From d7ee79c04d0bfc6223dd168532c21cf25947f373 Mon Sep 17 00:00:00 2001 From: Mads Boddum Date: Mon, 2 Jan 2017 16:25:31 +0100 Subject: [PATCH] Fixed being unable to equip items outside of buildings --- src/resources/commands/callbacks/TransferItemCallback.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/resources/commands/callbacks/TransferItemCallback.java b/src/resources/commands/callbacks/TransferItemCallback.java index d19694b38..071ace392 100644 --- a/src/resources/commands/callbacks/TransferItemCallback.java +++ b/src/resources/commands/callbacks/TransferItemCallback.java @@ -31,6 +31,7 @@ package resources.commands.callbacks; import intents.chat.ChatBroadcastIntent; import resources.Race; import resources.commands.ICmdCallback; +import resources.control.Assert; import resources.objects.GameObjectType; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; @@ -88,6 +89,8 @@ public class TransferItemCallback implements ICmdCallback { SWGObject appearanceInventory = actor.getSlottedObject("appearance_inventory"); + Assert.notNull(appearanceInventory); + // TODO move check to CommandService. There's an in-combat boolean column in the command table! // You can't equip or unequip non-weapon equipment whilst in combat if (!weapon && actor.isInCombat() && ((newContainer.equals(actor) || oldContainer.equals(actor)) || (newContainer.equals(appearanceInventory) || oldContainer.equals(appearanceInventory)))) { @@ -102,7 +105,9 @@ public class TransferItemCallback implements ICmdCallback { } // We can't transfer an item into an appearance-equipped container! - if (newContainer.getParent().equals(appearanceInventory)) { + SWGObject containerParent = newContainer.getParent(); + + if (containerParent != null && containerParent.equals(appearanceInventory)) { // Don't be fooled - the message below contains no prose keys new ChatBroadcastIntent(player, "@container_error_message:container34_prose").broadcast(); return;