Item Raise + Gachapon Rework + Minigames & M. Magnet & M. Door patch
Fixed a glitch in inventory that would happen when trying to put items into storage. Added "Item Raise" functionality. Adjusted Party Search. Token sessions no longer expires due to no players found, rather are sent into a brief "inactivity" period. Fixed Fredrick stored items not being properly erased after a character deletion. Fixed skillbooks in stacked quantities not being useable. New tool: MapleGachaponItemidRetriever. This tool parses the gachapon descriptor file (holding several item names, for several gachapons) and generates files for each defined gachapon with itemids of the loots. Revised Mushroom Empire transition portals that interacts with scripted items (items now are useable through inventory, no longer being automatically removed from inventory upon crossing portals). Fixed script "secretroom" always requiring a new key (quest reward) to access the inner rooms, which would make the room unreachable. Reworked gachapons loots throughout the game. New loots are supposed to represent an old-school MapleSEA-like escalation of gachapon loots. Fixed issues that would show up in the case null PIN/PIC gets checked. Reworked skill Monster Magnet, no longer using "catch success rate" as a skill progression element. This fixes the skill disconnecting caster upon failure. Revised Mystic Doors, no longer crashing players after the caster decides to cancel the buff moments after casting (during portal deploying effect in course). Fixed portal access to Prime Minister crashing when trying to access on a party. Refactored the several "startQuest/completeQuest" methods widely used in the many scripting managers. Methods that does essentially the same thing now are accessed from the superclass. Fixed "rechargeable items" not being properly accounted for slots availability in inventory slot checking. Fixed several issues of late within minigames. Fixed minigames regarding double results when handling some rare scenarios. Implemented "call for leave after finishing game" functionality of minigames.
This commit is contained in:
@@ -463,31 +463,41 @@ 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.
|
||||
|
||||
Map<Integer, Short> rcvItems = new LinkedHashMap<>();
|
||||
Map<Integer, List<Integer>> rcvItems = new LinkedHashMap<>();
|
||||
Map<Integer, Byte> rcvTypes = new LinkedHashMap<>();
|
||||
|
||||
for (Pair<Item, MapleInventoryType> item : items) {
|
||||
Integer itemId = item.left.getItemId();
|
||||
Short qty = rcvItems.get(itemId);
|
||||
List<Integer> qty = rcvItems.get(itemId);
|
||||
|
||||
if(qty == null) {
|
||||
rcvItems.put(itemId, item.left.getQuantity());
|
||||
List<Integer> itemQtyList = new LinkedList<>();
|
||||
itemQtyList.add((int) item.left.getQuantity());
|
||||
|
||||
rcvItems.put(itemId, itemQtyList);
|
||||
rcvTypes.put(itemId, item.right.getType());
|
||||
} else {
|
||||
rcvItems.put(itemId, (short)(qty + item.left.getQuantity()));
|
||||
if (!ItemConstants.isRechargeable(itemId)) {
|
||||
qty.set(0, qty.get(0) + item.left.getQuantity());
|
||||
} else {
|
||||
qty.add((int) item.left.getQuantity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MapleClient c = chr.getClient();
|
||||
for(Entry<Integer, Short> it: rcvItems.entrySet()) {
|
||||
for(Entry<Integer, List<Integer>> it: rcvItems.entrySet()) {
|
||||
int itemType = rcvTypes.get(it.getKey()) - 1;
|
||||
int usedSlots = typesSlotsUsed.get(itemType);
|
||||
|
||||
int result = MapleInventoryManipulator.checkSpaceProgressively(c, it.getKey(), it.getValue(), "", usedSlots, useProofInv);
|
||||
boolean hasSpace = ((result % 2) != 0);
|
||||
|
||||
if(!hasSpace) return false;
|
||||
typesSlotsUsed.set(itemType, (result >> 1));
|
||||
for (Integer itValue : it.getValue()) {
|
||||
int usedSlots = typesSlotsUsed.get(itemType);
|
||||
|
||||
int result = MapleInventoryManipulator.checkSpaceProgressively(c, it.getKey(), itValue, "", usedSlots, useProofInv);
|
||||
boolean hasSpace = ((result % 2) != 0);
|
||||
|
||||
if(!hasSpace) return false;
|
||||
typesSlotsUsed.set(itemType, (result >> 1));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -525,38 +535,48 @@ 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.
|
||||
|
||||
Map<Long, Short> rcvItems = new LinkedHashMap<>();
|
||||
Map<Long, List<Integer>> rcvItems = new LinkedHashMap<>();
|
||||
Map<Long, Byte> rcvTypes = new LinkedHashMap<>();
|
||||
Map<Long, String> rcvOwners = new LinkedHashMap<>();
|
||||
|
||||
for (Pair<Item, MapleInventoryType> item : items) {
|
||||
Long itemHash = hashKey(item.left.getItemId(), item.left.getOwner());
|
||||
Short qty = rcvItems.get(itemHash);
|
||||
List<Integer> qty = rcvItems.get(itemHash);
|
||||
|
||||
if(qty == null) {
|
||||
rcvItems.put(itemHash, item.left.getQuantity());
|
||||
List<Integer> itemQtyList = new LinkedList<>();
|
||||
itemQtyList.add((int) item.left.getQuantity());
|
||||
|
||||
rcvItems.put(itemHash, itemQtyList);
|
||||
rcvTypes.put(itemHash, item.right.getType());
|
||||
rcvOwners.put(itemHash, item.left.getOwner());
|
||||
} else {
|
||||
rcvItems.put(itemHash, (short)(qty + item.left.getQuantity()));
|
||||
// thanks BHB88 for pointing out an issue with rechargeable items being stacked on inventory check
|
||||
if (!ItemConstants.isRechargeable(item.left.getItemId())) {
|
||||
qty.set(0, qty.get(0) + item.left.getQuantity());
|
||||
} else {
|
||||
qty.add((int) item.left.getQuantity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MapleClient c = chr.getClient();
|
||||
for(Entry<Long, Short> it: rcvItems.entrySet()) {
|
||||
for(Entry<Long, List<Integer>> it: rcvItems.entrySet()) {
|
||||
int itemType = rcvTypes.get(it.getKey()) - 1;
|
||||
int usedSlots = typesSlotsUsed.get(itemType);
|
||||
int itemId = (int) (it.getKey() >> 32L);
|
||||
|
||||
Long itemId = it.getKey() >> 32L;
|
||||
|
||||
//System.out.print("inserting " + itemId.intValue() + " with type " + itemType + " qty " + it.getValue() + " owner '" + rcvOwners.get(it.getKey()) + "' current usedSlots:");
|
||||
//for(Integer i : typesSlotsUsed) System.out.print(" " + i);
|
||||
int result = MapleInventoryManipulator.checkSpaceProgressively(c, itemId.intValue(), it.getValue(), rcvOwners.get(it.getKey()), usedSlots, useProofInv);
|
||||
boolean hasSpace = ((result % 2) != 0);
|
||||
//System.out.print(" -> hasSpace: " + hasSpace + " RESULT : " + result + "\n");
|
||||
|
||||
if(!hasSpace) return false;
|
||||
typesSlotsUsed.set(itemType, (result >> 1));
|
||||
for (Integer itValue : it.getValue()) {
|
||||
int usedSlots = typesSlotsUsed.get(itemType);
|
||||
|
||||
//System.out.print("inserting " + itemId.intValue() + " with type " + itemType + " qty " + it.getValue() + " owner '" + rcvOwners.get(it.getKey()) + "' current usedSlots:");
|
||||
//for(Integer i : typesSlotsUsed) System.out.print(" " + i);
|
||||
int result = MapleInventoryManipulator.checkSpaceProgressively(c, itemId, itValue, rcvOwners.get(it.getKey()), usedSlots, useProofInv);
|
||||
boolean hasSpace = ((result % 2) != 0);
|
||||
//System.out.print(" -> hasSpace: " + hasSpace + " RESULT : " + result + "\n");
|
||||
|
||||
if(!hasSpace) return false;
|
||||
typesSlotsUsed.set(itemType, (result >> 1));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user