Handler created for DeleteItemMsg

This commit is contained in:
2024-03-29 04:46:45 -04:00
parent 162a049f30
commit 8083f39ba1
3 changed files with 70 additions and 37 deletions
@@ -92,39 +92,6 @@ public class ClientMessagePump implements NetMsgHandler {
DispatchMessage.dispatchMsgToInterestArea(pc, rwss, DispatchChannel.PRIMARY, MBServerStatics.CHARACTER_LOAD_RANGE, true, false);
}
private static void DeleteItem(DeleteItemMsg msg, ClientConnection origin) {
CharacterItemManager itemManager = origin.getPlayerCharacter().charItemManager;
int uuid = msg.getUUID();
PlayerCharacter sourcePlayer = origin.getPlayerCharacter();
if (sourcePlayer == null)
return;
if (!sourcePlayer.isAlive())
return;
Item i = Item.getFromCache(msg.getUUID());
if (i == null)
return;
if (!itemManager.doesCharOwnThisItem(i.getObjectUUID()))
return;
if (!itemManager.inventoryContains(i))
return;
if (i.isCanDestroy())
if (itemManager.delete(i) == true) {
Dispatch dispatch = Dispatch.borrow(sourcePlayer, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
}
}
private static void ackBankWindowOpened(AckBankWindowOpenedMsg msg, ClientConnection origin) {
// According to the Wiki, the client should not send this message.
// Log the instance to investigate, and modify Wiki accordingly.
@@ -761,9 +728,6 @@ public class ClientMessagePump implements NetMsgHandler {
case IGNORE:
((IgnoreMsg) msg).handleRequest(origin);
break;
case DELETEOBJECT:
DeleteItem((DeleteItemMsg) msg, origin);
break;
case VIEWRESOURCES:
ViewResourcesMessage((ViewResourcesMessage) msg, origin);
break;