Remove "Maple" prefix from MaplePacketCreator name
This commit is contained in:
@@ -30,26 +30,18 @@ import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.inventory.manipulator.MapleKarmaManipulator;
|
||||
import config.YamlConfig;
|
||||
import constants.game.GameConstants;
|
||||
import constants.inventory.ItemConstants;
|
||||
|
||||
import net.AbstractMaplePacketHandler;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.maps.MaplePortal;
|
||||
import server.MapleTrade;
|
||||
import constants.game.GameConstants;
|
||||
import server.maps.FieldLimit;
|
||||
import server.maps.MapleHiredMerchant;
|
||||
import server.maps.MapleMapObject;
|
||||
import server.maps.MapleMapObjectType;
|
||||
import server.maps.MapleMiniGame;
|
||||
import server.maps.*;
|
||||
import server.maps.MapleMiniGame.MiniGameType;
|
||||
import server.maps.MaplePlayerShop;
|
||||
import server.maps.MaplePlayerShopItem;
|
||||
import tools.FilePrinter;
|
||||
import tools.MaplePacketCreator;
|
||||
import tools.PacketCreator;
|
||||
import tools.data.input.SeekableLittleEndianAccessor;
|
||||
|
||||
import java.awt.Point;
|
||||
import java.awt.*;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -136,7 +128,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
@Override
|
||||
public final void handlePacket(SeekableLittleEndianAccessor slea, MapleClient c) {
|
||||
if (!c.tryacquireClient()) { // thanks GabrielSin for pointing dupes within player interactions
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
c.announce(PacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -146,7 +138,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
if (mode == Action.CREATE.getCode()) {
|
||||
if(!chr.isAlive()) { // thanks GabrielSin for pointing this
|
||||
chr.getClient().announce(MaplePacketCreator.getMiniRoomError(4));
|
||||
chr.getClient().announce(PacketCreator.getMiniRoomError(4));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -156,7 +148,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
} else if (createType == 1) { // omok mini game
|
||||
int status = establishMiniroomStatus(chr, true);
|
||||
if (status > 0) {
|
||||
chr.getClient().announce(MaplePacketCreator.getMiniRoomError(status));
|
||||
chr.getClient().announce(PacketCreator.getMiniRoomError(status));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -176,7 +168,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
type = 0;
|
||||
}
|
||||
if (!chr.haveItem(4080000 + type)) {
|
||||
chr.getClient().announce(MaplePacketCreator.getMiniRoomError(6));
|
||||
chr.getClient().announce(PacketCreator.getMiniRoomError(6));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -185,12 +177,12 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
game.setPieceType(type);
|
||||
game.setGameType(MiniGameType.OMOK);
|
||||
chr.getMap().addMapObject(game);
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.addOmokBox(chr, 1, 0));
|
||||
chr.getMap().broadcastMessage(PacketCreator.addOmokBox(chr, 1, 0));
|
||||
game.sendOmok(c, type);
|
||||
} else if (createType == 2) { // matchcard
|
||||
int status = establishMiniroomStatus(chr, true);
|
||||
if (status > 0) {
|
||||
chr.getClient().announce(MaplePacketCreator.getMiniRoomError(status));
|
||||
chr.getClient().announce(PacketCreator.getMiniRoomError(status));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -210,7 +202,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
type = 0;
|
||||
}
|
||||
if (!chr.haveItem(4080100)) {
|
||||
chr.getClient().announce(MaplePacketCreator.getMiniRoomError(6));
|
||||
chr.getClient().announce(PacketCreator.getMiniRoomError(6));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -226,17 +218,17 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
game.setGameType(MiniGameType.MATCH_CARD);
|
||||
chr.setMiniGame(game);
|
||||
chr.getMap().addMapObject(game);
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.addMatchCardBox(chr, 1, 0));
|
||||
chr.getMap().broadcastMessage(PacketCreator.addMatchCardBox(chr, 1, 0));
|
||||
game.sendMatchCard(c, type);
|
||||
} else if (createType == 4 || createType == 5) { // shop
|
||||
if(!GameConstants.isFreeMarketRoom(chr.getMapId())) {
|
||||
chr.getClient().announce(MaplePacketCreator.getMiniRoomError(15));
|
||||
chr.getClient().announce(PacketCreator.getMiniRoomError(15));
|
||||
return;
|
||||
}
|
||||
|
||||
int status = establishMiniroomStatus(chr, false);
|
||||
if (status > 0) {
|
||||
chr.getClient().announce(MaplePacketCreator.getMiniRoomError(status));
|
||||
chr.getClient().announce(PacketCreator.getMiniRoomError(status));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -248,7 +240,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
slea.skip(3);
|
||||
int itemId = slea.readInt();
|
||||
if (chr.getInventory(MapleInventoryType.CASH).countById(itemId) < 1) {
|
||||
chr.getClient().announce(MaplePacketCreator.getMiniRoomError(6));
|
||||
chr.getClient().announce(PacketCreator.getMiniRoomError(6));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -258,13 +250,13 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
chr.getMap().addMapObject(shop);
|
||||
shop.sendShop(c);
|
||||
c.getWorldServer().registerPlayerShop(shop);
|
||||
//c.announce(MaplePacketCreator.getPlayerShopRemoveVisitor(1));
|
||||
//c.announce(PacketCreator.getPlayerShopRemoveVisitor(1));
|
||||
} else if (ItemConstants.isHiredMerchant(itemId)) {
|
||||
MapleHiredMerchant merchant = new MapleHiredMerchant(chr, desc, itemId);
|
||||
chr.setHiredMerchant(merchant);
|
||||
c.getWorldServer().registerHiredMerchant(merchant);
|
||||
chr.getClient().getChannelServer().addHiredMerchant(chr.getId(), merchant);
|
||||
chr.announce(MaplePacketCreator.getHiredMerchant(chr, merchant, true));
|
||||
chr.announce(PacketCreator.getHiredMerchant(chr, merchant, true));
|
||||
}
|
||||
}
|
||||
} else if (mode == Action.INVITE.getCode()) {
|
||||
@@ -282,7 +274,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
if (!chr.getTrade().isFullTrade() && !chr.getTrade().getPartner().isFullTrade()) {
|
||||
MapleTrade.visitTrade(chr, chr.getTrade().getPartner().getChr());
|
||||
} else {
|
||||
chr.getClient().announce(MaplePacketCreator.getMiniRoomError(2));
|
||||
chr.getClient().announce(PacketCreator.getMiniRoomError(2));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -311,10 +303,10 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
chr.getClient().announce(MaplePacketCreator.getMiniRoomError(2));
|
||||
chr.getClient().announce(PacketCreator.getMiniRoomError(2));
|
||||
}
|
||||
} else {
|
||||
chr.getClient().announce(MaplePacketCreator.getMiniRoomError(22));
|
||||
chr.getClient().announce(PacketCreator.getMiniRoomError(22));
|
||||
}
|
||||
} else if (ob instanceof MapleHiredMerchant && chr.getHiredMerchant() == null) {
|
||||
MapleHiredMerchant merchant = (MapleHiredMerchant) ob;
|
||||
@@ -355,11 +347,11 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
slea.readShort();
|
||||
int birthday = slea.readInt();
|
||||
if (!CashOperationHandler.checkBirthday(c, birthday)) { // birthday check here found thanks to lucasziron
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "Please check again the birthday date."));
|
||||
c.announce(PacketCreator.serverNotice(1, "Please check again the birthday date."));
|
||||
return;
|
||||
}
|
||||
|
||||
c.announce(MaplePacketCreator.hiredMerchantOwnerMaintenanceLeave());
|
||||
c.announce(PacketCreator.hiredMerchantOwnerMaintenanceLeave());
|
||||
}
|
||||
|
||||
if (!canPlaceStore(chr)) { // thanks Ari for noticing player shops overlapping on opening time
|
||||
@@ -375,32 +367,32 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
} catch(RuntimeException re) {} // fella does not have a player shop permit...
|
||||
}
|
||||
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.updatePlayerShopBox(shop));
|
||||
chr.getMap().broadcastMessage(PacketCreator.updatePlayerShopBox(shop));
|
||||
shop.setOpen(true);
|
||||
} else if (merchant != null && merchant.isOwner(chr)) {
|
||||
chr.setHasMerchant(true);
|
||||
merchant.setOpen(true);
|
||||
chr.getMap().addMapObject(merchant);
|
||||
chr.setHiredMerchant(null);
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.spawnHiredMerchantBox(merchant));
|
||||
chr.getMap().broadcastMessage(PacketCreator.spawnHiredMerchantBox(merchant));
|
||||
}
|
||||
} else if (mode == Action.READY.getCode()) {
|
||||
MapleMiniGame game = chr.getMiniGame();
|
||||
game.broadcast(MaplePacketCreator.getMiniGameReady(game));
|
||||
game.broadcast(PacketCreator.getMiniGameReady(game));
|
||||
} else if (mode == Action.UN_READY.getCode()) {
|
||||
MapleMiniGame game = chr.getMiniGame();
|
||||
game.broadcast(MaplePacketCreator.getMiniGameUnReady(game));
|
||||
game.broadcast(PacketCreator.getMiniGameUnReady(game));
|
||||
} else if (mode == Action.START.getCode()) {
|
||||
MapleMiniGame game = chr.getMiniGame();
|
||||
if (game.getGameType().equals(MiniGameType.OMOK)) {
|
||||
game.minigameMatchStarted();
|
||||
game.broadcast(MaplePacketCreator.getMiniGameStart(game, game.getLoser()));
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.addOmokBox(game.getOwner(), 2, 1));
|
||||
game.broadcast(PacketCreator.getMiniGameStart(game, game.getLoser()));
|
||||
chr.getMap().broadcastMessage(PacketCreator.addOmokBox(game.getOwner(), 2, 1));
|
||||
} else if (game.getGameType().equals(MiniGameType.MATCH_CARD)) {
|
||||
game.minigameMatchStarted();
|
||||
game.shuffleList();
|
||||
game.broadcast(MaplePacketCreator.getMatchCardStart(game, game.getLoser()));
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.addMatchCardBox(game.getOwner(), 2, 1));
|
||||
game.broadcast(PacketCreator.getMatchCardStart(game, game.getLoser()));
|
||||
chr.getMap().broadcastMessage(PacketCreator.addMatchCardBox(game.getOwner(), 2, 1));
|
||||
}
|
||||
} else if (mode == Action.GIVE_UP.getCode()) {
|
||||
MapleMiniGame game = chr.getMiniGame();
|
||||
@@ -421,9 +413,9 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
MapleMiniGame game = chr.getMiniGame();
|
||||
if (!game.isTieDenied(chr)) {
|
||||
if (game.isOwner(chr)) {
|
||||
game.broadcastToVisitor(MaplePacketCreator.getMiniGameRequestTie(game));
|
||||
game.broadcastToVisitor(PacketCreator.getMiniGameRequestTie(game));
|
||||
} else {
|
||||
game.broadcastToOwner(MaplePacketCreator.getMiniGameRequestTie(game));
|
||||
game.broadcastToOwner(PacketCreator.getMiniGameRequestTie(game));
|
||||
}
|
||||
}
|
||||
} else if (mode == Action.ANSWER_TIE.getCode()) {
|
||||
@@ -434,17 +426,17 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
game.denyTie(chr);
|
||||
|
||||
if (game.isOwner(chr)) {
|
||||
game.broadcastToVisitor(MaplePacketCreator.getMiniGameDenyTie(game));
|
||||
game.broadcastToVisitor(PacketCreator.getMiniGameDenyTie(game));
|
||||
} else {
|
||||
game.broadcastToOwner(MaplePacketCreator.getMiniGameDenyTie(game));
|
||||
game.broadcastToOwner(PacketCreator.getMiniGameDenyTie(game));
|
||||
}
|
||||
}
|
||||
} else if (mode == Action.SKIP.getCode()) {
|
||||
MapleMiniGame game = chr.getMiniGame();
|
||||
if (game.isOwner(chr)) {
|
||||
game.broadcast(MaplePacketCreator.getMiniGameSkipOwner(game));
|
||||
game.broadcast(PacketCreator.getMiniGameSkipOwner(game));
|
||||
} else {
|
||||
game.broadcast(MaplePacketCreator.getMiniGameSkipVisitor(game));
|
||||
game.broadcast(PacketCreator.getMiniGameSkipVisitor(game));
|
||||
}
|
||||
} else if (mode == Action.MOVE_OMOK.getCode()) {
|
||||
int x = slea.readInt(); // x point
|
||||
@@ -459,22 +451,22 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
if (turn == 1) {
|
||||
game.setFirstSlot(slot);
|
||||
if (game.isOwner(chr)) {
|
||||
game.broadcastToVisitor(MaplePacketCreator.getMatchCardSelect(game, turn, slot, firstslot, turn));
|
||||
game.broadcastToVisitor(PacketCreator.getMatchCardSelect(game, turn, slot, firstslot, turn));
|
||||
} else {
|
||||
game.getOwner().getClient().announce(MaplePacketCreator.getMatchCardSelect(game, turn, slot, firstslot, turn));
|
||||
game.getOwner().getClient().announce(PacketCreator.getMatchCardSelect(game, turn, slot, firstslot, turn));
|
||||
}
|
||||
} else if ((game.getCardId(firstslot)) == (game.getCardId(slot))) {
|
||||
if (game.isOwner(chr)) {
|
||||
game.broadcast(MaplePacketCreator.getMatchCardSelect(game, turn, slot, firstslot, 2));
|
||||
game.broadcast(PacketCreator.getMatchCardSelect(game, turn, slot, firstslot, 2));
|
||||
game.setOwnerPoints();
|
||||
} else {
|
||||
game.broadcast(MaplePacketCreator.getMatchCardSelect(game, turn, slot, firstslot, 3));
|
||||
game.broadcast(PacketCreator.getMatchCardSelect(game, turn, slot, firstslot, 3));
|
||||
game.setVisitorPoints();
|
||||
}
|
||||
} else if (game.isOwner(chr)) {
|
||||
game.broadcast(MaplePacketCreator.getMatchCardSelect(game, turn, slot, firstslot, 0));
|
||||
game.broadcast(PacketCreator.getMatchCardSelect(game, turn, slot, firstslot, 0));
|
||||
} else {
|
||||
game.broadcast(MaplePacketCreator.getMatchCardSelect(game, turn, slot, firstslot, 1));
|
||||
game.broadcast(PacketCreator.getMatchCardSelect(game, turn, slot, firstslot, 1));
|
||||
}
|
||||
} else if (mode == Action.SET_MESO.getCode()) {
|
||||
chr.getTrade().setMeso(slea.readInt());
|
||||
@@ -488,30 +480,30 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
if (targetSlot < 1 || targetSlot > 9) {
|
||||
System.out.println("[Hack] " + chr.getName() + " Trying to dupe on trade slot.");
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
c.announce(PacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
if (item == null) {
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "Invalid item description."));
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
c.announce(PacketCreator.serverNotice(1, "Invalid item description."));
|
||||
c.announce(PacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
if (ii.isUnmerchable(item.getItemId())) {
|
||||
if (ItemConstants.isPet(item.getItemId())) {
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "Pets are not allowed to be traded."));
|
||||
c.announce(PacketCreator.serverNotice(1, "Pets are not allowed to be traded."));
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "Cash items are not allowed to be traded."));
|
||||
c.announce(PacketCreator.serverNotice(1, "Cash items are not allowed to be traded."));
|
||||
}
|
||||
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
c.announce(PacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
if (quantity < 1 || quantity > item.getQuantity()) {
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "You don't have enough quantity of the item."));
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
c.announce(PacketCreator.serverNotice(1, "You don't have enough quantity of the item."));
|
||||
c.announce(PacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -520,8 +512,8 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
if ((quantity <= item.getQuantity() && quantity >= 0) || ItemConstants.isRechargeable(item.getItemId())) {
|
||||
if (ii.isDropRestricted(item.getItemId())) { // ensure that undroppable items do not make it to the trade window
|
||||
if (!MapleKarmaManipulator.hasKarmaFlag(item)) {
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "That item is untradeable."));
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
c.announce(PacketCreator.serverNotice(1, "That item is untradeable."));
|
||||
c.announce(PacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -531,8 +523,8 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
try {
|
||||
Item checkItem = chr.getInventory(ivType).getItem(pos);
|
||||
if (checkItem != item || checkItem.getPosition() != item.getPosition()) {
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "Invalid item description."));
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
c.announce(PacketCreator.serverNotice(1, "Invalid item description."));
|
||||
c.announce(PacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -547,9 +539,9 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
if (trade.addItem(tradeItem)) {
|
||||
MapleInventoryManipulator.removeFromSlot(c, ivType, item.getPosition(), quantity, true);
|
||||
|
||||
trade.getChr().announce(MaplePacketCreator.getTradeItemAdd((byte) 0, tradeItem));
|
||||
trade.getChr().announce(PacketCreator.getTradeItemAdd((byte) 0, tradeItem));
|
||||
if (trade.getPartner() != null) {
|
||||
trade.getPartner().getChr().announce(MaplePacketCreator.getTradeItemAdd((byte) 1, tradeItem));
|
||||
trade.getPartner().getChr().announce(PacketCreator.getTradeItemAdd((byte) 1, tradeItem));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -570,17 +562,17 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
Item ivItem = chr.getInventory(ivType).getItem(slot);
|
||||
|
||||
if (ivItem == null || ivItem.isUntradeable()) {
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "Could not perform shop operation with that item."));
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
c.announce(PacketCreator.serverNotice(1, "Could not perform shop operation with that item."));
|
||||
c.announce(PacketCreator.enableActions());
|
||||
return;
|
||||
} else if (MapleItemInformationProvider.getInstance().isUnmerchable(ivItem.getItemId())) {
|
||||
if (ItemConstants.isPet(ivItem.getItemId())) {
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "Pets are not allowed to be sold on the Player Store."));
|
||||
c.announce(PacketCreator.serverNotice(1, "Pets are not allowed to be sold on the Player Store."));
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "Cash items are not allowed to be sold on the Player Store."));
|
||||
c.announce(PacketCreator.serverNotice(1, "Cash items are not allowed to be sold on the Player Store."));
|
||||
}
|
||||
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
c.announce(PacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -590,8 +582,8 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
perBundle = 1;
|
||||
bundles = 1;
|
||||
} else if (ivItem.getQuantity() < (bundles * perBundle)) { // thanks GabrielSin for finding a dupe here
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "Could not perform shop operation with that item."));
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
c.announce(PacketCreator.serverNotice(1, "Could not perform shop operation with that item."));
|
||||
c.announce(PacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -612,7 +604,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
MapleHiredMerchant merchant = chr.getHiredMerchant();
|
||||
if (shop != null && shop.isOwner(chr)) {
|
||||
if (shop.isOpen() || !shop.addItem(shopItem)) { // thanks Vcoc for pointing an exploit with unlimited shop slots
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "You can't sell it anymore."));
|
||||
c.announce(PacketCreator.serverNotice(1, "You can't sell it anymore."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -622,15 +614,15 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
MapleInventoryManipulator.removeFromSlot(c, ivType, slot, (short) (bundles * perBundle), true);
|
||||
}
|
||||
|
||||
c.announce(MaplePacketCreator.getPlayerShopItemUpdate(shop));
|
||||
c.announce(PacketCreator.getPlayerShopItemUpdate(shop));
|
||||
} else if (merchant != null && merchant.isOwner(chr)) {
|
||||
if (ivType.equals(MapleInventoryType.CASH) && merchant.isPublished()) {
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "Cash items are only allowed to be sold when first opening the store."));
|
||||
c.announce(PacketCreator.serverNotice(1, "Cash items are only allowed to be sold when first opening the store."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (merchant.isOpen() || !merchant.addItem(shopItem)) { // thanks Vcoc for pointing an exploit with unlimited shop slots
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "You can't sell it anymore."));
|
||||
c.announce(PacketCreator.serverNotice(1, "You can't sell it anymore."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -640,7 +632,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
MapleInventoryManipulator.removeFromSlot(c, ivType, slot, (short) (bundles * perBundle), true);
|
||||
}
|
||||
|
||||
c.announce(MaplePacketCreator.updateHiredMerchant(merchant, chr));
|
||||
c.announce(PacketCreator.updateHiredMerchant(merchant, chr));
|
||||
|
||||
if (YamlConfig.config.server.USE_ENFORCE_MERCHANT_SAVE) {
|
||||
chr.saveCharToDB(false);
|
||||
@@ -652,7 +644,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "You can't sell without owning a shop."));
|
||||
c.announce(PacketCreator.serverNotice(1, "You can't sell without owning a shop."));
|
||||
}
|
||||
} else if (mode == Action.REMOVE_ITEM.getCode()) {
|
||||
if (isTradeOpen(chr)) return;
|
||||
@@ -660,7 +652,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
MaplePlayerShop shop = chr.getPlayerShop();
|
||||
if (shop != null && shop.isOwner(chr)) {
|
||||
if (shop.isOpen()) {
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "You can't take it with the store open."));
|
||||
c.announce(PacketCreator.serverNotice(1, "You can't take it with the store open."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -690,7 +682,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
merchant.closeOwnerMerchant(chr);
|
||||
return;
|
||||
}
|
||||
c.announce(MaplePacketCreator.updateHiredMerchant(merchant, chr));
|
||||
c.announce(PacketCreator.updateHiredMerchant(merchant, chr));
|
||||
|
||||
} else if (mode == Action.BUY.getCode() || mode == Action.MERCHANT_BUY.getCode()) {
|
||||
if (isTradeOpen(chr)) return;
|
||||
@@ -707,11 +699,11 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
MapleHiredMerchant merchant = chr.getHiredMerchant();
|
||||
if (shop != null && shop.isVisitor(chr)) {
|
||||
if (shop.buy(c, itemid, quantity)) {
|
||||
shop.broadcast(MaplePacketCreator.getPlayerShopItemUpdate(shop));
|
||||
shop.broadcast(PacketCreator.getPlayerShopItemUpdate(shop));
|
||||
}
|
||||
} else if (merchant != null && !merchant.isOwner(chr)) {
|
||||
merchant.buy(c, itemid, quantity);
|
||||
merchant.broadcastToVisitorsThreadsafe(MaplePacketCreator.updateHiredMerchant(merchant, chr));
|
||||
merchant.broadcastToVisitorsThreadsafe(PacketCreator.updateHiredMerchant(merchant, chr));
|
||||
}
|
||||
} else if (mode == Action.TAKE_ITEM_BACK.getCode()) {
|
||||
if (isTradeOpen(chr)) return;
|
||||
@@ -719,7 +711,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
MapleHiredMerchant merchant = chr.getHiredMerchant();
|
||||
if (merchant != null && merchant.isOwner(chr)) {
|
||||
if (merchant.isOpen()) {
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "You can't take it with the store open."));
|
||||
c.announce(PacketCreator.serverNotice(1, "You can't take it with the store open."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -751,13 +743,13 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
} else {
|
||||
merchant.clearMessages();
|
||||
merchant.setOpen(true);
|
||||
merchant.getMap().broadcastMessage(MaplePacketCreator.updateHiredMerchantBox(merchant));
|
||||
merchant.getMap().broadcastMessage(PacketCreator.updateHiredMerchantBox(merchant));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
chr.setHiredMerchant(null);
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
c.announce(PacketCreator.enableActions());
|
||||
} else if (mode == Action.BAN_PLAYER.getCode()) {
|
||||
slea.skip(1);
|
||||
|
||||
@@ -772,7 +764,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
if(visitor != null) {
|
||||
visitor.closeMiniGame(false);
|
||||
visitor.announce(MaplePacketCreator.getMiniGameClose(true, 5));
|
||||
visitor.announce(PacketCreator.getMiniGameClose(true, 5));
|
||||
}
|
||||
}
|
||||
} else if (mode == Action.EXIT_AFTER_GAME.getCode()) {
|
||||
@@ -794,7 +786,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
private static boolean isTradeOpen(MapleCharacter chr) {
|
||||
if (chr.getTrade() != null) { // thanks to Rien dev team
|
||||
//Apparently there is a dupe exploit that causes racing conditions when saving/retrieving from the db with stuff like trade open.
|
||||
chr.announce(MaplePacketCreator.enableActions());
|
||||
chr.announce(PacketCreator.enableActions());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -812,11 +804,11 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
|
||||
MaplePlayerShop shop = mc.getPlayerShop();
|
||||
if (shop != null && shop.isOwner(mc)) {
|
||||
chr.announce(MaplePacketCreator.getMiniRoomError(13));
|
||||
chr.announce(PacketCreator.getMiniRoomError(13));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
chr.announce(MaplePacketCreator.getMiniRoomError(13));
|
||||
chr.announce(PacketCreator.getMiniRoomError(13));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -824,7 +816,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
Point cpos = chr.getPosition();
|
||||
MaplePortal portal = chr.getMap().findClosestTeleportPortal(cpos);
|
||||
if (portal != null && portal.getPosition().distance(cpos) < 120.0) {
|
||||
chr.announce(MaplePacketCreator.getMiniRoomError(10));
|
||||
chr.announce(PacketCreator.getMiniRoomError(10));
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user