Mob aggro overhaul + STR-DEX autoassign patch + Guild & Pl. Store fix
Reviewed Monster Magnet skill effect on mobs, now properly showing up to other players. Reworked concurrency protection on login handler, now properly synchronizing requests for the same accountId. Reviewed an expedition issue with attempting to send packets on loggedoff players. Expeditions no longer holds a character object list of its own, rather finding players through their id on the world storage. Added stat requirement definition as first message on 1st job NPCs. Fixed an issue with area triggered NPC conversations not getting properly disposed. Reviewed "launch.bat", internally referencing Java7 engine. Assuming it has been installed in the default directory on the system, it's no longer necessary to set precedence on PATH for it. Fixed need for "reapproval from the 3rd job instructors" to attempt Zakum once more. Reviewed goto command. Non-GM's no longer has access to area maps, only towns. Implemented a new server flag for enforcing base rates (server rate: 1x) on players level 10 or lower. Fixed player guild tooltips not being properly marshalled to others on the map, at the event of several guild actions. Reviewed event system allowing creation of same-name events, potentially leading to null EIM problems. Refactored some locks on MapleCharacter, potentially solving a deadlock case within expiring/forfeiting quest methods. Implemented a major overhaul on mob aggro system, now updating player aggro in real-time based on their latest DPS. Properly refactored and encapsulated aggro mechanics. Fixed NPE on disposing events with alive mobs. Added server-side birthday check handling when opening player shops or merchants having cash items in store. Fixed player shop tooltip not finishing properly when shop owner closes store with visitors still in there. Fixed forceChangeMap method not warping players to the designated event map (rather sending them to the starting event map). Reviewed "summon" command, now using forceChangeMap, also changing channels if needed. Reworked HeavenMS autoassigner: STR-based classes now ups a bit more DEX than before, since its a vital attribute for accuracy on their actions. Added meso ceil check on player transactions. Trades now gets suspended if the max amount is reached. Implemented server-side item limit check on player shops and merchants. Fixed an exploit with merchants, on where players would be able to save the selling item on DB before taking from inventory.
This commit is contained in:
@@ -35,6 +35,7 @@ import net.AbstractMaplePacketHandler;
|
||||
import server.MapleItemInformationProvider;
|
||||
import server.MapleTrade;
|
||||
import constants.GameConstants;
|
||||
import java.sql.SQLException;
|
||||
import server.maps.FieldLimit;
|
||||
import server.maps.MapleHiredMerchant;
|
||||
import server.maps.MapleMapObject;
|
||||
@@ -61,8 +62,8 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
CHAT(6),
|
||||
CHAT_THING(8),
|
||||
EXIT(0xA),
|
||||
OPEN(0xB),
|
||||
TRADE_BIRTHDAY(0x0E),
|
||||
OPEN_STORE(0xB),
|
||||
OPEN_CASH(0xE),
|
||||
SET_ITEMS(0xF),
|
||||
SET_MESO(0x10),
|
||||
CONFIRM(0x11),
|
||||
@@ -74,7 +75,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
REMOVE_ITEM(0x1B),
|
||||
BAN_PLAYER(0x1C),
|
||||
MERCHANT_THING(0x1D),
|
||||
OPEN_STORE(0x1E),
|
||||
OPEN_THING(0x1E),
|
||||
PUT_ITEM(0x21),
|
||||
MERCHANT_BUY(0x22),
|
||||
TAKE_ITEM_BACK(0x26),
|
||||
@@ -136,7 +137,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
try {
|
||||
byte mode = slea.readByte();
|
||||
final MapleCharacter chr = c.getPlayer();
|
||||
|
||||
|
||||
if (mode == Action.CREATE.getCode()) {
|
||||
if(!chr.isAlive()) { // thanks GabrielSin for pointing this
|
||||
chr.getClient().announce(MaplePacketCreator.getMiniRoomError(4));
|
||||
@@ -333,14 +334,25 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
chr.closeMiniGame();
|
||||
chr.closeHiredMerchant(true);
|
||||
}
|
||||
} else if (mode == Action.OPEN.getCode()) {
|
||||
} else if (mode == Action.OPEN_STORE.getCode() || mode == Action.OPEN_CASH.getCode()) {
|
||||
if (isTradeOpen(chr)) return;
|
||||
|
||||
if (mode == Action.OPEN_STORE.getCode()) {
|
||||
slea.readByte(); //01
|
||||
} else {
|
||||
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."));
|
||||
return;
|
||||
}
|
||||
|
||||
c.announce(MaplePacketCreator.hiredMerchantOwnerMaintenanceLeave());
|
||||
}
|
||||
|
||||
MaplePlayerShop shop = chr.getPlayerShop();
|
||||
MapleHiredMerchant merchant = chr.getHiredMerchant();
|
||||
if (shop != null && shop.isOwner(chr)) {
|
||||
slea.readByte();//01
|
||||
|
||||
if(ServerConstants.USE_ERASE_PERMIT_ON_OPENSHOP) {
|
||||
try {
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.CASH, shop.getItemId(), 1, true, false);
|
||||
@@ -355,7 +367,6 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
chr.getMap().addMapObject(merchant);
|
||||
chr.setHiredMerchant(null);
|
||||
chr.getMap().broadcastMessage(MaplePacketCreator.spawnHiredMerchantBox(merchant));
|
||||
slea.readByte();
|
||||
}
|
||||
} else if (mode == Action.READY.getCode()) {
|
||||
MapleMiniGame game = chr.getMiniGame();
|
||||
@@ -528,7 +539,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "Cash items are not allowed to be sold on the Player Store."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (ServerConstants.USE_ENFORCE_UNMERCHABLE_PET && ItemConstants.isPet(ivItem.getItemId())) {
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "Pets are not allowed to be sold on the Player Store."));
|
||||
return;
|
||||
@@ -543,26 +554,44 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
MaplePlayerShop shop = chr.getPlayerShop();
|
||||
MapleHiredMerchant merchant = chr.getHiredMerchant();
|
||||
if (shop != null && shop.isOwner(chr)) {
|
||||
if (shop.isOpen()) {
|
||||
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."));
|
||||
return;
|
||||
}
|
||||
|
||||
shop.addItem(shopItem);
|
||||
|
||||
if (ItemConstants.isRechargeable(ivItem.getItemId())) {
|
||||
MapleInventoryManipulator.removeFromSlot(c, ivType, slot, ivItem.getQuantity(), true);
|
||||
} else {
|
||||
MapleInventoryManipulator.removeFromSlot(c, ivType, slot, (short) (bundles * perBundle), true);
|
||||
}
|
||||
|
||||
c.announce(MaplePacketCreator.getPlayerShopItemUpdate(shop));
|
||||
} else if (merchant != null && merchant.isOwner(chr)) {
|
||||
if (merchant.isOpen()) {
|
||||
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."));
|
||||
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."));
|
||||
return;
|
||||
}
|
||||
|
||||
merchant.addItem(shopItem);
|
||||
|
||||
if (ItemConstants.isRechargeable(ivItem.getItemId())) {
|
||||
MapleInventoryManipulator.removeFromSlot(c, ivType, slot, ivItem.getQuantity(), true);
|
||||
} else {
|
||||
MapleInventoryManipulator.removeFromSlot(c, ivType, slot, (short) (bundles * perBundle), true);
|
||||
}
|
||||
|
||||
c.announce(MaplePacketCreator.updateHiredMerchant(merchant, chr));
|
||||
}
|
||||
if (ItemConstants.isRechargeable(ivItem.getItemId())) {
|
||||
MapleInventoryManipulator.removeFromSlot(c, ivType, slot, ivItem.getQuantity(), true);
|
||||
|
||||
try {
|
||||
merchant.saveItems(false); // thanks Masterrulax for realizing yet another dupe with merchants/Fredrick
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
MapleInventoryManipulator.removeFromSlot(c, ivType, slot, (short) (bundles * perBundle), true);
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "You can't sell without owning a shop."));
|
||||
}
|
||||
} else if (mode == Action.REMOVE_ITEM.getCode()) {
|
||||
if (isTradeOpen(chr)) return;
|
||||
@@ -616,8 +645,9 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
MaplePlayerShop shop = chr.getPlayerShop();
|
||||
MapleHiredMerchant merchant = chr.getHiredMerchant();
|
||||
if (shop != null && shop.isVisitor(chr)) {
|
||||
shop.buy(c, itemid, quantity);
|
||||
shop.broadcast(MaplePacketCreator.getPlayerShopItemUpdate(shop));
|
||||
if (shop.buy(c, itemid, quantity)) {
|
||||
shop.broadcast(MaplePacketCreator.getPlayerShopItemUpdate(shop));
|
||||
}
|
||||
} else if (merchant != null && !merchant.isOwner(chr)) {
|
||||
merchant.buy(c, itemid, quantity);
|
||||
merchant.broadcastToVisitorsThreadsafe(MaplePacketCreator.updateHiredMerchant(merchant, chr));
|
||||
@@ -661,6 +691,7 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
if (merchant.isOwner(chr)) {
|
||||
merchant.clearMessages();
|
||||
merchant.setOpen(true);
|
||||
merchant.getMap().broadcastMessage(MaplePacketCreator.updateHiredMerchantBox(merchant));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user