From 61e2c8423903d4d7a3a2afa66df2a2373a51af01 Mon Sep 17 00:00:00 2001 From: Kris Date: Sun, 20 Sep 2026 17:13:41 +0300 Subject: [PATCH 1/7] feat: revision 241 (initial copy of 240) --- protocol/osrs-241/build.gradle.kts | 14 + .../v241/ClientPacketDecoderServiceV241.kt | 25 + .../v241/GameClientProtProviderV241.kt | 16 + .../v241/GameServerProtProviderV241.kt | 16 + .../v241/ServerPacketDecoderServiceV241.kt | 31 + .../decoder/codec/buttons/If1ButtonDecoder.kt | 23 + .../decoder/codec/buttons/IfButtonDDecoder.kt | 33 + .../decoder/codec/buttons/IfButtonTDecoder.kt | 34 + .../decoder/codec/buttons/IfButtonXDecoder.kt | 31 + .../codec/buttons/IfScriptTriggerDecoder.kt | 33 + .../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/EventMouseClickV1Decoder.kt | 31 + .../codec/events/EventMouseClickV2Decoder.kt | 31 + .../codec/events/EventMouseMoveDecoder.kt | 96 ++ .../codec/events/EventMouseScrollDecoder.kt | 22 + .../events/EventNativeMouseMoveDecoder.kt | 93 ++ .../friendchat/FriendChatJoinLeaveDecoder.kt | 27 + .../codec/friendchat/FriendChatKickDecoder.kt | 22 + .../friendchat/FriendChatSetRankDecoder.kt | 24 + .../decoder/codec/locs/OpLoc1V2Decoder.kt | 31 + .../decoder/codec/locs/OpLoc2V2Decoder.kt | 31 + .../decoder/codec/locs/OpLoc3V2Decoder.kt | 31 + .../decoder/codec/locs/OpLoc4V2Decoder.kt | 31 + .../decoder/codec/locs/OpLoc5V2Decoder.kt | 31 + .../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 + .../codec/misc/client/RSevenStatusDecoder.kt | 22 + .../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 | 32 + .../codec/misc/user/ClickWorldMapDecoder.kt | 21 + .../codec/misc/user/ClientCheatDecoder.kt | 31 + .../codec/misc/user/CloseModalDecoder.kt | 19 + .../codec/misc/user/ExitFreecamDecoder.kt | 19 + .../codec/misc/user/HiscoreRequestDecoder.kt | 28 + .../codec/misc/user/IfCrmViewOpDecoder.kt | 33 + .../codec/misc/user/MoveGameClickDecoder.kt | 26 + .../misc/user/MoveMinimapClickDecoder.kt | 59 + .../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/OpNpc1V2Decoder.kt | 27 + .../decoder/codec/npcs/OpNpc2V2Decoder.kt | 27 + .../decoder/codec/npcs/OpNpc3V2Decoder.kt | 27 + .../decoder/codec/npcs/OpNpc4V2Decoder.kt | 27 + .../decoder/codec/npcs/OpNpc5V2Decoder.kt | 27 + .../decoder/codec/npcs/OpNpc6Decoder.kt | 20 + .../decoder/codec/npcs/OpNpcTDecoder.kt | 31 + .../decoder/codec/objs/OpObj1V2Decoder.kt | 31 + .../decoder/codec/objs/OpObj2V2Decoder.kt | 31 + .../decoder/codec/objs/OpObj3V2Decoder.kt | 31 + .../decoder/codec/objs/OpObj4V2Decoder.kt | 31 + .../decoder/codec/objs/OpObj5V2Decoder.kt | 31 + .../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 + .../resumed/ResumePCountDialogLongDecoder.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 + .../worldentities/OpWorldEntity1Decoder.kt | 25 + .../worldentities/OpWorldEntity2Decoder.kt | 25 + .../worldentities/OpWorldEntity3Decoder.kt | 25 + .../worldentities/OpWorldEntity4Decoder.kt | 25 + .../worldentities/OpWorldEntity5Decoder.kt | 25 + .../worldentities/OpWorldEntity6Decoder.kt | 20 + .../worldentities/OpWorldEntityTDecoder.kt | 31 + .../prot/ClientMessageDecoderRepository.kt | 201 +++ .../incoming/decoder/prot/GameClientProt.kt | 170 +++ .../incoming/decoder/prot/GameClientProtId.kt | 105 ++ .../codec/camera/CamLookAtCyclesDecoder.kt | 32 + .../codec/camera/CamLookAtV2Decoder.kt | 30 + .../codec/camera/CamLookAtV3Decoder.kt | 32 + .../decoder/codec/camera/CamModeDecoder.kt | 24 + .../codec/camera/CamMoveToArcV2Decoder.kt | 36 + .../codec/camera/CamMoveToArcV3Decoder.kt | 38 + .../codec/camera/CamMoveToCyclesV2Decoder.kt | 32 + .../codec/camera/CamMoveToCyclesV3Decoder.kt | 34 + .../codec/camera/CamMoveToV2Decoder.kt | 30 + .../codec/camera/CamMoveToV3Decoder.kt | 32 + .../decoder/codec/camera/CamResetDecoder.kt | 21 + .../decoder/codec/camera/CamRotateBy.kt | 30 + .../camera/CamRotateToCoordinateV2Decoder.kt | 30 + .../camera/CamRotateToCoordinateV3Decoder.kt | 34 + .../codec/camera/CamRotateToDecoder.kt | 30 + .../decoder/codec/camera/CamShakeDecoder.kt | 30 + .../decoder/codec/camera/CamSkyboxDecoder.kt | 22 + .../codec/camera/CamSmoothResetDecoder.kt | 30 + .../codec/camera/CamTargetV3Decoder.kt | 37 + .../codec/camera/CamTargetV4Decoder.kt | 30 + .../decoder/codec/camera/CamUnlockDecoder.kt | 22 + .../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 + .../decoder/codec/group/GroupFullDecoder.kt | 42 + .../decoder/codec/group/GroupVarDecoder.kt | 43 + .../decoder/codec/group/GroupVarIntDecoder.kt | 32 + .../codec/group/GroupVarLongDecoder.kt | 32 + .../codec/info/NpcInfoLargeV5Decoder.kt | 29 + .../codec/info/NpcInfoLargeV6Decoder.kt | 29 + .../codec/info/NpcInfoSmallV5Decoder.kt | 29 + .../codec/info/NpcInfoSmallV6Decoder.kt | 29 + .../decoder/codec/info/PlayerInfoDecoder.kt | 22 + .../codec/info/SetNpcUpdateOriginDecoder.kt | 38 + .../codec/info/WorldEntityInfoV7Decoder.kt | 112 ++ .../codec/interfaces/IfClearInvDecoder.kt | 24 + .../codec/interfaces/IfCloseSubDecoder.kt | 26 + .../codec/interfaces/IfMoveSubDecoder.kt | 27 + .../codec/interfaces/IfOpenSubDecoder.kt | 28 + .../codec/interfaces/IfOpenTopDecoder.kt | 22 + .../codec/interfaces/IfResyncV2Decoder.kt | 64 + .../codec/interfaces/IfSetAngleDecoder.kt | 30 + .../codec/interfaces/IfSetAnimDecoder.kt | 26 + .../codec/interfaces/IfSetColourDecoder.kt | 26 + .../codec/interfaces/IfSetEventsV2Decoder.kt | 32 + .../codec/interfaces/IfSetHideDecoder.kt | 26 + .../codec/interfaces/IfSetModelV2Decoder.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 + .../codec/map/RebuildRegionV2Decoder.kt | 49 + .../codec/map/RebuildWorldEntityV4Decoder.kt | 52 + .../decoder/codec/map/ReconnectDecoder.kt | 45 + .../codec/map/StaticRebuildV2Decoder.kt | 119 ++ .../codec/misc/client/HideLocOpsDecoder.kt | 22 + .../codec/misc/client/HideNpcOpsDecoder.kt | 22 + .../codec/misc/client/HideObjOpsDecoder.kt | 22 + .../codec/misc/client/HintArrowDecoder.kt | 55 + .../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/UpdateRebootTimerV2Decoder.kt | 32 + .../codec/misc/client/UpdateUid192Decoder.kt | 31 + .../codec/misc/client/UrlOpenDecoder.kt | 26 + .../codec/misc/player/AccountFlagsDecoder.kt | 24 + .../misc/player/ChatFilterSettingsDecoder.kt | 24 + .../ChatFilterSettingsPrivateChatDecoder.kt | 24 + .../codec/misc/player/MessageGameDecoder.kt | 40 + .../misc/player/RunClientScriptDecoder.kt | 58 + .../codec/misc/player/SetMapFlagV2Decoder.kt | 21 + .../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 + .../codec/sound/AmbientSoundStartDecoder.kt | 24 + .../codec/sound/AmbientSoundStopDecoder.kt | 22 + .../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/AnimSpecificDecoder.kt | 24 + .../codec/specific/LocAnimSpecificDecoder.kt | 28 + .../codec/specific/MapAnimSpecificDecoder.kt | 29 + .../codec/specific/NpcAnimSpecificDecoder.kt | 26 + .../specific/NpcHeadIconSpecificDecoder.kt | 28 + .../specific/NpcSpotAnimSpecificDecoder.kt | 31 + .../codec/specific/ObjAddSpecificDecoder.kt | 38 + .../codec/specific/ObjCountSpecificDecoder.kt | 29 + .../specific/ObjCustomiseSpecificDecoder.kt | 37 + .../codec/specific/ObjDelSpecificDecoder.kt | 27 + .../specific/ObjEnabledOpsSpecificDecoder.kt | 28 + .../specific/ObjUncustomiseSpecificDecoder.kt | 27 + .../specific/PlayerSpotAnimSpecificDecoder.kt | 31 + .../specific/ProjAnimSpecificV4Decoder.kt | 43 + .../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 + .../worldentity/SetActiveWorldV2Decoder.kt | 38 + .../header/UpdateZoneFullFollowsDecoder.kt | 26 + .../UpdateZonePartialEnclosedDecoder.kt | 71 + .../header/UpdateZonePartialFollowsDecoder.kt | 26 + .../zone/payload/LocAddChangeV2Decoder.kt | 45 + .../codec/zone/payload/LocAnimDecoder.kt | 28 + .../codec/zone/payload/LocDelDecoder.kt | 26 + .../codec/zone/payload/LocMergeDecoder.kt | 42 + .../codec/zone/payload/MapAnimDecoder.kt | 29 + .../zone/payload/MapProjAnimV2Decoder.kt | 44 + .../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 + .../zone/payload/ScriptedProjAddDecoder.kt | 57 + .../zone/payload/ScriptedProjChangeDecoder.kt | 37 + .../codec/zone/payload/SoundAreaDecoder.kt | 33 + .../outgoing/decoder/prot/GameServerProt.kt | 221 +++ .../outgoing/decoder/prot/GameServerProtId.kt | 156 +++ .../prot/ServerMessageDecoderRepository.kt | 341 +++++ .../model/info/npcinfo/NpcInfoClient.kt | 1093 +++++++++++++++ .../model/info/playerinfo/PlayerInfoClient.kt | 1198 +++++++++++++++++ .../worldentityinfo/WorldEntityInfoClient.kt | 650 +++++++++ 271 files changed, 12829 insertions(+) create mode 100644 protocol/osrs-241/build.gradle.kts create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/ClientPacketDecoderServiceV241.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/GameClientProtProviderV241.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/GameServerProtProviderV241.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/ServerPacketDecoderServiceV241.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/If1ButtonDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonDDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonTDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonXDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfScriptTriggerDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfSubOpDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/AffinedClanSettingsAddBannedFromChannelDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/AffinedClanSettingsSetMutedFromChannelDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/ClanChannelFullRequestDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/ClanChannelKickUserDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/ClanSettingsFullRequestDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventAppletFocusDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventCameraPositionDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventKeyboardDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventMouseClickV1Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventMouseClickV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventMouseMoveDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventMouseScrollDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventNativeMouseMoveDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/friendchat/FriendChatJoinLeaveDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/friendchat/FriendChatKickDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/friendchat/FriendChatSetRankDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc1V2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc2V2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc3V2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc4V2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc5V2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc6Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLocTDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/messaging/MessagePrivateDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/messaging/MessagePublicDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/ConnectionTelemetryDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/DetectModifiedClientDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/IdleDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/MapBuildCompleteDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/MembershipPromotionEligibilityDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/NoTimeoutDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/RSevenStatusDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/ReflectionCheckReplyDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/SoundJingleEndDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/WindowStatusDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/BugReportDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/ClickWorldMapDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/ClientCheatDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/CloseModalDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/ExitFreecamDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/HiscoreRequestDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/IfCrmViewOpDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/MoveGameClickDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/MoveMinimapClickDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/SendSnapshotDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/SetChatFilterSettingsDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/SetHeadingDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/TeleportDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc1V2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc2V2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc3V2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc4V2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc5V2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc6Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpcTDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj1V2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj2V2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj3V2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj4V2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj5V2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj6Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObjTDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer1Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer3Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer4Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer5Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer6Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer7Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer8Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayerTDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePCountDialogDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePCountDialogLongDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePNameDialogDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePObjDialogDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePStringDialogDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePauseButtonDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/social/FriendListAddDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/social/FriendListDelDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/social/IgnoreListAddDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/social/IgnoreListDelDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity1Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity3Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity4Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity5Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity6Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntityTDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProt.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProtId.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtCyclesDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV3Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamModeDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToArcV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToArcV3Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToCyclesV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToCyclesV3Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToV3Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamResetDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateBy.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToCoordinateV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToCoordinateV3Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamShakeDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamSkyboxDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamSmoothResetDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamTargetV3Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamTargetV4Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamUnlockDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/OculusSyncDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/ClanChannelDeltaDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/ClanChannelFullDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/ClanSettingsDeltaDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/ClanSettingsFullDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/MessageClanChannelDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/MessageClanChannelSystemDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/VarClanDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/VarClanDisableDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/VarClanEnableDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/friendchat/MessageFriendChannelDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/friendchat/UpdateFriendChatChannelFullV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/friendchat/UpdateFriendChatChannelSingleUserDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/group/GroupFullDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/group/GroupVarDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/group/GroupVarIntDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/group/GroupVarLongDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoLargeV5Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoLargeV6Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoSmallV5Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoSmallV6Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/PlayerInfoDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/SetNpcUpdateOriginDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/WorldEntityInfoV7Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfClearInvDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfCloseSubDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfMoveSubDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfOpenSubDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfOpenTopDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfResyncV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetAngleDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetAnimDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetColourDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetEventsV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetHideDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetModelV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadActiveDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetObjectDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerHeadDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBaseColourDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBodyTypeDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelObjDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelSelfDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPositionDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetScrollPosDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetTextDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvFullDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvPartialDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvStopTransmitDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/logout/LogoutDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/logout/LogoutTransferDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/logout/LogoutWithReasonDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/map/RebuildRegionV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/map/RebuildWorldEntityV4Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/map/ReconnectDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/map/StaticRebuildV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/HideLocOpsDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/HideNpcOpsDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/HideObjOpsDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/HintArrowDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/HiscoreReplyDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/MinimapToggleDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/PacketGroupEndDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/PacketGroupStartDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ReflectionCheckerDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ResetAnimsDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ResetInteractionModeDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/SendPingDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ServerTickEndDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/SetHeatmapEnabledDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/SetInteractionModeDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/SiteSettingsDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/UpdateRebootTimerV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/UpdateUid192Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/UrlOpenDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/AccountFlagsDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsPrivateChatDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/MessageGameDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/RunClientScriptDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/SetMapFlagV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/SetPlayerOpDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/TriggerOnDialogAbortDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateRunEnergyDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateRunWeightDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateStatV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateTradingPostDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/social/FriendListLoadedDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/social/MessagePrivateDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/social/MessagePrivateEchoDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/social/UpdateFriendListDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/social/UpdateIgnoreListDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStartDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStopDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiJingleDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongStopDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongWithSecondaryDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSwapDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/SynthSoundDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/AnimSpecificDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/LocAnimSpecificDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/MapAnimSpecificDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcAnimSpecificDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcHeadIconSpecificDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcSpotAnimSpecificDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjAddSpecificDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCountSpecificDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjDelSpecificDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjEnabledOpsSpecificDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjUncustomiseSpecificDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/PlayerSpotAnimSpecificDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ProjAnimSpecificV4Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/unknown/UnknownStringDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpLargeDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpResetDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpSmallDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpSyncDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/worldentity/SetActiveWorldV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZoneFullFollowsDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZonePartialEnclosedDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZonePartialFollowsDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocAddChangeV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocAnimDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocDelDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapProjAnimV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjCountDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjCustomiseDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjDelDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjEnabledOpsDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjUncustomiseDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjAddDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjChangeDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/SoundAreaDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/GameServerProt.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/GameServerProtId.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/npcinfo/NpcInfoClient.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/worldentityinfo/WorldEntityInfoClient.kt diff --git a/protocol/osrs-241/build.gradle.kts b/protocol/osrs-241/build.gradle.kts new file mode 100644 index 000000000..f47018b25 --- /dev/null +++ b/protocol/osrs-241/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-241/src/main/kotlin/net/rsprox/protocol/v241/ClientPacketDecoderServiceV241.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/ClientPacketDecoderServiceV241.kt new file mode 100644 index 000000000..1eb0db982 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/ClientPacketDecoderServiceV241.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v241 + +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.v241.game.incoming.decoder.prot.ClientMessageDecoderRepository + +public class ClientPacketDecoderServiceV241( + 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-241/src/main/kotlin/net/rsprox/protocol/v241/GameClientProtProviderV241.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/GameClientProtProviderV241.kt new file mode 100644 index 000000000..49cfb45b0 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/GameClientProtProviderV241.kt @@ -0,0 +1,16 @@ +package net.rsprox.protocol.v241 + +import net.rsprox.protocol.ProtProvider +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt +import kotlin.enums.EnumEntries + +public data object GameClientProtProviderV241 : ProtProvider { + override fun get(opcode: Int): GameClientProt { + return GameClientProt.entries.firstOrNull { it.opcode == opcode } + ?: throw IllegalArgumentException("Unknown game client prot: $opcode") + } + + override fun allProts(): EnumEntries { + return GameClientProt.entries + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/GameServerProtProviderV241.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/GameServerProtProviderV241.kt new file mode 100644 index 000000000..17ccf728a --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/GameServerProtProviderV241.kt @@ -0,0 +1,16 @@ +package net.rsprox.protocol.v241 + +import net.rsprox.protocol.ProtProvider +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt +import kotlin.enums.EnumEntries + +public data object GameServerProtProviderV241 : ProtProvider { + override fun get(opcode: Int): GameServerProt { + return GameServerProt.entries.firstOrNull { it.opcode == opcode } + ?: throw IllegalArgumentException("Unknown game server prot: $opcode") + } + + override fun allProts(): EnumEntries { + return GameServerProt.entries + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/ServerPacketDecoderServiceV241.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/ServerPacketDecoderServiceV241.kt new file mode 100644 index 000000000..b93b38b9c --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/ServerPacketDecoderServiceV241.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241 + +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.v241.game.outgoing.decoder.prot.ServerMessageDecoderRepository + +public class ServerPacketDecoderServiceV241( + 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/If1ButtonDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/If1ButtonDecoder.kt new file mode 100644 index 000000000..480af1200 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/If1ButtonDecoder.kt @@ -0,0 +1,23 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonDDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonDDecoder.kt new file mode 100644 index 000000000..0e8d483c3 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonDDecoder.kt @@ -0,0 +1,33 @@ +package net.rsprox.protocol.v241.game.incoming.decoder.codec.buttons + +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.incoming.model.buttons.IfButtonD +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class IfButtonDDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.IF_BUTTOND + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfButtonD { + val selectedSub = buffer.g2Alt2() + val targetCombinedId = buffer.gCombinedId() + val targetSub = buffer.g2() + val selectedCombinedId = buffer.gCombinedId() + val targetObj = buffer.g2Alt2() + val selectedObj = buffer.g2Alt3() + return IfButtonD( + selectedCombinedId, + selectedSub, + selectedObj, + targetCombinedId, + targetSub, + targetObj, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonTDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonTDecoder.kt new file mode 100644 index 000000000..00a29e4ad --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonTDecoder.kt @@ -0,0 +1,34 @@ +package net.rsprox.protocol.v241.game.incoming.decoder.codec.buttons + +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.incoming.model.buttons.IfButtonT +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class IfButtonTDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.IF_BUTTONT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfButtonT { + val selectedObj = buffer.g2Alt1() + val selectedCombinedId = buffer.gCombinedId() + val targetSub = buffer.g2Alt3() + val targetObj = buffer.g2Alt2() + val selectedSub = buffer.g2Alt3() + val targetCombinedId = buffer.gCombinedIdAlt3() + return IfButtonT( + selectedCombinedId, + selectedSub, + selectedObj, + targetCombinedId, + targetSub, + targetObj, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonXDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonXDecoder.kt new file mode 100644 index 000000000..69bedf5d8 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonXDecoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.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.If3Button +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public class IfButtonXDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.IF_BUTTONX + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): If3Button { + val combinedId = buffer.gCombinedId() + val sub = buffer.g2() + val obj = buffer.g2() + val op = buffer.g1() + return If3Button( + combinedId, + sub, + obj, + op, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfScriptTriggerDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfScriptTriggerDecoder.kt new file mode 100644 index 000000000..a37f11315 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfScriptTriggerDecoder.kt @@ -0,0 +1,33 @@ +package net.rsprox.protocol.v241.game.incoming.decoder.codec.buttons + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.buffer.extensions.toByteArray +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.util.gCombinedIdAlt2 +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.buttons.IfScriptTrigger +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class IfScriptTriggerDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.IF_SCRIPT_TRIGGER + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfScriptTrigger { + // Function is method(int combinedId, int sub, int obj, int crc, Object[] args) + val crc = buffer.g4Alt2() + val obj = buffer.g2() + val combinedId = buffer.gCombinedIdAlt2() + val sub = buffer.g2Alt1() + val bytes = buffer.buffer.toByteArray() + return IfScriptTrigger( + combinedId, + sub, + obj, + crc, + bytes, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfSubOpDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfSubOpDecoder.kt new file mode 100644 index 000000000..7de2ff54b --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfSubOpDecoder.kt @@ -0,0 +1,33 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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 op = buffer.g1() + val subop = buffer.g1() + return IfSubOp( + combinedId, + sub, + obj, + op, + subop, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/AffinedClanSettingsAddBannedFromChannelDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/AffinedClanSettingsAddBannedFromChannelDecoder.kt new file mode 100644 index 000000000..6c3c47466 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/AffinedClanSettingsAddBannedFromChannelDecoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/AffinedClanSettingsSetMutedFromChannelDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/AffinedClanSettingsSetMutedFromChannelDecoder.kt new file mode 100644 index 000000000..c02e6a369 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/AffinedClanSettingsSetMutedFromChannelDecoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/ClanChannelFullRequestDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/ClanChannelFullRequestDecoder.kt new file mode 100644 index 000000000..7457f795d --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/ClanChannelFullRequestDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/ClanChannelKickUserDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/ClanChannelKickUserDecoder.kt new file mode 100644 index 000000000..ad7011855 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/ClanChannelKickUserDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/ClanSettingsFullRequestDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/ClanSettingsFullRequestDecoder.kt new file mode 100644 index 000000000..c2f9ef995 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/clan/ClanSettingsFullRequestDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventAppletFocusDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventAppletFocusDecoder.kt new file mode 100644 index 000000000..cf5fd6508 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventAppletFocusDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventCameraPositionDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventCameraPositionDecoder.kt new file mode 100644 index 000000000..f3a0b8cb3 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventCameraPositionDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public class EventCameraPositionDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.EVENT_CAMERA_POSITION + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): EventCameraPosition { + val angleX = buffer.g2() + val angleY = buffer.g2Alt2() + return EventCameraPosition( + angleX, + angleY, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventKeyboardDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventKeyboardDecoder.kt new file mode 100644 index 000000000..8168a504b --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventKeyboardDecoder.kt @@ -0,0 +1,33 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public 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_V1 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): EventMouseClickV1 { + val packed = buffer.g2() + val rightClick = packed and 0x1 != 0 + val lastTransmittedMouseClick = packed ushr 1 + val x = buffer.g2() + val y = buffer.g2() + return EventMouseClickV1( + lastTransmittedMouseClick, + rightClick, + x, + y, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventMouseClickV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventMouseClickV2Decoder.kt new file mode 100644 index 000000000..f0f455e7e --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventMouseClickV2Decoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.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.EventMouseClickV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class EventMouseClickV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.EVENT_MOUSE_CLICK_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): EventMouseClickV2 { + val code = buffer.g1() + val y = buffer.g2Alt3() + val packed = buffer.g2() + val x = buffer.g2Alt3() + val rightClick = packed and 0x1 != 0 + val lastTransmittedMouseClick = packed ushr 1 + return EventMouseClickV2( + lastTransmittedMouseClick, + code, + rightClick, + x, + y, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventMouseMoveDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventMouseMoveDecoder.kt new file mode 100644 index 000000000..328e418f3 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventMouseMoveDecoder.kt @@ -0,0 +1,96 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Suppress("DuplicatedCode") +@Consistent +public class EventMouseMoveDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.EVENT_MOUSE_MOVE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): EventMouseMove { + val stepExcess = buffer.g1() + val endExcess = buffer.g1() + val array = threadLocalArray.get() + var count = 0 + while (buffer.isReadable) { + var packed = buffer.g1() + var x: Int + var y: Int + var timeSinceLastMovement: Int + var delta: Boolean + if (packed and 0xE0 == 0xE0) { + timeSinceLastMovement = packed and 0x1f shl 8 or buffer.g1() + val packed = buffer.g4() + if (packed == Int.MIN_VALUE) { + x = -1 + y = -1 + } else { + x = packed and 0xFFFF + y = packed ushr 16 and 0xFFFF + } + delta = false + } else if (packed and 0xC0 == 0xC0) { + timeSinceLastMovement = packed and 0x3f + + val packed = buffer.g4() + if (packed == Int.MIN_VALUE) { + x = -1 + y = -1 + } else { + x = packed and 0xFFFF + y = packed ushr 16 and 0xFFFF + } + delta = false + } else if (packed and 0x80 == 0x80) { + timeSinceLastMovement = packed and 0x7f + x = buffer.g1() - 128 + y = buffer.g1() - 128 + delta = true + } else { + packed = (packed shl 8) or (buffer.g1()) + timeSinceLastMovement = (packed ushr 12) and 0x7 + x = ((packed shr 6) and 0x3F) - 32 + y = (packed and 0x3F) - 32 + delta = true + } + val change = + MouseMovements.MousePosChange.pack( + timeSinceLastMovement, + x, + y, + delta, + ) + array[count++] = change + } + val slice = array.copyOf(count) + return EventMouseMove( + stepExcess, + endExcess, + 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventMouseScrollDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventMouseScrollDecoder.kt new file mode 100644 index 000000000..5797874e2 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventMouseScrollDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventNativeMouseMoveDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventNativeMouseMoveDecoder.kt new file mode 100644 index 000000000..4a15bc522 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventNativeMouseMoveDecoder.kt @@ -0,0 +1,93 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Suppress("DuplicatedCode") +@Consistent +public class EventNativeMouseMoveDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.EVENT_NATIVE_MOUSE_MOVE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): EventNativeMouseMove { + val stepExcess = buffer.g1() + val endExcess = buffer.g1() + val array = threadLocalArray.get() + var count = 0 + while (buffer.isReadable) { + var packed = buffer.g1() + var x: Int + var y: Int + var timeSinceLastMovement: Int + var delta: Boolean + if (packed and 0xE0 == 0xE0) { + timeSinceLastMovement = packed and 0x1f shl 8 or buffer.g1() + y = buffer.g2s() + x = buffer.g2s() + delta = false + if (x == 0 && y == -0x8000) { + x = -1 + y = -1 + } + } else if (packed and 0xC0 == 0xC0) { + timeSinceLastMovement = packed and 0x3f + y = buffer.g2s() + x = buffer.g2s() + delta = false + if (x == 0 && y == -0x8000) { + x = -1 + y = -1 + } + } else if (packed and 0x80 == 0x80) { + timeSinceLastMovement = packed and 0x7f + x = buffer.g1() - 128 + y = buffer.g1() - 128 + delta = true + } else { + packed = (packed shl 8) or (buffer.g1()) + timeSinceLastMovement = (packed ushr 12) and 0x7 + x = ((packed shr 6) and 0x3F) - 32 + y = (packed and 0x3F) - 32 + delta = true + } + val lastMouseButton = buffer.g1() + val change = + MouseMovements.MousePosChange.pack( + timeSinceLastMovement, + x, + y, + delta, + lastMouseButton, + ) + array[count++] = change + } + val slice = array.copyOf(count) + return EventNativeMouseMove( + stepExcess, + endExcess, + 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/friendchat/FriendChatJoinLeaveDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/friendchat/FriendChatJoinLeaveDecoder.kt new file mode 100644 index 000000000..64957fcef --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/friendchat/FriendChatJoinLeaveDecoder.kt @@ -0,0 +1,27 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/friendchat/FriendChatKickDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/friendchat/FriendChatKickDecoder.kt new file mode 100644 index 000000000..250dd45f2 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/friendchat/FriendChatKickDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/friendchat/FriendChatSetRankDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/friendchat/FriendChatSetRankDecoder.kt new file mode 100644 index 000000000..7dd44d6aa --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/friendchat/FriendChatSetRankDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public class FriendChatSetRankDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.FRIENDCHAT_SETRANK + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): FriendChatSetRank { + val rank = buffer.g1Alt2() + val name = buffer.gjstr() + return FriendChatSetRank( + name, + rank, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc1V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc1V2Decoder.kt new file mode 100644 index 000000000..21177761c --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc1V2Decoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.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.OpLocV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpLoc1V2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPLOC1_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpLocV2 { + val controlKey = buffer.g1Alt3() == 1 + val z = buffer.g2Alt3() + val subop = buffer.g1() + val x = buffer.g2Alt3() + val id = buffer.g2Alt2() + return OpLocV2( + id, + x, + z, + controlKey, + 1, + subop, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc2V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc2V2Decoder.kt new file mode 100644 index 000000000..3a2d37dc7 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc2V2Decoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.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.OpLocV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpLoc2V2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPLOC2_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpLocV2 { + val z = buffer.g2() + val subop = buffer.g1Alt2() + val controlKey = buffer.g1Alt3() == 1 + val id = buffer.g2() + val x = buffer.g2Alt1() + return OpLocV2( + id, + x, + z, + controlKey, + 2, + subop, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc3V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc3V2Decoder.kt new file mode 100644 index 000000000..60b1f4fdc --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc3V2Decoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.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.OpLocV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpLoc3V2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPLOC3_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpLocV2 { + val subop = buffer.g1Alt3() + val controlKey = buffer.g1Alt3() == 1 + val z = buffer.g2Alt2() + val id = buffer.g2Alt3() + val x = buffer.g2() + return OpLocV2( + id, + x, + z, + controlKey, + 3, + subop, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc4V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc4V2Decoder.kt new file mode 100644 index 000000000..e588de394 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc4V2Decoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.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.OpLocV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpLoc4V2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPLOC4_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpLocV2 { + val controlKey = buffer.g1Alt1() == 1 + val id = buffer.g2Alt1() + val z = buffer.g2() + val subop = buffer.g1Alt1() + val x = buffer.g2() + return OpLocV2( + id, + x, + z, + controlKey, + 4, + subop, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc5V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc5V2Decoder.kt new file mode 100644 index 000000000..b51d45afe --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc5V2Decoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.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.OpLocV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpLoc5V2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPLOC5_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpLocV2 { + val z = buffer.g2Alt1() + val x = buffer.g2() + val subop = buffer.g1Alt1() + val controlKey = buffer.g1Alt3() == 1 + val id = buffer.g2Alt3() + return OpLocV2( + id, + x, + z, + controlKey, + 5, + subop, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc6Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc6Decoder.kt new file mode 100644 index 000000000..cde9bdd3a --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc6Decoder.kt @@ -0,0 +1,20 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLocTDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLocTDecoder.kt new file mode 100644 index 000000000..8667c5399 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLocTDecoder.kt @@ -0,0 +1,35 @@ +package net.rsprox.protocol.v241.game.incoming.decoder.codec.locs + +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.incoming.model.locs.OpLocT +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpLocTDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPLOCT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpLocT { + val controlKey = buffer.g1Alt1() == 1 + val x = buffer.g2() + val id = buffer.g2() + val selectedCombinedId = buffer.gCombinedId() + val selectedSub = buffer.g2Alt1() + val z = buffer.g2Alt1() + val selectedObj = buffer.g2Alt2() + return OpLocT( + id, + x, + z, + controlKey, + selectedCombinedId, + selectedSub, + selectedObj, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/messaging/MessagePrivateDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/messaging/MessagePrivateDecoder.kt new file mode 100644 index 000000000..8ce743739 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/messaging/MessagePrivateDecoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/messaging/MessagePublicDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/messaging/MessagePublicDecoder.kt new file mode 100644 index 000000000..76606baa0 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/messaging/MessagePublicDecoder.kt @@ -0,0 +1,66 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/ConnectionTelemetryDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/ConnectionTelemetryDecoder.kt new file mode 100644 index 000000000..7b599983f --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/ConnectionTelemetryDecoder.kt @@ -0,0 +1,42 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/DetectModifiedClientDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/DetectModifiedClientDecoder.kt new file mode 100644 index 000000000..1a8b60746 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/DetectModifiedClientDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/IdleDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/IdleDecoder.kt new file mode 100644 index 000000000..ad41784e8 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/IdleDecoder.kt @@ -0,0 +1,19 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public class IdleDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.IDLE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): Idle = Idle +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/MapBuildCompleteDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/MapBuildCompleteDecoder.kt new file mode 100644 index 000000000..dfe065990 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/MapBuildCompleteDecoder.kt @@ -0,0 +1,19 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/MembershipPromotionEligibilityDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/MembershipPromotionEligibilityDecoder.kt new file mode 100644 index 000000000..8859f9c8c --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/MembershipPromotionEligibilityDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/NoTimeoutDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/NoTimeoutDecoder.kt new file mode 100644 index 000000000..f4dc556ac --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/NoTimeoutDecoder.kt @@ -0,0 +1,19 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public class NoTimeoutDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.NO_TIMEOUT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): NoTimeout = NoTimeout +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/RSevenStatusDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/RSevenStatusDecoder.kt new file mode 100644 index 000000000..f2d5239a8 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/RSevenStatusDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.RSevenStatus +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public class RSevenStatusDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.RSEVEN_STATUS + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): RSevenStatus { + val packed = buffer.g1() + return RSevenStatus(packed) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/ReflectionCheckReplyDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/ReflectionCheckReplyDecoder.kt new file mode 100644 index 000000000..045388532 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/ReflectionCheckReplyDecoder.kt @@ -0,0 +1,135 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt new file mode 100644 index 000000000..02f8d5961 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public class SendPingReplyDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.SEND_PING_REPLY + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): SendPingReply { + val fps = buffer.g1Alt1() + val gcPercentTime = buffer.g1Alt2() + val value1 = buffer.g4Alt1() + val value2 = buffer.g4Alt3() + return SendPingReply( + fps, + gcPercentTime, + value1, + value2, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/SoundJingleEndDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/SoundJingleEndDecoder.kt new file mode 100644 index 000000000..e898c710b --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/SoundJingleEndDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/WindowStatusDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/WindowStatusDecoder.kt new file mode 100644 index 000000000..c0af3806f --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/WindowStatusDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/BugReportDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/BugReportDecoder.kt new file mode 100644 index 000000000..807bc1b96 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/BugReportDecoder.kt @@ -0,0 +1,32 @@ +package net.rsprox.protocol.v241.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.BugReport +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class BugReportDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.BUG_REPORT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): BugReport { + val description = buffer.gjstr() + val instructions = buffer.gjstr() + val type = buffer.g1Alt3() + 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/ClickWorldMapDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/ClickWorldMapDecoder.kt new file mode 100644 index 000000000..05b191a83 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/ClickWorldMapDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public class ClickWorldMapDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.CLICKWORLDMAP + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ClickWorldMap { + val packed = buffer.g4Alt1() + return ClickWorldMap(CoordGrid(packed)) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/ClientCheatDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/ClientCheatDecoder.kt new file mode 100644 index 000000000..26bdca6e9 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/ClientCheatDecoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public class ClientCheatDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.CLIENT_CHEAT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ClientCheat { + val command = buffer.gjstr() + val autocomplete = + if (!buffer.isReadable) { + null + } else { + buffer.g1() == 1 + } + return ClientCheat( + command, + autocomplete, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/CloseModalDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/CloseModalDecoder.kt new file mode 100644 index 000000000..2a3d0f50c --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/CloseModalDecoder.kt @@ -0,0 +1,19 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public class CloseModalDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.CLOSE_MODAL + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CloseModal = CloseModal +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/ExitFreecamDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/ExitFreecamDecoder.kt new file mode 100644 index 000000000..e6c1d3730 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/ExitFreecamDecoder.kt @@ -0,0 +1,19 @@ +package net.rsprox.protocol.v241.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.ExitFreecam +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public class ExitFreecamDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.EXIT_FREECAM + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ExitFreecam = ExitFreecam +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/HiscoreRequestDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/HiscoreRequestDecoder.kt new file mode 100644 index 000000000..31dc83f9a --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/HiscoreRequestDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/IfCrmViewOpDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/IfCrmViewOpDecoder.kt new file mode 100644 index 000000000..38e1ba6e3 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/IfCrmViewOpDecoder.kt @@ -0,0 +1,33 @@ +package net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.user + +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.incoming.model.misc.user.IfCrmViewOp +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class IfCrmViewOpDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.IF_CRMVIEW_OP + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfCrmViewOp { + val behaviour2 = buffer.g4() + val behaviour1 = buffer.g4Alt1() + val behaviour3 = buffer.g4Alt3() + val serverTarget = buffer.g4() + val sub = buffer.g2Alt2() + val combinedId = buffer.gCombinedId() + return IfCrmViewOp( + serverTarget, + combinedId, + sub, + behaviour1, + behaviour2, + behaviour3, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/MoveGameClickDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/MoveGameClickDecoder.kt new file mode 100644 index 000000000..c952cb398 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/MoveGameClickDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public class MoveGameClickDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.MOVE_GAMECLICK + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MoveGameClick { + val z = buffer.g2Alt3() + val keyCombination = buffer.g1Alt2() + val x = buffer.g2Alt3() + return MoveGameClick( + x, + z, + keyCombination, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/MoveMinimapClickDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/MoveMinimapClickDecoder.kt new file mode 100644 index 000000000..c20d3ad1e --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/MoveMinimapClickDecoder.kt @@ -0,0 +1,59 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public 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.g2Alt3() + val keyCombination = buffer.g1Alt2() + val x = buffer.g2Alt3() + + // 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/SendSnapshotDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/SendSnapshotDecoder.kt new file mode 100644 index 000000000..63fcfb387 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/SendSnapshotDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/SetChatFilterSettingsDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/SetChatFilterSettingsDecoder.kt new file mode 100644 index 000000000..46cf00166 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/SetChatFilterSettingsDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/SetHeadingDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/SetHeadingDecoder.kt new file mode 100644 index 000000000..d64b2956f --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/SetHeadingDecoder.kt @@ -0,0 +1,20 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/TeleportDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/TeleportDecoder.kt new file mode 100644 index 000000000..414a94362 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/TeleportDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public class TeleportDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.TELEPORT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): Teleport { + val level = buffer.g1Alt3() + val x = buffer.g2Alt3() + val oculusSyncValue = buffer.g4() + val z = buffer.g2() + return Teleport( + oculusSyncValue, + x, + z, + level, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc1V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc1V2Decoder.kt new file mode 100644 index 000000000..1d1632358 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc1V2Decoder.kt @@ -0,0 +1,27 @@ +package net.rsprox.protocol.v241.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.OpNpcV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpNpc1V2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPNPC1_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpNpcV2 { + val index = buffer.g2Alt1() + val subop = buffer.g1() + val controlKey = buffer.g1Alt1() == 1 + return OpNpcV2( + index, + controlKey, + 1, + subop, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc2V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc2V2Decoder.kt new file mode 100644 index 000000000..40b207747 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc2V2Decoder.kt @@ -0,0 +1,27 @@ +package net.rsprox.protocol.v241.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.OpNpcV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpNpc2V2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPNPC2_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpNpcV2 { + val index = buffer.g2Alt1() + val subop = buffer.g1Alt1() + val controlKey = buffer.g1Alt3() == 1 + return OpNpcV2( + index, + controlKey, + 2, + subop, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc3V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc3V2Decoder.kt new file mode 100644 index 000000000..ed3ab9df6 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc3V2Decoder.kt @@ -0,0 +1,27 @@ +package net.rsprox.protocol.v241.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.OpNpcV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpNpc3V2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPNPC3_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpNpcV2 { + val index = buffer.g2Alt1() + val controlKey = buffer.g1Alt3() == 1 + val subop = buffer.g1Alt2() + return OpNpcV2( + index, + controlKey, + 3, + subop, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc4V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc4V2Decoder.kt new file mode 100644 index 000000000..737f5dfaa --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc4V2Decoder.kt @@ -0,0 +1,27 @@ +package net.rsprox.protocol.v241.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.OpNpcV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpNpc4V2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPNPC4_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpNpcV2 { + val controlKey = buffer.g1Alt3() == 1 + val subop = buffer.g1() + val index = buffer.g2Alt2() + return OpNpcV2( + index, + controlKey, + 4, + subop, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc5V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc5V2Decoder.kt new file mode 100644 index 000000000..78c5addbf --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc5V2Decoder.kt @@ -0,0 +1,27 @@ +package net.rsprox.protocol.v241.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.OpNpcV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpNpc5V2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPNPC5_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpNpcV2 { + val subop = buffer.g1() + val controlKey = buffer.g1Alt2() == 1 + val index = buffer.g2() + return OpNpcV2( + index, + controlKey, + 5, + subop, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc6Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc6Decoder.kt new file mode 100644 index 000000000..a91236595 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc6Decoder.kt @@ -0,0 +1,20 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public class OpNpc6Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPNPC6 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpNpc6 { + val id = buffer.g2Alt2() + return OpNpc6(id) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpcTDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpcTDecoder.kt new file mode 100644 index 000000000..2ef62ccea --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpcTDecoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public class OpNpcTDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPNPCT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpNpcT { + val controlKey = buffer.g1Alt3() == 1 + val selectedCombinedId = buffer.gCombinedIdAlt1() + val selectedSub = buffer.g2() + val selectedObj = buffer.g2Alt3() + val index = buffer.g2Alt2() + return OpNpcT( + index, + controlKey, + selectedCombinedId, + selectedSub, + selectedObj, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj1V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj1V2Decoder.kt new file mode 100644 index 000000000..911f8d6a3 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj1V2Decoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.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.OpObjV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpObj1V2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPOBJ1_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpObjV2 { + val subop = buffer.g1Alt2() + val x = buffer.g2Alt2() + val z = buffer.g2Alt3() + val controlKey = buffer.g1Alt3() == 1 + val id = buffer.g2() + return OpObjV2( + id, + x, + z, + controlKey, + 1, + subop, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj2V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj2V2Decoder.kt new file mode 100644 index 000000000..e78903fbd --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj2V2Decoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.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.OpObjV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpObj2V2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPOBJ2_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpObjV2 { + val subop = buffer.g1Alt2() + val z = buffer.g2() + val id = buffer.g2Alt2() + val x = buffer.g2Alt2() + val controlKey = buffer.g1Alt1() == 1 + return OpObjV2( + id, + x, + z, + controlKey, + 2, + subop, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj3V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj3V2Decoder.kt new file mode 100644 index 000000000..f537a1a36 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj3V2Decoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.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.OpObjV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpObj3V2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPOBJ3_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpObjV2 { + val x = buffer.g2Alt2() + val controlKey = buffer.g1Alt2() == 1 + val subop = buffer.g1() + val id = buffer.g2Alt1() + val z = buffer.g2() + return OpObjV2( + id, + x, + z, + controlKey, + 3, + subop, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj4V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj4V2Decoder.kt new file mode 100644 index 000000000..a50c330d0 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj4V2Decoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.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.OpObjV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpObj4V2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPOBJ4_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpObjV2 { + val subop = buffer.g1Alt2() + val controlKey = buffer.g1Alt3() == 1 + val z = buffer.g2Alt3() + val id = buffer.g2Alt2() + val x = buffer.g2Alt1() + return OpObjV2( + id, + x, + z, + controlKey, + 4, + subop, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj5V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj5V2Decoder.kt new file mode 100644 index 000000000..6fb9c7acf --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj5V2Decoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.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.OpObjV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpObj5V2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPOBJ5_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpObjV2 { + val id = buffer.g2Alt3() + val subop = buffer.g1() + val x = buffer.g2Alt1() + val controlKey = buffer.g1Alt3() == 1 + val z = buffer.g2Alt2() + return OpObjV2( + id, + x, + z, + controlKey, + 5, + subop, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj6Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj6Decoder.kt new file mode 100644 index 000000000..da27032ca --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj6Decoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public class OpObj6Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPOBJ6 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpObj6 { + val id = buffer.g2Alt1() + val z = buffer.g2Alt3() + val x = buffer.g2() + return OpObj6( + id, + x, + z, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObjTDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObjTDecoder.kt new file mode 100644 index 000000000..13dafdc63 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObjTDecoder.kt @@ -0,0 +1,35 @@ +package net.rsprox.protocol.v241.game.incoming.decoder.codec.objs + +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.incoming.model.objs.OpObjT +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpObjTDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPOBJT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpObjT { + val x = buffer.g2() + val selectedCombinedId = buffer.gCombinedId() + val controlKey = buffer.g1Alt3() == 1 + val selectedSub = buffer.g2Alt1() + val z = buffer.g2Alt3() + val id = buffer.g2Alt3() + val selectedObj = buffer.g2() + return OpObjT( + id, + x, + z, + controlKey, + selectedCombinedId, + selectedSub, + selectedObj, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer1Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer1Decoder.kt new file mode 100644 index 000000000..25c0242cd --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer1Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +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.g2() + return OpPlayer( + index, + controlKey, + 1, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer2Decoder.kt new file mode 100644 index 000000000..f71d17042 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer2Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public class OpPlayer2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPPLAYER2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpPlayer { + val controlKey = buffer.g1Alt3() == 1 + val index = buffer.g2Alt1() + return OpPlayer( + index, + controlKey, + 2, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer3Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer3Decoder.kt new file mode 100644 index 000000000..ee5a44542 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer3Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public class OpPlayer3Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPPLAYER3 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpPlayer { + val index = buffer.g2Alt2() + val controlKey = buffer.g1Alt1() == 1 + return OpPlayer( + index, + controlKey, + 3, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer4Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer4Decoder.kt new file mode 100644 index 000000000..224dd8b6a --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer4Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public class OpPlayer4Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPPLAYER4 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpPlayer { + val controlKey = buffer.g1Alt3() == 1 + val index = buffer.g2() + return OpPlayer( + index, + controlKey, + 4, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer5Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer5Decoder.kt new file mode 100644 index 000000000..103464b94 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer5Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public class OpPlayer5Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPPLAYER5 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpPlayer { + val index = buffer.g2Alt2() + val controlKey = buffer.g1Alt1() == 1 + return OpPlayer( + index, + controlKey, + 5, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer6Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer6Decoder.kt new file mode 100644 index 000000000..b4e930c95 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer6Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public class OpPlayer6Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPPLAYER6 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpPlayer { + val controlKey = buffer.g1Alt1() == 1 + val index = buffer.g2Alt1() + return OpPlayer( + index, + controlKey, + 6, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer7Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer7Decoder.kt new file mode 100644 index 000000000..782903bcf --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer7Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public class OpPlayer7Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPPLAYER7 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpPlayer { + val controlKey = buffer.g1Alt1() == 1 + val index = buffer.g2Alt1() + return OpPlayer( + index, + controlKey, + 7, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer8Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer8Decoder.kt new file mode 100644 index 000000000..555442215 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer8Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public class OpPlayer8Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPPLAYER8 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpPlayer { + val index = buffer.g2Alt2() + val controlKey = buffer.g1() == 1 + return OpPlayer( + index, + controlKey, + 8, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayerTDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayerTDecoder.kt new file mode 100644 index 000000000..33b7c854b --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayerTDecoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +public class OpPlayerTDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPPLAYERT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpPlayerT { + val controlKey = buffer.g1Alt2() == 1 + val selectedSub = buffer.g2Alt1() + val selectedCombinedId = buffer.gCombinedIdAlt2() + val selectedObj = buffer.g2Alt1() + val index = buffer.g2Alt3() + return OpPlayerT( + index, + controlKey, + selectedCombinedId, + selectedSub, + selectedObj, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePCountDialogDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePCountDialogDecoder.kt new file mode 100644 index 000000000..6faaffabe --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePCountDialogDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePCountDialogLongDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePCountDialogLongDecoder.kt new file mode 100644 index 000000000..b34545845 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePCountDialogLongDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.ResumePCountDialogLong +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public class ResumePCountDialogLongDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.RESUME_P_COUNTDIALOG_LONG + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ResumePCountDialogLong { + val count = buffer.g8() + return ResumePCountDialogLong(count) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePNameDialogDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePNameDialogDecoder.kt new file mode 100644 index 000000000..ba3c0be0b --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePNameDialogDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePObjDialogDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePObjDialogDecoder.kt new file mode 100644 index 000000000..89d321c1c --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePObjDialogDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePStringDialogDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePStringDialogDecoder.kt new file mode 100644 index 000000000..91a8004c1 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePStringDialogDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePauseButtonDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePauseButtonDecoder.kt new file mode 100644 index 000000000..2f518df0a --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePauseButtonDecoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v241.game.incoming.decoder.codec.resumed + +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.incoming.model.resumed.ResumePauseButton +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class ResumePauseButtonDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.RESUME_PAUSEBUTTON + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ResumePauseButton { + val combinedId = buffer.gCombinedId() + val sub = buffer.g2Alt3() + return ResumePauseButton( + combinedId, + sub, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/social/FriendListAddDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/social/FriendListAddDecoder.kt new file mode 100644 index 000000000..22fa36bf2 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/social/FriendListAddDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/social/FriendListDelDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/social/FriendListDelDecoder.kt new file mode 100644 index 000000000..3ee9d3b75 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/social/FriendListDelDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/social/IgnoreListAddDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/social/IgnoreListAddDecoder.kt new file mode 100644 index 000000000..da99be8cb --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/social/IgnoreListAddDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/social/IgnoreListDelDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/social/IgnoreListDelDecoder.kt new file mode 100644 index 000000000..e10faf18a --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/social/IgnoreListDelDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.prot.GameClientProt + +@Consistent +public 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity1Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity1Decoder.kt new file mode 100644 index 000000000..269b95a06 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity1Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v241.game.incoming.decoder.codec.worldentities + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.worldentities.OpWorldEntity +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpWorldEntity1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPWORLDENTITY1 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpWorldEntity { + val index = buffer.g2() + val controlKey = buffer.g1Alt2() == 1 + return OpWorldEntity( + index, + controlKey, + 1, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity2Decoder.kt new file mode 100644 index 000000000..ba15ca0e7 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity2Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v241.game.incoming.decoder.codec.worldentities + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.worldentities.OpWorldEntity +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpWorldEntity2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPWORLDENTITY2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpWorldEntity { + val controlKey = buffer.g1Alt1() == 1 + val index = buffer.g2() + return OpWorldEntity( + index, + controlKey, + 2, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity3Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity3Decoder.kt new file mode 100644 index 000000000..913d795e8 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity3Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v241.game.incoming.decoder.codec.worldentities + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.worldentities.OpWorldEntity +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpWorldEntity3Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPWORLDENTITY3 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpWorldEntity { + val index = buffer.g2() + val controlKey = buffer.g1() == 1 + return OpWorldEntity( + index, + controlKey, + 3, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity4Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity4Decoder.kt new file mode 100644 index 000000000..0d49f0c91 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity4Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v241.game.incoming.decoder.codec.worldentities + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.worldentities.OpWorldEntity +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpWorldEntity4Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPWORLDENTITY4 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpWorldEntity { + val index = buffer.g2() + val controlKey = buffer.g1Alt2() == 1 + return OpWorldEntity( + index, + controlKey, + 4, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity5Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity5Decoder.kt new file mode 100644 index 000000000..84fe25362 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity5Decoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v241.game.incoming.decoder.codec.worldentities + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.worldentities.OpWorldEntity +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpWorldEntity5Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPWORLDENTITY5 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpWorldEntity { + val controlKey = buffer.g1Alt1() == 1 + val index = buffer.g2Alt3() + return OpWorldEntity( + index, + controlKey, + 5, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity6Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity6Decoder.kt new file mode 100644 index 000000000..f0fe9d429 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity6Decoder.kt @@ -0,0 +1,20 @@ +package net.rsprox.protocol.v241.game.incoming.decoder.codec.worldentities + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.incoming.model.worldentities.OpWorldEntity6 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpWorldEntity6Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPWORLDENTITY6 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpWorldEntity6 { + val id = buffer.g2Alt2() + return OpWorldEntity6(id) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntityTDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntityTDecoder.kt new file mode 100644 index 000000000..b81091910 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntityTDecoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.game.incoming.decoder.codec.worldentities + +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.incoming.model.worldentities.OpWorldEntityT +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt + +public class OpWorldEntityTDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.OPWORLDENTITYT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): OpWorldEntityT { + val index = buffer.g2Alt3() + val selectedSub = buffer.g2Alt2() + val selectedObj = buffer.g2() + val selectedCombinedId = buffer.gCombinedId() + val controlKey = buffer.g1Alt3() == 1 + return OpWorldEntityT( + index, + controlKey, + selectedCombinedId, + selectedSub, + selectedObj, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt new file mode 100644 index 000000000..3883c4b15 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt @@ -0,0 +1,201 @@ +package net.rsprox.protocol.v241.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.v241.game.incoming.decoder.codec.buttons.* +import net.rsprox.protocol.v241.game.incoming.decoder.codec.clan.AffinedClanSettingsAddBannedFromChannelDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.clan.AffinedClanSettingsSetMutedFromChannelDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.clan.ClanChannelFullRequestDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.clan.ClanChannelKickUserDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.clan.ClanSettingsFullRequestDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.events.* +import net.rsprox.protocol.v241.game.incoming.decoder.codec.friendchat.FriendChatJoinLeaveDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.friendchat.FriendChatKickDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.friendchat.FriendChatSetRankDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.locs.OpLoc1V2Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.locs.OpLoc2V2Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.locs.OpLoc3V2Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.locs.OpLoc4V2Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.locs.OpLoc5V2Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.locs.OpLoc6Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.locs.OpLocTDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.messaging.MessagePrivateDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.messaging.MessagePublicDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.client.* +import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.client.ReflectionCheckReplyDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.user.BugReportDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.user.ClickWorldMapDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.user.ClientCheatDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.user.CloseModalDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.user.ExitFreecamDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.user.HiscoreRequestDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.user.IfCrmViewOpDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.user.MoveGameClickDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.user.MoveMinimapClickDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.user.SendSnapshotDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.user.SetChatFilterSettingsDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.user.SetHeadingDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.user.TeleportDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.npcs.OpNpc1V2Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.npcs.OpNpc2V2Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.npcs.OpNpc3V2Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.npcs.OpNpc4V2Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.npcs.OpNpc5V2Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.npcs.OpNpc6Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.npcs.OpNpcTDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.objs.OpObj1V2Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.objs.OpObj2V2Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.objs.OpObj3V2Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.objs.OpObj4V2Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.objs.OpObj5V2Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.objs.OpObj6Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.objs.OpObjTDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.players.OpPlayer1Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.players.OpPlayer2Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.players.OpPlayer3Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.players.OpPlayer4Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.players.OpPlayer5Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.players.OpPlayer6Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.players.OpPlayer7Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.players.OpPlayer8Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.players.OpPlayerTDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.resumed.ResumePCountDialogDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.resumed.ResumePCountDialogLongDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.resumed.ResumePNameDialogDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.resumed.ResumePObjDialogDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.resumed.ResumePStringDialogDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.resumed.ResumePauseButtonDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.social.FriendListAddDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.social.FriendListDelDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.social.IgnoreListAddDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.social.IgnoreListDelDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.worldentities.OpWorldEntity1Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.worldentities.OpWorldEntity2Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.worldentities.OpWorldEntity3Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.worldentities.OpWorldEntity4Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.worldentities.OpWorldEntity5Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.worldentities.OpWorldEntity6Decoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.worldentities.OpWorldEntityTDecoder + +internal object ClientMessageDecoderRepository { + @ExperimentalStdlibApi + fun build(huffmanCodec: HuffmanCodec): MessageDecoderRepository { + val protRepository = ProtRepository.of() + val builder = + MessageDecoderRepositoryBuilder( + protRepository, + ).apply { + bind(If1ButtonDecoder()) + bind(IfButtonXDecoder()) + bind(IfSubOpDecoder()) + bind(IfButtonDDecoder()) + bind(IfButtonTDecoder()) + bind(IfScriptTriggerDecoder()) + + bind(OpNpc1V2Decoder()) + bind(OpNpc2V2Decoder()) + bind(OpNpc3V2Decoder()) + bind(OpNpc4V2Decoder()) + bind(OpNpc5V2Decoder()) + bind(OpNpc6Decoder()) + bind(OpNpcTDecoder()) + + bind(OpLoc1V2Decoder()) + bind(OpLoc2V2Decoder()) + bind(OpLoc3V2Decoder()) + bind(OpLoc4V2Decoder()) + bind(OpLoc5V2Decoder()) + bind(OpLoc6Decoder()) + bind(OpLocTDecoder()) + + bind(OpObj1V2Decoder()) + bind(OpObj2V2Decoder()) + bind(OpObj3V2Decoder()) + bind(OpObj4V2Decoder()) + bind(OpObj5V2Decoder()) + bind(OpObj6Decoder()) + bind(OpObjTDecoder()) + + bind(OpPlayer1Decoder()) + bind(OpPlayer2Decoder()) + bind(OpPlayer3Decoder()) + bind(OpPlayer4Decoder()) + bind(OpPlayer5Decoder()) + bind(OpPlayer6Decoder()) + bind(OpPlayer7Decoder()) + bind(OpPlayer8Decoder()) + bind(OpPlayerTDecoder()) + + bind(OpWorldEntity1Decoder()) + bind(OpWorldEntity2Decoder()) + bind(OpWorldEntity3Decoder()) + bind(OpWorldEntity4Decoder()) + bind(OpWorldEntity5Decoder()) + bind(OpWorldEntity6Decoder()) + bind(OpWorldEntityTDecoder()) + + bind(EventAppletFocusDecoder()) + bind(EventCameraPositionDecoder()) + bind(EventKeyboardDecoder()) + bind(EventMouseScrollDecoder()) + bind(EventMouseMoveDecoder()) + bind(EventNativeMouseMoveDecoder()) + bind(EventMouseClickV1Decoder()) + bind(EventMouseClickV2Decoder()) + + bind(ResumePauseButtonDecoder()) + bind(ResumePNameDialogDecoder()) + bind(ResumePStringDialogDecoder()) + bind(ResumePCountDialogDecoder()) + bind(ResumePCountDialogLongDecoder()) + 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(ExitFreecamDecoder()) + bind(CloseModalDecoder()) + bind(TeleportDecoder()) + bind(BugReportDecoder()) + bind(SendSnapshotDecoder()) + bind(HiscoreRequestDecoder()) + bind(IfCrmViewOpDecoder()) + + bind(ConnectionTelemetryDecoder()) + bind(SendPingReplyDecoder()) + bind(DetectModifiedClientDecoder()) + bind(ReflectionCheckReplyDecoder()) + bind(NoTimeoutDecoder()) + bind(IdleDecoder()) + bind(MapBuildCompleteDecoder()) + bind(MembershipPromotionEligibilityDecoder()) + bind(SoundJingleEndDecoder()) + bind(WindowStatusDecoder()) + bind(RSevenStatusDecoder()) + } + return builder.build() + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProt.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProt.kt new file mode 100644 index 000000000..9a50e28ec --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProt.kt @@ -0,0 +1,170 @@ +package net.rsprox.protocol.v241.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_BUTTONX(GameClientProtId.IF_BUTTONX, 9), + IF_SUBOP(GameClientProtId.IF_SUBOP, 10), + IF_BUTTOND(GameClientProtId.IF_BUTTOND, 16), + IF_BUTTONT(GameClientProtId.IF_BUTTONT, 16), + IF_SCRIPT_TRIGGER(GameClientProtId.IF_SCRIPT_TRIGGER, Prot.VAR_SHORT), + + // Op npc + OPNPC1_V2(GameClientProtId.OPNPC1_V2, 4), + OPNPC2_V2(GameClientProtId.OPNPC2_V2, 4), + OPNPC3_V2(GameClientProtId.OPNPC3_V2, 4), + OPNPC4_V2(GameClientProtId.OPNPC4_V2, 4), + OPNPC5_V2(GameClientProtId.OPNPC5_V2, 4), + OPNPC6(GameClientProtId.OPNPC6, 2), + OPNPCT(GameClientProtId.OPNPCT, 11), + + @Deprecated( + "Deprecated since inventory rework in revision 204, " + + "all usagesgo through OPNPCT now.", + replaceWith = ReplaceWith("OPNPCT"), + ) + OPNPCU(GameClientProtId.OPNPCU, 11), + + // Op loc + OPLOC1_V2(GameClientProtId.OPLOC1_V2, 8), + OPLOC2_V2(GameClientProtId.OPLOC2_V2, 8), + OPLOC3_V2(GameClientProtId.OPLOC3_V2, 8), + OPLOC4_V2(GameClientProtId.OPLOC4_V2, 8), + OPLOC5_V2(GameClientProtId.OPLOC5_V2, 8), + OPLOC6(GameClientProtId.OPLOC6, 2), + OPLOCT(GameClientProtId.OPLOCT, 15), + + @Deprecated( + "Deprecated since inventory rework in revision 204, " + + "all usagesgo through OPLOCT now.", + replaceWith = ReplaceWith("OPLOCT"), + ) + OPLOCU(GameClientProtId.OPLOCU, 15), + + // Op obj + OPOBJ1_V2(GameClientProtId.OPOBJ1_V2, 8), + OPOBJ2_V2(GameClientProtId.OPOBJ2_V2, 8), + OPOBJ3_V2(GameClientProtId.OPOBJ3_V2, 8), + OPOBJ4_V2(GameClientProtId.OPOBJ4_V2, 8), + OPOBJ5_V2(GameClientProtId.OPOBJ5_V2, 8), + OPOBJ6(GameClientProtId.OPOBJ6, 6), + OPOBJT(GameClientProtId.OPOBJT, 15), + + @Deprecated( + "Deprecated since inventory rework in revision 204, " + + "all usagesgo 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, " + + "all usagesgo through OPPLAYERT now.", + replaceWith = ReplaceWith("OPPLAYERT"), + ) + OPPLAYERU(GameClientProtId.OPPLAYERU, 11), + + OPWORLDENTITY1(GameClientProtId.OPWORLDENTITY1, 3), + OPWORLDENTITY2(GameClientProtId.OPWORLDENTITY2, 3), + OPWORLDENTITY3(GameClientProtId.OPWORLDENTITY3, 3), + OPWORLDENTITY4(GameClientProtId.OPWORLDENTITY4, 3), + OPWORLDENTITY5(GameClientProtId.OPWORLDENTITY5, 3), + OPWORLDENTITY6(GameClientProtId.OPWORLDENTITY6, 2), + OPWORLDENTITYT(GameClientProtId.OPWORLDENTITYT, 11), + + @Deprecated( + "Deprecated since inventory rework in revision 204, " + + "all usages go through OPWORLDENTITYT now.", + replaceWith = ReplaceWith("OPWORLDENTITYT"), + ) + OPWORLDENTITYU(GameClientProtId.OPWORLDENTITYU, 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_V1(GameClientProtId.EVENT_MOUSE_CLICK_V1, 6), + EVENT_MOUSE_CLICK_V2(GameClientProtId.EVENT_MOUSE_CLICK_V2, 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_COUNTDIALOG_LONG(GameClientProtId.RESUME_P_COUNTDIALOG_LONG, 8), + 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), + EXIT_FREECAM(GameClientProtId.EXIT_FREECAM, 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_OP(GameClientProtId.IF_CRMVIEW_OP, 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), + RSEVEN_STATUS(GameClientProtId.RSEVEN_STATUS, 1), +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProtId.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProtId.kt new file mode 100644 index 000000000..6b030ebd8 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProtId.kt @@ -0,0 +1,105 @@ +package net.rsprox.protocol.v241.game.incoming.decoder.prot + +internal object GameClientProtId { + const val EVENT_MOUSE_CLICK_V1 = 0 + const val IF_BUTTONX = 1 + const val OPWORLDENTITY4 = 2 + const val RESUME_P_OBJDIALOG = 3 + const val OPPLAYER6 = 4 + const val IDLE = 7 + const val OPLOC3_V2 = 8 + const val OPOBJ6 = 9 + const val OPWORLDENTITYT = 10 + const val IF_BUTTON = 11 + const val REFLECTION_CHECK_REPLY = 12 + const val TELEPORT = 13 + const val BUG_REPORT = 14 + const val IF_CRMVIEW_OP = 15 + const val SET_CHATFILTERSETTINGS = 16 + const val AFFINEDCLANSETTINGS_ADDBANNED_FROMCHANNEL = 17 + const val OPPLAYER2 = 21 + const val OPOBJ3_V2 = 22 + const val OPWORLDENTITY6 = 25 + const val MAP_BUILD_COMPLETE = 27 + const val CONNECTION_TELEMETRY = 29 + const val EVENT_APPLET_FOCUS = 30 + const val SEND_PING_REPLY = 32 + const val CLANCHANNEL_FULL_REQUEST = 33 + const val OPNPC4_V2 = 35 + const val OPPLAYER3 = 36 + const val CLANCHANNEL_KICKUSER = 37 + const val OPOBJT = 38 + const val IF_BUTTOND = 39 + const val EVENT_MOUSE_CLICK_V2 = 40 + const val OPPLAYER8 = 41 + const val OPPLAYERU = 42 + const val OPNPC3_V2 = 43 + const val WINDOW_STATUS = 44 + const val OPPLAYERT = 45 + const val SOUND_JINGLEEND = 46 + const val EVENT_KEYBOARD = 47 + const val OPWORLDENTITY2 = 48 + const val OPWORLDENTITY3 = 49 + const val OPPLAYER7 = 50 + const val FRIENDCHAT_KICK = 51 + const val OPPLAYER5 = 52 + const val RESUME_P_STRINGDIALOG = 54 + const val EVENT_CAMERA_POSITION = 55 + const val MESSAGE_PUBLIC = 56 + const val OPPLAYER1 = 57 + const val IF_SCRIPT_TRIGGER = 58 + const val OPNPC1_V2 = 59 + const val AFFINEDCLANSETTINGS_SETMUTED_FROMCHANNEL = 60 + const val MOVE_MINIMAPCLICK = 61 + const val RESUME_P_COUNTDIALOG = 62 + const val OPNPCT = 63 + const val OPPLAYER4 = 64 + const val OPOBJ4_V2 = 65 + const val FRIENDCHAT_SETRANK = 66 + const val FRIENDLIST_ADD = 67 + const val OPLOCT = 68 + const val OPLOC4_V2 = 69 + const val RESUME_P_NAMEDIALOG = 70 + const val EXIT_FREECAM = 71 + const val OPNPC5_V2 = 73 + const val OPLOC1_V2 = 74 + const val OPOBJ5_V2 = 75 + const val MEMBERSHIP_PROMOTION_ELIGIBILITY = 76 + const val OPLOC5_V2 = 77 + const val CLICKWORLDMAP = 78 + const val CLIENT_CHEAT = 79 + const val IF_BUTTONT = 80 + const val IGNORELIST_ADD = 81 + const val RESUME_PAUSEBUTTON = 82 + const val EVENT_MOUSE_SCROLL = 83 + const val OPOBJU = 84 + const val OPWORLDENTITYU = 85 + const val IGNORELIST_DEL = 86 + const val OPNPC2_V2 = 87 + const val EVENT_NATIVE_MOUSE_MOVE = 88 + const val RSEVEN_STATUS = 89 + const val OPLOC2_V2 = 90 + const val UPDATE_PLAYER_MODEL_V2 = 91 + const val SEND_SNAPSHOT = 92 + const val OPWORLDENTITY5 = 93 + const val IF_SUBOP = 95 + const val OPWORLDENTITY1 = 96 + const val FRIENDCHAT_JOIN_LEAVE = 97 + const val CLOSE_MODAL = 98 + const val NO_TIMEOUT = 99 + const val CLANSETTINGS_FULL_REQUEST = 100 + const val OPNPC6 = 101 + const val MOVE_GAMECLICK = 102 + const val DETECT_MODIFIED_CLIENT = 103 + const val OPLOC6 = 105 + const val OPNPCU = 107 + const val MESSAGE_PRIVATE = 108 + const val SET_HEADING = 109 + const val HISCORE_REQUEST = 110 + const val RESUME_P_COUNTDIALOG_LONG = 111 + const val OPOBJ1_V2 = 112 + const val OPOBJ2_V2 = 113 + const val EVENT_MOUSE_MOVE = 114 + const val FRIENDLIST_DEL = 115 + const val OPLOCU = 116 +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtCyclesDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtCyclesDecoder.kt new file mode 100644 index 000000000..7a286131c --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtCyclesDecoder.kt @@ -0,0 +1,32 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamLookAtCycles +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class CamLookAtCyclesDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_LOOKAT_CYCLES + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamLookAtCycles { + val x = buffer.g2Alt2() + val cycles = buffer.g2Alt2() + val easing = buffer.g1Alt3() + val z = buffer.g2() + val heightRelative = buffer.g1Alt3() == 1 + val height = buffer.g2sAlt1() + return CamLookAtCycles( + x, + z, + height, + cycles, + easing, + heightRelative, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV2Decoder.kt new file mode 100644 index 000000000..43dedad58 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV2Decoder.kt @@ -0,0 +1,30 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamLookAtV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class CamLookAtV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_LOOKAT_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamLookAtV2 { + val rate2 = buffer.g1Alt3() + val height = buffer.g2() + val z = buffer.g2() + val rate = buffer.g1Alt3() + val x = buffer.g2Alt1() + return CamLookAtV2( + x, + z, + height, + rate, + rate2, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV3Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV3Decoder.kt new file mode 100644 index 000000000..81dae3fbb --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV3Decoder.kt @@ -0,0 +1,32 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamLookAtV3 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class CamLookAtV3Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_LOOKAT_V3 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamLookAtV3 { + val rate = buffer.g1Alt2() + val height = buffer.g2s() + val x = buffer.g2Alt3() + val z = buffer.g2() + val rate2 = buffer.g1Alt2() + val heightRelative = buffer.g1Alt3() == 1 + return CamLookAtV3( + x, + z, + height, + rate, + rate2, + heightRelative, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamModeDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamModeDecoder.kt new file mode 100644 index 000000000..c598c6b3f --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamModeDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToArcV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToArcV2Decoder.kt new file mode 100644 index 000000000..751f53998 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToArcV2Decoder.kt @@ -0,0 +1,36 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamMoveToArcV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class CamMoveToArcV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_MOVETO_ARC_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamMoveToArcV2 { + val destinationX = buffer.g2Alt3() + val centerZ = buffer.g2Alt3() + val easing = buffer.g1Alt3() + val centerX = buffer.g2Alt2() + val cycles = buffer.g2Alt1() + val height = buffer.g2Alt2() + val destinationZ = buffer.g2() + val ignoreTerrain = buffer.g1Alt1() == 1 + return CamMoveToArcV2( + centerX, + centerZ, + destinationX, + destinationZ, + height, + cycles, + ignoreTerrain, + easing, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToArcV3Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToArcV3Decoder.kt new file mode 100644 index 000000000..4c301ba8c --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToArcV3Decoder.kt @@ -0,0 +1,38 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamMoveToArcV3 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class CamMoveToArcV3Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_MOVETO_ARC_V3 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamMoveToArcV3 { + val centerZ = buffer.g2Alt2() + val heightRelative = buffer.g1Alt1() == 1 + val height = buffer.g2sAlt3() + val easing = buffer.g1Alt2() + val destinationZ = buffer.g2Alt3() + val cycles = buffer.g2Alt2() + val ignoreTerrain = buffer.g1() == 1 + val centerX = buffer.g2Alt3() + val destinationX = buffer.g2Alt1() + return CamMoveToArcV3( + centerX, + centerZ, + destinationX, + destinationZ, + height, + cycles, + ignoreTerrain, + easing, + heightRelative, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToCyclesV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToCyclesV2Decoder.kt new file mode 100644 index 000000000..c490f45a7 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToCyclesV2Decoder.kt @@ -0,0 +1,32 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamMoveToCyclesV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class CamMoveToCyclesV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_MOVETO_CYCLES_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamMoveToCyclesV2 { + val ignoreTerrain = buffer.g1() == 1 + val z = buffer.g2Alt3() + val cycles = buffer.g2Alt2() + val height = buffer.g2Alt1() + val easing = buffer.g1() + val x = buffer.g2() + return CamMoveToCyclesV2( + x, + z, + height, + cycles, + ignoreTerrain, + easing, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToCyclesV3Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToCyclesV3Decoder.kt new file mode 100644 index 000000000..845e26c22 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToCyclesV3Decoder.kt @@ -0,0 +1,34 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamMoveToCyclesV3 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class CamMoveToCyclesV3Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_MOVETO_CYCLES_V3 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamMoveToCyclesV3 { + val ignoreTerrain = buffer.g1Alt2() == 1 + val easing = buffer.g1Alt1() + val heightRelative = buffer.g1() == 1 + val height = buffer.g2sAlt3() + val z = buffer.g2Alt2() + val cycles = buffer.g2Alt1() + val x = buffer.g2Alt3() + return CamMoveToCyclesV3( + x, + z, + height, + cycles, + ignoreTerrain, + easing, + heightRelative, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToV2Decoder.kt new file mode 100644 index 000000000..fc805ffc6 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToV2Decoder.kt @@ -0,0 +1,30 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamMoveToV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class CamMoveToV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_MOVETO_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamMoveToV2 { + val z = buffer.g2() + val rate2 = buffer.g1Alt1() + val height = buffer.g2() + val x = buffer.g2Alt3() + val rate = buffer.g1Alt3() + return CamMoveToV2( + x, + z, + height, + rate, + rate2, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToV3Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToV3Decoder.kt new file mode 100644 index 000000000..cf2199657 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToV3Decoder.kt @@ -0,0 +1,32 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamMoveToV3 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class CamMoveToV3Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_MOVETO_V3 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamMoveToV3 { + val rate = buffer.g1Alt2() + val z = buffer.g2() + val rate2 = buffer.g1Alt1() + val height = buffer.g2sAlt1() + val x = buffer.g2Alt3() + val heightRelative = buffer.g1() == 1 + return CamMoveToV3( + x, + z, + height, + rate, + rate2, + heightRelative, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamResetDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamResetDecoder.kt new file mode 100644 index 000000000..5bed44aa6 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamResetDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateBy.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateBy.kt new file mode 100644 index 000000000..d9ffeac3b --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateBy.kt @@ -0,0 +1,30 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToCoordinateV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToCoordinateV2Decoder.kt new file mode 100644 index 000000000..22dd4f99c --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToCoordinateV2Decoder.kt @@ -0,0 +1,30 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamRotateToCoordinateV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class CamRotateToCoordinateV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_ROTATETO_COORDINATE_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamRotateToCoordinateV2 { + val x = buffer.g2Alt1() + val cycles = buffer.g2Alt1() + val height = buffer.g2Alt3() + val z = buffer.g2Alt1() + val easing = buffer.g1Alt2() + return CamRotateToCoordinateV2( + x, + z, + height, + cycles, + easing, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToCoordinateV3Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToCoordinateV3Decoder.kt new file mode 100644 index 000000000..f0fbc0b4d --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToCoordinateV3Decoder.kt @@ -0,0 +1,34 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamRotateToCoordinateV3 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class CamRotateToCoordinateV3Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_ROTATETO_COORDINATE_V3 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamRotateToCoordinateV3 { + val height = buffer.g2sAlt2() + val x = buffer.g2Alt2() + val easing = buffer.g1() + val cycles = buffer.g2() + val heightRelative = buffer.g1() == 1 + val z = buffer.g2Alt3() + val trackTarget = buffer.g1() == 1 + return CamRotateToCoordinateV3( + x, + z, + height, + cycles, + easing, + heightRelative, + trackTarget, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToDecoder.kt new file mode 100644 index 000000000..177e67b75 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToDecoder.kt @@ -0,0 +1,30 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamShakeDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamShakeDecoder.kt new file mode 100644 index 000000000..3e3ecc800 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamShakeDecoder.kt @@ -0,0 +1,30 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamSkyboxDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamSkyboxDecoder.kt new file mode 100644 index 000000000..1d59bd66c --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamSkyboxDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamSkybox +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class CamSkyboxDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_SKYBOX + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamSkybox { + val model = buffer.g4Alt2() + return CamSkybox( + model, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamSmoothResetDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamSmoothResetDecoder.kt new file mode 100644 index 000000000..db926616f --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamSmoothResetDecoder.kt @@ -0,0 +1,30 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamTargetV3Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamTargetV3Decoder.kt new file mode 100644 index 000000000..5f71e7ce2 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamTargetV3Decoder.kt @@ -0,0 +1,37 @@ +package net.rsprox.protocol.v241.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.CamTargetV3 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class CamTargetV3Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_TARGET_V3 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamTargetV3 { + val type = buffer.g1() + var worldEntityIndex = buffer.g2s() + // 237 made toplevel/root world into id 0 + // but because our transcriber handles all revisions, we need it to be a uniform value + // within logic processing. + if (worldEntityIndex == 0) { + worldEntityIndex = -1 + } + val targetIndex = buffer.g2() + return CamTargetV3( + when (type) { + 0 -> CamTargetV3.PlayerCamTarget(worldEntityIndex, if (targetIndex == 65535) -1 else targetIndex) + 1 -> CamTargetV3.NpcCamTarget(worldEntityIndex, if (targetIndex == 65535) -1 else targetIndex) + 2 -> CamTargetV3.WorldEntityTarget(worldEntityIndex, if (targetIndex == 65535) -1 else targetIndex) + else -> throw IllegalStateException("Unknown type: $type") + }, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamTargetV4Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamTargetV4Decoder.kt new file mode 100644 index 000000000..85bf8f34f --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamTargetV4Decoder.kt @@ -0,0 +1,30 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera + +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.camera.CamTargetV4 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class CamTargetV4Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_TARGET_V4 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamTargetV4 { + val type = buffer.g1Alt3() + val value = buffer.g4Alt3() + return CamTargetV4( + when (type) { + 0 -> CamTargetV4.PlayerCamTarget(if (value == 65535) -1 else value) + 1 -> CamTargetV4.NpcCamTarget(if (value == 65535) -1 else value) + 2 -> CamTargetV4.WorldEntityTarget(if (value == 65535) -1 else value) + 3 -> CamTargetV4.CoordGridTarget(CoordGrid(value)) + else -> throw IllegalStateException("Unknown type: $type") + }, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamUnlockDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamUnlockDecoder.kt new file mode 100644 index 000000000..6e0d26f6c --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamUnlockDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.camera.CamUnlock +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class CamUnlockDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.CAM_UNLOCK + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): CamUnlock { + val unlock = buffer.g1Alt1() == 1 + return CamUnlock( + unlock, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/OculusSyncDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/OculusSyncDecoder.kt new file mode 100644 index 000000000..87588d1b2 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/OculusSyncDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/ClanChannelDeltaDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/ClanChannelDeltaDecoder.kt new file mode 100644 index 000000000..74b347012 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/ClanChannelDeltaDecoder.kt @@ -0,0 +1,111 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/ClanChannelFullDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/ClanChannelFullDecoder.kt new file mode 100644 index 000000000..2de2ba735 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/ClanChannelFullDecoder.kt @@ -0,0 +1,89 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/ClanSettingsDeltaDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/ClanSettingsDeltaDecoder.kt new file mode 100644 index 000000000..348f2b8ae --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/ClanSettingsDeltaDecoder.kt @@ -0,0 +1,202 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/ClanSettingsFullDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/ClanSettingsFullDecoder.kt new file mode 100644 index 000000000..37dd3ddb3 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/ClanSettingsFullDecoder.kt @@ -0,0 +1,176 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/MessageClanChannelDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/MessageClanChannelDecoder.kt new file mode 100644 index 000000000..3abf84941 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/MessageClanChannelDecoder.kt @@ -0,0 +1,37 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/MessageClanChannelSystemDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/MessageClanChannelSystemDecoder.kt new file mode 100644 index 000000000..cac380a59 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/MessageClanChannelSystemDecoder.kt @@ -0,0 +1,33 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/VarClanDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/VarClanDecoder.kt new file mode 100644 index 000000000..d7550aa95 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/VarClanDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v241.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.v241.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.g2() + val data = ByteArray(buffer.readableBytes()) + buffer.gdata(data) + return VarClan(id, VarClan.UnknownVarClanData(data)) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/VarClanDisableDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/VarClanDisableDecoder.kt new file mode 100644 index 000000000..ff951846e --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/VarClanDisableDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/VarClanEnableDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/VarClanEnableDecoder.kt new file mode 100644 index 000000000..61ef918be --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/clan/VarClanEnableDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/friendchat/MessageFriendChannelDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/friendchat/MessageFriendChannelDecoder.kt new file mode 100644 index 000000000..c9f1cfab1 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/friendchat/MessageFriendChannelDecoder.kt @@ -0,0 +1,38 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/friendchat/UpdateFriendChatChannelFullV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/friendchat/UpdateFriendChatChannelFullV2Decoder.kt new file mode 100644 index 000000000..6b1b08868 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/friendchat/UpdateFriendChatChannelFullV2Decoder.kt @@ -0,0 +1,54 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/group/GroupFullDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/group/GroupFullDecoder.kt new file mode 100644 index 000000000..81e3fc053 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/group/GroupFullDecoder.kt @@ -0,0 +1,42 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.group + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.cache.api.CacheProvider +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.group.GroupFull +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class GroupFullDecoder( + @Suppress("unused") + private val cache: CacheProvider, +) : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.GROUP_FULL + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): GroupFull { + val updates = + buildList { + while (buffer.isReadable) { + val index = buffer.g1() + val id = buffer.gSmart1or2null() + if (id == -1) { + add(GroupFull.GroupDelete(index)) + } else { + val uid = buffer.g8() + val data = ByteArray(buffer.readableBytes()) + buffer.gdata(data) + // TODO: Use cache group definitions to decode group and member variables, + // then continue walking any following add/change updates in this packet. + add(GroupFull.GroupAddChange(index, id, uid, data)) + } + } + } + return GroupFull(updates) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/group/GroupVarDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/group/GroupVarDecoder.kt new file mode 100644 index 000000000..a57a4bd0b --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/group/GroupVarDecoder.kt @@ -0,0 +1,43 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.group + +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.group.GroupVar +import net.rsprox.protocol.game.outgoing.model.group.util.GroupVarUpdate +import net.rsprox.protocol.game.outgoing.model.group.util.GroupVariable +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class GroupVarDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.GROUP_VAR + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): GroupVar { + val updates = + buildList { + while (buffer.isReadable) { + val index = buffer.g1() + val packedGroupVar = buffer.g4() + val baseVarType = (packedGroupVar ushr 16) and 0x3 + val variable = + when (baseVarType) { + GroupVarUpdate.INT_BASE_VAR_TYPE -> GroupVariable.IntGroupVariable(buffer.g4()) + GroupVarUpdate.LONG_BASE_VAR_TYPE -> GroupVariable.LongGroupVariable(buffer.g8()) + GroupVarUpdate.STRING_BASE_VAR_TYPE -> GroupVariable.StringGroupVariable(buffer.gjstr()) + else -> { + val data = ByteArray(buffer.readableBytes()) + buffer.gdata(data) + GroupVariable.UnknownGroupVariable(baseVarType, data) + } + } + add(GroupVarUpdate(index, packedGroupVar, variable)) + } + } + return GroupVar(updates) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/group/GroupVarIntDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/group/GroupVarIntDecoder.kt new file mode 100644 index 000000000..e95565298 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/group/GroupVarIntDecoder.kt @@ -0,0 +1,32 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.group + +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.group.GroupVarInt +import net.rsprox.protocol.game.outgoing.model.group.util.GroupVarUpdate +import net.rsprox.protocol.game.outgoing.model.group.util.GroupVariable +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class GroupVarIntDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.GROUP_VAR_INT + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): GroupVarInt { + val index = buffer.g1() + val packedGroupVar = buffer.g4() + val value = buffer.g4() + return GroupVarInt( + GroupVarUpdate( + index, + packedGroupVar, + GroupVariable.IntGroupVariable(value), + ), + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/group/GroupVarLongDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/group/GroupVarLongDecoder.kt new file mode 100644 index 000000000..cb4ba3b99 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/group/GroupVarLongDecoder.kt @@ -0,0 +1,32 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.group + +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.group.GroupVarLong +import net.rsprox.protocol.game.outgoing.model.group.util.GroupVarUpdate +import net.rsprox.protocol.game.outgoing.model.group.util.GroupVariable +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class GroupVarLongDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.GROUP_VAR_LONG + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): GroupVarLong { + val index = buffer.g1() + val packedGroupVar = buffer.g4() + val value = buffer.g8() + return GroupVarLong( + GroupVarUpdate( + index, + packedGroupVar, + GroupVariable.LongGroupVariable(value), + ), + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoLargeV5Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoLargeV5Decoder.kt new file mode 100644 index 000000000..bcd18307b --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoLargeV5Decoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v241.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.v241.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(), + 5, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoLargeV6Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoLargeV6Decoder.kt new file mode 100644 index 000000000..c6c025708 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoLargeV6Decoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v241.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.v241.game.outgoing.decoder.prot.GameServerProt + +internal class NpcInfoLargeV6Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.NPC_INFO_LARGE_V6 + + 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(), + 6, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoSmallV5Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoSmallV5Decoder.kt new file mode 100644 index 000000000..bd50b7613 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoSmallV5Decoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v241.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.v241.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(), + 5, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoSmallV6Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoSmallV6Decoder.kt new file mode 100644 index 000000000..037fe2bf9 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoSmallV6Decoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v241.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.v241.game.outgoing.decoder.prot.GameServerProt + +internal class NpcInfoSmallV6Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.NPC_INFO_SMALL_V6 + + 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(), + 6, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/PlayerInfoDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/PlayerInfoDecoder.kt new file mode 100644 index 000000000..4057160de --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/PlayerInfoDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/SetNpcUpdateOriginDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/SetNpcUpdateOriginDecoder.kt new file mode 100644 index 000000000..f5c5603de --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/SetNpcUpdateOriginDecoder.kt @@ -0,0 +1,38 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/WorldEntityInfoV7Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/WorldEntityInfoV7Decoder.kt new file mode 100644 index 000000000..f2817adc8 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/WorldEntityInfoV7Decoder.kt @@ -0,0 +1,112 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.info + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.compression.HuffmanCodec +import net.rsprot.protocol.ClientProt +import net.rsprox.cache.api.CacheProvider +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.game.outgoing.model.info.worldentityinfo.WorldEntityUpdateType +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.session.allocateWorld +import net.rsprox.protocol.session.getActiveWorld +import net.rsprox.protocol.session.getWorld +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt +import net.rsprox.protocol.v241.game.outgoing.model.info.npcinfo.NpcInfoClient +import net.rsprox.protocol.v241.game.outgoing.model.info.playerinfo.PlayerInfoClient +import net.rsprox.protocol.v241.game.outgoing.model.info.worldentityinfo.WorldEntityInfoClient + +internal class WorldEntityInfoV7Decoder( + private val huffmanCodec: HuffmanCodec, + private val cache: CacheProvider, +) : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.WORLDENTITY_INFO_V7 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): WorldEntityInfo { + val activeWorld = session.getActiveWorld() + val world = session.getWorld(activeWorld) + val message = + world.worldEntity.decode( + buffer, + CoordGrid(world.level, world.baseX, world.baseZ), + 7, + ) + for ((index, update) in message.updates) { + when (update) { + is WorldEntityUpdateType.ActiveV2 -> { + } + WorldEntityUpdateType.HighResolutionToLowResolution -> { + } + is WorldEntityUpdateType.LowResolutionToHighResolutionV2 -> { + session.allocateWorld( + index, + PlayerInfoClient( + session.localPlayerIndex, + huffmanCodec, + ), + NpcInfoClient(cache), + WorldEntityInfoClient(), + update.sizeX, + update.sizeZ, + ) + } + WorldEntityUpdateType.Idle -> { + // noop + } + + is WorldEntityUpdateType.ActiveV1 -> { + } + is WorldEntityUpdateType.LowResolutionToHighResolutionV1 -> { + session.allocateWorld( + index, + PlayerInfoClient( + session.localPlayerIndex, + huffmanCodec, + ), + NpcInfoClient(cache), + WorldEntityInfoClient(), + update.sizeX, + update.sizeZ, + ) + } + + is WorldEntityUpdateType.LowResolutionToHighResolutionV3 -> { + session.allocateWorld( + index, + PlayerInfoClient( + session.localPlayerIndex, + huffmanCodec, + ), + NpcInfoClient(cache), + WorldEntityInfoClient(), + update.sizeX, + update.sizeZ, + ) + } + + is WorldEntityUpdateType.ActiveV3 -> { + } + is WorldEntityUpdateType.ExtendedInfoOnly -> { + } + is WorldEntityUpdateType.LowResolutionToHighResolutionV4 -> { + session.allocateWorld( + index, + PlayerInfoClient( + session.localPlayerIndex, + huffmanCodec, + ), + NpcInfoClient(cache), + WorldEntityInfoClient(), + update.sizeX, + update.sizeZ, + ) + } + } + } + return message + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfClearInvDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfClearInvDecoder.kt new file mode 100644 index 000000000..2591b14cf --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfClearInvDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v241.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.IfClearInv +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.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.gCombinedIdAlt1() + return IfClearInv( + combinedId.interfaceId, + combinedId.componentId, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfCloseSubDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfCloseSubDecoder.kt new file mode 100644 index 000000000..4b52f38c3 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfCloseSubDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfMoveSubDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfMoveSubDecoder.kt new file mode 100644 index 000000000..9f3fb0f5a --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfMoveSubDecoder.kt @@ -0,0 +1,27 @@ +package net.rsprox.protocol.v241.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.IfMoveSub +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.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.gCombinedIdAlt3() + val destinationCombinedId = buffer.gCombinedIdAlt3() + return IfMoveSub( + sourceCombinedId.interfaceId, + sourceCombinedId.componentId, + destinationCombinedId.interfaceId, + destinationCombinedId.componentId, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfOpenSubDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfOpenSubDecoder.kt new file mode 100644 index 000000000..d037a2677 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfOpenSubDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.IfOpenSub +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.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 type = buffer.g1() + val interfaceId = buffer.g2Alt3() + val combinedId = buffer.gCombinedIdAlt3() + return IfOpenSub( + combinedId.interfaceId, + combinedId.componentId, + interfaceId, + type, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfOpenTopDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfOpenTopDecoder.kt new file mode 100644 index 000000000..ae4b9c581 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfOpenTopDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.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.g2Alt3() + return IfOpenTop( + interfaceId, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfResyncV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfResyncV2Decoder.kt new file mode 100644 index 000000000..2c4a5a8a5 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfResyncV2Decoder.kt @@ -0,0 +1,64 @@ +package net.rsprox.protocol.v241.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.IfResyncV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class IfResyncV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_RESYNC_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfResyncV2 { + 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 combinedId = buffer.gCombinedIdAlt1() + val angleY = buffer.g2Alt2() + val angleX = buffer.g2() + val zoom = buffer.g2() + return IfSetAngle( + combinedId.interfaceId, + combinedId.componentId, + angleX, + angleY, + zoom, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetAnimDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetAnimDecoder.kt new file mode 100644 index 000000000..fe3b8b8d2 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetAnimDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.IfSetAnim +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.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 combinedId = buffer.gCombinedId() + val anim = buffer.g2sAlt2() + return IfSetAnim( + combinedId.interfaceId, + combinedId.componentId, + anim, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetColourDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetColourDecoder.kt new file mode 100644 index 000000000..840bc43ac --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetColourDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.IfSetColour +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.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 colour15BitPacked = buffer.g2Alt3() + val combinedId = buffer.gCombinedIdAlt1() + return IfSetColour( + combinedId.interfaceId, + combinedId.componentId, + colour15BitPacked, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetEventsV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetEventsV2Decoder.kt new file mode 100644 index 000000000..406c07d52 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetEventsV2Decoder.kt @@ -0,0 +1,32 @@ +package net.rsprox.protocol.v241.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.IfSetEventsV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class IfSetEventsV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_SETEVENTS_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetEventsV2 { + val combinedId = buffer.gCombinedId() + val events1 = buffer.g4Alt3() + val start = buffer.g2Alt2() + val events2 = buffer.g4Alt1() + val end = buffer.g2Alt1() + return IfSetEventsV2( + combinedId.interfaceId, + combinedId.componentId, + start, + end, + events1, + events2, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetHideDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetHideDecoder.kt new file mode 100644 index 000000000..97d5bc662 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetHideDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.IfSetHide +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.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.gCombinedIdAlt2() + return IfSetHide( + combinedId.interfaceId, + combinedId.componentId, + hidden, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetModelV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetModelV2Decoder.kt new file mode 100644 index 000000000..2f307bdaa --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetModelV2Decoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.IfSetModelV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class IfSetModelV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.IF_SETMODEL_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): IfSetModelV2 { + val model = buffer.g4Alt1() + val combinedId = buffer.gCombinedIdAlt1() + return IfSetModelV2( + combinedId.interfaceId, + combinedId.componentId, + model, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadActiveDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadActiveDecoder.kt new file mode 100644 index 000000000..b8cadacb9 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadActiveDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.IfSetNpcHeadActive +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.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 combinedId = buffer.gCombinedIdAlt1() + val index = buffer.g2Alt3() + return IfSetNpcHeadActive( + combinedId.interfaceId, + combinedId.componentId, + index, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadDecoder.kt new file mode 100644 index 000000000..82d4f52fb --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.IfSetNpcHead +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.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 combinedId = buffer.gCombinedIdAlt2() + val npc = buffer.g2Alt1() + return IfSetNpcHead( + combinedId.interfaceId, + combinedId.componentId, + npc, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetObjectDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetObjectDecoder.kt new file mode 100644 index 000000000..0dc6ccdff --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetObjectDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.v241.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 obj = buffer.g2Alt3() + val count = buffer.g4Alt3() + val combinedId = buffer.gCombinedIdAlt3() + return IfSetObject( + combinedId.interfaceId, + combinedId.componentId, + obj, + count, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerHeadDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerHeadDecoder.kt new file mode 100644 index 000000000..5fca5ae70 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerHeadDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v241.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.IfSetPlayerHead +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.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.gCombinedIdAlt1() + return IfSetPlayerHead( + combinedId.interfaceId, + combinedId.componentId, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBaseColourDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBaseColourDecoder.kt new file mode 100644 index 000000000..4a9830ecc --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBaseColourDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.IfSetPlayerModelBaseColour +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.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 colour = buffer.g1Alt2() + val index = buffer.g1Alt3() + val combinedId = buffer.gCombinedIdAlt2() + return IfSetPlayerModelBaseColour( + combinedId.interfaceId, + combinedId.componentId, + index, + colour, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBodyTypeDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBodyTypeDecoder.kt new file mode 100644 index 000000000..ab25d3b8a --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBodyTypeDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelObjDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelObjDecoder.kt new file mode 100644 index 000000000..507bc19fe --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelObjDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.IfSetPlayerModelObj +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.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.g4Alt3() + val combinedId = buffer.gCombinedId() + return IfSetPlayerModelObj( + combinedId.interfaceId, + combinedId.componentId, + obj, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelSelfDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelSelfDecoder.kt new file mode 100644 index 000000000..3639fe3a4 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelSelfDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.v241.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 copyObjs = buffer.g1Alt3() == 1 + val combinedId = buffer.gCombinedIdAlt2() + return IfSetPlayerModelSelf( + combinedId.interfaceId, + combinedId.componentId, + copyObjs, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPositionDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPositionDecoder.kt new file mode 100644 index 000000000..0a3797a3d --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPositionDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.IfSetPosition +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.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.g2sAlt2() + val y = buffer.g2sAlt2() + val combinedId = buffer.gCombinedIdAlt1() + return IfSetPosition( + combinedId.interfaceId, + combinedId.componentId, + x, + y, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt new file mode 100644 index 000000000..a6eab1aa1 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.IfSetRotateSpeed +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.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 xSpeed = buffer.g2Alt1() + val combinedId = buffer.gCombinedIdAlt3() + val ySpeed = buffer.g2Alt1() + return IfSetRotateSpeed( + combinedId.interfaceId, + combinedId.componentId, + xSpeed, + ySpeed, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetScrollPosDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetScrollPosDecoder.kt new file mode 100644 index 000000000..1f69b4c8a --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetScrollPosDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.IfSetScrollPos +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.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 combinedId = buffer.gCombinedIdAlt3() + val scrollPos = buffer.g2() + return IfSetScrollPos( + combinedId.interfaceId, + combinedId.componentId, + scrollPos, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetTextDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetTextDecoder.kt new file mode 100644 index 000000000..bdb6b1760 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetTextDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.IfSetText +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.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 combinedId = buffer.gCombinedIdAlt2() + val text = buffer.gjstr() + return IfSetText( + combinedId.interfaceId, + combinedId.componentId, + text, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvFullDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvFullDecoder.kt new file mode 100644 index 000000000..9be8b2d54 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvFullDecoder.kt @@ -0,0 +1,39 @@ +package net.rsprox.protocol.v241.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.v241.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() + } + val id = buffer.g2() + add(UpdateInvFull.Obj(id - 1, count)) + } + } + return UpdateInvFull( + combinedId.interfaceId, + combinedId.componentId, + inventoryId, + objs, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvPartialDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvPartialDecoder.kt new file mode 100644 index 000000000..00e3491c5 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvPartialDecoder.kt @@ -0,0 +1,45 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvStopTransmitDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvStopTransmitDecoder.kt new file mode 100644 index 000000000..f39642f98 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvStopTransmitDecoder.kt @@ -0,0 +1,20 @@ +package net.rsprox.protocol.v241.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.v241.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.g2Alt1() + return UpdateInvStopTransmit(inventoryId) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/logout/LogoutDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/logout/LogoutDecoder.kt new file mode 100644 index 000000000..76559faf1 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/logout/LogoutDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/logout/LogoutTransferDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/logout/LogoutTransferDecoder.kt new file mode 100644 index 000000000..93cba3062 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/logout/LogoutTransferDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/logout/LogoutWithReasonDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/logout/LogoutWithReasonDecoder.kt new file mode 100644 index 000000000..d3e295d53 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/logout/LogoutWithReasonDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/map/RebuildRegionV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/map/RebuildRegionV2Decoder.kt new file mode 100644 index 000000000..9123838c3 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/map/RebuildRegionV2Decoder.kt @@ -0,0 +1,49 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.map + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.buffer.bitbuffer.toBitBuf +import net.rsprot.protocol.ClientProt +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.map.RebuildRegionV2 +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.v241.game.outgoing.decoder.prot.GameServerProt + +internal class RebuildRegionV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.REBUILD_REGION_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): RebuildRegionV2 { + val zoneZ = buffer.g2Alt2() + val zoneX = buffer.g2Alt1() + val reload = buffer.g1Alt1() == 1 + + @Suppress("UnusedVariable", "unused") + val distinctMapsquareCount = 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 world = session.getWorld(-1) + world.baseX = (zoneX - 6) * 8 + world.baseZ = (zoneZ - 6) * 8 + return RebuildRegionV2( + zoneX, + zoneZ, + reload, + buildArea, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/map/RebuildWorldEntityV4Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/map/RebuildWorldEntityV4Decoder.kt new file mode 100644 index 000000000..4c2a30c18 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/map/RebuildWorldEntityV4Decoder.kt @@ -0,0 +1,52 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.map + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.buffer.bitbuffer.toBitBuf +import net.rsprot.protocol.ClientProt +import net.rsprot.protocol.metadata.Consistent +import net.rsprox.protocol.ProxyMessageDecoder +import net.rsprox.protocol.game.outgoing.model.map.RebuildWorldEntityV4 +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.getActiveWorld +import net.rsprox.protocol.session.getWorld +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class RebuildWorldEntityV4Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.REBUILD_WORLDENTITY_V4 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): RebuildWorldEntityV4 { + val baseX = buffer.g2() + val baseZ = buffer.g2() + + @Suppress("UnusedVariable", "unused") + val distinctMapsquareCount = buffer.g2() + val world = session.getWorld(session.getActiveWorld()) + val width = world.sizeX / 8 + val length = world.sizeZ / 8 + val buildArea = BuildArea(4, width, length) + buffer.buffer.toBitBuf().use { bitBuf -> + for (level in 0..<4) { + for (x 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_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): StaticRebuildMessageV2 { + 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/HideNpcOpsDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/HideNpcOpsDecoder.kt new file mode 100644 index 000000000..a3521f408 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/HideNpcOpsDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/HideObjOpsDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/HideObjOpsDecoder.kt new file mode 100644 index 000000000..dcb174f66 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/HideObjOpsDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/HintArrowDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/HintArrowDecoder.kt new file mode 100644 index 000000000..3a0d17ef5 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/HintArrowDecoder.kt @@ -0,0 +1,55 @@ +package net.rsprox.protocol.v241.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.v241.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)) + } + 11 -> { + val index = buffer.g2() + val height = buffer.g3() + HintArrow(HintArrow.WorldEntityHintArrow(index, height)) + } + 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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/HiscoreReplyDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/HiscoreReplyDecoder.kt new file mode 100644 index 000000000..02463819f --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/HiscoreReplyDecoder.kt @@ -0,0 +1,78 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/MinimapToggleDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/MinimapToggleDecoder.kt new file mode 100644 index 000000000..f3cd94375 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/MinimapToggleDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/PacketGroupEndDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/PacketGroupEndDecoder.kt new file mode 100644 index 000000000..a4288f832 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/PacketGroupEndDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/PacketGroupStartDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/PacketGroupStartDecoder.kt new file mode 100644 index 000000000..ebaf608f3 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/PacketGroupStartDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ReflectionCheckerDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ReflectionCheckerDecoder.kt new file mode 100644 index 000000000..3694ed470 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ReflectionCheckerDecoder.kt @@ -0,0 +1,123 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ResetAnimsDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ResetAnimsDecoder.kt new file mode 100644 index 000000000..532df7c15 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ResetAnimsDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ResetInteractionModeDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ResetInteractionModeDecoder.kt new file mode 100644 index 000000000..3fcc9025e --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ResetInteractionModeDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/SendPingDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/SendPingDecoder.kt new file mode 100644 index 000000000..e5fa43b25 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/SendPingDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ServerTickEndDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ServerTickEndDecoder.kt new file mode 100644 index 000000000..03e409573 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ServerTickEndDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/SetHeatmapEnabledDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/SetHeatmapEnabledDecoder.kt new file mode 100644 index 000000000..eccadff9b --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/SetHeatmapEnabledDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/SetInteractionModeDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/SetInteractionModeDecoder.kt new file mode 100644 index 000000000..278b5501f --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/SetInteractionModeDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/SiteSettingsDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/SiteSettingsDecoder.kt new file mode 100644 index 000000000..5ce1b2015 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/SiteSettingsDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/UpdateRebootTimerV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/UpdateRebootTimerV2Decoder.kt new file mode 100644 index 000000000..ae60c3408 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/UpdateRebootTimerV2Decoder.kt @@ -0,0 +1,32 @@ +package net.rsprox.protocol.v241.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.UpdateRebootTimerV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class UpdateRebootTimerV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_REBOOT_TIMER_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateRebootTimerV2 { + val message = buffer.gjstr() + val gameCycles = buffer.g2Alt2() + return UpdateRebootTimerV2( + gameCycles, + when { + message.isEmpty() -> UpdateRebootTimerV2.IgnoreUpdateMessage + message == CANCEL -> UpdateRebootTimerV2.ClearUpdateMessage + else -> UpdateRebootTimerV2.SetUpdateMessage(message) + }, + ) + } + + private companion object { + private const val CANCEL: String = "\u0018" + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/UpdateUid192Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/UpdateUid192Decoder.kt new file mode 100644 index 000000000..1319feffe --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/UpdateUid192Decoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/UrlOpenDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/UrlOpenDecoder.kt new file mode 100644 index 000000000..5eea59de1 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/UrlOpenDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/AccountFlagsDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/AccountFlagsDecoder.kt new file mode 100644 index 000000000..f02531a1e --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/AccountFlagsDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v241.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.AccountFlags +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class AccountFlagsDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.ACCOUNT_FLAGS + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): AccountFlags { + val flags = buffer.g8() + return AccountFlags( + flags, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsDecoder.kt new file mode 100644 index 000000000..9751eaa36 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v241.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.v241.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 tradeChatFilter = buffer.g1() + val publicChatFilter = buffer.g1() + return ChatFilterSettings( + publicChatFilter, + tradeChatFilter, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsPrivateChatDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsPrivateChatDecoder.kt new file mode 100644 index 000000000..675c788fe --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsPrivateChatDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/MessageGameDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/MessageGameDecoder.kt new file mode 100644 index 000000000..3ae622374 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/MessageGameDecoder.kt @@ -0,0 +1,40 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/RunClientScriptDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/RunClientScriptDecoder.kt new file mode 100644 index 000000000..ec9b04f50 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/RunClientScriptDecoder.kt @@ -0,0 +1,58 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player + +import net.rsprot.buffer.JagByteBuf +import net.rsprot.buffer.extensions.gjstr +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.v241.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()) { + when (char) { + 'W' -> { + val length = buffer.gVarInt2() + val array = + IntArray(length) { + buffer.gVarInt2s() + } + arguments.addFirst(array) + } + 'X' -> { + val length = buffer.gVarInt2() + val array = + Array(length) { + buffer.buffer.gjstr() + } + arguments.addFirst(array) + } + 's' -> { + arguments.addFirst(buffer.gjstr()) + } + 'Ï' -> { + arguments.addFirst(buffer.g8()) + } + else -> { + arguments.addFirst(buffer.g4()) + } + } + } + val id = buffer.g4() + return RunClientScript( + id, + types.toCharArray(), + arguments, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/SetMapFlagV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/SetMapFlagV2Decoder.kt new file mode 100644 index 000000000..4d7d338a6 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/SetMapFlagV2Decoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v241.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.common.CoordGrid +import net.rsprox.protocol.game.outgoing.model.misc.player.SetMapFlagV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class SetMapFlagV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.SET_MAP_FLAG_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): SetMapFlagV2 { + val coordGrid = CoordGrid(buffer.g4()) + return SetMapFlagV2(coordGrid) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/SetPlayerOpDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/SetPlayerOpDecoder.kt new file mode 100644 index 000000000..238515fed --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/SetPlayerOpDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.v241.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 id = buffer.g1Alt3() + val priority = buffer.g1Alt3() == 1 + val op = buffer.gjstr() + return SetPlayerOp( + id, + priority, + if (op == "null") null else op, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/TriggerOnDialogAbortDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/TriggerOnDialogAbortDecoder.kt new file mode 100644 index 000000000..1517c65df --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/TriggerOnDialogAbortDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateRunEnergyDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateRunEnergyDecoder.kt new file mode 100644 index 000000000..36f06d55e --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateRunEnergyDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateRunWeightDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateRunWeightDecoder.kt new file mode 100644 index 000000000..63121316e --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateRunWeightDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v241.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.v241.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.g2s() + return UpdateRunWeight( + runweight, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateStatV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateStatV2Decoder.kt new file mode 100644 index 000000000..4faba388d --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateStatV2Decoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.v241.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 stat = buffer.g1Alt3() + val experience = buffer.g4Alt1() + val invisibleBoostedLevel = buffer.g1() + val currentLevel = buffer.g1Alt3() + return UpdateStatV2( + stat, + currentLevel, + invisibleBoostedLevel, + experience, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt new file mode 100644 index 000000000..6aa2ccdb8 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt @@ -0,0 +1,47 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateTradingPostDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateTradingPostDecoder.kt new file mode 100644 index 000000000..334dc4952 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateTradingPostDecoder.kt @@ -0,0 +1,57 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/social/MessagePrivateDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/social/MessagePrivateDecoder.kt new file mode 100644 index 000000000..8eae29e57 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/social/MessagePrivateDecoder.kt @@ -0,0 +1,35 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/social/MessagePrivateEchoDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/social/MessagePrivateEchoDecoder.kt new file mode 100644 index 000000000..c6abec345 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/social/MessagePrivateEchoDecoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/social/UpdateFriendListDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/social/UpdateFriendListDecoder.kt new file mode 100644 index 000000000..18a391d74 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/social/UpdateFriendListDecoder.kt @@ -0,0 +1,64 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/social/UpdateIgnoreListDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/social/UpdateIgnoreListDecoder.kt new file mode 100644 index 000000000..91f985044 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/social/UpdateIgnoreListDecoder.kt @@ -0,0 +1,47 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStartDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStartDecoder.kt new file mode 100644 index 000000000..bacd295fb --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStartDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v241.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.AmbientSoundStart +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class AmbientSoundStartDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.AMBIENTSOUND_START + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): AmbientSoundStart { + val id = buffer.g2Alt2() + val fade = buffer.g1Alt2() == 1 + return AmbientSoundStart( + id, + fade, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStopDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStopDecoder.kt new file mode 100644 index 000000000..882473c98 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStopDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.AmbientSoundStop +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class AmbientSoundStopDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.AMBIENTSOUND_STOP + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): AmbientSoundStop { + val fade = buffer.g1Alt3() == 1 + return AmbientSoundStop( + fade, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiJingleDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiJingleDecoder.kt new file mode 100644 index 000000000..e35472609 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiJingleDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v241.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.v241.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 id = buffer.g2() + val lengthInMillis = buffer.g3Alt1() + return MidiJingle( + id, + lengthInMillis, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongStopDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongStopDecoder.kt new file mode 100644 index 000000000..52823eb10 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongStopDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v241.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.v241.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 fadeOutDelay = buffer.g2Alt2() + val fadeOutSpeed = buffer.g2Alt1() + return MidiSongStop( + fadeOutDelay, + fadeOutSpeed, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongV2Decoder.kt new file mode 100644 index 000000000..996d940e0 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongV2Decoder.kt @@ -0,0 +1,30 @@ +package net.rsprox.protocol.v241.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.v241.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.g2() + val fadeInDelay = buffer.g2Alt1() + val fadeInSpeed = buffer.g2Alt2() + val fadeOutDelay = buffer.g2() + val id = buffer.g2() + return MidiSongV2( + id, + fadeOutDelay, + fadeOutSpeed, + fadeInDelay, + fadeInSpeed, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongWithSecondaryDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongWithSecondaryDecoder.kt new file mode 100644 index 000000000..b7746e433 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongWithSecondaryDecoder.kt @@ -0,0 +1,32 @@ +package net.rsprox.protocol.v241.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.v241.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 fadeOutDelay = buffer.g2() + val secondaryId = buffer.g2() + val fadeInSpeed = buffer.g2Alt2() + val fadeOutSpeed = buffer.g2Alt3() + val primaryId = buffer.g2Alt2() + val fadeInDelay = buffer.g2Alt3() + return MidiSongWithSecondary( + primaryId, + secondaryId, + fadeOutDelay, + fadeOutSpeed, + fadeInDelay, + fadeInSpeed, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSwapDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSwapDecoder.kt new file mode 100644 index 000000000..4d5008c7b --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSwapDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.v241.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 fadeInDelay = buffer.g2Alt3() + val fadeOutSpeed = buffer.g2Alt1() + val fadeOutDelay = buffer.g2() + val fadeInSpeed = buffer.g2() + return MidiSwap( + fadeOutDelay, + fadeOutSpeed, + fadeInDelay, + fadeInSpeed, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/SynthSoundDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/SynthSoundDecoder.kt new file mode 100644 index 000000000..bf5b2e73a --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/SynthSoundDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/AnimSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/AnimSpecificDecoder.kt new file mode 100644 index 000000000..37049d3e2 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/AnimSpecificDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v241.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.AnimSpecific +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class AnimSpecificDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.ANIM_SPECIFIC + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): AnimSpecific { + val delay = buffer.g1Alt1() + val id = buffer.g2Alt2() + return AnimSpecific( + id, + delay, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/LocAnimSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/LocAnimSpecificDecoder.kt new file mode 100644 index 000000000..91aa62126 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/LocAnimSpecificDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.v241.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 id = buffer.g2Alt3() + val coordInBuildArea = CoordInBuildArea(buffer.g3()) + val locProperties = LocProperties(buffer.g1Alt3()) + return LocAnimSpecific( + id, + coordInBuildArea, + locProperties, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/MapAnimSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/MapAnimSpecificDecoder.kt new file mode 100644 index 000000000..16b016221 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/MapAnimSpecificDecoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v241.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.v241.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 id = buffer.g2Alt3() + val delay = buffer.g2Alt3() + val height = buffer.g1() + val coordInBuildArea = CoordInBuildArea(buffer.g3()) + return MapAnimSpecific( + id, + delay, + height, + coordInBuildArea, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcAnimSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcAnimSpecificDecoder.kt new file mode 100644 index 000000000..ca9eb47a4 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcAnimSpecificDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.v241.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 index = buffer.g2Alt1() + val id = buffer.g2Alt1() + val delay = buffer.g1Alt1() + return NpcAnimSpecific( + index, + id, + delay, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcHeadIconSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcHeadIconSpecificDecoder.kt new file mode 100644 index 000000000..c85404cb7 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcHeadIconSpecificDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.v241.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 spriteGroup = buffer.g4Alt2() + val index = buffer.g2() + val headIconSlot = buffer.g1Alt3() + val spriteIndex = buffer.g2sAlt2() + return NpcHeadIconSpecific( + index, + headIconSlot, + spriteGroup, + spriteIndex, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcSpotAnimSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcSpotAnimSpecificDecoder.kt new file mode 100644 index 000000000..ae4cb99b6 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcSpotAnimSpecificDecoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.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.v241.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 id = buffer.g2Alt1() + val packed = buffer.g4() + val index = buffer.g2() + val slot = buffer.g1Alt3() + val height = packed ushr 16 + val delay = packed and 0xFFFF + return NpcSpotAnimSpecific( + index, + id, + slot, + height, + delay, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjAddSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjAddSpecificDecoder.kt new file mode 100644 index 000000000..0aad739c8 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjAddSpecificDecoder.kt @@ -0,0 +1,38 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific + +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.specific.ObjAddSpecific +import net.rsprox.protocol.game.outgoing.model.util.OpFlags +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class ObjAddSpecificDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_ADD_SPECIFIC + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ObjAddSpecific { + val quantity = buffer.g4Alt1() + val opFlags = OpFlags(buffer.g1Alt2()) + val coordGrid = CoordGrid(buffer.g4Alt3()) + val neverBecomesPublic = buffer.g1Alt2() == 1 + val id = buffer.g2Alt2() + val timeUntilDespawn = buffer.g2() + val ownershipType = buffer.g1() + val timeUntilPublic = buffer.g2Alt1() + return ObjAddSpecific( + id, + quantity, + coordGrid, + opFlags, + timeUntilPublic, + timeUntilDespawn, + ownershipType, + neverBecomesPublic, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCountSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCountSpecificDecoder.kt new file mode 100644 index 000000000..9e3b8ee0f --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCountSpecificDecoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific + +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.specific.ObjCountSpecific +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class ObjCountSpecificDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_COUNT_SPECIFIC + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ObjCountSpecific { + val id = buffer.g2Alt1() + val coordGrid = CoordGrid(buffer.g4Alt2()) + val oldQuantity = buffer.g4Alt1() + val newQuantity = buffer.g4Alt2() + return ObjCountSpecific( + id, + oldQuantity, + newQuantity, + coordGrid, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt new file mode 100644 index 000000000..69dc653b5 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt @@ -0,0 +1,37 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific + +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.specific.ObjCustomiseSpecific +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ObjCustomiseSpecific { + val coordGrid = CoordGrid(buffer.g4Alt3()) + val recolIndex = buffer.g2sAlt1() + val model = buffer.g2Alt3() + val id = buffer.g2Alt3() + val retexIndex = buffer.g2sAlt1() + val quantity = buffer.g4() + val recol = buffer.g2sAlt3() + val retex = buffer.g2sAlt3() + return ObjCustomiseSpecific( + id, + quantity, + model, + recolIndex, + recol, + retexIndex, + retex, + coordGrid, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjDelSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjDelSpecificDecoder.kt new file mode 100644 index 000000000..8f33c4218 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjDelSpecificDecoder.kt @@ -0,0 +1,27 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific + +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.specific.ObjDelSpecific +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class ObjDelSpecificDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_DEL_SPECIFIC + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ObjDelSpecific { + val quantity = buffer.g4Alt3() + val coordGrid = CoordGrid(buffer.g4Alt1()) + val id = buffer.g2Alt3() + return ObjDelSpecific( + id, + quantity, + coordGrid, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjEnabledOpsSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjEnabledOpsSpecificDecoder.kt new file mode 100644 index 000000000..a10dee7c9 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjEnabledOpsSpecificDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific + +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.specific.ObjEnabledOpsSpecific +import net.rsprox.protocol.game.outgoing.model.util.OpFlags +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class ObjEnabledOpsSpecificDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_ENABLED_OPS_SPECIFIC + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ObjEnabledOpsSpecific { + val id = buffer.g2Alt3() + val coordGrid = CoordGrid(buffer.g4Alt2()) + val opFlags = OpFlags(buffer.g1Alt3()) + return ObjEnabledOpsSpecific( + id, + opFlags, + coordGrid, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjUncustomiseSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjUncustomiseSpecificDecoder.kt new file mode 100644 index 000000000..996a1bb7c --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjUncustomiseSpecificDecoder.kt @@ -0,0 +1,27 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific + +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.specific.ObjUncustomiseSpecific +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class ObjUncustomiseSpecificDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_UNCUSTOMISE_SPECIFIC + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ObjUncustomiseSpecific { + val id = buffer.g2Alt2() + val coordGrid = CoordGrid(buffer.g4Alt2()) + val quantity = buffer.g4Alt2() + return ObjUncustomiseSpecific( + id, + quantity, + coordGrid, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/PlayerSpotAnimSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/PlayerSpotAnimSpecificDecoder.kt new file mode 100644 index 000000000..070a38a50 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/PlayerSpotAnimSpecificDecoder.kt @@ -0,0 +1,31 @@ +package net.rsprox.protocol.v241.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.v241.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 packed = buffer.g4Alt2() + val slot = buffer.g1Alt3() + val id = buffer.g2Alt2() + val index = buffer.g2Alt2() + val height = packed ushr 16 + val delay = packed and 0xFFFF + return PlayerSpotAnimSpecific( + index, + id, + slot, + height, + delay, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ProjAnimSpecificV4Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ProjAnimSpecificV4Decoder.kt new file mode 100644 index 000000000..a42e55017 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ProjAnimSpecificV4Decoder.kt @@ -0,0 +1,43 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific + +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.specific.ProjAnimSpecificV4 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class ProjAnimSpecificV4Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.PROJANIM_SPECIFIC_V4 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ProjAnimSpecificV4 { + val sourceIndex = buffer.g3sAlt2() + val startTime = buffer.g2() + val endHeight = buffer.g2Alt3() + val id = buffer.g2Alt3() + val targetIndex = buffer.g3s() + val progress = buffer.g2Alt1() + val angle = buffer.g1() + val startHeight = buffer.g2Alt2() + val start = CoordGrid(buffer.g4()) + val end = CoordGrid(buffer.g4()) + val endTime = buffer.g2Alt3() + return ProjAnimSpecificV4( + id, + startHeight, + endHeight, + startTime, + endTime, + angle, + progress, + start, + sourceIndex, + end, + targetIndex, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/unknown/UnknownStringDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/unknown/UnknownStringDecoder.kt new file mode 100644 index 000000000..7410a5311 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/unknown/UnknownStringDecoder.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpLargeDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpLargeDecoder.kt new file mode 100644 index 000000000..98a3252d2 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpLargeDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v241.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.v241.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.g2Alt3() + val value = buffer.g4Alt1() + return VarpLarge( + id, + value, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpResetDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpResetDecoder.kt new file mode 100644 index 000000000..930b11122 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpResetDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpSmallDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpSmallDecoder.kt new file mode 100644 index 000000000..45589868f --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpSmallDecoder.kt @@ -0,0 +1,24 @@ +package net.rsprox.protocol.v241.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.v241.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.g2Alt2() + val value = buffer.g1sAlt2() + return VarpSmall( + id, + value, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpSyncDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpSyncDecoder.kt new file mode 100644 index 000000000..0f9d4210c --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpSyncDecoder.kt @@ -0,0 +1,21 @@ +package net.rsprox.protocol.v241.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.v241.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-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/worldentity/SetActiveWorldV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/worldentity/SetActiveWorldV2Decoder.kt new file mode 100644 index 000000000..27ea6c57f --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/worldentity/SetActiveWorldV2Decoder.kt @@ -0,0 +1,38 @@ +package net.rsprox.protocol.v241.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.SetActiveWorldV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.session.getWorld +import net.rsprox.protocol.session.setActiveWorld +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class SetActiveWorldV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.SET_ACTIVE_WORLD_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): SetActiveWorldV2 { + var index = buffer.g2s() + // 237 made toplevel/root world into id 0 + // but because our transcriber handles all revisions, we need it to be a uniform value + // within logic processing. + if (index == 0) { + index = -1 + } + val activeLevel = buffer.g1() + session.setActiveWorld(index, activeLevel) + val world = session.getWorld(index) + world.level = activeLevel + return if (index == -1) { + SetActiveWorldV2(SetActiveWorldV2.RootWorldType(activeLevel)) + } else { + SetActiveWorldV2(SetActiveWorldV2.DynamicWorldType(index, activeLevel)) + } + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZoneFullFollowsDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZoneFullFollowsDecoder.kt new file mode 100644 index 000000000..c4d954f55 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZoneFullFollowsDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.v241.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 zoneZ = buffer.g1() + val zoneX = buffer.g1() + val level = buffer.g1Alt3() + return UpdateZoneFullFollows( + zoneX, + zoneZ, + level, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZonePartialEnclosedDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZonePartialEnclosedDecoder.kt new file mode 100644 index 000000000..0fb0c8acd --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZonePartialEnclosedDecoder.kt @@ -0,0 +1,71 @@ +package net.rsprox.protocol.v241.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.v241.game.outgoing.decoder.codec.zone.payload.LocAddChangeV2Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.payload.LocAnimDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.payload.LocDelDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.payload.LocMergeDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.payload.MapAnimDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.payload.MapProjAnimV2Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.payload.ObjAddDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.payload.ObjCountDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.payload.ObjCustomiseDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.payload.ObjDelDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.payload.ObjEnabledOpsDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.payload.ObjUncustomiseDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.payload.ScriptedProjAddDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.payload.ScriptedProjChangeDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.payload.SoundAreaDecoder +import net.rsprox.protocol.v241.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 zoneX = buffer.g1Alt3() + val zoneZ = buffer.g1Alt1() + val level = 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<*>, + ) { + LOC_ADD_CHANGE_V2(LocAddChangeV2Decoder()), + SCRIPTEDPROJ_CHANGE(ScriptedProjChangeDecoder()), + SCRIPTEDPROJ_ADD(ScriptedProjAddDecoder()), + LOC_ANIM(LocAnimDecoder()), + MAP_PROJANIM_V2(MapProjAnimV2Decoder()), + LOC_MERGE(LocMergeDecoder()), + OBJ_ADD(ObjAddDecoder()), + OBJ_CUSTOMISE(ObjCustomiseDecoder()), + OBJ_COUNT(ObjCountDecoder()), + LOC_DEL(LocDelDecoder()), + OBJ_ENABLED_OPS(ObjEnabledOpsDecoder()), + SOUND_AREA(SoundAreaDecoder()), + OBJ_DEL(ObjDelDecoder()), + OBJ_UNCUSTOMISE(ObjUncustomiseDecoder()), + MAP_ANIM(MapAnimDecoder()), + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZonePartialFollowsDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZonePartialFollowsDecoder.kt new file mode 100644 index 000000000..7341d5dc2 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZonePartialFollowsDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.v241.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.g1() + val zoneZ = buffer.g1Alt3() + val zoneX = buffer.g1Alt3() + return UpdateZonePartialFollows( + zoneX, + zoneZ, + level, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocAddChangeV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocAddChangeV2Decoder.kt new file mode 100644 index 000000000..b80ba66b4 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocAddChangeV2Decoder.kt @@ -0,0 +1,45 @@ +package net.rsprox.protocol.v241.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.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.v241.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.g1Alt3()) + val opOverrideCount = buffer.g1() + val opOverrides: Map? = + if (opOverrideCount > 0) { + buildMap { + for (i in 0.. { + override val prot: ClientProt = GameServerProt.LOC_ANIM + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): LocAnim { + val coordInZone = CoordInZone(buffer.g1Alt1()) + val locProperties = LocProperties(buffer.g1()) + val id = buffer.g2Alt2() + return LocAnim( + id, + coordInZone, + locProperties, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocDelDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocDelDecoder.kt new file mode 100644 index 000000000..9cc2f8ba1 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocDelDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.v241.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 coordInZone = CoordInZone(buffer.g1()) + val locProperties = LocProperties(buffer.g1Alt3()) + return LocDel( + coordInZone, + locProperties, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt new file mode 100644 index 000000000..26e8cb1fe --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt @@ -0,0 +1,42 @@ +package net.rsprox.protocol.v241.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.v241.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 minZ = buffer.g1s() + val id = buffer.g2Alt3() + val end = buffer.g2() + val locProperties = LocProperties(buffer.g1Alt2()) + val start = buffer.g2Alt3() + val maxZ = buffer.g1sAlt2() + val minX = buffer.g1s() + val maxX = buffer.g1sAlt2() + val index = buffer.g2Alt2() + val coordInZone = CoordInZone(buffer.g1Alt2()) + return LocMerge( + index, + id, + coordInZone, + locProperties, + start, + end, + minX, + minZ, + maxX, + maxZ, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt new file mode 100644 index 000000000..2534c9029 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v241.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.v241.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.g2Alt3() + val delay = buffer.g2Alt3() + val coordInZone = CoordInZone(buffer.g1()) + val height = buffer.g1Alt2() + return MapAnim( + id, + delay, + height, + coordInZone, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapProjAnimV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapProjAnimV2Decoder.kt new file mode 100644 index 000000000..d5f5514c6 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapProjAnimV2Decoder.kt @@ -0,0 +1,44 @@ +package net.rsprox.protocol.v241.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.common.CoordGrid +import net.rsprox.protocol.game.outgoing.model.zone.payload.MapProjAnimV2 +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class MapProjAnimV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.MAP_PROJANIM_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): MapProjAnimV2 { + val progress = buffer.g2Alt2() + val id = buffer.g2() + val angle = buffer.g1Alt3() + val endHeight = buffer.g2Alt3() + val targetIndex = buffer.g3sAlt1() + val end = CoordGrid(buffer.g4()) + val coordInZone = CoordInZone(buffer.g1Alt2()) + val startHeight = buffer.g2() + val endTime = buffer.g2Alt3() + val sourceIndex = buffer.g3s() + val startTime = buffer.g2Alt3() + return MapProjAnimV2( + id, + startHeight, + endHeight, + startTime, + endTime, + angle, + progress, + sourceIndex, + targetIndex, + coordInZone, + end, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt new file mode 100644 index 000000000..36faf828a --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt @@ -0,0 +1,38 @@ +package net.rsprox.protocol.v241.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.v241.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 timeUntilDespawn = buffer.g2() + val timeUntilPublic = buffer.g2() + val quantity = buffer.g4Alt3() + val neverBecomesPublic = buffer.g1() == 1 + val id = buffer.g2Alt1() + val coordInZone = CoordInZone(buffer.g1Alt1()) + val opFlags = OpFlags(buffer.g1Alt2()) + val ownershipType = buffer.g1Alt2() + return ObjAdd( + id, + quantity, + coordInZone, + opFlags, + timeUntilPublic, + timeUntilDespawn, + ownershipType, + neverBecomesPublic, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjCountDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjCountDecoder.kt new file mode 100644 index 000000000..9c0462650 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjCountDecoder.kt @@ -0,0 +1,29 @@ +package net.rsprox.protocol.v241.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.v241.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 oldQuantity = buffer.g4Alt3() + val newQuantity = buffer.g4() + val id = buffer.g2Alt3() + return ObjCount( + id, + oldQuantity, + newQuantity, + coordInZone, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjCustomiseDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjCustomiseDecoder.kt new file mode 100644 index 000000000..75d6080c2 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjCustomiseDecoder.kt @@ -0,0 +1,38 @@ +package net.rsprox.protocol.v241.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.v241.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 recolIndex = buffer.g2sAlt1() + val id = buffer.g2Alt2() + val coordInZone = CoordInZone(buffer.g1Alt1()) + val recol = buffer.g2sAlt1() + val retexIndex = buffer.g2sAlt1() + val retex = buffer.g2sAlt3() + val quantity = buffer.g4Alt3() + val model = buffer.g2Alt3() + return ObjCustomise( + id, + quantity, + model, + recolIndex, + recol, + retexIndex, + retex, + coordInZone.xInZone, + coordInZone.zInZone, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjDelDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjDelDecoder.kt new file mode 100644 index 000000000..5641575c3 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjDelDecoder.kt @@ -0,0 +1,27 @@ +package net.rsprox.protocol.v241.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.v241.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.g1Alt3()) + val quantity = buffer.g4() + return ObjDel( + id, + quantity, + coordInZone, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjEnabledOpsDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjEnabledOpsDecoder.kt new file mode 100644 index 000000000..5e4d96fbb --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjEnabledOpsDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.v241.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 id = buffer.g2Alt2() + val opFlags = OpFlags(buffer.g1Alt2()) + val coordInZone = CoordInZone(buffer.g1Alt3()) + return ObjEnabledOps( + id, + opFlags, + coordInZone, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjUncustomiseDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjUncustomiseDecoder.kt new file mode 100644 index 000000000..5e98dafca --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjUncustomiseDecoder.kt @@ -0,0 +1,28 @@ +package net.rsprox.protocol.v241.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.v241.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 quantity = buffer.g4Alt3() + val coordInZone = CoordInZone(buffer.g1Alt1()) + val id = buffer.g2Alt1() + return ObjUncustomise( + id, + quantity, + coordInZone.xInZone, + coordInZone.zInZone, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjAddDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjAddDecoder.kt new file mode 100644 index 000000000..664b1f3d7 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjAddDecoder.kt @@ -0,0 +1,57 @@ +package net.rsprox.protocol.v241.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.common.CoordGrid +import net.rsprox.protocol.game.outgoing.model.zone.payload.ScriptedProjAdd +import net.rsprox.protocol.game.outgoing.model.zone.payload.util.CoordInZone +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class ScriptedProjAddDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.SCRIPTEDPROJ_ADD + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ScriptedProjAdd { + val targetIndex = buffer.g3sAlt3() + val targetHeight = buffer.g2s() + val endTime = buffer.g2Alt3() + val slot = buffer.g2Alt3() + val sourceOffsetZ = buffer.g2s() + val sourceIndex = buffer.g3sAlt1() + val curveScriptH = buffer.g2Alt2() + val id = buffer.g2Alt1() + val sourceOffsetX = buffer.g2sAlt3() + val sourceHeight = buffer.g2s() + val coordInZone = CoordInZone(buffer.g1Alt1()) + val targetCoord = CoordGrid(buffer.g4Alt1()) + val startTime = buffer.g2() + val targetOffsetZ = buffer.g2sAlt2() + val targetOffsetX = buffer.g2s() + val curveScriptT = buffer.g2Alt1() + val curveScriptA = buffer.g2Alt3() + return ScriptedProjAdd( + slot, + id, + coordInZone.xInZone, + coordInZone.zInZone, + sourceOffsetX, + sourceOffsetZ, + sourceHeight, + sourceIndex, + targetCoord, + targetOffsetX, + targetOffsetZ, + targetHeight, + targetIndex, + startTime, + endTime, + curveScriptH, + curveScriptA, + curveScriptT, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjChangeDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjChangeDecoder.kt new file mode 100644 index 000000000..d7b5952d8 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjChangeDecoder.kt @@ -0,0 +1,37 @@ +package net.rsprox.protocol.v241.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.common.CoordGrid +import net.rsprox.protocol.game.outgoing.model.zone.payload.ScriptedProjChange +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class ScriptedProjChangeDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.SCRIPTEDPROJ_CHANGE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ScriptedProjChange { + val freezeDuration = buffer.g2Alt3() + val deleteOnFreezeEnd = buffer.g1Alt1() == 1 + val targetOffsetX = buffer.g2sAlt2() + val targetCoord = CoordGrid(buffer.g4()) + val targetOffsetZ = buffer.g2sAlt1() + val targetHeight = buffer.g2sAlt3() + val slot = buffer.g2Alt1() + val targetIndex = buffer.g3s() + return ScriptedProjChange( + slot, + targetCoord, + targetOffsetX, + targetOffsetZ, + targetHeight, + targetIndex, + freezeDuration, + deleteOnFreezeEnd, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/SoundAreaDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/SoundAreaDecoder.kt new file mode 100644 index 000000000..637240eed --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/SoundAreaDecoder.kt @@ -0,0 +1,33 @@ +package net.rsprox.protocol.v241.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.v241.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 size = buffer.g1Alt1() + val loops = buffer.g1Alt1() + val delay = buffer.g1Alt3() + val coordInZone = CoordInZone(buffer.g1Alt1()) + val radius = buffer.g1Alt2() + val id = buffer.g2Alt3() + return SoundArea( + id, + delay, + loops, + radius, + size, + coordInZone, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/GameServerProt.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/GameServerProt.kt new file mode 100644 index 000000000..d4fbe1e8b --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/GameServerProt.kt @@ -0,0 +1,221 @@ +package net.rsprox.protocol.v241.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_V2(GameServerProtId.IF_RESYNC_V2, 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_V2(GameServerProtId.IF_SETEVENTS_V2, 16), + 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_V2(GameServerProtId.IF_SETMODEL_V2, 8), + 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), + AMBIENTSOUND_START(GameServerProtId.AMBIENTSOUND_START, 3), + AMBIENTSOUND_STOP(GameServerProtId.AMBIENTSOUND_STOP, 1), + + // 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_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), + OBJ_ADD(-1, 14), + OBJ_DEL(-1, 7), + OBJ_COUNT(-1, 11), + OBJ_ENABLED_OPS(-1, 4), + OBJ_CUSTOMISE(-1, 17), + OBJ_UNCUSTOMISE(-1, 7), + MAP_ANIM(GameServerProtId.MAP_ANIM, 6), + + // MAP_PROJANIM_V2 has no packet of its own. It can only be transmitted via the partial enclosed packet. + MAP_PROJANIM_V2(-1, 24), + SOUND_AREA(GameServerProtId.SOUND_AREA, 7), + SCRIPTEDPROJ_ADD(-1, 37), + SCRIPTEDPROJ_CHANGE(-1, 18), + + // Specific packets + PROJANIM_SPECIFIC_V4(GameServerProtId.PROJANIM_SPECIFIC_V4, 27), + 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), + ANIM_SPECIFIC(GameServerProtId.ANIM_SPECIFIC, 3), + PLAYER_SPOTANIM_SPECIFIC(GameServerProtId.PLAYER_SPOTANIM_SPECIFIC, 9), + OBJ_ADD_SPECIFIC(GameServerProtId.OBJ_ADD_SPECIFIC, 17), + OBJ_DEL_SPECIFIC(GameServerProtId.OBJ_DEL_SPECIFIC, 10), + OBJ_ENABLED_OPS_SPECIFIC(GameServerProtId.OBJ_ENABLED_OPS_SPECIFIC, 7), + OBJ_UNCUSTOMISE_SPECIFIC(GameServerProtId.OBJ_UNCUSTOMISE_SPECIFIC, 10), + OBJ_COUNT_SPECIFIC(GameServerProtId.OBJ_COUNT_SPECIFIC, 14), + OBJ_CUSTOMISE_SPECIFIC(GameServerProtId.OBJ_CUSTOMISE_SPECIFIC, 20), + + // 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), + NPC_INFO_SMALL_V6(GameServerProtId.NPC_INFO_SMALL_V6, Prot.VAR_SHORT), + NPC_INFO_LARGE_V6(GameServerProtId.NPC_INFO_LARGE_V6, Prot.VAR_SHORT), + + SET_NPC_UPDATE_ORIGIN(GameServerProtId.SET_NPC_UPDATE_ORIGIN, 2), + + // World entity packets + SET_ACTIVE_WORLD_V2(GameServerProtId.SET_ACTIVE_WORLD_V2, 3), + WORLDENTITY_INFO_V7(GameServerProtId.WORLDENTITY_INFO_V7, Prot.VAR_SHORT), + + // Map packets + REBUILD_NORMAL_V2(GameServerProtId.REBUILD_NORMAL_V2, Prot.VAR_SHORT), + REBUILD_REGION_V2(GameServerProtId.REBUILD_REGION_V2, Prot.VAR_SHORT), + REBUILD_WORLDENTITY_V4(GameServerProtId.REBUILD_WORLDENTITY_V4, 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_V2(GameServerProtId.CAM_MOVETO_V2, 8), + CAM_MOVETO_V3(GameServerProtId.CAM_MOVETO_V3, 9), + CAM_MOVETO_CYCLES_V2(GameServerProtId.CAM_MOVETO_CYCLES_V2, 10), + CAM_MOVETO_CYCLES_V3(GameServerProtId.CAM_MOVETO_CYCLES_V3, 11), + CAM_MOVETO_ARC_V2(GameServerProtId.CAM_MOVETO_ARC_V2, 14), + CAM_MOVETO_ARC_V3(GameServerProtId.CAM_MOVETO_ARC_V3, 15), + CAM_LOOKAT_V2(GameServerProtId.CAM_LOOKAT_V2, 8), + CAM_LOOKAT_V3(GameServerProtId.CAM_LOOKAT_V3, 9), + CAM_LOOKAT_CYCLES(GameServerProtId.CAM_LOOKAT_CYCLES, 10), + CAM_ROTATETO_COORDINATE_V2(GameServerProtId.CAM_ROTATETO_COORDINATE_V2, 9), + CAM_ROTATETO_COORDINATE_V3(GameServerProtId.CAM_ROTATETO_COORDINATE_V3, 11), + CAM_ROTATEBY(GameServerProtId.CAM_ROTATEBY, 7), + CAM_ROTATETO(GameServerProtId.CAM_ROTATETO, 7), + CAM_MODE(GameServerProtId.CAM_MODE, 1), + CAM_TARGET_V3(GameServerProtId.CAM_TARGET_V3, 5), + CAM_TARGET_V4(GameServerProtId.CAM_TARGET_V4, 5), + OCULUS_SYNC(GameServerProtId.OCULUS_SYNC, 4), + CAM_UNLOCK(GameServerProtId.CAM_UNLOCK, 1), + CAM_SKYBOX(GameServerProtId.CAM_SKYBOX, 4), + + // Group packets + GROUP_FULL(GameServerProtId.GROUP_FULL, Prot.VAR_SHORT), + GROUP_VAR(GameServerProtId.GROUP_VAR, Prot.VAR_SHORT), + GROUP_VAR_INT(GameServerProtId.GROUP_VAR_INT, 9), + GROUP_VAR_LONG(GameServerProtId.GROUP_VAR_LONG, 13), + + // 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_V2(GameServerProtId.SET_MAP_FLAG_V2, 4), + 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), + ACCOUNT_FLAGS(GameServerProtId.ACCOUNT_FLAGS, 8), + + // Misc. client state packets + HINT_ARROW(GameServerProtId.HINT_ARROW, 6), + RESET_ANIMS(GameServerProtId.RESET_ANIMS, 0), + UPDATE_REBOOT_TIMER_V2(GameServerProtId.UPDATE_REBOOT_TIMER_V2, Prot.VAR_BYTE), + 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), + UNHANDLED(GameServerProtId.UNHANDLED, Prot.VAR_SHORT), + + PACKET_GROUP_END(0xFE, 0), + RECONNECT(0xFF, Prot.VAR_SHORT), +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/GameServerProtId.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/GameServerProtId.kt new file mode 100644 index 000000000..b131ad756 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/GameServerProtId.kt @@ -0,0 +1,156 @@ +package net.rsprox.protocol.v241.game.outgoing.decoder.prot + +internal object GameServerProtId { + const val CAM_TARGET_V4 = 0 + const val IF_SETOBJECT = 1 + const val MESSAGE_FRIENDCHANNEL = 2 + const val HINT_ARROW = 3 + const val IF_SETANGLE = 4 + const val CLANSETTINGS_DELTA = 5 + const val SET_INTERACTION_MODE = 6 + const val CLANCHANNEL_FULL = 7 + const val MIDI_SONG_STOP = 8 + const val UPDATE_IGNORELIST = 9 + const val RUNCLIENTSCRIPT = 10 + const val IF_SETTEXT = 11 + const val REBUILD_REGION_V2 = 12 + const val MAP_ANIM = 13 + const val UPDATE_INV_STOPTRANSMIT = 14 + const val SET_HEATMAP_ENABLED = 15 + const val SOUND_AREA = 16 + const val CAM_RESET = 17 + const val CHAT_FILTER_SETTINGS = 18 + const val UPDATE_RUNWEIGHT = 19 + const val SET_ACTIVE_WORLD_V2 = 20 + const val VARCLAN = 21 + const val IF_SETPLAYERHEAD = 22 + const val UPDATE_INV_PARTIAL = 23 + const val UPDATE_FRIENDLIST = 24 + const val VARCLAN_DISABLE = 25 + const val LOGOUT_TRANSFER = 26 + const val MESSAGE_PRIVATE_ECHO = 27 + const val IF_SETCOLOUR = 28 + const val UPDATE_TRADINGPOST = 29 + const val IF_RESYNC_V2 = 30 + const val MIDI_SWAP = 31 + const val CAM_MODE = 32 + const val CAM_ROTATETO = 33 + const val CAM_SMOOTHRESET = 34 + const val IF_OPENTOP = 35 + const val MESSAGE_PRIVATE = 36 + const val LOGOUT = 37 + const val LOC_ADD_CHANGE_V2 = 38 + const val REBUILD_NORMAL_V2 = 39 + const val MIDI_JINGLE = 40 + const val LOC_DEL = 41 + const val IF_SETPLAYERMODEL_BASECOLOUR = 42 + const val MESSAGE_CLANCHANNEL = 43 + const val UNKNOWN_STRING = 44 + const val IF_OPENSUB = 45 + const val CLANCHANNEL_DELTA = 46 + const val MIDI_SONG_WITHSECONDARY = 47 + const val LOC_MERGE = 48 + const val UPDATE_ZONE_PARTIAL_ENCLOSED = 49 + const val IF_SETPLAYERMODEL_OBJ = 50 + const val IF_MOVESUB = 51 + const val OBJ_CUSTOMISE_SPECIFIC = 52 + const val SITE_SETTINGS = 53 + const val IF_SETHIDE = 54 + const val HIDELOCOPS = 55 + const val LOGOUT_WITHREASON = 56 + const val PACKET_GROUP_START = 57 + const val RESET_ANIMS = 58 + const val IF_SETANIM = 59 + const val IF_CLEARINV = 60 + const val IF_SETNPCHEAD = 61 + const val IF_SETPLAYERMODEL_SELF = 62 + const val UPDATE_STAT_V2 = 63 + const val IF_SETPLAYERMODEL_BODYTYPE = 64 + const val OCULUS_SYNC = 65 + const val UPDATE_REBOOT_TIMER_V2 = 66 + const val IF_SETNPCHEAD_ACTIVE = 67 + const val VARP_RESET = 68 + const val HISCORE_REPLY = 69 + const val FRIENDLIST_LOADED = 70 + const val CAM_TARGET_V3 = 71 + const val PROJANIM_SPECIFIC_V4 = 72 + const val MESSAGE_GAME = 73 + const val UPDATE_INV_FULL = 74 + const val REBUILD_WORLDENTITY_V4 = 75 + const val CHAT_FILTER_SETTINGS_PRIVATECHAT = 76 + const val TRIGGER_ONDIALOGABORT = 77 + const val IF_SETSCROLLPOS = 78 + const val MESSAGE_CLANCHANNEL_SYSTEM = 79 + const val WORLDENTITY_INFO_V7 = 80 + const val MIDI_SONG_V2 = 81 + const val ACCOUNT_FLAGS = 82 + const val PLAYER_SPOTANIM_SPECIFIC = 83 + const val LOC_ANIM_SPECIFIC = 84 + const val SET_PLAYER_OP = 85 + const val OBJ_DEL_SPECIFIC = 86 + const val OBJ_ENABLED_OPS_SPECIFIC = 87 + const val UPDATE_FRIENDCHAT_CHANNEL_FULL_V2 = 88 + const val OBJ_UNCUSTOMISE_SPECIFIC = 89 + const val MAP_ANIM_SPECIFIC = 90 + const val PLAYER_INFO = 91 + const val SERVER_TICK_END = 92 + const val NPC_INFO_LARGE_V5 = 93 + const val VARP_LARGE = 94 + const val CAM_ROTATEBY = 95 + const val NPC_HEADICON_SPECIFIC = 96 + const val CLANSETTINGS_FULL = 97 + const val SYNTH_SOUND = 98 + const val UPDATE_UID192 = 99 + const val VARP_SYNC = 100 + const val NPC_SPOTANIM_SPECIFIC = 101 + const val ANIM_SPECIFIC = 102 + const val UPDATE_STOCKMARKET_SLOT = 103 + const val VARCLAN_ENABLE = 104 + const val IF_SETROTATESPEED = 105 + const val IF_SETEVENTS_V2 = 106 + const val URL_OPEN = 107 + const val IF_SETPOSITION = 108 + const val UPDATE_FRIENDCHAT_CHANNEL_SINGLEUSER = 109 + const val HIDENPCOPS = 110 + const val SET_NPC_UPDATE_ORIGIN = 111 + const val HIDEOBJOPS = 112 + const val CAM_SHAKE = 113 + const val OBJ_ADD_SPECIFIC = 114 + const val SEND_PING = 115 + const val IF_CLOSESUB = 116 + const val NPC_ANIM_SPECIFIC = 117 + const val UPDATE_ZONE_PARTIAL_FOLLOWS = 118 + const val NPC_INFO_SMALL_V5 = 119 + const val UPDATE_RUNENERGY = 120 + const val RESET_INTERACTION_MODE = 121 + const val MINIMAP_TOGGLE = 122 + const val LOC_ANIM = 123 + const val OBJ_COUNT_SPECIFIC = 124 + const val REFLECTION_CHECKER = 125 + const val UPDATE_ZONE_FULL_FOLLOWS = 126 + const val VARP_SMALL = 127 + const val CAM_ROTATETO_COORDINATE_V3 = 128 + const val UNHANDLED = 129 + const val CAM_MOVETO_CYCLES_V3 = 130 + const val CAM_MOVETO_ARC_V3 = 131 + const val IF_SETMODEL_V2 = 132 + const val CAM_ROTATETO_COORDINATE_V2 = 133 + const val CAM_MOVETO_V3 = 134 + const val AMBIENTSOUND_START = 135 + const val SET_MAP_FLAG_V2 = 136 + const val GROUP_VAR_LONG = 137 + const val AMBIENTSOUND_STOP = 138 + const val GROUP_FULL = 139 + const val CAM_SKYBOX = 140 + const val NPC_INFO_LARGE_V6 = 141 + const val GROUP_VAR = 142 + const val CAM_MOVETO_ARC_V2 = 143 + const val GROUP_VAR_INT = 144 + const val CAM_LOOKAT_CYCLES = 145 + const val CAM_LOOKAT_V2 = 146 + const val CAM_MOVETO_CYCLES_V2 = 147 + const val CAM_LOOKAT_V3 = 148 + const val CAM_UNLOCK = 149 + const val NPC_INFO_SMALL_V6 = 150 + const val CAM_MOVETO_V2 = 151 +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt new file mode 100644 index 000000000..6b6ffff3d --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt @@ -0,0 +1,341 @@ +package net.rsprox.protocol.v241.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.v241.game.outgoing.decoder.codec.camera.CamLookAtCyclesDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamLookAtV2Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamLookAtV3Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamModeDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamMoveToArcV2Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamMoveToArcV3Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamMoveToCyclesV2Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamMoveToCyclesV3Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamMoveToV2Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamMoveToV3Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamResetDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamRotateBy +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamRotateToCoordinateV2Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamRotateToCoordinateV3Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamRotateToDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamShakeDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamSkyboxDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamSmoothResetDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamTargetV3Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamTargetV4Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamUnlockDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.OculusSyncDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.clan.ClanChannelDeltaDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.clan.ClanChannelFullDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.clan.ClanSettingsDeltaDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.clan.ClanSettingsFullDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.clan.MessageClanChannelDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.clan.MessageClanChannelSystemDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.clan.VarClanDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.clan.VarClanDisableDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.clan.VarClanEnableDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.friendchat.MessageFriendChannelDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.friendchat.UpdateFriendChatChannelFullV2Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.friendchat.UpdateFriendChatChannelSingleUserDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.group.GroupFullDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.group.GroupVarDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.group.GroupVarIntDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.group.GroupVarLongDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.info.NpcInfoLargeV5Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.info.NpcInfoLargeV6Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.info.NpcInfoSmallV5Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.info.NpcInfoSmallV6Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.info.PlayerInfoDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.info.SetNpcUpdateOriginDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.info.WorldEntityInfoV7Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.* +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfClearInvDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfCloseSubDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfMoveSubDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfOpenSubDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfOpenTopDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfResyncV2Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfSetAngleDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfSetAnimDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfSetColourDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfSetHideDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfSetNpcHeadActiveDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfSetNpcHeadDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfSetObjectDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfSetPlayerHeadDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfSetPlayerModelBaseColourDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfSetPlayerModelBodyTypeDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfSetPlayerModelObjDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfSetPlayerModelSelfDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfSetPositionDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfSetRotateSpeedDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfSetScrollPosDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces.IfSetTextDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.inv.UpdateInvFullDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.inv.UpdateInvPartialDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.inv.UpdateInvStopTransmitDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.logout.LogoutDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.logout.LogoutTransferDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.logout.LogoutWithReasonDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.map.RebuildRegionV2Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.map.RebuildWorldEntityV4Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.map.ReconnectDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.map.StaticRebuildV2Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.HideLocOpsDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.HideNpcOpsDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.HideObjOpsDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.HintArrowDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.HiscoreReplyDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.MinimapToggleDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.PacketGroupEndDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.PacketGroupStartDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.ReflectionCheckerDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.ResetAnimsDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.ResetInteractionModeDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.SendPingDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.ServerTickEndDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.SetHeatmapEnabledDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.SetInteractionModeDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.SiteSettingsDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.UpdateRebootTimerV2Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.UpdateUid192Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.UrlOpenDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.AccountFlagsDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.ChatFilterSettingsDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.ChatFilterSettingsPrivateChatDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.MessageGameDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.RunClientScriptDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.SetMapFlagV2Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.SetPlayerOpDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.TriggerOnDialogAbortDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.UpdateRunEnergyDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.UpdateRunWeightDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.UpdateStatV2Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.UpdateTradingPostDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.social.FriendListLoadedDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.social.MessagePrivateDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.social.MessagePrivateEchoDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.social.UpdateFriendListDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.social.UpdateIgnoreListDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.sound.AmbientSoundStartDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.sound.AmbientSoundStopDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.sound.MidiJingleDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.sound.MidiSongStopDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.sound.MidiSongV2Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.sound.MidiSongWithSecondaryDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.sound.MidiSwapDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.sound.SynthSoundDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific.* +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific.AnimSpecificDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific.LocAnimSpecificDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific.MapAnimSpecificDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific.NpcAnimSpecificDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific.NpcHeadIconSpecificDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific.NpcSpotAnimSpecificDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific.ObjAddSpecificDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific.PlayerSpotAnimSpecificDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific.ProjAnimSpecificV4Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.unknown.UnknownStringDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.varp.VarpLargeDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.varp.VarpResetDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.varp.VarpSmallDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.varp.VarpSyncDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.worldentity.SetActiveWorldV2Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.header.UpdateZoneFullFollowsDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.header.UpdateZonePartialEnclosedDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.header.UpdateZonePartialFollowsDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.payload.LocAddChangeV2Decoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.payload.LocAnimDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.payload.LocDelDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.payload.LocMergeDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.zone.payload.MapAnimDecoder +import net.rsprox.protocol.v241.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(CamRotateToCoordinateV2Decoder()) + bind(CamRotateToCoordinateV3Decoder()) + bind(CamLookAtV2Decoder()) + bind(CamLookAtV3Decoder()) + bind(CamLookAtCyclesDecoder()) + bind(CamModeDecoder()) + bind(CamMoveToArcV2Decoder()) + bind(CamMoveToArcV3Decoder()) + bind(CamMoveToCyclesV2Decoder()) + bind(CamMoveToCyclesV3Decoder()) + bind(CamMoveToV2Decoder()) + bind(CamMoveToV3Decoder()) + bind(CamResetDecoder()) + bind(CamShakeDecoder()) + bind(CamSmoothResetDecoder()) + bind(CamTargetV3Decoder()) + bind(CamTargetV4Decoder()) + bind(OculusSyncDecoder()) + bind(CamSkyboxDecoder()) + bind(CamUnlockDecoder()) + + bind(ClanChannelDeltaDecoder()) + bind(ClanChannelFullDecoder()) + bind(ClanSettingsDeltaDecoder()) + bind(ClanSettingsFullDecoder()) + bind(MessageClanChannelDecoder(huffmanCodec)) + bind(MessageClanChannelSystemDecoder(huffmanCodec)) + bind(VarClanDisableDecoder()) + bind(VarClanEnableDecoder()) + bind(VarClanDecoder()) + bind(GroupFullDecoder(cache)) + bind(GroupVarDecoder()) + bind(GroupVarIntDecoder()) + bind(GroupVarLongDecoder()) + + bind(MessageFriendChannelDecoder(huffmanCodec)) + bind(UpdateFriendChatChannelFullV2Decoder()) + bind(UpdateFriendChatChannelSingleUserDecoder()) + + bind(PlayerInfoDecoder()) + bind(NpcInfoSmallV5Decoder()) + bind(NpcInfoLargeV5Decoder()) + bind(NpcInfoSmallV6Decoder()) + bind(NpcInfoLargeV6Decoder()) + bind(SetNpcUpdateOriginDecoder()) + bind(WorldEntityInfoV7Decoder(huffmanCodec, cache)) + + bind(IfClearInvDecoder()) + bind(IfCloseSubDecoder()) + bind(IfResyncV2Decoder()) + bind(IfMoveSubDecoder()) + bind(IfOpenSubDecoder()) + bind(IfOpenTopDecoder()) + bind(IfSetAngleDecoder()) + bind(IfSetAnimDecoder()) + bind(IfSetColourDecoder()) + bind(IfSetEventsV2Decoder()) + bind(IfSetHideDecoder()) + bind(IfSetModelV2Decoder()) + 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(StaticRebuildV2Decoder(huffmanCodec, cache)) + bind(RebuildRegionV2Decoder()) + bind(RebuildWorldEntityV4Decoder()) + + 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(UpdateRebootTimerV2Decoder()) + bind(SiteSettingsDecoder()) + bind(UpdateUid192Decoder()) + bind(UrlOpenDecoder()) + bind(PacketGroupStartDecoder()) + bind(PacketGroupEndDecoder()) + + bind(ChatFilterSettingsDecoder()) + bind(ChatFilterSettingsPrivateChatDecoder()) + bind(MessageGameDecoder()) + bind(RunClientScriptDecoder()) + bind(SetMapFlagV2Decoder()) + bind(SetPlayerOpDecoder()) + bind(TriggerOnDialogAbortDecoder()) + bind(UpdateRunEnergyDecoder()) + bind(UpdateRunWeightDecoder()) + bind(UpdateStatV2Decoder()) + bind(UpdateStockMarketSlotDecoder()) + bind(UpdateTradingPostDecoder()) + bind(AccountFlagsDecoder()) + + 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(AmbientSoundStartDecoder()) + bind(AmbientSoundStopDecoder()) + + bind(LocAnimSpecificDecoder()) + bind(MapAnimSpecificDecoder()) + bind(NpcAnimSpecificDecoder()) + bind(NpcHeadIconSpecificDecoder()) + bind(NpcSpotAnimSpecificDecoder()) + bind(AnimSpecificDecoder()) + bind(PlayerSpotAnimSpecificDecoder()) + bind(ProjAnimSpecificV4Decoder()) + bind(ObjAddSpecificDecoder()) + bind(ObjDelSpecificDecoder()) + bind(ObjCountSpecificDecoder()) + bind(ObjEnabledOpsSpecificDecoder()) + bind(ObjCustomiseSpecificDecoder()) + bind(ObjUncustomiseSpecificDecoder()) + + bind(VarpLargeDecoder()) + bind(VarpResetDecoder()) + bind(VarpSmallDecoder()) + bind(VarpSyncDecoder()) + + bind(SetActiveWorldV2Decoder()) + + bind(UpdateZonePartialEnclosedDecoder()) + bind(UpdateZoneFullFollowsDecoder()) + bind(UpdateZonePartialFollowsDecoder()) + + bind(LocAddChangeV2Decoder()) + bind(LocAnimDecoder()) + bind(LocDelDecoder()) + bind(LocMergeDecoder()) + bind(MapAnimDecoder()) + bind(SoundAreaDecoder()) + + bind(UnknownStringDecoder()) + } + return builder.build() + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/npcinfo/NpcInfoClient.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/npcinfo/NpcInfoClient.kt new file mode 100644 index 000000000..ebe84c49d --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/npcinfo/NpcInfoClient.kt @@ -0,0 +1,1093 @@ +package net.rsprox.protocol.v241.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.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.EnabledOpsExtendedInfo +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.FaceExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.FreezeExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.Headbar +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.HeadbarExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.Hit +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.HitmarkExtendedInfo +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 +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.TransparencyExtendedInfo + +@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, + version: Int, + ): NpcInfo { + deletedNPCCount = 0 + extraUpdateNPCCount = 0 + buffer.toBitBuf().use { bitBuffer -> + processHighResolution(bitBuffer) + processLowResolution(large, bitBuffer, baseCoord, version) + } + 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 UNUSED_FLAGS != 0) { + throw IllegalStateException("Unused flag used: $flag!") + } + + if (flag and TINTING != 0) { + decodeTinting(buffer, blocks) + } + if (flag and BAS_CHANGE != 0) { + decodeBaseAnimationSet(buffer, blocks) + } + if (flag and SPOTANIM != 0) { + decodeSpotanim(buffer, blocks) + } + if (flag and HEAD_CUSTOMISATION != 0) { + decodeHeadCustomisationV2(npc.id, buffer, blocks) + } + if (flag and HEADICON_CUSTOMISATION != 0) { + decodeHeadiconCustomisation(buffer, blocks) + } + if (flag and OPS != 0) { + decodeEnabledOps(buffer, blocks) + } + if (flag and BODY_CUSTOMISATION_V3 != 0) { + decodeBodyCustomisationV3(buffer, blocks) + } + if (flag and SAY != 0) { + decodeSay(buffer, blocks) + } + if (flag and NPC_FREEZE != 0) { + decodeFreeze(buffer, blocks) + } + if (flag and LEVEL_CHANGE != 0) { + decodeCombatLevelChange(buffer, blocks) + } + if (flag and EXACT_MOVE != 0) { + decodeExactMove(buffer, blocks) + } + if (flag and SEQUENCE != 0) { + decodeSequence(buffer, blocks) + } + if (flag and HITMARKS != 0) { + decodeHitmarks(buffer, blocks) + } + if (flag and SPOTANIM_OLD != 0) { + decodeSpotanimOld(buffer, blocks) + } + if (flag and NPC_TRANSPARENCY != 0) { + decodeTransparency(buffer, blocks) + } + if (flag and BODY_CUSTOMISATION_V2 != 0) { + decodeBodyCustomisationV2(npc.id, buffer, blocks) + } + if (flag and NAME_CHANGE != 0) { + decodeNameChange(buffer, blocks) + } + if (flag and TRANSFORMATION != 0) { + decodeTransformation(buffer, blocks, npc) + } + if (flag and FACING != 0) { + decodeFacing(buffer, blocks) + } + if (flag and HEADBARS != 0) { + decodeHeadbars(buffer, blocks) + } + } + } + + private fun decodeBaseAnimationSet( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val flag = buffer.g4Alt3() + val turnLeftAnim = if (flag and 0x1 != 0) buffer.g2Alt3() else null + val turnRightAnim = if (flag and 0x2 != 0) buffer.g2Alt1() else null + val walkAnim = if (flag and 0x4 != 0) buffer.g2() else null + val walkAnimBack = if (flag and 0x8 != 0) buffer.g2Alt1() else null + val walkAnimLeft = if (flag and 0x10 != 0) buffer.g2Alt1() else null + val walkAnimRight = if (flag and 0x20 != 0) buffer.g2Alt3() else null + val runAnim = if (flag and 0x40 != 0) buffer.g2() else null + val runAnimBack = if (flag and 0x80 != 0) buffer.g2Alt2() else null + val runAnimLeft = if (flag and 0x100 != 0) buffer.g2Alt1() else null + val runAnimRight = if (flag and 0x200 != 0) buffer.g2Alt2() else null + val crawlAnim = if (flag and 0x400 != 0) buffer.g2Alt1() else null + val crawlAnimBack = if (flag and 0x800 != 0) buffer.g2Alt2() else null + val crawlAnimLeft = if (flag and 0x1000 != 0) buffer.g2Alt3() else null + val crawlAnimRight = if (flag and 0x2000 != 0) buffer.g2() else null + val readyAnim = if (flag and 0x4000 != 0) buffer.g2() else null + blocks += + BaseAnimationSetExtendedInfo( + turnLeftAnim, + turnRightAnim, + walkAnim, + walkAnimBack, + walkAnimLeft, + walkAnimRight, + runAnim, + runAnimBack, + runAnimLeft, + runAnimRight, + crawlAnim, + crawlAnimBack, + crawlAnimLeft, + crawlAnimRight, + readyAnim, + ) + } + + private fun decodeHitmarks( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val hitCount = buffer.g1Alt1() + val hits = ArrayList(hitCount) + for (i in 0.., + ) { + val headbarCount = buffer.g1Alt1() + val headbars = ArrayList(headbarCount) + for (i in 0.. 0) { + buffer.g1Alt2() + } else { + startFill + } + headbars += + Headbar( + type, + startFill, + endFill, + startTime, + endTime, + ) + } + blocks += HeadbarExtendedInfo(headbars) + } + + private fun decodeSpotanimOld( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val spotanims = mutableMapOf() + val count = buffer.g1Alt1() + for (i in 0.., + ) { + val spotanims = mutableMapOf() + val count = buffer.g1Alt3() + for (i in 0.., + ) { + val id = buffer.g2Alt1() + val delay = buffer.g1Alt1() + blocks += SequenceExtendedInfo(id, delay) + } + + private fun decodeCombatLevelChange( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val level = buffer.g4Alt1() + blocks += CombatLevelChangeExtendedInfo(level) + } + + private fun decodeFreeze( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val delay = buffer.g2Alt3() + val duration = buffer.g2Alt2() + val cancelSequence = buffer.g1() == 1 + blocks += FreezeExtendedInfo(delay, duration, cancelSequence) + } + + private fun decodeTransparency( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val start = buffer.g2sAlt1() + val end = buffer.g2s() + val startTransparency = buffer.g1sAlt1() + val endTransparency = buffer.g1s() + val useStartTransparency = buffer.g1() == 1 + blocks += + TransparencyExtendedInfo( + start, + end, + startTransparency, + endTransparency, + useStartTransparency, + ) + } + + private fun decodeTinting( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val start = buffer.g2() + val end = buffer.g2Alt2() + val hue = buffer.g1Alt2() + 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.g2Alt2() + blocks += TransformationExtendedInfo(id) + npc.id = id + } + + private fun decodeEnabledOps( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val flag = buffer.g1Alt3() + blocks += EnabledOpsExtendedInfo(flag) + } + + private fun decodeBodyCustomisationV3( + 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..(count) + for (i in 0..(count) + 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.g1Alt2() + 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.g1Alt1() + 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.g1sAlt1() + val deltaZ1 = buffer.g1sAlt3() + val deltaX2 = buffer.g1s() + val deltaZ2 = buffer.g1sAlt1() + val delay1 = buffer.g2Alt1() + val delay2 = buffer.g2Alt2() + val direction = buffer.g2Alt1() + 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.g1Alt1() + 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 decodeFacing( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val flag = buffer.g1Alt1() + val walkType = + when (val walkTypeValue = flag and 0x7) { + 0 -> FaceExtendedInfo.WalkType.CancelOnWalk + 1 -> FaceExtendedInfo.WalkType.TurnOnWalk + else -> error("Unknown walk type: $walkTypeValue") + } + val kind = flag ushr 3 and 0x7 + val instant = (flag ushr 6 and 0x1) == 1 + when (kind) { + 0 -> { + val entityType = + when (val entityTypeValue = buffer.gSmart1or2()) { + 0 -> FaceExtendedInfo.EntityType.None + 1 -> FaceExtendedInfo.EntityType.Npc + 2 -> FaceExtendedInfo.EntityType.Player + 3 -> FaceExtendedInfo.EntityType.WorldEntity + else -> error("Unknown entity type: $entityTypeValue") + } + val index = buffer.gSmart2or4null() + val fallbackAngle = buffer.gSmart1or2() + blocks += + FaceExtendedInfo( + FaceExtendedInfo.EntityFaceType( + entityType, + index, + fallbackAngle, + ), + walkType, + instant, + ) + } + 1 -> { + val x = buffer.gSmart1or2() + val z = buffer.gSmart1or2() + val bitpackedSize = buffer.gSmart1or2() + val sizeX = bitpackedSize and 0xF + val sizeZ = bitpackedSize ushr 4 and 0xF + blocks += + FaceExtendedInfo( + FaceExtendedInfo.LocFaceType( + x, + z, + sizeX, + sizeZ, + ), + walkType, + instant, + ) + } + 2 -> { + val angle = buffer.gSmart1or2() + blocks += + FaceExtendedInfo( + FaceExtendedInfo.AngleFaceType( + angle, + ), + walkType, + instant, + ) + } + 3 -> { + blocks += + FaceExtendedInfo( + FaceExtendedInfo.ResetFaceType, + walkType, + instant, + ) + } + else -> error("Unknown kind: $kind") + } + } + + private fun processHighResolution(buffer: BitBuf) { + val count = buffer.gBits(8) + if (count < transmittedNPCCount) { + for (i in count.. { + transmittedNPC[transmittedNPCCount++] = index + npc.lastTransmitCycle = cycle + npc.clearMovement() + 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 -> { + npc.clearMovement() + deletedNPC[deletedNPCCount++] = index + updates[index] = UpdateType.HIGH_RESOLUTION_TO_LOW_RESOLUTION + } + } + } + } + + private fun processLowResolution( + large: Boolean, + buffer: BitBuf, + baseCoord: CoordGrid, + version: Int, + ) { + 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: Int + val deltaZ: Int + val jump: Int + if (version == 6) { + val hasSpawnCycle = buffer.gBits(1) == 1 + if (hasSpawnCycle) { + val index = buffer.gBits(2) + npc.spawnCycle = buffer.gBits(spawnClockBitcodes[index]) + } + + val idBitCount = buffer.gBits(2) + npc.id = buffer.gBits(typeBitcodes[idBitCount]) + + val extendedInfo = buffer.gBits(1) + deltaX = decodeDelta(large, buffer) + val angle = NPC_TURN_ANGLES[buffer.gBits(3)] + jump = buffer.gBits(1) + deltaZ = decodeDelta(large, buffer) + if (isNew) { + npc.turnAngle = angle + npc.angle = angle + } + // reset bas + if (npc.turnSpeed == 0) { + npc.angle = 0 + } + if (extendedInfo == 1) { + this.extraUpdateNPC[extraUpdateNPCCount++] = index + } + } else { + val hasSpawnCycle = buffer.gBits(1) == 1 + if (hasSpawnCycle) { + npc.spawnCycle = buffer.gBits(32) + } + + npc.id = buffer.gBits(14) + val angle = NPC_TURN_ANGLES[buffer.gBits(3)] + deltaX = decodeDelta(large, buffer) + jump = buffer.gBits(1) + deltaZ = decodeDelta(large, buffer) + val extendedInfo = buffer.gBits(1) + if (isNew) { + npc.turnAngle = angle + npc.angle = angle + } + // reset bas + if (npc.turnSpeed == 0) { + npc.angle = 0 + } + if (extendedInfo == 1) { + this.extraUpdateNPC[extraUpdateNPCCount++] = index + } + } + 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 clearMovement() { + this.moveSpeed = MoveSpeed.STATIONARY + this.jump = false + } + + 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 val spawnClockBitcodes = intArrayOf(18, 19, 20, 32) + private val typeBitcodes = intArrayOf(12, 14, 17, 24) + private const val EXTENDED_SHORT: Int = 0x20 + private const val EXTENDED_MEDIUM: Int = 0x1000 + private const val EXTENDED_INT: Int = 0x40_000 + + private const val LEVEL_CHANGE: Int = 0x800 + private const val SEQUENCE: Int = 0x4 + private const val NAME_CHANGE: Int = 0x100 + private const val OPS: Int = 0x400 + private const val SPOTANIM: Int = 0x2 + private const val SPOTANIM_OLD: Int = 0x400_000 + private const val HEADBARS: Int = 0x1_000_000 + private const val BAS_CHANGE: Int = 0x200_000 + private const val SAY: Int = 0x10 + private const val EXACT_MOVE: Int = 0x2000 + private const val HITMARKS: Int = 0x20_000 + private const val TRANSFORMATION: Int = 0x8 + private const val FACING: Int = 0x80 + private const val HEADICON_CUSTOMISATION: Int = 0x10_000 + private const val BODY_CUSTOMISATION_V2: Int = 0x100_000 + private const val BODY_CUSTOMISATION_V3: Int = 0x2_000_000 + private const val HEAD_CUSTOMISATION: Int = 0x80_000 + private const val TINTING: Int = 0x200 + private const val NPC_TRANSPARENCY: Int = 0x8000 + private const val NPC_FREEZE: Int = 0x1 + + private const val UNUSED_FLAGS = 0x800000 or 0x4000 or 0x40 // 0x10000 or 0x2000 or 0x10 or 0x4 + + private enum class UpdateType { + IDLE, + LOW_RESOLUTION_TO_HIGH_RESOLUTION, + HIGH_RESOLUTION_TO_LOW_RESOLUTION, + ACTIVE, + } + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt new file mode 100644 index 000000000..e1dda8f83 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt @@ -0,0 +1,1198 @@ +package net.rsprox.protocol.v241.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.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.PlayerResetExtendedInfo +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.FaceExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.FacePathingEntityExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.FreezeExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.Headbar +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.HeadbarExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.Hit +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.HitmarkExtendedInfo +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 +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.TransparencyExtendedInfo + +@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 UNUSED_FLAGS != 0) { + throw IllegalStateException("Unused flags used!") + } + + if (flags and SPOTANIM != 0) { + decodeSpotanims(buffer, blocks) + } + if (flags and CHAT != 0) { + decodeChat(buffer, blocks) + } + if (flags and HEADBARS != 0) { + decodeHeadbar(buffer, blocks) + } + if (flags and APPEARANCE != 0) { + val len = buffer.g1Alt3() + val data = ByteArray(len) + buffer.gdataAlt1(data) + decodeAppearance(Unpooled.wrappedBuffer(data).toJagByteBuf(), blocks) + } + if (flags and PLAYER_FREEZE != 0) { + decodeFreeze(buffer, blocks) + } + if (flags and FACE != 0) { + decodeFacing(buffer, blocks) + } + if (flags and NAME_EXTRAS != 0) { + decodeNameExtras(buffer, blocks) + } + if (flags and MOVE_SPEED != 0) { + decodeMoveSpeed(buffer, blocks) + } + if (flags and TEMP_MOVE_SPEED != 0) { + decodeTemporaryMoveSpeed(buffer, blocks) + } + if (flags and SPOTANIM_OLD != 0) { + decodeSpotanimsOld(buffer, blocks) + } + if (flags and PLAYER_TRANSPARENCY != 0) { + decodeTransparency(buffer, blocks) + } + if (flags and HITMARKS != 0) { + decodeHitmark(buffer, blocks) + } + if (flags and EXACT_MOVE != 0) { + decodeExactMove(buffer, blocks) + } + if (flags and SEQUENCE != 0) { + decodeSequence(buffer, blocks) + } + if (flags and TINTING != 0) { + decodeTinting(buffer, blocks) + } + if (flags and PLAYER_RESET != 0) { + decodePlayerReset(buffer, blocks) + } + if (flags and SAY != 0) { + decodeSay(buffer, blocks) + } + } + + private fun decodeMoveSpeed( + buffer: JagByteBuf, + blocks: MutableList, + ) { + blocks += MoveSpeedExtendedInfo(buffer.g1sAlt3()) + } + + private fun decodeTemporaryMoveSpeed( + buffer: JagByteBuf, + blocks: MutableList, + ) { + blocks += TemporaryMoveSpeedExtendedInfo(buffer.g1sAlt2()) + } + + private fun decodeSequence( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val id = buffer.g2Alt3() + 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 decodeFacing( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val flag = buffer.g1() + val walkType = + when (val walkTypeValue = flag and 0x7) { + 0 -> FaceExtendedInfo.WalkType.CancelOnWalk + 1 -> FaceExtendedInfo.WalkType.TurnOnWalk + else -> error("Unknown walk type: $walkTypeValue") + } + val kind = flag ushr 3 and 0x7 + val instant = (flag ushr 6 and 0x1) == 1 + when (kind) { + 0 -> { + val entityType = + when (val entityTypeValue = buffer.gSmart1or2()) { + 0 -> FaceExtendedInfo.EntityType.None + 1 -> FaceExtendedInfo.EntityType.Npc + 2 -> FaceExtendedInfo.EntityType.Player + 3 -> FaceExtendedInfo.EntityType.WorldEntity + else -> error("Unknown entity type: $entityTypeValue") + } + val index = buffer.gSmart2or4null() + val fallbackAngle = buffer.gSmart1or2() + blocks += + FaceExtendedInfo( + FaceExtendedInfo.EntityFaceType( + entityType, + index, + fallbackAngle, + ), + walkType, + instant, + ) + } + 1 -> { + val x = buffer.gSmart1or2() + val z = buffer.gSmart1or2() + val bitpackedSize = buffer.gSmart1or2() + val sizeX = bitpackedSize and 0xF + val sizeZ = bitpackedSize ushr 4 and 0xF + blocks += + FaceExtendedInfo( + FaceExtendedInfo.LocFaceType( + x, + z, + sizeX, + sizeZ, + ), + walkType, + instant, + ) + } + 2 -> { + val angle = buffer.gSmart1or2() + blocks += + FaceExtendedInfo( + FaceExtendedInfo.AngleFaceType( + angle, + ), + walkType, + instant, + ) + } + 3 -> { + blocks += + FaceExtendedInfo( + FaceExtendedInfo.ResetFaceType, + walkType, + instant, + ) + } + else -> error("Unknown kind: $kind") + } + } + + 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.g2() + val modIcon = buffer.g1Alt1() + val autotyper = buffer.g1Alt2() == 1 + val huffmanLength = buffer.g1Alt1() + val data = ByteArray(huffmanLength) + buffer.gdataAlt3(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.g2Alt3() + blocks += + ExactMoveExtendedInfo( + deltaX1, + deltaZ1, + delay1, + deltaX2, + deltaZ2, + delay2, + direction, + ) + } + + private fun decodeSpotanimsOld( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val spotanims = mutableMapOf() + val count = buffer.g1Alt3() + for (i in 0.., + ) { + val spotanims = mutableMapOf() + val count = buffer.g1Alt1() + for (i in 0.., + ) { + val hitCount = buffer.g1() + val hits = ArrayList(hitCount) + for (i in 0.., + ) { + val headbarCount = buffer.g1Alt3() + val headbars = ArrayList(headbarCount) + for (i in 0.. 0) { + buffer.g1Alt2() + } else { + startFill + } + headbars += + Headbar( + type, + startFill, + endFill, + startTime, + endTime, + ) + } + blocks += HeadbarExtendedInfo(headbars) + } + + private fun decodePlayerReset( + buffer: JagByteBuf, + blocks: MutableList, + ) { + blocks += PlayerResetExtendedInfo(buffer.g1Alt2()) + } + + private fun decodeFreeze( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val delay = buffer.g2Alt2() + val duration = buffer.g2Alt1() + val cancelSequence = buffer.g1Alt2() == 1 + blocks += FreezeExtendedInfo(delay, duration, cancelSequence) + } + + private fun decodeTransparency( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val start = buffer.g2sAlt2() + val end = buffer.g2sAlt3() + val startTransparency = buffer.g1sAlt3() + val endTransparency = buffer.g1sAlt3() + val useStartTransparency = buffer.g1Alt3() == 1 + blocks += + TransparencyExtendedInfo( + start, + end, + startTransparency, + endTransparency, + useStartTransparency, + ) + } + + private fun decodeTinting( + buffer: JagByteBuf, + blocks: MutableList, + ) { + val start = buffer.g2Alt1() + val end = buffer.g2Alt3() + val hue = buffer.g1sAlt2() + val saturation = buffer.g1sAlt1() + val lightness = buffer.g1s() + 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 + } + } + + // Note: This branch is server-version checked, but we're pushing + // RSProx out after revision 237 is forced, + // meaning we can check this. RSprot does not support it either. + if (wearModels) { + manWear = buffer.g4() + womanWear = buffer.g4() + } + + if (headModels) { + manHead = buffer.g4() + womanHead = buffer.g4() + } + 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 = 0x2000 + + private const val SEQUENCE = 0x10 + private const val APPEARANCE = 0x4 + private const val FACE = 0x40 + private const val SAY = 0x1 + private const val CHAT = 0x1000 + private const val NAME_EXTRAS = 0x200 + private const val MOVE_SPEED = 0x4000 + private const val TINTING = 0x400 + private const val EXACT_MOVE = 0x8000 + private const val PLAYER_TRANSPARENCY = 0x10000 + private const val TEMP_MOVE_SPEED = 0x800 + private const val SPOTANIM_OLD = 0x80000 + private const val SPOTANIM = 0x20 + private const val HEADBARS = 0x20000 + private const val HITMARKS = 0x100000 + + private const val PLAYER_FREEZE = 0x40_000 + private const val PLAYER_RESET = 0x8 + private const val UNUSED_FLAGS = 0x2 + + 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, + } + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/worldentityinfo/WorldEntityInfoClient.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/worldentityinfo/WorldEntityInfoClient.kt new file mode 100644 index 000000000..bbf1b9feb --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/worldentityinfo/WorldEntityInfoClient.kt @@ -0,0 +1,650 @@ +package net.rsprox.protocol.v241.game.outgoing.model.info.worldentityinfo + +import net.rsprot.buffer.JagByteBuf +import net.rsprox.protocol.common.CoordFine +import net.rsprox.protocol.common.CoordGrid +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.EnabledOpsExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.ExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.shared.extendedinfo.SequenceExtendedInfo +import net.rsprox.protocol.game.outgoing.model.info.worldentityinfo.WorldEntityInfo +import net.rsprox.protocol.game.outgoing.model.info.worldentityinfo.WorldEntityInfoDecoder +import net.rsprox.protocol.game.outgoing.model.info.worldentityinfo.WorldEntityInfoV1 +import net.rsprox.protocol.game.outgoing.model.info.worldentityinfo.WorldEntityInfoV2 +import net.rsprox.protocol.game.outgoing.model.info.worldentityinfo.WorldEntityInfoV3 +import net.rsprox.protocol.game.outgoing.model.info.worldentityinfo.WorldEntityInfoV4 +import net.rsprox.protocol.game.outgoing.model.info.worldentityinfo.WorldEntityInfoV5 +import net.rsprox.protocol.game.outgoing.model.info.worldentityinfo.WorldEntityInfoV6 +import net.rsprox.protocol.game.outgoing.model.info.worldentityinfo.WorldEntityInfoV7 +import net.rsprox.protocol.game.outgoing.model.info.worldentityinfo.WorldEntityMoveSpeed +import net.rsprox.protocol.game.outgoing.model.info.worldentityinfo.WorldEntityUpdateType + +public class WorldEntityInfoClient : WorldEntityInfoDecoder { + private var transmittedWorldEntityCount: Int = 0 + private val transmittedWorldEntity: IntArray = IntArray(25) + private val worldEntity: Array = arrayOfNulls(4096) + private val earlyRemovals: MutableSet = mutableSetOf() + private val updates: MutableMap = mutableMapOf() + + override fun decode( + buffer: JagByteBuf, + baseCoord: CoordGrid, + version: Int, + ): WorldEntityInfo { + updates.clear() + earlyRemovals.clear() + if (version >= 7) { + decodeHighResolutionV5(buffer) + decodeLowResolutionV5(buffer, baseCoord) + } else if (version >= 6) { + decodeHighResolutionV4(buffer) + decodeLowResolutionV4(buffer, baseCoord) + } else if (version >= 5) { + decodeHighResolutionV3(buffer) + decodeLowResolutionV3(buffer, baseCoord) + } else if (version >= 3) { + decodeHighResolutionV2(buffer) + decodeLowResolutionV2(buffer, baseCoord, version) + } else { + decodeHighResolutionV1(buffer) + decodeLowResolutionV1(buffer, baseCoord) + } + val updates = updates.toMap() + return when (version) { + 1 -> WorldEntityInfoV1(updates) + 2 -> WorldEntityInfoV2(updates) + 3 -> WorldEntityInfoV3(updates) + 4 -> WorldEntityInfoV4(updates) + 5 -> WorldEntityInfoV5(earlyRemovals, updates) + 6 -> WorldEntityInfoV6(earlyRemovals, updates) + 7 -> WorldEntityInfoV7(earlyRemovals, updates) + else -> error("Invalid version: $version") + } + } + + private fun decodeHighResolutionV1(buffer: JagByteBuf) { + val count = buffer.g1() + if (count < transmittedWorldEntityCount) { + throw RuntimeException("dang") + } + if (count > transmittedWorldEntityCount) { + throw RuntimeException("dang!") + } + this.transmittedWorldEntityCount = 0 + for (i in 0.. transmittedWorldEntityCount) { + throw RuntimeException("dang!") + } + this.transmittedWorldEntityCount = 0 + for (i in 0.. transmittedWorldEntityCount) { + throw RuntimeException("dang!") + } + this.transmittedWorldEntityCount = 0 + for (i in 0.. transmittedWorldEntityCount) { + throw RuntimeException("dang!") + } + this.transmittedWorldEntityCount = 0 + for (i in 0.. transmittedWorldEntityCount) { + throw RuntimeException("dang!") + } + this.transmittedWorldEntityCount = 0 + for (i in 0.. { + val flags = buffer.g1() + if (flags == 0) { + return emptyList() + } + val blocks = mutableListOf() + if (flags and 0x2 != 0) { + val id = buffer.g2() + val delay = buffer.g1() + blocks += SequenceExtendedInfo(id, delay) + } + + if (flags and 0x1 != 0) { + blocks += EnabledOpsExtendedInfo(buffer.g1()) + } + return blocks + } + + private fun decodeWorldEntityInfoExtendedInfoObfuscated( + buffer: JagByteBuf, + flags: Int, + ): List { + if (flags == 0) { + return emptyList() + } + val blocks = mutableListOf() + if (flags and 0x1 != 0) { + val id = buffer.g2() + val delay = buffer.g1Alt1() + blocks += SequenceExtendedInfo(id, delay) + } + if (flags and 0x2 != 0) { + blocks += EnabledOpsExtendedInfo(buffer.g1Alt1()) + } + return blocks + } + + private fun decodeAngledCoordFineComponent( + buffer: JagByteBuf, + bitpackedOpcode: Int, + shift: Int, + ): Int { + val opcode = (bitpackedOpcode shr shift) and 0x3 + return when (opcode) { + 3 -> buffer.g4() + 2 -> buffer.g2s() + 1 -> buffer.g1s() + else -> 0 + } + } + + private fun decodeLowResolutionV1( + buffer: JagByteBuf, + baseCoord: CoordGrid, + ) { + while (buffer.isReadable(10)) { + val index = buffer.g2() + this.transmittedWorldEntity[this.transmittedWorldEntityCount++] = index + val sizeX = buffer.g1() * 8 + val sizeZ = buffer.g1() * 8 + val xInBuildArea = buffer.g1() + val zInBuildArea = buffer.g1() + val angle = buffer.g2() + val unknownProperty = buffer.g2() + val coord = CoordGrid(baseCoord.level, baseCoord.x + xInBuildArea, baseCoord.z + zInBuildArea) + val worldEntity = + WorldEntityV1( + index, + sizeX, + sizeZ, + unknownProperty, + coord, + angle, + WorldEntityMoveSpeed.ZERO, + ) + this.worldEntity[index] = worldEntity + this.updates[index] = + WorldEntityUpdateType.LowResolutionToHighResolutionV1( + sizeX, + sizeZ, + angle, + unknownProperty, + coord, + ) + } + } + + private fun decodeLowResolutionV2( + buffer: JagByteBuf, + baseCoord: CoordGrid, + version: Int, + ) { + while (buffer.isReadable(10)) { + val index = buffer.g2() + this.transmittedWorldEntity[this.transmittedWorldEntityCount++] = index + val sizeX = buffer.g1() * 8 + val sizeZ = buffer.g1() * 8 + val level = buffer.g1s() + var coordFine = CoordFine(0, 0, 0) + var angle = 0 + val bitpackedAngledCoordFineOpcodes = buffer.g1s() + if (bitpackedAngledCoordFineOpcodes != 0) { + val deltaX = decodeAngledCoordFineComponent(buffer, bitpackedAngledCoordFineOpcodes, 0) + val deltaY = decodeAngledCoordFineComponent(buffer, bitpackedAngledCoordFineOpcodes, 2) + val deltaZ = decodeAngledCoordFineComponent(buffer, bitpackedAngledCoordFineOpcodes, 4) + angle = decodeAngledCoordFineComponent(buffer, bitpackedAngledCoordFineOpcodes, 6) + coordFine = CoordFine(coordFine.x + deltaX, coordFine.y + deltaY, coordFine.z + deltaZ) + } + coordFine = + CoordFine( + (baseCoord.x shl 7) + coordFine.x, + coordFine.y, + (baseCoord.z shl 7) + coordFine.z, + ) + val centerFineOffsetX = if (version >= 4) buffer.g2s() else null + val centerFineOffsetZ = if (version >= 4) buffer.g2s() else null + val worldEntity = + WorldEntityV2( + index, + sizeX, + sizeZ, + coordFine, + angle, + level, + centerFineOffsetX, + centerFineOffsetZ, + ) + this.worldEntity[index] = worldEntity + this.updates[index] = + WorldEntityUpdateType.LowResolutionToHighResolutionV2( + sizeX, + sizeZ, + angle, + coordFine, + level, + centerFineOffsetX, + centerFineOffsetZ, + ) + } + } + + private fun decodeLowResolutionV3( + buffer: JagByteBuf, + baseCoord: CoordGrid, + ) { + while (buffer.isReadable(10)) { + val index = buffer.g2() + this.transmittedWorldEntity[this.transmittedWorldEntityCount++] = index + val sizeX = buffer.g1() * 8 + val sizeZ = buffer.g1() * 8 + val id = buffer.g2() + var coordFine = CoordFine(0, 0, 0) + var angle = 0 + val bitpackedAngledCoordFineOpcodes = buffer.g1s() + if (bitpackedAngledCoordFineOpcodes != 0) { + val deltaX = decodeAngledCoordFineComponent(buffer, bitpackedAngledCoordFineOpcodes, 0) + val deltaY = decodeAngledCoordFineComponent(buffer, bitpackedAngledCoordFineOpcodes, 2) + val deltaZ = decodeAngledCoordFineComponent(buffer, bitpackedAngledCoordFineOpcodes, 4) + angle = decodeAngledCoordFineComponent(buffer, bitpackedAngledCoordFineOpcodes, 6) + coordFine = CoordFine(coordFine.x + deltaX, coordFine.y + deltaY, coordFine.z + deltaZ) + } + coordFine = + CoordFine( + (baseCoord.x shl 7) + coordFine.x, + coordFine.y, + (baseCoord.z shl 7) + coordFine.z, + ) + val priority = buffer.g1() + val worldEntity = + WorldEntityV3( + index, + id, + sizeX, + sizeZ, + priority, + coordFine, + angle, + ) + this.worldEntity[index] = worldEntity + this.updates[index] = + WorldEntityUpdateType.LowResolutionToHighResolutionV3( + id, + sizeX, + sizeZ, + angle, + priority, + coordFine, + ) + } + } + + private fun decodeLowResolutionV4( + buffer: JagByteBuf, + baseCoord: CoordGrid, + ) { + while (buffer.isReadable) { + val index = buffer.g2() + this.transmittedWorldEntity[this.transmittedWorldEntityCount++] = index + val sizeX = buffer.g1() * 8 + val sizeZ = buffer.g1() * 8 + val id = buffer.g2() + var coordFine = CoordFine(0, 0, 0) + var angle = 0 + val bitpackedAngledCoordFineOpcodes = buffer.g1s() + if (bitpackedAngledCoordFineOpcodes != 0) { + val deltaX = decodeAngledCoordFineComponent(buffer, bitpackedAngledCoordFineOpcodes, 0) + val deltaY = decodeAngledCoordFineComponent(buffer, bitpackedAngledCoordFineOpcodes, 2) + val deltaZ = decodeAngledCoordFineComponent(buffer, bitpackedAngledCoordFineOpcodes, 4) + angle = decodeAngledCoordFineComponent(buffer, bitpackedAngledCoordFineOpcodes, 6) + coordFine = CoordFine(coordFine.x + deltaX, coordFine.y + deltaY, coordFine.z + deltaZ) + } + coordFine = + CoordFine( + (baseCoord.x shl 7) + coordFine.x, + coordFine.y, + (baseCoord.z shl 7) + coordFine.z, + ) + val priority = buffer.g1() + val worldEntity = + WorldEntityV3( + index, + id, + sizeX, + sizeZ, + priority, + coordFine, + angle, + ) + val extendedInfo = decodeWorldEntityInfoExtendedInfoUnobfuscated(buffer) + this.worldEntity[index] = worldEntity + this.updates[index] = + WorldEntityUpdateType.LowResolutionToHighResolutionV4( + id, + sizeX, + sizeZ, + angle, + priority, + coordFine, + extendedInfo, + ) + } + } + + private fun decodeLowResolutionV5( + buffer: JagByteBuf, + baseCoord: CoordGrid, + ) { + while (buffer.isReadable) { + val index = buffer.g2() + // Note: If serverVersion < 237, add +1 to index + this.transmittedWorldEntity[this.transmittedWorldEntityCount++] = index + val extendedInfoFlags = buffer.g1Alt3() + val packedSize = buffer.g1Alt3() + val priority = buffer.g1Alt1() + val id = buffer.g2sAlt1() + + var coordFine = CoordFine(0, 0, 0) + var angle = 0 + val bitpackedAngledCoordFineOpcodes = buffer.g1s() + if (bitpackedAngledCoordFineOpcodes != 0) { + val deltaX = decodeAngledCoordFineComponent(buffer, bitpackedAngledCoordFineOpcodes, 0) + val deltaY = decodeAngledCoordFineComponent(buffer, bitpackedAngledCoordFineOpcodes, 2) + val deltaZ = decodeAngledCoordFineComponent(buffer, bitpackedAngledCoordFineOpcodes, 4) + angle = decodeAngledCoordFineComponent(buffer, bitpackedAngledCoordFineOpcodes, 6) + coordFine = CoordFine(coordFine.x + deltaX, coordFine.y + deltaY, coordFine.z + deltaZ) + } + coordFine = + CoordFine( + (baseCoord.x shl 7) + coordFine.x, + coordFine.y, + (baseCoord.z shl 7) + coordFine.z, + ) + + val sizeX = (packedSize ushr 4 and 0xF) * 8 + val sizeZ = (packedSize and 0xF) * 8 + val worldEntity = + WorldEntityV3( + index, + id, + sizeX, + sizeZ, + priority, + coordFine, + angle, + ) + val extendedInfo = decodeWorldEntityInfoExtendedInfoObfuscated(buffer, extendedInfoFlags) + this.worldEntity[index] = worldEntity + this.updates[index] = + WorldEntityUpdateType.LowResolutionToHighResolutionV4( + id, + sizeX, + sizeZ, + angle, + priority, + coordFine, + extendedInfo, + ) + } + } + + @Suppress("unused") + private class WorldEntityV1( + val index: Int, + val sizeX: Int, + val sizeZ: Int, + val unknownProperty: Int, + var coordGrid: CoordGrid, + var angle: Int, + var moveSpeed: WorldEntityMoveSpeed, + ) + + @Suppress("unused") + private class WorldEntityV2( + val index: Int, + val sizeX: Int, + val sizeZ: Int, + var coordFine: CoordFine, + var angle: Int, + val level: Int, + val centerFineOffsetX: Int?, + val centerFineOffsetZ: Int?, + ) + + @Suppress("unused") + private class WorldEntityV3( + val index: Int, + val id: Int, + val sizeX: Int, + val sizeZ: Int, + val priority: Int, + var coordFine: CoordFine, + var angle: Int, + ) +} From 4b3b486d9fa151baa467d45971b20fcbd7f63e4e Mon Sep 17 00:00:00 2001 From: Kris Date: Sun, 20 Sep 2026 21:09:32 +0300 Subject: [PATCH 2/7] refactor: avoid edge case erroring for session population --- .../net/rsprox/gui/sessions/SessionPanel.kt | 72 ++++++++-------- .../net/rsprox/proxy/binary/BinaryBlob.kt | 9 +- .../proxy/server/ServerGameLoginDecoder.kt | 2 +- .../transcriber/LiveTranscriberSession.kt | 83 ++++++++++++++----- .../net/rsprox/shared/SessionMonitor.kt | 3 + 5 files changed, 111 insertions(+), 58 deletions(-) diff --git a/gui/proxy-tool/src/main/kotlin/net/rsprox/gui/sessions/SessionPanel.kt b/gui/proxy-tool/src/main/kotlin/net/rsprox/gui/sessions/SessionPanel.kt index 857dd62b4..ae7fbc6b4 100644 --- a/gui/proxy-tool/src/main/kotlin/net/rsprox/gui/sessions/SessionPanel.kt +++ b/gui/proxy-tool/src/main/kotlin/net/rsprox/gui/sessions/SessionPanel.kt @@ -53,8 +53,6 @@ public class SessionPanel( public var metrics: SessionMetrics = SessionMetrics() private var paused = false private var streamNode: StreamTreeTableNode? = null - private var tickNode: TickTreeTableNode? = null - private var lastCycle = -1 private var rs3Connected = false public val isActive: Boolean get() = if (type.isRs3) rs3Connected else streamNode != null @@ -176,20 +174,14 @@ public class SessionPanel( if (streamNode != null) { - // Replace the stream node directly instead of purging it one by one - val oldHeader = streamNode.header - val streamNode = - if (oldHeader != - null - ) { - StreamTreeTableNode(oldHeader) - } else { - StreamTreeTableNode(streamNode.label ?: "") - } + // Retain the node identity used by this recording's delayed callbacks. + for (i in streamNode.childCount - 1 downTo 0) { + streamNode.remove(i) + } + streamNode.tickNode = null addNodeAndExpand(streamNode, root, root.childCount) this@SessionPanel.streamNode = streamNode } - this@SessionPanel.tickNode = null } // make all buttons centered toolbar.add(clearAllButton) @@ -397,6 +389,7 @@ public class SessionPanel( } private inner class UiSessionMonitor : SessionMonitor { + private var sessionStreamNode: StreamTreeTableNode? = null private var lastCacheProvider: CacheProvider? = null private val formatter = OmitFilteredPropertyTreeFormatter( @@ -406,31 +399,31 @@ public class SessionPanel( ) { this.lastCacheProvider?.get() ?: error("Cache unavailable") }, ) + override fun forSession(header: BinaryHeader): SessionMonitor = UiSessionMonitor() + override fun onCacheUpdate(cacheProvider: CacheProvider) { this.lastCacheProvider = cacheProvider } override fun onLogin(header: BinaryHeader) { - // Update the session metrics data. - metrics.worldName = "World ${header.worldId} (${header.worldActivity})" - notifyMetricsChanged() - // Create a new root node for the logged in session. SwingUtilities.invokeLater { + metrics.worldName = "World ${header.worldId} (${header.worldActivity})" val streamNode = StreamTreeTableNode(header) addNodeAndExpand(streamNode, root, root.childCount) + sessionStreamNode = streamNode this@SessionPanel.streamNode = streamNode + notifyMetricsChanged() } } override fun onLogout(header: BinaryHeader) { - // Update the session metrics data. - metrics.username = "" - notifyMetricsChanged() - - // Clear the stream node. SwingUtilities.invokeLater { + if (streamNode !== sessionStreamNode) return@invokeLater + metrics.username = "" streamNode = null + // Keep sessionStreamNode for final rows still queued by the worker. + notifyMetricsChanged() } } @@ -445,11 +438,14 @@ public class SessionPanel( } override fun onNameUpdate(name: String) { - metrics.username = name - sessionsPanel.updateTabTitle(this@SessionPanel, name) - notifyMetricsChanged() - if (metrics.userId != -1L && metrics.userHash != -1L) { - App.service.updateCredentials(name, metrics.userId, metrics.userHash) + SwingUtilities.invokeLater { + if (streamNode !== sessionStreamNode || streamNode == null) return@invokeLater + metrics.username = name + sessionsPanel.updateTabTitle(this@SessionPanel, name) + notifyMetricsChanged() + if (metrics.userId != -1L && metrics.userHash != -1L) { + App.service.updateCredentials(name, metrics.userId, metrics.userHash) + } } } @@ -467,19 +463,24 @@ public class SessionPanel( ) { if (paused) return SwingUtilities.invokeLater { - val tickNode = findOrCreateTickNode(cycle) + val owner = sessionStreamNode ?: return@invokeLater + // Only discard rows when the user explicitly cleared their recording. + if (owner.parent !== root) return@invokeLater + val tickNode = findOrCreateTickNode(cycle, owner) createMessageNode(tickNode, cycle, property, formatter) } } } - private fun findOrCreateTickNode(tickNumber: Int): AbstractMutableTreeTableNode { - val streamNode = streamNode!! - var tickNode = tickNode - if (tickNode == null || lastCycle != tickNumber) { - lastCycle = tickNumber + private fun findOrCreateTickNode( + tickNumber: Int, + streamNode: StreamTreeTableNode = checkNotNull(this.streamNode), + ): AbstractMutableTreeTableNode { + var tickNode = streamNode.tickNode + if (tickNode == null || streamNode.lastCycle != tickNumber) { + streamNode.lastCycle = tickNumber tickNode = TickTreeTableNode(tickNumber) - this.tickNode = tickNode + streamNode.tickNode = tickNode addNodeAndExpand(tickNode, streamNode, streamNode.childCount) } return tickNode @@ -504,6 +505,9 @@ public class SessionPanel( val header: BinaryHeader?, val label: String?, ) : SessionBaseTreeTableNode() { + var tickNode: TickTreeTableNode? = null + var lastCycle: Int = -1 + constructor(header: BinaryHeader) : this(header, null) constructor(label: String) : this(null, label) diff --git a/proxy/src/main/kotlin/net/rsprox/proxy/binary/BinaryBlob.kt b/proxy/src/main/kotlin/net/rsprox/proxy/binary/BinaryBlob.kt index a4bc5f3e2..8b3a6cdf1 100644 --- a/proxy/src/main/kotlin/net/rsprox/proxy/binary/BinaryBlob.kt +++ b/proxy/src/main/kotlin/net/rsprox/proxy/binary/BinaryBlob.kt @@ -190,9 +190,14 @@ public data class BinaryBlob( } public fun reopen() { - liveSession?.flush() closed.set(false) - this.monitor.onLogin(header) + val session = liveSession + if (session == null) { + this.monitor.onLogin(header) + } else { + // Finish the old segment before the monitor creates the reconnect's UI stream. + session.flush { this.monitor.onLogin(header) } + } this.closeTimestamp = 0L } diff --git a/proxy/src/main/kotlin/net/rsprox/proxy/server/ServerGameLoginDecoder.kt b/proxy/src/main/kotlin/net/rsprox/proxy/server/ServerGameLoginDecoder.kt index 1cf53c133..4e741bd7e 100644 --- a/proxy/src/main/kotlin/net/rsprox/proxy/server/ServerGameLoginDecoder.kt +++ b/proxy/src/main/kotlin/net/rsprox/proxy/server/ServerGameLoginDecoder.kt @@ -331,7 +331,7 @@ public class ServerGameLoginDecoder( val encodeSeed = clientChannel.getAndDropEncodeSeed() val key = XteaKey(encodeSeed) val port = clientChannel.getPort() - val sessionMonitor = connections.getSessionMonitor(port) + val sessionMonitor = connections.getSessionMonitor(port).forSession(header) sessionMonitor.onLogin(header) sessionMonitor.onUserInformationUpdate(userId, userHash) val blob = diff --git a/proxy/src/main/kotlin/net/rsprox/proxy/transcriber/LiveTranscriberSession.kt b/proxy/src/main/kotlin/net/rsprox/proxy/transcriber/LiveTranscriberSession.kt index a5bbef043..a24f1c98f 100644 --- a/proxy/src/main/kotlin/net/rsprox/proxy/transcriber/LiveTranscriberSession.kt +++ b/proxy/src/main/kotlin/net/rsprox/proxy/transcriber/LiveTranscriberSession.kt @@ -13,8 +13,6 @@ import net.rsprox.transcriber.Packet import net.rsprox.transcriber.TranscriberRunner import net.rsprox.transcriber.state.KeyStorage import net.rsprox.transcriber.state.SessionTracker -import java.util.Queue -import java.util.concurrent.ConcurrentLinkedQueue public class LiveTranscriberSession( private val session: Session, @@ -26,7 +24,7 @@ public class LiveTranscriberSession( ) { @Suppress("PLATFORM_CLASS_MAPPED_TO_KOTLIN") private val lock: Object = Object() - private val queue: Queue = ConcurrentLinkedQueue() + private val queue: ArrayDeque = ArrayDeque() @Volatile private var running: Boolean = true @@ -51,9 +49,12 @@ public class LiveTranscriberSession( direction: StreamDirection, payload: ByteBuf, ) { - if (!running) return - queue.offer(UnidentifiedPacket(direction, payload)) synchronized(lock) { + if (!running) { + payload.release() + return + } + queue.addLast(UnidentifiedPacket(direction, payload)) lock.notifyAll() } } @@ -72,8 +73,7 @@ public class LiveTranscriberSession( val packet = Packet(unidentified.direction, result.prot, result.message) packetList += packet if (result.prot.toString() == "SERVER_TICK_END") { - executeRunner(runner.preprocess(packetList)) - packetList.clear() + flushPackets() } } } catch (t: Throwable) { @@ -114,42 +114,83 @@ public class LiveTranscriberSession( private fun launchThread(): Thread { val thread = Thread { - // Preload gameval types as they take quite long to load up - // This will block the decoding and transcribing during it, - // while still allowing login to take place - cacheProvider.get().allGameValTypes() - while (this.running) { - while (queue.isNotEmpty()) { - val next = queue.poll() - decode(next) + try { + // Preload gameval types while allowing packets to queue during login. + cacheProvider.get().allGameValTypes() + while (true) { + val next = + synchronized(lock) { + while (queue.isEmpty() && running) { + lock.wait() + } + queue.removeFirstOrNull() + } ?: break + when (next) { + is UnidentifiedPacket -> decode(next) + is Flush -> { + try { + flushPackets() + } finally { + next.afterFlush() + } + } + } } + flushPackets() + } catch (t: Throwable) { + logger.error(t) { "Live transcription stopped" } + } finally { synchronized(lock) { - lock.wait() + running = false + for (pending in queue) { + if (pending is UnidentifiedPacket) { + pending.payload.release() + } + } + queue.clear() } + packetList.clear() } } thread.start() return thread } - public fun flush() { + public fun flush(afterFlush: () -> Unit = {}) { synchronized(lock) { - executeRunner(runner.preprocess(packetList)) - packetList.clear() + if (running) { + // The worker owns packetList and session state, including on disconnect. + queue.addLast(Flush(afterFlush)) + lock.notifyAll() + return + } } + afterFlush() + } + + private fun flushPackets() { + if (packetList.isEmpty()) return + val packets = packetList.toList() + // A failed transcript must not replay partially applied state on the next tick. + packetList.clear() + executeRunner(runner.preprocess(packets)) } public fun shutdown() { - this.running = false synchronized(lock) { + this.running = false lock.notifyAll() } } + private sealed interface PendingEvent + + private class Flush(val afterFlush: () -> Unit) : PendingEvent + private class UnidentifiedPacket( val direction: StreamDirection, val payload: ByteBuf, - ) + ) : PendingEvent private companion object { private val logger = InlineLogger() diff --git a/shared/src/main/kotlin/net/rsprox/shared/SessionMonitor.kt b/shared/src/main/kotlin/net/rsprox/shared/SessionMonitor.kt index e68043561..8b2bb2d3f 100644 --- a/shared/src/main/kotlin/net/rsprox/shared/SessionMonitor.kt +++ b/shared/src/main/kotlin/net/rsprox/shared/SessionMonitor.kt @@ -4,6 +4,9 @@ import net.rsprox.cache.api.CacheProvider import net.rsprox.shared.property.RootProperty public interface SessionMonitor { + /** Bind delayed callbacks to one recording rather than the latest active login. */ + public fun forSession(header: T): SessionMonitor = this + public fun onLogin(header: T) public fun onLogout(header: T) From e119c87b14db3097cdbac694bf8c939739ff12d8 Mon Sep 17 00:00:00 2001 From: Kris Date: Sun, 20 Sep 2026 22:02:18 +0300 Subject: [PATCH 3/7] feat: revision 241 support --- .../decoder/codec/buttons/If1ButtonDecoder.kt | 2 +- .../decoder/codec/buttons/IfButtonDDecoder.kt | 10 +- .../decoder/codec/buttons/IfButtonTDecoder.kt | 14 +- .../decoder/codec/buttons/IfButtonXDecoder.kt | 2 +- .../codec/buttons/IfScriptTriggerDecoder.kt | 4 +- .../decoder/codec/buttons/IfSubOpDecoder.kt | 2 +- .../events/EventCameraPositionDecoder.kt | 4 +- .../codec/events/EventKeyboardDecoder.kt | 2 +- .../codec/events/EventMouseClickV2Decoder.kt | 4 +- .../friendchat/FriendChatSetRankDecoder.kt | 2 +- .../decoder/codec/locs/OpLoc1V2Decoder.kt | 8 +- .../decoder/codec/locs/OpLoc2V2Decoder.kt | 6 +- .../decoder/codec/locs/OpLoc3V2Decoder.kt | 8 +- .../decoder/codec/locs/OpLoc4V2Decoder.kt | 8 +- .../decoder/codec/locs/OpLoc5V2Decoder.kt | 10 +- .../decoder/codec/locs/OpLoc6Decoder.kt | 2 +- .../decoder/codec/locs/OpLocTDecoder.kt | 14 +- .../codec/misc/client/SendPingReplyDecoder.kt | 4 +- .../codec/misc/user/BugReportDecoder.kt | 4 +- .../codec/misc/user/ClickWorldMapDecoder.kt | 2 +- .../codec/misc/user/IfCrmViewOpDecoder.kt | 8 +- .../codec/misc/user/MoveGameClickDecoder.kt | 6 +- .../misc/user/MoveMinimapClickDecoder.kt | 6 +- .../codec/misc/user/TeleportDecoder.kt | 6 +- .../decoder/codec/npcs/OpNpc1V2Decoder.kt | 6 +- .../decoder/codec/npcs/OpNpc2V2Decoder.kt | 6 +- .../decoder/codec/npcs/OpNpc3V2Decoder.kt | 4 +- .../decoder/codec/npcs/OpNpc4V2Decoder.kt | 4 +- .../decoder/codec/npcs/OpNpc5V2Decoder.kt | 6 +- .../decoder/codec/npcs/OpNpc6Decoder.kt | 2 +- .../decoder/codec/npcs/OpNpcTDecoder.kt | 10 +- .../decoder/codec/objs/OpObj1V2Decoder.kt | 8 +- .../decoder/codec/objs/OpObj2V2Decoder.kt | 6 +- .../decoder/codec/objs/OpObj3V2Decoder.kt | 8 +- .../decoder/codec/objs/OpObj4V2Decoder.kt | 8 +- .../decoder/codec/objs/OpObj5V2Decoder.kt | 6 +- .../decoder/codec/objs/OpObj6Decoder.kt | 6 +- .../decoder/codec/objs/OpObjTDecoder.kt | 16 +- .../decoder/codec/players/OpPlayer1Decoder.kt | 2 +- .../decoder/codec/players/OpPlayer2Decoder.kt | 2 +- .../decoder/codec/players/OpPlayer3Decoder.kt | 2 +- .../decoder/codec/players/OpPlayer4Decoder.kt | 2 +- .../decoder/codec/players/OpPlayer5Decoder.kt | 4 +- .../decoder/codec/players/OpPlayer6Decoder.kt | 4 +- .../decoder/codec/players/OpPlayer7Decoder.kt | 4 +- .../decoder/codec/players/OpPlayer8Decoder.kt | 2 +- .../decoder/codec/players/OpPlayerTDecoder.kt | 10 +- .../codec/resumed/ResumePauseButtonDecoder.kt | 6 +- .../worldentities/OpWorldEntity1Decoder.kt | 4 +- .../worldentities/OpWorldEntity2Decoder.kt | 2 +- .../worldentities/OpWorldEntity3Decoder.kt | 2 +- .../worldentities/OpWorldEntity4Decoder.kt | 2 +- .../worldentities/OpWorldEntity5Decoder.kt | 2 +- .../prot/ClientMessageDecoderRepository.kt | 4 +- .../incoming/decoder/prot/GameClientProtId.kt | 201 ++++++------ .../codec/camera/CamLookAtCyclesDecoder.kt | 12 +- .../codec/camera/CamLookAtV2Decoder.kt | 30 -- .../codec/camera/CamLookAtV3Decoder.kt | 6 +- .../codec/camera/CamMoveToArcV2Decoder.kt | 36 -- .../codec/camera/CamMoveToArcV3Decoder.kt | 12 +- .../codec/camera/CamMoveToCyclesV2Decoder.kt | 32 -- .../codec/camera/CamMoveToCyclesV3Decoder.kt | 10 +- .../codec/camera/CamMoveToV2Decoder.kt | 30 -- .../codec/camera/CamMoveToV3Decoder.kt | 10 +- .../camera/CamRotateToCoordinateV2Decoder.kt | 30 -- .../camera/CamRotateToCoordinateV3Decoder.kt | 12 +- .../decoder/codec/camera/CamSkyboxDecoder.kt | 2 +- .../codec/camera/CamTargetV4Decoder.kt | 4 +- .../decoder/codec/camera/CamUnlockDecoder.kt | 2 +- .../codec/info/NpcInfoLargeV5Decoder.kt | 29 -- .../codec/info/NpcInfoSmallV5Decoder.kt | 29 -- .../codec/interfaces/IfClearInvDecoder.kt | 4 +- .../codec/interfaces/IfCloseSubDecoder.kt | 2 +- .../codec/interfaces/IfMoveSubDecoder.kt | 6 +- .../codec/interfaces/IfOpenSubDecoder.kt | 4 +- .../codec/interfaces/IfOpenTopDecoder.kt | 2 +- .../codec/interfaces/IfSetAngleDecoder.kt | 8 +- .../codec/interfaces/IfSetAnimDecoder.kt | 2 +- .../codec/interfaces/IfSetColourDecoder.kt | 6 +- .../codec/interfaces/IfSetEventsV2Decoder.kt | 6 +- .../codec/interfaces/IfSetHideDecoder.kt | 6 +- .../codec/interfaces/IfSetModelV2Decoder.kt | 6 +- .../interfaces/IfSetNpcHeadActiveDecoder.kt | 6 +- .../codec/interfaces/IfSetNpcHeadDecoder.kt | 6 +- .../codec/interfaces/IfSetObjectDecoder.kt | 6 +- .../interfaces/IfSetPlayerHeadDecoder.kt | 4 +- .../IfSetPlayerModelBaseColourDecoder.kt | 6 +- .../IfSetPlayerModelBodyTypeDecoder.kt | 6 +- .../interfaces/IfSetPlayerModelObjDecoder.kt | 2 +- .../interfaces/IfSetPlayerModelSelfDecoder.kt | 6 +- .../codec/interfaces/IfSetPositionDecoder.kt | 8 +- .../interfaces/IfSetRotateSpeedDecoder.kt | 8 +- .../codec/interfaces/IfSetScrollPosDecoder.kt | 2 +- .../codec/interfaces/IfSetTextDecoder.kt | 4 +- .../decoder/codec/inv/UpdateInvFullDecoder.kt | 4 +- .../codec/inv/UpdateInvStopTransmitDecoder.kt | 2 +- .../codec/map/RebuildRegionV2Decoder.kt | 4 +- .../codec/map/StaticRebuildV2Decoder.kt | 6 +- .../misc/client/ObjUnlockResetDecoder.kt | 19 ++ .../misc/client/ObjUnlockUpdateDecoder.kt | 26 ++ .../misc/player/ChatFilterSettingsDecoder.kt | 4 +- .../codec/misc/player/SetPlayerOpDecoder.kt | 2 +- .../codec/misc/player/UpdateStatV2Decoder.kt | 6 +- .../player/UpdateStockMarketSlotV2Decoder.kt | 47 +++ .../misc/player/UpdateTradingPostV2Decoder.kt | 53 +++ .../codec/sound/AmbientSoundStartDecoder.kt | 4 +- .../codec/sound/AmbientSoundStopDecoder.kt | 2 +- .../decoder/codec/sound/MidiJingleDecoder.kt | 2 +- .../codec/sound/MidiSongStopDecoder.kt | 4 +- .../decoder/codec/sound/MidiSongV2Decoder.kt | 8 +- .../sound/MidiSongWithSecondaryDecoder.kt | 10 +- .../decoder/codec/sound/MidiSwapDecoder.kt | 4 +- .../codec/specific/AnimSpecificDecoder.kt | 4 +- .../codec/specific/LocAnimSpecificDecoder.kt | 6 +- .../codec/specific/MapAnimSpecificDecoder.kt | 6 +- .../codec/specific/NpcAnimSpecificDecoder.kt | 6 +- .../specific/NpcHeadIconSpecificDecoder.kt | 4 +- .../specific/NpcSpotAnimSpecificDecoder.kt | 4 +- .../codec/specific/ObjAddSpecificDecoder.kt | 14 +- .../codec/specific/ObjCountSpecificDecoder.kt | 6 +- .../specific/ObjCustomiseSpecificDecoder.kt | 12 +- .../specific/ObjCustomiseSpecificV2Decoder.kt | 42 +++ .../specific/ObjEnabledOpsSpecificDecoder.kt | 4 +- .../specific/ObjUncustomiseSpecificDecoder.kt | 4 +- .../specific/PlayerSpotAnimSpecificDecoder.kt | 6 +- .../specific/ProjAnimSpecificV4Decoder.kt | 16 +- .../decoder/codec/varp/VarpLargeDecoder.kt | 2 +- .../decoder/codec/varp/VarpLongDecoder.kt | 25 ++ .../decoder/codec/varp/VarpSmallDecoder.kt | 4 +- .../header/UpdateZoneFullFollowsDecoder.kt | 2 +- .../UpdateZonePartialEnclosedDecoder.kt | 24 +- .../header/UpdateZonePartialFollowsDecoder.kt | 6 +- .../zone/payload/LocAddChangeV2Decoder.kt | 12 +- .../codec/zone/payload/LocAnimDecoder.kt | 6 +- .../codec/zone/payload/LocDelDecoder.kt | 2 +- .../codec/zone/payload/LocMergeDecoder.kt | 25 +- .../codec/zone/payload/MapAnimDecoder.kt | 6 +- .../zone/payload/MapProjAnimV2Decoder.kt | 18 +- .../codec/zone/payload/ObjAddDecoder.kt | 12 +- .../codec/zone/payload/ObjCountDecoder.kt | 6 +- .../codec/zone/payload/ObjCustomiseDecoder.kt | 16 +- .../codec/zone/payload/ObjDelDecoder.kt | 2 +- .../zone/payload/ObjEnabledOpsDecoder.kt | 4 +- .../zone/payload/ObjUncustomiseDecoder.kt | 6 +- .../zone/payload/ScriptedProjAddDecoder.kt | 28 +- .../zone/payload/ScriptedProjChangeDecoder.kt | 12 +- .../codec/zone/payload/SoundAreaDecoder.kt | 6 +- .../outgoing/decoder/prot/GameServerProt.kt | 15 +- .../outgoing/decoder/prot/GameServerProtId.kt | 298 ++++++++--------- .../prot/ServerMessageDecoderRepository.kt | 27 +- .../model/info/npcinfo/NpcInfoClient.kt | 308 +++++++++++------- .../model/info/playerinfo/PlayerInfoClient.kt | 243 ++++++-------- .../worldentityinfo/WorldEntityInfoClient.kt | 8 +- .../customisation/CustomisationType.kt | 7 +- .../extendedinfo/ObjTypeCustomisation.kt | 20 +- .../outgoing/model/interfaces/IfSetObject.kt | 4 +- .../model/interfaces/IfSetPosition.kt | 8 +- .../model/misc/client/ObjUnlockReset.kt | 6 + .../model/misc/client/ObjUnlockUpdate.kt | 8 + .../misc/player/UpdateStockMarketSlotV2.kt | 16 + .../model/misc/player/UpdateTradingPostV2.kt | 22 ++ .../model/specific/ObjCustomiseSpecificV2.kt | 17 + .../game/outgoing/model/varp/VarpLong.kt | 6 + .../rsprox/proxy/client/ClientGameHandler.kt | 6 + .../kotlin/net/rsprox/proxy/config/RSProx.kt | 4 +- .../net/rsprox/proxy/plugin/DecoderLoader.kt | 19 ++ .../rsprox/proxy/server/ServerGameHandler.kt | 5 + .../rsprox/transcriber/TranscriberPlugin.kt | 6 + .../transcriber/indexer/IndexerTranscriber.kt | 34 ++ .../interfaces/ServerPacketTranscriber.kt | 18 + .../rsprox/transcriber/prot/GameServerProt.kt | 7 + .../text/TextNpcInfoTranscriber.kt | 2 + .../text/TextPlayerInfoTranscriber.kt | 8 + .../text/TextServerPacketTranscriber.kt | 95 ++++++ 174 files changed, 1491 insertions(+), 1182 deletions(-) delete mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV2Decoder.kt delete mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToArcV2Decoder.kt delete mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToCyclesV2Decoder.kt delete mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToV2Decoder.kt delete mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToCoordinateV2Decoder.kt delete mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoLargeV5Decoder.kt delete mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoSmallV5Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ObjUnlockResetDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ObjUnlockUpdateDecoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateTradingPostV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV2Decoder.kt create mode 100644 protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpLongDecoder.kt create mode 100644 protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/misc/client/ObjUnlockReset.kt create mode 100644 protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/misc/client/ObjUnlockUpdate.kt create mode 100644 protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/misc/player/UpdateStockMarketSlotV2.kt create mode 100644 protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/misc/player/UpdateTradingPostV2.kt create mode 100644 protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/specific/ObjCustomiseSpecificV2.kt create mode 100644 protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/varp/VarpLong.kt diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/If1ButtonDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/If1ButtonDecoder.kt index 480af1200..c67402281 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/If1ButtonDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/If1ButtonDecoder.kt @@ -2,8 +2,8 @@ package net.rsprox.protocol.v241.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.rsprot.protocol.metadata.Consistent import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.incoming.model.buttons.If1Button import net.rsprox.protocol.session.Session diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonDDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonDDecoder.kt index 0e8d483c3..865a8ac08 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonDDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonDDecoder.kt @@ -2,7 +2,7 @@ package net.rsprox.protocol.v241.game.incoming.decoder.codec.buttons 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.incoming.model.buttons.IfButtonD import net.rsprox.protocol.session.Session @@ -15,12 +15,12 @@ public class IfButtonDDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfButtonD { - val selectedSub = buffer.g2Alt2() - val targetCombinedId = buffer.gCombinedId() + val selectedObj = buffer.g2Alt1() + val selectedCombinedId = buffer.gCombinedIdAlt3() + val selectedSub = buffer.g2Alt1() val targetSub = buffer.g2() - val selectedCombinedId = buffer.gCombinedId() val targetObj = buffer.g2Alt2() - val selectedObj = buffer.g2Alt3() + val targetCombinedId = buffer.gCombinedIdAlt3() return IfButtonD( selectedCombinedId, selectedSub, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonTDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonTDecoder.kt index 00a29e4ad..b9a4117ea 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonTDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonTDecoder.kt @@ -2,8 +2,8 @@ package net.rsprox.protocol.v241.game.incoming.decoder.codec.buttons import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.util.gCombinedId -import net.rsprot.protocol.util.gCombinedIdAlt3 +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 @@ -16,12 +16,12 @@ public class IfButtonTDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfButtonT { - val selectedObj = buffer.g2Alt1() - val selectedCombinedId = buffer.gCombinedId() - val targetSub = buffer.g2Alt3() - val targetObj = buffer.g2Alt2() + val targetCombinedId = buffer.gCombinedIdAlt1() + val selectedObj = buffer.g2Alt3() + val selectedCombinedId = buffer.gCombinedIdAlt2() + val targetObj = buffer.g2Alt3() + val targetSub = buffer.g2() val selectedSub = buffer.g2Alt3() - val targetCombinedId = buffer.gCombinedIdAlt3() return IfButtonT( selectedCombinedId, selectedSub, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonXDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonXDecoder.kt index 69bedf5d8..6a7292ba6 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonXDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfButtonXDecoder.kt @@ -2,8 +2,8 @@ package net.rsprox.protocol.v241.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.rsprot.protocol.metadata.Consistent import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.incoming.model.buttons.If3Button import net.rsprox.protocol.session.Session diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfScriptTriggerDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfScriptTriggerDecoder.kt index a37f11315..b9ab44216 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfScriptTriggerDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfScriptTriggerDecoder.kt @@ -17,10 +17,10 @@ public class IfScriptTriggerDecoder : ProxyMessageDecoder { session: Session, ): IfScriptTrigger { // Function is method(int combinedId, int sub, int obj, int crc, Object[] args) - val crc = buffer.g4Alt2() - val obj = buffer.g2() val combinedId = buffer.gCombinedIdAlt2() + val obj = buffer.g2Alt1() val sub = buffer.g2Alt1() + val crc = buffer.g4Alt2() val bytes = buffer.buffer.toByteArray() return IfScriptTrigger( combinedId, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfSubOpDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfSubOpDecoder.kt index 7de2ff54b..a34ef65db 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfSubOpDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/buttons/IfSubOpDecoder.kt @@ -2,8 +2,8 @@ package net.rsprox.protocol.v241.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.rsprot.protocol.metadata.Consistent import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.incoming.model.buttons.IfSubOp import net.rsprox.protocol.session.Session diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventCameraPositionDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventCameraPositionDecoder.kt index f3a0b8cb3..344c089d2 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventCameraPositionDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/events/EventCameraPositionDecoder.kt @@ -14,8 +14,8 @@ public class EventCameraPositionDecoder : ProxyMessageDecoder { val keys = ByteArray(count) var lastTransmittedKeyPress: Int = -1 for (i in 0.. { buffer: JagByteBuf, session: Session, ): EventMouseClickV2 { - val code = buffer.g1() val y = buffer.g2Alt3() - val packed = buffer.g2() val x = buffer.g2Alt3() + val packed = buffer.g2Alt2() + val code = buffer.g1Alt2() val rightClick = packed and 0x1 != 0 val lastTransmittedMouseClick = packed ushr 1 return EventMouseClickV2( diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/friendchat/FriendChatSetRankDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/friendchat/FriendChatSetRankDecoder.kt index 7dd44d6aa..18bea0d7e 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/friendchat/FriendChatSetRankDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/friendchat/FriendChatSetRankDecoder.kt @@ -14,7 +14,7 @@ public class FriendChatSetRankDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): FriendChatSetRank { - val rank = buffer.g1Alt2() + val rank = buffer.g1() val name = buffer.gjstr() return FriendChatSetRank( name, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc1V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc1V2Decoder.kt index 21177761c..b103e7c17 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc1V2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc1V2Decoder.kt @@ -14,11 +14,11 @@ public class OpLoc1V2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpLocV2 { - val controlKey = buffer.g1Alt3() == 1 - val z = buffer.g2Alt3() + val z = buffer.g2Alt1() + val id = buffer.g2Alt3() val subop = buffer.g1() - val x = buffer.g2Alt3() - val id = buffer.g2Alt2() + val x = buffer.g2() + val controlKey = buffer.g1Alt3() == 1 return OpLocV2( id, x, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc2V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc2V2Decoder.kt index 3a2d37dc7..03dd27d95 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc2V2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc2V2Decoder.kt @@ -14,11 +14,11 @@ public class OpLoc2V2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpLocV2 { + val controlKey = buffer.g1Alt3() == 1 val z = buffer.g2() + val id = buffer.g2Alt2() val subop = buffer.g1Alt2() - val controlKey = buffer.g1Alt3() == 1 - val id = buffer.g2() - val x = buffer.g2Alt1() + val x = buffer.g2() return OpLocV2( id, x, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc3V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc3V2Decoder.kt index 60b1f4fdc..a86d147d8 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc3V2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc3V2Decoder.kt @@ -14,11 +14,11 @@ public class OpLoc3V2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpLocV2 { - val subop = buffer.g1Alt3() - val controlKey = buffer.g1Alt3() == 1 - val z = buffer.g2Alt2() + val z = buffer.g2Alt1() + val x = buffer.g2Alt1() + val subop = buffer.g1Alt2() val id = buffer.g2Alt3() - val x = buffer.g2() + val controlKey = buffer.g1Alt1() == 1 return OpLocV2( id, x, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc4V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc4V2Decoder.kt index e588de394..55a451cb1 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc4V2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc4V2Decoder.kt @@ -14,11 +14,11 @@ public class OpLoc4V2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpLocV2 { - val controlKey = buffer.g1Alt1() == 1 - val id = buffer.g2Alt1() - val z = buffer.g2() + val id = buffer.g2Alt2() val subop = buffer.g1Alt1() - val x = buffer.g2() + val controlKey = buffer.g1Alt3() == 1 + val x = buffer.g2Alt1() + val z = buffer.g2Alt1() return OpLocV2( id, x, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc5V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc5V2Decoder.kt index b51d45afe..545d3422c 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc5V2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc5V2Decoder.kt @@ -14,11 +14,11 @@ public class OpLoc5V2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpLocV2 { - val z = buffer.g2Alt1() - val x = buffer.g2() - val subop = buffer.g1Alt1() - val controlKey = buffer.g1Alt3() == 1 - val id = buffer.g2Alt3() + val z = buffer.g2Alt3() + val id = buffer.g2Alt1() + val subop = buffer.g1() + val controlKey = buffer.g1Alt1() == 1 + val x = buffer.g2Alt2() return OpLocV2( id, x, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc6Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc6Decoder.kt index cde9bdd3a..b8a1bbb52 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc6Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLoc6Decoder.kt @@ -14,7 +14,7 @@ public class OpLoc6Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpLoc6 { - val id = buffer.g2Alt1() + val id = buffer.g2Alt3() return OpLoc6(id) } } diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLocTDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLocTDecoder.kt index 8667c5399..c4a63e105 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLocTDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/locs/OpLocTDecoder.kt @@ -2,7 +2,7 @@ package net.rsprox.protocol.v241.game.incoming.decoder.codec.locs 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.incoming.model.locs.OpLocT import net.rsprox.protocol.session.Session @@ -15,13 +15,13 @@ public class OpLocTDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpLocT { - val controlKey = buffer.g1Alt1() == 1 - val x = buffer.g2() + val selectedSub = buffer.g2Alt2() val id = buffer.g2() - val selectedCombinedId = buffer.gCombinedId() - val selectedSub = buffer.g2Alt1() - val z = buffer.g2Alt1() - val selectedObj = buffer.g2Alt2() + val controlKey = buffer.g1() == 1 + val z = buffer.g2Alt2() + val x = buffer.g2Alt3() + val selectedObj = buffer.g2() + val selectedCombinedId = buffer.gCombinedIdAlt1() return OpLocT( id, x, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt index 02f8d5961..10fb33871 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt @@ -14,10 +14,10 @@ public class SendPingReplyDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): SendPingReply { - val fps = buffer.g1Alt1() - val gcPercentTime = buffer.g1Alt2() val value1 = buffer.g4Alt1() val value2 = buffer.g4Alt3() + val fps = buffer.g1Alt3() + val gcPercentTime = buffer.g1() return SendPingReply( fps, gcPercentTime, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/BugReportDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/BugReportDecoder.kt index 807bc1b96..4c05d23a6 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/BugReportDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/BugReportDecoder.kt @@ -14,9 +14,9 @@ public class BugReportDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): BugReport { - val description = buffer.gjstr() val instructions = buffer.gjstr() - val type = buffer.g1Alt3() + val type = buffer.g1Alt2() + val description = buffer.gjstr() check(description.length <= 500) { "Bug report description length cannot exceed 500 characters." } diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/ClickWorldMapDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/ClickWorldMapDecoder.kt index 05b191a83..dc4102d24 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/ClickWorldMapDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/ClickWorldMapDecoder.kt @@ -15,7 +15,7 @@ public class ClickWorldMapDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): ClickWorldMap { - val packed = buffer.g4Alt1() + val packed = buffer.g4Alt2() return ClickWorldMap(CoordGrid(packed)) } } diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/IfCrmViewOpDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/IfCrmViewOpDecoder.kt index 38e1ba6e3..d8a651297 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/IfCrmViewOpDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/IfCrmViewOpDecoder.kt @@ -15,11 +15,11 @@ public class IfCrmViewOpDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfCrmViewOp { + val serverTarget = buffer.g4Alt1() + val sub = buffer.g2Alt1() + val behaviour1 = buffer.g4Alt2() val behaviour2 = buffer.g4() - val behaviour1 = buffer.g4Alt1() - val behaviour3 = buffer.g4Alt3() - val serverTarget = buffer.g4() - val sub = buffer.g2Alt2() + val behaviour3 = buffer.g4() val combinedId = buffer.gCombinedId() return IfCrmViewOp( serverTarget, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/MoveGameClickDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/MoveGameClickDecoder.kt index c952cb398..dbf1a2e2f 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/MoveGameClickDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/MoveGameClickDecoder.kt @@ -14,9 +14,9 @@ public class MoveGameClickDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): MoveGameClick { - val z = buffer.g2Alt3() - val keyCombination = buffer.g1Alt2() - val x = buffer.g2Alt3() + val keyCombination = buffer.g1Alt1() + val z = buffer.g2Alt2() + val x = buffer.g2Alt2() return MoveGameClick( x, z, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/MoveMinimapClickDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/MoveMinimapClickDecoder.kt index c20d3ad1e..015bf076e 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/MoveMinimapClickDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/MoveMinimapClickDecoder.kt @@ -15,9 +15,9 @@ public class MoveMinimapClickDecoder : ProxyMessageDecoder { session: Session, ): MoveMinimapClick { // The x, z and keyCombination get scrambled between revisions - val z = buffer.g2Alt3() - val keyCombination = buffer.g1Alt2() - val x = buffer.g2Alt3() + val keyCombination = buffer.g1Alt1() + val z = buffer.g2Alt2() + val x = buffer.g2Alt2() // The arguments below are consistent across revisions val minimapWidth = buffer.g1() diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/TeleportDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/TeleportDecoder.kt index 414a94362..fb9b9294d 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/TeleportDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/user/TeleportDecoder.kt @@ -14,10 +14,10 @@ public class TeleportDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): Teleport { - val level = buffer.g1Alt3() + val z = buffer.g2Alt2() val x = buffer.g2Alt3() - val oculusSyncValue = buffer.g4() - val z = buffer.g2() + val oculusSyncValue = buffer.g4Alt3() + val level = buffer.g1Alt2() return Teleport( oculusSyncValue, x, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc1V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc1V2Decoder.kt index 1d1632358..ca322d438 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc1V2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc1V2Decoder.kt @@ -14,9 +14,9 @@ public class OpNpc1V2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpNpcV2 { - val index = buffer.g2Alt1() - val subop = buffer.g1() - val controlKey = buffer.g1Alt1() == 1 + val subop = buffer.g1Alt1() + val index = buffer.g2Alt3() + val controlKey = buffer.g1Alt2() == 1 return OpNpcV2( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc2V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc2V2Decoder.kt index 40b207747..d424f310d 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc2V2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc2V2Decoder.kt @@ -14,9 +14,9 @@ public class OpNpc2V2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpNpcV2 { - val index = buffer.g2Alt1() - val subop = buffer.g1Alt1() - val controlKey = buffer.g1Alt3() == 1 + val controlKey = buffer.g1Alt1() == 1 + val subop = buffer.g1Alt3() + val index = buffer.g2Alt3() return OpNpcV2( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc3V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc3V2Decoder.kt index ed3ab9df6..d75908a2f 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc3V2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc3V2Decoder.kt @@ -15,8 +15,8 @@ public class OpNpc3V2Decoder : ProxyMessageDecoder { session: Session, ): OpNpcV2 { val index = buffer.g2Alt1() - val controlKey = buffer.g1Alt3() == 1 - val subop = buffer.g1Alt2() + val subop = buffer.g1() + val controlKey = buffer.g1Alt1() == 1 return OpNpcV2( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc4V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc4V2Decoder.kt index 737f5dfaa..7de89b7b5 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc4V2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc4V2Decoder.kt @@ -15,8 +15,8 @@ public class OpNpc4V2Decoder : ProxyMessageDecoder { session: Session, ): OpNpcV2 { val controlKey = buffer.g1Alt3() == 1 - val subop = buffer.g1() - val index = buffer.g2Alt2() + val subop = buffer.g1Alt3() + val index = buffer.g2Alt1() return OpNpcV2( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc5V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc5V2Decoder.kt index 78c5addbf..43f64dd69 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc5V2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc5V2Decoder.kt @@ -14,9 +14,9 @@ public class OpNpc5V2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpNpcV2 { - val subop = buffer.g1() - val controlKey = buffer.g1Alt2() == 1 - val index = buffer.g2() + val index = buffer.g2Alt2() + val controlKey = buffer.g1Alt1() == 1 + val subop = buffer.g1Alt2() return OpNpcV2( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc6Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc6Decoder.kt index a91236595..7955150b9 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc6Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpc6Decoder.kt @@ -14,7 +14,7 @@ public class OpNpc6Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpNpc6 { - val id = buffer.g2Alt2() + val id = buffer.g2() return OpNpc6(id) } } diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpcTDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpcTDecoder.kt index 2ef62ccea..6e8b1eb90 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpcTDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/npcs/OpNpcTDecoder.kt @@ -2,7 +2,7 @@ package net.rsprox.protocol.v241.game.incoming.decoder.codec.npcs 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.incoming.model.npcs.OpNpcT import net.rsprox.protocol.session.Session @@ -15,11 +15,11 @@ public class OpNpcTDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpNpcT { - val controlKey = buffer.g1Alt3() == 1 - val selectedCombinedId = buffer.gCombinedIdAlt1() + val selectedCombinedId = buffer.gCombinedIdAlt3() + val index = buffer.g2() val selectedSub = buffer.g2() - val selectedObj = buffer.g2Alt3() - val index = buffer.g2Alt2() + val selectedObj = buffer.g2Alt2() + val controlKey = buffer.g1Alt2() == 1 return OpNpcT( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj1V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj1V2Decoder.kt index 911f8d6a3..c769989a4 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj1V2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj1V2Decoder.kt @@ -14,11 +14,11 @@ public class OpObj1V2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpObjV2 { - val subop = buffer.g1Alt2() - val x = buffer.g2Alt2() - val z = buffer.g2Alt3() - val controlKey = buffer.g1Alt3() == 1 + val subop = buffer.g1() + val x = buffer.g2() val id = buffer.g2() + val controlKey = buffer.g1() == 1 + val z = buffer.g2Alt3() return OpObjV2( id, x, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj2V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj2V2Decoder.kt index e78903fbd..a6cbdd37c 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj2V2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj2V2Decoder.kt @@ -14,10 +14,10 @@ public class OpObj2V2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpObjV2 { - val subop = buffer.g1Alt2() - val z = buffer.g2() - val id = buffer.g2Alt2() val x = buffer.g2Alt2() + val id = buffer.g2() + val subop = buffer.g1Alt2() + val z = buffer.g2Alt2() val controlKey = buffer.g1Alt1() == 1 return OpObjV2( id, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj3V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj3V2Decoder.kt index f537a1a36..d7f931200 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj3V2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj3V2Decoder.kt @@ -14,11 +14,11 @@ public class OpObj3V2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpObjV2 { - val x = buffer.g2Alt2() - val controlKey = buffer.g1Alt2() == 1 val subop = buffer.g1() - val id = buffer.g2Alt1() - val z = buffer.g2() + val x = buffer.g2() + val id = buffer.g2() + val z = buffer.g2Alt1() + val controlKey = buffer.g1Alt3() == 1 return OpObjV2( id, x, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj4V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj4V2Decoder.kt index a50c330d0..becef5613 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj4V2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj4V2Decoder.kt @@ -14,11 +14,11 @@ public class OpObj4V2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpObjV2 { - val subop = buffer.g1Alt2() - val controlKey = buffer.g1Alt3() == 1 - val z = buffer.g2Alt3() + val z = buffer.g2Alt1() + val x = buffer.g2() + val controlKey = buffer.g1Alt2() == 1 + val subop = buffer.g1Alt1() val id = buffer.g2Alt2() - val x = buffer.g2Alt1() return OpObjV2( id, x, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj5V2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj5V2Decoder.kt index 6fb9c7acf..ed2dceba1 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj5V2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj5V2Decoder.kt @@ -15,10 +15,10 @@ public class OpObj5V2Decoder : ProxyMessageDecoder { session: Session, ): OpObjV2 { val id = buffer.g2Alt3() - val subop = buffer.g1() - val x = buffer.g2Alt1() + val z = buffer.g2Alt1() val controlKey = buffer.g1Alt3() == 1 - val z = buffer.g2Alt2() + val x = buffer.g2Alt2() + val subop = buffer.g1Alt3() return OpObjV2( id, x, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj6Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj6Decoder.kt index da27032ca..43ea68136 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj6Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObj6Decoder.kt @@ -14,9 +14,9 @@ public class OpObj6Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpObj6 { - val id = buffer.g2Alt1() - val z = buffer.g2Alt3() - val x = buffer.g2() + val z = buffer.g2Alt2() + val id = buffer.g2Alt3() + val x = buffer.g2Alt3() return OpObj6( id, x, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObjTDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObjTDecoder.kt index 13dafdc63..0d11cf760 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObjTDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/objs/OpObjTDecoder.kt @@ -2,7 +2,7 @@ package net.rsprox.protocol.v241.game.incoming.decoder.codec.objs 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.incoming.model.objs.OpObjT import net.rsprox.protocol.session.Session @@ -15,13 +15,13 @@ public class OpObjTDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpObjT { - val x = buffer.g2() - val selectedCombinedId = buffer.gCombinedId() - val controlKey = buffer.g1Alt3() == 1 - val selectedSub = buffer.g2Alt1() - val z = buffer.g2Alt3() - val id = buffer.g2Alt3() - val selectedObj = buffer.g2() + val selectedSub = buffer.g2Alt2() + val id = buffer.g2Alt2() + val z = buffer.g2() + val x = buffer.g2Alt3() + val selectedCombinedId = buffer.gCombinedIdAlt2() + val controlKey = buffer.g1Alt1() == 1 + val selectedObj = buffer.g2Alt1() return OpObjT( id, x, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer1Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer1Decoder.kt index 25c0242cd..c37f24b67 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer1Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer1Decoder.kt @@ -14,8 +14,8 @@ public class OpPlayer1Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpPlayer { + val index = buffer.g2Alt3() val controlKey = buffer.g1Alt2() == 1 - val index = buffer.g2() return OpPlayer( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer2Decoder.kt index f71d17042..3bc8a6e05 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer2Decoder.kt @@ -14,8 +14,8 @@ public class OpPlayer2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpPlayer { - val controlKey = buffer.g1Alt3() == 1 val index = buffer.g2Alt1() + val controlKey = buffer.g1Alt2() == 1 return OpPlayer( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer3Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer3Decoder.kt index ee5a44542..9f5f9dc3c 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer3Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer3Decoder.kt @@ -14,8 +14,8 @@ public class OpPlayer3Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpPlayer { - val index = buffer.g2Alt2() val controlKey = buffer.g1Alt1() == 1 + val index = buffer.g2Alt2() return OpPlayer( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer4Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer4Decoder.kt index 224dd8b6a..2bcf35a85 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer4Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer4Decoder.kt @@ -14,8 +14,8 @@ public class OpPlayer4Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpPlayer { + val index = buffer.g2Alt3() val controlKey = buffer.g1Alt3() == 1 - val index = buffer.g2() return OpPlayer( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer5Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer5Decoder.kt index 103464b94..267cacf25 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer5Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer5Decoder.kt @@ -14,8 +14,8 @@ public class OpPlayer5Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpPlayer { - val index = buffer.g2Alt2() - val controlKey = buffer.g1Alt1() == 1 + val index = buffer.g2Alt1() + val controlKey = buffer.g1() == 1 return OpPlayer( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer6Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer6Decoder.kt index b4e930c95..f89f99c83 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer6Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer6Decoder.kt @@ -14,8 +14,8 @@ public class OpPlayer6Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpPlayer { - val controlKey = buffer.g1Alt1() == 1 - val index = buffer.g2Alt1() + val controlKey = buffer.g1() == 1 + val index = buffer.g2() return OpPlayer( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer7Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer7Decoder.kt index 782903bcf..f61f20cdf 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer7Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer7Decoder.kt @@ -14,8 +14,8 @@ public class OpPlayer7Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpPlayer { - val controlKey = buffer.g1Alt1() == 1 - val index = buffer.g2Alt1() + val controlKey = buffer.g1Alt3() == 1 + val index = buffer.g2Alt3() return OpPlayer( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer8Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer8Decoder.kt index 555442215..6e5ae4041 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer8Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayer8Decoder.kt @@ -14,8 +14,8 @@ public class OpPlayer8Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpPlayer { + val controlKey = buffer.g1Alt3() == 1 val index = buffer.g2Alt2() - val controlKey = buffer.g1() == 1 return OpPlayer( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayerTDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayerTDecoder.kt index 33b7c854b..a4fdeb523 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayerTDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/players/OpPlayerTDecoder.kt @@ -2,7 +2,7 @@ package net.rsprox.protocol.v241.game.incoming.decoder.codec.players import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.util.gCombinedIdAlt2 +import net.rsprot.protocol.util.gCombinedId import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.incoming.model.players.OpPlayerT import net.rsprox.protocol.session.Session @@ -15,11 +15,11 @@ public class OpPlayerTDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpPlayerT { - val controlKey = buffer.g1Alt2() == 1 val selectedSub = buffer.g2Alt1() - val selectedCombinedId = buffer.gCombinedIdAlt2() - val selectedObj = buffer.g2Alt1() - val index = buffer.g2Alt3() + val selectedCombinedId = buffer.gCombinedId() + val controlKey = buffer.g1Alt1() == 1 + val selectedObj = buffer.g2Alt2() + val index = buffer.g2Alt2() return OpPlayerT( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePauseButtonDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePauseButtonDecoder.kt index 2f518df0a..5591c56f2 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePauseButtonDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePauseButtonDecoder.kt @@ -2,7 +2,7 @@ package net.rsprox.protocol.v241.game.incoming.decoder.codec.resumed 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.incoming.model.resumed.ResumePauseButton import net.rsprox.protocol.session.Session @@ -15,8 +15,8 @@ public class ResumePauseButtonDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): ResumePauseButton { - val combinedId = buffer.gCombinedId() - val sub = buffer.g2Alt3() + val sub = buffer.g2Alt1() + val combinedId = buffer.gCombinedIdAlt1() return ResumePauseButton( combinedId, sub, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity1Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity1Decoder.kt index 269b95a06..a239d5f9d 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity1Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity1Decoder.kt @@ -14,8 +14,8 @@ public class OpWorldEntity1Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpWorldEntity { - val index = buffer.g2() - val controlKey = buffer.g1Alt2() == 1 + val index = buffer.g2Alt1() + val controlKey = buffer.g1Alt3() == 1 return OpWorldEntity( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity2Decoder.kt index ba15ca0e7..9fdb084a7 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity2Decoder.kt @@ -14,8 +14,8 @@ public class OpWorldEntity2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpWorldEntity { + val index = buffer.g2Alt3() val controlKey = buffer.g1Alt1() == 1 - val index = buffer.g2() return OpWorldEntity( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity3Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity3Decoder.kt index 913d795e8..52bad9b72 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity3Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity3Decoder.kt @@ -15,7 +15,7 @@ public class OpWorldEntity3Decoder : ProxyMessageDecoder { session: Session, ): OpWorldEntity { val index = buffer.g2() - val controlKey = buffer.g1() == 1 + val controlKey = buffer.g1Alt2() == 1 return OpWorldEntity( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity4Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity4Decoder.kt index 0d49f0c91..55672d3d1 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity4Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity4Decoder.kt @@ -14,8 +14,8 @@ public class OpWorldEntity4Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpWorldEntity { + val controlKey = buffer.g1Alt3() == 1 val index = buffer.g2() - val controlKey = buffer.g1Alt2() == 1 return OpWorldEntity( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity5Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity5Decoder.kt index 84fe25362..ba34fbfed 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity5Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntity5Decoder.kt @@ -15,7 +15,7 @@ public class OpWorldEntity5Decoder : ProxyMessageDecoder { session: Session, ): OpWorldEntity { val controlKey = buffer.g1Alt1() == 1 - val index = buffer.g2Alt3() + val index = buffer.g2Alt1() return OpWorldEntity( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt index 3883c4b15..493fc7fc5 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt @@ -24,7 +24,6 @@ import net.rsprox.protocol.v241.game.incoming.decoder.codec.locs.OpLocTDecoder import net.rsprox.protocol.v241.game.incoming.decoder.codec.messaging.MessagePrivateDecoder import net.rsprox.protocol.v241.game.incoming.decoder.codec.messaging.MessagePublicDecoder import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.client.* -import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.client.ReflectionCheckReplyDecoder import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.user.BugReportDecoder import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.user.ClickWorldMapDecoder import net.rsprox.protocol.v241.game.incoming.decoder.codec.misc.user.ClientCheatDecoder @@ -77,7 +76,6 @@ import net.rsprox.protocol.v241.game.incoming.decoder.codec.worldentities.OpWorl import net.rsprox.protocol.v241.game.incoming.decoder.codec.worldentities.OpWorldEntity4Decoder import net.rsprox.protocol.v241.game.incoming.decoder.codec.worldentities.OpWorldEntity5Decoder import net.rsprox.protocol.v241.game.incoming.decoder.codec.worldentities.OpWorldEntity6Decoder -import net.rsprox.protocol.v241.game.incoming.decoder.codec.worldentities.OpWorldEntityTDecoder internal object ClientMessageDecoderRepository { @ExperimentalStdlibApi @@ -134,7 +132,7 @@ internal object ClientMessageDecoderRepository { bind(OpWorldEntity4Decoder()) bind(OpWorldEntity5Decoder()) bind(OpWorldEntity6Decoder()) - bind(OpWorldEntityTDecoder()) + // TODO(241): Native world-entity menus have no selected-target branch; OPWORLDENTITYT remains unbound. bind(EventAppletFocusDecoder()) bind(EventCameraPositionDecoder()) diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProtId.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProtId.kt index 6b030ebd8..f7f856cf0 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProtId.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProtId.kt @@ -1,105 +1,106 @@ package net.rsprox.protocol.v241.game.incoming.decoder.prot internal object GameClientProtId { - const val EVENT_MOUSE_CLICK_V1 = 0 - const val IF_BUTTONX = 1 - const val OPWORLDENTITY4 = 2 + const val IF_CRMVIEW_OP = 0 + const val CLANCHANNEL_FULL_REQUEST = 1 + const val IGNORELIST_DEL = 2 const val RESUME_P_OBJDIALOG = 3 - const val OPPLAYER6 = 4 - const val IDLE = 7 - const val OPLOC3_V2 = 8 - const val OPOBJ6 = 9 - const val OPWORLDENTITYT = 10 - const val IF_BUTTON = 11 - const val REFLECTION_CHECK_REPLY = 12 - const val TELEPORT = 13 - const val BUG_REPORT = 14 - const val IF_CRMVIEW_OP = 15 - const val SET_CHATFILTERSETTINGS = 16 - const val AFFINEDCLANSETTINGS_ADDBANNED_FROMCHANNEL = 17 - const val OPPLAYER2 = 21 - const val OPOBJ3_V2 = 22 - const val OPWORLDENTITY6 = 25 - const val MAP_BUILD_COMPLETE = 27 - const val CONNECTION_TELEMETRY = 29 - const val EVENT_APPLET_FOCUS = 30 - const val SEND_PING_REPLY = 32 - const val CLANCHANNEL_FULL_REQUEST = 33 - const val OPNPC4_V2 = 35 - const val OPPLAYER3 = 36 - const val CLANCHANNEL_KICKUSER = 37 - const val OPOBJT = 38 - const val IF_BUTTOND = 39 - const val EVENT_MOUSE_CLICK_V2 = 40 - const val OPPLAYER8 = 41 - const val OPPLAYERU = 42 - const val OPNPC3_V2 = 43 - const val WINDOW_STATUS = 44 - const val OPPLAYERT = 45 - const val SOUND_JINGLEEND = 46 - const val EVENT_KEYBOARD = 47 - const val OPWORLDENTITY2 = 48 - const val OPWORLDENTITY3 = 49 - const val OPPLAYER7 = 50 - const val FRIENDCHAT_KICK = 51 - const val OPPLAYER5 = 52 - const val RESUME_P_STRINGDIALOG = 54 - const val EVENT_CAMERA_POSITION = 55 - const val MESSAGE_PUBLIC = 56 - const val OPPLAYER1 = 57 - const val IF_SCRIPT_TRIGGER = 58 - const val OPNPC1_V2 = 59 - const val AFFINEDCLANSETTINGS_SETMUTED_FROMCHANNEL = 60 - const val MOVE_MINIMAPCLICK = 61 - const val RESUME_P_COUNTDIALOG = 62 - const val OPNPCT = 63 - const val OPPLAYER4 = 64 - const val OPOBJ4_V2 = 65 - const val FRIENDCHAT_SETRANK = 66 - const val FRIENDLIST_ADD = 67 - const val OPLOCT = 68 - const val OPLOC4_V2 = 69 - const val RESUME_P_NAMEDIALOG = 70 - const val EXIT_FREECAM = 71 - const val OPNPC5_V2 = 73 - const val OPLOC1_V2 = 74 - const val OPOBJ5_V2 = 75 - const val MEMBERSHIP_PROMOTION_ELIGIBILITY = 76 - const val OPLOC5_V2 = 77 - const val CLICKWORLDMAP = 78 - const val CLIENT_CHEAT = 79 - const val IF_BUTTONT = 80 - const val IGNORELIST_ADD = 81 - const val RESUME_PAUSEBUTTON = 82 - const val EVENT_MOUSE_SCROLL = 83 - const val OPOBJU = 84 - const val OPWORLDENTITYU = 85 - const val IGNORELIST_DEL = 86 - const val OPNPC2_V2 = 87 - const val EVENT_NATIVE_MOUSE_MOVE = 88 - const val RSEVEN_STATUS = 89 - const val OPLOC2_V2 = 90 - const val UPDATE_PLAYER_MODEL_V2 = 91 - const val SEND_SNAPSHOT = 92 - const val OPWORLDENTITY5 = 93 - const val IF_SUBOP = 95 - const val OPWORLDENTITY1 = 96 - const val FRIENDCHAT_JOIN_LEAVE = 97 - const val CLOSE_MODAL = 98 - const val NO_TIMEOUT = 99 - const val CLANSETTINGS_FULL_REQUEST = 100 - const val OPNPC6 = 101 - const val MOVE_GAMECLICK = 102 - const val DETECT_MODIFIED_CLIENT = 103 - const val OPLOC6 = 105 - const val OPNPCU = 107 - const val MESSAGE_PRIVATE = 108 - const val SET_HEADING = 109 - const val HISCORE_REQUEST = 110 - const val RESUME_P_COUNTDIALOG_LONG = 111 - const val OPOBJ1_V2 = 112 - const val OPOBJ2_V2 = 113 - const val EVENT_MOUSE_MOVE = 114 - const val FRIENDLIST_DEL = 115 - const val OPLOCU = 116 + const val OPLOC2_V2 = 4 + const val OPWORLDENTITY6 = 5 + const val OPWORLDENTITY5 = 6 + const val EVENT_MOUSE_CLICK_V1 = 7 + const val OPLOCT = 8 + const val OPOBJ5_V2 = 9 + const val SEND_PING_REPLY = 11 + const val OPPLAYER1 = 12 + const val OPWORLDENTITY2 = 13 + const val FRIENDLIST_ADD = 14 + const val IF_BUTTONT = 15 + const val RESUME_PAUSEBUTTON = 16 + const val IF_SCRIPT_TRIGGER = 17 + const val TELEPORT = 18 + const val SET_CHATFILTERSETTINGS = 19 + const val CONNECTION_TELEMETRY = 20 + const val OPWORLDENTITY4 = 21 + const val EVENT_MOUSE_SCROLL = 23 + const val OPLOC5_V2 = 24 + const val FRIENDCHAT_JOIN_LEAVE = 25 + const val OPPLAYER4 = 26 + const val EVENT_MOUSE_CLICK_V2 = 27 + const val CLICKWORLDMAP = 28 + const val AFFINEDCLANSETTINGS_SETMUTED_FROMCHANNEL = 29 + const val OPPLAYER3 = 30 + const val OPNPC4_V2 = 31 + const val OPWORLDENTITY3 = 32 + const val RESUME_P_NAMEDIALOG = 33 + const val EXIT_FREECAM = 34 + const val OPPLAYER2 = 35 + const val HISCORE_REQUEST = 36 + const val IF_BUTTONX = 38 + const val OPLOC6 = 39 + const val OPPLAYER8 = 40 + const val CLOSE_MODAL = 41 + const val EVENT_CAMERA_POSITION = 43 + const val OPNPC2_V2 = 44 + const val SEND_SNAPSHOT = 45 + const val IF_BUTTOND = 46 + const val MEMBERSHIP_PROMOTION_ELIGIBILITY = 47 + const val DETECT_MODIFIED_CLIENT = 48 + const val MESSAGE_PUBLIC = 49 + const val MESSAGE_PRIVATE = 50 + const val FRIENDLIST_DEL = 51 + const val OPNPC6 = 53 + const val OPPLAYER5 = 54 + const val MOVE_GAMECLICK = 55 + const val FRIENDCHAT_KICK = 57 + const val RESUME_P_STRINGDIALOG = 58 + const val AFFINEDCLANSETTINGS_ADDBANNED_FROMCHANNEL = 59 + const val EVENT_NATIVE_MOUSE_MOVE = 60 + const val OPPLAYERT = 61 + const val OPNPCT = 62 + const val OPOBJ4_V2 = 63 + const val OPPLAYER6 = 64 + const val OPOBJ3_V2 = 65 + const val IF_SUBOP = 66 + const val SOUND_JINGLEEND = 67 + const val RESUME_P_COUNTDIALOG = 68 + const val WINDOW_STATUS = 69 + const val CLANSETTINGS_FULL_REQUEST = 70 + const val OPOBJ1_V2 = 71 + const val OPLOC1_V2 = 72 + const val SET_HEADING = 73 + const val IDLE = 74 + const val NO_TIMEOUT = 75 + const val OPNPC5_V2 = 76 + const val BUG_REPORT = 77 + const val IF_BUTTON = 78 + const val OPLOC4_V2 = 79 + const val FRIENDCHAT_SETRANK = 80 + const val MOVE_MINIMAPCLICK = 81 + const val OPWORLDENTITY1 = 82 + const val CLANCHANNEL_KICKUSER = 83 + const val CLIENT_CHEAT = 84 + const val IGNORELIST_ADD = 85 + const val OPNPC3_V2 = 86 + const val EVENT_MOUSE_MOVE = 87 + const val OPOBJ6 = 90 + const val OPNPC1_V2 = 92 + const val RSEVEN_STATUS = 93 + const val OPOBJT = 94 + const val OPPLAYER7 = 95 + const val OPOBJ2_V2 = 98 + const val MAP_BUILD_COMPLETE = 99 + const val OPLOC3_V2 = 100 + const val EVENT_KEYBOARD = 101 + + const val OPWORLDENTITYT = -1 + const val REFLECTION_CHECK_REPLY = -1 + const val EVENT_APPLET_FOCUS = -1 + const val OPPLAYERU = -1 + const val OPOBJU = -1 + const val OPWORLDENTITYU = -1 + const val UPDATE_PLAYER_MODEL_V2 = -1 + const val OPNPCU = -1 + const val RESUME_P_COUNTDIALOG_LONG = -1 + const val OPLOCU = -1 } diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtCyclesDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtCyclesDecoder.kt index 7a286131c..de81ea5c2 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtCyclesDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtCyclesDecoder.kt @@ -14,12 +14,12 @@ internal class CamLookAtCyclesDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): CamLookAtCycles { - val x = buffer.g2Alt2() - val cycles = buffer.g2Alt2() - val easing = buffer.g1Alt3() - val z = buffer.g2() - val heightRelative = buffer.g1Alt3() == 1 - val height = buffer.g2sAlt1() + val height = buffer.g2sAlt2() + val easing = buffer.g1() + val x = buffer.g2Alt1() + val z = buffer.g2Alt1() + val cycles = buffer.g2Alt3() + val heightRelative = buffer.g1Alt1() == 1 return CamLookAtCycles( x, z, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV2Decoder.kt deleted file mode 100644 index 43dedad58..000000000 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV2Decoder.kt +++ /dev/null @@ -1,30 +0,0 @@ -package net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera - -import net.rsprot.buffer.JagByteBuf -import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.outgoing.model.camera.CamLookAtV2 -import net.rsprox.protocol.session.Session -import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt - -internal class CamLookAtV2Decoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.CAM_LOOKAT_V2 - - override fun decode( - buffer: JagByteBuf, - session: Session, - ): CamLookAtV2 { - val rate2 = buffer.g1Alt3() - val height = buffer.g2() - val z = buffer.g2() - val rate = buffer.g1Alt3() - val x = buffer.g2Alt1() - return CamLookAtV2( - x, - z, - height, - rate, - rate2, - ) - } -} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV3Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV3Decoder.kt index 81dae3fbb..a2fa7369e 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV3Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV3Decoder.kt @@ -14,12 +14,12 @@ internal class CamLookAtV3Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): CamLookAtV3 { - val rate = buffer.g1Alt2() val height = buffer.g2s() val x = buffer.g2Alt3() + val rate2 = buffer.g1Alt1() + val rate = buffer.g1() + val heightRelative = buffer.g1() == 1 val z = buffer.g2() - val rate2 = buffer.g1Alt2() - val heightRelative = buffer.g1Alt3() == 1 return CamLookAtV3( x, z, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToArcV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToArcV2Decoder.kt deleted file mode 100644 index 751f53998..000000000 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToArcV2Decoder.kt +++ /dev/null @@ -1,36 +0,0 @@ -package net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera - -import net.rsprot.buffer.JagByteBuf -import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.outgoing.model.camera.CamMoveToArcV2 -import net.rsprox.protocol.session.Session -import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt - -internal class CamMoveToArcV2Decoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.CAM_MOVETO_ARC_V2 - - override fun decode( - buffer: JagByteBuf, - session: Session, - ): CamMoveToArcV2 { - val destinationX = buffer.g2Alt3() - val centerZ = buffer.g2Alt3() - val easing = buffer.g1Alt3() - val centerX = buffer.g2Alt2() - val cycles = buffer.g2Alt1() - val height = buffer.g2Alt2() - val destinationZ = buffer.g2() - val ignoreTerrain = buffer.g1Alt1() == 1 - return CamMoveToArcV2( - centerX, - centerZ, - destinationX, - destinationZ, - height, - cycles, - ignoreTerrain, - easing, - ) - } -} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToArcV3Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToArcV3Decoder.kt index 4c301ba8c..2c2dd0bff 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToArcV3Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToArcV3Decoder.kt @@ -15,14 +15,14 @@ internal class CamMoveToArcV3Decoder : ProxyMessageDecoder { session: Session, ): CamMoveToArcV3 { val centerZ = buffer.g2Alt2() + val centerX = buffer.g2Alt2() val heightRelative = buffer.g1Alt1() == 1 - val height = buffer.g2sAlt3() - val easing = buffer.g1Alt2() - val destinationZ = buffer.g2Alt3() + val easing = buffer.g1Alt3() + val height = buffer.g2sAlt2() + val destinationZ = buffer.g2Alt2() + val destinationX = buffer.g2() + val ignoreTerrain = buffer.g1Alt1() == 1 val cycles = buffer.g2Alt2() - val ignoreTerrain = buffer.g1() == 1 - val centerX = buffer.g2Alt3() - val destinationX = buffer.g2Alt1() return CamMoveToArcV3( centerX, centerZ, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToCyclesV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToCyclesV2Decoder.kt deleted file mode 100644 index c490f45a7..000000000 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToCyclesV2Decoder.kt +++ /dev/null @@ -1,32 +0,0 @@ -package net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera - -import net.rsprot.buffer.JagByteBuf -import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.outgoing.model.camera.CamMoveToCyclesV2 -import net.rsprox.protocol.session.Session -import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt - -internal class CamMoveToCyclesV2Decoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.CAM_MOVETO_CYCLES_V2 - - override fun decode( - buffer: JagByteBuf, - session: Session, - ): CamMoveToCyclesV2 { - val ignoreTerrain = buffer.g1() == 1 - val z = buffer.g2Alt3() - val cycles = buffer.g2Alt2() - val height = buffer.g2Alt1() - val easing = buffer.g1() - val x = buffer.g2() - return CamMoveToCyclesV2( - x, - z, - height, - cycles, - ignoreTerrain, - easing, - ) - } -} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToCyclesV3Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToCyclesV3Decoder.kt index 845e26c22..241e7ff1e 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToCyclesV3Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToCyclesV3Decoder.kt @@ -14,13 +14,13 @@ internal class CamMoveToCyclesV3Decoder : ProxyMessageDecoder buffer: JagByteBuf, session: Session, ): CamMoveToCyclesV3 { - val ignoreTerrain = buffer.g1Alt2() == 1 - val easing = buffer.g1Alt1() - val heightRelative = buffer.g1() == 1 val height = buffer.g2sAlt3() - val z = buffer.g2Alt2() + val ignoreTerrain = buffer.g1Alt3() == 1 + val heightRelative = buffer.g1Alt1() == 1 + val x = buffer.g2() + val z = buffer.g2Alt1() val cycles = buffer.g2Alt1() - val x = buffer.g2Alt3() + val easing = buffer.g1Alt1() return CamMoveToCyclesV3( x, z, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToV2Decoder.kt deleted file mode 100644 index fc805ffc6..000000000 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToV2Decoder.kt +++ /dev/null @@ -1,30 +0,0 @@ -package net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera - -import net.rsprot.buffer.JagByteBuf -import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.outgoing.model.camera.CamMoveToV2 -import net.rsprox.protocol.session.Session -import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt - -internal class CamMoveToV2Decoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.CAM_MOVETO_V2 - - override fun decode( - buffer: JagByteBuf, - session: Session, - ): CamMoveToV2 { - val z = buffer.g2() - val rate2 = buffer.g1Alt1() - val height = buffer.g2() - val x = buffer.g2Alt3() - val rate = buffer.g1Alt3() - return CamMoveToV2( - x, - z, - height, - rate, - rate2, - ) - } -} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToV3Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToV3Decoder.kt index cf2199657..3eb4bc1a6 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToV3Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamMoveToV3Decoder.kt @@ -14,11 +14,11 @@ internal class CamMoveToV3Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): CamMoveToV3 { - val rate = buffer.g1Alt2() - val z = buffer.g2() - val rate2 = buffer.g1Alt1() - val height = buffer.g2sAlt1() - val x = buffer.g2Alt3() + val height = buffer.g2s() + val rate = buffer.g1Alt3() + val z = buffer.g2Alt3() + val x = buffer.g2() + val rate2 = buffer.g1Alt2() val heightRelative = buffer.g1() == 1 return CamMoveToV3( x, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToCoordinateV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToCoordinateV2Decoder.kt deleted file mode 100644 index 22dd4f99c..000000000 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToCoordinateV2Decoder.kt +++ /dev/null @@ -1,30 +0,0 @@ -package net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera - -import net.rsprot.buffer.JagByteBuf -import net.rsprot.protocol.ClientProt -import net.rsprox.protocol.ProxyMessageDecoder -import net.rsprox.protocol.game.outgoing.model.camera.CamRotateToCoordinateV2 -import net.rsprox.protocol.session.Session -import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt - -internal class CamRotateToCoordinateV2Decoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.CAM_ROTATETO_COORDINATE_V2 - - override fun decode( - buffer: JagByteBuf, - session: Session, - ): CamRotateToCoordinateV2 { - val x = buffer.g2Alt1() - val cycles = buffer.g2Alt1() - val height = buffer.g2Alt3() - val z = buffer.g2Alt1() - val easing = buffer.g1Alt2() - return CamRotateToCoordinateV2( - x, - z, - height, - cycles, - easing, - ) - } -} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToCoordinateV3Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToCoordinateV3Decoder.kt index f0fbc0b4d..a8c05f0a1 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToCoordinateV3Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamRotateToCoordinateV3Decoder.kt @@ -14,13 +14,13 @@ internal class CamRotateToCoordinateV3Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): CamSkybox { - val model = buffer.g4Alt2() + val model = buffer.g4Alt1() return CamSkybox( model, ) diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamTargetV4Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamTargetV4Decoder.kt index 85bf8f34f..5562b9792 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamTargetV4Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamTargetV4Decoder.kt @@ -15,8 +15,8 @@ internal class CamTargetV4Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): CamTargetV4 { - val type = buffer.g1Alt3() - val value = buffer.g4Alt3() + val type = buffer.g1() + val value = buffer.g4Alt1() return CamTargetV4( when (type) { 0 -> CamTargetV4.PlayerCamTarget(if (value == 65535) -1 else value) diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamUnlockDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamUnlockDecoder.kt index 6e0d26f6c..5bba6de44 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamUnlockDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamUnlockDecoder.kt @@ -14,7 +14,7 @@ internal class CamUnlockDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): CamUnlock { - val unlock = buffer.g1Alt1() == 1 + val unlock = buffer.g1Alt3() == 1 return CamUnlock( unlock, ) diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoLargeV5Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoLargeV5Decoder.kt deleted file mode 100644 index bcd18307b..000000000 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoLargeV5Decoder.kt +++ /dev/null @@ -1,29 +0,0 @@ -package net.rsprox.protocol.v241.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.v241.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(), - 5, - ) - } -} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoSmallV5Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoSmallV5Decoder.kt deleted file mode 100644 index bd50b7613..000000000 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/info/NpcInfoSmallV5Decoder.kt +++ /dev/null @@ -1,29 +0,0 @@ -package net.rsprox.protocol.v241.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.v241.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(), - 5, - ) - } -} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfClearInvDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfClearInvDecoder.kt index 2591b14cf..d417f82bb 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfClearInvDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfClearInvDecoder.kt @@ -2,7 +2,7 @@ package net.rsprox.protocol.v241.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.gCombinedId import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.interfaces.IfClearInv import net.rsprox.protocol.session.Session @@ -15,7 +15,7 @@ internal class IfClearInvDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfClearInv { - val combinedId = buffer.gCombinedIdAlt1() + val combinedId = buffer.gCombinedId() return IfClearInv( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfCloseSubDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfCloseSubDecoder.kt index 4b52f38c3..3da961054 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfCloseSubDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfCloseSubDecoder.kt @@ -2,8 +2,8 @@ package net.rsprox.protocol.v241.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.rsprot.protocol.metadata.Consistent import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.interfaces.IfCloseSub import net.rsprox.protocol.session.Session diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfMoveSubDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfMoveSubDecoder.kt index 9f3fb0f5a..67404387e 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfMoveSubDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfMoveSubDecoder.kt @@ -2,7 +2,7 @@ package net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.util.gCombinedIdAlt3 +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 @@ -15,8 +15,8 @@ internal class IfMoveSubDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfMoveSub { - val sourceCombinedId = buffer.gCombinedIdAlt3() - val destinationCombinedId = buffer.gCombinedIdAlt3() + val sourceCombinedId = buffer.gCombinedIdAlt1() + val destinationCombinedId = buffer.gCombinedIdAlt1() return IfMoveSub( sourceCombinedId.interfaceId, sourceCombinedId.componentId, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfOpenSubDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfOpenSubDecoder.kt index d037a2677..6e521a8ea 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfOpenSubDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfOpenSubDecoder.kt @@ -15,9 +15,9 @@ internal class IfOpenSubDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfOpenSub { - val type = buffer.g1() - val interfaceId = buffer.g2Alt3() val combinedId = buffer.gCombinedIdAlt3() + val interfaceId = buffer.g2Alt2() + val type = buffer.g1Alt1() return IfOpenSub( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfOpenTopDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfOpenTopDecoder.kt index ae4b9c581..95d088416 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfOpenTopDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfOpenTopDecoder.kt @@ -14,7 +14,7 @@ internal class IfOpenTopDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfOpenTop { - val interfaceId = buffer.g2Alt3() + val interfaceId = buffer.g2Alt2() return IfOpenTop( interfaceId, ) diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetAngleDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetAngleDecoder.kt index c987129db..28ff100ec 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetAngleDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetAngleDecoder.kt @@ -2,7 +2,7 @@ package net.rsprox.protocol.v241.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.gCombinedId import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetAngle import net.rsprox.protocol.session.Session @@ -15,10 +15,10 @@ internal class IfSetAngleDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetAngle { - val combinedId = buffer.gCombinedIdAlt1() + val combinedId = buffer.gCombinedId() + val angleX = buffer.g2Alt3() val angleY = buffer.g2Alt2() - val angleX = buffer.g2() - val zoom = buffer.g2() + val zoom = buffer.g2Alt1() return IfSetAngle( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetAnimDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetAnimDecoder.kt index fe3b8b8d2..b049f270c 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetAnimDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetAnimDecoder.kt @@ -16,7 +16,7 @@ internal class IfSetAnimDecoder : ProxyMessageDecoder { session: Session, ): IfSetAnim { val combinedId = buffer.gCombinedId() - val anim = buffer.g2sAlt2() + val anim = buffer.g2sAlt3() return IfSetAnim( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetColourDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetColourDecoder.kt index 840bc43ac..e28129f40 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetColourDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetColourDecoder.kt @@ -2,7 +2,7 @@ package net.rsprox.protocol.v241.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.IfSetColour import net.rsprox.protocol.session.Session @@ -15,8 +15,8 @@ internal class IfSetColourDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetColour { - val colour15BitPacked = buffer.g2Alt3() - val combinedId = buffer.gCombinedIdAlt1() + val combinedId = buffer.gCombinedIdAlt3() + val colour15BitPacked = buffer.g2Alt2() return IfSetColour( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetEventsV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetEventsV2Decoder.kt index 406c07d52..ea41e319d 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetEventsV2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetEventsV2Decoder.kt @@ -15,11 +15,11 @@ internal class IfSetEventsV2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetEventsV2 { + val events1 = buffer.g4Alt2() + val end = buffer.g2Alt3() + val start = buffer.g2Alt1() val combinedId = buffer.gCombinedId() - val events1 = buffer.g4Alt3() - val start = buffer.g2Alt2() val events2 = buffer.g4Alt1() - val end = buffer.g2Alt1() return IfSetEventsV2( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetHideDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetHideDecoder.kt index 97d5bc662..45bee79bf 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetHideDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetHideDecoder.kt @@ -2,7 +2,7 @@ package net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.util.gCombinedIdAlt2 +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 @@ -15,8 +15,8 @@ internal class IfSetHideDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetHide { - val hidden = buffer.g1Alt3() == 1 - val combinedId = buffer.gCombinedIdAlt2() + val combinedId = buffer.gCombinedIdAlt1() + val hidden = buffer.g1() == 1 return IfSetHide( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetModelV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetModelV2Decoder.kt index 2f307bdaa..b1683b7bc 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetModelV2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetModelV2Decoder.kt @@ -2,7 +2,7 @@ package net.rsprox.protocol.v241.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.gCombinedId import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetModelV2 import net.rsprox.protocol.session.Session @@ -15,8 +15,8 @@ internal class IfSetModelV2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetModelV2 { - val model = buffer.g4Alt1() - val combinedId = buffer.gCombinedIdAlt1() + val model = buffer.g4Alt2() + val combinedId = buffer.gCombinedId() return IfSetModelV2( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadActiveDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadActiveDecoder.kt index b8cadacb9..d56e31ae0 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadActiveDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetNpcHeadActiveDecoder.kt @@ -2,7 +2,7 @@ package net.rsprox.protocol.v241.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.IfSetNpcHeadActive import net.rsprox.protocol.session.Session @@ -15,8 +15,8 @@ internal class IfSetNpcHeadActiveDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetNpcHead { - val combinedId = buffer.gCombinedIdAlt2() - val npc = buffer.g2Alt1() + val combinedId = buffer.gCombinedId() + val npc = buffer.g2Alt2() return IfSetNpcHead( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetObjectDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetObjectDecoder.kt index 0dc6ccdff..0e99a8c3e 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetObjectDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetObjectDecoder.kt @@ -2,7 +2,7 @@ package net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.util.gCombinedIdAlt3 +import net.rsprot.protocol.util.gCombinedIdAlt2 import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetObject import net.rsprox.protocol.session.Session @@ -16,8 +16,8 @@ internal class IfSetObjectDecoder : ProxyMessageDecoder { session: Session, ): IfSetObject { val obj = buffer.g2Alt3() - val count = buffer.g4Alt3() - val combinedId = buffer.gCombinedIdAlt3() + val combinedId = buffer.gCombinedIdAlt2() + val count = buffer.g4Alt2() return IfSetObject( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerHeadDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerHeadDecoder.kt index 5fca5ae70..84e0881d5 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerHeadDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerHeadDecoder.kt @@ -2,7 +2,7 @@ package net.rsprox.protocol.v241.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.gCombinedId import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetPlayerHead import net.rsprox.protocol.session.Session @@ -15,7 +15,7 @@ internal class IfSetPlayerHeadDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetPlayerHead { - val combinedId = buffer.gCombinedIdAlt1() + val combinedId = buffer.gCombinedId() return IfSetPlayerHead( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBaseColourDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBaseColourDecoder.kt index 4a9830ecc..382af5e9a 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBaseColourDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetPlayerModelBaseColourDecoder.kt @@ -2,7 +2,7 @@ package net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.util.gCombinedIdAlt2 +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 @@ -15,9 +15,9 @@ internal class IfSetPlayerModelBaseColourDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetPosition { - val x = buffer.g2sAlt2() - val y = buffer.g2sAlt2() - val combinedId = buffer.gCombinedIdAlt1() + val x = buffer.g2sAlt1() + val y = buffer.g2sAlt3() + val combinedId = buffer.gCombinedIdAlt2() return IfSetPosition( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt index a6eab1aa1..920c7feaa 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt @@ -2,7 +2,7 @@ package net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.util.gCombinedIdAlt3 +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 @@ -15,9 +15,9 @@ internal class IfSetRotateSpeedDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetRotateSpeed { - val xSpeed = buffer.g2Alt1() - val combinedId = buffer.gCombinedIdAlt3() - val ySpeed = buffer.g2Alt1() + val combinedId = buffer.gCombinedId() + val xSpeed = buffer.g2() + val ySpeed = buffer.g2Alt2() return IfSetRotateSpeed( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetScrollPosDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetScrollPosDecoder.kt index 1f69b4c8a..7801376c8 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetScrollPosDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetScrollPosDecoder.kt @@ -16,7 +16,7 @@ internal class IfSetScrollPosDecoder : ProxyMessageDecoder { session: Session, ): IfSetScrollPos { val combinedId = buffer.gCombinedIdAlt3() - val scrollPos = buffer.g2() + val scrollPos = buffer.g2Alt1() return IfSetScrollPos( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetTextDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetTextDecoder.kt index bdb6b1760..cd897a0fe 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetTextDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetTextDecoder.kt @@ -2,7 +2,7 @@ package net.rsprox.protocol.v241.game.outgoing.decoder.codec.interfaces import net.rsprot.buffer.JagByteBuf import net.rsprot.protocol.ClientProt -import net.rsprot.protocol.util.gCombinedIdAlt2 +import net.rsprot.protocol.util.gCombinedId import net.rsprox.protocol.ProxyMessageDecoder import net.rsprox.protocol.game.outgoing.model.interfaces.IfSetText import net.rsprox.protocol.session.Session @@ -15,7 +15,7 @@ internal class IfSetTextDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): IfSetText { - val combinedId = buffer.gCombinedIdAlt2() + val combinedId = buffer.gCombinedId() val text = buffer.gjstr() return IfSetText( combinedId.interfaceId, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvFullDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvFullDecoder.kt index 9be8b2d54..3aac22ee1 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvFullDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvFullDecoder.kt @@ -21,11 +21,11 @@ internal class UpdateInvFullDecoder : ProxyMessageDecoder { val objs = buildList { for (i in 0..= 0xFF) { - count = buffer.g4() + count = buffer.g4Alt2() } - val id = buffer.g2() add(UpdateInvFull.Obj(id - 1, count)) } } diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvStopTransmitDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvStopTransmitDecoder.kt index f39642f98..887b47a34 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvStopTransmitDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/inv/UpdateInvStopTransmitDecoder.kt @@ -14,7 +14,7 @@ internal class UpdateInvStopTransmitDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): RebuildRegionV2 { - val zoneZ = buffer.g2Alt2() + val zoneZ = buffer.g2() + val reload = buffer.g1Alt2() == 1 val zoneX = buffer.g2Alt1() - val reload = buffer.g1Alt1() == 1 @Suppress("UnusedVariable", "unused") val distinctMapsquareCount = buffer.g2() diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/map/StaticRebuildV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/map/StaticRebuildV2Decoder.kt index 90fed675f..3ca0fd7ef 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/map/StaticRebuildV2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/map/StaticRebuildV2Decoder.kt @@ -49,9 +49,9 @@ internal class StaticRebuildV2Decoder( } else { null } - val zoneZ = buffer.g2Alt3() - val worldArea = buffer.g2sAlt3() - val zoneX = buffer.g2Alt3() + val zoneZ = buffer.g2() + val zoneX = buffer.g2Alt1() + val worldArea = buffer.g2s() return if (playerInfoInitBlock != null) { val message = RebuildLoginV2( diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ObjUnlockResetDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ObjUnlockResetDecoder.kt new file mode 100644 index 000000000..181bf61f8 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ObjUnlockResetDecoder.kt @@ -0,0 +1,19 @@ +package net.rsprox.protocol.v241.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.ObjUnlockReset +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class ObjUnlockResetDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJUNLOCK_RESET + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ObjUnlockReset { + return ObjUnlockReset + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ObjUnlockUpdateDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ObjUnlockUpdateDecoder.kt new file mode 100644 index 000000000..3a938ddc0 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/client/ObjUnlockUpdateDecoder.kt @@ -0,0 +1,26 @@ +package net.rsprox.protocol.v241.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.ObjUnlockUpdate +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class ObjUnlockUpdateDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJUNLOCK_UPDATE + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ObjUnlockUpdate { + var wordIndex = 0 + val entries = buildList { + while (buffer.isReadable) { + wordIndex = Math.addExact(wordIndex, buffer.gSmart1or2()) + add(ObjUnlockUpdate.Entry(wordIndex, buffer.g8())) + } + } + return ObjUnlockUpdate(entries) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsDecoder.kt index 9751eaa36..1090ddf78 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/ChatFilterSettingsDecoder.kt @@ -14,8 +14,8 @@ internal class ChatFilterSettingsDecoder : ProxyMessageDecoder { session: Session, ): SetPlayerOp { val id = buffer.g1Alt3() - val priority = buffer.g1Alt3() == 1 val op = buffer.gjstr() + val priority = buffer.g1() == 1 return SetPlayerOp( id, priority, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateStatV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateStatV2Decoder.kt index 4faba388d..8f3d62d59 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateStatV2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateStatV2Decoder.kt @@ -14,10 +14,10 @@ internal class UpdateStatV2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): UpdateStatV2 { - val stat = buffer.g1Alt3() val experience = buffer.g4Alt1() - val invisibleBoostedLevel = buffer.g1() - val currentLevel = buffer.g1Alt3() + val invisibleBoostedLevel = buffer.g1Alt1() + val stat = buffer.g1Alt2() + val currentLevel = buffer.g1Alt2() return UpdateStatV2( stat, currentLevel, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV2Decoder.kt new file mode 100644 index 000000000..ee958f924 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV2Decoder.kt @@ -0,0 +1,47 @@ +package net.rsprox.protocol.v241.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.UpdateStockMarketSlotV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class UpdateStockMarketSlotV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateStockMarketSlotV2 { + val slot = buffer.g1() + val firstState = buffer.g1() + // The native reset branch consumes only 28 of the declared 34 bytes. + // Its six trailing bytes are not yet understood: do not invent a reset payload. + check(firstState != 0) { "241 stockmarket V2 reset layout is not yet verified" } + val escaped = firstState and 7 == 7 + val version = if (escaped) buffer.g1() else 1 + val status = if (escaped) buffer.g1() else firstState + val obj = buffer.g2() + val price = if (version >= 2) buffer.g8() else buffer.g4().toLong() and 0xFFFFFFFFL + val count = buffer.g4() + val completedCount = buffer.g4() + val completedGold = if (version >= 2) buffer.g8() else buffer.g4().toLong() and 0xFFFFFFFFL + val extensionLength = if (version >= 2) buffer.g4() else 0 + require(extensionLength in 0..buffer.readableBytes()) { "Invalid offer extension length: $extensionLength" } + val extension = List(extensionLength) { buffer.g1() } + return UpdateStockMarketSlotV2( + slot, + version, + status, + obj, + price, + count, + completedCount, + completedGold, + extension, + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateTradingPostV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateTradingPostV2Decoder.kt new file mode 100644 index 000000000..c66404224 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/UpdateTradingPostV2Decoder.kt @@ -0,0 +1,53 @@ +package net.rsprox.protocol.v241.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.UpdateTradingPostV2 +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +@Consistent +internal class UpdateTradingPostV2Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): UpdateTradingPostV2 { + val hasUpdate = buffer.g1() != 0 + if (!hasUpdate) { + return UpdateTradingPostV2(null) + } + val age = buffer.g8() + val obj = buffer.g2() + val status = buffer.g1() == 1 + val offerCount = buffer.g2() + val offers = + List(offerCount) { + val name = buffer.gjstr() + val previousName = buffer.gjstr() + val world = buffer.g2() + val time = buffer.g8() + val price = buffer.g8() + val count = buffer.g4() + UpdateTradingPostV2.Offer( + name, + previousName, + world, + time, + price, + count, + ) + } + return UpdateTradingPostV2( + UpdateTradingPostV2.OfferList( + age, + obj, + status, + offers, + ), + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStartDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStartDecoder.kt index bacd295fb..113597756 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStartDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStartDecoder.kt @@ -14,8 +14,8 @@ internal class AmbientSoundStartDecoder : ProxyMessageDecoder buffer: JagByteBuf, session: Session, ): AmbientSoundStart { - val id = buffer.g2Alt2() - val fade = buffer.g1Alt2() == 1 + val id = buffer.g2() + val fade = buffer.g1Alt1() == 1 return AmbientSoundStart( id, fade, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStopDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStopDecoder.kt index 882473c98..d1721de8e 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStopDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStopDecoder.kt @@ -14,7 +14,7 @@ internal class AmbientSoundStopDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): AmbientSoundStop { - val fade = buffer.g1Alt3() == 1 + val fade = buffer.g1Alt2() != 0 return AmbientSoundStop( fade, ) diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiJingleDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiJingleDecoder.kt index e35472609..395949811 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiJingleDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiJingleDecoder.kt @@ -14,7 +14,7 @@ internal class MidiJingleDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): MidiJingle { - val id = buffer.g2() + val id = buffer.g2Alt3() val lengthInMillis = buffer.g3Alt1() return MidiJingle( id, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongStopDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongStopDecoder.kt index 52823eb10..800e0156b 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongStopDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongStopDecoder.kt @@ -14,8 +14,8 @@ internal class MidiSongStopDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): MidiSongStop { - val fadeOutDelay = buffer.g2Alt2() - val fadeOutSpeed = buffer.g2Alt1() + val fadeOutDelay = buffer.g2Alt3() + val fadeOutSpeed = buffer.g2Alt2() return MidiSongStop( fadeOutDelay, fadeOutSpeed, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongV2Decoder.kt index 996d940e0..d410ee5ae 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongV2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongV2Decoder.kt @@ -14,11 +14,11 @@ internal class MidiSongV2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): MidiSongV2 { - val fadeOutSpeed = buffer.g2() - val fadeInDelay = buffer.g2Alt1() - val fadeInSpeed = buffer.g2Alt2() + val id = buffer.g2Alt1() + val fadeOutSpeed = buffer.g2Alt1() + val fadeInDelay = buffer.g2Alt2() val fadeOutDelay = buffer.g2() - val id = buffer.g2() + val fadeInSpeed = buffer.g2() return MidiSongV2( id, fadeOutDelay, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongWithSecondaryDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongWithSecondaryDecoder.kt index b7746e433..5cead648b 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongWithSecondaryDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/MidiSongWithSecondaryDecoder.kt @@ -14,12 +14,12 @@ internal class MidiSongWithSecondaryDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): MidiSwap { - val fadeInDelay = buffer.g2Alt3() - val fadeOutSpeed = buffer.g2Alt1() + val fadeInDelay = buffer.g2() val fadeOutDelay = buffer.g2() + val fadeOutSpeed = buffer.g2Alt2() val fadeInSpeed = buffer.g2() return MidiSwap( fadeOutDelay, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/AnimSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/AnimSpecificDecoder.kt index 37049d3e2..12e07ed7f 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/AnimSpecificDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/AnimSpecificDecoder.kt @@ -14,8 +14,8 @@ internal class AnimSpecificDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): AnimSpecific { - val delay = buffer.g1Alt1() - val id = buffer.g2Alt2() + val id = buffer.g2() + val delay = buffer.g1Alt2() return AnimSpecific( id, delay, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/LocAnimSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/LocAnimSpecificDecoder.kt index 91aa62126..0410ce043 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/LocAnimSpecificDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/LocAnimSpecificDecoder.kt @@ -16,9 +16,9 @@ internal class LocAnimSpecificDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): LocAnimSpecific { - val id = buffer.g2Alt3() - val coordInBuildArea = CoordInBuildArea(buffer.g3()) - val locProperties = LocProperties(buffer.g1Alt3()) + val id = buffer.g2Alt1() + val coordInBuildArea = CoordInBuildArea(buffer.g3Alt2()) + val locProperties = LocProperties(buffer.g1Alt2()) return LocAnimSpecific( id, coordInBuildArea, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/MapAnimSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/MapAnimSpecificDecoder.kt index 16b016221..5bcf4050e 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/MapAnimSpecificDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/MapAnimSpecificDecoder.kt @@ -16,9 +16,9 @@ internal class MapAnimSpecificDecoder : ProxyMessageDecoder { session: Session, ): MapAnimSpecific { val id = buffer.g2Alt3() - val delay = buffer.g2Alt3() - val height = buffer.g1() - val coordInBuildArea = CoordInBuildArea(buffer.g3()) + val delay = buffer.g2() + val height = buffer.g1Alt3() + val coordInBuildArea = CoordInBuildArea(buffer.g3Alt2()) return MapAnimSpecific( id, delay, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcAnimSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcAnimSpecificDecoder.kt index ca9eb47a4..ad03562d0 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcAnimSpecificDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcAnimSpecificDecoder.kt @@ -14,9 +14,9 @@ internal class NpcAnimSpecificDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): NpcAnimSpecific { - val index = buffer.g2Alt1() - val id = buffer.g2Alt1() - val delay = buffer.g1Alt1() + val delay = buffer.g1Alt3() + val id = buffer.g2Alt3() + val index = buffer.g2Alt2() return NpcAnimSpecific( index, id, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcHeadIconSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcHeadIconSpecificDecoder.kt index c85404cb7..54bdc87a0 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcHeadIconSpecificDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/NpcHeadIconSpecificDecoder.kt @@ -14,10 +14,10 @@ internal class NpcHeadIconSpecificDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): ObjAddSpecific { - val quantity = buffer.g4Alt1() - val opFlags = OpFlags(buffer.g1Alt2()) + val id = buffer.g2() + val timeUntilPublic = buffer.g2Alt3() + val ownershipType = buffer.g1Alt2() + val quantity = buffer.g4Alt2() val coordGrid = CoordGrid(buffer.g4Alt3()) - val neverBecomesPublic = buffer.g1Alt2() == 1 - val id = buffer.g2Alt2() - val timeUntilDespawn = buffer.g2() - val ownershipType = buffer.g1() - val timeUntilPublic = buffer.g2Alt1() + val opFlags = OpFlags(buffer.g1()) + val neverBecomesPublic = buffer.g1() == 1 + val timeUntilDespawn = buffer.g2Alt1() return ObjAddSpecific( id, quantity, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCountSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCountSpecificDecoder.kt index 9e3b8ee0f..aefe5ffa4 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCountSpecificDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCountSpecificDecoder.kt @@ -15,10 +15,10 @@ internal class ObjCountSpecificDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): ObjCountSpecific { - val id = buffer.g2Alt1() + val newQuantity = buffer.g4Alt1() + val oldQuantity = buffer.g4Alt3() val coordGrid = CoordGrid(buffer.g4Alt2()) - val oldQuantity = buffer.g4Alt1() - val newQuantity = buffer.g4Alt2() + val id = buffer.g2Alt3() return ObjCountSpecific( id, oldQuantity, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt index 69dc653b5..a71c9c65a 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt @@ -15,14 +15,14 @@ internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC_V2 + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): ObjCustomiseSpecificV2 { + val packedCoord = buffer.g4() + val coord = CoordGrid(packedCoord) + val id = buffer.g2Alt3() + val modelId = buffer.g2Alt3() + val model = if (modelId == 65535) -1 else modelId + val retextureCount = buffer.g1Alt3() + val retextures = + List(retextureCount) { + val index = buffer.g1Alt2() + val value = buffer.g2Alt2() + ObjCustomiseSpecificV2.Replacement(index, value) + } + val quantity = buffer.g4Alt3() + val recolourCount = buffer.g1Alt2() + val recolours = + List(recolourCount) { + val index = buffer.g1Alt3() + val value = buffer.g2Alt1() + ObjCustomiseSpecificV2.Replacement(index, value) + } + val hasColour = buffer.g1() == 1 + val colour = if (hasColour) buffer.g2() else null + return ObjCustomiseSpecificV2(id, quantity, model, recolours, retextures, colour, coord) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjEnabledOpsSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjEnabledOpsSpecificDecoder.kt index a10dee7c9..935e7a4b1 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjEnabledOpsSpecificDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjEnabledOpsSpecificDecoder.kt @@ -16,9 +16,9 @@ internal class ObjEnabledOpsSpecificDecoder : ProxyMessageDecoder { session: Session, ): VarpLarge { val id = buffer.g2Alt3() - val value = buffer.g4Alt1() + val value = buffer.g4Alt3() return VarpLarge( id, value, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpLongDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpLongDecoder.kt new file mode 100644 index 000000000..cc03a0343 --- /dev/null +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpLongDecoder.kt @@ -0,0 +1,25 @@ +package net.rsprox.protocol.v241.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.VarpLong +import net.rsprox.protocol.session.Session +import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt + +internal class VarpLongDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.VARP_LONG + + override fun decode( + buffer: JagByteBuf, + session: Session, + ): VarpLong { + val high = buffer.g4Alt3() + val low = buffer.g4Alt3() + val id = buffer.g2() + return VarpLong( + id, + (high.toLong() shl 32) or (low.toLong() and 0xFFFFFFFFL), + ) + } +} diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpSmallDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpSmallDecoder.kt index 45589868f..4def2ab05 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpSmallDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/varp/VarpSmallDecoder.kt @@ -14,8 +14,8 @@ internal class VarpSmallDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): VarpSmall { - val id = buffer.g2Alt2() - val value = buffer.g1sAlt2() + val value = buffer.g1sAlt3() + val id = buffer.g2Alt1() return VarpSmall( id, value, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZoneFullFollowsDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZoneFullFollowsDecoder.kt index c4d954f55..36d910719 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZoneFullFollowsDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZoneFullFollowsDecoder.kt @@ -15,8 +15,8 @@ internal class UpdateZoneFullFollowsDecoder : ProxyMessageDecoder, ) { - LOC_ADD_CHANGE_V2(LocAddChangeV2Decoder()), - SCRIPTEDPROJ_CHANGE(ScriptedProjChangeDecoder()), - SCRIPTEDPROJ_ADD(ScriptedProjAddDecoder()), - LOC_ANIM(LocAnimDecoder()), + MAP_ANIM(MapAnimDecoder()), MAP_PROJANIM_V2(MapProjAnimV2Decoder()), - LOC_MERGE(LocMergeDecoder()), - OBJ_ADD(ObjAddDecoder()), - OBJ_CUSTOMISE(ObjCustomiseDecoder()), OBJ_COUNT(ObjCountDecoder()), LOC_DEL(LocDelDecoder()), OBJ_ENABLED_OPS(ObjEnabledOpsDecoder()), - SOUND_AREA(SoundAreaDecoder()), OBJ_DEL(ObjDelDecoder()), + LOC_ANIM(LocAnimDecoder()), + OBJ_CUSTOMISE(ObjCustomiseDecoder()), OBJ_UNCUSTOMISE(ObjUncustomiseDecoder()), - MAP_ANIM(MapAnimDecoder()), + OBJ_ADD(ObjAddDecoder()), + SCRIPTEDPROJ_CHANGE(ScriptedProjChangeDecoder()), + LOC_ADD_CHANGE_V2(LocAddChangeV2Decoder()), + LOC_MERGE(LocMergeDecoder()), + SCRIPTEDPROJ_ADD(ScriptedProjAddDecoder()), + SOUND_AREA(SoundAreaDecoder()), } } diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZonePartialFollowsDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZonePartialFollowsDecoder.kt index 7341d5dc2..655f2a935 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZonePartialFollowsDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/header/UpdateZonePartialFollowsDecoder.kt @@ -14,9 +14,9 @@ internal class UpdateZonePartialFollowsDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): LocAddChangeV2 { - val opFlags = OpFlags(buffer.g1Alt3()) - val opOverrideCount = buffer.g1() + val locProperties = LocProperties(buffer.g1Alt1()) + val opFlags = OpFlags(buffer.g1()) + val coordInZone = CoordInZone(buffer.g1()) + val opOverrideCount = buffer.g1Alt2() val opOverrides: Map? = if (opOverrideCount > 0) { buildMap { for (i in 0.. { } else { null } - val coordInZone = CoordInZone(buffer.g1()) - val id = buffer.g2Alt2() - val locProperties = LocProperties(buffer.g1()) + val id = buffer.g2() return LocAddChangeV2( id, coordInZone, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocAnimDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocAnimDecoder.kt index 938cdc8c2..23006a1a3 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocAnimDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocAnimDecoder.kt @@ -16,9 +16,9 @@ internal class LocAnimDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): LocAnim { - val coordInZone = CoordInZone(buffer.g1Alt1()) - val locProperties = LocProperties(buffer.g1()) - val id = buffer.g2Alt2() + val locProperties = LocProperties(buffer.g1Alt1()) + val coordInZone = CoordInZone(buffer.g1Alt2()) + val id = buffer.g2Alt3() return LocAnim( id, coordInZone, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocDelDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocDelDecoder.kt index 9cc2f8ba1..8cf50d4ee 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocDelDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocDelDecoder.kt @@ -16,8 +16,8 @@ internal class LocDelDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): LocDel { - val coordInZone = CoordInZone(buffer.g1()) val locProperties = LocProperties(buffer.g1Alt3()) + val coordInZone = CoordInZone(buffer.g1()) return LocDel( coordInZone, locProperties, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt index 26e8cb1fe..d9537ee62 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt @@ -4,8 +4,6 @@ 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.v241.game.outgoing.decoder.prot.GameServerProt @@ -16,27 +14,8 @@ internal class LocMergeDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): LocMerge { - val minZ = buffer.g1s() - val id = buffer.g2Alt3() - val end = buffer.g2() - val locProperties = LocProperties(buffer.g1Alt2()) - val start = buffer.g2Alt3() - val maxZ = buffer.g1sAlt2() - val minX = buffer.g1s() - val maxX = buffer.g1sAlt2() - val index = buffer.g2Alt2() - val coordInZone = CoordInZone(buffer.g1Alt2()) - return LocMerge( - index, - id, - coordInZone, - locProperties, - start, - end, - minX, - minZ, - maxX, - maxZ, + throw UnsupportedOperationException( + "241 LOC_MERGE is consume-only in the native client; its legacy payload semantics are unverified", ) } } diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt index 2534c9029..38646ccda 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt @@ -15,10 +15,10 @@ internal class MapAnimDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): MapAnim { + val delay = buffer.g2Alt1() + val height = buffer.g1() val id = buffer.g2Alt3() - val delay = buffer.g2Alt3() - val coordInZone = CoordInZone(buffer.g1()) - val height = buffer.g1Alt2() + val coordInZone = CoordInZone(buffer.g1Alt2()) return MapAnim( id, delay, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapProjAnimV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapProjAnimV2Decoder.kt index d5f5514c6..a135ae2ea 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapProjAnimV2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapProjAnimV2Decoder.kt @@ -16,17 +16,17 @@ internal class MapProjAnimV2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): MapProjAnimV2 { - val progress = buffer.g2Alt2() + val angle = buffer.g1Alt2() val id = buffer.g2() - val angle = buffer.g1Alt3() - val endHeight = buffer.g2Alt3() - val targetIndex = buffer.g3sAlt1() - val end = CoordGrid(buffer.g4()) - val coordInZone = CoordInZone(buffer.g1Alt2()) - val startHeight = buffer.g2() - val endTime = buffer.g2Alt3() - val sourceIndex = buffer.g3s() + val sourceIndex = buffer.g3sAlt3() val startTime = buffer.g2Alt3() + val startHeight = buffer.g2Alt1() + val coordInZone = CoordInZone(buffer.g1()) + val endHeight = buffer.g2Alt2() + val progress = buffer.g2Alt2() + val targetIndex = buffer.g3sAlt2() + val endTime = buffer.g2Alt2() + val end = CoordGrid(buffer.g4Alt3()) return MapProjAnimV2( id, startHeight, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt index 36faf828a..3b0feec36 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt @@ -16,14 +16,14 @@ internal class ObjAddDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): ObjAdd { - val timeUntilDespawn = buffer.g2() - val timeUntilPublic = buffer.g2() - val quantity = buffer.g4Alt3() - val neverBecomesPublic = buffer.g1() == 1 + val ownershipType = buffer.g1Alt2() + val coordInZone = CoordInZone(buffer.g1Alt2()) val id = buffer.g2Alt1() - val coordInZone = CoordInZone(buffer.g1Alt1()) + val timeUntilDespawn = buffer.g2Alt2() val opFlags = OpFlags(buffer.g1Alt2()) - val ownershipType = buffer.g1Alt2() + val quantity = buffer.g4() + val timeUntilPublic = buffer.g2Alt3() + val neverBecomesPublic = buffer.g1Alt3() == 1 return ObjAdd( id, quantity, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjCountDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjCountDecoder.kt index 9c0462650..de0496543 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjCountDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/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 oldQuantity = buffer.g4Alt3() - val newQuantity = buffer.g4() + val coordInZone = CoordInZone(buffer.g1()) val id = buffer.g2Alt3() + val newQuantity = buffer.g4Alt3() + val oldQuantity = buffer.g4() return ObjCount( id, oldQuantity, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjCustomiseDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjCustomiseDecoder.kt index 75d6080c2..3e5736a76 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjCustomiseDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjCustomiseDecoder.kt @@ -15,14 +15,14 @@ internal class ObjCustomiseDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): ObjCustomise { - val recolIndex = buffer.g2sAlt1() - val id = buffer.g2Alt2() - val coordInZone = CoordInZone(buffer.g1Alt1()) - val recol = buffer.g2sAlt1() - val retexIndex = buffer.g2sAlt1() - val retex = buffer.g2sAlt3() - val quantity = buffer.g4Alt3() - val model = buffer.g2Alt3() + val coordInZone = CoordInZone(buffer.g1Alt2()) + val id = buffer.g2Alt3() + val recolIndex = buffer.g2s() + val quantity = buffer.g4Alt2() + val model = buffer.g2() + val retex = buffer.g2s() + val retexIndex = buffer.g2s() + val recol = buffer.g2sAlt2() return ObjCustomise( id, quantity, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjDelDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjDelDecoder.kt index 5641575c3..d315c7757 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjDelDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjDelDecoder.kt @@ -16,7 +16,7 @@ internal class ObjDelDecoder : ProxyMessageDecoder { session: Session, ): ObjDel { val id = buffer.g2Alt1() - val coordInZone = CoordInZone(buffer.g1Alt3()) + val coordInZone = CoordInZone(buffer.g1Alt2()) val quantity = buffer.g4() return ObjDel( id, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjEnabledOpsDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjEnabledOpsDecoder.kt index 5e4d96fbb..6fb56b09c 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjEnabledOpsDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjEnabledOpsDecoder.kt @@ -17,8 +17,8 @@ internal class ObjEnabledOpsDecoder : ProxyMessageDecoder { session: Session, ): ObjEnabledOps { val id = buffer.g2Alt2() - val opFlags = OpFlags(buffer.g1Alt2()) - val coordInZone = CoordInZone(buffer.g1Alt3()) + val opFlags = OpFlags(buffer.g1()) + val coordInZone = CoordInZone(buffer.g1Alt2()) return ObjEnabledOps( id, opFlags, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjUncustomiseDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjUncustomiseDecoder.kt index 5e98dafca..d32a894a7 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjUncustomiseDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjUncustomiseDecoder.kt @@ -15,9 +15,9 @@ internal class ObjUncustomiseDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): ObjUncustomise { - val quantity = buffer.g4Alt3() - val coordInZone = CoordInZone(buffer.g1Alt1()) - val id = buffer.g2Alt1() + val coordInZone = CoordInZone(buffer.g1()) + val id = buffer.g2() + val quantity = buffer.g4() return ObjUncustomise( id, quantity, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjAddDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjAddDecoder.kt index 664b1f3d7..161cb8f65 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjAddDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjAddDecoder.kt @@ -16,23 +16,23 @@ internal class ScriptedProjAddDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): ScriptedProjAdd { - val targetIndex = buffer.g3sAlt3() - val targetHeight = buffer.g2s() - val endTime = buffer.g2Alt3() - val slot = buffer.g2Alt3() - val sourceOffsetZ = buffer.g2s() + val curveScriptT = buffer.g2() val sourceIndex = buffer.g3sAlt1() - val curveScriptH = buffer.g2Alt2() - val id = buffer.g2Alt1() - val sourceOffsetX = buffer.g2sAlt3() - val sourceHeight = buffer.g2s() - val coordInZone = CoordInZone(buffer.g1Alt1()) - val targetCoord = CoordGrid(buffer.g4Alt1()) + val sourceHeight = buffer.g2sAlt2() + val targetHeight = buffer.g2sAlt3() + val sourceOffsetX = buffer.g2s() + val targetOffsetX = buffer.g2sAlt2() + val targetOffsetZ = buffer.g2sAlt1() + val id = buffer.g2Alt2() + val targetIndex = buffer.g3sAlt2() + val endTime = buffer.g2() + val slot = buffer.g2Alt3() val startTime = buffer.g2() - val targetOffsetZ = buffer.g2sAlt2() - val targetOffsetX = buffer.g2s() - val curveScriptT = buffer.g2Alt1() + val sourceOffsetZ = buffer.g2sAlt2() val curveScriptA = buffer.g2Alt3() + val targetCoord = CoordGrid(buffer.g4Alt1()) + val curveScriptH = buffer.g2Alt3() + val coordInZone = CoordInZone(buffer.g1Alt2()) return ScriptedProjAdd( slot, id, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjChangeDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjChangeDecoder.kt index d7b5952d8..ec24d5e61 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjChangeDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjChangeDecoder.kt @@ -15,14 +15,14 @@ internal class ScriptedProjChangeDecoder : ProxyMessageDecoder { ): SoundArea { val size = buffer.g1Alt1() val loops = buffer.g1Alt1() + val radius = buffer.g1() + val coordInZone = CoordInZone(buffer.g1Alt2()) val delay = buffer.g1Alt3() - val coordInZone = CoordInZone(buffer.g1Alt1()) - val radius = buffer.g1Alt2() - val id = buffer.g2Alt3() + val id = buffer.g2() return SoundArea( id, delay, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/GameServerProt.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/GameServerProt.kt index d4fbe1e8b..3073fbd48 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/GameServerProt.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/GameServerProt.kt @@ -85,11 +85,10 @@ public enum class GameServerProt( OBJ_UNCUSTOMISE_SPECIFIC(GameServerProtId.OBJ_UNCUSTOMISE_SPECIFIC, 10), OBJ_COUNT_SPECIFIC(GameServerProtId.OBJ_COUNT_SPECIFIC, 14), OBJ_CUSTOMISE_SPECIFIC(GameServerProtId.OBJ_CUSTOMISE_SPECIFIC, 20), + OBJ_CUSTOMISE_SPECIFIC_V2(GameServerProtId.OBJ_CUSTOMISE_SPECIFIC_V2, Prot.VAR_SHORT), // 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), NPC_INFO_SMALL_V6(GameServerProtId.NPC_INFO_SMALL_V6, Prot.VAR_SHORT), NPC_INFO_LARGE_V6(GameServerProtId.NPC_INFO_LARGE_V6, Prot.VAR_SHORT), @@ -107,6 +106,7 @@ public enum class GameServerProt( // Varp packets VARP_SMALL(GameServerProtId.VARP_SMALL, 3), VARP_LARGE(GameServerProtId.VARP_LARGE, 6), + VARP_LONG(GameServerProtId.VARP_LONG, 10), VARP_RESET(GameServerProtId.VARP_RESET, 0), VARP_SYNC(GameServerProtId.VARP_SYNC, 0), @@ -114,16 +114,11 @@ public enum class GameServerProt( CAM_SHAKE(GameServerProtId.CAM_SHAKE, 4), CAM_RESET(GameServerProtId.CAM_RESET, 0), CAM_SMOOTHRESET(GameServerProtId.CAM_SMOOTHRESET, 4), - CAM_MOVETO_V2(GameServerProtId.CAM_MOVETO_V2, 8), CAM_MOVETO_V3(GameServerProtId.CAM_MOVETO_V3, 9), - CAM_MOVETO_CYCLES_V2(GameServerProtId.CAM_MOVETO_CYCLES_V2, 10), CAM_MOVETO_CYCLES_V3(GameServerProtId.CAM_MOVETO_CYCLES_V3, 11), - CAM_MOVETO_ARC_V2(GameServerProtId.CAM_MOVETO_ARC_V2, 14), CAM_MOVETO_ARC_V3(GameServerProtId.CAM_MOVETO_ARC_V3, 15), - CAM_LOOKAT_V2(GameServerProtId.CAM_LOOKAT_V2, 8), CAM_LOOKAT_V3(GameServerProtId.CAM_LOOKAT_V3, 9), CAM_LOOKAT_CYCLES(GameServerProtId.CAM_LOOKAT_CYCLES, 10), - CAM_ROTATETO_COORDINATE_V2(GameServerProtId.CAM_ROTATETO_COORDINATE_V2, 9), CAM_ROTATETO_COORDINATE_V3(GameServerProtId.CAM_ROTATETO_COORDINATE_V3, 11), CAM_ROTATEBY(GameServerProtId.CAM_ROTATEBY, 7), CAM_ROTATETO(GameServerProtId.CAM_ROTATETO, 7), @@ -187,7 +182,9 @@ public enum class GameServerProt( 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_TRADINGPOST_V2(GameServerProtId.UPDATE_TRADINGPOST_V2, Prot.VAR_SHORT), UPDATE_STOCKMARKET_SLOT(GameServerProtId.UPDATE_STOCKMARKET_SLOT, 20), + UPDATE_STOCKMARKET_SLOT_V2(GameServerProtId.UPDATE_STOCKMARKET_SLOT_V2, 34), ACCOUNT_FLAGS(GameServerProtId.ACCOUNT_FLAGS, 8), // Misc. client state packets @@ -203,6 +200,10 @@ public enum class GameServerProt( SET_INTERACTION_MODE(GameServerProtId.SET_INTERACTION_MODE, 4), RESET_INTERACTION_MODE(GameServerProtId.RESET_INTERACTION_MODE, 2), + // Obj unlock system (potential Bronzeman mode) + OBJUNLOCK_RESET(GameServerProtId.OBJUNLOCK_RESET, 0), + OBJUNLOCK_UPDATE(GameServerProtId.OBJUNLOCK_UPDATE, Prot.VAR_SHORT), + // Misc. client packets URL_OPEN(GameServerProtId.URL_OPEN, Prot.VAR_SHORT), SITE_SETTINGS(GameServerProtId.SITE_SETTINGS, Prot.VAR_BYTE), diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/GameServerProtId.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/GameServerProtId.kt index b131ad756..b4b4b63f0 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/GameServerProtId.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/GameServerProtId.kt @@ -1,156 +1,156 @@ package net.rsprox.protocol.v241.game.outgoing.decoder.prot internal object GameServerProtId { - const val CAM_TARGET_V4 = 0 - const val IF_SETOBJECT = 1 - const val MESSAGE_FRIENDCHANNEL = 2 - const val HINT_ARROW = 3 - const val IF_SETANGLE = 4 - const val CLANSETTINGS_DELTA = 5 - const val SET_INTERACTION_MODE = 6 - const val CLANCHANNEL_FULL = 7 - const val MIDI_SONG_STOP = 8 - const val UPDATE_IGNORELIST = 9 - const val RUNCLIENTSCRIPT = 10 + const val LOGOUT = 1 + const val SERVER_TICK_END = 2 + const val UPDATE_RUNENERGY = 3 + const val OCULUS_SYNC = 4 + const val TRIGGER_ONDIALOGABORT = 5 + const val CAM_TARGET_V3 = 6 + const val IF_SETANIM = 7 + const val CAM_RESET = 8 + const val SITE_SETTINGS = 9 + const val UPDATE_UID192 = 10 const val IF_SETTEXT = 11 - const val REBUILD_REGION_V2 = 12 - const val MAP_ANIM = 13 - const val UPDATE_INV_STOPTRANSMIT = 14 - const val SET_HEATMAP_ENABLED = 15 - const val SOUND_AREA = 16 - const val CAM_RESET = 17 - const val CHAT_FILTER_SETTINGS = 18 - const val UPDATE_RUNWEIGHT = 19 - const val SET_ACTIVE_WORLD_V2 = 20 - const val VARCLAN = 21 - const val IF_SETPLAYERHEAD = 22 - const val UPDATE_INV_PARTIAL = 23 - const val UPDATE_FRIENDLIST = 24 - const val VARCLAN_DISABLE = 25 - const val LOGOUT_TRANSFER = 26 - const val MESSAGE_PRIVATE_ECHO = 27 - const val IF_SETCOLOUR = 28 - const val UPDATE_TRADINGPOST = 29 - const val IF_RESYNC_V2 = 30 - const val MIDI_SWAP = 31 - const val CAM_MODE = 32 - const val CAM_ROTATETO = 33 - const val CAM_SMOOTHRESET = 34 - const val IF_OPENTOP = 35 - const val MESSAGE_PRIVATE = 36 - const val LOGOUT = 37 - const val LOC_ADD_CHANGE_V2 = 38 - const val REBUILD_NORMAL_V2 = 39 - const val MIDI_JINGLE = 40 - const val LOC_DEL = 41 - const val IF_SETPLAYERMODEL_BASECOLOUR = 42 - const val MESSAGE_CLANCHANNEL = 43 - const val UNKNOWN_STRING = 44 - const val IF_OPENSUB = 45 - const val CLANCHANNEL_DELTA = 46 - const val MIDI_SONG_WITHSECONDARY = 47 - const val LOC_MERGE = 48 - const val UPDATE_ZONE_PARTIAL_ENCLOSED = 49 - const val IF_SETPLAYERMODEL_OBJ = 50 - const val IF_MOVESUB = 51 - const val OBJ_CUSTOMISE_SPECIFIC = 52 - const val SITE_SETTINGS = 53 - const val IF_SETHIDE = 54 - const val HIDELOCOPS = 55 - const val LOGOUT_WITHREASON = 56 - const val PACKET_GROUP_START = 57 - const val RESET_ANIMS = 58 - const val IF_SETANIM = 59 - const val IF_CLEARINV = 60 - const val IF_SETNPCHEAD = 61 - const val IF_SETPLAYERMODEL_SELF = 62 - const val UPDATE_STAT_V2 = 63 - const val IF_SETPLAYERMODEL_BODYTYPE = 64 - const val OCULUS_SYNC = 65 - const val UPDATE_REBOOT_TIMER_V2 = 66 - const val IF_SETNPCHEAD_ACTIVE = 67 - const val VARP_RESET = 68 - const val HISCORE_REPLY = 69 - const val FRIENDLIST_LOADED = 70 - const val CAM_TARGET_V3 = 71 - const val PROJANIM_SPECIFIC_V4 = 72 - const val MESSAGE_GAME = 73 - const val UPDATE_INV_FULL = 74 - const val REBUILD_WORLDENTITY_V4 = 75 - const val CHAT_FILTER_SETTINGS_PRIVATECHAT = 76 - const val TRIGGER_ONDIALOGABORT = 77 - const val IF_SETSCROLLPOS = 78 - const val MESSAGE_CLANCHANNEL_SYSTEM = 79 - const val WORLDENTITY_INFO_V7 = 80 - const val MIDI_SONG_V2 = 81 - const val ACCOUNT_FLAGS = 82 - const val PLAYER_SPOTANIM_SPECIFIC = 83 - const val LOC_ANIM_SPECIFIC = 84 - const val SET_PLAYER_OP = 85 - const val OBJ_DEL_SPECIFIC = 86 - const val OBJ_ENABLED_OPS_SPECIFIC = 87 - const val UPDATE_FRIENDCHAT_CHANNEL_FULL_V2 = 88 - const val OBJ_UNCUSTOMISE_SPECIFIC = 89 - const val MAP_ANIM_SPECIFIC = 90 - const val PLAYER_INFO = 91 - const val SERVER_TICK_END = 92 - const val NPC_INFO_LARGE_V5 = 93 - const val VARP_LARGE = 94 - const val CAM_ROTATEBY = 95 - const val NPC_HEADICON_SPECIFIC = 96 - const val CLANSETTINGS_FULL = 97 - const val SYNTH_SOUND = 98 - const val UPDATE_UID192 = 99 - const val VARP_SYNC = 100 - const val NPC_SPOTANIM_SPECIFIC = 101 - const val ANIM_SPECIFIC = 102 - const val UPDATE_STOCKMARKET_SLOT = 103 - const val VARCLAN_ENABLE = 104 - const val IF_SETROTATESPEED = 105 - const val IF_SETEVENTS_V2 = 106 - const val URL_OPEN = 107 - const val IF_SETPOSITION = 108 - const val UPDATE_FRIENDCHAT_CHANNEL_SINGLEUSER = 109 - const val HIDENPCOPS = 110 - const val SET_NPC_UPDATE_ORIGIN = 111 - const val HIDEOBJOPS = 112 - const val CAM_SHAKE = 113 - const val OBJ_ADD_SPECIFIC = 114 - const val SEND_PING = 115 - const val IF_CLOSESUB = 116 - const val NPC_ANIM_SPECIFIC = 117 - const val UPDATE_ZONE_PARTIAL_FOLLOWS = 118 - const val NPC_INFO_SMALL_V5 = 119 - const val UPDATE_RUNENERGY = 120 - const val RESET_INTERACTION_MODE = 121 - const val MINIMAP_TOGGLE = 122 - const val LOC_ANIM = 123 - const val OBJ_COUNT_SPECIFIC = 124 - const val REFLECTION_CHECKER = 125 - const val UPDATE_ZONE_FULL_FOLLOWS = 126 - const val VARP_SMALL = 127 - const val CAM_ROTATETO_COORDINATE_V3 = 128 - const val UNHANDLED = 129 - const val CAM_MOVETO_CYCLES_V3 = 130 - const val CAM_MOVETO_ARC_V3 = 131 - const val IF_SETMODEL_V2 = 132 - const val CAM_ROTATETO_COORDINATE_V2 = 133 - const val CAM_MOVETO_V3 = 134 - const val AMBIENTSOUND_START = 135 - const val SET_MAP_FLAG_V2 = 136 + const val OBJ_CUSTOMISE_SPECIFIC = 12 + const val MESSAGE_CLANCHANNEL_SYSTEM = 13 + const val OBJ_UNCUSTOMISE_SPECIFIC = 14 + const val IF_SETROTATESPEED = 15 + const val UPDATE_TRADINGPOST = 16 + const val ANIM_SPECIFIC = 17 + const val UPDATE_FRIENDCHAT_CHANNEL_FULL_V2 = 18 + const val OBJ_DEL_SPECIFIC = 19 + const val LOGOUT_TRANSFER = 20 + const val VARP_SMALL = 21 + const val IF_MOVESUB = 22 + const val SET_NPC_UPDATE_ORIGIN = 23 + const val VARP_LONG = 24 + const val HISCORE_REPLY = 25 + const val CAM_SHAKE = 26 + const val PLAYER_INFO = 27 + const val UPDATE_INV_PARTIAL = 28 + const val MIDI_SONG_V2 = 29 + const val VARP_RESET = 30 + const val ACCOUNT_FLAGS = 31 + const val UPDATE_TRADINGPOST_V2 = 32 + const val LOC_ANIM_SPECIFIC = 33 + const val UPDATE_RUNWEIGHT = 34 + const val CLANCHANNEL_FULL = 36 + const val LOC_ANIM = 37 + const val UPDATE_INV_STOPTRANSMIT = 38 + const val REBUILD_REGION_V2 = 39 + const val VARP_LARGE = 40 + const val HIDEOBJOPS = 41 + const val CAM_SMOOTHRESET = 42 + const val LOC_MERGE = 43 + const val CLANCHANNEL_DELTA = 44 + const val IF_CLOSESUB = 45 + const val HIDELOCOPS = 46 + const val IF_SETPLAYERMODEL_BODYTYPE = 47 + const val LOC_ADD_CHANGE_V2 = 48 + const val IF_SETANGLE = 49 + const val MIDI_SONG_STOP = 50 + const val CHAT_FILTER_SETTINGS = 51 + const val VARCLAN_DISABLE = 52 + const val RESET_INTERACTION_MODE = 53 + const val LOC_DEL = 54 + const val UPDATE_ZONE_PARTIAL_FOLLOWS = 55 + const val OBJ_ENABLED_OPS_SPECIFIC = 56 + const val IF_SETHIDE = 57 + const val PACKET_GROUP_START = 58 + const val MIDI_SWAP = 59 + const val OBJ_ADD_SPECIFIC = 60 + const val UPDATE_IGNORELIST = 61 + const val RUNCLIENTSCRIPT = 62 + const val URL_OPEN = 63 + const val CLANSETTINGS_DELTA = 64 + const val IF_SETPLAYERMODEL_SELF = 65 + const val CLANSETTINGS_FULL = 66 + const val IF_SETPLAYERHEAD = 67 + const val UPDATE_ZONE_FULL_FOLLOWS = 68 + const val SYNTH_SOUND = 69 + const val UPDATE_STOCKMARKET_SLOT = 70 + const val RESET_ANIMS = 71 + const val MINIMAP_TOGGLE = 72 + const val IF_SETNPCHEAD = 73 + const val LOGOUT_WITHREASON = 74 + const val IF_SETEVENTS_V2 = 75 + const val VARP_SYNC = 76 + const val IF_SETPLAYERMODEL_BASECOLOUR = 77 + const val MESSAGE_PRIVATE_ECHO = 78 + const val MIDI_SONG_WITHSECONDARY = 79 + const val IF_CLEARINV = 80 + const val SET_PLAYER_OP = 81 + const val PLAYER_SPOTANIM_SPECIFIC = 82 + const val IF_SETPLAYERMODEL_OBJ = 83 + const val MIDI_JINGLE = 84 + const val OBJ_COUNT_SPECIFIC = 85 + const val HINT_ARROW = 86 + const val IF_SETSCROLLPOS = 87 + const val UPDATE_FRIENDLIST = 88 + const val SET_INTERACTION_MODE = 89 + const val FRIENDLIST_LOADED = 90 + const val NPC_ANIM_SPECIFIC = 91 + const val IF_SETPOSITION = 92 + const val IF_OPENSUB = 93 + const val MESSAGE_CLANCHANNEL = 94 + const val CAM_ROTATETO = 95 + const val REBUILD_NORMAL_V2 = 96 + const val MESSAGE_FRIENDCHANNEL = 97 + const val CAM_ROTATEBY = 98 + const val PROJANIM_SPECIFIC_V4 = 99 + const val SEND_PING = 100 + const val HIDENPCOPS = 101 + const val UPDATE_STOCKMARKET_SLOT_V2 = 102 + const val SET_ACTIVE_WORLD_V2 = 103 + const val NPC_SPOTANIM_SPECIFIC = 104 + const val MAP_ANIM = 105 + const val SOUND_AREA = 106 + const val UPDATE_ZONE_PARTIAL_ENCLOSED = 107 + const val UNKNOWN_STRING = 108 + const val MAP_ANIM_SPECIFIC = 109 + const val UPDATE_STAT_V2 = 110 + const val IF_SETCOLOUR = 111 + const val VARCLAN_ENABLE = 112 + const val VARCLAN = 113 + const val UPDATE_FRIENDCHAT_CHANNEL_SINGLEUSER = 114 + const val NPC_HEADICON_SPECIFIC = 115 + const val IF_RESYNC_V2 = 116 + const val REBUILD_WORLDENTITY_V4 = 117 + const val CHAT_FILTER_SETTINGS_PRIVATECHAT = 118 + const val UPDATE_REBOOT_TIMER_V2 = 119 + const val IF_OPENTOP = 120 + const val CAM_MODE = 121 + const val CAM_TARGET_V4 = 122 + const val IF_SETOBJECT = 123 + const val MESSAGE_GAME = 124 + const val MESSAGE_PRIVATE = 125 + const val UPDATE_INV_FULL = 126 + const val IF_SETNPCHEAD_ACTIVE = 127 + const val GROUP_VAR = 128 + const val AMBIENTSOUND_START = 129 + const val IF_SETMODEL_V2 = 130 + const val NPC_INFO_LARGE_V6 = 131 + const val CAM_MOVETO_CYCLES_V3 = 132 + const val CAM_LOOKAT_V3 = 133 + const val CAM_SKYBOX = 134 + const val OBJUNLOCK_RESET = 135 + const val GROUP_VAR_INT = 136 const val GROUP_VAR_LONG = 137 - const val AMBIENTSOUND_STOP = 138 - const val GROUP_FULL = 139 - const val CAM_SKYBOX = 140 - const val NPC_INFO_LARGE_V6 = 141 - const val GROUP_VAR = 142 - const val CAM_MOVETO_ARC_V2 = 143 - const val GROUP_VAR_INT = 144 - const val CAM_LOOKAT_CYCLES = 145 - const val CAM_LOOKAT_V2 = 146 - const val CAM_MOVETO_CYCLES_V2 = 147 - const val CAM_LOOKAT_V3 = 148 - const val CAM_UNLOCK = 149 + const val GROUP_FULL = 138 + const val SET_MAP_FLAG_V2 = 139 + const val CAM_LOOKAT_CYCLES = 140 + const val WORLDENTITY_INFO_V7 = 141 + const val CAM_MOVETO_V3 = 143 + const val AMBIENTSOUND_STOP = 144 + const val CAM_MOVETO_ARC_V3 = 145 + const val OBJ_CUSTOMISE_SPECIFIC_V2 = 146 + const val OBJUNLOCK_UPDATE = 147 + const val CAM_UNLOCK = 148 + const val CAM_ROTATETO_COORDINATE_V3 = 149 const val NPC_INFO_SMALL_V6 = 150 - const val CAM_MOVETO_V2 = 151 + + const val SET_HEATMAP_ENABLED = -1 + const val REFLECTION_CHECKER = -1 + const val UNHANDLED = -1 } diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt index 6b6ffff3d..cd83a5a45 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt @@ -6,18 +6,13 @@ import net.rsprox.cache.api.CacheProvider import net.rsprox.protocol.MessageDecoderRepository import net.rsprox.protocol.MessageDecoderRepositoryBuilder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamLookAtCyclesDecoder -import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamLookAtV2Decoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamLookAtV3Decoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamModeDecoder -import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamMoveToArcV2Decoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamMoveToArcV3Decoder -import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamMoveToCyclesV2Decoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamMoveToCyclesV3Decoder -import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamMoveToV2Decoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamMoveToV3Decoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamResetDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamRotateBy -import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamRotateToCoordinateV2Decoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamRotateToCoordinateV3Decoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamRotateToDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.camera.CamShakeDecoder @@ -43,9 +38,7 @@ import net.rsprox.protocol.v241.game.outgoing.decoder.codec.group.GroupFullDecod import net.rsprox.protocol.v241.game.outgoing.decoder.codec.group.GroupVarDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.group.GroupVarIntDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.group.GroupVarLongDecoder -import net.rsprox.protocol.v241.game.outgoing.decoder.codec.info.NpcInfoLargeV5Decoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.info.NpcInfoLargeV6Decoder -import net.rsprox.protocol.v241.game.outgoing.decoder.codec.info.NpcInfoSmallV5Decoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.info.NpcInfoSmallV6Decoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.info.PlayerInfoDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.info.SetNpcUpdateOriginDecoder @@ -89,6 +82,8 @@ import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.HideObjO import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.HintArrowDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.HiscoreReplyDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.MinimapToggleDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.ObjUnlockResetDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.ObjUnlockUpdateDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.PacketGroupEndDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.PacketGroupStartDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.client.ReflectionCheckerDecoder @@ -114,7 +109,9 @@ import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.UpdateRu import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.UpdateRunWeightDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.UpdateStatV2Decoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotV2Decoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.UpdateTradingPostDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.misc.player.UpdateTradingPostV2Decoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.social.FriendListLoadedDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.social.MessagePrivateDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.social.MessagePrivateEchoDecoder @@ -136,10 +133,12 @@ import net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific.NpcAnimSpec import net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific.NpcHeadIconSpecificDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific.NpcSpotAnimSpecificDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific.ObjAddSpecificDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific.ObjCustomiseSpecificV2Decoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific.PlayerSpotAnimSpecificDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.specific.ProjAnimSpecificV4Decoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.unknown.UnknownStringDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.varp.VarpLargeDecoder +import net.rsprox.protocol.v241.game.outgoing.decoder.codec.varp.VarpLongDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.varp.VarpResetDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.varp.VarpSmallDecoder import net.rsprox.protocol.v241.game.outgoing.decoder.codec.varp.VarpSyncDecoder @@ -167,17 +166,12 @@ internal object ServerMessageDecoderRepository { ).apply { bind(CamRotateToDecoder()) bind(CamRotateBy()) - bind(CamRotateToCoordinateV2Decoder()) bind(CamRotateToCoordinateV3Decoder()) - bind(CamLookAtV2Decoder()) bind(CamLookAtV3Decoder()) bind(CamLookAtCyclesDecoder()) bind(CamModeDecoder()) - bind(CamMoveToArcV2Decoder()) bind(CamMoveToArcV3Decoder()) - bind(CamMoveToCyclesV2Decoder()) bind(CamMoveToCyclesV3Decoder()) - bind(CamMoveToV2Decoder()) bind(CamMoveToV3Decoder()) bind(CamResetDecoder()) bind(CamShakeDecoder()) @@ -207,8 +201,6 @@ internal object ServerMessageDecoderRepository { bind(UpdateFriendChatChannelSingleUserDecoder()) bind(PlayerInfoDecoder()) - bind(NpcInfoSmallV5Decoder()) - bind(NpcInfoLargeV5Decoder()) bind(NpcInfoSmallV6Decoder()) bind(NpcInfoLargeV6Decoder()) bind(SetNpcUpdateOriginDecoder()) @@ -283,7 +275,9 @@ internal object ServerMessageDecoderRepository { bind(UpdateRunWeightDecoder()) bind(UpdateStatV2Decoder()) bind(UpdateStockMarketSlotDecoder()) + bind(UpdateStockMarketSlotV2Decoder()) bind(UpdateTradingPostDecoder()) + bind(UpdateTradingPostV2Decoder()) bind(AccountFlagsDecoder()) bind(FriendListLoadedDecoder()) @@ -314,13 +308,18 @@ internal object ServerMessageDecoderRepository { bind(ObjCountSpecificDecoder()) bind(ObjEnabledOpsSpecificDecoder()) bind(ObjCustomiseSpecificDecoder()) + bind(ObjCustomiseSpecificV2Decoder()) bind(ObjUncustomiseSpecificDecoder()) bind(VarpLargeDecoder()) bind(VarpResetDecoder()) bind(VarpSmallDecoder()) + bind(VarpLongDecoder()) bind(VarpSyncDecoder()) + bind(ObjUnlockResetDecoder()) + bind(ObjUnlockUpdateDecoder()) + bind(SetActiveWorldV2Decoder()) bind(UpdateZonePartialEnclosedDecoder()) diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/npcinfo/NpcInfoClient.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/npcinfo/NpcInfoClient.kt index ebe84c49d..d835826b6 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/npcinfo/NpcInfoClient.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/npcinfo/NpcInfoClient.kt @@ -149,65 +149,69 @@ internal class NpcInfoClient( throw IllegalStateException("Unused flag used: $flag!") } - if (flag and TINTING != 0) { - decodeTinting(buffer, blocks) - } - if (flag and BAS_CHANGE != 0) { - decodeBaseAnimationSet(buffer, blocks) - } if (flag and SPOTANIM != 0) { decodeSpotanim(buffer, blocks) } - if (flag and HEAD_CUSTOMISATION != 0) { - decodeHeadCustomisationV2(npc.id, buffer, blocks) - } - if (flag and HEADICON_CUSTOMISATION != 0) { - decodeHeadiconCustomisation(buffer, blocks) + if (flag and NPC_FREEZE != 0) { + decodeFreeze(buffer, blocks) } - if (flag and OPS != 0) { - decodeEnabledOps(buffer, blocks) + if (flag and EXACT_MOVE != 0) { + decodeExactMove(buffer, blocks) } if (flag and BODY_CUSTOMISATION_V3 != 0) { decodeBodyCustomisationV3(buffer, blocks) } - if (flag and SAY != 0) { - decodeSay(buffer, blocks) - } - if (flag and NPC_FREEZE != 0) { - decodeFreeze(buffer, blocks) - } if (flag and LEVEL_CHANGE != 0) { decodeCombatLevelChange(buffer, blocks) } - if (flag and EXACT_MOVE != 0) { - decodeExactMove(buffer, blocks) + if (flag and HEAD_CUSTOMISATION != 0) { + decodeHeadCustomisationV2(npc.id, buffer, blocks) + } + if (flag and HEADBARS != 0) { + decodeHeadbars(buffer, blocks) } if (flag and SEQUENCE != 0) { decodeSequence(buffer, blocks) } - if (flag and HITMARKS != 0) { - decodeHitmarks(buffer, blocks) - } if (flag and SPOTANIM_OLD != 0) { - decodeSpotanimOld(buffer, blocks) - } - if (flag and NPC_TRANSPARENCY != 0) { - decodeTransparency(buffer, blocks) + // The retired V2 mask retains only its count byte, even when nonzero. + buffer.g1() } if (flag and BODY_CUSTOMISATION_V2 != 0) { decodeBodyCustomisationV2(npc.id, buffer, blocks) } + if (flag and TINTING != 0) { + decodeTinting(buffer, blocks) + } + if (flag and BODY_CUSTOMISATION_V4 != 0) { + decodeBodyCustomisationV4(buffer, blocks) + } + if (flag and FACING != 0) { + decodeFacing(buffer, blocks) + } + if (flag and HEADICON_CUSTOMISATION != 0) { + decodeHeadiconCustomisation(buffer, blocks) + } + if (flag and SAY != 0) { + decodeSay(buffer, blocks) + } + if (flag and NPC_TRANSPARENCY != 0) { + decodeTransparency(buffer, blocks) + } if (flag and NAME_CHANGE != 0) { decodeNameChange(buffer, blocks) } + if (flag and OPS != 0) { + decodeEnabledOps(buffer, blocks) + } if (flag and TRANSFORMATION != 0) { decodeTransformation(buffer, blocks, npc) } - if (flag and FACING != 0) { - decodeFacing(buffer, blocks) + if (flag and HITMARKS != 0) { + decodeHitmarks(buffer, blocks) } - if (flag and HEADBARS != 0) { - decodeHeadbars(buffer, blocks) + if (flag and BAS_CHANGE != 0) { + decodeBaseAnimationSet(buffer, blocks) } } } @@ -216,19 +220,19 @@ internal class NpcInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - val flag = buffer.g4Alt3() - val turnLeftAnim = if (flag and 0x1 != 0) buffer.g2Alt3() else null - val turnRightAnim = if (flag and 0x2 != 0) buffer.g2Alt1() else null - val walkAnim = if (flag and 0x4 != 0) buffer.g2() else null - val walkAnimBack = if (flag and 0x8 != 0) buffer.g2Alt1() else null + val flag = buffer.g4Alt1() + val turnLeftAnim = if (flag and 0x1 != 0) buffer.g2Alt1() else null + val turnRightAnim = if (flag and 0x2 != 0) buffer.g2() else null + val walkAnim = if (flag and 0x4 != 0) buffer.g2Alt2() else null + val walkAnimBack = if (flag and 0x8 != 0) buffer.g2Alt2() else null val walkAnimLeft = if (flag and 0x10 != 0) buffer.g2Alt1() else null - val walkAnimRight = if (flag and 0x20 != 0) buffer.g2Alt3() else null - val runAnim = if (flag and 0x40 != 0) buffer.g2() else null - val runAnimBack = if (flag and 0x80 != 0) buffer.g2Alt2() else null - val runAnimLeft = if (flag and 0x100 != 0) buffer.g2Alt1() else null - val runAnimRight = if (flag and 0x200 != 0) buffer.g2Alt2() else null - val crawlAnim = if (flag and 0x400 != 0) buffer.g2Alt1() else null - val crawlAnimBack = if (flag and 0x800 != 0) buffer.g2Alt2() else null + val walkAnimRight = if (flag and 0x20 != 0) buffer.g2Alt1() else null + val runAnim = if (flag and 0x40 != 0) buffer.g2Alt3() else null + val runAnimBack = if (flag and 0x80 != 0) buffer.g2Alt1() 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.g2() else null val readyAnim = if (flag and 0x4000 != 0) buffer.g2() else null @@ -256,7 +260,7 @@ internal class NpcInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - val hitCount = buffer.g1Alt1() + val hitCount = buffer.g1Alt3() val hits = ArrayList(hitCount) for (i in 0.., ) { - val headbarCount = buffer.g1Alt1() + val headbarCount = buffer.g1() val headbars = ArrayList(headbarCount) for (i in 0.. 0) { - buffer.g1Alt2() + buffer.g1() } else { startFill } @@ -340,10 +344,10 @@ internal class NpcInfoClient( val spotanims = mutableMapOf() val count = buffer.g1Alt3() for (i in 0.., ) { - val level = buffer.g4Alt1() + val level = buffer.g4() blocks += CombatLevelChangeExtendedInfo(level) } @@ -372,8 +376,8 @@ internal class NpcInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - val delay = buffer.g2Alt3() - val duration = buffer.g2Alt2() + val delay = buffer.g2Alt1() + val duration = buffer.g2() val cancelSequence = buffer.g1() == 1 blocks += FreezeExtendedInfo(delay, duration, cancelSequence) } @@ -384,8 +388,8 @@ internal class NpcInfoClient( ) { val start = buffer.g2sAlt1() val end = buffer.g2s() - val startTransparency = buffer.g1sAlt1() - val endTransparency = buffer.g1s() + val startTransparency = buffer.g1sAlt2() + val endTransparency = buffer.g1sAlt3() val useStartTransparency = buffer.g1() == 1 blocks += TransparencyExtendedInfo( @@ -401,12 +405,12 @@ internal class NpcInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - val start = buffer.g2() - val end = buffer.g2Alt2() - val hue = buffer.g1Alt2() - val saturation = buffer.g1Alt3() - val lightness = buffer.g1Alt3() - val weight = buffer.g1Alt2() + val start = buffer.g2Alt1() + val end = buffer.g2() + val hue = buffer.g1Alt1() + val saturation = buffer.g1Alt1() + val lightness = buffer.g1Alt2() + val weight = buffer.g1Alt3() blocks += TintingExtendedInfo( start, @@ -432,22 +436,22 @@ internal class NpcInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - val flag = buffer.g1Alt3() + val flag = buffer.g1Alt1() blocks += EnabledOpsExtendedInfo(flag) } - private fun decodeBodyCustomisationV3( + private fun decodeBodyCustomisationV4( buffer: JagByteBuf, blocks: MutableList, ) { - val flag = buffer.g1Alt3() + val flag = buffer.g1() if (flag and 0x1 != 0) { blocks += BodyCustomisationExtendedInfo(ResetCustomisation) return } val models = if (flag and 0x2 != 0) { - val count = buffer.g1() + val count = buffer.g1Alt3() val models = ArrayList(count) for (i in 0..(count) + for (i in 0..(count) + for (i in 0.., + ) { + val flag = buffer.g1Alt3() + if (flag and 0x1 != 0) { + blocks += BodyCustomisationExtendedInfo(ResetCustomisation) + return + } + val models = + if (flag and 0x2 != 0) { + val count = buffer.g1Alt1() + val models = ArrayList(count) + for (i in 0..(count) for (i in 0..(count) for (i in 0.., ) { - val flag = buffer.g1Alt1() + val flag = buffer.g1() if (flag and 0x1 != 0) { blocks += BodyCustomisationExtendedInfo(ResetCustomisation) return @@ -522,7 +607,7 @@ internal class NpcInfoClient( val count = buffer.g1Alt2() val models = ArrayList(count) for (i in 0..(length) for (i in 0.., ) { - val flag = buffer.g1Alt1() + val flag = buffer.g1Alt3() if (flag and 0x1 != 0) { blocks += BodyCustomisationExtendedInfo(ResetCustomisation) return } val models = if (flag and 0x2 != 0) { - val count = buffer.g1Alt1() + 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.g1sAlt1() - val deltaZ1 = buffer.g1sAlt3() - val deltaX2 = buffer.g1s() + val deltaX1 = buffer.g1sAlt3() + val deltaZ1 = buffer.g1s() + val deltaX2 = buffer.g1sAlt1() val deltaZ2 = buffer.g1sAlt1() - val delay1 = buffer.g2Alt1() - val delay2 = buffer.g2Alt2() - val direction = buffer.g2Alt1() + val delay1 = buffer.g2Alt3() + val delay2 = buffer.g2Alt3() + val direction = buffer.g2Alt3() blocks += ExactMoveExtendedInfo( deltaX1, @@ -688,7 +773,7 @@ internal class NpcInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - val flag = buffer.g1Alt1() + val flag = buffer.g1() val groups = IntArray(8) val indices = IntArray(8) for (i in 0..<8) { @@ -707,7 +792,7 @@ internal class NpcInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - val flag = buffer.g1Alt1() + val flag = buffer.g1Alt2() val walkType = when (val walkTypeValue = flag and 0x7) { 0 -> FaceExtendedInfo.WalkType.CancelOnWalk @@ -895,20 +980,18 @@ internal class NpcInfoClient( val deltaZ: Int val jump: Int if (version == 6) { + deltaZ = decodeDelta(large, buffer) + jump = buffer.gBits(1) + val angle = NPC_TURN_ANGLES[buffer.gBits(3)] val hasSpawnCycle = buffer.gBits(1) == 1 if (hasSpawnCycle) { - val index = buffer.gBits(2) - npc.spawnCycle = buffer.gBits(spawnClockBitcodes[index]) + val width = buffer.gBits(2) + npc.spawnCycle = buffer.gBits(spawnClockBitcodes[width]) } - + val extendedInfo = buffer.gBits(1) val idBitCount = buffer.gBits(2) npc.id = buffer.gBits(typeBitcodes[idBitCount]) - - val extendedInfo = buffer.gBits(1) deltaX = decodeDelta(large, buffer) - val angle = NPC_TURN_ANGLES[buffer.gBits(3)] - jump = buffer.gBits(1) - deltaZ = decodeDelta(large, buffer) if (isNew) { npc.turnAngle = angle npc.angle = angle @@ -1056,32 +1139,33 @@ internal class NpcInfoClient( private val NPC_TURN_ANGLES = intArrayOf(768, 1024, 1280, 512, 1536, 256, 0, 1792) private val spawnClockBitcodes = intArrayOf(18, 19, 20, 32) private val typeBitcodes = intArrayOf(12, 14, 17, 24) - private const val EXTENDED_SHORT: Int = 0x20 - private const val EXTENDED_MEDIUM: Int = 0x1000 + private const val EXTENDED_SHORT: Int = 0x10 + private const val EXTENDED_MEDIUM: Int = 0x2000 private const val EXTENDED_INT: Int = 0x40_000 private const val LEVEL_CHANGE: Int = 0x800 - private const val SEQUENCE: Int = 0x4 - private const val NAME_CHANGE: Int = 0x100 - private const val OPS: Int = 0x400 - private const val SPOTANIM: Int = 0x2 - private const val SPOTANIM_OLD: Int = 0x400_000 - private const val HEADBARS: Int = 0x1_000_000 - private const val BAS_CHANGE: Int = 0x200_000 - private const val SAY: Int = 0x10 - private const val EXACT_MOVE: Int = 0x2000 - private const val HITMARKS: Int = 0x20_000 - private const val TRANSFORMATION: Int = 0x8 - private const val FACING: Int = 0x80 - private const val HEADICON_CUSTOMISATION: Int = 0x10_000 + private const val SEQUENCE: Int = 0x8 + private const val NAME_CHANGE: Int = 0x400 + private const val OPS: Int = 0x100 + private const val SPOTANIM: Int = 0x4 + private const val SPOTANIM_OLD: Int = 0x20000 + private const val HEADBARS: Int = 0x2000000 + private const val BAS_CHANGE: Int = 0x400000 + private const val SAY: Int = 0x40 + private const val EXACT_MOVE: Int = 0x200 + private const val HITMARKS: Int = 0x10000 + private const val TRANSFORMATION: Int = 0x2 + private const val FACING: Int = 0x20 + private const val HEADICON_CUSTOMISATION: Int = 0x800000 private const val BODY_CUSTOMISATION_V2: Int = 0x100_000 - private const val BODY_CUSTOMISATION_V3: Int = 0x2_000_000 + private const val BODY_CUSTOMISATION_V3: Int = 0x1000000 + private const val BODY_CUSTOMISATION_V4: Int = 0x1000 private const val HEAD_CUSTOMISATION: Int = 0x80_000 - private const val TINTING: Int = 0x200 + private const val TINTING: Int = 0x4000 private const val NPC_TRANSPARENCY: Int = 0x8000 - private const val NPC_FREEZE: Int = 0x1 + private const val NPC_FREEZE: Int = 0x80 - private const val UNUSED_FLAGS = 0x800000 or 0x4000 or 0x40 // 0x10000 or 0x2000 or 0x10 or 0x4 + private const val UNUSED_FLAGS = 0x1 or 0x200000 private enum class UpdateType { IDLE, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt index e1dda8f83..9cb0d2de1 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt @@ -302,59 +302,60 @@ internal class PlayerInfoClient( throw IllegalStateException("Unused flags used!") } + // The retired V2 spotanim mask retains only its count byte. + if (flags and SPOTANIM_OLD != 0) { + buffer.g1() + } + if (flags and SAY != 0) { + decodeSay(buffer, blocks) + } + if (flags and MOVE_SPEED != 0) { + decodeMoveSpeed(buffer, blocks) + } + if (flags and FACE != 0) { + decodeFacing(buffer, blocks) + } + if (flags and NAME_EXTRAS != 0) { + decodeNameExtras(buffer, blocks) + } if (flags and SPOTANIM != 0) { decodeSpotanims(buffer, blocks) } - if (flags and CHAT != 0) { - decodeChat(buffer, blocks) - } if (flags and HEADBARS != 0) { decodeHeadbar(buffer, blocks) } if (flags and APPEARANCE != 0) { - val len = buffer.g1Alt3() + val len = buffer.g1Alt2() val data = ByteArray(len) buffer.gdataAlt1(data) decodeAppearance(Unpooled.wrappedBuffer(data).toJagByteBuf(), blocks) } - if (flags and PLAYER_FREEZE != 0) { - decodeFreeze(buffer, blocks) - } - if (flags and FACE != 0) { - decodeFacing(buffer, blocks) - } - if (flags and NAME_EXTRAS != 0) { - decodeNameExtras(buffer, blocks) - } - if (flags and MOVE_SPEED != 0) { - decodeMoveSpeed(buffer, blocks) - } if (flags and TEMP_MOVE_SPEED != 0) { decodeTemporaryMoveSpeed(buffer, blocks) } - if (flags and SPOTANIM_OLD != 0) { - decodeSpotanimsOld(buffer, blocks) - } - if (flags and PLAYER_TRANSPARENCY != 0) { - decodeTransparency(buffer, blocks) + if (flags and CHAT != 0) { + decodeChat(buffer, blocks) } if (flags and HITMARKS != 0) { decodeHitmark(buffer, blocks) } - if (flags and EXACT_MOVE != 0) { - decodeExactMove(buffer, blocks) + if (flags and TINTING != 0) { + decodeTinting(buffer, blocks) } if (flags and SEQUENCE != 0) { decodeSequence(buffer, blocks) } - if (flags and TINTING != 0) { - decodeTinting(buffer, blocks) + if (flags and EXACT_MOVE != 0) { + decodeExactMove(buffer, blocks) + } + if (flags and PLAYER_TRANSPARENCY != 0) { + decodeTransparency(buffer, blocks) } if (flags and PLAYER_RESET != 0) { decodePlayerReset(buffer, blocks) } - if (flags and SAY != 0) { - decodeSay(buffer, blocks) + if (flags and PLAYER_FREEZE != 0) { + decodeFreeze(buffer, blocks) } } @@ -362,21 +363,21 @@ internal class PlayerInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - blocks += MoveSpeedExtendedInfo(buffer.g1sAlt3()) + blocks += MoveSpeedExtendedInfo(buffer.g1sAlt1()) } private fun decodeTemporaryMoveSpeed( buffer: JagByteBuf, blocks: MutableList, ) { - blocks += TemporaryMoveSpeedExtendedInfo(buffer.g1sAlt2()) + blocks += TemporaryMoveSpeedExtendedInfo(buffer.g1sAlt1()) } private fun decodeSequence( buffer: JagByteBuf, blocks: MutableList, ) { - val id = buffer.g2Alt3() + val id = buffer.g2Alt2() val delay = buffer.g1Alt1() blocks += SequenceExtendedInfo(id, delay) } @@ -394,7 +395,7 @@ internal class PlayerInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - val flag = buffer.g1() + val flag = buffer.g1Alt3() val walkType = when (val walkTypeValue = flag and 0x7) { 0 -> FaceExtendedInfo.WalkType.CancelOnWalk @@ -488,12 +489,12 @@ internal class PlayerInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - val colourAndEffectsPacked = buffer.g2() + val colourAndEffectsPacked = buffer.g2Alt1() val modIcon = buffer.g1Alt1() val autotyper = buffer.g1Alt2() == 1 val huffmanLength = buffer.g1Alt1() val data = ByteArray(huffmanLength) - buffer.gdataAlt3(data) + buffer.gdataAlt1(data) val text = huffmanCodec.decode(Unpooled.wrappedBuffer(data)) val colour = colourAndEffectsPacked ushr 8 val effects = colourAndEffectsPacked and 0xFF @@ -502,7 +503,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 deltaX2 = buffer.g1s() - val deltaZ2 = buffer.g1s() - val delay1 = buffer.g2Alt3() - val delay2 = buffer.g2Alt3() - val direction = buffer.g2Alt3() + val deltaX1 = buffer.g1sAlt1() + val deltaZ1 = buffer.g1s() + val deltaX2 = buffer.g1sAlt1() + val deltaZ2 = buffer.g1sAlt3() + val delay1 = buffer.g2Alt1() + val delay2 = buffer.g2Alt2() + val direction = buffer.g2Alt2() blocks += ExactMoveExtendedInfo( deltaX1, @@ -564,12 +565,12 @@ internal class PlayerInfoClient( blocks: MutableList, ) { val spotanims = mutableMapOf() - val count = buffer.g1Alt1() + val count = buffer.g1Alt2() for (i in 0.., ) { - val headbarCount = buffer.g1Alt3() + val headbarCount = buffer.g1() val headbars = ArrayList(headbarCount) for (i in 0.. 0) { - buffer.g1Alt2() + buffer.g1Alt1() } else { startFill } @@ -645,16 +646,16 @@ internal class PlayerInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - blocks += PlayerResetExtendedInfo(buffer.g1Alt2()) + blocks += PlayerResetExtendedInfo(buffer.g1()) } private fun decodeFreeze( buffer: JagByteBuf, blocks: MutableList, ) { - val delay = buffer.g2Alt2() + val delay = buffer.g2Alt1() val duration = buffer.g2Alt1() - val cancelSequence = buffer.g1Alt2() == 1 + val cancelSequence = buffer.g1Alt1() == 1 blocks += FreezeExtendedInfo(delay, duration, cancelSequence) } @@ -662,11 +663,11 @@ internal class PlayerInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - val start = buffer.g2sAlt2() + val start = buffer.g2sAlt3() val end = buffer.g2sAlt3() - val startTransparency = buffer.g1sAlt3() - val endTransparency = buffer.g1sAlt3() - val useStartTransparency = buffer.g1Alt3() == 1 + val startTransparency = buffer.g1sAlt1() + val endTransparency = buffer.g1sAlt1() + val useStartTransparency = buffer.g1Alt1() == 1 blocks += TransparencyExtendedInfo( start, @@ -681,12 +682,12 @@ internal class PlayerInfoClient( buffer: JagByteBuf, blocks: MutableList, ) { - val start = buffer.g2Alt1() - val end = buffer.g2Alt3() + val start = buffer.g2() + val end = buffer.g2Alt1() val hue = buffer.g1sAlt2() - val saturation = buffer.g1sAlt1() - val lightness = buffer.g1s() - val weight = buffer.g1Alt1() + val saturation = buffer.g1s() + val lightness = buffer.g1sAlt2() + val weight = buffer.g1Alt3() blocks += TintingExtendedInfo( start, @@ -752,82 +753,34 @@ internal class PlayerInfoClient( 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 + val recolours = + if (slotFlag and 0x1 != 0) { + List(buffer.g1()) { + ObjTypeCustomisation.Replacement(buffer.g1(), buffer.g2()) } - recol2 = - if (recolIndex2 != 15) { - buffer.g2() - } else { - -1 + } else { + null + } + val retextures = + if (slotFlag and 0x2 != 0) { + List(buffer.g1()) { + ObjTypeCustomisation.Replacement(buffer.g1(), buffer.g2()) } - } - - 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 - } - } - - // Note: This branch is server-version checked, but we're pushing - // RSProx out after revision 237 is forced, - // meaning we can check this. RSprot does not support it either. - if (wearModels) { - manWear = buffer.g4() - womanWear = buffer.g4() - } - - if (headModels) { - manHead = buffer.g4() - womanHead = buffer.g4() - } + } else { + null + } + val overrideColour = if (slotFlag and 0x10 != 0) buffer.g1() == 1 else null + val colour = if (slotFlag and 0x10 != 0) buffer.g2() else null + val manWear = if (slotFlag and 0x4 != 0) buffer.g4() else -1 + val womanWear = if (slotFlag and 0x4 != 0) buffer.g4() else -1 + val manHead = if (slotFlag and 0x8 != 0) buffer.g4() else -1 + val womanHead = if (slotFlag and 0x8 != 0) buffer.g4() else -1 customisation[i] = ObjTypeCustomisation( - recolIndices, - recol1, - recol2, - retexIndices, - retex1, - retex2, - manWear, - womanWear, - manHead, - womanHead, + -1, -1, -1, -1, -1, -1, + manWear, womanWear, manHead, womanHead, + recolours, retextures, overrideColour, colour, ) } } @@ -1160,25 +1113,25 @@ internal class PlayerInfoClient( private const val EXTENDED_SHORT = 0x80 private const val EXTENDED_MEDIUM = 0x2000 - private const val SEQUENCE = 0x10 - private const val APPEARANCE = 0x4 - private const val FACE = 0x40 - private const val SAY = 0x1 - private const val CHAT = 0x1000 - private const val NAME_EXTRAS = 0x200 - private const val MOVE_SPEED = 0x4000 - private const val TINTING = 0x400 - private const val EXACT_MOVE = 0x8000 + private const val SEQUENCE = 0x40 + private const val APPEARANCE = 0x2 + private const val FACE = 0x20 + private const val SAY = 0x10 + private const val CHAT = 0x400 + private const val NAME_EXTRAS = 0x8000 + private const val MOVE_SPEED = 0x100 + private const val TINTING = 0x1000 + private const val EXACT_MOVE = 0x800 private const val PLAYER_TRANSPARENCY = 0x10000 - private const val TEMP_MOVE_SPEED = 0x800 - private const val SPOTANIM_OLD = 0x80000 - private const val SPOTANIM = 0x20 - private const val HEADBARS = 0x20000 - private const val HITMARKS = 0x100000 + private const val TEMP_MOVE_SPEED = 0x4000 + private const val SPOTANIM_OLD = 0x100000 + private const val SPOTANIM = 0x4 + private const val HEADBARS = 0x80000 + private const val HITMARKS = 0x20000 private const val PLAYER_FREEZE = 0x40_000 private const val PLAYER_RESET = 0x8 - private const val UNUSED_FLAGS = 0x2 + private const val UNUSED_FLAGS = 0x1 private class Player { var queuedMove: Boolean = false diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/worldentityinfo/WorldEntityInfoClient.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/worldentityinfo/WorldEntityInfoClient.kt index bbf1b9feb..0afb0ea07 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/worldentityinfo/WorldEntityInfoClient.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/worldentityinfo/WorldEntityInfoClient.kt @@ -342,11 +342,11 @@ public class WorldEntityInfoClient : WorldEntityInfoDecoder { val blocks = mutableListOf() if (flags and 0x1 != 0) { val id = buffer.g2() - val delay = buffer.g1Alt1() + val delay = buffer.g1Alt2() blocks += SequenceExtendedInfo(id, delay) } if (flags and 0x2 != 0) { - blocks += EnabledOpsExtendedInfo(buffer.g1Alt1()) + blocks += EnabledOpsExtendedInfo(buffer.g1Alt2()) } return blocks } @@ -565,10 +565,10 @@ public class WorldEntityInfoClient : WorldEntityInfoDecoder { val index = buffer.g2() // Note: If serverVersion < 237, add +1 to index this.transmittedWorldEntity[this.transmittedWorldEntityCount++] = index + val id = buffer.g2sAlt1() val extendedInfoFlags = buffer.g1Alt3() + val priority = buffer.g1Alt2() val packedSize = buffer.g1Alt3() - val priority = buffer.g1Alt1() - val id = buffer.g2sAlt1() var coordFine = CoordFine(0, 0, 0) var angle = 0 diff --git a/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/info/npcinfo/extendedinfo/customisation/CustomisationType.kt b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/info/npcinfo/extendedinfo/customisation/CustomisationType.kt index fe202d33b..3ceea02f2 100644 --- a/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/info/npcinfo/extendedinfo/customisation/CustomisationType.kt +++ b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/info/npcinfo/extendedinfo/customisation/CustomisationType.kt @@ -9,6 +9,8 @@ public class ModelCustomisation( public val recolours: List?, public val retextures: List?, public val mirror: Boolean?, + /** Null uses the definition's colour; 65535 explicitly selects ordinary recolouring. */ + public val recolAll: Int? = null, ) : CustomisationType { override fun equals(other: Any?): Boolean { if (this === other) return true @@ -20,6 +22,7 @@ public class ModelCustomisation( if (recolours != other.recolours) return false if (retextures != other.retextures) return false if (mirror != other.mirror) return false + if (recolAll != other.recolAll) return false return true } @@ -29,6 +32,7 @@ public class ModelCustomisation( result = 31 * result + (recolours?.hashCode() ?: 0) result = 31 * result + (retextures?.hashCode() ?: 0) result = 31 * result + (mirror?.hashCode() ?: 0) + result = 31 * result + (recolAll ?: 0) return result } @@ -37,7 +41,8 @@ public class ModelCustomisation( "models=$models, " + "recolours=$recolours, " + "retextures=$retextures, " + - "mirror=$mirror" + + "mirror=$mirror, " + + "recolAll=$recolAll" + ")" } } diff --git a/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/info/playerinfo/extendedinfo/ObjTypeCustomisation.kt b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/info/playerinfo/extendedinfo/ObjTypeCustomisation.kt index d1ec0f4f3..779707b65 100644 --- a/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/info/playerinfo/extendedinfo/ObjTypeCustomisation.kt +++ b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/info/playerinfo/extendedinfo/ObjTypeCustomisation.kt @@ -11,7 +11,16 @@ public class ObjTypeCustomisation( public val womanWear: Int, public val manHead: Int, public val womanHead: Int, + public val recolours: List? = null, + public val retextures: List? = null, + public val overrideColour: Boolean? = null, + public val colour: Int? = null, ) { + public data class Replacement( + public val index: Int, + public val value: Int, + ) + override fun equals(other: Any?): Boolean { if (this === other) return true if (other !is ObjTypeCustomisation) return false @@ -26,6 +35,10 @@ public class ObjTypeCustomisation( if (womanWear != other.womanWear) return false if (manHead != other.manHead) return false if (womanHead != other.womanHead) return false + if (recolours != other.recolours) return false + if (retextures != other.retextures) return false + if (overrideColour != other.overrideColour) return false + if (colour != other.colour) return false return true } @@ -41,6 +54,10 @@ public class ObjTypeCustomisation( result = 31 * result + womanWear result = 31 * result + manHead result = 31 * result + womanHead + result = 31 * result + (recolours?.hashCode() ?: 0) + result = 31 * result + (retextures?.hashCode() ?: 0) + result = 31 * result + (overrideColour?.hashCode() ?: 0) + result = 31 * result + (colour ?: 0) return result } @@ -55,7 +72,8 @@ public class ObjTypeCustomisation( "manWear=$manWear, " + "womanWear=$womanWear, " + "manHead=$manHead, " + - "womanHead=$womanHead" + + "womanHead=$womanHead, " + + "recolours=$recolours, retextures=$retextures, overrideColour=$overrideColour, colour=$colour" + ")" } } diff --git a/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/interfaces/IfSetObject.kt b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/interfaces/IfSetObject.kt index e5d289e32..307eae7bd 100644 --- a/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/interfaces/IfSetObject.kt +++ b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/interfaces/IfSetObject.kt @@ -14,7 +14,7 @@ import net.rsprox.protocol.game.outgoing.model.IncomingServerGameMessage public class IfSetObject private constructor( public val combinedId: CombinedId, private val _obj: UShort, - private val _count: UShort, + private val _count: Int, ) : IncomingServerGameMessage { public constructor( interfaceId: Int, @@ -24,7 +24,7 @@ public class IfSetObject private constructor( ) : this( CombinedId(interfaceId, componentId), obj.toUShort(), - count.toUShort(), + count, ) public val interfaceId: Int diff --git a/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/interfaces/IfSetPosition.kt b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/interfaces/IfSetPosition.kt index b00c44f00..af2e4eda9 100644 --- a/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/interfaces/IfSetPosition.kt +++ b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/interfaces/IfSetPosition.kt @@ -12,8 +12,8 @@ import net.rsprox.protocol.game.outgoing.model.IncomingServerGameMessage */ public class IfSetPosition private constructor( public val combinedId: CombinedId, - private val _x: UShort, - private val _y: UShort, + private val _x: Short, + private val _y: Short, ) : IncomingServerGameMessage { public constructor( interfaceId: Int, @@ -22,8 +22,8 @@ public class IfSetPosition private constructor( y: Int, ) : this( CombinedId(interfaceId, componentId), - x.toUShort(), - y.toUShort(), + x.toShort(), + y.toShort(), ) public val interfaceId: Int diff --git a/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/misc/client/ObjUnlockReset.kt b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/misc/client/ObjUnlockReset.kt new file mode 100644 index 000000000..b6fdca596 --- /dev/null +++ b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/misc/client/ObjUnlockReset.kt @@ -0,0 +1,6 @@ +package net.rsprox.protocol.game.outgoing.model.misc.client + +import net.rsprox.protocol.game.outgoing.model.IncomingServerGameMessage + +/** Clears all object-unlock flags. */ +public data object ObjUnlockReset : IncomingServerGameMessage diff --git a/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/misc/client/ObjUnlockUpdate.kt b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/misc/client/ObjUnlockUpdate.kt new file mode 100644 index 000000000..81b566c7e --- /dev/null +++ b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/misc/client/ObjUnlockUpdate.kt @@ -0,0 +1,8 @@ +package net.rsprox.protocol.game.outgoing.model.misc.client + +import net.rsprox.protocol.game.outgoing.model.IncomingServerGameMessage + +/** Each entry replaces a 64-object unlock word; it is not an OR operation. */ +public data class ObjUnlockUpdate(public val entries: List) : IncomingServerGameMessage { + public data class Entry(public val wordIndex: Int, public val flags: Long) +} diff --git a/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/misc/player/UpdateStockMarketSlotV2.kt b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/misc/player/UpdateStockMarketSlotV2.kt new file mode 100644 index 000000000..bd3cd2c36 --- /dev/null +++ b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/misc/player/UpdateStockMarketSlotV2.kt @@ -0,0 +1,16 @@ +package net.rsprox.protocol.game.outgoing.model.misc.player + +import net.rsprox.protocol.game.outgoing.model.IncomingServerGameMessage + +/** Expanded stockmarket offer. Extension bytes are explicitly length-delimited by the native decoder. */ +public data class UpdateStockMarketSlotV2( + public val slot: Int, + public val version: Int, + public val status: Int, + public val obj: Int, + public val price: Long, + public val count: Int, + public val completedCount: Int, + public val completedGold: Long, + public val extension: List, +) : IncomingServerGameMessage diff --git a/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/misc/player/UpdateTradingPostV2.kt b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/misc/player/UpdateTradingPostV2.kt new file mode 100644 index 000000000..7ca3461a0 --- /dev/null +++ b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/misc/player/UpdateTradingPostV2.kt @@ -0,0 +1,22 @@ +package net.rsprox.protocol.game.outgoing.model.misc.player + +import net.rsprox.protocol.game.outgoing.model.IncomingServerGameMessage + +/** Trading-post offers with 64-bit prices; the packet carries no version byte. */ +public data class UpdateTradingPostV2(public val update: OfferList?) : IncomingServerGameMessage { + public data class OfferList( + public val age: Long, + public val obj: Int, + public val status: Boolean, + public val offers: List, + ) + + public data class Offer( + public val name: String, + public val previousName: String, + public val world: Int, + public val time: Long, + public val price: Long, + public val count: Int, + ) +} diff --git a/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/specific/ObjCustomiseSpecificV2.kt b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/specific/ObjCustomiseSpecificV2.kt new file mode 100644 index 000000000..9c606a7fe --- /dev/null +++ b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/specific/ObjCustomiseSpecificV2.kt @@ -0,0 +1,17 @@ +package net.rsprox.protocol.game.outgoing.model.specific + +import net.rsprox.protocol.common.CoordGrid +import net.rsprox.protocol.game.outgoing.model.IncomingServerGameMessage + +/** Multi-index ground-item customisation introduced in revision 241. */ +public data class ObjCustomiseSpecificV2( + public val id: Int, + public val quantity: Int, + public val model: Int, + public val recolours: List, + public val retextures: List, + public val colour: Int?, + public val coordGrid: CoordGrid, +) : IncomingServerGameMessage { + public data class Replacement(public val index: Int, public val value: Int) +} diff --git a/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/varp/VarpLong.kt b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/varp/VarpLong.kt new file mode 100644 index 000000000..dc0af1f43 --- /dev/null +++ b/protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/varp/VarpLong.kt @@ -0,0 +1,6 @@ +package net.rsprox.protocol.game.outgoing.model.varp + +import net.rsprox.protocol.game.outgoing.model.IncomingServerGameMessage + +/** Revision 241's 64-bit varp value. Do not truncate it into the legacy Int varp model. */ +public data class VarpLong(public val id: Int, public val value: Long) : IncomingServerGameMessage 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 0562c6d41..0f812fca9 100644 --- a/proxy/src/main/kotlin/net/rsprox/proxy/client/ClientGameHandler.kt +++ b/proxy/src/main/kotlin/net/rsprox/proxy/client/ClientGameHandler.kt @@ -172,6 +172,12 @@ public class ClientGameHandler( replacement.p1(0) replacement.p3(delta) } + 241 -> { + val delta = buffer.g3Alt1() + buffer.g1() // Key + replacement.p3Alt1(delta) + replacement.p1(0) + } } } diff --git a/proxy/src/main/kotlin/net/rsprox/proxy/config/RSProx.kt b/proxy/src/main/kotlin/net/rsprox/proxy/config/RSProx.kt index 2de7a947f..0c5807c40 100644 --- a/proxy/src/main/kotlin/net/rsprox/proxy/config/RSProx.kt +++ b/proxy/src/main/kotlin/net/rsprox/proxy/config/RSProx.kt @@ -19,8 +19,8 @@ internal val BINARY_CREDENTIALS: Path = BINARY_CREDENTIALS_FOLDER.resolve("binar internal val FAKE_CERTIFICATE_FILE: Path = SIGN_KEY_DIRECTORY.resolve("fake-cert.jks") internal val JAGEX_ACCOUNTS_FILE: Path = CONFIGURATION_PATH.resolve("jagex-accounts.properties") internal val RUNELITE_LAUNCHER_REPO_DIRECTORY: Path = CONFIGURATION_PATH.resolve("runelite-launcher") -internal const val CURRENT_REVISION: Int = 240 -internal const val LATEST_SUPPORTED_PLUGIN: Int = 240 +internal const val CURRENT_REVISION: Int = 241 +internal const val LATEST_SUPPORTED_PLUGIN: Int = 241 /** * Http server port needs to be hard-coded as we modify it in a few RuneLite classes directly. diff --git a/proxy/src/main/kotlin/net/rsprox/proxy/plugin/DecoderLoader.kt b/proxy/src/main/kotlin/net/rsprox/proxy/plugin/DecoderLoader.kt index 068ee5965..7e2113826 100644 --- a/proxy/src/main/kotlin/net/rsprox/proxy/plugin/DecoderLoader.kt +++ b/proxy/src/main/kotlin/net/rsprox/proxy/plugin/DecoderLoader.kt @@ -73,9 +73,13 @@ import net.rsprox.protocol.v239.GameClientProtProviderV239 import net.rsprox.protocol.v239.GameServerProtProviderV239 import net.rsprox.protocol.v239.ServerPacketDecoderServiceV239 import net.rsprox.protocol.v240.ClientPacketDecoderServiceV240 +import net.rsprox.protocol.v241.ClientPacketDecoderServiceV241 import net.rsprox.protocol.v240.GameClientProtProviderV240 +import net.rsprox.protocol.v241.GameClientProtProviderV241 import net.rsprox.protocol.v240.GameServerProtProviderV240 +import net.rsprox.protocol.v241.GameServerProtProviderV241 import net.rsprox.protocol.v240.ServerPacketDecoderServiceV240 +import net.rsprox.protocol.v241.ServerPacketDecoderServiceV241 import net.rsprox.proxy.huffman.HuffmanProvider import net.rsprox.transcriber.legacy.LegacyClientProt import net.rsprox.transcriber.legacy.LegacyServerProt @@ -214,6 +218,7 @@ public class DecoderLoader { 238 to Callable { loadRevision238(huffmanCodec, cache) }, 239 to Callable { loadRevision239(huffmanCodec, cache) }, 240 to Callable { loadRevision240(huffmanCodec, cache) }, + 241 to Callable { loadRevision241(huffmanCodec, cache) }, ) } @@ -469,6 +474,20 @@ public class DecoderLoader { ) } + private fun loadRevision241( + huffmanCodec: HuffmanCodec, + cache: CacheProvider, + ): RevisionDecoder { + logger.debug { "Loading revision 241 decoders" } + return RevisionDecoder( + 241, + ClientPacketDecoderServiceV241(huffmanCodec), + ServerPacketDecoderServiceV241(huffmanCodec, cache), + GameClientProtProviderV241, + GameServerProtProviderV241, + ) + } + public fun getDecoder( revision: Int, cache: CacheProvider, diff --git a/proxy/src/main/kotlin/net/rsprox/proxy/server/ServerGameHandler.kt b/proxy/src/main/kotlin/net/rsprox/proxy/server/ServerGameHandler.kt index 812c3b937..e144367b0 100644 --- a/proxy/src/main/kotlin/net/rsprox/proxy/server/ServerGameHandler.kt +++ b/proxy/src/main/kotlin/net/rsprox/proxy/server/ServerGameHandler.kt @@ -239,6 +239,11 @@ public class ServerGameHandler( interfaceId = buf.g2Alt3() targetComponent = buf.gCombinedIdAlt3() } + 241 -> { + targetComponent = buf.gCombinedIdAlt3() + interfaceId = buf.g2Alt2() + buf.skipRead(1) + } else -> { error("Unsupported revision: $revision") diff --git a/transcriber/src/main/kotlin/net/rsprox/transcriber/TranscriberPlugin.kt b/transcriber/src/main/kotlin/net/rsprox/transcriber/TranscriberPlugin.kt index 6d0be317c..8cd76fd0e 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/TranscriberPlugin.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/TranscriberPlugin.kt @@ -112,6 +112,7 @@ public class TranscriberPlugin( GameServerProt.OBJ_ENABLED_OPS_SPECIFIC -> pass(message, Transcriber::objEnabledOpsSpecific) GameServerProt.OBJ_UNCUSTOMISE_SPECIFIC -> pass(message, Transcriber::objUncustomiseSpecific) GameServerProt.OBJ_COUNT_SPECIFIC -> pass(message, Transcriber::objCountSpecific) + GameServerProt.OBJ_CUSTOMISE_SPECIFIC_V2 -> pass(message, Transcriber::objCustomiseSpecificV2) GameServerProt.OBJ_CUSTOMISE_SPECIFIC -> pass(message, Transcriber::objUncustomiseSpecific) GameServerProt.PLAYER_INFO -> pass(message, Transcriber::playerInfo) GameServerProt.NPC_INFO_SMALL_V6 -> pass(message, Transcriber::npcInfoV6) @@ -136,6 +137,11 @@ public class TranscriberPlugin( GameServerProt.REBUILD_WORLDENTITY_V3 -> pass(message, Transcriber::rebuildWorldEntityV3) GameServerProt.REBUILD_WORLDENTITY_V4 -> pass(message, Transcriber::rebuildWorldEntityV4) GameServerProt.VARP_SMALL -> pass(message, Transcriber::varpSmall) + GameServerProt.VARP_LONG -> pass(message, Transcriber::varpLong) + GameServerProt.UPDATE_TRADINGPOST_V2 -> pass(message, Transcriber::updateTradingPostV2) + GameServerProt.UPDATE_STOCKMARKET_SLOT_V2 -> pass(message, Transcriber::updateStockMarketSlotV2) + GameServerProt.OBJUNLOCK_RESET -> pass(message, Transcriber::objUnlockReset) + GameServerProt.OBJUNLOCK_UPDATE -> pass(message, Transcriber::objUnlockUpdate) GameServerProt.VARP_LARGE -> pass(message, Transcriber::varpLarge) GameServerProt.VARP_RESET -> pass(message, Transcriber::varpReset) GameServerProt.VARP_SYNC -> pass(message, Transcriber::varpSync) 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 85c14a70c..7fa016ede 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/indexer/IndexerTranscriber.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/indexer/IndexerTranscriber.kt @@ -118,6 +118,8 @@ import net.rsprox.protocol.game.outgoing.model.logout.LogoutTransfer import net.rsprox.protocol.game.outgoing.model.logout.LogoutWithReason import net.rsprox.protocol.game.outgoing.model.map.* import net.rsprox.protocol.game.outgoing.model.misc.client.* +import net.rsprox.protocol.game.outgoing.model.misc.client.ObjUnlockReset +import net.rsprox.protocol.game.outgoing.model.misc.client.ObjUnlockUpdate import net.rsprox.protocol.game.outgoing.model.misc.player.AccountFlags import net.rsprox.protocol.game.outgoing.model.misc.player.ChatFilterSettings import net.rsprox.protocol.game.outgoing.model.misc.player.ChatFilterSettingsPrivateChat @@ -132,7 +134,9 @@ import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateRunWeight import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStatV1 import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStatV2 import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStockMarketSlot +import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStockMarketSlotV2 import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateTradingPost +import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateTradingPostV2 import net.rsprox.protocol.game.outgoing.model.social.FriendListLoaded import net.rsprox.protocol.game.outgoing.model.social.MessagePrivateEcho import net.rsprox.protocol.game.outgoing.model.social.UpdateFriendList @@ -147,8 +151,10 @@ import net.rsprox.protocol.game.outgoing.model.sound.MidiSongWithSecondary import net.rsprox.protocol.game.outgoing.model.sound.MidiSwap import net.rsprox.protocol.game.outgoing.model.sound.SynthSound import net.rsprox.protocol.game.outgoing.model.specific.* +import net.rsprox.protocol.game.outgoing.model.specific.ObjCustomiseSpecificV2 import net.rsprox.protocol.game.outgoing.model.unknown.UnknownString import net.rsprox.protocol.game.outgoing.model.varp.VarpLarge +import net.rsprox.protocol.game.outgoing.model.varp.VarpLong import net.rsprox.protocol.game.outgoing.model.varp.VarpReset import net.rsprox.protocol.game.outgoing.model.varp.VarpSmall import net.rsprox.protocol.game.outgoing.model.varp.VarpSync @@ -1231,6 +1237,14 @@ public class IndexerTranscriber( } } + private fun logVarpLong(id: Int) { + // Ignore any varps set on tick 0 + if (sessionState.cycle == sessionState.lastConnection) { + return + } + binaryIndex.increment(IndexedType.VARP, id) + } + override fun varpSync(message: VarpSync) { } @@ -1574,4 +1588,24 @@ public class IndexerTranscriber( } } } + + override fun varpLong(message: VarpLong) { + logVarpLong(message.id) + } + + override fun updateTradingPostV2(message: UpdateTradingPostV2) { + } + + override fun updateStockMarketSlotV2(message: UpdateStockMarketSlotV2) { + } + + override fun objUnlockReset(message: ObjUnlockReset) { + } + + override fun objUnlockUpdate(message: ObjUnlockUpdate) { + } + + override fun objCustomiseSpecificV2(message: ObjCustomiseSpecificV2) { + binaryIndex.increment(IndexedType.OBJ, 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 82e774530..d8ab382bf 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/interfaces/ServerPacketTranscriber.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/interfaces/ServerPacketTranscriber.kt @@ -29,6 +29,8 @@ import net.rsprox.protocol.game.outgoing.model.logout.LogoutTransfer import net.rsprox.protocol.game.outgoing.model.logout.LogoutWithReason import net.rsprox.protocol.game.outgoing.model.map.* import net.rsprox.protocol.game.outgoing.model.misc.client.* +import net.rsprox.protocol.game.outgoing.model.misc.client.ObjUnlockReset +import net.rsprox.protocol.game.outgoing.model.misc.client.ObjUnlockUpdate import net.rsprox.protocol.game.outgoing.model.misc.player.AccountFlags import net.rsprox.protocol.game.outgoing.model.misc.player.ChatFilterSettings import net.rsprox.protocol.game.outgoing.model.misc.player.ChatFilterSettingsPrivateChat @@ -43,7 +45,9 @@ import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateRunWeight import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStatV1 import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStatV2 import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStockMarketSlot +import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStockMarketSlotV2 import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateTradingPost +import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateTradingPostV2 import net.rsprox.protocol.game.outgoing.model.social.FriendListLoaded import net.rsprox.protocol.game.outgoing.model.social.MessagePrivate import net.rsprox.protocol.game.outgoing.model.social.MessagePrivateEcho @@ -59,8 +63,10 @@ import net.rsprox.protocol.game.outgoing.model.sound.MidiSongWithSecondary import net.rsprox.protocol.game.outgoing.model.sound.MidiSwap import net.rsprox.protocol.game.outgoing.model.sound.SynthSound import net.rsprox.protocol.game.outgoing.model.specific.* +import net.rsprox.protocol.game.outgoing.model.specific.ObjCustomiseSpecificV2 import net.rsprox.protocol.game.outgoing.model.unknown.UnknownString import net.rsprox.protocol.game.outgoing.model.varp.VarpLarge +import net.rsprox.protocol.game.outgoing.model.varp.VarpLong import net.rsprox.protocol.game.outgoing.model.varp.VarpReset import net.rsprox.protocol.game.outgoing.model.varp.VarpSmall import net.rsprox.protocol.game.outgoing.model.varp.VarpSync @@ -456,4 +462,16 @@ public interface ServerPacketTranscriber { public fun setInteractionMode(message: SetInteractionMode) public fun resetInteractionMode(message: ResetInteractionMode) + + public fun varpLong(message: VarpLong) + + public fun updateTradingPostV2(message: UpdateTradingPostV2) + + public fun updateStockMarketSlotV2(message: UpdateStockMarketSlotV2) + + public fun objUnlockReset(message: ObjUnlockReset) + + public fun objUnlockUpdate(message: ObjUnlockUpdate) + + public fun objCustomiseSpecificV2(message: ObjCustomiseSpecificV2) } 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 a016ba8a3..2593eaf7a 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/prot/GameServerProt.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/prot/GameServerProt.kt @@ -83,6 +83,7 @@ public enum class GameServerProt : Prot { OBJ_UNCUSTOMISE_SPECIFIC, OBJ_COUNT_SPECIFIC, OBJ_CUSTOMISE_SPECIFIC, + OBJ_CUSTOMISE_SPECIFIC_V2, // Info packets PLAYER_INFO, @@ -241,5 +242,11 @@ public enum class GameServerProt : Prot { UNKNOWN_STRING, UNHANDLED, + VARP_LONG, + UPDATE_TRADINGPOST_V2, + UPDATE_STOCKMARKET_SLOT_V2, + OBJUNLOCK_RESET, + OBJUNLOCK_UPDATE, + RECONNECT, } diff --git a/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextNpcInfoTranscriber.kt b/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextNpcInfoTranscriber.kt index cd10f916c..f28b974c7 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextNpcInfoTranscriber.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextNpcInfoTranscriber.kt @@ -826,6 +826,7 @@ public class TextNpcInfoTranscriber( } when (val type = info.type) { is ModelCustomisation -> { + type.recolAll?.let { int("recolall", it) } val composition = info.playerComposition if (composition != null) { val models = type.models @@ -901,6 +902,7 @@ public class TextNpcInfoTranscriber( } when (val type = info.type) { is ModelCustomisation -> { + type.recolAll?.let { int("recolall", it) } val models = type.models if (models != null) { for (model in models) { diff --git a/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextPlayerInfoTranscriber.kt b/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextPlayerInfoTranscriber.kt index f63a64149..61e1c383d 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextPlayerInfoTranscriber.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextPlayerInfoTranscriber.kt @@ -889,6 +889,14 @@ public class TextPlayerInfoTranscriber( } val pos = WearPos.entries.first { it.id == index } namedEnum("wearpos", pos) + cus.recolours?.forEach { replacement -> + int("recol${replacement.index}", replacement.value) + } + cus.retextures?.forEach { replacement -> + scriptVarType("retex${replacement.index}", ScriptVarType.TEXTURE, replacement.value) + } + cus.overrideColour?.let { boolean("overridecolour", it) } + cus.colour?.let { int("colour", it) } val recolIndex1 = cus.recolIndices and 0xF val recolIndex2 = cus.recolIndices ushr 4 and 0xF if (recolIndex1 != 0xF) { 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 010cdf959..86c06b6db 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextServerPacketTranscriber.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextServerPacketTranscriber.kt @@ -46,6 +46,8 @@ import net.rsprox.protocol.game.outgoing.model.misc.client.HideObjOps import net.rsprox.protocol.game.outgoing.model.misc.client.HintArrow import net.rsprox.protocol.game.outgoing.model.misc.client.HiscoreReply import net.rsprox.protocol.game.outgoing.model.misc.client.MinimapToggle +import net.rsprox.protocol.game.outgoing.model.misc.client.ObjUnlockReset +import net.rsprox.protocol.game.outgoing.model.misc.client.ObjUnlockUpdate import net.rsprox.protocol.game.outgoing.model.misc.client.PacketGroupEnd import net.rsprox.protocol.game.outgoing.model.misc.client.PacketGroupStart import net.rsprox.protocol.game.outgoing.model.misc.client.ReflectionChecker @@ -75,7 +77,9 @@ import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateRunWeight import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStatV1 import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStatV2 import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStockMarketSlot +import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStockMarketSlotV2 import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateTradingPost +import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateTradingPostV2 import net.rsprox.protocol.game.outgoing.model.social.FriendListLoaded import net.rsprox.protocol.game.outgoing.model.social.MessagePrivate import net.rsprox.protocol.game.outgoing.model.social.MessagePrivateEcho @@ -91,8 +95,10 @@ import net.rsprox.protocol.game.outgoing.model.sound.MidiSongWithSecondary import net.rsprox.protocol.game.outgoing.model.sound.MidiSwap import net.rsprox.protocol.game.outgoing.model.sound.SynthSound import net.rsprox.protocol.game.outgoing.model.specific.* +import net.rsprox.protocol.game.outgoing.model.specific.ObjCustomiseSpecificV2 import net.rsprox.protocol.game.outgoing.model.unknown.UnknownString import net.rsprox.protocol.game.outgoing.model.varp.VarpLarge +import net.rsprox.protocol.game.outgoing.model.varp.VarpLong import net.rsprox.protocol.game.outgoing.model.varp.VarpReset import net.rsprox.protocol.game.outgoing.model.varp.VarpSmall import net.rsprox.protocol.game.outgoing.model.varp.VarpSync @@ -111,6 +117,7 @@ import net.rsprox.shared.filters.PropertyFilter import net.rsprox.shared.filters.PropertyFilterSet import net.rsprox.shared.filters.PropertyFilterSetStore import net.rsprox.shared.property.* +import net.rsprox.shared.property.formattedLong import net.rsprox.shared.property.regular.DecimalCoordGridProperty import net.rsprox.shared.property.regular.GroupProperty import net.rsprox.shared.property.regular.ScriptVarTypeProperty @@ -3897,4 +3904,92 @@ public class TextServerPacketTranscriber( private val KG_NUMBER_FORMAT: NumberFormat = DecimalFormat("###,###,###kg") public val worldentityInstanceSwCoords: MutableSet = mutableSetOf() } + + override fun varpLong(message: VarpLong) { + if (!filters[PropertyFilter.VARP]) return omit() + root.varp("id", message.id) + root.long("value", message.value) + } + + override fun updateTradingPostV2(message: UpdateTradingPostV2) { + if (!filters[PropertyFilter.DEPRECATED_SERVER]) return omit() + val update = message.update ?: return + root.long("age", update.age) + root.scriptVarType("id", ScriptVarType.OBJ, update.obj) + root.boolean("status", update.status) + root.group("OFFERS") { + for ((name, previousName, world, time, price, count) in update.offers) { + group { + string("name", name) + string("previousname", previousName) + int("world", world) + long("time", time) + formattedLong("price", price) + formattedInt("count", count) + } + } + } + } + + override fun updateStockMarketSlotV2(message: UpdateStockMarketSlotV2) { + if (!filters[PropertyFilter.UPDATE_STOCKMARKET_SLOT]) return omit() + root.int("slot", message.slot) + root.int("version", message.version) + root.int("status", message.status) + root.scriptVarType("id", ScriptVarType.OBJ, message.obj) + root.formattedLong("price", message.price) + root.formattedInt("count", message.count) + root.formattedInt("completedcount", message.completedCount) + root.formattedLong("completedgold", message.completedGold) + if (message.extension.isNotEmpty()) { + root.group("EXTENSION") { + for (value in message.extension) group { int("byte", value) } + } + } + } + + override fun objUnlockReset(message: ObjUnlockReset) { + } + + override fun objUnlockUpdate(message: ObjUnlockUpdate) { + root.group("OBJS") { + for ((wordIndex, flags) in message.entries) { + for (bit in 0 until Long.SIZE_BITS) { + if (flags and (1L shl bit) == 0L) continue + group { + scriptVarType("id", ScriptVarType.OBJ, wordIndex * Long.SIZE_BITS + bit) + } + } + } + } + } + + override fun objCustomiseSpecificV2(message: ObjCustomiseSpecificV2) { + if (!filters[PropertyFilter.OBJ_CUSTOMISE]) return omit() + root.scriptVarType("id", ScriptVarType.OBJ, message.id) + root.int("count", message.quantity) + root.scriptVarType("model", ScriptVarType.MODEL, message.model) + root.coordGrid(message.coordGrid) + message.colour?.let { root.int("colour", it) } + if (message.recolours.isNotEmpty()) { + root.group("RECOLOURS") { + for ((index, col) in message.recolours) { + group { + int("index", index) + int("colour", col) + } + } + } + } + if (message.retextures.isNotEmpty()) { + root.group("RETEXTURES") { + for ((index, tex) in message.retextures) { + group { + int("index", index) + int("texture", tex) + } + } + } + } + } } From 5f4b4ed4e73b9cb35af34dd066b4a49ffcc402b5 Mon Sep 17 00:00:00 2001 From: Kris Date: Sun, 20 Sep 2026 22:13:07 +0300 Subject: [PATCH 4/7] refactor: migrate v1 versions of new v2 packets to have v1 suffix --- ...er.kt => UpdateStockMarketSlotV1Decoder.kt} | 16 ++++++++-------- ...ecoder.kt => UpdateTradingPostV1Decoder.kt} | 16 ++++++++-------- .../outgoing/decoder/prot/GameServerProt.kt | 4 ++-- .../outgoing/decoder/prot/GameServerProtId.kt | 4 ++-- .../prot/ServerMessageDecoderRepository.kt | 8 ++++---- ...er.kt => UpdateStockMarketSlotV1Decoder.kt} | 16 ++++++++-------- ...ecoder.kt => UpdateTradingPostV1Decoder.kt} | 16 ++++++++-------- .../outgoing/decoder/prot/GameServerProt.kt | 4 ++-- .../outgoing/decoder/prot/GameServerProtId.kt | 4 ++-- .../prot/ServerMessageDecoderRepository.kt | 8 ++++---- ...er.kt => UpdateStockMarketSlotV1Decoder.kt} | 16 ++++++++-------- ...ecoder.kt => UpdateTradingPostV1Decoder.kt} | 16 ++++++++-------- .../outgoing/decoder/prot/GameServerProt.kt | 4 ++-- .../outgoing/decoder/prot/GameServerProtId.kt | 4 ++-- .../prot/ServerMessageDecoderRepository.kt | 8 ++++---- ...er.kt => UpdateStockMarketSlotV1Decoder.kt} | 16 ++++++++-------- ...ecoder.kt => UpdateTradingPostV1Decoder.kt} | 16 ++++++++-------- .../outgoing/decoder/prot/GameServerProt.kt | 4 ++-- .../outgoing/decoder/prot/GameServerProtId.kt | 4 ++-- .../prot/ServerMessageDecoderRepository.kt | 8 ++++---- ...er.kt => UpdateStockMarketSlotV1Decoder.kt} | 16 ++++++++-------- ...ecoder.kt => UpdateTradingPostV1Decoder.kt} | 16 ++++++++-------- .../outgoing/decoder/prot/GameServerProt.kt | 4 ++-- .../outgoing/decoder/prot/GameServerProtId.kt | 4 ++-- .../prot/ServerMessageDecoderRepository.kt | 8 ++++---- ...er.kt => UpdateStockMarketSlotV1Decoder.kt} | 16 ++++++++-------- ...ecoder.kt => UpdateTradingPostV1Decoder.kt} | 16 ++++++++-------- .../outgoing/decoder/prot/GameServerProt.kt | 4 ++-- .../outgoing/decoder/prot/GameServerProtId.kt | 4 ++-- .../prot/ServerMessageDecoderRepository.kt | 8 ++++---- ...er.kt => UpdateStockMarketSlotV1Decoder.kt} | 16 ++++++++-------- ...ecoder.kt => UpdateTradingPostV1Decoder.kt} | 16 ++++++++-------- .../outgoing/decoder/prot/GameServerProt.kt | 4 ++-- .../outgoing/decoder/prot/GameServerProtId.kt | 4 ++-- .../prot/ServerMessageDecoderRepository.kt | 8 ++++---- ...er.kt => UpdateStockMarketSlotV1Decoder.kt} | 16 ++++++++-------- ...ecoder.kt => UpdateTradingPostV1Decoder.kt} | 16 ++++++++-------- .../outgoing/decoder/prot/GameServerProt.kt | 4 ++-- .../outgoing/decoder/prot/GameServerProtId.kt | 4 ++-- .../prot/ServerMessageDecoderRepository.kt | 8 ++++---- ...er.kt => UpdateStockMarketSlotV1Decoder.kt} | 16 ++++++++-------- ...ecoder.kt => UpdateTradingPostV1Decoder.kt} | 16 ++++++++-------- .../outgoing/decoder/prot/GameServerProt.kt | 4 ++-- .../outgoing/decoder/prot/GameServerProtId.kt | 4 ++-- .../prot/ServerMessageDecoderRepository.kt | 8 ++++---- ...er.kt => UpdateStockMarketSlotV1Decoder.kt} | 16 ++++++++-------- ...ecoder.kt => UpdateTradingPostV1Decoder.kt} | 16 ++++++++-------- ...der.kt => ObjCustomiseSpecificV1Decoder.kt} | 10 +++++----- .../outgoing/decoder/prot/GameServerProt.kt | 6 +++--- .../outgoing/decoder/prot/GameServerProtId.kt | 6 +++--- .../prot/ServerMessageDecoderRepository.kt | 10 +++++----- ...er.kt => UpdateStockMarketSlotV1Decoder.kt} | 16 ++++++++-------- ...ecoder.kt => UpdateTradingPostV1Decoder.kt} | 16 ++++++++-------- ...der.kt => ObjCustomiseSpecificV1Decoder.kt} | 10 +++++----- .../outgoing/decoder/prot/GameServerProt.kt | 6 +++--- .../outgoing/decoder/prot/GameServerProtId.kt | 6 +++--- .../prot/ServerMessageDecoderRepository.kt | 10 +++++----- ...er.kt => UpdateStockMarketSlotV1Decoder.kt} | 16 ++++++++-------- ...ecoder.kt => UpdateTradingPostV1Decoder.kt} | 16 ++++++++-------- ...der.kt => ObjCustomiseSpecificV1Decoder.kt} | 10 +++++----- .../outgoing/decoder/prot/GameServerProt.kt | 6 +++--- .../outgoing/decoder/prot/GameServerProtId.kt | 6 +++--- .../prot/ServerMessageDecoderRepository.kt | 10 +++++----- ...er.kt => UpdateStockMarketSlotV1Decoder.kt} | 16 ++++++++-------- ...ecoder.kt => UpdateTradingPostV1Decoder.kt} | 16 ++++++++-------- ...der.kt => ObjCustomiseSpecificV1Decoder.kt} | 10 +++++----- .../outgoing/decoder/prot/GameServerProt.kt | 6 +++--- .../outgoing/decoder/prot/GameServerProtId.kt | 6 +++--- .../prot/ServerMessageDecoderRepository.kt | 10 +++++----- ...er.kt => UpdateStockMarketSlotV1Decoder.kt} | 16 ++++++++-------- ...ecoder.kt => UpdateTradingPostV1Decoder.kt} | 16 ++++++++-------- ...der.kt => ObjCustomiseSpecificV1Decoder.kt} | 10 +++++----- .../outgoing/decoder/prot/GameServerProt.kt | 6 +++--- .../outgoing/decoder/prot/GameServerProtId.kt | 6 +++--- .../prot/ServerMessageDecoderRepository.kt | 10 +++++----- ...er.kt => UpdateStockMarketSlotV1Decoder.kt} | 16 ++++++++-------- ...ecoder.kt => UpdateTradingPostV1Decoder.kt} | 16 ++++++++-------- ...der.kt => ObjCustomiseSpecificV1Decoder.kt} | 10 +++++----- .../outgoing/decoder/prot/GameServerProt.kt | 6 +++--- .../outgoing/decoder/prot/GameServerProtId.kt | 6 +++--- .../prot/ServerMessageDecoderRepository.kt | 10 +++++----- ...er.kt => UpdateStockMarketSlotV1Decoder.kt} | 16 ++++++++-------- ...ecoder.kt => UpdateTradingPostV1Decoder.kt} | 16 ++++++++-------- ...der.kt => ObjCustomiseSpecificV1Decoder.kt} | 10 +++++----- .../outgoing/decoder/prot/GameServerProt.kt | 6 +++--- .../outgoing/decoder/prot/GameServerProtId.kt | 6 +++--- .../prot/ServerMessageDecoderRepository.kt | 10 +++++----- ...er.kt => UpdateStockMarketSlotV1Decoder.kt} | 16 ++++++++-------- ...ecoder.kt => UpdateTradingPostV1Decoder.kt} | 16 ++++++++-------- ...der.kt => ObjCustomiseSpecificV1Decoder.kt} | 10 +++++----- .../outgoing/decoder/prot/GameServerProt.kt | 6 +++--- .../outgoing/decoder/prot/GameServerProtId.kt | 6 +++--- .../prot/ServerMessageDecoderRepository.kt | 10 +++++----- ...er.kt => UpdateStockMarketSlotV1Decoder.kt} | 16 ++++++++-------- ...ecoder.kt => UpdateTradingPostV1Decoder.kt} | 16 ++++++++-------- ...der.kt => ObjCustomiseSpecificV1Decoder.kt} | 10 +++++----- .../outgoing/decoder/prot/GameServerProt.kt | 6 +++--- .../outgoing/decoder/prot/GameServerProtId.kt | 6 +++--- .../prot/ServerMessageDecoderRepository.kt | 10 +++++----- ...er.kt => UpdateStockMarketSlotV1Decoder.kt} | 16 ++++++++-------- ...ecoder.kt => UpdateTradingPostV1Decoder.kt} | 16 ++++++++-------- ...der.kt => ObjCustomiseSpecificV1Decoder.kt} | 10 +++++----- .../outgoing/decoder/prot/GameServerProt.kt | 6 +++--- .../outgoing/decoder/prot/GameServerProtId.kt | 6 +++--- .../prot/ServerMessageDecoderRepository.kt | 10 +++++----- ...arketSlot.kt => UpdateStockMarketSlotV1.kt} | 6 +++--- ...teTradingPost.kt => UpdateTradingPostV1.kt} | 6 +++--- ...seSpecific.kt => ObjCustomiseSpecificV1.kt} | 6 +++--- .../model/specific/ObjUncustomiseSpecific.kt | 2 +- .../rsprox/transcriber/TranscriberPlugin.kt | 6 +++--- .../transcriber/indexer/IndexerTranscriber.kt | 10 +++++----- .../interfaces/ServerPacketTranscriber.kt | 10 +++++----- .../rsprox/transcriber/prot/GameServerProt.kt | 6 +++--- .../text/TextServerPacketTranscriber.kt | 18 +++++++++--------- 114 files changed, 571 insertions(+), 571 deletions(-) rename protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/codec/misc/player/{UpdateStockMarketSlotDecoder.kt => UpdateStockMarketSlotV1Decoder.kt} (77%) rename protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/codec/misc/player/{UpdateTradingPostDecoder.kt => UpdateTradingPostV1Decoder.kt} (81%) rename protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/codec/misc/player/{UpdateStockMarketSlotDecoder.kt => UpdateStockMarketSlotV1Decoder.kt} (77%) rename protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/codec/misc/player/{UpdateTradingPostDecoder.kt => UpdateTradingPostV1Decoder.kt} (81%) rename protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/codec/misc/player/{UpdateStockMarketSlotDecoder.kt => UpdateStockMarketSlotV1Decoder.kt} (77%) rename protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/codec/misc/player/{UpdateTradingPostDecoder.kt => UpdateTradingPostV1Decoder.kt} (81%) rename protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/codec/misc/player/{UpdateStockMarketSlotDecoder.kt => UpdateStockMarketSlotV1Decoder.kt} (77%) rename protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/codec/misc/player/{UpdateTradingPostDecoder.kt => UpdateTradingPostV1Decoder.kt} (81%) rename protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/codec/misc/player/{UpdateStockMarketSlotDecoder.kt => UpdateStockMarketSlotV1Decoder.kt} (77%) rename protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/codec/misc/player/{UpdateTradingPostDecoder.kt => UpdateTradingPostV1Decoder.kt} (81%) rename protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/{UpdateStockMarketSlotDecoder.kt => UpdateStockMarketSlotV1Decoder.kt} (77%) rename protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/{UpdateTradingPostDecoder.kt => UpdateTradingPostV1Decoder.kt} (81%) rename protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/codec/misc/player/{UpdateStockMarketSlotDecoder.kt => UpdateStockMarketSlotV1Decoder.kt} (77%) rename protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/codec/misc/player/{UpdateTradingPostDecoder.kt => UpdateTradingPostV1Decoder.kt} (81%) rename protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/codec/misc/player/{UpdateStockMarketSlotDecoder.kt => UpdateStockMarketSlotV1Decoder.kt} (77%) rename protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/codec/misc/player/{UpdateTradingPostDecoder.kt => UpdateTradingPostV1Decoder.kt} (81%) rename protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/codec/misc/player/{UpdateStockMarketSlotDecoder.kt => UpdateStockMarketSlotV1Decoder.kt} (77%) rename protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/codec/misc/player/{UpdateTradingPostDecoder.kt => UpdateTradingPostV1Decoder.kt} (81%) rename protocol/osrs-232/src/main/kotlin/net/rsprox/protocol/v232/game/outgoing/decoder/codec/misc/player/{UpdateStockMarketSlotDecoder.kt => UpdateStockMarketSlotV1Decoder.kt} (77%) rename protocol/osrs-232/src/main/kotlin/net/rsprox/protocol/v232/game/outgoing/decoder/codec/misc/player/{UpdateTradingPostDecoder.kt => UpdateTradingPostV1Decoder.kt} (81%) rename protocol/osrs-232/src/main/kotlin/net/rsprox/protocol/v232/game/outgoing/decoder/codec/specific/{ObjCustomiseSpecificDecoder.kt => ObjCustomiseSpecificV1Decoder.kt} (84%) rename protocol/osrs-233/src/main/kotlin/net/rsprox/protocol/v233/game/outgoing/decoder/codec/misc/player/{UpdateStockMarketSlotDecoder.kt => UpdateStockMarketSlotV1Decoder.kt} (77%) rename protocol/osrs-233/src/main/kotlin/net/rsprox/protocol/v233/game/outgoing/decoder/codec/misc/player/{UpdateTradingPostDecoder.kt => UpdateTradingPostV1Decoder.kt} (81%) rename protocol/osrs-233/src/main/kotlin/net/rsprox/protocol/v233/game/outgoing/decoder/codec/specific/{ObjCustomiseSpecificDecoder.kt => ObjCustomiseSpecificV1Decoder.kt} (84%) rename protocol/osrs-234/src/main/kotlin/net/rsprox/protocol/v234/game/outgoing/decoder/codec/misc/player/{UpdateStockMarketSlotDecoder.kt => UpdateStockMarketSlotV1Decoder.kt} (77%) rename protocol/osrs-234/src/main/kotlin/net/rsprox/protocol/v234/game/outgoing/decoder/codec/misc/player/{UpdateTradingPostDecoder.kt => UpdateTradingPostV1Decoder.kt} (81%) rename protocol/osrs-234/src/main/kotlin/net/rsprox/protocol/v234/game/outgoing/decoder/codec/specific/{ObjCustomiseSpecificDecoder.kt => ObjCustomiseSpecificV1Decoder.kt} (84%) rename protocol/osrs-235/src/main/kotlin/net/rsprox/protocol/v235/game/outgoing/decoder/codec/misc/player/{UpdateStockMarketSlotDecoder.kt => UpdateStockMarketSlotV1Decoder.kt} (77%) rename protocol/osrs-235/src/main/kotlin/net/rsprox/protocol/v235/game/outgoing/decoder/codec/misc/player/{UpdateTradingPostDecoder.kt => UpdateTradingPostV1Decoder.kt} (81%) rename protocol/osrs-235/src/main/kotlin/net/rsprox/protocol/v235/game/outgoing/decoder/codec/specific/{ObjCustomiseSpecificDecoder.kt => ObjCustomiseSpecificV1Decoder.kt} (84%) rename protocol/osrs-236/src/main/kotlin/net/rsprox/protocol/v236/game/outgoing/decoder/codec/misc/player/{UpdateStockMarketSlotDecoder.kt => UpdateStockMarketSlotV1Decoder.kt} (77%) rename protocol/osrs-236/src/main/kotlin/net/rsprox/protocol/v236/game/outgoing/decoder/codec/misc/player/{UpdateTradingPostDecoder.kt => UpdateTradingPostV1Decoder.kt} (81%) rename protocol/osrs-236/src/main/kotlin/net/rsprox/protocol/v236/game/outgoing/decoder/codec/specific/{ObjCustomiseSpecificDecoder.kt => ObjCustomiseSpecificV1Decoder.kt} (84%) rename protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/outgoing/decoder/codec/misc/player/{UpdateStockMarketSlotDecoder.kt => UpdateStockMarketSlotV1Decoder.kt} (77%) rename protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/outgoing/decoder/codec/misc/player/{UpdateTradingPostDecoder.kt => UpdateTradingPostV1Decoder.kt} (81%) rename protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/outgoing/decoder/codec/specific/{ObjCustomiseSpecificDecoder.kt => ObjCustomiseSpecificV1Decoder.kt} (84%) rename protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/outgoing/decoder/codec/misc/player/{UpdateStockMarketSlotDecoder.kt => UpdateStockMarketSlotV1Decoder.kt} (77%) rename protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/outgoing/decoder/codec/misc/player/{UpdateTradingPostDecoder.kt => UpdateTradingPostV1Decoder.kt} (81%) rename protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/outgoing/decoder/codec/specific/{ObjCustomiseSpecificDecoder.kt => ObjCustomiseSpecificV1Decoder.kt} (84%) rename protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/outgoing/decoder/codec/misc/player/{UpdateStockMarketSlotDecoder.kt => UpdateStockMarketSlotV1Decoder.kt} (77%) rename protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/outgoing/decoder/codec/misc/player/{UpdateTradingPostDecoder.kt => UpdateTradingPostV1Decoder.kt} (81%) rename protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/outgoing/decoder/codec/specific/{ObjCustomiseSpecificDecoder.kt => ObjCustomiseSpecificV1Decoder.kt} (84%) rename protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/outgoing/decoder/codec/misc/player/{UpdateStockMarketSlotDecoder.kt => UpdateStockMarketSlotV1Decoder.kt} (77%) rename protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/outgoing/decoder/codec/misc/player/{UpdateTradingPostDecoder.kt => UpdateTradingPostV1Decoder.kt} (81%) rename protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/outgoing/decoder/codec/specific/{ObjCustomiseSpecificDecoder.kt => ObjCustomiseSpecificV1Decoder.kt} (84%) rename protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/{UpdateStockMarketSlotDecoder.kt => UpdateStockMarketSlotV1Decoder.kt} (77%) rename protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/misc/player/{UpdateTradingPostDecoder.kt => UpdateTradingPostV1Decoder.kt} (81%) rename protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/{ObjCustomiseSpecificDecoder.kt => ObjCustomiseSpecificV1Decoder.kt} (84%) rename protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/misc/player/{UpdateStockMarketSlot.kt => UpdateStockMarketSlotV1.kt} (96%) rename protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/misc/player/{UpdateTradingPost.kt => UpdateTradingPostV1.kt} (97%) rename protocol/src/main/kotlin/net/rsprox/protocol/game/outgoing/model/specific/{ObjCustomiseSpecific.kt => ObjCustomiseSpecificV1.kt} (95%) diff --git a/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt b/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt similarity index 77% rename from protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt rename to protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt index 9185ae7fb..6735b6a13 100644 --- a/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt +++ b/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt @@ -4,24 +4,24 @@ 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.game.outgoing.model.misc.player.UpdateStockMarketSlotV1 import net.rsprox.protocol.session.Session import net.rsprox.protocol.v223.game.outgoing.decoder.prot.GameServerProt @Consistent -internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT +internal class UpdateStockMarketSlotV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateStockMarketSlot { + ): UpdateStockMarketSlotV1 { val slot = buffer.g1() return when (val status = buffer.g1()) { 0 -> { - UpdateStockMarketSlot( + UpdateStockMarketSlotV1( slot, - UpdateStockMarketSlot.ResetStockMarketSlot, + UpdateStockMarketSlotV1.ResetStockMarketSlot, ) } else -> { @@ -30,9 +30,9 @@ internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST +internal class UpdateTradingPostV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateTradingPost { + ): UpdateTradingPostV1 { val reset = buffer.g1() == 0 if (reset) { - return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + return UpdateTradingPostV1(UpdateTradingPostV1.ResetTradingPost) } val age = buffer.g8() val obj = buffer.g2() @@ -34,7 +34,7 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder val price = buffer.g4() val count = buffer.g4() add( - UpdateTradingPost.TradingPostOffer( + UpdateTradingPostV1.TradingPostOffer( name, previousName, world, @@ -45,8 +45,8 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder ) } } - return UpdateTradingPost( - UpdateTradingPost.SetTradingPostOfferList( + return UpdateTradingPostV1( + UpdateTradingPostV1.SetTradingPostOfferList( age, obj, status, diff --git a/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/prot/GameServerProt.kt b/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/prot/GameServerProt.kt index ec03f4cec..6cddbbec4 100644 --- a/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/prot/GameServerProt.kt +++ b/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/prot/GameServerProt.kt @@ -165,8 +165,8 @@ public enum class GameServerProt( 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), + UPDATE_TRADINGPOST_V1(GameServerProtId.UPDATE_TRADINGPOST_V1, Prot.VAR_SHORT), + UPDATE_STOCKMARKET_SLOT_V1(GameServerProtId.UPDATE_STOCKMARKET_SLOT_V1, 20), // Misc. client state packets HINT_ARROW(GameServerProtId.HINT_ARROW, 6), diff --git a/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/prot/GameServerProtId.kt b/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/prot/GameServerProtId.kt index 0099552c8..8ab049981 100644 --- a/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/prot/GameServerProtId.kt +++ b/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/prot/GameServerProtId.kt @@ -82,11 +82,11 @@ internal object GameServerProtId { const val MAP_ANIM = 78 const val VARP_SYNC = 79 const val MIDI_SONG_WITHSECONDARY = 80 - const val UPDATE_TRADINGPOST = 81 + const val UPDATE_TRADINGPOST_V1 = 81 const val CHAT_FILTER_SETTINGS_PRIVATECHAT = 82 const val MESSAGE_PRIVATE = 83 const val MIDI_SONG_V1 = 84 - const val UPDATE_STOCKMARKET_SLOT = 85 + const val UPDATE_STOCKMARKET_SLOT_V1 = 85 const val IF_SETCOLOUR = 86 const val LOC_DEL = 87 const val MESSAGE_CLANCHANNEL_SYSTEM = 88 diff --git a/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt b/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt index 884f4e4ee..e5bb7d2dc 100644 --- a/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt +++ b/protocol/osrs-223/src/main/kotlin/net/rsprox/protocol/v223/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt @@ -97,8 +97,8 @@ import net.rsprox.protocol.v223.game.outgoing.decoder.codec.misc.player.UpdateRu import net.rsprox.protocol.v223.game.outgoing.decoder.codec.misc.player.UpdateRunWeightDecoder import net.rsprox.protocol.v223.game.outgoing.decoder.codec.misc.player.UpdateStatV1Decoder import net.rsprox.protocol.v223.game.outgoing.decoder.codec.misc.player.UpdateStatV2Decoder -import net.rsprox.protocol.v223.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotDecoder -import net.rsprox.protocol.v223.game.outgoing.decoder.codec.misc.player.UpdateTradingPostDecoder +import net.rsprox.protocol.v223.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotV1Decoder +import net.rsprox.protocol.v223.game.outgoing.decoder.codec.misc.player.UpdateTradingPostV1Decoder import net.rsprox.protocol.v223.game.outgoing.decoder.codec.social.FriendListLoadedDecoder import net.rsprox.protocol.v223.game.outgoing.decoder.codec.social.MessagePrivateDecoder import net.rsprox.protocol.v223.game.outgoing.decoder.codec.social.MessagePrivateEchoDecoder @@ -252,8 +252,8 @@ internal object ServerMessageDecoderRepository { bind(UpdateRunWeightDecoder()) bind(UpdateStatV2Decoder()) bind(UpdateStatV1Decoder()) - bind(UpdateStockMarketSlotDecoder()) - bind(UpdateTradingPostDecoder()) + bind(UpdateStockMarketSlotV1Decoder()) + bind(UpdateTradingPostV1Decoder()) bind(FriendListLoadedDecoder()) bind(MessagePrivateEchoDecoder(huffmanCodec)) diff --git a/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt b/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt similarity index 77% rename from protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt rename to protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt index b72cc9262..86dd1c992 100644 --- a/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt +++ b/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt @@ -4,24 +4,24 @@ 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.game.outgoing.model.misc.player.UpdateStockMarketSlotV1 import net.rsprox.protocol.session.Session import net.rsprox.protocol.v224.game.outgoing.decoder.prot.GameServerProt @Consistent -internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT +internal class UpdateStockMarketSlotV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateStockMarketSlot { + ): UpdateStockMarketSlotV1 { val slot = buffer.g1() return when (val status = buffer.g1()) { 0 -> { - UpdateStockMarketSlot( + UpdateStockMarketSlotV1( slot, - UpdateStockMarketSlot.ResetStockMarketSlot, + UpdateStockMarketSlotV1.ResetStockMarketSlot, ) } else -> { @@ -30,9 +30,9 @@ internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST +internal class UpdateTradingPostV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateTradingPost { + ): UpdateTradingPostV1 { val reset = buffer.g1() == 0 if (reset) { - return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + return UpdateTradingPostV1(UpdateTradingPostV1.ResetTradingPost) } val age = buffer.g8() val obj = buffer.g2() @@ -34,7 +34,7 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder val price = buffer.g4() val count = buffer.g4() add( - UpdateTradingPost.TradingPostOffer( + UpdateTradingPostV1.TradingPostOffer( name, previousName, world, @@ -45,8 +45,8 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder ) } } - return UpdateTradingPost( - UpdateTradingPost.SetTradingPostOfferList( + return UpdateTradingPostV1( + UpdateTradingPostV1.SetTradingPostOfferList( age, obj, status, diff --git a/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/prot/GameServerProt.kt b/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/prot/GameServerProt.kt index 9c9d42695..6935ae134 100644 --- a/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/prot/GameServerProt.kt +++ b/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/prot/GameServerProt.kt @@ -165,8 +165,8 @@ public enum class GameServerProt( 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), + UPDATE_TRADINGPOST_V1(GameServerProtId.UPDATE_TRADINGPOST_V1, Prot.VAR_SHORT), + UPDATE_STOCKMARKET_SLOT_V1(GameServerProtId.UPDATE_STOCKMARKET_SLOT_V1, 20), // Misc. client state packets HINT_ARROW(GameServerProtId.HINT_ARROW, 6), diff --git a/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/prot/GameServerProtId.kt b/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/prot/GameServerProtId.kt index bde03c6a7..e17a87730 100644 --- a/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/prot/GameServerProtId.kt +++ b/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/prot/GameServerProtId.kt @@ -38,7 +38,7 @@ internal object GameServerProtId { const val SET_HEATMAP_ENABLED = 34 const val UPDATE_ZONE_PARTIAL_ENCLOSED = 35 const val MIDI_SONG_STOP = 36 - const val UPDATE_STOCKMARKET_SLOT = 37 + const val UPDATE_STOCKMARKET_SLOT_V1 = 37 const val IF_RESYNC_V1 = 38 const val IF_OPENTOP = 39 const val UPDATE_FRIENDLIST = 40 @@ -96,7 +96,7 @@ internal object GameServerProtId { const val IF_SETPLAYERMODEL_BASECOLOUR = 92 const val CLANCHANNEL_FULL = 93 const val NPC_INFO_SMALL_V4 = 94 - const val UPDATE_TRADINGPOST = 95 + const val UPDATE_TRADINGPOST_V1 = 95 const val NPC_INFO_LARGE_V4 = 96 const val IF_SETSCROLLPOS = 97 const val MESSAGE_GAME = 98 diff --git a/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt b/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt index 9e4251fbb..0d44740e0 100644 --- a/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt +++ b/protocol/osrs-224/src/main/kotlin/net/rsprox/protocol/v224/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt @@ -97,8 +97,8 @@ import net.rsprox.protocol.v224.game.outgoing.decoder.codec.misc.player.UpdateRu import net.rsprox.protocol.v224.game.outgoing.decoder.codec.misc.player.UpdateRunWeightDecoder import net.rsprox.protocol.v224.game.outgoing.decoder.codec.misc.player.UpdateStatV1Decoder import net.rsprox.protocol.v224.game.outgoing.decoder.codec.misc.player.UpdateStatV2Decoder -import net.rsprox.protocol.v224.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotDecoder -import net.rsprox.protocol.v224.game.outgoing.decoder.codec.misc.player.UpdateTradingPostDecoder +import net.rsprox.protocol.v224.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotV1Decoder +import net.rsprox.protocol.v224.game.outgoing.decoder.codec.misc.player.UpdateTradingPostV1Decoder import net.rsprox.protocol.v224.game.outgoing.decoder.codec.social.FriendListLoadedDecoder import net.rsprox.protocol.v224.game.outgoing.decoder.codec.social.MessagePrivateDecoder import net.rsprox.protocol.v224.game.outgoing.decoder.codec.social.MessagePrivateEchoDecoder @@ -253,8 +253,8 @@ internal object ServerMessageDecoderRepository { bind(UpdateRunWeightDecoder()) bind(UpdateStatV2Decoder()) bind(UpdateStatV1Decoder()) - bind(UpdateStockMarketSlotDecoder()) - bind(UpdateTradingPostDecoder()) + bind(UpdateStockMarketSlotV1Decoder()) + bind(UpdateTradingPostV1Decoder()) bind(FriendListLoadedDecoder()) bind(MessagePrivateEchoDecoder(huffmanCodec)) diff --git a/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt b/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt similarity index 77% rename from protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt rename to protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt index d511392cc..232f36304 100644 --- a/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt +++ b/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt @@ -4,24 +4,24 @@ 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.game.outgoing.model.misc.player.UpdateStockMarketSlotV1 import net.rsprox.protocol.session.Session import net.rsprox.protocol.v225.game.outgoing.decoder.prot.GameServerProt @Consistent -internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT +internal class UpdateStockMarketSlotV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateStockMarketSlot { + ): UpdateStockMarketSlotV1 { val slot = buffer.g1() return when (val status = buffer.g1()) { 0 -> { - UpdateStockMarketSlot( + UpdateStockMarketSlotV1( slot, - UpdateStockMarketSlot.ResetStockMarketSlot, + UpdateStockMarketSlotV1.ResetStockMarketSlot, ) } else -> { @@ -30,9 +30,9 @@ internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST +internal class UpdateTradingPostV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateTradingPost { + ): UpdateTradingPostV1 { val reset = buffer.g1() == 0 if (reset) { - return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + return UpdateTradingPostV1(UpdateTradingPostV1.ResetTradingPost) } val age = buffer.g8() val obj = buffer.g2() @@ -34,7 +34,7 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder val price = buffer.g4() val count = buffer.g4() add( - UpdateTradingPost.TradingPostOffer( + UpdateTradingPostV1.TradingPostOffer( name, previousName, world, @@ -45,8 +45,8 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder ) } } - return UpdateTradingPost( - UpdateTradingPost.SetTradingPostOfferList( + return UpdateTradingPostV1( + UpdateTradingPostV1.SetTradingPostOfferList( age, obj, status, diff --git a/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/prot/GameServerProt.kt b/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/prot/GameServerProt.kt index 2e85b4b93..f7da182a7 100644 --- a/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/prot/GameServerProt.kt +++ b/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/prot/GameServerProt.kt @@ -177,8 +177,8 @@ public enum class GameServerProt( 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), + UPDATE_TRADINGPOST_V1(GameServerProtId.UPDATE_TRADINGPOST_V1, Prot.VAR_SHORT), + UPDATE_STOCKMARKET_SLOT_V1(GameServerProtId.UPDATE_STOCKMARKET_SLOT_V1, 20), // Misc. client state packets HINT_ARROW(GameServerProtId.HINT_ARROW, 6), diff --git a/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/prot/GameServerProtId.kt b/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/prot/GameServerProtId.kt index 384a84bd5..71d041f85 100644 --- a/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/prot/GameServerProtId.kt +++ b/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/prot/GameServerProtId.kt @@ -59,7 +59,7 @@ internal object GameServerProtId { const val OBJ_DEL = 55 const val IF_SETPLAYERMODEL_OBJ = 56 const val IF_SETHIDE = 57 - const val UPDATE_TRADINGPOST = 58 + const val UPDATE_TRADINGPOST_V1 = 58 const val LOGOUT = 59 const val ANIM_SPECIFIC = 60 const val UPDATE_FRIENDLIST = 61 @@ -78,7 +78,7 @@ internal object GameServerProtId { const val UPDATE_INV_STOPTRANSMIT = 74 const val WORLDENTITY_INFO_V1 = 75 const val MIDI_SONG_WITHSECONDARY = 76 - const val UPDATE_STOCKMARKET_SLOT = 77 + const val UPDATE_STOCKMARKET_SLOT_V1 = 77 const val RUNCLIENTSCRIPT = 78 const val VARP_SYNC = 79 const val MESSAGE_GAME = 80 diff --git a/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt b/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt index 0a25fa33c..e532ae536 100644 --- a/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt +++ b/protocol/osrs-225/src/main/kotlin/net/rsprox/protocol/v225/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt @@ -97,8 +97,8 @@ import net.rsprox.protocol.v225.game.outgoing.decoder.codec.misc.player.UpdateRu import net.rsprox.protocol.v225.game.outgoing.decoder.codec.misc.player.UpdateRunWeightDecoder import net.rsprox.protocol.v225.game.outgoing.decoder.codec.misc.player.UpdateStatV1Decoder import net.rsprox.protocol.v225.game.outgoing.decoder.codec.misc.player.UpdateStatV2Decoder -import net.rsprox.protocol.v225.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotDecoder -import net.rsprox.protocol.v225.game.outgoing.decoder.codec.misc.player.UpdateTradingPostDecoder +import net.rsprox.protocol.v225.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotV1Decoder +import net.rsprox.protocol.v225.game.outgoing.decoder.codec.misc.player.UpdateTradingPostV1Decoder import net.rsprox.protocol.v225.game.outgoing.decoder.codec.social.FriendListLoadedDecoder import net.rsprox.protocol.v225.game.outgoing.decoder.codec.social.MessagePrivateDecoder import net.rsprox.protocol.v225.game.outgoing.decoder.codec.social.MessagePrivateEchoDecoder @@ -253,8 +253,8 @@ internal object ServerMessageDecoderRepository { bind(UpdateRunWeightDecoder()) bind(UpdateStatV2Decoder()) bind(UpdateStatV1Decoder()) - bind(UpdateStockMarketSlotDecoder()) - bind(UpdateTradingPostDecoder()) + bind(UpdateStockMarketSlotV1Decoder()) + bind(UpdateTradingPostV1Decoder()) bind(FriendListLoadedDecoder()) bind(MessagePrivateEchoDecoder(huffmanCodec)) diff --git a/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt b/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt similarity index 77% rename from protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt rename to protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt index deaded03d..6739c4728 100644 --- a/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt +++ b/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt @@ -4,24 +4,24 @@ 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.game.outgoing.model.misc.player.UpdateStockMarketSlotV1 import net.rsprox.protocol.session.Session import net.rsprox.protocol.v226.game.outgoing.decoder.prot.GameServerProt @Consistent -internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT +internal class UpdateStockMarketSlotV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateStockMarketSlot { + ): UpdateStockMarketSlotV1 { val slot = buffer.g1() return when (val status = buffer.g1()) { 0 -> { - UpdateStockMarketSlot( + UpdateStockMarketSlotV1( slot, - UpdateStockMarketSlot.ResetStockMarketSlot, + UpdateStockMarketSlotV1.ResetStockMarketSlot, ) } else -> { @@ -30,9 +30,9 @@ internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST +internal class UpdateTradingPostV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateTradingPost { + ): UpdateTradingPostV1 { val reset = buffer.g1() == 0 if (reset) { - return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + return UpdateTradingPostV1(UpdateTradingPostV1.ResetTradingPost) } val age = buffer.g8() val obj = buffer.g2() @@ -34,7 +34,7 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder val price = buffer.g4() val count = buffer.g4() add( - UpdateTradingPost.TradingPostOffer( + UpdateTradingPostV1.TradingPostOffer( name, previousName, world, @@ -45,8 +45,8 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder ) } } - return UpdateTradingPost( - UpdateTradingPost.SetTradingPostOfferList( + return UpdateTradingPostV1( + UpdateTradingPostV1.SetTradingPostOfferList( age, obj, status, diff --git a/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/prot/GameServerProt.kt b/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/prot/GameServerProt.kt index 7201052c6..80975c74e 100644 --- a/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/prot/GameServerProt.kt +++ b/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/prot/GameServerProt.kt @@ -197,8 +197,8 @@ public enum class GameServerProt( 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), + UPDATE_TRADINGPOST_V1(GameServerProtId.UPDATE_TRADINGPOST_V1, Prot.VAR_SHORT), + UPDATE_STOCKMARKET_SLOT_V1(GameServerProtId.UPDATE_STOCKMARKET_SLOT_V1, 20), // Misc. client state packets HINT_ARROW(GameServerProtId.HINT_ARROW, 6), diff --git a/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/prot/GameServerProtId.kt b/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/prot/GameServerProtId.kt index d514b5ef7..45ad77868 100644 --- a/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/prot/GameServerProtId.kt +++ b/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/prot/GameServerProtId.kt @@ -56,7 +56,7 @@ internal object GameServerProtId { const val PROJANIM_SPECIFIC_V1 = 52 const val LOC_ANIM_SPECIFIC = 53 const val UPDATE_FRIENDCHAT_CHANNEL_SINGLEUSER = 54 - const val UPDATE_STOCKMARKET_SLOT = 55 + const val UPDATE_STOCKMARKET_SLOT_V1 = 55 const val MIDI_JINGLE = 56 const val IF_SETHIDE = 57 const val IF_SETCOLOUR = 58 @@ -78,7 +78,7 @@ internal object GameServerProtId { const val LOC_DEL = 74 const val HISCORE_REPLY = 75 const val CAM_SMOOTHRESET = 76 - const val UPDATE_TRADINGPOST = 77 + const val UPDATE_TRADINGPOST_V1 = 77 const val REFLECTION_CHECKER = 78 const val IF_SETPLAYERHEAD = 79 const val LOC_ANIM = 80 diff --git a/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt b/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt index 728b56433..75aa930c5 100644 --- a/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt +++ b/protocol/osrs-226/src/main/kotlin/net/rsprox/protocol/v226/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt @@ -99,8 +99,8 @@ import net.rsprox.protocol.v226.game.outgoing.decoder.codec.misc.player.UpdateRu import net.rsprox.protocol.v226.game.outgoing.decoder.codec.misc.player.UpdateRunWeightDecoder import net.rsprox.protocol.v226.game.outgoing.decoder.codec.misc.player.UpdateStatV1Decoder import net.rsprox.protocol.v226.game.outgoing.decoder.codec.misc.player.UpdateStatV2Decoder -import net.rsprox.protocol.v226.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotDecoder -import net.rsprox.protocol.v226.game.outgoing.decoder.codec.misc.player.UpdateTradingPostDecoder +import net.rsprox.protocol.v226.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotV1Decoder +import net.rsprox.protocol.v226.game.outgoing.decoder.codec.misc.player.UpdateTradingPostV1Decoder import net.rsprox.protocol.v226.game.outgoing.decoder.codec.social.FriendListLoadedDecoder import net.rsprox.protocol.v226.game.outgoing.decoder.codec.social.MessagePrivateDecoder import net.rsprox.protocol.v226.game.outgoing.decoder.codec.social.MessagePrivateEchoDecoder @@ -259,8 +259,8 @@ internal object ServerMessageDecoderRepository { bind(UpdateRunWeightDecoder()) bind(UpdateStatV2Decoder()) bind(UpdateStatV1Decoder()) - bind(UpdateStockMarketSlotDecoder()) - bind(UpdateTradingPostDecoder()) + bind(UpdateStockMarketSlotV1Decoder()) + bind(UpdateTradingPostV1Decoder()) bind(FriendListLoadedDecoder()) bind(MessagePrivateEchoDecoder(huffmanCodec)) diff --git a/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt b/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt similarity index 77% rename from protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt rename to protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt index 57c7a7392..9cef06f17 100644 --- a/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt +++ b/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt @@ -4,24 +4,24 @@ 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.game.outgoing.model.misc.player.UpdateStockMarketSlotV1 import net.rsprox.protocol.session.Session import net.rsprox.protocol.v227.game.outgoing.decoder.prot.GameServerProt @Consistent -internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT +internal class UpdateStockMarketSlotV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateStockMarketSlot { + ): UpdateStockMarketSlotV1 { val slot = buffer.g1() return when (val status = buffer.g1()) { 0 -> { - UpdateStockMarketSlot( + UpdateStockMarketSlotV1( slot, - UpdateStockMarketSlot.ResetStockMarketSlot, + UpdateStockMarketSlotV1.ResetStockMarketSlot, ) } else -> { @@ -30,9 +30,9 @@ internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST +internal class UpdateTradingPostV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateTradingPost { + ): UpdateTradingPostV1 { val reset = buffer.g1() == 0 if (reset) { - return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + return UpdateTradingPostV1(UpdateTradingPostV1.ResetTradingPost) } val age = buffer.g8() val obj = buffer.g2() @@ -34,7 +34,7 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder val price = buffer.g4() val count = buffer.g4() add( - UpdateTradingPost.TradingPostOffer( + UpdateTradingPostV1.TradingPostOffer( name, previousName, world, @@ -45,8 +45,8 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder ) } } - return UpdateTradingPost( - UpdateTradingPost.SetTradingPostOfferList( + return UpdateTradingPostV1( + UpdateTradingPostV1.SetTradingPostOfferList( age, obj, status, diff --git a/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/prot/GameServerProt.kt b/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/prot/GameServerProt.kt index 470329b27..f58b6b9c4 100644 --- a/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/prot/GameServerProt.kt +++ b/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/prot/GameServerProt.kt @@ -163,8 +163,8 @@ public enum class GameServerProt( 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), + UPDATE_TRADINGPOST_V1(GameServerProtId.UPDATE_TRADINGPOST_V1, Prot.VAR_SHORT), + UPDATE_STOCKMARKET_SLOT_V1(GameServerProtId.UPDATE_STOCKMARKET_SLOT_V1, 20), // Misc. client state packets HINT_ARROW(GameServerProtId.HINT_ARROW, 6), diff --git a/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/prot/GameServerProtId.kt b/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/prot/GameServerProtId.kt index f80ed442a..b8bf5d59f 100644 --- a/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/prot/GameServerProtId.kt +++ b/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/prot/GameServerProtId.kt @@ -42,7 +42,7 @@ internal object GameServerProtId { const val VARP_RESET = 38 const val UPDATE_FRIENDLIST = 39 const val CLEAR_ENTITIES = 40 - const val UPDATE_TRADINGPOST = 41 + const val UPDATE_TRADINGPOST_V1 = 41 const val IF_MOVESUB = 42 const val UPDATE_ZONE_FULL_FOLLOWS = 43 const val CLANCHANNEL_FULL = 44 @@ -55,7 +55,7 @@ internal object GameServerProtId { const val IF_SETPLAYERMODEL_SELF = 51 const val CAM_ROTATETO = 52 const val SOUND_AREA = 53 - const val UPDATE_STOCKMARKET_SLOT = 54 + const val UPDATE_STOCKMARKET_SLOT_V1 = 54 const val CAM_MOVETO_V1 = 55 const val MAP_PROJANIM_V1 = 56 const val SET_NPC_UPDATE_ORIGIN = 57 diff --git a/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt b/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt index 7a4357ebf..56030047f 100644 --- a/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt +++ b/protocol/osrs-227/src/main/kotlin/net/rsprox/protocol/v227/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt @@ -98,8 +98,8 @@ import net.rsprox.protocol.v227.game.outgoing.decoder.codec.misc.player.TriggerO import net.rsprox.protocol.v227.game.outgoing.decoder.codec.misc.player.UpdateRunEnergyDecoder import net.rsprox.protocol.v227.game.outgoing.decoder.codec.misc.player.UpdateRunWeightDecoder import net.rsprox.protocol.v227.game.outgoing.decoder.codec.misc.player.UpdateStatV2Decoder -import net.rsprox.protocol.v227.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotDecoder -import net.rsprox.protocol.v227.game.outgoing.decoder.codec.misc.player.UpdateTradingPostDecoder +import net.rsprox.protocol.v227.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotV1Decoder +import net.rsprox.protocol.v227.game.outgoing.decoder.codec.misc.player.UpdateTradingPostV1Decoder import net.rsprox.protocol.v227.game.outgoing.decoder.codec.social.FriendListLoadedDecoder import net.rsprox.protocol.v227.game.outgoing.decoder.codec.social.MessagePrivateDecoder import net.rsprox.protocol.v227.game.outgoing.decoder.codec.social.MessagePrivateEchoDecoder @@ -257,8 +257,8 @@ internal object ServerMessageDecoderRepository { bind(UpdateRunEnergyDecoder()) bind(UpdateRunWeightDecoder()) bind(UpdateStatV2Decoder()) - bind(UpdateStockMarketSlotDecoder()) - bind(UpdateTradingPostDecoder()) + bind(UpdateStockMarketSlotV1Decoder()) + bind(UpdateTradingPostV1Decoder()) bind(FriendListLoadedDecoder()) bind(MessagePrivateEchoDecoder(huffmanCodec)) 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/UpdateStockMarketSlotV1Decoder.kt similarity index 77% rename from protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt rename to protocol/osrs-228/src/main/kotlin/net/rsprox/protocol/v228/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt index 18d3c50d8..f880493b1 100644 --- 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/UpdateStockMarketSlotV1Decoder.kt @@ -4,24 +4,24 @@ 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.game.outgoing.model.misc.player.UpdateStockMarketSlotV1 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 +internal class UpdateStockMarketSlotV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateStockMarketSlot { + ): UpdateStockMarketSlotV1 { val slot = buffer.g1() return when (val status = buffer.g1()) { 0 -> { - UpdateStockMarketSlot( + UpdateStockMarketSlotV1( slot, - UpdateStockMarketSlot.ResetStockMarketSlot, + UpdateStockMarketSlotV1.ResetStockMarketSlot, ) } else -> { @@ -30,9 +30,9 @@ internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST +internal class UpdateTradingPostV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateTradingPost { + ): UpdateTradingPostV1 { val reset = buffer.g1() == 0 if (reset) { - return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + return UpdateTradingPostV1(UpdateTradingPostV1.ResetTradingPost) } val age = buffer.g8() val obj = buffer.g2() @@ -34,7 +34,7 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder val price = buffer.g4() val count = buffer.g4() add( - UpdateTradingPost.TradingPostOffer( + UpdateTradingPostV1.TradingPostOffer( name, previousName, world, @@ -45,8 +45,8 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder ) } } - return UpdateTradingPost( - UpdateTradingPost.SetTradingPostOfferList( + return UpdateTradingPostV1( + UpdateTradingPostV1.SetTradingPostOfferList( age, obj, status, 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 3a55e90f6..3b1d60a7e 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 @@ -164,8 +164,8 @@ public enum class GameServerProt( 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), + UPDATE_TRADINGPOST_V1(GameServerProtId.UPDATE_TRADINGPOST_V1, Prot.VAR_SHORT), + UPDATE_STOCKMARKET_SLOT_V1(GameServerProtId.UPDATE_STOCKMARKET_SLOT_V1, 20), // Misc. client state packets HINT_ARROW(GameServerProtId.HINT_ARROW, 6), 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 6b8dab5d3..6b556fd83 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 @@ -65,7 +65,7 @@ internal object GameServerProtId { const val IF_SETHIDE = 61 const val SET_MAP_FLAG_V1 = 62 const val HISCORE_REPLY = 63 - const val UPDATE_STOCKMARKET_SLOT = 64 + const val UPDATE_STOCKMARKET_SLOT_V1 = 64 const val VARP_LARGE = 65 const val UPDATE_UID192 = 66 const val MIDI_SONG_STOP = 67 @@ -76,7 +76,7 @@ internal object GameServerProtId { const val SITE_SETTINGS = 72 const val UPDATE_REBOOT_TIMER_V1 = 73 const val CAM_MOVETO_CYCLES_V1 = 74 - const val UPDATE_TRADINGPOST = 75 + const val UPDATE_TRADINGPOST_V1 = 75 const val UPDATE_INV_PARTIAL = 76 const val HINT_ARROW = 77 const val ANIM_SPECIFIC = 78 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 8204d5382..58c0f7f68 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 @@ -98,8 +98,8 @@ import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player.TriggerO 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.misc.player.UpdateStockMarketSlotV1Decoder +import net.rsprox.protocol.v228.game.outgoing.decoder.codec.misc.player.UpdateTradingPostV1Decoder 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 @@ -258,8 +258,8 @@ internal object ServerMessageDecoderRepository { bind(UpdateRunEnergyDecoder()) bind(UpdateRunWeightDecoder()) bind(UpdateStatV2Decoder()) - bind(UpdateStockMarketSlotDecoder()) - bind(UpdateTradingPostDecoder()) + bind(UpdateStockMarketSlotV1Decoder()) + bind(UpdateTradingPostV1Decoder()) bind(FriendListLoadedDecoder()) bind(MessagePrivateEchoDecoder(huffmanCodec)) diff --git a/protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt b/protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt similarity index 77% rename from protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt rename to protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt index 31cef268c..c535bce46 100644 --- a/protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt +++ b/protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt @@ -4,24 +4,24 @@ 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.game.outgoing.model.misc.player.UpdateStockMarketSlotV1 import net.rsprox.protocol.session.Session import net.rsprox.protocol.v229.game.outgoing.decoder.prot.GameServerProt @Consistent -internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT +internal class UpdateStockMarketSlotV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateStockMarketSlot { + ): UpdateStockMarketSlotV1 { val slot = buffer.g1() return when (val status = buffer.g1()) { 0 -> { - UpdateStockMarketSlot( + UpdateStockMarketSlotV1( slot, - UpdateStockMarketSlot.ResetStockMarketSlot, + UpdateStockMarketSlotV1.ResetStockMarketSlot, ) } else -> { @@ -30,9 +30,9 @@ internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST +internal class UpdateTradingPostV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateTradingPost { + ): UpdateTradingPostV1 { val reset = buffer.g1() == 0 if (reset) { - return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + return UpdateTradingPostV1(UpdateTradingPostV1.ResetTradingPost) } val age = buffer.g8() val obj = buffer.g2() @@ -34,7 +34,7 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder val price = buffer.g4() val count = buffer.g4() add( - UpdateTradingPost.TradingPostOffer( + UpdateTradingPostV1.TradingPostOffer( name, previousName, world, @@ -45,8 +45,8 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder ) } } - return UpdateTradingPost( - UpdateTradingPost.SetTradingPostOfferList( + return UpdateTradingPostV1( + UpdateTradingPostV1.SetTradingPostOfferList( age, obj, status, diff --git a/protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/prot/GameServerProt.kt b/protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/prot/GameServerProt.kt index 195a7d88a..039a3f920 100644 --- a/protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/prot/GameServerProt.kt +++ b/protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/prot/GameServerProt.kt @@ -160,8 +160,8 @@ public enum class GameServerProt( 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), + UPDATE_TRADINGPOST_V1(GameServerProtId.UPDATE_TRADINGPOST_V1, Prot.VAR_SHORT), + UPDATE_STOCKMARKET_SLOT_V1(GameServerProtId.UPDATE_STOCKMARKET_SLOT_V1, 20), // Misc. client state packets HINT_ARROW(GameServerProtId.HINT_ARROW, 6), diff --git a/protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/prot/GameServerProtId.kt b/protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/prot/GameServerProtId.kt index e816fa22b..f2c0c0b5f 100644 --- a/protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/prot/GameServerProtId.kt +++ b/protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/prot/GameServerProtId.kt @@ -14,7 +14,7 @@ internal object GameServerProtId { const val NPC_INFO_SMALL_V5 = 10 const val PROJANIM_SPECIFIC_V3 = 11 const val URL_OPEN = 12 - const val UPDATE_STOCKMARKET_SLOT = 13 + const val UPDATE_STOCKMARKET_SLOT_V1 = 13 const val CHAT_FILTER_SETTINGS_PRIVATECHAT = 14 const val MESSAGE_FRIENDCHANNEL = 15 const val CAM_ROTATETO_COORDINATE_V1 = 16 @@ -92,7 +92,7 @@ internal object GameServerProtId { const val UPDATE_FRIENDCHAT_CHANNEL_FULL_V2 = 88 const val SET_NPC_UPDATE_ORIGIN = 89 const val CAM_ROTATETO = 90 - const val UPDATE_TRADINGPOST = 91 + const val UPDATE_TRADINGPOST_V1 = 91 const val IF_SETPLAYERMODEL_BODYTYPE = 92 const val UPDATE_RUNWEIGHT = 93 const val UPDATE_ZONE_PARTIAL_FOLLOWS = 94 diff --git a/protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt b/protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt index 44c6760de..59e9c4ad5 100644 --- a/protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt +++ b/protocol/osrs-229/src/main/kotlin/net/rsprox/protocol/v229/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt @@ -97,8 +97,8 @@ import net.rsprox.protocol.v229.game.outgoing.decoder.codec.misc.player.TriggerO import net.rsprox.protocol.v229.game.outgoing.decoder.codec.misc.player.UpdateRunEnergyDecoder import net.rsprox.protocol.v229.game.outgoing.decoder.codec.misc.player.UpdateRunWeightDecoder import net.rsprox.protocol.v229.game.outgoing.decoder.codec.misc.player.UpdateStatV2Decoder -import net.rsprox.protocol.v229.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotDecoder -import net.rsprox.protocol.v229.game.outgoing.decoder.codec.misc.player.UpdateTradingPostDecoder +import net.rsprox.protocol.v229.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotV1Decoder +import net.rsprox.protocol.v229.game.outgoing.decoder.codec.misc.player.UpdateTradingPostV1Decoder import net.rsprox.protocol.v229.game.outgoing.decoder.codec.social.FriendListLoadedDecoder import net.rsprox.protocol.v229.game.outgoing.decoder.codec.social.MessagePrivateDecoder import net.rsprox.protocol.v229.game.outgoing.decoder.codec.social.MessagePrivateEchoDecoder @@ -257,8 +257,8 @@ internal object ServerMessageDecoderRepository { bind(UpdateRunEnergyDecoder()) bind(UpdateRunWeightDecoder()) bind(UpdateStatV2Decoder()) - bind(UpdateStockMarketSlotDecoder()) - bind(UpdateTradingPostDecoder()) + bind(UpdateStockMarketSlotV1Decoder()) + bind(UpdateTradingPostV1Decoder()) bind(FriendListLoadedDecoder()) bind(MessagePrivateEchoDecoder(huffmanCodec)) diff --git a/protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt b/protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt similarity index 77% rename from protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt rename to protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt index 4640dc255..9b886d39a 100644 --- a/protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt +++ b/protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt @@ -4,24 +4,24 @@ 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.game.outgoing.model.misc.player.UpdateStockMarketSlotV1 import net.rsprox.protocol.session.Session import net.rsprox.protocol.v230.game.outgoing.decoder.prot.GameServerProt @Consistent -internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT +internal class UpdateStockMarketSlotV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateStockMarketSlot { + ): UpdateStockMarketSlotV1 { val slot = buffer.g1() return when (val status = buffer.g1()) { 0 -> { - UpdateStockMarketSlot( + UpdateStockMarketSlotV1( slot, - UpdateStockMarketSlot.ResetStockMarketSlot, + UpdateStockMarketSlotV1.ResetStockMarketSlot, ) } else -> { @@ -30,9 +30,9 @@ internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST +internal class UpdateTradingPostV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateTradingPost { + ): UpdateTradingPostV1 { val reset = buffer.g1() == 0 if (reset) { - return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + return UpdateTradingPostV1(UpdateTradingPostV1.ResetTradingPost) } val age = buffer.g8() val obj = buffer.g2() @@ -34,7 +34,7 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder val price = buffer.g4() val count = buffer.g4() add( - UpdateTradingPost.TradingPostOffer( + UpdateTradingPostV1.TradingPostOffer( name, previousName, world, @@ -45,8 +45,8 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder ) } } - return UpdateTradingPost( - UpdateTradingPost.SetTradingPostOfferList( + return UpdateTradingPostV1( + UpdateTradingPostV1.SetTradingPostOfferList( age, obj, status, diff --git a/protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/prot/GameServerProt.kt b/protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/prot/GameServerProt.kt index 98e219edf..2727331a6 100644 --- a/protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/prot/GameServerProt.kt +++ b/protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/prot/GameServerProt.kt @@ -158,8 +158,8 @@ public enum class GameServerProt( 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), + UPDATE_TRADINGPOST_V1(GameServerProtId.UPDATE_TRADINGPOST_V1, Prot.VAR_SHORT), + UPDATE_STOCKMARKET_SLOT_V1(GameServerProtId.UPDATE_STOCKMARKET_SLOT_V1, 20), // Misc. client state packets HINT_ARROW(GameServerProtId.HINT_ARROW, 6), diff --git a/protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/prot/GameServerProtId.kt b/protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/prot/GameServerProtId.kt index 0bef360e6..0ca379142 100644 --- a/protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/prot/GameServerProtId.kt +++ b/protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/prot/GameServerProtId.kt @@ -55,7 +55,7 @@ internal object GameServerProtId { const val NPC_HEADICON_SPECIFIC = 51 const val SEND_PING = 52 const val IF_RESYNC_V1 = 53 - const val UPDATE_STOCKMARKET_SLOT = 54 + const val UPDATE_STOCKMARKET_SLOT_V1 = 54 const val SET_ACTIVE_WORLD_V1 = 55 const val UPDATE_FRIENDLIST = 56 const val MIDI_SONG_V2 = 57 @@ -126,7 +126,7 @@ internal object GameServerProtId { const val OBJ_ENABLED_OPS = 122 const val IF_SETPLAYERMODEL_BASECOLOUR = 123 const val HIDENPCOPS = 124 - const val UPDATE_TRADINGPOST = 125 + const val UPDATE_TRADINGPOST_V1 = 125 const val HIDELOCOPS = 126 const val MAP_PROJANIM_V1 = 127 const val WORLDENTITY_INFO_V5 = 128 diff --git a/protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt b/protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt index 8ff9b797c..c2bc3a8a1 100644 --- a/protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt +++ b/protocol/osrs-230/src/main/kotlin/net/rsprox/protocol/v230/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt @@ -97,8 +97,8 @@ import net.rsprox.protocol.v230.game.outgoing.decoder.codec.misc.player.TriggerO import net.rsprox.protocol.v230.game.outgoing.decoder.codec.misc.player.UpdateRunEnergyDecoder import net.rsprox.protocol.v230.game.outgoing.decoder.codec.misc.player.UpdateRunWeightDecoder import net.rsprox.protocol.v230.game.outgoing.decoder.codec.misc.player.UpdateStatV2Decoder -import net.rsprox.protocol.v230.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotDecoder -import net.rsprox.protocol.v230.game.outgoing.decoder.codec.misc.player.UpdateTradingPostDecoder +import net.rsprox.protocol.v230.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotV1Decoder +import net.rsprox.protocol.v230.game.outgoing.decoder.codec.misc.player.UpdateTradingPostV1Decoder import net.rsprox.protocol.v230.game.outgoing.decoder.codec.social.FriendListLoadedDecoder import net.rsprox.protocol.v230.game.outgoing.decoder.codec.social.MessagePrivateDecoder import net.rsprox.protocol.v230.game.outgoing.decoder.codec.social.MessagePrivateEchoDecoder @@ -255,8 +255,8 @@ internal object ServerMessageDecoderRepository { bind(UpdateRunEnergyDecoder()) bind(UpdateRunWeightDecoder()) bind(UpdateStatV2Decoder()) - bind(UpdateStockMarketSlotDecoder()) - bind(UpdateTradingPostDecoder()) + bind(UpdateStockMarketSlotV1Decoder()) + bind(UpdateTradingPostV1Decoder()) bind(FriendListLoadedDecoder()) bind(MessagePrivateEchoDecoder(huffmanCodec)) diff --git a/protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt b/protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt similarity index 77% rename from protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt rename to protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt index 18b024490..a6689f32a 100644 --- a/protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt +++ b/protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt @@ -4,24 +4,24 @@ 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.game.outgoing.model.misc.player.UpdateStockMarketSlotV1 import net.rsprox.protocol.session.Session import net.rsprox.protocol.v231.game.outgoing.decoder.prot.GameServerProt @Consistent -internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT +internal class UpdateStockMarketSlotV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateStockMarketSlot { + ): UpdateStockMarketSlotV1 { val slot = buffer.g1() return when (val status = buffer.g1()) { 0 -> { - UpdateStockMarketSlot( + UpdateStockMarketSlotV1( slot, - UpdateStockMarketSlot.ResetStockMarketSlot, + UpdateStockMarketSlotV1.ResetStockMarketSlot, ) } else -> { @@ -30,9 +30,9 @@ internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST +internal class UpdateTradingPostV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateTradingPost { + ): UpdateTradingPostV1 { val reset = buffer.g1() == 0 if (reset) { - return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + return UpdateTradingPostV1(UpdateTradingPostV1.ResetTradingPost) } val age = buffer.g8() val obj = buffer.g2() @@ -34,7 +34,7 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder val price = buffer.g4() val count = buffer.g4() add( - UpdateTradingPost.TradingPostOffer( + UpdateTradingPostV1.TradingPostOffer( name, previousName, world, @@ -45,8 +45,8 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder ) } } - return UpdateTradingPost( - UpdateTradingPost.SetTradingPostOfferList( + return UpdateTradingPostV1( + UpdateTradingPostV1.SetTradingPostOfferList( age, obj, status, diff --git a/protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/prot/GameServerProt.kt b/protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/prot/GameServerProt.kt index 464aa094c..37601f5c2 100644 --- a/protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/prot/GameServerProt.kt +++ b/protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/prot/GameServerProt.kt @@ -163,8 +163,8 @@ public enum class GameServerProt( 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), + UPDATE_TRADINGPOST_V1(GameServerProtId.UPDATE_TRADINGPOST_V1, Prot.VAR_SHORT), + UPDATE_STOCKMARKET_SLOT_V1(GameServerProtId.UPDATE_STOCKMARKET_SLOT_V1, 20), // Misc. client state packets HINT_ARROW(GameServerProtId.HINT_ARROW, 6), diff --git a/protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/prot/GameServerProtId.kt b/protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/prot/GameServerProtId.kt index 9f0951118..97ce97026 100644 --- a/protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/prot/GameServerProtId.kt +++ b/protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/prot/GameServerProtId.kt @@ -120,13 +120,13 @@ internal object GameServerProtId { const val MAP_PROJANIM_V1 = 116 const val IF_CLEARINV = 117 const val MAP_ANIM_SPECIFIC = 118 - const val UPDATE_STOCKMARKET_SLOT = 119 + const val UPDATE_STOCKMARKET_SLOT_V1 = 119 const val LOC_ANIM_SPECIFIC = 120 const val UPDATE_FRIENDCHAT_CHANNEL_FULL_V2 = 121 const val MIDI_SONG_WITHSECONDARY = 122 const val UNKNOWN_STRING = 123 const val PROJANIM_SPECIFIC_V3 = 124 - const val UPDATE_TRADINGPOST = 125 + const val UPDATE_TRADINGPOST_V1 = 125 const val LOC_DEL = 126 const val HIDELOCOPS = 127 const val RESET_INTERACTION_MODE = 128 diff --git a/protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt b/protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt index 98763c364..b6e922adf 100644 --- a/protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt +++ b/protocol/osrs-231/src/main/kotlin/net/rsprox/protocol/v231/game/outgoing/decoder/prot/ServerMessageDecoderRepository.kt @@ -98,8 +98,8 @@ import net.rsprox.protocol.v231.game.outgoing.decoder.codec.misc.player.TriggerO import net.rsprox.protocol.v231.game.outgoing.decoder.codec.misc.player.UpdateRunEnergyDecoder import net.rsprox.protocol.v231.game.outgoing.decoder.codec.misc.player.UpdateRunWeightDecoder import net.rsprox.protocol.v231.game.outgoing.decoder.codec.misc.player.UpdateStatV2Decoder -import net.rsprox.protocol.v231.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotDecoder -import net.rsprox.protocol.v231.game.outgoing.decoder.codec.misc.player.UpdateTradingPostDecoder +import net.rsprox.protocol.v231.game.outgoing.decoder.codec.misc.player.UpdateStockMarketSlotV1Decoder +import net.rsprox.protocol.v231.game.outgoing.decoder.codec.misc.player.UpdateTradingPostV1Decoder import net.rsprox.protocol.v231.game.outgoing.decoder.codec.social.FriendListLoadedDecoder import net.rsprox.protocol.v231.game.outgoing.decoder.codec.social.MessagePrivateDecoder import net.rsprox.protocol.v231.game.outgoing.decoder.codec.social.MessagePrivateEchoDecoder @@ -258,8 +258,8 @@ internal object ServerMessageDecoderRepository { bind(UpdateRunEnergyDecoder()) bind(UpdateRunWeightDecoder()) bind(UpdateStatV2Decoder()) - bind(UpdateStockMarketSlotDecoder()) - bind(UpdateTradingPostDecoder()) + bind(UpdateStockMarketSlotV1Decoder()) + bind(UpdateTradingPostV1Decoder()) bind(FriendListLoadedDecoder()) bind(MessagePrivateEchoDecoder(huffmanCodec)) diff --git a/protocol/osrs-232/src/main/kotlin/net/rsprox/protocol/v232/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt b/protocol/osrs-232/src/main/kotlin/net/rsprox/protocol/v232/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt similarity index 77% rename from protocol/osrs-232/src/main/kotlin/net/rsprox/protocol/v232/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt rename to protocol/osrs-232/src/main/kotlin/net/rsprox/protocol/v232/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt index 79abb9df6..fab6b133d 100644 --- a/protocol/osrs-232/src/main/kotlin/net/rsprox/protocol/v232/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotDecoder.kt +++ b/protocol/osrs-232/src/main/kotlin/net/rsprox/protocol/v232/game/outgoing/decoder/codec/misc/player/UpdateStockMarketSlotV1Decoder.kt @@ -4,24 +4,24 @@ 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.game.outgoing.model.misc.player.UpdateStockMarketSlotV1 import net.rsprox.protocol.session.Session import net.rsprox.protocol.v232.game.outgoing.decoder.prot.GameServerProt @Consistent -internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT +internal class UpdateStockMarketSlotV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateStockMarketSlot { + ): UpdateStockMarketSlotV1 { val slot = buffer.g1() return when (val status = buffer.g1()) { 0 -> { - UpdateStockMarketSlot( + UpdateStockMarketSlotV1( slot, - UpdateStockMarketSlot.ResetStockMarketSlot, + UpdateStockMarketSlotV1.ResetStockMarketSlot, ) } else -> { @@ -30,9 +30,9 @@ internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST +internal class UpdateTradingPostV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateTradingPost { + ): UpdateTradingPostV1 { val reset = buffer.g1() == 0 if (reset) { - return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + return UpdateTradingPostV1(UpdateTradingPostV1.ResetTradingPost) } val age = buffer.g8() val obj = buffer.g2() @@ -34,7 +34,7 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder val price = buffer.g4() val count = buffer.g4() add( - UpdateTradingPost.TradingPostOffer( + UpdateTradingPostV1.TradingPostOffer( name, previousName, world, @@ -45,8 +45,8 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder ) } } - return UpdateTradingPost( - UpdateTradingPost.SetTradingPostOfferList( + return UpdateTradingPostV1( + UpdateTradingPostV1.SetTradingPostOfferList( age, obj, status, diff --git a/protocol/osrs-232/src/main/kotlin/net/rsprox/protocol/v232/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt b/protocol/osrs-232/src/main/kotlin/net/rsprox/protocol/v232/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt similarity index 84% rename from protocol/osrs-232/src/main/kotlin/net/rsprox/protocol/v232/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt rename to protocol/osrs-232/src/main/kotlin/net/rsprox/protocol/v232/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt index 5484bb4d2..1f9f05ab0 100644 --- a/protocol/osrs-232/src/main/kotlin/net/rsprox/protocol/v232/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt +++ b/protocol/osrs-232/src/main/kotlin/net/rsprox/protocol/v232/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt @@ -4,17 +4,17 @@ 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.specific.ObjCustomiseSpecific +import net.rsprox.protocol.game.outgoing.model.specific.ObjCustomiseSpecificV1 import net.rsprox.protocol.session.Session import net.rsprox.protocol.v232.game.outgoing.decoder.prot.GameServerProt -internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC +internal class ObjCustomiseSpecificV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): ObjCustomiseSpecific { + ): ObjCustomiseSpecificV1 { val recol = buffer.g2sAlt2() val retexIndex = buffer.g2s() val coordGrid = CoordGrid(buffer.g4()) @@ -23,7 +23,7 @@ internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT +internal class UpdateStockMarketSlotV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateStockMarketSlot { + ): UpdateStockMarketSlotV1 { val slot = buffer.g1() return when (val status = buffer.g1()) { 0 -> { - UpdateStockMarketSlot( + UpdateStockMarketSlotV1( slot, - UpdateStockMarketSlot.ResetStockMarketSlot, + UpdateStockMarketSlotV1.ResetStockMarketSlot, ) } else -> { @@ -30,9 +30,9 @@ internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST +internal class UpdateTradingPostV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateTradingPost { + ): UpdateTradingPostV1 { val reset = buffer.g1() == 0 if (reset) { - return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + return UpdateTradingPostV1(UpdateTradingPostV1.ResetTradingPost) } val age = buffer.g8() val obj = buffer.g2() @@ -34,7 +34,7 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder val price = buffer.g4() val count = buffer.g4() add( - UpdateTradingPost.TradingPostOffer( + UpdateTradingPostV1.TradingPostOffer( name, previousName, world, @@ -45,8 +45,8 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder ) } } - return UpdateTradingPost( - UpdateTradingPost.SetTradingPostOfferList( + return UpdateTradingPostV1( + UpdateTradingPostV1.SetTradingPostOfferList( age, obj, status, diff --git a/protocol/osrs-233/src/main/kotlin/net/rsprox/protocol/v233/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt b/protocol/osrs-233/src/main/kotlin/net/rsprox/protocol/v233/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt similarity index 84% rename from protocol/osrs-233/src/main/kotlin/net/rsprox/protocol/v233/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt rename to protocol/osrs-233/src/main/kotlin/net/rsprox/protocol/v233/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt index 0006f31f1..adfb9d08b 100644 --- a/protocol/osrs-233/src/main/kotlin/net/rsprox/protocol/v233/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt +++ b/protocol/osrs-233/src/main/kotlin/net/rsprox/protocol/v233/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt @@ -4,17 +4,17 @@ 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.specific.ObjCustomiseSpecific +import net.rsprox.protocol.game.outgoing.model.specific.ObjCustomiseSpecificV1 import net.rsprox.protocol.session.Session import net.rsprox.protocol.v233.game.outgoing.decoder.prot.GameServerProt -internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC +internal class ObjCustomiseSpecificV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): ObjCustomiseSpecific { + ): ObjCustomiseSpecificV1 { val recolIndex = buffer.g2s() val retexIndex = buffer.g2sAlt2() val model = buffer.g2Alt3() @@ -23,7 +23,7 @@ internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT +internal class UpdateStockMarketSlotV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateStockMarketSlot { + ): UpdateStockMarketSlotV1 { val slot = buffer.g1() return when (val status = buffer.g1()) { 0 -> { - UpdateStockMarketSlot( + UpdateStockMarketSlotV1( slot, - UpdateStockMarketSlot.ResetStockMarketSlot, + UpdateStockMarketSlotV1.ResetStockMarketSlot, ) } else -> { @@ -30,9 +30,9 @@ internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST +internal class UpdateTradingPostV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateTradingPost { + ): UpdateTradingPostV1 { val reset = buffer.g1() == 0 if (reset) { - return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + return UpdateTradingPostV1(UpdateTradingPostV1.ResetTradingPost) } val age = buffer.g8() val obj = buffer.g2() @@ -34,7 +34,7 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder val price = buffer.g4() val count = buffer.g4() add( - UpdateTradingPost.TradingPostOffer( + UpdateTradingPostV1.TradingPostOffer( name, previousName, world, @@ -45,8 +45,8 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder ) } } - return UpdateTradingPost( - UpdateTradingPost.SetTradingPostOfferList( + return UpdateTradingPostV1( + UpdateTradingPostV1.SetTradingPostOfferList( age, obj, status, diff --git a/protocol/osrs-234/src/main/kotlin/net/rsprox/protocol/v234/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt b/protocol/osrs-234/src/main/kotlin/net/rsprox/protocol/v234/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt similarity index 84% rename from protocol/osrs-234/src/main/kotlin/net/rsprox/protocol/v234/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt rename to protocol/osrs-234/src/main/kotlin/net/rsprox/protocol/v234/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt index 451a377e7..7b7d2957a 100644 --- a/protocol/osrs-234/src/main/kotlin/net/rsprox/protocol/v234/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt +++ b/protocol/osrs-234/src/main/kotlin/net/rsprox/protocol/v234/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt @@ -4,17 +4,17 @@ 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.specific.ObjCustomiseSpecific +import net.rsprox.protocol.game.outgoing.model.specific.ObjCustomiseSpecificV1 import net.rsprox.protocol.session.Session import net.rsprox.protocol.v234.game.outgoing.decoder.prot.GameServerProt -internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC +internal class ObjCustomiseSpecificV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): ObjCustomiseSpecific { + ): ObjCustomiseSpecificV1 { val id = buffer.g2Alt2() val model = buffer.g2Alt1() val recol = buffer.g2sAlt2() @@ -23,7 +23,7 @@ internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT +internal class UpdateStockMarketSlotV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateStockMarketSlot { + ): UpdateStockMarketSlotV1 { val slot = buffer.g1() return when (val status = buffer.g1()) { 0 -> { - UpdateStockMarketSlot( + UpdateStockMarketSlotV1( slot, - UpdateStockMarketSlot.ResetStockMarketSlot, + UpdateStockMarketSlotV1.ResetStockMarketSlot, ) } else -> { @@ -30,9 +30,9 @@ internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST +internal class UpdateTradingPostV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateTradingPost { + ): UpdateTradingPostV1 { val reset = buffer.g1() == 0 if (reset) { - return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + return UpdateTradingPostV1(UpdateTradingPostV1.ResetTradingPost) } val age = buffer.g8() val obj = buffer.g2() @@ -34,7 +34,7 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder val price = buffer.g4() val count = buffer.g4() add( - UpdateTradingPost.TradingPostOffer( + UpdateTradingPostV1.TradingPostOffer( name, previousName, world, @@ -45,8 +45,8 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder ) } } - return UpdateTradingPost( - UpdateTradingPost.SetTradingPostOfferList( + return UpdateTradingPostV1( + UpdateTradingPostV1.SetTradingPostOfferList( age, obj, status, diff --git a/protocol/osrs-235/src/main/kotlin/net/rsprox/protocol/v235/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt b/protocol/osrs-235/src/main/kotlin/net/rsprox/protocol/v235/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt similarity index 84% rename from protocol/osrs-235/src/main/kotlin/net/rsprox/protocol/v235/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt rename to protocol/osrs-235/src/main/kotlin/net/rsprox/protocol/v235/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt index 9edf58979..b99da6740 100644 --- a/protocol/osrs-235/src/main/kotlin/net/rsprox/protocol/v235/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt +++ b/protocol/osrs-235/src/main/kotlin/net/rsprox/protocol/v235/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt @@ -4,17 +4,17 @@ 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.specific.ObjCustomiseSpecific +import net.rsprox.protocol.game.outgoing.model.specific.ObjCustomiseSpecificV1 import net.rsprox.protocol.session.Session import net.rsprox.protocol.v235.game.outgoing.decoder.prot.GameServerProt -internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC +internal class ObjCustomiseSpecificV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): ObjCustomiseSpecific { + ): ObjCustomiseSpecificV1 { val model = buffer.g2Alt2() val quantity = buffer.g4Alt3() val coordGrid = CoordGrid(buffer.g4Alt2()) @@ -23,7 +23,7 @@ internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT +internal class UpdateStockMarketSlotV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateStockMarketSlot { + ): UpdateStockMarketSlotV1 { val slot = buffer.g1() return when (val status = buffer.g1()) { 0 -> { - UpdateStockMarketSlot( + UpdateStockMarketSlotV1( slot, - UpdateStockMarketSlot.ResetStockMarketSlot, + UpdateStockMarketSlotV1.ResetStockMarketSlot, ) } else -> { @@ -30,9 +30,9 @@ internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST +internal class UpdateTradingPostV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateTradingPost { + ): UpdateTradingPostV1 { val reset = buffer.g1() == 0 if (reset) { - return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + return UpdateTradingPostV1(UpdateTradingPostV1.ResetTradingPost) } val age = buffer.g8() val obj = buffer.g2() @@ -34,7 +34,7 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder val price = buffer.g4() val count = buffer.g4() add( - UpdateTradingPost.TradingPostOffer( + UpdateTradingPostV1.TradingPostOffer( name, previousName, world, @@ -45,8 +45,8 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder ) } } - return UpdateTradingPost( - UpdateTradingPost.SetTradingPostOfferList( + return UpdateTradingPostV1( + UpdateTradingPostV1.SetTradingPostOfferList( age, obj, status, diff --git a/protocol/osrs-236/src/main/kotlin/net/rsprox/protocol/v236/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt b/protocol/osrs-236/src/main/kotlin/net/rsprox/protocol/v236/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt similarity index 84% rename from protocol/osrs-236/src/main/kotlin/net/rsprox/protocol/v236/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt rename to protocol/osrs-236/src/main/kotlin/net/rsprox/protocol/v236/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt index 7ddb271d2..b93c8d3eb 100644 --- a/protocol/osrs-236/src/main/kotlin/net/rsprox/protocol/v236/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt +++ b/protocol/osrs-236/src/main/kotlin/net/rsprox/protocol/v236/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt @@ -4,17 +4,17 @@ 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.specific.ObjCustomiseSpecific +import net.rsprox.protocol.game.outgoing.model.specific.ObjCustomiseSpecificV1 import net.rsprox.protocol.session.Session import net.rsprox.protocol.v236.game.outgoing.decoder.prot.GameServerProt -internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC +internal class ObjCustomiseSpecificV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): ObjCustomiseSpecific { + ): ObjCustomiseSpecificV1 { val retexIndex = buffer.g2sAlt3() val retex = buffer.g2sAlt3() val id = buffer.g2Alt3() @@ -23,7 +23,7 @@ internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT +internal class UpdateStockMarketSlotV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateStockMarketSlot { + ): UpdateStockMarketSlotV1 { val slot = buffer.g1() return when (val status = buffer.g1()) { 0 -> { - UpdateStockMarketSlot( + UpdateStockMarketSlotV1( slot, - UpdateStockMarketSlot.ResetStockMarketSlot, + UpdateStockMarketSlotV1.ResetStockMarketSlot, ) } else -> { @@ -30,9 +30,9 @@ internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST +internal class UpdateTradingPostV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateTradingPost { + ): UpdateTradingPostV1 { val reset = buffer.g1() == 0 if (reset) { - return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + return UpdateTradingPostV1(UpdateTradingPostV1.ResetTradingPost) } val age = buffer.g8() val obj = buffer.g2() @@ -34,7 +34,7 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder val price = buffer.g4() val count = buffer.g4() add( - UpdateTradingPost.TradingPostOffer( + UpdateTradingPostV1.TradingPostOffer( name, previousName, world, @@ -45,8 +45,8 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder ) } } - return UpdateTradingPost( - UpdateTradingPost.SetTradingPostOfferList( + return UpdateTradingPostV1( + UpdateTradingPostV1.SetTradingPostOfferList( age, obj, status, diff --git a/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt b/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt similarity index 84% rename from protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt rename to protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt index bbbb29707..309910cc5 100644 --- a/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt +++ b/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt @@ -4,17 +4,17 @@ 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.specific.ObjCustomiseSpecific +import net.rsprox.protocol.game.outgoing.model.specific.ObjCustomiseSpecificV1 import net.rsprox.protocol.session.Session import net.rsprox.protocol.v237.game.outgoing.decoder.prot.GameServerProt -internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC +internal class ObjCustomiseSpecificV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): ObjCustomiseSpecific { + ): ObjCustomiseSpecificV1 { val recolIndex = buffer.g2sAlt3() val quantity = buffer.g4Alt3() val retexIndex = buffer.g2s() @@ -23,7 +23,7 @@ internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT +internal class UpdateStockMarketSlotV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateStockMarketSlot { + ): UpdateStockMarketSlotV1 { val slot = buffer.g1() return when (val status = buffer.g1()) { 0 -> { - UpdateStockMarketSlot( + UpdateStockMarketSlotV1( slot, - UpdateStockMarketSlot.ResetStockMarketSlot, + UpdateStockMarketSlotV1.ResetStockMarketSlot, ) } else -> { @@ -30,9 +30,9 @@ internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST +internal class UpdateTradingPostV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateTradingPost { + ): UpdateTradingPostV1 { val reset = buffer.g1() == 0 if (reset) { - return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + return UpdateTradingPostV1(UpdateTradingPostV1.ResetTradingPost) } val age = buffer.g8() val obj = buffer.g2() @@ -34,7 +34,7 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder val price = buffer.g4() val count = buffer.g4() add( - UpdateTradingPost.TradingPostOffer( + UpdateTradingPostV1.TradingPostOffer( name, previousName, world, @@ -45,8 +45,8 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder ) } } - return UpdateTradingPost( - UpdateTradingPost.SetTradingPostOfferList( + return UpdateTradingPostV1( + UpdateTradingPostV1.SetTradingPostOfferList( age, obj, status, diff --git a/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt b/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt similarity index 84% rename from protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt rename to protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt index 5e417bb15..5724002b3 100644 --- a/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt +++ b/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt @@ -4,17 +4,17 @@ 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.specific.ObjCustomiseSpecific +import net.rsprox.protocol.game.outgoing.model.specific.ObjCustomiseSpecificV1 import net.rsprox.protocol.session.Session import net.rsprox.protocol.v238.game.outgoing.decoder.prot.GameServerProt -internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC +internal class ObjCustomiseSpecificV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): ObjCustomiseSpecific { + ): ObjCustomiseSpecificV1 { val recolIndex = buffer.g2sAlt3() val recol = buffer.g2s() val coordGrid = CoordGrid(buffer.g4()) @@ -23,7 +23,7 @@ internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT +internal class UpdateStockMarketSlotV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateStockMarketSlot { + ): UpdateStockMarketSlotV1 { val slot = buffer.g1() return when (val status = buffer.g1()) { 0 -> { - UpdateStockMarketSlot( + UpdateStockMarketSlotV1( slot, - UpdateStockMarketSlot.ResetStockMarketSlot, + UpdateStockMarketSlotV1.ResetStockMarketSlot, ) } else -> { @@ -30,9 +30,9 @@ internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST +internal class UpdateTradingPostV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateTradingPost { + ): UpdateTradingPostV1 { val reset = buffer.g1() == 0 if (reset) { - return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + return UpdateTradingPostV1(UpdateTradingPostV1.ResetTradingPost) } val age = buffer.g8() val obj = buffer.g2() @@ -34,7 +34,7 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder val price = buffer.g4() val count = buffer.g4() add( - UpdateTradingPost.TradingPostOffer( + UpdateTradingPostV1.TradingPostOffer( name, previousName, world, @@ -45,8 +45,8 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder ) } } - return UpdateTradingPost( - UpdateTradingPost.SetTradingPostOfferList( + return UpdateTradingPostV1( + UpdateTradingPostV1.SetTradingPostOfferList( age, obj, status, diff --git a/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt b/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt similarity index 84% rename from protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt rename to protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt index 992ca0124..442ad3c0d 100644 --- a/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt +++ b/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt @@ -4,17 +4,17 @@ 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.specific.ObjCustomiseSpecific +import net.rsprox.protocol.game.outgoing.model.specific.ObjCustomiseSpecificV1 import net.rsprox.protocol.session.Session import net.rsprox.protocol.v239.game.outgoing.decoder.prot.GameServerProt -internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC +internal class ObjCustomiseSpecificV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): ObjCustomiseSpecific { + ): ObjCustomiseSpecificV1 { val model = buffer.g2Alt2() val retex = buffer.g2s() val retexIndex = buffer.g2sAlt2() @@ -23,7 +23,7 @@ internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT +internal class UpdateStockMarketSlotV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateStockMarketSlot { + ): UpdateStockMarketSlotV1 { val slot = buffer.g1() return when (val status = buffer.g1()) { 0 -> { - UpdateStockMarketSlot( + UpdateStockMarketSlotV1( slot, - UpdateStockMarketSlot.ResetStockMarketSlot, + UpdateStockMarketSlotV1.ResetStockMarketSlot, ) } else -> { @@ -30,9 +30,9 @@ internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST +internal class UpdateTradingPostV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateTradingPost { + ): UpdateTradingPostV1 { val reset = buffer.g1() == 0 if (reset) { - return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + return UpdateTradingPostV1(UpdateTradingPostV1.ResetTradingPost) } val age = buffer.g8() val obj = buffer.g2() @@ -34,7 +34,7 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder val price = buffer.g4() val count = buffer.g4() add( - UpdateTradingPost.TradingPostOffer( + UpdateTradingPostV1.TradingPostOffer( name, previousName, world, @@ -45,8 +45,8 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder ) } } - return UpdateTradingPost( - UpdateTradingPost.SetTradingPostOfferList( + return UpdateTradingPostV1( + UpdateTradingPostV1.SetTradingPostOfferList( age, obj, status, diff --git a/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt b/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt similarity index 84% rename from protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt rename to protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt index 8ff661f1c..a19dc052e 100644 --- a/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt +++ b/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt @@ -4,17 +4,17 @@ 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.specific.ObjCustomiseSpecific +import net.rsprox.protocol.game.outgoing.model.specific.ObjCustomiseSpecificV1 import net.rsprox.protocol.session.Session import net.rsprox.protocol.v240.game.outgoing.decoder.prot.GameServerProt -internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC +internal class ObjCustomiseSpecificV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): ObjCustomiseSpecific { + ): ObjCustomiseSpecificV1 { val coordGrid = CoordGrid(buffer.g4Alt3()) val recolIndex = buffer.g2sAlt1() val model = buffer.g2Alt3() @@ -23,7 +23,7 @@ internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT +internal class UpdateStockMarketSlotV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateStockMarketSlot { + ): UpdateStockMarketSlotV1 { val slot = buffer.g1() return when (val status = buffer.g1()) { 0 -> { - UpdateStockMarketSlot( + UpdateStockMarketSlotV1( slot, - UpdateStockMarketSlot.ResetStockMarketSlot, + UpdateStockMarketSlotV1.ResetStockMarketSlot, ) } else -> { @@ -30,9 +30,9 @@ internal class UpdateStockMarketSlotDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST +internal class UpdateTradingPostV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.UPDATE_TRADINGPOST_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): UpdateTradingPost { + ): UpdateTradingPostV1 { val reset = buffer.g1() == 0 if (reset) { - return UpdateTradingPost(UpdateTradingPost.ResetTradingPost) + return UpdateTradingPostV1(UpdateTradingPostV1.ResetTradingPost) } val age = buffer.g8() val obj = buffer.g2() @@ -34,7 +34,7 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder val price = buffer.g4() val count = buffer.g4() add( - UpdateTradingPost.TradingPostOffer( + UpdateTradingPostV1.TradingPostOffer( name, previousName, world, @@ -45,8 +45,8 @@ internal class UpdateTradingPostDecoder : ProxyMessageDecoder ) } } - return UpdateTradingPost( - UpdateTradingPost.SetTradingPostOfferList( + return UpdateTradingPostV1( + UpdateTradingPostV1.SetTradingPostOfferList( age, obj, status, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt similarity index 84% rename from protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt rename to protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt index a71c9c65a..60bcf1194 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/specific/ObjCustomiseSpecificV1Decoder.kt @@ -4,17 +4,17 @@ 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.specific.ObjCustomiseSpecific +import net.rsprox.protocol.game.outgoing.model.specific.ObjCustomiseSpecificV1 import net.rsprox.protocol.session.Session import net.rsprox.protocol.v241.game.outgoing.decoder.prot.GameServerProt -internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC +internal class ObjCustomiseSpecificV1Decoder : ProxyMessageDecoder { + override val prot: ClientProt = GameServerProt.OBJ_CUSTOMISE_SPECIFIC_V1 override fun decode( buffer: JagByteBuf, session: Session, - ): ObjCustomiseSpecific { + ): ObjCustomiseSpecificV1 { val id = buffer.g2Alt1() val coordGrid = CoordGrid(buffer.g4Alt1()) val quantity = buffer.g4Alt3() @@ -23,7 +23,7 @@ internal class ObjCustomiseSpecificDecoder : ProxyMessageDecoder pass(message, Transcriber::objUncustomiseSpecific) GameServerProt.OBJ_COUNT_SPECIFIC -> pass(message, Transcriber::objCountSpecific) GameServerProt.OBJ_CUSTOMISE_SPECIFIC_V2 -> pass(message, Transcriber::objCustomiseSpecificV2) - GameServerProt.OBJ_CUSTOMISE_SPECIFIC -> pass(message, Transcriber::objUncustomiseSpecific) + GameServerProt.OBJ_CUSTOMISE_SPECIFIC_V1 -> pass(message, Transcriber::objCustomiseSpecificV1) GameServerProt.PLAYER_INFO -> pass(message, Transcriber::playerInfo) GameServerProt.NPC_INFO_SMALL_V6 -> pass(message, Transcriber::npcInfoV6) GameServerProt.NPC_INFO_LARGE_V6 -> pass(message, Transcriber::npcInfoV6) @@ -220,8 +220,8 @@ public class TranscriberPlugin( GameServerProt.MESSAGE_GAME -> pass(message, Transcriber::messageGame) GameServerProt.CHAT_FILTER_SETTINGS -> pass(message, Transcriber::chatFilterSettings) GameServerProt.CHAT_FILTER_SETTINGS_PRIVATECHAT -> pass(message, Transcriber::chatFilterSettingsPrivateChat) - GameServerProt.UPDATE_TRADINGPOST -> pass(message, Transcriber::updateTradingPost) - GameServerProt.UPDATE_STOCKMARKET_SLOT -> pass(message, Transcriber::updateStockMarketSlot) + GameServerProt.UPDATE_TRADINGPOST_V1 -> pass(message, Transcriber::updateTradingPostV1) + GameServerProt.UPDATE_STOCKMARKET_SLOT_V1 -> pass(message, Transcriber::updateStockMarketSlotV1) GameServerProt.HINT_ARROW -> pass(message, Transcriber::hintArrow) GameServerProt.RESET_ANIMS -> pass(message, Transcriber::resetAnims) GameServerProt.UPDATE_REBOOT_TIMER_V1 -> pass(message, Transcriber::updateRebootTimerV1) 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 7fa016ede..3ea341c36 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/indexer/IndexerTranscriber.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/indexer/IndexerTranscriber.kt @@ -133,9 +133,9 @@ import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateRunEnergy import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateRunWeight import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStatV1 import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStatV2 -import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStockMarketSlot +import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStockMarketSlotV1 import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStockMarketSlotV2 -import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateTradingPost +import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateTradingPostV1 import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateTradingPostV2 import net.rsprox.protocol.game.outgoing.model.social.FriendListLoaded import net.rsprox.protocol.game.outgoing.model.social.MessagePrivateEcho @@ -1093,13 +1093,13 @@ public class IndexerTranscriber( override fun updateStatV1(message: UpdateStatV1) { } - override fun updateStockMarketSlot(message: UpdateStockMarketSlot) { + override fun updateStockMarketSlotV1(message: UpdateStockMarketSlotV1) { } override fun accountFlags(message: AccountFlags) { } - override fun updateTradingPost(message: UpdateTradingPost) { + override fun updateTradingPostV1(message: UpdateTradingPostV1) { } override fun friendListLoaded(message: FriendListLoaded) { @@ -1394,7 +1394,7 @@ public class IndexerTranscriber( binaryIndex.increment(IndexedType.OBJ, message.id) } - override fun objCustomiseSpecific(message: ObjCustomiseSpecific) { + override fun objCustomiseSpecificV1(message: ObjCustomiseSpecificV1) { binaryIndex.increment(IndexedType.OBJ, 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 d8ab382bf..07ce7853b 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/interfaces/ServerPacketTranscriber.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/interfaces/ServerPacketTranscriber.kt @@ -44,9 +44,9 @@ import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateRunEnergy import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateRunWeight import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStatV1 import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStatV2 -import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStockMarketSlot +import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStockMarketSlotV1 import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStockMarketSlotV2 -import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateTradingPost +import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateTradingPostV1 import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateTradingPostV2 import net.rsprox.protocol.game.outgoing.model.social.FriendListLoaded import net.rsprox.protocol.game.outgoing.model.social.MessagePrivate @@ -337,11 +337,11 @@ public interface ServerPacketTranscriber { public fun updateStatV1(message: UpdateStatV1) - public fun updateStockMarketSlot(message: UpdateStockMarketSlot) + public fun updateStockMarketSlotV1(message: UpdateStockMarketSlotV1) public fun accountFlags(message: AccountFlags) - public fun updateTradingPost(message: UpdateTradingPost) + public fun updateTradingPostV1(message: UpdateTradingPostV1) public fun friendListLoaded(message: FriendListLoaded) @@ -395,7 +395,7 @@ public interface ServerPacketTranscriber { public fun objCountSpecific(message: ObjCountSpecific) - public fun objCustomiseSpecific(message: ObjCustomiseSpecific) + public fun objCustomiseSpecificV1(message: ObjCustomiseSpecificV1) public fun projAnimSpecificV2(message: ProjAnimSpecificV2) 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 2593eaf7a..e89348148 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/prot/GameServerProt.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/prot/GameServerProt.kt @@ -82,7 +82,7 @@ public enum class GameServerProt : Prot { OBJ_ENABLED_OPS_SPECIFIC, OBJ_UNCUSTOMISE_SPECIFIC, OBJ_COUNT_SPECIFIC, - OBJ_CUSTOMISE_SPECIFIC, + OBJ_CUSTOMISE_SPECIFIC_V1, OBJ_CUSTOMISE_SPECIFIC_V2, // Info packets @@ -209,8 +209,8 @@ public enum class GameServerProt : Prot { MESSAGE_GAME, CHAT_FILTER_SETTINGS, CHAT_FILTER_SETTINGS_PRIVATECHAT, - UPDATE_TRADINGPOST, - UPDATE_STOCKMARKET_SLOT, + UPDATE_TRADINGPOST_V1, + UPDATE_STOCKMARKET_SLOT_V1, ACCOUNT_FLAGS, // Misc. client state packets 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 86c06b6db..12e1b99e3 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextServerPacketTranscriber.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextServerPacketTranscriber.kt @@ -76,9 +76,9 @@ import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateRunEnergy import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateRunWeight import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStatV1 import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStatV2 -import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStockMarketSlot +import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStockMarketSlotV1 import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateStockMarketSlotV2 -import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateTradingPost +import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateTradingPostV1 import net.rsprox.protocol.game.outgoing.model.misc.player.UpdateTradingPostV2 import net.rsprox.protocol.game.outgoing.model.social.FriendListLoaded import net.rsprox.protocol.game.outgoing.model.social.MessagePrivate @@ -2698,12 +2698,12 @@ public class TextServerPacketTranscriber( root.formattedInt("experience", message.experience - (oldXp ?: 0)) } - override fun updateStockMarketSlot(message: UpdateStockMarketSlot) { + override fun updateStockMarketSlotV1(message: UpdateStockMarketSlotV1) { if (!filters[PropertyFilter.UPDATE_STOCKMARKET_SLOT]) return omit() root.int("slot", message.slot) when (val update = message.update) { - UpdateStockMarketSlot.ResetStockMarketSlot -> {} - is UpdateStockMarketSlot.SetStockMarketSlot -> { + UpdateStockMarketSlotV1.ResetStockMarketSlot -> {} + is UpdateStockMarketSlotV1.SetStockMarketSlot -> { root.int("status", update.status) root.scriptVarType("id", ScriptVarType.OBJ, update.obj) root.formattedInt("price", update.price) @@ -2719,11 +2719,11 @@ public class TextServerPacketTranscriber( root.long("flags", message.flags) } - override fun updateTradingPost(message: UpdateTradingPost) { + override fun updateTradingPostV1(message: UpdateTradingPostV1) { if (!filters[PropertyFilter.DEPRECATED_SERVER]) return omit() when (val update = message.updateType) { - UpdateTradingPost.ResetTradingPost -> {} - is UpdateTradingPost.SetTradingPostOfferList -> { + UpdateTradingPostV1.ResetTradingPost -> {} + is UpdateTradingPostV1.SetTradingPostOfferList -> { root.long("age", update.age) root.scriptVarType("id", ScriptVarType.OBJ, update.obj) root.boolean("status", update.status) @@ -3881,7 +3881,7 @@ public class TextServerPacketTranscriber( root.coordGrid(message.coordGrid) } - override fun objCustomiseSpecific(message: ObjCustomiseSpecific) { + override fun objCustomiseSpecificV1(message: ObjCustomiseSpecificV1) { if (!filters[PropertyFilter.OBJ_CUSTOMISE]) return omit() root.scriptVarType("id", ScriptVarType.OBJ, message.id.maxUShortToMinusOne()) root.int("count", message.quantity) From 258b7b39b3e4508b2722ec700d16d228399f8644 Mon Sep 17 00:00:00 2001 From: Kris Date: Mon, 21 Sep 2026 00:56:34 +0300 Subject: [PATCH 5/7] refactor: rename resume_p_longdialog --- ...ialogLongDecoder.kt => ResumePLongDialogDecoder.kt} | 10 +++++----- .../decoder/prot/ClientMessageDecoderRepository.kt | 4 ++-- .../v237/game/incoming/decoder/prot/GameClientProt.kt | 2 +- .../game/incoming/decoder/prot/GameClientProtId.kt | 2 +- ...ialogLongDecoder.kt => ResumePLongDialogDecoder.kt} | 10 +++++----- .../decoder/prot/ClientMessageDecoderRepository.kt | 4 ++-- .../v238/game/incoming/decoder/prot/GameClientProt.kt | 2 +- .../game/incoming/decoder/prot/GameClientProtId.kt | 2 +- ...ialogLongDecoder.kt => ResumePLongDialogDecoder.kt} | 10 +++++----- .../decoder/prot/ClientMessageDecoderRepository.kt | 4 ++-- .../v239/game/incoming/decoder/prot/GameClientProt.kt | 2 +- .../game/incoming/decoder/prot/GameClientProtId.kt | 2 +- ...ialogLongDecoder.kt => ResumePLongDialogDecoder.kt} | 10 +++++----- .../decoder/prot/ClientMessageDecoderRepository.kt | 4 ++-- .../v240/game/incoming/decoder/prot/GameClientProt.kt | 2 +- .../game/incoming/decoder/prot/GameClientProtId.kt | 2 +- ...ialogLongDecoder.kt => ResumePLongDialogDecoder.kt} | 10 +++++----- .../decoder/prot/ClientMessageDecoderRepository.kt | 4 ++-- .../v241/game/incoming/decoder/prot/GameClientProt.kt | 2 +- .../game/incoming/decoder/prot/GameClientProtId.kt | 2 +- ...{ResumePCountDialogLong.kt => ResumePLongDialog.kt} | 6 +++--- .../kotlin/net/rsprox/transcriber/TranscriberPlugin.kt | 2 +- .../rsprox/transcriber/indexer/IndexerTranscriber.kt | 4 ++-- .../transcriber/interfaces/ClientPacketTranscriber.kt | 4 ++-- .../net/rsprox/transcriber/prot/GameClientProt.kt | 2 +- .../transcriber/text/TextClientPacketTranscriber.kt | 4 ++-- 26 files changed, 56 insertions(+), 56 deletions(-) rename protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/incoming/decoder/codec/resumed/{ResumePCountDialogLongDecoder.kt => ResumePLongDialogDecoder.kt} (60%) rename protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/incoming/decoder/codec/resumed/{ResumePCountDialogLongDecoder.kt => ResumePLongDialogDecoder.kt} (60%) rename protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/incoming/decoder/codec/resumed/{ResumePCountDialogLongDecoder.kt => ResumePLongDialogDecoder.kt} (60%) rename protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/incoming/decoder/codec/resumed/{ResumePCountDialogLongDecoder.kt => ResumePLongDialogDecoder.kt} (60%) rename protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/{ResumePCountDialogLongDecoder.kt => ResumePLongDialogDecoder.kt} (60%) rename protocol/src/main/kotlin/net/rsprox/protocol/game/incoming/model/resumed/{ResumePCountDialogLong.kt => ResumePLongDialog.kt} (83%) diff --git a/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/incoming/decoder/codec/resumed/ResumePCountDialogLongDecoder.kt b/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/incoming/decoder/codec/resumed/ResumePLongDialogDecoder.kt similarity index 60% rename from protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/incoming/decoder/codec/resumed/ResumePCountDialogLongDecoder.kt rename to protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/incoming/decoder/codec/resumed/ResumePLongDialogDecoder.kt index c3cb953be..39e3d2a46 100644 --- a/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/incoming/decoder/codec/resumed/ResumePCountDialogLongDecoder.kt +++ b/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/incoming/decoder/codec/resumed/ResumePLongDialogDecoder.kt @@ -4,19 +4,19 @@ 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.ResumePCountDialogLong +import net.rsprox.protocol.game.incoming.model.resumed.ResumePLongDialog import net.rsprox.protocol.session.Session import net.rsprox.protocol.v237.game.incoming.decoder.prot.GameClientProt @Consistent -public class ResumePCountDialogLongDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameClientProt.RESUME_P_COUNTDIALOG_LONG +public class ResumePLongDialogDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.RESUME_P_LONGDIALOG override fun decode( buffer: JagByteBuf, session: Session, - ): ResumePCountDialogLong { + ): ResumePLongDialog { val count = buffer.g8() - return ResumePCountDialogLong(count) + return ResumePLongDialog(count) } } diff --git a/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt b/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt index 2b31b6806..280d80168 100644 --- a/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt +++ b/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt @@ -77,7 +77,7 @@ import net.rsprox.protocol.v237.game.incoming.decoder.codec.players.OpPlayer7Dec import net.rsprox.protocol.v237.game.incoming.decoder.codec.players.OpPlayer8Decoder import net.rsprox.protocol.v237.game.incoming.decoder.codec.players.OpPlayerTDecoder import net.rsprox.protocol.v237.game.incoming.decoder.codec.resumed.ResumePCountDialogDecoder -import net.rsprox.protocol.v237.game.incoming.decoder.codec.resumed.ResumePCountDialogLongDecoder +import net.rsprox.protocol.v237.game.incoming.decoder.codec.resumed.ResumePLongDialogDecoder import net.rsprox.protocol.v237.game.incoming.decoder.codec.resumed.ResumePNameDialogDecoder import net.rsprox.protocol.v237.game.incoming.decoder.codec.resumed.ResumePObjDialogDecoder import net.rsprox.protocol.v237.game.incoming.decoder.codec.resumed.ResumePStringDialogDecoder @@ -179,7 +179,7 @@ internal object ClientMessageDecoderRepository { bind(ResumePNameDialogDecoder()) bind(ResumePStringDialogDecoder()) bind(ResumePCountDialogDecoder()) - bind(ResumePCountDialogLongDecoder()) + bind(ResumePLongDialogDecoder()) bind(ResumePObjDialogDecoder()) bind(FriendChatKickDecoder()) diff --git a/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/incoming/decoder/prot/GameClientProt.kt b/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/incoming/decoder/prot/GameClientProt.kt index b766d1d7b..5406f3904 100644 --- a/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/incoming/decoder/prot/GameClientProt.kt +++ b/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/incoming/decoder/prot/GameClientProt.kt @@ -133,7 +133,7 @@ public enum class GameClientProt( 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_COUNTDIALOG_LONG(GameClientProtId.RESUME_P_COUNTDIALOG_LONG, 8), + RESUME_P_LONGDIALOG(GameClientProtId.RESUME_P_LONGDIALOG, 8), RESUME_P_OBJDIALOG(GameClientProtId.RESUME_P_OBJDIALOG, 2), // Friend chat packets diff --git a/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/incoming/decoder/prot/GameClientProtId.kt b/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/incoming/decoder/prot/GameClientProtId.kt index 8d128d431..61f9aac37 100644 --- a/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/incoming/decoder/prot/GameClientProtId.kt +++ b/protocol/osrs-237/src/main/kotlin/net/rsprox/protocol/v237/game/incoming/decoder/prot/GameClientProtId.kt @@ -38,7 +38,7 @@ internal object GameClientProtId { const val FRIENDCHAT_JOIN_LEAVE = 34 const val OPPLAYER8 = 35 const val OPOBJ1_V2 = 36 - const val RESUME_P_COUNTDIALOG_LONG = 37 + const val RESUME_P_LONGDIALOG = 37 const val OPPLAYER5 = 38 const val IDLE = 39 const val OPWORLDENTITY4 = 40 diff --git a/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/incoming/decoder/codec/resumed/ResumePCountDialogLongDecoder.kt b/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/incoming/decoder/codec/resumed/ResumePLongDialogDecoder.kt similarity index 60% rename from protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/incoming/decoder/codec/resumed/ResumePCountDialogLongDecoder.kt rename to protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/incoming/decoder/codec/resumed/ResumePLongDialogDecoder.kt index 049d2a0b8..28c396a69 100644 --- a/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/incoming/decoder/codec/resumed/ResumePCountDialogLongDecoder.kt +++ b/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/incoming/decoder/codec/resumed/ResumePLongDialogDecoder.kt @@ -4,19 +4,19 @@ 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.ResumePCountDialogLong +import net.rsprox.protocol.game.incoming.model.resumed.ResumePLongDialog import net.rsprox.protocol.session.Session import net.rsprox.protocol.v238.game.incoming.decoder.prot.GameClientProt @Consistent -public class ResumePCountDialogLongDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameClientProt.RESUME_P_COUNTDIALOG_LONG +public class ResumePLongDialogDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.RESUME_P_LONGDIALOG override fun decode( buffer: JagByteBuf, session: Session, - ): ResumePCountDialogLong { + ): ResumePLongDialog { val count = buffer.g8() - return ResumePCountDialogLong(count) + return ResumePLongDialog(count) } } diff --git a/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt b/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt index 5543349a6..ecbf5414a 100644 --- a/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt +++ b/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt @@ -62,7 +62,7 @@ import net.rsprox.protocol.v238.game.incoming.decoder.codec.players.OpPlayer7Dec import net.rsprox.protocol.v238.game.incoming.decoder.codec.players.OpPlayer8Decoder import net.rsprox.protocol.v238.game.incoming.decoder.codec.players.OpPlayerTDecoder import net.rsprox.protocol.v238.game.incoming.decoder.codec.resumed.ResumePCountDialogDecoder -import net.rsprox.protocol.v238.game.incoming.decoder.codec.resumed.ResumePCountDialogLongDecoder +import net.rsprox.protocol.v238.game.incoming.decoder.codec.resumed.ResumePLongDialogDecoder import net.rsprox.protocol.v238.game.incoming.decoder.codec.resumed.ResumePNameDialogDecoder import net.rsprox.protocol.v238.game.incoming.decoder.codec.resumed.ResumePObjDialogDecoder import net.rsprox.protocol.v238.game.incoming.decoder.codec.resumed.ResumePStringDialogDecoder @@ -149,7 +149,7 @@ internal object ClientMessageDecoderRepository { bind(ResumePNameDialogDecoder()) bind(ResumePStringDialogDecoder()) bind(ResumePCountDialogDecoder()) - bind(ResumePCountDialogLongDecoder()) + bind(ResumePLongDialogDecoder()) bind(ResumePObjDialogDecoder()) bind(FriendChatKickDecoder()) diff --git a/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/incoming/decoder/prot/GameClientProt.kt b/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/incoming/decoder/prot/GameClientProt.kt index 55656acf6..ad75fa8b0 100644 --- a/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/incoming/decoder/prot/GameClientProt.kt +++ b/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/incoming/decoder/prot/GameClientProt.kt @@ -111,7 +111,7 @@ public enum class GameClientProt( 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_COUNTDIALOG_LONG(GameClientProtId.RESUME_P_COUNTDIALOG_LONG, 8), + RESUME_P_LONGDIALOG(GameClientProtId.RESUME_P_LONGDIALOG, 8), RESUME_P_OBJDIALOG(GameClientProtId.RESUME_P_OBJDIALOG, 2), // Friend chat packets diff --git a/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/incoming/decoder/prot/GameClientProtId.kt b/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/incoming/decoder/prot/GameClientProtId.kt index 02aa90dd1..6fce71495 100644 --- a/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/incoming/decoder/prot/GameClientProtId.kt +++ b/protocol/osrs-238/src/main/kotlin/net/rsprox/protocol/v238/game/incoming/decoder/prot/GameClientProtId.kt @@ -61,7 +61,7 @@ internal object GameClientProtId { const val FRIENDCHAT_JOIN_LEAVE = 67 const val MESSAGE_PUBLIC = 69 const val OPLOC3_V2 = 70 - const val RESUME_P_COUNTDIALOG_LONG = 72 + const val RESUME_P_LONGDIALOG = 72 const val NO_TIMEOUT = 73 const val OPOBJT = 74 const val SOUND_JINGLEEND = 76 diff --git a/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/incoming/decoder/codec/resumed/ResumePCountDialogLongDecoder.kt b/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/incoming/decoder/codec/resumed/ResumePLongDialogDecoder.kt similarity index 60% rename from protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/incoming/decoder/codec/resumed/ResumePCountDialogLongDecoder.kt rename to protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/incoming/decoder/codec/resumed/ResumePLongDialogDecoder.kt index 4ea15dce2..ba414ec4d 100644 --- a/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/incoming/decoder/codec/resumed/ResumePCountDialogLongDecoder.kt +++ b/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/incoming/decoder/codec/resumed/ResumePLongDialogDecoder.kt @@ -4,19 +4,19 @@ 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.ResumePCountDialogLong +import net.rsprox.protocol.game.incoming.model.resumed.ResumePLongDialog import net.rsprox.protocol.session.Session import net.rsprox.protocol.v239.game.incoming.decoder.prot.GameClientProt @Consistent -public class ResumePCountDialogLongDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameClientProt.RESUME_P_COUNTDIALOG_LONG +public class ResumePLongDialogDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.RESUME_P_LONGDIALOG override fun decode( buffer: JagByteBuf, session: Session, - ): ResumePCountDialogLong { + ): ResumePLongDialog { val count = buffer.g8() - return ResumePCountDialogLong(count) + return ResumePLongDialog(count) } } diff --git a/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt b/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt index 7b4317e51..21c3b96a8 100644 --- a/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt +++ b/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt @@ -62,7 +62,7 @@ import net.rsprox.protocol.v239.game.incoming.decoder.codec.players.OpPlayer7Dec import net.rsprox.protocol.v239.game.incoming.decoder.codec.players.OpPlayer8Decoder import net.rsprox.protocol.v239.game.incoming.decoder.codec.players.OpPlayerTDecoder import net.rsprox.protocol.v239.game.incoming.decoder.codec.resumed.ResumePCountDialogDecoder -import net.rsprox.protocol.v239.game.incoming.decoder.codec.resumed.ResumePCountDialogLongDecoder +import net.rsprox.protocol.v239.game.incoming.decoder.codec.resumed.ResumePLongDialogDecoder import net.rsprox.protocol.v239.game.incoming.decoder.codec.resumed.ResumePNameDialogDecoder import net.rsprox.protocol.v239.game.incoming.decoder.codec.resumed.ResumePObjDialogDecoder import net.rsprox.protocol.v239.game.incoming.decoder.codec.resumed.ResumePStringDialogDecoder @@ -149,7 +149,7 @@ internal object ClientMessageDecoderRepository { bind(ResumePNameDialogDecoder()) bind(ResumePStringDialogDecoder()) bind(ResumePCountDialogDecoder()) - bind(ResumePCountDialogLongDecoder()) + bind(ResumePLongDialogDecoder()) bind(ResumePObjDialogDecoder()) bind(FriendChatKickDecoder()) diff --git a/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/incoming/decoder/prot/GameClientProt.kt b/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/incoming/decoder/prot/GameClientProt.kt index 6ec15d66c..3654d3035 100644 --- a/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/incoming/decoder/prot/GameClientProt.kt +++ b/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/incoming/decoder/prot/GameClientProt.kt @@ -111,7 +111,7 @@ public enum class GameClientProt( 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_COUNTDIALOG_LONG(GameClientProtId.RESUME_P_COUNTDIALOG_LONG, 8), + RESUME_P_LONGDIALOG(GameClientProtId.RESUME_P_LONGDIALOG, 8), RESUME_P_OBJDIALOG(GameClientProtId.RESUME_P_OBJDIALOG, 2), // Friend chat packets diff --git a/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/incoming/decoder/prot/GameClientProtId.kt b/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/incoming/decoder/prot/GameClientProtId.kt index e8c349194..37e14be95 100644 --- a/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/incoming/decoder/prot/GameClientProtId.kt +++ b/protocol/osrs-239/src/main/kotlin/net/rsprox/protocol/v239/game/incoming/decoder/prot/GameClientProtId.kt @@ -55,7 +55,7 @@ internal object GameClientProtId { const val SEND_SNAPSHOT = 60 const val MEMBERSHIP_PROMOTION_ELIGIBILITY = 61 const val OPLOCT = 62 - const val RESUME_P_COUNTDIALOG_LONG = 63 + const val RESUME_P_LONGDIALOG = 63 const val RESUME_P_STRINGDIALOG = 64 const val FRIENDLIST_DEL = 65 const val EVENT_MOUSE_CLICK_V1 = 66 diff --git a/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/incoming/decoder/codec/resumed/ResumePCountDialogLongDecoder.kt b/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/incoming/decoder/codec/resumed/ResumePLongDialogDecoder.kt similarity index 60% rename from protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/incoming/decoder/codec/resumed/ResumePCountDialogLongDecoder.kt rename to protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/incoming/decoder/codec/resumed/ResumePLongDialogDecoder.kt index c6f0f799b..564ad0043 100644 --- a/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/incoming/decoder/codec/resumed/ResumePCountDialogLongDecoder.kt +++ b/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/incoming/decoder/codec/resumed/ResumePLongDialogDecoder.kt @@ -4,19 +4,19 @@ 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.ResumePCountDialogLong +import net.rsprox.protocol.game.incoming.model.resumed.ResumePLongDialog import net.rsprox.protocol.session.Session import net.rsprox.protocol.v240.game.incoming.decoder.prot.GameClientProt @Consistent -public class ResumePCountDialogLongDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameClientProt.RESUME_P_COUNTDIALOG_LONG +public class ResumePLongDialogDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.RESUME_P_LONGDIALOG override fun decode( buffer: JagByteBuf, session: Session, - ): ResumePCountDialogLong { + ): ResumePLongDialog { val count = buffer.g8() - return ResumePCountDialogLong(count) + return ResumePLongDialog(count) } } diff --git a/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt b/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt index 8cae53124..1e415f094 100644 --- a/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt +++ b/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt @@ -62,7 +62,7 @@ import net.rsprox.protocol.v240.game.incoming.decoder.codec.players.OpPlayer7Dec import net.rsprox.protocol.v240.game.incoming.decoder.codec.players.OpPlayer8Decoder import net.rsprox.protocol.v240.game.incoming.decoder.codec.players.OpPlayerTDecoder import net.rsprox.protocol.v240.game.incoming.decoder.codec.resumed.ResumePCountDialogDecoder -import net.rsprox.protocol.v240.game.incoming.decoder.codec.resumed.ResumePCountDialogLongDecoder +import net.rsprox.protocol.v240.game.incoming.decoder.codec.resumed.ResumePLongDialogDecoder import net.rsprox.protocol.v240.game.incoming.decoder.codec.resumed.ResumePNameDialogDecoder import net.rsprox.protocol.v240.game.incoming.decoder.codec.resumed.ResumePObjDialogDecoder import net.rsprox.protocol.v240.game.incoming.decoder.codec.resumed.ResumePStringDialogDecoder @@ -149,7 +149,7 @@ internal object ClientMessageDecoderRepository { bind(ResumePNameDialogDecoder()) bind(ResumePStringDialogDecoder()) bind(ResumePCountDialogDecoder()) - bind(ResumePCountDialogLongDecoder()) + bind(ResumePLongDialogDecoder()) bind(ResumePObjDialogDecoder()) bind(FriendChatKickDecoder()) diff --git a/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/incoming/decoder/prot/GameClientProt.kt b/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/incoming/decoder/prot/GameClientProt.kt index 3b1ff122a..7046cd3f9 100644 --- a/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/incoming/decoder/prot/GameClientProt.kt +++ b/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/incoming/decoder/prot/GameClientProt.kt @@ -111,7 +111,7 @@ public enum class GameClientProt( 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_COUNTDIALOG_LONG(GameClientProtId.RESUME_P_COUNTDIALOG_LONG, 8), + RESUME_P_LONGDIALOG(GameClientProtId.RESUME_P_LONGDIALOG, 8), RESUME_P_OBJDIALOG(GameClientProtId.RESUME_P_OBJDIALOG, 2), // Friend chat packets diff --git a/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/incoming/decoder/prot/GameClientProtId.kt b/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/incoming/decoder/prot/GameClientProtId.kt index 84113ce25..da889b1b8 100644 --- a/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/incoming/decoder/prot/GameClientProtId.kt +++ b/protocol/osrs-240/src/main/kotlin/net/rsprox/protocol/v240/game/incoming/decoder/prot/GameClientProtId.kt @@ -96,7 +96,7 @@ internal object GameClientProtId { const val MESSAGE_PRIVATE = 108 const val SET_HEADING = 109 const val HISCORE_REQUEST = 110 - const val RESUME_P_COUNTDIALOG_LONG = 111 + const val RESUME_P_LONGDIALOG = 111 const val OPOBJ1_V2 = 112 const val OPOBJ2_V2 = 113 const val EVENT_MOUSE_MOVE = 114 diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePCountDialogLongDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePLongDialogDecoder.kt similarity index 60% rename from protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePCountDialogLongDecoder.kt rename to protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePLongDialogDecoder.kt index b34545845..113afa636 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePCountDialogLongDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/resumed/ResumePLongDialogDecoder.kt @@ -4,19 +4,19 @@ 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.ResumePCountDialogLong +import net.rsprox.protocol.game.incoming.model.resumed.ResumePLongDialog import net.rsprox.protocol.session.Session import net.rsprox.protocol.v241.game.incoming.decoder.prot.GameClientProt @Consistent -public class ResumePCountDialogLongDecoder : ProxyMessageDecoder { - override val prot: ClientProt = GameClientProt.RESUME_P_COUNTDIALOG_LONG +public class ResumePLongDialogDecoder : ProxyMessageDecoder { + override val prot: ClientProt = GameClientProt.RESUME_P_LONGDIALOG override fun decode( buffer: JagByteBuf, session: Session, - ): ResumePCountDialogLong { + ): ResumePLongDialog { val count = buffer.g8() - return ResumePCountDialogLong(count) + return ResumePLongDialog(count) } } diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt index 493fc7fc5..670aff04c 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/ClientMessageDecoderRepository.kt @@ -61,7 +61,7 @@ import net.rsprox.protocol.v241.game.incoming.decoder.codec.players.OpPlayer7Dec import net.rsprox.protocol.v241.game.incoming.decoder.codec.players.OpPlayer8Decoder import net.rsprox.protocol.v241.game.incoming.decoder.codec.players.OpPlayerTDecoder import net.rsprox.protocol.v241.game.incoming.decoder.codec.resumed.ResumePCountDialogDecoder -import net.rsprox.protocol.v241.game.incoming.decoder.codec.resumed.ResumePCountDialogLongDecoder +import net.rsprox.protocol.v241.game.incoming.decoder.codec.resumed.ResumePLongDialogDecoder import net.rsprox.protocol.v241.game.incoming.decoder.codec.resumed.ResumePNameDialogDecoder import net.rsprox.protocol.v241.game.incoming.decoder.codec.resumed.ResumePObjDialogDecoder import net.rsprox.protocol.v241.game.incoming.decoder.codec.resumed.ResumePStringDialogDecoder @@ -147,7 +147,7 @@ internal object ClientMessageDecoderRepository { bind(ResumePNameDialogDecoder()) bind(ResumePStringDialogDecoder()) bind(ResumePCountDialogDecoder()) - bind(ResumePCountDialogLongDecoder()) + bind(ResumePLongDialogDecoder()) bind(ResumePObjDialogDecoder()) bind(FriendChatKickDecoder()) diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProt.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProt.kt index 9a50e28ec..0f875855f 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProt.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProt.kt @@ -111,7 +111,7 @@ public enum class GameClientProt( 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_COUNTDIALOG_LONG(GameClientProtId.RESUME_P_COUNTDIALOG_LONG, 8), + RESUME_P_LONGDIALOG(GameClientProtId.RESUME_P_LONGDIALOG, 8), RESUME_P_OBJDIALOG(GameClientProtId.RESUME_P_OBJDIALOG, 2), // Friend chat packets diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProtId.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProtId.kt index f7f856cf0..3f6395cd3 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProtId.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProtId.kt @@ -101,6 +101,6 @@ internal object GameClientProtId { const val OPWORLDENTITYU = -1 const val UPDATE_PLAYER_MODEL_V2 = -1 const val OPNPCU = -1 - const val RESUME_P_COUNTDIALOG_LONG = -1 + const val RESUME_P_LONGDIALOG = -1 const val OPLOCU = -1 } diff --git a/protocol/src/main/kotlin/net/rsprox/protocol/game/incoming/model/resumed/ResumePCountDialogLong.kt b/protocol/src/main/kotlin/net/rsprox/protocol/game/incoming/model/resumed/ResumePLongDialog.kt similarity index 83% rename from protocol/src/main/kotlin/net/rsprox/protocol/game/incoming/model/resumed/ResumePCountDialogLong.kt rename to protocol/src/main/kotlin/net/rsprox/protocol/game/incoming/model/resumed/ResumePLongDialog.kt index 357328039..575bbfbe2 100644 --- a/protocol/src/main/kotlin/net/rsprox/protocol/game/incoming/model/resumed/ResumePCountDialogLong.kt +++ b/protocol/src/main/kotlin/net/rsprox/protocol/game/incoming/model/resumed/ResumePLongDialog.kt @@ -9,7 +9,7 @@ import net.rsprox.protocol.game.incoming.model.GameClientProtCategory * long to the input box. It has no uses as of writing this. * @property count the count entered. */ -public class ResumePCountDialogLong( +public class ResumePLongDialog( public val count: Long, ) : IncomingGameMessage { override val category: ClientProtCategory @@ -19,12 +19,12 @@ public class ResumePCountDialogLong( if (this === other) return true if (javaClass != other?.javaClass) return false - other as ResumePCountDialogLong + other as ResumePLongDialog return count == other.count } override fun hashCode(): Int = count.hashCode() - override fun toString(): String = "ResumePCountDialogLong(count=$count)" + override fun toString(): String = "ResumePLongDialog(count=$count)" } diff --git a/transcriber/src/main/kotlin/net/rsprox/transcriber/TranscriberPlugin.kt b/transcriber/src/main/kotlin/net/rsprox/transcriber/TranscriberPlugin.kt index 02c3bbded..fe9926f9a 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/TranscriberPlugin.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/TranscriberPlugin.kt @@ -343,7 +343,7 @@ public class TranscriberPlugin( GameClientProt.RESUME_P_NAMEDIALOG -> pass(message, Transcriber::resumePNameDialog) GameClientProt.RESUME_P_STRINGDIALOG -> pass(message, Transcriber::resumePStringDialog) GameClientProt.RESUME_P_COUNTDIALOG -> pass(message, Transcriber::resumePCountDialog) - GameClientProt.RESUME_P_COUNTDIALOG_LONG -> pass(message, Transcriber::resumePCountDialogLong) + GameClientProt.RESUME_P_LONGDIALOG -> pass(message, Transcriber::resumePLongDialog) GameClientProt.RESUME_P_OBJDIALOG -> pass(message, Transcriber::resumePObjDialog) GameClientProt.FRIENDCHAT_KICK -> pass(message, Transcriber::friendChatKick) GameClientProt.FRIENDCHAT_SETRANK -> pass(message, Transcriber::friendChatSetRank) 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 3ea341c36..500310b5b 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/indexer/IndexerTranscriber.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/indexer/IndexerTranscriber.kt @@ -46,7 +46,7 @@ import net.rsprox.protocol.game.incoming.model.objs.OpObjV2 import net.rsprox.protocol.game.incoming.model.players.OpPlayer import net.rsprox.protocol.game.incoming.model.players.OpPlayerT import net.rsprox.protocol.game.incoming.model.resumed.ResumePCountDialog -import net.rsprox.protocol.game.incoming.model.resumed.ResumePCountDialogLong +import net.rsprox.protocol.game.incoming.model.resumed.ResumePLongDialog import net.rsprox.protocol.game.incoming.model.resumed.ResumePNameDialog import net.rsprox.protocol.game.incoming.model.resumed.ResumePObjDialog import net.rsprox.protocol.game.incoming.model.resumed.ResumePStringDialog @@ -437,7 +437,7 @@ public class IndexerTranscriber( override fun resumePCountDialog(message: ResumePCountDialog) { } - override fun resumePCountDialogLong(message: ResumePCountDialogLong) { + override fun resumePLongDialog(message: ResumePLongDialog) { } override fun resumePNameDialog(message: ResumePNameDialog) { diff --git a/transcriber/src/main/kotlin/net/rsprox/transcriber/interfaces/ClientPacketTranscriber.kt b/transcriber/src/main/kotlin/net/rsprox/transcriber/interfaces/ClientPacketTranscriber.kt index 3b586e914..c550df0a9 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/interfaces/ClientPacketTranscriber.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/interfaces/ClientPacketTranscriber.kt @@ -42,7 +42,7 @@ import net.rsprox.protocol.game.incoming.model.objs.OpObjV2 import net.rsprox.protocol.game.incoming.model.players.OpPlayer import net.rsprox.protocol.game.incoming.model.players.OpPlayerT import net.rsprox.protocol.game.incoming.model.resumed.ResumePCountDialog -import net.rsprox.protocol.game.incoming.model.resumed.ResumePCountDialogLong +import net.rsprox.protocol.game.incoming.model.resumed.ResumePLongDialog import net.rsprox.protocol.game.incoming.model.resumed.ResumePNameDialog import net.rsprox.protocol.game.incoming.model.resumed.ResumePObjDialog import net.rsprox.protocol.game.incoming.model.resumed.ResumePStringDialog @@ -192,7 +192,7 @@ public interface ClientPacketTranscriber { public fun resumePCountDialog(message: ResumePCountDialog) - public fun resumePCountDialogLong(message: ResumePCountDialogLong) + public fun resumePLongDialog(message: ResumePLongDialog) public fun resumePNameDialog(message: ResumePNameDialog) diff --git a/transcriber/src/main/kotlin/net/rsprox/transcriber/prot/GameClientProt.kt b/transcriber/src/main/kotlin/net/rsprox/transcriber/prot/GameClientProt.kt index 1e1da9eb7..790a761e8 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/prot/GameClientProt.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/prot/GameClientProt.kt @@ -104,7 +104,7 @@ public enum class GameClientProt : Prot { RESUME_P_NAMEDIALOG, RESUME_P_STRINGDIALOG, RESUME_P_COUNTDIALOG, - RESUME_P_COUNTDIALOG_LONG, + RESUME_P_LONGDIALOG, RESUME_P_OBJDIALOG, // Friend chat packets diff --git a/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextClientPacketTranscriber.kt b/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextClientPacketTranscriber.kt index b2a3ba860..714456d3c 100644 --- a/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextClientPacketTranscriber.kt +++ b/transcriber/src/main/kotlin/net/rsprox/transcriber/text/TextClientPacketTranscriber.kt @@ -44,7 +44,7 @@ import net.rsprox.protocol.game.incoming.model.objs.OpObjV2 import net.rsprox.protocol.game.incoming.model.players.OpPlayer import net.rsprox.protocol.game.incoming.model.players.OpPlayerT import net.rsprox.protocol.game.incoming.model.resumed.ResumePCountDialog -import net.rsprox.protocol.game.incoming.model.resumed.ResumePCountDialogLong +import net.rsprox.protocol.game.incoming.model.resumed.ResumePLongDialog import net.rsprox.protocol.game.incoming.model.resumed.ResumePNameDialog import net.rsprox.protocol.game.incoming.model.resumed.ResumePObjDialog import net.rsprox.protocol.game.incoming.model.resumed.ResumePStringDialog @@ -896,7 +896,7 @@ public open class TextClientPacketTranscriber( root.formattedInt("count", message.count) } - override fun resumePCountDialogLong(message: ResumePCountDialogLong) { + override fun resumePLongDialog(message: ResumePLongDialog) { if (!filters[PropertyFilter.RESUME_P_COUNTDIALOG]) return omit() root.formattedLong("count", message.count) } From e29449a2deb4f59f90db26f9b7f4b71533b67bb8 Mon Sep 17 00:00:00 2001 From: Kris Date: Mon, 28 Sep 2026 21:23:08 +0300 Subject: [PATCH 6/7] fix: incorrect packets based on java client --- .../codec/misc/client/SendPingReplyDecoder.kt | 2 +- .../worldentities/OpWorldEntityTDecoder.kt | 6 ++--- .../incoming/decoder/prot/GameClientProtId.kt | 21 ++++++++-------- .../codec/camera/CamLookAtV3Decoder.kt | 2 +- .../interfaces/IfSetRotateSpeedDecoder.kt | 4 +-- .../codec/map/RebuildRegionV2Decoder.kt | 4 +-- .../codec/sound/AmbientSoundStopDecoder.kt | 2 +- .../zone/payload/LocAddChangeV2Decoder.kt | 2 +- .../codec/zone/payload/LocAnimDecoder.kt | 2 +- .../codec/zone/payload/LocMergeDecoder.kt | 25 +++++++++++++++++-- .../codec/zone/payload/MapAnimDecoder.kt | 2 +- .../zone/payload/MapProjAnimV2Decoder.kt | 2 +- .../codec/zone/payload/ObjAddDecoder.kt | 2 +- .../codec/zone/payload/ObjCountDecoder.kt | 2 +- .../zone/payload/ScriptedProjAddDecoder.kt | 12 ++++----- .../zone/payload/ScriptedProjChangeDecoder.kt | 4 +-- .../outgoing/decoder/prot/GameServerProtId.kt | 7 +++--- .../model/info/npcinfo/NpcInfoClient.kt | 15 +++++------ .../model/info/playerinfo/PlayerInfoClient.kt | 9 ++----- 19 files changed, 68 insertions(+), 57 deletions(-) diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt index 10fb33871..69006c66c 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/misc/client/SendPingReplyDecoder.kt @@ -17,7 +17,7 @@ public class SendPingReplyDecoder : ProxyMessageDecoder { val value1 = buffer.g4Alt1() val value2 = buffer.g4Alt3() val fps = buffer.g1Alt3() - val gcPercentTime = buffer.g1() + val gcPercentTime = buffer.g1Alt2() return SendPingReply( fps, gcPercentTime, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntityTDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntityTDecoder.kt index b81091910..b439cea06 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntityTDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/codec/worldentities/OpWorldEntityTDecoder.kt @@ -15,11 +15,11 @@ public class OpWorldEntityTDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): OpWorldEntityT { - val index = buffer.g2Alt3() - val selectedSub = buffer.g2Alt2() val selectedObj = buffer.g2() + val controlKey = buffer.g1() == 1 val selectedCombinedId = buffer.gCombinedId() - val controlKey = buffer.g1Alt3() == 1 + val index = buffer.g2() + val selectedSub = buffer.g2Alt3() return OpWorldEntityT( index, controlKey, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProtId.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProtId.kt index 3f6395cd3..0000173b0 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProtId.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/incoming/decoder/prot/GameClientProtId.kt @@ -11,6 +11,7 @@ internal object GameClientProtId { const val EVENT_MOUSE_CLICK_V1 = 7 const val OPLOCT = 8 const val OPOBJ5_V2 = 9 + const val RESUME_P_LONGDIALOG = 10 const val SEND_PING_REPLY = 11 const val OPPLAYER1 = 12 const val OPWORLDENTITY2 = 13 @@ -22,6 +23,7 @@ internal object GameClientProtId { const val SET_CHATFILTERSETTINGS = 19 const val CONNECTION_TELEMETRY = 20 const val OPWORLDENTITY4 = 21 + const val OPLOCU = 22 const val EVENT_MOUSE_SCROLL = 23 const val OPLOC5_V2 = 24 const val FRIENDCHAT_JOIN_LEAVE = 25 @@ -36,10 +38,12 @@ internal object GameClientProtId { const val EXIT_FREECAM = 34 const val OPPLAYER2 = 35 const val HISCORE_REQUEST = 36 + const val OPNPCU = 37 const val IF_BUTTONX = 38 const val OPLOC6 = 39 const val OPPLAYER8 = 40 const val CLOSE_MODAL = 41 + const val OPPLAYERU = 42 const val EVENT_CAMERA_POSITION = 43 const val OPNPC2_V2 = 44 const val SEND_SNAPSHOT = 45 @@ -52,6 +56,7 @@ internal object GameClientProtId { const val OPNPC6 = 53 const val OPPLAYER5 = 54 const val MOVE_GAMECLICK = 55 + const val REFLECTION_CHECK_REPLY = 56 const val FRIENDCHAT_KICK = 57 const val RESUME_P_STRINGDIALOG = 58 const val AFFINEDCLANSETTINGS_ADDBANNED_FROMCHANNEL = 59 @@ -83,24 +88,18 @@ internal object GameClientProtId { const val IGNORELIST_ADD = 85 const val OPNPC3_V2 = 86 const val EVENT_MOUSE_MOVE = 87 + const val UPDATE_PLAYER_MODEL_V2 = 88 + const val OPWORLDENTITYU = 89 const val OPOBJ6 = 90 + const val OPWORLDENTITYT = 91 const val OPNPC1_V2 = 92 const val RSEVEN_STATUS = 93 const val OPOBJT = 94 const val OPPLAYER7 = 95 + const val OPOBJU = 96 + const val EVENT_APPLET_FOCUS = 97 const val OPOBJ2_V2 = 98 const val MAP_BUILD_COMPLETE = 99 const val OPLOC3_V2 = 100 const val EVENT_KEYBOARD = 101 - - const val OPWORLDENTITYT = -1 - const val REFLECTION_CHECK_REPLY = -1 - const val EVENT_APPLET_FOCUS = -1 - const val OPPLAYERU = -1 - const val OPOBJU = -1 - const val OPWORLDENTITYU = -1 - const val UPDATE_PLAYER_MODEL_V2 = -1 - const val OPNPCU = -1 - const val RESUME_P_LONGDIALOG = -1 - const val OPLOCU = -1 } diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV3Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV3Decoder.kt index a2fa7369e..2903aff6d 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV3Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/camera/CamLookAtV3Decoder.kt @@ -18,7 +18,7 @@ internal class CamLookAtV3Decoder : ProxyMessageDecoder { val x = buffer.g2Alt3() val rate2 = buffer.g1Alt1() val rate = buffer.g1() - val heightRelative = buffer.g1() == 1 + val heightRelative = buffer.g1Alt2() == 1 val z = buffer.g2() return CamLookAtV3( x, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt index 920c7feaa..3a99d7463 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/interfaces/IfSetRotateSpeedDecoder.kt @@ -16,8 +16,8 @@ internal class IfSetRotateSpeedDecoder : ProxyMessageDecoder { session: Session, ): IfSetRotateSpeed { val combinedId = buffer.gCombinedId() - val xSpeed = buffer.g2() - val ySpeed = buffer.g2Alt2() + val ySpeed = buffer.g2() + val xSpeed = buffer.g2Alt2() return IfSetRotateSpeed( combinedId.interfaceId, combinedId.componentId, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/map/RebuildRegionV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/map/RebuildRegionV2Decoder.kt index 39f0041e3..a2d3fdbb2 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/map/RebuildRegionV2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/map/RebuildRegionV2Decoder.kt @@ -18,9 +18,9 @@ internal class RebuildRegionV2Decoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): RebuildRegionV2 { - val zoneZ = buffer.g2() + val zoneX = buffer.g2() val reload = buffer.g1Alt2() == 1 - val zoneX = buffer.g2Alt1() + val zoneZ = buffer.g2Alt1() @Suppress("UnusedVariable", "unused") val distinctMapsquareCount = buffer.g2() diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStopDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStopDecoder.kt index d1721de8e..408399c88 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStopDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/sound/AmbientSoundStopDecoder.kt @@ -14,7 +14,7 @@ internal class AmbientSoundStopDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): AmbientSoundStop { - val fade = buffer.g1Alt2() != 0 + val fade = buffer.g1Alt2() == 1 return AmbientSoundStop( fade, ) diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocAddChangeV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocAddChangeV2Decoder.kt index 2bd9f6f6c..3d7f41496 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocAddChangeV2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocAddChangeV2Decoder.kt @@ -19,7 +19,7 @@ internal class LocAddChangeV2Decoder : ProxyMessageDecoder { ): LocAddChangeV2 { val locProperties = LocProperties(buffer.g1Alt1()) val opFlags = OpFlags(buffer.g1()) - val coordInZone = CoordInZone(buffer.g1()) + val coordInZone = CoordInZone(buffer.g1Alt1()) val opOverrideCount = buffer.g1Alt2() val opOverrides: Map? = if (opOverrideCount > 0) { diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocAnimDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocAnimDecoder.kt index 23006a1a3..a118c9b7c 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocAnimDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocAnimDecoder.kt @@ -17,7 +17,7 @@ internal class LocAnimDecoder : ProxyMessageDecoder { session: Session, ): LocAnim { val locProperties = LocProperties(buffer.g1Alt1()) - val coordInZone = CoordInZone(buffer.g1Alt2()) + val coordInZone = CoordInZone(buffer.g1Alt3()) val id = buffer.g2Alt3() return LocAnim( id, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt index d9537ee62..ee26a9b88 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/LocMergeDecoder.kt @@ -4,6 +4,8 @@ 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.v241.game.outgoing.decoder.prot.GameServerProt @@ -14,8 +16,27 @@ internal class LocMergeDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): LocMerge { - throw UnsupportedOperationException( - "241 LOC_MERGE is consume-only in the native client; its legacy payload semantics are unverified", + val coordInZone = CoordInZone(buffer.g1Alt3()) + val maxZ = buffer.g1s() + val end = buffer.g2() + val minX = buffer.g1sAlt1() + val locProperties = LocProperties(buffer.g1Alt3()) + val index = buffer.g2Alt1() + val start = buffer.g2Alt3() + val maxX = buffer.g1sAlt3() + val id = buffer.g2Alt3() + val minZ = buffer.g1sAlt1() + return LocMerge( + index, + id, + coordInZone, + locProperties, + start, + end, + minX, + minZ, + maxX, + maxZ, ) } } diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt index 38646ccda..07dd656f7 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapAnimDecoder.kt @@ -18,7 +18,7 @@ internal class MapAnimDecoder : ProxyMessageDecoder { val delay = buffer.g2Alt1() val height = buffer.g1() val id = buffer.g2Alt3() - val coordInZone = CoordInZone(buffer.g1Alt2()) + val coordInZone = CoordInZone(buffer.g1Alt3()) return MapAnim( id, delay, diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapProjAnimV2Decoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapProjAnimV2Decoder.kt index a135ae2ea..6658421ae 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapProjAnimV2Decoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/MapProjAnimV2Decoder.kt @@ -21,7 +21,7 @@ internal class MapProjAnimV2Decoder : ProxyMessageDecoder { val sourceIndex = buffer.g3sAlt3() val startTime = buffer.g2Alt3() val startHeight = buffer.g2Alt1() - val coordInZone = CoordInZone(buffer.g1()) + val coordInZone = CoordInZone(buffer.g1Alt1()) val endHeight = buffer.g2Alt2() val progress = buffer.g2Alt2() val targetIndex = buffer.g3sAlt2() diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt index 3b0feec36..0b3e35bc0 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjAddDecoder.kt @@ -17,7 +17,7 @@ internal class ObjAddDecoder : ProxyMessageDecoder { session: Session, ): ObjAdd { val ownershipType = buffer.g1Alt2() - val coordInZone = CoordInZone(buffer.g1Alt2()) + val coordInZone = CoordInZone(buffer.g1Alt3()) val id = buffer.g2Alt1() val timeUntilDespawn = buffer.g2Alt2() val opFlags = OpFlags(buffer.g1Alt2()) diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjCountDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjCountDecoder.kt index de0496543..5640bd73e 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjCountDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ObjCountDecoder.kt @@ -15,7 +15,7 @@ internal class ObjCountDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): ObjCount { - val coordInZone = CoordInZone(buffer.g1()) + val coordInZone = CoordInZone(buffer.g1Alt1()) val id = buffer.g2Alt3() val newQuantity = buffer.g4Alt3() val oldQuantity = buffer.g4() diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjAddDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjAddDecoder.kt index 161cb8f65..23da09b36 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjAddDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjAddDecoder.kt @@ -16,12 +16,12 @@ internal class ScriptedProjAddDecoder : ProxyMessageDecoder { buffer: JagByteBuf, session: Session, ): ScriptedProjAdd { - val curveScriptT = buffer.g2() + val curveScriptA = buffer.g2() val sourceIndex = buffer.g3sAlt1() - val sourceHeight = buffer.g2sAlt2() - val targetHeight = buffer.g2sAlt3() - val sourceOffsetX = buffer.g2s() - val targetOffsetX = buffer.g2sAlt2() + val sourceOffsetX = buffer.g2sAlt2() + val targetOffsetX = buffer.g2sAlt3() + val sourceHeight = buffer.g2s() + val targetHeight = buffer.g2sAlt2() val targetOffsetZ = buffer.g2sAlt1() val id = buffer.g2Alt2() val targetIndex = buffer.g3sAlt2() @@ -29,7 +29,7 @@ internal class ScriptedProjAddDecoder : ProxyMessageDecoder { val slot = buffer.g2Alt3() val startTime = buffer.g2() val sourceOffsetZ = buffer.g2sAlt2() - val curveScriptA = buffer.g2Alt3() + val curveScriptT = buffer.g2Alt3() val targetCoord = CoordGrid(buffer.g4Alt1()) val curveScriptH = buffer.g2Alt3() val coordInZone = CoordInZone(buffer.g1Alt2()) diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjChangeDecoder.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjChangeDecoder.kt index ec24d5e61..7934e3394 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjChangeDecoder.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/decoder/codec/zone/payload/ScriptedProjChangeDecoder.kt @@ -15,9 +15,9 @@ internal class ScriptedProjChangeDecoder : ProxyMessageDecoder, ) { - val flag = buffer.g1() + val flag = buffer.g1Alt1() if (flag and 0x1 != 0) { blocks += BodyCustomisationExtendedInfo(ResetCustomisation) return @@ -985,12 +981,14 @@ internal class NpcInfoClient( val angle = NPC_TURN_ANGLES[buffer.gBits(3)] val hasSpawnCycle = buffer.gBits(1) == 1 if (hasSpawnCycle) { - val width = buffer.gBits(2) - npc.spawnCycle = buffer.gBits(spawnClockBitcodes[width]) + val index = buffer.gBits(2) + npc.spawnCycle = buffer.gBits(spawnClockBitcodes[index]) } + val extendedInfo = buffer.gBits(1) val idBitCount = buffer.gBits(2) npc.id = buffer.gBits(typeBitcodes[idBitCount]) + deltaX = decodeDelta(large, buffer) if (isNew) { npc.turnAngle = angle @@ -1148,7 +1146,6 @@ internal class NpcInfoClient( private const val NAME_CHANGE: Int = 0x400 private const val OPS: Int = 0x100 private const val SPOTANIM: Int = 0x4 - private const val SPOTANIM_OLD: Int = 0x20000 private const val HEADBARS: Int = 0x2000000 private const val BAS_CHANGE: Int = 0x400000 private const val SAY: Int = 0x40 diff --git a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt index 9cb0d2de1..31132e7a9 100644 --- a/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt +++ b/protocol/osrs-241/src/main/kotlin/net/rsprox/protocol/v241/game/outgoing/model/info/playerinfo/PlayerInfoClient.kt @@ -302,10 +302,6 @@ internal class PlayerInfoClient( throw IllegalStateException("Unused flags used!") } - // The retired V2 spotanim mask retains only its count byte. - if (flags and SPOTANIM_OLD != 0) { - buffer.g1() - } if (flags and SAY != 0) { decodeSay(buffer, blocks) } @@ -655,7 +651,7 @@ internal class PlayerInfoClient( ) { val delay = buffer.g2Alt1() val duration = buffer.g2Alt1() - val cancelSequence = buffer.g1Alt1() == 1 + val cancelSequence = buffer.g1Alt3() == 1 blocks += FreezeExtendedInfo(delay, duration, cancelSequence) } @@ -667,7 +663,7 @@ internal class PlayerInfoClient( val end = buffer.g2sAlt3() val startTransparency = buffer.g1sAlt1() val endTransparency = buffer.g1sAlt1() - val useStartTransparency = buffer.g1Alt1() == 1 + val useStartTransparency = buffer.g1Alt3() == 1 blocks += TransparencyExtendedInfo( start, @@ -1124,7 +1120,6 @@ internal class PlayerInfoClient( private const val EXACT_MOVE = 0x800 private const val PLAYER_TRANSPARENCY = 0x10000 private const val TEMP_MOVE_SPEED = 0x4000 - private const val SPOTANIM_OLD = 0x100000 private const val SPOTANIM = 0x4 private const val HEADBARS = 0x80000 private const val HITMARKS = 0x20000 From 66898cb2b55ea8c603030afb81140f7fd5ca370f Mon Sep 17 00:00:00 2001 From: Kris Date: Tue, 29 Sep 2026 22:08:43 +0300 Subject: [PATCH 7/7] fix: unpin runelite and native --- proxy/src/main/kotlin/net/rsprox/proxy/ProxyService.kt | 4 ++-- .../net/rsprox/proxy/runelite/RuneliteLauncher.kt | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/proxy/src/main/kotlin/net/rsprox/proxy/ProxyService.kt b/proxy/src/main/kotlin/net/rsprox/proxy/ProxyService.kt index 194f94742..ada0db3db 100644 --- a/proxy/src/main/kotlin/net/rsprox/proxy/ProxyService.kt +++ b/proxy/src/main/kotlin/net/rsprox/proxy/ProxyService.kt @@ -1184,8 +1184,8 @@ public class ProxyService( val targetRev = target.config.revision val binary = if (targetRev == null || targetRev == "latest_supported") { - // JagexNativeClientDownloader.download(nativeClientType) - getHistoricNativeClient("240.1", nativeClientType) + JagexNativeClientDownloader.download(nativeClientType) + // getHistoricNativeClient("240.1", nativeClientType) } else { getHistoricNativeClient(targetRev, nativeClientType) } diff --git a/proxy/src/main/kotlin/net/rsprox/proxy/runelite/RuneliteLauncher.kt b/proxy/src/main/kotlin/net/rsprox/proxy/runelite/RuneliteLauncher.kt index 28adc5ee5..dd683d445 100644 --- a/proxy/src/main/kotlin/net/rsprox/proxy/runelite/RuneliteLauncher.kt +++ b/proxy/src/main/kotlin/net/rsprox/proxy/runelite/RuneliteLauncher.kt @@ -82,13 +82,13 @@ public class RuneliteLauncher { // Pick the correct bootstrap commit from here: // https://github.com/runelite/static.runelite.net/commits/gh-pages/bootstrap.json val repository = "https://raw.githubusercontent.com/runelite/static.runelite.net" - val commit = "c8f9b14be8bd3fae44fa830381795cdfd32aa95f" - val bootstrapUrl = "$repository/$commit/bootstrap.json" - val bootstrapSigUrl = "$repository/$commit/bootstrap.json.sha256" + // val commit = "c8f9b14be8bd3fae44fa830381795cdfd32aa95f" + // val bootstrapUrl = "$repository/$commit/bootstrap.json" + // val bootstrapSigUrl = "$repository/$commit/bootstrap.json.sha256" // Any other time, just rely on the latest bootstrap. - // val bootstrapUrl = "https://static.runelite.net/bootstrap.json" - // val bootstrapSigUrl = "https://static.runelite.net/bootstrap.json.sha256" + val bootstrapUrl = "https://static.runelite.net/bootstrap.json" + val bootstrapSigUrl = "https://static.runelite.net/bootstrap.json.sha256" val localClasspath: String? = System.getProperty("rsprox.runelite.localClasspath") val defaultArgs = buildList {