[11102] Provide for mount helper function parent spell data.

This let skip for triggered spell redundent (like cast time) info.
This commit is contained in:
VladimirMangos 2011-02-02 20:03:39 +03:00
parent cd3d815df6
commit 44cb8b6dd4
4 changed files with 21 additions and 15 deletions

View file

@ -6879,7 +6879,7 @@ void Spell::ResetEffectDamageAndHeal()
m_healing = 0;
}
void Spell::SelectMountByAreaAndSkill(Unit* target, uint32 spellId75, uint32 spellId150, uint32 spellId225, uint32 spellId300, uint32 spellIdSpecial)
void Spell::SelectMountByAreaAndSkill(Unit* target, SpellEntry const* parentSpell, uint32 spellId75, uint32 spellId150, uint32 spellId225, uint32 spellId300, uint32 spellIdSpecial)
{
if (!target || target->GetTypeId() != TYPEID_PLAYER)
return;
@ -6894,13 +6894,19 @@ void Spell::SelectMountByAreaAndSkill(Unit* target, uint32 spellId75, uint32 spe
{
uint32 spellid = skillval >= 300 ? spellId300 : spellId225;
SpellEntry const *pSpell = sSpellStore.LookupEntry(spellid);
if (!pSpell)
{
sLog.outError("SelectMountByAreaAndSkill: unknown spell id %i by caster: %s", spellid, target->GetGuidStr().c_str());
return;
}
// zone check
uint32 zone, area;
target->GetZoneAndAreaId(zone, area);
SpellCastResult locRes= sSpellMgr.GetSpellAllowedInLocationError(pSpell, target->GetMapId(), zone, area, target->GetCharmerOrOwnerPlayerOrPlayerItself());
if (locRes != SPELL_CAST_OK || !((Player*)target)->CanStartFlyInArea(target->GetMapId(), zone, area))
target->CastSpell(target, spellId150, true);
target->CastSpell(target, spellId150, true, NULL, NULL, ObjectGuid(), parentSpell);
else if (spellIdSpecial > 0)
{
for (PlayerSpellMap::const_iterator iter = ((Player*)target)->GetSpellMap().begin(); iter != ((Player*)target)->GetSpellMap().end(); ++iter)
@ -6917,22 +6923,22 @@ void Spell::SelectMountByAreaAndSkill(Unit* target, uint32 spellId75, uint32 spe
// speed higher than 280 replace it
if (mountSpeed > 280)
{
target->CastSpell(target, spellIdSpecial, true);
target->CastSpell(target, spellIdSpecial, true, NULL, NULL, ObjectGuid(), parentSpell);
return;
}
}
}
}
}
target->CastSpell(target, pSpell, true);
target->CastSpell(target, pSpell, true, NULL, NULL, ObjectGuid(), parentSpell);
}
else
target->CastSpell(target, pSpell, true);
target->CastSpell(target, pSpell, true, NULL, NULL, ObjectGuid(), parentSpell);
}
else if (skillval >= 150 && spellId150 > 0)
target->CastSpell(target, spellId150, true);
target->CastSpell(target, spellId150, true, NULL, NULL, ObjectGuid(), parentSpell);
else if (spellId75 > 0)
target->CastSpell(target, spellId75, true);
target->CastSpell(target, spellId75, true, NULL, NULL, ObjectGuid(), parentSpell);
return;
}