mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-05 20:12:51 -04:00
Equipment list now uses ids instead of the referencing the object to avoid storing duplicate objects in the db
This commit is contained in:
@@ -141,14 +141,14 @@ public class CreatureObject extends TangibleObject implements Serializable {
|
||||
@NotPersistent
|
||||
private transient int maxHAMListCounter = 0;
|
||||
|
||||
private SWGList<SWGObject> equipmentList;
|
||||
private SWGList<Long> equipmentList;
|
||||
@NotPersistent
|
||||
private transient int equipmentListUpdateCounter = 0;
|
||||
private SWGList<Buff> buffList = new SWGList<Buff>();
|
||||
@NotPersistent
|
||||
private transient int buffListUpdateCounter = 0;
|
||||
private byte difficulty = 0;
|
||||
private SWGList<SWGObject> appearanceEquipmentList;
|
||||
private SWGList<Long> appearanceEquipmentList;
|
||||
@NotPersistent
|
||||
private transient int appearanceEquipmentListUpdateCounter = 0;
|
||||
|
||||
@@ -197,9 +197,9 @@ public class CreatureObject extends TangibleObject implements Serializable {
|
||||
skillMods = new SWGMap<String, SkillMod>(getObjectID(), 4, 3);
|
||||
abilities = new SWGList<String>(getObjectID(), 4, 14);
|
||||
missionCriticalObjects = new SWGList<MissionCriticalObject>(getObjectID(), 4, 13);
|
||||
equipmentList = new SWGList<SWGObject>(getObjectID(), 6, 0x17);
|
||||
equipmentList = new SWGList<Long>(getObjectID(), 6, 0x17);
|
||||
buffList = new SWGList<Buff>(getObjectID(), 6, 0x1A);
|
||||
appearanceEquipmentList = new SWGList<SWGObject>(getObjectID(), 6, 0x1F);
|
||||
appearanceEquipmentList = new SWGList<Long>(getObjectID(), 6, 0x1F);
|
||||
}
|
||||
|
||||
public CreatureObject() {
|
||||
@@ -214,6 +214,7 @@ public class CreatureObject extends TangibleObject implements Serializable {
|
||||
cooldowns = new ConcurrentHashMap<String, Long>();
|
||||
performanceAudience = new Vector<CreatureObject>();
|
||||
messageBuilder = new CreatureMessageBuilder(this);
|
||||
|
||||
}
|
||||
|
||||
private void loadTemplateData() {
|
||||
@@ -1071,7 +1072,7 @@ public class CreatureObject extends TangibleObject implements Serializable {
|
||||
this.acceptBandflourishes = acceptBandflourishes;
|
||||
}
|
||||
|
||||
public SWGList<SWGObject> getEquipmentList() {
|
||||
public SWGList<Long> getEquipmentList() {
|
||||
synchronized(objectMutex) {
|
||||
return equipmentList;
|
||||
}
|
||||
@@ -1081,7 +1082,7 @@ public class CreatureObject extends TangibleObject implements Serializable {
|
||||
return buffList;
|
||||
}
|
||||
|
||||
public SWGList<SWGObject> getAppearanceEquipmentList() {
|
||||
public SWGList<Long> getAppearanceEquipmentList() {
|
||||
return appearanceEquipmentList;
|
||||
}
|
||||
|
||||
@@ -1097,33 +1098,33 @@ public class CreatureObject extends TangibleObject implements Serializable {
|
||||
|
||||
public void addObjectToEquipList(SWGObject object) {
|
||||
if(object instanceof TangibleObject) {
|
||||
equipmentList.get().add(object);
|
||||
equipmentList.get().add(object.getObjectID());
|
||||
setEquipmentListUpdateCounter(getEquipmentListUpdateCounter() + 1);
|
||||
notifyObservers(messageBuilder.buildAddEquipmentDelta((TangibleObject) object), true);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeObjectFromEquipList(SWGObject object) {
|
||||
if(object instanceof TangibleObject && equipmentList.contains(object)) {
|
||||
if(object instanceof TangibleObject && equipmentList.contains(object.getObjectID())) {
|
||||
setEquipmentListUpdateCounter(getEquipmentListUpdateCounter() + 1);
|
||||
notifyObservers(messageBuilder.buildRemoveEquipmentDelta((TangibleObject) object), true);
|
||||
equipmentList.get().remove(object);
|
||||
equipmentList.get().remove(object.getObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
public void addObjectToAppearanceEquipList(SWGObject object) {
|
||||
if(object instanceof TangibleObject) {
|
||||
appearanceEquipmentList.get().add(object);
|
||||
appearanceEquipmentList.get().add(object.getObjectID());
|
||||
setAppearanceEquipmentListUpdateCounter(getAppearanceEquipmentListUpdateCounter() + 1);
|
||||
notifyObservers(messageBuilder.buildAddAppearanceEquipmentDelta((TangibleObject) object), true);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeObjectFromAppearanceEquipList(SWGObject object) {
|
||||
if(object instanceof TangibleObject && appearanceEquipmentList.contains(object)) {
|
||||
if(object instanceof TangibleObject && appearanceEquipmentList.contains(object.getObjectID())) {
|
||||
setAppearanceEquipmentListUpdateCounter(getAppearanceEquipmentListUpdateCounter() + 1);
|
||||
notifyObservers(messageBuilder.buildRemoveAppearanceEquipmentDelta((TangibleObject) object), true);
|
||||
appearanceEquipmentList.get().remove(object);
|
||||
appearanceEquipmentList.get().remove(object.getObjectID());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user