[9882] Add support for mounts dependent from riding skill and location

This commit is contained in:
Laise 2010-05-12 13:33:17 +03:00
parent faf3e287c7
commit 41c58f3be9
5 changed files with 91 additions and 1 deletions

View file

@ -314,6 +314,9 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas
(47758,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Penance', 'Spell::EffectDummy'),
(47897, 5,0x0001000000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Shadowflame', 'Spell::EffectSchoolDMG'),
(47960,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Shadowflame', 'Spell::EffectSchoolDMG'),
(48023,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Headless Horseman\'s Mount', 'Aura::HandleAuraDummy'),
(48024,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Headless Horseman\'s Mount', 'Aura::HandleAuraDummy'),
(48025,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Headless Horseman\'s Mount', 'Aura::HandleAuraDummy'),
(48301,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Mind Trauma', 'Spell::EffectSchoolDMG'),
(48542,-1, -1, -1, -1, -1, -1, 30, -1,-1,'Revitalize', 'Spell::EffectEnergize'),
(48743,-1, -1, -1, -1, -1, -1, 10, -1,-1,'Death Pact', 'Spell::EffectHeal'),
@ -354,6 +357,8 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas
(51582, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Rocket Boots Engaged', 'Spell::EffectDummy'),
(51592, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Pickup Primordial Hatchling', 'Spell::EffectDummy'),
(51593,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Pickup Primordial Hatchling', 'Spell::EffectDummy'),
(51617,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Headless Horseman\'s Mount', 'Aura::HandleAuraDummy'),
(51621,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Headless Horseman\'s Mount', 'Aura::HandleAuraDummy'),
(51961, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Captured Chicken Cover', 'Spell::EffectDummy'),
(52025,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Cleansing Totem Effect', 'Spell::EffectDummy'),
(52032,-1, -1, -1, -1, -1, -1, 30, -1, 0,'Mana Spring Totem', 'Spell::EffectDummy'),
@ -458,10 +463,24 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas
(70937,-1, -1, -1, -1, -1, -1, -1, 4,-1,'Glyph of Eternal Water', 'Spell::EffectDummy'),
(71021,-1, -1, -1, -1, -1, -1, 31, -1,-1,'Saber Lash', 'Spell::EffectWeaponDmg'),
(71904, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Chaos Bane', 'Spell::EffectSchoolDMG'),
(72281, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Invincible', 'Aura::HandleAuraDummy'),
(72282, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Invincible', 'Aura::HandleAuraDummy'),
(72283, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Invincible', 'Aura::HandleAuraDummy'),
(72284, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Invincible', 'Aura::HandleAuraDummy'),
(72286, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Invincible', 'Aura::HandleAuraDummy'),
(72505, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Ooze Eruption', 'Spell::EffectSchoolDMG'),
(72624, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Ooze Eruption', 'Spell::EffectSchoolDMG'),
(72625, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Ooze Eruption', 'Spell::EffectSchoolDMG'),
(73422, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Chaos Bane', 'Spell::cast'),
(74854, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Blazing Hippogryph', 'Aura::HandleAuraDummy'),
(74855, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Blazing Hippogryph', 'Aura::HandleAuraDummy'),
(74856, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Blazing Hippogryph', 'Aura::HandleAuraDummy'),
(75614, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Celestial Steed', 'Aura::HandleAuraDummy'),
(75617, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Celestial Steed', 'Aura::HandleAuraDummy'),
(75618, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Celestial Steed', 'Aura::HandleAuraDummy'),
(75619, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Celestial Steed', 'Aura::HandleAuraDummy'),
(75620, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Celestial Steed', 'Aura::HandleAuraDummy'),
(76153, 0, -1, -1, -1, -1, -1, -1, -1,-1,'Celestial Steed', 'Aura::HandleAuraDummy'),
/*id fm familyMaskA fmMaskB icon vis cat eff aur ef name code */

View file

@ -6526,4 +6526,61 @@ void Spell::ResetEffectDamageAndHeal()
{
m_damage = 0;
m_healing = 0;
}
void Spell::SelectMountByAreaAndSkill(Unit* target, uint32 spellId75, uint32 spellId150, uint32 spellId225, uint32 spellId300, uint32 spellIdSpecial)
{
if (!target || target->GetTypeId() != TYPEID_PLAYER)
return;
// Prevent stacking of mounts
target->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
uint16 skillval = ((Player*)target)->GetSkillValue(SKILL_RIDING);
if (!skillval)
return;
if (skillval >= 225 && (spellId300 > 0 || spellId225 > 0))
{
uint32 spellid = skillval >= 300 ? spellId300 : spellId225;
SpellEntry const *pSpell = sSpellStore.LookupEntry(spellid);
// 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)->IsKnowHowFlyIn(target->GetMapId(),zone))
target->CastSpell(target, spellId150, true);
else if (spellIdSpecial > 0)
{
for (PlayerSpellMap::const_iterator iter = ((Player*)target)->GetSpellMap().begin(); iter != ((Player*)target)->GetSpellMap().end(); ++iter)
{
if (iter->second.state != PLAYERSPELL_REMOVED)
{
bool changedSpeed = false;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(iter->first);
for(int i = 0; i < MAX_EFFECT_INDEX; ++i)
{
if(spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED)
{
int32 mountSpeed = spellInfo->CalculateSimpleValue(SpellEffectIndex(i));
// speed higher than 300 replace it
if (mountSpeed > 300)
target->CastSpell(target, spellIdSpecial, true);
return;
}
}
}
}
target->CastSpell(target, pSpell, true);
}
else
target->CastSpell(target, pSpell, true);
}
else if (skillval >= 150 && spellId150 > 0)
target->CastSpell(target, spellId150, true);
else if (spellId75 > 0)
target->CastSpell(target, spellId75, true);
return;
}

View file

@ -497,6 +497,8 @@ class Spell
void CastTriggerSpells();
void CleanupTargetList();
static void SelectMountByAreaAndSkill(Unit* target, uint32 spellId75, uint32 spellId150, uint32 spellId225, uint32 spellId300, uint32 spellIdSpecial);
protected:
void SendLoot(uint64 guid, LootType loottype);

View file

@ -2290,6 +2290,9 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
// not use ammo and not allow use
((Player*)m_target)->RemoveAmmo();
return;
case 48025: // Headless Horseman's Mount
Spell::SelectMountByAreaAndSkill(m_target, 51621, 48024, 51617, 48023, NULL);
return;
case 62061: // Festive Holiday Mount
if (m_target->HasAuraType(SPELL_AURA_MOUNTED))
// Reindeer Transformation
@ -2305,6 +2308,15 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
if (m_target->GetTypeId() == TYPEID_PLAYER)
((Player*)m_target)->removeSpell(63680);
return;
case 72286: // Invincible
Spell::SelectMountByAreaAndSkill(m_target, 72281, 72282, 72283, 72284, NULL);
return;
case 74856: // Blazing Hippogryph
Spell::SelectMountByAreaAndSkill(m_target, NULL, NULL, 74854, 74855, NULL);
return;
case 75614: // Celestial Steed
Spell::SelectMountByAreaAndSkill(m_target, 75619, 75620, 75617, 75618, 76153);
return;
}
break;
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9881"
#define REVISION_NR "9882"
#endif // __REVISION_NR_H__