Files
hsmod/PROTOCOL-NOTES.md
T

5.7 KiB

Protocol Notes

Opcode Decoder Map (Client)

Source: hs-client/Assembly-CSharp/ConnectAPI.cs.

  • 116PongPacketDecoder
  • 169Deadend
  • 167DeadendUtil
  • 123DebugConsoleCommand
  • 124DebugConsoleResponse
  • 14AllOptions
  • 5DebugMessage
  • 17EntityChoices
  • 13EntitiesChosen
  • 16GameSetup
  • 19PowerHistory
  • 15UserUI
  • 9TurnTimer
  • 10NAckOption
  • 12GameCanceled
  • 23ServerResult
  • 24SpectatorNotify
  • 289Disconnected
  • 202DeckList
  • 207Collection
  • 215GetDeckContentsResponse
  • 216DBAction
  • 217DeckCreated
  • 218DeckDeleted
  • 219DeckRenamed
  • 212ProfileNotices
  • 224BoosterList
  • 226BoosterContent
  • 208GamesInfo
  • 231ProfileDeckLimit
  • 262ArcaneDustBalance
  • 278GoldBalance
  • 233ProfileProgress
  • 270PlayerRecords
  • 271RewardProgress
  • 232MedalInfo
  • 241ClientOptions
  • 246DraftBeginning
  • 247DraftRetired
  • 248DraftChoicesAndContents
  • 249DraftChosen
  • 288DraftRewardsAcked
  • 251DraftError
  • 252Achieves
  • 285ValidateAchieveResponse
  • 282CancelQuestResponse
  • 264GuardianVars
  • 260CardValues
  • 258BoughtSoldCard
  • 269MassDisenchantResponse
  • 265BattlePayStatusResponse
  • 295ThirdPartyPurchaseStatusResponse
  • 272PurchaseMethod
  • 275CancelPurchaseResponse
  • 256PurchaseResponse
  • 238BattlePayConfigResponse
  • 280PurchaseWithGoldResponse
  • 283HeroXP
  • 254NoOpPacketDecoder
  • 286PlayQueue
  • 330CheckAccountLicensesResponse
  • 331CheckGameLicensesResponse
  • 236CardBacks
  • 292SetCardBackResponse
  • 296SetProgressResponse
  • 299TriggerEventResponse
  • 300NotSoMassiveLoginReply
  • 304AssetsVersionResponse
  • 306AdventureProgressResponse
  • 307UpdateLoginComplete
  • 311AccountLicenseAchieveResponse
  • 315SubscribeResponse
  • 316TavernBrawlInfo
  • 317TavernBrawlPlayerRecordResponse
  • 318FavoriteHeroesResponse
  • 320SetFavoriteHeroResponse
  • 324DebugCommandResponse
  • 325AccountLicensesInfoResponse
  • 326GenericResponse
  • 328ClientRequestResponse
  • 322GetAssetResponse

Opcode Encoder Map (Client → Server)

Game server outbound (QueueGamePacket):

  • 22SpectatorHandshake
  • 168Handshake
  • 1GetGameState
  • 115Ping
  • 11Concede
  • 3ChooseEntities
  • 2ChooseOption
  • 15UserUI (emote + mouse)
  • 25InviteToSpectate
  • 26RemoveSpectators
  • 123DebugConsoleCommand

Debug console outbound (QueueDebugPacket):

  • 124DebugConsoleResponse

Util server outbound (ClientRequestManager/UtilOutbound):

  • 319SetFavoriteHero
  • 279PurchaseWithGold
  • 312StartThirdPartyPurchase
  • 293SubmitThirdPartyReceipt
  • 294GetThirdPartyPurchaseStatus
  • 250GetPurchaseMethod
  • 273DoPurchase
  • 274CancelPurchase
  • 237GetBattlePayConfig
  • 255GetBattlePayStatus
  • 268MassDisenchantRequest
  • 235DraftBegin
  • 242DraftRetire
  • 287DraftAckRewards
  • 244DraftGetPicksAndContents
  • 245DraftMakePick
  • 201GetAccountInfo
  • 327GenericRequestList
  • 205UpdateLogin
  • 214GetDeckContents
  • 209CreateDeck
  • 210DeleteDeck
  • 211RenameDeck
  • 332DeckSetTemplateSource
  • 222DeckSetData
  • 213AckNotice
  • 225OpenBooster
  • 230SetProgress
  • 298TriggerLaunchDayEvent
  • 303GetAssetsVersion
  • 308AckWingProgress
  • 309AcknowledgeBanner
  • 310SetAdventureOptions
  • 223AckCardSeen
  • 240GetOptions
  • 239SetOptions
  • 253GetAchieves
  • 284ValidateAchieve
  • 281CancelQuest
  • 243AckAchieveProgress
  • 297CheckAccountLicenseAchieve
  • 305GetAdventureProgress
  • 257BuySellCard
  • 267CheckAccountLicenses
  • 276CheckGameLicenses
  • 291SetCardBack
  • 321GetAssetRequest
  • 329Unsubscribe
  • 322DebugCommandRequest

Learnings

  • Client maintains deferred response maps for async requests in Network.cs.
  • Opcode map is a key compatibility anchor for the Go gateway.

Protobuf Definitions (Source)

The repo does not contain the protobuf class definitions for most message types. They live in the client assemblies that were not decompiled here. To generate Go structs, extract .proto from the client install:

  • PegasusGame.dll (game server packets)
  • PegasusUtil.dll (utility/account/collection packets)
  • SpectatorProto.dll (spectator packets)
  • BobNetProto.dll (misc/legacy)
  • PegasusShared.dll (shared types: CardDef, BnetId, enums)

Suggested mapping (verify by decompiling those DLLs):

  • PegasusGame: GameSetup, PowerHistory, EntityChoices, EntitiesChosen, UserUI, TurnTimer, NAckOption, GameCanceled, ServerResult, Disconnected, Handshake, GetGameState, Ping, Concede, ChooseEntities, ChooseOption.
  • SpectatorProto: SpectatorHandshake, SpectatorNotify, InviteToSpectate, RemoveSpectators.
  • PegasusUtil: everything in the decoder/encoder maps that relates to collection, login, decks, purchases, achievements, and assets (most of the UtilOutbound messages).
  • BobNetProto: Deadend, DeadendUtil (verify).