[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; 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) if (!target || target->GetTypeId() != TYPEID_PLAYER)
return; return;
@ -6894,13 +6894,19 @@ void Spell::SelectMountByAreaAndSkill(Unit* target, uint32 spellId75, uint32 spe
{ {
uint32 spellid = skillval >= 300 ? spellId300 : spellId225; uint32 spellid = skillval >= 300 ? spellId300 : spellId225;
SpellEntry const *pSpell = sSpellStore.LookupEntry(spellid); 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 // zone check
uint32 zone, area; uint32 zone, area;
target->GetZoneAndAreaId(zone, area); target->GetZoneAndAreaId(zone, area);
SpellCastResult locRes= sSpellMgr.GetSpellAllowedInLocationError(pSpell, target->GetMapId(), zone, area, target->GetCharmerOrOwnerPlayerOrPlayerItself()); SpellCastResult locRes= sSpellMgr.GetSpellAllowedInLocationError(pSpell, target->GetMapId(), zone, area, target->GetCharmerOrOwnerPlayerOrPlayerItself());
if (locRes != SPELL_CAST_OK || !((Player*)target)->CanStartFlyInArea(target->GetMapId(), zone, area)) 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) else if (spellIdSpecial > 0)
{ {
for (PlayerSpellMap::const_iterator iter = ((Player*)target)->GetSpellMap().begin(); iter != ((Player*)target)->GetSpellMap().end(); ++iter) 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 // speed higher than 280 replace it
if (mountSpeed > 280) if (mountSpeed > 280)
{ {
target->CastSpell(target, spellIdSpecial, true); target->CastSpell(target, spellIdSpecial, true, NULL, NULL, ObjectGuid(), parentSpell);
return; return;
} }
} }
} }
} }
} }
target->CastSpell(target, pSpell, true); target->CastSpell(target, pSpell, true, NULL, NULL, ObjectGuid(), parentSpell);
} }
else else
target->CastSpell(target, pSpell, true); target->CastSpell(target, pSpell, true, NULL, NULL, ObjectGuid(), parentSpell);
} }
else if (skillval >= 150 && spellId150 > 0) else if (skillval >= 150 && spellId150 > 0)
target->CastSpell(target, spellId150, true); target->CastSpell(target, spellId150, true, NULL, NULL, ObjectGuid(), parentSpell);
else if (spellId75 > 0) else if (spellId75 > 0)
target->CastSpell(target, spellId75, true); target->CastSpell(target, spellId75, true, NULL, NULL, ObjectGuid(), parentSpell);
return; return;
} }

View file

@ -489,7 +489,7 @@ class Spell
void CleanupTargetList(); void CleanupTargetList();
void ClearCastItem(); 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: protected:
bool HasGlobalCooldown(); bool HasGlobalCooldown();
void TriggerGlobalCooldown(); void TriggerGlobalCooldown();

View file

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

View file

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