[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;
}

View file

@ -489,7 +489,7 @@ class Spell
void CleanupTargetList();
void ClearCastItem();
static void SelectMountByAreaAndSkill(Unit* target, uint32 spellId75, uint32 spellId150, uint32 spellId225, uint32 spellId300, uint32 spellIdSpecial);
static void SelectMountByAreaAndSkill(Unit* target, SpellEntry const* parentSpell, uint32 spellId75, uint32 spellId150, uint32 spellId225, uint32 spellId300, uint32 spellIdSpecial);
protected:
bool HasGlobalCooldown();
void TriggerGlobalCooldown();

View file

@ -2028,7 +2028,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
// allow script to process further (text)
break;
case 48025: // Headless Horseman's Mount
Spell::SelectMountByAreaAndSkill(target, 51621, 48024, 51617, 48023, 0);
Spell::SelectMountByAreaAndSkill(target, GetSpellProto(), 51621, 48024, 51617, 48023, 0);
return;
case 51405: // Digging for Treasure
target->HandleEmote(EMOTE_STATE_WORK);
@ -2051,22 +2051,22 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
((Player*)target)->removeSpell(63680);
return;
case 71342: // Big Love Rocket
Spell::SelectMountByAreaAndSkill(target, 71344, 71345, 71346, 71347, 0);
Spell::SelectMountByAreaAndSkill(target, GetSpellProto(), 71344, 71345, 71346, 71347, 0);
return;
case 71563: // Deadly Precision
target->CastSpell(target, 71564, true, NULL, this);
return;
case 72286: // Invincible
Spell::SelectMountByAreaAndSkill(target, 72281, 72282, 72283, 72284, 0);
Spell::SelectMountByAreaAndSkill(target, GetSpellProto(), 72281, 72282, 72283, 72284, 0);
return;
case 74856: // Blazing Hippogryph
Spell::SelectMountByAreaAndSkill(target, 0, 0, 74854, 74855, 0);
Spell::SelectMountByAreaAndSkill(target, GetSpellProto(), 0, 0, 74854, 74855, 0);
return;
case 75614: // Celestial Steed
Spell::SelectMountByAreaAndSkill(target, 75619, 75620, 75617, 75618, 76153);
Spell::SelectMountByAreaAndSkill(target, GetSpellProto(), 75619, 75620, 75617, 75618, 76153);
return;
case 75973: // X-53 Touring Rocket
Spell::SelectMountByAreaAndSkill(target, 0, 0, 75957, 75972, 76154);
Spell::SelectMountByAreaAndSkill(target, GetSpellProto(), 0, 0, 75957, 75972, 76154);
return;
}
break;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11101"
#define REVISION_NR "11102"
#endif // __REVISION_NR_H__