chore(style): spotlessApply
This commit is contained in:
1 parent
a0dc6d961b
commit
a93efe624f
382 files changed
+6049
-5992
No files matched your search
@@ -7,593 +7,592 @@ import de.fiereu.network.s2c
|
|||||||
import de.fiereu.openmmo.net.game.packets.*
|
import de.fiereu.openmmo.net.game.packets.*
|
||||||
|
|
||||||
object GameProtocol : Protocol() {
|
object GameProtocol : Protocol() {
|
||||||
override val compressed: Boolean = true
|
override val compressed: Boolean = true
|
||||||
|
|
||||||
init {
|
init {
|
||||||
c2s<JoinPacket>(0x01u, JoinPacketCodec)
|
c2s<JoinPacket>(0x01u, JoinPacketCodec)
|
||||||
s2c<JoinResponsePacket>(0x01u, JoinResponsePacketCodec)
|
s2c<JoinResponsePacket>(0x01u, JoinResponsePacketCodec)
|
||||||
|
|
||||||
c2s<RequestCharactersPacket>(0x02u, RequestCharactersPacketCodec)
|
c2s<RequestCharactersPacket>(0x02u, RequestCharactersPacketCodec)
|
||||||
s2c<CharactersListPacket>(0x02u, CharactersListPacketCodec)
|
s2c<CharactersListPacket>(0x02u, CharactersListPacketCodec)
|
||||||
|
|
||||||
c2s<CreateCharacterPacket>(0x03u, CreateCharacterPacketCodec)
|
c2s<CreateCharacterPacket>(0x03u, CreateCharacterPacketCodec)
|
||||||
s2c<FriendRosterDeltaPacket>(0x03u, FriendRosterDeltaPacketCodec)
|
s2c<FriendRosterDeltaPacket>(0x03u, FriendRosterDeltaPacketCodec)
|
||||||
|
|
||||||
c2s<SelectCharacterPacket>(0x04u, SelectCharacterPacketCodec)
|
c2s<SelectCharacterPacket>(0x04u, SelectCharacterPacketCodec)
|
||||||
s2c<SelectedCharacterPacket>(0x04u, SelectedCharacterPacketCodec)
|
s2c<SelectedCharacterPacket>(0x04u, SelectedCharacterPacketCodec)
|
||||||
|
|
||||||
c2s<RequestPlayerPacket>(0x05u, RequestPlayerPacketCodec)
|
c2s<RequestPlayerPacket>(0x05u, RequestPlayerPacketCodec)
|
||||||
s2c<LoadEntityPacket>(0x05u, LoadEntityPacketCodec)
|
s2c<LoadEntityPacket>(0x05u, LoadEntityPacketCodec)
|
||||||
|
|
||||||
c2s<MovementPacket>(0x06u, MovementPacketCodec)
|
c2s<MovementPacket>(0x06u, MovementPacketCodec)
|
||||||
|
|
||||||
c2s<FaceDirectionPacket>(0x07u, FaceDirectionPacketCodec)
|
c2s<FaceDirectionPacket>(0x07u, FaceDirectionPacketCodec)
|
||||||
s2c<EntityFaceTurnPacket>(0x07u, EntityFaceTurnPacketCodec)
|
s2c<EntityFaceTurnPacket>(0x07u, EntityFaceTurnPacketCodec)
|
||||||
|
|
||||||
c2s<ChatMessageSendPacket>(0x08u, ChatMessageSendPacketCodec)
|
c2s<ChatMessageSendPacket>(0x08u, ChatMessageSendPacketCodec)
|
||||||
s2c<EntityLeavePacket>(0x08u, EntityLeavePacketCodec)
|
s2c<EntityLeavePacket>(0x08u, EntityLeavePacketCodec)
|
||||||
|
|
||||||
bidi<ChatMessagePacket>(0x09u, ChatMessagePacketCodec)
|
bidi<ChatMessagePacket>(0x09u, ChatMessagePacketCodec)
|
||||||
|
|
||||||
c2s<BattleMoveUsePacket>(0x0Au, BattleMoveUsePacketCodec)
|
c2s<BattleMoveUsePacket>(0x0Au, BattleMoveUsePacketCodec)
|
||||||
s2c<WorldFlagTableResetPacket>(0x0Au, WorldFlagTableResetPacketCodec)
|
s2c<WorldFlagTableResetPacket>(0x0Au, WorldFlagTableResetPacketCodec)
|
||||||
|
|
||||||
c2s<EvolutionPromptResponsePacket>(0x0Bu, EvolutionPromptResponsePacketCodec)
|
c2s<EvolutionPromptResponsePacket>(0x0Bu, EvolutionPromptResponsePacketCodec)
|
||||||
s2c<WorldFlagSetPacket>(0x0Bu, WorldFlagSetPacketCodec)
|
s2c<WorldFlagSetPacket>(0x0Bu, WorldFlagSetPacketCodec)
|
||||||
|
|
||||||
c2s<BattlePartySwitchPacket>(0x0Cu, BattlePartySwitchPacketCodec)
|
c2s<BattlePartySwitchPacket>(0x0Cu, BattlePartySwitchPacketCodec)
|
||||||
s2c<LocalCharacterDeltaPacket>(0x0Cu, LocalCharacterDeltaPacketCodec)
|
s2c<LocalCharacterDeltaPacket>(0x0Cu, LocalCharacterDeltaPacketCodec)
|
||||||
|
|
||||||
bidi<DialogDataPacket>(0x0Du, DialogDataPacketCodec)
|
bidi<DialogDataPacket>(0x0Du, DialogDataPacketCodec)
|
||||||
|
|
||||||
bidi<DialogStatePacket>(0x0Eu, DialogStatePacketCodec)
|
bidi<DialogStatePacket>(0x0Eu, DialogStatePacketCodec)
|
||||||
|
|
||||||
c2s<PokemonListAddPacket>(0x0Fu, PokemonListAddPacketCodec)
|
c2s<PokemonListAddPacket>(0x0Fu, PokemonListAddPacketCodec)
|
||||||
s2c<EntityPresencePacket>(0x0Fu, EntityPresencePacketCodec)
|
s2c<EntityPresencePacket>(0x0Fu, EntityPresencePacketCodec)
|
||||||
|
|
||||||
bidi<LoadMapPacket>(0x10u, LoadMapPacketCodec)
|
bidi<LoadMapPacket>(0x10u, LoadMapPacketCodec)
|
||||||
|
|
||||||
c2s<PartyMemberSelectPacket>(0x11u, PartyMemberSelectPacketCodec)
|
c2s<PartyMemberSelectPacket>(0x11u, PartyMemberSelectPacketCodec)
|
||||||
s2c<NpcUpdatePacket>(0x11u, NpcUpdatePacketCodec)
|
s2c<NpcUpdatePacket>(0x11u, NpcUpdatePacketCodec)
|
||||||
|
|
||||||
bidi<NpcSpawnPacket>(0x12u, NpcSpawnPacketCodec)
|
bidi<NpcSpawnPacket>(0x12u, NpcSpawnPacketCodec)
|
||||||
|
|
||||||
bidi<PokemonContainerPacket>(0x13u, PokemonContainerPacketCodec)
|
bidi<PokemonContainerPacket>(0x13u, PokemonContainerPacketCodec)
|
||||||
|
|
||||||
c2s<EntityActionRequestPacket>(0x14u, EntityActionRequestPacketCodec)
|
c2s<EntityActionRequestPacket>(0x14u, EntityActionRequestPacketCodec)
|
||||||
s2c<SocialListEntryAddPacket>(0x14u, SocialListEntryAddPacketCodec)
|
s2c<SocialListEntryAddPacket>(0x14u, SocialListEntryAddPacketCodec)
|
||||||
|
|
||||||
c2s<ChatLocalePreferencesPacket>(0x15u, ChatLocalePreferencesPacketCodec)
|
c2s<ChatLocalePreferencesPacket>(0x15u, ChatLocalePreferencesPacketCodec)
|
||||||
s2c<SocialListEntryRemovePacket>(0x15u, SocialListEntryRemovePacketCodec)
|
s2c<SocialListEntryRemovePacket>(0x15u, SocialListEntryRemovePacketCodec)
|
||||||
|
|
||||||
c2s<InGameChallengeResponsePacket>(0x16u, InGameChallengeResponsePacketCodec)
|
c2s<InGameChallengeResponsePacket>(0x16u, InGameChallengeResponsePacketCodec)
|
||||||
s2c<BattleEntityDeltaPacket>(0x16u, BattleEntityDeltaPacketCodec)
|
s2c<BattleEntityDeltaPacket>(0x16u, BattleEntityDeltaPacketCodec)
|
||||||
|
|
||||||
c2s<StorageBoxClosePacket>(0x17u, StorageBoxClosePacketCodec)
|
c2s<StorageBoxClosePacket>(0x17u, StorageBoxClosePacketCodec)
|
||||||
s2c<SocialEntryFlagSetPacket>(0x17u, SocialEntryFlagSetPacketCodec)
|
s2c<SocialEntryFlagSetPacket>(0x17u, SocialEntryFlagSetPacketCodec)
|
||||||
|
|
||||||
c2s<MonsterStatusConditionPacket>(0x18u, MonsterStatusConditionPacketCodec)
|
c2s<MonsterStatusConditionPacket>(0x18u, MonsterStatusConditionPacketCodec)
|
||||||
s2c<SocialEntryPresencePacket>(0x18u, SocialEntryPresencePacketCodec)
|
s2c<SocialEntryPresencePacket>(0x18u, SocialEntryPresencePacketCodec)
|
||||||
|
|
||||||
c2s<MonsterFormActionPacket>(0x19u, MonsterFormActionPacketCodec)
|
c2s<MonsterFormActionPacket>(0x19u, MonsterFormActionPacketCodec)
|
||||||
s2c<SocialEntryRenamePacket>(0x19u, SocialEntryRenamePacketCodec)
|
s2c<SocialEntryRenamePacket>(0x19u, SocialEntryRenamePacketCodec)
|
||||||
|
|
||||||
s2c<EntityMovePpPacket>(0x1Au, EntityMovePpPacketCodec)
|
s2c<EntityMovePpPacket>(0x1Au, EntityMovePpPacketCodec)
|
||||||
|
|
||||||
bidi<MapTransitionPacket>(0x1Bu, MapTransitionPacketCodec)
|
bidi<MapTransitionPacket>(0x1Bu, MapTransitionPacketCodec)
|
||||||
|
|
||||||
c2s<StorageBoxFilterPacket>(0x1Cu, StorageBoxFilterPacketCodec)
|
c2s<StorageBoxFilterPacket>(0x1Cu, StorageBoxFilterPacketCodec)
|
||||||
s2c<PokedexSpeciesResetPacket>(0x1Cu, PokedexSpeciesResetPacketCodec)
|
s2c<PokedexSpeciesResetPacket>(0x1Cu, PokedexSpeciesResetPacketCodec)
|
||||||
|
|
||||||
c2s<PokemonFlagsUpdatePacket>(0x1Du, PokemonFlagsUpdatePacketCodec)
|
c2s<PokemonFlagsUpdatePacket>(0x1Du, PokemonFlagsUpdatePacketCodec)
|
||||||
s2c<PokedexSpeciesUnlockPacket>(0x1Du, PokedexSpeciesUnlockPacketCodec)
|
s2c<PokedexSpeciesUnlockPacket>(0x1Du, PokedexSpeciesUnlockPacketCodec)
|
||||||
|
|
||||||
s2c<OverworldWeatherControlPacket>(0x1Eu, OverworldWeatherControlPacketCodec)
|
s2c<OverworldWeatherControlPacket>(0x1Eu, OverworldWeatherControlPacketCodec)
|
||||||
|
|
||||||
s2c<OverworldParticleSpawnPacket>(0x1Fu, OverworldParticleSpawnPacketCodec)
|
s2c<OverworldParticleSpawnPacket>(0x1Fu, OverworldParticleSpawnPacketCodec)
|
||||||
|
|
||||||
c2s<NullPacket>(0x20u, NullPacketCodec)
|
c2s<NullPacket>(0x20u, NullPacketCodec)
|
||||||
s2c<TokenPayloadPacket>(0x20u, TokenPayloadPacketCodec)
|
s2c<TokenPayloadPacket>(0x20u, TokenPayloadPacketCodec)
|
||||||
|
|
||||||
c2s<WarpTileInteractPacket>(0x21u, WarpTileInteractPacketCodec)
|
c2s<WarpTileInteractPacket>(0x21u, WarpTileInteractPacketCodec)
|
||||||
s2c<DialogActionPacket>(0x21u, DialogActionPacketCodec)
|
s2c<DialogActionPacket>(0x21u, DialogActionPacketCodec)
|
||||||
|
|
||||||
bidi<EntityInteractPacket>(0x22u, EntityInteractPacketCodec)
|
bidi<EntityInteractPacket>(0x22u, EntityInteractPacketCodec)
|
||||||
|
|
||||||
c2s<ExchangeItemRequestPacket>(0x23u, ExchangeItemRequestPacketCodec)
|
c2s<ExchangeItemRequestPacket>(0x23u, ExchangeItemRequestPacketCodec)
|
||||||
s2c<EventOverlayStatePacket>(0x23u, EventOverlayStatePacketCodec)
|
s2c<EventOverlayStatePacket>(0x23u, EventOverlayStatePacketCodec)
|
||||||
|
|
||||||
c2s<ShopSellRequestPacket>(0x24u, ShopSellRequestPacketCodec)
|
c2s<ShopSellRequestPacket>(0x24u, ShopSellRequestPacketCodec)
|
||||||
s2c<NpcPanelTogglePacket>(0x24u, NpcPanelTogglePacketCodec)
|
s2c<NpcPanelTogglePacket>(0x24u, NpcPanelTogglePacketCodec)
|
||||||
|
|
||||||
bidi<DialogChoicePacket>(0x25u, DialogChoicePacketCodec)
|
bidi<DialogChoicePacket>(0x25u, DialogChoicePacketCodec)
|
||||||
|
|
||||||
bidi<DialogOptionPacket>(0x26u, DialogOptionPacketCodec)
|
bidi<DialogOptionPacket>(0x26u, DialogOptionPacketCodec)
|
||||||
|
|
||||||
c2s<PlayerStopMovingPacket>(0x27u, PlayerStopMovingPacketCodec)
|
c2s<PlayerStopMovingPacket>(0x27u, PlayerStopMovingPacketCodec)
|
||||||
s2c<BattlePromptSwitchPacket>(0x27u, BattlePromptSwitchPacketCodec)
|
s2c<BattlePromptSwitchPacket>(0x27u, BattlePromptSwitchPacketCodec)
|
||||||
|
|
||||||
c2s<TypedBinaryDataPacket>(0x28u, TypedBinaryDataPacketCodec)
|
c2s<TypedBinaryDataPacket>(0x28u, TypedBinaryDataPacketCodec)
|
||||||
s2c<EntityInteractionFlagPacket>(0x28u, EntityInteractionFlagPacketCodec)
|
s2c<EntityInteractionFlagPacket>(0x28u, EntityInteractionFlagPacketCodec)
|
||||||
|
|
||||||
c2s<CustomizeCharacterAppearancePacket>(0x29u, CustomizeCharacterAppearancePacketCodec)
|
c2s<CustomizeCharacterAppearancePacket>(0x29u, CustomizeCharacterAppearancePacketCodec)
|
||||||
s2c<ShopPriceTablePacket>(0x29u, ShopPriceTablePacketCodec)
|
s2c<ShopPriceTablePacket>(0x29u, ShopPriceTablePacketCodec)
|
||||||
|
|
||||||
c2s<TeamNameChangePacket>(0x2Au, TeamNameChangePacketCodec)
|
c2s<TeamNameChangePacket>(0x2Au, TeamNameChangePacketCodec)
|
||||||
s2c<BattleStatusFlagPacket>(0x2Au, BattleStatusFlagPacketCodec)
|
s2c<BattleStatusFlagPacket>(0x2Au, BattleStatusFlagPacketCodec)
|
||||||
|
|
||||||
c2s<SetCharacterNamePacket>(0x2Bu, SetCharacterNamePacketCodec)
|
c2s<SetCharacterNamePacket>(0x2Bu, SetCharacterNamePacketCodec)
|
||||||
s2c<FollowerAdvancePacket>(0x2Bu, FollowerAdvancePacketCodec)
|
s2c<FollowerAdvancePacket>(0x2Bu, FollowerAdvancePacketCodec)
|
||||||
|
|
||||||
c2s<NpcDialogResponsePacket>(0x2Cu, NpcDialogResponsePacketCodec)
|
c2s<NpcDialogResponsePacket>(0x2Cu, NpcDialogResponsePacketCodec)
|
||||||
s2c<EntityTitleTagPacket>(0x2Cu, EntityTitleTagPacketCodec)
|
s2c<EntityTitleTagPacket>(0x2Cu, EntityTitleTagPacketCodec)
|
||||||
|
|
||||||
c2s<EntityInteractRequestPacket>(0x2Du, EntityInteractRequestPacketCodec)
|
c2s<EntityInteractRequestPacket>(0x2Du, EntityInteractRequestPacketCodec)
|
||||||
s2c<MapCellTilesetPacket>(0x2Du, MapCellTilesetPacketCodec)
|
s2c<MapCellTilesetPacket>(0x2Du, MapCellTilesetPacketCodec)
|
||||||
|
|
||||||
c2s<SendDirectMessagePacket>(0x2Eu, SendDirectMessagePacketCodec)
|
c2s<SendDirectMessagePacket>(0x2Eu, SendDirectMessagePacketCodec)
|
||||||
s2c<EntityRenamePacket>(0x2Eu, EntityRenamePacketCodec)
|
s2c<EntityRenamePacket>(0x2Eu, EntityRenamePacketCodec)
|
||||||
|
|
||||||
c2s<DialogResponsePacket>(0x2Fu, DialogResponsePacketCodec)
|
c2s<DialogResponsePacket>(0x2Fu, DialogResponsePacketCodec)
|
||||||
s2c<WorldJoinConfirmPacket>(0x2Fu, WorldJoinConfirmPacketCodec)
|
s2c<WorldJoinConfirmPacket>(0x2Fu, WorldJoinConfirmPacketCodec)
|
||||||
|
|
||||||
c2s<BattleActionPacket>(0x30u, BattleActionPacketCodec)
|
c2s<BattleActionPacket>(0x30u, BattleActionPacketCodec)
|
||||||
|
|
||||||
s2c<BattleBulkStatePacket>(0x31u, BattleBulkStatePacketCodec)
|
s2c<BattleBulkStatePacket>(0x31u, BattleBulkStatePacketCodec)
|
||||||
|
|
||||||
c2s<BattleActionSelectPacket>(0x32u, BattleActionSelectPacketCodec)
|
c2s<BattleActionSelectPacket>(0x32u, BattleActionSelectPacketCodec)
|
||||||
s2c<BattleQueuedEventPacket>(0x32u, BattleQueuedEventPacketCodec)
|
s2c<BattleQueuedEventPacket>(0x32u, BattleQueuedEventPacketCodec)
|
||||||
|
|
||||||
c2s<MapLoadedAckPacket>(0x33u, MapLoadedAckPacketCodec)
|
c2s<MapLoadedAckPacket>(0x33u, MapLoadedAckPacketCodec)
|
||||||
s2c<BattleEntityMoveEventPacket>(0x33u, BattleEntityMoveEventPacketCodec)
|
s2c<BattleEntityMoveEventPacket>(0x33u, BattleEntityMoveEventPacketCodec)
|
||||||
|
|
||||||
c2s<SpectateRequestPacket>(0x34u, SpectateRequestPacketCodec)
|
c2s<SpectateRequestPacket>(0x34u, SpectateRequestPacketCodec)
|
||||||
s2c<BattleSlotEventEnumPacket>(0x34u, BattleSlotEventEnumPacketCodec)
|
s2c<BattleSlotEventEnumPacket>(0x34u, BattleSlotEventEnumPacketCodec)
|
||||||
|
|
||||||
c2s<LeaveBattlePacket>(0x35u, LeaveBattlePacketCodec)
|
c2s<LeaveBattlePacket>(0x35u, LeaveBattlePacketCodec)
|
||||||
s2c<BattleSlotMoveEventPacket>(0x35u, BattleSlotMoveEventPacketCodec)
|
s2c<BattleSlotMoveEventPacket>(0x35u, BattleSlotMoveEventPacketCodec)
|
||||||
|
|
||||||
c2s<RequestNextBattleSequencePacket>(0x36u, RequestNextBattleSequencePacketCodec)
|
c2s<RequestNextBattleSequencePacket>(0x36u, RequestNextBattleSequencePacketCodec)
|
||||||
s2c<BattleSlotFlagEventPacket>(0x36u, BattleSlotFlagEventPacketCodec)
|
s2c<BattleSlotFlagEventPacket>(0x36u, BattleSlotFlagEventPacketCodec)
|
||||||
|
|
||||||
c2s<BattleSlotActionPacket>(0x37u, BattleSlotActionPacketCodec)
|
c2s<BattleSlotActionPacket>(0x37u, BattleSlotActionPacketCodec)
|
||||||
s2c<BattleListEventPacket>(0x37u, BattleListEventPacketCodec)
|
s2c<BattleListEventPacket>(0x37u, BattleListEventPacketCodec)
|
||||||
|
|
||||||
c2s<BattleSwitchSelectionsPacket>(0x38u, BattleSwitchSelectionsPacketCodec)
|
c2s<BattleSwitchSelectionsPacket>(0x38u, BattleSwitchSelectionsPacketCodec)
|
||||||
s2c<BattleEntityActionEventPacket>(0x38u, BattleEntityActionEventPacketCodec)
|
s2c<BattleEntityActionEventPacket>(0x38u, BattleEntityActionEventPacketCodec)
|
||||||
|
|
||||||
c2s<BattleUseItemPacket>(0x39u, BattleUseItemPacketCodec)
|
c2s<BattleUseItemPacket>(0x39u, BattleUseItemPacketCodec)
|
||||||
s2c<BattleLabeledMoveEventPacket>(0x39u, BattleLabeledMoveEventPacketCodec)
|
s2c<BattleLabeledMoveEventPacket>(0x39u, BattleLabeledMoveEventPacketCodec)
|
||||||
|
|
||||||
c2s<SetBattleMonsterAppearancePacket>(0x3Au, SetBattleMonsterAppearancePacketCodec)
|
c2s<SetBattleMonsterAppearancePacket>(0x3Au, SetBattleMonsterAppearancePacketCodec)
|
||||||
s2c<BattleEnumPairEventPacket>(0x3Au, BattleEnumPairEventPacketCodec)
|
s2c<BattleEnumPairEventPacket>(0x3Au, BattleEnumPairEventPacketCodec)
|
||||||
|
|
||||||
c2s<PrismaticPearlTransferPacket>(0x3Bu, PrismaticPearlTransferPacketCodec)
|
c2s<PrismaticPearlTransferPacket>(0x3Bu, PrismaticPearlTransferPacketCodec)
|
||||||
s2c<BattleEmptyEventPacket>(0x3Bu, BattleEmptyEventPacketCodec)
|
s2c<BattleEmptyEventPacket>(0x3Bu, BattleEmptyEventPacketCodec)
|
||||||
|
|
||||||
c2s<SetActiveMovesetPacket>(0x3Cu, SetActiveMovesetPacketCodec)
|
c2s<SetActiveMovesetPacket>(0x3Cu, SetActiveMovesetPacketCodec)
|
||||||
s2c<ServerChatTemplate5002Packet>(0x3Cu, ServerChatTemplate5002PacketCodec)
|
s2c<ServerChatTemplate5002Packet>(0x3Cu, ServerChatTemplate5002PacketCodec)
|
||||||
|
|
||||||
c2s<BattleCancelRequestPacket>(0x3Du, BattleCancelRequestPacketCodec)
|
c2s<BattleCancelRequestPacket>(0x3Du, BattleCancelRequestPacketCodec)
|
||||||
s2c<ServerChatTemplate5003Packet>(0x3Du, ServerChatTemplate5003PacketCodec)
|
s2c<ServerChatTemplate5003Packet>(0x3Du, ServerChatTemplate5003PacketCodec)
|
||||||
|
|
||||||
s2c<BattleSlotSwitchEventPacket>(0x3Eu, BattleSlotSwitchEventPacketCodec)
|
s2c<BattleSlotSwitchEventPacket>(0x3Eu, BattleSlotSwitchEventPacketCodec)
|
||||||
|
|
||||||
c2s<BattleSimulationRequestPacket>(0x3Fu, BattleSimulationRequestPacketCodec)
|
c2s<BattleSimulationRequestPacket>(0x3Fu, BattleSimulationRequestPacketCodec)
|
||||||
s2c<BattleMoveDisableUpdatePacket>(0x3Fu, BattleMoveDisableUpdatePacketCodec)
|
s2c<BattleMoveDisableUpdatePacket>(0x3Fu, BattleMoveDisableUpdatePacketCodec)
|
||||||
|
|
||||||
c2s<SubmitBreedingPartyPacket>(0x40u, SubmitBreedingPartyPacketCodec)
|
c2s<SubmitBreedingPartyPacket>(0x40u, SubmitBreedingPartyPacketCodec)
|
||||||
s2c<BattleSidePartyPacket>(0x40u, BattleSidePartyPacketCodec)
|
s2c<BattleSidePartyPacket>(0x40u, BattleSidePartyPacketCodec)
|
||||||
|
|
||||||
c2s<MonsterFavoriteTogglePacket>(0x41u, MonsterFavoriteTogglePacketCodec)
|
c2s<MonsterFavoriteTogglePacket>(0x41u, MonsterFavoriteTogglePacketCodec)
|
||||||
s2c<BattlePokemonSpritePacket>(0x41u, BattlePokemonSpritePacketCodec)
|
s2c<BattlePokemonSpritePacket>(0x41u, BattlePokemonSpritePacketCodec)
|
||||||
|
|
||||||
c2s<LeaveChatChannelPacket>(0x42u, LeaveChatChannelPacketCodec)
|
c2s<LeaveChatChannelPacket>(0x42u, LeaveChatChannelPacketCodec)
|
||||||
s2c<BattleSideAddPokemonPacket>(0x42u, BattleSideAddPokemonPacketCodec)
|
s2c<BattleSideAddPokemonPacket>(0x42u, BattleSideAddPokemonPacketCodec)
|
||||||
|
|
||||||
c2s<SetChatUserIgnoredPacket>(0x43u, SetChatUserIgnoredPacketCodec)
|
c2s<SetChatUserIgnoredPacket>(0x43u, SetChatUserIgnoredPacketCodec)
|
||||||
s2c<BattleSideRemovePokemonPacket>(0x43u, BattleSideRemovePokemonPacketCodec)
|
s2c<BattleSideRemovePokemonPacket>(0x43u, BattleSideRemovePokemonPacketCodec)
|
||||||
|
|
||||||
c2s<TournamentTeleportAcceptPacket>(0x44u, TournamentTeleportAcceptPacketCodec)
|
c2s<TournamentTeleportAcceptPacket>(0x44u, TournamentTeleportAcceptPacketCodec)
|
||||||
s2c<BattlePokemonStatusPacket>(0x44u, BattlePokemonStatusPacketCodec)
|
s2c<BattlePokemonStatusPacket>(0x44u, BattlePokemonStatusPacketCodec)
|
||||||
|
|
||||||
c2s<NpcDialogueChoicePacket>(0x45u, NpcDialogueChoicePacketCodec)
|
c2s<NpcDialogueChoicePacket>(0x45u, NpcDialogueChoicePacketCodec)
|
||||||
s2c<WorldStateControlPacket>(0x45u, WorldStateControlPacketCodec)
|
s2c<WorldStateControlPacket>(0x45u, WorldStateControlPacketCodec)
|
||||||
|
|
||||||
c2s<BattleReadyPacket>(0x46u, BattleReadyPacketCodec)
|
c2s<BattleReadyPacket>(0x46u, BattleReadyPacketCodec)
|
||||||
s2c<BattleControlBytesPacket>(0x46u, BattleControlBytesPacketCodec)
|
s2c<BattleControlBytesPacket>(0x46u, BattleControlBytesPacketCodec)
|
||||||
|
|
||||||
c2s<LeaveMatchmakingQueuePacket>(0x47u, LeaveMatchmakingQueuePacketCodec)
|
c2s<LeaveMatchmakingQueuePacket>(0x47u, LeaveMatchmakingQueuePacketCodec)
|
||||||
s2c<BattleScreenOpenPacket>(0x47u, BattleScreenOpenPacketCodec)
|
s2c<BattleScreenOpenPacket>(0x47u, BattleScreenOpenPacketCodec)
|
||||||
|
|
||||||
c2s<BattleActionSubmitPacket>(0x48u, BattleActionSubmitPacketCodec)
|
c2s<BattleActionSubmitPacket>(0x48u, BattleActionSubmitPacketCodec)
|
||||||
s2c<BattleActionResultPacket>(0x48u, BattleActionResultPacketCodec)
|
s2c<BattleActionResultPacket>(0x48u, BattleActionResultPacketCodec)
|
||||||
|
|
||||||
c2s<JoinMatchmakingQueuePacket>(0x49u, JoinMatchmakingQueuePacketCodec)
|
c2s<JoinMatchmakingQueuePacket>(0x49u, JoinMatchmakingQueuePacketCodec)
|
||||||
s2c<BattleMoveSelectionCancelPacket>(0x49u, BattleMoveSelectionCancelPacketCodec)
|
s2c<BattleMoveSelectionCancelPacket>(0x49u, BattleMoveSelectionCancelPacketCodec)
|
||||||
|
|
||||||
c2s<BattleTierSelectPacket>(0x4Au, BattleTierSelectPacketCodec)
|
c2s<BattleTierSelectPacket>(0x4Au, BattleTierSelectPacketCodec)
|
||||||
s2c<BattleRatingBulkPacket>(0x4Au, BattleRatingBulkPacketCodec)
|
s2c<BattleRatingBulkPacket>(0x4Au, BattleRatingBulkPacketCodec)
|
||||||
|
|
||||||
c2s<BattleChatMessagePacket>(0x4Bu, BattleChatMessagePacketCodec)
|
c2s<BattleChatMessagePacket>(0x4Bu, BattleChatMessagePacketCodec)
|
||||||
s2c<BattleRatingUpdatePacket>(0x4Bu, BattleRatingUpdatePacketCodec)
|
s2c<BattleRatingUpdatePacket>(0x4Bu, BattleRatingUpdatePacketCodec)
|
||||||
|
|
||||||
c2s<MatchmakingActionPacket>(0x4Cu, MatchmakingActionPacketCodec)
|
c2s<MatchmakingActionPacket>(0x4Cu, MatchmakingActionPacketCodec)
|
||||||
s2c<BattleMoveTargetsPacket>(0x4Cu, BattleMoveTargetsPacketCodec)
|
s2c<BattleMoveTargetsPacket>(0x4Cu, BattleMoveTargetsPacketCodec)
|
||||||
|
|
||||||
c2s<MarketListingsRequestPacket>(0x4Du, MarketListingsRequestPacketCodec)
|
c2s<MarketListingsRequestPacket>(0x4Du, MarketListingsRequestPacketCodec)
|
||||||
s2c<BattleStateBytePacket>(0x4Du, BattleStateBytePacketCodec)
|
s2c<BattleStateBytePacket>(0x4Du, BattleStateBytePacketCodec)
|
||||||
|
|
||||||
s2c<BattleMoveListPacket>(0x4Eu, BattleMoveListPacketCodec)
|
s2c<BattleMoveListPacket>(0x4Eu, BattleMoveListPacketCodec)
|
||||||
|
|
||||||
c2s<MarketSearchFilterPacket>(0x4Fu, MarketSearchFilterPacketCodec)
|
c2s<MarketSearchFilterPacket>(0x4Fu, MarketSearchFilterPacketCodec)
|
||||||
s2c<ChannelAssignmentsPacket>(0x4Fu, ChannelAssignmentsPacketCodec)
|
s2c<ChannelAssignmentsPacket>(0x4Fu, ChannelAssignmentsPacketCodec)
|
||||||
|
|
||||||
c2s<TradeActionPacket>(0x50u, TradeActionPacketCodec)
|
c2s<TradeActionPacket>(0x50u, TradeActionPacketCodec)
|
||||||
s2c<DuelInvitePacket>(0x50u, DuelInvitePacketCodec)
|
s2c<DuelInvitePacket>(0x50u, DuelInvitePacketCodec)
|
||||||
|
|
||||||
c2s<StringCommandPacket>(0x51u, StringCommandPacketCodec)
|
c2s<StringCommandPacket>(0x51u, StringCommandPacketCodec)
|
||||||
s2c<DuelInviteOutcomePacket>(0x51u, DuelInviteOutcomePacketCodec)
|
s2c<DuelInviteOutcomePacket>(0x51u, DuelInviteOutcomePacketCodec)
|
||||||
|
|
||||||
c2s<TradeSelectMonPacket>(0x52u, TradeSelectMonPacketCodec)
|
c2s<TradeSelectMonPacket>(0x52u, TradeSelectMonPacketCodec)
|
||||||
s2c<TradeListEntryPacket>(0x52u, TradeListEntryPacketCodec)
|
s2c<TradeListEntryPacket>(0x52u, TradeListEntryPacketCodec)
|
||||||
|
|
||||||
c2s<BattlePartySlotSelectPacket>(0x53u, BattlePartySlotSelectPacketCodec)
|
c2s<BattlePartySlotSelectPacket>(0x53u, BattlePartySlotSelectPacketCodec)
|
||||||
s2c<BattleStateSlotIntPacket>(0x53u, BattleStateSlotIntPacketCodec)
|
s2c<BattleStateSlotIntPacket>(0x53u, BattleStateSlotIntPacketCodec)
|
||||||
|
|
||||||
s2c<BattleBoardCellPacket>(0x54u, BattleBoardCellPacketCodec)
|
s2c<BattleBoardCellPacket>(0x54u, BattleBoardCellPacketCodec)
|
||||||
|
|
||||||
s2c<SpatialGroupSnapshotPacket>(0x55u, SpatialGroupSnapshotPacketCodec)
|
s2c<SpatialGroupSnapshotPacket>(0x55u, SpatialGroupSnapshotPacketCodec)
|
||||||
|
|
||||||
s2c<SpatialGroupInsertPacket>(0x56u, SpatialGroupInsertPacketCodec)
|
s2c<SpatialGroupInsertPacket>(0x56u, SpatialGroupInsertPacketCodec)
|
||||||
|
|
||||||
s2c<SpatialGroupDeletePacket>(0x57u, SpatialGroupDeletePacketCodec)
|
s2c<SpatialGroupDeletePacket>(0x57u, SpatialGroupDeletePacketCodec)
|
||||||
|
|
||||||
s2c<MenuVisibilityPacket>(0x58u, MenuVisibilityPacketCodec)
|
s2c<MenuVisibilityPacket>(0x58u, MenuVisibilityPacketCodec)
|
||||||
|
|
||||||
s2c<MenuPagePayloadPacket>(0x59u, MenuPagePayloadPacketCodec)
|
s2c<MenuPagePayloadPacket>(0x59u, MenuPagePayloadPacketCodec)
|
||||||
|
|
||||||
s2c<EntityNameChoicesPacket>(0x5Au, EntityNameChoicesPacketCodec)
|
s2c<EntityNameChoicesPacket>(0x5Au, EntityNameChoicesPacketCodec)
|
||||||
|
|
||||||
s2c<OptionListWindowPacket>(0x5Bu, OptionListWindowPacketCodec)
|
s2c<OptionListWindowPacket>(0x5Bu, OptionListWindowPacketCodec)
|
||||||
|
|
||||||
s2c<ListWindowPagePacket>(0x5Cu, ListWindowPagePacketCodec)
|
s2c<ListWindowPagePacket>(0x5Cu, ListWindowPagePacketCodec)
|
||||||
|
|
||||||
s2c<MarketBoardPagePacket>(0x5Du, MarketBoardPagePacketCodec)
|
s2c<MarketBoardPagePacket>(0x5Du, MarketBoardPagePacketCodec)
|
||||||
|
|
||||||
s2c<SceneObjectStatesPacket>(0x5Eu, SceneObjectStatesPacketCodec)
|
s2c<SceneObjectStatesPacket>(0x5Eu, SceneObjectStatesPacketCodec)
|
||||||
|
|
||||||
s2c<StorageInventoryPacket>(0x5Fu, StorageInventoryPacketCodec)
|
s2c<StorageInventoryPacket>(0x5Fu, StorageInventoryPacketCodec)
|
||||||
|
|
||||||
c2s<BlockPlayerPacket>(0x60u, BlockPlayerPacketCodec)
|
c2s<BlockPlayerPacket>(0x60u, BlockPlayerPacketCodec)
|
||||||
s2c<StorageContextWindowPacket>(0x60u, StorageContextWindowPacketCodec)
|
s2c<StorageContextWindowPacket>(0x60u, StorageContextWindowPacketCodec)
|
||||||
|
|
||||||
c2s<UnblockPlayerPacket>(0x61u, UnblockPlayerPacketCodec)
|
c2s<UnblockPlayerPacket>(0x61u, UnblockPlayerPacketCodec)
|
||||||
s2c<EntityCoordSyncPacket>(0x61u, EntityCoordSyncPacketCodec)
|
s2c<EntityCoordSyncPacket>(0x61u, EntityCoordSyncPacketCodec)
|
||||||
|
|
||||||
c2s<AddFriendPacket>(0x62u, AddFriendPacketCodec)
|
c2s<AddFriendPacket>(0x62u, AddFriendPacketCodec)
|
||||||
s2c<SocialActionOutcomePacket>(0x62u, SocialActionOutcomePacketCodec)
|
s2c<SocialActionOutcomePacket>(0x62u, SocialActionOutcomePacketCodec)
|
||||||
|
|
||||||
c2s<RemoveFriendPacket>(0x63u, RemoveFriendPacketCodec)
|
c2s<RemoveFriendPacket>(0x63u, RemoveFriendPacketCodec)
|
||||||
s2c<FriendListPacket>(0x63u, FriendListPacketCodec)
|
s2c<FriendListPacket>(0x63u, FriendListPacketCodec)
|
||||||
|
|
||||||
c2s<FriendProfileRequestPacket>(0x64u, FriendProfileRequestPacketCodec)
|
c2s<FriendProfileRequestPacket>(0x64u, FriendProfileRequestPacketCodec)
|
||||||
s2c<ContactInsertPacket>(0x64u, ContactInsertPacketCodec)
|
s2c<ContactInsertPacket>(0x64u, ContactInsertPacketCodec)
|
||||||
|
|
||||||
s2c<ContactDeletePacket>(0x65u, ContactDeletePacketCodec)
|
s2c<ContactDeletePacket>(0x65u, ContactDeletePacketCodec)
|
||||||
|
|
||||||
s2c<ContactOnlineStatePacket>(0x66u, ContactOnlineStatePacketCodec)
|
s2c<ContactOnlineStatePacket>(0x66u, ContactOnlineStatePacketCodec)
|
||||||
|
|
||||||
s2c<PartyRosterPacket>(0x67u, PartyRosterPacketCodec)
|
s2c<PartyRosterPacket>(0x67u, PartyRosterPacketCodec)
|
||||||
|
|
||||||
s2c<PartyMemberJoinPacket>(0x68u, PartyMemberJoinPacketCodec)
|
s2c<PartyMemberJoinPacket>(0x68u, PartyMemberJoinPacketCodec)
|
||||||
|
|
||||||
s2c<PartyMemberLeavePacket>(0x69u, PartyMemberLeavePacketCodec)
|
s2c<PartyMemberLeavePacket>(0x69u, PartyMemberLeavePacketCodec)
|
||||||
|
|
||||||
c2s<InstanceReadyCheckPacket>(0x6Au, InstanceReadyCheckPacketCodec)
|
c2s<InstanceReadyCheckPacket>(0x6Au, InstanceReadyCheckPacketCodec)
|
||||||
|
|
||||||
c2s<CancelMatchmakingSearchPacket>(0x6Bu, CancelMatchmakingSearchPacketCodec)
|
c2s<CancelMatchmakingSearchPacket>(0x6Bu, CancelMatchmakingSearchPacketCodec)
|
||||||
s2c<ActiveBattleSidePacket>(0x6Bu, ActiveBattleSidePacketCodec)
|
s2c<ActiveBattleSidePacket>(0x6Bu, ActiveBattleSidePacketCodec)
|
||||||
|
|
||||||
c2s<MatchmakingLanguagePrefsPacket>(0x6Cu, MatchmakingLanguagePrefsPacketCodec)
|
c2s<MatchmakingLanguagePrefsPacket>(0x6Cu, MatchmakingLanguagePrefsPacketCodec)
|
||||||
s2c<MountMoveCooldownPacket>(0x6Cu, MountMoveCooldownPacketCodec)
|
s2c<MountMoveCooldownPacket>(0x6Cu, MountMoveCooldownPacketCodec)
|
||||||
|
|
||||||
s2c<ClientCookieUpdatePacket>(0x6Du, ClientCookieUpdatePacketCodec)
|
s2c<ClientCookieUpdatePacket>(0x6Du, ClientCookieUpdatePacketCodec)
|
||||||
|
|
||||||
s2c<WorldToggleFlagsPacket>(0x6Eu, WorldToggleFlagsPacketCodec)
|
s2c<WorldToggleFlagsPacket>(0x6Eu, WorldToggleFlagsPacketCodec)
|
||||||
|
|
||||||
s2c<NamedCategoryEntriesPacket>(0x6Fu, NamedCategoryEntriesPacketCodec)
|
s2c<NamedCategoryEntriesPacket>(0x6Fu, NamedCategoryEntriesPacketCodec)
|
||||||
|
|
||||||
c2s<StorageBoxRequestPacket>(0x70u, StorageBoxRequestPacketCodec)
|
c2s<StorageBoxRequestPacket>(0x70u, StorageBoxRequestPacketCodec)
|
||||||
s2c<GtlMarketListingsPacket>(0x70u, GtlMarketListingsPacketCodec)
|
s2c<GtlMarketListingsPacket>(0x70u, GtlMarketListingsPacketCodec)
|
||||||
|
|
||||||
c2s<GtlPurchaseListingPacket>(0x71u, GtlPurchaseListingPacketCodec)
|
c2s<GtlPurchaseListingPacket>(0x71u, GtlPurchaseListingPacketCodec)
|
||||||
s2c<MatchmakingRentalsPacket>(0x71u, MatchmakingRentalsPacketCodec)
|
s2c<MatchmakingRentalsPacket>(0x71u, MatchmakingRentalsPacketCodec)
|
||||||
|
|
||||||
s2c<WorldStateValuePacket>(0x72u, WorldStateValuePacketCodec)
|
s2c<WorldStateValuePacket>(0x72u, WorldStateValuePacketCodec)
|
||||||
|
|
||||||
c2s<AssignBreedingSlotPacket>(0x73u, AssignBreedingSlotPacketCodec)
|
c2s<AssignBreedingSlotPacket>(0x73u, AssignBreedingSlotPacketCodec)
|
||||||
s2c<BreedingForecastPacket>(0x73u, BreedingForecastPacketCodec)
|
s2c<BreedingForecastPacket>(0x73u, BreedingForecastPacketCodec)
|
||||||
|
|
||||||
c2s<LeaderboardViewRequestPacket>(0x74u, LeaderboardViewRequestPacketCodec)
|
c2s<LeaderboardViewRequestPacket>(0x74u, LeaderboardViewRequestPacketCodec)
|
||||||
s2c<ServerNoticePacket>(0x74u, ServerNoticePacketCodec)
|
s2c<ServerNoticePacket>(0x74u, ServerNoticePacketCodec)
|
||||||
|
|
||||||
c2s<TourneyRegistrationPacket>(0x75u, TourneyRegistrationPacketCodec)
|
c2s<TourneyRegistrationPacket>(0x75u, TourneyRegistrationPacketCodec)
|
||||||
s2c<MatchmakingSideTeamPacket>(0x75u, MatchmakingSideTeamPacketCodec)
|
s2c<MatchmakingSideTeamPacket>(0x75u, MatchmakingSideTeamPacketCodec)
|
||||||
|
|
||||||
c2s<NpcInteractionChoicePacket>(0x76u, NpcInteractionChoicePacketCodec)
|
c2s<NpcInteractionChoicePacket>(0x76u, NpcInteractionChoicePacketCodec)
|
||||||
s2c<ActivePokemonSummaryPacket>(0x76u, ActivePokemonSummaryPacketCodec)
|
s2c<ActivePokemonSummaryPacket>(0x76u, ActivePokemonSummaryPacketCodec)
|
||||||
|
|
||||||
c2s<BattleTargetPickPacket>(0x77u, BattleTargetPickPacketCodec)
|
c2s<BattleTargetPickPacket>(0x77u, BattleTargetPickPacketCodec)
|
||||||
s2c<StreamChunkPacket>(0x77u, StreamChunkPacketCodec)
|
s2c<StreamChunkPacket>(0x77u, StreamChunkPacketCodec)
|
||||||
|
|
||||||
s2c<MatchmakingMemberProgressPacket>(0x78u, MatchmakingMemberProgressPacketCodec)
|
s2c<MatchmakingMemberProgressPacket>(0x78u, MatchmakingMemberProgressPacketCodec)
|
||||||
|
|
||||||
c2s<PcBoxStorePacket>(0x79u, PcBoxStorePacketCodec)
|
c2s<PcBoxStorePacket>(0x79u, PcBoxStorePacketCodec)
|
||||||
s2c<BattleStatCountersPacket>(0x79u, BattleStatCountersPacketCodec)
|
s2c<BattleStatCountersPacket>(0x79u, BattleStatCountersPacketCodec)
|
||||||
|
|
||||||
c2s<PcBoxRenamePacket>(0x7Au, PcBoxRenamePacketCodec)
|
c2s<PcBoxRenamePacket>(0x7Au, PcBoxRenamePacketCodec)
|
||||||
s2c<LearnedMovesetPacket>(0x7Au, LearnedMovesetPacketCodec)
|
s2c<LearnedMovesetPacket>(0x7Au, LearnedMovesetPacketCodec)
|
||||||
|
|
||||||
c2s<CoopScoreboardRequestPacket>(0x7Bu, CoopScoreboardRequestPacketCodec)
|
c2s<CoopScoreboardRequestPacket>(0x7Bu, CoopScoreboardRequestPacketCodec)
|
||||||
s2c<TournamentMatchupsPacket>(0x7Bu, TournamentMatchupsPacketCodec)
|
s2c<TournamentMatchupsPacket>(0x7Bu, TournamentMatchupsPacketCodec)
|
||||||
|
|
||||||
c2s<GtlListingSearchPacket>(0x7Cu, GtlListingSearchPacketCodec)
|
c2s<GtlListingSearchPacket>(0x7Cu, GtlListingSearchPacketCodec)
|
||||||
s2c<GtlItemMarketPacket>(0x7Cu, GtlItemMarketPacketCodec)
|
s2c<GtlItemMarketPacket>(0x7Cu, GtlItemMarketPacketCodec)
|
||||||
|
|
||||||
s2c<GameShopCatalogPacket>(0x7Du, GameShopCatalogPacketCodec)
|
s2c<GameShopCatalogPacket>(0x7Du, GameShopCatalogPacketCodec)
|
||||||
|
|
||||||
s2c<EggIncubatorSlotsPacket>(0x7Eu, EggIncubatorSlotsPacketCodec)
|
s2c<EggIncubatorSlotsPacket>(0x7Eu, EggIncubatorSlotsPacketCodec)
|
||||||
|
|
||||||
s2c<GtlPriceHistoryPacket>(0x7Fu, GtlPriceHistoryPacketCodec)
|
s2c<GtlPriceHistoryPacket>(0x7Fu, GtlPriceHistoryPacketCodec)
|
||||||
|
|
||||||
c2s<TeamFoundPacket>(0x80u, TeamFoundPacketCodec)
|
c2s<TeamFoundPacket>(0x80u, TeamFoundPacketCodec)
|
||||||
s2c<GuildMembershipPacket>(0x80u, GuildMembershipPacketCodec)
|
s2c<GuildMembershipPacket>(0x80u, GuildMembershipPacketCodec)
|
||||||
|
|
||||||
c2s<GuildMotdUpdatePacket>(0x81u, GuildMotdUpdatePacketCodec)
|
c2s<GuildMotdUpdatePacket>(0x81u, GuildMotdUpdatePacketCodec)
|
||||||
s2c<GuildProfileSyncPacket>(0x81u, GuildProfileSyncPacketCodec)
|
s2c<GuildProfileSyncPacket>(0x81u, GuildProfileSyncPacketCodec)
|
||||||
|
|
||||||
c2s<GuildDepartPacket>(0x82u, GuildDepartPacketCodec)
|
c2s<GuildDepartPacket>(0x82u, GuildDepartPacketCodec)
|
||||||
|
|
||||||
c2s<GuildChatSendPacket>(0x83u, GuildChatSendPacketCodec)
|
c2s<GuildChatSendPacket>(0x83u, GuildChatSendPacketCodec)
|
||||||
s2c<GuildRosterAddPacket>(0x83u, GuildRosterAddPacketCodec)
|
s2c<GuildRosterAddPacket>(0x83u, GuildRosterAddPacketCodec)
|
||||||
|
|
||||||
c2s<GuildMemberRankAssignPacket>(0x84u, GuildMemberRankAssignPacketCodec)
|
c2s<GuildMemberRankAssignPacket>(0x84u, GuildMemberRankAssignPacketCodec)
|
||||||
s2c<GuildMemberRankChangePacket>(0x84u, GuildMemberRankChangePacketCodec)
|
s2c<GuildMemberRankChangePacket>(0x84u, GuildMemberRankChangePacketCodec)
|
||||||
|
|
||||||
c2s<GuildMemberExpelPacket>(0x85u, GuildMemberExpelPacketCodec)
|
c2s<GuildMemberExpelPacket>(0x85u, GuildMemberExpelPacketCodec)
|
||||||
s2c<GuildRosterRemovePacket>(0x85u, GuildRosterRemovePacketCodec)
|
s2c<GuildRosterRemovePacket>(0x85u, GuildRosterRemovePacketCodec)
|
||||||
|
|
||||||
c2s<GuildRankPermissionUpdatePacket>(0x86u, GuildRankPermissionUpdatePacketCodec)
|
c2s<GuildRankPermissionUpdatePacket>(0x86u, GuildRankPermissionUpdatePacketCodec)
|
||||||
s2c<GuildMemberPresencePacket>(0x86u, GuildMemberPresencePacketCodec)
|
s2c<GuildMemberPresencePacket>(0x86u, GuildMemberPresencePacketCodec)
|
||||||
|
|
||||||
c2s<GuildDisbandToggleRequestPacket>(0x87u, GuildDisbandToggleRequestPacketCodec)
|
c2s<GuildDisbandToggleRequestPacket>(0x87u, GuildDisbandToggleRequestPacketCodec)
|
||||||
s2c<ContactCategoryGroupPacket>(0x87u, ContactCategoryGroupPacketCodec)
|
s2c<ContactCategoryGroupPacket>(0x87u, ContactCategoryGroupPacketCodec)
|
||||||
|
|
||||||
c2s<GuildRankLabelUpdatePacket>(0x88u, GuildRankLabelUpdatePacketCodec)
|
c2s<GuildRankLabelUpdatePacket>(0x88u, GuildRankLabelUpdatePacketCodec)
|
||||||
s2c<GuildRosterBulkPacket>(0x88u, GuildRosterBulkPacketCodec)
|
s2c<GuildRosterBulkPacket>(0x88u, GuildRosterBulkPacketCodec)
|
||||||
|
|
||||||
c2s<GuildActivityLogPageRequestPacket>(0x89u, GuildActivityLogPageRequestPacketCodec)
|
c2s<GuildActivityLogPageRequestPacket>(0x89u, GuildActivityLogPageRequestPacketCodec)
|
||||||
s2c<GuildActivityLogPacket>(0x89u, GuildActivityLogPacketCodec)
|
s2c<GuildActivityLogPacket>(0x89u, GuildActivityLogPacketCodec)
|
||||||
|
|
||||||
c2s<MailAttachmentRequestPacket>(0x8Au, MailAttachmentRequestPacketCodec)
|
c2s<MailAttachmentRequestPacket>(0x8Au, MailAttachmentRequestPacketCodec)
|
||||||
|
|
||||||
s2c<MonsterRecordBookPacket>(0x8Bu, MonsterRecordBookPacketCodec)
|
s2c<MonsterRecordBookPacket>(0x8Bu, MonsterRecordBookPacketCodec)
|
||||||
|
|
||||||
s2c<ChatChannelMessagesPacket>(0x8Cu, ChatChannelMessagesPacketCodec)
|
s2c<ChatChannelMessagesPacket>(0x8Cu, ChatChannelMessagesPacketCodec)
|
||||||
|
|
||||||
s2c<ChatChannelUserListPacket>(0x8Du, ChatChannelUserListPacketCodec)
|
s2c<ChatChannelUserListPacket>(0x8Du, ChatChannelUserListPacketCodec)
|
||||||
|
|
||||||
s2c<ChannelCountDeltaPacket>(0x8Eu, ChannelCountDeltaPacketCodec)
|
s2c<ChannelCountDeltaPacket>(0x8Eu, ChannelCountDeltaPacketCodec)
|
||||||
|
|
||||||
s2c<ChatMessageWithdrawPacket>(0x8Fu, ChatMessageWithdrawPacketCodec)
|
s2c<ChatMessageWithdrawPacket>(0x8Fu, ChatMessageWithdrawPacketCodec)
|
||||||
|
|
||||||
c2s<OverworldPathToTilePacket>(0x90u, OverworldPathToTilePacketCodec)
|
c2s<OverworldPathToTilePacket>(0x90u, OverworldPathToTilePacketCodec)
|
||||||
s2c<EntitySpriteChangePacket>(0x90u, EntitySpriteChangePacketCodec)
|
s2c<EntitySpriteChangePacket>(0x90u, EntitySpriteChangePacketCodec)
|
||||||
|
|
||||||
c2s<OverworldStepMovePacket>(0x91u, OverworldStepMovePacketCodec)
|
c2s<OverworldStepMovePacket>(0x91u, OverworldStepMovePacketCodec)
|
||||||
s2c<OpenAppearanceEditorPacket>(0x91u, OpenAppearanceEditorPacketCodec)
|
s2c<OpenAppearanceEditorPacket>(0x91u, OpenAppearanceEditorPacketCodec)
|
||||||
|
|
||||||
c2s<BattleTransitionReadyPacket>(0x92u, BattleTransitionReadyPacketCodec)
|
c2s<BattleTransitionReadyPacket>(0x92u, BattleTransitionReadyPacketCodec)
|
||||||
s2c<AppearanceRequestResultPacket>(0x92u, AppearanceRequestResultPacketCodec)
|
s2c<AppearanceRequestResultPacket>(0x92u, AppearanceRequestResultPacketCodec)
|
||||||
|
|
||||||
c2s<PendingRequestCancelPacket>(0x93u, PendingRequestCancelPacketCodec)
|
c2s<PendingRequestCancelPacket>(0x93u, PendingRequestCancelPacketCodec)
|
||||||
s2c<BattleStatStagePacket>(0x93u, BattleStatStagePacketCodec)
|
s2c<BattleStatStagePacket>(0x93u, BattleStatStagePacketCodec)
|
||||||
|
|
||||||
c2s<PartyInfoRequestPacket>(0x94u, PartyInfoRequestPacketCodec)
|
c2s<PartyInfoRequestPacket>(0x94u, PartyInfoRequestPacketCodec)
|
||||||
s2c<EntityAppearanceSyncPacket>(0x94u, EntityAppearanceSyncPacketCodec)
|
s2c<EntityAppearanceSyncPacket>(0x94u, EntityAppearanceSyncPacketCodec)
|
||||||
|
|
||||||
c2s<MailComposeSendPacket>(0x95u, MailComposeSendPacketCodec)
|
c2s<MailComposeSendPacket>(0x95u, MailComposeSendPacketCodec)
|
||||||
s2c<BattleSwitchPromptTogglePacket>(0x95u, BattleSwitchPromptTogglePacketCodec)
|
s2c<BattleSwitchPromptTogglePacket>(0x95u, BattleSwitchPromptTogglePacketCodec)
|
||||||
|
|
||||||
c2s<TeamPreviewRevealPickPacket>(0x96u, TeamPreviewRevealPickPacketCodec)
|
c2s<TeamPreviewRevealPickPacket>(0x96u, TeamPreviewRevealPickPacketCodec)
|
||||||
s2c<BattleEndDisconnectPacket>(0x96u, BattleEndDisconnectPacketCodec)
|
s2c<BattleEndDisconnectPacket>(0x96u, BattleEndDisconnectPacketCodec)
|
||||||
|
|
||||||
c2s<TeamPreviewSidePickPacket>(0x97u, TeamPreviewSidePickPacketCodec)
|
c2s<TeamPreviewSidePickPacket>(0x97u, TeamPreviewSidePickPacketCodec)
|
||||||
s2c<BattleTeamPreviewListPacket>(0x97u, BattleTeamPreviewListPacketCodec)
|
s2c<BattleTeamPreviewListPacket>(0x97u, BattleTeamPreviewListPacketCodec)
|
||||||
|
|
||||||
c2s<TeamPreviewLeadSubmitPacket>(0x98u, TeamPreviewLeadSubmitPacketCodec)
|
c2s<TeamPreviewLeadSubmitPacket>(0x98u, TeamPreviewLeadSubmitPacketCodec)
|
||||||
s2c<WorldVersionPacket>(0x98u, WorldVersionPacketCodec)
|
s2c<WorldVersionPacket>(0x98u, WorldVersionPacketCodec)
|
||||||
|
|
||||||
c2s<BattleTeamPreviewConfirmPacket>(0x99u, BattleTeamPreviewConfirmPacketCodec)
|
c2s<BattleTeamPreviewConfirmPacket>(0x99u, BattleTeamPreviewConfirmPacketCodec)
|
||||||
s2c<BattleSendOutActivePacket>(0x99u, BattleSendOutActivePacketCodec)
|
s2c<BattleSendOutActivePacket>(0x99u, BattleSendOutActivePacketCodec)
|
||||||
|
|
||||||
c2s<CreateMarketListingPacket>(0x9Au, CreateMarketListingPacketCodec)
|
c2s<CreateMarketListingPacket>(0x9Au, CreateMarketListingPacketCodec)
|
||||||
s2c<BattleSlotAnimationResetPacket>(0x9Au, BattleSlotAnimationResetPacketCodec)
|
s2c<BattleSlotAnimationResetPacket>(0x9Au, BattleSlotAnimationResetPacketCodec)
|
||||||
|
|
||||||
c2s<GtlSellPokemonListingPacket>(0x9Bu, GtlSellPokemonListingPacketCodec)
|
c2s<GtlSellPokemonListingPacket>(0x9Bu, GtlSellPokemonListingPacketCodec)
|
||||||
s2c<BattleActionOutcomePacket>(0x9Bu, BattleActionOutcomePacketCodec)
|
s2c<BattleActionOutcomePacket>(0x9Bu, BattleActionOutcomePacketCodec)
|
||||||
|
|
||||||
c2s<GtlConfirmPurchasePacket>(0x9Cu, GtlConfirmPurchasePacketCodec)
|
c2s<GtlConfirmPurchasePacket>(0x9Cu, GtlConfirmPurchasePacketCodec)
|
||||||
s2c<BattleDisconnectMessagePacket>(0x9Cu, BattleDisconnectMessagePacketCodec)
|
s2c<BattleDisconnectMessagePacket>(0x9Cu, BattleDisconnectMessagePacketCodec)
|
||||||
|
|
||||||
c2s<SelectSinglePokemonPacket>(0x9Du, SelectSinglePokemonPacketCodec)
|
c2s<SelectSinglePokemonPacket>(0x9Du, SelectSinglePokemonPacketCodec)
|
||||||
s2c<BattleActionPromptTogglePacket>(0x9Du, BattleActionPromptTogglePacketCodec)
|
s2c<BattleActionPromptTogglePacket>(0x9Du, BattleActionPromptTogglePacketCodec)
|
||||||
|
|
||||||
c2s<SelectPartyPokemonPacket>(0x9Eu, SelectPartyPokemonPacketCodec)
|
c2s<SelectPartyPokemonPacket>(0x9Eu, SelectPartyPokemonPacketCodec)
|
||||||
s2c<EntityEmoteBubblePacket>(0x9Eu, EntityEmoteBubblePacketCodec)
|
s2c<EntityEmoteBubblePacket>(0x9Eu, EntityEmoteBubblePacketCodec)
|
||||||
|
|
||||||
c2s<GtlTradeLogRequestPacket>(0x9Fu, GtlTradeLogRequestPacketCodec)
|
c2s<GtlTradeLogRequestPacket>(0x9Fu, GtlTradeLogRequestPacketCodec)
|
||||||
|
|
||||||
c2s<PlayerChatInputPacket>(0xA0u, PlayerChatInputPacketCodec)
|
c2s<PlayerChatInputPacket>(0xA0u, PlayerChatInputPacketCodec)
|
||||||
s2c<FriendRosterPacket>(0xA0u, FriendRosterPacketCodec)
|
s2c<FriendRosterPacket>(0xA0u, FriendRosterPacketCodec)
|
||||||
|
|
||||||
c2s<GtlListingCancelPacket>(0xA1u, GtlListingCancelPacketCodec)
|
c2s<GtlListingCancelPacket>(0xA1u, GtlListingCancelPacketCodec)
|
||||||
s2c<GmPlayerLookupPacket>(0xA1u, GmPlayerLookupPacketCodec)
|
s2c<GmPlayerLookupPacket>(0xA1u, GmPlayerLookupPacketCodec)
|
||||||
|
|
||||||
c2s<AdminNoteActionPacket>(0xA2u, AdminNoteActionPacketCodec)
|
c2s<AdminNoteActionPacket>(0xA2u, AdminNoteActionPacketCodec)
|
||||||
s2c<GmPanelVariantPacket>(0xA2u, GmPanelVariantPacketCodec)
|
s2c<GmPanelVariantPacket>(0xA2u, GmPanelVariantPacketCodec)
|
||||||
|
|
||||||
c2s<GtlPurchasePacket>(0xA3u, GtlPurchasePacketCodec)
|
c2s<GtlPurchasePacket>(0xA3u, GtlPurchasePacketCodec)
|
||||||
s2c<EntityNameVisibilityPacket>(0xA3u, EntityNameVisibilityPacketCodec)
|
s2c<EntityNameVisibilityPacket>(0xA3u, EntityNameVisibilityPacketCodec)
|
||||||
|
|
||||||
c2s<GtlListingActionPacket>(0xA4u, GtlListingActionPacketCodec)
|
c2s<GtlListingActionPacket>(0xA4u, GtlListingActionPacketCodec)
|
||||||
s2c<HighScoreBoardPacket>(0xA4u, HighScoreBoardPacketCodec)
|
s2c<HighScoreBoardPacket>(0xA4u, HighScoreBoardPacketCodec)
|
||||||
|
|
||||||
c2s<GtlOpenSessionPacket>(0xA5u, GtlOpenSessionPacketCodec)
|
c2s<GtlOpenSessionPacket>(0xA5u, GtlOpenSessionPacketCodec)
|
||||||
s2c<WorldNoticeSlotPacket>(0xA5u, WorldNoticeSlotPacketCodec)
|
s2c<WorldNoticeSlotPacket>(0xA5u, WorldNoticeSlotPacketCodec)
|
||||||
|
|
||||||
c2s<DataDigestSyncResponsePacket>(0xA6u, DataDigestSyncResponsePacketCodec)
|
c2s<DataDigestSyncResponsePacket>(0xA6u, DataDigestSyncResponsePacketCodec)
|
||||||
s2c<DataDigestSyncPacket>(0xA6u, DataDigestSyncPacketCodec)
|
s2c<DataDigestSyncPacket>(0xA6u, DataDigestSyncPacketCodec)
|
||||||
|
|
||||||
c2s<DataContentSyncBatchPacket>(0xA7u, DataContentSyncBatchPacketCodec)
|
c2s<DataContentSyncBatchPacket>(0xA7u, DataContentSyncBatchPacketCodec)
|
||||||
s2c<DataDigestSyncBatchedPacket>(0xA7u, DataDigestSyncBatchedPacketCodec)
|
s2c<DataDigestSyncBatchedPacket>(0xA7u, DataDigestSyncBatchedPacketCodec)
|
||||||
|
|
||||||
c2s<BatchInputEventsPacket>(0xA8u, BatchInputEventsPacketCodec)
|
c2s<BatchInputEventsPacket>(0xA8u, BatchInputEventsPacketCodec)
|
||||||
s2c<SelectionListWindowOpenPacket>(0xA8u, SelectionListWindowOpenPacketCodec)
|
s2c<SelectionListWindowOpenPacket>(0xA8u, SelectionListWindowOpenPacketCodec)
|
||||||
|
|
||||||
c2s<ModerationActionConfirmPacket>(0xA9u, ModerationActionConfirmPacketCodec)
|
c2s<ModerationActionConfirmPacket>(0xA9u, ModerationActionConfirmPacketCodec)
|
||||||
s2c<EntityAttributeChangePacket>(0xA9u, EntityAttributeChangePacketCodec)
|
s2c<EntityAttributeChangePacket>(0xA9u, EntityAttributeChangePacketCodec)
|
||||||
|
|
||||||
s2c<WorldFlagStateUpdatePacket>(0xAAu, WorldFlagStateUpdatePacketCodec)
|
s2c<WorldFlagStateUpdatePacket>(0xAAu, WorldFlagStateUpdatePacketCodec)
|
||||||
|
|
||||||
s2c<ChunkedTransferBeginPacket>(0xABu, ChunkedTransferBeginPacketCodec)
|
s2c<ChunkedTransferBeginPacket>(0xABu, ChunkedTransferBeginPacketCodec)
|
||||||
|
|
||||||
s2c<ChunkedTransferAppendPacket>(0xACu, ChunkedTransferAppendPacketCodec)
|
s2c<ChunkedTransferAppendPacket>(0xACu, ChunkedTransferAppendPacketCodec)
|
||||||
|
|
||||||
s2c<WorldTimedEventStatusPacket>(0xADu, WorldTimedEventStatusPacketCodec)
|
s2c<WorldTimedEventStatusPacket>(0xADu, WorldTimedEventStatusPacketCodec)
|
||||||
|
|
||||||
s2c<GroupMemberRosterPacket>(0xAEu, GroupMemberRosterPacketCodec)
|
s2c<GroupMemberRosterPacket>(0xAEu, GroupMemberRosterPacketCodec)
|
||||||
|
|
||||||
s2c<SceneEntityActionDispatchPacket>(0xB0u, SceneEntityActionDispatchPacketCodec)
|
s2c<SceneEntityActionDispatchPacket>(0xB0u, SceneEntityActionDispatchPacketCodec)
|
||||||
|
|
||||||
s2c<SocialProfileDialogOpenPacket>(0xB1u, SocialProfileDialogOpenPacketCodec)
|
s2c<SocialProfileDialogOpenPacket>(0xB1u, SocialProfileDialogOpenPacketCodec)
|
||||||
|
|
||||||
bidi<NpcAnimationPacket>(0xB2u, NpcAnimationPacketCodec)
|
bidi<NpcAnimationPacket>(0xB2u, NpcAnimationPacketCodec)
|
||||||
|
|
||||||
s2c<MapTileAttributeSetPacket>(0xB3u, MapTileAttributeSetPacketCodec)
|
s2c<MapTileAttributeSetPacket>(0xB3u, MapTileAttributeSetPacketCodec)
|
||||||
|
|
||||||
bidi<RenderScreenPacket>(0xB4u, RenderScreenPacketCodec)
|
bidi<RenderScreenPacket>(0xB4u, RenderScreenPacketCodec)
|
||||||
|
|
||||||
s2c<EntityAppearancePatchPacket>(0xB5u, EntityAppearancePatchPacketCodec)
|
s2c<EntityAppearancePatchPacket>(0xB5u, EntityAppearancePatchPacketCodec)
|
||||||
|
|
||||||
s2c<WorldActionDispatchPacket>(0xB6u, WorldActionDispatchPacketCodec)
|
s2c<WorldActionDispatchPacket>(0xB6u, WorldActionDispatchPacketCodec)
|
||||||
|
|
||||||
s2c<EntityDespawnPacket>(0xB7u, EntityDespawnPacketCodec)
|
s2c<EntityDespawnPacket>(0xB7u, EntityDespawnPacketCodec)
|
||||||
|
|
||||||
s2c<MapTileEntityStateSetPacket>(0xB8u, MapTileEntityStateSetPacketCodec)
|
s2c<MapTileEntityStateSetPacket>(0xB8u, MapTileEntityStateSetPacketCodec)
|
||||||
|
|
||||||
bidi<MapTransitionAckPacket>(0xB9u, MapTransitionAckPacketCodec)
|
bidi<MapTransitionAckPacket>(0xB9u, MapTransitionAckPacketCodec)
|
||||||
|
|
||||||
s2c<MapTileObjectSlotSetPacket>(0xBAu, MapTileObjectSlotSetPacketCodec)
|
s2c<MapTileObjectSlotSetPacket>(0xBAu, MapTileObjectSlotSetPacketCodec)
|
||||||
|
|
||||||
s2c<CameraFollowEntityPacket>(0xBBu, CameraFollowEntityPacketCodec)
|
s2c<CameraFollowEntityPacket>(0xBBu, CameraFollowEntityPacketCodec)
|
||||||
|
|
||||||
s2c<MapTileObjectRepositionPacket>(0xBCu, MapTileObjectRepositionPacketCodec)
|
s2c<MapTileObjectRepositionPacket>(0xBCu, MapTileObjectRepositionPacketCodec)
|
||||||
|
|
||||||
s2c<WorldEntityStateResetPacket>(0xBDu, WorldEntityStateResetPacketCodec)
|
s2c<WorldEntityStateResetPacket>(0xBDu, WorldEntityStateResetPacketCodec)
|
||||||
|
|
||||||
s2c<WorldOverlayObjectSetPacket>(0xBEu, WorldOverlayObjectSetPacketCodec)
|
s2c<WorldOverlayObjectSetPacket>(0xBEu, WorldOverlayObjectSetPacketCodec)
|
||||||
|
|
||||||
s2c<MapTileAnimationTogglePacket>(0xC0u, MapTileAnimationTogglePacketCodec)
|
s2c<MapTileAnimationTogglePacket>(0xC0u, MapTileAnimationTogglePacketCodec)
|
||||||
|
|
||||||
c2s<TournamentRegistrationPacket>(0xC1u, TournamentRegistrationPacketCodec)
|
c2s<TournamentRegistrationPacket>(0xC1u, TournamentRegistrationPacketCodec)
|
||||||
s2c<MapWeatherModeSetPacket>(0xC1u, MapWeatherModeSetPacketCodec)
|
s2c<MapWeatherModeSetPacket>(0xC1u, MapWeatherModeSetPacketCodec)
|
||||||
|
|
||||||
bidi<KeepAlivePacket>(0xC2u, KeepAlivePacketCodec)
|
bidi<KeepAlivePacket>(0xC2u, KeepAlivePacketCodec)
|
||||||
|
|
||||||
s2c<FieldMapTilePaletteApplyPacket>(0xC3u, FieldMapTilePaletteApplyPacketCodec)
|
s2c<FieldMapTilePaletteApplyPacket>(0xC3u, FieldMapTilePaletteApplyPacketCodec)
|
||||||
|
|
||||||
s2c<FieldMapBattleSlotTileMapPacket>(0xC4u, FieldMapBattleSlotTileMapPacketCodec)
|
s2c<FieldMapBattleSlotTileMapPacket>(0xC4u, FieldMapBattleSlotTileMapPacketCodec)
|
||||||
|
|
||||||
s2c<FieldMapBattleSlotMarkerPacket>(0xC5u, FieldMapBattleSlotMarkerPacketCodec)
|
s2c<FieldMapBattleSlotMarkerPacket>(0xC5u, FieldMapBattleSlotMarkerPacketCodec)
|
||||||
|
|
||||||
s2c<WorldObjectInstanceDespawnPacket>(0xC8u, WorldObjectInstanceDespawnPacketCodec)
|
s2c<WorldObjectInstanceDespawnPacket>(0xC8u, WorldObjectInstanceDespawnPacketCodec)
|
||||||
|
|
||||||
s2c<BattleStartScenePacket>(0xCAu, BattleStartScenePacketCodec)
|
s2c<BattleStartScenePacket>(0xCAu, BattleStartScenePacketCodec)
|
||||||
|
|
||||||
c2s<SendChatCommandPacket>(0xD0u, SendChatCommandPacketCodec)
|
c2s<SendChatCommandPacket>(0xD0u, SendChatCommandPacketCodec)
|
||||||
s2c<EntityGroupSnapshotPacket>(0xD0u, EntityGroupSnapshotPacketCodec)
|
s2c<EntityGroupSnapshotPacket>(0xD0u, EntityGroupSnapshotPacketCodec)
|
||||||
|
|
||||||
c2s<LinkKickMemberPacket>(0xD1u, LinkKickMemberPacketCodec)
|
c2s<LinkKickMemberPacket>(0xD1u, LinkKickMemberPacketCodec)
|
||||||
s2c<EntityGroupMemberAddPacket>(0xD1u, EntityGroupMemberAddPacketCodec)
|
s2c<EntityGroupMemberAddPacket>(0xD1u, EntityGroupMemberAddPacketCodec)
|
||||||
|
|
||||||
s2c<EntityGroupMemberRemovePacket>(0xD2u, EntityGroupMemberRemovePacketCodec)
|
s2c<EntityGroupMemberRemovePacket>(0xD2u, EntityGroupMemberRemovePacketCodec)
|
||||||
|
|
||||||
c2s<CancelSocialInteractionPacket>(0xD3u, CancelSocialInteractionPacketCodec)
|
c2s<CancelSocialInteractionPacket>(0xD3u, CancelSocialInteractionPacketCodec)
|
||||||
s2c<ObjectiveProgressBulkPacket>(0xD3u, ObjectiveProgressBulkPacketCodec)
|
s2c<ObjectiveProgressBulkPacket>(0xD3u, ObjectiveProgressBulkPacketCodec)
|
||||||
|
|
||||||
c2s<RequestSocialProfilePacket>(0xD4u, RequestSocialProfilePacketCodec)
|
c2s<RequestSocialProfilePacket>(0xD4u, RequestSocialProfilePacketCodec)
|
||||||
s2c<ObjectiveProgressPacket>(0xD4u, ObjectiveProgressPacketCodec)
|
s2c<ObjectiveProgressPacket>(0xD4u, ObjectiveProgressPacketCodec)
|
||||||
|
|
||||||
s2c<TrackedEntitySlotsPacket>(0xD5u, TrackedEntitySlotsPacketCodec)
|
s2c<TrackedEntitySlotsPacket>(0xD5u, TrackedEntitySlotsPacketCodec)
|
||||||
|
|
||||||
s2c<MenuPromptOpenPacket>(0xD6u, MenuPromptOpenPacketCodec)
|
s2c<MenuPromptOpenPacket>(0xD6u, MenuPromptOpenPacketCodec)
|
||||||
|
|
||||||
s2c<EntityChecklistPromptPacket>(0xD7u, EntityChecklistPromptPacketCodec)
|
s2c<EntityChecklistPromptPacket>(0xD7u, EntityChecklistPromptPacketCodec)
|
||||||
|
|
||||||
s2c<MenuPromptClosePacket>(0xD8u, MenuPromptClosePacketCodec)
|
s2c<MenuPromptClosePacket>(0xD8u, MenuPromptClosePacketCodec)
|
||||||
|
|
||||||
s2c<RequestConfirmationPromptPacket>(0xD9u, RequestConfirmationPromptPacketCodec)
|
s2c<RequestConfirmationPromptPacket>(0xD9u, RequestConfirmationPromptPacketCodec)
|
||||||
|
|
||||||
s2c<EntityPanelSelectPacket>(0xDAu, EntityPanelSelectPacketCodec)
|
s2c<EntityPanelSelectPacket>(0xDAu, EntityPanelSelectPacketCodec)
|
||||||
|
|
||||||
s2c<EntityFramesUpdatePacket>(0xDBu, EntityFramesUpdatePacketCodec)
|
s2c<EntityFramesUpdatePacket>(0xDBu, EntityFramesUpdatePacketCodec)
|
||||||
|
|
||||||
s2c<CategoryFlagsPacket>(0xDCu, CategoryFlagsPacketCodec)
|
s2c<CategoryFlagsPacket>(0xDCu, CategoryFlagsPacketCodec)
|
||||||
|
|
||||||
c2s<SaveTemplateEntryPacket>(0xE0u, SaveTemplateEntryPacketCodec)
|
c2s<SaveTemplateEntryPacket>(0xE0u, SaveTemplateEntryPacketCodec)
|
||||||
|
|
||||||
c2s<GtlCreateListingPacket>(0xE1u, GtlCreateListingPacketCodec)
|
c2s<GtlCreateListingPacket>(0xE1u, GtlCreateListingPacketCodec)
|
||||||
|
|
||||||
c2s<GtlSearchFilterPacket>(0xE2u, GtlSearchFilterPacketCodec)
|
c2s<GtlSearchFilterPacket>(0xE2u, GtlSearchFilterPacketCodec)
|
||||||
|
|
||||||
c2s<BattleRewardSelectPacket>(0xE3u, BattleRewardSelectPacketCodec)
|
c2s<BattleRewardSelectPacket>(0xE3u, BattleRewardSelectPacketCodec)
|
||||||
|
|
||||||
c2s<BattleChallengeRequestPacket>(0xE4u, BattleChallengeRequestPacketCodec)
|
c2s<BattleChallengeRequestPacket>(0xE4u, BattleChallengeRequestPacketCodec)
|
||||||
|
|
||||||
s2c<EntityMovePacket>(0xEAu, EntityMovePacketCodec)
|
s2c<EntityMovePacket>(0xEAu, EntityMovePacketCodec)
|
||||||
|
|
||||||
s2c<QueuePositionPacket>(0xF0u, QueuePositionPacketCodec)
|
s2c<QueuePositionPacket>(0xF0u, QueuePositionPacketCodec)
|
||||||
|
|
||||||
c2s<ChunkedTransferDataPacket>(0xF1u, ChunkedTransferDataPacketCodec)
|
c2s<ChunkedTransferDataPacket>(0xF1u, ChunkedTransferDataPacketCodec)
|
||||||
s2c<ViewScalePacket>(0xF1u, ViewScalePacketCodec)
|
s2c<ViewScalePacket>(0xF1u, ViewScalePacketCodec)
|
||||||
|
|
||||||
s2c<SessionExpiryInitPacket>(0xF2u, SessionExpiryInitPacketCodec)
|
s2c<SessionExpiryInitPacket>(0xF2u, SessionExpiryInitPacketCodec)
|
||||||
|
|
||||||
s2c<LocalPlayerStatePacket>(0xF3u, LocalPlayerStatePacketCodec)
|
s2c<LocalPlayerStatePacket>(0xF3u, LocalPlayerStatePacketCodec)
|
||||||
|
|
||||||
s2c<CurrencyBalancePacket>(0xF4u, CurrencyBalancePacketCodec)
|
s2c<CurrencyBalancePacket>(0xF4u, CurrencyBalancePacketCodec)
|
||||||
|
|
||||||
s2c<ServerMessagePacket>(0xF5u, ServerMessagePacketCodec)
|
s2c<ServerMessagePacket>(0xF5u, ServerMessagePacketCodec)
|
||||||
|
|
||||||
s2c<ChunkedImagePacket>(0xF6u, ChunkedImagePacketCodec)
|
s2c<ChunkedImagePacket>(0xF6u, ChunkedImagePacketCodec)
|
||||||
|
|
||||||
s2c<GmPanelEntryPacket>(0xF7u, GmPanelEntryPacketCodec)
|
s2c<GmPanelEntryPacket>(0xF7u, GmPanelEntryPacketCodec)
|
||||||
|
|
||||||
s2c<DisconnectNoticePacket>(0xF8u, DisconnectNoticePacketCodec)
|
s2c<DisconnectNoticePacket>(0xF8u, DisconnectNoticePacketCodec)
|
||||||
|
|
||||||
s2c<RosterCooldownPacket>(0xF9u, RosterCooldownPacketCodec)
|
s2c<RosterCooldownPacket>(0xF9u, RosterCooldownPacketCodec)
|
||||||
|
|
||||||
s2c<CancelEntityMessagePacket>(0xFAu, CancelEntityMessagePacketCodec)
|
s2c<CancelEntityMessagePacket>(0xFAu, CancelEntityMessagePacketCodec)
|
||||||
|
|
||||||
s2c<PlayerInputLockPacket>(0xFBu, PlayerInputLockPacketCodec)
|
s2c<PlayerInputLockPacket>(0xFBu, PlayerInputLockPacketCodec)
|
||||||
|
|
||||||
s2c<ServerEndpointListPacket>(0xFCu, ServerEndpointListPacketCodec)
|
s2c<ServerEndpointListPacket>(0xFCu, ServerEndpointListPacketCodec)
|
||||||
|
|
||||||
s2c<GtlListingsPagePacket>(0xFEu, GtlListingsPagePacketCodec)
|
s2c<GtlListingsPagePacket>(0xFEu, GtlListingsPagePacketCodec)
|
||||||
|
|
||||||
s2c<WorldSessionStatePacket>(0xFFu, WorldSessionStatePacketCodec)
|
s2c<WorldSessionStatePacket>(0xFFu, WorldSessionStatePacketCodec)
|
||||||
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+69
-69
@@ -14,75 +14,75 @@ internal val EpochSecondsS32LE: Codec<LocalDateTime> =
|
|||||||
private val TrailingBytes = bytesPrefixed(U16LE)
|
private val TrailingBytes = bytesPrefixed(U16LE)
|
||||||
|
|
||||||
class CharacterInfoCodec(private val withExtraLong: Boolean) : PacketCodec<CharacterInfo>() {
|
class CharacterInfoCodec(private val withExtraLong: Boolean) : PacketCodec<CharacterInfo>() {
|
||||||
override fun CodecScope<CharacterInfo>.body(): CharacterInfo {
|
override fun CodecScope<CharacterInfo>.body(): CharacterInfo {
|
||||||
val id = field(S64LE, CharacterInfo::id)
|
val id = field(S64LE, CharacterInfo::id)
|
||||||
val name = field(Utf16LeNullTerminated, CharacterInfo::name)
|
val name = field(Utf16LeNullTerminated, CharacterInfo::name)
|
||||||
val namePrefix = field(Utf16LeNullTerminated) { "" }
|
val namePrefix = field(Utf16LeNullTerminated) { "" }
|
||||||
val userId = field(S32LE, CharacterInfo::userId)
|
val userId = field(S32LE, CharacterInfo::userId)
|
||||||
val rivalSex = field(S8, CharacterInfo::rivalSex)
|
val rivalSex = field(S8, CharacterInfo::rivalSex)
|
||||||
val lastLogin = field(EpochSecondsS32LE, CharacterInfo::lastLogin)
|
val lastLogin = field(EpochSecondsS32LE, CharacterInfo::lastLogin)
|
||||||
if (withExtraLong) field(S64LE) { 0L }
|
if (withExtraLong) field(S64LE) { 0L }
|
||||||
val createdAt = field(EpochSecondsS32LE, CharacterInfo::createdAt)
|
val createdAt = field(EpochSecondsS32LE, CharacterInfo::createdAt)
|
||||||
field(S32LE) { 0 }
|
field(S32LE) { 0 }
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
field(S32LE) { 0 }
|
field(S32LE) { 0 }
|
||||||
val money = field(S32LE, CharacterInfo::money)
|
val money = field(S32LE, CharacterInfo::money)
|
||||||
field(S16LE) { 0 }
|
field(S16LE) { 0 }
|
||||||
field(S32LE) { 0 }
|
field(S32LE) { 0 }
|
||||||
val permissions = field(U8) { it.permissions and 0xFF }
|
val permissions = field(U8) { it.permissions and 0xFF }
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
field(S32LE) { 0 }
|
field(S32LE) { 0 }
|
||||||
repeat(8) { field(S8) { 0 } }
|
repeat(8) { field(S8) { 0 } }
|
||||||
val remainingSafariSteps = field(S16LE, CharacterInfo::remainingSafariSteps)
|
val remainingSafariSteps = field(S16LE, CharacterInfo::remainingSafariSteps)
|
||||||
val remainingSafariBalls = field(S8, CharacterInfo::remainingSafariBalls)
|
val remainingSafariBalls = field(S8, CharacterInfo::remainingSafariBalls)
|
||||||
field(S32LE) { 0 }
|
field(S32LE) { 0 }
|
||||||
val pcExtraSlots = field(S8, CharacterInfo::pcExtraSlots)
|
val pcExtraSlots = field(S8, CharacterInfo::pcExtraSlots)
|
||||||
val battleBoxExtraSlots = field(S8, CharacterInfo::battleBoxExtraSlots)
|
val battleBoxExtraSlots = field(S8, CharacterInfo::battleBoxExtraSlots)
|
||||||
val templateAmount = field(S8, CharacterInfo::templateAmount)
|
val templateAmount = field(S8, CharacterInfo::templateAmount)
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
val positionRegionId = field(S8, CharacterInfo::positionRegionId)
|
val positionRegionId = field(S8, CharacterInfo::positionRegionId)
|
||||||
val positionBankId = field(S8, CharacterInfo::positionBankId)
|
val positionBankId = field(S8, CharacterInfo::positionBankId)
|
||||||
val positionMapId = field(S8, CharacterInfo::positionMapId)
|
val positionMapId = field(S8, CharacterInfo::positionMapId)
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
val positionX = field(S16LE, CharacterInfo::positionX)
|
val positionX = field(S16LE, CharacterInfo::positionX)
|
||||||
val positionY = field(S16LE, CharacterInfo::positionY)
|
val positionY = field(S16LE, CharacterInfo::positionY)
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
val repelLeft = field(S16LE, CharacterInfo::repelLeft)
|
val repelLeft = field(S16LE, CharacterInfo::repelLeft)
|
||||||
val repelItemId = field(S16LE, CharacterInfo::repelItemId)
|
val repelItemId = field(S16LE, CharacterInfo::repelItemId)
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
val lureItemId = field(S16LE, CharacterInfo::lureItemId)
|
val lureItemId = field(S16LE, CharacterInfo::lureItemId)
|
||||||
val lureLeft = field(S16LE, CharacterInfo::lureLeft)
|
val lureLeft = field(S16LE, CharacterInfo::lureLeft)
|
||||||
field(TrailingBytes) { ByteArray(0) }
|
field(TrailingBytes) { ByteArray(0) }
|
||||||
return CharacterInfo(
|
return CharacterInfo(
|
||||||
id = id,
|
id = id,
|
||||||
name = name,
|
name = name,
|
||||||
namePrefix = namePrefix,
|
namePrefix = namePrefix,
|
||||||
userId = userId,
|
userId = userId,
|
||||||
rivalSex = rivalSex,
|
rivalSex = rivalSex,
|
||||||
lastLogin = lastLogin,
|
lastLogin = lastLogin,
|
||||||
createdAt = createdAt,
|
createdAt = createdAt,
|
||||||
money = money,
|
money = money,
|
||||||
permissions = permissions,
|
permissions = permissions,
|
||||||
remainingSafariSteps = remainingSafariSteps,
|
remainingSafariSteps = remainingSafariSteps,
|
||||||
remainingSafariBalls = remainingSafariBalls,
|
remainingSafariBalls = remainingSafariBalls,
|
||||||
pcExtraSlots = pcExtraSlots,
|
pcExtraSlots = pcExtraSlots,
|
||||||
battleBoxExtraSlots = battleBoxExtraSlots,
|
battleBoxExtraSlots = battleBoxExtraSlots,
|
||||||
templateAmount = templateAmount,
|
templateAmount = templateAmount,
|
||||||
positionRegionId = positionRegionId,
|
positionRegionId = positionRegionId,
|
||||||
positionBankId = positionBankId,
|
positionBankId = positionBankId,
|
||||||
positionMapId = positionMapId,
|
positionMapId = positionMapId,
|
||||||
positionX = positionX,
|
positionX = positionX,
|
||||||
positionY = positionY,
|
positionY = positionY,
|
||||||
repelLeft = repelLeft,
|
repelLeft = repelLeft,
|
||||||
repelItemId = repelItemId,
|
repelItemId = repelItemId,
|
||||||
lureLeft = lureLeft,
|
lureLeft = lureLeft,
|
||||||
lureItemId = lureItemId,
|
lureItemId = lureItemId,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val CharacterInfoCodecShort: Codec<CharacterInfo> = CharacterInfoCodec(withExtraLong = false)
|
val CharacterInfoCodecShort: Codec<CharacterInfo> = CharacterInfoCodec(withExtraLong = false)
|
||||||
|
|||||||
@@ -8,87 +8,87 @@ import de.fiereu.openmmo.common.enums.*
|
|||||||
private val PokemonUnknownBytes: Codec<ByteArray> = bytesPrefixed(U8)
|
private val PokemonUnknownBytes: Codec<ByteArray> = bytesPrefixed(U8)
|
||||||
|
|
||||||
object PokemonCodec : PacketCodec<Pokemon>() {
|
object PokemonCodec : PacketCodec<Pokemon>() {
|
||||||
override fun CodecScope<Pokemon>.body(): Pokemon {
|
override fun CodecScope<Pokemon>.body(): Pokemon {
|
||||||
val id = field(S64LE, Pokemon::id)
|
val id = field(S64LE, Pokemon::id)
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
field(S64LE) { 0L }
|
field(S64LE) { 0L }
|
||||||
field(S64LE) { 0L }
|
field(S64LE) { 0L }
|
||||||
val container = PokemonContainer.entries[field(U8) { it.container.ordinal }]
|
val container = PokemonContainer.entries[field(U8) { it.container.ordinal }]
|
||||||
val containerSlot = field(S16LE, Pokemon::containerSlot)
|
val containerSlot = field(S16LE, Pokemon::containerSlot)
|
||||||
val dexId = field(U16LE, Pokemon::dexId)
|
val dexId = field(U16LE, Pokemon::dexId)
|
||||||
val seed = field(S32LE, Pokemon::seed)
|
val seed = field(S32LE, Pokemon::seed)
|
||||||
field(S64LE) { 0L }
|
field(S64LE) { 0L }
|
||||||
val ot = field(Utf16LeNullTerminated, Pokemon::ot)
|
val ot = field(Utf16LeNullTerminated, Pokemon::ot)
|
||||||
val nickname = field(Utf16LeNullTerminated, Pokemon::nickname)
|
val nickname = field(Utf16LeNullTerminated, Pokemon::nickname)
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
val level = field(S8, Pokemon::level)
|
val level = field(S8, Pokemon::level)
|
||||||
val currentHp = field(S16LE, Pokemon::hp)
|
val currentHp = field(S16LE, Pokemon::hp)
|
||||||
field(S16LE) { 0 }
|
field(S16LE) { 0 }
|
||||||
val xp = field(S32LE, Pokemon::xp)
|
val xp = field(S32LE, Pokemon::xp)
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
field(S16LE) { 0 }
|
field(S16LE) { 0 }
|
||||||
val moveIds = List(4) { i -> field(S16LE) { it.moves[i].id } }
|
val moveIds = List(4) { i -> field(S16LE) { it.moves[i].id } }
|
||||||
val movePps = List(4) { i -> field(S8) { it.moves[i].pp } }
|
val movePps = List(4) { i -> field(S8) { it.moves[i].pp } }
|
||||||
val moves = List(4) { PokemonMove(moveIds[it], movePps[it]) }
|
val moves = List(4) { PokemonMove(moveIds[it], movePps[it]) }
|
||||||
repeat(4) { field(S16LE) { 0 } }
|
repeat(4) { field(S16LE) { 0 } }
|
||||||
val eVs =
|
val eVs =
|
||||||
EVs().apply {
|
EVs().apply {
|
||||||
hp = field(U8) { it.eVs.hp }
|
hp = field(U8) { it.eVs.hp }
|
||||||
atk = field(U8) { it.eVs.atk }
|
atk = field(U8) { it.eVs.atk }
|
||||||
def = field(U8) { it.eVs.def }
|
def = field(U8) { it.eVs.def }
|
||||||
spd = field(U8) { it.eVs.spd }
|
spd = field(U8) { it.eVs.spd }
|
||||||
spAtk = field(U8) { it.eVs.spAtk }
|
spAtk = field(U8) { it.eVs.spAtk }
|
||||||
spDef = field(U8) { it.eVs.spDef }
|
spDef = field(U8) { it.eVs.spDef }
|
||||||
}
|
}
|
||||||
repeat(11) { field(S8) { 0 } }
|
repeat(11) { field(S8) { 0 } }
|
||||||
val iVs = decompressIVs(field(S32LE) { it.iVs.compress() })
|
val iVs = decompressIVs(field(S32LE) { it.iVs.compress() })
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
field(S64LE) { 0L }
|
field(S64LE) { 0L }
|
||||||
val rarityMask =
|
val rarityMask =
|
||||||
field(U16LE) {
|
field(U16LE) {
|
||||||
var m = 0
|
var m = 0
|
||||||
if (it.isShiny) m = m or (1 shl PokemonRarity.SHINY.ordinal)
|
if (it.isShiny) m = m or (1 shl PokemonRarity.SHINY.ordinal)
|
||||||
if (it.hasHiddenAbility) m = m or (1 shl PokemonRarity.HIDDEN_ABILITY.ordinal)
|
if (it.hasHiddenAbility) m = m or (1 shl PokemonRarity.HIDDEN_ABILITY.ordinal)
|
||||||
if (it.isAlpha) m = m or (1 shl PokemonRarity.ALPHA.ordinal)
|
if (it.isAlpha) m = m or (1 shl PokemonRarity.ALPHA.ordinal)
|
||||||
if (it.isSecret) m = m or (1 shl PokemonRarity.SECRET.ordinal)
|
if (it.isSecret) m = m or (1 shl PokemonRarity.SECRET.ordinal)
|
||||||
if (it.isFatefulEncounter) m = m or (1 shl PokemonRarity.FATEFUL_ENCOUNTER.ordinal)
|
if (it.isFatefulEncounter) m = m or (1 shl PokemonRarity.FATEFUL_ENCOUNTER.ordinal)
|
||||||
if (it.isRaidEncounter) m = m or (1 shl PokemonRarity.RAID_ENCOUNTER.ordinal)
|
if (it.isRaidEncounter) m = m or (1 shl PokemonRarity.RAID_ENCOUNTER.ordinal)
|
||||||
m
|
m
|
||||||
}
|
}
|
||||||
val isShiny = (rarityMask and (1 shl PokemonRarity.SHINY.ordinal)) != 0
|
val isShiny = (rarityMask and (1 shl PokemonRarity.SHINY.ordinal)) != 0
|
||||||
val hasHiddenAbility = (rarityMask and (1 shl PokemonRarity.HIDDEN_ABILITY.ordinal)) != 0
|
val hasHiddenAbility = (rarityMask and (1 shl PokemonRarity.HIDDEN_ABILITY.ordinal)) != 0
|
||||||
val isAlpha = (rarityMask and (1 shl PokemonRarity.ALPHA.ordinal)) != 0
|
val isAlpha = (rarityMask and (1 shl PokemonRarity.ALPHA.ordinal)) != 0
|
||||||
val isSecret = (rarityMask and (1 shl PokemonRarity.SECRET.ordinal)) != 0
|
val isSecret = (rarityMask and (1 shl PokemonRarity.SECRET.ordinal)) != 0
|
||||||
val isFatefulEncounter = (rarityMask and (1 shl PokemonRarity.FATEFUL_ENCOUNTER.ordinal)) != 0
|
val isFatefulEncounter = (rarityMask and (1 shl PokemonRarity.FATEFUL_ENCOUNTER.ordinal)) != 0
|
||||||
val isRaidEncounter = (rarityMask and (1 shl PokemonRarity.RAID_ENCOUNTER.ordinal)) != 0
|
val isRaidEncounter = (rarityMask and (1 shl PokemonRarity.RAID_ENCOUNTER.ordinal)) != 0
|
||||||
val caughtAt = field(EpochSecondsS32LE, Pokemon::caughtAt)
|
val caughtAt = field(EpochSecondsS32LE, Pokemon::caughtAt)
|
||||||
field(S16LE) { 0 }
|
field(S16LE) { 0 }
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
field(PokemonUnknownBytes) { ByteArray(0) }
|
field(PokemonUnknownBytes) { ByteArray(0) }
|
||||||
repeat(12) { field(S8) { 0 } }
|
repeat(12) { field(S8) { 0 } }
|
||||||
return Pokemon(
|
return Pokemon(
|
||||||
id,
|
id,
|
||||||
container,
|
container,
|
||||||
containerSlot,
|
containerSlot,
|
||||||
dexId,
|
dexId,
|
||||||
seed,
|
seed,
|
||||||
ot,
|
ot,
|
||||||
nickname,
|
nickname,
|
||||||
level,
|
level,
|
||||||
currentHp,
|
currentHp,
|
||||||
xp,
|
xp,
|
||||||
eVs,
|
eVs,
|
||||||
iVs,
|
iVs,
|
||||||
moves,
|
moves,
|
||||||
isShiny,
|
isShiny,
|
||||||
hasHiddenAbility,
|
hasHiddenAbility,
|
||||||
isAlpha,
|
isAlpha,
|
||||||
isSecret,
|
isSecret,
|
||||||
isFatefulEncounter,
|
isFatefulEncounter,
|
||||||
isRaidEncounter,
|
isRaidEncounter,
|
||||||
caughtAt,
|
caughtAt,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,42 +7,42 @@ import java.util.*
|
|||||||
data class Skin(val slot: SkinSlot, val type: UShort?, val color: UByte?)
|
data class Skin(val slot: SkinSlot, val type: UShort?, val color: UByte?)
|
||||||
|
|
||||||
class SkinSet : EnumMap<SkinSlot, Skin>(SkinSlot::class.java) {
|
class SkinSet : EnumMap<SkinSlot, Skin>(SkinSlot::class.java) {
|
||||||
fun put(skin: Skin) {
|
fun put(skin: Skin) {
|
||||||
this[skin.slot] = skin
|
this[skin.slot] = skin
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun put(key: SkinSlot, value: Skin): Skin? {
|
override fun put(key: SkinSlot, value: Skin): Skin? {
|
||||||
require(key == value.slot) { "Slot mismatch: $key != ${value.slot}" }
|
require(key == value.slot) { "Slot mismatch: $key != ${value.slot}" }
|
||||||
return super.put(key, value)
|
return super.put(key, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SkinSetCodec(
|
class SkinSetCodec(
|
||||||
private val slots: List<SkinSlot> = SkinSlot.entries,
|
private val slots: List<SkinSlot> = SkinSlot.entries,
|
||||||
private val withLeadingByte: Boolean = true,
|
private val withLeadingByte: Boolean = true,
|
||||||
) : PacketCodec<SkinSet>() {
|
) : PacketCodec<SkinSet>() {
|
||||||
override fun CodecScope<SkinSet>.body(): SkinSet {
|
override fun CodecScope<SkinSet>.body(): SkinSet {
|
||||||
if (withLeadingByte) field(U8) { 0 }
|
if (withLeadingByte) field(U8) { 0 }
|
||||||
val mask = field(U16LE) { slots.fold(0) { acc, slot -> acc or (1 shl slot.ordinal) } }
|
val mask = field(U16LE) { slots.fold(0) { acc, slot -> acc or (1 shl slot.ordinal) } }
|
||||||
val skins = SkinSet()
|
val skins = SkinSet()
|
||||||
slots.forEach { slot ->
|
slots.forEach { slot ->
|
||||||
if ((mask and (1 shl slot.ordinal)) != 0) {
|
if ((mask and (1 shl slot.ordinal)) != 0) {
|
||||||
val compressed =
|
val compressed =
|
||||||
field(U16LE) {
|
field(U16LE) {
|
||||||
val skin = it[slot] ?: Skin(slot, 0u, 0u)
|
val skin = it[slot] ?: Skin(slot, 0u, 0u)
|
||||||
val type = skin.type ?: 0x3FFFu
|
val type = skin.type ?: 0x3FFFu
|
||||||
val color = skin.color ?: 0x3Fu
|
val color = skin.color ?: 0x3Fu
|
||||||
require(type <= 0x3FFFu) { "Skin type too large: ${skin.type}" }
|
require(type <= 0x3FFFu) { "Skin type too large: ${skin.type}" }
|
||||||
require(color <= 0x3Fu) { "Skin color too large: ${skin.color}" }
|
require(color <= 0x3Fu) { "Skin color too large: ${skin.color}" }
|
||||||
(type and 0x3FFFu).toInt() or ((color and 0x3Fu).toInt() shl 10)
|
(type and 0x3FFFu).toInt() or ((color and 0x3Fu).toInt() shl 10)
|
||||||
}
|
|
||||||
val type = (compressed and 0x3FFF).toUShort()
|
|
||||||
val color = ((compressed shr 10) and 0x3F).toUByte()
|
|
||||||
skins.put(Skin(slot, type, color))
|
|
||||||
}
|
}
|
||||||
}
|
val type = (compressed and 0x3FFF).toUShort()
|
||||||
return skins
|
val color = ((compressed shr 10) and 0x3F).toUByte()
|
||||||
|
skins.put(Skin(slot, type, color))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return skins
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val DefaultSkinSetCodec: Codec<SkinSet> = SkinSetCodec()
|
val DefaultSkinSetCodec: Codec<SkinSet> = SkinSetCodec()
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ import de.fiereu.openmmo.common.Tile2D
|
|||||||
val Tile2DCodec: Codec<Tile2D> =
|
val Tile2DCodec: Codec<Tile2D> =
|
||||||
U16LE.imap(
|
U16LE.imap(
|
||||||
decode = { raw ->
|
decode = { raw ->
|
||||||
Tile2D(
|
Tile2D(
|
||||||
material = (raw and 0x3FF).toShort(),
|
material = (raw and 0x3FF).toShort(),
|
||||||
collision = ((raw shr 10) and 0x3F).toByte(),
|
collision = ((raw shr 10) and 0x3F).toByte(),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
encode = { tile ->
|
encode = { tile ->
|
||||||
((tile.collision.toInt() and 0x3F) shl 10) or (tile.material.toInt() and 0x3FF)
|
((tile.collision.toInt() and 0x3F) shl 10) or (tile.material.toInt() and 0x3FF)
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
+4
-4
@@ -9,8 +9,8 @@ data class ActiveBattleSidePacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object ActiveBattleSidePacketCodec : PacketCodec<ActiveBattleSidePacket>() {
|
object ActiveBattleSidePacketCodec : PacketCodec<ActiveBattleSidePacket>() {
|
||||||
override fun CodecScope<ActiveBattleSidePacket>.body(): ActiveBattleSidePacket {
|
override fun CodecScope<ActiveBattleSidePacket>.body(): ActiveBattleSidePacket {
|
||||||
val side = field(S8) { it.side }
|
val side = field(S8) { it.side }
|
||||||
return ActiveBattleSidePacket(side)
|
return ActiveBattleSidePacket(side)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+128
-128
@@ -60,155 +60,155 @@ data class ActivePokemonSummaryPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
private object SummaryRankingEntryCodec : PacketCodec<SummaryRankingEntry>() {
|
private object SummaryRankingEntryCodec : PacketCodec<SummaryRankingEntry>() {
|
||||||
override fun CodecScope<SummaryRankingEntry>.body(): SummaryRankingEntry {
|
override fun CodecScope<SummaryRankingEntry>.body(): SummaryRankingEntry {
|
||||||
val entityId = field(S64LE, SummaryRankingEntry::entityId)
|
val entityId = field(S64LE, SummaryRankingEntry::entityId)
|
||||||
val rank = field(S8, SummaryRankingEntry::rank)
|
val rank = field(S8, SummaryRankingEntry::rank)
|
||||||
val flags = field(S8, SummaryRankingEntry::flags)
|
val flags = field(S8, SummaryRankingEntry::flags)
|
||||||
val name = field(Utf16LeNullTerminated, SummaryRankingEntry::name)
|
val name = field(Utf16LeNullTerminated, SummaryRankingEntry::name)
|
||||||
val value1 = field(S16LE, SummaryRankingEntry::value1)
|
val value1 = field(S16LE, SummaryRankingEntry::value1)
|
||||||
val species = field(S16LE, SummaryRankingEntry::species)
|
val species = field(S16LE, SummaryRankingEntry::species)
|
||||||
reserved(byte = 0)
|
reserved(byte = 0)
|
||||||
val ribbons = field(S64LE, SummaryRankingEntry::ribbons)
|
val ribbons = field(S64LE, SummaryRankingEntry::ribbons)
|
||||||
val value2 = field(S8, SummaryRankingEntry::value2)
|
val value2 = field(S8, SummaryRankingEntry::value2)
|
||||||
val value3 = field(S32LE, SummaryRankingEntry::value3)
|
val value3 = field(S32LE, SummaryRankingEntry::value3)
|
||||||
val value4 = field(S8, SummaryRankingEntry::value4)
|
val value4 = field(S8, SummaryRankingEntry::value4)
|
||||||
val flag1 = field(Bool, SummaryRankingEntry::flag1)
|
val flag1 = field(Bool, SummaryRankingEntry::flag1)
|
||||||
val flag2 = field(Bool, SummaryRankingEntry::flag2)
|
val flag2 = field(Bool, SummaryRankingEntry::flag2)
|
||||||
reserved(byte = 0)
|
reserved(byte = 0)
|
||||||
return SummaryRankingEntry(
|
return SummaryRankingEntry(
|
||||||
entityId,
|
entityId,
|
||||||
rank,
|
rank,
|
||||||
flags,
|
flags,
|
||||||
name,
|
name,
|
||||||
value1,
|
value1,
|
||||||
species,
|
species,
|
||||||
ribbons,
|
ribbons,
|
||||||
value2,
|
value2,
|
||||||
value3,
|
value3,
|
||||||
value4,
|
value4,
|
||||||
flag1,
|
flag1,
|
||||||
flag2,
|
flag2,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private object SummaryAppearanceCodec : PacketCodec<SummaryAppearance>() {
|
private object SummaryAppearanceCodec : PacketCodec<SummaryAppearance>() {
|
||||||
override fun CodecScope<SummaryAppearance>.body(): SummaryAppearance {
|
override fun CodecScope<SummaryAppearance>.body(): SummaryAppearance {
|
||||||
val name = field(Utf16LeNullTerminated, SummaryAppearance::name)
|
val name = field(Utf16LeNullTerminated, SummaryAppearance::name)
|
||||||
val gender = field(S8, SummaryAppearance::gender)
|
val gender = field(S8, SummaryAppearance::gender)
|
||||||
val formId = field(S32LE, SummaryAppearance::formId)
|
val formId = field(S32LE, SummaryAppearance::formId)
|
||||||
val kind = field(S8, SummaryAppearance::kind)
|
val kind = field(S8, SummaryAppearance::kind)
|
||||||
val palettePack = field(S8, SummaryAppearance::palettePack)
|
val palettePack = field(S8, SummaryAppearance::palettePack)
|
||||||
val slots = field(S16LE.repeat(4), SummaryAppearance::slots)
|
val slots = field(S16LE.repeat(4), SummaryAppearance::slots)
|
||||||
return SummaryAppearance(name, gender, formId, kind, palettePack, slots)
|
return SummaryAppearance(name, gender, formId, kind, palettePack, slots)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private object SummaryAbilityCodec : PacketCodec<SummaryAbility>() {
|
private object SummaryAbilityCodec : PacketCodec<SummaryAbility>() {
|
||||||
override fun CodecScope<SummaryAbility>.body(): SummaryAbility {
|
override fun CodecScope<SummaryAbility>.body(): SummaryAbility {
|
||||||
val slot = field(S8, SummaryAbility::slot)
|
val slot = field(S8, SummaryAbility::slot)
|
||||||
val sourceId = field(S64LE, SummaryAbility::sourceId)
|
val sourceId = field(S64LE, SummaryAbility::sourceId)
|
||||||
val appearance = field(SummaryAppearanceCodec, SummaryAbility::appearance)
|
val appearance = field(SummaryAppearanceCodec, SummaryAbility::appearance)
|
||||||
return SummaryAbility(slot, sourceId, appearance)
|
return SummaryAbility(slot, sourceId, appearance)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private object SummaryMoveCodec : PacketCodec<SummaryMove>() {
|
private object SummaryMoveCodec : PacketCodec<SummaryMove>() {
|
||||||
override fun CodecScope<SummaryMove>.body(): SummaryMove {
|
override fun CodecScope<SummaryMove>.body(): SummaryMove {
|
||||||
val moveId = field(S8, SummaryMove::moveId)
|
val moveId = field(S8, SummaryMove::moveId)
|
||||||
val slot = field(S8, SummaryMove::slot)
|
val slot = field(S8, SummaryMove::slot)
|
||||||
val locked = field(Bool, SummaryMove::locked)
|
val locked = field(Bool, SummaryMove::locked)
|
||||||
if (!locked) {
|
if (!locked) {
|
||||||
val intA = field(S32LE, SummaryMove::intA)
|
val intA = field(S32LE, SummaryMove::intA)
|
||||||
val intB = field(S32LE, SummaryMove::intB)
|
val intB = field(S32LE, SummaryMove::intB)
|
||||||
val intC = field(S32LE, SummaryMove::intC)
|
val intC = field(S32LE, SummaryMove::intC)
|
||||||
val shortA = field(S16LE, SummaryMove::shortA)
|
val shortA = field(S16LE, SummaryMove::shortA)
|
||||||
val shortB = field(S16LE, SummaryMove::shortB)
|
val shortB = field(S16LE, SummaryMove::shortB)
|
||||||
val byteA = field(S8, SummaryMove::byteA)
|
val byteA = field(S8, SummaryMove::byteA)
|
||||||
return SummaryMove(
|
return SummaryMove(
|
||||||
moveId,
|
moveId,
|
||||||
slot,
|
slot,
|
||||||
locked,
|
locked,
|
||||||
intA,
|
intA,
|
||||||
intB,
|
intB,
|
||||||
intC,
|
intC,
|
||||||
shortA,
|
shortA,
|
||||||
shortB,
|
shortB,
|
||||||
byteA,
|
byteA,
|
||||||
0,
|
0,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
0,
|
0,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
}
|
|
||||||
val unlockedShort = field(S16LE, SummaryMove::unlockedShort)
|
|
||||||
val boolA = field(Bool, SummaryMove::boolA)
|
|
||||||
val boolB = field(Bool, SummaryMove::boolB)
|
|
||||||
val unlockedByteA = field(S8, SummaryMove::unlockedByteA)
|
|
||||||
val boolC = field(Bool, SummaryMove::boolC)
|
|
||||||
val boolD = field(Bool, SummaryMove::boolD)
|
|
||||||
val unlockedByteB = field(S8, SummaryMove::unlockedByteB)
|
|
||||||
val unlockedByteC = field(S8, SummaryMove::unlockedByteC)
|
|
||||||
val unlockedByteD = field(S8, SummaryMove::unlockedByteD)
|
|
||||||
return SummaryMove(
|
|
||||||
moveId,
|
|
||||||
slot,
|
|
||||||
locked,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
unlockedShort,
|
|
||||||
boolA,
|
|
||||||
boolB,
|
|
||||||
unlockedByteA,
|
|
||||||
boolC,
|
|
||||||
boolD,
|
|
||||||
unlockedByteB,
|
|
||||||
unlockedByteC,
|
|
||||||
unlockedByteD,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
val unlockedShort = field(S16LE, SummaryMove::unlockedShort)
|
||||||
|
val boolA = field(Bool, SummaryMove::boolA)
|
||||||
|
val boolB = field(Bool, SummaryMove::boolB)
|
||||||
|
val unlockedByteA = field(S8, SummaryMove::unlockedByteA)
|
||||||
|
val boolC = field(Bool, SummaryMove::boolC)
|
||||||
|
val boolD = field(Bool, SummaryMove::boolD)
|
||||||
|
val unlockedByteB = field(S8, SummaryMove::unlockedByteB)
|
||||||
|
val unlockedByteC = field(S8, SummaryMove::unlockedByteC)
|
||||||
|
val unlockedByteD = field(S8, SummaryMove::unlockedByteD)
|
||||||
|
return SummaryMove(
|
||||||
|
moveId,
|
||||||
|
slot,
|
||||||
|
locked,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
unlockedShort,
|
||||||
|
boolA,
|
||||||
|
boolB,
|
||||||
|
unlockedByteA,
|
||||||
|
boolC,
|
||||||
|
boolD,
|
||||||
|
unlockedByteB,
|
||||||
|
unlockedByteC,
|
||||||
|
unlockedByteD,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val SummaryAbilityListPrefixedU8: Codec<List<SummaryAbility>> =
|
private val SummaryAbilityListPrefixedU8: Codec<List<SummaryAbility>> =
|
||||||
object : Codec<List<SummaryAbility>> {
|
object : Codec<List<SummaryAbility>> {
|
||||||
override fun read(buf: ReadBuffer): List<SummaryAbility> {
|
override fun read(buf: ReadBuffer): List<SummaryAbility> {
|
||||||
val n = U8.read(buf)
|
val n = U8.read(buf)
|
||||||
return List(n) { SummaryAbilityCodec.read(buf) }
|
return List(n) { SummaryAbilityCodec.read(buf) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun write(buf: WriteBuffer, value: List<SummaryAbility>) {
|
override fun write(buf: WriteBuffer, value: List<SummaryAbility>) {
|
||||||
U8.write(buf, value.size)
|
U8.write(buf, value.size)
|
||||||
value.forEach { SummaryAbilityCodec.write(buf, it) }
|
value.forEach { SummaryAbilityCodec.write(buf, it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val SummaryMoveListPrefixedU8: Codec<List<SummaryMove>> =
|
private val SummaryMoveListPrefixedU8: Codec<List<SummaryMove>> =
|
||||||
object : Codec<List<SummaryMove>> {
|
object : Codec<List<SummaryMove>> {
|
||||||
override fun read(buf: ReadBuffer): List<SummaryMove> {
|
override fun read(buf: ReadBuffer): List<SummaryMove> {
|
||||||
val n = U8.read(buf)
|
val n = U8.read(buf)
|
||||||
return List(n) { SummaryMoveCodec.read(buf) }
|
return List(n) { SummaryMoveCodec.read(buf) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun write(buf: WriteBuffer, value: List<SummaryMove>) {
|
override fun write(buf: WriteBuffer, value: List<SummaryMove>) {
|
||||||
U8.write(buf, value.size)
|
U8.write(buf, value.size)
|
||||||
value.forEach { SummaryMoveCodec.write(buf, it) }
|
value.forEach { SummaryMoveCodec.write(buf, it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object ActivePokemonSummaryPacketCodec : PacketCodec<ActivePokemonSummaryPacket>() {
|
object ActivePokemonSummaryPacketCodec : PacketCodec<ActivePokemonSummaryPacket>() {
|
||||||
override fun CodecScope<ActivePokemonSummaryPacket>.body(): ActivePokemonSummaryPacket {
|
override fun CodecScope<ActivePokemonSummaryPacket>.body(): ActivePokemonSummaryPacket {
|
||||||
val pokemon = field(SummaryRankingEntryCodec, ActivePokemonSummaryPacket::pokemon)
|
val pokemon = field(SummaryRankingEntryCodec, ActivePokemonSummaryPacket::pokemon)
|
||||||
val abilities = field(SummaryAbilityListPrefixedU8, ActivePokemonSummaryPacket::abilities)
|
val abilities = field(SummaryAbilityListPrefixedU8, ActivePokemonSummaryPacket::abilities)
|
||||||
val moves = field(SummaryMoveListPrefixedU8, ActivePokemonSummaryPacket::moves)
|
val moves = field(SummaryMoveListPrefixedU8, ActivePokemonSummaryPacket::moves)
|
||||||
return ActivePokemonSummaryPacket(pokemon, abilities, moves)
|
return ActivePokemonSummaryPacket(pokemon, abilities, moves)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -7,8 +7,8 @@ import de.fiereu.bytecodec.Utf16LeNullTerminated
|
|||||||
data class AddFriendPacket(val username: String)
|
data class AddFriendPacket(val username: String)
|
||||||
|
|
||||||
object AddFriendPacketCodec : PacketCodec<AddFriendPacket>() {
|
object AddFriendPacketCodec : PacketCodec<AddFriendPacket>() {
|
||||||
override fun CodecScope<AddFriendPacket>.body(): AddFriendPacket {
|
override fun CodecScope<AddFriendPacket>.body(): AddFriendPacket {
|
||||||
val username = field(Utf16LeNullTerminated) { it.username }
|
val username = field(Utf16LeNullTerminated) { it.username }
|
||||||
return AddFriendPacket(username)
|
return AddFriendPacket(username)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+26
-26
@@ -10,34 +10,34 @@ data class AdminNoteActionPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object AdminNoteActionPacketCodec : PacketCodec<AdminNoteActionPacket>() {
|
object AdminNoteActionPacketCodec : PacketCodec<AdminNoteActionPacket>() {
|
||||||
override fun CodecScope<AdminNoteActionPacket>.body(): AdminNoteActionPacket {
|
override fun CodecScope<AdminNoteActionPacket>.body(): AdminNoteActionPacket {
|
||||||
val actionType = field(S8) { it.actionType }
|
val actionType = field(S8) { it.actionType }
|
||||||
return when (actionType.toInt()) {
|
return when (actionType.toInt()) {
|
||||||
1 -> {
|
1 -> {
|
||||||
val targetEntityId =
|
val targetEntityId =
|
||||||
field(S64LE) {
|
field(S64LE) {
|
||||||
it.targetEntityId ?: throw MalformedPacketException("targetEntityId required")
|
it.targetEntityId ?: throw MalformedPacketException("targetEntityId required")
|
||||||
}
|
|
||||||
val noteText =
|
|
||||||
field(Utf16LeNullTerminated) {
|
|
||||||
it.noteText ?: throw MalformedPacketException("noteText required")
|
|
||||||
}
|
|
||||||
AdminNoteActionPacket(actionType, targetEntityId, null, noteText)
|
|
||||||
}
|
}
|
||||||
|
val noteText =
|
||||||
2 -> {
|
field(Utf16LeNullTerminated) {
|
||||||
val targetEntityId =
|
it.noteText ?: throw MalformedPacketException("noteText required")
|
||||||
field(S64LE) {
|
|
||||||
it.targetEntityId ?: throw MalformedPacketException("targetEntityId required")
|
|
||||||
}
|
|
||||||
val noteEntityId =
|
|
||||||
field(S64LE) {
|
|
||||||
it.noteEntityId ?: throw MalformedPacketException("noteEntityId required")
|
|
||||||
}
|
|
||||||
AdminNoteActionPacket(actionType, targetEntityId, noteEntityId, null)
|
|
||||||
}
|
}
|
||||||
|
AdminNoteActionPacket(actionType, targetEntityId, null, noteText)
|
||||||
|
}
|
||||||
|
|
||||||
else -> AdminNoteActionPacket(actionType, null, null, null)
|
2 -> {
|
||||||
}
|
val targetEntityId =
|
||||||
|
field(S64LE) {
|
||||||
|
it.targetEntityId ?: throw MalformedPacketException("targetEntityId required")
|
||||||
|
}
|
||||||
|
val noteEntityId =
|
||||||
|
field(S64LE) {
|
||||||
|
it.noteEntityId ?: throw MalformedPacketException("noteEntityId required")
|
||||||
|
}
|
||||||
|
AdminNoteActionPacket(actionType, targetEntityId, noteEntityId, null)
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> AdminNoteActionPacket(actionType, null, null, null)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+5
-5
@@ -11,9 +11,9 @@ data class AppearanceRequestResultPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object AppearanceRequestResultPacketCodec : PacketCodec<AppearanceRequestResultPacket>() {
|
object AppearanceRequestResultPacketCodec : PacketCodec<AppearanceRequestResultPacket>() {
|
||||||
override fun CodecScope<AppearanceRequestResultPacket>.body(): AppearanceRequestResultPacket {
|
override fun CodecScope<AppearanceRequestResultPacket>.body(): AppearanceRequestResultPacket {
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
val accepted = field(Bool) { it.accepted }
|
val accepted = field(Bool) { it.accepted }
|
||||||
return AppearanceRequestResultPacket(entityId, accepted)
|
return AppearanceRequestResultPacket(entityId, accepted)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-6
@@ -12,10 +12,10 @@ data class AssignBreedingSlotPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object AssignBreedingSlotPacketCodec : PacketCodec<AssignBreedingSlotPacket>() {
|
object AssignBreedingSlotPacketCodec : PacketCodec<AssignBreedingSlotPacket>() {
|
||||||
override fun CodecScope<AssignBreedingSlotPacket>.body(): AssignBreedingSlotPacket {
|
override fun CodecScope<AssignBreedingSlotPacket>.body(): AssignBreedingSlotPacket {
|
||||||
val ownPokemonEntityId = field(S64LE) { it.ownPokemonEntityId }
|
val ownPokemonEntityId = field(S64LE) { it.ownPokemonEntityId }
|
||||||
val partnerPokemonEntityId = field(S64LE) { it.partnerPokemonEntityId }
|
val partnerPokemonEntityId = field(S64LE) { it.partnerPokemonEntityId }
|
||||||
val slotIndex = field(S8) { it.slotIndex }
|
val slotIndex = field(S8) { it.slotIndex }
|
||||||
return AssignBreedingSlotPacket(ownPokemonEntityId, partnerPokemonEntityId, slotIndex)
|
return AssignBreedingSlotPacket(ownPokemonEntityId, partnerPokemonEntityId, slotIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+119
-121
@@ -20,132 +20,130 @@ data class BatchInputEventsPacket(
|
|||||||
|
|
||||||
private val EventsCodec: Codec<List<InputEventSample>> =
|
private val EventsCodec: Codec<List<InputEventSample>> =
|
||||||
object : Codec<List<InputEventSample>> {
|
object : Codec<List<InputEventSample>> {
|
||||||
override fun read(buf: ReadBuffer): List<InputEventSample> {
|
override fun read(buf: ReadBuffer): List<InputEventSample> {
|
||||||
val count = S16LE.read(buf).toInt()
|
val count = S16LE.read(buf).toInt()
|
||||||
if (count == 0) return emptyList()
|
if (count == 0) return emptyList()
|
||||||
var previous = S64LE.read(buf)
|
var previous = S64LE.read(buf)
|
||||||
val result = ArrayList<InputEventSample>(count)
|
val result = ArrayList<InputEventSample>(count)
|
||||||
for (i in 0 until count) {
|
for (i in 0 until count) {
|
||||||
val type = S8.read(buf)
|
val type = S8.read(buf)
|
||||||
val delta = S16LE.read(buf).toInt()
|
val delta = S16LE.read(buf).toInt()
|
||||||
val timestamp = if (delta == -1) S64LE.read(buf) else previous + delta
|
val timestamp = if (delta == -1) S64LE.read(buf) else previous + delta
|
||||||
var byteA: Byte = 0
|
var byteA: Byte = 0
|
||||||
var byteB: Byte = 0
|
var byteB: Byte = 0
|
||||||
var intA = 0
|
var intA = 0
|
||||||
var shortA: Short = 0
|
var shortA: Short = 0
|
||||||
var shortB: Short = 0
|
var shortB: Short = 0
|
||||||
var intB = 0
|
var intB = 0
|
||||||
when (type.toInt()) {
|
when (type.toInt()) {
|
||||||
0,
|
0,
|
||||||
1 -> {
|
1 -> {
|
||||||
byteA = S8.read(buf)
|
byteA = S8.read(buf)
|
||||||
byteB = S8.read(buf)
|
byteB = S8.read(buf)
|
||||||
intA = S32LE.read(buf)
|
intA = S32LE.read(buf)
|
||||||
intB = S32LE.read(buf)
|
intB = S32LE.read(buf)
|
||||||
}
|
|
||||||
|
|
||||||
2,
|
|
||||||
3 -> {
|
|
||||||
byteA = S8.read(buf)
|
|
||||||
byteB = S8.read(buf)
|
|
||||||
shortA = S16LE.read(buf)
|
|
||||||
shortB = S16LE.read(buf)
|
|
||||||
intA = S32LE.read(buf)
|
|
||||||
intB = S32LE.read(buf)
|
|
||||||
}
|
|
||||||
|
|
||||||
4,
|
|
||||||
14 -> {
|
|
||||||
byteB = S8.read(buf)
|
|
||||||
shortA = S16LE.read(buf)
|
|
||||||
shortB = S16LE.read(buf)
|
|
||||||
intA = S32LE.read(buf)
|
|
||||||
intB = S32LE.read(buf)
|
|
||||||
}
|
|
||||||
|
|
||||||
5,
|
|
||||||
6,
|
|
||||||
7,
|
|
||||||
8 -> {
|
|
||||||
byteB = S8.read(buf)
|
|
||||||
}
|
|
||||||
|
|
||||||
9 -> {
|
|
||||||
shortA = S16LE.read(buf)
|
|
||||||
shortB = S16LE.read(buf)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result.add(
|
|
||||||
InputEventSample(type, timestamp, byteA, byteB, intA, shortA, shortB, intB)
|
|
||||||
)
|
|
||||||
previous = timestamp
|
|
||||||
}
|
}
|
||||||
return result
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun write(buf: WriteBuffer, value: List<InputEventSample>) {
|
2,
|
||||||
S16LE.write(buf, value.size.toShort())
|
3 -> {
|
||||||
if (value.isEmpty()) return
|
byteA = S8.read(buf)
|
||||||
var previous = value[0].timestamp
|
byteB = S8.read(buf)
|
||||||
S64LE.write(buf, previous)
|
shortA = S16LE.read(buf)
|
||||||
for (event in value) {
|
shortB = S16LE.read(buf)
|
||||||
S8.write(buf, event.type)
|
intA = S32LE.read(buf)
|
||||||
val delta = event.timestamp - previous
|
intB = S32LE.read(buf)
|
||||||
if (delta > 32767L) {
|
|
||||||
S16LE.write(buf, (-1).toShort())
|
|
||||||
S64LE.write(buf, event.timestamp)
|
|
||||||
} else {
|
|
||||||
S16LE.write(buf, delta.toShort())
|
|
||||||
}
|
|
||||||
when (event.type.toInt()) {
|
|
||||||
0,
|
|
||||||
1 -> {
|
|
||||||
S8.write(buf, event.byteA)
|
|
||||||
S8.write(buf, event.byteB)
|
|
||||||
S32LE.write(buf, event.intA)
|
|
||||||
S32LE.write(buf, event.intB)
|
|
||||||
}
|
|
||||||
|
|
||||||
2,
|
|
||||||
3 -> {
|
|
||||||
S8.write(buf, event.byteA)
|
|
||||||
S8.write(buf, event.byteB)
|
|
||||||
S16LE.write(buf, event.shortA)
|
|
||||||
S16LE.write(buf, event.shortB)
|
|
||||||
S32LE.write(buf, event.intA)
|
|
||||||
S32LE.write(buf, event.intB)
|
|
||||||
}
|
|
||||||
|
|
||||||
4,
|
|
||||||
14 -> {
|
|
||||||
S8.write(buf, event.byteB)
|
|
||||||
S16LE.write(buf, event.shortA)
|
|
||||||
S16LE.write(buf, event.shortB)
|
|
||||||
S32LE.write(buf, event.intA)
|
|
||||||
S32LE.write(buf, event.intB)
|
|
||||||
}
|
|
||||||
|
|
||||||
5,
|
|
||||||
6,
|
|
||||||
7,
|
|
||||||
8 -> {
|
|
||||||
S8.write(buf, event.byteB)
|
|
||||||
}
|
|
||||||
|
|
||||||
9 -> {
|
|
||||||
S16LE.write(buf, event.shortA)
|
|
||||||
S16LE.write(buf, event.shortB)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
previous = event.timestamp
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4,
|
||||||
|
14 -> {
|
||||||
|
byteB = S8.read(buf)
|
||||||
|
shortA = S16LE.read(buf)
|
||||||
|
shortB = S16LE.read(buf)
|
||||||
|
intA = S32LE.read(buf)
|
||||||
|
intB = S32LE.read(buf)
|
||||||
|
}
|
||||||
|
|
||||||
|
5,
|
||||||
|
6,
|
||||||
|
7,
|
||||||
|
8 -> {
|
||||||
|
byteB = S8.read(buf)
|
||||||
|
}
|
||||||
|
|
||||||
|
9 -> {
|
||||||
|
shortA = S16LE.read(buf)
|
||||||
|
shortB = S16LE.read(buf)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
result.add(InputEventSample(type, timestamp, byteA, byteB, intA, shortA, shortB, intB))
|
||||||
|
previous = timestamp
|
||||||
}
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun write(buf: WriteBuffer, value: List<InputEventSample>) {
|
||||||
|
S16LE.write(buf, value.size.toShort())
|
||||||
|
if (value.isEmpty()) return
|
||||||
|
var previous = value[0].timestamp
|
||||||
|
S64LE.write(buf, previous)
|
||||||
|
for (event in value) {
|
||||||
|
S8.write(buf, event.type)
|
||||||
|
val delta = event.timestamp - previous
|
||||||
|
if (delta > 32767L) {
|
||||||
|
S16LE.write(buf, (-1).toShort())
|
||||||
|
S64LE.write(buf, event.timestamp)
|
||||||
|
} else {
|
||||||
|
S16LE.write(buf, delta.toShort())
|
||||||
|
}
|
||||||
|
when (event.type.toInt()) {
|
||||||
|
0,
|
||||||
|
1 -> {
|
||||||
|
S8.write(buf, event.byteA)
|
||||||
|
S8.write(buf, event.byteB)
|
||||||
|
S32LE.write(buf, event.intA)
|
||||||
|
S32LE.write(buf, event.intB)
|
||||||
|
}
|
||||||
|
|
||||||
|
2,
|
||||||
|
3 -> {
|
||||||
|
S8.write(buf, event.byteA)
|
||||||
|
S8.write(buf, event.byteB)
|
||||||
|
S16LE.write(buf, event.shortA)
|
||||||
|
S16LE.write(buf, event.shortB)
|
||||||
|
S32LE.write(buf, event.intA)
|
||||||
|
S32LE.write(buf, event.intB)
|
||||||
|
}
|
||||||
|
|
||||||
|
4,
|
||||||
|
14 -> {
|
||||||
|
S8.write(buf, event.byteB)
|
||||||
|
S16LE.write(buf, event.shortA)
|
||||||
|
S16LE.write(buf, event.shortB)
|
||||||
|
S32LE.write(buf, event.intA)
|
||||||
|
S32LE.write(buf, event.intB)
|
||||||
|
}
|
||||||
|
|
||||||
|
5,
|
||||||
|
6,
|
||||||
|
7,
|
||||||
|
8 -> {
|
||||||
|
S8.write(buf, event.byteB)
|
||||||
|
}
|
||||||
|
|
||||||
|
9 -> {
|
||||||
|
S16LE.write(buf, event.shortA)
|
||||||
|
S16LE.write(buf, event.shortB)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
previous = event.timestamp
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object BatchInputEventsPacketCodec : PacketCodec<BatchInputEventsPacket>() {
|
object BatchInputEventsPacketCodec : PacketCodec<BatchInputEventsPacket>() {
|
||||||
override fun CodecScope<BatchInputEventsPacket>.body(): BatchInputEventsPacket {
|
override fun CodecScope<BatchInputEventsPacket>.body(): BatchInputEventsPacket {
|
||||||
val hasEvents = field(Bool) { it.hasEvents }
|
val hasEvents = field(Bool) { it.hasEvents }
|
||||||
val events = field(EventsCodec) { it.events }
|
val events = field(EventsCodec) { it.events }
|
||||||
return BatchInputEventsPacket(hasEvents, events)
|
return BatchInputEventsPacket(hasEvents, events)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+73
-61
@@ -29,56 +29,68 @@ data class BattleActionParticipant(
|
|||||||
|
|
||||||
private val BattleRewardEntryCodec: Codec<BattleActionRewardEntry> =
|
private val BattleRewardEntryCodec: Codec<BattleActionRewardEntry> =
|
||||||
object : PacketCodec<BattleActionRewardEntry>() {
|
object : PacketCodec<BattleActionRewardEntry>() {
|
||||||
override fun CodecScope<BattleActionRewardEntry>.body(): BattleActionRewardEntry {
|
override fun CodecScope<BattleActionRewardEntry>.body(): BattleActionRewardEntry {
|
||||||
val itemId = field(S32LE) { it.itemId }
|
val itemId = field(S32LE) { it.itemId }
|
||||||
val quantity = field(S16LE) { it.quantity }
|
val quantity = field(S16LE) { it.quantity }
|
||||||
return BattleActionRewardEntry(itemId, quantity)
|
return BattleActionRewardEntry(itemId, quantity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class BattleParticipantCodec(private val isCapture: Boolean) :
|
private class BattleParticipantCodec(private val isCapture: Boolean) :
|
||||||
PacketCodec<BattleActionParticipant>() {
|
PacketCodec<BattleActionParticipant>() {
|
||||||
override fun CodecScope<BattleActionParticipant>.body(): BattleActionParticipant {
|
override fun CodecScope<BattleActionParticipant>.body(): BattleActionParticipant {
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
val kind = field(U8) { it.kind }
|
val kind = field(U8) { it.kind }
|
||||||
val intA = field(S32LE) { it.intA }
|
val intA = field(S32LE) { it.intA }
|
||||||
val intB = field(S32LE) { it.intB }
|
val intB = field(S32LE) { it.intB }
|
||||||
val intC = field(S32LE) { it.intC }
|
val intC = field(S32LE) { it.intC }
|
||||||
val shortA = field(S16LE) { it.shortA }
|
val shortA = field(S16LE) { it.shortA }
|
||||||
var critByte: Byte? = null
|
var critByte: Byte? = null
|
||||||
var critShort: Short? = null
|
var critShort: Short? = null
|
||||||
if (isCapture) {
|
if (isCapture) {
|
||||||
critByte = field(S8) { it.critByte!! }
|
critByte = field(S8) { it.critByte!! }
|
||||||
critShort = field(S16LE) { it.critShort!! }
|
critShort = field(S16LE) { it.critShort!! }
|
||||||
}
|
|
||||||
var capturedShort: Short? = null
|
|
||||||
var capturedByte: Byte? = null
|
|
||||||
if (isCapture || kind == 1) {
|
|
||||||
capturedShort = field(S16LE) { it.capturedShort!! }
|
|
||||||
capturedByte = field(S8) { it.capturedByte!! }
|
|
||||||
}
|
|
||||||
var xpShort: Short? = null
|
|
||||||
var xpByteA: Byte? = null
|
|
||||||
var xpByteB: Byte? = null
|
|
||||||
if (isCapture && kind == 0) {
|
|
||||||
xpShort = field(S16LE) { it.xpShort!! }
|
|
||||||
xpByteA = field(S8) { it.xpByteA!! }
|
|
||||||
xpByteB = field(S8) { it.xpByteB!! }
|
|
||||||
}
|
|
||||||
var pokemon: Pokemon? = null
|
|
||||||
var statStages: List<Short>? = null
|
|
||||||
if (kind == 0) {
|
|
||||||
val present = field(U8) { if (it.pokemon != null) 1 else 0 }
|
|
||||||
if (present == 1) {
|
|
||||||
pokemon = field(PokemonCodec) { it.pokemon!! }
|
|
||||||
statStages = (0 until 6).map { i -> field(S16LE) { it.statStages!![i] } }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return BattleActionParticipant(
|
|
||||||
entityId, kind, intA, intB, intC, shortA, critByte, critShort, capturedShort, capturedByte,
|
|
||||||
xpShort, xpByteA, xpByteB, pokemon, statStages
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
var capturedShort: Short? = null
|
||||||
|
var capturedByte: Byte? = null
|
||||||
|
if (isCapture || kind == 1) {
|
||||||
|
capturedShort = field(S16LE) { it.capturedShort!! }
|
||||||
|
capturedByte = field(S8) { it.capturedByte!! }
|
||||||
|
}
|
||||||
|
var xpShort: Short? = null
|
||||||
|
var xpByteA: Byte? = null
|
||||||
|
var xpByteB: Byte? = null
|
||||||
|
if (isCapture && kind == 0) {
|
||||||
|
xpShort = field(S16LE) { it.xpShort!! }
|
||||||
|
xpByteA = field(S8) { it.xpByteA!! }
|
||||||
|
xpByteB = field(S8) { it.xpByteB!! }
|
||||||
|
}
|
||||||
|
var pokemon: Pokemon? = null
|
||||||
|
var statStages: List<Short>? = null
|
||||||
|
if (kind == 0) {
|
||||||
|
val present = field(U8) { if (it.pokemon != null) 1 else 0 }
|
||||||
|
if (present == 1) {
|
||||||
|
pokemon = field(PokemonCodec) { it.pokemon!! }
|
||||||
|
statStages = (0 until 6).map { i -> field(S16LE) { it.statStages!![i] } }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return BattleActionParticipant(
|
||||||
|
entityId,
|
||||||
|
kind,
|
||||||
|
intA,
|
||||||
|
intB,
|
||||||
|
intC,
|
||||||
|
shortA,
|
||||||
|
critByte,
|
||||||
|
critShort,
|
||||||
|
capturedShort,
|
||||||
|
capturedByte,
|
||||||
|
xpShort,
|
||||||
|
xpByteA,
|
||||||
|
xpByteB,
|
||||||
|
pokemon,
|
||||||
|
statStages)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleActionOutcomePacket(
|
data class BattleActionOutcomePacket(
|
||||||
@@ -91,20 +103,20 @@ data class BattleActionOutcomePacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleActionOutcomePacketCodec : PacketCodec<BattleActionOutcomePacket>() {
|
object BattleActionOutcomePacketCodec : PacketCodec<BattleActionOutcomePacket>() {
|
||||||
override fun CodecScope<BattleActionOutcomePacket>.body(): BattleActionOutcomePacket {
|
override fun CodecScope<BattleActionOutcomePacket>.body(): BattleActionOutcomePacket {
|
||||||
val side = field(S8) { it.side }
|
val side = field(S8) { it.side }
|
||||||
val category = field(U8) { it.category }
|
val category = field(U8) { it.category }
|
||||||
val value = field(S16LE) { it.value }
|
val value = field(S16LE) { it.value }
|
||||||
val extra = field(S32LE) { it.extra }
|
val extra = field(S32LE) { it.extra }
|
||||||
val isCapture = category == 2
|
val isCapture = category == 2
|
||||||
val participantCodec = BattleParticipantCodec(isCapture)
|
val participantCodec = BattleParticipantCodec(isCapture)
|
||||||
val count = field(U8) { it.participants.size }
|
val count = field(U8) { it.participants.size }
|
||||||
val participants = (0 until count).map { i -> field(participantCodec) { it.participants[i] } }
|
val participants = (0 until count).map { i -> field(participantCodec) { it.participants[i] } }
|
||||||
val rewards =
|
val rewards =
|
||||||
if (category == 1) {
|
if (category == 1) {
|
||||||
val rewardCount = field(U8) { it.rewards!!.size }
|
val rewardCount = field(U8) { it.rewards!!.size }
|
||||||
(0 until rewardCount).map { i -> field(BattleRewardEntryCodec) { it.rewards!![i] } }
|
(0 until rewardCount).map { i -> field(BattleRewardEntryCodec) { it.rewards!![i] } }
|
||||||
} else null
|
} else null
|
||||||
return BattleActionOutcomePacket(side, category, value, extra, participants, rewards)
|
return BattleActionOutcomePacket(side, category, value, extra, participants, rewards)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+8
-8
@@ -11,12 +11,12 @@ data class BattleActionPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleActionPacketCodec : PacketCodec<BattleActionPacket>() {
|
object BattleActionPacketCodec : PacketCodec<BattleActionPacket>() {
|
||||||
override fun CodecScope<BattleActionPacket>.body(): BattleActionPacket {
|
override fun CodecScope<BattleActionPacket>.body(): BattleActionPacket {
|
||||||
val actionTypeId = field(S8) { it.actionTypeId }
|
val actionTypeId = field(S8) { it.actionTypeId }
|
||||||
val isSlotTarget = field(Bool) { it.isSlotTarget }
|
val isSlotTarget = field(Bool) { it.isSlotTarget }
|
||||||
val targetSlot: Short? = if (isSlotTarget) field(S16LE) { it.targetSlot!! } else null
|
val targetSlot: Short? = if (isSlotTarget) field(S16LE) { it.targetSlot!! } else null
|
||||||
val targetEntityId: Long? = if (!isSlotTarget) field(S64LE) { it.targetEntityId!! } else null
|
val targetEntityId: Long? = if (!isSlotTarget) field(S64LE) { it.targetEntityId!! } else null
|
||||||
val extraFlag = field(S8) { it.extraFlag }
|
val extraFlag = field(S8) { it.extraFlag }
|
||||||
return BattleActionPacket(actionTypeId, isSlotTarget, targetSlot, targetEntityId, extraFlag)
|
return BattleActionPacket(actionTypeId, isSlotTarget, targetSlot, targetEntityId, extraFlag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -9,8 +9,8 @@ data class BattleActionPromptTogglePacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleActionPromptTogglePacketCodec : PacketCodec<BattleActionPromptTogglePacket>() {
|
object BattleActionPromptTogglePacketCodec : PacketCodec<BattleActionPromptTogglePacket>() {
|
||||||
override fun CodecScope<BattleActionPromptTogglePacket>.body(): BattleActionPromptTogglePacket {
|
override fun CodecScope<BattleActionPromptTogglePacket>.body(): BattleActionPromptTogglePacket {
|
||||||
val shown = field(Bool) { it.shown }
|
val shown = field(Bool) { it.shown }
|
||||||
return BattleActionPromptTogglePacket(shown)
|
return BattleActionPromptTogglePacket(shown)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+14
-14
@@ -12,20 +12,20 @@ data class BattleActionResultPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleActionResultPacketCodec : PacketCodec<BattleActionResultPacket>() {
|
object BattleActionResultPacketCodec : PacketCodec<BattleActionResultPacket>() {
|
||||||
private const val MESSAGE_TYPE_WITH_MOVE: Int = 0
|
private const val MESSAGE_TYPE_WITH_MOVE: Int = 0
|
||||||
|
|
||||||
override fun CodecScope<BattleActionResultPacket>.body(): BattleActionResultPacket {
|
override fun CodecScope<BattleActionResultPacket>.body(): BattleActionResultPacket {
|
||||||
val targetCount = field(S8) { it.targetCount }
|
val targetCount = field(S8) { it.targetCount }
|
||||||
val targets = ArrayList<Byte>()
|
val targets = ArrayList<Byte>()
|
||||||
var entityId = 0L
|
var entityId = 0L
|
||||||
if (targetCount < 0) {
|
if (targetCount < 0) {
|
||||||
entityId = field(S64LE) { it.entityId }
|
entityId = field(S64LE) { it.entityId }
|
||||||
} else {
|
} else {
|
||||||
repeat(targetCount.toInt()) { i -> targets.add(field(S8) { p -> p.targets[i] }) }
|
repeat(targetCount.toInt()) { i -> targets.add(field(S8) { p -> p.targets[i] }) }
|
||||||
}
|
|
||||||
val value = field(S32LE) { it.value }
|
|
||||||
val messageType = field(S8) { it.messageType }
|
|
||||||
val move = if (messageType.toInt() == MESSAGE_TYPE_WITH_MOVE) field(S8) { it.move!! } else null
|
|
||||||
return BattleActionResultPacket(targetCount, targets, entityId, value, messageType, move)
|
|
||||||
}
|
}
|
||||||
|
val value = field(S32LE) { it.value }
|
||||||
|
val messageType = field(S8) { it.messageType }
|
||||||
|
val move = if (messageType.toInt() == MESSAGE_TYPE_WITH_MOVE) field(S8) { it.move!! } else null
|
||||||
|
return BattleActionResultPacket(targetCount, targets, entityId, value, messageType, move)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+26
-25
@@ -13,36 +13,37 @@ data class BattleActionSelectPacket(
|
|||||||
|
|
||||||
private val BattleActionSelectBody: Codec<BattleActionSelectPacket> =
|
private val BattleActionSelectBody: Codec<BattleActionSelectPacket> =
|
||||||
object : Codec<BattleActionSelectPacket> {
|
object : Codec<BattleActionSelectPacket> {
|
||||||
override fun read(buf: ReadBuffer): BattleActionSelectPacket {
|
override fun read(buf: ReadBuffer): BattleActionSelectPacket {
|
||||||
val slotRefPacked = S8.read(buf)
|
val slotRefPacked = S8.read(buf)
|
||||||
val actionKindId = S8.read(buf)
|
val actionKindId = S8.read(buf)
|
||||||
return BattleActionSelectPacket(slotRefPacked, actionKindId, 0, 0, 0, 0)
|
return BattleActionSelectPacket(slotRefPacked, actionKindId, 0, 0, 0, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun write(buf: WriteBuffer, value: BattleActionSelectPacket) {
|
override fun write(buf: WriteBuffer, value: BattleActionSelectPacket) {
|
||||||
S8.write(buf, value.slotRefPacked)
|
S8.write(buf, value.slotRefPacked)
|
||||||
S8.write(buf, value.actionKindId)
|
S8.write(buf, value.actionKindId)
|
||||||
when (value.payloadVariant) {
|
when (value.payloadVariant) {
|
||||||
1 -> {
|
1 -> {
|
||||||
S16LE.write(buf, value.moveOrItemId)
|
S16LE.write(buf, value.moveOrItemId)
|
||||||
S8.write(buf, value.extraFlag)
|
S8.write(buf, value.extraFlag)
|
||||||
}
|
}
|
||||||
|
|
||||||
2, 3 -> {
|
2,
|
||||||
S16LE.write(buf, value.moveOrItemId)
|
3 -> {
|
||||||
}
|
S16LE.write(buf, value.moveOrItemId)
|
||||||
|
}
|
||||||
|
|
||||||
4 -> {
|
4 -> {
|
||||||
S16LE.write(buf, value.moveOrItemId)
|
S16LE.write(buf, value.moveOrItemId)
|
||||||
S64LE.write(buf, value.targetEntityId)
|
S64LE.write(buf, value.targetEntityId)
|
||||||
S8.write(buf, value.extraFlag)
|
S8.write(buf, value.extraFlag)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object BattleActionSelectPacketCodec : PacketCodec<BattleActionSelectPacket>() {
|
object BattleActionSelectPacketCodec : PacketCodec<BattleActionSelectPacket>() {
|
||||||
override fun CodecScope<BattleActionSelectPacket>.body(): BattleActionSelectPacket {
|
override fun CodecScope<BattleActionSelectPacket>.body(): BattleActionSelectPacket {
|
||||||
return field(BattleActionSelectBody) { it }
|
return field(BattleActionSelectBody) { it }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+41
-41
@@ -12,54 +12,54 @@ data class MultiTierAction(val selections: List<TierSlotSelection>) : BattleActi
|
|||||||
|
|
||||||
private val BattleActionCodec: Codec<BattleAction> =
|
private val BattleActionCodec: Codec<BattleAction> =
|
||||||
object : Codec<BattleAction> {
|
object : Codec<BattleAction> {
|
||||||
override fun read(buf: ReadBuffer): BattleAction {
|
override fun read(buf: ReadBuffer): BattleAction {
|
||||||
val first = buf.readByte().toInt() and 0xFF
|
val first = buf.readByte().toInt() and 0xFF
|
||||||
return if (first == 0) {
|
return if (first == 0) {
|
||||||
var id = 0L
|
var id = 0L
|
||||||
for (i in 0 until 8) {
|
for (i in 0 until 8) {
|
||||||
id = id or ((buf.readByte().toLong() and 0xFF) shl (i * 8))
|
id = id or ((buf.readByte().toLong() and 0xFF) shl (i * 8))
|
||||||
}
|
}
|
||||||
val moveSlot = buf.readByte()
|
val moveSlot = buf.readByte()
|
||||||
SinglePokemonAction(id, moveSlot)
|
SinglePokemonAction(id, moveSlot)
|
||||||
} else {
|
} else {
|
||||||
val selections = ArrayList<TierSlotSelection>(first)
|
val selections = ArrayList<TierSlotSelection>(first)
|
||||||
repeat(first) {
|
repeat(first) {
|
||||||
val tierIndex = buf.readByte()
|
val tierIndex = buf.readByte()
|
||||||
val slot = buf.readByte()
|
val slot = buf.readByte()
|
||||||
selections.add(TierSlotSelection(tierIndex, slot))
|
selections.add(TierSlotSelection(tierIndex, slot))
|
||||||
}
|
}
|
||||||
MultiTierAction(selections)
|
MultiTierAction(selections)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun write(buf: WriteBuffer, value: BattleAction) {
|
override fun write(buf: WriteBuffer, value: BattleAction) {
|
||||||
when (value) {
|
when (value) {
|
||||||
is SinglePokemonAction -> {
|
is SinglePokemonAction -> {
|
||||||
buf.writeByte(0.toByte())
|
buf.writeByte(0.toByte())
|
||||||
var v = value.pokemonEntityId
|
var v = value.pokemonEntityId
|
||||||
for (i in 0 until 8) {
|
for (i in 0 until 8) {
|
||||||
buf.writeByte((v and 0xFF).toByte())
|
buf.writeByte((v and 0xFF).toByte())
|
||||||
v = v ushr 8
|
v = v ushr 8
|
||||||
}
|
|
||||||
buf.writeByte(value.moveSlot)
|
|
||||||
}
|
|
||||||
|
|
||||||
is MultiTierAction -> {
|
|
||||||
buf.writeByte(value.selections.size.toByte())
|
|
||||||
for (s in value.selections) {
|
|
||||||
buf.writeByte(s.tierIndex)
|
|
||||||
buf.writeByte(s.slot)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
buf.writeByte(value.moveSlot)
|
||||||
|
}
|
||||||
|
|
||||||
|
is MultiTierAction -> {
|
||||||
|
buf.writeByte(value.selections.size.toByte())
|
||||||
|
for (s in value.selections) {
|
||||||
|
buf.writeByte(s.tierIndex)
|
||||||
|
buf.writeByte(s.slot)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleActionSubmitPacket(val action: BattleAction)
|
data class BattleActionSubmitPacket(val action: BattleAction)
|
||||||
|
|
||||||
object BattleActionSubmitPacketCodec : PacketCodec<BattleActionSubmitPacket>() {
|
object BattleActionSubmitPacketCodec : PacketCodec<BattleActionSubmitPacket>() {
|
||||||
override fun CodecScope<BattleActionSubmitPacket>.body(): BattleActionSubmitPacket {
|
override fun CodecScope<BattleActionSubmitPacket>.body(): BattleActionSubmitPacket {
|
||||||
val action = field(BattleActionCodec) { it.action }
|
val action = field(BattleActionCodec) { it.action }
|
||||||
return BattleActionSubmitPacket(action)
|
return BattleActionSubmitPacket(action)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+9
-9
@@ -12,13 +12,13 @@ data class BattleBoardCellPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleBoardCellPacketCodec : PacketCodec<BattleBoardCellPacket>() {
|
object BattleBoardCellPacketCodec : PacketCodec<BattleBoardCellPacket>() {
|
||||||
override fun CodecScope<BattleBoardCellPacket>.body(): BattleBoardCellPacket {
|
override fun CodecScope<BattleBoardCellPacket>.body(): BattleBoardCellPacket {
|
||||||
val row = field(S8) { it.row }
|
val row = field(S8) { it.row }
|
||||||
val column = field(S16LE) { it.column }
|
val column = field(S16LE) { it.column }
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
val valueA = field(S16LE) { it.valueA }
|
val valueA = field(S16LE) { it.valueA }
|
||||||
val valueB = field(S16LE) { it.valueB }
|
val valueB = field(S16LE) { it.valueB }
|
||||||
val flags = field(S8) { it.flags }
|
val flags = field(S8) { it.flags }
|
||||||
return BattleBoardCellPacket(row, column, entityId, valueA, valueB, flags)
|
return BattleBoardCellPacket(row, column, entityId, valueA, valueB, flags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+110
-109
@@ -24,51 +24,51 @@ internal data class BattleMessageArg(
|
|||||||
|
|
||||||
internal val BattleMessageArgCodec: Codec<BattleMessageArg> =
|
internal val BattleMessageArgCodec: Codec<BattleMessageArg> =
|
||||||
object : Codec<BattleMessageArg> {
|
object : Codec<BattleMessageArg> {
|
||||||
override fun read(buf: ReadBuffer): BattleMessageArg {
|
override fun read(buf: ReadBuffer): BattleMessageArg {
|
||||||
val id = S8.read(buf)
|
val id = S8.read(buf)
|
||||||
var type = S8.read(buf)
|
var type = S8.read(buf)
|
||||||
var hasExtra = false
|
var hasExtra = false
|
||||||
var extra: Byte = 0
|
var extra: Byte = 0
|
||||||
if (type.toInt() and 0x80 != 0) {
|
if (type.toInt() and 0x80 != 0) {
|
||||||
type = (type.toInt() and 0x7F).toByte()
|
type = (type.toInt() and 0x7F).toByte()
|
||||||
hasExtra = true
|
hasExtra = true
|
||||||
extra = S8.read(buf)
|
extra = S8.read(buf)
|
||||||
}
|
|
||||||
val t = type.toInt()
|
|
||||||
val payload: BattleMessageArgPayload =
|
|
||||||
when {
|
|
||||||
t == 5 -> StringArgPayload(Utf16LeNullTerminated.read(buf))
|
|
||||||
t == 28 -> EmptyArgPayload
|
|
||||||
t == 30 -> LongArgPayload(S64LE.read(buf))
|
|
||||||
t == 9 || t == 10 || t == 17 -> IntArgPayload(S32LE.read(buf))
|
|
||||||
t == 18 -> StringArgPayload(Utf16LeNullTerminated.read(buf))
|
|
||||||
else -> {
|
|
||||||
val n = U8.read(buf)
|
|
||||||
ShortListArgPayload((0 until n).map { S16LE.read(buf) })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return BattleMessageArg(id, type, hasExtra, extra, payload)
|
|
||||||
}
|
}
|
||||||
|
val t = type.toInt()
|
||||||
override fun write(buf: WriteBuffer, value: BattleMessageArg) {
|
val payload: BattleMessageArgPayload =
|
||||||
S8.write(buf, value.id)
|
|
||||||
val rawType = if (value.hasExtra) (value.type.toInt() or 0x80).toByte() else value.type
|
|
||||||
S8.write(buf, rawType)
|
|
||||||
if (value.hasExtra) S8.write(buf, value.extra)
|
|
||||||
val t = value.type.toInt()
|
|
||||||
when {
|
when {
|
||||||
t == 5 -> Utf16LeNullTerminated.write(buf, (value.payload as StringArgPayload).value)
|
t == 5 -> StringArgPayload(Utf16LeNullTerminated.read(buf))
|
||||||
t == 28 -> {}
|
t == 28 -> EmptyArgPayload
|
||||||
t == 30 -> S64LE.write(buf, (value.payload as LongArgPayload).value)
|
t == 30 -> LongArgPayload(S64LE.read(buf))
|
||||||
t == 9 || t == 10 || t == 17 -> S32LE.write(buf, (value.payload as IntArgPayload).value)
|
t == 9 || t == 10 || t == 17 -> IntArgPayload(S32LE.read(buf))
|
||||||
t == 18 -> Utf16LeNullTerminated.write(buf, (value.payload as StringArgPayload).value)
|
t == 18 -> StringArgPayload(Utf16LeNullTerminated.read(buf))
|
||||||
else -> {
|
else -> {
|
||||||
val values = (value.payload as ShortListArgPayload).values
|
val n = U8.read(buf)
|
||||||
U8.write(buf, values.size)
|
ShortListArgPayload((0 until n).map { S16LE.read(buf) })
|
||||||
for (s in values) S16LE.write(buf, s)
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return BattleMessageArg(id, type, hasExtra, extra, payload)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun write(buf: WriteBuffer, value: BattleMessageArg) {
|
||||||
|
S8.write(buf, value.id)
|
||||||
|
val rawType = if (value.hasExtra) (value.type.toInt() or 0x80).toByte() else value.type
|
||||||
|
S8.write(buf, rawType)
|
||||||
|
if (value.hasExtra) S8.write(buf, value.extra)
|
||||||
|
val t = value.type.toInt()
|
||||||
|
when {
|
||||||
|
t == 5 -> Utf16LeNullTerminated.write(buf, (value.payload as StringArgPayload).value)
|
||||||
|
t == 28 -> {}
|
||||||
|
t == 30 -> S64LE.write(buf, (value.payload as LongArgPayload).value)
|
||||||
|
t == 9 || t == 10 || t == 17 -> S32LE.write(buf, (value.payload as IntArgPayload).value)
|
||||||
|
t == 18 -> Utf16LeNullTerminated.write(buf, (value.payload as StringArgPayload).value)
|
||||||
|
else -> {
|
||||||
|
val values = (value.payload as ShortListArgPayload).values
|
||||||
|
U8.write(buf, values.size)
|
||||||
|
for (s in values) S16LE.write(buf, s)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sealed class BattleSerializedEntry
|
sealed class BattleSerializedEntry
|
||||||
@@ -91,75 +91,76 @@ internal object EmptyCreatureDataEntry : BattleSerializedEntry()
|
|||||||
|
|
||||||
internal val BattleSerializedEntryCodec: Codec<BattleSerializedEntry> =
|
internal val BattleSerializedEntryCodec: Codec<BattleSerializedEntry> =
|
||||||
object : Codec<BattleSerializedEntry> {
|
object : Codec<BattleSerializedEntry> {
|
||||||
override fun read(buf: ReadBuffer): BattleSerializedEntry {
|
override fun read(buf: ReadBuffer): BattleSerializedEntry {
|
||||||
return when (val tag = S8.read(buf).toInt()) {
|
return when (val tag = S8.read(buf).toInt()) {
|
||||||
-1 -> NullSerializedEntry
|
-1 -> NullSerializedEntry
|
||||||
0 -> {
|
0 -> {
|
||||||
val value = S32LE.read(buf)
|
val value = S32LE.read(buf)
|
||||||
val n = U8.read(buf)
|
val n = U8.read(buf)
|
||||||
CreatureDataEntry(value, (0 until n).map { BattleMessageArgCodec.read(buf) })
|
CreatureDataEntry(value, (0 until n).map { BattleMessageArgCodec.read(buf) })
|
||||||
}
|
}
|
||||||
|
|
||||||
1 -> {
|
1 -> {
|
||||||
val v = S8.read(buf)
|
val v = S8.read(buf)
|
||||||
val n = U8.read(buf)
|
val n = U8.read(buf)
|
||||||
CreatureMovesEntry(v, (0 until n).map { S16LE.read(buf) })
|
CreatureMovesEntry(v, (0 until n).map { S16LE.read(buf) })
|
||||||
}
|
}
|
||||||
|
|
||||||
2 -> {
|
2 -> {
|
||||||
val moveId = S16LE.read(buf)
|
val moveId = S16LE.read(buf)
|
||||||
val a = S8.read(buf)
|
val a = S8.read(buf)
|
||||||
val b = S8.read(buf)
|
val b = S8.read(buf)
|
||||||
MoveAnimationEntry(a, b, moveId)
|
MoveAnimationEntry(a, b, moveId)
|
||||||
}
|
}
|
||||||
|
|
||||||
3 -> {
|
3 -> {
|
||||||
val a = S8.read(buf)
|
val a = S8.read(buf)
|
||||||
val typeId = S8.read(buf)
|
val typeId = S8.read(buf)
|
||||||
val x = S16LE.read(buf)
|
val x = S16LE.read(buf)
|
||||||
val y = S16LE.read(buf)
|
val y = S16LE.read(buf)
|
||||||
TextCreatureEntry(a, typeId, x, y)
|
TextCreatureEntry(a, typeId, x, y)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> EmptyCreatureDataEntry
|
else -> EmptyCreatureDataEntry
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun write(buf: WriteBuffer, value: BattleSerializedEntry) {
|
override fun write(buf: WriteBuffer, value: BattleSerializedEntry) {
|
||||||
when (value) {
|
when (value) {
|
||||||
is NullSerializedEntry -> S8.write(buf, (-1).toByte())
|
is NullSerializedEntry -> S8.write(buf, (-1).toByte())
|
||||||
is CreatureDataEntry -> {
|
is CreatureDataEntry -> {
|
||||||
S8.write(buf, 0)
|
S8.write(buf, 0)
|
||||||
S32LE.write(buf, value.value)
|
S32LE.write(buf, value.value)
|
||||||
U8.write(buf, value.args.size)
|
U8.write(buf, value.args.size)
|
||||||
for (a in value.args) BattleMessageArgCodec.write(buf, a)
|
for (a in value.args) BattleMessageArgCodec.write(buf, a)
|
||||||
}
|
}
|
||||||
|
|
||||||
is CreatureMovesEntry -> {
|
is CreatureMovesEntry -> {
|
||||||
S8.write(buf, 1)
|
S8.write(buf, 1)
|
||||||
S8.write(buf, value.value)
|
S8.write(buf, value.value)
|
||||||
U8.write(buf, value.moves.size)
|
U8.write(buf, value.moves.size)
|
||||||
for (m in value.moves) S16LE.write(buf, m)
|
for (m in value.moves) S16LE.write(buf, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
is MoveAnimationEntry -> {
|
is MoveAnimationEntry -> {
|
||||||
S8.write(buf, 2)
|
S8.write(buf, 2)
|
||||||
S16LE.write(buf, value.moveId)
|
S16LE.write(buf, value.moveId)
|
||||||
S8.write(buf, value.a)
|
S8.write(buf, value.a)
|
||||||
S8.write(buf, value.b)
|
S8.write(buf, value.b)
|
||||||
}
|
}
|
||||||
|
|
||||||
is TextCreatureEntry -> {
|
is TextCreatureEntry -> {
|
||||||
S8.write(buf, 3)
|
S8.write(buf, 3)
|
||||||
S8.write(buf, value.a)
|
S8.write(buf, value.a)
|
||||||
S8.write(buf, value.typeId)
|
S8.write(buf, value.typeId)
|
||||||
S16LE.write(buf, value.x)
|
S16LE.write(buf, value.x)
|
||||||
S16LE.write(buf, value.y)
|
S16LE.write(buf, value.y)
|
||||||
}
|
}
|
||||||
|
|
||||||
is EmptyCreatureDataEntry -> throw MalformedPacketException("cannot encode default battle entry")
|
is EmptyCreatureDataEntry ->
|
||||||
}
|
throw MalformedPacketException("cannot encode default battle entry")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleBulkStatePacket(
|
data class BattleBulkStatePacket(
|
||||||
@@ -173,14 +174,14 @@ data class BattleBulkStatePacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleBulkStatePacketCodec : PacketCodec<BattleBulkStatePacket>() {
|
object BattleBulkStatePacketCodec : PacketCodec<BattleBulkStatePacket>() {
|
||||||
override fun CodecScope<BattleBulkStatePacket>.body(): BattleBulkStatePacket {
|
override fun CodecScope<BattleBulkStatePacket>.body(): BattleBulkStatePacket {
|
||||||
val phase = field(S8) { it.phase }
|
val phase = field(S8) { it.phase }
|
||||||
val firstGroup = field(BattleSerializedEntryCodec.listPrefixed(U8)) { it.firstGroup }
|
val firstGroup = field(BattleSerializedEntryCodec.listPrefixed(U8)) { it.firstGroup }
|
||||||
val secondGroup = field(BattleSerializedEntryCodec.listPrefixed(U8)) { it.secondGroup }
|
val secondGroup = field(BattleSerializedEntryCodec.listPrefixed(U8)) { it.secondGroup }
|
||||||
val valueA = field(S32LE) { it.valueA }
|
val valueA = field(S32LE) { it.valueA }
|
||||||
val valueB = field(S32LE) { it.valueB }
|
val valueB = field(S32LE) { it.valueB }
|
||||||
val flag = field(S8) { it.flag }
|
val flag = field(S8) { it.flag }
|
||||||
val thirdGroup = field(BattleSerializedEntryCodec.listPrefixed(U8)) { it.thirdGroup }
|
val thirdGroup = field(BattleSerializedEntryCodec.listPrefixed(U8)) { it.thirdGroup }
|
||||||
return BattleBulkStatePacket(phase, firstGroup, secondGroup, valueA, valueB, flag, thirdGroup)
|
return BattleBulkStatePacket(phase, firstGroup, secondGroup, valueA, valueB, flag, thirdGroup)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-3
@@ -6,7 +6,7 @@ import de.fiereu.bytecodec.PacketCodec
|
|||||||
class BattleCancelRequestPacket
|
class BattleCancelRequestPacket
|
||||||
|
|
||||||
object BattleCancelRequestPacketCodec : PacketCodec<BattleCancelRequestPacket>() {
|
object BattleCancelRequestPacketCodec : PacketCodec<BattleCancelRequestPacket>() {
|
||||||
override fun CodecScope<BattleCancelRequestPacket>.body(): BattleCancelRequestPacket {
|
override fun CodecScope<BattleCancelRequestPacket>.body(): BattleCancelRequestPacket {
|
||||||
return BattleCancelRequestPacket()
|
return BattleCancelRequestPacket()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+57
-57
@@ -12,70 +12,70 @@ data class BattleChallengeRequestPacket(
|
|||||||
val ruleParam: Short,
|
val ruleParam: Short,
|
||||||
val extraRule: ByteArray?,
|
val extraRule: ByteArray?,
|
||||||
) {
|
) {
|
||||||
override fun equals(other: Any?): Boolean =
|
override fun equals(other: Any?): Boolean =
|
||||||
other is BattleChallengeRequestPacket &&
|
other is BattleChallengeRequestPacket &&
|
||||||
flags == other.flags &&
|
flags == other.flags &&
|
||||||
entryKindId == other.entryKindId &&
|
entryKindId == other.entryKindId &&
|
||||||
battleFormat == other.battleFormat &&
|
battleFormat == other.battleFormat &&
|
||||||
levelCap == other.levelCap &&
|
levelCap == other.levelCap &&
|
||||||
allowedSpecies == other.allowedSpecies &&
|
allowedSpecies == other.allowedSpecies &&
|
||||||
ruleSet == other.ruleSet &&
|
ruleSet == other.ruleSet &&
|
||||||
ruleParam == other.ruleParam &&
|
ruleParam == other.ruleParam &&
|
||||||
(extraRule?.contentEquals(other.extraRule ?: ByteArray(0)) ?: (other.extraRule == null))
|
(extraRule?.contentEquals(other.extraRule ?: ByteArray(0)) ?: (other.extraRule == null))
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
var r = flags.toInt()
|
var r = flags.toInt()
|
||||||
r = r * 31 + entryKindId
|
r = r * 31 + entryKindId
|
||||||
r = r * 31 + battleFormat
|
r = r * 31 + battleFormat
|
||||||
r = r * 31 + levelCap
|
r = r * 31 + levelCap
|
||||||
r = r * 31 + allowedSpecies.hashCode()
|
r = r * 31 + allowedSpecies.hashCode()
|
||||||
r = r * 31 + ruleSet
|
r = r * 31 + ruleSet
|
||||||
r = r * 31 + ruleParam
|
r = r * 31 + ruleParam
|
||||||
r = r * 31 + (extraRule?.contentHashCode() ?: 0)
|
r = r * 31 + (extraRule?.contentHashCode() ?: 0)
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val ExtraRuleBytes: Codec<ByteArray> =
|
private val ExtraRuleBytes: Codec<ByteArray> =
|
||||||
object : Codec<ByteArray> {
|
object : Codec<ByteArray> {
|
||||||
override fun read(buf: ReadBuffer): ByteArray {
|
override fun read(buf: ReadBuffer): ByteArray {
|
||||||
val data = ByteArray(buf.remaining())
|
val data = ByteArray(buf.remaining())
|
||||||
if (data.isNotEmpty()) buf.readBytes(data)
|
if (data.isNotEmpty()) buf.readBytes(data)
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun write(buf: WriteBuffer, value: ByteArray) {
|
override fun write(buf: WriteBuffer, value: ByteArray) {
|
||||||
if (value.isNotEmpty()) buf.writeBytes(value)
|
if (value.isNotEmpty()) buf.writeBytes(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object BattleChallengeRequestPacketCodec : PacketCodec<BattleChallengeRequestPacket>() {
|
object BattleChallengeRequestPacketCodec : PacketCodec<BattleChallengeRequestPacket>() {
|
||||||
override fun CodecScope<BattleChallengeRequestPacket>.body(): BattleChallengeRequestPacket {
|
override fun CodecScope<BattleChallengeRequestPacket>.body(): BattleChallengeRequestPacket {
|
||||||
val flags = field(S8) { it.flags }
|
val flags = field(S8) { it.flags }
|
||||||
val entryKindId = field(S8) { it.entryKindId }
|
val entryKindId = field(S8) { it.entryKindId }
|
||||||
val battleFormat = field(S8) { it.battleFormat }
|
val battleFormat = field(S8) { it.battleFormat }
|
||||||
val levelCap = field(S16LE) { it.levelCap }
|
val levelCap = field(S16LE) { it.levelCap }
|
||||||
val allowedSpecies = field(S16LE.listPrefixed(U8)) { it.allowedSpecies }
|
val allowedSpecies = field(S16LE.listPrefixed(U8)) { it.allowedSpecies }
|
||||||
val ruleSet = field(S8) { it.ruleSet }
|
val ruleSet = field(S8) { it.ruleSet }
|
||||||
val ruleParam = field(S16LE) { it.ruleParam }
|
val ruleParam = field(S16LE) { it.ruleParam }
|
||||||
val present = field(U8) { if (it.extraRule != null) 1 else 0 }
|
val present = field(U8) { if (it.extraRule != null) 1 else 0 }
|
||||||
val extraRule =
|
val extraRule =
|
||||||
if (present != 0) {
|
if (present != 0) {
|
||||||
field(ExtraRuleBytes) {
|
field(ExtraRuleBytes) {
|
||||||
it.extraRule ?: throw MalformedPacketException("extraRule required")
|
it.extraRule ?: throw MalformedPacketException("extraRule required")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
return BattleChallengeRequestPacket(
|
return BattleChallengeRequestPacket(
|
||||||
flags,
|
flags,
|
||||||
entryKindId,
|
entryKindId,
|
||||||
battleFormat,
|
battleFormat,
|
||||||
levelCap,
|
levelCap,
|
||||||
allowedSpecies,
|
allowedSpecies,
|
||||||
ruleSet,
|
ruleSet,
|
||||||
ruleParam,
|
ruleParam,
|
||||||
extraRule,
|
extraRule,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-5
@@ -8,9 +8,9 @@ import de.fiereu.bytecodec.Utf16LeNullTerminated
|
|||||||
data class BattleChatMessagePacket(val channelOrSlot: Byte, val message: String)
|
data class BattleChatMessagePacket(val channelOrSlot: Byte, val message: String)
|
||||||
|
|
||||||
object BattleChatMessagePacketCodec : PacketCodec<BattleChatMessagePacket>() {
|
object BattleChatMessagePacketCodec : PacketCodec<BattleChatMessagePacket>() {
|
||||||
override fun CodecScope<BattleChatMessagePacket>.body(): BattleChatMessagePacket {
|
override fun CodecScope<BattleChatMessagePacket>.body(): BattleChatMessagePacket {
|
||||||
val channelOrSlot = field(S8) { it.channelOrSlot }
|
val channelOrSlot = field(S8) { it.channelOrSlot }
|
||||||
val message = field(Utf16LeNullTerminated) { it.message }
|
val message = field(Utf16LeNullTerminated) { it.message }
|
||||||
return BattleChatMessagePacket(channelOrSlot, message)
|
return BattleChatMessagePacket(channelOrSlot, message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+7
-7
@@ -7,17 +7,17 @@ import de.fiereu.bytecodec.fixedBytes
|
|||||||
data class BattleControlBytesPacket(
|
data class BattleControlBytesPacket(
|
||||||
val controlBytes: ByteArray,
|
val controlBytes: ByteArray,
|
||||||
) {
|
) {
|
||||||
override fun equals(other: Any?): Boolean =
|
override fun equals(other: Any?): Boolean =
|
||||||
other is BattleControlBytesPacket && controlBytes.contentEquals(other.controlBytes)
|
other is BattleControlBytesPacket && controlBytes.contentEquals(other.controlBytes)
|
||||||
|
|
||||||
override fun hashCode(): Int = controlBytes.contentHashCode()
|
override fun hashCode(): Int = controlBytes.contentHashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
private val ControlBytes = fixedBytes(3)
|
private val ControlBytes = fixedBytes(3)
|
||||||
|
|
||||||
object BattleControlBytesPacketCodec : PacketCodec<BattleControlBytesPacket>() {
|
object BattleControlBytesPacketCodec : PacketCodec<BattleControlBytesPacket>() {
|
||||||
override fun CodecScope<BattleControlBytesPacket>.body(): BattleControlBytesPacket {
|
override fun CodecScope<BattleControlBytesPacket>.body(): BattleControlBytesPacket {
|
||||||
val controlBytes = field(ControlBytes) { it.controlBytes }
|
val controlBytes = field(ControlBytes) { it.controlBytes }
|
||||||
return BattleControlBytesPacket(controlBytes)
|
return BattleControlBytesPacket(controlBytes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+31
-27
@@ -15,28 +15,32 @@ data class MessageArg(
|
|||||||
|
|
||||||
internal val MessageArgCodec: Codec<MessageArg> =
|
internal val MessageArgCodec: Codec<MessageArg> =
|
||||||
object : PacketCodec<MessageArg>() {
|
object : PacketCodec<MessageArg>() {
|
||||||
override fun CodecScope<MessageArg>.body(): MessageArg {
|
override fun CodecScope<MessageArg>.body(): MessageArg {
|
||||||
val argId = field(S8) { it.argId }
|
val argId = field(S8) { it.argId }
|
||||||
val rawType = field(U8) { if (it.hasExtra) it.type or 128 else it.type }
|
val rawType = field(U8) { if (it.hasExtra) it.type or 128 else it.type }
|
||||||
val hasExtra = rawType and 128 != 0
|
val hasExtra = rawType and 128 != 0
|
||||||
val type = if (hasExtra) rawType and 127 else rawType
|
val type = if (hasExtra) rawType and 127 else rawType
|
||||||
val extra = if (hasExtra) field(S8) { it.extra } else 0
|
val extra = if (hasExtra) field(S8) { it.extra } else 0
|
||||||
var longValue: Long? = null
|
var longValue: Long? = null
|
||||||
var intValue: Int? = null
|
var intValue: Int? = null
|
||||||
var stringValue: String? = null
|
var stringValue: String? = null
|
||||||
var shortValues: List<Short>? = null
|
var shortValues: List<Short>? = null
|
||||||
when (type) {
|
when (type) {
|
||||||
28 -> {}
|
28 -> {}
|
||||||
30 -> longValue = field(S64LE) { it.longValue!! }
|
30 -> longValue = field(S64LE) { it.longValue!! }
|
||||||
9, 10, 17 -> intValue = field(S32LE) { it.intValue!! }
|
9,
|
||||||
5, 18 -> stringValue = field(Utf16LeNullTerminated) { it.stringValue!! }
|
10,
|
||||||
else -> {
|
17 -> intValue = field(S32LE) { it.intValue!! }
|
||||||
val count = field(U8) { it.shortValues!!.size }
|
5,
|
||||||
shortValues = (0 until count).map { i -> field(S16LE) { it.shortValues!![i] } }
|
18 -> stringValue = field(Utf16LeNullTerminated) { it.stringValue!! }
|
||||||
}
|
else -> {
|
||||||
}
|
val count = field(U8) { it.shortValues!!.size }
|
||||||
return MessageArg(argId, type, hasExtra, extra, longValue, intValue, stringValue, shortValues)
|
shortValues = (0 until count).map { i -> field(S16LE) { it.shortValues!![i] } }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return MessageArg(
|
||||||
|
argId, type, hasExtra, extra, longValue, intValue, stringValue, shortValues)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleDisconnectMessagePacket(
|
data class BattleDisconnectMessagePacket(
|
||||||
@@ -45,10 +49,10 @@ data class BattleDisconnectMessagePacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleDisconnectMessagePacketCodec : PacketCodec<BattleDisconnectMessagePacket>() {
|
object BattleDisconnectMessagePacketCodec : PacketCodec<BattleDisconnectMessagePacket>() {
|
||||||
override fun CodecScope<BattleDisconnectMessagePacket>.body(): BattleDisconnectMessagePacket {
|
override fun CodecScope<BattleDisconnectMessagePacket>.body(): BattleDisconnectMessagePacket {
|
||||||
val reason = field(S8) { it.reason }
|
val reason = field(S8) { it.reason }
|
||||||
val count = field(U8) { it.args.size }
|
val count = field(U8) { it.args.size }
|
||||||
val args = (0 until count).map { i -> field(MessageArgCodec) { it.args[i] } }
|
val args = (0 until count).map { i -> field(MessageArgCodec) { it.args[i] } }
|
||||||
return BattleDisconnectMessagePacket(reason, args)
|
return BattleDisconnectMessagePacket(reason, args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-3
@@ -8,7 +8,7 @@ data class BattleEmptyEventPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleEmptyEventPacketCodec : PacketCodec<BattleEmptyEventPacket>() {
|
object BattleEmptyEventPacketCodec : PacketCodec<BattleEmptyEventPacket>() {
|
||||||
override fun CodecScope<BattleEmptyEventPacket>.body(): BattleEmptyEventPacket {
|
override fun CodecScope<BattleEmptyEventPacket>.body(): BattleEmptyEventPacket {
|
||||||
return BattleEmptyEventPacket()
|
return BattleEmptyEventPacket()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -9,8 +9,8 @@ data class BattleEndDisconnectPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleEndDisconnectPacketCodec : PacketCodec<BattleEndDisconnectPacket>() {
|
object BattleEndDisconnectPacketCodec : PacketCodec<BattleEndDisconnectPacket>() {
|
||||||
override fun CodecScope<BattleEndDisconnectPacket>.body(): BattleEndDisconnectPacket {
|
override fun CodecScope<BattleEndDisconnectPacket>.body(): BattleEndDisconnectPacket {
|
||||||
val reason = field(S8) { it.reason }
|
val reason = field(S8) { it.reason }
|
||||||
return BattleEndDisconnectPacket(reason)
|
return BattleEndDisconnectPacket(reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-5
@@ -10,9 +10,9 @@ data class BattleEntityActionEventPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleEntityActionEventPacketCodec : PacketCodec<BattleEntityActionEventPacket>() {
|
object BattleEntityActionEventPacketCodec : PacketCodec<BattleEntityActionEventPacket>() {
|
||||||
override fun CodecScope<BattleEntityActionEventPacket>.body(): BattleEntityActionEventPacket {
|
override fun CodecScope<BattleEntityActionEventPacket>.body(): BattleEntityActionEventPacket {
|
||||||
val sourceId = field(S64LE) { it.sourceId }
|
val sourceId = field(S64LE) { it.sourceId }
|
||||||
val targetId = field(S64LE) { it.targetId }
|
val targetId = field(S64LE) { it.targetId }
|
||||||
return BattleEntityActionEventPacket(sourceId, targetId)
|
return BattleEntityActionEventPacket(sourceId, targetId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+83
-82
@@ -46,90 +46,91 @@ data class BattleEntityDeltaPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleEntityDeltaPacketCodec : PacketCodec<BattleEntityDeltaPacket>() {
|
object BattleEntityDeltaPacketCodec : PacketCodec<BattleEntityDeltaPacket>() {
|
||||||
override fun CodecScope<BattleEntityDeltaPacket>.body(): BattleEntityDeltaPacket {
|
override fun CodecScope<BattleEntityDeltaPacket>.body(): BattleEntityDeltaPacket {
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
val fieldMask = field(S32LE) { it.fieldMask }
|
val fieldMask = field(S32LE) { it.fieldMask }
|
||||||
val m = fieldMask
|
val m = fieldMask
|
||||||
|
|
||||||
val experienceLevel = if (m and 1 != 0) field(S8) { it.experienceLevel!! } else null
|
val experienceLevel = if (m and 1 != 0) field(S8) { it.experienceLevel!! } else null
|
||||||
val experiencePoints = if (m and 1 != 0) field(S32LE) { it.experiencePoints!! } else null
|
val experiencePoints = if (m and 1 != 0) field(S32LE) { it.experiencePoints!! } else null
|
||||||
val statValues = if (m and 2 != 0) field(S16LE.repeat(6)) { it.statValues!! } else null
|
val statValues = if (m and 2 != 0) field(S16LE.repeat(6)) { it.statValues!! } else null
|
||||||
val moveSlots = if (m and 4 != 0) field(MoveSlotCodec.repeat(4)) { it.moveSlots!! } else null
|
val moveSlots = if (m and 4 != 0) field(MoveSlotCodec.repeat(4)) { it.moveSlots!! } else null
|
||||||
val ppUps = if (m and 4 != 0) field(S8) { it.ppUps!! } else null
|
val ppUps = if (m and 4 != 0) field(S8) { it.ppUps!! } else null
|
||||||
val currentHp = if (m and 8 != 0) field(S16LE) { it.currentHp!! } else null
|
val currentHp = if (m and 8 != 0) field(S16LE) { it.currentHp!! } else null
|
||||||
val faintFlag = if (m and 16 != 0) field(S8) { it.faintFlag!! } else null
|
val faintFlag = if (m and 16 != 0) field(S8) { it.faintFlag!! } else null
|
||||||
val speciesId = if (m and 32 != 0) field(S16LE) { it.speciesId!! } else null
|
val speciesId = if (m and 32 != 0) field(S16LE) { it.speciesId!! } else null
|
||||||
val forme = if (m and 32 != 0) field(S8) { it.forme!! } else null
|
val forme = if (m and 32 != 0) field(S8) { it.forme!! } else null
|
||||||
val listType = if (m and 64 != 0) field(S8) { it.listType!! } else null
|
val listType = if (m and 64 != 0) field(S8) { it.listType!! } else null
|
||||||
val sortKey = if (m and 64 != 0) field(S16LE) { it.sortKey!! } else null
|
val sortKey = if (m and 64 != 0) field(S16LE) { it.sortKey!! } else null
|
||||||
val evValues = if (m and 128 != 0) field(S16LE.repeat(6)) { it.evValues!! } else null
|
val evValues = if (m and 128 != 0) field(S16LE.repeat(6)) { it.evValues!! } else null
|
||||||
val level = if (m and 256 != 0) field(S16LE) { it.level!! } else null
|
val level = if (m and 256 != 0) field(S16LE) { it.level!! } else null
|
||||||
val happiness = if (m and 512 != 0) field(S16LE) { it.happiness!! } else null
|
val happiness = if (m and 512 != 0) field(S16LE) { it.happiness!! } else null
|
||||||
val shininessSeed = if (m and 1024 != 0) field(S32LE) { it.shininessSeed!! } else null
|
val shininessSeed = if (m and 1024 != 0) field(S32LE) { it.shininessSeed!! } else null
|
||||||
val experience = if (m and 1024 != 0) field(S32LE) { it.experience!! } else null
|
val experience = if (m and 1024 != 0) field(S32LE) { it.experience!! } else null
|
||||||
val flagA = if (m and 1024 != 0) field(S8) { it.flagA!! } else null
|
val flagA = if (m and 1024 != 0) field(S8) { it.flagA!! } else null
|
||||||
val flagB = if (m and 1024 != 0) field(S8) { it.flagB!! } else null
|
val flagB = if (m and 1024 != 0) field(S8) { it.flagB!! } else null
|
||||||
val encounterType = if (m and 1024 != 0) field(S8) { it.encounterType!! } else null
|
val encounterType = if (m and 1024 != 0) field(S8) { it.encounterType!! } else null
|
||||||
val statusFlagsValue = if (m and 2048 != 0) field(S16LE) { it.statusFlagsValue!! } else null
|
val statusFlagsValue = if (m and 2048 != 0) field(S16LE) { it.statusFlagsValue!! } else null
|
||||||
val warnA = if (m and 4096 != 0) field(S16LE) { it.warnA!! } else null
|
val warnA = if (m and 4096 != 0) field(S16LE) { it.warnA!! } else null
|
||||||
val warnB = if (m and 4096 != 0) field(S16LE) { it.warnB!! } else null
|
val warnB = if (m and 4096 != 0) field(S16LE) { it.warnB!! } else null
|
||||||
val natureId = if (m and 8192 != 0) field(S8) { it.natureId!! } else null
|
val natureId = if (m and 8192 != 0) field(S8) { it.natureId!! } else null
|
||||||
val ribbons = if (m and 16384 != 0) field(S64LE) { it.ribbons!! } else null
|
val ribbons = if (m and 16384 != 0) field(S64LE) { it.ribbons!! } else null
|
||||||
val packedIvs = if (m and 2097152 != 0) field(S32LE) { it.packedIvs!! } else null
|
val packedIvs = if (m and 2097152 != 0) field(S32LE) { it.packedIvs!! } else null
|
||||||
|
|
||||||
val effortValues = if (m and 32768 != 0) field(S16LE.repeat(4)) { it.effortValues!! } else null
|
val effortValues = if (m and 32768 != 0) field(S16LE.repeat(4)) { it.effortValues!! } else null
|
||||||
val originalSpecies = if (m and 32768 != 0) field(S64LE) { it.originalSpecies!! } else null
|
val originalSpecies = if (m and 32768 != 0) field(S64LE) { it.originalSpecies!! } else null
|
||||||
val originalTrainerName =
|
val originalTrainerName =
|
||||||
if (m and 32768 != 0) field(Utf16LeNullTerminated) { it.originalTrainerName!! } else null
|
if (m and 32768 != 0) field(Utf16LeNullTerminated) { it.originalTrainerName!! } else null
|
||||||
val originalTrainerId = if (m and 32768 != 0) field(S32LE) { it.originalTrainerId!! } else null
|
val originalTrainerId = if (m and 32768 != 0) field(S32LE) { it.originalTrainerId!! } else null
|
||||||
|
|
||||||
val shininessType = if (m and 65536 != 0) field(S8) { it.shininessType!! } else null
|
val shininessType = if (m and 65536 != 0) field(S8) { it.shininessType!! } else null
|
||||||
val gender = if (m and 131072 != 0) field(S8) { it.gender!! } else null
|
val gender = if (m and 131072 != 0) field(S8) { it.gender!! } else null
|
||||||
val ivs = if (m and 262144 != 0) field(S16LE.repeat(5)) { it.ivs!! } else null
|
val ivs = if (m and 262144 != 0) field(S16LE.repeat(5)) { it.ivs!! } else null
|
||||||
val caughtBall = if (m and 524288 != 0) field(S8) { it.caughtBall!! } else null
|
val caughtBall = if (m and 524288 != 0) field(S8) { it.caughtBall!! } else null
|
||||||
val statusFlags2 = if (m and 1048576 != 0) field(S16LE) { it.statusFlags2!! } else null
|
val statusFlags2 = if (m and 1048576 != 0) field(S16LE) { it.statusFlags2!! } else null
|
||||||
val statusList = if (m and 4194304 != 0) field(S8.listPrefixed(U8)) { it.statusList!! } else null
|
val statusList =
|
||||||
val status = if (m and 8388608 != 0) field(S8) { it.status!! } else null
|
if (m and 4194304 != 0) field(S8.listPrefixed(U8)) { it.statusList!! } else null
|
||||||
|
val status = if (m and 8388608 != 0) field(S8) { it.status!! } else null
|
||||||
|
|
||||||
return BattleEntityDeltaPacket(
|
return BattleEntityDeltaPacket(
|
||||||
entityId = entityId,
|
entityId = entityId,
|
||||||
fieldMask = fieldMask,
|
fieldMask = fieldMask,
|
||||||
experienceLevel = experienceLevel,
|
experienceLevel = experienceLevel,
|
||||||
experiencePoints = experiencePoints,
|
experiencePoints = experiencePoints,
|
||||||
statValues = statValues,
|
statValues = statValues,
|
||||||
moveSlots = moveSlots,
|
moveSlots = moveSlots,
|
||||||
ppUps = ppUps,
|
ppUps = ppUps,
|
||||||
currentHp = currentHp,
|
currentHp = currentHp,
|
||||||
faintFlag = faintFlag,
|
faintFlag = faintFlag,
|
||||||
speciesId = speciesId,
|
speciesId = speciesId,
|
||||||
forme = forme,
|
forme = forme,
|
||||||
listType = listType,
|
listType = listType,
|
||||||
sortKey = sortKey,
|
sortKey = sortKey,
|
||||||
evValues = evValues,
|
evValues = evValues,
|
||||||
level = level,
|
level = level,
|
||||||
happiness = happiness,
|
happiness = happiness,
|
||||||
shininessSeed = shininessSeed,
|
shininessSeed = shininessSeed,
|
||||||
experience = experience,
|
experience = experience,
|
||||||
flagA = flagA,
|
flagA = flagA,
|
||||||
flagB = flagB,
|
flagB = flagB,
|
||||||
encounterType = encounterType,
|
encounterType = encounterType,
|
||||||
statusFlagsValue = statusFlagsValue,
|
statusFlagsValue = statusFlagsValue,
|
||||||
warnA = warnA,
|
warnA = warnA,
|
||||||
warnB = warnB,
|
warnB = warnB,
|
||||||
natureId = natureId,
|
natureId = natureId,
|
||||||
ribbons = ribbons,
|
ribbons = ribbons,
|
||||||
packedIvs = packedIvs,
|
packedIvs = packedIvs,
|
||||||
effortValues = effortValues,
|
effortValues = effortValues,
|
||||||
originalSpecies = originalSpecies,
|
originalSpecies = originalSpecies,
|
||||||
originalTrainerName = originalTrainerName,
|
originalTrainerName = originalTrainerName,
|
||||||
originalTrainerId = originalTrainerId,
|
originalTrainerId = originalTrainerId,
|
||||||
shininessType = shininessType,
|
shininessType = shininessType,
|
||||||
gender = gender,
|
gender = gender,
|
||||||
ivs = ivs,
|
ivs = ivs,
|
||||||
caughtBall = caughtBall,
|
caughtBall = caughtBall,
|
||||||
statusFlags2 = statusFlags2,
|
statusFlags2 = statusFlags2,
|
||||||
statusList = statusList,
|
statusList = statusList,
|
||||||
status = status,
|
status = status,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+13
-13
@@ -10,12 +10,12 @@ data class BattleMoveDataEntry(
|
|||||||
|
|
||||||
private val BattleMoveDataEntryCodec: Codec<BattleMoveDataEntry> =
|
private val BattleMoveDataEntryCodec: Codec<BattleMoveDataEntry> =
|
||||||
object : PacketCodec<BattleMoveDataEntry>() {
|
object : PacketCodec<BattleMoveDataEntry>() {
|
||||||
override fun CodecScope<BattleMoveDataEntry>.body(): BattleMoveDataEntry {
|
override fun CodecScope<BattleMoveDataEntry>.body(): BattleMoveDataEntry {
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
val value = field(S16LE) { it.value }
|
val value = field(S16LE) { it.value }
|
||||||
val actionCount = field(U8) { it.actionCount }
|
val actionCount = field(U8) { it.actionCount }
|
||||||
return BattleMoveDataEntry(entityId, value, actionCount)
|
return BattleMoveDataEntry(entityId, value, actionCount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleEntityMoveEventPacket(
|
data class BattleEntityMoveEventPacket(
|
||||||
@@ -26,11 +26,11 @@ data class BattleEntityMoveEventPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleEntityMoveEventPacketCodec : PacketCodec<BattleEntityMoveEventPacket>() {
|
object BattleEntityMoveEventPacketCodec : PacketCodec<BattleEntityMoveEventPacket>() {
|
||||||
override fun CodecScope<BattleEntityMoveEventPacket>.body(): BattleEntityMoveEventPacket {
|
override fun CodecScope<BattleEntityMoveEventPacket>.body(): BattleEntityMoveEventPacket {
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
val value = field(S16LE) { it.value }
|
val value = field(S16LE) { it.value }
|
||||||
val kind = field(S8) { it.kind }
|
val kind = field(S8) { it.kind }
|
||||||
val entries = field(BattleMoveDataEntryCodec.listPrefixed(U8)) { it.entries }
|
val entries = field(BattleMoveDataEntryCodec.listPrefixed(U8)) { it.entries }
|
||||||
return BattleEntityMoveEventPacket(entityId, value, kind, entries)
|
return BattleEntityMoveEventPacket(entityId, value, kind, entries)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-6
@@ -11,10 +11,10 @@ data class BattleEnumPairEventPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleEnumPairEventPacketCodec : PacketCodec<BattleEnumPairEventPacket>() {
|
object BattleEnumPairEventPacketCodec : PacketCodec<BattleEnumPairEventPacket>() {
|
||||||
override fun CodecScope<BattleEnumPairEventPacket>.body(): BattleEnumPairEventPacket {
|
override fun CodecScope<BattleEnumPairEventPacket>.body(): BattleEnumPairEventPacket {
|
||||||
val eventType = field(S8) { it.eventType }
|
val eventType = field(S8) { it.eventType }
|
||||||
val first = field(S8) { it.first }
|
val first = field(S8) { it.first }
|
||||||
val second = field(S8) { it.second }
|
val second = field(S8) { it.second }
|
||||||
return BattleEnumPairEventPacket(eventType, first, second)
|
return BattleEnumPairEventPacket(eventType, first, second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+16
-16
@@ -10,12 +10,12 @@ data class BattleLabeledMoveEntry(
|
|||||||
|
|
||||||
private val BattleLabeledMoveEntryCodec: Codec<BattleLabeledMoveEntry> =
|
private val BattleLabeledMoveEntryCodec: Codec<BattleLabeledMoveEntry> =
|
||||||
object : PacketCodec<BattleLabeledMoveEntry>() {
|
object : PacketCodec<BattleLabeledMoveEntry>() {
|
||||||
override fun CodecScope<BattleLabeledMoveEntry>.body(): BattleLabeledMoveEntry {
|
override fun CodecScope<BattleLabeledMoveEntry>.body(): BattleLabeledMoveEntry {
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
val value = field(S16LE) { it.value }
|
val value = field(S16LE) { it.value }
|
||||||
val actionCount = field(U8) { it.actionCount }
|
val actionCount = field(U8) { it.actionCount }
|
||||||
return BattleLabeledMoveEntry(entityId, value, actionCount)
|
return BattleLabeledMoveEntry(entityId, value, actionCount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleLabeledMoveEventPacket(
|
data class BattleLabeledMoveEventPacket(
|
||||||
@@ -29,14 +29,14 @@ data class BattleLabeledMoveEventPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleLabeledMoveEventPacketCodec : PacketCodec<BattleLabeledMoveEventPacket>() {
|
object BattleLabeledMoveEventPacketCodec : PacketCodec<BattleLabeledMoveEventPacket>() {
|
||||||
override fun CodecScope<BattleLabeledMoveEventPacket>.body(): BattleLabeledMoveEventPacket {
|
override fun CodecScope<BattleLabeledMoveEventPacket>.body(): BattleLabeledMoveEventPacket {
|
||||||
val byte1 = field(S8) { it.byte1 }
|
val byte1 = field(S8) { it.byte1 }
|
||||||
val byte2 = field(S8) { it.byte2 }
|
val byte2 = field(S8) { it.byte2 }
|
||||||
val value = field(S16LE) { it.value }
|
val value = field(S16LE) { it.value }
|
||||||
val byte3 = field(S8) { it.byte3 }
|
val byte3 = field(S8) { it.byte3 }
|
||||||
val short2 = field(S16LE) { it.short2 }
|
val short2 = field(S16LE) { it.short2 }
|
||||||
val label = field(Utf16LeNullTerminated) { it.label }
|
val label = field(Utf16LeNullTerminated) { it.label }
|
||||||
val entries = field(BattleLabeledMoveEntryCodec.listPrefixed(U8)) { it.entries }
|
val entries = field(BattleLabeledMoveEntryCodec.listPrefixed(U8)) { it.entries }
|
||||||
return BattleLabeledMoveEventPacket(byte1, byte2, value, byte3, short2, label, entries)
|
return BattleLabeledMoveEventPacket(byte1, byte2, value, byte3, short2, label, entries)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+12
-12
@@ -18,16 +18,16 @@ data class BattleListEventPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleListEventPacketCodec : PacketCodec<BattleListEventPacket>() {
|
object BattleListEventPacketCodec : PacketCodec<BattleListEventPacket>() {
|
||||||
override fun CodecScope<BattleListEventPacket>.body(): BattleListEventPacket {
|
override fun CodecScope<BattleListEventPacket>.body(): BattleListEventPacket {
|
||||||
val kind = field(S8) { it.kind }
|
val kind = field(S8) { it.kind }
|
||||||
val value = field(S16LE) { it.value }
|
val value = field(S16LE) { it.value }
|
||||||
val subKind = field(S8) { it.subKind }
|
val subKind = field(S8) { it.subKind }
|
||||||
val detail =
|
val detail =
|
||||||
if (subKind.toInt() == 4) {
|
if (subKind.toInt() == 4) {
|
||||||
val listType = field(S8) { it.detail!!.listType }
|
val listType = field(S8) { it.detail!!.listType }
|
||||||
val detailValue = field(S16LE) { it.detail!!.value }
|
val detailValue = field(S16LE) { it.detail!!.value }
|
||||||
BattleListEventDetail(listType, detailValue)
|
BattleListEventDetail(listType, detailValue)
|
||||||
} else null
|
} else null
|
||||||
return BattleListEventPacket(kind, value, subKind, detail)
|
return BattleListEventPacket(kind, value, subKind, detail)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+17
-17
@@ -18,29 +18,29 @@ data class BattleMoveDisableUpdatePacket(
|
|||||||
|
|
||||||
private val BattleMoveDisableEntryCodec: Codec<BattleMoveDisableEntry> =
|
private val BattleMoveDisableEntryCodec: Codec<BattleMoveDisableEntry> =
|
||||||
object : PacketCodec<BattleMoveDisableEntry>() {
|
object : PacketCodec<BattleMoveDisableEntry>() {
|
||||||
override fun CodecScope<BattleMoveDisableEntry>.body(): BattleMoveDisableEntry {
|
override fun CodecScope<BattleMoveDisableEntry>.body(): BattleMoveDisableEntry {
|
||||||
val present = field(Bool) { it.present }
|
val present = field(Bool) { it.present }
|
||||||
return if (present) {
|
return if (present) {
|
||||||
val disabled = field(Bool) { it.disabled }
|
val disabled = field(Bool) { it.disabled }
|
||||||
val disableTurns = field(S16LE) { it.disableTurns }
|
val disableTurns = field(S16LE) { it.disableTurns }
|
||||||
BattleMoveDisableEntry(true, disabled, disableTurns)
|
BattleMoveDisableEntry(true, disabled, disableTurns)
|
||||||
} else {
|
} else {
|
||||||
BattleMoveDisableEntry(false, false, 0)
|
BattleMoveDisableEntry(false, false, 0)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val BattleMoveDisableSideCodec: Codec<BattleMoveDisableSide> =
|
private val BattleMoveDisableSideCodec: Codec<BattleMoveDisableSide> =
|
||||||
object : PacketCodec<BattleMoveDisableSide>() {
|
object : PacketCodec<BattleMoveDisableSide>() {
|
||||||
override fun CodecScope<BattleMoveDisableSide>.body(): BattleMoveDisableSide {
|
override fun CodecScope<BattleMoveDisableSide>.body(): BattleMoveDisableSide {
|
||||||
val entries = field(BattleMoveDisableEntryCodec.listPrefixed(U8)) { it.entries }
|
val entries = field(BattleMoveDisableEntryCodec.listPrefixed(U8)) { it.entries }
|
||||||
return BattleMoveDisableSide(entries)
|
return BattleMoveDisableSide(entries)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object BattleMoveDisableUpdatePacketCodec : PacketCodec<BattleMoveDisableUpdatePacket>() {
|
object BattleMoveDisableUpdatePacketCodec : PacketCodec<BattleMoveDisableUpdatePacket>() {
|
||||||
override fun CodecScope<BattleMoveDisableUpdatePacket>.body(): BattleMoveDisableUpdatePacket {
|
override fun CodecScope<BattleMoveDisableUpdatePacket>.body(): BattleMoveDisableUpdatePacket {
|
||||||
val sides = field(BattleMoveDisableSideCodec.repeat(2)) { it.sides }
|
val sides = field(BattleMoveDisableSideCodec.repeat(2)) { it.sides }
|
||||||
return BattleMoveDisableUpdatePacket(sides)
|
return BattleMoveDisableUpdatePacket(sides)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+23
-23
@@ -13,15 +13,15 @@ data class BattleMoveAppearance(
|
|||||||
|
|
||||||
private val BattleMoveAppearanceCodec: Codec<BattleMoveAppearance> =
|
private val BattleMoveAppearanceCodec: Codec<BattleMoveAppearance> =
|
||||||
object : PacketCodec<BattleMoveAppearance>() {
|
object : PacketCodec<BattleMoveAppearance>() {
|
||||||
override fun CodecScope<BattleMoveAppearance>.body(): BattleMoveAppearance {
|
override fun CodecScope<BattleMoveAppearance>.body(): BattleMoveAppearance {
|
||||||
val name = field(Utf16LeNullTerminated) { it.name }
|
val name = field(Utf16LeNullTerminated) { it.name }
|
||||||
val gender = field(S8) { it.gender }
|
val gender = field(S8) { it.gender }
|
||||||
val id = field(S32LE) { it.id }
|
val id = field(S32LE) { it.id }
|
||||||
val kind = field(S8) { it.kind }
|
val kind = field(S8) { it.kind }
|
||||||
val palettePack = field(S8) { it.palettePack }
|
val palettePack = field(S8) { it.palettePack }
|
||||||
val slots = field(S16LE.repeat(4)) { it.slots }
|
val slots = field(S16LE.repeat(4)) { it.slots }
|
||||||
return BattleMoveAppearance(name, gender, id, kind, palettePack, slots)
|
return BattleMoveAppearance(name, gender, id, kind, palettePack, slots)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleMoveEntry(
|
data class BattleMoveEntry(
|
||||||
@@ -34,14 +34,14 @@ data class BattleMoveEntry(
|
|||||||
|
|
||||||
private val BattleMoveEntryCodec: Codec<BattleMoveEntry> =
|
private val BattleMoveEntryCodec: Codec<BattleMoveEntry> =
|
||||||
object : PacketCodec<BattleMoveEntry>() {
|
object : PacketCodec<BattleMoveEntry>() {
|
||||||
override fun CodecScope<BattleMoveEntry>.body(): BattleMoveEntry {
|
override fun CodecScope<BattleMoveEntry>.body(): BattleMoveEntry {
|
||||||
val moveId = field(S32LE) { it.moveId }
|
val moveId = field(S32LE) { it.moveId }
|
||||||
val tier = field(S8) { it.tier }
|
val tier = field(S8) { it.tier }
|
||||||
val int1 = field(S32LE) { it.int1 }
|
val int1 = field(S32LE) { it.int1 }
|
||||||
val int2 = field(S32LE) { it.int2 }
|
val int2 = field(S32LE) { it.int2 }
|
||||||
val appearances = field(BattleMoveAppearanceCodec.listPrefixed(U8)) { it.appearances }
|
val appearances = field(BattleMoveAppearanceCodec.listPrefixed(U8)) { it.appearances }
|
||||||
return BattleMoveEntry(moveId, tier, int1, int2, appearances)
|
return BattleMoveEntry(moveId, tier, int1, int2, appearances)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleMoveListPacket(
|
data class BattleMoveListPacket(
|
||||||
@@ -51,10 +51,10 @@ data class BattleMoveListPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleMoveListPacketCodec : PacketCodec<BattleMoveListPacket>() {
|
object BattleMoveListPacketCodec : PacketCodec<BattleMoveListPacket>() {
|
||||||
override fun CodecScope<BattleMoveListPacket>.body(): BattleMoveListPacket {
|
override fun CodecScope<BattleMoveListPacket>.body(): BattleMoveListPacket {
|
||||||
val actionId = field(S16LE) { it.actionId }
|
val actionId = field(S16LE) { it.actionId }
|
||||||
val slot = field(S8) { it.slot }
|
val slot = field(S8) { it.slot }
|
||||||
val moves = field(BattleMoveEntryCodec.listPrefixed(U8)) { it.moves }
|
val moves = field(BattleMoveEntryCodec.listPrefixed(U8)) { it.moves }
|
||||||
return BattleMoveListPacket(actionId, slot, moves)
|
return BattleMoveListPacket(actionId, slot, moves)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -9,8 +9,8 @@ data class BattleMoveSelectionCancelPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleMoveSelectionCancelPacketCodec : PacketCodec<BattleMoveSelectionCancelPacket>() {
|
object BattleMoveSelectionCancelPacketCodec : PacketCodec<BattleMoveSelectionCancelPacket>() {
|
||||||
override fun CodecScope<BattleMoveSelectionCancelPacket>.body(): BattleMoveSelectionCancelPacket {
|
override fun CodecScope<BattleMoveSelectionCancelPacket>.body(): BattleMoveSelectionCancelPacket {
|
||||||
reserved(byte = 0)
|
reserved(byte = 0)
|
||||||
return BattleMoveSelectionCancelPacket()
|
return BattleMoveSelectionCancelPacket()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -7,8 +7,8 @@ import de.fiereu.bytecodec.S8
|
|||||||
data class BattleMoveSlotChoicePacket(val moveSlotIndex: Byte)
|
data class BattleMoveSlotChoicePacket(val moveSlotIndex: Byte)
|
||||||
|
|
||||||
object BattleMoveSlotChoicePacketCodec : PacketCodec<BattleMoveSlotChoicePacket>() {
|
object BattleMoveSlotChoicePacketCodec : PacketCodec<BattleMoveSlotChoicePacket>() {
|
||||||
override fun CodecScope<BattleMoveSlotChoicePacket>.body(): BattleMoveSlotChoicePacket {
|
override fun CodecScope<BattleMoveSlotChoicePacket>.body(): BattleMoveSlotChoicePacket {
|
||||||
val moveSlotIndex = field(S8) { it.moveSlotIndex }
|
val moveSlotIndex = field(S8) { it.moveSlotIndex }
|
||||||
return BattleMoveSlotChoicePacket(moveSlotIndex)
|
return BattleMoveSlotChoicePacket(moveSlotIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+25
-25
@@ -13,15 +13,15 @@ data class BattleTargetAppearance(
|
|||||||
|
|
||||||
private val BattleTargetAppearanceCodec: Codec<BattleTargetAppearance> =
|
private val BattleTargetAppearanceCodec: Codec<BattleTargetAppearance> =
|
||||||
object : PacketCodec<BattleTargetAppearance>() {
|
object : PacketCodec<BattleTargetAppearance>() {
|
||||||
override fun CodecScope<BattleTargetAppearance>.body(): BattleTargetAppearance {
|
override fun CodecScope<BattleTargetAppearance>.body(): BattleTargetAppearance {
|
||||||
val name = field(Utf16LeNullTerminated) { it.name }
|
val name = field(Utf16LeNullTerminated) { it.name }
|
||||||
val gender = field(S8) { it.gender }
|
val gender = field(S8) { it.gender }
|
||||||
val id = field(S32LE) { it.id }
|
val id = field(S32LE) { it.id }
|
||||||
val kind = field(S8) { it.kind }
|
val kind = field(S8) { it.kind }
|
||||||
val palettePack = field(S8) { it.palettePack }
|
val palettePack = field(S8) { it.palettePack }
|
||||||
val slots = field(S16LE.repeat(4)) { it.slots }
|
val slots = field(S16LE.repeat(4)) { it.slots }
|
||||||
return BattleTargetAppearance(name, gender, id, kind, palettePack, slots)
|
return BattleTargetAppearance(name, gender, id, kind, palettePack, slots)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleMoveTargetEntry(
|
data class BattleMoveTargetEntry(
|
||||||
@@ -35,15 +35,15 @@ data class BattleMoveTargetEntry(
|
|||||||
|
|
||||||
private val BattleMoveTargetEntryCodec: Codec<BattleMoveTargetEntry> =
|
private val BattleMoveTargetEntryCodec: Codec<BattleMoveTargetEntry> =
|
||||||
object : PacketCodec<BattleMoveTargetEntry>() {
|
object : PacketCodec<BattleMoveTargetEntry>() {
|
||||||
override fun CodecScope<BattleMoveTargetEntry>.body(): BattleMoveTargetEntry {
|
override fun CodecScope<BattleMoveTargetEntry>.body(): BattleMoveTargetEntry {
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
val weight = field(F32LE) { it.weight }
|
val weight = field(F32LE) { it.weight }
|
||||||
val short1 = field(S16LE) { it.short1 }
|
val short1 = field(S16LE) { it.short1 }
|
||||||
val int1 = field(S32LE) { it.int1 }
|
val int1 = field(S32LE) { it.int1 }
|
||||||
val int2 = field(S32LE) { it.int2 }
|
val int2 = field(S32LE) { it.int2 }
|
||||||
val appearance = field(BattleTargetAppearanceCodec) { it.appearance }
|
val appearance = field(BattleTargetAppearanceCodec) { it.appearance }
|
||||||
return BattleMoveTargetEntry(entityId, weight, short1, int1, int2, appearance)
|
return BattleMoveTargetEntry(entityId, weight, short1, int1, int2, appearance)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleMoveTargetsPacket(
|
data class BattleMoveTargetsPacket(
|
||||||
@@ -54,11 +54,11 @@ data class BattleMoveTargetsPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleMoveTargetsPacketCodec : PacketCodec<BattleMoveTargetsPacket>() {
|
object BattleMoveTargetsPacketCodec : PacketCodec<BattleMoveTargetsPacket>() {
|
||||||
override fun CodecScope<BattleMoveTargetsPacket>.body(): BattleMoveTargetsPacket {
|
override fun CodecScope<BattleMoveTargetsPacket>.body(): BattleMoveTargetsPacket {
|
||||||
val actionId = field(S32LE) { it.actionId }
|
val actionId = field(S32LE) { it.actionId }
|
||||||
val slot = field(S8) { it.slot }
|
val slot = field(S8) { it.slot }
|
||||||
val tier = field(S8) { it.tier }
|
val tier = field(S8) { it.tier }
|
||||||
val targets = field(BattleMoveTargetEntryCodec.listPrefixed(U16LE)) { it.targets }
|
val targets = field(BattleMoveTargetEntryCodec.listPrefixed(U16LE)) { it.targets }
|
||||||
return BattleMoveTargetsPacket(actionId, slot, tier, targets)
|
return BattleMoveTargetsPacket(actionId, slot, tier, targets)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-6
@@ -9,10 +9,10 @@ data class BattleMoveUsePacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleMoveUsePacketCodec : PacketCodec<BattleMoveUsePacket>() {
|
object BattleMoveUsePacketCodec : PacketCodec<BattleMoveUsePacket>() {
|
||||||
override fun CodecScope<BattleMoveUsePacket>.body(): BattleMoveUsePacket {
|
override fun CodecScope<BattleMoveUsePacket>.body(): BattleMoveUsePacket {
|
||||||
val targetEntityId = field(S64LE) { it.targetEntityId }
|
val targetEntityId = field(S64LE) { it.targetEntityId }
|
||||||
val moveSlotIndex = field(S8) { it.moveSlotIndex }
|
val moveSlotIndex = field(S8) { it.moveSlotIndex }
|
||||||
val moveId = field(S16LE) { it.moveId }
|
val moveId = field(S16LE) { it.moveId }
|
||||||
return BattleMoveUsePacket(targetEntityId, moveSlotIndex, moveId)
|
return BattleMoveUsePacket(targetEntityId, moveSlotIndex, moveId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-6
@@ -12,10 +12,10 @@ data class BattlePartySlotSelectPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattlePartySlotSelectPacketCodec : PacketCodec<BattlePartySlotSelectPacket>() {
|
object BattlePartySlotSelectPacketCodec : PacketCodec<BattlePartySlotSelectPacket>() {
|
||||||
override fun CodecScope<BattlePartySlotSelectPacket>.body(): BattlePartySlotSelectPacket {
|
override fun CodecScope<BattlePartySlotSelectPacket>.body(): BattlePartySlotSelectPacket {
|
||||||
val slotIndex = field(S16LE) { it.slotIndex }
|
val slotIndex = field(S16LE) { it.slotIndex }
|
||||||
val pokemonEntityId = field(S64LE) { it.pokemonEntityId }
|
val pokemonEntityId = field(S64LE) { it.pokemonEntityId }
|
||||||
val contextId = field(S16LE) { it.contextId }
|
val contextId = field(S16LE) { it.contextId }
|
||||||
return BattlePartySlotSelectPacket(slotIndex, pokemonEntityId, contextId)
|
return BattlePartySlotSelectPacket(slotIndex, pokemonEntityId, contextId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -7,8 +7,8 @@ import de.fiereu.bytecodec.S64LE
|
|||||||
data class BattlePartySwitchPacket(val monsterEntityId: Long)
|
data class BattlePartySwitchPacket(val monsterEntityId: Long)
|
||||||
|
|
||||||
object BattlePartySwitchPacketCodec : PacketCodec<BattlePartySwitchPacket>() {
|
object BattlePartySwitchPacketCodec : PacketCodec<BattlePartySwitchPacket>() {
|
||||||
override fun CodecScope<BattlePartySwitchPacket>.body(): BattlePartySwitchPacket {
|
override fun CodecScope<BattlePartySwitchPacket>.body(): BattlePartySwitchPacket {
|
||||||
val monsterEntityId = field(S64LE) { it.monsterEntityId }
|
val monsterEntityId = field(S64LE) { it.monsterEntityId }
|
||||||
return BattlePartySwitchPacket(monsterEntityId)
|
return BattlePartySwitchPacket(monsterEntityId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-5
@@ -11,9 +11,9 @@ data class BattlePokemonSpritePacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattlePokemonSpritePacketCodec : PacketCodec<BattlePokemonSpritePacket>() {
|
object BattlePokemonSpritePacketCodec : PacketCodec<BattlePokemonSpritePacket>() {
|
||||||
override fun CodecScope<BattlePokemonSpritePacket>.body(): BattlePokemonSpritePacket {
|
override fun CodecScope<BattlePokemonSpritePacket>.body(): BattlePokemonSpritePacket {
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
val spriteId = field(S16LE) { it.spriteId }
|
val spriteId = field(S16LE) { it.spriteId }
|
||||||
return BattlePokemonSpritePacket(entityId, spriteId)
|
return BattlePokemonSpritePacket(entityId, spriteId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+13
-13
@@ -15,17 +15,17 @@ data class BattlePokemonStatusPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattlePokemonStatusPacketCodec : PacketCodec<BattlePokemonStatusPacket>() {
|
object BattlePokemonStatusPacketCodec : PacketCodec<BattlePokemonStatusPacket>() {
|
||||||
override fun CodecScope<BattlePokemonStatusPacket>.body(): BattlePokemonStatusPacket {
|
override fun CodecScope<BattlePokemonStatusPacket>.body(): BattlePokemonStatusPacket {
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
val statusId = field(S8) { it.statusId }
|
val statusId = field(S8) { it.statusId }
|
||||||
val present = field(U8) { if (it.statusEffect != null) 1 else 0 } == 1
|
val present = field(U8) { if (it.statusEffect != null) 1 else 0 } == 1
|
||||||
val statusEffect =
|
val statusEffect =
|
||||||
if (present) {
|
if (present) {
|
||||||
val durationTurns = field(S32LE) { it.statusEffect!!.durationTurns }
|
val durationTurns = field(S32LE) { it.statusEffect!!.durationTurns }
|
||||||
val effectType = field(S8) { it.statusEffect!!.effectType }
|
val effectType = field(S8) { it.statusEffect!!.effectType }
|
||||||
val sourceSlot = field(S8) { it.statusEffect!!.sourceSlot }
|
val sourceSlot = field(S8) { it.statusEffect!!.sourceSlot }
|
||||||
BattleStatusEffectData(durationTurns, effectType, sourceSlot)
|
BattleStatusEffectData(durationTurns, effectType, sourceSlot)
|
||||||
} else null
|
} else null
|
||||||
return BattlePokemonStatusPacket(entityId, statusId, statusEffect)
|
return BattlePokemonStatusPacket(entityId, statusId, statusEffect)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -9,8 +9,8 @@ data class BattlePromptSwitchPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattlePromptSwitchPacketCodec : PacketCodec<BattlePromptSwitchPacket>() {
|
object BattlePromptSwitchPacketCodec : PacketCodec<BattlePromptSwitchPacket>() {
|
||||||
override fun CodecScope<BattlePromptSwitchPacket>.body(): BattlePromptSwitchPacket {
|
override fun CodecScope<BattlePromptSwitchPacket>.body(): BattlePromptSwitchPacket {
|
||||||
val enabled = field(Bool) { it.enabled }
|
val enabled = field(Bool) { it.enabled }
|
||||||
return BattlePromptSwitchPacket(enabled)
|
return BattlePromptSwitchPacket(enabled)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+8
-8
@@ -7,16 +7,16 @@ import de.fiereu.bytecodec.S8
|
|||||||
data class BattleQueuedEventPacket(
|
data class BattleQueuedEventPacket(
|
||||||
val packed: Byte,
|
val packed: Byte,
|
||||||
) {
|
) {
|
||||||
val value: Byte
|
val value: Byte
|
||||||
get() = (packed.toInt() and 0x7F).toByte()
|
get() = (packed.toInt() and 0x7F).toByte()
|
||||||
|
|
||||||
val flag: Boolean
|
val flag: Boolean
|
||||||
get() = (packed.toInt() and 0x80) != 0
|
get() = (packed.toInt() and 0x80) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
object BattleQueuedEventPacketCodec : PacketCodec<BattleQueuedEventPacket>() {
|
object BattleQueuedEventPacketCodec : PacketCodec<BattleQueuedEventPacket>() {
|
||||||
override fun CodecScope<BattleQueuedEventPacket>.body(): BattleQueuedEventPacket {
|
override fun CodecScope<BattleQueuedEventPacket>.body(): BattleQueuedEventPacket {
|
||||||
val packed = field(S8) { it.packed }
|
val packed = field(S8) { it.packed }
|
||||||
return BattleQueuedEventPacket(packed)
|
return BattleQueuedEventPacket(packed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+15
-15
@@ -15,17 +15,17 @@ data class BattleRatingEntry(
|
|||||||
|
|
||||||
private val BattleRatingEntryCodec: Codec<BattleRatingEntry> =
|
private val BattleRatingEntryCodec: Codec<BattleRatingEntry> =
|
||||||
object : PacketCodec<BattleRatingEntry>() {
|
object : PacketCodec<BattleRatingEntry>() {
|
||||||
override fun CodecScope<BattleRatingEntry>.body(): BattleRatingEntry {
|
override fun CodecScope<BattleRatingEntry>.body(): BattleRatingEntry {
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
val tier = field(S8) { it.tier }
|
val tier = field(S8) { it.tier }
|
||||||
val bracket = field(S8) { it.bracket }
|
val bracket = field(S8) { it.bracket }
|
||||||
val elo = field(F32LE) { it.elo }
|
val elo = field(F32LE) { it.elo }
|
||||||
val short1 = field(S16LE) { it.short1 }
|
val short1 = field(S16LE) { it.short1 }
|
||||||
val byte1 = field(S8) { it.byte1 }
|
val byte1 = field(S8) { it.byte1 }
|
||||||
val int1 = field(S32LE) { it.int1 }
|
val int1 = field(S32LE) { it.int1 }
|
||||||
val int2 = field(S32LE) { it.int2 }
|
val int2 = field(S32LE) { it.int2 }
|
||||||
return BattleRatingEntry(entityId, tier, bracket, elo, short1, byte1, int1, int2)
|
return BattleRatingEntry(entityId, tier, bracket, elo, short1, byte1, int1, int2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleRatingBulkPacket(
|
data class BattleRatingBulkPacket(
|
||||||
@@ -33,8 +33,8 @@ data class BattleRatingBulkPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleRatingBulkPacketCodec : PacketCodec<BattleRatingBulkPacket>() {
|
object BattleRatingBulkPacketCodec : PacketCodec<BattleRatingBulkPacket>() {
|
||||||
override fun CodecScope<BattleRatingBulkPacket>.body(): BattleRatingBulkPacket {
|
override fun CodecScope<BattleRatingBulkPacket>.body(): BattleRatingBulkPacket {
|
||||||
val ratings = field(BattleRatingEntryCodec.listPrefixed(U8)) { it.ratings }
|
val ratings = field(BattleRatingEntryCodec.listPrefixed(U8)) { it.ratings }
|
||||||
return BattleRatingBulkPacket(ratings)
|
return BattleRatingBulkPacket(ratings)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+11
-11
@@ -14,15 +14,15 @@ data class BattleRatingUpdatePacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleRatingUpdatePacketCodec : PacketCodec<BattleRatingUpdatePacket>() {
|
object BattleRatingUpdatePacketCodec : PacketCodec<BattleRatingUpdatePacket>() {
|
||||||
override fun CodecScope<BattleRatingUpdatePacket>.body(): BattleRatingUpdatePacket {
|
override fun CodecScope<BattleRatingUpdatePacket>.body(): BattleRatingUpdatePacket {
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
val tier = field(S8) { it.tier }
|
val tier = field(S8) { it.tier }
|
||||||
val bracket = field(S8) { it.bracket }
|
val bracket = field(S8) { it.bracket }
|
||||||
val elo = field(F32LE) { it.elo }
|
val elo = field(F32LE) { it.elo }
|
||||||
val short1 = field(S16LE) { it.short1 }
|
val short1 = field(S16LE) { it.short1 }
|
||||||
val byte1 = field(S8) { it.byte1 }
|
val byte1 = field(S8) { it.byte1 }
|
||||||
val int1 = field(S32LE) { it.int1 }
|
val int1 = field(S32LE) { it.int1 }
|
||||||
val int2 = field(S32LE) { it.int2 }
|
val int2 = field(S32LE) { it.int2 }
|
||||||
return BattleRatingUpdatePacket(entityId, tier, bracket, elo, short1, byte1, int1, int2)
|
return BattleRatingUpdatePacket(entityId, tier, bracket, elo, short1, byte1, int1, int2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -7,8 +7,8 @@ import de.fiereu.bytecodec.PacketCodec
|
|||||||
data class BattleReadyPacket(val ready: Boolean)
|
data class BattleReadyPacket(val ready: Boolean)
|
||||||
|
|
||||||
object BattleReadyPacketCodec : PacketCodec<BattleReadyPacket>() {
|
object BattleReadyPacketCodec : PacketCodec<BattleReadyPacket>() {
|
||||||
override fun CodecScope<BattleReadyPacket>.body(): BattleReadyPacket {
|
override fun CodecScope<BattleReadyPacket>.body(): BattleReadyPacket {
|
||||||
val ready = field(Bool) { it.ready }
|
val ready = field(Bool) { it.ready }
|
||||||
return BattleReadyPacket(ready)
|
return BattleReadyPacket(ready)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-5
@@ -11,9 +11,9 @@ data class BattleRewardSelectPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleRewardSelectPacketCodec : PacketCodec<BattleRewardSelectPacket>() {
|
object BattleRewardSelectPacketCodec : PacketCodec<BattleRewardSelectPacket>() {
|
||||||
override fun CodecScope<BattleRewardSelectPacket>.body(): BattleRewardSelectPacket {
|
override fun CodecScope<BattleRewardSelectPacket>.body(): BattleRewardSelectPacket {
|
||||||
val targetEntityId = field(S64LE) { it.targetEntityId }
|
val targetEntityId = field(S64LE) { it.targetEntityId }
|
||||||
val rewardIndex = field(S32LE) { it.rewardIndex }
|
val rewardIndex = field(S32LE) { it.rewardIndex }
|
||||||
return BattleRewardSelectPacket(targetEntityId, rewardIndex)
|
return BattleRewardSelectPacket(targetEntityId, rewardIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+101
-94
@@ -19,26 +19,35 @@ data class BattleRankingEntry(
|
|||||||
|
|
||||||
private val BattleRankingEntryCodec: Codec<BattleRankingEntry> =
|
private val BattleRankingEntryCodec: Codec<BattleRankingEntry> =
|
||||||
object : PacketCodec<BattleRankingEntry>() {
|
object : PacketCodec<BattleRankingEntry>() {
|
||||||
override fun CodecScope<BattleRankingEntry>.body(): BattleRankingEntry {
|
override fun CodecScope<BattleRankingEntry>.body(): BattleRankingEntry {
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
val flag1 = field(S8) { it.flag1 }
|
val flag1 = field(S8) { it.flag1 }
|
||||||
val flag2 = field(S8) { it.flag2 }
|
val flag2 = field(S8) { it.flag2 }
|
||||||
val name = field(de.fiereu.bytecodec.Utf16LeNullTerminated) { it.name }
|
val name = field(de.fiereu.bytecodec.Utf16LeNullTerminated) { it.name }
|
||||||
val value1 = field(S16LE) { it.value1 }
|
val value1 = field(S16LE) { it.value1 }
|
||||||
val genderId = field(S16LE) { it.genderId }
|
val genderId = field(S16LE) { it.genderId }
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
val ribbons = field(S64LE) { it.ribbons }
|
val ribbons = field(S64LE) { it.ribbons }
|
||||||
val byte1 = field(S8) { it.byte1 }
|
val byte1 = field(S8) { it.byte1 }
|
||||||
val int1 = field(S32LE) { it.int1 }
|
val int1 = field(S32LE) { it.int1 }
|
||||||
val byte2 = field(S8) { it.byte2 }
|
val byte2 = field(S8) { it.byte2 }
|
||||||
val bool1 = field(Bool) { it.bool1 }
|
val bool1 = field(Bool) { it.bool1 }
|
||||||
val bool2 = field(Bool) { it.bool2 }
|
val bool2 = field(Bool) { it.bool2 }
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
return BattleRankingEntry(
|
return BattleRankingEntry(
|
||||||
entityId, flag1, flag2, name, value1, genderId, ribbons, byte1, int1, byte2, bool1,
|
entityId,
|
||||||
bool2
|
flag1,
|
||||||
)
|
flag2,
|
||||||
}
|
name,
|
||||||
|
value1,
|
||||||
|
genderId,
|
||||||
|
ribbons,
|
||||||
|
byte1,
|
||||||
|
int1,
|
||||||
|
byte2,
|
||||||
|
bool1,
|
||||||
|
bool2)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleTierUpdate(
|
data class BattleTierUpdate(
|
||||||
@@ -49,13 +58,13 @@ data class BattleTierUpdate(
|
|||||||
|
|
||||||
private val BattleTierUpdateCodec: Codec<BattleTierUpdate> =
|
private val BattleTierUpdateCodec: Codec<BattleTierUpdate> =
|
||||||
object : PacketCodec<BattleTierUpdate>() {
|
object : PacketCodec<BattleTierUpdate>() {
|
||||||
override fun CodecScope<BattleTierUpdate>.body(): BattleTierUpdate {
|
override fun CodecScope<BattleTierUpdate>.body(): BattleTierUpdate {
|
||||||
val tierIndex = field(S8) { it.tierIndex }
|
val tierIndex = field(S8) { it.tierIndex }
|
||||||
val unlocked = field(Bool) { it.unlocked }
|
val unlocked = field(Bool) { it.unlocked }
|
||||||
val expiry = field(S64LE) { it.expiry }
|
val expiry = field(S64LE) { it.expiry }
|
||||||
field(S64LE) { 0L }
|
field(S64LE) { 0L }
|
||||||
return BattleTierUpdate(tierIndex, unlocked, expiry)
|
return BattleTierUpdate(tierIndex, unlocked, expiry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleMoveTarget(
|
data class BattleMoveTarget(
|
||||||
@@ -71,34 +80,34 @@ data class BattleMoveTarget(
|
|||||||
|
|
||||||
private val BattleMoveTargetCodec: Codec<BattleMoveTarget> =
|
private val BattleMoveTargetCodec: Codec<BattleMoveTarget> =
|
||||||
object : PacketCodec<BattleMoveTarget>() {
|
object : PacketCodec<BattleMoveTarget>() {
|
||||||
override fun CodecScope<BattleMoveTarget>.body(): BattleMoveTarget {
|
override fun CodecScope<BattleMoveTarget>.body(): BattleMoveTarget {
|
||||||
val targetType = field(S8) { it.targetType }
|
val targetType = field(S8) { it.targetType }
|
||||||
return when (targetType.toInt()) {
|
return when (targetType.toInt()) {
|
||||||
0 -> {
|
0 -> {
|
||||||
val short1 = field(S16LE) { it.short1 }
|
val short1 = field(S16LE) { it.short1 }
|
||||||
val short2 = field(S16LE) { it.short2 }
|
val short2 = field(S16LE) { it.short2 }
|
||||||
val short3 = field(S16LE) { it.short3 }
|
val short3 = field(S16LE) { it.short3 }
|
||||||
BattleMoveTarget(targetType, short1, short2, short3, 0, 0, false, false)
|
BattleMoveTarget(targetType, short1, short2, short3, 0, 0, false, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
1 -> {
|
1 -> {
|
||||||
val short1 = field(S16LE) { it.short1 }
|
val short1 = field(S16LE) { it.short1 }
|
||||||
field(S8) { 0 }
|
field(S8) { 0 }
|
||||||
val byte1 = field(S8) { it.byte1 }
|
val byte1 = field(S8) { it.byte1 }
|
||||||
val byte2 = field(S8) { it.byte2 }
|
val byte2 = field(S8) { it.byte2 }
|
||||||
val flag1 = field(Bool) { it.flag1 }
|
val flag1 = field(Bool) { it.flag1 }
|
||||||
val flag2 = field(Bool) { it.flag2 }
|
val flag2 = field(Bool) { it.flag2 }
|
||||||
val short2 = field(S16LE) { it.short2 }
|
val short2 = field(S16LE) { it.short2 }
|
||||||
BattleMoveTarget(targetType, short1, short2, 0, byte1, byte2, flag1, flag2)
|
BattleMoveTarget(targetType, short1, short2, 0, byte1, byte2, flag1, flag2)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
val short1 = field(S16LE) { it.short1 }
|
val short1 = field(S16LE) { it.short1 }
|
||||||
val short2 = field(S16LE) { it.short2 }
|
val short2 = field(S16LE) { it.short2 }
|
||||||
BattleMoveTarget(targetType, short1, short2, 0, 0, 0, false, false)
|
BattleMoveTarget(targetType, short1, short2, 0, 0, 0, false, false)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleSelectablePokemon(
|
data class BattleSelectablePokemon(
|
||||||
@@ -113,16 +122,16 @@ data class BattleSelectablePokemon(
|
|||||||
|
|
||||||
private val BattleSelectablePokemonCodec: Codec<BattleSelectablePokemon> =
|
private val BattleSelectablePokemonCodec: Codec<BattleSelectablePokemon> =
|
||||||
object : PacketCodec<BattleSelectablePokemon>() {
|
object : PacketCodec<BattleSelectablePokemon>() {
|
||||||
override fun CodecScope<BattleSelectablePokemon>.body(): BattleSelectablePokemon {
|
override fun CodecScope<BattleSelectablePokemon>.body(): BattleSelectablePokemon {
|
||||||
val int1 = field(S32LE) { it.int1 }
|
val int1 = field(S32LE) { it.int1 }
|
||||||
val int2 = field(S32LE) { it.int2 }
|
val int2 = field(S32LE) { it.int2 }
|
||||||
val short1 = field(S16LE) { it.short1 }
|
val short1 = field(S16LE) { it.short1 }
|
||||||
val short2 = field(S16LE) { it.short2 }
|
val short2 = field(S16LE) { it.short2 }
|
||||||
val tierIndex = field(S8) { it.tierIndex }
|
val tierIndex = field(S8) { it.tierIndex }
|
||||||
val targetsA = field(BattleMoveTargetCodec.listPrefixed(U8)) { it.targetsA }
|
val targetsA = field(BattleMoveTargetCodec.listPrefixed(U8)) { it.targetsA }
|
||||||
val targetsB = field(BattleMoveTargetCodec.listPrefixed(U8)) { it.targetsB }
|
val targetsB = field(BattleMoveTargetCodec.listPrefixed(U8)) { it.targetsB }
|
||||||
return BattleSelectablePokemon(int1, int2, short1, short2, tierIndex, targetsA, targetsB)
|
return BattleSelectablePokemon(int1, int2, short1, short2, tierIndex, targetsA, targetsB)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleStorageItem(
|
data class BattleStorageItem(
|
||||||
@@ -138,19 +147,18 @@ data class BattleStorageItem(
|
|||||||
|
|
||||||
private val BattleStorageItemCodec: Codec<BattleStorageItem> =
|
private val BattleStorageItemCodec: Codec<BattleStorageItem> =
|
||||||
object : PacketCodec<BattleStorageItem>() {
|
object : PacketCodec<BattleStorageItem>() {
|
||||||
override fun CodecScope<BattleStorageItem>.body(): BattleStorageItem {
|
override fun CodecScope<BattleStorageItem>.body(): BattleStorageItem {
|
||||||
val typeByte = field(S8) { it.typeByte }
|
val typeByte = field(S8) { it.typeByte }
|
||||||
val short1 = field(S16LE) { it.short1 }
|
val short1 = field(S16LE) { it.short1 }
|
||||||
val short2 = field(S16LE) { it.short2 }
|
val short2 = field(S16LE) { it.short2 }
|
||||||
val short3 = field(S16LE) { it.short3 }
|
val short3 = field(S16LE) { it.short3 }
|
||||||
val short4 = field(S16LE) { it.short4 }
|
val short4 = field(S16LE) { it.short4 }
|
||||||
val byte1 = field(S8) { it.byte1 }
|
val byte1 = field(S8) { it.byte1 }
|
||||||
val pokemonByte = field(S8) { it.pokemonByte }
|
val pokemonByte = field(S8) { it.pokemonByte }
|
||||||
val boxByte = field(S8) { it.boxByte }
|
val boxByte = field(S8) { it.boxByte }
|
||||||
return BattleStorageItem(
|
return BattleStorageItem(
|
||||||
typeByte, short1, short2, short3, short4, byte1, pokemonByte, boxByte
|
typeByte, short1, short2, short3, short4, byte1, pokemonByte, boxByte)
|
||||||
)
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleScreenOpenPacket(
|
data class BattleScreenOpenPacket(
|
||||||
@@ -163,24 +171,23 @@ data class BattleScreenOpenPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleScreenOpenPacketCodec : PacketCodec<BattleScreenOpenPacket>() {
|
object BattleScreenOpenPacketCodec : PacketCodec<BattleScreenOpenPacket>() {
|
||||||
override fun CodecScope<BattleScreenOpenPacket>.body(): BattleScreenOpenPacket {
|
override fun CodecScope<BattleScreenOpenPacket>.body(): BattleScreenOpenPacket {
|
||||||
val active = field(U8) { if (it.active) 1 else 0 } == 1
|
val active = field(U8) { if (it.active) 1 else 0 } == 1
|
||||||
if (!active) {
|
if (!active) {
|
||||||
return BattleScreenOpenPacket(
|
return BattleScreenOpenPacket(
|
||||||
false, false, emptyList(), emptyList(), emptyList(), emptyList()
|
false, false, emptyList(), emptyList(), emptyList(), emptyList())
|
||||||
)
|
|
||||||
}
|
|
||||||
val wild = field(U8) { if (it.wild) 1 else 0 } == 1
|
|
||||||
var participants = emptyList<BattleRankingEntry>()
|
|
||||||
var tierUpdates = emptyList<BattleTierUpdate>()
|
|
||||||
var pokemon = emptyList<BattleSelectablePokemon>()
|
|
||||||
if (wild) {
|
|
||||||
participants = field(BattleRankingEntryCodec.listPrefixed(U8)) { it.participants }
|
|
||||||
} else {
|
|
||||||
tierUpdates = field(BattleTierUpdateCodec.listPrefixed(U8)) { it.tierUpdates }
|
|
||||||
pokemon = field(BattleSelectablePokemonCodec.listPrefixed(U8)) { it.pokemon }
|
|
||||||
}
|
|
||||||
val storageItems = field(BattleStorageItemCodec.listPrefixed(U8)) { it.storageItems }
|
|
||||||
return BattleScreenOpenPacket(active, wild, participants, tierUpdates, pokemon, storageItems)
|
|
||||||
}
|
}
|
||||||
|
val wild = field(U8) { if (it.wild) 1 else 0 } == 1
|
||||||
|
var participants = emptyList<BattleRankingEntry>()
|
||||||
|
var tierUpdates = emptyList<BattleTierUpdate>()
|
||||||
|
var pokemon = emptyList<BattleSelectablePokemon>()
|
||||||
|
if (wild) {
|
||||||
|
participants = field(BattleRankingEntryCodec.listPrefixed(U8)) { it.participants }
|
||||||
|
} else {
|
||||||
|
tierUpdates = field(BattleTierUpdateCodec.listPrefixed(U8)) { it.tierUpdates }
|
||||||
|
pokemon = field(BattleSelectablePokemonCodec.listPrefixed(U8)) { it.pokemon }
|
||||||
|
}
|
||||||
|
val storageItems = field(BattleStorageItemCodec.listPrefixed(U8)) { it.storageItems }
|
||||||
|
return BattleScreenOpenPacket(active, wild, participants, tierUpdates, pokemon, storageItems)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+30
-23
@@ -22,27 +22,34 @@ data class BattleSendOutActivePacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleSendOutActivePacketCodec : PacketCodec<BattleSendOutActivePacket>() {
|
object BattleSendOutActivePacketCodec : PacketCodec<BattleSendOutActivePacket>() {
|
||||||
override fun CodecScope<BattleSendOutActivePacket>.body(): BattleSendOutActivePacket {
|
override fun CodecScope<BattleSendOutActivePacket>.body(): BattleSendOutActivePacket {
|
||||||
val present = field(U8) { if (it.member != null) 1 else 0 }
|
val present = field(U8) { if (it.member != null) 1 else 0 }
|
||||||
if (present != 1) return BattleSendOutActivePacket(false, null)
|
if (present != 1) return BattleSendOutActivePacket(false, null)
|
||||||
val opponent = field(Bool) { it.opponent }
|
val opponent = field(Bool) { it.opponent }
|
||||||
val entityIdA = field(S64LE) { it.member!!.entityIdA }
|
val entityIdA = field(S64LE) { it.member!!.entityIdA }
|
||||||
val entityIdB = field(S64LE) { it.member!!.entityIdB }
|
val entityIdB = field(S64LE) { it.member!!.entityIdB }
|
||||||
val entityIdC = field(S64LE) { it.member!!.entityIdC }
|
val entityIdC = field(S64LE) { it.member!!.entityIdC }
|
||||||
val speciesByte = field(S8) { it.member!!.speciesByte }
|
val speciesByte = field(S8) { it.member!!.speciesByte }
|
||||||
val nickname = if (!opponent) field(Utf16LeNullTerminated) { it.member!!.nickname } else ""
|
val nickname = if (!opponent) field(Utf16LeNullTerminated) { it.member!!.nickname } else ""
|
||||||
val ownerName = if (opponent) field(Utf16LeNullTerminated) { it.member!!.ownerName } else ""
|
val ownerName = if (opponent) field(Utf16LeNullTerminated) { it.member!!.ownerName } else ""
|
||||||
val value = field(S32LE) { it.member!!.value }
|
val value = field(S32LE) { it.member!!.value }
|
||||||
val nameA = field(Utf16LeNullTerminated) { it.member!!.nameA }
|
val nameA = field(Utf16LeNullTerminated) { it.member!!.nameA }
|
||||||
val nameB = field(Utf16LeNullTerminated) { it.member!!.nameB }
|
val nameB = field(Utf16LeNullTerminated) { it.member!!.nameB }
|
||||||
val levelByte = field(S8) { it.member!!.levelByte }
|
val levelByte = field(S8) { it.member!!.levelByte }
|
||||||
val flag = field(Bool) { it.member!!.flag }
|
val flag = field(Bool) { it.member!!.flag }
|
||||||
return BattleSendOutActivePacket(
|
return BattleSendOutActivePacket(
|
||||||
opponent,
|
opponent,
|
||||||
BattleSendOutMember(
|
BattleSendOutMember(
|
||||||
entityIdA, entityIdB, entityIdC, speciesByte, nickname, ownerName, value, nameA, nameB,
|
entityIdA,
|
||||||
levelByte, flag
|
entityIdB,
|
||||||
)
|
entityIdC,
|
||||||
)
|
speciesByte,
|
||||||
}
|
nickname,
|
||||||
|
ownerName,
|
||||||
|
value,
|
||||||
|
nameA,
|
||||||
|
nameB,
|
||||||
|
levelByte,
|
||||||
|
flag))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+30
-31
@@ -20,32 +20,31 @@ data class BattleAddPokemon(
|
|||||||
|
|
||||||
private val BattleAddPokemonCodec: Codec<BattleAddPokemon> =
|
private val BattleAddPokemonCodec: Codec<BattleAddPokemon> =
|
||||||
object : PacketCodec<BattleAddPokemon>() {
|
object : PacketCodec<BattleAddPokemon>() {
|
||||||
override fun CodecScope<BattleAddPokemon>.body(): BattleAddPokemon {
|
override fun CodecScope<BattleAddPokemon>.body(): BattleAddPokemon {
|
||||||
val flags =
|
val flags =
|
||||||
field(U8) {
|
field(U8) {
|
||||||
(if (it.slot.toInt() != 0) 4 else 0) or
|
(if (it.slot.toInt() != 0) 4 else 0) or
|
||||||
(if (it.partyIndex.toInt() != -1) 8 else 0) or
|
(if (it.partyIndex.toInt() != -1) 8 else 0) or
|
||||||
(if (it.statusEffect != null) 16 else 0)
|
(if (it.statusEffect != null) 16 else 0)
|
||||||
}
|
}
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
if (flags and 1 != 0) field(S64LE) { 0L }
|
if (flags and 1 != 0) field(S64LE) { 0L }
|
||||||
val frontSpriteId = field(S16LE) { it.frontSpriteId }
|
val frontSpriteId = field(S16LE) { it.frontSpriteId }
|
||||||
val backSpriteId = field(S16LE) { it.backSpriteId }
|
val backSpriteId = field(S16LE) { it.backSpriteId }
|
||||||
val side = field(S8) { it.side }
|
val side = field(S8) { it.side }
|
||||||
if (flags and 2 != 0) field(S8) { 0 }
|
if (flags and 2 != 0) field(S8) { 0 }
|
||||||
val slot = if (flags and 4 != 0) field(S8) { it.slot } else 0
|
val slot = if (flags and 4 != 0) field(S8) { it.slot } else 0
|
||||||
val partyIndex = if (flags and 8 != 0) field(S8) { it.partyIndex } else -1
|
val partyIndex = if (flags and 8 != 0) field(S8) { it.partyIndex } else -1
|
||||||
val statusEffect =
|
val statusEffect =
|
||||||
if (flags and 16 != 0) {
|
if (flags and 16 != 0) {
|
||||||
val durationTurns = field(S32LE) { it.statusEffect!!.durationTurns }
|
val durationTurns = field(S32LE) { it.statusEffect!!.durationTurns }
|
||||||
val effectType = field(S8) { it.statusEffect!!.effectType }
|
val effectType = field(S8) { it.statusEffect!!.effectType }
|
||||||
val sourceSlot = field(S8) { it.statusEffect!!.sourceSlot }
|
val sourceSlot = field(S8) { it.statusEffect!!.sourceSlot }
|
||||||
BattleAddStatusEffect(durationTurns, effectType, sourceSlot)
|
BattleAddStatusEffect(durationTurns, effectType, sourceSlot)
|
||||||
} else null
|
} else null
|
||||||
return BattleAddPokemon(
|
return BattleAddPokemon(
|
||||||
entityId, frontSpriteId, backSpriteId, side, slot, partyIndex, statusEffect
|
entityId, frontSpriteId, backSpriteId, side, slot, partyIndex, statusEffect)
|
||||||
)
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleSideAddPokemonPacket(
|
data class BattleSideAddPokemonPacket(
|
||||||
@@ -54,9 +53,9 @@ data class BattleSideAddPokemonPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleSideAddPokemonPacketCodec : PacketCodec<BattleSideAddPokemonPacket>() {
|
object BattleSideAddPokemonPacketCodec : PacketCodec<BattleSideAddPokemonPacket>() {
|
||||||
override fun CodecScope<BattleSideAddPokemonPacket>.body(): BattleSideAddPokemonPacket {
|
override fun CodecScope<BattleSideAddPokemonPacket>.body(): BattleSideAddPokemonPacket {
|
||||||
val side = field(S8) { it.side }
|
val side = field(S8) { it.side }
|
||||||
val pokemon = field(BattleAddPokemonCodec) { it.pokemon }
|
val pokemon = field(BattleAddPokemonCodec) { it.pokemon }
|
||||||
return BattleSideAddPokemonPacket(side, pokemon)
|
return BattleSideAddPokemonPacket(side, pokemon)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+33
-34
@@ -20,34 +20,33 @@ data class BattlePartyPokemon(
|
|||||||
|
|
||||||
private val BattlePartyPokemonCodec: Codec<BattlePartyPokemon> =
|
private val BattlePartyPokemonCodec: Codec<BattlePartyPokemon> =
|
||||||
object : PacketCodec<BattlePartyPokemon>() {
|
object : PacketCodec<BattlePartyPokemon>() {
|
||||||
override fun CodecScope<BattlePartyPokemon>.body(): BattlePartyPokemon {
|
override fun CodecScope<BattlePartyPokemon>.body(): BattlePartyPokemon {
|
||||||
val flags =
|
val flags =
|
||||||
field(U8) {
|
field(U8) {
|
||||||
(if (false) 1 else 0) or
|
(if (false) 1 else 0) or
|
||||||
(if (false) 2 else 0) or
|
(if (false) 2 else 0) or
|
||||||
(if (it.slot.toInt() != 0) 4 else 0) or
|
(if (it.slot.toInt() != 0) 4 else 0) or
|
||||||
(if (it.partyIndex.toInt() != -1) 8 else 0) or
|
(if (it.partyIndex.toInt() != -1) 8 else 0) or
|
||||||
(if (it.statusEffect != null) 16 else 0)
|
(if (it.statusEffect != null) 16 else 0)
|
||||||
}
|
}
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
if (flags and 1 != 0) field(S64LE) { 0L }
|
if (flags and 1 != 0) field(S64LE) { 0L }
|
||||||
val frontSpriteId = field(S16LE) { it.frontSpriteId }
|
val frontSpriteId = field(S16LE) { it.frontSpriteId }
|
||||||
val backSpriteId = field(S16LE) { it.backSpriteId }
|
val backSpriteId = field(S16LE) { it.backSpriteId }
|
||||||
val side = field(S8) { it.side }
|
val side = field(S8) { it.side }
|
||||||
if (flags and 2 != 0) field(S8) { 0 }
|
if (flags and 2 != 0) field(S8) { 0 }
|
||||||
val slot = if (flags and 4 != 0) field(S8) { it.slot } else 0
|
val slot = if (flags and 4 != 0) field(S8) { it.slot } else 0
|
||||||
val partyIndex = if (flags and 8 != 0) field(S8) { it.partyIndex } else -1
|
val partyIndex = if (flags and 8 != 0) field(S8) { it.partyIndex } else -1
|
||||||
val statusEffect =
|
val statusEffect =
|
||||||
if (flags and 16 != 0) {
|
if (flags and 16 != 0) {
|
||||||
val durationTurns = field(S32LE) { it.statusEffect!!.durationTurns }
|
val durationTurns = field(S32LE) { it.statusEffect!!.durationTurns }
|
||||||
val effectType = field(S8) { it.statusEffect!!.effectType }
|
val effectType = field(S8) { it.statusEffect!!.effectType }
|
||||||
val sourceSlot = field(S8) { it.statusEffect!!.sourceSlot }
|
val sourceSlot = field(S8) { it.statusEffect!!.sourceSlot }
|
||||||
BattlePartyStatusEffect(durationTurns, effectType, sourceSlot)
|
BattlePartyStatusEffect(durationTurns, effectType, sourceSlot)
|
||||||
} else null
|
} else null
|
||||||
return BattlePartyPokemon(
|
return BattlePartyPokemon(
|
||||||
entityId, frontSpriteId, backSpriteId, side, slot, partyIndex, statusEffect
|
entityId, frontSpriteId, backSpriteId, side, slot, partyIndex, statusEffect)
|
||||||
)
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleSidePartyPacket(
|
data class BattleSidePartyPacket(
|
||||||
@@ -57,10 +56,10 @@ data class BattleSidePartyPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleSidePartyPacketCodec : PacketCodec<BattleSidePartyPacket>() {
|
object BattleSidePartyPacketCodec : PacketCodec<BattleSidePartyPacket>() {
|
||||||
override fun CodecScope<BattleSidePartyPacket>.body(): BattleSidePartyPacket {
|
override fun CodecScope<BattleSidePartyPacket>.body(): BattleSidePartyPacket {
|
||||||
val side = field(S8) { it.side }
|
val side = field(S8) { it.side }
|
||||||
val replace = field(U8) { if (it.replace) 1 else 0 } == 1
|
val replace = field(U8) { if (it.replace) 1 else 0 } == 1
|
||||||
val pokemon = field(BattlePartyPokemonCodec.listPrefixed(U16LE)) { it.pokemon }
|
val pokemon = field(BattlePartyPokemonCodec.listPrefixed(U16LE)) { it.pokemon }
|
||||||
return BattleSidePartyPacket(side, replace, pokemon)
|
return BattleSidePartyPacket(side, replace, pokemon)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-5
@@ -11,9 +11,9 @@ data class BattleSideRemovePokemonPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleSideRemovePokemonPacketCodec : PacketCodec<BattleSideRemovePokemonPacket>() {
|
object BattleSideRemovePokemonPacketCodec : PacketCodec<BattleSideRemovePokemonPacket>() {
|
||||||
override fun CodecScope<BattleSideRemovePokemonPacket>.body(): BattleSideRemovePokemonPacket {
|
override fun CodecScope<BattleSideRemovePokemonPacket>.body(): BattleSideRemovePokemonPacket {
|
||||||
val side = field(S8) { it.side }
|
val side = field(S8) { it.side }
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
return BattleSideRemovePokemonPacket(side, entityId)
|
return BattleSideRemovePokemonPacket(side, entityId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+16
-15
@@ -4,27 +4,28 @@ import de.fiereu.bytecodec.*
|
|||||||
|
|
||||||
private val SimulationConfigPayload: Codec<ByteArray> =
|
private val SimulationConfigPayload: Codec<ByteArray> =
|
||||||
object : Codec<ByteArray> {
|
object : Codec<ByteArray> {
|
||||||
override fun read(buf: ReadBuffer): ByteArray {
|
override fun read(buf: ReadBuffer): ByteArray {
|
||||||
val arr = ByteArray(buf.remaining())
|
val arr = ByteArray(buf.remaining())
|
||||||
if (arr.isNotEmpty()) buf.readBytes(arr)
|
if (arr.isNotEmpty()) buf.readBytes(arr)
|
||||||
return arr
|
return arr
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun write(buf: WriteBuffer, value: ByteArray) {
|
override fun write(buf: WriteBuffer, value: ByteArray) {
|
||||||
if (value.isNotEmpty()) buf.writeBytes(value)
|
if (value.isNotEmpty()) buf.writeBytes(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleSimulationRequestPacket(val simulationConfig: ByteArray) {
|
data class BattleSimulationRequestPacket(val simulationConfig: ByteArray) {
|
||||||
override fun equals(other: Any?): Boolean =
|
override fun equals(other: Any?): Boolean =
|
||||||
other is BattleSimulationRequestPacket && simulationConfig.contentEquals(other.simulationConfig)
|
other is BattleSimulationRequestPacket &&
|
||||||
|
simulationConfig.contentEquals(other.simulationConfig)
|
||||||
|
|
||||||
override fun hashCode(): Int = simulationConfig.contentHashCode()
|
override fun hashCode(): Int = simulationConfig.contentHashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
object BattleSimulationRequestPacketCodec : PacketCodec<BattleSimulationRequestPacket>() {
|
object BattleSimulationRequestPacketCodec : PacketCodec<BattleSimulationRequestPacket>() {
|
||||||
override fun CodecScope<BattleSimulationRequestPacket>.body(): BattleSimulationRequestPacket {
|
override fun CodecScope<BattleSimulationRequestPacket>.body(): BattleSimulationRequestPacket {
|
||||||
val simulationConfig = field(SimulationConfigPayload) { it.simulationConfig }
|
val simulationConfig = field(SimulationConfigPayload) { it.simulationConfig }
|
||||||
return BattleSimulationRequestPacket(simulationConfig)
|
return BattleSimulationRequestPacket(simulationConfig)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-5
@@ -10,9 +10,9 @@ data class BattleSlotActionPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleSlotActionPacketCodec : PacketCodec<BattleSlotActionPacket>() {
|
object BattleSlotActionPacketCodec : PacketCodec<BattleSlotActionPacket>() {
|
||||||
override fun CodecScope<BattleSlotActionPacket>.body(): BattleSlotActionPacket {
|
override fun CodecScope<BattleSlotActionPacket>.body(): BattleSlotActionPacket {
|
||||||
val slotRefPacked = field(S8) { it.slotRefPacked }
|
val slotRefPacked = field(S8) { it.slotRefPacked }
|
||||||
val actionByte = field(S8) { it.actionByte }
|
val actionByte = field(S8) { it.actionByte }
|
||||||
return BattleSlotActionPacket(slotRefPacked, actionByte)
|
return BattleSlotActionPacket(slotRefPacked, actionByte)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-5
@@ -11,9 +11,9 @@ data class BattleSlotAnimationResetPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleSlotAnimationResetPacketCodec : PacketCodec<BattleSlotAnimationResetPacket>() {
|
object BattleSlotAnimationResetPacketCodec : PacketCodec<BattleSlotAnimationResetPacket>() {
|
||||||
override fun CodecScope<BattleSlotAnimationResetPacket>.body(): BattleSlotAnimationResetPacket {
|
override fun CodecScope<BattleSlotAnimationResetPacket>.body(): BattleSlotAnimationResetPacket {
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
val slot = field(S8) { it.slot }
|
val slot = field(S8) { it.slot }
|
||||||
return BattleSlotAnimationResetPacket(entityId, slot)
|
return BattleSlotAnimationResetPacket(entityId, slot)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-5
@@ -10,9 +10,9 @@ data class BattleSlotEventEnumPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleSlotEventEnumPacketCodec : PacketCodec<BattleSlotEventEnumPacket>() {
|
object BattleSlotEventEnumPacketCodec : PacketCodec<BattleSlotEventEnumPacket>() {
|
||||||
override fun CodecScope<BattleSlotEventEnumPacket>.body(): BattleSlotEventEnumPacket {
|
override fun CodecScope<BattleSlotEventEnumPacket>.body(): BattleSlotEventEnumPacket {
|
||||||
val slot = field(S8) { it.slot }
|
val slot = field(S8) { it.slot }
|
||||||
val eventType = field(S8) { it.eventType }
|
val eventType = field(S8) { it.eventType }
|
||||||
return BattleSlotEventEnumPacket(slot, eventType)
|
return BattleSlotEventEnumPacket(slot, eventType)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-6
@@ -12,10 +12,10 @@ data class BattleSlotFlagEventPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleSlotFlagEventPacketCodec : PacketCodec<BattleSlotFlagEventPacket>() {
|
object BattleSlotFlagEventPacketCodec : PacketCodec<BattleSlotFlagEventPacket>() {
|
||||||
override fun CodecScope<BattleSlotFlagEventPacket>.body(): BattleSlotFlagEventPacket {
|
override fun CodecScope<BattleSlotFlagEventPacket>.body(): BattleSlotFlagEventPacket {
|
||||||
val slot = field(S8) { it.slot }
|
val slot = field(S8) { it.slot }
|
||||||
val flag = field(Bool) { it.flag }
|
val flag = field(Bool) { it.flag }
|
||||||
val immediate = field(Bool) { it.immediate }
|
val immediate = field(Bool) { it.immediate }
|
||||||
return BattleSlotFlagEventPacket(slot, flag, immediate)
|
return BattleSlotFlagEventPacket(slot, flag, immediate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-6
@@ -12,10 +12,10 @@ data class BattleSlotMoveEventPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleSlotMoveEventPacketCodec : PacketCodec<BattleSlotMoveEventPacket>() {
|
object BattleSlotMoveEventPacketCodec : PacketCodec<BattleSlotMoveEventPacket>() {
|
||||||
override fun CodecScope<BattleSlotMoveEventPacket>.body(): BattleSlotMoveEventPacket {
|
override fun CodecScope<BattleSlotMoveEventPacket>.body(): BattleSlotMoveEventPacket {
|
||||||
val slot = field(S8) { it.slot }
|
val slot = field(S8) { it.slot }
|
||||||
val moveType = field(S8) { it.moveType }
|
val moveType = field(S8) { it.moveType }
|
||||||
val resolved = field(Bool) { it.resolved }
|
val resolved = field(Bool) { it.resolved }
|
||||||
return BattleSlotMoveEventPacket(slot, moveType, resolved)
|
return BattleSlotMoveEventPacket(slot, moveType, resolved)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-6
@@ -12,10 +12,10 @@ data class BattleSlotSwitchEventPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleSlotSwitchEventPacketCodec : PacketCodec<BattleSlotSwitchEventPacket>() {
|
object BattleSlotSwitchEventPacketCodec : PacketCodec<BattleSlotSwitchEventPacket>() {
|
||||||
override fun CodecScope<BattleSlotSwitchEventPacket>.body(): BattleSlotSwitchEventPacket {
|
override fun CodecScope<BattleSlotSwitchEventPacket>.body(): BattleSlotSwitchEventPacket {
|
||||||
val slot = field(S8) { it.slot }
|
val slot = field(S8) { it.slot }
|
||||||
val switchType = field(S8) { it.switchType }
|
val switchType = field(S8) { it.switchType }
|
||||||
val immediate = field(Bool) { it.immediate }
|
val immediate = field(Bool) { it.immediate }
|
||||||
return BattleSlotSwitchEventPacket(slot, switchType, immediate)
|
return BattleSlotSwitchEventPacket(slot, switchType, immediate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-6
@@ -12,10 +12,10 @@ data class BattleStartScenePacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleStartScenePacketCodec : PacketCodec<BattleStartScenePacket>() {
|
object BattleStartScenePacketCodec : PacketCodec<BattleStartScenePacket>() {
|
||||||
override fun CodecScope<BattleStartScenePacket>.body(): BattleStartScenePacket {
|
override fun CodecScope<BattleStartScenePacket>.body(): BattleStartScenePacket {
|
||||||
val battleType = field(S8) { it.battleType }
|
val battleType = field(S8) { it.battleType }
|
||||||
val doubleBattle = field(U8) { if (it.doubleBattle) 1 else 0 } == 1
|
val doubleBattle = field(U8) { if (it.doubleBattle) 1 else 0 } == 1
|
||||||
val perspective = field(S8) { it.perspective }
|
val perspective = field(S8) { it.perspective }
|
||||||
return BattleStartScenePacket(battleType, doubleBattle, perspective)
|
return BattleStartScenePacket(battleType, doubleBattle, perspective)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+29
-29
@@ -14,33 +14,33 @@ data class BattleStatCountersPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleStatCountersPacketCodec : PacketCodec<BattleStatCountersPacket>() {
|
object BattleStatCountersPacketCodec : PacketCodec<BattleStatCountersPacket>() {
|
||||||
override fun CodecScope<BattleStatCountersPacket>.body(): BattleStatCountersPacket {
|
override fun CodecScope<BattleStatCountersPacket>.body(): BattleStatCountersPacket {
|
||||||
val entityId = field(S64LE, BattleStatCountersPacket::entityId)
|
val entityId = field(S64LE, BattleStatCountersPacket::entityId)
|
||||||
val baseCounter = field(S32LE, BattleStatCountersPacket::baseCounter)
|
val baseCounter = field(S32LE, BattleStatCountersPacket::baseCounter)
|
||||||
val flags =
|
val flags =
|
||||||
field(U8) {
|
field(U8) {
|
||||||
(if (it.counter1 != null) 1 else 0) or
|
(if (it.counter1 != null) 1 else 0) or
|
||||||
(if (it.counter2 != null) 2 else 0) or
|
(if (it.counter2 != null) 2 else 0) or
|
||||||
(if (it.counter3 != null) 4 else 0) or
|
(if (it.counter3 != null) 4 else 0) or
|
||||||
(if (it.counter4 != null) 8 else 0) or
|
(if (it.counter4 != null) 8 else 0) or
|
||||||
(if (it.counter5 != null) 16 else 0) or
|
(if (it.counter5 != null) 16 else 0) or
|
||||||
(if (it.counter6 != null) 32 else 0)
|
(if (it.counter6 != null) 32 else 0)
|
||||||
}
|
}
|
||||||
val counter1 = if (flags and 1 != 0) field(S32LE) { it.counter1!! } else null
|
val counter1 = if (flags and 1 != 0) field(S32LE) { it.counter1!! } else null
|
||||||
val counter2 = if (flags and 2 != 0) field(S32LE) { it.counter2!! } else null
|
val counter2 = if (flags and 2 != 0) field(S32LE) { it.counter2!! } else null
|
||||||
val counter3 = if (flags and 4 != 0) field(S32LE) { it.counter3!! } else null
|
val counter3 = if (flags and 4 != 0) field(S32LE) { it.counter3!! } else null
|
||||||
val counter4 = if (flags and 8 != 0) field(S32LE) { it.counter4!! } else null
|
val counter4 = if (flags and 8 != 0) field(S32LE) { it.counter4!! } else null
|
||||||
val counter5 = if (flags and 16 != 0) field(S32LE) { it.counter5!! } else null
|
val counter5 = if (flags and 16 != 0) field(S32LE) { it.counter5!! } else null
|
||||||
val counter6 = if (flags and 32 != 0) field(S32LE) { it.counter6!! } else null
|
val counter6 = if (flags and 32 != 0) field(S32LE) { it.counter6!! } else null
|
||||||
return BattleStatCountersPacket(
|
return BattleStatCountersPacket(
|
||||||
entityId,
|
entityId,
|
||||||
baseCounter,
|
baseCounter,
|
||||||
counter1,
|
counter1,
|
||||||
counter2,
|
counter2,
|
||||||
counter3,
|
counter3,
|
||||||
counter4,
|
counter4,
|
||||||
counter5,
|
counter5,
|
||||||
counter6,
|
counter6,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+8
-8
@@ -11,12 +11,12 @@ data class BattleStatStagePacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleStatStagePacketCodec : PacketCodec<BattleStatStagePacket>() {
|
object BattleStatStagePacketCodec : PacketCodec<BattleStatStagePacket>() {
|
||||||
override fun CodecScope<BattleStatStagePacket>.body(): BattleStatStagePacket {
|
override fun CodecScope<BattleStatStagePacket>.body(): BattleStatStagePacket {
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
val stat = field(S8) { it.stat }
|
val stat = field(S8) { it.stat }
|
||||||
val value = field(S16LE) { it.value }
|
val value = field(S16LE) { it.value }
|
||||||
val stage = field(S8) { it.stage }
|
val stage = field(S8) { it.stage }
|
||||||
val flags = field(S8) { it.flags }
|
val flags = field(S8) { it.flags }
|
||||||
return BattleStatStagePacket(entityId, stat, value, stage, flags)
|
return BattleStatStagePacket(entityId, stat, value, stage, flags)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -9,8 +9,8 @@ data class BattleStateBytePacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleStateBytePacketCodec : PacketCodec<BattleStateBytePacket>() {
|
object BattleStateBytePacketCodec : PacketCodec<BattleStateBytePacket>() {
|
||||||
override fun CodecScope<BattleStateBytePacket>.body(): BattleStateBytePacket {
|
override fun CodecScope<BattleStateBytePacket>.body(): BattleStateBytePacket {
|
||||||
val state = field(S8) { it.state }
|
val state = field(S8) { it.state }
|
||||||
return BattleStateBytePacket(state)
|
return BattleStateBytePacket(state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-5
@@ -11,9 +11,9 @@ data class BattleStateSlotIntPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleStateSlotIntPacketCodec : PacketCodec<BattleStateSlotIntPacket>() {
|
object BattleStateSlotIntPacketCodec : PacketCodec<BattleStateSlotIntPacket>() {
|
||||||
override fun CodecScope<BattleStateSlotIntPacket>.body(): BattleStateSlotIntPacket {
|
override fun CodecScope<BattleStateSlotIntPacket>.body(): BattleStateSlotIntPacket {
|
||||||
val index = field(S8) { it.index }
|
val index = field(S8) { it.index }
|
||||||
val value = field(S32LE) { it.value }
|
val value = field(S32LE) { it.value }
|
||||||
return BattleStateSlotIntPacket(index, value)
|
return BattleStateSlotIntPacket(index, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-6
@@ -12,10 +12,10 @@ data class BattleStatusFlagPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleStatusFlagPacketCodec : PacketCodec<BattleStatusFlagPacket>() {
|
object BattleStatusFlagPacketCodec : PacketCodec<BattleStatusFlagPacket>() {
|
||||||
override fun CodecScope<BattleStatusFlagPacket>.body(): BattleStatusFlagPacket {
|
override fun CodecScope<BattleStatusFlagPacket>.body(): BattleStatusFlagPacket {
|
||||||
val scope = field(S8) { it.scope }
|
val scope = field(S8) { it.scope }
|
||||||
val flagId = field(S16LE) { it.flagId }
|
val flagId = field(S16LE) { it.flagId }
|
||||||
val flagValue = field(S16LE) { it.flagValue }
|
val flagValue = field(S16LE) { it.flagValue }
|
||||||
return BattleStatusFlagPacket(scope, flagId, flagValue)
|
return BattleStatusFlagPacket(scope, flagId, flagValue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -9,8 +9,8 @@ data class BattleSwitchPromptTogglePacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleSwitchPromptTogglePacketCodec : PacketCodec<BattleSwitchPromptTogglePacket>() {
|
object BattleSwitchPromptTogglePacketCodec : PacketCodec<BattleSwitchPromptTogglePacket>() {
|
||||||
override fun CodecScope<BattleSwitchPromptTogglePacket>.body(): BattleSwitchPromptTogglePacket {
|
override fun CodecScope<BattleSwitchPromptTogglePacket>.body(): BattleSwitchPromptTogglePacket {
|
||||||
val shown = field(Bool) { it.shown }
|
val shown = field(Bool) { it.shown }
|
||||||
return BattleSwitchPromptTogglePacket(shown)
|
return BattleSwitchPromptTogglePacket(shown)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -9,8 +9,8 @@ data class BattleSwitchSelectionsPacket(
|
|||||||
private val SelectedEntityIdsCodec = S64LE.listPrefixed(U8)
|
private val SelectedEntityIdsCodec = S64LE.listPrefixed(U8)
|
||||||
|
|
||||||
object BattleSwitchSelectionsPacketCodec : PacketCodec<BattleSwitchSelectionsPacket>() {
|
object BattleSwitchSelectionsPacketCodec : PacketCodec<BattleSwitchSelectionsPacket>() {
|
||||||
override fun CodecScope<BattleSwitchSelectionsPacket>.body(): BattleSwitchSelectionsPacket {
|
override fun CodecScope<BattleSwitchSelectionsPacket>.body(): BattleSwitchSelectionsPacket {
|
||||||
val selectedEntityIds = field(SelectedEntityIdsCodec) { it.selectedEntityIds }
|
val selectedEntityIds = field(SelectedEntityIdsCodec) { it.selectedEntityIds }
|
||||||
return BattleSwitchSelectionsPacket(selectedEntityIds)
|
return BattleSwitchSelectionsPacket(selectedEntityIds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -9,8 +9,8 @@ data class BattleTargetPickPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleTargetPickPacketCodec : PacketCodec<BattleTargetPickPacket>() {
|
object BattleTargetPickPacketCodec : PacketCodec<BattleTargetPickPacket>() {
|
||||||
override fun CodecScope<BattleTargetPickPacket>.body(): BattleTargetPickPacket {
|
override fun CodecScope<BattleTargetPickPacket>.body(): BattleTargetPickPacket {
|
||||||
val targetEntityId = field(S64LE) { it.targetEntityId }
|
val targetEntityId = field(S64LE) { it.targetEntityId }
|
||||||
return BattleTargetPickPacket(targetEntityId)
|
return BattleTargetPickPacket(targetEntityId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-5
@@ -11,9 +11,9 @@ data class BattleTeamPreviewConfirmPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleTeamPreviewConfirmPacketCodec : PacketCodec<BattleTeamPreviewConfirmPacket>() {
|
object BattleTeamPreviewConfirmPacketCodec : PacketCodec<BattleTeamPreviewConfirmPacket>() {
|
||||||
override fun CodecScope<BattleTeamPreviewConfirmPacket>.body(): BattleTeamPreviewConfirmPacket {
|
override fun CodecScope<BattleTeamPreviewConfirmPacket>.body(): BattleTeamPreviewConfirmPacket {
|
||||||
val side = field(S16LE) { it.side }
|
val side = field(S16LE) { it.side }
|
||||||
val isOwnTeam = field(Bool) { it.isOwnTeam }
|
val isOwnTeam = field(Bool) { it.isOwnTeam }
|
||||||
return BattleTeamPreviewConfirmPacket(side, isOwnTeam)
|
return BattleTeamPreviewConfirmPacket(side, isOwnTeam)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+33
-25
@@ -20,23 +20,31 @@ private class BattlePreviewMemberCodec(
|
|||||||
private val opponent: Boolean,
|
private val opponent: Boolean,
|
||||||
private val withDetails: Boolean,
|
private val withDetails: Boolean,
|
||||||
) : PacketCodec<BattlePreviewMember>() {
|
) : PacketCodec<BattlePreviewMember>() {
|
||||||
override fun CodecScope<BattlePreviewMember>.body(): BattlePreviewMember {
|
override fun CodecScope<BattlePreviewMember>.body(): BattlePreviewMember {
|
||||||
val entityIdA = field(S64LE) { it.entityIdA }
|
val entityIdA = field(S64LE) { it.entityIdA }
|
||||||
val entityIdB = field(S64LE) { it.entityIdB }
|
val entityIdB = field(S64LE) { it.entityIdB }
|
||||||
val entityIdC = field(S64LE) { it.entityIdC }
|
val entityIdC = field(S64LE) { it.entityIdC }
|
||||||
val speciesByte = field(S8) { it.speciesByte }
|
val speciesByte = field(S8) { it.speciesByte }
|
||||||
val nickname = if (!opponent) field(Utf16LeNullTerminated) { it.nickname } else ""
|
val nickname = if (!opponent) field(Utf16LeNullTerminated) { it.nickname } else ""
|
||||||
val ownerName = if (opponent) field(Utf16LeNullTerminated) { it.ownerName } else ""
|
val ownerName = if (opponent) field(Utf16LeNullTerminated) { it.ownerName } else ""
|
||||||
val value = field(S32LE) { it.value }
|
val value = field(S32LE) { it.value }
|
||||||
val nameA = field(Utf16LeNullTerminated) { it.nameA }
|
val nameA = field(Utf16LeNullTerminated) { it.nameA }
|
||||||
val nameB = if (withDetails) field(Utf16LeNullTerminated) { it.nameB } else ""
|
val nameB = if (withDetails) field(Utf16LeNullTerminated) { it.nameB } else ""
|
||||||
val levelByte = field(S8) { it.levelByte }
|
val levelByte = field(S8) { it.levelByte }
|
||||||
val flag = field(Bool) { it.flag }
|
val flag = field(Bool) { it.flag }
|
||||||
return BattlePreviewMember(
|
return BattlePreviewMember(
|
||||||
entityIdA, entityIdB, entityIdC, speciesByte, nickname, ownerName, value, nameA, nameB,
|
entityIdA,
|
||||||
levelByte, flag
|
entityIdB,
|
||||||
)
|
entityIdC,
|
||||||
}
|
speciesByte,
|
||||||
|
nickname,
|
||||||
|
ownerName,
|
||||||
|
value,
|
||||||
|
nameA,
|
||||||
|
nameB,
|
||||||
|
levelByte,
|
||||||
|
flag)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class BattleTeamPreviewListPacket(
|
data class BattleTeamPreviewListPacket(
|
||||||
@@ -46,12 +54,12 @@ data class BattleTeamPreviewListPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleTeamPreviewListPacketCodec : PacketCodec<BattleTeamPreviewListPacket>() {
|
object BattleTeamPreviewListPacketCodec : PacketCodec<BattleTeamPreviewListPacket>() {
|
||||||
override fun CodecScope<BattleTeamPreviewListPacket>.body(): BattleTeamPreviewListPacket {
|
override fun CodecScope<BattleTeamPreviewListPacket>.body(): BattleTeamPreviewListPacket {
|
||||||
val side = field(S16LE) { it.side }
|
val side = field(S16LE) { it.side }
|
||||||
val opponent = field(Bool) { it.opponent }
|
val opponent = field(Bool) { it.opponent }
|
||||||
val memberCodec = BattlePreviewMemberCodec(opponent, false)
|
val memberCodec = BattlePreviewMemberCodec(opponent, false)
|
||||||
val count = field(S16LE) { it.members.size.toShort() }.toInt()
|
val count = field(S16LE) { it.members.size.toShort() }.toInt()
|
||||||
val members = (0 until count).map { i -> field(memberCodec) { it.members[i] } }
|
val members = (0 until count).map { i -> field(memberCodec) { it.members[i] } }
|
||||||
return BattleTeamPreviewListPacket(side, opponent, members)
|
return BattleTeamPreviewListPacket(side, opponent, members)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-5
@@ -7,9 +7,9 @@ import de.fiereu.bytecodec.S8
|
|||||||
data class BattleTierSelectPacket(val pokemonSlotIndex: Byte, val tierIndex: Byte)
|
data class BattleTierSelectPacket(val pokemonSlotIndex: Byte, val tierIndex: Byte)
|
||||||
|
|
||||||
object BattleTierSelectPacketCodec : PacketCodec<BattleTierSelectPacket>() {
|
object BattleTierSelectPacketCodec : PacketCodec<BattleTierSelectPacket>() {
|
||||||
override fun CodecScope<BattleTierSelectPacket>.body(): BattleTierSelectPacket {
|
override fun CodecScope<BattleTierSelectPacket>.body(): BattleTierSelectPacket {
|
||||||
val pokemonSlotIndex = field(S8) { it.pokemonSlotIndex }
|
val pokemonSlotIndex = field(S8) { it.pokemonSlotIndex }
|
||||||
val tierIndex = field(S8) { it.tierIndex }
|
val tierIndex = field(S8) { it.tierIndex }
|
||||||
return BattleTierSelectPacket(pokemonSlotIndex, tierIndex)
|
return BattleTierSelectPacket(pokemonSlotIndex, tierIndex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-3
@@ -6,7 +6,7 @@ import de.fiereu.bytecodec.PacketCodec
|
|||||||
class BattleTransitionReadyPacket
|
class BattleTransitionReadyPacket
|
||||||
|
|
||||||
object BattleTransitionReadyPacketCodec : PacketCodec<BattleTransitionReadyPacket>() {
|
object BattleTransitionReadyPacketCodec : PacketCodec<BattleTransitionReadyPacket>() {
|
||||||
override fun CodecScope<BattleTransitionReadyPacket>.body(): BattleTransitionReadyPacket {
|
override fun CodecScope<BattleTransitionReadyPacket>.body(): BattleTransitionReadyPacket {
|
||||||
return BattleTransitionReadyPacket()
|
return BattleTransitionReadyPacket()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-5
@@ -11,9 +11,9 @@ data class BattleUseItemPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object BattleUseItemPacketCodec : PacketCodec<BattleUseItemPacket>() {
|
object BattleUseItemPacketCodec : PacketCodec<BattleUseItemPacket>() {
|
||||||
override fun CodecScope<BattleUseItemPacket>.body(): BattleUseItemPacket {
|
override fun CodecScope<BattleUseItemPacket>.body(): BattleUseItemPacket {
|
||||||
val pokemonEntityId = field(S64LE) { it.pokemonEntityId }
|
val pokemonEntityId = field(S64LE) { it.pokemonEntityId }
|
||||||
val quantity = field(S16LE) { it.quantity }
|
val quantity = field(S16LE) { it.quantity }
|
||||||
return BattleUseItemPacket(pokemonEntityId, quantity)
|
return BattleUseItemPacket(pokemonEntityId, quantity)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-5
@@ -7,9 +7,9 @@ import de.fiereu.bytecodec.Utf16LeNullTerminated
|
|||||||
data class BlockPlayerPacket(val username: String, val reason: String)
|
data class BlockPlayerPacket(val username: String, val reason: String)
|
||||||
|
|
||||||
object BlockPlayerPacketCodec : PacketCodec<BlockPlayerPacket>() {
|
object BlockPlayerPacketCodec : PacketCodec<BlockPlayerPacket>() {
|
||||||
override fun CodecScope<BlockPlayerPacket>.body(): BlockPlayerPacket {
|
override fun CodecScope<BlockPlayerPacket>.body(): BlockPlayerPacket {
|
||||||
val username = field(Utf16LeNullTerminated) { it.username }
|
val username = field(Utf16LeNullTerminated) { it.username }
|
||||||
val reason = field(Utf16LeNullTerminated) { it.reason }
|
val reason = field(Utf16LeNullTerminated) { it.reason }
|
||||||
return BlockPlayerPacket(username, reason)
|
return BlockPlayerPacket(username, reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+73
-73
@@ -32,89 +32,89 @@ data class BreedingForecastPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
private object BreedingStatContributionCodec : PacketCodec<BreedingStatContribution>() {
|
private object BreedingStatContributionCodec : PacketCodec<BreedingStatContribution>() {
|
||||||
override fun CodecScope<BreedingStatContribution>.body(): BreedingStatContribution {
|
override fun CodecScope<BreedingStatContribution>.body(): BreedingStatContribution {
|
||||||
val source = field(S8, BreedingStatContribution::source)
|
val source = field(S8, BreedingStatContribution::source)
|
||||||
val weight = field(F32LE, BreedingStatContribution::weight)
|
val weight = field(F32LE, BreedingStatContribution::weight)
|
||||||
val amount = field(S32LE, BreedingStatContribution::amount)
|
val amount = field(S32LE, BreedingStatContribution::amount)
|
||||||
return BreedingStatContribution(source, weight, amount)
|
return BreedingStatContribution(source, weight, amount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val BreedingStatContributionListPrefixedU8: Codec<List<BreedingStatContribution>> =
|
private val BreedingStatContributionListPrefixedU8: Codec<List<BreedingStatContribution>> =
|
||||||
object : Codec<List<BreedingStatContribution>> {
|
object : Codec<List<BreedingStatContribution>> {
|
||||||
override fun read(buf: ReadBuffer): List<BreedingStatContribution> {
|
override fun read(buf: ReadBuffer): List<BreedingStatContribution> {
|
||||||
val n = U8.read(buf)
|
val n = U8.read(buf)
|
||||||
return List(n) { BreedingStatContributionCodec.read(buf) }
|
return List(n) { BreedingStatContributionCodec.read(buf) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun write(buf: WriteBuffer, value: List<BreedingStatContribution>) {
|
override fun write(buf: WriteBuffer, value: List<BreedingStatContribution>) {
|
||||||
U8.write(buf, value.size)
|
U8.write(buf, value.size)
|
||||||
value.forEach { BreedingStatContributionCodec.write(buf, it) }
|
value.forEach { BreedingStatContributionCodec.write(buf, it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private object BreedingStatEntryCodec : PacketCodec<BreedingStatEntry>() {
|
private object BreedingStatEntryCodec : PacketCodec<BreedingStatEntry>() {
|
||||||
override fun CodecScope<BreedingStatEntry>.body(): BreedingStatEntry {
|
override fun CodecScope<BreedingStatEntry>.body(): BreedingStatEntry {
|
||||||
val guaranteed = field(Bool, BreedingStatEntry::guaranteed)
|
val guaranteed = field(Bool, BreedingStatEntry::guaranteed)
|
||||||
val statId = field(S16LE, BreedingStatEntry::statId)
|
val statId = field(S16LE, BreedingStatEntry::statId)
|
||||||
val contributions =
|
val contributions =
|
||||||
field(BreedingStatContributionListPrefixedU8, BreedingStatEntry::contributions)
|
field(BreedingStatContributionListPrefixedU8, BreedingStatEntry::contributions)
|
||||||
return BreedingStatEntry(guaranteed, statId, contributions)
|
return BreedingStatEntry(guaranteed, statId, contributions)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object BreedingForecastPacketCodec : PacketCodec<BreedingForecastPacket>() {
|
object BreedingForecastPacketCodec : PacketCodec<BreedingForecastPacket>() {
|
||||||
override fun CodecScope<BreedingForecastPacket>.body(): BreedingForecastPacket {
|
override fun CodecScope<BreedingForecastPacket>.body(): BreedingForecastPacket {
|
||||||
val parentA = field(S64LE, BreedingForecastPacket::parentA)
|
val parentA = field(S64LE, BreedingForecastPacket::parentA)
|
||||||
val parentB = field(S64LE, BreedingForecastPacket::parentB)
|
val parentB = field(S64LE, BreedingForecastPacket::parentB)
|
||||||
val hasPreview = field(Bool, BreedingForecastPacket::hasPreview)
|
val hasPreview = field(Bool, BreedingForecastPacket::hasPreview)
|
||||||
if (!hasPreview) {
|
if (!hasPreview) {
|
||||||
return BreedingForecastPacket(
|
return BreedingForecastPacket(
|
||||||
parentA,
|
parentA,
|
||||||
parentB,
|
parentB,
|
||||||
hasPreview,
|
hasPreview,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
emptyList(),
|
emptyList(),
|
||||||
emptyList(),
|
emptyList(),
|
||||||
emptyList(),
|
emptyList(),
|
||||||
emptyList(),
|
emptyList(),
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
false,
|
false,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
}
|
|
||||||
val species = field(S16LE, BreedingForecastPacket::species)
|
|
||||||
val form = field(S8, BreedingForecastPacket::form)
|
|
||||||
val statCount = field(U8) { it.statEntries.size }
|
|
||||||
val statEntries = List(statCount) { i -> field(BreedingStatEntryCodec) { it.statEntries[i] } }
|
|
||||||
val shininessCount = field(U8) { it.shininessTypes.size }
|
|
||||||
val shininessTypes = List(shininessCount) { i -> field(S8) { it.shininessTypes[i] } }
|
|
||||||
val valueCount = field(U8) { it.valueIds.size }
|
|
||||||
val valueIds = List(valueCount) { i -> field(S16LE) { it.valueIds[i] } }
|
|
||||||
val valueSources = List(valueCount) { i -> field(S8) { it.valueSources[i] } }
|
|
||||||
val gender = field(S8, BreedingForecastPacket::gender)
|
|
||||||
val nature = field(S16LE, BreedingForecastPacket::nature)
|
|
||||||
val shiny = field(Bool, BreedingForecastPacket::shiny)
|
|
||||||
val cost = field(S32LE, BreedingForecastPacket::cost)
|
|
||||||
val secondaryCost = field(S32LE, BreedingForecastPacket::secondaryCost)
|
|
||||||
return BreedingForecastPacket(
|
|
||||||
parentA,
|
|
||||||
parentB,
|
|
||||||
hasPreview,
|
|
||||||
species,
|
|
||||||
form,
|
|
||||||
statEntries,
|
|
||||||
shininessTypes,
|
|
||||||
valueIds,
|
|
||||||
valueSources,
|
|
||||||
gender,
|
|
||||||
nature,
|
|
||||||
shiny,
|
|
||||||
cost,
|
|
||||||
secondaryCost,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
val species = field(S16LE, BreedingForecastPacket::species)
|
||||||
|
val form = field(S8, BreedingForecastPacket::form)
|
||||||
|
val statCount = field(U8) { it.statEntries.size }
|
||||||
|
val statEntries = List(statCount) { i -> field(BreedingStatEntryCodec) { it.statEntries[i] } }
|
||||||
|
val shininessCount = field(U8) { it.shininessTypes.size }
|
||||||
|
val shininessTypes = List(shininessCount) { i -> field(S8) { it.shininessTypes[i] } }
|
||||||
|
val valueCount = field(U8) { it.valueIds.size }
|
||||||
|
val valueIds = List(valueCount) { i -> field(S16LE) { it.valueIds[i] } }
|
||||||
|
val valueSources = List(valueCount) { i -> field(S8) { it.valueSources[i] } }
|
||||||
|
val gender = field(S8, BreedingForecastPacket::gender)
|
||||||
|
val nature = field(S16LE, BreedingForecastPacket::nature)
|
||||||
|
val shiny = field(Bool, BreedingForecastPacket::shiny)
|
||||||
|
val cost = field(S32LE, BreedingForecastPacket::cost)
|
||||||
|
val secondaryCost = field(S32LE, BreedingForecastPacket::secondaryCost)
|
||||||
|
return BreedingForecastPacket(
|
||||||
|
parentA,
|
||||||
|
parentB,
|
||||||
|
hasPreview,
|
||||||
|
species,
|
||||||
|
form,
|
||||||
|
statEntries,
|
||||||
|
shininessTypes,
|
||||||
|
valueIds,
|
||||||
|
valueSources,
|
||||||
|
gender,
|
||||||
|
nature,
|
||||||
|
shiny,
|
||||||
|
cost,
|
||||||
|
secondaryCost,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -7,8 +7,8 @@ import de.fiereu.bytecodec.S8
|
|||||||
data class ByteArgumentPacket(val value: Byte)
|
data class ByteArgumentPacket(val value: Byte)
|
||||||
|
|
||||||
object ByteArgumentPacketCodec : PacketCodec<ByteArgumentPacket>() {
|
object ByteArgumentPacketCodec : PacketCodec<ByteArgumentPacket>() {
|
||||||
override fun CodecScope<ByteArgumentPacket>.body(): ByteArgumentPacket {
|
override fun CodecScope<ByteArgumentPacket>.body(): ByteArgumentPacket {
|
||||||
val value = field(S8) { it.value }
|
val value = field(S8) { it.value }
|
||||||
return ByteArgumentPacket(value)
|
return ByteArgumentPacket(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -7,8 +7,8 @@ import de.fiereu.bytecodec.S8
|
|||||||
data class ByteChoicePacket(val value: Byte)
|
data class ByteChoicePacket(val value: Byte)
|
||||||
|
|
||||||
object ByteChoicePacketCodec : PacketCodec<ByteChoicePacket>() {
|
object ByteChoicePacketCodec : PacketCodec<ByteChoicePacket>() {
|
||||||
override fun CodecScope<ByteChoicePacket>.body(): ByteChoicePacket {
|
override fun CodecScope<ByteChoicePacket>.body(): ByteChoicePacket {
|
||||||
val value = field(S8) { it.value }
|
val value = field(S8) { it.value }
|
||||||
return ByteChoicePacket(value)
|
return ByteChoicePacket(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -9,8 +9,8 @@ data class CameraFollowEntityPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object CameraFollowEntityPacketCodec : PacketCodec<CameraFollowEntityPacket>() {
|
object CameraFollowEntityPacketCodec : PacketCodec<CameraFollowEntityPacket>() {
|
||||||
override fun CodecScope<CameraFollowEntityPacket>.body(): CameraFollowEntityPacket {
|
override fun CodecScope<CameraFollowEntityPacket>.body(): CameraFollowEntityPacket {
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
return CameraFollowEntityPacket(entityId)
|
return CameraFollowEntityPacket(entityId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-4
@@ -9,8 +9,8 @@ data class CancelEntityMessagePacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object CancelEntityMessagePacketCodec : PacketCodec<CancelEntityMessagePacket>() {
|
object CancelEntityMessagePacketCodec : PacketCodec<CancelEntityMessagePacket>() {
|
||||||
override fun CodecScope<CancelEntityMessagePacket>.body(): CancelEntityMessagePacket {
|
override fun CodecScope<CancelEntityMessagePacket>.body(): CancelEntityMessagePacket {
|
||||||
val entityId = field(S64LE) { it.entityId }
|
val entityId = field(S64LE) { it.entityId }
|
||||||
return CancelEntityMessagePacket(entityId)
|
return CancelEntityMessagePacket(entityId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-3
@@ -6,7 +6,7 @@ import de.fiereu.bytecodec.PacketCodec
|
|||||||
class CancelMatchmakingSearchPacket
|
class CancelMatchmakingSearchPacket
|
||||||
|
|
||||||
object CancelMatchmakingSearchPacketCodec : PacketCodec<CancelMatchmakingSearchPacket>() {
|
object CancelMatchmakingSearchPacketCodec : PacketCodec<CancelMatchmakingSearchPacket>() {
|
||||||
override fun CodecScope<CancelMatchmakingSearchPacket>.body(): CancelMatchmakingSearchPacket {
|
override fun CodecScope<CancelMatchmakingSearchPacket>.body(): CancelMatchmakingSearchPacket {
|
||||||
return CancelMatchmakingSearchPacket()
|
return CancelMatchmakingSearchPacket()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+3
-3
@@ -6,7 +6,7 @@ import de.fiereu.bytecodec.PacketCodec
|
|||||||
class CancelSocialInteractionPacket
|
class CancelSocialInteractionPacket
|
||||||
|
|
||||||
object CancelSocialInteractionPacketCodec : PacketCodec<CancelSocialInteractionPacket>() {
|
object CancelSocialInteractionPacketCodec : PacketCodec<CancelSocialInteractionPacket>() {
|
||||||
override fun CodecScope<CancelSocialInteractionPacket>.body(): CancelSocialInteractionPacket {
|
override fun CodecScope<CancelSocialInteractionPacket>.body(): CancelSocialInteractionPacket {
|
||||||
return CancelSocialInteractionPacket()
|
return CancelSocialInteractionPacket()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+17
-17
@@ -7,25 +7,25 @@ data class CategoryFlagsPacket(
|
|||||||
val timestampMillis: Long,
|
val timestampMillis: Long,
|
||||||
val flagBits: ByteArray,
|
val flagBits: ByteArray,
|
||||||
) {
|
) {
|
||||||
override fun equals(other: Any?): Boolean =
|
override fun equals(other: Any?): Boolean =
|
||||||
other is CategoryFlagsPacket &&
|
other is CategoryFlagsPacket &&
|
||||||
entryKind == other.entryKind &&
|
entryKind == other.entryKind &&
|
||||||
timestampMillis == other.timestampMillis &&
|
timestampMillis == other.timestampMillis &&
|
||||||
flagBits.contentEquals(other.flagBits)
|
flagBits.contentEquals(other.flagBits)
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
var r = entryKind
|
var r = entryKind
|
||||||
r = r * 31 + timestampMillis.hashCode()
|
r = r * 31 + timestampMillis.hashCode()
|
||||||
r = r * 31 + flagBits.contentHashCode()
|
r = r * 31 + flagBits.contentHashCode()
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object CategoryFlagsPacketCodec : PacketCodec<CategoryFlagsPacket>() {
|
object CategoryFlagsPacketCodec : PacketCodec<CategoryFlagsPacket>() {
|
||||||
override fun CodecScope<CategoryFlagsPacket>.body(): CategoryFlagsPacket {
|
override fun CodecScope<CategoryFlagsPacket>.body(): CategoryFlagsPacket {
|
||||||
val entryKind = field(U8) { it.entryKind }
|
val entryKind = field(U8) { it.entryKind }
|
||||||
val timestampMillis = field(S64LE) { it.timestampMillis }
|
val timestampMillis = field(S64LE) { it.timestampMillis }
|
||||||
val flagBits = field(bytesPrefixed(U16LE)) { it.flagBits }
|
val flagBits = field(bytesPrefixed(U16LE)) { it.flagBits }
|
||||||
return CategoryFlagsPacket(entryKind, timestampMillis, flagBits)
|
return CategoryFlagsPacket(entryKind, timestampMillis, flagBits)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+15
-15
@@ -13,26 +13,26 @@ data class ChannelAssignmentsPacket(
|
|||||||
|
|
||||||
private val ChannelTypeBindingCodec: Codec<ChannelTypeBinding> =
|
private val ChannelTypeBindingCodec: Codec<ChannelTypeBinding> =
|
||||||
object : PacketCodec<ChannelTypeBinding>() {
|
object : PacketCodec<ChannelTypeBinding>() {
|
||||||
override fun CodecScope<ChannelTypeBinding>.body(): ChannelTypeBinding {
|
override fun CodecScope<ChannelTypeBinding>.body(): ChannelTypeBinding {
|
||||||
val chatType = field(S16LE) { it.chatType }
|
val chatType = field(S16LE) { it.chatType }
|
||||||
val channel = field(S8) { it.channel }
|
val channel = field(S8) { it.channel }
|
||||||
return ChannelTypeBinding(chatType, channel)
|
return ChannelTypeBinding(chatType, channel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val ChannelGroupBindingCodec: Codec<ChannelGroupBinding> =
|
private val ChannelGroupBindingCodec: Codec<ChannelGroupBinding> =
|
||||||
object : PacketCodec<ChannelGroupBinding>() {
|
object : PacketCodec<ChannelGroupBinding>() {
|
||||||
override fun CodecScope<ChannelGroupBinding>.body(): ChannelGroupBinding {
|
override fun CodecScope<ChannelGroupBinding>.body(): ChannelGroupBinding {
|
||||||
val channel = field(S8) { it.channel }
|
val channel = field(S8) { it.channel }
|
||||||
val members = field(S16LE.listPrefixed(U16LE)) { it.members }
|
val members = field(S16LE.listPrefixed(U16LE)) { it.members }
|
||||||
return ChannelGroupBinding(channel, members)
|
return ChannelGroupBinding(channel, members)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object ChannelAssignmentsPacketCodec : PacketCodec<ChannelAssignmentsPacket>() {
|
object ChannelAssignmentsPacketCodec : PacketCodec<ChannelAssignmentsPacket>() {
|
||||||
override fun CodecScope<ChannelAssignmentsPacket>.body(): ChannelAssignmentsPacket {
|
override fun CodecScope<ChannelAssignmentsPacket>.body(): ChannelAssignmentsPacket {
|
||||||
val typeBindings = field(ChannelTypeBindingCodec.listPrefixed(U16LE)) { it.typeBindings }
|
val typeBindings = field(ChannelTypeBindingCodec.listPrefixed(U16LE)) { it.typeBindings }
|
||||||
val groupBindings = field(ChannelGroupBindingCodec.listPrefixed(U8)) { it.groupBindings }
|
val groupBindings = field(ChannelGroupBindingCodec.listPrefixed(U8)) { it.groupBindings }
|
||||||
return ChannelAssignmentsPacket(typeBindings, groupBindings)
|
return ChannelAssignmentsPacket(typeBindings, groupBindings)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+12
-12
@@ -15,19 +15,19 @@ data class ChannelCountDeltaPacket(
|
|||||||
|
|
||||||
private val ChannelCountEntryCodec: Codec<ChannelCountEntry> =
|
private val ChannelCountEntryCodec: Codec<ChannelCountEntry> =
|
||||||
object : PacketCodec<ChannelCountEntry>() {
|
object : PacketCodec<ChannelCountEntry>() {
|
||||||
override fun CodecScope<ChannelCountEntry>.body(): ChannelCountEntry {
|
override fun CodecScope<ChannelCountEntry>.body(): ChannelCountEntry {
|
||||||
val channelId = field(S16LE) { it.channelId }
|
val channelId = field(S16LE) { it.channelId }
|
||||||
val flag = field(Bool) { it.flag }
|
val flag = field(Bool) { it.flag }
|
||||||
return ChannelCountEntry(channelId, flag)
|
return ChannelCountEntry(channelId, flag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object ChannelCountDeltaPacketCodec : PacketCodec<ChannelCountDeltaPacket>() {
|
object ChannelCountDeltaPacketCodec : PacketCodec<ChannelCountDeltaPacket>() {
|
||||||
override fun CodecScope<ChannelCountDeltaPacket>.body(): ChannelCountDeltaPacket {
|
override fun CodecScope<ChannelCountDeltaPacket>.body(): ChannelCountDeltaPacket {
|
||||||
val category = field(S8) { it.category }
|
val category = field(S8) { it.category }
|
||||||
val count = field(U8) { it.entries.size }
|
val count = field(U8) { it.entries.size }
|
||||||
val entries = (0 until count).map { i -> field(ChannelCountEntryCodec) { it.entries[i] } }
|
val entries = (0 until count).map { i -> field(ChannelCountEntryCodec) { it.entries[i] } }
|
||||||
val delta = field(S8) { it.delta }
|
val delta = field(S8) { it.delta }
|
||||||
return ChannelCountDeltaPacket(category, entries, delta)
|
return ChannelCountDeltaPacket(category, entries, delta)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
-5
@@ -8,9 +8,9 @@ import de.fiereu.bytecodec.S8
|
|||||||
data class ChannelSwitchPacket(val channelId: Byte, val silent: Boolean)
|
data class ChannelSwitchPacket(val channelId: Byte, val silent: Boolean)
|
||||||
|
|
||||||
object ChannelSwitchPacketCodec : PacketCodec<ChannelSwitchPacket>() {
|
object ChannelSwitchPacketCodec : PacketCodec<ChannelSwitchPacket>() {
|
||||||
override fun CodecScope<ChannelSwitchPacket>.body(): ChannelSwitchPacket {
|
override fun CodecScope<ChannelSwitchPacket>.body(): ChannelSwitchPacket {
|
||||||
val channelId = field(S8) { it.channelId }
|
val channelId = field(S8) { it.channelId }
|
||||||
val silent = field(Bool) { it.silent }
|
val silent = field(Bool) { it.silent }
|
||||||
return ChannelSwitchPacket(channelId, silent)
|
return ChannelSwitchPacket(channelId, silent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+32
-31
@@ -14,38 +14,39 @@ data class CharacterAppearanceApplyPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object CharacterAppearanceApplyPacketCodec : PacketCodec<CharacterAppearanceApplyPacket>() {
|
object CharacterAppearanceApplyPacketCodec : PacketCodec<CharacterAppearanceApplyPacket>() {
|
||||||
override fun CodecScope<CharacterAppearanceApplyPacket>.body(): CharacterAppearanceApplyPacket {
|
override fun CodecScope<CharacterAppearanceApplyPacket>.body(): CharacterAppearanceApplyPacket {
|
||||||
val characterName = field(Utf16LeNullTerminated) { it.characterName }
|
val characterName = field(Utf16LeNullTerminated) { it.characterName }
|
||||||
val appearanceTypeA = field(S8) { it.appearanceTypeA }
|
val appearanceTypeA = field(S8) { it.appearanceTypeA }
|
||||||
val appearanceTypeB = field(S8) { it.appearanceTypeB }
|
val appearanceTypeB = field(S8) { it.appearanceTypeB }
|
||||||
|
|
||||||
val categoryByte = field(S8) { it.creatureMoves.categoryByte }
|
val categoryByte = field(S8) { it.creatureMoves.categoryByte }
|
||||||
val bitmask =
|
val bitmask =
|
||||||
field(S16LE) {
|
field(S16LE) {
|
||||||
var m = 0
|
var m = 0
|
||||||
for (move in it.creatureMoves.moves) {
|
for (move in it.creatureMoves.moves) {
|
||||||
m = m or (1 shl move.slot)
|
m = m or (1 shl move.slot)
|
||||||
if (move.ppUp != null) m = m or 0x8000
|
if (move.ppUp != null) m = m or 0x8000
|
||||||
}
|
}
|
||||||
m.toShort()
|
m.toShort()
|
||||||
}
|
|
||||||
val mask = bitmask.toInt() and 0xFFFF
|
|
||||||
val hasPp = (mask and 0x8000) != 0
|
|
||||||
val moves = mutableListOf<AppearanceMoveEntry>()
|
|
||||||
for (slot in 0 until 15) {
|
|
||||||
if (mask and (1 shl slot) != 0) {
|
|
||||||
val packed = field(S16LE) { v -> v.creatureMoves.moves.first { it.slot == slot }.packedMove }
|
|
||||||
val pp: Byte? =
|
|
||||||
if (hasPp) field(S8) { v -> v.creatureMoves.moves.first { it.slot == slot }.ppUp ?: 0 }
|
|
||||||
else null
|
|
||||||
moves.add(AppearanceMoveEntry(slot, packed, pp))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return CharacterAppearanceApplyPacket(
|
val mask = bitmask.toInt() and 0xFFFF
|
||||||
characterName,
|
val hasPp = (mask and 0x8000) != 0
|
||||||
appearanceTypeA,
|
val moves = mutableListOf<AppearanceMoveEntry>()
|
||||||
appearanceTypeB,
|
for (slot in 0 until 15) {
|
||||||
AppearanceMoveSet(categoryByte, moves),
|
if (mask and (1 shl slot) != 0) {
|
||||||
)
|
val packed =
|
||||||
|
field(S16LE) { v -> v.creatureMoves.moves.first { it.slot == slot }.packedMove }
|
||||||
|
val pp: Byte? =
|
||||||
|
if (hasPp) field(S8) { v -> v.creatureMoves.moves.first { it.slot == slot }.ppUp ?: 0 }
|
||||||
|
else null
|
||||||
|
moves.add(AppearanceMoveEntry(slot, packed, pp))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return CharacterAppearanceApplyPacket(
|
||||||
|
characterName,
|
||||||
|
appearanceTypeA,
|
||||||
|
appearanceTypeB,
|
||||||
|
AppearanceMoveSet(categoryByte, moves),
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+35
-35
@@ -11,57 +11,57 @@ data class CharacterEntry(
|
|||||||
val guildId: Int? = null,
|
val guildId: Int? = null,
|
||||||
val pokemon: List<Pokemon>,
|
val pokemon: List<Pokemon>,
|
||||||
) {
|
) {
|
||||||
init {
|
init {
|
||||||
require(pokemon.size <= 6) { "Party size can't be more than 6 pokemon" }
|
require(pokemon.size <= 6) { "Party size can't be more than 6 pokemon" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class CharactersListPacket(val characters: List<CharacterEntry>)
|
data class CharactersListPacket(val characters: List<CharacterEntry>)
|
||||||
|
|
||||||
private val CharacterInfoAsymmetric: Codec<CharacterInfo> =
|
private val CharacterInfoAsymmetric: Codec<CharacterInfo> =
|
||||||
object : Codec<CharacterInfo> {
|
object : Codec<CharacterInfo> {
|
||||||
override fun read(buf: ReadBuffer): CharacterInfo = CharacterInfoCodecLong.read(buf)
|
override fun read(buf: ReadBuffer): CharacterInfo = CharacterInfoCodecLong.read(buf)
|
||||||
|
|
||||||
override fun write(buf: WriteBuffer, value: CharacterInfo) {
|
override fun write(buf: WriteBuffer, value: CharacterInfo) {
|
||||||
CharacterInfoCodecShort.write(buf, value)
|
CharacterInfoCodecShort.write(buf, value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private object CharacterEntryCodec : PacketCodec<CharacterEntry>() {
|
private object CharacterEntryCodec : PacketCodec<CharacterEntry>() {
|
||||||
override fun CodecScope<CharacterEntry>.body(): CharacterEntry {
|
override fun CodecScope<CharacterEntry>.body(): CharacterEntry {
|
||||||
val info = field(CharacterInfoAsymmetric, CharacterEntry::characterInfo)
|
val info = field(CharacterInfoAsymmetric, CharacterEntry::characterInfo)
|
||||||
val skin = field(DefaultSkinSetCodec, CharacterEntry::skinSet)
|
val skin = field(DefaultSkinSetCodec, CharacterEntry::skinSet)
|
||||||
field(SkinSetCodecNoLeading, CharacterEntry::skinSet)
|
field(SkinSetCodecNoLeading, CharacterEntry::skinSet)
|
||||||
val hasGuild = field(Bool) { it.guildId != null }
|
val hasGuild = field(Bool) { it.guildId != null }
|
||||||
val guildId =
|
val guildId =
|
||||||
if (hasGuild) {
|
if (hasGuild) {
|
||||||
field(Utf16LeNullTerminated) { "" }
|
field(Utf16LeNullTerminated) { "" }
|
||||||
field(S32LE) { it.guildId!! }
|
field(S32LE) { it.guildId!! }
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
val partySize = field(U8) { it.pokemon.size }
|
val partySize = field(U8) { it.pokemon.size }
|
||||||
val party = List(partySize) { field(PokemonCodec) { entry -> entry.pokemon[it] } }
|
val party = List(partySize) { field(PokemonCodec) { entry -> entry.pokemon[it] } }
|
||||||
return CharacterEntry(info, skin, guildId, party)
|
return CharacterEntry(info, skin, guildId, party)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val CharacterEntryListPrefixedU8: Codec<List<CharacterEntry>> =
|
private val CharacterEntryListPrefixedU8: Codec<List<CharacterEntry>> =
|
||||||
object : Codec<List<CharacterEntry>> {
|
object : Codec<List<CharacterEntry>> {
|
||||||
override fun read(buf: ReadBuffer): List<CharacterEntry> {
|
override fun read(buf: ReadBuffer): List<CharacterEntry> {
|
||||||
val n = U8.read(buf)
|
val n = U8.read(buf)
|
||||||
return List(n) { CharacterEntryCodec.read(buf) }
|
return List(n) { CharacterEntryCodec.read(buf) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun write(buf: WriteBuffer, value: List<CharacterEntry>) {
|
override fun write(buf: WriteBuffer, value: List<CharacterEntry>) {
|
||||||
U8.write(buf, value.size)
|
U8.write(buf, value.size)
|
||||||
value.forEach { CharacterEntryCodec.write(buf, it) }
|
value.forEach { CharacterEntryCodec.write(buf, it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object CharactersListPacketCodec : PacketCodec<CharactersListPacket>() {
|
object CharactersListPacketCodec : PacketCodec<CharactersListPacket>() {
|
||||||
override fun CodecScope<CharactersListPacket>.body() =
|
override fun CodecScope<CharactersListPacket>.body() =
|
||||||
CharactersListPacket(
|
CharactersListPacket(
|
||||||
characters = field(CharacterEntryListPrefixedU8, CharactersListPacket::characters),
|
characters = field(CharacterEntryListPrefixedU8, CharactersListPacket::characters),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
+7
-7
@@ -10,11 +10,11 @@ data class ChatChannelMessagesPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object ChatChannelMessagesPacketCodec : PacketCodec<ChatChannelMessagesPacket>() {
|
object ChatChannelMessagesPacketCodec : PacketCodec<ChatChannelMessagesPacket>() {
|
||||||
override fun CodecScope<ChatChannelMessagesPacket>.body(): ChatChannelMessagesPacket {
|
override fun CodecScope<ChatChannelMessagesPacket>.body(): ChatChannelMessagesPacket {
|
||||||
val channelType = field(S8, ChatChannelMessagesPacket::channelType)
|
val channelType = field(S8, ChatChannelMessagesPacket::channelType)
|
||||||
val clear = field(Bool, ChatChannelMessagesPacket::clear)
|
val clear = field(Bool, ChatChannelMessagesPacket::clear)
|
||||||
val refresh = field(Bool, ChatChannelMessagesPacket::refresh)
|
val refresh = field(Bool, ChatChannelMessagesPacket::refresh)
|
||||||
val messageCount = field(U16LE, ChatChannelMessagesPacket::messageCount)
|
val messageCount = field(U16LE, ChatChannelMessagesPacket::messageCount)
|
||||||
return ChatChannelMessagesPacket(channelType, clear, refresh, messageCount)
|
return ChatChannelMessagesPacket(channelType, clear, refresh, messageCount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+22
-22
@@ -18,29 +18,29 @@ data class ChatChannelUserListPacket(
|
|||||||
|
|
||||||
private val ChatChannelUserCodec: Codec<ChatChannelUser> =
|
private val ChatChannelUserCodec: Codec<ChatChannelUser> =
|
||||||
object : PacketCodec<ChatChannelUser>() {
|
object : PacketCodec<ChatChannelUser>() {
|
||||||
override fun CodecScope<ChatChannelUser>.body(): ChatChannelUser {
|
override fun CodecScope<ChatChannelUser>.body(): ChatChannelUser {
|
||||||
val channelId = field(S16LE) { it.channelId }
|
val channelId = field(S16LE) { it.channelId }
|
||||||
val rank = field(S8) { it.rank }
|
val rank = field(S8) { it.rank }
|
||||||
return ChatChannelUser(channelId, rank)
|
return ChatChannelUser(channelId, rank)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object ChatChannelUserListPacketCodec : PacketCodec<ChatChannelUserListPacket>() {
|
object ChatChannelUserListPacketCodec : PacketCodec<ChatChannelUserListPacket>() {
|
||||||
override fun CodecScope<ChatChannelUserListPacket>.body(): ChatChannelUserListPacket {
|
override fun CodecScope<ChatChannelUserListPacket>.body(): ChatChannelUserListPacket {
|
||||||
val channelType = field(S8) { it.channelType }
|
val channelType = field(S8) { it.channelType }
|
||||||
val clear = field(Bool) { it.clear }
|
val clear = field(Bool) { it.clear }
|
||||||
val refresh = field(Bool) { it.refresh }
|
val refresh = field(Bool) { it.refresh }
|
||||||
val unreadCount = if (clear) field(S32LE) { it.unreadCount } else 0
|
val unreadCount = if (clear) field(S32LE) { it.unreadCount } else 0
|
||||||
val unreadMentionCount = if (clear) field(S32LE) { it.unreadMentionCount } else 0
|
val unreadMentionCount = if (clear) field(S32LE) { it.unreadMentionCount } else 0
|
||||||
val count = field(S16LE) { it.users.size.toShort() }.toInt() and 0xFFFF
|
val count = field(S16LE) { it.users.size.toShort() }.toInt() and 0xFFFF
|
||||||
val users = (0 until count).map { i -> field(ChatChannelUserCodec) { it.users[i] } }
|
val users = (0 until count).map { i -> field(ChatChannelUserCodec) { it.users[i] } }
|
||||||
return ChatChannelUserListPacket(
|
return ChatChannelUserListPacket(
|
||||||
channelType = channelType,
|
channelType = channelType,
|
||||||
clear = clear,
|
clear = clear,
|
||||||
refresh = refresh,
|
refresh = refresh,
|
||||||
unreadCount = unreadCount,
|
unreadCount = unreadCount,
|
||||||
unreadMentionCount = unreadMentionCount,
|
unreadMentionCount = unreadMentionCount,
|
||||||
users = users,
|
users = users,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6
-6
@@ -12,10 +12,10 @@ data class ChatLocalePreferencesPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object ChatLocalePreferencesPacketCodec : PacketCodec<ChatLocalePreferencesPacket>() {
|
object ChatLocalePreferencesPacketCodec : PacketCodec<ChatLocalePreferencesPacket>() {
|
||||||
override fun CodecScope<ChatLocalePreferencesPacket>.body(): ChatLocalePreferencesPacket {
|
override fun CodecScope<ChatLocalePreferencesPacket>.body(): ChatLocalePreferencesPacket {
|
||||||
val languageId = field(S8) { it.languageId }
|
val languageId = field(S8) { it.languageId }
|
||||||
val chatChannelMask = field(S16LE) { it.chatChannelMask }
|
val chatChannelMask = field(S16LE) { it.chatChannelMask }
|
||||||
val languageFilterMask = field(S16LE) { it.languageFilterMask }
|
val languageFilterMask = field(S16LE) { it.languageFilterMask }
|
||||||
return ChatLocalePreferencesPacket(languageId, chatChannelMask, languageFilterMask)
|
return ChatLocalePreferencesPacket(languageId, chatChannelMask, languageFilterMask)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+30
-30
@@ -12,35 +12,35 @@ data class ChatMessagePacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object ChatMessagePacketCodec : PacketCodec<ChatMessagePacket>() {
|
object ChatMessagePacketCodec : PacketCodec<ChatMessagePacket>() {
|
||||||
override fun CodecScope<ChatMessagePacket>.body(): ChatMessagePacket {
|
override fun CodecScope<ChatMessagePacket>.body(): ChatMessagePacket {
|
||||||
val type = ChatType.entries[field(U8) { it.type.ordinal }]
|
val type = ChatType.entries[field(U8) { it.type.ordinal }]
|
||||||
return if (type == ChatType.TEAM) {
|
return if (type == ChatType.TEAM) {
|
||||||
ChatMessagePacket(
|
ChatMessagePacket(
|
||||||
type = type,
|
type = type,
|
||||||
language = null,
|
language = null,
|
||||||
message = field(Utf16LeNullTerminated, ChatMessagePacket::message),
|
message = field(Utf16LeNullTerminated, ChatMessagePacket::message),
|
||||||
sender = null,
|
sender = null,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
field(S64LE) { 0L }
|
field(S64LE) { 0L }
|
||||||
val sender =
|
val sender =
|
||||||
field(Utf16LeNullTerminated) {
|
field(Utf16LeNullTerminated) {
|
||||||
it.sender ?: throw MalformedPacketException("sender must not be null")
|
it.sender ?: throw MalformedPacketException("sender must not be null")
|
||||||
}
|
}
|
||||||
val language =
|
val language =
|
||||||
Language.entries[
|
Language.entries[
|
||||||
field(U8) {
|
field(U8) {
|
||||||
(it.language ?: throw MalformedPacketException("language must not be null"))
|
(it.language ?: throw MalformedPacketException("language must not be null"))
|
||||||
.ordinal
|
.ordinal
|
||||||
}]
|
}]
|
||||||
field(S8) { -1 }
|
field(S8) { -1 }
|
||||||
val message = field(Utf16LeNullTerminated, ChatMessagePacket::message)
|
val message = field(Utf16LeNullTerminated, ChatMessagePacket::message)
|
||||||
ChatMessagePacket(
|
ChatMessagePacket(
|
||||||
type = type,
|
type = type,
|
||||||
language = language,
|
language = language,
|
||||||
message = message,
|
message = message,
|
||||||
sender = sender,
|
sender = sender,
|
||||||
)
|
)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+6
-7
@@ -12,11 +12,10 @@ data class ChatMessageSendPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object ChatMessageSendPacketCodec : PacketCodec<ChatMessageSendPacket>() {
|
object ChatMessageSendPacketCodec : PacketCodec<ChatMessageSendPacket>() {
|
||||||
override fun CodecScope<ChatMessageSendPacket>.body(): ChatMessageSendPacket {
|
override fun CodecScope<ChatMessageSendPacket>.body(): ChatMessageSendPacket {
|
||||||
val mode = field(S8) { it.mode }
|
val mode = field(S8) { it.mode }
|
||||||
val target = field(Utf16LeNullTerminated) { it.target }
|
val target = field(Utf16LeNullTerminated) { it.target }
|
||||||
val message =
|
val message = if (mode.toInt() == 4) field(Utf16LeNullTerminated) { it.message ?: "" } else null
|
||||||
if (mode.toInt() == 4) field(Utf16LeNullTerminated) { it.message ?: "" } else null
|
return ChatMessageSendPacket(mode, target, message)
|
||||||
return ChatMessageSendPacket(mode, target, message)
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+4
-4
@@ -9,8 +9,8 @@ data class ChatMessageWithdrawPacket(
|
|||||||
)
|
)
|
||||||
|
|
||||||
object ChatMessageWithdrawPacketCodec : PacketCodec<ChatMessageWithdrawPacket>() {
|
object ChatMessageWithdrawPacketCodec : PacketCodec<ChatMessageWithdrawPacket>() {
|
||||||
override fun CodecScope<ChatMessageWithdrawPacket>.body(): ChatMessageWithdrawPacket {
|
override fun CodecScope<ChatMessageWithdrawPacket>.body(): ChatMessageWithdrawPacket {
|
||||||
val authorId = field(S64LE) { it.authorId }
|
val authorId = field(S64LE) { it.authorId }
|
||||||
return ChatMessageWithdrawPacket(authorId)
|
return ChatMessageWithdrawPacket(authorId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+25
-25
@@ -9,33 +9,33 @@ data class ChunkedImagePacket(
|
|||||||
val last: Boolean?,
|
val last: Boolean?,
|
||||||
val data: ByteArray?,
|
val data: ByteArray?,
|
||||||
) {
|
) {
|
||||||
override fun equals(other: Any?): Boolean =
|
override fun equals(other: Any?): Boolean =
|
||||||
other is ChunkedImagePacket &&
|
other is ChunkedImagePacket &&
|
||||||
controlType == other.controlType &&
|
controlType == other.controlType &&
|
||||||
imageType == other.imageType &&
|
imageType == other.imageType &&
|
||||||
chunkIndex == other.chunkIndex &&
|
chunkIndex == other.chunkIndex &&
|
||||||
last == other.last &&
|
last == other.last &&
|
||||||
(if (data == null) other.data == null
|
(if (data == null) other.data == null
|
||||||
else other.data != null && data.contentEquals(other.data))
|
else other.data != null && data.contentEquals(other.data))
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
var r = controlType.toInt()
|
var r = controlType.toInt()
|
||||||
r = r * 31 + (imageType?.toInt() ?: 0)
|
r = r * 31 + (imageType?.toInt() ?: 0)
|
||||||
r = r * 31 + (chunkIndex ?: 0)
|
r = r * 31 + (chunkIndex ?: 0)
|
||||||
r = r * 31 + (last?.hashCode() ?: 0)
|
r = r * 31 + (last?.hashCode() ?: 0)
|
||||||
r = r * 31 + (data?.contentHashCode() ?: 0)
|
r = r * 31 + (data?.contentHashCode() ?: 0)
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object ChunkedImagePacketCodec : PacketCodec<ChunkedImagePacket>() {
|
object ChunkedImagePacketCodec : PacketCodec<ChunkedImagePacket>() {
|
||||||
override fun CodecScope<ChunkedImagePacket>.body(): ChunkedImagePacket {
|
override fun CodecScope<ChunkedImagePacket>.body(): ChunkedImagePacket {
|
||||||
val controlType = field(S8) { it.controlType }
|
val controlType = field(S8) { it.controlType }
|
||||||
val present = controlType.toInt() != 2
|
val present = controlType.toInt() != 2
|
||||||
val imageType = if (present) field(S8) { it.imageType!! } else null
|
val imageType = if (present) field(S8) { it.imageType!! } else null
|
||||||
val chunkIndex = if (present) field(U8) { it.chunkIndex!! } else null
|
val chunkIndex = if (present) field(U8) { it.chunkIndex!! } else null
|
||||||
val last = if (present) field(U8) { if (it.last!!) 1 else 0 } == 1 else null
|
val last = if (present) field(U8) { if (it.last!!) 1 else 0 } == 1 else null
|
||||||
val data = if (present) field(bytesPrefixed(U16LE)) { it.data!! } else null
|
val data = if (present) field(bytesPrefixed(U16LE)) { it.data!! } else null
|
||||||
return ChunkedImagePacket(controlType, imageType, chunkIndex, last, data)
|
return ChunkedImagePacket(controlType, imageType, chunkIndex, last, data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+7
-7
@@ -8,15 +8,15 @@ import de.fiereu.bytecodec.bytesPrefixed
|
|||||||
data class ChunkedTransferAppendPacket(
|
data class ChunkedTransferAppendPacket(
|
||||||
val data: ByteArray,
|
val data: ByteArray,
|
||||||
) {
|
) {
|
||||||
override fun equals(other: Any?): Boolean =
|
override fun equals(other: Any?): Boolean =
|
||||||
other is ChunkedTransferAppendPacket && data.contentEquals(other.data)
|
other is ChunkedTransferAppendPacket && data.contentEquals(other.data)
|
||||||
|
|
||||||
override fun hashCode(): Int = data.contentHashCode()
|
override fun hashCode(): Int = data.contentHashCode()
|
||||||
}
|
}
|
||||||
|
|
||||||
object ChunkedTransferAppendPacketCodec : PacketCodec<ChunkedTransferAppendPacket>() {
|
object ChunkedTransferAppendPacketCodec : PacketCodec<ChunkedTransferAppendPacket>() {
|
||||||
override fun CodecScope<ChunkedTransferAppendPacket>.body(): ChunkedTransferAppendPacket {
|
override fun CodecScope<ChunkedTransferAppendPacket>.body(): ChunkedTransferAppendPacket {
|
||||||
val data = field(bytesPrefixed(U16LE)) { it.data }
|
val data = field(bytesPrefixed(U16LE)) { it.data }
|
||||||
return ChunkedTransferAppendPacket(data)
|
return ChunkedTransferAppendPacket(data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+17
-17
@@ -7,25 +7,25 @@ data class ChunkedTransferBeginPacket(
|
|||||||
val totalSize: Int,
|
val totalSize: Int,
|
||||||
val data: ByteArray,
|
val data: ByteArray,
|
||||||
) {
|
) {
|
||||||
override fun equals(other: Any?): Boolean =
|
override fun equals(other: Any?): Boolean =
|
||||||
other is ChunkedTransferBeginPacket &&
|
other is ChunkedTransferBeginPacket &&
|
||||||
transferId == other.transferId &&
|
transferId == other.transferId &&
|
||||||
totalSize == other.totalSize &&
|
totalSize == other.totalSize &&
|
||||||
data.contentEquals(other.data)
|
data.contentEquals(other.data)
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
var r = transferId.hashCode()
|
var r = transferId.hashCode()
|
||||||
r = r * 31 + totalSize
|
r = r * 31 + totalSize
|
||||||
r = r * 31 + data.contentHashCode()
|
r = r * 31 + data.contentHashCode()
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object ChunkedTransferBeginPacketCodec : PacketCodec<ChunkedTransferBeginPacket>() {
|
object ChunkedTransferBeginPacketCodec : PacketCodec<ChunkedTransferBeginPacket>() {
|
||||||
override fun CodecScope<ChunkedTransferBeginPacket>.body(): ChunkedTransferBeginPacket {
|
override fun CodecScope<ChunkedTransferBeginPacket>.body(): ChunkedTransferBeginPacket {
|
||||||
val transferId = field(S64LE) { it.transferId }
|
val transferId = field(S64LE) { it.transferId }
|
||||||
val totalSize = field(S32LE) { it.totalSize }
|
val totalSize = field(S32LE) { it.totalSize }
|
||||||
val data = field(bytesPrefixed(U16LE)) { it.data }
|
val data = field(bytesPrefixed(U16LE)) { it.data }
|
||||||
return ChunkedTransferBeginPacket(transferId, totalSize, data)
|
return ChunkedTransferBeginPacket(transferId, totalSize, data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+27
-27
@@ -7,40 +7,40 @@ data class ChunkedTransferDataPacket(
|
|||||||
val totalSize: Int,
|
val totalSize: Int,
|
||||||
val chunkData: ByteArray,
|
val chunkData: ByteArray,
|
||||||
) {
|
) {
|
||||||
override fun equals(other: Any?): Boolean =
|
override fun equals(other: Any?): Boolean =
|
||||||
other is ChunkedTransferDataPacket &&
|
other is ChunkedTransferDataPacket &&
|
||||||
transferId == other.transferId &&
|
transferId == other.transferId &&
|
||||||
totalSize == other.totalSize &&
|
totalSize == other.totalSize &&
|
||||||
chunkData.contentEquals(other.chunkData)
|
chunkData.contentEquals(other.chunkData)
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
var r = transferId.hashCode()
|
var r = transferId.hashCode()
|
||||||
r = r * 31 + totalSize
|
r = r * 31 + totalSize
|
||||||
r = r * 31 + chunkData.contentHashCode()
|
r = r * 31 + chunkData.contentHashCode()
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val ChunkBytes: Codec<ByteArray> =
|
private val ChunkBytes: Codec<ByteArray> =
|
||||||
object : Codec<ByteArray> {
|
object : Codec<ByteArray> {
|
||||||
override fun read(buf: ReadBuffer): ByteArray {
|
override fun read(buf: ReadBuffer): ByteArray {
|
||||||
val length = S16LE.read(buf).toInt()
|
val length = S16LE.read(buf).toInt()
|
||||||
val data = ByteArray(length)
|
val data = ByteArray(length)
|
||||||
if (length > 0) buf.readBytes(data)
|
if (length > 0) buf.readBytes(data)
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun write(buf: WriteBuffer, value: ByteArray) {
|
override fun write(buf: WriteBuffer, value: ByteArray) {
|
||||||
S16LE.write(buf, value.size.toShort())
|
S16LE.write(buf, value.size.toShort())
|
||||||
if (value.isNotEmpty()) buf.writeBytes(value)
|
if (value.isNotEmpty()) buf.writeBytes(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object ChunkedTransferDataPacketCodec : PacketCodec<ChunkedTransferDataPacket>() {
|
object ChunkedTransferDataPacketCodec : PacketCodec<ChunkedTransferDataPacket>() {
|
||||||
override fun CodecScope<ChunkedTransferDataPacket>.body(): ChunkedTransferDataPacket {
|
override fun CodecScope<ChunkedTransferDataPacket>.body(): ChunkedTransferDataPacket {
|
||||||
val transferId = field(S64LE) { it.transferId }
|
val transferId = field(S64LE) { it.transferId }
|
||||||
val totalSize = field(S32LE) { it.totalSize }
|
val totalSize = field(S32LE) { it.totalSize }
|
||||||
val chunkData = field(ChunkBytes) { it.chunkData }
|
val chunkData = field(ChunkBytes) { it.chunkData }
|
||||||
return ChunkedTransferDataPacket(transferId, totalSize, chunkData)
|
return ChunkedTransferDataPacket(transferId, totalSize, chunkData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+35
-35
@@ -8,50 +8,50 @@ data class ClientCookieUpdatePacket(
|
|||||||
val blob: ByteArray?,
|
val blob: ByteArray?,
|
||||||
val namedValues: List<CookieNamedValue>?,
|
val namedValues: List<CookieNamedValue>?,
|
||||||
) {
|
) {
|
||||||
override fun equals(other: Any?): Boolean {
|
override fun equals(other: Any?): Boolean {
|
||||||
if (other !is ClientCookieUpdatePacket) return false
|
if (other !is ClientCookieUpdatePacket) return false
|
||||||
if (namedValues != other.namedValues) return false
|
if (namedValues != other.namedValues) return false
|
||||||
if (blob == null) return other.blob == null
|
if (blob == null) return other.blob == null
|
||||||
return other.blob != null && blob.contentEquals(other.blob)
|
return other.blob != null && blob.contentEquals(other.blob)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
var r = blob?.contentHashCode() ?: 0
|
var r = blob?.contentHashCode() ?: 0
|
||||||
r = r * 31 + (namedValues?.hashCode() ?: 0)
|
r = r * 31 + (namedValues?.hashCode() ?: 0)
|
||||||
return r
|
return r
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val CookieBlob = bytesPrefixed(U8)
|
private val CookieBlob = bytesPrefixed(U8)
|
||||||
|
|
||||||
private val CookieNamedValueCodec: Codec<CookieNamedValue> =
|
private val CookieNamedValueCodec: Codec<CookieNamedValue> =
|
||||||
(S8.then(Utf16LeNullTerminated)).let { pair ->
|
(S8.then(Utf16LeNullTerminated)).let { pair ->
|
||||||
object : Codec<CookieNamedValue> {
|
object : Codec<CookieNamedValue> {
|
||||||
override fun read(buf: de.fiereu.bytecodec.ReadBuffer): CookieNamedValue {
|
override fun read(buf: de.fiereu.bytecodec.ReadBuffer): CookieNamedValue {
|
||||||
val (k, v) = pair.read(buf)
|
val (k, v) = pair.read(buf)
|
||||||
return CookieNamedValue(k, v)
|
return CookieNamedValue(k, v)
|
||||||
}
|
|
||||||
|
|
||||||
override fun write(buf: de.fiereu.bytecodec.WriteBuffer, value: CookieNamedValue) {
|
|
||||||
pair.write(buf, value.key to value.value)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun write(buf: de.fiereu.bytecodec.WriteBuffer, value: CookieNamedValue) {
|
||||||
|
pair.write(buf, value.key to value.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
object ClientCookieUpdatePacketCodec : PacketCodec<ClientCookieUpdatePacket>() {
|
object ClientCookieUpdatePacketCodec : PacketCodec<ClientCookieUpdatePacket>() {
|
||||||
override fun CodecScope<ClientCookieUpdatePacket>.body(): ClientCookieUpdatePacket {
|
override fun CodecScope<ClientCookieUpdatePacket>.body(): ClientCookieUpdatePacket {
|
||||||
val flags =
|
val flags =
|
||||||
field(S8) {
|
field(S8) {
|
||||||
var f = 0
|
var f = 0
|
||||||
if (it.blob != null) f = f or 1
|
if (it.blob != null) f = f or 1
|
||||||
if (it.namedValues != null) f = f or 2
|
if (it.namedValues != null) f = f or 2
|
||||||
f.toByte()
|
f.toByte()
|
||||||
}
|
}
|
||||||
val blob: ByteArray? = if (flags.toInt() and 1 != 0) field(CookieBlob) { it.blob!! } else null
|
val blob: ByteArray? = if (flags.toInt() and 1 != 0) field(CookieBlob) { it.blob!! } else null
|
||||||
val namedValues: List<CookieNamedValue>? =
|
val namedValues: List<CookieNamedValue>? =
|
||||||
if (flags.toInt() and 2 != 0)
|
if (flags.toInt() and 2 != 0)
|
||||||
field(CookieNamedValueCodec.listPrefixed(U8)) { it.namedValues!! }
|
field(CookieNamedValueCodec.listPrefixed(U8)) { it.namedValues!! }
|
||||||
else null
|
else null
|
||||||
return ClientCookieUpdatePacket(blob, namedValues)
|
return ClientCookieUpdatePacket(blob, namedValues)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loaded 100 of 382 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user