Merge remote-tracking branch 'origin/master' into Wave_Missions

Conflicts:
	src/main/NGECore.java
	src/protocol/swg/chat/ChatFriendsListUpdate.java
	src/services/MissionService.java
This commit is contained in:
Waverunner
2014-04-19 18:33:02 -04:00
2227 changed files with 51521 additions and 59628 deletions
@@ -26,7 +26,6 @@ import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import protocol.swg.SWGMessage;
public class Animation extends ObjControllerObject {
@@ -45,7 +44,7 @@ public class Animation extends ObjControllerObject {
@Override
public IoBuffer serialize() {
IoBuffer result = IoBuffer.allocate(36).order(ByteOrder.LITTLE_ENDIAN);
IoBuffer result = IoBuffer.allocate(20 + animation.length()).order(ByteOrder.LITTLE_ENDIAN);
result.putInt(ObjControllerMessage.ANIMATION);
@@ -0,0 +1,61 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.objectControllerObjects;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
public class BiographyUpdate extends ObjControllerObject {
private long objectId;
private long targetObjectId;
private String biography;
public BiographyUpdate(long objectId, long targetObjectId, String biography) {
this.objectId = objectId;
this.biography = biography;
this.targetObjectId = targetObjectId;
}
@Override
public void deserialize(IoBuffer data) {
}
@Override
public IoBuffer serialize() {
IoBuffer buffer = IoBuffer.allocate(28 + (biography.length() * 2)).order(ByteOrder.LITTLE_ENDIAN);
buffer.putInt(0x000001DB);
buffer.putLong(objectId); // requester
buffer.putInt(0);
buffer.putLong(targetObjectId);
buffer.put(getUnicodeString(biography));
return buffer.flip();
}
}
@@ -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,130 @@ 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);
item.setSkillName(statName);
int investedPoints = buffer.getInt();
item.setInvested(investedPoints);
int maxAmount = buffer.getInt();
item.setBonusAmount(maxAmount);
item.setSkillName(getAsciiString(data));
item.setInvested(data.getInt());
item.setEntertainerBonus(data.getInt());
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;
}
}
@@ -0,0 +1,197 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.objectControllerObjects;
import java.nio.ByteOrder;
import java.util.Vector;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.objects.BuffItem;
public class BuffBuilderEndMessage extends ObjControllerObject {
private boolean accepted;
private int buffCost;
private long bufferId;
private int buffRecipientAccepted;
private long buffRecipientId;
private long objectId;
private Vector<BuffItem> statBuffs = new Vector<BuffItem>();
private int time;
public BuffBuilderEndMessage() {
}
public BuffBuilderEndMessage(BuffBuilderEndMessage endMessage) {
this.buffCost = endMessage.getBuffCost();
this.time = endMessage.getTime();
this.accepted = endMessage.getAccepted();
this.buffRecipientAccepted = endMessage.getBuffRecipientAccepted();
this.statBuffs = endMessage.getStatBuffs();
}
public BuffBuilderEndMessage(BuffBuilderChangeMessage changeMessage) {
this.buffRecipientId = changeMessage.getBuffRecipientId();
this.bufferId = changeMessage.getBufferId();
this.buffCost = changeMessage.getBuffCost();
this.time = changeMessage.getTime();
this.accepted = changeMessage.getAccepted();
this.buffRecipientAccepted = changeMessage.getBuffRecipientAccepted();
this.statBuffs = changeMessage.getStatBuffs();
}
@Override
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(data.getInt());
int statSize = data.getInt();
for (int i = 0; i < statSize; i++) {
BuffItem item = new BuffItem();
String statName = getAsciiString(data);
item.setSkillName(statName);
int investedPoints = data.getInt();
item.setInvested(investedPoints);
int entBonus = data.getInt();
item.setEntertainerBonus(entBonus);
statBuffs.add(item);
}
}
public boolean getAccepted() {
return accepted;
}
public int getBuffCost() {
return buffCost;
}
public long getBufferId() {
return bufferId;
}
public int getBuffRecipientAccepted() {
return 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_END);
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;
}
}
@@ -21,12 +21,8 @@
******************************************************************************/
package protocol.swg.objectControllerObjects;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import engine.resources.common.Utilities;
public class ChangeRoleIconChoice extends ObjControllerObject {
private long objectId = 0;
@@ -33,9 +33,9 @@ public class CombatSpam extends ObjControllerObject{
private long attackerId;
private long defenderId;
private int damage;
private String file;
private String text;
private byte colorFlag;
//private String file;
//private String text;
//private byte colorFlag;
private boolean hit = true;
private boolean critical = false;
private boolean dodge = false;
@@ -0,0 +1,361 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.objectControllerObjects;
import java.nio.ByteOrder;
import java.util.Vector;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.IDAttribute;
public class ImageDesignMessage extends ObjControllerObject {
private long designerId;
private long targetId;
private long objectId;
private byte unkByte;
private String hair;
private String unk;
private int sessionId;
private int moneyDemanded;
private int moneyOffered;
private boolean designerCommited;
private boolean customerAccepted;
private byte flagStatMigration;
private int bodyFormSkill1;
private int faceFormSkill1;
private int bodyFormSkill2;
private int faceFormSkill2;
private String holoEmote;
private Vector<IDAttribute> bodyAttributes;
private Vector<IDAttribute> colorAttributes;
private boolean endMessage;
public ImageDesignMessage() { }
public ImageDesignMessage(long objectId, long designerId, long targetId) {
this.objectId = objectId;
this.designerId = designerId;
this.targetId = targetId;
}
@Override
public void deserialize(IoBuffer data) {
setObjectId(data.getLong());
data.getInt();
setDesignerId(data.getLong());
setTargetId(data.getLong());
data.getLong(); // tent id
setUnkByte(data.get());
setHair(getAsciiString(data));
setUnk(getAsciiString(data));
data.getInt(); // timer
setSessionId(data.getInt());
setMoneyDemanded(data.getInt());
setMoneyOffered(data.getInt());
setDesignerCommited((boolean) ((data.get() == 1) ? true : false));
setCustomerAccepted((boolean) ((data.getInt() == 1) ? true : false));
setBodyFormSkill1(data.getInt());
setFaceFormSkill1(data.getInt());
setBodyFormSkill2(data.getInt());
setFaceFormSkill2(data.getInt());
int bodyAttributesSize = data.getInt();
if (bodyAttributesSize > 0) {
Vector<IDAttribute> bodyAttributes = new Vector<IDAttribute>();
for (int i = 0; i < bodyAttributesSize; i++) {
IDAttribute atr = new IDAttribute();
atr.setName(getAsciiString(data));
atr.setFloatValue(data.getFloat());
bodyAttributes.add(atr);
}
setBodyAttributes(bodyAttributes);
}
int colorAttributesSize = data.getInt();
if (colorAttributesSize > 0) {
Vector<IDAttribute> colorAttributes = new Vector<IDAttribute>();
for (int i = 0; i < colorAttributesSize; i++) {
IDAttribute atr = new IDAttribute();
atr.setName(getAsciiString(data));
atr.setValue(data.getInt());
colorAttributes.add(atr);
}
setColorAttributes(colorAttributes);
}
setHoloEmote(getAsciiString(data));
}
@Override
public IoBuffer serialize() {
IoBuffer buffer = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN);
buffer.setAutoExpand(true);
if (endMessage)
buffer.putInt(ObjControllerMessage.IMAGE_DESIGN_END);
else
buffer.putInt(ObjControllerMessage.IMAGE_DESIGN_CHANGE);
buffer.putLong(objectId);
buffer.putInt(0);
buffer.putLong(designerId);
buffer.putLong(targetId);
buffer.putLong(0); // tent id
buffer.put(unkByte);
if (hair != null)
buffer.put(getAsciiString(hair));
else
buffer.putShort((short) 0);
if (unk != null)
buffer.put(getAsciiString(unk));
else
buffer.putShort((short) 0);
buffer.putInt(0); // timer
buffer.putInt(sessionId);
buffer.putInt(moneyDemanded);
buffer.putInt(moneyOffered);
buffer.put((byte) ((designerCommited) ? 1 : 0));
buffer.putInt((int) ((customerAccepted) ? 1 : 0));
buffer.putInt(bodyFormSkill1);
buffer.putInt(faceFormSkill1);
buffer.putInt(bodyFormSkill2);
buffer.putInt(faceFormSkill2);
if(bodyAttributes != null && bodyAttributes.size() > 0) {
buffer.putInt(bodyAttributes.size());
for (IDAttribute atr : bodyAttributes) {
buffer.put(getAsciiString(atr.getName()));
buffer.putFloat(atr.getFloatValue());
}
} else {
buffer.putInt(0);
}
if (colorAttributes != null && colorAttributes.size() > 0) {
buffer.putInt(colorAttributes.size());
for (IDAttribute atr : colorAttributes) {
buffer.put(getAsciiString(atr.getName()));
buffer.putInt(atr.getValue());
}
} else {
buffer.putInt(0);
}
if (holoEmote != null)
buffer.put(getAsciiString(holoEmote));
else
buffer.putShort((short) 0);
return buffer.flip();
}
public long getDesignerId() {
return designerId;
}
public void setDesignerId(long designerId) {
this.designerId = designerId;
}
public long getTargetId() {
return targetId;
}
public void setTargetId(long targetId) {
this.targetId = targetId;
}
public long getObjectId() {
return objectId;
}
public void setObjectId(long objectId) {
this.objectId = objectId;
}
public byte getUnkByte() {
return unkByte;
}
public void setUnkByte(byte unkByte) {
this.unkByte = unkByte;
}
public String getHair() {
return hair;
}
public void setHair(String hair) {
this.hair = hair;
}
public String getUnk() {
return unk;
}
public void setUnk(String unk) {
this.unk = unk;
}
public int getSessionId() {
return sessionId;
}
public void setSessionId(int sessionId) {
this.sessionId = sessionId;
}
public int getMoneyDemanded() {
return moneyDemanded;
}
public void setMoneyDemanded(int moneyDemanded) {
this.moneyDemanded = moneyDemanded;
}
public int getMoneyOffered() {
return moneyOffered;
}
public void setMoneyOffered(int moneyOffered) {
this.moneyOffered = moneyOffered;
}
public boolean isDesignerCommited() {
return designerCommited;
}
public void setDesignerCommited(boolean designerCommited) {
this.designerCommited = designerCommited;
}
public boolean isCustomerAccepted() {
return customerAccepted;
}
public void setCustomerAccepted(boolean customerAccepted) {
this.customerAccepted = customerAccepted;
}
public byte getFlagStatMigration() {
return flagStatMigration;
}
public void setFlagStatMigration(byte flagStatMigration) {
this.flagStatMigration = flagStatMigration;
}
public int getBodyFormSkill1() {
return bodyFormSkill1;
}
public void setBodyFormSkill1(int bodyFormSkill1) {
this.bodyFormSkill1 = bodyFormSkill1;
}
public int getFaceFormSkill1() {
return faceFormSkill1;
}
public void setFaceFormSkill1(int faceFormSkill1) {
this.faceFormSkill1 = faceFormSkill1;
}
public int getBodyFormSkill2() {
return bodyFormSkill2;
}
public void setBodyFormSkill2(int bodyFormSkill2) {
this.bodyFormSkill2 = bodyFormSkill2;
}
public int getFaceFormSkill2() {
return faceFormSkill2;
}
public void setFaceFormSkill2(int faceFormSkill2) {
this.faceFormSkill2 = faceFormSkill2;
}
public String getHoloEmote() {
return holoEmote;
}
public void setHoloEmote(String holoEmote) {
this.holoEmote = holoEmote;
}
public Vector<IDAttribute> getBodyAttributes() {
return bodyAttributes;
}
public void setBodyAttributes(Vector<IDAttribute> bodyAttributes) {
this.bodyAttributes = bodyAttributes;
}
public Vector<IDAttribute> getColorAttributes() {
return colorAttributes;
}
public void setColorAttributes(Vector<IDAttribute> colorAttributes) {
this.colorAttributes = colorAttributes;
}
public boolean isEndMessage() {
return endMessage;
}
public void setEndMessage(boolean endMessage) {
this.endMessage = endMessage;
}
}
@@ -0,0 +1,61 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.objectControllerObjects;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
public class ImageDesignStartMessage extends ObjControllerObject {
private long objectId;
private long designer;
private long target;
public ImageDesignStartMessage(long objectId, long designer, long target) {
this.designer = designer;
this.target = target;
this.objectId = objectId;
}
@Override
public void deserialize(IoBuffer data) {
}
@Override
public IoBuffer serialize() {
IoBuffer buffer = IoBuffer.allocate(46).order(ByteOrder.LITTLE_ENDIAN);
buffer.putInt(ObjControllerMessage.IMAGE_DESIGN_START);
buffer.putLong(objectId);
buffer.putInt(0);
buffer.putLong(designer);
buffer.putLong(target);
buffer.putLong(0);
buffer.putShort((short) 0);
return buffer.flip();
}
}
@@ -21,11 +21,8 @@
******************************************************************************/
package protocol.swg.objectControllerObjects;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.Console;
import resources.common.StringUtilities;
@@ -0,0 +1,58 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.objectControllerObjects;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.OutOfBand;
public class NpcConversationMessage extends ObjControllerObject {
private long objectId;
private OutOfBand outOfBand;
public NpcConversationMessage(long objectId, OutOfBand outOfBand) {
this.objectId = objectId;
this.outOfBand = outOfBand;
outOfBand.setHeaderBytes(2);
}
@Override
public void deserialize(IoBuffer data) {
}
@Override
public IoBuffer serialize() {
IoBuffer outOfBandBuffer = outOfBand.serialize();
IoBuffer buffer = IoBuffer.allocate(16 + outOfBandBuffer.array().length).order(ByteOrder.LITTLE_ENDIAN);
buffer.putInt(ObjControllerMessage.CONVERSATION_MESSAGE);
buffer.putLong(objectId);
buffer.putInt(0);
buffer.put(outOfBandBuffer.array());
return buffer.flip();
}
}
@@ -0,0 +1,65 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.objectControllerObjects;
import java.nio.ByteOrder;
import java.util.Vector;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.ConversationOption;
import resources.objects.Delta;
public class NpcConversationOptions extends ObjControllerObject {
private long objectId;
private Vector<ConversationOption> conversationOptions = new Vector<ConversationOption>();
public NpcConversationOptions(long objectId) {
this.objectId = objectId;
}
@Override
public void deserialize(IoBuffer data) {
}
public void addOption(ConversationOption option) {
conversationOptions.add(option);
}
@Override
public IoBuffer serialize() {
IoBuffer buffer = IoBuffer.allocate(17).order(ByteOrder.LITTLE_ENDIAN);
buffer.setAutoExpand(true);
buffer.putInt(ObjControllerMessage.CONVERSATION_OPTIONS);
buffer.putLong(objectId);
buffer.putInt(0);
buffer.put((byte) conversationOptions.size());
for (ConversationOption option : conversationOptions) {
option.getOutOfBand().setHeaderBytes(2);
buffer.put(option.getOutOfBand().serialize().array());
}
return Delta.resizeBuffer(buffer);
}
}
@@ -59,41 +59,31 @@ public class ObjectMenuResponse extends ObjControllerObject {
@Override
public IoBuffer serialize() {
int size = 37;
byte counter = 0;
IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN);
result.setAutoExpand(true);
for (RadialOptions radialOption : radialOptions) {
size += 5 + getUnicodeString(radialOption.getDescription()).length;
}
IoBuffer result = IoBuffer.allocate(size).order(ByteOrder.LITTLE_ENDIAN);
result.putInt(ObjControllerMessage.OBJECT_MENU_RESPONSE);
result.putLong(ownerId);
result.putInt(0);
result.putLong(targetId);
result.putLong(ownerId);
int size = radialOptions.size();
result.putInt(size);
if(size > 0) {
byte counter = 0;
for(RadialOptions radialOption : radialOptions) {
result.put(++counter);
result.put(radialOption.getParentId());
result.putShort(radialOption.getOptionId());
//result.put(radialOption.getOptionType());
result.put((byte) 3);
if(radialOption.getDescription().length() > 0)
result.put(getUnicodeString(radialOption.getDescription()));
else
result.putInt(0);
}
result.putInt(radialOptions.size());
for (RadialOptions radialOption : radialOptions) {
result.put(++counter);
result.put(radialOption.getParentId());
result.putShort(radialOption.getOptionId());
//result.put(radialOption.getOptionType());
result.put((byte) 3);
result.put(getUnicodeString(radialOption.getDescription()));
}
result.put(radialCount);
int packetSize = result.position();
result = IoBuffer.allocate(packetSize).put(result.array(), 0, packetSize);
return result.flip();
}
}
@@ -47,9 +47,9 @@ public class Posture extends ObjControllerObject {
result.putInt(ObjControllerMessage.POSTURE);
result.putLong(objectId);
result.putInt(0); //unk
result.putInt(0); // tick count ?
result.put((byte) posture);
result.put((byte) 0);
result.put((byte) 0); // seen also as 1
return result.flip();
}
@@ -1,3 +1,24 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.objectControllerObjects;
import java.nio.ByteOrder;
@@ -27,8 +48,7 @@ public class SecureTrade extends ObjControllerObject{
@Override
public IoBuffer serialize() {
IoBuffer result = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN);
result.setAutoExpand(true);
IoBuffer result = IoBuffer.allocate(40).order(ByteOrder.LITTLE_ENDIAN);
result.putInt(ObjControllerMessage.SPACIAL_CHAT);
result.putInt(1);
@@ -0,0 +1,60 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.objectControllerObjects;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import org.apache.mina.core.buffer.IoBuffer;
public class SetProfessionTemplate extends ObjControllerObject {
private String profession;
@Override
public void deserialize(IoBuffer data) {
data.getLong();
data.getInt();
short size = data.getShort();
try {
profession = new String(ByteBuffer.allocate(size).put(data.array(), data.position(), size).array(), "US-ASCII");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
data.position(data.position() + size);
}
@Override
public IoBuffer serialize() {
// TODO Auto-generated method stub
return null;
}
public String getProfession() {
return profession;
}
public void setProfession(String profession) {
this.profession = profession;
}
}
@@ -26,50 +26,28 @@ import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.OutOfBand;
import resources.common.RGB;
import resources.common.Stf;
public class ShowFlyText extends ObjControllerObject {
private long recieverId;
private long receiverId;
private long objectId;
private int unknownInt1;
private short unknownShort1;
private byte unknownByte1;
private int unknownInt2;
private String stfFile;
private String stfString;
private short xp;
private Stf stf;
private OutOfBand outOfBand;
private float scale;
private RGB color;
private int displayType;
private boolean alternativeStructure;
private String customText;
public ShowFlyText(long recieverId, long objectId, String stfFile, String stfString, float scale, RGB color, int displayType) {
this.recieverId = recieverId;
public ShowFlyText(long receiverId, long objectId, String stf, OutOfBand outOfBand, float scale, RGB color, int displayType) {
this.receiverId = receiverId;
this.objectId = objectId;
this.stfFile = stfFile;
this.stfString = stfString;
this.stf = new Stf(stf);
this.outOfBand = outOfBand;
this.scale = scale;
this.color = color;
this.displayType = displayType;
this.alternativeStructure = false;
}
public ShowFlyText(long recieverId, long objectId, int unknownInt1, int unknownShort1, int unknownByte1, int unknownInt2, String stfFile, String stfString, String customText, int xp, float scale, RGB color, int displayType) {
this.recieverId = recieverId;
this.objectId = objectId;
this.unknownInt1 = unknownInt1;
this.unknownShort1 = (short) unknownShort1;
this.unknownByte1 = (byte) unknownByte1;
this.unknownInt2 = unknownInt2;
this.stfFile = stfFile;
this.stfString = stfString;
this.customText = customText;
this.xp = (short) xp;
this.scale = scale;
this.color = color;
this.alternativeStructure = true;
}
@Override
@@ -80,51 +58,20 @@ public class ShowFlyText extends ObjControllerObject {
@Override
public IoBuffer serialize() {
if (!alternativeStructure) {
IoBuffer result = IoBuffer.allocate(47 + stfFile.length() + stfString.length()).order(ByteOrder.LITTLE_ENDIAN);
result.setAutoExpand(true);
result.putInt(ObjControllerMessage.SHOW_FLY_TEXT);
result.putLong(recieverId);
result.putInt(0);
result.putLong(objectId);
result.put(getAsciiString(stfFile));
result.putInt(0);
result.put(getAsciiString(stfString));
result.putInt(0);
result.putFloat(scale);
result.put(color.getBytes());
result.putInt(displayType);
return result.flip();
} else {
IoBuffer result = IoBuffer.allocate(124 + stfFile.length() + stfString.length()).order(ByteOrder.LITTLE_ENDIAN);
result.setAutoExpand(true);
result.putInt(ObjControllerMessage.SHOW_FLY_TEXT);
result.putLong(recieverId);
result.putInt(0);
result.putLong(objectId);
result.putLong(0);
result.putInt(unknownInt1);
result.putShort(unknownShort1);
result.put(unknownByte1);
result.putInt(unknownInt2);
result.put(getAsciiString(stfFile));
result.putInt(0);
result.put(getAsciiString(stfString));
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.putLong(0);
result.put(getUnicodeString(customText));
result.putShort(xp);
result.putLong(0);
result.putFloat(scale);
result.put(color.getBytes());
result.putInt(displayType);
return result.flip();
}
IoBuffer outOfBandBuffer = outOfBand.serialize();
IoBuffer result = IoBuffer.allocate(35 + outOfBandBuffer.array().length).order(ByteOrder.LITTLE_ENDIAN);
result.setAutoExpand(true);
result.putInt(ObjControllerMessage.SHOW_FLY_TEXT);
result.putLong(receiverId);
result.putInt(0);
result.putLong(objectId);
result.put(stf.getBytes());
result.put(outOfBandBuffer.array());
result.putFloat(scale);
result.put(color.getBytes());
result.putInt(displayType);
result.flip();
return result;
}
}
@@ -0,0 +1,80 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.objectControllerObjects;
import java.nio.ByteOrder;
import java.util.Vector;
import org.apache.mina.core.buffer.IoBuffer;
import engine.resources.objects.SWGObject;
import protocol.swg.ObjControllerMessage;
public class ShowLootBox extends ObjControllerObject {
private long playerId;
private Vector<SWGObject> rewards;
private SWGObject reward;
public ShowLootBox(long playerId, SWGObject reward) {
this.playerId = playerId;
this.reward = reward;
}
public ShowLootBox(long playerId, Vector<SWGObject> rewards) {
this.playerId = playerId;
this.rewards = rewards;
}
@Override
public void deserialize(IoBuffer data) {
}
@Override
public IoBuffer serialize() {
IoBuffer buffer;
if (rewards != null)
buffer = IoBuffer.allocate(20 + (rewards.size() * 8)).order(ByteOrder.LITTLE_ENDIAN);
else
buffer = IoBuffer.allocate(28).order(ByteOrder.LITTLE_ENDIAN);
buffer.putInt(ObjControllerMessage.SHOW_LOOT_BOX);
buffer.putLong(playerId);
buffer.putInt(0); // 1 for a black background on icon, 0 or 2 for transparent (default)
if (rewards == null) {
buffer.putInt(1);
buffer.putLong(reward.getObjectId());
} else {
buffer.putInt(rewards.size());
for(SWGObject obj : rewards) {
buffer.putLong(obj.getObjectID());
}
}
return buffer.flip();
}
}
@@ -26,12 +26,12 @@ import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.OutOfBand;
@SuppressWarnings("unused")
public class SpatialChat extends ObjControllerObject {
private long audienceId;
private long destinationId;
private long sourceId;
private long targetId;
private String chatMessage;
@@ -40,15 +40,19 @@ public class SpatialChat extends ObjControllerObject {
private short balloonType = 1;
private short chatType;
private short moodId;
private byte languageId = 1;
private OutOfBand outOfBand;
public SpatialChat(long sourceId, long targetId, String chatMessage, short chatType, short moodId) {
public SpatialChat(long destinationId, long sourceId, long targetId, String chatMessage, short chatType, short moodId, int languageId, OutOfBand outOfBand) {
try {
this.audienceId = sourceId;
this.destinationId = destinationId;
this.sourceId = sourceId;
this.targetId = targetId;
this.chatMessage = chatMessage;
this.chatType = chatType;
this.moodId = moodId;
this.languageId = (byte) languageId;
this.outOfBand = ((outOfBand == null) ? new OutOfBand() : outOfBand);
/*String[] chatMessageParse = chatMessage.split(" ", 6);
@@ -62,19 +66,20 @@ public class SpatialChat extends ObjControllerObject {
}
}
public void setDestinationId(long audienceId) {
this.audienceId = audienceId;
public void setDestinationId(long destinationId) {
this.destinationId = destinationId;
}
public void deserialize(IoBuffer data) {
}
public IoBuffer serialize() {
IoBuffer result = IoBuffer.allocate(55 + chatMessage.length() * 2).order(ByteOrder.LITTLE_ENDIAN);
outOfBand.setHeaderBytes(2);
IoBuffer outOfBandBuffer = outOfBand.serialize();
IoBuffer result = IoBuffer.allocate(51 + (chatMessage.length() * 2) + outOfBandBuffer.array().length).order(ByteOrder.LITTLE_ENDIAN);
result.putInt(ObjControllerMessage.SPACIAL_CHAT);
result.putLong(audienceId);
result.putLong(destinationId);
result.putInt(0);
result.putLong(sourceId);
result.putLong(targetId);
@@ -83,11 +88,9 @@ public class SpatialChat extends ObjControllerObject {
result.putShort((short) 0x32);
result.putShort(chatType);
result.putShort(moodId);
result.put((byte) 1);
result.put(languageId);
result.putInt(0);
result.putInt(0);
result.put(outOfBandBuffer.array());
return result.flip();
}
@@ -0,0 +1,62 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.objectControllerObjects;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
public class StartNpcConversation extends ObjControllerObject {
private long npcId;
private long objectId;
public StartNpcConversation(long objectId, long npcId) {
this.objectId = objectId;
this.npcId = npcId;
}
@Override
public void deserialize(IoBuffer data) {
// TODO Auto-generated method stub
}
@Override
public IoBuffer serialize() {
IoBuffer buffer = IoBuffer.allocate(31).order(ByteOrder.LITTLE_ENDIAN);
buffer.putInt(ObjControllerMessage.START_CONVERSATION);
buffer.putLong(objectId);
buffer.putInt(0);
buffer.putLong(npcId);
buffer.putInt(0);
buffer.putShort((short) 0);
buffer.put((byte) 0);
return buffer.flip();
}
}
@@ -0,0 +1,66 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.objectControllerObjects;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
public class StopNpcConversation extends ObjControllerObject {
private long npcId;
private long objectId;
private String stfFile;
private String stfLabel;
public StopNpcConversation(long objectId, long npcId, String stfFile, String stfLabel) {
this.objectId = objectId;
this.npcId = npcId;
this.stfFile = stfFile;
this.stfLabel = stfLabel;
}
@Override
public void deserialize(IoBuffer data) {
// TODO Auto-generated method stub
}
@Override
public IoBuffer serialize() {
IoBuffer buffer = IoBuffer.allocate(40 + stfFile.length() + stfLabel.length()).order(ByteOrder.LITTLE_ENDIAN);
buffer.putInt(ObjControllerMessage.STOP_CONVERSATION);
buffer.putLong(objectId);
buffer.putInt(0);
buffer.putLong(npcId);
buffer.put(getAsciiString(stfFile));
buffer.putInt(0);
buffer.put(getAsciiString(stfLabel));
buffer.putLong(0);
return buffer.flip();
}
}
@@ -39,7 +39,7 @@ public class TargetUpdate extends ObjControllerObject {
@Override
public IoBuffer serialize() {
// TODO Auto-generated method stub
return null;
}
@@ -0,0 +1,60 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.objectControllerObjects;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
public class UiPlayEffect extends ObjControllerObject {
private long objectId;
private String uiString;
public UiPlayEffect(long objectId, String uiString) {
this.uiString = uiString;
this.objectId = objectId;
}
@Override
public void deserialize(IoBuffer data) {
// TODO Auto-generated method stub
}
@Override
public IoBuffer serialize() {
IoBuffer result = IoBuffer.allocate(26 + uiString.length()).order(ByteOrder.LITTLE_ENDIAN);
result.putInt(ObjControllerMessage.UI_PLAY_EFFECT);
result.putLong(objectId);
result.putInt(0);
result.putLong(objectId);
result.put(getAsciiString(uiString));
return result.flip();
}
}