tf_econ_dynamic.inc 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /**
  2. * An InjectedAttribute is an abstraction over the KeyValues representation of an attribute
  3. * definition.
  4. */
  5. methodmap TF2EconDynAttribute < Handle {
  6. /**
  7. * Creates a new, empty TF2EconDynAttribute handle.
  8. *
  9. * The attribute is not injected into the schema until TF2EconDynAttribute.Register() is
  10. * called.
  11. *
  12. * This handle should be freed by the calling plugin.
  13. */
  14. public native TF2EconDynAttribute();
  15. /**
  16. * Sets the attribute class. All values under the same attribute class are combined.
  17. * This is required.
  18. */
  19. public native void SetClass(const char[] attrClass);
  20. /**
  21. * Sets the attribute name. Only one instance of this per game entity can be active.
  22. * If this is empty or NULL_STRING, it will be set to the attribute class on registration.
  23. */
  24. public native void SetName(const char[] attrName);
  25. /**
  26. * Sets the description format. This determines how multiple values with the same attribute
  27. * class are combined.
  28. *
  29. * Generally, "value_is_additive" and "value_is_percentage" are the main ones that matter,
  30. * but being precise is ideal in case you want to use the description format when displaying
  31. * values to players as with actual schema attributes.
  32. */
  33. public native void SetDescriptionFormat(const char[] attrDescFmt);
  34. /**
  35. * Sets a custom key / value pair.
  36. *
  37. * Note that "injected" is a key reserved by the plugin that is set to 1 when registered,
  38. * overriding any other values set.
  39. *
  40. * The game has set other keys in the schema in the past, and it may use new ones in the
  41. * future.
  42. */
  43. public native void SetCustom(const char[] key, const char[] value);
  44. /**
  45. * Sets the attribute's definition index.
  46. *
  47. * By default, the extension will automatically allocate a previously unused index. As the
  48. * schema may be reloaded between maps, there is no guarantee that an attribute will
  49. * continue to exist at a specific index. If an index is manually specified and a
  50. * attribute now exists at the index, the injection of the attribute will fail.
  51. *
  52. * Plugins are expected to either perform a lookup by attribute name, or preferably, use the
  53. * hook-style natives with the attribute class.
  54. *
  55. * This native is solely provided for backwards compatibility with schema formats that
  56. * manually specify indices.
  57. */
  58. public native void SetDefIndex(int attrdef);
  59. /**
  60. * Clears the attribute's specified definition index.
  61. */
  62. public native void ClearDefIndex();
  63. /**
  64. * Stores a copy of the attribute properties in the core plugin to be injected.
  65. *
  66. * This operation does not clear existing values on the TF2EconDynAttribute, so you can
  67. * create multiple attributes by repeatedly calling TF2EconDynAttribute.SetName() and
  68. * TF2EconDynAttribute.Register().
  69. *
  70. * If an attribute with the same name already exists and is not an injected attribute
  71. * managed by the core plugin, this will fail.
  72. *
  73. * The attribute definition index may be reallocated if a new copy of the schema is loaded
  74. * in and the index is occupied by a non-injected attribute.
  75. */
  76. public native bool Register();
  77. /**
  78. * Imports the properties of an attribute by name to the TF2EconDynAttribute handle,
  79. * replacing all values currently set.
  80. *
  81. * @return True if the attribute exists, otherwise false.
  82. */
  83. // TODO this isn't implemented yet
  84. // public native bool Import(const char[] name);
  85. /**
  86. * Resets the container to its initial state.
  87. */
  88. public native void Clear();
  89. }
  90. /**
  91. * Do not edit below this line!
  92. */
  93. public Extension __ext_tf_econ_dynamic =
  94. {
  95. name = "TF2 Econ Dynamic",
  96. file = "tf2econdynamic.ext",
  97. #if defined AUTOLOAD_EXTENSIONS
  98. autoload = 1,
  99. #else
  100. autoload = 0,
  101. #endif
  102. #if defined REQUIRE_EXTENSIONS
  103. required = 1,
  104. #else
  105. required = 0,
  106. #endif
  107. };