mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-06 07:32:46 +00:00
Source code cleanup
This commit is contained in:
@@ -409,6 +409,7 @@ public class FreyaLineage2Client implements Lineage2Client {
|
||||
return (Lineage2PacketWriter) channel.getPipeline().get(
|
||||
Lineage2PacketWriter.HANDLER_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Lineage2Client [channel=" + channel + ", characterID="
|
||||
|
||||
@@ -77,9 +77,12 @@ public class CM_CHAR_ACTION extends AbstractClientPacket {
|
||||
private CharacterAction action;
|
||||
|
||||
/**
|
||||
* @param idResolver the id resolver
|
||||
* @param npcService the npc service
|
||||
* @param itemService the item service
|
||||
* @param idResolver
|
||||
* the id resolver
|
||||
* @param npcService
|
||||
* the npc service
|
||||
* @param itemService
|
||||
* the item service
|
||||
*/
|
||||
@Inject
|
||||
public CM_CHAR_ACTION(ObjectIDResolver idResolver, NPCService npcService,
|
||||
|
||||
@@ -42,7 +42,8 @@ public class CM_CHAR_APPEARING extends AbstractClientPacket {
|
||||
private final SpawnService spawnService;
|
||||
|
||||
/**
|
||||
* @param spawnService the spawn service
|
||||
* @param spawnService
|
||||
* the spawn service
|
||||
*/
|
||||
@Inject
|
||||
public CM_CHAR_APPEARING(SpawnService spawnService) {
|
||||
|
||||
@@ -127,7 +127,8 @@ public class CM_CHAR_ATTACK extends AbstractClientPacket {
|
||||
* the object id resolver
|
||||
*/
|
||||
@Inject
|
||||
public CM_CHAR_ATTACK(CharacterService charService, ObjectIDResolver idResolver) {
|
||||
public CM_CHAR_ATTACK(CharacterService charService,
|
||||
ObjectIDResolver idResolver) {
|
||||
this.charService = charService;
|
||||
this.idResolver = idResolver;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,8 @@ public class CM_CHAR_CHAT extends AbstractClientPacket {
|
||||
private String target;
|
||||
|
||||
/**
|
||||
* @param chatService the chat service
|
||||
* @param chatService
|
||||
* the chat service
|
||||
*/
|
||||
@Inject
|
||||
public CM_CHAR_CHAT(ChatService chatService) {
|
||||
|
||||
@@ -66,6 +66,7 @@ public class CM_CHAR_MOVE extends AbstractClientPacket {
|
||||
|
||||
/**
|
||||
* Defines the movement action type
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum MovementType {
|
||||
@@ -84,14 +85,16 @@ public class CM_CHAR_MOVE extends AbstractClientPacket {
|
||||
public final int id;
|
||||
|
||||
/**
|
||||
* @param id the type id
|
||||
* @param id
|
||||
* the type id
|
||||
*/
|
||||
MovementType(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id the type id
|
||||
* @param id
|
||||
* the type id
|
||||
* @return the {@link MovementType} represented by <code>id</code>
|
||||
*/
|
||||
public static MovementType fromID(int id) {
|
||||
@@ -104,7 +107,8 @@ public class CM_CHAR_MOVE extends AbstractClientPacket {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param charService the character service
|
||||
* @param charService
|
||||
* the character service
|
||||
*/
|
||||
@Inject
|
||||
public CM_CHAR_MOVE(CharacterService charService) {
|
||||
|
||||
@@ -51,7 +51,8 @@ public class CM_CHAR_POSITION extends AbstractClientPacket {
|
||||
private int extra; // vehicle id
|
||||
|
||||
/**
|
||||
* @param charService the character service
|
||||
* @param charService
|
||||
* the character service
|
||||
*/
|
||||
@Inject
|
||||
public CM_CHAR_POSITION(CharacterService charService) {
|
||||
|
||||
@@ -51,7 +51,8 @@ public class CM_CHAR_SELECT extends AbstractClientPacket {
|
||||
private int slot;
|
||||
|
||||
/**
|
||||
* @param characterDao the character dao
|
||||
* @param characterDao
|
||||
* the character dao
|
||||
*/
|
||||
@Inject
|
||||
public CM_CHAR_SELECT(CharacterDAO characterDao) {
|
||||
|
||||
@@ -51,7 +51,8 @@ public class CM_ENTER_WORLD extends AbstractClientPacket {
|
||||
private final CharacterService characterService;
|
||||
|
||||
/**
|
||||
* @param characterService the character service
|
||||
* @param characterService
|
||||
* the character service
|
||||
*/
|
||||
@Inject
|
||||
public CM_ENTER_WORLD(CharacterService characterService) {
|
||||
|
||||
@@ -53,7 +53,8 @@ public class CM_GG_KEY extends AbstractClientPacket {
|
||||
private byte[] key = new byte[8];
|
||||
|
||||
/**
|
||||
* @param ggService the gameguard service
|
||||
* @param ggService
|
||||
* the gameguard service
|
||||
*/
|
||||
@Inject
|
||||
public CM_GG_KEY(GameGuardService ggService) {
|
||||
|
||||
@@ -49,7 +49,8 @@ public class CM_GOTO_LOBBY extends AbstractClientPacket {
|
||||
private final CharacterDAO characterDao;
|
||||
|
||||
/**
|
||||
* @param characterDao the character dao
|
||||
* @param characterDao
|
||||
* the character dao
|
||||
*/
|
||||
@Inject
|
||||
public CM_GOTO_LOBBY(CharacterDAO characterDao) {
|
||||
|
||||
@@ -97,7 +97,8 @@ public class CM_ITEM_DESTROY extends AbstractClientPacket {
|
||||
} else {
|
||||
conn.updateInventoryItems(item);
|
||||
}
|
||||
} catch (NotEnoughItemsServiceException | NonStackableItemsServiceException e) {
|
||||
} catch (NotEnoughItemsServiceException
|
||||
| NonStackableItemsServiceException e) {
|
||||
conn.sendSystemMessage(SystemMessage.CANNOT_DISCARD_THIS_ITEM);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,8 @@ public class CM_ITEM_DROP extends AbstractClientPacket {
|
||||
} catch (ItemAlreadyOnGroundServiceException
|
||||
| AlreadySpawnedServiceException
|
||||
| SpawnPointNotFoundServiceException
|
||||
| NotEnoughItemsServiceException | NonStackableItemsServiceException e) {
|
||||
| NotEnoughItemsServiceException
|
||||
| NonStackableItemsServiceException e) {
|
||||
conn.sendActionFailed();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,8 @@ public class CM_PROTOCOL_VERSION extends AbstractClientPacket {
|
||||
private ProtocolVersion version;
|
||||
|
||||
/**
|
||||
* @param keygen the keygen service
|
||||
* @param keygen
|
||||
* the keygen service
|
||||
*/
|
||||
@Inject
|
||||
public CM_PROTOCOL_VERSION(BlowfishKeygenService keygen) {
|
||||
@@ -84,7 +85,7 @@ public class CM_PROTOCOL_VERSION extends AbstractClientPacket {
|
||||
// generate a new key
|
||||
final Lineage2CryptographyKey inKey = new Lineage2CryptographyKey(
|
||||
keygen.generate());
|
||||
|
||||
|
||||
final FreyaLineage2Client client = (FreyaLineage2Client) conn;
|
||||
|
||||
client.getDecrypter().enable(inKey);
|
||||
|
||||
@@ -65,7 +65,8 @@ public class CM_REQUEST_CHAR_TEMPLATE extends AbstractClientPacket {
|
||||
private final CharacterTemplateIDProvider idFactory;
|
||||
|
||||
/**
|
||||
* @param idFactory the character template id provider
|
||||
* @param idFactory
|
||||
* the character template id provider
|
||||
*/
|
||||
@Inject
|
||||
public CM_REQUEST_CHAR_TEMPLATE(CharacterTemplateIDProvider idFactory) {
|
||||
|
||||
@@ -49,8 +49,10 @@ public class CM_RESTART extends AbstractClientPacket {
|
||||
private final CharacterDAO charDao;
|
||||
|
||||
/**
|
||||
* @param charService the character service
|
||||
* @param charDao the character dao
|
||||
* @param charService
|
||||
* the character service
|
||||
* @param charDao
|
||||
* the character dao
|
||||
*/
|
||||
@Inject
|
||||
public CM_RESTART(CharacterService charService, CharacterDAO charDao) {
|
||||
|
||||
@@ -55,11 +55,15 @@ public class SM_ACTOR_CHAT extends AbstractServerPacket {
|
||||
private int messageID = 0;
|
||||
|
||||
/**
|
||||
* @param character the actor
|
||||
* @param destination the destination
|
||||
* @param message the message
|
||||
* @param character
|
||||
* the actor
|
||||
* @param destination
|
||||
* the destination
|
||||
* @param message
|
||||
* the message
|
||||
*/
|
||||
public SM_ACTOR_CHAT(Actor character, ChatMessageType destination, String message) {
|
||||
public SM_ACTOR_CHAT(Actor character, ChatMessageType destination,
|
||||
String message) {
|
||||
super(OPCODE);
|
||||
this.actor = character;
|
||||
this.destination = destination;
|
||||
@@ -67,9 +71,12 @@ public class SM_ACTOR_CHAT extends AbstractServerPacket {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param actor the actor
|
||||
* @param destination the destination
|
||||
* @param messageID the message id
|
||||
* @param actor
|
||||
* the actor
|
||||
* @param destination
|
||||
* the destination
|
||||
* @param messageID
|
||||
* the message id
|
||||
*/
|
||||
public SM_ACTOR_CHAT(Actor actor, ChatMessageType destination, int messageID) {
|
||||
super(OPCODE);
|
||||
|
||||
@@ -46,8 +46,10 @@ public class SM_ACTOR_MOVE extends AbstractServerPacket {
|
||||
private Coordinate target;
|
||||
|
||||
/**
|
||||
* @param actor the actor
|
||||
* @param target the target
|
||||
* @param actor
|
||||
* the actor
|
||||
* @param target
|
||||
* the target
|
||||
*/
|
||||
public SM_ACTOR_MOVE(Actor actor, Coordinate target) {
|
||||
super(OPCODE);
|
||||
|
||||
@@ -40,7 +40,8 @@ public class SM_ACTOR_POSITION extends AbstractServerPacket {
|
||||
private final Actor actor;
|
||||
|
||||
/**
|
||||
* @param actor the actor
|
||||
* @param actor
|
||||
* the actor
|
||||
*/
|
||||
public SM_ACTOR_POSITION(Actor actor) {
|
||||
super(OPCODE);
|
||||
|
||||
@@ -77,7 +77,8 @@ public class SM_CHAR_INFO extends AbstractServerPacket {
|
||||
private L2Character character;
|
||||
|
||||
/**
|
||||
* @param character the character
|
||||
* @param character
|
||||
* the character
|
||||
*/
|
||||
public SM_CHAR_INFO(L2Character character) {
|
||||
super(OPCODE);
|
||||
|
||||
@@ -39,7 +39,8 @@ public class SM_CHAR_INFO_EXTRA extends AbstractServerPacket {
|
||||
private L2Character character;
|
||||
|
||||
/**
|
||||
* @param character the character
|
||||
* @param character
|
||||
* the character
|
||||
*/
|
||||
public SM_CHAR_INFO_EXTRA(L2Character character) {
|
||||
super(OPCODE);
|
||||
|
||||
@@ -45,7 +45,8 @@ public class SM_CHAR_INVENTORY extends AbstractServerPacket {
|
||||
private boolean showWindow = false;
|
||||
|
||||
/**
|
||||
* @param inventory the inventory
|
||||
* @param inventory
|
||||
* the inventory
|
||||
*/
|
||||
public SM_CHAR_INVENTORY(CharacterInventory inventory) {
|
||||
super(OPCODE);
|
||||
|
||||
@@ -39,7 +39,8 @@ public class SM_CHAR_MOVE_TYPE extends AbstractServerPacket {
|
||||
private final L2Character character;
|
||||
|
||||
/**
|
||||
* @param character the character
|
||||
* @param character
|
||||
* the character
|
||||
*/
|
||||
public SM_CHAR_MOVE_TYPE(L2Character character) {
|
||||
super(OPCODE);
|
||||
|
||||
@@ -38,7 +38,8 @@ public class SM_CHAR_OPEN_MAP extends AbstractServerPacket {
|
||||
private final int mapID;
|
||||
|
||||
/**
|
||||
* @param mapID the map id
|
||||
* @param mapID
|
||||
* the map id
|
||||
*/
|
||||
public SM_CHAR_OPEN_MAP(int mapID) {
|
||||
super(OPCODE);
|
||||
|
||||
@@ -42,7 +42,8 @@ public class SM_CHAR_SELECTED extends AbstractServerPacket {
|
||||
private final L2Character character;
|
||||
|
||||
/**
|
||||
* @param character the character
|
||||
* @param character
|
||||
* the character
|
||||
*/
|
||||
public SM_CHAR_SELECTED(L2Character character) {
|
||||
super(OPCODE);
|
||||
|
||||
@@ -39,7 +39,8 @@ public class SM_CHAR_STOP extends AbstractServerPacket {
|
||||
private L2Character character;
|
||||
|
||||
/**
|
||||
* @param character the character
|
||||
* @param character
|
||||
* the character
|
||||
*/
|
||||
public SM_CHAR_STOP(L2Character character) {
|
||||
super(OPCODE);
|
||||
|
||||
@@ -40,7 +40,8 @@ public class SM_CHAR_TARGET_UNSELECT extends AbstractServerPacket {
|
||||
private final L2Character character;
|
||||
|
||||
/**
|
||||
* @param character the character
|
||||
* @param character
|
||||
* the character
|
||||
*/
|
||||
public SM_CHAR_TARGET_UNSELECT(L2Character character) {
|
||||
super(OPCODE);
|
||||
|
||||
@@ -45,8 +45,10 @@ public class SM_CHAR_TELEPORT extends AbstractServerPacket {
|
||||
private final Point3D point;
|
||||
|
||||
/**
|
||||
* @param character the character
|
||||
* @param point the teleport point
|
||||
* @param character
|
||||
* the character
|
||||
* @param point
|
||||
* the teleport point
|
||||
*/
|
||||
public SM_CHAR_TELEPORT(L2Character character, Point3D point) {
|
||||
super(OPCODE);
|
||||
|
||||
@@ -42,7 +42,8 @@ public class SM_COMMUNITY_HTML extends AbstractServerPacket {
|
||||
private final String html;
|
||||
|
||||
/**
|
||||
* @param html the html
|
||||
* @param html
|
||||
* the html
|
||||
*/
|
||||
public SM_COMMUNITY_HTML(String html) {
|
||||
super(OPCODE);
|
||||
@@ -50,7 +51,8 @@ public class SM_COMMUNITY_HTML extends AbstractServerPacket {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param html the html
|
||||
* @param html
|
||||
* the html
|
||||
*/
|
||||
public SM_COMMUNITY_HTML(Html html) {
|
||||
super(OPCODE);
|
||||
@@ -58,7 +60,8 @@ public class SM_COMMUNITY_HTML extends AbstractServerPacket {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param template the html template
|
||||
* @param template
|
||||
* the html template
|
||||
*/
|
||||
public SM_COMMUNITY_HTML(HtmlTemplate template) {
|
||||
super(OPCODE);
|
||||
|
||||
@@ -38,7 +38,8 @@ public class SM_ITEM_GROUND extends AbstractServerPacket {
|
||||
private final Item item;
|
||||
|
||||
/**
|
||||
* @param item the item that is on the ground
|
||||
* @param item
|
||||
* the item that is on the ground
|
||||
*/
|
||||
public SM_ITEM_GROUND(Item item) {
|
||||
super(OPCODE);
|
||||
@@ -47,7 +48,8 @@ public class SM_ITEM_GROUND extends AbstractServerPacket {
|
||||
|
||||
@Override
|
||||
public void write(Lineage2Client conn, ChannelBuffer buffer) {
|
||||
buffer.writeInt((item.getOwnerID() != null ? item.getOwnerID().getID() : 0)); // char who dropped
|
||||
buffer.writeInt((item.getOwnerID() != null ? item.getOwnerID().getID()
|
||||
: 0)); // char who dropped
|
||||
buffer.writeInt(item.getID().getID()); // item obj id
|
||||
buffer.writeInt(item.getTemplateID().getID()); // item template id
|
||||
|
||||
|
||||
@@ -39,7 +39,8 @@ public class SM_MANOR_LIST extends AbstractServerPacket {
|
||||
private String[] manors;
|
||||
|
||||
/**
|
||||
* @param manors the manors
|
||||
* @param manors
|
||||
* the manors
|
||||
*/
|
||||
public SM_MANOR_LIST(String... manors) {
|
||||
super(OPCODE);
|
||||
|
||||
@@ -55,7 +55,8 @@ public class SM_SERVER_OBJECT extends AbstractServerPacket {
|
||||
|
||||
buffer.writeInt(npc.getID().getID()); // obj id
|
||||
buffer.writeInt(npc.getTemplateID().getID() + 1000000); // template id
|
||||
BufferUtils.writeString(buffer, template.getInfo().getName().getValue()); // name
|
||||
BufferUtils
|
||||
.writeString(buffer, template.getInfo().getName().getValue()); // name
|
||||
buffer.writeInt((template.getInfo().isAttackable() ? 0x01 : 0x00)); // attackable
|
||||
buffer.writeInt(npc.getPoint().getX()); // x
|
||||
buffer.writeInt(npc.getPoint().getY()); // y
|
||||
@@ -65,7 +66,8 @@ public class SM_SERVER_OBJECT extends AbstractServerPacket {
|
||||
buffer.writeDouble(0x01); // attack spd mult
|
||||
buffer.writeDouble(template.getInfo().getCollision().getRadius());
|
||||
buffer.writeDouble(template.getInfo().getCollision().getHeigth());
|
||||
buffer.writeInt((int) (template.getInfo().isAttackable() ? npc.getHP() : 0x00));
|
||||
buffer.writeInt((int) (template.getInfo().isAttackable() ? npc.getHP()
|
||||
: 0x00));
|
||||
buffer.writeInt((int) (template.getInfo().isAttackable() ? template
|
||||
.getInfo().getStats().getHp() : 0x00));
|
||||
buffer.writeInt(0x01); // object type
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* This file is part of l2jserver2 <l2jserver2.com>.
|
||||
*
|
||||
* l2jserver2 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.
|
||||
*
|
||||
* l2jserver2 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 l2jserver2. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.service.network.gameguard;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.service.Service;
|
||||
import com.l2jserver.service.network.model.Lineage2Client;
|
||||
|
||||
/**
|
||||
* This service is responsible for querying and validating GameGuard packets
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public interface GameGuardService extends Service {
|
||||
/**
|
||||
* Queries the client GameGuard for an response
|
||||
*
|
||||
* @param character
|
||||
* the lineage 2 character
|
||||
* @return an future that will be used to obtain validation status
|
||||
*/
|
||||
Future<GameGuardResponse> query(L2Character character);
|
||||
|
||||
/**
|
||||
* The Game guard key state
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public enum GameGuardResponse {
|
||||
/**
|
||||
* Key is valid
|
||||
*/
|
||||
VALID,
|
||||
/**
|
||||
* Key is not valid
|
||||
*/
|
||||
INVALID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the game guard key for the given connection. Future will be notified
|
||||
* of the key state (valid or invalid).
|
||||
*
|
||||
* @param conn
|
||||
* the connection
|
||||
* @param key
|
||||
* the key
|
||||
* @return the validation state
|
||||
*/
|
||||
GameGuardResponse key(Lineage2Client conn, byte[] key);
|
||||
}
|
||||
Reference in New Issue
Block a user