Fixed remaining scaling mounts that have 310% speed when you have other 310% mount: Celestial Steed and X-53 Touring Rocket

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-05-24 16:11:35 +02:00
parent ffe78ba600
commit 2f5e46ee89
3 changed files with 127 additions and 0 deletions
+51
View File
@@ -3333,6 +3333,12 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
if (!pSkill)
continue;
if (!Has310Flyer(false) && pSkill->id == SKILL_MOUNTS)
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
spellInfo->CalculateSimpleValue(i) == 310)
SetHas310Flyer(true);
if (HasSkill(pSkill->id))
continue;
@@ -3355,6 +3361,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
break;
}
}
}
}
@@ -3596,6 +3603,16 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
SetSkill(pSkill->id, GetSkillStep(pSkill->id), 0, 0);
}
// most likely will never be used, haven't heard of cases where players unlearn a mount
if (Has310Flyer(false) && _spell_idx->second->skillId == SKILL_MOUNTS)
{
SpellEntry const *pSpellInfo = sSpellStore.LookupEntry(spell_id);
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (pSpellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
pSpellInfo->CalculateSimpleValue(i) == 310)
Has310Flyer(true, spell_id); // with true as first argument its also used to set/remove the flag
}
}
}
@@ -3665,6 +3682,40 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
}
}
bool Player::Has310Flyer(bool checkAllSpells, uint32 excludeSpellId)
{
if (!checkAllSpells)
return m_ExtraFlags & PLAYER_EXTRA_HAS_310_FLYER;
else
{
SetHas310Flyer(false);
SpellEntry const *pSpellInfo;
for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
{
if (itr->first == excludeSpellId)
continue;
SkillLineAbilityMapBounds bounds = spellmgr.GetSkillLineAbilityMapBounds(itr->first);
for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
{
if (_spell_idx->second->skillId != SKILL_MOUNTS)
break; // We can break because mount spells belong only to one skillline (at least 310 flyers do)
pSpellInfo = sSpellStore.LookupEntry(itr->first);
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (pSpellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
pSpellInfo->CalculateSimpleValue(i) == 310)
{
SetHas310Flyer(true);
return true;
}
}
}
}
return false;
}
void Player::RemoveSpellCooldown(uint32 spell_id, bool update /* = false */)
{
m_spellCooldowns.erase(spell_id);