mirror of
https://github.com/ProjectSWGCore/Holocore.git
synced 2026-09-11 21:45:26 -04:00
Removed unnecessary packets and created CoreManager
This commit is contained in:
@@ -1,40 +0,0 @@
|
||||
package network.packets.swg;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
||||
public class ErrorMessage extends SWGPacket {
|
||||
public static final int CRC = 0xB5ABF91A;
|
||||
private String type;
|
||||
private String message;
|
||||
private boolean fatal;
|
||||
|
||||
public ErrorMessage() {
|
||||
|
||||
}
|
||||
|
||||
public ErrorMessage(String type, String message, boolean fatal) {
|
||||
this.type = type;
|
||||
this.message = message;
|
||||
this.fatal = fatal;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
type = getAscii(data);
|
||||
message = getAscii(data);
|
||||
fatal = getBoolean(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 11 + type.length() + message.length();
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 3);
|
||||
addInt( data, CRC);
|
||||
addAscii(data, type);
|
||||
addAscii(data, message);
|
||||
addBoolean(data, fatal);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package network.packets.swg;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
||||
public class ServerUnixEpochTime extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x24B73893;
|
||||
private int time = 0;
|
||||
|
||||
public ServerUnixEpochTime() {
|
||||
|
||||
}
|
||||
|
||||
public ServerUnixEpochTime(int time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
time = getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(10);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addInt( data, time);
|
||||
return data;
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
return time;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package network.packets.swg.login;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class AccountFeatureBits extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x979F0279;
|
||||
|
||||
public AccountFeatureBits() {
|
||||
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
// Not sure how to decode this.. still a mystery
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(22);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addInt( data, 0x025C8231);
|
||||
addInt( data, 1);
|
||||
addInt( data, 6);
|
||||
addInt( data, 0x4EEAC08A);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package network.packets.swg.login;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class CharacterCreationDisabled extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xF4A15265;
|
||||
|
||||
private String [] serverNames = new String[0];
|
||||
|
||||
public CharacterCreationDisabled() {
|
||||
|
||||
}
|
||||
|
||||
public CharacterCreationDisabled(String [] serverNames) {
|
||||
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
int listSize = getInt(data);
|
||||
serverNames = new String[listSize];
|
||||
for (int i = 0; i < listSize; i++) {
|
||||
serverNames[i] = getAscii(data);
|
||||
}
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 10;
|
||||
for (int i = 0; i < serverNames.length; i++)
|
||||
length += 2 + serverNames[i].length();
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addInt( data, serverNames.length);
|
||||
for (int i = 0; i < serverNames.length; i++) {
|
||||
addAscii(data, serverNames[i]);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public String [] getServerNames() {
|
||||
return serverNames;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package network.packets.swg.login;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class ClientIdMsg extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xD5899226;
|
||||
private byte [] sessionKey;
|
||||
private String version;
|
||||
|
||||
public ClientIdMsg() {
|
||||
this(new byte[0], "");
|
||||
}
|
||||
|
||||
public ClientIdMsg(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public ClientIdMsg(byte [] sessionKey, String version) {
|
||||
this.sessionKey = sessionKey;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
int sessionKeyLength = getInt(data);
|
||||
sessionKey = new byte[sessionKeyLength];
|
||||
data.get(sessionKey);
|
||||
version = getAscii(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(10 + sessionKey.length + version.length());
|
||||
addShort(data, 4);
|
||||
addInt( data, CRC);
|
||||
addInt( data, sessionKey.length);
|
||||
data.put(sessionKey);
|
||||
addAscii(data, version);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package network.packets.swg.login;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class ClientPermissionsMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xE00730E5;
|
||||
|
||||
public ClientPermissionsMessage() {
|
||||
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
getByte(data); // 1
|
||||
getByte(data); // 1
|
||||
getByte(data); // 0
|
||||
getByte(data); // 1
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(10);
|
||||
addShort(data, 5);
|
||||
addInt( data, CRC);
|
||||
addByte( data, 1);
|
||||
addByte( data, 1);
|
||||
addByte( data, 0);
|
||||
addByte( data, 1);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
package network.packets.swg.login;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Vector;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class EnumerateCharacterId extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x65EA4574;
|
||||
|
||||
private SWGCharacter [] characters;
|
||||
|
||||
public EnumerateCharacterId() {
|
||||
characters = new SWGCharacter[0];
|
||||
}
|
||||
|
||||
public EnumerateCharacterId(SWGCharacter [] characters) {
|
||||
this.characters = characters;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
int characterLength = getInt(data);
|
||||
Vector <SWGCharacter> _characters = new Vector<SWGCharacter>();
|
||||
for (int i = 0; i < characterLength; i++) {
|
||||
SWGCharacter c = new SWGCharacter();
|
||||
c.decode(data);
|
||||
_characters.add(c);
|
||||
}
|
||||
characters = _characters.toArray(new SWGCharacter[0]);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 10;
|
||||
for (int i = 0; i < characters.length; i++) {
|
||||
length += characters[i].getLength();
|
||||
}
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addInt( data, characters.length);
|
||||
for (SWGCharacter c : characters) {
|
||||
data.put(c.encode().array());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public SWGCharacter [] getCharacters () {
|
||||
return characters;
|
||||
}
|
||||
|
||||
public static class SWGCharacter extends EnumerateCharacterId {
|
||||
private String name;
|
||||
private int raceCrc;
|
||||
private long id;
|
||||
private int galaxyId;
|
||||
private int status;
|
||||
|
||||
public SWGCharacter() {
|
||||
|
||||
}
|
||||
|
||||
public SWGCharacter(String name, int raceCrc, long id, int galaxyId, int status) {
|
||||
this.name = name;
|
||||
this.raceCrc = raceCrc;
|
||||
this.id = id;
|
||||
this.galaxyId = galaxyId;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public int getLength() {
|
||||
return 24 + name.length() * 2;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
name = getUnicode(data);
|
||||
raceCrc = getInt(data);
|
||||
id = getLong(data);
|
||||
galaxyId = getInt(data);
|
||||
status = getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(getLength());
|
||||
addUnicode(data, name);
|
||||
addInt( data, raceCrc);
|
||||
addLong( data, id);
|
||||
addInt( data, galaxyId);
|
||||
addInt( data, status);
|
||||
return data;
|
||||
}
|
||||
|
||||
public long getId() { return id; }
|
||||
public String getName() { return name; }
|
||||
public int getRaceCrc() { return raceCrc; }
|
||||
public int getGalaxyId() { return galaxyId; }
|
||||
public int getStatus() { return status; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package network.packets.swg.login;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class LoginClientId extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x41131F96;
|
||||
private String username;
|
||||
private String password;
|
||||
private String version;
|
||||
|
||||
public LoginClientId() {
|
||||
this("", "", "");
|
||||
}
|
||||
|
||||
public LoginClientId(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public LoginClientId(String username, String password, String version) {
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
username = getAscii(data);
|
||||
password = getAscii(data);
|
||||
version = getAscii(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 6 + 6 + username.length() * 2 + password.length() * 2 + version.length() * 2;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 4);
|
||||
addInt( data, CRC);
|
||||
addAscii(data, username);
|
||||
addAscii(data, password);
|
||||
addAscii(data, version);
|
||||
return data;
|
||||
}
|
||||
|
||||
public String getUsername() { return username; }
|
||||
public String getPassword() { return password; }
|
||||
public String getVersion() { return version; }
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package network.packets.swg.login;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class LoginClientToken extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xAAB296C6;
|
||||
private byte [] sessionKey;
|
||||
private int userId;
|
||||
private String username;
|
||||
|
||||
public LoginClientToken() {
|
||||
|
||||
}
|
||||
|
||||
public LoginClientToken(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public LoginClientToken(byte [] sessionKey, int userId, String username) {
|
||||
this.sessionKey = sessionKey;
|
||||
this.userId = userId;
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
int sessionKeyLength = getInt(data);
|
||||
if (sessionKeyLength > data.remaining())
|
||||
return;
|
||||
sessionKey = new byte[sessionKeyLength];
|
||||
data.get(sessionKey);
|
||||
userId = getInt(data);
|
||||
username = getAscii(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 16 + sessionKey.length + username.length();
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 4);
|
||||
addInt( data, CRC);
|
||||
addInt( data, sessionKey.length);
|
||||
data.put(sessionKey);
|
||||
addInt( data, userId);
|
||||
addAscii(data, username);
|
||||
return data;
|
||||
}
|
||||
|
||||
public byte [] getSessionKey() {
|
||||
return sessionKey;
|
||||
}
|
||||
|
||||
public int getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
package network.packets.swg.login;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
import resources.Galaxy;
|
||||
|
||||
|
||||
public class LoginClusterStatus extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x3436AEB6;
|
||||
|
||||
private Vector <Galaxy> galaxies;
|
||||
|
||||
public LoginClusterStatus() {
|
||||
galaxies = new Vector<Galaxy>();
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
int serverCount = getInt(data);
|
||||
for (int i = 0; i < serverCount; i++) {
|
||||
Galaxy g = new Galaxy();
|
||||
g.setId(getInt(data));
|
||||
g.setAddress(getAscii(data));
|
||||
getInt(data); // Server Port and Ping Port (blah!)
|
||||
getInt(data); // Spacer of some kind.. always 0xFFFFFFFF
|
||||
g.setPopulation(getInt(data));
|
||||
g.setMaxCharacters(getInt(data));
|
||||
g.setDistance(getInt(data));
|
||||
g.setStatus(getInt(data));
|
||||
g.setRecommended(getBoolean(data));
|
||||
getInt(data);
|
||||
getInt(data);
|
||||
galaxies.add(g);
|
||||
}
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 10;
|
||||
for (Galaxy g : galaxies)
|
||||
length += 35 + g.getAddress().length() + 8;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addInt( data, galaxies.size());
|
||||
for (Galaxy g : galaxies) {
|
||||
addInt( data, g.getId());
|
||||
addAscii( data, g.getAddress());
|
||||
addShort( data, 44463);
|
||||
addShort( data, 44462);
|
||||
addInt( data, g.getPopulation());
|
||||
//addInt( data, 0xFFFFFFFF);
|
||||
/*
|
||||
* Very Light = 0
|
||||
* Light = 300
|
||||
* Medium = 600
|
||||
* Heavy = 900
|
||||
* Very Heavy = 1200
|
||||
* Extreamly Heavy = 1500
|
||||
* Full = 3000
|
||||
*/
|
||||
addInt( data, 0); // Very Light
|
||||
addInt( data, g.getMaxCharacters());
|
||||
addInt( data, g.getDistance());
|
||||
addInt( data, g.getStatus());
|
||||
addBoolean(data, g.isRecommended());
|
||||
data.put(new byte[] { (byte)0xC4, 0x09, 0, 0, (byte)0xFA, 0, 0, 0});
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public void addGalaxy(Galaxy g) {
|
||||
galaxies.add(g);
|
||||
}
|
||||
|
||||
public List <Galaxy> getGalaxies() {
|
||||
return galaxies;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package network.packets.swg.login;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
import resources.Galaxy;
|
||||
|
||||
|
||||
public class LoginEnumCluster extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xC11C63B9;
|
||||
|
||||
private Vector <Galaxy> galaxies;
|
||||
private int maxCharacters;
|
||||
|
||||
public LoginEnumCluster() {
|
||||
galaxies = new Vector<Galaxy>();
|
||||
}
|
||||
|
||||
public LoginEnumCluster(int maxCharacters) {
|
||||
galaxies = new Vector<Galaxy>();
|
||||
this.maxCharacters = maxCharacters;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
int serverCount = getInt(data);
|
||||
for (int i = 0; i < serverCount; i++) {
|
||||
int id = getInt(data);
|
||||
String name = getAscii(data);
|
||||
int distance = getInt(data); // Distance - UNUSED
|
||||
Galaxy g = new Galaxy(id, name, "127.0.0.1", 0, 0, distance, 2);
|
||||
galaxies.add(g);
|
||||
}
|
||||
maxCharacters = getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 14;
|
||||
for (Galaxy g : galaxies)
|
||||
length += 10 + g.getName().length();
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 3);
|
||||
addInt( data, CRC);
|
||||
addInt( data, galaxies.size());
|
||||
for (Galaxy g : galaxies) {
|
||||
addInt( data, g.getId());
|
||||
addAscii(data, g.getName());
|
||||
//addInt( data, g.getDistance());
|
||||
addInt( data, 0xFFFF8F80);
|
||||
}
|
||||
addInt(data, maxCharacters);
|
||||
return data;
|
||||
}
|
||||
|
||||
public void addGalaxy(Galaxy g) {
|
||||
galaxies.add(g);
|
||||
}
|
||||
|
||||
public int getMaxCharacters() {
|
||||
return maxCharacters;
|
||||
}
|
||||
|
||||
public List <Galaxy> getGalaxies() {
|
||||
return galaxies;
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
package network.packets.swg.login;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class OfflineServersMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xF41A5265;
|
||||
|
||||
private List <String> offlineServers;
|
||||
|
||||
public OfflineServersMessage() {
|
||||
offlineServers = new ArrayList<String>();
|
||||
}
|
||||
|
||||
public OfflineServersMessage(List <String> offline) {
|
||||
this.offlineServers = offline;
|
||||
}
|
||||
|
||||
public OfflineServersMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
int listCount = getInt(data);
|
||||
offlineServers = new ArrayList<String>(listCount);
|
||||
for (int i = 0 ; i < listCount; i++)
|
||||
offlineServers.add(getAscii(data));
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int strLength = 0;
|
||||
for (String str : offlineServers)
|
||||
strLength += 2 + str.length();
|
||||
ByteBuffer data = ByteBuffer.allocate(10 + strLength);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
for (String str : offlineServers)
|
||||
addAscii(data, str);
|
||||
return data;
|
||||
}
|
||||
|
||||
public List <String> getOfflineServers() {
|
||||
return offlineServers;
|
||||
}
|
||||
|
||||
public void setOfflineServers(List <String> offline) {
|
||||
offlineServers = offline;
|
||||
}
|
||||
|
||||
public void addOflineServer(String offline) {
|
||||
offlineServers.add(offline);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package network.packets.swg.login;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class RequestExtendedClusters extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x8E33ED05;
|
||||
|
||||
public RequestExtendedClusters() {
|
||||
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(10);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addInt( data, 0);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package network.packets.swg.login;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class ServerId extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x58C07F21;
|
||||
private int serverId = 0;
|
||||
|
||||
public ServerId() {
|
||||
|
||||
}
|
||||
|
||||
public ServerId(int id) {
|
||||
this.serverId = id;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
serverId = getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(10);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addInt( data, serverId);
|
||||
return data;
|
||||
}
|
||||
|
||||
public int getServerId() {
|
||||
return serverId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package network.packets.swg.login;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class ServerString extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x0E20D7E9;
|
||||
private String serverName = "";
|
||||
|
||||
public ServerString() {
|
||||
|
||||
}
|
||||
|
||||
public ServerString(String name) {
|
||||
this.serverName = name;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
serverName = getAscii(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(8 + serverName.length());
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addAscii(data, serverName);
|
||||
return data;
|
||||
}
|
||||
|
||||
public String getServerString() {
|
||||
return serverName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package network.packets.swg.login;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class StationIdHasJediSlot extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xCC9FCCF8;
|
||||
|
||||
private int jedi;
|
||||
|
||||
public StationIdHasJediSlot() {
|
||||
this.jedi = 1;
|
||||
}
|
||||
|
||||
public StationIdHasJediSlot(int jedi) {
|
||||
this.jedi = jedi;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
jedi = getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(10);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addInt( data, jedi);
|
||||
return data;
|
||||
}
|
||||
|
||||
public int getJediSlot() {
|
||||
return jedi;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package network.packets.swg.login.creation;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class ApproveNameRequest extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x9EB04B9F;
|
||||
private String race = "";
|
||||
private String name = "";
|
||||
|
||||
public ApproveNameRequest() {
|
||||
|
||||
}
|
||||
|
||||
public ApproveNameRequest(String race, String name) {
|
||||
this.race = race;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
race = getAscii(data);
|
||||
name = getUnicode(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(10 + race.length() + name.length() * 2);
|
||||
addShort( data, 4);
|
||||
addInt( data, CRC);
|
||||
addAscii( data, race);
|
||||
addUnicode(data, name);
|
||||
return data;
|
||||
}
|
||||
|
||||
public String getRace() { return race; }
|
||||
public String getName() { return name; }
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package network.packets.swg.login.creation;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class ApproveNameResponse extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x9B2C6BA7;
|
||||
private String name = "";
|
||||
|
||||
public ApproveNameResponse() {
|
||||
|
||||
}
|
||||
|
||||
public ApproveNameResponse(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
name = getUnicode(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(33 + name.length() * 2);
|
||||
addShort( data, 9);
|
||||
addInt( data, CRC);
|
||||
addUnicode(data, name);
|
||||
addAscii( data, "ui");
|
||||
addInt( data, 0);
|
||||
addAscii( data, "name_approved");
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
package network.packets.swg.login.creation;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class ClientCreateCharacter extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xB97F3074;
|
||||
private byte [] charCustomization = new byte[0];
|
||||
private String name = "";
|
||||
private String race = "";
|
||||
private String start = "";
|
||||
private String hair = "";
|
||||
private byte [] hairCustomization = new byte[0];
|
||||
private String clothes = "";
|
||||
private float height = 0;
|
||||
private boolean tutorial = false;
|
||||
private String profession = "";
|
||||
private String startingPhase = "";
|
||||
|
||||
public ClientCreateCharacter() {
|
||||
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
charCustomization = getArray(data);
|
||||
name = getUnicode(data);
|
||||
race = getAscii(data);
|
||||
start = getAscii(data);
|
||||
hair = getAscii(data);
|
||||
hairCustomization = getArray(data);
|
||||
clothes = getAscii(data);
|
||||
byte b = getByte(data);
|
||||
height = getFloat(data);
|
||||
String str = getUnicode(data);
|
||||
tutorial = getBoolean(data);
|
||||
profession = getAscii(data);
|
||||
startingPhase = getAscii(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int extraSize = charCustomization.length;
|
||||
extraSize += name.length()*2;
|
||||
extraSize += race.length() + start.length();
|
||||
extraSize += hair.length() + hairCustomization.length;
|
||||
extraSize += clothes.length() + profession.length();
|
||||
extraSize += startingPhase.length();
|
||||
ByteBuffer data = ByteBuffer.allocate(36+extraSize);
|
||||
addShort(data, 2);
|
||||
addInt (data, CRC);
|
||||
addArray(data, charCustomization);
|
||||
addUnicode(data, name);
|
||||
addAscii(data, race);
|
||||
addAscii(data, start);
|
||||
addAscii(data, hair);
|
||||
addArray(data, hairCustomization);
|
||||
addAscii(data, clothes);
|
||||
addByte (data, 0);
|
||||
addFloat(data, height);
|
||||
addUnicode(data, "");
|
||||
addBoolean(data, tutorial);
|
||||
addAscii (data, profession);
|
||||
addAscii (data, startingPhase);
|
||||
return data;
|
||||
}
|
||||
|
||||
public byte [] getCharCustomization() { return charCustomization; }
|
||||
public String getName() { return name; }
|
||||
public String getRace() { return race; }
|
||||
public String getStartLocation() { return start; }
|
||||
public String getHair() { return hair; }
|
||||
public byte [] getHairCustomization() { return hairCustomization; }
|
||||
public String getClothes() { return clothes; }
|
||||
public float getHeight() { return height; }
|
||||
public boolean isTutorial() { return tutorial; }
|
||||
public String getProfession() { return profession; }
|
||||
public String getStartingPhase() { return startingPhase; }
|
||||
|
||||
public void setCharCustomization(byte [] data) { this.charCustomization = data; }
|
||||
public void setName(String name) { this.name = name; }
|
||||
public String getStart() { return start; }
|
||||
public void setStart(String start) { this.start = start; }
|
||||
public void setRace(String race) { this.race = race; }
|
||||
public void setHair(String hair) { this.hair = hair; }
|
||||
public void setHairCustomization(byte [] hairCustomization) { this.hairCustomization = hairCustomization; }
|
||||
public void setClothes(String clothes) { this.clothes = clothes; }
|
||||
public void setHeight(float height) { this.height = height; }
|
||||
public void setTutorial(boolean tutorial) { this.tutorial = tutorial; }
|
||||
public void setProfession(String profession) { this.profession = profession; }
|
||||
public void setStartingPhase(String startingPhase) { this.startingPhase = startingPhase; }
|
||||
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
package network.packets.swg.login.creation;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class CreateCharacterFailure extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xDF333C6E;
|
||||
private NameFailureReason reason;
|
||||
|
||||
public CreateCharacterFailure() {
|
||||
reason = NameFailureReason.NAME_RETRY;
|
||||
}
|
||||
|
||||
public CreateCharacterFailure(NameFailureReason reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
String errorString = nameFailureTranslation(reason);
|
||||
ByteBuffer data = ByteBuffer.allocate(20 + errorString.length());
|
||||
addShort( data, 3);
|
||||
addInt( data, CRC);
|
||||
addUnicode(data, "");
|
||||
addAscii( data, "ui");
|
||||
addInt( data, 0);
|
||||
addAscii( data, errorString);
|
||||
return data;
|
||||
}
|
||||
|
||||
private String nameFailureTranslation(NameFailureReason reason) {
|
||||
switch (reason) {
|
||||
case NAME_DECLINED_EMPTY:
|
||||
return "name_declined_empty";
|
||||
case NAME_IN_USE:
|
||||
return "name_declined_in_use";
|
||||
case NAME_RETRY:
|
||||
return "name_declined_retry";
|
||||
case NAME_SYNTAX:
|
||||
return "name_declined_syntax";
|
||||
case NAME_TOO_FAST:
|
||||
return "name_declined_too_fast";
|
||||
}
|
||||
return "name_declined_retry";
|
||||
}
|
||||
|
||||
public enum NameFailureReason {
|
||||
NAME_DECLINED_EMPTY,
|
||||
NAME_TOO_FAST,
|
||||
NAME_RETRY,
|
||||
NAME_SYNTAX,
|
||||
NAME_IN_USE
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package network.packets.swg.login.creation;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class CreateCharacterSuccess extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x1DB575CC;
|
||||
private long id = 0;
|
||||
|
||||
public CreateCharacterSuccess() {
|
||||
|
||||
}
|
||||
|
||||
public CreateCharacterSuccess(long charId) {
|
||||
this.id = charId;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
id = getLong(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(14);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addLong( data, id);
|
||||
return data;
|
||||
}
|
||||
|
||||
public long getId() { return id; }
|
||||
public void setId(long id) { this.id = id; }
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package network.packets.swg.login.creation;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class DeleteCharacterRequest extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xE87AD031;
|
||||
private int serverId = 0;
|
||||
private long playerId = 0;
|
||||
|
||||
public DeleteCharacterRequest() {
|
||||
|
||||
}
|
||||
|
||||
public DeleteCharacterRequest(int serverId, long playerId) {
|
||||
this.serverId = serverId;
|
||||
this.playerId = playerId;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
serverId = getInt(data);
|
||||
playerId = getLong(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(18);
|
||||
addShort(data, 3);
|
||||
addInt( data, CRC);
|
||||
addInt( data, serverId);
|
||||
addLong( data, playerId);
|
||||
return data;
|
||||
}
|
||||
|
||||
public int getServerId() { return serverId; }
|
||||
public long getPlayerId() { return playerId; }
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package network.packets.swg.login.creation;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class DeleteCharacterResponse extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x8268989B;
|
||||
private boolean deleted = true;
|
||||
|
||||
public DeleteCharacterResponse() {
|
||||
|
||||
}
|
||||
|
||||
public DeleteCharacterResponse(boolean deleted) {
|
||||
this.deleted = deleted;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
deleted = getInt(data) == 0;
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(10);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addInt( data, deleted ? 0 : 1);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package network.packets.swg.login.creation;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class RandomNameRequest extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xD6D1B6D1;
|
||||
private String raceCrc = "object/creature/player/human_male.iff";
|
||||
|
||||
public RandomNameRequest() {
|
||||
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
raceCrc = getAscii(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(8 + raceCrc.length());
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addAscii(data, raceCrc);
|
||||
return data;
|
||||
}
|
||||
|
||||
public String getRace() { return raceCrc; }
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package network.packets.swg.login.creation;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class RandomNameResponse extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xE85FB868;
|
||||
|
||||
private String race;
|
||||
private String randomName;
|
||||
|
||||
public RandomNameResponse() {
|
||||
this.race = "object/creature/player/human_male.iff";
|
||||
this.randomName = "";
|
||||
}
|
||||
|
||||
public RandomNameResponse(String race, String randomName) {
|
||||
this.race = race;
|
||||
this.randomName = randomName;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
race = getAscii(data);
|
||||
randomName = getUnicode(data);
|
||||
getAscii(data);
|
||||
getInt(data);
|
||||
getAscii(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 35 + race.length() + randomName.length() * 2;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort( data, 4);
|
||||
addInt( data, CRC);
|
||||
addAscii( data, race);
|
||||
addUnicode(data, randomName);
|
||||
addAscii( data, "ui");
|
||||
addInt( data, 0);
|
||||
addAscii( data, "name_approved");
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package network.packets.swg.zone;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ChatRequestRoomList extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x4C3D2CFA;
|
||||
|
||||
public ChatRequestRoomList() {
|
||||
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 6;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 1);
|
||||
addInt( data, CRC);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package network.packets.swg.zone;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class CmdSceneReady extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x43FD1C22;
|
||||
|
||||
public CmdSceneReady() {
|
||||
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 6;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 1);
|
||||
addInt( data, CRC);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package network.packets.swg.zone;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ConnectPlayerResponseMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x6137556F;
|
||||
|
||||
public ConnectPlayerResponseMessage() {
|
||||
|
||||
}
|
||||
|
||||
public ConnectPlayerResponseMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(10);
|
||||
addShort(data, 2);
|
||||
addInt (data, CRC);
|
||||
addInt (data, 0);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package network.packets.swg.zone;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class GalaxyLoopTimesRequest extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x7D842D68;
|
||||
|
||||
public GalaxyLoopTimesRequest() {
|
||||
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 6;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 1);
|
||||
addInt( data, CRC);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package network.packets.swg.zone;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class GalaxyLoopTimesResponse extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x4E428088;
|
||||
private long time = 0;
|
||||
|
||||
public GalaxyLoopTimesResponse() {
|
||||
|
||||
}
|
||||
|
||||
public GalaxyLoopTimesResponse(long time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
time = getLong(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 14;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 3);
|
||||
addInt( data, CRC);
|
||||
addLong( data, time);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package network.packets.swg.zone;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class HeartBeatMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xA16CF9AF;
|
||||
|
||||
public HeartBeatMessage() {
|
||||
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 10;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 1);
|
||||
addInt( data, CRC);
|
||||
addInt( data, 0);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package network.packets.swg.zone;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class OpenedContainerMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x2E11E4AB;
|
||||
|
||||
private long containerId;
|
||||
|
||||
public OpenedContainerMessage() {
|
||||
this(0);
|
||||
}
|
||||
|
||||
public OpenedContainerMessage(long containerId) {
|
||||
this.containerId = 0;
|
||||
}
|
||||
|
||||
public OpenedContainerMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
getInt(data); // 0?
|
||||
containerId = getLong(data);
|
||||
getShort(data); // 0?
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(20);
|
||||
addShort(data, 2);
|
||||
addInt (data, CRC);
|
||||
addInt (data, 0);
|
||||
addLong (data, containerId);
|
||||
addShort(data, 0);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package network.packets.swg.zone;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ParametersMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x487652DA;
|
||||
|
||||
public ParametersMessage() {
|
||||
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 14;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addInt( data, 900);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
package network.packets.swg.zone;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
import resources.Location;
|
||||
|
||||
public class SceneCreateObjectByCrc extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xFE89DDEA;
|
||||
private long objId = 0;
|
||||
private Location l = new Location();
|
||||
private int objCrc = 0;
|
||||
|
||||
public SceneCreateObjectByCrc() {
|
||||
|
||||
}
|
||||
|
||||
public SceneCreateObjectByCrc(long objId, Location l, int objCrc) {
|
||||
this.objId = objId;
|
||||
this.l = l;
|
||||
this.objCrc = objCrc;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
objId = getLong(data);
|
||||
l.setOrientationX(getFloat(data));
|
||||
l.setOrientationY(getFloat(data));
|
||||
l.setOrientationZ(getFloat(data));
|
||||
l.setOrientationW(getFloat(data));
|
||||
l.setX(getFloat(data));
|
||||
l.setZ(getFloat(data));
|
||||
l.setY(getFloat(data));
|
||||
objCrc = getInt(data);
|
||||
getByte(data); // Unknown Byte
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 47;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 5);
|
||||
addInt( data, CRC);
|
||||
addLong( data, objId);
|
||||
addFloat(data, l.getOrientationX());
|
||||
addFloat(data, l.getOrientationY());
|
||||
addFloat(data, l.getOrientationZ());
|
||||
addFloat(data, l.getOrientationW());
|
||||
addFloat(data, l.getX());
|
||||
addFloat(data, l.getY());
|
||||
addFloat(data, l.getZ());
|
||||
addInt( data, objCrc);
|
||||
addByte( data, 0); // Unknown Byte
|
||||
return data;
|
||||
}
|
||||
|
||||
public long getObjectId() { return objId; }
|
||||
public Location getLocation() { return l; }
|
||||
public int getObjectCrc() { return objCrc; }
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package network.packets.swg.zone;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class SceneDestroyObject extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x4D45D504;
|
||||
|
||||
private long objId;
|
||||
|
||||
public SceneDestroyObject() {
|
||||
this(0);
|
||||
}
|
||||
|
||||
public SceneDestroyObject(long objId) {
|
||||
|
||||
}
|
||||
|
||||
public SceneDestroyObject(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
objId = getLong(data);
|
||||
getByte(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(14);
|
||||
addShort(data, 3);
|
||||
addInt (data, CRC);
|
||||
addLong (data, objId);
|
||||
addByte (data, 0);
|
||||
return data;
|
||||
}
|
||||
|
||||
public long getObjectId() { return objId; }
|
||||
public void setObjectId(long objId) { this.objId = objId; }
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package network.packets.swg.zone;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class SceneEndBaselines extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x2C436037;
|
||||
private long objId = 0;
|
||||
|
||||
public SceneEndBaselines() {
|
||||
|
||||
}
|
||||
|
||||
public SceneEndBaselines(long objId) {
|
||||
this.objId = objId;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
objId = getLong(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 14;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addLong( data, objId);
|
||||
return data;
|
||||
}
|
||||
|
||||
public long getObjectId() { return objId; }
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package network.packets.swg.zone;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ServerTimeMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x2EBC3BD9;
|
||||
|
||||
private long time = 0;
|
||||
|
||||
public ServerTimeMessage() {
|
||||
|
||||
}
|
||||
|
||||
public ServerTimeMessage(long time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
time = getLong(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(14);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addLong( data, time);
|
||||
return data;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package network.packets.swg.zone;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class UpdateContainmentMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x56CBDE9E;
|
||||
|
||||
private long containerId = 0;
|
||||
private long objectId = 0;
|
||||
private int slotIndex = 0;
|
||||
|
||||
public UpdateContainmentMessage() {
|
||||
|
||||
}
|
||||
|
||||
public UpdateContainmentMessage(long objectId, long containerId, int slotIndex) {
|
||||
this.objectId = objectId;
|
||||
this.containerId = containerId;
|
||||
this.slotIndex = slotIndex;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
objectId = getLong(data);
|
||||
containerId = getLong(data);
|
||||
slotIndex = getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 26;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 4);
|
||||
addInt( data, CRC);
|
||||
addLong( data, objectId);
|
||||
addLong( data, containerId);
|
||||
addInt( data, slotIndex);
|
||||
return data;
|
||||
}
|
||||
|
||||
public long getObjectId() { return objectId; }
|
||||
public long getContainerId() { return containerId; }
|
||||
public int getSlotIndex() { return slotIndex; }
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package network.packets.swg.zone;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
import resources.Posture;
|
||||
|
||||
public class UpdatePostureMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x00BDE6B41;
|
||||
private int posture = 0;
|
||||
private long objId = 0;
|
||||
|
||||
public UpdatePostureMessage() {
|
||||
|
||||
}
|
||||
|
||||
public UpdatePostureMessage(Posture posture, long objId) {
|
||||
this.posture = posture.getId();
|
||||
this.objId = objId;
|
||||
}
|
||||
|
||||
public UpdatePostureMessage(int posture, long objId) {
|
||||
this.posture = posture;
|
||||
this.objId = objId;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
posture = getByte(data);
|
||||
objId = getLong(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 16;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 3);
|
||||
addInt (data, CRC);
|
||||
addByte (data, posture);
|
||||
addLong (data, objId);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package network.packets.swg.zone;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class UpdatePvpStatusMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x08A1C126;
|
||||
private int playerType = 16;
|
||||
private int playerFaction = 0;
|
||||
private long objId = 0;
|
||||
|
||||
public UpdatePvpStatusMessage() {
|
||||
|
||||
}
|
||||
|
||||
public UpdatePvpStatusMessage(int playerType, int playerFaction, long objId) {
|
||||
this.playerType = playerType;
|
||||
this.playerFaction = playerFaction;
|
||||
this.objId = objId;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
playerType = getInt(data);
|
||||
playerFaction = getInt(data);
|
||||
objId = getLong(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 22;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 4);
|
||||
addInt( data, CRC);
|
||||
addInt( data, playerType);
|
||||
addInt( data, playerFaction);
|
||||
addLong( data, objId);
|
||||
return data;
|
||||
}
|
||||
|
||||
public long getObjectId() { return objId; }
|
||||
public int getPlayerFaction() { return playerFaction; }
|
||||
public int getPlayerType() { return playerType; }
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package network.packets.swg.zone;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class UpdateTransformsMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x1B24F808;
|
||||
private long objId;
|
||||
private int posX;
|
||||
private int posY;
|
||||
private int posZ;
|
||||
private int updateCounter;
|
||||
private byte posture;
|
||||
private byte direction;
|
||||
|
||||
public UpdateTransformsMessage() {
|
||||
this(0, 0, 0, 0, 0, (byte)0, (byte)0);
|
||||
}
|
||||
|
||||
public UpdateTransformsMessage(long objId, int posX, int posY, int posZ, int updateCounter, byte posture, byte direction) {
|
||||
this.objId = objId;
|
||||
this.posX = posX;
|
||||
this.posY = posY;
|
||||
this.posZ = posZ;
|
||||
this.updateCounter = updateCounter;
|
||||
this.posture = posture;
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public UpdateTransformsMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
objId = getLong(data);
|
||||
posX = getShort(data);
|
||||
posY = getShort(data);
|
||||
posZ = getShort(data);
|
||||
updateCounter = getInt(data);
|
||||
posture = getByte(data);
|
||||
direction = getByte(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(26);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addLong( data, objId);
|
||||
addShort(data, posX);
|
||||
addShort(data, posY);
|
||||
addShort(data, posZ);
|
||||
addInt (data, updateCounter);
|
||||
addByte (data, posture);
|
||||
addByte (data, direction);
|
||||
return data;
|
||||
}
|
||||
|
||||
public long getObjectId() { return objId; }
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package network.packets.swg.zone.auction;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class AuctionQueryHeadersMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x679E0D00;
|
||||
|
||||
public AuctionQueryHeadersMessage() {
|
||||
|
||||
}
|
||||
|
||||
public AuctionQueryHeadersMessage(String command) {
|
||||
|
||||
}
|
||||
|
||||
public AuctionQueryHeadersMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(6);
|
||||
addShort(data, 2);
|
||||
addInt (data, CRC);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,222 +0,0 @@
|
||||
package network.packets.swg.zone.auction;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class AuctionQueryHeadersResponseMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xFA500E52;
|
||||
|
||||
private int counter;
|
||||
private int screen;
|
||||
private List <AuctionItem> items;
|
||||
|
||||
public AuctionQueryHeadersResponseMessage() {
|
||||
items = new ArrayList<AuctionItem>();
|
||||
}
|
||||
|
||||
public AuctionQueryHeadersResponseMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
counter = getInt(data);
|
||||
screen = getInt(data);
|
||||
String [] locations = new String[getInt(data)];
|
||||
for (int i = 0; i < locations.length; i++)
|
||||
locations[i] = getAscii(data);
|
||||
int itemCount = getInt(data);
|
||||
AuctionItem [] items = new AuctionItem[itemCount];
|
||||
for (int itemI = 0; itemI < itemCount; itemI++) {
|
||||
AuctionItem item = new AuctionItem();
|
||||
item.setItemName(getUnicode(data));
|
||||
items[itemI] = item;
|
||||
}
|
||||
itemCount = getInt(data);
|
||||
if (itemCount != items.length)
|
||||
throw new IllegalStateException("I WAS LIED TO!");
|
||||
for (int itemI = 0; itemI < itemCount; itemI++) {
|
||||
AuctionItem item = items[itemI];
|
||||
item.setObjectId(getLong(data));
|
||||
getByte(data);
|
||||
item.setPrice(getInt(data));
|
||||
item.setExpireTime(getInt(data)*1000+System.currentTimeMillis());
|
||||
if (getInt(data) != item.getPrice())
|
||||
throw new IllegalStateException("I WAS LIED TO AT INDEX " + itemI);
|
||||
item.setVuid(locations[getShort(data)]);
|
||||
item.setOwnerId(getLong(data));
|
||||
item.setOwnerName(locations[getShort(data)]);
|
||||
getLong(data);
|
||||
getInt(data);
|
||||
getInt(data);
|
||||
getShort(data);
|
||||
item.setItemType(getInt(data));
|
||||
getInt(data);
|
||||
item.setAuctionOptions(getInt(data));
|
||||
getInt(data);
|
||||
}
|
||||
getShort(data);
|
||||
getByte(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(6);
|
||||
addShort(data, 8);
|
||||
addInt (data, CRC);
|
||||
addInt (data, counter);
|
||||
addInt (data, screen);
|
||||
|
||||
Set <String> locations = new LinkedHashSet<String>();
|
||||
for (AuctionItem item : items) {
|
||||
locations.add(item.getVuid());
|
||||
locations.add(item.getOwnerName());
|
||||
}
|
||||
addInt(data, items.size());
|
||||
for (String item : locations) {
|
||||
addAscii(data, item);
|
||||
}
|
||||
|
||||
addInt (data, items.size());
|
||||
for (AuctionItem item : items)
|
||||
addUnicode(data, item.getItemName());
|
||||
|
||||
addInt (data, items.size());
|
||||
|
||||
int i = 0;
|
||||
for(AuctionItem item : items) {
|
||||
addLong(data, item.getObjectId());
|
||||
addByte(data, i);
|
||||
addInt(data, item.getPrice());
|
||||
addInt(data, (int) ((item.getExpireTime() - System.currentTimeMillis()) / 1000));
|
||||
addInt(data, item.getPrice()); // if != price then auction instead of instant sale
|
||||
//addInt(data, 0);
|
||||
addShort(data, getString(locations, item.getVuid()));
|
||||
addLong(data, item.getOwnerId());
|
||||
addShort(data, getString(locations, item.getOwnerName()));
|
||||
addLong(data, 0);
|
||||
addInt(data, 0); // unk seen as 2 mostly, doesnt seem to have any effect
|
||||
addInt(data, 0);
|
||||
addShort(data, (short) 0);
|
||||
addInt(data, item.getItemType()); // gameObjectType/category bitmask
|
||||
|
||||
addInt(data, 0);
|
||||
int options = 0;
|
||||
|
||||
if (item.getStatus() == AuctionState.OFFERED || item.getStatus() == AuctionState.FORSALE)
|
||||
options |= 0x800;
|
||||
|
||||
addInt(data, item.getAuctionOptions() | options);
|
||||
addInt(data, 0);
|
||||
i++;
|
||||
}
|
||||
|
||||
addShort(data, 0);
|
||||
|
||||
addByte(data, (byte) 0);
|
||||
return data;
|
||||
}
|
||||
|
||||
private int getString(Set <String> strings, String str) {
|
||||
int index = 0;
|
||||
for (String s : strings) {
|
||||
if (s.equals(str))
|
||||
return index;
|
||||
index++;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
public static enum AuctionState {
|
||||
PREMIUM (0x400),
|
||||
WITHDRAW (0x800),
|
||||
FORSALE (1),
|
||||
SOLD (2),
|
||||
EXPIRED (4),
|
||||
OFFERED (5),
|
||||
RETRIEVED (6);
|
||||
|
||||
private int id;
|
||||
|
||||
AuctionState(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getId() { return id; }
|
||||
}
|
||||
|
||||
public static class AuctionItem {
|
||||
private long objectId;
|
||||
private long ownerId;
|
||||
private long vendorId;
|
||||
private long buyerId;
|
||||
private long offerToId;
|
||||
private int itemType;
|
||||
private int itemTypeCRC;
|
||||
private String ownerName;
|
||||
private String bidderName;
|
||||
private String itemName;
|
||||
private String itemDescription;
|
||||
private String planet;
|
||||
private String location;
|
||||
private int price;
|
||||
private int proxyBid;
|
||||
private boolean auction;
|
||||
private String vuid;
|
||||
private boolean onBazaar = false;
|
||||
private long expireTime;
|
||||
private int auctionOptions;
|
||||
private AuctionState state;
|
||||
|
||||
public long getObjectId() { return objectId; }
|
||||
public long getOwnerId() { return ownerId; }
|
||||
public long getVendorId() { return vendorId; }
|
||||
public long getBuyerId() { return buyerId; }
|
||||
public long getOfferToId() { return offerToId; }
|
||||
public int getItemType() { return itemType; }
|
||||
public String getOwnerName() { return ownerName; }
|
||||
public String getBidderName() { return bidderName; }
|
||||
public String getItemName() { return itemName; }
|
||||
public String getLocation() { return location; }
|
||||
public int getPrice() { return price; }
|
||||
public int getProxyBid() { return proxyBid; }
|
||||
public boolean isAuction() { return auction; }
|
||||
public String getVuid() { return vuid; }
|
||||
public AuctionState getStatus() { return state; }
|
||||
public boolean isOnBazaar() { return onBazaar; }
|
||||
public int getAuctionOptions() { return auctionOptions; }
|
||||
public String getPlanet() { return planet; }
|
||||
public int getItemTypeCRC() { return itemTypeCRC; }
|
||||
|
||||
public String getItemDescription() { return itemDescription; }
|
||||
public void setObjectId(long objectId) { this.objectId = objectId; }
|
||||
public void setOwnerId(long ownerId) { this.ownerId = ownerId; }
|
||||
public void setVendorId(long vendorId) { this.vendorId = vendorId; }
|
||||
public void setBuyerId(long buyerId) { this.buyerId = buyerId; }
|
||||
public void setOfferToId(long offerToId) { this.offerToId = offerToId; }
|
||||
public void setItemType(int itemType) { this.itemType = itemType; }
|
||||
public void setOwnerName(String ownerName) { this.ownerName = ownerName; }
|
||||
public void setBidderName(String bidderName) { this.bidderName = bidderName; }
|
||||
public void setItemName(String itemName) { this.itemName = itemName; }
|
||||
public void setLocation(String location) { this.location = location; }
|
||||
public void setItemDescription(String itemDescription) { this.itemDescription = itemDescription; }
|
||||
public void setPrice(int price) { this.price = price; }
|
||||
public void setProxyBid(int proxyBid) { this.proxyBid = proxyBid; }
|
||||
public void setAuction(boolean auction) { this.auction = auction; }
|
||||
public void setVuid(String vuid) { this.vuid = vuid; }
|
||||
public void setStatus(AuctionState state) { this.state = state; }
|
||||
public void setOnBazaar(boolean onBazaar) { this.onBazaar = onBazaar; }
|
||||
public long getExpireTime() { return expireTime; }
|
||||
public void setExpireTime(long expireTime) { this.expireTime = expireTime; }
|
||||
public void setAuctionOptions(int auctionOptions) { this.auctionOptions = auctionOptions; }
|
||||
public void setPlanet(String planet) { this.planet = planet; }
|
||||
public void setItemTypeCRC(int itemTypeCRC) { this.itemTypeCRC = itemTypeCRC; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package network.packets.swg.zone.auction;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class CancelLiveAuctionMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x3687A4D2;
|
||||
|
||||
public CancelLiveAuctionMessage() {
|
||||
|
||||
}
|
||||
|
||||
public CancelLiveAuctionMessage(String command) {
|
||||
|
||||
}
|
||||
|
||||
public CancelLiveAuctionMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(6);
|
||||
addShort(data, 2);
|
||||
addInt (data, CRC);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package network.packets.swg.zone.auction;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class CancelLiveAuctionResponseMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x7DA2246C;
|
||||
|
||||
public CancelLiveAuctionResponseMessage() {
|
||||
|
||||
}
|
||||
|
||||
public CancelLiveAuctionResponseMessage(String command) {
|
||||
|
||||
}
|
||||
|
||||
public CancelLiveAuctionResponseMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(6);
|
||||
addShort(data, 2);
|
||||
addInt (data, CRC);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package network.packets.swg.zone.auction;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class GetAuctionDetails extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xD36EFAE4;
|
||||
|
||||
private long auctionId;
|
||||
|
||||
public GetAuctionDetails() {
|
||||
this(0);
|
||||
}
|
||||
|
||||
public GetAuctionDetails(long auctionId) {
|
||||
this.auctionId = auctionId;
|
||||
}
|
||||
|
||||
public GetAuctionDetails(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
auctionId = getLong(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(14);
|
||||
addShort(data, 2);
|
||||
addInt (data, CRC);
|
||||
addLong (data, auctionId);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package network.packets.swg.zone.auction;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class GetAuctionDetailsResponse extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xFE0E644B;
|
||||
|
||||
private long itemId;
|
||||
private Map <String, String> properties;
|
||||
private String itemName;
|
||||
|
||||
public GetAuctionDetailsResponse() {
|
||||
this(0, new HashMap<String, String>(), "");
|
||||
}
|
||||
|
||||
public GetAuctionDetailsResponse(long itemId, Map <String, String> properties, String itemName) {
|
||||
this.itemId = itemId;
|
||||
this.properties = properties;
|
||||
this.itemName = itemName;
|
||||
}
|
||||
|
||||
public GetAuctionDetailsResponse(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
itemId = getLong(data);
|
||||
getInt(data);
|
||||
int count = getInt(data);
|
||||
for (int i = 0; i < count; i++) {
|
||||
String key = getAscii(data);
|
||||
String val = getUnicode(data);
|
||||
properties.put(key, val);
|
||||
}
|
||||
itemName = getAscii(data);
|
||||
getShort(data); // 0
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int strSize = 0;
|
||||
for (Entry <String, String> e : properties.entrySet())
|
||||
strSize += 6 + e.getKey().length() + e.getValue().length()*2;
|
||||
ByteBuffer data = ByteBuffer.allocate(18 + strSize);
|
||||
addShort(data, 9);
|
||||
addInt (data, CRC);
|
||||
addLong (data, itemId);
|
||||
addInt (data, properties.size());
|
||||
for (Entry <String, String> e : properties.entrySet()) {
|
||||
addAscii(data, e.getKey());
|
||||
addUnicode(data, e.getValue());
|
||||
}
|
||||
addAscii(data, itemName);
|
||||
addShort(data, 0);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package network.packets.swg.zone.auction;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class IsVendorOwnerResponseMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xCE04173E;
|
||||
|
||||
public IsVendorOwnerResponseMessage() {
|
||||
|
||||
}
|
||||
|
||||
public IsVendorOwnerResponseMessage(String command) {
|
||||
|
||||
}
|
||||
|
||||
public IsVendorOwnerResponseMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(6);
|
||||
addShort(data, 2);
|
||||
addInt (data, CRC);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package network.packets.swg.zone.auction;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class RetrieveAuctionItemMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x12B0D449;
|
||||
|
||||
public RetrieveAuctionItemMessage() {
|
||||
|
||||
}
|
||||
|
||||
public RetrieveAuctionItemMessage(String command) {
|
||||
|
||||
}
|
||||
|
||||
public RetrieveAuctionItemMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(6);
|
||||
addShort(data, 2);
|
||||
addInt (data, CRC);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package network.packets.swg.zone.auction;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class RetrieveAuctionItemResponseMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x9499EF8C;
|
||||
|
||||
public RetrieveAuctionItemResponseMessage() {
|
||||
|
||||
}
|
||||
|
||||
public RetrieveAuctionItemResponseMessage(String command) {
|
||||
|
||||
}
|
||||
|
||||
public RetrieveAuctionItemResponseMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(6);
|
||||
addShort(data, 2);
|
||||
addInt (data, CRC);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package network.packets.swg.zone.baselines;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
|
||||
public class Baseline extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x68A75F0C;
|
||||
private BaselineType type;
|
||||
private int num;
|
||||
private long objId;
|
||||
private ByteBuffer baseData;
|
||||
|
||||
public Baseline() {
|
||||
|
||||
}
|
||||
|
||||
public Baseline(long objId, Baseline subData) {
|
||||
this.objId = objId;
|
||||
type = subData.getType();
|
||||
num = subData.getNum();
|
||||
baseData = subData.encodeBaseline();
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
objId = getLong(data);
|
||||
byte [] str = new byte[4]; data.get(str);
|
||||
String strType = new StringBuffer(new String(str, ascii)).reverse().toString();
|
||||
for (BaselineType baseType : BaselineType.values())
|
||||
if (baseType.toString().equals(strType))
|
||||
type = baseType;
|
||||
num = getByte(data);
|
||||
byte [] objData = new byte[getInt(data)];
|
||||
data.get(objData);
|
||||
baseData = ByteBuffer.wrap(objData);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(23 + baseData.array().length);
|
||||
addShort(data, 5);
|
||||
addInt( data, CRC);
|
||||
addLong( data, objId);
|
||||
data.put(new StringBuffer(type.toString()).reverse().toString().getBytes(ascii));
|
||||
addByte( data, num);
|
||||
addInt( data, baseData.array().length);
|
||||
data.put(baseData.array());
|
||||
return data;
|
||||
}
|
||||
|
||||
public ByteBuffer encodeBaseline() { return ByteBuffer.allocate(0); }
|
||||
|
||||
public long getObjectId() { return objId; }
|
||||
|
||||
public void setType(BaselineType type) { this.type = type; }
|
||||
public void setNum(int num) { this.num = num; }
|
||||
public void setId(long id) { this.objId = id; }
|
||||
|
||||
public BaselineType getType() { return type; }
|
||||
public int getNum() { return num; }
|
||||
public long getId() { return objId; }
|
||||
public ByteBuffer getBaselineData() { return baseData; }
|
||||
|
||||
public enum BaselineType {
|
||||
BMRK, BUIO, CREO, FCYT,
|
||||
GILD, GRUP, HINO, INSO,
|
||||
ITNO, MINO, MISO, MSCO,
|
||||
PLAY, RCNO, SCLT, STAO,
|
||||
SHIP, TANO, WAYP, WEAO
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
package network.packets.swg.zone.baselines;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public class CREO3 extends Baseline {
|
||||
|
||||
private String dName = "";
|
||||
private String cName = "";
|
||||
private byte [] customization = new byte[0];
|
||||
private int posture = 1;
|
||||
private float height = 0;
|
||||
private int fatigue = 0;
|
||||
|
||||
public CREO3() {
|
||||
|
||||
}
|
||||
|
||||
public CREO3(String dName, String cName, byte [] customization, int posture, float height, int fatigue) {
|
||||
this.dName = dName;
|
||||
this.cName = cName;
|
||||
this.customization = customization;
|
||||
this.posture = posture;
|
||||
this.height = height;
|
||||
this.fatigue = fatigue;
|
||||
}
|
||||
|
||||
public void decodeBaseline(ByteBuffer data) {
|
||||
getInt(data);
|
||||
getShort(data);
|
||||
getAscii(data);
|
||||
getInt(data);
|
||||
dName = getAscii(data);
|
||||
cName = getUnicode(data);
|
||||
getInt(data);
|
||||
getLong(data);
|
||||
customization = getArray(data);
|
||||
getInt(data);
|
||||
getInt(data);
|
||||
getInt(data);
|
||||
getInt(data);
|
||||
getInt(data);
|
||||
getInt(data);
|
||||
getInt(data);
|
||||
posture = getShort(data);
|
||||
getByte(data);
|
||||
getLong(data);
|
||||
height = getFloat(data);
|
||||
fatigue = getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encodeBaseline() {
|
||||
int length = 91 + "species".length() + dName.length() + cName.length() * 2 + customization.length;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addInt( data, 0x13); // Object Count?
|
||||
addShort( data, 0x3F80); // Scale?
|
||||
addAscii( data, "species"); // Unknown..
|
||||
addInt( data, 0); // Spacer
|
||||
addAscii( data, dName); // Default Name
|
||||
addUnicode(data, cName); // Custom Name
|
||||
addInt( data, 0x000F4240); // Unknown
|
||||
addLong( data, 0); // Unknown
|
||||
addArray( data, customization); // Object Customization Data
|
||||
addInt( data, 1); // Unknown
|
||||
addInt( data, 0); // Unknown
|
||||
addInt( data, 0); // Unknown
|
||||
addInt( data, 0x80); // Unknown
|
||||
addInt( data, 0); // Unknown
|
||||
addInt( data, 0); // Unknown
|
||||
addInt( data, 0x00003A98); // Unknown
|
||||
addShort( data, posture); // Posture for Object
|
||||
addByte( data, 1); // Unknown
|
||||
addLong( data, 0); // Target Object Id
|
||||
addFloat( data, height); // Height of Object
|
||||
addInt( data, fatigue); // Battle Fatigue
|
||||
addLong( data, 0); // State?
|
||||
return data;
|
||||
}
|
||||
|
||||
public String getDefaultName() { return dName; }
|
||||
public String getCustomName() { return cName; }
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -1,22 +0,0 @@
|
||||
package network.packets.swg.zone.baselines;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
||||
public class CREO8 extends Baseline {
|
||||
|
||||
public CREO8() {
|
||||
|
||||
}
|
||||
|
||||
public void decodeBaseline(ByteBuffer data) {
|
||||
|
||||
}
|
||||
|
||||
public ByteBuffer encodeBaseline() {
|
||||
int length = 2;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 0);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package network.packets.swg.zone.baselines;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
||||
public class CREO9 extends Baseline {
|
||||
|
||||
public CREO9() {
|
||||
|
||||
}
|
||||
|
||||
public void decodeBaseline(ByteBuffer data) {
|
||||
|
||||
}
|
||||
|
||||
public ByteBuffer encodeBaseline() {
|
||||
int length = 2;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 0);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package network.packets.swg.zone.baselines;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
||||
public class PLAY6 extends Baseline {
|
||||
|
||||
public void decodeBaseline(ByteBuffer data) {
|
||||
|
||||
}
|
||||
|
||||
public ByteBuffer encodeBaseline() {
|
||||
int length = 81;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 17);
|
||||
addInt( data, 0x4C);
|
||||
addAscii(data, "string_id_table");
|
||||
addLong( data, 0);
|
||||
addLong( data, 0);
|
||||
addLong( data, 0);
|
||||
addLong( data, 0);
|
||||
addLong( data, 0);
|
||||
addLong( data, 0);
|
||||
addLong( data, 0);
|
||||
addShort(data, 0);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
package network.packets.swg.zone.baselines;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
||||
public class PLAY9 extends Baseline {
|
||||
|
||||
public void decodeBaseline(ByteBuffer data) {
|
||||
|
||||
}
|
||||
|
||||
public ByteBuffer encodeBaseline() {
|
||||
int length = 0x0143;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addInt( data, 0x1F);
|
||||
addInt( data, 0);
|
||||
addInt( data, 0);
|
||||
addShort(data, 0);
|
||||
addInt( data, 0);
|
||||
addInt( data, 3);
|
||||
addInt( data, 3);
|
||||
addByte( data, 0);
|
||||
addInt( data, 0x30254293);
|
||||
addInt( data, 0xD805AB60);
|
||||
addInt( data, 1);
|
||||
addByte( data, 0);
|
||||
addInt( data, 0x4BB23CAE);
|
||||
addInt( data, 0x6C750908);
|
||||
addInt( data, 1);
|
||||
addByte( data, 0);
|
||||
addInt( data, 0x83AADF10);
|
||||
addInt( data, 0x757A3F17);
|
||||
addInt( data, 1);
|
||||
addByte( data, 0);
|
||||
addByte( data, 0);
|
||||
addShort(data, 0);
|
||||
addInt( data, 0);
|
||||
addInt( data, 8);
|
||||
addInt( data, 0);
|
||||
addInt( data, 10);
|
||||
addInt( data, 0x21);
|
||||
addAscii(data, "atima");
|
||||
addAscii(data, "brokovo");
|
||||
addAscii(data, "daymian");
|
||||
addAscii(data, "dow-jones");
|
||||
addAscii(data, "eclipse.pandoren");
|
||||
addAscii(data, "eclipse.rabivesk");
|
||||
addAscii(data, "kenpachie");
|
||||
addAscii(data, "melony");
|
||||
addAscii(data, "omatchi'");
|
||||
addAscii(data, "sobli");
|
||||
addInt( data, 0);
|
||||
addInt( data, 3);
|
||||
addInt( data, 1);
|
||||
addInt( data, 0);
|
||||
addInt( data, 100);
|
||||
addInt( data, 0);
|
||||
addInt( data, 100);
|
||||
addInt( data, 0);
|
||||
addInt( data, 100);
|
||||
addInt( data, 0);
|
||||
addInt( data, 0);
|
||||
addInt( data, 0);
|
||||
addInt( data, 3);
|
||||
addInt( data, 0);
|
||||
addInt( data, 0);
|
||||
addInt( data, 0);
|
||||
addInt( data, 0);
|
||||
addInt( data, 0);
|
||||
addInt( data, 0);
|
||||
addInt( data, 0);
|
||||
addInt( data, 0);
|
||||
addInt( data, 2);
|
||||
addInt( data, 0);
|
||||
addInt( data, 0);
|
||||
addInt( data, 0);
|
||||
addInt( data, 0);
|
||||
addInt( data, 0);
|
||||
addInt( data, 0);
|
||||
addInt( data, 0);
|
||||
addInt( data, 0);
|
||||
addInt( data, 0);
|
||||
addShort( data, 0);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package network.packets.swg.zone.building;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class UpdateCellPermissionMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xF612499C;
|
||||
|
||||
private byte permissionFlag;
|
||||
private long cellId;
|
||||
|
||||
public UpdateCellPermissionMessage() {
|
||||
permissionFlag = 0;
|
||||
cellId = 0;
|
||||
}
|
||||
|
||||
public UpdateCellPermissionMessage(byte permissionFlag, long cellId) {
|
||||
this.permissionFlag = permissionFlag;
|
||||
this.cellId = cellId;
|
||||
}
|
||||
|
||||
public UpdateCellPermissionMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
permissionFlag = getByte(data);
|
||||
cellId = getLong(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(15);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addByte( data, permissionFlag);
|
||||
addLong( data, cellId);
|
||||
return data;
|
||||
}
|
||||
|
||||
public long getCellId() { return cellId; }
|
||||
public byte getPermissions() { return permissionFlag; }
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package network.packets.swg.zone.chat;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ChatFriendsListUpdate extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x6CD2FCD8;
|
||||
|
||||
private String galaxy;
|
||||
private String friendName;
|
||||
private boolean online;
|
||||
|
||||
public ChatFriendsListUpdate() {
|
||||
|
||||
}
|
||||
|
||||
public ChatFriendsListUpdate(String command) {
|
||||
|
||||
}
|
||||
|
||||
public ChatFriendsListUpdate(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
getAscii(data); // SWG
|
||||
galaxy = getAscii(data);
|
||||
friendName = getAscii(data);
|
||||
online = getBoolean(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(6);
|
||||
addShort (data, 3);
|
||||
addInt (data, CRC);
|
||||
addAscii (data, "SWG");
|
||||
addAscii (data, galaxy);
|
||||
addAscii (data, friendName);
|
||||
addBoolean(data, online);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
package network.packets.swg.zone.chat;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ChatIgnoreList extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xF8C275B0;
|
||||
|
||||
private long objectId;
|
||||
private List <IgnoreListItem> ignoreList;
|
||||
|
||||
public ChatIgnoreList() {
|
||||
objectId = 0;
|
||||
ignoreList = new ArrayList<IgnoreListItem>();
|
||||
}
|
||||
|
||||
public ChatIgnoreList(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void addName(String game, String galaxy, String name) {
|
||||
addName(new IgnoreListItem(game, galaxy, name));
|
||||
}
|
||||
|
||||
public void addName(IgnoreListItem name) {
|
||||
ignoreList.add(name);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
objectId = getLong(data);
|
||||
int listCount = getInt(data);
|
||||
for (int i = 0; i < listCount; i++) {
|
||||
String game = getAscii(data);
|
||||
String galaxy = getAscii(data);
|
||||
String name = getAscii(data);
|
||||
addName(game, galaxy, name);
|
||||
}
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int extraSize = 0;
|
||||
for (IgnoreListItem item : ignoreList)
|
||||
extraSize += 6 + item.getGame().length() + item.getGalaxy().length() + item.getName().length();
|
||||
ByteBuffer data = ByteBuffer.allocate(18 + extraSize);
|
||||
addShort (data, 3);
|
||||
addInt (data, CRC);
|
||||
addLong (data, objectId);
|
||||
addInt (data, ignoreList.size());
|
||||
for (IgnoreListItem item : ignoreList) {
|
||||
addAscii(data, item.getGame());
|
||||
addAscii(data, item.getGalaxy());
|
||||
addAscii(data, item.getName());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public static class IgnoreListItem {
|
||||
private String game;
|
||||
private String galaxy;
|
||||
private String name;
|
||||
|
||||
public IgnoreListItem() {
|
||||
this("SWG", "", "");
|
||||
}
|
||||
|
||||
public IgnoreListItem(String game, String galaxy, String name) {
|
||||
this.game = game;
|
||||
this.galaxy = galaxy;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getGame() { return game; }
|
||||
public String getGalaxy() { return galaxy; }
|
||||
public String getName() { return name; }
|
||||
public void setGame(String game) { this.game = game; }
|
||||
public void setGalaxy(String galaxy) { this.galaxy = galaxy; }
|
||||
public void setName(String name) { this.name = name; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package network.packets.swg.zone.chat;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ChatInstantMessageToCharacter extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x84BB21F7;
|
||||
|
||||
private String galaxy;
|
||||
private String character;
|
||||
private String message;
|
||||
private int sequence;
|
||||
|
||||
public ChatInstantMessageToCharacter() {
|
||||
this("", "", "", 0);
|
||||
}
|
||||
|
||||
public ChatInstantMessageToCharacter(String galaxy, String character, String message, int sequence) {
|
||||
this.galaxy = galaxy;
|
||||
this.character = character;
|
||||
this.message = message;
|
||||
this.sequence = sequence;
|
||||
}
|
||||
|
||||
public ChatInstantMessageToCharacter(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
getAscii(data);
|
||||
galaxy = getAscii(data);
|
||||
character = getAscii(data);
|
||||
message = getAscii(data);
|
||||
getInt(data);
|
||||
sequence = getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(19 + character.length() + message.length());
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addAscii(data, "SWG");
|
||||
addAscii(data, galaxy);
|
||||
addAscii(data, character);
|
||||
addAscii(data, message);
|
||||
addInt (data, 0);
|
||||
addInt (data, sequence);
|
||||
return data;
|
||||
}
|
||||
|
||||
public String getGalaxy() { return galaxy; }
|
||||
public String getCharacter() { return character; }
|
||||
public String getMessage() { return message; }
|
||||
public int getSequence() { return sequence; }
|
||||
|
||||
public void setGalaxy(String galaxy) { this.galaxy = galaxy; }
|
||||
public void setCharacter(String character) { this.character = character; }
|
||||
public void setMessage(String message) { this.message = message; }
|
||||
public void setSequence(int sequence) { this.sequence = sequence; }
|
||||
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package network.packets.swg.zone.chat;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ChatInstantMessageToClient extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x3C565CED;
|
||||
|
||||
private String galaxy;
|
||||
private String character;
|
||||
private String message;
|
||||
|
||||
public ChatInstantMessageToClient() {
|
||||
this("", "", "");
|
||||
}
|
||||
|
||||
public ChatInstantMessageToClient(String galaxy, String character, String message) {
|
||||
this.galaxy = galaxy;
|
||||
this.character = character;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public ChatInstantMessageToClient(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
getAscii(data);
|
||||
galaxy = getAscii(data);
|
||||
character = getAscii(data);
|
||||
message = getAscii(data);
|
||||
getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(19 + character.length() + message.length());
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addAscii(data, "SWG");
|
||||
addAscii(data, galaxy);
|
||||
addAscii(data, character);
|
||||
addAscii(data, message);
|
||||
addInt (data, 0);
|
||||
return data;
|
||||
}
|
||||
|
||||
public String getGalaxy() { return galaxy; }
|
||||
public String getCharacter() { return character; }
|
||||
public String getMessage() { return message; }
|
||||
|
||||
public void setGalaxy(String galaxy) { this.galaxy = galaxy; }
|
||||
public void setCharacter(String character) { this.character = character; }
|
||||
public void setMessage(String message) { this.message = message; }
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package network.packets.swg.zone.chat;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ChatOnConnectAvatar extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xD72FE9BE;
|
||||
|
||||
public ChatOnConnectAvatar() {
|
||||
|
||||
}
|
||||
|
||||
public ChatOnConnectAvatar(String command) {
|
||||
|
||||
}
|
||||
|
||||
public ChatOnConnectAvatar(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(6);
|
||||
addShort(data, 2);
|
||||
addInt (data, CRC);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package network.packets.swg.zone.chat;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ChatOnDestroyRoom extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xE8EC5877;
|
||||
|
||||
private String galaxy;
|
||||
private String owner;
|
||||
private boolean success;
|
||||
private int roomId;
|
||||
private int requestId;
|
||||
|
||||
public ChatOnDestroyRoom() {
|
||||
this("", "", true, 0, 0);
|
||||
}
|
||||
|
||||
public ChatOnDestroyRoom(String galaxy, String owner, boolean success, int roomId, int requestId) {
|
||||
this.galaxy = galaxy;
|
||||
this.owner = owner;
|
||||
this.success = success;
|
||||
this.roomId = roomId;
|
||||
this.requestId = requestId;
|
||||
}
|
||||
|
||||
public ChatOnDestroyRoom(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
getAscii(data); // SWG
|
||||
galaxy = getAscii(data);
|
||||
owner = getAscii(data);
|
||||
success = getInt(data) == 0;
|
||||
roomId = getInt(data);
|
||||
requestId = getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(27 + galaxy.length() + owner.length());
|
||||
addShort(data, 5);
|
||||
addInt (data, CRC);
|
||||
addAscii(data, "SWG");
|
||||
addAscii(data, galaxy);
|
||||
addAscii(data, owner);
|
||||
addInt (data, success ? 0 : 1);
|
||||
addInt (data, roomId);
|
||||
addInt (data, requestId);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
package network.packets.swg.zone.chat;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ChatOnEnteredRoom extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xE69BDC0A;
|
||||
|
||||
private String galaxy;
|
||||
private String character;
|
||||
private ChannelStatus status;
|
||||
private int chatRoomId;
|
||||
|
||||
public ChatOnEnteredRoom() {
|
||||
this("", "", ChannelStatus.SUCCESS, 0);
|
||||
}
|
||||
|
||||
public ChatOnEnteredRoom(String galaxy, String character, ChannelStatus status, int chatRoomId) {
|
||||
this.galaxy = galaxy;
|
||||
this.character = character;
|
||||
this.status = status;
|
||||
this.chatRoomId = chatRoomId;
|
||||
}
|
||||
|
||||
public ChatOnEnteredRoom(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
getAscii(data);
|
||||
galaxy = getAscii(data);
|
||||
character = getAscii(data);
|
||||
status = ChannelStatus.fromInteger(getInt(data));
|
||||
chatRoomId = getInt(data);
|
||||
getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(27 + galaxy.length() + character.length());
|
||||
addShort(data, 5);
|
||||
addInt (data, CRC);
|
||||
addAscii(data, "SWG");
|
||||
addAscii(data, galaxy);
|
||||
addAscii(data, character);
|
||||
addInt (data, status.getBitmask());
|
||||
addInt (data, chatRoomId);
|
||||
addInt (data, 0);
|
||||
return data;
|
||||
}
|
||||
|
||||
public enum ChannelStatus {
|
||||
SUCCESS(0), // "You have joined the channel."
|
||||
NOT_INVITED(0x10), // "You cannot join '%TU (room name)' because you are not invted to the room."
|
||||
UNKNOWN(0x20); // "Chatroom '%TU (room name)' join failed for an unknown reason."
|
||||
|
||||
private int bitmask;
|
||||
|
||||
ChannelStatus(int bitmask) {
|
||||
this.bitmask = bitmask;
|
||||
}
|
||||
public int getBitmask() {
|
||||
return bitmask;
|
||||
}
|
||||
public static final ChannelStatus fromInteger(int i) {
|
||||
if (i == 0)
|
||||
return SUCCESS;
|
||||
if (i == 0x10)
|
||||
return NOT_INVITED;
|
||||
return UNKNOWN;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
package network.packets.swg.zone.chat;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ChatOnLeaveRoom extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x60B5098B;
|
||||
|
||||
private String galaxyName;
|
||||
private String characterName;
|
||||
private int errorCode;
|
||||
private int chatRoomId;
|
||||
private int requestId;
|
||||
|
||||
public ChatOnLeaveRoom() {
|
||||
this("", "", 0, 0, 0);
|
||||
}
|
||||
|
||||
public ChatOnLeaveRoom(String galaxy, String character, int errorCode, int chatRoomId, int requestId) {
|
||||
this.galaxyName = galaxy;
|
||||
this.characterName = character;
|
||||
this.errorCode = errorCode;
|
||||
this.chatRoomId = chatRoomId;
|
||||
this.requestId = requestId;
|
||||
}
|
||||
|
||||
public ChatOnLeaveRoom(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
getAscii(data);
|
||||
galaxyName = getAscii(data);
|
||||
characterName = getAscii(data);
|
||||
errorCode = getInt(data);
|
||||
chatRoomId = getInt(data);
|
||||
requestId = getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(27+galaxyName.length()+characterName.length());
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addAscii(data, "SWG");
|
||||
addAscii(data, galaxyName);
|
||||
addAscii(data, characterName);
|
||||
addInt (data, errorCode);
|
||||
addInt (data, chatRoomId);
|
||||
addInt (data, requestId);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package network.packets.swg.zone.chat;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ChatOnReceiveRoomInvitation extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xC17EB06D;
|
||||
|
||||
public ChatOnReceiveRoomInvitation() {
|
||||
|
||||
}
|
||||
|
||||
public ChatOnReceiveRoomInvitation(String command) {
|
||||
|
||||
}
|
||||
|
||||
public ChatOnReceiveRoomInvitation(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(6);
|
||||
addShort(data, 2);
|
||||
addInt (data, CRC);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package network.packets.swg.zone.chat;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ChatOnSendInstantMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x88DBB381;
|
||||
|
||||
private int errorCode;
|
||||
private int count;
|
||||
|
||||
public ChatOnSendInstantMessage() {
|
||||
this(0, 0);
|
||||
}
|
||||
|
||||
public ChatOnSendInstantMessage(int errorCode, int count) {
|
||||
this.errorCode = errorCode;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
public ChatOnSendInstantMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
errorCode = getInt(data);
|
||||
count = getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(14);
|
||||
addShort(data, 2);
|
||||
addInt (data, CRC);
|
||||
addInt (data, errorCode);
|
||||
addInt (data, count);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package network.packets.swg.zone.chat;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ChatOnSendRoomMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xE7B61633;
|
||||
private int error = 0;
|
||||
private int messageId = 0;
|
||||
|
||||
public ChatOnSendRoomMessage() {
|
||||
|
||||
}
|
||||
|
||||
public ChatOnSendRoomMessage(int error, int messageId) {
|
||||
this.error = error;
|
||||
this.messageId = messageId;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
error = getInt(data);
|
||||
messageId = getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 14;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 3);
|
||||
addInt( data, CRC);
|
||||
addInt( data, error);
|
||||
addInt( data, messageId);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,330 +0,0 @@
|
||||
package network.packets.swg.zone.chat;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import resources.Planet;
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ChatPersistentMessageToClient extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x08485E17;
|
||||
|
||||
private String senderName;
|
||||
private String galaxy;
|
||||
private int mailId;
|
||||
private byte type;
|
||||
private String subject;
|
||||
private String message;
|
||||
private List <WaypointAttachment> waypointAttachments;
|
||||
private List <ProseAttachment> proseAttachments;
|
||||
private byte status;
|
||||
private int timestamp;
|
||||
|
||||
public ChatPersistentMessageToClient() {
|
||||
senderName = "";
|
||||
galaxy = "";
|
||||
mailId = 0;
|
||||
type = 0;
|
||||
subject = "";
|
||||
message = "";
|
||||
waypointAttachments = new ArrayList<WaypointAttachment>();
|
||||
proseAttachments = new ArrayList<ProseAttachment>();
|
||||
status = 0;
|
||||
timestamp = 0;
|
||||
}
|
||||
|
||||
public ChatPersistentMessageToClient(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
senderName = getAscii(data);
|
||||
getAscii(data); // SWG
|
||||
galaxy = getAscii(data);
|
||||
mailId = getInt(data);
|
||||
type = getByte(data);
|
||||
|
||||
if (type == 1) {
|
||||
getInt(data); // 0?
|
||||
subject = getUnicode(data);
|
||||
getInt(data);
|
||||
} else {
|
||||
message = getUnicode(data);
|
||||
subject = getUnicode(data);
|
||||
int size = getInt(data) * 2;
|
||||
int start = data.position();
|
||||
do {
|
||||
getShort(data); // 0?
|
||||
byte type = getByte(data);
|
||||
getInt(data); // Integer version of the type, it seems
|
||||
if (type == 4)
|
||||
waypointAttachments.add(WaypointAttachment.deserialize(data));
|
||||
else if (type == 1)
|
||||
proseAttachments.add(ProseAttachment.deserialize(data));
|
||||
else {
|
||||
System.err.println("Invalid type supplied in ChatPersistentMessageToClient.decode");
|
||||
break;
|
||||
}
|
||||
} while (data.position() - start < size);
|
||||
}
|
||||
status = getByte(data);
|
||||
timestamp = getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int extraSize = 0;
|
||||
if (type == 1) {
|
||||
extraSize += 12 + subject.length()*2;
|
||||
} else {
|
||||
extraSize += 12 + message.length()*2 + subject.length()*2;
|
||||
for (WaypointAttachment waypoint : waypointAttachments)
|
||||
extraSize += 7 + waypoint.getSerializableSize();
|
||||
for (ProseAttachment prose : proseAttachments)
|
||||
extraSize += 7 + prose.getSerializableSize();
|
||||
}
|
||||
ByteBuffer data = ByteBuffer.allocate(25 + extraSize);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addAscii(data, senderName);
|
||||
addAscii(data, "SWG");
|
||||
addAscii(data, galaxy);
|
||||
addInt(data, mailId);
|
||||
addByte(data, type);
|
||||
|
||||
if (type == 1) {
|
||||
addInt(data, 0);
|
||||
addUnicode(data, subject);
|
||||
addInt(data, 0);
|
||||
} else {
|
||||
addUnicode(data, message);
|
||||
addUnicode(data, subject);
|
||||
addInt(data, extraSize / 2);
|
||||
for (WaypointAttachment waypoint : waypointAttachments) {
|
||||
addShort(data, 0);
|
||||
addByte(data, 4);
|
||||
addInt(data, 0xFFFFFFFD);
|
||||
waypoint.serialize(data);
|
||||
}
|
||||
for (ProseAttachment prose : proseAttachments) {
|
||||
addShort(data, 0);
|
||||
addByte(data, 1);
|
||||
addInt(data, 0xFFFFFFFF);
|
||||
prose.serialize(data);
|
||||
}
|
||||
}
|
||||
addByte(data, status);
|
||||
addInt(data, timestamp);
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setSenderName(String senderName) {
|
||||
this.senderName = senderName;
|
||||
}
|
||||
|
||||
public void setGalaxy(String galaxy) {
|
||||
this.galaxy = galaxy;
|
||||
}
|
||||
|
||||
public void setMailId(int mailId) {
|
||||
this.mailId = mailId;
|
||||
}
|
||||
|
||||
public void setType(byte type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public void addWaypoint(WaypointAttachment waypoint) {
|
||||
waypointAttachments.add(waypoint);
|
||||
}
|
||||
|
||||
public void addAllWaypoints(Collection <WaypointAttachment> waypoints) {
|
||||
waypointAttachments.addAll(waypoints);
|
||||
}
|
||||
|
||||
public void addProse(ProseAttachment prose) {
|
||||
proseAttachments.add(prose);
|
||||
}
|
||||
|
||||
public void addAllProses(Collection <ProseAttachment> proses) {
|
||||
proseAttachments.addAll(proses);
|
||||
}
|
||||
|
||||
public void setStatus(byte status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public void setTimestamp(int timestamp) {
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public static class WaypointAttachment {
|
||||
private float x;
|
||||
private float y;
|
||||
private float z;
|
||||
private Planet planet;
|
||||
private String attachmentName;
|
||||
private long cellId;
|
||||
private byte color;
|
||||
private boolean active;
|
||||
|
||||
public float getX() { return x; }
|
||||
public float getY() { return y; }
|
||||
public float getZ() { return z; }
|
||||
public Planet getPlanet() { return planet; }
|
||||
public String getAttachmentName() { return attachmentName; }
|
||||
public long getCellId() { return cellId; }
|
||||
public byte getColor() { return color; }
|
||||
public boolean isActive() { return active; }
|
||||
|
||||
public void setX(float x) { this.x = x; }
|
||||
public void setY(float y) { this.y = y; }
|
||||
public void setZ(float z) { this.z = z; }
|
||||
public void setPlanet(Planet p) { this.planet = p; }
|
||||
public void setAttachmentName(String name) { this.attachmentName = name; }
|
||||
public void setCellId(long id) { this.cellId = id; }
|
||||
public void setColor(byte c) { this.color = c; }
|
||||
public void setActive(boolean active) { this.active = active; }
|
||||
|
||||
private final int getSerializableSize() {
|
||||
return 43 + attachmentName.length()*2;
|
||||
}
|
||||
|
||||
private static final WaypointAttachment deserialize(ByteBuffer data) {
|
||||
WaypointAttachment waypoint = new WaypointAttachment();
|
||||
getInt(data); // 0?
|
||||
waypoint.setX(getFloat(data));
|
||||
waypoint.setY(getFloat(data));
|
||||
waypoint.setZ(getFloat(data));
|
||||
getLong(data); // 0?
|
||||
waypoint.setPlanet(Planet.getPlanetFromCrc(getInt(data)));
|
||||
waypoint.setAttachmentName(getUnicode(data));
|
||||
waypoint.setCellId(getLong(data));
|
||||
waypoint.setColor(getByte(data));
|
||||
waypoint.setActive(getBoolean(data));
|
||||
getByte(data); // 0?
|
||||
return waypoint;
|
||||
}
|
||||
|
||||
private final void serialize(ByteBuffer data) {
|
||||
addInt (data, 0);
|
||||
addFloat (data, getX());
|
||||
addFloat (data, getY());
|
||||
addFloat (data, getZ());
|
||||
addLong (data, 0);
|
||||
addInt (data, planet.getCrc());
|
||||
addUnicode(data, attachmentName);
|
||||
addLong (data, cellId);
|
||||
addByte (data, color);
|
||||
addBoolean(data, active);
|
||||
addByte (data, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ProseAttachment {
|
||||
private String stf;
|
||||
private ProseSegment tu;
|
||||
private ProseSegment tt;
|
||||
private ProseSegment to;
|
||||
private int diInt;
|
||||
private float dfFloat;
|
||||
|
||||
public String getSTF() { return stf; }
|
||||
public ProseSegment getTu() { return tu; }
|
||||
public ProseSegment getTt() { return tt; }
|
||||
public ProseSegment getTo() { return to; }
|
||||
public int getDiInteger() { return diInt; }
|
||||
public float getDfFloat() { return dfFloat; }
|
||||
|
||||
public void setSTF(String stf) { this.stf = stf; }
|
||||
public void setTu(ProseSegment tu) { this.tu = tu; }
|
||||
public void setTt(ProseSegment tt) { this.tt = tt; }
|
||||
public void setTo(ProseSegment to) { this.to = to; }
|
||||
public void setDiInteger(int di) { this.diInt = di; }
|
||||
public void setDfFloat(float df) { this.dfFloat = df; }
|
||||
|
||||
private final int getSerializableSize() {
|
||||
return 10 + stf.length() + tu.getSerializableSize() + tt.getSerializableSize() + to.getSerializableSize();
|
||||
}
|
||||
|
||||
private static final ProseAttachment deserialize(ByteBuffer data) {
|
||||
ProseAttachment prose = new ProseAttachment();
|
||||
prose.setSTF(getAscii(data));
|
||||
prose.setTu(ProseSegment.deserialize(data));
|
||||
prose.setTt(ProseSegment.deserialize(data));
|
||||
prose.setTo(ProseSegment.deserialize(data));
|
||||
prose.setDiInteger(getInt(data));
|
||||
prose.setDfFloat(getFloat(data));
|
||||
return prose;
|
||||
}
|
||||
|
||||
private final void serialize(ByteBuffer data) {
|
||||
addAscii(data, stf);
|
||||
tu.serialize(data);
|
||||
tt.serialize(data);
|
||||
to.serialize(data);
|
||||
addInt(data, diInt);
|
||||
addFloat(data, dfFloat);
|
||||
}
|
||||
|
||||
public static class ProseSegment {
|
||||
private long objectId;
|
||||
private String stf;
|
||||
private String customString;
|
||||
|
||||
public long getObjectId() { return objectId; }
|
||||
public String getSTF() { return stf; }
|
||||
public String getCustomString() { return customString; }
|
||||
|
||||
public void setObjectId(long id) { this.objectId = id; }
|
||||
public void setSTF(String stf) { this.stf = stf; }
|
||||
public void setCustomString(String custom) { this.customString = custom; }
|
||||
|
||||
private final int getSerializableSize() {
|
||||
return 14 + stf.length() + customString.length()*2;
|
||||
}
|
||||
|
||||
private static final ProseSegment deserialize(ByteBuffer data) {
|
||||
ProseSegment segment = new ProseSegment();
|
||||
segment.setObjectId(getLong(data));
|
||||
segment.setSTF(getAscii(data));
|
||||
segment.setCustomString(getUnicode(data));
|
||||
return segment;
|
||||
}
|
||||
|
||||
private final void serialize(ByteBuffer data) {
|
||||
addLong(data, objectId);
|
||||
addAscii(data, stf);
|
||||
addUnicode(data, customString);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* ASCII Stf
|
||||
* LONG TuObjectId
|
||||
* ASCII TuStf
|
||||
* UNICODE TuCustomString
|
||||
* LONG TtObjectId
|
||||
* ASCII TtStf
|
||||
* UNICODE TtCustomString
|
||||
* LONG ToObjectId
|
||||
* ASCII ToStf
|
||||
* UNICODE ToCustomString
|
||||
* INT DiInteger
|
||||
* FLOAT DfFloat
|
||||
* BYTE 0
|
||||
*/
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package network.packets.swg.zone.chat;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
import network.packets.swg.zone.insertion.ChatRoomList.ChatRoom.User;
|
||||
|
||||
public class ChatRoomMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xCD4CE444;
|
||||
private User user = new User();
|
||||
private int roomId = 0;
|
||||
private String message = "";
|
||||
|
||||
public ChatRoomMessage() {
|
||||
|
||||
}
|
||||
|
||||
public ChatRoomMessage(String game, String server, String name, int roomId, String message) {
|
||||
this.user.game = game;
|
||||
this.user.server = server;
|
||||
this.user.name = name;
|
||||
this.roomId = roomId;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
user.game = getAscii(data);
|
||||
user.server = getAscii(data);
|
||||
user.name = getAscii(data);
|
||||
roomId = getInt(data);
|
||||
message = getUnicode(data);
|
||||
getUnicode(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 24 + user.game.length() + user.server.length() + user.name.length() + message.length() * 2;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort( data, 5);
|
||||
addInt( data, CRC);
|
||||
addAscii( data, user.game);
|
||||
addAscii( data, user.server);
|
||||
addAscii( data, user.name);
|
||||
addInt( data, roomId);
|
||||
addUnicode(data, message);
|
||||
addUnicode(data, "");
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package network.packets.swg.zone.chat;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ChatSystemMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x6D2A6413;
|
||||
private int type = 0;
|
||||
private String message = "";
|
||||
|
||||
public ChatSystemMessage() {
|
||||
|
||||
}
|
||||
|
||||
public ChatSystemMessage(int type, String message) {
|
||||
this.type = type;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public ChatSystemMessage(SystemChatType type, String message) {
|
||||
this(type.ordinal(), message);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
type = getByte(data);
|
||||
message = getUnicode(data);
|
||||
getUnicode(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 15 + message.length() * 2;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort( data, 4);
|
||||
addInt( data, CRC);
|
||||
addByte( data, type);
|
||||
addUnicode(data, message);
|
||||
addUnicode(data, "");
|
||||
return data;
|
||||
}
|
||||
|
||||
public SystemChatType getType() {
|
||||
for (SystemChatType t : SystemChatType.values()) {
|
||||
if (type == t.ordinal()) return t;
|
||||
}
|
||||
return SystemChatType.SCREEN_AND_CHAT;
|
||||
}
|
||||
public String getMessage() { return message; }
|
||||
|
||||
public enum SystemChatType {
|
||||
SCREEN_AND_CHAT,
|
||||
SCREEN,
|
||||
CHAT
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package network.packets.swg.zone.chat;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ConGenericMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x08C5FC76;
|
||||
|
||||
private String message;
|
||||
|
||||
public ConGenericMessage() {
|
||||
this("");
|
||||
}
|
||||
|
||||
public ConGenericMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public ConGenericMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
message = getAscii(data);
|
||||
getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(8 + message.length());
|
||||
addShort(data, 3);
|
||||
addInt (data, CRC);
|
||||
addAscii(data, message);
|
||||
addInt (data, 0);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package network.packets.swg.zone.chat;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class VoiceChatStatus extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x9E601905;
|
||||
|
||||
public VoiceChatStatus() {
|
||||
|
||||
}
|
||||
|
||||
public VoiceChatStatus(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(6);
|
||||
addShort(data, 2);
|
||||
addInt (data, CRC);
|
||||
addInt (data, 1);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package network.packets.swg.zone.combat;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class GrantCommandMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xE67E3875;
|
||||
|
||||
private String command;
|
||||
|
||||
public GrantCommandMessage() {
|
||||
command = "";
|
||||
}
|
||||
|
||||
public GrantCommandMessage(String command) {
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
public GrantCommandMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
this.command = getAscii(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(8 + command.length());
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addAscii(data, command);
|
||||
return data;
|
||||
}
|
||||
|
||||
public String getCommand() {
|
||||
return command;
|
||||
}
|
||||
|
||||
public void setCommand(String command) {
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package network.packets.swg.zone.deltas;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
import network.packets.swg.zone.baselines.Baseline.BaselineType;
|
||||
|
||||
public class DeltasMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x12862153;
|
||||
|
||||
private long objId;
|
||||
private BaselineType type;
|
||||
private int num;
|
||||
private byte [] data;
|
||||
|
||||
public DeltasMessage() {
|
||||
this(0, 0, (byte)0, new byte[0]);
|
||||
}
|
||||
|
||||
public DeltasMessage(long objId, int type, byte typeNumber, byte [] data) {
|
||||
|
||||
}
|
||||
|
||||
public DeltasMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
objId = getLong(data);
|
||||
byte [] str = new byte[4]; data.get(str);
|
||||
String strType = new StringBuffer(new String(str, ascii)).reverse().toString();
|
||||
for (BaselineType baseType : BaselineType.values())
|
||||
if (baseType.toString().equals(strType))
|
||||
type = baseType;
|
||||
num = getByte(data);
|
||||
int length = getInt(data);
|
||||
this.data = getArray(data, length);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(23 + this.data.length);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addLong(data, objId);
|
||||
data.put(new StringBuffer(type.toString()).reverse().toString().getBytes(ascii));
|
||||
addByte(data, num);
|
||||
addInt(data, this.data.length);
|
||||
data.put(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
public long getObjectId() { return objId; }
|
||||
public BaselineType getType() { return type; }
|
||||
public int getNum() { return num; }
|
||||
|
||||
public void setType(BaselineType type) { this.type = type; }
|
||||
public void setNum(int num) { this.num = num; }
|
||||
public void setId(long id) { this.objId = id; }
|
||||
|
||||
}
|
||||
@@ -1,209 +0,0 @@
|
||||
package network.packets.swg.zone.insertion;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
import network.packets.swg.zone.insertion.ChatRoomList.ChatRoom.User;
|
||||
|
||||
public class ChatRoomList extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x70DEB197;
|
||||
private List <ChatRoom> chatrooms = new ArrayList<ChatRoom>();
|
||||
|
||||
public ChatRoomList() {
|
||||
|
||||
}
|
||||
|
||||
public ChatRoomList(ChatRoom room) {
|
||||
chatrooms.add(room);
|
||||
}
|
||||
|
||||
public ChatRoomList(ChatRoom [] rooms) {
|
||||
for (ChatRoom r : rooms) {
|
||||
chatrooms.add(r);
|
||||
}
|
||||
}
|
||||
|
||||
public void addChatRoom(ChatRoom r) {
|
||||
chatrooms.add(r);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
int chatroomCount = getInt(data);
|
||||
for (int i = 0; i < chatroomCount; i++) {
|
||||
ChatRoom room = new ChatRoom();
|
||||
room.setRoomId(getInt(data));
|
||||
room.setPrivateFlag(getInt(data));
|
||||
room.setModeratedFlag(getByte(data));
|
||||
room.setRoomPathName(getAscii(data));
|
||||
room.setGame(getAscii(data));
|
||||
room.setServer(getAscii(data));
|
||||
room.setOwner(getAscii(data));
|
||||
getAscii(data); // SWG
|
||||
getAscii(data); // galaxy
|
||||
room.setCreator(getAscii(data));
|
||||
room.setTitle(getUnicode(data));
|
||||
int moderatorCount = getInt(data);
|
||||
for (int m = 0; m < moderatorCount; m++) {
|
||||
User user = new User();
|
||||
user.setGame(getAscii(data));
|
||||
user.setServer(getAscii(data));
|
||||
user.setName(getAscii(data));
|
||||
room.addModerator(user);
|
||||
}
|
||||
int userCount = getInt(data);
|
||||
for (int u = 0; u < userCount; u++) {
|
||||
User user = new User();
|
||||
user.setGame(getAscii(data));
|
||||
user.setServer(getAscii(data));
|
||||
user.setName(getAscii(data));
|
||||
room.addUser(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 10;
|
||||
for (ChatRoom r : chatrooms) {
|
||||
length += r.getSize();
|
||||
}
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addInt( data, chatrooms.size());
|
||||
for (ChatRoom r : chatrooms) {
|
||||
addInt(data, r.getRoomId());
|
||||
addInt(data, r.getPrivateFlag());
|
||||
addByte(data, r.getModeratedFlag());
|
||||
addAscii(data, r.getRoomPathName());
|
||||
addAscii(data, r.getGame());
|
||||
addAscii(data, r.getServer());
|
||||
addAscii(data, r.getOwner());
|
||||
addAscii(data, r.getCreator());
|
||||
addUnicode(data, r.getTitle());
|
||||
addInt(data, r.getModerators().size());
|
||||
for (User u : r.getModerators()) {
|
||||
addAscii(data, u.game);
|
||||
addAscii(data, u.server);
|
||||
addAscii(data, u.name);
|
||||
}
|
||||
addInt(data, r.getUsers().size());
|
||||
for (User u : r.getUsers()) {
|
||||
addAscii(data, u.game);
|
||||
addAscii(data, u.server);
|
||||
addAscii(data, u.name);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public static class ChatRoom {
|
||||
private int roomId = 0;
|
||||
private int privateFlag = 0;
|
||||
private int moderatedFlag = 0;
|
||||
private String roomPathName = "";
|
||||
private String game = "";
|
||||
private String server = "";
|
||||
private String owner = "";
|
||||
private String creator = "";
|
||||
private String title = "";
|
||||
private Vector <User> moderators = new Vector<User>();
|
||||
private Vector <User> users = new Vector<User>();
|
||||
|
||||
public ChatRoom() {
|
||||
|
||||
}
|
||||
|
||||
public ChatRoom(int roomId, int privateFlag, int moderatedFlag, String roomPathName, String game, String server, String owner, String creator, String title) {
|
||||
this.roomId = roomId;
|
||||
this.privateFlag = privateFlag;
|
||||
this.moderatedFlag = moderatedFlag;
|
||||
this.roomPathName = roomPathName;
|
||||
this.game = game;
|
||||
this.server = server;
|
||||
this.owner = owner;
|
||||
this.creator = creator;
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public void addModerator(String game, String server, String name) {
|
||||
moderators.add(new User(game, server, name));
|
||||
}
|
||||
|
||||
public void addUser(String game, String server, String name) {
|
||||
users.add(new User(game, server, name));
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
int length = 31;
|
||||
length += roomPathName.length();
|
||||
length += game.length();
|
||||
length += server.length();
|
||||
length += owner.length();
|
||||
length += creator.length();
|
||||
length += title.length() * 2;
|
||||
for (User u : moderators) length += u.getSize();
|
||||
for (User u : users) length += u.getSize();
|
||||
return length;
|
||||
}
|
||||
|
||||
public int getRoomId() { return roomId; }
|
||||
public int getPrivateFlag() { return privateFlag; }
|
||||
public int getModeratedFlag() { return moderatedFlag; }
|
||||
public String getRoomPathName() { return roomPathName; }
|
||||
public String getGame() { return game; }
|
||||
public String getServer() { return server; }
|
||||
public String getOwner() { return owner; }
|
||||
public String getCreator() { return creator; }
|
||||
public String getTitle() { return title; }
|
||||
public List <User> getUsers() { return users; }
|
||||
public List <User> getModerators() { return moderators; }
|
||||
|
||||
public void setRoomId(int id) { this.roomId = id; }
|
||||
public void setPrivateFlag(int flag) { this.privateFlag = flag; }
|
||||
public void setModeratedFlag(int flag) { this.moderatedFlag = flag; }
|
||||
public void setRoomPathName(String path) { this.roomPathName = path; }
|
||||
public void setGame(String game) { this.game = game; }
|
||||
public void setServer(String server) { this.server = server; }
|
||||
public void setOwner(String owner) { this.owner = owner; }
|
||||
public void setCreator(String creator) { this.creator = creator; }
|
||||
public void setTitle(String title) { this.title = title; }
|
||||
public void setUsers(Vector<User> users) { this.users = users; }
|
||||
public void setModerators(Vector<User> moderators) { this.moderators = moderators; }
|
||||
public void addUser(User user) { this.users.add(user); }
|
||||
public void addModerator(User moderator) { this.moderators.add(moderator); }
|
||||
|
||||
public static class User {
|
||||
public String game = "";
|
||||
public String server = "";
|
||||
public String name = "";
|
||||
|
||||
public User() {
|
||||
|
||||
}
|
||||
|
||||
public User(String game, String server, String name) {
|
||||
this.game = game;
|
||||
this.server = server;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return 6 + game.length() + server.length() + name.length();
|
||||
}
|
||||
|
||||
public String getGame() { return game; }
|
||||
public String getServer() { return server; }
|
||||
public String getName() { return name; }
|
||||
|
||||
public void setGame(String game) { this.game = game; }
|
||||
public void setServer(String server) { this.server = server; }
|
||||
public void setName(String name) { this.name = name; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package network.packets.swg.zone.insertion;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ChatServerStatus extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x7102B15F;
|
||||
private boolean online = false;
|
||||
|
||||
public ChatServerStatus() {
|
||||
|
||||
}
|
||||
|
||||
public ChatServerStatus(boolean online) {
|
||||
this.online = online;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
online = getBoolean(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 7;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort( data, 2);
|
||||
addInt( data, CRC);
|
||||
addBoolean(data, online);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
package network.packets.swg.zone.insertion;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import resources.Location;
|
||||
import resources.Race;
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class CmdStartScene extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x3AE6DFAE;
|
||||
|
||||
private boolean ignoreLayoutFiles;
|
||||
private long charId;
|
||||
private String terrain;
|
||||
private Race race;
|
||||
private Location l;
|
||||
private long galacticTime;
|
||||
|
||||
public CmdStartScene() {
|
||||
ignoreLayoutFiles = false;
|
||||
charId = 0;
|
||||
terrain = "";
|
||||
race = Race.HUMAN;
|
||||
l = new Location();
|
||||
galacticTime = 0;
|
||||
}
|
||||
|
||||
public CmdStartScene(boolean ignoreLayoutFiles, long charId, String terrain, String race, Location l, long galacticTime) {
|
||||
this.ignoreLayoutFiles = ignoreLayoutFiles;
|
||||
this.charId = charId;
|
||||
this.terrain = terrain;
|
||||
this.race = Race.HUMAN;
|
||||
this.l = l;
|
||||
this.galacticTime = galacticTime;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
ignoreLayoutFiles = getBoolean(data);
|
||||
charId = getLong(data);
|
||||
terrain = getAscii(data);
|
||||
l.setX(getFloat(data));
|
||||
l.setY(getFloat(data));
|
||||
l.setZ(getFloat(data));
|
||||
getFloat(data);
|
||||
race = Race.getRace(getAscii(data));
|
||||
galacticTime = getLong(data);
|
||||
getInt(data); // 0x8EB5EA4E
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 47 + terrain.length() + race.getIFF().length();
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort( data, 2);
|
||||
addInt( data, CRC);
|
||||
addBoolean(data, ignoreLayoutFiles);
|
||||
addLong( data, charId);
|
||||
addAscii( data, terrain);
|
||||
addFloat( data, l.getX());
|
||||
addFloat( data, l.getY());
|
||||
addFloat( data, l.getZ());
|
||||
addFloat( data, 0);
|
||||
addAscii( data, race.getIFF());
|
||||
addLong( data, galacticTime);
|
||||
addInt (data, 0x8EB5EA4E);
|
||||
return data;
|
||||
}
|
||||
|
||||
public long getCharacterId() { return charId; }
|
||||
public String getTerrain() { return terrain; }
|
||||
public Location getLocation() { return l; }
|
||||
public Race getRace() { return race; }
|
||||
public long getGalacticTime() { return galacticTime; }
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package network.packets.swg.zone.insertion;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ConnectPlayerMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x2E365218;
|
||||
|
||||
public ConnectPlayerMessage() {
|
||||
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int length = 10;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addInt( data, 0);
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package network.packets.swg.zone.insertion;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class SelectCharacter extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xB5098D76;
|
||||
|
||||
private long charId = 0;
|
||||
|
||||
public SelectCharacter() {
|
||||
|
||||
}
|
||||
|
||||
public SelectCharacter(long id) {
|
||||
this.charId = id;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
charId = getLong(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(14);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addLong( data, charId);
|
||||
return data;
|
||||
}
|
||||
|
||||
public long getCharacterId() { return charId; }
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package network.packets.swg.zone.object_controller;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
||||
public class CommandQueueDequeue extends ObjectController {
|
||||
|
||||
public static final int CRC = 0x0117;
|
||||
private int counter;
|
||||
private float timer;
|
||||
private int error;
|
||||
private int action;
|
||||
|
||||
public CommandQueueDequeue() {
|
||||
|
||||
}
|
||||
|
||||
public CommandQueueDequeue(ByteBuffer data) {
|
||||
decodeAsObjectController(data);
|
||||
}
|
||||
|
||||
public void decodeAsObjectController(ByteBuffer data) {
|
||||
counter = getInt(data);
|
||||
timer = getFloat(data);
|
||||
error = getInt(data);
|
||||
action = getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encodeAsObjectController() {
|
||||
ByteBuffer data = ByteBuffer.allocate(16);
|
||||
addInt(data, counter);
|
||||
addFloat(data, timer);
|
||||
addInt(data, error);
|
||||
addInt(data, action);
|
||||
return data;
|
||||
}
|
||||
|
||||
public int getCounter() {
|
||||
return counter;
|
||||
}
|
||||
|
||||
public float getTimer() {
|
||||
return timer;
|
||||
}
|
||||
|
||||
public int getError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
public int getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package network.packets.swg.zone.object_controller;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
||||
public class CommandQueueEnqueue extends ObjectController {
|
||||
|
||||
public static final int CRC = 0x0116;
|
||||
private int counter = 0;
|
||||
private int crc = 0;
|
||||
private long targetId = 0;
|
||||
private String arguments = "";
|
||||
|
||||
public CommandQueueEnqueue() {
|
||||
|
||||
}
|
||||
|
||||
public CommandQueueEnqueue(ByteBuffer data) {
|
||||
decodeAsObjectController(data);
|
||||
}
|
||||
|
||||
public void decodeAsObjectController(ByteBuffer data) {
|
||||
counter = getInt(data);
|
||||
crc = getInt(data);
|
||||
targetId = getLong(data);
|
||||
arguments = getUnicode(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encodeAsObjectController() {
|
||||
int length = 20 + arguments.length() * 2;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addInt(data, counter);
|
||||
addInt(data, crc);
|
||||
addLong(data, targetId);
|
||||
addUnicode(data, arguments);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package network.packets.swg.zone.object_controller;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import resources.Location;
|
||||
|
||||
|
||||
public class DataTransform extends ObjectController{
|
||||
|
||||
public static final int CRC = 0x0071;
|
||||
private int updateCounter = 0;
|
||||
private Location l;
|
||||
private float speed = 0;
|
||||
|
||||
public DataTransform() {
|
||||
l = new Location();
|
||||
}
|
||||
|
||||
public DataTransform(Location l) {
|
||||
this.l = l;
|
||||
}
|
||||
|
||||
public DataTransform(ByteBuffer data) {
|
||||
decodeAsObjectController(data);
|
||||
}
|
||||
|
||||
public void decodeAsObjectController(ByteBuffer data) {
|
||||
getInt(data);
|
||||
getInt(data);
|
||||
updateCounter = getInt(data);
|
||||
l = getLocation(data);
|
||||
speed = getFloat(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encodeAsObjectController() {
|
||||
int length = 36;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addInt(data, updateCounter);
|
||||
addLocation(data, l);
|
||||
addFloat(data, speed);
|
||||
return data;
|
||||
}
|
||||
|
||||
public int getUpdateCounter() { return updateCounter; }
|
||||
public Location getLocation() { return l; }
|
||||
public float getSpeed() { return speed; }
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package network.packets.swg.zone.object_controller;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class ObjectController extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x80CE5E46;
|
||||
|
||||
private int header2 = 0;
|
||||
private int update = 0;
|
||||
private long objId = 0;
|
||||
private ObjectController obj;
|
||||
|
||||
public ObjectController() {
|
||||
|
||||
}
|
||||
|
||||
public ObjectController(int header, long objId, ObjectController obj) {
|
||||
this.header2 = header;
|
||||
this.objId = objId;
|
||||
this.obj = obj;
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
update = getInt(data);
|
||||
header2 = getInt(data);
|
||||
objId = getLong(data);
|
||||
getInt(data);
|
||||
byte [] rData = new byte[data.remaining()];
|
||||
data.get(rData);
|
||||
getDecodingObject(objId, header2, ByteBuffer.wrap(rData));
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
byte [] objData = obj.encodeAsObjectController().array();
|
||||
int length = 26 + objData.length;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addInt (data, update);
|
||||
addInt( data, header2);
|
||||
addLong( data, objId);
|
||||
addInt( data, 0);
|
||||
data.put(objData);
|
||||
return data;
|
||||
}
|
||||
|
||||
private void getDecodingObject(long id, int header, ByteBuffer data) {
|
||||
String hex = new String(Integer.toHexString(header)).toUpperCase();
|
||||
obj = null;
|
||||
switch (header) {
|
||||
case 0x00000071: obj = new DataTransform(data); break;
|
||||
case 0x00000116: obj = new CommandQueueEnqueue(data); break;
|
||||
case 0x00000117: obj = new CommandQueueDequeue(data); break;
|
||||
case 0x00000131: obj = new PostureUpdate(data); break;
|
||||
// default: System.out.println("Unprocessed Object Controller: " + header + "[0x" + hex + "]"); break;
|
||||
}
|
||||
}
|
||||
|
||||
public ByteBuffer encodeAsObjectController() { return ByteBuffer.allocate(0); }
|
||||
public void decodeAsObjectController(ByteBuffer data) { }
|
||||
|
||||
public long getObjectId() { return objId; }
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package network.packets.swg.zone.object_controller;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import resources.Posture;
|
||||
|
||||
public class PostureUpdate extends ObjectController {
|
||||
|
||||
public static final int CRC = 0x00000131;
|
||||
|
||||
private Posture posture;
|
||||
|
||||
public PostureUpdate() {
|
||||
this((byte)0);
|
||||
}
|
||||
|
||||
public PostureUpdate(Posture posture) {
|
||||
this.posture = posture;
|
||||
}
|
||||
|
||||
public PostureUpdate(byte posture) {
|
||||
this.posture = Posture.getFromId(posture);
|
||||
}
|
||||
|
||||
public PostureUpdate(ByteBuffer data) {
|
||||
decodeAsObjectController(data);
|
||||
}
|
||||
|
||||
public void decodeAsObjectController(ByteBuffer data) {
|
||||
posture = Posture.getFromId(data.get());
|
||||
data.get();
|
||||
}
|
||||
|
||||
public ByteBuffer encodeAsObjectController() {
|
||||
ByteBuffer data = ByteBuffer.allocate(2);
|
||||
data.put(posture.getId());
|
||||
data.put((byte)1);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
public Posture getPosture() { return posture; }
|
||||
public void setPosture(byte posture) { this.posture = Posture.getFromId(posture); }
|
||||
public void setPosture(Posture posture) { this.posture = posture; }
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package network.packets.swg.zone.object_controller;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
||||
public class SpatialChat extends ObjectController {
|
||||
|
||||
public static final int CRC = 0x00F4;
|
||||
private long sourceId = 0;
|
||||
private long targetId = 0;
|
||||
private String text = "";
|
||||
private int balloonSize = 5;
|
||||
private int balloonType = 0;
|
||||
|
||||
public SpatialChat() {
|
||||
|
||||
}
|
||||
|
||||
public SpatialChat(long sourceId, long targetId, String text, int balloonType) {
|
||||
this.sourceId = sourceId;
|
||||
this.targetId = targetId;
|
||||
this.text = text;
|
||||
this.balloonType = balloonType;
|
||||
}
|
||||
|
||||
public SpatialChat(ByteBuffer data) {
|
||||
decodeAsObjectController(data);
|
||||
}
|
||||
|
||||
public void decodeAsObjectController(ByteBuffer data) {
|
||||
sourceId = getLong(data);
|
||||
targetId = getLong(data);
|
||||
text = getUnicode(data);
|
||||
getInt(data);
|
||||
balloonSize = getShort(data);
|
||||
balloonType = getShort(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encodeAsObjectController() {
|
||||
int length = 44 + text.length() * 2;
|
||||
ByteBuffer data = ByteBuffer.allocate(length);
|
||||
addLong(data, sourceId);
|
||||
addLong(data, targetId);
|
||||
addUnicode(data, text);
|
||||
addInt(data, 0);
|
||||
addShort(data, balloonSize);
|
||||
addShort(data, balloonType);
|
||||
addInt(data, 0);
|
||||
addInt(data, 0);
|
||||
addInt(data, 0);
|
||||
addInt(data, 0);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
package network.packets.swg.zone.server_ui;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class SuiCreatePageMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xD44B7259;
|
||||
|
||||
private int windowId;
|
||||
private String scriptName;
|
||||
private List <SuiWindowComponent> components;
|
||||
private long objectId;
|
||||
private float maxDistance;
|
||||
|
||||
public SuiCreatePageMessage() {
|
||||
this(0, "", new ArrayList<SuiWindowComponent>(), 0, 0);
|
||||
}
|
||||
|
||||
public SuiCreatePageMessage(int windowId, String scriptName, List <SuiWindowComponent> components, long objectId, float maxDistance) {
|
||||
this.windowId = windowId;
|
||||
this.scriptName = scriptName;
|
||||
this.components = components;
|
||||
this.objectId = objectId;
|
||||
this.maxDistance = maxDistance;
|
||||
}
|
||||
|
||||
public SuiCreatePageMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
windowId = getInt(data);
|
||||
scriptName = getAscii(data);
|
||||
int compSize = getInt(data);
|
||||
components.clear();
|
||||
for (int compI = 0; compI < compSize; compI++) {
|
||||
SuiWindowComponent comp = new SuiWindowComponent();
|
||||
comp.setType(getByte(data));
|
||||
int wideSize = getInt(data);
|
||||
for (int wideI = 0; wideI < wideSize; wideI++)
|
||||
comp.getWideParams().add(getUnicode(data));
|
||||
int narrowSize = getInt(data);
|
||||
for (int narrowI = 0; narrowI < narrowSize; narrowI++)
|
||||
comp.getNarrowParams().add(getAscii(data));
|
||||
components.add(comp);
|
||||
}
|
||||
objectId = getLong(data);
|
||||
maxDistance = getFloat(data);
|
||||
getLong(data);
|
||||
getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int extraSize = 0;
|
||||
for (SuiWindowComponent comp : components) {
|
||||
extraSize += 9;
|
||||
for (String s : comp.getWideParams())
|
||||
extraSize += 4 + s.length()*2;
|
||||
for (String s : comp.getNarrowParams())
|
||||
extraSize += 2 + s.length();
|
||||
}
|
||||
ByteBuffer data = ByteBuffer.allocate(40+scriptName.length()+extraSize);
|
||||
addShort(data, 2);
|
||||
addInt( data, CRC);
|
||||
addInt (data, windowId);
|
||||
addAscii(data, scriptName);
|
||||
addInt (data, components.size());
|
||||
for (SuiWindowComponent comp : components) {
|
||||
addByte(data, comp.getType());
|
||||
addInt (data, comp.getWideParams().size());
|
||||
for (String wide : comp.getWideParams())
|
||||
addUnicode(data, wide);
|
||||
addInt (data, comp.getNarrowParams().size());
|
||||
for (String narrow : comp.getNarrowParams())
|
||||
addAscii(data, narrow);
|
||||
}
|
||||
addLong (data, objectId);
|
||||
addFloat(data, maxDistance);
|
||||
addLong (data, 0);
|
||||
addInt (data, 0);
|
||||
return data;
|
||||
}
|
||||
|
||||
public static class SuiWindowComponent {
|
||||
|
||||
private byte type;
|
||||
private List <String> narrowParams = new ArrayList<String>();
|
||||
private List <String> wideParams = new ArrayList<String>();
|
||||
|
||||
public byte getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(byte type) {
|
||||
this.type = type;
|
||||
}
|
||||
public List <String> getNarrowParams() {
|
||||
return narrowParams;
|
||||
}
|
||||
public void setNarrowParams(List <String> narrowParams) {
|
||||
this.narrowParams = narrowParams;
|
||||
}
|
||||
public List <String> getWideParams() {
|
||||
return wideParams;
|
||||
}
|
||||
public void setWideParams(List <String> wideParams) {
|
||||
this.wideParams = wideParams;
|
||||
}
|
||||
public void addNarrowParam(String param) {
|
||||
narrowParams.add(param);
|
||||
}
|
||||
public void addWideParam(String param) {
|
||||
wideParams.add(param);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package network.packets.swg.zone.server_ui;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class SuiEventNotification extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x092D3564;
|
||||
|
||||
private int windowId;
|
||||
private boolean action;
|
||||
private List <String> dataStrings;
|
||||
|
||||
public SuiEventNotification() {
|
||||
this(0, false, new String[0]);
|
||||
}
|
||||
|
||||
public SuiEventNotification(int windowId, boolean action, String [] strings) {
|
||||
this(windowId, action, new ArrayList<String>(Arrays.asList(strings)));
|
||||
}
|
||||
|
||||
public SuiEventNotification(int windowId, boolean action, List <String> strings) {
|
||||
this.windowId = windowId;
|
||||
this.action = action;
|
||||
this.dataStrings = strings;
|
||||
}
|
||||
|
||||
public SuiEventNotification(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
windowId = getInt(data);
|
||||
action = getInt(data) != 0;
|
||||
int size = getInt(data);
|
||||
size = getInt(data); // loljk, the size is this
|
||||
for (int i = 0; i < size; i++) {
|
||||
dataStrings.add(getUnicode(data));
|
||||
}
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int extraSize = 0;
|
||||
for (String s : dataStrings)
|
||||
extraSize += 4 + s.length()*2;
|
||||
ByteBuffer data = ByteBuffer.allocate(22+extraSize);
|
||||
addShort(data, 2);
|
||||
addInt (data, CRC);
|
||||
addInt (data, windowId);
|
||||
addInt (data, action?0xFFFFFFFF : 0);
|
||||
addInt (data, dataStrings.size());
|
||||
addInt (data, dataStrings.size());
|
||||
for (String s : dataStrings)
|
||||
addUnicode(data, s);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package network.packets.swg.zone.spatial;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class AttributeListMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xF3F12F2A;
|
||||
|
||||
private long objectId;
|
||||
private Map <String, String> attributes;
|
||||
|
||||
public AttributeListMessage() {
|
||||
this(0, new HashMap<String, String>());
|
||||
}
|
||||
|
||||
public AttributeListMessage(long objectId, Map <String, String> attributes) {
|
||||
this.objectId = objectId;
|
||||
this.attributes = attributes;
|
||||
}
|
||||
|
||||
public AttributeListMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
objectId = getLong(data);
|
||||
getShort(data);
|
||||
int count = getInt(data);
|
||||
for (int i = 0; i < count; i++) {
|
||||
String name = getAscii(data);
|
||||
String attr = getUnicode(data);
|
||||
attributes.put(name, attr);
|
||||
}
|
||||
getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
int size = 0;
|
||||
for (Entry <String, String> e : attributes.entrySet()) {
|
||||
size += 6 + e.getKey().length() + e.getValue().length();
|
||||
}
|
||||
ByteBuffer data = ByteBuffer.allocate(18 + size);
|
||||
addShort(data, 3);
|
||||
addInt (data, CRC);
|
||||
addLong (data, objectId);
|
||||
addShort(data, 0);
|
||||
addInt (data, attributes.size());
|
||||
for (Entry <String, String> e : attributes.entrySet()) {
|
||||
addAscii(data, e.getKey());
|
||||
addUnicode(data, e.getValue());
|
||||
}
|
||||
addInt (data, 0);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
package network.packets.swg.zone.spatial;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class GetMapLocationsMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x1A7AB839;
|
||||
|
||||
private String planet;
|
||||
private float x;
|
||||
private float y;
|
||||
private boolean category;
|
||||
private boolean subcategory;
|
||||
private boolean icon;
|
||||
|
||||
public GetMapLocationsMessage() {
|
||||
this("", 0, 0, false, false, false);
|
||||
}
|
||||
|
||||
public GetMapLocationsMessage(String planet, float x, float y, boolean category, boolean subcategory, boolean icon) {
|
||||
this.planet = planet;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.category = category;
|
||||
this.subcategory = subcategory;
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
public GetMapLocationsMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
planet = getAscii(data);
|
||||
x = getFloat(data);
|
||||
y = getFloat(data);
|
||||
category = getByte(data) != 0;
|
||||
subcategory = getByte(data) != 0;
|
||||
icon = getByte(data) != 0;
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(19 + planet.length());
|
||||
addShort(data, 28);
|
||||
addInt (data, CRC);
|
||||
addAscii(data, planet);
|
||||
addFloat(data, x);
|
||||
addFloat(data, y);
|
||||
addByte (data, category ? 1 : 0);
|
||||
addByte (data, subcategory ? 1 : 0);
|
||||
addByte (data, icon ? 1 : 0);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
package network.packets.swg.zone.spatial;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class NewTicketActivityResponseMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0x6EA42D80;
|
||||
|
||||
public NewTicketActivityResponseMessage() {
|
||||
|
||||
}
|
||||
|
||||
public NewTicketActivityResponseMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
getByte(data);
|
||||
getInt(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(11);
|
||||
addShort(data, 2);
|
||||
addInt (data, CRC);
|
||||
addByte (data, 0);
|
||||
addInt (data, 1);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package network.packets.swg.zone.spatial;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import network.packets.swg.SWGPacket;
|
||||
|
||||
public class StopClientEffectObjectByLabelMessage extends SWGPacket {
|
||||
|
||||
public static final int CRC = 0xAD6F6B26;
|
||||
|
||||
private long objectId;
|
||||
private String effect;
|
||||
|
||||
public StopClientEffectObjectByLabelMessage() {
|
||||
|
||||
}
|
||||
|
||||
public StopClientEffectObjectByLabelMessage(long objectId, String effect) {
|
||||
this.objectId = objectId;
|
||||
this.effect = effect;
|
||||
}
|
||||
|
||||
public StopClientEffectObjectByLabelMessage(ByteBuffer data) {
|
||||
decode(data);
|
||||
}
|
||||
|
||||
public void decode(ByteBuffer data) {
|
||||
if (!super.decode(data, CRC))
|
||||
return;
|
||||
objectId = getLong(data);
|
||||
effect = getAscii(data);
|
||||
getByte(data);
|
||||
}
|
||||
|
||||
public ByteBuffer encode() {
|
||||
ByteBuffer data = ByteBuffer.allocate(6);
|
||||
addShort(data, 4);
|
||||
addInt (data, CRC);
|
||||
addLong (data, objectId);
|
||||
addAscii(data, effect);
|
||||
addByte (data, 1);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package services;
|
||||
|
||||
import me.joshlarson.control.Manager;
|
||||
|
||||
public class CoreManager extends Manager {
|
||||
|
||||
private long startTime;
|
||||
private EngineManager engineManager;
|
||||
|
||||
public CoreManager() {
|
||||
engineManager = new EngineManager();
|
||||
|
||||
addChildManager(engineManager);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether or not the core is operational
|
||||
* @return TRUE if the core is operational, FALSE otherwise
|
||||
*/
|
||||
public boolean isOperational() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean initialize() {
|
||||
startTime = System.nanoTime();
|
||||
return super.initialize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the time in milliseconds since the server started initialization
|
||||
* @return the core time represented as a double
|
||||
*/
|
||||
public double getCoreTime() {
|
||||
return (System.nanoTime()-startTime)/1E6;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user