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

@@ -137,7 +137,7 @@ function action(mode, type, selection) {
cm.getPlayer().getCashShop().gainCash(1, nxAmount);
const PacketCreator = Java.type('tools.PacketCreator');
cm.getPlayer().announce(PacketCreator.earnTitleMessage("You have earned " + nxAmount + " NX"));
cm.getPlayer().sendPacket(PacketCreator.earnTitleMessage("You have earned " + nxAmount + " NX"));
cm.logLeaf(nxAmount + " NX");
cm.dispose();
} else if(choice == 2) {

View File

@@ -57,8 +57,8 @@ function action(mode, type, selection) {
if(harpNote != nextNote) {
cm.setQuestProgress(3114, 0);
cm.getPlayer().announce(PacketCreator.showEffect("quest/party/wrong_kor"));
cm.getPlayer().announce(PacketCreator.playSound("Party1/Failed"));
cm.getPlayer().sendPacket(PacketCreator.showEffect("quest/party/wrong_kor"));
cm.getPlayer().sendPacket(PacketCreator.playSound("Party1/Failed"));
cm.message("You've missed the note... Start over again.");
} else {
@@ -71,8 +71,8 @@ function action(mode, type, selection) {
cm.message("Twinkle, twinkle, little star, how I wonder what you are.");
cm.setQuestProgress(3114, 42);
cm.getPlayer().announce(PacketCreator.showEffect("quest/party/clear"));
cm.getPlayer().announce(PacketCreator.playSound("Party1/Clear"));
cm.getPlayer().sendPacket(PacketCreator.showEffect("quest/party/clear"));
cm.getPlayer().sendPacket(PacketCreator.playSound("Party1/Clear"));
cm.dispose();
return;

View File

@@ -57,8 +57,8 @@ function action(mode, type, selection) {
if(harpNote != nextNote) {
cm.setQuestProgress(3114, 0);
cm.getPlayer().announce(PacketCreator.showEffect("quest/party/wrong_kor"));
cm.getPlayer().announce(PacketCreator.playSound("Party1/Failed"));
cm.getPlayer().sendPacket(PacketCreator.showEffect("quest/party/wrong_kor"));
cm.getPlayer().sendPacket(PacketCreator.playSound("Party1/Failed"));
cm.message("You've missed the note... Start over again.");
} else {
@@ -71,8 +71,8 @@ function action(mode, type, selection) {
cm.message("Twinkle, twinkle, little star, how I wonder what you are.");
cm.setQuestProgress(3114, 42);
cm.getPlayer().announce(PacketCreator.showEffect("quest/party/clear"));
cm.getPlayer().announce(PacketCreator.playSound("Party1/Clear"));
cm.getPlayer().sendPacket(PacketCreator.showEffect("quest/party/clear"));
cm.getPlayer().sendPacket(PacketCreator.playSound("Party1/Clear"));
cm.dispose();
return;

View File

@@ -57,8 +57,8 @@ function action(mode, type, selection) {
if(harpNote != nextNote) {
cm.setQuestProgress(3114, 0);
cm.getPlayer().announce(PacketCreator.showEffect("quest/party/wrong_kor"));
cm.getPlayer().announce(PacketCreator.playSound("Party1/Failed"));
cm.getPlayer().sendPacket(PacketCreator.showEffect("quest/party/wrong_kor"));
cm.getPlayer().sendPacket(PacketCreator.playSound("Party1/Failed"));
cm.message("You've missed the note... Start over again.");
} else {
@@ -71,8 +71,8 @@ function action(mode, type, selection) {
cm.message("Twinkle, twinkle, little star, how I wonder what you are.");
cm.setQuestProgress(3114, 42);
cm.getPlayer().announce(PacketCreator.showEffect("quest/party/clear"));
cm.getPlayer().announce(PacketCreator.playSound("Party1/Clear"));
cm.getPlayer().sendPacket(PacketCreator.showEffect("quest/party/clear"));
cm.getPlayer().sendPacket(PacketCreator.playSound("Party1/Clear"));
cm.dispose();
return;

View File

@@ -57,8 +57,8 @@ function action(mode, type, selection) {
if(harpNote != nextNote) {
cm.setQuestProgress(3114, 0);
cm.getPlayer().announce(PacketCreator.showEffect("quest/party/wrong_kor"));
cm.getPlayer().announce(PacketCreator.playSound("Party1/Failed"));
cm.getPlayer().sendPacket(PacketCreator.showEffect("quest/party/wrong_kor"));
cm.getPlayer().sendPacket(PacketCreator.playSound("Party1/Failed"));
cm.message("You've missed the note... Start over again.");
} else {
@@ -71,8 +71,8 @@ function action(mode, type, selection) {
cm.message("Twinkle, twinkle, little star, how I wonder what you are.");
cm.setQuestProgress(3114, 42);
cm.getPlayer().announce(PacketCreator.showEffect("quest/party/clear"));
cm.getPlayer().announce(PacketCreator.playSound("Party1/Clear"));
cm.getPlayer().sendPacket(PacketCreator.showEffect("quest/party/clear"));
cm.getPlayer().sendPacket(PacketCreator.playSound("Party1/Clear"));
cm.dispose();
return;

View File

@@ -57,8 +57,8 @@ function action(mode, type, selection) {
if(harpNote != nextNote) {
cm.setQuestProgress(3114, 0);
cm.getPlayer().announce(PacketCreator.showEffect("quest/party/wrong_kor"));
cm.getPlayer().announce(PacketCreator.playSound("Party1/Failed"));
cm.getPlayer().sendPacket(PacketCreator.showEffect("quest/party/wrong_kor"));
cm.getPlayer().sendPacket(PacketCreator.playSound("Party1/Failed"));
cm.message("You've missed the note... Start over again.");
} else {
@@ -71,8 +71,8 @@ function action(mode, type, selection) {
cm.message("Twinkle, twinkle, little star, how I wonder what you are.");
cm.setQuestProgress(3114, 42);
cm.getPlayer().announce(PacketCreator.showEffect("quest/party/clear"));
cm.getPlayer().announce(PacketCreator.playSound("Party1/Clear"));
cm.getPlayer().sendPacket(PacketCreator.showEffect("quest/party/clear"));
cm.getPlayer().sendPacket(PacketCreator.playSound("Party1/Clear"));
cm.dispose();
return;

View File

@@ -57,8 +57,8 @@ function action(mode, type, selection) {
if(harpNote != nextNote) {
cm.setQuestProgress(3114, 0);
cm.getPlayer().announce(PacketCreator.showEffect("quest/party/wrong_kor"));
cm.getPlayer().announce(PacketCreator.playSound("Party1/Failed"));
cm.getPlayer().sendPacket(PacketCreator.showEffect("quest/party/wrong_kor"));
cm.getPlayer().sendPacket(PacketCreator.playSound("Party1/Failed"));
cm.message("You've missed the note... Start over again.");
} else {
@@ -71,8 +71,8 @@ function action(mode, type, selection) {
cm.message("Twinkle, twinkle, little star, how I wonder what you are.");
cm.setQuestProgress(3114, 42);
cm.getPlayer().announce(PacketCreator.showEffect("quest/party/clear"));
cm.getPlayer().announce(PacketCreator.playSound("Party1/Clear"));
cm.getPlayer().sendPacket(PacketCreator.showEffect("quest/party/clear"));
cm.getPlayer().sendPacket(PacketCreator.playSound("Party1/Clear"));
cm.dispose();
return;

View File

@@ -57,8 +57,8 @@ function action(mode, type, selection) {
if(harpNote != nextNote) {
cm.setQuestProgress(3114, 0);
cm.getPlayer().announce(PacketCreator.showEffect("quest/party/wrong_kor"));
cm.getPlayer().announce(PacketCreator.playSound("Party1/Failed"));
cm.getPlayer().sendPacket(PacketCreator.showEffect("quest/party/wrong_kor"));
cm.getPlayer().sendPacket(PacketCreator.playSound("Party1/Failed"));
cm.message("You've missed the note... Start over again.");
} else {
@@ -71,8 +71,8 @@ function action(mode, type, selection) {
cm.message("Twinkle, twinkle, little star, how I wonder what you are.");
cm.setQuestProgress(3114, 42);
cm.getPlayer().announce(PacketCreator.showEffect("quest/party/clear"));
cm.getPlayer().announce(PacketCreator.playSound("Party1/Clear"));
cm.getPlayer().sendPacket(PacketCreator.showEffect("quest/party/clear"));
cm.getPlayer().sendPacket(PacketCreator.playSound("Party1/Clear"));
cm.dispose();
return;

View File

@@ -27,7 +27,7 @@ function action(mode, type, selection) {
}
const PacketCreator = Java.type('tools.PacketCreator');
cm.getClient().announce(PacketCreator.openRPSNPC());
cm.getClient().sendPacket(PacketCreator.openRPSNPC());
cm.dispose();
}
}

View File

@@ -303,15 +303,15 @@ function action(mode, type, selection) {
const PacketCreator = Java.type('tools.PacketCreator');
if (YamlConfig.config.server.WEDDING_BLESSER_SHOWFX) {
var target = cm.getPlayer();
target.announce(PacketCreator.showSpecialEffect(9));
target.sendPacket(PacketCreator.showSpecialEffect(9));
target.getMap().broadcastMessage(target, PacketCreator.showForeignEffect(target.getId(), 9), false);
} else {
var target = eim.getPlayerById(eim.getIntProperty("groomId"));
target.announce(PacketCreator.showSpecialEffect(9));
target.sendPacket(PacketCreator.showSpecialEffect(9));
target.getMap().broadcastMessage(target, PacketCreator.showForeignEffect(target.getId(), 9), false);
target = eim.getPlayerById(eim.getIntProperty("brideId"));
target.announce(PacketCreator.showSpecialEffect(9));
target.sendPacket(PacketCreator.showSpecialEffect(9));
target.getMap().broadcastMessage(target, PacketCreator.showForeignEffect(target.getId(), 9), false);
}
@@ -357,8 +357,8 @@ function action(mode, type, selection) {
partner.setMarriageItemId(marriageRingId);
//var marriageId = eim.getIntProperty("weddingId");
//player.announce(Wedding.OnMarriageResult(marriageId, player, true));
//partner.announce(Wedding.OnMarriageResult(marriageId, player, true));
//player.sendPacket(Wedding.OnMarriageResult(marriageId, player, true));
//partner.sendPacket(Wedding.OnMarriageResult(marriageId, player, true));
giveCoupleBlessings(eim, player, partner);

View File

@@ -173,15 +173,15 @@ function action(mode, type, selection) {
const PacketCreator = Java.type('tools.PacketCreator');
if(YamlConfig.config.server.WEDDING_BLESSER_SHOWFX) {
var target = cm.getPlayer();
target.announce(PacketCreator.showSpecialEffect(9));
target.sendPacket(PacketCreator.showSpecialEffect(9));
target.getMap().broadcastMessage(target, PacketCreator.showForeignEffect(target.getId(), 9), false);
} else {
var target = eim.getPlayerById(eim.getIntProperty("groomId"));
target.announce(PacketCreator.showSpecialEffect(9));
target.sendPacket(PacketCreator.showSpecialEffect(9));
target.getMap().broadcastMessage(target, PacketCreator.showForeignEffect(target.getId(), 9), false);
target = eim.getPlayerById(eim.getIntProperty("brideId"));
target.announce(PacketCreator.showSpecialEffect(9));
target.sendPacket(PacketCreator.showSpecialEffect(9));
target.getMap().broadcastMessage(target, PacketCreator.showForeignEffect(target.getId(), 9), false);
}
@@ -227,8 +227,8 @@ function action(mode, type, selection) {
partner.setMarriageItemId(marriageRingId);
//var marriageId = eim.getIntProperty("weddingId");
//player.announce(Wedding.OnMarriageResult(marriageId, player, true));
//partner.announce(Wedding.OnMarriageResult(marriageId, player, true));
//player.sendPacket(Wedding.OnMarriageResult(marriageId, player, true));
//partner.sendPacket(Wedding.OnMarriageResult(marriageId, player, true));
giveCoupleBlessings(eim, player, partner);

View File

@@ -309,7 +309,7 @@ function writeAllFeatures() {
function start() {
const PacketCreator = Java.type('tools.PacketCreator');
cm.getPlayer().announce(PacketCreator.musicChange(anthemSong));
cm.getPlayer().sendPacket(PacketCreator.musicChange(anthemSong));
status = -1;
writeAllFeatures();
action(1, 0, 0);
@@ -318,11 +318,11 @@ function start() {
function action(mode, type, selection) {
const PacketCreator = Java.type('tools.PacketCreator');
if (mode == -1) {
cm.getPlayer().announce(PacketCreator.musicChange(ambientSong));
cm.getPlayer().sendPacket(PacketCreator.musicChange(ambientSong));
cm.dispose();
} else {
if (mode == 0 && type > 0) {
cm.getPlayer().announce(PacketCreator.musicChange(ambientSong));
cm.getPlayer().sendPacket(PacketCreator.musicChange(ambientSong));
cm.dispose();
return;
}
@@ -356,7 +356,7 @@ function action(mode, type, selection) {
cm.sendPrev(sendStr);
} else {
cm.getPlayer().announce(PacketCreator.musicChange(ambientSong));
cm.getPlayer().sendPacket(PacketCreator.musicChange(ambientSong));
cm.dispose();
}
}

View File

@@ -22,7 +22,7 @@ function action(mode, type, selection){
if(cm.getText() == cm.getQuestProgress(3360)){
cm.setQuestProgress(3360, 1);
const PacketCreator = Java.type('tools.PacketCreator');
cm.getPlayer().announce(PacketCreator.playPortalSound());
cm.getPlayer().sendPacket(PacketCreator.playPortalSound());
cm.warp(261030000, "sp_" + ((cm.getMapId() == 261010000) ? "jenu" : "alca"));
}
else {