Handlers read from InPacket instead of SeekableLittleEndianAccessor

This commit is contained in:
P0nk
2021-08-22 22:10:19 +02:00
parent 2232022cf1
commit da2d8abc56
182 changed files with 1223 additions and 1230 deletions

View File

@@ -63,8 +63,6 @@ import server.maps.FieldLimit;
import server.maps.MapleMap;
import server.maps.MapleMiniDungeonInfo;
import tools.*;
import tools.data.input.ByteArrayByteStream;
import tools.data.input.GenericSeekableLittleEndianAccessor;
import javax.script.ScriptEngine;
import java.io.IOException;
@@ -199,15 +197,11 @@ public class MapleClient extends ChannelInboundHandlerAdapter {
}
if (handler != null && handler.validateState(this)) {
// TODO: pass InPacket directly to handler once all handlers have been ported,
// this is just a temporary workaround
final byte[] content = packet.getBytes();
GenericSeekableLittleEndianAccessor accessor = new GenericSeekableLittleEndianAccessor(new ByteArrayByteStream(content));
try {
MapleLogger.logRecv(this, opcode, content);
handler.handlePacket(accessor, this);
MapleLogger.logRecv(this, opcode, packet.getBytes());
handler.handlePacket(packet, this);
} catch (final Throwable t) {
FilePrinter.printError(FilePrinter.PACKET_HANDLER + handler.getClass().getName() + ".txt", t, "Error for " + (getPlayer() == null ? "" : "player ; " + getPlayer() + " on map ; " + getPlayer().getMapId() + " - ") + "account ; " + getAccountName() + "\r\n" + accessor);
FilePrinter.printError(FilePrinter.PACKET_HANDLER + handler.getClass().getName() + ".txt", t, "Error for " + (getPlayer() == null ? "" : "player ; " + getPlayer() + " on map ; " + getPlayer().getMapId() + " - ") + "account ; " + getAccountName() + "\r\n" + packet);
//client.sendPacket(PacketCreator.enableActions());//bugs sometimes
}
}