fix(game): send the right value in the map transition ack (#99)
* fix(game): send 1 in the map transition ack, 2 is only the first placement * refactor(protocol): give the map transition ack a proper enum
This commit is contained in:
1 parent
d4940f85cf
commit
67e3b14a1d
4 files changed
+21
-6
No files matched your search
+3
-4
@@ -1,13 +1,12 @@
|
||||
package de.fiereu.openmmo.net.game.packets
|
||||
|
||||
import de.fiereu.bytecodec.Codec
|
||||
import de.fiereu.bytecodec.U8
|
||||
import de.fiereu.bytecodec.imap
|
||||
|
||||
data class MapTransitionAckPacket(val unk: Int = 0)
|
||||
data class MapTransitionAckPacket(val kind: MapTransitionKind)
|
||||
|
||||
val MapTransitionAckPacketCodec: Codec<MapTransitionAckPacket> =
|
||||
U8.imap(
|
||||
MapTransitionKindCodec.imap(
|
||||
decode = { MapTransitionAckPacket(it) },
|
||||
encode = { it.unk },
|
||||
encode = { it.kind },
|
||||
)
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package de.fiereu.openmmo.net.game.packets
|
||||
|
||||
import de.fiereu.bytecodec.Codec
|
||||
import de.fiereu.bytecodec.U8
|
||||
import de.fiereu.bytecodec.enumBy
|
||||
|
||||
enum class MapTransitionKind(val id: Int) {
|
||||
WARP(1),
|
||||
WORLD_ENTRY(2),
|
||||
}
|
||||
|
||||
val MapTransitionKindCodec: Codec<MapTransitionKind> =
|
||||
enumBy(
|
||||
U8, lookup = { id -> MapTransitionKind.entries.first { it.id == id } }, keyOf = { it.id })
|
||||
Reference in new issue
Block a user