Files
NGECore2/scripts/commands/transferitemarmor.py
T
2014-09-08 21:48:30 +01:00

31 lines
910 B
Python

import sys
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;
if oldContainer == actor:
core.equipmentService.unequip(actor, target)
elif oldContainer == actor.getSlottedObject('appearance_inventory'):
core.equipmentService.unequipAppearance(actor, target)
elif container == actor:
core.equipmentService.equip(actor, target)
elif container == actor.getSlottedObject('appearance_inventory'):
core.equipmentService.equipAppearance(actor, target)
else:
oldContainer.transferTo(actor, container, target)
return