Jump to content
  • 0

Help In Adapting Status Limiter For Acis 354


l2jkain

Question

Hello, I'm looking for an update on triskell but I found a very important mod a status limiter wanted help to improve the code following what it has in the code works 100% but I lose many lines that have on the acis and I do not know What these lines represent
 
Like this here
 
Return (int) calcStat (Stats.POWER_ATTACK_SPEED, base, null, null);
 
I do not know how to code
 
Int val = super.getPAtkSpd ();
 
If ((val> Config.MAX_PATK_SPEED) && (! GetActiveChar (). IsGM ()))
{
Return Config.MAX_PATK_SPEED;
}
Return val;
 
 
 
Codigo :
 
### 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

 

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0
int val = super.getPAtkSpd ();
 
If ((val> Config.MAX_PATK_SPEED) && (! GetActiveChar (). IsGM ()))
{
Return Config.MAX_PATK_SPEED;
}
Return val;
 

Its not hard to make a "guess",even if u arent familiar with L2J or anything at all.Its not ASM lol..

 

The code works like "limiter" for non GM chars.

No char will have higher attspeed than this one Config.MAX_PATK_SPEED; 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock