1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2026-01-29 06:02:48 +00:00

Template concept changes

Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
2011-05-15 18:53:17 -03:00
parent fe41dbdc6f
commit 85f1f8eba0
139 changed files with 1310 additions and 409 deletions

View 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();
}
}

View 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();
}
}

View 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;
}
}