All pastes #25763 Raw Edit

Someone

public text v1 · immutable
#25763 ·published 2005-10-17 17:55 UTC
rendered paste body
Index: D:/Programming/Eclipse/L2_GameServer/java/net/sf/l2j/gameserver/model/L2PcInstance.java
===================================================================
--- D:/Programming/Eclipse/L2_GameServer/java/net/sf/l2j/gameserver/model/L2PcInstance.java	(revision 1339)
+++ D:/Programming/Eclipse/L2_GameServer/java/net/sf/l2j/gameserver/model/L2PcInstance.java	(working copy)
@@ -52,6 +52,7 @@
 import net.sf.l2j.gameserver.SevenSignsFestival;
 import net.sf.l2j.gameserver.SkillTable;
 import net.sf.l2j.gameserver.SkillTreeTable;
+import net.sf.l2j.gameserver.TaskPriority;
 import net.sf.l2j.gameserver.Universe;
 import net.sf.l2j.gameserver.ai.CtrlIntention;
 import net.sf.l2j.gameserver.ai.L2CharacterAI;
@@ -98,6 +99,7 @@
 import net.sf.l2j.gameserver.serverpackets.SystemMessage;
 import net.sf.l2j.gameserver.serverpackets.TargetSelected;
 import net.sf.l2j.gameserver.serverpackets.UserInfo;
+import net.sf.l2j.gameserver.skills.Formulas;
 import net.sf.l2j.gameserver.skills.Stats;
 import net.sf.l2j.gameserver.templates.L2CharTemplate;
 import net.sf.l2j.gameserver.templates.L2Henna;
@@ -128,8 +130,14 @@
     public static final int STORE_PRIVATE_SELL = 1;
     public static final int STORE_PRIVATE_BUY = 3;
     public static final int STORE_PRIVATE_MANUFACTURE = 5;
+    
+    private static final String STR = "STR";
+    private static final String DEX = "DEX";
+    private static final String MEN = "STR";
+    private static final String WIT = "STR";
+    private static final String CON = "STR";
+    private static final String INT = "STR";
 
-
 	/** The table containing all minimum level needed for each Expertise (None, D, C, B, A, S)*/
 	private static final int[] EXPERTISE_LEVELS =
 	{
@@ -141,9 +149,8 @@
 		SkillTreeTable.getExpertiseLevel(5), //S
 	};
 
+    protected static Logger _log = Logger.getLogger(L2PcInstance.class.getName());
 
-    private static Logger _log = Logger.getLogger(L2PcInstance.class.getName());
-
 	public class AIAccessor extends L2Character.AIAccessor
 	{
 		protected AIAccessor() {}
@@ -389,6 +396,9 @@
     private boolean _hero = false;
     private int _team = 0;
     
+    /** Temp Values for stats **/
+    private int str, con, men, wit, dex, inte;
+    
 	/**
 	 * Create a new L2PcInstance and add it in the characters table of the database.<BR><BR>
 	 *
@@ -5847,4 +5857,107 @@
     {
         _nameColor = (red & 0xFF) + ((green & 0xFF) << 8) + ((blue & 0xFF) << 16);
     }
+    
+    class InvalidStatValue implements Runnable
+    {
+        String stat;
+        int statValue;
+        
+        public InvalidStatValue(String stat, int statValue)
+        {
+            this.stat = stat;
+            this.statValue = statValue;
+        }
+        
+        public void run()
+        {
+            String message  = "Player " + getName() + " has a " + stat + " value of " + stat;
+            _log.warning(message);
+            GmListTable.getInstance().broadcastMessageToGMs(message);
+        }
+    }
+
+    /**
+     * Return the STR of the L2Character (base+modifier).<BR><BR>
+     */
+    public int getSTR()
+    {
+        str = super.getSTR();
+        if (str >= Formulas.MAX_STAT_VALUE)
+        {
+            ClientScheduler.getInstance().scheduleAtFixedRate(new InvalidStatValue(STR, str), TaskPriority.PR_LOW, 500, 0);
+            return Formulas.MAX_STAT_VALUE - 1;
+        }
+        return str;
+    }
+
+    /**
+     * Return the COM of the L2Character (base+modifier).<BR><BR>
+     */
+    public int getCON()
+    {
+        con = super.getCON();
+        if (con >= Formulas.MAX_STAT_VALUE)
+        {
+            ClientScheduler.getInstance().scheduleAtFixedRate(new InvalidStatValue(CON, con), TaskPriority.PR_LOW, 500, 0);
+            return Formulas.MAX_STAT_VALUE - 1;
+        }
+        return con;
+    }
+
+    /**
+     * Return the DEX of the L2Character (base+modifier).<BR><BR>
+     */
+    public int getDEX()
+    {
+        dex = super.getDEX();
+        if (inte >= Formulas.MAX_STAT_VALUE)
+        {
+            ClientScheduler.getInstance().scheduleAtFixedRate(new InvalidStatValue(DEX, dex), TaskPriority.PR_LOW, 500, 0);
+            return Formulas.MAX_STAT_VALUE - 1;
+        }
+        return dex;
+    }
+
+    /**
+     * Return the INT of the L2Character (base+modifier).<BR><BR>
+     */
+    public int getINT()
+    {
+        inte = super.getINT();
+        if (inte >= Formulas.MAX_STAT_VALUE)
+        {
+            ClientScheduler.getInstance().scheduleAtFixedRate(new InvalidStatValue(INT, inte), TaskPriority.PR_LOW, 500, 0);
+            return Formulas.MAX_STAT_VALUE - 1;
+        }
+        return inte;
+    }
+
+    /**
+     * Return the WIT of the L2Character (base+modifier).<BR><BR>
+     */
+    public int getWIT()
+    {
+        wit = super.getWIT();
+        if (wit >= Formulas.MAX_STAT_VALUE)
+        {
+            ClientScheduler.getInstance().scheduleAtFixedRate(new InvalidStatValue(WIT, wit), TaskPriority.PR_LOW, 500, 0);
+            return Formulas.MAX_STAT_VALUE - 1;
+        }
+        return wit;
+    }
+
+    /**
+     * Return the MEN of the L2Character (base+modifier).<BR><BR>
+     */
+    public int getMEN()
+    {
+        men = super.getMEN();
+        if (men >= Formulas.MAX_STAT_VALUE)
+        {
+            ClientScheduler.getInstance().scheduleAtFixedRate(new InvalidStatValue(MEN, men), TaskPriority.PR_LOW, 500, 0);
+            return Formulas.MAX_STAT_VALUE - 1;
+        }
+        return men;
+    }
 }