1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-05 23:22:47 +00:00

Update assembly descriptor and improves significantly the documentation

Fixes an issue in the assembly descriptor that included older
compilation binaries into assemblies.
Improved javadoc documentation in more than 150 classes, including
fixing mistakes.
This commit is contained in:
2011-09-15 01:21:52 -03:00
parent 8a8557606f
commit a2e8680f72
155 changed files with 1223 additions and 225 deletions

View File

@@ -10,11 +10,6 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>

View File

@@ -1,6 +1,13 @@
#Tue Sep 13 16:51:09 BRT 2011
#Tue Sep 13 17:32:00 BRT 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7

68
pom.xml
View File

@@ -8,6 +8,45 @@
<description>Lineage II server emulator</description>
<inceptionYear>2011</inceptionYear>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/l2jserver2/l2jserver2-gs/issues</url>
</issueManagement>
<ciManagement>
<system>GitHub</system>
<url>https://github.com/l2jserver2/l2jserver2-gs/wiki</url>
</ciManagement>
<developers>
<developer>
<id>rogiel</id>
<name>Rogiel</name>
<email>rogiel@rogiel.com</email>
<url>http://www.rogiel.com/</url>
<timezone>-3</timezone>
<roles>
<role>Creator</role>
<role>API Designer</role>
</roles>
</developer>
</developers>
<scm>
<connection>git://github.com/l2jserver2/l2jserver2-gs.git</connection>
<developerConnection>ssh://git@github.com:l2jserver2/l2jserver2-gs.git</developerConnection>
<tag>master</tag>
<url>https://github.com/l2jserver2/l2jserver2-gs</url>
</scm>
<licenses>
<license>
<name>GNU General Public License version 3</name>
<url>http://www.gnu.org/licenses/gpl.txt</url>
<distribution>manual</distribution>
</license>
</licenses>
<build>
<defaultGoal>package</defaultGoal>
<plugins>
@@ -198,35 +237,6 @@
<!-- vfs -->
</dependencies>
<issueManagement>
<system>GitHub</system>
<url>https://github.com/Rogiel/l2jserver2-gs/issues</url>
</issueManagement>
<ciManagement>
<system>GitHub</system>
<url>https://github.com/Rogiel/l2jserver2-gs/wiki</url>
</ciManagement>
<developers>
<developer>
<id>rogiel</id>
<name>Rogiel</name>
<email>rogiel@rogiel.com</email>
<url>http://www.rogiel.com</url>
<timezone>GMT - 3</timezone>
<roles>
<role>Creator</role>
<role>API Designer</role>
</roles>
</developer>
</developers>
<contributors>
</contributors>
<scm>
<connection>git://github.com/Rogiel/l2jserver2-gs.git</connection>
<developerConnection>ssh://git@github.com:Rogiel/l2jserver2-gs.git</developerConnection>
<tag>master</tag>
<url>https://github.com/Rogiel/l2jserver2-gs</url>
</scm>
<repositories>
<repository>
<id>repository.jboss.org</id>

View File

@@ -31,12 +31,8 @@
<directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.jar</include>
<include>${project.artifactId}-${project.version}.jar</include>
</includes>
<excludes>
<exclude>*-sources.jar</exclude>
<exclude>*-javadoc.jar</exclude>
</excludes>
</fileSet>
</fileSets>
<dependencySets>

View File

@@ -31,12 +31,8 @@
<directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.jar</include>
<include>${project.artifactId}-${project.version}.jar</include>
</includes>
<excludes>
<exclude>*-sources.jar</exclude>
<exclude>*-javadoc.jar</exclude>
</excludes>
</fileSet>
</fileSets>
<dependencySets>

View File

@@ -30,8 +30,17 @@ import com.l2jserver.service.game.world.WorldIDService;
import com.l2jserver.service.network.NetworkService;
import com.l2jserver.service.network.keygen.BlowfishKeygenService;
/**
* Main class
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class L2JGameServerMain {
public static void main(String[] args) throws InterruptedException {
/**
* Main method
* @param args no arguments are used
*/
public static void main(String[] args) {
final L2JGameServer server = new L2JGameServer();
try {
final ServiceManager serviceManager = server.getInjector()

View File

@@ -20,6 +20,7 @@ import com.google.inject.Inject;
import com.l2jserver.game.ai.desires.Desire;
import com.l2jserver.game.ai.desires.DesireQueue;
import com.l2jserver.model.world.Actor;
import com.l2jserver.service.game.world.WorldService;
import com.l2jserver.service.game.world.event.WorldEventDispatcher;
/**
@@ -37,9 +38,18 @@ public abstract class AI<T extends Actor> {
*/
protected final T actor;
/**
* The {@link WorldService} event dispatcher
*/
@Inject
protected WorldEventDispatcher eventDispatcher;
/**
* Creates a new AI
*
* @param actor
* the actor controlled by this {@link AI}
*/
protected AI(T actor) {
this.actor = actor;
}

View File

@@ -62,20 +62,6 @@ public class Lineage2Client {
* The Lineage 2 session
*/
private Lineage2Session session;
/**
* The connection state
*/
private ConnectionState state = ConnectionState.CONNECTED;
/**
* Each connection is represented by an state: connected, authenticated and
* in-game.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum ConnectionState {
CONNECTED, AUTHENTICATED, IN_GAME;
}
/**
* The client supported protocol version
@@ -99,6 +85,8 @@ public class Lineage2Client {
*
* @param worldService
* the world service
* @param networkService
* the network service
* @param channel
* the channel
*/
@@ -155,21 +143,6 @@ public class Lineage2Client {
this.session = session;
}
/**
* @return the state
*/
public ConnectionState getState() {
return state;
}
/**
* @param state
* the state to set
*/
public void setState(ConnectionState state) {
this.state = state;
}
/**
* @return the version
*/
@@ -190,6 +163,7 @@ public class Lineage2Client {
* if the protocol is not known false will always be returned.
*
* @param version
* the protocol version to test for support
* @return true if version is supported by the client
* @see com.l2jserver.game.net.ProtocolVersion#supports(com.l2jserver.game.net.ProtocolVersion)
*/

View File

@@ -78,6 +78,11 @@ public class Lineage2CryptographyKey {
key[11] = (byte) (old >> 0x18 & 0xff);
}
/**
* Creates a copy of this key
*
* @return the copied key
*/
public Lineage2CryptographyKey copy() {
return new Lineage2CryptographyKey(Arrays.copyOf(key, key.length));
}

View File

@@ -23,6 +23,7 @@ import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.handler.logging.LoggingHandler;
import org.jboss.netty.logging.InternalLogLevel;
import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.l2jserver.game.net.codec.Lineage2Decrypter;
@@ -56,6 +57,12 @@ public class Lineage2PipelineFactory implements ChannelPipelineFactory {
*/
private final WorldService worldService;
/**
* Creates a new instance of this pipeline
* @param injector the {@link Guice} {@link Injector}
* @param networkService the network service
* @param worldService the world service
*/
@Inject
public Lineage2PipelineFactory(Injector injector,
NetworkService networkService, WorldService worldService) {

View File

@@ -40,18 +40,45 @@ public enum ProtocolVersion {
*/
HIGH5(268, FREYA);
/**
* The parent version
*/
public final ProtocolVersion parent;
/**
* This version numeric ID
*/
public final int version;
/**
* Creates a new instance
*
* @param version
* the version integer id
*/
ProtocolVersion(int version) {
this(version, null);
}
/**
* Creates a new instance with a parent version
*
* @param version
* the version integer id
* @param parent
* the parent version
*/
ProtocolVersion(int version, ProtocolVersion parent) {
this.version = version;
this.parent = parent;
}
/**
* Checks if an given version is compatible with this
*
* @param version
* the target version to be tested
* @return true if version is compatible
*/
public boolean supports(ProtocolVersion version) {
if (this == version)
return true;
@@ -60,6 +87,11 @@ public enum ProtocolVersion {
return this.parent.supports(version);
}
/**
* @param version
* the version integer id
* @return the detected version from the numeric id. Can be <tt>null</tt>
*/
public static ProtocolVersion fromVersion(int version) {
for (ProtocolVersion v : values()) {
if (v.version == version)

View File

@@ -15206,9 +15206,19 @@ public enum SystemMessage {
*/
THOMAS_D_TURKEY_DISAPPEARED(6505);
/**
* The system message integer id
*/
public final int id;
/**
* The cached {@link SM_SYSTEM_MESSAGE} packet
*/
public final SM_SYSTEM_MESSAGE packet;
/**
* @param id
* the integer id
*/
SystemMessage(int id) {
this.id = id;
this.packet = new SM_SYSTEM_MESSAGE(this);

View File

@@ -70,7 +70,8 @@ public class Lineage2Decrypter extends OneToOneDecoder {
/**
* Creates a random key and enables descrypting
*
* @return the generated key
* @param key
* the key
*/
public void enable(Lineage2CryptographyKey key) {
this.setKey(key);
@@ -89,10 +90,19 @@ public class Lineage2Decrypter extends OneToOneDecoder {
this.key = key;
}
/**
* @return true if decrypter is enabled
*/
public boolean isEnabled() {
return enabled;
}
/**
* Sets the state of this decrypter
*
* @param enabled
* the new state
*/
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}

View File

@@ -90,10 +90,19 @@ public class Lineage2Encrypter extends OneToOneEncoder {
this.key = key;
}
/**
* @return true if this encrypter is enabled
*/
public boolean isEnabled() {
return enabled;
}
/**
* Sets the state of this encrypter
*
* @param enabled
* the new state
*/
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}

View File

@@ -31,6 +31,9 @@ import org.jboss.netty.handler.codec.frame.FrameDecoder;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class Lineage2FrameDecoder extends FrameDecoder {
/**
* The message header size (in bytes)
*/
private static final int HEADER_SIZE = 2;
@Override

View File

@@ -53,6 +53,14 @@ public class Lineage2PacketHandler extends SimpleChannelHandler {
*/
private Lineage2Client connection;
/**
* Creates a new instance of the packet handler
*
* @param nettyNetworkService
* the netty network service
* @param worldService
* the world service
*/
public Lineage2PacketHandler(NettyNetworkService nettyNetworkService,
WorldService worldService) {
this.nettyNetworkService = nettyNetworkService;

View File

@@ -23,8 +23,17 @@ package com.l2jserver.game.net.packet;
* @see ServerPacket
*/
public abstract class AbstractServerPacket implements ServerPacket {
/**
* The packet OPCODE
*/
private final int opcode;
/**
* Creates a new instance of the packet
*
* @param opcode
* the packet opcode
*/
public AbstractServerPacket(int opcode) {
this.opcode = opcode;
}

View File

@@ -43,35 +43,108 @@ public class CM_ACTION_USE extends AbstractClientPacket {
*/
private final CharacterService charService;
/**
* The action to be performed
*/
private Action action;
/**
* The enumeration of all possible actions
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum Action {
SIT_STAND(0), WALK_RUN(1),
PRIVATE_STORE_SELL(10), PRIVATE_STORE_BUY(11),
PET_FOLLOW_MOVE(15), PET_FOLLOW_MOVE2(21),
PET_ATTACK(16), PET_ATTACK2(22),
PET_STOP(17), PET_STOP2(23),
/**
* Toggles the character in SIT or STAND mode
*/
SIT_STAND(0),
/**
* Toggles the character in WALK or RUN mode
*/
WALK_RUN(1),
/**
* Stats a new private store sell
*/
PRIVATE_STORE_SELL(10),
/**
* Stats a new private store buy
*/
PRIVATE_STORE_BUY(11),
/**
* Sets the pet in follow mode
*/
PET_FOLLOW_MOVE(15),
/**
* Sets the pet in follow mode 2
*/
PET_FOLLOW_MOVE2(21),
/**
* Orders the pet to attack
*/
PET_ATTACK(16),
/**
* Orders the pet to attack (second type)
*/
PET_ATTACK2(22),
/**
* Orders the pet to stop
*/
PET_STOP(17),
/**
* Orders the pet to stop (second type)
*/
PET_STOP2(23),
/**
* Unsummons the pet
*/
PET_UNSUMMON(19),
/**
* Mounts or dismount from pet
*/
MOUNT_DISMOUNT(38),
/**
* Switch Wild Hog Cannon mode
*/
WILD_HOG_CANNON_SWITCH_MODE(32),
/**
* Stops Wild Hog Cannon
*/
WILD_HOG_CANNON_STOP(41),
WILD_HOG_CANNON_SWITCH_MODE(32), WILD_HOG_CANNON_STOP(41),
SOULESS_TOXIC_SMOKE(36), SOULESS_PARASITE_BURST(39),
/**
* Souless toxic smoke
*/
SOULESS_TOXIC_SMOKE(36),
/**
* Souless parasite burst
*/
SOULESS_PARASITE_BURST(39),
/**
* Creates a new darwven manufacture
*/
DWARVEN_MANUFACTURE(37);
/**
* The numeric action id
*/
public final int id;
/**
* @param id
* the numeric action id
*/
Action(int id) {
this.id = id;
}
/**
* Resolves the numeric id into an Java type action
*
* @param id
* the numeric id
* @return the resolved action
*/
public static Action fromID(int id) {
for (final Action action : values())
if (action.id == id)
@@ -80,11 +153,21 @@ public class CM_ACTION_USE extends AbstractClientPacket {
}
}
/**
* If CTRL key was pressed for this action
*/
@SuppressWarnings("unused")
private boolean ctrlPressed;
/**
* If SHIFT key was pressed for this action
*/
@SuppressWarnings("unused")
private boolean shiftPressed;
/**
* @param charService
* the character service
*/
@Inject
public CM_ACTION_USE(CharacterService charService) {
this.charService = charService;

View File

@@ -46,6 +46,10 @@ public class CM_ADMIN_COMMAND extends AbstractClientPacket {
@SuppressWarnings("unused")
private String command;
/**
* @param adminService
* the administrator service
*/
@Inject
public CM_ADMIN_COMMAND(AdministratorService adminService) {
this.adminService = adminService;

View File

@@ -76,6 +76,11 @@ public class CM_ATTACK extends AbstractClientPacket {
@SuppressWarnings("unused")
private CharacterAttackAction action;
/**
* Enumeration of all possible attack actions
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum CharacterAttackAction {
/**
* Normal click
@@ -86,12 +91,27 @@ public class CM_ATTACK extends AbstractClientPacket {
*/
SHIFT_CLICK(1);
/**
* The attack action numeric id
*/
public final int id;
/**
* @param id
* the action numeric id
*/
CharacterAttackAction(int id) {
this.id = id;
}
/**
* Resolves the numeric action id to an {@link CharacterAttackAction}
* type
*
* @param id
* the numeric id
* @return the resolved action
*/
public static CharacterAttackAction fromID(int id) {
for (final CharacterAttackAction action : values())
if (action.id == id)
@@ -100,6 +120,12 @@ public class CM_ATTACK extends AbstractClientPacket {
}
}
/**
* @param charService
* the character service
* @param idResolver
* the object id resolver
*/
@Inject
public CM_ATTACK(CharacterService charService, ObjectIDResolver idResolver) {
this.charService = charService;

View File

@@ -58,11 +58,29 @@ public class CM_AUTH_LOGIN extends AbstractClientPacket {
* User account name
*/
private String loginName;
/**
* The play key 1
*/
private int playKey1;
/**
* The play key 2
*/
private int playKey2;
/**
* The login key 1
*/
private int loginKey1;
/**
* The login key 2
*/
private int loginKey2;
/**
* @param characterDao
* the character DAO
* @param accountIdFactory
* the account id factory
*/
@Inject
public CM_AUTH_LOGIN(CharacterDAO characterDao,
AccountIDProvider accountIdFactory) {

View File

@@ -40,6 +40,9 @@ import com.l2jserver.util.BufferUtils;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CM_BYPASS extends AbstractClientPacket {
/**
* The logger
*/
private final Logger log = LoggerFactory.getLogger(this.getClass());
/**
@@ -61,6 +64,12 @@ public class CM_BYPASS extends AbstractClientPacket {
*/
private String command;
/**
* @param idResolver
* the object id resolver
* @param npcService
* the {@link NPC} service
*/
@Inject
public CM_BYPASS(ObjectIDResolver idResolver, NPCService npcService) {
this.idResolver = idResolver;
@@ -98,6 +107,11 @@ public class CM_BYPASS extends AbstractClientPacket {
}
}
/**
* @param tokenizer
* the tokenizer
* @return an array of strings with each parameter
*/
private String[] createArgumentArray(StringTokenizer tokenizer) {
if (!tokenizer.hasMoreTokens())
return new String[0];

View File

@@ -75,6 +75,9 @@ public class SM_SYSTEM_MESSAGE extends AbstractServerPacket {
/**
* Creates a new instance
*
* @param message
* the {@link SystemMessage}
*/
public SM_SYSTEM_MESSAGE(SystemMessage message) {
super(OPCODE);
@@ -108,8 +111,9 @@ public class SM_SYSTEM_MESSAGE extends AbstractServerPacket {
* 81-89 Territory names<br>
* 101-121 Fortress names<br>
*
* @param number
* @return
* @param fort
* the fort
* @return the {@link SM_SYSTEM_MESSAGE} instance
*/
public final SM_SYSTEM_MESSAGE addFort(final Fort fort) {
params.add(new SystemMessagePacketParameter() {
@@ -206,7 +210,8 @@ public class SM_SYSTEM_MESSAGE extends AbstractServerPacket {
* Elemental name - 0(Fire) ...
*
* @param type
* @return
* the type
* @return the {@link SM_SYSTEM_MESSAGE} instance
*/
public final SM_SYSTEM_MESSAGE addElemntal(final int type) {
params.add(new SystemMessagePacketParameter() {
@@ -223,7 +228,8 @@ public class SM_SYSTEM_MESSAGE extends AbstractServerPacket {
* ID from sysstring-e.dat
*
* @param type
* @return
* the type
* @return the {@link SM_SYSTEM_MESSAGE} instance
*/
public final SM_SYSTEM_MESSAGE addSystemString(final int type) {
params.add(new SystemMessagePacketParameter() {
@@ -241,7 +247,7 @@ public class SM_SYSTEM_MESSAGE extends AbstractServerPacket {
*
* @param type
* id of instance
* @return
* @return the {@link SM_SYSTEM_MESSAGE} instance
*/
public final SM_SYSTEM_MESSAGE addInstanceName(final int type) {
params.add(new SystemMessagePacketParameter() {

View File

@@ -22,6 +22,9 @@ import com.l2jserver.model.id.ID;
/**
* Simple model interface implementing {@link ID} related methods
*
* @param <T>
* the ID type used to represent this {@link Model}
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class AbstractModel<T extends ID<?>> implements Model<T> {
@@ -63,6 +66,7 @@ public abstract class AbstractModel<T extends ID<?>> implements Model<T> {
* {@link ObjectDesire#INSERT} or {@link ObjectDesire#DELETE} the desire
* will not be changed.
*/
@SuppressWarnings("javadoc")
protected void desireUpdate() {
if (this.desire != ObjectDesire.INSERT
&& this.desire != ObjectDesire.DELETE)
@@ -73,6 +77,7 @@ public abstract class AbstractModel<T extends ID<?>> implements Model<T> {
* Set this object desire to {@link ObjectDesire#INSERT}. If the desire is
* {@link ObjectDesire#DELETE} the desire will not be changed.
*/
@SuppressWarnings("javadoc")
protected void desireInsert() {
if (this.desire != ObjectDesire.DELETE)
this.desire = ObjectDesire.INSERT;

View File

@@ -20,8 +20,13 @@ import com.l2jserver.model.id.ID;
import com.l2jserver.service.database.DatabaseService;
/**
* @author <a href="http://www.rogiel.com">Rogiel</a>
* Base model. Each object model must implement this interface to be able to be
* inserted into the database.
*
* @param <T>
* the {@link ID} type used to represent this {@link Model}
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface Model<T extends ID<?>> {
/**

View File

@@ -41,7 +41,7 @@ public interface NPCDAO extends DataAccessObject<NPC, NPCID>, Cacheable {
/**
* Select an {@link NPC} by its template.
*
* @param name
* @param templateID
* the npc template id
* @return the found NPC. Null if does not exists.
*/

View File

@@ -0,0 +1,133 @@
/*
* 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.game;
import java.util.Date;
import com.l2jserver.model.AbstractModel;
import com.l2jserver.model.id.CastleID;
import com.l2jserver.model.id.FortID;
import com.l2jserver.model.id.object.CharacterID;
/**
* An fort in Lineage II game world
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class Castle extends AbstractModel<FortID> {
/**
* The {@link Castle} of which this {@link Castle} belongs to
*/
private CastleID castleID;
/**
* The owner (clan leader) of which this {@link Castle} belongs to.
*/
private CharacterID ownerID;
/**
* The castle name
*/
private String name;
/**
* The siege date
*/
private Date siegeDate;
/**
* The last time this fort was owned by someone
*/
private Date lastOwnedTime;
/**
* @return the castleID
*/
public CastleID getCastleID() {
return castleID;
}
/**
* @param castleID
* the castleID to set
*/
public void setCastleID(CastleID castleID) {
desireUpdate();
this.castleID = castleID;
}
/**
* @return the ownerID
*/
public CharacterID getOwnerID() {
return ownerID;
}
/**
* @param ownerID
* the ownerID to set
*/
public void setOwnerID(CharacterID ownerID) {
desireUpdate();
this.ownerID = ownerID;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name
* the name to set
*/
public void setName(String name) {
desireUpdate();
this.name = name;
}
/**
* @return the siegeDate
*/
public Date getSiegeDate() {
return siegeDate;
}
/**
* @param siegeDate
* the siegeDate to set
*/
public void setSiegeDate(Date siegeDate) {
desireUpdate();
this.siegeDate = siegeDate;
}
/**
* @return the lastOwnedTime
*/
public Date getLastOwnedTime() {
return lastOwnedTime;
}
/**
* @param lastOwnedTime
* the lastOwnedTime to set
*/
public void setLastOwnedTime(Date lastOwnedTime) {
desireUpdate();
this.lastOwnedTime = lastOwnedTime;
}
}

View File

@@ -27,22 +27,38 @@ import com.l2jserver.model.world.L2Character;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CharacterFriend extends AbstractModel<FriendID> {
/**
* @param id
* the friend id
*/
public CharacterFriend(FriendID id) {
this.setID(id);
}
/**
* @return the character id
*/
public CharacterID getCharacterID() {
return id.getID1();
}
/**
* @return the character
*/
public L2Character getCharacter() {
return id.getID1().getObject();
}
/**
* @return the friend id
*/
public CharacterID getFriendID() {
return id.getID2();
}
/**
* @return the friend
*/
public L2Character getFriend() {
return id.getID2().getObject();
}

View File

@@ -61,7 +61,14 @@ public class Fort extends AbstractModel<FortID> {
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum FortType {
TYPE1, TYPE2;
/**
* Fort type 1
*/
TYPE1,
/**
* Fort type 2
*/
TYPE2;
}
/**

View File

@@ -63,13 +63,39 @@ public class Shortcut extends AbstractModel<ShortcutID> {
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum ShortcutType {
ITEM(1), SKILL(2), ACTION(3), MACRO(4), RECIPE(5), TPBOOKMARK(6);
/**
* Item shortcut
*/
ITEM(1),
/**
* Skill shortcut
*/
SKILL(2),
/**
* Social action shortcut
*/
ACTION(3),
/**
* Macro shortcut
*/
MACRO(4),
/**
* Recipe shortcut
*/
RECIPE(5),
/**
* Bookmark shortcut
*/
TPBOOKMARK(6);
/**
* The shortcut type id
*/
public final int id;
/**
* @param id the numeric id
*/
ShortcutType(int id) {
this.id = id;
}
@@ -78,7 +104,7 @@ public class Shortcut extends AbstractModel<ShortcutID> {
*
* @param id
* the type id
* @return
* @return the {@link ShortcutType}
*/
public static ShortcutType fromID(int id) {
for (final ShortcutType shortcut : values()) {
@@ -101,8 +127,8 @@ public class Shortcut extends AbstractModel<ShortcutID> {
/**
* Creates a new instance
*
* @param character
* the character
* @param characterID
* the character id
*/
public Shortcut(CharacterID characterID) {
this.characterID = characterID;

View File

@@ -29,6 +29,9 @@ import com.l2jserver.model.world.Actor;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class Skill extends AbstractModel<SkillID> {
/**
* The {@link Skill} template id
*/
private final SkillTemplateID templateID;
/**
* The skill level learned
@@ -38,6 +41,8 @@ public class Skill extends AbstractModel<SkillID> {
/**
* Creates a new instance in level one
*
* @param templateID
* the {@link SkillTemplateID} instance
* @param level
* the level of this skill
*/
@@ -48,6 +53,9 @@ public class Skill extends AbstractModel<SkillID> {
/**
* Creates a new instance in level one
*
* @param templateID
* the {@link SkillTemplateID} instance
*/
public Skill(SkillTemplateID templateID) {
this(templateID, 1);

View File

@@ -22,6 +22,11 @@ import com.l2jserver.model.Model;
* This is an abstract ID for most model objects that do not extend
* {@link ObjectID}.
*
* @param <T>
* the raw id type
* @param <O>
* the model this {@link ID} provides
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class AbstractModelID<T, O extends Model<? extends ID<T>>>

View File

@@ -18,6 +18,7 @@ package com.l2jserver.model.id;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import com.l2jserver.model.game.Castle;
import com.l2jserver.model.id.provider.IDProvider;
/**

View File

@@ -21,6 +21,9 @@ import com.google.inject.Inject;
/**
* The ID interface. Each object must be represented by an unique ID.
*
* @param <T>
* the raw id type
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class ID<T> {
@@ -29,6 +32,9 @@ public abstract class ID<T> {
*/
protected final T id;
/**
* @param id the raw id
*/
@Inject
protected ID(T id) {
this.id = id;

View File

@@ -21,6 +21,7 @@ import java.lang.ref.SoftReference;
import com.l2jserver.model.id.provider.IDProvider;
import com.l2jserver.model.template.Template;
import com.l2jserver.service.game.template.TemplateService;
/**
* Templates IDs, different from {@link ObjectID}s, can be repeated and are
@@ -29,9 +30,22 @@ import com.l2jserver.model.template.Template;
* Please, do not directly instantiate this class, use an {@link IDProvider}
* instead.
*
* @param <T>
* the template type provided by this {@link TemplateID}
* @param <I>
* the raw ID type
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class TemplateID<T extends Template<?>, I> extends ID<I> {
/**
* The cached template {@link Reference}
* <p>
* Please, avoid using it directly. Instead use {@link #getTemplate()} to
* retrieve the template object, since it will check if the reference is
* still valid and if not, will request the template with
* {@link TemplateService}.
*/
private Reference<T> cached;
/**

View File

@@ -21,6 +21,11 @@ import com.l2jserver.model.id.ID;
/**
* The compound {@link ID} is composed of two IDs.
*
* @param <T1>
* the first {@link ID} type
* @param <T2>
* the second {@link ID} type
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class AbstractCompoundID<T1, T2> extends ID<AbstractCompoundID<T1, T2>> {

View File

@@ -33,6 +33,9 @@ import com.l2jserver.model.world.Actor;
* the actor subclass
*/
public abstract class ActorID<T extends Actor> extends ObjectID<T> {
/**
* @param id the raw id
*/
@Inject
public ActorID(@Assisted int id) {
super(id);

View File

@@ -37,6 +37,10 @@ public final class CharacterID extends ActorID<L2Character> {
*/
private transient final CharacterDAO characterDao;
/**
* @param id the raw id
* @param characterDao the character DAO
*/
@Inject
public CharacterID(@Assisted int id, CharacterDAO characterDao) {
super(id);

View File

@@ -37,6 +37,10 @@ public final class ClanID extends ObjectID<Clan> {
*/
private final ClanDAO clanDao;
/**
* @param id the raw id
* @param clanDao the clan DAO
*/
@Inject
protected ClanID(@Assisted int id, ClanDAO clanDao) {
super(id);

View File

@@ -37,6 +37,10 @@ public final class ItemID extends ObjectID<Item> {
*/
private final ItemDAO itemDao;
/**
* @param id the raw id
* @param itemDao the item DAO
*/
@Inject
protected ItemID(@Assisted int id, ItemDAO itemDao) {
super(id);

View File

@@ -40,6 +40,12 @@ public final class NPCID extends ActorID<NPC> {
*/
private final WorldService worldService;
/**
* @param id
* the raw id
* @param worldService
* the world service
*/
@Inject
public NPCID(@Assisted int id, WorldService worldService) {
super(id);

View File

@@ -36,6 +36,10 @@ public final class PetID extends ActorID<Pet> {
*/
private final PetDAO petDao;
/**
* @param id the raw id
* @param petDao the pet DAO
*/
@Inject
protected PetID(int id, PetDAO petDao) {
super(id);

View File

@@ -22,20 +22,40 @@ package com.l2jserver.model.id.object.allocator;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class IDAllocatorException extends RuntimeException {
/**
* The Java Serialization Serial
*/
private static final long serialVersionUID = 111195059766878062L;
/**
* Creates an empty instance of this exception
*/
public IDAllocatorException() {
super();
}
/**
* @param message
* the message
* @param cause
* the root cause
*/
public IDAllocatorException(String message, Throwable cause) {
super(message, cause);
}
/**
* @param message
* the message
*/
public IDAllocatorException(String message) {
super(message);
}
/**
* @param cause
* the root cause
*/
public IDAllocatorException(Throwable cause) {
super(cause);
}

View File

@@ -42,6 +42,14 @@ public class CharacterIDProvider implements ObjectIDProvider<CharacterID> {
*/
private final CharacterIDGuiceFactory factory;
/**
* @param allocator
* the id allocator
* @param idService
* the world id service
* @param factory
* the character id factory
*/
@Inject
public CharacterIDProvider(IDAllocator allocator, WorldIDService idService,
CharacterIDGuiceFactory factory) {

View File

@@ -42,6 +42,14 @@ public class ClanIDProvider implements ObjectIDProvider<ClanID> {
*/
private final ClanIDGuiceFactory factory;
/**
* @param allocator
* the id allocator
* @param idService
* the world id service
* @param factory
* the clan id factory
*/
@Inject
public ClanIDProvider(IDAllocator allocator, WorldIDService idService,
ClanIDGuiceFactory factory) {

View File

@@ -42,6 +42,14 @@ public class ItemIDProvider implements ObjectIDProvider<ItemID> {
*/
private final ItemIDGuiceFactory factory;
/**
* @param allocator
* the id allocator
* @param idService
* the world id service
* @param factory
* the item id factory
*/
@Inject
public ItemIDProvider(IDAllocator allocator, WorldIDService idService,
ItemIDGuiceFactory factory) {

View File

@@ -42,6 +42,14 @@ public class NPCIDProvider implements ObjectIDProvider<NPCID> {
*/
private final NPCIDGuiceFactory factory;
/**
* @param allocator
* the id allocator
* @param idService
* the world id service
* @param factory
* the npc id factory
*/
@Inject
public NPCIDProvider(IDAllocator allocator, WorldIDService idService,
NPCIDGuiceFactory factory) {

View File

@@ -19,6 +19,12 @@ package com.l2jserver.model.id.object.provider;
import com.l2jserver.model.id.ObjectID;
import com.l2jserver.model.id.provider.IDProvider;
/**
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
* @param <T>
* the ID type provided
*/
public interface ObjectIDProvider<T extends ObjectID<?>> extends
IDProvider<Integer, T> {
/**

View File

@@ -55,6 +55,10 @@ public class ObjectIDResolver implements ObjectIDProvider<ObjectID<?>> {
*/
private final WorldIDService idService;
/**
* @param idService
* the world id service
*/
@Inject
public ObjectIDResolver(WorldIDService idService) {
this.idService = idService;
@@ -64,6 +68,7 @@ public class ObjectIDResolver implements ObjectIDProvider<ObjectID<?>> {
* Resolvers do not support creating new IDs
*
* @throws UnsupportedOperationException
* always
*/
@Override
public ObjectID<?> createID() {
@@ -94,6 +99,7 @@ public class ObjectIDResolver implements ObjectIDProvider<ObjectID<?>> {
* Resolvers do not support destroying IDs
*
* @throws UnsupportedOperationException
* always
*/
@Override
public void destroy(ObjectID<?> id) {

View File

@@ -42,6 +42,14 @@ public class PetIDProvider implements ObjectIDProvider<PetID> {
*/
private final PetIDGuiceFactory factory;
/**
* @param allocator
* the id allocator
* @param idService
* the world id service
* @param factory
* the pet id factory
*/
@Inject
public PetIDProvider(IDAllocator allocator, WorldIDService idService,
PetIDGuiceFactory factory) {

View File

@@ -24,6 +24,12 @@ import com.l2jserver.model.id.compound.AbstractCompoundID;
* The ID factory is used to create instances of IDs. It will automatically make
* sure the ID is free before allocating it.
*
* @param <I1>
* the first compound {@link ID} type
* @param <I2>
* the second compound {@link ID} type
* @param <T>
* the {@link CompoundIDProvider} type
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface CompoundIDProvider<I1 extends ID<?>, I2 extends ID<?>, T extends AbstractCompoundID<I1, I2>> {

View File

@@ -31,6 +31,10 @@ import com.l2jserver.model.id.ID;
* object will be created and following calls will always return the same
* object.
*
* @param <I>
* the raw id type
* @param <T>
* the {@link ID} implementation
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface IDProvider<I, T extends ID<I>> {
@@ -38,7 +42,8 @@ public interface IDProvider<I, T extends ID<I>> {
* Creates the ID object for an <b>EXISTING</b> ID.
*
* @param id
* @return
* the raw id value
* @return the resolved {@link ID} object
*/
T resolveID(I id);
}

View File

@@ -27,6 +27,8 @@ import com.l2jserver.service.game.template.TemplateService;
/**
* An {@link TemplateID} instance representing an {@link ActorTemplate} object
*
* @param <T>
* the type of {@link ActorTemplate} this {@link TemplateID} represents
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class ActorTemplateID<T extends ActorTemplate<?>> extends
@@ -36,6 +38,10 @@ public class ActorTemplateID<T extends ActorTemplate<?>> extends
*/
private transient final TemplateService templateService;
/**
* @param id the raw id
* @param templateService the template service
*/
@Inject
protected ActorTemplateID(@Assisted int id, TemplateService templateService) {
super(id);

View File

@@ -29,6 +29,10 @@ import com.l2jserver.service.game.template.TemplateService;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CharacterTemplateID extends ActorTemplateID<CharacterTemplate> {
/**
* @param id the raw id
* @param templateService the template service
*/
@Inject
public CharacterTemplateID(@Assisted int id, TemplateService templateService) {
super(id, templateService);

View File

@@ -36,8 +36,11 @@ public class ItemTemplateID extends TemplateID<ItemTemplate, Integer> {
*/
private final TemplateService templateService;
/**
* @param id the raw id
* @param templateService the template service
*/
@Inject
// FIXME this should be protected
public ItemTemplateID(@Assisted int id, TemplateService templateService) {
super(id);
this.templateService = templateService;

View File

@@ -32,6 +32,10 @@ import com.l2jserver.util.jaxb.NPCTemplateIDAdapter;
*/
@XmlJavaTypeAdapter(value = NPCTemplateIDAdapter.class)
public class NPCTemplateID extends ActorTemplateID<NPCTemplate> {
/**
* @param id the raw id
* @param templateService the template service
*/
@Inject
public NPCTemplateID(@Assisted int id, TemplateService templateService) {
super(id, templateService);

View File

@@ -33,6 +33,10 @@ public class SkillTemplateID extends TemplateID<SkillTemplate, Integer> {
*/
private final TemplateService templateService;
/**
* @param id the raw id
* @param templateService the template service
*/
@Inject
public SkillTemplateID(@Assisted int id, TemplateService templateService) {
super(id);

View File

@@ -39,6 +39,10 @@ public class TeleportationTemplateID extends
*/
private final TemplateService templateService;
/**
* @param id the raw id
* @param templateService the template service
*/
@Inject
public TeleportationTemplateID(@Assisted int id,
TemplateService templateService) {

View File

@@ -22,10 +22,11 @@ import com.l2jserver.model.id.provider.IDProvider;
/**
* Creates a new {@link TemplateID}
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
* @param <I>
* the raw id type
* @param <T>
* the subclass of {@link TemplateID} that will be createdF
* the subclass of {@link TemplateID} that will be created
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface TemplateIDProvider<I, T extends TemplateID<?, I>> extends
IDProvider<I, T> {

View File

@@ -73,6 +73,10 @@ public class AttackHit {
*/
public final byte flag;
/**
* @param flag
* the bitset flag
*/
AttackHitFlag(byte flag) {
this.flag = flag;
}

View File

@@ -24,11 +24,23 @@ import com.l2jserver.util.calculator.ComplexCalculator;
*/
public class AttackCalculator extends
ComplexCalculator<AttackCalculatorContext, AttackCalculatorType> {
/**
* @param functions
* the functions
*/
public AttackCalculator(AttackCalculatorFunction... functions) {
super(AttackCalculatorType.class, functions);
}
/**
* The calculator attributes
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum AttackCalculatorType {
/**
* Calculates the damage dealt by the attack
*/
DAMAGE;
}
}

View File

@@ -23,9 +23,21 @@ import com.l2jserver.util.calculator.CalculatorContext;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class AttackCalculatorContext extends CalculatorContext {
/**
* The attacker actor
*/
public final Actor attacker;
/**
* The target actor
*/
public final Actor target;
/**
* @param attacker
* the attacker
* @param target
* the target
*/
public AttackCalculatorContext(Actor attacker, Actor target) {
this.attacker = attacker;
this.target = target;

View File

@@ -25,6 +25,12 @@ import com.l2jserver.util.calculator.AbstractDoubleFunction;
*/
public abstract class AttackCalculatorFunction extends
AbstractDoubleFunction<AttackCalculatorContext, AttackCalculatorType> {
/**
* @param order
* the calculation order
* @param type
* the function attribute
*/
public AttackCalculatorFunction(int order, AttackCalculatorType type) {
super(order, type);
}
@@ -34,5 +40,14 @@ public abstract class AttackCalculatorFunction extends
return calculate(ctx.attacker, ctx.target, value);
}
/**
* @param attacker
* the attacker
* @param target
* the target
* @param value
* the original value
* @return the calculated value
*/
public abstract double calculate(Actor attacker, Actor target, double value);
}

View File

@@ -24,6 +24,9 @@ import com.l2jserver.model.world.Actor;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class PhysicalAttackCalculator extends AttackCalculator {
/**
* Creates a new instance
*/
public PhysicalAttackCalculator() {
super(new AttackCalculatorFunction(0x000, AttackCalculatorType.DAMAGE) {
@Override

View File

@@ -24,6 +24,8 @@ import com.l2jserver.model.world.Actor;
/**
* Template for {@link Actor}
*
* @param <T>
* the {@link Actor} type this template is for
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class ActorTemplate<T extends Actor> extends
@@ -42,5 +44,10 @@ public abstract class ActorTemplate<T extends Actor> extends
return actor;
}
/**
* Creates a new instance
*
* @return the created template instance
*/
protected abstract T createInstance();
}

View File

@@ -207,6 +207,9 @@ public class CharacterTemplate extends ActorTemplate<L2Character> {
return stats.crafter;
}
/**
* @return the base HP
*/
public double getBaseHP() {
if (stats == null)
return 0;
@@ -215,6 +218,9 @@ public class CharacterTemplate extends ActorTemplate<L2Character> {
return stats.hp.base;
}
/**
* @return the base HP modifier
*/
public double getBaseHPModifier() {
if (stats == null)
return 0;
@@ -223,6 +229,9 @@ public class CharacterTemplate extends ActorTemplate<L2Character> {
return stats.hp.modifier;
}
/**
* @return the base HP add
*/
public double getBaseHPAdd() {
if (stats == null)
return 0;
@@ -231,7 +240,10 @@ public class CharacterTemplate extends ActorTemplate<L2Character> {
return stats.hp.add;
}
public double getBaseBaseMP() {
/**
* @return the base MP
*/
public double getBaseMP() {
if (stats == null)
return 0;
if (stats.mp == null)
@@ -239,6 +251,9 @@ public class CharacterTemplate extends ActorTemplate<L2Character> {
return stats.mp.base;
}
/**
* @return the base MP modifier
*/
public double getBaseMPModifier() {
if (stats == null)
return 0;
@@ -247,6 +262,9 @@ public class CharacterTemplate extends ActorTemplate<L2Character> {
return stats.mp.modifier;
}
/**
* @return the base MP add
*/
public double getBaseMPAdd() {
if (stats == null)
return 0;
@@ -255,6 +273,9 @@ public class CharacterTemplate extends ActorTemplate<L2Character> {
return stats.mp.add;
}
/**
* @return the base CP
*/
public double getBaseCP() {
if (stats == null)
return 0;
@@ -263,6 +284,9 @@ public class CharacterTemplate extends ActorTemplate<L2Character> {
return stats.cp.base;
}
/**
* @return the base CP modifier
*/
public double getBaseCPModifier() {
if (stats == null)
return 0;
@@ -271,6 +295,9 @@ public class CharacterTemplate extends ActorTemplate<L2Character> {
return stats.cp.modifier;
}
/**
* @return the base CP add
*/
public double getBaseCPAdd() {
if (stats == null)
return 0;
@@ -390,6 +417,9 @@ public class CharacterTemplate extends ActorTemplate<L2Character> {
return stats.attack.magical.speed;
}
/**
* @return the base run speed
*/
public double getBaseRunSpeed() {
if (stats == null)
return 0;
@@ -398,6 +428,9 @@ public class CharacterTemplate extends ActorTemplate<L2Character> {
return stats.move.run;
}
/**
* @return the base walk speed
*/
public double getBaseWalkSpeed() {
if (stats == null)
return 0;
@@ -481,6 +514,9 @@ public class CharacterTemplate extends ActorTemplate<L2Character> {
return stats.maximumLoad;
}
/**
* @return the male collision radius
*/
public double getMaleCollisionRadius() {
if (collision == null)
return 0;
@@ -489,6 +525,9 @@ public class CharacterTemplate extends ActorTemplate<L2Character> {
return collision.male.radius;
}
/**
* @return the male collision height
*/
public double getMaleCollisionHeight() {
if (collision == null)
return 0;
@@ -497,6 +536,9 @@ public class CharacterTemplate extends ActorTemplate<L2Character> {
return collision.male.height;
}
/**
* @return the female collision radius
*/
public double getFemaleCollisionRadius() {
if (collision == null)
return 0;
@@ -505,6 +547,9 @@ public class CharacterTemplate extends ActorTemplate<L2Character> {
return collision.female.radius;
}
/**
* @return the female collision height
*/
public double getFemaleCollisionHeight() {
if (collision == null)
return 0;

View File

@@ -57,6 +57,14 @@ public class SkillTemplate extends AbstractTemplate<Skill> {
return create(null);
}
/**
* Creates a new instance
*
* @param actorID
* the actor ID
*
* @return the created template instance
*/
public Skill create(ActorID<?> actorID) {
final Skill skill = new Skill(id);
if (actorID != null)

View File

@@ -7,14 +7,33 @@ package com.l2jserver.model.template.actor;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum ActorSex {
MALE(0x00), FEMALE(0x01);
/**
* Represents an male character
*/
MALE(0x00),
/**
* Represents an female character
*/
FEMALE(0x01);
/**
* The numeric sex option
*/
public final int option;
/**
* @param option
* the numeric sex option
*/
ActorSex(int option) {
this.option = option;
}
/**
* @param option
* the numeric sex option
* @return the resolved {@link ActorSex}
*/
public static ActorSex fromOption(int option) {
for (ActorSex sex : values()) {
if (sex.option == option)

View File

@@ -27,8 +27,17 @@ import com.l2jserver.model.world.actor.stat.StatType;
*
*/
public class ItemSetActorCalculator extends ActorFormula {
/**
* The stat set
*/
private final StatSet set;
/**
* @param set
* the stat set
* @param type
* the stat type
*/
public ItemSetActorCalculator(StatSet set, StatType type) {
super(set.getOrder(), type);
this.set = set;

View File

@@ -24,13 +24,16 @@ import com.l2jserver.util.exception.L2Exception;
/**
* Defines an {@link Template} which the player can interact with
*
* @param <T>
* the interable {@link WorldObject} type
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
*/
public interface Interactable<T extends WorldObject> extends TemplateCapability {
/**
* Performs an interaction with this template.
*
* @param object
* the object to interact with
* @param character
* the interacting character
* @param args

View File

@@ -13,6 +13,9 @@ public enum CharacterRace {
*/
public final int id;
/**
* @param id the race numeric id
*/
CharacterRace(int id) {
this.id = id;
}

View File

@@ -133,6 +133,10 @@ public enum ItemType {
*/
public final int id;
/**
* @param id
* the numeric id
*/
ItemType(int id) {
this.id = id;
}

View File

@@ -78,12 +78,12 @@ public enum WeaponType {
DUALDAGGER(StatType.DUALDAGGER_WPN_VULN);
/**
* This weapon type weaknesses
* This weapon type of weaknesses
*/
public final StatType weaknessesStat;
/**
* @param weaknesses
* @param weaknessesStat
* the weapon weaknesses
*/
WeaponType(StatType weaknessesStat) {

View File

@@ -16,6 +16,7 @@
*/
package com.l2jserver.model.world;
import com.l2jserver.model.id.TemplateID;
import com.l2jserver.model.id.object.ActorID;
import com.l2jserver.model.id.template.ActorTemplateID;
import com.l2jserver.model.template.ActorTemplate;
@@ -30,6 +31,9 @@ import com.l2jserver.model.world.actor.stat.ActorStats;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class Actor extends PositionableObject {
/**
* The {@link Actor} {@link TemplateID}
*/
protected ActorTemplateID<?> templateID;
/**
@@ -101,10 +105,17 @@ public abstract class Actor extends PositionableObject {
*/
protected final ActorSkillContainer skills = new ActorSkillContainer(this);
/**
* @param templateID
* the actor template id
*/
protected Actor(ActorTemplateID<?> templateID) {
this.templateID = templateID;
}
/**
* @return the actor stats
*/
public abstract ActorStats<?> getStats();
/**
@@ -267,6 +278,9 @@ public abstract class Actor extends PositionableObject {
return effects;
}
/**
* @return the actor skills
*/
public ActorSkillContainer getSkills() {
return skills;
}

View File

@@ -69,6 +69,9 @@ public class Item extends PositionableObject {
*/
private long count = 1;
/**
* @param templateID the item template id
*/
public Item(ItemTemplateID templateID) {
this.templateID = templateID;
}

View File

@@ -136,10 +136,25 @@ public class L2Character extends Player {
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public enum CharacterMoveType {
RUN(0x01), WALK(0x00);
/**
* Run mode
*/
RUN(0x01),
/**
* Walk mode
*/
WALK(0x00);
/**
* The move mode numeric id
*/
public final int id;
/**
* @param id
* the mode numeric id
*/
CharacterMoveType(int id) {
this.id = id;
}
@@ -158,8 +173,8 @@ public class L2Character extends Player {
/**
* Creates a new instance
*
* @param baseAttributes
* the base attribute for this character
* @param templateID
* the {@link CharacterTemplateID}
*/
public L2Character(CharacterTemplateID templateID) {
super(templateID);

View File

@@ -93,18 +93,32 @@ public class NPC extends Actor {
throw new UnsupportedOperationException();
}
/**
* @return the maximum HP
*/
public double getMaxHP() {
return this.getTemplate().getMaximumHP();
}
/**
* @param maxHP the maximum HP
* @throws UnsupportedOperationException always
*/
public void setMaxHP(double maxHP) {
throw new UnsupportedOperationException();
}
/**
* @return the maximum MP
*/
public double getMaxMP() {
return this.getTemplate().getMaximumMP();
}
/**
* @param maxMP the maximum MP
* @throws UnsupportedOperationException always
*/
public void setMaxMP(double maxMP) {
throw new UnsupportedOperationException();
}

View File

@@ -36,6 +36,9 @@ public class Pet extends Player {
*/
private ItemID itemID;
/**
* @param templateID the pet template id
*/
public Pet(ActorTemplateID<?> templateID) {
super(templateID);
}

View File

@@ -25,6 +25,9 @@ import com.l2jserver.model.id.template.ActorTemplateID;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class Player extends Actor {
/**
* @param templateID the actor template id
*/
public Player(ActorTemplateID<?> templateID) {
super(templateID);
}

View File

@@ -47,10 +47,16 @@ public abstract class PositionableObject extends AbstractObject {
this.point = point;
}
/**
* @return the position coodinate
*/
public Coordinate getPosition() {
return point.getCoordinate();
}
/**
* @param coord sets the current position
*/
public void setPosition(Coordinate coord) {
desireUpdate();
this.point = new Point3D(coord, (point != null ? point.getAngle() : 0));

View File

@@ -78,6 +78,9 @@ public enum ActorExperience {
*/
public final int level;
/**
* @param experience the minimum experience for the level
*/
ActorExperience(long experience) {
this.experience = experience;
this.level = this.ordinal();

View File

@@ -25,8 +25,12 @@ import com.l2jserver.util.calculator.ComplexCalculator;
*/
public class ActorCalculator extends
ComplexCalculator<ActorCalculatorContext, StatType> {
public ActorCalculator(Class<StatType> type,
/**
* @param calculators
* the calculators
*/
public ActorCalculator(
Calculator<ActorCalculatorContext, StatType>... calculators) {
super(type, calculators);
super(StatType.class, calculators);
}
}

View File

@@ -29,6 +29,10 @@ public class ActorCalculatorContext extends CalculatorContext {
*/
public final Actor actor;
/**
* @param actor
* the actor
*/
public ActorCalculatorContext(Actor actor) {
this.actor = actor;
}

View File

@@ -28,6 +28,12 @@ import com.l2jserver.util.calculator.AbstractDoubleFunction;
*/
public abstract class ActorCalculatorFunction extends
AbstractDoubleFunction<ActorCalculatorContext, StatType> {
/**
* @param order
* the calculation order
* @param type
* the stat type
*/
public ActorCalculatorFunction(int order, StatType type) {
super(order, type);
}
@@ -37,6 +43,15 @@ public abstract class ActorCalculatorFunction extends
return calculate(ctx.actor, ctx.actor.getTemplate(), value);
}
/**
* @param a
* the actor
* @param t
* the actor template
* @param value
* the original value
* @return the calculated value
*/
protected abstract double calculate(Actor a, ActorTemplate<?> t,
double value);
}

View File

@@ -22,6 +22,12 @@ import com.l2jserver.model.world.actor.stat.StatType;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class ActorFormula extends ActorCalculatorFunction {
/**
* @param order
* the calculation order
* @param type
* the stat type
*/
public ActorFormula(int order, StatType type) {
super(order, type);
}

View File

@@ -38,6 +38,9 @@ import com.l2jserver.model.world.actor.stat.StatType;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class AttackAccuracyBonusCalculator extends ActorFormula {
/**
* Creates a new instance
*/
public AttackAccuracyBonusCalculator() {
super(0x200, StatType.ACCURACY_COMBAT);
}

View File

@@ -38,6 +38,9 @@ import com.l2jserver.model.world.actor.stat.StatType;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class AttackEvasionBonusCalculator extends ActorFormula {
/**
* Creates a new instance
*/
public AttackEvasionBonusCalculator() {
super(0x200, StatType.EVASION_RATE);
}

View File

@@ -32,6 +32,9 @@ import com.l2jserver.model.world.actor.stat.StatType;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class MagicalAttackBonusCalculator extends ActorFormula {
/**
* Creates a new instance
*/
public MagicalAttackBonusCalculator() {
super(0x200, StatType.MAGIC_ATTACK);
}

View File

@@ -32,6 +32,9 @@ import com.l2jserver.model.world.actor.stat.StatType;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class MagicalAttackSpeedBonusCalculator extends ActorFormula {
/**
* Creates a new instance
*/
public MagicalAttackSpeedBonusCalculator() {
super(0x200, StatType.MAGIC_ATTACK_SPEED);
}

View File

@@ -32,6 +32,9 @@ import com.l2jserver.model.world.actor.stat.StatType;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class MagicalCriticalRateBonusCalculator extends ActorFormula {
/**
* Creates a new instance
*/
public MagicalCriticalRateBonusCalculator() {
super(0x300, StatType.MCRITICAL_RATE);
}

View File

@@ -42,6 +42,9 @@ import com.l2jserver.model.world.actor.stat.StatType;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class MagicalDefenseBonusCalculator extends ActorFormula {
/**
* Creates a new instance
*/
public MagicalDefenseBonusCalculator() {
super(0x200, StatType.MAGIC_DEFENSE);
}

View File

@@ -31,6 +31,9 @@ import com.l2jserver.model.world.actor.stat.StatType;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class MaximumHPBonusCalculator extends ActorFormula {
/**
* Creates a new instance
*/
public MaximumHPBonusCalculator() {
super(0x200, StatType.MAX_HP);
}

View File

@@ -31,6 +31,9 @@ import com.l2jserver.model.world.actor.stat.StatType;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class MaximumMPBonusCalculator extends ActorFormula {
/**
* Creates a new instance
*/
public MaximumMPBonusCalculator() {
super(0x200, StatType.MAX_MP);
}

View File

@@ -33,6 +33,9 @@ import com.l2jserver.model.world.actor.stat.StatType;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class PhysicalAttackBonusCalculator extends ActorFormula {
/**
* Creates a new instance
*/
public PhysicalAttackBonusCalculator() {
super(0x100, StatType.POWER_ATTACK);
}

View File

@@ -32,6 +32,9 @@ import com.l2jserver.model.world.actor.stat.StatType;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class PhysicalAttackSpeedBonusCalculator extends ActorFormula {
/**
* Creates a new instance
*/
public PhysicalAttackSpeedBonusCalculator() {
super(0x200, StatType.POWER_ATTACK_SPEED);
}

View File

@@ -33,6 +33,9 @@ import com.l2jserver.model.world.actor.stat.StatType;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class PhysicalCriticalRateBonusCalculator extends ActorFormula {
/**
* Creates a new instance
*/
public PhysicalCriticalRateBonusCalculator() {
super(0x090, StatType.CRITICAL_RATE);
}

View File

@@ -43,6 +43,9 @@ import com.l2jserver.model.world.actor.stat.StatType;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class PhysicalDefenseBonusCalculator extends ActorFormula {
/**
* Creates a new instance
*/
public PhysicalDefenseBonusCalculator() {
super(0x200, StatType.POWER_DEFENSE);
}

View File

@@ -31,6 +31,9 @@ import com.l2jserver.model.world.actor.stat.StatType;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class RunSpeedBonusCalculator extends ActorFormula {
/**
* Creates a new instance
*/
public RunSpeedBonusCalculator() {
super(0x300, StatType.RUN_SPEED);
}

View File

@@ -31,6 +31,9 @@ import com.l2jserver.model.world.actor.stat.StatType;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class WalkSpeedBonusCalculator extends ActorFormula {
/**
* Creates a new instance
*/
public WalkSpeedBonusCalculator() {
super(0x300, StatType.WALK_SPEED);
}

View File

@@ -25,5 +25,8 @@ import com.l2jserver.service.game.world.event.WorldEvent;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface ActorEvent extends WorldEvent {
/**
* @return the event actor
*/
Actor getActor();
}

Some files were not shown because too many files have changed in this diff Show More