From 07d0926494e7e8fabfc0f23933e2bf667ed5b01b Mon Sep 17 00:00:00 2001 From: Treeku Date: Tue, 2 Sep 2014 07:47:36 +0100 Subject: [PATCH] Cleaned up transferitemweapon. --- scripts/commands/transferitemweapon.py | 32 ++++---------------------- 1 file changed, 5 insertions(+), 27 deletions(-) diff --git a/scripts/commands/transferitemweapon.py b/scripts/commands/transferitemweapon.py index c2586049..25b9378b 100644 --- a/scripts/commands/transferitemweapon.py +++ b/scripts/commands/transferitemweapon.py @@ -4,41 +4,19 @@ def setup(): return def run(core, actor, target, commandString): - parsedMsg = commandString.split(' ', 3) objService = core.objectService containerID = long(parsedMsg[1]) container = objService.getObject(containerID) + if target and container and target.getContainer(): oldContainer = target.getContainer() + if container == oldContainer: - print 'Error: New container is same as old container.' - return; - - canEquip = core.equipmentService.canEquip(actor, target) - - if canEquip[0] is False and container == actor: - actor.sendSystemMessage(canEquip[1], 0) - return - - replacedObject = None - slotName = None - replacedObjects = [] - slotNames = None - - if actor == container: - slotNames = container.getSlotNamesForObject(target) - - for slotName in slotNames: - object = container.getSlottedObject(slotName) - - if not object in replacedObjects and not object == None: - replacedObjects.append(object) - - if object != None: - container.transferTo(actor, container, object) + print 'Error: New container is same as old container.' + return; oldContainer.transferTo(actor, container, target) return - \ No newline at end of file +