diff --git a/.classpath b/.classpath index fec953ab2..fc3c2fc4e 100644 --- a/.classpath +++ b/.classpath @@ -4,5 +4,6 @@ + diff --git a/.gitignore b/.gitignore index 83d3b4df4..110388d76 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ /serverdata/**/*.db /log *.db-journal +/lib/ +/serverdata/ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..7794cac0d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "PSWGCommon"] + path = PSWGCommon + url = git@bitbucket.org:projectswg/pswgcommon.git diff --git a/.project b/.project index aa5b305c2..51c63351c 100644 --- a/.project +++ b/.project @@ -11,13 +11,8 @@ - org.eclipse.ui.externaltools.ExternalToolBuilder - full,incremental, + org.eclipse.buildship.core.gradleprojectbuilder - - LaunchConfigHandle - <project>/.externalToolBuilders/org.eclipse.buildship.core.gradleprojectbuilder (1).launch - diff --git a/PSWGCommon b/PSWGCommon new file mode 120000 index 000000000..8871044d4 --- /dev/null +++ b/PSWGCommon @@ -0,0 +1 @@ +/home/josh/devel/ProjectSWG/swg_workspace/PSWGCommon/ \ No newline at end of file diff --git a/build.gradle b/build.gradle index 5f8580598..444af0753 100644 --- a/build.gradle +++ b/build.gradle @@ -38,15 +38,18 @@ shadowJar{ } dependencies { + compile project(':PSWGCommon') compile fileTree(dir: 'lib', include: ['*.jar']) testCompile fileTree(dir: 'lib', include: ['*.jar']) } +repositories { + mavenCentral() +} + buildscript { repositories { - maven { - url 'https://plugins.gradle.org/m2/' - } + jcenter() } dependencies { classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.0' diff --git a/lib/PSWGCommon.jar b/lib/PSWGCommon.jar deleted file mode 100644 index 9137fe758..000000000 Binary files a/lib/PSWGCommon.jar and /dev/null differ diff --git a/src/intents/FactionIntent.java b/src/intents/FactionIntent.java index d33f9e92e..6424115ab 100644 --- a/src/intents/FactionIntent.java +++ b/src/intents/FactionIntent.java @@ -28,9 +28,9 @@ package intents; import com.projectswg.common.control.Intent; +import com.projectswg.common.data.encodables.tangible.PvpFaction; +import com.projectswg.common.data.encodables.tangible.PvpStatus; -import resources.PvpFaction; -import resources.PvpStatus; import resources.objects.tangible.TangibleObject; public class FactionIntent extends Intent { diff --git a/src/intents/NotifyPlayersPacketIntent.java b/src/intents/NotifyPlayersPacketIntent.java index f44944107..7f7894227 100644 --- a/src/intents/NotifyPlayersPacketIntent.java +++ b/src/intents/NotifyPlayersPacketIntent.java @@ -31,46 +31,46 @@ import java.util.List; import com.projectswg.common.control.Intent; import com.projectswg.common.data.location.Terrain; +import com.projectswg.common.network.packets.SWGPacket; -import network.packets.Packet; import resources.player.Player; public class NotifyPlayersPacketIntent extends Intent { - private Packet packet; + private SWGPacket SWGPacket; private Terrain terrain; private List networkIds; private ConditionalNotify condition; - public NotifyPlayersPacketIntent(Packet packet, Terrain terrain, ConditionalNotify condition, List networkIds) { - this.packet = packet; + public NotifyPlayersPacketIntent(SWGPacket SWGPacket, Terrain terrain, ConditionalNotify condition, List networkIds) { + this.SWGPacket = SWGPacket; this.terrain = terrain; this.condition = condition; this.networkIds = networkIds; } - public NotifyPlayersPacketIntent(Packet packet, Terrain terrain, ConditionalNotify condition) { - this(packet, terrain, condition, null); + public NotifyPlayersPacketIntent(SWGPacket SWGPacket, Terrain terrain, ConditionalNotify condition) { + this(SWGPacket, terrain, condition, null); } - public NotifyPlayersPacketIntent(Packet packet, ConditionalNotify condition, List networkIds) { - this(packet, null, condition, networkIds); + public NotifyPlayersPacketIntent(SWGPacket SWGPacket, ConditionalNotify condition, List networkIds) { + this(SWGPacket, null, condition, networkIds); } - public NotifyPlayersPacketIntent(Packet packet, List networkIds) { - this(packet, null, null, networkIds); + public NotifyPlayersPacketIntent(SWGPacket SWGPacket, List networkIds) { + this(SWGPacket, null, null, networkIds); } - public NotifyPlayersPacketIntent(Packet packet, Terrain terrain) { - this(packet, terrain, null); + public NotifyPlayersPacketIntent(SWGPacket SWGPacket, Terrain terrain) { + this(SWGPacket, terrain, null); } - public NotifyPlayersPacketIntent(Packet p) { + public NotifyPlayersPacketIntent(SWGPacket p) { this(p, null, null, null); } - public Packet getPacket() { - return packet; + public SWGPacket getPacket() { + return SWGPacket; } public Terrain getTerrain() { diff --git a/src/intents/chat/ChatRoomUpdateIntent.java b/src/intents/chat/ChatRoomUpdateIntent.java index cd7a44fe4..753466a48 100644 --- a/src/intents/chat/ChatRoomUpdateIntent.java +++ b/src/intents/chat/ChatRoomUpdateIntent.java @@ -27,8 +27,8 @@ package intents.chat; import com.projectswg.common.control.Intent; +import com.projectswg.common.data.encodables.chat.ChatAvatar; -import resources.chat.ChatAvatar; import resources.player.Player; public class ChatRoomUpdateIntent extends Intent { diff --git a/src/intents/chat/PersistentMessageIntent.java b/src/intents/chat/PersistentMessageIntent.java index f60684338..6d96ae709 100644 --- a/src/intents/chat/PersistentMessageIntent.java +++ b/src/intents/chat/PersistentMessageIntent.java @@ -28,8 +28,8 @@ package intents.chat; import com.projectswg.common.control.Intent; +import com.projectswg.common.data.encodables.player.Mail; -import resources.encodables.player.Mail; import resources.objects.SWGObject; public class PersistentMessageIntent extends Intent { diff --git a/src/intents/chat/SystemMessageIntent.java b/src/intents/chat/SystemMessageIntent.java index 9cc2605cd..e53976310 100644 --- a/src/intents/chat/SystemMessageIntent.java +++ b/src/intents/chat/SystemMessageIntent.java @@ -28,9 +28,9 @@ package intents.chat; import com.projectswg.common.control.Intent; +import com.projectswg.common.data.encodables.oob.ProsePackage; import com.projectswg.common.data.location.Terrain; -import resources.encodables.ProsePackage; import resources.player.Player; public class SystemMessageIntent extends Intent { diff --git a/src/intents/network/ConnectionClosedIntent.java b/src/intents/network/ConnectionClosedIntent.java index f16bdfedc..83264d9c2 100644 --- a/src/intents/network/ConnectionClosedIntent.java +++ b/src/intents/network/ConnectionClosedIntent.java @@ -28,8 +28,7 @@ package intents.network; import com.projectswg.common.control.Intent; - -import network.packets.swg.holo.HoloConnectionStopped.ConnectionStoppedReason; +import com.projectswg.common.network.packets.swg.holo.HoloConnectionStopped.ConnectionStoppedReason; public class ConnectionClosedIntent extends Intent { diff --git a/src/intents/network/GalacticPacketIntent.java b/src/intents/network/GalacticPacketIntent.java index 4df3119a6..595db4231 100644 --- a/src/intents/network/GalacticPacketIntent.java +++ b/src/intents/network/GalacticPacketIntent.java @@ -27,30 +27,31 @@ ***********************************************************************************/ package intents.network; +import com.projectswg.common.network.packets.SWGPacket; + import intents.GalacticIntent; -import network.packets.Packet; import resources.player.Player; public class GalacticPacketIntent extends GalacticIntent { - private Packet packet; + private SWGPacket SWGPacket; private Player player; - public GalacticPacketIntent(Packet packet, Player player) { - setPacket(packet); + public GalacticPacketIntent(SWGPacket SWGPacket, Player player) { + setPacket(SWGPacket); setPlayer(player); } - public Packet getPacket() { - return packet; + public SWGPacket getPacket() { + return SWGPacket; } public Player getPlayer() { return player; } - public void setPacket(Packet packet) { - this.packet = packet; + public void setPacket(SWGPacket SWGPacket) { + this.SWGPacket = SWGPacket; } public void setPlayer(Player player) { diff --git a/src/intents/network/InboundPacketIntent.java b/src/intents/network/InboundPacketIntent.java index c22021ad6..8b5568317 100644 --- a/src/intents/network/InboundPacketIntent.java +++ b/src/intents/network/InboundPacketIntent.java @@ -28,29 +28,28 @@ package intents.network; import com.projectswg.common.control.Intent; - -import network.packets.Packet; +import com.projectswg.common.network.packets.SWGPacket; public class InboundPacketIntent extends Intent { - private Packet packet; + private SWGPacket SWGPacket; private long networkId; - public InboundPacketIntent(Packet p, long networkId) { + public InboundPacketIntent(SWGPacket p, long networkId) { setPacket(p); setNetworkId(networkId); } - public void setPacket(Packet p) { - this.packet = p; + public void setPacket(SWGPacket p) { + this.SWGPacket = p; } public void setNetworkId(long networkId) { this.networkId = networkId; } - public Packet getPacket() { - return packet; + public SWGPacket getPacket() { + return SWGPacket; } public long getNetworkId() { diff --git a/src/intents/network/OutboundPacketIntent.java b/src/intents/network/OutboundPacketIntent.java index 091efabb5..762fe8859 100644 --- a/src/intents/network/OutboundPacketIntent.java +++ b/src/intents/network/OutboundPacketIntent.java @@ -28,29 +28,28 @@ package intents.network; import com.projectswg.common.control.Intent; - -import network.packets.Packet; +import com.projectswg.common.network.packets.SWGPacket; public class OutboundPacketIntent extends Intent { - private Packet packet; + private SWGPacket SWGPacket; private long networkId; - public OutboundPacketIntent(Packet p, long networkId) { + public OutboundPacketIntent(SWGPacket p, long networkId) { setPacket(p); setNetworkId(networkId); } - public void setPacket(Packet p) { - this.packet = p; + public void setPacket(SWGPacket p) { + this.SWGPacket = p; } public void setNetworkId(long networkId) { this.networkId = networkId; } - public Packet getPacket() { - return packet; + public SWGPacket getPacket() { + return SWGPacket; } public long getNetworkId() { diff --git a/src/intents/object/ObjectCreatedIntent.java b/src/intents/object/ObjectCreatedIntent.java index 738463bfe..be0f7c14a 100644 --- a/src/intents/object/ObjectCreatedIntent.java +++ b/src/intents/object/ObjectCreatedIntent.java @@ -43,4 +43,8 @@ public class ObjectCreatedIntent extends Intent { return obj; } + public static void broadcast(SWGObject obj) { + new ObjectCreatedIntent(obj).broadcast(); + } + } diff --git a/src/intents/radial/RadialRequestIntent.java b/src/intents/radial/RadialRequestIntent.java index 420969067..8f5ad1fb8 100644 --- a/src/intents/radial/RadialRequestIntent.java +++ b/src/intents/radial/RadialRequestIntent.java @@ -28,8 +28,8 @@ package intents.radial; import com.projectswg.common.control.Intent; +import com.projectswg.common.network.packets.swg.zone.object_controller.ObjectMenuRequest; -import network.packets.swg.zone.object_controller.ObjectMenuRequest; import resources.objects.SWGObject; import resources.player.Player; diff --git a/src/intents/radial/RadialResponseIntent.java b/src/intents/radial/RadialResponseIntent.java index 0a3351427..bf83f209c 100644 --- a/src/intents/radial/RadialResponseIntent.java +++ b/src/intents/radial/RadialResponseIntent.java @@ -30,10 +30,10 @@ package intents.radial; import java.util.List; import com.projectswg.common.control.Intent; +import com.projectswg.common.data.radial.RadialOption; import resources.objects.SWGObject; import resources.player.Player; -import resources.radial.RadialOption; public class RadialResponseIntent extends Intent { diff --git a/src/intents/radial/RadialSelectionIntent.java b/src/intents/radial/RadialSelectionIntent.java index a77d81de9..805701a7f 100644 --- a/src/intents/radial/RadialSelectionIntent.java +++ b/src/intents/radial/RadialSelectionIntent.java @@ -28,10 +28,10 @@ package intents.radial; import com.projectswg.common.control.Intent; +import com.projectswg.common.data.radial.RadialItem; import resources.objects.SWGObject; import resources.player.Player; -import resources.radial.RadialItem; public class RadialSelectionIntent extends Intent { diff --git a/src/intents/sui/SuiWindowIntent.java b/src/intents/sui/SuiWindowIntent.java index f2fc8a791..7eaec174c 100644 --- a/src/intents/sui/SuiWindowIntent.java +++ b/src/intents/sui/SuiWindowIntent.java @@ -28,9 +28,9 @@ package intents.sui; import com.projectswg.common.control.Intent; +import com.projectswg.common.data.sui.SuiBaseWindow; import resources.player.Player; -import resources.sui.SuiBaseWindow; public class SuiWindowIntent extends Intent { diff --git a/src/main/ProjectSWG.java b/src/main/ProjectSWG.java index 53f2bfac1..499387a85 100644 --- a/src/main/ProjectSWG.java +++ b/src/main/ProjectSWG.java @@ -44,13 +44,13 @@ import org.junit.runner.notification.Failure; import com.projectswg.common.concurrency.Delay; import com.projectswg.common.control.IntentManager; import com.projectswg.common.control.IntentManager.IntentSpeedRecord; +import com.projectswg.common.data.encodables.galaxy.Galaxy.GalaxyStatus; import com.projectswg.common.debug.Log; import com.projectswg.common.debug.Log.LogLevel; import com.projectswg.common.debug.log_wrapper.ConsoleLogWrapper; import com.projectswg.common.debug.log_wrapper.FileLogWrapper; import intents.server.ServerStatusIntent; -import resources.Galaxy.GalaxyStatus; import resources.control.ServerStatus; import resources.server_info.DataManager; import services.CoreManager; diff --git a/src/network/AdminNetworkClient.java b/src/network/AdminNetworkClient.java index 489a1724b..7cfbf2d85 100644 --- a/src/network/AdminNetworkClient.java +++ b/src/network/AdminNetworkClient.java @@ -29,20 +29,23 @@ package network; import java.net.SocketAddress; -import network.packets.Packet; +import com.projectswg.common.network.packets.SWGPacket; + import services.network.PacketSender; public class AdminNetworkClient extends NetworkClient { - + public AdminNetworkClient(SocketAddress address, long networkId, PacketSender sender) { super(address, networkId, sender); } - protected boolean isInboundAllowed(Packet p) { + @Override + protected boolean isInboundAllowed(SWGPacket p) { return true; } - protected boolean isOutboundAllowed(Packet p) { + @Override + protected boolean isOutboundAllowed(SWGPacket p) { return true; } diff --git a/src/network/NetworkClient.java b/src/network/NetworkClient.java index 98ecd087e..8b26d3385 100644 --- a/src/network/NetworkClient.java +++ b/src/network/NetworkClient.java @@ -36,14 +36,14 @@ import com.projectswg.common.control.IntentChain; import com.projectswg.common.debug.Assert; import com.projectswg.common.debug.Log; import com.projectswg.common.network.NetBufferStream; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.admin.AdminPacket; +import com.projectswg.common.network.packets.swg.holo.HoloConnectionStopped; +import com.projectswg.common.network.packets.swg.holo.HoloConnectionStopped.ConnectionStoppedReason; import intents.network.ConnectionClosedIntent; import intents.network.ConnectionOpenedIntent; import intents.network.InboundPacketIntent; -import network.packets.Packet; -import network.packets.swg.admin.AdminPacket; -import network.packets.swg.holo.HoloConnectionStopped; -import network.packets.swg.holo.HoloConnectionStopped.ConnectionStoppedReason; import services.network.HolocoreSessionManager; import services.network.HolocoreSessionManager.ResponseAction; import services.network.NetworkProtocol; @@ -129,18 +129,18 @@ public class NetworkClient { } } - public void addToOutbound(Packet packet) { + public void addToOutbound(SWGPacket SWGPacket) { if (getState() != State.CONNECTED) return; synchronized (outboundMutex) { - ResponseAction action = sessionManager.onOutbound(packet); + ResponseAction action = sessionManager.onOutbound(SWGPacket); if (action != ResponseAction.CONTINUE) { flushOutbound(); return; } - if (!isOutboundAllowed(packet)) + if (!isOutboundAllowed(SWGPacket)) return; - sendPacket(packet); + sendPacket(SWGPacket); } } @@ -151,16 +151,16 @@ public class NetworkClient { } } - protected boolean isInboundAllowed(Packet p) { + protected boolean isInboundAllowed(SWGPacket p) { return !(p instanceof AdminPacket); } - protected boolean isOutboundAllowed(Packet p) { + protected boolean isOutboundAllowed(SWGPacket p) { return !(p instanceof AdminPacket); } private boolean processNextPacket() throws EOFException { - Packet p; + SWGPacket p; synchronized (buffer) { if (!protocol.canDecode(buffer)) return false; @@ -176,7 +176,7 @@ public class NetworkClient { return true; } - private boolean processInbound(Packet p) { + private boolean processInbound(SWGPacket p) { ResponseAction action = sessionManager.onInbound(p); flushOutbound(); if (action == ResponseAction.IGNORE) @@ -190,14 +190,14 @@ public class NetworkClient { } private void flushOutbound() { - for (Packet out : sessionManager.getOutbound()) { + for (SWGPacket out : sessionManager.getOutbound()) { sendPacket(out); } } - private void sendPacket(Packet p) { + private void sendPacket(SWGPacket p) { if (sender == null) { - Log.w("Unable to send packet %s - sender is null!"); + Log.w("Unable to send SWGPacket %s - sender is null!"); return; } sender.sendPacket(address, protocol.encode(p)); @@ -220,6 +220,7 @@ public class NetworkClient { } } + @Override public String toString() { return "NetworkClient["+address+"]"; } diff --git a/src/network/PacketType.java b/src/network/PacketType.java deleted file mode 100644 index 563de9e59..000000000 --- a/src/network/PacketType.java +++ /dev/null @@ -1,407 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network; - -import java.util.HashMap; -import java.util.Map; - -import com.projectswg.common.debug.Log; - -import network.packets.swg.ErrorMessage; -import network.packets.swg.SWGPacket; -import network.packets.swg.ServerUnixEpochTime; -import network.packets.swg.admin.AdminShutdownServer; -import network.packets.swg.holo.HoloConnectionStarted; -import network.packets.swg.holo.HoloConnectionStopped; -import network.packets.swg.holo.HoloSetProtocolVersion; -import network.packets.swg.login.AccountFeatureBits; -import network.packets.swg.login.CharacterCreationDisabled; -import network.packets.swg.login.ClientIdMsg; -import network.packets.swg.login.ClientPermissionsMessage; -import network.packets.swg.login.ConnectionServerLagResponse; -import network.packets.swg.login.EnumerateCharacterId; -import network.packets.swg.login.LoginClientId; -import network.packets.swg.login.LoginClientToken; -import network.packets.swg.login.LoginClusterStatus; -import network.packets.swg.login.LoginEnumCluster; -import network.packets.swg.login.LoginIncorrectClientId; -import network.packets.swg.login.OfflineServersMessage; -import network.packets.swg.login.RequestExtendedClusters; -import network.packets.swg.login.ServerId; -import network.packets.swg.login.ServerString; -import network.packets.swg.login.StationIdHasJediSlot; -import network.packets.swg.login.creation.ClientCreateCharacter; -import network.packets.swg.login.creation.ClientVerifyAndLockNameRequest; -import network.packets.swg.login.creation.ClientVerifyAndLockNameResponse; -import network.packets.swg.login.creation.CreateCharacterFailure; -import network.packets.swg.login.creation.CreateCharacterSuccess; -import network.packets.swg.login.creation.DeleteCharacterRequest; -import network.packets.swg.login.creation.DeleteCharacterResponse; -import network.packets.swg.login.creation.RandomNameRequest; -import network.packets.swg.login.creation.RandomNameResponse; -import network.packets.swg.zone.ClientOpenContainerMessage; -import network.packets.swg.zone.CmdSceneReady; -import network.packets.swg.zone.ConnectPlayerResponseMessage; -import network.packets.swg.zone.EnterTicketPurchaseModeMessage; -import network.packets.swg.zone.ExpertiseRequestMessage; -import network.packets.swg.zone.GalaxyLoopTimesResponse; -import network.packets.swg.zone.GameServerLagResponse; -import network.packets.swg.zone.HeartBeat; -import network.packets.swg.zone.LagRequest; -import network.packets.swg.zone.ObjectMenuSelect; -import network.packets.swg.zone.ParametersMessage; -import network.packets.swg.zone.PlanetTravelPointListRequest; -import network.packets.swg.zone.PlanetTravelPointListResponse; -import network.packets.swg.zone.PlayClientEffectObjectMessage; -import network.packets.swg.zone.PlayMusicMessage; -import network.packets.swg.zone.RequestGalaxyLoopTimes; -import network.packets.swg.zone.SceneCreateObjectByCrc; -import network.packets.swg.zone.SceneDestroyObject; -import network.packets.swg.zone.SceneEndBaselines; -import network.packets.swg.zone.ServerNowEpochTime; -import network.packets.swg.zone.ServerTimeMessage; -import network.packets.swg.zone.ServerWeatherMessage; -import network.packets.swg.zone.SetWaypointColor; -import network.packets.swg.zone.ShowBackpack; -import network.packets.swg.zone.ShowHelmet; -import network.packets.swg.zone.StopClientEffectObjectByLabelMessage; -import network.packets.swg.zone.UpdateContainmentMessage; -import network.packets.swg.zone.UpdatePostureMessage; -import network.packets.swg.zone.UpdatePvpStatusMessage; -import network.packets.swg.zone.UpdateTransformMessage; -import network.packets.swg.zone.UpdateTransformWithParentMessage; -import network.packets.swg.zone.auction.AuctionQueryHeadersMessage; -import network.packets.swg.zone.auction.AuctionQueryHeadersResponseMessage; -import network.packets.swg.zone.auction.CancelLiveAuctionMessage; -import network.packets.swg.zone.auction.CancelLiveAuctionResponseMessage; -import network.packets.swg.zone.auction.CommoditiesItemTypeListRequest; -import network.packets.swg.zone.auction.CommoditiesItemTypeListResponse; -import network.packets.swg.zone.auction.GetAuctionDetails; -import network.packets.swg.zone.auction.GetAuctionDetailsResponse; -import network.packets.swg.zone.auction.IsVendorOwnerMessage; -import network.packets.swg.zone.auction.IsVendorOwnerResponseMessage; -import network.packets.swg.zone.auction.RetrieveAuctionItemMessage; -import network.packets.swg.zone.auction.RetrieveAuctionItemResponseMessage; -import network.packets.swg.zone.baselines.Baseline; -import network.packets.swg.zone.building.UpdateCellPermissionMessage; -import network.packets.swg.zone.chat.ChatAddModeratorToRoom; -import network.packets.swg.zone.chat.ChatBanAvatarFromRoom; -import network.packets.swg.zone.chat.ChatCreateRoom; -import network.packets.swg.zone.chat.ChatDeletePersistentMessage; -import network.packets.swg.zone.chat.ChatDestroyRoom; -import network.packets.swg.zone.chat.ChatEnterRoomById; -import network.packets.swg.zone.chat.ChatFriendsListUpdate; -import network.packets.swg.zone.chat.ChatIgnoreList; -import network.packets.swg.zone.chat.ChatInstantMessageToCharacter; -import network.packets.swg.zone.chat.ChatInstantMessageToClient; -import network.packets.swg.zone.chat.ChatInviteAvatarToRoom; -import network.packets.swg.zone.chat.ChatKickAvatarFromRoom; -import network.packets.swg.zone.chat.ChatOnConnectAvatar; -import network.packets.swg.zone.chat.ChatOnCreateRoom; -import network.packets.swg.zone.chat.ChatOnDestroyRoom; -import network.packets.swg.zone.chat.ChatOnEnteredRoom; -import network.packets.swg.zone.chat.ChatOnLeaveRoom; -import network.packets.swg.zone.chat.ChatOnReceiveRoomInvitation; -import network.packets.swg.zone.chat.ChatOnSendInstantMessage; -import network.packets.swg.zone.chat.ChatOnSendRoomMessage; -import network.packets.swg.zone.chat.ChatPersistentMessageToClient; -import network.packets.swg.zone.chat.ChatPersistentMessageToServer; -import network.packets.swg.zone.chat.ChatQueryRoom; -import network.packets.swg.zone.chat.ChatRemoveAvatarFromRoom; -import network.packets.swg.zone.chat.ChatRemoveModeratorFromRoom; -import network.packets.swg.zone.chat.ChatRequestPersistentMessage; -import network.packets.swg.zone.chat.ChatRequestRoomList; -import network.packets.swg.zone.chat.ChatRoomMessage; -import network.packets.swg.zone.chat.ChatSendToRoom; -import network.packets.swg.zone.chat.ChatSystemMessage; -import network.packets.swg.zone.chat.ChatUnbanAvatarFromRoom; -import network.packets.swg.zone.chat.ChatUninviteFromRoom; -import network.packets.swg.zone.chat.ConGenericMessage; -import network.packets.swg.zone.chat.VoiceChatStatus; -import network.packets.swg.zone.combat.GrantCommandMessage; -import network.packets.swg.zone.deltas.DeltasMessage; -import network.packets.swg.zone.insertion.ChatRoomList; -import network.packets.swg.zone.insertion.ChatServerStatus; -import network.packets.swg.zone.insertion.CmdStartScene; -import network.packets.swg.zone.insertion.ConnectPlayerMessage; -import network.packets.swg.zone.insertion.SelectCharacter; -import network.packets.swg.zone.object_controller.ChangeRoleIconChoice; -import network.packets.swg.zone.object_controller.CommandQueueEnqueue; -import network.packets.swg.zone.object_controller.DataTransform; -import network.packets.swg.zone.object_controller.DataTransformWithParent; -import network.packets.swg.zone.object_controller.ObjectController; -import network.packets.swg.zone.object_controller.ObjectMenuRequest; -import network.packets.swg.zone.object_controller.ObjectMenuResponse; -import network.packets.swg.zone.object_controller.ShowLootBox; -import network.packets.swg.zone.object_controller.SpatialChat; -import network.packets.swg.zone.server_ui.SuiCreatePageMessage; -import network.packets.swg.zone.server_ui.SuiEventNotification; -import network.packets.swg.zone.spatial.AttributeListMessage; -import network.packets.swg.zone.spatial.GetMapLocationsMessage; -import network.packets.swg.zone.spatial.GetMapLocationsResponseMessage; -import network.packets.swg.zone.spatial.NewTicketActivityResponseMessage; -import network.packets.swg.zone.trade.AbortTradeMessage; -import network.packets.swg.zone.trade.AcceptTransactionMessage; -import network.packets.swg.zone.trade.AddItemFailedMessage; -import network.packets.swg.zone.trade.AddItemMessage; -import network.packets.swg.zone.trade.BeginTradeMessage; -import network.packets.swg.zone.trade.BeginVerificationMessage; -import network.packets.swg.zone.trade.DenyTradeMessage; -import network.packets.swg.zone.trade.GiveMoneyMessage; -import network.packets.swg.zone.trade.RemoveItemMessage; -import network.packets.swg.zone.trade.TradeCompleteMessage; -import network.packets.swg.zone.trade.UnAcceptTransactionMessage; -import network.packets.swg.zone.trade.VerifyTradeMessage; - - -public enum PacketType { - - // Holocore - HOLO_SET_PROTOCOL_VERSION (HoloSetProtocolVersion.CRC, HoloSetProtocolVersion.class), - HOLO_CONNECTION_STARTED (HoloConnectionStarted.CRC, HoloConnectionStarted.class), - HOLO_CONNECTION_STOPPED (HoloConnectionStopped.CRC, HoloConnectionStopped.class), - - // Admin - ADMIN_SHUTDOWN_SERVER (AdminShutdownServer.CRC, AdminShutdownServer.class), - - // Both - SERVER_UNIX_EPOCH_TIME (ServerUnixEpochTime.CRC, ServerUnixEpochTime.class), - SERVER_ID (ServerId.CRC, ServerId.class), - SERVER_STRING (ServerString.CRC, ServerString.class), - LAG_REQUEST (LagRequest.CRC, LagRequest.class), - - // Login - CLIENT_ID_MSG (ClientIdMsg.CRC, ClientIdMsg.class), - ERROR_MESSAGE (ErrorMessage.CRC, ErrorMessage.class), - ACCOUNT_FEATURE_BITS (AccountFeatureBits.CRC, AccountFeatureBits.class), - CLIENT_PERMISSIONS_MESSAGE (ClientPermissionsMessage.CRC, ClientPermissionsMessage.class), - REQUEST_EXTENDED_CLUSTERS (RequestExtendedClusters.CRC, RequestExtendedClusters.class), - OFFLINE_SERVERS_MESSAGE (OfflineServersMessage.CRC, OfflineServersMessage.class), - SERVER_NOW_EPOCH_TIME (ServerNowEpochTime.CRC, ServerNowEpochTime.class), - GAME_SERVER_LAG_RESPONSE (GameServerLagResponse.CRC, GameServerLagResponse.class), - - // Post-Login - LOGIN_CLIENT_ID (LoginClientId.CRC, LoginClientId.class), - LOGIN_INCORRECT_CLIENT_ID (LoginIncorrectClientId.CRC, LoginIncorrectClientId.class), - LOGIN_CLIENT_TOKEN (LoginClientToken.CRC, LoginClientToken.class), - LOGIN_ENUM_CLUSTER (LoginEnumCluster.CRC, LoginEnumCluster.class), - LOGIN_CLUSTER_STATUS (LoginClusterStatus.CRC, LoginClusterStatus.class), - ENUMERATE_CHARACTER_ID (EnumerateCharacterId.CRC, EnumerateCharacterId.class), - STATION_ID_HAS_JEDI_SLOT (StationIdHasJediSlot.CRC, StationIdHasJediSlot.class), - CHARACTER_CREATION_DISABLED (CharacterCreationDisabled.CRC, CharacterCreationDisabled.class), - - // Character Creation - CLIENT_CREATE_CHARACTER (ClientCreateCharacter.CRC, ClientCreateCharacter.class), - CREATE_CHARACTER_SUCCESS (CreateCharacterSuccess.CRC, CreateCharacterSuccess.class), - CREATE_CHARACTER_FAILURE (CreateCharacterFailure.CRC, CreateCharacterFailure.class), - APPROVE_NAME_REQUEST (ClientVerifyAndLockNameRequest.CRC, ClientVerifyAndLockNameRequest.class), - APPROVE_NAME_RESPONSE (ClientVerifyAndLockNameResponse.CRC, ClientVerifyAndLockNameResponse.class), - RANDOM_NAME_REQUEST (RandomNameRequest.CRC, RandomNameRequest.class), - RANDOM_NAME_RESPONSE (RandomNameResponse.CRC, RandomNameResponse.class), - - // Character Deletion - DELETE_CHARACTER_RESPONSE (DeleteCharacterResponse.CRC, DeleteCharacterResponse.class), - DELETE_CHARACTER_REQUEST (DeleteCharacterRequest.CRC, DeleteCharacterRequest.class), - - // Zone - CONNECTION_SERVER_LAG_RESPONSE (ConnectionServerLagResponse.CRC, ConnectionServerLagResponse.class), - COMMAND_QUEUE_ENQUEUE (0x00000116, CommandQueueEnqueue.class), - SELECT_CHARACTER (SelectCharacter.CRC, SelectCharacter.class), - CMD_SCENE_READY (CmdSceneReady.CRC, CmdSceneReady.class), - CMD_START_SCENE (CmdStartScene.CRC, CmdStartScene.class), - HEART_BEAT_MESSAGE (HeartBeat.CRC, HeartBeat.class), - OBJECT_CONTROLLER (ObjectController.CRC, ObjectController.class), - BASELINE (Baseline.CRC, Baseline.class), - DATA_TRANSFORM (0x00000071, DataTransform.class), - DATA_TRANSFORM_PARENT (0x000000F1, DataTransformWithParent.class), - CONNECT_PLAYER_MESSAGE (ConnectPlayerMessage.CRC, ConnectPlayerMessage.class), - CONNECT_PLAYER_RESPONSE_MESSAGE (ConnectPlayerResponseMessage.CRC, ConnectPlayerResponseMessage.class), - GALAXY_LOOP_TIMES_REQUEST (RequestGalaxyLoopTimes.CRC, RequestGalaxyLoopTimes.class), - GALAXY_LOOP_TIMES_RESPONSE (GalaxyLoopTimesResponse.CRC, GalaxyLoopTimesResponse.class), - PARAMETERS_MESSAGE (ParametersMessage.CRC, ParametersMessage.class), - DELTA (DeltasMessage.CRC, DeltasMessage.class), - SERVER_TIME_MESSAGE (ServerTimeMessage.CRC, ServerTimeMessage.class), - SET_WAYPOINT_COLOR (SetWaypointColor.CRC, SetWaypointColor.class), - SHOW_BACKPACK (ShowBackpack.CRC, ShowBackpack.class), - SHOW_HELMET (ShowHelmet.CRC, ShowHelmet.class), - SERVER_WEATHER_MESSAGE (ServerWeatherMessage.CRC, ServerWeatherMessage.class), - PLAY_MUSIC_MESSAGE (PlayMusicMessage.CRC, PlayMusicMessage.class), - PLAY_CLIENT_EFFECT_OBJECT_MESSAGE (PlayClientEffectObjectMessage.CRC, PlayClientEffectObjectMessage.class), - STOP_CLIENT_EFFECT_OBJECT_BY_LABEL (StopClientEffectObjectByLabelMessage.CRC, StopClientEffectObjectByLabelMessage.class), - EXPERTISE_REQUEST_MESSAGE (ExpertiseRequestMessage.CRC, ExpertiseRequestMessage.class), - CHANGE_ROLE_ICON_CHOICE (ChangeRoleIconChoice.CRC, ChangeRoleIconChoice.class), - SHOW_LOOT_BOX (ShowLootBox.CRC, ShowLootBox.class), - - // Chat - CHAT_CREATE_ROOM (ChatCreateRoom.CRC, ChatCreateRoom.class), - CHAT_DESTROY_ROOM (ChatDestroyRoom.CRC, ChatDestroyRoom.class), - CHAT_ON_CREATE_ROOM (ChatOnCreateRoom.CRC, ChatOnCreateRoom.class), - CHAT_FRIENDS_LIST_UPDATE (ChatFriendsListUpdate.CRC, ChatFriendsListUpdate.class), - CHAT_IGNORE_LIST (ChatIgnoreList.CRC, ChatIgnoreList.class), - CHAT_INSTANT_MESSAGE_TO_CLIENT (ChatInstantMessageToClient.CRC, ChatInstantMessageToClient.class), - CHAT_INSTANT_MESSAGE_TO_CHARACTER (ChatInstantMessageToCharacter.CRC, ChatInstantMessageToCharacter.class), - CHAT_ON_CONNECT_AVATAR (ChatOnConnectAvatar.CRC, ChatOnConnectAvatar.class), - CHAT_ON_DESTROY_ROOM (ChatOnDestroyRoom.CRC, ChatOnDestroyRoom.class), - CHAT_ON_ENTERED_ROOM (ChatOnEnteredRoom.CRC, ChatOnEnteredRoom.class), - CHAT_ON_LEAVE_ROOM (ChatOnLeaveRoom.CRC, ChatOnLeaveRoom.class), - CHAT_ON_RECEIVE_ROOM_INVITATION (ChatOnReceiveRoomInvitation.CRC, ChatOnReceiveRoomInvitation.class), - CHAT_ON_SEND_INSTANT_MESSAGE (ChatOnSendInstantMessage.CRC, ChatOnSendInstantMessage.class), - CHAT_ON_SEND_ROOM_MESSAGE (ChatOnSendRoomMessage.CRC, ChatOnSendRoomMessage.class), - CHAT_PERSISTENT_MESSAGE_TO_CLIENT (ChatPersistentMessageToClient.CRC, ChatPersistentMessageToClient.class), - CHAT_PERSISTENT_MESSAGE_TO_SERVER (ChatPersistentMessageToServer.CRC, ChatPersistentMessageToServer.class), - CHAT_DELETE_PERSISTENT_MESSAGE (ChatDeletePersistentMessage.CRC, ChatDeletePersistentMessage.class), - CHAT_REQUEST_PERSISTENT_MESSAGE (ChatRequestPersistentMessage.CRC, ChatRequestPersistentMessage.class), - CHAT_REQUEST_ROOM_LIST (ChatRequestRoomList.CRC, ChatRequestRoomList.class), - CHAT_ENTER_ROOM_BY_ID (ChatEnterRoomById.CRC, ChatEnterRoomById.class), - CHAT_QUERY_ROOM (ChatQueryRoom.CRC, ChatQueryRoom.class), - CHAT_ROOM_LIST (ChatRoomList.CRC, ChatRoomList.class), - CHAT_ROOM_MESSAGE (ChatRoomMessage.CRC, ChatRoomMessage.class), - CHAT_SEND_TO_ROOM (ChatSendToRoom.CRC, ChatSendToRoom.class), - CHAT_REMOVE_AVATAR_FROM_ROOM (ChatRemoveAvatarFromRoom.CRC, ChatRemoveAvatarFromRoom.class), - CHAT_SERVER_STATUS (ChatServerStatus.CRC, ChatServerStatus.class), - CHAT_SYSTEM_MESSAGE (ChatSystemMessage.CRC, ChatSystemMessage.class), - CHAT_INVITE_AVATAR_TO_ROOM (ChatInviteAvatarToRoom.CRC, ChatInviteAvatarToRoom.class), - CHAT_UNINVITE_FROM_ROOM (ChatUninviteFromRoom.CRC, ChatUninviteFromRoom.class), - CHAT_KICK_AVATAR_FROM_ROOM (ChatKickAvatarFromRoom.CRC, ChatKickAvatarFromRoom.class), - CHAT_BAN_AVATAR_FROM_ROOM (ChatBanAvatarFromRoom.CRC, ChatBanAvatarFromRoom.class), - CHAT_UNBAN_AVATAR_FROM_ROOM (ChatUnbanAvatarFromRoom.CRC, ChatUnbanAvatarFromRoom.class), - CHAT_ADD_MODERATOR_TO_ROOM (ChatAddModeratorToRoom.CRC, ChatAddModeratorToRoom.class), - CHAT_REMOVE_MODERATOR_FROM_ROOM (ChatRemoveModeratorFromRoom.CRC, ChatRemoveModeratorFromRoom.class), - CON_GENERIC_MESSAGE (ConGenericMessage.CRC, ConGenericMessage.class), - VOICE_CHAT_STATUS (VoiceChatStatus.CRC, VoiceChatStatus.class), - - // Scene - SCENE_END_BASELINES (SceneEndBaselines.CRC, SceneEndBaselines.class), - SCENE_CREATE_OBJECT_BY_CRC (SceneCreateObjectByCrc.CRC, SceneCreateObjectByCrc.class), - SCENE_DESTROY_OBJECT (SceneDestroyObject.CRC, SceneDestroyObject.class), - UPDATE_CONTAINMENT_MESSAGE (UpdateContainmentMessage.CRC, UpdateContainmentMessage.class), - UPDATE_CELL_PERMISSIONS_MESSAGE (UpdateCellPermissionMessage.CRC, UpdateCellPermissionMessage.class), - GET_MAP_LOCATIONS_MESSAGE (GetMapLocationsMessage.CRC, GetMapLocationsMessage.class), - GET_MAP_LOCATIONS_RESPONSE_MESSAGE (GetMapLocationsResponseMessage.CRC, GetMapLocationsResponseMessage.class), - - // Spatial - UPDATE_POSTURE_MESSAGE (UpdatePostureMessage.CRC, UpdatePostureMessage.class), - UPDATE_TRANSFORMS_MESSAGE (UpdateTransformMessage.CRC, UpdateTransformMessage.class), - UPDATE_TRANSFORM_WITH_PARENT_MESSAGE (UpdateTransformWithParentMessage.CRC, UpdateTransformWithParentMessage.class), - SPATIAL_CHAT (0x000000f4, SpatialChat.class), - NEW_TICKET_ACTIVITY_RESPONSE_MESSAGE (NewTicketActivityResponseMessage.CRC, NewTicketActivityResponseMessage.class), - ATTRIBUTE_LIST_MESSAGE (AttributeListMessage.CRC, AttributeListMessage.class), - OPENED_CONTAINER_MESSAGE (ClientOpenContainerMessage.CRC, ClientOpenContainerMessage.class), - - // Combat - UPDATE_PVP_STATUS_MESSAGE (UpdatePvpStatusMessage.CRC, UpdatePvpStatusMessage.class), - GRANT_COMMAND_MESSAGE (GrantCommandMessage.CRC, GrantCommandMessage.class), - - // Server UI - OBJECT_MENU_REQUEST (0x00000146, ObjectMenuRequest.class), - OBJECT_MENU_RESPONSE (0x00000147, ObjectMenuResponse.class), - OBJECT_MENU_SELECT (ObjectMenuSelect.CRC, ObjectMenuSelect.class), - SUI_CREATE_PAGE_MESSAGE (SuiCreatePageMessage.CRC, SuiCreatePageMessage.class), - SUI_EVENT_NOTIFICATION (SuiEventNotification.CRC, SuiEventNotification.class), - - // Auction - IS_VENDOR_OWNER_RESPONSE_MESSAGE (IsVendorOwnerResponseMessage.CRC, IsVendorOwnerResponseMessage.class), - AUCTION_QUERY_HEADERS_MESSAGE (AuctionQueryHeadersMessage.CRC, AuctionQueryHeadersMessage.class), - GET_AUCTION_DETAILS (GetAuctionDetails.CRC, GetAuctionDetails.class), - GET_AUCTION_DETAILS_RESPONSE (GetAuctionDetailsResponse.CRC, GetAuctionDetailsResponse.class), - CANCEL_LIVE_AUCTION_MESSAGE (CancelLiveAuctionMessage.CRC, CancelLiveAuctionMessage.class), - CANCEL_LIVE_AUCTION_RESPONSE_MESSAGE (CancelLiveAuctionResponseMessage.CRC, CancelLiveAuctionResponseMessage.class), - AUCTION_QUERY_HEADERS_RESPONSE_MESSAGE (AuctionQueryHeadersResponseMessage.CRC, AuctionQueryHeadersResponseMessage.class), - RETRIEVE_AUCTION_ITEM_MESSAGE (RetrieveAuctionItemMessage.CRC, RetrieveAuctionItemMessage.class), - RETRIEVE_AUCTION_ITEM_RESPONSE_MESSAGE (RetrieveAuctionItemResponseMessage.CRC, RetrieveAuctionItemResponseMessage.class), - IS_VENDOR_OWNER_MESSAGE (IsVendorOwnerMessage.CRC, IsVendorOwnerMessage.class), - COMMODITIES_ITEM_TYPE_LIST_REPSONSE (CommoditiesItemTypeListResponse.CRC, CommoditiesItemTypeListResponse.class), - COMMODITIES_ITEM_TYPE_LIST_REQUEST (CommoditiesItemTypeListRequest.CRC, CommoditiesItemTypeListRequest.class), - - // Travel - ENTER_TICKET_PURCHASE_MODE_MESSAGE (EnterTicketPurchaseModeMessage.CRC, EnterTicketPurchaseModeMessage.class), - PLANET_TRAVEL_POINT_LIST_REQUEST (PlanetTravelPointListRequest.CRC, PlanetTravelPointListRequest.class), - PLANET_TRAVEL_POINT_LIST_RESPONSE (PlanetTravelPointListResponse.CRC, PlanetTravelPointListResponse.class), - - //Trade - ABORT_TRADE_MESSAGE (AbortTradeMessage.CRC, AbortTradeMessage.class), - ACCEPT_TRANSACTION_MESSAGE (AcceptTransactionMessage.CRC, AcceptTransactionMessage.class), - ADD_ITEM_FAILED_MESSAGE (AddItemFailedMessage.CRC, AddItemFailedMessage.class), - ADD_ITEM_MESSAGE (AddItemMessage.CRC, AddItemMessage.class), - BEGIN_TRADE_MESSAGE (BeginTradeMessage.CRC, BeginTradeMessage.class), - BEGIN_VERIFICATION_MESSAGE (BeginVerificationMessage.CRC, BeginVerificationMessage.class), - DENY_TRADE_MESSAGE (DenyTradeMessage.CRC, DenyTradeMessage.class), - GIVE_MONEY_MESSAGE (GiveMoneyMessage.CRC, GiveMoneyMessage.class), - REMOVE_ITEM_MESSAGE (RemoveItemMessage.CRC, RemoveItemMessage.class), - TRADE_COMPLETE_MESSAGE (TradeCompleteMessage.CRC, TradeCompleteMessage.class), - UNACCEPT_TRANSACTION_MESSAGE (UnAcceptTransactionMessage.CRC, UnAcceptTransactionMessage.class), - VERIFY_TRADE_MESSAGE (VerifyTradeMessage.CRC, VerifyTradeMessage.class), - - UNKNOWN (0xFFFFFFFF, SWGPacket.class); - - private static final Map packetMap = new HashMap<>(); - - static { - for (PacketType type : values()) { - packetMap.put(type.crc, type); - } - } - - private int crc; - private Class c; - - PacketType(int crc, Class c) { - this.crc = crc; - this.c = c; - } - - public int getCrc() { - return crc; - } - - public Class getSwgClass() { - return c; - } - - public static PacketType fromCrc(int crc) { - PacketType type = packetMap.get(crc); - if (type == null) - return UNKNOWN; - return type; - } - - public static SWGPacket getForCrc(int crc) { - PacketType type = packetMap.get(crc); - if (type == null || type == UNKNOWN) - return null; - Class c = type.c; - try { - return c.newInstance(); - } catch (Exception e) { - Log.e("Packet: [%08X] %s", crc, c.getName()); - Log.e(e); - } - return null; - } - -} diff --git a/src/network/encryption/Encryption.java b/src/network/encryption/Encryption.java index 874dae11c..e492d5063 100644 --- a/src/network/encryption/Encryption.java +++ b/src/network/encryption/Encryption.java @@ -151,7 +151,7 @@ public class Encryption { int length = decompressor.inflate(result); return length; } catch (DataFormatException e) { - System.err.println("Failed to decompress packet. "+e.getClass().getSimpleName()+" Message: " + e.getMessage()); + System.err.println("Failed to decompress SWGPacket. "+e.getClass().getSimpleName()+" Message: " + e.getMessage()); return -1; } finally { decompressor.end(); diff --git a/src/network/packets/Packet.java b/src/network/packets/Packet.java deleted file mode 100644 index 9c935bd12..000000000 --- a/src/network/packets/Packet.java +++ /dev/null @@ -1,71 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets; - -import java.net.SocketAddress; -import java.nio.charset.Charset; - -import com.projectswg.common.data.CRC; -import com.projectswg.common.network.NetBuffer; - -public abstract class Packet { - - public static final Charset ascii = Charset.forName("UTF-8"); - public static final Charset unicode = Charset.forName("UTF-16LE"); - - private SocketAddress socketAddress; - - public Packet() { - socketAddress = null; - } - - public Packet(NetBuffer data) { - decode(data); - } - - public void setSocketAddress(SocketAddress socketAddress) { - this.socketAddress = socketAddress; - } - - public SocketAddress getSocketAddress() { - return socketAddress; - } - - protected static int getCrc(String str) { - return CRC.getCrc(str); - } - - public abstract void decode(NetBuffer data); - public abstract NetBuffer encode(); - - @Override - public String toString() { - return getClass().getSimpleName(); - } - -} diff --git a/src/network/packets/swg/ErrorMessage.java b/src/network/packets/swg/ErrorMessage.java deleted file mode 100644 index c322da213..000000000 --- a/src/network/packets/swg/ErrorMessage.java +++ /dev/null @@ -1,69 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg; - -import com.projectswg.common.network.NetBuffer; - - -public class ErrorMessage extends SWGPacket { - public static final int CRC = getCrc("ErrorMessage"); - - private String type; - private String message; - private boolean fatal; - - public ErrorMessage() { - - } - - public ErrorMessage(String type, String message, boolean fatal) { - this.type = type; - this.message = message; - this.fatal = fatal; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - type = data.getAscii(); - message = data.getAscii(); - fatal = data.getBoolean(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(11 + type.length() + message.length()); - data.addShort(3); - data.addInt(CRC); - data.addAscii(type); - data.addAscii(message); - data.addBoolean(fatal); - return data; - } -} diff --git a/src/network/packets/swg/SWGPacket.java b/src/network/packets/swg/SWGPacket.java deleted file mode 100644 index 507d018d5..000000000 --- a/src/network/packets/swg/SWGPacket.java +++ /dev/null @@ -1,70 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg; - -import com.projectswg.common.data.CRC; -import com.projectswg.common.debug.Log; -import com.projectswg.common.network.NetBuffer; - -import network.PacketType; -import network.packets.Packet; - - -public abstract class SWGPacket extends Packet { - - private PacketType type; - private int crc; - - public SWGPacket() { - this.type = PacketType.UNKNOWN; - this.crc = 0; - } - - public int getSWGOpcode() { - return crc; - } - - public PacketType getPacketType() { - return type; - } - - public boolean checkDecode(NetBuffer data, int crc) { - data.getShort(); - this.crc = data.getInt(); - this.type = PacketType.fromCrc(crc); - if (this.crc == crc) - return true; - Log.w("SWG Opcode does not match actual! Expected: 0x%08X Actual: 0x%08X", crc, getSWGOpcode()); - return false; - } - - public static int getCrc(String string) { - return CRC.getCrc(string); - } - -} diff --git a/src/network/packets/swg/ServerUnixEpochTime.java b/src/network/packets/swg/ServerUnixEpochTime.java deleted file mode 100644 index 37ba765a9..000000000 --- a/src/network/packets/swg/ServerUnixEpochTime.java +++ /dev/null @@ -1,63 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg; - -import com.projectswg.common.network.NetBuffer; - - -public class ServerUnixEpochTime extends SWGPacket { - public static final int CRC = getCrc("ServerUnixEpochTime"); - - private int time = 0; - - public ServerUnixEpochTime() { - - } - - public ServerUnixEpochTime(int time) { - this.time = time; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - time = data.getInt(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(10); - data.addShort(2); - data.addInt(CRC); - data.addInt(time); - return data; - } - - public int getTime() { - return time; - } -} diff --git a/src/network/packets/swg/admin/AdminPacket.java b/src/network/packets/swg/admin/AdminPacket.java deleted file mode 100644 index 94e405b39..000000000 --- a/src/network/packets/swg/admin/AdminPacket.java +++ /dev/null @@ -1,34 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.admin; - -import network.packets.swg.holo.HoloPacket; - -public abstract class AdminPacket extends HoloPacket { - -} diff --git a/src/network/packets/swg/admin/AdminShutdownServer.java b/src/network/packets/swg/admin/AdminShutdownServer.java deleted file mode 100644 index 88baa903a..000000000 --- a/src/network/packets/swg/admin/AdminShutdownServer.java +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.admin; - -import com.projectswg.common.network.NetBuffer; - -public class AdminShutdownServer extends AdminPacket { - - public static final int CRC = getCrc("AdminShutdownServer"); - - private int shutdownTime; - - public AdminShutdownServer() { - - } - - public AdminShutdownServer(int shutdownTime) { - setShutdownTime(shutdownTime); - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - shutdownTime = data.getShort(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(8); - data.addShort(1); - data.addInt(CRC); - data.addShort(shutdownTime); - return data; - } - - public int getShutdownTime() { - return shutdownTime; - } - - public void setShutdownTime(int shutdownTime) { - this.shutdownTime = shutdownTime; - } - -} diff --git a/src/network/packets/swg/holo/HoloConnectionStarted.java b/src/network/packets/swg/holo/HoloConnectionStarted.java deleted file mode 100644 index acb0eebce..000000000 --- a/src/network/packets/swg/holo/HoloConnectionStarted.java +++ /dev/null @@ -1,54 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.holo; - -import com.projectswg.common.network.NetBuffer; - -public class HoloConnectionStarted extends HoloPacket { - - public static final int CRC = getCrc("HoloConnectionStarted"); - - public HoloConnectionStarted() { - - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(1); - data.addInt(CRC); - return data; - } - -} diff --git a/src/network/packets/swg/holo/HoloConnectionStopped.java b/src/network/packets/swg/holo/HoloConnectionStopped.java deleted file mode 100644 index c9a42ca8f..000000000 --- a/src/network/packets/swg/holo/HoloConnectionStopped.java +++ /dev/null @@ -1,83 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.holo; - -import com.projectswg.common.network.NetBuffer; - -public class HoloConnectionStopped extends HoloPacket { - - public static final int CRC = getCrc("HoloConnectionStopped"); - - private ConnectionStoppedReason reason; - - public HoloConnectionStopped() { - this(ConnectionStoppedReason.UNKNOWN); - } - - public HoloConnectionStopped(ConnectionStoppedReason reason) { - this.reason = reason; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - try { - reason = ConnectionStoppedReason.valueOf(data.getAscii()); - } catch (IllegalArgumentException e) { - reason = ConnectionStoppedReason.UNKNOWN; - } - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(8+reason.name().length()); - data.addShort(1); - data.addInt(CRC); - data.addAscii(reason.name()); - return data; - } - - public void setReason(ConnectionStoppedReason reason) { - this.reason = reason; - } - - public ConnectionStoppedReason getReason() { - return reason; - } - - public static enum ConnectionStoppedReason { - APPLICATION, - INVALID_PROTOCOL, - OTHER_SIDE_TERMINATED, - NETWORK, - SERVER_ERROR, - UNKNOWN - } - -} diff --git a/src/network/packets/swg/holo/HoloPacket.java b/src/network/packets/swg/holo/HoloPacket.java deleted file mode 100644 index 98a46b0f9..000000000 --- a/src/network/packets/swg/holo/HoloPacket.java +++ /dev/null @@ -1,39 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.holo; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public abstract class HoloPacket extends SWGPacket { - - public abstract void decode(NetBuffer data); - public abstract NetBuffer encode(); - -} diff --git a/src/network/packets/swg/holo/HoloSetProtocolVersion.java b/src/network/packets/swg/holo/HoloSetProtocolVersion.java deleted file mode 100644 index c3910b893..000000000 --- a/src/network/packets/swg/holo/HoloSetProtocolVersion.java +++ /dev/null @@ -1,70 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.holo; - -import com.projectswg.common.network.NetBuffer; - -public class HoloSetProtocolVersion extends HoloPacket { - - public static final int CRC = getCrc("HoloSetProtocolVersion"); - - private String protocol; - - public HoloSetProtocolVersion() { - this(""); - } - - public HoloSetProtocolVersion(String protocol) { - this.protocol = protocol; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - protocol = data.getAscii(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(8 + protocol.length()); - data.addShort(2); - data.addInt(CRC); - data.addAscii(protocol); - return data; - } - - public String getProtocol() { - return protocol; - } - - public void setProtocol(String protocol) { - this.protocol = protocol; - } - -} diff --git a/src/network/packets/swg/login/AccountFeatureBits.java b/src/network/packets/swg/login/AccountFeatureBits.java deleted file mode 100644 index 7275d5fdf..000000000 --- a/src/network/packets/swg/login/AccountFeatureBits.java +++ /dev/null @@ -1,60 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class AccountFeatureBits extends SWGPacket { - - public static final int CRC = 0x979F0279; - - public AccountFeatureBits() { - - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - // Not sure how to decode this.. still a mystery - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(22); - data.addShort(2); - data.addInt(CRC); - data.addInt(0x025C8231); - data.addInt(1); - data.addInt(6); - data.addInt(0x4EEAC08A); - return data; - } - -} diff --git a/src/network/packets/swg/login/CharacterCreationDisabled.java b/src/network/packets/swg/login/CharacterCreationDisabled.java deleted file mode 100644 index d14d3f9a7..000000000 --- a/src/network/packets/swg/login/CharacterCreationDisabled.java +++ /dev/null @@ -1,77 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class CharacterCreationDisabled extends SWGPacket { - - public static final int CRC = 0xF4A15265; - - private String [] serverNames = new String[0]; - - public CharacterCreationDisabled() { - this(new String[0]); - } - - public CharacterCreationDisabled(String [] serverNames) { - this.serverNames = serverNames; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - int listSize = data.getInt(); - serverNames = new String[listSize]; - for (int i = 0; i < listSize; i++) { - serverNames[i] = data.getAscii(); - } - } - - public NetBuffer encode() { - int length = 10; - for (int i = 0; i < serverNames.length; i++) - length += 2 + serverNames[i].length(); - NetBuffer data = NetBuffer.allocate(length); - data.addShort(2); - data.addInt(CRC); - data.addInt(serverNames.length); - for (int i = 0; i < serverNames.length; i++) { - data.addAscii(serverNames[i]); - } - return data; - } - - public String [] getServerNames() { - return serverNames; - } - -} diff --git a/src/network/packets/swg/login/ClientIdMsg.java b/src/network/packets/swg/login/ClientIdMsg.java deleted file mode 100644 index 3446c1ef4..000000000 --- a/src/network/packets/swg/login/ClientIdMsg.java +++ /dev/null @@ -1,80 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class ClientIdMsg extends SWGPacket { - - public static final int CRC = getCrc("ClientIdMsg"); - - private int gameBitsToClear; - private byte [] sessionToken; - private String version; - - public ClientIdMsg() { - this(0, new byte[0], ""); - } - - public ClientIdMsg(NetBuffer data) { - decode(data); - } - - public ClientIdMsg(int gameBitsToClear, byte [] sessionKey, String version) { - this.gameBitsToClear = gameBitsToClear; - this.sessionToken = sessionKey; - this.version = version; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - gameBitsToClear = data.getInt(); - sessionToken = data.getArrayLarge(); - version = data.getAscii(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(16 + sessionToken.length + version.length()); - data.addShort(4); - data.addInt(CRC); - data.addInt(gameBitsToClear); - data.addArrayLarge(sessionToken); - data.addAscii(version); - return data; - } - - public int getGameBitsToClear() { return gameBitsToClear; } - public byte [] getSessionToken() { return sessionToken; } - public String getVersion() { return version; } -} diff --git a/src/network/packets/swg/login/ClientPermissionsMessage.java b/src/network/packets/swg/login/ClientPermissionsMessage.java deleted file mode 100644 index cbc7952f1..000000000 --- a/src/network/packets/swg/login/ClientPermissionsMessage.java +++ /dev/null @@ -1,79 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class ClientPermissionsMessage extends SWGPacket { - public static final int CRC = getCrc("ClientPermissionsMessage"); - - private boolean canLogin; - private boolean canCreateRegularCharacter; - private boolean canCreateJediCharacter; - private boolean canSkipTutorial; - - public ClientPermissionsMessage() { - canLogin = true; - canCreateRegularCharacter = true; - canCreateJediCharacter = true; - canSkipTutorial = true; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - canLogin = data.getBoolean(); - canCreateRegularCharacter = data.getBoolean(); - canCreateJediCharacter = data.getBoolean(); - canSkipTutorial = data.getBoolean(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(10); - data.addShort(5); - data.addInt(CRC); - data.addBoolean(canLogin); - data.addBoolean(canCreateRegularCharacter); - data.addBoolean(canCreateJediCharacter); - data.addBoolean(canSkipTutorial); - return data; - } - - public void setCanLogin(boolean can) { this.canLogin = can; } - public void setCanCreateRegularCharacter(boolean can) { this.canCreateRegularCharacter = can; } - public void setCanCreateJediCharacter(boolean can) { this.canCreateJediCharacter = can; } - public void setCanSkipTutorial(boolean can) { this.canSkipTutorial = can; } - - public boolean canLogin() { return canLogin; } - public boolean canCreateRegularCharacter() { return canCreateRegularCharacter; } - public boolean canCreateJediCharacter() { return canCreateJediCharacter; } - public boolean canSkipTutorial() { return canSkipTutorial; } -} diff --git a/src/network/packets/swg/login/ConnectionServerLagResponse.java b/src/network/packets/swg/login/ConnectionServerLagResponse.java deleted file mode 100644 index d9b80cb9c..000000000 --- a/src/network/packets/swg/login/ConnectionServerLagResponse.java +++ /dev/null @@ -1,55 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class ConnectionServerLagResponse extends SWGPacket { - - public static final int CRC = getCrc("ConnectionServerLagResponse"); - - public ConnectionServerLagResponse() { - - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(1); - data.addInt(CRC); - return data; - } - -} diff --git a/src/network/packets/swg/login/EnumerateCharacterId.java b/src/network/packets/swg/login/EnumerateCharacterId.java deleted file mode 100644 index dfff0e13f..000000000 --- a/src/network/packets/swg/login/EnumerateCharacterId.java +++ /dev/null @@ -1,138 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login; - -import java.util.ArrayList; -import java.util.List; - -import com.projectswg.common.encoding.Encodable; -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class EnumerateCharacterId extends SWGPacket { - public static final int CRC = getCrc("EnumerateCharacterId"); - - private List characters; - - public EnumerateCharacterId() { - this.characters = new ArrayList<>(); - } - - public EnumerateCharacterId(List characters) { - this.characters = new ArrayList<>(characters); - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - characters = data.getList(SWGCharacter.class); - } - - @Override - public NetBuffer encode() { - int length = 10; - for (SWGCharacter c : characters) { - length += c.getLength(); - } - NetBuffer data = NetBuffer.allocate(length); - data.addShort(2); - data.addInt(CRC); - data.addList(characters); - return data; - } - - public List getCharacters() { - return characters; - } - - public static class SWGCharacter implements Encodable { - - private String name; - private int raceCrc; - private long id; - private int galaxyId; - private int type; - - public SWGCharacter() { - - } - - public SWGCharacter(String name, int raceCrc, long id, int galaxyId, int status) { - this.name = name; - this.raceCrc = raceCrc; - this.id = id; - this.galaxyId = galaxyId; - this.type = status; - } - - public int getLength() { - return 24 + name.length() * 2; - } - - @Override - public void decode(NetBuffer data) { - name = data.getUnicode(); - raceCrc = data.getInt(); - id = data.getLong(); - galaxyId = data.getInt(); - type = data.getInt(); - } - - @Override - public byte [] encode() { - NetBuffer data = NetBuffer.allocate(getLength()); - data.addUnicode(name); - data.addInt(raceCrc); - data.addLong(id); - data.addInt(galaxyId); - data.addInt(type); - return data.array(); - } - - public void setId(long id) { this.id = id; } - public void setName(String name) { this.name = name; } - public void setRaceCrc(int crc) { this.raceCrc = crc; } - public void setGalaxyId(int id) { this.galaxyId = id; } - public void setType(int type) { this.type = type; } - - public long getId() { return id; } - public String getName() { return name; } - public int getRaceCrc() { return raceCrc; } - public int getGalaxyId() { return galaxyId; } - public int getType() { return type; } - - @Override - public String toString() { - return String.format("SWGCharacter[id=%d name=%s race=%d galaxy=%d type=%d", id, name, raceCrc, galaxyId, type); - } - - } -} diff --git a/src/network/packets/swg/login/LoginClientId.java b/src/network/packets/swg/login/LoginClientId.java deleted file mode 100644 index 76e15b69c..000000000 --- a/src/network/packets/swg/login/LoginClientId.java +++ /dev/null @@ -1,80 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class LoginClientId extends SWGPacket { - public static final int CRC = getCrc("LoginClientId"); - - private String username; - private String password; - private String version; - - public LoginClientId() { - this("", "", ""); - } - - public LoginClientId(NetBuffer data) { - decode(data); - } - - public LoginClientId(String username, String password, String version) { - this.username = username; - this.password = password; - this.version = version; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - username = data.getAscii(); - password = data.getAscii(); - version = data.getAscii(); - } - - public NetBuffer encode() { - int length = 6 + 6 + username.length() * 2 + password.length() * 2 + version.length() * 2; - NetBuffer data = NetBuffer.allocate(length); - data.addShort(4); - data.addInt(CRC); - data.addAscii(username); - data.addAscii(password); - data.addAscii(version); - return data; - } - - public String getUsername() { return username; } - public void setUsername(String str) { this.username = str; } - public String getPassword() { return password; } - public void setPassword(String str) { this.password = str; } - public String getVersion() { return version; } -} diff --git a/src/network/packets/swg/login/LoginClientToken.java b/src/network/packets/swg/login/LoginClientToken.java deleted file mode 100644 index 44531ec19..000000000 --- a/src/network/packets/swg/login/LoginClientToken.java +++ /dev/null @@ -1,89 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class LoginClientToken extends SWGPacket { - public static final int CRC = getCrc("LoginClientToken"); - - private byte [] sessionKey; - private int userId; - private String username; - - public LoginClientToken() { - - } - - public LoginClientToken(NetBuffer data) { - decode(data); - } - - public LoginClientToken(byte [] sessionKey, int userId, String username) { - this.sessionKey = sessionKey; - this.userId = userId; - this.username = username; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - sessionKey = data.getArrayLarge(); - userId = data.getInt(); - username = data.getAscii(); - } - - @Override - public NetBuffer encode() { - int length = 16 + sessionKey.length + username.length(); - NetBuffer data = NetBuffer.allocate(length); - data.addShort(4); - data.addInt(CRC); - data.addArrayLarge(sessionKey); - data.addInt(userId); - data.addAscii(username); - return data; - } - - public byte [] getSessionKey() { - return sessionKey; - } - - public int getUserId() { - return userId; - } - - public String getUsername() { - return username; - } - -} diff --git a/src/network/packets/swg/login/LoginClusterStatus.java b/src/network/packets/swg/login/LoginClusterStatus.java deleted file mode 100644 index c5dcf1fc5..000000000 --- a/src/network/packets/swg/login/LoginClusterStatus.java +++ /dev/null @@ -1,105 +0,0 @@ -/*********************************************************************************** - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.login; - -import java.time.ZoneOffset; -import java.util.List; -import java.util.Vector; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.Galaxy; - - -public class LoginClusterStatus extends SWGPacket { - - public static final int CRC = getCrc("LoginClusterStatus"); - - private Vector galaxies; - - public LoginClusterStatus() { - galaxies = new Vector(); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - int serverCount = data.getInt(); - for (int i = 0; i < serverCount; i++) { - Galaxy g = new Galaxy(); - g.setId(data.getInt()); - g.setAddress(data.getAscii()); - g.setZonePort(data.getShort()); - g.setPingPort(data.getShort()); - g.setPopulation(data.getInt()); - data.getInt(); // population status - g.setMaxCharacters(data.getInt()); - g.setZoneOffset(ZoneOffset.ofTotalSeconds(data.getInt())); - g.setStatus(data.getInt()); - g.setRecommended(data.getBoolean()); - g.setOnlinePlayerLimit(data.getInt()); - g.setOnlineFreeTrialLimit(data.getInt()); - galaxies.add(g); - } - } - - public NetBuffer encode() { - int length = 10; - for (Galaxy g : galaxies) - length += 39 + g.getAddress().length(); - NetBuffer data = NetBuffer.allocate(length); - data.addShort(2); - data.addInt(CRC); - data.addInt(galaxies.size()); - for (Galaxy g : galaxies) { - data.addInt(g.getId()); - data.addAscii(g.getAddress()); - data.addShort(g.getZonePort()); - data.addShort(g.getPingPort()); - data.addInt(g.getPopulation()); - data.addInt(g.getPopulationStatus()); - data.addInt(g.getMaxCharacters()); - data.addInt(g.getDistance()); - data.addInt(g.getStatus().getStatus()); - data.addBoolean(g.isRecommended()); - data.addInt(g.getOnlinePlayerLimit()); - data.addInt(g.getOnlineFreeTrialLimit()); - } - return data; - } - - public void addGalaxy(Galaxy g) { - galaxies.add(g); - } - - public List getGalaxies() { - return galaxies; - } - -} diff --git a/src/network/packets/swg/login/LoginEnumCluster.java b/src/network/packets/swg/login/LoginEnumCluster.java deleted file mode 100644 index 0b82cb6f5..000000000 --- a/src/network/packets/swg/login/LoginEnumCluster.java +++ /dev/null @@ -1,102 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login; - -import java.time.ZoneOffset; -import java.util.List; -import java.util.Vector; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.Galaxy; - - -public class LoginEnumCluster extends SWGPacket { - - public static final int CRC = 0xC11C63B9; - - private Vector galaxies; - private int maxCharacters; - - public LoginEnumCluster() { - galaxies = new Vector(); - } - - public LoginEnumCluster(int maxCharacters) { - galaxies = new Vector(); - this.maxCharacters = maxCharacters; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - int serverCount = data.getInt(); - for (int i = 0; i < serverCount; i++) { - Galaxy g = new Galaxy(); - g.setId(data.getInt()); - g.setName(data.getAscii()); - g.setZoneOffset(ZoneOffset.ofTotalSeconds(data.getInt())); - galaxies.add(g); - } - maxCharacters = data.getInt(); - } - - public NetBuffer encode() { - int length = 14; - for (Galaxy g : galaxies) - length += 10 + g.getName().length(); - NetBuffer data = NetBuffer.allocate(length); - data.addShort(3); - data.addInt(CRC); - data.addInt(galaxies.size()); - for (Galaxy g : galaxies) { - data.addInt(g.getId()); - data.addAscii(g.getName()); - data.addInt(g.getDistance()); - } - data.addInt(maxCharacters); - return data; - } - - public void addGalaxy(Galaxy g) { - galaxies.add(g); - } - - public void setMaxCharacters(int max) { - this.maxCharacters = max; - } - - public int getMaxCharacters() { - return maxCharacters; - } - - public List getGalaxies() { - return galaxies; - } -} diff --git a/src/network/packets/swg/login/LoginIncorrectClientId.java b/src/network/packets/swg/login/LoginIncorrectClientId.java deleted file mode 100644 index d524e768b..000000000 --- a/src/network/packets/swg/login/LoginIncorrectClientId.java +++ /dev/null @@ -1,69 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class LoginIncorrectClientId extends SWGPacket { - public static final int CRC = getCrc("LoginIncorrectClientId"); - - private String serverId; - private String serverAppVersion; - - public LoginIncorrectClientId() { - this("", ""); - } - - public LoginIncorrectClientId(NetBuffer data) { - decode(data); - } - - public LoginIncorrectClientId(String serverId, String serverAppVersion) { - this.serverId = serverId; - this.serverAppVersion = serverAppVersion; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - serverId = data.getAscii(); - serverAppVersion = data.getAscii(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(10 + serverId.length() + serverAppVersion.length()); - data.addShort(4); - data.addInt(CRC); - data.addAscii(serverId); - data.addAscii(serverAppVersion); - return data; - } - -} diff --git a/src/network/packets/swg/login/OfflineServersMessage.java b/src/network/packets/swg/login/OfflineServersMessage.java deleted file mode 100644 index 8cace4594..000000000 --- a/src/network/packets/swg/login/OfflineServersMessage.java +++ /dev/null @@ -1,89 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login; - -import java.util.ArrayList; -import java.util.List; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class OfflineServersMessage extends SWGPacket { - - public static final int CRC = 0xF41A5265; - - private List offlineServers; - - public OfflineServersMessage() { - offlineServers = new ArrayList(); - } - - public OfflineServersMessage(List offline) { - this.offlineServers = offline; - } - - public OfflineServersMessage(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - int listCount = data.getInt(); - offlineServers = new ArrayList(listCount); - for (int i = 0 ; i < listCount; i++) - offlineServers.add(data.getAscii()); - } - - public NetBuffer encode() { - int strLength = 0; - for (String str : offlineServers) - strLength += 2 + str.length(); - NetBuffer data = NetBuffer.allocate(10 + strLength); - data.addShort(2); - data.addInt(CRC); - data.addInt(offlineServers.size()); - for (String str : offlineServers) - data.addAscii(str); - return data; - } - - public List getOfflineServers() { - return offlineServers; - } - - public void setOfflineServers(List offline) { - offlineServers = offline; - } - - public void addOflineServer(String offline) { - offlineServers.add(offline); - } - -} diff --git a/src/network/packets/swg/login/RequestExtendedClusters.java b/src/network/packets/swg/login/RequestExtendedClusters.java deleted file mode 100644 index 18954cf80..000000000 --- a/src/network/packets/swg/login/RequestExtendedClusters.java +++ /dev/null @@ -1,55 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class RequestExtendedClusters extends SWGPacket { - - public static final int CRC = getCrc("RequestExtendedClusterInfo"); - - public RequestExtendedClusters() { - - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(10); - data.addShort(2); - data.addInt(CRC); - data.addInt(0); - return data; - } -} diff --git a/src/network/packets/swg/login/ServerId.java b/src/network/packets/swg/login/ServerId.java deleted file mode 100644 index 8f9931dd3..000000000 --- a/src/network/packets/swg/login/ServerId.java +++ /dev/null @@ -1,66 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class ServerId extends SWGPacket { - - public static final int CRC = 0x58C07F21; - private int serverId = 0; - - public ServerId() { - - } - - public ServerId(int id) { - this.serverId = id; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - serverId = data.getInt(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(10); - data.addShort(2); - data.addInt(CRC); - data.addInt(serverId); - return data; - } - - public int getServerId() { - return serverId; - } - -} diff --git a/src/network/packets/swg/login/ServerString.java b/src/network/packets/swg/login/ServerString.java deleted file mode 100644 index cb94a69a3..000000000 --- a/src/network/packets/swg/login/ServerString.java +++ /dev/null @@ -1,66 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class ServerString extends SWGPacket { - - public static final int CRC = 0x0E20D7E9; - private String serverName = ""; - - public ServerString() { - - } - - public ServerString(String name) { - this.serverName = name; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - serverName = data.getAscii(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(8 + serverName.length()); - data.addShort(2); - data.addInt(CRC); - data.addAscii(serverName); - return data; - } - - public String getServerString() { - return serverName; - } - -} diff --git a/src/network/packets/swg/login/StationIdHasJediSlot.java b/src/network/packets/swg/login/StationIdHasJediSlot.java deleted file mode 100644 index bbd75c0bb..000000000 --- a/src/network/packets/swg/login/StationIdHasJediSlot.java +++ /dev/null @@ -1,67 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class StationIdHasJediSlot extends SWGPacket { - - public static final int CRC = 0xCC9FCCF8; - - private int jedi; - - public StationIdHasJediSlot() { - this.jedi = 1; - } - - public StationIdHasJediSlot(int jedi) { - this.jedi = jedi; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - jedi = data.getInt(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(10); - data.addShort(2); - data.addInt(CRC); - data.addInt(jedi); - return data; - } - - public int getJediSlot() { - return jedi; - } - -} diff --git a/src/network/packets/swg/login/creation/ClientCreateCharacter.java b/src/network/packets/swg/login/creation/ClientCreateCharacter.java deleted file mode 100644 index 74c82053c..000000000 --- a/src/network/packets/swg/login/creation/ClientCreateCharacter.java +++ /dev/null @@ -1,125 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login.creation; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class ClientCreateCharacter extends SWGPacket { - public static final int CRC = getCrc("ClientCreateCharacter"); - - private byte [] charCustomization = new byte[0]; - private String name = ""; - private String race = ""; - private String start = ""; - private String hair = ""; - private byte [] hairCustomization = new byte[0]; - private String clothes = ""; - private boolean jedi = false; - private float height = 0; - private String biography = ""; - private boolean tutorial = false; - private String profession = ""; - private String startingPhase = ""; - - public ClientCreateCharacter() { - - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - charCustomization = data.getArray(); - name = data.getUnicode(); - race = data.getAscii(); - start = data.getAscii(); - hair = data.getAscii(); - hairCustomization = data.getArray(); - clothes = data.getAscii(); - jedi = data.getBoolean(); - height = data.getFloat(); - biography = data.getUnicode(); - tutorial = data.getBoolean(); - profession = data.getAscii(); - startingPhase = data.getAscii(); - } - - public NetBuffer encode() { - int extraSize = charCustomization.length; - extraSize += name.length()*2; - extraSize += race.length() + start.length(); - extraSize += hair.length() + hairCustomization.length; - extraSize += clothes.length() + profession.length(); - extraSize += startingPhase.length(); - NetBuffer data = NetBuffer.allocate(36+extraSize); - data.addShort(2); - data.addInt(CRC); - data.addArray(charCustomization); - data.addUnicode(name); - data.addAscii(race); - data.addAscii(start); - data.addAscii(hair); - data.addArray(hairCustomization); - data.addAscii(clothes); - data.addBoolean(jedi); - data.addFloat(height); - data.addUnicode(biography); - data.addBoolean(tutorial); - data.addAscii(profession); - data.addAscii(startingPhase); - return data; - } - - public byte [] getCharCustomization() { return charCustomization; } - public String getName() { return name; } - public String getRace() { return race; } - public String getStartLocation() { return start; } - public String getHair() { return hair; } - public byte [] getHairCustomization() { return hairCustomization; } - public String getClothes() { return clothes; } - public float getHeight() { return height; } - public boolean isTutorial() { return tutorial; } - public String getProfession() { return profession; } - public String getStartingPhase() { return startingPhase; } - - public void setCharCustomization(byte [] data) { this.charCustomization = data; } - public void setName(String name) { this.name = name; } - public String getStart() { return start; } - public void setStart(String start) { this.start = start; } - public void setRace(String race) { this.race = race; } - public void setHair(String hair) { this.hair = hair; } - public void setHairCustomization(byte [] hairCustomization) { this.hairCustomization = hairCustomization; } - public void setClothes(String clothes) { this.clothes = clothes; } - public void setHeight(float height) { this.height = height; } - public void setTutorial(boolean tutorial) { this.tutorial = tutorial; } - public void setProfession(String profession) { this.profession = profession; } - public void setStartingPhase(String startingPhase) { this.startingPhase = startingPhase; } - -} diff --git a/src/network/packets/swg/login/creation/ClientVerifyAndLockNameRequest.java b/src/network/packets/swg/login/creation/ClientVerifyAndLockNameRequest.java deleted file mode 100644 index 1238d9966..000000000 --- a/src/network/packets/swg/login/creation/ClientVerifyAndLockNameRequest.java +++ /dev/null @@ -1,68 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login.creation; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class ClientVerifyAndLockNameRequest extends SWGPacket { - public static final int CRC = getCrc("ClientVerifyAndLockNameRequest"); - - private String race = ""; - private String name = ""; - - public ClientVerifyAndLockNameRequest() { - - } - - public ClientVerifyAndLockNameRequest(String race, String name) { - this.race = race; - this.name = name; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - race = data.getAscii(); - name = data.getUnicode(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(10 + race.length() + name.length() * 2); - data.addShort(4); - data.addInt(CRC); - data.addAscii(race); - data.addUnicode(name); - return data; - } - - public String getRace() { return race; } - public String getName() { return name; } -} diff --git a/src/network/packets/swg/login/creation/ClientVerifyAndLockNameResponse.java b/src/network/packets/swg/login/creation/ClientVerifyAndLockNameResponse.java deleted file mode 100644 index c7880b72e..000000000 --- a/src/network/packets/swg/login/creation/ClientVerifyAndLockNameResponse.java +++ /dev/null @@ -1,94 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login.creation; - -import java.util.Locale; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class ClientVerifyAndLockNameResponse extends SWGPacket { - public static final int CRC = getCrc("ClientVerifyAndLockNameResponse"); - - private String name = ""; - private ErrorMessage error = ErrorMessage.NAME_APPROVED; - - public ClientVerifyAndLockNameResponse() { - - } - - public ClientVerifyAndLockNameResponse(String name, ErrorMessage error) { - this.name = name; - this.error = error; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - name = data.getUnicode(); - data.getAscii(); // ui - data.getInt(); - error = ErrorMessage.valueOf(data.getAscii().toUpperCase(Locale.US)); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(20 + error.name().length() + name.length() * 2); - data.addShort(9); - data.addInt(CRC); - data.addUnicode(name); - data.addAscii("ui"); - data.addInt(0); - data.addAscii(error.name().toLowerCase(Locale.US)); - return data; - } - - public enum ErrorMessage { - NAME_APPROVED, - NAME_APPROVED_MODIFIED, - NAME_DECLINED_SYNTAX, - NAME_DECLINED_EMPTY, - NAME_DECLINED_RACIALLY_INAPPROPRIATE, - NAME_DECLINED_FICTIONALLY_INAPPROPRIATE, - NAME_DECLINED_PROFANE, - NAME_DECLINED_IN_USE, - NAME_DECLINED_RESERVED, - NAME_DECLINED_NO_TEMPLATE, - NAME_DECLINED_NOT_CREATURE_TEMPLATE, - NAME_DECLINED_NO_NAME_GENERATOR, - NAME_DECLINED_CANT_CREATE_AVATAR, - NAME_DECLINED_INTERNAL_ERROR, - NAME_DECLINED_RETRY, - NAME_DECLINED_TOO_FAST, - NAME_DECLINED_NOT_AUTHORIZED_FOR_SPECIES, - NAME_DECLINED_FICTIONALLY_RESERVED, - SERVER_CHARACTER_CREATION_MAX_CHARS; - } - -} diff --git a/src/network/packets/swg/login/creation/CreateCharacterFailure.java b/src/network/packets/swg/login/creation/CreateCharacterFailure.java deleted file mode 100644 index 696ca60d5..000000000 --- a/src/network/packets/swg/login/creation/CreateCharacterFailure.java +++ /dev/null @@ -1,96 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login.creation; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class CreateCharacterFailure extends SWGPacket { - public static final int CRC = getCrc("ClientCreateCharacterFailed"); - - private NameFailureReason reason; - - public CreateCharacterFailure() { - reason = NameFailureReason.NAME_RETRY; - } - - public CreateCharacterFailure(NameFailureReason reason) { - this.reason = reason; - } - - public void decode(NetBuffer data) { - - } - - public NetBuffer encode() { - String errorString = nameFailureTranslation(reason); - NetBuffer data = NetBuffer.allocate(20 + errorString.length()); - data.addShort(3); - data.addInt(CRC); - data.addUnicode(""); - data.addAscii("ui"); - data.addInt(0); - data.addAscii(errorString); - return data; - } - - private String nameFailureTranslation(NameFailureReason reason) { - switch (reason) { - case NAME_DECLINED_EMPTY: - return "name_declined_empty"; - case NAME_IN_USE: - return "name_declined_in_use"; - case NAME_RETRY: - return "name_declined_retry"; - case NAME_FICTIONALLY_INAPPRORIATE: - return "name_declined_syntax"; - case NAME_SYNTAX: - return "name_declined_syntax"; - case NAME_TOO_FAST: - return "name_declined_too_fast"; - case NAME_DEV_RESERVED: - return "name_declined_developer"; - case TOO_MANY_CHARACTERS: - return "server_character_creation_max_chars"; - } - return "name_declined_retry"; - } - - public enum NameFailureReason { - NAME_DECLINED_EMPTY, - NAME_TOO_FAST, - NAME_RETRY, - NAME_SYNTAX, - NAME_IN_USE, - NAME_FICTIONALLY_INAPPRORIATE, - NAME_DEV_RESERVED, - TOO_MANY_CHARACTERS; - } -} diff --git a/src/network/packets/swg/login/creation/CreateCharacterSuccess.java b/src/network/packets/swg/login/creation/CreateCharacterSuccess.java deleted file mode 100644 index 83c8d4e81..000000000 --- a/src/network/packets/swg/login/creation/CreateCharacterSuccess.java +++ /dev/null @@ -1,64 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login.creation; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class CreateCharacterSuccess extends SWGPacket { - public static final int CRC = getCrc("ClientCreateCharacterSuccess"); - - private long id = 0; - - public CreateCharacterSuccess() { - - } - - public CreateCharacterSuccess(long charId) { - this.id = charId; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - id = data.getLong(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(14); - data.addShort(2); - data.addInt(CRC); - data.addLong(id); - return data; - } - - public long getId() { return id; } - public void setId(long id) { this.id = id; } -} diff --git a/src/network/packets/swg/login/creation/DeleteCharacterRequest.java b/src/network/packets/swg/login/creation/DeleteCharacterRequest.java deleted file mode 100644 index 650eb3312..000000000 --- a/src/network/packets/swg/login/creation/DeleteCharacterRequest.java +++ /dev/null @@ -1,68 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login.creation; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class DeleteCharacterRequest extends SWGPacket { - public static final int CRC = getCrc("DeleteCharacterMessage"); - - private int serverId = 0; - private long playerId = 0; - - public DeleteCharacterRequest() { - - } - - public DeleteCharacterRequest(int serverId, long playerId) { - this.serverId = serverId; - this.playerId = playerId; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - serverId = data.getInt(); - playerId = data.getLong(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(18); - data.addShort(3); - data.addInt(CRC); - data.addInt(serverId); - data.addLong(playerId); - return data; - } - - public int getServerId() { return serverId; } - public long getPlayerId() { return playerId; } -} diff --git a/src/network/packets/swg/login/creation/DeleteCharacterResponse.java b/src/network/packets/swg/login/creation/DeleteCharacterResponse.java deleted file mode 100644 index 55b9d0107..000000000 --- a/src/network/packets/swg/login/creation/DeleteCharacterResponse.java +++ /dev/null @@ -1,61 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login.creation; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class DeleteCharacterResponse extends SWGPacket { - public static final int CRC = getCrc("DeleteCharacterReplyMessage"); - - private boolean deleted = true; - - public DeleteCharacterResponse() { - - } - - public DeleteCharacterResponse(boolean deleted) { - this.deleted = deleted; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - deleted = data.getInt() == 0; - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(10); - data.addShort(2); - data.addInt(CRC); - data.addInt(deleted ? 0 : 1); - return data; - } -} diff --git a/src/network/packets/swg/login/creation/RandomNameRequest.java b/src/network/packets/swg/login/creation/RandomNameRequest.java deleted file mode 100644 index 9d3b98995..000000000 --- a/src/network/packets/swg/login/creation/RandomNameRequest.java +++ /dev/null @@ -1,60 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login.creation; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class RandomNameRequest extends SWGPacket { - public static final int CRC = getCrc("ClientRandomNameRequest"); - - private String raceCrc = "object/creature/player/human_male.iff"; - - public RandomNameRequest() { - - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - raceCrc = data.getAscii(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(8 + raceCrc.length()); - data.addShort(2); - data.addInt(CRC); - data.addAscii(raceCrc); - return data; - } - - public String getRace() { return raceCrc; } - public void setRace(String race) { this.raceCrc = race; } -} diff --git a/src/network/packets/swg/login/creation/RandomNameResponse.java b/src/network/packets/swg/login/creation/RandomNameResponse.java deleted file mode 100644 index ddf3a85a3..000000000 --- a/src/network/packets/swg/login/creation/RandomNameResponse.java +++ /dev/null @@ -1,79 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.login.creation; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class RandomNameResponse extends SWGPacket { - public static final int CRC = getCrc("ClientRandomNameResponse"); - - private String race; - private String randomName; - - public RandomNameResponse() { - this.race = "object/creature/player/human_male.iff"; - this.randomName = ""; - } - - public RandomNameResponse(String race, String randomName) { - this.race = race; - this.randomName = randomName; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - race = data.getAscii(); - randomName = data.getUnicode(); - data.getAscii(); - data.getInt(); - data.getAscii(); - } - - public NetBuffer encode() { - int length = 35 + race.length() + randomName.length() * 2; - NetBuffer data = NetBuffer.allocate(length); - data.addShort(4); - data.addInt(CRC); - data.addAscii(race); - data.addUnicode(randomName); - data.addAscii("ui"); - data.addInt(0); - data.addAscii("name_approved"); - return data; - } - - public void setRace(String race) { this.race = race; } - public void setRandomName(String randomName) { this.randomName = randomName; } - - public String getRace() { return race; } - public String getRandomName() { return randomName; } -} diff --git a/src/network/packets/swg/zone/ClientOpenContainerMessage.java b/src/network/packets/swg/zone/ClientOpenContainerMessage.java deleted file mode 100644 index f391d1f85..000000000 --- a/src/network/packets/swg/zone/ClientOpenContainerMessage.java +++ /dev/null @@ -1,69 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ClientOpenContainerMessage extends SWGPacket { - public static final int CRC = getCrc("ClientOpenContainerMessage"); - - private long containerId; - private String slot; - - public ClientOpenContainerMessage() { - this(0, ""); - } - - public ClientOpenContainerMessage(long containerId, String slot) { - this.containerId = containerId; - this.slot = slot; - } - - public ClientOpenContainerMessage(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - containerId = data.getLong(); - slot = data.getAscii(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(16 + slot.length()); - data.addShort(2); - data.addInt(CRC); - data.addLong(containerId); - data.addAscii(slot); - return data; - } - -} diff --git a/src/network/packets/swg/zone/CmdSceneReady.java b/src/network/packets/swg/zone/CmdSceneReady.java deleted file mode 100644 index 96359ee75..000000000 --- a/src/network/packets/swg/zone/CmdSceneReady.java +++ /dev/null @@ -1,53 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class CmdSceneReady extends SWGPacket { - public static final int CRC = getCrc("CmdSceneReady"); - - public CmdSceneReady() { - - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - public NetBuffer encode() { - int length = 6; - NetBuffer data = NetBuffer.allocate(length); - data.addShort(1); - data.addInt(CRC); - return data; - } -} diff --git a/src/network/packets/swg/zone/ConnectPlayerResponseMessage.java b/src/network/packets/swg/zone/ConnectPlayerResponseMessage.java deleted file mode 100644 index 7098ee740..000000000 --- a/src/network/packets/swg/zone/ConnectPlayerResponseMessage.java +++ /dev/null @@ -1,59 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ConnectPlayerResponseMessage extends SWGPacket { - public static final int CRC = getCrc("ConnectPlayerResponseMessage"); - - public ConnectPlayerResponseMessage() { - - } - - public ConnectPlayerResponseMessage(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - data.getInt(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(10); - data.addShort(2); - data.addInt(CRC); - data.addInt(0); - return data; - } - -} diff --git a/src/network/packets/swg/zone/EnterTicketPurchaseModeMessage.java b/src/network/packets/swg/zone/EnterTicketPurchaseModeMessage.java deleted file mode 100644 index 748f3ba3c..000000000 --- a/src/network/packets/swg/zone/EnterTicketPurchaseModeMessage.java +++ /dev/null @@ -1,70 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class EnterTicketPurchaseModeMessage extends SWGPacket { - public static final int CRC = getCrc("EnterTicketPurchaseModeMessage"); - - private String planetName; - private String nearestPointName; - private boolean instant; - - public EnterTicketPurchaseModeMessage() { - - } - - public EnterTicketPurchaseModeMessage(String planetName, String nearestPointName, boolean instant) { - this.planetName = planetName; - this.nearestPointName = nearestPointName; - this.instant = instant; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - planetName = data.getAscii(); - nearestPointName = data.getAscii(); - instant = data.getBoolean(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(11 + planetName.length() + nearestPointName.length()); // 2x ascii length shorts, 1x opcount short, 1x boolean, int CRC = 11 - data.addShort(3); // Operand count of 3 - data.addInt(CRC); - data.addAscii(planetName); - data.addAscii(nearestPointName); - data.addBoolean(instant); - return data; - } - - -} diff --git a/src/network/packets/swg/zone/ExpertiseRequestMessage.java b/src/network/packets/swg/zone/ExpertiseRequestMessage.java deleted file mode 100644 index c0ed7b900..000000000 --- a/src/network/packets/swg/zone/ExpertiseRequestMessage.java +++ /dev/null @@ -1,91 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public final class ExpertiseRequestMessage extends SWGPacket { - - public static final int CRC = getCrc("ExpertiseRequestMessage"); - - private String[] requestedSkills; - private boolean clearAllExpertisesFirst; - - public ExpertiseRequestMessage() { - - } - - public ExpertiseRequestMessage(NetBuffer data) { - decode(data); - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - requestedSkills = new String[data.getInt()]; - - for (int i = 0; i < requestedSkills.length; i++) { - requestedSkills[i] = data.getAscii(); - } - - clearAllExpertisesFirst = data.getBoolean(); - } - - @Override - public NetBuffer encode() { - int skillNamesLength = 0; - - for (String skillName : requestedSkills) - skillNamesLength += 2 + skillName.length(); - - NetBuffer data = NetBuffer.allocate(11 + skillNamesLength); - data.addShort(3); - data.addInt(CRC); - data.addInt(requestedSkills.length); - - for (String requestedSkill : requestedSkills) { - data.addAscii(requestedSkill); - } - - data.addBoolean(clearAllExpertisesFirst); - - return data; - } - - public String[] getRequestedSkills() { - return requestedSkills; - } - - public boolean isClearAllExpertisesFirst() { - return clearAllExpertisesFirst; - } - -} diff --git a/src/network/packets/swg/zone/GalaxyLoopTimesResponse.java b/src/network/packets/swg/zone/GalaxyLoopTimesResponse.java deleted file mode 100644 index 4c88c0bd3..000000000 --- a/src/network/packets/swg/zone/GalaxyLoopTimesResponse.java +++ /dev/null @@ -1,61 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class GalaxyLoopTimesResponse extends SWGPacket { - public static final int CRC = getCrc("GalaxyLoopTimesResponse"); - - private long time = 0; - - public GalaxyLoopTimesResponse() { - - } - - public GalaxyLoopTimesResponse(long time) { - this.time = time; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - time = data.getLong(); - } - - public NetBuffer encode() { - int length = 14; - NetBuffer data = NetBuffer.allocate(length); - data.addShort(3); - data.addInt(CRC); - data.addLong(time); - return data; - } -} diff --git a/src/network/packets/swg/zone/GameServerLagResponse.java b/src/network/packets/swg/zone/GameServerLagResponse.java deleted file mode 100644 index 68571e40b..000000000 --- a/src/network/packets/swg/zone/GameServerLagResponse.java +++ /dev/null @@ -1,55 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class GameServerLagResponse extends SWGPacket { - - public static final int CRC = getCrc("GameServerLagResponse"); - - public GameServerLagResponse() { - - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(1); - data.addInt(CRC); - return data; - } - -} diff --git a/src/network/packets/swg/zone/HeartBeat.java b/src/network/packets/swg/zone/HeartBeat.java deleted file mode 100644 index e2ba4ff4b..000000000 --- a/src/network/packets/swg/zone/HeartBeat.java +++ /dev/null @@ -1,54 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class HeartBeat extends SWGPacket { - public static final int CRC = getCrc("HeartBeat"); - - public HeartBeat() { - - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(1); - data.addInt(CRC); - return data; - } -} diff --git a/src/network/packets/swg/zone/LagRequest.java b/src/network/packets/swg/zone/LagRequest.java deleted file mode 100644 index 370a4e891..000000000 --- a/src/network/packets/swg/zone/LagRequest.java +++ /dev/null @@ -1,55 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - - -public class LagRequest extends SWGPacket { - - public static final int CRC = getCrc("LagRequest"); - - public LagRequest() { - - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(2); - data.addInt(CRC); - return data; - } - -} diff --git a/src/network/packets/swg/zone/ObjectMenuSelect.java b/src/network/packets/swg/zone/ObjectMenuSelect.java deleted file mode 100644 index 762966051..000000000 --- a/src/network/packets/swg/zone/ObjectMenuSelect.java +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ObjectMenuSelect extends SWGPacket { - - public static final int CRC = getCrc("ObjectMenuSelectMessage::MESSAGE_TYPE"); - - private long objectId; - private short selection; - - public ObjectMenuSelect() { - this(0, (short) 0); - } - - public ObjectMenuSelect(long objectId, short selection) { - this.objectId = objectId; - this.selection = selection; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - objectId = data.getLong(); - selection = data.getShort(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(16); - data.addShort(3); - data.addInt(CRC); - data.addLong(objectId); - data.addShort(selection); - return data; - } - - public void setObjectId(long objectId) { - this.objectId = objectId; - } - - public void setSelection(short selection) { - this.selection = selection; - } - - public long getObjectId() { - return objectId; - } - - public short getSelection() { - return selection; - } - -} diff --git a/src/network/packets/swg/zone/ParametersMessage.java b/src/network/packets/swg/zone/ParametersMessage.java deleted file mode 100644 index 8fccfb68b..000000000 --- a/src/network/packets/swg/zone/ParametersMessage.java +++ /dev/null @@ -1,56 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ParametersMessage extends SWGPacket { - public static final int CRC = getCrc("ParametersMessage"); - - private int weatherInterval = 900; - - public ParametersMessage() { - - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - weatherInterval = data.getInt(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(10); - data.addShort(2); - data.addInt(CRC); - data.addInt(weatherInterval); - return data; - } -} diff --git a/src/network/packets/swg/zone/PlanetTravelPointListRequest.java b/src/network/packets/swg/zone/PlanetTravelPointListRequest.java deleted file mode 100644 index 5f8d615b7..000000000 --- a/src/network/packets/swg/zone/PlanetTravelPointListRequest.java +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class PlanetTravelPointListRequest extends SWGPacket { - - public static final int CRC = getCrc("PlanetTravelPointListRequest"); - - private long requesterObjId; // The object ID of the CreatureObject belonging to the player clicking the travel terminal - private String planetName; - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - requesterObjId = data.getLong(); - planetName = data.getAscii(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(16 + planetName.length()); // ascii length short + opcount short + long + int = 16 - data.addShort(3); // Operand count of 3 - data.addInt(CRC); - data.addLong(requesterObjId); - data.addAscii(planetName); - return data; - } - - public String getPlanetName() { - return planetName; - } - -} diff --git a/src/network/packets/swg/zone/PlanetTravelPointListResponse.java b/src/network/packets/swg/zone/PlanetTravelPointListResponse.java deleted file mode 100644 index 67bb73c7e..000000000 --- a/src/network/packets/swg/zone/PlanetTravelPointListResponse.java +++ /dev/null @@ -1,134 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import com.projectswg.common.data.location.Location; -import com.projectswg.common.data.location.Point3D; -import com.projectswg.common.data.location.Terrain; -import com.projectswg.common.encoding.StringType; -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import services.galaxy.travel.TravelPoint; - -public class PlanetTravelPointListResponse extends SWGPacket { - - public static final int CRC = getCrc("PlanetTravelPointListResponse"); - - private Collection travelPoints; - private String planetName; - private Collection additionalCosts; - - public PlanetTravelPointListResponse() { - this("", new ArrayList<>(), new ArrayList<>()); - } - - public PlanetTravelPointListResponse(String planetName, Collection travelPoints, Collection additionalCosts) { - this.planetName = planetName; - this.travelPoints = travelPoints; - this.additionalCosts = additionalCosts; - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(calculateSize()); - - data.addShort(6); // Operand count - data.addInt(CRC); // CRC - data.addAscii(planetName); // ASCII planet name - - data.addInt(travelPoints.size()); // List size - for (TravelPoint tp : travelPoints) // Point names - data.addAscii(tp.getName()); - - data.addInt(travelPoints.size()); // List size - for (TravelPoint tp : travelPoints) { // Point coordinates - data.addFloat((float) tp.getLocation().getX()); - data.addFloat((float) tp.getLocation().getY()); - data.addFloat((float) tp.getLocation().getZ()); - } - - data.addInt(additionalCosts.size()); // List size - for (int additionalCost : additionalCosts) { // additional costs - data.addInt(additionalCost); - } - - data.addInt(travelPoints.size()); // List size - for (TravelPoint tp : travelPoints) { // reachable - data.addBoolean(tp.isReachable()); - } - - return data; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - planetName = data.getAscii(); - List pointNames = data.getList(StringType.ASCII); - List points = data.getList(Point3D.class); - int[] additionalCosts = data.getIntArray(); - data.getBooleanArray(); // reachable - - for (int additionalCost : additionalCosts) { - this.additionalCosts.add(additionalCost * 2); - } - - for (int i = 0; i < pointNames.size(); i++) { - String pointName = pointNames.get(i); - Point3D point = points.get(i); - - travelPoints.add(new TravelPoint(pointName, new Location(point.getX(), point.getY(), point.getZ(), Terrain.getTerrainFromName(planetName)), null, isStarport(pointName))); - } - } - - private boolean isStarport(String pointName) { - return pointName.endsWith(" Starport") || pointName.endsWith(" Spaceport") || pointName.split(" ").length == 2; - } - - private int calculateSize() { - int size = Integer.BYTES * 5 + // CRC, 4x travelpoint list size - Short.BYTES * 2 + // operand count + ascii string for planet name - travelPoints.size() * (3 * Float.BYTES) + // all the floats - travelPoints.size() * Integer.BYTES + // prices - travelPoints.size() * Byte.BYTES; // the "reachable" booleans - - for (TravelPoint tp : travelPoints) - size += tp.getName().length() + Short.BYTES; // length of each actual name + a short to indicate name length - - size += planetName.length(); - - return size; - } - -} diff --git a/src/network/packets/swg/zone/PlayClientEffectObjectMessage.java b/src/network/packets/swg/zone/PlayClientEffectObjectMessage.java deleted file mode 100644 index a40b60bdb..000000000 --- a/src/network/packets/swg/zone/PlayClientEffectObjectMessage.java +++ /dev/null @@ -1,74 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class PlayClientEffectObjectMessage extends SWGPacket { - public static final int CRC = getCrc("PlayClientEffectObjectMessage"); - - private String effectFile; - private String effectLocation; - private long objectId; - private String commandString; - - public PlayClientEffectObjectMessage() { - - } - - public PlayClientEffectObjectMessage(String effectFile, String effectLocation, long objectId, String commandString) { - this.effectFile = effectFile; - this.effectLocation = effectLocation; - this.objectId = objectId; - this.commandString = commandString; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - effectFile = data.getAscii(); - effectLocation = data.getAscii(); - objectId = data.getLong(); - commandString = data.getAscii(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(20 + effectFile.length() + effectLocation.length() + commandString.length()); - data.addShort(4); - data.addInt(CRC); - data.addAscii(effectFile); - data.addAscii(effectLocation); - data.addLong(objectId); - data.addAscii(commandString); - return data; - } -} diff --git a/src/network/packets/swg/zone/PlayClientEffectObjectTransformMessage.java b/src/network/packets/swg/zone/PlayClientEffectObjectTransformMessage.java deleted file mode 100644 index 6cf0c1f4c..000000000 --- a/src/network/packets/swg/zone/PlayClientEffectObjectTransformMessage.java +++ /dev/null @@ -1,75 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.data.location.Location; -import com.projectswg.common.network.NetBuffer; -import network.packets.swg.SWGPacket; - -public class PlayClientEffectObjectTransformMessage extends SWGPacket { - public static final int CRC = getCrc("PlayClientEffectObjectTransformMessage"); - - private long objectId; - private String effectFile; - private Location location; - private String commandString; - - public PlayClientEffectObjectTransformMessage() { - - } - - public PlayClientEffectObjectTransformMessage(long objectId, String effectFile, Location location, String commandString) { - this.objectId = objectId; - this.effectFile = effectFile; - this.location = location; - this.commandString = commandString; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - - effectFile = data.getAscii(); - location = data.getEncodable(Location.class); - objectId = data.getLong(); - commandString = data.getAscii(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(46 + effectFile.length() + commandString.length()); - data.addShort(5); - data.addInt(CRC); - data.addAscii(effectFile); - data.addEncodable(location); - data.addLong(objectId); - data.addAscii(commandString); - return data; - } -} diff --git a/src/network/packets/swg/zone/PlayMusicMessage.java b/src/network/packets/swg/zone/PlayMusicMessage.java deleted file mode 100644 index b67d678a9..000000000 --- a/src/network/packets/swg/zone/PlayMusicMessage.java +++ /dev/null @@ -1,78 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class PlayMusicMessage extends SWGPacket { - public static final int CRC = getCrc("PlayMusicMessage"); - - private long objectId; - private String soundFile; - private int repititions; // playType? - private boolean loop; - - /** - * - * @param objectId is the ID for the object where this sound originates from. - * Use an object ID of 0 if the sound doesn't originate from anywhere. - * @param soundFile is the full path to the .snd file to play - * @param repititions TODO - * @param loop can be set to true if this sound should keep looping (TODO ?) - */ - public PlayMusicMessage(long objectId, String soundFile, int repititions, boolean loop) { - this.objectId = objectId; - this.soundFile = soundFile; - this.repititions = repititions; - this.loop = loop; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - soundFile = data.getAscii(); - objectId = data.getLong(); - repititions = data.getInt(); - loop = data.getBoolean(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(21 + soundFile.length()); - data.addShort(5); - data.addInt(CRC); - data.addAscii(soundFile); - data.addLong(objectId); - data.addInt(repititions); - data.addBoolean(loop); - return data; - } -} diff --git a/src/network/packets/swg/zone/RequestGalaxyLoopTimes.java b/src/network/packets/swg/zone/RequestGalaxyLoopTimes.java deleted file mode 100644 index 27c3ed45e..000000000 --- a/src/network/packets/swg/zone/RequestGalaxyLoopTimes.java +++ /dev/null @@ -1,55 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class RequestGalaxyLoopTimes extends SWGPacket { - public static final int CRC = getCrc("RequestGalaxyLoopTimes"); - - public RequestGalaxyLoopTimes() { - - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - @Override - public NetBuffer encode() { - int length = 6; - NetBuffer data = NetBuffer.allocate(length); - data.addShort(1); - data.addInt(CRC); - return data; - } -} diff --git a/src/network/packets/swg/zone/SceneCreateObjectByCrc.java b/src/network/packets/swg/zone/SceneCreateObjectByCrc.java deleted file mode 100644 index c530225c1..000000000 --- a/src/network/packets/swg/zone/SceneCreateObjectByCrc.java +++ /dev/null @@ -1,129 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.data.location.Location; -import com.projectswg.common.debug.Assert; -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class SceneCreateObjectByCrc extends SWGPacket { - - public static final int CRC = getCrc("SceneCreateObjectByCrc"); - - private Location location; - private boolean hyperspace; - private long objId; - private int objCrc; - - public SceneCreateObjectByCrc() { - - } - - public SceneCreateObjectByCrc(long objId, Location l, int objCrc, boolean hyperspace) { - setObjectId(objId); - setLocation(l); - setObjectCrc(objCrc); - setHyperspace(hyperspace); - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - objId = data.getLong(); - location = data.getEncodable(Location.class); - objCrc = data.getInt(); - hyperspace = data.getBoolean(); - } - - @Override - public NetBuffer encode() { - verifyObjectId(); - verifyLocation(); - NetBuffer data = NetBuffer.allocate(47); - data.addShort(5); - data.addInt(CRC); - data.addLong(objId); - data.addEncodable(location); - data.addInt(objCrc); - data.addBoolean(hyperspace); - return data; - } - - public void setObjectId(long objId) { - this.objId = objId; - verifyObjectId(); - } - - public void setLocation(Location l) { - this.location = new Location(l); - verifyLocation(); - } - - public void setObjectCrc(int objCrc) { - this.objCrc = objCrc; - } - - public void setHyperspace(boolean hyperspace) { - this.hyperspace = hyperspace; - } - - public long getObjectId() { - return objId; - } - - public Location getLocation() { - return location; - } - - public int getObjectCrc() { - return objCrc; - } - - public boolean isHyperspace() { - return hyperspace; - } - - private void verifyObjectId() { - Assert.test(objId != 0, "Object ID cannot be 0!"); - } - - private void verifyLocation() { - Assert.notNull(location); - Assert.test(!Double.isNaN(location.getX()), "X Coordinate is NaN!"); - Assert.test(!Double.isNaN(location.getY()), "Y Coordinate is NaN!"); - Assert.test(!Double.isNaN(location.getZ()), "Z Coordinate is NaN!"); - Assert.test(!Double.isNaN(location.getOrientationX()), "X Orientation is NaN!"); - Assert.test(!Double.isNaN(location.getOrientationY()), "Y Orientation is NaN!"); - Assert.test(!Double.isNaN(location.getOrientationZ()), "Z Orientation is NaN!"); - Assert.test(!Double.isNaN(location.getOrientationW()), "W Orientation is NaN!"); - } - -} diff --git a/src/network/packets/swg/zone/SceneDestroyObject.java b/src/network/packets/swg/zone/SceneDestroyObject.java deleted file mode 100644 index 99950c991..000000000 --- a/src/network/packets/swg/zone/SceneDestroyObject.java +++ /dev/null @@ -1,70 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class SceneDestroyObject extends SWGPacket { - public static final int CRC = getCrc("SceneDestroyObject"); - - private long objId; - - public SceneDestroyObject() { - this(0); - } - - public SceneDestroyObject(long objId) { - this.objId = objId; - } - - public SceneDestroyObject(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - objId = data.getLong(); - data.getByte(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(15); - data.addShort(3); - data.addInt(CRC); - data.addLong(objId); - data.addByte(0); - return data; - } - - public long getObjectId() { return objId; } - public void setObjectId(long objId) { this.objId = objId; } - -} diff --git a/src/network/packets/swg/zone/SceneEndBaselines.java b/src/network/packets/swg/zone/SceneEndBaselines.java deleted file mode 100644 index 5840766e4..000000000 --- a/src/network/packets/swg/zone/SceneEndBaselines.java +++ /dev/null @@ -1,64 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class SceneEndBaselines extends SWGPacket { - public static final int CRC = getCrc("SceneEndBaselines"); - - private long objId = 0; - - public SceneEndBaselines() { - - } - - public SceneEndBaselines(long objId) { - this.objId = objId; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - objId = data.getLong(); - } - - public NetBuffer encode() { - int length = 14; - NetBuffer data = NetBuffer.allocate(length); - data.addShort(2); - data.addInt(CRC); - data.addLong(objId); - return data; - } - - public long getObjectId() { return objId; } - -} diff --git a/src/network/packets/swg/zone/ServerNowEpochTime.java b/src/network/packets/swg/zone/ServerNowEpochTime.java deleted file mode 100644 index 84cca4df0..000000000 --- a/src/network/packets/swg/zone/ServerNowEpochTime.java +++ /dev/null @@ -1,64 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ServerNowEpochTime extends SWGPacket { - public static final int CRC = getCrc("ServerNowEpochTime"); - - private int time = 0; - - public ServerNowEpochTime() { - - } - - public ServerNowEpochTime(int time) { - this.time = time; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - time = data.getInt(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(10); - data.addShort(2); - data.addInt(CRC); - data.addInt(time); - return data; - } - - public int getTime() { - return time; - } -} diff --git a/src/network/packets/swg/zone/ServerTimeMessage.java b/src/network/packets/swg/zone/ServerTimeMessage.java deleted file mode 100644 index c5c0e1841..000000000 --- a/src/network/packets/swg/zone/ServerTimeMessage.java +++ /dev/null @@ -1,68 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ServerTimeMessage extends SWGPacket { - public static final int CRC = getCrc("ServerTimeMessage"); - - private long time = 0; - - public ServerTimeMessage() { - - } - - public ServerTimeMessage(long time) { - this.time = time; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - time = data.getLong(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(14); - data.addShort(2); - data.addInt(CRC); - data.addLong(time); - return data; - } - - public long getTime() { - return time; - } - - public void setTime(long time) { - this.time = time; - } -} diff --git a/src/network/packets/swg/zone/ServerWeatherMessage.java b/src/network/packets/swg/zone/ServerWeatherMessage.java deleted file mode 100644 index 7664b0078..000000000 --- a/src/network/packets/swg/zone/ServerWeatherMessage.java +++ /dev/null @@ -1,116 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.WeatherType; - -public class ServerWeatherMessage extends SWGPacket { - public static final int CRC = getCrc("ServerWeatherMessage"); - - private WeatherType type; - private float cloudVectorX; - private float cloudVectorZ; - private float cloudVectorY; - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - - switch (data.getInt()) { - case 0: - default: - type = WeatherType.CLEAR; - break; - case 1: - type = WeatherType.LIGHT; - break; - case 2: - type = WeatherType.MEDIUM; - break; - case 3: - type = WeatherType.HEAVY; - break; - } - - cloudVectorX = data.getFloat(); - cloudVectorZ = data.getFloat(); - cloudVectorY = data.getFloat(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(22); - - data.addShort(3); - data.addInt(CRC); - data.addInt(type.getValue()); - - data.addFloat(cloudVectorX); - data.addFloat(cloudVectorZ); - data.addFloat(cloudVectorY); - - return data; - } - - public WeatherType getType() { - return type; - } - - public void setType(WeatherType type) { - this.type = type; - } - - public float getCloudVectorX() { - return cloudVectorX; - } - - public void setCloudVectorX(float cloudVectorX) { - this.cloudVectorX = cloudVectorX; - } - - public float getCloudVectorZ() { - return cloudVectorZ; - } - - public void setCloudVectorZ(float cloudVectorZ) { - this.cloudVectorZ = cloudVectorZ; - } - - public float getCloudVectorY() { - return cloudVectorY; - } - - public void setCloudVectorY(float cloudVectorY) { - this.cloudVectorY = cloudVectorY; - } - -} diff --git a/src/network/packets/swg/zone/SetWaypointColor.java b/src/network/packets/swg/zone/SetWaypointColor.java deleted file mode 100644 index 364debe3a..000000000 --- a/src/network/packets/swg/zone/SetWaypointColor.java +++ /dev/null @@ -1,68 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class SetWaypointColor extends SWGPacket { - public static final int CRC = getCrc("SetWaypointColor"); - - private long objId; - private String color; - - public SetWaypointColor() { } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - - objId = data.getLong(); - color = data.getAscii(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(16 + color.length()); - data.addShort(3); - data.addInt(CRC); - data.addLong(objId); - data.addAscii(color); - return data; - } - - public long getObjId() { - return objId; - } - - public String getColor() { - return color; - } -} diff --git a/src/network/packets/swg/zone/ShowBackpack.java b/src/network/packets/swg/zone/ShowBackpack.java deleted file mode 100644 index 8022fc97e..000000000 --- a/src/network/packets/swg/zone/ShowBackpack.java +++ /dev/null @@ -1,67 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ShowBackpack extends SWGPacket { - public static final int CRC = getCrc("ShowBackpack"); - - private long objectId; - private boolean showBackpack; - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - - objectId = data.getLong(); - showBackpack = data.getBoolean(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(15); - data.addShort(3); - data.addInt(CRC); - data.addLong(objectId); - data.addBoolean(showBackpack); - return data; - } - - public boolean showingBackpack() { - return showBackpack; - } - - public long getObjectId() { - return objectId; - } - -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/ShowHelmet.java b/src/network/packets/swg/zone/ShowHelmet.java deleted file mode 100644 index a402cb78e..000000000 --- a/src/network/packets/swg/zone/ShowHelmet.java +++ /dev/null @@ -1,67 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ShowHelmet extends SWGPacket { - public static final int CRC = getCrc("ShowHelmet"); - - private long objectId; - private boolean showHelmet; - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - - objectId = data.getLong(); - showHelmet = data.getBoolean(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(15); - data.addShort(3); - data.addInt(CRC); - data.addLong(objectId); - data.addBoolean(showHelmet); - return data; - } - - public boolean showingHelmet() { - return showHelmet; - } - - public long getObjectId() { - return objectId; - } - -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/StopClientEffectObjectByLabelMessage.java b/src/network/packets/swg/zone/StopClientEffectObjectByLabelMessage.java deleted file mode 100644 index fe3fc38c5..000000000 --- a/src/network/packets/swg/zone/StopClientEffectObjectByLabelMessage.java +++ /dev/null @@ -1,75 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class StopClientEffectObjectByLabelMessage extends SWGPacket { - public static final int CRC = getCrc("StopClientEffectObjectByLabelMessage"); - - private long objectId; - private String label; - private boolean softStop; - - public StopClientEffectObjectByLabelMessage() { - - } - - public StopClientEffectObjectByLabelMessage(long objectId, String label, boolean softStop) { - this.objectId = objectId; - this.label = label; - this.softStop = softStop; - } - - public StopClientEffectObjectByLabelMessage(NetBuffer data) { - decode(data); - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - objectId = data.getLong(); - label = data.getAscii(); - softStop = data.getBoolean(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(Short.BYTES * 2 + Integer.BYTES + Long.BYTES + Byte.BYTES + label.length()); - data.addShort(4); - data.addInt(CRC); - data.addLong(objectId); - data.addAscii(label); - data.addBoolean(softStop); - return data; - } - -} diff --git a/src/network/packets/swg/zone/UpdateContainmentMessage.java b/src/network/packets/swg/zone/UpdateContainmentMessage.java deleted file mode 100644 index c0d6b76ed..000000000 --- a/src/network/packets/swg/zone/UpdateContainmentMessage.java +++ /dev/null @@ -1,72 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class UpdateContainmentMessage extends SWGPacket { - public static final int CRC = getCrc("UpdateContainmentMessage"); - - private long containerId = 0; - private long objectId = 0; - private int slotIndex = 0; - - public UpdateContainmentMessage() { - - } - - public UpdateContainmentMessage(long objectId, long containerId, int slotIndex) { - this.objectId = objectId; - this.containerId = containerId; - this.slotIndex = slotIndex; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - objectId = data.getLong(); - containerId = data.getLong(); - slotIndex = data.getInt(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(26); - data.addShort(4); - data.addInt(CRC); - data.addLong(objectId); - data.addLong(containerId); - data.addInt(slotIndex); - return data; - } - - public long getObjectId() { return objectId; } - public long getContainerId() { return containerId; } - public int getSlotIndex() { return slotIndex; } -} diff --git a/src/network/packets/swg/zone/UpdatePostureMessage.java b/src/network/packets/swg/zone/UpdatePostureMessage.java deleted file mode 100644 index 2944cbed7..000000000 --- a/src/network/packets/swg/zone/UpdatePostureMessage.java +++ /dev/null @@ -1,88 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.Posture; - -public class UpdatePostureMessage extends SWGPacket { - public static final int CRC = getCrc("UpdatePostureMessage"); - - private int posture = 0; - private long objId = 0; - - public UpdatePostureMessage() { - - } - - public UpdatePostureMessage(Posture posture, long objId) { - this.posture = posture.getId(); - this.objId = objId; - } - - public UpdatePostureMessage(int posture, long objId) { - this.posture = posture; - this.objId = objId; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - posture = data.getByte(); - objId = data.getLong(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(15); - data.addShort(3); - data.addInt(CRC); - data.addByte(posture); - data.addLong(objId); - return data; - } - - public int getPosture() { - return posture; - } - - public long getObjectId() { - return objId; - } - - public void setPosture(int posture) { - this.posture = posture; - } - - public void setObjId(long objId) { - this.objId = objId; - } -} diff --git a/src/network/packets/swg/zone/UpdatePvpStatusMessage.java b/src/network/packets/swg/zone/UpdatePvpStatusMessage.java deleted file mode 100644 index e44ee0ae9..000000000 --- a/src/network/packets/swg/zone/UpdatePvpStatusMessage.java +++ /dev/null @@ -1,87 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import java.util.EnumSet; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.PvpFaction; -import resources.PvpFlag; - -public class UpdatePvpStatusMessage extends SWGPacket { - public static final int CRC = getCrc("UpdatePvpStatusMessage"); - - private PvpFlag[] pvpFlags; - private PvpFaction pvpFaction; - private long objId; - - public UpdatePvpStatusMessage() { - pvpFlags = new PvpFlag[]{PvpFlag.PLAYER}; - pvpFaction = PvpFaction.NEUTRAL; - objId = 0; - } - - public UpdatePvpStatusMessage(PvpFaction pvpFaction, long objId, PvpFlag... pvpFlags) { - this.pvpFlags = pvpFlags; - this.pvpFaction = pvpFaction; - this.objId = objId; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - EnumSet enumFlags = PvpFlag.getFlags(data.getInt()); - - pvpFlags = enumFlags.toArray(new PvpFlag[enumFlags.size()]); - pvpFaction = PvpFaction.getFactionForCrc(data.getInt()); - objId = data.getLong(); - } - - public NetBuffer encode() { - int length = 22; - int flagBitmask = 0; - NetBuffer data = NetBuffer.allocate(length); - - for(PvpFlag pvpFlag : pvpFlags) - flagBitmask |= pvpFlag.getBitmask(); - - data.addShort(4); - data.addInt(CRC); - data.addInt(flagBitmask); - data.addInt(pvpFaction.getCrc()); - data.addLong(objId); - return data; - } - - public long getObjectId() { return objId; } - public PvpFaction getPlayerFaction() { return pvpFaction; } - public PvpFlag[] getPvpFlags() { return pvpFlags; } - -} diff --git a/src/network/packets/swg/zone/UpdateTransformMessage.java b/src/network/packets/swg/zone/UpdateTransformMessage.java deleted file mode 100644 index ad036197f..000000000 --- a/src/network/packets/swg/zone/UpdateTransformMessage.java +++ /dev/null @@ -1,122 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class UpdateTransformMessage extends SWGPacket { - public static final int CRC = getCrc("UpdateTransformMessage"); - - private long objId; - private short posX; - private short posY; - private short posZ; - private int updateCounter; - private byte direction; - private float speed; - private byte lookAtYaw; - private boolean useLookAtYaw; - - public UpdateTransformMessage() { - this.objId = 0; - this.posX = 0; - this.posY = 0; - this.posZ = 0; - this.updateCounter = 0; - this.direction = 0; - this.speed = 0; - } - - public UpdateTransformMessage(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - objId = data.getLong(); - posX = data.getShort(); - posY = data.getShort(); - posZ = data.getShort(); - updateCounter = data.getInt(); - speed = data.getByte(); - direction = data.getByte(); - lookAtYaw = data.getByte(); - useLookAtYaw = data.getBoolean(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(28); - data.addShort(10); - data.addInt(CRC); - data.addLong(objId); - data.addShort(posX); - data.addShort(posY); - data.addShort(posZ); - data.addInt(updateCounter); - data.addByte((byte) speed); - data.addByte(direction); - data.addByte(lookAtYaw); // lookAtYaw - data.addBoolean(useLookAtYaw); // useLookAtYaw - return data; - } - - public void setObjectId(long objId) { this.objId = objId; } - public void setX(short x) { this.posX = x; } - public void setY(short y) { this.posY = y; } - public void setZ(short z) { this.posZ = z; } - public void setUpdateCounter(int count) { this.updateCounter = count; } - public void setDirection(byte d) { this.direction = d; } - public void setSpeed(float speed) { this.speed = speed; } - - public long getObjectId() { return objId; } - public short getX() { return posX; } - public short getY() { return posY; } - public short getZ() { return posZ; } - public int getUpdateCounter() { return updateCounter; } - public byte getDirection() { return direction; } - public float getSpeed() { return speed; } - - public boolean isUseLookAtYaw() { - return useLookAtYaw; - } - - public void setUseLookAtYaw(boolean useLookAtYaw) { - this.useLookAtYaw = useLookAtYaw; - } - - public byte getLookAtYaw() { - return lookAtYaw; - } - - public void setLookAtYaw(byte lookAtYaw) { - this.lookAtYaw = lookAtYaw; - } -} diff --git a/src/network/packets/swg/zone/UpdateTransformWithParentMessage.java b/src/network/packets/swg/zone/UpdateTransformWithParentMessage.java deleted file mode 100644 index d6f37bf2a..000000000 --- a/src/network/packets/swg/zone/UpdateTransformWithParentMessage.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone; - -import com.projectswg.common.data.location.Location; -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -/** - * @author Waverunner - */ -public class UpdateTransformWithParentMessage extends SWGPacket { - public static final int CRC = getCrc("UpdateTransformWithParentMessage"); - - private long cellId; - private long objectId; - private short x; - private short y; - private short z; - private int updateCounter; - private byte speed; - private byte direction; - private byte lookDirection; - private boolean useLookDirection; - - public UpdateTransformWithParentMessage() { - - } - - public UpdateTransformWithParentMessage(long cellId, long objectId) { - this.cellId = cellId; - this.objectId = objectId; - } - - public UpdateTransformWithParentMessage(long cellId, long objectId, Location location, int updateCounter, byte speed, byte direction, byte lookDirection, boolean useLookDirection) { - this.cellId = cellId; - this.objectId = objectId; - this.updateCounter = updateCounter; - this.speed = speed; - this.direction = direction; - this.lookDirection = lookDirection; - this.useLookDirection = useLookDirection; - setLocation(location); - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - cellId = data.getLong(); - objectId = data.getLong(); - x = data.getShort(); - y = data.getShort(); - z = data.getShort(); - updateCounter = data.getInt(); - speed = data.getByte(); - direction = data.getByte(); - lookDirection = data.getByte(); - useLookDirection= data.getBoolean(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(36); - data.addShort(11); - data.addInt(CRC); - data.addLong(cellId); - data.addLong(objectId); - data.addShort(x); - data.addShort(y); - data.addShort(z); - data.addInt(updateCounter); - data.addByte(speed); - data.addByte(direction); - data.addByte(lookDirection); - data.addBoolean(useLookDirection); - return data; - } - - public void setCellId(long cellId) { - this.cellId = cellId; - } - - public void setObjectId(long objectId) { - this.objectId = objectId; - } - - public void setUpdateCounter(int updateCounter) { - this.updateCounter = updateCounter; - } - - public void setSpeed(byte speed) { - this.speed = speed; - } - - public void setDirection(byte direction) { - this.direction = direction; - } - - public void setLookDirection(byte lookDirection) { - this.lookDirection = lookDirection; - } - - public void setUseLookDirection(boolean useLookDirection) { - this.useLookDirection = useLookDirection; - } - - public long getCellId() { - return cellId; - } - - public long getObjectId() { - return objectId; - } - - public int getUpdateCounter() { - return updateCounter; - } - - public byte getSpeed() { - return speed; - } - - public byte getDirection() { - return direction; - } - - public byte getLookDirection() { - return lookDirection; - } - - public boolean isUseLookDirection() { - return useLookDirection; - } - - public void setLocation(Location location) { - this.x = (short) (location.getX() * 8 + 0.5); - this.y = (short) (location.getY() * 8 + 0.5); - this.z = (short) (location.getZ() * 8 + 0.5); - } -} diff --git a/src/network/packets/swg/zone/auction/AuctionQueryHeadersMessage.java b/src/network/packets/swg/zone/auction/AuctionQueryHeadersMessage.java deleted file mode 100644 index c85a79499..000000000 --- a/src/network/packets/swg/zone/auction/AuctionQueryHeadersMessage.java +++ /dev/null @@ -1,62 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.auction; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class AuctionQueryHeadersMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("AuctionQueryHeadersMessage"); - - public AuctionQueryHeadersMessage() { - - } - - public AuctionQueryHeadersMessage(String command) { - - } - - public AuctionQueryHeadersMessage(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(2); - data.addInt(CRC); - return data; - } - -} diff --git a/src/network/packets/swg/zone/auction/AuctionQueryHeadersResponseMessage.java b/src/network/packets/swg/zone/auction/AuctionQueryHeadersResponseMessage.java deleted file mode 100644 index 40dee5ce3..000000000 --- a/src/network/packets/swg/zone/auction/AuctionQueryHeadersResponseMessage.java +++ /dev/null @@ -1,252 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.auction; - -import java.util.ArrayList; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class AuctionQueryHeadersResponseMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("AuctionQueryHeadersResponseMessage"); - - private int counter; - private int screen; - private List items; - - public AuctionQueryHeadersResponseMessage() { - items = new ArrayList(); - } - - public AuctionQueryHeadersResponseMessage(NetBuffer data) { - decode(data); - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - counter = data.getInt(); - screen = data.getInt(); - String [] locations = new String[data.getInt()]; - for (int i = 0; i < locations.length; i++) - locations[i] = data.getAscii(); - int itemCount = data.getInt(); - AuctionItem [] items = new AuctionItem[itemCount]; - for (int itemI = 0; itemI < itemCount; itemI++) { - AuctionItem item = new AuctionItem(); - item.setItemName(data.getUnicode()); - items[itemI] = item; - } - itemCount = data.getInt(); - if (itemCount != items.length) - throw new IllegalStateException("I WAS LIED TO!"); - for (int itemI = 0; itemI < itemCount; itemI++) { - AuctionItem item = items[itemI]; - item.setObjectId(data.getLong()); - data.getByte(); - item.setPrice(data.getInt()); - item.setExpireTime(data.getInt()*1000L+System.currentTimeMillis()); - if (data.getInt() != item.getPrice()) - throw new IllegalStateException("I WAS LIED TO AT INDEX " + itemI); - item.setVuid(locations[data.getShort()]); - item.setOwnerId(data.getLong()); - item.setOwnerName(locations[data.getShort()]); - data.getLong(); - data.getInt(); - data.getInt(); - data.getShort(); - item.setItemType(data.getInt()); - data.getInt(); - item.setAuctionOptions(data.getInt()); - data.getInt(); - } - data.getShort(); - data.getByte(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(8); - data.addInt(CRC); - data.addInt(counter); - data.addInt(screen); - - Set locations = new LinkedHashSet(); - for (AuctionItem item : items) { - locations.add(item.getVuid()); - locations.add(item.getOwnerName()); - } - data.addInt(items.size()); - for (String item : locations) { - data.addAscii(item); - } - - data.addInt(items.size()); - for (AuctionItem item : items) - data.addUnicode(item.getItemName()); - - data.addInt(items.size()); - - int i = 0; - for(AuctionItem item : items) { - data.addLong(item.getObjectId()); - data.addByte(i); - data.addInt(item.getPrice()); - data.addInt((int) ((item.getExpireTime() - System.currentTimeMillis()) / 1000)); - data.addInt(item.getPrice()); // if != price then auction instead of instant sale - //data.addInt(0); - data.addShort(getString(locations, item.getVuid())); - data.addLong(item.getOwnerId()); - data.addShort(getString(locations, item.getOwnerName())); - data.addLong(0); - data.addInt(0); // unk seen as 2 mostly, doesnt seem to have any effect - data.addInt(0); - data.addShort((short) 0); - data.addInt(item.getItemType()); // gameObjectType/category bitmask - - data.addInt(0); - int options = 0; - - if (item.getStatus() == AuctionState.OFFERED || item.getStatus() == AuctionState.FORSALE) - options |= 0x800; - - data.addInt(item.getAuctionOptions() | options); - data.addInt(0); - i++; - } - - data.addShort(0); - - data.addByte((byte) 0); - return data; - } - - private int getString(Set strings, String str) { - int index = 0; - for (String s : strings) { - if (s.equals(str)) - return index; - index++; - } - return index; - } - - public static enum AuctionState { - PREMIUM (0x400), - WITHDRAW (0x800), - FORSALE (1), - SOLD (2), - EXPIRED (4), - OFFERED (5), - RETRIEVED (6); - - private int id; - - AuctionState(int id) { - this.id = id; - } - - public int getId() { return id; } - } - - public static class AuctionItem { - private long objectId; - private long ownerId; - private long vendorId; - private long buyerId; - private long offerToId; - private int itemType; - private int itemTypeCRC; - private String ownerName; - private String bidderName; - private String itemName; - private String itemDescription; - private String planet; - private String location; - private int price; - private int proxyBid; - private boolean auction; - private String vuid; - private boolean onBazaar = false; - private long expireTime; - private int auctionOptions; - private AuctionState state; - - public long getObjectId() { return objectId; } - public long getOwnerId() { return ownerId; } - public long getVendorId() { return vendorId; } - public long getBuyerId() { return buyerId; } - public long getOfferToId() { return offerToId; } - public int getItemType() { return itemType; } - public String getOwnerName() { return ownerName; } - public String getBidderName() { return bidderName; } - public String getItemName() { return itemName; } - public String getLocation() { return location; } - public int getPrice() { return price; } - public int getProxyBid() { return proxyBid; } - public boolean isAuction() { return auction; } - public String getVuid() { return vuid; } - public AuctionState getStatus() { return state; } - public boolean isOnBazaar() { return onBazaar; } - public int getAuctionOptions() { return auctionOptions; } - public String getPlanet() { return planet; } - public int getItemTypeCRC() { return itemTypeCRC; } - - public String getItemDescription() { return itemDescription; } - public void setObjectId(long objectId) { this.objectId = objectId; } - public void setOwnerId(long ownerId) { this.ownerId = ownerId; } - public void setVendorId(long vendorId) { this.vendorId = vendorId; } - public void setBuyerId(long buyerId) { this.buyerId = buyerId; } - public void setOfferToId(long offerToId) { this.offerToId = offerToId; } - public void setItemType(int itemType) { this.itemType = itemType; } - public void setOwnerName(String ownerName) { this.ownerName = ownerName; } - public void setBidderName(String bidderName) { this.bidderName = bidderName; } - public void setItemName(String itemName) { this.itemName = itemName; } - public void setLocation(String location) { this.location = location; } - public void setItemDescription(String itemDescription) { this.itemDescription = itemDescription; } - public void setPrice(int price) { this.price = price; } - public void setProxyBid(int proxyBid) { this.proxyBid = proxyBid; } - public void setAuction(boolean auction) { this.auction = auction; } - public void setVuid(String vuid) { this.vuid = vuid; } - public void setStatus(AuctionState state) { this.state = state; } - public void setOnBazaar(boolean onBazaar) { this.onBazaar = onBazaar; } - public long getExpireTime() { return expireTime; } - public void setExpireTime(long expireTime) { this.expireTime = expireTime; } - public void setAuctionOptions(int auctionOptions) { this.auctionOptions = auctionOptions; } - public void setPlanet(String planet) { this.planet = planet; } - public void setItemTypeCRC(int itemTypeCRC) { this.itemTypeCRC = itemTypeCRC; } - } - -} diff --git a/src/network/packets/swg/zone/auction/CancelLiveAuctionMessage.java b/src/network/packets/swg/zone/auction/CancelLiveAuctionMessage.java deleted file mode 100644 index 65fb16244..000000000 --- a/src/network/packets/swg/zone/auction/CancelLiveAuctionMessage.java +++ /dev/null @@ -1,62 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.auction; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class CancelLiveAuctionMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("CancelLiveAuctionMessage"); - - public CancelLiveAuctionMessage() { - - } - - public CancelLiveAuctionMessage(String command) { - - } - - public CancelLiveAuctionMessage(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(2); - data.addInt(CRC); - return data; - } - -} diff --git a/src/network/packets/swg/zone/auction/CancelLiveAuctionResponseMessage.java b/src/network/packets/swg/zone/auction/CancelLiveAuctionResponseMessage.java deleted file mode 100644 index 7af281ce7..000000000 --- a/src/network/packets/swg/zone/auction/CancelLiveAuctionResponseMessage.java +++ /dev/null @@ -1,62 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.auction; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class CancelLiveAuctionResponseMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("CancelLiveAuctionResponseMessage"); - - public CancelLiveAuctionResponseMessage() { - - } - - public CancelLiveAuctionResponseMessage(String command) { - - } - - public CancelLiveAuctionResponseMessage(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(2); - data.addInt(CRC); - return data; - } - -} diff --git a/src/network/packets/swg/zone/auction/CommoditiesItemTypeListRequest.java b/src/network/packets/swg/zone/auction/CommoditiesItemTypeListRequest.java deleted file mode 100644 index 15b643b4a..000000000 --- a/src/network/packets/swg/zone/auction/CommoditiesItemTypeListRequest.java +++ /dev/null @@ -1,32 +0,0 @@ -package network.packets.swg.zone.auction; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class CommoditiesItemTypeListRequest extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("CommoditiesItemTypeListRequest"); - - private String from; - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - from = data.getAscii(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(8 + from.length()); - data.addShort(2); - data.addInt(CRC); - data.addAscii(from); - return data; - } - - public String getFrom() { - return from; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/auction/CommoditiesItemTypeListResponse.java b/src/network/packets/swg/zone/auction/CommoditiesItemTypeListResponse.java deleted file mode 100644 index 403f4bf0b..000000000 --- a/src/network/packets/swg/zone/auction/CommoditiesItemTypeListResponse.java +++ /dev/null @@ -1,84 +0,0 @@ -package network.packets.swg.zone.auction; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class CommoditiesItemTypeListResponse extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("CommoditiesItemTypeListResponse"); - - private String serverName; - private int subCategoryCounter; - private int subCatagory; - private int itemsInSubCategory; - private String categoryName; - private int placeholder; - private String type; - - public CommoditiesItemTypeListResponse(String serverName, int subCategoryCounter, int subCatagory, int itemsInSubCategory, String categoryName, int placeholder, String type) { - this.serverName = serverName; - this.subCategoryCounter = subCategoryCounter; - this.subCatagory = subCatagory; - this.itemsInSubCategory = itemsInSubCategory; - this.categoryName = categoryName; - this.placeholder = placeholder; - this.type = type; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - serverName = data.getAscii(); - subCategoryCounter = data.getInt(); - subCatagory = data.getInt(); - itemsInSubCategory = data.getInt(); - categoryName = data.getAscii(); - placeholder = data.getInt(); - type = data.getUnicode(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(30 + serverName.length() + categoryName.length() + type.length()*2); - data.addShort(8); - data.addInt(CRC); - data.addAscii(serverName); - data.addInt(subCategoryCounter); - data.addInt(subCatagory); - data.addInt(itemsInSubCategory); - data.addAscii(categoryName); - data.addInt(placeholder); - data.addUnicode(type); - return data; - } - - public String getServerName() { - return serverName; - } - - public int getSubCategoryCounter() { - return subCategoryCounter; - } - - public int getSubCatagory() { - return subCatagory; - } - - public int getItemsInSubCategory() { - return itemsInSubCategory; - } - - public String getCategoryName() { - return categoryName; - } - - public int getPlaceholder() { - return placeholder; - } - - public String getType() { - return type; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/auction/GetAuctionDetails.java b/src/network/packets/swg/zone/auction/GetAuctionDetails.java deleted file mode 100644 index 32e3e4860..000000000 --- a/src/network/packets/swg/zone/auction/GetAuctionDetails.java +++ /dev/null @@ -1,66 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.auction; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class GetAuctionDetails extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("GetAuctionDetails"); - - private long auctionId; - - public GetAuctionDetails() { - this(0); - } - - public GetAuctionDetails(long auctionId) { - this.auctionId = auctionId; - } - - public GetAuctionDetails(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - auctionId = data.getLong(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(14); - data.addShort(2); - data.addInt(CRC); - data.addLong(auctionId); - return data; - } - -} diff --git a/src/network/packets/swg/zone/auction/GetAuctionDetailsResponse.java b/src/network/packets/swg/zone/auction/GetAuctionDetailsResponse.java deleted file mode 100644 index 0dacff2a1..000000000 --- a/src/network/packets/swg/zone/auction/GetAuctionDetailsResponse.java +++ /dev/null @@ -1,93 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.auction; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class GetAuctionDetailsResponse extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("GetAuctionDetailsResponse"); - - private long itemId; - private Map properties; - private String itemName; - - public GetAuctionDetailsResponse() { - this(0, new HashMap(), ""); - } - - public GetAuctionDetailsResponse(long itemId, Map properties, String itemName) { - this.itemId = itemId; - this.properties = properties; - this.itemName = itemName; - } - - public GetAuctionDetailsResponse(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - itemId = data.getLong(); - data.getInt(); - int count = data.getInt(); - for (int i = 0; i < count; i++) { - String key = data.getAscii(); - String val = data.getUnicode(); - properties.put(key, val); - } - itemName = data.getAscii(); - data.getShort(); // 0 - } - - public NetBuffer encode() { - int strSize = 0; - for (Entry e : properties.entrySet()) - strSize += 6 + e.getKey().length() + e.getValue().length()*2; - NetBuffer data = NetBuffer.allocate(18 + strSize); - data.addShort(9); - data.addInt(CRC); - data.addLong(itemId); - data.addInt(properties.size()); - for (Entry e : properties.entrySet()) { - data.addAscii(e.getKey()); - data.addUnicode(e.getValue()); - } - data.addAscii(itemName); - data.addShort(0); - return data; - } - -} diff --git a/src/network/packets/swg/zone/auction/IsVendorOwnerMessage.java b/src/network/packets/swg/zone/auction/IsVendorOwnerMessage.java deleted file mode 100644 index eb3b92567..000000000 --- a/src/network/packets/swg/zone/auction/IsVendorOwnerMessage.java +++ /dev/null @@ -1,32 +0,0 @@ -package network.packets.swg.zone.auction; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class IsVendorOwnerMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("IsVendorOwnerMessage"); - - private long terminalId; - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - terminalId = data.getLong(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(14); - data.addShort(2); - data.addInt(CRC); - data.addLong(terminalId); - return data; - } - - public long getTerminalId() { - return terminalId; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/auction/IsVendorOwnerResponseMessage.java b/src/network/packets/swg/zone/auction/IsVendorOwnerResponseMessage.java deleted file mode 100644 index f8b56a90a..000000000 --- a/src/network/packets/swg/zone/auction/IsVendorOwnerResponseMessage.java +++ /dev/null @@ -1,121 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.auction; - -import com.projectswg.common.data.EnumLookup; -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class IsVendorOwnerResponseMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("IsVendorOwnerResponseMessage"); - - private int ownerResult; - private int auctionResult; - private long containerId; - private String marketName; - private short maxPageSize; - - public IsVendorOwnerResponseMessage(long containerId, String marketName, int auctionResult, int ownerResult, short maxPageSize) { - super(); - this.containerId = containerId; - this.marketName = marketName; - this.auctionResult = auctionResult; - this.ownerResult = ownerResult; - this.maxPageSize = maxPageSize; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - containerId = data.getLong(); - auctionResult = data.getInt(); - marketName = data.getAscii(); - ownerResult = data.getInt(); - maxPageSize = data.getShort(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(26 + marketName.length()); - data.addShort(5); - data.addInt(CRC); - data.addLong(containerId); - data.addInt(auctionResult); - data.addAscii(marketName); - data.addInt(ownerResult); - data.addShort(maxPageSize); - return data; - } - - public int getOwnerResult() { - return ownerResult; - } - - public int getAuctionResult() { - return auctionResult; - } - - public long getContainerId() { - return containerId; - } - - public String getMarketName() { - return marketName; - } - - public short getMaxPageSize() { - return maxPageSize; - } - - public enum VendorOwnerResult { - UNDEFINED (Integer.MIN_VALUE), - IS_OWNER (0), - IS_NOT_OWNER (1), - IS_BAZAAR (2); - - - private static final EnumLookup LOOKUP = new EnumLookup<>(VendorOwnerResult.class, t -> t.getId()); - - private int id; - - VendorOwnerResult(int id) { - this.id = id; - } - - public int getId() { - return id; - } - - public static VendorOwnerResult getTypeForInt(int id) { - return LOOKUP.getEnum(id, UNDEFINED); - } - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/auction/RetrieveAuctionItemMessage.java b/src/network/packets/swg/zone/auction/RetrieveAuctionItemMessage.java deleted file mode 100644 index 0c99bcd14..000000000 --- a/src/network/packets/swg/zone/auction/RetrieveAuctionItemMessage.java +++ /dev/null @@ -1,62 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.auction; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class RetrieveAuctionItemMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("RetrieveAuctionItemMessage"); - - public RetrieveAuctionItemMessage() { - - } - - public RetrieveAuctionItemMessage(String command) { - - } - - public RetrieveAuctionItemMessage(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(2); - data.addInt(CRC); - return data; - } - -} diff --git a/src/network/packets/swg/zone/auction/RetrieveAuctionItemResponseMessage.java b/src/network/packets/swg/zone/auction/RetrieveAuctionItemResponseMessage.java deleted file mode 100644 index 6410b4952..000000000 --- a/src/network/packets/swg/zone/auction/RetrieveAuctionItemResponseMessage.java +++ /dev/null @@ -1,62 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.auction; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class RetrieveAuctionItemResponseMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("RetrieveAuctionItemResponseMessage"); - - public RetrieveAuctionItemResponseMessage() { - - } - - public RetrieveAuctionItemResponseMessage(String command) { - - } - - public RetrieveAuctionItemResponseMessage(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(2); - data.addInt(CRC); - return data; - } - -} diff --git a/src/network/packets/swg/zone/baselines/Baseline.java b/src/network/packets/swg/zone/baselines/Baseline.java deleted file mode 100644 index 6b9f2a327..000000000 --- a/src/network/packets/swg/zone/baselines/Baseline.java +++ /dev/null @@ -1,102 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.baselines; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class Baseline extends SWGPacket { - public static final int CRC = getCrc("BaselinesMessage"); - - private BaselineType type; - private int num; - private short opCount; - private long objId; - private byte [] baseData; - - public Baseline() { - - } - - public Baseline(long objId, Baseline subData) { - this.objId = objId; - type = subData.getType(); - num = subData.getNum(); - baseData = subData.encodeBaseline().array(); - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - objId = data.getLong(); - type = BaselineType.valueOf(new StringBuffer(new String(data.getArray(4), ascii)).reverse().toString()); - num = data.getByte(); - baseData = data.getArrayLarge(); - if (baseData.length >= 2) - opCount = NetBuffer.wrap(baseData).getShort(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(25 + baseData.length); - data.addShort(5); - data.addInt(CRC); - data.addLong(objId); - data.addRawArray(new StringBuffer(type.toString()).reverse().toString().getBytes(ascii)); - data.addByte(num); - data.addInt(baseData.length + 2); - data.addShort((opCount == 0 ? 5 : opCount)); - data.addRawArray(baseData); - return data; - } - - public NetBuffer encodeBaseline() { return NetBuffer.allocate(0); } - - public long getObjectId() { return objId; } - - public void setType(BaselineType type) { this.type = type; } - public void setNum(int num) { this.num = num; } - public void setId(long id) { this.objId = id; } - public void setBaselineData(byte [] data) { this.baseData = data; } - public void setOperandCount(int count) { this.opCount = (short) count;} - - public BaselineType getType() { return type; } - public int getNum() { return num; } - public long getId() { return objId; } - public byte [] getBaselineData() { return baseData; } - - public enum BaselineType { - BMRK, BUIO, CREO, FCYT, - GILD, GRUP, HINO, INSO, - ITNO, MINO, MISO, MSCO, - PLAY, RCNO, SCLT, STAO, - SHIP, TANO, WAYP, WEAO - } -} diff --git a/src/network/packets/swg/zone/building/UpdateCellPermissionMessage.java b/src/network/packets/swg/zone/building/UpdateCellPermissionMessage.java deleted file mode 100644 index 32da108dd..000000000 --- a/src/network/packets/swg/zone/building/UpdateCellPermissionMessage.java +++ /dev/null @@ -1,73 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.building; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class UpdateCellPermissionMessage extends SWGPacket { - public static final int CRC = getCrc("UpdateCellPermissionMessage"); - - private byte permissionFlag; - private long cellId; - - public UpdateCellPermissionMessage() { - permissionFlag = 0; - cellId = 0; - } - - public UpdateCellPermissionMessage(byte permissionFlag, long cellId) { - this.permissionFlag = permissionFlag; - this.cellId = cellId; - } - - public UpdateCellPermissionMessage(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - permissionFlag = data.getByte(); - cellId = data.getLong(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(15); - data.addShort(2); - data.addInt(CRC); - data.addByte(permissionFlag); - data.addLong(cellId); - return data; - } - - public long getCellId() { return cellId; } - public byte getPermissions() { return permissionFlag; } - -} diff --git a/src/network/packets/swg/zone/chat/ChatAddModeratorToRoom.java b/src/network/packets/swg/zone/chat/ChatAddModeratorToRoom.java deleted file mode 100644 index c4a52dbda..000000000 --- a/src/network/packets/swg/zone/chat/ChatAddModeratorToRoom.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; - -public class ChatAddModeratorToRoom extends SWGPacket { - - public static final int CRC = getCrc("ChatAddModeratorToRoom"); - - private ChatAvatar avatar; - private String room; - private int sequence; - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - avatar = data.getEncodable(ChatAvatar.class); - room = data.getAscii(); - sequence = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(12 + room.length() + avatar.encode().length); - data.addShort(4); - data.addInt(CRC); - data.addEncodable(avatar); - data.addAscii(room); - data.addInt(sequence); - return data; - } - - public ChatAvatar getAvatar() { - return avatar; - } - - public String getRoom() { - return room; - } - - public int getSequence() { - return sequence; - } - -} diff --git a/src/network/packets/swg/zone/chat/ChatBanAvatarFromRoom.java b/src/network/packets/swg/zone/chat/ChatBanAvatarFromRoom.java deleted file mode 100644 index 1e834bdce..000000000 --- a/src/network/packets/swg/zone/chat/ChatBanAvatarFromRoom.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; - -public class ChatBanAvatarFromRoom extends SWGPacket { - - public static final int CRC = getCrc("ChatBanAvatarFromRoom"); - - private ChatAvatar avatar; - private String room; - private int sequence; - - public ChatBanAvatarFromRoom() { - - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - avatar = data.getEncodable(ChatAvatar.class); - room = data.getAscii(); - sequence = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(12 + avatar.encode().length + room.length()); - data.addShort(4); - data.addInt(CRC); - data.addEncodable(avatar); - data.addAscii(room); - data.addInt(sequence); - return data; - } - - public ChatAvatar getAvatar() { - return avatar; - } - - public String getRoom() { - return room; - } - - public int getSequence() { - return sequence; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatCreateRoom.java b/src/network/packets/swg/zone/chat/ChatCreateRoom.java deleted file mode 100644 index 2aa5677a1..000000000 --- a/src/network/packets/swg/zone/chat/ChatCreateRoom.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -/** - * @author Waverunner - */ -public class ChatCreateRoom extends SWGPacket { - public static final int CRC = getCrc("ChatCreateRoom"); - - private boolean isPublic; - private boolean isModerated; - private String owner; - private String roomName; - private String roomTitle; - private int sequence; - - public ChatCreateRoom() {} - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - isPublic = data.getBoolean(); - isModerated = data.getBoolean(); - owner = data.getAscii(); - roomName = data.getAscii(); - roomTitle = data.getAscii(); - sequence = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(18 + owner.length() + roomName.length() + roomTitle.length()); - data.addShort(7); - data.addInt(CRC); - data.addBoolean(isPublic); - data.addBoolean(isModerated); - data.addAscii(owner); - data.addAscii(roomName); - data.addAscii(roomTitle); - data.addInt(sequence); - return data; - } - - public boolean isPublic() { - return isPublic; - } - - public boolean isModerated() { - return isModerated; - } - - public String getOwner() { - return owner; - } - - public String getRoomName() { - return roomName; - } - - public String getRoomTitle() { - return roomTitle; - } - - public int getSequence() { - return sequence; - } - - @Override - public String toString() { - return "ChatCreateRoom[isPublic=" + isPublic + ", isModerated=" + isModerated + - ", owner='" + owner + "'," + "roomName='" + roomName + "'," + "roomTitle='" + roomTitle + '\'' + - ", sequence=" + sequence + "]"; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatDeletePersistentMessage.java b/src/network/packets/swg/zone/chat/ChatDeletePersistentMessage.java deleted file mode 100644 index ed535cf32..000000000 --- a/src/network/packets/swg/zone/chat/ChatDeletePersistentMessage.java +++ /dev/null @@ -1,57 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ChatDeletePersistentMessage extends SWGPacket { - public static final int CRC = getCrc("ChatDeletePersistentMessage"); - - private int mailId; - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - - mailId = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(10); - data.addShort(2); - data.addInt(CRC); - data.addInt(mailId); - return data; - } - - public int getMailId() { return mailId; } -} diff --git a/src/network/packets/swg/zone/chat/ChatDestroyRoom.java b/src/network/packets/swg/zone/chat/ChatDestroyRoom.java deleted file mode 100644 index 75b9922d3..000000000 --- a/src/network/packets/swg/zone/chat/ChatDestroyRoom.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -/** - * @author Waverunner - */ -public class ChatDestroyRoom extends SWGPacket { - public static final int CRC = getCrc("ChatDestroyRoom"); - - private int roomId; - private int sequence; - - public ChatDestroyRoom() {} - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - roomId = data.getInt(); - sequence = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(14); - data.addShort(3); - data.addInt(CRC); - data.addInt(roomId); - data.addInt(sequence); - return data; - } - - public int getRoomId() { - return roomId; - } - - public int getSequence() { - return sequence; - } - - @Override - public String toString() { - return "ChatDestroyRoom[roomId=" + roomId + ", sequence=" + sequence + "]"; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatEnterRoomById.java b/src/network/packets/swg/zone/chat/ChatEnterRoomById.java deleted file mode 100644 index aafaf8de5..000000000 --- a/src/network/packets/swg/zone/chat/ChatEnterRoomById.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -/** - * @author Waverunner - */ -public class ChatEnterRoomById extends SWGPacket { - public static final int CRC = getCrc("ChatEnterRoomById"); - - private int sequence; - private int roomId; - private String roomPath; - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - - sequence = data.getInt(); - roomId = data.getInt(); - roomPath = data.getAscii(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(10 + roomPath.length()); - data.addShort(4); - data.addInt(sequence); - data.addInt(roomId); - data.addAscii(roomPath); - return data; - } - - public int getSequence() { - return sequence; - } - - public int getRoomId() { - return roomId; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatFriendsListUpdate.java b/src/network/packets/swg/zone/chat/ChatFriendsListUpdate.java deleted file mode 100644 index aff465bda..000000000 --- a/src/network/packets/swg/zone/chat/ChatFriendsListUpdate.java +++ /dev/null @@ -1,71 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; - -public class ChatFriendsListUpdate extends SWGPacket { - public static final int CRC = getCrc("ChatFriendsListUpdate"); - - private ChatAvatar friend; - private boolean online; - - public ChatFriendsListUpdate() {} - - public ChatFriendsListUpdate(ChatAvatar friend, boolean online) { - this.friend = friend; - this.online = online; - } - - public ChatFriendsListUpdate(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - friend = data.getEncodable(ChatAvatar.class); - online = data.getBoolean(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(7 + friend.encode().length); - data.addShort(3); - data.addInt(CRC); - data.addEncodable(friend); - data.addBoolean(online); - return data; - } - - public ChatAvatar getFriend() { - return friend; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatIgnoreList.java b/src/network/packets/swg/zone/chat/ChatIgnoreList.java deleted file mode 100644 index 9f769f2ff..000000000 --- a/src/network/packets/swg/zone/chat/ChatIgnoreList.java +++ /dev/null @@ -1,114 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import java.util.ArrayList; -import java.util.List; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ChatIgnoreList extends SWGPacket { - - public static final int CRC = 0xF8C275B0; - - private long objectId; - private List ignoreList; - - public ChatIgnoreList() { - objectId = 0; - ignoreList = new ArrayList(); - } - - public ChatIgnoreList(NetBuffer data) { - decode(data); - } - - public void addName(String game, String galaxy, String name) { - addName(new IgnoreListItem(game, galaxy, name)); - } - - public void addName(IgnoreListItem name) { - ignoreList.add(name); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - objectId = data.getLong(); - int listCount = data.getInt(); - for (int i = 0; i < listCount; i++) { - String game = data.getAscii(); - String galaxy = data.getAscii(); - String name = data.getAscii(); - addName(game, galaxy, name); - } - } - - public NetBuffer encode() { - int extraSize = 0; - for (IgnoreListItem item : ignoreList) - extraSize += 6 + item.getGame().length() + item.getGalaxy().length() + item.getName().length(); - NetBuffer data = NetBuffer.allocate(18 + extraSize); - data.addShort(3); - data.addInt(CRC); - data.addLong(objectId); - data.addInt(ignoreList.size()); - for (IgnoreListItem item : ignoreList) { - data.addAscii(item.getGame()); - data.addAscii(item.getGalaxy()); - data.addAscii(item.getName()); - } - return data; - } - - public static class IgnoreListItem { - private String game; - private String galaxy; - private String name; - - public IgnoreListItem() { - this("SWG", "", ""); - } - - public IgnoreListItem(String game, String galaxy, String name) { - this.game = game; - this.galaxy = galaxy; - this.name = name; - } - - public String getGame() { return game; } - public String getGalaxy() { return galaxy; } - public String getName() { return name; } - public void setGame(String game) { this.game = game; } - public void setGalaxy(String galaxy) { this.galaxy = galaxy; } - public void setName(String name) { this.name = name; } - } - -} diff --git a/src/network/packets/swg/zone/chat/ChatInstantMessageToCharacter.java b/src/network/packets/swg/zone/chat/ChatInstantMessageToCharacter.java deleted file mode 100644 index 3e60f37b5..000000000 --- a/src/network/packets/swg/zone/chat/ChatInstantMessageToCharacter.java +++ /dev/null @@ -1,99 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ChatInstantMessageToCharacter extends SWGPacket { - public static final int CRC = getCrc("ChatInstantMessageToCharacter"); - - private String galaxy; - private String character; - private String message; - private String outOfBand; - private int sequence; - - public ChatInstantMessageToCharacter() { - this("", "", "", "", 0); - } - - public ChatInstantMessageToCharacter(String galaxy, String character, String message, int sequence) { - this(galaxy, character, message, "", sequence); - } - - public ChatInstantMessageToCharacter(String galaxy, String character, String message, String outOfBand, int sequence) { - this.galaxy = galaxy; - this.character = character; - this.message = message; - this.outOfBand = outOfBand; - this.sequence = sequence; - } - - public ChatInstantMessageToCharacter(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - data.getAscii(); - galaxy = data.getAscii(); - character = data.getAscii(); - message = data.getUnicode(); - outOfBand = data.getUnicode(); - sequence = data.getInt(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(27 + galaxy.length() + character.length() + message.length()*2); - data.addShort(2); - data.addInt(CRC); - data.addAscii("SWG"); - data.addAscii(galaxy); - data.addAscii(character); - data.addUnicode(message); - data.addUnicode(outOfBand); - data.addInt(sequence); - return data; - } - - public String getGalaxy() { return galaxy; } - public String getCharacter() { return character; } - public String getMessage() { return message; } - public String getOutOfBand() { return outOfBand; } - public int getSequence() { return sequence; } - - public void setGalaxy(String galaxy) { this.galaxy = galaxy; } - public void setCharacter(String character) { this.character = character; } - public void setMessage(String message) { this.message = message; } - public void setOutOfBand(String outOfBand) { this.outOfBand = outOfBand; } - public void setSequence(int sequence) { this.sequence = sequence; } - -} diff --git a/src/network/packets/swg/zone/chat/ChatInstantMessageToClient.java b/src/network/packets/swg/zone/chat/ChatInstantMessageToClient.java deleted file mode 100644 index 78d4fa6e8..000000000 --- a/src/network/packets/swg/zone/chat/ChatInstantMessageToClient.java +++ /dev/null @@ -1,93 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ChatInstantMessageToClient extends SWGPacket { - public static final int CRC = getCrc("ChatInstantMessageToClient"); - - private String galaxy; - private String character; - private String message; - private String outOfBand; - - public ChatInstantMessageToClient() { - this("", "", "", ""); - } - - public ChatInstantMessageToClient(String galaxy, String character, String message) { - this(galaxy, character, message, ""); - } - - public ChatInstantMessageToClient(String galaxy, String character, String message, String outOfBand) { - this.galaxy = galaxy; - this.character = character; - this.message = message; - this.outOfBand = outOfBand; - } - - public ChatInstantMessageToClient(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - data.getAscii(); // "SWG" - galaxy = data.getAscii(); - character = data.getAscii(); - message = data.getUnicode(); - outOfBand = data.getUnicode(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(23 + galaxy.length() + character.length() + message.length()*2 + outOfBand.length()*2); - data.addShort(2); - data.addInt(CRC); - data.addAscii("SWG"); - data.addAscii(galaxy); - data.addAscii(character); - data.addUnicode(message); - data.addUnicode(outOfBand); - return data; - } - - public String getGalaxy() { return galaxy; } - public String getCharacter() { return character; } - public String getMessage() { return message; } - public String getOutOfBand() { return outOfBand; } - - public void setGalaxy(String galaxy) { this.galaxy = galaxy; } - public void setCharacter(String character) { this.character = character; } - public void setMessage(String message) { this.message = message; } - public void setOutOfBand(String outOfBand) { this.outOfBand = outOfBand; } - -} diff --git a/src/network/packets/swg/zone/chat/ChatInviteAvatarToRoom.java b/src/network/packets/swg/zone/chat/ChatInviteAvatarToRoom.java deleted file mode 100644 index 5de7f82cc..000000000 --- a/src/network/packets/swg/zone/chat/ChatInviteAvatarToRoom.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; - -/** - * @author Waverunner - */ -public class ChatInviteAvatarToRoom extends SWGPacket { - public static final int CRC = getCrc("ChatInviteAvatarToRoom"); - - private ChatAvatar avatar; - private String room; - - public ChatInviteAvatarToRoom() {} - - public ChatInviteAvatarToRoom(ChatAvatar avatar, String room) { - this.avatar = avatar; - this.room = room; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - avatar = data.getEncodable(ChatAvatar.class); - room = data.getAscii(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(8 + avatar.getLength() + room.length()); - data.addShort(3); - data.addInt(CRC); - data.addEncodable(avatar); - data.addAscii(room); - return data; - } - - public ChatAvatar getAvatar() { - return avatar; - } - - public String getRoom() { - return room; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatKickAvatarFromRoom.java b/src/network/packets/swg/zone/chat/ChatKickAvatarFromRoom.java deleted file mode 100644 index db09dfe24..000000000 --- a/src/network/packets/swg/zone/chat/ChatKickAvatarFromRoom.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; - -/** - * @author Waverunner - */ -public class ChatKickAvatarFromRoom extends SWGPacket { - public static final int CRC = getCrc("ChatKickAvatarFromRoom"); - - private ChatAvatar avatar; - private String room; - - public ChatKickAvatarFromRoom() {} - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - avatar = data.getEncodable(ChatAvatar.class); - room = data.getAscii(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(8 + avatar.encode().length); - data.addShort(3); - data.addInt(CRC); - data.addEncodable(avatar); - data.addAscii(room); - return data; - } - - public ChatAvatar getAvatar() { - return avatar; - } - - public String getRoom() { - return room; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatOnAddModeratorToRoom.java b/src/network/packets/swg/zone/chat/ChatOnAddModeratorToRoom.java deleted file mode 100644 index c9d0ebc2a..000000000 --- a/src/network/packets/swg/zone/chat/ChatOnAddModeratorToRoom.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; - -/** - * @author Waverunner - */ -public class ChatOnAddModeratorToRoom extends SWGPacket { - public static final int CRC = getCrc("ChatOnAddModeratorToRoom"); - - private ChatAvatar target; - private ChatAvatar moderator; - private int result; - private String room; - private int sequence; - - public ChatOnAddModeratorToRoom(ChatAvatar target, ChatAvatar moderator, int result, String room, int sequence) { - this.target = target; - this.moderator = moderator; - this.result = result; - this.room = room; - this.sequence = sequence; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - target = data.getEncodable(ChatAvatar.class); - moderator = data.getEncodable(ChatAvatar.class); - result = data.getInt(); - room = data.getAscii(); - sequence = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(16 + target.encode().length + moderator.encode().length + room.length()); - data.addShort(1); - data.addInt(CRC); - data.addEncodable(target); - data.addEncodable(moderator); - data.addInt(result); - data.addAscii(room); - data.addInt(sequence); - return data; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatOnBanAvatarFromRoom.java b/src/network/packets/swg/zone/chat/ChatOnBanAvatarFromRoom.java deleted file mode 100644 index 9c21ae7f6..000000000 --- a/src/network/packets/swg/zone/chat/ChatOnBanAvatarFromRoom.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; - -/** - * @author Waverunner - */ -public class ChatOnBanAvatarFromRoom extends SWGPacket { - public static final int CRC = getCrc("ChatOnBanAvatarFromRoom"); - - private String room; - private ChatAvatar moderator; - private ChatAvatar target; - private int result; - private int sequence; - - public ChatOnBanAvatarFromRoom(String room, ChatAvatar moderator, ChatAvatar target, int result, int sequence) { - this.room = room; - this.moderator = moderator; - this.target = target; - this.result = result; - this.sequence = sequence; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - room = data.getAscii(); - moderator = data.getEncodable(ChatAvatar.class); - target = data.getEncodable(ChatAvatar.class); - result = data.getInt(); - sequence = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(16 + moderator.encode().length + target.encode().length + room.length()); - data.addShort(6); - data.addInt(CRC); - data.addAscii(room); - data.addEncodable(moderator); - data.addEncodable(target); - data.addInt(result); - data.addInt(sequence); - return data; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatOnConnectAvatar.java b/src/network/packets/swg/zone/chat/ChatOnConnectAvatar.java deleted file mode 100644 index 855e015ba..000000000 --- a/src/network/packets/swg/zone/chat/ChatOnConnectAvatar.java +++ /dev/null @@ -1,63 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ChatOnConnectAvatar extends SWGPacket { - public static final int CRC = getCrc("ChatOnConnectAvatar"); - - public ChatOnConnectAvatar() { - - } - - public ChatOnConnectAvatar(String command) { - - } - - public ChatOnConnectAvatar(NetBuffer data) { - decode(data); - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(2); - data.addInt(CRC); - return data; - } - -} diff --git a/src/network/packets/swg/zone/chat/ChatOnCreateRoom.java b/src/network/packets/swg/zone/chat/ChatOnCreateRoom.java deleted file mode 100644 index 2886e945c..000000000 --- a/src/network/packets/swg/zone/chat/ChatOnCreateRoom.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatRoom; - -/** - * @author Waverunner - */ -public class ChatOnCreateRoom extends SWGPacket { - public static final int CRC = getCrc("ChatOnCreateRoom"); - - private int result; - private ChatRoom room; - private int sequence; - - public ChatOnCreateRoom() {} - - public ChatOnCreateRoom(int result, ChatRoom room, int sequence) { - this.result = result; - this.room = room; - this.sequence = sequence; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - result = data.getInt(); - room = data.getEncodable(ChatRoom.class); - sequence = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(14 + room.encode().length); - data.addShort(1); - data.addInt(CRC); - data.addInt(result); - data.addEncodable(room); - data.addInt(sequence); - return data; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatOnDestroyRoom.java b/src/network/packets/swg/zone/chat/ChatOnDestroyRoom.java deleted file mode 100644 index 197a6931b..000000000 --- a/src/network/packets/swg/zone/chat/ChatOnDestroyRoom.java +++ /dev/null @@ -1,81 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; - -public class ChatOnDestroyRoom extends SWGPacket { - public static final int CRC = getCrc("ChatOnDestroyRoom"); - - private ChatAvatar owner; - private int result; - private int roomId; - private int sequence; - - public ChatOnDestroyRoom() { - this(null, 0, 0, 0); - } - - public ChatOnDestroyRoom(ChatAvatar owner, int result, int roomId, int sequence) { - this.owner = owner; - this.result = result; - this.roomId = roomId; - this.sequence = sequence; - } - - public ChatOnDestroyRoom(NetBuffer data) { - decode(data); - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - owner = data.getEncodable(ChatAvatar.class); - result = data.getInt(); - roomId = data.getInt(); - sequence = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(18 + owner.getLength()); - data.addShort(5); - data.addInt(CRC); - data.addEncodable(owner); - data.addInt(result); - data.addInt(roomId); - data.addInt(sequence); - return data; - } - -} - diff --git a/src/network/packets/swg/zone/chat/ChatOnEnteredRoom.java b/src/network/packets/swg/zone/chat/ChatOnEnteredRoom.java deleted file mode 100644 index 29feafd36..000000000 --- a/src/network/packets/swg/zone/chat/ChatOnEnteredRoom.java +++ /dev/null @@ -1,86 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; -import resources.chat.ChatResult; - -public class ChatOnEnteredRoom extends SWGPacket { - - public static final int CRC = getCrc("ChatOnEnteredRoom"); - - private ChatAvatar avatar; - private ChatResult result; - private int chatRoomId; - private int sequence; - - public ChatOnEnteredRoom() { - - } - - public ChatOnEnteredRoom(ChatAvatar avatar, int chatRoomId, int sequence) { - this(avatar, ChatResult.NONE, chatRoomId, sequence); - } - - public ChatOnEnteredRoom(ChatAvatar avatar, ChatResult result, int chatRoomId, int sequence) { - this.avatar = avatar; - this.result = result; - this.chatRoomId = chatRoomId; - this.sequence = sequence; - } - - public ChatOnEnteredRoom(NetBuffer data) { - decode(data); - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - avatar = data.getEncodable(ChatAvatar.class); - result = ChatResult.fromInteger(data.getInt()); - chatRoomId = data.getInt(); - sequence = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(avatar.getLength() + 18); - data.addShort(5); - data.addInt(CRC); - data.addEncodable(avatar); - data.addInt(result.getCode()); - data.addInt(chatRoomId); - data.addInt(sequence); - return data; - } - -} diff --git a/src/network/packets/swg/zone/chat/ChatOnInviteToRoom.java b/src/network/packets/swg/zone/chat/ChatOnInviteToRoom.java deleted file mode 100644 index a63aec0bd..000000000 --- a/src/network/packets/swg/zone/chat/ChatOnInviteToRoom.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; - -/** - * @author Waverunner - */ -public class ChatOnInviteToRoom extends SWGPacket { - public static final int CRC = getCrc("ChatOnInviteToRoom"); - - private String room; - private ChatAvatar sender; - private ChatAvatar invited; - private int result; - - public ChatOnInviteToRoom() {} - - public ChatOnInviteToRoom(String room, ChatAvatar sender, ChatAvatar invited, int result) { - this.room = room; - this.sender = sender; - this.invited = invited; - this.result = result; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - room = data.getAscii(); - sender = data.getEncodable(ChatAvatar.class); - invited = data.getEncodable(ChatAvatar.class); - result = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(12 + sender.getLength() + invited.getLength() + room.length()); - data.addShort(5); - data.addInt(CRC); - data.addAscii(room); - data.addEncodable(sender); - data.addEncodable(invited); - data.addInt(result); - return data; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatOnKickAvatarFromRoom.java b/src/network/packets/swg/zone/chat/ChatOnKickAvatarFromRoom.java deleted file mode 100644 index 7b8c16633..000000000 --- a/src/network/packets/swg/zone/chat/ChatOnKickAvatarFromRoom.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; - -/** - * @author Waverunner - */ -public class ChatOnKickAvatarFromRoom extends SWGPacket { - public static final int CRC = getCrc("ChatOnKickAvatarFromRoom"); - - private ChatAvatar target; - private ChatAvatar moderator; - private int result; - private String room; - - public ChatOnKickAvatarFromRoom(ChatAvatar target, ChatAvatar moderator, int result, String room) { - this.target = target; - this.moderator = moderator; - this.result = result; - this.room = room; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - target = data.getEncodable(ChatAvatar.class); - moderator = data.getEncodable(ChatAvatar.class); - result = data.getInt(); - room = data.getAscii(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(16 + target.encode().length + moderator.encode().length + room.length()); - data.addShort(6); - data.addInt(CRC); - data.addEncodable(target); - data.addEncodable(moderator); - data.addInt(result); - data.addAscii(room); - return data; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatOnLeaveRoom.java b/src/network/packets/swg/zone/chat/ChatOnLeaveRoom.java deleted file mode 100644 index 80cfc17f8..000000000 --- a/src/network/packets/swg/zone/chat/ChatOnLeaveRoom.java +++ /dev/null @@ -1,78 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; - -public class ChatOnLeaveRoom extends SWGPacket { - public static final int CRC = getCrc("ChatOnLeaveRoom"); - - private ChatAvatar avatar; - private int result; - private int chatRoomId; - private int sequence; - - public ChatOnLeaveRoom() { - - } - - public ChatOnLeaveRoom(ChatAvatar avatar, int result, int chatRoomId, int sequence) { - this.avatar = avatar; - this.result = result; - this.chatRoomId = chatRoomId; - this.sequence = sequence; - } - - public ChatOnLeaveRoom(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - avatar = data.getEncodable(ChatAvatar.class); - result = data.getInt(); - chatRoomId = data.getInt(); - sequence = data.getInt(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(18 + avatar.getLength()); - data.addShort(5); - data.addInt(CRC); - data.addEncodable(avatar); - data.addInt(result); - data.addInt(chatRoomId); - data.addInt(sequence); - return data; - } - -} diff --git a/src/network/packets/swg/zone/chat/ChatOnReceiveRoomInvitation.java b/src/network/packets/swg/zone/chat/ChatOnReceiveRoomInvitation.java deleted file mode 100644 index cc659693d..000000000 --- a/src/network/packets/swg/zone/chat/ChatOnReceiveRoomInvitation.java +++ /dev/null @@ -1,63 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; - -public class ChatOnReceiveRoomInvitation extends SWGPacket { - public static final int CRC = getCrc("ChatOnReceiveRoomInvitation"); - - private ChatAvatar avatar; - private String room; - - public ChatOnReceiveRoomInvitation() {} - - public ChatOnReceiveRoomInvitation(ChatAvatar avatar, String room) { - this.avatar = avatar; - this.room = room; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - avatar = data.getEncodable(ChatAvatar.class); - room = data.getAscii(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(8 + avatar.getLength() + room.length()); - data.addShort(3); - data.addInt(CRC); - data.addEncodable(avatar); - data.addAscii(room); - return data; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatOnRemoveModeratorFromRoom.java b/src/network/packets/swg/zone/chat/ChatOnRemoveModeratorFromRoom.java deleted file mode 100644 index cc3c2c6a5..000000000 --- a/src/network/packets/swg/zone/chat/ChatOnRemoveModeratorFromRoom.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; - -/** - * @author Waverunner - */ -public class ChatOnRemoveModeratorFromRoom extends SWGPacket { - public static final int CRC = getCrc("ChatOnRemoveModeratorFromRoom"); - - private ChatAvatar target; - private ChatAvatar moderator; - private int result; - private String room; - private int sequence; - - public ChatOnRemoveModeratorFromRoom(ChatAvatar target, ChatAvatar moderator, int result, String room, int sequence) { - this.target = target; - this.moderator = moderator; - this.result = result; - this.room = room; - this.sequence = sequence; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - target = data.getEncodable(ChatAvatar.class); - moderator = data.getEncodable(ChatAvatar.class); - result = data.getInt(); - room = data.getAscii(); - sequence = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(16 + target.encode().length + moderator.encode().length + room.length()); - data.addShort(1); - data.addInt(CRC); - data.addEncodable(target); - data.addEncodable(moderator); - data.addInt(result); - data.addAscii(room); - data.addInt(sequence); - return data; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatOnSendInstantMessage.java b/src/network/packets/swg/zone/chat/ChatOnSendInstantMessage.java deleted file mode 100644 index 99e128ff8..000000000 --- a/src/network/packets/swg/zone/chat/ChatOnSendInstantMessage.java +++ /dev/null @@ -1,85 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ChatOnSendInstantMessage extends SWGPacket { - public static final int CRC = getCrc("ChatOnSendInstantMessage"); - - private int result; - private int sequence; - - public ChatOnSendInstantMessage() { - this(0, 0); - } - - public ChatOnSendInstantMessage(int result, int sequence) { - this.result = result; - this.sequence = sequence; - } - - public ChatOnSendInstantMessage(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - result = data.getInt(); - sequence = data.getInt(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(14); - data.addShort(2); - data.addInt(CRC); - data.addInt(result); - data.addInt(sequence); - return data; - } - - public void setResult(int result) { - this.result = result; - } - - public void setSequence(int sequence) { - this.sequence = sequence; - } - - public int getResult() { - return result; - } - - public int getSequence() { - return sequence; - } - -} diff --git a/src/network/packets/swg/zone/chat/ChatOnSendPersistentMessage.java b/src/network/packets/swg/zone/chat/ChatOnSendPersistentMessage.java deleted file mode 100644 index b0c42e093..000000000 --- a/src/network/packets/swg/zone/chat/ChatOnSendPersistentMessage.java +++ /dev/null @@ -1,63 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatResult; - -public class ChatOnSendPersistentMessage extends SWGPacket { - public static final int CRC = getCrc("ChatOnSendPersistentMessage"); - - private ChatResult result; - private int count; - - public ChatOnSendPersistentMessage(ChatResult result, int count) { - this.result = result; - this.count = count; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - result = ChatResult.fromInteger(data.getInt()); - count = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(14); - data.addShort(3); - data.addInt(CRC); - data.addInt(result.getCode()); - data.addInt(count); - return data; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatOnSendRoomMessage.java b/src/network/packets/swg/zone/chat/ChatOnSendRoomMessage.java deleted file mode 100644 index ce61ff6d4..000000000 --- a/src/network/packets/swg/zone/chat/ChatOnSendRoomMessage.java +++ /dev/null @@ -1,60 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ChatOnSendRoomMessage extends SWGPacket { - public static final int CRC = getCrc("ChatOnSendRoomMessage"); - - private int result = 0; - private int sequence = 0; - - public ChatOnSendRoomMessage(int result, int sequence) { - this.result = result; - this.sequence = sequence; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - result = data.getInt(); - sequence = data.getInt(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(14); - data.addShort(3); - data.addInt(CRC); - data.addInt(result); - data.addInt(sequence); - return data; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatOnUnbanAvatarFromRoom.java b/src/network/packets/swg/zone/chat/ChatOnUnbanAvatarFromRoom.java deleted file mode 100644 index ae19beb4b..000000000 --- a/src/network/packets/swg/zone/chat/ChatOnUnbanAvatarFromRoom.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; - -/** - * @author Waverunner - */ -public class ChatOnUnbanAvatarFromRoom extends SWGPacket { - public static final int CRC = getCrc("ChatOnUnbanAvatarFromRoom"); - - private String room; - private ChatAvatar moderator; - private ChatAvatar target; - private int result; - private int sequence; - - public ChatOnUnbanAvatarFromRoom(String room, ChatAvatar moderator, ChatAvatar target, int result, int sequence) { - this.room = room; - this.moderator = moderator; - this.target = target; - this.result = result; - this.sequence = sequence; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - room = data.getAscii(); - moderator = data.getEncodable(ChatAvatar.class); - target = data.getEncodable(ChatAvatar.class); - result = data.getInt(); - sequence = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(16 + moderator.encode().length + target.encode().length + room.length()); - data.addShort(6); - data.addInt(CRC); - data.addAscii(room); - data.addEncodable(moderator); - data.addEncodable(target); - data.addInt(result); - data.addInt(sequence); - return data; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatOnUninviteFromRoom.java b/src/network/packets/swg/zone/chat/ChatOnUninviteFromRoom.java deleted file mode 100644 index f25e82641..000000000 --- a/src/network/packets/swg/zone/chat/ChatOnUninviteFromRoom.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; - -/** - * @author Waverunner - */ -public class ChatOnUninviteFromRoom extends SWGPacket { - public static final int CRC = getCrc("ChatOnUninviteFromRoom"); - - private String room; - private ChatAvatar sender; - private ChatAvatar invitee; - private int result; - private int sequence; - - public ChatOnUninviteFromRoom() {} - - public ChatOnUninviteFromRoom(String room, ChatAvatar sender, ChatAvatar invitee, int result, int sequence) { - this.room = room; - this.sender = sender; - this.invitee = invitee; - this.result = result; - this.sequence = sequence; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - - room = data.getAscii(); - sender = data.getEncodable(ChatAvatar.class); - invitee = data.getEncodable(ChatAvatar.class); - result = data.getInt(); - sequence = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(16 + room.length() + sender.encode().length + invitee.encode().length); - data.addShort(6); - data.addInt(CRC); - data.addAscii(room); - data.addEncodable(sender); - data.addEncodable(invitee); - data.addInt(result); - data.addInt(sequence); - return data; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatPersistentMessageToClient.java b/src/network/packets/swg/zone/chat/ChatPersistentMessageToClient.java deleted file mode 100644 index 878289177..000000000 --- a/src/network/packets/swg/zone/chat/ChatPersistentMessageToClient.java +++ /dev/null @@ -1,90 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.encodables.player.Mail; -import services.CoreManager; - -public class ChatPersistentMessageToClient extends SWGPacket { - - public static final int CRC = getCrc("ChatPersistentMessageToClient"); - - private Mail mail; - private boolean header; - - public ChatPersistentMessageToClient() { - this(null, false); - } - - public ChatPersistentMessageToClient(Mail mail, boolean header) { - this.mail = mail; - this.header = header; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - mail = new Mail(null, null, null, 0); - mail.setSender(data.getAscii()); - data.getAscii(); // SWG - data.getAscii(); // galaxy - mail.setId(data.getInt()); - header = data.getBoolean(); - if (header) - mail.decodeHeader(data); - else - mail.decode(data); - mail.setStatus(data.getByte()); - mail.setTimestamp(data.getInt()); - } - - @Override - public NetBuffer encode() { - byte[] mailData = (header ? mail.encodeHeader() : mail.encode()); - String galaxy = CoreManager.getGalaxy().getName(); - - NetBuffer data = NetBuffer.allocate(25 + galaxy.length() + mailData.length + mail.getSender().length()); - data.addShort(2); - data.addInt(CRC); - - data.addAscii(mail.getSender()); - data.addAscii("SWG"); - data.addAscii(galaxy); - data.addInt(mail.getId()); - data.addBoolean(header); - data.addRawArray(mailData); - data.addByte(mail.getStatus()); - data.addInt(mail.getTimestamp()); - return data; - } - -} diff --git a/src/network/packets/swg/zone/chat/ChatPersistentMessageToServer.java b/src/network/packets/swg/zone/chat/ChatPersistentMessageToServer.java deleted file mode 100644 index af22f111d..000000000 --- a/src/network/packets/swg/zone/chat/ChatPersistentMessageToServer.java +++ /dev/null @@ -1,128 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.encodables.OutOfBandPackage; - -public class ChatPersistentMessageToServer extends SWGPacket { - public static final int CRC = getCrc("ChatPersistentMessageToServer"); - - private String message; - private OutOfBandPackage outOfBandPackage; - private int counter; - private String subject; - private String galaxy; - private String recipient; - - public ChatPersistentMessageToServer() { - message = ""; - outOfBandPackage = new OutOfBandPackage(); - subject = ""; - galaxy = ""; - recipient = ""; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - message = data.getUnicode(); - outOfBandPackage = data.getEncodable(OutOfBandPackage.class); - counter = data.getInt(); - subject = data.getUnicode(); - data.getAscii(); // "SWG" - galaxy = data.getAscii(); - recipient = data.getAscii(); - } - - @Override - public NetBuffer encode() { - int dataLength = 31 + message.length() * 2 + outOfBandPackage.getLength() + subject.length() * 2 + galaxy.length() + recipient.length(); - NetBuffer data = NetBuffer.allocate(dataLength); - data.addUnicode(message); - data.addEncodable(outOfBandPackage); - data.addInt(counter); - data.addUnicode(subject); - data.addAscii("SWG"); - data.addAscii(galaxy); - data.addAscii(recipient); - return data; - } - - public String getMessage() { - return message; - } - - public OutOfBandPackage getOutOfBandPackage() { - return outOfBandPackage; - } - - public int getCounter() { - return counter; - } - - public String getSubject() { - return subject; - } - - public String getCluster() { - return galaxy; - } - - public String getRecipient() { - return recipient; - } - - public void setMessage(String message) { - this.message = message; - } - - public void setOutOfBandPackage(OutOfBandPackage outOfBandPackage) { - this.outOfBandPackage = outOfBandPackage; - } - - public void setCounter(int counter) { - this.counter = counter; - } - - public void setSubject(String subject) { - this.subject = subject; - } - - public void setCluster(String cluster) { - this.galaxy = cluster; - } - - public void setRecipient(String recipient) { - this.recipient = recipient; - } - -} diff --git a/src/network/packets/swg/zone/chat/ChatQueryRoom.java b/src/network/packets/swg/zone/chat/ChatQueryRoom.java deleted file mode 100644 index 4e85f7f24..000000000 --- a/src/network/packets/swg/zone/chat/ChatQueryRoom.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -/** - * @author Waverunner - */ -public class ChatQueryRoom extends SWGPacket { - public static final int CRC = getCrc("ChatQueryRoom"); - - private int sequence; - private String roomPath; - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - sequence = data.getInt(); - roomPath = data.getAscii(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(12 + roomPath.length()); - data.addShort(3); - data.addInt(CRC); - data.addInt(sequence); - data.addAscii(roomPath); - return data; - } - - public int getSequence() { - return sequence; - } - - public String getRoomPath() { - return roomPath; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatQueryRoomResults.java b/src/network/packets/swg/zone/chat/ChatQueryRoomResults.java deleted file mode 100644 index 603ba6a2b..000000000 --- a/src/network/packets/swg/zone/chat/ChatQueryRoomResults.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; -import resources.chat.ChatRoom; - -public class ChatQueryRoomResults extends SWGPacket { - - public static final int CRC = getCrc("ChatQueryRoomResults"); - - private ChatRoom room; - private int sequence; - - public ChatQueryRoomResults(ChatRoom room, int sequence) { - this.room = room; - this.sequence = sequence; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(getLength()); - data.addList(room.getMembers()); - data.addList(room.getInvited()); - data.addList(room.getModerators()); - data.addList(room.getBanned()); - data.addInt(sequence); - data.addEncodable(room); - return data; - } - - private int getLength() { - int size = 20 + room.getLength(); - - for (ChatAvatar avatar : room.getMembers()) { - size += avatar.getLength(); - } - for (ChatAvatar avatar : room.getInvited()) { - size += avatar.getLength(); - } - for (ChatAvatar avatar : room.getModerators()) { - size += avatar.getLength(); - } - for (ChatAvatar avatar : room.getBanned()) { - size += avatar.getLength(); - } - - return size; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatRemoveAvatarFromRoom.java b/src/network/packets/swg/zone/chat/ChatRemoveAvatarFromRoom.java deleted file mode 100644 index 9626d2baa..000000000 --- a/src/network/packets/swg/zone/chat/ChatRemoveAvatarFromRoom.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; - -/** - * @author Waverunner - */ -public class ChatRemoveAvatarFromRoom extends SWGPacket { - public static final int CRC = getCrc("ChatRemoveAvatarFromRoom"); - - private ChatAvatar avatar; - private String path; - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - - avatar = data.getEncodable(ChatAvatar.class); - path = data.getAscii(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6 + path.length() + avatar.getLength()); - data.addShort(3); - data.addInt(CRC); - data.addEncodable(avatar); - data.addAscii(path); - return data; - } - - public ChatAvatar getAvatar() { - return avatar; - } - - public String getPath() { - return path; - } - -} diff --git a/src/network/packets/swg/zone/chat/ChatRemoveModeratorFromRoom.java b/src/network/packets/swg/zone/chat/ChatRemoveModeratorFromRoom.java deleted file mode 100644 index d7433d999..000000000 --- a/src/network/packets/swg/zone/chat/ChatRemoveModeratorFromRoom.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; - -/** - * @author Waverunner - */ -public class ChatRemoveModeratorFromRoom extends SWGPacket { - public static final int CRC = getCrc("ChatRemoveModeratorFromRoom"); - - private ChatAvatar avatar; - private String room; - private int sequence; - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - avatar = data.getEncodable(ChatAvatar.class); - room = data.getAscii(); - sequence = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(12 + room.length() + avatar.encode().length); - data.addShort(4); - data.addInt(CRC); - data.addEncodable(avatar); - data.addAscii(room); - data.addInt(sequence); - return data; - } - - public ChatAvatar getAvatar() { - return avatar; - } - - public String getRoom() { - return room; - } - - public int getSequence() { - return sequence; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatRequestPersistentMessage.java b/src/network/packets/swg/zone/chat/ChatRequestPersistentMessage.java deleted file mode 100644 index 336c3438a..000000000 --- a/src/network/packets/swg/zone/chat/ChatRequestPersistentMessage.java +++ /dev/null @@ -1,60 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ChatRequestPersistentMessage extends SWGPacket { - public static final int CRC = getCrc("ChatRequestPersistentMessage"); - - private int sequence; - private int mailId; - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - sequence = data.getInt(); - mailId = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(14); - data.addShort(3); - data.addInt(CRC); - data.addInt(sequence); - data.addInt(mailId); - - return data; - } - - public int getMailId() { return this.mailId; } -} diff --git a/src/network/packets/swg/zone/chat/ChatRequestRoomList.java b/src/network/packets/swg/zone/chat/ChatRequestRoomList.java deleted file mode 100644 index 1c54f8cba..000000000 --- a/src/network/packets/swg/zone/chat/ChatRequestRoomList.java +++ /dev/null @@ -1,54 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ChatRequestRoomList extends SWGPacket { - - public static final int CRC = getCrc("ChatRequestRoomList"); - - public ChatRequestRoomList() { - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(1); - data.addInt(CRC); - return data; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatRoomMessage.java b/src/network/packets/swg/zone/chat/ChatRoomMessage.java deleted file mode 100644 index 357825940..000000000 --- a/src/network/packets/swg/zone/chat/ChatRoomMessage.java +++ /dev/null @@ -1,74 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; -import resources.encodables.OutOfBandPackage; - -public class ChatRoomMessage extends SWGPacket { - public static final int CRC = getCrc("ChatRoomMessage"); - - private ChatAvatar avatar; - private int roomId = 0; - private String message = ""; - private OutOfBandPackage outOfBandPackage; - - public ChatRoomMessage(ChatAvatar avatar, int roomId, String message, OutOfBandPackage oob) { - this.avatar = avatar; - this.roomId = roomId; - this.message = message; - this.outOfBandPackage = oob; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - avatar = data.getEncodable(ChatAvatar.class); - roomId = data.getInt(); - message = data.getUnicode(); - outOfBandPackage = data.getEncodable(OutOfBandPackage.class); - } - - @Override - public NetBuffer encode() { - byte[] oob = outOfBandPackage.encode(); - int length = 14 + avatar.getLength() + oob.length + message.length() * 2; - NetBuffer data = NetBuffer.allocate(length); - data.addShort(5); - data.addInt(CRC); - data.addEncodable(avatar); - data.addInt(roomId); - data.addUnicode(message); - data.addRawArray(oob); - return data; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatSendToRoom.java b/src/network/packets/swg/zone/chat/ChatSendToRoom.java deleted file mode 100644 index 45b82149a..000000000 --- a/src/network/packets/swg/zone/chat/ChatSendToRoom.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.encodables.OutOfBandPackage; - -public class ChatSendToRoom extends SWGPacket { - public static final int CRC = getCrc("ChatSendToRoom"); - - private String message; - private OutOfBandPackage outOfBandPackage; - private int roomId; - private int sequence; // This seems to vary from room to room, client keeps track individually for each room? - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - - message = data.getUnicode(); - outOfBandPackage = data.getEncodable(OutOfBandPackage.class); - roomId = data.getInt(); - sequence = data.getInt(); - } - - @Override - public NetBuffer encode() { - byte [] oobRaw = outOfBandPackage.encode(); - NetBuffer data = NetBuffer.allocate(12 + message.length()*2 + oobRaw.length); - data.addUnicode(message); - data.addRawArray(oobRaw); - data.addInt(roomId); - data.addInt(sequence); - return data; - } - - public String getMessage() { - return message; - } - - public OutOfBandPackage getOutOfBandPackage() { - return outOfBandPackage; - } - - public int getRoomId() { - return roomId; - } - - public int getSequence() { - return sequence; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatSystemMessage.java b/src/network/packets/swg/zone/chat/ChatSystemMessage.java deleted file mode 100644 index 39e37b34f..000000000 --- a/src/network/packets/swg/zone/chat/ChatSystemMessage.java +++ /dev/null @@ -1,118 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.encodables.OutOfBandPackage; - -public class ChatSystemMessage extends SWGPacket { - - public static final int CRC = getCrc("ChatSystemMessage"); - - private OutOfBandPackage oob; - private String message; - private SystemChatType type; - - public ChatSystemMessage() { - this(SystemChatType.PERSONAL, "", null); - } - - public ChatSystemMessage(SystemChatType type, String message) { - this(type, message, null); - } - - public ChatSystemMessage(SystemChatType type, OutOfBandPackage oob) { - this(type, "", oob); - } - - public ChatSystemMessage(SystemChatType type, String message, OutOfBandPackage oob) { - this.type = type; - this.message = message; - this.oob = oob; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - type = SystemChatType.getType(data.getByte()); - message = data.getUnicode(); - data.getUnicode(); - } - - @Override - public NetBuffer encode() { - boolean oobExists = (oob != null); - NetBuffer data = NetBuffer.allocate(11 + message.length()*2 + (oobExists ? oob.getLength() : 4)); - data.addShort(4); - data.addInt(CRC); - data.addByte(type.getType()); - data.addUnicode(message); - if (oobExists) - data.addEncodable(oob); - else - data.addInt(0); - return data; - } - - public String getMessage() { - return message; - } - - public enum SystemChatType { - PERSONAL (0x00), - BROADCAST (0x01), - CHAT_BOX (0x02), - QUEST (0x04); - - int type; - - SystemChatType(int type) { - this.type = type; - } - - public int getType() { - return type; - } - - public static SystemChatType getType(int type) { - switch (type) { - case 0: - default: - return SystemChatType.PERSONAL; - case 1: - return SystemChatType.BROADCAST; - case 2: - return SystemChatType.CHAT_BOX; - } - } - } - -} diff --git a/src/network/packets/swg/zone/chat/ChatUnbanAvatarFromRoom.java b/src/network/packets/swg/zone/chat/ChatUnbanAvatarFromRoom.java deleted file mode 100644 index 5a7e8aecd..000000000 --- a/src/network/packets/swg/zone/chat/ChatUnbanAvatarFromRoom.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; - -/** - * @author Waverunner - */ -public class ChatUnbanAvatarFromRoom extends SWGPacket { - public static final int CRC = getCrc("ChatUnbanAvatarFromRoom"); - - private ChatAvatar avatar; - private String room; - private int sequence; - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - avatar = data.getEncodable(ChatAvatar.class); - room = data.getAscii(); - sequence = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(12 + avatar.encode().length + room.length()); - data.addShort(4); - data.addInt(CRC); - data.addEncodable(avatar); - data.addAscii(room); - data.addInt(sequence); - return data; - } - - public ChatAvatar getAvatar() { - return avatar; - } - - public String getRoom() { - return room; - } - - public int getSequence() { - return sequence; - } -} diff --git a/src/network/packets/swg/zone/chat/ChatUninviteFromRoom.java b/src/network/packets/swg/zone/chat/ChatUninviteFromRoom.java deleted file mode 100644 index 798255cce..000000000 --- a/src/network/packets/swg/zone/chat/ChatUninviteFromRoom.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatAvatar; - -/** - * @author Waverunner - */ -public class ChatUninviteFromRoom extends SWGPacket { - public static final int CRC = getCrc("ChatUninviteFromRoom"); - - private ChatAvatar avatar; - private String room; - private int sequence; - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - avatar = data.getEncodable(ChatAvatar.class); - room = data.getAscii(); - sequence = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(12 + avatar.encode().length + room.length()); - data.addShort(4); - data.addInt(CRC); - data.addEncodable(avatar); - data.addAscii(room); - data.addInt(sequence); - return data; - } - - public ChatAvatar getAvatar() { - return avatar; - } - - public String getRoom() { - return room; - } - - public int getSequence() { - return sequence; - } -} diff --git a/src/network/packets/swg/zone/chat/ConGenericMessage.java b/src/network/packets/swg/zone/chat/ConGenericMessage.java deleted file mode 100644 index 486159eae..000000000 --- a/src/network/packets/swg/zone/chat/ConGenericMessage.java +++ /dev/null @@ -1,69 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ConGenericMessage extends SWGPacket { - public static final int CRC = getCrc("ConGenericMessage"); - - private String message; - - public ConGenericMessage() { - this(""); - } - - public ConGenericMessage(String message) { - this.message = message; - } - - public ConGenericMessage(NetBuffer data) { - decode(data); - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - message = data.getAscii(); - data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(8 + message.length()); - data.addShort(3); - data.addInt(CRC); - data.addAscii(message); - data.addInt(0); - return data; - } - -} diff --git a/src/network/packets/swg/zone/chat/VoiceChatStatus.java b/src/network/packets/swg/zone/chat/VoiceChatStatus.java deleted file mode 100644 index 8e2669687..000000000 --- a/src/network/packets/swg/zone/chat/VoiceChatStatus.java +++ /dev/null @@ -1,60 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.chat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class VoiceChatStatus extends SWGPacket { - - public static final int CRC = 0x9E601905; - - public VoiceChatStatus() { - - } - - public VoiceChatStatus(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - data.getInt(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(10); - data.addShort(2); - data.addInt(CRC); - data.addInt(1); - return data; - } - -} diff --git a/src/network/packets/swg/zone/combat/GrantCommandMessage.java b/src/network/packets/swg/zone/combat/GrantCommandMessage.java deleted file mode 100644 index 040ae9e92..000000000 --- a/src/network/packets/swg/zone/combat/GrantCommandMessage.java +++ /dev/null @@ -1,74 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.combat; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class GrantCommandMessage extends SWGPacket { - - public static final int CRC = 0xE67E3875; - - private String command; - - public GrantCommandMessage() { - command = ""; - } - - public GrantCommandMessage(String command) { - this.command = command; - } - - public GrantCommandMessage(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - this.command = data.getAscii(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(8 + command.length()); - data.addShort(2); - data.addInt(CRC); - data.addAscii(command); - return data; - } - - public String getCommand() { - return command; - } - - public void setCommand(String command) { - this.command = command; - } - -} diff --git a/src/network/packets/swg/zone/crafting/resources/ResourceListForSurveyMessage.java b/src/network/packets/swg/zone/crafting/resources/ResourceListForSurveyMessage.java deleted file mode 100644 index adb9ffe93..000000000 --- a/src/network/packets/swg/zone/crafting/resources/ResourceListForSurveyMessage.java +++ /dev/null @@ -1,174 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.crafting.resources; - -import java.util.ArrayList; -import java.util.List; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ResourceListForSurveyMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("ResourceListForSurveyMessage"); - - private final List resources; - - private String resourceType; - private long creatureId; - - public ResourceListForSurveyMessage(long creatureId, String resourceType) { - this.resources = new ArrayList<>(); - this.creatureId = creatureId; - this.resourceType = resourceType; - } - - public ResourceListForSurveyMessage(NetBuffer data) { - this.resources = new ArrayList<>(); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - int resourceSize = data.getInt(); - for (int i = 0; i < resourceSize; i++) { - resources.add(ResourceItem.decode(data)); - } - resourceType = data.getAscii(); - creatureId = data.getLong(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(getLength()); - data.addShort(4); - data.addInt(CRC); - data.addInt(resources.size()); - for (ResourceItem item : resources) { - ResourceItem.encode(data, item); - } - data.addAscii(resourceType); - data.addLong(creatureId); - return data; - } - - public List getResources() { - return resources; - } - - public String getResourceType() { - return resourceType; - } - - public long getCreatureId() { - return creatureId; - } - - public void addResource(ResourceItem item) { - resources.add(item); - } - - public void removeResource(ResourceItem item) { - resources.remove(item); - } - - public void setResourceType(String resourceType) { - this.resourceType = resourceType; - } - - public void setCreatureId(long creatureId) { - this.creatureId = creatureId; - } - - private int getLength() { - int length = 20 + resourceType.length(); - for (ResourceItem item : resources) - length += item.getLength(); - return length; - } - - public static class ResourceItem { - - private final String resourceName; - private final String resourceClass; - private final long resourceId; - - public ResourceItem(String resourceName, String resourceClass, long resourceId) { - this.resourceName = resourceName; - this.resourceClass = resourceClass; - this.resourceId = resourceId; - } - - public String getResourceName() { - return resourceName; - } - - public String getResourceClass() { - return resourceClass; - } - - public long getResourceId() { - return resourceId; - } - - public int getLength() { - return 12 + resourceName.length() + resourceClass.length(); - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof ResourceItem)) - return false; - ResourceItem item = (ResourceItem) o; - return item.resourceName.equals(resourceName) && item.resourceClass.equals(resourceClass) && item.resourceId == resourceId; - } - - @Override - public int hashCode() { - return Long.hashCode(resourceId) * 7 + resourceName.hashCode() * 3 + resourceClass.hashCode(); - } - - public static void encode(NetBuffer buffer, ResourceItem item) { - buffer.addAscii(item.getResourceName()); - buffer.addLong(item.getResourceId()); - buffer.addAscii(item.getResourceClass()); - } - - public static ResourceItem decode(NetBuffer buffer) { - String resourceName = buffer.getAscii(); - long resourceId = buffer.getLong(); - String resourceClass = buffer.getAscii(); - return new ResourceItem(resourceName, resourceClass, resourceId); - } - - } - -} diff --git a/src/network/packets/swg/zone/crafting/surveying/SurveyMessage.java b/src/network/packets/swg/zone/crafting/surveying/SurveyMessage.java deleted file mode 100644 index 62082c70c..000000000 --- a/src/network/packets/swg/zone/crafting/surveying/SurveyMessage.java +++ /dev/null @@ -1,131 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.crafting.surveying; - -import java.util.ArrayList; -import java.util.List; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class SurveyMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("SurveyMessage"); - - private final List concentrations; - - public SurveyMessage() { - this.concentrations = new ArrayList<>(); - } - - public SurveyMessage(NetBuffer data) { - this.concentrations = new ArrayList<>(); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - int pointAmounts = data.getInt(); - for (int i = 0; i < pointAmounts; i++) { - float x = data.getFloat(); - data.getFloat(); - float z = data.getFloat(); - float concentration = data.getFloat(); - concentrations.add(new ResourceConcentration(x, z, concentration)); - } - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(getLength()); - data.addShort(2); - data.addInt(CRC); - data.addInt(concentrations.size()); - for (ResourceConcentration rc : concentrations) { - data.addFloat((float) rc.getX()); - data.addFloat(0); - data.addFloat((float) rc.getZ()); - data.addFloat((float) rc.getConcentration()); - } - return data; - } - - private int getLength() { - return 10 + concentrations.size() * 16; - } - - public List getConcentrations() { - return concentrations; - } - - public void addConcentration(ResourceConcentration rc) { - concentrations.add(rc); - } - - public void removeConcentration(ResourceConcentration rc) { - concentrations.remove(rc); - } - - public static class ResourceConcentration { - - private final double x; - private final double z; - private final double concentration; - - public ResourceConcentration(double x, double z, double concentration) { - this.x = x; - this.z = z; - this.concentration = concentration; - } - - public double getX() { - return x; - } - - public double getZ() { - return z; - } - - public double getConcentration() { - return concentration; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof ResourceConcentration)) - return false; - ResourceConcentration rc = (ResourceConcentration) o; - return rc.x == x && rc.z == z && rc.concentration == concentration; - } - - } - -} diff --git a/src/network/packets/swg/zone/deltas/DeltasMessage.java b/src/network/packets/swg/zone/deltas/DeltasMessage.java deleted file mode 100644 index 4961c2d8b..000000000 --- a/src/network/packets/swg/zone/deltas/DeltasMessage.java +++ /dev/null @@ -1,132 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.deltas; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import network.packets.swg.zone.baselines.Baseline.BaselineType; - -public class DeltasMessage extends SWGPacket { - - public static final int CRC = getCrc("DeltasMessage"); - - private long objId; - private BaselineType type; - private int num; - private byte[] deltaData; - private int update; - - public DeltasMessage() { - - } - - public DeltasMessage(long objId, BaselineType type, int typeNumber, int update, byte[] data) { - this.objId = objId; - this.type = type; - this.update = update; - this.num = typeNumber; - this.deltaData = data; - } - - public DeltasMessage(NetBuffer data) { - decode(data); - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - objId = data.getLong(); - type = BaselineType.valueOf(reverse(new String(data.getArray(4), ascii))); - num = data.getByte(); - NetBuffer deltaDataBuffer = NetBuffer.wrap(data.getArrayLarge()); - deltaDataBuffer.getShort(); - update = deltaDataBuffer.getShort(); - deltaData = deltaDataBuffer.getArray(deltaDataBuffer.remaining()); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(27 + deltaData.length); - data.addShort(5); - data.addInt(CRC); - data.addLong(objId); - data.addRawArray(reverse(type.toString()).getBytes(ascii)); - data.addByte(num); - data.addInt(deltaData.length + 4); - data.addShort(1); // updates - only 1 cause we're boring - data.addShort(update); - data.addRawArray(deltaData); - return data; - } - - public long getObjectId() { - return objId; - } - - public BaselineType getType() { - return type; - } - - public int getNum() { - return num; - } - - public int getUpdate() { - return update; - } - - public byte[] getDeltaData() { - return deltaData; - } - - public void setType(BaselineType type) { - this.type = type; - } - - public void setNum(int num) { - this.num = num; - } - - public void setId(long id) { - this.objId = id; - } - - public void setData(byte[] data) { - this.deltaData = data; - } - - public void setUpdate(int update) { - this.update = update; - } - - private String reverse(String str) { - return new StringBuffer(str).reverse().toString(); - } -} diff --git a/src/network/packets/swg/zone/harvesters/ResourceHarvesterActivatePageMessage.java b/src/network/packets/swg/zone/harvesters/ResourceHarvesterActivatePageMessage.java deleted file mode 100644 index 74103137d..000000000 --- a/src/network/packets/swg/zone/harvesters/ResourceHarvesterActivatePageMessage.java +++ /dev/null @@ -1,39 +0,0 @@ -package network.packets.swg.zone.harvesters; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ResourceHarvesterActivatePageMessage extends SWGPacket { - public static final int CRC = getCrc("ResourceHarvesterActivatePageMessage"); - - private long harvesterId; - - public ResourceHarvesterActivatePageMessage(long harvesterId) { - this.harvesterId = harvesterId; - } - - public ResourceHarvesterActivatePageMessage(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - harvesterId = data.getLong(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(8); - data.addLong(harvesterId); - return data; - } - - public long getHarvesterId() { - return harvesterId; - } - - public void setHarvesterId(long harvesterId) { - this.harvesterId = harvesterId; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/insertion/ChatRoomList.java b/src/network/packets/swg/zone/insertion/ChatRoomList.java deleted file mode 100644 index ef836d9f2..000000000 --- a/src/network/packets/swg/zone/insertion/ChatRoomList.java +++ /dev/null @@ -1,86 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.insertion; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.chat.ChatRoom; - -public class ChatRoomList extends SWGPacket { - - public static final int CRC = getCrc("ChatRoomList"); - - private Collection rooms; - - public ChatRoomList() { - this.rooms = new ArrayList<>(); - } - - public ChatRoomList(ChatRoom... rooms) { - this.rooms = Arrays.asList(rooms); - } - - public ChatRoomList(Collection rooms) { - this.rooms = rooms; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - rooms = data.getList(ChatRoom.class); - } - - @Override - public NetBuffer encode() { - int length = 10; - for (ChatRoom r : rooms) { - length += r.getLength(); - } - NetBuffer data = NetBuffer.allocate(length); - data.addShort(2); - data.addInt(CRC); - data.addList(rooms); - return data; - } - - public Collection getRooms() { - return rooms; - } - - @Override - public String toString() { - return "ChatRoomList[roomSize=" + rooms.size() + "]"; - } - -} diff --git a/src/network/packets/swg/zone/insertion/ChatServerStatus.java b/src/network/packets/swg/zone/insertion/ChatServerStatus.java deleted file mode 100644 index 08299f293..000000000 --- a/src/network/packets/swg/zone/insertion/ChatServerStatus.java +++ /dev/null @@ -1,61 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.insertion; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ChatServerStatus extends SWGPacket { - public static final int CRC = getCrc("ChatServerStatus"); - - private boolean online = false; - - public ChatServerStatus() { - - } - - public ChatServerStatus(boolean online) { - this.online = online; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - online = data.getBoolean(); - } - - public NetBuffer encode() { - int length = 7; - NetBuffer data = NetBuffer.allocate(length); - data.addShort(2); - data.addInt(CRC); - data.addBoolean(online); - return data; - } -} diff --git a/src/network/packets/swg/zone/insertion/CmdStartScene.java b/src/network/packets/swg/zone/insertion/CmdStartScene.java deleted file mode 100644 index 8de91c400..000000000 --- a/src/network/packets/swg/zone/insertion/CmdStartScene.java +++ /dev/null @@ -1,116 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.insertion; - -import com.projectswg.common.data.location.Location; -import com.projectswg.common.data.location.Terrain; -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.Race; - -public class CmdStartScene extends SWGPacket { - public static final int CRC = getCrc("CmdStartScene"); - - private boolean ignoreLayoutFiles; - private long charId; - private Race race; - private Location l; - private long galacticTime; - private int serverEpoch; - - public CmdStartScene() { - ignoreLayoutFiles = false; - charId = 0; - race = Race.HUMAN_MALE; - l = new Location(); - galacticTime = 0; - serverEpoch = 0; - } - - public CmdStartScene(boolean ignoreLayoutFiles, long charId, Race race, Location l, long galacticTime, int serverEpoch) { - this.ignoreLayoutFiles = ignoreLayoutFiles; - this.charId = charId; - this.race = race; - this.l = l; - this.galacticTime = galacticTime; - this.serverEpoch = serverEpoch; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - ignoreLayoutFiles = data.getBoolean(); - charId = data.getLong(); - String ter = data.getAscii(); - l.setTerrain(null); - for (Terrain t : Terrain.values()) - if (t.getFile().equals(ter)) - l.setTerrain(t); - l.setX(data.getFloat()); - l.setY(data.getFloat()); - l.setZ(data.getFloat()); - l.setHeading(data.getFloat()); - race = Race.getRaceByFile(data.getAscii()); - galacticTime = data.getLong(); - serverEpoch = data.getInt(); - } - - @Override - public NetBuffer encode() { - int length = 47 + l.getTerrain().getFile().length() + race.getFilename().length(); - NetBuffer data = NetBuffer.allocate(length); - data.addShort(2); - data.addInt(CRC); - data.addBoolean(ignoreLayoutFiles); - data.addLong(charId); - data.addAscii(l.getTerrain().getFile()); - data.addFloat((float) l.getX()); - data.addFloat((float) l.getY()); - data.addFloat((float) l.getZ()); - data.addFloat((float) l.getYaw()); - data.addAscii(race.getFilename()); - data.addLong(galacticTime); - data.addInt(serverEpoch); - return data; - } - - public long getCharacterId() { return charId; } - public Location getLocation() { return l; } - public Race getRace() { return race; } - public long getGalacticTime() { return galacticTime; } - public int getServerEpoch() { return serverEpoch; } - - public void setCharacterId(long id) { this.charId = id; } - public void setLocation(Location l) { this.l = l; } - public void setRace(Race r) { this.race = r; } - public void setGalacticTime(long time) { this.galacticTime = time; } - public void setServerEpoch(int epoch) { this.serverEpoch = epoch; } - -} diff --git a/src/network/packets/swg/zone/insertion/ConnectPlayerMessage.java b/src/network/packets/swg/zone/insertion/ConnectPlayerMessage.java deleted file mode 100644 index 091a6294a..000000000 --- a/src/network/packets/swg/zone/insertion/ConnectPlayerMessage.java +++ /dev/null @@ -1,57 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.insertion; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class ConnectPlayerMessage extends SWGPacket { - public static final int CRC = getCrc("ConnectPlayerMessage"); - - private int stationId = 0; - - public ConnectPlayerMessage() { - - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - stationId = data.getInt(); - } - - public NetBuffer encode() { - int length = 10; - NetBuffer data = NetBuffer.allocate(length); - data.addShort(2); - data.addInt(CRC); - data.addInt(stationId); // stationId that's sent when using auto-login - return data; - } -} diff --git a/src/network/packets/swg/zone/insertion/SelectCharacter.java b/src/network/packets/swg/zone/insertion/SelectCharacter.java deleted file mode 100644 index e462d8394..000000000 --- a/src/network/packets/swg/zone/insertion/SelectCharacter.java +++ /dev/null @@ -1,62 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.insertion; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class SelectCharacter extends SWGPacket { - public static final int CRC = getCrc("SelectCharacter"); - - private long charId = 0; - - public SelectCharacter() { - - } - - public SelectCharacter(long id) { - this.charId = id; - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - charId = data.getLong(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(14); - data.addShort(2); - data.addInt(CRC); - data.addLong(charId); - return data; - } - - public long getCharacterId() { return charId; } -} diff --git a/src/network/packets/swg/zone/object_controller/Animation.java b/src/network/packets/swg/zone/object_controller/Animation.java deleted file mode 100644 index abcbbe4f1..000000000 --- a/src/network/packets/swg/zone/object_controller/Animation.java +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class Animation extends ObjectController { - - public static final int CRC = 0x00F2; - - private String animation; - - public Animation(long objectId, String animation) { - super(objectId, CRC); - this.animation = animation; - } - - public Animation(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - animation = data.getAscii(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 2 + animation.length()); - encodeHeader(data); - data.addAscii(animation); - return data; - } -} - diff --git a/src/network/packets/swg/zone/object_controller/BiographyUpdate.java b/src/network/packets/swg/zone/object_controller/BiographyUpdate.java deleted file mode 100644 index fd438fc2c..000000000 --- a/src/network/packets/swg/zone/object_controller/BiographyUpdate.java +++ /dev/null @@ -1,76 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class BiographyUpdate extends ObjectController { - - public static final int CRC = 0x01DB; - - private long targetId; - private String biography; - - public BiographyUpdate(long objectId, long targetId, String biography) { - super(objectId, CRC); - setTargetId(targetId); - setBiography(biography); - } - - public BiographyUpdate(NetBuffer data) { - super(CRC); - decode(data); - } - - public void decode(NetBuffer data) { - decodeHeader(data); - targetId = data.getLong(); - biography = data.getUnicode(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + Long.BYTES + Integer.BYTES + biography.length() * 2); - encodeHeader(data); - data.addLong(targetId); - data.addUnicode(biography); - return data; - } - - public long getTargetId() { return targetId; } - - public void setTargetId(long targetId) { this.targetId = targetId; } - - public String getBiography() { - return biography; - } - - public void setBiography(String biography) { - this.biography = biography; - } - -} diff --git a/src/network/packets/swg/zone/object_controller/ChangeRoleIconChoice.java b/src/network/packets/swg/zone/object_controller/ChangeRoleIconChoice.java deleted file mode 100644 index 75064f910..000000000 --- a/src/network/packets/swg/zone/object_controller/ChangeRoleIconChoice.java +++ /dev/null @@ -1,70 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class ChangeRoleIconChoice extends ObjectController { - - public static final int CRC = 0x044D; - - private int iconChoice; - - public ChangeRoleIconChoice(long objectId) { - super(objectId, CRC); - } - - public ChangeRoleIconChoice(NetBuffer data) { - super(CRC); - decode(data); - } - - public ChangeRoleIconChoice(long objectId, int iconChoice) { - super(objectId, CRC); - this.iconChoice = iconChoice; - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - iconChoice = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + Integer.BYTES); - encodeHeader(data); - data.addInt(iconChoice); - return data; - } - - public int getIconChoice() { - return iconChoice; - } - -} diff --git a/src/network/packets/swg/zone/object_controller/CommandQueueDequeue.java b/src/network/packets/swg/zone/object_controller/CommandQueueDequeue.java deleted file mode 100644 index 04bd1ceb3..000000000 --- a/src/network/packets/swg/zone/object_controller/CommandQueueDequeue.java +++ /dev/null @@ -1,79 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - - -public class CommandQueueDequeue extends ObjectController { - - public static final int CRC = 0x0117; - - private int counter; - private float timer; - private int error; - private int action; - - public CommandQueueDequeue(long objectId) { - super(objectId, CRC); - } - - public CommandQueueDequeue(NetBuffer data) { - super(CRC); - decode(data); - } - - public void decode(NetBuffer data) { - decodeHeader(data); - counter = data.getInt(); - timer = data.getFloat(); - error = data.getInt(); - action = data.getInt(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 16); - encodeHeader(data); - data.addInt(counter); - data.addFloat(timer); - data.addInt(error); - data.addInt(action); - return data; - } - - public int getCounter() { return counter; } - public float getTimer() { return timer; } - public int getError() { return error; } - public int getAction() { return action; } - - public void setCounter(int counter) { this.counter = counter; } - public void setTimer(float timer) { this.timer = timer; } - public void setError(int error) { this.error = error; } - public void setAction(int action) { this.action = action; } - -} diff --git a/src/network/packets/swg/zone/object_controller/CommandQueueEnqueue.java b/src/network/packets/swg/zone/object_controller/CommandQueueEnqueue.java deleted file mode 100644 index 0ce8e646b..000000000 --- a/src/network/packets/swg/zone/object_controller/CommandQueueEnqueue.java +++ /dev/null @@ -1,83 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - - -public class CommandQueueEnqueue extends ObjectController { - - public static final int CRC = 0x0116; - - private int counter = 0; - private int crc = 0; - private long targetId = 0; - private String arguments = ""; - - public CommandQueueEnqueue(long objectId, int counter, int crc, long targetId, String arguments) { - super(objectId, CRC); - this.counter = counter; - this.crc = crc; - this.targetId = targetId; - this.arguments = arguments; - } - - public CommandQueueEnqueue(NetBuffer data) { - super(CRC); - decode(data); - } - - public void decode(NetBuffer data) { - decodeHeader(data); - counter = data.getInt(); - crc = data.getInt(); - targetId = data.getLong(); - arguments = data.getUnicode(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 20 + arguments.length()*2); - encodeHeader(data); - data.addInt(counter); - data.addInt(crc); - data.addLong(targetId); - data.addUnicode(arguments); - return data; - } - - public int getCounter() { return counter; } - public int getCommandCrc() { return crc; } - public String getArguments() { return arguments; } - public long getTargetId() { return targetId; } - - public void setCounter(int counter) { this.counter = counter; } - public void setCommandCrc(int crc) { this.crc = crc; } - public void setArguments(String args) { this.arguments = args; } - public void setTargetId(long targetId) { this.targetId = targetId; } - -} diff --git a/src/network/packets/swg/zone/object_controller/CommandTimer.java b/src/network/packets/swg/zone/object_controller/CommandTimer.java deleted file mode 100644 index e2d6523ef..000000000 --- a/src/network/packets/swg/zone/object_controller/CommandTimer.java +++ /dev/null @@ -1,110 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - - -public class CommandTimer extends ObjectController { - - public static final int CRC = 0x0448; - - private int sequenceId; - private int commandNameCrc; - private int cooldownGroupCrc; - private float cooldownMin; - private float cooldownMax; - - public CommandTimer(long objectId) { - super(objectId, CRC); - } - - public CommandTimer(NetBuffer data) { - super(CRC); - decode(data); - } - - public void decode(NetBuffer data) { - decodeHeader(data); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 29); - encodeHeader(data); - data.addByte(4); // 0 for no cooldown, 0x26 to add defaultTime (usually 0.25) - data.addInt(sequenceId); - data.addInt(0); // Unknown - data.addInt(0); // Unknown - data.addInt(commandNameCrc); - data.addInt(cooldownGroupCrc); - data.addFloat(cooldownMin); - data.addFloat(cooldownMax); - return data; - } - - public int getSequenceId() { - return sequenceId; - } - - public void setSequenceId(int sequenceId) { - this.sequenceId = sequenceId; - } - - public int getCommandNameCrc() { - return commandNameCrc; - } - - public void setCommandNameCrc(int commandNameCrc) { - this.commandNameCrc = commandNameCrc; - } - - public int getCooldownGroupCrc() { - return cooldownGroupCrc; - } - - public void setCooldownGroupCrc(int cooldownGroupCrc) { - this.cooldownGroupCrc = cooldownGroupCrc; - } - - public float getCooldownMin() { - return cooldownMin; - } - - public void setCooldownMin(float cooldownMin) { - this.cooldownMin = cooldownMin; - } - - public float getCooldownMax() { - return cooldownMax; - } - - public void setCooldownMax(float cooldownMax) { - this.cooldownMax = cooldownMax; - } - -} diff --git a/src/network/packets/swg/zone/object_controller/CraftAcknowledge.java b/src/network/packets/swg/zone/object_controller/CraftAcknowledge.java deleted file mode 100644 index 66600fe38..000000000 --- a/src/network/packets/swg/zone/object_controller/CraftAcknowledge.java +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class CraftAcknowledge extends ObjectController { - - public static final int CRC = 0x010C; - - private int acknowledgeId; - private int errorId; - private byte updateCounter; - - public CraftAcknowledge(int acknowledgeId, int errorId, byte updateCounter) { - super(CRC); - this.acknowledgeId = acknowledgeId; - this.errorId = errorId; - this.updateCounter = updateCounter; - } - - public CraftAcknowledge(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - acknowledgeId = data.getInt(); - errorId = data.getInt(); - updateCounter = data.getByte(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 9); - encodeHeader(data); - data.addInt(acknowledgeId); - data.addInt(errorId); - data.addByte(updateCounter); - return data; - } - - public int getAcknowledgeId() { - return acknowledgeId; - } - - public void setAcknowledgeId(int acknowledgeId) { - this.acknowledgeId = acknowledgeId; - } - - public int getErrorId() { - return errorId; - } - - public void setErrorId(int errorId) { - this.errorId = errorId; - } - - public byte getUpdateCounter() { - return updateCounter; - } - - public void setUpdateCounter(byte updateCounter) { - this.updateCounter = updateCounter; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/object_controller/CraftExperimentationResponse.java b/src/network/packets/swg/zone/object_controller/CraftExperimentationResponse.java deleted file mode 100644 index 44df601ec..000000000 --- a/src/network/packets/swg/zone/object_controller/CraftExperimentationResponse.java +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class CraftExperimentationResponse extends ObjectController{ - - public static final int CRC = 0x0113; - - private int acknowledgeId; - private int stringId; - private byte staleFlag; - - public CraftExperimentationResponse(int acknowledgeId, int stringId, byte staleFlag) { - super(CRC); - this.acknowledgeId = acknowledgeId; - this.stringId = stringId; - this.staleFlag = staleFlag; - } - - public CraftExperimentationResponse(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - acknowledgeId = data.getInt(); - stringId = data.getInt(); - staleFlag = data.getByte(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 9); - encodeHeader(data); - data.addInt(acknowledgeId); - data.addInt(stringId); - data.addByte(staleFlag); - return data; - } - - public int getAcknowledgeId() { - return acknowledgeId; - } - - public void setAcknowledgeId(int acknowledgeId) { - this.acknowledgeId = acknowledgeId; - } - - public int getStringId() { - return stringId; - } - - public void setStringId(int stringId) { - this.stringId = stringId; - } - - public byte getStaleFlag() { - return staleFlag; - } - - public void setStaleFlag(byte staleFlag) { - this.staleFlag = staleFlag; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/object_controller/CraftingSessionEnded.java b/src/network/packets/swg/zone/object_controller/CraftingSessionEnded.java deleted file mode 100644 index d899cc90d..000000000 --- a/src/network/packets/swg/zone/object_controller/CraftingSessionEnded.java +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class CraftingSessionEnded extends ObjectController{ - - public static final int CRC = 0x01C2; - - private long playerId; //crafterId - private int sessionId; //sessionId, must be 0 after the Craftingsession - private byte count; //Itemcount created in that Session - - public CraftingSessionEnded(long playerId, int sessionId, byte count) { - super(CRC); - this.playerId = playerId; - this.sessionId = sessionId; - this.count = count; - } - - public CraftingSessionEnded(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - playerId = data.getLong(); - sessionId = data.getInt(); - count = data.getByte(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 13); - encodeHeader(data); - data.addLong(playerId); - data.addInt(sessionId); - data.addByte(count); - return data; - } - - public long getPlayerId() { - return playerId; - } - - public void setPlayerId(long playerId) { - this.playerId = playerId; - } - - public int getSessionId() { - return sessionId; - } - - public void setSessionId(int sessionId) { - this.sessionId = sessionId; - } - - public byte getCount() { - return count; - } - - public void setCount(byte count) { - this.count = count; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/object_controller/DataTransform.java b/src/network/packets/swg/zone/object_controller/DataTransform.java deleted file mode 100644 index cd7cce37c..000000000 --- a/src/network/packets/swg/zone/object_controller/DataTransform.java +++ /dev/null @@ -1,162 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.data.location.Location; -import com.projectswg.common.network.NetBuffer; - -public class DataTransform extends ObjectController { - - public static final int CRC = 0x0071; - - private int timestamp; - private int updateCounter = 0; - private Location l; - private float speed = 0; - private float lookAtYaw = 0; - private boolean useLookAtYaw; - - public DataTransform(long objectId) { - super(objectId, CRC); - } - - public DataTransform(DataTransform transform) { - super(transform.getObjectId(), CRC); - timestamp = transform.getTimestamp(); - updateCounter = transform.getUpdateCounter(); - l = new Location(transform.getLocation()); - speed = transform.getSpeed(); - lookAtYaw = transform.getLookAtYaw(); - useLookAtYaw = transform.isUseLookAtYaw(); - } - - public DataTransform(long objectId, int counter, Location l, float speed) { - super(objectId, CRC); - if (l == null) - l = new Location(); - this.l = l; - this.speed = speed; - this.updateCounter = counter; - } - - public DataTransform(NetBuffer data) { - super(CRC); - this.l = new Location(); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - timestamp = data.getInt(); - updateCounter = data.getInt(); - l = data.getEncodable(Location.class); - speed = data.getFloat(); - lookAtYaw = data.getFloat(); - useLookAtYaw = data.getBoolean(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 45); - encodeHeader(data); - data.addInt(timestamp); - data.addInt(updateCounter); - data.addEncodable(l); - data.addFloat(speed); - data.addFloat(lookAtYaw); - data.addBoolean(useLookAtYaw); - return data; - } - - public void setTimestamp(int timestamp) { - this.timestamp = timestamp; - } - - public void setUpdateCounter(int counter) { - this.updateCounter = counter; - } - - public void setLocation(Location l) { - this.l = l; - } - - public void setSpeed(float speed) { - this.speed = speed; - } - - public int getUpdateCounter() { - return updateCounter; - } - - public Location getLocation() { - return l; - } - - public float getSpeed() { - return speed; - } - - public boolean isUseLookAtYaw() { - return useLookAtYaw; - } - - public void setUseLookAtYaw(boolean useLookAtYaw) { - this.useLookAtYaw = useLookAtYaw; - } - - public float getLookAtYaw() { - return lookAtYaw; - } - - public void setLookAtYaw(float lookAtYaw) { - this.lookAtYaw = lookAtYaw; - } - - public int getTimestamp() { - return timestamp; - } - - public byte getMovementAngle() { - byte movementAngle = (byte) 0.0f; - double wOrient = l.getOrientationW(); - double yOrient = l.getOrientationY(); - double sq = Math.sqrt(1 - (wOrient * wOrient)); - - if (sq != 0) { - if (l.getOrientationW() > 0 && l.getOrientationY() < 0) { - wOrient *= -1; - yOrient *= -1; - } - movementAngle = (byte) ((yOrient / sq) * (2 * Math.acos(wOrient) / 0.06283f)); - } - - return movementAngle; - } - -} diff --git a/src/network/packets/swg/zone/object_controller/DataTransformWithParent.java b/src/network/packets/swg/zone/object_controller/DataTransformWithParent.java deleted file mode 100644 index a3a77cc34..000000000 --- a/src/network/packets/swg/zone/object_controller/DataTransformWithParent.java +++ /dev/null @@ -1,144 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.object_controller; - - -import com.projectswg.common.data.location.Location; -import com.projectswg.common.network.NetBuffer; - -public class DataTransformWithParent extends ObjectController { - - public static final int CRC = 0x00F1; - - private int timestamp; - private int counter; - private long cellId; - private Location l; - private float speed; - private float lookAtYaw; - private boolean useLookAtYaw; - - public DataTransformWithParent(long objectId) { - super(objectId, CRC); - } - - public DataTransformWithParent(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - timestamp = data.getInt(); // Timestamp - counter = data.getInt(); - cellId = data.getLong(); - l = data.getEncodable(Location.class); - speed = data.getFloat(); - lookAtYaw = data.getFloat(); - useLookAtYaw = data.getBoolean(); - } - - @Override - public NetBuffer encode() { - return null; - } - - public void setUpdateCounter(int counter) { - this.counter = counter; - } - - public void setTimestamp(int timestamp) { - this.timestamp = timestamp; - } - - public void setCellId(long cellId) { - this.cellId = cellId; - } - - public void setLocation(Location l) { - this.l = l; - } - - public void setSpeed(float speed) { - this.speed = speed; - } - - public void setLookAtYaw(float lookAtYaw) { - this.lookAtYaw = lookAtYaw; - } - - public void setUseLookAtYaw(boolean useLookAtYaw) { - this.useLookAtYaw = useLookAtYaw; - } - - public int getUpdateCounter() { - return counter; - } - - public long getCellId() { - return cellId; - } - - public Location getLocation() { - return l; - } - - public float getSpeed() { - return speed; - } - - public float getLookAtYaw() { - return lookAtYaw; - } - - public boolean isUseLookAtYaw() { - return useLookAtYaw; - } - - public int getTimestamp() { - return timestamp; - } - - public byte getMovementAngle() { - byte movementAngle = (byte) 0.0f; - double wOrient = l.getOrientationW(); - double yOrient = l.getOrientationY(); - double sq = Math.sqrt(1 - (wOrient * wOrient)); - - if (sq != 0) { - if (l.getOrientationW() > 0 && l.getOrientationY() < 0) { - wOrient *= -1; - yOrient *= -1; - } - movementAngle = (byte) ((yOrient / sq) * (2 * Math.acos(wOrient) / 0.06283f)); - } - - return movementAngle; - } -} diff --git a/src/network/packets/swg/zone/object_controller/IntendedTarget.java b/src/network/packets/swg/zone/object_controller/IntendedTarget.java deleted file mode 100644 index 33c87d898..000000000 --- a/src/network/packets/swg/zone/object_controller/IntendedTarget.java +++ /dev/null @@ -1,64 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class IntendedTarget extends ObjectController { - - public static final int CRC = 0x04C5; - - private long targetId; - - public IntendedTarget(long objectId, long targetId) { - super(objectId, CRC); - setTargetId(targetId); - } - - public IntendedTarget(NetBuffer data) { - super(CRC); - decode(data); - } - - public void decode(NetBuffer data) { - decodeHeader(data); - targetId = data.getLong(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 2); - encodeHeader(data); - data.addLong(targetId); - return data; - } - - public long getTargetId() { return targetId; } - - public void setTargetId(long targetId) { this.targetId = targetId; } - -} diff --git a/src/network/packets/swg/zone/object_controller/JTLTerminalSharedMessage.java b/src/network/packets/swg/zone/object_controller/JTLTerminalSharedMessage.java deleted file mode 100644 index 3a66912dc..000000000 --- a/src/network/packets/swg/zone/object_controller/JTLTerminalSharedMessage.java +++ /dev/null @@ -1,48 +0,0 @@ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class JTLTerminalSharedMessage extends ObjectController { - - public static final int CRC = 0x041C; - - private int tickCount; - private long terminalId; - - public JTLTerminalSharedMessage(NetBuffer data) { - super(CRC); - } - - public int getTickCount() { - return tickCount; - } - - public void setTickCount(int tickCount) { - this.tickCount = tickCount; - } - - public long getTerminalId() { - return terminalId; - } - - public void setTerminalId(long terminalId) { - this.terminalId = terminalId; - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - setTickCount(data.getInt()); - setTerminalId(data.getLong()); - - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 12); - encodeHeader(data); - data.addInt(getTickCount()); - data.addLong(getTerminalId()); - return data; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/object_controller/JumpUpdate.java b/src/network/packets/swg/zone/object_controller/JumpUpdate.java deleted file mode 100644 index e43acc98a..000000000 --- a/src/network/packets/swg/zone/object_controller/JumpUpdate.java +++ /dev/null @@ -1,54 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class JumpUpdate extends ObjectController { - - public static final int CRC = 0x04BF; - - public JumpUpdate(long objectId) { - super(objectId, CRC); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH); - encodeHeader(data); - - return data; - } - -} diff --git a/src/network/packets/swg/zone/object_controller/LookAtTarget.java b/src/network/packets/swg/zone/object_controller/LookAtTarget.java deleted file mode 100644 index 259dffa59..000000000 --- a/src/network/packets/swg/zone/object_controller/LookAtTarget.java +++ /dev/null @@ -1,64 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class LookAtTarget extends ObjectController { - - public static final int CRC = 0x0126; - - private long targetId; - - public LookAtTarget(long objectId, long targetId) { - super(objectId, CRC); - setTargetId(targetId); - } - - public LookAtTarget(NetBuffer data) { - super(CRC); - decode(data); - } - - public void decode(NetBuffer data) { - decodeHeader(data); - targetId = data.getLong(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 2); - encodeHeader(data); - data.addLong(targetId); - return data; - } - - public long getTargetId() { return targetId; } - - public void setTargetId(long targetId) { this.targetId = targetId; } - -} diff --git a/src/network/packets/swg/zone/object_controller/MessageQueueCraftCustomization.java b/src/network/packets/swg/zone/object_controller/MessageQueueCraftCustomization.java deleted file mode 100644 index 1fc0f028e..000000000 --- a/src/network/packets/swg/zone/object_controller/MessageQueueCraftCustomization.java +++ /dev/null @@ -1,135 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class MessageQueueCraftCustomization extends ObjectController { - - public static final int CRC = 0x015A; - - private String itemName; - private byte appearenceTemplate; - private int itemAmount; - private byte count; - private int[] property; - private int[] value; - - public MessageQueueCraftCustomization(String itemName, byte appearenceTemplate, int itemAmount, byte count, int[] property, int[] value) { - super(CRC); - this.itemName = itemName; - this.appearenceTemplate = appearenceTemplate; - this.itemAmount = itemAmount; - this.count = count; - this.property = property; - this.value = value; - } - - public MessageQueueCraftCustomization(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - itemName = data.getUnicode(); - appearenceTemplate = data.getByte(); - itemAmount = data.getInt(); - count = data.getByte(); - - for(int i = 0; i < count; i++){ - property[i] = data.getInt(); - value[i] = data.getInt(); - } - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 10 + itemName.length()*2 + count * 8); - encodeHeader(data); - data.addUnicode(itemName); - data.addByte(appearenceTemplate); - data.addInt(itemAmount); - data.addByte(count); - - for(int i = 0; i < count; i++){ - data.addInt(property[i] ); - data.addInt(value[i]); - } - return data; - } - - public String getItemName() { - return itemName; - } - - public void setItemName(String itemName) { - this.itemName = itemName; - } - - public byte getAppearenceTemplate() { - return appearenceTemplate; - } - - public void setAppearenceTemplate(byte appearenceTemplate) { - this.appearenceTemplate = appearenceTemplate; - } - - public int getItemAmount() { - return itemAmount; - } - - public void setItemAmount(int itemAmount) { - this.itemAmount = itemAmount; - } - - public byte getCount() { - return count; - } - - public void setCount(byte count) { - this.count = count; - } - - public int[] getProperty() { - return property; - } - - public void setProperty(int[] property) { - this.property = property; - } - - public int[] getValue() { - return value; - } - - public void setValue(int[] value) { - this.value = value; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/object_controller/MessageQueueCraftEmptySlot.java b/src/network/packets/swg/zone/object_controller/MessageQueueCraftEmptySlot.java deleted file mode 100644 index d4c41fc7e..000000000 --- a/src/network/packets/swg/zone/object_controller/MessageQueueCraftEmptySlot.java +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class MessageQueueCraftEmptySlot extends ObjectController{ - - public static final int CRC = 0x0108; - - private int slot; - private long containerId; - private byte staleFlag; - - public MessageQueueCraftEmptySlot(int slot, long containerId, byte staleFlag) { - super(CRC); - this.slot = slot; - this.containerId = containerId; - this.staleFlag = staleFlag; - } - - public MessageQueueCraftEmptySlot(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - slot = data.getInt(); - containerId = data.getLong(); - staleFlag = data.getByte(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 13); - encodeHeader(data); - data.addInt(slot); - data.addLong(containerId); - data.addByte(staleFlag); - return data; - } - - public int getSlot() { - return slot; - } - - public void setSlot(int slot) { - this.slot = slot; - } - - public long getContainerId() { - return containerId; - } - - public void setContainerId(long containerId) { - this.containerId = containerId; - } - - public byte getStaleFlag() { - return staleFlag; - } - - public void setStaleFlag(byte staleFlag) { - this.staleFlag = staleFlag; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/object_controller/MessageQueueCraftExperiment.java b/src/network/packets/swg/zone/object_controller/MessageQueueCraftExperiment.java deleted file mode 100644 index b724d6e3a..000000000 --- a/src/network/packets/swg/zone/object_controller/MessageQueueCraftExperiment.java +++ /dev/null @@ -1,101 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class MessageQueueCraftExperiment extends ObjectController { - - public static final int CRC = 0x0106; - - private byte actionCounter; //total of points, should increase by 2 during experimentation each roll - private int statCount; //counter of stats we can eperiment on - private int[] statExperimentationAmount; //amount of Stats we will experiment on in this roll - private int[] spentPoints; //amount of spentpoints - - public MessageQueueCraftExperiment(byte actionCounter, int statCount, int[] statExperimentationAmount, int[] spentPoints) { - super(CRC); - this.actionCounter = actionCounter; - this.statCount = statCount; - this.statExperimentationAmount = statExperimentationAmount; - this.spentPoints = spentPoints; - } - public MessageQueueCraftExperiment(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - actionCounter = data.getByte(); - statCount = data.getInt(); - for(int i = 0; i < statCount; i++){ - statExperimentationAmount[i] = data.getInt(); - spentPoints[i] = data.getInt(); - } - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 5 + statCount * 8); - encodeHeader(data); - data.addByte(actionCounter); - data.addInt(statCount); - for(int i = 0; i < statCount; i++){ - data.addInt(statExperimentationAmount[i]); - data.addInt(spentPoints[i]); - } - return data; - } - - public byte getActionCounter() { - return actionCounter; - } - public void setActionCounter(byte actionCounter) { - this.actionCounter = actionCounter; - } - public int getStatCount() { - return statCount; - } - public void setStatCount(int statCount) { - this.statCount = statCount; - } - public int[] getStatExperimentationAmount() { - return statExperimentationAmount; - } - public void setStatExperimentationAmount(int[] statExperimentationAmount) { - this.statExperimentationAmount = statExperimentationAmount; - } - public int[] getSpentPoints() { - return spentPoints; - } - public void setSpentPoints(int[] spentPoints) { - this.spentPoints = spentPoints; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/object_controller/MessageQueueCraftFillSlot.java b/src/network/packets/swg/zone/object_controller/MessageQueueCraftFillSlot.java deleted file mode 100644 index b27a84ffc..000000000 --- a/src/network/packets/swg/zone/object_controller/MessageQueueCraftFillSlot.java +++ /dev/null @@ -1,105 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class MessageQueueCraftFillSlot extends ObjectController{ - - public static final int CRC = 0x0107; - - private long resourceId; - private int slotId; - private int option; - private byte sequenceId; - - public MessageQueueCraftFillSlot(long resourceId, int slotId, int option, byte sequenceId) { - super(CRC); - this.resourceId = resourceId; - this.slotId = slotId; - this.option = option; - this.sequenceId = sequenceId; - } - - public MessageQueueCraftFillSlot(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - resourceId = data.getLong(); - slotId = data.getInt(); - option = data.getInt(); - sequenceId = data.getByte(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 17 ); - encodeHeader(data); - data.addLong(resourceId); - data.addInt(slotId); - data.addInt(option); - data.addByte(sequenceId); - return data; - } - - public long getResourceId() { - return resourceId; - } - - public void setResourceId(long resourceId) { - this.resourceId = resourceId; - } - - public int getSlotId() { - return slotId; - } - - public void setSlotId(int slotId) { - this.slotId = slotId; - } - - public int getOption() { - return option; - } - - public void setOption(int option) { - this.option = option; - } - - public byte getSequenceId() { - return sequenceId; - } - - public void setSequenceId(byte sequenceId) { - this.sequenceId = sequenceId; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/object_controller/MessageQueueCraftIngredients.java b/src/network/packets/swg/zone/object_controller/MessageQueueCraftIngredients.java deleted file mode 100644 index 7c90daf78..000000000 --- a/src/network/packets/swg/zone/object_controller/MessageQueueCraftIngredients.java +++ /dev/null @@ -1,112 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class MessageQueueCraftIngredients extends ObjectController { - - public static final int CRC = 0x0105; - - private int count; - private String[] resourceName; - private byte[] type; - private int[] quantity; - - public MessageQueueCraftIngredients(int count, String[] resourceName, byte[] type, int[] quantity) { - super(); - this.count = count; - this.resourceName = resourceName; - this.type = type; - this.quantity = quantity; - } - - public MessageQueueCraftIngredients(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - count = data.getInt(); - for(int i = 0; i < count; i++){ - resourceName[i] = data.getUnicode(); - type[i] = data.getByte(); - quantity[i] = data.getInt(); - } - } - - @Override - public NetBuffer encode() { - int len = 4; - for (int i = 0; i < count; i++) - len += 9 + resourceName[i].length(); - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 4 + len); - encodeHeader(data); - data.addInt(count); - for(int i = 0; i < count; i++){ - data.addUnicode(resourceName[i] ); - data.addByte(type[i]); - data.addInt(quantity[i]); - } - return data; - } - - public int getCount() { - return count; - } - - public void setCount(int count) { - this.count = count; - } - - public String[] getResourceName() { - return resourceName; - } - - public void setResourceName(String[] resourceName) { - this.resourceName = resourceName; - } - - public byte[] getType() { - return type; - } - - public void setType(byte[] type) { - this.type = type; - } - - public int[] getQuantity() { - return quantity; - } - - public void setQuantity(int[] quantity) { - this.quantity = quantity; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/object_controller/MessageQueueCraftRequestSession.java b/src/network/packets/swg/zone/object_controller/MessageQueueCraftRequestSession.java deleted file mode 100644 index d52f29480..000000000 --- a/src/network/packets/swg/zone/object_controller/MessageQueueCraftRequestSession.java +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class MessageQueueCraftRequestSession extends ObjectController{ - - private final static int CRC = 0x010F; - - private long sessionId; //wants to create a session for this particular craftingsession - private int sequenceId; - - public MessageQueueCraftRequestSession(long sessionId, int sequenceId) { - super(CRC); - this.sessionId = sessionId; - this.sequenceId = sequenceId; - } - - public MessageQueueCraftRequestSession(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - sessionId = data.getLong(); - sequenceId = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 12); - encodeHeader(data); - data.addLong(sessionId); - data.addInt(sequenceId); - return data; - } - - public long getSessionId() { - return sessionId; - } - - public void setSessionId(long sessionId) { - this.sessionId = sessionId; - } - - public int getSequenceId() { - return sequenceId; - } - - public void setSequenceId(int sequenceId) { - this.sequenceId = sequenceId; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/object_controller/MessageQueueCraftSelectSchematic.java b/src/network/packets/swg/zone/object_controller/MessageQueueCraftSelectSchematic.java deleted file mode 100644 index 9ea9b74e3..000000000 --- a/src/network/packets/swg/zone/object_controller/MessageQueueCraftSelectSchematic.java +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class MessageQueueCraftSelectSchematic extends ObjectController { - - public static final int CRC = 0x010E; - - private int schematicId; - - public MessageQueueCraftSelectSchematic(int schematicId) { - super(CRC); - this.schematicId = schematicId; - } - - public MessageQueueCraftSelectSchematic(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - schematicId = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 4 ); - encodeHeader(data); - data.addInt(schematicId); - return data; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/object_controller/MessageQueueDraftSchematics.java b/src/network/packets/swg/zone/object_controller/MessageQueueDraftSchematics.java deleted file mode 100644 index 433bcb58a..000000000 --- a/src/network/packets/swg/zone/object_controller/MessageQueueDraftSchematics.java +++ /dev/null @@ -1,133 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class MessageQueueDraftSchematics extends ObjectController { - - private final static int CRC = 0x0102; - - private long toolId; - private long craftingStationId; - private int schematicsCounter; - private int[] schematicsId; - private int[] schematicsCrc; - private byte [][] schematicSubcategories = new byte[schematicsCounter][4]; - - public MessageQueueDraftSchematics(long toolId, long craftingStationId, int schematicsCounter, int[] schematicsId, int[] schematicsCrc, byte[][] schematicSubcategories) { - super(); - this.toolId = toolId; - this.craftingStationId = craftingStationId; - this.schematicsCounter = schematicsCounter; - this.schematicsId = schematicsId; - this.schematicsCrc = schematicsCrc; - System.arraycopy(schematicSubcategories, 0, this.schematicSubcategories, 0, 4); - } - - public MessageQueueDraftSchematics(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - toolId = data.getLong(); - craftingStationId = data.getLong(); - schematicsCounter = data.getInt(); - for(int i = 0; i < schematicsCounter; i++){ - schematicsId[i] = data.getInt(); - schematicsCrc[i] = data.getInt(); - schematicSubcategories[i] = data.getArray(4); - } - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 20 + schematicsCounter * 12 + schematicSubcategories.length); - encodeHeader(data); - data.addLong(toolId); - data.addLong(craftingStationId); - data.addInt(schematicsCounter); - for(int i = 0; i< schematicsCounter; i++){ - data.addInt(schematicsId[i]); - data.addInt(schematicsCrc[i]); - data.addRawArray(schematicSubcategories[i]); - } - return data; - } - - public long getToolId() { - return toolId; - } - - public void setToolId(long toolId) { - this.toolId = toolId; - } - - public long getCraftingStationId() { - return craftingStationId; - } - - public void setCraftingStationId(long craftingStationId) { - this.craftingStationId = craftingStationId; - } - - public int getSchematicsCounter() { - return schematicsCounter; - } - - public void setSchematicsCounter(int schematicsCounter) { - this.schematicsCounter = schematicsCounter; - } - - public int[] getSchematicsId() { - return schematicsId; - } - - public void setSchematicsId(int[] schematicsId) { - this.schematicsId = schematicsId; - } - - public int[] getSchematicsCrc() { - return schematicsCrc; - } - - public void setSchematicsCrc(int[] schematicsCrc) { - this.schematicsCrc = schematicsCrc; - } - - public byte[][] getSchematicSubcategories() { - return schematicSubcategories; - } - - public void setSchematicSubcategories(byte[][] schematicSubcategories) { - this.schematicSubcategories = schematicSubcategories; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/object_controller/MessageQueueHarvesterResourceData.java b/src/network/packets/swg/zone/object_controller/MessageQueueHarvesterResourceData.java deleted file mode 100644 index 817b8d4bd..000000000 --- a/src/network/packets/swg/zone/object_controller/MessageQueueHarvesterResourceData.java +++ /dev/null @@ -1,138 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class MessageQueueHarvesterResourceData extends ObjectController { - - public static final int CRC = 0x00EA; - - private long harvesterId; - private int resourceListSize; - private long[] resourceId; - private String[] resourceName; - private String[] resourceType; - private byte[] resourceDensity; - - public MessageQueueHarvesterResourceData(long harvesterId, int resourceListSize, long[] resourceId, String[] resourceName, String[] resourceType, byte[] resourceDensity) { - super(CRC); - this.harvesterId = harvesterId; - this.resourceListSize = resourceListSize; - this.resourceId = resourceId; - this.resourceName = resourceName; - this.resourceType = resourceType; - this.resourceDensity = resourceDensity; - } - - public MessageQueueHarvesterResourceData(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - harvesterId = data.getLong(); - resourceListSize = data.getInt(); - for(int i = 0; i < resourceListSize; i++){ - resourceId[i] = data.getLong(); - resourceName[i] = data.getUnicode(); - resourceType[i] = data.getUnicode(); - resourceDensity[i] = data.getByte(); - } - - } - - @Override - public NetBuffer encode() { - int len = HEADER_LENGTH + 12; - for (int i = 0; i < resourceListSize; i++) - len += 17 + resourceName[i].length() * 2 + resourceType[i].length() * 2; - NetBuffer data = NetBuffer.allocate(len); - encodeHeader(data); - data.addLong(harvesterId); - data.addInt(resourceListSize); - for(int i = 0; i < resourceListSize; i++){ - data.addLong(resourceId[i]); - data.addUnicode(resourceName[i]); - data.addUnicode(resourceType[i]); - data.addByte(resourceDensity[i]); - } - - return data; - } - - public long getHarvesterId() { - return harvesterId; - } - - public void setHarvesterId(long harvesterId) { - this.harvesterId = harvesterId; - } - - public int getResourceListSize() { - return resourceListSize; - } - - public void setResourceListSize(int resourceListSize) { - this.resourceListSize = resourceListSize; - } - - public long[] getResourceId() { - return resourceId; - } - - public void setResourceId(long[] resourceId) { - this.resourceId = resourceId; - } - - public String[] getResourceName() { - return resourceName; - } - - public void setResourceName(String[] resourceName) { - this.resourceName = resourceName; - } - - public String[] getResourceType() { - return resourceType; - } - - public void setResourceTypo(String[] resourceType) { - this.resourceType = resourceType; - } - - public byte[] getResourceDensity() { - return resourceDensity; - } - - public void setResourceDensity(byte[] resourceDensity) { - this.resourceDensity = resourceDensity; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/object_controller/MessageQueueResourceEmptyHopper.java b/src/network/packets/swg/zone/object_controller/MessageQueueResourceEmptyHopper.java deleted file mode 100644 index 08698f43a..000000000 --- a/src/network/packets/swg/zone/object_controller/MessageQueueResourceEmptyHopper.java +++ /dev/null @@ -1,117 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class MessageQueueResourceEmptyHopper extends ObjectController { - - public static final int CRC = 0x00ED; - - private long playerId; - private long harvesterId; - private int amount; - private boolean discard; - private int sequenceId; - - public MessageQueueResourceEmptyHopper(long playerId, long harvesterId, int amount, boolean discard, int sequenceId) { - super(CRC); - this.playerId = playerId; - this.harvesterId = harvesterId; - this.amount = amount; - this.discard = discard; - this.sequenceId = sequenceId; - } - - public MessageQueueResourceEmptyHopper(NetBuffer data){ - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - playerId = data.getLong(); - harvesterId = data.getLong(); - amount = data.getInt(); - discard = data.getBoolean(); - sequenceId = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 25 ); - encodeHeader(data); - data.addLong(playerId); - data.addLong(harvesterId); - data.addInt(amount); - data.addBoolean(discard); - data.addInt(sequenceId); - return data; - } - - public long getPlayerId() { - return playerId; - } - - public void setPlayerId(long playerId) { - this.playerId = playerId; - } - - public long getHarvesterId() { - return harvesterId; - } - - public void setHarvesterId(long harvesterId) { - this.harvesterId = harvesterId; - } - - public int getAmount() { - return amount; - } - - public void setAmount(int amount) { - this.amount = amount; - } - - public boolean isDiscard() { - return discard; - } - - public void setDiscard(boolean discard) { - this.discard = discard; - } - - public int getSequenceId() { - return sequenceId; - } - - public void setSequenceId(int sequenceId) { - this.sequenceId = sequenceId; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/object_controller/MessageQueueSpaceMiningSellResource.java b/src/network/packets/swg/zone/object_controller/MessageQueueSpaceMiningSellResource.java deleted file mode 100644 index 9c6b94d10..000000000 --- a/src/network/packets/swg/zone/object_controller/MessageQueueSpaceMiningSellResource.java +++ /dev/null @@ -1,105 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class MessageQueueSpaceMiningSellResource extends ObjectController{ - - public static final int CRC = 0x04B6; - - private long shipId; - private long spaceStationId; - private long resourceId; - private int amount; - - public MessageQueueSpaceMiningSellResource(long shipId, long spaceStationId, long resourceId, int amount) { - super(CRC); - this.shipId = shipId; - this.spaceStationId = spaceStationId; - this.resourceId = resourceId; - this.amount = amount; - } - - public MessageQueueSpaceMiningSellResource(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - shipId = data.getLong(); - spaceStationId = data.getLong(); - resourceId = data.getLong(); - amount = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 28 ); - encodeHeader(data); - data.addLong(shipId); - data.addLong(spaceStationId); - data.addLong(resourceId); - data.addInt(amount); - return data; - } - - public long getShipId() { - return shipId; - } - - public void setShipId(long shipId) { - this.shipId = shipId; - } - - public long getSpaceStationId() { - return spaceStationId; - } - - public void setSpaceStationId(long spaceStationId) { - this.spaceStationId = spaceStationId; - } - - public long getResourceId() { - return resourceId; - } - - public void setResourceId(long resourceId) { - this.resourceId = resourceId; - } - - public int getAmount() { - return amount; - } - - public void setAmount(int amount) { - this.amount = amount; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/object_controller/MissionListRequest.java b/src/network/packets/swg/zone/object_controller/MissionListRequest.java deleted file mode 100644 index af47dcba8..000000000 --- a/src/network/packets/swg/zone/object_controller/MissionListRequest.java +++ /dev/null @@ -1,49 +0,0 @@ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class MissionListRequest extends ObjectController{ - - public static final int CRC = 0x00F5; - - private long terminalId; - private byte tickCount; - - public MissionListRequest(NetBuffer data) { - super(CRC); - } - - public long getTerminalId() { - return terminalId; - } - - public void setTerminalId(long terminalId) { - this.terminalId = terminalId; - } - - public byte getTickCount() { - return tickCount; - } - - public void setTickCount(byte tickCount) { - this.tickCount = tickCount; - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - data.getByte(); - setTickCount(data.getByte()); - setTerminalId(data.getLong()); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 10); - encodeHeader(data); - data.addByte(0); - data.addByte(getTickCount()); - data.addLong(getTerminalId()); - return data; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/object_controller/NextCraftingStage.java b/src/network/packets/swg/zone/object_controller/NextCraftingStage.java deleted file mode 100644 index 4f9fcc269..000000000 --- a/src/network/packets/swg/zone/object_controller/NextCraftingStage.java +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class NextCraftingStage extends ObjectController{ - - public static final int CRC = 0x0109; - - private int requestId; - private int response; - private byte sequenceId; - - public NextCraftingStage(int requestId, int response, byte sequenceId) { - super(CRC); - this.requestId = requestId; - this.response = response; - this.sequenceId = sequenceId; - } - - public NextCraftingStage(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - requestId = data.getInt(); - response = data.getInt(); - sequenceId = data.getByte(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 9); - encodeHeader(data); - data.addInt(requestId); - data.addInt(response); - data.addByte(sequenceId); - return data; - } - - public int getRequestId() { - return requestId; - } - - public void setRequestId(int requestId) { - this.requestId = requestId; - } - - public int getResponse() { - return response; - } - - public void setResponse(int response) { - this.response = response; - } - - public byte getSequenceId() { - return sequenceId; - } - - public void setSequenceId(byte sequenceId) { - this.sequenceId = sequenceId; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/object_controller/NextCraftingStageResult.java b/src/network/packets/swg/zone/object_controller/NextCraftingStageResult.java deleted file mode 100644 index 9e454666f..000000000 --- a/src/network/packets/swg/zone/object_controller/NextCraftingStageResult.java +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class NextCraftingStageResult extends ObjectController { - - public static final int CRC = 0x01BE; - - private int requestId; - private int response; - private byte sequenceId; - - public NextCraftingStageResult(int requestId, int response, byte sequenceId) { - super(CRC); - this.requestId = requestId; - this.response = response; - this.sequenceId = sequenceId; - } - - public NextCraftingStageResult(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - requestId = data.getInt(); - response = data.getInt(); - sequenceId = data.getByte(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 9); - encodeHeader(data); - data.addInt(requestId); - data.addInt(response); - data.addByte(sequenceId); - return data; - } - - public int getRequestId() { - return requestId; - } - - public void setRequestId(int requestId) { - this.requestId = requestId; - } - - public int getResponse() { - return response; - } - - public void setResponse(int response) { - this.response = response; - } - - public byte getSequenceId() { - return sequenceId; - } - - public void setSequenceId(byte sequenceId) { - this.sequenceId = sequenceId; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/object_controller/ObjectController.java b/src/network/packets/swg/zone/object_controller/ObjectController.java deleted file mode 100644 index ff07527ba..000000000 --- a/src/network/packets/swg/zone/object_controller/ObjectController.java +++ /dev/null @@ -1,143 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.debug.Log; -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import network.packets.swg.zone.object_controller.combat.CombatAction; -import network.packets.swg.zone.object_controller.combat.CombatSpam; - -public abstract class ObjectController extends SWGPacket { - - public static final int CRC = 0x80CE5E46; - protected static final int HEADER_LENGTH = 26; - - private final int controllerCrc; - private int update = 0; - private long objectId = 0; - - public ObjectController() { - this(0, 0); - } - - public ObjectController(int controllerCrc) { - this(0, controllerCrc); - } - - public ObjectController(long objectId, int controllerCrc) { - this.objectId = objectId; - this.controllerCrc = controllerCrc; - this.update = 0x1B; - } - - protected final void decodeHeader(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - update = data.getInt(); - if (data.getInt() != controllerCrc) - Log.e("Attempting to process invalid controller"); - objectId = data.getLong(); - data.getInt(); - return; - } - - protected final void encodeHeader(NetBuffer data) { - data.addShort(5); - data.addInt(CRC); - data.addInt(update); - data.addInt(controllerCrc); - data.addLong(objectId); - data.addInt(0); - } - - @Override - public abstract void decode(NetBuffer data); - @Override - public abstract NetBuffer encode(); - - public long getObjectId() { return objectId; } - public int getUpdate() { return update; } - public int getControllerCrc() { return controllerCrc; } - - public void setUpdate(int update) { this.update = update; } - - public static final ObjectController decodeController(NetBuffer data) { - if (data.array().length < 14) - return null; - int pos = data.position(); - data.position(pos+10); - int crc = data.getInt(); - data.position(pos); - switch (crc) { - case 0x0071: return new DataTransform(data); - case 0x00CC: return new CombatAction(data); - case 0x00F1: return new DataTransformWithParent(data); - case 0x0116: return new CommandQueueEnqueue(data); - case 0x0117: return new CommandQueueDequeue(data); - case 0x0126: return new LookAtTarget(data); - case 0x012E: return new PlayerEmote(data); - case 0x0131: return new PostureUpdate(data); - case 0x0134: return new CombatSpam(data); - case 0x0146: return new ObjectMenuRequest(data); - case 0x01BD: return new ShowFlyText(data); - case 0x01DB: return new BiographyUpdate(data); - case 0x0448: return new CommandTimer(data); - case 0x044D: return new ChangeRoleIconChoice(data); - case 0x04BC: return new ShowLootBox(data); - case 0x04C5: return new IntendedTarget(data); - case 0x00F5: return new MissionListRequest(data); - case 0x041C: return new JTLTerminalSharedMessage(data); - case 0x0115: return new SecureTrade(data); - } - Log.w("Unknown object controller: %08X", crc); - return new GenericObjectController(crc, data); - } - - private static class GenericObjectController extends ObjectController { - - public GenericObjectController(int crc, NetBuffer data) { - super(0, crc); - decode(data); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH); - encodeHeader(data); - return data; - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - } - } - -} diff --git a/src/network/packets/swg/zone/object_controller/ObjectMenuRequest.java b/src/network/packets/swg/zone/object_controller/ObjectMenuRequest.java deleted file mode 100644 index 9a23b58ac..000000000 --- a/src/network/packets/swg/zone/object_controller/ObjectMenuRequest.java +++ /dev/null @@ -1,85 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import java.util.List; - -import com.projectswg.common.network.NetBuffer; - -import resources.radial.RadialOption; -import resources.radial.RadialOptionList; - -public class ObjectMenuRequest extends ObjectController { - - public static final int CRC = 0x0146; - - private long targetId; - private long requestorId; - private RadialOptionList options; - private byte counter; - - public ObjectMenuRequest(long objectId) { - super(objectId, CRC); - options = new RadialOptionList(); - } - - public ObjectMenuRequest(NetBuffer data) { - super(CRC); - options = new RadialOptionList(); - decode(data); - } - - public void decode(NetBuffer data) { - decodeHeader(data); - targetId = data.getLong(); - requestorId = data.getLong(); - options = data.getEncodable(RadialOptionList.class); - counter = data.getByte(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + options.getSize() + 17); - encodeHeader(data); - data.addLong(targetId); - data.addLong(requestorId); - data.addEncodable(options); - data.addByte(counter); - return data; - } - - public long getTargetId() { return targetId; } - public long getRequestorId() { return requestorId; } - public int getCounter() { return counter; } - public List getOptions() { return options.getOptions(); } - - public void setTargetId(long targetId) { this.targetId = targetId; } - public void setRequestorId(long requesterId) { this.requestorId = requesterId; } - public void setCounter(byte counter) { this.counter = counter; } - public void addOption(RadialOption opt) { options.addOption(opt); } - -} diff --git a/src/network/packets/swg/zone/object_controller/ObjectMenuResponse.java b/src/network/packets/swg/zone/object_controller/ObjectMenuResponse.java deleted file mode 100644 index 743e28480..000000000 --- a/src/network/packets/swg/zone/object_controller/ObjectMenuResponse.java +++ /dev/null @@ -1,119 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import java.util.List; - -import com.projectswg.common.network.NetBuffer; - -import resources.radial.RadialOption; -import resources.radial.RadialOptionList; - -public class ObjectMenuResponse extends ObjectController { - - public static final int CRC = 0x0147; - - private RadialOptionList options; - private long targetId; - private long requestorId; - private int counter; - - public ObjectMenuResponse(long objectId) { - super(objectId, CRC); - this.options = new RadialOptionList(); - } - - public ObjectMenuResponse(long objectId, long targetId, long requestorId, List options, int counter) { - super(objectId, CRC); - this.targetId = targetId; - this.requestorId = requestorId; - this.options = new RadialOptionList(options); - this.counter = counter; - setTargetId(targetId); - setRequestorId(requestorId); - setRadialOptions(options); - setCounter(counter); - } - - public ObjectMenuResponse(NetBuffer data) { - super(CRC); - this.options = new RadialOptionList(); - decode(data); - } - - public void decode(NetBuffer data) { - decodeHeader(data); - targetId = data.getLong(); - requestorId = data.getLong(); - options = data.getEncodable(RadialOptionList.class); - counter = data.getByte(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + options.getSize() + 17); - encodeHeader(data); - data.addLong(targetId); - data.addLong(requestorId); - data.addEncodable(options); - data.addByte(counter); - return data; - } - - public void setTargetId(long targetId) { - this.targetId = targetId; - } - - public void setRequestorId(long requestorId) { - this.requestorId = requestorId; - } - - public void setRadialOptions(List options) { - this.options.setOptions(options); - } - - public void setCounter(int counter) { - this.counter = counter; - } - - public long getTargetId() { - return targetId; - } - - public long getRequestorId() { - return requestorId; - } - - public List getOptions() { - return options.getOptions(); - } - - public int getCounter() { - return counter; - } - -} diff --git a/src/network/packets/swg/zone/object_controller/PlayerEmote.java b/src/network/packets/swg/zone/object_controller/PlayerEmote.java deleted file mode 100644 index a8171aabf..000000000 --- a/src/network/packets/swg/zone/object_controller/PlayerEmote.java +++ /dev/null @@ -1,83 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class PlayerEmote extends ObjectController { - - public static final int CRC = 0x012E; - - private long sourceId; - private long targetId; - private short emoteId; - - public PlayerEmote(long objectId) { - super(objectId, CRC); - } - - public PlayerEmote(NetBuffer data) { - super(CRC); - decode(data); - } - - public PlayerEmote(long objectId, long sourceId, long targetId, short emoteId) { - super(objectId, CRC); - this.sourceId = sourceId; - this.targetId = targetId; - this.emoteId = emoteId; - } - - public PlayerEmote(long objectId, PlayerEmote emote) { - super(objectId, CRC); - this.sourceId = emote.sourceId; - this.targetId = emote.targetId; - this.emoteId = emote.emoteId; - } - - public void decode(NetBuffer data) { - decodeHeader(data); - sourceId = data.getLong(); - targetId = data.getLong(); - emoteId = data.getShort(); - data.getShort(); // Should be 0 - data.getByte(); // Should be 3 - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 21); - encodeHeader(data); - data.addLong(sourceId); - data.addLong(targetId); - data.addShort(emoteId); - data.addShort((short) 0); - data.addByte((byte) 3); - return data; - } - -} diff --git a/src/network/packets/swg/zone/object_controller/PostureUpdate.java b/src/network/packets/swg/zone/object_controller/PostureUpdate.java deleted file mode 100644 index 116b400f9..000000000 --- a/src/network/packets/swg/zone/object_controller/PostureUpdate.java +++ /dev/null @@ -1,68 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -import resources.Posture; - -public class PostureUpdate extends ObjectController { - - public static final int CRC = 0x0131; - - private Posture posture; - - public PostureUpdate(long objectId, Posture posture) { - super(objectId, CRC); - this.posture = posture; - } - - public PostureUpdate(NetBuffer data) { - super(CRC); - decode(data); - } - - public void decode(NetBuffer data) { - decodeHeader(data); - posture = Posture.getFromId(data.getByte()); - data.getBoolean(); // isClientImmediate - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 2); - encodeHeader(data); - data.addByte(posture.getId()); - data.addBoolean(true); // isClientImmediate - return data; - } - - public Posture getPosture() { return posture; } - - public void setPosture(Posture posture) { this.posture = posture; } - -} diff --git a/src/network/packets/swg/zone/object_controller/SecureTrade.java b/src/network/packets/swg/zone/object_controller/SecureTrade.java deleted file mode 100644 index 2a3e34fa0..000000000 --- a/src/network/packets/swg/zone/object_controller/SecureTrade.java +++ /dev/null @@ -1,87 +0,0 @@ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.data.EnumLookup; -import com.projectswg.common.network.NetBuffer; - -public class SecureTrade extends ObjectController { - - public static final int CRC = 0x0115; - - private TradeMessageType type; - private long starterId; - private long accepterId; - - public SecureTrade(TradeMessageType type, long starterId, long accepterId) { - super(CRC); - this.type = type; - this.starterId = starterId; - this.accepterId = accepterId; - } - - public SecureTrade(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - type = TradeMessageType.getTypeForInt(data.getInt()); - starterId = data.getLong(); - accepterId = data.getLong(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 20); - encodeHeader(data); - data.addInt(type.getId()); - data.addLong(starterId); - data.addLong(accepterId); - return data; - } - - public TradeMessageType getType() { - return type; - } - - public void setType(TradeMessageType type) { - this.type = type; - } - - public long getStarterId() { - return starterId; - } - - public long getAccepterId() { - return accepterId; - } - - public static enum TradeMessageType { - UNDEFINED (Integer.MIN_VALUE), - REQUEST_TRADE (0), - TRADE_REQUESTED (1), - ACCEPT_TRADE (2), - DENIED_TRADE (3), - DENIED_PLAYER_BUSY (4), - DENIED_PLAYER_UNREACHABLE (5), - REQUEST_TRADE_REVERSED (6), - LAST_TRADE_MESSAGE (7); - - private static final EnumLookup LOOKUP = new EnumLookup<>(TradeMessageType.class, t -> t.getId()); - - private int id; - - TradeMessageType(int id) { - this.id = id; - } - - public int getId() { - return id; - } - - public static TradeMessageType getTypeForInt(int id) { - return LOOKUP.getEnum(id, UNDEFINED); - } - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/object_controller/ShowFlyText.java b/src/network/packets/swg/zone/object_controller/ShowFlyText.java deleted file mode 100644 index 767aaf608..000000000 --- a/src/network/packets/swg/zone/object_controller/ShowFlyText.java +++ /dev/null @@ -1,210 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import java.util.EnumSet; -import java.util.Set; - -import com.projectswg.common.data.RGB; -import com.projectswg.common.network.NetBuffer; - -import resources.encodables.OutOfBandPackage; -import resources.encodables.StringId; - -public class ShowFlyText extends ObjectController { - - public static final int CRC = 0x01BD; - - private StringId text; - private OutOfBandPackage oob; - private double scale; - private RGB rgb; - private Set display; - - public ShowFlyText(long objectId, String text, Scale scale, RGB rgb, Flag ... flags) { - this(objectId, new StringId(text), scale, rgb, flags); - } - - public ShowFlyText(long objectId, StringId text, Scale scale, RGB rgb, Flag ... flags) { - this(objectId, text, new OutOfBandPackage(), scale, rgb, flags); - } - - public ShowFlyText(long objectId, OutOfBandPackage oob, Scale scale, RGB rgb, Flag ... flags) { - this(objectId, new StringId(), oob, scale, rgb, flags); - } - - public ShowFlyText(long objectId, StringId text, OutOfBandPackage oob, Scale scale, RGB rgb, Flag ... flags) { - this(objectId, text, oob, scale.getSize(), rgb, flags); - } - - public ShowFlyText(long objectId, StringId text, OutOfBandPackage oob, double scale, RGB rgb, Flag ... flags) { - super(objectId, CRC); - this.text = text; - this.oob = oob; - this.scale = scale; - this.rgb = rgb; - this.display = EnumSet.noneOf(Flag.class); - setDisplayFlag(flags); - } - - public ShowFlyText(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - data.getLong(); - text = data.getEncodable(StringId.class); - oob = data.getEncodable(OutOfBandPackage.class); - scale = data.getFloat(); - rgb = data.getEncodable(RGB.class); - display = Flag.getFlyFlags(data.getInt()); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 27 + text.getFile().length() + text.getKey().length() + oob.getLength()); - encodeHeader(data); - data.addLong(getObjectId()); - data.addEncodable(text); - data.addEncodable(oob); - data.addFloat((float) scale); - data.addEncodable(rgb); - data.addInt(getDisplayBitmask()); - return data; - } - - public StringId getText() { - return text; - } - - public void setText(StringId text) { - this.text = text; - } - - public OutOfBandPackage getOob() { - return oob; - } - - public void setOob(OutOfBandPackage oob) { - this.oob = oob; - } - - public double getScale() { - return scale; - } - - public void setScale(double scale) { - this.scale = scale; - } - - public RGB getRgb() { - return rgb; - } - - public void setRgb(RGB rgb) { - this.rgb = rgb; - } - - public Set getDisplayFlags() { - return display; - } - - public void setDisplayFlag(ShowFlyText.Flag ... flags) { - for (Flag f : flags) - display.add(f); - } - - public void removeDisplayFlag(ShowFlyText.Flag ... flags) { - for (Flag f : flags) - display.remove(f); - } - - private int getDisplayBitmask() { - int bitmask = 0; - for (Flag f : display) - bitmask |= f.getMask(); - return bitmask; - } - - public enum Scale { - SMALLEST(1.0), - SMALL (1.2), - MEDIUM (1.5), - LARGE (2.0), - LARGEST (2.5); - - private double size; - - Scale(double size) { - this.size = size; - } - - public double getSize() { - return size; - } - } - - public enum Flag { - PRIVATE (0x0001), - SHOW_IN_CHAT_BOX (0x0002), - IS_DAMAGE_FROM_PLAYER (0x0004), - IS_SNARE (0x0008), - IS_GLANCING_BLOW (0x0010), - IS_CRITICAL_HIT (0x0020), - IS_LUCKY (0x0040), - IS_DOT (0x0080), - IS_BLEED (0x0100), - IS_HEAL (0x0200), - IS_FREESHOT (0x0400); - - private static final Flag [] VALUES = values(); - - private int num; - - Flag(int num) { - this.num = num; - } - - public int getMask() { - return num; - } - - public static Set getFlyFlags(int num) { - Set flags = EnumSet.noneOf(Flag.class); - for (Flag flag : VALUES) { - if ((num & flag.getMask()) != 0) - flags.add(flag); - } - return flags; - } - } -} - diff --git a/src/network/packets/swg/zone/object_controller/ShowLootBox.java b/src/network/packets/swg/zone/object_controller/ShowLootBox.java deleted file mode 100644 index 2488c2b01..000000000 --- a/src/network/packets/swg/zone/object_controller/ShowLootBox.java +++ /dev/null @@ -1,75 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class ShowLootBox extends ObjectController { - - public static final int CRC = 0x04BC; - - private long[] items; - - public ShowLootBox(long objectId, long[] items) { - super(objectId, CRC); - this.items = items; - } - - public ShowLootBox(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - - int itemCount = data.getInt(); - items = new long[itemCount]; - - for(int i = 0; i < itemCount; i++ ) { - items[i] = data.getLong(); - } - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 4 + items.length * 8); - encodeHeader(data); - - - data.addInt(items.length); - for (long objectId : items) { - data.addLong(objectId); - } - - return data; - } - -} - diff --git a/src/network/packets/swg/zone/object_controller/SitOnObject.java b/src/network/packets/swg/zone/object_controller/SitOnObject.java deleted file mode 100644 index 4f13bbdf0..000000000 --- a/src/network/packets/swg/zone/object_controller/SitOnObject.java +++ /dev/null @@ -1,86 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - -public class SitOnObject extends ObjectController { - - public static final int CRC = 0x013B; - - private long cellId; - private float x; - private float y; - private float z; - - public SitOnObject(long objectId) { - super(objectId, CRC); - } - - public SitOnObject(NetBuffer data) { - super(CRC); - decode(data); - } - - public SitOnObject(long objectId, long cellId, float x, float y, float z ) { - super(objectId, CRC); - this.cellId = cellId; - this.x = x; - this.y = y; - this.z = z; - } - - public SitOnObject(long objectId, SitOnObject sit) { - super(objectId, CRC); - this.cellId = sit.cellId; - this.x = sit.x; - this.y = sit.y; - this.z = sit.z; - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - cellId = data.getLong(); - x = data.getFloat(); - z = data.getFloat(); - y = data.getFloat(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 20); - encodeHeader(data); - data.addLong(cellId); - data.addFloat(x); - data.addFloat(z); - data.addFloat(y); - return data; - } - -} diff --git a/src/network/packets/swg/zone/object_controller/SpatialChat.java b/src/network/packets/swg/zone/object_controller/SpatialChat.java deleted file mode 100644 index 7f318d741..000000000 --- a/src/network/packets/swg/zone/object_controller/SpatialChat.java +++ /dev/null @@ -1,129 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.object_controller; - -import com.projectswg.common.network.NetBuffer; - - -public class SpatialChat extends ObjectController { - - public static final int CRC = 0x00F4; - - private long sourceId = 0; - private long targetId = 0; - private String text = ""; - private short balloonSize = 5; - private short balloonType = 0; - private short moodId = 0; - private byte languageId = 0; - private String outOfBand = ""; - private String sourceName = ""; - - public SpatialChat(long objectId) { - super(objectId, CRC); - } - - public SpatialChat(long objectId, long sourceId, long targetId, String text, short balloonType, short moodId) { - super(objectId, CRC); - this.sourceId = sourceId; - this.targetId = targetId; - this.text = text; - this.balloonType = balloonType; - this.moodId = moodId; - } - - public SpatialChat(long objectId, SpatialChat chat) { - super(objectId, CRC); - this.sourceId = chat.sourceId; - this.targetId = chat.targetId; - this.text = chat.text; - this.balloonSize = chat.balloonSize; - this.balloonType = chat.balloonType; - this.moodId = chat.moodId; - this.languageId = chat.languageId; - this.outOfBand = chat.outOfBand; - this.sourceName = chat.sourceName; - } - - public SpatialChat(NetBuffer data) { - super(CRC); - decode(data); - } - - public void decode(NetBuffer data) { - decodeHeader(data); - sourceId = data.getLong(); - targetId = data.getLong(); - text = data.getUnicode(); - data.getInt(); - balloonSize = data.getShort(); - balloonType = data.getShort(); - moodId = data.getShort(); - languageId = data.getByte(); - outOfBand = data.getUnicode(); - sourceName = data.getUnicode(); - } - - public NetBuffer encode() { - int length = 39 + text.length()*2 + outOfBand.length()*2 + sourceName.length()*2; - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + length); - encodeHeader(data); - data.addLong(sourceId); - data.addLong(targetId); - data.addUnicode(text); - data.addInt(0); // flags - data.addShort(balloonSize); - data.addShort(balloonType); - data.addShort(moodId); - data.addByte(languageId); // languageId - data.addUnicode(outOfBand); - data.addUnicode(sourceName); - return data; - } - - public void setSourceId(long sourceId) { this.sourceId = sourceId; } - public void setTargetId(long targetId) { this.targetId = targetId; } - public void setText(String text) { this.text = text; } - public void setBalloonSize(short size) { this.balloonSize = size; } - public void setBalloonType(short type) { this.balloonType = type; } - public void setMoodId(short moodId) { this.moodId = moodId; } - public void setLanguageId(byte id) { this.languageId = id; } - public void setOutOfBand(String oob) { this.outOfBand = oob; } - public void setSourceName(String name) { this.sourceName = name; } - - public long getSourceId() { return sourceId; } - public long getTargetId() { return targetId; } - public String getText() { return text; } - public short getBalloonSize() { return balloonSize; } - public short getBalloonType() { return balloonType; } - public short getMoodId() { return moodId; } - public byte getLanguageId() { return languageId; } - public String getOutOfBand() { return outOfBand; } - public String getSourceName() { return sourceName; } - -} diff --git a/src/network/packets/swg/zone/object_controller/combat/CombatAction.java b/src/network/packets/swg/zone/object_controller/combat/CombatAction.java deleted file mode 100644 index 41c7d272b..000000000 --- a/src/network/packets/swg/zone/object_controller/combat/CombatAction.java +++ /dev/null @@ -1,303 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller.combat; - -import java.util.HashSet; -import java.util.Set; - -import com.projectswg.common.data.location.Point3D; -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.zone.object_controller.ObjectController; -import resources.Posture; -import resources.combat.HitLocation; -import resources.combat.TrailLocation; -import resources.objects.creature.CreatureObject; - -public class CombatAction extends ObjectController { - - public static final int CRC = 0x00CC; - - private int actionCrc; - private long attackerId; - private long weaponId; - private Posture posture; - private Point3D position; - private long cell; - private TrailLocation trail; - private byte clientEffectId; - private int commandCrc; - private boolean useLocation; - private Set defenders; - - public CombatAction(long objectId) { - super(objectId, CRC); - defenders = new HashSet<>(); - } - - public CombatAction(NetBuffer data) { - super(CRC); - defenders = new HashSet<>(); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - actionCrc = data.getInt(); - attackerId = data.getLong(); - weaponId = data.getLong(); - posture = Posture.getFromId(data.getByte()); - trail = TrailLocation.getTrailLocation(data.getByte()); - clientEffectId = data.getByte(); - commandCrc = data.getInt(); - useLocation = data.getBoolean(); - if (useLocation) { - position = data.getEncodable(Point3D.class); - cell = data.getLong(); - } - int count = data.getShort(); - for (int i = 0; i < count; i++) { - Defender d = new Defender(); - d.setCreatureId(data.getLong()); - d.setPosture(Posture.getFromId(data.getByte())); - d.setDefense(data.getBoolean()); - d.setClientEffectId(data.getByte()); - d.setHitLocation(HitLocation.getHitLocation(data.getByte())); - d.setDamage(data.getShort()); - defenders.add(d); - } - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(HEADER_LENGTH + 30 + defenders.size() * 14 + (useLocation ? 20 : 0)); - encodeHeader(data); - data.addInt(actionCrc); - data.addLong(attackerId); - data.addLong(weaponId); - data.addByte(posture.getId()); - data.addByte(trail.getNum()); - data.addByte(clientEffectId); - data.addInt(commandCrc); - data.addBoolean(useLocation); - if (useLocation) { - data.addEncodable(position); - data.addLong(cell); - } - data.addShort(defenders.size()); - for (Defender d : defenders) { - data.addLong(d.getCreatureId()); - data.addByte(d.getPosture().getId()); - data.addBoolean(d.isDefense()); - data.addByte(d.getClientEffectId()); - data.addByte(d.getHitLocation().getNum()); - data.addShort(d.getDamage()); - } - return data; - } - - public int getActionCrc() { - return actionCrc; - } - - public long getAttackerId() { - return attackerId; - } - - public long getWeaponId() { - return weaponId; - } - - public Posture getPosture() { - return posture; - } - - public Point3D getPosition() { - return position; - } - - public long getCell() { - return cell; - } - - public TrailLocation getTrail() { - return trail; - } - - public byte getClientEffectId() { - return clientEffectId; - } - - public int getCommandCrc() { - return commandCrc; - } - - public boolean isUseLocation() { - return useLocation; - } - - public Set getDefenders() { - return defenders; - } - - public void setActionCrc(int actionCrc) { - this.actionCrc = actionCrc; - } - - public void setAttacker(CreatureObject attacker) { - setAttackerId(attacker.getObjectId()); - setWeaponId(attacker.getEquippedWeapon() == null ? 0 : attacker.getEquippedWeapon().getObjectId()); - setPosture(attacker.getPosture()); - } - - public void setAttackerId(long attackerId) { - this.attackerId = attackerId; - } - - public void setWeaponId(long weaponId) { - this.weaponId = weaponId; - } - - public void setPosture(Posture posture) { - this.posture = posture; - } - - public void setPosition(Point3D position) { - this.position = position; - } - - public void setCell(long cell) { - this.cell = cell; - } - - public void setTrail(TrailLocation trail) { - this.trail = trail; - } - - public void setClientEffectId(byte clientEffectId) { - this.clientEffectId = clientEffectId; - } - - public void setCommandCrc(int commandCrc) { - this.commandCrc = commandCrc; - } - - public void setUseLocation(boolean useLocation) { - this.useLocation = useLocation; - } - - public void addDefender(CreatureObject creature, boolean defense, byte clientEffectId, HitLocation location, short damage) { - defenders.add(new Defender(creature.getObjectId(), creature.getPosture(), defense, clientEffectId, location, damage)); - } - - public static class Defender { - - private long creatureId; - private Posture posture; - private boolean defense; - private byte clientEffectId; - private HitLocation hitLocation; - private short damage; - - public Defender() { - this(0, Posture.UPRIGHT, false, (byte) 0, HitLocation.HIT_LOCATION_BODY, (short) 0); - } - - public Defender(long creatureId, Posture p, boolean defense, byte clientEffectId, HitLocation location, short damage) { - setCreatureId(creatureId); - setPosture(p); - setDefense(defense); - setClientEffectId(clientEffectId); - setHitLocation(location); - setDamage(damage); - } - - public long getCreatureId() { - return creatureId; - } - - public Posture getPosture() { - return posture; - } - - public boolean isDefense() { - return defense; - } - - public byte getClientEffectId() { - return clientEffectId; - } - - public HitLocation getHitLocation() { - return hitLocation; - } - - public short getDamage() { - return damage; - } - - public void setCreatureId(long creatureId) { - this.creatureId = creatureId; - } - - public void setPosture(Posture p) { - this.posture = p; - } - - public void setDefense(boolean defense) { - this.defense = defense; - } - - public void setClientEffectId(byte clientEffectId) { - this.clientEffectId = clientEffectId; - } - - public void setHitLocation(HitLocation hitLocation) { - this.hitLocation = hitLocation; - } - - public void setDamage(short damage) { - this.damage = damage; - } - - public int hashCode() { - return Long.hashCode(creatureId); - } - - public boolean equals(Defender d) { - return creatureId == d.getCreatureId(); - } - - public String toString() { - return String.format("CREO=%d:%s Defense=%b EffectId=%d HitLoc=%s Damage=%d", creatureId, posture, defense, clientEffectId, hitLocation, damage); - } - } - -} - diff --git a/src/network/packets/swg/zone/object_controller/combat/CombatSpam.java b/src/network/packets/swg/zone/object_controller/combat/CombatSpam.java deleted file mode 100644 index 672495976..000000000 --- a/src/network/packets/swg/zone/object_controller/combat/CombatSpam.java +++ /dev/null @@ -1,302 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.object_controller.combat; - -import com.projectswg.common.data.location.Point3D; -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.zone.object_controller.ObjectController; -import resources.combat.AttackInfo; -import resources.combat.DamageType; -import resources.combat.HitLocation; -import resources.encodables.StringId; -import resources.objects.SWGObject; -import resources.objects.creature.CreatureObject; - -public class CombatSpam extends ObjectController { - - public static final int CRC = 0x0134; - - private byte dataType; - private long attacker; - private Point3D attackerPosition; - private long defender; - private Point3D defenderPosition; - private long weapon; - private StringId weaponName; - private StringId attackName; - private AttackInfo info; - private String spamMessage; - private int spamType; - - public CombatSpam(long objectId) { - super(objectId, CRC); - } - - public CombatSpam(NetBuffer data) { - super(CRC); - decode(data); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - info = new AttackInfo(); - dataType = data.getByte(); - attacker = data.getLong(); - attackerPosition = data.getEncodable(Point3D.class); - defender = data.getLong(); - defenderPosition = data.getEncodable(Point3D.class); - if (isAttackDataWeaponObject(dataType) || isAttackWeaponName(dataType)) { - if (isAttackDataWeaponObject(dataType)) - weapon = data.getLong(); - else - weaponName = data.getEncodable(StringId.class); - attackName = data.getEncodable(StringId.class); - info.setSuccess(data.getBoolean()); - if (info.isSuccess()) { - info.setArmor(data.getLong()); - info.setRawDamage(data.getInt()); - info.setDamageType(DamageType.getDamageType(data.getInt())); - info.setElementalDamage(data.getInt()); - info.setElementalDamageType(DamageType.getDamageType(data.getInt())); - info.setBleedDamage(data.getInt()); - info.setCriticalDamage(data.getInt()); - info.setBlockedDamage(data.getInt()); - info.setFinalDamage(data.getInt()); - info.setHitLocation(HitLocation.getHitLocation(data.getInt())); - info.setCrushing(data.getBoolean()); - info.setStrikethrough(data.getBoolean()); - info.setStrikethroughAmount(data.getFloat()); - info.setEvadeResult(data.getBoolean()); - info.setEvadeAmount(data.getFloat()); - info.setBlockResult(data.getBoolean()); - info.setBlock(data.getInt()); - } else { - info.setDodge(data.getBoolean()); - info.setParry(data.getBoolean()); - } - } else { - // spamMessage = data.getUnicode(); - data.getInt(); - } - info.setCritical(data.getBoolean()); - info.setGlancing(data.getBoolean()); - info.setProc(data.getBoolean()); - spamType = data.getInt(); - if (isMessageData(dataType)) { - // Extra stuff? - } - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(getEncodeSize()); - encodeHeader(data); - data.addByte(dataType); - data.addLong(attacker); - data.addEncodable(attackerPosition); - data.addLong(defender); - data.addEncodable(defenderPosition); - if (isAttackDataWeaponObject(dataType) || isAttackWeaponName(dataType)) { - if (isAttackDataWeaponObject(dataType)) - data.addLong(weapon); - else - data.addEncodable(weaponName); - data.addEncodable(attackName); - data.addBoolean(info.isSuccess()); - if (info.isSuccess()) { - data.addLong(info.getArmor()); - data.addInt(info.getRawDamage()); - data.addInt(info.getDamageType().getNum()); - data.addInt(info.getElementalDamage()); - data.addInt(info.getElementalDamageType().getNum()); - data.addInt(info.getBleedDamage());; - data.addInt(info.getCriticalDamage()); - data.addInt(info.getBlockedDamage()); - data.addInt(info.getFinalDamage()); - data.addInt(info.getHitLocation().getNum()); - data.addBoolean(info.isCrushing()); - data.addBoolean(info.isStrikethrough()); - data.addFloat((float) info.getStrikethroughAmount()); - data.addBoolean(info.isEvadeResult()); - data.addFloat((float) info.getEvadeAmount()); - data.addBoolean(info.isBlockResult()); - data.addInt(info.getBlock()); - } else { - data.addBoolean(info.isDodge()); - data.addBoolean(info.isParry()); - } - } else { - data.addInt(0); // ihnfk - } - data.addBoolean(info.isCritical()); - data.addBoolean(info.isGlancing()); - data.addBoolean(info.isProc()); - data.addInt(spamType); - return data; - } - - private int getEncodeSize() { - int size = HEADER_LENGTH + 24 + attackerPosition.getLength() + defenderPosition.getLength(); - if (isAttackDataWeaponObject(dataType)) - size += 9 + attackName.getLength() + (info.isSuccess() ? 60 : 2); - else if (isAttackWeaponName(dataType)) - size += 1 + attackName.getLength() + weaponName.getLength() + (info.isSuccess() ? 60 : 2); - else - size += 4; // I have no idea what's in this struct - return size; - } - - /** - * Sets the various fields based off of this creature object - * - * @param attacker the attacker - */ - public void setAttacker(CreatureObject attacker) { - setDataType((byte) 0); - setAttacker(attacker.getObjectId()); - setAttackerPosition(attacker.getLocation().getPosition()); - if (attacker.getEquippedWeapon() != null) - setWeapon(attacker.getEquippedWeapon().getObjectId()); - else - setWeapon(0); - } - - /** - * Sets the various fields based off of this creature object - * - * @param defender the defender - */ - public void setDefender(SWGObject defender) { - setDefender(defender.getObjectId()); - setDefenderPosition(defender.getLocation().getPosition()); - } - - public byte getDataType() { - return dataType; - } - - public long getAttacker() { - return attacker; - } - - public Point3D getAttackerPosition() { - return attackerPosition; - } - - public long getDefender() { - return defender; - } - - public Point3D getDefenderPosition() { - return defenderPosition; - } - - public long getWeapon() { - return weapon; - } - - public StringId getWeaponName() { - return weaponName; - } - - public StringId getAttackName() { - return attackName; - } - - public AttackInfo getInfo() { - return info; - } - - public String getSpamMessage() { - return spamMessage; - } - - public int getSpamType() { - return spamType; - } - - public void setDataType(byte dataType) { - this.dataType = dataType; - } - - public void setAttacker(long attacker) { - this.attacker = attacker; - } - - public void setAttackerPosition(Point3D attackerPosition) { - this.attackerPosition = attackerPosition; - } - - public void setDefender(long defender) { - this.defender = defender; - } - - public void setDefenderPosition(Point3D defenderPosition) { - this.defenderPosition = defenderPosition; - } - - public void setWeapon(long weapon) { - this.weapon = weapon; - } - - public void setWeaponName(StringId weaponName) { - this.weaponName = weaponName; - } - - public void setAttackName(StringId attackName) { - this.attackName = attackName; - } - - public void setInfo(AttackInfo info) { - this.info = info; - } - - public void setSpamMessage(String spamMessage) { - this.spamMessage = spamMessage; - } - - public void setSpamType(int spamType) { - this.spamType = spamType; - } - - private boolean isAttackDataWeaponObject(byte b) { - return b == 0; - } - - private boolean isAttackWeaponName(byte b) { - return b == 1; - } - - private boolean isMessageData(byte b) { - return b == 2; - } - -} - diff --git a/src/network/packets/swg/zone/resource/ResourceWeight.java b/src/network/packets/swg/zone/resource/ResourceWeight.java deleted file mode 100644 index 6346b135d..000000000 --- a/src/network/packets/swg/zone/resource/ResourceWeight.java +++ /dev/null @@ -1,158 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.resource; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import com.projectswg.common.debug.Assert; -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.zone.object_controller.ObjectController; - -public class ResourceWeight extends ObjectController { - - public static final int CRC = 0x0207; - - private final Map> attributes; - private final Map> resourceMaxWeights; - private int schematicId; - private int schematicCrc; - - public ResourceWeight() { - super(CRC); - attributes = new HashMap<>(); - resourceMaxWeights = new HashMap<>(); - } - - @Override - public void decode(NetBuffer data) { - decodeHeader(data); - schematicId = data.getInt(); - schematicCrc = data.getInt(); - int count = data.getByte(); - decodeWeights(data, attributes, count); - decodeWeights(data, resourceMaxWeights, count); - Assert.test(attributes.size() == resourceMaxWeights.size()); - } - - @Override - public NetBuffer encode() { - int len = HEADER_LENGTH + 9; - for (List weights : attributes.values()) - len += 3 + weights.size(); - for (List weights : resourceMaxWeights.values()) - len += 3 + weights.size(); - Assert.test(attributes.size() == resourceMaxWeights.size()); - NetBuffer data = NetBuffer.allocate(len); - encodeHeader(data); - encodeWeights(data, attributes); - encodeWeights(data, resourceMaxWeights); - data.addInt(attributes.size()); - return data; - } - - private void decodeWeights(NetBuffer data, Map> map, int count) { - for (int i = 0; i < count; i++) { - data.getByte(); // index - int slot = data.getByte(); - int weightCount = data.getByte(); - List weights = new ArrayList<>(); - map.put(slot, weights); - for (int j = 0; j < weightCount; j++) { - byte b = data.getByte(); - weights.add(new Weight((b & 0xF0) >>> 4, b & 0x0F)); - } - } - } - - private void encodeWeights(NetBuffer data, Map> map) { - int i = 0; - for (Entry> e : map.entrySet()) { - List weights = e.getValue(); - data.addByte(i++); - data.addByte(e.getKey()); - data.addByte(weights.size()); - for (Weight w : weights) { - data.addByte((w.getResourceId() << 4) | w.getWeight()); - } - } - } - - public Map> getAttributes() { - return attributes; - } - - public Map> getResourceMaxWeights() { - return resourceMaxWeights; - } - - public int getSchematicId() { - return schematicId; - } - - public int getSchematicCrc() { - return schematicCrc; - } - - public void setSchematicId(int schematicId) { - this.schematicId = schematicId; - } - - public void setSchematicCrc(int schematicCrc) { - this.schematicCrc = schematicCrc; - } - - public static class Weight { - - private int resourceId; - private int weight; - - public Weight() { - this(-1, 0); - } - - public Weight(int resourceId, int weight) { - this.resourceId = resourceId; - this.weight = weight; - } - - public int getResourceId() { - return resourceId; - } - - public int getWeight() { - return weight; - } - - } - -} diff --git a/src/network/packets/swg/zone/server_ui/SuiCreatePageMessage.java b/src/network/packets/swg/zone/server_ui/SuiCreatePageMessage.java deleted file mode 100644 index a3e71a241..000000000 --- a/src/network/packets/swg/zone/server_ui/SuiCreatePageMessage.java +++ /dev/null @@ -1,70 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.server_ui; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import resources.sui.SuiBaseWindow; - -public class SuiCreatePageMessage extends SWGPacket { - - public static final int CRC = getCrc("SuiCreatePageMessage"); - - private SuiBaseWindow window; - - public SuiCreatePageMessage() {} - - public SuiCreatePageMessage(SuiBaseWindow window) { - this.window = window; - } - - public SuiCreatePageMessage(NetBuffer data) { - decode(data); - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - window = data.getEncodable(SuiBaseWindow.class); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6 + window.getLength()); - data.addShort(2); - data.addInt(CRC); - data.addEncodable(window); - return data; - } - - public SuiBaseWindow getWindow() { - return window; - } -} diff --git a/src/network/packets/swg/zone/server_ui/SuiEventNotification.java b/src/network/packets/swg/zone/server_ui/SuiEventNotification.java deleted file mode 100644 index 0d38e37ac..000000000 --- a/src/network/packets/swg/zone/server_ui/SuiEventNotification.java +++ /dev/null @@ -1,87 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.server_ui; - -import java.util.ArrayList; -import java.util.List; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class SuiEventNotification extends SWGPacket { - public static final int CRC = getCrc("SuiEventNotification"); - - private int windowId; - private int eventIndex; - private int updateCount; - private List subscribedToProperties; - - public SuiEventNotification() { - subscribedToProperties = new ArrayList<>(); - } - - public SuiEventNotification(NetBuffer data) { - this(); - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - windowId = data.getInt(); - eventIndex = data.getInt(); - int size = data.getInt(); - updateCount = data.getInt(); - for (int i = 0; i < size; i++) { - subscribedToProperties.add(data.getUnicode()); - } - } - - public NetBuffer encode() { - int size = 0; - for (String property : subscribedToProperties) { - size += 4 + (property.length() * 2); - } - - NetBuffer data = NetBuffer.allocate(size + 16); - data.addInt(windowId); - data.addInt(eventIndex); - data.addInt(subscribedToProperties.size()); - data.addInt(updateCount); - for (String property : subscribedToProperties) { - data.addUnicode(property); - } - return data; - } - - public int getWindowId() { return this.windowId; } - public List getSubscribedToProperties() { return this.subscribedToProperties; } - public int getEventIndex() { return this.eventIndex; } - public int getUpdateCount() { return this.updateCount; } -} diff --git a/src/network/packets/swg/zone/server_ui/SuiForceClosePage.java b/src/network/packets/swg/zone/server_ui/SuiForceClosePage.java deleted file mode 100644 index af04c6d59..000000000 --- a/src/network/packets/swg/zone/server_ui/SuiForceClosePage.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package network.packets.swg.zone.server_ui; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -/** - * Created by Waverunner on 8/17/2015 - */ -public class SuiForceClosePage extends SWGPacket { - public static final int CRC = getCrc("SuiForceClosePage"); - - private int windowId; - - public SuiForceClosePage(int windowId) { - this.windowId = windowId; - } - - public SuiForceClosePage() {} - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - windowId = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(10); - data.addShort(1); - data.addInt(CRC); - data.addInt(windowId); - return data; - } - - public int getWindowId() { - return windowId; - } -} diff --git a/src/network/packets/swg/zone/spatial/AttributeListMessage.java b/src/network/packets/swg/zone/spatial/AttributeListMessage.java deleted file mode 100644 index ed375ef17..000000000 --- a/src/network/packets/swg/zone/spatial/AttributeListMessage.java +++ /dev/null @@ -1,91 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.spatial; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class AttributeListMessage extends SWGPacket { - public static final int CRC = getCrc("AttributeListMessage"); - - private long objectId; - private Map attributes; - - public AttributeListMessage() { - this(0, new HashMap<>()); - } - - public AttributeListMessage(long objectId, Map attributes) { - this.objectId = objectId; - this.attributes = attributes; - } - - public AttributeListMessage(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - objectId = data.getLong(); - data.getAscii(); // static item name - int count = data.getInt(); - for (int i = 0; i < count; i++) { - String name = data.getAscii(); - String attr = data.getUnicode(); - attributes.put(name, attr); - } - data.getInt(); - } - - public NetBuffer encode() { - int size = 0; - for (Entry e : attributes.entrySet()) { - size += 6 + e.getKey().length() + (e.getValue().length() * 2); - } - NetBuffer data = NetBuffer.allocate(24 + size); - data.addShort(3); - data.addInt(CRC); - data.addLong(objectId); - data.addShort(0); - data.addInt(attributes.size()); - for (Entry e : attributes.entrySet()) { - data.addAscii(e.getKey()); - data.addUnicode(e.getValue()); - } - data.addInt(0); - return data; - } - -} - diff --git a/src/network/packets/swg/zone/spatial/GetMapLocationsMessage.java b/src/network/packets/swg/zone/spatial/GetMapLocationsMessage.java deleted file mode 100644 index 31c69549a..000000000 --- a/src/network/packets/swg/zone/spatial/GetMapLocationsMessage.java +++ /dev/null @@ -1,85 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.spatial; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class GetMapLocationsMessage extends SWGPacket { - public static final int CRC = getCrc("GetMapLocationsMessage"); - - private String planet; - private int versionStatic; - private int versionDynamic; - private int versionPersist; - - public GetMapLocationsMessage() { - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - planet = data.getAscii(); - versionStatic = data.getInt(); - versionDynamic = data.getInt(); - versionPersist = data.getInt(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(19 + planet.length()); - data.addShort(28); - data.addInt(CRC); - data.addAscii(planet); - data.addInt(versionStatic); - data.addInt(versionDynamic); - data.addInt(versionPersist); - return data; - } - - public String getPlanet() { return planet; } - - public int getVersionDynamic() { - return versionDynamic; - } - - public int getVersionStatic() { - return versionStatic; - } - - public int getVersionPersist() { - return versionPersist; - } - - @Override - public String toString() { - return String.format("[GetMapLocationsMessage] planet=%s static=%d dynamic=%d persist=%d", - planet, versionStatic, versionDynamic, versionPersist); - } -} - diff --git a/src/network/packets/swg/zone/spatial/GetMapLocationsResponseMessage.java b/src/network/packets/swg/zone/spatial/GetMapLocationsResponseMessage.java deleted file mode 100644 index 4216c1867..000000000 --- a/src/network/packets/swg/zone/spatial/GetMapLocationsResponseMessage.java +++ /dev/null @@ -1,125 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.spatial; - -import java.util.List; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; -import services.map.MapLocation; - -public class GetMapLocationsResponseMessage extends SWGPacket { - public static final int CRC = getCrc("GetMapLocationsResponseMessage"); - - private String planet; - private List updatedStaticLocations; - private List updatedDynamicLocations; - private List updatedPersistLocations; - private int staticLocVersion; - private int dynamicLocVersion; - private int persistentLocVersion; - - public GetMapLocationsResponseMessage() { - - } - - public GetMapLocationsResponseMessage(String planet, - List staticLocs, List dynamicLocs, List persistLocs, - int staticLocVersion, int dynamicLocVersion, int persistLocVersion) { - this.planet = planet; - this.updatedStaticLocations = staticLocs; - this.updatedDynamicLocations = dynamicLocs; - this.updatedPersistLocations = persistLocs; - this.staticLocVersion = staticLocVersion; - this.dynamicLocVersion = dynamicLocVersion; - this.persistentLocVersion = persistLocVersion; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - planet = data.getAscii(); - updatedStaticLocations = data.getList(MapLocation.class); - updatedDynamicLocations = data.getList(MapLocation.class); - updatedPersistLocations = data.getList(MapLocation.class); - staticLocVersion = data.getInt(); - dynamicLocVersion = data.getInt(); - persistentLocVersion = data.getInt(); - } - - @Override - public NetBuffer encode() { - int size = planet.length() + 32; - - // Get size of data - if (updatedStaticLocations != null) { - for (MapLocation location : updatedStaticLocations) { - byte[] data = location.encode(); - size += data.length; - } - } - - if (updatedDynamicLocations != null) { - for (MapLocation location : updatedDynamicLocations) { - byte[] data = location.encode(); - size += data.length; - } - } - - if (updatedPersistLocations != null) { - for (MapLocation location : updatedPersistLocations) { - byte[] data = location.encode(); - size += data.length; - } - } - - // Create the packet - NetBuffer data = NetBuffer.allocate(size); - data.addShort(8); - data.addInt(CRC); - - data.addAscii(planet); - - data.addList(updatedStaticLocations); - data.addList(updatedDynamicLocations); - data.addList(updatedPersistLocations); - - data.addInt(staticLocVersion); - data.addInt(dynamicLocVersion); - data.addInt(persistentLocVersion); - return data; - } - - @Override - public String toString() { - return "[GetMapLocationsResponseMessage] " + - "staticVersion=" + staticLocVersion + "dynamicVersion=" + dynamicLocVersion + "persistVersion=" + persistentLocVersion; - } -} diff --git a/src/network/packets/swg/zone/spatial/NewTicketActivityResponseMessage.java b/src/network/packets/swg/zone/spatial/NewTicketActivityResponseMessage.java deleted file mode 100644 index b8e87c88e..000000000 --- a/src/network/packets/swg/zone/spatial/NewTicketActivityResponseMessage.java +++ /dev/null @@ -1,61 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package network.packets.swg.zone.spatial; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class NewTicketActivityResponseMessage extends SWGPacket { - public static final int CRC = getCrc("NewTicketActivityResponseMessage"); - - public NewTicketActivityResponseMessage() { - - } - - public NewTicketActivityResponseMessage(NetBuffer data) { - decode(data); - } - - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - data.getByte(); - data.getInt(); - } - - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(11); - data.addShort(2); - data.addInt(CRC); - data.addByte(0); - data.addInt(1); - return data; - } - -} diff --git a/src/network/packets/swg/zone/trade/AbortTradeMessage.java b/src/network/packets/swg/zone/trade/AbortTradeMessage.java deleted file mode 100644 index 419cae09b..000000000 --- a/src/network/packets/swg/zone/trade/AbortTradeMessage.java +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.trade; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class AbortTradeMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("AbortTradeMessage"); - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(1); - data.addInt(CRC); - return data; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/trade/AcceptTransactionMessage.java b/src/network/packets/swg/zone/trade/AcceptTransactionMessage.java deleted file mode 100644 index a5aab2377..000000000 --- a/src/network/packets/swg/zone/trade/AcceptTransactionMessage.java +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.trade; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class AcceptTransactionMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("AcceptTransactionMessage"); - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(1); - data.addInt(CRC); - return data; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/trade/AddItemFailedMessage.java b/src/network/packets/swg/zone/trade/AddItemFailedMessage.java deleted file mode 100644 index 971157192..000000000 --- a/src/network/packets/swg/zone/trade/AddItemFailedMessage.java +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.trade; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class AddItemFailedMessage extends SWGPacket{ - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("AddItemFailedMessage"); - - private long objectId; - - public AddItemFailedMessage(long objectId) { - this.objectId = objectId; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - objectId = data.getLong(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(14); - data.addShort(2); - data.addInt(CRC); - data.addLong(objectId); - return data; - } - - public long getObjectId() { - return objectId; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/trade/AddItemMessage.java b/src/network/packets/swg/zone/trade/AddItemMessage.java deleted file mode 100644 index 7a1885692..000000000 --- a/src/network/packets/swg/zone/trade/AddItemMessage.java +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.trade; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class AddItemMessage extends SWGPacket{ - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("AddItemMessage"); - - private long objectId; - - public AddItemMessage(long objectId) { - this.objectId = objectId; - } - - public AddItemMessage() { - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - objectId = data.getLong(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(14); - data.addShort(2); - data.addInt(CRC); - data.addLong(objectId); - return data; - } - - public long getObjectId() { - return objectId; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/trade/BeginTradeMessage.java b/src/network/packets/swg/zone/trade/BeginTradeMessage.java deleted file mode 100644 index 59342c4f6..000000000 --- a/src/network/packets/swg/zone/trade/BeginTradeMessage.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ -package network.packets.swg.zone.trade; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class BeginTradeMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("BeginTradeMessage"); - - private long playerId; - - public BeginTradeMessage(long playerId) { - super(); - this.playerId = playerId; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - playerId = data.getLong(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(14); - data.addShort(2); - data.addInt(CRC); - data.addLong(playerId); - return data; - } - - public long getPlayerId() { - return playerId; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/trade/BeginVerificationMessage.java b/src/network/packets/swg/zone/trade/BeginVerificationMessage.java deleted file mode 100644 index 5ee9cf849..000000000 --- a/src/network/packets/swg/zone/trade/BeginVerificationMessage.java +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.trade; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class BeginVerificationMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("BeginVerificationMessage"); - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(1); - data.addInt(CRC); - return data; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/trade/DenyTradeMessage.java b/src/network/packets/swg/zone/trade/DenyTradeMessage.java deleted file mode 100644 index 3ab8d321c..000000000 --- a/src/network/packets/swg/zone/trade/DenyTradeMessage.java +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.trade; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class DenyTradeMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("DenyTradeMessage"); - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(1); - data.addInt(CRC); - return data; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/trade/GiveMoneyMessage.java b/src/network/packets/swg/zone/trade/GiveMoneyMessage.java deleted file mode 100644 index feddf2a53..000000000 --- a/src/network/packets/swg/zone/trade/GiveMoneyMessage.java +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.trade; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class GiveMoneyMessage extends SWGPacket{ - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("GiveMoneyMessage"); - - private int moneyAmount; - - public GiveMoneyMessage(int moneyAmount) { - super(); - this.moneyAmount = moneyAmount; - } - - public GiveMoneyMessage() { - super(); - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - moneyAmount = data.getInt(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(10); - data.addShort(2); - data.addInt(CRC); - data.addInt(moneyAmount); - return data; - } - - public int getMoneyAmount() { - return moneyAmount; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/trade/RemoveItemMessage.java b/src/network/packets/swg/zone/trade/RemoveItemMessage.java deleted file mode 100644 index 274070cc0..000000000 --- a/src/network/packets/swg/zone/trade/RemoveItemMessage.java +++ /dev/null @@ -1,64 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.trade; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class RemoveItemMessage extends SWGPacket{ - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("RemoveItemMessage"); - - private long objectId; - - public RemoveItemMessage(long objectId) { - super(); - this.objectId = objectId; - } - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - objectId = data.getLong(); - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(14); - data.addShort(2); - data.addInt(CRC); - data.addLong(objectId); - return data; - } - - public long getObjectId() { - return objectId; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/trade/TradeCompleteMessage.java b/src/network/packets/swg/zone/trade/TradeCompleteMessage.java deleted file mode 100644 index c21d69a7e..000000000 --- a/src/network/packets/swg/zone/trade/TradeCompleteMessage.java +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.trade; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class TradeCompleteMessage extends SWGPacket{ - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("TradeCompleteMessage"); - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(1); - data.addInt(CRC); - return data; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/trade/UnAcceptTransactionMessage.java b/src/network/packets/swg/zone/trade/UnAcceptTransactionMessage.java deleted file mode 100644 index c61f6cd66..000000000 --- a/src/network/packets/swg/zone/trade/UnAcceptTransactionMessage.java +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.trade; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class UnAcceptTransactionMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("UnAcceptTransactionMessage"); - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(1); - data.addInt(CRC); - return data; - } -} \ No newline at end of file diff --git a/src/network/packets/swg/zone/trade/VerifyTradeMessage.java b/src/network/packets/swg/zone/trade/VerifyTradeMessage.java deleted file mode 100644 index 4f82a5319..000000000 --- a/src/network/packets/swg/zone/trade/VerifyTradeMessage.java +++ /dev/null @@ -1,51 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package network.packets.swg.zone.trade; - -import com.projectswg.common.network.NetBuffer; - -import network.packets.swg.SWGPacket; - -public class VerifyTradeMessage extends SWGPacket { - - public static final int CRC = com.projectswg.common.data.CRC.getCrc("VerifyTradeMessage"); - - @Override - public void decode(NetBuffer data) { - if (!super.checkDecode(data, CRC)) - return; - } - - @Override - public NetBuffer encode() { - NetBuffer data = NetBuffer.allocate(6); - data.addShort(1); - data.addInt(CRC); - return data; - } -} \ No newline at end of file diff --git a/src/resources/Galaxy.java b/src/resources/Galaxy.java deleted file mode 100644 index 02b121904..000000000 --- a/src/resources/Galaxy.java +++ /dev/null @@ -1,143 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package resources; - -import java.time.ZoneOffset; -import java.util.TimeZone; -import java.util.concurrent.TimeUnit; - - -public class Galaxy { - - // Population status values. Values are in percent. - private static final double VERY_LIGHT = 10; - private static final double LIGHT = 20; - private static final double MEDIUM = 30; - private static final double HEAVY = 40; - private static final double VERY_HEAVY = 50; - private static final double EXTREMELY_HEAVY = 100; - - private int id = 0; - private String name = ""; - private String address = ""; - private int zonePort = 44463; - private int pingPort = 44462; - private int population = 0; - private GalaxyStatus status = GalaxyStatus.DOWN; - private ZoneOffset zoneOffset; - private int maxCharacters = 0; - private int onlinePlayerLimit = 0; - private int onlineFreeTrialLimit = 0; - private int adminServerPort = 0; - private boolean recommended = true; - - public Galaxy() { - - } - - public synchronized int getId() { return id; } - public synchronized String getName() { return name; } - public synchronized String getAddress() { return address; } - public synchronized int getZonePort() { return zonePort; } - public synchronized int getPingPort() { return pingPort; } - public synchronized int getPopulation() { return population; } - public synchronized GalaxyStatus getStatus() { return status; } - public synchronized int getDistance() { return zoneOffset.getTotalSeconds() - (int) TimeUnit.SECONDS.convert(TimeZone.getDefault().getDSTSavings(), TimeUnit.MILLISECONDS); } - public synchronized int getMaxCharacters() { return maxCharacters; } - public synchronized int getOnlinePlayerLimit() { return onlinePlayerLimit; } - public synchronized int getOnlineFreeTrialLimit() { return onlineFreeTrialLimit; } - public synchronized int getAdminServerPort() { return adminServerPort; } - public synchronized boolean isRecommended() { return recommended; } - - public synchronized int getPopulationStatus() { - - if (population < VERY_LIGHT) - return 0; - else if(population < LIGHT) - return 1; - else if(population < MEDIUM) - return 2; - else if(population < HEAVY) - return 3; - else if(population < VERY_HEAVY) - return 4; - else if(population < EXTREMELY_HEAVY) - return 5; - return 6; - } - - public synchronized void setId(int id) { this.id = id; } - public synchronized void setName(String name) { this.name = name; } - public synchronized void setAddress(String addr) { this.address = addr; } - public synchronized void setZonePort(int port) { this.zonePort = port; } - public synchronized void setPingPort(int port) { this.pingPort = port; } - public synchronized void setPopulation(int population) { this.population = population; } - public synchronized void setStatus(GalaxyStatus status) { this.status = status; } - public synchronized void setZoneOffset(ZoneOffset zoneOffset) { this.zoneOffset = zoneOffset; } - public synchronized void setMaxCharacters(int max) { this.maxCharacters = max; } - public synchronized void setOnlinePlayerLimit(int max) { this.onlinePlayerLimit = max; } - public synchronized void setOnlineFreeTrialLimit(int max) { this.onlineFreeTrialLimit = max; } - public synchronized void setAdminServerPort(int port) { this.adminServerPort = port; } - public synchronized void setRecommended(boolean r) { this.recommended = r; } - public synchronized void incrementPopulationCount() { population++; } - public synchronized void decrementPopulationCount() { population--; } - - public String toString() { - return String.format("Galaxy[ID=%d Name=%s Address=%s Zone=%d Ping=%d Pop=%d PopStat=%d Status=%s Time=%s Max=%d Rec=%b]", - id, name, address, zonePort, pingPort, population, getPopulationStatus(), status, zoneOffset.getId(), maxCharacters, recommended); - } - - public void setStatus(int status) { - for (GalaxyStatus gs : GalaxyStatus.values()) { - if (gs.getStatus() == status) { - setStatus(gs); - return; - } - } - } - - public enum GalaxyStatus { - DOWN (0x00), - LOADING (0x01), - UP (0x02), - LOCKED (0x03), - RESTRICTED (0x04), - FULL (0x05); - - private byte status; - - GalaxyStatus(int status) { - this.status = (byte) status; - } - - public byte getStatus() { - return status; - } - } - -} diff --git a/src/resources/HologramColour.java b/src/resources/HologramColour.java deleted file mode 100644 index a6ccfa8ed..000000000 --- a/src/resources/HologramColour.java +++ /dev/null @@ -1,49 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package resources; - -public enum HologramColour { - DEFAULT(-1), BLUE(0), PURPLE(4), ORANGE(8); - - private int value; - - HologramColour(int value) { - this.value = value; - } - - public int getValue() { - return value; - } - - public static final HologramColour getForValue(int value) { - for (HologramColour d : values()) - if (d.getValue() == value) - return d; - return DEFAULT; - } -} \ No newline at end of file diff --git a/src/resources/Posture.java b/src/resources/Posture.java deleted file mode 100644 index 59b3a937c..000000000 --- a/src/resources/Posture.java +++ /dev/null @@ -1,77 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package resources; - -import java.util.Hashtable; -import java.util.Map; - -public enum Posture { - UPRIGHT (0x00), - CROUCHED (0x01), - PRONE (0x02), - SNEAKING (0x03), - BLOCKING (0x04), - CLIMBING (0x05), - FLYING (0x06), - LYING_DOWN (0x07), - SITTING (0x08), - SKILL_ANIMATING (0x09), - DRIVING_VEHICLE (0x0A), - RIDING_CREATURE (0x0B), - KNOCKED_DOWN (0x0C), - INCAPACITATED (0x0D), - DEAD (0x0E), - INVALID (0x0E); - - private static final Map POSTURE_MAP = new Hashtable(15); - private byte id; - - static { - for (Posture p : values()) { - if (p != INVALID) - POSTURE_MAP.put(p.getId(), p); - } - } - - Posture(int id) { - this.id = (byte)id; - } - - public byte getId() { return id; } - - public static final Posture getFromId(byte id) { - Posture p = null; - synchronized (POSTURE_MAP) { - p = POSTURE_MAP.get(id); - } - if (p == null) - return INVALID; - return p; - } - -} \ No newline at end of file diff --git a/src/resources/PvpFaction.java b/src/resources/PvpFaction.java deleted file mode 100644 index 2fa1023f8..000000000 --- a/src/resources/PvpFaction.java +++ /dev/null @@ -1,66 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package resources; - -import java.util.HashMap; -import java.util.Map; - -import com.projectswg.common.data.CRC; - - -public enum PvpFaction { - - NEUTRAL(0), - IMPERIAL(CRC.getCrc("imperial")), - REBEL(CRC.getCrc("rebel")); - - private static final Map CRC_LOOKUP; - - static { - CRC_LOOKUP = new HashMap<>(); - - for(PvpFaction pvpFaction : values()) { - CRC_LOOKUP.put(pvpFaction.getCrc(), pvpFaction); - } - } - - private int crc; - - PvpFaction(int crc) { - this.crc = crc; - } - - public int getCrc() { - return crc; - } - - public static PvpFaction getFactionForCrc(int crc) { - return CRC_LOOKUP.get(crc); - } - -} diff --git a/src/resources/PvpFlag.java b/src/resources/PvpFlag.java deleted file mode 100644 index 4be7d0c67..000000000 --- a/src/resources/PvpFlag.java +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package resources; - -import java.util.EnumSet; - -public enum PvpFlag { - - ATTACKABLE(1<<0), - AGGRESSIVE(1<<1), - OVERT(1<<2), - TEF(1<<3), - PLAYER(1<<4), - ENEMY(1<<5), - GOING_OVERT(1<<6), - GOING_COVERT(1<<7), - DUEL(1<<8); - - private int bitmask; - - PvpFlag(int bitmask) { - this.bitmask = bitmask; - } - - public int getBitmask() { - return bitmask; - } - public static EnumSet getFlags(int bits) { - EnumSet states = EnumSet.noneOf(PvpFlag.class); - for (PvpFlag state : values()) { - if ((state.getBitmask() & bits) != 0) - states.add(state); - } - return states; - } - -} \ No newline at end of file diff --git a/src/resources/PvpStatus.java b/src/resources/PvpStatus.java deleted file mode 100644 index 5805f2ab3..000000000 --- a/src/resources/PvpStatus.java +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package resources; - -import java.util.HashMap; -import java.util.Map; - -public enum PvpStatus { - - ONLEAVE(0), - COMBATANT(1), - SPECIALFORCES(2); - - private static final Map CRC_LOOKUP; - - static { - CRC_LOOKUP = new HashMap<>(); - - for(PvpStatus pvpStatus : values()) { - CRC_LOOKUP.put(pvpStatus.getValue(), pvpStatus); - } - } - - private int value; - - PvpStatus(int crc) { - this.value = crc; - } - - public int getValue() { - return value; - } - - public static PvpStatus getStatusForValue(int crc) { - return CRC_LOOKUP.get(crc); - } - -} \ No newline at end of file diff --git a/src/resources/Race.java b/src/resources/Race.java deleted file mode 100644 index 641496a8c..000000000 --- a/src/resources/Race.java +++ /dev/null @@ -1,119 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package resources; - -import java.util.HashMap; -import java.util.Map; - -import com.projectswg.common.data.CRC; -import com.projectswg.common.data.swgfile.ClientFactory; - - -public enum Race { - HUMAN_MALE ("human_male", 50, 0, 0, 50, 50, 50), - HUMAN_FEMALE ("human_female", 50, 0, 0, 50, 50, 50), - TRANDOSHAN_MALE ("trandoshan_male", 20, 65, 0, 0, 65, 50), - TRANDOSHAN_FEMALE ("trandoshan_female", 20, 65, 0, 0, 65, 50), - TWILEK_MALE ("twilek_male", 60, 0, 40, 40, 60, 0), - TWILEK_FEMALE ("twilek_female", 60, 0, 40, 40, 60, 0), - BOTHAN_MALE ("bothan_male", 50, 25, 60, 65, 0, 0), - BOTHAN_FEMALE ("bothan_female", 50, 25, 60, 65, 0, 0), - ZABRAK_MALE ("zabrak_male", 50, 50, 0, 50, 0, 50), - ZABRAK_FEMALE ("zabrak_female", 50, 50, 0, 50, 0, 50), - RODIAN_MALE ("rodian_male", 80, 0, 20, 80, 20, 0), - RODIAN_FEMALE ("rodian_female", 80, 0, 20, 80, 20, 0), - MONCAL_MALE ("moncal_male", 0, 40, 40, 60, 60, 0), - MONCAL_FEMALE ("moncal_female", 0, 40, 40, 60, 60, 0), - WOOKIEE_MALE ("wookiee_male", 0, 85, 0, 10, 40, 85), - WOOKIEE_FEMALE ("wookiee_female", 0, 85, 0, 10, 40, 85), - SULLUSTAN_MALE ("sullustan_male", 60, 60, 40, 0, 0, 40), - SULLUSTAN_FEMALE ("sullustan_female", 60, 60, 40, 0, 0, 40), - ITHORIAN_MALE ("ithorian_male", 0, 0, 30, 40, 70, 60), - ITHORIAN_FEMALE ("ithorian_female", 0, 0, 30, 40, 70, 60); - - private static final Map CRC_TO_RACE = new HashMap(); - private static final Map SPECIES_TO_RACE = new HashMap(); - private static final Map FILE_TO_RACE = new HashMap(); - - static { - for (Race r : values()) { - SPECIES_TO_RACE.put(r.species, r); - CRC_TO_RACE.put(r.getCrc(), r); - FILE_TO_RACE.put(r.getFilename(), r); - } - } - - private boolean male; - private int crc; - private String species; - private int agility; - private int constitution; - private int luck; - private int precision; - private int stamina; - private int strength; - - Race(String species, int agility, int constitution, int luck, int precision, int stamina, int strength) { - this.male = !species.endsWith("female"); - this.crc = CRC.getCrc("object/creature/player/"+species+".iff"); - this.species = species; - this.agility = agility; - this.constitution = constitution; - this.luck = luck; - this.precision = precision; - this.stamina = stamina; - this.strength = strength; - } - - public boolean isMale() { return male; } - public boolean isFemale() { return !male; } - public int getCrc() { return crc; } - public int getAgility() { return agility; } - public int getConstitution() { return constitution; } - public int getLuck() { return luck; } - public int getPrecision() { return precision; } - public int getStamina() { return stamina; } - public int getStrength() { return strength; } - public String getFilename() { return "object/creature/player/shared_"+species+".iff"; } - public String getSpecies() { return species.substring(0, species.indexOf('_')); } - - public static final Race getRace(int crc) { - return CRC_TO_RACE.get(crc); - } - - public static final Race getRace(String species) { - Race r = SPECIES_TO_RACE.get(species); - return r == null ? HUMAN_MALE : r; - } - - public static final Race getRaceByFile(String iffFile) { - Race r = FILE_TO_RACE.get(ClientFactory.formatToSharedFile(iffFile)); - return r == null ? HUMAN_MALE : r; - } - -} diff --git a/src/resources/SkillMod.java b/src/resources/SkillMod.java deleted file mode 100644 index 2ab5cdbde..000000000 --- a/src/resources/SkillMod.java +++ /dev/null @@ -1,98 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package resources; - -import com.projectswg.common.encoding.Encodable; -import com.projectswg.common.network.NetBuffer; -import com.projectswg.common.network.NetBufferStream; -import com.projectswg.common.persistable.Persistable; - -public class SkillMod implements Encodable, Persistable { - - private int base, modifier; - - public SkillMod() { - this(0, 0); - } - - public SkillMod(int base, int modifier) { - this.base = base; - this.modifier = modifier; - } - - @Override - public byte[] encode() { - NetBuffer data = NetBuffer.allocate(8); - - data.addInt(base); - data.addInt(modifier); - - return data.array(); - } - - @Override - public void decode(NetBuffer data) { - base = data.getInt(); - modifier = data.getInt(); - } - - @Override - public int getLength() { - return 8; - } - - @Override - public void save(NetBufferStream stream) { - stream.addInt(base); - stream.addInt(modifier); - } - - @Override - public void read(NetBufferStream stream) { - base = stream.getInt(); - modifier = stream.getInt(); - } - - public void adjustBase(int adjustment) { - base += adjustment; - } - - public void adjustModifier(int adjustment) { - modifier += adjustment; - } - - public int getValue() { - return base + modifier; - } - - @Override - public String toString() { - return "SkillMod[Base="+base+", Modifier="+modifier+"]"; - } - -} diff --git a/src/resources/WeatherType.java b/src/resources/WeatherType.java deleted file mode 100644 index 15d7c702a..000000000 --- a/src/resources/WeatherType.java +++ /dev/null @@ -1,57 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package resources; - -/** - * Make sure that the chances for each weather type add up to 1.0 (100%). - * @author Ziggy - * - */ -public enum WeatherType { - CLEAR(0, .70f), // 70% chance - LIGHT(1, .15f), // 15% chance - MEDIUM(2, .10f), // 10% chance - HEAVY(3, .05f); // 5% chance - - private int value; - private float chance; - - WeatherType(int value, float chance) { - this.value = value; - this.chance = chance; - } - - public int getValue() { - return value; - } - - public float getChance() { - return chance; - } - -} diff --git a/src/resources/chat/ChatAvatar.java b/src/resources/chat/ChatAvatar.java deleted file mode 100644 index d0cd93089..000000000 --- a/src/resources/chat/ChatAvatar.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ -package resources.chat; - -import java.util.Locale; - -import com.projectswg.common.encoding.CachedEncode; -import com.projectswg.common.encoding.Encodable; -import com.projectswg.common.network.NetBuffer; -import com.projectswg.common.network.NetBufferStream; -import com.projectswg.common.persistable.Persistable; - -import resources.player.Player; -import services.CoreManager; - -public class ChatAvatar implements Encodable, Persistable { - - private final CachedEncode cache; - - private Player player; - private String name; - - public ChatAvatar() { - this(null, null); - } - - public ChatAvatar(Player player, String name) { - this.cache = new CachedEncode(() -> encodeImpl()); - this.player = player; - this.name = name; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - this.cache.clearCached(); - } - - public String getGalaxy() { - return getCoreGalaxy(); - } - - public Player getPlayer() { - return player; - } - - public void setPlayer(Player player) { - this.player = player; - } - - private byte [] encodeImpl() { - NetBuffer buffer = NetBuffer.allocate(getLength()); - buffer.addAscii("SWG"); - buffer.addAscii(getCoreGalaxy()); - buffer.addAscii(name); - return buffer.array(); - } - - public int getLength() { - return 9 + name.length() + getCoreGalaxy().length(); - } - - @Override - public byte[] encode() { - return cache.encode(); - } - - @Override - public void decode(NetBuffer data) { - data.getAscii(); // SWG - data.getAscii(); - name = data.getAscii().toLowerCase(Locale.US); - } - - @Override - public void save(NetBufferStream stream) { - stream.addByte(1); - stream.addAscii(name); - } - - @Override - public void read(NetBufferStream stream) { - byte ver = stream.getByte(); - if (ver == 0) - stream.getAscii(); - name = stream.getAscii(); - } - - @Override - public String toString() { - return String.format("ChatAvatar[name='%s']", name); - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof ChatAvatar)) - return false; - return ((ChatAvatar) o).getName().equals(getName()); - } - - @Override - public int hashCode() { - return name.hashCode(); - } - - public static ChatAvatar getFromPlayer(Player player) { - return new ChatAvatar(player, player.getCharacterFirstName().toLowerCase(Locale.US)); - } - - public static ChatAvatar getSystemAvatar() { - return new ChatAvatar(null, "system"); - } - - private static String getCoreGalaxy() { - return CoreManager.getGalaxy().getName(); - } -} diff --git a/src/resources/chat/ChatResult.java b/src/resources/chat/ChatResult.java deleted file mode 100644 index 1d836efb9..000000000 --- a/src/resources/chat/ChatResult.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package resources.chat; - -import java.util.HashMap; -import java.util.Map; - -/** - * @author Waverunner - */ -public enum ChatResult { - NONE (-1), // The client will just display an "unknown error code" if this is used. - SUCCESS (0), - TARGET_AVATAR_DOESNT_EXIST (4), - ROOM_INVALID_ID (5), - ROOM_INVALID_NAME (6), - CUSTOM_FAILURE (9), - ROOM_AVATAR_BANNED (12), - ROOM_PRIVATE (13), - ROOM_AVATAR_NO_PERMISSION (16), - IGNORED (23), - ROOM_ALREADY_EXISTS (24), - ROOM_ALREADY_JOINED (36), - CHAT_SERVER_UNAVAILABLE (1000000), - ROOM_DIFFERENT_FACTION (1000001), - ROOM_NOT_GCW_DEFENDER_FACTION (1000005); - - private static final Map RESULT_MAP = new HashMap<>(); - - static { - for (ChatResult result : values()) { - RESULT_MAP.put(result.getCode(), result); - } - } - - private final int code; - - ChatResult(int code) { - this.code = code; - } - - public int getCode() { - return code; - } - - public static ChatResult fromInteger(int code) { - ChatResult result = RESULT_MAP.get(code); - if (result == null) - return NONE; - return result; - } -} diff --git a/src/resources/chat/ChatRoom.java b/src/resources/chat/ChatRoom.java deleted file mode 100644 index 0990c69a2..000000000 --- a/src/resources/chat/ChatRoom.java +++ /dev/null @@ -1,346 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ -package resources.chat; - -import java.util.ArrayList; -import java.util.List; - -import com.projectswg.common.encoding.CachedEncode; -import com.projectswg.common.encoding.Encodable; -import com.projectswg.common.network.NetBuffer; -import com.projectswg.common.network.NetBufferStream; -import com.projectswg.common.persistable.Persistable; - -import network.packets.swg.SWGPacket; -import network.packets.swg.zone.chat.ChatRoomMessage; -import resources.encodables.OutOfBandPackage; -import services.player.PlayerManager; - -public class ChatRoom implements Encodable, Persistable { - - private final CachedEncode cache; - - private int id; - private int type; - private String path; - private ChatAvatar owner; - private ChatAvatar creator; - private String title; - private List moderators; - private List invited; - private boolean moderated; // No one but moderators can talk - private List banned; - // Members are only actually apart of a room when they're "in the room", so we don't need to save this info - // as each player will automatically re-join the room based on their joined channels list - private transient List members; - - public ChatRoom() { - this.cache = new CachedEncode(() -> encodeImpl()); - owner = new ChatAvatar(); - creator = new ChatAvatar(); - moderators = new ArrayList<>(); - invited = new ArrayList<>(); - members = new ArrayList<>(); - banned = new ArrayList<>(); - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.cache.clearCached(); - this.id = id; - } - - public int getType() { - return type; - } - - public void setType(int type) { - this.cache.clearCached(); - this.type = type; - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.cache.clearCached(); - this.path = path; - } - - public ChatAvatar getOwner() { - return owner; - } - - public void setOwner(ChatAvatar owner) { - this.cache.clearCached(); - this.owner = owner; - } - - public ChatAvatar getCreator() { - return creator; - } - - public void setCreator(ChatAvatar creator) { - this.cache.clearCached(); - this.creator = creator; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.cache.clearCached(); - this.title = title; - } - - public List getModerators() { - return moderators; - } - - public List getInvited() { - return invited; - } - - public boolean isModerated() { - return moderated; - } - - public void setModerated(boolean moderated) { - this.cache.clearCached(); - this.moderated = moderated; - } - - public List getMembers() { - return members; - } - - public boolean isPublic() { - return type == 0; - } - - public void setIsPublic(boolean isPublic) { - this.cache.clearCached(); - this.type = (isPublic ? 0 : 1); - } - - public List getBanned() { - return banned; - } - - public ChatResult canJoinRoom(ChatAvatar avatar, boolean ignoreInvitation) { - if (banned.contains(avatar)) - return ChatResult.ROOM_AVATAR_BANNED; - - if (members.contains(avatar)) - return ChatResult.ROOM_ALREADY_JOINED; - - if (isPublic() || ignoreInvitation || invited.contains(avatar) || moderators.contains(avatar)) - return ChatResult.SUCCESS; - - return ChatResult.ROOM_AVATAR_NO_PERMISSION; - } - - public ChatResult canSendMessage(ChatAvatar avatar) { - if (banned.contains(avatar)) - return ChatResult.ROOM_AVATAR_BANNED; - - if (moderated && !moderators.contains(avatar)) - return ChatResult.CUSTOM_FAILURE; - - return ChatResult.SUCCESS; - } - - public boolean isModerator(ChatAvatar avatar) { - return avatar.equals(owner) || moderators.contains(avatar); - } - - public boolean isMember(ChatAvatar avatar) { - return members.contains(avatar); - } - - public boolean isBanned(ChatAvatar avatar) { - return banned.contains(avatar); - } - - public boolean isInvited(ChatAvatar avatar) { - return invited.contains(avatar); - } - - public boolean addMember(ChatAvatar avatar) { - this.cache.clearCached(); - return members.add(avatar); - } - - public boolean removeMember(ChatAvatar avatar) { - this.cache.clearCached(); - return members.remove(avatar); - } - - public boolean addModerator(ChatAvatar avatar) { - this.cache.clearCached(); - return moderators.add(avatar); - } - - public boolean removeModerator(ChatAvatar avatar) { - this.cache.clearCached(); - return moderators.remove(avatar); - } - - public boolean addInvited(ChatAvatar avatar) { - this.cache.clearCached(); - return invited.add(avatar); - } - - public boolean removeInvited(ChatAvatar avatar) { - this.cache.clearCached(); - return invited.remove(avatar); - } - - public boolean addBanned(ChatAvatar avatar) { - this.cache.clearCached(); - return banned.add(avatar); - } - - public boolean removeBanned(ChatAvatar avatar) { - this.cache.clearCached(); - return banned.remove(avatar); - } - - public void sendMessage(ChatAvatar sender, String message, OutOfBandPackage oob, PlayerManager playerManager) { - ChatRoomMessage chatRoomMessage = new ChatRoomMessage(sender, getId(), message, oob); - for (ChatAvatar member : members) { - if (member.getPlayer().getPlayerObject().isIgnored(sender.getName())) - continue; - - member.getPlayer().sendPacket(chatRoomMessage); - } - } - - public void sendPacketToMembers(PlayerManager manager, SWGPacket... packets) { - for (ChatAvatar member : members) { - member.getPlayer().sendPacket(packets); - } - } - - @Override - public void decode(NetBuffer data) { - id = data.getInt(); - type = data.getInt(); - moderated = data.getBoolean(); - path = data.getAscii(); - owner = data.getEncodable(ChatAvatar.class); - creator = data.getEncodable(ChatAvatar.class); - title = data.getUnicode(); - moderators = data.getList(ChatAvatar.class); - invited = data.getList(ChatAvatar.class); - } - - @Override - public byte[] encode() { - return cache.encode(); - } - - private byte[] encodeImpl() { - NetBuffer data = NetBuffer.allocate(getLength()); - data.addInt(id); - data.addInt(type); - data.addBoolean(moderated); - data.addAscii(path); - data.addEncodable(owner); - data.addEncodable(creator); - data.addUnicode(title); - data.addList(moderators); - data.addList(invited); - return data.array(); - } - - public int getLength() { - int avatarIdSize = 0; // The encode method for ChatAvatar saves the encode result if the class was modified/null data - - for (ChatAvatar moderator : moderators) { - avatarIdSize += moderator.getLength(); - } - for (ChatAvatar invitee : invited) { - avatarIdSize += invitee.getLength(); - } - - avatarIdSize += owner.getLength() + creator.getLength(); - return 23 + path.length() + (title.length() * 2) + avatarIdSize; - } - - @Override - public void save(NetBufferStream stream) { - stream.addByte(0); - owner.save(stream); - creator.save(stream); - stream.addInt(id); - stream.addInt(type); - stream.addAscii(path); - stream.addUnicode(title); - stream.addBoolean(moderated); - stream.addList(moderators, (a) -> a.save(stream)); - stream.addList(invited, (a) -> a.save(stream)); - stream.addList(banned, (a) -> a.save(stream)); - } - - @Override - public void read(NetBufferStream stream) { - stream.getByte(); - owner.read(stream); - creator.read(stream); - id = stream.getInt(); - type = stream.getInt(); - path = stream.getAscii(); - title = stream.getUnicode(); - moderated = stream.getBoolean(); - stream.getList((i) -> moderators.add(inflateAvatar(stream))); - stream.getList((i) -> invited.add(inflateAvatar(stream))); - stream.getList((i) -> banned.add(inflateAvatar(stream))); - } - - private ChatAvatar inflateAvatar(NetBufferStream stream) { - ChatAvatar avatar = new ChatAvatar(); - avatar.read(stream); - return avatar; - } - - @Override - public String toString() { - return "ChatRoom[id=" + id + ", type=" + type + ", path='" + path + "', title='" + title + '\'' + ", creator=" + creator + ", moderated=" + moderated + ", isPublic=" + isPublic() + "]"; - } - - public static ChatRoom create(NetBufferStream stream) { - ChatRoom room = new ChatRoom(); - room.read(stream); - return room; - } -} diff --git a/src/resources/collections/SWGBitSet.java b/src/resources/collections/SWGBitSet.java index 001b148bb..20d0c77c4 100644 --- a/src/resources/collections/SWGBitSet.java +++ b/src/resources/collections/SWGBitSet.java @@ -44,7 +44,7 @@ public class SWGBitSet extends BitSet implements Encodable, Persistable { private int updateType; public SWGBitSet(int view, int updateType) { - super(128); // Seems to be the default size for the bitmask sets in packets + super(128); // Seems to be the default size for the bitmask sets in SWGPackets this.view = view; this.updateType = updateType; } diff --git a/src/resources/collections/SWGFlag.java b/src/resources/collections/SWGFlag.java index 5f6ea4815..710fc4c73 100644 --- a/src/resources/collections/SWGFlag.java +++ b/src/resources/collections/SWGFlag.java @@ -35,9 +35,9 @@ import java.util.BitSet; import com.projectswg.common.encoding.Encodable; import com.projectswg.common.network.NetBuffer; import com.projectswg.common.network.NetBufferStream; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline; import com.projectswg.common.persistable.Persistable; -import network.packets.swg.zone.baselines.Baseline; import resources.objects.SWGObject; public class SWGFlag extends BitSet implements Encodable, Persistable { @@ -58,7 +58,7 @@ public class SWGFlag extends BitSet implements Encodable, Persistable { * this BitSet resides at within the baseline */ public SWGFlag(int view, int updateType) { - super(128); // Seems to be the default size for the bitmask sets in packets + super(128); // Seems to be the default size for the bitmask sets in SWGPackets this.view = view; this.updateType = updateType; } diff --git a/src/resources/collections/SWGList.java b/src/resources/collections/SWGList.java index ac522aa04..cfce9287f 100644 --- a/src/resources/collections/SWGList.java +++ b/src/resources/collections/SWGList.java @@ -42,8 +42,8 @@ import com.projectswg.common.encoding.Encodable; import com.projectswg.common.encoding.Encoder; import com.projectswg.common.encoding.StringType; import com.projectswg.common.network.NetBuffer; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline.BaselineType; -import network.packets.swg.zone.baselines.Baseline.BaselineType; import resources.objects.SWGObject; /** diff --git a/src/resources/collections/SWGSet.java b/src/resources/collections/SWGSet.java index 972885ede..1bfe377dd 100644 --- a/src/resources/collections/SWGSet.java +++ b/src/resources/collections/SWGSet.java @@ -44,8 +44,8 @@ import com.projectswg.common.encoding.Encodable; import com.projectswg.common.encoding.Encoder; import com.projectswg.common.encoding.StringType; import com.projectswg.common.network.NetBuffer; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline; -import network.packets.swg.zone.baselines.Baseline; import resources.objects.SWGObject; public class SWGSet extends CopyOnWriteArraySet implements Encodable { diff --git a/src/resources/combat/AttackInfo.java b/src/resources/combat/AttackInfo.java deleted file mode 100644 index 03c5e56de..000000000 --- a/src/resources/combat/AttackInfo.java +++ /dev/null @@ -1,239 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package resources.combat; - -public class AttackInfo { - - private boolean success = true; - private long armor = 0; - private int rawDamage = 0; - private DamageType damageType = DamageType.KINETIC; - private int elementalDamage = 0; - private DamageType elementalDamageType = DamageType.KINETIC; - private int bleedDamage = 0; - private int criticalDamage = 0; - private int blockedDamage = 0; - private int finalDamage = 0; - private HitLocation hitLocation = HitLocation.HIT_LOCATION_BODY; - private boolean crushing = false; - private boolean strikethrough = false; - private double strikethroughAmount = 0; - private boolean evadeResult = false; - private double evadeAmount = 0; - private boolean blockResult = false; - private int block = 0; - private boolean dodge = false; - private boolean parry = false; - private boolean critical = false; - private boolean glancing = false; - private boolean proc = false; - - public boolean isSuccess() { - return success; - } - - public long getArmor() { - return armor; - } - - public int getRawDamage() { - return rawDamage; - } - - public DamageType getDamageType() { - return damageType; - } - - public int getElementalDamage() { - return elementalDamage; - } - - public DamageType getElementalDamageType() { - return elementalDamageType; - } - - public int getBleedDamage() { - return bleedDamage; - } - - public int getCriticalDamage() { - return criticalDamage; - } - - public int getBlockedDamage() { - return blockedDamage; - } - - public int getFinalDamage() { - return finalDamage; - } - - public HitLocation getHitLocation() { - return hitLocation; - } - - public boolean isCrushing() { - return crushing; - } - - public boolean isStrikethrough() { - return strikethrough; - } - - public double getStrikethroughAmount() { - return strikethroughAmount; - } - - public boolean isEvadeResult() { - return evadeResult; - } - - public double getEvadeAmount() { - return evadeAmount; - } - - public boolean isBlockResult() { - return blockResult; - } - - public int getBlock() { - return block; - } - - public boolean isDodge() { - return dodge; - } - - public boolean isParry() { - return parry; - } - - public boolean isCritical() { - return critical; - } - - public boolean isGlancing() { - return glancing; - } - - public boolean isProc() { - return proc; - } - - public void setSuccess(boolean success) { - this.success = success; - } - - public void setArmor(long armor) { - this.armor = armor; - } - - public void setRawDamage(int rawDamage) { - this.rawDamage = rawDamage; - } - - public void setDamageType(DamageType damageType) { - this.damageType = damageType; - } - - public void setElementalDamage(int elementalDamage) { - this.elementalDamage = elementalDamage; - } - - public void setElementalDamageType(DamageType elementalDamageType) { - this.elementalDamageType = elementalDamageType; - } - - public void setBleedDamage(int bleedDamage) { - this.bleedDamage = bleedDamage; - } - - public void setCriticalDamage(int criticalDamage) { - this.criticalDamage = criticalDamage; - } - - public void setBlockedDamage(int blockedDamage) { - this.blockedDamage = blockedDamage; - } - - public void setFinalDamage(int finalDamage) { - this.finalDamage = finalDamage; - } - - public void setHitLocation(HitLocation hitLocation) { - this.hitLocation = hitLocation; - } - - public void setCrushing(boolean crushing) { - this.crushing = crushing; - } - - public void setStrikethrough(boolean strikethrough) { - this.strikethrough = strikethrough; - } - - public void setStrikethroughAmount(double strikethroughAmount) { - this.strikethroughAmount = strikethroughAmount; - } - - public void setEvadeResult(boolean evadeResult) { - this.evadeResult = evadeResult; - } - - public void setEvadeAmount(double evadeAmount) { - this.evadeAmount = evadeAmount; - } - - public void setBlockResult(boolean blockResult) { - this.blockResult = blockResult; - } - - public void setBlock(int block) { - this.block = block; - } - - public void setDodge(boolean dodge) { - this.dodge = dodge; - } - - public void setParry(boolean parry) { - this.parry = parry; - } - - public void setCritical(boolean critical) { - this.critical = critical; - } - - public void setGlancing(boolean glancing) { - this.glancing = glancing; - } - - public void setProc(boolean proc) { - this.proc = proc; - } -} diff --git a/src/resources/combat/AttackType.java b/src/resources/combat/AttackType.java deleted file mode 100644 index fef9976ef..000000000 --- a/src/resources/combat/AttackType.java +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package resources.combat; - -public enum AttackType { - CONE (0), - SINGLE_TARGET (1), - AREA (2), - TARGET_AREA (3), - DUAL_WIELD (4), - RAMPAGE (5), - RANDOM_HATE_TARGET (6), - RANDOM_HATE_TARGET_CONE (7), - RANDOM_HATE_TARGET_CONE_TERMINUS (8), - HATE_LIST (9), - RANDOM_HATE_MULTI (10), - AREA_PROGRESSIVE (11), - SPLIT_DAMAGE_TARGET_AREA (12), - DISTANCE_FARTHEST (13); - - private static final AttackType [] VALUES = values(); - - private int num; - - AttackType(int num) { - this.num = num; - } - - public int getNum() { - return num; - } - - public static AttackType getAttackType(int num) { - if (num < 0 || num >= VALUES.length) - return AttackType.SINGLE_TARGET; - return VALUES[num]; - } -} diff --git a/src/resources/combat/CombatStatus.java b/src/resources/combat/CombatStatus.java deleted file mode 100644 index ec228b885..000000000 --- a/src/resources/combat/CombatStatus.java +++ /dev/null @@ -1,37 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package resources.combat; - -public enum CombatStatus { - UNKNOWN, - INVALID_TARGET, - NO_WEAPON, - NO_TARGET, - TOO_FAR, - SUCCESS -} diff --git a/src/resources/combat/DamageType.java b/src/resources/combat/DamageType.java deleted file mode 100644 index e6aa40b45..000000000 --- a/src/resources/combat/DamageType.java +++ /dev/null @@ -1,72 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package resources.combat; - -import java.util.EnumSet; -import java.util.Set; - -public enum DamageType { - KINETIC (1), - ENERGY (2), - BLAST (4), - STUN (8), - RESTAINT (16), - ELEMENTAL_HEAT (32), - ELEMENTAL_COLD (64), - ELEMENTAL_ACID (128), - ELEMENTAL_ELECTRICAL (256); - - private static final DamageType [] VALUES = values(); - - private int num; - - DamageType(int num) { - this.num = num; - } - - public int getNum() { - return num; - } - - public static DamageType getDamageType(int num) { - for (DamageType type : VALUES) { - if ((num & type.getNum()) != 0) - return type; - } - return KINETIC; - } - - public static Set getDamageTypes(int num) { - Set types = EnumSet.noneOf(DamageType.class); - for (DamageType type : VALUES) { - if ((num & type.getNum()) != 0) - types.add(type); - } - return types; - } -} diff --git a/src/resources/combat/DelayAttackEggPosition.java b/src/resources/combat/DelayAttackEggPosition.java deleted file mode 100644 index bd51515f6..000000000 --- a/src/resources/combat/DelayAttackEggPosition.java +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package resources.combat; - -import java.util.HashMap; -import java.util.Map; - -public enum DelayAttackEggPosition { - LOCATION (1), - TARGET (2), - SELF (3); - - private static final Map EGG_POSITIONS = new HashMap<>(); - - static { - for(DelayAttackEggPosition eggPosition : values()) { - EGG_POSITIONS.put(eggPosition.getNum(), eggPosition); - } - } - - private final int num; - - DelayAttackEggPosition(int num) { - this.num = num; - } - - public int getNum() { - return num; - } - - public static DelayAttackEggPosition getEggPosition(int num) { - return EGG_POSITIONS.getOrDefault(num, SELF); - } -} \ No newline at end of file diff --git a/src/resources/combat/HitLocation.java b/src/resources/combat/HitLocation.java deleted file mode 100644 index 12731aea3..000000000 --- a/src/resources/combat/HitLocation.java +++ /dev/null @@ -1,56 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package resources.combat; - -public enum HitLocation { - HIT_LOCATION_BODY (0), - HIT_LOCATION_HEAD (1), - HIT_LOCATION_R_ARM (2), - HIT_LOCATION_L_ARM (3), - HIT_LOCATION_R_LEG (4), - HIT_LOCATION_L_LEG (5), - HIT_LOCATION_NUM_LOCATIONS (6); - - private static final HitLocation [] VALUES = values(); - - private int num; - - HitLocation(int num) { - this.num = num; - } - - public int getNum() { - return num; - } - - public static HitLocation getHitLocation(int num) { - if (num < 0 || num >= VALUES.length) - return HIT_LOCATION_BODY; - return VALUES[num]; - } -} diff --git a/src/resources/combat/HitType.java b/src/resources/combat/HitType.java deleted file mode 100644 index e1ab5a767..000000000 --- a/src/resources/combat/HitType.java +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package resources.combat; - -import java.util.HashMap; -import java.util.Map; - -public enum HitType { - ATTACK (-1), - BUFF (0), - DEBUFF (4), - HEAL (5), - DELAY_ATTACK (6), - REVIVE (7); - - private static final Map HIT_TYPES = new HashMap<>(); - - static { - for(HitType hitType : values()) { - HIT_TYPES.put(hitType.getNum(), hitType); - } - } - - private final int num; - - HitType(int num) { - this.num = num; - } - - public int getNum() { - return num; - } - - public static HitType getHitType(int num) { - return HIT_TYPES.getOrDefault(num, ATTACK); - } -} \ No newline at end of file diff --git a/src/resources/combat/TrailLocation.java b/src/resources/combat/TrailLocation.java deleted file mode 100644 index e8862db69..000000000 --- a/src/resources/combat/TrailLocation.java +++ /dev/null @@ -1,69 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package resources.combat; - -import java.util.EnumSet; -import java.util.Set; - -public enum TrailLocation { - LEFT_FOOT (0x01), - RIGHT_FOOT (0x02), - LEFT_HAND (0x04), - RIGHT_HAND (0x08), - WEAPON (0x10); - - private static final TrailLocation [] VALUES = values(); - - private int num; - - TrailLocation(int num) { - this.num = num; - } - - public int getNum() { - return num; - } - - public static TrailLocation getTrailLocation(int num) { - for (TrailLocation type : VALUES) { - if ((num & type.getNum()) != 0) - return type; - } - return WEAPON; - } - - public static Set getTrailLocations(int num) { - Set types = EnumSet.noneOf(TrailLocation.class); - for (TrailLocation type : VALUES) { - if ((num & type.getNum()) != 0) - types.add(type); - } - return types; - } - -} diff --git a/src/resources/combat/ValidTarget.java b/src/resources/combat/ValidTarget.java deleted file mode 100644 index eec92aaef..000000000 --- a/src/resources/combat/ValidTarget.java +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package resources.combat; - -public enum ValidTarget { - NONE (-1), - STANDARD(0), - MOB (1), - CREATURE(2), - NPC (3), - DROID (4), - PVP (5), - JEDI (6), - DEAD (7), - FRIEND (8); - - private static final ValidTarget [] VALUES = values(); - - private int num; - - ValidTarget(int num) { - this.num = num; - } - - public int getNum() { - return num; - } - - public static ValidTarget getValidTarget(int num) { - ++num; - if (num < 0 || num >= VALUES.length) - return STANDARD; - return VALUES[num]; - } - -} diff --git a/src/resources/commands/CombatCommand.java b/src/resources/commands/CombatCommand.java index 145fc20b6..9538d678b 100644 --- a/src/resources/commands/CombatCommand.java +++ b/src/resources/commands/CombatCommand.java @@ -30,11 +30,12 @@ package resources.commands; import java.util.HashMap; import java.util.Map; -import resources.combat.AttackType; -import resources.combat.DamageType; -import resources.combat.DelayAttackEggPosition; -import resources.combat.HitType; -import resources.combat.ValidTarget; +import com.projectswg.common.data.combat.AttackType; +import com.projectswg.common.data.combat.DamageType; +import com.projectswg.common.data.combat.DelayAttackEggPosition; +import com.projectswg.common.data.combat.HitType; +import com.projectswg.common.data.combat.ValidTarget; + import resources.objects.weapon.WeaponType; public class CombatCommand extends Command { diff --git a/src/resources/commands/callbacks/AttributesCmdCallback.java b/src/resources/commands/callbacks/AttributesCmdCallback.java index e81f33dab..b1d55581f 100644 --- a/src/resources/commands/callbacks/AttributesCmdCallback.java +++ b/src/resources/commands/callbacks/AttributesCmdCallback.java @@ -29,7 +29,8 @@ package resources.commands.callbacks; import java.util.Map; -import network.packets.swg.zone.spatial.AttributeListMessage; +import com.projectswg.common.network.packets.swg.zone.spatial.AttributeListMessage; + import resources.commands.ICmdCallback; import resources.objects.SWGObject; import resources.player.Player; diff --git a/src/resources/commands/callbacks/FindFriendCallback.java b/src/resources/commands/callbacks/FindFriendCallback.java index 6ef3c7312..59863b06c 100644 --- a/src/resources/commands/callbacks/FindFriendCallback.java +++ b/src/resources/commands/callbacks/FindFriendCallback.java @@ -30,13 +30,14 @@ package resources.commands.callbacks; import java.util.Locale; import java.util.Map; +import com.projectswg.common.data.encodables.oob.ProsePackage; +import com.projectswg.common.data.encodables.oob.StringId; +import com.projectswg.common.data.encodables.oob.waypoint.WaypointColor; import com.projectswg.common.data.location.Location; import intents.chat.SystemMessageIntent; import intents.object.ObjectCreatedIntent; import resources.commands.ICmdCallback; -import resources.encodables.ProsePackage; -import resources.encodables.StringId; import resources.objects.SWGObject; import resources.objects.player.PlayerObject; import resources.objects.waypoint.WaypointObject; @@ -90,7 +91,7 @@ public class FindFriendCallback implements ICmdCallback { if (waypoint == null) { waypoint = (WaypointObject) ObjectCreator.createObjectFromTemplate("object/waypoint/shared_waypoint.iff"); waypoint.setPosition(location.getTerrain(), location.getX(), location.getY(), location.getZ()); - waypoint.setColor(WaypointObject.WaypointColor.PURPLE); + waypoint.setColor(WaypointColor.PURPLE); waypoint.setName(friendName); ghost.addWaypoint(waypoint); new ObjectCreatedIntent(waypoint).broadcast(); diff --git a/src/resources/commands/callbacks/JumpCmdCallback.java b/src/resources/commands/callbacks/JumpCmdCallback.java index e102944fc..f2a61d855 100644 --- a/src/resources/commands/callbacks/JumpCmdCallback.java +++ b/src/resources/commands/callbacks/JumpCmdCallback.java @@ -27,7 +27,8 @@ ***********************************************************************************/ package resources.commands.callbacks; -import network.packets.swg.zone.object_controller.JumpUpdate; +import com.projectswg.common.network.packets.swg.zone.object_controller.JumpUpdate; + import resources.commands.ICmdCallback; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; diff --git a/src/resources/commands/callbacks/KneelCmdCallback.java b/src/resources/commands/callbacks/KneelCmdCallback.java index a4b09fbce..16c8ae451 100644 --- a/src/resources/commands/callbacks/KneelCmdCallback.java +++ b/src/resources/commands/callbacks/KneelCmdCallback.java @@ -27,8 +27,9 @@ ***********************************************************************************/ package resources.commands.callbacks; -import network.packets.swg.zone.object_controller.PostureUpdate; -import resources.Posture; +import com.projectswg.common.data.encodables.tangible.Posture; +import com.projectswg.common.network.packets.swg.zone.object_controller.PostureUpdate; + import resources.commands.ICmdCallback; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; diff --git a/src/resources/commands/callbacks/LogoutCmdCallback.java b/src/resources/commands/callbacks/LogoutCmdCallback.java index d408f4d71..8c5e6dccc 100644 --- a/src/resources/commands/callbacks/LogoutCmdCallback.java +++ b/src/resources/commands/callbacks/LogoutCmdCallback.java @@ -30,15 +30,15 @@ package resources.commands.callbacks; import java.util.concurrent.TimeUnit; import com.projectswg.common.control.IntentChain; +import com.projectswg.common.data.encodables.oob.ProsePackage; +import com.projectswg.common.data.encodables.oob.StringId; +import com.projectswg.common.data.encodables.tangible.Posture; import com.projectswg.common.debug.Assert; import com.projectswg.common.debug.Log; import intents.chat.SystemMessageIntent; import intents.connection.ForceLogoutIntent; -import resources.Posture; import resources.commands.ICmdCallback; -import resources.encodables.ProsePackage; -import resources.encodables.StringId; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; import resources.player.Player; diff --git a/src/resources/commands/callbacks/ProneCmdCallback.java b/src/resources/commands/callbacks/ProneCmdCallback.java index 08a985bb1..b4e0c3e38 100644 --- a/src/resources/commands/callbacks/ProneCmdCallback.java +++ b/src/resources/commands/callbacks/ProneCmdCallback.java @@ -27,8 +27,9 @@ ***********************************************************************************/ package resources.commands.callbacks; -import network.packets.swg.zone.object_controller.PostureUpdate; -import resources.Posture; +import com.projectswg.common.data.encodables.tangible.Posture; +import com.projectswg.common.network.packets.swg.zone.object_controller.PostureUpdate; + import resources.commands.ICmdCallback; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; diff --git a/src/resources/commands/callbacks/QaToolCmdCallback.java b/src/resources/commands/callbacks/QaToolCmdCallback.java index 55a377b28..c374b21b1 100644 --- a/src/resources/commands/callbacks/QaToolCmdCallback.java +++ b/src/resources/commands/callbacks/QaToolCmdCallback.java @@ -27,10 +27,9 @@ package resources.commands.callbacks; -import java.util.Map; - import com.projectswg.common.data.location.Location; import com.projectswg.common.data.location.Terrain; +import com.projectswg.common.data.sui.SuiEvent; import com.projectswg.common.debug.Log; import groovy.util.ResourceException; @@ -50,9 +49,7 @@ import resources.network.DisconnectReason; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; import resources.player.Player; -import resources.sui.ISuiCallback; import resources.sui.SuiButtons; -import resources.sui.SuiEvent; import resources.sui.SuiInputBox; import resources.sui.SuiListBox; import resources.sui.SuiMessageBox; @@ -109,7 +106,7 @@ public class QaToolCmdCallback implements ICmdCallback { if(command.length == 3) grantXp(player, command[1], command[2]); else - sendSystemMessage(player, "QATool XP: Expected format: /qatool xp "); + SystemMessageIntent.broadcastPersonal(player, "QATool XP: Expected format: /qatool xp "); break; default: displayMainWindow(player); @@ -127,15 +124,20 @@ public class QaToolCmdCallback implements ICmdCallback { SuiListBox window = new SuiListBox(SuiButtons.OK_CANCEL, TITLE, PROMPT); window.addListItem("Item Creator"); - window.addCallback("handleQaTool", new QaListBoxSuiCallback()); + window.addCallback("handleQaTool", (event, parameters) -> { + if (event != SuiEvent.OK_PRESSED || SuiListBox.getSelectedRow(parameters) != 0) + return; + + displayItemCreator(player); + }); window.display(player); } - private void displayItemCreator(Player creator) { + private void displayItemCreator(Player player) { SuiInputBox inputBox = new SuiInputBox(SuiButtons.OK_CANCEL, "Item Creator", "Enter the name of the item you wish to create"); - inputBox.addOkButtonCallback("handleCreateItem", (player, actor, event, parameters) -> handleCreateItem(player, SuiInputBox.getEnteredText(parameters))); - inputBox.addCancelButtonCallback("displayMainWindow", (player, actor, event, parameters) -> displayMainWindow(player)); - inputBox.display(creator); + inputBox.addOkButtonCallback("handleCreateItem", (event, parameters) -> handleCreateItem(player, SuiInputBox.getEnteredText(parameters))); + inputBox.addCancelButtonCallback("displayMainWindow", (event, parameters) -> displayMainWindow(player)); + inputBox.display(player); } /* Handlers */ @@ -170,7 +172,7 @@ public class QaToolCmdCallback implements ICmdCallback { private void forceDelete(final ObjectManager objManager, final Player player, final SWGObject target) { SuiMessageBox inputBox = new SuiMessageBox(SuiButtons.OK_CANCEL, "Force Delete?", "Are you sure you want to delete this object?"); - inputBox.addOkButtonCallback("handleDeleteObject", (caller, actor, event, parameters) -> { + inputBox.addOkButtonCallback("handleDeleteObject", (event, parameters) -> { if (target instanceof CreatureObject && ((CreatureObject) target).isPlayer()) { Log.i("[%s] Requested deletion of character: %s", player.getUsername(), target.getObjectName()); new DeleteCharacterIntent((CreatureObject) target).broadcast(); @@ -191,18 +193,18 @@ public class QaToolCmdCallback implements ICmdCallback { args = args.trim(); long recoveree = playerManager.getCharacterIdByFirstName(args); if (recoveree == 0) { - sendSystemMessage(player, "Could not find player by first name: '" + args + "'"); + SystemMessageIntent.broadcastPersonal(player, "Could not find player by first name: '" + args + "'"); return; } SWGObject obj = objectManager.getObjectById(recoveree); if (!(obj instanceof CreatureObject)) { - sendSystemMessage(player, "Object is not a creature: '" + args + "'"); + SystemMessageIntent.broadcastPersonal(player, "Object is not a creature: '" + args + "'"); return; } Location loc = new Location(3525, 4, -4807, Terrain.TATOOINE); new ObjectTeleportIntent(obj, loc).broadcast(); - sendSystemMessage(player, "Sucessfully teleported " + obj.getObjectName() + " to " + loc.getPosition()); + SystemMessageIntent.broadcastPersonal(player, "Sucessfully teleported " + obj.getObjectName() + " to " + loc.getPosition()); } private void setInstance(Player player, String args) { @@ -215,7 +217,7 @@ public class QaToolCmdCallback implements ICmdCallback { new ForceAwarenessUpdateIntent(creature).broadcast(); } catch (NumberFormatException e) { Log.e("Invalid instance number with qatool: %s", args); - sendSystemMessage(player, "Invalid call to qatool: '" + args + "' - invalid instance number"); + SystemMessageIntent.broadcastPersonal(player, "Invalid call to qatool: '" + args + "' - invalid instance number"); return; } } @@ -231,7 +233,7 @@ public class QaToolCmdCallback implements ICmdCallback { new ExperienceIntent(player.getCreatureObject(), xpType, xpGained).broadcast(); Log.i("XP command: %s gave themselves %d %s XP", player.getUsername(), xpGained, xpType); } catch (NumberFormatException e) { - sendSystemMessage(player, String.format("XP command: %s is not a number", xpGainedArg)); + SystemMessageIntent.broadcastPersonal(player, String.format("XP command: %s is not a number", xpGainedArg)); Log.e("XP command: %s gave a non-numerical XP gained argument of %s", player.getUsername(), xpGainedArg); } } @@ -242,27 +244,4 @@ public class QaToolCmdCallback implements ICmdCallback { new SuiMessageBox(SuiButtons.OK, title, prompt).display(player); } - private void sendSystemMessage(Player player, String message) { - new SystemMessageIntent(player, message).broadcast(); - } - - /* Callbacks */ - - private class QaListBoxSuiCallback implements ISuiCallback { - @Override - public void handleEvent(Player player, SWGObject actor, SuiEvent event, Map parameters) { - if (event != SuiEvent.OK_PRESSED) - return; - - int selection = SuiListBox.getSelectedRow(parameters); - - switch (selection) { - case 0: - displayItemCreator(player); - break; - default: - break; - } - } - } } diff --git a/src/resources/commands/callbacks/RequestBiographyCmdCallback.java b/src/resources/commands/callbacks/RequestBiographyCmdCallback.java index 90b9a3797..70b190f08 100644 --- a/src/resources/commands/callbacks/RequestBiographyCmdCallback.java +++ b/src/resources/commands/callbacks/RequestBiographyCmdCallback.java @@ -28,8 +28,8 @@ package resources.commands.callbacks; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.swg.zone.object_controller.BiographyUpdate; -import network.packets.swg.zone.object_controller.BiographyUpdate; import resources.commands.ICmdCallback; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; diff --git a/src/resources/commands/callbacks/RequestWaypointCmdCallback.java b/src/resources/commands/callbacks/RequestWaypointCmdCallback.java index a622b50ad..856accf28 100644 --- a/src/resources/commands/callbacks/RequestWaypointCmdCallback.java +++ b/src/resources/commands/callbacks/RequestWaypointCmdCallback.java @@ -27,12 +27,16 @@ ***********************************************************************************/ package resources.commands.callbacks; +import com.projectswg.common.data.encodables.oob.waypoint.WaypointColor; +import com.projectswg.common.data.location.Point3D; import com.projectswg.common.data.location.Terrain; +import intents.chat.SystemMessageIntent; import intents.object.ObjectCreatedIntent; import resources.commands.ICmdCallback; import resources.objects.SWGObject; -import resources.objects.player.PlayerObject; +import resources.objects.SpecificObject; +import resources.objects.creature.CreatureObject; import resources.objects.waypoint.WaypointObject; import resources.player.Player; import services.galaxy.GalacticManager; @@ -42,34 +46,51 @@ public class RequestWaypointCmdCallback implements ICmdCallback { @Override public void execute(GalacticManager galacticManager, Player player, SWGObject target, String args) { - // First parameter can be name of the planet or an int for the color - // Args: (^-,=+_)color_1(,+-=_^)=1 planet x 0.0 z - PlayerObject ghost = player.getPlayerObject(); - if (ghost == null) + String[] cmd = args.split(" "); + CreatureObject creature = player.getCreatureObject(); + long cellId = 0; + Point3D position = creature.getLocation().getPosition(); + Terrain terrain = creature.getTerrain(); + String expectedFormat = "/waypoint x y z"; + try { + switch (cmd.length) { + case 0: + cellId = (creature.getParent() != null) ? creature.getParent().getObjectId() : 0; + break; + case 3: // x y z + position.setX(Double.parseDouble(cmd[0])); + position.setY(Double.parseDouble(cmd[1])); + position.setZ(Double.parseDouble(cmd[2])); + break; + case 4: // terrain x y z + expectedFormat = "/waypoint terrain x y z"; + terrain = Terrain.getTerrainFromName(cmd[0]); + position.setX(Double.parseDouble(cmd[1])); + position.setY(Double.parseDouble(cmd[2])); + position.setZ(Double.parseDouble(cmd[3])); + break; + default: + SystemMessageIntent.broadcastPersonal(player, "Warning: unknown number of args: "+cmd.length+" - defaulting to 0 argument call to waypoint"); + break; + } + } catch (NumberFormatException e) { + SystemMessageIntent.broadcastPersonal(player, "Invalid call to waypoint [INVALID_NUMBER]! Expected: " + expectedFormat); return; - - String[] cmd = args.split(" ", 6); - WaypointObject.WaypointColor color = WaypointObject.WaypointColor.BLUE; - -/* if (cmd[0].contains("color_")) { - // Command is in color planet x y z name format - String colorId = cmd[0].substring(14, cmd[0].length() - 10); - color = WaypointObject.WaypointColor.values()[Integer.valueOf(colorId) - 1]; - }*/ - Terrain terrain = (color != null ? Terrain.getTerrainFromName(cmd[1]) : Terrain.getTerrainFromName(cmd[0])); - - double x = (color != null ? Double.valueOf(cmd[2]) : Double.valueOf(cmd[1])); - double y = (color != null ? Double.valueOf(cmd[3]) : Double.valueOf(cmd[2])); - double z = (color != null ? Double.valueOf(cmd[4]) : Double.valueOf(cmd[3])); - - String name = (cmd.length == 6 ? cmd[5] : "@planet_n:" + terrain.getName()); - - WaypointObject waypoint = (WaypointObject) ObjectCreator.createObjectFromTemplate("object/waypoint/shared_waypoint.iff"); - waypoint.setPosition(terrain, x, y, z); - waypoint.setName(name.isEmpty() ? "@planet_n:" + terrain.getName() : name); - if (color != null) - waypoint.setColor(color); - ghost.addWaypoint(waypoint); - new ObjectCreatedIntent(waypoint).broadcast(); + } + if (terrain == null) { + SystemMessageIntent.broadcastPersonal(player, "Invalid call to waypoint [INVALID_TERRAIN]! Expected: " + expectedFormat); + return; + } + createWaypoint(player, terrain, position, cellId); + } + + private static void createWaypoint(Player player, Terrain terrain, Point3D position, long cellId) { + WaypointObject waypoint = (WaypointObject) ObjectCreator.createObjectFromTemplate(SpecificObject.SO_WAYPOINT.getTemplate()); + waypoint.setPosition(terrain, position.getX(), position.getY(), position.getZ()); + waypoint.setCellId(cellId); + waypoint.setName("@planet_n:" + terrain.getName()); + waypoint.setColor(WaypointColor.BLUE); + player.getPlayerObject().addWaypoint(waypoint); + ObjectCreatedIntent.broadcast(waypoint); } } diff --git a/src/resources/commands/callbacks/ServerCmdCallback.java b/src/resources/commands/callbacks/ServerCmdCallback.java index c171f5b41..5f68e370a 100644 --- a/src/resources/commands/callbacks/ServerCmdCallback.java +++ b/src/resources/commands/callbacks/ServerCmdCallback.java @@ -27,7 +27,6 @@ ***********************************************************************************/ package resources.commands.callbacks; -import java.util.Map; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; @@ -38,9 +37,7 @@ import intents.server.ServerManagementIntent.ServerManagementEvent; import resources.commands.ICmdCallback; import resources.objects.SWGObject; import resources.player.Player; -import resources.sui.ISuiCallback; import resources.sui.SuiButtons; -import resources.sui.SuiEvent; import resources.sui.SuiInputBox; import resources.sui.SuiListBox; import resources.sui.SuiMessageBox; @@ -58,13 +55,7 @@ public class ServerCmdCallback implements ICmdCallback { listBox.addListItem("Shutdown Server - 15 Minutes"); listBox.addListItem("Shutdown Server - Custom Time"); - listBox.addOkButtonCallback("handleSelectedItem", new ServerSuiCallback()); - listBox.display(player); - } - - private static class ServerSuiCallback implements ISuiCallback { - @Override - public void handleEvent(Player player, SWGObject actor, SuiEvent event, Map parameters) { + listBox.addOkButtonCallback("handleSelectedItem", (event, parameters) -> { int selection = SuiListBox.getSelectedRow(parameters); switch(selection) { @@ -75,70 +66,70 @@ public class ServerCmdCallback implements ICmdCallback { case 4: handleCustomShutdownServer(player); break; default: Log.i("There is no handle function for selected list item %d", selection); break; } - } + }); + listBox.display(player); + } + + private static void handleKickPlayer(Player player) { + SuiInputBox window = new SuiInputBox(SuiButtons.OK_CANCEL, "Kick Player", "Enter the name of the player that you wish to KICK from the server."); + window.addOkButtonCallback("handleKickPlayer", (event, parameters) -> { + String name = SuiInputBox.getEnteredText(parameters); + new ServerManagementIntent(player, name, ServerManagementEvent.KICK).broadcast(); + }); + window.display(player); + } + + private static void handleBanPlayer(Player player) { + SuiInputBox window = new SuiInputBox(SuiButtons.OK_CANCEL, "Ban Player", "Enter the name of the player that you wish to BAN from the server."); + window.addOkButtonCallback("handleBanPlayer", (event, parameters) -> { + String name = SuiInputBox.getEnteredText(parameters); + new ServerManagementIntent(player, name, ServerManagementEvent.BAN).broadcast(); + }); + window.display(player); + } + + private static void handleUnbanPlayer(Player player) { + SuiInputBox window = new SuiInputBox(SuiButtons.OK_CANCEL, "Unban Player", "Enter the name of the player that you wish to UNBAN from the server."); + window.addOkButtonCallback("handleUnbanPlayer", (event, parameters) -> { + String name = SuiInputBox.getEnteredText(parameters); + new ServerManagementIntent(player, name, ServerManagementEvent.UNBAN).broadcast(); + }); + window.display(player); + } + + private static void handleShutdownServer(Player player) { + SuiMessageBox window = new SuiMessageBox(SuiButtons.YES_NO, "Shutdown Server", "Are you sure you wish to begin the shutdown sequence?"); + window.addOkButtonCallback("handleShutdownServer", (event, parameters) -> { + new ServerManagementIntent(15, TimeUnit.MINUTES, ServerManagementEvent.SHUTDOWN).broadcast(); + }); + window.display(player); + } + + private static void handleCustomShutdownServer(Player player) { + final SuiListBox unitWindow = new SuiListBox(SuiButtons.OK_CANCEL, "Shutdown Server", "Select the time unit that the time will be specified in. "); + final SuiInputBox timeWindow = new SuiInputBox(SuiButtons.OK_CANCEL, "Shutdown Server", "Enter the time until the server shuts down. The shutdown sequence " + "will begin upon hitting OK."); + final AtomicReference timeUnitReference = new AtomicReference<>(); + final TimeUnit[] unitValues = TimeUnit.values(); - private void handleKickPlayer(Player actor) { - SuiInputBox window = new SuiInputBox(SuiButtons.OK_CANCEL, "Kick Player", "Enter the name of the player that you wish to KICK from the server."); - window.addOkButtonCallback("handleKickPlayer", (player, actor1, event, parameters) -> { - String name = SuiInputBox.getEnteredText(parameters); - new ServerManagementIntent(player, name, ServerManagementEvent.KICK).broadcast(); - }); - window.display(actor); - } + timeWindow.allowStringCharacters(false); - private void handleBanPlayer(Player actor) { - SuiInputBox window = new SuiInputBox(SuiButtons.OK_CANCEL, "Ban Player", "Enter the name of the player that you wish to BAN from the server."); - window.addOkButtonCallback("handleBanPlayer", (player, actor1, event, parameters) -> { - String name = SuiInputBox.getEnteredText(parameters); - new ServerManagementIntent(player, name, ServerManagementEvent.BAN).broadcast(); - }); - window.display(actor); - } + // Ziggy: Add all the TimeUnit values as options + for (byte i = 0; i < unitValues.length; i++) + unitWindow.addListItem(unitValues[i].toString(), i); - private void handleUnbanPlayer(Player actor) { - SuiInputBox window = new SuiInputBox(SuiButtons.OK_CANCEL, "Unban Player", "Enter the name of the player that you wish to UNBAN from the server."); - window.addOkButtonCallback("handleUnbanPlayer", (player, actor1, event, parameters) -> { - String name = SuiInputBox.getEnteredText(parameters); - new ServerManagementIntent(player, name, ServerManagementEvent.UNBAN).broadcast(); - }); - window.display(actor); - } + unitWindow.addOkButtonCallback("handleCustomShutdownTime", (event, parameters) -> { + int index = SuiListBox.getSelectedRow(parameters); + if (index < 0 || index >= unitValues.length) + return; + timeUnitReference.set(unitValues[index]); + timeWindow.display(player); // Ziggy: Display the next window + }); - private void handleShutdownServer(Player actor) { - SuiMessageBox window = new SuiMessageBox(SuiButtons.YES_NO, "Shutdown Server", "Are you sure you wish to begin the shutdown sequence?"); - window.addOkButtonCallback("handleShutdownServer", (player, actor1, event, parameters) -> { - new ServerManagementIntent(15, TimeUnit.MINUTES, ServerManagementEvent.SHUTDOWN).broadcast(); - }); - window.display(actor); - } + timeWindow.addOkButtonCallback("handleCustomShutdownCountdown", (event, parameters) -> { + long countdown = Long.parseLong(SuiInputBox.getEnteredText(parameters)); + new ServerManagementIntent(countdown, timeUnitReference.get(), ServerManagementEvent.SHUTDOWN).broadcast(); + }); - private void handleCustomShutdownServer(Player actor) { - final SuiListBox unitWindow = new SuiListBox(SuiButtons.OK_CANCEL, "Shutdown Server", "Select the time unit that the time will be specified in. "); - final SuiInputBox timeWindow = new SuiInputBox(SuiButtons.OK_CANCEL, "Shutdown Server", "Enter the time until the server shuts down. The shutdown sequence " - + "will begin upon hitting OK."); - final AtomicReference timeUnitReference = new AtomicReference<>(); - final TimeUnit[] unitValues = TimeUnit.values(); - - timeWindow.allowStringCharacters(false); - - // Ziggy: Add all the TimeUnit values as options - for(byte i = 0; i < unitValues.length; i++) - unitWindow.addListItem(unitValues[i].toString(), i); - - unitWindow.addOkButtonCallback("handleCustomShutdownTime", (player, actor1, event, parameters) -> { - int index = SuiListBox.getSelectedRow(parameters); - if (index < 0 || index >= unitValues.length) - return; - timeUnitReference.set(unitValues[index]); - timeWindow.display(actor); // Ziggy: Display the next window - }); - - timeWindow.addOkButtonCallback("handleCustomShutdownCountdown", (player, actor1, event, parameters) -> { - long countdown = Long.parseLong(SuiInputBox.getEnteredText(parameters)); - new ServerManagementIntent(countdown, timeUnitReference.get(), ServerManagementEvent.SHUTDOWN).broadcast(); - }); - - unitWindow.display(actor); - } + unitWindow.display(player); } } diff --git a/src/resources/commands/callbacks/SitOnObjectCmdCallback.java b/src/resources/commands/callbacks/SitOnObjectCmdCallback.java index 0914fdaa4..601a0535b 100644 --- a/src/resources/commands/callbacks/SitOnObjectCmdCallback.java +++ b/src/resources/commands/callbacks/SitOnObjectCmdCallback.java @@ -27,10 +27,10 @@ ***********************************************************************************/ package resources.commands.callbacks; +import com.projectswg.common.data.encodables.tangible.Posture; import com.projectswg.common.data.location.Location; +import com.projectswg.common.network.packets.swg.zone.object_controller.SitOnObject; -import network.packets.swg.zone.object_controller.SitOnObject; -import resources.Posture; import resources.commands.ICmdCallback; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; diff --git a/src/resources/commands/callbacks/SocialInternalCmdCallback.java b/src/resources/commands/callbacks/SocialInternalCmdCallback.java index f52657c1d..27c490430 100644 --- a/src/resources/commands/callbacks/SocialInternalCmdCallback.java +++ b/src/resources/commands/callbacks/SocialInternalCmdCallback.java @@ -27,7 +27,8 @@ ***********************************************************************************/ package resources.commands.callbacks; -import network.packets.swg.zone.object_controller.PlayerEmote; +import com.projectswg.common.network.packets.swg.zone.object_controller.PlayerEmote; + import resources.commands.ICmdCallback; import resources.objects.SWGObject; import resources.player.Player; diff --git a/src/resources/commands/callbacks/StandCmdCallback.java b/src/resources/commands/callbacks/StandCmdCallback.java index efae2d8b9..8baaa194a 100644 --- a/src/resources/commands/callbacks/StandCmdCallback.java +++ b/src/resources/commands/callbacks/StandCmdCallback.java @@ -27,8 +27,9 @@ ***********************************************************************************/ package resources.commands.callbacks; -import network.packets.swg.zone.object_controller.PostureUpdate; -import resources.Posture; +import com.projectswg.common.data.encodables.tangible.Posture; +import com.projectswg.common.network.packets.swg.zone.object_controller.PostureUpdate; + import resources.commands.ICmdCallback; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; diff --git a/src/resources/commands/callbacks/StartDanceCallback.java b/src/resources/commands/callbacks/StartDanceCallback.java index d8e32f2b9..663282f50 100644 --- a/src/resources/commands/callbacks/StartDanceCallback.java +++ b/src/resources/commands/callbacks/StartDanceCallback.java @@ -29,7 +29,6 @@ package resources.commands.callbacks; import java.util.Locale; -import java.util.Map; import java.util.Set; import resources.commands.ICmdCallback; @@ -37,7 +36,6 @@ import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; import resources.player.Player; import resources.sui.SuiButtons; -import resources.sui.SuiEvent; import resources.sui.SuiListBox; import services.galaxy.GalacticManager; @@ -69,16 +67,13 @@ public class StartDanceCallback implements ICmdCallback { } } - listBox.addOkButtonCallback("handleSelectedItem", new resources.sui.ISuiCallback() { - @Override - public void handleEvent(Player player, SWGObject actor, SuiEvent event, Map parameters) { - int selection = SuiListBox.getSelectedRow(parameters); - String selectedDanceName = listBox.getListItem(selection).getName().toLowerCase(Locale.ENGLISH); - - new intents.DanceIntent(selectedDanceName, player.getCreatureObject(), changeDance).broadcast(); - } + listBox.addOkButtonCallback("handleSelectedItem", (event, parameters) -> { + int selection = SuiListBox.getSelectedRow(parameters); + String selectedDanceName = listBox.getListItem(selection).getName().toLowerCase(Locale.ENGLISH); + + new intents.DanceIntent(selectedDanceName, player.getCreatureObject(), changeDance).broadcast(); }); - + listBox.display(player); } else { new intents.DanceIntent(args, player.getCreatureObject(), changeDance).broadcast(); diff --git a/src/resources/commands/callbacks/WaypointCmdCallback.java b/src/resources/commands/callbacks/WaypointCmdCallback.java index 48aa76191..7640e8e59 100644 --- a/src/resources/commands/callbacks/WaypointCmdCallback.java +++ b/src/resources/commands/callbacks/WaypointCmdCallback.java @@ -27,6 +27,7 @@ ***********************************************************************************/ package resources.commands.callbacks; +import com.projectswg.common.data.encodables.oob.waypoint.WaypointColor; import com.projectswg.common.data.location.Location; import com.projectswg.common.data.location.Terrain; @@ -37,7 +38,6 @@ import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; import resources.objects.waypoint.WaypointObject; -import resources.objects.waypoint.WaypointObject.WaypointColor; import resources.player.Player; import services.galaxy.GalacticManager; import services.objects.ObjectCreator; diff --git a/src/resources/encodables/OutOfBandData.java b/src/resources/encodables/OutOfBandData.java deleted file mode 100644 index 6caf8ad25..000000000 --- a/src/resources/encodables/OutOfBandData.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ -package resources.encodables; - -import com.projectswg.common.encoding.Encodable; -import com.projectswg.common.persistable.Persistable; - -public interface OutOfBandData extends Encodable, Persistable { - - OutOfBandPackage.Type getOobType(); - int getOobPosition(); - -} diff --git a/src/resources/encodables/OutOfBandFactory.java b/src/resources/encodables/OutOfBandFactory.java deleted file mode 100644 index a7f832298..000000000 --- a/src/resources/encodables/OutOfBandFactory.java +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package resources.encodables; - -import com.projectswg.common.network.NetBufferStream; - -import resources.objects.waypoint.WaypointObject; -import resources.persistable.SWGObjectFactory; - -public class OutOfBandFactory { - - public static void save(OutOfBandData oob, NetBufferStream stream) { - if (oob instanceof StringId) - stream.addByte(1); - else if (oob instanceof ProsePackage) - stream.addByte(2); - else if (oob instanceof WaypointObject) { - stream.addByte(3); - SWGObjectFactory.save((WaypointObject) oob, stream); - return; - } else - throw new IllegalArgumentException("Unknown OOB data!"); - oob.save(stream); - } - - public static OutOfBandData create(NetBufferStream stream) { - OutOfBandData oob; - byte type = stream.getByte(); - switch (type) { - case 1: - oob = new StringId(); - break; - case 2: - oob = new ProsePackage(); - break; - case 3: - oob = (WaypointObject) SWGObjectFactory.create(stream); - return oob; - default: - throw new IllegalStateException("Unknown type byte! Type: " + type); - } - oob.read(stream); - return oob; - } - -} diff --git a/src/resources/encodables/OutOfBandPackage.java b/src/resources/encodables/OutOfBandPackage.java deleted file mode 100644 index d193ccfbb..000000000 --- a/src/resources/encodables/OutOfBandPackage.java +++ /dev/null @@ -1,187 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package resources.encodables; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import com.projectswg.common.data.EnumLookup; -import com.projectswg.common.debug.Log; -import com.projectswg.common.encoding.Encodable; -import com.projectswg.common.network.NetBuffer; -import com.projectswg.common.network.NetBufferStream; -import com.projectswg.common.persistable.Persistable; - -import resources.objects.SpecificObject; -import resources.objects.waypoint.WaypointObject; -import services.objects.ObjectCreator; - -public class OutOfBandPackage implements Encodable, Persistable { - - private final List packages; - - public OutOfBandPackage() { - packages = new ArrayList<>(); - } - - public OutOfBandPackage(OutOfBandData ... outOfBandData) { - this(); - Collections.addAll(packages, outOfBandData); - } - - public List getPackages() { - return packages; - } - - @Override - public byte[] encode() { - if (packages.isEmpty()) - return new byte[4]; - - int length = getLength(); - NetBuffer data = NetBuffer.allocate(length); - data.addInt((length-4) / 2); // Client treats this like a unicode string, so it's half the actual size of the array - for (OutOfBandData oob : packages) { - data.addRawArray(packOutOfBandData(oob)); - } - return data.array(); - } - - @Override - public void decode(NetBuffer data) { - int remaining = data.getInt() * 2; - while (remaining > 0) { - int start = data.position(); - int padding = data.getShort(); - Type type = Type.getTypeForByte(data.getByte()); - unpackOutOfBandData(data, type); - data.seek(padding); - remaining -= data.position() - start; - } - } - - @Override - public int getLength() { - int size = 4; - for (OutOfBandData oob : packages) { - size += getOOBLength(oob); - } - return size; - } - - @Override - public void save(NetBufferStream stream) { - stream.addList(packages, (p) -> OutOfBandFactory.save(p, stream)); - } - - @Override - public void read(NetBufferStream stream) { - stream.getList((i) -> packages.add(OutOfBandFactory.create(stream))); - } - - private void unpackOutOfBandData(NetBuffer data, Type type) { - // Position doesn't seem to be reflective of it's spot in the package list, not sure if this can be automated - // as the client will send -3 for multiple waypoints in a mail, so could be static for each OutOfBandData - // If that's the case, then we can move the position variable to the Type enum instead of a method return statement - data.getInt(); // position - OutOfBandData oob; - switch (type) { - case PROSE_PACKAGE: - oob = data.getEncodable(ProsePackage.class); - break; - case WAYPOINT: - oob = (WaypointObject) ObjectCreator.createObjectFromTemplate(SpecificObject.SO_WORLD_WAYPOINT.getTemplate()); - oob.decode(data); - break; - case STRING_ID: - oob = data.getEncodable(StringId.class); - break; - default: - Log.e("Tried to decode an unsupported OutOfBandData Type: " + type); - return; - } - packages.add(oob); - } - - private byte[] packOutOfBandData(OutOfBandData oob) { - // Type and position is included in the padding size - int paddingSize = getOOBPaddingSize(oob); - NetBuffer data = NetBuffer.allocate(getOOBLength(oob)); - data.addShort(paddingSize); // Number of bytes for decoding to skip over when reading - data.addByte(oob.getOobType().getType()); - data.addInt(oob.getOobPosition()); - data.addEncodable(oob); - for (int i = 0; i < paddingSize; i++) { - data.addByte(0); - } - - return data.array(); - } - - private int getOOBLength(OutOfBandData oob) { - return 7 + oob.getLength() + getOOBPaddingSize(oob); - } - - private int getOOBPaddingSize(OutOfBandData oob) { - return (oob.getLength() + 5) % 2; - } - - @Override - public String toString() { - return "OutOfBandPackage[packages=" + packages + "]"; - } - - public enum Type { - UNDEFINED (Byte.MIN_VALUE), - OBJECT (0), - PROSE_PACKAGE (1), - AUCTION_TOKEN (2), - OBJECT_ATTRIBUTES (3), - WAYPOINT (4), - STRING_ID (5), - STRING (6), - NUM_TYPES (7); - - private static final EnumLookup LOOKUP = new EnumLookup<>(Type.class, t -> t.getType()); - - private byte type; - - Type(int type) { - this.type = (byte) type; - } - - public byte getType() { - return type; - } - - public static Type getTypeForByte(byte typeByte) { - return LOOKUP.getEnum(typeByte, UNDEFINED); - } - } -} diff --git a/src/resources/encodables/ProsePackage.java b/src/resources/encodables/ProsePackage.java deleted file mode 100644 index b1ac3bca9..000000000 --- a/src/resources/encodables/ProsePackage.java +++ /dev/null @@ -1,359 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package resources.encodables; - -import java.math.BigInteger; - -import com.projectswg.common.debug.Assert; -import com.projectswg.common.debug.Log; -import com.projectswg.common.encoding.Encodable; -import com.projectswg.common.network.NetBuffer; -import com.projectswg.common.network.NetBufferStream; -import com.projectswg.common.persistable.Persistable; - -public class ProsePackage implements OutOfBandData { - - private StringId base; - private Prose actor; - private Prose target; - private Prose other; - private int di; // decimal integer - private float df; // decimal float - private boolean grammarFlag; - - public ProsePackage() { - this.base = new StringId("", ""); - this.actor = new Prose(); - this.target = new Prose(); - this.other = new Prose(); - this.di = 0; - this.df = 0; - this.grammarFlag = false; - } - - /** - * Creates a new ProsePackage that only specifies a StringId - * - * @param table Base stf table for this ProsePackage - * @param key The key for the provided table to use - */ - public ProsePackage(String table, String key) { - this(); - setStringId(new StringId(table, key)); - } - - /** - * Creates a new ProsePackage that contains only 1 parameter for the specified StringId object
- *
- * Example:
- *      ProsePackage("@base_player:prose_deposit_success", "DI", 500) - * - * @param stringId The base stringId for this ProsePackage - * @param proseKey The key in the message, can either be TU, TT, TO, or DI. - * @param prose Value to set for this key, instance depends on the key. - */ - public ProsePackage(StringId stringId, String proseKey, Object prose) { - this(); - setStringId(stringId); - setProse(proseKey, prose); - } - - /** - * Creates a new ProsePackage with multiple defined parameters. The first Object must be the prose key, followed by the keys value, and so on. If you're only setting 1 parameter, you should use the ProsePackage(key, prose) constructor instead.
- *
- * Example:
- *      ProsePackage("StringId", new StringId("base_player", "prose_deposit_success"), "DI", 500) - * - * @param objects Key followed by the value. Can either be STF, TU, TT, TO, or DI. - */ - public ProsePackage(Object ... objects) { - this(); - int length = objects.length; - for (int i = 0; i < length - 1; i++) { - if (!(objects[i] instanceof String)) // Make sure that it's a key, chance of it being a customString though - continue; - - setProse((String) objects[i], objects[i + 1]); - } - } - - private void setProse(String key, Object prose) { - switch (key) { - case "StringId": - setStringId(prose); - break; - case "TU": - setTU(prose); - break; - case "TT": - setTT(prose); - break; - case "TO": - setTO(prose); - break; - case "DI": - if (prose instanceof Integer) - setDI((Integer) prose); - else { - Log.w("DI can only be a Integer!"); - } - break; - case "DF": - if (prose instanceof Float) - setDF((Float) prose); - else { - Log.w("DF can only be a Float!"); - } - break; - default: - break; - - } - } - - public void setStringId(Object prose) { - if (prose instanceof StringId) { - base = (StringId) prose; - } else if (prose instanceof String) { - if (((String) prose).startsWith("@")) { - base = new StringId((String) prose); - } else { - Log.w("The base STF cannot be a custom string!"); - } - } else { - Log.w("The base STF must be either a Stf or a String! Received class: " + prose.getClass().getName()); - } - } - - public void setTU(Object prose) { - setProse(actor, prose); - } - - public void setTT(Object prose) { - setProse(target, prose); - } - - public void setTO(Object prose) { - setProse(other, prose); - } - - public void setDI(Integer prose) { - di = prose; - } - - public void setDF(Float prose) { - df = prose; - } - - public void setGrammarFlag(boolean useGrammar) { - grammarFlag = useGrammar; - } - - private void setProse(Prose prose, Object obj) { - if (obj instanceof StringId) { - prose.setStringId((StringId) obj); - } else if (obj instanceof String) { - if (((String) obj).startsWith("@")) { - prose.setStringId(new StringId((String) obj)); - } else { - prose.setText((String) obj); - } - } else if (obj instanceof Long) { - prose.setObjectId((Long) obj); - } else if (obj instanceof BigInteger) { - prose.setObjectId(((BigInteger) obj).longValue()); - } else { - Log.w("Proses can only be Strings or Longs! Received class: " + prose.getClass().getName()); - } - } - - @Override - public byte[] encode() { - Assert.notNull(base, "There must be a StringId base!"); - NetBuffer data = NetBuffer.allocate(getLength()); - data.addEncodable(base); - data.addEncodable(actor); - data.addEncodable(target); - data.addEncodable(other); - data.addInt(di); - data.addFloat(df); - data.addBoolean(grammarFlag); - return data.array(); - } - - @Override - public void decode(NetBuffer data) { - base = data.getEncodable(StringId.class); - actor = data.getEncodable(Prose.class); - target = data.getEncodable(Prose.class); - other = data.getEncodable(Prose.class); - di = data.getInt(); - df = data.getInt(); - grammarFlag = data.getBoolean(); - } - - @Override - public int getLength() { - return 9 + base.getLength() + actor.getLength() + target.getLength() + other.getLength(); - } - - @Override - public void save(NetBufferStream stream) { - stream.addByte(0); - base.save(stream); - actor.save(stream); - target.save(stream); - other.save(stream); - stream.addBoolean(grammarFlag); - stream.addInt(di); - stream.addFloat(df); - } - - @Override - public void read(NetBufferStream stream) { - stream.getByte(); - base.read(stream); - actor.read(stream); - target.read(stream); - other.read(stream); - grammarFlag = stream.getBoolean(); - di = stream.getInt(); - df = stream.getFloat(); - } - - @Override - public OutOfBandPackage.Type getOobType() { - return OutOfBandPackage.Type.PROSE_PACKAGE; - } - - @Override - public int getOobPosition() { - return -1; - } - - @Override - public String toString() { - return "ProsePackage[base=" + base + ", grammarFlag=" + grammarFlag + ", actor=" + actor + ", target=" + target + ", other=" + other + ", di=" + di + ", df=" + df + "]"; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof ProsePackage)) - return false; - ProsePackage pp = (ProsePackage) o; - return base.equals(pp.base) && actor.equals(pp.actor) && target.equals(pp.target) && other.equals(pp.other) && grammarFlag == pp.grammarFlag && di == pp.di && df == pp.df; - } - - @Override - public int hashCode() { - return base.hashCode() * 3 + actor.hashCode() * 7 + target.hashCode() * 13 + other.hashCode() * 17 + (grammarFlag ? 1 : 0) + di * 19 + ((int) (df * 23)); - } - - public static class Prose implements Encodable, Persistable { - - private long objectId; - private StringId stringId; - private String text; - - public Prose() { - this.objectId = 0; - this.stringId = new StringId("", ""); - this.text = ""; - } - - public void setObjectId(long objectId) { - this.objectId = objectId; - } - - public void setStringId(StringId stringId) { - Assert.notNull(stringId, "StringId cannot be null!"); - this.stringId = stringId; - } - - public void setText(String text) { - Assert.notNull(text, "Text cannot be null!"); - this.text = text; - } - - @Override - public byte[] encode() { - NetBuffer data = NetBuffer.allocate(getLength()); - data.addLong(objectId); - data.addEncodable(stringId); - data.addUnicode(text); - return data.array(); - } - - @Override - public void decode(NetBuffer data) { - objectId = data.getLong(); - stringId = data.getEncodable(StringId.class); - text = data.getUnicode(); - } - - @Override - public int getLength() { - return 12 + stringId.getLength() + text.length()*2; - } - - @Override - public void save(NetBufferStream stream) { - stream.addByte(0); - stringId.save(stream); - stream.addLong(objectId); - stream.addUnicode(text); - } - - @Override - public void read(NetBufferStream stream) { - stream.getByte(); - stringId.read(stream); - objectId = stream.getLong(); - text = stream.getUnicode(); - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof Prose)) - return false; - Prose p = (Prose) o; - return stringId.equals(p.stringId) && objectId == p.objectId && text.equals(p.text); - } - - @Override - public int hashCode() { - return stringId.hashCode() * 3 + Long.hashCode(objectId) * 7 + text.hashCode() * 13; - } - - @Override - public String toString() { - return "Prose[objectId=" + objectId + ", stringId=" + stringId + ", text='" + text + "']"; - } - } - -} diff --git a/src/resources/encodables/StringId.java b/src/resources/encodables/StringId.java deleted file mode 100644 index 3cad1e9e8..000000000 --- a/src/resources/encodables/StringId.java +++ /dev/null @@ -1,140 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package resources.encodables; - -import com.projectswg.common.debug.Log; -import com.projectswg.common.network.NetBuffer; -import com.projectswg.common.network.NetBufferStream; -import com.projectswg.common.persistable.Persistable; - -public class StringId implements OutOfBandData, Persistable { - - private String key = ""; - private String file = ""; - - public StringId() { - - } - - public StringId(String file, String key) { - this.file = file; - this.key = key; - } - - public StringId(String stf) { - if (!stf.contains(":")) { - Log.e("Invalid stf format! Expected a semi-colon for " + stf); - return; - } - - if (stf.startsWith("@")) - stf = stf.substring(1); - - String[] split = stf.split(":", 2); - file = split[0]; - - if (split.length == 2) - key = split[1]; - } - - @Override - public byte[] encode() { - NetBuffer buffer = NetBuffer.allocate(getLength()); - buffer.addAscii(file); - buffer.addInt(0); - buffer.addAscii(key); - return buffer.array(); - } - - @Override - public void decode(NetBuffer data) { - file = data.getAscii(); - data.getInt(); - key = data.getAscii(); - } - - @Override - public int getLength() { - return 8 + key.length() + file.length(); - } - - @Override - public void save(NetBufferStream stream) { - stream.addAscii(file); - stream.addAscii(key); - } - - @Override - public void read(NetBufferStream stream) { - file = stream.getAscii(); - key = stream.getAscii(); - } - - @Override - public OutOfBandPackage.Type getOobType() { - return OutOfBandPackage.Type.STRING_ID; - } - - @Override - public int getOobPosition() { - return -1; - } - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getFile() { - return file; - } - - public void setFile(String file) { - this.file = file; - } - - @Override - public String toString() { - return "@" + file + ":" + key; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof StringId)) - return false; - return ((StringId) o).getKey().equals(getKey()) && ((StringId) o).getFile().equals(getFile()); - } - - @Override - public int hashCode() { - return key.hashCode() * 67 + file.hashCode(); - } -} diff --git a/src/resources/encodables/player/Equipment.java b/src/resources/encodables/player/Equipment.java deleted file mode 100644 index c5bf2518b..000000000 --- a/src/resources/encodables/player/Equipment.java +++ /dev/null @@ -1,192 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package resources.encodables.player; - -import com.projectswg.common.data.CRC; -import com.projectswg.common.debug.Log; -import com.projectswg.common.encoding.Encodable; -import com.projectswg.common.network.NetBuffer; -import com.projectswg.common.network.NetBufferStream; -import com.projectswg.common.persistable.Persistable; - -import network.packets.swg.zone.baselines.Baseline; -import resources.objects.SWGObject; -import resources.objects.tangible.TangibleObject; -import resources.objects.weapon.WeaponObject; -import resources.persistable.SWGObjectFactory; -import services.objects.ObjectCreator; - -public class Equipment implements Encodable, Persistable { - - private TangibleObject weapon; - private byte[] customizationString; - private int arrangementId; - private long objectId; - private CRC template; - - public Equipment() { - this(0, "", 4); - } - - public Equipment(SWGObject obj) { - this(obj.getObjectId(), obj.getTemplate(), obj.getSlotArrangement()); - if (obj instanceof WeaponObject) - this.weapon = (WeaponObject) obj; - } - - private Equipment(long objectId, String template, int arrangementId) { - this.objectId = objectId; - this.template = new CRC(template); - this.customizationString = new byte[0]; - this.arrangementId = 4; - this.weapon = null; - } - - @Override - public byte [] encode() { - boolean hasWeapon = weapon != null; - byte [] weaponData = hasWeapon ? getWeaponData() : new byte[0]; - NetBuffer buffer = NetBuffer.allocate(getLength(weaponData.length)); - buffer.addArray(customizationString); // TODO: Create encodable class for customization string - buffer.addInt(arrangementId); - buffer.addLong(objectId); - buffer.addEncodable(template); - buffer.addBoolean(hasWeapon); - buffer.addRawArray(weaponData); - return buffer.array(); - } - - @Override - public void decode(NetBuffer data) { - customizationString = data.getArray(); // TODO: Create encodable class for customization string - arrangementId = data.getInt(); - objectId = data.getLong(); - template = data.getEncodable(CRC.class); - if (data.getBoolean()) - this.weapon = createWeaponFromData(data); - } - - @Override - public int getLength() { - boolean hasWeapon = weapon != null; - int weaponLength = hasWeapon ? getWeaponData().length : 0; - return getLength(weaponLength); - } - - private int getLength(int weaponLength) { - return 15 + weaponLength + customizationString.length + template.getLength(); - } - - @Override - public void save(NetBufferStream stream) { - stream.addByte(0); - stream.addLong(objectId); - stream.addInt(arrangementId); - stream.addInt(template.getCrc()); - stream.addArray(customizationString); - stream.addBoolean(weapon != null); - if (weapon != null) - SWGObjectFactory.save(weapon, stream); - } - - @Override - public void read(NetBufferStream stream) { - stream.getByte(); - objectId = stream.getLong(); - arrangementId = stream.getInt(); - template = new CRC(stream.getInt()); - customizationString = stream.getArray(); - if (stream.getBoolean()) - weapon = (TangibleObject) SWGObjectFactory.create(stream); - } - - public byte [] getCustomizationString() {return customizationString;} - public void setCustomizationString(byte [] customizationString) { this.customizationString = customizationString; } - - public int getArrangementId() { return arrangementId; } - public void setArrangementId(int arrangementId) { this.arrangementId = arrangementId; } - - public long getObjectId() { return objectId; } - public void setObjectId(long objectId) { this.objectId = objectId; } - - public String getTemplate() { return template.getString(); } - public void setTemplate(String template) { this.template = new CRC(template); } - - public TangibleObject getWeapon() { return weapon; } - public void setWeapon(TangibleObject weapon) { this.weapon = weapon; } - - private byte[] getWeaponData() { - if (weapon == null) - return new byte[0]; - NetBuffer data3 = weapon.createBaseline3(null).encode(); - NetBuffer data6 = weapon.createBaseline6(null).encode(); - - int data3Size = data3.limit(); - int data6Size = data6.limit(); - byte [] ret = new byte[data3Size + data6Size]; - System.arraycopy(data3.array(), 0, ret, 0, data3Size); - System.arraycopy(data6.array(), 0, ret, data3Size, data6Size); - return ret; - } - - private TangibleObject createWeaponFromData(NetBuffer data) { - SWGObject weapon = ObjectCreator.createObjectFromTemplate(objectId, template.getString()); - - Baseline b3 = new Baseline(); - b3.decode(data); - Baseline b6 = new Baseline(); - b6.decode(data); - - weapon.parseBaseline(b3); - weapon.parseBaseline(b6); - if (weapon instanceof TangibleObject) - return (TangibleObject) weapon; - Log.e("Unknown Equipment Type: " + weapon.getClass().getSimpleName()); - return null; - } - - @Override - public String toString() { - if (weapon != null) - return "Equipment: " + weapon; - return "Equipment: " + template; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof Equipment)) - return false; - - return ((Equipment) o).getObjectId() == objectId; - } - - @Override - public int hashCode() { - return Long.hashCode(objectId); - } -} diff --git a/src/resources/encodables/player/Mail.java b/src/resources/encodables/player/Mail.java deleted file mode 100644 index 31e76fa4b..000000000 --- a/src/resources/encodables/player/Mail.java +++ /dev/null @@ -1,200 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package resources.encodables.player; - -import com.projectswg.common.encoding.Encodable; -import com.projectswg.common.network.NetBuffer; -import com.projectswg.common.network.NetBufferStream; -import com.projectswg.common.persistable.Persistable; - -import resources.encodables.OutOfBandPackage; - -public class Mail implements Encodable, Persistable { - - private int id; - private String sender; - private long receiverId; - private String subject; - private String message; - private OutOfBandPackage outOfBandPackage; - private byte status; - private int timestamp; - - public static final byte NEW = 0x4E; - public static final byte READ = 0x52; - public static final byte UNREAD = 0x55; - - public Mail(String sender, String subject, String message, long receiverId) { - this.sender = sender; - this.subject = subject; - this.message = message; - this.receiverId = receiverId; - this.status = NEW; - this.outOfBandPackage = null; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getSender() { - return sender; - } - - public void setSender(String sender) { - this.sender = sender; - } - - public long getReceiverId() { - return receiverId; - } - - public String getSubject() { - return subject; - } - - public String getMessage() { - return message; - } - - public byte getStatus() { - return status; - } - - public void setStatus(byte status) { - this.status = status; - } - - public int getTimestamp() { - return timestamp; - } - - public void setTimestamp(int timestamp) { - this.timestamp = timestamp; - } - - public OutOfBandPackage getOutOfBandPackage() { - return outOfBandPackage; - } - - public void setOutOfBandPackage(OutOfBandPackage outOfBandPackage) { - this.outOfBandPackage = outOfBandPackage; - } - - @Override - public byte[] encode() { - NetBuffer data = NetBuffer.allocate(getLength()); - data.addUnicode(message); - data.addUnicode(subject); - data.addEncodable(outOfBandPackage); - return data.array(); - } - - @Override - public void decode(NetBuffer data) { - message = data.getUnicode(); - subject = data.getUnicode(); - outOfBandPackage = data.getEncodable(OutOfBandPackage.class); - } - - @Override - public int getLength() { - return 8 + message.length()*2 + subject.length()*2 + outOfBandPackage.getLength(); - } - - @Override - public void save(NetBufferStream stream) { - stream.addByte(0); - stream.addByte(status); - stream.addInt(id); - stream.addInt(timestamp); - stream.addLong(receiverId); - stream.addUnicode(sender); - stream.addUnicode(subject); - stream.addUnicode(message); - stream.addBoolean(outOfBandPackage != null); - if (outOfBandPackage != null) - outOfBandPackage.save(stream); - } - - @Override - public void read(NetBufferStream stream) { - stream.getByte(); - status = stream.getByte(); - id = stream.getInt(); - timestamp = stream.getInt(); - receiverId = stream.getLong(); - sender = stream.getUnicode(); - subject = stream.getUnicode(); - message = stream.getUnicode(); - if (stream.getBoolean()) { - outOfBandPackage = new OutOfBandPackage(); - outOfBandPackage.read(stream); - } - } - - @Override - public int hashCode() { - return id; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof Mail)) - return false; - return ((Mail) o).id == id; - } - - public byte[] encodeHeader() { - NetBuffer data = NetBuffer.allocate(12 + subject.length() * 2); - data.addInt(0); - data.addUnicode(subject); - data.addInt(0); - return data.array(); - } - - public void decodeHeader(NetBuffer data) { - data.getInt(); - subject = data.getUnicode(); - data.getInt(); - } - - public static Mail create(NetBufferStream stream) { - Mail m = new Mail("", "", "", 0); - m.read(stream); - return m; - } - - public static void saveMail(Mail m, NetBufferStream stream) { - m.save(stream); - } -} diff --git a/src/resources/network/BaselineBuilder.java b/src/resources/network/BaselineBuilder.java index 800f4f8e3..ac363bf21 100644 --- a/src/resources/network/BaselineBuilder.java +++ b/src/resources/network/BaselineBuilder.java @@ -30,19 +30,20 @@ package resources.network; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import com.projectswg.common.debug.Log; import com.projectswg.common.encoding.Encodable; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline.BaselineType; -import network.packets.swg.zone.baselines.Baseline; -import network.packets.swg.zone.baselines.Baseline.BaselineType; import resources.objects.SWGObject; import resources.player.Player; public class BaselineBuilder { - public static final Charset ASCII = Charset.forName("UTF-8"); - public static final Charset UNICODE = Charset.forName("UTF-16LE"); + public static final Charset ASCII = StandardCharsets.UTF_8; + public static final Charset UNICODE = StandardCharsets.UTF_16LE; private SWGObject object; private BaselineType type; diff --git a/src/resources/network/BaselineObject.java b/src/resources/network/BaselineObject.java index b60f16574..3fd9a30bc 100644 --- a/src/resources/network/BaselineObject.java +++ b/src/resources/network/BaselineObject.java @@ -38,10 +38,10 @@ import java.util.List; import com.projectswg.common.debug.Log; import com.projectswg.common.encoding.StringType; import com.projectswg.common.network.NetBuffer; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline.BaselineType; import com.projectswg.common.utilities.ByteUtilities; -import network.packets.swg.zone.baselines.Baseline; -import network.packets.swg.zone.baselines.Baseline.BaselineType; import resources.config.ConfigFile; import resources.objects.SWGObject; import resources.player.Player; diff --git a/src/resources/network/DeltaBuilder.java b/src/resources/network/DeltaBuilder.java index c23ba6d05..0747f8b82 100644 --- a/src/resources/network/DeltaBuilder.java +++ b/src/resources/network/DeltaBuilder.java @@ -29,9 +29,9 @@ package resources.network; import com.projectswg.common.encoding.Encoder; import com.projectswg.common.encoding.StringType; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline.BaselineType; +import com.projectswg.common.network.packets.swg.zone.deltas.DeltasMessage; -import network.packets.swg.zone.baselines.Baseline.BaselineType; -import network.packets.swg.zone.deltas.DeltasMessage; import resources.objects.SWGObject; import resources.player.Player; import resources.player.PlayerState; diff --git a/src/resources/network/UDPServer.java b/src/resources/network/UDPServer.java index 06f798175..de3379e28 100644 --- a/src/resources/network/UDPServer.java +++ b/src/resources/network/UDPServer.java @@ -41,7 +41,7 @@ import com.projectswg.common.debug.Log; /** - * This class represents a UDP server that listens for packets and + * This class represents a UDP server that listens for SWGPackets and * will call the callback when it receives one */ public class UDPServer { @@ -51,7 +51,7 @@ public class UDPServer { private final DatagramSocket socket; private final UDPUpdater updater; private final Queue inbound; - private final int packetSize; + private final int SWGPacketSize; private UDPCallback callback; private int port; @@ -59,13 +59,13 @@ public class UDPServer { this(port, 1024); } - public UDPServer(int port, int packetSize) throws SocketException { - this(null, port, packetSize); + public UDPServer(int port, int SWGPacketSize) throws SocketException { + this(null, port, SWGPacketSize); } - public UDPServer(InetAddress bindAddr, int port, int packetSize) throws SocketException { + public UDPServer(InetAddress bindAddr, int port, int SWGPacketSize) throws SocketException { this.callback = null; - this.packetSize = packetSize; + this.SWGPacketSize = SWGPacketSize; inbound = new LinkedBlockingQueue(); if (port > 0) { if (bindAddr == null) @@ -90,7 +90,7 @@ public class UDPServer { return inbound.poll(); } - public int packetCount() { + public int SWGPacketCount() { return inbound.size(); } @@ -168,7 +168,7 @@ public class UDPServer { } public interface UDPCallback { - public void onReceivedPacket(UDPPacket packet); + public void onReceivedPacket(UDPPacket SWGPacket); } public static class UDPPacket { @@ -208,7 +208,7 @@ public class UDPServer { public UDPUpdater() { thread = new Thread(this); thread.setName("UDPServer Port#" + port); - dataBuffer = new byte[packetSize]; + dataBuffer = new byte[SWGPacketSize]; } public boolean isRunning() { @@ -237,10 +237,10 @@ public class UDPServer { } private void loop() { - DatagramPacket packet = receivePacket(); - if (packet.getLength() <= 0) + DatagramPacket SWGPacket = receivePacket(); + if (SWGPacket.getLength() <= 0) return; - UDPPacket udpPacket = generatePacket(packet); + UDPPacket udpPacket = generatePacket(SWGPacket); if (callback != null) callback.onReceivedPacket(udpPacket); else @@ -255,23 +255,23 @@ public class UDPServer { } private DatagramPacket receivePacket() { - DatagramPacket packet = new DatagramPacket(dataBuffer, dataBuffer.length); + DatagramPacket SWGPacket = new DatagramPacket(dataBuffer, dataBuffer.length); try { - socket.receive(packet); + socket.receive(SWGPacket); } catch (IOException e) { if (e.getMessage() != null && (e.getMessage().contains("socket closed") || e.getMessage().contains("Socket closed"))) running = false; else Log.e(e); - packet.setLength(0); + SWGPacket.setLength(0); } - return packet; + return SWGPacket; } - private UDPPacket generatePacket(DatagramPacket packet) { - byte [] data = new byte[packet.getLength()]; - System.arraycopy(packet.getData(), 0, data, 0, packet.getLength()); - UDPPacket udpPacket = new UDPPacket(packet.getAddress(), packet.getPort(), data); + private UDPPacket generatePacket(DatagramPacket SWGPacket) { + byte [] data = new byte[SWGPacket.getLength()]; + System.arraycopy(SWGPacket.getData(), 0, data, 0, SWGPacket.getLength()); + UDPPacket udpPacket = new UDPPacket(SWGPacket.getAddress(), SWGPacket.getPort(), data); return udpPacket; } diff --git a/src/resources/objects/SWGObject.java b/src/resources/objects/SWGObject.java index 4a698d3dd..bb33876d5 100644 --- a/src/resources/objects/SWGObject.java +++ b/src/resources/objects/SWGObject.java @@ -44,6 +44,7 @@ import java.util.stream.Collectors; import com.projectswg.common.concurrency.SynchronizedMap; import com.projectswg.common.data.CRC; +import com.projectswg.common.data.encodables.oob.StringId; import com.projectswg.common.data.location.Location; import com.projectswg.common.data.location.Terrain; import com.projectswg.common.data.swgfile.visitors.ObjectData.ObjectDataAttribute; @@ -51,18 +52,17 @@ import com.projectswg.common.debug.Assert; import com.projectswg.common.debug.Log; import com.projectswg.common.network.NetBuffer; import com.projectswg.common.network.NetBufferStream; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.zone.SceneCreateObjectByCrc; +import com.projectswg.common.network.packets.swg.zone.SceneDestroyObject; +import com.projectswg.common.network.packets.swg.zone.SceneEndBaselines; +import com.projectswg.common.network.packets.swg.zone.UpdateContainmentMessage; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline.BaselineType; import com.projectswg.common.persistable.Persistable; import intents.object.ContainerTransferIntent; -import network.packets.Packet; -import network.packets.swg.zone.SceneCreateObjectByCrc; -import network.packets.swg.zone.SceneDestroyObject; -import network.packets.swg.zone.SceneEndBaselines; -import network.packets.swg.zone.UpdateContainmentMessage; -import network.packets.swg.zone.baselines.Baseline.BaselineType; import resources.containers.ContainerPermissionsType; import resources.containers.ContainerResult; -import resources.encodables.StringId; import resources.location.InstanceLocation; import resources.location.InstanceType; import resources.network.BaselineBuilder; @@ -859,26 +859,26 @@ public abstract class SWGObject extends BaselineObject implements Comparable { - new GroupEventIntent(GroupEventType.GROUP_LEAVE,leavingPlayer).broadcast(); + SuiMessageBox window = new SuiMessageBox(SuiButtons.OK_LEAVE_GROUP, "@group:loot_changed", "@group:" + lootRuleMsg); + window.addCancelButtonCallback("handleLeaveGroup", (event, parameters) -> { + new GroupEventIntent(GroupEventType.GROUP_LEAVE, memberPlayer).broadcast(); }); window.display(memberPlayer); } diff --git a/src/resources/objects/guild/GuildObject.java b/src/resources/objects/guild/GuildObject.java index c86da881e..8a73f9588 100644 --- a/src/resources/objects/guild/GuildObject.java +++ b/src/resources/objects/guild/GuildObject.java @@ -30,8 +30,8 @@ package resources.objects.guild; import com.projectswg.common.encoding.Encodable; import com.projectswg.common.encoding.StringType; import com.projectswg.common.network.NetBuffer; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline.BaselineType; -import network.packets.swg.zone.baselines.Baseline.BaselineType; import resources.collections.SWGMap; import resources.collections.SWGSet; import resources.network.BaselineBuilder; diff --git a/src/resources/objects/installation/InstallationObject.java b/src/resources/objects/installation/InstallationObject.java index 8ce4ef2bc..ce614e16b 100644 --- a/src/resources/objects/installation/InstallationObject.java +++ b/src/resources/objects/installation/InstallationObject.java @@ -29,8 +29,8 @@ package resources.objects.installation; import com.projectswg.common.network.NetBuffer; import com.projectswg.common.network.NetBufferStream; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline.BaselineType; -import network.packets.swg.zone.baselines.Baseline.BaselineType; import resources.network.BaselineBuilder; import resources.objects.tangible.TangibleObject; import resources.player.Player; diff --git a/src/resources/objects/intangible/IntangibleObject.java b/src/resources/objects/intangible/IntangibleObject.java index 3b1c7921f..1715ebea9 100644 --- a/src/resources/objects/intangible/IntangibleObject.java +++ b/src/resources/objects/intangible/IntangibleObject.java @@ -29,8 +29,8 @@ package resources.objects.intangible; import com.projectswg.common.network.NetBuffer; import com.projectswg.common.network.NetBufferStream; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline.BaselineType; -import network.packets.swg.zone.baselines.Baseline.BaselineType; import resources.network.BaselineBuilder; import resources.objects.SWGObject; import resources.player.Player; diff --git a/src/resources/objects/manufacture/ManufactureSchematicObject.java b/src/resources/objects/manufacture/ManufactureSchematicObject.java index cd4b16fac..db3de2a50 100644 --- a/src/resources/objects/manufacture/ManufactureSchematicObject.java +++ b/src/resources/objects/manufacture/ManufactureSchematicObject.java @@ -30,12 +30,12 @@ package resources.objects.manufacture; import java.util.Map.Entry; import com.projectswg.common.data.CRC; +import com.projectswg.common.data.encodables.oob.StringId; import com.projectswg.common.network.NetBuffer; import com.projectswg.common.network.NetBufferStream; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline.BaselineType; -import network.packets.swg.zone.baselines.Baseline.BaselineType; import resources.collections.SWGMap; -import resources.encodables.StringId; import resources.network.BaselineBuilder; import resources.objects.intangible.IntangibleObject; import resources.player.Player; diff --git a/src/resources/objects/mission/MissionObject.java b/src/resources/objects/mission/MissionObject.java index d7f8c111f..dbad08204 100644 --- a/src/resources/objects/mission/MissionObject.java +++ b/src/resources/objects/mission/MissionObject.java @@ -28,15 +28,16 @@ package resources.objects.mission; import com.projectswg.common.data.CRC; +import com.projectswg.common.data.encodables.oob.StringId; +import com.projectswg.common.data.encodables.oob.waypoint.WaypointPackage; import com.projectswg.common.data.location.Point3D; import com.projectswg.common.data.location.Terrain; import com.projectswg.common.encoding.Encodable; import com.projectswg.common.network.NetBuffer; import com.projectswg.common.network.NetBufferStream; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline.BaselineType; import com.projectswg.common.persistable.Persistable; -import network.packets.swg.zone.baselines.Baseline.BaselineType; -import resources.encodables.StringId; import resources.network.BaselineBuilder; import resources.objects.intangible.IntangibleObject; import resources.objects.waypoint.WaypointObject; @@ -75,7 +76,7 @@ public class MissionObject extends IntangibleObject { bb.addInt(status); bb.addObject(missionType); bb.addAscii(targetName); - bb.addObject(waypoint); + bb.addObject(waypoint.getOOB()); } @Override @@ -97,7 +98,7 @@ public class MissionObject extends IntangibleObject { buffer.getUnicode(); waypoint = new WaypointObject(buffer.getLong()); buffer.position(pos); - waypoint.decode(buffer); + waypoint.setOOB(new WaypointPackage(buffer)); } @Override diff --git a/src/resources/objects/player/PlayerObject.java b/src/resources/objects/player/PlayerObject.java index ce2ac8de1..ab6b27710 100644 --- a/src/resources/objects/player/PlayerObject.java +++ b/src/resources/objects/player/PlayerObject.java @@ -32,9 +32,9 @@ import java.util.List; import com.projectswg.common.encoding.StringType; import com.projectswg.common.network.NetBufferStream; +import com.projectswg.common.network.packets.swg.zone.UpdatePostureMessage; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline.BaselineType; -import network.packets.swg.zone.UpdatePostureMessage; -import network.packets.swg.zone.baselines.Baseline.BaselineType; import resources.collections.SWGMap; import resources.network.BaselineBuilder; import resources.objects.SWGObject; diff --git a/src/resources/objects/player/PlayerObjectPrivate.java b/src/resources/objects/player/PlayerObjectPrivate.java index a89d543e8..c041a8220 100644 --- a/src/resources/objects/player/PlayerObjectPrivate.java +++ b/src/resources/objects/player/PlayerObjectPrivate.java @@ -31,7 +31,7 @@ import com.projectswg.common.encoding.StringType; import com.projectswg.common.network.NetBufferStream; import com.projectswg.common.persistable.Persistable; -import network.packets.swg.zone.chat.ChatSystemMessage; +import intents.chat.SystemMessageIntent; import resources.collections.SWGBitSet; import resources.collections.SWGMap; import resources.network.BaselineBuilder; @@ -61,7 +61,7 @@ class PlayerObjectPrivate implements Persistable { waypoints.put(waypoint.getObjectId(), waypoint); waypoints.sendDeltaMessage(target); } else { - target.sendSelf(new ChatSystemMessage(ChatSystemMessage.SystemChatType.PERSONAL, "@base_player:too_many_waypoints")); + SystemMessageIntent.broadcastPersonal(target.getOwner(), "@base_player:too_many_waypoints"); } } } diff --git a/src/resources/objects/resource/ResourceContainerObject.java b/src/resources/objects/resource/ResourceContainerObject.java index 8b91b8dae..2f85f6f14 100644 --- a/src/resources/objects/resource/ResourceContainerObject.java +++ b/src/resources/objects/resource/ResourceContainerObject.java @@ -28,8 +28,8 @@ package resources.objects.resource; import com.projectswg.common.network.NetBufferStream; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline.BaselineType; -import network.packets.swg.zone.baselines.Baseline.BaselineType; import resources.network.BaselineBuilder; import resources.objects.tangible.TangibleObject; import resources.player.Player; diff --git a/src/resources/objects/ship/ShipObject.java b/src/resources/objects/ship/ShipObject.java index 7501ddd9f..bd68c18c2 100644 --- a/src/resources/objects/ship/ShipObject.java +++ b/src/resources/objects/ship/ShipObject.java @@ -28,8 +28,8 @@ package resources.objects.ship; import com.projectswg.common.network.NetBufferStream; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline.BaselineType; -import network.packets.swg.zone.baselines.Baseline.BaselineType; import resources.objects.tangible.TangibleObject; public class ShipObject extends TangibleObject { diff --git a/src/resources/objects/staticobject/StaticObject.java b/src/resources/objects/staticobject/StaticObject.java index f4b13ca8f..d48a73d27 100644 --- a/src/resources/objects/staticobject/StaticObject.java +++ b/src/resources/objects/staticobject/StaticObject.java @@ -28,8 +28,8 @@ package resources.objects.staticobject; import com.projectswg.common.network.NetBufferStream; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline.BaselineType; -import network.packets.swg.zone.baselines.Baseline.BaselineType; import resources.objects.SWGObject; public class StaticObject extends SWGObject { diff --git a/src/resources/objects/tangible/TangibleObject.java b/src/resources/objects/tangible/TangibleObject.java index 4d56d7036..dfdcefac6 100644 --- a/src/resources/objects/tangible/TangibleObject.java +++ b/src/resources/objects/tangible/TangibleObject.java @@ -31,16 +31,16 @@ import java.io.IOException; import java.io.ObjectInputStream; import java.util.Set; +import com.projectswg.common.data.encodables.tangible.PvpFaction; +import com.projectswg.common.data.encodables.tangible.PvpFlag; +import com.projectswg.common.data.encodables.tangible.PvpStatus; import com.projectswg.common.encoding.StringType; import com.projectswg.common.network.NetBuffer; import com.projectswg.common.network.NetBufferStream; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline.BaselineType; import intents.FactionIntent; import intents.FactionIntent.FactionIntentType; -import network.packets.swg.zone.baselines.Baseline.BaselineType; -import resources.PvpFaction; -import resources.PvpFlag; -import resources.PvpStatus; import resources.collections.SWGMap; import resources.collections.SWGSet; import resources.network.BaselineBuilder; diff --git a/src/resources/objects/waypoint/WaypointObject.java b/src/resources/objects/waypoint/WaypointObject.java index bd97ac53a..8474f492f 100644 --- a/src/resources/objects/waypoint/WaypointObject.java +++ b/src/resources/objects/waypoint/WaypointObject.java @@ -27,130 +27,115 @@ ***********************************************************************************/ package resources.objects.waypoint; +import com.projectswg.common.data.encodables.oob.OutOfBandPackage.Type; +import com.projectswg.common.data.encodables.oob.waypoint.WaypointColor; +import com.projectswg.common.data.encodables.oob.waypoint.WaypointPackage; +import com.projectswg.common.data.location.Point3D; import com.projectswg.common.data.location.Terrain; -import com.projectswg.common.network.NetBuffer; import com.projectswg.common.network.NetBufferStream; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline.BaselineType; -import network.packets.swg.zone.baselines.Baseline.BaselineType; -import resources.encodables.OutOfBandData; -import resources.encodables.OutOfBandPackage; import resources.objects.intangible.IntangibleObject; import resources.player.Player; -public class WaypointObject extends IntangibleObject implements OutOfBandData { +public class WaypointObject extends IntangibleObject { - private long cellId; - private String name; - private WaypointColor color; - private boolean active; + private WaypointPackage waypoint; public WaypointObject(long objectId) { super(objectId, BaselineType.WAYP); - this.cellId = 0; - this.name = "New Waypoint"; - this.color = WaypointColor.BLUE; - this.active = true; + this.waypoint = new WaypointPackage(); + } + + public void setOOB(WaypointPackage oob) { + this.waypoint = oob; + } + + public WaypointPackage getOOB() { + return waypoint; } @Override public String getObjectName() { - return name; + return waypoint.getName(); } - public void setName(String name) { - this.name = name; + public Point3D getPosition() { + return waypoint.getPosition(); } - public WaypointColor getColor() { - return color; + @Override + public long getObjectId() { + return waypoint.getObjectId(); } - public void setColor(WaypointColor color) { - this.color = color; - } - - public boolean isActive() { - return active; - } - - public void setActive(boolean active) { - this.active = active; + @Override + public Terrain getTerrain() { + return waypoint.getTerrain(); } public long getCellId() { - return cellId; + return waypoint.getCellId(); + } + + public String getName() { + return waypoint.getName(); + } + + public WaypointColor getColor() { + return waypoint.getColor(); + } + + public boolean isActive() { + return waypoint.isActive(); + } + + public void setObjectId(long objectId) { + waypoint.setObjectId(objectId); + } + + @Override + public void setTerrain(Terrain terrain) { + waypoint.setTerrain(terrain); } public void setCellId(long cellId) { - this.cellId = cellId; + waypoint.setCellId(cellId); } + public void setName(String name) { + waypoint.setName(name); + } + + public void setColor(WaypointColor color) { + waypoint.setColor(color); + } + + public void setActive(boolean active) { + waypoint.setActive(active); + } + + public Type getOobType() { + return waypoint.getOobType(); + } + @Override public void createObject(Player target) { // NOTE: Client is never sent a WAYP baseline in NGE, WaypointObject's just go inside the Waypoint List in PLAY. } - @Override - public byte[] encode() { - NetBuffer data = NetBuffer.allocate(getLength()); - data.addInt(0); - data.addFloat((float) getX()); - data.addFloat((float) getY()); - data.addFloat((float) getZ()); - data.addLong(cellId); - data.addInt(getTerrain().getCrc()); - data.addUnicode(name); - data.addLong(getObjectId()); - data.addByte(color.getValue()); - data.addBoolean(active); - return data.array(); - } - - @Override - public void decode(NetBuffer data) { - data.getInt(); - setPosition(data.getFloat(), data.getFloat(), data.getFloat()); - cellId = data.getLong(); - setTerrain(Terrain.getTerrainFromCrc(data.getInt())); - name = data.getUnicode(); - data.getLong(); // objectId - color = WaypointColor.valueOf(data.getByte()); - active = data.getBoolean(); - } - - @Override - public int getLength() { - return 42 + name.length() * 2; - } - @Override public void save(NetBufferStream stream) { super.save(stream); stream.addByte(0); - stream.addBoolean(active); - stream.addLong(cellId); - stream.addAscii(name); - stream.addAscii(color.name()); + waypoint.save(stream); } @Override public void read(NetBufferStream stream) { super.read(stream); stream.getByte(); - active = stream.getBoolean(); - cellId = stream.getLong(); - name = stream.getAscii(); - color = WaypointColor.valueOf(stream.getAscii()); - } - - @Override - public OutOfBandPackage.Type getOobType() { - return OutOfBandPackage.Type.WAYPOINT; - } - - @Override - public int getOobPosition() { - return -3; + waypoint.read(stream); } @Override @@ -158,65 +143,12 @@ public class WaypointObject extends IntangibleObject implements OutOfBandData { if (!(o instanceof WaypointObject)) return false; WaypointObject wp = (WaypointObject) o; - return wp.name.equals(name) && wp.cellId == cellId && wp.color == color && wp.active == active; - } - - @Override - public int hashCode() { - return ((super.hashCode() * 7 + name.hashCode()) * 13 + color.getValue()) * 17 + (int) cellId; + return wp.getObjectId() == getObjectId(); } @Override public String toString() { - return "WaypointObject[" + "cellId=" + cellId + ", name='" + name + '\'' + ", color=" + color + ", active=" + active + ", location=" + getLocation() + "]"; + return String.format("WaypointObject[name='%s', color=%s, active=%b, location=%s:%s", getName(), getColor(), isActive(), getTerrain(), getPosition()); } - public enum WaypointColor { - BLUE(1), - GREEN(2), - ORANGE(3), - YELLOW(4), - PURPLE(5), - WHITE(6), - MULTICOLOR(7); - - private int i; - - WaypointColor(int i) { - this.i = i; - } - - public int getValue() { - return i; - } - - public static WaypointColor valueOf(int colorId) { - for (WaypointColor color : WaypointColor.values()) { - if (color.getValue() == colorId) - return color; - } - return WaypointColor.BLUE; - } - - public static WaypointColor fromString(String string) { - switch (string) { - case "blue": - return WaypointColor.BLUE; - case "green": - return WaypointColor.GREEN; - case "orange": - return WaypointColor.ORANGE; - case "yellow": - return WaypointColor.YELLOW; - case "purple": - return WaypointColor.PURPLE; - case "white": - return WaypointColor.WHITE; - case "multicolor": - return WaypointColor.MULTICOLOR; - default: - return WaypointColor.BLUE; - } - } - } } diff --git a/src/resources/objects/weapon/WeaponObject.java b/src/resources/objects/weapon/WeaponObject.java index 73e0511c0..18848f1b5 100644 --- a/src/resources/objects/weapon/WeaponObject.java +++ b/src/resources/objects/weapon/WeaponObject.java @@ -27,11 +27,11 @@ ***********************************************************************************/ package resources.objects.weapon; +import com.projectswg.common.data.combat.DamageType; import com.projectswg.common.network.NetBuffer; import com.projectswg.common.network.NetBufferStream; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline.BaselineType; -import network.packets.swg.zone.baselines.Baseline.BaselineType; -import resources.combat.DamageType; import resources.network.BaselineBuilder; import resources.objects.tangible.TangibleObject; import resources.player.Player; diff --git a/src/resources/player/Player.java b/src/resources/player/Player.java index 01f3ad201..67f912fd6 100644 --- a/src/resources/player/Player.java +++ b/src/resources/player/Player.java @@ -29,9 +29,9 @@ package resources.player; import com.projectswg.common.control.IntentChain; import com.projectswg.common.control.Service; +import com.projectswg.common.network.packets.SWGPacket; import intents.network.OutboundPacketIntent; -import network.packets.Packet; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; @@ -39,7 +39,7 @@ import services.player.PlayerManager; public class Player implements Comparable { - private final IntentChain packetChain; + private final IntentChain SWGPacketChain; private final Service playerManager; private final Object sendingLock; private final long networkId; @@ -58,7 +58,7 @@ public class Player implements Comparable { } public Player(Service playerManager, long networkId) { - this.packetChain = new IntentChain(); + this.SWGPacketChain = new IntentChain(); this.playerManager = playerManager; this.sendingLock = new Object(); this.networkId = networkId; @@ -97,7 +97,7 @@ public class Player implements Comparable { if (obj != null && obj.getOwner() != this) obj.setOwner(this); if (obj == null) - packetChain.reset(); + SWGPacketChain.reset(); } public void updateLastPacketTimestamp() { @@ -167,10 +167,10 @@ public class Player implements Comparable { return sendingLock; } - public void sendPacket(Packet ... packets) { + public void sendPacket(SWGPacket ... SWGPackets) { synchronized (getSendingLock()) { - for (Packet p : packets) { - packetChain.broadcastAfter(new OutboundPacketIntent(p, networkId)); + for (SWGPacket p : SWGPackets) { + SWGPacketChain.broadcastAfter(new OutboundPacketIntent(p, networkId)); } } } diff --git a/src/resources/radial/RadialItem.java b/src/resources/radial/RadialItem.java deleted file mode 100644 index 134daf639..000000000 --- a/src/resources/radial/RadialItem.java +++ /dev/null @@ -1,395 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package resources.radial; - -import java.util.Hashtable; -import java.util.Map; - -public enum RadialItem { - UNKNOWN (""), - COMBAT_TARGET (""), - COMBAT_UNTARGET (""), - COMBAT_ATTACK (""), - COMBAT_PEACE (""), - COMBAT_DUEL (""), - COMBAT_DEATH_BLOW (""), - EXAMINE (""), - EXAMINE_CHARACTERSHEET (""), - TRADE_START (""), - TRADE_ACCEPT (""), - ITEM_PICKUP (""), - ITEM_EQUIP (""), - ITEM_UNEQUIP (""), - ITEM_DROP (""), - ITEM_DESTROY (""), - ITEM_TOKEN (""), - ITEM_OPEN (""), - ITEM_OPEN_NEW_WINDOW (""), - ITEM_ACTIVATE (""), - ITEM_DEACTIVATE (""), - ITEM_USE (""), - ITEM_USE_SELF (""), - ITEM_USE_OTHER (""), - ITEM_SIT (""), - ITEM_MAIL (""), - CONVERSE_START (""), - CONVERSE_RESPOND (""), - CONVERSE_RESPONSE (""), - CONVERSE_STOP (""), - CRAFT_OPTIONS (""), - CRAFT_START (""), - CRAFT_HOPPER_INPUT (""), - CRAFT_HOPPER_OUTPUT (""), - MISSION_TERMINAL_LIST (""), - MISSION_DETAILS (""), - LOOT (""), - LOOT_ALL (""), - GROUP_INVITE (""), - GROUP_JOIN (""), - GROUP_LEAVE (""), - GROUP_KICK (""), - GROUP_DISBAND (""), - GROUP_DECLINE (""), - EXTRACT_OBJECT (""), - PET_CALL (""), - TERMINAL_AUCTION_USE (""), - CREATURE_FOLLOW (""), - CREATURE_STOP_FOLLOW (""), - SPLIT (""), - IMAGEDESIGN (""), - SET_NAME (""), - ITEM_ROTATE (""), - ITEM_ROTATE_LEFT (""), - ITEM_MOVE (""), - ITEM_MOVE_FORWARD (""), - ITEM_MOVE_BACK (""), - ITEM_MOVE_UP (""), - ITEM_MOVE_DOWN (""), - PET_STORE (""), - VEHICLE_GENERATE (""), - VEHICLE_STORE (""), - MISSION_ABORT (""), - MISSION_END_DUTY (""), - SHIP_MANAGE_COMPONENTS (""), - WAYPOINT_AUTOPILOT (""), - PROGRAM_DROID (""), - VEHICLE_OFFER_RIDE (""), - ITEM_PUBLIC_CONTAINER_USE1 (""), - COLLECTIONS (""), - GROUP_MASTER_LOOTER (""), - GROUP_MAKE_LEADER (""), - GROUP_LOOT (""), - ITEM_ROTATE_BACKWARD (""), - ITEM_ROTATE_COUNTERCLOCKWISE (""), - ITEM_ROTATE_RANDOM (""), - ITEM_ROTATE_RANDOM_YAW (""), - ITEM_ROTATE_RANDOM_PITCH (""), - ITEM_ROTATE_RANDOM_ROLL (""), - ITEM_ROTATE_RESET (""), - ITEM_ROTATE_COPY (""), - ITEM_MOVE_COPY_LOCATION (""), - ITEM_MOVE_COPY_HEIGHT (""), - GROUP_TELL (""), - ITEM_WP_SETCOLOR (""), - ITEM_WP_SETCOLOR_BLUE (""), - ITEM_WP_SETCOLOR_GREEN (""), - ITEM_WP_SETCOLOR_ORANGE (""), - ITEM_WP_SETCOLOR_YELLOW (""), - ITEM_WP_SETCOLOR_PURPLE (""), - ITEM_WP_SETCOLOR_WHITE (""), - ITEM_MOVE_LEFT (""), - ITEM_MOVE_RIGHT (""), - ROTATE_APPLY (""), - ROTATE_RESET (""), - WINDOW_LOCK (""), - WINDOW_UNLOCK (""), - GROUP_CREATE_PICKUP_POINT (""), - GROUP_USE_PICKUP_POINT (""), - GROUP_USE_PICKUP_POINT_NOCAMP (""), - VOICE_SHORTLIST_REMOVE (""), - VOICE_INVITE (""), - VOICE_KICK (""), - ITEM_EQUIP_APPEARANCE (""), - ITEM_UNEQUIP_APPEARANCE (""), - OPEN_STORYTELLER_RECIPE (""), - ITEM_WP_MAKE_CITY_WAYPOINT (""), - ITEM_WP_MAKE_GUILD_WAYPOINT (""), - ATMOSPHERIC_FLIGHT_FLY (""), - ATMOSPHERIC_FLIGHT_LAND (""), - SERVER_DIVIDER (""), - SERVER_MENU1 (""), - SERVER_MENU2 (""), - SERVER_MENU3 (""), - SERVER_MENU4 (""), - SERVER_MENU5 (""), - SERVER_MENU6 (""), - SERVER_MENU7 (""), - SERVER_MENU8 (""), - SERVER_MENU9 (""), - SERVER_MENU10 (""), - SERVER_MENU11 (""), - SERVER_MENU12 (""), - SERVER_MENU13 (""), - SERVER_MENU14 (""), - SERVER_MENU15 (""), - SERVER_MENU16 (""), - SERVER_MENU17 (""), - SERVER_MENU18 (""), - SERVER_MENU19 (""), - SERVER_MENU20 (""), - SERVER_MENU21 (""), - SERVER_MENU22 (""), - SERVER_MENU23 (""), - SERVER_MENU24 (""), - SERVER_MENU25 (""), - SERVER_MENU26 (""), - SERVER_MENU27 (""), - SERVER_MENU28 (""), - SERVER_MENU29 (""), - SERVER_MENU30 (""), - SERVER_MENU31 (""), - SERVER_MENU32 (""), - SERVER_MENU33 (""), - SERVER_MENU34 (""), - SERVER_MENU35 (""), - SERVER_MENU36 (""), - SERVER_MENU37 (""), - SERVER_MENU38 (""), - SERVER_MENU39 (""), - SERVER_MENU40 (""), - SERVER_MENU41 (""), - SERVER_MENU42 (""), - SERVER_MENU43 (""), - SERVER_MENU44 (""), - SERVER_MENU45 (""), - SERVER_MENU46 (""), - SERVER_MENU47 (""), - SERVER_MENU48 (""), - SERVER_MENU49 (""), - SERVER_MENU50 (""), - SERVER_HARVESTER_MANAGE (""), - SERVER_HOUSE_MANAGE (""), - SERVER_FACTION_HALL_MANAGE (""), - SERVER_HUE (""), - SERVER_OBSERVE (""), - SERVER_STOP_OBSERVING (""), - SERVER_TRAVEL_OPTIONS (""), - SERVER_BAZAAR_OPTIONS (""), - SERVER_SHIPPING_OPTIONS (""), - SERVER_HEAL_WOUND (""), - SERVER_HEAL_WOUND_HEALTH (""), - SERVER_HEAL_WOUND_ACTION (""), - SERVER_HEAL_WOUND_STRENGTH (""), - SERVER_HEAL_WOUND_CONSTITUTION (""), - SERVER_HEAL_WOUND_QUICKNESS (""), - SERVER_HEAL_WOUND_STAMINA (""), - SERVER_HEAL_DAMAGE (""), - SERVER_HEAL_STATE (""), - SERVER_HEAL_STATE_STUNNED (""), - SERVER_HEAL_STATE_BLINDED (""), - SERVER_HEAL_STATE_DIZZY (""), - SERVER_HEAL_STATE_INTIMIDATED (""), - SERVER_HEAL_ENHANCE (""), - SERVER_HEAL_ENHANCE_HEALTH (""), - SERVER_HEAL_ENHANCE_ACTION (""), - SERVER_HEAL_ENHANCE_STRENGTH (""), - SERVER_HEAL_ENHANCE_CONSTITUTION (""), - SERVER_HEAL_ENHANCE_QUICKNESS (""), - SERVER_HEAL_ENHANCE_STAMINA (""), - SERVER_HEAL_FIRSTAID (""), - SERVER_HEAL_CURE_POISON (""), - SERVER_HEAL_CURE_DISEASE (""), - SERVER_HEAL_APPLY_POISON (""), - SERVER_HEAL_APPLY_DISEASE (""), - SERVER_HARVEST_CORPSE (""), - SERVER_PERFORMANCE_LISTEN (""), - SERVER_PERFORMANCE_WATCH (""), - SERVER_PERFORMANCE_LISTEN_STOP (""), - SERVER_PERFORMANCE_WATCH_STOP (""), - SERVER_TERMINAL_PERMISSIONS (""), - SERVER_TERMINAL_MANAGEMENT (""), - SERVER_TERMINAL_PERMISSIONS_ENTER (""), - SERVER_TERMINAL_PERMISSIONS_BANNED (""), - SERVER_TERMINAL_PERMISSIONS_ADMIN (""), - SERVER_TERMINAL_PERMISSIONS_VENDOR (""), - SERVER_TERMINAL_PERMISSIONS_HOPPER (""), - SERVER_TERMINAL_MANAGEMENT_STATUS (""), - SERVER_TERMINAL_MANAGEMENT_PRIVACY (""), - SERVER_TERMINAL_MANAGEMENT_TRANSFER (""), - SERVER_TERMINAL_MANAGEMENT_RESIDENCE (""), - SERVER_TERMINAL_MANAGEMENT_DESTROY (""), - SERVER_TERMINAL_MANAGEMENT_PAY (""), - SERVER_TERMINAL_CREATE_VENDOR (""), - SERVER_GIVE_VENDOR_MAINTENANCE (""), - SERVER_ITEM_OPTIONS (""), - SERVER_SURVEY_TOOL_RANGE (""), - SERVER_SURVEY_TOOL_RESOLUTION (""), - SERVER_SURVEY_TOOL_CLASS (""), - SERVER_PROBE_DROID_TRACK_TARGET (""), - SERVER_PROBE_DROID_FIND_TARGET (""), - SERVER_PROBE_DROID_ACTIVATE (""), - SERVER_PROBE_DROID_BUY (""), - SERVER_TEACH (""), - PET_COMMAND (""), - PET_FOLLOW (""), - PET_STAY (""), - PET_GUARD (""), - PET_FRIEND (""), - PET_ATTACK (""), - PET_PATROL (""), - PET_GET_PATROL_POINT (""), - PET_CLEAR_PATROL_POINTS (""), - PET_ASSUME_FORMATION_1 (""), - PET_ASSUME_FORMATION_2 (""), - PET_TRANSFER (""), - PET_RELEASE (""), - PET_TRICK_1 (""), - PET_TRICK_2 (""), - PET_TRICK_3 (""), - PET_TRICK_4 (""), - PET_GROUP (""), - PET_TAME (""), - PET_FEED (""), - PET_SPECIAL_ATTACK_ONE (""), - PET_SPECIAL_ATTACK_TWO (""), - PET_RANGED_ATTACK (""), - DICE_ROLL (""), - DICE_TWO_FACE (""), - DICE_THREE_FACE (""), - DICE_FOUR_FACE (""), - DICE_FIVE_FACE (""), - DICE_SIX_FACE (""), - DICE_SEVEN_FACE (""), - DICE_EIGHT_FACE (""), - DICE_COUNT_ONE (""), - DICE_COUNT_TWO (""), - DICE_COUNT_THREE (""), - DICE_COUNT_FOUR (""), - CREATE_BALLOT (""), - VOTE (""), - BOMBING_RUN (""), - SELF_DESTRUCT (""), - THIRTY_SEC (""), - FIFTEEN_SEC (""), - SERVER_CAMP_DISBAND (""), - SERVER_CAMP_ASSUME_OWNERSHIP (""), - SERVER_PROBE_DROID_PROGRAM (""), - SERVER_GUILD_CREATE ("@guild:menu_create"), - SERVER_GUILD_INFO (""), - SERVER_GUILD_MEMBERS (""), - SERVER_GUILD_SPONSORED (""), - SERVER_GUILD_ENEMIES (""), - SERVER_GUILD_SPONSOR (""), - SERVER_GUILD_DISBAND (""), - SERVER_GUILD_NAMECHANGE (""), - SERVER_GUILD_GUILD_MANAGEMENT (""), - SERVER_GUILD_MEMBER_MANAGEMENT (""), - SERVER_MANF_HOPPER_INPUT (""), - SERVER_MANF_HOPPER_OUTPUT (""), - SERVER_MANF_STATION_SCHEMATIC (""), - ELEVATOR_UP (""), - ELEVATOR_DOWN (""), - SERVER_PET_OPEN (""), - SERVER_PET_DPAD (""), - SERVER_MED_TOOL_DIAGNOSE (""), - SERVER_MED_TOOL_TENDWOUND (""), - SERVER_MED_TOOL_TENDDAMAGE (""), - SERVER_PET_DISMOUNT (""), - SERVER_PET_TRAIN_MOUNT (""), - SERVER_VEHICLE_ENTER (""), - SERVER_VEHICLE_EXIT (""), - OPEN_NAVICOMP_DPAD (""), - INIT_NAVICOMP_DPAD (""), - CITY_STATUS (""), - CITY_CITIZENS (""), - CITY_STRUCTURES (""), - CITY_TREASURY (""), - CITY_MANAGEMENT (""), - CITY_NAME (""), - CITY_MILITIA (""), - CITY_TAXES (""), - CITY_TREASURY_DEPOSIT (""), - CITY_TREASURY_WITHDRAW (""), - CITY_REGISTER (""), - CITY_RANK (""), - CITY_ADMIN_1 (""), - CITY_ADMIN_2 (""), - CITY_ADMIN_3 (""), - CITY_ADMIN_4 (""), - CITY_ADMIN_5 (""), - CITY_ADMIN_6 (""), - MEMORY_CHIP_PROGRAM (""), - MEMORY_CHIP_TRANSFER (""), - MEMORY_CHIP_ANALYZE (""), - EQUIP_DROID_ON_SHIP (""), - BIO_LINK (""), - LANDMINE_DISARM (""), - LANDMINE_REVERSE_TRIGGER (""), - REWARD_TRADE_IN (""); - - private static final Map INT_TO_ITEM = new Hashtable<>(values().length); - private int id; - private int optionType; - private String text; - - static { - for (RadialItem item : values()) { - INT_TO_ITEM.put(item.getId(), item); - } - } - - RadialItem(String text) { - this.id = RadialItemInit.getNextItemId(); - this.optionType = 3; - this.text = text; - } - - public int getId() { - return id; - } - - public int getOptionType() { - return optionType; - } - - public String getText() { - return text; - } - - /** - * Gets the RadialItem from the selection id. If the item is undefined, - * then NULL is returned - * @param id the selection id that maps to a RadialItem - * @return the RadialItem represented by the selection, or NULL if it does - * not exist - */ - public static RadialItem getFromId(int id) { - return INT_TO_ITEM.get(id); - } - -} diff --git a/src/resources/radial/RadialItemInit.java b/src/resources/radial/RadialItemInit.java deleted file mode 100644 index 89957fd0f..000000000 --- a/src/resources/radial/RadialItemInit.java +++ /dev/null @@ -1,40 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package resources.radial; - -import java.util.concurrent.atomic.AtomicInteger; - -class RadialItemInit { - - private static final AtomicInteger ID = new AtomicInteger(0); - - public static int getNextItemId() { - return ID.getAndIncrement(); - } - -} diff --git a/src/resources/radial/RadialOption.java b/src/resources/radial/RadialOption.java deleted file mode 100644 index 32b6b959b..000000000 --- a/src/resources/radial/RadialOption.java +++ /dev/null @@ -1,69 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package resources.radial; - -import java.util.ArrayList; -import java.util.List; - -public class RadialOption { - - private RadialItem item; - private List children; - private String overriddenText; - - public RadialOption() { - this.children = new ArrayList<>(); - } - - public RadialOption(RadialItem item) { - this.item = item; - this.children = new ArrayList<>(); - } - - public void setItem(RadialItem item) { this.item = item; } - public void addChild(RadialOption option) { this.children.add(option); } - public void addChild(RadialItem item) { addChild(new RadialOption(item)); } - public void addChildWithOverriddenText(RadialItem item, String overriddenText) { - RadialOption childOption = new RadialOption(item); - childOption.setOverriddenText(overriddenText); - addChild(childOption); - } - public void setOverriddenText(String overridenText) { this.overriddenText = overridenText; } - - public int getId() { return item.getId(); } - public int getOptionType() { return item.getOptionType(); } - public String getText() { return overriddenText != null ? overriddenText : item.getText(); } - - public List getChildren() { return children; } - - @Override - public String toString() { - return String.format("ID=%d Option=%d Text=%s", getId(), getOptionType(), getText()); - } - -} diff --git a/src/resources/radial/RadialOptionList.java b/src/resources/radial/RadialOptionList.java deleted file mode 100644 index 9e67d9474..000000000 --- a/src/resources/radial/RadialOptionList.java +++ /dev/null @@ -1,171 +0,0 @@ -/************************************************************************************ - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com * - * * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * - * Our goal is to create an emulator which will provide a server for players to * - * continue playing a game similar to the one they used to play. We are basing * - * it on the final publish of the game prior to end-game events. * - * * - * This file is part of Holocore. * - * * - * -------------------------------------------------------------------------------- * - * * - * Holocore is free software: you can redistribute it and/or modify * - * it under the terms of the GNU Affero General Public License as * - * published by the Free Software Foundation, either version 3 of the * - * License, or (at your option) any later version. * - * * - * Holocore 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 Affero General Public License for more details. * - * * - * You should have received a copy of the GNU Affero General Public License * - * along with Holocore. If not, see . * - * * - ***********************************************************************************/ -package resources.radial; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.projectswg.common.debug.Log; -import com.projectswg.common.encoding.Encodable; -import com.projectswg.common.network.NetBuffer; - -public class RadialOptionList implements Encodable { - - private final List options; - - public RadialOptionList() { - options = new ArrayList<>(); - } - - public RadialOptionList(List options) { - this(); - this.options.addAll(options); - } - - public void addOption(RadialOption option) { - options.add(option); - } - - public void setOptions(List options) { - this.options.clear(); - this.options.addAll(options); - } - - public List getOptions() { - return Collections.unmodifiableList(options); - } - - @Override - public void decode(NetBuffer data) { - int optionsCount = data.getInt(); - Map optionMap = new HashMap<>(); - for (int i = 0; i < optionsCount; i++) { - RadialOption option = new RadialOption(); - int opt = data.getByte(); // option number - int parent = data.getByte(); // parentId - int radialType = data.getShort(); // radialType - data.getByte(); // optionType - data.getUnicode(); // text - RadialItem item = RadialItem.getFromId(radialType); - if (item == null) { - Log.e("No radial item found for: %04X"); - continue; - } - option.setItem(item); - optionMap.put(opt, option); - if (parent == 0) { - options.add(option); - } else { - RadialOption parentOpt = optionMap.get(parent); - if (parentOpt == null) { - Log.e("Parent not found! Parent=%d Option=%s", parent, option); - } else { - parentOpt.addChild(option); - } - } - } - } - - @Override - public byte [] encode() { - NetBuffer data = NetBuffer.allocate(4 + getOptionSize()); - data.addInt(getOptionCount()); - addOptions(data); - return data.array(); - } - - @Override - public int getLength() { - return 4 + getOptionSize(); - } - - public int getSize() { - return 4 + getOptionSize(); - } - - private int getOptionCount() { - int count = 0; - for (RadialOption option : options) { - count += getOptionCount(option); - } - return count; - } - - private int getOptionSize() { - int size = 0; - for (RadialOption option : options) { - size += getOptionSize(option); - } - return size; - } - - private void addOptions(NetBuffer data) { - int index = 1; - for (RadialOption option : options) { - index = addOption(data, option, 0, index); - } - } - - private int getOptionCount(RadialOption parent) { - int count = 1; - for (RadialOption child : parent.getChildren()) { - count += getOptionCount(child); - } - return count; - } - - private int getOptionSize(RadialOption parent) { - int size = 9; - if (parent.getText() != null && !parent.getText().isEmpty()) - size += parent.getText().length()*2; - for (RadialOption child : parent.getChildren()) { - size += getOptionSize(child); - } - return size; - } - - private int addOption(NetBuffer data, RadialOption parent, int parentIndex, int index) { - int myIndex = index++; - data.addByte(myIndex); - data.addByte(parentIndex); - data.addShort(parent.getId()); - data.addByte(parent.getOptionType()); - if (parent.getText() != null || !parent.getText().isEmpty()) - data.addUnicode(parent.getText()); - else - data.addInt(0); - for (RadialOption option : parent.getChildren()) { - index = addOption(data, option, myIndex, index); - } - return index; - } - -} diff --git a/src/resources/radial/Radials.java b/src/resources/radial/Radials.java index 2e812e2a4..300d541b9 100644 --- a/src/resources/radial/Radials.java +++ b/src/resources/radial/Radials.java @@ -27,16 +27,19 @@ ***********************************************************************************/ package resources.radial; +import java.util.ArrayList; +import java.util.List; + +import com.projectswg.common.data.radial.RadialItem; +import com.projectswg.common.data.radial.RadialOption; import com.projectswg.common.debug.Log; + import groovy.util.ResourceException; import groovy.util.ScriptException; import resources.objects.SWGObject; import resources.player.Player; import utilities.Scripts; -import java.util.ArrayList; -import java.util.List; - public class Radials { private static final String SCRIPT_PREFIX = "radial/"; diff --git a/src/resources/spawn/Spawner.java b/src/resources/spawn/Spawner.java index 2b20f5e22..e7ea9a7e6 100644 --- a/src/resources/spawn/Spawner.java +++ b/src/resources/spawn/Spawner.java @@ -29,9 +29,9 @@ package resources.spawn; import java.util.Random; +import com.projectswg.common.data.encodables.tangible.PvpFaction; import com.projectswg.common.data.location.Location; -import resources.PvpFaction; import resources.objects.SWGObject; import resources.objects.creature.CreatureDifficulty; import resources.objects.custom.AIBehavior; diff --git a/src/resources/sui/ISuiCallback.java b/src/resources/sui/ISuiCallback.java deleted file mode 100644 index c51887680..000000000 --- a/src/resources/sui/ISuiCallback.java +++ /dev/null @@ -1,37 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package resources.sui; - -import java.util.Map; - -import resources.objects.SWGObject; -import resources.player.Player; - -public interface ISuiCallback { - void handleEvent(Player player, SWGObject actor, SuiEvent event, Map parameters); -} diff --git a/src/resources/sui/SuiBaseWindow.java b/src/resources/sui/SuiBaseWindow.java deleted file mode 100644 index cb9eb47c0..000000000 --- a/src/resources/sui/SuiBaseWindow.java +++ /dev/null @@ -1,324 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package resources.sui; - -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.projectswg.common.debug.Log; -import com.projectswg.common.encoding.Encodable; -import com.projectswg.common.network.NetBuffer; - -public class SuiBaseWindow implements Encodable { - - private int id; - private String suiScript; - private long rangeObjId; - private float maxDistance = 0; - private List components = new ArrayList<>(); - private Map callbacks; - private Map scriptCallbacks; - private boolean hasSubscriptionComponent = false; - - public SuiBaseWindow() { - } - - public SuiBaseWindow(String suiScript) { - this.suiScript = suiScript; - } - - public final void clearDataSource(String dataSource) { - SuiComponent component = new SuiComponent(SuiComponent.Type.CLEAR_DATA_SOURCE, dataSource); - components.add(component); - } - - public final void addChildWidget(String type, String childWidget, String parentWidget) { - SuiComponent component = new SuiComponent(SuiComponent.Type.ADD_CHILD_WIDGET, parentWidget); - - component.addNarrowParam(type); - component.addNarrowParam(childWidget); - - components.add(component); - } - - public final void setProperty(String widget, String property, String value) { - SuiComponent component = new SuiComponent(SuiComponent.Type.SET_PROPERTY, widget); - - component.addNarrowParam(property); - component.addWideParam(value); - - components.add(component); - } - - public final void addDataItem(String dataSource, String name, String value) { - SuiComponent component = new SuiComponent(SuiComponent.Type.ADD_DATA_ITEM, dataSource); - - component.addNarrowParam(name); - component.addWideParam(value); - - components.add(component); - } - - protected void subscribeToEvent(int event, String widgetSource, String callback) { - SuiComponent component = getSubscriptionForEvent(event, widgetSource); - if (component != null) { - Log.i("Added event callback %d to %s when the event is already subscribed to, replacing callback to %s", event, widgetSource, callback); - component.getNarrowParams().set(2, callback); - } else { - component = new SuiComponent(SuiComponent.Type.SUBSCRIBE_TO_EVENT, widgetSource); - component.addNarrowParam(getWrappedEventString(event)); - component.addNarrowParam(callback); - - components.add(component); - } - if (!hasSubscriptionComponent()) - hasSubscriptionComponent = true; - } - - protected void subscribeToPropertyEvent(int event, String widgetSource, String propertyWidget, String propertyName) { - SuiComponent component = getSubscriptionForEvent(event, widgetSource); - if (component != null) { - // This component already has the trigger and source param, just need to add the widget and property - // for client to return the value to the server - component.addNarrowParam(propertyWidget); - component.addNarrowParam(propertyName); - } else { - component = new SuiComponent(SuiComponent.Type.SUBSCRIBE_TO_EVENT, widgetSource); - component.addNarrowParam(getWrappedEventString(event)); - component.addNarrowParam(""); - component.addNarrowParam(propertyWidget); - component.addNarrowParam(propertyName); - components.add(component); - } - if (!hasSubscriptionComponent()) - hasSubscriptionComponent = true; - } - - public final void addDataSourceContainer(String dataSourceContainer, String name, String value) { - SuiComponent component = new SuiComponent(SuiComponent.Type.ADD_DATA_SOURCE_CONTAINER, dataSourceContainer); - - component.addNarrowParam(name); - component.addWideParam(value); - - components.add(component); - } - - public final void clearDataSourceContainer(String dataSourceContainer) { - SuiComponent component = new SuiComponent(SuiComponent.Type.CLEAR_DATA_SOURCE_CONTAINER, dataSourceContainer); - components.add(component); - } - - public final void addDataSource(String dataSource, String name, String value) { - SuiComponent component = new SuiComponent(SuiComponent.Type.ADD_DATA_SOURCE, dataSource); - - component.addNarrowParam(name); - component.addWideParam(value); - - components.add(component); - } - - public final void addReturnableProperty(SuiEvent event, String source, String widget, String property) { - subscribeToPropertyEvent(event.getValue(), source, widget, property); - } - - public final void addReturnableProperty(SuiEvent event, String widget, String property) { - addReturnableProperty(event, "", widget, property); - } - - public final void addReturnableProperty(String widget, String property) { - subscribeToPropertyEvent(SuiEvent.OK_PRESSED.getValue(), "", widget, property); - subscribeToPropertyEvent(SuiEvent.CANCEL_PRESSED.getValue(), "", widget, property); - } - - public final void addCallback(SuiEvent event, String source, String name, ISuiCallback callback) { - subscribeToEvent(event.getValue(), source, name); - addJavaCallback(name, callback); - } - - public final void addCallback(SuiEvent event, String name, ISuiCallback callback) { - addCallback(event, "", name, callback); - } - - public final void addCallback(SuiEvent event, String source, String script, String function) { - subscribeToEvent(event.getValue(), source, function); - addScriptCallback(function, script); - } - - public final void addCallback(SuiEvent event, String script, String function) { - addCallback(event, "", script, function); - } - - public final void addCallback(String source, String script, String function) { - subscribeToEvent(SuiEvent.OK_PRESSED.getValue(), source, function); - subscribeToEvent(SuiEvent.CANCEL_PRESSED.getValue(), source, function); - addScriptCallback(function, script); - } - - public final void addCallback(String script, String function) { - addCallback("", script, function); - } - - public final void addCallback(String source, String name, ISuiCallback callback) { - subscribeToEvent(SuiEvent.OK_PRESSED.getValue(), source, name); - subscribeToEvent(SuiEvent.CANCEL_PRESSED.getValue(), source, name); - addJavaCallback(name, callback); - } - - public final void addCallback(String name, ISuiCallback callback) { - addCallback("", name, callback); - } - - public final SuiComponent getSubscriptionForEvent(int event, String widget) { - for (SuiComponent component : components) { - if (component.getType() != SuiComponent.Type.SUBSCRIBE_TO_EVENT) - continue; - - int eventType = component.getSubscribedToEventType(); - - if (eventType == event && component.getTarget().equals(widget)) - return component; - } - return null; - } - - public final SuiComponent getSubscriptionByIndex(int index) { - int count = 0; - for (SuiComponent component : components) { - if (component.getType() == SuiComponent.Type.SUBSCRIBE_TO_EVENT) { - if (index == count) return component; - else count++; - } - } - return null; - } - - public final long getRangeObjId() { - return rangeObjId; - } - - public final void setRangeObjId(long rangeObjId) { - this.rangeObjId = rangeObjId; - } - - public final int getId() { - return id; - } - - public final void setId(int id) { - this.id = id; - } - - public final String getSuiScript() { - return suiScript; - } - - public final float getMaxDistance() { - return maxDistance; - } - - public final void setMaxDistance(float maxDistance) { - this.maxDistance = maxDistance; - } - - public final List getComponents() { - return components; - } - - public final ISuiCallback getJavaCallback(String name) { - return callbacks != null ? callbacks.get(name) : null; - } - - public final String getCallbackScript(String function) { - return scriptCallbacks != null ? scriptCallbacks.get(function) : null; - } - - public final boolean hasCallbackFunction(String function) { - return scriptCallbacks != null && scriptCallbacks.containsKey(function); - } - - public final boolean hasJavaCallback(String name) { - return callbacks != null && callbacks.containsKey(name); - } - - public final boolean hasSubscriptionComponent() { - return hasSubscriptionComponent; - } - - private void addJavaCallback(String name, ISuiCallback callback) { - if (callbacks == null) callbacks = new HashMap<>(); - - callbacks.put(name, callback); - } - - private void addScriptCallback(String function, String script) { - if (scriptCallbacks == null) scriptCallbacks = new HashMap<>(); - - scriptCallbacks.put(function, script); - } - - private String getWrappedEventString(int event) { - return new String(new byte[]{(byte) event}, StandardCharsets.UTF_8); - } - - @Override - public byte[] encode() { - NetBuffer data = NetBuffer.allocate(getLength()); - data.addInt(id); - data.addAscii(suiScript); - data.addList(components); - data.addLong(rangeObjId); - data.addFloat(maxDistance); - data.addLong(0); // Window Location? - data.addInt(0); - return data.array(); - } - - @Override - public void decode(NetBuffer data) { - id = data.getInt(); - suiScript = data.getAscii(); - components = data.getList(SuiComponent.class); - rangeObjId = data.getLong(); - maxDistance = data.getFloat(); - // unk long - // unk int - } - - @Override - public int getLength() { - int listSize = 0; - for (SuiComponent component : components) { - listSize += component.getLength(); - } - return 34 + suiScript.length() + listSize; - } - -} diff --git a/src/resources/sui/SuiComponent.java b/src/resources/sui/SuiComponent.java deleted file mode 100644 index a4b6912a3..000000000 --- a/src/resources/sui/SuiComponent.java +++ /dev/null @@ -1,199 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package resources.sui; - -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.List; - -import com.projectswg.common.debug.Log; -import com.projectswg.common.encoding.Encodable; -import com.projectswg.common.encoding.StringType; -import com.projectswg.common.network.NetBuffer; - -/** - * @author Waverunner - */ -public class SuiComponent implements Encodable { - - private Type type; - private List wideParams; - private List narrowParams; - - public SuiComponent() { - type = Type.NONE; - wideParams = new ArrayList<>(); - narrowParams = new ArrayList<>(); - } - - public SuiComponent(Type type, String widget) { - this.type = type; - this.wideParams = new ArrayList<>(3); - this.narrowParams = new ArrayList<>(3); - - narrowParams.add(widget); - } - - public Type getType() { - return type; - } - public List getNarrowParams() { - return narrowParams; - } - public List getWideParams() { - return wideParams; - } - - /** - * Retrieve the base widget that this component targets - * @return Base widget this component targets - */ - public String getTarget() { - return narrowParams.get(0); - } - - public void addNarrowParam(String param) { - narrowParams.add(param); - } - - public void addWideParam(String param) { - wideParams.add(param); - } - - public List getSubscribedProperties() { - if (type != Type.SUBSCRIBE_TO_EVENT) - return null; - - int size = narrowParams.size(); - if (size < 3) { - Log.w("Tried to get subscribed properties when there are none for target %s", getTarget()); - } else { - List subscribedProperties = new ArrayList<>(); - - for (int i = 3; i < size;) { - String property = narrowParams.get(i++) + "." + narrowParams.get(i++); - subscribedProperties.add(property); - } - - return subscribedProperties; - } - return null; - } - - public String getSubscribeToEventCallback() { - if (type != Type.SUBSCRIBE_TO_EVENT) - return null; - - int size = narrowParams.size(); - if (size < 3) { - Log.w("Tried to get subscribed callback when there is none for target %s", getTarget()); - } else { - - return narrowParams.get(2); - } - return null; - } - - public int getSubscribedToEventType() { - if (type != Type.SUBSCRIBE_TO_EVENT) - return -1; - - int size = narrowParams.size(); - if (size < 3) { - Log.w("Tried to get subscribed event type when there is none for target %s", getTarget()); - } else { - byte[] bytes = narrowParams.get(1).getBytes(StandardCharsets.UTF_8); - if (bytes.length > 1) { - Log.w("Tried to get eventType but narrowparams string byte array length is more than 1"); - return -1; - } - - return bytes[0]; - } - return -1; - } - - @Override - public byte[] encode() { - NetBuffer data = NetBuffer.allocate(getLength()); - data.addByte(type.getValue()); - data.addList(wideParams, StringType.UNICODE); - data.addList(narrowParams, StringType.ASCII); - return data.array(); - } - - @Override - public void decode(NetBuffer data) { - type = Type.valueOf(data.getByte()); - wideParams = data.getList(StringType.UNICODE); - narrowParams = data.getList(StringType.ASCII); - } - - public int getLength() { - int size = 9; - - for (String param : wideParams) { - size += 4 + (param.length() * 2); - } - for (String param : narrowParams) { - size += 2 + param.length(); - } - - return size; - } - - public enum Type { - NONE(0), - CLEAR_DATA_SOURCE(1), - ADD_CHILD_WIDGET(2), - SET_PROPERTY(3), - ADD_DATA_ITEM(4), - SUBSCRIBE_TO_EVENT(5), - ADD_DATA_SOURCE_CONTAINER(6), - CLEAR_DATA_SOURCE_CONTAINER(7), - ADD_DATA_SOURCE(8); - - private byte value; - - Type(int value) { - this.value = (byte) value; - } - - public byte getValue() { - return value; - } - - public static Type valueOf(byte value) { - for (Type type : Type.values()) { - if (type.getValue() == value) - return type; - } - return NONE; - } - } -} diff --git a/src/resources/sui/SuiEvent.java b/src/resources/sui/SuiEvent.java deleted file mode 100644 index 7e2c0dc8a..000000000 --- a/src/resources/sui/SuiEvent.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package resources.sui; - -/** - * Created by Waverunner on 8/14/2015 - */ -public enum SuiEvent { - NONE(0), - BUTTON(1), - CHECKBOX(2), - ENABLE_DISABLE(3), - GENERIC(4), - SLIDER(5), - TAB_PANE(6), - TEXTBOX(7), - VISIBILITY_CHANGED(8), - OK_PRESSED(9), - CANCEL_PRESSED(10); - - private int value; - - SuiEvent(int value) { - this.value = value; - } - - public int getValue() { - return value; - } - - public static SuiEvent valueOf(int value) { - switch(value) { - case 0: return NONE; - case 1: return BUTTON; - case 2: return CHECKBOX; - case 3: return ENABLE_DISABLE; - case 4: return GENERIC; - case 5: return SLIDER; - case 6: return TAB_PANE; - case 7: return TEXTBOX; - case 8: return VISIBILITY_CHANGED; - case 9: return OK_PRESSED; - case 10: return CANCEL_PRESSED; - default: return NONE; - } - } -} diff --git a/src/resources/sui/SuiMessageBox.java b/src/resources/sui/SuiMessageBox.java index a95bf42a5..ec5ce79bd 100644 --- a/src/resources/sui/SuiMessageBox.java +++ b/src/resources/sui/SuiMessageBox.java @@ -27,6 +27,8 @@ ***********************************************************************************/ package resources.sui; +import com.projectswg.common.data.sui.ISuiCallback; + public class SuiMessageBox extends SuiWindow { public SuiMessageBox(SuiButtons buttons, String title, String prompt) { diff --git a/src/resources/sui/SuiWindow.java b/src/resources/sui/SuiWindow.java index 88ab77780..2b7e9cda5 100644 --- a/src/resources/sui/SuiWindow.java +++ b/src/resources/sui/SuiWindow.java @@ -27,6 +27,10 @@ ***********************************************************************************/ package resources.sui; +import com.projectswg.common.data.sui.ISuiCallback; +import com.projectswg.common.data.sui.SuiBaseWindow; +import com.projectswg.common.data.sui.SuiEvent; + import intents.sui.SuiWindowIntent; import resources.player.Player; diff --git a/src/services/CoreManager.java b/src/services/CoreManager.java index 00aa5652a..803b5566b 100644 --- a/src/services/CoreManager.java +++ b/src/services/CoreManager.java @@ -34,27 +34,27 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import com.projectswg.common.control.Manager; +import com.projectswg.common.data.encodables.galaxy.Galaxy; +import com.projectswg.common.data.encodables.galaxy.Galaxy.GalaxyStatus; import com.projectswg.common.data.info.Config; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.admin.AdminShutdownServer; +import com.projectswg.common.network.packets.swg.zone.baselines.Baseline; +import com.projectswg.common.network.packets.swg.zone.deltas.DeltasMessage; +import com.projectswg.common.network.packets.swg.zone.object_controller.ObjectController; +import com.projectswg.common.utilities.ThreadUtilities; import intents.network.InboundPacketIntent; import intents.network.OutboundPacketIntent; import intents.server.ServerManagementIntent; import intents.server.ServerStatusIntent; -import network.packets.Packet; -import network.packets.swg.admin.AdminShutdownServer; -import network.packets.swg.zone.baselines.Baseline; -import network.packets.swg.zone.deltas.DeltasMessage; -import network.packets.swg.zone.object_controller.ObjectController; -import resources.Galaxy; -import resources.Galaxy.GalaxyStatus; import resources.config.ConfigFile; import resources.control.ServerStatus; import resources.server_info.BasicLogStream; import resources.server_info.DataManager; import services.galaxy.GalacticManager; import utilities.ScheduledUtilities; -import utilities.ThreadUtilities; public class CoreManager extends Manager { @@ -64,7 +64,7 @@ public class CoreManager extends Manager { private final ScheduledExecutorService shutdownService; private final EngineManager engineManager; private final GalacticManager galacticManager; - private final BasicLogStream packetLogger; + private final BasicLogStream SWGPacketLogger; private final Config debugConfig; private long startTime; @@ -77,7 +77,7 @@ public class CoreManager extends Manager { if (adminServerPort <= 0) adminServerPort = -1; getGalaxy().setAdminServerPort(adminServerPort); - packetLogger = new BasicLogStream(new File("log/packets.txt")); + SWGPacketLogger = new BasicLogStream(new File("log/SWGPackets.txt")); shutdownService = Executors.newSingleThreadScheduledExecutor(ThreadUtilities.newThreadFactory("core-shutdown-service")); shutdownRequested = false; engineManager = new EngineManager(); @@ -152,14 +152,14 @@ public class CoreManager extends Manager { } private void printPacketStream(boolean in, long networkId, String str) { - packetLogger.log("%s %d:\t%s", in?"IN ":"OUT", networkId, str); + SWGPacketLogger.log("%s %d:\t%s", in?"IN ":"OUT", networkId, str); } private boolean isPacketDebug() { - return debugConfig.getBoolean("PACKET-LOGGING", false); + return debugConfig.getBoolean("SWGPacket-LOGGING", false); } - private String createExtendedPacketInformation(Packet p) { + private String createExtendedPacketInformation(SWGPacket p) { if (p instanceof Baseline) return createBaselineInformation((Baseline) p); if (p instanceof DeltasMessage) diff --git a/src/services/ShutdownService.java b/src/services/ShutdownService.java index 5b9fc663e..8501ffa1d 100644 --- a/src/services/ShutdownService.java +++ b/src/services/ShutdownService.java @@ -35,12 +35,12 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import com.projectswg.common.control.Service; +import com.projectswg.common.utilities.ThreadUtilities; import intents.chat.SystemMessageIntent; import intents.chat.SystemMessageIntent.BroadcastType; import intents.server.ServerStatusIntent; import resources.control.ServerStatus; -import utilities.ThreadUtilities; public class ShutdownService extends Service { diff --git a/src/services/chat/ChatMailService.java b/src/services/chat/ChatMailService.java index aa3d96c6b..71eb0540d 100644 --- a/src/services/chat/ChatMailService.java +++ b/src/services/chat/ChatMailService.java @@ -36,22 +36,21 @@ import java.util.Locale; import java.util.concurrent.atomic.AtomicReference; import com.projectswg.common.control.Service; +import com.projectswg.common.data.encodables.chat.ChatResult; +import com.projectswg.common.data.encodables.player.Mail; import com.projectswg.common.data.info.RelationalServerData; import com.projectswg.common.data.info.RelationalServerFactory; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.zone.chat.ChatDeletePersistentMessage; +import com.projectswg.common.network.packets.swg.zone.chat.ChatOnSendPersistentMessage; +import com.projectswg.common.network.packets.swg.zone.chat.ChatPersistentMessageToClient; +import com.projectswg.common.network.packets.swg.zone.chat.ChatPersistentMessageToServer; +import com.projectswg.common.network.packets.swg.zone.chat.ChatRequestPersistentMessage; import intents.PlayerEventIntent; import intents.chat.PersistentMessageIntent; import intents.network.GalacticPacketIntent; -import network.packets.Packet; -import network.packets.swg.SWGPacket; -import network.packets.swg.zone.chat.ChatDeletePersistentMessage; -import network.packets.swg.zone.chat.ChatOnSendPersistentMessage; -import network.packets.swg.zone.chat.ChatPersistentMessageToClient; -import network.packets.swg.zone.chat.ChatPersistentMessageToServer; -import network.packets.swg.zone.chat.ChatRequestPersistentMessage; -import resources.chat.ChatResult; -import resources.encodables.player.Mail; import resources.objects.SWGObject; import resources.objects.player.PlayerObject; import resources.player.Player; @@ -111,12 +110,9 @@ public class ChatMailService extends Service { } private void handleGalacticPacketIntent(GalacticPacketIntent gpi){ - Packet p = gpi.getPacket(); - if (!(p instanceof SWGPacket)) - return; - SWGPacket swg = (SWGPacket) p; + SWGPacket p = gpi.getPacket(); String galaxyName = CoreManager.getGalaxy().getName(); - switch (swg.getPacketType()) { + switch (p.getPacketType()) { /* Mails */ case CHAT_PERSISTENT_MESSAGE_TO_SERVER: if (p instanceof ChatPersistentMessageToServer) @@ -239,18 +235,18 @@ public class ChatMailService extends Service { return; } - ChatPersistentMessageToClient packet = null; + ChatPersistentMessageToClient SWGPacket = null; switch (requestType) { case FULL_MESSAGE: - packet = new ChatPersistentMessageToClient(mail, false); + SWGPacket = new ChatPersistentMessageToClient(mail, CoreManager.getGalaxy().getName(), false); break; case HEADER_ONLY: - packet = new ChatPersistentMessageToClient(mail, true); + SWGPacket = new ChatPersistentMessageToClient(mail, CoreManager.getGalaxy().getName(), true); break; } - receiver.sendPacket(packet); + receiver.sendPacket(SWGPacket); } private void deletePersistentMessage(int mailId) { diff --git a/src/services/chat/ChatManager.java b/src/services/chat/ChatManager.java index e1af3081a..a5279c689 100644 --- a/src/services/chat/ChatManager.java +++ b/src/services/chat/ChatManager.java @@ -32,31 +32,30 @@ import java.sql.SQLException; import java.util.Locale; import com.projectswg.common.control.Manager; +import com.projectswg.common.data.encodables.chat.ChatAvatar; +import com.projectswg.common.data.encodables.chat.ChatResult; +import com.projectswg.common.data.encodables.oob.OutOfBandPackage; +import com.projectswg.common.data.encodables.oob.ProsePackage; import com.projectswg.common.data.info.RelationalServerData; import com.projectswg.common.data.info.RelationalServerFactory; import com.projectswg.common.data.location.Terrain; import com.projectswg.common.debug.Assert; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.zone.chat.ChatFriendsListUpdate; +import com.projectswg.common.network.packets.swg.zone.chat.ChatInstantMessageToCharacter; +import com.projectswg.common.network.packets.swg.zone.chat.ChatInstantMessageToClient; +import com.projectswg.common.network.packets.swg.zone.chat.ChatOnSendInstantMessage; +import com.projectswg.common.network.packets.swg.zone.chat.ChatSystemMessage; +import com.projectswg.common.network.packets.swg.zone.chat.ChatSystemMessage.SystemChatType; +import com.projectswg.common.network.packets.swg.zone.object_controller.SpatialChat; import intents.NotifyPlayersPacketIntent; import intents.PlayerEventIntent; import intents.chat.ChatAvatarRequestIntent; -import intents.chat.SystemMessageIntent; import intents.chat.SpatialChatIntent; +import intents.chat.SystemMessageIntent; import intents.network.GalacticPacketIntent; -import network.packets.Packet; -import network.packets.swg.SWGPacket; -import network.packets.swg.zone.chat.ChatFriendsListUpdate; -import network.packets.swg.zone.chat.ChatInstantMessageToCharacter; -import network.packets.swg.zone.chat.ChatInstantMessageToClient; -import network.packets.swg.zone.chat.ChatOnSendInstantMessage; -import network.packets.swg.zone.chat.ChatSystemMessage; -import network.packets.swg.zone.chat.ChatSystemMessage.SystemChatType; -import network.packets.swg.zone.object_controller.SpatialChat; -import resources.chat.ChatAvatar; -import resources.chat.ChatResult; -import resources.encodables.OutOfBandPackage; -import resources.encodables.ProsePackage; import resources.objects.SWGObject; import resources.objects.player.PlayerObject; import resources.player.Player; @@ -86,7 +85,7 @@ public class ChatManager extends Manager { } private void handleGalacticPacketIntent(GalacticPacketIntent gpi) { - Packet p = gpi.getPacket(); + SWGPacket p = gpi.getPacket(); if (!(p instanceof SWGPacket)) return; switch (((SWGPacket) p).getPacketType()) { @@ -314,13 +313,13 @@ public class ChatManager extends Manager { } private void broadcastPlanetMessage(String message, Terrain terrain) { - ChatSystemMessage packet = new ChatSystemMessage(SystemChatType.PERSONAL, message); - new NotifyPlayersPacketIntent(packet, terrain).broadcast(); + ChatSystemMessage SWGPacket = new ChatSystemMessage(SystemChatType.PERSONAL, message); + new NotifyPlayersPacketIntent(SWGPacket, terrain).broadcast(); } private void broadcastGalaxyMessage(String message) { - ChatSystemMessage packet = new ChatSystemMessage(SystemChatType.PERSONAL, message); - new NotifyPlayersPacketIntent(packet).broadcast(); + ChatSystemMessage SWGPacket = new ChatSystemMessage(SystemChatType.PERSONAL, message); + new NotifyPlayersPacketIntent(SWGPacket).broadcast(); } private void broadcastPersonalMessage(Player player, String message) { diff --git a/src/services/chat/ChatRoomContainer.java b/src/services/chat/ChatRoomContainer.java index a18a59730..a53f95370 100644 --- a/src/services/chat/ChatRoomContainer.java +++ b/src/services/chat/ChatRoomContainer.java @@ -32,11 +32,10 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import com.projectswg.common.data.encodables.chat.ChatRoom; import com.projectswg.common.debug.Assert; import com.projectswg.common.debug.Log; -import resources.chat.ChatRoom; - public class ChatRoomContainer { private final Object mapMutex; diff --git a/src/services/chat/ChatRoomHandler.java b/src/services/chat/ChatRoomHandler.java index 8dd5fa2c0..b64dd73f9 100644 --- a/src/services/chat/ChatRoomHandler.java +++ b/src/services/chat/ChatRoomHandler.java @@ -33,23 +33,24 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; +import com.projectswg.common.data.encodables.chat.ChatAvatar; +import com.projectswg.common.data.encodables.chat.ChatResult; +import com.projectswg.common.data.encodables.chat.ChatRoom; +import com.projectswg.common.data.encodables.oob.OutOfBandPackage; import com.projectswg.common.data.info.RelationalServerData; import com.projectswg.common.data.info.RelationalServerFactory; import com.projectswg.common.data.location.Terrain; import com.projectswg.common.data.swgfile.visitors.DatatableData; import com.projectswg.common.debug.Assert; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.swg.zone.chat.ChatOnDestroyRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatOnEnteredRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatOnLeaveRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatOnSendRoomMessage; +import com.projectswg.common.network.packets.swg.zone.chat.ChatRoomMessage; +import com.projectswg.common.network.packets.swg.zone.insertion.ChatRoomList; -import network.packets.swg.zone.chat.ChatOnDestroyRoom; -import network.packets.swg.zone.chat.ChatOnEnteredRoom; -import network.packets.swg.zone.chat.ChatOnLeaveRoom; -import network.packets.swg.zone.chat.ChatOnSendRoomMessage; -import network.packets.swg.zone.insertion.ChatRoomList; -import resources.chat.ChatAvatar; -import resources.chat.ChatResult; -import resources.chat.ChatRoom; import resources.client_info.ServerFactory; -import resources.encodables.OutOfBandPackage; import resources.player.AccessLevel; import resources.player.Player; import resources.server_info.CachedObjectDatabase; @@ -259,7 +260,15 @@ public class ChatRoomHandler { player.sendPacket(new ChatOnSendRoomMessage(result.getCode(), sequence)); if (result == ChatResult.SUCCESS) { - room.sendMessage(avatar, message, oobPackage, player.getPlayerManager()); + ChatRoomMessage chatRoomMessage = new ChatRoomMessage(avatar, room.getId(), message, oobPackage); + for (ChatAvatar member : room.getMembers()) { + if (member.getPlayer().getPlayerObject().isIgnored(sender.getName())) + continue; + + member.getPlayer().sendPacket(chatRoomMessage); + } + + room.sendMessage(avatar, message, oobPackage); logChat(player.getCreatureObject().getObjectId(), player.getCharacterName(), room.getId() + "/" + room.getPath(), message); } } @@ -274,11 +283,11 @@ public class ChatRoomHandler { rooms.destroyRoom(room); } - // Send the ChatOnDestroyRoom packet to every else in the room besides the person destroying the packet - ChatOnDestroyRoom packet = new ChatOnDestroyRoom(destroyer, ChatResult.SUCCESS.getCode(), room.getId(), 0); + // Send the ChatOnDestroyRoom SWGPacket to every else in the room besides the person destroying the SWGPacket + ChatOnDestroyRoom SWGPacket = new ChatOnDestroyRoom(destroyer, ChatResult.SUCCESS.getCode(), room.getId(), 0); room.getMembers().forEach(member -> { if (!destroyer.equals(member)) - member.getPlayer().sendPacket(packet); + member.getPlayer().sendPacket(SWGPacket); }); return true; diff --git a/src/services/chat/ChatRoomService.java b/src/services/chat/ChatRoomService.java index d778929c2..c967d8e62 100644 --- a/src/services/chat/ChatRoomService.java +++ b/src/services/chat/ChatRoomService.java @@ -28,42 +28,41 @@ package services.chat; import com.projectswg.common.control.Service; +import com.projectswg.common.data.encodables.chat.ChatAvatar; +import com.projectswg.common.data.encodables.chat.ChatResult; +import com.projectswg.common.data.encodables.chat.ChatRoom; +import com.projectswg.common.data.encodables.oob.OutOfBandPackage; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.zone.chat.ChatAddModeratorToRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatBanAvatarFromRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatCreateRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatDestroyRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatEnterRoomById; +import com.projectswg.common.network.packets.swg.zone.chat.ChatInviteAvatarToRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatKickAvatarFromRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatOnAddModeratorToRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatOnBanAvatarFromRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatOnCreateRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatOnDestroyRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatOnInviteToRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatOnKickAvatarFromRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatOnReceiveRoomInvitation; +import com.projectswg.common.network.packets.swg.zone.chat.ChatOnRemoveModeratorFromRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatOnUnbanAvatarFromRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatOnUninviteFromRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatQueryRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatQueryRoomResults; +import com.projectswg.common.network.packets.swg.zone.chat.ChatRemoveAvatarFromRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatRemoveModeratorFromRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatRequestRoomList; +import com.projectswg.common.network.packets.swg.zone.chat.ChatSendToRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatUnbanAvatarFromRoom; +import com.projectswg.common.network.packets.swg.zone.chat.ChatUninviteFromRoom; +import com.projectswg.common.network.packets.swg.zone.insertion.ChatRoomList; import intents.PlayerEventIntent; import intents.chat.ChatRoomUpdateIntent; import intents.network.GalacticPacketIntent; -import network.packets.Packet; -import network.packets.swg.SWGPacket; -import network.packets.swg.zone.chat.ChatAddModeratorToRoom; -import network.packets.swg.zone.chat.ChatBanAvatarFromRoom; -import network.packets.swg.zone.chat.ChatCreateRoom; -import network.packets.swg.zone.chat.ChatDestroyRoom; -import network.packets.swg.zone.chat.ChatEnterRoomById; -import network.packets.swg.zone.chat.ChatInviteAvatarToRoom; -import network.packets.swg.zone.chat.ChatKickAvatarFromRoom; -import network.packets.swg.zone.chat.ChatOnAddModeratorToRoom; -import network.packets.swg.zone.chat.ChatOnBanAvatarFromRoom; -import network.packets.swg.zone.chat.ChatOnCreateRoom; -import network.packets.swg.zone.chat.ChatOnDestroyRoom; -import network.packets.swg.zone.chat.ChatOnInviteToRoom; -import network.packets.swg.zone.chat.ChatOnKickAvatarFromRoom; -import network.packets.swg.zone.chat.ChatOnReceiveRoomInvitation; -import network.packets.swg.zone.chat.ChatOnRemoveModeratorFromRoom; -import network.packets.swg.zone.chat.ChatOnUnbanAvatarFromRoom; -import network.packets.swg.zone.chat.ChatOnUninviteFromRoom; -import network.packets.swg.zone.chat.ChatQueryRoom; -import network.packets.swg.zone.chat.ChatQueryRoomResults; -import network.packets.swg.zone.chat.ChatRemoveAvatarFromRoom; -import network.packets.swg.zone.chat.ChatRemoveModeratorFromRoom; -import network.packets.swg.zone.chat.ChatRequestRoomList; -import network.packets.swg.zone.chat.ChatSendToRoom; -import network.packets.swg.zone.chat.ChatUnbanAvatarFromRoom; -import network.packets.swg.zone.chat.ChatUninviteFromRoom; -import network.packets.swg.zone.insertion.ChatRoomList; -import resources.chat.ChatAvatar; -import resources.chat.ChatResult; -import resources.chat.ChatRoom; -import resources.encodables.OutOfBandPackage; import resources.player.Player; public class ChatRoomService extends Service { @@ -89,7 +88,7 @@ public class ChatRoomService extends Service { } private void handleGalacticPacketIntent(GalacticPacketIntent gpi) { - Packet p = gpi.getPacket(); + SWGPacket p = gpi.getPacket(); if (p instanceof SWGPacket) processSwgPacket(gpi.getPlayer(), (SWGPacket) p); } diff --git a/src/services/collections/CollectionBadgeManager.java b/src/services/collections/CollectionBadgeManager.java index 73613d791..ba16e3445 100644 --- a/src/services/collections/CollectionBadgeManager.java +++ b/src/services/collections/CollectionBadgeManager.java @@ -34,11 +34,11 @@ import java.util.BitSet; import com.projectswg.common.control.Manager; import com.projectswg.common.data.swgfile.ClientFactory; import com.projectswg.common.data.swgfile.visitors.DatatableData; +import com.projectswg.common.network.packets.swg.zone.PlayMusicMessage; import intents.GrantBadgeIntent; import intents.GrantClickyCollectionIntent; import intents.object.DestroyObjectIntent; -import network.packets.swg.zone.PlayMusicMessage; import resources.objects.SWGObject; import resources.objects.collections.ClickyCollectionItem; import resources.objects.collections.CollectionItem; diff --git a/src/services/collections/CollectionService.java b/src/services/collections/CollectionService.java index c142097c1..9ea015080 100644 --- a/src/services/collections/CollectionService.java +++ b/src/services/collections/CollectionService.java @@ -36,6 +36,7 @@ import java.util.List; import com.projectswg.common.control.Service; import com.projectswg.common.data.info.RelationalServerData; import com.projectswg.common.data.info.RelationalServerFactory; +import com.projectswg.common.data.radial.RadialOption; import com.projectswg.common.debug.Log; import intents.GrantClickyCollectionIntent; @@ -44,7 +45,6 @@ import intents.radial.RadialResponseIntent; import intents.radial.RadialSelectionIntent; import resources.objects.collections.ClickyCollectionItem; import resources.objects.collections.CollectionItem; -import resources.radial.RadialOption; import resources.radial.Radials; public class CollectionService extends Service { diff --git a/src/services/combat/CombatManager.java b/src/services/combat/CombatManager.java index 4354a541a..3c888f73b 100644 --- a/src/services/combat/CombatManager.java +++ b/src/services/combat/CombatManager.java @@ -44,13 +44,27 @@ import java.util.stream.Collectors; import com.projectswg.common.control.Manager; import com.projectswg.common.data.CRC; import com.projectswg.common.data.RGB; +import com.projectswg.common.data.combat.AttackInfo; +import com.projectswg.common.data.combat.CombatStatus; +import com.projectswg.common.data.combat.HitLocation; +import com.projectswg.common.data.combat.TrailLocation; +import com.projectswg.common.data.encodables.oob.ProsePackage; +import com.projectswg.common.data.encodables.oob.StringId; +import com.projectswg.common.data.encodables.tangible.Posture; import com.projectswg.common.data.location.Location; import com.projectswg.common.data.swgfile.ClientFactory; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.swg.zone.PlayClientEffectObjectMessage; +import com.projectswg.common.network.packets.swg.zone.object_controller.ShowFlyText; +import com.projectswg.common.network.packets.swg.zone.object_controller.ShowFlyText.Scale; +import com.projectswg.common.network.packets.swg.zone.object_controller.combat.CombatAction; +import com.projectswg.common.network.packets.swg.zone.object_controller.combat.CombatAction.Defender; +import com.projectswg.common.network.packets.swg.zone.object_controller.combat.CombatSpam; +import com.projectswg.common.utilities.ThreadUtilities; import intents.BuffIntent; -import intents.chat.SystemMessageIntent; import intents.chat.ChatCommandIntent; +import intents.chat.SystemMessageIntent; import intents.combat.CreatureIncapacitatedIntent; import intents.combat.CreatureKilledIntent; import intents.combat.DeathblowIntent; @@ -58,27 +72,13 @@ import intents.combat.IncapacitateCreatureIntent; import intents.combat.KillCreatureIntent; import intents.object.DestroyObjectIntent; import intents.object.ObjectCreatedIntent; -import network.packets.swg.zone.PlayClientEffectObjectMessage; -import network.packets.swg.zone.object_controller.ShowFlyText; -import network.packets.swg.zone.object_controller.ShowFlyText.Scale; -import network.packets.swg.zone.object_controller.combat.CombatAction; -import network.packets.swg.zone.object_controller.combat.CombatSpam; -import resources.Posture; -import resources.combat.AttackInfo; -import resources.combat.CombatStatus; -import resources.combat.HitLocation; -import services.combat.LootService; -import resources.combat.TrailLocation; import resources.commands.CombatCommand; -import resources.encodables.ProsePackage; -import resources.encodables.StringId; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; import resources.objects.staticobject.StaticObject; import resources.objects.tangible.TangibleObject; import resources.objects.weapon.WeaponObject; import services.objects.ObjectCreator; -import utilities.ThreadUtilities; public class CombatManager extends Manager { @@ -382,7 +382,9 @@ public class CombatManager extends Manager { CombatAction action = new CombatAction(source.getObjectId()); String anim = command.getRandomAnimation(weapon.getType()); action.setActionCrc(CRC.getCrc(anim)); - action.setAttacker(source); + action.setAttackerId(source.getObjectId()); + action.setPosture(source.getPosture()); + action.setWeaponId(source.getEquippedWeapon() == null ? 0 : source.getEquippedWeapon().getObjectId()); action.setClientEffectId((byte) 0); action.setCommandCrc(command.getCrc()); action.setTrail(TrailLocation.WEAPON); @@ -399,8 +401,11 @@ public class CombatManager extends Manager { source.addDefender(target); CombatSpam combatSpam = new CombatSpam(source.getObjectId()); - combatSpam.setAttacker(source); - combatSpam.setDefender(target); + combatSpam.setAttacker(source.getObjectId()); + combatSpam.setAttackerPosition(source.getLocation().getPosition()); + combatSpam.setWeapon(source.getEquippedWeapon() == null ? 0 : source.getEquippedWeapon().getObjectId()); + combatSpam.setDefender(target.getObjectId()); + combatSpam.setDefenderPosition(target.getLocation().getPosition()); combatSpam.setInfo(info); combatSpam.setAttackName(new StringId("cmd_n", command.getName())); combatSpam.setWeapon(weapon.getObjectId()); @@ -426,7 +431,7 @@ public class CombatManager extends Manager { int finalDamage = info.getFinalDamage(); - action.addDefender(target, true, (byte) 0, HitLocation.HIT_LOCATION_BODY, (short) finalDamage); + action.addDefender(new Defender(target.getObjectId(), target.getPosture(), true, (byte) 0, HitLocation.HIT_LOCATION_BODY, (short) finalDamage)); target.handleDamage(source, finalDamage); diff --git a/src/services/combat/CorpseService.java b/src/services/combat/CorpseService.java index b60c92405..39d4251aa 100644 --- a/src/services/combat/CorpseService.java +++ b/src/services/combat/CorpseService.java @@ -41,12 +41,20 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import com.projectswg.common.control.Service; +import com.projectswg.common.data.encodables.oob.ProsePackage; +import com.projectswg.common.data.encodables.oob.StringId; +import com.projectswg.common.data.encodables.tangible.Posture; +import com.projectswg.common.data.encodables.tangible.PvpFaction; +import com.projectswg.common.data.encodables.tangible.PvpStatus; import com.projectswg.common.data.info.RelationalDatabase; import com.projectswg.common.data.info.RelationalServerFactory; import com.projectswg.common.data.location.Location; import com.projectswg.common.data.location.Terrain; +import com.projectswg.common.data.sui.SuiEvent; import com.projectswg.common.data.swgfile.ClientFactory; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.swg.zone.PlayClientEffectObjectMessage; +import com.projectswg.common.utilities.ThreadUtilities; import intents.BuffIntent; import intents.FactionIntent; @@ -56,12 +64,6 @@ import intents.combat.CreatureKilledIntent; import intents.object.DestroyObjectIntent; import intents.object.ObjectCreatedIntent; import intents.object.ObjectTeleportIntent; -import network.packets.swg.zone.PlayClientEffectObjectMessage; -import resources.Posture; -import resources.PvpFaction; -import resources.PvpStatus; -import resources.encodables.ProsePackage; -import resources.encodables.StringId; import resources.objects.SWGObject; import resources.objects.building.BuildingObject; import resources.objects.cell.CellObject; @@ -69,10 +71,8 @@ import resources.objects.creature.CreatureObject; import resources.player.Player; import resources.server_info.StandardLog; import resources.sui.SuiButtons; -import resources.sui.SuiEvent; import resources.sui.SuiListBox; import resources.sui.SuiWindow; -import utilities.ThreadUtilities; /** * The {@code CorpseService} removes corpses from the world a while after @@ -262,16 +262,16 @@ public final class CorpseService extends Service { suiWindow.addListItem(name); } - suiWindow.addCallback("handleFacilityChoice", (Player player, SWGObject actor, SuiEvent event, Map parameters) -> { + suiWindow.addCallback("handleFacilityChoice", (SuiEvent event, Map parameters) -> { int selectionIndex = SuiListBox.getSelectedRow(parameters); if (event != SuiEvent.OK_PRESSED || selectionIndex >= availableFacilities.size() || selectionIndex < 0) { - suiWindow.display(player); + suiWindow.display(corpse.getOwner()); return; } if (reviveCorpse(corpse, availableFacilities.get(selectionIndex)) != CloneResult.SUCCESS) { - suiWindow.display(player); + suiWindow.display(corpse.getOwner()); } }); diff --git a/src/services/combat/DuelPlayerService.java b/src/services/combat/DuelPlayerService.java index 033131143..41cca6c1c 100644 --- a/src/services/combat/DuelPlayerService.java +++ b/src/services/combat/DuelPlayerService.java @@ -28,13 +28,13 @@ package services.combat; import com.projectswg.common.control.Service; +import com.projectswg.common.data.encodables.oob.ProsePackage; +import com.projectswg.common.data.encodables.oob.StringId; +import com.projectswg.common.data.encodables.tangible.PvpFlag; import com.projectswg.common.data.location.Location; import intents.chat.SystemMessageIntent; import intents.combat.DuelPlayerIntent; -import resources.PvpFlag; -import resources.encodables.ProsePackage; -import resources.encodables.StringId; import resources.objects.creature.CreatureObject; public class DuelPlayerService extends Service { diff --git a/src/services/combat/LootService.java b/src/services/combat/LootService.java index e731e8dce..c9da76afc 100644 --- a/src/services/combat/LootService.java +++ b/src/services/combat/LootService.java @@ -40,8 +40,12 @@ import com.projectswg.common.control.Service; import com.projectswg.common.data.info.RelationalDatabase; import com.projectswg.common.data.info.RelationalServerFactory; import com.projectswg.common.data.location.Location; +import com.projectswg.common.data.radial.RadialItem; +import com.projectswg.common.data.radial.RadialOption; import com.projectswg.common.data.swgfile.ClientFactory; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.swg.zone.ClientOpenContainerMessage; +import com.projectswg.common.network.packets.swg.zone.PlayClientEffectObjectTransformMessage; import intents.chat.ChatCommandIntent; import intents.chat.SystemMessageIntent; @@ -52,8 +56,6 @@ import intents.object.ObjectCreatedIntent; import intents.radial.RadialRequestIntent; import intents.radial.RadialResponseIntent; import intents.radial.RadialSelectionIntent; -import network.packets.swg.zone.ClientOpenContainerMessage; -import network.packets.swg.zone.PlayClientEffectObjectTransformMessage; import resources.config.ConfigFile; import resources.containers.ContainerPermissionsType; import resources.objects.SWGObject; @@ -63,8 +65,6 @@ import resources.objects.custom.AIObject; import resources.objects.group.GroupObject; import resources.objects.tangible.TangibleObject; import resources.player.Player; -import resources.radial.RadialItem; -import resources.radial.RadialOption; import resources.server_info.DataManager; import resources.server_info.StandardLog; import services.objects.ObjectCreator; diff --git a/src/services/commands/BuffService.java b/src/services/commands/BuffService.java index 3b5996b9b..c620f39de 100644 --- a/src/services/commands/BuffService.java +++ b/src/services/commands/BuffService.java @@ -27,11 +27,20 @@ ***********************************************************************************/ package services.commands; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Optional; +import java.util.Set; +import java.util.stream.Stream; + import com.projectswg.common.concurrency.PswgBasicScheduledThread; import com.projectswg.common.control.Service; import com.projectswg.common.data.CRC; import com.projectswg.common.debug.Assert; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.swg.zone.PlayClientEffectObjectMessage; + import groovy.util.ResourceException; import groovy.util.ScriptException; import intents.BuffIntent; @@ -39,7 +48,6 @@ import intents.PlayerEventIntent; import intents.SkillModIntent; import intents.combat.CreatureKilledIntent; import main.ProjectSWG; -import network.packets.swg.zone.PlayClientEffectObjectMessage; import resources.objects.creature.Buff; import resources.objects.creature.CreatureObject; import resources.server_info.StandardLog; @@ -47,13 +55,6 @@ import services.commands.buff.BuffData; import services.commands.buff.BuffMap; import utilities.Scripts; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Stream; - public class BuffService extends Service { /* diff --git a/src/services/commands/CommandCooldownHandler.java b/src/services/commands/CommandCooldownHandler.java index adc17a7f1..49241055c 100644 --- a/src/services/commands/CommandCooldownHandler.java +++ b/src/services/commands/CommandCooldownHandler.java @@ -35,8 +35,8 @@ import java.util.Set; import com.projectswg.common.concurrency.PswgScheduledThreadPool; import com.projectswg.common.data.CRC; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.swg.zone.object_controller.CommandTimer; -import network.packets.swg.zone.object_controller.CommandTimer; import resources.commands.Command; import resources.objects.creature.CreatureObject; import services.commands.CommandLauncher.EnqueuedCommand; diff --git a/src/services/commands/CommandLauncher.java b/src/services/commands/CommandLauncher.java index ca19ab9ab..b45449e59 100644 --- a/src/services/commands/CommandLauncher.java +++ b/src/services/commands/CommandLauncher.java @@ -33,17 +33,17 @@ import java.util.PriorityQueue; import java.util.Queue; import com.projectswg.common.concurrency.PswgScheduledThreadPool; +import com.projectswg.common.data.encodables.oob.ProsePackage; +import com.projectswg.common.data.encodables.oob.StringId; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.swg.zone.object_controller.CommandQueueDequeue; +import com.projectswg.common.network.packets.swg.zone.object_controller.CommandQueueEnqueue; import groovy.util.ResourceException; import groovy.util.ScriptException; -import intents.chat.SystemMessageIntent; import intents.chat.ChatCommandIntent; -import network.packets.swg.zone.object_controller.CommandQueueDequeue; -import network.packets.swg.zone.object_controller.CommandQueueEnqueue; +import intents.chat.SystemMessageIntent; import resources.commands.Command; -import resources.encodables.ProsePackage; -import resources.encodables.StringId; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; import resources.player.AccessLevel; diff --git a/src/services/commands/CommandService.java b/src/services/commands/CommandService.java index b4c94507f..0067155aa 100644 --- a/src/services/commands/CommandService.java +++ b/src/services/commands/CommandService.java @@ -33,20 +33,20 @@ import java.util.Locale; import com.projectswg.common.control.Service; import com.projectswg.common.data.CRC; +import com.projectswg.common.data.combat.AttackType; +import com.projectswg.common.data.combat.DamageType; +import com.projectswg.common.data.combat.DelayAttackEggPosition; +import com.projectswg.common.data.combat.HitType; +import com.projectswg.common.data.combat.ValidTarget; import com.projectswg.common.data.swgfile.ClientFactory; import com.projectswg.common.data.swgfile.visitors.DatatableData; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.zone.object_controller.CommandQueueEnqueue; import intents.PlayerEventIntent; import intents.network.GalacticPacketIntent; import intents.player.PlayerTransformedIntent; -import network.packets.Packet; -import network.packets.swg.zone.object_controller.CommandQueueEnqueue; -import resources.combat.AttackType; -import resources.combat.DamageType; -import resources.combat.DelayAttackEggPosition; -import resources.combat.HitType; -import resources.combat.ValidTarget; import resources.commands.CombatCommand; import resources.commands.Command; import resources.commands.DefaultPriority; @@ -116,7 +116,7 @@ public class CommandService extends Service { } private void handleGalacticPacketIntent(GalacticPacketIntent gpi) { - Packet p = gpi.getPacket(); + SWGPacket p = gpi.getPacket(); if (p instanceof CommandQueueEnqueue) { CommandQueueEnqueue controller = (CommandQueueEnqueue) p; handleCommandRequest(gpi.getPlayer(), gpi.getGalacticManager(), controller); diff --git a/src/services/commands/EntertainmentService.java b/src/services/commands/EntertainmentService.java index bfdf9f2b6..cafb679d5 100644 --- a/src/services/commands/EntertainmentService.java +++ b/src/services/commands/EntertainmentService.java @@ -37,10 +37,14 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import com.projectswg.common.control.Service; +import com.projectswg.common.data.encodables.oob.ProsePackage; +import com.projectswg.common.data.encodables.oob.StringId; +import com.projectswg.common.data.encodables.tangible.Posture; import com.projectswg.common.data.location.Location; import com.projectswg.common.data.swgfile.ClientFactory; import com.projectswg.common.data.swgfile.visitors.DatatableData; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.swg.zone.object_controller.Animation; import intents.DanceIntent; import intents.FlourishIntent; @@ -49,10 +53,6 @@ import intents.WatchIntent; import intents.chat.SystemMessageIntent; import intents.experience.ExperienceIntent; import intents.player.PlayerTransformedIntent; -import network.packets.swg.zone.object_controller.Animation; -import resources.Posture; -import resources.encodables.ProsePackage; -import resources.encodables.StringId; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; import resources.player.Player; @@ -454,7 +454,7 @@ public class EntertainmentService extends Service { PerformanceData performanceData = performanceMap.get(performanceName); int flourishXpMod = performanceData.getFlourishXpMod(); int performanceCounter = performer.getPerformanceCounter(); - int xpGained = (int) (performanceCounter * flourishXpMod); + int xpGained = performanceCounter * flourishXpMod; if(xpGained > 0) { new ExperienceIntent(performer, "entertainer", xpGained).broadcast(); diff --git a/src/services/crafting/resource/raw/RawResource.java b/src/services/crafting/resource/raw/RawResource.java index cbabeaa6b..4efe1a092 100644 --- a/src/services/crafting/resource/raw/RawResource.java +++ b/src/services/crafting/resource/raw/RawResource.java @@ -31,7 +31,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -import resources.encodables.StringId; +import com.projectswg.common.data.encodables.oob.StringId; + import services.crafting.resource.galactic.RawResourceType; public class RawResource { diff --git a/src/services/crafting/survey/SampleSession.java b/src/services/crafting/survey/SampleSession.java index ced990cbe..e0c83bac0 100644 --- a/src/services/crafting/survey/SampleSession.java +++ b/src/services/crafting/survey/SampleSession.java @@ -29,12 +29,12 @@ package services.crafting.survey; import java.util.List; +import com.projectswg.common.data.encodables.tangible.Posture; import com.projectswg.common.data.location.Terrain; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.swg.zone.PlayClientEffectObjectMessage; +import com.projectswg.common.network.packets.swg.zone.PlayMusicMessage; -import network.packets.swg.zone.PlayClientEffectObjectMessage; -import network.packets.swg.zone.PlayMusicMessage; -import resources.Posture; import resources.objects.creature.CreatureObject; import services.crafting.resource.galactic.GalacticResource; import services.crafting.resource.galactic.GalacticResourceSpawn; diff --git a/src/services/crafting/survey/SurveyService.java b/src/services/crafting/survey/SurveyService.java index 1d0f50160..086ea0ad8 100644 --- a/src/services/crafting/survey/SurveyService.java +++ b/src/services/crafting/survey/SurveyService.java @@ -29,13 +29,13 @@ package services.crafting.survey; import com.projectswg.common.control.Service; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.swg.zone.PlayMusicMessage; +import com.projectswg.common.network.packets.swg.zone.crafting.resources.ResourceListForSurveyMessage; +import com.projectswg.common.network.packets.swg.zone.crafting.resources.ResourceListForSurveyMessage.ResourceItem; import intents.crafting.survey.SampleResourceIntent; import intents.crafting.survey.StartSurveyToolIntent; import intents.crafting.survey.StartSurveyingIntent; -import network.packets.swg.zone.PlayMusicMessage; -import network.packets.swg.zone.crafting.resources.ResourceListForSurveyMessage; -import network.packets.swg.zone.crafting.resources.ResourceListForSurveyMessage.ResourceItem; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; import services.crafting.resource.galactic.GalacticResource; diff --git a/src/services/crafting/survey/SurveySession.java b/src/services/crafting/survey/SurveySession.java index 15bf4fcbe..050d8a231 100644 --- a/src/services/crafting/survey/SurveySession.java +++ b/src/services/crafting/survey/SurveySession.java @@ -31,11 +31,11 @@ import java.util.List; import com.projectswg.common.data.location.Terrain; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.swg.zone.PlayClientEffectObjectMessage; +import com.projectswg.common.network.packets.swg.zone.PlayMusicMessage; +import com.projectswg.common.network.packets.swg.zone.crafting.surveying.SurveyMessage; +import com.projectswg.common.network.packets.swg.zone.crafting.surveying.SurveyMessage.ResourceConcentration; -import network.packets.swg.zone.PlayClientEffectObjectMessage; -import network.packets.swg.zone.PlayMusicMessage; -import network.packets.swg.zone.crafting.surveying.SurveyMessage; -import network.packets.swg.zone.crafting.surveying.SurveyMessage.ResourceConcentration; import resources.objects.creature.CreatureObject; import services.crafting.resource.galactic.GalacticResource; import services.crafting.resource.galactic.GalacticResourceSpawn; diff --git a/src/services/dev/DeveloperService.java b/src/services/dev/DeveloperService.java index 35b8a8f7b..fa02becf1 100644 --- a/src/services/dev/DeveloperService.java +++ b/src/services/dev/DeveloperService.java @@ -28,11 +28,11 @@ package services.dev; import com.projectswg.common.control.Service; +import com.projectswg.common.data.encodables.tangible.PvpFlag; import com.projectswg.common.data.location.Location; import com.projectswg.common.data.location.Terrain; import intents.object.ObjectCreatedIntent; -import resources.PvpFlag; import resources.config.ConfigFile; import resources.objects.SWGObject; import resources.objects.custom.DefaultAIObject; diff --git a/src/services/experience/ExperienceManager.java b/src/services/experience/ExperienceManager.java index 4a981266d..37e4ac108 100644 --- a/src/services/experience/ExperienceManager.java +++ b/src/services/experience/ExperienceManager.java @@ -33,18 +33,18 @@ import java.util.Map; import com.projectswg.common.control.Manager; import com.projectswg.common.data.RGB; +import com.projectswg.common.data.encodables.oob.OutOfBandPackage; +import com.projectswg.common.data.encodables.oob.ProsePackage; +import com.projectswg.common.data.encodables.oob.StringId; import com.projectswg.common.data.swgfile.ClientFactory; import com.projectswg.common.data.swgfile.visitors.DatatableData; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.swg.zone.object_controller.ShowFlyText; +import com.projectswg.common.network.packets.swg.zone.object_controller.ShowFlyText.Scale; import intents.experience.ExperienceIntent; import intents.experience.LevelChangedIntent; -import network.packets.swg.zone.object_controller.ShowFlyText; -import network.packets.swg.zone.object_controller.ShowFlyText.Scale; import resources.config.ConfigFile; -import resources.encodables.OutOfBandPackage; -import resources.encodables.ProsePackage; -import resources.encodables.StringId; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; import resources.server_info.DataManager; @@ -108,16 +108,8 @@ public final class ExperienceManager extends Manager { } private int awardExperience(CreatureObject creatureObject, PlayerObject playerObject, String xpType, int xpGained) { - Integer currentXp = playerObject.getExperiencePoints(xpType); - int newXpTotal; - - xpGained *= xpMultiplier; - - if (currentXp == null) { // They don't have this type of XP already - newXpTotal = xpGained; - } else { // They already have this kind of XP - add gained to current - newXpTotal = currentXp + xpGained; - } + int currentXp = playerObject.getExperiencePoints(xpType); + int newXpTotal = currentXp + (int) (xpGained * xpMultiplier); playerObject.setExperiencePoints(xpType, newXpTotal); creatureObject.setTotalLevelXp(newXpTotal); diff --git a/src/services/experience/ExpertiseService.java b/src/services/experience/ExpertiseService.java index fa79e0a74..3a998522f 100644 --- a/src/services/experience/ExpertiseService.java +++ b/src/services/experience/ExpertiseService.java @@ -41,12 +41,12 @@ import com.projectswg.common.data.info.RelationalServerFactory; import com.projectswg.common.data.swgfile.ClientFactory; import com.projectswg.common.data.swgfile.visitors.DatatableData; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.zone.ExpertiseRequestMessage; import intents.experience.GrantSkillIntent; import intents.experience.LevelChangedIntent; import intents.network.GalacticPacketIntent; -import network.packets.Packet; -import network.packets.swg.zone.ExpertiseRequestMessage; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; import resources.server_info.StandardLog; @@ -167,13 +167,13 @@ public final class ExpertiseService extends Service { } private void handleGalacticPacketIntent(GalacticPacketIntent gpi) { - Packet packet = gpi.getPacket(); + SWGPacket SWGPacket = gpi.getPacket(); - if (!(packet instanceof ExpertiseRequestMessage)) { + if (!(SWGPacket instanceof ExpertiseRequestMessage)) { return; } - ExpertiseRequestMessage expertiseRequestMessage = (ExpertiseRequestMessage) packet; + ExpertiseRequestMessage expertiseRequestMessage = (ExpertiseRequestMessage) SWGPacket; CreatureObject creatureObject = gpi.getPlayer().getCreatureObject(); String[] requestedSkills = expertiseRequestMessage.getRequestedSkills(); diff --git a/src/services/experience/SkillManager.java b/src/services/experience/SkillManager.java index 2fb9345ed..f63d64efb 100644 --- a/src/services/experience/SkillManager.java +++ b/src/services/experience/SkillManager.java @@ -37,12 +37,12 @@ import com.projectswg.common.data.swgfile.ClientFactory; import com.projectswg.common.data.swgfile.visitors.DatatableData; import com.projectswg.common.debug.Assert; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.zone.object_controller.ChangeRoleIconChoice; import intents.SkillModIntent; import intents.experience.GrantSkillIntent; import intents.network.GalacticPacketIntent; -import network.packets.Packet; -import network.packets.swg.zone.object_controller.ChangeRoleIconChoice; import resources.objects.creature.CreatureObject; /** @@ -144,9 +144,9 @@ public final class SkillManager extends Manager { } private void handleGalacticPacketIntent(GalacticPacketIntent gpi) { - Packet packet = gpi.getPacket(); - if (packet instanceof ChangeRoleIconChoice) { - ChangeRoleIconChoice iconChoice = (ChangeRoleIconChoice) packet; + SWGPacket SWGPacket = gpi.getPacket(); + if (SWGPacket instanceof ChangeRoleIconChoice) { + ChangeRoleIconChoice iconChoice = (ChangeRoleIconChoice) SWGPacket; changeRoleIcon(gpi.getPlayer().getCreatureObject(), iconChoice.getIconChoice()); } } diff --git a/src/services/experience/SkillTemplateService.java b/src/services/experience/SkillTemplateService.java index 3b76d83d6..3ce80590c 100644 --- a/src/services/experience/SkillTemplateService.java +++ b/src/services/experience/SkillTemplateService.java @@ -35,22 +35,22 @@ import java.util.Map; import com.projectswg.common.control.Service; import com.projectswg.common.data.RGB; +import com.projectswg.common.data.encodables.oob.StringId; +import com.projectswg.common.data.encodables.tangible.Race; import com.projectswg.common.data.swgfile.ClientFactory; import com.projectswg.common.data.swgfile.visitors.DatatableData; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.swg.zone.PlayClientEffectObjectMessage; +import com.projectswg.common.network.packets.swg.zone.PlayMusicMessage; +import com.projectswg.common.network.packets.swg.zone.object_controller.ShowFlyText; +import com.projectswg.common.network.packets.swg.zone.object_controller.ShowFlyText.Scale; import intents.GrantBadgeIntent; import intents.experience.GrantSkillIntent; import intents.experience.LevelChangedIntent; import intents.object.CreateStaticItemIntent; import intents.object.ObjectCreatedIntent; -import network.packets.swg.zone.PlayClientEffectObjectMessage; -import network.packets.swg.zone.PlayMusicMessage; -import network.packets.swg.zone.object_controller.ShowFlyText; -import network.packets.swg.zone.object_controller.ShowFlyText.Scale; -import resources.Race; import resources.containers.ContainerPermissionsType; -import resources.encodables.StringId; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; diff --git a/src/services/faction/FactionService.java b/src/services/faction/FactionService.java index 991149338..a87da573c 100644 --- a/src/services/faction/FactionService.java +++ b/src/services/faction/FactionService.java @@ -36,19 +36,19 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import com.projectswg.common.control.Service; +import com.projectswg.common.data.encodables.tangible.PvpFaction; +import com.projectswg.common.data.encodables.tangible.PvpFlag; +import com.projectswg.common.data.encodables.tangible.PvpStatus; +import com.projectswg.common.network.packets.swg.zone.UpdatePvpStatusMessage; +import com.projectswg.common.network.packets.swg.zone.chat.ChatSystemMessage; +import com.projectswg.common.network.packets.swg.zone.chat.ChatSystemMessage.SystemChatType; +import com.projectswg.common.utilities.ThreadUtilities; import intents.FactionIntent; import intents.chat.SystemMessageIntent; -import network.packets.swg.zone.UpdatePvpStatusMessage; -import network.packets.swg.zone.chat.ChatSystemMessage; -import network.packets.swg.zone.chat.ChatSystemMessage.SystemChatType; -import resources.PvpFaction; -import resources.PvpFlag; -import resources.PvpStatus; import resources.objects.creature.CreatureObject; import resources.objects.tangible.TangibleObject; import resources.player.Player; -import utilities.ThreadUtilities; public final class FactionService extends Service { diff --git a/src/services/galaxy/ConnectionService.java b/src/services/galaxy/ConnectionService.java index 3c13305e5..8305dca12 100644 --- a/src/services/galaxy/ConnectionService.java +++ b/src/services/galaxy/ConnectionService.java @@ -38,12 +38,13 @@ import com.projectswg.common.control.IntentChain; import com.projectswg.common.control.Service; import com.projectswg.common.debug.Assert; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.swg.zone.HeartBeat; +import com.projectswg.common.utilities.ThreadUtilities; import intents.PlayerEventIntent; import intents.connection.ForceLogoutIntent; import intents.network.CloseConnectionIntent; import intents.network.GalacticPacketIntent; -import network.packets.swg.zone.HeartBeat; import resources.network.DisconnectReason; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; @@ -51,7 +52,6 @@ import resources.player.Player; import resources.player.PlayerEvent; import resources.player.PlayerFlags; import services.CoreManager; -import utilities.ThreadUtilities; public class ConnectionService extends Service { diff --git a/src/services/galaxy/EnvironmentService.java b/src/services/galaxy/EnvironmentService.java index 995f8fd89..038633a23 100644 --- a/src/services/galaxy/EnvironmentService.java +++ b/src/services/galaxy/EnvironmentService.java @@ -35,18 +35,18 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import com.projectswg.common.control.Service; +import com.projectswg.common.data.WeatherType; import com.projectswg.common.data.location.Terrain; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.zone.ServerTimeMessage; +import com.projectswg.common.network.packets.swg.zone.ServerWeatherMessage; +import com.projectswg.common.utilities.ThreadUtilities; import intents.NotifyPlayersPacketIntent; import intents.PlayerEventIntent; import main.ProjectSWG; -import network.packets.swg.SWGPacket; -import network.packets.swg.zone.ServerTimeMessage; -import network.packets.swg.zone.ServerWeatherMessage; -import resources.WeatherType; import resources.player.Player; import resources.player.PlayerEvent; -import utilities.ThreadUtilities; public final class EnvironmentService extends Service { @@ -115,7 +115,7 @@ public final class EnvironmentService extends Service { private void setWeather(Terrain terrain, WeatherType type) { SWGPacket swm; - // Ziggy: Prevent packets containing the same weather from being sent + // Ziggy: Prevent SWGPackets containing the same weather from being sent if(weatherForTerrain.containsKey(terrain)) if(type.equals(weatherForTerrain.get(terrain))) return; diff --git a/src/services/galaxy/SkillModService.java b/src/services/galaxy/SkillModService.java index 83fb4534c..3e303ac9c 100644 --- a/src/services/galaxy/SkillModService.java +++ b/src/services/galaxy/SkillModService.java @@ -33,15 +33,15 @@ import java.sql.SQLException; import java.util.Map; import com.projectswg.common.control.Service; +import com.projectswg.common.data.encodables.tangible.Race; import com.projectswg.common.data.info.RelationalServerData; import com.projectswg.common.data.info.RelationalServerFactory; import com.projectswg.common.debug.Log; import intents.SkillModIntent; -import intents.player.CreatedCharacterIntent; import intents.experience.LevelChangedIntent; import intents.object.ContainerTransferIntent; -import resources.Race; +import intents.player.CreatedCharacterIntent; import resources.objects.creature.CreatureObject; import resources.objects.player.PlayerObject; import resources.player.Player; diff --git a/src/services/galaxy/terminals/TerminalService.java b/src/services/galaxy/terminals/TerminalService.java index 8c251d3cf..386430ad1 100644 --- a/src/services/galaxy/terminals/TerminalService.java +++ b/src/services/galaxy/terminals/TerminalService.java @@ -38,13 +38,13 @@ import java.util.Set; import com.projectswg.common.control.Service; import com.projectswg.common.data.info.RelationalServerData; import com.projectswg.common.data.info.RelationalServerFactory; +import com.projectswg.common.data.radial.RadialOption; import com.projectswg.common.debug.Log; import intents.radial.RadialRegisterIntent; import intents.radial.RadialRequestIntent; import intents.radial.RadialResponseIntent; import intents.radial.RadialSelectionIntent; -import resources.radial.RadialOption; import resources.radial.Radials; public class TerminalService extends Service { diff --git a/src/services/galaxy/travel/TravelGroup.java b/src/services/galaxy/travel/TravelGroup.java index ea785cfde..a9867376e 100644 --- a/src/services/galaxy/travel/TravelGroup.java +++ b/src/services/galaxy/travel/TravelGroup.java @@ -32,9 +32,9 @@ import java.util.List; import java.util.concurrent.atomic.AtomicLong; import com.projectswg.common.concurrency.Delay; +import com.projectswg.common.data.encodables.tangible.Posture; import com.projectswg.common.debug.Log; -import resources.Posture; import resources.objects.creature.CreatureObject; public class TravelGroup implements Runnable { diff --git a/src/services/galaxy/travel/TravelHelper.java b/src/services/galaxy/travel/TravelHelper.java index b1fe0c79b..386e8f85e 100644 --- a/src/services/galaxy/travel/TravelHelper.java +++ b/src/services/galaxy/travel/TravelHelper.java @@ -36,6 +36,8 @@ import java.util.List; import java.util.Map; import com.projectswg.common.concurrency.PswgThreadPool; +import com.projectswg.common.data.encodables.oob.ProsePackage; +import com.projectswg.common.data.encodables.oob.StringId; import com.projectswg.common.data.info.Config; import com.projectswg.common.data.location.Location; import com.projectswg.common.data.location.Terrain; @@ -48,8 +50,6 @@ import intents.object.DestroyObjectIntent; import intents.object.ObjectCreatedIntent; import intents.object.ObjectTeleportIntent; import resources.config.ConfigFile; -import resources.encodables.ProsePackage; -import resources.encodables.StringId; import resources.objects.SWGObject; import resources.objects.SpecificObject; import resources.objects.creature.CreatureObject; diff --git a/src/services/galaxy/travel/TravelService.java b/src/services/galaxy/travel/TravelService.java index 7c43673ec..3dd5e9e32 100644 --- a/src/services/galaxy/travel/TravelService.java +++ b/src/services/galaxy/travel/TravelService.java @@ -33,8 +33,16 @@ import java.util.Collections; import java.util.List; import com.projectswg.common.control.Service; +import com.projectswg.common.data.encodables.oob.ProsePackage; +import com.projectswg.common.data.encodables.oob.StringId; +import com.projectswg.common.data.encodables.tangible.Posture; import com.projectswg.common.data.location.Terrain; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.zone.EnterTicketPurchaseModeMessage; +import com.projectswg.common.network.packets.swg.zone.PlanetTravelPointListRequest; +import com.projectswg.common.network.packets.swg.zone.PlanetTravelPointListResponse; +import com.projectswg.common.network.packets.swg.zone.PlanetTravelPointListResponse.PlanetTravelPoint; import intents.chat.SystemMessageIntent; import intents.network.GalacticPacketIntent; @@ -42,14 +50,7 @@ import intents.object.ObjectCreatedIntent; import intents.travel.TicketPurchaseIntent; import intents.travel.TicketUseIntent; import intents.travel.TravelPointSelectionIntent; -import network.packets.Packet; -import network.packets.swg.zone.EnterTicketPurchaseModeMessage; -import network.packets.swg.zone.PlanetTravelPointListRequest; -import network.packets.swg.zone.PlanetTravelPointListResponse; -import resources.Posture; import resources.config.ConfigFile; -import resources.encodables.ProsePackage; -import resources.encodables.StringId; import resources.objects.SWGObject; import resources.objects.SpecificObject; import resources.objects.creature.CreatureObject; @@ -114,12 +115,12 @@ public class TravelService extends Service { traveler.sendSelf(new EnterTicketPurchaseModeMessage(traveler.getTerrain().getName(), travel.getNearestTravelPoint(traveler).getName(), tpsi.isInstant())); } - private void handleTravelPointRequest(GalacticPacketIntent i) { - Packet p = i.getPacket(); + private void handleTravelPointRequest(GalacticPacketIntent gpi) { + SWGPacket p = gpi.getPacket(); if (p instanceof PlanetTravelPointListRequest) { String planetName = ((PlanetTravelPointListRequest) p).getPlanetName(); - Player player = i.getPlayer(); + Player player = gpi.getPlayer(); Terrain to = Terrain.getTerrainFromName(planetName); if (to == null) { Log.e("Unknown terrain in PlanetTravelPointListRequest: %s", planetName); @@ -132,7 +133,14 @@ public class TravelService extends Service { if (pointsForPlanet.remove(nearest)) pointsForPlanet.add(0, nearest); // Yes ... adding it to the beginning of the list because I hate the client - player.sendPacket(new PlanetTravelPointListResponse(planetName, pointsForPlanet, getAdditionalCosts(nearest, pointsForPlanet))); + List additionalCosts = getAdditionalCosts(nearest, pointsForPlanet); + List pointList = new ArrayList<>(); + for (int i = 0; i < pointsForPlanet.size(); i++) { + TravelPoint tp = pointsForPlanet.get(i); + int cost = additionalCosts.get(i); + pointList.add(new PlanetTravelPoint(tp.getName(), tp.getLocation().getPosition(), cost, tp.isReachable())); + } + player.sendPacket(new PlanetTravelPointListResponse(planetName, pointList)); } } @@ -203,12 +211,12 @@ public class TravelService extends Service { ticketBox.addListItem(destinationPoint.getSuiFormat(), destinationPoint); } - ticketBox.addOkButtonCallback("handleSelectedItem", (callbackPlayer, actor, event, parameters) -> { + ticketBox.addOkButtonCallback("handleSelectedItem", (event, parameters) -> { int row = SuiListBox.getSelectedRow(parameters); SWGObject ticket = usableTickets.get(row); TravelPoint nearestPoint = travel.getNearestTravelPoint(ticket); TravelPoint destinationPoint = (TravelPoint) ticketBox.getListItem(row).getObject(); - travel.handleTicketUse(callbackPlayer, ticket, nearestPoint, destinationPoint); + travel.handleTicketUse(player, ticket, nearestPoint, destinationPoint); }); ticketBox.display(player); } diff --git a/src/services/group/GroupService.java b/src/services/group/GroupService.java index d04a7d765..cecdee9b5 100644 --- a/src/services/group/GroupService.java +++ b/src/services/group/GroupService.java @@ -31,24 +31,23 @@ import java.util.Set; import com.projectswg.common.concurrency.SynchronizedMap; import com.projectswg.common.control.Service; +import com.projectswg.common.data.encodables.chat.ChatAvatar; +import com.projectswg.common.data.encodables.oob.ProsePackage; +import com.projectswg.common.data.sui.SuiEvent; import com.projectswg.common.debug.Assert; import intents.GroupEventIntent; import intents.PlayerEventIntent; -import intents.chat.SystemMessageIntent; import intents.chat.ChatRoomUpdateIntent; import intents.chat.ChatRoomUpdateIntent.UpdateType; +import intents.chat.SystemMessageIntent; import intents.object.DestroyObjectIntent; import intents.object.ObjectCreatedIntent; -import resources.chat.ChatAvatar; -import resources.encodables.ProsePackage; -import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; import resources.objects.group.GroupObject; import resources.player.Player; import resources.player.Player.PlayerServer; import resources.sui.SuiButtons; -import resources.sui.SuiEvent; import resources.sui.SuiListBox; import services.objects.ObjectCreator; import services.objects.ObjectManager.ObjectLookup; @@ -119,7 +118,7 @@ public class GroupService extends Service { window.addListItem("Lottery"); window.addListItem("Random"); - window.addCallback("handleSelectedItem", (Player player, SWGObject actor, SuiEvent event, Map parameters) -> { + window.addCallback("handleSelectedItem", (SuiEvent event, Map parameters) -> { if (event != SuiEvent.OK_PRESSED) return; @@ -143,10 +142,10 @@ public class GroupService extends Service { lootRuleMsg = "selected_free4all"; } - GroupObject groupObject = (GroupObject) ObjectLookup.getObjectById(player.getCreatureObject().getGroupId()); + GroupObject groupObject = (GroupObject) ObjectLookup.getObjectById(groupLeader.getCreatureObject().getGroupId()); groupObject.setLootRule(selectedRow); groupObject.displayLootRuleChangeBox(lootRuleMsg); - sendSystemMessage(player, lootRuleMsg); + sendSystemMessage(groupLeader, lootRuleMsg); }); window.display(groupLeader); } diff --git a/src/services/map/CityService.java b/src/services/map/CityService.java index 6fa7d0c46..bbc24d1d5 100644 --- a/src/services/map/CityService.java +++ b/src/services/map/CityService.java @@ -39,12 +39,12 @@ import com.projectswg.common.data.info.RelationalDatabase; import com.projectswg.common.data.info.RelationalServerFactory; import com.projectswg.common.data.location.Terrain; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.zone.object_controller.DataTransform; import intents.PlayerEventIntent; import intents.network.GalacticPacketIntent; import intents.object.ObjectCreatedIntent; -import network.packets.Packet; -import network.packets.swg.zone.object_controller.DataTransform; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; import resources.objects.tangible.TangibleObject; @@ -85,7 +85,7 @@ public class CityService extends Service { private void handleGalacticPacketIntent(GalacticPacketIntent i) { GalacticPacketIntent gpi = i; - Packet p = gpi.getPacket(); + SWGPacket p = gpi.getPacket(); if (p instanceof DataTransform) { performLocationUpdate(gpi.getPlayer().getCreatureObject()); } diff --git a/src/services/map/MapLocation.java b/src/services/map/MapLocation.java deleted file mode 100644 index 3c3569ef4..000000000 --- a/src/services/map/MapLocation.java +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2015 /// Project SWG /// www.projectswg.com - * - * ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on - * July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. - * Our goal is to create an emulator which will provide a server for players to - * continue playing a game similar to the one they used to play. We are basing - * it on the final publish of the game prior to end-game events. - * - * This file is part of Holocore. - * - * -------------------------------------------------------------------------------- - * - * Holocore is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * Holocore 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Holocore. If not, see - ******************************************************************************/ - -package services.map; - -import com.projectswg.common.encoding.CachedEncode; -import com.projectswg.common.encoding.Encodable; -import com.projectswg.common.network.NetBuffer; - -public class MapLocation implements Encodable { - - private long id; - private String name; - private float x; - private float y; - private byte category; - private byte subcategory; - private boolean isActive; - - private final CachedEncode cache; - - public MapLocation() { - this.cache = new CachedEncode(() -> encodeImpl()); - } - - public MapLocation(long id, String name, float x, float y, byte category, byte subcategory, boolean isActive) { - this(); - this.id = id; - this.name = name; - this.x = x; - this.y = y; - this.category = category; - this.subcategory = subcategory; - this.isActive = isActive; - } - - public long getId() { - return id; - } - - public void setId(long id) { - cache.clearCached(); - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - cache.clearCached(); - this.name = name; - } - - public float getX() { - return x; - } - - public void setX(float x) { - cache.clearCached(); - this.x = x; - } - - public float getY() { - return y; - } - - public void setY(float y) { - cache.clearCached(); - this.y = y; - } - - public byte getCategory() { - return category; - } - - public void setCategory(byte category) { - cache.clearCached(); - this.category = category; - } - - public byte getSubcategory() { - return subcategory; - } - - public void setSubcategory(byte subcategory) { - cache.clearCached(); - this.subcategory = subcategory; - } - - public boolean isActive() { - return isActive; - } - - public void setIsActive(boolean isActive) { - cache.clearCached(); - this.isActive = isActive; - } - - @Override - public byte[] encode() { - return cache.encode(); - } - - @Override - public void decode(NetBuffer data) { - id = data.getLong(); - name = data.getUnicode(); - x = data.getFloat(); - y = data.getFloat(); - category = data.getByte(); - subcategory = data.getByte(); - isActive = data.getBoolean(); - } - - private byte [] encodeImpl() { - NetBuffer data = NetBuffer.allocate(getLength()); - data.addLong(id); - data.addUnicode(name); - data.addFloat(x); - data.addFloat(y); - data.addByte(category); - data.addByte(subcategory); - data.addBoolean(isActive); - return data.array(); - } - - @Override - public int getLength() { - return name.length() * 2 + 23; - } - - @Override - public String toString() { - return name + " x: " + x + "y: " + y; - } -} diff --git a/src/services/map/MapManager.java b/src/services/map/MapManager.java index 32a7067cf..51b2f9951 100644 --- a/src/services/map/MapManager.java +++ b/src/services/map/MapManager.java @@ -35,15 +35,15 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; import com.projectswg.common.control.Manager; +import com.projectswg.common.data.encodables.map.MapLocation; import com.projectswg.common.data.swgfile.ClientFactory; import com.projectswg.common.data.swgfile.visitors.DatatableData; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.zone.spatial.GetMapLocationsMessage; +import com.projectswg.common.network.packets.swg.zone.spatial.GetMapLocationsResponseMessage; import intents.network.GalacticPacketIntent; import intents.object.ObjectCreatedIntent; -import network.packets.Packet; -import network.packets.swg.SWGPacket; -import network.packets.swg.zone.spatial.GetMapLocationsMessage; -import network.packets.swg.zone.spatial.GetMapLocationsResponseMessage; import resources.client_info.ServerFactory; import resources.objects.SWGObject; import resources.player.Player; @@ -91,7 +91,7 @@ public class MapManager extends Manager { } private void processPacket(GalacticPacketIntent intent) { - Packet p = intent.getPacket(); + SWGPacket p = intent.getPacket(); if (p instanceof SWGPacket) processSwgPacket(intent.getPlayer(), (SWGPacket) p); } diff --git a/src/services/network/HolocoreSessionManager.java b/src/services/network/HolocoreSessionManager.java index 1ee4d8d90..e2f8e2127 100644 --- a/src/services/network/HolocoreSessionManager.java +++ b/src/services/network/HolocoreSessionManager.java @@ -31,20 +31,19 @@ import java.util.ArrayDeque; import java.util.Queue; import com.projectswg.common.debug.Log; - -import network.packets.Packet; -import network.packets.swg.ErrorMessage; -import network.packets.swg.holo.HoloConnectionStarted; -import network.packets.swg.holo.HoloConnectionStopped; -import network.packets.swg.holo.HoloConnectionStopped.ConnectionStoppedReason; -import network.packets.swg.holo.HoloPacket; -import network.packets.swg.holo.HoloSetProtocolVersion; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.ErrorMessage; +import com.projectswg.common.network.packets.swg.holo.HoloConnectionStarted; +import com.projectswg.common.network.packets.swg.holo.HoloConnectionStopped; +import com.projectswg.common.network.packets.swg.holo.HoloConnectionStopped.ConnectionStoppedReason; +import com.projectswg.common.network.packets.swg.holo.HoloPacket; +import com.projectswg.common.network.packets.swg.holo.HoloSetProtocolVersion; public class HolocoreSessionManager { private static final String PROTOCOL = "2016-04-13"; - private final Queue outbound; + private final Queue outbound; private HolocoreSessionCallback callback; private Status status; @@ -59,11 +58,11 @@ public class HolocoreSessionManager { } /** - * Called when a packet is being received - * @param p the packet received - * @return TRUE if the packet is allowed to be broadcasted, FALSE otherwise + * Called when a SWGPacket is being received + * @param p the SWGPacket received + * @return TRUE if the SWGPacket is allowed to be broadcasted, FALSE otherwise */ - public ResponseAction onInbound(Packet p) { + public ResponseAction onInbound(SWGPacket p) { boolean holoPacket = p instanceof HoloPacket; if (!holoPacket && getConnectionStatus() != Status.CONNECTED) { addToOutbound(new ErrorMessage("Network Manager", "Upgrade your launcher!", false)); @@ -76,8 +75,8 @@ public class HolocoreSessionManager { return ResponseAction.CONTINUE; } - private ResponseAction processSetProtocolVersion(HoloSetProtocolVersion packet) { - if (!packet.getProtocol().equals(PROTOCOL)) { + private ResponseAction processSetProtocolVersion(HoloSetProtocolVersion SWGPacket) { + if (!SWGPacket.getProtocol().equals(PROTOCOL)) { addToOutbound(new HoloConnectionStopped(ConnectionStoppedReason.INVALID_PROTOCOL)); return ResponseAction.SHUT_DOWN; } @@ -87,17 +86,17 @@ public class HolocoreSessionManager { } /** - * Called when a packet is being sent out - * @param p the packet being sent - * @return TRUE if the packet is allowed to be sent, FALSE otherwise + * Called when a SWGPacket is being sent out + * @param p the SWGPacket being sent + * @return TRUE if the SWGPacket is allowed to be sent, FALSE otherwise */ - public ResponseAction onOutbound(Packet p) { + public ResponseAction onOutbound(SWGPacket p) { return ResponseAction.CONTINUE; } - public Packet [] getOutbound() { + public SWGPacket [] getOutbound() { synchronized (outbound) { - Packet [] ret = outbound.toArray(new Packet[outbound.size()]); + SWGPacket [] ret = outbound.toArray(new SWGPacket[outbound.size()]); outbound.clear(); return ret; } @@ -115,7 +114,7 @@ public class HolocoreSessionManager { updateStatus(Status.DISCONNECTED); } - private void addToOutbound(Packet p) { + private void addToOutbound(SWGPacket p) { synchronized (outbound) { outbound.add(p); } diff --git a/src/services/network/NetworkClientManager.java b/src/services/network/NetworkClientManager.java index f5d2ae5ae..b26fe3abe 100644 --- a/src/services/network/NetworkClientManager.java +++ b/src/services/network/NetworkClientManager.java @@ -39,12 +39,12 @@ import com.projectswg.common.debug.Log; import com.projectswg.common.network.NetBuffer; import com.projectswg.common.network.TCPServer; import com.projectswg.common.network.TCPServer.TCPCallback; +import com.projectswg.common.network.packets.swg.holo.HoloConnectionStopped.ConnectionStoppedReason; import intents.network.CloseConnectionIntent; import main.ProjectSWG.CoreException; import network.AdminNetworkClient; import network.NetworkClient; -import network.packets.swg.holo.HoloConnectionStopped.ConnectionStoppedReason; import resources.config.ConfigFile; import resources.network.UDPServer; import resources.network.UDPServer.UDPPacket; @@ -73,7 +73,7 @@ public class NetworkClientManager extends Manager { adminServer = null; else adminServer = new TCPServer(InetAddress.getLoopbackAddress(), adminServerPort, 1024); - udpServer.setCallback(packet -> onUdpPacket(packet)); + udpServer.setCallback(SWGPacket -> onUdpPacket(SWGPacket)); inboundManager = new InboundNetworkManager(clientManager); outboundManager = new OutboundNetworkManager(tcpServer, clientManager); @@ -134,11 +134,11 @@ public class NetworkClientManager extends Manager { return DataManager.getConfig(ConfigFile.NETWORK).getInt("BUFFER-SIZE", 4096); } - private void onUdpPacket(UDPPacket packet) { - if (packet.getLength() <= 0) + private void onUdpPacket(UDPPacket SWGPacket) { + if (SWGPacket.getLength() <= 0) return; - switch (packet.getData()[0]) { - case 1: sendState(packet.getAddress(), packet.getPort()); break; + switch (SWGPacket.getData()[0]) { + case 1: sendState(SWGPacket.getAddress(), SWGPacket.getPort()); break; default: break; } } diff --git a/src/services/network/NetworkProtocol.java b/src/services/network/NetworkProtocol.java index 8a3f97f76..786aefb3b 100644 --- a/src/services/network/NetworkProtocol.java +++ b/src/services/network/NetworkProtocol.java @@ -33,20 +33,19 @@ import com.projectswg.common.debug.Assert; import com.projectswg.common.debug.Log; import com.projectswg.common.network.NetBuffer; import com.projectswg.common.network.NetBufferStream; +import com.projectswg.common.network.packets.PacketType; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.zone.object_controller.ObjectController; -import network.PacketType; import network.encryption.Compression; -import network.packets.Packet; -import network.packets.swg.SWGPacket; -import network.packets.swg.zone.object_controller.ObjectController; public class NetworkProtocol { - public NetBuffer encode(Packet p) { + public NetBuffer encode(SWGPacket p) { NetBuffer encoded = p.encode(); encoded.flip(); if (encoded.remaining() != encoded.capacity()) - Log.w("Packet %s has invalid array length. Expected: %d Actual: %d", p, encoded.remaining(), encoded.capacity()); + Log.w("SWGPacket %s has invalid array length. Expected: %d Actual: %d", p, encoded.remaining(), encoded.capacity()); return preparePacket(encoded); } @@ -65,7 +64,7 @@ public class NetworkProtocol { } } - public Packet decode(NetBufferStream buffer) throws EOFException { + public SWGPacket decode(NetBufferStream buffer) throws EOFException { if (buffer.remaining() < 5) throw new EOFException("Not enough remaining data for header! Remaining: " + buffer.remaining()); byte bitfield = buffer.getByte(); @@ -83,13 +82,13 @@ public class NetworkProtocol { return processSWG(pData); } - private NetBuffer preparePacket(NetBuffer packet) { - int remaining = packet.remaining(); + private NetBuffer preparePacket(NetBuffer SWGPacket) { + int remaining = SWGPacket.remaining(); NetBuffer data = NetBuffer.allocate(remaining + 5); data.addByte(2); // SWG bitmask data.addShort(remaining); data.addShort(remaining); - data.add(packet); + data.add(SWGPacket); data.flip(); return data; } diff --git a/src/services/objects/ObjectAwareness.java b/src/services/objects/ObjectAwareness.java index 4753664fa..ed72017ea 100644 --- a/src/services/objects/ObjectAwareness.java +++ b/src/services/objects/ObjectAwareness.java @@ -34,6 +34,16 @@ import com.projectswg.common.data.location.Point3D; import com.projectswg.common.data.location.Terrain; import com.projectswg.common.debug.Assert; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.zone.CmdSceneReady; +import com.projectswg.common.network.packets.swg.zone.HeartBeat; +import com.projectswg.common.network.packets.swg.zone.ParametersMessage; +import com.projectswg.common.network.packets.swg.zone.chat.ChatOnConnectAvatar; +import com.projectswg.common.network.packets.swg.zone.chat.VoiceChatStatus; +import com.projectswg.common.network.packets.swg.zone.insertion.ChatServerStatus; +import com.projectswg.common.network.packets.swg.zone.insertion.CmdStartScene; +import com.projectswg.common.network.packets.swg.zone.object_controller.DataTransform; +import com.projectswg.common.network.packets.swg.zone.object_controller.DataTransformWithParent; import intents.PlayerEventIntent; import intents.RequestZoneInIntent; @@ -47,16 +57,6 @@ import intents.object.ObjectCreatedIntent; import intents.object.ObjectTeleportIntent; import intents.player.PlayerTransformedIntent; import main.ProjectSWG; -import network.packets.Packet; -import network.packets.swg.zone.CmdSceneReady; -import network.packets.swg.zone.HeartBeat; -import network.packets.swg.zone.ParametersMessage; -import network.packets.swg.zone.chat.ChatOnConnectAvatar; -import network.packets.swg.zone.chat.VoiceChatStatus; -import network.packets.swg.zone.insertion.ChatServerStatus; -import network.packets.swg.zone.insertion.CmdStartScene; -import network.packets.swg.zone.object_controller.DataTransform; -import network.packets.swg.zone.object_controller.DataTransformWithParent; import resources.config.ConfigFile; import resources.network.DisconnectReason; import resources.objects.SWGObject; @@ -171,13 +171,13 @@ public class ObjectAwareness extends Service implements TerrainMapCallback { } private void processGalacticPacketIntent(GalacticPacketIntent gpi) { - Packet packet = gpi.getPacket(); - if (packet instanceof DataTransform) { - handleDataTransform((DataTransform) packet, gpi.getObjectManager()); - } else if (packet instanceof DataTransformWithParent) { - handleDataTransformWithParent((DataTransformWithParent) packet, gpi.getObjectManager()); - } else if (packet instanceof CmdSceneReady) { - handleCmdSceneReady(gpi.getPlayer(), (CmdSceneReady) packet); + SWGPacket SWGPacket = gpi.getPacket(); + if (SWGPacket instanceof DataTransform) { + handleDataTransform((DataTransform) SWGPacket, gpi.getObjectManager()); + } else if (SWGPacket instanceof DataTransformWithParent) { + handleDataTransformWithParent((DataTransformWithParent) SWGPacket, gpi.getObjectManager()); + } else if (SWGPacket instanceof CmdSceneReady) { + handleCmdSceneReady(gpi.getPlayer(), (CmdSceneReady) SWGPacket); } } diff --git a/src/services/objects/ObjectCreator.java b/src/services/objects/ObjectCreator.java index 54677c8e2..9d73806bd 100644 --- a/src/services/objects/ObjectCreator.java +++ b/src/services/objects/ObjectCreator.java @@ -145,6 +145,7 @@ public final class ObjectCreator { case GOT_MISC_CONTAINER_SHIP_LOOT: case GOT_MISC_CONTAINER_WEARABLE: case GOT_MISC_FURNITURE: return new TangibleObject(objectId); + case GOT_STATIC: return new StaticObject(objectId); default: return null; } } @@ -167,6 +168,7 @@ public final class ObjectCreator { case GOTM_CYBERNETIC: case GOTM_TERMINAL: case GOTM_POWERUP_WEAPON: return new TangibleObject(objectId); + case GOTM_NONE: default: return null; } } diff --git a/src/services/objects/ObjectManager.java b/src/services/objects/ObjectManager.java index b4969fde0..683112e0b 100644 --- a/src/services/objects/ObjectManager.java +++ b/src/services/objects/ObjectManager.java @@ -34,12 +34,12 @@ import java.util.concurrent.atomic.AtomicReference; import com.projectswg.common.control.Manager; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.zone.object_controller.IntendedTarget; import intents.network.GalacticPacketIntent; import intents.object.DestroyObjectIntent; import intents.object.ObjectCreatedIntent; -import network.packets.Packet; -import network.packets.swg.zone.object_controller.IntendedTarget; import resources.objects.SWGObject; import resources.objects.building.BuildingObject; import resources.objects.cell.CellObject; @@ -199,9 +199,9 @@ public class ObjectManager extends Manager { } private void processGalacticPacketIntent(GalacticPacketIntent gpi) { - Packet packet = gpi.getPacket(); - if (packet instanceof IntendedTarget) { - IntendedTarget intendedTarget = (IntendedTarget) packet; + SWGPacket SWGPacket = gpi.getPacket(); + if (SWGPacket instanceof IntendedTarget) { + IntendedTarget intendedTarget = (IntendedTarget) SWGPacket; CreatureObject creatureObject = gpi.getPlayer().getCreatureObject(); long targetId = intendedTarget.getTargetId(); diff --git a/src/services/objects/RadialService.java b/src/services/objects/RadialService.java index 890d1cd74..5193734ff 100644 --- a/src/services/objects/RadialService.java +++ b/src/services/objects/RadialService.java @@ -32,22 +32,22 @@ import java.util.List; import java.util.Set; import com.projectswg.common.control.Service; +import com.projectswg.common.data.radial.RadialItem; +import com.projectswg.common.data.radial.RadialOption; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.zone.ObjectMenuSelect; +import com.projectswg.common.network.packets.swg.zone.object_controller.ObjectMenuRequest; +import com.projectswg.common.network.packets.swg.zone.object_controller.ObjectMenuResponse; import intents.network.GalacticPacketIntent; import intents.radial.RadialRegisterIntent; import intents.radial.RadialRequestIntent; import intents.radial.RadialResponseIntent; import intents.radial.RadialSelectionIntent; -import network.packets.Packet; -import network.packets.swg.zone.ObjectMenuSelect; -import network.packets.swg.zone.object_controller.ObjectMenuRequest; -import network.packets.swg.zone.object_controller.ObjectMenuResponse; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; import resources.player.Player; -import resources.radial.RadialItem; -import resources.radial.RadialOption; import services.galaxy.GalacticManager; public class RadialService extends Service { @@ -63,7 +63,7 @@ public class RadialService extends Service { } private void handleGalacticPacketIntent(GalacticPacketIntent gpi){ - Packet p = gpi.getPacket(); + SWGPacket p = gpi.getPacket(); if (p instanceof ObjectMenuRequest) { onRequest(gpi.getObjectManager(), (ObjectMenuRequest) p); } else if (p instanceof ObjectMenuSelect) { diff --git a/src/services/objects/StaticItemService.java b/src/services/objects/StaticItemService.java index 7910622a1..f52364d06 100644 --- a/src/services/objects/StaticItemService.java +++ b/src/services/objects/StaticItemService.java @@ -33,17 +33,17 @@ import java.util.HashMap; import java.util.Map; import com.projectswg.common.control.Service; +import com.projectswg.common.data.combat.DamageType; import com.projectswg.common.data.info.RelationalServerData; import com.projectswg.common.data.info.RelationalServerFactory; import com.projectswg.common.data.swgfile.ClientFactory; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.swg.zone.object_controller.ShowLootBox; import intents.chat.SystemMessageIntent; import intents.object.CreateStaticItemIntent; import intents.object.ObjectCreatedIntent; import intents.server.ConfigChangedIntent; -import network.packets.swg.zone.object_controller.ShowLootBox; -import resources.combat.DamageType; import resources.config.ConfigFile; import resources.containers.ContainerPermissionsType; import resources.objects.SWGObject; diff --git a/src/services/objects/UniformBoxService.java b/src/services/objects/UniformBoxService.java index 826b3cd00..486a93eac 100644 --- a/src/services/objects/UniformBoxService.java +++ b/src/services/objects/UniformBoxService.java @@ -36,6 +36,7 @@ import java.util.Collection; import com.projectswg.common.control.Service; import com.projectswg.common.data.info.RelationalServerData; import com.projectswg.common.data.info.RelationalServerFactory; +import com.projectswg.common.data.radial.RadialItem; import com.projectswg.common.debug.Log; import intents.object.CreateStaticItemIntent; @@ -45,7 +46,6 @@ import resources.containers.ContainerPermissionsType; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; import resources.player.Player; -import resources.radial.RadialItem; public class UniformBoxService extends Service { diff --git a/src/services/player/CharacterCreationService.java b/src/services/player/CharacterCreationService.java index e4d1c7ea2..94f6771cf 100644 --- a/src/services/player/CharacterCreationService.java +++ b/src/services/player/CharacterCreationService.java @@ -37,27 +37,27 @@ import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; import com.projectswg.common.control.Service; +import com.projectswg.common.data.encodables.tangible.Race; import com.projectswg.common.data.info.RelationalDatabase; import com.projectswg.common.data.info.RelationalServerFactory; import com.projectswg.common.data.swgfile.ClientFactory; import com.projectswg.common.data.swgfile.visitors.ProfTemplateData; import com.projectswg.common.debug.Assert; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.login.creation.ClientCreateCharacter; +import com.projectswg.common.network.packets.swg.login.creation.ClientVerifyAndLockNameRequest; +import com.projectswg.common.network.packets.swg.login.creation.ClientVerifyAndLockNameResponse; +import com.projectswg.common.network.packets.swg.login.creation.ClientVerifyAndLockNameResponse.ErrorMessage; +import com.projectswg.common.network.packets.swg.login.creation.CreateCharacterFailure; +import com.projectswg.common.network.packets.swg.login.creation.CreateCharacterFailure.NameFailureReason; +import com.projectswg.common.network.packets.swg.login.creation.CreateCharacterSuccess; +import com.projectswg.common.network.packets.swg.login.creation.RandomNameRequest; +import com.projectswg.common.network.packets.swg.login.creation.RandomNameResponse; import intents.GalacticIntent; import intents.object.DestroyObjectIntent; import intents.player.CreatedCharacterIntent; -import network.packets.Packet; -import network.packets.swg.login.creation.ClientCreateCharacter; -import network.packets.swg.login.creation.ClientVerifyAndLockNameRequest; -import network.packets.swg.login.creation.ClientVerifyAndLockNameResponse; -import network.packets.swg.login.creation.ClientVerifyAndLockNameResponse.ErrorMessage; -import network.packets.swg.login.creation.CreateCharacterFailure; -import network.packets.swg.login.creation.CreateCharacterFailure.NameFailureReason; -import network.packets.swg.login.creation.CreateCharacterSuccess; -import network.packets.swg.login.creation.RandomNameRequest; -import network.packets.swg.login.creation.RandomNameResponse; -import resources.Race; import resources.config.ConfigFile; import resources.objects.creature.CreatureObject; import resources.player.AccessLevel; @@ -125,7 +125,7 @@ public class CharacterCreationService extends Service { return super.terminate(); } - public void handlePacket(GalacticIntent intent, Player player, Packet p) { + public void handlePacket(GalacticIntent intent, Player player, SWGPacket p) { if (p instanceof RandomNameRequest) handleRandomNameRequest(player, (RandomNameRequest) p); if (p instanceof ClientVerifyAndLockNameRequest) diff --git a/src/services/player/LoginService.java b/src/services/player/LoginService.java index a8722a452..d6b4c0441 100644 --- a/src/services/player/LoginService.java +++ b/src/services/player/LoginService.java @@ -36,11 +36,28 @@ import java.util.Locale; import com.projectswg.common.control.Service; import com.projectswg.common.data.BCrypt; +import com.projectswg.common.data.encodables.galaxy.Galaxy; +import com.projectswg.common.data.encodables.tangible.Race; import com.projectswg.common.data.info.Config; import com.projectswg.common.data.info.RelationalDatabase; import com.projectswg.common.data.info.RelationalServerFactory; import com.projectswg.common.debug.Assert; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.ErrorMessage; +import com.projectswg.common.network.packets.swg.login.CharacterCreationDisabled; +import com.projectswg.common.network.packets.swg.login.EnumerateCharacterId; +import com.projectswg.common.network.packets.swg.login.EnumerateCharacterId.SWGCharacter; +import com.projectswg.common.network.packets.swg.login.LoginClientId; +import com.projectswg.common.network.packets.swg.login.LoginClientToken; +import com.projectswg.common.network.packets.swg.login.LoginClusterStatus; +import com.projectswg.common.network.packets.swg.login.LoginEnumCluster; +import com.projectswg.common.network.packets.swg.login.LoginIncorrectClientId; +import com.projectswg.common.network.packets.swg.login.creation.DeleteCharacterRequest; +import com.projectswg.common.network.packets.swg.login.creation.DeleteCharacterResponse; +import com.projectswg.common.network.packets.swg.zone.GameServerLagResponse; +import com.projectswg.common.network.packets.swg.zone.LagRequest; +import com.projectswg.common.network.packets.swg.zone.ServerNowEpochTime; import intents.GalacticIntent; import intents.LoginEventIntent; @@ -48,23 +65,6 @@ import intents.LoginEventIntent.LoginEvent; import intents.network.GalacticPacketIntent; import intents.object.DestroyObjectIntent; import intents.player.DeleteCharacterIntent; -import network.packets.Packet; -import network.packets.swg.ErrorMessage; -import network.packets.swg.login.CharacterCreationDisabled; -import network.packets.swg.login.EnumerateCharacterId; -import network.packets.swg.login.EnumerateCharacterId.SWGCharacter; -import network.packets.swg.login.LoginClientId; -import network.packets.swg.login.LoginClientToken; -import network.packets.swg.login.LoginClusterStatus; -import network.packets.swg.login.LoginEnumCluster; -import network.packets.swg.login.LoginIncorrectClientId; -import network.packets.swg.login.creation.DeleteCharacterRequest; -import network.packets.swg.login.creation.DeleteCharacterResponse; -import network.packets.swg.zone.GameServerLagResponse; -import network.packets.swg.zone.LagRequest; -import network.packets.swg.zone.ServerNowEpochTime; -import resources.Galaxy; -import resources.Race; import resources.config.ConfigFile; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; @@ -145,7 +145,7 @@ public class LoginService extends Service { return 0; } - private void handlePacket(GalacticPacketIntent gpi, Packet p) { + private void handlePacket(GalacticPacketIntent gpi, SWGPacket p) { if (p instanceof LoginClientId) { handleLogin(gpi.getPlayer(), (LoginClientId) p); } else if (p instanceof DeleteCharacterRequest) { diff --git a/src/services/player/PlayerManager.java b/src/services/player/PlayerManager.java index 9d96774ee..40a63dd4e 100644 --- a/src/services/player/PlayerManager.java +++ b/src/services/player/PlayerManager.java @@ -30,18 +30,24 @@ package services.player; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicReference; import java.util.function.BiConsumer; import com.projectswg.common.concurrency.SynchronizedMap; import com.projectswg.common.control.Manager; import com.projectswg.common.data.location.Terrain; import com.projectswg.common.debug.Assert; +import com.projectswg.common.network.packets.SWGPacket; import intents.NotifyPlayersPacketIntent; import intents.PlayerEventIntent; import intents.network.ConnectionClosedIntent; import intents.network.ConnectionOpenedIntent; -import network.packets.Packet; +import intents.object.DestroyObjectIntent; +import intents.object.ObjectCreatedIntent; +import resources.objects.SWGObject; +import resources.objects.creature.CreatureObject; import resources.player.Player; import resources.player.Player.PlayerServer; import resources.player.PlayerEvent; @@ -51,22 +57,26 @@ import services.CoreManager; public class PlayerManager extends Manager { private final Map players; + private final Map characters; private final LoginService loginService; private final ZoneManager zoneService; public PlayerManager() { - players = new SynchronizedMap<>(); - loginService = new LoginService(); - zoneService = new ZoneManager(); + this.players = new SynchronizedMap<>(); + this.characters = new ConcurrentHashMap<>(); + this.loginService = new LoginService(); + this.zoneService = new ZoneManager(); addChildService(loginService); addChildService(zoneService); - registerForIntent(NotifyPlayersPacketIntent.class, nppi -> handleNotifyPlayersPacketIntent(nppi)); - registerForIntent(ConnectionOpenedIntent.class, coi -> handleConnectionOpenedIntent(coi)); - registerForIntent(ConnectionClosedIntent.class, cci -> handleConnectionClosedIntent(cci)); + registerForIntent(NotifyPlayersPacketIntent.class, this::handleNotifyPlayersPacketIntent); + registerForIntent(ConnectionOpenedIntent.class, this::handleConnectionOpenedIntent); + registerForIntent(ConnectionClosedIntent.class, this::handleConnectionClosedIntent); + registerForIntent(ObjectCreatedIntent.class, this::handleObjectCreatedIntent); + registerForIntent(DestroyObjectIntent.class, this::handleDestroyObjectIntent); } - + public boolean playerExists(String name) { return zoneService.characterExistsForName(name); } @@ -87,19 +97,10 @@ public class PlayerManager extends Manager { Assert.notNull(name); name = name.trim().toLowerCase(Locale.ENGLISH); Assert.test(!name.isEmpty()); - synchronized (players) { - for (Player p : players.values()) { - if (p.getCreatureObject() == null) - continue; - String cName = p.getCharacterName().toLowerCase(Locale.ENGLISH); - if (cName.equals(name)) - return p; - int spaceIndex = cName.indexOf(' '); - if (spaceIndex != -1 && cName.substring(0, spaceIndex).equals(name)) - return p; - } - } - return null; + CreatureObject creature = characters.get(name); + if (creature == null) + return null; + return creature.getOwner(); } public long getCharacterIdByFirstName(String name) { @@ -114,28 +115,28 @@ public class PlayerManager extends Manager { return loginService.getCharacterId(name); } - public void notifyPlayers(Packet ... packets) { + public void notifyPlayers(SWGPacket ... SWGPackets) { iteratePlayers((key, p) -> { if (p.getCreatureObject() != null) - p.sendPacket(packets); + p.sendPacket(SWGPackets); }); } - public void notifyPlayers(NotifyPlayersPacketIntent.ConditionalNotify conditional, Packet ... packets) { + public void notifyPlayers(NotifyPlayersPacketIntent.ConditionalNotify conditional, SWGPacket ... SWGPackets) { if (conditional == null) { - notifyPlayers(packets); + notifyPlayers(SWGPackets); return; } iteratePlayers((key, p) -> { if (conditional.meetsCondition(p)) - p.sendPacket(packets); + p.sendPacket(SWGPackets); }); } - public void notifyPlayers(List networkIds, NotifyPlayersPacketIntent.ConditionalNotify conditionalNotify, Packet ... packets) { + public void notifyPlayers(List networkIds, NotifyPlayersPacketIntent.ConditionalNotify conditionalNotify, SWGPacket ... SWGPackets) { if (conditionalNotify == null) { - notifyPlayers(networkIds, packets); + notifyPlayers(networkIds, SWGPackets); return; } @@ -143,41 +144,41 @@ public class PlayerManager extends Manager { Player p = getPlayerFromNetworkId(id); Assert.notNull(p); if (p.getCreatureObject() != null && conditionalNotify.meetsCondition(p)) - p.sendPacket(packets); + p.sendPacket(SWGPackets); }); } - public void notifyPlayers(List networkIds, Packet ... packets) { + public void notifyPlayers(List networkIds, SWGPacket ... SWGPackets) { networkIds.forEach(id -> { Player p = getPlayerFromNetworkId(id); Assert.notNull(p); if (p.getCreatureObject() != null) - p.sendPacket(packets); + p.sendPacket(SWGPackets); }); } - public void notifyPlayersAtPlanet(NotifyPlayersPacketIntent.ConditionalNotify conditional, Terrain terrain, Packet ... packets) { + public void notifyPlayersAtPlanet(NotifyPlayersPacketIntent.ConditionalNotify conditional, Terrain terrain, SWGPacket ... SWGPackets) { if (conditional == null) { - notifyPlayersAtPlanet(terrain, packets); + notifyPlayersAtPlanet(terrain, SWGPackets); return; } iteratePlayers((key, p) -> { if (p.getCreatureObject() != null && p.getCreatureObject().getTerrain() == terrain && conditional.meetsCondition(p)) - p.sendPacket(packets); + p.sendPacket(SWGPackets); }); } - public void notifyPlayersAtPlanet(Terrain terrain, Packet ... packets) { + public void notifyPlayersAtPlanet(Terrain terrain, SWGPacket ... SWGPackets) { iteratePlayers((key, p) -> { if (p.getCreatureObject() != null && p.getCreatureObject().getTerrain() == terrain) - p.sendPacket(packets); + p.sendPacket(SWGPackets); }); } - public void notifyPlayersAtPlanet(List networkIds, NotifyPlayersPacketIntent.ConditionalNotify conditional, Terrain terrain, Packet ... packets) { + public void notifyPlayersAtPlanet(List networkIds, NotifyPlayersPacketIntent.ConditionalNotify conditional, Terrain terrain, SWGPacket ... SWGPackets) { if (conditional == null) { - notifyPlayersAtPlanet(networkIds, terrain, packets); + notifyPlayersAtPlanet(networkIds, terrain, SWGPackets); return; } @@ -185,16 +186,16 @@ public class PlayerManager extends Manager { Player p = getPlayerFromNetworkId(id); Assert.notNull(p); if (p.getCreatureObject() != null && p.getCreatureObject().getTerrain() == terrain && conditional.meetsCondition(p)) - p.sendPacket(packets); + p.sendPacket(SWGPackets); }); } - public void notifyPlayersAtPlanet(List networkIds, Terrain terrain, Packet ... packets) { + public void notifyPlayersAtPlanet(List networkIds, Terrain terrain, SWGPacket ... SWGPackets) { networkIds.forEach(id -> { Player p = getPlayerFromNetworkId(id); Assert.notNull(p); if (p.getCreatureObject() != null && p.getCreatureObject().getTerrain() == terrain) - p.sendPacket(packets); + p.sendPacket(SWGPackets); }); } @@ -237,4 +238,50 @@ public class PlayerManager extends Manager { p.setPlayerServer(PlayerServer.NONE); new PlayerEventIntent(p, PlayerEvent.PE_LOGGED_OUT).broadcast(); } + + private void handleObjectCreatedIntent(ObjectCreatedIntent oci) { + SWGObject obj = oci.getObject(); + if (!(obj instanceof CreatureObject)) + return; + + CreatureObject creature = (CreatureObject) obj; + if (!creature.isPlayer()) + return; + + String name = creature.getObjectName(); + if (name.indexOf(' ') != -1) + name = name.substring(0, name.indexOf(' ')); + name = name.toLowerCase(Locale.US); + characters.put(name, creature); + } + + private void handleDestroyObjectIntent(DestroyObjectIntent doi) { + SWGObject obj = doi.getObject(); + if (!(obj instanceof CreatureObject)) + return; + + CreatureObject creature = (CreatureObject) obj; + if (!creature.isPlayer()) + return; + + String name = creature.getObjectName(); + if (name.indexOf(' ') != -1) + name = name.substring(0, name.indexOf(' ')); + name = name.toLowerCase(Locale.US); + characters.remove(name); + } + + public static class ObjectLookup { + + private static final AtomicReference PLAYER_MANAGER = new AtomicReference<>(null); + + private static void setObjectManager(PlayerManager playerManager) { + PLAYER_MANAGER.set(playerManager); + } + + public static CreatureObject getCharacterByFirstName(String name) { + return PLAYER_MANAGER.get().getObjectById(id); + } + + } } diff --git a/src/services/player/ZoneManager.java b/src/services/player/ZoneManager.java index ba57ab1cb..be8550e39 100644 --- a/src/services/player/ZoneManager.java +++ b/src/services/player/ZoneManager.java @@ -37,30 +37,30 @@ import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevCommit; import com.projectswg.common.control.Manager; +import com.projectswg.common.data.encodables.oob.waypoint.WaypointColor; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.login.AccountFeatureBits; +import com.projectswg.common.network.packets.swg.login.ClientIdMsg; +import com.projectswg.common.network.packets.swg.login.ClientPermissionsMessage; +import com.projectswg.common.network.packets.swg.login.ConnectionServerLagResponse; +import com.projectswg.common.network.packets.swg.zone.HeartBeat; +import com.projectswg.common.network.packets.swg.zone.LagRequest; +import com.projectswg.common.network.packets.swg.zone.SetWaypointColor; +import com.projectswg.common.network.packets.swg.zone.ShowBackpack; +import com.projectswg.common.network.packets.swg.zone.ShowHelmet; +import com.projectswg.common.network.packets.swg.zone.chat.ChatSystemMessage; +import com.projectswg.common.network.packets.swg.zone.insertion.SelectCharacter; import intents.GalacticIntent; import intents.PlayerEventIntent; import intents.chat.SystemMessageIntent; import intents.network.GalacticPacketIntent; -import network.packets.Packet; -import network.packets.swg.login.AccountFeatureBits; -import network.packets.swg.login.ClientIdMsg; -import network.packets.swg.login.ClientPermissionsMessage; -import network.packets.swg.login.ConnectionServerLagResponse; -import network.packets.swg.zone.HeartBeat; -import network.packets.swg.zone.LagRequest; -import network.packets.swg.zone.SetWaypointColor; -import network.packets.swg.zone.ShowBackpack; -import network.packets.swg.zone.ShowHelmet; -import network.packets.swg.zone.chat.ChatSystemMessage; -import network.packets.swg.zone.insertion.SelectCharacter; import resources.config.ConfigFile; import resources.objects.SWGObject; import resources.objects.creature.CreatureMood; import resources.objects.player.PlayerObject; import resources.objects.waypoint.WaypointObject; -import resources.objects.waypoint.WaypointObject.WaypointColor; import resources.player.Player; import resources.player.Player.PlayerServer; import resources.player.PlayerEvent; @@ -107,7 +107,7 @@ public class ZoneManager extends Manager { } } - private void handlePacket(GalacticIntent intent, Player player, Packet p) { + private void handlePacket(GalacticIntent intent, Player player, SWGPacket p) { characterCreationService.handlePacket(intent, player, p); if (p instanceof ClientIdMsg) handleClientIdMsg(player, (ClientIdMsg) p); @@ -179,7 +179,7 @@ public class ZoneManager extends Manager { } private void handleSetWaypointColor(Player player, SetWaypointColor p) { - // TODO Should move this to a different service, maybe make a service for other packets similar to this (ie misc.) + // TODO Should move this to a different service, maybe make a service for other SWGPackets similar to this (ie misc.) PlayerObject ghost = player.getPlayerObject(); WaypointObject waypoint = ghost.getWaypoint(p.getObjId()); diff --git a/src/services/player/creation/CharacterCreation.java b/src/services/player/creation/CharacterCreation.java index 10a3a7807..e42bc9d43 100644 --- a/src/services/player/creation/CharacterCreation.java +++ b/src/services/player/creation/CharacterCreation.java @@ -29,16 +29,16 @@ package services.player.creation; import java.util.Calendar; +import com.projectswg.common.data.encodables.tangible.PvpFlag; +import com.projectswg.common.data.encodables.tangible.Race; import com.projectswg.common.data.swgfile.ClientFactory; import com.projectswg.common.data.swgfile.visitors.ProfTemplateData; import com.projectswg.common.debug.Assert; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.swg.login.creation.ClientCreateCharacter; import intents.experience.GrantSkillIntent; import intents.object.ObjectCreatedIntent; -import network.packets.swg.login.creation.ClientCreateCharacter; -import resources.PvpFlag; -import resources.Race; import resources.containers.ContainerPermissionsType; import resources.objects.SWGObject; import resources.objects.building.BuildingObject; diff --git a/src/services/player/zone/ZoneRequester.java b/src/services/player/zone/ZoneRequester.java index 187354cd1..e4807936d 100644 --- a/src/services/player/zone/ZoneRequester.java +++ b/src/services/player/zone/ZoneRequester.java @@ -31,10 +31,10 @@ import java.util.concurrent.TimeUnit; import com.projectswg.common.data.location.Terrain; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.swg.ErrorMessage; import intents.RequestZoneInIntent; import intents.chat.SystemMessageIntent; -import network.packets.swg.ErrorMessage; import resources.config.ConfigFile; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; diff --git a/src/services/spawn/SpawnerService.java b/src/services/spawn/SpawnerService.java index e6163e9b0..910d37a9b 100644 --- a/src/services/spawn/SpawnerService.java +++ b/src/services/spawn/SpawnerService.java @@ -37,20 +37,21 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import com.projectswg.common.control.Service; +import com.projectswg.common.data.encodables.tangible.PvpFaction; +import com.projectswg.common.data.encodables.tangible.PvpFlag; +import com.projectswg.common.data.encodables.tangible.PvpStatus; import com.projectswg.common.data.info.RelationalDatabase; import com.projectswg.common.data.info.RelationalServerFactory; import com.projectswg.common.data.location.Location; import com.projectswg.common.data.location.Terrain; import com.projectswg.common.data.swgfile.ClientFactory; import com.projectswg.common.debug.Log; +import com.projectswg.common.utilities.ThreadUtilities; import intents.FactionIntent; import intents.object.DestroyObjectIntent; import intents.object.ObjectCreatedIntent; import intents.server.ConfigChangedIntent; -import resources.PvpFaction; -import resources.PvpFlag; -import resources.PvpStatus; import resources.config.ConfigFile; import resources.containers.ContainerPermissionsType; import resources.objects.SWGObject; @@ -68,7 +69,6 @@ import resources.spawn.Spawner.SpawnerFlag; import resources.spawn.SpawnerType; import services.objects.ObjectCreator; import services.objects.ObjectManager; -import utilities.ThreadUtilities; public final class SpawnerService extends Service { diff --git a/src/services/sui/SuiService.java b/src/services/sui/SuiService.java index 2a5cd1d92..9789c0b97 100644 --- a/src/services/sui/SuiService.java +++ b/src/services/sui/SuiService.java @@ -27,30 +27,30 @@ ***********************************************************************************/ package services.sui; -import com.projectswg.common.control.Service; -import com.projectswg.common.debug.Log; -import groovy.util.ResourceException; -import groovy.util.ScriptException; -import intents.network.GalacticPacketIntent; -import intents.sui.SuiWindowIntent; -import network.packets.Packet; -import network.packets.swg.SWGPacket; -import network.packets.swg.zone.server_ui.SuiCreatePageMessage; -import network.packets.swg.zone.server_ui.SuiEventNotification; -import network.packets.swg.zone.server_ui.SuiForceClosePage; -import resources.player.Player; -import resources.sui.ISuiCallback; -import resources.sui.SuiBaseWindow; -import resources.sui.SuiComponent; -import resources.sui.SuiEvent; -import utilities.Scripts; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import com.projectswg.common.control.Service; +import com.projectswg.common.data.sui.ISuiCallback; +import com.projectswg.common.data.sui.SuiBaseWindow; +import com.projectswg.common.data.sui.SuiComponent; +import com.projectswg.common.data.sui.SuiEvent; +import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.zone.server_ui.SuiCreatePageMessage; +import com.projectswg.common.network.packets.swg.zone.server_ui.SuiEventNotification; +import com.projectswg.common.network.packets.swg.zone.server_ui.SuiForceClosePage; + +import groovy.util.ResourceException; +import groovy.util.ScriptException; +import intents.network.GalacticPacketIntent; +import intents.sui.SuiWindowIntent; +import resources.player.Player; +import utilities.Scripts; + public class SuiService extends Service { private final Map> windows; @@ -63,9 +63,9 @@ public class SuiService extends Service { } private void handleGalacticPacketIntent(GalacticPacketIntent gpi) { - Packet p = gpi.getPacket(); + SWGPacket p = gpi.getPacket(); if (p instanceof SWGPacket) - processSwgPacket(gpi.getPlayer(), (SWGPacket) p); + processSwgPacket(gpi.getPlayer(), p); } private void processSwgPacket(Player player, SWGPacket p) { @@ -140,7 +140,7 @@ public class SuiService extends Service { } } else if (window.hasJavaCallback(callback)) { ISuiCallback suiCallback = window.getJavaCallback(callback); - suiCallback.handleEvent(player, player.getCreatureObject(), event, parameters); + suiCallback.handleEvent(event, parameters); } // Both of these events "closes" the sui window for the client, so we have no need for the server to continue tracking the window. @@ -152,8 +152,8 @@ public class SuiService extends Service { int id = createWindowId(); window.setId(id); - SuiCreatePageMessage packet = new SuiCreatePageMessage(window); - player.sendPacket(packet); + SuiCreatePageMessage SWGPacket = new SuiCreatePageMessage(window); + player.sendPacket(SWGPacket); long networkId = player.getNetworkId(); List activeWindows = windows.get(networkId); diff --git a/src/services/trade/TradeService.java b/src/services/trade/TradeService.java index 8160f62f9..a8b43f21f 100644 --- a/src/services/trade/TradeService.java +++ b/src/services/trade/TradeService.java @@ -4,21 +4,21 @@ import java.util.ArrayList; import java.util.List; import com.projectswg.common.control.Service; +import com.projectswg.common.data.encodables.tangible.Posture; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.zone.object_controller.SecureTrade; +import com.projectswg.common.network.packets.swg.zone.trade.AbortTradeMessage; +import com.projectswg.common.network.packets.swg.zone.trade.AcceptTransactionMessage; +import com.projectswg.common.network.packets.swg.zone.trade.AddItemMessage; +import com.projectswg.common.network.packets.swg.zone.trade.DenyTradeMessage; +import com.projectswg.common.network.packets.swg.zone.trade.GiveMoneyMessage; +import com.projectswg.common.network.packets.swg.zone.trade.UnAcceptTransactionMessage; +import com.projectswg.common.network.packets.swg.zone.trade.VerifyTradeMessage; import intents.PlayerEventIntent; import intents.chat.SystemMessageIntent; import intents.network.GalacticPacketIntent; -import network.packets.Packet; -import network.packets.swg.zone.object_controller.SecureTrade; -import network.packets.swg.zone.trade.AbortTradeMessage; -import network.packets.swg.zone.trade.AcceptTransactionMessage; -import network.packets.swg.zone.trade.AddItemMessage; -import network.packets.swg.zone.trade.DenyTradeMessage; -import network.packets.swg.zone.trade.GiveMoneyMessage; -import network.packets.swg.zone.trade.UnAcceptTransactionMessage; -import network.packets.swg.zone.trade.VerifyTradeMessage; -import resources.Posture; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; import resources.player.Player; @@ -64,30 +64,30 @@ public class TradeService extends Service { } private void handleGalacticPacketIntent(GalacticPacketIntent gpi) { - Packet packet = gpi.getPacket(); + SWGPacket SWGPacket = gpi.getPacket(); - if (packet instanceof SecureTrade) { - handleSecureTrade((SecureTrade) packet, gpi.getPlayer()); - } else if (packet instanceof AbortTradeMessage) { + if (SWGPacket instanceof SecureTrade) { + handleSecureTrade((SecureTrade) SWGPacket, gpi.getPlayer()); + } else if (SWGPacket instanceof AbortTradeMessage) { handleAbortTradeMessage(gpi.getPlayer()); - } else if (packet instanceof DenyTradeMessage) { + } else if (SWGPacket instanceof DenyTradeMessage) { handleDenyTradeMessage(gpi.getPlayer()); - } else if (packet instanceof AcceptTransactionMessage) { + } else if (SWGPacket instanceof AcceptTransactionMessage) { handleAcceptTransactionMessage(gpi.getPlayer()); - } else if (packet instanceof UnAcceptTransactionMessage) { + } else if (SWGPacket instanceof UnAcceptTransactionMessage) { handleUnAcceptTransactionMessage(gpi.getPlayer()); - } else if (packet instanceof AddItemMessage) { - handleAddItemMessage((AddItemMessage) packet, gpi.getPlayer()); - } else if (packet instanceof GiveMoneyMessage) { - handleGiveMoneyMessage((GiveMoneyMessage) packet, gpi.getPlayer()); - } else if (packet instanceof VerifyTradeMessage) { + } else if (SWGPacket instanceof AddItemMessage) { + handleAddItemMessage((AddItemMessage) SWGPacket, gpi.getPlayer()); + } else if (SWGPacket instanceof GiveMoneyMessage) { + handleGiveMoneyMessage((GiveMoneyMessage) SWGPacket, gpi.getPlayer()); + } else if (SWGPacket instanceof VerifyTradeMessage) { handleVerifyTradeMessage(gpi.getPlayer(), gpi.getObjectManager()); } } - private void handleSecureTrade(SecureTrade packet, Player player) { + private void handleSecureTrade(SecureTrade SWGPacket, Player player) { CreatureObject initiator = player.getCreatureObject(); - SWGObject accepterObject = ObjectLookup.getObjectById(packet.getAccepterId()); + SWGObject accepterObject = ObjectLookup.getObjectById(SWGPacket.getAccepterId()); if (!(accepterObject instanceof CreatureObject) || !((CreatureObject) accepterObject).isPlayer()) { sendSystemMessage(initiator.getOwner(), "start_fail_target_not_player"); return; @@ -115,7 +115,7 @@ public class TradeService extends Service { initiator.setTradeSession(tradeSession); if (oldSession != null) oldSession.abortTrade(); - handleTradeSessionRequest(packet, player, initiator, accepter); + handleTradeSessionRequest(SWGPacket, player, initiator, accepter); } private void handleAbortTradeMessage(Player player) { @@ -158,14 +158,14 @@ public class TradeService extends Service { tradeSession.setTradeAccepted(creature, false); } - private void handleAddItemMessage(AddItemMessage packet, Player player) { + private void handleAddItemMessage(AddItemMessage SWGPacket, Player player) { CreatureObject creature = player.getCreatureObject(); TradeSession tradeSession = creature.getTradeSession(); if (!verifyTradeSession(tradeSession, creature)) return; - SWGObject tradeObject = ObjectLookup.getObjectById(packet.getObjectId()); + SWGObject tradeObject = ObjectLookup.getObjectById(SWGPacket.getObjectId()); if (tradeObject == null || tradeObject.hasAttribute("no_trade") || tradeObject.getSuperParent() != creature) { Log.w("Invalid object to trade: %s for creature: %s", tradeObject, creature); @@ -176,14 +176,14 @@ public class TradeService extends Service { tradeSession.addItem(creature, tradeObject); } - private void handleGiveMoneyMessage(GiveMoneyMessage packet, Player player) { + private void handleGiveMoneyMessage(GiveMoneyMessage SWGPacket, Player player) { CreatureObject creature = player.getCreatureObject(); TradeSession tradeSession = creature.getTradeSession(); if (!verifyTradeSession(tradeSession, creature)) return; - tradeSession.setMoneyAmount(creature, packet.getMoneyAmount() & 0x00000000FFFFFFFFl); + tradeSession.setMoneyAmount(creature, SWGPacket.getMoneyAmount() & 0x00000000FFFFFFFFl); } private void handleVerifyTradeMessage(Player player, ObjectManager objectManager) { @@ -196,9 +196,9 @@ public class TradeService extends Service { tradeSession.setTradeVerified(creature); } - private void handleTradeSessionRequest(SecureTrade packet, Player packetSender, CreatureObject initiator, CreatureObject accepter) { + private void handleTradeSessionRequest(SecureTrade SWGPacket, Player SWGPacketSender, CreatureObject initiator, CreatureObject accepter) { SuiMessageBox requestBox = new SuiMessageBox(SuiButtons.OK_CANCEL, "Trade Request", initiator.getObjectName() + " wants to trade with you.\nDo you want to accept the request?"); - requestBox.addOkButtonCallback("handleTradeRequest", (player, actor, event, paramenters) -> { + requestBox.addOkButtonCallback("handleTradeRequest", (event, paramenters) -> { TradeSession tradeSession = initiator.getTradeSession(); if (tradeSession == null) return; @@ -206,8 +206,8 @@ public class TradeService extends Service { accepter.setTradeSession(tradeSession); tradeSession.beginTrade(); }); - requestBox.addCancelButtonCallback("handleTradeRequestDeny", (player, actor, event, paramenters) -> { - packetSender.sendPacket(new DenyTradeMessage(), new AbortTradeMessage()); + requestBox.addCancelButtonCallback("handleTradeRequestDeny", (event, paramenters) -> { + SWGPacketSender.sendPacket(new DenyTradeMessage(), new AbortTradeMessage()); }); requestBox.display(accepter.getOwner()); } diff --git a/src/services/trade/TradeSession.java b/src/services/trade/TradeSession.java index 5b5675851..8667c9b95 100644 --- a/src/services/trade/TradeSession.java +++ b/src/services/trade/TradeSession.java @@ -8,18 +8,18 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.zone.trade.AbortTradeMessage; +import com.projectswg.common.network.packets.swg.zone.trade.AcceptTransactionMessage; +import com.projectswg.common.network.packets.swg.zone.trade.AddItemMessage; +import com.projectswg.common.network.packets.swg.zone.trade.BeginTradeMessage; +import com.projectswg.common.network.packets.swg.zone.trade.BeginVerificationMessage; +import com.projectswg.common.network.packets.swg.zone.trade.DenyTradeMessage; +import com.projectswg.common.network.packets.swg.zone.trade.GiveMoneyMessage; +import com.projectswg.common.network.packets.swg.zone.trade.TradeCompleteMessage; +import com.projectswg.common.network.packets.swg.zone.trade.UnAcceptTransactionMessage; +import com.projectswg.common.network.packets.swg.zone.trade.VerifyTradeMessage; -import network.packets.swg.SWGPacket; -import network.packets.swg.zone.trade.AbortTradeMessage; -import network.packets.swg.zone.trade.AcceptTransactionMessage; -import network.packets.swg.zone.trade.AddItemMessage; -import network.packets.swg.zone.trade.BeginTradeMessage; -import network.packets.swg.zone.trade.BeginVerificationMessage; -import network.packets.swg.zone.trade.DenyTradeMessage; -import network.packets.swg.zone.trade.GiveMoneyMessage; -import network.packets.swg.zone.trade.TradeCompleteMessage; -import network.packets.swg.zone.trade.UnAcceptTransactionMessage; -import network.packets.swg.zone.trade.VerifyTradeMessage; import resources.objects.SWGObject; import resources.objects.creature.CreatureObject; @@ -230,12 +230,12 @@ public class TradeSession { return true; } - public void sendPacket(SWGPacket packet) { - creature.getOwner().sendPacket(packet); + public void sendPacket(SWGPacket SWGPacket) { + creature.getOwner().sendPacket(SWGPacket); } - public void sendToPartner(SWGPacket packet) { - partner.getOwner().sendPacket(packet); + public void sendToPartner(SWGPacket SWGPacket) { + partner.getOwner().sendPacket(SWGPacket); } public void setAccepted(boolean accepted) { diff --git a/src/utilities/IntentFactory.java b/src/utilities/IntentFactory.java index befaa5d28..39df9e8b4 100644 --- a/src/utilities/IntentFactory.java +++ b/src/utilities/IntentFactory.java @@ -27,16 +27,17 @@ ***********************************************************************************/ package utilities; +import com.projectswg.common.data.encodables.oob.OutOfBandPackage; +import com.projectswg.common.data.encodables.oob.ProsePackage; +import com.projectswg.common.data.encodables.oob.StringId; +import com.projectswg.common.data.encodables.oob.waypoint.WaypointPackage; +import com.projectswg.common.data.encodables.player.Mail; import com.projectswg.common.data.location.Terrain; import com.projectswg.common.debug.Log; +import com.projectswg.common.network.packets.swg.zone.chat.ChatSystemMessage; import intents.chat.PersistentMessageIntent; import intents.chat.SystemMessageIntent; -import network.packets.swg.zone.chat.ChatSystemMessage; -import resources.encodables.OutOfBandPackage; -import resources.encodables.ProsePackage; -import resources.encodables.StringId; -import resources.encodables.player.Mail; import resources.objects.SWGObject; import resources.objects.waypoint.WaypointObject; import resources.player.Player; @@ -141,9 +142,12 @@ public final class IntentFactory { */ public void sendMail(SWGObject receiver, String sender, String subject, String message, WaypointObject... waypoints) { Mail mail = new Mail(sender, subject, message, receiver.getObjectId()); - mail.setOutOfBandPackage(new OutOfBandPackage(waypoints)); - + WaypointPackage [] packages = new WaypointPackage[waypoints.length]; + for (int i = 0; i < waypoints.length; i++) + packages[i] = waypoints[i].getOOB(); + mail.setOutOfBandPackage(new OutOfBandPackage(packages)); + new PersistentMessageIntent(receiver, mail, receiver.getOwner().getGalaxyName()).broadcast(); } - + } diff --git a/src/utilities/ScheduledUtilities.java b/src/utilities/ScheduledUtilities.java index 9c147811a..f2a7557f5 100644 --- a/src/utilities/ScheduledUtilities.java +++ b/src/utilities/ScheduledUtilities.java @@ -32,6 +32,8 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; +import com.projectswg.common.utilities.ThreadUtilities; + public class ScheduledUtilities { private static final Object mutex = new Object(); diff --git a/src/utilities/Scripts.java b/src/utilities/Scripts.java index f74feaf42..1e1288a29 100644 --- a/src/utilities/Scripts.java +++ b/src/utilities/Scripts.java @@ -27,15 +27,16 @@ ***********************************************************************************/ package utilities; +import java.io.IOException; + import com.projectswg.common.debug.Log; + import groovy.lang.Binding; import groovy.lang.Script; import groovy.util.GroovyScriptEngine; import groovy.util.ResourceException; import groovy.util.ScriptException; -import java.io.IOException; - public class Scripts { private static GroovyScriptEngine groovyEngine; diff --git a/src/utilities/ThreadUtilities.java b/src/utilities/ThreadUtilities.java deleted file mode 100644 index 626a40404..000000000 --- a/src/utilities/ThreadUtilities.java +++ /dev/null @@ -1,60 +0,0 @@ -/*********************************************************************************** -* Copyright (c) 2015 /// Project SWG /// www.projectswg.com * -* * -* ProjectSWG is the first NGE emulator for Star Wars Galaxies founded on * -* July 7th, 2011 after SOE announced the official shutdown of Star Wars Galaxies. * -* Our goal is to create an emulator which will provide a server for players to * -* continue playing a game similar to the one they used to play. We are basing * -* it on the final publish of the game prior to end-game events. * -* * -* This file is part of Holocore. * -* * -* -------------------------------------------------------------------------------- * -* * -* Holocore is free software: you can redistribute it and/or modify * -* it under the terms of the GNU Affero General Public License as * -* published by the Free Software Foundation, either version 3 of the * -* License, or (at your option) any later version. * -* * -* Holocore 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 Affero General Public License for more details. * -* * -* You should have received a copy of the GNU Affero General Public License * -* along with Holocore. If not, see . * -* * -***********************************************************************************/ -package utilities; - -import java.util.concurrent.ThreadFactory; - -public class ThreadUtilities { - - public static ThreadFactory newThreadFactory(String pattern) { - return new CustomThreadFactory(pattern); - } - - private static class CustomThreadFactory implements ThreadFactory { - - private final String pattern; - private int counter; - - public CustomThreadFactory(String pattern) { - this.pattern = pattern; - this.counter = 0; - } - - @Override - public Thread newThread(Runnable r) { - String name; - if (pattern.contains("%d")) - name = String.format(pattern, counter++); - else - name = pattern; - return new Thread(r, name); - } - - } - -} diff --git a/src/utilities/namegen/SWGNameGenerator.java b/src/utilities/namegen/SWGNameGenerator.java index 484ab62bc..e04a291e2 100644 --- a/src/utilities/namegen/SWGNameGenerator.java +++ b/src/utilities/namegen/SWGNameGenerator.java @@ -37,9 +37,9 @@ import java.util.List; import java.util.Locale; import java.util.Map; +import com.projectswg.common.data.encodables.tangible.Race; import com.projectswg.common.debug.Log; -import resources.Race; import resources.zone.NameFilter; public class SWGNameGenerator { diff --git a/test/resources/TestWeatherType.java b/test/resources/TestWeatherType.java index bd01eccc4..0bdc5635f 100644 --- a/test/resources/TestWeatherType.java +++ b/test/resources/TestWeatherType.java @@ -31,6 +31,8 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; +import com.projectswg.common.data.WeatherType; + public class TestWeatherType { /** diff --git a/test/resources/objects/awareness/TestObjectAwareness.java b/test/resources/objects/awareness/TestObjectAwareness.java index c04ee92dc..8e4bcd8a3 100644 --- a/test/resources/objects/awareness/TestObjectAwareness.java +++ b/test/resources/objects/awareness/TestObjectAwareness.java @@ -37,6 +37,7 @@ import org.junit.runners.JUnit4; import com.projectswg.common.concurrency.Delay; import com.projectswg.common.control.Intent; import com.projectswg.common.control.IntentManager; +import com.projectswg.common.data.encodables.tangible.Posture; import com.projectswg.common.data.location.Location; import com.projectswg.common.data.location.Terrain; @@ -45,7 +46,6 @@ import intents.object.ContainerTransferIntent; import intents.object.DestroyObjectIntent; import intents.object.MoveObjectIntent; import intents.object.ObjectCreatedIntent; -import resources.Posture; import resources.objects.building.BuildingObject; import resources.objects.cell.CellObject; import resources.objects.creature.CreatureObject; diff --git a/test/resources/persistable/TestMailPersistable.java b/test/resources/persistable/TestMailPersistable.java index e0834f080..0cee6e2d7 100644 --- a/test/resources/persistable/TestMailPersistable.java +++ b/test/resources/persistable/TestMailPersistable.java @@ -36,13 +36,13 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; +import com.projectswg.common.data.encodables.oob.OutOfBandPackage; +import com.projectswg.common.data.encodables.oob.ProsePackage; +import com.projectswg.common.data.encodables.oob.StringId; +import com.projectswg.common.data.encodables.player.Mail; import com.projectswg.common.persistable.InputPersistenceStream; import com.projectswg.common.persistable.OutputPersistenceStream; -import resources.encodables.OutOfBandPackage; -import resources.encodables.ProsePackage; -import resources.encodables.StringId; -import resources.encodables.player.Mail; import resources.objects.SpecificObject; import resources.objects.waypoint.WaypointObject; import services.objects.ObjectCreator; @@ -81,9 +81,9 @@ public class TestMailPersistable { Mail mail = new Mail("sender", "subject", "message", 100); WaypointObject waypoint1 = (WaypointObject) ObjectCreator.createObjectFromTemplate(SpecificObject.SO_WORLD_WAYPOINT.getTemplate()); WaypointObject waypoint2 = (WaypointObject) ObjectCreator.createObjectFromTemplate(SpecificObject.SO_WORLD_WAYPOINT.getTemplate()); - mail.setOutOfBandPackage(new OutOfBandPackage(waypoint1)); + mail.setOutOfBandPackage(new OutOfBandPackage(waypoint1.getOOB())); test(mail); - mail.setOutOfBandPackage(new OutOfBandPackage(waypoint1, waypoint2)); + mail.setOutOfBandPackage(new OutOfBandPackage(waypoint1.getOOB(), waypoint2.getOOB())); test(mail); } diff --git a/test/resources/persistable/TestSWGPersistable.java b/test/resources/persistable/TestSWGPersistable.java index b8d6c0352..593cb57db 100644 --- a/test/resources/persistable/TestSWGPersistable.java +++ b/test/resources/persistable/TestSWGPersistable.java @@ -36,10 +36,10 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; +import com.projectswg.common.data.encodables.tangible.Race; import com.projectswg.common.persistable.InputPersistenceStream; import com.projectswg.common.persistable.OutputPersistenceStream; -import resources.Race; import resources.objects.SWGObject; import resources.objects.building.BuildingObject; import services.objects.ObjectCreator; diff --git a/test/services/player/zone/TestZoneRequester.java b/test/services/player/zone/TestZoneRequester.java index b989ae88a..de7ad7f45 100644 --- a/test/services/player/zone/TestZoneRequester.java +++ b/test/services/player/zone/TestZoneRequester.java @@ -34,8 +34,9 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -import network.packets.Packet; -import network.packets.swg.ErrorMessage; +import com.projectswg.common.network.packets.SWGPacket; +import com.projectswg.common.network.packets.swg.ErrorMessage; + import resources.objects.player.PlayerObject; import resources.player.Player; import test_resources.GenericCreatureObject; @@ -84,8 +85,8 @@ public class TestZoneRequester { private final AtomicBoolean sentError = new AtomicBoolean(false); @Override - public void sendPacket(Packet ... packets) { - if (packets.length == 1 && packets[0] instanceof ErrorMessage) + public void sendPacket(SWGPacket ... SWGPackets) { + if (SWGPackets.length == 1 && SWGPackets[0] instanceof ErrorMessage) sentError.set(true); } diff --git a/test/test_resources/GenericCreatureObject.java b/test/test_resources/GenericCreatureObject.java index a1fd8e33e..e05a325c2 100644 --- a/test/test_resources/GenericCreatureObject.java +++ b/test/test_resources/GenericCreatureObject.java @@ -29,16 +29,16 @@ package test_resources; import java.util.Map.Entry; +import com.projectswg.common.data.encodables.tangible.Race; import com.projectswg.common.data.swgfile.ClientFactory; import com.projectswg.common.data.swgfile.visitors.ObjectData; import com.projectswg.common.data.swgfile.visitors.ObjectData.ObjectDataAttribute; import com.projectswg.common.data.swgfile.visitors.SlotArrangementData; import com.projectswg.common.data.swgfile.visitors.SlotDescriptorData; import com.projectswg.common.debug.Assert; +import com.projectswg.common.network.packets.SWGPacket; import intents.object.ObjectCreatedIntent; -import network.packets.Packet; -import resources.Race; import resources.containers.ContainerPermissionsType; import resources.objects.GameObjectType; import resources.objects.SWGObject; @@ -57,7 +57,7 @@ public class GenericCreatureObject extends CreatureObject { super(objectId); player = new Player() { @Override - public void sendPacket(Packet ... packets) { + public void sendPacket(SWGPacket ... SWGPackets) { // Nah } };