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.

710 lines
25 KiB

  1. //====== Copyright 1996-2005, 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. //-----------------------------------------------------------------------------
  23. // Econ Item testing
  24. //-----------------------------------------------------------------------------
  25. #define TESTITEM_DEFINITIONS_BEGIN_AT 32000
  26. #define TESTITEM_DEFINITIONS_COUNT 16
  27. //-----------------------------------------------------------------------------
  28. // Type IDs for economy classes. These are part of the client-GC protocol and
  29. // should not change if it can be helped
  30. // NOTE: if possible fill up the gaps in this enum so that cache objects could
  31. // consume less memory!
  32. //-----------------------------------------------------------------------------
  33. enum EEconTypeID
  34. {
  35. k_EEconTypeItem =1,
  36. k_EEconTypePersonaDataPublic =2,
  37. k_EEconTypeGameAccountClient =7,
  38. k_EEconTypeGameAccount =8,
  39. k_EEconTypeEquipInstance =31,
  40. k_EEconTypeDefaultEquippedDefinitionInstance =42,
  41. k_EEconTypeDefaultEquippedDefinitionInstanceClient =43,
  42. k_EEconTypeCoupon =45,
  43. k_EEconTypeQuest =46,
  44. };
  45. //-----------------------------------------------------------------------------
  46. // Actions for the ItemAudit table
  47. //-----------------------------------------------------------------------------
  48. // WARNING!!! Values stored in DB. Do not renumber!
  49. enum EItemAction
  50. {
  51. k_EItemActionInvalid = -1,
  52. k_EItemActionGSCreate = 0,
  53. k_EItemActionUnpurchase = 1,
  54. k_EItemActionDelete = 2,
  55. k_EItemActionAwardAchievement = 3,
  56. k_EItemActionBanned = 4,
  57. k_EItemActionQuantityChanged = 5,
  58. k_EItemActionRestored = 6,
  59. k_EItemActionAwardTime = 7,
  60. k_EItemActionManualCreate = 8,
  61. k_EItemActionDrop = 9,
  62. k_EItemActionPickUp = 10,
  63. k_EItemActionCraftDestroy = 11,
  64. k_EItemActionCraftCreate = 12,
  65. k_EItemActionLimitExceeded = 13,
  66. k_EItemActionPurchase = 14,
  67. k_EItemActionNameChanged_Add = 15,
  68. k_EItemActionUnlockCrate_Add = 16,
  69. k_EItemActionPaintItem_Add = 17,
  70. k_EItemActionAutoGrantItem = 18,
  71. k_EItemActionCrossGameAchievement = 19,
  72. k_EItemActionAddItemToSocket_Add = 20,
  73. k_EItemActionAddSocketToItem_Add = 21,
  74. k_EItemActionRemoveSocketItem_Add = 22,
  75. k_EItemActionCustomizeItemTexture_Add = 23,
  76. k_EItemActionItemTraded_Add = 24,
  77. k_EItemActionUseItem = 25,
  78. k_EItemActionAwardGift_Receiver = 26,
  79. k_EItemActionNameChanged_Remove = 27,
  80. k_EItemActionUnlockCrate_Remove = 28,
  81. k_EItemActionPaintItem_Remove = 29,
  82. k_EItemActionAddItemToSocket_Remove = 30,
  83. k_EItemActionAddSocketToItem_Remove = 31,
  84. k_EItemActionRemoveSocketItem_Remove = 32,
  85. k_EItemActionCustomizeItemTexture_Remove = 33,
  86. k_EItemActionItemTraded_Remove = 34,
  87. k_EItemActionUnpackItemBundle = 35,
  88. k_EItemActionCreateItemFromBundle = 36,
  89. k_EItemActionAwardStorePromotionItem = 37,
  90. k_EItemActionConvertItem = 38,
  91. k_EItemActionEarnedItem = 39,
  92. k_EItemActionAwardGift_Giver = 40,
  93. k_EItemActionRefundedItem = 41,
  94. k_EItemActionAwardThirdPartyPromo = 42,
  95. k_EItemActionRemoveItemName_Remove = 43,
  96. k_EItemActionRemoveItemName_Add = 44,
  97. k_EItemActionRemoveItemPaint_Remove = 45,
  98. k_EItemActionRemoveItemPaint_Add = 46,
  99. k_EItemActionHalloweenDrop = 47,
  100. k_EItemActionSteamWorkshopContributor = 48,
  101. k_EItemActionSupportDelete = 50,
  102. k_EItemActionSupportCreatedByUndo = 51,
  103. k_EItemActionSupportDeletedByUndo = 52,
  104. k_EItemActionSupportQuantityChangedByUndo = 53,
  105. k_EItemActionSupportRename_Add = 54,
  106. k_EItemActionSupportRename_Remove = 55,
  107. k_EItemActionSupportDescribe_Add = 56,
  108. k_EItemActionSupportDescribe_Remove = 57,
  109. k_EItemActionPeriodicScoreReward_Add = 58,
  110. k_EItemActionPeriodicScoreReward_Remove = 59,
  111. k_EItemActionStrangePartApply_Add = 60,
  112. k_EItemActionStrangePartApply_Remove = 61,
  113. k_EItemActionPennantUpgradeApply_Add = 62,
  114. k_EItemActionPennantUpgradeApply_Remove = 63,
  115. k_EItemActionPaintKitItem_Add = 64,
  116. k_EItemActionPaintKitItem_Remove = 65,
  117. k_EItemActionUpgradeChallengeCoin_Add = 66,
  118. k_EItemActionUpgradeChallengeCoin_Remove = 67,
  119. k_EItemActionStickerApply_Add = 68,
  120. k_EItemActionStickerApply_Remove = 69,
  121. k_EItemActionStickerRemove_Add = 70,
  122. k_EItemActionStickerRemove_Remove = 71,
  123. k_EItemActionGrantQuestReward_Add = 72,
  124. k_EItemActionGrantQuestReward_Remove = 73,
  125. k_EItemActionApplyQuestProgress_Add = 74,
  126. k_EItemActionApplyQuestProgress_Remove = 75,
  127. k_EItemActionPurchaseUnlockCrate_Add = 76,
  128. k_EItemActionPurchaseUnlockCrate_Remove = 77,
  129. k_EItemActionSwapStatTrak_Add = 78,
  130. k_EItemActionSwapStatTrak_Remove = 79,
  131. k_EItemActionPurchaseConsumedAsNonItem = 80,
  132. k_EItemActionDev_ClientLootListRoll = 90,
  133. k_EItemActionGiftWrap_Add = 100,
  134. k_EItemActionGiftWrap_Remove = 101,
  135. k_EItemActionGiftDelivery_Add = 102,
  136. k_EItemActionGiftDelivery_Remove = 103,
  137. k_EItemActionGiftUnwrap_Add = 104,
  138. k_EItemActionGiftUnwrap_Remove = 105,
  139. k_EItemActionPackageItem = 106,
  140. k_EItemActionPackageItem_Revoked = 107,
  141. k_EItemActionHandleMapToken = 108,
  142. k_EItemActionCafeOrSchoolItem_Remove = 109,
  143. k_EItemActionVACBanned_Remove = 110,
  144. k_EItemActionUpgradeThirdPartyPromo = 111,
  145. k_EItemActionExpired = 112,
  146. k_EItemActionTradeRollback_Add = 113,
  147. k_EItemActionTradeRollback_Remove = 114,
  148. k_EItemActionCDKeyGrant = 115,
  149. k_EItemActionCDKeyRevoke = 116,
  150. k_EItemActionWeddingRing_Add = 117,
  151. k_EItemActionWeddingRing_Remove = 118,
  152. k_EItemActionWeddingRing_AddPartner = 119,
  153. k_EItemActionEconSetUnowned = 120,
  154. k_EItemActionEconSetOwned = 121,
  155. k_EItemActionRemoveItemCraftIndex_Remove = 150,
  156. k_EItemActionRemoveItemCraftIndex_Add = 151,
  157. k_EItemActionRemoveItemMakersMark_Remove = 152, // early versions of this will be in the database as 150
  158. k_EItemActionRemoveItemMakersMark_Add = 153, // early versions of this will be in the database as 151 because I am a terrible person
  159. k_EItemActionCollectItem_CollectedItem = 154,
  160. k_EItemActionCollectItem_UpdateCollection = 155,
  161. k_EItemActionCollectItem_RemoveCollection = 156,
  162. k_EItemActionCollectItem_RedeemCollectionReward = 157,
  163. k_EItemActionPreviewItem_BeginPreviewPeriod = 158,
  164. k_EItemActionPreviewItem_EndPreviewPeriodExpired = 159,
  165. k_EItemActionPreviewItem_EndPreviewPeriodItemBought = 160,
  166. k_EItemActionRecycling = 161,
  167. k_EItemActionAwardXP = 162,
  168. k_EItemActionTournamentDrop = 163,
  169. k_EItemDiretideReward = 164,
  170. k_EItemDiretideEggAddOnModify = 165,
  171. k_EItemDiretideEssenceRemove = 166,
  172. k_EItemDiretideEggRemoveOnModify = 167,
  173. k_EItemActionUnpackItems = 168,
  174. k_EItemActionUnlockStyle = 169,
  175. k_EItemActionUnlockStyle_Remove = 170,
  176. k_EItemActionTutorialDrop = 171,
  177. k_EItemActionAutographAdd = 172,
  178. k_EItemActionAutographRemove = 173,
  179. k_EItemActionApplyIntermediateStickerWear = 174,
  180. k_EItemActionTemplateItemGrant = 175,
  181. k_EItemActionCoinCampaignProgress = 176,
  182. k_EItemActionMarket_Add = 177,
  183. k_EItemActionMarket_Remove = 178,
  184. // Let's be consistent with the underscores please.
  185. // k_EItemActionYourNewAction, not k_EItemAction_YourNewAction
  186. // Yes, it matters. See PchLocalizedNameFromEItemAction for why.
  187. };
  188. extern const char *PchNameFromEItemAction( EItemAction eAction );
  189. extern const char *PchNameFromEItemActionUnsafe( EItemAction eAction );
  190. extern bool BIsActionCreative( EItemAction );
  191. extern bool BIsActionDestructive( EItemAction );
  192. enum EItemActionMissingBehavior { kEItemAction_FriendlyNameLookup_ReturnNULLIfMissing, kEItemAction_FriendlyNameLookup_ReturnDummyStringIfMissing };
  193. extern const char *PchFriendlyNameFromEItemAction( EItemAction eAction, EItemActionMissingBehavior eMissingBehavior );
  194. extern const char *PchLocalizedNameFromEItemAction( EItemAction eAction, CLocalizationProvider &localizationProvider );
  195. //-----------------------------------------------------------------------------
  196. // Purpose: Used to pass audit actions to asset servers for SetUnowned and
  197. // SetOwned methods.
  198. //-----------------------------------------------------------------------------
  199. enum EEconOwnershipAction
  200. {
  201. k_EEconOwnershipAction_Invalid = 0,
  202. k_EEconOwnershipAction_TradeBase = 100,
  203. k_EEconOwnershipAction_TradeCommit = 101, // precommit and docommit step of a trade. Reference is trade ID
  204. k_EEconOwnershipAction_TradeRollback = 102, // cancelcommit and rollbackcommit step of a trade. Reference is trade ID
  205. };
  206. // old
  207. enum eEconItemFlags_Deprecated
  208. {
  209. kDeprecated_EconItemFlag_AchievementGrantedItem = 1 << 0,
  210. kDeprecated_EconItemFlag_CannotTrade = 1 << 1,
  211. kDeprecated_EconItemFlag_Purchased = 1 << 2,
  212. kDeprecated_EconItemFlag_CannotBeUsedInCrafting = 1 << 3,
  213. kDeprecated_EconItemFlag_Promotion = 1 << 4,
  214. };
  215. //-----------------------------------------------------------------------------
  216. // Flags for CEconItem
  217. //-----------------------------------------------------------------------------
  218. // WARNING!!! Values stored in DB. DO NOT CHANGE EXISTING VALUES. Add values to the end.
  219. enum eEconItemFlags
  220. {
  221. kEconItemFlag_CannotTrade = 1 << 0,
  222. kEconItemFlag_CannotBeUsedInCrafting = 1 << 1,
  223. kEconItemFlag_CanBeTradedByFreeAccounts = 1 << 2,
  224. 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.
  225. #ifdef CLIENT_DLL
  226. #ifdef TF_CLIENT_DLL
  227. kEconItemFlagClient_ForceBlueTeam = 1 << 5,
  228. #endif // TF_CLIENT_DLL
  229. kEconItemFlagClient_StoreItem = 1 << 6,
  230. kEconItemFlagClient_Preview = 1 << 7, // only set on the client; means "this item is being previewed"
  231. #endif // CLIENT_DLL
  232. // combination of the above flags used in code
  233. kEconItemFlags_CheckFlags_CannotTrade = kEconItemFlag_CannotTrade,
  234. kEconItemFlags_CheckFlags_NotUsableInCrafting = kEconItemFlag_CannotBeUsedInCrafting,
  235. kEconItemFlags_CheckFlags_AllGCFlags = kEconItemFlags_CheckFlags_CannotTrade | kEconItemFlags_CheckFlags_NotUsableInCrafting,
  236. };
  237. //-----------------------------------------------------------------------------
  238. // Origin for an item for CEconItem
  239. //-----------------------------------------------------------------------------
  240. // WARNING!!! Values stored in DB. DO NOT CHANGE EXISTING VALUES. Add values to the end.
  241. enum eEconItemOrigin
  242. {
  243. kEconItemOrigin_Invalid = -1, // should never be stored in the DB! used to indicate "invalid" for in-memory objects only
  244. kEconItemOrigin_Drop = 0,
  245. kEconItemOrigin_Achievement,
  246. kEconItemOrigin_Purchased,
  247. kEconItemOrigin_Traded,
  248. kEconItemOrigin_Crafted,
  249. kEconItemOrigin_StorePromotion,
  250. kEconItemOrigin_Gifted,
  251. kEconItemOrigin_SupportGranted,
  252. kEconItemOrigin_FoundInCrate,
  253. kEconItemOrigin_Earned,
  254. kEconItemOrigin_ThirdPartyPromotion,
  255. kEconItemOrigin_GiftWrapped,
  256. kEconItemOrigin_HalloweenDrop,
  257. kEconItemOrigin_PackageItem,
  258. kEconItemOrigin_Foreign,
  259. kEconItemOrigin_CDKey,
  260. kEconItemOrigin_CollectionReward,
  261. kEconItemOrigin_PreviewItem,
  262. kEconItemOrigin_SteamWorkshopContribution,
  263. kEconItemOrigin_PeriodicScoreReward,
  264. kEconItemOrigin_Recycling,
  265. kEconItemOrigin_TournamentDrop,
  266. kEconItemOrigin_StockItem,
  267. KEconItemOrigin_QuestReward,
  268. KEconItemOrigin_LevelUpReward,
  269. kEconItemOrigin_Max,
  270. };
  271. extern const char *PchNameFromeEconItemOrigin( eEconItemOrigin eOrigin );
  272. // The Steam backend representation of a unique item index
  273. typedef uint64 itemid_t;
  274. typedef uint16 item_definition_index_t;
  275. typedef uint16 attrib_definition_index_t;
  276. typedef uint32 attrib_value_t;
  277. // Misc typedefs for clarity.
  278. typedef uint32 equip_region_mask_t;
  279. typedef uint8 style_index_t;
  280. const uint64 INVALID_ITEM_ID = (itemid_t)-1;
  281. const item_definition_index_t INVALID_ITEM_DEF_INDEX = ((item_definition_index_t)-1);
  282. const attrib_definition_index_t INVALID_ATTRIB_DEF_INDEX= ((attrib_definition_index_t)-1);
  283. //-----------------------------------------------------------------------------
  284. // Standard/default backpack size
  285. #define DEFAULT_NUM_BACKPACK_SLOTS_PER_PAGE 100
  286. #define DEFAULT_NUM_BACKPACK_SLOTS 1000
  287. #define DEFAULT_NUM_BACKPACK_SLOTS_FREE_TRIAL_ACCOUNT 100
  288. #define MAX_NUM_BACKPACK_SLOTS 2000
  289. // Current item level range
  290. #define MIN_ITEM_LEVEL 0
  291. #define MAX_ITEM_LEVEL 100
  292. // Maximum number of attributes allowed on a single item
  293. #define MAX_ATTRIBUTES_PER_ITEM 32
  294. // The maximum length of a single attribute's description
  295. // divide by locchar_t, so we can ensure 192 bytes, whether that's 128 wchars on client or 256 utf-8 bytes on gc
  296. #define MAX_ATTRIBUTE_DESCRIPTION_LENGTH ( 256 / sizeof( locchar_t ) )
  297. // The maximum length of an item's name
  298. #define MAX_ITEM_NAME_LENGTH 128
  299. #define MAX_ITEM_DESC_LENGTH 256
  300. #define MAX_ITEM_LONG_DESC_LENGTH 2048
  301. // The maximum length of an item description. (Extra +1 line is for the base item type line)
  302. // #define MAX_ITEM_DESCRIPTION_LENGTH ((MAX_ATTRIBUTES_PER_ITEM+1) * MAX_ATTRIBUTE_DESCRIPTION_LENGTH)
  303. // For custom user-naming of econ items.
  304. #define MAX_ITEM_CUSTOM_NAME_LENGTH 40
  305. #define MAX_ITEM_CUSTOM_NAME_DATABASE_SIZE ((4 * MAX_ITEM_CUSTOM_NAME_LENGTH) + 1) // Ensures we can store MAX_ITEM_CUSTOM_NAME_LENGTH
  306. // characters worth of obscure unicode characters in UTF8
  307. #define MAX_ITEM_CUSTOM_DESC_LENGTH 80
  308. #define MAX_ITEM_CUSTOM_DESC_DATABASE_SIZE ((4 * MAX_ITEM_CUSTOM_DESC_LENGTH) + 1)
  309. // max length in the DB for claim codes
  310. #define MAX_CLAIM_CODE_LENGTH 128
  311. // The number of items to work on in a job before checking if a yield is necessary
  312. #define MAX_ITEMS_BEFORE_YIELD 50
  313. // TF team-color paints (moved from econ_item_view.h)
  314. #define RGB_INT_RED 12073019
  315. #define RGB_INT_BLUE 5801378
  316. // Custom textures
  317. const int k_nCustomImageSize = 256;
  318. const int k_nMaxCustomImageFileSize = k_nCustomImageSize*k_nCustomImageSize*4 + 4*1024; // Is this about right?
  319. //-----------------------------------------------------------------------------
  320. // Purpose: Quality types of items
  321. //-----------------------------------------------------------------------------
  322. typedef int32 entityquality_t;
  323. enum EEconItemQuality
  324. {
  325. AE_UNDEFINED = -1,
  326. AE_NORMAL = 0,
  327. AE_GENUINE = 1,
  328. AE_VINTAGE,
  329. AE_UNUSUAL,
  330. AE_UNIQUE,
  331. AE_COMMUNITY,
  332. AE_DEVELOPER,
  333. AE_SELFMADE,
  334. AE_CUSTOMIZED,
  335. AE_STRANGE,
  336. AE_COMPLETED,
  337. AE_HAUNTED,
  338. AE_TOURNAMENT,
  339. AE_FAVORED,
  340. AE_MAX_TYPES,
  341. };
  342. //-----------------------------------------------------------------------------
  343. // Purpose: colors used in the display of attributes
  344. //-----------------------------------------------------------------------------
  345. enum attrib_colors_t
  346. {
  347. ATTRIB_COL_LEVEL = 0,
  348. ATTRIB_COL_NEUTRAL,
  349. ATTRIB_COL_POSITIVE,
  350. ATTRIB_COL_NEGATIVE,
  351. ATTRIB_COL_ITEMSET_NAME,
  352. ATTRIB_COL_ITEMSET_EQUIPPED,
  353. ATTRIB_COL_ITEMSET_MISSING,
  354. ATTRIB_COL_BUNDLE_ITEM,
  355. ATTRIB_COL_LIMITED_USE,
  356. ATTRIB_COL_ITEM_FLAGS,
  357. ATTRIB_COL_RARITY_DEFAULT,
  358. ATTRIB_COL_RARITY_COMMON,
  359. ATTRIB_COL_RARITY_UNCOMMON,
  360. ATTRIB_COL_RARITY_RARE,
  361. ATTRIB_COL_RARITY_MYTHICAL,
  362. ATTRIB_COL_RARITY_LEGENDARY,
  363. ATTRIB_COL_RARITY_ANCIENT,
  364. ATTRIB_COL_RARITY_IMMORTAL,
  365. ATTRIB_COL_RARITY_ARCANA,
  366. ATTRIB_COL_STRANGE,
  367. ATTRIB_COL_UNUSUAL,
  368. NUM_ATTRIB_COLORS,
  369. };
  370. #define AE_USE_SCRIPT_VALUE 9999 // Can't be -1, due to unsigned ints used on the backend
  371. const char *EconQuality_GetQualityString( EEconItemQuality eQuality );
  372. const char *EconQuality_GetColorString( EEconItemQuality eQuality );
  373. const char *EconQuality_GetLocalizationString( EEconItemQuality eQuality );
  374. // Sort order for rarities
  375. int EconQuality_GetRarityScore( EEconItemQuality eQuality );
  376. int EconRarity_CombinedItemAndPaintRarity( int nItemDefRarity, int nPaintRarity );
  377. int EconWear_ToIntCategory( float flWear );
  378. float EconWear_FromIntCategory( int nWearCategory );
  379. int EconMinutes_ToRoundMinHrsCategory( float flMinutes );
  380. float EconMinutes_FromRoundMinHrsCategory( int nRoundMinHrsCategory );
  381. int EconTintID_ToRoundCategory( uint32 unTintID );
  382. uint32 EconTintID_FromRoundCategory( int nRoundCategory );
  383. extern attrib_colors_t GetAttribColorIndexForName( const char* pszName );
  384. extern const char *GetColorNameForAttribColor( attrib_colors_t unAttribColor );
  385. extern const char *GetHexColorForAttribColor( attrib_colors_t unAttribColor );
  386. // Utility function that'll get you an item quality from a string
  387. entityquality_t GetItemQualityFromString( const char *sQuality );
  388. enum recipecategories_t
  389. {
  390. RECIPE_CATEGORY_CRAFTINGITEMS = 0,
  391. RECIPE_CATEGORY_COMMONITEMS,
  392. RECIPE_CATEGORY_RAREITEMS,
  393. RECIPE_CATEGORY_SPECIAL,
  394. NUM_RECIPE_CATEGORIES
  395. };
  396. extern const char *g_szRecipeCategoryStrings[NUM_RECIPE_CATEGORIES];
  397. //-----------------------------------------------------------------------------
  398. // Kill eater support.
  399. //-----------------------------------------------------------------------------
  400. enum kill_eater_event_t
  401. {
  402. kKillEaterEvent_PlayerKill = 0,
  403. kKillEaterEvent_MVPs,
  404. // kKillEaterEvent_KillAssists, // not yet implemented
  405. // kKillEaterEvent_Wins,
  406. // kKillEaterEvent_Treants_Created,
  407. // kKillEaterEvent_Omnislash_Jumps,
  408. // kKillEaterEvent_Blade_Fury_Damage,
  409. // kKillEaterEvent_Blade_Dance_Crits,
  410. // kKillEaterEvent_Wards_Placed,
  411. // kKillEaterEvent_Killing_Sprees, // not yet implemented
  412. // kKillEaterEvent_Trees_Created,
  413. // kKillEaterEvent_Carries_Killed, // not yet implemented
  414. // kKillEaterEvent_First_Blood,
  415. // kKillEaterEvent_Godlike,
  416. // kKillEaterEvent_Gold_Earned,
  417. // kKillEaterEvent_Gold_Spent,
  418. // kKillEaterEvent_Towers_Destroyed,
  419. // kKillEaterEventType_Bounty_TrackedKills,
  420. // kKillEaterEventType_Bounty_TrackedInvisKills,
  421. // kKillEaterEventType_Bounty_InvisJinadaHits,
  422. // kKillEaterEventType_Bounty_TrackGold,
  423. // kKillEaterEventType_Tide_GoodRavages,
  424. // kKillEaterEventType_Windrunner_DoubleShackles,
  425. // kKillEaterEventType_Windrunner_GoodPowershots,
  426. // kKillEaterEventType_Invoker_SunstrikeKills,
  427. // kKillEaterEventType_Couriers_Purchased,
  428. // kKillEaterEventType_Wards_Purchased,
  429. // kKillEaterEventType_Tide_EnemiesGushed,
  430. // kKillEaterEventType_Axe_Culls,
  431. // kKillEaterEventType_Axe_BattleHungerKills,
  432. // kKillEaterEventType_Axe_LowHealthKills,
  433. // kKillEaterEventType_Axe_CalledDamageDone,
  434. // kKillEaterEventType_Axe_CalledDamageTaken,
  435. // kKillEaterEventType_Invoker_TornadoKills,
  436. // kKillEaterEventType_Games_Viewed,
  437. // kKillEaterEventType_Sven_DoubleStuns,
  438. // kKillEaterEventType_Sven_WarcryAssists,
  439. // kKillEaterEventType_Sven_CleaveDoubleKills,
  440. // kKillEaterEventType_Sven_TeleportInterrupts,
  441. // kKillEaterEventType_Faceless_MultiChrono,
  442. // kKillEaterEventType_Faceless_ChronoKills,
  443. // kKillEaterEventType_Ursa_MultiShocks,
  444. // kKillEaterEventType_RoshanKills,
  445. // NEW ENTRIES MUST BE ADDED AT THE BOTTOM
  446. };
  447. // Make sure to update this when you add a new type.
  448. bool EventRequiresVictim( kill_eater_event_t ke_event );
  449. // Ugh -- these are shared between the GC and the client. Maybe #define is slightly better than
  450. // magic string literals?
  451. #define KILL_EATER_RANK_LEVEL_BLOCK_NAME "KillEaterRank"
  452. int GetKillEaterAttrPairCount();
  453. const class CEconItemAttributeDefinition *GetKillEaterAttrPair_Score( int i );
  454. const class CEconItemAttributeDefinition *GetKillEaterAttrPair_Type( int i );
  455. bool GetKillEaterAttrPair_IsUserCustomizable( int i );
  456. //===============================================================================================================
  457. // POSITION HANDLING
  458. //===============================================================================================================
  459. // TF Inventory Position cracking
  460. // REALLY OLD FORMAT (??):
  461. // We store a bag index in the highbits of the inventory position.
  462. // The lowbit stores the position of the item within the bag.
  463. //
  464. // LESS OLD FORMAT (up through July, 2011):
  465. // If Bit 31 is 0:
  466. // Bits 1-16 are the backpack position.
  467. // Bits 17-26 are a bool for whether the item is equipped in the matching class.
  468. // Otherwise, if Bit 31 is 1:
  469. // Item hasn't been acknowledged by the player yet.
  470. // Bits 1-16 are the method by the player found the item (see unacknowledged_item_inventory_positions_t)
  471. // Bit 32 is 1, to note the new format.
  472. //
  473. // CURRENT FORMAT:
  474. // If Bit 31 is 0:
  475. // Bits 1-16 are the backpack position.
  476. // Otherwise, if Bit 31 is 1:
  477. // Item hasn't been acknowledged by the player yet.
  478. // Bits 1-16 are the method by the player found the item (see unacknowledged_item_inventory_positions_t)
  479. // Equipped state is stored elsewhere.
  480. // This is the only format that should exist on clients.
  481. enum unacknowledged_item_inventory_positions_t
  482. {
  483. UNACK_ITEM_DROPPED = 1,
  484. UNACK_ITEM_CRAFTED,
  485. UNACK_ITEM_TRADED,
  486. UNACK_ITEM_PURCHASED,
  487. UNACK_ITEM_FOUND_IN_CRATE,
  488. UNACK_ITEM_GIFTED,
  489. UNACK_ITEM_SUPPORT,
  490. UNACK_ITEM_PROMOTION,
  491. UNACK_ITEM_EARNED,
  492. UNACK_ITEM_REFUNDED,
  493. UNACK_ITEM_GIFT_WRAPPED,
  494. UNACK_ITEM_FOREIGN,
  495. UNACK_ITEM_COLLECTION_REWARD,
  496. UNACK_ITEM_PREVIEW_ITEM,
  497. UNACK_ITEM_PREVIEW_ITEM_PURCHASED,
  498. UNACK_ITEM_PERIODIC_SCORE_REWARD,
  499. UNACK_ITEM_RECYCLING,
  500. UNACK_ITEM_TOURNAMENT_DROP,
  501. UNACK_ITEM_QUEST_REWARD,
  502. UNACK_ITEM_LEVEL_UP_REWARD,
  503. #ifdef ENABLE_STORE_RENTAL_BACKEND
  504. UNACK_ITEM_RENTAL_PURCHASE,
  505. #endif
  506. UNACK_NUM_METHODS,
  507. };
  508. extern const char *g_pszItemPickupMethodStrings[UNACK_NUM_METHODS];
  509. extern const char *g_pszItemPickupMethodStringsUnloc[UNACK_NUM_METHODS];
  510. extern const char *g_pszItemFoundMethodStrings[UNACK_NUM_METHODS];
  511. enum
  512. {
  513. kGCItemSort_NoSort = 0, // this won't do anything, but can be used as a safe "header" value
  514. kGCItemSort_SortByName = 1,
  515. kGCItemSort_SortByDefIndex = 2,
  516. kGCItemSort_SortByRarity = 3,
  517. kGCItemSort_SortByType = 4,
  518. kGCItemSort_SortByQuality = 5,
  519. kGCItemSort_GameSpecificBase = 100,
  520. };
  521. // FIXME: these should be moved... somewhere; where?
  522. enum
  523. {
  524. kTFGCItemSort_SortByClass = kGCItemSort_GameSpecificBase + 1,
  525. kTFGCItemSort_SortBySlot = kGCItemSort_GameSpecificBase + 2,
  526. kDOTAGCItemSort_SortByHero = kGCItemSort_GameSpecificBase + 3,
  527. };
  528. enum
  529. {
  530. kBackendPosition_Unacked = 1 << 30,
  531. kBackendPosition_Reserved = 1 << 31,
  532. kBackendPositionMask_Position = 0x0000ffff,
  533. kBackendPositionMask_FormatFlags = (kBackendPosition_Unacked | kBackendPosition_Reserved),
  534. };
  535. inline void SetBackpackPosition( uint32 *pPosition, uint32 iPackPosition )
  536. {
  537. (*pPosition) = iPackPosition;
  538. // Remove the unack'd flag
  539. (*pPosition) &= ~kBackendPosition_Unacked;
  540. }
  541. inline bool IsUnacknowledged( uint32 iBackendPosition )
  542. {
  543. // For backwards compatibility, we consider position 0 as unacknowledged too
  544. return ( iBackendPosition == 0 || (iBackendPosition & kBackendPosition_Unacked) != 0 );
  545. }
  546. inline int ExtractBackpackPositionFromBackend( uint32 iBackendPosition )
  547. {
  548. if ( IsUnacknowledged( iBackendPosition) )
  549. return 0;
  550. return iBackendPosition & kBackendPositionMask_Position;
  551. }
  552. inline unacknowledged_item_inventory_positions_t GetUnacknowledgedReason( uint32 iBackendPosition )
  553. {
  554. return (unacknowledged_item_inventory_positions_t)( iBackendPosition &= ~kBackendPositionMask_FormatFlags );
  555. }
  556. inline uint32 GetUnacknowledgedPositionFor( unacknowledged_item_inventory_positions_t iMethod )
  557. {
  558. return ( iMethod | kBackendPosition_Unacked | kBackendPosition_Reserved );
  559. }
  560. //-----------------------------------------------------------------------------
  561. // Item Preview event IDs for logging.
  562. //-----------------------------------------------------------------------------
  563. enum EEconItemPreviewEventIDs
  564. {
  565. k_EEconItemPreview_Start =1,
  566. k_EEconItemPreview_Expired =2,
  567. k_EEconItemPreview_ItemPurchased =3,
  568. };
  569. //-----------------------------------------------------------------------------
  570. //
  571. //-----------------------------------------------------------------------------
  572. enum EHoliday
  573. {
  574. kHoliday_None = 0, // must stay at zero for backwards compatability
  575. kHoliday_Halloween,
  576. kHoliday_Christmas,
  577. kHoliday_FullMoon,
  578. kHoliday_HalloweenOrFullMoon,
  579. kHoliday_Easter,
  580. kHolidayCount,
  581. };
  582. //-----------------------------------------------------------------------------
  583. //
  584. //-----------------------------------------------------------------------------
  585. enum ECartItemType
  586. {
  587. kCartItem_Purchase, // a normal lifetime purchase (needs to stay as entry 0!)
  588. kCartItem_TryOutUpgrade, // an upgrade from "try-it-out"
  589. kCartItem_Rental_1Day,
  590. kCartItem_Rental_3Day,
  591. kCartItem_Rental_7Day,
  592. };
  593. void GetHexStringFromPaintColor( float flPaint, char *pszRGB );
  594. inline bool IsRentalCartItemType( ECartItemType eCartType )
  595. {
  596. return eCartType == kCartItem_Rental_1Day
  597. || eCartType == kCartItem_Rental_3Day
  598. || eCartType == kCartItem_Rental_7Day;
  599. }
  600. #endif // ACTUAL_ECON_ITEM_CONSTANTS_H