Active Coupon Buff

Added buff icons for active coupons the player has. Fixed a minor issue,
introduced on the last commit, that prevented coupons to become active
automatically.
This commit is contained in:
ronancpl
2017-05-30 23:28:31 -03:00
parent e1c95352c8
commit f30acb3b8a
40 changed files with 538 additions and 337 deletions

View File

@@ -275,29 +275,29 @@ public class MapleInventoryManipulator {
}
public static void removeById(MapleClient c, MapleInventoryType type, int itemId, int quantity, boolean fromDrop, boolean consume) {
int removeQuantity = quantity;
MapleInventory inv = c.getPlayer().getInventory(type);
int removeQuantity = quantity;
MapleInventory inv = c.getPlayer().getInventory(type);
int slotLimit = type == MapleInventoryType.EQUIPPED ? 128 : inv.getSlotLimit();
for (short i = 0; i <= slotLimit; i++) {
Item item = inv.getItem((short) (type == MapleInventoryType.EQUIPPED ? -i : i));
if (item != null) {
if (item.getItemId() == itemId || item.getCashId() == itemId) {
if (removeQuantity <= item.getQuantity()) {
removeFromSlot(c, type, item.getPosition(), (short) removeQuantity, fromDrop, consume);
removeQuantity = 0;
break;
} else {
removeQuantity -= item.getQuantity();
removeFromSlot(c, type, item.getPosition(), item.getQuantity(), fromDrop, consume);
}
}
}
for (short i = 0; i <= slotLimit; i++) {
Item item = inv.getItem((short) (type == MapleInventoryType.EQUIPPED ? -i : i));
if (item != null) {
if (item.getItemId() == itemId || item.getCashId() == itemId) {
if (removeQuantity <= item.getQuantity()) {
removeFromSlot(c, type, item.getPosition(), (short) removeQuantity, fromDrop, consume);
removeQuantity = 0;
break;
} else {
removeQuantity -= item.getQuantity();
removeFromSlot(c, type, item.getPosition(), item.getQuantity(), fromDrop, consume);
}
}
}
}
if (removeQuantity > 0) {
throw new RuntimeException("[HACK] Not enough items available of Item:" + itemId + ", Quantity (After Quantity/Over Current Quantity): " + (quantity - removeQuantity) + "/" + quantity);
}
}
if (removeQuantity > 0) {
throw new RuntimeException("[HACK] Not enough items available of Item:" + itemId + ", Quantity (After Quantity/Over Current Quantity): " + (quantity - removeQuantity) + "/" + quantity);
}
}
public static void move(MapleClient c, MapleInventoryType type, short src, short dst) {
if (src < 0 || dst < 0) {