diff --git a/.gitignore b/.gitignore index 89882a7e..8560d241 100644 --- a/.gitignore +++ b/.gitignore @@ -61,9 +61,6 @@ odb/resourcehistory/je.info.* odb/resourceroots/je.info.* odb/resources/je.info.* -# PSWG Configs -options.cfg - # External tool builders .externalToolBuilders/ @@ -214,4 +211,4 @@ pip-log.txt ############# ## PyCharm ############# -.idea \ No newline at end of file +.idea diff --git a/scripts/commands/afk.py b/scripts/commands/afk.py deleted file mode 100644 index 68670816..00000000 --- a/scripts/commands/afk.py +++ /dev/null @@ -1,13 +0,0 @@ -from resources.datatables import PlayerFlags -import sys - -def setup(): - return - -def run(core, actor, target, commandString): - command = core.commandService.getCommandByName("toggleawayfromkeyboard") - - if command: - core.commandService.processCommand(actor, target, command, 0, commandString) - - return diff --git a/scripts/commands/movefurniture.py b/scripts/commands/movefurniture.py new file mode 100644 index 00000000..3c45c55e --- /dev/null +++ b/scripts/commands/movefurniture.py @@ -0,0 +1,38 @@ +import sys +from engine.resources.scene import Point3D + +def setup(): + return + +def run(core, actor, target, commandString): + tarObj = core.objectService.getObject(actor.getTargetId()) + + container = actor.getContainer() + parsedMsg = commandString.split(' ', 2) + + if core.housingService.getPermissions(actor, container): # i should probably relook into my permissions system... it kinda sucks + if parsedMsg[0] == "up": + core.simulationService.transform(tarObj, Point3D(0, float(parsedMsg[1]) * 0.01, 0)) + return + elif parsedMsg[0] == "down": + core.simulationService.transform(tarObj, Point3D(0, float(parsedMsg[1]) * -0.01, 0)) + return + elif parsedMsg[0] == "forward": + core.simulationService.transform(tarObj, Point3D(0, 0, float(parsedMsg[1]) * 0.01)) + return + elif parsedMsg[0] == "back": + core.simulationService.transform(tarObj, Point3D(0, 0, float(parsedMsg[1]) * -0.01)) + return + elif parsedMsg[0] == "right": + core.simulationService.transform(tarObj, Point3D(float(parsedMsg[1]) * 0.01, 0, 0)) + return + elif parsedMsg[0] == "left": + core.simulationService.transform(tarObj, Point3D(float(parsedMsg[1]) * -0.01, 0, 0)) + return + + elif container.getTemplate() == "object/cell/shared_cell.iff": + actor.sendSystemMessage("You do not have permission to access that container!", 0) + return + + return + \ No newline at end of file diff --git a/scripts/commands/rotatefurniture.py b/scripts/commands/rotatefurniture.py new file mode 100644 index 00000000..9d019d0c --- /dev/null +++ b/scripts/commands/rotatefurniture.py @@ -0,0 +1,29 @@ +import sys +from engine.resources.scene import Point3D + +def setup(): + return + +def run(core, actor, target, commandString): + tarObj = core.objectService.getObject(actor.getTargetId()) + + container = actor.getContainer() + parsedMsg = commandString.split(' ', 2) + + if core.housingService.getPermissions(actor, container): # i should probably relook into my permissions system... it kinda sucks + if parsedMsg[0] == "pitch": + core.simulationService.transform(tarObj, float(parsedMsg[1]), Point3D(1, 0, 0)) # this is messed up ??? + return + elif parsedMsg[0] == "yaw": + core.simulationService.transform(tarObj, float(parsedMsg[1]), Point3D(0, 1, 0)) # this is correct + return + elif parsedMsg[0] == "roll": + core.simulationService.transform(tarObj, float(parsedMsg[1]), Point3D(0, 0, 1)) # this is messed up ??? + return + + elif container.getTemplate() == "object/cell/shared_cell.iff": + actor.sendSystemMessage("You do not have permission to access that container!", 0) + return + + return + \ No newline at end of file diff --git a/scripts/commands/transferitemmisc.py b/scripts/commands/transferitemmisc.py index 5dc726fd..27bfde45 100644 --- a/scripts/commands/transferitemmisc.py +++ b/scripts/commands/transferitemmisc.py @@ -1,18 +1,29 @@ import sys - +from engine.resources.scene import Quaternion + def setup(): return def run(core, actor, target, commandString): + parsedMsg = commandString.split(' ', 3) + objService = core.objectService + containerID = long(parsedMsg[1]) + container = objService.getObject(containerID) + actorContainer = actor.getContainer() + + if actorContainer != None and (container.getTemplate() == "object/cell/shared_cell.iff") & core.housingService.getPermissions(actor, actorContainer): + target.getContainer().transferTo(actor, container, target) + core.simulationService.teleport(target, actor.getPosition(), Quaternion(1,0,0,0), containerID) + return + elif actorContainer != None and container.getTemplate() == "object/cell/shared_cell.iff": + actor.sendSystemMessage("You do not have permission to access that container!", 0) + return + if core.equipmentService.canEquip(actor, target) is False: actor.sendSystemMessage('@error_message:insufficient_skill', 0) return - parsedMsg = commandString.split(' ', 3) - objService = core.objectService - containerID = long(parsedMsg[1]) - container = objService.getObject(containerID) if target and container and target.getContainer(): oldContainer = target.getContainer() diff --git a/scripts/radial/moveable.py b/scripts/radial/moveable.py new file mode 100644 index 00000000..4bbb4120 --- /dev/null +++ b/scripts/radial/moveable.py @@ -0,0 +1,25 @@ +from resources.common import RadialOptions +import sys + +def createRadial(core, owner, target, radials): + radials.clear() + radials.add(RadialOptions(0, 11, 1, '')) + + radials.add(RadialOptions(0, 55, 0, '')) + radials.add(RadialOptions(3, 56, 1, '')) + radials.add(RadialOptions(3, 57, 1, '')) + radials.add(RadialOptions(3, 58, 1, '')) + radials.add(RadialOptions(3, 59, 1, '')) + + radials.add(RadialOptions(0, 52, 0, '')) + radials.add(RadialOptions(4, 53, 1, '')) + radials.add(RadialOptions(4, 54, 1, '')) + return + +def handleSelection(core, owner, target, option): + + if option == 56: + core.commandService.callCommand(owner, 'movefurniture', target, 'forward 10') + + return + \ No newline at end of file diff --git a/scripts/static_travel_points.py b/scripts/static_travel_points.py index 26ac3f85..b1814ec9 100644 --- a/scripts/static_travel_points.py +++ b/scripts/static_travel_points.py @@ -49,8 +49,8 @@ def corelliaPoints(core, planet): def dantooinePoints(core, planet): trvSvc = core.travelService - trvSvc.addTravelPoint(planet, "Imperial Outpost", -635, 3, 2507) - trvSvc.addTravelPoint(planet, "Mining Outpost", -4208, 3, -2350) + trvSvc.addTravelPoint(planet, "Mining Outpost", -635, 3, 2507) + trvSvc.addTravelPoint(planet, "Imperial Outpost", -4208, 3, -2350) trvSvc.addTravelPoint(planet, "Agro Outpost", 1569, 4, -6415) return @@ -149,4 +149,4 @@ def mustafarPoints(core, planet): trvSvc = core.travelService trvSvc.addTravelPoint(planet, "Mensix Mining Facility", 405, 230, -1352) - return \ No newline at end of file + return diff --git a/src/main/NGECore.java b/src/main/NGECore.java index ab271d74..02469dff 100644 --- a/src/main/NGECore.java +++ b/src/main/NGECore.java @@ -43,7 +43,7 @@ import org.apache.mina.core.session.IoSession; import com.sleepycat.je.Transaction; import com.sleepycat.persist.EntityCursor; -import protocol.swg.ChatSystemMessage; +import protocol.swg.chat.ChatSystemMessage; import net.engio.mbassy.bus.config.BusConfiguration; import resources.common.RadialOptions; import resources.common.ThreadMonitor; diff --git a/src/protocol/swg/AttributeListMessage.java b/src/protocol/swg/AttributeListMessage.java index ce9cf865..55721a52 100644 --- a/src/protocol/swg/AttributeListMessage.java +++ b/src/protocol/swg/AttributeListMessage.java @@ -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; diff --git a/src/protocol/swg/CollectionServerFirstListResponse.java b/src/protocol/swg/CollectionServerFirstListResponse.java index 163627da..0373dc5a 100644 --- a/src/protocol/swg/CollectionServerFirstListResponse.java +++ b/src/protocol/swg/CollectionServerFirstListResponse.java @@ -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; diff --git a/src/protocol/swg/CommPlayerMessage.java b/src/protocol/swg/CommPlayerMessage.java index 631d4c1c..59648d21 100644 --- a/src/protocol/swg/CommPlayerMessage.java +++ b/src/protocol/swg/CommPlayerMessage.java @@ -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 { diff --git a/src/protocol/swg/GuildRequestMessage.java b/src/protocol/swg/GuildRequestMessage.java index 211536e4..d9f1f368 100644 --- a/src/protocol/swg/GuildRequestMessage.java +++ b/src/protocol/swg/GuildRequestMessage.java @@ -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; diff --git a/src/protocol/swg/GuildResponseMessage.java b/src/protocol/swg/GuildResponseMessage.java index e0c8eb42..f98e6713 100644 --- a/src/protocol/swg/GuildResponseMessage.java +++ b/src/protocol/swg/GuildResponseMessage.java @@ -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; diff --git a/src/protocol/swg/ObjControllerMessage.java b/src/protocol/swg/ObjControllerMessage.java index a8b3d10a..b3aa94eb 100644 --- a/src/protocol/swg/ObjControllerMessage.java +++ b/src/protocol/swg/ObjControllerMessage.java @@ -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 { diff --git a/src/protocol/swg/ResourceListForSurveyMessage.java b/src/protocol/swg/ResourceListForSurveyMessage.java index 5263255c..e1c9c886 100644 --- a/src/protocol/swg/ResourceListForSurveyMessage.java +++ b/src/protocol/swg/ResourceListForSurveyMessage.java @@ -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 planetVector = core.resourceService.getSpawnedResourcesByPlanetAndType(surveyor.getPlanetId(),generalType); - resourceList = new ArrayList(planetVector); + resourceList = new ArrayList(planetVector); } diff --git a/src/protocol/swg/SWGMessageFactory.java b/src/protocol/swg/SWGMessageFactory.java index fc5bd8c3..640b019e 100644 --- a/src/protocol/swg/SWGMessageFactory.java +++ b/src/protocol/swg/SWGMessageFactory.java @@ -24,6 +24,7 @@ package protocol.swg; import java.nio.ByteBuffer; import protocol.Message; +import protocol.swg.chat.ChatInstantMessageToCharacter; public class SWGMessageFactory { diff --git a/src/protocol/swg/SurveyMapUpdateMessage.java b/src/protocol/swg/SurveyMapUpdateMessage.java index 7ea62318..21a2728f 100644 --- a/src/protocol/swg/SurveyMapUpdateMessage.java +++ b/src/protocol/swg/SurveyMapUpdateMessage.java @@ -63,7 +63,7 @@ public class SurveyMapUpdateMessage extends SWGMessage { highestConcentration = concentration; } } - int size = buffer.position(); + //int size = buffer.position(); buffer.flip(); } diff --git a/src/protocol/swg/ChatCreateRoom.java b/src/protocol/swg/chat/ChatCreateRoom.java similarity index 97% rename from src/protocol/swg/ChatCreateRoom.java rename to src/protocol/swg/chat/ChatCreateRoom.java index 640cba0e..841c1614 100644 --- a/src/protocol/swg/ChatCreateRoom.java +++ b/src/protocol/swg/chat/ChatCreateRoom.java @@ -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 ChatCreateRoom extends SWGMessage { diff --git a/src/protocol/swg/ChatDeletePersistentMessage.java b/src/protocol/swg/chat/ChatDeletePersistentMessage.java similarity index 96% rename from src/protocol/swg/ChatDeletePersistentMessage.java rename to src/protocol/swg/chat/ChatDeletePersistentMessage.java index 1e812255..3f0d1b70 100644 --- a/src/protocol/swg/ChatDeletePersistentMessage.java +++ b/src/protocol/swg/chat/ChatDeletePersistentMessage.java @@ -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 { diff --git a/src/protocol/swg/ChatEnterRoomById.java b/src/protocol/swg/chat/ChatEnterRoomById.java similarity index 94% rename from src/protocol/swg/ChatEnterRoomById.java rename to src/protocol/swg/chat/ChatEnterRoomById.java index a5b2d4c3..b6715b09 100644 --- a/src/protocol/swg/ChatEnterRoomById.java +++ b/src/protocol/swg/chat/ChatEnterRoomById.java @@ -19,11 +19,11 @@ * 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 resources.common.StringUtilities; +import protocol.swg.SWGMessage; public class ChatEnterRoomById extends SWGMessage { @@ -34,7 +34,6 @@ public class ChatEnterRoomById extends SWGMessage { @Override public void deserialize(IoBuffer data) { - StringUtilities.printBytes(data.array()); data.getShort(); data.getInt(); diff --git a/src/protocol/swg/ChatFriendsListUpdate.java b/src/protocol/swg/chat/ChatFriendsListUpdate.java similarity index 94% rename from src/protocol/swg/ChatFriendsListUpdate.java rename to src/protocol/swg/chat/ChatFriendsListUpdate.java index 962b2ad2..f3a17a34 100644 --- a/src/protocol/swg/ChatFriendsListUpdate.java +++ b/src/protocol/swg/chat/ChatFriendsListUpdate.java @@ -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; diff --git a/src/protocol/swg/ChatInstantMessageToCharacter.java b/src/protocol/swg/chat/ChatInstantMessageToCharacter.java similarity index 98% rename from src/protocol/swg/ChatInstantMessageToCharacter.java rename to src/protocol/swg/chat/ChatInstantMessageToCharacter.java index 1d0efccd..8a1414f9 100644 --- a/src/protocol/swg/ChatInstantMessageToCharacter.java +++ b/src/protocol/swg/chat/ChatInstantMessageToCharacter.java @@ -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 { diff --git a/src/protocol/swg/ChatInstantMessagetoClient.java b/src/protocol/swg/chat/ChatInstantMessagetoClient.java similarity index 97% rename from src/protocol/swg/ChatInstantMessagetoClient.java rename to src/protocol/swg/chat/ChatInstantMessagetoClient.java index f87c0da8..f11903fc 100644 --- a/src/protocol/swg/ChatInstantMessagetoClient.java +++ b/src/protocol/swg/chat/ChatInstantMessagetoClient.java @@ -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{ diff --git a/src/protocol/swg/ChatOnAddFriend.java b/src/protocol/swg/chat/ChatOnAddFriend.java similarity index 96% rename from src/protocol/swg/ChatOnAddFriend.java rename to src/protocol/swg/chat/ChatOnAddFriend.java index 0b84e6ff..44b0b8ac 100644 --- a/src/protocol/swg/ChatOnAddFriend.java +++ b/src/protocol/swg/chat/ChatOnAddFriend.java @@ -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 diff --git a/src/protocol/swg/ChatOnChangeFriendStatus.java b/src/protocol/swg/chat/ChatOnChangeFriendStatus.java similarity index 97% rename from src/protocol/swg/ChatOnChangeFriendStatus.java rename to src/protocol/swg/chat/ChatOnChangeFriendStatus.java index a11c85bb..1c770233 100644 --- a/src/protocol/swg/ChatOnChangeFriendStatus.java +++ b/src/protocol/swg/chat/ChatOnChangeFriendStatus.java @@ -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 { diff --git a/src/protocol/swg/chat/ChatOnConnectAvatar.java b/src/protocol/swg/chat/ChatOnConnectAvatar.java new file mode 100644 index 00000000..faebcf9d --- /dev/null +++ b/src/protocol/swg/chat/ChatOnConnectAvatar.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * 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 . + * + * 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(); + } + +} diff --git a/src/protocol/swg/ChatOnCreateRoom.java b/src/protocol/swg/chat/ChatOnCreateRoom.java similarity index 97% rename from src/protocol/swg/ChatOnCreateRoom.java rename to src/protocol/swg/chat/ChatOnCreateRoom.java index 0492800c..fc690fae 100644 --- a/src/protocol/swg/ChatOnCreateRoom.java +++ b/src/protocol/swg/chat/ChatOnCreateRoom.java @@ -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 services.chat.ChatRoom; public class ChatOnCreateRoom extends SWGMessage { diff --git a/src/protocol/swg/ChatOnEnteredRoom.java b/src/protocol/swg/chat/ChatOnEnteredRoom.java similarity index 97% rename from src/protocol/swg/ChatOnEnteredRoom.java rename to src/protocol/swg/chat/ChatOnEnteredRoom.java index 179f981a..786f16a6 100644 --- a/src/protocol/swg/ChatOnEnteredRoom.java +++ b/src/protocol/swg/chat/ChatOnEnteredRoom.java @@ -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; diff --git a/src/protocol/swg/ChatOnGetFriendsList.java b/src/protocol/swg/chat/ChatOnGetFriendsList.java similarity index 95% rename from src/protocol/swg/ChatOnGetFriendsList.java rename to src/protocol/swg/chat/ChatOnGetFriendsList.java index 3e497bf1..14d5ac8f 100644 --- a/src/protocol/swg/ChatOnGetFriendsList.java +++ b/src/protocol/swg/chat/ChatOnGetFriendsList.java @@ -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 diff --git a/src/protocol/swg/ChatOnSendInstantMessage.java b/src/protocol/swg/chat/ChatOnSendInstantMessage.java similarity index 96% rename from src/protocol/swg/ChatOnSendInstantMessage.java rename to src/protocol/swg/chat/ChatOnSendInstantMessage.java index 9bcb41da..f1be9e0a 100644 --- a/src/protocol/swg/ChatOnSendInstantMessage.java +++ b/src/protocol/swg/chat/ChatOnSendInstantMessage.java @@ -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; diff --git a/src/protocol/swg/ChatOnSendPersistentMessage.java b/src/protocol/swg/chat/ChatOnSendPersistentMessage.java similarity index 96% rename from src/protocol/swg/ChatOnSendPersistentMessage.java rename to src/protocol/swg/chat/ChatOnSendPersistentMessage.java index 3d8a3a48..9dc28eff 100644 --- a/src/protocol/swg/ChatOnSendPersistentMessage.java +++ b/src/protocol/swg/chat/ChatOnSendPersistentMessage.java @@ -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 { diff --git a/src/protocol/swg/ChatOnSendRoomMessage.java b/src/protocol/swg/chat/ChatOnSendRoomMessage.java similarity index 96% rename from src/protocol/swg/ChatOnSendRoomMessage.java rename to src/protocol/swg/chat/ChatOnSendRoomMessage.java index 0d7729e5..21d03390 100644 --- a/src/protocol/swg/ChatOnSendRoomMessage.java +++ b/src/protocol/swg/chat/ChatOnSendRoomMessage.java @@ -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; diff --git a/src/protocol/swg/ChatPersistentMessageToClient.java b/src/protocol/swg/chat/ChatPersistentMessageToClient.java similarity index 98% rename from src/protocol/swg/ChatPersistentMessageToClient.java rename to src/protocol/swg/chat/ChatPersistentMessageToClient.java index 3db681b6..a5013ab8 100644 --- a/src/protocol/swg/ChatPersistentMessageToClient.java +++ b/src/protocol/swg/chat/ChatPersistentMessageToClient.java @@ -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; diff --git a/src/protocol/swg/ChatPersistentMessageToServer.java b/src/protocol/swg/chat/ChatPersistentMessageToServer.java similarity index 98% rename from src/protocol/swg/ChatPersistentMessageToServer.java rename to src/protocol/swg/chat/ChatPersistentMessageToServer.java index a8602f83..84fa1e52 100644 --- a/src/protocol/swg/ChatPersistentMessageToServer.java +++ b/src/protocol/swg/chat/ChatPersistentMessageToServer.java @@ -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; diff --git a/src/protocol/swg/chat/ChatQueryRoomResults.java b/src/protocol/swg/chat/ChatQueryRoomResults.java new file mode 100644 index 00000000..da760c20 --- /dev/null +++ b/src/protocol/swg/chat/ChatQueryRoomResults.java @@ -0,0 +1,113 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * 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 . + * + * 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 users = room.getUserList(); + + buffer.putInt(users.size()); + if (users.size() > 0) { + for (CreatureObject creo : users) { + buffer.put(getAsciiString("SWG")); + buffer.put(getAsciiString(server)); + buffer.put(getAsciiString(creo.getCustomName())); + } + } + + buffer.putInt(0); // TODO: Invited list for chat rooms + + Vector moderators = room.getModeratorList(); + + buffer.putInt(moderators.size()); + if (moderators.size() > 0) { + for (CreatureObject creo : users) { + buffer.put(getAsciiString("SWG")); + buffer.put(getAsciiString(server)); + buffer.put(getAsciiString(creo.getCustomName())); + } + } + + Vector banned = room.getBanList(); + buffer.putInt(banned.size()); + if (banned.size() > 0) { + for (CreatureObject creo : users) { + buffer.put(getAsciiString("SWG")); + buffer.put(getAsciiString(server)); + buffer.put(getAsciiString(creo.getCustomName())); + } + } + + 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(); + } + +} diff --git a/src/protocol/swg/ChatRequestPersistentMessage.java b/src/protocol/swg/chat/ChatRequestPersistentMessage.java similarity index 96% rename from src/protocol/swg/ChatRequestPersistentMessage.java rename to src/protocol/swg/chat/ChatRequestPersistentMessage.java index d52b4afd..dd9ec88f 100644 --- a/src/protocol/swg/ChatRequestPersistentMessage.java +++ b/src/protocol/swg/chat/ChatRequestPersistentMessage.java @@ -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 { diff --git a/src/protocol/swg/ChatRoomList.java b/src/protocol/swg/chat/ChatRoomList.java similarity index 92% rename from src/protocol/swg/ChatRoomList.java rename to src/protocol/swg/chat/ChatRoomList.java index e2bff284..b183b140 100644 --- a/src/protocol/swg/ChatRoomList.java +++ b/src/protocol/swg/chat/ChatRoomList.java @@ -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; import java.util.concurrent.ConcurrentHashMap; @@ -28,6 +28,7 @@ import main.NGECore; import org.apache.mina.core.buffer.IoBuffer; +import protocol.swg.SWGMessage; import services.chat.ChatRoom; public class ChatRoomList extends SWGMessage { @@ -46,7 +47,7 @@ public class ChatRoomList extends SWGMessage { @Override public IoBuffer serialize() { String server = NGECore.getInstance().getGalaxyName(); - IoBuffer buffer = IoBuffer.allocate(100).order(ByteOrder.LITTLE_ENDIAN); + IoBuffer buffer = IoBuffer.allocate(53).order(ByteOrder.LITTLE_ENDIAN); buffer.setAutoExpand(true); buffer.putShort((short) 2); @@ -70,7 +71,9 @@ public class ChatRoomList extends SWGMessage { buffer.putInt(0); // user list (not used by client) } }); - return buffer.flip(); + buffer.flip(); + //StringUtilities.printBytes(buffer.array()); + return buffer; } } diff --git a/src/protocol/swg/ChatRoomMessage.java b/src/protocol/swg/chat/ChatRoomMessage.java similarity index 97% rename from src/protocol/swg/ChatRoomMessage.java rename to src/protocol/swg/chat/ChatRoomMessage.java index 209db832..616d019d 100644 --- a/src/protocol/swg/ChatRoomMessage.java +++ b/src/protocol/swg/chat/ChatRoomMessage.java @@ -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; diff --git a/src/protocol/swg/ChatSendToRoom.java b/src/protocol/swg/chat/ChatSendToRoom.java similarity index 96% rename from src/protocol/swg/ChatSendToRoom.java rename to src/protocol/swg/chat/ChatSendToRoom.java index c3a07dac..0a751ac0 100644 --- a/src/protocol/swg/ChatSendToRoom.java +++ b/src/protocol/swg/chat/ChatSendToRoom.java @@ -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; diff --git a/src/protocol/swg/chat/ChatServerStatus.java b/src/protocol/swg/chat/ChatServerStatus.java new file mode 100644 index 00000000..a867a244 --- /dev/null +++ b/src/protocol/swg/chat/ChatServerStatus.java @@ -0,0 +1,44 @@ +/******************************************************************************* + * Copyright (c) 2013 + * + * 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 . + * + * 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 { + + @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(); + } +} diff --git a/src/protocol/swg/ChatSystemMessage.java b/src/protocol/swg/chat/ChatSystemMessage.java similarity index 98% rename from src/protocol/swg/ChatSystemMessage.java rename to src/protocol/swg/chat/ChatSystemMessage.java index e12aa1f4..af1b516d 100644 --- a/src/protocol/swg/ChatSystemMessage.java +++ b/src/protocol/swg/chat/ChatSystemMessage.java @@ -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{ diff --git a/src/protocol/swg/objectControllerObjects/BiographyUpdate.java b/src/protocol/swg/objectControllerObjects/BiographyUpdate.java index 30e2f1a2..290d4580 100644 --- a/src/protocol/swg/objectControllerObjects/BiographyUpdate.java +++ b/src/protocol/swg/objectControllerObjects/BiographyUpdate.java @@ -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; diff --git a/src/protocol/swg/objectControllerObjects/CombatSpam.java b/src/protocol/swg/objectControllerObjects/CombatSpam.java index 75eaf9cd..fbf836de 100644 --- a/src/protocol/swg/objectControllerObjects/CombatSpam.java +++ b/src/protocol/swg/objectControllerObjects/CombatSpam.java @@ -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; diff --git a/src/protocol/swg/objectControllerObjects/ImageDesignMessage.java b/src/protocol/swg/objectControllerObjects/ImageDesignMessage.java index 8678ec4d..8c99498e 100644 --- a/src/protocol/swg/objectControllerObjects/ImageDesignMessage.java +++ b/src/protocol/swg/objectControllerObjects/ImageDesignMessage.java @@ -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 { diff --git a/src/protocol/swg/objectControllerObjects/MissionListRequest.java b/src/protocol/swg/objectControllerObjects/MissionListRequest.java index 7fbe2d02..aacf1bd0 100644 --- a/src/protocol/swg/objectControllerObjects/MissionListRequest.java +++ b/src/protocol/swg/objectControllerObjects/MissionListRequest.java @@ -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; diff --git a/src/protocol/swg/objectControllerObjects/NpcConversationMessage.java b/src/protocol/swg/objectControllerObjects/NpcConversationMessage.java index 93a05982..12a2d822 100644 --- a/src/protocol/swg/objectControllerObjects/NpcConversationMessage.java +++ b/src/protocol/swg/objectControllerObjects/NpcConversationMessage.java @@ -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 { diff --git a/src/protocol/swg/objectControllerObjects/NpcConversationOptions.java b/src/protocol/swg/objectControllerObjects/NpcConversationOptions.java index b85e42e2..e80a92c6 100644 --- a/src/protocol/swg/objectControllerObjects/NpcConversationOptions.java +++ b/src/protocol/swg/objectControllerObjects/NpcConversationOptions.java @@ -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 conversationOptions = new Vector(); - public NpcConversationOptions(long objectId, long npcId) { + public NpcConversationOptions(long objectId) { this.objectId = objectId; - this.npcId = npcId; } @Override diff --git a/src/protocol/swg/objectControllerObjects/SetProfessionTemplate.java b/src/protocol/swg/objectControllerObjects/SetProfessionTemplate.java index 775a8322..f9c0bb77 100644 --- a/src/protocol/swg/objectControllerObjects/SetProfessionTemplate.java +++ b/src/protocol/swg/objectControllerObjects/SetProfessionTemplate.java @@ -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; diff --git a/src/protocol/swg/objectControllerObjects/ShowFlyText.java b/src/protocol/swg/objectControllerObjects/ShowFlyText.java index f47bbbb2..0413b576 100644 --- a/src/protocol/swg/objectControllerObjects/ShowFlyText.java +++ b/src/protocol/swg/objectControllerObjects/ShowFlyText.java @@ -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 { diff --git a/src/protocol/swg/objectControllerObjects/ShowLootBox.java b/src/protocol/swg/objectControllerObjects/ShowLootBox.java index d4c83d33..c20121a3 100644 --- a/src/protocol/swg/objectControllerObjects/ShowLootBox.java +++ b/src/protocol/swg/objectControllerObjects/ShowLootBox.java @@ -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 { diff --git a/src/protocol/swg/objectControllerObjects/StartNpcConversation.java b/src/protocol/swg/objectControllerObjects/StartNpcConversation.java index d4056d90..a696ca70 100644 --- a/src/protocol/swg/objectControllerObjects/StartNpcConversation.java +++ b/src/protocol/swg/objectControllerObjects/StartNpcConversation.java @@ -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 { diff --git a/src/protocol/swg/objectControllerObjects/StopNpcConversation.java b/src/protocol/swg/objectControllerObjects/StopNpcConversation.java index 469b1725..4690140d 100644 --- a/src/protocol/swg/objectControllerObjects/StopNpcConversation.java +++ b/src/protocol/swg/objectControllerObjects/StopNpcConversation.java @@ -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 { diff --git a/src/resources/common/Cooldown.java b/src/resources/common/Cooldown.java index edaf7e94..2c7e2240 100644 --- a/src/resources/common/Cooldown.java +++ b/src/resources/common/Cooldown.java @@ -21,9 +21,7 @@ ******************************************************************************/ package resources.common; -import java.util.concurrent.Executors; import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; public class Cooldown { private long startTimestamp; diff --git a/src/resources/common/IDAttribute.java b/src/resources/common/IDAttribute.java index 6accf7e3..b17edf9d 100644 --- a/src/resources/common/IDAttribute.java +++ b/src/resources/common/IDAttribute.java @@ -21,8 +21,6 @@ ******************************************************************************/ package resources.common; -import java.math.BigInteger; - public class IDAttribute { private float floatValue; diff --git a/src/resources/common/ThreadMonitor.java b/src/resources/common/ThreadMonitor.java index 19c83baa..bf5c2cb8 100644 --- a/src/resources/common/ThreadMonitor.java +++ b/src/resources/common/ThreadMonitor.java @@ -187,7 +187,8 @@ public class ThreadMonitor { return true; } - private void parseMBeanInfo() throws IOException { + @SuppressWarnings("unused") + private void parseMBeanInfo() throws IOException { try { MBeanOperationInfo[] mopis = server.getMBeanInfo(objname).getOperations(); diff --git a/src/resources/objects/Buff.java b/src/resources/objects/Buff.java index f8fc8dff..fd6aa4e0 100644 --- a/src/resources/objects/Buff.java +++ b/src/resources/objects/Buff.java @@ -36,8 +36,6 @@ import resources.objects.creature.CreatureObject; import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.Persistent; -import engine.clientdata.ClientFileManager; -import engine.clientdata.visitors.DatatableVisitor; import engine.resources.common.CRC; @Persistent(version=10) diff --git a/src/resources/objects/building/BuildingObject.java b/src/resources/objects/building/BuildingObject.java index 68f59f6a..f604d0a3 100644 --- a/src/resources/objects/building/BuildingObject.java +++ b/src/resources/objects/building/BuildingObject.java @@ -30,9 +30,7 @@ import resources.objects.tangible.TangibleObject; import com.sleepycat.persist.model.Entity; import com.sleepycat.persist.model.NotPersistent; import engine.clients.Client; -import engine.resources.container.Traverser; import engine.resources.objects.IPersistent; -import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; diff --git a/src/resources/objects/creature/CreatureMessageBuilder.java b/src/resources/objects/creature/CreatureMessageBuilder.java index 1893b318..d70cf87c 100644 --- a/src/resources/objects/creature/CreatureMessageBuilder.java +++ b/src/resources/objects/creature/CreatureMessageBuilder.java @@ -30,7 +30,6 @@ import org.apache.mina.core.buffer.IoBuffer; import com.sleepycat.persist.model.Persistent; import engine.resources.common.CRC; -import resources.common.StringUtilities; import resources.objects.Buff; import resources.objects.ObjectMessageBuilder; import resources.objects.SkillMod; diff --git a/src/resources/objects/creature/CreatureObject.java b/src/resources/objects/creature/CreatureObject.java index da90caec..d53ff7e2 100644 --- a/src/resources/objects/creature/CreatureObject.java +++ b/src/resources/objects/creature/CreatureObject.java @@ -28,18 +28,15 @@ import java.util.Iterator; import java.util.List; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.Executors; import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.TimeUnit; import org.apache.mina.core.buffer.IoBuffer; -import protocol.swg.ChatSystemMessage; import protocol.swg.ObjControllerMessage; -import protocol.swg.PlayClientEffectObjectMessage; import protocol.swg.PlayMusicMessage; import protocol.swg.UpdatePostureMessage; import protocol.swg.UpdatePVPStatusMessage; +import protocol.swg.chat.ChatSystemMessage; import protocol.swg.objectControllerObjects.Animation; import protocol.swg.objectControllerObjects.Posture; @@ -64,7 +61,6 @@ import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; import resources.objects.player.PlayerObject; import resources.objects.tangible.TangibleObject; -import resources.objects.weapon.WeaponObject; @Entity(version=6) public class CreatureObject extends TangibleObject implements IPersistent { @@ -1090,8 +1086,7 @@ public class CreatureObject extends TangibleObject implements IPersistent { appearanceEquipmentList.get().remove(object); } } - - @SuppressWarnings("unused") + @Override public void sendBaselines(Client destination) { diff --git a/src/resources/objects/player/PlayerMessageBuilder.java b/src/resources/objects/player/PlayerMessageBuilder.java index 41df49b1..aae6f5c3 100644 --- a/src/resources/objects/player/PlayerMessageBuilder.java +++ b/src/resources/objects/player/PlayerMessageBuilder.java @@ -27,8 +27,6 @@ import java.util.Map.Entry; import org.apache.mina.core.buffer.IoBuffer; -import engine.resources.common.CRC; -import resources.common.StringUtilities; import resources.objects.ObjectMessageBuilder; import resources.objects.waypoint.WaypointObject; diff --git a/src/resources/objects/player/PlayerObject.java b/src/resources/objects/player/PlayerObject.java index 1a50837d..d1c23985 100644 --- a/src/resources/objects/player/PlayerObject.java +++ b/src/resources/objects/player/PlayerObject.java @@ -28,7 +28,6 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; -import resources.common.Console; import resources.objects.intangible.IntangibleObject; import resources.objects.resource.ResourceContainerObject; import resources.objects.tool.SurveyTool; @@ -838,7 +837,7 @@ public class PlayerObject extends IntangibleObject { public boolean deductLots(int amount) { - if(this.lotsRemaining - amount > 0) + if(this.lotsRemaining - amount >= 0) { this.lotsRemaining -= amount; return true; diff --git a/src/resources/objects/resource/GalacticResource.java b/src/resources/objects/resource/GalacticResource.java index ebd728d4..643e1444 100644 --- a/src/resources/objects/resource/GalacticResource.java +++ b/src/resources/objects/resource/GalacticResource.java @@ -24,20 +24,17 @@ package resources.objects.resource; import java.util.List; import java.util.Random; import java.util.Vector; -import java.util.concurrent.TimeUnit; import main.NGECore; import protocol.swg.SurveyMapUpdateMessage; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; -import resources.objects.tangible.TangibleObject; import resources.objects.waypoint.WaypointObject; import com.sleepycat.je.Environment; import com.sleepycat.je.Transaction; import com.sleepycat.persist.model.Entity; import com.sleepycat.persist.model.NotPersistent; -import com.sleepycat.persist.model.Persistent; import engine.clients.Client; import engine.resources.objects.IPersistent; diff --git a/src/resources/objects/resource/ResourceConcentration.java b/src/resources/objects/resource/ResourceConcentration.java index 332eed7e..c2104b9e 100644 --- a/src/resources/objects/resource/ResourceConcentration.java +++ b/src/resources/objects/resource/ResourceConcentration.java @@ -27,7 +27,7 @@ public class ResourceConcentration { return coordsZ; } - public void setCoordsZ(float coordsY) { + public void setCoordsZ(float coordsZ) { this.coordsZ = coordsZ; } diff --git a/src/resources/objects/resource/ResourceContainerObject.java b/src/resources/objects/resource/ResourceContainerObject.java index 20ef9dfd..b2a0eada 100644 --- a/src/resources/objects/resource/ResourceContainerObject.java +++ b/src/resources/objects/resource/ResourceContainerObject.java @@ -70,6 +70,7 @@ public class ResourceContainerObject extends TangibleObject { private short overallQuality; private short flavor; + /* private static byte CONTAINER_TYPE_INORGANIC_MINERALS = 0; private static byte CONTAINER_TYPE_INORGANIC_CHEMICALS = 1; private static byte CONTAINER_TYPE_INORGANIC_GAS = 2; @@ -127,6 +128,7 @@ public class ResourceContainerObject extends TangibleObject { "object/resource_container/shared_resource_container_energy_radioactive.iff", "object/resource_container/shared_resource_container_energy_solid.iff" }; + */ @NotPersistent public static int maximalStackCapacity = 100000; diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index 3ac40cf1..f7d120cc 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -31,8 +31,6 @@ import java.util.Map; import java.util.Set; import java.util.Vector; -import javax.xml.bind.DatatypeConverter; - import main.NGECore; import protocol.swg.ObjControllerMessage; import protocol.swg.PlayClientEffectObjectMessage; @@ -43,7 +41,6 @@ import resources.common.RGB; import resources.objects.creature.CreatureObject; import resources.objects.loot.LootGroup; import resources.visitors.IDManagerVisitor; -import services.ai.AIActor; import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.Persistent; diff --git a/src/services/BuffService.java b/src/services/BuffService.java index 97032e4e..36a0154f 100644 --- a/src/services/BuffService.java +++ b/src/services/BuffService.java @@ -178,7 +178,6 @@ public class BuffService implements INetworkDispatch { // I'm not sure if all aura effects follow the same rules, so this is simply restricted to officer aura's atm ScheduledFuture task = scheduler.scheduleAtFixedRate(new Runnable() { - @SuppressWarnings("unused") @Override public void run() { if (buffer == null || buffer.getClient() == null) diff --git a/src/services/ConversationService.java b/src/services/ConversationService.java index a4f624dc..b2b3854a 100644 --- a/src/services/ConversationService.java +++ b/src/services/ConversationService.java @@ -124,7 +124,7 @@ public class ConversationService implements INetworkDispatch { conversationHandlers.put(player, handler); - NpcConversationOptions convoOptions = new NpcConversationOptions(player.getObjectID(), npc.getObjectID()); + NpcConversationOptions convoOptions = new NpcConversationOptions(player.getObjectID()); options.forEach(convoOptions::addOption); ObjControllerMessage objController = new ObjControllerMessage(0x0B, convoOptions); player.getClient().getSession().write(objController.serialize()); diff --git a/src/services/EntertainmentService.java b/src/services/EntertainmentService.java index 2821f0f1..3c6772a9 100644 --- a/src/services/EntertainmentService.java +++ b/src/services/EntertainmentService.java @@ -2,10 +2,8 @@ package services; import java.nio.ByteOrder; import java.util.HashMap; -import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; -import java.util.Random; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; @@ -19,25 +17,18 @@ import org.apache.mina.core.buffer.IoBuffer; import org.apache.mina.core.session.IoSession; import protocol.swg.ObjControllerMessage; -import protocol.swg.OkMessage; -import protocol.swg.PlayClientEffectObjectMessage; import protocol.swg.objectControllerObjects.BuffBuilderChangeMessage; import protocol.swg.objectControllerObjects.BuffBuilderEndMessage; -import protocol.swg.objectControllerObjects.BuffBuilderStartMessage; import protocol.swg.objectControllerObjects.ImageDesignMessage; import resources.common.BuffBuilder; -import resources.common.Console; import resources.common.IDAttribute; import resources.common.MathUtilities; import resources.common.ObjControllerOpcodes; import resources.common.Performance; import resources.common.PerformanceEffect; import resources.common.RGB; -import resources.common.StringUtilities; import resources.datatables.Posture; -import resources.objects.Buff; import resources.objects.BuffItem; -import resources.objects.SWGList; import resources.objects.SkillMod; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; @@ -45,7 +36,6 @@ import resources.objects.tangible.TangibleObject; import resources.visitors.IDManagerVisitor; import services.sui.SUIService.InputBoxType; import services.sui.SUIWindow; -import services.sui.SUIWindow.SUICallback; import services.sui.SUIWindow.Trigger; import engine.clientdata.ClientFileManager; import engine.clientdata.visitors.DatatableVisitor; diff --git a/src/services/EquipmentService.java b/src/services/EquipmentService.java index d19d838f..12764c94 100644 --- a/src/services/EquipmentService.java +++ b/src/services/EquipmentService.java @@ -35,7 +35,6 @@ import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; import java.util.TreeMap; -import org.python.antlr.ast.Str; import org.python.core.Py; import org.python.core.PyObject; @@ -46,9 +45,7 @@ import engine.resources.objects.SWGObject; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; import resources.objects.player.PlayerObject; -import resources.objects.tangible.TangibleObject; import services.equipment.BonusSetTemplate; -import services.spawn.MobileTemplate; public class EquipmentService implements INetworkDispatch { diff --git a/src/services/GroupService.java b/src/services/GroupService.java index b9504a8c..ba159d69 100644 --- a/src/services/GroupService.java +++ b/src/services/GroupService.java @@ -28,7 +28,6 @@ import java.util.Map; import resources.objects.Buff; import resources.objects.creature.CreatureObject; import resources.objects.group.GroupObject; -import services.chat.ChatRoom; import main.NGECore; import engine.clients.Client; import engine.resources.objects.SWGObject; diff --git a/src/services/InstanceService.java b/src/services/InstanceService.java index 386cc3cf..09ec11d4 100644 --- a/src/services/InstanceService.java +++ b/src/services/InstanceService.java @@ -36,7 +36,6 @@ import java.util.concurrent.TimeUnit; import resources.objects.building.BuildingObject; import resources.objects.creature.CreatureObject; import resources.objects.group.GroupObject; -import services.object.ObjectService; import main.NGECore; import engine.clientdata.ClientFileManager; diff --git a/src/services/MissionService.java b/src/services/MissionService.java index 78fce706..77e9dca7 100644 --- a/src/services/MissionService.java +++ b/src/services/MissionService.java @@ -24,7 +24,6 @@ package services; import java.nio.ByteOrder; import java.util.Map; import java.util.Random; -import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; import main.NGECore; @@ -44,7 +43,6 @@ import engine.clientdata.visitors.DatatableVisitor; import engine.clients.Client; import engine.resources.container.Traverser; import engine.resources.objects.SWGObject; -import engine.resources.scene.Planet; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; diff --git a/src/services/SimulationService.java b/src/services/SimulationService.java index d7c05496..22b30882 100644 --- a/src/services/SimulationService.java +++ b/src/services/SimulationService.java @@ -60,15 +60,15 @@ import engine.resources.scene.Quaternion; import engine.resources.scene.quadtree.QuadTree; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; -import protocol.swg.ChatFriendsListUpdate; -import protocol.swg.ChatOnChangeFriendStatus; -import protocol.swg.ChatOnGetFriendsList; import protocol.swg.CmdStartScene; import protocol.swg.HeartBeatMessage; import protocol.swg.ObjControllerMessage; import protocol.swg.OpenedContainerMessage; import protocol.swg.UpdateTransformMessage; import protocol.swg.UpdateTransformWithParentMessage; +import protocol.swg.chat.ChatFriendsListUpdate; +import protocol.swg.chat.ChatOnChangeFriendStatus; +import protocol.swg.chat.ChatOnGetFriendsList; import protocol.swg.objectControllerObjects.DataTransform; import protocol.swg.objectControllerObjects.DataTransformWithParent; import protocol.swg.objectControllerObjects.TargetUpdate; @@ -886,6 +886,24 @@ public class SimulationService implements INetworkDispatch { } + public void transform(TangibleObject obj, Point3D position) + { + Point3D oldPosition = obj.getPosition(); + Point3D newPosition = new Point3D(oldPosition.x + position.x, oldPosition.y + position.y, oldPosition.z + position.z); + + teleport(obj, newPosition, obj.getOrientation(), obj.getParentId()); + } + + public void transform(SWGObject obj, float rotation, Point3D axis) + { + rotation *= (Math.PI / 180); + + Quaternion oldRotation = obj.getOrientation(); + Quaternion newRotation = resources.common.MathUtilities.rotateQuaternion(oldRotation, rotation, axis); + + teleport(obj, obj.getPosition(), newRotation, obj.getParentId()); + } + public void teleport(SWGObject obj, Point3D position, Quaternion orientation, long cellId) { if(cellId == 0) { @@ -900,6 +918,9 @@ public class SimulationService implements INetworkDispatch { DataTransformWithParent dataTransform = new DataTransformWithParent(new Point3D(position.x, position.y, position.z), orientation, obj.getMovementCounter(), obj.getObjectID(), cellId); ObjControllerMessage objController = new ObjControllerMessage(0x1B, dataTransform); obj.notifyObservers(objController, true); + + obj.setPosition(position); + obj.setOrientation(orientation); } } diff --git a/src/services/SurveyService.java b/src/services/SurveyService.java index 333db3f7..db662c14 100644 --- a/src/services/SurveyService.java +++ b/src/services/SurveyService.java @@ -22,7 +22,6 @@ package services; import java.util.Map; -import java.util.Observable; import java.util.Random; import java.util.Vector; import java.util.concurrent.Executors; @@ -31,27 +30,19 @@ import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import protocol.swg.PlayClientEffectLocMessage; -import protocol.swg.SceneCreateObjectByCrc; -import protocol.swg.SceneEndBaselines; -import protocol.swg.SurveyMapUpdateMessage; -import protocol.swg.UpdateContainmentMessage; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; import resources.objects.resource.GalacticResource; -import resources.objects.resource.ResourceConcentration; import resources.objects.resource.ResourceContainerObject; import resources.objects.resource.ResourceRoot; import resources.objects.tangible.TangibleObject; import resources.objects.tool.SurveyTool; -import resources.objects.waypoint.WaypointObject; import services.sui.SUIWindow; import services.sui.SUIWindow.SUICallback; import services.sui.SUIWindow.Trigger; import main.NGECore; -import engine.resources.common.CRC; import engine.resources.container.Traverser; import engine.resources.objects.SWGObject; -import engine.resources.scene.Point3D; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; @@ -479,7 +470,6 @@ public class SurveyService implements INetworkDispatch { returnList.add("List.lstList:SelectedRow"); window.addHandler(0, "", Trigger.TRIGGER_OK, returnList, new SUICallback() { - @SuppressWarnings("unchecked") @Override public void process(SWGObject owner, int eventType, Vector returnList) { int index = Integer.parseInt(returnList.get(0)); @@ -627,7 +617,6 @@ public class SurveyService implements INetworkDispatch { final SurveyTool outerSurveyTool = (SurveyTool)target; window.addHandler(0, "", Trigger.TRIGGER_OK, returnList, new SUICallback() { - @SuppressWarnings("unchecked") @Override public void process(SWGObject owner, int eventType, Vector returnList) { CreatureObject crafter = (CreatureObject)owner; @@ -673,14 +662,12 @@ public class SurveyService implements INetworkDispatch { final SurveyTool outerSurveyTool = (SurveyTool)target; window.addHandler(0, "", Trigger.TRIGGER_OK, returnList, new SUICallback() { - @SuppressWarnings("unchecked") @Override public void process(SWGObject owner, int eventType, Vector returnList) { ((CreatureObject)owner).sendSystemMessage("Rad confirmed", (byte) 0); } }); window.addHandler(1, "", Trigger.TRIGGER_CANCEL, returnList, new SUICallback() { - @SuppressWarnings("unchecked") @Override public void process(SWGObject owner, int eventType, Vector returnList) { ((CreatureObject)owner).sendSystemMessage("Rad declined", (byte) 0); diff --git a/src/services/TerrainService.java b/src/services/TerrainService.java index 151cf9a6..c8b3aaf5 100644 --- a/src/services/TerrainService.java +++ b/src/services/TerrainService.java @@ -24,22 +24,16 @@ package services; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import resources.common.FileUtilities; import resources.common.collidables.CollidableCircle; -import resources.objects.building.BuildingObject; -import resources.objects.cell.CellObject; -import resources.objects.creature.CreatureObject; import engine.clientdata.ClientFileManager; import engine.clientdata.visitors.DatatableVisitor; import engine.resources.config.Config; -import engine.resources.container.Traverser; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; import engine.resources.scene.Point3D; diff --git a/src/services/ai/AIActor.java b/src/services/ai/AIActor.java index f3f406b7..c34ed1fc 100644 --- a/src/services/ai/AIActor.java +++ b/src/services/ai/AIActor.java @@ -22,7 +22,6 @@ package services.ai; import java.util.Map; -import java.util.Map.Entry; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledExecutorService; @@ -42,7 +41,6 @@ import services.ai.states.AttackState; import services.ai.states.DeathState; import services.ai.states.IdleState; import services.ai.states.RetreatState; -import services.ai.states.SpawnState; import services.combat.CombatEvents.DamageTaken; import services.spawn.MobileTemplate; diff --git a/src/services/ai/AIService.java b/src/services/ai/AIService.java index 786ac66d..5f2f3e63 100644 --- a/src/services/ai/AIService.java +++ b/src/services/ai/AIService.java @@ -26,14 +26,11 @@ import java.util.Map.Entry; import java.util.Random; import java.util.Vector; -import resources.objects.cell.CellObject; import resources.objects.creature.CreatureObject; import resources.objects.group.GroupObject; import resources.objects.player.PlayerObject; -import engine.resources.scene.Planet; import engine.resources.scene.Point3D; -import engine.resources.scene.Quaternion; import main.NGECore; diff --git a/src/services/ai/states/RetreatState.java b/src/services/ai/states/RetreatState.java index 61db1785..315f8cb3 100644 --- a/src/services/ai/states/RetreatState.java +++ b/src/services/ai/states/RetreatState.java @@ -21,9 +21,7 @@ ******************************************************************************/ package services.ai.states; -import resources.objects.creature.CreatureObject; import services.ai.AIActor; -import services.ai.states.AIState.StateResult; public class RetreatState extends AIState { diff --git a/src/services/chat/ChatRoom.java b/src/services/chat/ChatRoom.java index 41ee1565..a2428907 100644 --- a/src/services/chat/ChatRoom.java +++ b/src/services/chat/ChatRoom.java @@ -21,7 +21,6 @@ ******************************************************************************/ package services.chat; -import java.util.List; import java.util.Vector; import resources.objects.creature.CreatureObject; @@ -29,8 +28,6 @@ import resources.objects.creature.CreatureObject; import com.sleepycat.persist.model.Entity; import com.sleepycat.persist.model.NotPersistent; import com.sleepycat.persist.model.PrimaryKey; -import com.sleepycat.persist.model.Relationship; -import com.sleepycat.persist.model.SecondaryKey; @Entity public class ChatRoom { @@ -45,8 +42,6 @@ public class ChatRoom { @NotPersistent private Vector userList = new Vector(); // current users - @NotPersistent - private int requestId; // not-persistent private boolean moderatorsOnly; private boolean privateRoom; private boolean visible; @@ -92,14 +87,6 @@ public class ChatRoom { this.userList = userList; } - public int getRequestId() { - return requestId; - } - - public void setRequestId(int requestId) { - this.requestId = requestId; - } - public boolean isModeratorsOnly() { return moderatorsOnly; } diff --git a/src/services/chat/ChatService.java b/src/services/chat/ChatService.java index 8d4a159f..06afbab6 100644 --- a/src/services/chat/ChatService.java +++ b/src/services/chat/ChatService.java @@ -34,8 +34,6 @@ import org.apache.mina.core.session.IoSession; import com.sleepycat.je.Transaction; import com.sleepycat.persist.EntityCursor; -import com.sleepycat.persist.PrimaryIndex; -import com.sleepycat.persist.SecondaryIndex; import engine.clients.Client; import engine.resources.config.Config; @@ -49,27 +47,25 @@ import resources.common.*; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; import protocol.swg.AddIgnoreMessage; -import protocol.swg.ChatCreateRoom; -import protocol.swg.ChatEnterRoomById; -import protocol.swg.ChatOnChangeFriendStatus; -import protocol.swg.ChatDeletePersistentMessage; -import protocol.swg.ChatFriendsListUpdate; -import protocol.swg.ChatInstantMessageToCharacter; -import protocol.swg.ChatInstantMessagetoClient; -import protocol.swg.ChatOnAddFriend; -import protocol.swg.ChatOnCreateRoom; -import protocol.swg.ChatOnEnteredRoom; -import protocol.swg.ChatOnSendInstantMessage; -import protocol.swg.ChatOnSendPersistentMessage; -import protocol.swg.ChatOnSendRoomMessage; -import protocol.swg.ChatPersistentMessageToClient; -import protocol.swg.ChatPersistentMessageToServer; -import protocol.swg.ChatRequestPersistentMessage; -import protocol.swg.ChatRoomList; -import protocol.swg.ChatRoomMessage; -import protocol.swg.ChatSendToRoom; -import protocol.swg.ChatSystemMessage; import protocol.swg.ObjControllerMessage; +import protocol.swg.chat.ChatDeletePersistentMessage; +import protocol.swg.chat.ChatEnterRoomById; +import protocol.swg.chat.ChatFriendsListUpdate; +import protocol.swg.chat.ChatInstantMessageToCharacter; +import protocol.swg.chat.ChatInstantMessagetoClient; +import protocol.swg.chat.ChatOnAddFriend; +import protocol.swg.chat.ChatOnChangeFriendStatus; +import protocol.swg.chat.ChatOnEnteredRoom; +import protocol.swg.chat.ChatOnSendInstantMessage; +import protocol.swg.chat.ChatOnSendPersistentMessage; +import protocol.swg.chat.ChatOnSendRoomMessage; +import protocol.swg.chat.ChatPersistentMessageToClient; +import protocol.swg.chat.ChatPersistentMessageToServer; +import protocol.swg.chat.ChatRequestPersistentMessage; +import protocol.swg.chat.ChatRoomList; +import protocol.swg.chat.ChatRoomMessage; +import protocol.swg.chat.ChatSendToRoom; +import protocol.swg.chat.ChatSystemMessage; import protocol.swg.objectControllerObjects.PlayerEmote; import protocol.swg.objectControllerObjects.SpatialChat; import main.NGECore; @@ -363,15 +359,17 @@ public class ChatService implements INetworkDispatch { if (obj == null) return; - ChatRoomList listMessage = new ChatRoomList(chatRooms); + //ChatServerStatus chatServerStatus = new ChatServerStatus(); + //client.getSession().write(chatServerStatus.serialize()); + ChatRoomList listMessage = new ChatRoomList(chatRooms); client.getSession().write(listMessage.serialize()); } }); swgOpcodes.put(Opcodes.ChatCreateRoom, (session, data) -> { - data.order(ByteOrder.LITTLE_ENDIAN); + /*data.order(ByteOrder.LITTLE_ENDIAN); Client client = core.getClient(session); @@ -389,19 +387,33 @@ public class ChatService implements INetworkDispatch { sentPacket.deserialize(data); ChatRoom room = createChatRoom(sentPacket.getTitle(), sentPacket.getAddress(), creo.getCustomName().toLowerCase(), true, false); - room.setPrivateRoom(sentPacket.isPrivacy()); - room.setModeratorsOnly(sentPacket.isModeratorOnly()); if (room != null) { + room.setPrivateRoom(sentPacket.isPrivacy()); + room.setModeratorsOnly(sentPacket.isModeratorOnly()); room.getUserList().add(creo); room.getModeratorList().add(creo); ChatOnCreateRoom response = new ChatOnCreateRoom(room, 0, sentPacket.getRequest()); session.write(response.serialize()); - } + }*/ }); swgOpcodes.put(Opcodes.ChatQueryRoom, (session, data) -> { + data.order(ByteOrder.LITTLE_ENDIAN); + //StringUtilities.printBytes(data.array()); + Client client = core.getClient(session); + + if(client == null) + return; + + SWGObject obj = client.getParent(); + + if (obj == null) + return; + + + }); swgOpcodes.put(Opcodes.ChatSendToRoom, (session, data) -> { @@ -441,7 +453,7 @@ public class ChatService implements INetworkDispatch { joinChatRoom((CreatureObject) obj, sentPacket.getRoomId()); - System.out.println("Entering room... " + sentPacket.getRoomId()); + //System.out.println("Entering room... " + sentPacket.getRoomId()); }); } @@ -728,15 +740,15 @@ public class ChatService implements INetworkDispatch { if (creator.contains(" ")) creator = creator.split(" ")[0]; - + ChatRoom room = new ChatRoom(); room.setDescription(roomName); if (!address.startsWith("SWG.")) room.setRoomAddress("SWG." + core.getGalaxyName() + "." + address); else room.setRoomAddress(address); - room.setCreator(creator); - room.setOwner(creator); + room.setCreator(creator.toLowerCase()); + room.setOwner(creator.toLowerCase()); room.setVisible(showInList); room.setRoomId(generateChatRoomId()); diff --git a/src/services/combat/CombatCommands.java b/src/services/combat/CombatCommands.java index 7a66c472..dcdc875d 100644 --- a/src/services/combat/CombatCommands.java +++ b/src/services/combat/CombatCommands.java @@ -21,7 +21,6 @@ ******************************************************************************/ package services.combat; -import services.command.CombatCommand; import main.NGECore; public class CombatCommands { diff --git a/src/services/combat/CombatService.java b/src/services/combat/CombatService.java index 08a6cee5..1f455338 100644 --- a/src/services/combat/CombatService.java +++ b/src/services/combat/CombatService.java @@ -36,7 +36,6 @@ import org.apache.mina.core.session.IoSession; import protocol.swg.ObjControllerMessage; import protocol.swg.PlayClientEffectLocMessage; -import protocol.swg.UpdatePVPStatusMessage; import protocol.swg.objectControllerObjects.CombatAction; import protocol.swg.objectControllerObjects.CombatSpam; import protocol.swg.objectControllerObjects.CommandEnqueueRemove; @@ -52,6 +51,7 @@ import resources.objects.waypoint.WaypointObject; import resources.objects.weapon.WeaponObject; import services.ai.AIActor; import services.combat.CombatEvents.DamageTaken; +import services.command.BaseSWGCommand; import services.command.CombatCommand; import services.sui.SUIService.MessageBoxType; import services.sui.SUIWindow; @@ -400,7 +400,7 @@ public class CombatService implements INetworkDispatch { } - private void sendCombatPackets(CreatureObject attacker, TangibleObject target, WeaponObject weapon, CombatCommand command, int actionCounter, float damage, int armorAbsorbed, int hitType) { + private void sendCombatPackets(CreatureObject attacker, TangibleObject target, WeaponObject weapon, BaseSWGCommand command, int actionCounter, float damage, int armorAbsorbed, int hitType) { String animationStr = command.getRandomAnimation(weapon); CombatAction combatAction = new CombatAction(CRC.StringtoCRC(animationStr), attacker.getObjectID(), weapon.getObjectID(), target.getObjectID(), command.getCommandCRC()); @@ -429,7 +429,7 @@ public class CombatService implements INetworkDispatch { } - private void sendHealPackets(CreatureObject attacker, CreatureObject target, WeaponObject weapon, CombatCommand command, int actionCounter) { + private void sendHealPackets(CreatureObject attacker, CreatureObject target, WeaponObject weapon, BaseSWGCommand command, int actionCounter) { CombatAction combatAction = new CombatAction(CRC.StringtoCRC(command.getDefaultAnimations()[0]), attacker.getObjectID(), weapon.getObjectID(), target.getObjectID(), command.getCommandCRC()); ObjControllerMessage objController = new ObjControllerMessage(0x1B, combatAction); @@ -820,7 +820,6 @@ public class CombatService implements INetworkDispatch { target.getEventBus().publish(event); } - @SuppressWarnings("unused") public void doDrainHeal(CreatureObject receiver, int drainAmount) { synchronized(receiver.getMutex()) { receiver.setHealth(receiver.getHealth() + drainAmount); diff --git a/src/services/command/BaseSWGCommand.java b/src/services/command/BaseSWGCommand.java index 0448a8ea..3205bd5e 100644 --- a/src/services/command/BaseSWGCommand.java +++ b/src/services/command/BaseSWGCommand.java @@ -27,6 +27,9 @@ import engine.resources.common.CRC; import java.util.ArrayList; import java.util.List; +import java.util.Random; + +import resources.objects.weapon.WeaponObject; public class BaseSWGCommand implements Cloneable { @@ -34,7 +37,6 @@ public class BaseSWGCommand implements Cloneable { private String clientEffectSelf; private String clientEffectTarget; private int commandCRC; - private boolean isGmCommand = false; private String characterAbility; private int target; private int targetType; @@ -55,6 +57,21 @@ public class BaseSWGCommand implements Cloneable { private Byte[] invalidPostures; private Long[] invalidStates; + private String[] defaultAnimations = new String[]{}; + private String[] oneHandedAnimations = new String[]{}; + private String[] twoHandedAnimations = new String[]{}; + private String[] polearmAnimations = new String[]{}; + private String[] unarmedAnimations = new String[]{}; + private String[] pistolAnimations = new String[]{}; + private String[] carbineAnimations = new String[]{}; + private String[] lightRifleAnimations = new String[]{}; + private String[] rifleAnimations = new String[]{}; + private String[] heavyWpnAnimations = new String[]{}; + private String[] oneHandedLSAnimations = new String[]{}; + private String[] twoHandedLSAnimations = new String[]{}; + private String[] polearmLSAnimations = new String[]{}; + private String[] thrownAnimations = new String[]{}; + public BaseSWGCommand(String commandName) { setCommandName(commandName); setCommandCRC(CRC.StringtoCRC(commandName)); @@ -222,10 +239,6 @@ public class BaseSWGCommand implements Cloneable { return (godLevel > 0); } - public void setGmCommand(boolean isGmCommand) { - this.isGmCommand = isGmCommand; - } - public String getCharacterAbility() { return characterAbility; } @@ -362,4 +375,169 @@ public class BaseSWGCommand implements Cloneable { this.warmupTime = warmupTime; } + public String[] getDefaultAnimations() { + return defaultAnimations; + } + + public void setDefaultAnimations(String[] defaultAnimations) { + this.defaultAnimations = defaultAnimations; + } + + public String[] getOneHandedAnimations() { + return oneHandedAnimations; + } + + public void setOneHandedAnimations(String[] oneHandedAnimations) { + this.oneHandedAnimations = oneHandedAnimations; + } + + public String[] getTwoHandedAnimations() { + return twoHandedAnimations; + } + + public void setTwoHandedAnimations(String[] twoHandedAnimations) { + this.twoHandedAnimations = twoHandedAnimations; + } + + public String[] getPolearmAnimations() { + return polearmAnimations; + } + + public void setPolearmAnimations(String[] polearmAnimations) { + this.polearmAnimations = polearmAnimations; + } + + public String[] getUnarmedAnimations() { + return unarmedAnimations; + } + + public void setUnarmedAnimations(String[] unarmedAnimations) { + this.unarmedAnimations = unarmedAnimations; + } + + public String[] getPistolAnimations() { + return pistolAnimations; + } + + public void setPistolAnimations(String[] pistolAnimations) { + this.pistolAnimations = pistolAnimations; + } + + public String[] getCarbineAnimations() { + return carbineAnimations; + } + + public void setCarbineAnimations(String[] carbineAnimations) { + this.carbineAnimations = carbineAnimations; + } + + public String[] getLightRifleAnimations() { + return lightRifleAnimations; + } + + public void setLightRifleAnimations(String[] lightRifleAnimations) { + this.lightRifleAnimations = lightRifleAnimations; + } + + public String[] getRifleAnimations() { + return rifleAnimations; + } + + public void setRifleAnimations(String[] rifleAnimations) { + this.rifleAnimations = rifleAnimations; + } + + public String[] getHeavyWpnAnimations() { + return heavyWpnAnimations; + } + + public void setHeavyWpnAnimations(String[] heavyWpnAnimations) { + this.heavyWpnAnimations = heavyWpnAnimations; + } + + public String[] getOneHandedLSAnimations() { + return oneHandedLSAnimations; + } + + public void setOneHandedLSAnimations(String[] oneHandedLSAnimations) { + this.oneHandedLSAnimations = oneHandedLSAnimations; + } + + public String[] getTwoHandedLSAnimations() { + return twoHandedLSAnimations; + } + + public void setTwoHandedLSAnimations(String[] twoHandedLSAnimations) { + this.twoHandedLSAnimations = twoHandedLSAnimations; + } + + public String[] getPolearmLSAnimations() { + return polearmLSAnimations; + } + + public void setPolearmLSAnimations(String[] polearmLSAnimations) { + this.polearmLSAnimations = polearmLSAnimations; + } + + public String[] getThrownAnimations() { + return thrownAnimations; + } + + public void setThrownAnimations(String[] thrownAnimations) { + this.thrownAnimations = thrownAnimations; + } + + public String getRandomAnimation(WeaponObject weapon) { + int weaponType = weapon.getWeaponType(); + String[] animations; + + switch (weaponType) { + case 0: + animations = rifleAnimations; + break; + case 1: + animations = carbineAnimations; + break; + case 2: + animations = pistolAnimations; + break; + case 3: + animations = heavyWpnAnimations; + break; + case 4: + animations = oneHandedAnimations; + break; + case 5: + animations = twoHandedAnimations; + break; + case 6: + animations = defaultAnimations; + break; + case 7: + animations = polearmAnimations; + break; + case 8: + animations = thrownAnimations; + break; + case 9: + animations = oneHandedLSAnimations; + break; + case 10: + animations = twoHandedLSAnimations; + break; + case 11: + animations = polearmLSAnimations; + break; + default: + animations = defaultAnimations; + break; + } + + if (animations.length == 0) { + animations = defaultAnimations; + } + + return animations[new Random().nextInt(animations.length)]; + } + } diff --git a/src/services/command/CombatCommand.java b/src/services/command/CombatCommand.java index cab1f4ef..77ecde00 100644 --- a/src/services/command/CombatCommand.java +++ b/src/services/command/CombatCommand.java @@ -21,28 +21,11 @@ ******************************************************************************/ package services.command; -import java.util.Random; - -import resources.objects.weapon.WeaponObject; import engine.clientdata.ClientFileManager; import engine.clientdata.visitors.DatatableVisitor; public class CombatCommand extends BaseSWGCommand { - private String[] defaultAnimations = new String[]{}; - private String[] oneHandedAnimations = new String[]{}; - private String[] twoHandedAnimations = new String[]{}; - private String[] polearmAnimations = new String[]{}; - private String[] unarmedAnimations = new String[]{}; - private String[] pistolAnimations = new String[]{}; - private String[] carbineAnimations = new String[]{}; - private String[] lightRifleAnimations = new String[]{}; - private String[] rifleAnimations = new String[]{}; - private String[] heavyWpnAnimations = new String[]{}; - private String[] oneHandedLSAnimations = new String[]{}; - private String[] twoHandedLSAnimations = new String[]{}; - private String[] polearmLSAnimations = new String[]{}; - private String[] thrownAnimations = new String[]{}; private byte validTargetType; private byte hitType; private byte healType; @@ -67,16 +50,12 @@ public class CombatCommand extends BaseSWGCommand { private int damageType, elementalType, elementalValue; private String performanceSpam; private byte hitSpam; - //private float cooldown; private String delayAttackEggTemplate; private String delayAttackParticle; private float initialAttackDelay; private float delayAttackInterval; private int delayAttackLoops; private int delayAttackEggPosition; - //private String cooldownGroup; - //private float executeTime; - //private float warmupTime; private float vigorCost; // for commando kill meter and bm specials private float criticalChance; private int attack_rolls; @@ -166,119 +145,7 @@ public class CombatCommand extends BaseSWGCommand { e.printStackTrace(); } } - - public String[] getDefaultAnimations() { - return defaultAnimations; - } - - public void setDefaultAnimations(String[] defaultAnimations) { - this.defaultAnimations = defaultAnimations; - } - - public String[] getOneHandedAnimations() { - return oneHandedAnimations; - } - - public void setOneHandedAnimations(String[] oneHandedAnimations) { - this.oneHandedAnimations = oneHandedAnimations; - } - - public String[] getTwoHandedAnimations() { - return twoHandedAnimations; - } - - public void setTwoHandedAnimations(String[] twoHandedAnimations) { - this.twoHandedAnimations = twoHandedAnimations; - } - - public String[] getPolearmAnimations() { - return polearmAnimations; - } - - public void setPolearmAnimations(String[] polearmAnimations) { - this.polearmAnimations = polearmAnimations; - } - - public String[] getUnarmedAnimations() { - return unarmedAnimations; - } - - public void setUnarmedAnimations(String[] unarmedAnimations) { - this.unarmedAnimations = unarmedAnimations; - } - - public String[] getPistolAnimations() { - return pistolAnimations; - } - - public void setPistolAnimations(String[] pistolAnimations) { - this.pistolAnimations = pistolAnimations; - } - - public String[] getCarbineAnimations() { - return carbineAnimations; - } - - public void setCarbineAnimations(String[] carbineAnimations) { - this.carbineAnimations = carbineAnimations; - } - - public String[] getLightRifleAnimations() { - return lightRifleAnimations; - } - - public void setLightRifleAnimations(String[] lightRifleAnimations) { - this.lightRifleAnimations = lightRifleAnimations; - } - - public String[] getRifleAnimations() { - return rifleAnimations; - } - - public void setRifleAnimations(String[] rifleAnimations) { - this.rifleAnimations = rifleAnimations; - } - - public String[] getHeavyWpnAnimations() { - return heavyWpnAnimations; - } - - public void setHeavyWpnAnimations(String[] heavyWpnAnimations) { - this.heavyWpnAnimations = heavyWpnAnimations; - } - - public String[] getOneHandedLSAnimations() { - return oneHandedLSAnimations; - } - - public void setOneHandedLSAnimations(String[] oneHandedLSAnimations) { - this.oneHandedLSAnimations = oneHandedLSAnimations; - } - - public String[] getTwoHandedLSAnimations() { - return twoHandedLSAnimations; - } - - public void setTwoHandedLSAnimations(String[] twoHandedLSAnimations) { - this.twoHandedLSAnimations = twoHandedLSAnimations; - } - - public String[] getPolearmLSAnimations() { - return polearmLSAnimations; - } - - public void setPolearmLSAnimations(String[] polearmLSAnimations) { - this.polearmLSAnimations = polearmLSAnimations; - } - - public String[] getThrownAnimations() { - return thrownAnimations; - } - - public void setThrownAnimations(String[] thrownAnimations) { - this.thrownAnimations = thrownAnimations; - } - + public byte getValidTargetType() { return validTargetType; } @@ -550,64 +417,7 @@ public class CombatCommand extends BaseSWGCommand { public void setHitSpam(byte hitSpam) { this.hitSpam = hitSpam; } - - public String getRandomAnimation(WeaponObject weapon) { - - int weaponType = weapon.getWeaponType(); - String[] animations; - - switch(weaponType) { - - case 0: - animations = rifleAnimations; - break; - case 1: - animations = carbineAnimations; - break; - case 2: - animations = pistolAnimations; - break; - case 3: - animations = heavyWpnAnimations; - break; - case 4: - animations = oneHandedAnimations; - break; - case 5: - animations = twoHandedAnimations; - break; - case 6: - animations = defaultAnimations; - break; - case 7: - animations = polearmAnimations; - break; - case 8: - animations = thrownAnimations; - break; - case 9: - animations = oneHandedLSAnimations; - break; - case 10: - animations = twoHandedLSAnimations; - break; - case 11: - animations = polearmLSAnimations; - break; - - default: - animations = defaultAnimations; - break; - - } - - if(animations.length == 0) - animations = defaultAnimations; - - return animations[new Random().nextInt(animations.length)]; - - } - + public String getDelayAttackEggTemplate() { return delayAttackEggTemplate; } diff --git a/src/services/command/CommandService.java b/src/services/command/CommandService.java index efb0fd84..34e02ecf 100644 --- a/src/services/command/CommandService.java +++ b/src/services/command/CommandService.java @@ -27,7 +27,6 @@ import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; import main.NGECore; @@ -43,7 +42,6 @@ import engine.resources.scene.Point3D; import engine.resources.service.INetworkDispatch; import engine.resources.service.INetworkRemoteEvent; import resources.common.*; -import resources.datatables.StateStatus; import protocol.swg.ObjControllerMessage; import protocol.swg.objectControllerObjects.CommandEnqueue; import protocol.swg.objectControllerObjects.CommandEnqueueRemove; @@ -56,6 +54,7 @@ import resources.objects.weapon.WeaponObject; public class CommandService implements INetworkDispatch { private Vector commandLookup = new Vector(); + private ConcurrentHashMap aliases = new ConcurrentHashMap(); private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); private NGECore core; @@ -63,6 +62,10 @@ public class CommandService implements INetworkDispatch { this.core = core; } + public void registerAlias(String name, String target) { + aliases.put(CRC.StringtoCRC(name.toLowerCase()), CRC.StringtoCRC(target.toLowerCase())); + } + public boolean callCommand(CreatureObject actor, SWGObject target, BaseSWGCommand command, int actionCounter, String commandArgs) { if (actor == null) { return false; @@ -80,7 +83,7 @@ public class CommandService implements INetworkDispatch { return false; } - if (command.getGodLevel() > 0 && !actor.getClient().isGM()) { + if (command.getGodLevel() > 0 && (actor.getClient() == null || !actor.getClient().isGM())) { return false; } @@ -94,14 +97,14 @@ public class CommandService implements INetworkDispatch { return false; } - // The two below statements need testing before use - for (long state : command.getInvalidStates()) { if ((actor.getStateBitmask() & state) == state) { //return false; } } + // This SHOULD be invalid locomotions but we don't track these currently. + // Postures are the best we can do. for (byte posture : command.getInvalidPostures()) { if (actor.getPosture() == posture) { //return false; @@ -109,9 +112,7 @@ public class CommandService implements INetworkDispatch { } switch (command.getTargetType()) { - case 0: // Target Not Used For This Command or Self - target = actor; - + case 0: // Target Not Used For This Command break; case 1: // Other Only if (target == null || target == actor) { @@ -176,7 +177,7 @@ public class CommandService implements INetworkDispatch { } // Without this we could be buffing ally NPCs and such - if (object.getSlottedObject("ghost") == null) { + if (actor.getSlottedObject("ghost") != null && object.getSlottedObject("ghost") == null) { return false; } @@ -208,46 +209,20 @@ public class CommandService implements INetworkDispatch { } long warmupTime = (long) (command.getWarmupTime() * 1000F); - final CreatureObject actorObject = actor; - final SWGObject targetObject = target; - if (warmupTime != 0) { - scheduler.schedule(new Runnable() { - - @Override - public void run() { - processCommand(actorObject, targetObject, command, actionCounter, commandArgs); - } - - }, warmupTime, TimeUnit.MILLISECONDS); - } else { - processCommand(actor, target, command, actionCounter, commandArgs); + try { + Thread.sleep(warmupTime); + } catch (InterruptedException e) { + e.printStackTrace(); } + processCommand(actor, target, command, actionCounter, commandArgs); + return true; } public void callCommand(SWGObject actor, String commandName, SWGObject target, String commandArgs) { - if (actor == null) - return; - - BaseSWGCommand command = getCommandByName(commandName); - - if (command == null) - return; - - if(command instanceof CombatCommand) { - CombatCommand command2; - try { - command2 = (CombatCommand) command.clone(); - processCombatCommand((CreatureObject) actor, target, command2, 0, ""); - } catch (CloneNotSupportedException e) { - e.printStackTrace(); - } - return; - } - - core.scriptService.callScript("scripts/commands/", command.getCommandName(), "run", core, actor, target, commandArgs); + callCommand((CreatureObject) actor, target, getCommandByName(commandName), 0, commandArgs); } public BaseSWGCommand getCommandByCRC(int commandCRC) { @@ -284,15 +259,7 @@ public class CommandService implements INetworkDispatch { sub += 5; } - boolean isCombatCommand = false; - - System.out.println(((String) visitor.getObject(i, 85-sub))); - - if(((String) visitor.getObject(i, 3)).equals("failSpecialAttack") || ((String) visitor.getObject(i, 85-sub)).equals("defaultattack")) - isCombatCommand = true; - - - if (hasCharacterAbility || isCombatCommand) { + if (hasCharacterAbility || isCombatCommand(name)) { CombatCommand command = new CombatCommand(name.toLowerCase()); commandLookup.add(command); return command; @@ -348,13 +315,7 @@ public class CommandService implements INetworkDispatch { sub += 5; } - boolean isCombatCommand = false; - - if(((String) visitor.getObject(i, 3)).equals("failSpecialAttack") || ((String) visitor.getObject(i, 85-sub)).equals("defaultattack")) - isCombatCommand = true; - - // "isCombatCommand" needs to be changed so that non-combat commands that are flagged to added to a combat queue are not considered combat commands - if (hasCharacterAbility || isCombatCommand) { + if (hasCharacterAbility || isCombatCommand(commandName)) { CombatCommand command = new CombatCommand(commandName); commandLookup.add(command); return command; @@ -374,27 +335,37 @@ public class CommandService implements INetworkDispatch { return null; } + public boolean isCombatCommand(String commandName) { + try { + DatatableVisitor visitor = ClientFileManager.loadFile("datatables/combat/combat_data.iff", DatatableVisitor.class); + + for (int i = 0; i < visitor.getRowCount(); i++) { + if (visitor.getObject(i, 0) != null && ((String) (visitor.getObject(i, 0))).equalsIgnoreCase(commandName)) { + return true; + } + } + } catch (Exception e) { + e.printStackTrace(); + } + + return false; + } + public void processCommand(CreatureObject actor, SWGObject target, BaseSWGCommand command, int actionCounter, String commandArgs) { actor.addCooldown(command.getCooldownGroup(), command.getCooldown()); + if (command instanceof CombatCommand) { processCombatCommand(actor, target, (CombatCommand) command, actionCounter, commandArgs); } else { if (FileUtilities.doesFileExist("scripts/commands/" + command.getCommandName() + ".py")) { core.scriptService.callScript("scripts/commands/", command.getCommandName(), "run", core, actor, target, commandArgs); + } else if (FileUtilities.doesFileExist("scripts/commands/combat/" + command.getCommandName() + ".py")) { + core.scriptService.callScript("scripts/commands/combat/", command.getCommandName(), "run", core, actor, target, commandArgs); } } } public void processCombatCommand(CreatureObject attacker, SWGObject target, CombatCommand command, int actionCounter, String commandArgs) { - - // Check if the person has access to this ability. - // Abilities (inc expertise ones) are added automatically as they level - // by reading the datatables. - // disabled for now (breaks all combat) - //if (!attacker.hasAbility(command.getCommandName())) { - // return; - //} - if(FileUtilities.doesFileExist("scripts/commands/combat/" + command.getCommandName() + ".py")) { core.scriptService.callScript("scripts/commands/combat/", command.getCommandName(), "setup", core, attacker, target, command); @@ -502,7 +473,6 @@ public class CommandService implements INetworkDispatch { @Override public void handlePacket(IoSession session, IoBuffer data) throws Exception { - data.order(ByteOrder.LITTLE_ENDIAN); Client client = core.getClient(session); @@ -514,7 +484,13 @@ public class CommandService implements INetworkDispatch { CommandEnqueue commandEnqueue = new CommandEnqueue(); commandEnqueue.deserialize(data); - BaseSWGCommand command = getCommandByCRC(commandEnqueue.getCommandCRC()); + int commandCRC = commandEnqueue.getCommandCRC(); + + if (aliases.containsKey(commandEnqueue.getCommandCRC())) { + commandCRC = aliases.get(commandCRC); + } + + BaseSWGCommand command = getCommandByCRC(commandCRC); if (command == null) { //System.out.println("Unknown Command CRC: " + commandEnqueue.getCommandCRC()); @@ -553,26 +529,8 @@ public class CommandService implements INetworkDispatch { } - public CombatCommand registerCombatCommand(String name) { - BaseSWGCommand command = getCommandByName(name); - - if (command == null) { - return null; - } - - if (command instanceof CombatCommand) { - return (CombatCommand) command; - } else { - System.out.println("Warning: Forced to make non-combat command " + name + " a combat command."); - commandLookup.remove(command); - CombatCommand combatCommand = new CombatCommand(name.toLowerCase()); - commandLookup.add(combatCommand); - return combatCommand; - } - } - + public BaseSWGCommand registerCombatCommand(String name) { return getCommandByName(name); } public BaseSWGCommand registerCommand(String name) { return getCommandByName(name); } public BaseSWGCommand registerGmCommand(String name) { return getCommandByName(name); } - public void registerAlias(String name, String target) { } } diff --git a/src/services/gcw/FactionService.java b/src/services/gcw/FactionService.java index afe73fd5..4148f969 100644 --- a/src/services/gcw/FactionService.java +++ b/src/services/gcw/FactionService.java @@ -37,7 +37,6 @@ import protocol.swg.FactionResponseMessage; import resources.common.FileUtilities; import resources.common.Opcodes; import resources.datatables.FactionStatus; -import resources.datatables.Options; import resources.datatables.PvpStatus; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; diff --git a/src/services/guild/GuildService.java b/src/services/guild/GuildService.java index f591db3e..022895de 100644 --- a/src/services/guild/GuildService.java +++ b/src/services/guild/GuildService.java @@ -23,7 +23,6 @@ package services.guild; import java.util.Map; -import resources.common.Console; import resources.guild.Guild; import resources.objects.SWGList; import resources.objects.guild.GuildObject; diff --git a/src/services/housing/HouseTemplate.java b/src/services/housing/HouseTemplate.java index fc2861df..3918cf55 100644 --- a/src/services/housing/HouseTemplate.java +++ b/src/services/housing/HouseTemplate.java @@ -57,7 +57,7 @@ public class HouseTemplate public boolean canBePlacedOn(String planetName) { if(placeablePlanets.contains(planetName)) return true; - else return false; + return false; } public int getLotCost() { diff --git a/src/services/housing/HousingService.java b/src/services/housing/HousingService.java index 3bcc9188..a9f427b5 100644 --- a/src/services/housing/HousingService.java +++ b/src/services/housing/HousingService.java @@ -33,16 +33,11 @@ import java.util.Map; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; -import com.sleepycat.persist.EntityCursor; - import main.NGECore; import protocol.swg.EnterStructurePlacementModeMessage; import resources.objects.building.BuildingObject; import resources.objects.creature.CreatureObject; -import resources.objects.player.PlayerObject; import resources.objects.tangible.TangibleObject; -import services.chat.Mail; -import services.equipment.BonusSetTemplate; import engine.resources.objects.SWGObject; import engine.resources.scene.Point3D; import engine.resources.scene.Quaternion; @@ -97,12 +92,11 @@ public class HousingService implements INetworkDispatch { } // Lot stuff - if(actor.getPlayerObject().getLotsRemaining() - structureLotCost < 0) + if(!actor.getPlayerObject().deductLots(structureLotCost)) { actor.sendSystemMessage("You do not have enough available lots to place this structure.", (byte) 0); // should probably load this from an stf return; } - actor.getPlayerObject().deductLots(structureLotCost); // Calculate our orientation and height Quaternion quaternion = new Quaternion(1, 0, 0, 0); diff --git a/src/services/object/ObjectService.java b/src/services/object/ObjectService.java index 6c5a44a4..816d910b 100644 --- a/src/services/object/ObjectService.java +++ b/src/services/object/ObjectService.java @@ -58,10 +58,6 @@ import com.sleepycat.persist.EntityCursor; import com.sleepycat.persist.model.Entity; import com.sleepycat.persist.model.PrimaryKey; -import protocol.swg.ChatFriendsListUpdate; -import protocol.swg.ChatOnChangeFriendStatus; -import protocol.swg.ChatOnGetFriendsList; -import protocol.swg.ChatRoomList; import protocol.swg.CmdSceneReady; import protocol.swg.CmdStartScene; import protocol.swg.HeartBeatMessage; @@ -70,6 +66,12 @@ import protocol.swg.ParametersMessage; import protocol.swg.SelectCharacter; import protocol.swg.ServerTimeMessage; import protocol.swg.UnkByteFlag; +import protocol.swg.chat.ChatFriendsListUpdate; +import protocol.swg.chat.ChatOnChangeFriendStatus; +import protocol.swg.chat.ChatOnConnectAvatar; +import protocol.swg.chat.ChatOnGetFriendsList; +import protocol.swg.chat.ChatRoomList; +import protocol.swg.chat.ChatServerStatus; import protocol.swg.objectControllerObjects.UiPlayEffect; import engine.clientdata.ClientFileManager; import engine.clientdata.visitors.CrcStringTableVisitor; @@ -783,10 +785,18 @@ public class ObjectService implements INetworkDispatch { core.chatService.loadMailHeaders(client); core.simulationService.handleZoneIn(client); + creature.makeAware(creature); + ChatServerStatus chatStatus = new ChatServerStatus(); + creature.getClient().getSession().write(chatStatus.serialize()); + + ChatOnConnectAvatar chatConnect = new ChatOnConnectAvatar(); + creature.getClient().getSession().write(chatConnect.serialize()); + ChatRoomList chatRooms = new ChatRoomList(core.chatService.getChatRooms()); creature.getClient().getSession().write(chatRooms.serialize()); + //ChatOnGetFriendsList friendsListMessage = new ChatOnGetFriendsList(ghost); //client.getSession().write(friendsListMessage.serialize()); diff --git a/src/services/resources/ResourceService.java b/src/services/resources/ResourceService.java index fa546a01..efc62fe1 100644 --- a/src/services/resources/ResourceService.java +++ b/src/services/resources/ResourceService.java @@ -28,7 +28,6 @@ import java.util.Random; import java.util.Vector; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; import com.sleepycat.persist.EntityCursor; import main.NGECore; import engine.resources.common.CRC; diff --git a/src/services/spawn/DynamicSpawnArea.java b/src/services/spawn/DynamicSpawnArea.java index a5df57d7..e588e4cd 100644 --- a/src/services/spawn/DynamicSpawnArea.java +++ b/src/services/spawn/DynamicSpawnArea.java @@ -25,7 +25,6 @@ import net.engio.mbassy.listener.Handler; import resources.common.collidables.AbstractCollidable; import resources.common.collidables.AbstractCollidable.EnterEvent; import resources.common.collidables.AbstractCollidable.ExitEvent; -import services.SimulationService.MoveEvent; import engine.resources.scene.Planet; public class DynamicSpawnArea extends SpawnArea { diff --git a/src/services/spawn/MobileTemplate.java b/src/services/spawn/MobileTemplate.java index 4d289bb8..78664aa2 100644 --- a/src/services/spawn/MobileTemplate.java +++ b/src/services/spawn/MobileTemplate.java @@ -23,10 +23,8 @@ package services.spawn; import java.util.Vector; -import main.NGECore; import resources.datatables.Options; import resources.datatables.PvpStatus; -import resources.objects.weapon.WeaponObject; public class MobileTemplate { diff --git a/src/services/spawn/SpawnArea.java b/src/services/spawn/SpawnArea.java index aadb1746..2d64c576 100644 --- a/src/services/spawn/SpawnArea.java +++ b/src/services/spawn/SpawnArea.java @@ -28,7 +28,6 @@ import net.engio.mbassy.listener.Handler; import resources.common.collidables.AbstractCollidable; import resources.common.collidables.AbstractCollidable.EnterEvent; import resources.common.collidables.AbstractCollidable.ExitEvent; -import services.SimulationService.MoveEvent; import engine.resources.objects.SWGObject; import engine.resources.scene.Planet; diff --git a/src/services/spawn/SpawnService.java b/src/services/spawn/SpawnService.java index 74da646a..dbb967ef 100644 --- a/src/services/spawn/SpawnService.java +++ b/src/services/spawn/SpawnService.java @@ -38,8 +38,6 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; -import org.python.core.Py; - import resources.common.collidables.CollidableCircle; import resources.datatables.Options; import resources.datatables.PvpStatus; diff --git a/src/services/spawn/StaticSpawnArea.java b/src/services/spawn/StaticSpawnArea.java index 2bce6aef..64de8d63 100644 --- a/src/services/spawn/StaticSpawnArea.java +++ b/src/services/spawn/StaticSpawnArea.java @@ -25,7 +25,6 @@ import net.engio.mbassy.listener.Handler; import resources.common.collidables.AbstractCollidable; import resources.common.collidables.AbstractCollidable.EnterEvent; import resources.common.collidables.AbstractCollidable.ExitEvent; -import services.SimulationService.MoveEvent; import engine.resources.scene.Planet; public class StaticSpawnArea extends SpawnArea { diff --git a/src/services/sui/SUIService.java b/src/services/sui/SUIService.java index f74c20d0..eb853838 100644 --- a/src/services/sui/SUIService.java +++ b/src/services/sui/SUIService.java @@ -23,7 +23,6 @@ package services.sui; import java.nio.ByteOrder; import java.util.Map; -import java.util.Map.Entry; import java.util.Random; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; @@ -82,6 +81,16 @@ public class SUIService implements INetworkDispatch { if(target == null || owner == null) return; + if(target.getGrandparent() != null && target.getGrandparent().getAttachment("structureAdmins") != null) + { + if(core.housingService.getPermissions(owner, target.getContainer())) + { + core.scriptService.callScript("scripts/radial/", "moveable", "createRadial", core, owner, target, request.getRadialOptions()); + sendRadial(owner, target, request.getRadialOptions(), request.getRadialCount()); + return; + } + } + core.scriptService.callScript("scripts/radial/", getRadialFilename(target), "createRadial", core, owner, target, request.getRadialOptions()); if(getRadialFilename(target).equals("default")) return; diff --git a/src/services/travel/TravelService.java b/src/services/travel/TravelService.java index 6cd5c7c1..a6929851 100644 --- a/src/services/travel/TravelService.java +++ b/src/services/travel/TravelService.java @@ -25,7 +25,6 @@ import java.nio.ByteOrder; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Random; import java.util.Vector; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executors; diff --git a/src/tools/CharonPacketUtils.java b/src/tools/CharonPacketUtils.java index b7eb10a1..7c091133 100644 --- a/src/tools/CharonPacketUtils.java +++ b/src/tools/CharonPacketUtils.java @@ -56,7 +56,7 @@ public class CharonPacketUtils { public static void printAnalysis(IoBuffer pack){ - if (!NGECore.getInstance().PACKET_DEBUG) + if (!NGECore.PACKET_DEBUG) return; byte[] packArray = pack.array();