mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-09-11 21:45:43 -04:00
Cleaned up transferitemweapon.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user