SHOW:
|
|
- or go back to the newest paste.
1 | diff --git a/config/CustomMods/ProtectionMods.ini b/config/CustomMods/ProtectionMods.ini | |
2 | index 3aa6aed..e3de7d8 100644 | |
3 | --- a/config/CustomMods/ProtectionMods.ini | |
4 | +++ b/config/CustomMods/ProtectionMods.ini | |
5 | @@ -18,3 +18,15 @@ | |
6 | # How long character were suppose to stay in jail? (in minutes) | |
7 | PunishmentTime = 1 | |
8 | ||
9 | +#============================================================= | |
10 | +# Anti Enchant Warerouse | |
11 | +#============================================================= | |
12 | +#Enable Protection Anti Enchant Warehouse? | |
13 | +EnableProtectionEnchantWarehouse = True | |
14 | + | |
15 | +#Screen Message Enchant Forbidden use. | |
16 | +ScreenEnchantMessageText = Forbidden to Use Enchant near the bank! | |
17 | + | |
18 | +# Show screen Enchant message for x seconds when character. | |
19 | +ScreenEnchantMessageTime = 4 | |
20 | + | |
21 | diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java | |
22 | index 2fe4ba4..a88012b 100644 | |
23 | --- a/java/net/sf/l2j/Config.java | |
24 | +++ b/java/net/sf/l2j/Config.java | |
25 | @@ -139,6 +139,9 @@ | |
26 | public static int VALIDATION_TIME; | |
27 | public static int PUNISHMENT; | |
28 | public static int PUNISHMENT_TIME; | |
29 | + public static boolean PHX_ENCHANT_WAREHOUSE; | |
30 | + public static String WELCOME_MESSAGE_ENCHANT; | |
31 | + public static int WELCOME_MESSAGE_TIME_ENCHANT; | |
32 | // -------------------------------------------------- | |
33 | // Events settings | |
34 | // -------------------------------------------------- | |
35 | @@ -1106,6 +1109,9 @@ | |
36 | VALIDATION_TIME = Integer.parseInt(Protection.getProperty("ValidationTime", "60")); | |
37 | PUNISHMENT = Integer.parseInt(Protection.getProperty("Punishment", "0")); | |
38 | PUNISHMENT_TIME = Integer.parseInt(Protection.getProperty("PunishmentTime", "60")); | |
39 | + PHX_ENCHANT_WAREHOUSE = Boolean.parseBoolean(Protection.getProperty("EnableProtectionEnchantWarehouse", "false")); | |
40 | + WELCOME_MESSAGE_ENCHANT = Protection.getProperty("ScreenEnchantMessageText", "Forbidden to Use Enchant near the bank!"); | |
41 | + WELCOME_MESSAGE_TIME_ENCHANT = Integer.parseInt(Protection.getProperty("ScreenEnchantMessageTime", "6")) * 1000; | |
42 | } | |
43 | ||
44 | private static final void loadOff() | |
45 | diff --git a/java/net/sf/l2j/gameserver/network/clientpackets/RequestEnchantItem.java b/java/net/sf/l2j/gameserver/network/clientpackets/RequestEnchantItem.java | |
46 | index 50bda20..e114856 100644 | |
47 | --- a/java/net/sf/l2j/gameserver/network/clientpackets/RequestEnchantItem.java | |
48 | +++ b/java/net/sf/l2j/gameserver/network/clientpackets/RequestEnchantItem.java | |
49 | @@ -1,13 +1,19 @@ | |
50 | package net.sf.l2j.gameserver.network.clientpackets; | |
51 | ||
52 | +import java.util.List; | |
53 | + | |
54 | import net.sf.l2j.commons.random.Rnd; | |
55 | ||
56 | +import net.sf.l2j.Config; | |
57 | import net.sf.l2j.gameserver.data.SkillTable; | |
58 | import net.sf.l2j.gameserver.data.xml.ArmorSetData; | |
59 | import net.sf.l2j.gameserver.enums.Paperdoll; | |
60 | import net.sf.l2j.gameserver.enums.StatusType; | |
61 | import net.sf.l2j.gameserver.model.World; | |
62 | +import net.sf.l2j.gameserver.model.WorldObject; | |
63 | +import net.sf.l2j.gameserver.model.actor.Creature; | |
64 | import net.sf.l2j.gameserver.model.actor.Player; | |
65 | +import net.sf.l2j.gameserver.model.actor.instance.WarehouseKeeper; | |
66 | import net.sf.l2j.gameserver.model.item.ArmorSet; | |
67 | import net.sf.l2j.gameserver.model.item.instance.ItemInstance; | |
68 | import net.sf.l2j.gameserver.model.item.kind.Armor; | |
69 | @@ -15,6 +21,7 @@ | |
70 | import net.sf.l2j.gameserver.model.item.kind.Weapon; | |
71 | import net.sf.l2j.gameserver.network.SystemMessageId; | |
72 | import net.sf.l2j.gameserver.network.serverpackets.EnchantResult; | |
73 | +import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage; | |
74 | import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate; | |
75 | import net.sf.l2j.gameserver.network.serverpackets.ItemList; | |
76 | import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate; | |
77 | @@ -31,13 +38,23 @@ | |
78 | _objectId = readD(); | |
79 | } | |
80 | ||
81 | + @SuppressWarnings("null") | |
82 | @Override | |
83 | protected void runImpl() | |
84 | { | |
85 | final Player player = getClient().getPlayer(); | |
86 | + List<Creature> knowns = player.getKnownTypeInRadius(Creature.class, 400); | |
87 | if (player == null || _objectId == 0) | |
88 | return; | |
89 | - | |
90 | + if (Config.PHX_ENCHANT_WAREHOUSE) | |
91 | + for (WorldObject wh : knowns) | |
92 | + { | |
93 | + if (wh instanceof WarehouseKeeper) | |
94 | + { | |
95 | + player.sendPacket(new ExShowScreenMessage(Config.WELCOME_MESSAGE_ENCHANT, Config.WELCOME_MESSAGE_TIME_ENCHANT)); | |
96 | + return; | |
97 | + } | |
98 | + } | |
99 | if (!player.isOnline() || getClient().isDetached()) | |
100 | { | |
101 | player.setActiveEnchantItem(null); | |
102 |