feat(game): handle npc dialog replies and send correct dialog actions (#63)

This commit is contained in:
Fiereu authored and GitHub committed 2026-07-25 19:18:58 +02:00
1 parent 35a7966a97
commit e89ae6e6df
10 files changed
+97 -74

No files matched your search

@@ -6,6 +6,7 @@ import de.fiereu.network.c2s
import de.fiereu.network.s2c
import de.fiereu.openmmo.net.game.packets.*
import de.fiereu.openmmo.net.game.packets.battle.*
import de.fiereu.openmmo.net.game.packets.dialog.*
import de.fiereu.openmmo.net.game.packets.guild.*
object GameProtocol : Protocol() {
@@ -97,7 +98,7 @@ object GameProtocol : Protocol() {
c2s<NullPacket>(0x20u, NullPacketCodec)
s2c<TokenPayloadPacket>(0x20u, TokenPayloadPacketCodec)
c2s<WarpTileInteractPacket>(0x21u, WarpTileInteractPacketCodec)
c2s<DialogActionResponsePacket>(0x21u, DialogActionResponsePacketCodec)
s2c<DialogActionPacket>(0x21u, DialogActionPacketCodec)
bidi<EntityInteractPacket>(0x22u, EntityInteractPacketCodec)
@@ -1,26 +0,0 @@
package de.fiereu.openmmo.net.game.packets
import de.fiereu.bytecodec.*
data class InteractivePacket(
val id: Int,
val type: Int,
val unk1: Int,
val unk2: Int,
val targetEntityId: Long,
val unk3: Int,
val unk4: Int,
)
object InteractivePacketCodec : PacketCodec<InteractivePacket>() {
override fun CodecScope<InteractivePacket>.body(): InteractivePacket {
val id = field(U8) { it.id }
val type = field(U8) { it.type }
val unk1 = field(S32LE) { it.unk1 }
val unk2 = field(S32LE) { it.unk2 }
val targetEntityId = field(S64LE) { it.targetEntityId }
val unk3 = field(U16LE) { it.unk3 }
val unk4 = field(U16LE) { it.unk4 }
return InteractivePacket(id, type, unk1, unk2, targetEntityId, unk3, unk4)
}
}
@@ -1,15 +0,0 @@
package de.fiereu.openmmo.net.game.packets
import de.fiereu.bytecodec.CodecScope
import de.fiereu.bytecodec.PacketCodec
import de.fiereu.bytecodec.U8
data class InteractiveResponsePacket(val id: Int, val unk: Int)
object InteractiveResponsePacketCodec : PacketCodec<InteractiveResponsePacket>() {
override fun CodecScope<InteractiveResponsePacket>.body(): InteractiveResponsePacket {
val id = field(U8) { it.id }
val unk = field(U8) { it.unk }
return InteractiveResponsePacket(id, unk)
}
}
@@ -1,18 +0,0 @@
package de.fiereu.openmmo.net.game.packets
import de.fiereu.bytecodec.CodecScope
import de.fiereu.bytecodec.PacketCodec
import de.fiereu.bytecodec.S8
data class WarpTileInteractPacket(
val floorId: Byte,
val warpMode: Byte,
)
object WarpTileInteractPacketCodec : PacketCodec<WarpTileInteractPacket>() {
override fun CodecScope<WarpTileInteractPacket>.body(): WarpTileInteractPacket {
val floorId = field(S8) { it.floorId }
val warpMode = field(S8) { it.warpMode }
return WarpTileInteractPacket(floorId, warpMode)
}
}
@@ -1,4 +1,4 @@
package de.fiereu.openmmo.net.game.packets
package de.fiereu.openmmo.net.game.packets.dialog
import de.fiereu.bytecodec.*
@@ -0,0 +1,15 @@
package de.fiereu.openmmo.net.game.packets.dialog
import de.fiereu.bytecodec.CodecScope
import de.fiereu.bytecodec.PacketCodec
import de.fiereu.bytecodec.U8
data class DialogActionResponsePacket(val id: Int, val unk: Int)
object DialogActionResponsePacketCodec : PacketCodec<DialogActionResponsePacket>() {
override fun CodecScope<DialogActionResponsePacket>.body(): DialogActionResponsePacket {
val id = field(U8) { it.id }
val unk = field(U8) { it.unk }
return DialogActionResponsePacket(id, unk)
}
}