Conflicts:
	src/main/NGECore.java
This commit is contained in:
Light2
2014-04-11 23:53:15 +02:00
268 changed files with 6673 additions and 742 deletions
@@ -22,7 +22,6 @@
package protocol.swg;
import java.nio.ByteOrder;
import java.util.Map.Entry;
import org.apache.mina.core.buffer.IoBuffer;
import org.apache.mina.core.buffer.SimpleBufferAllocator;
@@ -99,7 +99,7 @@ public class CharacterSheetResponseMessage extends SWGMessage {
buffer.put(getUnicodeString(spouse));
buffer.putInt(10); // lots remaining
buffer.putInt(creature.getPlayerObject().getLotsRemaining()); // lots remaining
return buffer.flip();
}
@@ -25,8 +25,6 @@ import java.nio.ByteOrder;
import java.util.Map;
import java.util.Map.Entry;
import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import services.collections.ServerFirst;
-1
View File
@@ -27,7 +27,6 @@ import org.apache.mina.core.buffer.IoBuffer;
import resources.common.Console;
import resources.common.StringUtilities;
import engine.resources.common.CRC;
public class CommPlayerMessage extends SWGMessage {
@@ -22,20 +22,23 @@
package protocol.swg;
import java.nio.ByteOrder;
import java.util.concurrent.ConcurrentHashMap;
import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import services.chat.ChatRoom;
import services.travel.TravelPoint;
import engine.resources.objects.SWGObject;
public class ChatRoomList extends SWGMessage {
@SuppressWarnings("unused")
public class EnterStructurePlacementModeMessage extends SWGMessage {
private ConcurrentHashMap<Integer, ChatRoom> chatRooms;
public ChatRoomList(ConcurrentHashMap<Integer, ChatRoom> chatRooms) {
this.chatRooms = chatRooms;
private SWGObject deed;
private String structureTemplate;
public EnterStructurePlacementModeMessage(SWGObject deed, String structureTemplate) {
this.deed = deed;
this.structureTemplate = structureTemplate;
}
@Override
@@ -45,32 +48,17 @@ public class ChatRoomList extends SWGMessage {
@Override
public IoBuffer serialize() {
String server = NGECore.getInstance().getGalaxyName();
IoBuffer buffer = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN);
buffer.setAutoExpand(true);
IoBuffer result = IoBuffer.allocate(16 + structureTemplate.length()).order(ByteOrder.LITTLE_ENDIAN);
buffer.putShort((short) 2);
buffer.putInt(0x70DEB197);
result.putShort((short) 3);
result.putInt(0xE8A54DC1);
buffer.putInt(chatRooms.size());
chatRooms.forEach((key, value) -> {
if (value.isVisible()) {
buffer.putInt(value.getRoomId());
buffer.putInt((int) ((value.isPrivateRoom() ? 1 : 0)));
buffer.put((byte) ((value.isModeratorsOnly() ? 1 : 0)));
buffer.put(getAsciiString(value.getRoomAddress()));
buffer.put(getAsciiString("SWG"));
buffer.put(getAsciiString(server));
buffer.put(getAsciiString(value.getOwner()));
buffer.put(getAsciiString("SWG"));
buffer.put(getAsciiString(server));
buffer.put(getAsciiString(value.getCreator()));
buffer.put(getUnicodeString(value.getDescription()));
buffer.putInt(0); // moderator list (not used by client)
buffer.putInt(0); // user list (not used by client)
}
});
return buffer.flip();
result.putLong(deed.getObjectID());
deed.setAttachment("structureTemplate", structureTemplate);
result.put(getAsciiString(structureTemplate));
return result.flip();
}
}
}
@@ -2,9 +2,6 @@ package protocol.swg;
import org.apache.mina.core.buffer.IoBuffer;
import resources.common.Console;
import resources.common.StringUtilities;
public class GuildRequestMessage extends SWGMessage {
private long characterId;
@@ -25,11 +25,6 @@ import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import resources.common.Console;
import resources.common.StringUtilities;
import resources.guild.Guild;
import resources.objects.creature.CreatureObject;
public class GuildResponseMessage extends SWGMessage {
private long player;
@@ -32,7 +32,6 @@ import protocol.swg.objectControllerObjects.DataTransform;
import protocol.swg.objectControllerObjects.DataTransformWithParent;
import protocol.swg.objectControllerObjects.ObjControllerObject;
import protocol.swg.objectControllerObjects.UnknownObjController;
import resources.common.StringUtilities;
public class ObjControllerMessage extends SWGMessage {
@@ -34,8 +34,6 @@ import protocol.swg.SWGMessage;
import resources.objects.creature.CreatureObject;
import resources.objects.resource.GalacticResource;
import resources.objects.tangible.TangibleObject;
import resources.objects.tool.SurveyTool;
public class ResourceListForSurveyMessage extends SWGMessage {
@@ -71,7 +69,7 @@ public class ResourceListForSurveyMessage extends SWGMessage {
Vector<GalacticResource> planetVector = core.resourceService.getSpawnedResourcesByPlanetAndType(surveyor.getPlanetId(),generalType);
resourceList = new ArrayList(planetVector);
resourceList = new ArrayList<GalacticResource>(planetVector);
}
+1
View File
@@ -24,6 +24,7 @@ package protocol.swg;
import java.nio.ByteBuffer;
import protocol.Message;
import protocol.swg.chat.ChatInstantMessageToCharacter;
public class SWGMessageFactory {
+1 -1
View File
@@ -63,7 +63,7 @@ public class SurveyMapUpdateMessage extends SWGMessage {
highestConcentration = concentration;
}
}
int size = buffer.position();
//int size = buffer.position();
buffer.flip();
}
+69
View File
@@ -0,0 +1,69 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.chat;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatCreateRoom extends SWGMessage {
private String address, title;
private boolean privacy, moderatorOnly;
private int request;
public ChatCreateRoom() { }
@Override
public void deserialize(IoBuffer data) {
this.privacy = (boolean) ((data.get() == 1) ? false : true);
this.moderatorOnly = (boolean) ((data.get() == 1) ? true : false);
data.getShort(); // unk
this.address = getAsciiString(data);
this.title = getAsciiString(data);
this.request = data.getInt();
}
@Override
public IoBuffer serialize() {
return null;
}
public String getAddress() {
return address;
}
public String getTitle() {
return title;
}
public boolean isPrivacy() {
return privacy;
}
public boolean isModeratorOnly() {
return moderatorOnly;
}
public int getRequest() {
return request;
}
}
@@ -19,10 +19,12 @@
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
package protocol.swg.chat;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatDeletePersistentMessage extends SWGMessage {
@@ -19,19 +19,27 @@
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
package protocol.swg.chat;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatEnterRoomById extends SWGMessage {
private int roomId;
private int requestId;
public ChatEnterRoomById() { }
@Override
public void deserialize(IoBuffer data) {
setRoomId(data.getInt());
data.getShort();
data.getInt();
this.requestId = data.getInt();
this.roomId = data.getInt();
// getAsciiString(data); // name of the room but don't need it since we have id.
}
@Override
@@ -39,12 +47,12 @@ public class ChatEnterRoomById extends SWGMessage {
return null;
}
public int getRequestId() {
return requestId;
}
public int getRoomId() {
return roomId;
}
public void setRoomId(int roomId) {
this.roomId = roomId;
}
}
@@ -1,4 +1,4 @@
package protocol.swg;
package protocol.swg.chat;
import java.nio.ByteOrder;
@@ -6,6 +6,8 @@ import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatFriendsListUpdate extends SWGMessage {
private String friendName;
@@ -19,13 +19,15 @@
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
package protocol.swg.chat;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
@SuppressWarnings("unused")
public class ChatInstantMessageToCharacter extends SWGMessage {
@@ -19,12 +19,14 @@
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
package protocol.swg.chat;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatInstantMessagetoClient extends SWGMessage{
@@ -19,12 +19,14 @@
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
package protocol.swg.chat;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatOnAddFriend extends SWGMessage {
@Override
@@ -19,7 +19,7 @@
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
package protocol.swg.chat;
import java.nio.ByteOrder;
@@ -27,6 +27,7 @@ import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
import engine.resources.config.Config;
public class ChatOnChangeFriendStatus extends SWGMessage {
@@ -1,47 +1,48 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
import org.apache.mina.core.buffer.IoBuffer;
import services.chat.ChatRoom;
public class ChatOnCreateRoom extends SWGMessage {
private ChatRoom room;
public ChatOnCreateRoom(ChatRoom room) {
this.room = room;
}
@Override
public void deserialize(IoBuffer data) {
}
@Override
public IoBuffer serialize() {
// TODO Auto-generated method stub
return null;
}
}
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.chat;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatOnConnectAvatar extends SWGMessage {
public ChatOnConnectAvatar() { }
@Override
public void deserialize(IoBuffer data) {
}
@Override
public IoBuffer serialize() {
IoBuffer buffer = IoBuffer.allocate(6).order(ByteOrder.LITTLE_ENDIAN);
buffer.putShort((short) 1);
buffer.putInt(0xD72FE9BE);
return buffer.flip();
}
}
@@ -0,0 +1,94 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.chat;
import java.nio.ByteOrder;
import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
import services.chat.ChatRoom;
public class ChatOnCreateRoom extends SWGMessage {
private ChatRoom room;
private int error;
private int requestId;
public ChatOnCreateRoom(ChatRoom room, int error, int requestId) {
this.room = room;
this.error = error;
this.requestId = requestId;
}
@Override
public void deserialize(IoBuffer data) {
}
@Override
public IoBuffer serialize() {
String server = NGECore.getInstance().getGalaxyName();
IoBuffer data = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN);
data.setAutoExpand(true);
data.putShort((short) 4);
data.putInt(0x35D7CC9F);
data.putInt(error);
data.putInt(room.getRoomId());
data.putInt(room.isPrivateRoom() ? 0 : 1);
data.put((byte) (room.isModeratorsOnly() ? 1 : 0));
data.put(getAsciiString(room.getRoomAddress()));
data.put(getAsciiString("SWG"));
data.put(getAsciiString(server));
data.put(getAsciiString(room.getCreator()));
data.put(getAsciiString("SWG"));
data.put(getAsciiString(server));
data.put(getAsciiString(room.getOwner()));
data.put(getUnicodeString(room.getDescription()));
data.putInt(0);
/*if (room.getModeratorList().size() > 0) {
for (CreatureObject creo : room.getModeratorList()) {
data.put(getAsciiString("SWG"));
data.put(getAsciiString(server));
data.put(getAsciiString(creo.getCustomName()));
}
}*/
data.putInt(0);
/*if (room.getUserList().size() > 0) {
for (CreatureObject creo : room.getUserList()) {
data.put(getAsciiString("SWG"));
data.put(getAsciiString(server));
data.put(getAsciiString(creo.getCustomName()));
}
}*/
data.putInt(requestId);
return data.flip();
}
}
@@ -19,7 +19,7 @@
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
package protocol.swg.chat;
import java.nio.ByteOrder;
@@ -27,6 +27,7 @@ import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
import engine.resources.common.CRC;
import resources.common.Opcodes;
@@ -62,6 +63,7 @@ public class ChatOnEnteredRoom extends SWGMessage {
buffer.put(getAsciiString(characterName));
buffer.putInt(success);
buffer.putInt(roomId);
buffer.putInt(0);
return buffer.flip();
}
@@ -1,4 +1,4 @@
package protocol.swg;
package protocol.swg.chat;
import java.nio.ByteOrder;
import java.util.List;
@@ -7,6 +7,7 @@ import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
import resources.objects.player.PlayerObject;
// This is possibly unused
@@ -19,12 +19,14 @@
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
package protocol.swg.chat;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatOnSendInstantMessage extends SWGMessage {
private int errorType;
@@ -19,12 +19,14 @@
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
package protocol.swg.chat;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatOnSendPersistentMessage extends SWGMessage {
@@ -19,12 +19,14 @@
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
package protocol.swg.chat;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatOnSendRoomMessage extends SWGMessage {
private int errorCode;
@@ -19,11 +19,14 @@
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
package protocol.swg.chat;
import java.nio.ByteOrder;
import java.util.List;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
import services.chat.WaypointAttachment;
@@ -19,13 +19,16 @@
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
package protocol.swg.chat;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
import services.chat.WaypointAttachment;
@@ -0,0 +1,113 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.chat;
import java.nio.ByteOrder;
import java.util.Vector;
import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
import resources.objects.creature.CreatureObject;
import services.chat.ChatRoom;
public class ChatQueryRoomResults extends SWGMessage {
private ChatRoom room;
private int requestId;
public ChatQueryRoomResults(ChatRoom room, int requestId) {
this.room = room;
this.requestId = requestId;
}
@Override
public void deserialize(IoBuffer data) {
}
@Override
public IoBuffer serialize() {
String server = NGECore.getInstance().getGalaxyName();
IoBuffer buffer = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN);
buffer.putShort((short) 7);
buffer.putInt(0xC4DE864E);
Vector<String> users = room.getUserList();
buffer.putInt(users.size());
if (users.size() > 0) {
for (String str : users) {
buffer.put(getAsciiString("SWG"));
buffer.put(getAsciiString(server));
buffer.put(getAsciiString(str));
}
}
buffer.putInt(0); // TODO: Invited list for chat rooms
Vector<String> moderators = room.getModeratorList();
buffer.putInt(moderators.size());
if (moderators.size() > 0) {
for (String str : moderators) {
buffer.put(getAsciiString("SWG"));
buffer.put(getAsciiString(server));
buffer.put(getAsciiString(str));
}
}
Vector<String> banned = room.getBanList();
buffer.putInt(banned.size());
if (banned.size() > 0) {
for (String str : banned) {
buffer.put(getAsciiString("SWG"));
buffer.put(getAsciiString(server));
buffer.put(getAsciiString(str));
}
}
buffer.putInt(requestId);
buffer.putInt(room.getRoomId());
buffer.putInt(room.isPrivateRoom() ? 0 : 1);
buffer.put((byte) (room.isModeratorsOnly() ? 1 : 0));
buffer.put(getAsciiString(room.getRoomAddress()));
buffer.put(getAsciiString("SWG"));
buffer.put(getAsciiString(server));
buffer.put(getAsciiString(room.getOwner()));
buffer.put(getAsciiString("SWG"));
buffer.put(getAsciiString(server));
buffer.put(getAsciiString(room.getCreator()));
buffer.put(getUnicodeString(room.getDescription()));
buffer.putInt(0); // moderator list
buffer.putInt(0); // user list
return buffer.flip();
}
}
@@ -19,10 +19,12 @@
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
package protocol.swg.chat;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatRequestPersistentMessage extends SWGMessage {
+102
View File
@@ -0,0 +1,102 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.chat;
import java.nio.ByteOrder;
import java.util.concurrent.ConcurrentHashMap;
import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
import services.chat.ChatRoom;
public class ChatRoomList extends SWGMessage {
private ConcurrentHashMap<Integer, ChatRoom> chatRooms;
private ChatRoom room;
public ChatRoomList(ConcurrentHashMap<Integer, ChatRoom> chatRooms) {
this.chatRooms = chatRooms;
}
public ChatRoomList(ChatRoom room) {
this.room = room;
}
@Override
public void deserialize(IoBuffer data) {
}
@Override
public IoBuffer serialize() {
String server = NGECore.getInstance().getGalaxyName();
IoBuffer buffer = IoBuffer.allocate(53).order(ByteOrder.LITTLE_ENDIAN);
buffer.setAutoExpand(true);
buffer.putShort((short) 2);
buffer.putInt(0x70DEB197);
if (room != null) {
buffer.putInt(1);
buffer.putInt(room.getRoomId());
buffer.putInt((int) ((room.isPrivateRoom() ? 1 : 0)));
buffer.put((byte) ((room.isModeratorsOnly() ? 1 : 0)));
buffer.put(getAsciiString(room.getRoomAddress()));
buffer.put(getAsciiString("SWG"));
buffer.put(getAsciiString(server));
buffer.put(getAsciiString(room.getOwner()));
buffer.put(getAsciiString("SWG"));
buffer.put(getAsciiString(server));
buffer.put(getAsciiString(room.getCreator()));
buffer.put(getUnicodeString(room.getDescription()));
buffer.putInt(0); // moderator list (not used by client)
buffer.putInt(0); // user list (not used by client)
} else {
buffer.putInt(chatRooms.size());
chatRooms.forEach((key, value) -> {
if (value.isVisible()) {
buffer.putInt(value.getRoomId());
buffer.putInt((int) ((value.isPrivateRoom() ? 1 : 0)));
buffer.put((byte) ((value.isModeratorsOnly() ? 1 : 0)));
buffer.put(getAsciiString(value.getRoomAddress()));
buffer.put(getAsciiString("SWG"));
buffer.put(getAsciiString(server));
buffer.put(getAsciiString(value.getOwner()));
buffer.put(getAsciiString("SWG"));
buffer.put(getAsciiString(server));
buffer.put(getAsciiString(value.getCreator()));
buffer.put(getUnicodeString(value.getDescription()));
buffer.putInt(0); // moderator list (not used by client)
buffer.putInt(0); // user list (not used by client)
}
});
}
buffer.flip();
//StringUtilities.printBytes(buffer.array());
return buffer;
}
}
@@ -19,7 +19,7 @@
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
package protocol.swg.chat;
import java.nio.ByteOrder;
@@ -27,6 +27,8 @@ import main.NGECore;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatRoomMessage extends SWGMessage {
private String character;
@@ -19,10 +19,12 @@
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
package protocol.swg.chat;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatSendToRoom extends SWGMessage {
private String message;
@@ -0,0 +1,46 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.chat;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class ChatServerStatus extends SWGMessage {
public ChatServerStatus() { }
@Override
public void deserialize(IoBuffer data) {
}
@Override
public IoBuffer serialize() {
IoBuffer buffer = IoBuffer.allocate(7).order(ByteOrder.LITTLE_ENDIAN);
buffer.putShort((short) 2);
buffer.putInt(0x7102B15F);
buffer.put((byte) 1);
return buffer.flip();
}
}
@@ -19,12 +19,13 @@
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
package protocol.swg.chat;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
import resources.common.Opcodes;
public class ChatSystemMessage extends SWGMessage{
@@ -1,38 +1,47 @@
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg;
import org.apache.mina.core.buffer.IoBuffer;
public class ChatCreateRoom extends SWGMessage {
@Override
public void deserialize(IoBuffer data) {
}
@Override
public IoBuffer serialize() {
return null;
}
}
/*******************************************************************************
* Copyright (c) 2013 <Project SWG>
*
* This File is part of NGECore2.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Using NGEngine to work with NGECore2 is making a combined work based on NGEngine.
* Therefore all terms and conditions of the GNU Lesser General Public License cover the combination.
******************************************************************************/
package protocol.swg.chat;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.SWGMessage;
public class VoiceChatStatus extends SWGMessage {
public VoiceChatStatus() { }
@Override
public void deserialize(IoBuffer data) {
}
@Override
public IoBuffer serialize() {
IoBuffer buffer = IoBuffer.allocate(10).order(ByteOrder.LITTLE_ENDIAN);
buffer.putShort((short) 2);
buffer.putInt(0x9E601905);
buffer.putInt(1);
return buffer.flip();
}
}
@@ -25,10 +25,6 @@ import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.Console;
import resources.common.StringUtilities;
public class BiographyUpdate extends ObjControllerObject {
private long objectId;
@@ -33,9 +33,9 @@ public class CombatSpam extends ObjControllerObject{
private long attackerId;
private long defenderId;
private int damage;
private String file;
private String text;
private byte colorFlag;
//private String file;
//private String text;
//private byte colorFlag;
private boolean hit = true;
private boolean critical = false;
private boolean dodge = false;
@@ -21,8 +21,6 @@
******************************************************************************/
package protocol.swg.objectControllerObjects;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Vector;
@@ -30,7 +28,6 @@ import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.IDAttribute;
import resources.common.StringUtilities;
public class ImageDesignMessage extends ObjControllerObject {
@@ -21,11 +21,8 @@
******************************************************************************/
package protocol.swg.objectControllerObjects;
import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.Console;
import resources.common.StringUtilities;
@@ -26,7 +26,6 @@ import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.ObjControllerOpcodes;
import resources.common.OutOfBand;
public class NpcConversationMessage extends ObjControllerObject {
@@ -28,17 +28,14 @@ import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.ConversationOption;
import resources.common.ObjControllerOpcodes;
public class NpcConversationOptions extends ObjControllerObject {
private long npcId;
private long objectId;
private Vector<ConversationOption> conversationOptions = new Vector<ConversationOption>();
public NpcConversationOptions(long objectId, long npcId) {
public NpcConversationOptions(long objectId) {
this.objectId = objectId;
this.npcId = npcId;
}
@Override
@@ -26,8 +26,6 @@ import java.nio.ByteBuffer;
import org.apache.mina.core.buffer.IoBuffer;
import engine.resources.common.Utilities;
public class SetProfessionTemplate extends ObjControllerObject {
private String profession;
@@ -27,7 +27,6 @@ import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.RGB;
import resources.common.StringUtilities;
public class ShowFlyText extends ObjControllerObject {
@@ -22,14 +22,12 @@
package protocol.swg.objectControllerObjects;
import java.nio.ByteOrder;
import java.util.List;
import java.util.Vector;
import org.apache.mina.core.buffer.IoBuffer;
import engine.resources.objects.SWGObject;
import protocol.swg.ObjControllerMessage;
import resources.common.StringUtilities;
public class ShowLootBox extends ObjControllerObject {
@@ -26,7 +26,6 @@ import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.ObjControllerOpcodes;
public class StartNpcConversation extends ObjControllerObject {
@@ -26,7 +26,6 @@ import java.nio.ByteOrder;
import org.apache.mina.core.buffer.IoBuffer;
import protocol.swg.ObjControllerMessage;
import resources.common.ObjControllerOpcodes;
public class StopNpcConversation extends ObjControllerObject {