mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-09 17:02:53 +00:00
Change-Id: I0000000000000000000000000000000000000000
Change-Id: I8636776eaf000fcdfb528cc403710f6d6ee9e73e Change-Id: Iebc523681d07ecd6d7b7e89343b29a8034558f94
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user