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

@@ -315,7 +315,7 @@ public class MapleQuest {
return false;
}
if (timeLimit > 0) {
chr.announce(PacketCreator.removeQuestTimeLimit(id));
chr.sendPacket(PacketCreator.removeQuestTimeLimit(id));
}
MapleQuestStatus newStatus = new MapleQuestStatus(this, MapleQuestStatus.Status.NOT_STARTED);
newStatus.setForfeited(chr.getQuest(this).getForfeited() + 1);
@@ -361,7 +361,7 @@ public class MapleQuest {
public boolean forceComplete(MapleCharacter chr, int npc) {
if (timeLimit > 0) {
chr.announce(PacketCreator.removeQuestTimeLimit(id));
chr.sendPacket(PacketCreator.removeQuestTimeLimit(id));
}
MapleQuestStatus newStatus = new MapleQuestStatus(this, MapleQuestStatus.Status.COMPLETED, npc);
@@ -370,7 +370,7 @@ public class MapleQuest {
newStatus.setCompletionTime(System.currentTimeMillis());
chr.updateQuestStatus(newStatus);
chr.announce(PacketCreator.showSpecialEffect(9)); // Quest completion
chr.sendPacket(PacketCreator.showSpecialEffect(9)); // Quest completion
chr.getMap().broadcastMessage(chr, PacketCreator.showForeignEffect(chr.getId(), 9), false); //use 9 instead of 12 for both
return true;
}

View File

@@ -143,14 +143,14 @@ public class ItemAction extends MapleQuestAction {
}
MapleInventoryManipulator.removeById(chr.getClient(), type, itemid, quantity, true, false);
chr.announce(PacketCreator.getShowItemGain(itemid, (short) count, true));
chr.sendPacket(PacketCreator.getShowItemGain(itemid, (short) count, true));
}
for(ItemData iEntry: giveItem) {
int itemid = iEntry.getId(), count = iEntry.getCount(), period = iEntry.getPeriod(); // thanks Vcoc for noticing quest milestone item not getting removed from inventory after a while
MapleInventoryManipulator.addById(chr.getClient(), itemid, (short) count, "", -1, period > 0 ? (System.currentTimeMillis() + period * 60 * 1000) : -1);
chr.announce(PacketCreator.getShowItemGain(itemid, (short) count, true));
chr.sendPacket(PacketCreator.getShowItemGain(itemid, (short) count, true));
}
}

View File

@@ -50,6 +50,6 @@ public class NextQuestAction extends MapleQuestAction {
@Override
public void run(MapleCharacter chr, Integer extSelection) {
MapleQuestStatus status = chr.getQuest(MapleQuest.getInstance(questID));
chr.announce(PacketCreator.updateQuestFinish((short) questID, status.getNpc(), (short) nextQuest));
chr.sendPacket(PacketCreator.updateQuestFinish((short) questID, status.getNpc(), (short) nextQuest));
}
}