mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-08-01 02:16:15 -04:00
Fixed an issue where attributes weren't being removed when unequipping items. EquipmentList and ApperaranceList are currently broken and will cause crashes when modified, thus when equipping an item in any way will cause a crash. Expect a fix for that from Treeku shortly.
44 lines
1.1 KiB
Python
44 lines
1.1 KiB
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;
|
|
|
|
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)
|
|
|
|
oldContainer.transferTo(actor, container, target)
|
|
|
|
return
|
|
|