1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-10 09:22:49 +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

@@ -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() {