SHOW:
|
|
- or go back to the newest paste.
| 1 | ### Eclipse Workspace Patch 1.0 | |
| 2 | #P L2jFrozen_GameServer | |
| 3 | Index: head-src/com/l2jfrozen/Config.java | |
| 4 | =================================================================== | |
| 5 | --- head-src/com/l2jfrozen/Config.java (revision 987) | |
| 6 | +++ head-src/com/l2jfrozen/Config.java (working copy) | |
| 7 | @@ -2891,6 +2891,9 @@ | |
| 8 | public static int GM_OVER_ENCHANT; | |
| 9 | public static int MAX_ITEM_ENCHANT_KICK; | |
| 10 | ||
| 11 | + public static boolean ENABLE_ENCHANT_ANNOUNCE; | |
| 12 | + public static String ENCHANT_ANNOUNCE_LEVEL; | |
| 13 | + public static FastList<Integer> LIST_ENCHANT_ANNOUNCE_LEVEL = new FastList<Integer>(); | |
| 14 | ||
| 15 | //============================================================ | |
| 16 | public static void loadEnchantConfig() | |
| 17 | @@ -3196,6 +3199,13 @@ | |
| 18 | MAX_ITEM_ENCHANT_KICK = Integer.parseInt(ENCHANTSetting.getProperty("EnchantKick", "0"));
| |
| 19 | GM_OVER_ENCHANT = Integer.parseInt(ENCHANTSetting.getProperty("GMOverEnchant", "0"));
| |
| 20 | ||
| 21 | + ENABLE_ENCHANT_ANNOUNCE = Boolean.parseBoolean(ENCHANTSetting.getProperty("EnableEnchantAnnounce", "False"));
| |
| 22 | + ENCHANT_ANNOUNCE_LEVEL = ENCHANTSetting.getProperty("EnchantAnnounceLevels", "6,10,16,20");
| |
| 23 | + LIST_ENCHANT_ANNOUNCE_LEVEL = new FastList<Integer>(); | |
| 24 | + for (String id : ENCHANT_ANNOUNCE_LEVEL.split(","))
| |
| 25 | + {
| |
| 26 | + LIST_ENCHANT_ANNOUNCE_LEVEL.add(Integer.parseInt(id)); | |
| 27 | + } | |
| 28 | } | |
| 29 | catch(Exception e) | |
| 30 | {
| |
| 31 | Index: head-src/com/l2jfrozen/gameserver/model/entity/Announcements.java | |
| 32 | =================================================================== | |
| 33 | --- head-src/com/l2jfrozen/gameserver/model/entity/Announcements.java (revision 987) | |
| 34 | +++ head-src/com/l2jfrozen/gameserver/model/entity/Announcements.java (working copy) | |
| 35 | @@ -42,6 +42,7 @@ | |
| 36 | import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage; | |
| 37 | import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage; | |
| 38 | import com.l2jfrozen.gameserver.script.DateRange; | |
| 39 | +import com.l2jfrozen.gameserver.util.Broadcast; | |
| 40 | ||
| 41 | /** | |
| 42 | * @author ProGramMoS | |
| 43 | @@ -292,6 +293,12 @@ | |
| 44 | player.sendPacket(sm); | |
| 45 | } | |
| 46 | } | |
| 47 | + | |
| 48 | + public static void announceInRegion(L2PcInstance activeChar, String text) | |
| 49 | + {
| |
| 50 | + CreatureSay cs = new CreatureSay(0, 18, "", text); | |
| 51 | + Broadcast.toPlayersInSameRegion(activeChar, cs); | |
| 52 | + } | |
| 53 | ||
| 54 | // Method fo handling announcements from admin | |
| 55 | public void handleAnnounce(String command, int lengthToTrim) | |
| 56 | Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java | |
| 57 | =================================================================== | |
| 58 | --- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java (revision 987) | |
| 59 | +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestEnchantItem.java (working copy) | |
| 60 | @@ -25,10 +25,12 @@ | |
| 61 | import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance; | |
| 62 | import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; | |
| 63 | import com.l2jfrozen.gameserver.model.base.Race; | |
| 64 | +import com.l2jfrozen.gameserver.model.entity.Announcements; | |
| 65 | import com.l2jfrozen.gameserver.network.SystemMessageId; | |
| 66 | import com.l2jfrozen.gameserver.network.serverpackets.EnchantResult; | |
| 67 | import com.l2jfrozen.gameserver.network.serverpackets.InventoryUpdate; | |
| 68 | import com.l2jfrozen.gameserver.network.serverpackets.ItemList; | |
| 69 | +import com.l2jfrozen.gameserver.network.serverpackets.MagicSkillUser; | |
| 70 | import com.l2jfrozen.gameserver.network.serverpackets.StatusUpdate; | |
| 71 | import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage; | |
| 72 | import com.l2jfrozen.gameserver.templates.L2Item; | |
| 73 | @@ -301,6 +303,7 @@ | |
| 74 | int chance = 0; | |
| 75 | int maxEnchantLevel = 0; | |
| 76 | int minEnchantLevel = 0; | |
| 77 | + int nextEnchantLevel = item.getEnchantLevel() + 1; | |
| 78 | ||
| 79 | if(item.getItem().getType2() == L2Item.TYPE2_WEAPON) | |
| 80 | {
| |
| 81 | @@ -565,6 +568,14 @@ | |
| 82 | sm = new SystemMessage(SystemMessageId.S1_SUCCESSFULLY_ENCHANTED); | |
| 83 | sm.addItemName(item.getItemId()); | |
| 84 | activeChar.sendPacket(sm); | |
| 85 | + | |
| 86 | + if (Config.ENABLE_ENCHANT_ANNOUNCE && Config.LIST_ENCHANT_ANNOUNCE_LEVEL.contains(nextEnchantLevel)) | |
| 87 | + {
| |
| 88 | + Announcements.announceInRegion(activeChar, "Congratulations to " + activeChar.getName() + "! Your " + item.getItem() + " has been successfully enchanted to +" + nextEnchantLevel); | |
| 89 | + MagicSkillUser MSU = new MagicSkillUser(activeChar, activeChar, 2025, 1, 1, 0); | |
| 90 | + activeChar.sendPacket(MSU); | |
| 91 | + activeChar.broadcastPacket(MSU); | |
| 92 | + } | |
| 93 | } | |
| 94 | else | |
| 95 | {
| |
| 96 | @@ -572,6 +583,14 @@ | |
| 97 | sm.addNumber(item.getEnchantLevel()); | |
| 98 | sm.addItemName(item.getItemId()); | |
| 99 | activeChar.sendPacket(sm); | |
| 100 | + | |
| 101 | + if (Config.ENABLE_ENCHANT_ANNOUNCE && Config.LIST_ENCHANT_ANNOUNCE_LEVEL.contains(nextEnchantLevel)) | |
| 102 | + {
| |
| 103 | + Announcements.announceInRegion(activeChar, "Congratulations to " + activeChar.getName() + "! Your " + item.getItem() + " has been successfully enchanted to +" + nextEnchantLevel); | |
| 104 | + MagicSkillUser MSU = new MagicSkillUser(activeChar, activeChar, 2025, 1, 1, 0); | |
| 105 | + activeChar.sendPacket(MSU); | |
| 106 | + activeChar.broadcastPacket(MSU); | |
| 107 | + } | |
| 108 | } | |
| 109 | ||
| 110 | item.setEnchantLevel(item.getEnchantLevel() + Config.CUSTOM_ENCHANT_VALUE); | |
| 111 | Index: head-src/com/l2jfrozen/gameserver/util/Broadcast.java | |
| 112 | =================================================================== | |
| 113 | --- head-src/com/l2jfrozen/gameserver/util/Broadcast.java (revision 987) | |
| 114 | +++ head-src/com/l2jfrozen/gameserver/util/Broadcast.java (working copy) | |
| 115 | @@ -32,6 +32,7 @@ | |
| 116 | import java.util.logging.Logger; | |
| 117 | ||
| 118 | import com.l2jfrozen.Config; | |
| 119 | +import com.l2jfrozen.gameserver.datatables.csv.MapRegionTable; | |
| 120 | import com.l2jfrozen.gameserver.model.L2Character; | |
| 121 | import com.l2jfrozen.gameserver.model.L2World; | |
| 122 | import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; | |
| 123 | @@ -243,4 +244,26 @@ | |
| 124 | onlinePlayer.sendPacket(mov); | |
| 125 | } | |
| 126 | } | |
| 127 | + | |
| 128 | + public static void toPlayersInSameRegion(L2PcInstance player, L2GameServerPacket mov) | |
| 129 | + {
| |
| 130 | + int curRegion = MapRegionTable.getInstance().getMapRegion(player.getX(), player.getY()); | |
| 131 | + if (Config.DEBUG) | |
| 132 | + {
| |
| 133 | + _log.fine("Players to notify: " + L2World.getAllPlayersCount() + " (with packet " + mov.getType() + ")");
| |
| 134 | + } | |
| 135 | + | |
| 136 | + for (L2PcInstance target : L2World.getInstance().getAllPlayers()) | |
| 137 | + {
| |
| 138 | + if (target == null) | |
| 139 | + {
| |
| 140 | + continue; | |
| 141 | + } | |
| 142 | + | |
| 143 | + if (curRegion == MapRegionTable.getInstance().getMapRegion(target.getX(), target.getY())) | |
| 144 | + {
| |
| 145 | + target.sendPacket(mov); | |
| 146 | + } | |
| 147 | + } | |
| 148 | + } | |
| 149 | } | |
| 150 | Index: config/head/enchant.properties | |
| 151 | =================================================================== | |
| 152 | --- config/head/enchant.properties (revision 987) | |
| 153 | +++ config/head/enchant.properties (working copy) | |
| 154 | @@ -131,4 +131,15 @@ | |
| 155 | # HOW WORKS: if you set it to 20, and player have an item > 20 | |
| 156 | # he will be kicked and the item will disappear! | |
| 157 | # Enchant amount at which a player gets punished (0 disabled) | |
| 158 | -EnchantKick = 0 | |
| 159 | \ No newline at end of file | |
| 160 | +EnchantKick = 0 | |
| 161 | + | |
| 162 | +# ---------------------- | |
| 163 | +# Enchant Announce - | |
| 164 | +# ---------------------- | |
| 165 | +# Announce when a player successfully enchant an item to x | |
| 166 | +# Default: False | |
| 167 | +EnableEnchantAnnounce = False | |
| 168 | + | |
| 169 | +# The value of x is... set it here (separated by comma) e.g: 5,10,20,35,... | |
| 170 | +# NOTE: Dont have default value! | |
| 171 | +EnchantAnnounceLevels = 6,10,16,20 |