mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-08 08:23:11 +00:00
Change-Id: I0000000000000000000000000000000000000000
Change-Id: I8636776eaf000fcdfb528cc403710f6d6ee9e73e Change-Id: Iebc523681d07ecd6d7b7e89343b29a8034558f94
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package com.l2jserver.model.id;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.l2jserver.model.template.Template;
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
|
||||
/**
|
||||
* The ID interface. Each Object or Template must be represented by an unique
|
||||
* ID.
|
||||
* The ID interface. Each {@link WorldObject} or {@link Template} must be
|
||||
* represented by an unique ID.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
@@ -35,7 +37,7 @@ public abstract class ID {
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + id;
|
||||
result = prime * result + id + this.getClass().hashCode();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.l2jserver.model.id;
|
||||
|
||||
import com.l2jserver.model.template.Template;
|
||||
|
||||
|
||||
/**
|
||||
* Templates IDs, different from {@link ObjectID}s, can be repeated and are
|
||||
* defined in the template class.
|
||||
@@ -14,6 +13,6 @@ public abstract class TemplateID<T extends Template> extends ID {
|
||||
public TemplateID(int id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
|
||||
public abstract T getTemplate();
|
||||
}
|
||||
|
||||
@@ -15,5 +15,5 @@ public interface IDFactory<T extends ID> {
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
T createID(int id);
|
||||
T createID(int id);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.l2jserver.model.id.object.factory.CharacterIDFactory;
|
||||
import com.l2jserver.model.id.object.factory.CharacterIDFactory.CharacterIDGuiceFactory;
|
||||
import com.l2jserver.model.id.object.factory.ItemIDFactory;
|
||||
import com.l2jserver.model.id.object.factory.ItemIDFactory.ItemIDGuiceFactory;
|
||||
import com.l2jserver.model.id.template.factory.CharacterTemplateIDFactory;
|
||||
import com.l2jserver.model.id.template.factory.ItemTemplateIDFactory;
|
||||
import com.l2jserver.model.id.template.factory.SkillTemplateIDFactory;
|
||||
|
||||
@@ -34,5 +35,7 @@ public class IDFactoryModule extends AbstractModule {
|
||||
// TEMPLATE IDS
|
||||
install(new FactoryModuleBuilder().build(ItemTemplateIDFactory.class));
|
||||
install(new FactoryModuleBuilder().build(SkillTemplateIDFactory.class));
|
||||
install(new FactoryModuleBuilder()
|
||||
.build(CharacterTemplateIDFactory.class));
|
||||
}
|
||||
}
|
||||
|
||||
13
src/main/java/com/l2jserver/model/id/object/ActorID.java
Normal file
13
src/main/java/com/l2jserver/model/id/object/ActorID.java
Normal file
@@ -0,0 +1,13 @@
|
||||
package com.l2jserver.model.id.object;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.id.ObjectID;
|
||||
import com.l2jserver.model.world.capability.Actor;
|
||||
|
||||
public abstract class ActorID<T extends Actor> extends ObjectID<T> {
|
||||
@Inject
|
||||
public ActorID(@Assisted int id) {
|
||||
super(id);
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,9 @@ package com.l2jserver.model.id.object;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.db.dao.CharacterDAO;
|
||||
import com.l2jserver.model.id.ObjectID;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
|
||||
public final class CharacterID extends ObjectID<L2Character> {
|
||||
public final class CharacterID extends ActorID<L2Character> {
|
||||
/**
|
||||
* Data Access Object (DAO) for characters
|
||||
*/
|
||||
|
||||
@@ -2,10 +2,9 @@ package com.l2jserver.model.id.object;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.l2jserver.db.dao.PetDAO;
|
||||
import com.l2jserver.model.id.ObjectID;
|
||||
import com.l2jserver.model.world.Pet;
|
||||
|
||||
public final class PetID extends ObjectID<Pet> {
|
||||
public final class PetID extends ActorID<Pet> {
|
||||
/**
|
||||
* Data Access Object (DAO) for pets
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.l2jserver.model.id.template;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.service.game.template.TemplateService;
|
||||
|
||||
public class CharacterTemplateID extends TemplateID<CharacterTemplate> {
|
||||
private final TemplateService templateService;
|
||||
|
||||
@Inject
|
||||
protected CharacterTemplateID(@Assisted int id,
|
||||
TemplateService templateService) {
|
||||
super(id);
|
||||
this.templateService = templateService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharacterTemplate getTemplate() {
|
||||
return (CharacterTemplate) templateService.getTemplate(this);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.l2jserver.model.id.template.factory;
|
||||
|
||||
import com.l2jserver.model.id.template.CharacterTemplateID;
|
||||
|
||||
public interface CharacterTemplateIDFactory extends
|
||||
TemplateIDFactory<CharacterTemplateID> {
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
|
||||
public class AbstractTemplate implements Template {
|
||||
public abstract class AbstractTemplate<T> implements Template<T> {
|
||||
private final TemplateID<?> id;
|
||||
|
||||
public AbstractTemplate(TemplateID<?> id) {
|
||||
|
||||
@@ -0,0 +1,250 @@
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.l2jserver.model.id.template.CharacterTemplateID;
|
||||
import com.l2jserver.model.world.AbstractActor.Race;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.character.CharacterBaseAttributes;
|
||||
import com.l2jserver.model.world.character.CharacterClass;
|
||||
import com.l2jserver.util.Coordinate;
|
||||
|
||||
public abstract class CharacterTemplate extends AbstractTemplate<L2Character> {
|
||||
/**
|
||||
* The logger
|
||||
*/
|
||||
private static final Logger log = LoggerFactory
|
||||
.getLogger(CharacterTemplate.class);
|
||||
|
||||
/**
|
||||
* The character race
|
||||
*/
|
||||
protected final Race race;
|
||||
/**
|
||||
* The character class
|
||||
*/
|
||||
protected final CharacterClass characterClass;
|
||||
/**
|
||||
* The initial location for the character to be spawned
|
||||
*/
|
||||
protected final Coordinate spawnLocation;
|
||||
/**
|
||||
* The base attributes instance
|
||||
*/
|
||||
protected final CharacterBaseAttributes baseAttributes;
|
||||
|
||||
public CharacterTemplate(CharacterTemplateID id,
|
||||
CharacterClass characterClass, 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, Coordinate spawnLocation) {
|
||||
super(id);
|
||||
this.race = characterClass.race;
|
||||
this.characterClass = characterClass;
|
||||
this.spawnLocation = spawnLocation;
|
||||
baseAttributes = new CharacterBaseAttributes(intelligence, strength,
|
||||
concentration, mentality, dextry, witness, physicalAttack,
|
||||
magicalAttack, physicalDefense, magicalDefense, attackSpeed,
|
||||
castSpeed, accuracy, criticalChance, evasionChance, moveSpeed,
|
||||
maxWeigth, craft);
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2Character create() {
|
||||
log.debug("Creating a new Character instance with template {}", this);
|
||||
final L2Character character = new L2Character(baseAttributes);
|
||||
|
||||
character.setRace(race);
|
||||
character.setCharacterClass(characterClass);
|
||||
character.setPosition(spawnLocation);
|
||||
|
||||
// character.getBaseAttributes().setIntelligence(intelligence);
|
||||
// character.getBaseAttributes().setStrength(strength);
|
||||
// character.getBaseAttributes().setConcentration(concentration);
|
||||
// character.getBaseAttributes().setMentality(mentality);
|
||||
// character.getBaseAttributes().setDextry(dextry);
|
||||
// character.getBaseAttributes().setWitness(witness);
|
||||
|
||||
return character;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the race
|
||||
*/
|
||||
public Race getRace() {
|
||||
return race;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the characterClass
|
||||
*/
|
||||
public CharacterClass getCharacterClass() {
|
||||
return characterClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the spawnLocation
|
||||
*/
|
||||
public Coordinate getSpawnLocation() {
|
||||
return spawnLocation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the baseAttributes
|
||||
*/
|
||||
public CharacterBaseAttributes getBaseAttributes() {
|
||||
return baseAttributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.world.character.CharacterBaseAttributes#getIntelligence()
|
||||
*/
|
||||
public int getIntelligence() {
|
||||
return baseAttributes.getIntelligence();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.world.character.CharacterBaseAttributes#getStrength()
|
||||
*/
|
||||
public int getStrength() {
|
||||
return baseAttributes.getStrength();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.world.character.CharacterBaseAttributes#getConcentration()
|
||||
*/
|
||||
public int getConcentration() {
|
||||
return baseAttributes.getConcentration();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.world.character.CharacterBaseAttributes#getMentality()
|
||||
*/
|
||||
public int getMentality() {
|
||||
return baseAttributes.getMentality();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.world.character.CharacterBaseAttributes#getDextry()
|
||||
*/
|
||||
public int getDextry() {
|
||||
return baseAttributes.getDextry();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.world.character.CharacterBaseAttributes#getWitness()
|
||||
*/
|
||||
public int getWitness() {
|
||||
return baseAttributes.getWitness();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.world.character.CharacterBaseAttributes#getPhysicalAttack()
|
||||
*/
|
||||
public int getPhysicalAttack() {
|
||||
return baseAttributes.getPhysicalAttack();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.world.character.CharacterBaseAttributes#getMagicalAttack()
|
||||
*/
|
||||
public int getMagicalAttack() {
|
||||
return baseAttributes.getMagicalAttack();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.world.character.CharacterBaseAttributes#getPhysicalDefense()
|
||||
*/
|
||||
public int getPhysicalDefense() {
|
||||
return baseAttributes.getPhysicalDefense();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.world.character.CharacterBaseAttributes#getMagicalDefense()
|
||||
*/
|
||||
public int getMagicalDefense() {
|
||||
return baseAttributes.getMagicalDefense();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.world.character.CharacterBaseAttributes#getAttackSpeed()
|
||||
*/
|
||||
public int getAttackSpeed() {
|
||||
return baseAttributes.getAttackSpeed();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.world.character.CharacterBaseAttributes#getCastSpeed()
|
||||
*/
|
||||
public int getCastSpeed() {
|
||||
return baseAttributes.getCastSpeed();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.world.character.CharacterBaseAttributes#getAccuracy()
|
||||
*/
|
||||
public int getAccuracy() {
|
||||
return baseAttributes.getAccuracy();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.world.character.CharacterBaseAttributes#getCriticalChance()
|
||||
*/
|
||||
public int getCriticalChance() {
|
||||
return baseAttributes.getCriticalChance();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.world.character.CharacterBaseAttributes#getEvasionChance()
|
||||
*/
|
||||
public int getEvasionChance() {
|
||||
return baseAttributes.getEvasionChance();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.world.character.CharacterBaseAttributes#getMoveSpeed()
|
||||
*/
|
||||
public int getMoveSpeed() {
|
||||
return baseAttributes.getMoveSpeed();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.world.character.CharacterBaseAttributes#getMaxWeigth()
|
||||
*/
|
||||
public int getMaxWeigth() {
|
||||
return baseAttributes.getMaxWeigth();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @see com.l2jserver.model.world.character.CharacterBaseAttributes#canCraft()
|
||||
*/
|
||||
public boolean canCraft() {
|
||||
return baseAttributes.canCraft();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharacterTemplateID getID() {
|
||||
return (CharacterTemplateID) super.getID();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,28 @@
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.id.template.ItemTemplateID;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.l2jserver.model.id.template.ItemTemplateID;
|
||||
import com.l2jserver.model.world.Item;
|
||||
|
||||
public abstract class ItemTemplate extends AbstractTemplate<Item> {
|
||||
/**
|
||||
* The logger
|
||||
*/
|
||||
private static final Logger log = LoggerFactory
|
||||
.getLogger(ItemTemplate.class);
|
||||
|
||||
public abstract class ItemTemplate extends AbstractTemplate {
|
||||
public ItemTemplate(ItemTemplateID id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item create() {
|
||||
log.debug("Creating a new Item instance with template {}", this);
|
||||
return new Item(this.getID());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemTemplateID getID() {
|
||||
return (ItemTemplateID) super.getID();
|
||||
|
||||
@@ -2,13 +2,21 @@ package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.id.template.SkillTemplateID;
|
||||
import com.l2jserver.model.template.capability.Castable;
|
||||
import com.l2jserver.model.world.character.CharacterClass;
|
||||
|
||||
public abstract class SkillTemplate extends AbstractTemplate implements
|
||||
public abstract class SkillTemplate extends AbstractTemplate<Void> implements
|
||||
Castable {
|
||||
public SkillTemplate(SkillTemplateID id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
public abstract CharacterClass[] getClasses();
|
||||
|
||||
@Override
|
||||
public Void create() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SkillTemplateID getID() {
|
||||
return (SkillTemplateID) super.getID();
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.id.TemplateID;
|
||||
|
||||
public interface Template {
|
||||
public interface Template<T> {
|
||||
T create();
|
||||
|
||||
TemplateID<?> getID();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.l2jserver.model.template.capability;
|
||||
|
||||
|
||||
public interface Enchantable extends TemplateCapability {
|
||||
void enchant(com.l2jserver.model.world.capability.Enchantable target);
|
||||
}
|
||||
|
||||
@@ -1,26 +1,74 @@
|
||||
package com.l2jserver.model.world;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.model.template.SkillTemplate;
|
||||
import com.l2jserver.model.template.capability.Attackable;
|
||||
import com.l2jserver.model.world.actor.ActorListener;
|
||||
import com.l2jserver.model.world.actor.ActorEffects;
|
||||
import com.l2jserver.model.world.capability.Actor;
|
||||
import com.l2jserver.model.world.capability.Attacker;
|
||||
import com.l2jserver.model.world.capability.Castable;
|
||||
import com.l2jserver.model.world.capability.Equipable;
|
||||
import com.l2jserver.model.world.capability.Equiper;
|
||||
import com.l2jserver.util.Coordinate;
|
||||
import com.l2jserver.util.factory.CollectionFactory;
|
||||
|
||||
public abstract class AbstractActor extends AbstractObject implements Actor {
|
||||
private final List<ActorListener> listeners = CollectionFactory
|
||||
.newList(ActorListener.class);
|
||||
protected Race race;
|
||||
|
||||
/**
|
||||
* Represents the actor race.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum Race {
|
||||
HUMAN(0x00), ELF(0x01), DARK_ELF(0x02), ORC(0x03), DWARF(0x04), KAMAEL(
|
||||
0x05);
|
||||
|
||||
public final int option;
|
||||
|
||||
Race(int option) {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
public static Race fromOption(int option) {
|
||||
for (final Race race : values()) {
|
||||
if (race.option == option)
|
||||
return race;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected Sex sex;
|
||||
|
||||
/**
|
||||
* Represent the sex of an actor.
|
||||
* <p>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum Sex {
|
||||
MALE(0x00), FEMALE(0x01);
|
||||
|
||||
public final int option;
|
||||
|
||||
Sex(int option) {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
public static Sex fromOption(int option) {
|
||||
for (Sex sex : values()) {
|
||||
if (sex.option == option)
|
||||
return sex;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected int level;
|
||||
protected int hp;
|
||||
protected Coordinate position;
|
||||
|
||||
protected final ActorEffects effects = new ActorEffects(this);
|
||||
|
||||
@Override
|
||||
public void receiveDamage(int damage) {
|
||||
// TODO Auto-generated method stub
|
||||
@@ -78,6 +126,36 @@ public abstract class AbstractActor extends AbstractObject implements Actor {
|
||||
this.position = coord;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the race
|
||||
*/
|
||||
public Race getRace() {
|
||||
return race;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param race
|
||||
* the race to set
|
||||
*/
|
||||
public void setRace(Race race) {
|
||||
this.race = race;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the sex
|
||||
*/
|
||||
public Sex getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param sex
|
||||
* the sex to set
|
||||
*/
|
||||
public void setSex(Sex sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel() {
|
||||
return level;
|
||||
@@ -88,6 +166,13 @@ public abstract class AbstractActor extends AbstractObject implements Actor {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the active effects on this actor
|
||||
*/
|
||||
public ActorEffects getEffects() {
|
||||
return effects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die(WorldObject killer) {
|
||||
// TODO
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
package com.l2jserver.model.world;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.model.id.object.CharacterID;
|
||||
import com.l2jserver.model.id.template.ItemTemplateID;
|
||||
import com.l2jserver.model.world.capability.Listenable;
|
||||
import com.l2jserver.model.world.capability.Playable;
|
||||
import com.l2jserver.model.world.capability.Spawnable;
|
||||
import com.l2jserver.model.world.item.ItemEvent;
|
||||
import com.l2jserver.model.world.item.ItemListener;
|
||||
import com.l2jserver.util.Coordinate;
|
||||
import com.l2jserver.util.factory.CollectionFactory;
|
||||
|
||||
public class Item extends AbstractObject implements Playable, Spawnable,
|
||||
Listenable<ItemListener, ItemEvent> {
|
||||
private final List<ItemListener> listeners = CollectionFactory
|
||||
.newList(ItemListener.class);
|
||||
|
||||
private final ItemTemplateID templateID;
|
||||
private CharacterID ownerID;
|
||||
|
||||
public Item(ItemTemplateID templateID) {
|
||||
this.templateID = templateID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawn(Coordinate coordinate) {
|
||||
|
||||
@@ -39,7 +39,14 @@ public class Item extends AbstractObject implements Playable, Spawnable,
|
||||
public void setPosition(Coordinate coord) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the templateID
|
||||
*/
|
||||
public ItemTemplateID getTemplateID() {
|
||||
return templateID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ownerID
|
||||
*/
|
||||
|
||||
@@ -6,6 +6,10 @@ import com.l2jserver.model.id.object.CharacterID;
|
||||
import com.l2jserver.model.id.object.ClanID;
|
||||
import com.l2jserver.model.id.object.PetID;
|
||||
import com.l2jserver.model.world.character.CharacterAppearance;
|
||||
import com.l2jserver.model.world.character.CharacterAttributes;
|
||||
import com.l2jserver.model.world.character.CharacterBaseAttributes;
|
||||
import com.l2jserver.model.world.character.CharacterCalculatedAttributes;
|
||||
import com.l2jserver.model.world.character.CharacterClass;
|
||||
import com.l2jserver.model.world.character.CharacterInventory;
|
||||
|
||||
/**
|
||||
@@ -26,6 +30,10 @@ public class L2Character extends Player {
|
||||
* The character name
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* The class of the character
|
||||
*/
|
||||
private CharacterClass characterClass;
|
||||
/**
|
||||
* The character's status
|
||||
*/
|
||||
@@ -43,6 +51,25 @@ public class L2Character extends Player {
|
||||
* The appearance of this character
|
||||
*/
|
||||
private final CharacterAppearance appearance = new CharacterAppearance(this);
|
||||
/**
|
||||
* The base attributes of this character
|
||||
*/
|
||||
private final CharacterBaseAttributes baseAttributes;
|
||||
/**
|
||||
* The attributes of this character
|
||||
*/
|
||||
private final CharacterAttributes attributes;
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param baseAttributes
|
||||
* the base attribute for this character
|
||||
*/
|
||||
public L2Character(CharacterBaseAttributes baseAttributes) {
|
||||
this.baseAttributes = baseAttributes;
|
||||
this.attributes = new CharacterCalculatedAttributes(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharacterID getID() {
|
||||
@@ -112,6 +139,21 @@ public class L2Character extends Player {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the characterClass
|
||||
*/
|
||||
public CharacterClass getCharacterClass() {
|
||||
return characterClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param characterClass
|
||||
* the characterClass to set
|
||||
*/
|
||||
public void setCharacterClass(CharacterClass characterClass) {
|
||||
this.characterClass = characterClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the online
|
||||
*/
|
||||
@@ -155,4 +197,18 @@ public class L2Character extends Player {
|
||||
public CharacterAppearance getAppearance() {
|
||||
return appearance;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the base attributes
|
||||
*/
|
||||
public CharacterBaseAttributes getBaseAttributes() {
|
||||
return baseAttributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the attributes
|
||||
*/
|
||||
public CharacterAttributes getAttributes() {
|
||||
return attributes;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,9 +12,6 @@ import com.l2jserver.util.factory.CollectionFactory;
|
||||
|
||||
public class Party extends AbstractObject implements
|
||||
Listenable<PartyListener, PartyEvent>, Joinable<L2Character> {
|
||||
private final List<PartyListener> listeners = CollectionFactory
|
||||
.newList(PartyListener.class);
|
||||
|
||||
private final List<CharacterID> members = CollectionFactory
|
||||
.newList(CharacterID.class);
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.l2jserver.model.world.actor;
|
||||
|
||||
import com.l2jserver.model.world.capability.Actor;
|
||||
|
||||
public class ActorEffects {
|
||||
private final Actor actor;
|
||||
|
||||
public ActorEffects(Actor actor) {
|
||||
this.actor = actor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the actor
|
||||
*/
|
||||
public Actor getActor() {
|
||||
return actor;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.world.AbstractObject;
|
||||
import com.l2jserver.model.world.actor.ActorEffects;
|
||||
import com.l2jserver.model.world.actor.ActorEvent;
|
||||
import com.l2jserver.model.world.actor.ActorListener;
|
||||
|
||||
@@ -13,5 +14,5 @@ import com.l2jserver.model.world.actor.ActorListener;
|
||||
public interface Actor extends Listenable<ActorListener, ActorEvent>,
|
||||
Spawnable, Positionable, Damagable, Attackable, Attacker, Castable,
|
||||
Caster, Levelable, Killable, Equiper, Equipable {
|
||||
|
||||
ActorEffects getEffects();
|
||||
}
|
||||
|
||||
@@ -10,9 +10,11 @@ import com.l2jserver.model.world.AbstractObject;
|
||||
*/
|
||||
public interface Equiper extends ObjectCapability {
|
||||
void equip(Equipable equipable);
|
||||
|
||||
|
||||
boolean isEquiped(Equipable equipment);
|
||||
boolean isEquiped(com.l2jserver.model.template.capability.Equipable equipable);
|
||||
|
||||
boolean isEquiped(
|
||||
com.l2jserver.model.template.capability.Equipable equipable);
|
||||
|
||||
void setEquipment(Object slot, Equipable equipment);
|
||||
|
||||
|
||||
@@ -10,5 +10,6 @@ import com.l2jserver.util.Coordinate;
|
||||
*/
|
||||
public interface Positionable extends ObjectCapability {
|
||||
Coordinate getPosition();
|
||||
|
||||
void setPosition(Coordinate coord);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -5,5 +5,6 @@ import com.l2jserver.util.Coordinate;
|
||||
|
||||
public interface SpawnEvent extends WorldEvent {
|
||||
Spawnable getObject();
|
||||
|
||||
Coordinate getCoordinate();
|
||||
}
|
||||
@@ -11,8 +11,8 @@ public class AndFilter<O extends WorldObject> implements WorldObjectFilter<O> {
|
||||
|
||||
@Override
|
||||
public boolean accept(O object) {
|
||||
for(final WorldObjectFilter<O> filter : filters) {
|
||||
if(!filter.accept(object))
|
||||
for (final WorldObjectFilter<O> filter : filters) {
|
||||
if (!filter.accept(object))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -11,8 +11,8 @@ public class OrFilter<O extends WorldObject> implements WorldObjectFilter<O> {
|
||||
|
||||
@Override
|
||||
public boolean accept(O object) {
|
||||
for(final WorldObjectFilter<O> filter : filters) {
|
||||
if(filter.accept(object))
|
||||
for (final WorldObjectFilter<O> filter : filters) {
|
||||
if (filter.accept(object))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -3,7 +3,8 @@ package com.l2jserver.model.world.filter.impl;
|
||||
import com.l2jserver.model.world.WorldObject;
|
||||
import com.l2jserver.model.world.filter.WorldObjectFilter;
|
||||
|
||||
public class InstanceFilter<T extends WorldObject> implements WorldObjectFilter<T> {
|
||||
public class InstanceFilter<T extends WorldObject> implements
|
||||
WorldObjectFilter<T> {
|
||||
private final Class<?> type;
|
||||
|
||||
public InstanceFilter(Class<?> instance) {
|
||||
|
||||
Reference in New Issue
Block a user