[12000] Implement server side spells

Add exemplarily support for spells 21387(used with Ragnaros) and 62388(related to Demonic Circle)
Further table columns can be added as required.

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
Kid10 2012-06-12 23:15:07 +02:00 committed by Schmoozerd
parent 969c10a8d9
commit acc27152eb
9 changed files with 120 additions and 4 deletions

View file

@ -6751,6 +6751,59 @@ void ObjectMgr::LoadNPCSpellClickSpells()
sLog.outString(">> Loaded %u spellclick definitions", count);
}
static char* SERVER_SIDE_SPELL = "MaNGOS server-side spell";
struct SQLSpellLoader : public SQLStorageLoaderBase<SQLSpellLoader>
{
template<class S, class D>
void default_fill(uint32 field_pos, S src, D &dst)
{
if (field_pos == 65) // EquippedItemClass
dst = D(-1);
else
dst = D(src);
}
void default_fill_to_str(uint32 field_pos, char const* /*src*/, char * & dst)
{
if (field_pos == 132) // SpellName[0]
{
dst = SERVER_SIDE_SPELL;
}
else
{
dst = new char[1];
*dst = 0;
}
}
};
void ObjectMgr::LoadSpellTemplate()
{
SQLSpellLoader loader;
loader.Load(sSpellTemplate);
sLog.outString(">> Loaded %u spell definitions", sSpellTemplate.RecordCount);
sLog.outString();
for (uint32 i = 1; i < sSpellTemplate.MaxEntry; ++i)
{
// check data correctness
SpellEntry const* spellEntry = sSpellTemplate.LookupEntry<SpellEntry>(i);
if (!spellEntry)
continue;
// insert serverside spell data
if (sSpellStore.GetNumRows() <= i)
{
sLog.outErrorDb("Loading Spell Template for spell %u, index out of bounds (max = %)", i, sSpellStore.GetNumRows());
continue;
}
else
sSpellStore.InsertEntry(const_cast<SpellEntry*>(spellEntry), i);
}
}
void ObjectMgr::LoadWeatherZoneChances()
{
uint32 count = 0;