mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-15 05:13:14 -04:00
Fixed several equipment bugs where stats wouldn't be properly removed or added
Updated engine must be committed for this fix to work - please wait
This commit is contained in:
@@ -12,51 +12,41 @@ def run(core, actor, target, commandString):
|
||||
|
||||
canEquip = core.equipmentService.canEquip(actor, target)
|
||||
|
||||
if target and container and target.getContainer():
|
||||
oldContainer = target.getContainer()
|
||||
|
||||
if container == oldContainer:
|
||||
print 'Error: New container is same as old container.'
|
||||
return;
|
||||
|
||||
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:
|
||||
actor.transferTo(actor, oldContainer, object)
|
||||
|
||||
if target and container and target.getContainer():
|
||||
oldContainer = target.getContainer()
|
||||
if container == oldContainer:
|
||||
print 'Error: New container is same as old container.'
|
||||
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)
|
||||
|
||||
oldContainer.transferTo(actor, container, target)
|
||||
|
||||
if actor == container:
|
||||
if target.getTemplate().find('/wearables/') or target.getTemplate().find('/weapon/'):
|
||||
core.equipmentService.equip(actor, target)
|
||||
for object in replacedObjects:
|
||||
core.equipmentService.unequip(actor, object)
|
||||
#path = 'scripts/' + target.getTemplate().rpartition('/')[0] + '/'
|
||||
#module = target.getTemplate().rpartition('/')[2].replace('shared_', '').replace('.iff', '')
|
||||
#core.scriptService.callScript(path, 'equip', module, core, actor, target)
|
||||
|
||||
if container == actor.getSlottedObject('appearance_inventory'):
|
||||
actor.addObjectToAppearanceEquipList(target)
|
||||
for object in replacedObjects:
|
||||
actor.removeObjectFromAppearanceEquipList(object)
|
||||
|
||||
if oldContainer == actor.getSlottedObject('appearance_inventory'):
|
||||
actor.removeObjectFromAppearanceEquipList(target)
|
||||
|
||||
if actor == oldContainer:
|
||||
if target.getTemplate().find('/wearables/') or target.getTemplate().find('/weapon/'):
|
||||
#path = 'scripts/' + target.getTemplate().rpartition('/')[0] + '/'
|
||||
#module = target.getTemplate().rpartition('/')[2].replace('shared_', '').replace('.iff', '')
|
||||
#core.scriptService.callScript(path, 'unequip', module, core, actor, target)
|
||||
core.equipmentService.unequip(actor, target, replacedObject)
|
||||
oldContainer.transferTo(actor, container, target)
|
||||
|
||||
if oldContainer == actor.getSlottedObject('appearance_inventory'):
|
||||
actor.removeObjectFromAppearanceEquipList(target)
|
||||
|
||||
if container == actor.getSlottedObject('appearance_inventory'):
|
||||
actor.addObjectToAppearanceEquipList(target)
|
||||
|
||||
return
|
||||
|
||||
@@ -2,102 +2,90 @@ import sys
|
||||
from engine.resources.scene import Quaternion
|
||||
|
||||
def setup():
|
||||
return
|
||||
|
||||
return
|
||||
|
||||
def run(core, actor, target, commandString):
|
||||
parsedMsg = commandString.split(' ', 3)
|
||||
objService = core.objectService
|
||||
containerID = long(parsedMsg[1])
|
||||
container = objService.getObject(containerID)
|
||||
actorContainer = actor.getContainer()
|
||||
|
||||
if container == None: return
|
||||
|
||||
if not 'cell' in container.getTemplate() and container.isFull():
|
||||
actor.sendSystemMessage('@container_error_message:container03', 0)
|
||||
return
|
||||
|
||||
if container.getTemplate().startswith("object/tangible/inventory/shared_lightsaber_inventory") or target.getContainer().getTemplate().startswith("object/tangible/inventory/shared_lightsaber_inventory"):
|
||||
core.equipmentService.calculateLightsaberAttributes(actor, target, container)
|
||||
return;
|
||||
parsedMsg = commandString.split(' ', 3)
|
||||
objService = core.objectService
|
||||
containerID = long(parsedMsg[1])
|
||||
container = objService.getObject(containerID)
|
||||
actorContainer = actor.getContainer()
|
||||
|
||||
if container == None: return
|
||||
|
||||
if not 'cell' in container.getTemplate() and container.isFull():
|
||||
actor.sendSystemMessage('@container_error_message:container03', 0)
|
||||
return
|
||||
|
||||
if target.getTemplate() == 'object/tangible/item/shared_loot_cash.iff':
|
||||
core.lootService.handleCreditPickUp(actor,target)
|
||||
if target.getGrandparent().getInventoryItemCount()==1:
|
||||
core.lootService.setLooted(actor,target.getGrandparent())
|
||||
core.objectService.destroyObject(target)
|
||||
return
|
||||
if container.getTemplate().startswith("object/tangible/inventory/shared_lightsaber_inventory") or target.getContainer().getTemplate().startswith("object/tangible/inventory/shared_lightsaber_inventory"):
|
||||
core.equipmentService.calculateLightsaberAttributes(actor, target, container)
|
||||
return;
|
||||
|
||||
if target.getTemplate() == 'object/tangible/item/shared_loot_cash.iff':
|
||||
core.lootService.handleCreditPickUp(actor,target)
|
||||
if target.getGrandparent().getInventoryItemCount()==1:
|
||||
core.lootService.setLooted(actor,target.getGrandparent())
|
||||
core.objectService.destroyObject(target)
|
||||
return
|
||||
|
||||
if target.isLootItem():
|
||||
target.setLootItem(0)
|
||||
actor.sendSystemMessage('You looted ' + target.getObjectName().getStfValue() + ' from corpse.', 0)
|
||||
#actor.sendSystemMessage('container.getInventoryItemCount() %s' % target.getGrandparent().getInventoryItemCount(), 0)
|
||||
if target.getGrandparent().getInventoryItemCount()==1:
|
||||
core.lootService.setLooted(actor,target.getGrandparent())
|
||||
|
||||
if actorContainer != None and (container.getTemplate() == "object/cell/shared_cell.iff") & core.housingService.getPermissions(actor, actorContainer):
|
||||
if target.isLootItem():
|
||||
target.setLootItem(0)
|
||||
actor.sendSystemMessage('You looted ' + target.getObjectName().getStfValue() + ' from corpse.', 0)
|
||||
#actor.sendSystemMessage('container.getInventoryItemCount() %s' % target.getGrandparent().getInventoryItemCount(), 0)
|
||||
if target.getGrandparent().getInventoryItemCount()==1:
|
||||
core.lootService.setLooted(actor,target.getGrandparent())
|
||||
|
||||
if actorContainer != None and (container.getTemplate() == "object/cell/shared_cell.iff") & core.housingService.getPermissions(actor, actorContainer):
|
||||
target.getContainer().transferTo(actor, container, target)
|
||||
core.simulationService.teleport(target, actor.getPosition(), Quaternion(1,0,0,0), containerID)
|
||||
return
|
||||
|
||||
elif target.getContainer().getTemplate() == "object/cell/shared_cell.iff" and core.housingService.getPermissions(actor, target.getContainer()):
|
||||
elif target.getContainer().getTemplate() == "object/cell/shared_cell.iff" and core.housingService.getPermissions(actor, target.getContainer()):
|
||||
target.getContainer().transferTo(actor, container, target)
|
||||
return
|
||||
|
||||
elif actorContainer != None and container.getTemplate() == "object/cell/shared_cell.iff":
|
||||
actor.sendSystemMessage("You do not have permission to access that container!", 0)
|
||||
return
|
||||
elif actorContainer != None and container.getTemplate() == "object/cell/shared_cell.iff":
|
||||
actor.sendSystemMessage("You do not have permission to access that container!", 0)
|
||||
return
|
||||
|
||||
canEquip = core.equipmentService.canEquip(actor, target)
|
||||
canEquip = core.equipmentService.canEquip(actor, target)
|
||||
|
||||
if canEquip[0] is False and container == actor:
|
||||
actor.sendSystemMessage(canEquip[1], 0)
|
||||
return
|
||||
if canEquip[0] is False and container == actor:
|
||||
actor.sendSystemMessage(canEquip[1], 0)
|
||||
return
|
||||
|
||||
|
||||
if target and container and target.getContainer():
|
||||
oldContainer = target.getContainer()
|
||||
|
||||
if container == oldContainer:
|
||||
print 'Error: New container is same as old container.'
|
||||
return;
|
||||
|
||||
if target and container and target.getContainer():
|
||||
oldContainer = target.getContainer()
|
||||
|
||||
if container == oldContainer:
|
||||
print 'Error: New container is same as old container.'
|
||||
return;
|
||||
|
||||
replacedObject = None
|
||||
slotName = None
|
||||
replacedObjects = []
|
||||
replacedObjects = []
|
||||
slotNames = None
|
||||
if actor == container:
|
||||
|
||||
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)
|
||||
|
||||
oldContainer.transferTo(actor, container, target)
|
||||
|
||||
for object in replacedObjects:
|
||||
core.equipmentService.unequip(actor, object)
|
||||
|
||||
if actor == container:
|
||||
if target.getTemplate().find('/wearables/') or target.getTemplate().find('/weapon/'):
|
||||
core.equipmentService.equip(actor, target)
|
||||
|
||||
#path = 'scripts/' + target.getTemplate().rpartition('/')[0] + '/'
|
||||
#module = target.getTemplate().rpartition('/')[2].replace('shared_', '').replace('.iff', '')
|
||||
#core.scriptService.callScript(path, 'equip', module, core, actor, target)
|
||||
if container == actor.getSlottedObject('appearance_inventory'):
|
||||
actor.addObjectToAppearanceEquipList(target)
|
||||
for object in replacedObjects:
|
||||
actor.removeObjectFromAppearanceEquipList(object)
|
||||
if object != None:
|
||||
container.transferTo(actor, container, object)
|
||||
|
||||
oldContainer.transferTo(actor, container, target)
|
||||
|
||||
if oldContainer == actor.getSlottedObject('appearance_inventory'):
|
||||
actor.removeObjectFromAppearanceEquipList(target)
|
||||
|
||||
if container == actor.getSlottedObject('appearance_inventory'):
|
||||
actor.addObjectToAppearanceEquipList(target)
|
||||
|
||||
if actor == oldContainer:
|
||||
if target.getTemplate().find('/wearables/') or target.getTemplate().find('/weapon/'):
|
||||
#path = 'scripts/' + target.getTemplate().rpartition('/')[0] + '/'
|
||||
#module = target.getTemplate().rpartition('/')[2].replace('shared_', '').replace('.iff', '')
|
||||
#core.scriptService.callScript(path, 'unequip', module, core, actor, target)
|
||||
core.equipmentService.unequip(actor, target)
|
||||
|
||||
return
|
||||
return
|
||||
|
||||
@@ -14,8 +14,8 @@ def run(core, actor, target, commandString):
|
||||
if target and container and target.getContainer():
|
||||
oldContainer = target.getContainer()
|
||||
if container == oldContainer:
|
||||
print 'Error: New container is same as old container.'
|
||||
return;
|
||||
print 'Error: New container is same as old container.'
|
||||
return;
|
||||
|
||||
canEquip = core.equipmentService.canEquip(actor, target)
|
||||
|
||||
@@ -25,32 +25,22 @@ def run(core, actor, target, commandString):
|
||||
|
||||
replacedObject = None
|
||||
slotName = None
|
||||
replacedObjects = []
|
||||
replacedObjects = []
|
||||
slotNames = None
|
||||
if actor == container:
|
||||
|
||||
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)
|
||||
|
||||
oldContainer.transferTo(actor, container, target)
|
||||
|
||||
if actor == container:
|
||||
if target.getTemplate().find('/wearables/') or target.getTemplate().find('/weapon/'):
|
||||
core.equipmentService.equip(actor, target)
|
||||
for object in replacedObjects:
|
||||
core.equipmentService.unequip(actor, object)
|
||||
#path = 'scripts/' + target.getTemplate().rpartition('/')[0] + '/'
|
||||
#module = target.getTemplate().rpartition('/')[2].replace('shared_', '').replace('.iff', '')
|
||||
#core.scriptService.callScript(path, 'equip', module, core, actor, target)
|
||||
|
||||
if actor == oldContainer:
|
||||
if target.getTemplate().find('/wearables/') or target.getTemplate().find('/weapon/'):
|
||||
#path = 'scripts/' + target.getTemplate().rpartition('/')[0] + '/'
|
||||
#module = target.getTemplate().rpartition('/')[2].replace('shared_', '').replace('.iff', '')
|
||||
#core.scriptService.callScript(path, 'unequip', module, core, actor, target)
|
||||
core.equipmentService.unequip(actor, target, replacedObject)
|
||||
actor.setWeaponId(target.getObjectID())
|
||||
return
|
||||
|
||||
@@ -166,6 +166,8 @@ public class EquipmentService implements INetworkDispatch {
|
||||
|
||||
if(!actor.getEquipmentList().contains(item.getObjectID()))
|
||||
{
|
||||
if(item instanceof WeaponObject) actor.setWeaponId(item.getObjectID());
|
||||
|
||||
actor.addObjectToEquipList(item);
|
||||
processItemAtrributes(actor, item, true);
|
||||
}
|
||||
@@ -182,6 +184,8 @@ public class EquipmentService implements INetworkDispatch {
|
||||
|
||||
if(actor.getEquipmentList().contains(item.getObjectID()))
|
||||
{
|
||||
if(item instanceof WeaponObject) actor.setWeaponId(actor.getSlottedObject("default_weapon").getObjectID());
|
||||
|
||||
actor.removeObjectFromEquipList(item);
|
||||
processItemAtrributes(actor, item, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user