View difference between Paste ID: Aw9XK7d9 and vbee3SEh
SHOW: | | - or go back to the newest paste.
1
diff --git a/config/CustomMods/ProtectionMods.ini b/config/CustomMods/ProtectionMods.ini
2
index c476345..a877b86 100644
3
--- a/config/CustomMods/ProtectionMods.ini
4
+++ b/config/CustomMods/ProtectionMods.ini
5
@@ -53,3 +53,16 @@
6
 # Recomended is True ( Official = False )
7
 PvPSumon = False
8
 
9
+#=============================================================
10
+#                   Anti Hervy System
11
+#=============================================================
12
+# Enable or Disable anti-heavy system.
13
+# Dagger, tyrant, and bow classes won't be able to equip heavy type armours.
14
+EnableAntiHeavySystem = True
15
+
16
+#Screen Message Anti Hervy Class user
17
+ScreenAntiHervyMessageText = Your Class Can't Equip Heavy Type Armors!
18
+
19
+# Show screen AntiHervy message for x seconds when character
20
+ScreenAntiHervyMessageTime = 4
21
+
22
diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java
23
index ffaa2f8..055f23e 100644
24
--- a/java/net/sf/l2j/Config.java
25
+++ b/java/net/sf/l2j/Config.java
26
@@ -85,6 +85,9 @@
27
 	/** Clan Hall function */
28
 	public static boolean PVP_SAME_IP;
29
     public static boolean PVP_SUMON;
30
+    public static boolean ENABLE_ANTI_HEAVY;
31
+	public static String WELCOME_MESSAGE_ANTIHERVY;
32
+	public static int WELCOME_MESSAGE_TIME_ANTIHERVY;
33
 	public static long CH_TELE_FEE_RATIO;
34
 	public static int CH_TELE1_FEE;
35
 	public static int CH_TELE2_FEE;
36
@@ -1123,6 +1126,9 @@
37
          SHOUT_RESTRICTION_VALUE = Integer.parseInt(Protection.getProperty("ShoutRestrictionValue", "0"));
38
          PVP_SAME_IP = Boolean.parseBoolean(Protection.getProperty("PvPSameIP", "False"));
39
          PVP_SUMON = Boolean.parseBoolean(Protection.getProperty("PvPSumon", "False"));
40
+         ENABLE_ANTI_HEAVY = Boolean.parseBoolean(Protection.getProperty("EnableAntiHeavySystem", "True"));
41
+         WELCOME_MESSAGE_ANTIHERVY = Protection.getProperty("ScreenAntiHervyMessageText", "Your Class Can't Equip Heavy Type Armors!");
42
+         WELCOME_MESSAGE_TIME_ANTIHERVY = Integer.parseInt(Protection.getProperty("ScreenAntiHervyMessageTime", "6")) * 1000;
43
 	}
44
 	
45
 	private static final void loadOff()
46
diff --git a/java/net/sf/l2j/gameserver/network/clientpackets/UseItem.java b/java/net/sf/l2j/gameserver/network/clientpackets/UseItem.java
47
index f3eb170..df7dd43 100644
48
--- a/java/net/sf/l2j/gameserver/network/clientpackets/UseItem.java
49
+++ b/java/net/sf/l2j/gameserver/network/clientpackets/UseItem.java
50
@@ -3,6 +3,7 @@
51
 import net.sf.l2j.Config;
52
 import net.sf.l2j.gameserver.enums.Paperdoll;
53
 import net.sf.l2j.gameserver.enums.items.ActionType;
54
+import net.sf.l2j.gameserver.enums.items.ArmorType;
55
 import net.sf.l2j.gameserver.enums.items.EtcItemType;
56
 import net.sf.l2j.gameserver.enums.items.WeaponType;
57
 import net.sf.l2j.gameserver.enums.skills.SkillType;
58
@@ -14,6 +15,7 @@
59
 import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
60
 import net.sf.l2j.gameserver.model.item.kind.Item;
61
 import net.sf.l2j.gameserver.network.SystemMessageId;
62
+import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;
63
 import net.sf.l2j.gameserver.network.serverpackets.ItemList;
64
 import net.sf.l2j.gameserver.network.serverpackets.PetItemList;
65
 import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
66
@@ -67,7 +69,16 @@
67
 		
68
 		if (player.isAlikeDead() || player.isStunned() || player.isSleeping() || player.isParalyzed() || player.isAfraid())
69
 			return;
70
-		
71
+		if (Config.ENABLE_ANTI_HEAVY && item.getItemType() == ArmorType.HEAVY) {
72
+			if (player.getClassId().getId() == 48 || player.getClassId().getId() == 114 || player.getClassId().getId() == 109
73
+				|| player.getClassId().getId() == 37 || player.getClassId().getId() == 108 || player.getClassId().getId() == 36
74
+				|| player.getClassId().getId() == 102 || player.getClassId().getId() == 24 || player.getClassId().getId() == 101
75
+				|| player.getClassId().getId() == 23 || player.getClassId().getId() == 93 || player.getClassId().getId() == 8
76
+				|| player.getClassId().getId() == 92 || player.getClassId().getId() == 9) {
77
+				player.sendPacket(new ExShowScreenMessage(Config.WELCOME_MESSAGE_ANTIHERVY, Config.WELCOME_MESSAGE_TIME_ANTIHERVY));
78
+				return;
79
+			}
80
+		}
81
 		if (!Config.KARMA_PLAYER_CAN_TELEPORT && player.getKarma() > 0)
82
 		{
83
 			final IntIntHolder[] sHolders = item.getItem().getSkills();
84