mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 13:37:00 +00:00
[8637] Added special check in load time for TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT, code cleanup.
- Added check for presence of implicit spell focus for TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT - Avoid double creature lookup in loading code - Code style cleanup - Old commented code part removed Signed-off-by: ApoC <apoc@nymfe.net>
This commit is contained in:
parent
901eea0813
commit
ed0b01c65c
2 changed files with 45 additions and 52 deletions
|
|
@ -2199,11 +2199,30 @@ void SpellMgr::LoadSpellScriptTarget()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// More checks on TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT
|
||||||
|
bool ok = true;
|
||||||
|
for (int i = 0; i < 3; ++i)
|
||||||
|
{
|
||||||
|
if (spellProto->EffectImplicitTargetA[i] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT ||
|
||||||
|
spellProto->EffectImplicitTargetB[i] == TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT)
|
||||||
|
{
|
||||||
|
if (spellProto->RequiresSpellFocus)
|
||||||
|
{
|
||||||
|
sLog.outErrorDb("Table `spell_script_target`: spellId %u for TargetEnty %u of type TARGET_FOCUS_OR_SCRIPTED_GAMEOBJECT is wrong because spell has implicit ReqSpellFocus %u.", spellId, targetEntry, spellProto->RequiresSpellFocus);
|
||||||
|
ok = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!ok)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Checks by target type
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case SPELL_TARGET_TYPE_GAMEOBJECT:
|
case SPELL_TARGET_TYPE_GAMEOBJECT:
|
||||||
{
|
{
|
||||||
if( targetEntry==0 )
|
if (!targetEntry)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!sGOStorage.LookupEntry<GameObjectInfo>(targetEntry))
|
if (!sGOStorage.LookupEntry<GameObjectInfo>(targetEntry))
|
||||||
|
|
@ -2214,26 +2233,25 @@ void SpellMgr::LoadSpellScriptTarget()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
if (!targetEntry)
|
||||||
if( targetEntry==0 )
|
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Table `spell_script_target`: target entry == 0 for not GO target type (%u).",type);
|
sLog.outErrorDb("Table `spell_script_target`: target entry == 0 for not GO target type (%u).",type);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(!sCreatureStorage.LookupEntry<CreatureInfo>(targetEntry))
|
if (const CreatureInfo* cInfo = 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)
|
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);
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sLog.outErrorDb("Table `spell_script_target`: creature template entry %u does not exist.",targetEntry);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mSpellScriptTarget.insert(SpellScriptTarget::value_type(spellId,SpellTargetEntry(SpellTargetType(type),targetEntry)));
|
mSpellScriptTarget.insert(SpellScriptTarget::value_type(spellId,SpellTargetEntry(SpellTargetType(type),targetEntry)));
|
||||||
|
|
@ -2243,31 +2261,6 @@ void SpellMgr::LoadSpellScriptTarget()
|
||||||
|
|
||||||
delete result;
|
delete result;
|
||||||
|
|
||||||
// Check all spells
|
|
||||||
/* Disabled (lot errors at this moment)
|
|
||||||
for(uint32 i = 1; i < sSpellStore.nCount; ++i)
|
|
||||||
{
|
|
||||||
SpellEntry const * spellInfo = sSpellStore.LookupEntry(i);
|
|
||||||
if(!spellInfo)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
bool found = false;
|
|
||||||
for(int j=0; j<3; ++j)
|
|
||||||
{
|
|
||||||
if( spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT || spellInfo->EffectImplicitTargetA[j] != TARGET_SELF && spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT )
|
|
||||||
{
|
|
||||||
SpellScriptTarget::const_iterator lower = spellmgr.GetBeginSpellScriptTarget(spellInfo->Id);
|
|
||||||
SpellScriptTarget::const_iterator upper = spellmgr.GetEndSpellScriptTarget(spellInfo->Id);
|
|
||||||
if(lower==upper)
|
|
||||||
{
|
|
||||||
sLog.outErrorDb("Spell (ID: %u) has effect EffectImplicitTargetA/EffectImplicitTargetB = %u (TARGET_SCRIPT), but does not have record in `spell_script_target`",spellInfo->Id,TARGET_SCRIPT);
|
|
||||||
break; // effects of spell
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
sLog.outString();
|
sLog.outString();
|
||||||
sLog.outString(">> Loaded %u Spell Script Targets", count);
|
sLog.outString(">> Loaded %u Spell Script Targets", count);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8636"
|
#define REVISION_NR "8637"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue