mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-06 07:32:46 +00:00
@@ -33,15 +33,15 @@ import com.l2jserver.model.id.provider.AccountIDProvider;
|
||||
import com.l2jserver.model.id.template.CharacterTemplateID;
|
||||
import com.l2jserver.model.id.template.provider.CharacterTemplateIDProvider;
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.Actor.ActorSex;
|
||||
import com.l2jserver.model.template.actor.ActorSex;
|
||||
import com.l2jserver.model.template.character.CharacterClass;
|
||||
import com.l2jserver.model.template.character.CharacterRace;
|
||||
import com.l2jserver.model.world.Clan;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.L2Character.CharacterRace;
|
||||
import com.l2jserver.model.world.character.CharacterAppearance;
|
||||
import com.l2jserver.model.world.character.CharacterAppearance.CharacterFace;
|
||||
import com.l2jserver.model.world.character.CharacterAppearance.CharacterHairColor;
|
||||
import com.l2jserver.model.world.character.CharacterAppearance.CharacterHairStyle;
|
||||
import com.l2jserver.model.world.character.CharacterClass;
|
||||
import com.l2jserver.service.database.DatabaseService;
|
||||
import com.l2jserver.service.database.JDBCDatabaseService.CachedMapper;
|
||||
import com.l2jserver.service.database.JDBCDatabaseService.InsertUpdateQuery;
|
||||
|
||||
@@ -50,6 +50,7 @@ public class L2JGameServerMain {
|
||||
serviceManager.start(TemplateService.class);
|
||||
|
||||
serviceManager.start(ChatService.class);
|
||||
serviceManager.start(NPCService.class);
|
||||
|
||||
serviceManager.start(CharacterService.class);
|
||||
serviceManager.start(PathingService.class);
|
||||
@@ -57,9 +58,6 @@ public class L2JGameServerMain {
|
||||
serviceManager.start(BlowfishKeygenService.class);
|
||||
serviceManager.start(NetworkService.class);
|
||||
|
||||
// spawn everything
|
||||
serviceManager.get(NPCService.class).spawnAll();
|
||||
|
||||
// final long free = Runtime.getRuntime().freeMemory();
|
||||
// final long allocated = Runtime.getRuntime().totalMemory();
|
||||
// final long maximum = Runtime.getRuntime().maxMemory();
|
||||
|
||||
@@ -31,13 +31,13 @@ import com.l2jserver.model.id.object.provider.CharacterIDProvider;
|
||||
import com.l2jserver.model.id.template.CharacterTemplateID;
|
||||
import com.l2jserver.model.id.template.provider.CharacterTemplateIDProvider;
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.Actor.ActorSex;
|
||||
import com.l2jserver.model.template.actor.ActorSex;
|
||||
import com.l2jserver.model.template.character.CharacterClass;
|
||||
import com.l2jserver.model.template.character.CharacterRace;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.L2Character.CharacterRace;
|
||||
import com.l2jserver.model.world.character.CharacterAppearance.CharacterFace;
|
||||
import com.l2jserver.model.world.character.CharacterAppearance.CharacterHairColor;
|
||||
import com.l2jserver.model.world.character.CharacterAppearance.CharacterHairStyle;
|
||||
import com.l2jserver.model.world.character.CharacterClass;
|
||||
import com.l2jserver.util.BufferUtils;
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,7 @@ import com.l2jserver.game.net.packet.server.SM_CHAR_TEMPLATE;
|
||||
import com.l2jserver.model.id.template.CharacterTemplateID;
|
||||
import com.l2jserver.model.id.template.provider.CharacterTemplateIDProvider;
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.world.character.CharacterClass;
|
||||
import com.l2jserver.model.template.character.CharacterClass;
|
||||
|
||||
/**
|
||||
* Requests the creation of a new Character. The list of character templates is
|
||||
|
||||
@@ -46,7 +46,7 @@ import org.jboss.netty.buffer.ChannelBuffer;
|
||||
|
||||
import com.l2jserver.game.net.Lineage2Connection;
|
||||
import com.l2jserver.game.net.packet.AbstractServerPacket;
|
||||
import com.l2jserver.model.world.Actor.ActorSex;
|
||||
import com.l2jserver.model.template.actor.ActorSex;
|
||||
import com.l2jserver.model.world.Item;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.actor.ActorExperience;
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.jboss.netty.buffer.ChannelBuffer;
|
||||
|
||||
import com.l2jserver.game.net.Lineage2Connection;
|
||||
import com.l2jserver.game.net.packet.AbstractServerPacket;
|
||||
import com.l2jserver.model.world.Actor.ActorSex;
|
||||
import com.l2jserver.model.template.actor.ActorSex;
|
||||
import com.l2jserver.model.world.Item;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.L2Character.CharacterMoveType;
|
||||
|
||||
@@ -199,7 +199,7 @@ public class SM_SYSTEM_MESSAGE extends AbstractServerPacket {
|
||||
}
|
||||
|
||||
public final SM_SYSTEM_MESSAGE addSkill(final Skill skill) {
|
||||
return addSkill(skill.getSkillTemplate(), skill.getLevel());
|
||||
return addSkill(skill.getTemplate(), skill.getLevel());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,6 +42,7 @@ public abstract class AbstractModel<T extends ID<?>> implements Model<T> {
|
||||
@Override
|
||||
public void setID(T ID) {
|
||||
Preconditions.checkState(id == null, "ID is already set");
|
||||
desireInsert();
|
||||
this.id = ID;
|
||||
}
|
||||
|
||||
@@ -68,6 +69,15 @@ public abstract class AbstractModel<T extends ID<?>> implements Model<T> {
|
||||
this.desire = ObjectDesire.UPDATE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set this object desire to {@link ObjectDesire#INSERT}. If the desire is
|
||||
* {@link ObjectDesire#DELETE} the desire will not be changed.
|
||||
*/
|
||||
protected void desireInsert() {
|
||||
if (this.desire != ObjectDesire.DELETE)
|
||||
this.desire = ObjectDesire.INSERT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
|
||||
@@ -29,10 +29,16 @@ public interface Model<T extends ID<?>> {
|
||||
T getID();
|
||||
|
||||
/**
|
||||
* Please note that the ID can only be set one time. Once it has been set,
|
||||
* it cannot be changed and a {@link IllegalStateException} will be thrown
|
||||
* if trying to change the ID.
|
||||
*
|
||||
* @param ID
|
||||
* the object ID to set
|
||||
* @throws IllegalStateException
|
||||
* if the ID was already set
|
||||
*/
|
||||
void setID(T ID);
|
||||
void setID(T ID) throws IllegalStateException;
|
||||
|
||||
/**
|
||||
* @return the database object desire
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.l2jserver.model.game;
|
||||
|
||||
import com.l2jserver.model.AbstractModel;
|
||||
import com.l2jserver.model.id.SkillID;
|
||||
import com.l2jserver.model.id.object.ActorID;
|
||||
import com.l2jserver.model.id.template.SkillTemplateID;
|
||||
import com.l2jserver.model.template.SkillTemplate;
|
||||
@@ -27,72 +28,62 @@ import com.l2jserver.model.world.Actor;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class Skill extends AbstractModel {
|
||||
/**
|
||||
* The skill template ID
|
||||
*/
|
||||
private final SkillTemplateID skillTemplateID;
|
||||
/**
|
||||
* The actor id that has learned this skill
|
||||
*/
|
||||
private ActorID<?> actorID;
|
||||
|
||||
public class Skill extends AbstractModel<SkillID> {
|
||||
private final SkillTemplateID templateID;
|
||||
/**
|
||||
* The skill level learned
|
||||
*/
|
||||
private int level;
|
||||
|
||||
/**
|
||||
* Creates a new instance
|
||||
* Creates a new instance in level one
|
||||
*
|
||||
* @param skillTemplateID
|
||||
* the skill template id
|
||||
* @param level
|
||||
* the skill level
|
||||
* the level of this skill
|
||||
*/
|
||||
public Skill(SkillTemplateID skillTemplateID, int level) {
|
||||
this.skillTemplateID = skillTemplateID;
|
||||
public Skill(SkillTemplateID templateID, int level) {
|
||||
this.templateID = templateID;
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new instance in level one
|
||||
*
|
||||
* @param skillTemplateID
|
||||
* the skill template id
|
||||
*/
|
||||
public Skill(SkillTemplateID skillTemplateID) {
|
||||
this(skillTemplateID, 1);
|
||||
public Skill(SkillTemplateID templateID) {
|
||||
this(templateID, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if this skill is learned in the maximum level
|
||||
*/
|
||||
public boolean isMaximumLevel() {
|
||||
return level >= skillTemplateID.getTemplate().getMaximumLevel();
|
||||
return level >= getTemplate().getMaximumLevel();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the actorID
|
||||
*/
|
||||
public ActorID<?> getActorID() {
|
||||
return actorID;
|
||||
return id.getID1();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the actor
|
||||
*/
|
||||
public Actor getActor() {
|
||||
return actorID.getObject();
|
||||
return getActorID().getObject();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the actor ID. Note that this will change the skill ID and because of
|
||||
* this, the ID can only be set once.
|
||||
*
|
||||
* @param actorID
|
||||
* the actor ID to set
|
||||
* set the actor ID
|
||||
* @see Skill#setID(SkillID)
|
||||
*/
|
||||
public void setActorID(ActorID<?> actorID) {
|
||||
desireUpdate();
|
||||
this.actorID = actorID;
|
||||
setID(new SkillID(actorID, templateID));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,51 +105,14 @@ public class Skill extends AbstractModel {
|
||||
/**
|
||||
* @return the skillTemplateID
|
||||
*/
|
||||
public SkillTemplateID getSkillTemplateID() {
|
||||
return skillTemplateID;
|
||||
public SkillTemplateID getTemplateID() {
|
||||
return id.getID2();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the skillTemplate
|
||||
*/
|
||||
public SkillTemplate getSkillTemplate() {
|
||||
return skillTemplateID.getTemplate();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + ((actorID == null) ? 0 : actorID.hashCode());
|
||||
result = prime * result
|
||||
+ ((skillTemplateID == null) ? 0 : skillTemplateID.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (!super.equals(obj))
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
Skill other = (Skill) obj;
|
||||
if (actorID == null) {
|
||||
if (other.actorID != null)
|
||||
return false;
|
||||
} else if (!actorID.equals(other.actorID))
|
||||
return false;
|
||||
if (skillTemplateID == null) {
|
||||
if (other.skillTemplateID != null)
|
||||
return false;
|
||||
} else if (!skillTemplateID.equals(other.skillTemplateID))
|
||||
return false;
|
||||
return true;
|
||||
public SkillTemplate getTemplate() {
|
||||
return getTemplateID().getTemplate();
|
||||
}
|
||||
}
|
||||
|
||||
45
src/main/java/com/l2jserver/model/id/SkillID.java
Normal file
45
src/main/java/com/l2jserver/model/id/SkillID.java
Normal file
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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.id;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
import com.l2jserver.model.game.CharacterFriend;
|
||||
import com.l2jserver.model.id.compound.AbstractCompoundID;
|
||||
import com.l2jserver.model.id.object.ActorID;
|
||||
import com.l2jserver.model.id.template.SkillTemplateID;
|
||||
|
||||
/**
|
||||
* Each {@link CharacterFriend} is identified by an {@link ID}.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class SkillID extends AbstractCompoundID<ActorID<?>, SkillTemplateID> {
|
||||
/**
|
||||
* Creates a new instance
|
||||
*
|
||||
* @param id1
|
||||
* the actor id
|
||||
* @param id2
|
||||
* the skill template id
|
||||
*/
|
||||
@Inject
|
||||
public SkillID(@Assisted("id1") ActorID<?> id1,
|
||||
@Assisted("id2") SkillTemplateID id2) {
|
||||
super(id1, id2);
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package com.l2jserver.model.server.attack;
|
||||
|
||||
import com.l2jserver.model.template.ItemTemplate;
|
||||
import com.l2jserver.model.world.Actor;
|
||||
|
||||
/**
|
||||
@@ -28,256 +29,254 @@ public class PhysicalAttackCalculator extends AttackCalculator {
|
||||
super(new AttackCalculatorFunction(0x000, AttackCalculatorType.DAMAGE) {
|
||||
@Override
|
||||
public double calculate(Actor attacker, Actor target, double value) {
|
||||
// // 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;
|
||||
// // 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,
|
||||
|
||||
@@ -25,9 +25,9 @@ import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
import com.l2jserver.model.id.template.CharacterTemplateID;
|
||||
import com.l2jserver.model.template.character.CharacterClass;
|
||||
import com.l2jserver.model.template.character.CharacterRace;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,8 +33,8 @@ 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.actor.ActorSex;
|
||||
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;
|
||||
@@ -302,9 +302,8 @@ public class NPCTemplate extends ActorTemplate<NPC> {
|
||||
if (template == null)
|
||||
// FIXME this should thrown an exception!
|
||||
continue;
|
||||
final Skill skill = template.create();
|
||||
final Skill skill = template.create(npc.getID());
|
||||
skill.setLevel(metadata.level);
|
||||
skill.setActorID(npc.getID());
|
||||
skills.add(skill);
|
||||
}
|
||||
npc.getSkills().load(skills);
|
||||
|
||||
@@ -24,6 +24,7 @@ import javax.xml.bind.annotation.XmlType;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
import com.l2jserver.model.game.Skill;
|
||||
import com.l2jserver.model.id.object.ActorID;
|
||||
import com.l2jserver.model.id.template.SkillTemplateID;
|
||||
import com.l2jserver.util.jaxb.SkillTemplateIDAdapter;
|
||||
|
||||
@@ -53,7 +54,13 @@ public class SkillTemplate extends AbstractTemplate<Skill> {
|
||||
|
||||
@Override
|
||||
public Skill create() {
|
||||
return create(null);
|
||||
}
|
||||
|
||||
public Skill create(ActorID<?> actorID) {
|
||||
final Skill skill = new Skill(id);
|
||||
if (actorID != null)
|
||||
skill.setActorID(actorID);
|
||||
skill.setLevel(1);
|
||||
return skill;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.l2jserver.model.template.actor;
|
||||
|
||||
/**
|
||||
* Represent the sex of an actor.
|
||||
* <p>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum ActorSex {
|
||||
MALE(0x00), FEMALE(0x01);
|
||||
|
||||
public final int option;
|
||||
|
||||
ActorSex(int option) {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
public static ActorSex fromOption(int option) {
|
||||
for (ActorSex sex : values()) {
|
||||
if (sex.option == option)
|
||||
return sex;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,17 @@
|
||||
* 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.world.character;
|
||||
package com.l2jserver.model.template.character;
|
||||
|
||||
import com.l2jserver.model.world.L2Character.CharacterRace;
|
||||
import static com.l2jserver.model.template.character.CharacterClass.ClassType.FIGHTER;
|
||||
import static com.l2jserver.model.template.character.CharacterClass.ClassType.MYSTIC;
|
||||
import static com.l2jserver.model.template.character.CharacterClass.ClassType.PRIEST;
|
||||
import static com.l2jserver.model.template.character.CharacterRace.DARK_ELF;
|
||||
import static com.l2jserver.model.template.character.CharacterRace.DWARF;
|
||||
import static com.l2jserver.model.template.character.CharacterRace.ELF;
|
||||
import static com.l2jserver.model.template.character.CharacterRace.HUMAN;
|
||||
import static com.l2jserver.model.template.character.CharacterRace.KAMAEL;
|
||||
import static com.l2jserver.model.template.character.CharacterRace.ORC;
|
||||
|
||||
/**
|
||||
* Defines all the possible classes for an character
|
||||
@@ -27,104 +35,99 @@ public enum CharacterClass {
|
||||
/**
|
||||
* Human fighter
|
||||
*/
|
||||
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(
|
||||
0x09, ROGUE), DUELIST(0x58, GLADIATOR), DREADNOUGHT(0x59, WARLORD), PHOENIX_KNIGHT(
|
||||
0x5a, PALADIN), HELL_KNIGHT(0x5b, DARK_AVENGER), SAGITTARIUS(0x5c,
|
||||
HUMAN_FIGHTER(0x00, FIGHTER, 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(0x09, ROGUE), DUELIST(
|
||||
0x58, GLADIATOR), DREADNOUGHT(0x59, WARLORD), PHOENIX_KNIGHT(0x5a,
|
||||
PALADIN), HELL_KNIGHT(0x5b, DARK_AVENGER), SAGITTARIUS(0x5c,
|
||||
HAWKEYE), ADVENTURER(0x5d, TREASURE_HUNTER),
|
||||
|
||||
/**
|
||||
* Human mystic
|
||||
*/
|
||||
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(
|
||||
0x5f, NECROMANCER), ARCANA_LORD(0x60, WARLOCK), CARDINAL(0x61,
|
||||
BISHOP), HIEROPHANT(0x62, PROPHET),
|
||||
HUMAN_MYSTIC(0x0a, MYSTIC, HUMAN), WIZARD(0x0b, HUMAN_MYSTIC), SORCEROR(
|
||||
0x0c, WIZARD), NECROMANCER(0x0d, WIZARD), WARLOCK(0x0e, true,
|
||||
WIZARD), CLERIC(0x0f, PRIEST, HUMAN_MYSTIC), BISHOP(0x10, CLERIC), PROPHET(
|
||||
0x11, CLERIC), ARCHMAGE(0x5e, SORCEROR), SOULTAKER(0x5f,
|
||||
NECROMANCER), ARCANA_LORD(0x60, WARLOCK), CARDINAL(0x61, BISHOP), HIEROPHANT(
|
||||
0x62, PROPHET),
|
||||
|
||||
/**
|
||||
* Elven fighter
|
||||
*/
|
||||
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(
|
||||
0x63, TEMPLE_KNIGHT), SWORD_MUSE(0x64, SWORD_SINGER), WIND_RIDER(
|
||||
0x65, PLAINS_WALKER), MOONLIGHT_SENTINEL(0x66, SILVER_RANGER),
|
||||
ELVEN_FIGHTER(0x12, FIGHTER, 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(0x63, TEMPLE_KNIGHT), SWORD_MUSE(
|
||||
0x64, SWORD_SINGER), WIND_RIDER(0x65, PLAINS_WALKER), MOONLIGHT_SENTINEL(
|
||||
0x66, SILVER_RANGER),
|
||||
/**
|
||||
* Elven mystic
|
||||
*/
|
||||
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(
|
||||
0x68, ELEMENTAL_SUMMONER), EVA_SAINT(0x69, ELDER),
|
||||
ELVEN_MYSTIC(0x19, MYSTIC, ELF), ELVEN_WIZARD(0x1a, ELVEN_MYSTIC), SPELLSINGER(
|
||||
0x1b, ELVEN_WIZARD), ELEMENTAL_SUMMONER(0x1c, true, ELVEN_WIZARD), ORACLE(
|
||||
0x1d, PRIEST, ELVEN_MYSTIC), ELDER(0x1e, ORACLE), MYSTIC_MUSE(0x67,
|
||||
SPELLSINGER), ELEMENTAL_MASTER(0x68, ELEMENTAL_SUMMONER), EVA_SAINT(
|
||||
0x69, ELDER),
|
||||
|
||||
/**
|
||||
* Dark elf fighter
|
||||
*/
|
||||
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(
|
||||
0x6a, SHILLIEN_KNIGHT), spectralDancer(0x6b, BLADEDANCER), GHOST_HUNTER(
|
||||
0x6c, ABYSS_WALKER), GHOST_SENTINEL(0x6d, PHANTOM_RANGER),
|
||||
DARK_FIGHTER(0x1f, FIGHTER, 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(0x6a, SHILLIEN_KNIGHT), spectralDancer(
|
||||
0x6b, BLADEDANCER), GHOST_HUNTER(0x6c, ABYSS_WALKER), GHOST_SENTINEL(
|
||||
0x6d, PHANTOM_RANGER),
|
||||
|
||||
/**
|
||||
* Dark elf mystic
|
||||
*/
|
||||
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(
|
||||
DARK_MYSTIC(0x26, MYSTIC, DARK_ELF), DARK_WIZARD(0x27, DARK_MYSTIC), SPELLHOWLER(
|
||||
0x28, DARK_WIZARD), PHANTOM_SUMMONER(0x29, true, DARK_WIZARD), SHILLIEN_ORACLE(
|
||||
0x2a, PRIEST, DARK_MYSTIC), SHILLIEN_ELDER(0x2b, SHILLIEN_ORACLE), STORM_SCREAMER(
|
||||
0x6e, SPELLHOWLER), SPECTRAL_MASTER(0x6f, PHANTOM_SUMMONER), SHILLIEAN_SAINT(
|
||||
0x70, SHILLIEN_ELDER),
|
||||
|
||||
/**
|
||||
* Orc fighter
|
||||
*/
|
||||
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),
|
||||
ORC_FIGHTER(0x2c, FIGHTER, 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),
|
||||
|
||||
/**
|
||||
* Orc mystic
|
||||
*/
|
||||
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),
|
||||
ORC_MYSTIC(0x31, FIGHTER, ORC), ORC_SHAMAN(0x32, MYSTIC, ORC_MYSTIC), OVERLORD(
|
||||
0x33, ORC_SHAMAN), WARCRYER(0x34, ORC_SHAMAN), DOMINATOR(0x73,
|
||||
OVERLORD), DOOMCRYER(0x74, WARCRYER),
|
||||
|
||||
/**
|
||||
* Dwarf fighter
|
||||
*/
|
||||
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),
|
||||
DWARVEN_FIGHTER(0x35, FIGHTER, DWARF), SCAVENGER(0x36, DWARVEN_FIGHTER), BOUNTY_HUNTER(
|
||||
0x37, SCAVENGER), ARTISAN(0x38, DWARVEN_FIGHTER), WARSMITH(0x39,
|
||||
ARTISAN), FORTUNE_SEEKER(0x75, BOUNTY_HUNTER), MAESTRO(0x76,
|
||||
WARSMITH),
|
||||
|
||||
/**
|
||||
* Kamael male soldier
|
||||
*/
|
||||
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),
|
||||
MALE_SOLDIER(0x7b, FIGHTER, KAMAEL), TROOPER(0x7D, MALE_SOLDIER), BERSEKER(
|
||||
0x7F, TROOPER), MALE_SOULBREAKER(0x80, TROOPER), DOOMBRINGER(0x83,
|
||||
BERSEKER), MALE_SOULDHOUND(0x84, MALE_SOULBREAKER),
|
||||
|
||||
/**
|
||||
* Kamael female soldier
|
||||
*/
|
||||
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,
|
||||
INSPECTOR),
|
||||
FEMALE_SOLDIER(0x7C, FIGHTER, 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, INSPECTOR),
|
||||
|
||||
// DUMMY ENTRIES, TRASH
|
||||
// DUMMY ENTRIES a.k.a TRASH
|
||||
DUMMY_ENTRY_1(58, null, false, null, null), DUMMY_ENTRY_2(59, null, false,
|
||||
null, null), DUMMY_ENTRY_3(60, null, false, null, null), DUMMY_ENTRY_4(
|
||||
61, null, false, null, null), DUMMY_ENTRY_5(62, null, false, null,
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.l2jserver.model.template.character;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ package com.l2jserver.model.world;
|
||||
import com.l2jserver.model.id.object.ActorID;
|
||||
import com.l2jserver.model.id.template.ActorTemplateID;
|
||||
import com.l2jserver.model.template.ActorTemplate;
|
||||
import com.l2jserver.model.template.actor.ActorSex;
|
||||
import com.l2jserver.model.world.actor.ActorEffects;
|
||||
import com.l2jserver.model.world.actor.ActorSkillContainer;
|
||||
import com.l2jserver.model.world.actor.stat.ActorStats;
|
||||
@@ -36,30 +37,6 @@ public abstract class Actor extends PositionableObject {
|
||||
*/
|
||||
protected ActorSex sex;
|
||||
|
||||
/**
|
||||
* Represent the sex of an actor.
|
||||
* <p>
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum ActorSex {
|
||||
MALE(0x00), FEMALE(0x01);
|
||||
|
||||
public final int option;
|
||||
|
||||
ActorSex(int option) {
|
||||
this.option = option;
|
||||
}
|
||||
|
||||
public static ActorSex fromOption(int option) {
|
||||
for (ActorSex sex : values()) {
|
||||
if (sex.option == option)
|
||||
return sex;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The actor level
|
||||
*/
|
||||
|
||||
@@ -25,8 +25,9 @@ import com.l2jserver.model.id.object.ClanID;
|
||||
import com.l2jserver.model.id.object.PetID;
|
||||
import com.l2jserver.model.id.template.CharacterTemplateID;
|
||||
import com.l2jserver.model.template.CharacterTemplate;
|
||||
import com.l2jserver.model.template.character.CharacterClass;
|
||||
import com.l2jserver.model.template.character.CharacterRace;
|
||||
import com.l2jserver.model.world.character.CharacterAppearance;
|
||||
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;
|
||||
@@ -57,40 +58,6 @@ public class L2Character extends Player {
|
||||
*/
|
||||
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
|
||||
*/
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.l2jserver.model.id.TemplateID;
|
||||
import com.l2jserver.model.id.object.NPCID;
|
||||
import com.l2jserver.model.id.template.NPCTemplateID;
|
||||
import com.l2jserver.model.template.NPCTemplate;
|
||||
import com.l2jserver.model.template.actor.ActorSex;
|
||||
import com.l2jserver.model.world.npc.NPCStats;
|
||||
import com.l2jserver.service.game.ai.AIScript;
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ public class ActorSkillContainer implements Iterable<Skill> {
|
||||
*/
|
||||
public Skill hasSkill(SkillTemplateID skillTemplate) {
|
||||
for (final Skill skill : this.skills) {
|
||||
if (skill.getSkillTemplateID().equals(skillTemplate))
|
||||
if (skill.getTemplateID().equals(skillTemplate))
|
||||
return skill;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
*/
|
||||
package com.l2jserver.service.game.npc;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.l2jserver.game.net.Lineage2Connection;
|
||||
import com.l2jserver.game.net.packet.client.CM_CHAR_ACTION.CharacterAction;
|
||||
import com.l2jserver.model.template.NPCTemplate;
|
||||
@@ -27,8 +25,6 @@ import com.l2jserver.model.world.NPC;
|
||||
import com.l2jserver.service.Service;
|
||||
import com.l2jserver.service.core.threading.AsyncFuture;
|
||||
import com.l2jserver.service.game.character.CannotSetTargetServiceException;
|
||||
import com.l2jserver.service.game.spawn.AlreadySpawnedServiceException;
|
||||
import com.l2jserver.service.game.spawn.SpawnPointNotFoundServiceException;
|
||||
import com.l2jserver.util.geometry.Point3D;
|
||||
|
||||
/**
|
||||
@@ -91,17 +87,6 @@ public interface NPCService extends Service {
|
||||
*/
|
||||
AsyncFuture<Boolean> move(NPC npc, Point3D point);
|
||||
|
||||
/**
|
||||
* Load from database and spawn all {@link NPC NPCs} instances
|
||||
*
|
||||
* @throws AlreadySpawnedServiceException
|
||||
* if one of the NPCs is already spawned
|
||||
* @throws SpawnPointNotFoundServiceException
|
||||
* if one of the NPCs does not have an spawn point defined
|
||||
*/
|
||||
Collection<NPC> spawnAll() throws SpawnPointNotFoundServiceException,
|
||||
AlreadySpawnedServiceException;
|
||||
|
||||
/**
|
||||
* Attacks an given NPC, if possible.
|
||||
*
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.l2jserver.model.world.npc.controller.NPCController;
|
||||
import com.l2jserver.model.world.npc.event.NPCDieEvent;
|
||||
import com.l2jserver.service.AbstractService;
|
||||
import com.l2jserver.service.AbstractService.Depends;
|
||||
import com.l2jserver.service.ServiceStartException;
|
||||
import com.l2jserver.service.core.threading.AsyncFuture;
|
||||
import com.l2jserver.service.core.threading.ThreadService;
|
||||
import com.l2jserver.service.database.DatabaseService;
|
||||
@@ -101,6 +102,7 @@ public class NPCServiceImpl extends AbstractService implements NPCService {
|
||||
*/
|
||||
private Map<Class<? extends NPCController>, NPCController> controllers = CollectionFactory
|
||||
.newMap();
|
||||
private Collection<NPC> npcs;
|
||||
|
||||
@Inject
|
||||
public NPCServiceImpl(SpawnService spawnService,
|
||||
@@ -118,6 +120,20 @@ public class NPCServiceImpl extends AbstractService implements NPCService {
|
||||
this.injector = injector;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doStart() throws ServiceStartException {
|
||||
npcs = npcDao.loadAll();
|
||||
try {
|
||||
for (final NPC npc : npcs) {
|
||||
spawnService.spawn(npc, null);
|
||||
}
|
||||
} catch (SpawnPointNotFoundServiceException e) {
|
||||
throw new ServiceStartException(e);
|
||||
} catch (AlreadySpawnedServiceException e) {
|
||||
throw new ServiceStartException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void action(NPC npc, L2Character character, CharacterAction action)
|
||||
throws ActionServiceException, CannotSetTargetServiceException {
|
||||
@@ -197,17 +213,6 @@ public class NPCServiceImpl extends AbstractService implements NPCService {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<NPC> spawnAll()
|
||||
throws SpawnPointNotFoundServiceException,
|
||||
AlreadySpawnedServiceException {
|
||||
final Collection<NPC> npcs = npcDao.loadAll();
|
||||
for (final NPC npc : npcs) {
|
||||
spawnService.spawn(npc, null);
|
||||
}
|
||||
return npcs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attack(NPC npc, Lineage2Connection conn, L2Character attacker)
|
||||
throws NotAttackableNPCServiceException {
|
||||
|
||||
@@ -21,7 +21,7 @@ import javax.xml.bind.annotation.adapters.XmlAdapter;
|
||||
import com.google.inject.Inject;
|
||||
import com.l2jserver.model.id.template.CharacterTemplateID;
|
||||
import com.l2jserver.model.id.template.provider.CharacterTemplateIDProvider;
|
||||
import com.l2jserver.model.world.character.CharacterClass;
|
||||
import com.l2jserver.model.template.character.CharacterClass;
|
||||
|
||||
/**
|
||||
* This class is an JAXB Adapter for {@link CharacterTemplateIDProvider}
|
||||
|
||||
@@ -65,8 +65,8 @@ import com.l2jserver.model.template.NPCTemplate.NPCInformationMetadata.NPCTitleM
|
||||
import com.l2jserver.model.template.NPCTemplate.SkillMetadata;
|
||||
import com.l2jserver.model.template.NPCTemplate.TalkMetadata;
|
||||
import com.l2jserver.model.template.TeleportationTemplate.TeleportRestriction;
|
||||
import com.l2jserver.model.template.actor.ActorSex;
|
||||
import com.l2jserver.model.template.npc.NPCRace;
|
||||
import com.l2jserver.model.world.Actor.ActorSex;
|
||||
import com.l2jserver.model.world.npc.controller.BaseNPCController;
|
||||
import com.l2jserver.model.world.npc.controller.MonsterController;
|
||||
import com.l2jserver.model.world.npc.controller.NPCController;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package com.l2jserver.tool;
|
||||
|
||||
import com.l2jserver.model.world.character.CharacterClass;
|
||||
import com.l2jserver.model.template.character.CharacterClass;
|
||||
|
||||
public class CharacterSQLEnumGenerator {
|
||||
public static void main(String[] args) {
|
||||
|
||||
Reference in New Issue
Block a user