mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-11 09:42:54 +00:00
Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
@@ -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.
|
||||
* <p>
|
||||
* This field is not persisted.
|
||||
*/
|
||||
private CharacterMoveType moveType = CharacterMoveType.WALK;
|
||||
|
||||
/**
|
||||
* This character's inventory
|
||||
* The character walking mode
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
25
src/main/java/com/l2jserver/model/world/NPC.java
Normal file
25
src/main/java/com/l2jserver/model/world/NPC.java
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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.world;
|
||||
|
||||
/**
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*
|
||||
*/
|
||||
public class NPC extends AbstractActor {
|
||||
|
||||
}
|
||||
@@ -14,19 +14,19 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.model.world.character;
|
||||
package com.l2jserver.model.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 <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*
|
||||
*/
|
||||
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
|
||||
@@ -1,310 +0,0 @@
|
||||
/*
|
||||
* 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.world.character;
|
||||
|
||||
/**
|
||||
* Defines the attributes of an character
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -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 <b>real</b>
|
||||
* This {@link ActorAttributes} implementation calculates the <b>real</b>
|
||||
* character attributes based on it's {@link CharacterTemplate} and active
|
||||
* buffs.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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.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 <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
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 };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user