Merge branch 'master' of github.com:TrinityCore/TrinityCore

This commit is contained in:
Shauren
2011-07-23 00:23:27 +02:00
5 changed files with 4 additions and 64 deletions
+1 -51
View File
@@ -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);
-6
View File
@@ -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;
+1 -5
View File
@@ -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;
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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