mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-13 10:42:54 +00:00
Change-Id: I0000000000000000000000000000000000000000
Change-Id: I8636776eaf000fcdfb528cc403710f6d6ee9e73e Change-Id: Iebc523681d07ecd6d7b7e89343b29a8034558f94
This commit is contained in:
@@ -25,21 +25,19 @@ public class CharacterAppearance {
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum CharacterFace {
|
||||
FACE1((byte) 0x00),
|
||||
FACE_A(0x00),
|
||||
|
||||
FACE2((byte) 0x01),
|
||||
FACE_B(0x01),
|
||||
|
||||
FACE3((byte) 0x02),
|
||||
FACE_C(0x02);
|
||||
|
||||
FACE4((byte) 0x03);
|
||||
public final int option;
|
||||
|
||||
public final byte option;
|
||||
|
||||
CharacterFace(byte option) {
|
||||
CharacterFace(int option) {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
public static CharacterFace fromOption(byte option) {
|
||||
public static CharacterFace fromOption(int option) {
|
||||
for (CharacterFace face : values()) {
|
||||
if (face.option == option)
|
||||
return face;
|
||||
@@ -59,21 +57,21 @@ public class CharacterAppearance {
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum CharacterHairColor {
|
||||
COLOR1((byte) 0x00),
|
||||
COLOR_A(0x00),
|
||||
|
||||
COLOR2((byte) 0x01),
|
||||
COLOR_B(0x01),
|
||||
|
||||
COLOR3((byte) 0x02),
|
||||
COLOR_C(0x02),
|
||||
|
||||
COLOR4((byte) 0x03);
|
||||
COLOR_D(0x03);
|
||||
|
||||
public final byte option;
|
||||
public final int option;
|
||||
|
||||
CharacterHairColor(byte option) {
|
||||
CharacterHairColor(int option) {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
public static CharacterHairColor fromOption(byte option) {
|
||||
public static CharacterHairColor fromOption(int option) {
|
||||
for (CharacterHairColor color : values()) {
|
||||
if (color.option == option)
|
||||
return color;
|
||||
@@ -93,21 +91,23 @@ public class CharacterAppearance {
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum CharacterHairStyle {
|
||||
STYLE1((byte) 0x00),
|
||||
STYLE_A(0x00),
|
||||
|
||||
STYLE2((byte) 0x01),
|
||||
STYLE_B(0x01),
|
||||
|
||||
STYLE3((byte) 0x02),
|
||||
STYLE_C(0x02),
|
||||
|
||||
STYLE4((byte) 0x03);
|
||||
STYLE_D(0x03),
|
||||
|
||||
public final byte option;
|
||||
STYLE_E(0x04);
|
||||
|
||||
CharacterHairStyle(byte option) {
|
||||
public final int option;
|
||||
|
||||
CharacterHairStyle(int option) {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
public static CharacterHairStyle fromOption(byte option) {
|
||||
public static CharacterHairStyle fromOption(int option) {
|
||||
for (CharacterHairStyle style : values()) {
|
||||
if (style.option == option)
|
||||
return style;
|
||||
@@ -116,23 +116,6 @@ public class CharacterAppearance {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The character sex
|
||||
*/
|
||||
private CharacterSex sex;
|
||||
|
||||
/**
|
||||
* Represent the sex of an character.
|
||||
* <p>
|
||||
* TODO this will be moved soon: not only characters have sex, NPC can
|
||||
* have'em too.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum CharacterSex {
|
||||
MALE, FEMALE;
|
||||
}
|
||||
|
||||
/**
|
||||
* An alternative name. It will be displayed in-game.
|
||||
* <p>
|
||||
@@ -148,14 +131,16 @@ public class CharacterAppearance {
|
||||
|
||||
/**
|
||||
* The name color
|
||||
* <p>
|
||||
* <b>This is not persisted!</b>
|
||||
*/
|
||||
private RGBColor nameColor = new RGBColor((byte) 0xFF, (byte) 0xFF,
|
||||
(byte) 0xFF);
|
||||
private RGBColor nameColor = RGBColor.fromInteger(0xFFFFFF);
|
||||
/**
|
||||
* The title color
|
||||
* <p>
|
||||
* <b>This is not persisted!</b>
|
||||
*/
|
||||
private RGBColor titleColor = new RGBColor((byte) 0xFF, (byte) 0xFF,
|
||||
(byte) 0x77);
|
||||
private RGBColor titleColor = RGBColor.fromInteger(0xFFFF77);
|
||||
|
||||
public CharacterAppearance(L2Character character) {
|
||||
this.character = character;
|
||||
@@ -206,21 +191,6 @@ public class CharacterAppearance {
|
||||
this.hairStyle = hairStyle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the character sex
|
||||
*/
|
||||
public CharacterSex getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sex
|
||||
* the character sex to set
|
||||
*/
|
||||
public void setSex(CharacterSex sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the alternative name
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.l2jserver.model.world.character;
|
||||
|
||||
public interface CharacterAttributes {
|
||||
/**
|
||||
* @return the intelligence
|
||||
*/
|
||||
public int getIntelligence();
|
||||
|
||||
/**
|
||||
* @return the strength
|
||||
*/
|
||||
public int getStrength();
|
||||
|
||||
/**
|
||||
* @return the concentration
|
||||
*/
|
||||
public int getConcentration();
|
||||
|
||||
/**
|
||||
* @return the mentality
|
||||
*/
|
||||
public int getMentality();
|
||||
|
||||
/**
|
||||
* @return the dextry
|
||||
*/
|
||||
public int getDextry();
|
||||
|
||||
/**
|
||||
* @return the witness
|
||||
*/
|
||||
public int getWitness();
|
||||
|
||||
/**
|
||||
* @return the physicalAttack
|
||||
*/
|
||||
public int getPhysicalAttack();
|
||||
|
||||
/**
|
||||
* @return the magicalAttack
|
||||
*/
|
||||
public int getMagicalAttack();
|
||||
|
||||
/**
|
||||
* @return the physicalDefense
|
||||
*/
|
||||
public int getPhysicalDefense();
|
||||
|
||||
/**
|
||||
* @return the magicalDefense
|
||||
*/
|
||||
public int getMagicalDefense();
|
||||
|
||||
/**
|
||||
* @return the attackSpeed
|
||||
*/
|
||||
public int getAttackSpeed();
|
||||
|
||||
/**
|
||||
* @return the castSpeed
|
||||
*/
|
||||
public int getCastSpeed();
|
||||
|
||||
/**
|
||||
* @return the accuracy
|
||||
*/
|
||||
public int getAccuracy();
|
||||
|
||||
/**
|
||||
* @return the criticalChance
|
||||
*/
|
||||
public int getCriticalChance();
|
||||
|
||||
/**
|
||||
* @return the evasionChance
|
||||
*/
|
||||
public int getEvasionChance();
|
||||
|
||||
/**
|
||||
* @return the movement speed
|
||||
*/
|
||||
public int getMoveSpeed();
|
||||
|
||||
/**
|
||||
* @return the maxWeigth
|
||||
*/
|
||||
public int getMaxWeigth();
|
||||
|
||||
/**
|
||||
* @return the craft
|
||||
*/
|
||||
public boolean canCraft();
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
package com.l2jserver.model.world.character;
|
||||
|
||||
/**
|
||||
* Defines the attributes of an character
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterBaseAttributes implements CharacterAttributes {
|
||||
/**
|
||||
* The character intelligence
|
||||
*/
|
||||
private final int intelligence;
|
||||
/**
|
||||
* The character strength
|
||||
*/
|
||||
private final int strength;
|
||||
/**
|
||||
* The character concentration
|
||||
*/
|
||||
private final int concentration;
|
||||
/**
|
||||
* The character mentality power
|
||||
*/
|
||||
private final int mentality;
|
||||
/**
|
||||
* The character dextry
|
||||
*/
|
||||
private final int dextry;
|
||||
/**
|
||||
* The character witness
|
||||
*/
|
||||
private final int witness;
|
||||
|
||||
/**
|
||||
* The default physical attack
|
||||
*/
|
||||
private final int physicalAttack;
|
||||
/**
|
||||
* The default magical attack
|
||||
*/
|
||||
private final int magicalAttack;
|
||||
/**
|
||||
* The physical defense
|
||||
*/
|
||||
private final int physicalDefense;
|
||||
/**
|
||||
* The magical defense
|
||||
*/
|
||||
private final int magicalDefense;
|
||||
|
||||
/**
|
||||
* The physical attack speed
|
||||
*/
|
||||
private final int attackSpeed;
|
||||
/**
|
||||
* The "magical attack speed" (aka cast speed)
|
||||
*/
|
||||
private final int castSpeed;
|
||||
|
||||
/**
|
||||
* The character accuracy
|
||||
*/
|
||||
private final int accuracy;
|
||||
/**
|
||||
* Chance of issuing an critical attack
|
||||
*/
|
||||
private final int criticalChance;
|
||||
/**
|
||||
* Chance of avoiding an attack
|
||||
*/
|
||||
private final int evasionChance;
|
||||
/**
|
||||
* The character's movement speed
|
||||
*/
|
||||
private final int moveSpeed;
|
||||
/**
|
||||
* The maximum weigth in items to be carried in the inventory
|
||||
*/
|
||||
private final int maxWeigth;
|
||||
/**
|
||||
* If this character can craft
|
||||
*/
|
||||
private final boolean craft;
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param intelligence
|
||||
* the intelligence
|
||||
* @param strength
|
||||
* the strength
|
||||
* @param concentration
|
||||
* the concentration
|
||||
* @param mentality
|
||||
* the mentality
|
||||
* @param dextry
|
||||
* the dextry
|
||||
* @param witness
|
||||
* the witness
|
||||
* @param physicalAttack
|
||||
* the physical attack
|
||||
* @param magicalAttack
|
||||
* the magical attack
|
||||
* @param physicalDefense
|
||||
* the physical defense
|
||||
* @param magicalDefense
|
||||
* the magical defense
|
||||
* @param attackSpeed
|
||||
* the attack speed
|
||||
* @param castSpeed
|
||||
* the cast speed
|
||||
* @param accuracy
|
||||
* the accuracy
|
||||
* @param criticalChance
|
||||
* the critical chance
|
||||
* @param evasionChance
|
||||
* the evasion chance
|
||||
* @param maxWeigth
|
||||
* the maximum weight in inventory
|
||||
* @param moveSpeed
|
||||
* the character movement speed
|
||||
* @param craft
|
||||
* if the character can craft items
|
||||
*/
|
||||
public CharacterBaseAttributes(int intelligence, int strength,
|
||||
int concentration, int mentality, int dextry, int witness,
|
||||
int physicalAttack, int magicalAttack, int physicalDefense,
|
||||
int magicalDefense, int attackSpeed, int castSpeed, int accuracy,
|
||||
int criticalChance, int evasionChance, int moveSpeed,
|
||||
int maxWeigth, boolean craft) {
|
||||
this.intelligence = intelligence;
|
||||
this.strength = strength;
|
||||
this.concentration = concentration;
|
||||
this.mentality = mentality;
|
||||
this.dextry = dextry;
|
||||
this.witness = witness;
|
||||
this.physicalAttack = physicalAttack;
|
||||
this.magicalAttack = magicalAttack;
|
||||
this.physicalDefense = physicalDefense;
|
||||
this.magicalDefense = magicalDefense;
|
||||
this.attackSpeed = attackSpeed;
|
||||
this.castSpeed = castSpeed;
|
||||
this.accuracy = accuracy;
|
||||
this.criticalChance = criticalChance;
|
||||
this.evasionChance = evasionChance;
|
||||
this.moveSpeed = moveSpeed;
|
||||
this.maxWeigth = maxWeigth;
|
||||
this.craft = craft;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the intelligence
|
||||
*/
|
||||
public int getIntelligence() {
|
||||
return intelligence;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the strength
|
||||
*/
|
||||
public int getStrength() {
|
||||
return strength;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the concentration
|
||||
*/
|
||||
public int getConcentration() {
|
||||
return concentration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the mentality
|
||||
*/
|
||||
public int getMentality() {
|
||||
return mentality;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dextry
|
||||
*/
|
||||
public int getDextry() {
|
||||
return dextry;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the witness
|
||||
*/
|
||||
public int getWitness() {
|
||||
return witness;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the physicalAttack
|
||||
*/
|
||||
public int getPhysicalAttack() {
|
||||
return physicalAttack;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the magicalAttack
|
||||
*/
|
||||
public int getMagicalAttack() {
|
||||
return magicalAttack;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the physicalDefense
|
||||
*/
|
||||
public int getPhysicalDefense() {
|
||||
return physicalDefense;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the magicalDefense
|
||||
*/
|
||||
public int getMagicalDefense() {
|
||||
return magicalDefense;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the attackSpeed
|
||||
*/
|
||||
public int getAttackSpeed() {
|
||||
return attackSpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the castSpeed
|
||||
*/
|
||||
public int getCastSpeed() {
|
||||
return castSpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the accuracy
|
||||
*/
|
||||
public int getAccuracy() {
|
||||
return accuracy;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the criticalChance
|
||||
*/
|
||||
public int getCriticalChance() {
|
||||
return criticalChance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the evasionChance
|
||||
*/
|
||||
public int getEvasionChance() {
|
||||
return evasionChance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the moveSpeed
|
||||
*/
|
||||
public int getMoveSpeed() {
|
||||
return moveSpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maxWeigth
|
||||
*/
|
||||
public int getMaxWeigth() {
|
||||
return maxWeigth;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the craft
|
||||
*/
|
||||
public boolean canCraft() {
|
||||
return craft;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.l2jserver.model.world.character;
|
||||
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
|
||||
public class CharacterCalculatedAttributes implements CharacterAttributes {
|
||||
private final L2Character character;
|
||||
private final CharacterAttributes baseAttributes;
|
||||
|
||||
public CharacterCalculatedAttributes(L2Character character) {
|
||||
this.character = character;
|
||||
this.baseAttributes = this.character.getBaseAttributes();
|
||||
}
|
||||
|
||||
public int getIntelligence() {
|
||||
return baseAttributes.getIntelligence();
|
||||
}
|
||||
|
||||
public int getStrength() {
|
||||
return baseAttributes.getStrength();
|
||||
}
|
||||
|
||||
public int getConcentration() {
|
||||
return baseAttributes.getConcentration();
|
||||
}
|
||||
|
||||
public int getMentality() {
|
||||
return baseAttributes.getMentality();
|
||||
}
|
||||
|
||||
public int getDextry() {
|
||||
return baseAttributes.getDextry();
|
||||
}
|
||||
|
||||
public int getWitness() {
|
||||
return baseAttributes.getWitness();
|
||||
}
|
||||
|
||||
public int getPhysicalAttack() {
|
||||
return baseAttributes.getPhysicalAttack();
|
||||
}
|
||||
|
||||
public int getMagicalAttack() {
|
||||
return baseAttributes.getMagicalAttack();
|
||||
}
|
||||
|
||||
public int getPhysicalDefense() {
|
||||
return baseAttributes.getPhysicalDefense();
|
||||
}
|
||||
|
||||
public int getMagicalDefense() {
|
||||
return baseAttributes.getMagicalDefense();
|
||||
}
|
||||
|
||||
public int getAttackSpeed() {
|
||||
return baseAttributes.getAttackSpeed();
|
||||
}
|
||||
|
||||
public int getCastSpeed() {
|
||||
return baseAttributes.getCastSpeed();
|
||||
}
|
||||
|
||||
public int getAccuracy() {
|
||||
return baseAttributes.getAccuracy();
|
||||
}
|
||||
|
||||
public int getCriticalChance() {
|
||||
return baseAttributes.getCriticalChance();
|
||||
}
|
||||
|
||||
public int getEvasionChance() {
|
||||
return baseAttributes.getEvasionChance();
|
||||
}
|
||||
|
||||
public int getMoveSpeed() {
|
||||
return baseAttributes.getMoveSpeed();
|
||||
}
|
||||
|
||||
public int getMaxWeigth() {
|
||||
return baseAttributes.getMaxWeigth();
|
||||
}
|
||||
|
||||
public boolean canCraft() {
|
||||
return baseAttributes.canCraft();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.l2jserver.model.world.character;
|
||||
|
||||
import com.l2jserver.model.world.AbstractActor.Race;
|
||||
|
||||
/**
|
||||
* Defines all the possible classes for an character
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum CharacterClass {
|
||||
/**
|
||||
* Human fighter
|
||||
*/
|
||||
HUMAN_FIGHTER(0x00, Race.HUMAN), WARRIOR(0x01, HUMAN_FIGHTER), GLADIATOR(
|
||||
0x02, WARRIOR), WARLORD(0x03, WARRIOR), KNIGHT(0x04, HUMAN_FIGHTER), PALADIN(
|
||||
0x05, KNIGHT), DARK_AVENGER(0x06, KNIGHT), ROGUE(0x07,
|
||||
HUMAN_FIGHTER), REASURE_HUNTER(0x08, ROGUE), HAWKEYE(0x09, ROGUE),
|
||||
/**
|
||||
* Human mystic
|
||||
*/
|
||||
HUMAN_MYSTIC(0x0a, true, Race.HUMAN), WIZARD(0x0b, HUMAN_MYSTIC), SORCEROR(
|
||||
0x0c, WIZARD), NECROMANCER(0x0d, WIZARD), WARLOCK(0x0e, true, true,
|
||||
WIZARD), CLERIC(0x0f, HUMAN_MYSTIC), BISHOP(0x10, CLERIC), PROPHET(
|
||||
0x11, CLERIC),
|
||||
|
||||
/**
|
||||
* Elven fighter
|
||||
*/
|
||||
ELVEN_FIGHTER(0x12, Race.ELF), ELVEN_KNIGHT(0x13, ELVEN_FIGHTER), TEMPLE_KNIGHT(
|
||||
0x14, ELVEN_KNIGHT), SWORD_SINGER(0x15, ELVEN_KNIGHT), ELVEN_SCOUT(
|
||||
0x16, ELVEN_FIGHTER), PLAINS_WALKER(0x17, ELVEN_SCOUT), SILVER_RANGER(
|
||||
0x18, ELVEN_SCOUT),
|
||||
/**
|
||||
* Elven mystic
|
||||
*/
|
||||
ELVEN_MYSTIC(0x19, true, Race.ELF), ELVEN_WIZARD(0x1a, ELVEN_MYSTIC), SPELLSINGER(
|
||||
0x1b, ELVEN_WIZARD), ELEMENTAL_SUMMONER(0x1c, true, true,
|
||||
ELVEN_WIZARD), ORACLE(0x1d, ELVEN_MYSTIC), ELDER(0x1e, ORACLE),
|
||||
|
||||
/**
|
||||
* Dark elf fighter
|
||||
*/
|
||||
DARK_FIGHTER(0x1f, Race.DARK_ELF), PALUS_KNIGHT(0x20, DARK_FIGHTER), SHILLIEN_KNIGHT(
|
||||
0x21, PALUS_KNIGHT), BLADEDANCER(0x22, PALUS_KNIGHT), ASSASSIN(
|
||||
0x23, DARK_FIGHTER), ABYSS_WALKER(0x24, ASSASSIN), PHANTOM_RANGER(
|
||||
0x25, ASSASSIN),
|
||||
|
||||
/**
|
||||
* Dark elf mystic
|
||||
*/
|
||||
DARK_MYSTIC(0x26, true, Race.DARK_ELF), DARK_WIZARD(0x27, DARK_MYSTIC), SPELLHOWLER(
|
||||
0x28, DARK_WIZARD), PHANTOM_SUMMONER(0x29, true, true, DARK_WIZARD), SHILLIEN_ORACLE(
|
||||
0x2a, DARK_MYSTIC), SHILLIEN_ELDER(0x2b, SHILLIEN_ORACLE);
|
||||
|
||||
// TODO dwarf classes
|
||||
// TODO kamael classes
|
||||
// TODO 3rd classes
|
||||
|
||||
public final int id;
|
||||
public final boolean mystic;
|
||||
public final boolean summoner;
|
||||
public final Race race;
|
||||
public final CharacterClass parent;
|
||||
|
||||
private CharacterClass(int id, boolean mystic, boolean summoner, Race race,
|
||||
CharacterClass parent) {
|
||||
this.id = id;
|
||||
this.mystic = mystic;
|
||||
this.summoner = summoner;
|
||||
this.race = race;
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
private CharacterClass(int id, CharacterClass parent) {
|
||||
this(id, parent.mystic, parent.summoner, parent.race, parent);
|
||||
}
|
||||
|
||||
private CharacterClass(int id, Race race, CharacterClass parent) {
|
||||
this(id, false, false, race, parent);
|
||||
}
|
||||
|
||||
private CharacterClass(int id, Race race) {
|
||||
this(id, false, false, race, null);
|
||||
}
|
||||
|
||||
private CharacterClass(int id, boolean mystic, Race race) {
|
||||
this(id, mystic, false, race, null);
|
||||
}
|
||||
|
||||
private CharacterClass(int id, boolean mystic, boolean summoner,
|
||||
CharacterClass parent) {
|
||||
this(id, mystic, summoner, parent.race, parent);
|
||||
}
|
||||
|
||||
public CharacterClass fromID(int id) {
|
||||
for (final CharacterClass c : values()) {
|
||||
if (c.id == id)
|
||||
return c;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the level of the class. Base class is zero.
|
||||
*
|
||||
* @return the class level
|
||||
*/
|
||||
public final int level() {
|
||||
if (parent == null)
|
||||
return 0;
|
||||
return 1 + parent.level();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user