//===== rAthena Documentation ================================
//= Item Database
//===== By: ==================================================
//= rAthena Dev Team
//===== Last Updated: ========================================
//= 20210624
//===== Description: =========================================
//= Explanation of the item_group.yml file and structure.
//============================================================

Items within an item group can be retrieved through the 'groupranditem',
'getrandgroupitem', and 'getgroupitem' script commands.
The table below explains which fields are accessed in each.

+===============+=================+====================+================+
| Field         | 'groupranditem' | 'getrandgroupitem' | 'getgroupitem' |
+===============+=================+====================+================+
| GroupID       |       YES       |        YES         |      YES       |
+===============+=================+====================+================+
| Item          |       YES       |        YES         |      YES       |
+===============+=================+====================+================+
| Rate          |       YES       |        YES         |      YES       |
+===============+=================+====================+================+
| Amount        |       no        |     OPTIONAL       |      YES       |
+===============+=================+====================+================+
| SubGroup      |    OPTIONAL     |     OPTIONAL       |      YES       |
+===============+=================+====================+================+
| Announced     |       no        |        no          |      YES       |
+===============+=================+====================+================+
| Duration      |       no        |        no          |      YES       |
+===============+=================+====================+================+
| UniqueId      |       no        |        no          |      YES       |
+===============+=================+====================+================+
| Bound         |       no        |        no          |      YES       |
+===============+=================+====================+================+
| Named         |       no        |        no          |      YES       |
+===============+=================+====================+================+

---------------------------------------

GroupID: See the "Item Group ID" section in 'src/map/itemdb.hpp' and the "item groups" section in 'src/map/script_constants.hpp'.
         Supports IG_* constants. 'IG_' is appended to the name when the file is read.

---------------------------------------

Index: Unique number that can be used to add the same Item with different data in the list.

---------------------------------------

Item: Available item that will be obtained from this item group.
      Requires the AegisName of the item.

---------------------------------------

Rate: Probability to get the item. Not a percentage value!

Examples:
  - Group: MyItemGroup
    SubGroups:
      - SubGroup: 1
        List:
          - Index: 0
            Item: Knife
            Rate: 5
          - Index: 1
            Item: Dagger
            Rate: 1

	- Knife has chance 5/6 (83.3%) to be obtained
	- Dagger has chance 1/6 (16.7%) to be obtained

---------------------------------------

Amount: Amount of item that will be obtained.

---------------------------------------

SubGroup: Setting this to '0' makes the item always obtainable ("must" item).
		  SubGroup value will allocate where the item will be stored at random group.

	Item Group:
      - Group: MyItemGroup
        SubGroups:
          - SubGroup: 0
            List:
              - Index: 0
                Item: Knife       # "must" item(s)
              - Index: 1
                Item: Dagger      # "must" item(s)
          - SubGroup: 1
            List:
              - Index: 0
                Item: Stiletto    # random at SubGroup 1
                Rate: 5
              - Index: 1
                Item: Stiletto_   # random at SubGroup 1
                Rate: 2
          - SubGroup: 2
            List:
              - Index: 0
                Item: Stiletto    # random at SubGroup 2
                Rate: 5
              - Index: 1
                Item: Dagger_     # random at SubGroup 2
                Rate: 4

	Usages:
	getgroupitem(<group_id>)
	------------
	-> 'getgroupitem(IG_MyItemGroup);'
		- Player always gets 1x Knife and 1x Dagger
		- Player has chance to get 1x Stiletto by chance 5/7 from SubGroup 1
		- Player has chance to get 1x Stiletto_ by chance 2/7 from SubGroup 1
		- Player has chance to get 1x Stiletto by chance 5/9 from SubGroup 2
		- Player has chance to get 1x Dagger_ by chance 4/9 from SubGroup 2

	getrandgroupitem(<group_id>{,<quantity>{,<sub_group>}})
	------------
	-> 'getrandgroupitem(IG_MyItemGroup);'
		- Random SubGroup: 1, Amount: [Based on list]
		- Equals to: getrandgroupitem(IG_MyItemGroup,0) and getrandgroupitem(IG_MyItemGroup,0,1)
		- Player has chance to get 1x Stiletto by chance 5/7 from SubGroup 1
		- Player has chance to get 1x Stiletto_ by chance 2/7 from SubGroup 1
		- 'must' and 'SubGroup 2' are ignored

	-> 'getrandgroupitem(IG_MyItemGroup,1);'
		- Random SubGroup: 1, Amount: 2, ignore 'amount' on the list
		- Equals to: getrandgroupitem(IG_MyItemGroup,1,1)
		- Player has chance to get 2x Stiletto by chance 5/7 from SubGroup 1
		- Player has chance to get 2x Stiletto_ by chance 2/7 from SubGroup 1
		- 'must' and 'SubGroup 2' are ignored

	-> 'getrandgroupitem(IG_MyItemGroup,3, 0);'
		- Random SubGroup: 'must', Amount: 2, ignore 'amount' on the list
		- Player has chance to get 3x Knife by chance 1/2 from 'must' SubGroup
		- Player has chance to get 3x Dagger by chance 1/2 from 'must' SubGroup
		- 'SubGroup 1' and 'SubGroup 2' are ignored

	groupranditem(<group id>{,<sub_group>})
	------------
	This command only returns an Item ID from random SubGroup. Combine with 'getitem'
	to retrieve the items.
	-> 'groupranditem(IG_MyItemGroup);'
		- Random SubGroup: 1
		- Returns Item ID of Stiletto by chance 5/7 from SubGroup 1
		- Returns Item ID of Stiletto_ by chance 2/7 from SubGroup 1
		- 'must' and 'SubGroup 2' are ignored
	-> 'groupranditem(IG_MyItemGroup,0);'
		- Random SubGroup: 0
		- Returns Item ID of Knife by chance 5/7 from 'must' SubGroup
		- Returns Item ID of Dagger by chance 2/7 from 'must' SubGroup
		- 'SubGroup 1' and 'SubGroup 2' are ignored

---------------------------------------

Announced: If player obtained this item, it will be broadcast to the server.
           "[Player] has won [Item] from 'Box'"

---------------------------------------

Duration: Makes the item a rental item, which will be expire in the given amount
          of minutes. Not intended for use with stackable items.

---------------------------------------

UniqueId: Makes the given item(s) with Unique ID. Item will be stacked ONLY each group
      when it obtained. Cannot be stacked with same item, even it's stackable item.
	  Example, there is Box (just call it Apple_Box) that contains 3x Apples with
	  UniqueId = 1. When Apples appear it will stack for each 3 even another 3x Apples
	  are appeared by same box. So it will be filled in inventory as:
	        3x Apples | 3x Apples | so on... | nx Apples (normal)

---------------------------------------

Bound: Binds the obtained item.
       See 'getitembound' in 'doc/script_commands.txt' for valid bound types.

---------------------------------------

Named: Inscribes the item with the obtainer's name.

---------------------------------------
