mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 01:15:35 +01:00
[7776] Completed implementation of CMSG_SPELLCLICK Author: arrai
For vehicles, you have to add the correct SPELL_AURA_CONTROL_VEHICLE spells to
npc_spellclick_spells, otherwise you won't be able to use them
--HG--
branch : trunk
This commit is contained in:
@@ -6207,6 +6207,76 @@ void ObjectMgr::LoadPointsOfInterest()
|
||||
sLog.outString(">> Loaded %u Points of Interest definitions", count);
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadNPCSpellClickSpells()
|
||||
{
|
||||
uint32 count = 0;
|
||||
|
||||
mSpellClickInfoMap.clear();
|
||||
|
||||
QueryResult *result = WorldDatabase.Query("SELECT npc_entry, spell_id, quest_id, cast_flags FROM npc_spellclick_spells");
|
||||
|
||||
if(!result)
|
||||
{
|
||||
barGoLink bar(1);
|
||||
|
||||
bar.step();
|
||||
|
||||
sLog.outString();
|
||||
sLog.outErrorDb(">> Loaded 0 spellclick spells. DB table `npc_spellclick_spells` is empty.");
|
||||
return;
|
||||
}
|
||||
|
||||
barGoLink bar(result->GetRowCount());
|
||||
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
bar.step();
|
||||
|
||||
uint32 npc_entry = fields[0].GetUInt32();
|
||||
CreatureInfo const* cInfo = GetCreatureTemplate(npc_entry);
|
||||
if (!cInfo)
|
||||
{
|
||||
sLog.outErrorDb("Table npc_spellclick_spells references unknown creature_template %u. Skipping entry.", npc_entry);
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 spellid = fields[1].GetUInt32();
|
||||
SpellEntry const *spellinfo = sSpellStore.LookupEntry(spellid);
|
||||
if (!spellinfo)
|
||||
{
|
||||
sLog.outErrorDb("Table npc_spellclick_spells references unknown spellid %u. Skipping entry.", spellid);
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 quest = fields[2].GetUInt32();
|
||||
|
||||
// quest might be 0 to enable spellclick independent of any quest
|
||||
if (quest)
|
||||
{
|
||||
if(mQuestTemplates.find(quest) == mQuestTemplates.end())
|
||||
{
|
||||
sLog.outErrorDb("Table npc_spellclick_spells references unknown quest %u. Skipping entry.", spellid);
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
uint8 castFlags = fields[3].GetUInt8();
|
||||
SpellClickInfo info;
|
||||
info.spellId = spellid;
|
||||
info.questId = quest;
|
||||
info.castFlags = castFlags;
|
||||
mSpellClickInfoMap.insert(SpellClickInfoMap::value_type(npc_entry, info));
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString(">> Loaded %u spellclick definitions", count);
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadWeatherZoneChances()
|
||||
{
|
||||
uint32 count = 0;
|
||||
|
||||
Reference in New Issue
Block a user