All packet creating methods now create Packet instead of byte[]

This commit got way too big...
- Remove deprecated methods for sending packets
- Favor OutPacket & Packet over MaplePacketLittleEndianWriter, LittleEndianWriter, and byte array
- Split up some packet creating methods into separate classes
This commit is contained in:
P0nk
2021-08-21 01:36:51 +02:00
parent b5cd6887ae
commit 8f6860d7d7
231 changed files with 6403 additions and 6927 deletions

View File

@@ -1,6 +1,6 @@
package client.keybind;
import tools.data.output.MaplePacketLittleEndianWriter;
import net.packet.OutPacket;
import java.util.Arrays;
@@ -31,25 +31,22 @@ public class MapleQuickslotBinding
this.m_aQuickslotKeyMapped = aKeys.clone();
}
public void Encode(MaplePacketLittleEndianWriter oPacket)
public void encode(OutPacket p)
{
// Quickslots are default.
// The client will skip them and call CQuickslotKeyMappedMan::DefaultQuickslotKeyMap.
if(Arrays.equals(this.m_aQuickslotKeyMapped, DEFAULT_QUICKSLOTS))
{
oPacket.writeBool(false);
if (Arrays.equals(this.m_aQuickslotKeyMapped, DEFAULT_QUICKSLOTS)) {
p.writeBool(false);
return;
}
oPacket.writeBool(true);
p.writeBool(true);
for(byte nKey : this.m_aQuickslotKeyMapped)
{
for(byte nKey : this.m_aQuickslotKeyMapped) {
// For some reason Nexon sends these as integers, similar to CFuncKeyMappedMan.
// However there's no evidence any key can be above 0xFF anyhow.
// Regardless, we need to encode an integer to avoid an error 38 crash; as CFuncKeyMapped::m_aQuickslotKeyMapped is int[8].
oPacket.writeInt(nKey);
p.writeInt(nKey);
}
}