Storybook announce + AOE Mobskills & Autopot & Inventory check Patch

Implemented storybook detection for the skillbook announcer.
Fixed an issue with AOE mob skills not locating players properly in certain situations.
Reviewed interaction of players within same remote network on multiclient system.
Patched messages when leaving the expedition area showing up for leaving players.
Patched some skill questline item chances unexpectedly too low.
Reviewed Rush questline-exclusive area not allowing multiple players in the room.
Fixed meso capacity check on shop owner happening after item transaction.
Patched server-side autopot settings, now using threshold cooling method to determine a player's updated settings.
Reviewed locking flow regarding world/channel deployment on main class.
Fixed a scenario where items collectable by party members would not show up in case those were the only items to be dropped and none needed by the last-hitter.
Patched an issue in the inventory space checking algorithm that would allow a transaction for multiple of the same equipments.
Refactored Dojo entry/exit modules.
Patched a check on Maker skill.
Fixed Cygnus FA buff getting reapplied each time the skill procs.
This commit is contained in:
ronancpl
2019-11-26 01:13:15 -03:00
parent 661dcf0a96
commit bb586a7c0b
49 changed files with 658 additions and 372 deletions

View File

@@ -25,12 +25,14 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map.Entry;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.locks.Lock;
import net.server.audit.locks.factory.MonitoredReentrantLockFactory;
@@ -448,6 +450,20 @@ public class MapleInventory implements Iterable<Item> {
}
}
private static boolean checkItemRestricted(List<Pair<Item, MapleInventoryType>> items) {
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
Set<Integer> itemids = new HashSet<>();
for (Pair<Item, MapleInventoryType> p : items) {
int itemid = p.getLeft().getItemId();
if (ii.isPickupRestricted(itemid) && (p.getLeft().getQuantity() > 1 || !itemids.add(itemid))) {
return false;
}
}
return true;
}
public static boolean checkSpot(MapleCharacter chr, Item item) { // thanks Vcoc for noticing pshops not checking item stacks when taking item back
return checkSpot(chr, Collections.singletonList(item));
}
@@ -476,6 +492,10 @@ public class MapleInventory implements Iterable<Item> {
public static boolean checkSpots(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> items, List<Integer> typesSlotsUsed, boolean useProofInv) {
// assumption: no "UNDEFINED" or "EQUIPPED" items shall be tested here, all counts are >= 0.
if (!checkItemRestricted(items)) {
return false;
}
Map<Integer, List<Integer>> rcvItems = new LinkedHashMap<>();
Map<Integer, Byte> rcvTypes = new LinkedHashMap<>();
@@ -490,7 +510,7 @@ public class MapleInventory implements Iterable<Item> {
rcvItems.put(itemId, itemQtyList);
rcvTypes.put(itemId, item.right.getType());
} else {
if (!ItemConstants.isRechargeable(itemId)) {
if (!ItemConstants.isEquipment(itemId) && !ItemConstants.isRechargeable(itemId)) {
qty.set(0, qty.get(0) + item.left.getQuantity());
} else {
qty.add((int) item.left.getQuantity());
@@ -548,6 +568,10 @@ public class MapleInventory implements Iterable<Item> {
public static boolean checkSpotsAndOwnership(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> items, List<Integer> typesSlotsUsed, boolean useProofInv) {
//assumption: no "UNDEFINED" or "EQUIPPED" items shall be tested here, all counts are >= 0 and item list to be checked is a legal one.
if (!checkItemRestricted(items)) {
return false;
}
Map<Long, List<Integer>> rcvItems = new LinkedHashMap<>();
Map<Long, Byte> rcvTypes = new LinkedHashMap<>();
Map<Long, String> rcvOwners = new LinkedHashMap<>();
@@ -565,7 +589,7 @@ public class MapleInventory implements Iterable<Item> {
rcvOwners.put(itemHash, item.left.getOwner());
} else {
// thanks BHB88 for pointing out an issue with rechargeable items being stacked on inventory check
if (!ItemConstants.isRechargeable(item.left.getItemId())) {
if (!ItemConstants.isEquipment(item.left.getItemId()) && !ItemConstants.isRechargeable(item.left.getItemId())) {
qty.set(0, qty.get(0) + item.left.getQuantity());
} else {
qty.add((int) item.left.getQuantity());

View File

@@ -106,7 +106,7 @@ public class MapleInventoryManipulator {
}
}
boolean sandboxItem = (flag & ItemConstants.SANDBOX) == ItemConstants.SANDBOX;
while (quantity > 0 || ItemConstants.isRechargeable(itemId)) {
while (quantity > 0) {
short newQ = (short) Math.min(quantity, slotMax);
if (newQ != 0) {
quantity -= newQ;
@@ -124,9 +124,6 @@ public class MapleInventoryManipulator {
}
c.announce(MaplePacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, nItem))));
if(sandboxItem) chr.setHasSandboxItem();
if ((ItemConstants.isRechargeable(itemId)) && quantity == 0) {
break;
}
} else {
c.announce(MaplePacketCreator.enableActions());
return false;
@@ -189,8 +186,8 @@ public class MapleInventoryManipulator {
private static boolean addFromDropInternal(MapleClient c, MapleCharacter chr, MapleInventoryType type, MapleInventory inv, Item item, boolean show, int petId) {
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
if (ii.isPickupRestricted(item.getItemId()) && chr.haveItemWithId(item.getItemId(), true)) {
int itemid = item.getItemId();
if (ii.isPickupRestricted(itemid) && chr.haveItemWithId(itemid, true)) {
c.announce(MaplePacketCreator.getInventoryFull());
c.announce(MaplePacketCreator.showItemUnavailable());
return false;
@@ -198,9 +195,9 @@ public class MapleInventoryManipulator {
short quantity = item.getQuantity();
if (!type.equals(MapleInventoryType.EQUIP)) {
short slotMax = ii.getSlotMax(c, item.getItemId());
List<Item> existing = inv.listById(item.getItemId());
if (!ItemConstants.isRechargeable(item.getItemId()) && petId == -1) {
short slotMax = ii.getSlotMax(c, itemid);
List<Item> existing = inv.listById(itemid);
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) {
@@ -222,7 +219,7 @@ public class MapleInventoryManipulator {
while (quantity > 0) {
short newQ = (short) Math.min(quantity, slotMax);
quantity -= newQ;
Item nItem = new Item(item.getItemId(), (short) 0, newQ, petId);
Item nItem = new Item(itemid, (short) 0, newQ, petId);
nItem.setExpiration(item.getExpiration());
nItem.setOwner(item.getOwner());
nItem.setFlag(item.getFlag());
@@ -239,7 +236,7 @@ public class MapleInventoryManipulator {
if (MapleInventoryManipulator.isSandboxItem(nItem)) chr.setHasSandboxItem();
}
} else {
Item nItem = new Item(item.getItemId(), (short) 0, quantity, petId);
Item nItem = new Item(itemid, (short) 0, quantity, petId);
nItem.setExpiration(item.getExpiration());
nItem.setFlag(item.getFlag());
@@ -266,13 +263,13 @@ public class MapleInventoryManipulator {
c.announce(MaplePacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(0, item))));
if (MapleInventoryManipulator.isSandboxItem(item)) chr.setHasSandboxItem();
} else {
FilePrinter.printError(FilePrinter.ITEM, "Tried to pickup Equip id " + item.getItemId() + " containing more than 1 quantity --> " + quantity);
FilePrinter.printError(FilePrinter.ITEM, "Tried to pickup Equip id " + itemid + " containing more than 1 quantity --> " + quantity);
c.announce(MaplePacketCreator.getInventoryFull());
c.announce(MaplePacketCreator.showItemUnavailable());
return false;
}
if (show) {
c.announce(MaplePacketCreator.getShowItemGain(item.getItemId(), item.getQuantity()));
c.announce(MaplePacketCreator.getShowItemGain(itemid, item.getQuantity()));
}
return true;
}