mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-08 08:23:11 +00:00
Template classes for all NPC instances
Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
@@ -21,7 +21,6 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.l2jserver.model.id.template.ActorTemplateID;
|
||||
import com.l2jserver.model.world.Actor;
|
||||
import com.l2jserver.model.world.Actor.Race;
|
||||
import com.l2jserver.model.world.actor.ActorAttributes;
|
||||
|
||||
/**
|
||||
@@ -37,11 +36,6 @@ public abstract class ActorTemplate<T extends Actor> extends
|
||||
private static final Logger log = LoggerFactory
|
||||
.getLogger(ActorTemplate.class);
|
||||
|
||||
/**
|
||||
* The actor race
|
||||
*/
|
||||
protected final Race race;
|
||||
|
||||
/**
|
||||
* The movement speed multiplier
|
||||
*/
|
||||
@@ -51,16 +45,21 @@ public abstract class ActorTemplate<T extends Actor> extends
|
||||
*/
|
||||
protected double attackSpeedMultiplier = 1.0;
|
||||
|
||||
protected int maxHp;
|
||||
protected double maxHP;
|
||||
protected double HP;
|
||||
|
||||
protected double maxMP;
|
||||
protected double MP;
|
||||
|
||||
protected int level;
|
||||
|
||||
/**
|
||||
* The base attributes instance
|
||||
*/
|
||||
protected ActorBaseAttributes attributes = new ActorBaseAttributes();
|
||||
|
||||
public ActorTemplate(ActorTemplateID<?> id, Race race) {
|
||||
public ActorTemplate(ActorTemplateID<?> id) {
|
||||
super(id);
|
||||
this.race = race;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,13 +72,6 @@ public abstract class ActorTemplate<T extends Actor> extends
|
||||
|
||||
protected abstract T createInstance();
|
||||
|
||||
/**
|
||||
* @return the race
|
||||
*/
|
||||
public Race getRace() {
|
||||
return race;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the baseAttributes
|
||||
*/
|
||||
@@ -139,7 +131,7 @@ public abstract class ActorTemplate<T extends Actor> extends
|
||||
* @return
|
||||
* @see com.l2jserver.model.template.ActorBaseAttributes#getPhysicalAttack()
|
||||
*/
|
||||
public int getPhysicalAttack() {
|
||||
public double getPhysicalAttack() {
|
||||
return attributes.getPhysicalAttack();
|
||||
}
|
||||
|
||||
@@ -147,7 +139,7 @@ public abstract class ActorTemplate<T extends Actor> extends
|
||||
* @return
|
||||
* @see com.l2jserver.model.template.ActorBaseAttributes#getMagicalAttack()
|
||||
*/
|
||||
public int getMagicalAttack() {
|
||||
public double getMagicalAttack() {
|
||||
return attributes.getMagicalAttack();
|
||||
}
|
||||
|
||||
@@ -155,7 +147,7 @@ public abstract class ActorTemplate<T extends Actor> extends
|
||||
* @return
|
||||
* @see com.l2jserver.model.template.ActorBaseAttributes#getPhysicalDefense()
|
||||
*/
|
||||
public int getPhysicalDefense() {
|
||||
public double getPhysicalDefense() {
|
||||
return attributes.getPhysicalDefense();
|
||||
}
|
||||
|
||||
@@ -163,7 +155,7 @@ public abstract class ActorTemplate<T extends Actor> extends
|
||||
* @return
|
||||
* @see com.l2jserver.model.template.ActorBaseAttributes#getMagicalDefense()
|
||||
*/
|
||||
public int getMagicalDefense() {
|
||||
public double getMagicalDefense() {
|
||||
return attributes.getMagicalDefense();
|
||||
}
|
||||
|
||||
@@ -209,10 +201,18 @@ public abstract class ActorTemplate<T extends Actor> extends
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.template.ActorBaseAttributes#getMoveSpeed()
|
||||
* @see com.l2jserver.model.template.ActorBaseAttributes#getRunSpeed()
|
||||
*/
|
||||
public double getMoveSpeed() {
|
||||
return attributes.getMoveSpeed();
|
||||
public double getRunSpeed() {
|
||||
return attributes.getRunSpeed();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.template.ActorBaseAttributes#getWalkSpeed()
|
||||
*/
|
||||
public double getWalkSpeed() {
|
||||
return attributes.getWalkSpeed();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -248,8 +248,8 @@ public abstract class ActorTemplate<T extends Actor> extends
|
||||
/**
|
||||
* @return the max hp
|
||||
*/
|
||||
public int getMaxHP() {
|
||||
return maxHp;
|
||||
public double getMaxHP() {
|
||||
return maxHP;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -286,19 +286,19 @@ public abstract class ActorTemplate<T extends Actor> extends
|
||||
/**
|
||||
* The default physical attack
|
||||
*/
|
||||
public int physicalAttack;
|
||||
public double physicalAttack;
|
||||
/**
|
||||
* The default magical attack
|
||||
*/
|
||||
public int magicalAttack;
|
||||
public double magicalAttack;
|
||||
/**
|
||||
* The physical defense
|
||||
*/
|
||||
public int physicalDefense;
|
||||
public double physicalDefense;
|
||||
/**
|
||||
* The magical defense
|
||||
*/
|
||||
public int magicalDefense;
|
||||
public double magicalDefense;
|
||||
|
||||
/**
|
||||
* The physical attack speed
|
||||
@@ -322,9 +322,13 @@ public abstract class ActorTemplate<T extends Actor> extends
|
||||
*/
|
||||
public int evasionChance;
|
||||
/**
|
||||
* The character's movement speed
|
||||
* The character's run speed
|
||||
*/
|
||||
public float moveSpeed;
|
||||
public double runSpeed;
|
||||
/**
|
||||
* The character's walk speed
|
||||
*/
|
||||
public double walkSpeed;
|
||||
/**
|
||||
* The maximum weigth in items to be carried in the inventory
|
||||
*/
|
||||
@@ -386,7 +390,7 @@ public abstract class ActorTemplate<T extends Actor> extends
|
||||
* @return the physicalAttack
|
||||
*/
|
||||
@Override
|
||||
public int getPhysicalAttack() {
|
||||
public double getPhysicalAttack() {
|
||||
return physicalAttack;
|
||||
}
|
||||
|
||||
@@ -394,7 +398,7 @@ public abstract class ActorTemplate<T extends Actor> extends
|
||||
* @return the magicalAttack
|
||||
*/
|
||||
@Override
|
||||
public int getMagicalAttack() {
|
||||
public double getMagicalAttack() {
|
||||
return magicalAttack;
|
||||
}
|
||||
|
||||
@@ -402,7 +406,7 @@ public abstract class ActorTemplate<T extends Actor> extends
|
||||
* @return the physicalDefense
|
||||
*/
|
||||
@Override
|
||||
public int getPhysicalDefense() {
|
||||
public double getPhysicalDefense() {
|
||||
return physicalDefense;
|
||||
}
|
||||
|
||||
@@ -410,7 +414,7 @@ public abstract class ActorTemplate<T extends Actor> extends
|
||||
* @return the magicalDefense
|
||||
*/
|
||||
@Override
|
||||
public int getMagicalDefense() {
|
||||
public double getMagicalDefense() {
|
||||
return magicalDefense;
|
||||
}
|
||||
|
||||
@@ -458,8 +462,13 @@ public abstract class ActorTemplate<T extends Actor> extends
|
||||
* @return the moveSpeed
|
||||
*/
|
||||
@Override
|
||||
public double getMoveSpeed() {
|
||||
return moveSpeed;
|
||||
public double getRunSpeed() {
|
||||
return runSpeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getWalkSpeed() {
|
||||
return walkSpeed;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.id.template.CharacterTemplateID;
|
||||
import com.l2jserver.model.world.Actor.ActorRace;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.character.CharacterClass;
|
||||
import com.l2jserver.util.dimensional.Point;
|
||||
@@ -59,10 +60,10 @@ public abstract class CharacterTemplate extends ActorTemplate<L2Character> {
|
||||
* The collision height for female instances
|
||||
*/
|
||||
protected double femaleCollisionHeight = 0;
|
||||
|
||||
|
||||
protected CharacterTemplate(CharacterTemplateID id,
|
||||
CharacterClass characterClass, Point spawnLocation) {
|
||||
super(id, characterClass.race);
|
||||
super(id);
|
||||
this.characterClass = characterClass;
|
||||
this.spawnLocation = spawnLocation;
|
||||
}
|
||||
@@ -71,13 +72,20 @@ public abstract class CharacterTemplate extends ActorTemplate<L2Character> {
|
||||
public L2Character createInstance() {
|
||||
final L2Character character = new L2Character(this.getID(), attributes);
|
||||
|
||||
character.setRace(race);
|
||||
character.setRace(getRace());
|
||||
character.setCharacterClass(characterClass);
|
||||
character.setPoint(spawnLocation);
|
||||
|
||||
return character;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the race
|
||||
*/
|
||||
public ActorRace getRace() {
|
||||
return characterClass.race;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the characterClass
|
||||
*/
|
||||
@@ -91,7 +99,7 @@ public abstract class CharacterTemplate extends ActorTemplate<L2Character> {
|
||||
public Point getSpawnLocation() {
|
||||
return spawnLocation;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the male collision radius
|
||||
*/
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.l2jserver.model.id.template.NPCTemplateID;
|
||||
import com.l2jserver.model.id.template.provider.ItemTemplateIDProvider;
|
||||
import com.l2jserver.model.template.capability.Interactable;
|
||||
import com.l2jserver.model.world.Actor;
|
||||
import com.l2jserver.model.world.Actor.Race;
|
||||
import com.l2jserver.model.world.Actor.ActorSex;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.NPC;
|
||||
import com.l2jserver.service.game.character.CannotSetTargetServiceException;
|
||||
@@ -62,10 +62,18 @@ public abstract class NPCTemplate extends ActorTemplate<NPC> implements
|
||||
* The NPC name
|
||||
*/
|
||||
protected String name = null;
|
||||
/**
|
||||
* If true will send the name in the packet
|
||||
*/
|
||||
protected boolean serverSideName;
|
||||
/**
|
||||
* The NPC title
|
||||
*/
|
||||
protected String title = null;
|
||||
/**
|
||||
* If true will send the title in the packet
|
||||
*/
|
||||
protected boolean serverSideTitle;
|
||||
/**
|
||||
* The attackable state of the NPC
|
||||
*/
|
||||
@@ -80,8 +88,36 @@ public abstract class NPCTemplate extends ActorTemplate<NPC> implements
|
||||
*/
|
||||
protected double collisionHeight = 0;
|
||||
|
||||
// id idTemplate name serverSideName title serverSideTitle class
|
||||
// collision_radius collision_height level sex type attackrange hp mp hpreg
|
||||
// mpreg str con dex int wit men exp sp patk pdef matk mdef atkspd critical
|
||||
// aggro matkspd rhand lhand enchant walkspd runspd targetable show_name
|
||||
// dropHerbGroup basestats
|
||||
|
||||
protected ActorSex sex;
|
||||
protected int level;
|
||||
|
||||
protected int attackRange;
|
||||
|
||||
protected double hpRegeneration;
|
||||
protected double mpRegeneration;
|
||||
|
||||
protected long experience;
|
||||
protected long sp;
|
||||
|
||||
protected boolean aggressive;
|
||||
|
||||
protected ItemTemplateID rightHand;
|
||||
protected ItemTemplateID leftHand;
|
||||
protected int enchantLevel;
|
||||
|
||||
protected boolean targetable;
|
||||
protected boolean showName;
|
||||
protected int dropHerbGroup;
|
||||
protected boolean baseAttributes;
|
||||
|
||||
protected NPCTemplate(NPCTemplateID id) {
|
||||
super(id, null);
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -195,10 +231,122 @@ public abstract class NPCTemplate extends ActorTemplate<NPC> implements
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the race
|
||||
* @return the serverSideName
|
||||
*/
|
||||
public Race getRace() {
|
||||
return race;
|
||||
public boolean isServerSideName() {
|
||||
return serverSideName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the serverSideTitle
|
||||
*/
|
||||
public boolean isServerSideTitle() {
|
||||
return serverSideTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sex
|
||||
*/
|
||||
public ActorSex getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the level
|
||||
*/
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the attackRange
|
||||
*/
|
||||
public int getAttackRange() {
|
||||
return attackRange;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the hpRegeneration
|
||||
*/
|
||||
public double getHPRegeneration() {
|
||||
return hpRegeneration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the mpRegeneration
|
||||
*/
|
||||
public double getMPRegeneration() {
|
||||
return mpRegeneration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the experience
|
||||
*/
|
||||
public long getExperience() {
|
||||
return experience;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sp
|
||||
*/
|
||||
public long getSp() {
|
||||
return sp;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the aggressive
|
||||
*/
|
||||
public boolean isAggressive() {
|
||||
return aggressive;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the right Hand item
|
||||
*/
|
||||
public ItemTemplateID getRightHand() {
|
||||
return rightHand;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the left Hand item
|
||||
*/
|
||||
public ItemTemplateID getLeftHand() {
|
||||
return leftHand;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the enchantLevel
|
||||
*/
|
||||
public int getEnchantLevel() {
|
||||
return enchantLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the targetable
|
||||
*/
|
||||
public boolean isTargetable() {
|
||||
return targetable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the showName
|
||||
*/
|
||||
public boolean isShowName() {
|
||||
return showName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dropHerbGroup
|
||||
*/
|
||||
public int getDropHerbGroup() {
|
||||
return dropHerbGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the baseAttributes
|
||||
*/
|
||||
public boolean isBaseAttributes() {
|
||||
return baseAttributes;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.l2jserver.model.template.NPCTemplate;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*
|
||||
*/
|
||||
public class PenaltyNPCTemplate extends NPCTemplate {
|
||||
public class GrandBossNPCTemplate extends NPCTemplate {
|
||||
/**
|
||||
* Creates a new instance of this template
|
||||
*
|
||||
@@ -32,7 +32,7 @@ public class PenaltyNPCTemplate extends NPCTemplate {
|
||||
* @param race
|
||||
* the npc race
|
||||
*/
|
||||
protected PenaltyNPCTemplate(NPCTemplateID id) {
|
||||
protected GrandBossNPCTemplate(NPCTemplateID id) {
|
||||
super(id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.template.npc;
|
||||
|
||||
import com.l2jserver.model.id.template.NPCTemplateID;
|
||||
|
||||
/**
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*
|
||||
*/
|
||||
public class MysticVillageMasterNPCTemplate extends AbstractVillageMasterNPCTemplate {
|
||||
/**
|
||||
* Creates a new instance of this template
|
||||
*
|
||||
* @param id
|
||||
* the template id
|
||||
* @param race
|
||||
* the npc race
|
||||
*/
|
||||
protected MysticVillageMasterNPCTemplate(NPCTemplateID id) {
|
||||
super(id);
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ import com.l2jserver.model.template.NPCTemplate;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*
|
||||
*/
|
||||
public class SignsPriestsNPCTemplate extends NPCTemplate {
|
||||
public class PenaltyMonsterNPCTemplate extends NPCTemplate {
|
||||
/**
|
||||
* Creates a new instance of this template
|
||||
*
|
||||
@@ -32,7 +32,7 @@ public class SignsPriestsNPCTemplate extends NPCTemplate {
|
||||
* @param race
|
||||
* the npc race
|
||||
*/
|
||||
protected SignsPriestsNPCTemplate(NPCTemplateID id) {
|
||||
protected PenaltyMonsterNPCTemplate(NPCTemplateID id) {
|
||||
super(id);
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ import com.l2jserver.model.template.NPCTemplate;
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*
|
||||
*/
|
||||
public class GrandeBossNPCTemplate extends NPCTemplate {
|
||||
public class SignsPriestNPCTemplate extends NPCTemplate {
|
||||
/**
|
||||
* Creates a new instance of this template
|
||||
*
|
||||
@@ -32,7 +32,7 @@ public class GrandeBossNPCTemplate extends NPCTemplate {
|
||||
* @param race
|
||||
* the npc race
|
||||
*/
|
||||
protected GrandeBossNPCTemplate(NPCTemplateID id) {
|
||||
protected SignsPriestNPCTemplate(NPCTemplateID id) {
|
||||
super(id);
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ import com.l2jserver.model.id.template.NPCTemplateID;
|
||||
import com.l2jserver.model.template.NPCTemplate;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.NPC;
|
||||
import com.l2jserver.service.game.spawn.CharacterAlreadyTeleportingServiceException;
|
||||
import com.l2jserver.service.game.spawn.NotSpawnedServiceException;
|
||||
import com.l2jserver.service.game.spawn.SpawnService;
|
||||
import com.l2jserver.util.dimensional.Coordinate;
|
||||
@@ -103,6 +104,8 @@ public class TeleporterNPCTemplate extends NPCTemplate {
|
||||
*/
|
||||
protected TeleporterNPCTemplate(NPCTemplateID id) {
|
||||
super(id);
|
||||
// TODO remove this when possible
|
||||
addLocation("Talking Island Village - temporary", TALKING_ISLAND_VILLAGE, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -138,7 +141,8 @@ public class TeleporterNPCTemplate extends NPCTemplate {
|
||||
|
||||
protected void teleport(NPC npc, L2Character character,
|
||||
Lineage2Connection conn, String name)
|
||||
throws NotSpawnedServiceException {
|
||||
throws NotSpawnedServiceException,
|
||||
CharacterAlreadyTeleportingServiceException {
|
||||
final int location = Integer.parseInt(name);
|
||||
final TeleportationMetadata metadata = locations.get(location);
|
||||
if (metadata == null) {
|
||||
|
||||
@@ -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