mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-09 17:02:53 +00:00
215
src/main/java/com/l2jserver/model/template/ActorTemplate.java
Normal file
215
src/main/java/com/l2jserver/model/template/ActorTemplate.java
Normal file
@@ -0,0 +1,215 @@
|
||||
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.capability.Actor;
|
||||
import com.l2jserver.model.world.character.CharacterBaseAttributes;
|
||||
|
||||
/**
|
||||
* Template for {@link Actor}
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public abstract class ActorTemplate<T extends Actor> extends
|
||||
AbstractTemplate<T> {
|
||||
/**
|
||||
* The logger
|
||||
*/
|
||||
private static final Logger log = LoggerFactory
|
||||
.getLogger(ActorTemplate.class);
|
||||
|
||||
/**
|
||||
* The actor race
|
||||
*/
|
||||
protected final Race race;
|
||||
/**
|
||||
* The base attributes instance
|
||||
*/
|
||||
protected final CharacterBaseAttributes baseAttributes;
|
||||
|
||||
public ActorTemplate(CharacterTemplateID id, Race race, int intelligence,
|
||||
int strength, int concentration, int mentality, int dexterity,
|
||||
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) {
|
||||
super(id);
|
||||
this.race = race;
|
||||
baseAttributes = new CharacterBaseAttributes(intelligence, strength,
|
||||
concentration, mentality, dexterity, witness, physicalAttack,
|
||||
magicalAttack, physicalDefense, magicalDefense, attackSpeed,
|
||||
castSpeed, accuracy, criticalChance, evasionChance, moveSpeed,
|
||||
maxWeigth, craft);
|
||||
}
|
||||
|
||||
@Override
|
||||
public T create() {
|
||||
log.debug("Creating a new Actor instance with template {}", this);
|
||||
final T actor = createInstance();
|
||||
|
||||
return actor;
|
||||
}
|
||||
|
||||
public abstract T createInstance();
|
||||
|
||||
/**
|
||||
* @return the race
|
||||
*/
|
||||
public Race getRace() {
|
||||
return race;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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#getDexterity()
|
||||
*/
|
||||
public int getDextry() {
|
||||
return baseAttributes.getDexterity();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,7 @@
|
||||
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.dimensional.Point;
|
||||
|
||||
@@ -15,17 +10,7 @@ import com.l2jserver.util.dimensional.Point;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
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;
|
||||
public abstract class CharacterTemplate extends ActorTemplate<L2Character> {
|
||||
/**
|
||||
* The character class
|
||||
*/
|
||||
@@ -34,55 +19,34 @@ public abstract class CharacterTemplate extends AbstractTemplate<L2Character> {
|
||||
* The initial location for the character to be spawned
|
||||
*/
|
||||
protected final Point spawnLocation;
|
||||
/**
|
||||
* The base attributes instance
|
||||
*/
|
||||
protected final CharacterBaseAttributes baseAttributes;
|
||||
|
||||
public CharacterTemplate(CharacterTemplateID id,
|
||||
protected CharacterTemplate(CharacterTemplateID id,
|
||||
CharacterClass characterClass, int intelligence, int strength,
|
||||
int concentration, int mentality, int dexterity, 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, Point spawnLocation) {
|
||||
super(id);
|
||||
this.race = characterClass.race;
|
||||
super(id, characterClass.race, intelligence, strength, concentration,
|
||||
mentality, dexterity, witness, physicalAttack, magicalAttack,
|
||||
physicalDefense, magicalDefense, attackSpeed, castSpeed,
|
||||
accuracy, criticalChance, evasionChance, moveSpeed, maxWeigth,
|
||||
craft);
|
||||
this.characterClass = characterClass;
|
||||
this.spawnLocation = spawnLocation;
|
||||
baseAttributes = new CharacterBaseAttributes(intelligence, strength,
|
||||
concentration, mentality, dexterity, 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);
|
||||
public L2Character createInstance() {
|
||||
final L2Character character = new L2Character(baseAttributes);
|
||||
|
||||
character.setRace(race);
|
||||
character.setCharacterClass(characterClass);
|
||||
character.setPoint(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
|
||||
*/
|
||||
@@ -97,157 +61,6 @@ public abstract class CharacterTemplate extends AbstractTemplate<L2Character> {
|
||||
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#getDexterity()
|
||||
*/
|
||||
public int getDextry() {
|
||||
return baseAttributes.getDexterity();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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();
|
||||
|
||||
43
src/main/java/com/l2jserver/model/template/NPCTemplate.java
Normal file
43
src/main/java/com/l2jserver/model/template/NPCTemplate.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.id.template.CharacterTemplateID;
|
||||
import com.l2jserver.model.id.template.NPCTemplateID;
|
||||
import com.l2jserver.model.world.AbstractActor.Race;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
|
||||
/**
|
||||
* Template for {@link NPC}
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public abstract class NPCTemplate extends ActorTemplate<L2Character> {
|
||||
protected NPCTemplate(CharacterTemplateID id, Race race, int intelligence,
|
||||
int strength, int concentration, int mentality, int dexterity,
|
||||
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) {
|
||||
super(id, race, intelligence, strength, concentration, mentality,
|
||||
dexterity, witness, physicalAttack, magicalAttack,
|
||||
physicalDefense, magicalDefense, attackSpeed, castSpeed,
|
||||
accuracy, criticalChance, evasionChance, moveSpeed, maxWeigth,
|
||||
craft);
|
||||
}
|
||||
|
||||
@Override
|
||||
public L2Character createInstance() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the race
|
||||
*/
|
||||
public Race getRace() {
|
||||
return race;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NPCTemplateID getID() {
|
||||
return (NPCTemplateID) super.getID();
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,39 @@
|
||||
package com.l2jserver.model.template;
|
||||
|
||||
import com.l2jserver.model.game.Skill;
|
||||
import com.l2jserver.model.id.template.SkillTemplateID;
|
||||
import com.l2jserver.model.template.capability.Castable;
|
||||
import com.l2jserver.model.world.character.CharacterClass;
|
||||
|
||||
/**
|
||||
* Template for skill
|
||||
* Template for {@link Skill} object
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public abstract class SkillTemplate extends AbstractTemplate<Void> implements
|
||||
public abstract class SkillTemplate extends AbstractTemplate<Skill> implements
|
||||
Castable {
|
||||
/**
|
||||
* The maximum level supported by this skill
|
||||
*/
|
||||
protected int maximumLevel = 1;
|
||||
|
||||
public SkillTemplate(SkillTemplateID id) {
|
||||
super(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maximumLevel
|
||||
*/
|
||||
public int getMaximumLevel() {
|
||||
return maximumLevel;
|
||||
}
|
||||
|
||||
public abstract CharacterClass[] getClasses();
|
||||
|
||||
@Override
|
||||
public Void create() {
|
||||
return null;
|
||||
public Skill create() {
|
||||
final Skill skill = new Skill(this.getID());
|
||||
return skill;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user