Buff Windows now close, changed formula used for stats on inspiration buffs, minor changes overall to entertainer

This commit is contained in:
Waverunner
2014-03-16 13:01:30 -04:00
parent fae3847b64
commit 97f4db58d1
12 changed files with 565 additions and 262 deletions
@@ -6,28 +6,26 @@ import java.util.Vector;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.ObjControllerOpcodes;
import resources.common.StringUtilities;
import resources.objects.BuffItem;
public class BuffBuilderChangeMessage extends ObjControllerObject {
private boolean accepted;
private int buffCost;
private int time;
private long bufferId;
private int buffRecipientAccepted;
private long buffRecipientId;
private long objectId;
private long bufferId;
private long buffRecipientId;
private boolean accepted;
private int buffRecipientAccepted;
private Vector<BuffItem> statBuffs = new Vector<BuffItem>();
private int time;
public BuffBuilderChangeMessage() {
}
public BuffBuilderChangeMessage(long objectId, long bufferId, long buffRecipientId, Vector<BuffItem> statBuffs) {
this.objectId = objectId;
this.bufferId = bufferId;
@@ -35,136 +33,135 @@ public class BuffBuilderChangeMessage extends ObjControllerObject {
this.statBuffs = statBuffs;
}
@Override
public void deserialize(IoBuffer buffer) {
setObjectId(buffer.getLong());
buffer.getInt();
setBufferId(buffer.getLong());
setBuffRecipientId(buffer.getLong());
setTime(buffer.getInt());
setBuffCost(buffer.getInt());
byte value = buffer.get();
public void deserialize(IoBuffer data) {
setObjectId(data.getLong());
data.getInt();
setBufferId(data.getLong());
setBuffRecipientId(data.getLong());
setTime(data.getInt());
setBuffCost(data.getInt());
byte value = data.get();
if (value == (byte) 0)
setAccepted(false);
else if (value == (byte) 1)
setAccepted(true);
setBuffRecipientAccepted(buffer.getInt());
int statSize = buffer.getInt();
setBuffRecipientAccepted(data.getInt());
int statSize = data.getInt();
for (int i = 0; i < statSize; i++) {
BuffItem item = new BuffItem();
String statName = getAsciiString(buffer);
String statName = getAsciiString(data);
item.setSkillName(statName);
int investedPoints = buffer.getInt();
int investedPoints = data.getInt();
item.setInvested(investedPoints);
int maxAmount = buffer.getInt();
item.setBonusAmount(maxAmount);
int entBonus = data.getInt();
item.setEntertainerBonus(entBonus);
statBuffs.add(item);
System.out.println("Added buff item with " + investedPoints + " invested points " + " which has a bonus amount of " + maxAmount);
}
}
@Override
public IoBuffer serialize() {
IoBuffer result = IoBuffer.allocate(65 + statBuffs.size()).order(ByteOrder.LITTLE_ENDIAN);
result.setAutoExpand(true);
result.putInt(ObjControllerMessage.BUFF_BUILDER_CHANGE);
result.putLong(objectId);
result.putInt(0);
result.putLong(bufferId);
result.putLong(buffRecipientId);
result.putInt(time);
result.putInt(buffCost);
result.put((byte) ((accepted) ? 1 : 0));
result.putInt(buffRecipientAccepted);
result.putInt(statBuffs.size());
if (!statBuffs.isEmpty()) {
for (BuffItem item : statBuffs) {
result.put(getAsciiString(item.getSkillName()));
result.putInt(item.getInvested());
result.putInt(item.getBonusAmount());
}
}
return result.flip();
}
public int getBuffCost() {
return buffCost;
}
public void setBuffCost(int buffCost) {
this.buffCost = buffCost;
}
public int getTime() {
return time;
}
public void setTime(int time) {
this.time = time;
}
public long getObjectId() {
return objectId;
}
public void setObjectId(long objectId) {
this.objectId = objectId;
}
public long getBufferId() {
return bufferId;
}
public void setBufferId(long bufferId) {
this.bufferId = bufferId;
}
public long getBuffRecipientId() {
return buffRecipientId;
}
public void setBuffRecipientId(long buffRecipientId) {
this.buffRecipientId = buffRecipientId;
}
public boolean getAccepted() {
return accepted;
}
public void setAccepted(boolean accepted) {
this.accepted = accepted;
public int getBuffCost() {
return buffCost;
}
public long getBufferId() {
return bufferId;
}
public int getBuffRecipientAccepted() {
return buffRecipientAccepted;
}
public void setBuffRecipientAccepted(int buffRecipientAccepted) {
this.buffRecipientAccepted = buffRecipientAccepted;
public long getBuffRecipientId() {
return buffRecipientId;
}
public long getObjectId() {
return objectId;
}
public Vector<BuffItem> getStatBuffs() {
return statBuffs;
}
public int getTime() {
return time;
}
@Override
public IoBuffer serialize() {
IoBuffer result = IoBuffer.allocate(65 + statBuffs.size()).order(ByteOrder.LITTLE_ENDIAN);
result.setAutoExpand(true);
result.putInt(ObjControllerMessage.BUFF_BUILDER_CHANGE);
result.putLong(objectId);
result.putInt(0);
result.putLong(bufferId);
result.putLong(buffRecipientId);
result.putInt(time);
result.putInt(buffCost);
result.put((byte) ((accepted) ? 1 : 0));
result.putInt(buffRecipientAccepted);
result.putInt(statBuffs.size());
if (!statBuffs.isEmpty()) {
for (BuffItem item : statBuffs) {
result.put(getAsciiString(item.getSkillName()));
result.putInt(item.getInvested());
result.putInt(item.getEntertainerBonus());
}
}
return result.flip();
}
public void setAccepted(boolean accepted) {
this.accepted = accepted;
}
public void setBuffCost(int buffCost) {
this.buffCost = buffCost;
}
public void setBufferId(long bufferId) {
this.bufferId = bufferId;
}
public void setBuffRecipientAccepted(int buffRecipientAccepted) {
this.buffRecipientAccepted = buffRecipientAccepted;
}
public void setBuffRecipientId(long buffRecipientId) {
this.buffRecipientId = buffRecipientId;
}
public void setObjectId(long objectId) {
this.objectId = objectId;
}
public void setStatBuffs(Vector<BuffItem> statBuffs) {
this.statBuffs = statBuffs;
}
public void setTime(int time) {
this.time = time;
}
}