mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-08 08:23:11 +00:00
273
src/main/java/com/l2jserver/model/game/CharacterShortcut.java
Normal file
273
src/main/java/com/l2jserver/model/game/CharacterShortcut.java
Normal file
@@ -0,0 +1,273 @@
|
||||
package com.l2jserver.model.game;
|
||||
|
||||
import com.l2jserver.model.id.object.CharacterID;
|
||||
import com.l2jserver.model.id.object.ItemID;
|
||||
import com.l2jserver.model.id.template.SkillTemplateID;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
|
||||
/**
|
||||
* An shortcut in Lineage II game interface
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterShortcut {
|
||||
/**
|
||||
* The character id
|
||||
*/
|
||||
private final CharacterID characterID;
|
||||
/**
|
||||
* The shortcut skill id (only if <tt>type</tt> is
|
||||
* {@link ShortcutType#SKILL})
|
||||
*/
|
||||
private SkillTemplateID skillID;
|
||||
|
||||
/**
|
||||
* The shortcut item id (only if <tt>type</tt> is {@link ShortcutType#ITEM})
|
||||
*/
|
||||
private ItemID itemID;
|
||||
|
||||
/**
|
||||
* The shortcut slot (0 - 11 = 12 slots/page)
|
||||
*/
|
||||
private int slot;
|
||||
/**
|
||||
* The shortcut page (0-3 = 4 pages)
|
||||
*/
|
||||
private int page;
|
||||
/**
|
||||
* The shortcut type
|
||||
*/
|
||||
private ShortcutType type;
|
||||
|
||||
/**
|
||||
* Enum with all shortcut types supported
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum ShortcutType {
|
||||
ITEM(1), SKILL(2), ACTION(3), MACRO(4), RECIPE(5), TPBOOKMARK(6);
|
||||
|
||||
/**
|
||||
* The shortcut type id
|
||||
*/
|
||||
public final int id;
|
||||
|
||||
ShortcutType(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id
|
||||
* the type id
|
||||
* @return
|
||||
*/
|
||||
public static ShortcutType fromID(int id) {
|
||||
for (final ShortcutType shortcut : values()) {
|
||||
if (shortcut.id == id)
|
||||
return shortcut;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The skill level (only if <tt>type</tt> is {@link ShortcutType#SKILL})
|
||||
*/
|
||||
private int level;
|
||||
/**
|
||||
* unknown!
|
||||
*/
|
||||
private int characterType;
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param character
|
||||
* the character
|
||||
*/
|
||||
public CharacterShortcut(CharacterID characterID) {
|
||||
this.characterID = characterID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Item Shortcut
|
||||
*
|
||||
* @param characterID
|
||||
* the character id
|
||||
* @param itemID
|
||||
* the item id
|
||||
* @param characterType
|
||||
* the character type
|
||||
*/
|
||||
public CharacterShortcut(CharacterID characterID, ItemID itemID,
|
||||
int characterType) {
|
||||
this.type = ShortcutType.ITEM;
|
||||
this.characterID = characterID;
|
||||
this.itemID = itemID;
|
||||
this.characterType = characterType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Skill Shortcut
|
||||
*
|
||||
* @param characterID
|
||||
* the character id
|
||||
* @param skillID
|
||||
* the skill id
|
||||
* @param level
|
||||
* the skill level
|
||||
* @param characterType
|
||||
* the character type
|
||||
*/
|
||||
public CharacterShortcut(CharacterID characterID, SkillTemplateID skillID,
|
||||
int level, int characterType) {
|
||||
this.type = ShortcutType.SKILL;
|
||||
this.characterID = characterID;
|
||||
this.skillID = skillID;
|
||||
this.level = level;
|
||||
this.characterType = characterType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates another type of shortcut
|
||||
*
|
||||
* @param characterID
|
||||
* the character id
|
||||
* @param type
|
||||
* the shortcut type
|
||||
* @param slot
|
||||
* the shortcut slot
|
||||
* @param page
|
||||
* the shortcut page
|
||||
* @param characterType
|
||||
* the character type
|
||||
*/
|
||||
public CharacterShortcut(CharacterID characterID, ShortcutType type,
|
||||
int slot, int page, int characterType) {
|
||||
this.characterID = characterID;
|
||||
this.slot = slot;
|
||||
this.page = page;
|
||||
this.type = type;
|
||||
this.characterType = characterType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the skillID
|
||||
*/
|
||||
public SkillTemplateID getSkillID() {
|
||||
return skillID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param skillID
|
||||
* the skillID to set
|
||||
*/
|
||||
public void setSkillID(SkillTemplateID skillID) {
|
||||
this.skillID = skillID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the itemID
|
||||
*/
|
||||
public ItemID getItemID() {
|
||||
return itemID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param itemID
|
||||
* the itemID to set
|
||||
*/
|
||||
public void setItemID(ItemID itemID) {
|
||||
this.itemID = itemID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the slot
|
||||
*/
|
||||
public int getSlot() {
|
||||
return slot;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param slot
|
||||
* the slot to set
|
||||
*/
|
||||
public void setSlot(int slot) {
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the page
|
||||
*/
|
||||
public int getPage() {
|
||||
return page;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param page
|
||||
* the page to set
|
||||
*/
|
||||
public void setPage(int page) {
|
||||
this.page = page;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public ShortcutType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param type
|
||||
* the type to set
|
||||
*/
|
||||
public void setType(ShortcutType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the level
|
||||
*/
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param level
|
||||
* the level to set
|
||||
*/
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the characterType
|
||||
*/
|
||||
public int getCharacterType() {
|
||||
return characterType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param characterType
|
||||
* the characterType to set
|
||||
*/
|
||||
public void setCharacterType(int characterType) {
|
||||
this.characterType = characterType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the character id
|
||||
*/
|
||||
public CharacterID getCharacterID() {
|
||||
return characterID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the character
|
||||
*/
|
||||
public L2Character getCharacter() {
|
||||
return characterID.getObject();
|
||||
}
|
||||
}
|
||||
108
src/main/java/com/l2jserver/model/game/Skill.java
Normal file
108
src/main/java/com/l2jserver/model/game/Skill.java
Normal file
@@ -0,0 +1,108 @@
|
||||
package com.l2jserver.model.game;
|
||||
|
||||
import com.l2jserver.model.id.object.ActorID;
|
||||
import com.l2jserver.model.id.template.SkillTemplateID;
|
||||
import com.l2jserver.model.template.SkillTemplate;
|
||||
import com.l2jserver.model.world.capability.Actor;
|
||||
|
||||
/**
|
||||
* Register the state of a skill known by an {@link Actor}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class Skill {
|
||||
/**
|
||||
* The skill template ID
|
||||
*/
|
||||
private final SkillTemplateID skillTemplateID;
|
||||
/**
|
||||
* The actor id that has learned this skill
|
||||
*/
|
||||
private ActorID<?> actorID;
|
||||
|
||||
/**
|
||||
* The skill level learned
|
||||
*/
|
||||
private int level;
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param skillTemplateID
|
||||
* the skill template id
|
||||
* @param level
|
||||
* the skill level
|
||||
*/
|
||||
public Skill(SkillTemplateID skillTemplateID, int level) {
|
||||
this.skillTemplateID = skillTemplateID;
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance in level one
|
||||
*
|
||||
* @param skillTemplateID
|
||||
* the skill template id
|
||||
*/
|
||||
public Skill(SkillTemplateID skillTemplateID) {
|
||||
this(skillTemplateID, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if this skill is learned in the maximum level
|
||||
*/
|
||||
public boolean isMaximumLevel() {
|
||||
return level >= skillTemplateID.getTemplate().getMaximumLevel();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the actorID
|
||||
*/
|
||||
public ActorID<?> getActorID() {
|
||||
return actorID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the actor
|
||||
*/
|
||||
public Actor getActor() {
|
||||
return actorID.getObject();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param actorID
|
||||
* the actor ID to set
|
||||
*/
|
||||
public void setActorID(ActorID<?> actorID) {
|
||||
this.actorID = actorID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the level
|
||||
*/
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param level
|
||||
* the level to set
|
||||
*/
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the skillTemplateID
|
||||
*/
|
||||
public SkillTemplateID getSkillTemplateID() {
|
||||
return skillTemplateID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the skillTemplate
|
||||
*/
|
||||
public SkillTemplate getSkillTemplate() {
|
||||
return skillTemplateID.getTemplate();
|
||||
}
|
||||
}
|
||||
58
src/main/java/com/l2jserver/model/game/Spawn.java
Normal file
58
src/main/java/com/l2jserver/model/game/Spawn.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package com.l2jserver.model.game;
|
||||
|
||||
import com.l2jserver.model.id.template.NPCTemplateID;
|
||||
import com.l2jserver.model.template.NPCTemplate;
|
||||
import com.l2jserver.util.dimensional.Point;
|
||||
|
||||
/**
|
||||
* This class represents an spawn instance of a NPC or Monster
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class Spawn {
|
||||
/**
|
||||
* The NPC template id
|
||||
*/
|
||||
private NPCTemplateID npcTemplateID;
|
||||
/**
|
||||
* The NPC spawn point
|
||||
*/
|
||||
private Point point;
|
||||
|
||||
/**
|
||||
* @return the npcTemplate ID
|
||||
*/
|
||||
public NPCTemplateID getNPCTemplateID() {
|
||||
return npcTemplateID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the npcTemplate
|
||||
*/
|
||||
public NPCTemplate getNPCTemplate() {
|
||||
return npcTemplateID.getTemplate();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param npcTemplateID
|
||||
* the npcTemplate ID to set
|
||||
*/
|
||||
public void setNPCTemplateID(NPCTemplateID npcTemplateID) {
|
||||
this.npcTemplateID = npcTemplateID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the point
|
||||
*/
|
||||
public Point getPoint() {
|
||||
return point;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param point
|
||||
* the point to set
|
||||
*/
|
||||
public void setPoint(Point point) {
|
||||
this.point = point;
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,6 @@ public class CharacterIDFactory implements ObjectIDFactory<CharacterID> {
|
||||
* the numeric ID
|
||||
* @return the new ID created by injection
|
||||
*/
|
||||
public CharacterID create(@Assisted int id);
|
||||
CharacterID create(@Assisted int id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,6 @@ public class ClanIDFactory implements ObjectIDFactory<ClanID> {
|
||||
* the numeric ID
|
||||
* @return the new ID created by injection
|
||||
*/
|
||||
public ClanID create(@Assisted int id);
|
||||
ClanID create(@Assisted int id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,6 @@ public class ItemIDFactory implements ObjectIDFactory<ItemID> {
|
||||
* the numeric ID
|
||||
* @return the new ID created by injection
|
||||
*/
|
||||
public ItemID create(@Assisted int id);
|
||||
ItemID create(@Assisted int id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,6 @@ public class PetIDFactory implements ObjectIDFactory<PetID> {
|
||||
* the numeric ID
|
||||
* @return the new ID created by injection
|
||||
*/
|
||||
public PetID create(@Assisted int id);
|
||||
PetID create(@Assisted int id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
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.ActorTemplate;
|
||||
import com.l2jserver.service.game.template.TemplateService;
|
||||
|
||||
/**
|
||||
* An {@link TemplateID} instance representing an {@link ActorTemplate}
|
||||
* object
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class ActorTemplateID<T extends ActorTemplate<?>> extends TemplateID<T> {
|
||||
/**
|
||||
* The template service
|
||||
*/
|
||||
private final TemplateService templateService;
|
||||
|
||||
@Inject
|
||||
protected ActorTemplateID(@Assisted int id,
|
||||
TemplateService templateService) {
|
||||
super(id);
|
||||
this.templateService = templateService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getTemplate() {
|
||||
return templateService.getTemplate(this);
|
||||
}
|
||||
}
|
||||
@@ -12,21 +12,10 @@ import com.l2jserver.service.game.template.TemplateService;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterTemplateID extends TemplateID<CharacterTemplate> {
|
||||
/**
|
||||
* The template service
|
||||
*/
|
||||
private final TemplateService templateService;
|
||||
|
||||
public class CharacterTemplateID extends ActorTemplateID<CharacterTemplate> {
|
||||
@Inject
|
||||
protected CharacterTemplateID(@Assisted int id,
|
||||
TemplateService templateService) {
|
||||
super(id);
|
||||
this.templateService = templateService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharacterTemplate getTemplate() {
|
||||
return templateService.getTemplate(this);
|
||||
super(id, templateService);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
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.NPCTemplate;
|
||||
import com.l2jserver.service.game.template.TemplateService;
|
||||
|
||||
/**
|
||||
* An {@link TemplateID} instance representing an {@link NPCTemplate}
|
||||
* object
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class NPCTemplateID extends ActorTemplateID<NPCTemplate> {
|
||||
@Inject
|
||||
protected NPCTemplateID(@Assisted int id,
|
||||
TemplateService templateService) {
|
||||
super(id, templateService);
|
||||
}
|
||||
}
|
||||
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
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.l2jserver.model.world;
|
||||
|
||||
import com.l2jserver.model.id.object.ActorID;
|
||||
import com.l2jserver.model.template.SkillTemplate;
|
||||
import com.l2jserver.model.template.capability.Attackable;
|
||||
import com.l2jserver.model.world.actor.ActorEffects;
|
||||
import com.l2jserver.model.world.actor.ActorSkillContainer;
|
||||
import com.l2jserver.model.world.capability.Actor;
|
||||
import com.l2jserver.model.world.capability.Attacker;
|
||||
import com.l2jserver.model.world.capability.Castable;
|
||||
@@ -31,15 +33,25 @@ public abstract class AbstractActor extends AbstractObject implements Actor {
|
||||
HUMAN(0x00), ELF(0x01), DARK_ELF(0x02), ORC(0x03), DWARF(0x04), KAMAEL(
|
||||
0x05);
|
||||
|
||||
public final int option;
|
||||
/**
|
||||
* The numeric ID representing this race
|
||||
*/
|
||||
public final int id;
|
||||
|
||||
Race(int option) {
|
||||
this.option = option;
|
||||
Race(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public static Race fromOption(int option) {
|
||||
/**
|
||||
* Finds the race based on the <tt>id</tt>
|
||||
*
|
||||
* @param id
|
||||
* the id
|
||||
* @return the race constant
|
||||
*/
|
||||
public static Race fromOption(int id) {
|
||||
for (final Race race : values()) {
|
||||
if (race.option == option)
|
||||
if (race.id == id)
|
||||
return race;
|
||||
}
|
||||
return null;
|
||||
@@ -91,6 +103,10 @@ public abstract class AbstractActor extends AbstractObject implements Actor {
|
||||
* The currently effects active on the actor
|
||||
*/
|
||||
protected final ActorEffects effects = new ActorEffects(this);
|
||||
/**
|
||||
* The skills learned by this actor
|
||||
*/
|
||||
protected final ActorSkillContainer skills = new ActorSkillContainer(this);
|
||||
|
||||
@Override
|
||||
public void receiveDamage(int damage) {
|
||||
@@ -212,6 +228,11 @@ public abstract class AbstractActor extends AbstractObject implements Actor {
|
||||
return effects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActorSkillContainer getSkills() {
|
||||
return skills;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void die(WorldObject killer) {
|
||||
// TODO
|
||||
@@ -247,4 +268,9 @@ public abstract class AbstractActor extends AbstractObject implements Actor {
|
||||
public void equip(Equiper equiper) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActorID<?> getID() {
|
||||
return (ActorID<?>) super.getID();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.l2jserver.model.world.character.CharacterCalculatedAttributes;
|
||||
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;
|
||||
|
||||
/**
|
||||
* This class represents a playable character in Lineage II world.
|
||||
@@ -69,6 +70,11 @@ public class L2Character extends Player {
|
||||
* The list of friend of this character
|
||||
*/
|
||||
private final CharacterFriendList friendList = new CharacterFriendList(this);
|
||||
/**
|
||||
* The shortcut container of this character
|
||||
*/
|
||||
private final CharacterShortcutContainer shortcuts = new CharacterShortcutContainer(
|
||||
this);
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
@@ -239,6 +245,13 @@ public class L2Character extends Player {
|
||||
return friendList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the shortcuts
|
||||
*/
|
||||
public CharacterShortcutContainer getShortcuts() {
|
||||
return shortcuts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharacterID getID() {
|
||||
return (CharacterID) super.getID();
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.l2jserver.model.world.actor;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.model.game.Skill;
|
||||
import com.l2jserver.model.id.template.SkillTemplateID;
|
||||
import com.l2jserver.model.template.SkillTemplate;
|
||||
import com.l2jserver.model.world.capability.Actor;
|
||||
import com.l2jserver.util.factory.CollectionFactory;
|
||||
|
||||
/**
|
||||
* The Skill container will manage all learned skills by an actor. This class
|
||||
* can also create the {@link Skill} object if an actor is learning a new skill.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class ActorSkillContainer implements Iterable<Skill> {
|
||||
/**
|
||||
* The actor
|
||||
*/
|
||||
private final Actor actor;
|
||||
/**
|
||||
* The learned skill list
|
||||
*/
|
||||
private List<Skill> skills = CollectionFactory.newList(Skill.class);
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param actor
|
||||
* the actor
|
||||
*/
|
||||
public ActorSkillContainer(Actor actor) {
|
||||
this.actor = actor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Learns a new skill
|
||||
*
|
||||
* @param template
|
||||
* the skill to be learned
|
||||
* @param level
|
||||
* the skill level
|
||||
* @return the created skill object, null if skill existed or could not be
|
||||
* learned.
|
||||
*/
|
||||
public Skill learn(SkillTemplate template, int level) {
|
||||
if (hasSkill(template.getID()) != null)
|
||||
return null;
|
||||
if (level > template.getMaximumLevel())
|
||||
level = template.getMaximumLevel();
|
||||
final Skill newSkill = template.create();
|
||||
newSkill.setLevel(level);
|
||||
if (skills.add(newSkill))
|
||||
return newSkill;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Learns a new skill. The skill <tt>level</tt> will be 1.
|
||||
*
|
||||
* @param template
|
||||
* the skill to be learned
|
||||
* @return the created skill object, null if skill existed or could not be
|
||||
* learned.
|
||||
* @see ActorSkillContainer#learn(SkillTemplate, int)
|
||||
*/
|
||||
public Skill learn(SkillTemplate template) {
|
||||
return learn(template, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Learns a new skill
|
||||
*
|
||||
* @param skill
|
||||
* the skill to be learned
|
||||
* @param level
|
||||
* the skill level
|
||||
* @return the created skill object, null if skill existed or could not be
|
||||
* learned.
|
||||
* @see ActorSkillContainer#learn(SkillTemplate, int)
|
||||
*/
|
||||
public Skill learn(SkillTemplateID skill, int level) {
|
||||
return learn(skill.getTemplate(), level);
|
||||
}
|
||||
|
||||
/**
|
||||
* Learns a new skill. The skill <tt>level</tt> will be 1.
|
||||
*
|
||||
* @param skill
|
||||
* the skill to be learned
|
||||
* @return the created skill object, null if skill existed or could not be
|
||||
* learned.
|
||||
* @see ActorSkillContainer#learn(SkillTemplate, int)
|
||||
*/
|
||||
public Skill learn(SkillTemplateID skill) {
|
||||
return learn(skill, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test is the actor knows the given <tt>skillTemplate</tt>
|
||||
*
|
||||
* @param skillTemplate
|
||||
* the skill
|
||||
* @return return the learned skill or null if does not learned skill
|
||||
*/
|
||||
public Skill hasSkill(SkillTemplateID skillTemplate) {
|
||||
for (final Skill skill : this.skills) {
|
||||
if (skill.getSkillTemplateID().equals(skillTemplate))
|
||||
return skill;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all skills in the {@link Collection} to this container
|
||||
*
|
||||
* @param skills
|
||||
* the skill collection
|
||||
*/
|
||||
public void load(Collection<Skill> skills) {
|
||||
this.skills.addAll(skills);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Skill> iterator() {
|
||||
return skills.iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the actor
|
||||
*/
|
||||
public Actor getActor() {
|
||||
return actor;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.l2jserver.model.world.capability;
|
||||
|
||||
import com.l2jserver.model.id.object.ActorID;
|
||||
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;
|
||||
import com.l2jserver.model.world.actor.ActorSkillContainer;
|
||||
|
||||
/**
|
||||
* Defines an {@link AbstractObject} that defines an Actor (NPC, player, pet,
|
||||
@@ -14,5 +16,16 @@ import com.l2jserver.model.world.actor.ActorListener;
|
||||
public interface Actor extends Listenable<ActorListener, ActorEvent>,
|
||||
Spawnable, Pointable, Damagable, Attackable, Attacker, Castable,
|
||||
Caster, Levelable, Killable, Equiper, Equipable {
|
||||
/**
|
||||
* @return the actor effects
|
||||
*/
|
||||
ActorEffects getEffects();
|
||||
|
||||
/**
|
||||
* @return the actor skills
|
||||
*/
|
||||
ActorSkillContainer getSkills();
|
||||
|
||||
@Override
|
||||
ActorID<?> getID();
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ public enum CharacterClass {
|
||||
KNIGHT), ROGUE(0x07, HUMAN_FIGHTER), TREASURE_HUNTER(0x08, ROGUE), HAWKEYE(
|
||||
0x09, ROGUE),
|
||||
// 3rd classes
|
||||
DUELIST(0x58, GLADIATOR), DREADNOUGHT(0x59, WARLORD), phoenixKnight(0x5a,
|
||||
PALADIN), hellKnight(0x5b, DARK_AVENGER), sagittarius(0x5c, HAWKEYE), adventurer(
|
||||
DUELIST(0x58, GLADIATOR), DREADNOUGHT(0x59, WARLORD), PHOENIX_KNIGHT(0x5a,
|
||||
PALADIN), HELL_KNIGHT(0x5b, DARK_AVENGER), SAGITTARIUS(0x5c, HAWKEYE), ADVENTURER(
|
||||
0x5d, TREASURE_HUNTER),
|
||||
|
||||
/**
|
||||
@@ -61,8 +61,8 @@ public enum CharacterClass {
|
||||
0x22, PALUS_KNIGHT), ASSASSIN(0x23, DARK_FIGHTER), ABYSS_WALKER(
|
||||
0x24, ASSASSIN), PHANTOM_RANGER(0x25, ASSASSIN),
|
||||
// 3rd classes
|
||||
SHILLIEN_TEMPLAR(0x6a, SHILLIEN_KNIGHT), spectralDancer(0x6b, BLADEDANCER), ghostHunter(
|
||||
0x6c, ABYSS_WALKER), ghostSentinel(0x6d, PHANTOM_RANGER),
|
||||
SHILLIEN_TEMPLAR(0x6a, SHILLIEN_KNIGHT), spectralDancer(0x6b, BLADEDANCER), GHOST_HUNTER(
|
||||
0x6c, ABYSS_WALKER), GHOST_SENTINEL(0x6d, PHANTOM_RANGER),
|
||||
|
||||
/**
|
||||
* Dark elf mystic
|
||||
|
||||
@@ -46,10 +46,10 @@ public class CharacterInventory implements Iterable<Item> {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the character
|
||||
* @return the amount if items in inventory
|
||||
*/
|
||||
public L2Character getCharacter() {
|
||||
return character;
|
||||
public int getItemCount() {
|
||||
return items.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,4 +85,11 @@ public class CharacterInventory implements Iterable<Item> {
|
||||
public enum InventoryPaperdoll {
|
||||
UNDERWEAR, HEAD, HAIR1, HAIR2, NECK, RIGHT_HAND, LEFT_HAND, RIGHT_EAR, LEFT_EAR, GLOVES, LEGS, LEFT_FEET, RIGHT_FEET, RIGHT_FINGER, LEFT_FINGER, LEFT_BRACELET, RIGHT_BRACELET, DECORATION_1, DECOREATION_2, DECORATION_3, DECORATION_4, DECORATION_5, DECORATION_6, CLOAK, BELT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the character
|
||||
*/
|
||||
public L2Character getCharacter() {
|
||||
return character;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.l2jserver.model.world.character;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.model.game.CharacterShortcut;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.util.factory.CollectionFactory;
|
||||
|
||||
/**
|
||||
* Container that controls shortcut for character instances
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterShortcutContainer implements Iterable<CharacterShortcut> {
|
||||
/**
|
||||
* The character
|
||||
*/
|
||||
private final L2Character character;
|
||||
/**
|
||||
* The shortcut list
|
||||
*/
|
||||
private List<CharacterShortcut> shortcuts = CollectionFactory
|
||||
.newList(CharacterShortcut.class);
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param character
|
||||
* the character
|
||||
*/
|
||||
public CharacterShortcutContainer(L2Character character) {
|
||||
this.character = character;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a new shortcut to this container
|
||||
*
|
||||
* @param shortcut
|
||||
* the shortcut to be added
|
||||
*/
|
||||
public void register(CharacterShortcut shortcut) {
|
||||
shortcuts.add(shortcut);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters the given shortcut from this container
|
||||
*
|
||||
* @param shortcut
|
||||
* the shortcut to be removed
|
||||
*/
|
||||
public void unregister(CharacterShortcut shortcut) {
|
||||
shortcuts.remove(shortcut);
|
||||
}
|
||||
|
||||
/**
|
||||
* Swap two shortcuts between them. Once swap is complete,
|
||||
* <tt>shortcut1</tt> will be in the place of <tt>shortcut2</tt>, and
|
||||
* <tt>shortcut2</tt> in <tt>shortcut1</tt>.
|
||||
*
|
||||
* @param shortcut1
|
||||
* the first shortcut
|
||||
* @param shortcut2
|
||||
* the second shortcut
|
||||
*/
|
||||
public void swap(CharacterShortcut shortcut1, CharacterShortcut shortcut2) {
|
||||
// only swap if is registered already
|
||||
if (!shortcuts.contains(shortcut1) || !shortcuts.contains(shortcut2))
|
||||
return;
|
||||
|
||||
final int slot1 = shortcut1.getSlot();
|
||||
final int page1 = shortcut1.getPage();
|
||||
shortcut1.setSlot(shortcut2.getSlot());
|
||||
shortcut1.setPage(shortcut2.getPage());
|
||||
shortcut2.setSlot(slot1);
|
||||
shortcut2.setPage(page1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if container is full
|
||||
*/
|
||||
public boolean isFull() {
|
||||
return shortcuts.size() >= 12 * 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if there is not shortcut registered
|
||||
*/
|
||||
public boolean isEmpty() {
|
||||
return shortcuts.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads all shortcuts in the given {@link Collection}. This method is
|
||||
* normally called from a DAO.
|
||||
*
|
||||
* @param shortcuts
|
||||
* the collection of shortcuts
|
||||
*/
|
||||
public void load(Collection<CharacterShortcut> shortcuts) {
|
||||
this.shortcuts.addAll(shortcuts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<CharacterShortcut> iterator() {
|
||||
return shortcuts.iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the character
|
||||
*/
|
||||
public L2Character getCharacter() {
|
||||
return character;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user