Core/Conditions: Convert npc_spellclick_spells data to condition system. This implements CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT (previous CONDITION_SOURCE_TYPE_UNUSED_18). Wiki needs to be updated accordingly.
This commit is contained in:
@@ -194,30 +194,8 @@ LanguageDesc const* GetLanguageDescByID(uint32 lang)
|
||||
bool SpellClickInfo::IsFitToRequirements(Unit const* clicker, Unit const* clickee) const
|
||||
{
|
||||
Player const* playerClicker = clicker->ToPlayer();
|
||||
if (playerClicker)
|
||||
{
|
||||
if (questStart)
|
||||
{
|
||||
// not in expected required quest state
|
||||
if ((!questStartCanActive || !playerClicker->IsActiveQuest(questStart)) && !playerClicker->GetQuestRewardStatus(questStart))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (questEnd)
|
||||
{
|
||||
// not in expected forbidden quest state
|
||||
if (playerClicker->GetQuestRewardStatus(questEnd))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (auraRequired)
|
||||
if (!clicker->HasAura(auraRequired))
|
||||
return false;
|
||||
|
||||
if (auraForbidden)
|
||||
if (clicker->HasAura(auraForbidden))
|
||||
return false;
|
||||
if (!playerClicker)
|
||||
return true;
|
||||
|
||||
Unit const* summoner = NULL;
|
||||
// Check summoners for party
|
||||
@@ -226,9 +204,6 @@ bool SpellClickInfo::IsFitToRequirements(Unit const* clicker, Unit const* clicke
|
||||
if (!summoner)
|
||||
summoner = clickee;
|
||||
|
||||
if (!playerClicker)
|
||||
return true;
|
||||
|
||||
// This only applies to players
|
||||
switch (userType)
|
||||
{
|
||||
@@ -7117,8 +7092,8 @@ void ObjectMgr::LoadNPCSpellClickSpells()
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
_spellClickInfoStore.clear();
|
||||
// 0 1 2 3 4 5 6 7 8
|
||||
QueryResult result = WorldDatabase.Query("SELECT npc_entry, spell_id, quest_start, quest_start_active, quest_end, cast_flags, aura_required, aura_forbidden, user_type FROM npc_spellclick_spells");
|
||||
// 0 1 2 3
|
||||
QueryResult result = WorldDatabase.Query("SELECT npc_entry, spell_id, cast_flags, user_type FROM npc_spellclick_spells");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -7149,66 +7124,14 @@ void ObjectMgr::LoadNPCSpellClickSpells()
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 auraRequired = fields[6].GetUInt32();
|
||||
if (auraRequired)
|
||||
{
|
||||
SpellInfo const* aurReqInfo = sSpellMgr->GetSpellInfo(auraRequired);
|
||||
if (!aurReqInfo)
|
||||
{
|
||||
sLog->outErrorDb("Table npc_spellclick_spells references unknown aura required %u. Skipping entry.", auraRequired);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 auraForbidden = fields[7].GetUInt32();
|
||||
if (auraForbidden)
|
||||
{
|
||||
SpellInfo const* aurForInfo = sSpellMgr->GetSpellInfo(auraForbidden);
|
||||
if (!aurForInfo)
|
||||
{
|
||||
sLog->outErrorDb("Table npc_spellclick_spells references unknown aura forbidden %u. Skipping entry.", auraForbidden);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 quest_start = fields[2].GetUInt32();
|
||||
|
||||
// quest might be 0 to enable spellclick independent of any quest
|
||||
if (quest_start)
|
||||
{
|
||||
if (_questTemplates.find(quest_start) == _questTemplates.end())
|
||||
{
|
||||
sLog->outErrorDb("Table npc_spellclick_spells references unknown start quest %u. Skipping entry.", quest_start);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
bool quest_start_active = fields[3].GetBool();
|
||||
|
||||
uint32 quest_end = fields[4].GetUInt32();
|
||||
// quest might be 0 to enable spellclick active infinity after start quest
|
||||
if (quest_end)
|
||||
{
|
||||
if (_questTemplates.find(quest_end) == _questTemplates.end())
|
||||
{
|
||||
sLog->outErrorDb("Table npc_spellclick_spells references unknown end quest %u. Skipping entry.", quest_end);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
uint8 userType = fields[8].GetUInt8();
|
||||
uint8 userType = fields[3].GetUInt8();
|
||||
if (userType >= SPELL_CLICK_USER_MAX)
|
||||
sLog->outErrorDb("Table npc_spellclick_spells references unknown user type %u. Skipping entry.", uint32(userType));
|
||||
|
||||
uint8 castFlags = fields[5].GetUInt8();
|
||||
uint8 castFlags = fields[2].GetUInt8();
|
||||
SpellClickInfo info;
|
||||
info.spellId = spellid;
|
||||
info.questStart = quest_start;
|
||||
info.questStartCanActive = quest_start_active;
|
||||
info.questEnd = quest_end;
|
||||
info.castFlags = castFlags;
|
||||
info.auraRequired = auraRequired;
|
||||
info.auraForbidden = auraForbidden;
|
||||
info.userType = SpellClickUserTypes(userType);
|
||||
_spellClickInfoStore.insert(SpellClickInfoContainer::value_type(npc_entry, info));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user