1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-05 23:22:47 +00:00

Calculator Javadoc

Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
2011-05-26 12:01:00 -03:00
parent 6a527038e2
commit fc0dcd221e
28 changed files with 450 additions and 21 deletions

View File

@@ -0,0 +1,4 @@
jdbc.mysql.url = jdbc:mysql://localhost/l2jserver2
jdbc.mysql.driver = com.mysql.jdbc.Driver
jdbc.mysql.username = l2j123
jdbc.mysql.password = changeme

View File

@@ -22,7 +22,7 @@ import com.l2jserver.game.net.Lineage2Connection;
import com.l2jserver.game.net.packet.AbstractServerPacket; import com.l2jserver.game.net.packet.AbstractServerPacket;
/** /**
* An packet informing that the character was created with success. * An packet authorizing the client to open the map
* *
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */

View File

@@ -44,49 +44,206 @@ import com.l2jserver.model.world.character.calculator.CharacterCalculatorContext
import com.l2jserver.util.calculator.Calculator; import com.l2jserver.util.calculator.Calculator;
/** /**
* @author <a href="http://www.rogiel.com">Rogiel</a> * This class is responsible for calculating the real character stats. The real
* stats vary from the values from the templates, also, skills and items
* equipped can change those values. Once an buff is applied, a new calculator
* is {@link Calculator#importFunctions(Calculator) imported} and their
* functions are added to this class calculator. Once the skill effect has past
* away, all the functions that were imported are now
* {@link Calculator#removeFunctions(Calculator) removed} and the calculator
* return to its original state.
* <p>
* Another important note is that calculators should perform calculations as
* fast as possible.
* <p>
* <i><b>IMPORTANT</b>: NEVER TOUCH THE STATIC CALCULATORS!</i>
* *
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class CharacterStats { public class CharacterStats {
/**
* The calculator for base maximum HP
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_HP_CALCULATOR = new BaseHPCalculator(); private static final CharacterCalculator BASE_HP_CALCULATOR = new BaseHPCalculator();
/**
* The calculator for base maximum MP
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_MP_CALCULATOR = new BaseMPCalculator(); private static final CharacterCalculator BASE_MP_CALCULATOR = new BaseMPCalculator();
/**
* The calculator for base maximum CP
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_CP_CALCULATOR = new BaseCPCalculator(); private static final CharacterCalculator BASE_CP_CALCULATOR = new BaseCPCalculator();
/**
* The calculator for base intelligence
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_INT_CALCULATOR = new BaseIntelligenceCalculator(); private static final CharacterCalculator BASE_INT_CALCULATOR = new BaseIntelligenceCalculator();
/**
* The calculator for base strength
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_STR_CALCULATOR = new BaseStrengthCalculator(); private static final CharacterCalculator BASE_STR_CALCULATOR = new BaseStrengthCalculator();
/**
* The calculator for base concentration
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_CON_CALCULATOR = new BaseConcentrationCalculator(); private static final CharacterCalculator BASE_CON_CALCULATOR = new BaseConcentrationCalculator();
/**
* The calculator for base mentality
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_MEN_CALCULATOR = new BaseMentalityCalculator(); private static final CharacterCalculator BASE_MEN_CALCULATOR = new BaseMentalityCalculator();
/**
* The calculator for base dexterity
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_DEX_CALCULATOR = new BaseDexterityCalculator(); private static final CharacterCalculator BASE_DEX_CALCULATOR = new BaseDexterityCalculator();
/**
* The calculator for base witness
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_WIT_CALCULATOR = new BaseWitnessCalculator(); private static final CharacterCalculator BASE_WIT_CALCULATOR = new BaseWitnessCalculator();
/**
* The calculator for base run speed
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_RUN_SPEED_CALCULATOR = new BaseRunSpeedCalculator(); private static final CharacterCalculator BASE_RUN_SPEED_CALCULATOR = new BaseRunSpeedCalculator();
/**
* The calculator for base walk speed
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_WALK_SPEED_CALCULATOR = new BaseWalkSpeedCalculator(); private static final CharacterCalculator BASE_WALK_SPEED_CALCULATOR = new BaseWalkSpeedCalculator();
/**
* The calculator base physical attack
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_PHYSICAL_ATTACK_CALCULATOR = new BasePhysicalAttackCalculator(); private static final CharacterCalculator BASE_PHYSICAL_ATTACK_CALCULATOR = new BasePhysicalAttackCalculator();
/**
* The calculator base physical attack speed
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_PHYSICAL_ATTACK_SPEED_CALCULATOR = new BasePhysicalAttackSpeedCalculator(); private static final CharacterCalculator BASE_PHYSICAL_ATTACK_SPEED_CALCULATOR = new BasePhysicalAttackSpeedCalculator();
/**
* The calculator base physical attack critical rate
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_PHYSICAL_CRITICAL_RATE_CALCULATOR = new BasePhysicalCriticalRateCalculator(); private static final CharacterCalculator BASE_PHYSICAL_CRITICAL_RATE_CALCULATOR = new BasePhysicalCriticalRateCalculator();
/**
* The calculator base physical defense
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_PHYSICAL_DEFENSE_CALCULATOR = new BasePhysicalDefenseCalculator(); private static final CharacterCalculator BASE_PHYSICAL_DEFENSE_CALCULATOR = new BasePhysicalDefenseCalculator();
/**
* The calculator base magical attack
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_MAGICAL_ATTACK_CALCULATOR = new BaseMagicalAttackCalculator(); private static final CharacterCalculator BASE_MAGICAL_ATTACK_CALCULATOR = new BaseMagicalAttackCalculator();
/**
* The calculator base magical attack speed
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_MAGICAL_ATTACK_SPEED_CALCULATOR = new BaseMagicalAttackSpeedCalculator(); private static final CharacterCalculator BASE_MAGICAL_ATTACK_SPEED_CALCULATOR = new BaseMagicalAttackSpeedCalculator();
/**
* The calculator base magical attack critical rate
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_MAGICAL_CRITICAL_RATE_CALCULATOR = new BaseMagicalCriticalRateCalculator(); private static final CharacterCalculator BASE_MAGICAL_CRITICAL_RATE_CALCULATOR = new BaseMagicalCriticalRateCalculator();
/**
* The calculator base magical defense
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_MAGICAL_DEFENSE_CALCULATOR = new BaseMagicalDefenseCalculator(); private static final CharacterCalculator BASE_MAGICAL_DEFENSE_CALCULATOR = new BaseMagicalDefenseCalculator();
/**
* The calculator base attack accuracy
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_ATTACK_ACCURACY_CALCULATOR = new BaseAttackAccuracyCalculator(); private static final CharacterCalculator BASE_ATTACK_ACCURACY_CALCULATOR = new BaseAttackAccuracyCalculator();
/**
* The calculator base evasion
* <p>
* <u>This calculator does not store any state and thus is safe to be
* shared.</u>
*/
private static final CharacterCalculator BASE_ATTACK_EVASION_CALCULATOR = new BaseAttackEvasionCalculator(); private static final CharacterCalculator BASE_ATTACK_EVASION_CALCULATOR = new BaseAttackEvasionCalculator();
/**
* The character
*/
private final L2Character character; private final L2Character character;
/**
* The list of calculators for this character
* <p>
* It is safe to use an array since this number cannot be changed in
* runtime, it would be required to be able to change the {@link StatType}
* enum. Also, an full-sized array is created because this way we don't need
* to change the array size very often. A bit of memory is "lost", but the
* speed gain is much higher.
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private final Calculator<L2Character>[] calculators = new Calculator[StatType private final Calculator<L2Character>[] calculators = new Calculator[StatType
.values().length]; .values().length];
/**
* Creates a new {@link CharacterStats} and adds default calculators
*
* @param character
* the character
*/
public CharacterStats(L2Character character) { public CharacterStats(L2Character character) {
this.character = character; this.character = character;
for (int i = 0; i < calculators.length; i++) { for (int i = 0; i < calculators.length; i++) {
calculators[i] = new Calculator<L2Character>(); calculators[i] = new Calculator<L2Character>();
} }
// bind default functions // import default functions
getCalculator(StatType.MAX_HP).importFunctions(BASE_HP_CALCULATOR); getCalculator(StatType.MAX_HP).importFunctions(BASE_HP_CALCULATOR);
getCalculator(StatType.MAX_MP).importFunctions(BASE_MP_CALCULATOR); getCalculator(StatType.MAX_MP).importFunctions(BASE_MP_CALCULATOR);
getCalculator(StatType.MAX_CP).importFunctions(BASE_CP_CALCULATOR); getCalculator(StatType.MAX_CP).importFunctions(BASE_CP_CALCULATOR);
@@ -129,90 +286,156 @@ public class CharacterStats {
// TODO henna stats calculators // TODO henna stats calculators
} }
/**
* @return the calculated maximum HP
*/
public int getMaxHP() { public int getMaxHP() {
return (int) calc(StatType.MAX_HP); return (int) calc(StatType.MAX_HP);
} }
/**
* @return the calculated maximum MP
*/
public int getMaxMP() { public int getMaxMP() {
return (int) calc(StatType.MAX_MP); return (int) calc(StatType.MAX_MP);
} }
/**
* @return the calculated maximum CP
*/
public int getMaxCP() { public int getMaxCP() {
return (int) calc(StatType.MAX_CP); return (int) calc(StatType.MAX_CP);
} }
/**
* @return the calculated intelligence
*/
public int getIntelligence() { public int getIntelligence() {
return (int) calc(StatType.STAT_INT); return (int) calc(StatType.STAT_INT);
} }
/**
* @return the calculated strength
*/
public int getStrength() { public int getStrength() {
return (int) calc(StatType.STAT_STR); return (int) calc(StatType.STAT_STR);
} }
/**
* @return the calculated concentration
*/
public int getConcentration() { public int getConcentration() {
return (int) calc(StatType.STAT_CON); return (int) calc(StatType.STAT_CON);
} }
/**
* @return the calculated mentality
*/
public int getMentality() { public int getMentality() {
return (int) calc(StatType.STAT_MEN); return (int) calc(StatType.STAT_MEN);
} }
/**
* @return the calculated dexterity
*/
public int getDexterity() { public int getDexterity() {
return (int) calc(StatType.STAT_DEX); return (int) calc(StatType.STAT_DEX);
} }
/**
* @return the calculated witness
*/
public int getWitness() { public int getWitness() {
return (int) calc(StatType.STAT_WIT); return (int) calc(StatType.STAT_WIT);
} }
/**
* @return the calculated run speed
*/
public int getRunSpeed() { public int getRunSpeed() {
return (int) calc(StatType.RUN_SPEED); return (int) calc(StatType.RUN_SPEED);
} }
/**
* @return the calculated walk speed
*/
public int getWalkSpeed() { public int getWalkSpeed() {
return (int) calc(StatType.WALK_SPEED); return (int) calc(StatType.WALK_SPEED);
} }
/**
* @return the calculated physical attack
*/
public int getPhysicalAttack() { public int getPhysicalAttack() {
return (int) calc(StatType.POWER_ATTACK); return (int) calc(StatType.POWER_ATTACK);
} }
/**
* @return the calculated physical attack speed
*/
public int getPhysicalAttackSpeed() { public int getPhysicalAttackSpeed() {
return (int) calc(StatType.POWER_ATTACK_SPEED); return (int) calc(StatType.POWER_ATTACK_SPEED);
} }
/**
* @return the calculated physical attack critical rate
*/
public int getPhysicalCriticalRate() { public int getPhysicalCriticalRate() {
return (int) calc(StatType.CRITICAL_RATE); return (int) calc(StatType.CRITICAL_RATE);
} }
/**
* @return the calculated physical defense
*/
public int getPhysicalDefense() { public int getPhysicalDefense() {
return (int) calc(StatType.POWER_DEFENSE); return (int) calc(StatType.POWER_DEFENSE);
} }
/**
* @return the calculated magical attack
*/
public int getMagicalAttack() { public int getMagicalAttack() {
return (int) calc(StatType.MAGIC_ATTACK); return (int) calc(StatType.MAGIC_ATTACK);
} }
/**
* @return the calculated magical attack speed
*/
public int getMagicalAttackSpeed() { public int getMagicalAttackSpeed() {
return (int) calc(StatType.MAGIC_ATTACK_SPEED); return (int) calc(StatType.MAGIC_ATTACK_SPEED);
} }
/**
* @return the calculated magical attack critical rate
*/
public int getMagicalCriticalRate() { public int getMagicalCriticalRate() {
return (int) calc(StatType.MCRITICAL_RATE); return (int) calc(StatType.MCRITICAL_RATE);
} }
/**
* @return the calculated magical defense
*/
public int getMagicalDefense() { public int getMagicalDefense() {
return (int) calc(StatType.MAGIC_DEFENSE); return (int) calc(StatType.MAGIC_DEFENSE);
} }
/**
* @return the calculated accuracy
*/
public int getAccuracy() { public int getAccuracy() {
return (int) calc(StatType.ACCURACY_COMBAT); return (int) calc(StatType.ACCURACY_COMBAT);
} }
/**
* @return the calculated evasion rate
*/
public int getEvasionRate() { public int getEvasionRate() {
return (int) calc(StatType.EVASION_RATE); return (int) calc(StatType.EVASION_RATE);
} }
/**
* @return the calculated maximum load
*/
public int getMaximumLoad() { public int getMaximumLoad() {
return (int) calc(StatType.MAX_LOAD); return (int) calc(StatType.MAX_LOAD);
} }
@@ -221,10 +444,22 @@ public class CharacterStats {
// getCalculator(type).importFunctions(calculator); // getCalculator(type).importFunctions(calculator);
// } // }
/**
* @param the
* calculator {@link StatType}
* @return the calculator object associated with the given <tt>type</tt>
*/
protected Calculator<L2Character> getCalculator(StatType type) { protected Calculator<L2Character> getCalculator(StatType type) {
return calculators[type.ordinal()]; return calculators[type.ordinal()];
} }
/**
* Does the calculation of an given {@link StatType}
*
* @param type
* the type
* @return the value calculated
*/
public double calc(StatType type) { public double calc(StatType type) {
final CharacterCalculatorContext ctx = new CharacterCalculatorContext( final CharacterCalculatorContext ctx = new CharacterCalculatorContext(
character); character);

View File

@@ -23,8 +23,19 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* @author <a href="http://www.rogiel.com">Rogiel</a> * Calculates the character base accuracy.
* *
* <pre>
* ctx.result = c.getTemplate().getBaseAccuracy();
* ctx.result += sqrt(DEX) * 6
* ctx.result += level;
* if (level > 77)
* ctx.result += (level - 77) + 1;
* if (level > 69)
* ctx.result += (level - 69);
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BaseAttackAccuracyCalculator extends CharacterCalculator { public class BaseAttackAccuracyCalculator extends CharacterCalculator {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@@ -23,8 +23,19 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* @author <a href="http://www.rogiel.com">Rogiel</a> * Calculates the character evasion
* *
* <pre>
* ctx.result = c.getTemplate().getBaseEvasion();
* ctx.result += sqrt(DEX) * 6;
* ctx.result += level;
* if (level &gt; 77)
* ctx.result += (level - 77) + 1;
* if (level &gt; 69)
* ctx.result += (level - 69);
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BaseAttackEvasionCalculator extends CharacterCalculator { public class BaseAttackEvasionCalculator extends CharacterCalculator {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@@ -23,8 +23,21 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* @author <a href="http://www.rogiel.com">Rogiel</a> * Calculates the character maximum CP
* *
* <pre>
* ctx.result = c.getTemplate().getBaseCP();
*
* int lvl = c.getLevel() - template.getMinimumLevel();
* double mod = template.getBaseCPModifier() * lvl;
* double max = (template.getBaseCPAdd() + mod) * lvl;
* double min = (template.getBaseCPAdd() * lvl) + mod;
* ctx.result += (max + min) / 2;
*
* ctx.result *= BaseStats.CON.calculateBonus(c.getStats().getConcentration());
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BaseCPCalculator extends CharacterCalculator { public class BaseCPCalculator extends CharacterCalculator {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@@ -21,6 +21,12 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* Calculates the character concentration
*
* <pre>
* ctx.result = c.getTemplate().getBaseConcentration();
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BaseConcentrationCalculator extends CharacterCalculator { public class BaseConcentrationCalculator extends CharacterCalculator {

View File

@@ -21,6 +21,12 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* Calculates the character base dexterity
*
* <pre>
* ctx.result = c.getTemplate().getBaseDexterity();
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BaseDexterityCalculator extends CharacterCalculator { public class BaseDexterityCalculator extends CharacterCalculator {

View File

@@ -23,8 +23,21 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* @author <a href="http://www.rogiel.com">Rogiel</a> * Calculates the character maximum HP
* *
* <pre>
* ctx.result = c.getTemplate().getBaseHP();
*
* int lvl = c.getLevel() - template.getMinimumLevel();
* double mod = template.getBaseHP() * lvl;
* double max = (template.getBaseHPAdd() + mod) * lvl;
* double min = (template.getBaseHPAdd() * lvl) + mod;
* ctx.result += (max + min) / 2;
*
* ctx.result *= BaseStats.CON.calculateBonus(c.getStats().getConcentration());
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BaseHPCalculator extends CharacterCalculator { public class BaseHPCalculator extends CharacterCalculator {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@@ -23,8 +23,13 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* @author <a href="http://www.rogiel.com">Rogiel</a> * Calculates the character base HP regeneration
* *
* <pre>
* TODO base hp regen
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BaseHPRegenerationCalculator extends CharacterCalculator { public class BaseHPRegenerationCalculator extends CharacterCalculator {
/** /**

View File

@@ -21,6 +21,12 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* Calculates the character base intelligence
*
* <pre>
* ctx.result = c.getTemplate().getBaseIntelligence();
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BaseIntelligenceCalculator extends CharacterCalculator { public class BaseIntelligenceCalculator extends CharacterCalculator {

View File

@@ -23,8 +23,21 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* @author <a href="http://www.rogiel.com">Rogiel</a> * Calculates the character base MP
* *
* <pre>
* ctx.result = c.getTemplate().getBaseBaseMP();
*
* int lvl = c.getLevel() - template.getMinimumLevel();
* double mod = template.getBaseMPModifier() * lvl;
* double max = (template.getBaseMPAdd() + mod) * lvl;
* double min = (template.getBaseMPAdd() * lvl) + mod;
* ctx.result += (max + min) / 2;
*
* ctx.result *= BaseStats.MEN.calculateBonus(c.getStats().getMentality());
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BaseMPCalculator extends CharacterCalculator { public class BaseMPCalculator extends CharacterCalculator {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@@ -22,8 +22,14 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* @author <a href="http://www.rogiel.com">Rogiel</a> * Calculates the character base magical attack
* *
* <pre>
* ctx.result *= (((100.0 - 11 + c.getLevel()) / 100.0) &circ; 2)
* * (BaseStats.INT.calculateBonus(c.getStats().getIntelligence()) &circ; 2);
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BaseMagicalAttackCalculator extends CharacterCalculator { public class BaseMagicalAttackCalculator extends CharacterCalculator {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@@ -22,8 +22,14 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* @author <a href="http://www.rogiel.com">Rogiel</a> * Calculates the base magical attack speed
* *
* <pre>
* ctx.result = c.getTemplate().getBaseMagicalAttackSpeed();
* ctx.result *= BaseStats.WIT.calculateBonus(c.getStats().getWitness());
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BaseMagicalAttackSpeedCalculator extends CharacterCalculator { public class BaseMagicalAttackSpeedCalculator extends CharacterCalculator {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@@ -22,6 +22,13 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* Calculates the base magical attack critical rate
*
* <pre>
* ctx.result = c.getTemplate().getBaseCritical(); // must be checked
* ctx.result *= BaseStats.WIT.calculateBonus(c.getStats().getWitness());
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BaseMagicalCriticalRateCalculator extends CharacterCalculator { public class BaseMagicalCriticalRateCalculator extends CharacterCalculator {

View File

@@ -29,6 +29,23 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* Calculates the character base magical defense.
*
* <pre>
* if (inv.has(LEFT_FINGER))
* ctx.result -= 5;
* if (inv.has(RIGHT_FINGER))
* ctx.result -= 5;
* if (inv.has(LEFT_EAR))
* ctx.result -= 9;
* if (inv.has(RIGHT_EAR))
* ctx.result -= 9;
* if (inv.has(NECK))
* ctx.result -= 13;
* ctx.result *= BaseStats.MEN.calculateBonus(c.getStats().getMentality())
* * ((100.0 - 11 + c.getLevel()) / 100.0);
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BaseMagicalDefenseCalculator extends CharacterCalculator { public class BaseMagicalDefenseCalculator extends CharacterCalculator {

View File

@@ -21,6 +21,12 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* Calculates the character base mentality
*
* <pre>
* ctx.result = c.getTemplate().getBaseMentality();
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BaseMentalityCalculator extends CharacterCalculator { public class BaseMentalityCalculator extends CharacterCalculator {

View File

@@ -22,8 +22,15 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* @author <a href="http://www.rogiel.com">Rogiel</a> * Calculates the character base physical attack
* *
* <pre>
* ctx.result = c.getTemplate().getBasePhysicalAttack();
* ctx.result *= BaseStats.STR.calculateBonus(c.getStats().getStrength())
* * ((100.0 - 11 + c.getLevel()) / 100.0);
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BasePhysicalAttackCalculator extends CharacterCalculator { public class BasePhysicalAttackCalculator extends CharacterCalculator {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@@ -22,8 +22,14 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* @author <a href="http://www.rogiel.com">Rogiel</a> * Calculates the character base physical attack speed
* *
* <pre>
* ctx.result = c.getTemplate().getBasePhysicalAttackSpeed();
* ctx.result *= BaseStats.DEX.calculateBonus(c.getStats().getDexterity());
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BasePhysicalAttackSpeedCalculator extends CharacterCalculator { public class BasePhysicalAttackSpeedCalculator extends CharacterCalculator {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@@ -22,6 +22,14 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* Calculates the character base critical rate
*
* <pre>
* ctx.result = c.getTemplate().getBaseCritical();
* ctx.result *= BaseStats.DEX.calculateBonus(c.getStats().getDexterity());
* ctx.result *= 10;
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BasePhysicalCriticalRateCalculator extends CharacterCalculator { public class BasePhysicalCriticalRateCalculator extends CharacterCalculator {

View File

@@ -31,6 +31,25 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* Calculates the character base physical defense
*
* <pre>
* ctx.result = c.getTemplate().getBasePhysicalDefense();
*
* if (inv.has(HEAD))
* ctx.result -= 12;
* final Item chest = inv.getItem(CHEST);
* if (chest != null)
* ctx.result -= hasMagePDef ? 15 : 31;
* if (inv.has(LEGS))
* ctx.result -= hasMagePDef ? 8 : 18;
* if (inv.has(GLOVES))
* ctx.result -= 8;
* if (inv.has(FEET))
* ctx.result -= 7;
* ctx.result *= ((100.0 - 11 + c.getLevel()) / 100.0);
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BasePhysicalDefenseCalculator extends CharacterCalculator { public class BasePhysicalDefenseCalculator extends CharacterCalculator {

View File

@@ -22,8 +22,14 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* @author <a href="http://www.rogiel.com">Rogiel</a> * Calculates the character base run speed
* *
* <pre>
* ctx.result = c.getTemplate().getBaseRunSpeed();
* ctx.result *= BaseStats.DEX.calculateBonus(c.getStats().getDexterity());
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BaseRunSpeedCalculator extends CharacterCalculator { public class BaseRunSpeedCalculator extends CharacterCalculator {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@@ -21,6 +21,12 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* Calculates the character base strength
*
* <pre>
* ctx.result = c.getTemplate().getBaseStrength();
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BaseStrengthCalculator extends CharacterCalculator { public class BaseStrengthCalculator extends CharacterCalculator {

View File

@@ -22,8 +22,14 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* @author <a href="http://www.rogiel.com">Rogiel</a> * Calculates the character base walk speed
* *
* <pre>
* ctx.result = c.getTemplate().getBaseWalkSpeed();
* ctx.result *= BaseStats.DEX.calculateBonus(c.getStats().getDexterity());
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BaseWalkSpeedCalculator extends CharacterCalculator { public class BaseWalkSpeedCalculator extends CharacterCalculator {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@@ -21,6 +21,12 @@ import com.l2jserver.util.calculator.AbstractFunction;
import com.l2jserver.util.calculator.CalculatorContext; import com.l2jserver.util.calculator.CalculatorContext;
/** /**
* Calculates the character base witness
*
* <pre>
* ctx.result = c.getTemplate().getBaseWitness();
* </pre>
*
* @author <a href="http://www.rogiel.com">Rogiel</a> * @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class BaseWitnessCalculator extends CharacterCalculator { public class BaseWitnessCalculator extends CharacterCalculator {

View File

@@ -21,12 +21,12 @@ import com.l2jserver.util.calculator.Calculator;
import com.l2jserver.util.calculator.Function; import com.l2jserver.util.calculator.Function;
/** /**
* @author <a href="http://www.rogiel.com">Rogiel</a> * An calculator for character formulas.
* *
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class CharacterCalculator extends Calculator<L2Character> { public class CharacterCalculator extends Calculator<L2Character> {
public CharacterCalculator( public CharacterCalculator(Function<L2Character>... functions) {
Function<L2Character>... functions) {
super(functions); super(functions);
} }
} }

View File

@@ -20,8 +20,9 @@ import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.actor.calculator.ActorCalculatorContext; import com.l2jserver.model.world.actor.calculator.ActorCalculatorContext;
/** /**
* @author <a href="http://www.rogiel.com">Rogiel</a> * Calculator context for character formulas
* *
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/ */
public class CharacterCalculatorContext extends ActorCalculatorContext { public class CharacterCalculatorContext extends ActorCalculatorContext {
/** /**

View File

@@ -85,7 +85,6 @@ public class ProxyConfigurationService extends AbstractService implements
Properties properties; Properties properties;
try { try {
properties = findProperties(config); properties = findProperties(config);
System.out.println(properties);
} catch (IOException e) { } catch (IOException e) {
properties = new Properties(); properties = new Properties();
logger.info( logger.info(