Improved item & drop-point checking + Dojo fixes + Duey revamp

Fixed some issues with items being dropped sometimes out-of-reach and in a weird way.
Improved item checking function, now looking up one-of-a-kind items properly.
Fixed some issues with dojo skills and possible exploits in dojo progression.
Improved Duey, now displaying better info to players.
This commit is contained in:
ronancpl
2018-01-03 18:45:56 -02:00
parent 012f965f6a
commit 1190513d0c
69 changed files with 781 additions and 423 deletions

View File

@@ -120,10 +120,10 @@ public class Equip extends Item {
}
@Override
public byte getType() {
public byte getItemType() {
return 1;
}
public byte getUpgradeSlots() {
return upgradeSlots;
}

View File

@@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package client.inventory;
import constants.ItemConstants;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@@ -93,7 +94,11 @@ public class Item implements Comparable<Item> {
return quantity;
}
public byte getType() {
public MapleInventoryType getInventoryType() {
return ItemConstants.getInventoryType(id);
}
public byte getItemType() { // 1: equip, 3: pet, 2: other
if (getPetId() > -1) {
return 3;
}

View File

@@ -133,7 +133,7 @@ public enum ItemFactory {
items.add(new Pair<>(item, mit));
}
}
rs.close();
ps.close();
con.close();

View File

@@ -367,7 +367,7 @@ public class MapleInventory implements Iterable<Item> {
}
public static boolean checkSpot(MapleCharacter chr, Item item) {
if (chr.getInventory(MapleInventoryType.getByType(item.getType())).isFull()) return false;
if (chr.getInventory(item.getInventoryType()).isFull()) return false;
return true;
}
@@ -437,7 +437,7 @@ public class MapleInventory implements Iterable<Item> {
}
public static boolean checkSpotsAndOwnership(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> items, List<Integer> typesSlotsUsed) {
// assumption: no "UNDEFINED" or "EQUIPPED" items shall be tested here, all counts are >= 0.
//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, Byte> rcvTypes = new LinkedHashMap<>();
@@ -493,7 +493,7 @@ public class MapleInventory implements Iterable<Item> {
boolean isRing = false;
Equip equip = null;
for (Item item : list()) {
if (item.getType() == MapleInventoryType.EQUIP.getType()) {
if (item.getInventoryType().equals(MapleInventoryType.EQUIP)) {
equip = (Equip) item;
isRing = equip.getRingId() > -1;
}

View File

@@ -1,7 +1,5 @@
package client.inventory;
import constants.ItemConstants;
/**
*
* @author kevin
@@ -28,7 +26,7 @@ public class ModifyInventory {
}
public final int getInventoryType() {
return ItemConstants.getInventoryType(item.getItemId()).getType();
return item.getInventoryType().type;
}
public final short getPosition() {