Every consumer of the legacy ItemTemplate item_type now reads template.cacheTemplate.getItemType(). Left on the legacy field: the type count in dbItemHandler.LOAD_ITEM_TEMPLATES, which runs before the bridge is linked. The charter checks already read DeedTemplate. Parity (offline, static_item_templates vs the template CObjectIndex.lookup picks, scripts/p14.py, 7586 templates: ITEM 4011, DEED 880, RUNE 2695): 0 differences in item_type. No value changes expected. JSON-Refactor-Plan Task 1.4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
99 lines
3.2 KiB
Java
99 lines
3.2 KiB
Java
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
// Magicbane Emulator Project © 2013 - 2026
|
|
// https://www.magicbane.com
|
|
|
|
package engine.net.client.handlers;
|
|
|
|
import engine.gameManager.DispatchManager;
|
|
import engine.gameManager.NPCManager;
|
|
import engine.mbEnums;
|
|
import engine.mbEnums.DispatchChannel;
|
|
import engine.net.Dispatch;
|
|
import engine.net.client.ClientConnection;
|
|
import engine.net.client.msg.ClientNetMsg;
|
|
import engine.net.client.msg.TransferItemFromBankMsg;
|
|
import engine.net.client.msg.UpdateGoldMsg;
|
|
import engine.objects.CharacterItemManager;
|
|
import engine.objects.Item;
|
|
import engine.objects.PlayerCharacter;
|
|
|
|
public class TransferItemFromBankMsgHandler extends AbstractClientMsgHandler {
|
|
|
|
public TransferItemFromBankMsgHandler() {
|
|
super();
|
|
}
|
|
|
|
@Override
|
|
protected boolean _handleNetMsg(ClientNetMsg baseMsg, ClientConnection origin) {
|
|
|
|
PlayerCharacter player = origin.getPlayerCharacter();
|
|
Dispatch dispatch;
|
|
|
|
if (player == null)
|
|
return true;
|
|
;
|
|
|
|
TransferItemFromBankMsg msg = (TransferItemFromBankMsg) baseMsg;
|
|
|
|
if (!NPCManager.NPCVaultBankRangeCheck(player, origin, "bank"))
|
|
return true;
|
|
;
|
|
|
|
CharacterItemManager itemManager = player.charItemManager;
|
|
|
|
if (itemManager == null)
|
|
return true;
|
|
;
|
|
|
|
int uuid = msg.getUUID();
|
|
|
|
Item item = itemManager.getItemByUUID(uuid);
|
|
|
|
if (item == null)
|
|
return true;
|
|
;
|
|
|
|
//dupe check
|
|
// WTF Checking but not logging?
|
|
|
|
if (!item.validForBank(origin, player, itemManager))
|
|
return true;
|
|
;
|
|
|
|
if (item.containerType == mbEnums.ItemContainerType.BANK && itemManager.isBankOpen() == false)
|
|
return true;
|
|
;
|
|
|
|
if (item.template.cacheTemplate.getItemType().equals(mbEnums.ItemType.GOLD)) {
|
|
|
|
if (!itemManager.moveGoldToInventory(item, msg.getNumItems()))
|
|
return true;
|
|
;
|
|
|
|
UpdateGoldMsg goldMes = new UpdateGoldMsg(player);
|
|
goldMes.configure();
|
|
|
|
dispatch = Dispatch.borrow(player, goldMes);
|
|
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
|
|
|
return true;
|
|
}
|
|
|
|
// Not gold, process update here
|
|
|
|
if (!itemManager.hasRoomInventory(item.template.item_wt))
|
|
return true;
|
|
|
|
if (itemManager.moveItemToInventory(item) == false)
|
|
return true;
|
|
|
|
dispatch = Dispatch.borrow(player, msg);
|
|
DispatchManager.dispatchMsgDispatch(dispatch, DispatchChannel.SECONDARY);
|
|
return true;
|
|
}
|
|
|
|
} |