item_group.txt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. //===== rAthena Documentation ================================
  2. //= Item Database
  3. //===== By: ==================================================
  4. //= rAthena Dev Team
  5. //===== Last Updated: ========================================
  6. //= 20210624
  7. //===== Description: =========================================
  8. //= Explanation of the item_group.yml file and structure.
  9. //============================================================
  10. Items within an item group can be retrieved through the 'groupranditem',
  11. 'getrandgroupitem', and 'getgroupitem' script commands.
  12. The table below explains which fields are accessed in each.
  13. +===============+=================+====================+================+
  14. | Field | 'groupranditem' | 'getrandgroupitem' | 'getgroupitem' |
  15. +===============+=================+====================+================+
  16. | GroupID | YES | YES | YES |
  17. +===============+=================+====================+================+
  18. | Item | YES | YES | YES |
  19. +===============+=================+====================+================+
  20. | Rate | YES | YES | YES |
  21. +===============+=================+====================+================+
  22. | Amount | no | OPTIONAL | YES |
  23. +===============+=================+====================+================+
  24. | SubGroup | OPTIONAL | OPTIONAL | YES |
  25. +===============+=================+====================+================+
  26. | Announced | no | no | YES |
  27. +===============+=================+====================+================+
  28. | Duration | no | no | YES |
  29. +===============+=================+====================+================+
  30. | UniqueId | no | no | YES |
  31. +===============+=================+====================+================+
  32. | Bound | no | no | YES |
  33. +===============+=================+====================+================+
  34. | Named | no | no | YES |
  35. +===============+=================+====================+================+
  36. ---------------------------------------
  37. GroupID: See the "Item Group ID" section in 'src/map/itemdb.hpp' and the "item groups" section in 'src/map/script_constants.hpp'.
  38. Supports IG_* constants. 'IG_' is appended to the name when the file is read.
  39. ---------------------------------------
  40. Index: Unique number that can be used to add the same Item with different data in the list.
  41. ---------------------------------------
  42. Item: Available item that will be obtained from this item group.
  43. Requires the AegisName of the item.
  44. ---------------------------------------
  45. Rate: Probability to get the item. Not a percentage value!
  46. Examples:
  47. - Group: MyItemGroup
  48. SubGroups:
  49. - SubGroup: 1
  50. List:
  51. - Index: 0
  52. Item: Knife
  53. Rate: 5
  54. - Index: 1
  55. Item: Dagger
  56. Rate: 1
  57. - Knife has chance 5/6 (83.3%) to be obtained
  58. - Dagger has chance 1/6 (16.7%) to be obtained
  59. ---------------------------------------
  60. Amount: Amount of item that will be obtained.
  61. ---------------------------------------
  62. SubGroup: Unique number to create a list of item.
  63. ---------------------------------------
  64. Algorithm: Type of algorithm associated with SubGroup.
  65. Random - A random item is picked from the sub group using rate as chance for an item being picked.
  66. The chance remains the same every time.
  67. All - All items in this sub group shall be picked.
  68. If you use a command that is supposed to return only one item with such a sub group, then a random item is returned instead, with each
  69. item having the same chance to be picked.
  70. When using this algorithm, the rate must remain unspecified (0).
  71. SharedPool - Rate is the amount of items of this item ID in the sub group. A random item is picked from all the items in the group and then removed
  72. from the sub group. That means each time an item is returned from the sub group, it will have a lower chance to be returned again and if
  73. no more items of this item ID remain in the sub group, it cannot be returned at all anymore. This also means that if the server requests
  74. an item from this sub group as often as there are total items in this sub group, it will get exactly the amounts specified under "rate".
  75. Only when the group is completely empty or the server restarts, the group refills.
  76. Default: SharedPool
  77. Example:
  78. Item Group:
  79. - Group: MyItemGroup
  80. SubGroups:
  81. - SubGroup: 0
  82. Algorithm: All
  83. List:
  84. - Index: 0
  85. Item: Knife # "must" item(s)
  86. - Index: 1
  87. Item: Dagger # "must" item(s)
  88. - SubGroup: 1
  89. Algorithm: Random
  90. List:
  91. - Index: 0
  92. Item: Stiletto # random at SubGroup 1
  93. Rate: 5
  94. - Index: 1
  95. Item: Stiletto_ # random at SubGroup 1
  96. Rate: 2
  97. - SubGroup: 2
  98. Algorithm: Random
  99. List:
  100. - Index: 0
  101. Item: Stiletto # random at SubGroup 2
  102. Rate: 5
  103. - Index: 1
  104. Item: Dagger_ # random at SubGroup 2
  105. Rate: 4
  106. Usages:
  107. getgroupitem(<group_id>)
  108. ------------
  109. -> 'getgroupitem(IG_MyItemGroup);'
  110. - Player always gets 1x Knife and 1x Dagger
  111. - Player has chance to get 1x Stiletto by chance 5/7 from SubGroup 1
  112. - Player has chance to get 1x Stiletto_ by chance 2/7 from SubGroup 1
  113. - Player has chance to get 1x Stiletto by chance 5/9 from SubGroup 2
  114. - Player has chance to get 1x Dagger_ by chance 4/9 from SubGroup 2
  115. getrandgroupitem(<group_id>{,<quantity>{,<sub_group>}})
  116. ------------
  117. -> 'getrandgroupitem(IG_MyItemGroup);'
  118. - Random SubGroup: 1, Amount: [Based on list]
  119. - Equals to: getrandgroupitem(IG_MyItemGroup,0) and getrandgroupitem(IG_MyItemGroup,0,1)
  120. - Player has chance to get 1x Stiletto by chance 5/7 from SubGroup 1
  121. - Player has chance to get 1x Stiletto_ by chance 2/7 from SubGroup 1
  122. - 'must' and 'SubGroup 2' are ignored
  123. -> 'getrandgroupitem(IG_MyItemGroup,1);'
  124. - Random SubGroup: 1, Amount: 2, ignore 'amount' on the list
  125. - Equals to: getrandgroupitem(IG_MyItemGroup,1,1)
  126. - Player has chance to get 2x Stiletto by chance 5/7 from SubGroup 1
  127. - Player has chance to get 2x Stiletto_ by chance 2/7 from SubGroup 1
  128. - 'must' and 'SubGroup 2' are ignored
  129. -> 'getrandgroupitem(IG_MyItemGroup,3, 0);'
  130. - Random SubGroup: 'must', Amount: 2, ignore 'amount' on the list
  131. - Player has chance to get 3x Knife by chance 1/2 from 'must' SubGroup
  132. - Player has chance to get 3x Dagger by chance 1/2 from 'must' SubGroup
  133. - 'SubGroup 1' and 'SubGroup 2' are ignored
  134. groupranditem(<group id>{,<sub_group>})
  135. ------------
  136. This command only returns an Item ID from random SubGroup. Combine with 'getitem'
  137. to retrieve the items.
  138. -> 'groupranditem(IG_MyItemGroup);'
  139. - Random SubGroup: 1
  140. - Returns Item ID of Stiletto by chance 5/7 from SubGroup 1
  141. - Returns Item ID of Stiletto_ by chance 2/7 from SubGroup 1
  142. - 'must' and 'SubGroup 2' are ignored
  143. -> 'groupranditem(IG_MyItemGroup,0);'
  144. - Random SubGroup: 0
  145. - Returns Item ID of Knife by chance 5/7 from 'must' SubGroup
  146. - Returns Item ID of Dagger by chance 2/7 from 'must' SubGroup
  147. - 'SubGroup 1' and 'SubGroup 2' are ignored
  148. Example #2:
  149. Item Group:
  150. - Group: MyItemGroup2
  151. SubGroups:
  152. - SubGroup: 1
  153. Algorithm: SharedPool
  154. List:
  155. - Index: 0
  156. Item: Milk
  157. Rate: 10
  158. Amount: 3
  159. - Index: 1
  160. Item: Well_Baked_Cookie
  161. Rate: 5
  162. Amount: 2
  163. - Index: 2
  164. Item: Gift_Box
  165. Rate: 1
  166. (Note: Specifying the "SharedPool" algorithm is optional, as it defaults to SharedPool if not specified.)
  167. You can interpret this as within MyItemGroup2 there are 10 packs of 3x Milk, 5 packs of 2x Well_Baked_Cookie and 1 Gift_Box; 16 packs in total.
  168. Usages:
  169. 'getgroupitem(IG_MyItemGroup2);'
  170. 'getrandgroupitem(IG_MyItemGroup2);'
  171. The first time one of the two commands above are called:
  172. - Player has chance to get 3x Milk by chance 10/16
  173. - Player has chance to get 2x Well_Baked_Cookie by chance 5/16
  174. - Player has chance to get 1x Gift_Box by chance 1/16
  175. Let's say a pack of Well_Baked_Cookie was received from the group. That means only 4 packs of Well_Baked_Cookie remain in the group.
  176. The second time one of the two commands above are called:
  177. - Player has chance to get 3x Milk by chance 10/15
  178. - Player has chance to get 2x Well_Baked_Cookie by chance 4/15
  179. - Player has chance to get 1x Gift_Box by chance 1/15
  180. Now a Gift_Box is received from the group. That means no more Gift_Box are remaining in the group.
  181. The third time one of the two commands above are called:
  182. - Player has chance to get 3x Milk by chance 10/14
  183. - Player has chance to get 2x Well_Baked_Cookie by chance 4/14
  184. After the two commands were called 16 times, the server will always have given out exactly:
  185. - 30 Milk (10 packs of 3x Milk)
  186. - 10 Well_Baked_Cookie (5 packs of 2x Well_Baked_Cookie)
  187. - 1 Gift_Box
  188. Now the group is refilled and the next time the command is called, it will behave similar to the first time.
  189. ---------------------------------------
  190. Announced: If player obtained this item, it will be broadcast to the server.
  191. "[Player] has won [Item] from 'Box'"
  192. ---------------------------------------
  193. Duration: Makes the item a rental item, which will be expire in the given amount
  194. of minutes. Not intended for use with stackable items.
  195. ---------------------------------------
  196. UniqueId: Makes the given item(s) with Unique ID. Item will be stacked ONLY each group
  197. when it obtained. Cannot be stacked with same item, even it's stackable item.
  198. Example, there is Box (just call it Apple_Box) that contains 3x Apples with
  199. UniqueId = 1. When Apples appear it will stack for each 3 even another 3x Apples
  200. are appeared by same box. So it will be filled in inventory as:
  201. 3x Apples | 3x Apples | so on... | nx Apples (normal)
  202. ---------------------------------------
  203. Bound: Binds the obtained item.
  204. See 'getitembound' in 'doc/script_commands.txt' for valid bound types.
  205. ---------------------------------------
  206. Named: Inscribes the item with the obtainer's name.
  207. ---------------------------------------