Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OP-69] OpModel1Message #180

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions data/packets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1444,11 +1444,13 @@ in-packets:
length: 8
ignore: true

- message: gg.rsmod.game.message.impl.IgnoreMessage # Unknown
- message: gg.rsmod.game.message.impl.OpModel1Message # TODO: FIND MORE ABOUT THIS
type: FIXED
opcode: 69
length: 4
ignore: true
structure:
- name: componentId
type: INT

- message: gg.rsmod.game.message.impl.IgnoreMessage # TODO: OPOBJ2
type: FIXED
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package gg.rsmod.plugins.content.skills

val buttons = intArrayOf(5, 11, 12, 13, 14, 15)

buttons.forEach {
println("instantiating button plugin for interface 374 button $it")
on_button(374, it) {
player.message("interface 374 button $it clicked")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ class MessageDecoderSet {
put(OpPlayer6Message::class.java, OpPlayer6Decoder(), OpPlayer6Handler(), structures)
put(OpPlayer7Message::class.java, OpPlayer7Decoder(), OpPlayer7Handler(), structures)
put(OpPlayer8Message::class.java, OpPlayer8Decoder(), OpPlayer8Handler(), structures)

put(OpModel1Message::class.java, OpModel1Decoder(), OpModel1Handler(), structures)

}

private fun <T : Message> put(messageType: Class<T>, decoderType: MessageDecoder<T>, handlerType: MessageHandler<T>, structures: MessageStructureSet) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package gg.rsmod.game.message.decoder

import gg.rsmod.game.message.MessageDecoder
import gg.rsmod.game.message.impl.OpModel1Message

/**
* Decodes [OpModel1Message]
* TODO: Find out more about OpModel1Decoder (op 69, nice)
*
* @author Curtis Woodard <[email protected]>
*/
class OpModel1Decoder: MessageDecoder<OpModel1Message>() {
override fun decode(
opcode: Int,
opcodeIndex: Int,
values: HashMap<String, Number>,
stringValues: HashMap<String, String>
): OpModel1Message =
OpModel1Message(componentId = values["componentId"]!!.toInt())
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package gg.rsmod.game.message.handler

import gg.rsmod.game.message.MessageHandler
import gg.rsmod.game.message.impl.IfButtonMessage
import gg.rsmod.game.message.impl.OpModel1Message
import gg.rsmod.game.model.World
import gg.rsmod.game.model.entity.Client

/**
* For now, this will be treated as an IfButton1 with no option slot or item until I can find out more about this opcode.
*
* @author Curtis Woodard <[email protected]>
*/
class OpModel1Handler: MessageHandler<OpModel1Message> {
override fun handle(client: Client, world: World, message: OpModel1Message) {
val ifButtonMessage = IfButtonMessage(message.componentId, -1, -1, -1)
IfButton1Handler().handle(client, world, ifButtonMessage)
}
}
13 changes: 13 additions & 0 deletions game/src/main/kotlin/gg/rsmod/game/message/impl/OpModel1Message.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package gg.rsmod.game.message.impl

import gg.rsmod.game.message.Message


/**
* This happens when you click a model component
*
* @property [componentId] The component id of this model inside the current interface
*
* @author Curtis Woodard <[email protected]>
*/
data class OpModel1Message(val componentId: Int): Message