mirror of
https://github.com/ProjectSWGCore/Holocore.git
synced 2026-10-05 20:13:20 -04:00
Fixed CREO equipment and SWGObject.removeObject
This commit is contained in:
@@ -163,7 +163,7 @@ public abstract class SWGObject extends BaselineObject implements Comparable<SWG
|
||||
// This object is a container object, so remove it from the container
|
||||
if (object.getSlotArrangement() == -1) {
|
||||
synchronized (containedObjects) {
|
||||
containedObjects.remove(object.objectId);
|
||||
containedObjects.remove(object);
|
||||
}
|
||||
} else {
|
||||
for (String slot : (slotArrangement == -1 ?
|
||||
@@ -250,7 +250,6 @@ public abstract class SWGObject extends BaselineObject implements Comparable<SWG
|
||||
for (String slotName : getArrangement().get(arrangementId - 4)) {
|
||||
SWGObject equippedItem = container.getSlottedObject(slotName);
|
||||
if (equippedItem != null) {
|
||||
Log.d("SWGObject", "Moving %s into inventory %s", equippedItem, container.getSlottedObject("inventory"));
|
||||
equippedItem.moveToContainer(requester, container.getSlottedObject("inventory"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,6 @@ import resources.collections.SWGSet;
|
||||
import resources.network.BaselineBuilder;
|
||||
import resources.network.NetBuffer;
|
||||
import resources.network.NetBufferStream;
|
||||
import resources.objects.GameObjectType;
|
||||
import resources.objects.SWGObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import resources.objects.tangible.TangibleObject;
|
||||
@@ -87,52 +86,30 @@ public class CreatureObject extends TangibleObject {
|
||||
@Override
|
||||
public void addObject(SWGObject obj) {
|
||||
super.addObject(obj);
|
||||
if (isEquipment(obj.getGameObjectType())) {
|
||||
if (getArrangementId(obj) != -1 && !(obj instanceof PlayerObject)) {
|
||||
addEquipment(obj);
|
||||
if (obj instanceof WeaponObject && defaultWeapon != null && !obj.equals(defaultWeapon))
|
||||
removeEquipment(defaultWeapon);
|
||||
if (obj instanceof WeaponObject && defaultWeapon != null && !obj.equals(defaultWeapon)) {
|
||||
removeObject(defaultWeapon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeObject(SWGObject obj) {
|
||||
super.removeObject(obj);
|
||||
if (isEquipment(obj.getGameObjectType())) {
|
||||
if (getArrangementId(obj) != -1 && !(obj instanceof PlayerObject)) {
|
||||
removeEquipment(obj);
|
||||
if (obj instanceof WeaponObject && defaultWeapon != null && !obj.equals(defaultWeapon))
|
||||
addEquipment(defaultWeapon);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isEquipment(GameObjectType type) {
|
||||
switch (type.getMask()) {
|
||||
case GOTM_ARMOR:
|
||||
case GOTM_CLOTHING:
|
||||
case GOTM_CYBERNETIC:
|
||||
case GOTM_JEWELRY:
|
||||
case GOTM_TOOL:
|
||||
case GOTM_WEAPON:
|
||||
return true;
|
||||
case GOTM_MISC:
|
||||
switch (type) {
|
||||
case GOT_MISC_CONTAINER:
|
||||
case GOT_MISC_CONTAINER_PUBLIC:
|
||||
case GOT_MISC_CONTAINER_SHIP_LOOT:
|
||||
case GOT_MISC_CONTAINER_WEARABLE:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
if (obj instanceof WeaponObject && defaultWeapon != null && !obj.equals(defaultWeapon)) {
|
||||
addObject(defaultWeapon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addEquipment(SWGObject obj) {
|
||||
private void addEquipment(SWGObject obj) {
|
||||
creo6.addEquipment(obj, this);
|
||||
}
|
||||
|
||||
public void removeEquipment(SWGObject obj) {
|
||||
private void removeEquipment(SWGObject obj) {
|
||||
creo6.removeEquipment(obj, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -390,7 +390,6 @@ public class CharacterCreationService extends Service {
|
||||
hairObj.setAppearanceData(customization);
|
||||
|
||||
hairObj.moveToContainer(creatureObj); // hair slot
|
||||
creatureObj.addEquipment(hairObj);
|
||||
}
|
||||
|
||||
private void setCreatureObjectValues(ObjectManager objManager, CreatureObject creatureObj, ClientCreateCharacter create) {
|
||||
@@ -434,7 +433,6 @@ public class CharacterCreationService extends Service {
|
||||
return;
|
||||
// Move the new item to the player's clothing slots and add to equipment list
|
||||
item.moveToContainer(player, player);
|
||||
player.addEquipment(item);
|
||||
}
|
||||
|
||||
SWGObject inventory = player.getSlottedObject("inventory");
|
||||
|
||||
Reference in New Issue
Block a user