Changed QuestJournal to use SWGMap, Added counter to retrieve_item task types

This commit is contained in:
Waverunner
2014-08-16 11:42:11 -04:00
parent a62a56c868
commit d33d5adbf2
7 changed files with 59 additions and 87 deletions
+2 -33
View File
@@ -54,7 +54,6 @@ public class SWGList<E> implements List<E>, Serializable {
private byte viewType;
private short updateType;
private boolean addByte;
private boolean questMethod;
protected transient Object objectMutex = new Object();
private transient SWGObject object;
@@ -67,14 +66,6 @@ public class SWGList<E> implements List<E>, Serializable {
this.object = object;
}
public SWGList(SWGObject object, int viewType, int updateType, boolean addByte, boolean questMethod) {
this.viewType = (byte) viewType;
this.updateType = (short) updateType;
this.addByte = addByte;
this.object = object;
this.questMethod = questMethod;
}
public void init(SWGObject object) {
objectMutex = new Object();
updateCounter = 0;
@@ -94,19 +85,7 @@ public class SWGList<E> implements List<E>, Serializable {
public boolean add(E e) {
synchronized(objectMutex) {
if (valid(e) && list.add(e)) {
if (!questMethod) queue(item(1, list.lastIndexOf(e), Baseline.toBytes(e), true, true));
else {
List<byte[]> buffer = new ArrayList<byte[]>();
int index = 0;
for (E element : list) {
buffer.add(item(1, index, Baseline.toBytes(element), true, true));
index++;
}
queue(buffer);
return true;
}
queue(item(1, list.lastIndexOf(e), Baseline.toBytes(e), true, true));
return true;
}
@@ -462,17 +441,7 @@ public class SWGList<E> implements List<E>, Serializable {
}
private byte[] item(int type, int index, byte[] data, boolean useIndex, boolean useData) {
if (questMethod) {
int size = data.length;
IoBuffer buffer = Delta.createBuffer(size);
buffer.put(data);
buffer.flip();
updateCounter++;
return buffer.array();
}
int size = 1 + ((useIndex) ? 2 : 0) + ((useData) ? data.length : 0);
IoBuffer buffer = Delta.createBuffer(size);