Noticias:

Debes de estar registrado para poder ver el contenido indicado. Registrate o Conectate

Menú Principal

Buff Protection

Iniciado por Swarlog, Ago 16, 2022, 02:35 AM

Tema anterior - Siguiente tema

Swarlog

Con esta implementación, permites o no el que puedan darte buffos. Muy bueno para cuando este ya full bufado y no te den buffos malos los de clanes rivales.

Comandos: ".buffoff" // ".buffon"

CORE:

Index: dist/game/config/Character.properties
===================================================================
--- dist/game/config/Character.properties (revision 6245)
+++ dist/game/config/Character.properties (working copy)
@@ -843,4 +843,11 @@
 # When enabled pvp skills will not be casted on non flagged player.
 # Sadly its non-retail
 # Default: False
-AltValidateTriggerSkills = False
\ No newline at end of file
+AltValidateTriggerSkills = False
+
+# ---------------------------------------------------------------------------
+# Grief Buff Protection:
+# ---------------------------------------------------------------------------
+# The list of buffs to protect the players from, when they are using ".buffoff" command.
+# Help & Support: http://www.l2board.com/
+PreventedBuffs = 264,265,266,267,268,269,270,271,272,273,274,275,276,277,304,305,306,307,308,309,310,310,311,349,363,364,365,366,530,529,4342,4343,4344,4345,4346,4347,4348,4349,4350,4351,4352,4353,4354,4355,4356,4357,4358,4359,4360,1388,1389,1303,1355,1356,1357,1352,1414,1397,1353,1259,1087,1304,1499,1500,1501,1502,1503,1504,1002,1006,1007,1009,1229,1251,1252,1253,1284,1310,1308,1309,1362,1363,1413,1390,1391,1461,1517,1518,1519,4699,4700,4702,4703,1040,1240,1085,1062,1035,1036,1078,1354,1086,765,1392,1393,1182,1189,1191,1043,915,1033,1044,1068,1073,1204,1243,1257,1259,1304,1355,1393,1460,1077,1032,1045,1048,1242,1059,1268,825,826,827,828,829,830,1307,1542,1364,914,528,789,982,787,1416,1256,1374,834
\ No newline at end of file
Index: java/com/l2jserver/Config.java
===================================================================
--- java/com/l2jserver/Config.java (revision 6245)
+++ java/com/l2jserver/Config.java (working copy)
@@ -50,6 +50,8 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import javolution.util.FastList;
+
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 
@@ -258,6 +260,8 @@
  public static String[] FORBIDDEN_NAMES;
  public static boolean SILENCE_MODE_EXCLUDE;
  public static boolean ALT_VALIDATE_TRIGGER_SKILLS;
+ public static String PREVENTED_BUFFS;
+ public static FastList<Integer> PREVENTED_BUFFS_LIST = new FastList<Integer>();
 
  // --------------------------------------------------
  // ClanHall Settings
@@ -1806,6 +1810,11 @@
    ALT_VALIDATE_TRIGGER_SKILLS = Boolean.parseBoolean(Character.getProperty("AltValidateTriggerSkills", "False"));
    PLAYER_MOVEMENT_BLOCK_TIME = Integer.parseInt(Character.getProperty("NpcTalkBlockingTime", "0")) * 1000;
   
+   PREVENTED_BUFFS = Character.getProperty("PreventedBuffs");
+   PREVENTED_BUFFS_LIST = new FastList<Integer>();
+   for (String id : PREVENTED_BUFFS.trim().split(","))
+   PREVENTED_BUFFS_LIST.add(Integer.parseInt(id.trim()));
+   
    // Load L2J Server Version L2Properties file (if exists)
    L2Properties serverVersion = new L2Properties();
    final File server_ver = new File(SERVER_VERSION_FILE);
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 6245)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -16427,4 +16427,17 @@
  {
   return _eventListeners;
  }
+
+ private boolean _buffoff = false;
+ public void setBuffOff(boolean nobuff)
+    {
+  _buffoff = nobuff;
+    }
+
+ @Override
+ public boolean isBuffOff()
+    {
+
+  return _buffoff;
+    }
 }
\ No newline at end of file
Index: java/com/l2jserver/gameserver/model/L2Object.java
===================================================================
--- java/com/l2jserver/gameserver/model/L2Object.java (revision 6245)
+++ java/com/l2jserver/gameserver/model/L2Object.java (working copy)
@@ -920,4 +920,10 @@
   }
   return (T) _scripts.get(script.getName());
  }
+
+ public boolean isBuffOff()
+    {
+  L2PcInstance player = getActingPlayer();
+  return (player == null ? false : player.isBuffOff());
+ }
 }
\ No newline at end of file
Index: java/com/l2jserver/gameserver/model/skills/L2Skill.java
===================================================================
--- java/com/l2jserver/gameserver/model/skills/L2Skill.java (revision 6245)
+++ java/com/l2jserver/gameserver/model/skills/L2Skill.java (working copy)
@@ -1440,6 +1440,13 @@
   
   if (effector != effected)
   {
+   if ((effector instanceof L2PcInstance && (Config.PREVENTED_BUFFS_LIST.contains(_id))) && effected instanceof L2PcInstance && (((L2PcInstance)effected).isBuffOff()))
+   {
+    return _emptyEffectSet;
+   }
+  }
+  if (effector != effected)
+  {
    if (isOffensive() || isDebuff())
    {
     if (effected.isInvul())

DATA:

Index: dist/game/data/scripts/handlers/MasterHandler.java
===================================================================
--- dist/game/data/scripts/handlers/MasterHandler.java (revision 9982)
+++ dist/game/data/scripts/handlers/MasterHandler.java (working copy)
@@ -291,6 +291,7 @@
 import handlers.usercommandhandlers.PartyInfo;
 import handlers.usercommandhandlers.Time;
 import handlers.usercommandhandlers.Unstuck;
+import handlers.voicedcommandhandlers.AntiBuff;
 import handlers.voicedcommandhandlers.Banking;
 import handlers.voicedcommandhandlers.ChangePassword;
 import handlers.voicedcommandhandlers.ChatAdmin;
@@ -570,6 +571,7 @@
   {
    // Voiced Command Handlers
    StatsVCmd.class,
+   AntiBuff.class,
    // TODO: Add configuration options for this voiced commands:
    // CastleVCmd.class,
    // SetVCmd.class,
Index: dist/game/data/scripts/handlers/voicedcommandhandlers/AntiBuff.java
===================================================================
--- dist/game/data/scripts/handlers/voicedcommandhandlers/AntiBuff.java (revision 0)
+++ dist/game/data/scripts/handlers/voicedcommandhandlers/AntiBuff.java (working copy)
@@ -0,0 +1,48 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** Author: Extreme
+ ** Support: http://www.l2board.com/
+ **/
+
+package handlers.voicedcommandhandlers;
+
+import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+public class AntiBuff implements IVoicedCommandHandler
+{
+    private static final String[] VOICED_COMMANDS = { "buff_off", "buffoff", "buff_on", "buffon" };
+
+    public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+    {
+        if (command.equalsIgnoreCase("buff_off") || command.equalsIgnoreCase("buffoff"))
+        {   
+           activeChar.setBuffOff(true);
+           activeChar.sendMessage("Anti Buff Enabled!");
+        }   
+        else if (command.equalsIgnoreCase("buff_on") || command.equalsIgnoreCase("buffon"))
+        {   
+           activeChar.setBuffOff(false);
+           activeChar.sendMessage("Anti Buff Disabled!");
+        }   
+        return true;
+    }
+   
+    public String[] getVoicedCommandList()
+    {
+        return VOICED_COMMANDS;
+     }
+}