inventoryslots.c 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /**@class InventorySlots
  2. * @brief provides access to slot configuration
  3. **/
  4. class InventorySlots
  5. {
  6. /**@NOTE: engine pre-populates this class with first 32 slots from CfgSlots (uppercased)
  7. **/
  8. /** \name C++ constants
  9. Constants filled in from C++
  10. */
  11. //@{
  12. //! Amount of pre-populated slots (32)
  13. const int COUNT;
  14. //! Invalid slot (-1)
  15. const int INVALID;
  16. //@}
  17. #ifdef DIAG_DEVELOPER
  18. private void InventorySlots() {}
  19. private void ~InventorySlots() {}
  20. #else
  21. void InventorySlots() {}
  22. void ~InventorySlots() {}
  23. #endif
  24. /**@fn GetSlotIdFromString
  25. * @brief converts string to slot_id
  26. * @param[in] slot_name \p slot name to be find.
  27. * @return slot id or InventorySlots.INVALID
  28. *
  29. * @example
  30. * int slot = InventorySlots.GetSlotIdFromString("FireWood");
  31. * if (slot != InventorySlots.INVALID)
  32. *
  33. * @NOTE the example looks in the DZ/data/config.cpp and searches for class entry Slot_##slot_name
  34. * class Slot_Firewood { whatever };
  35. *
  36. * i.e. it does NOT look at name= or displayName= attributes of the entry!
  37. **/
  38. static proto native int GetSlotIdFromString(string slot_name);
  39. /**@fn GetSlotName
  40. * @brief converts slot_id to string
  41. * @param[in] slot_id \p slot id to be find.
  42. * @return string or null string
  43. **/
  44. static proto native owned string GetSlotName(int id);
  45. /**@fn GetSlotDisplayName
  46. * @brief converts slot_id to string
  47. * @param[in] slot_id \p slot id to be find.
  48. * @return string or null string
  49. **/
  50. static proto native owned string GetSlotDisplayName(int id);
  51. /**@fn IsSlotIdValid
  52. * @brief verifies existence of the slot id
  53. * @return true if slot valid
  54. **/
  55. static proto native bool IsSlotIdValid(int slotId);
  56. /**@fn GetStackMaxForSlotId
  57. * @param[in] slot_id \p queried slot
  58. * @return stackMax attribute from corresponding entry (or default value == 1)
  59. **/
  60. static proto native int GetStackMaxForSlotId(int slot_Id);
  61. /**@fn GetShowForSlotId
  62. * @param[in] slot_id \p queried slot
  63. * @return show attribute from corresponding entry (or default value == true)
  64. **/
  65. static proto native bool GetShowForSlotId(int slot_Id);
  66. /**@fn GetAutoAttachForSlotId
  67. * @param[in] slot_id \p queried slot
  68. * @return auto attach attribute from corresponding entry (or default value == 1)
  69. **/
  70. static proto native bool GetAutoAttachForSlotId(int slot_Id);
  71. /**@fn GetBoneNameForSlotId
  72. * @param[in] slot_id \p queried slot
  73. * @param[out] bone_name \p selection filled with attribute from corresponding entry
  74. * @return true if slot valid
  75. **/
  76. static proto bool GetBoneNameForSlotId(int slot_Id, out string bone_name);
  77. /**@fn GetSelectionForSlotId
  78. * @param[in] slot_id \p queried slot
  79. * @param[out] selection \p selection filled with attribute from corresponding entry
  80. * @return true if slot valid
  81. **/
  82. static proto bool GetSelectionForSlotId(int slot_Id, out string selection);
  83. /**@fn GetBoneIndexForSlotId
  84. * @param[in] slot_id \p queried slot
  85. * @return stackMax attribute from corresponding entry (or default value == 1)
  86. **/
  87. //static proto native int GetBoneIndexForSlotId (int slot_Id);
  88. };