mirror of
https://github.com/ProjectSWGCore/NGECore2.git
synced 2026-10-11 01:13:05 -04:00
Merge branch 'master' of https://github.com/ProjectSWGCore/NGECore2
Conflicts: src/resources/objects/creature/CreatureMessageBuilder.java src/resources/objects/creature/CreatureObject.java src/services/PlayerService.java
This commit is contained in:
@@ -16,17 +16,22 @@
|
||||
* 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.
|
||||
* 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;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
import main.NGECore;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import resources.objects.creature.CreatureObject;
|
||||
import resources.objects.player.PlayerObject;
|
||||
import engine.resources.common.CRC;
|
||||
import engine.resources.objects.SWGObject;
|
||||
import engine.resources.scene.Point3D;
|
||||
|
||||
public class CharacterSheetResponseMessage extends SWGMessage {
|
||||
|
||||
@@ -34,7 +39,7 @@ public class CharacterSheetResponseMessage extends SWGMessage {
|
||||
public CharacterSheetResponseMessage(PlayerObject player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void deserialize(IoBuffer data) {
|
||||
|
||||
@@ -42,35 +47,63 @@ public class CharacterSheetResponseMessage extends SWGMessage {
|
||||
|
||||
@Override
|
||||
public IoBuffer serialize() {
|
||||
IoBuffer buffer = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putShort((short) 12);
|
||||
buffer.putInt(CRC.StringtoCRC("CharacterSheetResponseMessage"));
|
||||
buffer.putShort((short) 0); //unk
|
||||
buffer.putInt(1); // unk
|
||||
|
||||
|
||||
buffer.putFloat(0); // bind x
|
||||
buffer.putFloat(0); // bind z
|
||||
buffer.putFloat(0); // bind y
|
||||
buffer.putInt(0); // planet
|
||||
|
||||
buffer.putFloat(0); // bank x
|
||||
buffer.putFloat(0); // bank z
|
||||
buffer.putFloat(0); // bank y
|
||||
buffer.put(getAsciiString("tatooine")); // planet
|
||||
|
||||
buffer.putFloat(0); // home x
|
||||
buffer.putFloat(0); // home z
|
||||
buffer.putFloat(0); // home y
|
||||
buffer.putInt(0); // home planet
|
||||
|
||||
if (player.getSpouseName() == null)
|
||||
CreatureObject creature = (CreatureObject) player.getContainer();
|
||||
|
||||
if (creature != null) {
|
||||
|
||||
SWGObject desCloner = null;
|
||||
if (creature.getAttachment("preDesignatedCloner") != null)
|
||||
desCloner = NGECore.getInstance().objectService.getObject((long) creature.getAttachment("preDesignatedCloner"));
|
||||
|
||||
String clonerPlanet = "";
|
||||
String spouse = "";
|
||||
|
||||
if (desCloner != null)
|
||||
clonerPlanet = desCloner.getPlanet().getName();
|
||||
|
||||
if (player.getSpouseName() != null)
|
||||
spouse = player.getSpouseName();
|
||||
|
||||
IoBuffer buffer = IoBuffer.allocate(82 + clonerPlanet.length() + (spouse.length() * 2)).order(ByteOrder.LITTLE_ENDIAN);
|
||||
|
||||
buffer.putShort((short) 12);
|
||||
buffer.putInt(CRC.StringtoCRC("CharacterSheetResponseMessage"));
|
||||
|
||||
buffer.putInt(0);
|
||||
else
|
||||
buffer.put(getUnicodeString(player.getSpouseName())); // spouse name <<<<< CORRECT
|
||||
|
||||
buffer.putInt(10); // lots remaining <<<<<<< CORRECT
|
||||
return buffer.flip();
|
||||
buffer.putInt(0);
|
||||
|
||||
if (desCloner != null) {
|
||||
Point3D loc = desCloner.getPosition();
|
||||
buffer.putFloat(loc.x); // bind x
|
||||
buffer.putFloat(loc.y); // bind z
|
||||
buffer.putFloat(loc.z); // bind y
|
||||
buffer.put(getAsciiString(clonerPlanet)); // bind planet
|
||||
} else {
|
||||
buffer.putFloat(0); // bind x
|
||||
buffer.putFloat(0); // bind z
|
||||
buffer.putFloat(0); // bind y
|
||||
buffer.put(getAsciiString("")); // bind planet
|
||||
}
|
||||
|
||||
buffer.putFloat(0); // bank x
|
||||
buffer.putFloat(0); // bank z
|
||||
buffer.putFloat(0); // bank y
|
||||
buffer.put(getAsciiString("tatooine"));
|
||||
|
||||
buffer.putFloat(0); // home x
|
||||
buffer.putFloat(0); // home z
|
||||
buffer.putFloat(0); // home y
|
||||
buffer.put(getAsciiString("")); // home planet
|
||||
|
||||
buffer.put(getAsciiString("")); // Name of city player resides in
|
||||
|
||||
buffer.put(getUnicodeString(spouse));
|
||||
|
||||
buffer.putInt(10); // lots remaining
|
||||
|
||||
return buffer.flip();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
/*******************************************************************************
|
||||
* 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;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
public class CollectionServerFirstListRequest extends SWGMessage {
|
||||
|
||||
private String server;
|
||||
|
||||
public CollectionServerFirstListRequest() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(IoBuffer data) {
|
||||
data.getShort();
|
||||
data.getInt();
|
||||
setServer(getAsciiString(data));
|
||||
}
|
||||
|
||||
public String getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IoBuffer serialize() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setServer(String server) {
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
/*******************************************************************************
|
||||
* 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;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import main.NGECore;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import services.collections.ServerFirst;
|
||||
import engine.resources.common.CRC;
|
||||
|
||||
public class CollectionServerFirstListResponse extends SWGMessage {
|
||||
|
||||
private Map<String, ServerFirst> sfList;
|
||||
private String server;
|
||||
|
||||
public CollectionServerFirstListResponse(String server, Map<String, ServerFirst> serverFirstList){
|
||||
this.sfList = serverFirstList;
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(IoBuffer data) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IoBuffer serialize() {
|
||||
IoBuffer buffer;
|
||||
|
||||
int size = 0;
|
||||
|
||||
synchronized (sfList) {
|
||||
for (Entry<String, ServerFirst> entry : sfList.entrySet()) {
|
||||
size += entry.getValue().getBytes().length;
|
||||
}
|
||||
|
||||
buffer = IoBuffer.allocate(12 + server.length() + size).order(ByteOrder.LITTLE_ENDIAN);
|
||||
buffer.putShort((short) 2);
|
||||
buffer.putInt(CRC.StringtoCRC("CollectionServerFirstListResponse"));
|
||||
|
||||
buffer.put(getAsciiString(server));
|
||||
buffer.putInt(sfList.size());
|
||||
|
||||
for (Entry<String, ServerFirst> entry : sfList.entrySet()) {
|
||||
buffer.put(entry.getValue().getBytes());
|
||||
|
||||
}
|
||||
return buffer.flip();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,8 +55,9 @@ public class ObjControllerMessage extends SWGMessage {
|
||||
public static final int SHOW_FLY_TEXT = 0x01BD;
|
||||
public static final int START_TASK = 0x448;
|
||||
public static final int ANIMATION = 0x00F2;
|
||||
public static final int BUFF_BUILDER_START = 0x025C;
|
||||
public static final int BUFF_BUILDER_CHANGE = 0x025A;
|
||||
public static final int BUFF_BUILDER_END = 0x025B;
|
||||
public static final int BUFF_BUILDER_START = 0x025C;
|
||||
public static final int UI_PLAY_EFFECT = 0x0401;
|
||||
public static final int SHOW_LOOT_BOX = 0x04BC;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -59,41 +59,30 @@ 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();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
import protocol.swg.ObjControllerMessage;
|
||||
import resources.common.RGB;
|
||||
import resources.common.StringUtilities;
|
||||
|
||||
public class ShowFlyText extends ObjControllerObject {
|
||||
|
||||
@@ -70,6 +71,7 @@ public class ShowFlyText extends ObjControllerObject {
|
||||
this.scale = scale;
|
||||
this.color = color;
|
||||
this.alternativeStructure = true;
|
||||
this.displayType = displayType;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -117,13 +119,16 @@ public class ShowFlyText extends ObjControllerObject {
|
||||
result.putLong(0);
|
||||
result.putLong(0);
|
||||
result.putLong(0);
|
||||
result.put(getUnicodeString(customText));
|
||||
result.putShort(xp);
|
||||
result.put(getUnicodeString(customText)); // %TO?
|
||||
result.putShort(xp); // %DI ?
|
||||
result.putLong(0);
|
||||
result.putFloat(scale);
|
||||
result.put(color.getBytes());
|
||||
result.putInt(displayType);
|
||||
return result.flip();
|
||||
|
||||
result.flip();
|
||||
//StringUtilities.printBytes(result.array());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ package protocol.swg.objectControllerObjects;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.apache.mina.core.buffer.IoBuffer;
|
||||
|
||||
@@ -33,9 +34,15 @@ import resources.common.StringUtilities;
|
||||
public class ShowLootBox extends ObjControllerObject {
|
||||
|
||||
private long playerId;
|
||||
private SWGObject[] rewards;
|
||||
private Vector<SWGObject> rewards;
|
||||
private SWGObject reward;
|
||||
|
||||
public ShowLootBox(long playerId, SWGObject[] rewards) {
|
||||
public ShowLootBox(long playerId, SWGObject reward) {
|
||||
this.playerId = playerId;
|
||||
this.rewards = rewards;
|
||||
}
|
||||
|
||||
public ShowLootBox(long playerId, Vector<SWGObject> rewards) {
|
||||
this.playerId = playerId;
|
||||
this.rewards = rewards;
|
||||
}
|
||||
@@ -47,19 +54,24 @@ public class ShowLootBox extends ObjControllerObject {
|
||||
|
||||
@Override
|
||||
public IoBuffer serialize() {
|
||||
// Controller Type = 11
|
||||
IoBuffer buffer = IoBuffer.allocate(20 + (rewards.length * 8)).order(ByteOrder.LITTLE_ENDIAN);
|
||||
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.length == 1) {
|
||||
if (rewards == null) {
|
||||
buffer.putInt(1);
|
||||
buffer.putLong(rewards[0].getObjectId());
|
||||
buffer.putLong(reward.getObjectId());
|
||||
} else {
|
||||
buffer.putInt(rewards.length);
|
||||
buffer.putInt(rewards.size());
|
||||
for(SWGObject obj : rewards) {
|
||||
buffer.putLong(obj.getObjectID());
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class TargetUpdate extends ObjControllerObject {
|
||||
|
||||
@Override
|
||||
public IoBuffer serialize() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user