From 4e88a19a097a6de455d50d10e0340c018e39effc Mon Sep 17 00:00:00 2001 From: Kris Date: Sun, 12 Jan 2025 22:55:16 +0200 Subject: [PATCH 1/8] fix: make .txt transcripts of bin differ in last-modified timestamp This ensures that tools such as notepad will pick up on changes to the file, as they rely on the last-modified date changing. The new implementation will begin the timestamp at .bin +1ms, incrementing by +1ms every time the tool is re-ran, if the .txt file already exists. Visually the timestamps will remain the same, but for sorting purposes, and file-change-listeners, it'll behave as one would want. --- .../kotlin/net/rsprox/proxy/cli/TranscribeCommand.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/proxy/src/main/kotlin/net/rsprox/proxy/cli/TranscribeCommand.kt b/proxy/src/main/kotlin/net/rsprox/proxy/cli/TranscribeCommand.kt index 075cd47a..e9bd1d67 100644 --- a/proxy/src/main/kotlin/net/rsprox/proxy/cli/TranscribeCommand.kt +++ b/proxy/src/main/kotlin/net/rsprox/proxy/cli/TranscribeCommand.kt @@ -30,6 +30,7 @@ import net.rsprox.transcriber.text.TextTranscriberProvider import java.io.BufferedWriter import java.nio.file.Files import java.nio.file.Path +import java.nio.file.attribute.FileTime import java.util.Locale import kotlin.io.path.bufferedWriter import kotlin.io.path.exists @@ -92,6 +93,8 @@ public class TranscribeCommand : CliktCommand(name = "transcribe") { filters: PropertyFilterSetStore, settings: SettingSetStore, ) { + val oldTextPath = binaryPath.parent.resolve(binaryPath.nameWithoutExtension + ".txt") + val oldTextTime = if (oldTextPath.exists()) Files.getLastModifiedTime(oldTextPath) else null statefulCacheProvider.update( Js5MasterIndex.trimmed( binary.header.revision, @@ -159,7 +162,12 @@ public class TranscribeCommand : CliktCommand(name = "transcribe") { consumers.close() // Set the last modified date to match up with the .bin file, so it's easier to find and link files // in particular when re-ordering files in descending order - Files.setLastModifiedTime(textPath, Files.getLastModifiedTime(binaryPath)) + val oldTime = oldTextTime ?: Files.getLastModifiedTime(binaryPath) + val baseTime = FileTime.fromMillis(oldTime.toMillis() + 1) + // Set the time 1 millisecond above the last (or binary) + // This ensures that tools such as notepad will pick up on file changes, as they rely on the + // last modified timestamp. + Files.setLastModifiedTime(textPath, baseTime) } private fun createBufferedWriterConsumer(writer: BufferedWriter): MessageConsumer { From ddd0612dce1bedd9c81d86327d0a03bce7fe94fb Mon Sep 17 00:00:00 2001 From: Kris Date: Thu, 16 Jan 2025 02:07:28 +0200 Subject: [PATCH 2/8] feat: revision 228 (initial copy of 227) --- protocol/osrs-228/build.gradle.kts | 14 + .../v228/ClientPacketDecoderServiceV228.kt | 25 + .../v228/GameClientProtProviderV228.kt | 11 + .../v228/GameServerProtProviderV228.kt | 11 + .../v228/ServerPacketDecoderServiceV228.kt | 31 + .../decoder/codec/buttons/If1ButtonDecoder.kt | 23 + .../decoder/codec/buttons/If3ButtonDecoder.kt | 30 + .../decoder/codec/buttons/IfButtonDDecoder.kt | 34 + .../decoder/codec/buttons/IfButtonTDecoder.kt | 34 + .../decoder/codec/buttons/IfSubOpDecoder.kt | 33 + ...ClanSettingsAddBannedFromChannelDecoder.kt | 29 + ...dClanSettingsSetMutedFromChannelDecoder.kt | 31 + .../clan/ClanChannelFullRequestDecoder.kt | 22 + .../codec/clan/ClanChannelKickUserDecoder.kt | 28 + .../clan/ClanSettingsFullRequestDecoder.kt | 22 + .../codec/events/EventAppletFocusDecoder.kt | 22 + .../events/EventCameraPositionDecoder.kt | 24 + .../codec/events/EventKeyboardDecoder.kt | 33 + .../codec/events/EventMouseClickDecoder.kt | 31 + .../codec/events/EventMouseMoveDecoder.kt | 85 ++ .../codec/events/EventMouseScrollDecoder.kt | 22 + .../events/EventNativeMouseClickDecoder.kt | 27 + .../events/EventNativeMouseMoveDecoder.kt | 87 ++ .../friendchat/FriendChatJoinLeaveDecoder.kt | 27 + .../codec/friendchat/FriendChatKickDecoder.kt | 22 + .../friendchat/FriendChatSetRankDecoder.kt | 24 + .../decoder/codec/locs/OpLoc1Decoder.kt | 29 + .../decoder/codec/locs/OpLoc2Decoder.kt | 29 + .../decoder/codec/locs/OpLoc3Decoder.kt | 29 + .../decoder/codec/locs/OpLoc4Decoder.kt | 29 + .../decoder/codec/locs/OpLoc5Decoder.kt | 29 + .../decoder/codec/locs/OpLoc6Decoder.kt | 20 + .../decoder/codec/locs/OpLocTDecoder.kt | 35 + .../codec/messaging/MessagePrivateDecoder.kt | 29 + .../codec/messaging/MessagePublicDecoder.kt | 66 + .../misc/client/ConnectionTelemetryDecoder.kt | 42 + .../client/DetectModifiedClientDecoder.kt | 22 + .../decoder/codec/misc/client/IdleDecoder.kt | 19 + .../misc/client/MapBuildCompleteDecoder.kt | 19 + .../MembershipPromotionEligibilityDecoder.kt | 26 + .../codec/misc/client/NoTimeoutDecoder.kt | 19 + .../client/ReflectionCheckReplyDecoder.kt | 135 +++ .../codec/misc/client/SendPingReplyDecoder.kt | 28 + .../misc/client/SoundJingleEndDecoder.kt | 22 + .../codec/misc/client/WindowStatusDecoder.kt | 28 + .../codec/misc/user/BugReportDecoder.kt | 34 + .../codec/misc/user/ClickWorldMapDecoder.kt | 21 + .../codec/misc/user/ClientCheatDecoder.kt | 22 + .../codec/misc/user/CloseModalDecoder.kt | 19 + .../codec/misc/user/HiscoreRequestDecoder.kt | 28 + .../codec/misc/user/IfCrmViewClickDecoder.kt | 33 + .../codec/misc/user/MoveGameClickDecoder.kt | 26 + .../misc/user/MoveMinimapClickDecoder.kt | 59 + .../codec/misc/user/OculusLeaveDecoder.kt | 19 + .../codec/misc/user/SendSnapshotDecoder.kt | 28 + .../misc/user/SetChatFilterSettingsDecoder.kt | 28 + .../codec/misc/user/SetHeadingDecoder.kt | 20 + .../codec/misc/user/TeleportDecoder.kt | 28 + .../decoder/codec/npcs/OpNpc1Decoder.kt | 25 + .../decoder/codec/npcs/OpNpc2Decoder.kt | 25 + .../decoder/codec/npcs/OpNpc3Decoder.kt | 25 + .../decoder/codec/npcs/OpNpc4Decoder.kt | 25 + .../decoder/codec/npcs/OpNpc5Decoder.kt | 25 + .../decoder/codec/npcs/OpNpc6Decoder.kt | 20 + .../decoder/codec/npcs/OpNpcTDecoder.kt | 31 + .../decoder/codec/objs/OpObj1Decoder.kt | 29 + .../decoder/codec/objs/OpObj2Decoder.kt | 29 + .../decoder/codec/objs/OpObj3Decoder.kt | 29 + .../decoder/codec/objs/OpObj4Decoder.kt | 29 + .../decoder/codec/objs/OpObj5Decoder.kt | 29 + .../decoder/codec/objs/OpObj6Decoder.kt | 26 + .../decoder/codec/objs/OpObjTDecoder.kt | 35 + .../decoder/codec/players/OpPlayer1Decoder.kt | 25 + .../decoder/codec/players/OpPlayer2Decoder.kt | 25 + .../decoder/codec/players/OpPlayer3Decoder.kt | 25 + .../decoder/codec/players/OpPlayer4Decoder.kt | 25 + .../decoder/codec/players/OpPlayer5Decoder.kt | 25 + .../decoder/codec/players/OpPlayer6Decoder.kt | 25 + .../decoder/codec/players/OpPlayer7Decoder.kt | 25 + .../decoder/codec/players/OpPlayer8Decoder.kt | 25 + .../decoder/codec/players/OpPlayerTDecoder.kt | 31 + .../resumed/ResumePCountDialogDecoder.kt | 22 + .../codec/resumed/ResumePNameDialogDecoder.kt | 22 + .../codec/resumed/ResumePObjDialogDecoder.kt | 22 + .../resumed/ResumePStringDialogDecoder.kt | 22 + .../codec/resumed/ResumePauseButtonDecoder.kt | 25 + .../codec/social/FriendListAddDecoder.kt | 22 + .../codec/social/FriendListDelDecoder.kt | 22 + .../codec/social/IgnoreListAddDecoder.kt | 22 + .../codec/social/IgnoreListDelDecoder.kt | 22 + .../prot/ClientMessageDecoderRepository.kt | 210 ++++ .../incoming/decoder/prot/GameClientProt.kt | 162 +++ .../incoming/decoder/prot/GameClientProtId.kt | 104 ++ .../decoder/codec/camera/CamLookAtDecoder.kt | 32 + .../camera/CamLookAtEasedCoordDecoder.kt | 32 + .../decoder/codec/camera/CamModeDecoder.kt | 24 + .../codec/camera/CamMoveToArcDecoder.kt | 38 + .../codec/camera/CamMoveToCyclesDecoder.kt | 34 + .../decoder/codec/camera/CamMoveToDecoder.kt | 32 + .../decoder/codec/camera/CamResetDecoder.kt | 21 + .../decoder/codec/camera/CamRotateBy.kt | 30 + .../codec/camera/CamRotateToDecoder.kt | 30 + .../decoder/codec/camera/CamShakeDecoder.kt | 30 + .../codec/camera/CamSmoothResetDecoder.kt | 30 + .../codec/camera/CamTargetV2Decoder.kt | 37 + .../decoder/codec/camera/OculusSyncDecoder.kt | 22 + .../codec/clan/ClanChannelDeltaDecoder.kt | 111 ++ .../codec/clan/ClanChannelFullDecoder.kt | 89 ++ .../codec/clan/ClanSettingsDeltaDecoder.kt | 202 ++++ .../codec/clan/ClanSettingsFullDecoder.kt | 176 +++ .../codec/clan/MessageClanChannelDecoder.kt | 37 + .../clan/MessageClanChannelSystemDecoder.kt | 33 + .../decoder/codec/clan/VarClanDecoder.kt | 24 + .../codec/clan/VarClanDisableDecoder.kt | 21 + .../codec/clan/VarClanEnableDecoder.kt | 21 + .../friendchat/MessageFriendChannelDecoder.kt | 38 + .../UpdateFriendChatChannelFullV2Decoder.kt | 54 + ...pdateFriendChatChannelSingleUserDecoder.kt | 41 + .../codec/info/NpcInfoLargeV5Decoder.kt | 28 + .../codec/info/NpcInfoSmallV5Decoder.kt | 28 + .../decoder/codec/info/PlayerInfoDecoder.kt | 22 + .../codec/info/SetNpcUpdateOriginDecoder.kt | 38 + .../codec/info/WorldEntityInfoV3Decoder.kt | 28 + .../codec/info/WorldEntityInfoV4Decoder.kt | 28 + .../codec/interfaces/IfClearInvDecoder.kt | 24 + .../codec/interfaces/IfCloseSubDecoder.kt | 26 + .../codec/interfaces/IfMoveSubDecoder.kt | 28 + .../codec/interfaces/IfOpenSubDecoder.kt | 28 + .../codec/interfaces/IfOpenTopDecoder.kt | 22 + .../codec/interfaces/IfResyncDecoder.kt | 62 + .../codec/interfaces/IfSetAngleDecoder.kt | 30 + .../codec/interfaces/IfSetAnimDecoder.kt | 26 + .../codec/interfaces/IfSetColourDecoder.kt | 26 + .../codec/interfaces/IfSetEventsDecoder.kt | 30 + .../codec/interfaces/IfSetHideDecoder.kt | 26 + .../codec/interfaces/IfSetModelDecoder.kt | 26 + .../interfaces/IfSetNpcHeadActiveDecoder.kt | 26 + .../codec/interfaces/IfSetNpcHeadDecoder.kt | 26 + .../codec/interfaces/IfSetObjectDecoder.kt | 28 + .../interfaces/IfSetPlayerHeadDecoder.kt | 24 + .../IfSetPlayerModelBaseColourDecoder.kt | 28 + .../IfSetPlayerModelBodyTypeDecoder.kt | 26 + .../interfaces/IfSetPlayerModelObjDecoder.kt | 26 + .../interfaces/IfSetPlayerModelSelfDecoder.kt | 26 + .../codec/interfaces/IfSetPositionDecoder.kt | 28 + .../interfaces/IfSetRotateSpeedDecoder.kt | 28 + .../codec/interfaces/IfSetScrollPosDecoder.kt | 26 + .../codec/interfaces/IfSetTextDecoder.kt | 26 + .../decoder/codec/inv/UpdateInvFullDecoder.kt | 39 + .../codec/inv/UpdateInvPartialDecoder.kt | 45 + .../codec/inv/UpdateInvStopTransmitDecoder.kt | 20 + .../decoder/codec/logout/LogoutDecoder.kt | 21 + .../codec/logout/LogoutTransferDecoder.kt | 28 + .../codec/logout/LogoutWithReasonDecoder.kt | 22 + .../decoder/codec/map/RebuildRegionDecoder.kt | 55 + .../codec/map/RebuildWorldEntityDecoder.kt | 57 + .../decoder/codec/map/ReconnectDecoder.kt | 45 + .../decoder/codec/map/StaticRebuildDecoder.kt | 149 +++ .../codec/misc/client/HideLocOpsDecoder.kt | 22 + .../codec/misc/client/HideNpcOpsDecoder.kt | 22 + .../codec/misc/client/HideObjOpsDecoder.kt | 22 + .../codec/misc/client/HintArrowDecoder.kt | 50 + .../codec/misc/client/HiscoreReplyDecoder.kt | 78 ++ .../codec/misc/client/MinimapToggleDecoder.kt | 22 + .../misc/client/PacketGroupEndDecoder.kt | 21 + .../misc/client/PacketGroupStartDecoder.kt | 26 + .../misc/client/ReflectionCheckerDecoder.kt | 123 ++ .../codec/misc/client/ResetAnimsDecoder.kt | 21 + .../client/ResetInteractionModeDecoder.kt | 24 + .../codec/misc/client/SendPingDecoder.kt | 26 + .../codec/misc/client/ServerTickEndDecoder.kt | 21 + .../misc/client/SetHeatmapEnabledDecoder.kt | 22 + .../misc/client/SetInteractionModeDecoder.kt | 28 + .../codec/misc/client/SiteSettingsDecoder.kt | 24 + .../misc/client/UpdateRebootTimerDecoder.kt | 22 + .../codec/misc/client/UpdateUid192Decoder.kt | 31 + .../codec/misc/client/UrlOpenDecoder.kt | 26 + .../misc/player/ChatFilterSettingsDecoder.kt | 24 + .../ChatFilterSettingsPrivateChatDecoder.kt | 24 + .../codec/misc/player/MessageGameDecoder.kt | 40 + .../misc/player/RunClientScriptDecoder.kt | 35 + .../codec/misc/player/SetMapFlagDecoder.kt | 26 + .../codec/misc/player/SetPlayerOpDecoder.kt | 26 + .../player/TriggerOnDialogAbortDecoder.kt | 21 + .../misc/player/UpdateRunEnergyDecoder.kt | 24 + .../misc/player/UpdateRunWeightDecoder.kt | 24 + .../codec/misc/player/UpdateStatV2Decoder.kt | 28 + .../player/UpdateStockMarketSlotDecoder.kt | 47 + .../misc/player/UpdateTradingPostDecoder.kt | 57 + .../codec/social/FriendListLoadedDecoder.kt | 21 + .../codec/social/MessagePrivateDecoder.kt | 35 + .../codec/social/MessagePrivateEchoDecoder.kt | 29 + .../codec/social/UpdateFriendListDecoder.kt | 64 + .../codec/social/UpdateIgnoreListDecoder.kt | 47 + .../decoder/codec/sound/MidiJingleDecoder.kt | 24 + .../codec/sound/MidiSongStopDecoder.kt | 24 + .../decoder/codec/sound/MidiSongV2Decoder.kt | 30 + .../sound/MidiSongWithSecondaryDecoder.kt | 32 + .../decoder/codec/sound/MidiSwapDecoder.kt | 28 + .../decoder/codec/sound/SynthSoundDecoder.kt | 28 + .../codec/specific/LocAnimSpecificDecoder.kt | 28 + .../codec/specific/MapAnimSpecificDecoder.kt | 29 + .../codec/specific/NpcAnimSpecificDecoder.kt | 26 + .../specific/NpcHeadIconSpecificDecoder.kt | 28 + .../specific/NpcSpotAnimSpecificDecoder.kt | 31 + .../specific/PlayerAnimSpecificDecoder.kt | 24 + .../specific/PlayerSpotAnimSpecificDecoder.kt | 31 + .../specific/ProjAnimSpecificV3Decoder.kt | 45 + .../codec/unknown/UnknownStringDecoder.kt | 22 + .../decoder/codec/varp/VarpLargeDecoder.kt | 24 + .../decoder/codec/varp/VarpResetDecoder.kt | 21 + .../decoder/codec/varp/VarpSmallDecoder.kt | 24 + .../decoder/codec/varp/VarpSyncDecoder.kt | 21 + .../codec/worldentity/ClearEntitiesDecoder.kt | 21 + .../worldentity/SetActiveWorldDecoder.kt | 31 + .../header/UpdateZoneFullFollowsDecoder.kt | 26 + .../UpdateZonePartialEnclosedDecoder.kt | 67 ++ .../header/UpdateZonePartialFollowsDecoder.kt | 26 + .../codec/zone/payload/LocAddChangeDecoder.kt | 31 + .../codec/zone/payload/LocAnimDecoder.kt | 28 + .../codec/zone/payload/LocDelDecoder.kt | 26 + .../codec/zone/payload/LocMergeDecoder.kt | 42 + .../codec/zone/payload/MapAnimDecoder.kt | 29 + .../codec/zone/payload/MapProjAnimDecoder.kt | 45 + .../codec/zone/payload/ObjAddDecoder.kt | 38 + .../codec/zone/payload/ObjCountDecoder.kt | 29 + .../codec/zone/payload/ObjCustomiseDecoder.kt | 38 + .../codec/zone/payload/ObjDelDecoder.kt | 27 + .../zone/payload/ObjEnabledOpsDecoder.kt | 28 + .../zone/payload/ObjUncustomiseDecoder.kt | 28 + .../codec/zone/payload/SoundAreaDecoder.kt | 33 + .../outgoing/decoder/prot/GameServerProt.kt | 196 +++ .../outgoing/decoder/prot/GameServerProtId.kt | 140 +++ .../prot/ServerMessageDecoderRepository.kt | 315 +++++ .../model/info/npcinfo/NpcInfoClient.kt | 869 ++++++++++++++ .../model/info/playerinfo/PlayerInfoClient.kt | 1069 +++++++++++++++++ 236 files changed, 10561 insertions(+) create mode 100644 protocol/osrs-228/build.gradle.kts create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/ClientPacketDecoderServiceV228.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/GameClientProtProviderV228.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/GameServerProtProviderV228.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/ServerPacketDecoderServiceV228.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/If1ButtonDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/If3ButtonDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfButtonDDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfButtonTDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfSubOpDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/AffinedClanSettingsAddBannedFromChannelDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/AffinedClanSettingsSetMutedFromChannelDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanChannelFullRequestDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanChannelKickUserDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanSettingsFullRequestDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventAppletFocusDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventCameraPositionDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventKeyboardDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventMouseClickDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventMouseMoveDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventMouseScrollDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventNativeMouseClickDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventNativeMouseMoveDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatJoinLeaveDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatKickDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatSetRankDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc1Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc2Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc3Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc4Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc5Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc6Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLocTDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/messaging/MessagePrivateDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/messaging/MessagePublicDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/ConnectionTelemetryDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/DetectModifiedClientDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/IdleDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/MapBuildCompleteDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/MembershipPromotionEligibilityDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/NoTimeoutDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/ReflectionCheckReplyDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/SoundJingleEndDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/WindowStatusDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/BugReportDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/ClickWorldMapDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/ClientCheatDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/CloseModalDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/HiscoreRequestDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/IfCrmViewClickDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/MoveGameClickDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/MoveMinimapClickDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/OculusLeaveDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SendSnapshotDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SetChatFilterSettingsDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SetHeadingDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/TeleportDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc1Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc2Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc3Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc4Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc5Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc6Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpcTDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj1Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj2Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj3Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj4Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj5Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj6Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObjTDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer1Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer2Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer3Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer4Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer5Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer6Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer7Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer8Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayerTDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePCountDialogDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePNameDialogDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePObjDialogDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePStringDialogDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePauseButtonDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/FriendListAddDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/FriendListDelDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/IgnoreListAddDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/IgnoreListDelDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/prot/GameClientProt.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/prot/GameClientProtId.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamLookAtDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamLookAtEasedCoordDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamModeDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamMoveToArcDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamMoveToCyclesDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamMoveToDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamResetDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamRotateBy.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamRotateToDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamShakeDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamSmoothResetDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamTargetV2Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/OculusSyncDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/ClanChannelDeltaDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/ClanChannelFullDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/ClanSettingsDeltaDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/ClanSettingsFullDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/MessageClanChannelDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/MessageClanChannelSystemDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/VarClanDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/VarClanDisableDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/VarClanEnableDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/friendchat/MessageFriendChannelDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/friendchat/UpdateFriendChatChannelFullV2Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/friendchat/UpdateFriendChatChannelSingleUserDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/NpcInfoLargeV5Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/NpcInfoSmallV5Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/PlayerInfoDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/SetNpcUpdateOriginDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/WorldEntityInfoV3Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/WorldEntityInfoV4Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfClearInvDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfCloseSubDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfMoveSubDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfOpenSubDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfOpenTopDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfResyncDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetAngleDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetAnimDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetColourDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetEventsDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetHideDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetModelDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadActiveDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetObjectDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerHeadDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBaseColourDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBodyTypeDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelObjDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelSelfDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPositionDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetScrollPosDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetTextDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvFullDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvPartialDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvStopTransmitDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/logout/LogoutDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/logout/LogoutTransferDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/logout/LogoutWithReasonDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/map/RebuildRegionDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/map/RebuildWorldEntityDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/map/ReconnectDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/map/StaticRebuildDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/HideLocOpsDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/HideNpcOpsDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/HideObjOpsDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/HintArrowDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/HiscoreReplyDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/MinimapToggleDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/PacketGroupEndDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/PacketGroupStartDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/ReflectionCheckerDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/ResetAnimsDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/ResetInteractionModeDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/SendPingDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/ServerTickEndDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/SetHeatmapEnabledDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/SetInteractionModeDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/SiteSettingsDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/UpdateRebootTimerDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/UpdateUid192Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/UrlOpenDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsPrivateChatDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/MessageGameDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/RunClientScriptDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/SetMapFlagDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/SetPlayerOpDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/TriggerOnDialogAbortDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateRunEnergyDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateRunWeightDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateStatV2Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateTradingPostDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/social/FriendListLoadedDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/social/MessagePrivateDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/social/MessagePrivateEchoDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/social/UpdateFriendListDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/social/UpdateIgnoreListDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiJingleDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongStopDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongV2Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongWithSecondaryDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSwapDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/SynthSoundDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/LocAnimSpecificDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/MapAnimSpecificDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcAnimSpecificDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcHeadIconSpecificDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcSpotAnimSpecificDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/PlayerAnimSpecificDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/PlayerSpotAnimSpecificDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/ProjAnimSpecificV3Decoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/unknown/UnknownStringDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpLargeDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpResetDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpSmallDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpSyncDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/worldentity/ClearEntitiesDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/worldentity/SetActiveWorldDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZoneFullFollowsDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZonePartialEnclosedDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZonePartialFollowsDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocAnimDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocDelDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/MapProjAnimDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjCountDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjCustomiseDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjDelDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjEnabledOpsDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjUncustomiseDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/SoundAreaDecoder.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/GameServerProt.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/GameServerProtId.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/npcinfo/NpcInfoClient.kt create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt diff --git a/protocol/osrs-228/build.gradle.kts b/protocol/osrs-228/build.gradle.kts new file mode 100644 index 00000000..f47018b2 --- /dev/null +++ b/protocol/osrs-228/build.gradle.kts @@ -0,0 +1,14 @@ +dependencies { + implementation(platform(rootProject.libs.netty.bom)) + implementation(rootProject.libs.netty.buffer) + implementation(rootProject.libs.netty.transport) + implementation(rootProject.libs.netty.handler) + implementation(rootProject.libs.rsprot.buffer) + implementation(rootProject.libs.rsprot.compression) + implementation(rootProject.libs.rsprot.protocol) + implementation(rootProject.libs.rsprot.crypto) + implementation(platform(rootProject.libs.log4j.bom)) + implementation(rootProject.libs.bundles.log4j) + implementation(projects.protocol) + implementation(projects.cache.cacheApi) +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/ClientPacketDecoderServiceV228.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/ClientPacketDecoderServiceV228.kt new file mode 100644 index 00000000..f793c5e5 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/ClientPacketDecoderServiceV228.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v228 + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.compression.HuffmanCodec +import net.rsprot.protocol.message.IncomingMessage +import net.rsprox.protocol.ClientPacketDecoder +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.ClientMessageDecoderRepository + +public class ClientPacketDecoderServiceV228( + huffmanCodec: HuffmanCodec, +) : ClientPacketDecoder { + @OptIn(ExperimentalStdlibApi::class) + private val repository = ClientMessageDecoderRepository.build(huffmanCodec) + + override fun decode( + opcode: Int, + payload: JagByteBuf, + session: Session, + ): IncomingMessage { + return repository + .getDecoder(opcode) + .decode(payload, session) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/GameClientProtProviderV228.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/GameClientProtProviderV228.kt new file mode 100644 index 00000000..055dc44f --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/GameClientProtProviderV228.kt @@ -0,0 +1,11 @@ +package net.rsprox.protocol.v228 + +import net.rsprox.protocol.ProtProvider +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +public data object GameClientProtProviderV228 : ProtProvider { + override fun get(opcode: Int): GameClientProt { + return GameClientProt.entries.firstOrNull { it.opcode == opcode } + ?: throw IllegalArgumentException("Unknown game client prot: $opcode") + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/GameServerProtProviderV228.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/GameServerProtProviderV228.kt new file mode 100644 index 00000000..13de5026 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/GameServerProtProviderV228.kt @@ -0,0 +1,11 @@ +package net.rsprox.protocol.v228 + +import net.rsprox.protocol.ProtProvider +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +public data object GameServerProtProviderV228 : ProtProvider { + override fun get(opcode: Int): GameServerProt { + return GameServerProt.entries.firstOrNull { it.opcode == opcode } + ?: throw IllegalArgumentException("Unknown game server prot: $opcode") + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/ServerPacketDecoderServiceV228.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/ServerPacketDecoderServiceV228.kt new file mode 100644 index 00000000..5c189dd0 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/ServerPacketDecoderServiceV228.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v228 + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.compression.HuffmanCodec +import net.rsprot.protocol.message.IncomingMessage +import net.rsprox.cache.api.CacheProvider +import net.rsprox.protocol.ServerPacketDecoder +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.ServerMessageDecoderRepository + +public class ServerPacketDecoderServiceV228( + huffmanCodec: HuffmanCodec, + cache: CacheProvider, +) : ServerPacketDecoder { + @OptIn(ExperimentalStdlibApi::class) + private val repository = + ServerMessageDecoderRepository.build( + huffmanCodec, + cache, + ) + + override fun decode( + opcode: Int, + payload: JagByteBuf, + session: Session, + ): IncomingMessage { + return repository + .getDecoder(opcode) + .decode(payload, session) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/If1ButtonDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/If1ButtonDecoder.kt new file mode 100644 index 00000000..5c6e049a --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/If1ButtonDecoder.kt @@ -0,0 +1,23 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprot.protocol.util.gCombinedId +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.buttons.If1Button +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class If1ButtonDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.IF_BUTTON + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): If1Button { + val combinedId = buffer.gCombinedId() + return If1Button(combinedId) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/If3ButtonDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/If3ButtonDecoder.kt new file mode 100644 index 00000000..98ace382 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/If3ButtonDecoder.kt @@ -0,0 +1,30 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.metadata.Consistent +import net.rsprot.protocol.util.gCombinedId +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.buttons.If3Button +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class If3ButtonDecoder( + override val prot: GameClientProt, + private val op: Int, +) : ProxyMessageDecoder { + override fun decode( + buffer: JagByteBuf, + session: Session, + ): If3Button { + val combinedId = buffer.gCombinedId() + val sub = buffer.g2() + val obj = buffer.g2() + return If3Button( + combinedId, + sub, + obj, + op, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfButtonDDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfButtonDDecoder.kt new file mode 100644 index 00000000..f18cf094 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfButtonDDecoder.kt @@ -0,0 +1,34 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt1 +import net.rsprot.protocol.util.gCombinedIdAlt2 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.buttons.IfButtonD +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class IfButtonDDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.IF_BUTTOND + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfButtonD { + val selectedSub = buffer.g2() + val targetCombinedId = buffer.gCombinedIdAlt2() + val targetSub = buffer.g2Alt2() + val selectedCombinedId = buffer.gCombinedIdAlt1() + val selectedObj = buffer.g2Alt3() + val targetObj = buffer.g2Alt3() + return IfButtonD( + selectedCombinedId, + selectedSub, + selectedObj, + targetCombinedId, + targetSub, + targetObj, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfButtonTDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfButtonTDecoder.kt new file mode 100644 index 00000000..7b40ae18 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfButtonTDecoder.kt @@ -0,0 +1,34 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt1 +import net.rsprot.protocol.util.gCombinedIdAlt2 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.buttons.IfButtonT +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class IfButtonTDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.IF_BUTTONT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfButtonT { + val targetSub = buffer.g2Alt2() + val selectedObj = buffer.g2Alt2() + val targetCombinedId = buffer.gCombinedIdAlt1() + val selectedSub = buffer.g2Alt3() + val selectedCombinedId = buffer.gCombinedIdAlt2() + val targetObj = buffer.g2Alt3() + return IfButtonT( + selectedCombinedId, + selectedSub, + selectedObj, + targetCombinedId, + targetSub, + targetObj, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfSubOpDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfSubOpDecoder.kt new file mode 100644 index 00000000..c5c24a8e --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfSubOpDecoder.kt @@ -0,0 +1,33 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprot.protocol.util.gCombinedId +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.buttons.IfSubOp +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class IfSubOpDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.IF_SUBOP + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSubOp { + val combinedId = buffer.gCombinedId() + val sub = buffer.g2() + val obj = buffer.g2() + val subop = buffer.g1() + val op = buffer.g1() + return IfSubOp( + combinedId, + sub, + obj, + op + 1, + subop, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/AffinedClanSettingsAddBannedFromChannelDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/AffinedClanSettingsAddBannedFromChannelDecoder.kt new file mode 100644 index 00000000..c7978bba --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/AffinedClanSettingsAddBannedFromChannelDecoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.clan + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.clan.AffinedClanSettingsAddBannedFromChannel +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class AffinedClanSettingsAddBannedFromChannelDecoder : + ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.AFFINEDCLANSETTINGS_ADDBANNED_FROMCHANNEL + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): AffinedClanSettingsAddBannedFromChannel { + val clanId = buffer.g1() + val memberIndex = buffer.g2() + val name = buffer.gjstr() + return AffinedClanSettingsAddBannedFromChannel( + name, + clanId, + memberIndex, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/AffinedClanSettingsSetMutedFromChannelDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/AffinedClanSettingsSetMutedFromChannelDecoder.kt new file mode 100644 index 00000000..11f21364 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/AffinedClanSettingsSetMutedFromChannelDecoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.clan + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.clan.AffinedClanSettingsSetMutedFromChannel +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class AffinedClanSettingsSetMutedFromChannelDecoder : + ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.AFFINEDCLANSETTINGS_SETMUTED_FROMCHANNEL + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): AffinedClanSettingsSetMutedFromChannel { + val clanId = buffer.g1() + val memberIndex = buffer.g2() + val muted = buffer.g1() == 1 + val name = buffer.gjstr() + return AffinedClanSettingsSetMutedFromChannel( + name, + clanId, + memberIndex, + muted, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanChannelFullRequestDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanChannelFullRequestDecoder.kt new file mode 100644 index 00000000..984f1a37 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanChannelFullRequestDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.clan + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.clan.ClanChannelFullRequest +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class ClanChannelFullRequestDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.CLANCHANNEL_FULL_REQUEST + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ClanChannelFullRequest { + val clanId = buffer.g1s() + return ClanChannelFullRequest(clanId) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanChannelKickUserDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanChannelKickUserDecoder.kt new file mode 100644 index 00000000..6780b38c --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanChannelKickUserDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.clan + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.clan.ClanChannelKickUser +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class ClanChannelKickUserDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.CLANCHANNEL_KICKUSER + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ClanChannelKickUser { + val clanId = buffer.g1() + val memberIndex = buffer.g2() + val name = buffer.gjstr() + return ClanChannelKickUser( + name, + clanId, + memberIndex, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanSettingsFullRequestDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanSettingsFullRequestDecoder.kt new file mode 100644 index 00000000..c01adce5 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanSettingsFullRequestDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.clan + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.clan.ClanSettingsFullRequest +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class ClanSettingsFullRequestDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.CLANSETTINGS_FULL_REQUEST + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ClanSettingsFullRequest { + val clanId = buffer.g1s() + return ClanSettingsFullRequest(clanId) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventAppletFocusDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventAppletFocusDecoder.kt new file mode 100644 index 00000000..2237fb71 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventAppletFocusDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.events + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.events.EventAppletFocus +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class EventAppletFocusDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.EVENT_APPLET_FOCUS + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): EventAppletFocus { + val inFocus = buffer.g1() == 1 + return EventAppletFocus(inFocus) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventCameraPositionDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventCameraPositionDecoder.kt new file mode 100644 index 00000000..00ca1530 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventCameraPositionDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.events + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.events.EventCameraPosition +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class EventCameraPositionDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.EVENT_CAMERA_POSITION + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): EventCameraPosition { + val angleY = buffer.g2Alt2() + val angleX = buffer.g2() + return EventCameraPosition( + angleX, + angleY, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventKeyboardDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventKeyboardDecoder.kt new file mode 100644 index 00000000..a676f630 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventKeyboardDecoder.kt @@ -0,0 +1,33 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.events + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.events.EventKeyboard +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class EventKeyboardDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.EVENT_KEYBOARD + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): EventKeyboard { + val count = buffer.readableBytes() / 4 + val keys = ByteArray(count) + var lastTransmittedKeyPress: Int = -1 + for (i in 0.. { + override val prot: ClientProt = GameClientProt.EVENT_MOUSE_CLICK + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): EventMouseClick { + val packed = buffer.g2() + val rightClick = packed and 0x1 != 0 + val lastTransmittedMouseClick = packed ushr 1 + val x = buffer.g2() + val y = buffer.g2() + return EventMouseClick( + lastTransmittedMouseClick, + rightClick, + x, + y, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventMouseMoveDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventMouseMoveDecoder.kt new file mode 100644 index 00000000..beb98c35 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventMouseMoveDecoder.kt @@ -0,0 +1,85 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.events + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.events.EventMouseMove +import net.rsprox.protocol.game.incoming.model.events.util.MouseMovements +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Suppress("DuplicatedCode") +@Consistent +internal class EventMouseMoveDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.EVENT_MOUSE_MOVE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): EventMouseMove { + val averageTime = buffer.g1() + val remainingTime = buffer.g1() + val array = threadLocalArray.get() + var count = 0 + while (buffer.isReadable) { + var packed = buffer.g1() + var deltaX: Int + var deltaY: Int + var timeSinceLastMovement: Int + if (packed and 0xE0 == 0xE0) { + timeSinceLastMovement = packed and 0x1f shl 8 or buffer.g1() + deltaX = buffer.g2s() + deltaY = buffer.g2s() + if (deltaY == 0 && deltaX == -0x8000) { + deltaX = -1 + deltaY = -1 + } + } else if (packed and 0xC0 == 0xC0) { + timeSinceLastMovement = packed and 0x3f + deltaX = buffer.g2s() + deltaY = buffer.g2s() + if (deltaY == 0 && deltaX == -0x8000) { + deltaX = -1 + deltaY = -1 + } + } else if (packed and 0x80 == 0x80) { + timeSinceLastMovement = packed and 0x7f + deltaX = buffer.g1() - 128 + deltaY = buffer.g1() - 128 + } else { + packed = (packed shl 8) or (buffer.g1()) + timeSinceLastMovement = (packed ushr 12) and 0x7 + deltaX = ((packed shr 6) and 0x3F) - 32 + deltaY = (packed and 0x3F) - 32 + } + val change = + MouseMovements.MousePosChange.pack( + timeSinceLastMovement, + deltaX, + deltaY, + ) + array[count++] = change + } + val slice = array.copyOf(count) + return EventMouseMove( + averageTime, + remainingTime, + MouseMovements(slice), + ) + } + + private companion object { + /** + * Utilizing a thread-local initial long array, as the number of + * mouse movements is unknown (relies on remaining bytes in buffer, + * which in turn uses compression methods so each entry can be 2-4 bytes). + * As Netty's threads decode this, a thread-local implementation is + * perfectly safe to utilize, and will save us some memory in return. + */ + private val threadLocalArray = + ThreadLocal.withInitial { + LongArray(128) + } + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventMouseScrollDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventMouseScrollDecoder.kt new file mode 100644 index 00000000..0170864e --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventMouseScrollDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.events + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.events.EventMouseScroll +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class EventMouseScrollDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.EVENT_MOUSE_SCROLL + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): EventMouseScroll { + val rotation = buffer.g2s() + return EventMouseScroll(rotation) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventNativeMouseClickDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventNativeMouseClickDecoder.kt new file mode 100644 index 00000000..98b7aa19 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventNativeMouseClickDecoder.kt @@ -0,0 +1,27 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.events + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.events.EventNativeMouseClick +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class EventNativeMouseClickDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.EVENT_NATIVE_MOUSE_CLICK + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): EventNativeMouseClick { + val packedCoord = buffer.g4Alt2() + val lastTransmittedMouseClick = buffer.g2() + val code = buffer.g1Alt2() + return EventNativeMouseClick( + lastTransmittedMouseClick, + code, + packedCoord and 0xFFFF, + packedCoord ushr 16 and 0xFFFF, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventNativeMouseMoveDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventNativeMouseMoveDecoder.kt new file mode 100644 index 00000000..708e421f --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventNativeMouseMoveDecoder.kt @@ -0,0 +1,87 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.events + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.events.EventNativeMouseMove +import net.rsprox.protocol.game.incoming.model.events.util.MouseMovements +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Suppress("DuplicatedCode") +@Consistent +internal class EventNativeMouseMoveDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.EVENT_NATIVE_MOUSE_MOVE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): EventNativeMouseMove { + val averageTime = buffer.g1() + val remainingTime = buffer.g1() + val array = threadLocalArray.get() + var count = 0 + while (buffer.isReadable) { + var packed = buffer.g1() + var deltaX: Int + var deltaY: Int + var timeSinceLastMovement: Int + if (packed and 0xE0 == 0xE0) { + timeSinceLastMovement = packed and 0x1f shl 8 or buffer.g1() + deltaX = buffer.g2s() + deltaY = buffer.g2s() + if (deltaY == 0 && deltaX == -0x8000) { + deltaX = -1 + deltaY = -1 + } + } else if (packed and 0xC0 == 0xC0) { + timeSinceLastMovement = packed and 0x3f + deltaX = buffer.g2s() + deltaY = buffer.g2s() + if (deltaY == 0 && deltaX == -0x8000) { + deltaX = -1 + deltaY = -1 + } + } else if (packed and 0x80 == 0x80) { + timeSinceLastMovement = packed and 0x7f + deltaX = buffer.g1() - 128 + deltaY = buffer.g1() - 128 + } else { + packed = (packed shl 8) or (buffer.g1()) + timeSinceLastMovement = (packed ushr 12) and 0x7 + deltaX = ((packed shr 6) and 0x3F) - 32 + deltaY = (packed and 0x3F) - 32 + } + val lastMouseButton = buffer.g1() + val change = + MouseMovements.MousePosChange.pack( + timeSinceLastMovement, + deltaX, + deltaY, + lastMouseButton, + ) + array[count++] = change + } + val slice = array.copyOf(count) + return EventNativeMouseMove( + averageTime, + remainingTime, + MouseMovements(slice), + ) + } + + private companion object { + /** + * Utilizing a thread-local initial long array, as the number of + * mouse movements is unknown (relies on remaining bytes in buffer, + * which in turn uses compression methods so each entry can be 2-4 bytes). + * As Netty's threads decode this, a thread-local implementation is + * perfectly safe to utilize, and will save us some memory in return. + */ + private val threadLocalArray = + ThreadLocal.withInitial { + LongArray(128) + } + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatJoinLeaveDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatJoinLeaveDecoder.kt new file mode 100644 index 00000000..68c9aec2 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatJoinLeaveDecoder.kt @@ -0,0 +1,27 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.friendchat + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.friendchat.FriendChatJoinLeave +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class FriendChatJoinLeaveDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.FRIENDCHAT_JOIN_LEAVE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): FriendChatJoinLeave { + val name = + if (!buffer.isReadable) { + null + } else { + buffer.gjstr() + } + return FriendChatJoinLeave(name) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatKickDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatKickDecoder.kt new file mode 100644 index 00000000..cbf92ea3 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatKickDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.friendchat + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.friendchat.FriendChatKick +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class FriendChatKickDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.FRIENDCHAT_KICK + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): FriendChatKick { + val name = buffer.gjstr() + return FriendChatKick(name) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatSetRankDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatSetRankDecoder.kt new file mode 100644 index 00000000..0652623e --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatSetRankDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.friendchat + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.friendchat.FriendChatSetRank +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class FriendChatSetRankDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.FRIENDCHAT_SETRANK + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): FriendChatSetRank { + val rank = buffer.g1Alt1() + val name = buffer.gjstr() + return FriendChatSetRank( + name, + rank, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc1Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc1Decoder.kt new file mode 100644 index 00000000..67a657f3 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc1Decoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.locs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.locs.OpLoc +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpLoc1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPLOC1 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpLoc { + val id = buffer.g2Alt2() + val controlKey = buffer.g1() == 1 + val z = buffer.g2() + val x = buffer.g2() + return OpLoc( + id, + x, + z, + controlKey, + 1, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc2Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc2Decoder.kt new file mode 100644 index 00000000..24998db7 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc2Decoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.locs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.locs.OpLoc +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpLoc2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPLOC2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpLoc { + val id = buffer.g2Alt3() + val controlKey = buffer.g1Alt1() == 1 + val x = buffer.g2Alt1() + val z = buffer.g2Alt3() + return OpLoc( + id, + x, + z, + controlKey, + 2, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc3Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc3Decoder.kt new file mode 100644 index 00000000..66938392 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc3Decoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.locs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.locs.OpLoc +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpLoc3Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPLOC3 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpLoc { + val x = buffer.g2() + val controlKey = buffer.g1Alt3() == 1 + val id = buffer.g2Alt1() + val z = buffer.g2Alt2() + return OpLoc( + id, + x, + z, + controlKey, + 3, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc4Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc4Decoder.kt new file mode 100644 index 00000000..44ec4050 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc4Decoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.locs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.locs.OpLoc +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpLoc4Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPLOC4 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpLoc { + val id = buffer.g2Alt3() + val z = buffer.g2Alt1() + val x = buffer.g2() + val controlKey = buffer.g1() == 1 + return OpLoc( + id, + x, + z, + controlKey, + 4, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc5Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc5Decoder.kt new file mode 100644 index 00000000..524052ef --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc5Decoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.locs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.locs.OpLoc +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpLoc5Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPLOC5 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpLoc { + val controlKey = buffer.g1Alt3() == 1 + val id = buffer.g2Alt2() + val x = buffer.g2() + val z = buffer.g2Alt2() + return OpLoc( + id, + x, + z, + controlKey, + 5, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc6Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc6Decoder.kt new file mode 100644 index 00000000..4fdeb0bf --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc6Decoder.kt @@ -0,0 +1,20 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.locs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.locs.OpLoc6 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpLoc6Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPLOC6 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpLoc6 { + val id = buffer.g2Alt1() + return OpLoc6(id) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLocTDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLocTDecoder.kt new file mode 100644 index 00000000..ffac2da7 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLocTDecoder.kt @@ -0,0 +1,35 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.locs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt1 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.locs.OpLocT +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpLocTDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPLOCT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpLocT { + val z = buffer.g2() + val selectedSub = buffer.g2Alt1() + val x = buffer.g2() + val id = buffer.g2Alt2() + val selectedCombinedId = buffer.gCombinedIdAlt1() + val selectedObj = buffer.g2Alt2() + val controlKey = buffer.g1Alt1() == 1 + return OpLocT( + id, + x, + z, + controlKey, + selectedCombinedId, + selectedSub, + selectedObj, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/messaging/MessagePrivateDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/messaging/MessagePrivateDecoder.kt new file mode 100644 index 00000000..0bd9a4d3 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/messaging/MessagePrivateDecoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.messaging + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.compression.HuffmanCodec +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.messaging.MessagePrivate +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class MessagePrivateDecoder( + private val huffmanCodec: HuffmanCodec, +) : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.MESSAGE_PRIVATE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MessagePrivate { + val name = buffer.gjstr() + val message = huffmanCodec.decode(buffer) + return MessagePrivate( + name, + message, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/messaging/MessagePublicDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/messaging/MessagePublicDecoder.kt new file mode 100644 index 00000000..6bfe00c8 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/messaging/MessagePublicDecoder.kt @@ -0,0 +1,66 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.messaging + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.compression.HuffmanCodec +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.messaging.MessagePublic +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class MessagePublicDecoder( + private val huffmanCodec: HuffmanCodec, +) : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.MESSAGE_PUBLIC + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MessagePublic { + val type = buffer.g1() + val colour = buffer.g1() + val effect = buffer.g1() + val patternArray = + if (colour in 13..20) { + ByteArray(colour - 12) { + buffer.g1().toByte() + } + } else { + null + } + val hasTrailingByte = type == CLAN_MAIN_CHANNEL_TYPE + val huffmanSlice = + if (hasTrailingByte) { + buffer.buffer.readSlice(buffer.readableBytes() - 1) + } else { + buffer.buffer + } + val message = huffmanCodec.decode(huffmanSlice) + val clanType = + if (hasTrailingByte) { + buffer.g1() + } else { + -1 + } + val pattern = + if (patternArray != null) { + MessagePublic.MessageColourPattern(patternArray) + } else { + null + } + return MessagePublic( + type, + colour, + effect, + message, + pattern, + clanType, + ) + } + + private companion object { + private const val CLAN_MAIN_CHANNEL_TYPE: Int = 3 + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/ConnectionTelemetryDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/ConnectionTelemetryDecoder.kt new file mode 100644 index 00000000..8dcae99a --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/ConnectionTelemetryDecoder.kt @@ -0,0 +1,42 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.client.ConnectionTelemetry +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class ConnectionTelemetryDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.CONNECTION_TELEMETRY + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ConnectionTelemetry { + val connectionLostDuration = buffer.g2() + val loginDuration = buffer.g2() + val unusedDuration = buffer.g2() + check(unusedDuration == 0) { + "Unknown duration detected: $unusedDuration" + } + val clientState = buffer.g2() + val unused1 = buffer.g2() + check(unused1 == 0) { + "Unused1 property value detected: $unused1" + } + val loginCount = buffer.g2() + val unused2 = buffer.g2() + check(unused2 == 0) { + "Unused2 property value detected: $unused2" + } + return ConnectionTelemetry( + connectionLostDuration, + loginDuration, + clientState, + loginCount, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/DetectModifiedClientDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/DetectModifiedClientDecoder.kt new file mode 100644 index 00000000..f29ae5db --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/DetectModifiedClientDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.client.DetectModifiedClient +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class DetectModifiedClientDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.DETECT_MODIFIED_CLIENT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): DetectModifiedClient { + val code = buffer.g4() + return DetectModifiedClient(code) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/IdleDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/IdleDecoder.kt new file mode 100644 index 00000000..5bf3a17a --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/IdleDecoder.kt @@ -0,0 +1,19 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.client.Idle +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class IdleDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.IDLE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): Idle = Idle +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/MapBuildCompleteDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/MapBuildCompleteDecoder.kt new file mode 100644 index 00000000..74cf9053 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/MapBuildCompleteDecoder.kt @@ -0,0 +1,19 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.client.MapBuildComplete +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class MapBuildCompleteDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.MAP_BUILD_COMPLETE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MapBuildComplete = MapBuildComplete +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/MembershipPromotionEligibilityDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/MembershipPromotionEligibilityDecoder.kt new file mode 100644 index 00000000..5f0d6d84 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/MembershipPromotionEligibilityDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.client.MembershipPromotionEligibility +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class MembershipPromotionEligibilityDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.MEMBERSHIP_PROMOTION_ELIGIBILITY + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MembershipPromotionEligibility { + val eligibleForIntroductoryPrice = buffer.g1() + val eligibleForTrialPurchase = buffer.g1() + return MembershipPromotionEligibility( + eligibleForIntroductoryPrice, + eligibleForTrialPurchase, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/NoTimeoutDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/NoTimeoutDecoder.kt new file mode 100644 index 00000000..9da4ad1e --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/NoTimeoutDecoder.kt @@ -0,0 +1,19 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.client.NoTimeout +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class NoTimeoutDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.NO_TIMEOUT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): NoTimeout = NoTimeout +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/ReflectionCheckReplyDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/ReflectionCheckReplyDecoder.kt new file mode 100644 index 00000000..075c62c0 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/ReflectionCheckReplyDecoder.kt @@ -0,0 +1,135 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.buffer.extensions.checkCRC32 +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.client.ReflectionCheckReply +import net.rsprox.protocol.game.incoming.model.misc.client.ReflectionCheckReply.ErrorResult +import net.rsprox.protocol.reflection.ReflectionCheck +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.session.getReflectionChecks +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import java.io.IOException +import java.io.InvalidClassException +import java.io.OptionalDataException +import java.io.StreamCorruptedException +import java.lang.reflect.InvocationTargetException + +@Consistent +internal class ReflectionCheckReplyDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.REFLECTION_CHECK_REPLY + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ReflectionCheckReply { + val id = buffer.g4() + val checks = session.getReflectionChecks().remove(id) + checkNotNull(checks) { + "Unable to link reflection check reply to request: $id" + } + val results = ArrayList>(checks.size) + for (check in checks) { + val opcode = buffer.g1s() + if (opcode < 0) { + results += + if (opcode <= -10) { + val throwable = getExecutionThrowableClass(opcode) + ErrorResult( + check, + ErrorResult.ThrowableResultType.ExecutionThrowable(throwable), + ) + } else { + val throwable = getConstructionThrowableClass(opcode) + ErrorResult( + check, + ErrorResult.ThrowableResultType.ConstructionThrowable(throwable), + ) + } + continue + } + when (check) { + is ReflectionCheck.GetFieldValue -> { + val result = buffer.g4() + results += ReflectionCheckReply.GetFieldValueResult(check, result) + } + is ReflectionCheck.SetFieldValue -> { + results += ReflectionCheckReply.SetFieldValueResult(check) + } + is ReflectionCheck.GetFieldModifiers -> { + val modifiers = buffer.g4() + results += ReflectionCheckReply.GetFieldModifiersResult(check, modifiers) + } + is ReflectionCheck.InvokeMethod -> { + results += + when (opcode) { + 0 -> ReflectionCheckReply.InvokeMethodResult(check, ReflectionCheckReply.NullReturnValue) + 1 -> + ReflectionCheckReply.InvokeMethodResult( + check, + ReflectionCheckReply.NumberReturnValue(buffer.g8()), + ) + 2 -> + ReflectionCheckReply.InvokeMethodResult( + check, + ReflectionCheckReply.StringReturnValue(buffer.gjstr()), + ) + 4 -> ReflectionCheckReply.InvokeMethodResult(check, ReflectionCheckReply.UnknownReturnValue) + else -> throw IllegalStateException("Unknown opcode for method invocation: $opcode") + } + } + is ReflectionCheck.GetMethodModifiers -> { + val modifiers = buffer.g4() + results += ReflectionCheckReply.GetMethodModifiersResult(check, modifiers) + } + } + } + buffer.readerIndex(buffer.writerIndex()) + if (!buffer.buffer.checkCRC32()) { + throw IllegalStateException("CRC mismatch!") + } + return ReflectionCheckReply( + id, + results, + ) + } + + /** + * Gets the throwable class corresponding to each opcode during the reflection check execution. + * @param opcode the opcode value + * @return the throwable class corresponding to that opcode + */ + private fun getExecutionThrowableClass(opcode: Int): Class = + when (opcode) { + -10 -> ClassNotFoundException::class.java + -11 -> InvalidClassException::class.java + -12 -> StreamCorruptedException::class.java + -13 -> OptionalDataException::class.java + -14 -> IllegalAccessException::class.java + -15 -> IllegalArgumentException::class.java + -16 -> InvocationTargetException::class.java + -17 -> SecurityException::class.java + -18 -> IOException::class.java + -19 -> NullPointerException::class.java + -20 -> Exception::class.java + -21 -> Throwable::class.java + else -> throw IllegalArgumentException("Unknown execution throwable opcode: $opcode") + } + + /** + * Gets the throwable class corresponding to each opcode during the reflection check construction. + * @param opcode the opcode value + * @return the throwable class corresponding to that opcode + */ + private fun getConstructionThrowableClass(opcode: Int): Class = + when (opcode) { + -1 -> ClassNotFoundException::class.java + -2 -> SecurityException::class.java + -3 -> NullPointerException::class.java + -4 -> Exception::class.java + -5 -> Throwable::class.java + else -> throw IllegalArgumentException("Unknown construction throwable opcode: $opcode") + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt new file mode 100644 index 00000000..cba65b00 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.client.SendPingReply +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class SendPingReplyDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.SEND_PING_REPLY + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): SendPingReply { + val gcPercentTime = buffer.g1Alt3() + val fps = buffer.g1() + val value1 = buffer.g4Alt3() + val value2 = buffer.g4Alt1() + return SendPingReply( + fps, + gcPercentTime, + value1, + value2, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/SoundJingleEndDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/SoundJingleEndDecoder.kt new file mode 100644 index 00000000..25b9cd45 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/SoundJingleEndDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.client.SoundJingleEnd +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class SoundJingleEndDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.SOUND_JINGLEEND + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): SoundJingleEnd { + val jingle = buffer.g4() + return SoundJingleEnd(jingle) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/WindowStatusDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/WindowStatusDecoder.kt new file mode 100644 index 00000000..d09def95 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/WindowStatusDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.client.WindowStatus +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class WindowStatusDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.WINDOW_STATUS + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): WindowStatus { + val windowMode = buffer.g1() + val frameWidth = buffer.g2() + val frameHeight = buffer.g2() + return WindowStatus( + windowMode, + frameWidth, + frameHeight, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/BugReportDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/BugReportDecoder.kt new file mode 100644 index 00000000..e07868cd --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/BugReportDecoder.kt @@ -0,0 +1,34 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.user.BugReport +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class BugReportDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.BUG_REPORT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): BugReport { + val description = buffer.gjstr() + val type = buffer.g1Alt3() + val instructions = buffer.gjstr() + check(description.length <= 500) { + "Bug report description length cannot exceed 500 characters." + } + check(instructions.length <= 500) { + "Bug report instructions length cannot exceed 500 characters." + } + return BugReport( + type, + description, + instructions, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/ClickWorldMapDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/ClickWorldMapDecoder.kt new file mode 100644 index 00000000..70e04eab --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/ClickWorldMapDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.common.CoordGrid +import net.rsprox.protocol.game.incoming.model.misc.user.ClickWorldMap +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class ClickWorldMapDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.CLICKWORLDMAP + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ClickWorldMap { + val packed = buffer.g4Alt2() + return ClickWorldMap(CoordGrid(packed)) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/ClientCheatDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/ClientCheatDecoder.kt new file mode 100644 index 00000000..d6930cfa --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/ClientCheatDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.user.ClientCheat +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class ClientCheatDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.CLIENT_CHEAT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ClientCheat { + val command = buffer.gjstr() + return ClientCheat(command) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/CloseModalDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/CloseModalDecoder.kt new file mode 100644 index 00000000..8533892f --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/CloseModalDecoder.kt @@ -0,0 +1,19 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.user.CloseModal +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class CloseModalDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.CLOSE_MODAL + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CloseModal = CloseModal +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/HiscoreRequestDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/HiscoreRequestDecoder.kt new file mode 100644 index 00000000..35832adf --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/HiscoreRequestDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.user.HiscoreRequest +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class HiscoreRequestDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.HISCORE_REQUEST + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): HiscoreRequest { + val requestId = buffer.g1() + val type = buffer.g1() + val name = buffer.gjstr() + return HiscoreRequest( + type, + requestId, + name, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/IfCrmViewClickDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/IfCrmViewClickDecoder.kt new file mode 100644 index 00000000..5459c555 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/IfCrmViewClickDecoder.kt @@ -0,0 +1,33 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt3 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.user.IfCrmViewClick +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class IfCrmViewClickDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.IF_CRMVIEW_CLICK + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfCrmViewClick { + val behaviour1 = buffer.g4Alt3() + val sub = buffer.g2Alt2() + val combinedId = buffer.gCombinedIdAlt3() + val behaviour3 = buffer.g4Alt2() + val behaviour2 = buffer.g4Alt3() + val serverTarget = buffer.g4Alt2() + return IfCrmViewClick( + serverTarget, + combinedId, + sub, + behaviour1, + behaviour2, + behaviour3, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/MoveGameClickDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/MoveGameClickDecoder.kt new file mode 100644 index 00000000..5005185e --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/MoveGameClickDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.user.MoveGameClick +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class MoveGameClickDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.MOVE_GAMECLICK + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MoveGameClick { + val z = buffer.g2Alt2() + val x = buffer.g2Alt3() + val keyCombination = buffer.g1() + return MoveGameClick( + x, + z, + keyCombination, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/MoveMinimapClickDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/MoveMinimapClickDecoder.kt new file mode 100644 index 00000000..cc8c0d63 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/MoveMinimapClickDecoder.kt @@ -0,0 +1,59 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.user.MoveMinimapClick +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class MoveMinimapClickDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.MOVE_MINIMAPCLICK + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MoveMinimapClick { + // The x, z and keyCombination get scrambled between revisions + val z = buffer.g2Alt2() + val x = buffer.g2Alt3() + val keyCombination = buffer.g1() + + // The arguments below are consistent across revisions + val minimapWidth = buffer.g1() + val minimapHeight = buffer.g1() + val cameraAngleY = buffer.g2() + val checkpoint1 = buffer.g1() + check(checkpoint1 == 57) { + "Invalid checkpoint 1: $checkpoint1" + } + val checkpoint2 = buffer.g1() + check(checkpoint2 == 0) { + "Invalid checkpoint 2: $checkpoint2" + } + val checkpoint3 = buffer.g1() + check(checkpoint3 == 0) { + "Invalid checkpoint 3: $checkpoint3" + } + val checkpoint4 = buffer.g1() + check(checkpoint4 == 89) { + "Invalid checkpoint 4: $checkpoint4" + } + val fineX = buffer.g2() + val fineZ = buffer.g2() + val checkpoint5 = buffer.g1() + check(checkpoint5 == 63) { + "Invalid checkpoint 5: $checkpoint5" + } + return MoveMinimapClick( + x, + z, + keyCombination, + minimapWidth, + minimapHeight, + cameraAngleY, + fineX, + fineZ, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/OculusLeaveDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/OculusLeaveDecoder.kt new file mode 100644 index 00000000..700cc821 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/OculusLeaveDecoder.kt @@ -0,0 +1,19 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.user.OculusLeave +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class OculusLeaveDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OCULUS_LEAVE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OculusLeave = OculusLeave +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SendSnapshotDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SendSnapshotDecoder.kt new file mode 100644 index 00000000..a8e86c80 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SendSnapshotDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.user.SendSnapshot +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class SendSnapshotDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.SEND_SNAPSHOT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): SendSnapshot { + val name = buffer.gjstr() + val ruleId = buffer.g1() + val mute = buffer.g1() == 1 + return SendSnapshot( + name, + ruleId, + mute, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SetChatFilterSettingsDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SetChatFilterSettingsDecoder.kt new file mode 100644 index 00000000..5da56584 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SetChatFilterSettingsDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.user.SetChatFilterSettings +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class SetChatFilterSettingsDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.SET_CHATFILTERSETTINGS + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): SetChatFilterSettings { + val publicChatFilter = buffer.g1() + val privateChatFilter = buffer.g1() + val tradeChatFilter = buffer.g1() + return SetChatFilterSettings( + publicChatFilter, + privateChatFilter, + tradeChatFilter, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SetHeadingDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SetHeadingDecoder.kt new file mode 100644 index 00000000..420a673d --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SetHeadingDecoder.kt @@ -0,0 +1,20 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.user.SetHeading +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class SetHeadingDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.SET_HEADING + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): SetHeading { + val heading = buffer.g1Alt1() + return SetHeading(heading) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/TeleportDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/TeleportDecoder.kt new file mode 100644 index 00000000..1bf92098 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/TeleportDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.misc.user.Teleport +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class TeleportDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.TELEPORT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): Teleport { + val oculusSyncValue = buffer.g4Alt2() + val x = buffer.g2Alt2() + val z = buffer.g2Alt2() + val level = buffer.g1Alt2() + return Teleport( + oculusSyncValue, + x, + z, + level, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc1Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc1Decoder.kt new file mode 100644 index 00000000..58f52ce1 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc1Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.npcs.OpNpc +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpNpc1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPNPC1 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpNpc { + val controlKey = buffer.g1() == 1 + val index = buffer.g2Alt1() + return OpNpc( + index, + controlKey, + 1, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc2Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc2Decoder.kt new file mode 100644 index 00000000..d89a07a0 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc2Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.npcs.OpNpc +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpNpc2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPNPC2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpNpc { + val index = buffer.g2() + val controlKey = buffer.g1Alt2() == 1 + return OpNpc( + index, + controlKey, + 2, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc3Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc3Decoder.kt new file mode 100644 index 00000000..9f6a2576 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc3Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.npcs.OpNpc +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpNpc3Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPNPC3 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpNpc { + val index = buffer.g2Alt1() + val controlKey = buffer.g1Alt2() == 1 + return OpNpc( + index, + controlKey, + 3, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc4Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc4Decoder.kt new file mode 100644 index 00000000..43894658 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc4Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.npcs.OpNpc +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpNpc4Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPNPC4 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpNpc { + val index = buffer.g2() + val controlKey = buffer.g1Alt1() == 1 + return OpNpc( + index, + controlKey, + 4, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc5Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc5Decoder.kt new file mode 100644 index 00000000..cdb0323e --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc5Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.npcs.OpNpc +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpNpc5Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPNPC5 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpNpc { + val index = buffer.g2Alt1() + val controlKey = buffer.g1Alt1() == 1 + return OpNpc( + index, + controlKey, + 5, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc6Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc6Decoder.kt new file mode 100644 index 00000000..b882c04c --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc6Decoder.kt @@ -0,0 +1,20 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.npcs.OpNpc6 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpNpc6Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPNPC6 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpNpc6 { + val id = buffer.g2Alt3() + return OpNpc6(id) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpcTDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpcTDecoder.kt new file mode 100644 index 00000000..99247c94 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpcTDecoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt1 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.npcs.OpNpcT +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpNpcTDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPNPCT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpNpcT { + val controlKey = buffer.g1Alt1() == 1 + val selectedCombinedId = buffer.gCombinedIdAlt1() + val selectedSub = buffer.g2Alt3() + val selectedObj = buffer.g2() + val index = buffer.g2Alt1() + return OpNpcT( + index, + controlKey, + selectedCombinedId, + selectedSub, + selectedObj, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj1Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj1Decoder.kt new file mode 100644 index 00000000..4313f341 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj1Decoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.objs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.objs.OpObj +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpObj1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPOBJ1 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpObj { + val z = buffer.g2() + val controlKey = buffer.g1Alt3() == 1 + val x = buffer.g2Alt3() + val id = buffer.g2Alt2() + return OpObj( + id, + x, + z, + controlKey, + 1, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj2Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj2Decoder.kt new file mode 100644 index 00000000..8e911cdb --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj2Decoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.objs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.objs.OpObj +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpObj2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPOBJ2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpObj { + val z = buffer.g2Alt2() + val id = buffer.g2Alt3() + val x = buffer.g2() + val controlKey = buffer.g1() == 1 + return OpObj( + id, + x, + z, + controlKey, + 2, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj3Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj3Decoder.kt new file mode 100644 index 00000000..ea863bd5 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj3Decoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.objs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.objs.OpObj +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpObj3Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPOBJ3 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpObj { + val controlKey = buffer.g1Alt2() == 1 + val x = buffer.g2Alt2() + val z = buffer.g2Alt2() + val id = buffer.g2Alt3() + return OpObj( + id, + x, + z, + controlKey, + 3, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj4Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj4Decoder.kt new file mode 100644 index 00000000..679ccd1c --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj4Decoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.objs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.objs.OpObj +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpObj4Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPOBJ4 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpObj { + val z = buffer.g2Alt3() + val x = buffer.g2Alt2() + val id = buffer.g2() + val controlKey = buffer.g1Alt2() == 1 + return OpObj( + id, + x, + z, + controlKey, + 4, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj5Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj5Decoder.kt new file mode 100644 index 00000000..e90858b0 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj5Decoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.objs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.objs.OpObj +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpObj5Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPOBJ5 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpObj { + val z = buffer.g2Alt2() + val id = buffer.g2() + val x = buffer.g2() + val controlKey = buffer.g1Alt1() == 1 + return OpObj( + id, + x, + z, + controlKey, + 5, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj6Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj6Decoder.kt new file mode 100644 index 00000000..49cb3313 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj6Decoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.objs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.objs.OpObj6 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpObj6Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPOBJ6 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpObj6 { + val x = buffer.g2Alt3() + val id = buffer.g2() + val z = buffer.g2() + return OpObj6( + id, + x, + z, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObjTDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObjTDecoder.kt new file mode 100644 index 00000000..3eb13f05 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObjTDecoder.kt @@ -0,0 +1,35 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.objs + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt1 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.objs.OpObjT +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpObjTDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPOBJT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpObjT { + val x = buffer.g2Alt3() + val controlKey = buffer.g1Alt3() == 1 + val z = buffer.g2Alt2() + val selectedSub = buffer.g2Alt3() + val selectedCombinedId = buffer.gCombinedIdAlt1() + val id = buffer.g2() + val selectedObj = buffer.g2() + return OpObjT( + id, + x, + z, + controlKey, + selectedCombinedId, + selectedSub, + selectedObj, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer1Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer1Decoder.kt new file mode 100644 index 00000000..0b2a4e94 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer1Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.players + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.players.OpPlayer +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpPlayer1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPPLAYER1 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpPlayer { + val controlKey = buffer.g1Alt2() == 1 + val index = buffer.g2Alt3() + return OpPlayer( + index, + controlKey, + 1, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer2Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer2Decoder.kt new file mode 100644 index 00000000..2b58eae0 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer2Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.players + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.players.OpPlayer +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpPlayer2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPPLAYER2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpPlayer { + val index = buffer.g2() + val controlKey = buffer.g1Alt2() == 1 + return OpPlayer( + index, + controlKey, + 2, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer3Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer3Decoder.kt new file mode 100644 index 00000000..f9e713c3 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer3Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.players + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.players.OpPlayer +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpPlayer3Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPPLAYER3 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpPlayer { + val controlKey = buffer.g1Alt3() == 1 + val index = buffer.g2() + return OpPlayer( + index, + controlKey, + 3, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer4Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer4Decoder.kt new file mode 100644 index 00000000..ba28f63a --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer4Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.players + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.players.OpPlayer +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpPlayer4Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPPLAYER4 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpPlayer { + val index = buffer.g2Alt2() + val controlKey = buffer.g1() == 1 + return OpPlayer( + index, + controlKey, + 4, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer5Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer5Decoder.kt new file mode 100644 index 00000000..8280a032 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer5Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.players + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.players.OpPlayer +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpPlayer5Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPPLAYER5 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpPlayer { + val index = buffer.g2Alt1() + val controlKey = buffer.g1() == 1 + return OpPlayer( + index, + controlKey, + 5, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer6Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer6Decoder.kt new file mode 100644 index 00000000..95c7a249 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer6Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.players + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.players.OpPlayer +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpPlayer6Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPPLAYER6 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpPlayer { + val index = buffer.g2Alt3() + val controlKey = buffer.g1Alt2() == 1 + return OpPlayer( + index, + controlKey, + 6, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer7Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer7Decoder.kt new file mode 100644 index 00000000..a6cfdea5 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer7Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.players + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.players.OpPlayer +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpPlayer7Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPPLAYER7 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpPlayer { + val controlKey = buffer.g1Alt3() == 1 + val index = buffer.g2() + return OpPlayer( + index, + controlKey, + 7, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer8Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer8Decoder.kt new file mode 100644 index 00000000..e863e78e --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer8Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.players + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.players.OpPlayer +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpPlayer8Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPPLAYER8 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpPlayer { + val controlKey = buffer.g1Alt2() == 1 + val index = buffer.g2() + return OpPlayer( + index, + controlKey, + 8, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayerTDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayerTDecoder.kt new file mode 100644 index 00000000..f701768f --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayerTDecoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.players + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt2 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.players.OpPlayerT +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class OpPlayerTDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPPLAYERT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpPlayerT { + val selectedSub = buffer.g2() + val selectedCombinedId = buffer.gCombinedIdAlt2() + val selectedObj = buffer.g2Alt3() + val controlKey = buffer.g1() == 1 + val index = buffer.g2() + return OpPlayerT( + index, + controlKey, + selectedCombinedId, + selectedSub, + selectedObj, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePCountDialogDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePCountDialogDecoder.kt new file mode 100644 index 00000000..04a119b9 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePCountDialogDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.resumed + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.resumed.ResumePCountDialog +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class ResumePCountDialogDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.RESUME_P_COUNTDIALOG + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ResumePCountDialog { + val count = buffer.g4() + return ResumePCountDialog(count) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePNameDialogDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePNameDialogDecoder.kt new file mode 100644 index 00000000..47e07617 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePNameDialogDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.resumed + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.resumed.ResumePNameDialog +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class ResumePNameDialogDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.RESUME_P_NAMEDIALOG + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ResumePNameDialog { + val name = buffer.gjstr() + return ResumePNameDialog(name) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePObjDialogDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePObjDialogDecoder.kt new file mode 100644 index 00000000..3810ac34 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePObjDialogDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.resumed + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.resumed.ResumePObjDialog +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class ResumePObjDialogDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.RESUME_P_OBJDIALOG + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ResumePObjDialog { + val obj = buffer.g2() + return ResumePObjDialog(obj) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePStringDialogDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePStringDialogDecoder.kt new file mode 100644 index 00000000..c07e627f --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePStringDialogDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.resumed + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.resumed.ResumePStringDialog +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class ResumePStringDialogDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.RESUME_P_STRINGDIALOG + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ResumePStringDialog { + val string = buffer.gjstr() + return ResumePStringDialog(string) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePauseButtonDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePauseButtonDecoder.kt new file mode 100644 index 00000000..f242061b --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePauseButtonDecoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.resumed + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt2 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.resumed.ResumePauseButton +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +internal class ResumePauseButtonDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.RESUME_PAUSEBUTTON + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ResumePauseButton { + val sub = buffer.g2Alt2() + val combinedId = buffer.gCombinedIdAlt2() + return ResumePauseButton( + combinedId, + sub, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/FriendListAddDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/FriendListAddDecoder.kt new file mode 100644 index 00000000..01544e57 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/FriendListAddDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.social + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.social.FriendListAdd +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class FriendListAddDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.FRIENDLIST_ADD + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): FriendListAdd { + val name = buffer.gjstr() + return FriendListAdd(name) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/FriendListDelDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/FriendListDelDecoder.kt new file mode 100644 index 00000000..63d97e9d --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/FriendListDelDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.social + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.social.FriendListDel +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class FriendListDelDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.FRIENDLIST_DEL + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): FriendListDel { + val name = buffer.gjstr() + return FriendListDel(name) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/IgnoreListAddDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/IgnoreListAddDecoder.kt new file mode 100644 index 00000000..7f86f03a --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/IgnoreListAddDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.social + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.social.IgnoreListAdd +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class IgnoreListAddDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.IGNORELIST_ADD + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IgnoreListAdd { + val name = buffer.gjstr() + return IgnoreListAdd(name) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/IgnoreListDelDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/IgnoreListDelDecoder.kt new file mode 100644 index 00000000..00dc458d --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/IgnoreListDelDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.codec.social + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.social.IgnoreListDel +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt + +@Consistent +internal class IgnoreListDelDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.IGNORELIST_DEL + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IgnoreListDel { + val name = buffer.gjstr() + return IgnoreListDel(name) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt new file mode 100644 index 00000000..2bd59090 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt @@ -0,0 +1,210 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.prot + +import net.rsprot.compression.HuffmanCodec +import net.rsprot.protocol.ProtRepository +import net.rsprox.protocol.MessageDecoderRepository +import net.rsprox.protocol.MessageDecoderRepositoryBuilder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons.If1ButtonDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons.If3ButtonDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons.IfButtonDDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons.IfButtonTDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons.IfSubOpDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.clan.AffinedClanSettingsAddBannedFromChannelDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.clan.AffinedClanSettingsSetMutedFromChannelDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.clan.ClanChannelFullRequestDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.clan.ClanChannelKickUserDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.clan.ClanSettingsFullRequestDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.events.EventAppletFocusDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.events.EventCameraPositionDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.events.EventKeyboardDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.events.EventMouseClickDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.events.EventMouseMoveDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.events.EventMouseScrollDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.events.EventNativeMouseClickDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.events.EventNativeMouseMoveDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.friendchat.FriendChatJoinLeaveDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.friendchat.FriendChatKickDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.friendchat.FriendChatSetRankDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.locs.OpLoc1Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.locs.OpLoc2Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.locs.OpLoc3Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.locs.OpLoc4Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.locs.OpLoc5Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.locs.OpLoc6Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.locs.OpLocTDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.messaging.MessagePrivateDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.messaging.MessagePublicDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client.ConnectionTelemetryDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client.DetectModifiedClientDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client.IdleDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client.MapBuildCompleteDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client.MembershipPromotionEligibilityDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client.NoTimeoutDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client.ReflectionCheckReplyDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client.SendPingReplyDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client.SoundJingleEndDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client.WindowStatusDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user.BugReportDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user.ClickWorldMapDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user.ClientCheatDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user.CloseModalDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user.HiscoreRequestDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user.IfCrmViewClickDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user.MoveGameClickDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user.MoveMinimapClickDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user.OculusLeaveDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user.SendSnapshotDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user.SetChatFilterSettingsDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user.SetHeadingDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user.TeleportDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs.OpNpc1Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs.OpNpc2Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs.OpNpc3Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs.OpNpc4Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs.OpNpc5Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs.OpNpc6Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs.OpNpcTDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.objs.OpObj1Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.objs.OpObj2Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.objs.OpObj3Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.objs.OpObj4Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.objs.OpObj5Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.objs.OpObj6Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.objs.OpObjTDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.players.OpPlayer1Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.players.OpPlayer2Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.players.OpPlayer3Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.players.OpPlayer4Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.players.OpPlayer5Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.players.OpPlayer6Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.players.OpPlayer7Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.players.OpPlayer8Decoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.players.OpPlayerTDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.resumed.ResumePCountDialogDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.resumed.ResumePNameDialogDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.resumed.ResumePObjDialogDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.resumed.ResumePStringDialogDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.resumed.ResumePauseButtonDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.social.FriendListAddDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.social.FriendListDelDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.social.IgnoreListAddDecoder +import net.rsprox.protocol.v228.game.incoming.decoder.codec.social.IgnoreListDelDecoder + +internal object ClientMessageDecoderRepository { + @ExperimentalStdlibApi + fun build(huffmanCodec: HuffmanCodec): MessageDecoderRepository { + val protRepository = ProtRepository.of() + val builder = + MessageDecoderRepositoryBuilder( + protRepository, + ).apply { + bind(If1ButtonDecoder()) + bind(If3ButtonDecoder(GameClientProt.IF_BUTTON1, 1)) + bind(If3ButtonDecoder(GameClientProt.IF_BUTTON2, 2)) + bind(If3ButtonDecoder(GameClientProt.IF_BUTTON3, 3)) + bind(If3ButtonDecoder(GameClientProt.IF_BUTTON4, 4)) + bind(If3ButtonDecoder(GameClientProt.IF_BUTTON5, 5)) + bind(If3ButtonDecoder(GameClientProt.IF_BUTTON6, 6)) + bind(If3ButtonDecoder(GameClientProt.IF_BUTTON7, 7)) + bind(If3ButtonDecoder(GameClientProt.IF_BUTTON8, 8)) + bind(If3ButtonDecoder(GameClientProt.IF_BUTTON9, 9)) + bind(If3ButtonDecoder(GameClientProt.IF_BUTTON10, 10)) + bind(IfSubOpDecoder()) + bind(IfButtonDDecoder()) + bind(IfButtonTDecoder()) + + bind(OpNpc1Decoder()) + bind(OpNpc2Decoder()) + bind(OpNpc3Decoder()) + bind(OpNpc4Decoder()) + bind(OpNpc5Decoder()) + bind(OpNpc6Decoder()) + bind(OpNpcTDecoder()) + + bind(OpLoc1Decoder()) + bind(OpLoc2Decoder()) + bind(OpLoc3Decoder()) + bind(OpLoc4Decoder()) + bind(OpLoc5Decoder()) + bind(OpLoc6Decoder()) + bind(OpLocTDecoder()) + + bind(OpObj1Decoder()) + bind(OpObj2Decoder()) + bind(OpObj3Decoder()) + bind(OpObj4Decoder()) + bind(OpObj5Decoder()) + bind(OpObj6Decoder()) + bind(OpObjTDecoder()) + + bind(OpPlayer1Decoder()) + bind(OpPlayer2Decoder()) + bind(OpPlayer3Decoder()) + bind(OpPlayer4Decoder()) + bind(OpPlayer5Decoder()) + bind(OpPlayer6Decoder()) + bind(OpPlayer7Decoder()) + bind(OpPlayer8Decoder()) + bind(OpPlayerTDecoder()) + + bind(EventAppletFocusDecoder()) + bind(EventCameraPositionDecoder()) + bind(EventKeyboardDecoder()) + bind(EventMouseScrollDecoder()) + bind(EventMouseMoveDecoder()) + bind(EventNativeMouseMoveDecoder()) + bind(EventMouseClickDecoder()) + bind(EventNativeMouseClickDecoder()) + + bind(ResumePauseButtonDecoder()) + bind(ResumePNameDialogDecoder()) + bind(ResumePStringDialogDecoder()) + bind(ResumePCountDialogDecoder()) + bind(ResumePObjDialogDecoder()) + + bind(FriendChatKickDecoder()) + bind(FriendChatSetRankDecoder()) + bind(FriendChatJoinLeaveDecoder()) + + bind(ClanChannelFullRequestDecoder()) + bind(ClanSettingsFullRequestDecoder()) + bind(ClanChannelKickUserDecoder()) + bind(AffinedClanSettingsAddBannedFromChannelDecoder()) + bind(AffinedClanSettingsSetMutedFromChannelDecoder()) + + bind(FriendListAddDecoder()) + bind(FriendListDelDecoder()) + bind(IgnoreListAddDecoder()) + bind(IgnoreListDelDecoder()) + + bind(MessagePublicDecoder(huffmanCodec)) + bind(MessagePrivateDecoder(huffmanCodec)) + + bind(MoveGameClickDecoder()) + bind(MoveMinimapClickDecoder()) + bind(ClientCheatDecoder()) + bind(SetChatFilterSettingsDecoder()) + bind(SetHeadingDecoder()) + bind(ClickWorldMapDecoder()) + bind(OculusLeaveDecoder()) + bind(CloseModalDecoder()) + bind(TeleportDecoder()) + bind(BugReportDecoder()) + bind(SendSnapshotDecoder()) + bind(HiscoreRequestDecoder()) + bind(IfCrmViewClickDecoder()) + + bind(ConnectionTelemetryDecoder()) + bind(SendPingReplyDecoder()) + bind(DetectModifiedClientDecoder()) + bind(ReflectionCheckReplyDecoder()) + bind(NoTimeoutDecoder()) + bind(IdleDecoder()) + bind(MapBuildCompleteDecoder()) + bind(MembershipPromotionEligibilityDecoder()) + bind(SoundJingleEndDecoder()) + bind(WindowStatusDecoder()) + } + return builder.build() + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/prot/GameClientProt.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/prot/GameClientProt.kt new file mode 100644 index 00000000..3613866c --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/prot/GameClientProt.kt @@ -0,0 +1,162 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.prot + +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.Prot + +public enum class GameClientProt( + override val opcode: Int, + override val size: Int, +) : ClientProt { + // If buttons + IF_BUTTON(GameClientProtId.IF_BUTTON, 4), + IF_BUTTON1(GameClientProtId.IF_BUTTON1, 8), + IF_BUTTON2(GameClientProtId.IF_BUTTON2, 8), + IF_BUTTON3(GameClientProtId.IF_BUTTON3, 8), + IF_BUTTON4(GameClientProtId.IF_BUTTON4, 8), + IF_BUTTON5(GameClientProtId.IF_BUTTON5, 8), + IF_BUTTON6(GameClientProtId.IF_BUTTON6, 8), + IF_BUTTON7(GameClientProtId.IF_BUTTON7, 8), + IF_BUTTON8(GameClientProtId.IF_BUTTON8, 8), + IF_BUTTON9(GameClientProtId.IF_BUTTON9, 8), + IF_BUTTON10(GameClientProtId.IF_BUTTON10, 8), + IF_SUBOP(GameClientProtId.IF_SUBOP, 10), + IF_BUTTOND(GameClientProtId.IF_BUTTOND, 16), + IF_BUTTONT(GameClientProtId.IF_BUTTONT, 16), + + // Op npc + OPNPC1(GameClientProtId.OPNPC1, 3), + OPNPC2(GameClientProtId.OPNPC2, 3), + OPNPC3(GameClientProtId.OPNPC3, 3), + OPNPC4(GameClientProtId.OPNPC4, 3), + OPNPC5(GameClientProtId.OPNPC5, 3), + OPNPC6(GameClientProtId.OPNPC6, 2), + OPNPCT(GameClientProtId.OPNPCT, 11), + + @Deprecated( + "Deprecated since inventory rework in revision 204, " + + "use all usages go through OPNPCT now.", + replaceWith = ReplaceWith("OPNPCT"), + ) + OPNPCU(GameClientProtId.OPNPCU, 11), + + // Op loc + OPLOC1(GameClientProtId.OPLOC1, 7), + OPLOC2(GameClientProtId.OPLOC2, 7), + OPLOC3(GameClientProtId.OPLOC3, 7), + OPLOC4(GameClientProtId.OPLOC4, 7), + OPLOC5(GameClientProtId.OPLOC5, 7), + OPLOC6(GameClientProtId.OPLOC6, 2), + OPLOCT(GameClientProtId.OPLOCT, 15), + + @Deprecated( + "Deprecated since inventory rework in revision 204, " + + "use all usages go through OPLOCT now.", + replaceWith = ReplaceWith("OPLOCT"), + ) + OPLOCU(GameClientProtId.OPLOCU, 15), + + // Op obj + OPOBJ1(GameClientProtId.OPOBJ1, 7), + OPOBJ2(GameClientProtId.OPOBJ2, 7), + OPOBJ3(GameClientProtId.OPOBJ3, 7), + OPOBJ4(GameClientProtId.OPOBJ4, 7), + OPOBJ5(GameClientProtId.OPOBJ5, 7), + OPOBJ6(GameClientProtId.OPOBJ6, 6), + OPOBJT(GameClientProtId.OPOBJT, 15), + + @Deprecated( + "Deprecated since inventory rework in revision 204, " + + "use all usages go through OPOBJT now.", + replaceWith = ReplaceWith("OPOBJT"), + ) + OPOBJU(GameClientProtId.OPOBJU, 15), + + // Op player + OPPLAYER1(GameClientProtId.OPPLAYER1, 3), + OPPLAYER2(GameClientProtId.OPPLAYER2, 3), + OPPLAYER3(GameClientProtId.OPPLAYER3, 3), + OPPLAYER4(GameClientProtId.OPPLAYER4, 3), + OPPLAYER5(GameClientProtId.OPPLAYER5, 3), + OPPLAYER6(GameClientProtId.OPPLAYER6, 3), + OPPLAYER7(GameClientProtId.OPPLAYER7, 3), + OPPLAYER8(GameClientProtId.OPPLAYER8, 3), + OPPLAYERT(GameClientProtId.OPPLAYERT, 11), + + @Deprecated( + "Deprecated since inventory rework in revision 204, " + + "use all usages go through OPPLAYERT now.", + replaceWith = ReplaceWith("OPPLAYERT"), + ) + OPPLAYERU(GameClientProtId.OPPLAYERU, 11), + + // Events + EVENT_APPLET_FOCUS(GameClientProtId.EVENT_APPLET_FOCUS, 1), + EVENT_CAMERA_POSITION(GameClientProtId.EVENT_CAMERA_POSITION, 4), + EVENT_KEYBOARD(GameClientProtId.EVENT_KEYBOARD, Prot.VAR_SHORT), + EVENT_MOUSE_SCROLL(GameClientProtId.EVENT_MOUSE_SCROLL, 2), + EVENT_MOUSE_MOVE(GameClientProtId.EVENT_MOUSE_MOVE, Prot.VAR_BYTE), + EVENT_NATIVE_MOUSE_MOVE(GameClientProtId.EVENT_NATIVE_MOUSE_MOVE, Prot.VAR_BYTE), + EVENT_MOUSE_CLICK(GameClientProtId.EVENT_MOUSE_CLICK, 6), + EVENT_NATIVE_MOUSE_CLICK(GameClientProtId.EVENT_NATIVE_MOUSE_CLICK, 7), + + // Resume events + RESUME_PAUSEBUTTON(GameClientProtId.RESUME_PAUSEBUTTON, 6), + RESUME_P_NAMEDIALOG(GameClientProtId.RESUME_P_NAMEDIALOG, Prot.VAR_BYTE), + RESUME_P_STRINGDIALOG(GameClientProtId.RESUME_P_STRINGDIALOG, Prot.VAR_BYTE), + RESUME_P_COUNTDIALOG(GameClientProtId.RESUME_P_COUNTDIALOG, 4), + RESUME_P_OBJDIALOG(GameClientProtId.RESUME_P_OBJDIALOG, 2), + + // Friend chat packets + FRIENDCHAT_KICK(GameClientProtId.FRIENDCHAT_KICK, Prot.VAR_BYTE), + FRIENDCHAT_SETRANK(GameClientProtId.FRIENDCHAT_SETRANK, Prot.VAR_BYTE), + FRIENDCHAT_JOIN_LEAVE(GameClientProtId.FRIENDCHAT_JOIN_LEAVE, Prot.VAR_BYTE), + + // Clan packets + CLANCHANNEL_FULL_REQUEST(GameClientProtId.CLANCHANNEL_FULL_REQUEST, 1), + CLANSETTINGS_FULL_REQUEST(GameClientProtId.CLANSETTINGS_FULL_REQUEST, 1), + CLANCHANNEL_KICKUSER(GameClientProtId.CLANCHANNEL_KICKUSER, Prot.VAR_BYTE), + AFFINEDCLANSETTINGS_ADDBANNED_FROMCHANNEL( + GameClientProtId.AFFINEDCLANSETTINGS_ADDBANNED_FROMCHANNEL, + Prot.VAR_BYTE, + ), + AFFINEDCLANSETTINGS_SETMUTED_FROMCHANNEL(GameClientProtId.AFFINEDCLANSETTINGS_SETMUTED_FROMCHANNEL, Prot.VAR_BYTE), + + // Socials + FRIENDLIST_ADD(GameClientProtId.FRIENDLIST_ADD, Prot.VAR_BYTE), + FRIENDLIST_DEL(GameClientProtId.FRIENDLIST_DEL, Prot.VAR_BYTE), + IGNORELIST_ADD(GameClientProtId.IGNORELIST_ADD, Prot.VAR_BYTE), + IGNORELIST_DEL(GameClientProtId.IGNORELIST_DEL, Prot.VAR_BYTE), + + // Messaging + MESSAGE_PUBLIC(GameClientProtId.MESSAGE_PUBLIC, Prot.VAR_BYTE), + MESSAGE_PRIVATE(GameClientProtId.MESSAGE_PRIVATE, Prot.VAR_SHORT), + + // Misc. user packets + MOVE_GAMECLICK(GameClientProtId.MOVE_GAMECLICK, Prot.VAR_BYTE), + MOVE_MINIMAPCLICK(GameClientProtId.MOVE_MINIMAPCLICK, Prot.VAR_BYTE), + CLIENT_CHEAT(GameClientProtId.CLIENT_CHEAT, Prot.VAR_BYTE), + SET_CHATFILTERSETTINGS(GameClientProtId.SET_CHATFILTERSETTINGS, 3), + CLICKWORLDMAP(GameClientProtId.CLICKWORLDMAP, 4), + OCULUS_LEAVE(GameClientProtId.OCULUS_LEAVE, 0), + CLOSE_MODAL(GameClientProtId.CLOSE_MODAL, 0), + TELEPORT(GameClientProtId.TELEPORT, 9), + BUG_REPORT(GameClientProtId.BUG_REPORT, Prot.VAR_SHORT), + SEND_SNAPSHOT(GameClientProtId.SEND_SNAPSHOT, Prot.VAR_BYTE), + HISCORE_REQUEST(GameClientProtId.HISCORE_REQUEST, Prot.VAR_BYTE), + IF_CRMVIEW_CLICK(GameClientProtId.IF_CRMVIEW_CLICK, 22), + UPDATE_PLAYER_MODEL_V2(GameClientProtId.UPDATE_PLAYER_MODEL_V2, 26), + + // Misc. client packets + CONNECTION_TELEMETRY(GameClientProtId.CONNECTION_TELEMETRY, Prot.VAR_BYTE), + SEND_PING_REPLY(GameClientProtId.SEND_PING_REPLY, 10), + DETECT_MODIFIED_CLIENT(GameClientProtId.DETECT_MODIFIED_CLIENT, 4), + REFLECTION_CHECK_REPLY(GameClientProtId.REFLECTION_CHECK_REPLY, Prot.VAR_BYTE), + NO_TIMEOUT(GameClientProtId.NO_TIMEOUT, 0), + IDLE(GameClientProtId.IDLE, 0), + MAP_BUILD_COMPLETE(GameClientProtId.MAP_BUILD_COMPLETE, 0), + MEMBERSHIP_PROMOTION_ELIGIBILITY(GameClientProtId.MEMBERSHIP_PROMOTION_ELIGIBILITY, 2), + SOUND_JINGLEEND(GameClientProtId.SOUND_JINGLEEND, 4), + WINDOW_STATUS(GameClientProtId.WINDOW_STATUS, 5), + SET_HEADING(GameClientProtId.SET_HEADING, 1), + UNKNOWN_BYTE(GameClientProtId.UNKNOWN_BYTE, 1), +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/prot/GameClientProtId.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/prot/GameClientProtId.kt new file mode 100644 index 00000000..8e12f213 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/prot/GameClientProtId.kt @@ -0,0 +1,104 @@ +package net.rsprox.protocol.v228.game.incoming.decoder.prot + +internal object GameClientProtId { + const val OPOBJ6 = 0 + const val FRIENDCHAT_SETRANK = 1 + const val RESUME_P_COUNTDIALOG = 2 + const val OPNPC6 = 3 + const val OPLOC6 = 4 + const val CLANCHANNEL_KICKUSER = 5 + const val EVENT_NATIVE_MOUSE_MOVE = 6 + const val EVENT_APPLET_FOCUS = 7 + const val FRIENDCHAT_JOIN_LEAVE = 8 + const val OPPLAYER4 = 9 + const val RESUME_P_NAMEDIALOG = 10 + const val IF_BUTTONT = 11 + const val OPNPC4 = 12 + const val CLOSE_MODAL = 13 + const val IF_BUTTOND = 14 + const val CLANCHANNEL_FULL_REQUEST = 15 + const val UNKNOWN_BYTE = 16 + const val IGNORELIST_DEL = 17 + const val BUG_REPORT = 18 + const val IF_BUTTON4 = 19 + const val CLICKWORLDMAP = 20 + const val IF_BUTTON6 = 21 + const val OPOBJ1 = 22 + const val IF_BUTTON8 = 23 + const val AFFINEDCLANSETTINGS_ADDBANNED_FROMCHANNEL = 24 + const val OPNPCU = 25 + const val OPNPCT = 26 + const val OPNPC3 = 27 + const val MAP_BUILD_COMPLETE = 28 + const val OPOBJ4 = 29 + const val IGNORELIST_ADD = 30 + const val OPOBJU = 31 + const val WINDOW_STATUS = 32 + const val OPOBJ3 = 33 + const val RESUME_PAUSEBUTTON = 34 + const val REFLECTION_CHECK_REPLY = 35 + const val IF_BUTTON1 = 36 + const val OPPLAYER5 = 37 + const val OPOBJ2 = 38 + const val OPLOC2 = 39 + const val SEND_SNAPSHOT = 40 + const val IF_BUTTON10 = 41 + const val OPLOC5 = 42 + const val MOVE_MINIMAPCLICK = 43 + const val OPPLAYER3 = 44 + const val EVENT_CAMERA_POSITION = 45 + const val OPPLAYERT = 46 + const val MEMBERSHIP_PROMOTION_ELIGIBILITY = 47 + const val RESUME_P_STRINGDIALOG = 48 + const val OPPLAYER6 = 49 + const val SET_CHATFILTERSETTINGS = 50 + const val AFFINEDCLANSETTINGS_SETMUTED_FROMCHANNEL = 51 + const val OPLOC3 = 52 + const val OPPLAYER2 = 53 + const val OPOBJT = 54 + const val OPPLAYERU = 55 + const val RESUME_P_OBJDIALOG = 56 + const val IF_BUTTON3 = 57 + const val FRIENDCHAT_KICK = 58 + const val CLANSETTINGS_FULL_REQUEST = 59 + const val OPLOCU = 60 + const val OPNPC1 = 61 + const val IDLE = 62 + const val MESSAGE_PRIVATE = 63 + const val MESSAGE_PUBLIC = 64 + const val OPLOC4 = 65 + const val DETECT_MODIFIED_CLIENT = 66 + const val HISCORE_REQUEST = 67 + const val UPDATE_PLAYER_MODEL_V2 = 68 + const val OCULUS_LEAVE = 69 + const val IF_BUTTON = 70 + const val IF_SUBOP = 71 + const val MOVE_GAMECLICK = 72 + const val IF_BUTTON2 = 73 + const val EVENT_NATIVE_MOUSE_CLICK = 74 + const val EVENT_KEYBOARD = 75 + const val IF_BUTTON9 = 76 + const val OPPLAYER7 = 77 + const val FRIENDLIST_ADD = 78 + const val NO_TIMEOUT = 79 + const val OPOBJ5 = 80 + const val OPLOCT = 81 + const val FRIENDLIST_DEL = 82 + const val SEND_PING_REPLY = 83 + const val OPPLAYER8 = 84 + const val EVENT_MOUSE_CLICK = 85 + const val OPLOC1 = 86 + const val IF_BUTTON7 = 87 + const val CLIENT_CHEAT = 88 + const val OPPLAYER1 = 89 + const val IF_CRMVIEW_CLICK = 90 + const val EVENT_MOUSE_MOVE = 91 + const val SOUND_JINGLEEND = 92 + const val EVENT_MOUSE_SCROLL = 93 + const val OPNPC5 = 94 + const val TELEPORT = 95 + const val OPNPC2 = 96 + const val IF_BUTTON5 = 97 + const val SET_HEADING = 98 + const val CONNECTION_TELEMETRY = 99 +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamLookAtDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamLookAtDecoder.kt new file mode 100644 index 00000000..8b0d1ce1 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamLookAtDecoder.kt @@ -0,0 +1,32 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamLookAt +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class CamLookAtDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_LOOKAT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamLookAt { + val destinationXInBuildArea = buffer.g1() + val destinationZInBuildArea = buffer.g1() + val height = buffer.g2() + val speed = buffer.g1() + val acceleration = buffer.g1() + return CamLookAt( + destinationXInBuildArea, + destinationZInBuildArea, + height, + speed, + acceleration, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamLookAtEasedCoordDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamLookAtEasedCoordDecoder.kt new file mode 100644 index 00000000..99c2a696 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamLookAtEasedCoordDecoder.kt @@ -0,0 +1,32 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamLookAtEasedCoord +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class CamLookAtEasedCoordDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_LOOKAT_EASED_COORD + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamLookAtEasedCoord { + val destinationXInBuildArea = buffer.g1() + val destinationZInBuildArea = buffer.g1() + val height = buffer.g2() + val duration = buffer.g2() + val function = buffer.g1() + return CamLookAtEasedCoord( + destinationXInBuildArea, + destinationZInBuildArea, + height, + duration, + function, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamModeDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamModeDecoder.kt new file mode 100644 index 00000000..5b841a73 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamModeDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamMode +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class CamModeDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_MODE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamMode { + val mode = buffer.g1() + return CamMode( + mode, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamMoveToArcDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamMoveToArcDecoder.kt new file mode 100644 index 00000000..bfd7c929 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamMoveToArcDecoder.kt @@ -0,0 +1,38 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamMoveToArc +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class CamMoveToArcDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_MOVETO_ARC + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamMoveToArc { + val destinationXInBuildArea = buffer.g1() + val destinationZInBuildArea = buffer.g1() + val height = buffer.g2() + val centerXInBuildArea = buffer.g1() + val centerZInBuildArea = buffer.g1() + val duration = buffer.g2() + val maintainFixedAltitude = buffer.gboolean() + val function = buffer.g1() + return CamMoveToArc( + centerXInBuildArea, + centerZInBuildArea, + destinationXInBuildArea, + destinationZInBuildArea, + height, + duration, + maintainFixedAltitude, + function, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamMoveToCyclesDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamMoveToCyclesDecoder.kt new file mode 100644 index 00000000..30449b5a --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamMoveToCyclesDecoder.kt @@ -0,0 +1,34 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamMoveToCycles +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class CamMoveToCyclesDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_MOVETO_CYCLES + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamMoveToCycles { + val destinationXInBuildArea = buffer.g1() + val destinationZInBuildArea = buffer.g1() + val height = buffer.g2() + val duration = buffer.g2() + val maintainFixedAltitude = buffer.gboolean() + val function = buffer.g1() + return CamMoveToCycles( + destinationXInBuildArea, + destinationZInBuildArea, + height, + duration, + maintainFixedAltitude, + function, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamMoveToDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamMoveToDecoder.kt new file mode 100644 index 00000000..2da6df86 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamMoveToDecoder.kt @@ -0,0 +1,32 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamMoveTo +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class CamMoveToDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_MOVETO + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamMoveTo { + val destinationXInBuildArea = buffer.g1() + val destinationZInBuildArea = buffer.g1() + val height = buffer.g2() + val speed = buffer.g1() + val acceleration = buffer.g1() + return CamMoveTo( + destinationXInBuildArea, + destinationZInBuildArea, + height, + speed, + acceleration, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamResetDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamResetDecoder.kt new file mode 100644 index 00000000..f96c525d --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamResetDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamReset +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class CamResetDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_RESET + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamReset { + return CamReset + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamRotateBy.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamRotateBy.kt new file mode 100644 index 00000000..b5bc9caa --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamRotateBy.kt @@ -0,0 +1,30 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamRotateBy +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class CamRotateBy : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_ROTATEBY + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamRotateBy { + val yAngle = buffer.g2() + val xAngle = buffer.g2() + val duration = buffer.g2() + val function = buffer.g1() + return CamRotateBy( + xAngle, + yAngle, + duration, + function, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamRotateToDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamRotateToDecoder.kt new file mode 100644 index 00000000..99635883 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamRotateToDecoder.kt @@ -0,0 +1,30 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamRotateTo +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class CamRotateToDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_ROTATETO + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamRotateTo { + val yAngle = buffer.g2() + val xAngle = buffer.g2() + val duration = buffer.g2() + val function = buffer.g1() + return CamRotateTo( + xAngle, + yAngle, + duration, + function, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamShakeDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamShakeDecoder.kt new file mode 100644 index 00000000..9c471c3d --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamShakeDecoder.kt @@ -0,0 +1,30 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamShake +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class CamShakeDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_SHAKE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamShake { + val type = buffer.g1() + val randomAmount = buffer.g1() + val sineAmount = buffer.g1() + val sineFrequency = buffer.g1() + return CamShake( + type, + randomAmount, + sineAmount, + sineFrequency, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamSmoothResetDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamSmoothResetDecoder.kt new file mode 100644 index 00000000..77a1b3b8 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamSmoothResetDecoder.kt @@ -0,0 +1,30 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamSmoothReset +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class CamSmoothResetDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_SMOOTHRESET + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamSmoothReset { + val cameraMoveConstantSpeed = buffer.g1() + val cameraMoveProportionalSpeed = buffer.g1() + val cameraLookConstantSpeed = buffer.g1() + val cameraLookProportionalSpeed = buffer.g1() + return CamSmoothReset( + cameraMoveConstantSpeed, + cameraMoveProportionalSpeed, + cameraLookConstantSpeed, + cameraLookProportionalSpeed, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamTargetV2Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamTargetV2Decoder.kt new file mode 100644 index 00000000..74771cb9 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/CamTargetV2Decoder.kt @@ -0,0 +1,37 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamTargetV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class CamTargetV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_TARGET_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamTargetV2 { + val type = buffer.g1() + val index = buffer.g2() + val cameraLockedPlayerIndex = buffer.g2() + return CamTargetV2( + when (type) { + 0 -> + CamTargetV2.PlayerCamTarget(index) + 1 -> + CamTargetV2.NpcCamTarget(index) + 2 -> + CamTargetV2.WorldEntityTarget( + index, + cameraLockedPlayerIndex, + ) + else -> throw IllegalStateException("Unknown type: $type") + }, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/OculusSyncDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/OculusSyncDecoder.kt new file mode 100644 index 00000000..9549636d --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/camera/OculusSyncDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.OculusSync +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class OculusSyncDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OCULUS_SYNC + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OculusSync { + val value = buffer.g4() + return OculusSync(value) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/ClanChannelDeltaDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/ClanChannelDeltaDecoder.kt new file mode 100644 index 00000000..bc34a7a6 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/ClanChannelDeltaDecoder.kt @@ -0,0 +1,111 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.clan + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.clan.ClanChannelDelta +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class ClanChannelDeltaDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CLANCHANNEL_DELTA + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ClanChannelDelta { + val clanType = buffer.g1() + val clanHash = buffer.g8() + val updateNum = buffer.g8() + val events = + buildList { + while (buffer.isReadable) { + when (val opcode = buffer.g1()) { + 0 -> break + 1 -> { + buffer.skipRead(1) + // TODO: Should name be nullable? + val name = buffer.gjstrnull() ?: "" + val world = buffer.g2() + val rank = buffer.g1() + add( + ClanChannelDelta.ClanChannelDeltaAddUserEvent( + name, + world, + rank, + ), + ) + } + 2 -> { + val index = buffer.g2() + val rank = buffer.g1() + val world = buffer.g2() + buffer.skipRead(8) + val name = buffer.gjstr() + add( + ClanChannelDelta.ClanChannelDeltaUpdateUserDetailsEvent( + index, + name, + rank, + world, + ), + ) + } + 3 -> { + val index = buffer.g2() + buffer.skipRead(1) + buffer.skipRead(1) + add( + ClanChannelDelta.ClanChannelDeltaDeleteUserEvent( + index, + ), + ) + } + 4 -> { + val name = buffer.gjstrnull() + if (name != null) { + buffer.skipRead(1) + val talkRank = buffer.g1() + val kickRank = buffer.g1() + add( + ClanChannelDelta.ClanChannelDeltaUpdateBaseSettingsEvent( + name, + talkRank, + kickRank, + ), + ) + } else { + add(ClanChannelDelta.ClanChannelDeltaUpdateBaseSettingsEvent()) + } + } + 5 -> { + buffer.skipRead(1) + val index = buffer.g2() + val rank = buffer.g1() + val world = buffer.g2() + buffer.skipRead(8) + val name = buffer.gjstr() + buffer.skipRead(1) + add( + ClanChannelDelta.ClanChannelDeltaUpdateUserDetailsV2Event( + index, + name, + rank, + world, + ), + ) + } + else -> throw IllegalStateException("Unknown clanchannel delta update: $opcode") + } + } + } + return ClanChannelDelta( + clanType, + clanHash, + updateNum, + events, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/ClanChannelFullDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/ClanChannelFullDecoder.kt new file mode 100644 index 00000000..596775e3 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/ClanChannelFullDecoder.kt @@ -0,0 +1,89 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.clan + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.compression.Base37 +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.clan.ClanChannelFull +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class ClanChannelFullDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CLANCHANNEL_FULL + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ClanChannelFull { + val clanType = buffer.g1() + if (!buffer.isReadable) { + return ClanChannelFull( + clanType, + ClanChannelFull.ClanChannelFullLeaveUpdate, + ) + } + val flags = buffer.g1() + val version = + if (flags and ClanChannelFull.FLAG_HAS_VERSION != 0) { + buffer.g1() + } else { + ClanChannelFull.DEFAULT_OLDSCHOOL_VERSION + } + val clanHash = buffer.g8() + val updateNum = buffer.g8() + val clanName = buffer.gjstr() + val discardedBoolean = buffer.gboolean() + val kickRank = buffer.g1() + val talkRank = buffer.g1() + val memberCount = buffer.g2() + val base37 = flags and ClanChannelFull.FLAG_USE_BASE_37_NAMES != 0 + val displayNames = flags and ClanChannelFull.FLAG_USE_DISPLAY_NAMES != 0 + check(base37 || displayNames) { + "Unexpected behavior: Names not included in packet." + } + val members = + buildList { + for (i in 0..= 3) { + buffer.gboolean() + } else { + false + } + add( + ClanChannelFull.ClanMember( + checkNotNull(name), + rank, + world, + discardedMemberBoolean, + ), + ) + } + } + return ClanChannelFull( + clanType, + ClanChannelFull.ClanChannelFullJoinUpdate( + clanHash, + updateNum, + clanName, + discardedBoolean, + kickRank, + talkRank, + members, + version, + base37, + ), + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/ClanSettingsDeltaDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/ClanSettingsDeltaDecoder.kt new file mode 100644 index 00000000..cb9e512d --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/ClanSettingsDeltaDecoder.kt @@ -0,0 +1,202 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.clan + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.clan.ClanSettingsDelta +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class ClanSettingsDeltaDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CLANSETTINGS_DELTA + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ClanSettingsDelta { + val clanType = buffer.g1() + val owner = buffer.g8() + val updateNum = buffer.g4() + val updates = + buildList { + while (buffer.isReadable) { + when (val opcode = buffer.g1()) { + 0 -> break + 1 -> { + val hashOpcode = buffer.g1() + val hash = + if (hashOpcode != 0xFF) { + buffer.readerIndex(buffer.readerIndex() - 1) + buffer.g8() + } else { + -1L + } + val name = buffer.gjstrnull() + add( + ClanSettingsDelta.ClanSettingsDeltaAddMemberV1Update( + hash, + name, + ), + ) + } + 2 -> { + val index = buffer.g2() + val rank = buffer.g1() + add( + ClanSettingsDelta.ClanSettingsDeltaSetMemberRankUpdate( + index, + rank, + ), + ) + } + 3 -> { + val hashOpcode = buffer.g1() + val hash = + if (hashOpcode != 0xFF) { + buffer.readerIndex(buffer.readerIndex() - 1) + buffer.g8() + } else { + -1L + } + val name = buffer.gjstrnull() + add( + ClanSettingsDelta.ClanSettingsDeltaAddBannedUpdate( + hash, + name, + ), + ) + } + 4 -> { + val allowUnaffined = buffer.g1() == 1 + val talkRank = buffer.g1() + val kickRank = buffer.g1() + val lootshareRank = buffer.g1() + val coinshareRank = buffer.g1() + add( + ClanSettingsDelta.ClanSettingsDeltaBaseSettingsUpdate( + allowUnaffined, + talkRank, + kickRank, + lootshareRank, + coinshareRank, + ), + ) + } + 5 -> { + val index = buffer.g2() + add(ClanSettingsDelta.ClanSettingsDeltaDeleteMemberUpdate(index)) + } + 6 -> { + val index = buffer.g2() + add(ClanSettingsDelta.ClanSettingsDeltaDeleteBannedUpdate(index)) + } + 7 -> { + val index = buffer.g2() + val value = buffer.g4() + val startBit = buffer.g1() + val endBit = buffer.g1() + add( + ClanSettingsDelta.ClanSettingsDeltaSetMemberExtraInfoUpdate( + index, + value, + startBit, + endBit, + ), + ) + } + 8 -> { + val setting = buffer.g4() + val value = buffer.g4() + add( + ClanSettingsDelta.ClanSettingsDeltaSetIntSettingUpdate( + setting, + value, + ), + ) + } + 9 -> { + val setting = buffer.g4() + val value = buffer.g8() + add( + ClanSettingsDelta.ClanSettingsDeltaSetLongSettingUpdate( + setting, + value, + ), + ) + } + 10 -> { + val setting = buffer.g4() + val value = buffer.gjstr() + add( + ClanSettingsDelta.ClanSettingsDeltaSetStringSettingUpdate( + setting, + value, + ), + ) + } + 11 -> { + val setting = buffer.g4() + val value = buffer.g4() + val startBit = buffer.g1() + val endBit = buffer.g1() + add( + ClanSettingsDelta.ClanSettingsDeltaSetVarbitSettingUpdate( + setting, + value, + startBit, + endBit, + ), + ) + } + 12 -> { + val clanName = buffer.gjstr() + buffer.skipRead(4) + add(ClanSettingsDelta.ClanSettingsDeltaSetClanNameUpdate(clanName)) + } + 13 -> { + val hashOpcode = buffer.g1() + val hash = + if (hashOpcode != 0xFF) { + buffer.readerIndex(buffer.readerIndex() - 1) + buffer.g8() + } else { + -1L + } + val name = buffer.gjstrnull() + val joinRuneDay = buffer.g2() + add( + ClanSettingsDelta.ClanSettingsDeltaAddMemberV2Update( + hash, + name, + joinRuneDay, + ), + ) + } + 14 -> { + val index = buffer.g2() + val muted = buffer.g1() == 1 + add( + ClanSettingsDelta.ClanSettingsDeltaSetMemberMutedUpdate( + index, + muted, + ), + ) + } + 15 -> { + val index = buffer.g2() + add(ClanSettingsDelta.ClanSettingsDeltaSetClanOwnerUpdate(index)) + } + else -> error("Unknown opcode: $opcode") + } + } + } + return ClanSettingsDelta( + clanType, + owner, + updateNum, + updates, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/ClanSettingsFullDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/ClanSettingsFullDecoder.kt new file mode 100644 index 00000000..12b89a26 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/ClanSettingsFullDecoder.kt @@ -0,0 +1,176 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.clan + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.clan.ClanSettingsFull +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class ClanSettingsFullDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CLANSETTINGS_FULL + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ClanSettingsFull { + val clanType = buffer.g1() + if (!buffer.isReadable) { + return ClanSettingsFull( + clanType, + ClanSettingsFull.ClanSettingsFullLeaveUpdate, + ) + } + val version = buffer.g1() + val flags = buffer.g1() + val updateNum = buffer.g4() + val creationTime = buffer.g4() + val affinedMemberCount = buffer.g2() + val bannedMemberCount = buffer.g1() + val clanName = buffer.gjstr() + if (version >= 4) { + buffer.skipRead(4) + } + val allowUnaffined = buffer.g1() == 1 + val talkRank = buffer.g1() + val kickRank = buffer.g1() + val lootshareRank = buffer.g1() + val coinshareRank = buffer.g1() + val hasAffinedHashes = flags and ClanSettingsFull.FLAG_HAS_AFFINED_HASHES != 0 + val hasAffinedDisplayNames = flags and ClanSettingsFull.FLAG_HAS_AFFINED_DISPLAY_NAMES != 0 + check(hasAffinedHashes || hasAffinedDisplayNames) { + "Unexpected behavior: No hashes or display names." + } + check(hasAffinedHashes != hasAffinedDisplayNames) { + "Unexpected behavior: Two ways of writing names detected" + } + val affinedMembers = + buildList { + for (i in 0..= 2) { + buffer.g4() + } else { + 0 + } + val joinRuneDay = + if (version >= 5) { + buffer.g2() + } else { + 0 + } + val muted = + if (version >= 6) { + buffer.g1() == 1 + } else { + false + } + if (hasAffinedHashes) { + add( + ClanSettingsFull.AffinedClanMember( + hash, + rank, + extraInfo, + joinRuneDay, + muted, + ), + ) + } else { + add( + ClanSettingsFull.AffinedClanMember( + checkNotNull(displayName), + rank, + extraInfo, + joinRuneDay, + muted, + ), + ) + } + } + } + val bannedMembers = + buildList { + for (i in 0..= 3) { + val settingsCount = buffer.g2() + buildList { + for (i in 0.. { + val value = buffer.g4() + add(ClanSettingsFull.IntClanSetting(id, value)) + } + 1 -> { + val value = buffer.g8() + add(ClanSettingsFull.LongClanSetting(id, value)) + } + 2 -> { + val value = buffer.gjstr() + add(ClanSettingsFull.StringClanSetting(id, value)) + } + else -> { + error("Unknown type: $type") + } + } + } + } + } else { + emptyList() + } + return ClanSettingsFull( + clanType, + ClanSettingsFull.ClanSettingsFullJoinUpdate( + updateNum, + creationTime, + clanName, + allowUnaffined, + talkRank, + kickRank, + lootshareRank, + coinshareRank, + affinedMembers, + bannedMembers, + settings, + hasAffinedHashes, + hasAffinedDisplayNames, + ), + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/MessageClanChannelDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/MessageClanChannelDecoder.kt new file mode 100644 index 00000000..729ebdff --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/MessageClanChannelDecoder.kt @@ -0,0 +1,37 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.clan + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.compression.HuffmanCodec +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.clan.MessageClanChannel +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class MessageClanChannelDecoder( + private val huffmanCodec: HuffmanCodec, +) : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.MESSAGE_CLANCHANNEL + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MessageClanChannel { + val clanType = buffer.g1() + val name = buffer.gjstr() + val worldId = buffer.g2() + val worldMessageCounter = buffer.g3() + val chatCrownType = buffer.g1() + val message = huffmanCodec.decode(buffer) + return MessageClanChannel( + clanType, + name, + worldId, + worldMessageCounter, + chatCrownType, + message, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/MessageClanChannelSystemDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/MessageClanChannelSystemDecoder.kt new file mode 100644 index 00000000..520e1a48 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/MessageClanChannelSystemDecoder.kt @@ -0,0 +1,33 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.clan + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.compression.HuffmanCodec +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.clan.MessageClanChannelSystem +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class MessageClanChannelSystemDecoder( + private val huffmanCodec: HuffmanCodec, +) : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.MESSAGE_CLANCHANNEL_SYSTEM + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MessageClanChannelSystem { + val clanType = buffer.g1() + val worldId = buffer.g2() + val worldMessageCounter = buffer.g3() + val message = huffmanCodec.decode(buffer) + return MessageClanChannelSystem( + clanType, + worldId, + worldMessageCounter, + message, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/VarClanDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/VarClanDecoder.kt new file mode 100644 index 00000000..9ed4bb2a --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/VarClanDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.clan + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.clan.VarClan +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class VarClanDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.VARCLAN + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): VarClan { + val id = buffer.g1() + val data = ByteArray(buffer.readableBytes()) + buffer.gdata(data) + return VarClan(id, VarClan.UnknownVarClanData(data)) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/VarClanDisableDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/VarClanDisableDecoder.kt new file mode 100644 index 00000000..7dafb323 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/VarClanDisableDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.clan + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.clan.VarClanDisable +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class VarClanDisableDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.VARCLAN_DISABLE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): VarClanDisable { + return VarClanDisable + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/VarClanEnableDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/VarClanEnableDecoder.kt new file mode 100644 index 00000000..f62f047a --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/clan/VarClanEnableDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.clan + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.clan.VarClanEnable +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class VarClanEnableDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.VARCLAN_ENABLE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): VarClanEnable { + return VarClanEnable + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/friendchat/MessageFriendChannelDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/friendchat/MessageFriendChannelDecoder.kt new file mode 100644 index 00000000..f1cf1388 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/friendchat/MessageFriendChannelDecoder.kt @@ -0,0 +1,38 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.friendchat + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.compression.Base37 +import net.rsprot.compression.HuffmanCodec +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.friendchat.MessageFriendChannel +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class MessageFriendChannelDecoder( + private val huffmanCodec: HuffmanCodec, +) : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.MESSAGE_FRIENDCHANNEL + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MessageFriendChannel { + val sender = buffer.gjstr() + val channelName = Base37.decodeWithCase(buffer.g8()) + val worldId = buffer.g2() + val worldMessageCounter = buffer.g3() + val chatCrownType = buffer.g1() + val message = huffmanCodec.decode(buffer) + return MessageFriendChannel( + sender, + channelName, + worldId, + worldMessageCounter, + chatCrownType, + message, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/friendchat/UpdateFriendChatChannelFullV2Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/friendchat/UpdateFriendChatChannelFullV2Decoder.kt new file mode 100644 index 00000000..0594f854 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/friendchat/UpdateFriendChatChannelFullV2Decoder.kt @@ -0,0 +1,54 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.friendchat + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.compression.Base37 +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.friendchat.UpdateFriendChatChannelFull +import net.rsprox.protocol.game.outgoing.model.friendchat.UpdateFriendChatChannelFullV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class UpdateFriendChatChannelFullV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_FRIENDCHAT_CHANNEL_FULL_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateFriendChatChannelFullV2 { + if (!buffer.isReadable) { + return UpdateFriendChatChannelFullV2(UpdateFriendChatChannelFullV2.LeaveUpdate) + } + val channelOwner = buffer.gjstr() + val channelName = Base37.decodeWithCase(buffer.g8()) + val kickRank = buffer.g1s() + val entryCount = buffer.gSmart1or2null() + val entries = + buildList { + for (i in 0.. { + override val prot: ClientProt = GameServerProt.UPDATE_FRIENDCHAT_CHANNEL_SINGLEUSER + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateFriendChatChannelSingleUser { + val name = buffer.gjstr() + val worldId = buffer.g2() + val rank = buffer.g1s() + return if (rank != -128) { + val worldName = buffer.gjstr() + UpdateFriendChatChannelSingleUser( + UpdateFriendChatChannelSingleUser.AddedFriendChatUser( + name, + worldId, + rank, + worldName, + ), + ) + } else { + UpdateFriendChatChannelSingleUser( + UpdateFriendChatChannelSingleUser.RemovedFriendChatUser( + name, + worldId, + ), + ) + } + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/NpcInfoLargeV5Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/NpcInfoLargeV5Decoder.kt new file mode 100644 index 00000000..95e5f6ad --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/NpcInfoLargeV5Decoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.info + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.info.npcinfo.NpcInfo +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.session.getActiveWorld +import net.rsprox.protocol.session.getNpcInfoBaseCoord +import net.rsprox.protocol.session.getWorld +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class NpcInfoLargeV5Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.NPC_INFO_LARGE_V5 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): NpcInfo { + val activeWorld = session.getActiveWorld() + val world = session.getWorld(activeWorld) + return world.npcInfo.decode( + buffer.buffer, + true, + session.getNpcInfoBaseCoord(), + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/NpcInfoSmallV5Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/NpcInfoSmallV5Decoder.kt new file mode 100644 index 00000000..528b6eed --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/NpcInfoSmallV5Decoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.info + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.info.npcinfo.NpcInfo +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.session.getActiveWorld +import net.rsprox.protocol.session.getNpcInfoBaseCoord +import net.rsprox.protocol.session.getWorld +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class NpcInfoSmallV5Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.NPC_INFO_SMALL_V5 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): NpcInfo { + val activeWorld = session.getActiveWorld() + val world = session.getWorld(activeWorld) + return world.npcInfo.decode( + buffer.buffer, + false, + session.getNpcInfoBaseCoord(), + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/PlayerInfoDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/PlayerInfoDecoder.kt new file mode 100644 index 00000000..07905dd9 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/PlayerInfoDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.info + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.info.playerinfo.PlayerInfo +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.session.getActiveWorld +import net.rsprox.protocol.session.getWorld +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class PlayerInfoDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.PLAYER_INFO + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): PlayerInfo { + val playerInfo = session.getWorld(session.getActiveWorld()).playerInfo + return playerInfo.decode(buffer.buffer) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/SetNpcUpdateOriginDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/SetNpcUpdateOriginDecoder.kt new file mode 100644 index 00000000..c9a13376 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/SetNpcUpdateOriginDecoder.kt @@ -0,0 +1,38 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.info + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.common.CoordGrid +import net.rsprox.protocol.game.outgoing.model.info.npcinfo.SetNpcUpdateOrigin +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.session.getActiveWorld +import net.rsprox.protocol.session.getWorld +import net.rsprox.protocol.session.setNpcInfoBaseCoord +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class SetNpcUpdateOriginDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.SET_NPC_UPDATE_ORIGIN + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): SetNpcUpdateOrigin { + val originX = buffer.g1() + val originZ = buffer.g1() + val world = session.getWorld(session.getActiveWorld()) + val coord = + CoordGrid( + world.level, + world.baseX + originX, + world.baseZ + originZ, + ) + session.setNpcInfoBaseCoord(coord) + return SetNpcUpdateOrigin( + originX, + originZ, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/WorldEntityInfoV3Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/WorldEntityInfoV3Decoder.kt new file mode 100644 index 00000000..559a4fb5 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/WorldEntityInfoV3Decoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.info + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.common.CoordGrid +import net.rsprox.protocol.game.outgoing.model.info.worldentityinfo.WorldEntityInfo +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.session.getActiveWorld +import net.rsprox.protocol.session.getWorld +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class WorldEntityInfoV3Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.WORLDENTITY_INFO_V3 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): WorldEntityInfo { + val activeWorld = session.getActiveWorld() + val world = session.getWorld(activeWorld) + return world.worldEntityInfo.decode( + buffer, + CoordGrid(world.level, world.baseX, world.baseZ), + 3, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/WorldEntityInfoV4Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/WorldEntityInfoV4Decoder.kt new file mode 100644 index 00000000..781a5079 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/info/WorldEntityInfoV4Decoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.info + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.common.CoordGrid +import net.rsprox.protocol.game.outgoing.model.info.worldentityinfo.WorldEntityInfo +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.session.getActiveWorld +import net.rsprox.protocol.session.getWorld +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class WorldEntityInfoV4Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.WORLDENTITY_INFO_V4 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): WorldEntityInfo { + val activeWorld = session.getActiveWorld() + val world = session.getWorld(activeWorld) + return world.worldEntityInfo.decode( + buffer, + CoordGrid(world.level, world.baseX, world.baseZ), + 4, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfClearInvDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfClearInvDecoder.kt new file mode 100644 index 00000000..0948d631 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfClearInvDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt3 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfClearInv +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfClearInvDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_CLEARINV + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfClearInv { + val combinedId = buffer.gCombinedIdAlt3() + return IfClearInv( + combinedId.interfaceId, + combinedId.componentId, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfCloseSubDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfCloseSubDecoder.kt new file mode 100644 index 00000000..4f2144ed --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfCloseSubDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprot.protocol.util.gCombinedId +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfCloseSub +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class IfCloseSubDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_CLOSESUB + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfCloseSub { + val combinedId = buffer.gCombinedId() + return IfCloseSub( + combinedId.interfaceId, + combinedId.componentId, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfMoveSubDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfMoveSubDecoder.kt new file mode 100644 index 00000000..eb5b1b66 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfMoveSubDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedId +import net.rsprot.protocol.util.gCombinedIdAlt1 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfMoveSub +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfMoveSubDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_MOVESUB + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfMoveSub { + val sourceCombinedId = buffer.gCombinedIdAlt1() + val destinationCombinedId = buffer.gCombinedId() + return IfMoveSub( + sourceCombinedId.interfaceId, + sourceCombinedId.componentId, + destinationCombinedId.interfaceId, + destinationCombinedId.componentId, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfOpenSubDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfOpenSubDecoder.kt new file mode 100644 index 00000000..1153e3a8 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfOpenSubDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt2 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfOpenSub +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfOpenSubDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_OPENSUB + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfOpenSub { + val interfaceId = buffer.g2Alt2() + val combinedId = buffer.gCombinedIdAlt2() + val type = buffer.g1Alt1() + return IfOpenSub( + combinedId.interfaceId, + combinedId.componentId, + interfaceId, + type, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfOpenTopDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfOpenTopDecoder.kt new file mode 100644 index 00000000..acd883f6 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfOpenTopDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfOpenTop +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfOpenTopDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_OPENTOP + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfOpenTop { + val interfaceId = buffer.g2Alt1() + return IfOpenTop( + interfaceId, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfResyncDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfResyncDecoder.kt new file mode 100644 index 00000000..3e1d6027 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfResyncDecoder.kt @@ -0,0 +1,62 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprot.protocol.util.gCombinedId +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfResync +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class IfResyncDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_RESYNC + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfResync { + val topLevelInterface = buffer.g2() + val subInterfaceCount = buffer.g2() + val subInterfaces = + buildList { + for (i in 0.. { + override val prot: ClientProt = GameServerProt.IF_SETANGLE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetAngle { + val angleY = buffer.g2Alt2() + val angleX = buffer.g2Alt3() + val zoom = buffer.g2Alt3() + val combinedId = buffer.gCombinedId() + return IfSetAngle( + combinedId.interfaceId, + combinedId.componentId, + angleX, + angleY, + zoom, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetAnimDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetAnimDecoder.kt new file mode 100644 index 00000000..4975f334 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetAnimDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt1 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetAnim +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfSetAnimDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_SETANIM + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetAnim { + val anim = buffer.g2Alt3() + val combinedId = buffer.gCombinedIdAlt1() + return IfSetAnim( + combinedId.interfaceId, + combinedId.componentId, + anim, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetColourDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetColourDecoder.kt new file mode 100644 index 00000000..cb928ee7 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetColourDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedId +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetColour +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfSetColourDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_SETCOLOUR + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetColour { + val combinedId = buffer.gCombinedId() + val colour15BitPacked = buffer.g2Alt1() + return IfSetColour( + combinedId.interfaceId, + combinedId.componentId, + colour15BitPacked, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetEventsDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetEventsDecoder.kt new file mode 100644 index 00000000..39a8a93b --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetEventsDecoder.kt @@ -0,0 +1,30 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt1 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetEvents +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfSetEventsDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_SETEVENTS + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetEvents { + val events = buffer.g4Alt1() + val combinedId = buffer.gCombinedIdAlt1() + val end = buffer.g2Alt3() + val start = buffer.g2Alt2() + return IfSetEvents( + combinedId.interfaceId, + combinedId.componentId, + start, + end, + events, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetHideDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetHideDecoder.kt new file mode 100644 index 00000000..3cad16a7 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetHideDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt1 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetHide +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfSetHideDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_SETHIDE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetHide { + val hidden = buffer.g1Alt3() == 1 + val combinedId = buffer.gCombinedIdAlt1() + return IfSetHide( + combinedId.interfaceId, + combinedId.componentId, + hidden, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetModelDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetModelDecoder.kt new file mode 100644 index 00000000..c3b3d8e5 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetModelDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt1 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetModel +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfSetModelDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_SETMODEL + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetModel { + val combinedId = buffer.gCombinedIdAlt1() + val model = buffer.g2Alt1() + return IfSetModel( + combinedId.interfaceId, + combinedId.componentId, + model, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadActiveDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadActiveDecoder.kt new file mode 100644 index 00000000..3281ea45 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadActiveDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt2 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetNpcHeadActive +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfSetNpcHeadActiveDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_SETNPCHEAD_ACTIVE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetNpcHeadActive { + val index = buffer.g2Alt3() + val combinedId = buffer.gCombinedIdAlt2() + return IfSetNpcHeadActive( + combinedId.interfaceId, + combinedId.componentId, + index, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadDecoder.kt new file mode 100644 index 00000000..ea9a6a68 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt3 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetNpcHead +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfSetNpcHeadDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_SETNPCHEAD + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetNpcHead { + val npc = buffer.g2() + val combinedId = buffer.gCombinedIdAlt3() + return IfSetNpcHead( + combinedId.interfaceId, + combinedId.componentId, + npc, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetObjectDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetObjectDecoder.kt new file mode 100644 index 00000000..1126919a --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetObjectDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt3 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetObject +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfSetObjectDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_SETOBJECT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetObject { + val combinedId = buffer.gCombinedIdAlt3() + val count = buffer.g4Alt3() + val obj = buffer.g2Alt2() + return IfSetObject( + combinedId.interfaceId, + combinedId.componentId, + obj, + count, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerHeadDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerHeadDecoder.kt new file mode 100644 index 00000000..228ceac2 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerHeadDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedId +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetPlayerHead +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfSetPlayerHeadDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_SETPLAYERHEAD + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetPlayerHead { + val combinedId = buffer.gCombinedId() + return IfSetPlayerHead( + combinedId.interfaceId, + combinedId.componentId, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBaseColourDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBaseColourDecoder.kt new file mode 100644 index 00000000..0ee85242 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBaseColourDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt3 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetPlayerModelBaseColour +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfSetPlayerModelBaseColourDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_SETPLAYERMODEL_BASECOLOUR + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetPlayerModelBaseColour { + val index = buffer.g1Alt1() + val combinedId = buffer.gCombinedIdAlt3() + val colour = buffer.g1() + return IfSetPlayerModelBaseColour( + combinedId.interfaceId, + combinedId.componentId, + index, + colour, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBodyTypeDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBodyTypeDecoder.kt new file mode 100644 index 00000000..0455a6cc --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBodyTypeDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt2 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetPlayerModelBodyType +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfSetPlayerModelBodyTypeDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_SETPLAYERMODEL_BODYTYPE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetPlayerModelBodyType { + val bodyType = buffer.g1Alt1() + val combinedId = buffer.gCombinedIdAlt2() + return IfSetPlayerModelBodyType( + combinedId.interfaceId, + combinedId.componentId, + bodyType, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelObjDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelObjDecoder.kt new file mode 100644 index 00000000..743141a8 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelObjDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt1 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetPlayerModelObj +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfSetPlayerModelObjDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_SETPLAYERMODEL_OBJ + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetPlayerModelObj { + val obj = buffer.g4Alt1() + val combinedId = buffer.gCombinedIdAlt1() + return IfSetPlayerModelObj( + combinedId.interfaceId, + combinedId.componentId, + obj, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelSelfDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelSelfDecoder.kt new file mode 100644 index 00000000..632f82cc --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelSelfDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt2 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetPlayerModelSelf +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfSetPlayerModelSelfDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_SETPLAYERMODEL_SELF + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetPlayerModelSelf { + val combinedId = buffer.gCombinedIdAlt2() + val copyObjs = buffer.g1() == 0 + return IfSetPlayerModelSelf( + combinedId.interfaceId, + combinedId.componentId, + copyObjs, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPositionDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPositionDecoder.kt new file mode 100644 index 00000000..af99b86f --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPositionDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt3 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetPosition +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfSetPositionDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_SETPOSITION + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetPosition { + val x = buffer.g2Alt1() + val y = buffer.g2Alt1() + val combinedId = buffer.gCombinedIdAlt3() + return IfSetPosition( + combinedId.interfaceId, + combinedId.componentId, + x, + y, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt new file mode 100644 index 00000000..c06e105c --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedId +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetRotateSpeed +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfSetRotateSpeedDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_SETROTATESPEED + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetRotateSpeed { + val combinedId = buffer.gCombinedId() + val ySpeed = buffer.g2() + val xSpeed = buffer.g2Alt1() + return IfSetRotateSpeed( + combinedId.interfaceId, + combinedId.componentId, + xSpeed, + ySpeed, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetScrollPosDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetScrollPosDecoder.kt new file mode 100644 index 00000000..c3e875eb --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetScrollPosDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt1 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetScrollPos +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfSetScrollPosDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_SETSCROLLPOS + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetScrollPos { + val scrollPos = buffer.g2() + val combinedId = buffer.gCombinedIdAlt1() + return IfSetScrollPos( + combinedId.interfaceId, + combinedId.componentId, + scrollPos, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetTextDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetTextDecoder.kt new file mode 100644 index 00000000..b43bb768 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetTextDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt3 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetText +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class IfSetTextDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_SETTEXT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetText { + val text = buffer.gjstr() + val combinedId = buffer.gCombinedIdAlt3() + return IfSetText( + combinedId.interfaceId, + combinedId.componentId, + text, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvFullDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvFullDecoder.kt new file mode 100644 index 00000000..e916f05b --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvFullDecoder.kt @@ -0,0 +1,39 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.inv + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedId +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.inv.UpdateInvFull +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class UpdateInvFullDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_INV_FULL + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateInvFull { + val combinedId = buffer.gCombinedId() + val inventoryId = buffer.g2() + val capacity = buffer.g2() + val objs = + buildList { + for (i in 0..= 0xFF) { + count = buffer.g4() + } + add(UpdateInvFull.Obj(id - 1, count)) + } + } + return UpdateInvFull( + combinedId.interfaceId, + combinedId.componentId, + inventoryId, + objs, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvPartialDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvPartialDecoder.kt new file mode 100644 index 00000000..bdbce5f5 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvPartialDecoder.kt @@ -0,0 +1,45 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.inv + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprot.protocol.util.gCombinedId +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.inv.UpdateInvPartial +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class UpdateInvPartialDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_INV_PARTIAL + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateInvPartial { + val combinedId = buffer.gCombinedId() + val inventoryId = buffer.g2() + val objs = + buildList { + while (buffer.isReadable) { + val slot = buffer.gSmart1or2() + val id = buffer.g2() + if (id == 0) { + add(UpdateInvPartial.IndexedObj(slot, -1, 0)) + continue + } + var count = buffer.g1() + if (count >= 0xFF) { + count = buffer.g4() + } + add(UpdateInvPartial.IndexedObj(slot, id - 1, count)) + } + } + return UpdateInvPartial( + combinedId.interfaceId, + combinedId.componentId, + inventoryId, + objs, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvStopTransmitDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvStopTransmitDecoder.kt new file mode 100644 index 00000000..96942e09 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvStopTransmitDecoder.kt @@ -0,0 +1,20 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.inv + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.inv.UpdateInvStopTransmit +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class UpdateInvStopTransmitDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_INV_STOPTRANSMIT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateInvStopTransmit { + val inventoryId = buffer.g2() + return UpdateInvStopTransmit(inventoryId) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/logout/LogoutDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/logout/LogoutDecoder.kt new file mode 100644 index 00000000..976942dd --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/logout/LogoutDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.logout + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.logout.Logout +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class LogoutDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.LOGOUT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): Logout { + return Logout + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/logout/LogoutTransferDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/logout/LogoutTransferDecoder.kt new file mode 100644 index 00000000..171c593e --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/logout/LogoutTransferDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.logout + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.logout.LogoutTransfer +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class LogoutTransferDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.LOGOUT_TRANSFER + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): LogoutTransfer { + val host = buffer.gjstr() + val id = buffer.g2() + val properties = buffer.g4() + return LogoutTransfer( + host, + id, + properties, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/logout/LogoutWithReasonDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/logout/LogoutWithReasonDecoder.kt new file mode 100644 index 00000000..94ac058e --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/logout/LogoutWithReasonDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.logout + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.logout.LogoutWithReason +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class LogoutWithReasonDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.LOGOUT_WITHREASON + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): LogoutWithReason { + val reason = buffer.g1() + return LogoutWithReason(reason) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/map/RebuildRegionDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/map/RebuildRegionDecoder.kt new file mode 100644 index 00000000..fb042061 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/map/RebuildRegionDecoder.kt @@ -0,0 +1,55 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.map + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.buffer.bitbuffer.toBitBuf +import net.rsprot.crypto.xtea.XteaKey +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.map.RebuildRegion +import net.rsprox.protocol.game.outgoing.model.map.util.BuildArea +import net.rsprox.protocol.game.outgoing.model.map.util.RebuildRegionZone +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.session.getWorld +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class RebuildRegionDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.REBUILD_REGION + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): RebuildRegion { + val zoneX = buffer.g2Alt2() + val reload = buffer.g1Alt3() == 1 + val zoneZ = buffer.g2Alt2() + val xteaCount = buffer.g2() + val buildArea = BuildArea() + buffer.buffer.toBitBuf().use { bitBuf -> + for (level in 0..<4) { + for (x in 0..<13) { + for (z in 0..<13) { + val exists = bitBuf.gBits(1) == 1 + val value = if (exists) bitBuf.gBits(26) else -1 + buildArea[level, x, z] = RebuildRegionZone(value) + } + } + } + } + val keys = + buildList { + for (i in 0.. { + override val prot: ClientProt = GameServerProt.REBUILD_WORLDENTITY + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): RebuildWorldEntityV2 { + val index = buffer.g2() + val baseX = buffer.g2() + val baseZ = buffer.g2() + val xteaCount = buffer.g2() + val buildArea = BuildArea() + buffer.buffer.toBitBuf().use { bitBuf -> + for (level in 0..<4) { + for (x in 0..<13) { + for (z in 0..<13) { + val exists = bitBuf.gBits(1) == 1 + val value = if (exists) bitBuf.gBits(26) else -1 + buildArea[level, x, z] = RebuildRegionZone(value) + } + } + } + } + val keys = + buildList { + for (i in 0.. { + override val prot: ClientProt = GameServerProt.RECONNECT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): Reconnect { + val playerInfoInitBlock = + buffer.buffer + .toBitBuf() + .use { bitBuf -> + val localPlayerAbsolutePosition = bitBuf.gBits(30) + val lowResolutionPositions = IntArray(2048) + for (i in 1.. { + override val prot: ClientProt = GameServerProt.REBUILD_NORMAL + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): StaticRebuildMessage { + val playerInfoInitBlock = + if (buffer.isReadable(MINIMUM_REBUILD_LOGIN_CAPACITY)) { + buffer.buffer + .toBitBuf() + .use { bitBuf -> + val localPlayerAbsolutePosition = bitBuf.gBits(30) + val lowResolutionPositions = IntArray(2048) + for (i in 1.. { + override val prot: ClientProt = GameServerProt.HIDELOCOPS + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): HideLocOps { + val hidden = buffer.gboolean() + return HideLocOps(hidden) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/HideNpcOpsDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/HideNpcOpsDecoder.kt new file mode 100644 index 00000000..45d1462d --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/HideNpcOpsDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.client.HideNpcOps +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class HideNpcOpsDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.HIDENPCOPS + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): HideNpcOps { + val hidden = buffer.gboolean() + return HideNpcOps(hidden) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/HideObjOpsDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/HideObjOpsDecoder.kt new file mode 100644 index 00000000..75861373 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/HideObjOpsDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.client.HideObjOps +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class HideObjOpsDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.HIDEOBJOPS + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): HideObjOps { + val hidden = buffer.gboolean() + return HideObjOps(hidden) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/HintArrowDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/HintArrowDecoder.kt new file mode 100644 index 00000000..ad6281a4 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/HintArrowDecoder.kt @@ -0,0 +1,50 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.client.HintArrow +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class HintArrowDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.HINT_ARROW + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): HintArrow { + return when (val type = buffer.g1()) { + 0 -> { + buffer.skipRead(5) + HintArrow(HintArrow.ResetHintArrow) + } + 1 -> { + val index = buffer.g2() + buffer.skipRead(3) + HintArrow(HintArrow.NpcHintArrow(index)) + } + 10 -> { + val index = buffer.g2() + buffer.skipRead(3) + HintArrow(HintArrow.PlayerHintArrow(index)) + } + in 2..6 -> { + val x = buffer.g2() + val z = buffer.g2() + val height = buffer.g1() + HintArrow( + HintArrow.TileHintArrow( + x, + z, + height, + type, + ), + ) + } + else -> error("Unknown hint arrow type: $type") + } + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/HiscoreReplyDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/HiscoreReplyDecoder.kt new file mode 100644 index 00000000..dbaf5aed --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/HiscoreReplyDecoder.kt @@ -0,0 +1,78 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.client.HiscoreReply +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class HiscoreReplyDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.HISCORE_REPLY + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): HiscoreReply { + val requestId = buffer.g1() + return when (val responseType = buffer.g1()) { + 0 -> { + val version = buffer.g1() + val statCount = buffer.g1() + val stats = + buildList { + for (i in 0.. { + val reason = buffer.gjstr() + HiscoreReply( + requestId, + HiscoreReply.FailedHiscoreReply(reason), + ) + } + else -> error("Invalid hiscore reply type: $responseType") + } + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/MinimapToggleDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/MinimapToggleDecoder.kt new file mode 100644 index 00000000..b464aa24 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/MinimapToggleDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.client.MinimapToggle +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class MinimapToggleDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.MINIMAP_TOGGLE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MinimapToggle { + val state = buffer.g1() + return MinimapToggle(state) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/PacketGroupEndDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/PacketGroupEndDecoder.kt new file mode 100644 index 00000000..3d1320ba --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/PacketGroupEndDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.client.PacketGroupEnd +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class PacketGroupEndDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.PACKET_GROUP_END + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): PacketGroupEnd { + return PacketGroupEnd(buffer.g2()) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/PacketGroupStartDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/PacketGroupStartDecoder.kt new file mode 100644 index 00000000..46a90484 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/PacketGroupStartDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.client.PacketGroupStart +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.session.setBytesConsumed +import net.rsprox.protocol.session.setRemainingBytesInPacketGroup +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class PacketGroupStartDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.PACKET_GROUP_START + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): PacketGroupStart { + val length = buffer.g2s() + session.setRemainingBytesInPacketGroup(length) + session.setBytesConsumed(null) + return PacketGroupStart(length) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/ReflectionCheckerDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/ReflectionCheckerDecoder.kt new file mode 100644 index 00000000..6b420b19 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/ReflectionCheckerDecoder.kt @@ -0,0 +1,123 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.client.ReflectionChecker +import net.rsprox.protocol.reflection.ReflectionCheck +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.session.getReflectionChecks +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Suppress("DuplicatedCode") +@Consistent +internal class ReflectionCheckerDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.REFLECTION_CHECKER + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ReflectionChecker { + val checksCount = buffer.g1() + val id = buffer.g4() + val checks = + buildList { + for (i in 0.. { + val className = buffer.gjstr() + val fieldName = buffer.gjstr() + add( + ReflectionCheck.GetFieldValue( + className, + fieldName, + ), + ) + } + 1 -> { + val className = buffer.gjstr() + val fieldName = buffer.gjstr() + val value = buffer.g4() + add( + ReflectionCheck.SetFieldValue( + className, + fieldName, + value, + ), + ) + } + 2 -> { + val className = buffer.gjstr() + val fieldName = buffer.gjstr() + add( + ReflectionCheck.GetFieldModifiers( + className, + fieldName, + ), + ) + } + 3 -> { + val className = buffer.gjstr() + val methodName = buffer.gjstr() + val parameterClassCount = buffer.g1() + val parameterClasses = + buildList { + for (j in 0.. { + val className = buffer.gjstr() + val methodName = buffer.gjstr() + val parameterClassCount = buffer.g1() + val parameterClasses = + buildList { + for (j in 0.. error("Unknown reflection check type: $opcode") + } + } + } + val old = session.getReflectionChecks().put(id, checks) + check(old == null) { + "Overlapping reflection check: $old/$checks" + } + return ReflectionChecker( + id, + checks, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/ResetAnimsDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/ResetAnimsDecoder.kt new file mode 100644 index 00000000..f8721163 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/ResetAnimsDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.client.ResetAnims +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class ResetAnimsDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.RESET_ANIMS + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ResetAnims { + return ResetAnims + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/ResetInteractionModeDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/ResetInteractionModeDecoder.kt new file mode 100644 index 00000000..b6461e9d --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/ResetInteractionModeDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.client.ResetInteractionMode +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class ResetInteractionModeDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.RESET_INTERACTION_MODE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ResetInteractionMode { + val worldId = buffer.g2() + return ResetInteractionMode( + worldId, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/SendPingDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/SendPingDecoder.kt new file mode 100644 index 00000000..d57c1883 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/SendPingDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.client.SendPing +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class SendPingDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.SEND_PING + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): SendPing { + val value1 = buffer.g4() + val value2 = buffer.g4() + return SendPing( + value1, + value2, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/ServerTickEndDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/ServerTickEndDecoder.kt new file mode 100644 index 00000000..ce749550 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/ServerTickEndDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.client.ServerTickEnd +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class ServerTickEndDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.SERVER_TICK_END + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ServerTickEnd { + return ServerTickEnd + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/SetHeatmapEnabledDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/SetHeatmapEnabledDecoder.kt new file mode 100644 index 00000000..04e4e9e2 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/SetHeatmapEnabledDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.client.SetHeatmapEnabled +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class SetHeatmapEnabledDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.SET_HEATMAP_ENABLED + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): SetHeatmapEnabled { + val enabled = buffer.gboolean() + return SetHeatmapEnabled(enabled) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/SetInteractionModeDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/SetInteractionModeDecoder.kt new file mode 100644 index 00000000..7a34efab --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/SetInteractionModeDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.client.SetInteractionMode +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class SetInteractionModeDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.SET_INTERACTION_MODE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): SetInteractionMode { + val worldId = buffer.g2() + val tileInteractionMode = buffer.g1() + val entityInteractionMode = buffer.g1() + return SetInteractionMode( + worldId, + tileInteractionMode, + entityInteractionMode, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/SiteSettingsDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/SiteSettingsDecoder.kt new file mode 100644 index 00000000..33c107d6 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/SiteSettingsDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.client.SiteSettings +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class SiteSettingsDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.SITE_SETTINGS + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): SiteSettings { + val settings = buffer.gjstr() + return SiteSettings( + settings, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/UpdateRebootTimerDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/UpdateRebootTimerDecoder.kt new file mode 100644 index 00000000..f577fbae --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/UpdateRebootTimerDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.client.UpdateRebootTimer +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class UpdateRebootTimerDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_REBOOT_TIMER + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateRebootTimer { + val gameCycles = buffer.g2() + return UpdateRebootTimer( + gameCycles, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/UpdateUid192Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/UpdateUid192Decoder.kt new file mode 100644 index 00000000..f8b56599 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/UpdateUid192Decoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.crypto.crc.CyclicRedundancyCheck +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.client.UpdateUid192 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class UpdateUid192Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_UID192 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateUid192 { + val data = ByteArray(24) + buffer.gdata(data) + val expectedCrc = buffer.g4() + val crc = CyclicRedundancyCheck.computeCrc32(data) + if (expectedCrc != crc) { + throw IllegalStateException("CRC Mismatch: $expectedCrc != $crc") + } + return UpdateUid192( + data, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/UrlOpenDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/UrlOpenDecoder.kt new file mode 100644 index 00000000..b5672df3 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/UrlOpenDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.client.UrlOpen +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class UrlOpenDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.URL_OPEN + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UrlOpen { + // The URL is already decrypted at the proxy level + // Additionally, any sensitive web tokens are erased at the proxy. + val url = buffer.gjstr() + return UrlOpen( + url, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsDecoder.kt new file mode 100644 index 00000000..461d911a --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.player.ChatFilterSettings +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class ChatFilterSettingsDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CHAT_FILTER_SETTINGS + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ChatFilterSettings { + val publicChatFilter = buffer.g1Alt3() + val tradeChatFilter = buffer.g1Alt2() + return ChatFilterSettings( + publicChatFilter, + tradeChatFilter, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsPrivateChatDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsPrivateChatDecoder.kt new file mode 100644 index 00000000..9f554831 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsPrivateChatDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.player.ChatFilterSettingsPrivateChat +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class ChatFilterSettingsPrivateChatDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CHAT_FILTER_SETTINGS_PRIVATECHAT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ChatFilterSettingsPrivateChat { + val privateChatFilter = buffer.g1() + return ChatFilterSettingsPrivateChat( + privateChatFilter, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/MessageGameDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/MessageGameDecoder.kt new file mode 100644 index 00000000..a0361b9d --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/MessageGameDecoder.kt @@ -0,0 +1,40 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.player.MessageGame +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class MessageGameDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.MESSAGE_GAME + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MessageGame { + val type = buffer.gSmart1or2() + val name = + if (buffer.g1() == 1) { + buffer.gjstr() + } else { + null + } + val message = buffer.gjstr() + return if (name != null) { + MessageGame( + type, + name, + message, + ) + } else { + MessageGame( + type, + message, + ) + } + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/RunClientScriptDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/RunClientScriptDecoder.kt new file mode 100644 index 00000000..7a9de064 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/RunClientScriptDecoder.kt @@ -0,0 +1,35 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.player.RunClientScript +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class RunClientScriptDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.RUNCLIENTSCRIPT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): RunClientScript { + val types = buffer.gjstr() + val arguments = ArrayDeque() + for (char in types.reversed()) { + if (char == 's') { + arguments.addFirst(buffer.gjstr()) + } else { + arguments.addFirst(buffer.g4()) + } + } + val id = buffer.g4() + return RunClientScript( + id, + types.toCharArray(), + arguments, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/SetMapFlagDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/SetMapFlagDecoder.kt new file mode 100644 index 00000000..af7c1a59 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/SetMapFlagDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.player.SetMapFlag +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class SetMapFlagDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.SET_MAP_FLAG + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): SetMapFlag { + val xInBuildArea = buffer.g1() + val zInBuildArea = buffer.g1() + return SetMapFlag( + xInBuildArea, + zInBuildArea, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/SetPlayerOpDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/SetPlayerOpDecoder.kt new file mode 100644 index 00000000..a5cc0000 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/SetPlayerOpDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.player.SetPlayerOp +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class SetPlayerOpDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.SET_PLAYER_OP + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): SetPlayerOp { + val priority = buffer.g1Alt2() == 1 + val id = buffer.g1Alt2() + val op = buffer.gjstr() + return SetPlayerOp( + id, + priority, + if (op == "null") null else op, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/TriggerOnDialogAbortDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/TriggerOnDialogAbortDecoder.kt new file mode 100644 index 00000000..4821c436 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/TriggerOnDialogAbortDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.player.TriggerOnDialogAbort +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class TriggerOnDialogAbortDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.TRIGGER_ONDIALOGABORT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): TriggerOnDialogAbort { + return TriggerOnDialogAbort + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateRunEnergyDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateRunEnergyDecoder.kt new file mode 100644 index 00000000..3b1b28f3 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateRunEnergyDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateRunEnergy +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class UpdateRunEnergyDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_RUNENERGY + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateRunEnergy { + val energy = buffer.g2() + return UpdateRunEnergy( + energy, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateRunWeightDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateRunWeightDecoder.kt new file mode 100644 index 00000000..601da0f1 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateRunWeightDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateRunWeight +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class UpdateRunWeightDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_RUNWEIGHT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateRunWeight { + val runweight = buffer.g2() + return UpdateRunWeight( + runweight, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateStatV2Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateStatV2Decoder.kt new file mode 100644 index 00000000..3999e321 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateStatV2Decoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStatV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class UpdateStatV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STAT_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateStatV2 { + val experience = buffer.g4() + val invisibleBoostedLevel = buffer.g1() + val currentLevel = buffer.g1() + val stat = buffer.g1() + return UpdateStatV2( + stat, + currentLevel, + invisibleBoostedLevel, + experience, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt new file mode 100644 index 00000000..18d3c50d --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt @@ -0,0 +1,47 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStockMarketSlot +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateStockMarketSlot { + val slot = buffer.g1() + return when (val status = buffer.g1()) { + 0 -> { + UpdateStockMarketSlot( + slot, + UpdateStockMarketSlot.ResetStockMarketSlot, + ) + } + else -> { + val obj = buffer.g2() + val price = buffer.g4() + val count = buffer.g4() + val completedCount = buffer.g4() + val completedGold = buffer.g4() + UpdateStockMarketSlot( + slot, + UpdateStockMarketSlot.SetStockMarketSlot( + status, + obj, + price, + count, + completedCount, + completedGold, + ), + ) + } + } + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateTradingPostDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateTradingPostDecoder.kt new file mode 100644 index 00000000..d76ba225 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateTradingPostDecoder.kt @@ -0,0 +1,57 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateTradingPost +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class UpdateTradingPostDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateTradingPost { + val reset = buffer.g1() == 0 + if (reset) { + return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + } + val age = buffer.g8() + val obj = buffer.g2() + val status = buffer.g1() == 1 + val offerCount = buffer.g2() + val offers = + buildList { + for (i in 0.. { + override val prot: ClientProt = GameServerProt.FRIENDLIST_LOADED + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): FriendListLoaded { + return FriendListLoaded + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/social/MessagePrivateDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/social/MessagePrivateDecoder.kt new file mode 100644 index 00000000..3e95ba5b --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/social/MessagePrivateDecoder.kt @@ -0,0 +1,35 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.social + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.compression.HuffmanCodec +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.social.MessagePrivate +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class MessagePrivateDecoder( + private val huffmanCodec: HuffmanCodec, +) : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.MESSAGE_PRIVATE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MessagePrivate { + val sender = buffer.gjstr() + val worldId = buffer.g2() + val worldMessageCounter = buffer.g3() + val chatCrownType = buffer.g1() + val message = huffmanCodec.decode(buffer) + return MessagePrivate( + sender, + worldId, + worldMessageCounter, + chatCrownType, + message, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/social/MessagePrivateEchoDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/social/MessagePrivateEchoDecoder.kt new file mode 100644 index 00000000..4c917af5 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/social/MessagePrivateEchoDecoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.social + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.compression.HuffmanCodec +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.social.MessagePrivateEcho +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class MessagePrivateEchoDecoder( + private val huffmanCodec: HuffmanCodec, +) : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.MESSAGE_PRIVATE_ECHO + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MessagePrivateEcho { + val recipient = buffer.gjstr() + val message = huffmanCodec.decode(buffer) + return MessagePrivateEcho( + recipient, + message, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/social/UpdateFriendListDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/social/UpdateFriendListDecoder.kt new file mode 100644 index 00000000..63a04755 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/social/UpdateFriendListDecoder.kt @@ -0,0 +1,64 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.social + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.social.UpdateFriendList +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class UpdateFriendListDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_FRIENDLIST + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateFriendList { + return UpdateFriendList( + buildList { + while (buffer.isReadable) { + val added = buffer.g1() == 1 + val name = buffer.gjstr() + val previousName = buffer.gjstr() + val worldId = buffer.g2() + val rank = buffer.g1() + val properties = buffer.g1() + if (worldId > 0) { + val worldName = buffer.gjstr() + val platform = buffer.g1() + val worldFlags = buffer.g4() + val notes = buffer.gjstr() + add( + UpdateFriendList.OnlineFriend( + added, + name, + previousName, + worldId, + rank, + properties, + notes, + worldName, + platform, + worldFlags, + ), + ) + continue + } + val notes = buffer.gjstr() + add( + UpdateFriendList.OfflineFriend( + added, + name, + previousName, + rank, + properties, + notes, + ), + ) + } + }, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/social/UpdateIgnoreListDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/social/UpdateIgnoreListDecoder.kt new file mode 100644 index 00000000..7dd2443f --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/social/UpdateIgnoreListDecoder.kt @@ -0,0 +1,47 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.social + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.social.UpdateIgnoreList +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class UpdateIgnoreListDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_IGNORELIST + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateIgnoreList { + return UpdateIgnoreList( + buildList { + while (buffer.isReadable) { + val type = buffer.g1() + val name = buffer.gjstr() + if (type == 4) { + add( + UpdateIgnoreList.RemovedIgnoredEntry( + name, + ), + ) + continue + } + val added = type and 0x1 != 0 + val previousName = buffer.gjstr() + val note = buffer.gjstr() + add( + UpdateIgnoreList.AddedIgnoredEntry( + name, + previousName, + note, + added, + ), + ) + } + }, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiJingleDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiJingleDecoder.kt new file mode 100644 index 00000000..9c74deab --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiJingleDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.sound + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.sound.MidiJingle +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class MidiJingleDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.MIDI_JINGLE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MidiJingle { + val lengthInMillis = buffer.g3Alt2() + val id = buffer.g2Alt1() + return MidiJingle( + id, + lengthInMillis, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongStopDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongStopDecoder.kt new file mode 100644 index 00000000..2802d5f1 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongStopDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.sound + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.sound.MidiSongStop +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class MidiSongStopDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.MIDI_SONG_STOP + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MidiSongStop { + val fadeOutSpeed = buffer.g2() + val fadeOutDelay = buffer.g2Alt2() + return MidiSongStop( + fadeOutDelay, + fadeOutSpeed, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongV2Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongV2Decoder.kt new file mode 100644 index 00000000..452ce760 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongV2Decoder.kt @@ -0,0 +1,30 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.sound + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.sound.MidiSongV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class MidiSongV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.MIDI_SONG_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MidiSongV2 { + val fadeOutSpeed = buffer.g2Alt1() + val fadeOutDelay = buffer.g2Alt2() + val id = buffer.g2Alt1() + val fadeInSpeed = buffer.g2Alt1() + val fadeInDelay = buffer.g2Alt1() + return MidiSongV2( + id, + fadeOutDelay, + fadeOutSpeed, + fadeInDelay, + fadeInSpeed, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongWithSecondaryDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongWithSecondaryDecoder.kt new file mode 100644 index 00000000..4f1e5dde --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongWithSecondaryDecoder.kt @@ -0,0 +1,32 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.sound + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.sound.MidiSongWithSecondary +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class MidiSongWithSecondaryDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.MIDI_SONG_WITHSECONDARY + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MidiSongWithSecondary { + val fadeInDelay = buffer.g2Alt2() + val fadeInSpeed = buffer.g2Alt3() + val fadeOutSpeed = buffer.g2Alt1() + val primaryId = buffer.g2Alt2() + val secondaryId = buffer.g2() + val fadeOutDelay = buffer.g2Alt1() + return MidiSongWithSecondary( + primaryId, + secondaryId, + fadeOutDelay, + fadeOutSpeed, + fadeInDelay, + fadeInSpeed, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSwapDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSwapDecoder.kt new file mode 100644 index 00000000..0fe38e70 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSwapDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.sound + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.sound.MidiSwap +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class MidiSwapDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.MIDI_SWAP + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MidiSwap { + val fadeInSpeed = buffer.g2Alt3() + val fadeOutDelay = buffer.g2Alt3() + val fadeInDelay = buffer.g2Alt2() + val fadeOutSpeed = buffer.g2Alt1() + return MidiSwap( + fadeOutDelay, + fadeOutSpeed, + fadeInDelay, + fadeInSpeed, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/SynthSoundDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/SynthSoundDecoder.kt new file mode 100644 index 00000000..470bff9f --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/SynthSoundDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.sound + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.sound.SynthSound +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class SynthSoundDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.SYNTH_SOUND + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): SynthSound { + val id = buffer.g2() + val loops = buffer.g1() + val delay = buffer.g2() + return SynthSound( + id, + loops, + delay, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/LocAnimSpecificDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/LocAnimSpecificDecoder.kt new file mode 100644 index 00000000..ee3b9406 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/LocAnimSpecificDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.specific + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.specific.LocAnimSpecific +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInBuildArea +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.LocProperties +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class LocAnimSpecificDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.LOC_ANIM_SPECIFIC + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): LocAnimSpecific { + val locProperties = LocProperties(buffer.g1Alt2()) + val id = buffer.g2Alt2() + val coordInBuildArea = CoordInBuildArea(buffer.g3Alt2()) + return LocAnimSpecific( + id, + coordInBuildArea, + locProperties, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/MapAnimSpecificDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/MapAnimSpecificDecoder.kt new file mode 100644 index 00000000..14096e72 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/MapAnimSpecificDecoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.specific + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.specific.MapAnimSpecific +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInBuildArea +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class MapAnimSpecificDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.MAP_ANIM_SPECIFIC + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MapAnimSpecific { + val height = buffer.g1Alt1() + val id = buffer.g2Alt2() + val delay = buffer.g2Alt1() + val coordInBuildArea = CoordInBuildArea(buffer.g3Alt2()) + return MapAnimSpecific( + id, + delay, + height, + coordInBuildArea, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcAnimSpecificDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcAnimSpecificDecoder.kt new file mode 100644 index 00000000..df8417f9 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcAnimSpecificDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.specific + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.specific.NpcAnimSpecific +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class NpcAnimSpecificDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.NPC_ANIM_SPECIFIC + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): NpcAnimSpecific { + val id = buffer.g2Alt3() + val delay = buffer.g1Alt3() + val index = buffer.g2Alt3() + return NpcAnimSpecific( + index, + id, + delay, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcHeadIconSpecificDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcHeadIconSpecificDecoder.kt new file mode 100644 index 00000000..6e64bcf1 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcHeadIconSpecificDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.specific + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.specific.NpcHeadIconSpecific +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class NpcHeadIconSpecificDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.NPC_HEADICON_SPECIFIC + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): NpcHeadIconSpecific { + val index = buffer.g2() + val headIconSlot = buffer.g1Alt3() + val spriteIndex = buffer.g2Alt1() + val spriteGroup = buffer.g4Alt2() + return NpcHeadIconSpecific( + index, + headIconSlot, + spriteGroup, + spriteIndex, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcSpotAnimSpecificDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcSpotAnimSpecificDecoder.kt new file mode 100644 index 00000000..b1be2f4a --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcSpotAnimSpecificDecoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.specific + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.specific.NpcSpotAnimSpecific +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class NpcSpotAnimSpecificDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.NPC_SPOTANIM_SPECIFIC + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): NpcSpotAnimSpecific { + val slot = buffer.g1Alt1() + val id = buffer.g2Alt2() + val index = buffer.g2Alt1() + val packed = buffer.g4() + val height = packed ushr 16 + val delay = packed and 0xFFFF + return NpcSpotAnimSpecific( + index, + id, + slot, + height, + delay, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/PlayerAnimSpecificDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/PlayerAnimSpecificDecoder.kt new file mode 100644 index 00000000..cf1bb047 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/PlayerAnimSpecificDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.specific + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.specific.PlayerAnimSpecific +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class PlayerAnimSpecificDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.PLAYER_ANIM_SPECIFIC + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): PlayerAnimSpecific { + val id = buffer.g2Alt2() + val delay = buffer.g1Alt3() + return PlayerAnimSpecific( + id, + delay, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/PlayerSpotAnimSpecificDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/PlayerSpotAnimSpecificDecoder.kt new file mode 100644 index 00000000..03dbbdb0 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/PlayerSpotAnimSpecificDecoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.specific + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.specific.PlayerSpotAnimSpecific +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class PlayerSpotAnimSpecificDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.PLAYER_SPOTANIM_SPECIFIC + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): PlayerSpotAnimSpecific { + val index = buffer.g2Alt1() + val slot = buffer.g1Alt2() + val packed = buffer.g4Alt1() + val id = buffer.g2Alt3() + val height = packed ushr 16 + val delay = packed and 0xFFFF + return PlayerSpotAnimSpecific( + index, + id, + slot, + height, + delay, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/ProjAnimSpecificV3Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/ProjAnimSpecificV3Decoder.kt new file mode 100644 index 00000000..35378dd4 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/ProjAnimSpecificV3Decoder.kt @@ -0,0 +1,45 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.specific + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.specific.ProjAnimSpecificV3 +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInBuildArea +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class ProjAnimSpecificV3Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.PROJANIM_SPECIFIC_V3 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ProjAnimSpecificV3 { + val coordInBuildArea = CoordInBuildArea(buffer.g3Alt1()) + val deltaZ = buffer.g1() + val targetIndex = buffer.g3sAlt3() + val progress = buffer.g2Alt1() + val angle = buffer.g1Alt3() + val endHeight = buffer.g1Alt2() + val sourceIndex = buffer.g3sAlt2() + val startTime = buffer.g2Alt2() + val id = buffer.g2Alt1() + val deltaX = buffer.g1() + val endTime = buffer.g2Alt1() + val startHeight = buffer.g1Alt1() + return ProjAnimSpecificV3( + id, + startHeight, + endHeight, + startTime, + endTime, + angle, + progress, + sourceIndex, + targetIndex, + coordInBuildArea, + deltaX, + deltaZ, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/unknown/UnknownStringDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/unknown/UnknownStringDecoder.kt new file mode 100644 index 00000000..c2af8b9a --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/unknown/UnknownStringDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.unknown + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.unknown.UnknownString +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class UnknownStringDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UNKNOWN_STRING + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UnknownString { + val string = buffer.gjstr() + return UnknownString(string) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpLargeDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpLargeDecoder.kt new file mode 100644 index 00000000..1cf2f57a --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpLargeDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.varp + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.varp.VarpLarge +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class VarpLargeDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.VARP_LARGE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): VarpLarge { + val id = buffer.g2Alt2() + val value = buffer.g4() + return VarpLarge( + id, + value, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpResetDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpResetDecoder.kt new file mode 100644 index 00000000..a5b2d542 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpResetDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.varp + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.varp.VarpReset +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class VarpResetDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.VARP_RESET + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): VarpReset { + return VarpReset + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpSmallDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpSmallDecoder.kt new file mode 100644 index 00000000..9ef46398 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpSmallDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.varp + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.varp.VarpSmall +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class VarpSmallDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.VARP_SMALL + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): VarpSmall { + val id = buffer.g2() + val value = buffer.g1() + return VarpSmall( + id, + value, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpSyncDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpSyncDecoder.kt new file mode 100644 index 00000000..9f9f0407 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpSyncDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.varp + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.varp.VarpSync +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class VarpSyncDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.VARP_SYNC + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): VarpSync { + return VarpSync + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/worldentity/ClearEntitiesDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/worldentity/ClearEntitiesDecoder.kt new file mode 100644 index 00000000..f5537c70 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/worldentity/ClearEntitiesDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.worldentity + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.worldentity.ClearEntities +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class ClearEntitiesDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CLEAR_ENTITIES + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ClearEntities { + return ClearEntities + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/worldentity/SetActiveWorldDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/worldentity/SetActiveWorldDecoder.kt new file mode 100644 index 00000000..5be3f6e3 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/worldentity/SetActiveWorldDecoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.worldentity + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.worldentity.SetActiveWorld +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.session.getWorld +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class SetActiveWorldDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.SET_ACTIVE_WORLD + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): SetActiveWorld { + val type = buffer.g1() + val index = buffer.g2() + val activeLevel = buffer.g1() + val world = session.getWorld(if (type == 0) -1 else index) + world.level = activeLevel + return if (type == 0) { + SetActiveWorld(SetActiveWorld.RootWorldType(activeLevel)) + } else { + SetActiveWorld(SetActiveWorld.DynamicWorldType(index, activeLevel)) + } + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZoneFullFollowsDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZoneFullFollowsDecoder.kt new file mode 100644 index 00000000..2561cf97 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZoneFullFollowsDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.header + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZoneFullFollows +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class UpdateZoneFullFollowsDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_ZONE_FULL_FOLLOWS + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateZoneFullFollows { + val level = buffer.g1Alt1() + val zoneZ = buffer.g1() + val zoneX = buffer.g1Alt2() + return UpdateZoneFullFollows( + zoneX, + zoneZ, + level, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZonePartialEnclosedDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZonePartialEnclosedDecoder.kt new file mode 100644 index 00000000..bebc457f --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZonePartialEnclosedDecoder.kt @@ -0,0 +1,67 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.header + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.IncomingZoneProt +import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZonePartialEnclosed +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.LocAddChangeDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.LocAnimDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.LocDelDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.LocMergeDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.MapAnimDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.MapProjAnimDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.ObjAddDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.ObjCountDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.ObjCustomiseDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.ObjDelDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.ObjEnabledOpsDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.ObjUncustomiseDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.SoundAreaDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class UpdateZonePartialEnclosedDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_ZONE_PARTIAL_ENCLOSED + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateZonePartialEnclosed { + val zoneZ = buffer.g1() + val level = buffer.g1Alt3() + val zoneX = buffer.g1Alt2() + val packets = + buildList { + while (buffer.isReadable) { + val index = buffer.g1() + val decoder = IndexedZoneProtDecoder.entries[index] + add(decoder.decoder.decode(buffer, session) as IncomingZoneProt) + } + } + return UpdateZonePartialEnclosed( + zoneX, + zoneZ, + level, + packets, + ) + } + + private enum class IndexedZoneProtDecoder( + val decoder: ProxyMessageDecoder<*>, + ) { + MAP_PROJANIM(MapProjAnimDecoder()), + LOC_ADD_CHANGE(LocAddChangeDecoder()), + OBJ_UNCUSTOMISE(ObjUncustomiseDecoder()), + OBJ_COUNT(ObjCountDecoder()), + OBJ_ENABLED_OPS(ObjEnabledOpsDecoder()), + LOC_MERGE(LocMergeDecoder()), + OBJ_DEL(ObjDelDecoder()), + MAP_ANIM(MapAnimDecoder()), + SOUND_AREA(SoundAreaDecoder()), + OBJ_ADD(ObjAddDecoder()), + OBJ_CUSTOMISE(ObjCustomiseDecoder()), + LOC_DEL(LocDelDecoder()), + LOC_ANIM(LocAnimDecoder()), + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZonePartialFollowsDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZonePartialFollowsDecoder.kt new file mode 100644 index 00000000..cfae0b40 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZonePartialFollowsDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.header + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZonePartialFollows +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class UpdateZonePartialFollowsDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_ZONE_PARTIAL_FOLLOWS + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateZonePartialFollows { + val level = buffer.g1Alt3() + val zoneX = buffer.g1Alt1() + val zoneZ = buffer.g1() + return UpdateZonePartialFollows( + zoneX, + zoneZ, + level, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt new file mode 100644 index 00000000..77fc0865 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.util.OpFlags +import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChange +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.LocProperties +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class LocAddChangeDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.LOC_ADD_CHANGE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): LocAddChange { + val opFlags = OpFlags(buffer.g1Alt1()) + val id = buffer.g2() + val locProperties = LocProperties(buffer.g1Alt3()) + val coordInZone = CoordInZone(buffer.g1()) + return LocAddChange( + id, + coordInZone, + locProperties, + opFlags, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocAnimDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocAnimDecoder.kt new file mode 100644 index 00000000..98f11a23 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocAnimDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAnim +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.LocProperties +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class LocAnimDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.LOC_ANIM + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): LocAnim { + val id = buffer.g2Alt1() + val coordInZone = CoordInZone(buffer.g1()) + val locProperties = LocProperties(buffer.g1Alt3()) + return LocAnim( + id, + coordInZone, + locProperties, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocDelDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocDelDecoder.kt new file mode 100644 index 00000000..46048ca6 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocDelDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.zone.payload.LocDel +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.LocProperties +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class LocDelDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.LOC_DEL + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): LocDel { + val locProperties = LocProperties(buffer.g1Alt3()) + val coordInZone = CoordInZone(buffer.g1()) + return LocDel( + coordInZone, + locProperties, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt new file mode 100644 index 00000000..43c1c9e4 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt @@ -0,0 +1,42 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.zone.payload.LocMerge +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.LocProperties +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class LocMergeDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.LOC_MERGE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): LocMerge { + val start = buffer.g2() + val maxZ = buffer.g1Alt3() + val minZ = buffer.g1() + val id = buffer.g2Alt1() + val coordInZone = CoordInZone(buffer.g1()) + val maxX = buffer.g1() + val index = buffer.g2Alt2() + val end = buffer.g2Alt1() + val locProperties = LocProperties(buffer.g1Alt2()) + val minX = buffer.g1Alt2() + return LocMerge( + index, + id, + coordInZone, + locProperties, + start, + end, + minX, + minZ, + maxX, + maxZ, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt new file mode 100644 index 00000000..883fd9d8 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.zone.payload.MapAnim +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class MapAnimDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.MAP_ANIM + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MapAnim { + val id = buffer.g2() + val height = buffer.g1Alt1() + val delay = buffer.g2Alt2() + val coordInZone = CoordInZone(buffer.g1Alt2()) + return MapAnim( + id, + delay, + height, + coordInZone, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/MapProjAnimDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/MapProjAnimDecoder.kt new file mode 100644 index 00000000..131016df --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/MapProjAnimDecoder.kt @@ -0,0 +1,45 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.zone.payload.MapProjAnim +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class MapProjAnimDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.MAP_PROJANIM + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MapProjAnim { + val sourceIndex = buffer.g3sAlt3() + val endTime = buffer.g2Alt2() + val id = buffer.g2() + val startTime = buffer.g2Alt2() + val coordInZone = CoordInZone(buffer.g1Alt2()) + val progress = buffer.g2Alt2() + val targetIndex = buffer.g3sAlt2() + val startHeight = buffer.g1() + val deltaX = buffer.g1Alt3() + val endHeight = buffer.g1Alt3() + val deltaZ = buffer.g1Alt3() + val angle = buffer.g1Alt3() + return MapProjAnim( + id, + startHeight, + endHeight, + startTime, + endTime, + angle, + progress, + sourceIndex, + targetIndex, + coordInZone, + deltaX, + deltaZ, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt new file mode 100644 index 00000000..444b20b6 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt @@ -0,0 +1,38 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.util.OpFlags +import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjAdd +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class ObjAddDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_ADD + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ObjAdd { + val ownershipType = buffer.g1Alt1() + val opFlags = OpFlags(buffer.g1()) + val timeUntilPublic = buffer.g2() + val timeUntilDespawn = buffer.g2Alt2() + val id = buffer.g2Alt1() + val quantity = buffer.g4Alt3() + val coordInZone = CoordInZone(buffer.g1Alt3()) + val neverBecomesPublic = buffer.g1Alt3() == 1 + return ObjAdd( + id, + quantity, + coordInZone, + opFlags, + timeUntilPublic, + timeUntilDespawn, + ownershipType, + neverBecomesPublic, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjCountDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjCountDecoder.kt new file mode 100644 index 00000000..9a34a18f --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjCountDecoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjCount +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class ObjCountDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_COUNT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ObjCount { + val coordInZone = CoordInZone(buffer.g1Alt3()) + val id = buffer.g2Alt2() + val oldQuantity = buffer.g4() + val newQuantity = buffer.g4Alt2() + return ObjCount( + id, + oldQuantity, + newQuantity, + coordInZone, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjCustomiseDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjCustomiseDecoder.kt new file mode 100644 index 00000000..b5d8b9db --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjCustomiseDecoder.kt @@ -0,0 +1,38 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjCustomise +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class ObjCustomiseDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ObjCustomise { + val retexIndex = buffer.g2() + val retex = buffer.g2Alt3() + val coordInZone = CoordInZone(buffer.g1Alt1()) + val id = buffer.g2Alt1() + val recolIndex = buffer.g2Alt1() + val quantity = buffer.g4() + val model = buffer.g2Alt2() + val recol = buffer.g2() + return ObjCustomise( + id, + quantity, + model, + recolIndex, + recol, + retexIndex, + retex, + coordInZone.xInZone, + coordInZone.zInZone, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjDelDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjDelDecoder.kt new file mode 100644 index 00000000..e7c3df12 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjDelDecoder.kt @@ -0,0 +1,27 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjDel +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class ObjDelDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_DEL + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ObjDel { + val id = buffer.g2Alt1() + val coordInZone = CoordInZone(buffer.g1Alt1()) + val quantity = buffer.g4() + return ObjDel( + id, + quantity, + coordInZone, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjEnabledOpsDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjEnabledOpsDecoder.kt new file mode 100644 index 00000000..93cedd7c --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjEnabledOpsDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.util.OpFlags +import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjEnabledOps +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class ObjEnabledOpsDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_ENABLED_OPS + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ObjEnabledOps { + val opFlags = OpFlags(buffer.g1()) + val coordInZone = CoordInZone(buffer.g1Alt1()) + val id = buffer.g2Alt1() + return ObjEnabledOps( + id, + opFlags, + coordInZone, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjUncustomiseDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjUncustomiseDecoder.kt new file mode 100644 index 00000000..e3bbacfb --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjUncustomiseDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjUncustomise +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class ObjUncustomiseDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_UNCUSTOMISE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ObjUncustomise { + val id = buffer.g2() + val quantity = buffer.g4Alt1() + val coordInZone = CoordInZone(buffer.g1Alt1()) + return ObjUncustomise( + id, + quantity, + coordInZone.xInZone, + coordInZone.zInZone, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/SoundAreaDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/SoundAreaDecoder.kt new file mode 100644 index 00000000..57551737 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/SoundAreaDecoder.kt @@ -0,0 +1,33 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.zone.payload.SoundArea +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class SoundAreaDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.SOUND_AREA + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): SoundArea { + val coordInZone = CoordInZone(buffer.g1Alt3()) + val radius = buffer.g1Alt2() + val id = buffer.g2Alt1() + val loops = buffer.g1() + val size = buffer.g1() + val delay = buffer.g1Alt1() + return SoundArea( + id, + delay, + loops, + radius, + size, + coordInZone, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/GameServerProt.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/GameServerProt.kt new file mode 100644 index 00000000..d42424a5 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/GameServerProt.kt @@ -0,0 +1,196 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.prot + +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.Prot +import net.rsprot.protocol.ServerProt + +public enum class GameServerProt( + override val opcode: Int, + override val size: Int, +) : ServerProt, + ClientProt { + // Interface related packets + IF_RESYNC(GameServerProtId.IF_RESYNC, Prot.VAR_SHORT), + IF_OPENTOP(GameServerProtId.IF_OPENTOP, 2), + IF_OPENSUB(GameServerProtId.IF_OPENSUB, 7), + IF_CLOSESUB(GameServerProtId.IF_CLOSESUB, 4), + IF_MOVESUB(GameServerProtId.IF_MOVESUB, 8), + IF_CLEARINV(GameServerProtId.IF_CLEARINV, 4), + IF_SETEVENTS(GameServerProtId.IF_SETEVENTS, 12), + IF_SETPOSITION(GameServerProtId.IF_SETPOSITION, 8), + IF_SETSCROLLPOS(GameServerProtId.IF_SETSCROLLPOS, 6), + IF_SETROTATESPEED(GameServerProtId.IF_SETROTATESPEED, 8), + IF_SETTEXT(GameServerProtId.IF_SETTEXT, Prot.VAR_SHORT), + IF_SETHIDE(GameServerProtId.IF_SETHIDE, 5), + IF_SETANGLE(GameServerProtId.IF_SETANGLE, 10), + IF_SETOBJECT(GameServerProtId.IF_SETOBJECT, 10), + IF_SETCOLOUR(GameServerProtId.IF_SETCOLOUR, 6), + IF_SETANIM(GameServerProtId.IF_SETANIM, 6), + IF_SETNPCHEAD(GameServerProtId.IF_SETNPCHEAD, 6), + IF_SETNPCHEAD_ACTIVE(GameServerProtId.IF_SETNPCHEAD_ACTIVE, 6), + IF_SETPLAYERHEAD(GameServerProtId.IF_SETPLAYERHEAD, 4), + IF_SETMODEL(GameServerProtId.IF_SETMODEL, 6), + IF_SETPLAYERMODEL_BASECOLOUR(GameServerProtId.IF_SETPLAYERMODEL_BASECOLOUR, 6), + IF_SETPLAYERMODEL_BODYTYPE(GameServerProtId.IF_SETPLAYERMODEL_BODYTYPE, 5), + IF_SETPLAYERMODEL_OBJ(GameServerProtId.IF_SETPLAYERMODEL_OBJ, 8), + IF_SETPLAYERMODEL_SELF(GameServerProtId.IF_SETPLAYERMODEL_SELF, 5), + + // Music-system related packets (excl. zone ones) + MIDI_SONG_V2(GameServerProtId.MIDI_SONG_V2, 10), + MIDI_SONG_WITHSECONDARY(GameServerProtId.MIDI_SONG_WITHSECONDARY, 12), + MIDI_SWAP(GameServerProtId.MIDI_SWAP, 8), + MIDI_SONG_STOP(GameServerProtId.MIDI_SONG_STOP, 4), + MIDI_JINGLE(GameServerProtId.MIDI_JINGLE, 5), + SYNTH_SOUND(GameServerProtId.SYNTH_SOUND, 5), + + // Zone header packets + UPDATE_ZONE_FULL_FOLLOWS(GameServerProtId.UPDATE_ZONE_FULL_FOLLOWS, 3), + UPDATE_ZONE_PARTIAL_FOLLOWS(GameServerProtId.UPDATE_ZONE_PARTIAL_FOLLOWS, 3), + UPDATE_ZONE_PARTIAL_ENCLOSED(GameServerProtId.UPDATE_ZONE_PARTIAL_ENCLOSED, Prot.VAR_SHORT), + + // Zone payload packets + LOC_ADD_CHANGE(GameServerProtId.LOC_ADD_CHANGE, 5), + LOC_DEL(GameServerProtId.LOC_DEL, 2), + LOC_ANIM(GameServerProtId.LOC_ANIM, 4), + LOC_MERGE(GameServerProtId.LOC_MERGE, 14), + OBJ_ADD(GameServerProtId.OBJ_ADD, 14), + OBJ_DEL(GameServerProtId.OBJ_DEL, 7), + OBJ_COUNT(GameServerProtId.OBJ_COUNT, 11), + OBJ_ENABLED_OPS(GameServerProtId.OBJ_ENABLED_OPS, 4), + OBJ_CUSTOMISE(GameServerProtId.OBJ_CUSTOMISE, 17), + OBJ_UNCUSTOMISE(GameServerProtId.OBJ_UNCUSTOMISE, 7), + MAP_ANIM(GameServerProtId.MAP_ANIM, 6), + MAP_PROJANIM(GameServerProtId.MAP_PROJANIM, 20), + SOUND_AREA(GameServerProtId.SOUND_AREA, 7), + + // Specific packets + PROJANIM_SPECIFIC_V3(GameServerProtId.PROJANIM_SPECIFIC_V3, 22), + MAP_ANIM_SPECIFIC(GameServerProtId.MAP_ANIM_SPECIFIC, 8), + LOC_ANIM_SPECIFIC(GameServerProtId.LOC_ANIM_SPECIFIC, 6), + NPC_HEADICON_SPECIFIC(GameServerProtId.NPC_HEADICON_SPECIFIC, 9), + NPC_SPOTANIM_SPECIFIC(GameServerProtId.NPC_SPOTANIM_SPECIFIC, 9), + NPC_ANIM_SPECIFIC(GameServerProtId.NPC_ANIM_SPECIFIC, 5), + PLAYER_ANIM_SPECIFIC(GameServerProtId.PLAYER_ANIM_SPECIFIC, 3), + PLAYER_SPOTANIM_SPECIFIC(GameServerProtId.PLAYER_SPOTANIM_SPECIFIC, 9), + + // Info packets + PLAYER_INFO(GameServerProtId.PLAYER_INFO, Prot.VAR_SHORT), + NPC_INFO_SMALL_V5(GameServerProtId.NPC_INFO_SMALL_V5, Prot.VAR_SHORT), + NPC_INFO_LARGE_V5(GameServerProtId.NPC_INFO_LARGE_V5, Prot.VAR_SHORT), + + SET_NPC_UPDATE_ORIGIN(GameServerProtId.SET_NPC_UPDATE_ORIGIN, 2), + + // World entity packets + CLEAR_ENTITIES(GameServerProtId.CLEAR_ENTITIES, 0), + SET_ACTIVE_WORLD(GameServerProtId.SET_ACTIVE_WORLD, 4), + + @Deprecated( + "Deprecated as a new variant that supports defining center coord was introduced.", + replaceWith = ReplaceWith("WORLDENTITY_INFO_V4"), + ) + WORLDENTITY_INFO_V3(GameServerProtId.WORLDENTITY_INFO_V3, Prot.VAR_SHORT), + WORLDENTITY_INFO_V4(GameServerProtId.WORLDENTITY_INFO_V4, Prot.VAR_SHORT), + + // Map packets + REBUILD_NORMAL(GameServerProtId.REBUILD_NORMAL, Prot.VAR_SHORT), + REBUILD_REGION(GameServerProtId.REBUILD_REGION, Prot.VAR_SHORT), + REBUILD_WORLDENTITY(GameServerProtId.REBUILD_WORLDENTITY, Prot.VAR_SHORT), + + // Varp packets + VARP_SMALL(GameServerProtId.VARP_SMALL, 3), + VARP_LARGE(GameServerProtId.VARP_LARGE, 6), + VARP_RESET(GameServerProtId.VARP_RESET, 0), + VARP_SYNC(GameServerProtId.VARP_SYNC, 0), + + // Camera packets + CAM_SHAKE(GameServerProtId.CAM_SHAKE, 4), + CAM_RESET(GameServerProtId.CAM_RESET, 0), + CAM_SMOOTHRESET(GameServerProtId.CAM_SMOOTHRESET, 4), + CAM_MOVETO(GameServerProtId.CAM_MOVETO, 6), + CAM_MOVETO_CYCLES(GameServerProtId.CAM_MOVETO_CYCLES, 8), + CAM_MOVETO_ARC(GameServerProtId.CAM_MOVETO_ARC, 10), + CAM_LOOKAT(GameServerProtId.CAM_LOOKAT, 6), + CAM_LOOKAT_EASED_COORD(GameServerProtId.CAM_LOOKAT_EASED_COORD, 7), + CAM_ROTATEBY(GameServerProtId.CAM_ROTATEBY, 7), + CAM_ROTATETO(GameServerProtId.CAM_ROTATETO, 7), + CAM_MODE(GameServerProtId.CAM_MODE, 1), + CAM_TARGET_V2(GameServerProtId.CAM_TARGET_V2, 5), + OCULUS_SYNC(GameServerProtId.OCULUS_SYNC, 4), + + // Inventory packets + UPDATE_INV_FULL(GameServerProtId.UPDATE_INV_FULL, Prot.VAR_SHORT), + UPDATE_INV_PARTIAL(GameServerProtId.UPDATE_INV_PARTIAL, Prot.VAR_SHORT), + UPDATE_INV_STOPTRANSMIT(GameServerProtId.UPDATE_INV_STOPTRANSMIT, 2), + + // Social packets + MESSAGE_PRIVATE(GameServerProtId.MESSAGE_PRIVATE, Prot.VAR_SHORT), + MESSAGE_PRIVATE_ECHO(GameServerProtId.MESSAGE_PRIVATE_ECHO, Prot.VAR_SHORT), + FRIENDLIST_LOADED(GameServerProtId.FRIENDLIST_LOADED, 0), + UPDATE_FRIENDLIST(GameServerProtId.UPDATE_FRIENDLIST, Prot.VAR_SHORT), + UPDATE_IGNORELIST(GameServerProtId.UPDATE_IGNORELIST, Prot.VAR_SHORT), + + // Friend chat (old "clans") packets + UPDATE_FRIENDCHAT_CHANNEL_FULL_V2(GameServerProtId.UPDATE_FRIENDCHAT_CHANNEL_FULL_V2, Prot.VAR_SHORT), + UPDATE_FRIENDCHAT_CHANNEL_SINGLEUSER(GameServerProtId.UPDATE_FRIENDCHAT_CHANNEL_SINGLEUSER, Prot.VAR_BYTE), + MESSAGE_FRIENDCHANNEL(GameServerProtId.MESSAGE_FRIENDCHANNEL, Prot.VAR_BYTE), + + // Clan chat packets + VARCLAN(GameServerProtId.VARCLAN, Prot.VAR_BYTE), + VARCLAN_ENABLE(GameServerProtId.VARCLAN_ENABLE, 0), + VARCLAN_DISABLE(GameServerProtId.VARCLAN_DISABLE, 0), + CLANCHANNEL_FULL(GameServerProtId.CLANCHANNEL_FULL, Prot.VAR_SHORT), + CLANCHANNEL_DELTA(GameServerProtId.CLANCHANNEL_DELTA, Prot.VAR_SHORT), + CLANSETTINGS_FULL(GameServerProtId.CLANSETTINGS_FULL, Prot.VAR_SHORT), + CLANSETTINGS_DELTA(GameServerProtId.CLANSETTINGS_DELTA, Prot.VAR_SHORT), + MESSAGE_CLANCHANNEL(GameServerProtId.MESSAGE_CLANCHANNEL, Prot.VAR_BYTE), + MESSAGE_CLANCHANNEL_SYSTEM(GameServerProtId.MESSAGE_CLANCHANNEL_SYSTEM, Prot.VAR_BYTE), + + // Log out packets + LOGOUT(GameServerProtId.LOGOUT, 0), + LOGOUT_WITHREASON(GameServerProtId.LOGOUT_WITHREASON, 1), + LOGOUT_TRANSFER(GameServerProtId.LOGOUT_TRANSFER, Prot.VAR_BYTE), + + // Misc. player state packets + UPDATE_RUNWEIGHT(GameServerProtId.UPDATE_RUNWEIGHT, 2), + UPDATE_RUNENERGY(GameServerProtId.UPDATE_RUNENERGY, 2), + SET_MAP_FLAG(GameServerProtId.SET_MAP_FLAG, 2), + SET_PLAYER_OP(GameServerProtId.SET_PLAYER_OP, Prot.VAR_BYTE), + UPDATE_STAT_V2(GameServerProtId.UPDATE_STAT_V2, 7), + + // Misc. player packets + RUNCLIENTSCRIPT(GameServerProtId.RUNCLIENTSCRIPT, Prot.VAR_SHORT), + TRIGGER_ONDIALOGABORT(GameServerProtId.TRIGGER_ONDIALOGABORT, 0), + MESSAGE_GAME(GameServerProtId.MESSAGE_GAME, Prot.VAR_BYTE), + CHAT_FILTER_SETTINGS(GameServerProtId.CHAT_FILTER_SETTINGS, 2), + CHAT_FILTER_SETTINGS_PRIVATECHAT(GameServerProtId.CHAT_FILTER_SETTINGS_PRIVATECHAT, 1), + UPDATE_TRADINGPOST(GameServerProtId.UPDATE_TRADINGPOST, Prot.VAR_SHORT), + UPDATE_STOCKMARKET_SLOT(GameServerProtId.UPDATE_STOCKMARKET_SLOT, 20), + + // Misc. client state packets + HINT_ARROW(GameServerProtId.HINT_ARROW, 6), + RESET_ANIMS(GameServerProtId.RESET_ANIMS, 0), + UPDATE_REBOOT_TIMER(GameServerProtId.UPDATE_REBOOT_TIMER, 2), + SET_HEATMAP_ENABLED(GameServerProtId.SET_HEATMAP_ENABLED, 1), + MINIMAP_TOGGLE(GameServerProtId.MINIMAP_TOGGLE, 1), + SERVER_TICK_END(GameServerProtId.SERVER_TICK_END, 0), + HIDENPCOPS(GameServerProtId.HIDENPCOPS, 1), + HIDEOBJOPS(GameServerProtId.HIDEOBJOPS, 1), + HIDELOCOPS(GameServerProtId.HIDELOCOPS, 1), + SET_INTERACTION_MODE(GameServerProtId.SET_INTERACTION_MODE, 4), + RESET_INTERACTION_MODE(GameServerProtId.RESET_INTERACTION_MODE, 2), + + // Misc. client packets + URL_OPEN(GameServerProtId.URL_OPEN, Prot.VAR_SHORT), + SITE_SETTINGS(GameServerProtId.SITE_SETTINGS, Prot.VAR_BYTE), + UPDATE_UID192(GameServerProtId.UPDATE_UID192, 28), + REFLECTION_CHECKER(GameServerProtId.REFLECTION_CHECKER, Prot.VAR_SHORT), + SEND_PING(GameServerProtId.SEND_PING, 8), + HISCORE_REPLY(GameServerProtId.HISCORE_REPLY, Prot.VAR_SHORT), + PACKET_GROUP_START(GameServerProtId.PACKET_GROUP_START, 2), + + // Unknown packets + UNKNOWN_STRING(GameServerProtId.UNKNOWN_STRING, Prot.VAR_BYTE), + + PACKET_GROUP_END(0xFE, 0), + RECONNECT(0xFF, Prot.VAR_SHORT), +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/GameServerProtId.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/GameServerProtId.kt new file mode 100644 index 00000000..eb1a5be9 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/GameServerProtId.kt @@ -0,0 +1,140 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.prot + +internal object GameServerProtId { + const val NPC_HEADICON_SPECIFIC = 0 + const val LOGOUT_TRANSFER = 1 + const val CLANSETTINGS_FULL = 2 + const val MINIMAP_TOGGLE = 3 + const val CAM_SHAKE = 4 + const val OBJ_ADD = 5 + const val SET_ACTIVE_WORLD = 6 + const val IF_SETCOLOUR = 7 + const val IF_SETHIDE = 8 + const val CAM_RESET = 9 + const val IF_RESYNC = 10 + const val IF_SETMODEL = 11 + const val RUNCLIENTSCRIPT = 12 + const val IF_SETTEXT = 13 + const val HIDEOBJOPS = 14 + const val MESSAGE_FRIENDCHANNEL = 15 + const val CAM_LOOKAT_EASED_COORD = 16 + const val SITE_SETTINGS = 17 + const val CAM_TARGET_V2 = 18 + const val REFLECTION_CHECKER = 19 + const val IF_CLEARINV = 20 + const val IF_SETNPCHEAD_ACTIVE = 21 + const val REBUILD_NORMAL = 22 + const val SERVER_TICK_END = 23 + const val REBUILD_WORLDENTITY = 24 + const val UPDATE_RUNENERGY = 25 + const val VARCLAN_ENABLE = 26 + const val IF_SETNPCHEAD = 27 + const val MIDI_SONG_WITHSECONDARY = 28 + const val CHAT_FILTER_SETTINGS_PRIVATECHAT = 29 + const val UPDATE_UID192 = 30 + const val FRIENDLIST_LOADED = 31 + const val OBJ_COUNT = 32 + const val PLAYER_SPOTANIM_SPECIFIC = 33 + const val HISCORE_REPLY = 34 + const val OBJ_DEL = 35 + const val MESSAGE_PRIVATE = 36 + const val HINT_ARROW = 37 + const val VARP_RESET = 38 + const val UPDATE_FRIENDLIST = 39 + const val CLEAR_ENTITIES = 40 + const val UPDATE_TRADINGPOST = 41 + const val IF_MOVESUB = 42 + const val UPDATE_ZONE_FULL_FOLLOWS = 43 + const val CLANCHANNEL_FULL = 44 + const val VARP_SMALL = 45 + const val PLAYER_INFO = 46 + const val LOC_DEL = 47 + const val UPDATE_RUNWEIGHT = 48 + const val IF_SETANGLE = 49 + const val UPDATE_INV_STOPTRANSMIT = 50 + const val IF_SETPLAYERMODEL_SELF = 51 + const val CAM_ROTATETO = 52 + const val SOUND_AREA = 53 + const val UPDATE_STOCKMARKET_SLOT = 54 + const val CAM_MOVETO = 55 + const val MAP_PROJANIM = 56 + const val SET_NPC_UPDATE_ORIGIN = 57 + const val SET_PLAYER_OP = 58 + const val MESSAGE_CLANCHANNEL_SYSTEM = 59 + const val IF_SETANIM = 60 + const val IF_SETPOSITION = 61 + const val UPDATE_ZONE_PARTIAL_FOLLOWS = 62 + const val CAM_MOVETO_CYCLES = 63 + const val MIDI_SWAP = 64 + const val VARP_LARGE = 65 + const val NPC_ANIM_SPECIFIC = 66 + const val IF_SETPLAYERMODEL_BASECOLOUR = 67 + const val CAM_MODE = 68 + const val UPDATE_ZONE_PARTIAL_ENCLOSED = 69 + const val TRIGGER_ONDIALOGABORT = 70 + const val VARP_SYNC = 71 + const val MIDI_SONG_STOP = 72 + const val REBUILD_REGION = 73 + const val SET_HEATMAP_ENABLED = 74 + const val MAP_ANIM = 75 + const val IF_SETOBJECT = 76 + const val UPDATE_FRIENDCHAT_CHANNEL_SINGLEUSER = 77 + const val NPC_INFO_SMALL_V5 = 78 + const val HIDELOCOPS = 79 + const val RESET_ANIMS = 80 + const val MIDI_JINGLE = 81 + const val UPDATE_IGNORELIST = 82 + const val PLAYER_ANIM_SPECIFIC = 83 + const val URL_OPEN = 84 + const val CAM_MOVETO_ARC = 85 + const val MESSAGE_GAME = 86 + const val IF_SETEVENTS = 87 + const val CLANSETTINGS_DELTA = 88 + const val UPDATE_STAT_V2 = 89 + const val CLANCHANNEL_DELTA = 90 + const val CAM_SMOOTHRESET = 91 + const val IF_SETPLAYERMODEL_BODYTYPE = 92 + const val LOC_ANIM_SPECIFIC = 93 + const val CAM_ROTATEBY = 94 + const val SET_MAP_FLAG = 95 + const val CHAT_FILTER_SETTINGS = 96 + const val NPC_SPOTANIM_SPECIFIC = 97 + const val IF_SETPLAYERHEAD = 98 + const val IF_OPENTOP = 99 + const val OCULUS_SYNC = 100 + const val LOC_MERGE = 101 + const val IF_CLOSESUB = 102 + const val MAP_ANIM_SPECIFIC = 103 + const val MESSAGE_CLANCHANNEL = 104 + const val LOGOUT = 105 + const val UPDATE_INV_FULL = 106 + const val VARCLAN_DISABLE = 107 + const val PROJANIM_SPECIFIC_V3 = 108 + const val UPDATE_FRIENDCHAT_CHANNEL_FULL_V2 = 109 + const val UNKNOWN_STRING = 110 + const val UPDATE_REBOOT_TIMER = 111 + const val IF_SETROTATESPEED = 112 + const val SYNTH_SOUND = 113 + const val VARCLAN = 114 + const val SEND_PING = 115 + const val IF_OPENSUB = 116 + const val CAM_LOOKAT = 117 + const val MESSAGE_PRIVATE_ECHO = 118 + const val LOGOUT_WITHREASON = 119 + const val LOC_ANIM = 120 + const val IF_SETSCROLLPOS = 121 + const val HIDENPCOPS = 122 + const val IF_SETPLAYERMODEL_OBJ = 123 + const val UPDATE_INV_PARTIAL = 124 + const val LOC_ADD_CHANGE = 125 + const val MIDI_SONG_V2 = 126 + const val OBJ_ENABLED_OPS = 127 + const val SET_INTERACTION_MODE = 128 + const val RESET_INTERACTION_MODE = 129 + const val WORLDENTITY_INFO_V3 = 130 + const val OBJ_CUSTOMISE = 131 + const val OBJ_UNCUSTOMISE = 132 + const val WORLDENTITY_INFO_V4 = 133 + const val PACKET_GROUP_START = 134 + const val NPC_INFO_LARGE_V5 = 135 +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt new file mode 100644 index 00000000..853acce7 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt @@ -0,0 +1,315 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.prot + +import net.rsprot.compression.HuffmanCodec +import net.rsprot.protocol.ProtRepository +import net.rsprox.cache.api.CacheProvider +import net.rsprox.protocol.MessageDecoderRepository +import net.rsprox.protocol.MessageDecoderRepositoryBuilder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera.CamLookAtDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera.CamLookAtEasedCoordDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera.CamModeDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera.CamMoveToArcDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera.CamMoveToCyclesDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera.CamMoveToDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera.CamResetDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera.CamRotateBy +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera.CamRotateToDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera.CamShakeDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera.CamSmoothResetDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera.CamTargetV2Decoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.camera.OculusSyncDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.clan.ClanChannelDeltaDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.clan.ClanChannelFullDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.clan.ClanSettingsDeltaDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.clan.ClanSettingsFullDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.clan.MessageClanChannelDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.clan.MessageClanChannelSystemDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.clan.VarClanDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.clan.VarClanDisableDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.clan.VarClanEnableDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.friendchat.MessageFriendChannelDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.friendchat.UpdateFriendChatChannelFullV2Decoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.friendchat.UpdateFriendChatChannelSingleUserDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.info.* +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.info.NpcInfoLargeV5Decoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.info.NpcInfoSmallV5Decoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.info.PlayerInfoDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.info.SetNpcUpdateOriginDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.info.WorldEntityInfoV3Decoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfClearInvDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfCloseSubDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfMoveSubDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfOpenSubDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfOpenTopDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfResyncDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfSetAngleDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfSetAnimDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfSetColourDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfSetEventsDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfSetHideDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfSetModelDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfSetNpcHeadActiveDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfSetNpcHeadDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfSetObjectDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfSetPlayerHeadDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfSetPlayerModelBaseColourDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfSetPlayerModelBodyTypeDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfSetPlayerModelObjDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfSetPlayerModelSelfDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfSetPositionDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfSetRotateSpeedDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfSetScrollPosDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces.IfSetTextDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.inv.UpdateInvFullDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.inv.UpdateInvPartialDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.inv.UpdateInvStopTransmitDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.logout.LogoutDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.logout.LogoutTransferDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.logout.LogoutWithReasonDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.map.RebuildRegionDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.map.RebuildWorldEntityDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.map.ReconnectDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.map.StaticRebuildDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client.* +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client.HideLocOpsDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client.HideNpcOpsDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client.HideObjOpsDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client.HintArrowDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client.HiscoreReplyDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client.MinimapToggleDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client.ReflectionCheckerDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client.ResetAnimsDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client.ResetInteractionModeDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client.SendPingDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client.ServerTickEndDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client.SetHeatmapEnabledDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client.SetInteractionModeDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client.SiteSettingsDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client.UpdateRebootTimerDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client.UpdateUid192Decoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.client.UrlOpenDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player.ChatFilterSettingsDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player.ChatFilterSettingsPrivateChatDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player.MessageGameDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player.RunClientScriptDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player.SetMapFlagDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player.SetPlayerOpDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player.TriggerOnDialogAbortDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player.UpdateRunEnergyDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player.UpdateRunWeightDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player.UpdateStatV2Decoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player.UpdateTradingPostDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.social.FriendListLoadedDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.social.MessagePrivateDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.social.MessagePrivateEchoDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.social.UpdateFriendListDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.social.UpdateIgnoreListDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.sound.MidiJingleDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.sound.MidiSongStopDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.sound.MidiSongV2Decoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.sound.MidiSongWithSecondaryDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.sound.MidiSwapDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.sound.SynthSoundDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.specific.LocAnimSpecificDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.specific.MapAnimSpecificDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.specific.NpcAnimSpecificDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.specific.NpcHeadIconSpecificDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.specific.NpcSpotAnimSpecificDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.specific.PlayerAnimSpecificDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.specific.PlayerSpotAnimSpecificDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.specific.ProjAnimSpecificV3Decoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.unknown.UnknownStringDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.varp.VarpLargeDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.varp.VarpResetDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.varp.VarpSmallDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.varp.VarpSyncDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.worldentity.ClearEntitiesDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.worldentity.SetActiveWorldDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.header.UpdateZoneFullFollowsDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.header.UpdateZonePartialEnclosedDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.header.UpdateZonePartialFollowsDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.LocAddChangeDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.LocAnimDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.LocDelDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.LocMergeDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.MapAnimDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.MapProjAnimDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.ObjAddDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.ObjCountDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.ObjCustomiseDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.ObjDelDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.ObjEnabledOpsDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.ObjUncustomiseDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.SoundAreaDecoder + +internal object ServerMessageDecoderRepository { + @ExperimentalStdlibApi + fun build( + huffmanCodec: HuffmanCodec, + cache: CacheProvider, + ): MessageDecoderRepository { + val protRepository = ProtRepository.of() + val builder = + MessageDecoderRepositoryBuilder( + protRepository, + ).apply { + bind(CamRotateToDecoder()) + bind(CamRotateBy()) + bind(CamLookAtEasedCoordDecoder()) + bind(CamLookAtDecoder()) + bind(CamModeDecoder()) + bind(CamMoveToArcDecoder()) + bind(CamMoveToCyclesDecoder()) + bind(CamMoveToDecoder()) + bind(CamResetDecoder()) + bind(CamShakeDecoder()) + bind(CamSmoothResetDecoder()) + bind(CamTargetV2Decoder()) + bind(OculusSyncDecoder()) + + bind(ClanChannelDeltaDecoder()) + bind(ClanChannelFullDecoder()) + bind(ClanSettingsDeltaDecoder()) + bind(ClanSettingsFullDecoder()) + bind(MessageClanChannelDecoder(huffmanCodec)) + bind(MessageClanChannelSystemDecoder(huffmanCodec)) + bind(VarClanDisableDecoder()) + bind(VarClanEnableDecoder()) + bind(VarClanDecoder()) + + bind(MessageFriendChannelDecoder(huffmanCodec)) + bind(UpdateFriendChatChannelFullV2Decoder()) + bind(UpdateFriendChatChannelSingleUserDecoder()) + + bind(PlayerInfoDecoder()) + bind(NpcInfoSmallV5Decoder()) + bind(NpcInfoLargeV5Decoder()) + bind(SetNpcUpdateOriginDecoder()) + bind(WorldEntityInfoV3Decoder()) + bind(WorldEntityInfoV4Decoder()) + + bind(IfClearInvDecoder()) + bind(IfCloseSubDecoder()) + bind(IfResyncDecoder()) + bind(IfMoveSubDecoder()) + bind(IfOpenSubDecoder()) + bind(IfOpenTopDecoder()) + bind(IfSetAngleDecoder()) + bind(IfSetAnimDecoder()) + bind(IfSetColourDecoder()) + bind(IfSetEventsDecoder()) + bind(IfSetHideDecoder()) + bind(IfSetModelDecoder()) + bind(IfSetNpcHeadActiveDecoder()) + bind(IfSetNpcHeadDecoder()) + bind(IfSetObjectDecoder()) + bind(IfSetPlayerHeadDecoder()) + bind(IfSetPlayerModelBaseColourDecoder()) + bind(IfSetPlayerModelBodyTypeDecoder()) + bind(IfSetPlayerModelObjDecoder()) + bind(IfSetPlayerModelSelfDecoder()) + bind(IfSetPositionDecoder()) + bind(IfSetRotateSpeedDecoder()) + bind(IfSetScrollPosDecoder()) + bind(IfSetTextDecoder()) + + bind(UpdateInvFullDecoder()) + bind(UpdateInvPartialDecoder()) + bind(UpdateInvStopTransmitDecoder()) + + bind(LogoutDecoder()) + bind(LogoutTransferDecoder()) + bind(LogoutWithReasonDecoder()) + + bind(ReconnectDecoder()) + bind(StaticRebuildDecoder(huffmanCodec, cache)) + bind(RebuildRegionDecoder()) + bind(RebuildWorldEntityDecoder()) + + bind(SetHeatmapEnabledDecoder()) + bind(HideLocOpsDecoder()) + bind(HideNpcOpsDecoder()) + bind(HideObjOpsDecoder()) + bind(SetInteractionModeDecoder()) + bind(ResetInteractionModeDecoder()) + bind(HintArrowDecoder()) + bind(HiscoreReplyDecoder()) + bind(MinimapToggleDecoder()) + bind(ReflectionCheckerDecoder()) + bind(ResetAnimsDecoder()) + bind(SendPingDecoder()) + bind(ServerTickEndDecoder()) + bind(UpdateRebootTimerDecoder()) + bind(SiteSettingsDecoder()) + bind(UpdateUid192Decoder()) + bind(UrlOpenDecoder()) + bind(PacketGroupStartDecoder()) + bind(PacketGroupEndDecoder()) + + bind(ChatFilterSettingsDecoder()) + bind(ChatFilterSettingsPrivateChatDecoder()) + bind(MessageGameDecoder()) + bind(RunClientScriptDecoder()) + bind(SetMapFlagDecoder()) + bind(SetPlayerOpDecoder()) + bind(TriggerOnDialogAbortDecoder()) + bind(UpdateRunEnergyDecoder()) + bind(UpdateRunWeightDecoder()) + bind(UpdateStatV2Decoder()) + bind(UpdateStockMarketSlotDecoder()) + bind(UpdateTradingPostDecoder()) + + bind(FriendListLoadedDecoder()) + bind(MessagePrivateEchoDecoder(huffmanCodec)) + bind(MessagePrivateDecoder(huffmanCodec)) + bind(UpdateFriendListDecoder()) + bind(UpdateIgnoreListDecoder()) + + bind(MidiJingleDecoder()) + bind(MidiSongV2Decoder()) + bind(MidiSongStopDecoder()) + bind(MidiSongWithSecondaryDecoder()) + bind(MidiSwapDecoder()) + bind(SynthSoundDecoder()) + + bind(LocAnimSpecificDecoder()) + bind(MapAnimSpecificDecoder()) + bind(NpcAnimSpecificDecoder()) + bind(NpcHeadIconSpecificDecoder()) + bind(NpcSpotAnimSpecificDecoder()) + bind(PlayerAnimSpecificDecoder()) + bind(PlayerSpotAnimSpecificDecoder()) + bind(ProjAnimSpecificV3Decoder()) + + bind(VarpLargeDecoder()) + bind(VarpResetDecoder()) + bind(VarpSmallDecoder()) + bind(VarpSyncDecoder()) + + bind(ClearEntitiesDecoder()) + bind(SetActiveWorldDecoder()) + + bind(UpdateZonePartialEnclosedDecoder()) + bind(UpdateZoneFullFollowsDecoder()) + bind(UpdateZonePartialFollowsDecoder()) + + bind(LocAddChangeDecoder()) + bind(LocAnimDecoder()) + bind(LocDelDecoder()) + bind(LocMergeDecoder()) + bind(MapAnimDecoder()) + bind(MapProjAnimDecoder()) + bind(ObjAddDecoder()) + bind(ObjCountDecoder()) + bind(ObjDelDecoder()) + bind(ObjEnabledOpsDecoder()) + bind(SoundAreaDecoder()) + bind(ObjCustomiseDecoder()) + bind(ObjUncustomiseDecoder()) + + bind(UnknownStringDecoder()) + } + return builder.build() + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/npcinfo/NpcInfoClient.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/npcinfo/NpcInfoClient.kt new file mode 100644 index 00000000..18a56eba --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/npcinfo/NpcInfoClient.kt @@ -0,0 +1,869 @@ +package net.rsprox.protocol.v228.game.outgoing.model.info.npcinfo + +import io.netty.buffer.ByteBuf +import net.rsprot.buffer.JagByteBuf +import net.rsprot.buffer.bitbuffer.BitBuf +import net.rsprot.buffer.bitbuffer.toBitBuf +import net.rsprot.buffer.extensions.toJagByteBuf +import net.rsprox.cache.api.CacheProvider +import net.rsprox.protocol.common.CoordGrid +import net.rsprox.protocol.exceptions.DecodeError +import net.rsprox.protocol.game.outgoing.model.info.npcinfo.MoveSpeed +import net.rsprox.protocol.game.outgoing.model.info.npcinfo.NpcInfo +import net.rsprox.protocol.game.outgoing.model.info.npcinfo.NpcInfoDecoder +import net.rsprox.protocol.game.outgoing.model.info.npcinfo.NpcUpdateType +import net.rsprox.protocol.game.outgoing.model.info.npcinfo.extendedinfo.BaseAnimationSetExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.npcinfo.extendedinfo.BodyCustomisationExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.npcinfo.extendedinfo.CombatLevelChangeExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.npcinfo.extendedinfo.EnabledOpsExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.npcinfo.extendedinfo.FaceCoordExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.npcinfo.extendedinfo.HeadCustomisationExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.npcinfo.extendedinfo.HeadIconCustomisationExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.npcinfo.extendedinfo.NameChangeExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.npcinfo.extendedinfo.TransformationExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.npcinfo.extendedinfo.customisation.ModelCustomisation +import net.rsprox.protocol.game.outgoing.model.info.npcinfo.extendedinfo.customisation.ResetCustomisation +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.ExactMoveExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.ExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.FacePathingEntityExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.Headbar +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.Hit +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.HitExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.SayExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.SequenceExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.Spotanim +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.SpotanimExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.TintingExtendedInfo + +@Suppress("DuplicatedCode") +internal class NpcInfoClient( + val cache: CacheProvider, +) : NpcInfoDecoder { + private var deletedNPCCount: Int = 0 + private var deletedNPC = IntArray(1000) + private var npc = arrayOfNulls(65536) + private var transmittedNPCCount = 0 + private var transmittedNPC = IntArray(65536) + private var extraUpdateNPCCount: Int = 0 + private var extraUpdateNPC: IntArray = IntArray(250) + private var cycle = 0 + + private val updates: MutableMap = mutableMapOf() + private val extendedInfoBlocks: MutableMap> = mutableMapOf() + + override fun decode( + buffer: ByteBuf, + large: Boolean, + baseCoord: CoordGrid, + ): NpcInfo { + deletedNPCCount = 0 + extraUpdateNPCCount = 0 + buffer.toBitBuf().use { bitBuffer -> + processHighResolution(bitBuffer) + processLowResolution(large, bitBuffer, baseCoord) + } + processExtendedInfo(buffer.toJagByteBuf()) + for (i in 0..() + for ((index, update) in updates) { + when (update) { + UpdateType.IDLE -> { + // Too spammy, continue + continue + } + UpdateType.LOW_RESOLUTION_TO_HIGH_RESOLUTION -> { + val npc = checkNotNull(npc[index]) + val extendedInfo = this.extendedInfoBlocks[index] ?: emptyList() + result[index] = + NpcUpdateType.LowResolutionToHighResolution( + npc.id, + npc.spawnCycle, + npc.coord.x, + npc.coord.z, + npc.coord.level, + npc.angle, + npc.jump, + extendedInfo, + ) + } + UpdateType.HIGH_RESOLUTION_TO_LOW_RESOLUTION -> { + result[index] = NpcUpdateType.HighResolutionToLowResolution + } + UpdateType.ACTIVE -> { + val npc = checkNotNull(npc[index]) + val extendedInfo = this.extendedInfoBlocks[index] ?: emptyList() + result[index] = + NpcUpdateType.Active( + npc.coord.x, + npc.coord.z, + npc.coord.level, + npc.steps, + npc.moveSpeed, + extendedInfo, + npc.jump, + ) + } + } + } + this.updates.clear() + this.extendedInfoBlocks.clear() + return NpcInfo(result) + } + + private fun processExtendedInfo(buffer: JagByteBuf) { + for (i in 0..() + + this.extendedInfoBlocks[index] = blocks + + if (flag and OLD_SPOTANIM_UNUSED != 0) { + throw IllegalStateException("Old spotanim used!") + } + if (flag and HEADICON_CUSTOMISATION != 0) { + decodeHeadiconCustomisation(buffer, blocks) + } + if (flag and TRANSFORMATION != 0) { + decodeTransformation(buffer, blocks, npc) + } + if (flag and FACE_COORD != 0) { + decodeFaceCoord(buffer, blocks) + } + if (flag and FACE_PATHINGENTITY != 0) { + decodeFacePathingEntity(buffer, blocks) + } + if (flag and LEVEL_CHANGE != 0) { + decodeCombatLevelChange(buffer, blocks) + } + if (flag and NAME_CHANGE != 0) { + decodeNameChange(buffer, blocks) + } + if (flag and EXACT_MOVE != 0) { + decodeExactMove(buffer, blocks) + } + if (flag and HEAD_CUSTOMISATION != 0) { + decodeHeadCustomisation(npc.id, buffer, blocks) + } + if (flag and BODY_CUSTOMISATION != 0) { + decodeBodyCustomisation(npc.id, buffer, blocks) + } + if (flag and TINTING != 0) { + decodeTinting(buffer, blocks) + } + if (flag and SPOTANIM != 0) { + decodeSpotanim(buffer, blocks) + } + if (flag and SAY != 0) { + decodeSay(buffer, blocks) + } + if (flag and OPS != 0) { + decodeEnabledOps(buffer, blocks) + } + if (flag and SEQUENCE != 0) { + decodeSequence(buffer, blocks) + } + if (flag and BAS_CHANGE != 0) { + decodeBaseAnimationSet(buffer, blocks) + } + if (flag and HITS != 0) { + decodeHits(buffer, blocks) + } + } + } + + private fun decodeBaseAnimationSet( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val flag = buffer.g4Alt1() + val turnLeftAnim = if (flag and 0x1 != 0) buffer.g2Alt2() else null + val turnRightAnim = if (flag and 0x2 != 0) buffer.g2() else null + val walkAnim = if (flag and 0x4 != 0) buffer.g2() else null + val walkAnimBack = if (flag and 0x8 != 0) buffer.g2Alt3() else null + val walkAnimLeft = if (flag and 0x10 != 0) buffer.g2Alt2() else null + val walkAnimRight = if (flag and 0x20 != 0) buffer.g2Alt3() else null + val runAnim = if (flag and 0x40 != 0) buffer.g2Alt2() else null + val runAnimBack = if (flag and 0x80 != 0) buffer.g2Alt2() else null + val runAnimLeft = if (flag and 0x100 != 0) buffer.g2Alt3() else null + val runAnimRight = if (flag and 0x200 != 0) buffer.g2() else null + val crawlAnim = if (flag and 0x400 != 0) buffer.g2Alt2() else null + val crawlAnimBack = if (flag and 0x800 != 0) buffer.g2() else null + val crawlAnimLeft = if (flag and 0x1000 != 0) buffer.g2Alt3() else null + val crawlAnimRight = if (flag and 0x2000 != 0) buffer.g2Alt3() else null + val readyAnim = if (flag and 0x4000 != 0) buffer.g2Alt1() else null + blocks += + BaseAnimationSetExtendedInfo( + turnLeftAnim, + turnRightAnim, + walkAnim, + walkAnimBack, + walkAnimLeft, + walkAnimRight, + runAnim, + runAnimBack, + runAnimLeft, + runAnimRight, + crawlAnim, + crawlAnimBack, + crawlAnimLeft, + crawlAnimRight, + readyAnim, + ) + } + + private fun decodeHits( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val hitCount = buffer.g1Alt1() + val hits = ArrayList(hitCount) + for (i in 0.. { + val delay = buffer.gSmart1or2() + hits += + Hit( + 0x7FFE, + -1, + -1, + -1, + delay, + ) + } + 0x7FFF -> { + val mainType = buffer.gSmart1or2() + val value = buffer.gSmart1or2() + val soakType = buffer.gSmart1or2() + val soakValue = buffer.gSmart1or2() + val delay = buffer.gSmart1or2() + hits += + Hit( + mainType, + value, + soakType, + soakValue, + delay, + ) + } + else -> { + val value = buffer.gSmart1or2() + val delay = buffer.gSmart1or2() + hits += + Hit( + type, + value, + -1, + -1, + delay, + ) + } + } + } + + val headbarCount = buffer.g1Alt1() + val headbars = ArrayList(headbarCount) + for (i in 0.. 0) { + buffer.g1() + } else { + startFill + } + headbars += + Headbar( + type, + startFill, + endFill, + startTime, + endTime, + ) + } + blocks += HitExtendedInfo(hits, headbars) + } + + private fun decodeSpotanim( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val spotanims = mutableMapOf() + val count = buffer.g1Alt2() + for (i in 0.., + ) { + val id = buffer.g2Alt3() + val delay = buffer.g1() + blocks += SequenceExtendedInfo(id, delay) + } + + private fun decodeCombatLevelChange( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val level = buffer.g4Alt1() + blocks += CombatLevelChangeExtendedInfo(level) + } + + private fun decodeTinting( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val start = buffer.g2() + val end = buffer.g2Alt3() + val hue = buffer.g1Alt1() + val saturation = buffer.g1Alt3() + val lightness = buffer.g1Alt3() + val weight = buffer.g1Alt2() + blocks += + TintingExtendedInfo( + start, + end, + hue, + saturation, + lightness, + weight, + ) + } + + private fun decodeTransformation( + buffer: JagByteBuf, + blocks: MutableList, + npc: Npc, + ) { + val id = buffer.g2Alt1() + blocks += TransformationExtendedInfo(id) + npc.id = id + } + + private fun decodeEnabledOps( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val flag = buffer.g1Alt2() + blocks += EnabledOpsExtendedInfo(flag) + } + + private fun decodeFacePathingEntity( + buffer: JagByteBuf, + blocks: MutableList, + ) { + var index = buffer.g2Alt3() + index += buffer.g1Alt2() shl 16 + blocks += FacePathingEntityExtendedInfo(index) + } + + private fun decodeBodyCustomisation( + id: Int, + buffer: JagByteBuf, + blocks: MutableList, + ) { + val flag = buffer.g1Alt3() + if (flag and 0x1 != 0) { + blocks += BodyCustomisationExtendedInfo(ResetCustomisation) + return + } + val models = + if (flag and 0x2 != 0) { + val count = buffer.g1() + val models = ArrayList(count) + for (i in 0..(length) + for (i in 0..(length) + for (i in 0.., + ) { + val flag = buffer.g1Alt1() + if (flag and 0x1 != 0) { + blocks += BodyCustomisationExtendedInfo(ResetCustomisation) + return + } + val models = + if (flag and 0x2 != 0) { + val count = buffer.g1() + val models = ArrayList(count) + for (i in 0..(length) + for (i in 0..(length) + for (i in 0.., + ) { + val text = buffer.gjstr() + blocks += SayExtendedInfo(text) + } + + private fun decodeExactMove( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val deltaX1 = buffer.g1sAlt3() + val deltaZ1 = buffer.g1s() + val deltaX2 = buffer.g1sAlt1() + val deltaZ2 = buffer.g1sAlt3() + val delay1 = buffer.g2Alt2() + val delay2 = buffer.g2() + val direction = buffer.g2Alt3() + blocks += + ExactMoveExtendedInfo( + deltaX1, + deltaZ1, + delay1, + deltaX2, + deltaZ2, + delay2, + direction, + ) + } + + private fun decodeNameChange( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val text = buffer.gjstr() + blocks += NameChangeExtendedInfo(text) + } + + private fun decodeHeadiconCustomisation( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val flag = buffer.g1Alt2() + val groups = IntArray(8) + val indices = IntArray(8) + for (i in 0..<8) { + if (flag and (1 shl i) != 0) { + groups[i] = buffer.gSmart2or4null() + indices[i] = buffer.gSmart1or2null() + } else { + groups[i] = -1 + indices[i] = -1 + } + } + blocks += HeadIconCustomisationExtendedInfo(groups, indices) + } + + private fun decodeFaceCoord( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val x = buffer.g2Alt1() + val z = buffer.g2Alt2() + val instant = buffer.g1Alt2() == 1 + blocks += FaceCoordExtendedInfo(x, z, instant) + } + + private fun processHighResolution(buffer: BitBuf) { + val count = buffer.gBits(8) + if (count < transmittedNPCCount) { + for (i in count.. { + transmittedNPC[transmittedNPCCount++] = index + npc.lastTransmitCycle = cycle + extraUpdateNPC[extraUpdateNPCCount++] = index + updates[index] = UpdateType.ACTIVE + } + 1 -> { + transmittedNPC[transmittedNPCCount++] = index + npc.lastTransmitCycle = cycle + val walkDirection = buffer.gBits(3) + npc.addRouteWaypointAdjacent( + walkDirection, + MoveSpeed.WALK, + ) + val extendedInfo = buffer.gBits(1) + if (extendedInfo == 1) { + this.extraUpdateNPC[extraUpdateNPCCount++] = index + } + updates[index] = UpdateType.ACTIVE + } + 2 -> { + transmittedNPC[transmittedNPCCount++] = index + npc.lastTransmitCycle = cycle + if (buffer.gBits(1) == 1) { + val walkDirection = buffer.gBits(3) + npc.addRouteWaypointAdjacent( + walkDirection, + MoveSpeed.RUN, + ) + val runDirection = buffer.gBits(3) + npc.addRouteWaypointAdjacent( + runDirection, + MoveSpeed.RUN, + ) + } else { + val crawlDirection = buffer.gBits(3) + npc.addRouteWaypointAdjacent( + crawlDirection, + MoveSpeed.CRAWL, + ) + } + val extendedInfo = buffer.gBits(1) + if (extendedInfo == 1) { + this.extraUpdateNPC[extraUpdateNPCCount++] = index + } + updates[index] = UpdateType.ACTIVE + } + 3 -> { + deletedNPC[deletedNPCCount++] = index + updates[index] = UpdateType.HIGH_RESOLUTION_TO_LOW_RESOLUTION + } + } + } + } + + private fun processLowResolution( + large: Boolean, + buffer: BitBuf, + baseCoord: CoordGrid, + ) { + while (true) { + val indexBitCount = 16 + val capacity = (1 shl indexBitCount) + if (buffer.readableBits() >= indexBitCount + 12) { + val index = buffer.gBits(indexBitCount) + if (capacity - 1 != index) { + var isNew = false + if (npc[index] == null) { + npc[index] = Npc(-1, CoordGrid.INVALID) + isNew = true + } + val existingType = updates[index] + if (existingType == UpdateType.HIGH_RESOLUTION_TO_LOW_RESOLUTION) { + // Teleport + updates[index] = UpdateType.ACTIVE + } else { + updates[index] = UpdateType.LOW_RESOLUTION_TO_HIGH_RESOLUTION + } + val npc = checkNotNull(npc[index]) + transmittedNPC[transmittedNPCCount++] = index + npc.lastTransmitCycle = cycle + + val deltaX = decodeDelta(large, buffer) + val jump = buffer.gBits(1) + val deltaZ = decodeDelta(large, buffer) + npc.id = buffer.gBits(14) + val hasSpawnCycle = buffer.gBits(1) == 1 + if (hasSpawnCycle) { + npc.spawnCycle = buffer.gBits(32) + } + val extendedInfo = buffer.gBits(1) + if (extendedInfo == 1) { + this.extraUpdateNPC[extraUpdateNPCCount++] = index + } + val angle = NPC_TURN_ANGLES[buffer.gBits(3)] + if (isNew) { + npc.turnAngle = angle + npc.angle = angle + } + // reset bas + if (npc.turnSpeed == 0) { + npc.angle = 0 + } + npc.addRouteWaypoint( + baseCoord, + deltaX, + deltaZ, + jump == 1, + ) + continue + } + } + return + } + } + + private fun decodeDelta( + large: Boolean, + buffer: BitBuf, + ): Int = + if (large) { + var delta = buffer.gBits(8) + if (delta > 127) { + delta -= 256 + } + delta + } else { + var delta = buffer.gBits(6) + if (delta > 31) { + delta -= 64 + } + delta + } + + private class Npc( + var id: Int, + var coord: CoordGrid, + ) { + var lastTransmitCycle: Int = 0 + var moveSpeed: MoveSpeed = MoveSpeed.STATIONARY + var turnAngle = 0 + var angle = 0 + var spawnCycle = 0 + var turnSpeed = 32 + var jump: Boolean = false + var steps: MutableList = mutableListOf() + + fun addRouteWaypoint( + baseCoord: CoordGrid, + relativeX: Int, + relativeZ: Int, + jump: Boolean, + ) { + coord = CoordGrid(baseCoord.level, baseCoord.x + relativeX, baseCoord.z + relativeZ) + moveSpeed = MoveSpeed.STATIONARY + this.jump = jump + } + + fun addRouteWaypointAdjacent( + opcode: Int, + speed: MoveSpeed, + ) { + steps += opcode + var x = coord.x + var z = coord.z + if (opcode == 0) { + --x + ++z + } + + if (opcode == 1) { + ++z + } + + if (opcode == 2) { + ++x + ++z + } + + if (opcode == 3) { + --x + } + + if (opcode == 4) { + ++x + } + + if (opcode == 5) { + --x + --z + } + + if (opcode == 6) { + --z + } + + if (opcode == 7) { + ++x + --z + } + + coord = CoordGrid(coord.level, x, z) + moveSpeed = speed + } + } + + private companion object { + private val NPC_TURN_ANGLES = intArrayOf(768, 1024, 1280, 512, 1536, 256, 0, 1792) + private const val SEQUENCE: Int = 0x1 + private const val EXTENDED_SHORT: Int = 0x2 + private const val HITS: Int = 0x4 + private const val OLD_SPOTANIM_UNUSED: Int = 0x8 + private const val FACE_COORD: Int = 0x10 + private const val FACE_PATHINGENTITY: Int = 0x20 + private const val SAY: Int = 0x40 + private const val TRANSFORMATION: Int = 0x80 + private const val EXTENDED_MEDIUM: Int = 0x100 + private const val BODY_CUSTOMISATION: Int = 0x200 + private const val TINTING: Int = 0x400 + private const val LEVEL_CHANGE: Int = 0x800 + private const val HEAD_CUSTOMISATION: Int = 0x1000 + private const val NAME_CHANGE: Int = 0x2000 + private const val EXACT_MOVE: Int = 0x4000 + private const val OPS: Int = 0x8000 + private const val SPOTANIM: Int = 0x10000 + private const val BAS_CHANGE: Int = 0x20000 + private const val HEADICON_CUSTOMISATION: Int = 0x40000 + + private enum class UpdateType { + IDLE, + LOW_RESOLUTION_TO_HIGH_RESOLUTION, + HIGH_RESOLUTION_TO_LOW_RESOLUTION, + ACTIVE, + } + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt new file mode 100644 index 00000000..826bedd3 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt @@ -0,0 +1,1069 @@ +package net.rsprox.protocol.v228.game.outgoing.model.info.playerinfo + +import io.netty.buffer.ByteBuf +import io.netty.buffer.Unpooled +import net.rsprot.buffer.JagByteBuf +import net.rsprot.buffer.bitbuffer.BitBuf +import net.rsprot.buffer.bitbuffer.toBitBuf +import net.rsprot.buffer.extensions.toJagByteBuf +import net.rsprot.compression.HuffmanCodec +import net.rsprox.protocol.common.CoordGrid +import net.rsprox.protocol.game.outgoing.model.info.playerinfo.PlayerInfo +import net.rsprox.protocol.game.outgoing.model.info.playerinfo.PlayerInfoDecoder +import net.rsprox.protocol.game.outgoing.model.info.playerinfo.PlayerUpdateType +import net.rsprox.protocol.game.outgoing.model.info.playerinfo.extendedinfo.AppearanceExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.playerinfo.extendedinfo.ChatExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.playerinfo.extendedinfo.FaceAngleExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.playerinfo.extendedinfo.MoveSpeedExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.playerinfo.extendedinfo.NameExtrasExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.playerinfo.extendedinfo.ObjTypeCustomisation +import net.rsprox.protocol.game.outgoing.model.info.playerinfo.extendedinfo.TemporaryMoveSpeedExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.playerinfo.util.LowResolutionPosition +import net.rsprox.protocol.game.outgoing.model.info.playerinfo.util.PlayerInfoInitBlock +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.ExactMoveExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.ExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.FacePathingEntityExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.Headbar +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.Hit +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.HitExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.SayExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.SequenceExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.Spotanim +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.SpotanimExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.TintingExtendedInfo + +@Suppress("DuplicatedCode") +internal class PlayerInfoClient( + private val localIndex: Int, + private val huffmanCodec: HuffmanCodec, +) : PlayerInfoDecoder { + private var extendedInfoCount: Int = 0 + private val extendedInfoIndices: IntArray = IntArray(2048) + private var highResolutionCount: Int = 0 + private val highResolutionIndices: IntArray = IntArray(2048) + private var lowResolutionCount: Int = 0 + private val lowResolutionIndices: IntArray = IntArray(2048) + private val unmodifiedFlags: ByteArray = ByteArray(2048) + private val cachedPlayers: Array = arrayOfNulls(2048) + private val lowResolutionPositions: IntArray = IntArray(2048) + private val updateTypes: Array = + Array(2048) { + UpdateType.LOW_RESOLUTION_IDLE + } + + override fun gpiInit(initBlock: PlayerInfoInitBlock) { + val localPlayer = Player() + cachedPlayers[localIndex] = localPlayer + localPlayer.coord = initBlock.localPlayerCoord + highResolutionCount = 0 + highResolutionIndices[highResolutionCount++] = localIndex + unmodifiedFlags[localIndex] = 0 + lowResolutionCount = 0 + for (idx in 1..<2048) { + if (idx == localIndex) continue + val packed = initBlock.getLowResolutionPosition(idx).packed + val level = packed shr 16 + val x = packed shr 8 and 597 + val z = packed and 597 + lowResolutionPositions[idx] = CoordGrid(level, x, z).packed + lowResolutionIndices[lowResolutionCount++] = idx + unmodifiedFlags[idx] = 0 + } + } + + override fun reset() { + for (i in cachedPlayers.indices) { + cachedPlayers[i] = null + } + highResolutionCount = 0 + lowResolutionCount = 0 + unmodifiedFlags.fill(0) + lowResolutionPositions.fill(0) + lowResolutionIndices.fill(0) + } + + override fun decode(buffer: ByteBuf): PlayerInfo { + extendedInfoCount = 0 + updateTypes.fill(UpdateType.LOW_RESOLUTION_IDLE) + for (player in cachedPlayers) { + player?.extendedInfoBlocks = emptyList() + } + val updates = mutableMapOf() + decodeBitCodes(buffer) + for ((index, updateType) in updateTypes.withIndex()) { + when (updateType) { + UpdateType.LOW_RESOLUTION_IDLE -> { + // updates[index] = PlayerUpdateType.LowResolutionIdle + // ^Ignore these as they are too spammy + } + UpdateType.HIGH_RESOLUTION_IDLE -> { + val player = checkNotNull(cachedPlayers[index]) + updates[index] = PlayerUpdateType.HighResolutionIdle(player.extendedInfoBlocks) + } + UpdateType.LOW_RESOLUTION_TO_HIGH_RESOLUTION -> { + val player = checkNotNull(cachedPlayers[index]) + updates[index] = + PlayerUpdateType.LowResolutionToHighResolution( + player.coord, + player.extendedInfoBlocks, + ) + } + UpdateType.HIGH_RESOLUTION_MOVEMENT -> { + val player = checkNotNull(cachedPlayers[index]) + updates[index] = + PlayerUpdateType.HighResolutionMovement( + player.coord, + player.extendedInfoBlocks, + ) + } + UpdateType.LOW_RESOLUTION_MOVEMENT -> { + val coord = CoordGrid(this.lowResolutionPositions[index]) + val lowResX = coord.x + val lowResZ = coord.z + val level = coord.level + updates[index] = + PlayerUpdateType.LowResolutionMovement( + LowResolutionPosition( + lowResX, + lowResZ, + level, + ), + ) + } + UpdateType.HIGH_RESOLUTION_TO_LOW_RESOLUTION -> { + val coord = CoordGrid(this.lowResolutionPositions[index]) + val lowResX = coord.x + val lowResZ = coord.z + val level = coord.level + updates[index] = + PlayerUpdateType.HighResolutionToLowResolution( + LowResolutionPosition( + lowResX, + lowResZ, + level, + ), + ) + } + } + } + return PlayerInfo(updates) + } + + private fun setUpdateType( + idx: Int, + updateType: UpdateType, + ) { + this.updateTypes[idx] = updateType + } + + private fun decodeBitCodes(byteBuf: ByteBuf) { + byteBuf.toBitBuf().use { buffer -> + var skipped = 0 + for (i in 0.. 0) { + --skipped + setUpdateType(idx, UpdateType.HIGH_RESOLUTION_IDLE) + unmodifiedFlags[idx] = (unmodifiedFlags[idx].toInt() or NEXT_CYCLE_INACTIVE).toByte() + } else { + val active = buffer.gBits(1) + if (active == 0) { + skipped = readStationary(buffer) + setUpdateType(idx, UpdateType.HIGH_RESOLUTION_IDLE) + unmodifiedFlags[idx] = (unmodifiedFlags[idx].toInt() or NEXT_CYCLE_INACTIVE).toByte() + } else { + getHighResolutionPlayerPosition(buffer, idx) + } + } + } + } + if (skipped != 0) { + throw RuntimeException() + } + } + byteBuf.toBitBuf().use { buffer -> + var skipped = 0 + for (i in 0.. 0) { + --skipped + setUpdateType(idx, UpdateType.HIGH_RESOLUTION_IDLE) + unmodifiedFlags[idx] = (unmodifiedFlags[idx].toInt() or NEXT_CYCLE_INACTIVE).toByte() + } else { + val active = buffer.gBits(1) + if (active == 0) { + skipped = readStationary(buffer) + setUpdateType(idx, UpdateType.HIGH_RESOLUTION_IDLE) + unmodifiedFlags[idx] = (unmodifiedFlags[idx].toInt() or NEXT_CYCLE_INACTIVE).toByte() + } else { + getHighResolutionPlayerPosition(buffer, idx) + } + } + } + } + if (skipped != 0) { + throw RuntimeException() + } + } + + byteBuf.toBitBuf().use { buffer -> + var skipped = 0 + for (i in 0.. 0) { + --skipped + setUpdateType(idx, UpdateType.LOW_RESOLUTION_IDLE) + unmodifiedFlags[idx] = (unmodifiedFlags[idx].toInt() or NEXT_CYCLE_INACTIVE).toByte() + } else { + val active = buffer.gBits(1) + if (active == 0) { + skipped = readStationary(buffer) + setUpdateType(idx, UpdateType.LOW_RESOLUTION_IDLE) + unmodifiedFlags[idx] = (unmodifiedFlags[idx].toInt() or NEXT_CYCLE_INACTIVE).toByte() + } else if (getLowResolutionPlayerPosition(buffer, idx)) { + unmodifiedFlags[idx] = (unmodifiedFlags[idx].toInt() or NEXT_CYCLE_INACTIVE).toByte() + } + } + } + } + if (skipped != 0) { + throw RuntimeException() + } + } + byteBuf.toBitBuf().use { buffer -> + var skipped = 0 + for (i in 0.. 0) { + --skipped + setUpdateType(idx, UpdateType.LOW_RESOLUTION_IDLE) + unmodifiedFlags[idx] = (unmodifiedFlags[idx].toInt() or NEXT_CYCLE_INACTIVE).toByte() + } else { + val active = buffer.gBits(1) + if (active == 0) { + skipped = readStationary(buffer) + setUpdateType(idx, UpdateType.LOW_RESOLUTION_IDLE) + unmodifiedFlags[idx] = (unmodifiedFlags[idx].toInt() or NEXT_CYCLE_INACTIVE).toByte() + } else if (getLowResolutionPlayerPosition(buffer, idx)) { + unmodifiedFlags[idx] = (unmodifiedFlags[idx].toInt() or NEXT_CYCLE_INACTIVE).toByte() + } + } + } + } + if (skipped != 0) { + throw RuntimeException() + } + } + lowResolutionCount = 0 + highResolutionCount = 0 + for (i in 1..<2048) { + unmodifiedFlags[i] = (unmodifiedFlags[i].toInt() shr 1).toByte() + val cachedPlayer = cachedPlayers[i] + if (cachedPlayer != null) { + highResolutionIndices[highResolutionCount++] = i + } else { + lowResolutionIndices[lowResolutionCount++] = i + } + } + decodeExtendedInfo(byteBuf.toJagByteBuf()) + } + + private fun decodeExtendedInfo(buffer: JagByteBuf) { + for (i in 0..() + player.extendedInfoBlocks = blocks + decodeExtendedInfoBlocks(buffer, flag, blocks) + } + } + + private fun decodeExtendedInfoBlocks( + buffer: JagByteBuf, + flags: Int, + blocks: MutableList, + ) { + if (flags and CHAT != 0) { + decodeChat(buffer, blocks) + } + if (flags and TEMP_MOVE_SPEED != 0) { + decodeTemporaryMoveSpeed(buffer, blocks) + } + if (flags and FACE_PATHINGENTITY != 0) { + decodeFacePathingEntity(buffer, blocks) + } + if (flags and CHAT_OLD != 0) { + throw IllegalStateException("Old chat used!") + } + if (flags and MOVE_SPEED != 0) { + decodeMoveSpeed(buffer, blocks) + } + if (flags and HITS != 0) { + decodeHit(buffer, blocks) + } + if (flags and SAY != 0) { + decodeSay(buffer, blocks) + } + if (flags and SEQUENCE != 0) { + decodeSequence(buffer, blocks) + } + if (flags and NAME_EXTRAS != 0) { + decodeNameExtras(buffer, blocks) + } + if (flags and APPEARANCE != 0) { + val len = buffer.g1Alt2() + val data = ByteArray(len) + buffer.gdata(data) + decodeAppearance(Unpooled.wrappedBuffer(data).toJagByteBuf(), blocks) + } + if (flags and SPOTANIM != 0) { + decodeSpotanims(buffer, blocks) + } + if (flags and TINTING != 0) { + decodeTinting(buffer, blocks) + } + if (flags and EXACT_MOVE != 0) { + decodeExactMove(buffer, blocks) + } + if (flags and FACE_ANGLE != 0) { + decodeFaceAngle(buffer, blocks) + } + } + + private fun decodeMoveSpeed( + buffer: JagByteBuf, + blocks: MutableList, + ) { + blocks += MoveSpeedExtendedInfo(buffer.g1Alt3()) + } + + private fun decodeTemporaryMoveSpeed( + buffer: JagByteBuf, + blocks: MutableList, + ) { + blocks += TemporaryMoveSpeedExtendedInfo(buffer.g1Alt1()) + } + + private fun decodeSequence( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val id = buffer.g2Alt2() + val delay = buffer.g1Alt1() + blocks += SequenceExtendedInfo(id, delay) + } + + private fun decodeFacePathingEntity( + buffer: JagByteBuf, + blocks: MutableList, + ) { + var index = buffer.g2Alt3() + index += buffer.g1() shl 16 + blocks += FacePathingEntityExtendedInfo(index) + } + + private fun decodeFaceAngle( + buffer: JagByteBuf, + blocks: MutableList, + ) { + blocks += FaceAngleExtendedInfo(buffer.g2()) + } + + private fun decodeSay( + buffer: JagByteBuf, + blocks: MutableList, + ) { + blocks += SayExtendedInfo(buffer.gjstr()) + } + + private fun decodeNameExtras( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val beforeName = buffer.gjstr() + val afterName = buffer.gjstr() + val afterCombatLevel = buffer.gjstr() + blocks += NameExtrasExtendedInfo(beforeName, afterName, afterCombatLevel) + } + + private fun decodeChat( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val colourAndEffectsPacked = buffer.g2Alt1() + val modIcon = buffer.g1Alt3() + val autotyper = buffer.g1() == 1 + val huffmanLength = buffer.g1Alt1() + val data = ByteArray(huffmanLength) + buffer.gdataAlt2(data) + val text = huffmanCodec.decode(Unpooled.wrappedBuffer(data)) + val colour = colourAndEffectsPacked ushr 8 + val effects = colourAndEffectsPacked and 0xFF + val patternLength = if (colour in 13..20) colour - 12 else 0 + val pattern = + if (patternLength in 1..8) { + val array = ByteArray(patternLength) + for (i in 0.., + ) { + val deltaX1 = buffer.g1s() + val deltaZ1 = buffer.g1sAlt3() + val deltaX2 = buffer.g1s() + val deltaZ2 = buffer.g1s() + val delay1 = buffer.g2Alt3() + val delay2 = buffer.g2Alt3() + val direction = buffer.g2Alt1() + blocks += + ExactMoveExtendedInfo( + deltaX1, + deltaZ1, + delay1, + deltaX2, + deltaZ2, + delay2, + direction, + ) + } + + private fun decodeSpotanims( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val spotanims = mutableMapOf() + val count = buffer.g1Alt2() + for (i in 0.., + ) { + val hitCount = buffer.g1Alt2() + val hits = ArrayList(hitCount) + for (i in 0.. { + val delay = buffer.gSmart1or2() + hits += + Hit( + 0x7FFE, + -1, + -1, + -1, + delay, + ) + } + 0x7FFF -> { + val mainType = buffer.gSmart1or2() + val value = buffer.gSmart1or2() + val soakType = buffer.gSmart1or2() + val soakValue = buffer.gSmart1or2() + val delay = buffer.gSmart1or2() + hits += + Hit( + mainType, + value, + soakType, + soakValue, + delay, + ) + } + else -> { + val value = buffer.gSmart1or2() + val delay = buffer.gSmart1or2() + hits += + Hit( + type, + value, + -1, + -1, + delay, + ) + } + } + } + + val headbarCount = buffer.g1() + val headbars = ArrayList(headbarCount) + for (i in 0.. 0) { + buffer.g1Alt3() + } else { + startFill + } + headbars += + Headbar( + type, + startFill, + endFill, + startTime, + endTime, + ) + } + blocks += HitExtendedInfo(hits, headbars) + } + + private fun decodeTinting( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val start = buffer.g2() + val end = buffer.g2() + val hue = buffer.g1Alt2() + val saturation = buffer.g1Alt1() + val lightness = buffer.g1() + val weight = buffer.g1Alt1() + blocks += + TintingExtendedInfo( + start, + end, + hue, + saturation, + lightness, + weight, + ) + } + + private fun decodeAppearance( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val gender = buffer.g1s() + val skullIcon = buffer.g1s() + val overheadIcon = buffer.g1s() + val identKit = IntArray(12) + var transformedNpcId: Int = -1 + for (i in 0..<12) { + val flag = buffer.g1() + if (flag == 0) { + identKit[i] = 0 + continue + } + val extra = buffer.g1() + identKit[i] = (flag shl 8) + extra + if (i == 0 && identKit[i] == 65535) { + transformedNpcId = buffer.g2() + break + } + } + val interfaceInentKit = IntArray(12) + for (i in 0..<12) { + val value = buffer.g1() + if (value == 0) { + interfaceInentKit[i] = 0 + } else { + interfaceInentKit[i] = (value shl 8) + buffer.g1() + } + } + val colours = IntArray(5) + for (i in 0..<5) { + colours[i] = buffer.g1() + } + val readyAnim = buffer.g2() + val turnAnim = buffer.g2() + val walkAnim = buffer.g2() + val walkAnimBack = buffer.g2() + val walkAnimLeft = buffer.g2() + val walkAnimRight = buffer.g2() + val runAnim = buffer.g2() + val name = buffer.gjstr() + val combatLevel = buffer.g1() + val skillLevel = buffer.g2() + val hidden = buffer.g1() == 1 + val customisationFlag = buffer.g2() + val forceRefresh = customisationFlag shr 15 and 0x1 == 1 + val objTypeCustomisation: Array? = + if (customisationFlag > 0 && customisationFlag != 32768) { + val customisation = arrayOfNulls(12) + for (i in 0..<12) { + val hasCustomisation = customisationFlag shr (12 - i) and 1 + if (hasCustomisation == 1) { + var recolIndices: Int = -1 + var recol1: Int = -1 + var recol2: Int = -1 + var retexIndices: Int = -1 + var retex1: Int = -1 + var retex2: Int = -1 + var manWear: Int = -1 + var womanWear: Int = -1 + var manHead: Int = -1 + var womanHead: Int = -1 + + val slotFlag = buffer.g1() + val recol = slotFlag and 0x1 != 0 + val retex = slotFlag and 0x2 != 0 + val wearModels = slotFlag and 0x4 != 0 + val headModels = slotFlag and 0x8 != 0 + if (recol) { + recolIndices = buffer.g1() + val recolIndex1 = recolIndices and 15 + val recolIndex2 = recolIndices ushr 4 and 15 + recol1 = + if (recolIndex1 != 15) { + buffer.g2() + } else { + -1 + } + recol2 = + if (recolIndex2 != 15) { + buffer.g2() + } else { + -1 + } + } + + if (retex) { + retexIndices = buffer.g1() + val retexIndex1 = retexIndices and 15 + val retexIndex2 = retexIndices ushr 4 and 15 + retex1 = + if (retexIndex1 != 15) { + buffer.g2() + } else { + -1 + } + retex2 = + if (retexIndex2 != 15) { + buffer.g2() + } else { + -1 + } + } + + if (wearModels) { + manWear = buffer.g2() + womanWear = buffer.g2() + } + + if (headModels) { + manHead = buffer.g2() + womanHead = buffer.g2() + } + customisation[i] = + ObjTypeCustomisation( + recolIndices, + recol1, + recol2, + retexIndices, + retex1, + retex2, + manWear, + womanWear, + manHead, + womanHead, + ) + } + } + customisation + } else { + null + } + val beforeName = buffer.gjstr() + val afterName = buffer.gjstr() + val afterCombatLevel = buffer.gjstr() + val textGender = buffer.g1s() + blocks += + AppearanceExtendedInfo( + name, + combatLevel, + skillLevel, + hidden, + gender, + textGender, + skullIcon, + overheadIcon, + transformedNpcId, + identKit, + interfaceInentKit, + colours, + readyAnim, + turnAnim, + walkAnim, + walkAnimBack, + walkAnimLeft, + walkAnimRight, + runAnim, + beforeName, + afterName, + afterCombatLevel, + forceRefresh, + objTypeCustomisation, + ) + } + + private fun getHighResolutionPlayerPosition( + buffer: BitBuf, + idx: Int, + ) { + val extendedInfo = buffer.gBits(1) == 1 + if (extendedInfo) { + extendedInfoIndices[extendedInfoCount++] = idx + } + val opcode = buffer.gBits(2) + val cachedPlayer = checkNotNull(cachedPlayers[idx]) + if (opcode == 0) { + if (extendedInfo) { + cachedPlayer.queuedMove = false + setUpdateType(idx, UpdateType.HIGH_RESOLUTION_IDLE) + } else if (localIndex == idx) { + throw RuntimeException() + } else { + lowResolutionPositions[idx] = + (cachedPlayer.coord.level shl 28) + .or(cachedPlayer.coord.z shr 13) + .or(cachedPlayer.coord.x shr 13 shl 14) + cachedPlayers[idx] = null + setUpdateType(idx, UpdateType.HIGH_RESOLUTION_TO_LOW_RESOLUTION) + if (buffer.gBits(1) != 0) { + getLowResolutionPlayerPosition(buffer, idx) + } + } + } else if (opcode == 1) { + setUpdateType(idx, UpdateType.HIGH_RESOLUTION_MOVEMENT) + val movementOpcode = buffer.gBits(3) + var curX = cachedPlayer.coord.x + var curZ = cachedPlayer.coord.z + when (movementOpcode) { + 0 -> { + --curX + --curZ + } + 1 -> { + --curZ + } + 2 -> { + ++curX + --curZ + } + 3 -> { + --curX + } + 4 -> { + ++curX + } + 5 -> { + --curX + ++curZ + } + 6 -> { + ++curZ + } + 7 -> { + ++curX + ++curZ + } + } + cachedPlayer.coord = CoordGrid(cachedPlayer.coord.level, curX, curZ) + cachedPlayer.queuedMove = extendedInfo + } else if (opcode == 2) { + setUpdateType(idx, UpdateType.HIGH_RESOLUTION_MOVEMENT) + val movementOpcode = buffer.gBits(4) + var curX = cachedPlayer.coord.x + var curZ = cachedPlayer.coord.z + when (movementOpcode) { + 0 -> { + curX -= 2 + curZ -= 2 + } + 1 -> { + --curX + curZ -= 2 + } + 2 -> { + curZ -= 2 + } + 3 -> { + ++curX + curZ -= 2 + } + 4 -> { + curX += 2 + curZ -= 2 + } + 5 -> { + curX -= 2 + --curZ + } + 6 -> { + curX += 2 + --curZ + } + 7 -> { + curX -= 2 + } + 8 -> { + curX += 2 + } + 9 -> { + curX -= 2 + ++curZ + } + 10 -> { + curX += 2 + ++curZ + } + 11 -> { + curX -= 2 + curZ += 2 + } + 12 -> { + --curX + curZ += 2 + } + 13 -> { + curZ += 2 + } + 14 -> { + ++curX + curZ += 2 + } + 15 -> { + curX += 2 + curZ += 2 + } + } + cachedPlayer.coord = CoordGrid(cachedPlayer.coord.level, curX, curZ) + cachedPlayer.queuedMove = extendedInfo + } else { + setUpdateType(idx, UpdateType.HIGH_RESOLUTION_MOVEMENT) + val far = buffer.gBits(1) + if (far == 0) { + val coord = buffer.gBits(12) + val deltaLevel = coord shr 10 + var deltaX = coord shr 5 and 31 + if (deltaX > 15) { + deltaX -= 32 + } + var deltaZ = coord and 31 + if (deltaZ > 15) { + deltaZ -= 32 + } + var curLevel = cachedPlayer.coord.level + var curX = cachedPlayer.coord.x + var curZ = cachedPlayer.coord.z + curX += deltaX + curZ += deltaZ + curLevel = (curLevel + deltaLevel) and 0x3 + cachedPlayer.coord = CoordGrid(curLevel, curX, curZ) + cachedPlayer.queuedMove = extendedInfo + } else { + val coord = buffer.gBits(30) + val deltaLevel = coord shr 28 + val deltaX = coord shr 14 and 16383 + val deltaZ = coord and 16383 + var curLevel = cachedPlayer.coord.level + var curX = cachedPlayer.coord.x + var curZ = cachedPlayer.coord.z + curX = (curX + deltaX) and 16383 + curZ = (curZ + deltaZ) and 16383 + curLevel = (curLevel + deltaLevel) and 0x3 + cachedPlayer.coord = CoordGrid(curLevel, curX, curZ) + cachedPlayer.queuedMove = extendedInfo + } + } + } + + private fun getLowResolutionPlayerPosition( + buffer: BitBuf, + idx: Int, + ): Boolean { + val opcode = buffer.gBits(2) + when (opcode) { + 0 -> { + if (buffer.gBits(1) != 0) { + getLowResolutionPlayerPosition(buffer, idx) + } + val x = buffer.gBits(13) + val z = buffer.gBits(13) + val extendedInfo = buffer.gBits(1) == 1 + if (extendedInfo) { + this.extendedInfoIndices[extendedInfoCount++] = idx + } + if (cachedPlayers[idx] != null) { + throw RuntimeException() + } + val player = Player() + cachedPlayers[idx] = player + // cached appearance decoding + val lowResolutionPosition = lowResolutionPositions[idx] + val level = lowResolutionPosition shr 28 + val lowResX = lowResolutionPosition shr 14 and 0xFF + val lowResZ = lowResolutionPosition and 0xFF + player.coord = CoordGrid(level, (lowResX shl 13) + x, (lowResZ shl 13) + z) + player.queuedMove = false + setUpdateType(idx, UpdateType.LOW_RESOLUTION_TO_HIGH_RESOLUTION) + return true + } + 1 -> { + val levelDelta = buffer.gBits(2) + val lowResPosition = lowResolutionPositions[idx] + lowResolutionPositions[idx] = + ((((lowResPosition shr 28) + levelDelta) and 3 shl 28)) + .plus(lowResPosition and 268435455) + setUpdateType(idx, UpdateType.LOW_RESOLUTION_MOVEMENT) + return false + } + 2 -> { + setUpdateType(idx, UpdateType.LOW_RESOLUTION_MOVEMENT) + val bitpacked = buffer.gBits(5) + val levelDelta = bitpacked shr 3 + val movementCode = bitpacked and 7 + val lowResPosition = lowResolutionPositions[idx] + val level = (lowResPosition shr 28) + levelDelta and 3 + var x = lowResPosition shr 14 and 255 + var z = lowResPosition and 255 + if (movementCode == 0) { + --x + --z + } + + if (movementCode == 1) { + --z + } + + if (movementCode == 2) { + ++x + --z + } + + if (movementCode == 3) { + --x + } + + if (movementCode == 4) { + ++x + } + + if (movementCode == 5) { + --x + ++z + } + + if (movementCode == 6) { + ++z + } + + if (movementCode == 7) { + ++x + ++z + } + lowResolutionPositions[idx] = (x shl 14) + z + (level shl 28) + return false + } + else -> { + setUpdateType(idx, UpdateType.LOW_RESOLUTION_MOVEMENT) + val bitpacked = buffer.gBits(18) + val levelDelta = bitpacked shr 16 + val xDelta = bitpacked shr 8 and 255 + val zDelta = bitpacked and 255 + val lowResPosition = lowResolutionPositions[idx] + val level = (lowResPosition shr 28) + levelDelta and 3 + val x = (xDelta + (lowResPosition shr 14)) and 255 + val z = (zDelta + lowResPosition) and 255 + lowResolutionPositions[idx] = (x shl 14) + z + (level shl 28) + return false + } + } + } + + private fun readStationary(buffer: BitBuf): Int { + val type = buffer.gBits(2) + return when (type) { + 0 -> 0 + 1 -> buffer.gBits(5) + 2 -> buffer.gBits(8) + else -> buffer.gBits(11) + } + } + + private companion object { + private const val CUR_CYCLE_INACTIVE = 0x1 + private const val NEXT_CYCLE_INACTIVE = 0x2 + + private const val EXTENDED_SHORT = 0x80 + private const val EXTENDED_MEDIUM = 0x100 + private const val APPEARANCE = 0x1 + private const val SAY = 0x2 + private const val FACE_ANGLE = 0x4 + private const val CHAT_OLD = 0x8 + private const val FACE_PATHINGENTITY = 0x10 + private const val SEQUENCE = 0x20 + private const val HITS = 0x40 + private const val CHAT = 0x400 + private const val MOVE_SPEED = 0x800 + private const val EXACT_MOVE = 0x1000 + private const val TEMP_MOVE_SPEED = 0x2000 + private const val TINTING = 0x8000 + private const val SPOTANIM = 0x10000 + private const val NAME_EXTRAS = 0x200 + + private class Player { + var queuedMove: Boolean = false + var coord: CoordGrid = CoordGrid.INVALID + var extendedInfoBlocks: List = emptyList() + } + + private enum class UpdateType { + LOW_RESOLUTION_IDLE, + HIGH_RESOLUTION_IDLE, + LOW_RESOLUTION_TO_HIGH_RESOLUTION, + HIGH_RESOLUTION_MOVEMENT, + LOW_RESOLUTION_MOVEMENT, + HIGH_RESOLUTION_TO_LOW_RESOLUTION, + } + } +} From c8489f01c1bac7ab5422c76101504fed31d56913 Mon Sep 17 00:00:00 2001 From: Kris Date: Thu, 16 Jan 2025 02:14:10 +0200 Subject: [PATCH 3/8] feat: update client prots to 228 --- .../decoder/codec/buttons/If1ButtonDecoder.kt | 10 +- .../decoder/codec/buttons/If3ButtonDecoder.kt | 8 +- .../decoder/codec/buttons/IfButtonDDecoder.kt | 19 +- .../decoder/codec/buttons/IfButtonTDecoder.kt | 18 +- .../decoder/codec/buttons/IfSubOpDecoder.kt | 10 +- ...ClanSettingsAddBannedFromChannelDecoder.kt | 8 +- ...dClanSettingsSetMutedFromChannelDecoder.kt | 8 +- .../clan/ClanChannelFullRequestDecoder.kt | 8 +- .../codec/clan/ClanChannelKickUserDecoder.kt | 8 +- .../clan/ClanSettingsFullRequestDecoder.kt | 8 +- .../codec/events/EventAppletFocusDecoder.kt | 8 +- .../events/EventCameraPositionDecoder.kt | 8 +- .../codec/events/EventKeyboardDecoder.kt | 10 +- .../codec/events/EventMouseClickDecoder.kt | 8 +- .../codec/events/EventMouseMoveDecoder.kt | 8 +- .../codec/events/EventMouseScrollDecoder.kt | 8 +- .../events/EventNativeMouseClickDecoder.kt | 10 +- .../events/EventNativeMouseMoveDecoder.kt | 8 +- .../friendchat/FriendChatJoinLeaveDecoder.kt | 8 +- .../codec/friendchat/FriendChatKickDecoder.kt | 8 +- .../friendchat/FriendChatSetRankDecoder.kt | 6 +- .../decoder/codec/locs/OpLoc1Decoder.kt | 12 +- .../decoder/codec/locs/OpLoc2Decoder.kt | 12 +- .../decoder/codec/locs/OpLoc3Decoder.kt | 12 +- .../decoder/codec/locs/OpLoc4Decoder.kt | 12 +- .../decoder/codec/locs/OpLoc5Decoder.kt | 12 +- .../decoder/codec/locs/OpLoc6Decoder.kt | 8 +- .../decoder/codec/locs/OpLocTDecoder.kt | 20 +- .../misc/client/ConnectionTelemetryDecoder.kt | 8 +- .../client/DetectModifiedClientDecoder.kt | 8 +- .../decoder/codec/misc/client/IdleDecoder.kt | 8 +- .../misc/client/MapBuildCompleteDecoder.kt | 8 +- .../MembershipPromotionEligibilityDecoder.kt | 8 +- .../codec/misc/client/NoTimeoutDecoder.kt | 8 +- .../codec/misc/client/SendPingReplyDecoder.kt | 14 +- .../misc/client/SoundJingleEndDecoder.kt | 8 +- .../codec/misc/client/WindowStatusDecoder.kt | 8 +- .../codec/misc/user/BugReportDecoder.kt | 8 +- .../codec/misc/user/ClickWorldMapDecoder.kt | 8 +- .../codec/misc/user/ClientCheatDecoder.kt | 8 +- .../codec/misc/user/CloseModalDecoder.kt | 8 +- .../codec/misc/user/HiscoreRequestDecoder.kt | 8 +- .../codec/misc/user/IfCrmViewClickDecoder.kt | 20 +- .../codec/misc/user/MoveGameClickDecoder.kt | 10 +- .../misc/user/MoveMinimapClickDecoder.kt | 10 +- .../codec/misc/user/OculusLeaveDecoder.kt | 8 +- .../codec/misc/user/SendSnapshotDecoder.kt | 8 +- .../misc/user/SetChatFilterSettingsDecoder.kt | 8 +- .../codec/misc/user/SetHeadingDecoder.kt | 8 +- .../codec/misc/user/TeleportDecoder.kt | 10 +- .../decoder/codec/npcs/OpNpc1Decoder.kt | 10 +- .../decoder/codec/npcs/OpNpc2Decoder.kt | 8 +- .../decoder/codec/npcs/OpNpc3Decoder.kt | 8 +- .../decoder/codec/npcs/OpNpc4Decoder.kt | 8 +- .../decoder/codec/npcs/OpNpc5Decoder.kt | 10 +- .../decoder/codec/npcs/OpNpc6Decoder.kt | 8 +- .../decoder/codec/npcs/OpNpcTDecoder.kt | 18 +- .../decoder/codec/objs/OpObj1Decoder.kt | 14 +- .../decoder/codec/objs/OpObj2Decoder.kt | 10 +- .../decoder/codec/objs/OpObj3Decoder.kt | 12 +- .../decoder/codec/objs/OpObj4Decoder.kt | 8 +- .../decoder/codec/objs/OpObj5Decoder.kt | 14 +- .../decoder/codec/objs/OpObj6Decoder.kt | 10 +- .../decoder/codec/objs/OpObjTDecoder.kt | 20 +- .../decoder/codec/players/OpPlayer1Decoder.kt | 10 +- .../decoder/codec/players/OpPlayer2Decoder.kt | 10 +- .../decoder/codec/players/OpPlayer3Decoder.kt | 10 +- .../decoder/codec/players/OpPlayer4Decoder.kt | 10 +- .../decoder/codec/players/OpPlayer5Decoder.kt | 10 +- .../decoder/codec/players/OpPlayer6Decoder.kt | 8 +- .../decoder/codec/players/OpPlayer7Decoder.kt | 10 +- .../decoder/codec/players/OpPlayer8Decoder.kt | 10 +- .../decoder/codec/players/OpPlayerTDecoder.kt | 16 +- .../resumed/ResumePCountDialogDecoder.kt | 8 +- .../codec/resumed/ResumePNameDialogDecoder.kt | 8 +- .../codec/resumed/ResumePObjDialogDecoder.kt | 8 +- .../resumed/ResumePStringDialogDecoder.kt | 8 +- .../codec/resumed/ResumePauseButtonDecoder.kt | 10 +- .../codec/social/FriendListAddDecoder.kt | 8 +- .../codec/social/FriendListDelDecoder.kt | 8 +- .../codec/social/IgnoreListAddDecoder.kt | 8 +- .../codec/social/IgnoreListDelDecoder.kt | 8 +- .../incoming/decoder/prot/GameClientProtId.kt | 198 +++++++++--------- 83 files changed, 503 insertions(+), 504 deletions(-) diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/If1ButtonDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/If1ButtonDecoder.kt index 5c6e049a..7cd6ce62 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/If1ButtonDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/If1ButtonDecoder.kt @@ -2,15 +2,15 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprot.protocol.util.gCombinedId -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.buttons.If1Button import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.buttons.If1Button import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent +import net.rsprot.protocol.util.gCombinedId @Consistent -internal class If1ButtonDecoder : ProxyMessageDecoder { +public class If1ButtonDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.IF_BUTTON override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/If3ButtonDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/If3ButtonDecoder.kt index 98ace382..8e79d515 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/If3ButtonDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/If3ButtonDecoder.kt @@ -1,15 +1,15 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons import net.rsprot.buffer.JagByteBuf +import net.rsprox.protocol.game.incoming.model.buttons.If3Button +import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder import net.rsprot.protocol.metadata.Consistent import net.rsprot.protocol.util.gCombinedId -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.buttons.If3Button import net.rsprox.protocol.session.Session -import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt @Consistent -internal class If3ButtonDecoder( +public class If3ButtonDecoder( override val prot: GameClientProt, private val op: Int, ) : ProxyMessageDecoder { diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfButtonDDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfButtonDDecoder.kt index f18cf094..2ce1c44f 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfButtonDDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfButtonDDecoder.kt @@ -2,26 +2,25 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.util.gCombinedIdAlt1 -import net.rsprot.protocol.util.gCombinedIdAlt2 -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.buttons.IfButtonD import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.buttons.IfButtonD import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.util.gCombinedId -internal class IfButtonDDecoder : ProxyMessageDecoder { +public class IfButtonDDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.IF_BUTTOND override fun decode( buffer: JagByteBuf, session: Session, ): IfButtonD { - val selectedSub = buffer.g2() - val targetCombinedId = buffer.gCombinedIdAlt2() + val selectedObj = buffer.g2() val targetSub = buffer.g2Alt2() - val selectedCombinedId = buffer.gCombinedIdAlt1() - val selectedObj = buffer.g2Alt3() - val targetObj = buffer.g2Alt3() + val selectedSub = buffer.g2Alt2() + val targetCombinedId = buffer.gCombinedId() + val targetObj = buffer.g2() + val selectedCombinedId = buffer.gCombinedId() return IfButtonD( selectedCombinedId, selectedSub, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfButtonTDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfButtonTDecoder.kt index 7b40ae18..b81867ed 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfButtonTDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfButtonTDecoder.kt @@ -2,26 +2,26 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.util.gCombinedIdAlt1 -import net.rsprot.protocol.util.gCombinedIdAlt2 -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.buttons.IfButtonT import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.buttons.IfButtonT import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.util.gCombinedIdAlt1 +import net.rsprot.protocol.util.gCombinedIdAlt2 -internal class IfButtonTDecoder : ProxyMessageDecoder { +public class IfButtonTDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.IF_BUTTONT override fun decode( buffer: JagByteBuf, session: Session, ): IfButtonT { - val targetSub = buffer.g2Alt2() - val selectedObj = buffer.g2Alt2() - val targetCombinedId = buffer.gCombinedIdAlt1() + val selectedCombinedId = buffer.gCombinedIdAlt1() + val targetSub = buffer.g2() + val targetCombinedId = buffer.gCombinedIdAlt2() val selectedSub = buffer.g2Alt3() - val selectedCombinedId = buffer.gCombinedIdAlt2() val targetObj = buffer.g2Alt3() + val selectedObj = buffer.g2() return IfButtonT( selectedCombinedId, selectedSub, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfSubOpDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfSubOpDecoder.kt index c5c24a8e..9903086f 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfSubOpDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/buttons/IfSubOpDecoder.kt @@ -2,15 +2,15 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.buttons import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprot.protocol.util.gCombinedId -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.buttons.IfSubOp import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.buttons.IfSubOp import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent +import net.rsprot.protocol.util.gCombinedId @Consistent -internal class IfSubOpDecoder : ProxyMessageDecoder { +public class IfSubOpDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.IF_SUBOP override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/AffinedClanSettingsAddBannedFromChannelDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/AffinedClanSettingsAddBannedFromChannelDecoder.kt index c7978bba..d6abc257 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/AffinedClanSettingsAddBannedFromChannelDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/AffinedClanSettingsAddBannedFromChannelDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.clan import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.clan.AffinedClanSettingsAddBannedFromChannel import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.clan.AffinedClanSettingsAddBannedFromChannel import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class AffinedClanSettingsAddBannedFromChannelDecoder : +public class AffinedClanSettingsAddBannedFromChannelDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.AFFINEDCLANSETTINGS_ADDBANNED_FROMCHANNEL diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/AffinedClanSettingsSetMutedFromChannelDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/AffinedClanSettingsSetMutedFromChannelDecoder.kt index 11f21364..29d01823 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/AffinedClanSettingsSetMutedFromChannelDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/AffinedClanSettingsSetMutedFromChannelDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.clan import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.clan.AffinedClanSettingsSetMutedFromChannel import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.clan.AffinedClanSettingsSetMutedFromChannel import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class AffinedClanSettingsSetMutedFromChannelDecoder : +public class AffinedClanSettingsSetMutedFromChannelDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.AFFINEDCLANSETTINGS_SETMUTED_FROMCHANNEL diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanChannelFullRequestDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanChannelFullRequestDecoder.kt index 984f1a37..0449839c 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanChannelFullRequestDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanChannelFullRequestDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.clan import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.clan.ClanChannelFullRequest import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.clan.ClanChannelFullRequest import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class ClanChannelFullRequestDecoder : ProxyMessageDecoder { +public class ClanChannelFullRequestDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.CLANCHANNEL_FULL_REQUEST override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanChannelKickUserDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanChannelKickUserDecoder.kt index 6780b38c..7d1a27c9 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanChannelKickUserDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanChannelKickUserDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.clan import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.clan.ClanChannelKickUser import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.clan.ClanChannelKickUser import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class ClanChannelKickUserDecoder : ProxyMessageDecoder { +public class ClanChannelKickUserDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.CLANCHANNEL_KICKUSER override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanSettingsFullRequestDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanSettingsFullRequestDecoder.kt index c01adce5..4d126c28 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanSettingsFullRequestDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/clan/ClanSettingsFullRequestDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.clan import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.clan.ClanSettingsFullRequest import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.clan.ClanSettingsFullRequest import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class ClanSettingsFullRequestDecoder : ProxyMessageDecoder { +public class ClanSettingsFullRequestDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.CLANSETTINGS_FULL_REQUEST override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventAppletFocusDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventAppletFocusDecoder.kt index 2237fb71..56aea94e 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventAppletFocusDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventAppletFocusDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.events import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.events.EventAppletFocus import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.events.EventAppletFocus import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class EventAppletFocusDecoder : ProxyMessageDecoder { +public class EventAppletFocusDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.EVENT_APPLET_FOCUS override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventCameraPositionDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventCameraPositionDecoder.kt index 00ca1530..0fbf954f 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventCameraPositionDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventCameraPositionDecoder.kt @@ -2,12 +2,12 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.events import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.events.EventCameraPosition import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.events.EventCameraPosition import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class EventCameraPositionDecoder : ProxyMessageDecoder { +public class EventCameraPositionDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.EVENT_CAMERA_POSITION override fun decode( @@ -15,7 +15,7 @@ internal class EventCameraPositionDecoder : ProxyMessageDecoder { +public class EventKeyboardDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.EVENT_KEYBOARD override fun decode( @@ -18,8 +18,8 @@ internal class EventKeyboardDecoder : ProxyMessageDecoder { val keys = ByteArray(count) var lastTransmittedKeyPress: Int = -1 for (i in 0.. { +public class EventMouseClickDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.EVENT_MOUSE_CLICK override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventMouseMoveDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventMouseMoveDecoder.kt index beb98c35..f64e7582 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventMouseMoveDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventMouseMoveDecoder.kt @@ -2,16 +2,16 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.events import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.session.Session import net.rsprox.protocol.game.incoming.model.events.EventMouseMove import net.rsprox.protocol.game.incoming.model.events.util.MouseMovements -import net.rsprox.protocol.session.Session import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Suppress("DuplicatedCode") @Consistent -internal class EventMouseMoveDecoder : ProxyMessageDecoder { +public class EventMouseMoveDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.EVENT_MOUSE_MOVE override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventMouseScrollDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventMouseScrollDecoder.kt index 0170864e..2ec617b9 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventMouseScrollDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventMouseScrollDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.events import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.events.EventMouseScroll import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.events.EventMouseScroll import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class EventMouseScrollDecoder : ProxyMessageDecoder { +public class EventMouseScrollDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.EVENT_MOUSE_SCROLL override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventNativeMouseClickDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventNativeMouseClickDecoder.kt index 98b7aa19..2450fb6e 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventNativeMouseClickDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventNativeMouseClickDecoder.kt @@ -2,21 +2,21 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.events import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.events.EventNativeMouseClick import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.events.EventNativeMouseClick import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class EventNativeMouseClickDecoder : ProxyMessageDecoder { +public class EventNativeMouseClickDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.EVENT_NATIVE_MOUSE_CLICK override fun decode( buffer: JagByteBuf, session: Session, ): EventNativeMouseClick { + val code = buffer.g1Alt1() + val lastTransmittedMouseClick = buffer.g2Alt2() val packedCoord = buffer.g4Alt2() - val lastTransmittedMouseClick = buffer.g2() - val code = buffer.g1Alt2() return EventNativeMouseClick( lastTransmittedMouseClick, code, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventNativeMouseMoveDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventNativeMouseMoveDecoder.kt index 708e421f..ecd232fe 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventNativeMouseMoveDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/events/EventNativeMouseMoveDecoder.kt @@ -2,16 +2,16 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.events import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.session.Session import net.rsprox.protocol.game.incoming.model.events.EventNativeMouseMove import net.rsprox.protocol.game.incoming.model.events.util.MouseMovements -import net.rsprox.protocol.session.Session import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Suppress("DuplicatedCode") @Consistent -internal class EventNativeMouseMoveDecoder : ProxyMessageDecoder { +public class EventNativeMouseMoveDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.EVENT_NATIVE_MOUSE_MOVE override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatJoinLeaveDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatJoinLeaveDecoder.kt index 68c9aec2..21caccd6 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatJoinLeaveDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatJoinLeaveDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.friendchat import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.friendchat.FriendChatJoinLeave import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.friendchat.FriendChatJoinLeave import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class FriendChatJoinLeaveDecoder : ProxyMessageDecoder { +public class FriendChatJoinLeaveDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.FRIENDCHAT_JOIN_LEAVE override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatKickDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatKickDecoder.kt index cbf92ea3..ddb2d15c 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatKickDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatKickDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.friendchat import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.friendchat.FriendChatKick import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.friendchat.FriendChatKick import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class FriendChatKickDecoder : ProxyMessageDecoder { +public class FriendChatKickDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.FRIENDCHAT_KICK override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatSetRankDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatSetRankDecoder.kt index 0652623e..c140ded0 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatSetRankDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/friendchat/FriendChatSetRankDecoder.kt @@ -2,12 +2,12 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.friendchat import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.friendchat.FriendChatSetRank import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.friendchat.FriendChatSetRank import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class FriendChatSetRankDecoder : ProxyMessageDecoder { +public class FriendChatSetRankDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.FRIENDCHAT_SETRANK override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc1Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc1Decoder.kt index 67a657f3..73eeca09 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc1Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc1Decoder.kt @@ -2,22 +2,22 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.locs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.locs.OpLoc import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.locs.OpLoc import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpLoc1Decoder : ProxyMessageDecoder { +public class OpLoc1Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPLOC1 override fun decode( buffer: JagByteBuf, session: Session, ): OpLoc { - val id = buffer.g2Alt2() + val z = buffer.g2Alt3() val controlKey = buffer.g1() == 1 - val z = buffer.g2() - val x = buffer.g2() + val id = buffer.g2Alt3() + val x = buffer.g2Alt3() return OpLoc( id, x, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc2Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc2Decoder.kt index 24998db7..2ecbd384 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc2Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc2Decoder.kt @@ -2,22 +2,22 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.locs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.locs.OpLoc import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.locs.OpLoc import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpLoc2Decoder : ProxyMessageDecoder { +public class OpLoc2Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPLOC2 override fun decode( buffer: JagByteBuf, session: Session, ): OpLoc { + val z = buffer.g2Alt1() val id = buffer.g2Alt3() - val controlKey = buffer.g1Alt1() == 1 - val x = buffer.g2Alt1() - val z = buffer.g2Alt3() + val x = buffer.g2() + val controlKey = buffer.g1() == 1 return OpLoc( id, x, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc3Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc3Decoder.kt index 66938392..7452e69f 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc3Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc3Decoder.kt @@ -2,21 +2,21 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.locs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.locs.OpLoc import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.locs.OpLoc import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpLoc3Decoder : ProxyMessageDecoder { +public class OpLoc3Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPLOC3 override fun decode( buffer: JagByteBuf, session: Session, ): OpLoc { - val x = buffer.g2() - val controlKey = buffer.g1Alt3() == 1 - val id = buffer.g2Alt1() + val id = buffer.g2Alt3() + val x = buffer.g2Alt3() + val controlKey = buffer.g1Alt2() == 1 val z = buffer.g2Alt2() return OpLoc( id, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc4Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc4Decoder.kt index 44ec4050..57810a20 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc4Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc4Decoder.kt @@ -2,22 +2,22 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.locs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.locs.OpLoc import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.locs.OpLoc import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpLoc4Decoder : ProxyMessageDecoder { +public class OpLoc4Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPLOC4 override fun decode( buffer: JagByteBuf, session: Session, ): OpLoc { - val id = buffer.g2Alt3() - val z = buffer.g2Alt1() val x = buffer.g2() - val controlKey = buffer.g1() == 1 + val id = buffer.g2() + val z = buffer.g2Alt1() + val controlKey = buffer.g1Alt3() == 1 return OpLoc( id, x, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc5Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc5Decoder.kt index 524052ef..d9227f59 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc5Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc5Decoder.kt @@ -2,22 +2,22 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.locs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.locs.OpLoc import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.locs.OpLoc import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpLoc5Decoder : ProxyMessageDecoder { +public class OpLoc5Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPLOC5 override fun decode( buffer: JagByteBuf, session: Session, ): OpLoc { - val controlKey = buffer.g1Alt3() == 1 + val controlKey = buffer.g1Alt1() == 1 + val x = buffer.g2Alt2() + val z = buffer.g2Alt3() val id = buffer.g2Alt2() - val x = buffer.g2() - val z = buffer.g2Alt2() return OpLoc( id, x, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc6Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc6Decoder.kt index 4fdeb0bf..f0ed2199 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc6Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLoc6Decoder.kt @@ -2,19 +2,19 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.locs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.locs.OpLoc6 import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.locs.OpLoc6 import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpLoc6Decoder : ProxyMessageDecoder { +public class OpLoc6Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPLOC6 override fun decode( buffer: JagByteBuf, session: Session, ): OpLoc6 { - val id = buffer.g2Alt1() + val id = buffer.g2Alt3() return OpLoc6(id) } } diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLocTDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLocTDecoder.kt index ffac2da7..ee01c5b9 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLocTDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/locs/OpLocTDecoder.kt @@ -2,26 +2,26 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.locs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.util.gCombinedIdAlt1 -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.locs.OpLocT import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.locs.OpLocT import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.util.gCombinedIdAlt2 -internal class OpLocTDecoder : ProxyMessageDecoder { +public class OpLocTDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPLOCT override fun decode( buffer: JagByteBuf, session: Session, ): OpLocT { + val selectedCombinedId = buffer.gCombinedIdAlt2() val z = buffer.g2() - val selectedSub = buffer.g2Alt1() - val x = buffer.g2() - val id = buffer.g2Alt2() - val selectedCombinedId = buffer.gCombinedIdAlt1() - val selectedObj = buffer.g2Alt2() - val controlKey = buffer.g1Alt1() == 1 + val id = buffer.g2Alt3() + val controlKey = buffer.g1Alt2() == 1 + val selectedObj = buffer.g2() + val selectedSub = buffer.g2Alt3() + val x = buffer.g2Alt3() return OpLocT( id, x, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/ConnectionTelemetryDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/ConnectionTelemetryDecoder.kt index 8dcae99a..96c3e273 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/ConnectionTelemetryDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/ConnectionTelemetryDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.client.ConnectionTelemetry import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.client.ConnectionTelemetry import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class ConnectionTelemetryDecoder : ProxyMessageDecoder { +public class ConnectionTelemetryDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.CONNECTION_TELEMETRY override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/DetectModifiedClientDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/DetectModifiedClientDecoder.kt index f29ae5db..5ae9a827 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/DetectModifiedClientDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/DetectModifiedClientDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.client.DetectModifiedClient import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.client.DetectModifiedClient import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class DetectModifiedClientDecoder : ProxyMessageDecoder { +public class DetectModifiedClientDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.DETECT_MODIFIED_CLIENT override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/IdleDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/IdleDecoder.kt index 5bf3a17a..5d18c430 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/IdleDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/IdleDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.client.Idle import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.client.Idle import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class IdleDecoder : ProxyMessageDecoder { +public class IdleDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.IDLE override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/MapBuildCompleteDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/MapBuildCompleteDecoder.kt index 74cf9053..87957538 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/MapBuildCompleteDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/MapBuildCompleteDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.client.MapBuildComplete import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.client.MapBuildComplete import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class MapBuildCompleteDecoder : ProxyMessageDecoder { +public class MapBuildCompleteDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.MAP_BUILD_COMPLETE override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/MembershipPromotionEligibilityDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/MembershipPromotionEligibilityDecoder.kt index 5f0d6d84..9ea0bc20 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/MembershipPromotionEligibilityDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/MembershipPromotionEligibilityDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.client.MembershipPromotionEligibility import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.client.MembershipPromotionEligibility import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class MembershipPromotionEligibilityDecoder : ProxyMessageDecoder { +public class MembershipPromotionEligibilityDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.MEMBERSHIP_PROMOTION_ELIGIBILITY override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/NoTimeoutDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/NoTimeoutDecoder.kt index 9da4ad1e..021ca2d7 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/NoTimeoutDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/NoTimeoutDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.client.NoTimeout import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.client.NoTimeout import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class NoTimeoutDecoder : ProxyMessageDecoder { +public class NoTimeoutDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.NO_TIMEOUT override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt index cba65b00..a7e2d5f7 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt @@ -2,22 +2,22 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.client.SendPingReply import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.client.SendPingReply import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class SendPingReplyDecoder : ProxyMessageDecoder { +public class SendPingReplyDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.SEND_PING_REPLY override fun decode( buffer: JagByteBuf, session: Session, ): SendPingReply { - val gcPercentTime = buffer.g1Alt3() - val fps = buffer.g1() - val value1 = buffer.g4Alt3() - val value2 = buffer.g4Alt1() + val gcPercentTime = buffer.g1Alt1() + val fps = buffer.g1Alt1() + val value1 = buffer.g4() + val value2 = buffer.g4() return SendPingReply( fps, gcPercentTime, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/SoundJingleEndDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/SoundJingleEndDecoder.kt index 25b9cd45..a1c19800 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/SoundJingleEndDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/SoundJingleEndDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.client.SoundJingleEnd import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.client.SoundJingleEnd import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class SoundJingleEndDecoder : ProxyMessageDecoder { +public class SoundJingleEndDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.SOUND_JINGLEEND override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/WindowStatusDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/WindowStatusDecoder.kt index d09def95..57228b6f 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/WindowStatusDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/client/WindowStatusDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.client import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.client.WindowStatus import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.client.WindowStatus import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class WindowStatusDecoder : ProxyMessageDecoder { +public class WindowStatusDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.WINDOW_STATUS override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/BugReportDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/BugReportDecoder.kt index e07868cd..d2569dc3 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/BugReportDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/BugReportDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.user.BugReport import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.user.BugReport import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class BugReportDecoder : ProxyMessageDecoder { +public class BugReportDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.BUG_REPORT override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/ClickWorldMapDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/ClickWorldMapDecoder.kt index 70e04eab..64c5fc85 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/ClickWorldMapDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/ClickWorldMapDecoder.kt @@ -2,13 +2,13 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.common.CoordGrid -import net.rsprox.protocol.game.incoming.model.misc.user.ClickWorldMap import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.user.ClickWorldMap import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.common.CoordGrid -internal class ClickWorldMapDecoder : ProxyMessageDecoder { +public class ClickWorldMapDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.CLICKWORLDMAP override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/ClientCheatDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/ClientCheatDecoder.kt index d6930cfa..a94225de 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/ClientCheatDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/ClientCheatDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.user.ClientCheat import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.user.ClientCheat import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class ClientCheatDecoder : ProxyMessageDecoder { +public class ClientCheatDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.CLIENT_CHEAT override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/CloseModalDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/CloseModalDecoder.kt index 8533892f..d9b940e9 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/CloseModalDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/CloseModalDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.user.CloseModal import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.user.CloseModal import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class CloseModalDecoder : ProxyMessageDecoder { +public class CloseModalDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.CLOSE_MODAL override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/HiscoreRequestDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/HiscoreRequestDecoder.kt index 35832adf..2f6aebb7 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/HiscoreRequestDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/HiscoreRequestDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.user.HiscoreRequest import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.user.HiscoreRequest import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class HiscoreRequestDecoder : ProxyMessageDecoder { +public class HiscoreRequestDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.HISCORE_REQUEST override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/IfCrmViewClickDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/IfCrmViewClickDecoder.kt index 5459c555..34f040c3 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/IfCrmViewClickDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/IfCrmViewClickDecoder.kt @@ -2,25 +2,25 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.util.gCombinedIdAlt3 -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.user.IfCrmViewClick import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.user.IfCrmViewClick import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.util.gCombinedIdAlt2 -internal class IfCrmViewClickDecoder : ProxyMessageDecoder { +public class IfCrmViewClickDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.IF_CRMVIEW_CLICK override fun decode( buffer: JagByteBuf, session: Session, ): IfCrmViewClick { - val behaviour1 = buffer.g4Alt3() - val sub = buffer.g2Alt2() - val combinedId = buffer.gCombinedIdAlt3() - val behaviour3 = buffer.g4Alt2() - val behaviour2 = buffer.g4Alt3() - val serverTarget = buffer.g4Alt2() + val behaviour3 = buffer.g4Alt1() + val serverTarget = buffer.g4() + val behaviour2 = buffer.g4Alt2() + val behaviour1 = buffer.g4Alt1() + val sub = buffer.g2() + val combinedId = buffer.gCombinedIdAlt2() return IfCrmViewClick( serverTarget, combinedId, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/MoveGameClickDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/MoveGameClickDecoder.kt index 5005185e..06123ee4 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/MoveGameClickDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/MoveGameClickDecoder.kt @@ -2,21 +2,21 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.user.MoveGameClick import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.user.MoveGameClick import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class MoveGameClickDecoder : ProxyMessageDecoder { +public class MoveGameClickDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.MOVE_GAMECLICK override fun decode( buffer: JagByteBuf, session: Session, ): MoveGameClick { - val z = buffer.g2Alt2() - val x = buffer.g2Alt3() val keyCombination = buffer.g1() + val z = buffer.g2() + val x = buffer.g2Alt2() return MoveGameClick( x, z, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/MoveMinimapClickDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/MoveMinimapClickDecoder.kt index cc8c0d63..52fb9f9d 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/MoveMinimapClickDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/MoveMinimapClickDecoder.kt @@ -2,12 +2,12 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.user.MoveMinimapClick import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.user.MoveMinimapClick import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class MoveMinimapClickDecoder : ProxyMessageDecoder { +public class MoveMinimapClickDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.MOVE_MINIMAPCLICK override fun decode( @@ -15,9 +15,9 @@ internal class MoveMinimapClickDecoder : ProxyMessageDecoder { session: Session, ): MoveMinimapClick { // The x, z and keyCombination get scrambled between revisions - val z = buffer.g2Alt2() - val x = buffer.g2Alt3() val keyCombination = buffer.g1() + val z = buffer.g2() + val x = buffer.g2Alt2() // The arguments below are consistent across revisions val minimapWidth = buffer.g1() diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/OculusLeaveDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/OculusLeaveDecoder.kt index 700cc821..de27fbbc 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/OculusLeaveDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/OculusLeaveDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.user.OculusLeave import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.user.OculusLeave import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class OculusLeaveDecoder : ProxyMessageDecoder { +public class OculusLeaveDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OCULUS_LEAVE override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SendSnapshotDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SendSnapshotDecoder.kt index a8e86c80..0f8a7b97 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SendSnapshotDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SendSnapshotDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.user.SendSnapshot import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.user.SendSnapshot import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class SendSnapshotDecoder : ProxyMessageDecoder { +public class SendSnapshotDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.SEND_SNAPSHOT override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SetChatFilterSettingsDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SetChatFilterSettingsDecoder.kt index 5da56584..6beb0be3 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SetChatFilterSettingsDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SetChatFilterSettingsDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.user.SetChatFilterSettings import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.user.SetChatFilterSettings import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class SetChatFilterSettingsDecoder : ProxyMessageDecoder { +public class SetChatFilterSettingsDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.SET_CHATFILTERSETTINGS override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SetHeadingDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SetHeadingDecoder.kt index 420a673d..417f0563 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SetHeadingDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/SetHeadingDecoder.kt @@ -2,19 +2,19 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.user.SetHeading import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.user.SetHeading import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class SetHeadingDecoder : ProxyMessageDecoder { +public class SetHeadingDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.SET_HEADING override fun decode( buffer: JagByteBuf, session: Session, ): SetHeading { - val heading = buffer.g1Alt1() + val heading = buffer.g1Alt3() return SetHeading(heading) } } diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/TeleportDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/TeleportDecoder.kt index 1bf92098..428d9da0 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/TeleportDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/misc/user/TeleportDecoder.kt @@ -2,21 +2,21 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.misc.user import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.misc.user.Teleport import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.misc.user.Teleport import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class TeleportDecoder : ProxyMessageDecoder { +public class TeleportDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.TELEPORT override fun decode( buffer: JagByteBuf, session: Session, ): Teleport { - val oculusSyncValue = buffer.g4Alt2() val x = buffer.g2Alt2() - val z = buffer.g2Alt2() + val z = buffer.g2Alt3() + val oculusSyncValue = buffer.g4Alt2() val level = buffer.g1Alt2() return Teleport( oculusSyncValue, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc1Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc1Decoder.kt index 58f52ce1..0aecd9d6 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc1Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc1Decoder.kt @@ -2,20 +2,20 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.npcs.OpNpc import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.npcs.OpNpc import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpNpc1Decoder : ProxyMessageDecoder { +public class OpNpc1Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPNPC1 override fun decode( buffer: JagByteBuf, session: Session, ): OpNpc { - val controlKey = buffer.g1() == 1 - val index = buffer.g2Alt1() + val controlKey = buffer.g1Alt1() == 1 + val index = buffer.g2Alt2() return OpNpc( index, controlKey, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc2Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc2Decoder.kt index d89a07a0..ca842f46 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc2Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc2Decoder.kt @@ -2,19 +2,19 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.npcs.OpNpc import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.npcs.OpNpc import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpNpc2Decoder : ProxyMessageDecoder { +public class OpNpc2Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPNPC2 override fun decode( buffer: JagByteBuf, session: Session, ): OpNpc { - val index = buffer.g2() + val index = buffer.g2Alt3() val controlKey = buffer.g1Alt2() == 1 return OpNpc( index, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc3Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc3Decoder.kt index 9f6a2576..bf553de1 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc3Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc3Decoder.kt @@ -2,19 +2,19 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.npcs.OpNpc import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.npcs.OpNpc import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpNpc3Decoder : ProxyMessageDecoder { +public class OpNpc3Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPNPC3 override fun decode( buffer: JagByteBuf, session: Session, ): OpNpc { - val index = buffer.g2Alt1() + val index = buffer.g2Alt3() val controlKey = buffer.g1Alt2() == 1 return OpNpc( index, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc4Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc4Decoder.kt index 43894658..b298cf98 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc4Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc4Decoder.kt @@ -2,20 +2,20 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.npcs.OpNpc import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.npcs.OpNpc import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpNpc4Decoder : ProxyMessageDecoder { +public class OpNpc4Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPNPC4 override fun decode( buffer: JagByteBuf, session: Session, ): OpNpc { + val controlKey = buffer.g1() == 1 val index = buffer.g2() - val controlKey = buffer.g1Alt1() == 1 return OpNpc( index, controlKey, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc5Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc5Decoder.kt index cdb0323e..b0af5931 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc5Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc5Decoder.kt @@ -2,20 +2,20 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.npcs.OpNpc import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.npcs.OpNpc import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpNpc5Decoder : ProxyMessageDecoder { +public class OpNpc5Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPNPC5 override fun decode( buffer: JagByteBuf, session: Session, ): OpNpc { - val index = buffer.g2Alt1() - val controlKey = buffer.g1Alt1() == 1 + val index = buffer.g2() + val controlKey = buffer.g1Alt3() == 1 return OpNpc( index, controlKey, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc6Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc6Decoder.kt index b882c04c..5cb36d68 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc6Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpc6Decoder.kt @@ -2,19 +2,19 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.npcs.OpNpc6 import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.npcs.OpNpc6 import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpNpc6Decoder : ProxyMessageDecoder { +public class OpNpc6Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPNPC6 override fun decode( buffer: JagByteBuf, session: Session, ): OpNpc6 { - val id = buffer.g2Alt3() + val id = buffer.g2Alt1() return OpNpc6(id) } } diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpcTDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpcTDecoder.kt index 99247c94..0df36a73 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpcTDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/npcs/OpNpcTDecoder.kt @@ -2,24 +2,24 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.npcs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.util.gCombinedIdAlt1 -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.npcs.OpNpcT import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.npcs.OpNpcT import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.util.gCombinedIdAlt2 -internal class OpNpcTDecoder : ProxyMessageDecoder { +public class OpNpcTDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPNPCT override fun decode( buffer: JagByteBuf, session: Session, ): OpNpcT { - val controlKey = buffer.g1Alt1() == 1 - val selectedCombinedId = buffer.gCombinedIdAlt1() - val selectedSub = buffer.g2Alt3() - val selectedObj = buffer.g2() - val index = buffer.g2Alt1() + val controlKey = buffer.g1Alt3() == 1 + val index = buffer.g2Alt3() + val selectedSub = buffer.g2Alt1() + val selectedCombinedId = buffer.gCombinedIdAlt2() + val selectedObj = buffer.g2Alt3() return OpNpcT( index, controlKey, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj1Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj1Decoder.kt index 4313f341..97afea4c 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj1Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj1Decoder.kt @@ -2,22 +2,22 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.objs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.objs.OpObj import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.objs.OpObj import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpObj1Decoder : ProxyMessageDecoder { +public class OpObj1Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPOBJ1 override fun decode( buffer: JagByteBuf, session: Session, ): OpObj { - val z = buffer.g2() - val controlKey = buffer.g1Alt3() == 1 - val x = buffer.g2Alt3() - val id = buffer.g2Alt2() + val x = buffer.g2Alt2() + val id = buffer.g2Alt1() + val z = buffer.g2Alt2() + val controlKey = buffer.g1Alt1() == 1 return OpObj( id, x, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj2Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj2Decoder.kt index 8e911cdb..74f93181 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj2Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj2Decoder.kt @@ -2,21 +2,21 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.objs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.objs.OpObj import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.objs.OpObj import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpObj2Decoder : ProxyMessageDecoder { +public class OpObj2Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPOBJ2 override fun decode( buffer: JagByteBuf, session: Session, ): OpObj { - val z = buffer.g2Alt2() val id = buffer.g2Alt3() - val x = buffer.g2() + val x = buffer.g2Alt3() + val z = buffer.g2() val controlKey = buffer.g1() == 1 return OpObj( id, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj3Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj3Decoder.kt index ea863bd5..4940b21b 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj3Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj3Decoder.kt @@ -2,22 +2,22 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.objs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.objs.OpObj import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.objs.OpObj import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpObj3Decoder : ProxyMessageDecoder { +public class OpObj3Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPOBJ3 override fun decode( buffer: JagByteBuf, session: Session, ): OpObj { - val controlKey = buffer.g1Alt2() == 1 - val x = buffer.g2Alt2() + val controlKey = buffer.g1() == 1 + val x = buffer.g2() + val id = buffer.g2() val z = buffer.g2Alt2() - val id = buffer.g2Alt3() return OpObj( id, x, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj4Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj4Decoder.kt index 679ccd1c..a0a79d8f 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj4Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj4Decoder.kt @@ -2,12 +2,12 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.objs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.objs.OpObj import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.objs.OpObj import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpObj4Decoder : ProxyMessageDecoder { +public class OpObj4Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPOBJ4 override fun decode( @@ -15,8 +15,8 @@ internal class OpObj4Decoder : ProxyMessageDecoder { session: Session, ): OpObj { val z = buffer.g2Alt3() + val id = buffer.g2Alt3() val x = buffer.g2Alt2() - val id = buffer.g2() val controlKey = buffer.g1Alt2() == 1 return OpObj( id, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj5Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj5Decoder.kt index e90858b0..4f3eed66 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj5Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj5Decoder.kt @@ -2,22 +2,22 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.objs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.objs.OpObj import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.objs.OpObj import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpObj5Decoder : ProxyMessageDecoder { +public class OpObj5Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPOBJ5 override fun decode( buffer: JagByteBuf, session: Session, ): OpObj { - val z = buffer.g2Alt2() - val id = buffer.g2() - val x = buffer.g2() - val controlKey = buffer.g1Alt1() == 1 + val controlKey = buffer.g1Alt3() == 1 + val z = buffer.g2() + val x = buffer.g2Alt1() + val id = buffer.g2Alt2() return OpObj( id, x, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj6Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj6Decoder.kt index 49cb3313..c0c4106a 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj6Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObj6Decoder.kt @@ -2,21 +2,21 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.objs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.objs.OpObj6 import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.objs.OpObj6 import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpObj6Decoder : ProxyMessageDecoder { +public class OpObj6Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPOBJ6 override fun decode( buffer: JagByteBuf, session: Session, ): OpObj6 { - val x = buffer.g2Alt3() - val id = buffer.g2() + val id = buffer.g2Alt1() val z = buffer.g2() + val x = buffer.g2() return OpObj6( id, x, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObjTDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObjTDecoder.kt index 3eb13f05..65d0c8c1 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObjTDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/objs/OpObjTDecoder.kt @@ -2,26 +2,26 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.objs import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.util.gCombinedIdAlt1 -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.objs.OpObjT import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.objs.OpObjT import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.util.gCombinedIdAlt2 -internal class OpObjTDecoder : ProxyMessageDecoder { +public class OpObjTDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPOBJT override fun decode( buffer: JagByteBuf, session: Session, ): OpObjT { - val x = buffer.g2Alt3() - val controlKey = buffer.g1Alt3() == 1 + val x = buffer.g2() val z = buffer.g2Alt2() - val selectedSub = buffer.g2Alt3() - val selectedCombinedId = buffer.gCombinedIdAlt1() - val id = buffer.g2() - val selectedObj = buffer.g2() + val id = buffer.g2Alt3() + val selectedCombinedId = buffer.gCombinedIdAlt2() + val selectedObj = buffer.g2Alt1() + val controlKey = buffer.g1() == 1 + val selectedSub = buffer.g2Alt2() return OpObjT( id, x, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer1Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer1Decoder.kt index 0b2a4e94..08ba1d6e 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer1Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer1Decoder.kt @@ -2,20 +2,20 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.players import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.players.OpPlayer import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.players.OpPlayer import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpPlayer1Decoder : ProxyMessageDecoder { +public class OpPlayer1Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPPLAYER1 override fun decode( buffer: JagByteBuf, session: Session, ): OpPlayer { - val controlKey = buffer.g1Alt2() == 1 - val index = buffer.g2Alt3() + val controlKey = buffer.g1Alt1() == 1 + val index = buffer.g2Alt1() return OpPlayer( index, controlKey, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer2Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer2Decoder.kt index 2b58eae0..0570b834 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer2Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer2Decoder.kt @@ -2,20 +2,20 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.players import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.players.OpPlayer import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.players.OpPlayer import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpPlayer2Decoder : ProxyMessageDecoder { +public class OpPlayer2Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPPLAYER2 override fun decode( buffer: JagByteBuf, session: Session, ): OpPlayer { - val index = buffer.g2() - val controlKey = buffer.g1Alt2() == 1 + val index = buffer.g2Alt3() + val controlKey = buffer.g1Alt1() == 1 return OpPlayer( index, controlKey, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer3Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer3Decoder.kt index f9e713c3..ac28989d 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer3Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer3Decoder.kt @@ -2,20 +2,20 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.players import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.players.OpPlayer import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.players.OpPlayer import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpPlayer3Decoder : ProxyMessageDecoder { +public class OpPlayer3Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPPLAYER3 override fun decode( buffer: JagByteBuf, session: Session, ): OpPlayer { - val controlKey = buffer.g1Alt3() == 1 - val index = buffer.g2() + val index = buffer.g2Alt3() + val controlKey = buffer.g1() == 1 return OpPlayer( index, controlKey, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer4Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer4Decoder.kt index ba28f63a..f694159e 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer4Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer4Decoder.kt @@ -2,20 +2,20 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.players import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.players.OpPlayer import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.players.OpPlayer import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpPlayer4Decoder : ProxyMessageDecoder { +public class OpPlayer4Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPPLAYER4 override fun decode( buffer: JagByteBuf, session: Session, ): OpPlayer { - val index = buffer.g2Alt2() - val controlKey = buffer.g1() == 1 + val index = buffer.g2Alt3() + val controlKey = buffer.g1Alt1() == 1 return OpPlayer( index, controlKey, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer5Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer5Decoder.kt index 8280a032..e733d2fb 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer5Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer5Decoder.kt @@ -2,20 +2,20 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.players import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.players.OpPlayer import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.players.OpPlayer import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpPlayer5Decoder : ProxyMessageDecoder { +public class OpPlayer5Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPPLAYER5 override fun decode( buffer: JagByteBuf, session: Session, ): OpPlayer { - val index = buffer.g2Alt1() - val controlKey = buffer.g1() == 1 + val index = buffer.g2() + val controlKey = buffer.g1Alt2() == 1 return OpPlayer( index, controlKey, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer6Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer6Decoder.kt index 95c7a249..a928b7a7 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer6Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer6Decoder.kt @@ -2,20 +2,20 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.players import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.players.OpPlayer import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.players.OpPlayer import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpPlayer6Decoder : ProxyMessageDecoder { +public class OpPlayer6Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPPLAYER6 override fun decode( buffer: JagByteBuf, session: Session, ): OpPlayer { - val index = buffer.g2Alt3() val controlKey = buffer.g1Alt2() == 1 + val index = buffer.g2Alt2() return OpPlayer( index, controlKey, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer7Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer7Decoder.kt index a6cfdea5..59280fdb 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer7Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer7Decoder.kt @@ -2,20 +2,20 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.players import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.players.OpPlayer import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.players.OpPlayer import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpPlayer7Decoder : ProxyMessageDecoder { +public class OpPlayer7Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPPLAYER7 override fun decode( buffer: JagByteBuf, session: Session, ): OpPlayer { - val controlKey = buffer.g1Alt3() == 1 - val index = buffer.g2() + val index = buffer.g2Alt3() + val controlKey = buffer.g1() == 1 return OpPlayer( index, controlKey, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer8Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer8Decoder.kt index e863e78e..3fe53338 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer8Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayer8Decoder.kt @@ -2,20 +2,20 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.players import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.players.OpPlayer import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.players.OpPlayer import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder -internal class OpPlayer8Decoder : ProxyMessageDecoder { +public class OpPlayer8Decoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPPLAYER8 override fun decode( buffer: JagByteBuf, session: Session, ): OpPlayer { - val controlKey = buffer.g1Alt2() == 1 - val index = buffer.g2() + val index = buffer.g2Alt3() + val controlKey = buffer.g1Alt1() == 1 return OpPlayer( index, controlKey, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayerTDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayerTDecoder.kt index f701768f..b7251d33 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayerTDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/players/OpPlayerTDecoder.kt @@ -2,24 +2,24 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.players import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.util.gCombinedIdAlt2 -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.players.OpPlayerT import net.rsprox.protocol.session.Session +import net.rsprox.protocol.game.incoming.model.players.OpPlayerT import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.util.gCombinedId -internal class OpPlayerTDecoder : ProxyMessageDecoder { +public class OpPlayerTDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.OPPLAYERT override fun decode( buffer: JagByteBuf, session: Session, ): OpPlayerT { - val selectedSub = buffer.g2() - val selectedCombinedId = buffer.gCombinedIdAlt2() - val selectedObj = buffer.g2Alt3() - val controlKey = buffer.g1() == 1 + val controlKey = buffer.g1Alt1() == 1 + val selectedSub = buffer.g2Alt1() + val selectedCombinedId = buffer.gCombinedId() val index = buffer.g2() + val selectedObj = buffer.g2() return OpPlayerT( index, controlKey, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePCountDialogDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePCountDialogDecoder.kt index 04a119b9..4635a63a 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePCountDialogDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePCountDialogDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.resumed import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.resumed.ResumePCountDialog import net.rsprox.protocol.session.Session import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.game.incoming.model.resumed.ResumePCountDialog +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class ResumePCountDialogDecoder : ProxyMessageDecoder { +public class ResumePCountDialogDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.RESUME_P_COUNTDIALOG override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePNameDialogDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePNameDialogDecoder.kt index 47e07617..97d4edda 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePNameDialogDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePNameDialogDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.resumed import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.resumed.ResumePNameDialog import net.rsprox.protocol.session.Session import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.game.incoming.model.resumed.ResumePNameDialog +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class ResumePNameDialogDecoder : ProxyMessageDecoder { +public class ResumePNameDialogDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.RESUME_P_NAMEDIALOG override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePObjDialogDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePObjDialogDecoder.kt index 3810ac34..2f069d9f 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePObjDialogDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePObjDialogDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.resumed import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.resumed.ResumePObjDialog import net.rsprox.protocol.session.Session import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.game.incoming.model.resumed.ResumePObjDialog +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class ResumePObjDialogDecoder : ProxyMessageDecoder { +public class ResumePObjDialogDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.RESUME_P_OBJDIALOG override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePStringDialogDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePStringDialogDecoder.kt index c07e627f..a682852d 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePStringDialogDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePStringDialogDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.resumed import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.resumed.ResumePStringDialog import net.rsprox.protocol.session.Session import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.game.incoming.model.resumed.ResumePStringDialog +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class ResumePStringDialogDecoder : ProxyMessageDecoder { +public class ResumePStringDialogDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.RESUME_P_STRINGDIALOG override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePauseButtonDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePauseButtonDecoder.kt index f242061b..c6317145 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePauseButtonDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/resumed/ResumePauseButtonDecoder.kt @@ -2,21 +2,21 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.resumed import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.util.gCombinedIdAlt2 -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.resumed.ResumePauseButton import net.rsprox.protocol.session.Session import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.game.incoming.model.resumed.ResumePauseButton +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.util.gCombinedIdAlt3 -internal class ResumePauseButtonDecoder : ProxyMessageDecoder { +public class ResumePauseButtonDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.RESUME_PAUSEBUTTON override fun decode( buffer: JagByteBuf, session: Session, ): ResumePauseButton { + val combinedId = buffer.gCombinedIdAlt3() val sub = buffer.g2Alt2() - val combinedId = buffer.gCombinedIdAlt2() return ResumePauseButton( combinedId, sub, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/FriendListAddDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/FriendListAddDecoder.kt index 01544e57..57886e51 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/FriendListAddDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/FriendListAddDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.social import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.social.FriendListAdd import net.rsprox.protocol.session.Session import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.game.incoming.model.social.FriendListAdd +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class FriendListAddDecoder : ProxyMessageDecoder { +public class FriendListAddDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.FRIENDLIST_ADD override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/FriendListDelDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/FriendListDelDecoder.kt index 63d97e9d..983d5521 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/FriendListDelDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/FriendListDelDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.social import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.social.FriendListDel import net.rsprox.protocol.session.Session import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.game.incoming.model.social.FriendListDel +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class FriendListDelDecoder : ProxyMessageDecoder { +public class FriendListDelDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.FRIENDLIST_DEL override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/IgnoreListAddDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/IgnoreListAddDecoder.kt index 7f86f03a..6c100d06 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/IgnoreListAddDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/IgnoreListAddDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.social import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.social.IgnoreListAdd import net.rsprox.protocol.session.Session import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.game.incoming.model.social.IgnoreListAdd +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class IgnoreListAddDecoder : ProxyMessageDecoder { +public class IgnoreListAddDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.IGNORELIST_ADD override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/IgnoreListDelDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/IgnoreListDelDecoder.kt index 00dc458d..58c7bd5c 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/IgnoreListDelDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/codec/social/IgnoreListDelDecoder.kt @@ -2,14 +2,14 @@ package net.rsprox.protocol.v228.game.incoming.decoder.codec.social import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.metadata.Consistent -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.incoming.model.social.IgnoreListDel import net.rsprox.protocol.session.Session import net.rsprox.protocol.v228.game.incoming.decoder.prot.GameClientProt +import net.rsprox.protocol.game.incoming.model.social.IgnoreListDel +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprot.protocol.metadata.Consistent @Consistent -internal class IgnoreListDelDecoder : ProxyMessageDecoder { +public class IgnoreListDelDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameClientProt.IGNORELIST_DEL override fun decode( diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/prot/GameClientProtId.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/prot/GameClientProtId.kt index 8e12f213..485af039 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/prot/GameClientProtId.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/incoming/decoder/prot/GameClientProtId.kt @@ -1,104 +1,104 @@ package net.rsprox.protocol.v228.game.incoming.decoder.prot internal object GameClientProtId { - const val OPOBJ6 = 0 - const val FRIENDCHAT_SETRANK = 1 - const val RESUME_P_COUNTDIALOG = 2 - const val OPNPC6 = 3 - const val OPLOC6 = 4 - const val CLANCHANNEL_KICKUSER = 5 - const val EVENT_NATIVE_MOUSE_MOVE = 6 - const val EVENT_APPLET_FOCUS = 7 - const val FRIENDCHAT_JOIN_LEAVE = 8 - const val OPPLAYER4 = 9 - const val RESUME_P_NAMEDIALOG = 10 - const val IF_BUTTONT = 11 - const val OPNPC4 = 12 - const val CLOSE_MODAL = 13 - const val IF_BUTTOND = 14 - const val CLANCHANNEL_FULL_REQUEST = 15 - const val UNKNOWN_BYTE = 16 - const val IGNORELIST_DEL = 17 - const val BUG_REPORT = 18 - const val IF_BUTTON4 = 19 - const val CLICKWORLDMAP = 20 - const val IF_BUTTON6 = 21 - const val OPOBJ1 = 22 - const val IF_BUTTON8 = 23 - const val AFFINEDCLANSETTINGS_ADDBANNED_FROMCHANNEL = 24 - const val OPNPCU = 25 - const val OPNPCT = 26 - const val OPNPC3 = 27 - const val MAP_BUILD_COMPLETE = 28 + const val OPNPCU = 0 + const val OCULUS_LEAVE = 1 + const val OPOBJ3 = 2 + const val CONNECTION_TELEMETRY = 3 + const val EVENT_MOUSE_MOVE = 4 + const val OPPLAYER4 = 5 + const val OPNPCT = 6 + const val IF_BUTTON1 = 7 + const val DETECT_MODIFIED_CLIENT = 8 + const val OPPLAYER7 = 9 + const val IF_BUTTON7 = 10 + const val IF_BUTTON9 = 11 + const val REFLECTION_CHECK_REPLY = 12 + const val IF_BUTTON8 = 13 + const val IGNORELIST_ADD = 14 + const val IF_BUTTON6 = 15 + const val SET_CHATFILTERSETTINGS = 16 + const val OPLOC6 = 17 + const val FRIENDCHAT_JOIN_LEAVE = 18 + const val RESUME_PAUSEBUTTON = 19 + const val MOVE_MINIMAPCLICK = 20 + const val CLANCHANNEL_KICKUSER = 21 + const val IF_BUTTON5 = 22 + const val OPPLAYER3 = 23 + const val CLOSE_MODAL = 24 + const val OPPLAYERU = 25 + const val OPOBJ1 = 26 + const val OPOBJ2 = 27 + const val CLIENT_CHEAT = 28 const val OPOBJ4 = 29 - const val IGNORELIST_ADD = 30 - const val OPOBJU = 31 - const val WINDOW_STATUS = 32 - const val OPOBJ3 = 33 - const val RESUME_PAUSEBUTTON = 34 - const val REFLECTION_CHECK_REPLY = 35 - const val IF_BUTTON1 = 36 - const val OPPLAYER5 = 37 - const val OPOBJ2 = 38 - const val OPLOC2 = 39 - const val SEND_SNAPSHOT = 40 - const val IF_BUTTON10 = 41 - const val OPLOC5 = 42 - const val MOVE_MINIMAPCLICK = 43 - const val OPPLAYER3 = 44 - const val EVENT_CAMERA_POSITION = 45 - const val OPPLAYERT = 46 - const val MEMBERSHIP_PROMOTION_ELIGIBILITY = 47 - const val RESUME_P_STRINGDIALOG = 48 - const val OPPLAYER6 = 49 - const val SET_CHATFILTERSETTINGS = 50 - const val AFFINEDCLANSETTINGS_SETMUTED_FROMCHANNEL = 51 - const val OPLOC3 = 52 - const val OPPLAYER2 = 53 - const val OPOBJT = 54 - const val OPPLAYERU = 55 - const val RESUME_P_OBJDIALOG = 56 - const val IF_BUTTON3 = 57 - const val FRIENDCHAT_KICK = 58 - const val CLANSETTINGS_FULL_REQUEST = 59 - const val OPLOCU = 60 - const val OPNPC1 = 61 - const val IDLE = 62 - const val MESSAGE_PRIVATE = 63 - const val MESSAGE_PUBLIC = 64 - const val OPLOC4 = 65 - const val DETECT_MODIFIED_CLIENT = 66 - const val HISCORE_REQUEST = 67 - const val UPDATE_PLAYER_MODEL_V2 = 68 - const val OCULUS_LEAVE = 69 - const val IF_BUTTON = 70 - const val IF_SUBOP = 71 - const val MOVE_GAMECLICK = 72 - const val IF_BUTTON2 = 73 - const val EVENT_NATIVE_MOUSE_CLICK = 74 - const val EVENT_KEYBOARD = 75 - const val IF_BUTTON9 = 76 - const val OPPLAYER7 = 77 - const val FRIENDLIST_ADD = 78 - const val NO_TIMEOUT = 79 - const val OPOBJ5 = 80 - const val OPLOCT = 81 - const val FRIENDLIST_DEL = 82 - const val SEND_PING_REPLY = 83 - const val OPPLAYER8 = 84 - const val EVENT_MOUSE_CLICK = 85 - const val OPLOC1 = 86 - const val IF_BUTTON7 = 87 - const val CLIENT_CHEAT = 88 - const val OPPLAYER1 = 89 - const val IF_CRMVIEW_CLICK = 90 - const val EVENT_MOUSE_MOVE = 91 - const val SOUND_JINGLEEND = 92 - const val EVENT_MOUSE_SCROLL = 93 - const val OPNPC5 = 94 - const val TELEPORT = 95 - const val OPNPC2 = 96 - const val IF_BUTTON5 = 97 - const val SET_HEADING = 98 - const val CONNECTION_TELEMETRY = 99 + const val IF_BUTTON4 = 30 + const val OPNPC4 = 31 + const val CLANSETTINGS_FULL_REQUEST = 32 + const val IF_BUTTON2 = 33 + const val FRIENDCHAT_KICK = 34 + const val EVENT_NATIVE_MOUSE_MOVE = 35 + const val CLICKWORLDMAP = 36 + const val OPPLAYER6 = 37 + const val EVENT_KEYBOARD = 38 + const val OPPLAYER8 = 39 + const val OPLOC5 = 40 + const val RESUME_P_COUNTDIALOG = 41 + const val OPNPC1 = 42 + const val RESUME_P_NAMEDIALOG = 43 + const val OPLOC4 = 44 + const val CLANCHANNEL_FULL_REQUEST = 45 + const val EVENT_APPLET_FOCUS = 46 + const val OPLOC1 = 47 + const val UPDATE_PLAYER_MODEL_V2 = 48 + const val OPPLAYER5 = 49 + const val WINDOW_STATUS = 50 + const val MESSAGE_PRIVATE = 51 + const val TELEPORT = 52 + const val IF_BUTTON = 53 + const val IF_BUTTON10 = 54 + const val OPLOC3 = 55 + const val SEND_PING_REPLY = 56 + const val OPPLAYERT = 57 + const val FRIENDLIST_ADD = 58 + const val IF_BUTTOND = 59 + const val IF_BUTTON3 = 60 + const val OPOBJ6 = 61 + const val MOVE_GAMECLICK = 62 + const val FRIENDCHAT_SETRANK = 63 + const val OPPLAYER1 = 64 + const val OPNPC5 = 65 + const val OPNPC2 = 66 + const val OPNPC6 = 67 + const val BUG_REPORT = 68 + const val SET_HEADING = 69 + const val SEND_SNAPSHOT = 70 + const val OPOBJU = 71 + const val EVENT_MOUSE_SCROLL = 72 + const val EVENT_CAMERA_POSITION = 73 + const val IF_CRMVIEW_CLICK = 74 + const val OPOBJ5 = 75 + const val HISCORE_REQUEST = 76 + const val OPLOCU = 77 + const val OPLOC2 = 78 + const val EVENT_NATIVE_MOUSE_CLICK = 79 + const val MESSAGE_PUBLIC = 80 + const val OPNPC3 = 81 + const val MAP_BUILD_COMPLETE = 82 + const val IGNORELIST_DEL = 83 + const val RESUME_P_OBJDIALOG = 84 + const val OPPLAYER2 = 85 + const val OPOBJT = 86 + const val FRIENDLIST_DEL = 87 + const val OPLOCT = 88 + const val NO_TIMEOUT = 89 + const val RESUME_P_STRINGDIALOG = 90 + const val AFFINEDCLANSETTINGS_ADDBANNED_FROMCHANNEL = 91 + const val IDLE = 92 + const val SOUND_JINGLEEND = 93 + const val MEMBERSHIP_PROMOTION_ELIGIBILITY = 94 + const val AFFINEDCLANSETTINGS_SETMUTED_FROMCHANNEL = 95 + const val IF_BUTTONT = 96 + const val IF_SUBOP = 97 + const val EVENT_MOUSE_CLICK = 98 + const val UNKNOWN_BYTE = 99 } From 404c093c8213900c497745cd272f78310c632ed3 Mon Sep 17 00:00:00 2001 From: Kris Date: Thu, 16 Jan 2025 02:21:51 +0200 Subject: [PATCH 4/8] feat: fill in loc add change v2 (incomplete) --- .../codec/zone/payload/LocAddChangeDecoder.kt | 8 +- .../codec/zone/payload/LocAddChangeDecoder.kt | 8 +- .../codec/zone/payload/LocAddChangeDecoder.kt | 8 +- .../codec/zone/payload/LocAddChangeDecoder.kt | 8 +- .../codec/zone/payload/LocAddChangeDecoder.kt | 8 +- .../UpdateZonePartialEnclosedDecoder.kt | 7 +- ...ngeDecoder.kt => LocAddChangeV1Decoder.kt} | 10 +- .../zone/payload/LocAddChangeV2Decoder.kt | 33 +++ .../outgoing/decoder/prot/GameServerProt.kt | 3 +- .../outgoing/decoder/prot/GameServerProtId.kt | 269 +++++++++--------- .../prot/ServerMessageDecoderRepository.kt | 6 +- .../protocol/common/OldSchoolZoneProt.kt | 3 +- .../{LocAddChange.kt => LocAddChangeV1.kt} | 10 +- .../model/zone/payload/LocAddChangeV2.kt | 120 ++++++++ .../transcriber/indexer/IndexerTranscriber.kt | 6 +- .../interfaces/ServerPacketTranscriber.kt | 4 +- .../text/TextServerPacketTranscriber.kt | 10 +- 17 files changed, 341 insertions(+), 180 deletions(-) rename protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/{LocAddChangeDecoder.kt => LocAddChangeV1Decoder.kt} (87%) create mode 100644 protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocAddChangeV2Decoder.kt rename protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/zone/payload/{LocAddChange.kt => LocAddChangeV1.kt} (92%) create mode 100644 protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/zone/payload/LocAddChangeV2.kt diff --git a/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt b/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt index af0c0ba3..f6349d74 100644 --- a/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt +++ b/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt @@ -4,24 +4,24 @@ import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.util.OpFlags -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChange +import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChangeV1 import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone import net.rsprox.protocol.game.outgoing.model.zone.payload.util.LocProperties import net.rsprox.protocol.session.Session import net.rsprox.protocol.v223.game.outgoing.decoder.prot.GameServerProt -internal class LocAddChangeDecoder : ProxyMessageDecoder { +internal class LocAddChangeDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameServerProt.LOC_ADD_CHANGE override fun decode( buffer: JagByteBuf, session: Session, - ): LocAddChange { + ): LocAddChangeV1 { val locProperties = LocProperties(buffer.g1Alt2()) val opFlags = OpFlags(buffer.g1Alt3()) val coordInZone = CoordInZone(buffer.g1Alt3()) val id = buffer.g2Alt2() - return LocAddChange( + return LocAddChangeV1( id, coordInZone, locProperties, diff --git a/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt b/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt index c29cd84d..29959aa5 100644 --- a/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt +++ b/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt @@ -4,24 +4,24 @@ import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.util.OpFlags -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChange +import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChangeV1 import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone import net.rsprox.protocol.game.outgoing.model.zone.payload.util.LocProperties import net.rsprox.protocol.session.Session import net.rsprox.protocol.v224.game.outgoing.decoder.prot.GameServerProt -internal class LocAddChangeDecoder : ProxyMessageDecoder { +internal class LocAddChangeDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameServerProt.LOC_ADD_CHANGE override fun decode( buffer: JagByteBuf, session: Session, - ): LocAddChange { + ): LocAddChangeV1 { val locProperties = LocProperties(buffer.g1Alt2()) val coordInZone = CoordInZone(buffer.g1()) val opFlags = OpFlags(buffer.g1Alt2()) val id = buffer.g2Alt1() - return LocAddChange( + return LocAddChangeV1( id, coordInZone, locProperties, diff --git a/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt b/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt index 2baf5c38..4a19f7c3 100644 --- a/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt +++ b/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt @@ -4,24 +4,24 @@ import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.util.OpFlags -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChange +import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChangeV1 import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone import net.rsprox.protocol.game.outgoing.model.zone.payload.util.LocProperties import net.rsprox.protocol.session.Session import net.rsprox.protocol.v225.game.outgoing.decoder.prot.GameServerProt -internal class LocAddChangeDecoder : ProxyMessageDecoder { +internal class LocAddChangeDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameServerProt.LOC_ADD_CHANGE override fun decode( buffer: JagByteBuf, session: Session, - ): LocAddChange { + ): LocAddChangeV1 { val id = buffer.g2Alt2() val opFlags = OpFlags(buffer.g1Alt2()) val locProperties = LocProperties(buffer.g1Alt2()) val coordInZone = CoordInZone(buffer.g1Alt2()) - return LocAddChange( + return LocAddChangeV1( id, coordInZone, locProperties, diff --git a/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt b/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt index 4926fd3f..440dc75c 100644 --- a/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt +++ b/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt @@ -4,24 +4,24 @@ import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.util.OpFlags -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChange +import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChangeV1 import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone import net.rsprox.protocol.game.outgoing.model.zone.payload.util.LocProperties import net.rsprox.protocol.session.Session import net.rsprox.protocol.v226.game.outgoing.decoder.prot.GameServerProt -internal class LocAddChangeDecoder : ProxyMessageDecoder { +internal class LocAddChangeDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameServerProt.LOC_ADD_CHANGE override fun decode( buffer: JagByteBuf, session: Session, - ): LocAddChange { + ): LocAddChangeV1 { val locProperties = LocProperties(buffer.g1Alt3()) val opFlags = OpFlags(buffer.g1Alt3()) val id = buffer.g2Alt1() val coordInZone = CoordInZone(buffer.g1Alt1()) - return LocAddChange( + return LocAddChangeV1( id, coordInZone, locProperties, diff --git a/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt b/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt index 29bf36fc..3232fbc2 100644 --- a/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt +++ b/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/codec/zone/payload/LocAddChangeDecoder.kt @@ -4,24 +4,24 @@ import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.util.OpFlags -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChange +import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChangeV1 import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone import net.rsprox.protocol.game.outgoing.model.zone.payload.util.LocProperties import net.rsprox.protocol.session.Session import net.rsprox.protocol.v227.game.outgoing.decoder.prot.GameServerProt -internal class LocAddChangeDecoder : ProxyMessageDecoder { +internal class LocAddChangeDecoder : ProxyMessageDecoder { override val prot: ClientProt = GameServerProt.LOC_ADD_CHANGE override fun decode( buffer: JagByteBuf, session: Session, - ): LocAddChange { + ): LocAddChangeV1 { val opFlags = OpFlags(buffer.g1Alt1()) val id = buffer.g2() val locProperties = LocProperties(buffer.g1Alt3()) val coordInZone = CoordInZone(buffer.g1()) - return LocAddChange( + return LocAddChangeV1( id, coordInZone, locProperties, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZonePartialEnclosedDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZonePartialEnclosedDecoder.kt index bebc457f..e91b6642 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZonePartialEnclosedDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZonePartialEnclosedDecoder.kt @@ -6,7 +6,9 @@ import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.IncomingZoneProt import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZonePartialEnclosed import net.rsprox.protocol.session.Session -import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.LocAddChangeDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.* +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.LocAddChangeV1Decoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.LocAddChangeV2Decoder import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.LocAnimDecoder import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.LocDelDecoder import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.LocMergeDecoder @@ -51,7 +53,7 @@ internal class UpdateZonePartialEnclosedDecoder : ProxyMessageDecoder, ) { MAP_PROJANIM(MapProjAnimDecoder()), - LOC_ADD_CHANGE(LocAddChangeDecoder()), + LOC_ADD_CHANGE_V1(LocAddChangeV1Decoder()), OBJ_UNCUSTOMISE(ObjUncustomiseDecoder()), OBJ_COUNT(ObjCountDecoder()), OBJ_ENABLED_OPS(ObjEnabledOpsDecoder()), @@ -63,5 +65,6 @@ internal class UpdateZonePartialEnclosedDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.LOC_ADD_CHANGE +internal class LocAddChangeV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.LOC_ADD_CHANGE_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): LocAddChange { + ): LocAddChangeV1 { val opFlags = OpFlags(buffer.g1Alt1()) val id = buffer.g2() val locProperties = LocProperties(buffer.g1Alt3()) val coordInZone = CoordInZone(buffer.g1()) - return LocAddChange( + return LocAddChangeV1( id, coordInZone, locProperties, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocAddChangeV2Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocAddChangeV2Decoder.kt new file mode 100644 index 00000000..6a2779d9 --- /dev/null +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocAddChangeV2Decoder.kt @@ -0,0 +1,33 @@ +package net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.util.OpFlags +import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChangeV1 +import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChangeV2 +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.LocProperties +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v228.game.outgoing.decoder.prot.GameServerProt + +internal class LocAddChangeV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.LOC_ADD_CHANGE_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): LocAddChangeV2 { + val opFlags = OpFlags(buffer.g1Alt1()) + val id = buffer.g2() + val locProperties = LocProperties(buffer.g1Alt3()) + val coordInZone = CoordInZone(buffer.g1()) + // TODO + return LocAddChangeV2( + id, + coordInZone, + locProperties, + opFlags, + ) + } +} diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/GameServerProt.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/GameServerProt.kt index d42424a5..6fbdd912 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/GameServerProt.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/GameServerProt.kt @@ -49,7 +49,8 @@ public enum class GameServerProt( UPDATE_ZONE_PARTIAL_ENCLOSED(GameServerProtId.UPDATE_ZONE_PARTIAL_ENCLOSED, Prot.VAR_SHORT), // Zone payload packets - LOC_ADD_CHANGE(GameServerProtId.LOC_ADD_CHANGE, 5), + LOC_ADD_CHANGE_V1(GameServerProtId.LOC_ADD_CHANGE_V1, 5), + LOC_ADD_CHANGE_V2(GameServerProtId.LOC_ADD_CHANGE_V2, -2), LOC_DEL(GameServerProtId.LOC_DEL, 2), LOC_ANIM(GameServerProtId.LOC_ANIM, 4), LOC_MERGE(GameServerProtId.LOC_MERGE, 14), diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/GameServerProtId.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/GameServerProtId.kt index eb1a5be9..a7721f96 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/GameServerProtId.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/GameServerProtId.kt @@ -1,140 +1,141 @@ package net.rsprox.protocol.v228.game.outgoing.decoder.prot internal object GameServerProtId { - const val NPC_HEADICON_SPECIFIC = 0 - const val LOGOUT_TRANSFER = 1 - const val CLANSETTINGS_FULL = 2 - const val MINIMAP_TOGGLE = 3 - const val CAM_SHAKE = 4 - const val OBJ_ADD = 5 - const val SET_ACTIVE_WORLD = 6 - const val IF_SETCOLOUR = 7 - const val IF_SETHIDE = 8 - const val CAM_RESET = 9 - const val IF_RESYNC = 10 - const val IF_SETMODEL = 11 + const val SET_PLAYER_OP = 0 + const val CAM_ROTATETO = 1 + const val IF_SETNPCHEAD = 2 + const val IF_SETEVENTS = 3 + const val MAP_ANIM_SPECIFIC = 4 + const val LOC_ANIM_SPECIFIC = 5 + const val MIDI_JINGLE = 6 + const val LOC_ANIM = 7 + const val LOC_DEL = 8 + const val IF_SETANGLE = 9 + const val UPDATE_RUNENERGY = 10 + const val IF_SETPOSITION = 11 const val RUNCLIENTSCRIPT = 12 - const val IF_SETTEXT = 13 - const val HIDEOBJOPS = 14 - const val MESSAGE_FRIENDCHANNEL = 15 - const val CAM_LOOKAT_EASED_COORD = 16 - const val SITE_SETTINGS = 17 - const val CAM_TARGET_V2 = 18 - const val REFLECTION_CHECKER = 19 - const val IF_CLEARINV = 20 - const val IF_SETNPCHEAD_ACTIVE = 21 - const val REBUILD_NORMAL = 22 - const val SERVER_TICK_END = 23 - const val REBUILD_WORLDENTITY = 24 - const val UPDATE_RUNENERGY = 25 - const val VARCLAN_ENABLE = 26 - const val IF_SETNPCHEAD = 27 - const val MIDI_SONG_WITHSECONDARY = 28 - const val CHAT_FILTER_SETTINGS_PRIVATECHAT = 29 - const val UPDATE_UID192 = 30 - const val FRIENDLIST_LOADED = 31 - const val OBJ_COUNT = 32 - const val PLAYER_SPOTANIM_SPECIFIC = 33 - const val HISCORE_REPLY = 34 - const val OBJ_DEL = 35 - const val MESSAGE_PRIVATE = 36 - const val HINT_ARROW = 37 - const val VARP_RESET = 38 - const val UPDATE_FRIENDLIST = 39 - const val CLEAR_ENTITIES = 40 - const val UPDATE_TRADINGPOST = 41 - const val IF_MOVESUB = 42 - const val UPDATE_ZONE_FULL_FOLLOWS = 43 - const val CLANCHANNEL_FULL = 44 - const val VARP_SMALL = 45 - const val PLAYER_INFO = 46 - const val LOC_DEL = 47 - const val UPDATE_RUNWEIGHT = 48 - const val IF_SETANGLE = 49 - const val UPDATE_INV_STOPTRANSMIT = 50 - const val IF_SETPLAYERMODEL_SELF = 51 - const val CAM_ROTATETO = 52 - const val SOUND_AREA = 53 - const val UPDATE_STOCKMARKET_SLOT = 54 - const val CAM_MOVETO = 55 - const val MAP_PROJANIM = 56 - const val SET_NPC_UPDATE_ORIGIN = 57 - const val SET_PLAYER_OP = 58 - const val MESSAGE_CLANCHANNEL_SYSTEM = 59 - const val IF_SETANIM = 60 - const val IF_SETPOSITION = 61 - const val UPDATE_ZONE_PARTIAL_FOLLOWS = 62 - const val CAM_MOVETO_CYCLES = 63 - const val MIDI_SWAP = 64 + const val IF_SETPLAYERMODEL_BASECOLOUR = 13 + const val CAM_ROTATEBY = 14 + const val UPDATE_FRIENDLIST = 15 + const val VARCLAN_DISABLE = 16 + const val UPDATE_ZONE_PARTIAL_ENCLOSED = 17 + const val IF_OPENTOP = 18 + const val OBJ_ADD = 19 + const val OBJ_DEL = 20 + const val REBUILD_WORLDENTITY = 21 + const val LOGOUT_WITHREASON = 22 + const val OCULUS_SYNC = 23 + const val IF_RESYNC = 24 + const val MIDI_SWAP = 25 + const val NPC_SPOTANIM_SPECIFIC = 26 + const val VARP_SMALL = 27 + const val MAP_PROJANIM = 28 + const val CAM_LOOKAT_EASED_COORD = 29 + const val CAM_SHAKE = 30 + const val REBUILD_REGION = 31 + const val IF_CLEARINV = 32 + const val SEND_PING = 33 + const val IF_SETMODEL = 34 + const val MIDI_SONG_WITHSECONDARY = 35 + const val LOGOUT_TRANSFER = 36 + const val URL_OPEN = 37 + const val IF_SETANIM = 38 + const val CAM_TARGET_V2 = 39 + const val SYNTH_SOUND = 40 + const val SET_HEATMAP_ENABLED = 41 + const val VARCLAN = 42 + const val IF_MOVESUB = 43 + const val LOC_ADD_CHANGE_V1 = 44 + const val CAM_RESET = 45 + const val OBJ_ENABLED_OPS = 46 + const val LOGOUT = 47 + const val MESSAGE_CLANCHANNEL = 48 + const val UPDATE_RUNWEIGHT = 49 + const val CAM_MOVETO_ARC = 50 + const val IF_SETSCROLLPOS = 51 + const val PLAYER_SPOTANIM_SPECIFIC = 52 + const val UNKNOWN_STRING = 53 + const val IF_SETOBJECT = 54 + const val VARCLAN_ENABLE = 55 + const val MESSAGE_GAME = 56 + const val CAM_MODE = 57 + const val REBUILD_NORMAL = 58 + const val IF_SETPLAYERHEAD = 59 + const val CLANCHANNEL_FULL = 60 + const val IF_SETHIDE = 61 + const val SET_MAP_FLAG = 62 + const val HISCORE_REPLY = 63 + const val UPDATE_STOCKMARKET_SLOT = 64 const val VARP_LARGE = 65 - const val NPC_ANIM_SPECIFIC = 66 - const val IF_SETPLAYERMODEL_BASECOLOUR = 67 - const val CAM_MODE = 68 - const val UPDATE_ZONE_PARTIAL_ENCLOSED = 69 - const val TRIGGER_ONDIALOGABORT = 70 - const val VARP_SYNC = 71 - const val MIDI_SONG_STOP = 72 - const val REBUILD_REGION = 73 - const val SET_HEATMAP_ENABLED = 74 - const val MAP_ANIM = 75 - const val IF_SETOBJECT = 76 - const val UPDATE_FRIENDCHAT_CHANNEL_SINGLEUSER = 77 - const val NPC_INFO_SMALL_V5 = 78 - const val HIDELOCOPS = 79 - const val RESET_ANIMS = 80 - const val MIDI_JINGLE = 81 - const val UPDATE_IGNORELIST = 82 - const val PLAYER_ANIM_SPECIFIC = 83 - const val URL_OPEN = 84 - const val CAM_MOVETO_ARC = 85 - const val MESSAGE_GAME = 86 - const val IF_SETEVENTS = 87 - const val CLANSETTINGS_DELTA = 88 - const val UPDATE_STAT_V2 = 89 - const val CLANCHANNEL_DELTA = 90 - const val CAM_SMOOTHRESET = 91 - const val IF_SETPLAYERMODEL_BODYTYPE = 92 - const val LOC_ANIM_SPECIFIC = 93 - const val CAM_ROTATEBY = 94 - const val SET_MAP_FLAG = 95 - const val CHAT_FILTER_SETTINGS = 96 - const val NPC_SPOTANIM_SPECIFIC = 97 - const val IF_SETPLAYERHEAD = 98 - const val IF_OPENTOP = 99 - const val OCULUS_SYNC = 100 - const val LOC_MERGE = 101 - const val IF_CLOSESUB = 102 - const val MAP_ANIM_SPECIFIC = 103 - const val MESSAGE_CLANCHANNEL = 104 - const val LOGOUT = 105 - const val UPDATE_INV_FULL = 106 - const val VARCLAN_DISABLE = 107 - const val PROJANIM_SPECIFIC_V3 = 108 - const val UPDATE_FRIENDCHAT_CHANNEL_FULL_V2 = 109 - const val UNKNOWN_STRING = 110 - const val UPDATE_REBOOT_TIMER = 111 - const val IF_SETROTATESPEED = 112 - const val SYNTH_SOUND = 113 - const val VARCLAN = 114 - const val SEND_PING = 115 - const val IF_OPENSUB = 116 - const val CAM_LOOKAT = 117 - const val MESSAGE_PRIVATE_ECHO = 118 - const val LOGOUT_WITHREASON = 119 - const val LOC_ANIM = 120 - const val IF_SETSCROLLPOS = 121 - const val HIDENPCOPS = 122 - const val IF_SETPLAYERMODEL_OBJ = 123 - const val UPDATE_INV_PARTIAL = 124 - const val LOC_ADD_CHANGE = 125 - const val MIDI_SONG_V2 = 126 - const val OBJ_ENABLED_OPS = 127 - const val SET_INTERACTION_MODE = 128 - const val RESET_INTERACTION_MODE = 129 - const val WORLDENTITY_INFO_V3 = 130 - const val OBJ_CUSTOMISE = 131 - const val OBJ_UNCUSTOMISE = 132 - const val WORLDENTITY_INFO_V4 = 133 - const val PACKET_GROUP_START = 134 - const val NPC_INFO_LARGE_V5 = 135 + const val UPDATE_UID192 = 66 + const val MIDI_SONG_STOP = 67 + const val CLANSETTINGS_FULL = 68 + const val IF_SETCOLOUR = 69 + const val IF_SETPLAYERMODEL_BODYTYPE = 70 + const val TRIGGER_ONDIALOGABORT = 71 + const val SITE_SETTINGS = 72 + const val UPDATE_REBOOT_TIMER = 73 + const val CAM_MOVETO_CYCLES = 74 + const val UPDATE_TRADINGPOST = 75 + const val UPDATE_INV_PARTIAL = 76 + const val HINT_ARROW = 77 + const val PLAYER_ANIM_SPECIFIC = 78 + const val IF_SETROTATESPEED = 79 + const val CAM_MOVETO = 80 + const val NPC_HEADICON_SPECIFIC = 81 + const val MAP_ANIM = 82 + const val LOC_ADD_CHANGE_V2 = 83 + const val CAM_SMOOTHRESET = 84 + const val CLANSETTINGS_DELTA = 85 + const val SERVER_TICK_END = 86 + const val IF_OPENSUB = 87 + const val VARP_SYNC = 88 + const val SET_ACTIVE_WORLD = 89 + const val SOUND_AREA = 90 + const val RESET_ANIMS = 91 + const val MESSAGE_CLANCHANNEL_SYSTEM = 92 + const val UPDATE_INV_STOPTRANSMIT = 93 + const val FRIENDLIST_LOADED = 94 + const val IF_CLOSESUB = 95 + const val PLAYER_INFO = 96 + const val UPDATE_STAT_V2 = 97 + const val PROJANIM_SPECIFIC_V3 = 98 + const val IF_SETNPCHEAD_ACTIVE = 99 + const val CHAT_FILTER_SETTINGS = 100 + const val UPDATE_ZONE_PARTIAL_FOLLOWS = 101 + const val UPDATE_FRIENDCHAT_CHANNEL_FULL_V2 = 102 + const val CHAT_FILTER_SETTINGS_PRIVATECHAT = 103 + const val VARP_RESET = 104 + const val MESSAGE_PRIVATE_ECHO = 105 + const val HIDENPCOPS = 106 + const val IF_SETPLAYERMODEL_OBJ = 107 + const val CAM_LOOKAT = 108 + const val MIDI_SONG_V2 = 109 + const val CLANCHANNEL_DELTA = 110 + const val UPDATE_IGNORELIST = 111 + const val MESSAGE_PRIVATE = 112 + const val MINIMAP_TOGGLE = 113 + const val LOC_MERGE = 114 + const val MESSAGE_FRIENDCHANNEL = 115 + const val UPDATE_ZONE_FULL_FOLLOWS = 116 + const val IF_SETPLAYERMODEL_SELF = 117 + const val REFLECTION_CHECKER = 118 + const val SET_NPC_UPDATE_ORIGIN = 119 + const val UPDATE_INV_FULL = 120 + const val UPDATE_FRIENDCHAT_CHANNEL_SINGLEUSER = 121 + const val CLEAR_ENTITIES = 122 + const val IF_SETTEXT = 123 + const val HIDELOCOPS = 124 + const val HIDEOBJOPS = 125 + const val OBJ_COUNT = 126 + const val NPC_ANIM_SPECIFIC = 127 + const val WORLDENTITY_INFO_V4 = 128 + const val NPC_INFO_LARGE_V5 = 129 + const val SET_INTERACTION_MODE = 130 + const val OBJ_UNCUSTOMISE = 131 + const val RESET_INTERACTION_MODE = 132 + const val NPC_INFO_SMALL_V5 = 133 + const val WORLDENTITY_INFO_V3 = 134 + const val OBJ_CUSTOMISE = 135 + const val PACKET_GROUP_START = 136 } diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt index 853acce7..7989eb23 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt @@ -129,7 +129,8 @@ import net.rsprox.protocol.v228.game.outgoing.decoder.codec.worldentity.SetActiv import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.header.UpdateZoneFullFollowsDecoder import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.header.UpdateZonePartialEnclosedDecoder import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.header.UpdateZonePartialFollowsDecoder -import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.LocAddChangeDecoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.* +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.LocAddChangeV1Decoder import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.LocAnimDecoder import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.LocDelDecoder import net.rsprox.protocol.v228.game.outgoing.decoder.codec.zone.payload.LocMergeDecoder @@ -294,7 +295,8 @@ internal object ServerMessageDecoderRepository { bind(UpdateZoneFullFollowsDecoder()) bind(UpdateZonePartialFollowsDecoder()) - bind(LocAddChangeDecoder()) + bind(LocAddChangeV1Decoder()) + bind(LocAddChangeV2Decoder()) bind(LocAnimDecoder()) bind(LocDelDecoder()) bind(LocMergeDecoder()) diff --git a/protocol/src/main/kotlin/net/rsprox/protocol/common/OldSchoolZoneProt.kt b/protocol/src/main/kotlin/net/rsprox/protocol/common/OldSchoolZoneProt.kt index b6e5b0cd..45150d50 100644 --- a/protocol/src/main/kotlin/net/rsprox/protocol/common/OldSchoolZoneProt.kt +++ b/protocol/src/main/kotlin/net/rsprox/protocol/common/OldSchoolZoneProt.kt @@ -1,7 +1,7 @@ package net.rsprox.protocol.common public object OldSchoolZoneProt { - public const val LOC_ADD_CHANGE: Int = 0 + public const val LOC_ADD_CHANGE_V1: Int = 0 public const val LOC_DEL: Int = 1 public const val LOC_ANIM: Int = 2 public const val LOC_MERGE: Int = 3 @@ -14,4 +14,5 @@ public object OldSchoolZoneProt { public const val SOUND_AREA: Int = 10 public const val OBJ_CUSTOMISE: Int = 11 public const val OBJ_UNCUSTOMISE: Int = 12 + public const val LOC_ADD_CHANGE_V2: Int = 13 } diff --git a/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/zone/payload/LocAddChange.kt b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/zone/payload/LocAddChangeV1.kt similarity index 92% rename from protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/zone/payload/LocAddChange.kt rename to protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/zone/payload/LocAddChangeV1.kt index ff83b29c..c1ef83cd 100644 --- a/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/zone/payload/LocAddChange.kt +++ b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/zone/payload/LocAddChangeV1.kt @@ -7,7 +7,7 @@ import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone import net.rsprox.protocol.game.outgoing.model.zone.payload.util.LocProperties /** - * Loc add-change packed is used to either add or change a loc in the world. + * Loc add-change v1 packe1 is used to either add or change a loc in the world. * The client will add a new loc if none exists by this description, * or overwrites an old one with the same layer (layer is obtained through the [shape] * property of the loc). @@ -20,7 +20,7 @@ import net.rsprox.protocol.game.outgoing.model.zone.payload.util.LocProperties * @property rotation the rotation of the loc, a value of 0 to 3 (inclusive) is expected. * @property opFlags the right-click options enabled on this loc. */ -public class LocAddChange private constructor( +public class LocAddChangeV1 private constructor( private val _id: UShort, private val coordInZone: CoordInZone, private val locProperties: LocProperties, @@ -68,13 +68,13 @@ public class LocAddChange private constructor( public val locPropertiesPacked: Int get() = locProperties.packed.toInt() - override val protId: Int = OldSchoolZoneProt.LOC_ADD_CHANGE + override val protId: Int = OldSchoolZoneProt.LOC_ADD_CHANGE_V1 override fun equals(other: Any?): Boolean { if (this === other) return true if (javaClass != other?.javaClass) return false - other as LocAddChange + other as LocAddChangeV1 if (_id != other._id) return false if (coordInZone != other.coordInZone) return false @@ -93,7 +93,7 @@ public class LocAddChange private constructor( } override fun toString(): String { - return "LocAddChange(" + + return "LocAddChangeV1(" + "id=$id, " + "xInZone=$xInZone, " + "zInZone=$zInZone, " + diff --git a/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/zone/payload/LocAddChangeV2.kt b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/zone/payload/LocAddChangeV2.kt new file mode 100644 index 00000000..f64b165b --- /dev/null +++ b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/zone/payload/LocAddChangeV2.kt @@ -0,0 +1,120 @@ +package net.rsprox.protocol.game.outgoing.model.zone.payload + +import net.rsprox.protocol.common.OldSchoolZoneProt +import net.rsprox.protocol.game.outgoing.model.IncomingZoneProt +import net.rsprox.protocol.game.outgoing.model.util.OpFlags +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.LocProperties + +/** + * Loc add-change v2 packet is used to either add or change a loc in the world. + * The client will add a new loc if none exists by this description, + * or overwrites an old one with the same layer (layer is obtained through the [shape] + * property of the loc). + * @property id the id of the loc to add + * @property xInZone the x coordinate of the loc within the zone it is in, + * a value in range of 0 to 7 (inclusive) is expected. Any bits outside that are ignored. + * @property zInZone the z coordinate of the loc within the zone it is in, + * a value in range of 0 to 7 (inclusive) is expected. Any bits outside that are ignored. + * @property shape the shape of the loc, a value of 0 to 22 (inclusive) is expected. + * @property rotation the rotation of the loc, a value of 0 to 3 (inclusive) is expected. + * @property opFlags the right-click options enabled on this loc. + * @property ops a map of mini menu ops to override the defaults with. + * If the map is null or empty, the ops will not be overridden and the ones provided in the + * respective cache config will be used. If the map has entries, **all** the cache ops are + * ignored and the provided map is used. Note that only ops 1-5 will actually be used, any + * other values get ignored by the client. As such, if a map is provided that has no keys + * of value 1-5, all the ops will simply be hidden. + */ +public class LocAddChangeV2 private constructor( + private val _id: UShort, + private val coordInZone: CoordInZone, + private val locProperties: LocProperties, + public val opFlags: OpFlags, + public val ops: Map?, +) : IncomingZoneProt { + public constructor( + id: Int, + xInZone: Int, + zInZone: Int, + shape: Int, + rotation: Int, + opFlags: OpFlags, + ops: Map?, + ) : this( + id.toUShort(), + CoordInZone(xInZone, zInZone), + LocProperties(shape, rotation), + opFlags, + ops, + ) + + public constructor( + id: Int, + coordInZone: CoordInZone, + locProperties: LocProperties, + opFlags: OpFlags, + ) : this( + id.toUShort(), + coordInZone, + locProperties, + opFlags, + null, + ) + + public val id: Int + get() = _id.toInt() + public val xInZone: Int + get() = coordInZone.xInZone + public val zInZone: Int + get() = coordInZone.zInZone + public val shape: Int + get() = locProperties.shape + public val rotation: Int + get() = locProperties.rotation + + public val coordInZonePacked: Int + get() = coordInZone.packed.toInt() + public val locPropertiesPacked: Int + get() = locProperties.packed.toInt() + + override val protId: Int = OldSchoolZoneProt.LOC_ADD_CHANGE_V2 + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (javaClass != other?.javaClass) return false + + other as LocAddChangeV2 + + if (_id != other._id) return false + if (coordInZone != other.coordInZone) return false + if (locProperties != other.locProperties) return false + if (opFlags != other.opFlags) return false + if (ops != other.ops) return false + if (protId != other.protId) return false + + return true + } + + override fun hashCode(): Int { + var result = _id.hashCode() + result = 31 * result + coordInZone.hashCode() + result = 31 * result + locProperties.hashCode() + result = 31 * result + opFlags.hashCode() + result = 31 * result + (ops?.hashCode() ?: 0) + result = 31 * result + protId + return result + } + + override fun toString(): String { + return "LocAddChangeV2(" + + "id=$id, " + + "xInZone=$xInZone, " + + "zInZone=$zInZone, " + + "shape=$shape, " + + "rotation=$rotation" + + "opFlags=$opFlags, " + + "ops=$ops, " + + ")" + } +} diff --git a/transcriber/src/main/kotlin/net/rsprox/transcriber/indexer/IndexerTranscriber.kt b/transcriber/src/main/kotlin/net/rsprox/transcriber/indexer/IndexerTranscriber.kt index f224cda1..40e76cab 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/indexer/IndexerTranscriber.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/indexer/IndexerTranscriber.kt @@ -210,7 +210,7 @@ import net.rsprox.protocol.game.outgoing.model.worldentity.SetActiveWorld import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZoneFullFollows import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZonePartialEnclosed import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZonePartialFollows -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChange +import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChangeV1 import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAnim import net.rsprox.protocol.game.outgoing.model.zone.payload.LocDel import net.rsprox.protocol.game.outgoing.model.zone.payload.LocMerge @@ -1075,7 +1075,7 @@ public class IndexerTranscriber( override fun updateZonePartialEnclosed(message: UpdateZonePartialEnclosed) { for (update in message.packets) { when (update) { - is LocAddChange -> { + is LocAddChangeV1 -> { binaryIndex.increment(IndexedType.LOC, update.id) } is LocAnim -> { @@ -1114,7 +1114,7 @@ public class IndexerTranscriber( override fun updateZonePartialFollows(message: UpdateZonePartialFollows) { } - override fun locAddChange(message: LocAddChange) { + override fun locAddChange(message: LocAddChangeV1) { binaryIndex.increment(IndexedType.LOC, message.id) } diff --git a/transcriber/src/main/kotlin/net/rsprox/transcriber/interfaces/ServerPacketTranscriber.kt b/transcriber/src/main/kotlin/net/rsprox/transcriber/interfaces/ServerPacketTranscriber.kt index 8f8916d6..7667f96e 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/interfaces/ServerPacketTranscriber.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/interfaces/ServerPacketTranscriber.kt @@ -112,7 +112,7 @@ import net.rsprox.protocol.game.outgoing.model.worldentity.SetActiveWorld import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZoneFullFollows import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZonePartialEnclosed import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZonePartialFollows -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChange +import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChangeV1 import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAnim import net.rsprox.protocol.game.outgoing.model.zone.payload.LocDel import net.rsprox.protocol.game.outgoing.model.zone.payload.LocMerge @@ -381,7 +381,7 @@ public interface ServerPacketTranscriber { public fun updateZonePartialFollows(message: UpdateZonePartialFollows) - public fun locAddChange(message: LocAddChange) + public fun locAddChange(message: LocAddChangeV1) public fun locAnim(message: LocAnim) diff --git a/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextServerPacketTranscriber.kt b/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextServerPacketTranscriber.kt index 762342fb..589d5ef6 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextServerPacketTranscriber.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextServerPacketTranscriber.kt @@ -139,7 +139,7 @@ import net.rsprox.protocol.game.outgoing.model.worldentity.SetActiveWorld import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZoneFullFollows import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZonePartialEnclosed import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZonePartialFollows -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChange +import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChangeV1 import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAnim import net.rsprox.protocol.game.outgoing.model.zone.payload.LocDel import net.rsprox.protocol.game.outgoing.model.zone.payload.LocMerge @@ -2445,7 +2445,7 @@ public class TextServerPacketTranscriber( private fun createFakeZoneProts(packets: List) { for (event in packets) { when (event) { - is LocAddChange -> { + is LocAddChangeV1 -> { if (!filters[PropertyFilter.LOC_ADD_CHANGE]) continue val root = sessionState.createFakeServerRoot("LOC_ADD_CHANGE") root.buildLocAddChange(event) @@ -2521,7 +2521,7 @@ public class TextServerPacketTranscriber( root.apply { for (event in packets) { when (event) { - is LocAddChange -> { + is LocAddChangeV1 -> { if (!filters[PropertyFilter.LOC_ADD_CHANGE]) continue group("LOC_ADD_CHANGE") { buildLocAddChange(event) @@ -2609,7 +2609,7 @@ public class TextServerPacketTranscriber( root.coordGrid(buildAreaCoordGrid(message.zoneX, message.zoneZ, message.level)) } - override fun locAddChange(message: LocAddChange) { + override fun locAddChange(message: LocAddChangeV1) { if (!filters[PropertyFilter.LOC_ADD_CHANGE]) return omit() root.buildLocAddChange(message) } @@ -2671,7 +2671,7 @@ public class TextServerPacketTranscriber( return sessionState.getActiveWorld().relativizeZoneCoord(xInZone, zInZone) } - private fun Property.buildLocAddChange(message: LocAddChange) { + private fun Property.buildLocAddChange(message: LocAddChangeV1) { scriptVarType("id", ScriptVarType.LOC, message.id) coordGrid(coordInZone(message.xInZone, message.zInZone)) scriptVarType("shape", ScriptVarType.LOC_SHAPE, message.shape) From 3a483e7668336630ce96efe9a38d00b423086f10 Mon Sep 17 00:00:00 2001 From: Kris Date: Thu, 16 Jan 2025 02:46:00 +0200 Subject: [PATCH 5/8] feat: server prots --- .../codec/interfaces/IfClearInvDecoder.kt | 3 +- .../codec/interfaces/IfMoveSubDecoder.kt | 5 +- .../codec/interfaces/IfOpenSubDecoder.kt | 7 +- .../codec/interfaces/IfSetAngleDecoder.kt | 7 +- .../codec/interfaces/IfSetAnimDecoder.kt | 2 +- .../codec/interfaces/IfSetColourDecoder.kt | 5 +- .../codec/interfaces/IfSetEventsDecoder.kt | 7 +- .../codec/interfaces/IfSetHideDecoder.kt | 5 +- .../codec/interfaces/IfSetModelDecoder.kt | 5 +- .../interfaces/IfSetNpcHeadActiveDecoder.kt | 3 +- .../codec/interfaces/IfSetNpcHeadDecoder.kt | 2 +- .../codec/interfaces/IfSetObjectDecoder.kt | 4 +- .../interfaces/IfSetPlayerHeadDecoder.kt | 3 +- .../IfSetPlayerModelBaseColourDecoder.kt | 7 +- .../IfSetPlayerModelBodyTypeDecoder.kt | 2 +- .../interfaces/IfSetPlayerModelObjDecoder.kt | 2 +- .../interfaces/IfSetPlayerModelSelfDecoder.kt | 2 +- .../codec/interfaces/IfSetPositionDecoder.kt | 5 +- .../interfaces/IfSetRotateSpeedDecoder.kt | 4 +- .../codec/interfaces/IfSetScrollPosDecoder.kt | 5 +- .../codec/interfaces/IfSetTextDecoder.kt | 2 +- .../decoder/codec/inv/UpdateInvFullDecoder.kt | 6 +- .../codec/inv/UpdateInvStopTransmitDecoder.kt | 2 +- .../decoder/codec/map/RebuildRegionDecoder.kt | 6 +- .../decoder/codec/map/StaticRebuildDecoder.kt | 6 +- .../misc/client/UpdateRebootTimerDecoder.kt | 2 +- .../misc/player/ChatFilterSettingsDecoder.kt | 4 +- .../codec/misc/player/SetPlayerOpDecoder.kt | 4 +- .../codec/misc/player/UpdateStatV2Decoder.kt | 4 +- .../decoder/codec/sound/MidiJingleDecoder.kt | 4 +- .../decoder/codec/sound/MidiSongV2Decoder.kt | 8 +- .../sound/MidiSongWithSecondaryDecoder.kt | 8 +- .../decoder/codec/sound/MidiSwapDecoder.kt | 8 +- .../codec/specific/LocAnimSpecificDecoder.kt | 6 +- .../codec/specific/MapAnimSpecificDecoder.kt | 6 +- .../codec/specific/NpcAnimSpecificDecoder.kt | 4 +- .../specific/NpcHeadIconSpecificDecoder.kt | 6 +- .../specific/NpcSpotAnimSpecificDecoder.kt | 6 +- .../specific/PlayerAnimSpecificDecoder.kt | 4 +- .../specific/PlayerSpotAnimSpecificDecoder.kt | 6 +- .../specific/ProjAnimSpecificV3Decoder.kt | 22 +- .../decoder/codec/varp/VarpLargeDecoder.kt | 2 +- .../decoder/codec/varp/VarpSmallDecoder.kt | 4 +- .../header/UpdateZoneFullFollowsDecoder.kt | 4 +- .../UpdateZonePartialEnclosedDecoder.kt | 24 +-- .../header/UpdateZonePartialFollowsDecoder.kt | 6 +- .../zone/payload/LocAddChangeV1Decoder.kt | 8 +- .../zone/payload/LocAddChangeV2Decoder.kt | 20 +- .../codec/zone/payload/LocAnimDecoder.kt | 6 +- .../codec/zone/payload/LocDelDecoder.kt | 4 +- .../codec/zone/payload/LocMergeDecoder.kt | 16 +- .../codec/zone/payload/MapAnimDecoder.kt | 8 +- .../codec/zone/payload/MapProjAnimDecoder.kt | 20 +- .../codec/zone/payload/ObjAddDecoder.kt | 12 +- .../codec/zone/payload/ObjCountDecoder.kt | 8 +- .../codec/zone/payload/ObjCustomiseDecoder.kt | 12 +- .../codec/zone/payload/ObjDelDecoder.kt | 4 +- .../zone/payload/ObjEnabledOpsDecoder.kt | 2 +- .../zone/payload/ObjUncustomiseDecoder.kt | 4 +- .../codec/zone/payload/SoundAreaDecoder.kt | 8 +- .../model/info/npcinfo/NpcInfoClient.kt | 194 +++++++++--------- .../model/info/playerinfo/PlayerInfoClient.kt | 124 +++++------ .../model/zone/payload/LocAddChangeV2.kt | 3 +- 63 files changed, 365 insertions(+), 337 deletions(-) diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfClearInvDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfClearInvDecoder.kt index 0948d631..23f451bc 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfClearInvDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfClearInvDecoder.kt @@ -2,6 +2,7 @@ package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedId import net.rsprot.protocol.util.gCombinedIdAlt3 import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.interfaces.IfClearInv @@ -15,7 +16,7 @@ internal class IfClearInvDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfClearInv { - val combinedId = buffer.gCombinedIdAlt3() + val combinedId = buffer.gCombinedId() return IfClearInv( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfMoveSubDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfMoveSubDecoder.kt index eb5b1b66..9d24d8e9 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfMoveSubDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfMoveSubDecoder.kt @@ -4,6 +4,7 @@ import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt import net.rsprot.protocol.util.gCombinedId import net.rsprot.protocol.util.gCombinedIdAlt1 +import net.rsprot.protocol.util.gCombinedIdAlt3 import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.interfaces.IfMoveSub import net.rsprox.protocol.session.Session @@ -16,8 +17,8 @@ internal class IfMoveSubDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfMoveSub { - val sourceCombinedId = buffer.gCombinedIdAlt1() - val destinationCombinedId = buffer.gCombinedId() + val sourceCombinedId = buffer.gCombinedIdAlt3() + val destinationCombinedId = buffer.gCombinedIdAlt3() return IfMoveSub( sourceCombinedId.interfaceId, sourceCombinedId.componentId, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfOpenSubDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfOpenSubDecoder.kt index 1153e3a8..2bc2af97 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfOpenSubDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfOpenSubDecoder.kt @@ -2,6 +2,7 @@ package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt1 import net.rsprot.protocol.util.gCombinedIdAlt2 import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.interfaces.IfOpenSub @@ -15,9 +16,9 @@ internal class IfOpenSubDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfOpenSub { - val interfaceId = buffer.g2Alt2() - val combinedId = buffer.gCombinedIdAlt2() - val type = buffer.g1Alt1() + val combinedId = buffer.gCombinedIdAlt1() + val type = buffer.g1Alt3() + val interfaceId = buffer.g2Alt1() return IfOpenSub( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetAngleDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetAngleDecoder.kt index d9492b77..d4c65bfc 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetAngleDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetAngleDecoder.kt @@ -3,6 +3,7 @@ package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt import net.rsprot.protocol.util.gCombinedId +import net.rsprot.protocol.util.gCombinedIdAlt3 import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetAngle import net.rsprox.protocol.session.Session @@ -15,10 +16,10 @@ internal class IfSetAngleDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetAngle { - val angleY = buffer.g2Alt2() + val combinedId = buffer.gCombinedIdAlt3() + val angleY = buffer.g2Alt3() + val zoom = buffer.g2Alt2() val angleX = buffer.g2Alt3() - val zoom = buffer.g2Alt3() - val combinedId = buffer.gCombinedId() return IfSetAngle( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetAnimDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetAnimDecoder.kt index 4975f334..24d67949 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetAnimDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetAnimDecoder.kt @@ -15,7 +15,7 @@ internal class IfSetAnimDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetAnim { - val anim = buffer.g2Alt3() + val anim = buffer.g2Alt2() val combinedId = buffer.gCombinedIdAlt1() return IfSetAnim( combinedId.interfaceId, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetColourDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetColourDecoder.kt index cb928ee7..f030542e 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetColourDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetColourDecoder.kt @@ -3,6 +3,7 @@ package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt import net.rsprot.protocol.util.gCombinedId +import net.rsprot.protocol.util.gCombinedIdAlt2 import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetColour import net.rsprox.protocol.session.Session @@ -15,8 +16,8 @@ internal class IfSetColourDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetColour { - val combinedId = buffer.gCombinedId() - val colour15BitPacked = buffer.g2Alt1() + val colour15BitPacked = buffer.g2Alt2() + val combinedId = buffer.gCombinedIdAlt2() return IfSetColour( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetEventsDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetEventsDecoder.kt index 39a8a93b..7d407792 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetEventsDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetEventsDecoder.kt @@ -3,6 +3,7 @@ package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt import net.rsprot.protocol.util.gCombinedIdAlt1 +import net.rsprot.protocol.util.gCombinedIdAlt3 import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetEvents import net.rsprox.protocol.session.Session @@ -15,10 +16,10 @@ internal class IfSetEventsDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetEvents { - val events = buffer.g4Alt1() - val combinedId = buffer.gCombinedIdAlt1() + val events = buffer.g4Alt3() + val combinedId = buffer.gCombinedIdAlt3() val end = buffer.g2Alt3() - val start = buffer.g2Alt2() + val start = buffer.g2() return IfSetEvents( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetHideDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetHideDecoder.kt index 3cad16a7..1500be86 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetHideDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetHideDecoder.kt @@ -3,6 +3,7 @@ package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt import net.rsprot.protocol.util.gCombinedIdAlt1 +import net.rsprot.protocol.util.gCombinedIdAlt3 import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetHide import net.rsprox.protocol.session.Session @@ -15,8 +16,8 @@ internal class IfSetHideDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetHide { - val hidden = buffer.g1Alt3() == 1 - val combinedId = buffer.gCombinedIdAlt1() + val hidden = buffer.g1Alt2() == 1 + val combinedId = buffer.gCombinedIdAlt3() return IfSetHide( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetModelDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetModelDecoder.kt index c3b3d8e5..d9fa8ea7 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetModelDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetModelDecoder.kt @@ -2,6 +2,7 @@ package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedId import net.rsprot.protocol.util.gCombinedIdAlt1 import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetModel @@ -15,8 +16,8 @@ internal class IfSetModelDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetModel { - val combinedId = buffer.gCombinedIdAlt1() - val model = buffer.g2Alt1() + val combinedId = buffer.gCombinedId() + val model = buffer.g2Alt3() return IfSetModel( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadActiveDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadActiveDecoder.kt index 3281ea45..9522ea86 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadActiveDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadActiveDecoder.kt @@ -2,6 +2,7 @@ package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt1 import net.rsprot.protocol.util.gCombinedIdAlt2 import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetNpcHeadActive @@ -16,7 +17,7 @@ internal class IfSetNpcHeadActiveDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetNpcHead { - val npc = buffer.g2() + val npc = buffer.g2Alt3() val combinedId = buffer.gCombinedIdAlt3() return IfSetNpcHead( combinedId.interfaceId, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetObjectDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetObjectDecoder.kt index 1126919a..3f2f99f2 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetObjectDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetObjectDecoder.kt @@ -15,9 +15,9 @@ internal class IfSetObjectDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetObject { - val combinedId = buffer.gCombinedIdAlt3() - val count = buffer.g4Alt3() + val count = buffer.g4Alt1() val obj = buffer.g2Alt2() + val combinedId = buffer.gCombinedIdAlt3() return IfSetObject( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerHeadDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerHeadDecoder.kt index 228ceac2..2384f32d 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerHeadDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerHeadDecoder.kt @@ -3,6 +3,7 @@ package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt import net.rsprot.protocol.util.gCombinedId +import net.rsprot.protocol.util.gCombinedIdAlt2 import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetPlayerHead import net.rsprox.protocol.session.Session @@ -15,7 +16,7 @@ internal class IfSetPlayerHeadDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetPlayerHead { - val combinedId = buffer.gCombinedId() + val combinedId = buffer.gCombinedIdAlt2() return IfSetPlayerHead( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBaseColourDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBaseColourDecoder.kt index 0ee85242..12359343 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBaseColourDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBaseColourDecoder.kt @@ -2,6 +2,7 @@ package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt1 import net.rsprot.protocol.util.gCombinedIdAlt3 import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetPlayerModelBaseColour @@ -15,9 +16,9 @@ internal class IfSetPlayerModelBaseColourDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetPosition { - val x = buffer.g2Alt1() + val combinedId = buffer.gCombinedIdAlt2() val y = buffer.g2Alt1() - val combinedId = buffer.gCombinedIdAlt3() + val x = buffer.g2Alt1() return IfSetPosition( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt index c06e105c..1ec6d074 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt @@ -16,8 +16,8 @@ internal class IfSetRotateSpeedDecoder : ProxyMessageDecoder { session: Session, ): IfSetRotateSpeed { val combinedId = buffer.gCombinedId() - val ySpeed = buffer.g2() - val xSpeed = buffer.g2Alt1() + val xSpeed = buffer.g2Alt2() + val ySpeed = buffer.g2Alt2() return IfSetRotateSpeed( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetScrollPosDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetScrollPosDecoder.kt index c3e875eb..a29296ae 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetScrollPosDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetScrollPosDecoder.kt @@ -2,6 +2,7 @@ package net.rsprox.protocol.v228.game.outgoing.decoder.codec.interfaces import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedId import net.rsprot.protocol.util.gCombinedIdAlt1 import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetScrollPos @@ -15,8 +16,8 @@ internal class IfSetScrollPosDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetScrollPos { - val scrollPos = buffer.g2() - val combinedId = buffer.gCombinedIdAlt1() + val combinedId = buffer.gCombinedId() + val scrollPos = buffer.g2Alt3() return IfSetScrollPos( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetTextDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetTextDecoder.kt index b43bb768..fa1b5007 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetTextDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/interfaces/IfSetTextDecoder.kt @@ -15,8 +15,8 @@ internal class IfSetTextDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetText { - val text = buffer.gjstr() val combinedId = buffer.gCombinedIdAlt3() + val text = buffer.gjstr() return IfSetText( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvFullDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvFullDecoder.kt index e916f05b..5451a44e 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvFullDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvFullDecoder.kt @@ -21,10 +21,10 @@ internal class UpdateInvFullDecoder : ProxyMessageDecoder { val objs = buildList { for (i in 0..= 0xFF) { - count = buffer.g4() + count = buffer.g4Alt3() } add(UpdateInvFull.Obj(id - 1, count)) } diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvStopTransmitDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvStopTransmitDecoder.kt index 96942e09..2c5d6383 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvStopTransmitDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/inv/UpdateInvStopTransmitDecoder.kt @@ -14,7 +14,7 @@ internal class UpdateInvStopTransmitDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): RebuildRegion { - val zoneX = buffer.g2Alt2() - val reload = buffer.g1Alt3() == 1 - val zoneZ = buffer.g2Alt2() + val zoneX = buffer.g2Alt1() + val zoneZ = buffer.g2() + val reload = buffer.g1Alt1() == 1 val xteaCount = buffer.g2() val buildArea = BuildArea() buffer.buffer.toBitBuf().use { bitBuf -> diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/map/StaticRebuildDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/map/StaticRebuildDecoder.kt index 28c79280..5418a301 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/map/StaticRebuildDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/map/StaticRebuildDecoder.kt @@ -49,9 +49,9 @@ internal class StaticRebuildDecoder( } else { null } - val worldArea = buffer.g2Alt1() - val zoneX = buffer.g2Alt1() - val zoneZ = buffer.g2Alt2() + val zoneZ = buffer.g2Alt1() + val zoneX = buffer.g2() + val worldArea = buffer.g2Alt3() val xteaCount = buffer.g2() val keys = buildList { diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/UpdateRebootTimerDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/UpdateRebootTimerDecoder.kt index f577fbae..53c48a35 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/UpdateRebootTimerDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/client/UpdateRebootTimerDecoder.kt @@ -14,7 +14,7 @@ internal class UpdateRebootTimerDecoder : ProxyMessageDecoder buffer: JagByteBuf, session: Session, ): UpdateRebootTimer { - val gameCycles = buffer.g2() + val gameCycles = buffer.g2Alt1() return UpdateRebootTimer( gameCycles, ) diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsDecoder.kt index 461d911a..59df0ca7 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsDecoder.kt @@ -14,8 +14,8 @@ internal class ChatFilterSettingsDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): SetPlayerOp { - val priority = buffer.g1Alt2() == 1 - val id = buffer.g1Alt2() + val priority = buffer.g1() == 1 val op = buffer.gjstr() + val id = buffer.g1Alt1() return SetPlayerOp( id, priority, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateStatV2Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateStatV2Decoder.kt index 3999e321..c1509831 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateStatV2Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateStatV2Decoder.kt @@ -14,10 +14,10 @@ internal class UpdateStatV2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): UpdateStatV2 { + val invisibleBoostedLevel = buffer.g1Alt2() + val stat = buffer.g1Alt2() val experience = buffer.g4() - val invisibleBoostedLevel = buffer.g1() val currentLevel = buffer.g1() - val stat = buffer.g1() return UpdateStatV2( stat, currentLevel, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiJingleDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiJingleDecoder.kt index 9c74deab..11996cf6 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiJingleDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiJingleDecoder.kt @@ -14,8 +14,8 @@ internal class MidiJingleDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): MidiJingle { - val lengthInMillis = buffer.g3Alt2() - val id = buffer.g2Alt1() + val lengthInMillis = buffer.g3Alt1() + val id = buffer.g2() return MidiJingle( id, lengthInMillis, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongV2Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongV2Decoder.kt index 452ce760..ba41fba9 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongV2Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongV2Decoder.kt @@ -14,11 +14,11 @@ internal class MidiSongV2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): MidiSongV2 { - val fadeOutSpeed = buffer.g2Alt1() - val fadeOutDelay = buffer.g2Alt2() + val fadeOutSpeed = buffer.g2() + val fadeOutDelay = buffer.g2() + val fadeInSpeed = buffer.g2() + val fadeInDelay = buffer.g2Alt3() val id = buffer.g2Alt1() - val fadeInSpeed = buffer.g2Alt1() - val fadeInDelay = buffer.g2Alt1() return MidiSongV2( id, fadeOutDelay, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongWithSecondaryDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongWithSecondaryDecoder.kt index 4f1e5dde..86c776a0 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongWithSecondaryDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/sound/MidiSongWithSecondaryDecoder.kt @@ -14,12 +14,12 @@ internal class MidiSongWithSecondaryDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): MidiSwap { - val fadeInSpeed = buffer.g2Alt3() - val fadeOutDelay = buffer.g2Alt3() - val fadeInDelay = buffer.g2Alt2() - val fadeOutSpeed = buffer.g2Alt1() + val fadeOutSpeed = buffer.g2Alt2() + val fadeInSpeed = buffer.g2Alt2() + val fadeInDelay = buffer.g2() + val fadeOutDelay = buffer.g2() return MidiSwap( fadeOutDelay, fadeOutSpeed, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/LocAnimSpecificDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/LocAnimSpecificDecoder.kt index ee3b9406..b07a00cc 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/LocAnimSpecificDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/LocAnimSpecificDecoder.kt @@ -16,9 +16,9 @@ internal class LocAnimSpecificDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): LocAnimSpecific { - val locProperties = LocProperties(buffer.g1Alt2()) - val id = buffer.g2Alt2() - val coordInBuildArea = CoordInBuildArea(buffer.g3Alt2()) + val locProperties = LocProperties(buffer.g1()) + val id = buffer.g2() + val coordInBuildArea = CoordInBuildArea(buffer.g3Alt1()) return LocAnimSpecific( id, coordInBuildArea, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/MapAnimSpecificDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/MapAnimSpecificDecoder.kt index 14096e72..2c7e0d41 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/MapAnimSpecificDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/MapAnimSpecificDecoder.kt @@ -15,10 +15,10 @@ internal class MapAnimSpecificDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): MapAnimSpecific { - val height = buffer.g1Alt1() - val id = buffer.g2Alt2() - val delay = buffer.g2Alt1() val coordInBuildArea = CoordInBuildArea(buffer.g3Alt2()) + val delay = buffer.g2() + val height = buffer.g1Alt3() + val id = buffer.g2() return MapAnimSpecific( id, delay, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcAnimSpecificDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcAnimSpecificDecoder.kt index df8417f9..78ef9e6f 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcAnimSpecificDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcAnimSpecificDecoder.kt @@ -14,9 +14,9 @@ internal class NpcAnimSpecificDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): NpcAnimSpecific { - val id = buffer.g2Alt3() - val delay = buffer.g1Alt3() + val id = buffer.g2Alt2() val index = buffer.g2Alt3() + val delay = buffer.g1Alt1() return NpcAnimSpecific( index, id, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcHeadIconSpecificDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcHeadIconSpecificDecoder.kt index 6e64bcf1..89e0b4f6 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcHeadIconSpecificDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/specific/NpcHeadIconSpecificDecoder.kt @@ -14,10 +14,10 @@ internal class NpcHeadIconSpecificDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): VarpLarge { - val id = buffer.g2Alt2() + val id = buffer.g2() val value = buffer.g4() return VarpLarge( id, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpSmallDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpSmallDecoder.kt index 9ef46398..7e9893a0 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpSmallDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/varp/VarpSmallDecoder.kt @@ -14,8 +14,8 @@ internal class VarpSmallDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): VarpSmall { - val id = buffer.g2() - val value = buffer.g1() + val value = buffer.g1Alt1() + val id = buffer.g2Alt3() return VarpSmall( id, value, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZoneFullFollowsDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZoneFullFollowsDecoder.kt index 2561cf97..f4c5d55a 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZoneFullFollowsDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZoneFullFollowsDecoder.kt @@ -14,9 +14,9 @@ internal class UpdateZoneFullFollowsDecoder : ProxyMessageDecoder, ) { - MAP_PROJANIM(MapProjAnimDecoder()), + OBJ_DEL(ObjDelDecoder()), + OBJ_ENABLED_OPS(ObjEnabledOpsDecoder()), + OBJ_ADD(ObjAddDecoder()), + LOC_DEL(LocDelDecoder()), LOC_ADD_CHANGE_V1(LocAddChangeV1Decoder()), OBJ_UNCUSTOMISE(ObjUncustomiseDecoder()), - OBJ_COUNT(ObjCountDecoder()), - OBJ_ENABLED_OPS(ObjEnabledOpsDecoder()), + LOC_ADD_CHANGE_V2(LocAddChangeV2Decoder()), LOC_MERGE(LocMergeDecoder()), - OBJ_DEL(ObjDelDecoder()), - MAP_ANIM(MapAnimDecoder()), SOUND_AREA(SoundAreaDecoder()), - OBJ_ADD(ObjAddDecoder()), - OBJ_CUSTOMISE(ObjCustomiseDecoder()), - LOC_DEL(LocDelDecoder()), + MAP_PROJANIM(MapProjAnimDecoder()), + OBJ_COUNT(ObjCountDecoder()), LOC_ANIM(LocAnimDecoder()), - LOC_ADD_CHANGE_V2(LocAddChangeV2Decoder()), + OBJ_CUSTOMISE(ObjCustomiseDecoder()), + MAP_ANIM(MapAnimDecoder()), } } diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZonePartialFollowsDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZonePartialFollowsDecoder.kt index cfae0b40..5ea4b8ed 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZonePartialFollowsDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/header/UpdateZonePartialFollowsDecoder.kt @@ -14,9 +14,9 @@ internal class UpdateZonePartialFollowsDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): LocAddChangeV1 { - val opFlags = OpFlags(buffer.g1Alt1()) - val id = buffer.g2() - val locProperties = LocProperties(buffer.g1Alt3()) - val coordInZone = CoordInZone(buffer.g1()) + val coordInZone = CoordInZone(buffer.g1Alt1()) + val opFlags = OpFlags(buffer.g1Alt2()) + val id = buffer.g2Alt2() + val locProperties = LocProperties(buffer.g1Alt2()) return LocAddChangeV1( id, coordInZone, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocAddChangeV2Decoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocAddChangeV2Decoder.kt index 6a2779d9..0150a825 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocAddChangeV2Decoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocAddChangeV2Decoder.kt @@ -18,16 +18,28 @@ internal class LocAddChangeV2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): LocAddChangeV2 { - val opFlags = OpFlags(buffer.g1Alt1()) - val id = buffer.g2() - val locProperties = LocProperties(buffer.g1Alt3()) val coordInZone = CoordInZone(buffer.g1()) - // TODO + val locProperties = LocProperties(buffer.g1Alt2()) + val opOverrideCount = buffer.g1Alt2() + val opOverrides: Map? = if (opOverrideCount > 0) { + buildMap { + for (i in 0.. { buffer: JagByteBuf, session: Session, ): LocAnim { - val id = buffer.g2Alt1() - val coordInZone = CoordInZone(buffer.g1()) - val locProperties = LocProperties(buffer.g1Alt3()) + val locProperties = LocProperties(buffer.g1Alt1()) + val coordInZone = CoordInZone(buffer.g1Alt1()) + val id = buffer.g2Alt2() return LocAnim( id, coordInZone, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocDelDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocDelDecoder.kt index 46048ca6..afa9beb4 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocDelDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocDelDecoder.kt @@ -16,8 +16,8 @@ internal class LocDelDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): LocDel { - val locProperties = LocProperties(buffer.g1Alt3()) - val coordInZone = CoordInZone(buffer.g1()) + val coordInZone = CoordInZone(buffer.g1Alt3()) + val locProperties = LocProperties(buffer.g1Alt1()) return LocDel( coordInZone, locProperties, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt index 43c1c9e4..b2790955 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt @@ -16,16 +16,16 @@ internal class LocMergeDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): LocMerge { + val maxZ = buffer.g1Alt1() + val index = buffer.g2Alt1() + val maxX = buffer.g1Alt1() + val id = buffer.g2() + val minX = buffer.g1Alt2() + val coordInZone = CoordInZone(buffer.g1Alt3()) + val end = buffer.g2Alt1() val start = buffer.g2() - val maxZ = buffer.g1Alt3() val minZ = buffer.g1() - val id = buffer.g2Alt1() - val coordInZone = CoordInZone(buffer.g1()) - val maxX = buffer.g1() - val index = buffer.g2Alt2() - val end = buffer.g2Alt1() - val locProperties = LocProperties(buffer.g1Alt2()) - val minX = buffer.g1Alt2() + val locProperties = LocProperties(buffer.g1()) return LocMerge( index, id, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt index 883fd9d8..7ef8f18f 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt @@ -15,10 +15,10 @@ internal class MapAnimDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): MapAnim { - val id = buffer.g2() - val height = buffer.g1Alt1() - val delay = buffer.g2Alt2() - val coordInZone = CoordInZone(buffer.g1Alt2()) + val id = buffer.g2Alt1() + val height = buffer.g1Alt2() + val coordInZone = CoordInZone(buffer.g1Alt3()) + val delay = buffer.g2Alt1() return MapAnim( id, delay, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/MapProjAnimDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/MapProjAnimDecoder.kt index 131016df..1a986d9d 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/MapProjAnimDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/MapProjAnimDecoder.kt @@ -15,18 +15,18 @@ internal class MapProjAnimDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): MapProjAnim { - val sourceIndex = buffer.g3sAlt3() - val endTime = buffer.g2Alt2() - val id = buffer.g2() - val startTime = buffer.g2Alt2() - val coordInZone = CoordInZone(buffer.g1Alt2()) - val progress = buffer.g2Alt2() + val endHeight = buffer.g1Alt2() + val angle = buffer.g1() + val progress = buffer.g2() val targetIndex = buffer.g3sAlt2() val startHeight = buffer.g1() - val deltaX = buffer.g1Alt3() - val endHeight = buffer.g1Alt3() - val deltaZ = buffer.g1Alt3() - val angle = buffer.g1Alt3() + val coordInZone = CoordInZone(buffer.g1()) + val deltaX = buffer.g1Alt2() + val id = buffer.g2Alt2() + val endTime = buffer.g2Alt1() + val startTime = buffer.g2Alt1() + val deltaZ = buffer.g1() + val sourceIndex = buffer.g3sAlt2() return MapProjAnim( id, startHeight, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt index 444b20b6..f423850e 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt @@ -16,14 +16,14 @@ internal class ObjAddDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): ObjAdd { - val ownershipType = buffer.g1Alt1() - val opFlags = OpFlags(buffer.g1()) - val timeUntilPublic = buffer.g2() - val timeUntilDespawn = buffer.g2Alt2() - val id = buffer.g2Alt1() + val opFlags = OpFlags(buffer.g1Alt1()) + val timeUntilPublic = buffer.g2Alt3() val quantity = buffer.g4Alt3() + val neverBecomesPublic = buffer.g1Alt1() == 1 + val timeUntilDespawn = buffer.g2() + val id = buffer.g2() + val ownershipType = buffer.g1Alt1() val coordInZone = CoordInZone(buffer.g1Alt3()) - val neverBecomesPublic = buffer.g1Alt3() == 1 return ObjAdd( id, quantity, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjCountDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjCountDecoder.kt index 9a34a18f..ac4558bd 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjCountDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjCountDecoder.kt @@ -15,10 +15,10 @@ internal class ObjCountDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): ObjCount { - val coordInZone = CoordInZone(buffer.g1Alt3()) - val id = buffer.g2Alt2() - val oldQuantity = buffer.g4() - val newQuantity = buffer.g4Alt2() + val newQuantity = buffer.g4() + val oldQuantity = buffer.g4Alt3() + val coordInZone = CoordInZone(buffer.g1Alt1()) + val id = buffer.g2Alt3() return ObjCount( id, oldQuantity, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjCustomiseDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjCustomiseDecoder.kt index b5d8b9db..9dafcc6d 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjCustomiseDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjCustomiseDecoder.kt @@ -15,14 +15,14 @@ internal class ObjCustomiseDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): ObjCustomise { - val retexIndex = buffer.g2() + val quantity = buffer.g4() val retex = buffer.g2Alt3() - val coordInZone = CoordInZone(buffer.g1Alt1()) + val recol = buffer.g2Alt1() + val coordInZone = CoordInZone(buffer.g1Alt3()) + val model = buffer.g2() val id = buffer.g2Alt1() - val recolIndex = buffer.g2Alt1() - val quantity = buffer.g4() - val model = buffer.g2Alt2() - val recol = buffer.g2() + val recolIndex = buffer.g2() + val retexIndex = buffer.g2Alt2() return ObjCustomise( id, quantity, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjDelDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjDelDecoder.kt index e7c3df12..3c14c74a 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjDelDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjDelDecoder.kt @@ -15,8 +15,8 @@ internal class ObjDelDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): ObjDel { - val id = buffer.g2Alt1() - val coordInZone = CoordInZone(buffer.g1Alt1()) + val id = buffer.g2() + val coordInZone = CoordInZone(buffer.g1Alt3()) val quantity = buffer.g4() return ObjDel( id, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjEnabledOpsDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjEnabledOpsDecoder.kt index 93cedd7c..a27e1eb8 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjEnabledOpsDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjEnabledOpsDecoder.kt @@ -16,9 +16,9 @@ internal class ObjEnabledOpsDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): ObjEnabledOps { + val id = buffer.g2Alt1() val opFlags = OpFlags(buffer.g1()) val coordInZone = CoordInZone(buffer.g1Alt1()) - val id = buffer.g2Alt1() return ObjEnabledOps( id, opFlags, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjUncustomiseDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjUncustomiseDecoder.kt index e3bbacfb..0027adba 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjUncustomiseDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/ObjUncustomiseDecoder.kt @@ -15,9 +15,9 @@ internal class ObjUncustomiseDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): ObjUncustomise { - val id = buffer.g2() + val id = buffer.g2Alt1() + val coordInZone = CoordInZone(buffer.g1Alt3()) val quantity = buffer.g4Alt1() - val coordInZone = CoordInZone(buffer.g1Alt1()) return ObjUncustomise( id, quantity, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/SoundAreaDecoder.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/SoundAreaDecoder.kt index 57551737..b78188cf 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/SoundAreaDecoder.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/zone/payload/SoundAreaDecoder.kt @@ -15,12 +15,12 @@ internal class SoundAreaDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): SoundArea { - val coordInZone = CoordInZone(buffer.g1Alt3()) - val radius = buffer.g1Alt2() - val id = buffer.g2Alt1() - val loops = buffer.g1() val size = buffer.g1() + val coordInZone = CoordInZone(buffer.g1Alt1()) + val id = buffer.g2() + val loops = buffer.g1Alt1() val delay = buffer.g1Alt1() + val radius = buffer.g1Alt2() return SoundArea( id, delay, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/npcinfo/NpcInfoClient.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/npcinfo/NpcInfoClient.kt index 18a56eba..636e8b04 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/npcinfo/NpcInfoClient.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/npcinfo/NpcInfoClient.kt @@ -139,57 +139,57 @@ internal class NpcInfoClient( this.extendedInfoBlocks[index] = blocks - if (flag and OLD_SPOTANIM_UNUSED != 0) { - throw IllegalStateException("Old spotanim used!") + if (flag and FACE_PATHINGENTITY != 0) { + decodeFacePathingEntity(buffer, blocks) } - if (flag and HEADICON_CUSTOMISATION != 0) { - decodeHeadiconCustomisation(buffer, blocks) + if (flag and SAY != 0) { + decodeSay(buffer, blocks) + } + if (flag and BAS_CHANGE != 0) { + decodeBaseAnimationSet(buffer, blocks) + } + if (flag and SPOTANIM != 0) { + decodeSpotanim(buffer, blocks) } if (flag and TRANSFORMATION != 0) { decodeTransformation(buffer, blocks, npc) } - if (flag and FACE_COORD != 0) { - decodeFaceCoord(buffer, blocks) + if (flag and NAME_CHANGE != 0) { + decodeNameChange(buffer, blocks) } - if (flag and FACE_PATHINGENTITY != 0) { - decodeFacePathingEntity(buffer, blocks) + if (flag and HITS != 0) { + decodeHits(buffer, blocks) } - if (flag and LEVEL_CHANGE != 0) { - decodeCombatLevelChange(buffer, blocks) + if (flag and TINTING != 0) { + decodeTinting(buffer, blocks) } - if (flag and NAME_CHANGE != 0) { - decodeNameChange(buffer, blocks) + if (flag and SEQUENCE != 0) { + decodeSequence(buffer, blocks) } if (flag and EXACT_MOVE != 0) { decodeExactMove(buffer, blocks) } + if (flag and LEVEL_CHANGE != 0) { + decodeCombatLevelChange(buffer, blocks) + } if (flag and HEAD_CUSTOMISATION != 0) { decodeHeadCustomisation(npc.id, buffer, blocks) } + if (flag and FACE_COORD != 0) { + decodeFaceCoord(buffer, blocks) + } if (flag and BODY_CUSTOMISATION != 0) { decodeBodyCustomisation(npc.id, buffer, blocks) } - if (flag and TINTING != 0) { - decodeTinting(buffer, blocks) - } - if (flag and SPOTANIM != 0) { - decodeSpotanim(buffer, blocks) + if (flag and OLD_SPOTANIM_UNUSED != 0) { + throw IllegalStateException("Old spotanim used!") } - if (flag and SAY != 0) { - decodeSay(buffer, blocks) + if (flag and HEADICON_CUSTOMISATION != 0) { + decodeHeadiconCustomisation(buffer, blocks) } if (flag and OPS != 0) { decodeEnabledOps(buffer, blocks) } - if (flag and SEQUENCE != 0) { - decodeSequence(buffer, blocks) - } - if (flag and BAS_CHANGE != 0) { - decodeBaseAnimationSet(buffer, blocks) - } - if (flag and HITS != 0) { - decodeHits(buffer, blocks) - } } } @@ -198,20 +198,20 @@ internal class NpcInfoClient( blocks: MutableList, ) { val flag = buffer.g4Alt1() - val turnLeftAnim = if (flag and 0x1 != 0) buffer.g2Alt2() else null - val turnRightAnim = if (flag and 0x2 != 0) buffer.g2() else null - val walkAnim = if (flag and 0x4 != 0) buffer.g2() else null + val turnLeftAnim = if (flag and 0x1 != 0) buffer.g2() else null + val turnRightAnim = if (flag and 0x2 != 0) buffer.g2Alt2() else null + val walkAnim = if (flag and 0x4 != 0) buffer.g2Alt3() else null val walkAnimBack = if (flag and 0x8 != 0) buffer.g2Alt3() else null - val walkAnimLeft = if (flag and 0x10 != 0) buffer.g2Alt2() else null - val walkAnimRight = if (flag and 0x20 != 0) buffer.g2Alt3() else null - val runAnim = if (flag and 0x40 != 0) buffer.g2Alt2() else null - val runAnimBack = if (flag and 0x80 != 0) buffer.g2Alt2() else null - val runAnimLeft = if (flag and 0x100 != 0) buffer.g2Alt3() else null - val runAnimRight = if (flag and 0x200 != 0) buffer.g2() else null - val crawlAnim = if (flag and 0x400 != 0) buffer.g2Alt2() else null - val crawlAnimBack = if (flag and 0x800 != 0) buffer.g2() else null - val crawlAnimLeft = if (flag and 0x1000 != 0) buffer.g2Alt3() else null - val crawlAnimRight = if (flag and 0x2000 != 0) buffer.g2Alt3() else null + val walkAnimLeft = if (flag and 0x10 != 0) buffer.g2Alt3() else null + val walkAnimRight = if (flag and 0x20 != 0) buffer.g2() else null + val runAnim = if (flag and 0x40 != 0) buffer.g2Alt1() else null + val runAnimBack = if (flag and 0x80 != 0) buffer.g2Alt3() else null + val runAnimLeft = if (flag and 0x100 != 0) buffer.g2() else null + val runAnimRight = if (flag and 0x200 != 0) buffer.g2Alt2() else null + val crawlAnim = if (flag and 0x400 != 0) buffer.g2() else null + val crawlAnimBack = if (flag and 0x800 != 0) buffer.g2Alt3() else null + val crawlAnimLeft = if (flag and 0x1000 != 0) buffer.g2Alt1() else null + val crawlAnimRight = if (flag and 0x2000 != 0) buffer.g2() else null val readyAnim = if (flag and 0x4000 != 0) buffer.g2Alt1() else null blocks += BaseAnimationSetExtendedInfo( @@ -237,7 +237,7 @@ internal class NpcInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - val hitCount = buffer.g1Alt1() + val hitCount = buffer.g1Alt3() val hits = ArrayList(hitCount) for (i in 0..(headbarCount) for (i in 0.. 0) { - buffer.g1() + buffer.g1Alt1() } else { startFill } @@ -323,10 +323,10 @@ internal class NpcInfoClient( blocks: MutableList, ) { val spotanims = mutableMapOf() - val count = buffer.g1Alt2() + val count = buffer.g1Alt3() for (i in 0.., ) { - val id = buffer.g2Alt3() - val delay = buffer.g1() + val id = buffer.g2() + val delay = buffer.g1Alt3() blocks += SequenceExtendedInfo(id, delay) } @@ -348,7 +348,7 @@ internal class NpcInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - val level = buffer.g4Alt1() + val level = buffer.g4() blocks += CombatLevelChangeExtendedInfo(level) } @@ -356,12 +356,12 @@ internal class NpcInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - val start = buffer.g2() - val end = buffer.g2Alt3() - val hue = buffer.g1Alt1() + val start = buffer.g2Alt3() + val end = buffer.g2Alt2() + val hue = buffer.g1Alt2() val saturation = buffer.g1Alt3() - val lightness = buffer.g1Alt3() - val weight = buffer.g1Alt2() + val lightness = buffer.g1Alt2() + val weight = buffer.g1() blocks += TintingExtendedInfo( start, @@ -378,7 +378,7 @@ internal class NpcInfoClient( blocks: MutableList, npc: Npc, ) { - val id = buffer.g2Alt1() + val id = buffer.g2() blocks += TransformationExtendedInfo(id) npc.id = id } @@ -396,7 +396,7 @@ internal class NpcInfoClient( blocks: MutableList, ) { var index = buffer.g2Alt3() - index += buffer.g1Alt2() shl 16 + index += buffer.g1Alt1() shl 16 blocks += FacePathingEntityExtendedInfo(index) } @@ -405,7 +405,7 @@ internal class NpcInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - val flag = buffer.g1Alt3() + val flag = buffer.g1() if (flag and 0x1 != 0) { blocks += BodyCustomisationExtendedInfo(ResetCustomisation) return @@ -415,7 +415,7 @@ internal class NpcInfoClient( val count = buffer.g1() val models = ArrayList(count) for (i in 0..(length) for (i in 0..(length) for (i in 0.., ) { - val flag = buffer.g1Alt1() + val flag = buffer.g1() if (flag and 0x1 != 0) { blocks += BodyCustomisationExtendedInfo(ResetCustomisation) return @@ -484,7 +484,7 @@ internal class NpcInfoClient( val count = buffer.g1() val models = ArrayList(count) for (i in 0..(length) for (i in 0..(length) for (i in 0.., ) { - val deltaX1 = buffer.g1sAlt3() + val deltaX1 = buffer.g1sAlt1() val deltaZ1 = buffer.g1s() val deltaX2 = buffer.g1sAlt1() - val deltaZ2 = buffer.g1sAlt3() + val deltaZ2 = buffer.g1sAlt1() val delay1 = buffer.g2Alt2() - val delay2 = buffer.g2() + val delay2 = buffer.g2Alt3() val direction = buffer.g2Alt3() blocks += ExactMoveExtendedInfo( @@ -581,7 +581,7 @@ internal class NpcInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - val flag = buffer.g1Alt2() + val flag = buffer.g1() val groups = IntArray(8) val indices = IntArray(8) for (i in 0..<8) { @@ -600,8 +600,8 @@ internal class NpcInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - val x = buffer.g2Alt1() - val z = buffer.g2Alt2() + val x = buffer.g2() + val z = buffer.g2() val instant = buffer.g1Alt2() == 1 blocks += FaceCoordExtendedInfo(x, z, instant) } @@ -713,18 +713,16 @@ internal class NpcInfoClient( transmittedNPC[transmittedNPCCount++] = index npc.lastTransmitCycle = cycle - val deltaX = decodeDelta(large, buffer) - val jump = buffer.gBits(1) + + val deltaZ = decodeDelta(large, buffer) - npc.id = buffer.gBits(14) + val deltaX = decodeDelta(large, buffer) val hasSpawnCycle = buffer.gBits(1) == 1 if (hasSpawnCycle) { npc.spawnCycle = buffer.gBits(32) } - val extendedInfo = buffer.gBits(1) - if (extendedInfo == 1) { - this.extraUpdateNPC[extraUpdateNPCCount++] = index - } + npc.id = buffer.gBits(14) + val jump = buffer.gBits(1) val angle = NPC_TURN_ANGLES[buffer.gBits(3)] if (isNew) { npc.turnAngle = angle @@ -734,6 +732,10 @@ internal class NpcInfoClient( if (npc.turnSpeed == 0) { npc.angle = 0 } + val extendedInfo = buffer.gBits(1) + if (extendedInfo == 1) { + this.extraUpdateNPC[extraUpdateNPCCount++] = index + } npc.addRouteWaypoint( baseCoord, deltaX, @@ -839,25 +841,25 @@ internal class NpcInfoClient( private companion object { private val NPC_TURN_ANGLES = intArrayOf(768, 1024, 1280, 512, 1536, 256, 0, 1792) - private const val SEQUENCE: Int = 0x1 - private const val EXTENDED_SHORT: Int = 0x2 - private const val HITS: Int = 0x4 - private const val OLD_SPOTANIM_UNUSED: Int = 0x8 - private const val FACE_COORD: Int = 0x10 + private const val EXTENDED_SHORT: Int = 0x10 + private const val EXTENDED_MEDIUM: Int = 0x800 private const val FACE_PATHINGENTITY: Int = 0x20 - private const val SAY: Int = 0x40 - private const val TRANSFORMATION: Int = 0x80 - private const val EXTENDED_MEDIUM: Int = 0x100 - private const val BODY_CUSTOMISATION: Int = 0x200 - private const val TINTING: Int = 0x400 - private const val LEVEL_CHANGE: Int = 0x800 - private const val HEAD_CUSTOMISATION: Int = 0x1000 - private const val NAME_CHANGE: Int = 0x2000 - private const val EXACT_MOVE: Int = 0x4000 - private const val OPS: Int = 0x8000 + private const val SAY: Int = 0x4 + private const val BAS_CHANGE: Int = 0x40000 private const val SPOTANIM: Int = 0x10000 - private const val BAS_CHANGE: Int = 0x20000 - private const val HEADICON_CUSTOMISATION: Int = 0x40000 + private const val TRANSFORMATION: Int = 0x2 + private const val NAME_CHANGE: Int = 0x1000 + private const val HITS: Int = 0x8 + private const val TINTING: Int = 0x100 + private const val SEQUENCE: Int = 0x40 + private const val EXACT_MOVE: Int = 0x2000 + private const val LEVEL_CHANGE: Int = 0x200 + private const val HEAD_CUSTOMISATION: Int = 0x4000 + private const val FACE_COORD: Int = 0x1 + private const val BODY_CUSTOMISATION: Int = 0x8000 + private const val OLD_SPOTANIM_UNUSED: Int = 0x80 + private const val HEADICON_CUSTOMISATION: Int = 0x20000 + private const val OPS: Int = 0x400 private enum class UpdateType { IDLE, diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt index 826bedd3..f718eb0a 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt @@ -294,51 +294,51 @@ internal class PlayerInfoClient( flags: Int, blocks: MutableList, ) { - if (flags and CHAT != 0) { - decodeChat(buffer, blocks) - } - if (flags and TEMP_MOVE_SPEED != 0) { - decodeTemporaryMoveSpeed(buffer, blocks) + if (flags and NAME_EXTRAS != 0) { + decodeNameExtras(buffer, blocks) } if (flags and FACE_PATHINGENTITY != 0) { decodeFacePathingEntity(buffer, blocks) } - if (flags and CHAT_OLD != 0) { - throw IllegalStateException("Old chat used!") - } if (flags and MOVE_SPEED != 0) { decodeMoveSpeed(buffer, blocks) } + if (flags and APPEARANCE != 0) { + val len = buffer.g1Alt2() + val data = ByteArray(len) + buffer.gdata(data) + decodeAppearance(Unpooled.wrappedBuffer(data).toJagByteBuf(), blocks) + } if (flags and HITS != 0) { decodeHit(buffer, blocks) } + if (flags and CHAT_OLD != 0) { + throw IllegalStateException("Old chat used!") + } + if (flags and CHAT != 0) { + decodeChat(buffer, blocks) + } + if (flags and TEMP_MOVE_SPEED != 0) { + decodeTemporaryMoveSpeed(buffer, blocks) + } + if (flags and TINTING != 0) { + decodeTinting(buffer, blocks) + } if (flags and SAY != 0) { decodeSay(buffer, blocks) } if (flags and SEQUENCE != 0) { decodeSequence(buffer, blocks) } - if (flags and NAME_EXTRAS != 0) { - decodeNameExtras(buffer, blocks) - } - if (flags and APPEARANCE != 0) { - val len = buffer.g1Alt2() - val data = ByteArray(len) - buffer.gdata(data) - decodeAppearance(Unpooled.wrappedBuffer(data).toJagByteBuf(), blocks) - } if (flags and SPOTANIM != 0) { decodeSpotanims(buffer, blocks) } - if (flags and TINTING != 0) { - decodeTinting(buffer, blocks) + if (flags and FACE_ANGLE != 0) { + decodeFaceAngle(buffer, blocks) } if (flags and EXACT_MOVE != 0) { decodeExactMove(buffer, blocks) } - if (flags and FACE_ANGLE != 0) { - decodeFaceAngle(buffer, blocks) - } } private fun decodeMoveSpeed( @@ -352,14 +352,14 @@ internal class PlayerInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - blocks += TemporaryMoveSpeedExtendedInfo(buffer.g1Alt1()) + blocks += TemporaryMoveSpeedExtendedInfo(buffer.g1Alt2()) } private fun decodeSequence( buffer: JagByteBuf, blocks: MutableList, ) { - val id = buffer.g2Alt2() + val id = buffer.g2Alt1() val delay = buffer.g1Alt1() blocks += SequenceExtendedInfo(id, delay) } @@ -369,7 +369,7 @@ internal class PlayerInfoClient( blocks: MutableList, ) { var index = buffer.g2Alt3() - index += buffer.g1() shl 16 + index += buffer.g1Alt1() shl 16 blocks += FacePathingEntityExtendedInfo(index) } @@ -401,12 +401,12 @@ internal class PlayerInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - val colourAndEffectsPacked = buffer.g2Alt1() - val modIcon = buffer.g1Alt3() - val autotyper = buffer.g1() == 1 - val huffmanLength = buffer.g1Alt1() + val colourAndEffectsPacked = buffer.g2Alt2() + val modIcon = buffer.g1Alt1() + val autotyper = buffer.g1Alt1() == 1 + val huffmanLength = buffer.g1Alt3() val data = ByteArray(huffmanLength) - buffer.gdataAlt2(data) + buffer.gdata(data) val text = huffmanCodec.decode(Unpooled.wrappedBuffer(data)) val colour = colourAndEffectsPacked ushr 8 val effects = colourAndEffectsPacked and 0xFF @@ -415,7 +415,7 @@ internal class PlayerInfoClient( if (patternLength in 1..8) { val array = ByteArray(patternLength) for (i in 0.., ) { val deltaX1 = buffer.g1s() - val deltaZ1 = buffer.g1sAlt3() + val deltaZ1 = buffer.g1sAlt2() val deltaX2 = buffer.g1s() - val deltaZ2 = buffer.g1s() - val delay1 = buffer.g2Alt3() - val delay2 = buffer.g2Alt3() - val direction = buffer.g2Alt1() + val deltaZ2 = buffer.g1sAlt2() + val delay1 = buffer.g2Alt2() + val delay2 = buffer.g2Alt1() + val direction = buffer.g2Alt2() blocks += ExactMoveExtendedInfo( deltaX1, @@ -460,11 +460,11 @@ internal class PlayerInfoClient( blocks: MutableList, ) { val spotanims = mutableMapOf() - val count = buffer.g1Alt2() + val count = buffer.g1Alt3() for (i in 0.., ) { - val hitCount = buffer.g1Alt2() + val hitCount = buffer.g1() val hits = ArrayList(hitCount) for (i in 0..(headbarCount) for (i in 0.. 0) { - buffer.g1Alt3() + buffer.g1Alt2() } else { startFill } @@ -561,11 +561,11 @@ internal class PlayerInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - val start = buffer.g2() - val end = buffer.g2() - val hue = buffer.g1Alt2() - val saturation = buffer.g1Alt1() - val lightness = buffer.g1() + val start = buffer.g2Alt3() + val end = buffer.g2Alt2() + val hue = buffer.g1Alt3() + val saturation = buffer.g1() + val lightness = buffer.g1Alt1() val weight = buffer.g1Alt1() blocks += TintingExtendedInfo( @@ -1034,22 +1034,22 @@ internal class PlayerInfoClient( private const val CUR_CYCLE_INACTIVE = 0x1 private const val NEXT_CYCLE_INACTIVE = 0x2 - private const val EXTENDED_SHORT = 0x80 + private const val SEQUENCE = 0x1 + private const val HITS = 0x2 + private const val EXTENDED_SHORT = 0x4 + private const val FACE_PATHINGENTITY = 0x8 + private const val APPEARANCE = 0x10 + private const val CHAT_OLD = 0x20 + private const val FACE_ANGLE = 0x40 + private const val SAY = 0x80 private const val EXTENDED_MEDIUM = 0x100 - private const val APPEARANCE = 0x1 - private const val SAY = 0x2 - private const val FACE_ANGLE = 0x4 - private const val CHAT_OLD = 0x8 - private const val FACE_PATHINGENTITY = 0x10 - private const val SEQUENCE = 0x20 - private const val HITS = 0x40 - private const val CHAT = 0x400 - private const val MOVE_SPEED = 0x800 - private const val EXACT_MOVE = 0x1000 - private const val TEMP_MOVE_SPEED = 0x2000 - private const val TINTING = 0x8000 + private const val MOVE_SPEED = 0x200 + private const val NAME_EXTRAS = 0x400 + private const val TEMP_MOVE_SPEED = 0x800 + private const val TINTING = 0x1000 + private const val EXACT_MOVE = 0x4000 + private const val CHAT = 0x8000 private const val SPOTANIM = 0x10000 - private const val NAME_EXTRAS = 0x200 private class Player { var queuedMove: Boolean = false diff --git a/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/zone/payload/LocAddChangeV2.kt b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/zone/payload/LocAddChangeV2.kt index f64b165b..01566750 100644 --- a/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/zone/payload/LocAddChangeV2.kt +++ b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/zone/payload/LocAddChangeV2.kt @@ -54,12 +54,13 @@ public class LocAddChangeV2 private constructor( coordInZone: CoordInZone, locProperties: LocProperties, opFlags: OpFlags, + ops: Map?, ) : this( id.toUShort(), coordInZone, locProperties, opFlags, - null, + ops, ) public val id: Int From 79b6260ab2a0acb9061b47ecdd368bca21190edd Mon Sep 17 00:00:00 2001 From: Kris Date: Thu, 16 Jan 2025 03:01:14 +0200 Subject: [PATCH 6/8] feat: update proxy service to revision 228 --- proxy/build.gradle.kts | 2 ++ .../rsprox/proxy/client/ClientGameHandler.kt | 8 +++---- .../kotlin/net/rsprox/proxy/config/RSProx.kt | 4 ++-- .../net/rsprox/proxy/plugin/DecoderLoader.kt | 24 ++++++++++++++++++- .../rsprox/proxy/server/ServerGameHandler.kt | 5 ++-- 5 files changed, 34 insertions(+), 9 deletions(-) diff --git a/proxy/build.gradle.kts b/proxy/build.gradle.kts index 497c00bf..0d4ceecc 100644 --- a/proxy/build.gradle.kts +++ b/proxy/build.gradle.kts @@ -36,6 +36,8 @@ dependencies { implementation(projects.protocol.osrs225) implementation(projects.protocol.osrs226) implementation(projects.protocol.osrs227) + implementation(projects.protocol.osrs228) + implementation(project(mapOf("path" to ":protocol:osrs-228"))) } tasks.build.configure { diff --git a/proxy/src/main/kotlin/net/rsprox/proxy/client/ClientGameHandler.kt b/proxy/src/main/kotlin/net/rsprox/proxy/client/ClientGameHandler.kt index 05b454b7..b18a9ed2 100644 --- a/proxy/src/main/kotlin/net/rsprox/proxy/client/ClientGameHandler.kt +++ b/proxy/src/main/kotlin/net/rsprox/proxy/client/ClientGameHandler.kt @@ -51,15 +51,15 @@ public class ClientGameHandler( .toJagByteBuf() for (i in 0.. { // Note(revision): This block changes in each revision and must be updated val buf = msg.payload.toJagByteBuf() - val interfaceId = buf.g2Alt2() - val targetComponent = buf.gCombinedIdAlt2() + val targetComponent = buf.gCombinedIdAlt1() buf.skipRead(1) + val interfaceId = buf.g2Alt1() if (interfaceId == BANK_PIN_INTERFACE) { this.bankPinComponent = targetComponent clientChannel.attr(INCOMING_BANK_PIN).set(true) From 19a1f62c2fe357ee3e4e285cb65c9304742c5b8e Mon Sep 17 00:00:00 2001 From: Kris Date: Thu, 16 Jan 2025 03:07:24 +0200 Subject: [PATCH 7/8] feat: update transcriber to support loc_add_change_v2 --- .../model/info/playerinfo/PlayerInfoClient.kt | 14 ++--- .../rsprox/transcriber/TranscriberPlugin.kt | 3 +- .../transcriber/indexer/IndexerTranscriber.kt | 20 ++----- .../interfaces/ServerPacketTranscriber.kt | 18 ++---- .../rsprox/transcriber/prot/GameServerProt.kt | 3 +- .../text/TextServerPacketTranscriber.kt | 57 ++++++++++++------- 6 files changed, 58 insertions(+), 57 deletions(-) diff --git a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt index f718eb0a..5127976b 100644 --- a/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt +++ b/protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt @@ -304,9 +304,9 @@ internal class PlayerInfoClient( decodeMoveSpeed(buffer, blocks) } if (flags and APPEARANCE != 0) { - val len = buffer.g1Alt2() + val len = buffer.g1() val data = ByteArray(len) - buffer.gdata(data) + buffer.gdataAlt2(data) decodeAppearance(Unpooled.wrappedBuffer(data).toJagByteBuf(), blocks) } if (flags and HITS != 0) { @@ -345,14 +345,14 @@ internal class PlayerInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - blocks += MoveSpeedExtendedInfo(buffer.g1Alt3()) + blocks += MoveSpeedExtendedInfo(buffer.g1sAlt3()) } private fun decodeTemporaryMoveSpeed( buffer: JagByteBuf, blocks: MutableList, ) { - blocks += TemporaryMoveSpeedExtendedInfo(buffer.g1Alt2()) + blocks += TemporaryMoveSpeedExtendedInfo(buffer.g1sAlt2()) } private fun decodeSequence( @@ -563,9 +563,9 @@ internal class PlayerInfoClient( ) { val start = buffer.g2Alt3() val end = buffer.g2Alt2() - val hue = buffer.g1Alt3() - val saturation = buffer.g1() - val lightness = buffer.g1Alt1() + val hue = buffer.g1sAlt3() + val saturation = buffer.g1s() + val lightness = buffer.g1sAlt1() val weight = buffer.g1Alt1() blocks += TintingExtendedInfo( diff --git a/transcriber/src/main/kotlin/net/rsprox/transcriber/TranscriberPlugin.kt b/transcriber/src/main/kotlin/net/rsprox/transcriber/TranscriberPlugin.kt index 52182d4b..d494b8bc 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/TranscriberPlugin.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/TranscriberPlugin.kt @@ -68,7 +68,8 @@ public class TranscriberPlugin( GameServerProt.UPDATE_ZONE_FULL_FOLLOWS -> pass(message, Transcriber::updateZoneFullFollows) GameServerProt.UPDATE_ZONE_PARTIAL_FOLLOWS -> pass(message, Transcriber::updateZonePartialFollows) GameServerProt.UPDATE_ZONE_PARTIAL_ENCLOSED -> pass(message, Transcriber::updateZonePartialEnclosed) - GameServerProt.LOC_ADD_CHANGE -> pass(message, Transcriber::locAddChange) + GameServerProt.LOC_ADD_CHANGE_V1 -> pass(message, Transcriber::locAddChangeV1) + GameServerProt.LOC_ADD_CHANGE_V2 -> pass(message, Transcriber::locAddChangeV2) GameServerProt.LOC_DEL -> pass(message, Transcriber::locDel) GameServerProt.LOC_ANIM -> pass(message, Transcriber::locAnim) GameServerProt.LOC_MERGE -> pass(message, Transcriber::locMerge) diff --git a/transcriber/src/main/kotlin/net/rsprox/transcriber/indexer/IndexerTranscriber.kt b/transcriber/src/main/kotlin/net/rsprox/transcriber/indexer/IndexerTranscriber.kt index 40e76cab..189f0c02 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/indexer/IndexerTranscriber.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/indexer/IndexerTranscriber.kt @@ -210,19 +210,7 @@ import net.rsprox.protocol.game.outgoing.model.worldentity.SetActiveWorld import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZoneFullFollows import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZonePartialEnclosed import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZonePartialFollows -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChangeV1 -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAnim -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocDel -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocMerge -import net.rsprox.protocol.game.outgoing.model.zone.payload.MapAnim -import net.rsprox.protocol.game.outgoing.model.zone.payload.MapProjAnim -import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjAdd -import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjCount -import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjCustomise -import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjDel -import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjEnabledOps -import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjUncustomise -import net.rsprox.protocol.game.outgoing.model.zone.payload.SoundArea +import net.rsprox.protocol.game.outgoing.model.zone.payload.* import net.rsprox.shared.BaseVarType import net.rsprox.shared.ScriptVarType import net.rsprox.shared.indexing.BinaryIndex @@ -1114,7 +1102,11 @@ public class IndexerTranscriber( override fun updateZonePartialFollows(message: UpdateZonePartialFollows) { } - override fun locAddChange(message: LocAddChangeV1) { + override fun locAddChangeV1(message: LocAddChangeV1) { + binaryIndex.increment(IndexedType.LOC, message.id) + } + + override fun locAddChangeV2(message: LocAddChangeV2) { binaryIndex.increment(IndexedType.LOC, message.id) } diff --git a/transcriber/src/main/kotlin/net/rsprox/transcriber/interfaces/ServerPacketTranscriber.kt b/transcriber/src/main/kotlin/net/rsprox/transcriber/interfaces/ServerPacketTranscriber.kt index 7667f96e..fa2a6a41 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/interfaces/ServerPacketTranscriber.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/interfaces/ServerPacketTranscriber.kt @@ -112,19 +112,7 @@ import net.rsprox.protocol.game.outgoing.model.worldentity.SetActiveWorld import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZoneFullFollows import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZonePartialEnclosed import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZonePartialFollows -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChangeV1 -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAnim -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocDel -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocMerge -import net.rsprox.protocol.game.outgoing.model.zone.payload.MapAnim -import net.rsprox.protocol.game.outgoing.model.zone.payload.MapProjAnim -import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjAdd -import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjCount -import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjCustomise -import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjDel -import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjEnabledOps -import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjUncustomise -import net.rsprox.protocol.game.outgoing.model.zone.payload.SoundArea +import net.rsprox.protocol.game.outgoing.model.zone.payload.* public interface ServerPacketTranscriber { public fun camLookAt(message: CamLookAt) @@ -381,7 +369,9 @@ public interface ServerPacketTranscriber { public fun updateZonePartialFollows(message: UpdateZonePartialFollows) - public fun locAddChange(message: LocAddChangeV1) + public fun locAddChangeV1(message: LocAddChangeV1) + + public fun locAddChangeV2(message: LocAddChangeV2) public fun locAnim(message: LocAnim) diff --git a/transcriber/src/main/kotlin/net/rsprox/transcriber/prot/GameServerProt.kt b/transcriber/src/main/kotlin/net/rsprox/transcriber/prot/GameServerProt.kt index b05395bd..077013d6 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/prot/GameServerProt.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/prot/GameServerProt.kt @@ -42,7 +42,8 @@ public enum class GameServerProt : Prot { UPDATE_ZONE_PARTIAL_ENCLOSED, // Zone payload packets - LOC_ADD_CHANGE, + LOC_ADD_CHANGE_V1, + LOC_ADD_CHANGE_V2, LOC_DEL, LOC_ANIM, LOC_MERGE, diff --git a/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextServerPacketTranscriber.kt b/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextServerPacketTranscriber.kt index 589d5ef6..7aea288e 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextServerPacketTranscriber.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextServerPacketTranscriber.kt @@ -139,19 +139,7 @@ import net.rsprox.protocol.game.outgoing.model.worldentity.SetActiveWorld import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZoneFullFollows import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZonePartialEnclosed import net.rsprox.protocol.game.outgoing.model.zone.header.UpdateZonePartialFollows -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAddChangeV1 -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocAnim -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocDel -import net.rsprox.protocol.game.outgoing.model.zone.payload.LocMerge -import net.rsprox.protocol.game.outgoing.model.zone.payload.MapAnim -import net.rsprox.protocol.game.outgoing.model.zone.payload.MapProjAnim -import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjAdd -import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjCount -import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjCustomise -import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjDel -import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjEnabledOps -import net.rsprox.protocol.game.outgoing.model.zone.payload.ObjUncustomise -import net.rsprox.protocol.game.outgoing.model.zone.payload.SoundArea +import net.rsprox.protocol.game.outgoing.model.zone.payload.* import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInBuildArea import net.rsprox.protocol.reflection.ReflectionCheck import net.rsprox.shared.ScriptVarType @@ -2447,8 +2435,13 @@ public class TextServerPacketTranscriber( when (event) { is LocAddChangeV1 -> { if (!filters[PropertyFilter.LOC_ADD_CHANGE]) continue - val root = sessionState.createFakeServerRoot("LOC_ADD_CHANGE") - root.buildLocAddChange(event) + val root = sessionState.createFakeServerRoot("LOC_ADD_CHANGE_V1") + root.buildLocAddChangeV1(event) + } + is LocAddChangeV2 -> { + if (!filters[PropertyFilter.LOC_ADD_CHANGE]) continue + val root = sessionState.createFakeServerRoot("LOC_ADD_CHANGE_V2") + root.buildLocAddChangeV2(event) } is LocAnim -> { if (!filters[PropertyFilter.LOC_ANIM]) continue @@ -2523,8 +2516,14 @@ public class TextServerPacketTranscriber( when (event) { is LocAddChangeV1 -> { if (!filters[PropertyFilter.LOC_ADD_CHANGE]) continue - group("LOC_ADD_CHANGE") { - buildLocAddChange(event) + group("LOC_ADD_CHANGE_V1") { + buildLocAddChangeV1(event) + } + } + is LocAddChangeV2 -> { + if (!filters[PropertyFilter.LOC_ADD_CHANGE]) continue + group("LOC_ADD_CHANGE_V2") { + buildLocAddChangeV2(event) } } is LocAnim -> { @@ -2609,9 +2608,14 @@ public class TextServerPacketTranscriber( root.coordGrid(buildAreaCoordGrid(message.zoneX, message.zoneZ, message.level)) } - override fun locAddChange(message: LocAddChangeV1) { + override fun locAddChangeV1(message: LocAddChangeV1) { + if (!filters[PropertyFilter.LOC_ADD_CHANGE]) return omit() + root.buildLocAddChangeV1(message) + } + + override fun locAddChangeV2(message: LocAddChangeV2) { if (!filters[PropertyFilter.LOC_ADD_CHANGE]) return omit() - root.buildLocAddChange(message) + root.buildLocAddChangeV2(message) } override fun locAnim(message: LocAnim) { @@ -2671,13 +2675,26 @@ public class TextServerPacketTranscriber( return sessionState.getActiveWorld().relativizeZoneCoord(xInZone, zInZone) } - private fun Property.buildLocAddChange(message: LocAddChangeV1) { + private fun Property.buildLocAddChangeV1(message: LocAddChangeV1) { scriptVarType("id", ScriptVarType.LOC, message.id) coordGrid(coordInZone(message.xInZone, message.zInZone)) scriptVarType("shape", ScriptVarType.LOC_SHAPE, message.shape) int("rotation", message.rotation) } + private fun Property.buildLocAddChangeV2(message: LocAddChangeV2) { + scriptVarType("id", ScriptVarType.LOC, message.id) + coordGrid(coordInZone(message.xInZone, message.zInZone)) + scriptVarType("shape", ScriptVarType.LOC_SHAPE, message.shape) + int("rotation", message.rotation) + val ops = message.ops + if (ops != null) { + for ((k, v) in ops) { + string("op$k", v) + } + } + } + private fun Property.buildLocAnim(message: LocAnim) { coordGrid(coordInZone(message.xInZone, message.zInZone)) scriptVarType("shape", ScriptVarType.LOC_SHAPE, message.shape) From a5c185e55e25b7333593de856c73cfae4fedc302 Mon Sep 17 00:00:00 2001 From: Kris Date: Thu, 16 Jan 2025 03:20:41 +0200 Subject: [PATCH 8/8] fix: increment loc add change v2's op indices so it doesn't start at 0 --- .../net/rsprox/transcriber/text/TextServerPacketTranscriber.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextServerPacketTranscriber.kt b/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextServerPacketTranscriber.kt index 7aea288e..1c6b44bc 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextServerPacketTranscriber.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextServerPacketTranscriber.kt @@ -2690,7 +2690,7 @@ public class TextServerPacketTranscriber( val ops = message.ops if (ops != null) { for ((k, v) in ops) { - string("op$k", v) + string("op${k.inc()}", v) } } }