All loot template

Материал из YTDB DataBase

(Перенаправлено с Reference loot template)
Перейти к: навигация, поиск

Содержание

К описанию таблиц базы данных mangos.


Таблицы вида `*_loot_template`

General

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. 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 Attributes Null Key Default Comments
entry mediumint(8) unsigned NO PRI 0
item mediumint(8) unsigned NO PRI 0
ChanceOrQuestChance float NO 100
groupid tinyint(3) NO 0
mincountOrRef mediumint(9) NO 1
maxcount tinyint(3) unsigned NO 1
condition_id mediumint(8) unsigned NO 0
comments varchar(300) YES

Сейчас в базе есть 12 таблиц, имеющих общий принцип:

Loot table Field Relation Related table Field Comment
creature_loot_template entry many <- many creature_template lootid
disenchant_loot_template entry many <- many item_template DisenchantID
fishing_loot_template no relation entry is linked with ID of the fishing zone or area
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
mail_loot_template entry quest_template RewMailTemplateId
milling_loot_template entry many <- one item_template entry
pickpocketing_loot_template entry many <- many creature_template pickpocketloot
prospecting_loot_template entry many <- one item_template entry
reference_loot_template entry many <- many *_loot_template -mincountOrRef In case of negative mincountOrRef
skinning_loot_template entry many <- many creature_template skinloot Can also store minable/herbable items gathered from creatures
spell_loot_template entry spell.dbc [entry]

Описание полей

entry

ID лута (loot template). Строки с одинаковым ID представляют собой общий список всех предметов, которые могут выпасть с определённого объекта.
Обычно совпадает с ID объекта, лутом которого является (предмет, нпс, и т.п. (например, лут для нпс номер 6 будет иметь ID 6)) 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.

ПРИМЕЧАНИЕ:

creature_loot_template - 'entry' = 0, используется для лута с игроков (БГ).

fishing_loot_template - 'entry' = 0, используется для лута в случае неудачной рыбалки (если разрешено в конфиге).

item

ID предмета который включен в лут.

ПРИМЕЧАНИЕ: Если указана ссылка на reference entries значение этого поля игнорируется, обычно используется тоже значение, что и reference entries. Потому что уникальности данной таблицы строится на комбинации entry + item, this field will nonetheless need to be a unique number for each reference entry so that no indexing conflicts arise.

ChanceOrQuestChance

Meaning of that field is a bit different depending on its sign and the sign of mincountOrRef:

Plain entry

ChanceOrQuestChance > 0, mincountOrRef > 0

Absolute value of ChanceOrQuestChance (actuallu just the value as it's positive in this case) 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.

Quest drop

ChanceOrQuestChance < 0, mincountOrRef > 0

Just as for plain entries absolute value of ChanceOrQuestChance signifies the percent chance that the item has to drop. But in addition negative ChanceOrQuestChance 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 ReqItemIdN fields or in its ReqSourceIdN fields. The player must also have less copies of the item than ReqItemCountN or ReqSourceCountN.

Chanced references

mincountOrRef < 0

For negative mincountOrRef (reference entries) ChanceOrQuestChance 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 ChanceOrQuestChance make no sense for that case and should not be used.

Common remarks

Zero value of ChanceOrQuestChance is allowed for grouped entries only.

(Non-zero) values of ChanceOrQuestChance in loot definition are multiplied by RATE_DROP_ITEMS (mangos config setting) during loot generation for references and non-reference entries, but not for grouped entries.

groupid

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 fields.

A group may consists of explicitly-chanced (having non-zero ChanceOrQuestChance) and equal-chanced (ChanceOrQuestChance = 0) entries. Every equal-chanced entry of a group is considered having such a chance that:

  • all equal-chanced entries have the same chance
  • group chance (sum of chances of all entries) is 100%

Of course group may consist of

  • only explicitly-chanced entries or
  • only equal-chanced entries or
  • entries of both type.

The easies 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:

  • core rolls for explicitly-chanced entries (if any):
    • a random number R is rolled in range 0 to 100 (floating point value).
    • chance to drop is checked for every (explicitly-chanced) entry in the group:
      • if R is less than absolute value of ChanceOrQuestChance of the entry then the entry 'wins': the item is included in the loot. Group processing stops, the rest of group entries are just skipped.
      • otherwise the entry 'looses': the item misses its chance to get into the loot. R is decreased by the absolute value of ChanceOrQuestChance and next explicitly-chanced entry is checked.
  • if none of explicitly-chanced entries got its chance then equal-chanced part (if any) is processed:
    • a random entry is selected from the set of equal-chanced entries and corresponding item is included in the loot.
  • If nothing selected yet (this never happens if the group has some equal-chanced entries) - no item from the group is included into the loot.

Let us use term group chance as the sum of ChanceOrQuestChance (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:

  • Not more than one item from a group may drop at any given time.
  • If group chance is at least 100 then one item will be dropped for sure.
  • If group chance does not exceed 100 then every item defined in group entries has exactly that chance to drop as set in ChanceOrQuestChance.
  • If group chance is greater than 100 then some entries will lost a part of their chance (or even not be checked at all - that will be the case for all equal-chanced entries) whatever value takes the roll R. So for some items chance to drop will be less than their ChanceOrQuestChance. That is very bad and that is why having group chance > 100 is strictly prohibited.
  • Processing of equal-chanced part takes much less time then of explicitly-chanced one. So usage of equal-chanced groups is recommended when possible.

So now basic applications of the groups are clear:

  • Groups with group chance of 100% generate exactly one item every time. This is needed quite often, for example such behavior is needed to define a loot template for tier item drop from a boss.
  • Groups with group chance < 100 generate one or zero items every time keeping chances of every item unchanged. Such behavior is useful to limit maximum number of items in the loot.
  • A single group may be defined for a set of items common for several loot sources. This could be very useful for decreasing DB size without any loss of data. See References for more details.

There is no way to have a reference as a part of a group.

Note: A group may contain definitions of non-quest drop, quest drop or both, but mixing non-quest and quest drop in a single group is not recommended.

Note: The core has a limitation - only 16 non-quest items (money and items added into the loot for quests are not counted for this "16") may come into the loot. And this is not a caprice of core devs - the client has some constraints. As most of loots have much more than 16 possible items (sometimes several hundreds) so without groups there is a (little) chance that more than 16 items will be rolled for a given loot but player will be able to see (and take) only first 16 of them. With groups you can ensure that more than 16 items will never drop. If DB pretends to be a quality software it must have loot template definitions which ensure that not more than 16 plain entries and groups are defined for any loot template. This is just a note - such declaration is not issued by database developers yet.

Note: The core has no limitation for number of groups (except 255 by DB field size), but according to the previous note there is no need to use values greater than 16.

mincountOrRef

This field defines

  • when positive: the minimum number of copies of the item that can drop in a single loot
  • when negative: a reference to another template.

Zero value makes no sense and should not be used.

Meaning of positive values is quite clear and requires no additional comments. References can point to either a whole template or to single group of a template and decribed below.

Template reference

mincountOrRef < 0, group = 0

Template reference asks core to process another loot template (having entry equal to "-mincountOrRef") 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 `creature_loot_template` (`entry`,`item`,`mincountOrRef`) 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.

Group reference

mincountOrRef < 0, group > 0

Group reference asks core to process another loot template (having entry equal to "-mincountOrRef") only in the part of one group - with id equal to value of `groupid` field of the reference entry. So this reference may add only none or 1 item into the loot (provided maxcount is equal to 1).

Meaning of maxcount field value is the same as described in Template reference.

Note that there is no way to have a reference as a part of a group as such grouped reference would have the same format as reference to group described here.

There are two types of group references:

  • external reference when group reference row has entry different from entry of the referenced group
  • internal reference when group reference row has the same entry as the referenced group.

Basic usage of group references is to avoid repetition of group definitions when several loot sources have common parts of the loot. In this case it is possible:

  • to define groups with the same contents (items/drop chances) again and again. The simpliest way, but very RAM consumable.
  • to define the group once as a part of one of loot source loot definition and to include group references in loot definitions of the other loot sources instead of repeating group definition.
  • to define the group once as a part of an artificial loot definition (having entry not corresponding to any source) and to include group references in loot definitions for every related loot source.

The first way is deprecated, both second and third use external references.

As references have chance to be processed it is possible to use them effiently for zone or world drop definitions. Those drops often have different chances for different loot sources (low/high skill gameobjects, non-elite/elite creatures etc) while having the same contents of the loot. The recommended way to define such drops is as following:

  • to set up a group with 100% group chance in an artificial loot template (using equal-chanced entries when possible)
  • to include references to that group into loot definition of every related loot source setting the drop chance for the reference.

Some bosses drop more than one tier item (two or three). Loot statistics looks like the same group is rolled 2 or 3 times and every time an item (possible the same) is chosen. It is simple to define a group for single item, but how to define drop for the second and the third? We can:

  • repeat group definition 2 (or 3) times with change of group id
  • define the group once and include 1 (or 2) internal references.
  • define the group once as a part of an artificial loot definition and include 2 (or 3) external group references.
  • define the group once as a part of an artificial loot definition and include an external group reference with repetition factor of 2 (or 3).

The in-game results will be the same. But again - the first way is very inefficient and then deprecated.

maxcount

For non-reference entries - the maximum number of copies of the item that can drop in a single loot.

For references value of maxcount field is used as a repetition factor for references - the reference will be processed not just once but exactly maxcount times. This is designed to serve a single purpose: to make definition of tier token drops a bit simplier (tokens of a tier are defined as a 100%-chance group of an artificial template and bosses' loot templates include 100%-chanced reference to that group with repetition factor of 2 or 3 depending on the case). Using non-1 repetition factor for other things (references to a group with group chance less than 100% or chanced references with chance less than 100%) must be agreed with database devs first (and described here).

Note: core rolls chance for any loot definition entry just one time - so if a references looses its chance it is skipped for the current loot completely whatever is maxcount value.

condition_id

Идентификатор условия conditions.condition_entry, при котором игрок получит данный лут.

comments

Комментарий.


NOTE: For reference entries these fields have no meaning, not used by the core in any way and should have the default value of 0.

Agreements

These agreements are different for different loot tables. Mainly agreements defines rules for loot template IDs (entry) and groups

Fishing haul

For fishing_loot_template, ID is the zone or area ID from AreaTable.dbc (Note: Area IDs are not included in the link)

Also an extra note on fishing_loot_template: if just one area ID is defined for a zone, then that whole zone ID is skipped and therefore all areas in that zone need to have entries in the table. Only when there doesn't exist any area entries for a zone does the core use the zone ID directly. Zone = Wetlands, Elwynn, etc; Area = Northshire, Lakeshire, etc.

When several zones uses the same loot definition then

  • the loot template of the zone with minimal ID (minID) should be defined without references
  • the other zone with the same loot should have loot definition as a single reference to the minID loot definition

Note: To be confirmed by database developers

As successful fishing should give exactly 1 fish (with an exception for quest fishes) so non-quest part of every loot template should be

  • or single plain entry with 100% drop chance
  • or a single group with group chance equal to 100%
  • or a reference to a template made according to previous two variants. It is recommended to use group references.

When a fish is catched for a quest it becoms the second fish on the hook. Many people rolled on floor laughing but this is blizzlike and fortunately easy to implement. Just add necessary quest drop definition(s).

Corpse loot

For creature_loot_template basic approach is to use creature_template.lootid equal to creature_template.entry. But this results in great overhead in the loot table as

  • many creatures use the same loot definition (well, stats on sites are similar due to the nature of random roll)
  • even more creatures use same parts of loot definition

That is why it is recommended to use grouping, group references and template references.

Disenchant outcome

Agreements for disenchant loot templates numbering is item.level*100 + item.quality where item is disenchanting target.

As disenchanting should give exactly 1 type of shard/essence/dust/etc so every loot template should be

There is no use for references here as the reference is done with the relation field. No quest drop at all.

Gameobject harvest

TBD

Luggage contents

TBD

Pocket pick-ups

Agreements for pickpocketing loot templates numbering is not known.

TBD

Prospecting outcome

Agreements for prospecting loot templates numbering is not known.

TBD

Skinning pulls

Agreements for skinning loot templates numbering is not known. It's a real pity as many creatures should use the same templates. In most cases mobs with the same family and level have very similar skinning statistics.

As skinning should give exactly 1 type of skin/hide/etc so every loot template should be

There is no use for references here as the reference is done with the relation field.

When a skin is pulled for a quest it becoms the second skin from the mob. Yes, funny. This is blizzlike and fortunately easy to implement. Just add necessary quest drop definition(s).

Личные инструменты