mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-10 09:22:49 +00:00
@@ -18,9 +18,14 @@ package com.l2jserver.game.net.packet.client;
|
||||
|
||||
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.SM_CHAR_LIST;
|
||||
import com.l2jserver.game.net.packet.server.SM_CHAR_RESTART;
|
||||
import com.l2jserver.service.game.character.CharacterService;
|
||||
import com.l2jserver.service.game.spawn.NotSpawnedServiceException;
|
||||
|
||||
/**
|
||||
* Requests the list of characters to be displayed in the lobby. The list of
|
||||
@@ -34,13 +39,36 @@ public class CM_RESTART extends AbstractClientPacket {
|
||||
*/
|
||||
public static final int OPCODE = 0x57;
|
||||
|
||||
/**
|
||||
* The {@link CharacterService}
|
||||
*/
|
||||
private final CharacterService charService;
|
||||
/**
|
||||
* The {@link CharacterDAO}
|
||||
*/
|
||||
private final CharacterDAO charDao;
|
||||
|
||||
@Inject
|
||||
public CM_RESTART(CharacterService charService, CharacterDAO charDao) {
|
||||
this.charService = charService;
|
||||
this.charDao = charDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void read(Lineage2Connection conn, ChannelBuffer buffer) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(final Lineage2Connection conn) {
|
||||
try {
|
||||
charService.leaveWorld(conn.getCharacter());
|
||||
} catch (NotSpawnedServiceException e) {
|
||||
conn.sendActionFailed();
|
||||
return;
|
||||
}
|
||||
conn.setCharacterID(null);
|
||||
conn.write(SM_CHAR_RESTART.ok());
|
||||
conn.write(SM_CHAR_LIST.fromL2Session(conn.getSession(),
|
||||
charDao.selectByAccount(conn.getSession().getAccountID())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ import static com.l2jserver.model.world.character.CharacterInventory.InventoryPa
|
||||
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.RIGHT_FINGER;
|
||||
import static com.l2jserver.model.world.character.CharacterInventory.InventoryPaperdoll.RIGHT_HAND;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.jboss.netty.buffer.ChannelBuffer;
|
||||
|
||||
import com.l2jserver.game.net.Lineage2Connection;
|
||||
@@ -77,8 +79,8 @@ public class SM_CHAR_LIST extends AbstractServerPacket {
|
||||
*/
|
||||
private final L2Character[] characters;
|
||||
|
||||
public SM_CHAR_LIST(String loginName, int sessionId,
|
||||
int lastCharacterId, L2Character... characters) {
|
||||
public SM_CHAR_LIST(String loginName, int sessionId, int lastCharacterId,
|
||||
L2Character... characters) {
|
||||
super(OPCODE);
|
||||
this.loginName = loginName;
|
||||
this.sessionId = sessionId;
|
||||
@@ -86,12 +88,18 @@ public class SM_CHAR_LIST extends AbstractServerPacket {
|
||||
this.characters = characters;
|
||||
}
|
||||
|
||||
public static SM_CHAR_LIST fromL2Session(
|
||||
Lineage2Session session, L2Character... characters) {
|
||||
public static SM_CHAR_LIST fromL2Session(Lineage2Session session,
|
||||
L2Character... characters) {
|
||||
return new SM_CHAR_LIST(session.getAccountID().getID(),
|
||||
session.getPlayKey2(), -1, characters);
|
||||
}
|
||||
|
||||
public static SM_CHAR_LIST fromL2Session(Lineage2Session session,
|
||||
Collection<L2Character> characters) {
|
||||
return fromL2Session(session,
|
||||
characters.toArray(new L2Character[characters.size()]));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Lineage2Connection conn, ChannelBuffer buffer) {
|
||||
// buffer.writeByte(0x09);
|
||||
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* This packet sends an item that is dropped on the ground
|
||||
*
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*/
|
||||
public class SM_ITEM_GROUND extends AbstractServerPacket {
|
||||
/**
|
||||
* The packet OPCODE
|
||||
*/
|
||||
public static final int OPCODE = 0x16;
|
||||
|
||||
public SM_ITEM_GROUND() {
|
||||
super(OPCODE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void write(Lineage2Connection conn, ChannelBuffer buffer) {
|
||||
buffer.writeInt(268437456); // char who dropped
|
||||
buffer.writeInt(268635461); // item obj id
|
||||
buffer.writeInt(57); // item template id
|
||||
|
||||
buffer.writeInt(-84341); // x
|
||||
buffer.writeInt(244623); // y
|
||||
buffer.writeInt(-3728); // z
|
||||
// only show item count if it is a stackable item
|
||||
buffer.writeInt(0x01); // show count
|
||||
buffer.writeLong(4001); // count
|
||||
|
||||
buffer.writeInt(1); // unknown
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user