Переглянути джерело

Multisell floodprotection.
Feel free to change default values in floodprotector.properties
Tnx to momo61 for reporting.

_DS_ 16 роки тому
батько
коміт
1ec3b0f40d

+ 6 - 1
L2_GameServer/java/config/floodprotector.properties

@@ -63,4 +63,9 @@ FloodProtectorServerBypassInterval = 5
 FloodProtectorServerBypassLogFlooding = False
 FloodProtectorServerBypassPunishmentLimit = 0
 FloodProtectorServerBypassPunishmentType = none
-FloodProtectorServerBypassPunishmentTime = 0
+FloodProtectorServerBypassPunishmentTime = 0
+FloodProtectorMultiSellInterval = 1
+FloodProtectorMultiSellLogFlooding = False
+FloodProtectorMultiSellPunishmentLimit = 0
+FloodProtectorMultiSellPunishmentType = none
+FloodProtectorMultiSellPunishmentTime = 0

+ 2 - 0
L2_GameServer/java/net/sf/l2j/Config.java

@@ -373,6 +373,8 @@ public final class Config
 		new FloodProtectorConfig("DropItemFloodProtector");
 	public static final FloodProtectorConfig FLOOD_PROTECTOR_SERVER_BYPASS =
 		new FloodProtectorConfig("ServerBypassFloodProtector");
+	public static final FloodProtectorConfig FLOOD_PROTECTOR_MULTISELL =
+		new FloodProtectorConfig("MultiSellFloodProtector");
 	public static boolean ALLOW_DISCARDITEM;
 	public static int AUTODESTROY_ITEM_AFTER;
 	public static int HERB_AUTO_DESTROY_TIME;

+ 7 - 4
L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/MultiSellChoose.java

@@ -96,6 +96,13 @@ public class MultiSellChoose extends L2GameClientPacket
 	@Override
 	public void runImpl()
 	{
+		L2PcInstance player = getClient().getActiveChar();
+		if (player == null)
+			return;
+
+		if (!player.getFloodProtectors().getMultiSell().tryPerformAction("multisell choose"))
+			return;
+
 		if (_amount < 1 || _amount > 5000)
 			return;
 		
@@ -103,10 +110,6 @@ public class MultiSellChoose extends L2GameClientPacket
 		if (list == null)
 			return;
 		
-		L2PcInstance player = getClient().getActiveChar();
-		if (player == null)
-			return;
-		
 		for (MultiSellEntry entry : list.getEntries())
 		{
 			if (entry.getEntryId() == _entryId)

+ 16 - 0
L2_GameServer/java/net/sf/l2j/gameserver/util/FloodProtectors.java

@@ -55,6 +55,10 @@ public final class FloodProtectors
 	 * Server-bypass flood protector.
 	 */
 	private final FloodProtectorAction _serverBypass;
+	/**
+	 * Multisell flood protector.
+	 */
+	private final FloodProtectorAction _multiSell;
 	
 	/**
 	 * Creates new instance of FloodProtectors.
@@ -73,6 +77,7 @@ public final class FloodProtectors
 		_subclass = new FloodProtectorAction(player, Config.FLOOD_PROTECTOR_SUBCLASS);
 		_dropItem = new FloodProtectorAction(player, Config.FLOOD_PROTECTOR_DROP_ITEM);
 		_serverBypass = new FloodProtectorAction(player, Config.FLOOD_PROTECTOR_SERVER_BYPASS);
+		_multiSell = new FloodProtectorAction(player, Config.FLOOD_PROTECTOR_MULTISELL);
 	}
 	
 	/**
@@ -154,4 +159,15 @@ public final class FloodProtectors
 	{
 		return _serverBypass;
 	}
+
+	/**
+	 * Returns {@link #_multisell}.
+	 * 
+	 * @return {@link #_multisell}
+	 */
+	public FloodProtectorAction getMultiSell()
+	{
+		return _multiSell;
+	}
+
 }