mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-05 23:22:47 +00:00
4
config/database.properties
Normal file
4
config/database.properties
Normal 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
|
||||
@@ -22,7 +22,7 @@ import com.l2jserver.game.net.Lineage2Connection;
|
||||
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>
|
||||
*/
|
||||
|
||||
@@ -44,49 +44,206 @@ import com.l2jserver.model.world.character.calculator.CharacterCalculatorContext
|
||||
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 {
|
||||
/**
|
||||
* 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();
|
||||
/**
|
||||
* 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();
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
/**
|
||||
* 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();
|
||||
/**
|
||||
* 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();
|
||||
/**
|
||||
* 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();
|
||||
/**
|
||||
* 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();
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
/**
|
||||
* 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();
|
||||
/**
|
||||
* 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();
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
/**
|
||||
* 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();
|
||||
/**
|
||||
* 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();
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* 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();
|
||||
/**
|
||||
* 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();
|
||||
|
||||
/**
|
||||
* The 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")
|
||||
private final Calculator<L2Character>[] calculators = new Calculator[StatType
|
||||
.values().length];
|
||||
|
||||
/**
|
||||
* Creates a new {@link CharacterStats} and adds default calculators
|
||||
*
|
||||
* @param character
|
||||
* the character
|
||||
*/
|
||||
public CharacterStats(L2Character character) {
|
||||
this.character = character;
|
||||
for (int i = 0; i < calculators.length; i++) {
|
||||
calculators[i] = new Calculator<L2Character>();
|
||||
}
|
||||
|
||||
// bind default functions
|
||||
// import default functions
|
||||
getCalculator(StatType.MAX_HP).importFunctions(BASE_HP_CALCULATOR);
|
||||
getCalculator(StatType.MAX_MP).importFunctions(BASE_MP_CALCULATOR);
|
||||
getCalculator(StatType.MAX_CP).importFunctions(BASE_CP_CALCULATOR);
|
||||
@@ -129,90 +286,156 @@ public class CharacterStats {
|
||||
// TODO henna stats calculators
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated maximum HP
|
||||
*/
|
||||
public int getMaxHP() {
|
||||
return (int) calc(StatType.MAX_HP);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated maximum MP
|
||||
*/
|
||||
public int getMaxMP() {
|
||||
return (int) calc(StatType.MAX_MP);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated maximum CP
|
||||
*/
|
||||
public int getMaxCP() {
|
||||
return (int) calc(StatType.MAX_CP);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated intelligence
|
||||
*/
|
||||
public int getIntelligence() {
|
||||
return (int) calc(StatType.STAT_INT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated strength
|
||||
*/
|
||||
public int getStrength() {
|
||||
return (int) calc(StatType.STAT_STR);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated concentration
|
||||
*/
|
||||
public int getConcentration() {
|
||||
return (int) calc(StatType.STAT_CON);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated mentality
|
||||
*/
|
||||
public int getMentality() {
|
||||
return (int) calc(StatType.STAT_MEN);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated dexterity
|
||||
*/
|
||||
public int getDexterity() {
|
||||
return (int) calc(StatType.STAT_DEX);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated witness
|
||||
*/
|
||||
public int getWitness() {
|
||||
return (int) calc(StatType.STAT_WIT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated run speed
|
||||
*/
|
||||
public int getRunSpeed() {
|
||||
return (int) calc(StatType.RUN_SPEED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated walk speed
|
||||
*/
|
||||
public int getWalkSpeed() {
|
||||
return (int) calc(StatType.WALK_SPEED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated physical attack
|
||||
*/
|
||||
public int getPhysicalAttack() {
|
||||
return (int) calc(StatType.POWER_ATTACK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated physical attack speed
|
||||
*/
|
||||
public int getPhysicalAttackSpeed() {
|
||||
return (int) calc(StatType.POWER_ATTACK_SPEED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated physical attack critical rate
|
||||
*/
|
||||
public int getPhysicalCriticalRate() {
|
||||
return (int) calc(StatType.CRITICAL_RATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated physical defense
|
||||
*/
|
||||
public int getPhysicalDefense() {
|
||||
return (int) calc(StatType.POWER_DEFENSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated magical attack
|
||||
*/
|
||||
public int getMagicalAttack() {
|
||||
return (int) calc(StatType.MAGIC_ATTACK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated magical attack speed
|
||||
*/
|
||||
public int getMagicalAttackSpeed() {
|
||||
return (int) calc(StatType.MAGIC_ATTACK_SPEED);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated magical attack critical rate
|
||||
*/
|
||||
public int getMagicalCriticalRate() {
|
||||
return (int) calc(StatType.MCRITICAL_RATE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated magical defense
|
||||
*/
|
||||
public int getMagicalDefense() {
|
||||
return (int) calc(StatType.MAGIC_DEFENSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated accuracy
|
||||
*/
|
||||
public int getAccuracy() {
|
||||
return (int) calc(StatType.ACCURACY_COMBAT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the calculated evasion rate
|
||||
*/
|
||||
public int getEvasionRate() {
|
||||
return (int) calc(StatType.EVASION_RATE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the calculated maximum load
|
||||
*/
|
||||
public int getMaximumLoad() {
|
||||
return (int) calc(StatType.MAX_LOAD);
|
||||
}
|
||||
@@ -221,10 +444,22 @@ public class CharacterStats {
|
||||
// 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) {
|
||||
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) {
|
||||
final CharacterCalculatorContext ctx = new CharacterCalculatorContext(
|
||||
character);
|
||||
|
||||
@@ -23,8 +23,19 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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 {
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -23,8 +23,19 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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 > 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 BaseAttackEvasionCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -23,8 +23,21 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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 {
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -21,6 +21,12 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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>
|
||||
*/
|
||||
public class BaseConcentrationCalculator extends CharacterCalculator {
|
||||
|
||||
@@ -21,6 +21,12 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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>
|
||||
*/
|
||||
public class BaseDexterityCalculator extends CharacterCalculator {
|
||||
|
||||
@@ -23,8 +23,21 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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 {
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -23,8 +23,13 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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 {
|
||||
/**
|
||||
|
||||
@@ -21,6 +21,12 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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>
|
||||
*/
|
||||
public class BaseIntelligenceCalculator extends CharacterCalculator {
|
||||
|
||||
@@ -23,8 +23,21 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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 {
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -22,8 +22,14 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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) ˆ 2)
|
||||
* * (BaseStats.INT.calculateBonus(c.getStats().getIntelligence()) ˆ 2);
|
||||
* </pre>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class BaseMagicalAttackCalculator extends CharacterCalculator {
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -22,8 +22,14 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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 {
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -22,6 +22,13 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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>
|
||||
*/
|
||||
public class BaseMagicalCriticalRateCalculator extends CharacterCalculator {
|
||||
|
||||
@@ -29,6 +29,23 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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>
|
||||
*/
|
||||
public class BaseMagicalDefenseCalculator extends CharacterCalculator {
|
||||
|
||||
@@ -21,6 +21,12 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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>
|
||||
*/
|
||||
public class BaseMentalityCalculator extends CharacterCalculator {
|
||||
|
||||
@@ -22,8 +22,15 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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 {
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -22,8 +22,14 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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 {
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -22,6 +22,14 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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>
|
||||
*/
|
||||
public class BasePhysicalCriticalRateCalculator extends CharacterCalculator {
|
||||
|
||||
@@ -31,6 +31,25 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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>
|
||||
*/
|
||||
public class BasePhysicalDefenseCalculator extends CharacterCalculator {
|
||||
|
||||
@@ -22,8 +22,14 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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 {
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -21,6 +21,12 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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>
|
||||
*/
|
||||
public class BaseStrengthCalculator extends CharacterCalculator {
|
||||
|
||||
@@ -22,8 +22,14 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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 {
|
||||
@SuppressWarnings("unchecked")
|
||||
|
||||
@@ -21,6 +21,12 @@ import com.l2jserver.util.calculator.AbstractFunction;
|
||||
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>
|
||||
*/
|
||||
public class BaseWitnessCalculator extends CharacterCalculator {
|
||||
|
||||
@@ -21,12 +21,12 @@ import com.l2jserver.util.calculator.Calculator;
|
||||
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 CharacterCalculator(
|
||||
Function<L2Character>... functions) {
|
||||
public CharacterCalculator(Function<L2Character>... functions) {
|
||||
super(functions);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,8 +20,9 @@ import com.l2jserver.model.world.L2Character;
|
||||
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 {
|
||||
/**
|
||||
|
||||
@@ -85,7 +85,6 @@ public class ProxyConfigurationService extends AbstractService implements
|
||||
Properties properties;
|
||||
try {
|
||||
properties = findProperties(config);
|
||||
System.out.println(properties);
|
||||
} catch (IOException e) {
|
||||
properties = new Properties();
|
||||
logger.info(
|
||||
|
||||
Reference in New Issue
Block a user