diff options
Diffstat (limited to 'src/game/SpellMgr.cpp')
-rw-r--r-- | src/game/SpellMgr.cpp | 168 |
1 files changed, 0 insertions, 168 deletions
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 0feac0ef110..510fdccb98a 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -1972,174 +1972,6 @@ void SpellMgr::LoadSpellLearnSpells() sLog.outString(">> Loaded %u spell learn spells + %u found in DBC", count, dbc_count); } -void SpellMgr::LoadSpellScriptTarget() -{ - mSpellScriptTarget.clear(); // need for reload case - - uint32 count = 0; - - QueryResult_AutoPtr result = WorldDatabase.Query("SELECT entry,type,targetEntry FROM spell_script_target"); - - if (!result) - { - barGoLink bar(1); - - bar.step(); - - sLog.outString(); - sLog.outErrorDb(">> Loaded 0 SpellScriptTarget. DB table `spell_script_target` is empty."); - return; - } - - barGoLink bar(result->GetRowCount()); - - do - { - Field *fields = result->Fetch(); - bar.step(); - - uint32 spellId = fields[0].GetUInt32(); - uint32 type = fields[1].GetUInt32(); - uint32 targetEntry = fields[2].GetUInt32(); - - SpellEntry const* spellProto = sSpellStore.LookupEntry(spellId); - - if (!spellProto) - { - sLog.outErrorDb("Table `spell_script_target`: spellId %u listed for TargetEntry %u does not exist.",spellId,targetEntry); - continue; - } - - bool targetfound = false; - for (uint8 i = 0; i < 3; ++i) - { - if (spellProto->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENTRY_SRC || - spellProto->EffectImplicitTargetB[i] == TARGET_UNIT_AREA_ENTRY_SRC || - spellProto->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENTRY_DST || - spellProto->EffectImplicitTargetB[i] == TARGET_UNIT_AREA_ENTRY_DST || - spellProto->EffectImplicitTargetA[i] == TARGET_UNIT_NEARBY_ENTRY || - spellProto->EffectImplicitTargetB[i] == TARGET_UNIT_NEARBY_ENTRY || - spellProto->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT_NEARBY_ENTRY || - spellProto->EffectImplicitTargetB[i] == TARGET_GAMEOBJECT_NEARBY_ENTRY || - spellProto->EffectImplicitTargetA[i] == TARGET_DST_NEARBY_ENTRY || - spellProto->EffectImplicitTargetB[i] == TARGET_DST_NEARBY_ENTRY || - spellProto->EffectImplicitTargetA[i] == TARGET_UNIT_CONE_ENTRY || - spellProto->EffectImplicitTargetB[i] == TARGET_UNIT_CONE_ENTRY) - { - targetfound = true; - break; - } - } - if (!targetfound) - { - sLog.outErrorDb("Table `spell_script_target`: spellId %u listed for TargetEntry %u does not have any implicit target TARGET_UNIT_NEARBY_ENTRY(38) or TARGET_DST_NEARBY_ENTRY (46)\ - ,TARGET_UNIT_AREA_ENTRY_SRC(7), TARGET_UNIT_AREA_ENTRY_DST(8), TARGET_UNIT_CONE_ENTRY(60), TARGET_GAMEOBJECT_NEARBY_ENTRY(40)",spellId,targetEntry); - continue; - } - - if (type >= MAX_SPELL_TARGET_TYPE) - { - sLog.outErrorDb("Table `spell_script_target`: target type %u for TargetEntry %u is incorrect.",type,targetEntry); - continue; - } - - switch(type) - { - case SPELL_TARGET_TYPE_GAMEOBJECT: - { - if (targetEntry == 0) - break; - - if (!sGOStorage.LookupEntry<GameObjectInfo>(targetEntry)) - { - sLog.outErrorDb("Table `spell_script_target`: gameobject template entry %u does not exist.", targetEntry); - continue; - } - break; - } - case SPELL_TARGET_TYPE_CONTROLLED: - if (targetEntry == 0) - sLog.outErrorDb("Table `spell_script_target`: creature template entry %u does not exist.", targetEntry); - default: - { - //players - /*if (targetEntry == 0) - { - sLog.outErrorDb("Table `spell_script_target`: target entry == 0 for not GO target type (%u).",type); - continue; - }*/ - if (targetEntry && !sCreatureStorage.LookupEntry<CreatureInfo>(targetEntry)) - { - sLog.outErrorDb("Table `spell_script_target`: creature template entry %u does not exist.", targetEntry); - continue; - } - const CreatureInfo* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(targetEntry); - - if (spellId == 30427 && !cInfo->SkinLootId) - { - sLog.outErrorDb("Table `spell_script_target` has creature %u as a target of spellid 30427, but this creature has no skinlootid. Gas extraction will not work!", cInfo->Entry); - continue; - } - break; - } - } - - mSpellScriptTarget.insert(SpellScriptTarget::value_type(spellId, SpellTargetEntry(SpellScriptTargetType(type), targetEntry))); - - ++count; - } while (result->NextRow()); - - // Check all spells - for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i) - { - SpellEntry const * spellInfo = sSpellStore.LookupEntry(i); - if (!spellInfo) - continue; - - bool found = false; - for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j) - { - switch (spellInfo->EffectImplicitTargetA[j]) - { - case TARGET_UNIT_AREA_ENTRY_SRC: - case TARGET_UNIT_AREA_ENTRY_DST: - case TARGET_UNIT_NEARBY_ENTRY: - case TARGET_GAMEOBJECT_NEARBY_ENTRY: - case TARGET_DST_NEARBY_ENTRY: - case TARGET_UNIT_CONE_ENTRY: - found = true; - break; - } - if (found) - break; - - switch (spellInfo->EffectImplicitTargetB[j]) - { - case TARGET_UNIT_AREA_ENTRY_SRC: - case TARGET_UNIT_AREA_ENTRY_DST: - case TARGET_UNIT_NEARBY_ENTRY: - case TARGET_GAMEOBJECT_NEARBY_ENTRY: - case TARGET_DST_NEARBY_ENTRY: - case TARGET_UNIT_CONE_ENTRY: - found = true; - break; - } - - if (found) - break; - } - if (found) - { - SpellScriptTargetBounds bounds = spellmgr.GetSpellScriptTargetBounds(i); - //if (bounds.first == bounds.second) - //sLog.outDebug("Spell (ID: %u) does not have record in `spell_script_target`", i); - } - } - - sLog.outString(); - sLog.outString(">> Loaded %u Spell Script Targets", count); -} - void SpellMgr::LoadSpellPetAuras() { mSpellPetAuraMap.clear(); // need for reload case |