diff options
author | Shauren <shauren.trinity@gmail.com> | 2011-07-23 00:23:27 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2011-07-23 00:23:27 +0200 |
commit | bd45e59e9fcf82e46a3faf9530cf74a43ec6e474 (patch) | |
tree | 54167519c65d1d67503e8b44910505491b7bbeeb /src | |
parent | 18d4daf5394ad83c64e24b34b334da2743eebdd1 (diff) | |
parent | a0f1a5c78900037827e46ef82277cc293a39e0bd (diff) |
Merge branch 'master' of github.com:TrinityCore/TrinityCore
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Entities/Player/Player.cpp | 52 | ||||
-rwxr-xr-x | src/server/game/Entities/Player/Player.h | 6 | ||||
-rwxr-xr-x | src/server/game/Spells/Spell.cpp | 6 | ||||
-rwxr-xr-x | src/server/game/Spells/SpellEffects.cpp | 2 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_item.cpp | 2 |
5 files changed, 4 insertions, 64 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index eea6159dbeb..851c92222ef 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -842,8 +842,6 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa for (uint8 i = 0; i < MAX_POWERS; ++i) m_powerFraction[i] = 0; - m_globalCooldowns.clear(); - m_ConditionErrorMsgId = 0; isDebugAreaTriggers = false; @@ -1504,17 +1502,6 @@ void Player::Update(uint32 p_time) m_nextMailDelivereTime = 0; } - for (std::map<uint32, uint32>::iterator itr = m_globalCooldowns.begin(); itr != m_globalCooldowns.end(); ++itr) - { - if (itr->second) - { - if (itr->second > p_time) - itr->second -= p_time; - else - itr->second = 0; - } - } - // If this is set during update SetSpellModTakingSpell call is missing somewhere in the code // Having this would prevent more aura charges to be dropped, so let's crash //ASSERT (!m_spellModTakingSpell); @@ -12094,7 +12081,7 @@ Item* Player::EquipItem(uint16 pos, Item *pItem, bool update) { m_weaponChangeTimer = spellProto->StartRecoveryTime; - AddGlobalCooldown(spellProto, NULL); // NULL spell is safe (needed for serverside GCD + GetGlobalCooldownMgr().AddGlobalCooldown(spellProto, m_weaponChangeTimer); WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4); data << uint64(GetGUID()); @@ -22922,43 +22909,6 @@ void Player::UpdateCharmedAI() } } -void Player::AddGlobalCooldown(SpellEntry const *spellInfo, Spell* spell) -{ - if (!spellInfo || !spellInfo->StartRecoveryTime) - return; - - float cdTime = float(spellInfo->StartRecoveryTime); - - if (!(spellInfo->Attributes & (SPELL_ATTR0_ABILITY|SPELL_ATTR0_PASSIVE))) - cdTime *= GetFloatValue(UNIT_MOD_CAST_SPEED); - else if (IsRangedWeaponSpell(spellInfo) && spell && !spell->IsAutoRepeat()) - cdTime *= m_modAttackSpeedPct[RANGED_ATTACK]; - - if (cdTime > 1500.0f) - cdTime = 1500.0f; - - ApplySpellMod(spellInfo->Id, SPELLMOD_GLOBAL_COOLDOWN, cdTime, spell); - if (cdTime > 0) - m_globalCooldowns[spellInfo->StartRecoveryCategory] = uint32(cdTime); -} - -bool Player::HasGlobalCooldown(SpellEntry const *spellInfo) const -{ - if (!spellInfo) - return false; - - std::map<uint32, uint32>::const_iterator itr = m_globalCooldowns.find(spellInfo->StartRecoveryCategory); - return itr != m_globalCooldowns.end() && (itr->second > sWorld->GetUpdateTime()); -} - -void Player::RemoveGlobalCooldown(SpellEntry const *spellInfo) -{ - if (!spellInfo || !spellInfo->StartRecoveryTime) - return; - - m_globalCooldowns[spellInfo->StartRecoveryCategory] = 0; -} - uint32 Player::GetRuneBaseCooldown(uint8 index) { uint8 rune = GetBaseRune(index); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 6ba3af8e97d..4f7167c7c17 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1700,11 +1700,6 @@ class Player : public Unit, public GridObject<Player> void SetLastPotionId(uint32 item_id) { m_lastPotionId = item_id; } void UpdatePotionCooldown(Spell* spell = NULL); - // global cooldown - void AddGlobalCooldown(SpellEntry const *spellInfo, Spell* spell); - bool HasGlobalCooldown(SpellEntry const *spellInfo) const; - void RemoveGlobalCooldown(SpellEntry const *spellInfo); - void setResurrectRequestData(uint64 guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana) { m_resurrectGUID = guid; @@ -2754,7 +2749,6 @@ class Player : public Unit, public GridObject<Player> ReputationMgr m_reputationMgr; SpellCooldowns m_spellCooldowns; - std::map<uint32, uint32> m_globalCooldowns; // whole start recovery category stored in one uint32 m_ChampioningFaction; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 28849f09386..5ac19c3d6c5 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3017,9 +3017,6 @@ void Spell::cancel() if (m_selfContainer && *m_selfContainer == this) *m_selfContainer = NULL; - if (m_caster->GetTypeId() == TYPEID_PLAYER) - m_caster->ToPlayer()->RemoveGlobalCooldown(m_spellInfo); - m_caster->RemoveDynObject(m_spellInfo->Id); m_caster->RemoveGameObject(m_spellInfo->Id, true); @@ -4598,8 +4595,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (!m_IsTriggeredSpell && m_caster->ToPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY)) return SPELL_FAILED_SPELL_IN_PROGRESS; - if (m_caster->ToPlayer()->HasSpellCooldown(m_spellInfo->Id) || - (strict && !m_IsTriggeredSpell && m_caster->ToPlayer()->HasGlobalCooldown(m_spellInfo))) + if (m_caster->ToPlayer()->HasSpellCooldown(m_spellInfo->Id)) { if (m_triggeredByAuraSpell) return SPELL_FAILED_DONT_REPORT; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 1049a1aef33..5eb0a440f8e 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -784,7 +784,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) if (!unitTarget) return; - // apply damage percent mods + // apply percent damage mods damage = m_caster->SpellDamageBonus(unitTarget, m_spellInfo, damage, SPELL_DIRECT_DAMAGE); switch (m_spellInfo->Id) diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 6d2818e507c..acf92d3a984 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -775,7 +775,7 @@ class spell_item_red_rider_air_rifle : public SpellScriptLoader GetCaster()->CastSpell(GetCaster(), SPELL_AIR_RIFLE_HOLD_VISUAL, true); // needed because this spell shares GCD with its triggered spells (which must not be cast with triggered flag) if (Player* player = GetCaster()->ToPlayer()) - player->RemoveGlobalCooldown(GetSpellInfo()); + player->GetGlobalCooldownMgr().CancelGlobalCooldown(GetSpellInfo()); if (urand(0, 4)) GetCaster()->CastSpell(GetHitUnit(), SPELL_AIR_RIFLE_SHOOT, false); else |