-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
1,314 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...top/src/main/kotlin/net/rsprot/protocol/game/incoming/codec/misc/user/BugReportDecoder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package net.rsprot.protocol.game.incoming.codec.misc.user | ||
|
||
import net.rsprot.buffer.JagByteBuf | ||
import net.rsprot.protocol.ClientProt | ||
import net.rsprot.protocol.game.incoming.misc.user.BugReport | ||
import net.rsprot.protocol.game.incoming.prot.GameClientProt | ||
import net.rsprot.protocol.message.codec.MessageDecoder | ||
import net.rsprot.protocol.metadata.Consistent | ||
import net.rsprot.protocol.tools.MessageDecodingTools | ||
|
||
@Consistent | ||
public class BugReportDecoder : MessageDecoder<BugReport> { | ||
override val prot: ClientProt = GameClientProt.BUG_REPORT | ||
|
||
override fun decode( | ||
buffer: JagByteBuf, | ||
tools: MessageDecodingTools, | ||
): BugReport { | ||
val type = buffer.g1() | ||
val description = buffer.gjstr() | ||
val instructions = buffer.gjstr() | ||
check(description.length <= 500) { | ||
"Bug report description length cannot exceed 500 characters." | ||
} | ||
check(instructions.length <= 500) { | ||
"Bug report instructions length cannot exceed 500 characters." | ||
} | ||
return BugReport( | ||
type, | ||
description, | ||
instructions, | ||
) | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...src/main/kotlin/net/rsprot/protocol/game/incoming/codec/misc/user/ClickWorldMapDecoder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package net.rsprot.protocol.game.incoming.codec.misc.user | ||
|
||
import net.rsprot.buffer.JagByteBuf | ||
import net.rsprot.protocol.ClientProt | ||
import net.rsprot.protocol.game.incoming.misc.user.ClickWorldMap | ||
import net.rsprot.protocol.game.incoming.prot.GameClientProt | ||
import net.rsprot.protocol.internal.game.outgoing.info.CoordGrid | ||
import net.rsprot.protocol.message.codec.MessageDecoder | ||
import net.rsprot.protocol.tools.MessageDecodingTools | ||
|
||
public class ClickWorldMapDecoder : MessageDecoder<ClickWorldMap> { | ||
override val prot: ClientProt = GameClientProt.CLICKWORLDMAP | ||
|
||
override fun decode( | ||
buffer: JagByteBuf, | ||
tools: MessageDecodingTools, | ||
): ClickWorldMap { | ||
val packed = buffer.g4Alt3() | ||
return ClickWorldMap(CoordGrid(packed)) | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
...p/src/main/kotlin/net/rsprot/protocol/game/incoming/codec/misc/user/ClientCheatDecoder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package net.rsprot.protocol.game.incoming.codec.misc.user | ||
|
||
import net.rsprot.buffer.JagByteBuf | ||
import net.rsprot.protocol.ClientProt | ||
import net.rsprot.protocol.game.incoming.misc.user.ClientCheat | ||
import net.rsprot.protocol.game.incoming.prot.GameClientProt | ||
import net.rsprot.protocol.message.codec.MessageDecoder | ||
import net.rsprot.protocol.metadata.Consistent | ||
import net.rsprot.protocol.tools.MessageDecodingTools | ||
|
||
@Consistent | ||
public class ClientCheatDecoder : MessageDecoder<ClientCheat> { | ||
override val prot: ClientProt = GameClientProt.CLIENT_CHEAT | ||
|
||
override fun decode( | ||
buffer: JagByteBuf, | ||
tools: MessageDecodingTools, | ||
): ClientCheat { | ||
val command = buffer.gjstr() | ||
return ClientCheat(command) | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...op/src/main/kotlin/net/rsprot/protocol/game/incoming/codec/misc/user/CloseModalDecoder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package net.rsprot.protocol.game.incoming.codec.misc.user | ||
|
||
import net.rsprot.buffer.JagByteBuf | ||
import net.rsprot.protocol.ClientProt | ||
import net.rsprot.protocol.game.incoming.misc.user.CloseModal | ||
import net.rsprot.protocol.game.incoming.prot.GameClientProt | ||
import net.rsprot.protocol.message.codec.MessageDecoder | ||
import net.rsprot.protocol.tools.MessageDecodingTools | ||
|
||
public class CloseModalDecoder : MessageDecoder<CloseModal> { | ||
override val prot: ClientProt = GameClientProt.CLOSE_MODAL | ||
|
||
override fun decode( | ||
buffer: JagByteBuf, | ||
tools: MessageDecodingTools, | ||
): CloseModal { | ||
return CloseModal | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...rc/main/kotlin/net/rsprot/protocol/game/incoming/codec/misc/user/HiscoreRequestDecoder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package net.rsprot.protocol.game.incoming.codec.misc.user | ||
|
||
import net.rsprot.buffer.JagByteBuf | ||
import net.rsprot.protocol.ClientProt | ||
import net.rsprot.protocol.game.incoming.misc.user.HiscoreRequest | ||
import net.rsprot.protocol.game.incoming.prot.GameClientProt | ||
import net.rsprot.protocol.message.codec.MessageDecoder | ||
import net.rsprot.protocol.metadata.Consistent | ||
import net.rsprot.protocol.tools.MessageDecodingTools | ||
|
||
@Consistent | ||
public class HiscoreRequestDecoder : MessageDecoder<HiscoreRequest> { | ||
override val prot: ClientProt = GameClientProt.HISCORE_REQUEST | ||
|
||
override fun decode( | ||
buffer: JagByteBuf, | ||
tools: MessageDecodingTools, | ||
): HiscoreRequest { | ||
val type = buffer.g1() | ||
val requestId = buffer.g1() | ||
val name = buffer.gjstr() | ||
return HiscoreRequest( | ||
type, | ||
requestId, | ||
name, | ||
) | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...rc/main/kotlin/net/rsprot/protocol/game/incoming/codec/misc/user/IfCrmViewClickDecoder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package net.rsprot.protocol.game.incoming.codec.misc.user | ||
|
||
import net.rsprot.buffer.JagByteBuf | ||
import net.rsprot.protocol.ClientProt | ||
import net.rsprot.protocol.game.incoming.misc.user.IfCrmViewClick | ||
import net.rsprot.protocol.game.incoming.prot.GameClientProt | ||
import net.rsprot.protocol.message.codec.MessageDecoder | ||
import net.rsprot.protocol.tools.MessageDecodingTools | ||
import net.rsprot.protocol.util.gCombinedIdAlt1 | ||
|
||
public class IfCrmViewClickDecoder : MessageDecoder<IfCrmViewClick> { | ||
override val prot: ClientProt = GameClientProt.IF_CRMVIEW_CLICK | ||
|
||
override fun decode( | ||
buffer: JagByteBuf, | ||
tools: MessageDecodingTools, | ||
): IfCrmViewClick { | ||
val serverTarget = buffer.g4Alt1() | ||
val sub = buffer.g2() | ||
val behaviour2 = buffer.g4() | ||
val behaviour3 = buffer.g4() | ||
val combinedId = buffer.gCombinedIdAlt1() | ||
val behaviour1 = buffer.g4() | ||
return IfCrmViewClick( | ||
serverTarget, | ||
combinedId, | ||
sub, | ||
behaviour1, | ||
behaviour2, | ||
behaviour3, | ||
) | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...src/main/kotlin/net/rsprot/protocol/game/incoming/codec/misc/user/MoveGameClickDecoder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package net.rsprot.protocol.game.incoming.codec.misc.user | ||
|
||
import net.rsprot.buffer.JagByteBuf | ||
import net.rsprot.protocol.ClientProt | ||
import net.rsprot.protocol.game.incoming.misc.user.MoveGameClick | ||
import net.rsprot.protocol.game.incoming.prot.GameClientProt | ||
import net.rsprot.protocol.message.codec.MessageDecoder | ||
import net.rsprot.protocol.tools.MessageDecodingTools | ||
|
||
public class MoveGameClickDecoder : MessageDecoder<MoveGameClick> { | ||
override val prot: ClientProt = GameClientProt.MOVE_GAMECLICK | ||
|
||
override fun decode( | ||
buffer: JagByteBuf, | ||
tools: MessageDecodingTools, | ||
): MoveGameClick { | ||
val x = buffer.g2() | ||
val keyCombination = buffer.g1() | ||
val z = buffer.g2Alt1() | ||
return MoveGameClick( | ||
x, | ||
z, | ||
keyCombination, | ||
) | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
.../main/kotlin/net/rsprot/protocol/game/incoming/codec/misc/user/MoveMinimapClickDecoder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package net.rsprot.protocol.game.incoming.codec.misc.user | ||
|
||
import net.rsprot.buffer.JagByteBuf | ||
import net.rsprot.protocol.ClientProt | ||
import net.rsprot.protocol.game.incoming.misc.user.MoveMinimapClick | ||
import net.rsprot.protocol.game.incoming.prot.GameClientProt | ||
import net.rsprot.protocol.message.codec.MessageDecoder | ||
import net.rsprot.protocol.tools.MessageDecodingTools | ||
|
||
public class MoveMinimapClickDecoder : MessageDecoder<MoveMinimapClick> { | ||
override val prot: ClientProt = GameClientProt.MOVE_MINIMAPCLICK | ||
|
||
override fun decode( | ||
buffer: JagByteBuf, | ||
tools: MessageDecodingTools, | ||
): MoveMinimapClick { | ||
// The x, z and keyCombination get scrambled between revisions | ||
val x = buffer.g2() | ||
val keyCombination = buffer.g1() | ||
val z = buffer.g2() | ||
|
||
// 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, | ||
) | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
...p/src/main/kotlin/net/rsprot/protocol/game/incoming/codec/misc/user/OculusLeaveDecoder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package net.rsprot.protocol.game.incoming.codec.misc.user | ||
|
||
import net.rsprot.buffer.JagByteBuf | ||
import net.rsprot.protocol.ClientProt | ||
import net.rsprot.protocol.game.incoming.misc.user.OculusLeave | ||
import net.rsprot.protocol.game.incoming.prot.GameClientProt | ||
import net.rsprot.protocol.message.codec.MessageDecoder | ||
import net.rsprot.protocol.metadata.Consistent | ||
import net.rsprot.protocol.tools.MessageDecodingTools | ||
|
||
@Consistent | ||
public class OculusLeaveDecoder : MessageDecoder<OculusLeave> { | ||
override val prot: ClientProt = GameClientProt.OCULUS_LEAVE | ||
|
||
override fun decode( | ||
buffer: JagByteBuf, | ||
tools: MessageDecodingTools, | ||
): OculusLeave { | ||
return OculusLeave | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
.../src/main/kotlin/net/rsprot/protocol/game/incoming/codec/misc/user/SendSnapshotDecoder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package net.rsprot.protocol.game.incoming.codec.misc.user | ||
|
||
import net.rsprot.buffer.JagByteBuf | ||
import net.rsprot.protocol.ClientProt | ||
import net.rsprot.protocol.game.incoming.misc.user.SendSnapshot | ||
import net.rsprot.protocol.game.incoming.prot.GameClientProt | ||
import net.rsprot.protocol.message.codec.MessageDecoder | ||
import net.rsprot.protocol.metadata.Consistent | ||
import net.rsprot.protocol.tools.MessageDecodingTools | ||
|
||
@Consistent | ||
public class SendSnapshotDecoder : MessageDecoder<SendSnapshot> { | ||
override val prot: ClientProt = GameClientProt.SEND_SNAPSHOT | ||
|
||
override fun decode( | ||
buffer: JagByteBuf, | ||
tools: MessageDecodingTools, | ||
): SendSnapshot { | ||
val name = buffer.gjstr() | ||
val ruleId = buffer.g1() | ||
val mute = buffer.g1() == 1 | ||
return SendSnapshot( | ||
name, | ||
ruleId, | ||
mute, | ||
) | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
.../kotlin/net/rsprot/protocol/game/incoming/codec/misc/user/SetChatFilterSettingsDecoder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package net.rsprot.protocol.game.incoming.codec.misc.user | ||
|
||
import net.rsprot.buffer.JagByteBuf | ||
import net.rsprot.protocol.ClientProt | ||
import net.rsprot.protocol.game.incoming.misc.user.SetChatFilterSettings | ||
import net.rsprot.protocol.game.incoming.prot.GameClientProt | ||
import net.rsprot.protocol.message.codec.MessageDecoder | ||
import net.rsprot.protocol.metadata.Consistent | ||
import net.rsprot.protocol.tools.MessageDecodingTools | ||
|
||
@Consistent | ||
public class SetChatFilterSettingsDecoder : MessageDecoder<SetChatFilterSettings> { | ||
override val prot: ClientProt = GameClientProt.SET_CHATFILTERSETTINGS | ||
|
||
override fun decode( | ||
buffer: JagByteBuf, | ||
tools: MessageDecodingTools, | ||
): SetChatFilterSettings { | ||
val publicChatFilter = buffer.g1() | ||
val privateChatFilter = buffer.g1() | ||
val tradeChatFilter = buffer.g1() | ||
return SetChatFilterSettings( | ||
publicChatFilter, | ||
privateChatFilter, | ||
tradeChatFilter, | ||
) | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
...ktop/src/main/kotlin/net/rsprot/protocol/game/incoming/codec/misc/user/TeleportDecoder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package net.rsprot.protocol.game.incoming.codec.misc.user | ||
|
||
import net.rsprot.buffer.JagByteBuf | ||
import net.rsprot.protocol.ClientProt | ||
import net.rsprot.protocol.game.incoming.misc.user.Teleport | ||
import net.rsprot.protocol.game.incoming.prot.GameClientProt | ||
import net.rsprot.protocol.message.codec.MessageDecoder | ||
import net.rsprot.protocol.tools.MessageDecodingTools | ||
|
||
public class TeleportDecoder : MessageDecoder<Teleport> { | ||
override val prot: ClientProt = GameClientProt.TELEPORT | ||
|
||
override fun decode( | ||
buffer: JagByteBuf, | ||
tools: MessageDecodingTools, | ||
): Teleport { | ||
val oculusSyncValue = buffer.g4Alt2() | ||
val x = buffer.g2Alt1() | ||
val level = buffer.g1Alt1() | ||
val z = buffer.g2Alt1() | ||
return Teleport( | ||
oculusSyncValue, | ||
x, | ||
z, | ||
level, | ||
) | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...main/kotlin/net/rsprot/protocol/game/incoming/codec/misc/user/UpdatePlayerModelDecoder.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package net.rsprot.protocol.game.incoming.codec.misc.user | ||
|
||
import net.rsprot.buffer.JagByteBuf | ||
import net.rsprot.protocol.ClientProt | ||
import net.rsprot.protocol.game.incoming.misc.user.UpdatePlayerModel | ||
import net.rsprot.protocol.game.incoming.prot.GameClientProt | ||
import net.rsprot.protocol.message.codec.MessageDecoder | ||
import net.rsprot.protocol.metadata.Consistent | ||
import net.rsprot.protocol.tools.MessageDecodingTools | ||
|
||
@Consistent | ||
public class UpdatePlayerModelDecoder : MessageDecoder<UpdatePlayerModel> { | ||
override val prot: ClientProt = GameClientProt.UPDATE_PLAYER_MODEL | ||
|
||
override fun decode( | ||
buffer: JagByteBuf, | ||
tools: MessageDecodingTools, | ||
): UpdatePlayerModel { | ||
val bodyType = buffer.g1() | ||
val identKit = ByteArray(7) | ||
for (i in identKit.indices) { | ||
identKit[i] = buffer.g1().toByte() | ||
} | ||
val colours = ByteArray(5) | ||
for (i in colours.indices) { | ||
colours[i] = buffer.g1().toByte() | ||
} | ||
return UpdatePlayerModel( | ||
bodyType, | ||
identKit, | ||
colours, | ||
) | ||
} | ||
} |
Oops, something went wrong.