I’ve been dealing with this issue for days now, and after getting frustrated enough decided to post on here.
I have noticed Trainer.cpp and Trainer.h are new files in the newer revision and hence alot of changes has been made from the older revisions, stuff from creature has been reworked and implemented into the new file game/creature/Trainer for instance.
This is the piece of code that has been causing my compiler to error for the last couple of days without any success fixes:
auto spells = sObjectMgr->GetNpcTrainerSpells(Trainer); // class trainer
if (!spells)
return;
auto spellList = spells->spellList;
for (auto itr = spellList.begin(); itr != spellList.end(); ++itr)
{
TrainerSpell const* tSpell = &itr->second;
const SpellInfo* info = sSpellMgr->GetSpellInfo(tSpell->SpellID);
if (!info)
continue;
bool valid = true;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (!tSpell->ReqAbility[i])
continue;
if (!player->IsSpellFitByClassAndRace(tSpell->ReqAbility[i]))
{
valid = false;
break;
}
}
if (!valid)
continue;
if (info->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL)
player->CastSpell(player, tSpell->SpellID, false);
else
player->LearnSpell(tSpell->SpellID, false);
}