Autor Tema: [IMP] Limitador de Status  (Leído 912 veces)

Mayo 05, 2015, 12:50:30 pm

Desconectado Danarys

  • Vips
  • Usuario
  • *
  • Mensajes: 220
  • Karma: 0
  • Sexo: Femenino



Código: You are not allowed to view links. Register or Login
### Eclipse Workspace Patch 1.0
#P aCis_gameserver
Index: java/net/sf/l2j/gameserver/model/actor/stat/CharStat.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/stat/CharStat.java (revision 104)
+++ java/net/sf/l2j/gameserver/model/actor/stat/CharStat.java (working copy)
@@ -153,10 +153,20 @@
   * @param skill
   * @return the Critical Hit rate (base+modifier) of the L2Character.
   */
- public int getCriticalHit(L2Character target, L2Skill skill)
- {
- return Math.min((int) calcStat(Stats.CRITICAL_RATE, _activeChar.getTemplate().getBaseCritRate(), target, skill), 500);
- }
+         public int getCriticalHit(L2Character target, L2Skill skill)
+         {
+           if (_activeChar == null)
+           {
+             return 1;
+           }
+
+           int criticalHit = Math.min((int)calcStat(Stats.CRITICAL_RATE, _activeChar.getTemplate().getBaseCritRate(), target, skill), 500);
+
+           if (criticalHit > Config.MAX_PCRIT_RATE) {
+             criticalHit = Config.MAX_PCRIT_RATE;
+           }
+           return criticalHit;
+         }
 
  /**
   * @param target
@@ -163,19 +173,39 @@
   * @param skill
   * @return the Magic Critical Hit rate (base+modifier) of the L2Character.
   */
- public final int getMCriticalHit(L2Character target, L2Skill skill)
- {
- return (int) calcStat(Stats.MCRITICAL_RATE, 8, target, skill);
- }
+       public final int getMCriticalHit(L2Character target, L2Skill skill)
+       {
+        if (_activeChar == null)
+           {
+             return 1;
+               }
+       
+           double mrate = calcStat(Stats.MCRITICAL_RATE, 8.0D, target, skill);
+
+               if (mrate > Config.MAX_MCRIT_RATE) {
+                 mrate = Config.MAX_MCRIT_RATE;
+           }
+                 return (int)mrate;
+        }
 
  /**
   * @param target
   * @return the Attack Evasion rate (base+modifier) of the L2Character.
   */
- public int getEvasionRate(L2Character target)
- {
- return (int) calcStat(Stats.EVASION_RATE, 0, target, null);
- }
+       public int getEvasionRate(L2Character target)
+       {
+         if (_activeChar == null)
+         {
+           return 1;
+         }
+         int val = (int)Math.round(calcStat(Stats.EVASION_RATE, 0.0D, target, null));
+
+         if ((val > Config.MAX_EVASION) && (!_activeChar.isGM()))
+         {
+           val = Config.MAX_EVASION;
+         }
+         return val;
+       }
 
  /**
   * @return the Accuracy (base+modifier) of the L2Character in function of the Weapon Expertise Penalty.
@@ -182,7 +212,17 @@
   */
  public int getAccuracy()
  {
- return (int) calcStat(Stats.ACCURACY_COMBAT, 0, null, null);
+        if (_activeChar == null)
+        {
+          return 1;
+        }
+        int val = (int)Math.round(calcStat(Stats.ACCURACY_COMBAT, 0.0D, null, null));
+
+        if ((val > Config.MAX_ACCURACY) && (!_activeChar.isGM()))
+        {
+          val = Config.MAX_ACCURACY;
+        }
+        return val;
  }
 
  public int getMaxHp()
Index: config/aCis.properties
===================================================================
--- config/aCis.properties (revision 104)
+++ config/aCis.properties (working copy)
@@ -82,3 +82,40 @@
 # Players can see in the upper chat who dies in pvp and pk
 # Default : False
 AnnounceKillPLayers = true
+
+#=============================================================
+#                            Limits
+#=============================================================
+
+# Run speed modifier. Example: Setting this to 5 will
+# give players +5 to their running speed.
+# Default: 0
+RunSpeedBoost = 0
+
+# Maximum character running speed.
+# Default: 250
+MaxRunSpeed = 250
+
+# Maximum character Physical Critical Rate. (10 = 1%)
+# Default: 500
+MaxPCritRate = 500
+
+# Maximum character Magic Critical Rate. (10 = 1%)
+# Default: 200
+MaxMCritRate = 200
+
+# Maximum character Attack Speed.
+# Default: 1500
+MaxPAtkSpeed = 1500
+
+# Maximum character Cast Speed.
+# Default: 1999
+MaxMAtkSpeed = 1999
+
+# Maximum character Evasion.
+# Default: 250
+MaxEvasion = 250
+
+# Maxmum character Accuracy
+# Default: 300
+MaxAccuracy = 300
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java (revision 104)
+++ java/net/sf/l2j/Config.java (working copy)
@@ -401,6 +401,15 @@
     public static boolean ENABLE_MODIFY_SKILL_DURATION;
     public static Map<Integer, Integer> SKILL_DURATION_LIST;
     public static boolean ANNOUNCE_KILL;
+    /** Limits */
+    public static int RUN_SPD_BOOST;
+    public static int MAX_RUN_SPEED;
+    public static int MAX_PCRIT_RATE;
+    public static int MAX_MCRIT_RATE;
+    public static int MAX_PATK_SPEED;
+    public static int MAX_MATK_SPEED;
+    public static int MAX_EVASION;
+    public static int MAX_ACCURACY;
 
  // --------------------------------------------------
  // Players
@@ -947,8 +956,15 @@
  }
  }
  ANNOUNCE_KILL = aCis.getProperty("AnnounceKillPLayers", false);
+            RUN_SPD_BOOST = aCis.getProperty("RunSpeedBoost", 0);
+            MAX_RUN_SPEED = aCis.getProperty("MaxRunSpeed", 250);
+            MAX_PCRIT_RATE = aCis.getProperty("MaxPCritRate", 500);
+            MAX_MCRIT_RATE = aCis.getProperty("MaxMCritRate", 200);
+            MAX_PATK_SPEED = aCis.getProperty("MaxPAtkSpeed", 1500);
+            MAX_MATK_SPEED = aCis.getProperty("MaxMAtkSpeed", 1999);
+            MAX_EVASION = aCis.getProperty("MaxEvasion", 250);
+            MAX_ACCURACY = aCis.getProperty("MaxAccuracy", 300);
 
-
  // NPCs / Monsters
  ExProperties npcs = load(NPCS_FILE);
  CHAMPION_FREQUENCY = npcs.getProperty("ChampionFrequency", 0);
Index: java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java (revision 104)
+++ java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java (working copy)
@@ -330,46 +330,61 @@
  else
  val = super.getRunSpeed();
 
- final int penalty = getActiveChar().getExpertiseArmorPenalty();
- if (penalty > 0)
- val *= Math.pow(0.84, penalty);
-
- return val;
+        val += Config.RUN_SPD_BOOST;
+
+        if ((val > Config.MAX_RUN_SPEED) && (!getActiveChar().isGM()))
+        {
+          return Config.MAX_RUN_SPEED;
+        }
+        return val;
  }
 
  @Override
- public int getMAtkSpd()
- {
- int val = super.getMAtkSpd();
-
- final int penalty = getActiveChar().getExpertiseArmorPenalty();
- if (penalty > 0)
- val *= Math.pow(0.84, penalty);
-
- return val;
- }
+    public int getMAtkSpd()
+    {
+      int val = super.getMAtkSpd();
+
+      if ((val > Config.MAX_MATK_SPEED) && (!getActiveChar().isGM()))
+      {
+        return Config.MAX_MATK_SPEED;
+      }
+      return val;
+    }
 
+    @Override
+ public int getPAtkSpd()
+    {
+      int val = super.getPAtkSpd();
+
+      if ((val > Config.MAX_PATK_SPEED) && (!getActiveChar().isGM()))
+      {
+        return Config.MAX_PATK_SPEED;
+      }
+      return val;
+    }
+   
  @Override
- public int getEvasionRate(L2Character target)
- {
- int val = super.getEvasionRate(target);
-
- final int penalty = getActiveChar().getExpertiseArmorPenalty();
- if (penalty > 0)
- val -= (2 * penalty);
-
- return val;
- }
+    public int getEvasionRate(L2Character target)
+    {
+      int val = super.getEvasionRate(target);
+
+      if ((val > Config.MAX_EVASION) && (!getActiveChar().isGM()))
+      {
+        return Config.MAX_EVASION;
+      }
+      return val;
+    }
 
  @Override
  public int getAccuracy()
  {
- int val = super.getAccuracy();
-
- if (getActiveChar().getExpertiseWeaponPenalty())
- val -= 20;
-
- return val;
+        int val = super.getAccuracy();
+
+        if ((val > Config.MAX_ACCURACY) && (!getActiveChar().isGM()))
+        {
+          return Config.MAX_ACCURACY;
+        }
+        return val;
  }
 
  @Override

Créditos de autor: ????????
Créditos por compartir: wallister
Créditos por compartir: Blackzer0