Player/NPC Shop patch + Fredrick/Duey patch + Loot w. time GMS-like
Reading approximated unitPrice value from WZ in such a fashion that the new double value can be represented in float point without losing too much data. Fixed rechargeables with quantity 0 set on the playershop/hiredmerchant being handed back to the owner with quantity 1. Solved many concurrecy issues related with items on the field and playershop/hiredmerchant. Fixed anomalies with waiting time before picking up other players items, now acting GMS-like. Added/patched copyleft claims in files that are from my own authorship. Please see backtrack_licenses/readme.txt for more info about this move. Fixed issues with item retrieval when using bundles on playershop/hiredmerchant. Fixed some exploits with playershop/hiredmerchant. Fixed a glitch with npcshop when trying to recharge/buy items without having enough mesos. Added portal sound effect for some scripted portals that still lacked it. Fixed some exploits with NPCs Fredrick and Duey. Fixed Body Pressure not displaying damage to other players. Added a flag that permits town scrolls to act like a "banish" for players. This renders the antibanish scroll effect available.
This commit is contained in:
@@ -70,7 +70,7 @@ public class MapleInventoryManipulator {
|
||||
if (!type.equals(MapleInventoryType.EQUIP)) {
|
||||
short slotMax = ii.getSlotMax(c, itemId);
|
||||
List<Item> existing = c.getPlayer().getInventory(type).listById(itemId);
|
||||
if (!ItemConstants.isRechargable(itemId) && petid == -1) {
|
||||
if (!ItemConstants.isRechargeable(itemId) && petid == -1) {
|
||||
if (existing.size() > 0) { // first update all existing slots to slotMax
|
||||
Iterator<Item> i = existing.iterator();
|
||||
while (quantity > 0) {
|
||||
@@ -89,7 +89,7 @@ public class MapleInventoryManipulator {
|
||||
}
|
||||
}
|
||||
}
|
||||
while (quantity > 0 || ItemConstants.isRechargable(itemId)) {
|
||||
while (quantity > 0 || ItemConstants.isRechargeable(itemId)) {
|
||||
short newQ = (short) Math.min(quantity, slotMax);
|
||||
if (newQ != 0) {
|
||||
quantity -= newQ;
|
||||
@@ -106,7 +106,7 @@ public class MapleInventoryManipulator {
|
||||
nItem.setOwner(owner);
|
||||
}
|
||||
c.announce(MaplePacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, nItem))));
|
||||
if ((ItemConstants.isRechargable(itemId)) && quantity == 0) {
|
||||
if ((ItemConstants.isRechargeable(itemId)) && quantity == 0) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -166,7 +166,7 @@ public class MapleInventoryManipulator {
|
||||
if (!type.equals(MapleInventoryType.EQUIP)) {
|
||||
short slotMax = ii.getSlotMax(c, item.getItemId());
|
||||
List<Item> existing = c.getPlayer().getInventory(type).listById(item.getItemId());
|
||||
if (!ItemConstants.isRechargable(item.getItemId()) && petId == -1) {
|
||||
if (!ItemConstants.isRechargeable(item.getItemId()) && petId == -1) {
|
||||
if (existing.size() > 0) { // first update all existing slots to slotMax
|
||||
Iterator<Item> i = existing.iterator();
|
||||
while (quantity > 0) {
|
||||
@@ -248,7 +248,7 @@ public class MapleInventoryManipulator {
|
||||
if (!type.equals(MapleInventoryType.EQUIP)) {
|
||||
short slotMax = ii.getSlotMax(c, itemid);
|
||||
List<Item> existing = c.getPlayer().getInventory(type).listById(itemid);
|
||||
if (!ItemConstants.isRechargable(itemid)) {
|
||||
if (!ItemConstants.isRechargeable(itemid)) {
|
||||
if (existing.size() > 0) // first update all existing slots to slotMax
|
||||
{
|
||||
for (Item eItem : existing) {
|
||||
@@ -266,7 +266,7 @@ public class MapleInventoryManipulator {
|
||||
final int numSlotsNeeded;
|
||||
if (slotMax > 0) {
|
||||
numSlotsNeeded = (int) (Math.ceil(((double) quantity) / slotMax));
|
||||
} else if (ItemConstants.isRechargable(itemid)) {
|
||||
} else if (ItemConstants.isRechargeable(itemid)) {
|
||||
numSlotsNeeded = 1;
|
||||
} else {
|
||||
numSlotsNeeded = 1;
|
||||
@@ -293,7 +293,7 @@ public class MapleInventoryManipulator {
|
||||
|
||||
if (!type.equals(MapleInventoryType.EQUIP)) {
|
||||
short slotMax = ii.getSlotMax(c, itemid);
|
||||
if (!ItemConstants.isRechargable(itemid)) {
|
||||
if (!ItemConstants.isRechargeable(itemid)) {
|
||||
List<Item> existing = c.getPlayer().getInventory(type).listById(itemid);
|
||||
|
||||
if (existing.size() > 0) // first update all existing slots to slotMax
|
||||
@@ -313,7 +313,7 @@ public class MapleInventoryManipulator {
|
||||
final int numSlotsNeeded;
|
||||
if (slotMax > 0) {
|
||||
numSlotsNeeded = (int) (Math.ceil(((double) quantity) / slotMax));
|
||||
} else if (ItemConstants.isRechargable(itemid)) {
|
||||
} else if (ItemConstants.isRechargeable(itemid)) {
|
||||
numSlotsNeeded = 1;
|
||||
} else {
|
||||
numSlotsNeeded = 1;
|
||||
@@ -337,7 +337,7 @@ public class MapleInventoryManipulator {
|
||||
|
||||
public static void removeFromSlot(MapleClient c, MapleInventoryType type, short slot, short quantity, boolean fromDrop, boolean consume) {
|
||||
Item item = c.getPlayer().getInventory(type).getItem(slot);
|
||||
boolean allowZero = consume && ItemConstants.isRechargable(item.getItemId());
|
||||
boolean allowZero = consume && ItemConstants.isRechargeable(item.getItemId());
|
||||
c.getPlayer().getInventory(type).removeItem(slot, quantity, allowZero);
|
||||
if (item.getQuantity() == 0 && !allowZero) {
|
||||
c.announce(MaplePacketCreator.modifyInventory(fromDrop, Collections.singletonList(new ModifyInventory(3, item))));
|
||||
@@ -396,7 +396,7 @@ public class MapleInventoryManipulator {
|
||||
short slotMax = ii.getSlotMax(c, source.getItemId());
|
||||
c.getPlayer().getInventory(type).move(src, dst, slotMax);
|
||||
final List<ModifyInventory> mods = new ArrayList<>();
|
||||
if (!(type.equals(MapleInventoryType.EQUIP) || type.equals(MapleInventoryType.CASH)) && initialTarget != null && initialTarget.getItemId() == source.getItemId() && !ItemConstants.isRechargable(source.getItemId()) && isSameOwner(source, initialTarget)) {
|
||||
if (!(type.equals(MapleInventoryType.EQUIP) || type.equals(MapleInventoryType.CASH)) && initialTarget != null && initialTarget.getItemId() == source.getItemId() && !ItemConstants.isRechargeable(source.getItemId()) && isSameOwner(source, initialTarget)) {
|
||||
if ((olddstQ + oldsrcQ) > slotMax) {
|
||||
mods.add(new ModifyInventory(1, source));
|
||||
mods.add(new ModifyInventory(1, initialTarget));
|
||||
@@ -562,11 +562,11 @@ public class MapleInventoryManipulator {
|
||||
c.getPlayer().setChalkboard(null);
|
||||
}
|
||||
}
|
||||
if ((!ItemConstants.isRechargable(itemId) && source.getQuantity() < quantity) || quantity < 0) {
|
||||
if ((!ItemConstants.isRechargeable(itemId) && source.getQuantity() < quantity) || quantity < 0) {
|
||||
return;
|
||||
}
|
||||
Point dropPos = new Point(c.getPlayer().getPosition());
|
||||
if (quantity < source.getQuantity() && !ItemConstants.isRechargable(itemId)) {
|
||||
if (quantity < source.getQuantity() && !ItemConstants.isRechargeable(itemId)) {
|
||||
Item target = source.copy();
|
||||
target.setQuantity(quantity);
|
||||
source.setQuantity((short) (source.getQuantity() - quantity));
|
||||
|
||||
@@ -421,6 +421,41 @@ public class MapleItemInformationProvider {
|
||||
return pEntry;
|
||||
}
|
||||
|
||||
private static double getRoundedUnitPrice(double unitPrice, int max) {
|
||||
double intPart = Math.floor(unitPrice);
|
||||
double fractPart = unitPrice - intPart;
|
||||
if(fractPart == 0.0) return intPart;
|
||||
|
||||
double fractMask = 0.0;
|
||||
double lastFract, curFract = 1.0;
|
||||
int i = 1;
|
||||
|
||||
do {
|
||||
lastFract = curFract;
|
||||
curFract /= 2;
|
||||
|
||||
if(fractPart == curFract) {
|
||||
break;
|
||||
} else if(fractPart > curFract) {
|
||||
fractMask += curFract;
|
||||
fractPart -= curFract;
|
||||
}
|
||||
|
||||
i++;
|
||||
} while(i <= max);
|
||||
|
||||
if(i > max) {
|
||||
lastFract = curFract;
|
||||
curFract = 0.0;
|
||||
}
|
||||
|
||||
if(Math.abs(fractPart - curFract) < Math.abs(fractPart - lastFract)) {
|
||||
return intPart + fractMask + curFract;
|
||||
} else {
|
||||
return intPart + fractMask + lastFract;
|
||||
}
|
||||
}
|
||||
|
||||
private Pair<Integer, Double> getItemPriceData(int itemId) {
|
||||
MapleData item = getItemData(itemId);
|
||||
if (item == null) {
|
||||
@@ -439,7 +474,7 @@ public class MapleItemInformationProvider {
|
||||
pData = item.getChildByPath("info/unitPrice");
|
||||
if (pData != null) {
|
||||
try {
|
||||
fEntry = MapleDataTool.getDouble(pData);
|
||||
fEntry = getRoundedUnitPrice(MapleDataTool.getDouble(pData), 5);
|
||||
} catch (Exception e) {
|
||||
fEntry = (double) MapleDataTool.getInt(pData);
|
||||
}
|
||||
@@ -472,7 +507,7 @@ public class MapleItemInformationProvider {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(!ItemConstants.isRechargable(itemId)) {
|
||||
if(!ItemConstants.isRechargeable(itemId)) {
|
||||
retPrice *= quantity;
|
||||
} else {
|
||||
retPrice += Math.ceil(quantity * getUnitPrice(itemId));
|
||||
@@ -481,38 +516,6 @@ public class MapleItemInformationProvider {
|
||||
return retPrice;
|
||||
}
|
||||
|
||||
public static boolean canSell(Item item, short quantity) {
|
||||
if (item == null) { //Basic check
|
||||
return false;
|
||||
}
|
||||
|
||||
short iQuant = item.getQuantity();
|
||||
if (iQuant == 0xFFFF) {
|
||||
iQuant = 1;
|
||||
} else if(iQuant < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ItemConstants.isRechargable(item.getItemId())) {
|
||||
if (iQuant == 0 || quantity > iQuant) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static short getSellingQuantity(Item item, short quantity) {
|
||||
if (ItemConstants.isRechargable(item.getItemId())) {
|
||||
quantity = item.getQuantity();
|
||||
if (quantity == 0xFFFF) {
|
||||
quantity = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return quantity;
|
||||
}
|
||||
|
||||
protected String getEquipmentSlot(int itemId) {
|
||||
if (equipmentSlotCache.containsKey(itemId)) {
|
||||
return equipmentSlotCache.get(itemId);
|
||||
|
||||
@@ -91,7 +91,7 @@ public class MapleShop {
|
||||
if (item.getPrice() > 0) {
|
||||
if (c.getPlayer().getMeso() >= (long) item.getPrice() * quantity) {
|
||||
if (MapleInventoryManipulator.checkSpace(c, itemId, quantity, "")) {
|
||||
if (!ItemConstants.isRechargable(itemId)) { //Pets can't be bought from shops
|
||||
if (!ItemConstants.isRechargeable(itemId)) { //Pets can't be bought from shops
|
||||
MapleInventoryManipulator.addById(c, itemId, quantity);
|
||||
c.getPlayer().gainMeso(-(item.getPrice() * quantity), false);
|
||||
} else {
|
||||
@@ -110,7 +110,7 @@ public class MapleShop {
|
||||
} else if (item.getPitch() > 0) {
|
||||
if (c.getPlayer().getInventory(MapleInventoryType.ETC).countById(4310000) >= (long) item.getPitch() * quantity) {
|
||||
if (MapleInventoryManipulator.checkSpace(c, itemId, quantity, "")) {
|
||||
if (!ItemConstants.isRechargable(itemId)) {
|
||||
if (!ItemConstants.isRechargeable(itemId)) {
|
||||
MapleInventoryManipulator.addById(c, itemId, quantity);
|
||||
MapleInventoryManipulator.removeById(c, MapleInventoryType.ETC, 4310000, item.getPitch() * quantity, false, false);
|
||||
} else {
|
||||
@@ -149,6 +149,37 @@ public class MapleShop {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean canSell(Item item, short quantity) {
|
||||
if (item == null) { //Basic check
|
||||
return false;
|
||||
}
|
||||
|
||||
short iQuant = item.getQuantity();
|
||||
if (iQuant == 0xFFFF) {
|
||||
iQuant = 1;
|
||||
} else if(iQuant < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ItemConstants.isRechargeable(item.getItemId())) {
|
||||
if (iQuant == 0 || quantity > iQuant) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static short getSellingQuantity(Item item, short quantity) {
|
||||
if (ItemConstants.isRechargeable(item.getItemId())) {
|
||||
quantity = item.getQuantity();
|
||||
if (quantity == 0xFFFF) {
|
||||
quantity = 1;
|
||||
}
|
||||
}
|
||||
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void sell(MapleClient c, MapleInventoryType type, short slot, short quantity) {
|
||||
if (quantity == 0xFFFF || quantity == 0) {
|
||||
@@ -158,8 +189,8 @@ public class MapleShop {
|
||||
}
|
||||
|
||||
Item item = c.getPlayer().getInventory(type).getItem((short) slot);
|
||||
if(MapleItemInformationProvider.canSell(item, quantity)) {
|
||||
quantity = MapleItemInformationProvider.getSellingQuantity(item, quantity);
|
||||
if(canSell(item, quantity)) {
|
||||
quantity = getSellingQuantity(item, quantity);
|
||||
MapleInventoryManipulator.removeFromSlot(c, type, (byte) slot, quantity, false);
|
||||
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
@@ -168,13 +199,15 @@ public class MapleShop {
|
||||
c.getPlayer().gainMeso(recvMesos, false);
|
||||
}
|
||||
c.announce(MaplePacketCreator.shopTransaction((byte) 0x8));
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.shopTransaction((byte) 0x5));
|
||||
}
|
||||
}
|
||||
|
||||
public void recharge(MapleClient c, short slot) {
|
||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||
Item item = c.getPlayer().getInventory(MapleInventoryType.USE).getItem(slot);
|
||||
if (item == null || !ItemConstants.isRechargable(item.getItemId())) {
|
||||
if (item == null || !ItemConstants.isRechargeable(item.getItemId())) {
|
||||
return;
|
||||
}
|
||||
short slotMax = ii.getSlotMax(c, item.getItemId());
|
||||
@@ -189,8 +222,7 @@ public class MapleShop {
|
||||
c.getPlayer().gainMeso(-price, false, true, false);
|
||||
c.announce(MaplePacketCreator.shopTransaction((byte) 0x8));
|
||||
} else {
|
||||
c.announce(MaplePacketCreator.serverNotice(1, "You do not have enough mesos."));
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
c.announce(MaplePacketCreator.shopTransaction((byte) 0x2));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -228,7 +260,7 @@ public class MapleShop {
|
||||
rs = ps.executeQuery();
|
||||
List<Integer> recharges = new ArrayList<>(rechargeableItems);
|
||||
while (rs.next()) {
|
||||
if (ItemConstants.isRechargable(rs.getInt("itemid"))) {
|
||||
if (ItemConstants.isRechargeable(rs.getInt("itemid"))) {
|
||||
MapleShopItem starItem = new MapleShopItem((short) 1, rs.getInt("itemid"), rs.getInt("price"), rs.getInt("pitch"));
|
||||
ret.addItem(starItem);
|
||||
if (rechargeableItems.contains(starItem.getItemId())) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server
|
||||
Copyleft (L) 2017 RonanLana
|
||||
This file is part of the HeavenMS MapleStory Server
|
||||
Copyleft (L) 2016 - 2018 RonanLana
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
@@ -230,7 +230,7 @@ public class MapleStorageInventory {
|
||||
source.setPosition(dSlot);
|
||||
inventory.put(dSlot, source);
|
||||
inventory.remove(sSlot);
|
||||
} else if (target.getItemId() == source.getItemId() && !ItemConstants.isRechargable(source.getItemId()) && !MapleItemInformationProvider.getInstance().isPickupRestricted(source.getItemId()) && isSameOwner(source, target)) {
|
||||
} else if (target.getItemId() == source.getItemId() && !ItemConstants.isRechargeable(source.getItemId()) && !MapleItemInformationProvider.getInstance().isPickupRestricted(source.getItemId()) && isSameOwner(source, target)) {
|
||||
if (isEquipOrCash(source)) {
|
||||
swap(target, source);
|
||||
} else if (source.getQuantity() + target.getQuantity() > slotMax) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server
|
||||
Copyleft (L) 2017 RonanLana
|
||||
This file is part of the HeavenMS MapleStory Server
|
||||
Copyleft (L) 2016 - 2018 RonanLana
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
||||
@@ -165,6 +165,37 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
|
||||
}
|
||||
}
|
||||
|
||||
public void withdrawMesos(MapleCharacter chr) {
|
||||
if (isOwner(chr)) {
|
||||
synchronized (items) {
|
||||
chr.withdrawMerchantMesos();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void takeItemBack(int slot, MapleCharacter chr) {
|
||||
synchronized (items) {
|
||||
MaplePlayerShopItem shopItem = items.get(slot);
|
||||
if(shopItem.isExist()) {
|
||||
if (shopItem.getBundles() > 0) {
|
||||
Item iitem = shopItem.getItem().copy();
|
||||
iitem.setQuantity((short) (shopItem.getItem().getQuantity() * shopItem.getBundles()));
|
||||
|
||||
if (!MapleInventory.checkSpot(chr, iitem)) {
|
||||
chr.announce(MaplePacketCreator.serverNotice(1, "Have a slot available on your inventory to claim back the item."));
|
||||
chr.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
MapleInventoryManipulator.addFromDrop(chr.getClient(), iitem, true);
|
||||
}
|
||||
|
||||
removeFromSlot(slot);
|
||||
chr.announce(MaplePacketCreator.updateHiredMerchant(this, chr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean canBuy(MapleClient c, Item newItem) {
|
||||
return MapleInventoryManipulator.checkSpace(c, newItem.getItemId(), newItem.getQuantity(), newItem.getOwner()) && MapleInventoryManipulator.addFromDrop(c, newItem, false);
|
||||
}
|
||||
@@ -172,21 +203,19 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
|
||||
public void buy(MapleClient c, int item, short quantity) {
|
||||
synchronized (items) {
|
||||
MaplePlayerShopItem pItem = items.get(item);
|
||||
|
||||
Item newItem = pItem.getItem().copy();
|
||||
|
||||
newItem.setQuantity((short) ((pItem.getItem().getQuantity() * quantity)));
|
||||
if ((newItem.getFlag() & ItemConstants.KARMA) == ItemConstants.KARMA) {
|
||||
newItem.setFlag((byte) (newItem.getFlag() ^ ItemConstants.KARMA));
|
||||
}
|
||||
if (quantity < 1 || pItem.getBundles() < 1 || !pItem.isExist() || pItem.getBundles() < quantity) {
|
||||
if (quantity < 1 || !pItem.isExist() || pItem.getBundles() < quantity) {
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
} else if (newItem.getInventoryType().equals(MapleInventoryType.EQUIP) && newItem.getQuantity() > 1) {
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
} else if (!pItem.isExist()) {
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
if ((newItem.getFlag() & ItemConstants.KARMA) == ItemConstants.KARMA) {
|
||||
newItem.setFlag((byte) (newItem.getFlag() ^ ItemConstants.KARMA));
|
||||
}
|
||||
|
||||
int price = (int) Math.min((long)pItem.getPrice() * quantity, Integer.MAX_VALUE);
|
||||
@@ -196,7 +225,7 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
|
||||
if(ServerConstants.USE_ANNOUNCE_SHOPITEMSOLD) announceItemSold(newItem, price); // idea thanks to vcoc
|
||||
|
||||
synchronized (sold) {
|
||||
sold.add(new SoldItem(c.getPlayer().getName(), pItem.getItem().getItemId(), quantity, price));
|
||||
sold.add(new SoldItem(c.getPlayer().getName(), pItem.getItem().getItemId(), newItem.getQuantity(), price));
|
||||
}
|
||||
|
||||
pItem.setBundles((short) (pItem.getBundles() - quantity));
|
||||
@@ -224,7 +253,7 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
|
||||
c.getPlayer().dropMessage(1, "Your inventory is full. Please clean a slot before buying this item.");
|
||||
}
|
||||
} else {
|
||||
c.getPlayer().dropMessage(1, "You do not have enough mesos.");
|
||||
c.getPlayer().dropMessage(1, "You don't have enough mesos to purchase this item.");
|
||||
}
|
||||
try {
|
||||
this.saveItems(false);
|
||||
@@ -388,10 +417,24 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
|
||||
}
|
||||
}
|
||||
|
||||
public void removeFromSlot(int slot) {
|
||||
synchronized (items) {
|
||||
items.remove(slot);
|
||||
public void clearInexistentItems() {
|
||||
synchronized(items) {
|
||||
for (int i = items.size() - 1; i >= 0; i--) {
|
||||
if (!items.get(i).isExist()) {
|
||||
items.remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
this.saveItems(false);
|
||||
} catch (SQLException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void removeFromSlot(int slot) {
|
||||
items.remove(slot);
|
||||
|
||||
try {
|
||||
this.saveItems(false);
|
||||
|
||||
+166
-33
@@ -650,6 +650,7 @@ public class MapleMap {
|
||||
if (mob.dropsDisabled() || !dropsOn) {
|
||||
return;
|
||||
}
|
||||
|
||||
final byte droptype = (byte) (mob.getStats().isExplosiveReward() ? 3 : mob.getStats().isFfaLoot() ? 2 : chr.getParty() != null ? 1 : 0);
|
||||
final int mobpos = mob.getPosition().x;
|
||||
int chRate = chr.getDropRate();
|
||||
@@ -793,7 +794,7 @@ public class MapleMap {
|
||||
|
||||
objectWLock.lock();
|
||||
try {
|
||||
if(!everlast) registerItemDrop(mdrop);
|
||||
registerItemDrop(mdrop);
|
||||
registeredDrops.add(new WeakReference<>((MapleMapObject) mdrop));
|
||||
} finally {
|
||||
objectWLock.unlock();
|
||||
@@ -803,13 +804,23 @@ public class MapleMap {
|
||||
}
|
||||
|
||||
private void registerItemDrop(MapleMapItem mdrop) {
|
||||
droppedItems.put(mdrop, System.currentTimeMillis() + ServerConstants.ITEM_EXPIRE_TIME);
|
||||
droppedItems.put(mdrop, !everlast ? System.currentTimeMillis() + ServerConstants.ITEM_EXPIRE_TIME : Long.MAX_VALUE);
|
||||
}
|
||||
|
||||
private void unregisterItemDrop(MapleMapItem mdrop) {
|
||||
objectWLock.lock();
|
||||
try {
|
||||
droppedItems.remove(mdrop);
|
||||
} finally {
|
||||
objectWLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
private void makeDisappearExpiredItemDrops() {
|
||||
objectWLock.lock();
|
||||
List<MapleMapItem> toDisappear = new LinkedList<>();
|
||||
|
||||
objectRLock.lock();
|
||||
try {
|
||||
List<MapleMapItem> toDisappear = new LinkedList<>();
|
||||
long timeNow = System.currentTimeMillis();
|
||||
|
||||
for(Entry<MapleMapItem, Long> it : droppedItems.entrySet()) {
|
||||
@@ -817,9 +828,17 @@ public class MapleMap {
|
||||
toDisappear.add(it.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
} finally {
|
||||
objectRLock.unlock();
|
||||
}
|
||||
|
||||
for(MapleMapItem mmi : toDisappear) {
|
||||
makeDisappearItemFromMap(mmi);
|
||||
}
|
||||
|
||||
objectWLock.lock();
|
||||
try {
|
||||
for(MapleMapItem mmi : toDisappear) {
|
||||
makeDisappearItemFromMap(mmi);
|
||||
droppedItems.remove(mmi);
|
||||
}
|
||||
} finally {
|
||||
@@ -827,12 +846,64 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
public void pickItemDrop(byte[] pickupPacket, MapleMapItem mdrop) {
|
||||
private List<MapleMapItem> getDroppedItems() {
|
||||
objectRLock.lock();
|
||||
try {
|
||||
return new LinkedList<>(droppedItems.keySet());
|
||||
} finally {
|
||||
objectRLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void pickItemDrop(byte[] pickupPacket, MapleMapItem mdrop) { // mdrop must be already locked and not-pickedup checked by now
|
||||
broadcastMessage(pickupPacket, mdrop.getPosition());
|
||||
|
||||
droppedItemCount.decrementAndGet();
|
||||
this.removeMapObject(mdrop);
|
||||
mdrop.setPickedUp(true);
|
||||
unregisterItemDrop(mdrop);
|
||||
}
|
||||
|
||||
private static boolean shouldShowQuestItem(MapleCharacter chr, int questid, int itemid) {
|
||||
return questid <= 0 || (chr.getQuestStatus(questid) == 1 && chr.needQuestItem(questid, itemid));
|
||||
}
|
||||
|
||||
public void updatePlayerItemDrops(int partyid, int charid, List<MapleCharacter> partyMembers, MapleCharacter partyLeaver) {
|
||||
for(MapleMapItem mdrop : getDroppedItems()) {
|
||||
if(mdrop.getOwnerId() == charid) {
|
||||
mdrop.lockItem();
|
||||
try {
|
||||
if(mdrop.isPickedUp()) return;
|
||||
|
||||
mdrop.setPartyOwnerId(partyid);
|
||||
|
||||
byte[] removePacket = MaplePacketCreator.silentRemoveItemFromMap(mdrop.getObjectId());
|
||||
byte[] updatePacket = MaplePacketCreator.updateMapItemObject(mdrop, partyLeaver == null);
|
||||
|
||||
for(MapleCharacter mc : partyMembers) {
|
||||
if(this.equals(mc.getMap())) {
|
||||
mc.announce(removePacket);
|
||||
|
||||
if(shouldShowQuestItem(mc, mdrop.getQuest(), mdrop.getItemId())) {
|
||||
mc.announce(updatePacket);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(partyLeaver != null) {
|
||||
if(this.equals(partyLeaver.getMap())) {
|
||||
partyLeaver.announce(removePacket);
|
||||
|
||||
if(shouldShowQuestItem(partyLeaver, mdrop.getQuest(), mdrop.getItemId())) {
|
||||
partyLeaver.announce(MaplePacketCreator.updateMapItemObject(mdrop, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
mdrop.unlockItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void spawnDrop(final Item idrop, final Point dropPos, final MapleMapObject dropper, final MapleCharacter chr, final byte droptype, final short questid) {
|
||||
@@ -841,8 +912,15 @@ public class MapleMap {
|
||||
spawnAndAddRangedMapObject(mdrop, new DelayedPacketCreation() {
|
||||
@Override
|
||||
public void sendPackets(MapleClient c) {
|
||||
if (questid <= 0 || (c.getPlayer().getQuestStatus(questid) == 1 && c.getPlayer().needQuestItem(questid, idrop.getItemId()))) {
|
||||
c.announce(MaplePacketCreator.dropItemFromMapObject(mdrop, dropper.getPosition(), dropPos, (byte) 1));
|
||||
MapleCharacter chr = c.getPlayer();
|
||||
|
||||
if (shouldShowQuestItem(chr, questid, idrop.getItemId())) {
|
||||
mdrop.lockItem();
|
||||
try {
|
||||
c.announce(MaplePacketCreator.dropItemFromMapObject(chr.getParty() != null, mdrop, dropper.getPosition(), dropPos, (byte) 1));
|
||||
} finally {
|
||||
mdrop.unlockItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
}, null);
|
||||
@@ -859,7 +937,12 @@ public class MapleMap {
|
||||
spawnAndAddRangedMapObject(mdrop, new DelayedPacketCreation() {
|
||||
@Override
|
||||
public void sendPackets(MapleClient c) {
|
||||
c.announce(MaplePacketCreator.dropItemFromMapObject(mdrop, dropper.getPosition(), droppos, (byte) 1));
|
||||
mdrop.lockItem();
|
||||
try {
|
||||
c.announce(MaplePacketCreator.dropItemFromMapObject(c.getPlayer().getParty() != null, mdrop, dropper.getPosition(), droppos, (byte) 1));
|
||||
} finally {
|
||||
mdrop.unlockItem();
|
||||
}
|
||||
}
|
||||
}, null);
|
||||
|
||||
@@ -868,8 +951,14 @@ public class MapleMap {
|
||||
|
||||
public final void disappearingItemDrop(final MapleMapObject dropper, final MapleCharacter owner, final Item item, final Point pos) {
|
||||
final Point droppos = calcDropPos(pos, pos);
|
||||
final MapleMapItem drop = new MapleMapItem(item, droppos, dropper, owner, owner.getClient(), (byte) 1, false);
|
||||
broadcastMessage(MaplePacketCreator.dropItemFromMapObject(drop, dropper.getPosition(), droppos, (byte) 3), drop.getPosition());
|
||||
final MapleMapItem mdrop = new MapleMapItem(item, droppos, dropper, owner, owner.getClient(), (byte) 1, false);
|
||||
|
||||
mdrop.lockItem();
|
||||
try {
|
||||
broadcastItemDropMessage(mdrop, dropper.getPosition(), droppos, (byte) 3, mdrop.getPosition());
|
||||
} finally {
|
||||
mdrop.unlockItem();
|
||||
}
|
||||
}
|
||||
|
||||
public MapleMonster getMonsterById(int id) {
|
||||
@@ -1918,11 +2007,22 @@ public class MapleMap {
|
||||
spawnAndAddRangedMapObject(mdrop, new DelayedPacketCreation() {
|
||||
@Override
|
||||
public void sendPackets(MapleClient c) {
|
||||
c.announce(MaplePacketCreator.dropItemFromMapObject(mdrop, dropper.getPosition(), droppos, (byte) 1));
|
||||
mdrop.lockItem();
|
||||
try {
|
||||
c.announce(MaplePacketCreator.dropItemFromMapObject(c.getPlayer().getParty() != null, mdrop, dropper.getPosition(), droppos, (byte) 1));
|
||||
} finally {
|
||||
mdrop.unlockItem();
|
||||
}
|
||||
}
|
||||
}, null);
|
||||
broadcastMessage(MaplePacketCreator.dropItemFromMapObject(mdrop, dropper.getPosition(), droppos, (byte) 0));
|
||||
|
||||
|
||||
mdrop.lockItem();
|
||||
try {
|
||||
broadcastItemDropMessage(mdrop, dropper.getPosition(), droppos, (byte) 0);
|
||||
} finally {
|
||||
mdrop.unlockItem();
|
||||
}
|
||||
|
||||
instantiateItemDrop(mdrop);
|
||||
activateItemReactors(mdrop, owner.getClient());
|
||||
}
|
||||
@@ -1997,8 +2097,13 @@ public class MapleMap {
|
||||
objectRLock.lock();
|
||||
try {
|
||||
for(MapleMapItem mmi : droppedItems.keySet()) {
|
||||
if(!mmi.isPickedUp()) {
|
||||
list.add(mmi);
|
||||
mmi.lockItem();
|
||||
try {
|
||||
if(!mmi.isPickedUp()) {
|
||||
list.add(mmi);
|
||||
}
|
||||
} finally {
|
||||
mmi.unlockItem();
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
@@ -2435,18 +2540,6 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
public void dropMessage(int type, String message) {
|
||||
broadcastStringMessage(type, message);
|
||||
}
|
||||
|
||||
public void broadcastStringMessage(int type, String message) {
|
||||
broadcastMessage(MaplePacketCreator.serverNotice(type, message));
|
||||
}
|
||||
|
||||
public void broadcastBossHpMessage(MapleMonster mm, int bossHash, final byte[] packet) {
|
||||
broadcastBossHpMessage(mm, bossHash, null, packet, Double.POSITIVE_INFINITY, null);
|
||||
}
|
||||
|
||||
public void broadcastMessage(final byte[] packet) {
|
||||
broadcastMessage(null, packet, Double.POSITIVE_INFINITY, null);
|
||||
}
|
||||
@@ -2488,10 +2581,6 @@ public class MapleMap {
|
||||
broadcastMessage(null, packet, getRangedDistance(), rangedFrom);
|
||||
}
|
||||
|
||||
public void broadcastBossHpMessage(MapleMonster mm, int bossHash, final byte[] packet, Point rangedFrom) {
|
||||
broadcastBossHpMessage(mm, bossHash, null, packet, getRangedDistance(), rangedFrom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Always ranged from point. Does not repeat to source.
|
||||
*
|
||||
@@ -2522,6 +2611,14 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
public void broadcastBossHpMessage(MapleMonster mm, int bossHash, final byte[] packet) {
|
||||
broadcastBossHpMessage(mm, bossHash, null, packet, Double.POSITIVE_INFINITY, null);
|
||||
}
|
||||
|
||||
public void broadcastBossHpMessage(MapleMonster mm, int bossHash, final byte[] packet, Point rangedFrom) {
|
||||
broadcastBossHpMessage(mm, bossHash, null, packet, getRangedDistance(), rangedFrom);
|
||||
}
|
||||
|
||||
private void broadcastBossHpMessage(MapleMonster mm, int bossHash, MapleCharacter source, final byte[] packet, double rangeSq, Point rangedFrom) {
|
||||
chrRLock.lock();
|
||||
try {
|
||||
@@ -2541,6 +2638,41 @@ public class MapleMap {
|
||||
}
|
||||
}
|
||||
|
||||
private void broadcastItemDropMessage(MapleMapItem mdrop, Point dropperPos, Point dropPos, byte mod, Point rangedFrom) {
|
||||
broadcastItemDropMessage(mdrop, dropperPos, dropPos, mod, getRangedDistance(), rangedFrom);
|
||||
}
|
||||
|
||||
private void broadcastItemDropMessage(MapleMapItem mdrop, Point dropperPos, Point dropPos, byte mod) {
|
||||
broadcastItemDropMessage(mdrop, dropperPos, dropPos, mod, Double.POSITIVE_INFINITY, null);
|
||||
}
|
||||
|
||||
private void broadcastItemDropMessage(MapleMapItem mdrop, Point dropperPos, Point dropPos, byte mod, double rangeSq, Point rangedFrom) {
|
||||
chrRLock.lock();
|
||||
try {
|
||||
for (MapleCharacter chr : characters) {
|
||||
final byte[] packet = MaplePacketCreator.dropItemFromMapObject(chr.getParty() != null, mdrop, dropperPos, dropPos, mod);
|
||||
|
||||
if (rangeSq < Double.POSITIVE_INFINITY) {
|
||||
if (rangedFrom.distanceSq(chr.getPosition()) <= rangeSq) {
|
||||
chr.announce(packet);
|
||||
}
|
||||
} else {
|
||||
chr.announce(packet);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
chrRLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void dropMessage(int type, String message) {
|
||||
broadcastStringMessage(type, message);
|
||||
}
|
||||
|
||||
public void broadcastStringMessage(int type, String message) {
|
||||
broadcastMessage(MaplePacketCreator.serverNotice(type, message));
|
||||
}
|
||||
|
||||
private boolean isNonRangedType(MapleMapObjectType type) {
|
||||
switch (type) {
|
||||
case NPC:
|
||||
@@ -2982,6 +3114,7 @@ public class MapleMap {
|
||||
return;
|
||||
}
|
||||
mapitem.setPickedUp(true);
|
||||
unregisterItemDrop(mapitem);
|
||||
|
||||
reactor.setShouldCollect(false);
|
||||
MapleMap.this.broadcastMessage(MaplePacketCreator.removeItemFromMap(mapitem.getObjectId(), 0, 0), mapitem.getPosition());
|
||||
|
||||
@@ -97,8 +97,24 @@ public class MapleMapItem extends AbstractMapleMapObject {
|
||||
return character_ownerid;
|
||||
}
|
||||
|
||||
public final int getPartyOwnerId() {
|
||||
return party_ownerid;
|
||||
}
|
||||
|
||||
public final void setPartyOwnerId(int partyid) {
|
||||
party_ownerid = partyid;
|
||||
}
|
||||
|
||||
public final boolean isFFADrop() {
|
||||
return type == 2 || type == 3 || hasExpiredOwnershipTime();
|
||||
}
|
||||
|
||||
public final boolean hasExpiredOwnershipTime() {
|
||||
return System.currentTimeMillis() - dropTime >= 15 * 1000;
|
||||
}
|
||||
|
||||
public final boolean canBePickedBy(MapleCharacter chr) {
|
||||
if (character_ownerid <= 0) return true;
|
||||
if (character_ownerid <= 0 || isFFADrop()) return true;
|
||||
|
||||
if (party_ownerid == -1) {
|
||||
if (chr.getId() == character_ownerid) {
|
||||
@@ -116,7 +132,7 @@ public class MapleMapItem extends AbstractMapleMapObject {
|
||||
}
|
||||
}
|
||||
|
||||
return System.currentTimeMillis() - dropTime >= 15 * 1000;
|
||||
return hasExpiredOwnershipTime();
|
||||
}
|
||||
|
||||
public final MapleClient getOwnerClient() {
|
||||
@@ -166,8 +182,15 @@ public class MapleMapItem extends AbstractMapleMapObject {
|
||||
|
||||
@Override
|
||||
public void sendSpawnData(final MapleClient client) {
|
||||
if (questid <= 0 || (client.getPlayer().getQuestStatus(questid) == 1 && client.getPlayer().needQuestItem(questid, item.getItemId()))) {
|
||||
client.announce(MaplePacketCreator.dropItemFromMapObject(this, null, getPosition(), (byte) 2));
|
||||
MapleCharacter chr = client.getPlayer();
|
||||
|
||||
if (questid <= 0 || (chr.getQuestStatus(questid) == 1 && chr.needQuestItem(questid, item.getItemId()))) {
|
||||
this.lockItem();
|
||||
try {
|
||||
client.announce(MaplePacketCreator.dropItemFromMapObject(chr.getParty() != null, this, null, getPosition(), (byte) 2));
|
||||
} finally {
|
||||
this.unlockItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server
|
||||
Copyleft (L) 2017 RonanLana
|
||||
This file is part of the HeavenMS MapleStory Server
|
||||
Copyleft (L) 2016 - 2018 RonanLana
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
||||
@@ -24,7 +24,9 @@ package server.maps;
|
||||
import client.MapleCharacter;
|
||||
import client.MapleClient;
|
||||
import client.inventory.Item;
|
||||
import client.inventory.MapleInventory;
|
||||
import client.inventory.MapleInventoryType;
|
||||
import constants.ItemConstants;
|
||||
import constants.ServerConstants;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -53,6 +55,7 @@ public class MaplePlayerShop extends AbstractMapleMapObject {
|
||||
private MapleCharacter owner;
|
||||
private MapleCharacter[] visitors = new MapleCharacter[3];
|
||||
private List<MaplePlayerShopItem> items = new ArrayList<>();
|
||||
private List<SoldItem> sold = new LinkedList<>();
|
||||
private String description;
|
||||
private int boughtnumber = 0;
|
||||
private List<String> bannedList = new ArrayList<>();
|
||||
@@ -182,16 +185,37 @@ public class MaplePlayerShop extends AbstractMapleMapObject {
|
||||
}
|
||||
}
|
||||
|
||||
public void removeItem(int item) {
|
||||
synchronized (items) {
|
||||
items.remove(item);
|
||||
}
|
||||
private void removeFromSlot(int slot) {
|
||||
items.remove(slot);
|
||||
}
|
||||
|
||||
private static boolean canBuy(MapleClient c, Item newItem) {
|
||||
return MapleInventoryManipulator.checkSpace(c, newItem.getItemId(), newItem.getQuantity(), newItem.getOwner()) && MapleInventoryManipulator.addFromDrop(c, newItem, false);
|
||||
}
|
||||
|
||||
public void takeItemBack(int slot, MapleCharacter chr) {
|
||||
synchronized (items) {
|
||||
MaplePlayerShopItem shopItem = items.get(slot);
|
||||
if(shopItem.isExist()) {
|
||||
if (shopItem.getBundles() > 0) {
|
||||
Item iitem = shopItem.getItem().copy();
|
||||
iitem.setQuantity((short) (shopItem.getItem().getQuantity() * shopItem.getBundles()));
|
||||
|
||||
if (!MapleInventory.checkSpot(chr, iitem)) {
|
||||
chr.announce(MaplePacketCreator.serverNotice(1, "Have a slot available on your inventory to claim back the item."));
|
||||
chr.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
|
||||
MapleInventoryManipulator.addFromDrop(chr.getClient(), iitem, true);
|
||||
}
|
||||
|
||||
removeFromSlot(slot);
|
||||
chr.announce(MaplePacketCreator.getPlayerShopItemUpdate(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* no warnings for now o.o
|
||||
* @param c
|
||||
@@ -203,13 +227,22 @@ public class MaplePlayerShop extends AbstractMapleMapObject {
|
||||
if (isVisitor(c.getPlayer())) {
|
||||
MaplePlayerShopItem pItem = items.get(item);
|
||||
Item newItem = pItem.getItem().copy();
|
||||
newItem.setQuantity(newItem.getQuantity());
|
||||
if (quantity < 1 || pItem.getBundles() < 1 || newItem.getQuantity() > pItem.getBundles() || !pItem.isExist()) {
|
||||
|
||||
newItem.setQuantity((short) ((pItem.getItem().getQuantity() * quantity)));
|
||||
if (quantity < 1 || !pItem.isExist() || pItem.getBundles() < quantity) {
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
} else if (newItem.getInventoryType().equals(MapleInventoryType.EQUIP) && newItem.getQuantity() > 1) {
|
||||
c.announce(MaplePacketCreator.enableActions());
|
||||
return;
|
||||
}
|
||||
synchronized (c.getPlayer()) {
|
||||
|
||||
if ((newItem.getFlag() & ItemConstants.KARMA) == ItemConstants.KARMA) {
|
||||
newItem.setFlag((byte) (newItem.getFlag() ^ ItemConstants.KARMA));
|
||||
}
|
||||
|
||||
visitorLock.lock();
|
||||
try {
|
||||
int price = (int) Math.min((long)pItem.getPrice() * quantity, Integer.MAX_VALUE);
|
||||
|
||||
if (c.getPlayer().getMeso() >= price) {
|
||||
@@ -219,6 +252,13 @@ public class MaplePlayerShop extends AbstractMapleMapObject {
|
||||
if(ServerConstants.USE_ANNOUNCE_SHOPITEMSOLD) announceItemSold(newItem, price); // idea thanks to vcoc
|
||||
owner.gainMeso(price, true);
|
||||
|
||||
SoldItem soldItem = new SoldItem(c.getPlayer().getName(), pItem.getItem().getItemId(), quantity, price);
|
||||
owner.announce(MaplePacketCreator.getPlayerShopOwnerUpdate(soldItem, item));
|
||||
|
||||
synchronized (sold) {
|
||||
sold.add(soldItem);
|
||||
}
|
||||
|
||||
pItem.setBundles((short) (pItem.getBundles() - quantity));
|
||||
if (pItem.getBundles() < 1) {
|
||||
pItem.setDoesExist(false);
|
||||
@@ -232,7 +272,11 @@ public class MaplePlayerShop extends AbstractMapleMapObject {
|
||||
} else {
|
||||
c.getPlayer().dropMessage(1, "Your inventory is full. Please clean a slot before buying this item.");
|
||||
}
|
||||
} else {
|
||||
c.getPlayer().dropMessage(1, "You don't have enough mesos to purchase this item.");
|
||||
}
|
||||
} finally {
|
||||
visitorLock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -489,6 +533,12 @@ public class MaplePlayerShop extends AbstractMapleMapObject {
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<SoldItem> getSold() {
|
||||
synchronized (sold) {
|
||||
return Collections.unmodifiableList(sold);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendDestroyData(MapleClient client) {
|
||||
@@ -504,4 +554,34 @@ public class MaplePlayerShop extends AbstractMapleMapObject {
|
||||
public MapleMapObjectType getType() {
|
||||
return MapleMapObjectType.SHOP;
|
||||
}
|
||||
|
||||
public class SoldItem {
|
||||
|
||||
int itemid, mesos;
|
||||
short quantity;
|
||||
String buyer;
|
||||
|
||||
public SoldItem(String buyer, int itemid, short quantity, int mesos) {
|
||||
this.buyer = buyer;
|
||||
this.itemid = itemid;
|
||||
this.quantity = quantity;
|
||||
this.mesos = mesos;
|
||||
}
|
||||
|
||||
public String getBuyer() {
|
||||
return buyer;
|
||||
}
|
||||
|
||||
public int getItemId() {
|
||||
return itemid;
|
||||
}
|
||||
|
||||
public short getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public int getMesos() {
|
||||
return mesos;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,8 +78,8 @@ public enum MapleQuestRequirementType {
|
||||
return COMPLETED_QUEST;
|
||||
} else if(name.equals("start")) {
|
||||
return START;
|
||||
} else if(name.equals("end")) {
|
||||
return END;
|
||||
/*} else if(name.equals("end")) { already coded
|
||||
return END;*/
|
||||
} else if(name.equals("daybyday")) {
|
||||
return DAY_BY_DAY;
|
||||
} else if (name.equals("money")) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server
|
||||
Copyleft (L) 2017 RonanLana
|
||||
This file is part of the HeavenMS MapleStory Server
|
||||
Copyleft (L) 2016 - 2018 RonanLana
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server
|
||||
Copyleft (L) 2017 RonanLana
|
||||
This file is part of the HeavenMS MapleStory Server
|
||||
Copyleft (L) 2016 - 2018 RonanLana
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
||||
@@ -74,7 +74,7 @@ public class ItemRequirement extends MapleQuestRequirement {
|
||||
count += item.getQuantity();
|
||||
}
|
||||
//Weird stuff, nexon made some quests only available when wearing gm clothes. This enables us to accept it ><
|
||||
if (iType.equals(MapleInventoryType.EQUIP)) {
|
||||
if (iType.equals(MapleInventoryType.EQUIP) && !ItemConstants.isMedal(itemId)) {
|
||||
if(chr.isGM()) {
|
||||
for (Item item : chr.getInventory(MapleInventoryType.EQUIPPED).listById(itemId)) {
|
||||
count += item.getQuantity();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
This file is part of the HeavenMS (MapleSolaxiaV2) MapleStory Server
|
||||
Copyleft (L) 2017 RonanLana
|
||||
This file is part of the HeavenMS MapleStory Server
|
||||
Copyleft (L) 2016 - 2018 RonanLana
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as
|
||||
|
||||
Reference in New Issue
Block a user