{
+ /**
+ * Creates a new instance of this template
+ *
+ * @param id
+ * the template id
+ * @param race
+ * the npc race
+ */
+ protected WarehouseNPCTemplate(NPCTemplateID id) {
+ super(id);
+ }
+}
diff --git a/src/main/java/com/l2jserver/model/world/L2Character.java b/src/main/java/com/l2jserver/model/world/L2Character.java
index 825b011f7..1922717b0 100644
--- a/src/main/java/com/l2jserver/model/world/L2Character.java
+++ b/src/main/java/com/l2jserver/model/world/L2Character.java
@@ -22,9 +22,9 @@ import com.l2jserver.model.id.AccountID;
import com.l2jserver.model.id.object.CharacterID;
import com.l2jserver.model.id.object.ClanID;
import com.l2jserver.model.id.object.PetID;
+import com.l2jserver.model.template.CharacterTemplate;
+import com.l2jserver.model.world.actor.ActorAttributes;
import com.l2jserver.model.world.character.CharacterAppearance;
-import com.l2jserver.model.world.character.CharacterAttributes;
-import com.l2jserver.model.world.character.CharacterBaseAttributes;
import com.l2jserver.model.world.character.CharacterCalculatedAttributes;
import com.l2jserver.model.world.character.CharacterClass;
import com.l2jserver.model.world.character.CharacterFriendList;
@@ -49,6 +49,33 @@ public class L2Character extends Player {
* The pet id
*/
private PetID petID;
+
+ /**
+ * This character's inventory
+ */
+ private final CharacterInventory inventory = new CharacterInventory(this);
+ /**
+ * The appearance of this character
+ */
+ private final CharacterAppearance appearance = new CharacterAppearance(this);
+ /**
+ * The base attributes of this character
+ */
+ private final CharacterTemplate.ActorBaseAttributes baseAttributes;
+ /**
+ * The attributes of this character
+ */
+ private final ActorAttributes attributes;
+ /**
+ * The list of friend of this character
+ */
+ private final CharacterFriendList friendList = new CharacterFriendList(this);
+ /**
+ * The shortcut container of this character
+ */
+ private final CharacterShortcutContainer shortcuts = new CharacterShortcutContainer(
+ this);
+
/**
* The character name
*/
@@ -65,32 +92,27 @@ public class L2Character extends Player {
* Date of character's last access
*/
private Date lastAccess;
+ /**
+ * The character walk mode.
+ *
+ * This field is not persisted.
+ */
+ private CharacterMoveType moveType = CharacterMoveType.WALK;
/**
- * This character's inventory
+ * The character walking mode
+ *
+ * @author Rogiel
*/
- private final CharacterInventory inventory = new CharacterInventory(this);
- /**
- * The appearance of this character
- */
- private final CharacterAppearance appearance = new CharacterAppearance(this);
- /**
- * The base attributes of this character
- */
- private final CharacterBaseAttributes baseAttributes;
- /**
- * The attributes of this character
- */
- private final CharacterAttributes attributes;
- /**
- * The list of friend of this character
- */
- private final CharacterFriendList friendList = new CharacterFriendList(this);
- /**
- * The shortcut container of this character
- */
- private final CharacterShortcutContainer shortcuts = new CharacterShortcutContainer(
- this);
+ public enum CharacterMoveType {
+ RUN(0x01), WALK(0x00);
+
+ public final int id;
+
+ CharacterMoveType(int id) {
+ this.id = id;
+ }
+ }
/**
* Creates a new instance
@@ -98,7 +120,7 @@ public class L2Character extends Player {
* @param baseAttributes
* the base attribute for this character
*/
- public L2Character(CharacterBaseAttributes baseAttributes) {
+ public L2Character(CharacterTemplate.ActorBaseAttributes baseAttributes) {
this.baseAttributes = baseAttributes;
this.attributes = new CharacterCalculatedAttributes(this);
}
@@ -226,6 +248,21 @@ public class L2Character extends Player {
this.lastAccess = lastAccess;
}
+ /**
+ * @return the moveType
+ */
+ public CharacterMoveType getMoveType() {
+ return moveType;
+ }
+
+ /**
+ * @param moveType
+ * the moveType to set
+ */
+ public void setMoveType(CharacterMoveType moveType) {
+ this.moveType = moveType;
+ }
+
/**
* @return the inventory
*/
@@ -243,14 +280,14 @@ public class L2Character extends Player {
/**
* @return the base attributes
*/
- public CharacterBaseAttributes getBaseAttributes() {
+ public CharacterTemplate.ActorBaseAttributes getBaseAttributes() {
return baseAttributes;
}
/**
* @return the attributes
*/
- public CharacterAttributes getAttributes() {
+ public ActorAttributes getAttributes() {
return attributes;
}
diff --git a/src/main/java/com/l2jserver/model/world/NPC.java b/src/main/java/com/l2jserver/model/world/NPC.java
new file mode 100644
index 000000000..e78a12dec
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/NPC.java
@@ -0,0 +1,25 @@
+/*
+ * This file is part of l2jserver .
+ *
+ * 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 .
+ */
+package com.l2jserver.model.world;
+
+/**
+ * @author Rogiel
+ *
+ */
+public class NPC extends AbstractActor {
+
+}
diff --git a/src/main/java/com/l2jserver/model/world/character/CharacterAttributes.java b/src/main/java/com/l2jserver/model/world/actor/ActorAttributes.java
similarity index 87%
rename from src/main/java/com/l2jserver/model/world/character/CharacterAttributes.java
rename to src/main/java/com/l2jserver/model/world/actor/ActorAttributes.java
index 2e6341402..9827158f2 100644
--- a/src/main/java/com/l2jserver/model/world/character/CharacterAttributes.java
+++ b/src/main/java/com/l2jserver/model/world/actor/ActorAttributes.java
@@ -14,19 +14,19 @@
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see .
*/
-package com.l2jserver.model.world.character;
+package com.l2jserver.model.world.actor;
-import com.l2jserver.model.template.CharacterTemplate;
+import com.l2jserver.model.template.ActorTemplate;
/**
* Defines attributes of the character. Implementations can use an static value
- * (i.e. from {@link CharacterTemplate}) or can use an calculator to define
- * values, composed from many attributes objects.
+ * (i.e. from {@link ActorTemplate}) or can use an calculator to define values,
+ * composed from many attributes objects.
*
* @author Rogiel
*
*/
-public interface CharacterAttributes {
+public interface ActorAttributes {
/**
* @return the intelligence
*/
@@ -105,7 +105,7 @@ public interface CharacterAttributes {
/**
* @return the movement speed
*/
- public int getMoveSpeed();
+ public double getMoveSpeed();
/**
* @return the maxWeigth
diff --git a/src/main/java/com/l2jserver/model/world/character/CharacterBaseAttributes.java b/src/main/java/com/l2jserver/model/world/character/CharacterBaseAttributes.java
deleted file mode 100644
index 50eb22857..000000000
--- a/src/main/java/com/l2jserver/model/world/character/CharacterBaseAttributes.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- * This file is part of l2jserver .
- *
- * 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 .
- */
-package com.l2jserver.model.world.character;
-
-/**
- * Defines the attributes of an character
- *
- * @author Rogiel
- */
-public class CharacterBaseAttributes implements CharacterAttributes {
- /**
- * The character intelligence
- */
- private final int intelligence;
- /**
- * The character strength
- */
- private final int strength;
- /**
- * The character concentration
- */
- private final int concentration;
- /**
- * The character mentality power
- */
- private final int mentality;
- /**
- * The character dexterity
- */
- private final int dexterity;
- /**
- * The character witness
- */
- private final int witness;
-
- /**
- * The default physical attack
- */
- private final int physicalAttack;
- /**
- * The default magical attack
- */
- private final int magicalAttack;
- /**
- * The physical defense
- */
- private final int physicalDefense;
- /**
- * The magical defense
- */
- private final int magicalDefense;
-
- /**
- * The physical attack speed
- */
- private final int attackSpeed;
- /**
- * The "magical attack speed" (aka cast speed)
- */
- private final int castSpeed;
-
- /**
- * The character accuracy
- */
- private final int accuracy;
- /**
- * Chance of issuing an critical attack
- */
- private final int criticalChance;
- /**
- * Chance of avoiding an attack
- */
- private final int evasionChance;
- /**
- * The character's movement speed
- */
- private final int moveSpeed;
- /**
- * The maximum weigth in items to be carried in the inventory
- */
- private final int maxWeigth;
- /**
- * If this character can craft
- */
- private final boolean craft;
-
- /**
- * Creates a new instance
- *
- * @param intelligence
- * the intelligence
- * @param strength
- * the strength
- * @param concentration
- * the concentration
- * @param mentality
- * the mentality
- * @param dexterity
- * the dexterity
- * @param witness
- * the witness
- * @param physicalAttack
- * the physical attack
- * @param magicalAttack
- * the magical attack
- * @param physicalDefense
- * the physical defense
- * @param magicalDefense
- * the magical defense
- * @param attackSpeed
- * the attack speed
- * @param castSpeed
- * the cast speed
- * @param accuracy
- * the accuracy
- * @param criticalChance
- * the critical chance
- * @param evasionChance
- * the evasion chance
- * @param maxWeigth
- * the maximum weight in inventory
- * @param moveSpeed
- * the character movement speed
- * @param craft
- * if the character can craft items
- */
- public CharacterBaseAttributes(int intelligence, int strength,
- int concentration, int mentality, int dextry, int witness,
- int physicalAttack, int magicalAttack, int physicalDefense,
- int magicalDefense, int attackSpeed, int castSpeed, int accuracy,
- int criticalChance, int evasionChance, int moveSpeed,
- int maxWeigth, boolean craft) {
- this.intelligence = intelligence;
- this.strength = strength;
- this.concentration = concentration;
- this.mentality = mentality;
- this.dexterity = dextry;
- this.witness = witness;
- this.physicalAttack = physicalAttack;
- this.magicalAttack = magicalAttack;
- this.physicalDefense = physicalDefense;
- this.magicalDefense = magicalDefense;
- this.attackSpeed = attackSpeed;
- this.castSpeed = castSpeed;
- this.accuracy = accuracy;
- this.criticalChance = criticalChance;
- this.evasionChance = evasionChance;
- this.moveSpeed = moveSpeed;
- this.maxWeigth = maxWeigth;
- this.craft = craft;
- }
-
- /**
- * @return the intelligence
- */
- @Override
- public int getIntelligence() {
- return intelligence;
- }
-
- /**
- * @return the strength
- */
- @Override
- public int getStrength() {
- return strength;
- }
-
- /**
- * @return the concentration
- */
- @Override
- public int getConcentration() {
- return concentration;
- }
-
- /**
- * @return the mentality
- */
- @Override
- public int getMentality() {
- return mentality;
- }
-
- /**
- * @return the dexterity
- */
- @Override
- public int getDexterity() {
- return dexterity;
- }
-
- /**
- * @return the witness
- */
- @Override
- public int getWitness() {
- return witness;
- }
-
- /**
- * @return the physicalAttack
- */
- @Override
- public int getPhysicalAttack() {
- return physicalAttack;
- }
-
- /**
- * @return the magicalAttack
- */
- @Override
- public int getMagicalAttack() {
- return magicalAttack;
- }
-
- /**
- * @return the physicalDefense
- */
- @Override
- public int getPhysicalDefense() {
- return physicalDefense;
- }
-
- /**
- * @return the magicalDefense
- */
- @Override
- public int getMagicalDefense() {
- return magicalDefense;
- }
-
- /**
- * @return the attackSpeed
- */
- @Override
- public int getAttackSpeed() {
- return attackSpeed;
- }
-
- /**
- * @return the castSpeed
- */
- @Override
- public int getCastSpeed() {
- return castSpeed;
- }
-
- /**
- * @return the accuracy
- */
- @Override
- public int getAccuracy() {
- return accuracy;
- }
-
- /**
- * @return the criticalChance
- */
- @Override
- public int getCriticalChance() {
- return criticalChance;
- }
-
- /**
- * @return the evasionChance
- */
- @Override
- public int getEvasionChance() {
- return evasionChance;
- }
-
- /**
- * @return the moveSpeed
- */
- @Override
- public int getMoveSpeed() {
- return moveSpeed;
- }
-
- /**
- * @return the maxWeigth
- */
- @Override
- public int getMaxWeigth() {
- return maxWeigth;
- }
-
- /**
- * @return the craft
- */
- @Override
- public boolean canCraft() {
- return craft;
- }
-}
diff --git a/src/main/java/com/l2jserver/model/world/character/CharacterCalculatedAttributes.java b/src/main/java/com/l2jserver/model/world/character/CharacterCalculatedAttributes.java
index 3114f929c..d405f4255 100644
--- a/src/main/java/com/l2jserver/model/world/character/CharacterCalculatedAttributes.java
+++ b/src/main/java/com/l2jserver/model/world/character/CharacterCalculatedAttributes.java
@@ -18,15 +18,16 @@ package com.l2jserver.model.world.character;
import com.l2jserver.model.template.CharacterTemplate;
import com.l2jserver.model.world.L2Character;
+import com.l2jserver.model.world.actor.ActorAttributes;
/**
- * This {@link CharacterAttributes} implementation calculates the real
+ * This {@link ActorAttributes} implementation calculates the real
* character attributes based on it's {@link CharacterTemplate} and active
* buffs.
*
* @author Rogiel
*/
-public class CharacterCalculatedAttributes implements CharacterAttributes {
+public class CharacterCalculatedAttributes implements ActorAttributes {
/**
* The character
*/
@@ -34,7 +35,7 @@ public class CharacterCalculatedAttributes implements CharacterAttributes {
/**
* The base attributes (from {@link CharacterTemplate})
*/
- private final CharacterAttributes baseAttributes;
+ private final ActorAttributes baseAttributes;
public CharacterCalculatedAttributes(L2Character character) {
this.character = character;
@@ -117,7 +118,7 @@ public class CharacterCalculatedAttributes implements CharacterAttributes {
}
@Override
- public int getMoveSpeed() {
+ public double getMoveSpeed() {
return baseAttributes.getMoveSpeed();
}
diff --git a/src/main/java/com/l2jserver/model/world/character/event/CharacterStopMoveEvent.java b/src/main/java/com/l2jserver/model/world/character/event/CharacterStopMoveEvent.java
new file mode 100644
index 000000000..350bb84d7
--- /dev/null
+++ b/src/main/java/com/l2jserver/model/world/character/event/CharacterStopMoveEvent.java
@@ -0,0 +1,85 @@
+/*
+ * This file is part of l2jserver .
+ *
+ * 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 .
+ */
+package com.l2jserver.model.world.character.event;
+
+import com.l2jserver.model.world.L2Character;
+import com.l2jserver.model.world.Player;
+import com.l2jserver.model.world.WorldObject;
+import com.l2jserver.model.world.capability.Actor;
+import com.l2jserver.model.world.capability.Listenable;
+import com.l2jserver.util.dimensional.Point;
+
+/**
+ * Event triggered once a character moves
+ *
+ * @author Rogiel
+ */
+public class CharacterStopMoveEvent implements CharacterEvent {
+ /**
+ * The character that is logging in
+ */
+ private final L2Character character;
+ /**
+ * The new point of the character
+ */
+ private final Point point;
+
+ /**
+ * Creates a new instance
+ *
+ * @param character
+ * the character
+ * @param point
+ * the character point
+ */
+ public CharacterStopMoveEvent(L2Character character, Point point) {
+ this.character = character;
+ this.point = point;
+ }
+
+ /**
+ * @return the point
+ */
+ public Point getPoint() {
+ return point;
+ }
+
+ @Override
+ public Player getPlayer() {
+ return character;
+ }
+
+ @Override
+ public Actor getActor() {
+ return character;
+ }
+
+ @Override
+ public WorldObject getObject() {
+ return character;
+ }
+
+ @Override
+ public L2Character getCharacter() {
+ return character;
+ }
+
+ @Override
+ public Listenable, ?>[] getDispatchableObjects() {
+ return new Listenable, ?>[] { character };
+ }
+}
diff --git a/src/main/java/com/l2jserver/service/ServiceModule.java b/src/main/java/com/l2jserver/service/ServiceModule.java
index 8c361c512..aba759b20 100644
--- a/src/main/java/com/l2jserver/service/ServiceModule.java
+++ b/src/main/java/com/l2jserver/service/ServiceModule.java
@@ -19,8 +19,6 @@ package com.l2jserver.service;
import com.google.inject.AbstractModule;
import com.google.inject.Module;
import com.google.inject.Scopes;
-import com.l2jserver.service.blowfish.BlowfishKeygenService;
-import com.l2jserver.service.blowfish.SecureBlowfishKeygenService;
import com.l2jserver.service.cache.CacheService;
import com.l2jserver.service.cache.EhCacheService;
import com.l2jserver.service.configuration.ConfigurationService;
@@ -45,6 +43,8 @@ import com.l2jserver.service.logging.Log4JLoggingService;
import com.l2jserver.service.logging.LoggingService;
import com.l2jserver.service.network.NettyNetworkService;
import com.l2jserver.service.network.NetworkService;
+import com.l2jserver.service.network.keygen.BlowfishKeygenService;
+import com.l2jserver.service.network.keygen.SecureBlowfishKeygenService;
/**
* Google Guice {@link Module} for services
diff --git a/src/main/java/com/l2jserver/service/game/CharacterService.java b/src/main/java/com/l2jserver/service/game/CharacterService.java
index 4aec23bac..15c150dbd 100644
--- a/src/main/java/com/l2jserver/service/game/CharacterService.java
+++ b/src/main/java/com/l2jserver/service/game/CharacterService.java
@@ -18,6 +18,7 @@ package com.l2jserver.service.game;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.service.Service;
+import com.l2jserver.util.dimensional.Coordinate;
/**
* This service manages {@link L2Character} instances
@@ -40,4 +41,30 @@ public interface CharacterService extends Service {
* the character
*/
void leaveWorld(L2Character character);
+
+ /**
+ * Moves the given character to coordinate
+ *
+ * @param character
+ * the character
+ * @param coordinate
+ * the coordinate
+ */
+ void move(L2Character character, Coordinate coordinate);
+
+ /**
+ * Set the character to walking mode
+ *
+ * @param character
+ * the character
+ */
+ void walk(L2Character character);
+
+ /**
+ * Set the character to run mode
+ *
+ * @param character
+ * the character
+ */
+ void run(L2Character character);
}
diff --git a/src/main/java/com/l2jserver/service/game/CharacterServiceImpl.java b/src/main/java/com/l2jserver/service/game/CharacterServiceImpl.java
index 930bbd42d..f9922531f 100644
--- a/src/main/java/com/l2jserver/service/game/CharacterServiceImpl.java
+++ b/src/main/java/com/l2jserver/service/game/CharacterServiceImpl.java
@@ -20,30 +20,36 @@ import com.google.inject.Inject;
import com.l2jserver.game.net.Lineage2Connection;
import com.l2jserver.game.net.packet.client.CharacterChatMessagePacket.MessageDestination;
import com.l2jserver.game.net.packet.server.ActorChatMessagePacket;
+import com.l2jserver.game.net.packet.server.ActorMovementPacket;
+import com.l2jserver.game.net.packet.server.CharacterMovementTypePacket;
import com.l2jserver.game.net.packet.server.GameGuardQueryPacket;
import com.l2jserver.game.net.packet.server.InventoryPacket;
import com.l2jserver.game.net.packet.server.UserInformationPacket;
import com.l2jserver.model.id.object.CharacterID;
import com.l2jserver.model.world.L2Character;
+import com.l2jserver.model.world.L2Character.CharacterMoveType;
import com.l2jserver.model.world.character.event.CharacterEnterWorldEvent;
import com.l2jserver.model.world.character.event.CharacterEvent;
import com.l2jserver.model.world.character.event.CharacterLeaveWorldEvent;
import com.l2jserver.model.world.character.event.CharacterListener;
import com.l2jserver.service.AbstractService;
import com.l2jserver.service.AbstractService.Depends;
+import com.l2jserver.service.game.ai.AIService;
import com.l2jserver.service.game.chat.ChatService;
import com.l2jserver.service.game.chat.channel.ChatChannel;
import com.l2jserver.service.game.chat.channel.ChatChannelListener;
import com.l2jserver.service.game.world.WorldService;
import com.l2jserver.service.game.world.event.WorldEventDispatcher;
import com.l2jserver.service.network.NetworkService;
+import com.l2jserver.util.dimensional.Coordinate;
/**
* Default implementation for {@link CharacterService}.
*
* @author Rogiel
*/
-@Depends({ WorldService.class, ChatService.class, NetworkService.class })
+@Depends({ WorldService.class, ChatService.class, NetworkService.class,
+ SpawnService.class, AIService.class })
public class CharacterServiceImpl extends AbstractService implements
CharacterService {
/**
@@ -67,15 +73,25 @@ public class CharacterServiceImpl extends AbstractService implements
*/
private final SpawnService spawnService;
+ // /**
+ // * The {@link AIService}
+ // */
+ // private final AIService aiService;
+
@Inject
public CharacterServiceImpl(WorldService worldService,
WorldEventDispatcher eventDispatcher, ChatService chatService,
- NetworkService networkService, SpawnService spawnService) {
+ NetworkService networkService, SpawnService spawnService/*
+ * ,
+ * AIService
+ * aiService
+ */) {
this.worldService = worldService;
this.eventDispatcher = eventDispatcher;
this.chatService = chatService;
this.networkService = networkService;
this.spawnService = spawnService;
+ // this.aiService = aiService;
}
@Override
@@ -123,6 +139,8 @@ public class CharacterServiceImpl extends AbstractService implements
conn.write(new GameGuardQueryPacket());
conn.write(new InventoryPacket(character.getInventory()));
+ run(character);
+
// dispatch enter world event
eventDispatcher.dispatch(new CharacterEnterWorldEvent(character));
@@ -130,10 +148,44 @@ public class CharacterServiceImpl extends AbstractService implements
spawnService.spawn(character);
}
+ @Override
+ public void move(L2Character character, Coordinate coordinate) {
+ final CharacterID id = character.getID();
+ final Lineage2Connection conn = networkService.discover(id);
+ // for now, let's just write the packet
+ // aiService.walk(character, coordinate);
+
+ final Coordinate source = character.getPosition();
+ character.setPosition(coordinate);
+ conn.write(new ActorMovementPacket(character, source));
+ // we don't dispatch events here, they will be dispatched by
+ // CharacterValidatePositionPacket packets at fixed time intervals.
+ }
+
@Override
public void leaveWorld(L2Character character) {
if (!worldService.remove(character))
return;
eventDispatcher.dispatch(new CharacterLeaveWorldEvent(character));
}
+
+ @Override
+ public void walk(L2Character character) {
+ final CharacterID id = character.getID();
+ final Lineage2Connection conn = networkService.discover(id);
+ if (character.getMoveType() == CharacterMoveType.RUN) {
+ character.setMoveType(CharacterMoveType.WALK);
+ conn.broadcast(new CharacterMovementTypePacket(character));
+ }
+ }
+
+ @Override
+ public void run(L2Character character) {
+ final CharacterID id = character.getID();
+ final Lineage2Connection conn = networkService.discover(id);
+ if (character.getMoveType() == CharacterMoveType.WALK) {
+ character.setMoveType(CharacterMoveType.RUN);
+ conn.broadcast(new CharacterMovementTypePacket(character));
+ }
+ }
}
diff --git a/src/main/java/com/l2jserver/service/game/ai/AIScript.java b/src/main/java/com/l2jserver/service/game/ai/AIScript.java
new file mode 100644
index 000000000..ff7bca58a
--- /dev/null
+++ b/src/main/java/com/l2jserver/service/game/ai/AIScript.java
@@ -0,0 +1,54 @@
+/*
+ * This file is part of l2jserver .
+ *
+ * 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 .
+ */
+package com.l2jserver.service.game.ai;
+
+/**
+ * The AI Script interface. Scripts are not continuous executed. The service
+ * will call multiple times {@link #run(double)}. Each time will represent a
+ * tick and a bit of the job should be done in there.
+ *
+ * @author Rogiel
+ */
+public interface AIScript {
+ /**
+ * Start the AIScript. Will register required listeners and start tasks.
+ */
+ void start();
+
+ /**
+ * Executes an AI operation.
+ *
+ * Please note that time will almost never reach 1 second
+ * its usage is to determine how much time has been spent idle and to deal
+ * with it.
+ *
+ * Instead of having a fixed "tick" time this method will be called at a
+ * random interval. This will make possible to use load balancers that can
+ * slow the "tick" once the server is in high load and reduce when the load
+ * is low.
+ *
+ * @param time
+ * the time elapsed since last call. In seconds
+ */
+ void run(double time);
+
+ /**
+ * Stop the AIScript. Will unregister the listeners that were registered in
+ * {@link #start()} and during life time.
+ */
+ void stop();
+}
diff --git a/src/main/java/com/l2jserver/service/game/ai/AIService.java b/src/main/java/com/l2jserver/service/game/ai/AIService.java
new file mode 100644
index 000000000..c10902153
--- /dev/null
+++ b/src/main/java/com/l2jserver/service/game/ai/AIService.java
@@ -0,0 +1,38 @@
+/*
+ * This file is part of l2jserver .
+ *
+ * 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 .
+ */
+package com.l2jserver.service.game.ai;
+
+import com.l2jserver.model.world.capability.Actor;
+import com.l2jserver.service.Service;
+import com.l2jserver.util.dimensional.Coordinate;
+
+/**
+ * This service executes AI operations
+ *
+ * @author Rogiel
+ */
+public interface AIService extends Service {
+ /**
+ * Walks the given actor to coordinate
+ *
+ * @param actor
+ * the actor
+ * @param coordinate
+ * the coordinate
+ */
+ void walk(Actor actor, Coordinate coordinate);
+}
diff --git a/src/main/java/com/l2jserver/service/game/ai/AIServiceImpl.java b/src/main/java/com/l2jserver/service/game/ai/AIServiceImpl.java
new file mode 100644
index 000000000..bde96de27
--- /dev/null
+++ b/src/main/java/com/l2jserver/service/game/ai/AIServiceImpl.java
@@ -0,0 +1,82 @@
+/*
+ * This file is part of l2jserver .
+ *
+ * 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 .
+ */
+package com.l2jserver.service.game.ai;
+
+import com.google.inject.Inject;
+import com.l2jserver.model.world.capability.Actor;
+import com.l2jserver.service.AbstractService;
+import com.l2jserver.service.AbstractService.Depends;
+import com.l2jserver.service.ServiceStartException;
+import com.l2jserver.service.ServiceStopException;
+import com.l2jserver.service.game.CharacterService;
+import com.l2jserver.service.game.template.TemplateService;
+import com.l2jserver.service.game.world.WorldService;
+import com.l2jserver.service.game.world.event.WorldEventDispatcher;
+import com.l2jserver.service.network.NetworkService;
+import com.l2jserver.service.threading.ThreadService;
+import com.l2jserver.util.dimensional.Coordinate;
+
+/**
+ * Default implementation for {@link CharacterService}.
+ *
+ * @author Rogiel
+ */
+@Depends({ WorldService.class, TemplateService.class, ThreadService.class,
+ NetworkService.class })
+public class AIServiceImpl extends AbstractService implements AIService {
+ /**
+ * The {@link WorldService}
+ */
+ private final WorldService worldService;
+ /**
+ * The {@link WorldService} event dispatcher
+ */
+ private final WorldEventDispatcher eventDispatcher;
+ /**
+ * The {@link ThreadService}
+ */
+ private final ThreadService threadService;
+ /**
+ * The {@link NetworkService}
+ */
+ private final NetworkService networkService;
+
+ @Inject
+ public AIServiceImpl(WorldService worldService,
+ WorldEventDispatcher eventDispatcher, ThreadService threadService,
+ NetworkService networkService) {
+ this.worldService = worldService;
+ this.eventDispatcher = eventDispatcher;
+ this.threadService = threadService;
+ this.networkService = networkService;
+ }
+
+ @Override
+ protected void doStart() throws ServiceStartException {
+
+ }
+
+ @Override
+ public void walk(Actor actor, Coordinate coordinate) {
+
+ }
+
+ @Override
+ protected void doStop() throws ServiceStopException {
+
+ }
+}
diff --git a/src/main/java/com/l2jserver/service/game/ai/script/AttackAIScript.java b/src/main/java/com/l2jserver/service/game/ai/script/AttackAIScript.java
new file mode 100644
index 000000000..9527572a0
--- /dev/null
+++ b/src/main/java/com/l2jserver/service/game/ai/script/AttackAIScript.java
@@ -0,0 +1,27 @@
+/*
+ * This file is part of l2jserver .
+ *
+ * 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 .
+ */
+package com.l2jserver.service.game.ai.script;
+
+import com.l2jserver.model.world.capability.Attackable;
+import com.l2jserver.service.game.ai.AIScript;
+
+/**
+ * @author Rogiel.
+ *
+ * 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 .
+ */
+package com.l2jserver.service.game.ai.script;
+
+import com.l2jserver.model.world.capability.Positionable;
+
+/**
+ * This AI is used to receive notifications once another object aproaches.
+ *
+ * @author Rogiel
+ */
+public interface ProximityAIScript {
+ /**
+ * Invoked once another object moves in proximity or the object suddenly
+ * appears.
+ *
+ * @param object
+ * the object
+ */
+ void approach(Positionable object);
+}
diff --git a/src/main/java/com/l2jserver/service/game/ai/script/WalkingAIScript.java b/src/main/java/com/l2jserver/service/game/ai/script/WalkingAIScript.java
new file mode 100644
index 000000000..a4bb57f6e
--- /dev/null
+++ b/src/main/java/com/l2jserver/service/game/ai/script/WalkingAIScript.java
@@ -0,0 +1,30 @@
+/*
+ * This file is part of l2jserver .
+ *
+ * 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 .
+ */
+package com.l2jserver.service.game.ai.script;
+
+import com.l2jserver.model.world.capability.Positionable;
+import com.l2jserver.service.game.ai.AIScript;
+import com.l2jserver.util.dimensional.Coordinate;
+
+/**
+ * @author Rogiel.
+ *
+ * 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 .
+ */
+package com.l2jserver.service.game.effect;
+
+import com.l2jserver.model.world.L2Character;
+import com.l2jserver.service.Service;
+
+/**
+ * The effect service will handle
+ *
+ * @author Rogiel
+ */
+public interface EffectService extends Service {
+ /**
+ * Adds a new effect to an given character. The effect will last
+ * duration milliseconds.
+ *
+ * @param character
+ * the character
+ * @param duration
+ * the effect duration in milliseconds
+ */
+ void addEffect(L2Character character, long duration);
+}
diff --git a/src/main/java/com/l2jserver/service/game/world/WorldService.java b/src/main/java/com/l2jserver/service/game/world/WorldService.java
index c5b2506df..94f6a7458 100644
--- a/src/main/java/com/l2jserver/service/game/world/WorldService.java
+++ b/src/main/java/com/l2jserver/service/game/world/WorldService.java
@@ -19,6 +19,7 @@ package com.l2jserver.service.game.world;
import java.util.Iterator;
import java.util.List;
+import com.l2jserver.model.id.ObjectID;
import com.l2jserver.model.world.WorldObject;
import com.l2jserver.service.Service;
import com.l2jserver.service.game.world.event.WorldEventDispatcher;
@@ -55,6 +56,19 @@ public interface WorldService extends Service, Iterable {
*/
boolean contains(WorldObject object);
+ /**
+ * Locates the object with the given id
+ *
+ * @param
+ * the object type
+ * @param id
+ * the object id
+ * @return the found object
+ * @throws ClassCastException
+ * if object found is not an instance of T
+ */
+ T find(ObjectID id) throws ClassCastException;
+
/**
* Get the event dispatcher
*
diff --git a/src/main/java/com/l2jserver/service/game/world/WorldServiceImpl.java b/src/main/java/com/l2jserver/service/game/world/WorldServiceImpl.java
index 197520d34..e4208ae47 100644
--- a/src/main/java/com/l2jserver/service/game/world/WorldServiceImpl.java
+++ b/src/main/java/com/l2jserver/service/game/world/WorldServiceImpl.java
@@ -24,6 +24,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
+import com.l2jserver.model.id.ObjectID;
import com.l2jserver.model.world.WorldObject;
import com.l2jserver.service.AbstractService;
import com.l2jserver.service.AbstractService.Depends;
@@ -35,6 +36,7 @@ import com.l2jserver.service.game.template.TemplateService;
import com.l2jserver.service.game.world.event.WorldEventDispatcher;
import com.l2jserver.service.game.world.filter.FilterIterator;
import com.l2jserver.service.game.world.filter.WorldObjectFilter;
+import com.l2jserver.service.game.world.filter.impl.IDFilter;
import com.l2jserver.service.game.world.filter.impl.InstanceFilter;
import com.l2jserver.service.logging.LoggingService;
import com.l2jserver.util.factory.CollectionFactory;
@@ -90,6 +92,17 @@ public class WorldServiceImpl extends AbstractService implements WorldService {
return objects.contains(object);
}
+ @Override
+ @SuppressWarnings("unchecked")
+ public T find(ObjectID id) {
+ final IDFilter filter = new IDFilter(id);
+ for (final WorldObject object : objects) {
+ if (filter.accept(object))
+ return (T) object;
+ }
+ return null;
+ }
+
@Override
public WorldEventDispatcher getEventDispatcher() {
return dispatcher;
diff --git a/src/main/java/com/l2jserver/service/game/world/event/WorldEventDispatcher.java b/src/main/java/com/l2jserver/service/game/world/event/WorldEventDispatcher.java
index 4811fb4e6..aa45ec07c 100644
--- a/src/main/java/com/l2jserver/service/game/world/event/WorldEventDispatcher.java
+++ b/src/main/java/com/l2jserver/service/game/world/event/WorldEventDispatcher.java
@@ -36,6 +36,19 @@ public interface WorldEventDispatcher {
*/
void dispatch(WorldEvent event);
+ /**
+ * Adds a new global listener
+ *
+ * @param
+ * the event type
+ * @param
+ * the listener type
+ * @param listener
+ * the listener
+ */
+ void addListener(
+ WorldListener listener);
+
/**
* Adds a new listener to object
*
diff --git a/src/main/java/com/l2jserver/service/game/world/event/WorldEventDispatcherImpl.java b/src/main/java/com/l2jserver/service/game/world/event/WorldEventDispatcherImpl.java
index 938f1f699..161984e5b 100644
--- a/src/main/java/com/l2jserver/service/game/world/event/WorldEventDispatcherImpl.java
+++ b/src/main/java/com/l2jserver/service/game/world/event/WorldEventDispatcherImpl.java
@@ -86,11 +86,19 @@ public class WorldEventDispatcherImpl implements WorldEventDispatcher {
}
}
+ @Override
+ public void addListener(WorldListener listener) {
+ log.debug("Adding new listener global {}", listener);
+ listeners.add(new ListenerIDPair(null, listener));
+ }
+
@Override
public void addListener(
Listenable object, WorldListener listener) {
- log.debug("Adding new listener {} to {}", listener, object.getID());
- listeners.add(new ListenerIDPair(object.getID(), listener));
+ log.debug("Adding new listener {} to {}", listener,
+ (object != null ? object.getID() : null));
+ listeners.add(new ListenerIDPair((object != null ? object.getID()
+ : null), listener));
}
@Override
@@ -125,6 +133,8 @@ public class WorldEventDispatcherImpl implements WorldEventDispatcher {
}
public boolean testDispatch(ObjectID> id) {
+ if (this.ID == null) // global listeners
+ return true;
return id.equals(this.ID);
}
diff --git a/src/main/java/com/l2jserver/service/game/world/filter/impl/IDFilter.java b/src/main/java/com/l2jserver/service/game/world/filter/impl/IDFilter.java
index c5a805ff5..375c82f1d 100644
--- a/src/main/java/com/l2jserver/service/game/world/filter/impl/IDFilter.java
+++ b/src/main/java/com/l2jserver/service/game/world/filter/impl/IDFilter.java
@@ -17,7 +17,7 @@
package com.l2jserver.service.game.world.filter.impl;
import com.l2jserver.model.id.ObjectID;
-import com.l2jserver.model.world.capability.Positionable;
+import com.l2jserver.model.world.WorldObject;
import com.l2jserver.service.game.world.filter.WorldObjectFilter;
/**
@@ -25,7 +25,7 @@ import com.l2jserver.service.game.world.filter.WorldObjectFilter;
*
* @author Rogiel
*/
-public class IDFilter implements WorldObjectFilter {
+public class IDFilter implements WorldObjectFilter {
/**
* The object id
*/
@@ -42,7 +42,7 @@ public class IDFilter implements WorldObjectFilter {
}
@Override
- public boolean accept(Positionable other) {
+ public boolean accept(WorldObject other) {
if (other == null)
return false;
return other.getID().equals(id);
diff --git a/src/main/java/com/l2jserver/service/network/NettyNetworkService.java b/src/main/java/com/l2jserver/service/network/NettyNetworkService.java
index 75d8383ac..ffbfc4e1e 100644
--- a/src/main/java/com/l2jserver/service/network/NettyNetworkService.java
+++ b/src/main/java/com/l2jserver/service/network/NettyNetworkService.java
@@ -34,10 +34,10 @@ import com.l2jserver.game.net.Lineage2PipelineFactory;
import com.l2jserver.model.id.object.CharacterID;
import com.l2jserver.service.AbstractService;
import com.l2jserver.service.AbstractService.Depends;
-import com.l2jserver.service.blowfish.BlowfishKeygenService;
import com.l2jserver.service.configuration.ConfigurationService;
import com.l2jserver.service.game.world.WorldService;
import com.l2jserver.service.logging.LoggingService;
+import com.l2jserver.service.network.keygen.BlowfishKeygenService;
import com.l2jserver.util.factory.CollectionFactory;
/**
diff --git a/src/main/java/com/l2jserver/service/blowfish/BlowfishKeygenService.java b/src/main/java/com/l2jserver/service/network/keygen/BlowfishKeygenService.java
similarity index 94%
rename from src/main/java/com/l2jserver/service/blowfish/BlowfishKeygenService.java
rename to src/main/java/com/l2jserver/service/network/keygen/BlowfishKeygenService.java
index 9d7e2927a..6eb3ec9e5 100644
--- a/src/main/java/com/l2jserver/service/blowfish/BlowfishKeygenService.java
+++ b/src/main/java/com/l2jserver/service/network/keygen/BlowfishKeygenService.java
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see .
*/
-package com.l2jserver.service.blowfish;
+package com.l2jserver.service.network.keygen;
import com.l2jserver.service.Service;
diff --git a/src/main/java/com/l2jserver/service/blowfish/PseudoRandomBlowfishKeygenService.java b/src/main/java/com/l2jserver/service/network/keygen/PseudoRandomBlowfishKeygenService.java
similarity index 97%
rename from src/main/java/com/l2jserver/service/blowfish/PseudoRandomBlowfishKeygenService.java
rename to src/main/java/com/l2jserver/service/network/keygen/PseudoRandomBlowfishKeygenService.java
index e8d239dc6..0463c8919 100644
--- a/src/main/java/com/l2jserver/service/blowfish/PseudoRandomBlowfishKeygenService.java
+++ b/src/main/java/com/l2jserver/service/network/keygen/PseudoRandomBlowfishKeygenService.java
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see .
*/
-package com.l2jserver.service.blowfish;
+package com.l2jserver.service.network.keygen;
import java.util.Random;
diff --git a/src/main/java/com/l2jserver/service/blowfish/SecureBlowfishKeygenService.java b/src/main/java/com/l2jserver/service/network/keygen/SecureBlowfishKeygenService.java
similarity index 97%
rename from src/main/java/com/l2jserver/service/blowfish/SecureBlowfishKeygenService.java
rename to src/main/java/com/l2jserver/service/network/keygen/SecureBlowfishKeygenService.java
index 4d039830f..4256592cf 100644
--- a/src/main/java/com/l2jserver/service/blowfish/SecureBlowfishKeygenService.java
+++ b/src/main/java/com/l2jserver/service/network/keygen/SecureBlowfishKeygenService.java
@@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with l2jserver. If not, see .
*/
-package com.l2jserver.service.blowfish;
+package com.l2jserver.service.network.keygen;
import org.apache.commons.math.random.RandomData;
import org.apache.commons.math.random.RandomDataImpl;
diff --git a/src/main/java/com/l2jserver/service/threading/ThreadService.java b/src/main/java/com/l2jserver/service/threading/ThreadService.java
index f7ad07250..e01013c41 100644
--- a/src/main/java/com/l2jserver/service/threading/ThreadService.java
+++ b/src/main/java/com/l2jserver/service/threading/ThreadService.java
@@ -16,12 +16,14 @@
*/
package com.l2jserver.service.threading;
+import com.l2jserver.service.Service;
+
/**
* This service is responsible for scheduling tasks and executing them in
* parallel.
*
* @author Rogiel
*/
-public interface ThreadService {
+public interface ThreadService extends Service {
}
diff --git a/src/main/java/com/l2jserver/util/RGBColor.java b/src/main/java/com/l2jserver/util/RGBColor.java
index ae2e154ec..969ef255e 100644
--- a/src/main/java/com/l2jserver/util/RGBColor.java
+++ b/src/main/java/com/l2jserver/util/RGBColor.java
@@ -77,7 +77,7 @@ public class RGBColor {
* @return the color integer
*/
public int toInteger() {
- return red + green >> 8 + blue >> 16;
+ return red >> 24 + green >> 16 + blue >> 8;
}
public static RGBColor fromByteArray(byte[] rgb) {
diff --git a/src/main/java/com/l2jserver/util/dimensional/Coordinate.java b/src/main/java/com/l2jserver/util/dimensional/Coordinate.java
index 8230dd163..d2e957bc1 100644
--- a/src/main/java/com/l2jserver/util/dimensional/Coordinate.java
+++ b/src/main/java/com/l2jserver/util/dimensional/Coordinate.java
@@ -86,13 +86,12 @@ public class Coordinate {
return new Coordinate(x, y, z);
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#toString()
- */
@Override
public String toString() {
return "Coordinate [" + vector + "]";
}
+
+ public Point toPoint() {
+ return new Point(this, 0);
+ }
}
diff --git a/src/tool/java/com/l2jserver/tool/conversor/chartemplate/CharacterTemplateBase.txt b/src/tool/java/com/l2jserver/tool/conversor/chartemplate/CharacterTemplateBase.txt
index 46aef4915..b28412a03 100644
--- a/src/tool/java/com/l2jserver/tool/conversor/chartemplate/CharacterTemplateBase.txt
+++ b/src/tool/java/com/l2jserver/tool/conversor/chartemplate/CharacterTemplateBase.txt
@@ -1,4 +1,20 @@
-package script.template.character;
+/*
+ * This file is part of l2jserver .
+ *
+ * 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 .
+ */
+package script.template.actor.character;
import com.google.inject.Inject;
import com.l2jserver.model.id.template.CharacterTemplateID;
@@ -10,43 +26,31 @@ import com.l2jserver.util.dimensional.Point;
public class ${javaClassName}Template extends ${parent}Template {
@Inject
public ${javaClassName}Template(CharacterTemplateIDFactory factory) {
- super(factory.createID(${ClassId}.id),
- ${ClassId},
- // ATTRIBUTES
- ${_INT},// INT
- ${STR},// STR
- ${CON},// CON
- ${MEN},// MEN
- ${DEX},// DEX
- ${WIT},// WIT
- ${P_ATK},// physical attack
- ${M_ATK},// magical attack
- ${P_DEF},// physical def
- ${M_DEF},// magical def
- ${P_SPD},// attack speed
- ${M_SPD},// cast speed
- ${ACC},// accuracy
- ${CRITICAL},// critical
- ${EVASION},// evasion
- ${MOVE_SPD},// move speed
- ${_LOAD},// max inventory weight
- ${canCraft},// can craft
- Point.fromXYZ(${x}, ${y}, ${z})// spawn location
- );
+ super(factory.createID(${ClassId}.id), ${ClassId}, Point.fromXYZ(${x}, ${y}, ${z}));
+ // ATTRIBUTES
+ attributes.intelligence = ${_INT};
+ attributes.strength = ${STR};
+ attributes.concentration = ${CON};
+ attributes.mentality = ${MEN};
+ attributes.dexterity = ${DEX};
+ attributes.witness = ${WIT};
+ attributes.physicalAttack = ${P_ATK};
+ attributes.magicalAttack = ${M_ATK};
+ attributes.physicalDefense = ${P_DEF};
+ attributes.magicalDefense = ${M_DEF};
+ attributes.attackSpeed = ${P_SPD};
+ attributes.castSpeed = ${M_SPD};
+ attributes.accuracy = ${ACC};
+ attributes.criticalChance = ${CRITICAL};
+ attributes.evasionChance = ${EVASION};
+ attributes.moveSpeed = ${MOVE_SPD};
+ attributes.maxWeigth = ${_LOAD};
+ attributes.craft = ${canCraft};
}
protected ${javaClassName}Template(CharacterTemplateID id,
- CharacterClass characterClass, int intelligence, int strength,
- int concentration, int mentality, int dexterity, int witness,
- int physicalAttack, int magicalAttack, int physicalDefense,
- int magicalDefense, int attackSpeed, int castSpeed, int accuracy,
- int criticalChance, int evasionChance, int moveSpeed,
- int maxWeigth, boolean craft, Point spawnLocation) {
- super(id, characterClass, intelligence, strength, concentration,
- mentality, dexterity, witness, physicalAttack, magicalAttack,
- physicalDefense, magicalDefense, attackSpeed, castSpeed,
- accuracy, criticalChance, evasionChance, moveSpeed, maxWeigth,
- craft, spawnLocation);
+ CharacterClass characterClass, Point spawnLocation) {
+ super(id, characterClass, spawnLocation);
}
@Override