[3.3.5] Are trainers in any way hardcoded ?

Hello,

I tried to make a custom trainer. Therefore I copied the record of the fishing trainer Matthew Hooper (entry 1680) in creature_template 1:1.

I also use the existing gossip_menu_id 5665.

I have added the same spellset -202001 to my new trainer.

Restart of server and client, delete client cache.

I can spawn both entries, a new instance of 1680 and one of my custom template.

The 1680 spawn works fine, however my custom trainer opens only the gossip window. If I click on ‘train me’ nothing happens.

I also have seen that it’s even not necessary to have a gossip menu option ‘Train me’. As soon as the NPC has the trainer flag the core is inserting a ‘train me’ option. Unfortunately nothing is working with this option. I also tried other spells.

So, is there some other table to use or something hardcoded in the core ?

To me it sounds about right. Vendors are not hardcoded as far as I know.

Check that you really do have the rows in DB still (specifically the npc_vendor one)
Also check your server logs and console, usually those contain information about invalid vendors.

I tested the same thing and both trainers open up the gossip with train me in it and then clicking on it shows the trainer spells

After all I have to say: Yes, trainers are hardcoded. It’s not possible to make trainers with entry > 200000 (TRINITY_TRAINER_START_REF) because there is a limitation in AddSpellToTrainer() in ObjectMgr.cpp.

if (ID >= TRINITY_TRAINER_START_REF)
        return;

The reason for this hack is a weird mix of spells and spellsets in the npc_trainer table.

After changing this limitation in the core to 200000-300000 and making NPC entries > 300000 it was working.

The better way would be to save spellsets with negative values in npc_trainer.

Trainers have always been hard-coded from get go from the beta release in Blizzard servers and always will be I don’t look for this to change at anytime soon, matter of fact there are going to be some other changes too when talking with Blizzard coming soon that is going to change the way trinitycore looks at a lot of other things when dealing with other aspects of other features when dealing with hard-coding.