Added Puppets on Aggro + Guild/Alliance packet info patch + Pet flags
Added pet flags recognition, such as the "pet speed same as owner" mechanic. Fixed repeatable quest "Remnants of HT..." not rewarding Dragon Stones. Refactored character object's check slots method, now using the same algorithm from the API class. Fixed a vunerability from before reviving/respawning players to towns, on where players would get their HP restored in area map before sending them back to safety. Fixed some NPC gates in Mushking Empire, allowing players to access bosses free of quest requirements. Improved dialog of NPCs for "permission to attempt Zakum expeds". Implemented (or rather improved) item scripts, now using NPC conversation methods as it was intended originally. Rehauled mob-skill "summon mobs" limit, now using the placeholders found in the wz to determine limit of concurrent underlings spawned, and "limit" now refers to total of underlings spawned from a mob. Revised IoSession closing mechanics in several login classes. Implemented automated loggedin account shutdown if another player has gained a pass from the DB to login. Improved the server-side check for teleport rocks. Fixed removeAfter from mobs being procced after they were disposed. Reviewed EIM start references on several scripts, minding the latest EIM setup implementations. Fixed equipments that were reused Scissors of Karma not not being able to sell on pshops/merchants. Fixed a bug where entering alliances would lead a player to see information from other guilds of past alliances until an update takes place. Padronized a few skillbook names. Reviewed player puppets not gaining priority properly on the recent aggro system. Improved "item sold" message of merchants, now displaying also quantity left of an item on store. Fixed a bug with itemid limits of weapons on server.
This commit is contained in:
@@ -25,6 +25,7 @@ import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.autoban.AutobanFactory;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||
import client.inventory.manipulator.MapleKarmaManipulator;
|
||||
@@ -465,22 +466,41 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
} else if (mode == Action.SET_ITEMS.getCode()) {
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
MapleInventoryType ivType = MapleInventoryType.getByType(slea.readByte());
|
||||
Item item = chr.getInventory(ivType).getItem(slea.readShort());
|
||||
short pos = slea.readShort();
|
||||
Item item = chr.getInventory(ivType).getItem(pos);
|
||||
short quantity = slea.readShort();
|
||||
byte targetSlot = slea.readByte();
|
||||
|
||||
if (targetSlot < 1 || targetSlot > 9) {
|
||||
System.out.println("[h4x] " + chr.getName() + " Trying to dupe on trade slot.");
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
if (item == null) {
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "Invalid item description."));
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(ServerConstants.USE_ENFORCE_UNMERCHABLE_CASH && ii.isCash(item.getItemId())) {
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "Cash items are not allowed to be traded."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (ServerConstants.USE_ENFORCE_UNMERCHABLE_PET && ItemConstants.isPet(item.getItemId())) {
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "Pets are not allowed to be traded."));
|
||||
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());
|
||||
return;
|
||||
}
|
||||
if (chr.getTrade() != null) {
|
||||
|
||||
MapleTrade trade = chr.getTrade();
|
||||
if (trade != null) {
|
||||
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)) {
|
||||
@@ -489,16 +509,38 @@ public final class PlayerInteractionHandler extends AbstractMaplePacketHandler {
|
||||
return;
|
||||
}
|
||||
}
|
||||
Item tradeItem = item.copy();
|
||||
if (ItemConstants.isRechargeable(item.getItemId())) {
|
||||
tradeItem.setQuantity(item.getQuantity());
|
||||
MapleInventoryManipulator.removeFromSlot(c, ivType, item.getPosition(), item.getQuantity(), true);
|
||||
} else {
|
||||
|
||||
MapleInventory inv = chr.getInventory(ivType);
|
||||
inv.lockInventory();
|
||||
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());
|
||||
return;
|
||||
}
|
||||
|
||||
Item tradeItem = item.copy();
|
||||
if (ItemConstants.isRechargeable(item.getItemId())) {
|
||||
quantity = item.getQuantity();
|
||||
}
|
||||
|
||||
tradeItem.setQuantity(quantity);
|
||||
MapleInventoryManipulator.removeFromSlot(c, ivType, item.getPosition(), quantity, true);
|
||||
tradeItem.setPosition(targetSlot);
|
||||
|
||||
if (trade.addItem(tradeItem)) {
|
||||
MapleInventoryManipulator.removeFromSlot(c, ivType, item.getPosition(), quantity, true);
|
||||
|
||||
trade.getChr().announce(MaplePacketCreator.getTradeItemAdd((byte) 0, tradeItem));
|
||||
if (trade.getPartner() != null) {
|
||||
trade.getPartner().getChr().announce(MaplePacketCreator.getTradeItemAdd((byte) 1, tradeItem));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FilePrinter.printError(FilePrinter.TRADE_EXCEPTION, e, "Player '" + chr + "' tried to add " + ii.getName(item.getItemId()) + " qty. " + item.getQuantity() + " in trade (slot " + targetSlot + ") then exception occurred.");
|
||||
} finally {
|
||||
inv.unlockInventory();
|
||||
}
|
||||
tradeItem.setPosition(targetSlot);
|
||||
chr.getTrade().addItem(tradeItem);
|
||||
}
|
||||
}
|
||||
} else if (mode == Action.CONFIRM.getCode()) {
|
||||
|
||||
Reference in New Issue
Block a user