@@ -306,7 +306,7 @@ server:
|
|||||||
PARTY_BONUS_EXP_RATE: 1.0 #Rate for the party exp bonus reward.
|
PARTY_BONUS_EXP_RATE: 1.0 #Rate for the party exp bonus reward.
|
||||||
|
|
||||||
#Miscellaneous Configuration
|
#Miscellaneous Configuration
|
||||||
TIMEZONE: GMT-3
|
TIMEZONE: GMT
|
||||||
CHARSET: US-ASCII # Is loaded first, so applies to the rest of this config. Defaults to US-ASCII if invalid or not set.
|
CHARSET: US-ASCII # Is loaded first, so applies to the rest of this config. Defaults to US-ASCII if invalid or not set.
|
||||||
USE_DISPLAY_NUMBERS_WITH_COMMA: true #Enforce comma on displayed strings (use this when USE_UNITPRICE_WITH_COMMA is active and you still want to display comma-separated values).
|
USE_DISPLAY_NUMBERS_WITH_COMMA: true #Enforce comma on displayed strings (use this when USE_UNITPRICE_WITH_COMMA is active and you still want to display comma-separated values).
|
||||||
USE_UNITPRICE_WITH_COMMA: true #Set this accordingly with the layout of the unitPrices on Item.wz XML's, whether it's using commas or dots to represent fractions.
|
USE_UNITPRICE_WITH_COMMA: true #Set this accordingly with the layout of the unitPrices on Item.wz XML's, whether it's using commas or dots to represent fractions.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@echo off
|
@echo off
|
||||||
@title Cosmic
|
@title Cosmic
|
||||||
java -Xmx2048m -jar target\Cosmic.jar
|
java -Xmx2048m -Dwz-path= -jar target\Cosmic.jar
|
||||||
pause
|
pause
|
||||||
@@ -155,7 +155,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
|||||||
private MapleClient client;
|
private MapleClient client;
|
||||||
private MapleGuildCharacter mgc = null;
|
private MapleGuildCharacter mgc = null;
|
||||||
private MaplePartyCharacter mpc = null;
|
private MaplePartyCharacter mpc = null;
|
||||||
private MapleInventory[] inventory;
|
private Inventory[] inventory;
|
||||||
private MapleJob job = MapleJob.BEGINNER;
|
private MapleJob job = MapleJob.BEGINNER;
|
||||||
private MapleMessenger messenger = null;
|
private MapleMessenger messenger = null;
|
||||||
private MapleMiniGame miniGame;
|
private MapleMiniGame miniGame;
|
||||||
@@ -303,7 +303,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
|||||||
useCS = false;
|
useCS = false;
|
||||||
|
|
||||||
setStance(0);
|
setStance(0);
|
||||||
inventory = new MapleInventory[MapleInventoryType.values().length];
|
inventory = new Inventory[MapleInventoryType.values().length];
|
||||||
savedLocations = new SavedLocation[SavedLocationType.values().length];
|
savedLocations = new SavedLocation[SavedLocationType.values().length];
|
||||||
|
|
||||||
for (MapleInventoryType type : MapleInventoryType.values()) {
|
for (MapleInventoryType type : MapleInventoryType.values()) {
|
||||||
@@ -311,7 +311,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
|||||||
if (type == MapleInventoryType.CASH) {
|
if (type == MapleInventoryType.CASH) {
|
||||||
b = 96;
|
b = 96;
|
||||||
}
|
}
|
||||||
inventory[type.ordinal()] = new MapleInventory(this, type, (byte) b);
|
inventory[type.ordinal()] = new Inventory(this, type, (byte) b);
|
||||||
}
|
}
|
||||||
inventory[MapleInventoryType.CANHOLD.ordinal()] = new MapleInventoryProof(this);
|
inventory[MapleInventoryType.CANHOLD.ordinal()] = new MapleInventoryProof(this);
|
||||||
|
|
||||||
@@ -906,7 +906,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
|||||||
|
|
||||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||||
for(MapleInventoryType invType : MapleInventoryType.values()) {
|
for(MapleInventoryType invType : MapleInventoryType.values()) {
|
||||||
MapleInventory inv = this.getInventory(invType);
|
Inventory inv = this.getInventory(invType);
|
||||||
|
|
||||||
inv.lockInventory();
|
inv.lockInventory();
|
||||||
try {
|
try {
|
||||||
@@ -2944,7 +2944,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Item> toberemove = new ArrayList<>();
|
List<Item> toberemove = new ArrayList<>();
|
||||||
for (MapleInventory inv : inventory) {
|
for (Inventory inv : inventory) {
|
||||||
for (Item item : inv.list()) {
|
for (Item item : inv.list()) {
|
||||||
expiration = item.getExpiration();
|
expiration = item.getExpiration();
|
||||||
|
|
||||||
@@ -5096,7 +5096,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
|||||||
return initialSpawnPoint;
|
return initialSpawnPoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapleInventory getInventory(MapleInventoryType type) {
|
public Inventory getInventory(MapleInventoryType type) {
|
||||||
return inventory[type.ordinal()];
|
return inventory[type.ordinal()];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6667,7 +6667,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateCouponRates() {
|
public void updateCouponRates() {
|
||||||
MapleInventory cashInv = this.getInventory(MapleInventoryType.CASH);
|
Inventory cashInv = this.getInventory(MapleInventoryType.CASH);
|
||||||
if (cashInv == null) return;
|
if (cashInv == null) return;
|
||||||
|
|
||||||
effLock.lock();
|
effLock.lock();
|
||||||
@@ -6872,7 +6872,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
|||||||
ret.jobRankMove = rs.getInt("jobRankMove");
|
ret.jobRankMove = rs.getInt("jobRankMove");
|
||||||
|
|
||||||
if(equipped != null) { // players can have no equipped items at all, ofc
|
if(equipped != null) { // players can have no equipped items at all, ofc
|
||||||
MapleInventory inv = ret.inventory[MapleInventoryType.EQUIPPED.ordinal()];
|
Inventory inv = ret.inventory[MapleInventoryType.EQUIPPED.ordinal()];
|
||||||
for (Item item : equipped) {
|
for (Item item : equipped) {
|
||||||
inv.addItemFromDB(item);
|
inv.addItemFromDB(item);
|
||||||
}
|
}
|
||||||
@@ -7831,7 +7831,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
|||||||
boolean gun = weapon == MapleWeaponType.GUN;
|
boolean gun = weapon == MapleWeaponType.GUN;
|
||||||
if (bow || crossbow || claw || gun) {
|
if (bow || crossbow || claw || gun) {
|
||||||
// Also calc stars into this.
|
// Also calc stars into this.
|
||||||
MapleInventory inv = getInventory(MapleInventoryType.USE);
|
Inventory inv = getInventory(MapleInventoryType.USE);
|
||||||
for (short i = 1; i <= inv.getSlotLimit(); i++) {
|
for (short i = 1; i <= inv.getSlotLimit(); i++) {
|
||||||
Item item = inv.getItem(i);
|
Item item = inv.getItem(i);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
@@ -8279,7 +8279,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
itemsWithType = new ArrayList<>();
|
itemsWithType = new ArrayList<>();
|
||||||
for (MapleInventory iv : inventory) {
|
for (Inventory iv : inventory) {
|
||||||
for (Item item : iv.list()) {
|
for (Item item : iv.list()) {
|
||||||
itemsWithType.add(new Pair<>(item, iv.getType()));
|
itemsWithType.add(new Pair<>(item, iv.getType()));
|
||||||
}
|
}
|
||||||
@@ -8557,7 +8557,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Pair<Item, MapleInventoryType>> itemsWithType = new ArrayList<>();
|
List<Pair<Item, MapleInventoryType>> itemsWithType = new ArrayList<>();
|
||||||
for (MapleInventory iv : inventory) {
|
for (Inventory iv : inventory) {
|
||||||
for (Item item : iv.list()) {
|
for (Item item : iv.list()) {
|
||||||
itemsWithType.add(new Pair<>(item, iv.getType()));
|
itemsWithType.add(new Pair<>(item, iv.getType()));
|
||||||
}
|
}
|
||||||
@@ -9139,7 +9139,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInventory(MapleInventoryType type, MapleInventory inv) {
|
public void setInventory(MapleInventoryType type, Inventory inv) {
|
||||||
inventory[type.ordinal()] = inv;
|
inventory[type.ordinal()] = inv;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9329,7 +9329,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
|||||||
//player decides from which inventory items should be sold.
|
//player decides from which inventory items should be sold.
|
||||||
MapleInventoryType type = MapleInventoryType.getByType(invTypeId);
|
MapleInventoryType type = MapleInventoryType.getByType(invTypeId);
|
||||||
|
|
||||||
MapleInventory inv = getInventory(type);
|
Inventory inv = getInventory(type);
|
||||||
inv.lockInventory();
|
inv.lockInventory();
|
||||||
try {
|
try {
|
||||||
Item it = inv.findByName(name);
|
Item it = inv.findByName(name);
|
||||||
@@ -9346,7 +9346,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
|||||||
public int sellAllItemsFromPosition(MapleItemInformationProvider ii, MapleInventoryType type, short pos) {
|
public int sellAllItemsFromPosition(MapleItemInformationProvider ii, MapleInventoryType type, short pos) {
|
||||||
int mesoGain = 0;
|
int mesoGain = 0;
|
||||||
|
|
||||||
MapleInventory inv = getInventory(type);
|
Inventory inv = getInventory(type);
|
||||||
inv.lockInventory();
|
inv.lockInventory();
|
||||||
try {
|
try {
|
||||||
for(short i = pos; i <= inv.getSlotLimit(); i++) {
|
for(short i = pos; i <= inv.getSlotLimit(); i++) {
|
||||||
@@ -9367,7 +9367,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
|||||||
quantity = 1;
|
quantity = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
MapleInventory inv = getInventory(type);
|
Inventory inv = getInventory(type);
|
||||||
inv.lockInventory();
|
inv.lockInventory();
|
||||||
try {
|
try {
|
||||||
Item item = inv.getItem((short) slot);
|
Item item = inv.getItem((short) slot);
|
||||||
@@ -9443,7 +9443,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
|||||||
public boolean mergeAllItemsFromName(String name) {
|
public boolean mergeAllItemsFromName(String name) {
|
||||||
MapleInventoryType type = MapleInventoryType.EQUIP;
|
MapleInventoryType type = MapleInventoryType.EQUIP;
|
||||||
|
|
||||||
MapleInventory inv = getInventory(type);
|
Inventory inv = getInventory(type);
|
||||||
inv.lockInventory();
|
inv.lockInventory();
|
||||||
try {
|
try {
|
||||||
Item it = inv.findByName(name);
|
Item it = inv.findByName(name);
|
||||||
@@ -9518,7 +9518,7 @@ public class MapleCharacter extends AbstractMapleCharacterObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void mergeAllItemsFromPosition(Map<StatUpgrade, Float> statups, short pos) {
|
public void mergeAllItemsFromPosition(Map<StatUpgrade, Float> statups, short pos) {
|
||||||
MapleInventory inv = getInventory(MapleInventoryType.EQUIP);
|
Inventory inv = getInventory(MapleInventoryType.EQUIP);
|
||||||
inv.lockInventory();
|
inv.lockInventory();
|
||||||
try {
|
try {
|
||||||
for(short i = pos; i <= inv.getSlotLimit(); i++) {
|
for(short i = pos; i <= inv.getSlotLimit(); i++) {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import client.MapleCharacter;
|
|||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
import client.command.Command;
|
import client.command.Command;
|
||||||
import client.inventory.Equip;
|
import client.inventory.Equip;
|
||||||
import client.inventory.MapleInventory;
|
import client.inventory.Inventory;
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import constants.inventory.ItemConstants;
|
import constants.inventory.ItemConstants;
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ public class SetEqStatCommand extends Command {
|
|||||||
|
|
||||||
short newStat = (short) Math.max(0, Integer.parseInt(params[0]));
|
short newStat = (short) Math.max(0, Integer.parseInt(params[0]));
|
||||||
short newSpdJmp = params.length >= 2 ? (short) Integer.parseInt(params[1]) : 0;
|
short newSpdJmp = params.length >= 2 ? (short) Integer.parseInt(params[1]) : 0;
|
||||||
MapleInventory equip = player.getInventory(MapleInventoryType.EQUIP);
|
Inventory equip = player.getInventory(MapleInventoryType.EQUIP);
|
||||||
|
|
||||||
for (byte i = 1; i <= equip.getSlotLimit(); i++) {
|
for (byte i = 1; i <= equip.getSlotLimit(); i++) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ package client.creator;
|
|||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
import client.MapleSkinColor;
|
import client.MapleSkinColor;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import config.YamlConfig;
|
import config.YamlConfig;
|
||||||
import net.server.Server;
|
import net.server.Server;
|
||||||
@@ -58,7 +58,7 @@ public abstract class CharacterFactory {
|
|||||||
newchar.setJob(recipe.getJob());
|
newchar.setJob(recipe.getJob());
|
||||||
newchar.setMapId(recipe.getMap());
|
newchar.setMapId(recipe.getMap());
|
||||||
|
|
||||||
MapleInventory equipped = newchar.getInventory(MapleInventoryType.EQUIPPED);
|
Inventory equipped = newchar.getInventory(MapleInventoryType.EQUIPPED);
|
||||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||||
|
|
||||||
int top = recipe.getTop(), bottom = recipe.getBottom(), shoes = recipe.getShoes(), weapon = recipe.getWeapon();
|
int top = recipe.getTop(), bottom = recipe.getBottom(), shoes = recipe.getShoes(), weapon = recipe.getWeapon();
|
||||||
|
|||||||
@@ -37,18 +37,18 @@ import java.util.Map.Entry;
|
|||||||
import java.util.concurrent.locks.Lock;
|
import java.util.concurrent.locks.Lock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Matze, Ronan
|
* @author Matze, Ronan
|
||||||
*/
|
*/
|
||||||
public class MapleInventory implements Iterable<Item> {
|
public class Inventory implements Iterable<Item> {
|
||||||
protected MapleCharacter owner;
|
protected final Map<Short, Item> inventory;
|
||||||
protected Map<Short, Item> inventory = new LinkedHashMap<>();
|
protected final MapleInventoryType type;
|
||||||
protected byte slotLimit;
|
protected final Lock lock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.INVENTORY, true);
|
||||||
protected MapleInventoryType type;
|
|
||||||
protected boolean checked = false;
|
|
||||||
protected Lock lock = MonitoredReentrantLockFactory.createLock(MonitoredLockType.INVENTORY, true);
|
|
||||||
|
|
||||||
public MapleInventory(MapleCharacter mc, MapleInventoryType type, byte slotLimit) {
|
protected MapleCharacter owner;
|
||||||
|
protected byte slotLimit;
|
||||||
|
protected boolean checked = false;
|
||||||
|
|
||||||
|
public Inventory(MapleCharacter mc, MapleInventoryType type, byte slotLimit) {
|
||||||
this.owner = mc;
|
this.owner = mc;
|
||||||
this.inventory = new LinkedHashMap<>();
|
this.inventory = new LinkedHashMap<>();
|
||||||
this.type = type;
|
this.type = type;
|
||||||
@@ -158,7 +158,9 @@ public class MapleInventory implements Iterable<Item> {
|
|||||||
|
|
||||||
if (required >= 0) {
|
if (required >= 0) {
|
||||||
openSlot++;
|
openSlot++;
|
||||||
if(required == 0) return openSlot;
|
if (required == 0) {
|
||||||
|
return openSlot;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return openSlot;
|
return openSlot;
|
||||||
}
|
}
|
||||||
@@ -169,7 +171,9 @@ public class MapleInventory implements Iterable<Item> {
|
|||||||
|
|
||||||
if (required >= 0) {
|
if (required >= 0) {
|
||||||
openSlot++;
|
openSlot++;
|
||||||
if(required == 0) return openSlot;
|
if (required == 0) {
|
||||||
|
return openSlot;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return openSlot;
|
return openSlot;
|
||||||
}
|
}
|
||||||
@@ -450,7 +454,9 @@ public class MapleInventory implements Iterable<Item> {
|
|||||||
public static boolean checkSpots(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> items, boolean useProofInv) {
|
public static boolean checkSpots(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> items, boolean useProofInv) {
|
||||||
int invTypesSize = MapleInventoryType.values().length;
|
int invTypesSize = MapleInventoryType.values().length;
|
||||||
List<Integer> zeroedList = new ArrayList<>(invTypesSize);
|
List<Integer> zeroedList = new ArrayList<>(invTypesSize);
|
||||||
for(byte i = 0; i < invTypesSize; i++) zeroedList.add(0);
|
for (byte i = 0; i < invTypesSize; i++) {
|
||||||
|
zeroedList.add(0);
|
||||||
|
}
|
||||||
|
|
||||||
return checkSpots(chr, items, zeroedList, useProofInv);
|
return checkSpots(chr, items, zeroedList, useProofInv);
|
||||||
}
|
}
|
||||||
@@ -494,7 +500,9 @@ public class MapleInventory implements Iterable<Item> {
|
|||||||
int result = MapleInventoryManipulator.checkSpaceProgressively(c, it.getKey(), itValue, "", usedSlots, useProofInv);
|
int result = MapleInventoryManipulator.checkSpaceProgressively(c, it.getKey(), itValue, "", usedSlots, useProofInv);
|
||||||
boolean hasSpace = ((result % 2) != 0);
|
boolean hasSpace = ((result % 2) != 0);
|
||||||
|
|
||||||
if(!hasSpace) return false;
|
if (!hasSpace) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
typesSlotsUsed.set(itemType, (result >> 1));
|
typesSlotsUsed.set(itemType, (result >> 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -526,7 +534,9 @@ public class MapleInventory implements Iterable<Item> {
|
|||||||
|
|
||||||
public static boolean checkSpotsAndOwnership(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> items, boolean useProofInv) {
|
public static boolean checkSpotsAndOwnership(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> items, boolean useProofInv) {
|
||||||
List<Integer> zeroedList = new ArrayList<>(5);
|
List<Integer> zeroedList = new ArrayList<>(5);
|
||||||
for(byte i = 0; i < 5; i++) zeroedList.add(0);
|
for (byte i = 0; i < 5; i++) {
|
||||||
|
zeroedList.add(0);
|
||||||
|
}
|
||||||
|
|
||||||
return checkSpotsAndOwnership(chr, items, zeroedList, useProofInv);
|
return checkSpotsAndOwnership(chr, items, zeroedList, useProofInv);
|
||||||
}
|
}
|
||||||
@@ -577,7 +587,9 @@ public class MapleInventory implements Iterable<Item> {
|
|||||||
boolean hasSpace = ((result % 2) != 0);
|
boolean hasSpace = ((result % 2) != 0);
|
||||||
//System.out.print(" -> hasSpace: " + hasSpace + " RESULT : " + result + "\n");
|
//System.out.print(" -> hasSpace: " + hasSpace + " RESULT : " + result + "\n");
|
||||||
|
|
||||||
if(!hasSpace) return false;
|
if (!hasSpace) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
typesSlotsUsed.set(itemType, (result >> 1));
|
typesSlotsUsed.set(itemType, (result >> 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -594,10 +606,6 @@ public class MapleInventory implements Iterable<Item> {
|
|||||||
return Collections.unmodifiableCollection(list()).iterator();
|
return Collections.unmodifiableCollection(list()).iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<MapleInventory> allInventories() {
|
|
||||||
return Collections.singletonList(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Item findByCashId(int cashId) {
|
public Item findByCashId(int cashId) {
|
||||||
boolean isRing = false;
|
boolean isRing = false;
|
||||||
Equip equip = null;
|
Equip equip = null;
|
||||||
@@ -606,9 +614,10 @@ public class MapleInventory implements Iterable<Item> {
|
|||||||
equip = (Equip) item;
|
equip = (Equip) item;
|
||||||
isRing = equip.getRingId() > -1;
|
isRing = equip.getRingId() > -1;
|
||||||
}
|
}
|
||||||
if ((item.getPetId() > -1 ? item.getPetId() : isRing ? equip.getRingId() : item.getCashId()) == cashId)
|
if ((item.getPetId() > -1 ? item.getPetId() : isRing ? equip.getRingId() : item.getCashId()) == cashId) {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -25,13 +25,13 @@ import client.MapleCharacter;
|
|||||||
*
|
*
|
||||||
* @author Ronan
|
* @author Ronan
|
||||||
*/
|
*/
|
||||||
public class MapleInventoryProof extends MapleInventory {
|
public class MapleInventoryProof extends Inventory {
|
||||||
|
|
||||||
public MapleInventoryProof(MapleCharacter mc) {
|
public MapleInventoryProof(MapleCharacter mc) {
|
||||||
super(mc, MapleInventoryType.CANHOLD, (byte) 0);
|
super(mc, MapleInventoryType.CANHOLD, (byte) 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cloneContents(MapleInventory inv) {
|
public void cloneContents(Inventory inv) {
|
||||||
inv.lockInventory();
|
inv.lockInventory();
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class MapleInventoryManipulator {
|
|||||||
MapleCharacter chr = c.getPlayer();
|
MapleCharacter chr = c.getPlayer();
|
||||||
MapleInventoryType type = ItemConstants.getInventoryType(itemId);
|
MapleInventoryType type = ItemConstants.getInventoryType(itemId);
|
||||||
|
|
||||||
MapleInventory inv = chr.getInventory(type);
|
Inventory inv = chr.getInventory(type);
|
||||||
inv.lockInventory();
|
inv.lockInventory();
|
||||||
try {
|
try {
|
||||||
return addByIdInternal(c, chr, type, inv, itemId, quantity, owner, petid, flag, expiration);
|
return addByIdInternal(c, chr, type, inv, itemId, quantity, owner, petid, flag, expiration);
|
||||||
@@ -75,7 +75,7 @@ public class MapleInventoryManipulator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean addByIdInternal(MapleClient c, MapleCharacter chr, MapleInventoryType type, MapleInventory inv, int itemId, short quantity, String owner, int petid, short flag, long expiration) {
|
private static boolean addByIdInternal(MapleClient c, MapleCharacter chr, MapleInventoryType type, Inventory inv, int itemId, short quantity, String owner, int petid, short flag, long expiration) {
|
||||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||||
if (!type.equals(MapleInventoryType.EQUIP)) {
|
if (!type.equals(MapleInventoryType.EQUIP)) {
|
||||||
short slotMax = ii.getSlotMax(c, itemId);
|
short slotMax = ii.getSlotMax(c, itemId);
|
||||||
@@ -169,7 +169,7 @@ public class MapleInventoryManipulator {
|
|||||||
MapleCharacter chr = c.getPlayer();
|
MapleCharacter chr = c.getPlayer();
|
||||||
MapleInventoryType type = item.getInventoryType();
|
MapleInventoryType type = item.getInventoryType();
|
||||||
|
|
||||||
MapleInventory inv = chr.getInventory(type);
|
Inventory inv = chr.getInventory(type);
|
||||||
inv.lockInventory();
|
inv.lockInventory();
|
||||||
try {
|
try {
|
||||||
return addFromDropInternal(c, chr, type, inv, item, show, petId);
|
return addFromDropInternal(c, chr, type, inv, item, show, petId);
|
||||||
@@ -178,7 +178,7 @@ public class MapleInventoryManipulator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean addFromDropInternal(MapleClient c, MapleCharacter chr, MapleInventoryType type, MapleInventory inv, Item item, boolean show, int petId) {
|
private static boolean addFromDropInternal(MapleClient c, MapleCharacter chr, MapleInventoryType type, Inventory inv, Item item, boolean show, int petId) {
|
||||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||||
int itemid = item.getItemId();
|
int itemid = item.getItemId();
|
||||||
if (ii.isPickupRestricted(itemid) && chr.haveItemWithId(itemid, true)) {
|
if (ii.isPickupRestricted(itemid) && chr.haveItemWithId(itemid, true)) {
|
||||||
@@ -268,7 +268,7 @@ public class MapleInventoryManipulator {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean haveItemWithId(MapleInventory inv, int itemid) {
|
private static boolean haveItemWithId(Inventory inv, int itemid) {
|
||||||
return inv.findById(itemid) != null;
|
return inv.findById(itemid) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ public class MapleInventoryManipulator {
|
|||||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||||
MapleInventoryType type = ItemConstants.getInventoryType(itemid);
|
MapleInventoryType type = ItemConstants.getInventoryType(itemid);
|
||||||
MapleCharacter chr = c.getPlayer();
|
MapleCharacter chr = c.getPlayer();
|
||||||
MapleInventory inv = chr.getInventory(type);
|
Inventory inv = chr.getInventory(type);
|
||||||
|
|
||||||
if (ii.isPickupRestricted(itemid)) {
|
if (ii.isPickupRestricted(itemid)) {
|
||||||
if (haveItemWithId(inv, itemid)) {
|
if (haveItemWithId(inv, itemid)) {
|
||||||
@@ -331,7 +331,7 @@ public class MapleInventoryManipulator {
|
|||||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||||
MapleInventoryType type = !useProofInv ? ItemConstants.getInventoryType(itemid) : MapleInventoryType.CANHOLD;
|
MapleInventoryType type = !useProofInv ? ItemConstants.getInventoryType(itemid) : MapleInventoryType.CANHOLD;
|
||||||
MapleCharacter chr = c.getPlayer();
|
MapleCharacter chr = c.getPlayer();
|
||||||
MapleInventory inv = chr.getInventory(type);
|
Inventory inv = chr.getInventory(type);
|
||||||
|
|
||||||
if (ii.isPickupRestricted(itemid)) {
|
if (ii.isPickupRestricted(itemid)) {
|
||||||
if (haveItemWithId(inv, itemid)) {
|
if (haveItemWithId(inv, itemid)) {
|
||||||
@@ -389,7 +389,7 @@ public class MapleInventoryManipulator {
|
|||||||
|
|
||||||
public static void removeFromSlot(MapleClient c, MapleInventoryType type, short slot, short quantity, boolean fromDrop, boolean consume) {
|
public static void removeFromSlot(MapleClient c, MapleInventoryType type, short slot, short quantity, boolean fromDrop, boolean consume) {
|
||||||
MapleCharacter chr = c.getPlayer();
|
MapleCharacter chr = c.getPlayer();
|
||||||
MapleInventory inv = chr.getInventory(type);
|
Inventory inv = chr.getInventory(type);
|
||||||
Item item = inv.getItem(slot);
|
Item item = inv.getItem(slot);
|
||||||
boolean allowZero = consume && ItemConstants.isRechargeable(item.getItemId());
|
boolean allowZero = consume && ItemConstants.isRechargeable(item.getItemId());
|
||||||
|
|
||||||
@@ -437,7 +437,7 @@ public class MapleInventoryManipulator {
|
|||||||
|
|
||||||
public static void removeById(MapleClient c, MapleInventoryType type, int itemId, int quantity, boolean fromDrop, boolean consume) {
|
public static void removeById(MapleClient c, MapleInventoryType type, int itemId, int quantity, boolean fromDrop, boolean consume) {
|
||||||
int removeQuantity = quantity;
|
int removeQuantity = quantity;
|
||||||
MapleInventory inv = c.getPlayer().getInventory(type);
|
Inventory inv = c.getPlayer().getInventory(type);
|
||||||
int slotLimit = type == MapleInventoryType.EQUIPPED ? 128 : inv.getSlotLimit();
|
int slotLimit = type == MapleInventoryType.EQUIPPED ? 128 : inv.getSlotLimit();
|
||||||
|
|
||||||
for (short i = 0; i <= slotLimit; i++) {
|
for (short i = 0; i <= slotLimit; i++) {
|
||||||
@@ -465,7 +465,7 @@ public class MapleInventoryManipulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void move(MapleClient c, MapleInventoryType type, short src, short dst) {
|
public static void move(MapleClient c, MapleInventoryType type, short src, short dst) {
|
||||||
MapleInventory inv = c.getPlayer().getInventory(type);
|
Inventory inv = c.getPlayer().getInventory(type);
|
||||||
|
|
||||||
if (src < 0 || dst < 0) {
|
if (src < 0 || dst < 0) {
|
||||||
return;
|
return;
|
||||||
@@ -505,8 +505,8 @@ public class MapleInventoryManipulator {
|
|||||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||||
|
|
||||||
MapleCharacter chr = c.getPlayer();
|
MapleCharacter chr = c.getPlayer();
|
||||||
MapleInventory eqpInv = chr.getInventory(MapleInventoryType.EQUIP);
|
Inventory eqpInv = chr.getInventory(MapleInventoryType.EQUIP);
|
||||||
MapleInventory eqpdInv = chr.getInventory(MapleInventoryType.EQUIPPED);
|
Inventory eqpdInv = chr.getInventory(MapleInventoryType.EQUIPPED);
|
||||||
|
|
||||||
Equip source = (Equip) eqpInv.getItem(src);
|
Equip source = (Equip) eqpInv.getItem(src);
|
||||||
if (source == null || !ii.canWearEquipment(chr, source, dst)) {
|
if (source == null || !ii.canWearEquipment(chr, source, dst)) {
|
||||||
@@ -620,8 +620,8 @@ public class MapleInventoryManipulator {
|
|||||||
|
|
||||||
public static void unequip(MapleClient c, short src, short dst) {
|
public static void unequip(MapleClient c, short src, short dst) {
|
||||||
MapleCharacter chr = c.getPlayer();
|
MapleCharacter chr = c.getPlayer();
|
||||||
MapleInventory eqpInv = chr.getInventory(MapleInventoryType.EQUIP);
|
Inventory eqpInv = chr.getInventory(MapleInventoryType.EQUIP);
|
||||||
MapleInventory eqpdInv = chr.getInventory(MapleInventoryType.EQUIPPED);
|
Inventory eqpdInv = chr.getInventory(MapleInventoryType.EQUIPPED);
|
||||||
|
|
||||||
Equip source = (Equip) eqpdInv.getItem(src);
|
Equip source = (Equip) eqpdInv.getItem(src);
|
||||||
Equip target = (Equip) eqpInv.getItem(dst);
|
Equip target = (Equip) eqpInv.getItem(dst);
|
||||||
@@ -685,7 +685,7 @@ public class MapleInventoryManipulator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MapleCharacter chr = c.getPlayer();
|
MapleCharacter chr = c.getPlayer();
|
||||||
MapleInventory inv = chr.getInventory(type);
|
Inventory inv = chr.getInventory(type);
|
||||||
Item source = inv.getItem(src);
|
Item source = inv.getItem(src);
|
||||||
|
|
||||||
if (chr.getTrade() != null || chr.getMiniGame() != null || source == null) { //Only check needed would prob be merchants (to see if the player is in one)
|
if (chr.getTrade() != null || chr.getMiniGame() != null || source == null) { //Only check needed would prob be merchants (to see if the player is in one)
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ package client.processor.action;
|
|||||||
|
|
||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import config.YamlConfig;
|
import config.YamlConfig;
|
||||||
@@ -96,7 +96,7 @@ public class PetAutopotProcessor {
|
|||||||
curHp = chr.getHp();
|
curHp = chr.getHp();
|
||||||
curMp = chr.getMp();
|
curMp = chr.getMp();
|
||||||
|
|
||||||
MapleInventory useInv = chr.getInventory(MapleInventoryType.USE);
|
Inventory useInv = chr.getInventory(MapleInventoryType.USE);
|
||||||
useInv.lockInventory();
|
useInv.lockInventory();
|
||||||
try {
|
try {
|
||||||
toUse = useInv.getItem(slot);
|
toUse = useInv.getItem(slot);
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ package client.processor.npc;
|
|||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
import client.autoban.AutobanFactory;
|
import client.autoban.AutobanFactory;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.ItemFactory;
|
import client.inventory.ItemFactory;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import client.inventory.manipulator.MapleKarmaManipulator;
|
import client.inventory.manipulator.MapleKarmaManipulator;
|
||||||
@@ -242,7 +242,7 @@ public class DueyProcessor {
|
|||||||
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
|
||||||
|
|
||||||
MapleInventoryType invType = MapleInventoryType.getByType(invTypeId);
|
MapleInventoryType invType = MapleInventoryType.getByType(invTypeId);
|
||||||
MapleInventory inv = c.getPlayer().getInventory(invType);
|
Inventory inv = c.getPlayer().getInventory(invType);
|
||||||
|
|
||||||
Item item;
|
Item item;
|
||||||
inv.lockInventory();
|
inv.lockInventory();
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ package client.processor.npc;
|
|||||||
|
|
||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.ItemFactory;
|
import client.inventory.ItemFactory;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import net.server.Server;
|
import net.server.Server;
|
||||||
@@ -53,7 +53,7 @@ public class FredrickProcessor {
|
|||||||
private static int[] dailyReminders = new int[]{2, 5, 10, 15, 30, 60, 90, Integer.MAX_VALUE};
|
private static int[] dailyReminders = new int[]{2, 5, 10, 15, 30, 60, 90, Integer.MAX_VALUE};
|
||||||
|
|
||||||
private static byte canRetrieveFromFredrick(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> items) {
|
private static byte canRetrieveFromFredrick(MapleCharacter chr, List<Pair<Item, MapleInventoryType>> items) {
|
||||||
if (!MapleInventory.checkSpotsAndOwnership(chr, items)) {
|
if (!Inventory.checkSpotsAndOwnership(chr, items)) {
|
||||||
List<Integer> itemids = new LinkedList<>();
|
List<Integer> itemids = new LinkedList<>();
|
||||||
for (Pair<Item, MapleInventoryType> it : items) {
|
for (Pair<Item, MapleInventoryType> it : items) {
|
||||||
itemids.add(it.getLeft().getItemId());
|
itemids.add(it.getLeft().getItemId());
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ package client.processor.npc;
|
|||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
import client.autoban.AutobanFactory;
|
import client.autoban.AutobanFactory;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import client.inventory.manipulator.MapleKarmaManipulator;
|
import client.inventory.manipulator.MapleKarmaManipulator;
|
||||||
@@ -107,7 +107,7 @@ public class StorageProcessor {
|
|||||||
int itemId = p.readInt();
|
int itemId = p.readInt();
|
||||||
short quantity = p.readShort();
|
short quantity = p.readShort();
|
||||||
MapleInventoryType invType = ItemConstants.getInventoryType(itemId);
|
MapleInventoryType invType = ItemConstants.getInventoryType(itemId);
|
||||||
MapleInventory inv = chr.getInventory(invType);
|
Inventory inv = chr.getInventory(invType);
|
||||||
if (slot < 1 || slot > inv.getSlotLimit()) { //player inv starts at one
|
if (slot < 1 || slot > inv.getSlotLimit()) { //player inv starts at one
|
||||||
AutobanFactory.PACKET_EDIT.alert(c.getPlayer(), c.getPlayer().getName() + " tried to packet edit with storage.");
|
AutobanFactory.PACKET_EDIT.alert(c.getPlayer(), c.getPlayer().getName() + " tried to packet edit with storage.");
|
||||||
FilePrinter.print(FilePrinter.EXPLOITS + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + " tried to store item at slot " + slot);
|
FilePrinter.print(FilePrinter.EXPLOITS + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + " tried to store item at slot " + slot);
|
||||||
|
|||||||
@@ -62,12 +62,10 @@ import server.TimerManager;
|
|||||||
import server.expeditions.MapleExpeditionBossLog;
|
import server.expeditions.MapleExpeditionBossLog;
|
||||||
import server.life.MaplePlayerNPCFactory;
|
import server.life.MaplePlayerNPCFactory;
|
||||||
import server.quest.MapleQuest;
|
import server.quest.MapleQuest;
|
||||||
import tools.AutoJCE;
|
|
||||||
import tools.DatabaseConnection;
|
import tools.DatabaseConnection;
|
||||||
import tools.FilePrinter;
|
import tools.FilePrinter;
|
||||||
import tools.Pair;
|
import tools.Pair;
|
||||||
|
|
||||||
import java.security.Security;
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@@ -958,8 +956,6 @@ public class Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Security.setProperty("crypto.policy", "unlimited");
|
|
||||||
AutoJCE.removeCryptographyRestrictions();
|
|
||||||
Server.getInstance().init();
|
Server.getInstance().init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ package net.server.channel.handlers;
|
|||||||
|
|
||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
import client.inventory.MapleInventory;
|
import client.inventory.Inventory;
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import net.AbstractPacketHandler;
|
import net.AbstractPacketHandler;
|
||||||
@@ -62,7 +62,7 @@ public final class AdminCommandHandler extends AbstractPacketHandler {
|
|||||||
break;
|
break;
|
||||||
case 0x01: { // /d (inv)
|
case 0x01: { // /d (inv)
|
||||||
byte type = p.readByte();
|
byte type = p.readByte();
|
||||||
MapleInventory in = c.getPlayer().getInventory(MapleInventoryType.getByType(type));
|
Inventory in = c.getPlayer().getInventory(MapleInventoryType.getByType(type));
|
||||||
for (short i = 1; i <= in.getSlotLimit(); i++) { //TODO What is the point of this loop?
|
for (short i = 1; i <= in.getSlotLimit(); i++) { //TODO What is the point of this loop?
|
||||||
if (in.getItem(i) != null) {
|
if (in.getItem(i) != null) {
|
||||||
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.getByType(type), i, in.getItem(i).getQuantity(), false);
|
MapleInventoryManipulator.removeFromSlot(c, MapleInventoryType.getByType(type), i, in.getItem(i).getQuantity(), false);
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ import client.MapleCharacter;
|
|||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
import client.MapleRing;
|
import client.MapleRing;
|
||||||
import client.inventory.Equip;
|
import client.inventory.Equip;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import config.YamlConfig;
|
import config.YamlConfig;
|
||||||
@@ -280,7 +280,7 @@ public final class CashOperationHandler extends AbstractPacketHandler {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MapleInventory mi = chr.getInventory(MapleInventoryType.getByType(invType));
|
Inventory mi = chr.getInventory(MapleInventoryType.getByType(invType));
|
||||||
Item item = mi.findByCashId(cashId);
|
Item item = mi.findByCashId(cashId);
|
||||||
if (item == null) {
|
if (item == null) {
|
||||||
c.enableCSActions();
|
c.enableCSActions();
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ package net.server.channel.handlers;
|
|||||||
|
|
||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import config.YamlConfig;
|
import config.YamlConfig;
|
||||||
@@ -54,7 +54,7 @@ public final class InventoryMergeHandler extends AbstractPacketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MapleInventoryType inventoryType = MapleInventoryType.getByType(invType);
|
MapleInventoryType inventoryType = MapleInventoryType.getByType(invType);
|
||||||
MapleInventory inventory = c.getPlayer().getInventory(inventoryType);
|
Inventory inventory = c.getPlayer().getInventory(inventoryType);
|
||||||
inventory.lockInventory();
|
inventory.lockInventory();
|
||||||
try {
|
try {
|
||||||
//------------------- RonanLana's SLOT MERGER -----------------
|
//------------------- RonanLana's SLOT MERGER -----------------
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ public final class InventorySortHandler extends AbstractPacketHandler {
|
|||||||
ArrayList<Item> itemarray = new ArrayList<>();
|
ArrayList<Item> itemarray = new ArrayList<>();
|
||||||
List<ModifyInventory> mods = new ArrayList<>();
|
List<ModifyInventory> mods = new ArrayList<>();
|
||||||
|
|
||||||
MapleInventory inventory = chr.getInventory(MapleInventoryType.getByType(invType));
|
Inventory inventory = chr.getInventory(MapleInventoryType.getByType(invType));
|
||||||
inventory.lockInventory();
|
inventory.lockInventory();
|
||||||
try {
|
try {
|
||||||
for (short i = 1; i <= inventory.getSlotLimit(); i++) {
|
for (short i = 1; i <= inventory.getSlotLimit(); i++) {
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ package net.server.channel.handlers;
|
|||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
import client.autoban.AutobanManager;
|
import client.autoban.AutobanManager;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.MaplePet;
|
import client.inventory.MaplePet;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
@@ -71,7 +71,7 @@ public final class PetFoodHandler extends AbstractPacketHandler {
|
|||||||
|
|
||||||
if (c.tryacquireClient()) {
|
if (c.tryacquireClient()) {
|
||||||
try {
|
try {
|
||||||
MapleInventory useInv = chr.getInventory(MapleInventoryType.USE);
|
Inventory useInv = chr.getInventory(MapleInventoryType.USE);
|
||||||
useInv.lockInventory();
|
useInv.lockInventory();
|
||||||
try {
|
try {
|
||||||
Item use = useInv.getItem(pos);
|
Item use = useInv.getItem(pos);
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ package net.server.channel.handlers;
|
|||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
import client.autoban.AutobanFactory;
|
import client.autoban.AutobanFactory;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import client.inventory.manipulator.MapleKarmaManipulator;
|
import client.inventory.manipulator.MapleKarmaManipulator;
|
||||||
@@ -518,7 +518,7 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MapleInventory inv = chr.getInventory(ivType);
|
Inventory inv = chr.getInventory(ivType);
|
||||||
inv.lockInventory();
|
inv.lockInventory();
|
||||||
try {
|
try {
|
||||||
Item checkItem = chr.getInventory(ivType).getItem(pos);
|
Item checkItem = chr.getInventory(ivType).getItem(pos);
|
||||||
|
|||||||
@@ -314,7 +314,7 @@ public final class PlayerLoggedinHandler extends AbstractPacketHandler {
|
|||||||
player.updatePartyMemberHP();
|
player.updatePartyMemberHP();
|
||||||
}
|
}
|
||||||
|
|
||||||
MapleInventory eqpInv = player.getInventory(MapleInventoryType.EQUIPPED);
|
Inventory eqpInv = player.getInventory(MapleInventoryType.EQUIPPED);
|
||||||
eqpInv.lockInventory();
|
eqpInv.lockInventory();
|
||||||
try {
|
try {
|
||||||
for (Item it : eqpInv.list()) {
|
for (Item it : eqpInv.list()) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package net.server.channel.handlers;
|
|||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
import client.MapleQuestStatus;
|
import client.MapleQuestStatus;
|
||||||
import client.inventory.MapleInventory;
|
import client.inventory.Inventory;
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import net.AbstractPacketHandler;
|
import net.AbstractPacketHandler;
|
||||||
@@ -47,7 +47,7 @@ public class RaiseIncExpHandler extends AbstractPacketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int consId;
|
int consId;
|
||||||
MapleInventory inv = chr.getInventory(MapleInventoryType.getByType(inventorytype));
|
Inventory inv = chr.getInventory(MapleInventoryType.getByType(inventorytype));
|
||||||
inv.lockInventory();
|
inv.lockInventory();
|
||||||
try {
|
try {
|
||||||
consId = inv.getItem(slot).getItemId();
|
consId = inv.getItem(slot).getItemId();
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
package net.server.channel.handlers;
|
package net.server.channel.handlers;
|
||||||
|
|
||||||
import client.*;
|
import client.*;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.MapleWeaponType;
|
import client.inventory.MapleWeaponType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
@@ -123,7 +123,7 @@ public final class RangedAttackHandler extends AbstractDealDamageHandler {
|
|||||||
if (hasShadowPartner) {
|
if (hasShadowPartner) {
|
||||||
bulletCount *= 2;
|
bulletCount *= 2;
|
||||||
}
|
}
|
||||||
MapleInventory inv = chr.getInventory(MapleInventoryType.USE);
|
Inventory inv = chr.getInventory(MapleInventoryType.USE);
|
||||||
for (short i = 1; i <= inv.getSlotLimit(); i++) {
|
for (short i = 1; i <= inv.getSlotLimit(); i++) {
|
||||||
Item item = inv.getItem(i);
|
Item item = inv.getItem(i);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
@@ -174,7 +174,7 @@ public final class RangedAttackHandler extends AbstractDealDamageHandler {
|
|||||||
if (projectile != 0 || soulArrow || attack.skill == 11101004 || attack.skill == 15111007 || attack.skill == 14101006 || attack.skill == 4111004 || attack.skill == 13101005) {
|
if (projectile != 0 || soulArrow || attack.skill == 11101004 || attack.skill == 15111007 || attack.skill == 14101006 || attack.skill == 4111004 || attack.skill == 13101005) {
|
||||||
int visProjectile = projectile; //visible projectile sent to players
|
int visProjectile = projectile; //visible projectile sent to players
|
||||||
if (ItemConstants.isThrowingStar(projectile)) {
|
if (ItemConstants.isThrowingStar(projectile)) {
|
||||||
MapleInventory cash = chr.getInventory(MapleInventoryType.CASH);
|
Inventory cash = chr.getInventory(MapleInventoryType.CASH);
|
||||||
for (int i = 1; i <= cash.getSlotLimit(); i++) { // impose order...
|
for (int i = 1; i <= cash.getSlotLimit(); i++) { // impose order...
|
||||||
Item item = cash.getItem((short) i);
|
Item item = cash.getItem((short) i);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public final class ScrollHandler extends AbstractPacketHandler {
|
|||||||
}
|
}
|
||||||
byte oldLevel = toScroll.getLevel();
|
byte oldLevel = toScroll.getLevel();
|
||||||
byte oldSlots = toScroll.getUpgradeSlots();
|
byte oldSlots = toScroll.getUpgradeSlots();
|
||||||
MapleInventory useInventory = chr.getInventory(MapleInventoryType.USE);
|
Inventory useInventory = chr.getInventory(MapleInventoryType.USE);
|
||||||
Item scroll = useInventory.getItem(slot);
|
Item scroll = useInventory.getItem(slot);
|
||||||
Item wscroll = null;
|
Item wscroll = null;
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ public final class ScrollHandler extends AbstractPacketHandler {
|
|||||||
if(!ItemConstants.isWeddingRing(toScroll.getItemId())) {
|
if(!ItemConstants.isWeddingRing(toScroll.getItemId())) {
|
||||||
mods.add(new ModifyInventory(3, toScroll));
|
mods.add(new ModifyInventory(3, toScroll));
|
||||||
if (dst < 0) {
|
if (dst < 0) {
|
||||||
MapleInventory inv = chr.getInventory(MapleInventoryType.EQUIPPED);
|
Inventory inv = chr.getInventory(MapleInventoryType.EQUIPPED);
|
||||||
|
|
||||||
inv.lockInventory();
|
inv.lockInventory();
|
||||||
try {
|
try {
|
||||||
@@ -151,7 +151,7 @@ public final class ScrollHandler extends AbstractPacketHandler {
|
|||||||
inv.unlockInventory();
|
inv.unlockInventory();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
MapleInventory inv = chr.getInventory(MapleInventoryType.EQUIP);
|
Inventory inv = chr.getInventory(MapleInventoryType.EQUIP);
|
||||||
|
|
||||||
inv.lockInventory();
|
inv.lockInventory();
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ import client.MapleCharacter;
|
|||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
import client.Skill;
|
import client.Skill;
|
||||||
import client.SkillFactory;
|
import client.SkillFactory;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import net.AbstractPacketHandler;
|
import net.AbstractPacketHandler;
|
||||||
@@ -56,7 +56,7 @@ public final class SkillBookHandler extends AbstractPacketHandler {
|
|||||||
MapleCharacter player = c.getPlayer();
|
MapleCharacter player = c.getPlayer();
|
||||||
if (c.tryacquireClient()) {
|
if (c.tryacquireClient()) {
|
||||||
try {
|
try {
|
||||||
MapleInventory inv = c.getPlayer().getInventory(MapleInventoryType.USE);
|
Inventory inv = c.getPlayer().getInventory(MapleInventoryType.USE);
|
||||||
Item toUse = inv.getItem(slot);
|
Item toUse = inv.getItem(slot);
|
||||||
if (toUse == null || toUse.getItemId() != itemId) {
|
if (toUse == null || toUse.getItemId() != itemId) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
package net.server.channel.handlers;
|
package net.server.channel.handlers;
|
||||||
|
|
||||||
import client.*;
|
import client.*;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import client.status.MonsterStatus;
|
import client.status.MonsterStatus;
|
||||||
@@ -105,7 +105,7 @@ public final class TakeDamageHandler extends AbstractPacketHandler {
|
|||||||
if (dropCount > 0) {
|
if (dropCount > 0) {
|
||||||
int qty;
|
int qty;
|
||||||
|
|
||||||
MapleInventory inv = chr.getInventory(type);
|
Inventory inv = chr.getInventory(type);
|
||||||
inv.lockInventory();
|
inv.lockInventory();
|
||||||
try {
|
try {
|
||||||
qty = Math.min(chr.countItem(loseItem.getId()), dropCount);
|
qty = Math.min(chr.countItem(loseItem.getId()), dropCount);
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public final class UseCashItemHandler extends AbstractPacketHandler {
|
|||||||
int itemId = p.readInt();
|
int itemId = p.readInt();
|
||||||
int itemType = itemId / 10000;
|
int itemType = itemId / 10000;
|
||||||
|
|
||||||
MapleInventory cashInv = player.getInventory(MapleInventoryType.CASH);
|
Inventory cashInv = player.getInventory(MapleInventoryType.CASH);
|
||||||
Item toUse = cashInv.getItem(position);
|
Item toUse = cashInv.getItem(position);
|
||||||
if (toUse == null || toUse.getItemId() != itemId) {
|
if (toUse == null || toUse.getItemId() != itemId) {
|
||||||
toUse = cashInv.findById(itemId);
|
toUse = cashInv.findById(itemId);
|
||||||
@@ -601,7 +601,7 @@ public final class UseCashItemHandler extends AbstractPacketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void remove(MapleClient c, short position, int itemid) {
|
private static void remove(MapleClient c, short position, int itemid) {
|
||||||
MapleInventory cashInv = c.getPlayer().getInventory(MapleInventoryType.CASH);
|
Inventory cashInv = c.getPlayer().getInventory(MapleInventoryType.CASH);
|
||||||
cashInv.lockInventory();
|
cashInv.lockInventory();
|
||||||
try {
|
try {
|
||||||
Item it = cashInv.getItem(position);
|
Item it = cashInv.getItem(position);
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ package net.server.channel.handlers;
|
|||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
import client.MapleMount;
|
import client.MapleMount;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import constants.game.ExpTable;
|
import constants.game.ExpTable;
|
||||||
@@ -46,7 +46,7 @@ public final class UseMountFoodHandler extends AbstractPacketHandler {
|
|||||||
|
|
||||||
MapleCharacter chr = c.getPlayer();
|
MapleCharacter chr = c.getPlayer();
|
||||||
MapleMount mount = chr.getMount();
|
MapleMount mount = chr.getMount();
|
||||||
MapleInventory useInv = chr.getInventory(MapleInventoryType.USE);
|
Inventory useInv = chr.getInventory(MapleInventoryType.USE);
|
||||||
|
|
||||||
if (c.tryacquireClient()) {
|
if (c.tryacquireClient()) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ package net.server.channel.handlers;
|
|||||||
|
|
||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import net.AbstractPacketHandler;
|
import net.AbstractPacketHandler;
|
||||||
@@ -50,7 +50,7 @@ public final class UseSolomonHandler extends AbstractPacketHandler {
|
|||||||
if (c.tryacquireClient()) {
|
if (c.tryacquireClient()) {
|
||||||
try {
|
try {
|
||||||
MapleCharacter chr = c.getPlayer();
|
MapleCharacter chr = c.getPlayer();
|
||||||
MapleInventory inv = chr.getInventory(MapleInventoryType.USE);
|
Inventory inv = chr.getInventory(MapleInventoryType.USE);
|
||||||
inv.lockInventory();
|
inv.lockInventory();
|
||||||
try {
|
try {
|
||||||
Item slotItem = inv.getItem(slot);
|
Item slotItem = inv.getItem(slot);
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ package net.server.channel.handlers;
|
|||||||
|
|
||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import client.inventory.manipulator.MapleKarmaManipulator;
|
import client.inventory.manipulator.MapleKarmaManipulator;
|
||||||
@@ -57,7 +57,7 @@ public final class WeddingHandler extends AbstractPacketHandler {
|
|||||||
MapleCharacter spouse = marriage.getPlayerById(cid);
|
MapleCharacter spouse = marriage.getPlayerById(cid);
|
||||||
if (spouse != null) {
|
if (spouse != null) {
|
||||||
MapleInventoryType type = ItemConstants.getInventoryType(itemid);
|
MapleInventoryType type = ItemConstants.getInventoryType(itemid);
|
||||||
MapleInventory chrInv = chr.getInventory(type);
|
Inventory chrInv = chr.getInventory(type);
|
||||||
|
|
||||||
Item newItem = null;
|
Item newItem = null;
|
||||||
chrInv.lockInventory();
|
chrInv.lockInventory();
|
||||||
@@ -111,7 +111,7 @@ public final class WeddingHandler extends AbstractPacketHandler {
|
|||||||
if (groomWishlist != null) {
|
if (groomWishlist != null) {
|
||||||
Item item = marriage.getGiftItem(c, groomWishlist, itemPos);
|
Item item = marriage.getGiftItem(c, groomWishlist, itemPos);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
if (MapleInventory.checkSpot(chr, item)) {
|
if (Inventory.checkSpot(chr, item)) {
|
||||||
marriage.removeGiftItem(groomWishlist, item);
|
marriage.removeGiftItem(groomWishlist, item);
|
||||||
marriage.saveGiftItemsToDb(c, groomWishlist, chr.getId());
|
marriage.saveGiftItemsToDb(c, groomWishlist, chr.getId());
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ public final class WeddingHandler extends AbstractPacketHandler {
|
|||||||
List<Item> items = c.getAbstractPlayerInteraction().getUnclaimedMarriageGifts();
|
List<Item> items = c.getAbstractPlayerInteraction().getUnclaimedMarriageGifts();
|
||||||
try {
|
try {
|
||||||
Item item = items.get(itemPos);
|
Item item = items.get(itemPos);
|
||||||
if (MapleInventory.checkSpot(chr, item)) {
|
if (Inventory.checkSpot(chr, item)) {
|
||||||
items.remove(itemPos);
|
items.remove(itemPos);
|
||||||
MapleMarriage.saveGiftItemsToDb(c, items, chr.getId());
|
MapleMarriage.saveGiftItemsToDb(c, items, chr.getId());
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public enum WZFiles {
|
|||||||
SOUND("Sound"),
|
SOUND("Sound"),
|
||||||
UI("UI");
|
UI("UI");
|
||||||
|
|
||||||
public static final String DIRECTORY = "wz";
|
public static final String DIRECTORY = getWzDirectory();
|
||||||
|
|
||||||
private final String fileName;
|
private final String fileName;
|
||||||
|
|
||||||
@@ -32,4 +32,15 @@ public enum WZFiles {
|
|||||||
public String getFilePath() {
|
public String getFilePath() {
|
||||||
return getFile().getPath();
|
return getFile().getPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getWzDirectory() {
|
||||||
|
// Either provide a custom directory path through the "wz-path" property when launching the .jar,
|
||||||
|
// or don't provide one to use the default "wz" directory
|
||||||
|
String propertyPath = System.getProperty("wz-path");
|
||||||
|
if (propertyPath != null && new File(propertyPath).isDirectory()) {
|
||||||
|
return propertyPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "wz";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,11 +169,11 @@ public class AbstractPlayerInteraction {
|
|||||||
return getPlayer().getEventInstance();
|
return getPlayer().getEventInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapleInventory getInventory(int type) {
|
public Inventory getInventory(int type) {
|
||||||
return getPlayer().getInventory(MapleInventoryType.getByType((byte) type));
|
return getPlayer().getInventory(MapleInventoryType.getByType((byte) type));
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapleInventory getInventory(MapleInventoryType type) {
|
public Inventory getInventory(MapleInventoryType type) {
|
||||||
return getPlayer().getInventory(type);
|
return getPlayer().getInventory(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,7 +251,7 @@ public class AbstractPlayerInteraction {
|
|||||||
addedItems.add(new Pair<>(it, ItemConstants.getInventoryType(itemids.get(i))));
|
addedItems.add(new Pair<>(it, ItemConstants.getInventoryType(itemids.get(i))));
|
||||||
}
|
}
|
||||||
|
|
||||||
return MapleInventory.checkSpots(c.getPlayer(), addedItems, false);
|
return Inventory.checkSpots(c.getPlayer(), addedItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Pair<Item, MapleInventoryType>> prepareProofInventoryItems(List<Pair<Integer, Integer>> items) {
|
private List<Pair<Item, MapleInventoryType>> prepareProofInventoryItems(List<Pair<Integer, Integer>> items) {
|
||||||
@@ -293,7 +293,7 @@ public class AbstractPlayerInteraction {
|
|||||||
if(!toAdd.isEmpty()) {
|
if(!toAdd.isEmpty()) {
|
||||||
List<Pair<Integer, Integer>> toRemove = toRemoveItemList.get(i);
|
List<Pair<Integer, Integer>> toRemove = toRemoveItemList.get(i);
|
||||||
|
|
||||||
MapleInventory inv = this.getInventory(i);
|
Inventory inv = this.getInventory(i);
|
||||||
prfInv.cloneContents(inv);
|
prfInv.cloneContents(inv);
|
||||||
|
|
||||||
for(Pair<Integer, Integer> p : toRemove) {
|
for(Pair<Integer, Integer> p : toRemove) {
|
||||||
@@ -302,7 +302,7 @@ public class AbstractPlayerInteraction {
|
|||||||
|
|
||||||
List<Pair<Item, MapleInventoryType>> addItems = prepareProofInventoryItems(toAdd);
|
List<Pair<Item, MapleInventoryType>> addItems = prepareProofInventoryItems(toAdd);
|
||||||
|
|
||||||
boolean canHold = MapleInventory.checkSpots(c.getPlayer(), addItems, true);
|
boolean canHold = Inventory.checkSpots(c.getPlayer(), addItems, true);
|
||||||
if(!canHold) {
|
if(!canHold) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -843,7 +843,7 @@ public class AbstractPlayerInteraction {
|
|||||||
public void removeFromParty(int id, List<MapleCharacter> party) {
|
public void removeFromParty(int id, List<MapleCharacter> party) {
|
||||||
for (MapleCharacter chr : party) {
|
for (MapleCharacter chr : party) {
|
||||||
MapleInventoryType type = ItemConstants.getInventoryType(id);
|
MapleInventoryType type = ItemConstants.getInventoryType(id);
|
||||||
MapleInventory iv = chr.getInventory(type);
|
Inventory iv = chr.getInventory(type);
|
||||||
int possesed = iv.countById(id);
|
int possesed = iv.countById(id);
|
||||||
if (possesed > 0) {
|
if (possesed > 0) {
|
||||||
MapleInventoryManipulator.removeById(c, ItemConstants.getInventoryType(id), id, possesed, true, false);
|
MapleInventoryManipulator.removeById(c, ItemConstants.getInventoryType(id), id, possesed, true, false);
|
||||||
|
|||||||
@@ -1581,7 +1581,7 @@ public class MapleItemInformationProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Item> canWearEquipment(MapleCharacter chr, Collection<Item> items) {
|
public Collection<Item> canWearEquipment(MapleCharacter chr, Collection<Item> items) {
|
||||||
MapleInventory inv = chr.getInventory(MapleInventoryType.EQUIPPED);
|
Inventory inv = chr.getInventory(MapleInventoryType.EQUIPPED);
|
||||||
if (inv.checked()) {
|
if (inv.checked()) {
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ package server;
|
|||||||
|
|
||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.ItemFactory;
|
import client.inventory.ItemFactory;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import scripting.event.EventInstanceManager;
|
import scripting.event.EventInstanceManager;
|
||||||
@@ -118,7 +118,7 @@ public class MapleMarriage extends EventInstanceManager {
|
|||||||
|
|
||||||
public static boolean claimGiftItems(MapleClient c, MapleCharacter chr) {
|
public static boolean claimGiftItems(MapleClient c, MapleCharacter chr) {
|
||||||
List<Item> gifts = loadGiftItemsFromDb(c, chr.getId());
|
List<Item> gifts = loadGiftItemsFromDb(c, chr.getId());
|
||||||
if (MapleInventory.checkSpot(chr, gifts)) {
|
if (Inventory.checkSpot(chr, gifts)) {
|
||||||
try (Connection con = DatabaseConnection.getConnection()) {
|
try (Connection con = DatabaseConnection.getConnection()) {
|
||||||
ItemFactory.MARRIAGE_GIFTS.saveItems(new LinkedList<>(), chr.getId(), con);
|
ItemFactory.MARRIAGE_GIFTS.saveItems(new LinkedList<>(), chr.getId(), con);
|
||||||
} catch (SQLException sqle) {
|
} catch (SQLException sqle) {
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
package server;
|
package server;
|
||||||
|
|
||||||
import client.*;
|
import client.*;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import client.status.MonsterStatus;
|
import client.status.MonsterStatus;
|
||||||
@@ -940,7 +940,7 @@ public class MapleStatEffect {
|
|||||||
if (isShadowClaw()) {
|
if (isShadowClaw()) {
|
||||||
short projectileConsume = this.getBulletConsume(); // noticed by shavit
|
short projectileConsume = this.getBulletConsume(); // noticed by shavit
|
||||||
|
|
||||||
MapleInventory use = applyto.getInventory(MapleInventoryType.USE);
|
Inventory use = applyto.getInventory(MapleInventoryType.USE);
|
||||||
use.lockInventory();
|
use.lockInventory();
|
||||||
try {
|
try {
|
||||||
Item projectile = null;
|
Item projectile = null;
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
package server;
|
package server;
|
||||||
|
|
||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import client.inventory.manipulator.MapleKarmaManipulator;
|
import client.inventory.manipulator.MapleKarmaManipulator;
|
||||||
@@ -251,7 +251,7 @@ public class MapleTrade {
|
|||||||
tradeItems.add(new Pair<>(item, item.getInventoryType()));
|
tradeItems.add(new Pair<>(item, item.getInventoryType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return MapleInventory.checkSpotsAndOwnership(chr, tradeItems);
|
return Inventory.checkSpotsAndOwnership(chr, tradeItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean fitsUniquesInInventory() {
|
private boolean fitsUniquesInInventory() {
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ package server.maps;
|
|||||||
|
|
||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.ItemFactory;
|
import client.inventory.ItemFactory;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import client.inventory.manipulator.MapleKarmaManipulator;
|
import client.inventory.manipulator.MapleKarmaManipulator;
|
||||||
@@ -220,7 +220,7 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
|
|||||||
Item iitem = shopItem.getItem().copy();
|
Item iitem = shopItem.getItem().copy();
|
||||||
iitem.setQuantity((short) (shopItem.getItem().getQuantity() * shopItem.getBundles()));
|
iitem.setQuantity((short) (shopItem.getItem().getQuantity() * shopItem.getBundles()));
|
||||||
|
|
||||||
if (!MapleInventory.checkSpot(chr, iitem)) {
|
if (!Inventory.checkSpot(chr, iitem)) {
|
||||||
chr.sendPacket(PacketCreator.serverNotice(1, "Have a slot available on your inventory to claim back the item."));
|
chr.sendPacket(PacketCreator.serverNotice(1, "Have a slot available on your inventory to claim back the item."));
|
||||||
chr.sendPacket(PacketCreator.enableActions());
|
chr.sendPacket(PacketCreator.enableActions());
|
||||||
return;
|
return;
|
||||||
@@ -656,7 +656,7 @@ public class MapleHiredMerchant extends AbstractMapleMapObject {
|
|||||||
li.add(new Pair<>(it, it.getInventoryType()));
|
li.add(new Pair<>(it, it.getInventoryType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return MapleInventory.checkSpotsAndOwnership(chr, li);
|
return Inventory.checkSpotsAndOwnership(chr, li);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getChannel() {
|
public int getChannel() {
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ package server.maps;
|
|||||||
|
|
||||||
import client.MapleCharacter;
|
import client.MapleCharacter;
|
||||||
import client.MapleClient;
|
import client.MapleClient;
|
||||||
|
import client.inventory.Inventory;
|
||||||
import client.inventory.Item;
|
import client.inventory.Item;
|
||||||
import client.inventory.MapleInventory;
|
|
||||||
import client.inventory.MapleInventoryType;
|
import client.inventory.MapleInventoryType;
|
||||||
import client.inventory.manipulator.MapleInventoryManipulator;
|
import client.inventory.manipulator.MapleInventoryManipulator;
|
||||||
import client.inventory.manipulator.MapleKarmaManipulator;
|
import client.inventory.manipulator.MapleKarmaManipulator;
|
||||||
@@ -224,7 +224,7 @@ public class MaplePlayerShop extends AbstractMapleMapObject {
|
|||||||
Item iitem = shopItem.getItem().copy();
|
Item iitem = shopItem.getItem().copy();
|
||||||
iitem.setQuantity((short) (shopItem.getItem().getQuantity() * shopItem.getBundles()));
|
iitem.setQuantity((short) (shopItem.getItem().getQuantity() * shopItem.getBundles()));
|
||||||
|
|
||||||
if (!MapleInventory.checkSpot(chr, iitem)) {
|
if (!Inventory.checkSpot(chr, iitem)) {
|
||||||
chr.sendPacket(PacketCreator.serverNotice(1, "Have a slot available on your inventory to claim back the item."));
|
chr.sendPacket(PacketCreator.serverNotice(1, "Have a slot available on your inventory to claim back the item."));
|
||||||
chr.sendPacket(PacketCreator.enableActions());
|
chr.sendPacket(PacketCreator.enableActions());
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,61 +0,0 @@
|
|||||||
package tools;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
import java.security.Permission;
|
|
||||||
import java.security.PermissionCollection;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class AutoJCE{ // AutoJCE into server source thanks to Acernis dev team
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Credits: ntoskrnl of StackOverflow
|
|
||||||
* http://stackoverflow.com/questions/1179672/
|
|
||||||
*/
|
|
||||||
public static byte removeCryptographyRestrictions(){
|
|
||||||
if(!isRestrictedCryptography()){
|
|
||||||
//System.out.println("Cryptography restrictions removal not needed");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
try{
|
|
||||||
/*
|
|
||||||
* Do the following, but with reflection to bypass access checks:
|
|
||||||
*
|
|
||||||
* JceSecurity.isRestricted = false;
|
|
||||||
* JceSecurity.defaultPolicy.perms.clear();
|
|
||||||
* JceSecurity.defaultPolicy.add(CryptoAllPermission.INSTANCE);
|
|
||||||
*/
|
|
||||||
final Class<?> jceSecurity = Class.forName("javax.crypto.JceSecurity");
|
|
||||||
final Class<?> cryptoPermissions = Class.forName("javax.crypto.CryptoPermissions");
|
|
||||||
final Class<?> cryptoAllPermission = Class.forName("javax.crypto.CryptoAllPermission");
|
|
||||||
final Field isRestrictedField = jceSecurity.getDeclaredField("isRestricted");// was set to final in Java 8 Update 112. Requires you to remove the final modifier.
|
|
||||||
Field modifiersField = Field.class.getDeclaredField("modifiers");
|
|
||||||
modifiersField.setAccessible(true);
|
|
||||||
modifiersField.setInt(isRestrictedField, isRestrictedField.getModifiers() & ~Modifier.FINAL);
|
|
||||||
isRestrictedField.setAccessible(true);
|
|
||||||
isRestrictedField.set(null, false);
|
|
||||||
final Field defaultPolicyField = jceSecurity.getDeclaredField("defaultPolicy");
|
|
||||||
defaultPolicyField.setAccessible(true);
|
|
||||||
final PermissionCollection defaultPolicy = (PermissionCollection) defaultPolicyField.get(null);
|
|
||||||
final Field perms = cryptoPermissions.getDeclaredField("perms");
|
|
||||||
perms.setAccessible(true);
|
|
||||||
((Map<?, ?>) perms.get(defaultPolicy)).clear();
|
|
||||||
final Field instance = cryptoAllPermission.getDeclaredField("INSTANCE");
|
|
||||||
instance.setAccessible(true);
|
|
||||||
defaultPolicy.add((Permission) instance.get(null));
|
|
||||||
|
|
||||||
//System.out.println("Successfully removed cryptography restrictions");
|
|
||||||
return 1;
|
|
||||||
}catch(final Exception e){
|
|
||||||
e.printStackTrace();
|
|
||||||
|
|
||||||
System.err.println("Failed to remove cryptography restrictions");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isRestrictedCryptography(){
|
|
||||||
// This simply matches the Oracle JRE, but not OpenJDK.
|
|
||||||
return "Java(TM) SE Runtime Environment".equals(System.getProperty("java.runtime.name"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -246,7 +246,7 @@ public class PacketCreator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void addCharEquips(final OutPacket p, MapleCharacter chr) {
|
private static void addCharEquips(final OutPacket p, MapleCharacter chr) {
|
||||||
MapleInventory equip = chr.getInventory(MapleInventoryType.EQUIPPED);
|
Inventory equip = chr.getInventory(MapleInventoryType.EQUIPPED);
|
||||||
Collection<Item> ii = MapleItemInformationProvider.getInstance().canWearEquipment(chr, equip.list());
|
Collection<Item> ii = MapleItemInformationProvider.getInstance().canWearEquipment(chr, equip.list());
|
||||||
Map<Short, Integer> myEquip = new LinkedHashMap<>();
|
Map<Short, Integer> myEquip = new LinkedHashMap<>();
|
||||||
Map<Short, Integer> maskedEquip = new LinkedHashMap<>();
|
Map<Short, Integer> maskedEquip = new LinkedHashMap<>();
|
||||||
@@ -444,7 +444,7 @@ public class PacketCreator {
|
|||||||
p.writeByte(chr.getInventory(MapleInventoryType.getByType(i)).getSlotLimit());
|
p.writeByte(chr.getInventory(MapleInventoryType.getByType(i)).getSlotLimit());
|
||||||
}
|
}
|
||||||
p.writeLong(getTime(-2));
|
p.writeLong(getTime(-2));
|
||||||
MapleInventory iv = chr.getInventory(MapleInventoryType.EQUIPPED);
|
Inventory iv = chr.getInventory(MapleInventoryType.EQUIPPED);
|
||||||
Collection<Item> equippedC = iv.list();
|
Collection<Item> equippedC = iv.list();
|
||||||
List<Item> equipped = new ArrayList<>(equippedC.size());
|
List<Item> equipped = new ArrayList<>(equippedC.size());
|
||||||
List<Item> equippedCash = new ArrayList<>(equippedC.size());
|
List<Item> equippedCash = new ArrayList<>(equippedC.size());
|
||||||
|
|||||||
Reference in New Issue
Block a user