aboutsummaryrefslogtreecommitdiff
path: root/src/game/Player.cpp
diff options
context:
space:
mode:
authorShauren <none@none>2010-05-24 16:11:35 +0200
committerShauren <none@none>2010-05-24 16:11:35 +0200
commit2f5e46ee896eca79441c7878ac4141644cd9155e (patch)
tree0982dd960f089dce00b3a82738459a5bb9bd183d /src/game/Player.cpp
parentffe78ba600d407ca4304b6d077242e1956ae73fc (diff)
Fixed remaining scaling mounts that have 310% speed when you have other 310% mount: Celestial Steed and X-53 Touring Rocket
--HG-- branch : trunk
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r--src/game/Player.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 0b31ec67b1f..5a99c66d8ee 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -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);