1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-08 08:23:11 +00:00

NPC skills added, updated item template

Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
2011-06-03 14:04:57 -03:00
parent b188f054df
commit fe7373ba29
10110 changed files with 181889 additions and 39634 deletions

View File

@@ -35,15 +35,15 @@ public interface Model<T extends ID<?>> {
void setID(T ID);
/**
* @return the database object state
* @return the database object desire
*/
ObjectDesire getObjectDesire();
/**
* @param state
* the database object state to set
* @param desire
* the database object desire to set
*/
void setObjectDesire(ObjectDesire state);
void setObjectDesire(ObjectDesire desire);
public enum ObjectDesire {
NONE, INSERT, UPDATE, DELETE;

View File

@@ -28,10 +28,257 @@ public class PhysicalAttackCalculator extends AttackCalculator {
super(new AttackCalculatorFunction(0x000, AttackCalculatorType.DAMAGE) {
@Override
public double calculate(Actor attacker, Actor target, double value) {
// TODO this is certainly not right!!!
// this is just an simple calculator for testing!
return attacker.getStats().getPhysicalAttack()
- target.getStats().getPhysicalDefense();
// // final boolean isPvP = (attacker instanceof L2Playable) &&
// // (target instanceof L2Playable);
// // TODO soulshot charge
// boolean soulshot = false;
//
// double damage = attacker.getStats().getPhysicalAttack();
// double defense = target.getStats().getPhysicalDefense();
// // damage += calcValakasAttribute(attacker, target, skill);
// // if (attacker instanceof NPC) {
// // if (((NPC) attacker)._soulshotcharged) {
// // ss = true;
// // } else
// // ss = false;
// // ((L2Npc) attacker)._soulshotcharged = false;
// // }
// // TODO implement pvp
// // Def bonusses in PvP fight
// // if (isPvP) {
// // if (skill == null)
// // defence *= target.calcStat(Stats.PVP_PHYSICAL_DEF, 1,
// // null, null);
// // else
// // defence *= target.calcStat(Stats.PVP_PHYS_SKILL_DEF, 1,
// // null, null);
// // }
//
// // TODO implement shield
// // switch (shld) {
// // case SHIELD_DEFENSE_SUCCEED:
// // if (!Config.ALT_GAME_SHIELD_BLOCKS)
// // defense += target.getShldDef();
// // break;
// // case SHIELD_DEFENSE_PERFECT_BLOCK: // perfect block
// // return 1.;
// // }
//
// if (soulshot)
// damage *= 2;
// // if (skill != null) {
// // double skillpower = skill.getPower(attacker, target,
// isPvP);
// // float ssboost = skill.getSSBoost();
// // if (ssboost <= 0)
// // damage += skillpower;
// // else if (ssboost > 0) {
// // if (ss) {
// // skillpower *= ssboost;
// // damage += skillpower;
// // } else
// // damage += skillpower;
// // }
// // }
//
// // defense modifier depending of the attacker weapon
// ItemTemplate weapon = attacker.getActiveWeaponItem();
// boolean isBow = false;
// if (weapon != null/* && !attacker.isTransformed()*/) {
// switch (null) {
// case BOW:
// isBow = true;
// stat = StatType.BOW_WPN_VULN;
// break;
// case CROSSBOW:
// isBow = true;
// stat = StatType.CROSSBOW_WPN_VULN;
// break;
// case BLUNT:
// stat = StatType.BLUNT_WPN_VULN;
// break;
// case DAGGER:
// stat = StatType.DAGGER_WPN_VULN;
// break;
// case DUAL:
// stat = StatType.DUAL_WPN_VULN;
// break;
// case DUALFIST:
// stat = StatType.DUALFIST_WPN_VULN;
// break;
// case ETC:
// stat = StatType.ETC_WPN_VULN;
// break;
// case FIST:
// stat = StatType.FIST_WPN_VULN;
// break;
// case POLE:
// stat = StatType.POLE_WPN_VULN;
// break;
// case SWORD:
// stat = StatType.SWORD_WPN_VULN;
// break;
// case BIGSWORD:
// stat = StatType.BIGSWORD_WPN_VULN;
// break;
// case BIGBLUNT:
// stat = StatType.BIGBLUNT_WPN_VULN;
// break;
// case DUALDAGGER:
// stat = StatType.DUALDAGGER_WPN_VULN;
// break;
// case RAPIER:
// stat = StatType.RAPIER_WPN_VULN;
// break;
// case ANCIENTSWORD:
// stat = StatType.ANCIENT_WPN_VULN;
// break;
// /*
// * case PET: stat = Stats.PET_WPN_VULN; break;
// */
// }
// }
//
// // for summon use pet weapon vuln, since they cant hold
// weapon
// // if (attacker instanceof L2SummonInstance)
// // stat = Stats.PET_WPN_VULN;
//
// // if (crit) {
// // // Finally retail like formula
// // damage = 2
// // * attacker.calcStat(Stats.CRITICAL_DAMAGE, 1,
// // target, skill)
// // * target.calcStat(Stats.CRIT_VULN,
// // target.getTemplate().baseCritVuln, target,
// // null) * (70 * damage / defense);
// // // Crit dmg add is almost useless in normal hits...
// // damage += (attacker.calcStat(Stats.CRITICAL_DAMAGE_ADD, 0,
// // target, skill) * 70 / defense);
// // } else
// // damage = 70 * damage / defense;
//
// if (stat != null) {
// // get the vulnerability due to skills (buffs, passives,
// // toggles, etc)
// damage = target.calcStat(stat, damage, target, null);
// /*
// * if (target instanceof L2Npc) { // get the natural
// * vulnerability for the template damage *= ((L2Npc)
// * target).getTemplate().getVulnerability(stat); }
// */
// }
//
// // Weapon random damage
// damage *= attacker.getRandomDamageMultiplier();
//
// // damage += Rnd.nextDouble() * damage / 10;
// // damage += _rnd.nextDouble()*
// // attacker.getRandomDamage(target);
// // }
// if (shld > 0 && Config.ALT_GAME_SHIELD_BLOCKS) {
// damage -= target.getShldDef();
// if (damage < 0)
// damage = 0;
// }
//
// if (target instanceof L2Npc) {
// switch (((L2Npc) target).getTemplate().getRace()) {
// case BEAST:
// damage *= attacker.getPAtkMonsters(target);
// break;
// case ANIMAL:
// damage *= attacker.getPAtkAnimals(target);
// break;
// case PLANT:
// damage *= attacker.getPAtkPlants(target);
// break;
// case DRAGON:
// damage *= attacker.getPAtkDragons(target);
// break;
// case BUG:
// damage *= attacker.getPAtkInsects(target);
// break;
// case GIANT:
// damage *= attacker.getPAtkGiants(target);
// break;
// case MAGICCREATURE:
// damage *= attacker.getPAtkMagicCreatures(target);
// break;
// default:
// // nothing
// break;
// }
// }
//
// if (damage > 0 && damage < 1) {
// damage = 1;
// } else if (damage < 0) {
// damage = 0;
// }
//
// // Dmg bonusses in PvP fight
// if (isPvP) {
// if (skill == null)
// damage *= attacker.calcStat(Stats.PVP_PHYSICAL_DMG, 1,
// null, null);
// else
// damage *= attacker.calcStat(Stats.PVP_PHYS_SKILL_DMG,
// 1, null, null);
// }
//
// // Physical skill dmg boost
// if (skill != null)
// damage *= attacker.calcStat(Stats.PHYSICAL_SKILL_POWER, 1,
// null, null);
//
// damage *= calcElemental(attacker, target, skill);
// if (target instanceof L2Attackable) {
// if (isBow) {
// if (skill != null)
// damage *= attacker.calcStat(
// Stats.PVE_BOW_SKILL_DMG, 1, null, null);
// else
// damage *= attacker.calcStat(Stats.PVE_BOW_DMG, 1,
// null, null);
// } else
// damage *= attacker.calcStat(Stats.PVE_PHYSICAL_DMG, 1,
// null, null);
// if (!target.isRaid()
// && !target.isRaidMinion()
// && target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY
// && attacker.getActingPlayer() != null
// && (target.getLevel() - attacker.getActingPlayer()
// .getLevel()) >= 2) {
// int lvlDiff = target.getLevel()
// - attacker.getActingPlayer().getLevel() - 1;
// if (skill != null) {
// if (lvlDiff > Config.NPC_SKILL_DMG_PENALTY.size())
// damage *= Config.NPC_SKILL_DMG_PENALTY
// .get(Config.NPC_SKILL_DMG_PENALTY
// .size());
// else
// damage *= Config.NPC_SKILL_DMG_PENALTY
// .get(lvlDiff);
// } else if (crit) {
// if (lvlDiff > Config.NPC_CRIT_DMG_PENALTY.size())
// damage *= Config.NPC_CRIT_DMG_PENALTY
// .get(Config.NPC_CRIT_DMG_PENALTY.size());
// else
// damage *= Config.NPC_CRIT_DMG_PENALTY
// .get(lvlDiff);
// } else {
// if (lvlDiff > Config.NPC_DMG_PENALTY.size())
// damage *= Config.NPC_DMG_PENALTY
// .get(Config.NPC_DMG_PENALTY.size());
// else
// damage *= Config.NPC_DMG_PENALTY.get(lvlDiff);
// }
// }
// }
//
// return damage;
return 10;
}
}, new AttackCalculatorFunction(Integer.MAX_VALUE,
AttackCalculatorType.DAMAGE) {

View File

@@ -25,8 +25,8 @@ import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import com.l2jserver.model.id.template.CharacterTemplateID;
import com.l2jserver.model.world.Actor.ActorRace;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.model.world.L2Character.CharacterRace;
import com.l2jserver.model.world.character.CharacterClass;
import com.l2jserver.util.jaxb.CharacterTemplateIDAdapter;
@@ -185,7 +185,7 @@ public class CharacterTemplate extends ActorTemplate<L2Character> {
/**
* @return the character race
*/
public ActorRace getRace() {
public CharacterRace getRace() {
return getCharacterClass().race;
}

View File

@@ -30,6 +30,10 @@ import org.slf4j.LoggerFactory;
import com.l2jserver.model.id.template.ItemTemplateID;
import com.l2jserver.model.template.calculator.ItemSetActorCalculator;
import com.l2jserver.model.template.item.ArmorType;
import com.l2jserver.model.template.item.ItemMaterial;
import com.l2jserver.model.template.item.ItemType;
import com.l2jserver.model.template.item.WeaponType;
import com.l2jserver.model.world.Item;
import com.l2jserver.model.world.actor.stat.StatType;
import com.l2jserver.util.jaxb.ItemTemplateIDAdapter;
@@ -87,14 +91,14 @@ public class ItemTemplate extends AbstractTemplate<Item> {
protected ItemMaterial material;
public enum ItemMaterial {
COTTON, WOOD, PAPER, FISH, ORIHARUKON, HORN, ADAMANTAITE, CHRYSOLITE, MITHRIL, COBWEB, RUNE_XP, CLOTH, SCALE_OF_DRAGON, BONE, GOLD, LEATHER, FINE_STEEL, SILVER, DYESTUFF, CRYSTAL, RUNE_REMOVE_PENALTY, STEEL, BRONZE, RUNE_SP, LIQUID, BLOOD_STEEL, DAMASCUS;
}
public enum EffectType {
IMMEDIATE;
}
protected ItemType itemType = ItemType.NONE;
protected WeaponType weaponType = WeaponType.NONE;
protected ArmorType armorType = ArmorType.NONE;
@XmlType(namespace = "item")
public static class StatAttribute {
@XmlElement(name = "set")

View File

@@ -16,6 +16,7 @@
*/
package com.l2jserver.model.template;
import java.util.Collection;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
@@ -28,13 +29,18 @@ import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import com.l2jserver.model.game.Skill;
import com.l2jserver.model.id.template.ItemTemplateID;
import com.l2jserver.model.id.template.NPCTemplateID;
import com.l2jserver.model.id.template.SkillTemplateID;
import com.l2jserver.model.template.npc.NPCRace;
import com.l2jserver.model.world.Actor.ActorSex;
import com.l2jserver.model.world.NPC;
import com.l2jserver.model.world.npc.controller.NPCController;
import com.l2jserver.util.factory.CollectionFactory;
import com.l2jserver.util.jaxb.ItemTemplateIDAdapter;
import com.l2jserver.util.jaxb.NPCTemplateIDAdapter;
import com.l2jserver.util.jaxb.SkillTemplateIDAdapter;
/**
* @author <a href="http://www.rogiel.com">Rogiel</a>
@@ -80,6 +86,8 @@ public class NPCTemplate extends ActorTemplate<NPC> {
@XmlElement(name = "level")
protected int level = 0;
@XmlElement(name = "race")
protected NPCRace race = NPCRace.NONE;
@XmlElement(name = "sex")
protected ActorSex sex = null;
@@ -259,13 +267,26 @@ public class NPCTemplate extends ActorTemplate<NPC> {
protected DropCategory category = null;
public enum DropCategory {
KILL;
DROP, SPOIL, UNK_1, UNK_2, UNK_3, UNK_4, UNK_5, UNK_6, UNK_7, UNK_8, UNK_9, UNK_10, UNK_11, UNK_12, UNK_13, UNK_14, UNK_15, UNK_16, UNK_17, UNK_18, UNK_19, UNK_20, UNK_21, UNK_22, UNK_23, UNK_24, UNK_25, UNK_26, UNK_27, UNK_28, UNK_29, UNK_30, UNK_31, UNK_32, UNK_33, UNK_34, UNK_35, UNK_36, UNK_100, UNK_101, UNK_102, UNK_200;
}
@XmlAttribute(name = "chance")
protected int chance = 0;
}
@XmlElementWrapper(name = "skills")
@XmlElement(name = "skill")
protected List<SkillMetadata> skills = null;
@XmlType(namespace = "npc")
protected static class SkillMetadata {
@XmlAttribute(name = "id")
@XmlJavaTypeAdapter(value = SkillTemplateIDAdapter.class)
protected SkillTemplateID skill = null;
@XmlAttribute(name = "level")
protected int level = 0;
}
@Override
protected NPC createInstance() {
final NPC npc = new NPC(this.id);
@@ -274,6 +295,19 @@ public class NPCTemplate extends ActorTemplate<NPC> {
npc.setHP(getMaximumHP());
npc.setMP(getMaximumMP());
// load skills
final Collection<Skill> skills = CollectionFactory.newSet();
for (final SkillMetadata metadata : this.skills) {
final SkillTemplate template = metadata.skill.getTemplate();
if (template == null)
// FIXME this should thrown an exception!
continue;
final Skill skill = template.create();
skill.setLevel(metadata.level);
skills.add(skill);
}
npc.getSkills().load(skills);
return npc;
}
@@ -333,6 +367,15 @@ public class NPCTemplate extends ActorTemplate<NPC> {
return info.level;
}
/**
* @return the race
*/
public NPCRace getRace() {
if (info == null)
return NPCRace.NONE;
return info.race;
}
/**
* @return the sex
*/

View File

@@ -0,0 +1,26 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.template.item;
/**
* Enum of all available armor types
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum ArmorType {
NONE, LIGHT, HEAVY, MAGIC, SIGILO;
}

View File

@@ -0,0 +1,21 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.template.item;
public enum ItemMaterial {
COTTON, WOOD, PAPER, FISH, ORIHARUKON, HORN, ADAMANTAITE, CHRYSOLITE, MITHRIL, COBWEB, RUNE_XP, CLOTH, SCALE_OF_DRAGON, BONE, GOLD, LEATHER, FINE_STEEL, SILVER, DYESTUFF, CRYSTAL, RUNE_REMOVE_PENALTY, STEEL, BRONZE, RUNE_SP, LIQUID, BLOOD_STEEL, DAMASCUS;
}

View File

@@ -0,0 +1,139 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.template.item;
/**
* Enum for all available item types
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum ItemType {
/**
* No specific item type
*/
NONE(1),
/**
* An arrow for bows
*/
ARROW(2),
/**
* An potion used to regen cp, hp, mp or cure something
*/
POTION(3),
/**
* Enchant scroll for weapons
*/
WEAPON_ENCHANT_SCROLL(4),
/**
* Enchant scroll for armors
*/
ARMOR_ENCHANT_SCROLL(5),
/**
* An all purpose scroll
*/
SCROLL(6),
/**
* An item recipe
*/
RECIPE(7),
/**
* An material used to craft another item
*/
MATERIAL(8),
/**
* Pet collar
*/
PET_COLLAR(9),
/**
* Castle guard?????
*/
CASTLE_GUARD(10),
/**
* An lottery ticket
*/
LOTTERY_TICKET(11),
/**
* An race ticket
*/
RACE_TICKET(12),
/**
* An dye
*/
DYE(13),
/**
* A seed
*/
SEED(14),
/**
* A crop
*/
CROP(15),
/**
* An mature crop
*/
MATURECROP(16),
/**
* An harvest
*/
HARVEST(17),
/**
* An seed
*/
SEED2(18),
/**
* An ticket of lord
*/
TICKET_OF_LORD(19),
/**
* An lure
*/
LURE(20),
/**
* An blessed weapon enchant scroll
*/
BLESSED_WEAPON_ENCHANT_SCROLL(21),
/**
* An blessed armor enchant scroll
*/
BLESSED_ARMOR_ENCHANT_SCROLL(22),
/**
* An coupon
*/
COUPON(23),
/**
* An elixir
*/
ELIXIR(24),
/**
* Scroll used for enchanting attributes
*/
ATTRIBUTE_ENCHANT_SCROLL(25),
/**
* Bolt? unk.
*/
BOLT(26), SCRL_INC_ENCHANT_PROP_WP(27), SCRL_INC_ENCHANT_PROP_AM(28), ANCIENT_CRYSTAL_ENCHANT_WP(
29), ANCIENT_CRYSTAL_ENCHANT_AM(30), RUNE_SELECT(31), RUNE(32);
/**
* The packet id for this item type
*/
public final int id;
ItemType(int id) {
this.id = id;
}
}

View File

@@ -0,0 +1,92 @@
package com.l2jserver.model.template.item;
import com.l2jserver.model.world.actor.stat.StatType;
/**
* Enum of all available weapon types
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum WeaponType {
/**
* The Sword weapon type
*/
SWORD(StatType.SWORD_WPN_VULN),
/**
* The blunt weapon type
*/
BLUNT(StatType.BLUNT_WPN_VULN),
/**
* The dagger weapon type
*/
DAGGER(StatType.DAGGER_WPN_VULN),
/**
* The bow weapon type
*/
BOW(StatType.BOW_WPN_VULN),
/**
* The pole weapon type
*/
POLE(StatType.POLE_WPN_VULN),
/**
* An dummy entry for a none-weapon
*/
NONE(StatType.NONE_WPN_VULN),
/**
* The dual sword weapon type
*/
DUAL(StatType.DUAL_WPN_VULN),
/**
* An other type of weapon
*/
ETC(StatType.ETC_WPN_VULN),
/**
* The fist weapon type
*/
FIST(StatType.FIST_WPN_VULN),
/**
* The dual fist weapon type
*/
DUALFIST(StatType.DUALFIST_WPN_VULN),
/**
* The fishing tools
*/
FISHINGROD(null),
/**
* The rapier weapon type
*/
RAPIER(StatType.RAPIER_WPN_VULN),
/**
* The ancient sword type
*/
ANCIENTSWORD(StatType.ANCIENT_WPN_VULN),
/**
* The crossbow type
*/
CROSSBOW(StatType.CROSSBOW_WPN_VULN),
/**
* Unk
*/
FLAG(null),
/**
* Unk
*/
OWNTHING(null),
/**
* The dual dagger weapon type
*/
DUALDAGGER(StatType.DUALDAGGER_WPN_VULN);
/**
* This weapon type weaknesses
*/
public final StatType weaknessesStat;
/**
* @param weaknesses
* the weapon weaknesses
*/
WeaponType(StatType weaknessesStat) {
this.weaknessesStat = weaknessesStat;
}
}

View File

@@ -0,0 +1,32 @@
/*
* This file is part of l2jserver <l2jserver.com>.
*
* l2jserver is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* l2jserver is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jserver.model.template.npc;
/**
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum NPCRace {
// character races
HUMAN, ELVEN, DARKELVEN, ORC, DWARVEN, KAMAEL,
// npc exclusive
UNDEAD, MAGIC_CREATURE, BEAST, ANIMAL, PLANT, HUMANOID, SPIRIT,
ANGEL, DEMON, DRAGON, GIANT, BUG, FAIRIE, OTHER, NON_LIVING,
SIEGE_WEAPON, DEFENDING_ARMY, MERCENARIE, UNKNOWN, NONE;
}

View File

@@ -31,45 +31,6 @@ import com.l2jserver.model.world.actor.stat.ActorStats;
public abstract class Actor extends PositionableObject {
protected ActorTemplateID<?> templateID;
/**
* The actor race
*/
protected ActorRace race;
/**
* Represents the actor race.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum ActorRace {
HUMAN(0x00), ELF(0x01), DARK_ELF(0x02), ORC(0x03), DWARF(0x04), KAMAEL(
0x05);
/**
* The numeric ID representing this race
*/
public final int id;
ActorRace(int id) {
this.id = id;
}
/**
* Finds the race based on the <tt>id</tt>
*
* @param id
* the id
* @return the race constant
*/
public static ActorRace fromOption(int id) {
for (final ActorRace race : values()) {
if (race.id == id)
return race;
}
return null;
}
}
/**
* The actor sex
*/
@@ -169,22 +130,6 @@ public abstract class Actor extends PositionableObject {
public abstract ActorStats<?> getStats();
/**
* @return the race
*/
public ActorRace getRace() {
return race;
}
/**
* @param race
* the race to set
*/
public void setRace(ActorRace race) {
desireUpdate();
this.race = race;
}
/**
* @return the sex
*/

View File

@@ -52,6 +52,45 @@ public class L2Character extends Player {
*/
private PetID petID;
/**
* The character race
*/
protected CharacterRace race;
/**
* Represents the character race.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum CharacterRace {
HUMAN(0x00), ELF(0x01), DARK_ELF(0x02), ORC(0x03), DWARF(0x04), KAMAEL(
0x05);
/**
* The numeric ID representing this race
*/
public final int id;
CharacterRace(int id) {
this.id = id;
}
/**
* Finds the race based on the <tt>id</tt>
*
* @param id
* the id
* @return the race constant
*/
public static CharacterRace fromOption(int id) {
for (final CharacterRace race : values()) {
if (race.id == id)
return race;
}
return null;
}
}
/**
* This character's inventory
*/
@@ -224,6 +263,22 @@ public class L2Character extends Player {
desireUpdate();
this.petID = petID;
}
/**
* @return the race
*/
public CharacterRace getRace() {
return race;
}
/**
* @param race
* the race to set
*/
public void setRace(CharacterRace race) {
desireUpdate();
this.race = race;
}
/**
* @return the name

View File

@@ -16,7 +16,7 @@
*/
package com.l2jserver.model.world.character;
import com.l2jserver.model.world.Actor.ActorRace;
import com.l2jserver.model.world.L2Character.CharacterRace;
/**
* Defines all the possible classes for an character
@@ -27,7 +27,7 @@ public enum CharacterClass {
/**
* Human fighter
*/
HUMAN_FIGHTER(0x00, ClassType.FIGHTER, ActorRace.HUMAN), WARRIOR(0x01,
HUMAN_FIGHTER(0x00, ClassType.FIGHTER, CharacterRace.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), TREASURE_HUNTER(0x08, ROGUE), HAWKEYE(
@@ -38,7 +38,7 @@ public enum CharacterClass {
/**
* Human mystic
*/
HUMAN_MYSTIC(0x0a, ClassType.MYSTIC, ActorRace.HUMAN), WIZARD(0x0b,
HUMAN_MYSTIC(0x0a, ClassType.MYSTIC, CharacterRace.HUMAN), WIZARD(0x0b,
HUMAN_MYSTIC), SORCEROR(0x0c, WIZARD), NECROMANCER(0x0d, WIZARD), WARLOCK(
0x0e, true, WIZARD), CLERIC(0x0f, ClassType.PRIEST, HUMAN_MYSTIC), BISHOP(
0x10, CLERIC), PROPHET(0x11, CLERIC), ARCHMAGE(0x5e, SORCEROR), SOULTAKER(
@@ -48,7 +48,7 @@ public enum CharacterClass {
/**
* Elven fighter
*/
ELVEN_FIGHTER(0x12, ClassType.FIGHTER, ActorRace.ELF), ELVEN_KNIGHT(0x13,
ELVEN_FIGHTER(0x12, ClassType.FIGHTER, CharacterRace.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), EVA_TEMPLAR(
@@ -57,7 +57,7 @@ public enum CharacterClass {
/**
* Elven mystic
*/
ELVEN_MYSTIC(0x19, ClassType.MYSTIC, ActorRace.ELF), ELVEN_WIZARD(0x1a,
ELVEN_MYSTIC(0x19, ClassType.MYSTIC, CharacterRace.ELF), ELVEN_WIZARD(0x1a,
ELVEN_MYSTIC), SPELLSINGER(0x1b, ELVEN_WIZARD), ELEMENTAL_SUMMONER(
0x1c, true, ELVEN_WIZARD), ORACLE(0x1d, ClassType.PRIEST,
ELVEN_MYSTIC), ELDER(0x1e, ORACLE), MYSTIC_MUSE(0x67, SPELLSINGER), ELEMENTAL_MASTER(
@@ -66,7 +66,7 @@ public enum CharacterClass {
/**
* Dark elf fighter
*/
DARK_FIGHTER(0x1f, ClassType.FIGHTER, ActorRace.DARK_ELF), PALUS_KNIGHT(
DARK_FIGHTER(0x1f, ClassType.FIGHTER, CharacterRace.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), SHILLIEN_TEMPLAR(
@@ -76,7 +76,7 @@ public enum CharacterClass {
/**
* Dark elf mystic
*/
DARK_MYSTIC(0x26, ClassType.MYSTIC, ActorRace.DARK_ELF), DARK_WIZARD(0x27,
DARK_MYSTIC(0x26, ClassType.MYSTIC, CharacterRace.DARK_ELF), DARK_WIZARD(0x27,
DARK_MYSTIC), SPELLHOWLER(0x28, DARK_WIZARD), PHANTOM_SUMMONER(
0x29, true, DARK_WIZARD), SHILLIEN_ORACLE(0x2a, ClassType.PRIEST,
DARK_MYSTIC), SHILLIEN_ELDER(0x2b, SHILLIEN_ORACLE), STORM_SCREAMER(
@@ -86,7 +86,7 @@ public enum CharacterClass {
/**
* Orc fighter
*/
ORC_FIGHTER(0x2c, ClassType.FIGHTER, ActorRace.ORC), ORC_RAIDER(0x2d,
ORC_FIGHTER(0x2c, ClassType.FIGHTER, CharacterRace.ORC), ORC_RAIDER(0x2d,
ORC_FIGHTER), DESTROYER(0x2e, ORC_RAIDER), ORC_MONK(0x2f,
ORC_FIGHTER), TYRANT(0x30, ORC_RAIDER), TITAN(0x71, DESTROYER), GRAND_KHAUATARI(
0x72, TYRANT),
@@ -94,7 +94,7 @@ public enum CharacterClass {
/**
* Orc mystic
*/
ORC_MYSTIC(0x31, ClassType.FIGHTER, ActorRace.ORC), ORC_SHAMAN(0x32,
ORC_MYSTIC(0x31, ClassType.FIGHTER, CharacterRace.ORC), ORC_SHAMAN(0x32,
ClassType.MYSTIC, ORC_MYSTIC), OVERLORD(0x33, ORC_SHAMAN), WARCRYER(
0x34, ORC_SHAMAN), DOMINATOR(0x73, OVERLORD), DOOMCRYER(0x74,
WARCRYER),
@@ -102,7 +102,7 @@ public enum CharacterClass {
/**
* Dwarf fighter
*/
DWARVEN_FIGHTER(0x35, ClassType.FIGHTER, ActorRace.DWARF), SCAVENGER(0x36,
DWARVEN_FIGHTER(0x35, ClassType.FIGHTER, CharacterRace.DWARF), SCAVENGER(0x36,
DWARVEN_FIGHTER), BOUNTY_HUNTER(0x37, SCAVENGER), ARTISAN(0x38,
DWARVEN_FIGHTER), WARSMITH(0x39, ARTISAN), FORTUNE_SEEKER(0x75,
BOUNTY_HUNTER), MAESTRO(0x76, WARSMITH),
@@ -110,7 +110,7 @@ public enum CharacterClass {
/**
* Kamael male soldier
*/
MALE_SOLDIER(0x7b, ClassType.FIGHTER, ActorRace.KAMAEL), TROOPER(0x7D,
MALE_SOLDIER(0x7b, ClassType.FIGHTER, CharacterRace.KAMAEL), TROOPER(0x7D,
MALE_SOLDIER), BERSEKER(0x7F, TROOPER), MALE_SOULBREAKER(0x80,
TROOPER), DOOMBRINGER(0x83, BERSEKER), MALE_SOULDHOUND(0x84,
MALE_SOULBREAKER),
@@ -118,7 +118,7 @@ public enum CharacterClass {
/**
* Kamael female soldier
*/
FEMALE_SOLDIER(0x7C, ClassType.FIGHTER, ActorRace.KAMAEL), WARDER(0x7E,
FEMALE_SOLDIER(0x7C, ClassType.FIGHTER, CharacterRace.KAMAEL), WARDER(0x7E,
FEMALE_SOLDIER), FEMALE_SOULBREAKER(0x81, WARDER), ARBALESTER(0x82,
WARDER), FEMALE_SOULDHOUND(0x85, FEMALE_SOULBREAKER), TRICKSTER(
0x86, ARBALESTER), INSPECTOR(0x87, WARDER), JUDICATOR(0x88,
@@ -164,7 +164,7 @@ public enum CharacterClass {
/**
* The class race
*/
public final ActorRace race;
public final CharacterRace race;
/**
* The parent class
*/
@@ -185,7 +185,7 @@ public enum CharacterClass {
* the parent
*/
private CharacterClass(int id, ClassType type, boolean summoner,
ActorRace race, CharacterClass parent) {
CharacterRace race, CharacterClass parent) {
this.id = id;
this.type = type;
this.summoner = summoner;
@@ -232,7 +232,7 @@ public enum CharacterClass {
* @param parent
* the parent class
*/
private CharacterClass(int id, ActorRace race, CharacterClass parent) {
private CharacterClass(int id, CharacterRace race, CharacterClass parent) {
this(id, parent.type, parent.summoner, race, parent);
}
@@ -247,7 +247,7 @@ public enum CharacterClass {
* @param race
* the class race
*/
private CharacterClass(int id, ClassType type, ActorRace race) {
private CharacterClass(int id, ClassType type, CharacterRace race) {
this(id, type, false, race, null);
}