econmanager.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef _INCLUDE_DYNATTRIB_ECON_MANAGER_H_
  2. #define _INCLUDE_DYNATTRIB_ECON_MANAGER_H_
  3. #include "mmsplugin.h"
  4. #include <utlmap.h>
  5. #include <utlstring.h>
  6. #include <KeyValues.h>
  7. class ISchemaAttributeType;
  8. // this may need to be updated in the future
  9. class CEconItemAttributeDefinition
  10. {
  11. public:
  12. // TODO implementing ~CEconItemAttributeDefinition segfaults. not sure what's up.
  13. // ideally we implement it to match the game so InsertOrReplace is sure to work correctly
  14. /* 0x00 */ KeyValues *m_KeyValues;
  15. /* 0x04 */ unsigned short m_iIndex;
  16. /* 0x08 */ ISchemaAttributeType *m_AttributeType;
  17. /* 0x0c */ bool m_bHidden;
  18. /* 0x0d */ bool m_bForceOutputDescription;
  19. /* 0x0e */ bool m_bStoreAsInteger;
  20. /* 0x0f */ bool m_bInstanceData;
  21. /* 0x10 */ int m_iAssetClassExportType;
  22. /* 0x14 */ int m_iAssetClassBucket;
  23. /* 0x18 */ bool m_bIsSetBonus;
  24. /* 0x1c */ int m_iIsUserGenerated;
  25. /* 0x20 */ int m_iEffectType;
  26. /* 0x24 */ int m_iDescriptionFormat;
  27. /* 0x28 */ char *m_pszDescriptionString;
  28. /* 0x2c */ char *m_pszArmoryDesc;
  29. /* 0x30 */ char *m_pszName;
  30. /* 0x34 */ char *m_pszAttributeClass;
  31. /* 0x38 */ bool m_bCanAffectMarketName;
  32. /* 0x39 */ bool m_bCanAffectRecipeCompName;
  33. /* 0x3c */ int m_nTagHandle;
  34. /* 0x40 */ string_t m_iszAttributeClass;
  35. };
  36. // handles
  37. class CEconManager {
  38. public:
  39. bool Init(char *error, size_t maxlength);
  40. bool InsertOrReplaceAttribute(KeyValues *pAttribKV);
  41. };
  42. // binary refers to 0x58 when iterating over the attribute map, so we'll refer to that value
  43. // we could also do a runtime assertion
  44. static_assert(sizeof(CEconItemAttributeDefinition) + 0x14 == 0x58, "CEconItemAttributeDefinition size mismatch");
  45. extern CEconManager g_EconManager;
  46. #endif // _INCLUDE_DYNATTRIB_ECON_MANAGER_H_