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

@@ -77,7 +77,7 @@ public class BuybackProcessor {
map.broadcastMessage(PacketCreator.playSound("Buyback/" + jobString));
map.broadcastMessage(PacketCreator.earnTitleMessage(chr.getName() + " just bought back into the game!"));
chr.announce(PacketCreator.showBuybackEffect());
chr.sendPacket(PacketCreator.showBuybackEffect());
map.broadcastMessage(chr, PacketCreator.showForeignBuybackEffect(chr.getId()), false);
}
}

View File

@@ -65,8 +65,8 @@ public class MakerProcessor {
int fromLeftover = toCreate;
toCreate = ii.getMakerCrystalFromLeftover(toCreate);
if(toCreate == -1) {
c.announce(PacketCreator.serverNotice(1, ii.getName(fromLeftover) + " is unavailable for Monster Crystal conversion."));
c.announce(PacketCreator.makerEnableActions());
c.sendPacket(PacketCreator.serverNotice(1, ii.getName(fromLeftover) + " is unavailable for Monster Crystal conversion."));
c.sendPacket(PacketCreator.makerEnableActions());
return;
}
@@ -83,13 +83,13 @@ public class MakerProcessor {
if(p != null) {
recipe = MakerItemFactory.generateDisassemblyCrystalEntry(toDisassemble, p.getLeft(), p.getRight());
} else {
c.announce(PacketCreator.serverNotice(1, ii.getName(toCreate) + " is unavailable for Monster Crystal disassembly."));
c.announce(PacketCreator.makerEnableActions());
c.sendPacket(PacketCreator.serverNotice(1, ii.getName(toCreate) + " is unavailable for Monster Crystal disassembly."));
c.sendPacket(PacketCreator.makerEnableActions());
return;
}
} else {
c.announce(PacketCreator.serverNotice(1, "An unknown error occurred when trying to apply that item for disassembly."));
c.announce(PacketCreator.makerEnableActions());
c.sendPacket(PacketCreator.serverNotice(1, "An unknown error occurred when trying to apply that item for disassembly."));
c.sendPacket(PacketCreator.makerEnableActions());
return;
}
} else {
@@ -136,8 +136,8 @@ public class MakerProcessor {
if(!reagentids.isEmpty()) {
if(!removeOddMakerReagents(toCreate, reagentids)) {
c.announce(PacketCreator.serverNotice(1, "You can only use WATK and MATK Strengthening Gems on weapon items."));
c.announce(PacketCreator.makerEnableActions());
c.sendPacket(PacketCreator.serverNotice(1, "You can only use WATK and MATK Strengthening Gems on weapon items."));
c.sendPacket(PacketCreator.makerEnableActions());
return;
}
}
@@ -151,33 +151,33 @@ public class MakerProcessor {
switch(createStatus) {
case -1:// non-available for Maker itemid has been tried to forge
FilePrinter.printError(FilePrinter.EXPLOITS, "Player " + c.getPlayer().getName() + " tried to craft itemid " + toCreate + " using the Maker skill.");
c.announce(PacketCreator.serverNotice(1, "The requested item could not be crafted on this operation."));
c.announce(PacketCreator.makerEnableActions());
c.sendPacket(PacketCreator.serverNotice(1, "The requested item could not be crafted on this operation."));
c.sendPacket(PacketCreator.makerEnableActions());
break;
case 1: // no items
c.announce(PacketCreator.serverNotice(1, "You don't have all required items in your inventory to make " + ii.getName(toCreate) + "."));
c.announce(PacketCreator.makerEnableActions());
c.sendPacket(PacketCreator.serverNotice(1, "You don't have all required items in your inventory to make " + ii.getName(toCreate) + "."));
c.sendPacket(PacketCreator.makerEnableActions());
break;
case 2: // no meso
c.announce(PacketCreator.serverNotice(1, "You don't have enough mesos (" + GameConstants.numberWithCommas(recipe.getCost()) + ") to complete this operation."));
c.announce(PacketCreator.makerEnableActions());
c.sendPacket(PacketCreator.serverNotice(1, "You don't have enough mesos (" + GameConstants.numberWithCommas(recipe.getCost()) + ") to complete this operation."));
c.sendPacket(PacketCreator.makerEnableActions());
break;
case 3: // no req level
c.announce(PacketCreator.serverNotice(1, "You don't have enough level to complete this operation."));
c.announce(PacketCreator.makerEnableActions());
c.sendPacket(PacketCreator.serverNotice(1, "You don't have enough level to complete this operation."));
c.sendPacket(PacketCreator.makerEnableActions());
break;
case 4: // no req skill level
c.announce(PacketCreator.serverNotice(1, "You don't have enough Maker level to complete this operation."));
c.announce(PacketCreator.makerEnableActions());
c.sendPacket(PacketCreator.serverNotice(1, "You don't have enough Maker level to complete this operation."));
c.sendPacket(PacketCreator.makerEnableActions());
break;
case 5: // inventory full
c.announce(PacketCreator.serverNotice(1, "Your inventory is full."));
c.announce(PacketCreator.makerEnableActions());
c.sendPacket(PacketCreator.serverNotice(1, "Your inventory is full."));
c.sendPacket(PacketCreator.makerEnableActions());
break;
default:
@@ -214,14 +214,14 @@ public class MakerProcessor {
// thanks inhyuk for noticing missing MAKER_RESULT packets
if (type == 3) {
c.announce(PacketCreator.makerResultCrystal(recipe.getGainItems().get(0).getLeft(), recipe.getReqItems().get(0).getLeft()));
c.sendPacket(PacketCreator.makerResultCrystal(recipe.getGainItems().get(0).getLeft(), recipe.getReqItems().get(0).getLeft()));
} else if (type == 4) {
c.announce(PacketCreator.makerResultDesynth(recipe.getReqItems().get(0).getLeft(), recipe.getCost(), recipe.getGainItems()));
c.sendPacket(PacketCreator.makerResultDesynth(recipe.getReqItems().get(0).getLeft(), recipe.getCost(), recipe.getGainItems()));
} else {
c.announce(PacketCreator.makerResult(makerSucceeded, recipe.getGainItems().get(0).getLeft(), recipe.getGainItems().get(0).getRight(), recipe.getCost(), recipe.getReqItems(), stimulantid, new LinkedList<>(reagentids.keySet())));
c.sendPacket(PacketCreator.makerResult(makerSucceeded, recipe.getGainItems().get(0).getLeft(), recipe.getGainItems().get(0).getRight(), recipe.getCost(), recipe.getReqItems(), stimulantid, new LinkedList<>(reagentids.keySet())));
}
c.announce(PacketCreator.showMakerEffect(makerSucceeded));
c.sendPacket(PacketCreator.showMakerEffect(makerSucceeded));
c.getPlayer().getMap().broadcastMessage(c.getPlayer(), PacketCreator.showForeignMakerEffect(c.getPlayer().getId(), makerSucceeded), false);
if(toCreate == 4260003 && type == 3 && c.getPlayer().getQuestStatus(6033) == 1) {

View File

@@ -83,7 +83,7 @@ public class PetAutopotProcessor {
MapleClient c = this.c;
MapleCharacter chr = c.getPlayer();
if (!chr.isAlive()) {
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return;
}
@@ -102,7 +102,7 @@ public class PetAutopotProcessor {
toUse = useInv.getItem(slot);
if (toUse != null) {
if (toUse.getItemId() != itemId) {
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return;
}
@@ -111,7 +111,7 @@ public class PetAutopotProcessor {
// from now on, toUse becomes the "cursor" for the current pot being used
if (toUse.getQuantity() <= 0) {
if (!cursorOnNextAvailablePot(chr)) {
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return;
}
}
@@ -179,7 +179,7 @@ public class PetAutopotProcessor {
}
}
chr.announce(PacketCreator.enableActions());
chr.sendPacket(PacketCreator.enableActions());
}
}

View File

@@ -52,7 +52,7 @@ public class SpawnPetProcessor {
{
if (chr.haveItem(petid + 1)) {
chr.dropMessage(5, "You can't hatch your " + (petid == 5000028 ? "Dragon egg" : "Robo egg") + " if you already have a Baby " + (petid == 5000028 ? "Dragon." : "Robo."));
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return;
} else {
int evolveid = MapleDataTool.getInt("info/evol1", dataRoot.getData("Pet/" + petid + ".img"));
@@ -64,7 +64,7 @@ public class SpawnPetProcessor {
MapleInventoryManipulator.removeById(c, MapleInventoryType.CASH, petid, (short) 1, false, false);
MapleInventoryManipulator.addById(c, evolveid, (short) 1, null, petId, expiration);
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return;
}
}
@@ -86,8 +86,8 @@ public class SpawnPetProcessor {
pet.saveToDb();
chr.addPet(pet);
chr.getMap().broadcastMessage(c.getPlayer(), PacketCreator.showPet(c.getPlayer(), pet, false, false), true);
c.announce(PacketCreator.petStatUpdate(c.getPlayer()));
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.petStatUpdate(c.getPlayer()));
c.sendPacket(PacketCreator.enableActions());
chr.commitExcludedItems();
chr.getClient().getWorldServer().registerPetHunger(chr, chr.getPetIndex(pet));

View File

@@ -117,7 +117,7 @@ public class DueyProcessor {
ps2.setInt(1, player.getId());
ps2.executeUpdate();
c.announce(PacketCreator.sendDueyParcelReceived(rs.getString("SenderName"), rs.getInt("Type") == 1));
c.sendPacket(PacketCreator.sendDueyParcelReceived(rs.getString("SenderName"), rs.getInt("Type") == 1));
}
}
}
@@ -305,21 +305,21 @@ public class DueyProcessor {
int recipientAccId = accIdCid.getLeft();
if (recipientAccId != -1) {
if (recipientAccId == c.getAccID()) {
c.announce(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_SAMEACC_ERROR.getCode()));
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_SAMEACC_ERROR.getCode()));
return;
}
} else {
c.announce(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_NAME_DOES_NOT_EXIST.getCode()));
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_NAME_DOES_NOT_EXIST.getCode()));
return;
}
} else {
c.announce(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_NOT_ENOUGH_MESOS.getCode()));
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_NOT_ENOUGH_MESOS.getCode()));
return;
}
int recipientCid = accIdCid.getRight();
if (recipientCid == -1) {
c.announce(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_NAME_DOES_NOT_EXIST.getCode()));
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_NAME_DOES_NOT_EXIST.getCode()));
return;
}
@@ -329,18 +329,18 @@ public class DueyProcessor {
int packageId = createPackage(sendMesos, sendMessage, c.getPlayer().getName(), recipientCid, quick);
if (packageId == -1) {
c.announce(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_ENABLE_ACTIONS.getCode()));
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_ENABLE_ACTIONS.getCode()));
return;
}
c.getPlayer().gainMeso((int) -finalcost, false);
int res = addPackageItemFromInventory(packageId, c, invTypeId, itemPos, amount);
if (res == 0) {
c.announce(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_SUCCESSFULLY_SENT.getCode()));
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_SUCCESSFULLY_SENT.getCode()));
} else if (res > 0) {
c.announce(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_ENABLE_ACTIONS.getCode()));
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_ENABLE_ACTIONS.getCode()));
} else {
c.announce(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_INCORRECT_REQUEST.getCode()));
c.sendPacket(PacketCreator.sendDueyMSG(DueyProcessor.Actions.TOCLIENT_SEND_INCORRECT_REQUEST.getCode()));
}
MapleClient rClient = null;
@@ -368,7 +368,7 @@ public class DueyProcessor {
if (c.tryacquireClient()) {
try {
removePackageFromDB(packageid);
c.announce(PacketCreator.removeItemFromDuey(playerRemove, packageid));
c.sendPacket(PacketCreator.removeItemFromDuey(playerRemove, packageid));
} finally {
c.releaseClient();
}
@@ -392,29 +392,29 @@ public class DueyProcessor {
}
if (dp == null) {
c.announce(PacketCreator.sendDueyMSG(Actions.TOCLIENT_RECV_UNKNOWN_ERROR.getCode()));
c.sendPacket(PacketCreator.sendDueyMSG(Actions.TOCLIENT_RECV_UNKNOWN_ERROR.getCode()));
FilePrinter.printError(FilePrinter.EXPLOITS + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + " tried to receive package from duey with id " + packageId);
return;
}
if (dp.isDeliveringTime()) {
c.announce(PacketCreator.sendDueyMSG(Actions.TOCLIENT_RECV_UNKNOWN_ERROR.getCode()));
c.sendPacket(PacketCreator.sendDueyMSG(Actions.TOCLIENT_RECV_UNKNOWN_ERROR.getCode()));
return;
}
Item dpItem = dp.getItem();
if (dpItem != null) {
if (!c.getPlayer().canHoldMeso(dp.getMesos())) {
c.announce(PacketCreator.sendDueyMSG(Actions.TOCLIENT_RECV_UNKNOWN_ERROR.getCode()));
c.sendPacket(PacketCreator.sendDueyMSG(Actions.TOCLIENT_RECV_UNKNOWN_ERROR.getCode()));
return;
}
if (!MapleInventoryManipulator.checkSpace(c, dpItem.getItemId(), dpItem.getQuantity(), dpItem.getOwner())) {
int itemid = dpItem.getItemId();
if (MapleItemInformationProvider.getInstance().isPickupRestricted(itemid) && c.getPlayer().getInventory(ItemConstants.getInventoryType(itemid)).findById(itemid) != null) {
c.announce(PacketCreator.sendDueyMSG(Actions.TOCLIENT_RECV_RECEIVER_WITH_UNIQUE.getCode()));
c.sendPacket(PacketCreator.sendDueyMSG(Actions.TOCLIENT_RECV_RECEIVER_WITH_UNIQUE.getCode()));
} else {
c.announce(PacketCreator.sendDueyMSG(Actions.TOCLIENT_RECV_NO_FREE_SLOTS.getCode()));
c.sendPacket(PacketCreator.sendDueyMSG(Actions.TOCLIENT_RECV_NO_FREE_SLOTS.getCode()));
}
return;
@@ -440,15 +440,15 @@ public class DueyProcessor {
try {
long timeNow = System.currentTimeMillis();
if (timeNow - c.getPlayer().getNpcCooldown() < YamlConfig.config.server.BLOCK_NPC_RACE_CONDT) {
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return;
}
c.getPlayer().setNpcCooldown(timeNow);
if (quickDelivery) {
c.announce(PacketCreator.sendDuey(0x1A, null));
c.sendPacket(PacketCreator.sendDuey(0x1A, null));
} else {
c.announce(PacketCreator.sendDuey(0x8, loadPackages(c.getPlayer())));
c.sendPacket(PacketCreator.sendDuey(0x8, loadPackages(c.getPlayer())));
}
} finally {
c.releaseClient();

View File

@@ -275,7 +275,7 @@ public class FredrickProcessor {
byte response = canRetrieveFromFredrick(chr, items);
if (response != 0) {
chr.announce(PacketCreator.fredrickMessage(response));
chr.sendPacket(PacketCreator.fredrickMessage(response));
return;
}
@@ -294,7 +294,7 @@ public class FredrickProcessor {
FilePrinter.print(FilePrinter.FREDRICK + chr.getName() + ".txt", chr.getName() + " gained " + item.getQuantity() + " " + itemName + " (" + item.getItemId() + ")");
}
chr.announce(PacketCreator.fredrickMessage((byte) 0x1E));
chr.sendPacket(PacketCreator.fredrickMessage((byte) 0x1E));
removeFredrickLog(chr.getId());
} else {
chr.message("An unknown error has occured.");

View File

@@ -52,7 +52,7 @@ public class StorageProcessor {
if (chr.getLevel() < 15){
chr.dropMessage(1, "You may only use the storage once you have reached level 15.");
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return;
}
@@ -71,13 +71,13 @@ public class StorageProcessor {
Item item = storage.getItem(slot);
if (item != null) {
if (ii.isPickupRestricted(item.getItemId()) && chr.haveItemWithId(item.getItemId(), true)) {
c.announce(PacketCreator.getStorageError((byte) 0x0C));
c.sendPacket(PacketCreator.getStorageError((byte) 0x0C));
return;
}
int takeoutFee = storage.getTakeOutFee();
if (chr.getMeso() < takeoutFee) {
c.announce(PacketCreator.getStorageError((byte) 0x0B));
c.sendPacket(PacketCreator.getStorageError((byte) 0x0B));
return;
} else {
chr.gainMeso(-takeoutFee, false);
@@ -95,11 +95,11 @@ public class StorageProcessor {
storage.sendTakenOut(c, item.getInventoryType());
} else {
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return;
}
} else {
c.announce(PacketCreator.getStorageError((byte) 0x0A));
c.sendPacket(PacketCreator.getStorageError((byte) 0x0A));
}
}
} else if (mode == 5) { // store
@@ -115,17 +115,17 @@ public class StorageProcessor {
return;
}
if (quantity < 1) {
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return;
}
if (storage.isFull()) {
c.announce(PacketCreator.getStorageError((byte) 0x11));
c.sendPacket(PacketCreator.getStorageError((byte) 0x11));
return;
}
int storeFee = storage.getStoreFee();
if (chr.getMeso() < storeFee) {
c.announce(PacketCreator.getStorageError((byte) 0x0B));
c.sendPacket(PacketCreator.getStorageError((byte) 0x0B));
} else {
Item item;
@@ -134,7 +134,7 @@ public class StorageProcessor {
item = inv.getItem(slot);
if (item != null && item.getItemId() == itemId && (item.getQuantity() >= quantity || ItemConstants.isRechargeable(itemId))) {
if (ItemConstants.isWeddingRing(itemId) || ItemConstants.isWeddingToken(itemId)) {
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return;
}
@@ -144,7 +144,7 @@ public class StorageProcessor {
MapleInventoryManipulator.removeFromSlot(c, invType, slot, quantity, false);
} else {
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return;
}
@@ -168,7 +168,7 @@ public class StorageProcessor {
}
} else if (mode == 6) { // arrange items
if(YamlConfig.config.server.USE_STORAGE_ITEM_SORT) storage.arrangeItems(c);
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
} else if (mode == 7) { // meso
int meso = slea.readInt();
int storageMesos = storage.getMeso();
@@ -177,13 +177,13 @@ public class StorageProcessor {
if (meso < 0 && (storageMesos - meso) < 0) {
meso = Integer.MIN_VALUE + storageMesos;
if (meso < playerMesos) {
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return;
}
} else if (meso > 0 && (playerMesos + meso) < 0) {
meso = Integer.MAX_VALUE - playerMesos;
if (meso > storageMesos) {
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return;
}
}
@@ -193,7 +193,7 @@ public class StorageProcessor {
FilePrinter.print(FilePrinter.STORAGE + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + (meso > 0 ? " took out " : " stored ") + Math.abs(meso) + " mesos");
storage.sendMeso(c);
} else {
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return;
}
} else if (mode == 8) {// close... unless the player decides to enter cash shop!

View File

@@ -329,11 +329,11 @@ public class AssignAPProcessor {
}
chr.assignStrDexIntLuk(statGain[0], statGain[1], statGain[3], statGain[2]);
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
//----------------------------------------------------------------------------------------
c.announce(PacketCreator.serverNotice(1, "Better AP applications detected:\r\nSTR: +" + statGain[0] + "\r\nDEX: +" + statGain[1] + "\r\nINT: +" + statGain[3] + "\r\nLUK: +" + statGain[2]));
c.sendPacket(PacketCreator.serverNotice(1, "Better AP applications detected:\r\nSTR: +" + statGain[0] + "\r\nDEX: +" + statGain[1] + "\r\nINT: +" + statGain[3] + "\r\nLUK: +" + statGain[2]));
} else {
if(slea.available() < 16) {
AutobanFactory.PACKET_EDIT.alert(chr, "Didn't send full packet for Auto Assign.");
@@ -353,7 +353,7 @@ public class AssignAPProcessor {
}
chr.assignStrDexIntLuk(statGain[0], statGain[1], statGain[3], statGain[2]);
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
}
} finally {
c.unlockClient();
@@ -426,48 +426,48 @@ public class AssignAPProcessor {
case 64: // str
if (player.getStr() < 5) {
player.message("You don't have the minimum STR required to swap.");
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return false;
}
if (!player.assignStr(-1)) {
player.message("Couldn't execute AP reset operation.");
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return false;
}
break;
case 128: // dex
if (player.getDex() < 5) {
player.message("You don't have the minimum DEX required to swap.");
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return false;
}
if (!player.assignDex(-1)) {
player.message("Couldn't execute AP reset operation.");
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return false;
}
break;
case 256: // int
if (player.getInt() < 5) {
player.message("You don't have the minimum INT required to swap.");
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return false;
}
if (!player.assignInt(-1)) {
player.message("Couldn't execute AP reset operation.");
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return false;
}
break;
case 512: // luk
if (player.getLuk() < 5) {
player.message("You don't have the minimum LUK required to swap.");
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return false;
}
if (!player.assignLuk(-1)) {
player.message("Couldn't execute AP reset operation.");
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return false;
}
break;
@@ -475,14 +475,14 @@ public class AssignAPProcessor {
if(YamlConfig.config.server.USE_ENFORCE_HPMP_SWAP) {
if (APTo != 8192) {
player.message("You can only swap HP ability points to MP.");
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return false;
}
}
if (player.getHpMpApUsed() < 1) {
player.message("You don't have enough HPMP stat points to spend on AP Reset.");
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return false;
}
@@ -490,7 +490,7 @@ public class AssignAPProcessor {
int level_ = player.getLevel();
if (hp < level_ * 14 + 148) {
player.message("You don't have the minimum HP pool required to swap.");
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return false;
}
@@ -506,14 +506,14 @@ public class AssignAPProcessor {
if(YamlConfig.config.server.USE_ENFORCE_HPMP_SWAP) {
if (APTo != 2048) {
player.message("You can only swap MP ability points to HP.");
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return false;
}
}
if (player.getHpMpApUsed() < 1) {
player.message("You don't have enough HPMP stat points to spend on AP Reset.");
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return false;
}
@@ -534,7 +534,7 @@ public class AssignAPProcessor {
if (!canWash) {
player.message("You don't have the minimum MP pool required to swap.");
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return false;
}
@@ -546,7 +546,7 @@ public class AssignAPProcessor {
}
break;
default:
c.announce(PacketCreator.updatePlayerStats(PacketCreator.EMPTY_STATUPDATE, true, player));
c.sendPacket(PacketCreator.updatePlayerStats(PacketCreator.EMPTY_STATUPDATE, true, player));
return false;
}
@@ -571,47 +571,47 @@ public class AssignAPProcessor {
case 64:
if (!chr.assignStr(1)) {
chr.message("Couldn't execute AP assign operation.");
chr.announce(PacketCreator.enableActions());
chr.sendPacket(PacketCreator.enableActions());
return false;
}
break;
case 128: // Dex
if (!chr.assignDex(1)) {
chr.message("Couldn't execute AP assign operation.");
chr.announce(PacketCreator.enableActions());
chr.sendPacket(PacketCreator.enableActions());
return false;
}
break;
case 256: // Int
if (!chr.assignInt(1)) {
chr.message("Couldn't execute AP assign operation.");
chr.announce(PacketCreator.enableActions());
chr.sendPacket(PacketCreator.enableActions());
return false;
}
break;
case 512: // Luk
if (!chr.assignLuk(1)) {
chr.message("Couldn't execute AP assign operation.");
chr.announce(PacketCreator.enableActions());
chr.sendPacket(PacketCreator.enableActions());
return false;
}
break;
case 2048:
if (!chr.assignHP(calcHpChange(chr, usedAPReset), 1)) {
chr.message("Couldn't execute AP assign operation.");
chr.announce(PacketCreator.enableActions());
chr.sendPacket(PacketCreator.enableActions());
return false;
}
break;
case 8192:
if (!chr.assignMP(calcMpChange(chr, usedAPReset), 1)) {
chr.message("Couldn't execute AP assign operation.");
chr.announce(PacketCreator.enableActions());
chr.sendPacket(PacketCreator.enableActions());
return false;
}
break;
default:
chr.announce(PacketCreator.updatePlayerStats(PacketCreator.EMPTY_STATUPDATE, true, chr));
chr.sendPacket(PacketCreator.updatePlayerStats(PacketCreator.EMPTY_STATUPDATE, true, chr));
return false;
}
return true;

View File

@@ -41,7 +41,7 @@ public class AssignSPProcessor {
public static boolean canSPAssign(MapleClient c, int skillid) {
if (skillid == Aran.HIDDEN_FULL_DOUBLE || skillid == Aran.HIDDEN_FULL_TRIPLE || skillid == Aran.HIDDEN_OVER_DOUBLE || skillid == Aran.HIDDEN_OVER_TRIPLE) {
c.announce(PacketCreator.enableActions());
c.sendPacket(PacketCreator.enableActions());
return false;
}
@@ -82,7 +82,7 @@ public class AssignSPProcessor {
if (!isBeginnerSkill) {
player.gainSp(-1, GameConstants.getSkillBook(skillid/10000), false);
} else {
player.announce(PacketCreator.enableActions());
player.sendPacket(PacketCreator.enableActions());
}
if (skill.getId() == Aran.FULL_SWING) {
player.changeSkillLevel(skill, (byte) (curLevel + 1), player.getMasterLevel(skill), player.getSkillExpiration(skill));