<!DOCTYPE markdown>
Well, according to vocabulary the meaning of the word “loot” is good for corpse loot and may be for some gameobjects like chests but quite unfit for fishing “loot”. Nevermind. We will use term “loot” here as “a set of items generated on an event for a player” and “loot definition” as “a set of rules for loot generation”. And forget about vocabulary for a while.
This table format is used for 12 different tables to generate different loot items for different things. The 12 tables are creature_loot_template, disenchant_loot_template, fishing_loot_template, gameobject_loot_template, item_loot_template, pickpocketing_loot_template, prospecting_loot_template, skinning_loot_template, quest_mail_loot_template, reference_loot_template, milling_loot_template, spell_loot_template. The general description here is valid for all 12 because the loot system is the same for all eleven.
Loot templates define only items in the loot. See comments about money drop in corpse, pickpocketing and luggage loot in creature_template and item_template.
Field | Type | Null | Key | Default | Extra | Comment |
---|---|---|---|---|---|---|
Entry | MEDIUMINT UNSIGNED | NO | PRI | 0 | ||
Item | MEDIUMINT UNSIGNED | NO | PRI | 0 | ||
Reference | MEDIUMINT UNSIGNED | NO | PRI | 0 | ||
Chance | FLOAT | NO | 100 | |||
QuestRequired | bool | NO | 0 | |||
LootMode | SMALLINT | NO | 1 | |||
GroupId | TINYINT | NO | PRI | 0 | ||
MinCount | MEDIUMINT | NO | 1 | |||
MaxCount | TINYINT UNSIGNED | NO | 1 | |||
Comment | VARCHAR |
The 11 tables have different relations with other DB tables.
Loot table | Field | Relation | Related table | Field | Comment |
---|---|---|---|---|---|
fishing_loot_template | no relation | entry is linked with ID of the fishing zone or area | |||
creature_loot_template | entry | many ← many | creature_template | lootid | |
gameobject_loot_template | entry | many ← many | gameobject_template | data1 | Only gameobject type 3 (GAMEOBJECT_TYPE_CHEST) or 25 (GAMEOBJECT_TYPE_FISHINGHOLE) use data1 as loot ID, for other types data1 is used in other ways |
item_loot_template | entry | many ← one | item_template | entry | |
disenchant_loot_template | entry | many ← many | item_template | DisenchantID | |
prospecting_loot_template | entry | many ← one | item_template | entry | |
milling_loot_template | entry | many ← one | item_template | entry | |
pickpocketing_loot_template | entry | many ← many | creature_template | pickpocketloot | |
player_loot_template | no relation | entry is linked with player TeamID | 0 = Horde, 1 = Alliance | ||
skinning_loot_template | entry | many ← many | creature_template | skinloot | Can also store minable/herbable items gathered from creatures |
quest_mail_loot_template | entry | quest_template | RewardMailTemplateId | ||
reference_loot_template | entry | many ← many | - _loot_template | -mincountOrRef | In case of negative mincountOrRef |
spell_loot_template | entry | many ← many | Spell (DBC) | SpellId |
The ID of the loot definition (loot template). The rows with the same ID defines a single loot.
It is often the same ID as the loot source (item, creature, etc) but when the link is made not on Entry field of the Related table then ID can be different. For example, when several loot sources should provide the same loot, single loot definition can be used. In this case the loot sources have the same value in the link field.
It is possible also to set up artificial loot templates which are not used directly at all as they have ID which are not referenced from the related source. Such “support templates” can be referenced from “normal” loot templates.
When a common or artificial loot template is used a problem arises: what ID to use for that template? Depending on the loot table, different rules can be agreed on to simplify maintenance for the table. Moreover, such rules would be very handy but it seems at the moment there are very few rules explicitly defined.
Agreements on Entry field values are described there.
Template ID of the item which can be included into the loot.
Template reference asks core to process another loot template and to include all items dropped for that template into current loot. Simple idea.
Value of MaxCount field is used as a repetition factor for references - the reference will be processed not just once but exactly MaxCount times. So if the referenced template can produce 3 to 10 items (depending on luck) and value of MaxCount is '5' then after processing of that reference 15 to 50 items will be added to the loot. An awful example, isn't it? Actually no good example for whole template reference repetition is known, but it is quite useful for group references sometimes.
Be careful. Self references (loot template includes reference to itself) and loop references (loot template A includes reference to entire template B, loot template B includes reference to entire template A) are completely different from internal references. If you make a self-reference like
INSERT INTO `reference_loot_template` (`Entry`, `Item`, `Reference`) VALUES (21215, 0, 21215);
then the core will crash due to stack overflow at first attempt of loot 21215 processing. That is why self references and loop references are strictly forbidden.
Item drop chance (plain entry or quest entry). Not sure how this functions for loot reference items.
Chance > 0
Absolute value of Chance signifies the percent chance that the item has to drop. Any floating point number is allowed but indeed any value larger that 100 will make the same result as 100.
Chance > 0
Absolute value of Chance signifies the percent chance that the item has to drop. Any floating point number is allowed but indeed any value larger that 100 will make the same result as 100.
Just as for plain entries absolute value of Chance signifies the percent chance that the item has to drop. But in addition negative Chance
For Reference entries Chance signifies the percent chance that the reference has to be used. So it is very similar to plain entries meaning, just note that entire reference is skipped if the chance is missed.
Negative and zero values of Chance make no sense for that case and should not be used.
Zero value of Chance is allowed for grouped entries only.
(Non-zero) values of Chance in loot definition are multiplied by Rate.Drop.Item.XXX (worldserver.conf settings) during loot generation for references and non-reference entries, but not for grouped entries. It only works when groupid
is equal to 0.
Informs the core that the item should be shown only to characters having appropriate quest. This means that even if item is dropped, in order to see it in the loot the player must have at least one quest that has the item ID in its RequiredItemId fields or in its RequiredSourceItemId fields. The player must also have less copies of the item than RequiredItemCount or RequiredSourceItemCount.
A special parameter used for separating conditional loot, such as Hard Mode loot. A lootmode of 0 will effectively disable a loot entry (its roll will always fail). This column is a bitmask, so you shouldn't duplicate loot across lootmodes. The active lootmode(s) can be changed at any time by the core. This column should only be used if required, in most cases it should be left as 1. Valid lootmodes include: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 16384, 32768.
Loot mode examples from the Flame Leviathan fight in Ulduar:
LootMode | Use |
---|---|
1 | Normal mode (0 towers) |
2 | Hard mode A (1 tower) |
4 | Hard mode B (2 towers) |
8 | Hard mode C (3 towers) |
16 | Hard mode D (4 towers) |
A group is a set of loot definitions processed in such a way that at any given looting event the loot generated can receive only 1 (or none) item from the items declared in the loot definitions of the group. Groups are formed by loot definitions having the same values of entry and GroupId > 0 fields.
A group may consists of explicitly-chanced (having non-zero Chance) and equal-chanced (Chance = 0) entries. Every equal-chanced entry of a group is considered having such a chance that:
Of course group may consist of
The easiest way to understand what are groups is to understand how core processes grouped entries:
At loading time:
groups are formed - all grouped entries with the same values of*GroupId and Entry fields are gathered into two sets - one for explicitly-chanced entries and one for equal-chanced. Note that order of entries in the sets can not be defined by DB - you should assume that the entries are in an unknown order. But indeed every time core processes a group the entries are in some order, constant during processing.
During loot generation:
Let us use term group chance as the sum of Chance (absolute) values for the group. Please note that even one equal-chanced entry makes group chance to be 100% (provided that sum of explicit chances does not exceed 100%).
If you understand the process you can understand the results: