Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

530 lines
12 KiB

  1. //====== Copyright (C), Valve Corporation, All rights reserved. =======
  2. //
  3. // Purpose: This file defines all of our over-the-wire net protocols for the
  4. // Game Coordinator for the item system. Note that we never use types
  5. // with undefined length (like int). Always use an explicit type
  6. // (like int32).
  7. //
  8. //=============================================================================
  9. #ifndef ITEM_GCMESSAGES_H
  10. #define ITEM_GCMESSAGES_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. #pragma pack( push, 1 )
  15. // generic zero-length message struct
  16. struct MsgGCEmpty_t
  17. {
  18. };
  19. // k_EMsgGCSetItemPosition
  20. struct MsgGCSetItemPosition_t
  21. {
  22. uint64 m_unItemID;
  23. uint32 m_unNewPosition;
  24. };
  25. // k_EMsgGCCraft
  26. struct MsgGCCraft_t
  27. {
  28. int16 m_nRecipeDefIndex;
  29. uint16 m_nItemCount;
  30. // list of m_nItemCount uint64 item IDs
  31. };
  32. // k_EMsgGCDelete
  33. struct MsgGCDelete_t
  34. {
  35. uint64 m_unItemID;
  36. bool m_bRecycle;
  37. };
  38. // k_EMsgGCCraftResponse
  39. struct MsgGCStandardResponse_t
  40. {
  41. int16 m_nResponseIndex;
  42. uint32 m_eResponse;
  43. };
  44. // k_EMsgGCVerifyCacheSubscription
  45. struct MsgGCVerifyCacheSubscription_t
  46. {
  47. uint64 m_ulSteamID;
  48. };
  49. // k_EMsgGCNameItem
  50. struct MsgGCNameItem_t
  51. {
  52. uint64 m_unToolItemID; // the Nametag item
  53. uint64 m_unSubjectItemID; // the item to be renamed
  54. bool m_bDescription;
  55. // Varchar: Item name
  56. };
  57. // k_EMsgGCNameBaseItem
  58. struct MsgGCNameBaseItem_t
  59. {
  60. uint64 m_unToolItemID; // the Nametag item
  61. uint32 m_unBaseItemDefinitionID; // the base item definition to be renamed
  62. bool m_bDescription;
  63. // Varchar: Item name
  64. };
  65. // k_EMsgGCUnlockCrate
  66. struct MsgGCUnlockCrate_t
  67. {
  68. uint64 m_unToolItemID; // the crate key
  69. uint64 m_unSubjectItemID; // the crate to be decoded
  70. };
  71. // k_EMsgGCPaintItem
  72. struct MsgGCPaintItem_t
  73. {
  74. uint64 m_unToolItemID; // the Paint Can item
  75. uint64 m_unSubjectItemID; // the item to be painted
  76. bool m_bUnusualPaint; // the paint event is unusual paint
  77. };
  78. // k_EMsgGCPaintKitItem
  79. struct MsgGCPaintKitItem_t
  80. {
  81. uint64 m_unToolItemID; // the Paint Kit item
  82. uint64 m_unSubjectItemID; // the item to be painted
  83. bool m_bUnusualPaint; // the paint event is unusual paint
  84. };
  85. // k_EMsgGCPaintKitBaseItem
  86. struct MsgGCPaintKitBaseItem_t
  87. {
  88. uint64 m_unToolItemID; // the Paint Kit item
  89. uint32 m_unBaseItemDefinitionID; // the base item definition to be painted
  90. };
  91. // k_EMsgGCPaintKitBaseItem
  92. struct MsgGCDev_PaintKitItemDrop_t
  93. {
  94. uint32 m_unPaintID; // the Paint Kit ID
  95. uint32 m_unBaseItemDefinitionID; // the base item definition to be painted
  96. int m_nStrangeType;
  97. };
  98. // k_EMsgGCGiftWrapItem
  99. struct MsgGCGiftWrapItem_t
  100. {
  101. uint64 m_unToolItemID; // the Gift Wrap item
  102. uint64 m_unSubjectItemID; // the item to be wrapped
  103. };
  104. // k_EMsgGCDeliverGift
  105. struct MsgGCDeliverGift_t
  106. {
  107. uint64 m_unGiftID;
  108. uint64 m_ulGiverSteamID;
  109. uint64 m_ulTargetSteamID;
  110. };
  111. // k_EMsgGCUnwrapGiftRequest
  112. struct MsgGCUnwrapGiftRequest_t
  113. {
  114. uint64 m_unItemID;
  115. };
  116. // k_EMsgGCMOTDRequest
  117. struct MsgGCMOTDRequest_t
  118. {
  119. RTime32 m_nLastMOTDRequest; // Time at which the client last asked for MOTDs. GC will send back all MOTDs posted since.
  120. int16 m_eLanguage;
  121. };
  122. // k_EMsgGCMOTDRequestResponse
  123. struct MsgGCMOTDRequestResponse_t
  124. {
  125. int16 m_nEntries;
  126. };
  127. // k_EMsgGCCustomizeItemTexture
  128. struct MsgGCCustomizeItemTexture_t
  129. {
  130. uint64 m_unToolItemID; // the tool
  131. uint64 m_unSubjectItemID; // the item wants the texture
  132. uint64 m_unImageUGCHandle; // cloud ID of image file (UGCHandle_t)
  133. };
  134. // k_EMsgGCSetItemStyle
  135. struct MsgGCSetItemStyle_t
  136. {
  137. uint64 m_unItemID;
  138. uint8 m_iStyle;
  139. };
  140. // k_EMsgGCUnlockItemStyle
  141. struct MsgGCUnlockItemStyle_t
  142. {
  143. uint64 m_unItemID;
  144. uint8 m_iStyle;
  145. };
  146. // k_EMsgGCUnlockItemStyleResponse
  147. struct MsgGCUnlockItemStyleResponse_t
  148. {
  149. uint64 m_unItemID;
  150. uint8 m_iStyle;
  151. uint8 m_iStylePreReq;
  152. uint8 m_iResult;
  153. };
  154. // k_EMsgGCItemPreviewCheckStatus
  155. struct MsgGCCheckItemPreviewStatus_t
  156. {
  157. uint32 m_unItemDefIndex;
  158. };
  159. // k_EMsgGCItemPreviewCheckStatusResponse
  160. struct MsgGCItemPreviewCheckStatusResponse_t
  161. {
  162. uint32 m_unItemDefIndex;
  163. uint32 m_eResponse;
  164. RTime32 m_timePreviewTime;
  165. };
  166. // k_EMsgGCItemPreviewRequest
  167. struct MsgGCItemPreviewRequest_t
  168. {
  169. uint32 m_unItemDefIndex;
  170. };
  171. // k_EMsgGCItemPreviewRequestResponse
  172. struct MsgGCItemPreviewRequestResponse_t
  173. {
  174. uint32 m_unItemDefIndex;
  175. uint32 m_eResponse;
  176. };
  177. // k_EMsgGCItemPreviewExpireNotification
  178. struct MsgGCItemPreviewExpireNotification_t
  179. {
  180. uint32 m_unItemDefIndex;
  181. };
  182. // k_EMsgGCItemPreviewItemBoughtNotification
  183. struct MsgGCItemPreviewItemBoughtNotification_t
  184. {
  185. uint32 m_unItemDefIndex;
  186. };
  187. //-----------------------------------------------------------------------------
  188. // k_EMsgGCUseItemResponse
  189. enum EGCMsgUseItemResponse
  190. {
  191. k_EGCMsgUseItemResponse_ItemUsed = 0,
  192. k_EGCMsgUseItemResponse_GiftNoOtherPlayers = 1,
  193. k_EGCMsgUseItemResponse_ServerError = 2,
  194. k_EGCMsgUseItemResponse_MiniGameAlreadyStarted = 3,
  195. k_EGCMsgUseItemResponse_ItemUsed_ItemsGranted = 4,
  196. k_EGCMsgUseItemResponse_DropRateBonusAlreadyGranted = 5,
  197. k_EGCMsgUseItemResponse_NotInLowPriorityPool = 6,
  198. k_EGCMsgUseItemResponse_ForceSizeInt = 0x7FFFFFFF
  199. };
  200. // k_EMsgGCUseItemResponse
  201. struct MsgGCUseItemResponse_t
  202. {
  203. uint32 m_eResponse;
  204. uint32 m_unDefIndex;
  205. };
  206. // DEPRECATED : k_EMsgGCGiftedItems_DEPRECATED
  207. // struct MsgGCGiftedItems_t
  208. // {
  209. // uint64 m_ulGifterSteamID;
  210. // bool m_bRandomPerson;
  211. // uint8 m_unNumGiftRecipients;
  212. // // other data dynamically added:
  213. // // steam ids of all the recipients
  214. // };
  215. // k_EMsgGCRemoveItemName
  216. struct MsgGCRemoveItemName_t
  217. {
  218. uint64 m_unItemID;
  219. bool m_bDescription;
  220. };
  221. // k_EMsgGCRemoveItemPaint
  222. struct MsgGCRemoveItemPaint_t
  223. {
  224. uint64 m_unItemID;
  225. };
  226. // MsgGCRemoveItemCustomTexture_t
  227. struct MsgGCRemoveItemCustomTexture_t
  228. {
  229. uint64 m_unItemID;
  230. };
  231. // MsgGCRemoveItemMakersMark_t
  232. struct MsgGCRemoveItemMakersMark_t
  233. {
  234. uint64 m_unItemID;
  235. };
  236. // MsgGCRemoveItemUniqueCraftIndex_t
  237. struct MsgGCRemoveItemUniqueCraftIndex_t
  238. {
  239. uint64 m_unItemID;
  240. };
  241. // k_EMsgGCApplyConsumableEffects
  242. struct MsgGCApplyConsumableEffects_t
  243. {
  244. uint64 m_ulInitiatorSteamID;
  245. uint32 m_unItemDefinitionID;
  246. };
  247. //-----------------------------------------------------------------------------
  248. // Trading
  249. // k_EMsgGCTrading_InitiateTradeRequest
  250. struct MsgGCTrading_InitiateTradeRequest_t
  251. {
  252. uint32 m_unTradeRequestID;
  253. uint64 m_ulOtherSteamID;
  254. // @note player A's name as string when sent to party B
  255. };
  256. enum EGCMsgInitiateTradeResponse
  257. {
  258. k_EGCMsgInitiateTradeResponse_Accepted = 0,
  259. k_EGCMsgInitiateTradeResponse_Declined = 1,
  260. k_EGCMsgInitiateTradeResponse_VAC_Banned_Initiator = 2,
  261. k_EGCMsgInitiateTradeResponse_VAC_Banned_Target = 3,
  262. k_EGCMsgInitiateTradeResponse_Target_Already_Trading = 4,
  263. k_EGCMsgInitiateTradeResponse_Disabled = 5,
  264. k_EGCMsgInitiateTradeResponse_NotLoggedIn = 6,
  265. k_EGCMsgInitiateTradeResponse_Cancel = 7,
  266. k_EGCMsgInitiateTradeResponse_TooSoon = 8,
  267. k_EGCMsgInitiateTradeResponse_TooSoonPenalty = 9,
  268. k_EGCMsgInitiateTradeResponse_Trade_Banned_Initiator = 10,
  269. k_EGCMsgInitiateTradeResponse_Trade_Banned_Target = 11,
  270. k_EGCMsgInitiateTradeResponse_Free_Account_Initiator_DEPRECATED = 12, // free accounts can initiate trades now
  271. k_EGCMsgInitiateTradeResponse_Shared_Account_Initiator= 13,
  272. k_EGCMsgInitiateTradeResponse_Service_Unavailable = 14,
  273. k_EGCMsgInitiateTradeResponse_Count,
  274. k_EGCMsgInitiateTradeResponse_ForceSizeInt = 0x7FFFFFFF
  275. };
  276. // k_EMsgGCTrading_InitiateTradeResponse
  277. struct MsgGCTrading_InitiateTradeResponse_t
  278. {
  279. uint32 m_eResponse;
  280. uint32 m_unTradeRequestID;
  281. };
  282. // k_EMsgGCTrading_StartSession
  283. struct MsgGCTrading_StartSession_t
  284. {
  285. uint32 m_unSessionVersion;
  286. uint64 m_ulSteamIDPartyA;
  287. uint64 m_ulSteamIDPartyB;
  288. // @note strings from player names will be added to the message
  289. };
  290. // k_EMsgGCTrading_SetItem
  291. struct MsgGCTrading_SetItem_t
  292. {
  293. bool m_bShowcase;
  294. uint64 m_unItemID;
  295. uint8 m_unPosition;
  296. };
  297. // k_EMsgGCTrading_RemoveItem
  298. struct MsgGCTrading_RemoveItem_t
  299. {
  300. uint64 m_unItemID;
  301. };
  302. // k_EMsgGCTrading_UpdateTradeInfo
  303. struct MsgGCTrading_UpdateTradeInfo_t
  304. {
  305. uint32 m_unSessionVersion;
  306. uint8 m_unNumItemsPartyA;
  307. uint8 m_unNumItemsPartyB;
  308. uint8 m_unNumShowcaseItemsPartyA;
  309. uint8 m_unNumShowcaseItemsPartyB;
  310. // @note 4 lists of item ids in the order above
  311. };
  312. // k_EMsgGCTrading_SetReadiness
  313. struct MsgGCTrading_SetReadiness_t
  314. {
  315. uint32 m_unSessionVersion;
  316. bool m_bReady;
  317. };
  318. // k_EMsgGCTrading_ConfirmOffer
  319. struct MsgGCTrading_ConfirmOffer_t
  320. {
  321. uint32 m_unConfirmedSessionVersion;
  322. };
  323. // k_EMsgGCTrading_ReadinessResponse
  324. struct MsgGCTrading_ReadinessResponse_t
  325. {
  326. uint32 m_unSessionVersion;
  327. bool m_bIsReadyPartyA;
  328. bool m_bIsReadyPartyB;
  329. bool m_bConfirmedByPartyA;
  330. bool m_bConfirmedByPartyB;
  331. };
  332. enum EGCMsgSessionClosed
  333. {
  334. k_EGCMsgSessionClosed_ItemsTraded = 0,
  335. k_EGCMsgSessionClosed_Canceled = 1,
  336. k_EGCMsgSessionClosed_Error = 2,
  337. k_EGCMsgSessionClosed_DoesNotOwnItems = 3,
  338. k_EGCMsgSessionClosed_UntradableItems = 4,
  339. k_EGCMsgSessionClosed_NoItems = 5,
  340. k_EGCMsgSessionClosed_Disabled = 6,
  341. k_EGCMsgSessionClosed_ForceSizeInt = 0x7FFFFFFF
  342. };
  343. // k_EMsgGCTrading_SessionClosed
  344. struct MsgGCTrading_SessionClosed_t
  345. {
  346. uint32 m_eReason;
  347. };
  348. // k_EMsgGCTrading_CancelSession
  349. struct MsgGCTrading_CancelSession_t
  350. {
  351. };
  352. // k_EMsgGCTrading_TradeChatMsg
  353. struct MsgGCTrading_TradeChatMsg_t
  354. {
  355. // char* variable length chat message, up to 128 characters
  356. };
  357. // k_EMsgGCTrading_TradeTypingChatMsg
  358. struct MsgGCTrading_TradeTypingChatMsg_t
  359. {
  360. // empty
  361. };
  362. // k_EMsgGCUsedClaimCodeItem
  363. struct MsgGCUsedClaimCodeItem_t
  364. {
  365. // string of URL
  366. };
  367. //-----------------------------------------------------------------------------
  368. // ServerBrowser messages
  369. enum EGCMsgServerBrowser
  370. {
  371. k_EGCMsgServerBrowser_FromServerBrowser = 0,
  372. k_EGCMsgServerBrowser_FromAutoAskDialog = 1,
  373. };
  374. // k_EMsgGCServerBrowser_FavoriteServer
  375. // k_EMsgGCServerBrowser_BlacklistServer
  376. struct MsgGCServerBrowser_Server_t
  377. {
  378. uint32 m_unIP;
  379. int m_usPort;
  380. uint8 m_ubSource; // 0=serverbrowser, 1=auto-ask dialog
  381. };
  382. //-----------------------------------------------------------------------------
  383. // Public facing loot lists.
  384. // k_EMsgGC_RevolvingLootList
  385. struct MsgGC_RevolvingLootList_t
  386. {
  387. uint8 m_usListID; // Id of this list.
  388. // Var Data:
  389. // Serialized Lootlist KV
  390. };
  391. //-----------------------------------------------------------------------------
  392. // Microtransactions
  393. // k_EMsgGCStorePurchaseFinalize
  394. struct MsgGCStorePurchaseFinalize_t
  395. {
  396. uint64 m_ulTxnID; // Transaction ID for the the transaction
  397. };
  398. //k_EMsgGCStorePurchaseFinalizeResponse
  399. struct MsgGCStorePurchaseFinalizeResponse_t
  400. {
  401. int16 m_eResult; // Result of the operation
  402. uint32 m_cItemIDs; // Number of items contained in the purchase
  403. // Var Data:
  404. // If successful, list of m_cItemIDs uint64's
  405. // that represent the purchased items
  406. };
  407. //k_EMsgGCStorePurchaseCancel
  408. struct MsgGCStorePurchaseCancel_t
  409. {
  410. uint64 m_ulTxnID; // Transaction ID for the the transaction
  411. };
  412. //k_EMsgGCStorePurchaseCancelResponse
  413. struct MsgGCStorePurchaseCancelResponse_t
  414. {
  415. int16 m_eResult; // Result of the operation
  416. };
  417. //k_EMsgGCStorePurchaseQueryTxn
  418. struct MsgGCStorePurchaseQueryTxn_t
  419. {
  420. uint64 m_ulTxnID; // Transaction ID for the the transaction
  421. };
  422. //k_EMsgGCStorePurchaseQueryTxnResponse
  423. struct MsgGCStorePurchaseQueryTxnResponse_t
  424. {
  425. int16 m_eResult; // Result of the operation
  426. int16 m_ePurchaseState; // State of the queried transaction
  427. uint32 m_cItemIDs; // Number of items contained in the purchase
  428. // Var Data:
  429. // If the order is final, list of m_cItemIDs uint64's
  430. // that represent the items purchased by this order
  431. };
  432. // k_EMsgGCLookupAccount
  433. struct MsgGCLookupAccount_t
  434. {
  435. uint16 m_uiFindType;
  436. // Var Data
  437. // string containing Persona / URL / etc
  438. };
  439. // k_EMsgGCLookupAccountResponse
  440. // k_EMsgGCLookupAccountName
  441. struct MsgGCLookupAccountName_t
  442. {
  443. uint32 m_unAccountID;
  444. };
  445. // k_EMsgGCLookupAccountNameResponse
  446. struct MsgGCLookupAccountNameResponse_t
  447. {
  448. uint32 m_unAccountID;
  449. // string containing persona name
  450. };
  451. #pragma pack( pop )
  452. #endif