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

@@ -76,7 +76,7 @@ public class MapleShop {
public void sendShop(MapleClient c) {
c.getPlayer().setShop(this);
c.announce(PacketCreator.getNPCShop(c, getNpcId(), items));
c.sendPacket(PacketCreator.getNPCShop(c, getNpcId(), items));
}
public void buy(MapleClient c, short slot, int itemId, short quantity) {
@@ -103,12 +103,12 @@ public class MapleShop {
MapleInventoryManipulator.addById(c, itemId, quantity, "", -1);
c.getPlayer().gainMeso(-item.getPrice(), false);
}
c.announce(PacketCreator.shopTransaction((byte) 0));
c.sendPacket(PacketCreator.shopTransaction((byte) 0));
} else
c.announce(PacketCreator.shopTransaction((byte) 3));
c.sendPacket(PacketCreator.shopTransaction((byte) 3));
} else
c.announce(PacketCreator.shopTransaction((byte) 2));
c.sendPacket(PacketCreator.shopTransaction((byte) 2));
} else if (item.getPitch() > 0) {
int amount = (int)Math.min((float) item.getPitch() * quantity, Integer.MAX_VALUE);
@@ -124,9 +124,9 @@ public class MapleShop {
MapleInventoryManipulator.addById(c, itemId, quantity, "", -1);
MapleInventoryManipulator.removeById(c, MapleInventoryType.ETC, 4310000, amount, false, false);
}
c.announce(PacketCreator.shopTransaction((byte) 0));
c.sendPacket(PacketCreator.shopTransaction((byte) 0));
} else
c.announce(PacketCreator.shopTransaction((byte) 3));
c.sendPacket(PacketCreator.shopTransaction((byte) 3));
}
} else if (c.getPlayer().getInventory(MapleInventoryType.CASH).countById(token) != 0) {
@@ -145,11 +145,11 @@ public class MapleShop {
}
c.getPlayer().gainMeso(diff, false);
} else {
c.announce(PacketCreator.shopTransaction((byte) 3));
c.sendPacket(PacketCreator.shopTransaction((byte) 3));
}
c.announce(PacketCreator.shopTransaction((byte) 0));
c.sendPacket(PacketCreator.shopTransaction((byte) 0));
} else {
c.announce(PacketCreator.shopTransaction((byte) 2));
c.sendPacket(PacketCreator.shopTransaction((byte) 2));
}
}
}
@@ -203,9 +203,9 @@ public class MapleShop {
if (recvMesos > 0) {
c.getPlayer().gainMeso(recvMesos, false);
}
c.announce(PacketCreator.shopTransaction((byte) 0x8));
c.sendPacket(PacketCreator.shopTransaction((byte) 0x8));
} else {
c.announce(PacketCreator.shopTransaction((byte) 0x5));
c.sendPacket(PacketCreator.shopTransaction((byte) 0x5));
}
}
@@ -225,9 +225,9 @@ public class MapleShop {
item.setQuantity(slotMax);
c.getPlayer().forceUpdateItem(item);
c.getPlayer().gainMeso(-price, false, true, false);
c.announce(PacketCreator.shopTransaction((byte) 0x8));
c.sendPacket(PacketCreator.shopTransaction((byte) 0x8));
} else {
c.announce(PacketCreator.shopTransaction((byte) 0x2));
c.sendPacket(PacketCreator.shopTransaction((byte) 0x2));
}
}
}