|
|
@ -542,41 +542,51 @@ public class ClientMessagePump implements NetMsgHandler { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void deleteItem(DeleteItemMsg msg, ClientConnection origin) { |
|
|
|
private static void DeleteItem(DeleteItemMsg msg, ClientConnection origin) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CharacterItemManager itemManager = origin.getPlayerCharacter().getCharItemManager(); |
|
|
|
|
|
|
|
int uuid = msg.getUUID(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PlayerCharacter sourcePlayer = origin.getPlayerCharacter(); |
|
|
|
PlayerCharacter sourcePlayer = origin.getPlayerCharacter(); |
|
|
|
if (sourcePlayer == null || !sourcePlayer.isAlive()) { |
|
|
|
|
|
|
|
|
|
|
|
if (sourcePlayer == null) |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CharacterItemManager itemManager = sourcePlayer.getCharItemManager(); |
|
|
|
if (!sourcePlayer.isAlive()) |
|
|
|
Item item = Item.getFromCache(msg.getUUID()); |
|
|
|
|
|
|
|
if (item == null || !canDeleteItem(item, itemManager)) { |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int value = item.getItemBase().value; |
|
|
|
Item i = Item.getFromCache(msg.getUUID()); |
|
|
|
if (item.getItemBase().isRune()) { |
|
|
|
|
|
|
|
value = 500000; |
|
|
|
if (i == null) |
|
|
|
} |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(i.getItemBaseID() == 7) |
|
|
|
|
|
|
|
return; //cant delete gold
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!itemManager.doesCharOwnThisItem(i.getObjectUUID())) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!itemManager.inventoryContains(i)) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(i.getItemBaseID() == 980066) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (i.canDestroy) { |
|
|
|
|
|
|
|
int value = i.getItemBase().value; |
|
|
|
|
|
|
|
if(i.getItemBase().isRune()) |
|
|
|
|
|
|
|
value = 500000; |
|
|
|
if(sourcePlayer.getCharItemManager().getGoldInventory().getNumOfItems() + value > 10000000){ |
|
|
|
if(sourcePlayer.getCharItemManager().getGoldInventory().getNumOfItems() + value > 10000000){ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (itemManager.delete(i) == true) { |
|
|
|
if (itemManager.delete(item)) { |
|
|
|
sourcePlayer.getCharItemManager().addGoldToInventory(value,false); |
|
|
|
itemManager.addGoldToInventory(value, false); |
|
|
|
sourcePlayer.getCharItemManager().updateInventory(); |
|
|
|
itemManager.updateInventory(); |
|
|
|
|
|
|
|
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg); |
|
|
|
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg); |
|
|
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); |
|
|
|
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static boolean canDeleteItem(Item item, CharacterItemManager itemManager) { |
|
|
|
|
|
|
|
return item.getItemBaseID() != 7 && // Can't delete gold
|
|
|
|
|
|
|
|
item.getItemBaseID() != 980066 && // Can't delete conc pots
|
|
|
|
|
|
|
|
item.canDestroy && |
|
|
|
|
|
|
|
itemManager.doesCharOwnThisItem(item.getObjectUUID()) && |
|
|
|
|
|
|
|
itemManager.inventoryContains(item); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void ackBankWindowOpened(AckBankWindowOpenedMsg msg, ClientConnection origin) { |
|
|
|
private static void ackBankWindowOpened(AckBankWindowOpenedMsg msg, ClientConnection origin) { |
|
|
@ -1969,7 +1979,7 @@ public class ClientMessagePump implements NetMsgHandler { |
|
|
|
TransferItemFromInventoryToEquip((TransferItemFromInventoryToEquipMsg) msg, origin); |
|
|
|
TransferItemFromInventoryToEquip((TransferItemFromInventoryToEquipMsg) msg, origin); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case DELETEOBJECT: |
|
|
|
case DELETEOBJECT: |
|
|
|
deleteItem((DeleteItemMsg) msg, origin); |
|
|
|
DeleteItem((DeleteItemMsg) msg, origin); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case VIEWRESOURCES: |
|
|
|
case VIEWRESOURCES: |
|
|
|
ViewResourcesMessage((ViewResourcesMessage) msg, origin); |
|
|
|
ViewResourcesMessage((ViewResourcesMessage) msg, origin); |
|
|
|