mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-10 09:22:49 +00:00
Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
@@ -26,6 +26,7 @@ public enum ProtocolVersion {
|
||||
* Release version
|
||||
*/
|
||||
RELEASE(0),
|
||||
|
||||
/**
|
||||
* Freya(216)
|
||||
*/
|
||||
|
||||
@@ -40,7 +40,7 @@ import com.l2jserver.game.net.packet.client.RequestCharacterTemplatesPacket;
|
||||
import com.l2jserver.game.net.packet.client.RequestGotoLobbyPacket;
|
||||
import com.l2jserver.game.net.packet.client.RequestKeyMappingPacket;
|
||||
import com.l2jserver.game.net.packet.client.RequestManorListPacket;
|
||||
import com.l2jserver.game.net.packet.client.RequestMoveBackwardToLocationPacket;
|
||||
import com.l2jserver.game.net.packet.client.CharacterRequestMovePacket;
|
||||
import com.l2jserver.game.net.packet.client.RequestRestartPacket;
|
||||
|
||||
/**
|
||||
@@ -150,8 +150,8 @@ public class Lineage2PacketReader extends OneToOneDecoder {
|
||||
break;
|
||||
case CharacterSelectPacket.OPCODE:
|
||||
return CharacterSelectPacket.class;
|
||||
case RequestMoveBackwardToLocationPacket.OPCODE:
|
||||
return RequestMoveBackwardToLocationPacket.class;
|
||||
case CharacterRequestMovePacket.OPCODE:
|
||||
return CharacterRequestMovePacket.class;
|
||||
case RequestRestartPacket.OPCODE:
|
||||
return RequestRestartPacket.class;
|
||||
case CharacterChatMessagePacket.OPCODE:
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* 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.game.net.packet.client;
|
||||
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.l2jserver.game.net.Lineage2Connection;
|
||||
import com.l2jserver.game.net.packet.AbstractClientPacket;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.model.world.L2Character.CharacterMoveType;
|
||||
import com.l2jserver.service.game.CharacterService;
|
||||
|
||||
/**
|
||||
* This packet notifies the server which character the player has chosen to use.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterRequestActionUse extends AbstractClientPacket {
|
||||
/**
|
||||
* The packet OPCODE
|
||||
*/
|
||||
public static final int OPCODE = 0x56;
|
||||
|
||||
/**
|
||||
* The {@link CharacterService}
|
||||
*/
|
||||
private final CharacterService charService;
|
||||
|
||||
private Action action;
|
||||
|
||||
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),
|
||||
|
||||
PET_UNSUMMON(19),
|
||||
|
||||
MOUNT_DISMOUNT(38),
|
||||
|
||||
WILD_HOG_CANNON_SWITCH_MODE(32), WILD_HOG_CANNON_STOP(41),
|
||||
|
||||
SOULESS_TOXIC_SMOKE(36), SOULESS_PARASITE_BURST(39),
|
||||
|
||||
DWARVEN_MANUFACTURE(37);
|
||||
|
||||
public final int id;
|
||||
|
||||
Action(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public static Action fromID(int id) {
|
||||
for (final Action action : values())
|
||||
if (action.id == id)
|
||||
return action;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean ctrlPressed;
|
||||
private boolean shiftPressed;
|
||||
|
||||
@Inject
|
||||
public CharacterRequestActionUse(CharacterService charService) {
|
||||
this.charService = charService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(Lineage2Connection conn, ChannelBuffer buffer) {
|
||||
action = Action.fromID(buffer.readInt());
|
||||
ctrlPressed = (buffer.readByte() == 1 ? true : false);
|
||||
shiftPressed = (buffer.readByte() == 1 ? true : false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(final Lineage2Connection conn) {
|
||||
final L2Character character = conn.getCharacter();
|
||||
switch (action) {
|
||||
case SIT_STAND:
|
||||
// TODO
|
||||
break;
|
||||
case WALK_RUN:
|
||||
if (character.getMoveType() == CharacterMoveType.WALK) {
|
||||
charService.run(character);
|
||||
} else {
|
||||
charService.walk(character);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,7 @@ import com.l2jserver.game.net.Lineage2Connection;
|
||||
import com.l2jserver.game.net.packet.AbstractClientPacket;
|
||||
import com.l2jserver.game.net.packet.server.CharacterStopMovePacket;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.service.game.SpawnService;
|
||||
import com.l2jserver.service.game.CharacterService;
|
||||
import com.l2jserver.util.dimensional.Coordinate;
|
||||
|
||||
/**
|
||||
@@ -33,7 +33,7 @@ import com.l2jserver.util.dimensional.Coordinate;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class RequestMoveBackwardToLocationPacket extends AbstractClientPacket {
|
||||
public class CharacterRequestMovePacket extends AbstractClientPacket {
|
||||
/**
|
||||
* The packet OPCODE
|
||||
*/
|
||||
@@ -42,9 +42,9 @@ public class RequestMoveBackwardToLocationPacket extends AbstractClientPacket {
|
||||
private final Logger log = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
/**
|
||||
* The {@link SpawnService}
|
||||
* The {@link CharacterService}
|
||||
*/
|
||||
private final SpawnService spawnService;
|
||||
private final CharacterService charService;
|
||||
|
||||
// packet
|
||||
private Coordinate target;
|
||||
@@ -52,8 +52,8 @@ public class RequestMoveBackwardToLocationPacket extends AbstractClientPacket {
|
||||
private int moveMovement;
|
||||
|
||||
@Inject
|
||||
public RequestMoveBackwardToLocationPacket(SpawnService spawnService) {
|
||||
this.spawnService = spawnService;
|
||||
public CharacterRequestMovePacket(CharacterService charService) {
|
||||
this.charService = charService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -86,6 +86,6 @@ public class RequestMoveBackwardToLocationPacket extends AbstractClientPacket {
|
||||
final L2Character character = conn.getCharacter();
|
||||
log.debug("Character {} is moving from {} to {}", new Object[] {
|
||||
character, origin, target });
|
||||
spawnService.teleport(character, target);
|
||||
charService.move(character, target);
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ import com.l2jserver.game.net.Lineage2Connection;
|
||||
import com.l2jserver.game.net.Lineage2CryptographyKey;
|
||||
import com.l2jserver.game.net.packet.AbstractClientPacket;
|
||||
import com.l2jserver.game.net.packet.server.KeyPacket;
|
||||
import com.l2jserver.service.blowfish.BlowfishKeygenService;
|
||||
import com.l2jserver.service.network.keygen.BlowfishKeygenService;
|
||||
|
||||
/**
|
||||
* In this packet the client is informing its protocol version. It is possible
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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.game.net.packet.server;
|
||||
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
|
||||
import com.l2jserver.game.net.Lineage2Connection;
|
||||
import com.l2jserver.game.net.packet.AbstractServerPacket;
|
||||
import com.l2jserver.game.net.packet.server.CharacterCreateFailPacket.Reason;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.util.dimensional.Coordinate;
|
||||
|
||||
/**
|
||||
* This packet notifies the client that the chosen character has been
|
||||
* successfully selected.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
* @see Reason
|
||||
*/
|
||||
public class ActorMovementPacket extends AbstractServerPacket {
|
||||
/**
|
||||
* The packet OPCODE
|
||||
*/
|
||||
public static final int OPCODE = 0x2f;
|
||||
|
||||
/**
|
||||
* The selected character
|
||||
*/
|
||||
private final L2Character character;
|
||||
private Coordinate source;
|
||||
|
||||
public ActorMovementPacket(L2Character character, Coordinate source) {
|
||||
super(OPCODE);
|
||||
this.character = character;
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Lineage2Connection conn, ChannelBuffer buffer) {
|
||||
buffer.writeInt(character.getID().getID());
|
||||
|
||||
buffer.writeInt(character.getPoint().getX());
|
||||
buffer.writeInt(character.getPoint().getY());
|
||||
buffer.writeInt(character.getPoint().getZ());
|
||||
|
||||
buffer.writeInt(source.getX());
|
||||
buffer.writeInt(source.getY());
|
||||
buffer.writeInt(source.getZ());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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.game.net.packet.server;
|
||||
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
|
||||
import com.l2jserver.game.net.Lineage2Connection;
|
||||
import com.l2jserver.game.net.packet.AbstractServerPacket;
|
||||
import com.l2jserver.game.net.packet.server.CharacterCreateFailPacket.Reason;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
|
||||
/**
|
||||
* This packet updates the movement type
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
* @see Reason
|
||||
*/
|
||||
public class CharacterMovementTypePacket extends AbstractServerPacket {
|
||||
/**
|
||||
* The packet OPCODE
|
||||
*/
|
||||
public static final int OPCODE = 0x28;
|
||||
|
||||
/**
|
||||
* The character
|
||||
*/
|
||||
private final L2Character character;
|
||||
|
||||
public CharacterMovementTypePacket(L2Character character) {
|
||||
super(OPCODE);
|
||||
this.character = character;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Lineage2Connection conn, ChannelBuffer buffer) {
|
||||
buffer.writeInt(character.getID().getID());
|
||||
buffer.writeInt(character.getMoveType().id);
|
||||
buffer.writeInt(0x00); // unk
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@ import static com.l2jserver.model.world.character.CharacterInventory.InventoryPa
|
||||
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_3;
|
||||
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_4;
|
||||
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_5;
|
||||
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.DECORATION_6;
|
||||
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.FEET;
|
||||
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.GLOVES;
|
||||
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.HAIR1;
|
||||
@@ -108,11 +109,8 @@ public class CharacterSelectionListPacket extends AbstractServerPacket {
|
||||
buffer.writeInt(character.getID().getID());
|
||||
BufferUtils.writeString(buffer, loginName);
|
||||
buffer.writeInt(sessionId);
|
||||
// if (character.getClanID() == null) {
|
||||
buffer.writeInt(0x00); // clan id
|
||||
// } else {
|
||||
// buffer.writeInt(character.getClanID().getID()); // clan id
|
||||
// }
|
||||
buffer.writeInt((character.getClanID() != null ? character
|
||||
.getClanID().getID() : 0x00)); // clan id
|
||||
buffer.writeInt(0x00); // ??
|
||||
|
||||
buffer.writeInt(character.getSex().option); // sex
|
||||
@@ -176,17 +174,15 @@ public class CharacterSelectionListPacket extends AbstractServerPacket {
|
||||
writePaperdollItemID(buffer, character, DECORATION_3);
|
||||
writePaperdollItemID(buffer, character, DECORATION_4);
|
||||
writePaperdollItemID(buffer, character, DECORATION_5);
|
||||
writePaperdollItemID(buffer, character, DECORATION_6);
|
||||
writePaperdollItemID(buffer, character, BELT);
|
||||
|
||||
// hair style
|
||||
// buffer.writeInt(character.getAppearance().getHairStyle().option);
|
||||
buffer.writeInt(0x00);
|
||||
buffer.writeInt(character.getAppearance().getHairStyle().option);
|
||||
// hair color
|
||||
// buffer.writeInt(character.getAppearance().getHairColor().option);
|
||||
buffer.writeInt(0x00);
|
||||
buffer.writeInt(character.getAppearance().getHairColor().option);
|
||||
// face
|
||||
// buffer.writeInt(character.getAppearance().getFace().option);
|
||||
buffer.writeInt(0x00);
|
||||
buffer.writeInt(character.getAppearance().getFace().option);
|
||||
|
||||
buffer.writeDouble(30); // hp max
|
||||
buffer.writeDouble(30); // mp max
|
||||
|
||||
@@ -94,13 +94,13 @@ public class UserInformationPacket extends AbstractServerPacket {
|
||||
buffer.writeInt(character.getAttributes().getIntelligence());
|
||||
buffer.writeInt(character.getAttributes().getWitness());
|
||||
buffer.writeInt(character.getAttributes().getMentality());
|
||||
buffer.writeInt(200); // hp
|
||||
buffer.writeInt(200); // max hp
|
||||
buffer.writeInt((int) 200); // cur hp
|
||||
buffer.writeInt(200); // mp
|
||||
buffer.writeInt(200); // max mp
|
||||
buffer.writeInt((int) 200); // cur mp
|
||||
buffer.writeInt(0); // sp
|
||||
buffer.writeInt(0); // load
|
||||
buffer.writeInt(200); // max load
|
||||
buffer.writeInt(character.getAttributes().getMaxWeigth()); // max load
|
||||
|
||||
// 20 no weapon, 40 weapon equippe
|
||||
buffer.writeInt(20);
|
||||
@@ -139,16 +139,14 @@ public class UserInformationPacket extends AbstractServerPacket {
|
||||
writePaperdollItemID(buffer, character, RIGHT_FINGER);
|
||||
writePaperdollItemID(buffer, character, LEFT_FINGER);
|
||||
writePaperdollItemID(buffer, character, HEAD);
|
||||
buffer.writeInt(246);
|
||||
// writePaperdollItemID(buffer, character, RIGHT_HAND);
|
||||
writePaperdollItemID(buffer, character, RIGHT_HAND);
|
||||
writePaperdollItemID(buffer, character, LEFT_HAND);
|
||||
writePaperdollItemID(buffer, character, GLOVES);
|
||||
writePaperdollItemID(buffer, character, CHEST);
|
||||
writePaperdollItemID(buffer, character, LEGS);
|
||||
writePaperdollItemID(buffer, character, FEET);
|
||||
writePaperdollItemID(buffer, character, CLOAK);
|
||||
// /writePaperdollItemID(buffer, character, RIGHT_HAND);
|
||||
buffer.writeInt(246);
|
||||
writePaperdollItemID(buffer, character, RIGHT_HAND);
|
||||
writePaperdollItemID(buffer, character, HAIR1);
|
||||
writePaperdollItemID(buffer, character, HAIR2);
|
||||
writePaperdollItemID(buffer, character, RIGHT_BRACELET);
|
||||
@@ -201,16 +199,21 @@ public class UserInformationPacket extends AbstractServerPacket {
|
||||
buffer.writeInt(character.getAttributes().getMagicalAttack());
|
||||
buffer.writeInt(character.getAttributes().getCastSpeed());
|
||||
buffer.writeInt(character.getAttributes().getAttackSpeed());
|
||||
|
||||
buffer.writeInt(character.getAttributes().getMagicalDefense());
|
||||
|
||||
buffer.writeInt(0x00); // 0-non-pvp 1-pvp = violett name
|
||||
buffer.writeInt(0x00); // karma
|
||||
|
||||
buffer.writeInt(0x10); // run speed
|
||||
buffer.writeInt(0x20); // walk speed
|
||||
buffer.writeInt(0x10); // swim run speed
|
||||
buffer.writeInt(0x20); // swim walk speed
|
||||
buffer.writeInt((int) character.getAttributes().getMoveSpeed()); // run
|
||||
// speed
|
||||
buffer.writeInt((int) character.getAttributes().getMoveSpeed()); // walk
|
||||
// speed
|
||||
buffer.writeInt((int) character.getAttributes().getMoveSpeed()); // swim
|
||||
// run
|
||||
// speed
|
||||
buffer.writeInt((int) character.getAttributes().getMoveSpeed()); // swim
|
||||
// walk
|
||||
// speed
|
||||
buffer.writeInt(0); // unk
|
||||
buffer.writeInt(0); // unk
|
||||
buffer.writeInt(0); // fly speed -only if flying
|
||||
@@ -275,13 +278,13 @@ public class UserInformationPacket extends AbstractServerPacket {
|
||||
buffer.writeShort(500); // inventory limit
|
||||
|
||||
buffer.writeInt(character.getCharacterClass().id);
|
||||
buffer.writeInt(0x00); // special effects? circles around player...
|
||||
buffer.writeInt(0x01); // special effects? circles around player...
|
||||
buffer.writeInt(200); // max cp
|
||||
buffer.writeInt(200); // cur cp
|
||||
buffer.writeByte(127); // is mount or is airshilhelp = 0; otherwise
|
||||
// enchant effect (minimum 127)
|
||||
|
||||
buffer.writeByte(0x01);// team, 1=blue,2 red,0 is unknown
|
||||
buffer.writeByte(0x00);// team, 1=blue,2 red,0 is unknown
|
||||
|
||||
buffer.writeInt(0x00); // clan crest large id
|
||||
// 0x01: symbol on char menu ctrl+I
|
||||
@@ -328,7 +331,7 @@ public class UserInformationPacket extends AbstractServerPacket {
|
||||
buffer.writeInt(0x00); // Fame
|
||||
buffer.writeInt(0x01); // Minimap on Hellbound
|
||||
buffer.writeInt(1); // Vitality Points
|
||||
buffer.writeInt(0x000001); // special effects
|
||||
buffer.writeInt(0x00); // special effects
|
||||
}
|
||||
|
||||
private void writePaperdollObjectID(ChannelBuffer buffer,
|
||||
|
||||
Reference in New Issue
Block a user