Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2jFrozen_GameServer
- Index: head-src/com/l2jfrozen/Config.java
- ===================================================================
- --- head-src/com/l2jfrozen/Config.java (revision 987)
- +++ head-src/com/l2jfrozen/Config.java (working copy)
- @@ -2891,6 +2891,9 @@
- public static int GM_OVER_ENCHANT;
- public static int MAX_ITEM_ENCHANT_KICK;
- + public static boolean ENABLE_ENCHANT_ANNOUNCE;
- + public static String ENCHANT_ANNOUNCE_LEVEL;
- + public static FastList<Integer> LIST_ENCHANT_ANNOUNCE_LEVEL = new FastList<Integer>();
- //============================================================
- public static void loadEnchantConfig()
- @@ -3196,6 +3199,13 @@
- MAX_ITEM_ENCHANT_KICK = Integer.parseInt(ENCHANTSetting.getProperty("EnchantKick", "0"));
- GM_OVER_ENCHANT = Integer.parseInt(ENCHANTSetting.getProperty("GMOverEnchant", "0"));
- + ENABLE_ENCHANT_ANNOUNCE = Boolean.parseBoolean(ENCHANTSetting.getProperty("EnableEnchantAnnounce", "False"));
- + ENCHANT_ANNOUNCE_LEVEL = ENCHANTSetting.getProperty("EnchantAnnounceLevels", "6,10,16,20");
- + LIST_ENCHANT_ANNOUNCE_LEVEL = new FastList<Integer>();
- + for (String id : ENCHANT_ANNOUNCE_LEVEL.split(","))
- + {
- + LIST_ENCHANT_ANNOUNCE_LEVEL.add(Integer.parseInt(id));
- + }
- }
- catch(Exception e)
- {
- Index: head-src/com/l2jfrozen/gameserver/model/entity/Announcements.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/model/entity/Announcements.java (revision 987)
- +++ head-src/com/l2jfrozen/gameserver/model/entity/Announcements.java (working copy)
- @@ -42,6 +42,7 @@
- import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
- import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
- import com.l2jfrozen.gameserver.script.DateRange;
- +import com.l2jfrozen.gameserver.util.Broadcast;
- /**
- * @author ProGramMoS
- @@ -292,6 +293,12 @@
- player.sendPacket(sm);
- }
- }
- +
- + public static void announceInRegion(L2PcInstance activeChar, String text)
- + {
- + CreatureSay cs = new CreatureSay(0, 18, "", text);
- + Broadcast.toPlayersInSameRegion(activeChar, cs);
- + }
- // Method fo handling announcements from admin
- public void handleAnnounce(String command, int lengthToTrim)
- Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java (revision 987)
- +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java (working copy)
- @@ -25,10 +25,12 @@
- import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
- import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jfrozen.gameserver.model.base.Race;
- +import com.l2jfrozen.gameserver.model.entity.Announcements;
- import com.l2jfrozen.gameserver.network.SystemMessageId;
- import com.l2jfrozen.gameserver.network.serverpackets.EnchantResult;
- import com.l2jfrozen.gameserver.network.serverpackets.InventoryUpdate;
- import com.l2jfrozen.gameserver.network.serverpackets.ItemList;
- +import com.l2jfrozen.gameserver.network.serverpackets.MagicSkillUser;
- import com.l2jfrozen.gameserver.network.serverpackets.StatusUpdate;
- import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
- import com.l2jfrozen.gameserver.templates.L2Item;
- @@ -301,6 +303,7 @@
- int chance = 0;
- int maxEnchantLevel = 0;
- int minEnchantLevel = 0;
- + int nextEnchantLevel = item.getEnchantLevel() + 1;
- if(item.getItem().getType2() == L2Item.TYPE2_WEAPON)
- {
- @@ -565,6 +568,14 @@
- sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED);
- sm.addItemName(item.getItemId());
- activeChar.sendPacket(sm);
- +
- + if (Config.ENABLE_ENCHANT_ANNOUNCE && Config.LIST_ENCHANT_ANNOUNCE_LEVEL.contains(nextEnchantLevel))
- + {
- + Announcements.announceInRegion(activeChar, "Congratulations to " + activeChar.getName() + "! Your " + item.getItem() + " has been successfully enchanted to +" + nextEnchantLevel);
- + MagicSkillUser MSU = new MagicSkillUser(activeChar, activeChar, 2025, 1, 1, 0);
- + activeChar.sendPacket(MSU);
- + activeChar.broadcastPacket(MSU);
- + }
- }
- else
- {
- @@ -572,6 +583,14 @@
- sm.addNumber(item.getEnchantLevel());
- sm.addItemName(item.getItemId());
- activeChar.sendPacket(sm);
- +
- + if (Config.ENABLE_ENCHANT_ANNOUNCE && Config.LIST_ENCHANT_ANNOUNCE_LEVEL.contains(nextEnchantLevel))
- + {
- + Announcements.announceInRegion(activeChar, "Congratulations to " + activeChar.getName() + "! Your " + item.getItem() + " has been successfully enchanted to +" + nextEnchantLevel);
- + MagicSkillUser MSU = new MagicSkillUser(activeChar, activeChar, 2025, 1, 1, 0);
- + activeChar.sendPacket(MSU);
- + activeChar.broadcastPacket(MSU);
- + }
- }
- item.setEnchantLevel(item.getEnchantLevel() + Config.CUSTOM_ENCHANT_VALUE);
- Index: head-src/com/l2jfrozen/gameserver/util/Broadcast.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/util/Broadcast.java (revision 987)
- +++ head-src/com/l2jfrozen/gameserver/util/Broadcast.java (working copy)
- @@ -32,6 +32,7 @@
- import java.util.logging.Logger;
- import com.l2jfrozen.Config;
- +import com.l2jfrozen.gameserver.datatables.csv.MapRegionTable;
- import com.l2jfrozen.gameserver.model.L2Character;
- import com.l2jfrozen.gameserver.model.L2World;
- import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- @@ -243,4 +244,26 @@
- onlinePlayer.sendPacket(mov);
- }
- }
- +
- + public static void toPlayersInSameRegion(L2PcInstance player, L2GameServerPacket mov)
- + {
- + int curRegion = MapRegionTable.getInstance().getMapRegion(player.getX(), player.getY());
- + if (Config.DEBUG)
- + {
- + _log.fine("Players to notify: " + L2World.getAllPlayersCount() + " (with packet " + mov.getType() + ")");
- + }
- +
- + for (L2PcInstance target : L2World.getInstance().getAllPlayers())
- + {
- + if (target == null)
- + {
- + continue;
- + }
- +
- + if (curRegion == MapRegionTable.getInstance().getMapRegion(target.getX(), target.getY()))
- + {
- + target.sendPacket(mov);
- + }
- + }
- + }
- }
- Index: config/head/enchant.properties
- ===================================================================
- --- config/head/enchant.properties (revision 987)
- +++ config/head/enchant.properties (working copy)
- @@ -131,4 +131,15 @@
- # HOW WORKS: if you set it to 20, and player have an item > 20
- # he will be kicked and the item will disappear!
- # Enchant amount at which a player gets punished (0 disabled)
- -EnchantKick = 0
- \ No newline at end of file
- +EnchantKick = 0
- +
- +# ----------------------
- +# Enchant Announce -
- +# ----------------------
- +# Announce when a player successfully enchant an item to x
- +# Default: False
- +EnableEnchantAnnounce = False
- +
- +# The value of x is... set it here (separated by comma) e.g: 5,10,20,35,...
- +# NOTE: Dont have default value!
- +EnchantAnnounceLevels = 6,10,16,20
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement