Changed CreatureObject to use attribute lists in the baseline

This commit is contained in:
Waverunner
2014-12-15 10:46:59 -05:00
parent f98b183958
commit 4abab8f004
@@ -21,8 +21,6 @@ public class CreatureObject extends TangibleObject {
private Posture posture = Posture.STANDING;
private Race race = Race.HUMAN;
private int attributes = 0;
private int maxAttributes = 0;
private int unmodifiedMaxAtributes = 0;
private int attributeBonus = 0;
private int shockWounds = 0;
@@ -50,24 +48,41 @@ public class CreatureObject extends TangibleObject {
private int cashBalance = 0;
private int bankBalance = 0;
private SWGList<String> skills = new SWGList<String>(BaselineType.CREO, 1, 4, false, StringType.ASCII);
private SWGList<Integer> hamEncumbList = new SWGList<Integer>(BaselineType.CREO, 4, 2);
private SWGList<Equipment> equipmentList = new SWGList<Equipment>(BaselineType.CREO, 6, 15);
private SWGList<Equipment> appearanceList = new SWGList<Equipment>(BaselineType.CREO, 6, 26);
private SWGList<Integer> baseAttributes = new SWGList<Integer>(BaselineType.CREO, 1, 3);
private SWGList<String> skills = new SWGList<String>(BaselineType.CREO, 1, 4, false, StringType.ASCII);
private SWGList<Integer> hamEncumbList = new SWGList<Integer>(BaselineType.CREO, 4, 0); // TODO: UpdateType
private SWGList<Integer> attributes = new SWGList<Integer>(BaselineType.CREO, 6, 0); // TODO: UpdateType
private SWGList<Integer> maxAttributes = new SWGList<Integer>(BaselineType.CREO, 6, 0); // TODO: UpdateType
private SWGList<Equipment> equipmentList = new SWGList<Equipment>(BaselineType.CREO, 6, 0); // TODO: UpdateType
private SWGList<Equipment> appearanceList = new SWGList<Equipment>(BaselineType.CREO, 6, 0); // TODO: UpdateType
public CreatureObject(long objectId) {
super(objectId);
attributes.add(1000); // Health
attributes.add(0);
attributes.add(300); // Action
attributes.add(0);
attributes.add(300); // ??
attributes.add(0);
maxAttributes.addAll(attributes);
baseAttributes.addAll(attributes);
}
public void addEquipment(SWGObject obj) {
if (obj instanceof WeaponObject)
equipmentList.add(new Equipment((WeaponObject) obj));
else
equipmentList.add(new Equipment(obj.getObjectId(), obj.getTemplate()));
synchronized(equipmentList) {
if (obj instanceof WeaponObject)
equipmentList.add(new Equipment((WeaponObject) obj));
else
equipmentList.add(new Equipment(obj.getObjectId(), obj.getTemplate()));
}
}
public void addAppearanceItem(SWGObject obj) {
appearanceList.add(new Equipment(obj.getObjectId(), obj.getTemplate()));
synchronized(appearanceList) {
appearanceList.add(new Equipment(obj.getObjectId(), obj.getTemplate()));
}
}
public SWGList<Equipment> getEquipmentList() {
@@ -98,14 +113,6 @@ public class CreatureObject extends TangibleObject {
return race;
}
public int getAttributes() {
return attributes;
}
public int getMaxAttributes() {
return maxAttributes;
}
public int getUnmodifiedMaxAtributes() {
return unmodifiedMaxAtributes;
}
@@ -222,14 +229,6 @@ public class CreatureObject extends TangibleObject {
this.bankBalance = bankBalance;
}
public void setAttributes(int attributes) {
this.attributes = attributes;
}
public void setMaxAttributes(int maxAttributes) {
this.maxAttributes = maxAttributes;
}
public void setUnmodifiedMaxAtributes(int unmodifiedMaxAtributes) {
this.unmodifiedMaxAtributes = unmodifiedMaxAtributes;
}
@@ -326,6 +325,54 @@ public class CreatureObject extends TangibleObject {
this.beast = beast;
}
public int getHealth() {
return attributes.get(0);
}
public int getMaxHealth() {
return maxAttributes.get(0);
}
public int getBaseHealth() {
return baseAttributes.get(0);
}
public int getAction() {
return attributes.get(2);
}
public int getMaxAction() {
return attributes.get(2);
}
public int getBaseAction() {
return attributes.get(2);
}
public void setHealth(int health) {
synchronized(attributes) {
attributes.set(0, health);
}
}
public void setMaxHealth(int maxHealth) {
synchronized(maxAttributes) {
maxAttributes.set(0, maxHealth);
}
}
public void setAction(int action) {
synchronized(attributes) {
attributes.set(2, action);
}
}
public void setMaxAction(int maxAction) {
synchronized(maxAttributes) {
maxAttributes.set(2, maxAction);
}
}
public void createObject(Player target) {
sendSceneCreateObject(target);
@@ -369,14 +416,7 @@ public class CreatureObject extends TangibleObject {
super.createBaseline1(target, bb);
bb.addInt(cashBalance);
bb.addInt(bankBalance);
bb.addInt(6); // Base HAM Mod List Size (List, Integer)
bb.addInt(0); // update counter
bb.addInt(1000); // Max Health
bb.addInt(0); // ??
bb.addInt(300); // Max Action
bb.addInt(0); // ??
bb.addInt(300); // Max Mind
bb.addInt(0); // ??
bb.addObject(baseAttributes); // Attributes player has without any gear on
bb.addObject(skills);
bb.incremeantOperandCount(4);
@@ -437,22 +477,8 @@ public class CreatureObject extends TangibleObject {
bb.addByte(0); // Mood ID
bb.addInt(0); // Performance Counter
bb.addInt(0); // Performance ID
bb.addInt(6); // Attributes List Size (List, Integer)
bb.addInt(5);
bb.addInt(2363); // Health
bb.addInt(0);
bb.addInt(3050); // Action
bb.addInt(0);
bb.addInt(1000); // ?? it's 300 on new characters
bb.addInt(0);
bb.addInt(6); // Max Attributes List Size (List, Integer)
bb.addInt(5);
bb.addInt(2363); // Health
bb.addInt(0);
bb.addInt(3050); // Action
bb.addInt(0);
bb.addInt(1000); // ?? it's 300 on new characters
bb.addInt(0);
bb.addObject(attributes);
bb.addObject(maxAttributes);
bb.addObject(equipmentList);
bb.addAscii(""); // Appearance (costume)
bb.addBoolean(true); // Visible