Team Fortress 2 Source Code as on 22/4/2020
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.

965 lines
42 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================
  6. #ifndef ACTUAL_ECON_ITEM_CONSTANTS_H // ECON_ITEM_CONSTANTS_H is used by src/common/econ_item_view.h
  7. #define ACTUAL_ECON_ITEM_CONSTANTS_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. //=============================================================================
  12. // To avoid #include dependency chains, this file should
  13. // contain only constants that do not depend on other
  14. // header files.
  15. // This file is #included in cbase.h to allow schema compiles
  16. // to use these constants to ensure correlation between
  17. // code data structures and database entries
  18. //=============================================================================
  19. typedef uint32 item_price_t; // this is the type that is used to hold currency values for transactions! don't change this without changing the relevant code/databases/etc.
  20. typedef uint8 item_transaction_quantity_t;
  21. class CLocalizationProvider;
  22. enum { kLocalizedPriceSizeInChararacters = 64 };
  23. //-----------------------------------------------------------------------------
  24. // Econ Item testing
  25. //-----------------------------------------------------------------------------
  26. enum testitem_itemtypes_t
  27. {
  28. TI_TYPE_UNKNOWN = -1,
  29. TI_TYPE_WEAPON = 0,
  30. TI_TYPE_HEADGEAR,
  31. TI_TYPE_MISC1,
  32. TI_TYPE_MISC2,
  33. TI_TYPE_COUNT,
  34. };
  35. #define TESTITEM_DEFINITIONS_BEGIN_AT 40000
  36. //-----------------------------------------------------------------------------
  37. // Type IDs for economy classes. These are part of the client-GC protocol and
  38. // should not change if it can be helped
  39. //-----------------------------------------------------------------------------
  40. enum EEconTypeID
  41. {
  42. k_EEconTypeItem =1,
  43. k_EEconTypePlayerInfo =2,
  44. k_EEconTypeClaimCode =3,
  45. k_EEconTypeRecipe =5,
  46. k_EEconTypeGameAccountClient =7,
  47. k_EEconTypeGameAccount =8,
  48. k_EEconTypeDuelSummary =19,
  49. k_EEconTypeExperiment =20,
  50. k_EEconTypeMapContribution =28,
  51. k_EEconTypeGameServerAccount =29,
  52. k_EEconTypeCoachRating =30,
  53. // k_EEconTypeEquipInstance =31, // DEPRECATED
  54. k_EEconTypeSelectedItemPreset =35,
  55. k_EEconTypeItemPresetInstance =36,
  56. k_EEconTypeGameAccountForGameServers =37,
  57. k_EEConTypeWarData =38,
  58. k_EEConTypeLadderData =39,
  59. k_EEConTypeMatchResultPlayerInfo =40,
  60. k_EEconTypeXPSource =41,
  61. k_EEconTypeNotification =42,
  62. };
  63. //-----------------------------------------------------------------------------
  64. // Actions for the ItemAudit table
  65. //-----------------------------------------------------------------------------
  66. // WARNING!!! Values stored in DB. Do not renumber!
  67. enum EItemAction
  68. {
  69. k_EItemActionInvalid = -1,
  70. k_EItemActionGSCreate = 0,
  71. k_EItemActionUnpurchase = 1,
  72. k_EItemActionDelete = 2,
  73. k_EItemActionAwardAchievement = 3,
  74. k_EItemActionBanned = 4,
  75. k_EItemActionQuantityChanged = 5,
  76. k_EItemActionRestored = 6,
  77. k_EItemActionAwardTime = 7,
  78. k_EItemActionManualCreate = 8,
  79. k_EItemActionDrop = 9,
  80. k_EItemActionPickUp = 10,
  81. k_EItemActionCraftDestroy = 11,
  82. k_EItemActionCraftCreate = 12,
  83. k_EItemActionLimitExceeded = 13,
  84. k_EItemActionPurchase = 14,
  85. k_EItemActionNameChanged_Add = 15,
  86. k_EItemActionUnlockCrate_Add = 16,
  87. k_EItemActionPaintItem_Add = 17,
  88. k_EItemActionAutoGrantItem = 18,
  89. k_EItemActionCrossGameAchievement = 19,
  90. k_EItemActionAddItemToSocket_Add = 20,
  91. k_EItemActionAddSocketToItem_Add = 21,
  92. k_EItemActionRemoveSocketItem_Add = 22,
  93. k_EItemActionCustomizeItemTexture_Add = 23,
  94. k_EItemActionItemTraded_Add = 24,
  95. k_EItemActionUseItem = 25,
  96. k_EItemActionAwardGift_Receiver = 26,
  97. k_EItemActionNameChanged_Remove = 27,
  98. k_EItemActionUnlockCrate_Remove = 28,
  99. k_EItemActionPaintItem_Remove = 29,
  100. k_EItemActionAddItemToSocket_Remove = 30,
  101. k_EItemActionAddSocketToItem_Remove = 31,
  102. k_EItemActionRemoveSocketItem_Remove = 32,
  103. k_EItemActionCustomizeItemTexture_Remove = 33,
  104. k_EItemActionItemTraded_Remove = 34,
  105. k_EItemActionUnpackItemBundle = 35,
  106. k_EItemActionCreateItemFromBundle = 36,
  107. k_EItemActionAwardStorePromotionItem = 37,
  108. k_EItemActionConvertItem = 38,
  109. k_EItemActionEarnedItem = 39,
  110. k_EItemActionAwardGift_Giver = 40,
  111. k_EItemActionRefundedItem = 41,
  112. k_EItemActionAwardThirdPartyPromo = 42,
  113. k_EItemActionRemoveItemName_Remove = 43,
  114. k_EItemActionRemoveItemName_Add = 44,
  115. k_EItemActionRemoveItemPaint_Remove = 45,
  116. k_EItemActionRemoveItemPaint_Add = 46,
  117. k_EItemActionHalloweenDrop = 47,
  118. k_EItemActionSteamWorkshopContributor = 48,
  119. k_EItemActionManualOwnershipChange = 49, // when we have bad bugs that corrupt item data and have to fix up rows in the DB by hand
  120. k_EItemActionSupportDelete = 50,
  121. k_EItemActionSupportCreatedByUndo = 51,
  122. k_EItemActionSupportDeletedByUndo = 52,
  123. k_EItemActionSupportQuantityChangedByUndo = 53,
  124. k_EItemActionSupportRename_Add = 54,
  125. k_EItemActionSupportRename_Remove = 55,
  126. k_EItemActionSupportDescribe_Add = 56,
  127. k_EItemActionSupportDescribe_Remove = 57,
  128. k_EItemActionStrangePartApply_Add = 58,
  129. k_EItemActionStrangePartApply_Remove = 59,
  130. k_EItemActionStrangeScoreReset_Add = 60,
  131. k_EItemActionStrangeScoreReset_Remove = 61,
  132. k_EItemActionStrangePartRemove_Add = 62,
  133. k_EItemActionStrangePartRemove_Remove = 63,
  134. k_EItemActionSupportStrangify_Add = 64,
  135. k_EItemActionSupportStrangify_Remove = 65,
  136. k_EItemActionUpgradeCardApply_Add = 66,
  137. k_EItemActionUpgradeCardApply_Remove = 67,
  138. k_EItemActionUpgradeCardRemove_Add = 68,
  139. k_EItemActionUpgradeCardRemove_Remove = 69,
  140. k_EItemActionStrangeRestrictionApply_Add = 70,
  141. k_EItemActionStrangeRestrictionApply_Remove = 71,
  142. k_EItemActionTransmogrify_Add = 72,
  143. k_EItemActionTransmogrify_Remove = 73,
  144. k_EItemActionHalloweenSpellPageAdd_Add = 74,
  145. k_EItemActionHalloweenSpellPageAdd_Remove = 75,
  146. k_EItemActionDev_ClientLootListRoll = 90,
  147. k_EItemActionGiftWrap_Add = 100,
  148. k_EItemActionGiftWrap_Remove = 101,
  149. k_EItemActionGiftDelivery_Add = 102,
  150. k_EItemActionGiftDelivery_Remove = 103,
  151. k_EItemActionGiftUnwrap_Add = 104,
  152. k_EItemActionGiftUnwrap_Remove = 105,
  153. k_EItemActionPackageItem = 106,
  154. k_EItemActionPackageItem_Revoked = 107,
  155. k_EItemActionHandleMapToken = 108,
  156. k_EItemActionCafeOrSchoolItem_Remove = 109,
  157. k_EItemActionVACBanned_Remove = 110,
  158. k_EItemActionUpgradeThirdPartyPromo = 111,
  159. k_EItemActionExpired = 112,
  160. k_EItemActionTradeRollback_Add = 113,
  161. k_EItemActionTradeRollback_Remove = 114,
  162. k_EItemActionCDKeyGrant = 115,
  163. k_EItemActionCDKeyRevoke = 116,
  164. k_EItemActionWeddingRing_Add = 117,
  165. k_EItemActionWeddingRing_Remove = 118,
  166. k_EItemActionWeddingRing_AddPartner = 119,
  167. k_EItemActionEconSetUnowned = 120,
  168. k_EItemActionEconSetOwned = 121,
  169. k_EItemActionStrangifyItem_Add = 122,
  170. k_EItemActionStrangifyItem_Remove = 123,
  171. k_EItemActionConsumeItem_Consume_ToolRemove = 124,
  172. k_EItemActionConsumeItem_Consume_ToolAdd = 125,
  173. k_EItemActionConsumeItem_Consume_InputRemove = 126,
  174. k_EItemActionConsumeItem_Complete_OutputAdd = 127,
  175. k_EItemActionConsumeItem_Complete_ToolRemove = 128,
  176. k_EItemActionItemEaterRecharge_Add = 129,
  177. k_EItemActionItemEaterRecharge_Remove = 130,
  178. k_EItemActionRemoveItemCraftIndex_Remove = 150,
  179. k_EItemActionRemoveItemCraftIndex_Add = 151,
  180. k_EItemActionRemoveItemMakersMark_Remove = 152, // early versions of this will be in the database as 150
  181. k_EItemActionRemoveItemMakersMark_Add = 153, // early versions of this will be in the database as 151 because I am a terrible person
  182. k_EItemActionCollectItem_CollectedItem = 154,
  183. k_EItemActionCollectItem_UpdateCollection = 155,
  184. k_EItemActionCollectItem_RemoveCollection = 156,
  185. k_EItemActionCollectItem_RedeemCollectionReward = 157,
  186. k_EItemActionPreviewItem_BeginPreviewPeriod = 158,
  187. k_EItemActionPreviewItem_EndPreviewPeriodExpired = 159,
  188. k_EItemActionPreviewItem_EndPreviewPeriodItemBought = 160,
  189. k_EItemActionPeriodicScoreReward_Add = 170,
  190. k_EItemActionPeriodicScoreReward_Remove = 171,
  191. k_EItemActionMvM_ChallengeCompleted_RemoveTicket = 180, // we completed a challenge and consumed this ticket as the cost
  192. k_EItemActionMvM_ChallengeCompleted_GrantBadge = 181, // we completed a challenge and granted the player a badge because they didn't have one
  193. k_EItemActionMvM_ChallengeCompleted_UpdateBadgeStamps_Remove = 182, // we completed a challenge and we're crossing an entry off our badge checklist (this may also reset the badge back down to empty if this was the last line item)
  194. k_EItemActionMvM_ChallengeCompleted_UpdateBadgeStamps_Add = 183, // (other half of the above)
  195. k_EItemActionMvM_ChallengeCompleted_GrantMissionCompletionLoot = 184, // we completed a mission in MvM
  196. k_EItemActionMvM_RemoveSquadSurplusVoucher = 185,
  197. k_EItemActionMvM_AwardSquadSurplus_Receiver = 186,
  198. k_EItemActionMvM_AwardSquadSurplus_Giver = 187,
  199. k_EItemActionMvM_ChallengeCompleted_GrantTourCompletionLoot = 188, // we completed a full tour in MvM
  200. k_EItemActionMvM_AwardHelpANoobBonus_Helper = 189,
  201. k_EItemActionHalloween_UpdateMerasmusLootLevel_Add = 200, // set the level of the merasmus loot
  202. k_EItemActionHalloween_UpdateMerasmusLootLevel_Remove = 201,
  203. k_EItemActionRemoveItemKillStreak_Remove = 202,
  204. k_EItemActionRemoveItemKillStreak_Add = 203,
  205. k_EItemActionSupportAddOrModifyAttribute_Remove = 204,
  206. k_EItemActionSupportAddOrModifyAttribute_Add = 205,
  207. k_EItemActionSpyVsEngyWar_JoinedWar = 206,
  208. k_EItemAction_UpdateDuckBadgeLevel_Add = 207,
  209. k_EItemAction_UpdateDuckBadgeLevel_Remove = 208,
  210. k_EItemAction_QuestDrop = 209,
  211. k_EItemAction_OperationPass_Add = 210,
  212. k_EItemActionMarket_Add = 211,
  213. k_EItemActionMarket_Remove = 212,
  214. k_EItemAction_QuestComplete_Reward = 213,
  215. k_EItemAction_QuestComplete_Remove = 214,
  216. k_EItemAction_QuestLoaner_Add = 215,
  217. k_EItemActionStrangeCountTransfer_Add = 216,
  218. k_EItemActionStrangeCountTransfer_Remove = 217,
  219. k_EItemActionCraftCollectionUpgrade_Add = 218,
  220. k_EItemActionCraftCollectionUpgrade_Remove = 219,
  221. k_EItemActionCraftHalloweenOffering_Add = 220,
  222. k_EItemActionCraftHalloweenOffering_Remove = 221,
  223. k_EItemActionRemoveItemGiftedBy_Remove = 222,
  224. k_EItemActionRemoveItemGiftedBy_Add = 223,
  225. k_EItemActionAddParticleVerticalAttr_Remove = 224,
  226. k_EItemActionAddParticleVerticalAttr_Add = 225,
  227. k_EItemActionAddParticleUseHeadOriginAttr_Remove = 226,
  228. k_EItemActionAddParticleUseHeadOriginAttr_Add = 227,
  229. k_EItemActionRemoveItemDynamicAttr_Add = 228,
  230. k_EItemActionRemoveItemDynamicAttr_Remove = 229,
  231. k_EItemActionCraftStatClockTradeUp_Add = 230,
  232. k_EItemActionCraftStatClockTradeUp_Remove = 231,
  233. k_EItemActionViralCompetitiveBetaPass_Drop = 232,
  234. k_EItemActionSupportDeleteAttribute_Remove = 233,
  235. k_EItemActionSupportDeleteAttribute_Add = 234,
  236. // Let's be consistent with the underscores please.
  237. // k_EItemActionYourNewAction, not k_EItemAction_YourNewAction
  238. // Yes, it matters. See PchLocalizedNameFromEItemAction for why.
  239. };
  240. extern const char *PchNameFromEItemAction( EItemAction eAction );
  241. extern const char *PchNameFromEItemActionUnsafe( EItemAction eAction );
  242. extern bool BIsActionCreative( EItemAction );
  243. extern bool BIsActionDestructive( EItemAction );
  244. enum EItemActionMissingBehavior { kEItemAction_FriendlyNameLookup_ReturnNULLIfMissing, kEItemAction_FriendlyNameLookup_ReturnDummyStringIfMissing };
  245. extern const char *PchFriendlyNameFromEItemAction( EItemAction eAction, EItemActionMissingBehavior eMissingBehavior );
  246. extern const char *PchLocalizedNameFromEItemAction( EItemAction eAction, CLocalizationProvider &localizationProvider );
  247. //-----------------------------------------------------------------------------
  248. // Purpose: Used to pass audit actions to asset servers for SetUnowned and
  249. // SetOwned methods.
  250. //-----------------------------------------------------------------------------
  251. enum EEconOwnershipAction
  252. {
  253. k_EEconOwnershipAction_Invalid = 0,
  254. k_EEconOwnershipAction_TradeBase = 100,
  255. k_EEconOwnershipAction_TradeCommit = 101, // precommit and docommit step of a trade. Reference is trade ID
  256. k_EEconOwnershipAction_TradeRollback = 102, // cancelcommit and rollbackcommit step of a trade. Reference is trade ID
  257. };
  258. // old
  259. enum eEconItemFlags_Deprecated
  260. {
  261. kDeprecated_EconItemFlag_AchievementGrantedItem = 1 << 0,
  262. kDeprecated_EconItemFlag_CannotTrade = 1 << 1,
  263. kDeprecated_EconItemFlag_Purchased = 1 << 2,
  264. kDeprecated_EconItemFlag_CannotBeUsedInCrafting = 1 << 3,
  265. kDeprecated_EconItemFlag_Promotion = 1 << 4,
  266. };
  267. //-----------------------------------------------------------------------------
  268. // Periodic score events
  269. //-----------------------------------------------------------------------------
  270. enum eEconPeriodicScoreEvents
  271. {
  272. kPeriodicScoreEvent_GiftsDistributed = 0,
  273. kPeriodicScoreEvent_DuelsWon = 1,
  274. kPeriodicScoreEvent_MapStampsPurchased = 2,
  275. };
  276. //-----------------------------------------------------------------------------
  277. // Flags for CEconItem
  278. //-----------------------------------------------------------------------------
  279. // WARNING!!! Values stored in DB. DO NOT CHANGE EXISTING VALUES. Add values to the end.
  280. enum eEconItemFlags
  281. {
  282. kEconItemFlag_CannotTrade = 1 << 0,
  283. kEconItemFlag_CannotBeUsedInCrafting = 1 << 1,
  284. kEconItemFlag_CanBeTradedByFreeAccounts = 1 << 2,
  285. kEconItemFlag_NonEconomy = 1 << 3, // used for items that are meant to not interact in the economy -- these can't be traded, gift-wrapped, crafted, etc.
  286. kEconItemFlag_PurchasedAfterStoreCraftabilityChanges2012 = 1 << 4, // cosmetic items coming from the store are now usable in crafting; this flag is set on all items purchased from the store after this change was made
  287. #ifdef CLIENT_DLL
  288. #ifdef TF_CLIENT_DLL
  289. kEconItemFlagClient_ForceBlueTeam = 1 << 5,
  290. #endif // TF_CLIENT_DLL
  291. kEconItemFlagClient_StoreItem = 1 << 6,
  292. kEconItemFlagClient_Preview = 1 << 7, // only set on the client; means "this item is being previewed"
  293. #endif // CLIENT_DLL
  294. // combination of the above flags used in code
  295. kEconItemFlags_CheckFlags_AllGCFlags = kEconItemFlag_CannotTrade | kEconItemFlag_CannotBeUsedInCrafting | kEconItemFlag_CanBeTradedByFreeAccounts | kEconItemFlag_NonEconomy | kEconItemFlag_PurchasedAfterStoreCraftabilityChanges2012,
  296. };
  297. //-----------------------------------------------------------------------------
  298. // Origin for an item for CEconItem
  299. //-----------------------------------------------------------------------------
  300. // WARNING!!! Values stored in DB. DO NOT CHANGE EXISTING VALUES. Add values to the end.
  301. enum eEconItemOrigin
  302. {
  303. kEconItemOrigin_Invalid = -1, // should never be stored in the DB! used to indicate "invalid" for in-memory objects only
  304. kEconItemOrigin_Drop = 0,
  305. kEconItemOrigin_Achievement,
  306. kEconItemOrigin_Purchased,
  307. kEconItemOrigin_Traded,
  308. kEconItemOrigin_Crafted,
  309. kEconItemOrigin_StorePromotion,
  310. kEconItemOrigin_Gifted,
  311. kEconItemOrigin_SupportGranted,
  312. kEconItemOrigin_FoundInCrate,
  313. kEconItemOrigin_Earned,
  314. kEconItemOrigin_ThirdPartyPromotion,
  315. kEconItemOrigin_GiftWrapped,
  316. kEconItemOrigin_HalloweenDrop,
  317. kEconItemOrigin_PackageItem,
  318. kEconItemOrigin_Foreign,
  319. kEconItemOrigin_CDKey,
  320. kEconItemOrigin_CollectionReward,
  321. kEconItemOrigin_PreviewItem,
  322. kEconItemOrigin_SteamWorkshopContribution,
  323. kEconItemOrigin_PeriodicScoreReward,
  324. kEconItemOrigin_MvMMissionCompletionReward, // includes loot from both "mission completed" and "tour completed" events
  325. kEconItemOrigin_MvMSquadSurplusReward,
  326. kEconItemOrigin_RecipeOutput,
  327. kEconItemOrigin_QuestDrop,
  328. kEconItemOrigin_QuestLoanerItem,
  329. kEconItemOrigin_TradeUp,
  330. kEconItemOrigin_ViralCompetitiveBetaPassSpread,
  331. kEconItemOrigin_Max,
  332. };
  333. extern const char *PchNameFromeEconItemOrigin( eEconItemOrigin eOrigin );
  334. // The Steam backend representation of a unique item index
  335. typedef uint64 itemid_t;
  336. typedef uint16 item_definition_index_t;
  337. typedef uint16 attrib_definition_index_t;
  338. typedef uint32 attrib_value_t;
  339. typedef uint32 operation_definition_index_t;
  340. typedef uint8 war_definition_index_t;
  341. typedef uint8 war_side_t;
  342. // Misc typedefs for clarity.
  343. typedef uint32 equip_region_mask_t;
  344. typedef uint8 style_index_t;
  345. const uint64 INVALID_ITEM_ID = (itemid_t)-1;
  346. const item_definition_index_t INVALID_ITEM_DEF_INDEX = ((item_definition_index_t)-1);
  347. const attrib_definition_index_t INVALID_ATTRIB_DEF_INDEX= ((attrib_definition_index_t)-1);
  348. const war_definition_index_t INVALID_WAR_DEF_INDEX = ((war_definition_index_t)-1);
  349. const war_side_t INVALID_WAR_SIDE = ((war_side_t)-1);
  350. // Hard code the pyro/heavy stuff. Must be in sync with the schema.
  351. const war_definition_index_t PYRO_VS_HEAVY_WAR_DEF_INDEX= ((war_definition_index_t)0);
  352. const war_side_t PYRO_VS_HEAVY_WAR_SIDE_HEAVY = ((war_side_t)0);
  353. const war_side_t PYRO_VS_HEAVY_WAR_SIDE_PYRO = ((war_side_t)1);
  354. //-----------------------------------------------------------------------------
  355. // Standard/default backpack size
  356. #define DEFAULT_NUM_BACKPACK_SLOTS 300
  357. #define DEFAULT_NUM_BACKPACK_SLOTS_FREE_TRIAL_ACCOUNT 50
  358. #define MAX_NUM_BACKPACK_SLOTS 2000
  359. // Current item level range
  360. #define MIN_ITEM_LEVEL 0
  361. #define MAX_ITEM_LEVEL 100
  362. // Maximum number of attributes allowed on a single item
  363. #define MAX_ATTRIBUTES_PER_ITEM 15
  364. // The maximum length of a single attribute's description
  365. // divide by locchar_t, so we can ensure 192 bytes, whether that's 128 wchars on client or 256 utf-8 bytes on gc
  366. #define MAX_ATTRIBUTE_DESCRIPTION_LENGTH ( 256 / sizeof( locchar_t ) )
  367. // The maximum length of an item's name
  368. #define MAX_ITEM_NAME_LENGTH 128
  369. #define MAX_ITEM_DESC_LENGTH 256
  370. // The maximum length of an item description. (Extra +1 line is for the base item type line)
  371. #define MAX_ITEM_DESCRIPTION_LENGTH ((MAX_ATTRIBUTES_PER_ITEM+1) * MAX_ATTRIBUTE_DESCRIPTION_LENGTH)
  372. // For custom user-naming of econ items.
  373. #define MAX_ITEM_CUSTOM_NAME_LENGTH 40
  374. #define MAX_ITEM_CUSTOM_NAME_DATABASE_SIZE ((4 * MAX_ITEM_CUSTOM_NAME_LENGTH) + 1) // Ensures we can store MAX_ITEM_CUSTOM_NAME_LENGTH
  375. // characters worth of obscure unicode characters in UTF8
  376. #define MAX_ITEM_CUSTOM_DESC_LENGTH 80
  377. #define MAX_ITEM_CUSTOM_DESC_DATABASE_SIZE ((4 * MAX_ITEM_CUSTOM_DESC_LENGTH) + 1)
  378. #define MAX_KILLCAM_MESSAGE_LENGTH 40
  379. #define MAX_KILLCAM_MESSAGE_DATABASE_SIZE ((4 * MAX_KILLCAM_MESSAGE_LENGTH) + 1)
  380. // max length in the DB for claim codes
  381. #define MAX_CLAIM_CODE_LENGTH 128
  382. // The item definition index reserved for the preview item
  383. #define PREVIEW_ITEM_DEFINITION_INDEX (item_definition_index_t)-1
  384. // The number of items to work on in a job before checking if a yield is necessary
  385. #define MAX_ITEMS_BEFORE_YIELD 50
  386. // TF team-color paints (moved from econ_item_view.h)
  387. #define RGB_INT_RED 12073019
  388. #define RGB_INT_BLUE 5801378
  389. // Custom textures
  390. const int k_nCustomImageSize = 128;
  391. const int k_nMaxCustomImageFileSize = k_nCustomImageSize*k_nCustomImageSize*4 + 4*1024; // Is this about right?
  392. //-----------------------------------------------------------------------------
  393. // Purpose: Quality types of items
  394. //-----------------------------------------------------------------------------
  395. typedef int32 entityquality_t;
  396. enum EEconItemQuality
  397. {
  398. AE_UNDEFINED = -1,
  399. AE_NORMAL = 0,
  400. AE_RARITY1 = 1, // Genuine
  401. AE_RARITY2 = 2, // Customized (unused)
  402. AE_VINTAGE = 3, // Vintage has to stay at 3 for backwards compatibility
  403. AE_RARITY3, // Artisan
  404. AE_UNUSUAL, // Unusual
  405. AE_UNIQUE,
  406. AE_COMMUNITY,
  407. AE_DEVELOPER,
  408. AE_SELFMADE,
  409. AE_CUSTOMIZED, // (unused)
  410. AE_STRANGE,
  411. AE_COMPLETED,
  412. AE_HAUNTED,
  413. AE_COLLECTORS,
  414. AE_PAINTKITWEAPON,
  415. AE_RARITY_DEFAULT,
  416. AE_RARITY_COMMON,
  417. AE_RARITY_UNCOMMON,
  418. AE_RARITY_RARE,
  419. AE_RARITY_MYTHICAL,
  420. AE_RARITY_LEGENDARY,
  421. AE_RARITY_ANCIENT,
  422. AE_MAX_TYPES,
  423. AE_DEPRECATED_UNIQUE = 3,
  424. };
  425. //-----------------------------------------------------------------------------
  426. // Purpose: colors used in the display of attributes
  427. //-----------------------------------------------------------------------------
  428. enum attrib_colors_t
  429. {
  430. ATTRIB_COL_LEVEL = 0,
  431. ATTRIB_COL_NEUTRAL,
  432. ATTRIB_COL_POSITIVE,
  433. ATTRIB_COL_NEGATIVE,
  434. ATTRIB_COL_ITEMSET_NAME,
  435. ATTRIB_COL_ITEMSET_EQUIPPED,
  436. ATTRIB_COL_ITEMSET_MISSING,
  437. ATTRIB_COL_BUNDLE_ITEM,
  438. ATTRIB_COL_LIMITED_USE,
  439. ATTRIB_COL_component_flags,
  440. ATTRIB_COL_LIMITED_QUANTITY,
  441. ATTRIB_COL_RARITY_DEFAULT,
  442. ATTRIB_COL_RARITY_COMMON,
  443. ATTRIB_COL_RARITY_UNCOMMON,
  444. ATTRIB_COL_RARITY_RARE,
  445. ATTRIB_COL_RARITY_MYTHICAL,
  446. ATTRIB_COL_RARITY_LEGENDARY,
  447. ATTRIB_COL_RARITY_ANCIENT,
  448. ATTRIB_COL_RARITY_IMMORTAL,
  449. ATTRIB_COL_RARITY_ARCANA,
  450. ATTRIB_COL_STRANGE,
  451. ATTRIB_COL_UNUSUAL,
  452. NUM_ATTRIB_COLORS,
  453. };
  454. #define AE_USE_SCRIPT_VALUE 9999 // Can't be -1, due to unsigned ints used on the backend
  455. const char *EconQuality_GetQualityString( EEconItemQuality eQuality );
  456. const char *EconQuality_GetColorString( EEconItemQuality eQuality );
  457. const char *EconQuality_GetLocalizationString( EEconItemQuality eQuality );
  458. EEconItemQuality EconQuality_GetQualityFromString( const char* pszQuality );
  459. // Sort order for rarities
  460. int EconQuality_GetRarityScore( EEconItemQuality eQuality );
  461. extern attrib_colors_t GetAttribColorIndexForName( const char* pszName );
  462. extern const char *GetColorNameForAttribColor( attrib_colors_t unAttribColor );
  463. extern const char *GetHexColorForAttribColor( attrib_colors_t unAttribColor );
  464. // Utility function that'll get you an item quality from a string
  465. entityquality_t GetItemQualityFromString( const char *sQuality );
  466. enum recipecategories_t
  467. {
  468. RECIPE_CATEGORY_CRAFTINGITEMS = 0,
  469. RECIPE_CATEGORY_COMMONITEMS,
  470. RECIPE_CATEGORY_RAREITEMS,
  471. RECIPE_CATEGORY_SPECIAL,
  472. NUM_RECIPE_CATEGORIES
  473. };
  474. extern const char *g_szRecipeCategoryStrings[NUM_RECIPE_CATEGORIES];
  475. //-----------------------------------------------------------------------------
  476. // Kill eater support.
  477. // Strange counters and strange parts
  478. //-----------------------------------------------------------------------------
  479. #if defined( TF_DLL ) || defined( TF_GC_DLL ) || defined( TF_CLIENT_DLL )
  480. enum kill_eater_event_t
  481. {
  482. kKillEaterEvent_PlayerKill = 0, // default; items with no event type specified use this
  483. kKillEaterEvent_UberActivated,
  484. kKillEaterEvent_PlayerKillAssist,
  485. kKillEaterEvent_PlayerKillsBySentry, // your sentry you built with this item killed someone
  486. kKillEaterEvent_PeeVictims, // this game is great
  487. kKillEaterEvent_BackstabAbsorbed, // you're a sniper and you got a spy to stab your Razorback
  488. kKillEaterEvent_HeadsTaken, // this also tracks kills but with different flavor text
  489. kKillEaterEvent_Humiliations, // fish kills!
  490. kKillEaterEvent_GiftsGiven, // number of gifts given
  491. kKillEaterEvent_DeathsFeigned, // number of deaths successfully feigned with the Dead Ringer
  492. kKillEaterEvent_ScoutKill, // (part)
  493. kKillEaterEvent_SniperKill, // (part)
  494. kKillEaterEvent_SoldierKill, // (part)
  495. kKillEaterEvent_DemomanKill, // (part)
  496. kKillEaterEvent_HeavyKill, // (part)
  497. kKillEaterEvent_PyroKill, // (part)
  498. kKillEaterEvent_SpyKill, // (part)
  499. kKillEaterEvent_EngineerKill, // (part)
  500. kKillEaterEvent_MedicKill, // (part)
  501. kKillEaterEvent_BuildingDestroyed, // (part)
  502. kKillEaterEvent_ProjectileReflect, // (part)
  503. kKillEaterEvent_HeadshotKill, // (part)
  504. kKillEaterEvent_AirborneEnemyKill, // (part) (enemy is in the air when they die)
  505. kKillEaterEvent_GibKill, // (part)
  506. kKillEaterEvent_BuildingSapped, // a sapper was doing damage to this building while it was destroyed
  507. kKillEaterEvent_PlayerTickle, // we used our comedy holiday gloves to force someone else to laugh
  508. kKillEaterEvent_PlayerKillByBootStomp, // we killed a player by transferring our falling damage onto them
  509. kKillEaterEvent_PlayerKillDuringFullMoon, // (part) we killed a player during the full moon holiday event (GC-updated)
  510. kKillEaterEvent_PlayerKillStartDomination, // (part) we killed a player and this kill was enough to start our domination of them
  511. kKillEaterEvent_PlayerKillAlreadyDominated, // (part) we killed a player with this weapon that we were already dominating
  512. kKillEaterEvent_PlayerKillRevenge, // (part) we killed a player with this weapon when that player was dominating us
  513. kKillEaterEvent_PlayerKillPosthumous, // (part) we killed a player after we were already dead (afterburn, stray rocket, etc.)
  514. kKillEaterEvent_BurningAllyExtinguished, // (part) we used urine/milk/flamethrower/whatever to put out the fire on an ally that was burning
  515. kKillEaterEvent_PlayerKillCritical, // (part) we killed a player with a shot that was a critical
  516. kKillEaterEvent_PlayerKillWhileExplosiveJumping, // (part) we killed a player while we were rocket/sticky-jumping
  517. kKillEaterEvent_PlayerKillFriend, // (part) we killed a player who is a Steam friend (GC-updated)
  518. kKillEaterEvent_SapperDestroyed, // (part) we destroyed a sapper that was on a friendly building
  519. kKillEaterEvent_InvisibleSpiesKilled, // (part) we killed an invisible spy
  520. kKillEaterEvent_MedicsWithFullUberKilled, // (part) we killed a fully ubered medic
  521. kKillEaterEvent_RobotsDestroyed, // (part) we killed a robot in MvM
  522. kKillEaterEvent_MinibossRobotsDestroyed, // (part) we killed a miniboss robot in MvM
  523. kKillEaterEvent_RobotsDestroyedAfterPenetration, // (part) we killed a robot with a shot that had already penetrated another robot
  524. kKillEaterEvent_RobotHeadshotKills, // (part) like kKillEaterEvent_HeadshotKill, but only for robots
  525. kKillEaterEvent_RobotsSlowed, // (part) we hit some robots with Jarate and now they're slow
  526. kKillEaterEvent_KillWhileLowHealth, // (part) we killed someone while we had <10% max health
  527. kKillEaterEvent_HalloweenKill, // (part) we killed someone during the Halloween holiday
  528. kKillEaterEvent_HalloweenKillRobot, // (part) we killed a robot in MvM during the Halloween holiday
  529. kKillEaterEvent_DefenderKill, // (part) we killed someone carrying the intel, pushing the cart, or capping a point
  530. kKillEaterEvent_UnderwaterKill, // (part) we killed someone who was completely submerged
  531. kKillEaterEvent_KillWhileUbercharged, // (part) we killed someone while we were invulnerable
  532. kKillEaterEvent_FoodEaten, // We ate our food
  533. kKillEaterEvent_BannersDeployed, // We deployed a banner buff
  534. kKillEaterEvent_NEGATIVE_SniperShotsMissed, // (part) we shot our sniper rifle and didnt hit anything
  535. kKillEaterEvent_NEGATIVE_UbersDropped, // (part) we died with a full ubercharge
  536. kKillEaterEvent_NEGATIVE_DeathsWhileCarryingBuilding, // (part) we died while carrying a building
  537. kKillEaterEvent_NEGATIVE_DeathsFromCratering, // (part) we died from cratering
  538. kKillEaterEvent_NEGATIVE_DeathsFromEnvironment, // (part) we died from environmental damage
  539. kKillEaterEvent_NEGATIVE_Deaths, // (part) we died :(
  540. kKillEaterEvent_TimeCloaked, // Time we are cloaked
  541. kKillEaterEvent_HealingProvided, // Health Provided to Allies
  542. kKillEaterEvent_TeleportsProvided, // Teleports Provided to Allies
  543. kKillEaterEvent_TanksDestroyed, // (part) we dealt the killing blow to a tank in MvM
  544. kKillEaterEvent_LongDistanceKill, // (part) we dealt the killing blow (while alive) from far away
  545. kKillEaterEvent_UniqueEvent__KilledAccountWithItem, // (part) (unique event) how many individual accounts have we killed?
  546. // kKillEaterEvent_UniqueEvent__PlayedWithAccountIDWhileWearingItem, // (part) (unique event) how many individual accounts have we played a round with?
  547. kKillEaterEvent_PointsScored, // How many score points we've accumulated
  548. kKillEaterEvent_DoubleDonks, // Double-Donks scored with the loose cannon
  549. kKillEaterEvent_TeammatesWhipped, // Whipped Teammates with the Disciplinary Action
  550. kKillEaterEvent_VictoryTimeKill, // Kills while in Victory / Bonus Time
  551. kKillEaterEvent_RobotScoutKill, // (part)
  552. kKillEaterEvent_RobotSniperKill, // (part) Not yet shipped
  553. kKillEaterEvent_RobotSoldierKill, // (part) Not yet shipped
  554. kKillEaterEvent_RobotDemomanKill, // (part) Not yet shipped
  555. kKillEaterEvent_RobotHeavyKill, // (part) Not yet shipped
  556. kKillEaterEvent_RobotPyroKill, // (part) Not yet shipped
  557. kKillEaterEvent_RobotSpyKill, // (part)
  558. kKillEaterEvent_RobotEngineerKill, // (part) Not yet shipped
  559. kKillEaterEvent_RobotMedicKill, // (part) Not yet shipped
  560. kKillEaterEvent_TauntKill, // Taunt Kills
  561. kKillEaterEvent_PlayersWearingUnusualKill, // (part) we killed someone wearing an unusual hat (!)
  562. kKillEaterEvent_BurningEnemyKill, // (part) we killed someone who was on fire up until they died
  563. kKillEaterEvent_KillstreaksEnded, // (part) we killed someone who was on a killstreak
  564. kKillEaterEvent_KillcamTaunts, // (cosmetic part) we appeared wearing this item in the killcam taunting
  565. kKillEaterEvent_DamageDealt, // (part) we have dealt this much damage to people
  566. kKillEaterEvent_FiresSurvived, // (cosmetic part) we were lit on fire wearing this item and then the fire went out and we were still alive
  567. kKillEaterEvent_AllyHealingDone, // (part) we have healed this much (directly, so doesn't count Mad Milk, etc. because we lose the item pointer at some point); also ignores self heal (ie., Concheror buff, MvM upgrades)
  568. kKillEaterEvent_PointBlankKills, // (part) we killed someone while standing right next to them
  569. kKillEaterEvent_PlayerKillsByManualControlOfSentry, // Kills from wrangled a sentry
  570. kKillEaterEvent_CosmeticKills, // (cosmetic part) kills
  571. kKillEaterEvent_FullHealthKills, // (part) Kills while at fullhealth
  572. kKillEaterEvent_TauntingPlayerKills, // (part) Taunting Player Kills
  573. kKillEaterEvent_Halloween_OverworldKills,
  574. kKillEaterEvent_Halloween_UnderworldKills,
  575. kKillEaterEvent_Halloween_MinigamesWon,
  576. kKillEaterEvent_NonCritKills, // part kills that are not crit or mini crit
  577. kKillEaterEvent_PlayersHit, // part
  578. kKillEaterEvent_CosmeticAssists, // Cosmetic part
  579. kKillEaterEvent_CosmeticOperationContractsCompleted, // Operation Stat Tracker
  580. kKillEaterEvent_CosmeticOperationKills, // Operation Stat Tracker
  581. kKillEaterEvent_CosmeticOperationContractsPoints,
  582. kKillEaterEvent_CosmeticOperationBonusPoints,
  583. kKillEaterEvent_TauntsPerformed, // Strange Taunts
  584. kKillEaterEvent_InvasionKills, // Kills During Invasion Event. Locked after Operation
  585. kKillEaterEvent_InvasionKillsOnMap01,
  586. kKillEaterEvent_InvasionKillsOnMap02,
  587. kKillEaterEvent_InvasionKillsOnMap03,
  588. kKillEaterEvent_InvasionKillsOnMap04,
  589. kKillEaterEvent_HalloweenSouls, // Halloween
  590. kKillEaterEvent_HalloweenContractsCompleted,
  591. kKillEaterEvent_HalloweenOfferings,
  592. kKillEaterEvent_PowerupBottlesUsed,
  593. // NEW ENTRIES MUST BE ADDED AT THE BOTTOM
  594. };
  595. #else
  596. // projects that actually want to implement kill-eater functionality will want to put their list somewhere around here,
  597. // but unfortunately the base code relies on this specific definition being entry 0
  598. static const uint32 kKillEaterEvent_PlayerKill = 0;
  599. #endif // defined( TF_DLL ) || defined( TF_GC_DLL ) || defined( TF_CLIENT_DLL )
  600. enum strange_event_restriction_t
  601. {
  602. kStrangeEventRestriction_None = 0, // default -- unassigned, all events pass
  603. kStrangeEventRestriction_VictimSteamAccount, // the victim must have a specific Steam ID
  604. #if defined( TF_DLL ) || defined( TF_GC_DLL ) || defined( TF_CLIENT_DLL )
  605. kStrangeEventRestriction_Map, // must be playing on a certain map when the event takes place
  606. kStrangeEventRestriction_Competitive, // must be playing in a competitive game
  607. #endif // defined( TF_DLL ) || defined( TF_GC_DLL ) || defined( TF_CLIENT_DLL )
  608. kStrangeEventRestrictionCount
  609. };
  610. // Ugh -- these are shared between the GC and the client. Maybe #define is slightly better than
  611. // magic string literals?
  612. #define KILL_EATER_RANK_LEVEL_BLOCK_NAME "KillEaterRank"
  613. #ifdef TF_DLL
  614. class CTFWeaponBase *GetKilleaterWeaponFromDamageInfo( const class CTakeDamageInfo *pInfo );
  615. // A specific CEconEntity caused a kill eater event to happen. For example, a weapon might cause a
  616. // player kill event so we want to update the stats for that specific weapon.
  617. void EconEntity_OnOwnerKillEaterEvent( class CEconEntity *pEconEntity, class CTFPlayer *pOwner, class CTFPlayer *pVictim, kill_eater_event_t eEventType, int nIncrementValue = 1 );
  618. void EconItemInterface_OnOwnerKillEaterEvent( class IEconItemInterface *pEconEntity, class CTFPlayer *pOwner, class CTFPlayer *pVictim, kill_eater_event_t eEventType, int nIncrementValue = 1 );
  619. void EconEntity_OnOwnerKillEaterEventNoPartner( class CEconEntity *pEconEntity, class CTFPlayer *pOwner, kill_eater_event_t eEventType, int nIncrementValue = 1 );
  620. void EconItemInterface_OnOwnerKillEaterEventNoPartner( class IEconItemInterface *pEconEntity, class CTFPlayer *pOwner, kill_eater_event_t eEventType, int nIncrementValue = 1 );
  621. void HatAndMiscEconEntities_OnOwnerKillEaterEvent( class CTFPlayer *pOwner, class CTFPlayer *pVictim, kill_eater_event_t eEventType, int nIncrementValue = 1 );
  622. void HatAndMiscEconEntities_OnOwnerKillEaterEventNoParter( class CTFPlayer *pOwner, kill_eater_event_t eEventType, int nIncrementValue = 1 );
  623. void EconEntity_NonEquippedItemKillTracking_NoPartner( class CTFPlayer *pOwner, item_definition_index_t iDefIndex, kill_eater_event_t eEventType, int nIncrementValue = 1 );
  624. void EconEntity_NonEquippedItemKillTracking_NoPartnerBatched( class CTFPlayer *pOwner, item_definition_index_t iDefIndex, kill_eater_event_t eEventType, int nIncrementValue = 1 );
  625. // Batching system for frequent events (ie., damage dealing). The game server will flush all batches
  626. // at specific time intervals and send up one composite message to avoid flooding the GC. Batched
  627. // messages will only work correctly for types that support increment values. Because the game client
  628. // and game server don't know which event types support increment values we can't do any checking
  629. // before we send the message.
  630. void EconEntity_OnOwnerKillEaterEvent_Batched( class CEconEntity *pEconEntity, class CTFPlayer *pOwner, class CTFPlayer *pVictim, kill_eater_event_t eEventType, int nIncrementValue = 1 );
  631. void EconItemInterface_OnOwnerKillEaterEvent_Batched( class IEconItemInterface *pEconEntity, class CTFPlayer *pOwner, class CTFPlayer *pVictim, kill_eater_event_t eEventType, int nIncrementValue = 1 );
  632. void KillEaterEvents_FlushBatches();
  633. #endif // TF_DLL
  634. int GetKillEaterAttrCount();
  635. int GetKillEaterAttrCount_UserCustomizable();
  636. const class CEconItemAttributeDefinition *GetKillEaterAttr_Score( int i );
  637. const class CEconItemAttributeDefinition *GetKillEaterAttr_Type( int i );
  638. const class CEconItemAttributeDefinition *GetKillEaterAttr_Restriction( int i );
  639. const class CEconItemAttributeDefinition *GetKillEaterAttr_RestrictionValue( int i );
  640. bool GetKillEaterAttr_IsUserCustomizable( int i );
  641. bool GetKilleaterValueByEvent( const class IEconItemInterface* pItem, const kill_eater_event_t& EEventType, uint32& value );
  642. bool BIsItemStrange( const class IEconItemInterface *pItem );
  643. const int COLLECTION_CRAFTING_ITEM_COUNT = 10;
  644. const char* GetCollectionCraftingInvalidReason( const class IEconItemInterface *pTestItem, const class IEconItemInterface *pSourceItem );
  645. const int HALLOWEEN_OFFERING_ITEM_COUNT = 3;
  646. const char* GetHalloweenOfferingInvalidReason( const class IEconItemInterface *pTestItem, const class IEconItemInterface *pSourceItem );
  647. const int CRAFT_COMMON_STATCLOCK_ITEM_COUNT = 5;
  648. const char* GetCraftCommonStatClockInvalidReason( const class IEconItemInterface *pTestItem, const class IEconItemInterface *pSourceItem );
  649. int GetMaxCardUpgradesPerItem();
  650. const class CEconItemAttributeDefinition *GetCardUpgradeForIndex( const class IEconItemInterface *pItem, int i );
  651. #define GUARANTEED_OUTPUT (1<<0)
  652. #define GUARANTEED_INPUT (1<<1)
  653. #define DYNAMIC_RECIPE_FLAG_IS_OUTPUT (1<<0)
  654. #define DYNAMIC_RECIPE_FLAG_IS_UNTRADABLE (1<<1)
  655. #define DYNAMIC_RECIPE_FLAG_PARAM_ITEM_DEF_SET (1<<2)
  656. #define DYNAMIC_RECIPE_FLAG_PARAM_QUALITY_SET (1<<3)
  657. #define DYNAMIC_RECIPE_FLAG_PARAM_ATTRIBUTE_SET_ALL (1<<4)
  658. #define DYNAMIC_RECIPE_FLAG_PARAM_ATTRIBUTE_SET_ANY (1<<5)
  659. #define k_ObjectiveTrackerFlag_OwnerClient (1<<0)
  660. #define k_ObjectiveTrackerFlag_Servers (1<<1)
  661. #define k_ObjectiveTrackerFlag_AllClients (1<<2)
  662. #define k_ObjectiveTrackerFlag_ClientAndServer ( k_ObjectiveTrackerFlag_OwnerClient | k_ObjectiveTrackerFlag_Servers )
  663. const float k_MaxElapsedQuestReportTime = 10.f;
  664. //===============================================================================================================
  665. // POSITION HANDLING
  666. //===============================================================================================================
  667. // TF Inventory Position cracking
  668. // REALLY OLD FORMAT (??):
  669. // We store a bag index in the highbits of the inventory position.
  670. // The lowbit stores the position of the item within the bag.
  671. //
  672. // LESS OLD FORMAT (up through July, 2011):
  673. // If Bit 31 is 0:
  674. // Bits 1-16 are the backpack position.
  675. // Bits 17-26 are a bool for whether the item is equipped in the matching class.
  676. // Otherwise, if Bit 31 is 1:
  677. // Item hasn't been acknowledged by the player yet.
  678. // Bits 1-16 are the method by the player found the item (see unacknowledged_item_inventory_positions_t)
  679. // Bit 32 is 1, to note the new format.
  680. //
  681. // CURRENT FORMAT:
  682. // If Bit 31 is 0:
  683. // Bits 1-16 are the backpack position.
  684. // Otherwise, if Bit 31 is 1:
  685. // Item hasn't been acknowledged by the player yet.
  686. // Bits 1-16 are the method by the player found the item (see unacknowledged_item_inventory_positions_t)
  687. // Equipped state is stored elsewhere.
  688. // This is the only format that should exist on clients.
  689. // Note (1/15/2013) For backwards compatibility, if the value is 0 item is considered unacknowledged too
  690. enum unacknowledged_item_inventory_positions_t
  691. {
  692. UNACK_ITEM_UNKNOWN = 0,
  693. UNACK_ITEM_DROPPED = 1,
  694. UNACK_ITEM_CRAFTED,
  695. UNACK_ITEM_TRADED,
  696. UNACK_ITEM_PURCHASED,
  697. UNACK_ITEM_FOUND_IN_CRATE,
  698. UNACK_ITEM_GIFTED,
  699. UNACK_ITEM_SUPPORT,
  700. UNACK_ITEM_PROMOTION,
  701. UNACK_ITEM_EARNED,
  702. UNACK_ITEM_REFUNDED,
  703. UNACK_ITEM_GIFT_WRAPPED,
  704. UNACK_ITEM_FOREIGN,
  705. UNACK_ITEM_COLLECTION_REWARD,
  706. UNACK_ITEM_PREVIEW_ITEM,
  707. UNACK_ITEM_PREVIEW_ITEM_PURCHASED,
  708. UNACK_ITEM_PERIODIC_SCORE_REWARD,
  709. UNACK_ITEM_MVM_MISSION_COMPLETION_REWARD,
  710. UNACK_ITEM_MVM_SQUAD_SURPLUS_REWARD,
  711. UNACK_ITEM_FOUND_HOLIDAY_GIFT,
  712. UNACK_ITEM_COMMUNITY_MARKET_PURCHASE,
  713. UNACK_ITEM_RECIPE_OUTPUT,
  714. UNACK_ITEM_HIDDEN_QUEST_ITEM,
  715. UNACK_ITEM_QUEST_OUTPUT,
  716. UNACK_ITEM_QUEST_LOANER,
  717. UNACK_ITEM_TRADE_UP,
  718. UNACK_ITEM_QUEST_MERASMISSION_OUTPUT,
  719. UNACK_ITEM_VIRAL_COMPETITIVE_BETA_PASS_SPREAD,
  720. #ifdef ENABLE_STORE_RENTAL_BACKEND
  721. UNACK_ITEM_RENTAL_PURCHASE,
  722. #endif
  723. UNACK_NUM_METHODS,
  724. };
  725. extern const char *g_pszItemPickupMethodStrings[UNACK_NUM_METHODS - 1]; // -1 because UNACK_ITEM_DROPPED is index 1, not 0
  726. extern const char *g_pszItemPickupMethodStringsUnloc[UNACK_NUM_METHODS - 1];
  727. extern const char *g_pszItemFoundMethodStrings[UNACK_NUM_METHODS - 1];
  728. enum
  729. {
  730. kGCItemSort_NoSort = 0, // this won't do anything, but can be used as a safe "header" value
  731. kGCItemSort_SortByName = 1,
  732. kGCItemSort_SortByDefIndex = 2,
  733. kGCItemSort_SortByRarity = 3,
  734. kGCItemSort_SortByType = 4,
  735. kGCItemSort_SortByDate = 5,
  736. kGCItemSort_GameSpecificBase = 100,
  737. };
  738. // FIXME: these should be moved... somewhere; where?
  739. enum
  740. {
  741. kTFGCItemSort_SortByClass = kGCItemSort_GameSpecificBase + 1,
  742. kTFGCItemSort_SortBySlot = kGCItemSort_GameSpecificBase + 2,
  743. };
  744. enum
  745. {
  746. kBackendPosition_Unacked = 1 << 30,
  747. kBackendPosition_NewFormat = 1 << 31,
  748. kBackendPositionMask_Position = 0x0000ffff,
  749. kBackendPositionMask_FormatFlags = (kBackendPosition_Unacked | kBackendPosition_NewFormat),
  750. };
  751. inline void SetBackpackPosition( uint32 *pPosition, uint32 iPackPosition )
  752. {
  753. (*pPosition) = iPackPosition;
  754. // Remove the unack'd flag
  755. (*pPosition) &= ~kBackendPosition_Unacked;
  756. }
  757. inline bool IsNewPositionFormat( uint32 iBackendPosition )
  758. {
  759. return ( iBackendPosition & kBackendPosition_NewFormat ) != 0;
  760. }
  761. inline bool IsUnacknowledged( uint32 iBackendPosition )
  762. {
  763. // For backwards compatibility, we consider position 0 as unacknowledged too
  764. return (iBackendPosition == 0 || (iBackendPosition & kBackendPosition_Unacked) != 0);
  765. }
  766. inline int ExtractBackpackPositionFromBackend( uint32 iBackendPosition )
  767. {
  768. if ( IsUnacknowledged( iBackendPosition) )
  769. return 0;
  770. return iBackendPosition & kBackendPositionMask_Position;
  771. }
  772. inline unacknowledged_item_inventory_positions_t GetUnacknowledgedReason( uint32 iBackendPosition )
  773. {
  774. return (unacknowledged_item_inventory_positions_t)( iBackendPosition &= ~kBackendPositionMask_FormatFlags );
  775. }
  776. inline uint32 GetUnacknowledgedPositionFor( unacknowledged_item_inventory_positions_t iMethod )
  777. {
  778. return (iMethod | kBackendPosition_Unacked | kBackendPosition_NewFormat);
  779. }
  780. //-----------------------------------------------------------------------------
  781. // Item Preview event IDs for logging.
  782. //-----------------------------------------------------------------------------
  783. enum EEconItemPreviewEventIDs
  784. {
  785. k_EEconItemPreview_Start =1,
  786. k_EEconItemPreview_Expired =2,
  787. k_EEconItemPreview_ItemPurchased =3,
  788. };
  789. //-----------------------------------------------------------------------------
  790. // List of holidays. These are sorted by priority. Needs to match static IIsHolidayActive *s_HolidayChecks
  791. //-----------------------------------------------------------------------------
  792. enum EHoliday
  793. {
  794. kHoliday_None = 0, // must stay at zero for backwards compatibility
  795. kHoliday_TFBirthday,
  796. kHoliday_Halloween,
  797. kHoliday_Christmas,
  798. kHoliday_CommunityUpdate,
  799. kHoliday_EOTL,
  800. kHoliday_Valentines,
  801. kHoliday_MeetThePyro,
  802. kHoliday_FullMoon,
  803. kHoliday_HalloweenOrFullMoon,
  804. kHoliday_HalloweenOrFullMoonOrValentines,
  805. kHoliday_AprilFools,
  806. kHolidayCount,
  807. };
  808. //-----------------------------------------------------------------------------
  809. //
  810. //-----------------------------------------------------------------------------
  811. enum ECartItemType
  812. {
  813. kCartItem_Purchase, // a normal lifetime purchase (needs to stay as entry 0!)
  814. kCartItem_TryOutUpgrade, // an upgrade from "try-it-out"
  815. kCartItem_Rental_1Day,
  816. kCartItem_Rental_3Day,
  817. kCartItem_Rental_7Day,
  818. };
  819. inline bool IsRentalCartItemType( ECartItemType eCartType )
  820. {
  821. return eCartType == kCartItem_Rental_1Day
  822. || eCartType == kCartItem_Rental_3Day
  823. || eCartType == kCartItem_Rental_7Day;
  824. }
  825. const uint8 k_unItemRarity_Any = 0xFF;
  826. const uint8 k_unItemQuality_Any = 0xFF;
  827. typedef int econ_tag_handle_t;
  828. enum EItemUntradability
  829. {
  830. k_Untradability_Temporary = 1<<1,
  831. k_Untradability_Permanent = 1<<2,
  832. };
  833. #define INVALID_ECON_TAG_HANDLE ((econ_tag_handle_t)-1)
  834. #endif // ACTUAL_ECON_ITEM_CONSTANTS_H