NOTE: This page is auto-generated from the MAGNET DBDocs module,
Any changes made directly to this page will be lost when it is regenerated.
Description of the 'npc_trainer_template' table for MaNGOSThree
The npc_trainer_template table holds spell lists usable for multiple training creatures.
For example, I've created a spell that combines the detection of mines & herbs so that they both appear on the minimap. I simply created an entry in the template table* to reference it as such:
REPLACE INTO mangos0.npc_trainer_template(entry,spell,spellcost,reqskill,reqskillvalue) VALUES (182,50000,100,182,1);
and then I simply update the creature_template accordingly with the TrainerTemplateId being the entry from the npc_trainer_template table.
UPDATE mangos0.creature_template SET TrainerTemplateId=182 WHERE (SubName="Herbalism Trainer" AND TrainerType=2 AND (NpcFlags=17 OR NpcFlags=19 OR NpcFlags=21));
With all this, I'm then able to learn the spell from any of the herbalist trainers (I've also made one for the miners but it is irrelevant for the example). The point is, instead of adding every single spell by hand for every trainer that can teach it, I've created a single entry in the template table that links to all the spells this group of trainers can teach.?
And obviously, it is working since in-game, every herbalist / miner can teach me that spell (along with the others I've added). Same thing goes for the items. The whole point of these tables (at least for me) was to provide a way to add bundles of spells & items to npcs without having to add too much entries and especially, ones in the "standard" tables.
This table uses the 'InnoDB' DB Engine
The Field definitions follow:
|Field Name||Field Type||Nullable||Key||Default Value||Attributes||Notes|
|entry||mediumint(8) unsigned||NO||PRI||'0'||The unique identifier for the training template.|
|spell||mediumint(8) unsigned||NO||PRI||'0'||The spell identifier. .|
|spellcost||int(10) unsigned||NO||'0'||The cost that the player needs to pay in order to learn the spell in copper.|
|reqskill||smallint(5) unsigned||NO||'0'||The required skill to be able to learn the spell.|
|reqskillvalue||smallint(5) unsigned||NO||'0'||The minimum skill level required for the skill referenced in reqskill.|
|reqlevel||tinyint(3) unsigned||NO||'0'||The character level required in order to learn the spell.|
Description of the fields
entry mediumint(8) unsigned
The unique identifier for the training template. A "creature_template" table references this from its trainer_id column.
spell mediumint(8) unsigned
The spell identifier. The value has to match with a spell identifier defined in Spell.dbc [See Spell.dbc]. This has to be a spell which teaches the actual spell.
spellcost int(10) unsigned
The cost that the player needs to pay in order to learn the spell in copper.
reqskill smallint(5) unsigned
The required skill to be able to learn the spell. This references the skill's entry in the SkillLine.dbc table [See Spell.dbc].
reqskillvalue smallint(5) unsigned
The minimum skill level required for the skill referenced in reqskill.
reqlevel tinyint(3) unsigned
The character level required in order to learn the spell.
auto-generated by the getMaNGOS.eu MAGNET dbdocs module
Edited by Antz