mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-06 07:32:46 +00:00
@@ -21,6 +21,7 @@ import com.l2jserver.service.blowfish.BlowfishKeygenService;
|
||||
import com.l2jserver.service.cache.CacheService;
|
||||
import com.l2jserver.service.configuration.ConfigurationService;
|
||||
import com.l2jserver.service.database.DatabaseService;
|
||||
import com.l2jserver.service.game.chat.ChatService;
|
||||
import com.l2jserver.service.game.scripting.ScriptingService;
|
||||
import com.l2jserver.service.game.template.TemplateService;
|
||||
import com.l2jserver.service.network.NetworkService;
|
||||
@@ -43,6 +44,8 @@ public class L2JGameServerMain {
|
||||
serviceManager.start(ScriptingService.class);
|
||||
serviceManager.start(TemplateService.class);
|
||||
|
||||
serviceManager.start(ChatService.class);
|
||||
|
||||
serviceManager.start(BlowfishKeygenService.class);
|
||||
serviceManager.start(NetworkService.class);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -184,8 +184,13 @@ public class Lineage2Connection {
|
||||
return channel.isConnected();
|
||||
}
|
||||
|
||||
public ChannelFuture write(ServerPacket message) {
|
||||
return channel.write(message);
|
||||
public ChannelFuture write(ServerPacket packet) {
|
||||
return channel.write(packet);
|
||||
}
|
||||
|
||||
public ChannelFuture[] broadcast(ServerPacket packet) {
|
||||
// TODO implement broadcasting
|
||||
return new ChannelFuture[] { write(packet) };
|
||||
}
|
||||
|
||||
public ChannelFuture disconnect() {
|
||||
|
||||
@@ -28,7 +28,9 @@ import com.google.inject.Injector;
|
||||
import com.l2jserver.game.net.Lineage2Connection;
|
||||
import com.l2jserver.game.net.packet.ClientPacket;
|
||||
import com.l2jserver.game.net.packet.client.AuthLoginPacket;
|
||||
import com.l2jserver.game.net.packet.client.CharacterChatMessagePacket;
|
||||
import com.l2jserver.game.net.packet.client.CharacterCreatePacket;
|
||||
import com.l2jserver.game.net.packet.client.CharacterSelectPacket;
|
||||
import com.l2jserver.game.net.packet.client.EnterWorld;
|
||||
import com.l2jserver.game.net.packet.client.LogoutPacket;
|
||||
import com.l2jserver.game.net.packet.client.ProtocolVersionPacket;
|
||||
@@ -37,6 +39,8 @@ 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.RequestRestartPacket;
|
||||
|
||||
/**
|
||||
* This decoder reads an frame and decodes the packet in it. Each packet has an
|
||||
@@ -143,6 +147,14 @@ public class Lineage2PacketReader extends OneToOneDecoder {
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case CharacterSelectPacket.OPCODE:
|
||||
return CharacterSelectPacket.class;
|
||||
case RequestMoveBackwardToLocationPacket.OPCODE:
|
||||
return RequestMoveBackwardToLocationPacket.class;
|
||||
case RequestRestartPacket.OPCODE:
|
||||
return RequestRestartPacket.class;
|
||||
case CharacterChatMessagePacket.OPCODE:
|
||||
return CharacterChatMessagePacket.class;
|
||||
case EnterWorld.OPCODE:
|
||||
return EnterWorld.class;
|
||||
default:
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* 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.service.game.chat.ChatService;
|
||||
import com.l2jserver.service.game.chat.channel.PublicChatChannel;
|
||||
import com.l2jserver.util.BufferUtils;
|
||||
|
||||
/**
|
||||
* Completes the creation of an character. Creates the object, inserts into the
|
||||
* database and notifies the client about the status of the operation.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterChatMessagePacket extends AbstractClientPacket {
|
||||
/**
|
||||
* The packet OPCODE
|
||||
*/
|
||||
public static final int OPCODE = 0x49;
|
||||
|
||||
// services and daos
|
||||
/**
|
||||
* The {@link ChatService} implementation
|
||||
*/
|
||||
private final ChatService chatService;
|
||||
|
||||
private String message;
|
||||
private MessageDestination destination;
|
||||
|
||||
public enum MessageDestination {
|
||||
/**
|
||||
* Everyone
|
||||
*/
|
||||
ALL(0),
|
||||
/**
|
||||
* !
|
||||
*/
|
||||
SHOUT(1),
|
||||
/**
|
||||
* Private message
|
||||
*/
|
||||
TELL(2),
|
||||
/**
|
||||
* #
|
||||
*/
|
||||
PARTY(3),
|
||||
/**
|
||||
* @
|
||||
*/
|
||||
CLAN(4), GM(5), PETITION_PLAYER(6), PETITION_GM(7),
|
||||
/**
|
||||
* +
|
||||
*/
|
||||
TRADE(8),
|
||||
/**
|
||||
* $
|
||||
*/
|
||||
ALLIANCE(9), ANNOUNCEMENT(10), BOAT(11), L2FRIEND(12), MSNCHAT(13), PARTYMATCH_ROOM(
|
||||
14), PARTYROOM_COMMANDER(15), PARTYROOM_ALL(16), HERO_VOICE(17), CRITICAL_ANNOUNCE(
|
||||
18), SCREEN_ANNOUNCE(19), BATTLEFIELD(20), MPCC_ROOM(21);
|
||||
|
||||
public final int id;
|
||||
|
||||
MessageDestination(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public static MessageDestination fromID(int id) {
|
||||
for (final MessageDestination dest : values()) {
|
||||
if (dest.id == id)
|
||||
return dest;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String target;
|
||||
|
||||
@Inject
|
||||
public CharacterChatMessagePacket(ChatService chatService) {
|
||||
this.chatService = chatService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(Lineage2Connection conn, ChannelBuffer buffer) {
|
||||
this.message = BufferUtils.readString(buffer);
|
||||
this.destination = MessageDestination.fromID(buffer.readInt());
|
||||
if (this.destination == MessageDestination.TELL) { // private message
|
||||
this.target = BufferUtils.readString(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(final Lineage2Connection conn) {
|
||||
final PublicChatChannel channel = chatService.getGlobalChannel();
|
||||
// TODO handle chat destination!!!
|
||||
channel.send(conn.getCharacterID(), message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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 java.util.List;
|
||||
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.l2jserver.db.dao.CharacterDAO;
|
||||
import com.l2jserver.game.net.Lineage2Connection;
|
||||
import com.l2jserver.game.net.packet.AbstractClientPacket;
|
||||
import com.l2jserver.game.net.packet.server.CharacterSelectedPacket;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
|
||||
/**
|
||||
* This packet notifies the server which character the player has chosen to use.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterSelectPacket extends AbstractClientPacket {
|
||||
/**
|
||||
* The packet OPCODE
|
||||
*/
|
||||
public static final int OPCODE = 0x12;
|
||||
|
||||
// services and daos
|
||||
/**
|
||||
* The {@link CharacterDAO} implementation
|
||||
*/
|
||||
private final CharacterDAO characterDao;
|
||||
|
||||
// packet
|
||||
/**
|
||||
* The character slot
|
||||
*/
|
||||
private int slot;
|
||||
|
||||
@Inject
|
||||
public CharacterSelectPacket(CharacterDAO characterDao) {
|
||||
this.characterDao = characterDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(Lineage2Connection conn, ChannelBuffer buffer) {
|
||||
slot = buffer.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(final Lineage2Connection conn) {
|
||||
final List<L2Character> chars = characterDao.selectByAccount(conn
|
||||
.getSession().getAccountID());
|
||||
|
||||
// FIXME better handling! this will throw an exception sooner or later
|
||||
final L2Character character = chars.get(slot);
|
||||
conn.setCharacterID(character.getID());
|
||||
|
||||
conn.write(new CharacterSelectedPacket(chars.get(slot)));
|
||||
}
|
||||
}
|
||||
@@ -18,15 +18,18 @@ 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.game.net.packet.client.CharacterChatMessagePacket.MessageDestination;
|
||||
import com.l2jserver.game.net.packet.server.ActorChatMessagePacket;
|
||||
import com.l2jserver.game.net.packet.server.GameGuardQueryPacket;
|
||||
import com.l2jserver.game.net.packet.server.InventoryPacket;
|
||||
import com.l2jserver.game.net.packet.server.UserInformationPacket;
|
||||
import com.l2jserver.model.id.object.CharacterID;
|
||||
import com.l2jserver.service.game.chat.ChatService;
|
||||
import com.l2jserver.service.game.chat.channel.ChatChannel;
|
||||
import com.l2jserver.service.game.chat.channel.ChatChannelListener;
|
||||
import com.l2jserver.service.game.chat.channel.PublicChatChannel;
|
||||
|
||||
/**
|
||||
* The client is requesting a logout. Currently, when this packet is received
|
||||
@@ -51,6 +54,7 @@ public class EnterWorld extends AbstractClientPacket {
|
||||
* @param chatService
|
||||
* the chat service
|
||||
*/
|
||||
@Inject
|
||||
public EnterWorld(ChatService chatService) {
|
||||
this.chatService = chatService;
|
||||
}
|
||||
@@ -72,20 +76,19 @@ public class EnterWorld extends AbstractClientPacket {
|
||||
|
||||
@Override
|
||||
public void process(final Lineage2Connection conn) {
|
||||
if (conn.getCharacter().getClanID() != null) {
|
||||
final PublicChatChannel clanChannel = chatService.getChannel(conn
|
||||
.getCharacter().getClanID());
|
||||
clanChannel.addChatChannelListener(new ChatChannelListener() {
|
||||
@Override
|
||||
public void onMessage(ChatChannel channel, CharacterID source,
|
||||
String message) {
|
||||
// TODO write message
|
||||
}
|
||||
});
|
||||
}
|
||||
chatService.getGlobalChannel().addChatChannelListener(
|
||||
new ChatChannelListener() {
|
||||
@Override
|
||||
public void onMessage(ChatChannel channel,
|
||||
CharacterID source, String message) {
|
||||
conn.write(new ActorChatMessagePacket(source
|
||||
.getObject(), MessageDestination.ALL, message));
|
||||
}
|
||||
});
|
||||
|
||||
conn.write(new UserInformationPacket(conn.getCharacter()));
|
||||
// TODO game guard enforcing
|
||||
conn.write(new GameGuardQueryPacket());
|
||||
// conn.write(new InventoryPacket(conn.getCharacter().getInventory()));
|
||||
conn.write(new InventoryPacket(conn.getCharacter().getInventory()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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.l2jserver.game.net.Lineage2Connection;
|
||||
import com.l2jserver.game.net.packet.AbstractClientPacket;
|
||||
import com.l2jserver.game.net.packet.server.CharacterStopMovePacket;
|
||||
import com.l2jserver.game.net.packet.server.CharacterTeleportPacket;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.util.dimensional.Coordinate;
|
||||
|
||||
/**
|
||||
* This packet notifies the server which character the player has chosen to use.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class RequestMoveBackwardToLocationPacket extends AbstractClientPacket {
|
||||
/**
|
||||
* The packet OPCODE
|
||||
*/
|
||||
public static final int OPCODE = 0x0f;
|
||||
|
||||
// packet
|
||||
private Coordinate target;
|
||||
private Coordinate origin;
|
||||
private int moveMovement;
|
||||
|
||||
@Override
|
||||
public void read(Lineage2Connection conn, ChannelBuffer buffer) {
|
||||
this.target = Coordinate.fromXYZ(buffer.readInt(), buffer.readInt(),
|
||||
buffer.readInt());
|
||||
this.origin = Coordinate.fromXYZ(buffer.readInt(), buffer.readInt(),
|
||||
buffer.readInt());
|
||||
// 0 keyboard, 1 mouse
|
||||
this.moveMovement = buffer.readInt(); // seems that L2Walker does not
|
||||
// send this
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(final Lineage2Connection conn) {
|
||||
if (target.equals(origin)) {
|
||||
conn.write(new CharacterStopMovePacket(conn.getCharacter()));
|
||||
return;
|
||||
}
|
||||
if (target.getDistance(origin) >= 98010000) {
|
||||
// TODO send action failed message!
|
||||
return;
|
||||
}
|
||||
final L2Character character = conn.getCharacter();
|
||||
character.setPosition(target);
|
||||
|
||||
conn.broadcast(new CharacterTeleportPacket(character));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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.l2jserver.game.net.Lineage2Connection;
|
||||
import com.l2jserver.game.net.packet.AbstractClientPacket;
|
||||
import com.l2jserver.game.net.packet.server.RestartResponsePacket;
|
||||
|
||||
/**
|
||||
* Requests the list of characters to be displayed in the lobby. The list of
|
||||
* characters is sent to the client.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class RequestRestartPacket extends AbstractClientPacket {
|
||||
/**
|
||||
* The packet OPCODE
|
||||
*/
|
||||
public static final int OPCODE = 0x57;
|
||||
|
||||
@Override
|
||||
public void read(Lineage2Connection conn, ChannelBuffer buffer) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(final Lineage2Connection conn) {
|
||||
conn.setCharacterID(null);
|
||||
conn.write(RestartResponsePacket.ok());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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.client.CharacterChatMessagePacket.MessageDestination;
|
||||
import com.l2jserver.game.net.packet.server.CharacterCreateFailPacket.Reason;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.util.BufferUtils;
|
||||
|
||||
/**
|
||||
* 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 ActorChatMessagePacket extends AbstractServerPacket {
|
||||
/**
|
||||
* The packet OPCODE
|
||||
*/
|
||||
public static final int OPCODE = 0x4a;
|
||||
|
||||
/**
|
||||
* The selected character
|
||||
*/
|
||||
private final L2Character character;
|
||||
private MessageDestination destination;
|
||||
private String message = null;
|
||||
private int messageID = 0;
|
||||
|
||||
public ActorChatMessagePacket(L2Character character,
|
||||
MessageDestination destination, String message) {
|
||||
super(OPCODE);
|
||||
this.character = character;
|
||||
this.destination = destination;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Lineage2Connection conn, ChannelBuffer buffer) {
|
||||
buffer.writeInt(character.getID().getID());
|
||||
buffer.writeInt(destination.id);
|
||||
BufferUtils.writeString(buffer, character.getName()); // TODO can be
|
||||
// char id!
|
||||
BufferUtils.writeString(buffer, message); // TODO can be msg id
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* 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.model.world.actor.ActorExperience;
|
||||
import com.l2jserver.util.BufferUtils;
|
||||
|
||||
/**
|
||||
* 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 CharacterSelectedPacket extends AbstractServerPacket {
|
||||
/**
|
||||
* The packet OPCODE
|
||||
*/
|
||||
public static final int OPCODE = 0x0b;
|
||||
|
||||
/**
|
||||
* The selected character
|
||||
*/
|
||||
private final L2Character character;
|
||||
|
||||
public CharacterSelectedPacket(L2Character character) {
|
||||
super(OPCODE);
|
||||
this.character = character;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Lineage2Connection conn, ChannelBuffer buffer) {
|
||||
BufferUtils.writeString(buffer, character.getName());
|
||||
buffer.writeInt(character.getID().getID());
|
||||
BufferUtils.writeString(buffer, "It works!"); // title
|
||||
buffer.writeInt(conn.getSession().getPlayKey1());
|
||||
buffer.writeInt((character.getClanID() != null ? character.getClanID()
|
||||
.getID() : 0));
|
||||
buffer.writeInt(0x00); // ??
|
||||
buffer.writeInt(character.getSex().option);
|
||||
buffer.writeInt(character.getRace().id);
|
||||
buffer.writeInt(character.getCharacterClass().id);
|
||||
buffer.writeInt(0x01); // active ??
|
||||
buffer.writeInt(character.getPoint().getX());
|
||||
buffer.writeInt(character.getPoint().getY());
|
||||
buffer.writeInt(character.getPoint().getZ());
|
||||
|
||||
buffer.writeDouble(20); // cur hp
|
||||
buffer.writeDouble(20); // cur mp
|
||||
buffer.writeInt(0); // sp
|
||||
buffer.writeLong(ActorExperience.LEVEL_1.experience);
|
||||
buffer.writeInt(ActorExperience.LEVEL_1.level);
|
||||
buffer.writeInt(0); // karma
|
||||
buffer.writeInt(0); // pk
|
||||
buffer.writeInt(character.getAttributes().getIntelligence());
|
||||
buffer.writeInt(character.getAttributes().getStrength());
|
||||
buffer.writeInt(character.getAttributes().getConcentration());
|
||||
buffer.writeInt(character.getAttributes().getMentality());
|
||||
buffer.writeInt(character.getAttributes().getDexterity());
|
||||
buffer.writeInt(character.getAttributes().getWitness());
|
||||
|
||||
buffer.writeInt(0); // game time
|
||||
buffer.writeInt(0x00); // unk
|
||||
|
||||
buffer.writeInt(character.getCharacterClass().id);
|
||||
|
||||
buffer.writeInt(0x00);// unk
|
||||
buffer.writeInt(0x00);// unk
|
||||
buffer.writeInt(0x00);// unk
|
||||
buffer.writeInt(0x00);// unk
|
||||
|
||||
buffer.writeBytes(new byte[64]); // unk
|
||||
buffer.writeInt(0x00);// unk
|
||||
}
|
||||
}
|
||||
@@ -126,9 +126,9 @@ public class CharacterSelectionListPacket extends AbstractServerPacket {
|
||||
|
||||
buffer.writeInt(1); // active ??
|
||||
|
||||
buffer.writeInt(-71338); // x
|
||||
buffer.writeInt(258271); // y
|
||||
buffer.writeInt(-3104); // z
|
||||
buffer.writeInt(character.getPoint().getX()); // x
|
||||
buffer.writeInt(character.getPoint().getY()); // y
|
||||
buffer.writeInt(character.getPoint().getZ()); // z
|
||||
|
||||
buffer.writeDouble(20); // hp cur
|
||||
buffer.writeDouble(20); // mp cur
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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.model.world.L2Character;
|
||||
|
||||
/**
|
||||
* An packet that sends all character templates to the client.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class CharacterStopMovePacket extends AbstractServerPacket {
|
||||
/**
|
||||
* The packet OPCODE
|
||||
*/
|
||||
public static final int OPCODE = 0x47;
|
||||
|
||||
private L2Character character;
|
||||
|
||||
public CharacterStopMovePacket(L2Character character) {
|
||||
super(OPCODE);
|
||||
this.character = character;
|
||||
}
|
||||
|
||||
@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((int) character.getPoint().getAngle());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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 notifies the client that the chosen character has been
|
||||
* successfully selected.
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
* @see Reason
|
||||
*/
|
||||
public class CharacterTeleportPacket extends AbstractServerPacket {
|
||||
/**
|
||||
* The packet OPCODE
|
||||
*/
|
||||
public static final int OPCODE = 0x22;
|
||||
|
||||
/**
|
||||
* The selected character
|
||||
*/
|
||||
private final L2Character character;
|
||||
|
||||
public CharacterTeleportPacket(L2Character character) {
|
||||
super(OPCODE);
|
||||
this.character = character;
|
||||
}
|
||||
|
||||
@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(0x00); // isValidation ??
|
||||
buffer.writeInt((int) character.getPoint().getAngle()); // nYaw
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* This packet responds to the Restart request
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class RestartResponsePacket extends AbstractServerPacket {
|
||||
/**
|
||||
* The packet OPCODE
|
||||
*/
|
||||
public static final int OPCODE = 0x71;
|
||||
|
||||
/**
|
||||
* The restart state
|
||||
*/
|
||||
private boolean state;
|
||||
|
||||
public RestartResponsePacket(boolean state) {
|
||||
super(OPCODE);
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public static RestartResponsePacket ok() {
|
||||
return new RestartResponsePacket(true);
|
||||
}
|
||||
|
||||
public static RestartResponsePacket denied() {
|
||||
return new RestartResponsePacket(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Lineage2Connection conn, ChannelBuffer buffer) {
|
||||
buffer.writeByte((state ? 0x01 : 0x00));
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,8 @@ import com.l2jserver.service.configuration.ConfigurationService;
|
||||
import com.l2jserver.service.configuration.ProxyConfigurationService;
|
||||
import com.l2jserver.service.database.DatabaseService;
|
||||
import com.l2jserver.service.database.MySQLDatabaseService;
|
||||
import com.l2jserver.service.game.chat.ChatService;
|
||||
import com.l2jserver.service.game.chat.SimpleChatService;
|
||||
import com.l2jserver.service.game.scripting.ScriptingService;
|
||||
import com.l2jserver.service.game.scripting.ScriptingServiceImpl;
|
||||
import com.l2jserver.service.game.template.ScriptTemplateService;
|
||||
@@ -53,8 +55,7 @@ public class ServiceModule extends AbstractModule {
|
||||
Scopes.SINGLETON);
|
||||
bind(ConfigurationService.class).to(ProxyConfigurationService.class)
|
||||
.in(Scopes.SINGLETON);
|
||||
bind(CacheService.class).to(EhCacheService.class).in(
|
||||
Scopes.SINGLETON);
|
||||
bind(CacheService.class).to(EhCacheService.class).in(Scopes.SINGLETON);
|
||||
bind(DatabaseService.class).to(MySQLDatabaseService.class).in(
|
||||
Scopes.SINGLETON);
|
||||
|
||||
@@ -67,6 +68,9 @@ public class ServiceModule extends AbstractModule {
|
||||
bind(TemplateService.class).to(ScriptTemplateService.class).in(
|
||||
Scopes.SINGLETON);
|
||||
|
||||
bind(ChatService.class).to(SimpleChatService.class)
|
||||
.in(Scopes.SINGLETON);
|
||||
|
||||
bind(WorldService.class).to(WorldServiceImpl.class)
|
||||
.in(Scopes.SINGLETON);
|
||||
bind(WorldEventDispatcher.class).to(WorldEventDispatcherImpl.class).in(
|
||||
|
||||
@@ -19,12 +19,12 @@ package com.l2jserver.service.game.chat;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.l2jserver.model.id.object.CharacterID;
|
||||
import com.l2jserver.model.id.object.ClanID;
|
||||
import com.l2jserver.model.world.Clan;
|
||||
import com.l2jserver.model.world.L2Character;
|
||||
import com.l2jserver.service.AbstractService;
|
||||
import com.l2jserver.service.AbstractService.Depends;
|
||||
import com.l2jserver.service.ServiceStartException;
|
||||
import com.l2jserver.service.ServiceStopException;
|
||||
import com.l2jserver.service.game.chat.channel.ChatChannel;
|
||||
@@ -40,7 +40,7 @@ import com.l2jserver.util.factory.CollectionFactory;
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
@Depends(RegionService.class)
|
||||
// @Depends(RegionService.class)
|
||||
public class SimpleChatService extends AbstractService implements ChatService {
|
||||
private final RegionService regionService;
|
||||
|
||||
@@ -69,8 +69,10 @@ public class SimpleChatService extends AbstractService implements ChatService {
|
||||
* @param regionService
|
||||
* the region service
|
||||
*/
|
||||
public SimpleChatService(RegionService regionService) {
|
||||
this.regionService = regionService;
|
||||
@Inject
|
||||
public SimpleChatService() {
|
||||
// this.regionService = regionService;
|
||||
this.regionService = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user