mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-11 09:42:54 +00:00
Template classes for all NPC instances
Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
@@ -34,14 +34,14 @@ public abstract class Actor extends PositionableObject {
|
||||
/**
|
||||
* The actor race
|
||||
*/
|
||||
protected Race race;
|
||||
protected ActorRace race;
|
||||
|
||||
/**
|
||||
* Represents the actor race.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum Race {
|
||||
public enum ActorRace {
|
||||
HUMAN(0x00), ELF(0x01), DARK_ELF(0x02), ORC(0x03), DWARF(0x04), KAMAEL(
|
||||
0x05);
|
||||
|
||||
@@ -50,7 +50,7 @@ public abstract class Actor extends PositionableObject {
|
||||
*/
|
||||
public final int id;
|
||||
|
||||
Race(int id) {
|
||||
ActorRace(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@ public abstract class Actor extends PositionableObject {
|
||||
* the id
|
||||
* @return the race constant
|
||||
*/
|
||||
public static Race fromOption(int id) {
|
||||
for (final Race race : values()) {
|
||||
public static ActorRace fromOption(int id) {
|
||||
for (final ActorRace race : values()) {
|
||||
if (race.id == id)
|
||||
return race;
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public abstract class Actor extends PositionableObject {
|
||||
/**
|
||||
* The actor sex
|
||||
*/
|
||||
protected Sex sex;
|
||||
protected ActorSex sex;
|
||||
|
||||
/**
|
||||
* Represent the sex of an actor.
|
||||
@@ -81,17 +81,17 @@ public abstract class Actor extends PositionableObject {
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum Sex {
|
||||
public enum ActorSex {
|
||||
MALE(0x00), FEMALE(0x01);
|
||||
|
||||
public final int option;
|
||||
|
||||
Sex(int option) {
|
||||
ActorSex(int option) {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
public static Sex fromOption(int option) {
|
||||
for (Sex sex : values()) {
|
||||
public static ActorSex fromOption(int option) {
|
||||
for (ActorSex sex : values()) {
|
||||
if (sex.option == option)
|
||||
return sex;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public abstract class Actor extends PositionableObject {
|
||||
/**
|
||||
* @return the race
|
||||
*/
|
||||
public Race getRace() {
|
||||
public ActorRace getRace() {
|
||||
return race;
|
||||
}
|
||||
|
||||
@@ -143,14 +143,14 @@ public abstract class Actor extends PositionableObject {
|
||||
* @param race
|
||||
* the race to set
|
||||
*/
|
||||
public void setRace(Race race) {
|
||||
public void setRace(ActorRace race) {
|
||||
this.race = race;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sex
|
||||
*/
|
||||
public Sex getSex() {
|
||||
public ActorSex getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ public abstract class Actor extends PositionableObject {
|
||||
* @param sex
|
||||
* the sex to set
|
||||
*/
|
||||
public void setSex(Sex sex) {
|
||||
public void setSex(ActorSex sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.l2jserver.model.world.character.CharacterClass;
|
||||
import com.l2jserver.model.world.character.CharacterFriendList;
|
||||
import com.l2jserver.model.world.character.CharacterInventory;
|
||||
import com.l2jserver.model.world.character.CharacterShortcutContainer;
|
||||
import com.l2jserver.util.dimensional.Point;
|
||||
|
||||
/**
|
||||
* This class represents a playable character in Lineage II world.
|
||||
@@ -129,10 +130,20 @@ public class L2Character extends Player {
|
||||
*/
|
||||
private CharacterState state;
|
||||
|
||||
/**
|
||||
* The valid states for an character
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum CharacterState {
|
||||
TELEPORTING, CASTING, ATTACKING, MOVING;
|
||||
}
|
||||
|
||||
/**
|
||||
* The point the player is moving, teleporting etc...
|
||||
*/
|
||||
private Point targetLocation;
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
@@ -330,6 +341,28 @@ public class L2Character extends Player {
|
||||
return state == CharacterState.TELEPORTING;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if character is moving
|
||||
*/
|
||||
public boolean isMoving() {
|
||||
return state == CharacterState.MOVING;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the targetLocation
|
||||
*/
|
||||
public Point getTargetLocation() {
|
||||
return targetLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param targetLocation
|
||||
* the targetLocation to set
|
||||
*/
|
||||
public void setTargetLocation(Point targetLocation) {
|
||||
this.targetLocation = targetLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the inventory
|
||||
*/
|
||||
|
||||
@@ -60,22 +60,22 @@ public interface ActorAttributes {
|
||||
/**
|
||||
* @return the physicalAttack
|
||||
*/
|
||||
public int getPhysicalAttack();
|
||||
public double getPhysicalAttack();
|
||||
|
||||
/**
|
||||
* @return the magicalAttack
|
||||
*/
|
||||
public int getMagicalAttack();
|
||||
public double getMagicalAttack();
|
||||
|
||||
/**
|
||||
* @return the physicalDefense
|
||||
*/
|
||||
public int getPhysicalDefense();
|
||||
public double getPhysicalDefense();
|
||||
|
||||
/**
|
||||
* @return the magicalDefense
|
||||
*/
|
||||
public int getMagicalDefense();
|
||||
public double getMagicalDefense();
|
||||
|
||||
/**
|
||||
* @return the attackSpeed
|
||||
@@ -103,9 +103,14 @@ public interface ActorAttributes {
|
||||
public int getEvasionChance();
|
||||
|
||||
/**
|
||||
* @return the movement speed
|
||||
* @return the run speed
|
||||
*/
|
||||
public double getMoveSpeed();
|
||||
public double getRunSpeed();
|
||||
|
||||
/**
|
||||
* @return the walking speed
|
||||
*/
|
||||
public double getWalkSpeed();
|
||||
|
||||
/**
|
||||
* @return the maxWeigth
|
||||
|
||||
@@ -73,22 +73,22 @@ public class CharacterCalculatedAttributes implements ActorAttributes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPhysicalAttack() {
|
||||
public double getPhysicalAttack() {
|
||||
return baseAttributes.getPhysicalAttack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMagicalAttack() {
|
||||
public double getMagicalAttack() {
|
||||
return baseAttributes.getMagicalAttack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPhysicalDefense() {
|
||||
public double getPhysicalDefense() {
|
||||
return baseAttributes.getPhysicalDefense();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMagicalDefense() {
|
||||
public double getMagicalDefense() {
|
||||
return baseAttributes.getMagicalDefense();
|
||||
}
|
||||
|
||||
@@ -118,8 +118,13 @@ public class CharacterCalculatedAttributes implements ActorAttributes {
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getMoveSpeed() {
|
||||
return baseAttributes.getMoveSpeed();
|
||||
public double getRunSpeed() {
|
||||
return baseAttributes.getRunSpeed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWalkSpeed() {
|
||||
return baseAttributes.getWalkSpeed();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package com.l2jserver.model.world.character;
|
||||
|
||||
import com.l2jserver.model.world.Actor.Race;
|
||||
import com.l2jserver.model.world.Actor.ActorRace;
|
||||
|
||||
/**
|
||||
* Defines all the possible classes for an character
|
||||
@@ -27,7 +27,7 @@ public enum CharacterClass {
|
||||
/**
|
||||
* Human fighter
|
||||
*/
|
||||
HUMAN_FIGHTER(0x00, ClassType.FIGHTER, Race.HUMAN), WARRIOR(0x01,
|
||||
HUMAN_FIGHTER(0x00, ClassType.FIGHTER, ActorRace.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), TREASURE_HUNTER(0x08, ROGUE), HAWKEYE(
|
||||
@@ -40,7 +40,7 @@ public enum CharacterClass {
|
||||
/**
|
||||
* Human mystic
|
||||
*/
|
||||
HUMAN_MYSTIC(0x0a, ClassType.MYSTIC, Race.HUMAN), WIZARD(0x0b, HUMAN_MYSTIC), SORCEROR(
|
||||
HUMAN_MYSTIC(0x0a, ClassType.MYSTIC, ActorRace.HUMAN), WIZARD(0x0b, HUMAN_MYSTIC), SORCEROR(
|
||||
0x0c, WIZARD), NECROMANCER(0x0d, WIZARD), WARLOCK(0x0e, true,
|
||||
WIZARD), CLERIC(0x0f, ClassType.PRIEST, HUMAN_MYSTIC), BISHOP(0x10,
|
||||
CLERIC), PROPHET(0x11, CLERIC),
|
||||
@@ -51,7 +51,7 @@ public enum CharacterClass {
|
||||
/**
|
||||
* Elven fighter
|
||||
*/
|
||||
ELVEN_FIGHTER(0x12, ClassType.FIGHTER, Race.ELF), ELVEN_KNIGHT(0x13,
|
||||
ELVEN_FIGHTER(0x12, ClassType.FIGHTER, ActorRace.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),
|
||||
@@ -61,7 +61,7 @@ public enum CharacterClass {
|
||||
/**
|
||||
* Elven mystic
|
||||
*/
|
||||
ELVEN_MYSTIC(0x19, ClassType.MYSTIC, Race.ELF), ELVEN_WIZARD(0x1a,
|
||||
ELVEN_MYSTIC(0x19, ClassType.MYSTIC, ActorRace.ELF), ELVEN_WIZARD(0x1a,
|
||||
ELVEN_MYSTIC), SPELLSINGER(0x1b, ELVEN_WIZARD), ELEMENTAL_SUMMONER(
|
||||
0x1c, true, ELVEN_WIZARD), ORACLE(0x1d, ClassType.PRIEST,
|
||||
ELVEN_MYSTIC), ELDER(0x1e, ORACLE),
|
||||
@@ -72,7 +72,7 @@ public enum CharacterClass {
|
||||
/**
|
||||
* Dark elf fighter
|
||||
*/
|
||||
DARK_FIGHTER(0x1f, ClassType.FIGHTER, Race.DARK_ELF), PALUS_KNIGHT(0x20,
|
||||
DARK_FIGHTER(0x1f, ClassType.FIGHTER, ActorRace.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),
|
||||
@@ -83,7 +83,7 @@ public enum CharacterClass {
|
||||
/**
|
||||
* Dark elf mystic
|
||||
*/
|
||||
DARK_MYSTIC(0x26, ClassType.MYSTIC, Race.DARK_ELF), DARK_WIZARD(0x27,
|
||||
DARK_MYSTIC(0x26, ClassType.MYSTIC, ActorRace.DARK_ELF), DARK_WIZARD(0x27,
|
||||
DARK_MYSTIC), SPELLHOWLER(0x28, DARK_WIZARD), PHANTOM_SUMMONER(
|
||||
0x29, true, DARK_WIZARD), SHILLIEN_ORACLE(0x2a, ClassType.PRIEST,
|
||||
DARK_MYSTIC), SHILLIEN_ELDER(0x2b, SHILLIEN_ORACLE),
|
||||
@@ -94,7 +94,7 @@ public enum CharacterClass {
|
||||
/**
|
||||
* Orc fighter
|
||||
*/
|
||||
ORC_FIGHTER(0x2c, ClassType.FIGHTER, Race.ORC), ORC_RAIDER(0x2d,
|
||||
ORC_FIGHTER(0x2c, ClassType.FIGHTER, ActorRace.ORC), ORC_RAIDER(0x2d,
|
||||
ORC_FIGHTER), DESTROYER(0x2e, ORC_RAIDER), ORC_MONK(0x2f,
|
||||
ORC_FIGHTER), TYRANT(0x30, ORC_RAIDER),
|
||||
// 3rd classes
|
||||
@@ -103,7 +103,7 @@ public enum CharacterClass {
|
||||
/**
|
||||
* Orc mystic
|
||||
*/
|
||||
ORC_MYSTIC(0x31, ClassType.MYSTIC, Race.ORC), ORC_SHAMAN(0x32, ORC_MYSTIC), OVERLORD(
|
||||
ORC_MYSTIC(0x31, ClassType.MYSTIC, ActorRace.ORC), ORC_SHAMAN(0x32, ORC_MYSTIC), OVERLORD(
|
||||
0x33, ORC_SHAMAN), WARCRYER(0x34, ORC_SHAMAN),
|
||||
// 3rd classes
|
||||
DOMINATOR(0x73, OVERLORD), DOOMCRYER(0x74, WARCRYER),
|
||||
@@ -111,7 +111,7 @@ public enum CharacterClass {
|
||||
/**
|
||||
* Dwarf fighter
|
||||
*/
|
||||
DWARVEN_FIGHTER(0x35, ClassType.FIGHTER, Race.DWARF), SCAVENGER(0x36,
|
||||
DWARVEN_FIGHTER(0x35, ClassType.FIGHTER, ActorRace.DWARF), SCAVENGER(0x36,
|
||||
DWARVEN_FIGHTER), BOUNTY_HUNTER(0x37, SCAVENGER), ARTISAN(0x38,
|
||||
DWARVEN_FIGHTER), WARSMITH(0x39, ARTISAN),
|
||||
// 3rd classes
|
||||
@@ -120,7 +120,7 @@ public enum CharacterClass {
|
||||
/**
|
||||
* Kamael male soldier
|
||||
*/
|
||||
MALE_SOLDIER(0x7b, ClassType.FIGHTER, Race.KAMAEL), TROOPER(0x7D,
|
||||
MALE_SOLDIER(0x7b, ClassType.FIGHTER, ActorRace.KAMAEL), TROOPER(0x7D,
|
||||
MALE_SOLDIER), BERSEKER(0x7F, TROOPER), MALE_SOULBREAKER(0x80,
|
||||
TROOPER), DOOMBRINGER(0x83, BERSEKER), MALE_SOULDHOUND(0x84,
|
||||
MALE_SOULBREAKER),
|
||||
@@ -128,7 +128,7 @@ public enum CharacterClass {
|
||||
/**
|
||||
* Kamael female soldier
|
||||
*/
|
||||
FEMALE_SOLDIER(0x7C, ClassType.FIGHTER, Race.KAMAEL), WARDER(0x7E,
|
||||
FEMALE_SOLDIER(0x7C, ClassType.FIGHTER, ActorRace.KAMAEL), WARDER(0x7E,
|
||||
FEMALE_SOLDIER), FEMALE_SOULBREAKER(0x81, WARDER), ARBALESTER(0x82,
|
||||
WARDER), FEMALE_SOULDHOUND(0x85, FEMALE_SOULBREAKER), TRICKSTER(
|
||||
0x86, ARBALESTER), INSPECTOR(0x87, WARDER), JUDICATOR(0x88,
|
||||
@@ -174,7 +174,7 @@ public enum CharacterClass {
|
||||
/**
|
||||
* The class race
|
||||
*/
|
||||
public final Race race;
|
||||
public final ActorRace race;
|
||||
/**
|
||||
* The parent class
|
||||
*/
|
||||
@@ -194,7 +194,7 @@ public enum CharacterClass {
|
||||
* @param parent
|
||||
* the parent
|
||||
*/
|
||||
private CharacterClass(int id, ClassType type, boolean summoner, Race race,
|
||||
private CharacterClass(int id, ClassType type, boolean summoner, ActorRace race,
|
||||
CharacterClass parent) {
|
||||
this.id = id;
|
||||
this.type = type;
|
||||
@@ -242,7 +242,7 @@ public enum CharacterClass {
|
||||
* @param parent
|
||||
* the parent class
|
||||
*/
|
||||
private CharacterClass(int id, Race race, CharacterClass parent) {
|
||||
private CharacterClass(int id, ActorRace race, CharacterClass parent) {
|
||||
this(id, parent.type, parent.summoner, race, parent);
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ public enum CharacterClass {
|
||||
* @param race
|
||||
* the class race
|
||||
*/
|
||||
private CharacterClass(int id, ClassType type, Race race) {
|
||||
private CharacterClass(int id, ClassType type, ActorRace race) {
|
||||
this(id, type, false, race, null);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user