mirror of
https://github.com/Rogiel/l2jserver2
synced 2026-01-30 06:22:47 +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.CharacterTemplateID;
|
||||||
import com.l2jserver.model.id.template.provider.CharacterTemplateIDProvider;
|
import com.l2jserver.model.id.template.provider.CharacterTemplateIDProvider;
|
||||||
import com.l2jserver.model.template.CharacterTemplate;
|
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.Clan;
|
||||||
import com.l2jserver.model.world.L2Character;
|
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;
|
||||||
import com.l2jserver.model.world.character.CharacterAppearance.CharacterFace;
|
import com.l2jserver.model.world.character.CharacterAppearance.CharacterFace;
|
||||||
import com.l2jserver.model.world.character.CharacterAppearance.CharacterHairColor;
|
import com.l2jserver.model.world.character.CharacterAppearance.CharacterHairColor;
|
||||||
import com.l2jserver.model.world.character.CharacterAppearance.CharacterHairStyle;
|
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.DatabaseService;
|
||||||
import com.l2jserver.service.database.JDBCDatabaseService.CachedMapper;
|
import com.l2jserver.service.database.JDBCDatabaseService.CachedMapper;
|
||||||
import com.l2jserver.service.database.JDBCDatabaseService.InsertUpdateQuery;
|
import com.l2jserver.service.database.JDBCDatabaseService.InsertUpdateQuery;
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public class L2JGameServerMain {
|
|||||||
serviceManager.start(TemplateService.class);
|
serviceManager.start(TemplateService.class);
|
||||||
|
|
||||||
serviceManager.start(ChatService.class);
|
serviceManager.start(ChatService.class);
|
||||||
|
serviceManager.start(NPCService.class);
|
||||||
|
|
||||||
serviceManager.start(CharacterService.class);
|
serviceManager.start(CharacterService.class);
|
||||||
serviceManager.start(PathingService.class);
|
serviceManager.start(PathingService.class);
|
||||||
@@ -57,9 +58,6 @@ public class L2JGameServerMain {
|
|||||||
serviceManager.start(BlowfishKeygenService.class);
|
serviceManager.start(BlowfishKeygenService.class);
|
||||||
serviceManager.start(NetworkService.class);
|
serviceManager.start(NetworkService.class);
|
||||||
|
|
||||||
// spawn everything
|
|
||||||
serviceManager.get(NPCService.class).spawnAll();
|
|
||||||
|
|
||||||
// final long free = Runtime.getRuntime().freeMemory();
|
// final long free = Runtime.getRuntime().freeMemory();
|
||||||
// final long allocated = Runtime.getRuntime().totalMemory();
|
// final long allocated = Runtime.getRuntime().totalMemory();
|
||||||
// final long maximum = Runtime.getRuntime().maxMemory();
|
// 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.CharacterTemplateID;
|
||||||
import com.l2jserver.model.id.template.provider.CharacterTemplateIDProvider;
|
import com.l2jserver.model.id.template.provider.CharacterTemplateIDProvider;
|
||||||
import com.l2jserver.model.template.CharacterTemplate;
|
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;
|
||||||
import com.l2jserver.model.world.L2Character.CharacterRace;
|
|
||||||
import com.l2jserver.model.world.character.CharacterAppearance.CharacterFace;
|
import com.l2jserver.model.world.character.CharacterAppearance.CharacterFace;
|
||||||
import com.l2jserver.model.world.character.CharacterAppearance.CharacterHairColor;
|
import com.l2jserver.model.world.character.CharacterAppearance.CharacterHairColor;
|
||||||
import com.l2jserver.model.world.character.CharacterAppearance.CharacterHairStyle;
|
import com.l2jserver.model.world.character.CharacterAppearance.CharacterHairStyle;
|
||||||
import com.l2jserver.model.world.character.CharacterClass;
|
|
||||||
import com.l2jserver.util.BufferUtils;
|
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.CharacterTemplateID;
|
||||||
import com.l2jserver.model.id.template.provider.CharacterTemplateIDProvider;
|
import com.l2jserver.model.id.template.provider.CharacterTemplateIDProvider;
|
||||||
import com.l2jserver.model.template.CharacterTemplate;
|
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
|
* 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.Lineage2Connection;
|
||||||
import com.l2jserver.game.net.packet.AbstractServerPacket;
|
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.Item;
|
||||||
import com.l2jserver.model.world.L2Character;
|
import com.l2jserver.model.world.L2Character;
|
||||||
import com.l2jserver.model.world.actor.ActorExperience;
|
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.Lineage2Connection;
|
||||||
import com.l2jserver.game.net.packet.AbstractServerPacket;
|
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.Item;
|
||||||
import com.l2jserver.model.world.L2Character;
|
import com.l2jserver.model.world.L2Character;
|
||||||
import com.l2jserver.model.world.L2Character.CharacterMoveType;
|
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) {
|
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
|
@Override
|
||||||
public void setID(T ID) {
|
public void setID(T ID) {
|
||||||
Preconditions.checkState(id == null, "ID is already set");
|
Preconditions.checkState(id == null, "ID is already set");
|
||||||
|
desireInsert();
|
||||||
this.id = ID;
|
this.id = ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +69,15 @@ public abstract class AbstractModel<T extends ID<?>> implements Model<T> {
|
|||||||
this.desire = ObjectDesire.UPDATE;
|
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
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
|
|||||||
@@ -29,10 +29,16 @@ public interface Model<T extends ID<?>> {
|
|||||||
T getID();
|
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
|
* @param ID
|
||||||
* the object ID to set
|
* 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
|
* @return the database object desire
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
package com.l2jserver.model.game;
|
package com.l2jserver.model.game;
|
||||||
|
|
||||||
import com.l2jserver.model.AbstractModel;
|
import com.l2jserver.model.AbstractModel;
|
||||||
|
import com.l2jserver.model.id.SkillID;
|
||||||
import com.l2jserver.model.id.object.ActorID;
|
import com.l2jserver.model.id.object.ActorID;
|
||||||
import com.l2jserver.model.id.template.SkillTemplateID;
|
import com.l2jserver.model.id.template.SkillTemplateID;
|
||||||
import com.l2jserver.model.template.SkillTemplate;
|
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>
|
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||||
*/
|
*/
|
||||||
public class Skill extends AbstractModel {
|
public class Skill extends AbstractModel<SkillID> {
|
||||||
/**
|
private final SkillTemplateID templateID;
|
||||||
* The skill template ID
|
|
||||||
*/
|
|
||||||
private final SkillTemplateID skillTemplateID;
|
|
||||||
/**
|
|
||||||
* The actor id that has learned this skill
|
|
||||||
*/
|
|
||||||
private ActorID<?> actorID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The skill level learned
|
* The skill level learned
|
||||||
*/
|
*/
|
||||||
private int level;
|
private int level;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance
|
* Creates a new instance in level one
|
||||||
*
|
*
|
||||||
* @param skillTemplateID
|
|
||||||
* the skill template id
|
|
||||||
* @param level
|
* @param level
|
||||||
* the skill level
|
* the level of this skill
|
||||||
*/
|
*/
|
||||||
public Skill(SkillTemplateID skillTemplateID, int level) {
|
public Skill(SkillTemplateID templateID, int level) {
|
||||||
this.skillTemplateID = skillTemplateID;
|
this.templateID = templateID;
|
||||||
this.level = level;
|
this.level = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance in level one
|
* Creates a new instance in level one
|
||||||
*
|
|
||||||
* @param skillTemplateID
|
|
||||||
* the skill template id
|
|
||||||
*/
|
*/
|
||||||
public Skill(SkillTemplateID skillTemplateID) {
|
public Skill(SkillTemplateID templateID) {
|
||||||
this(skillTemplateID, 1);
|
this(templateID, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if this skill is learned in the maximum level
|
* @return true if this skill is learned in the maximum level
|
||||||
*/
|
*/
|
||||||
public boolean isMaximumLevel() {
|
public boolean isMaximumLevel() {
|
||||||
return level >= skillTemplateID.getTemplate().getMaximumLevel();
|
return level >= getTemplate().getMaximumLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the actorID
|
* @return the actorID
|
||||||
*/
|
*/
|
||||||
public ActorID<?> getActorID() {
|
public ActorID<?> getActorID() {
|
||||||
return actorID;
|
return id.getID1();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the actor
|
* @return the actor
|
||||||
*/
|
*/
|
||||||
public Actor getActor() {
|
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
|
* @param actorID
|
||||||
* the actor ID to set
|
* set the actor ID
|
||||||
|
* @see Skill#setID(SkillID)
|
||||||
*/
|
*/
|
||||||
public void setActorID(ActorID<?> actorID) {
|
public void setActorID(ActorID<?> actorID) {
|
||||||
desireUpdate();
|
setID(new SkillID(actorID, templateID));
|
||||||
this.actorID = actorID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,51 +105,14 @@ public class Skill extends AbstractModel {
|
|||||||
/**
|
/**
|
||||||
* @return the skillTemplateID
|
* @return the skillTemplateID
|
||||||
*/
|
*/
|
||||||
public SkillTemplateID getSkillTemplateID() {
|
public SkillTemplateID getTemplateID() {
|
||||||
return skillTemplateID;
|
return id.getID2();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the skillTemplate
|
* @return the skillTemplate
|
||||||
*/
|
*/
|
||||||
public SkillTemplate getSkillTemplate() {
|
public SkillTemplate getTemplate() {
|
||||||
return skillTemplateID.getTemplate();
|
return getTemplateID().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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
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;
|
package com.l2jserver.model.server.attack;
|
||||||
|
|
||||||
|
import com.l2jserver.model.template.ItemTemplate;
|
||||||
import com.l2jserver.model.world.Actor;
|
import com.l2jserver.model.world.Actor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,8 +68,7 @@ public class PhysicalAttackCalculator extends AttackCalculator {
|
|||||||
// if (soulshot)
|
// if (soulshot)
|
||||||
// damage *= 2;
|
// damage *= 2;
|
||||||
// // if (skill != null) {
|
// // if (skill != null) {
|
||||||
// // double skillpower = skill.getPower(attacker, target,
|
// // double skillpower = skill.getPower(attacker, target, isPvP);
|
||||||
// isPvP);
|
|
||||||
// // float ssboost = skill.getSSBoost();
|
// // float ssboost = skill.getSSBoost();
|
||||||
// // if (ssboost <= 0)
|
// // if (ssboost <= 0)
|
||||||
// // damage += skillpower;
|
// // damage += skillpower;
|
||||||
@@ -82,7 +82,7 @@ public class PhysicalAttackCalculator extends AttackCalculator {
|
|||||||
// // }
|
// // }
|
||||||
//
|
//
|
||||||
// // defense modifier depending of the attacker weapon
|
// // defense modifier depending of the attacker weapon
|
||||||
// ItemTemplate weapon = attacker.getActiveWeaponItem();
|
// //ItemTemplate weapon = attacker.getActiveWeaponItem();
|
||||||
// boolean isBow = false;
|
// boolean isBow = false;
|
||||||
// if (weapon != null/* && !attacker.isTransformed() */) {
|
// if (weapon != null/* && !attacker.isTransformed() */) {
|
||||||
// switch (null) {
|
// switch (null) {
|
||||||
@@ -139,8 +139,7 @@ public class PhysicalAttackCalculator extends AttackCalculator {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// // for summon use pet weapon vuln, since they cant hold
|
// // for summon use pet weapon vuln, since they cant hold weapon
|
||||||
// weapon
|
|
||||||
// // if (attacker instanceof L2SummonInstance)
|
// // if (attacker instanceof L2SummonInstance)
|
||||||
// // stat = Stats.PET_WPN_VULN;
|
// // stat = Stats.PET_WPN_VULN;
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ import javax.xml.bind.annotation.XmlType;
|
|||||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||||
|
|
||||||
import com.l2jserver.model.id.template.CharacterTemplateID;
|
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;
|
||||||
import com.l2jserver.model.world.L2Character.CharacterRace;
|
|
||||||
import com.l2jserver.model.world.character.CharacterClass;
|
|
||||||
import com.l2jserver.util.jaxb.CharacterTemplateIDAdapter;
|
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.ItemTemplateID;
|
||||||
import com.l2jserver.model.id.template.NPCTemplateID;
|
import com.l2jserver.model.id.template.NPCTemplateID;
|
||||||
import com.l2jserver.model.id.template.SkillTemplateID;
|
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.template.npc.NPCRace;
|
||||||
import com.l2jserver.model.world.Actor.ActorSex;
|
|
||||||
import com.l2jserver.model.world.NPC;
|
import com.l2jserver.model.world.NPC;
|
||||||
import com.l2jserver.model.world.npc.controller.NPCController;
|
import com.l2jserver.model.world.npc.controller.NPCController;
|
||||||
import com.l2jserver.util.factory.CollectionFactory;
|
import com.l2jserver.util.factory.CollectionFactory;
|
||||||
@@ -302,9 +302,8 @@ public class NPCTemplate extends ActorTemplate<NPC> {
|
|||||||
if (template == null)
|
if (template == null)
|
||||||
// FIXME this should thrown an exception!
|
// FIXME this should thrown an exception!
|
||||||
continue;
|
continue;
|
||||||
final Skill skill = template.create();
|
final Skill skill = template.create(npc.getID());
|
||||||
skill.setLevel(metadata.level);
|
skill.setLevel(metadata.level);
|
||||||
skill.setActorID(npc.getID());
|
|
||||||
skills.add(skill);
|
skills.add(skill);
|
||||||
}
|
}
|
||||||
npc.getSkills().load(skills);
|
npc.getSkills().load(skills);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import javax.xml.bind.annotation.XmlType;
|
|||||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||||
|
|
||||||
import com.l2jserver.model.game.Skill;
|
import com.l2jserver.model.game.Skill;
|
||||||
|
import com.l2jserver.model.id.object.ActorID;
|
||||||
import com.l2jserver.model.id.template.SkillTemplateID;
|
import com.l2jserver.model.id.template.SkillTemplateID;
|
||||||
import com.l2jserver.util.jaxb.SkillTemplateIDAdapter;
|
import com.l2jserver.util.jaxb.SkillTemplateIDAdapter;
|
||||||
|
|
||||||
@@ -53,7 +54,13 @@ public class SkillTemplate extends AbstractTemplate<Skill> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Skill create() {
|
public Skill create() {
|
||||||
|
return create(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Skill create(ActorID<?> actorID) {
|
||||||
final Skill skill = new Skill(id);
|
final Skill skill = new Skill(id);
|
||||||
|
if (actorID != null)
|
||||||
|
skill.setActorID(actorID);
|
||||||
skill.setLevel(1);
|
skill.setLevel(1);
|
||||||
return skill;
|
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
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
* 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
|
* Defines all the possible classes for an character
|
||||||
@@ -27,104 +35,99 @@ public enum CharacterClass {
|
|||||||
/**
|
/**
|
||||||
* Human fighter
|
* Human fighter
|
||||||
*/
|
*/
|
||||||
HUMAN_FIGHTER(0x00, ClassType.FIGHTER, CharacterRace.HUMAN), WARRIOR(0x01,
|
HUMAN_FIGHTER(0x00, FIGHTER, HUMAN), WARRIOR(0x01, HUMAN_FIGHTER), GLADIATOR(
|
||||||
HUMAN_FIGHTER), GLADIATOR(0x02, WARRIOR), WARLORD(0x03, WARRIOR), KNIGHT(
|
0x02, WARRIOR), WARLORD(0x03, WARRIOR), KNIGHT(0x04, HUMAN_FIGHTER), PALADIN(
|
||||||
0x04, HUMAN_FIGHTER), PALADIN(0x05, KNIGHT), DARK_AVENGER(0x06,
|
0x05, KNIGHT), DARK_AVENGER(0x06, KNIGHT), ROGUE(0x07,
|
||||||
KNIGHT), ROGUE(0x07, HUMAN_FIGHTER), TREASURE_HUNTER(0x08, ROGUE), HAWKEYE(
|
HUMAN_FIGHTER), TREASURE_HUNTER(0x08, ROGUE), HAWKEYE(0x09, ROGUE), DUELIST(
|
||||||
0x09, ROGUE), DUELIST(0x58, GLADIATOR), DREADNOUGHT(0x59, WARLORD), PHOENIX_KNIGHT(
|
0x58, GLADIATOR), DREADNOUGHT(0x59, WARLORD), PHOENIX_KNIGHT(0x5a,
|
||||||
0x5a, PALADIN), HELL_KNIGHT(0x5b, DARK_AVENGER), SAGITTARIUS(0x5c,
|
PALADIN), HELL_KNIGHT(0x5b, DARK_AVENGER), SAGITTARIUS(0x5c,
|
||||||
HAWKEYE), ADVENTURER(0x5d, TREASURE_HUNTER),
|
HAWKEYE), ADVENTURER(0x5d, TREASURE_HUNTER),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Human mystic
|
* Human mystic
|
||||||
*/
|
*/
|
||||||
HUMAN_MYSTIC(0x0a, ClassType.MYSTIC, CharacterRace.HUMAN), WIZARD(0x0b,
|
HUMAN_MYSTIC(0x0a, MYSTIC, HUMAN), WIZARD(0x0b, HUMAN_MYSTIC), SORCEROR(
|
||||||
HUMAN_MYSTIC), SORCEROR(0x0c, WIZARD), NECROMANCER(0x0d, WIZARD), WARLOCK(
|
0x0c, WIZARD), NECROMANCER(0x0d, WIZARD), WARLOCK(0x0e, true,
|
||||||
0x0e, true, WIZARD), CLERIC(0x0f, ClassType.PRIEST, HUMAN_MYSTIC), BISHOP(
|
WIZARD), CLERIC(0x0f, PRIEST, HUMAN_MYSTIC), BISHOP(0x10, CLERIC), PROPHET(
|
||||||
0x10, CLERIC), PROPHET(0x11, CLERIC), ARCHMAGE(0x5e, SORCEROR), SOULTAKER(
|
0x11, CLERIC), ARCHMAGE(0x5e, SORCEROR), SOULTAKER(0x5f,
|
||||||
0x5f, NECROMANCER), ARCANA_LORD(0x60, WARLOCK), CARDINAL(0x61,
|
NECROMANCER), ARCANA_LORD(0x60, WARLOCK), CARDINAL(0x61, BISHOP), HIEROPHANT(
|
||||||
BISHOP), HIEROPHANT(0x62, PROPHET),
|
0x62, PROPHET),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Elven fighter
|
* Elven fighter
|
||||||
*/
|
*/
|
||||||
ELVEN_FIGHTER(0x12, ClassType.FIGHTER, CharacterRace.ELF), ELVEN_KNIGHT(0x13,
|
ELVEN_FIGHTER(0x12, FIGHTER, ELF), ELVEN_KNIGHT(0x13, ELVEN_FIGHTER), TEMPLE_KNIGHT(
|
||||||
ELVEN_FIGHTER), TEMPLE_KNIGHT(0x14, ELVEN_KNIGHT), SWORD_SINGER(
|
0x14, ELVEN_KNIGHT), SWORD_SINGER(0x15, ELVEN_KNIGHT), ELVEN_SCOUT(
|
||||||
0x15, ELVEN_KNIGHT), ELVEN_SCOUT(0x16, ELVEN_FIGHTER), PLAINS_WALKER(
|
0x16, ELVEN_FIGHTER), PLAINS_WALKER(0x17, ELVEN_SCOUT), SILVER_RANGER(
|
||||||
0x17, ELVEN_SCOUT), SILVER_RANGER(0x18, ELVEN_SCOUT), EVA_TEMPLAR(
|
0x18, ELVEN_SCOUT), EVA_TEMPLAR(0x63, TEMPLE_KNIGHT), SWORD_MUSE(
|
||||||
0x63, TEMPLE_KNIGHT), SWORD_MUSE(0x64, SWORD_SINGER), WIND_RIDER(
|
0x64, SWORD_SINGER), WIND_RIDER(0x65, PLAINS_WALKER), MOONLIGHT_SENTINEL(
|
||||||
0x65, PLAINS_WALKER), MOONLIGHT_SENTINEL(0x66, SILVER_RANGER),
|
0x66, SILVER_RANGER),
|
||||||
/**
|
/**
|
||||||
* Elven mystic
|
* Elven mystic
|
||||||
*/
|
*/
|
||||||
ELVEN_MYSTIC(0x19, ClassType.MYSTIC, CharacterRace.ELF), ELVEN_WIZARD(0x1a,
|
ELVEN_MYSTIC(0x19, MYSTIC, ELF), ELVEN_WIZARD(0x1a, ELVEN_MYSTIC), SPELLSINGER(
|
||||||
ELVEN_MYSTIC), SPELLSINGER(0x1b, ELVEN_WIZARD), ELEMENTAL_SUMMONER(
|
0x1b, ELVEN_WIZARD), ELEMENTAL_SUMMONER(0x1c, true, ELVEN_WIZARD), ORACLE(
|
||||||
0x1c, true, ELVEN_WIZARD), ORACLE(0x1d, ClassType.PRIEST,
|
0x1d, PRIEST, ELVEN_MYSTIC), ELDER(0x1e, ORACLE), MYSTIC_MUSE(0x67,
|
||||||
ELVEN_MYSTIC), ELDER(0x1e, ORACLE), MYSTIC_MUSE(0x67, SPELLSINGER), ELEMENTAL_MASTER(
|
SPELLSINGER), ELEMENTAL_MASTER(0x68, ELEMENTAL_SUMMONER), EVA_SAINT(
|
||||||
0x68, ELEMENTAL_SUMMONER), EVA_SAINT(0x69, ELDER),
|
0x69, ELDER),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dark elf fighter
|
* Dark elf fighter
|
||||||
*/
|
*/
|
||||||
DARK_FIGHTER(0x1f, ClassType.FIGHTER, CharacterRace.DARK_ELF), PALUS_KNIGHT(
|
DARK_FIGHTER(0x1f, FIGHTER, DARK_ELF), PALUS_KNIGHT(0x20, DARK_FIGHTER), SHILLIEN_KNIGHT(
|
||||||
0x20, DARK_FIGHTER), SHILLIEN_KNIGHT(0x21, PALUS_KNIGHT), BLADEDANCER(
|
0x21, PALUS_KNIGHT), BLADEDANCER(0x22, PALUS_KNIGHT), ASSASSIN(
|
||||||
0x22, PALUS_KNIGHT), ASSASSIN(0x23, DARK_FIGHTER), ABYSS_WALKER(
|
0x23, DARK_FIGHTER), ABYSS_WALKER(0x24, ASSASSIN), PHANTOM_RANGER(
|
||||||
0x24, ASSASSIN), PHANTOM_RANGER(0x25, ASSASSIN), SHILLIEN_TEMPLAR(
|
0x25, ASSASSIN), SHILLIEN_TEMPLAR(0x6a, SHILLIEN_KNIGHT), spectralDancer(
|
||||||
0x6a, SHILLIEN_KNIGHT), spectralDancer(0x6b, BLADEDANCER), GHOST_HUNTER(
|
0x6b, BLADEDANCER), GHOST_HUNTER(0x6c, ABYSS_WALKER), GHOST_SENTINEL(
|
||||||
0x6c, ABYSS_WALKER), GHOST_SENTINEL(0x6d, PHANTOM_RANGER),
|
0x6d, PHANTOM_RANGER),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dark elf mystic
|
* Dark elf mystic
|
||||||
*/
|
*/
|
||||||
DARK_MYSTIC(0x26, ClassType.MYSTIC, CharacterRace.DARK_ELF), DARK_WIZARD(0x27,
|
DARK_MYSTIC(0x26, MYSTIC, DARK_ELF), DARK_WIZARD(0x27, DARK_MYSTIC), SPELLHOWLER(
|
||||||
DARK_MYSTIC), SPELLHOWLER(0x28, DARK_WIZARD), PHANTOM_SUMMONER(
|
0x28, DARK_WIZARD), PHANTOM_SUMMONER(0x29, true, DARK_WIZARD), SHILLIEN_ORACLE(
|
||||||
0x29, true, DARK_WIZARD), SHILLIEN_ORACLE(0x2a, ClassType.PRIEST,
|
0x2a, PRIEST, DARK_MYSTIC), SHILLIEN_ELDER(0x2b, SHILLIEN_ORACLE), STORM_SCREAMER(
|
||||||
DARK_MYSTIC), SHILLIEN_ELDER(0x2b, SHILLIEN_ORACLE), STORM_SCREAMER(
|
|
||||||
0x6e, SPELLHOWLER), SPECTRAL_MASTER(0x6f, PHANTOM_SUMMONER), SHILLIEAN_SAINT(
|
0x6e, SPELLHOWLER), SPECTRAL_MASTER(0x6f, PHANTOM_SUMMONER), SHILLIEAN_SAINT(
|
||||||
0x70, SHILLIEN_ELDER),
|
0x70, SHILLIEN_ELDER),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Orc fighter
|
* Orc fighter
|
||||||
*/
|
*/
|
||||||
ORC_FIGHTER(0x2c, ClassType.FIGHTER, CharacterRace.ORC), ORC_RAIDER(0x2d,
|
ORC_FIGHTER(0x2c, FIGHTER, ORC), ORC_RAIDER(0x2d, ORC_FIGHTER), DESTROYER(
|
||||||
ORC_FIGHTER), DESTROYER(0x2e, ORC_RAIDER), ORC_MONK(0x2f,
|
0x2e, ORC_RAIDER), ORC_MONK(0x2f, ORC_FIGHTER), TYRANT(0x30,
|
||||||
ORC_FIGHTER), TYRANT(0x30, ORC_RAIDER), TITAN(0x71, DESTROYER), GRAND_KHAUATARI(
|
ORC_RAIDER), TITAN(0x71, DESTROYER), GRAND_KHAUATARI(0x72, TYRANT),
|
||||||
0x72, TYRANT),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Orc mystic
|
* Orc mystic
|
||||||
*/
|
*/
|
||||||
ORC_MYSTIC(0x31, ClassType.FIGHTER, CharacterRace.ORC), ORC_SHAMAN(0x32,
|
ORC_MYSTIC(0x31, FIGHTER, ORC), ORC_SHAMAN(0x32, MYSTIC, ORC_MYSTIC), OVERLORD(
|
||||||
ClassType.MYSTIC, ORC_MYSTIC), OVERLORD(0x33, ORC_SHAMAN), WARCRYER(
|
0x33, ORC_SHAMAN), WARCRYER(0x34, ORC_SHAMAN), DOMINATOR(0x73,
|
||||||
0x34, ORC_SHAMAN), DOMINATOR(0x73, OVERLORD), DOOMCRYER(0x74,
|
OVERLORD), DOOMCRYER(0x74, WARCRYER),
|
||||||
WARCRYER),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dwarf fighter
|
* Dwarf fighter
|
||||||
*/
|
*/
|
||||||
DWARVEN_FIGHTER(0x35, ClassType.FIGHTER, CharacterRace.DWARF), SCAVENGER(0x36,
|
DWARVEN_FIGHTER(0x35, FIGHTER, DWARF), SCAVENGER(0x36, DWARVEN_FIGHTER), BOUNTY_HUNTER(
|
||||||
DWARVEN_FIGHTER), BOUNTY_HUNTER(0x37, SCAVENGER), ARTISAN(0x38,
|
0x37, SCAVENGER), ARTISAN(0x38, DWARVEN_FIGHTER), WARSMITH(0x39,
|
||||||
DWARVEN_FIGHTER), WARSMITH(0x39, ARTISAN), FORTUNE_SEEKER(0x75,
|
ARTISAN), FORTUNE_SEEKER(0x75, BOUNTY_HUNTER), MAESTRO(0x76,
|
||||||
BOUNTY_HUNTER), MAESTRO(0x76, WARSMITH),
|
WARSMITH),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kamael male soldier
|
* Kamael male soldier
|
||||||
*/
|
*/
|
||||||
MALE_SOLDIER(0x7b, ClassType.FIGHTER, CharacterRace.KAMAEL), TROOPER(0x7D,
|
MALE_SOLDIER(0x7b, FIGHTER, KAMAEL), TROOPER(0x7D, MALE_SOLDIER), BERSEKER(
|
||||||
MALE_SOLDIER), BERSEKER(0x7F, TROOPER), MALE_SOULBREAKER(0x80,
|
0x7F, TROOPER), MALE_SOULBREAKER(0x80, TROOPER), DOOMBRINGER(0x83,
|
||||||
TROOPER), DOOMBRINGER(0x83, BERSEKER), MALE_SOULDHOUND(0x84,
|
BERSEKER), MALE_SOULDHOUND(0x84, MALE_SOULBREAKER),
|
||||||
MALE_SOULBREAKER),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kamael female soldier
|
* Kamael female soldier
|
||||||
*/
|
*/
|
||||||
FEMALE_SOLDIER(0x7C, ClassType.FIGHTER, CharacterRace.KAMAEL), WARDER(0x7E,
|
FEMALE_SOLDIER(0x7C, FIGHTER, KAMAEL), WARDER(0x7E, FEMALE_SOLDIER), FEMALE_SOULBREAKER(
|
||||||
FEMALE_SOLDIER), FEMALE_SOULBREAKER(0x81, WARDER), ARBALESTER(0x82,
|
0x81, WARDER), ARBALESTER(0x82, WARDER), FEMALE_SOULDHOUND(0x85,
|
||||||
WARDER), FEMALE_SOULDHOUND(0x85, FEMALE_SOULBREAKER), TRICKSTER(
|
FEMALE_SOULBREAKER), TRICKSTER(0x86, ARBALESTER), INSPECTOR(0x87,
|
||||||
0x86, ARBALESTER), INSPECTOR(0x87, WARDER), JUDICATOR(0x88,
|
WARDER), JUDICATOR(0x88, INSPECTOR),
|
||||||
INSPECTOR),
|
|
||||||
|
|
||||||
// DUMMY ENTRIES, TRASH
|
// DUMMY ENTRIES a.k.a TRASH
|
||||||
DUMMY_ENTRY_1(58, null, false, null, null), DUMMY_ENTRY_2(59, null, false,
|
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(
|
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,
|
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.object.ActorID;
|
||||||
import com.l2jserver.model.id.template.ActorTemplateID;
|
import com.l2jserver.model.id.template.ActorTemplateID;
|
||||||
import com.l2jserver.model.template.ActorTemplate;
|
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.ActorEffects;
|
||||||
import com.l2jserver.model.world.actor.ActorSkillContainer;
|
import com.l2jserver.model.world.actor.ActorSkillContainer;
|
||||||
import com.l2jserver.model.world.actor.stat.ActorStats;
|
import com.l2jserver.model.world.actor.stat.ActorStats;
|
||||||
@@ -36,30 +37,6 @@ public abstract class Actor extends PositionableObject {
|
|||||||
*/
|
*/
|
||||||
protected ActorSex sex;
|
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
|
* 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.object.PetID;
|
||||||
import com.l2jserver.model.id.template.CharacterTemplateID;
|
import com.l2jserver.model.id.template.CharacterTemplateID;
|
||||||
import com.l2jserver.model.template.CharacterTemplate;
|
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.CharacterAppearance;
|
||||||
import com.l2jserver.model.world.character.CharacterClass;
|
|
||||||
import com.l2jserver.model.world.character.CharacterFriendList;
|
import com.l2jserver.model.world.character.CharacterFriendList;
|
||||||
import com.l2jserver.model.world.character.CharacterInventory;
|
import com.l2jserver.model.world.character.CharacterInventory;
|
||||||
import com.l2jserver.model.world.character.CharacterShortcutContainer;
|
import com.l2jserver.model.world.character.CharacterShortcutContainer;
|
||||||
@@ -57,40 +58,6 @@ public class L2Character extends Player {
|
|||||||
*/
|
*/
|
||||||
protected CharacterRace 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
|
* 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.object.NPCID;
|
||||||
import com.l2jserver.model.id.template.NPCTemplateID;
|
import com.l2jserver.model.id.template.NPCTemplateID;
|
||||||
import com.l2jserver.model.template.NPCTemplate;
|
import com.l2jserver.model.template.NPCTemplate;
|
||||||
|
import com.l2jserver.model.template.actor.ActorSex;
|
||||||
import com.l2jserver.model.world.npc.NPCStats;
|
import com.l2jserver.model.world.npc.NPCStats;
|
||||||
import com.l2jserver.service.game.ai.AIScript;
|
import com.l2jserver.service.game.ai.AIScript;
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ public class ActorSkillContainer implements Iterable<Skill> {
|
|||||||
*/
|
*/
|
||||||
public Skill hasSkill(SkillTemplateID skillTemplate) {
|
public Skill hasSkill(SkillTemplateID skillTemplate) {
|
||||||
for (final Skill skill : this.skills) {
|
for (final Skill skill : this.skills) {
|
||||||
if (skill.getSkillTemplateID().equals(skillTemplate))
|
if (skill.getTemplateID().equals(skillTemplate))
|
||||||
return skill;
|
return skill;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.l2jserver.service.game.npc;
|
package com.l2jserver.service.game.npc;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
import com.l2jserver.game.net.Lineage2Connection;
|
import com.l2jserver.game.net.Lineage2Connection;
|
||||||
import com.l2jserver.game.net.packet.client.CM_CHAR_ACTION.CharacterAction;
|
import com.l2jserver.game.net.packet.client.CM_CHAR_ACTION.CharacterAction;
|
||||||
import com.l2jserver.model.template.NPCTemplate;
|
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.Service;
|
||||||
import com.l2jserver.service.core.threading.AsyncFuture;
|
import com.l2jserver.service.core.threading.AsyncFuture;
|
||||||
import com.l2jserver.service.game.character.CannotSetTargetServiceException;
|
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;
|
import com.l2jserver.util.geometry.Point3D;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,17 +87,6 @@ public interface NPCService extends Service {
|
|||||||
*/
|
*/
|
||||||
AsyncFuture<Boolean> move(NPC npc, Point3D point);
|
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.
|
* 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.model.world.npc.event.NPCDieEvent;
|
||||||
import com.l2jserver.service.AbstractService;
|
import com.l2jserver.service.AbstractService;
|
||||||
import com.l2jserver.service.AbstractService.Depends;
|
import com.l2jserver.service.AbstractService.Depends;
|
||||||
|
import com.l2jserver.service.ServiceStartException;
|
||||||
import com.l2jserver.service.core.threading.AsyncFuture;
|
import com.l2jserver.service.core.threading.AsyncFuture;
|
||||||
import com.l2jserver.service.core.threading.ThreadService;
|
import com.l2jserver.service.core.threading.ThreadService;
|
||||||
import com.l2jserver.service.database.DatabaseService;
|
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
|
private Map<Class<? extends NPCController>, NPCController> controllers = CollectionFactory
|
||||||
.newMap();
|
.newMap();
|
||||||
|
private Collection<NPC> npcs;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public NPCServiceImpl(SpawnService spawnService,
|
public NPCServiceImpl(SpawnService spawnService,
|
||||||
@@ -118,6 +120,20 @@ public class NPCServiceImpl extends AbstractService implements NPCService {
|
|||||||
this.injector = injector;
|
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
|
@Override
|
||||||
public void action(NPC npc, L2Character character, CharacterAction action)
|
public void action(NPC npc, L2Character character, CharacterAction action)
|
||||||
throws ActionServiceException, CannotSetTargetServiceException {
|
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
|
@Override
|
||||||
public void attack(NPC npc, Lineage2Connection conn, L2Character attacker)
|
public void attack(NPC npc, Lineage2Connection conn, L2Character attacker)
|
||||||
throws NotAttackableNPCServiceException {
|
throws NotAttackableNPCServiceException {
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import javax.xml.bind.annotation.adapters.XmlAdapter;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.l2jserver.model.id.template.CharacterTemplateID;
|
import com.l2jserver.model.id.template.CharacterTemplateID;
|
||||||
import com.l2jserver.model.id.template.provider.CharacterTemplateIDProvider;
|
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}
|
* 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.SkillMetadata;
|
||||||
import com.l2jserver.model.template.NPCTemplate.TalkMetadata;
|
import com.l2jserver.model.template.NPCTemplate.TalkMetadata;
|
||||||
import com.l2jserver.model.template.TeleportationTemplate.TeleportRestriction;
|
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.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.BaseNPCController;
|
||||||
import com.l2jserver.model.world.npc.controller.MonsterController;
|
import com.l2jserver.model.world.npc.controller.MonsterController;
|
||||||
import com.l2jserver.model.world.npc.controller.NPCController;
|
import com.l2jserver.model.world.npc.controller.NPCController;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.l2jserver.tool;
|
package com.l2jserver.tool;
|
||||||
|
|
||||||
import com.l2jserver.model.world.character.CharacterClass;
|
import com.l2jserver.model.template.character.CharacterClass;
|
||||||
|
|
||||||
public class CharacterSQLEnumGenerator {
|
public class CharacterSQLEnumGenerator {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
Reference in New Issue
Block a user