1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-11 09:42:54 +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

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