feat(game): let the player replace a move on level up (#90)
This commit is contained in:
1 parent
1ecfabaed5
commit
4470cbda37
11 files changed
+281
-66
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.battle.moves.*
|
||||
import de.fiereu.openmmo.net.game.packets.dialog.*
|
||||
import de.fiereu.openmmo.net.game.packets.guild.*
|
||||
|
||||
@@ -38,7 +39,7 @@ object GameProtocol : Protocol() {
|
||||
|
||||
bidi<ChatMessagePacket>(0x09u, ChatMessagePacketCodec)
|
||||
|
||||
c2s<BattleMoveUsePacket>(0x0Au, BattleMoveUsePacketCodec)
|
||||
c2s<MoveLearnReplyPacket>(0x0Au, MoveLearnReplyPacketCodec)
|
||||
s2c<WorldFlagTableResetPacket>(0x0Au, WorldFlagTableResetPacketCodec)
|
||||
|
||||
c2s<EvolutionPromptResponsePacket>(0x0Bu, EvolutionPromptResponsePacketCodec)
|
||||
@@ -73,7 +74,7 @@ object GameProtocol : Protocol() {
|
||||
s2c<BattleEntityDeltaPacket>(0x16u, BattleEntityDeltaPacketCodec)
|
||||
|
||||
c2s<StorageBoxClosePacket>(0x17u, StorageBoxClosePacketCodec)
|
||||
s2c<SocialEntryFlagSetPacket>(0x17u, SocialEntryFlagSetPacketCodec)
|
||||
s2c<MoveLearnPromptPacket>(0x17u, MoveLearnPromptPacketCodec)
|
||||
|
||||
c2s<MonsterStatusConditionPacket>(0x18u, MonsterStatusConditionPacketCodec)
|
||||
s2c<SocialEntryPresencePacket>(0x18u, SocialEntryPresencePacketCodec)
|
||||
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
package de.fiereu.openmmo.net.game.packets
|
||||
|
||||
import de.fiereu.bytecodec.*
|
||||
|
||||
data class SocialEntryFlagSetPacket(
|
||||
val playerId: Long,
|
||||
val flag: Byte,
|
||||
val value: Short,
|
||||
)
|
||||
|
||||
object SocialEntryFlagSetPacketCodec : PacketCodec<SocialEntryFlagSetPacket>() {
|
||||
override fun CodecScope<SocialEntryFlagSetPacket>.body(): SocialEntryFlagSetPacket {
|
||||
val playerId = field(S64LE) { it.playerId }
|
||||
val flag = field(S8) { it.flag }
|
||||
val value = field(S16LE) { it.value }
|
||||
return SocialEntryFlagSetPacket(playerId, flag, value)
|
||||
}
|
||||
}
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
package de.fiereu.openmmo.net.game.packets.battle
|
||||
|
||||
import de.fiereu.bytecodec.*
|
||||
|
||||
data class BattleMoveUsePacket(
|
||||
val targetEntityId: Long,
|
||||
val moveSlotIndex: Byte,
|
||||
val moveId: Short,
|
||||
)
|
||||
|
||||
object BattleMoveUsePacketCodec : PacketCodec<BattleMoveUsePacket>() {
|
||||
override fun CodecScope<BattleMoveUsePacket>.body(): BattleMoveUsePacket {
|
||||
val targetEntityId = field(S64LE) { it.targetEntityId }
|
||||
val moveSlotIndex = field(S8) { it.moveSlotIndex }
|
||||
val moveId = field(S16LE) { it.moveId }
|
||||
return BattleMoveUsePacket(targetEntityId, moveSlotIndex, moveId)
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package de.fiereu.openmmo.net.game.packets.battle.moves
|
||||
|
||||
import de.fiereu.bytecodec.*
|
||||
|
||||
/** Asks the player which move to drop for a new one. */
|
||||
data class MoveLearnPromptPacket(
|
||||
val entityId: Long,
|
||||
val offered: List<Short>,
|
||||
)
|
||||
|
||||
object MoveLearnPromptPacketCodec : PacketCodec<MoveLearnPromptPacket>() {
|
||||
override fun CodecScope<MoveLearnPromptPacket>.body(): MoveLearnPromptPacket {
|
||||
val entityId = field(S64LE) { it.entityId }
|
||||
val offered = field(S16LE.listPrefixed(U8)) { it.offered }
|
||||
return MoveLearnPromptPacket(entityId, offered)
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package de.fiereu.openmmo.net.game.packets.battle.moves
|
||||
|
||||
import de.fiereu.bytecodec.*
|
||||
|
||||
/** The moveset the player picked. A new move sits in the slot it takes over. */
|
||||
data class MoveLearnReplyPacket(
|
||||
val entityId: Long,
|
||||
val moveIds: List<Short>,
|
||||
val offered: List<Short>,
|
||||
)
|
||||
|
||||
object MoveLearnReplyPacketCodec : PacketCodec<MoveLearnReplyPacket>() {
|
||||
override fun CodecScope<MoveLearnReplyPacket>.body(): MoveLearnReplyPacket {
|
||||
val entityId = field(S64LE) { it.entityId }
|
||||
val moveIds = field(S16LE.listPrefixed(U8)) { it.moveIds }
|
||||
val offered = field(S16LE.listPrefixed(U8)) { it.offered }
|
||||
return MoveLearnReplyPacket(entityId, moveIds, offered)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user