Merge commit 'dbaf88566be7083408fb8324d7886dc3e0a45cc0' into 4.3.4
Conflicts: .gitattributes CONTRIBUTING.md sql/updates/world/2015_05_11_04_world.sql sql/updates/world/2015_05_27_00_world.sql sql/updates/world/2015_05_27_01_world.sql sql/updates/world/2015_06_06_01_world_335.sql src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp src/server/game/Entities/Creature/Creature.cpp src/server/game/Entities/Creature/Creature.h src/server/game/Entities/Object/ObjectGuid.h src/server/game/Entities/Player/Player.cpp src/server/game/Entities/Player/Player.h src/server/game/Entities/Unit/Unit.cpp src/server/game/Entities/Unit/Unit.h src/server/game/Spells/Auras/SpellAuras.cpp src/server/game/Spells/Spell.cpp src/server/game/Spells/SpellMgr.cpp src/server/scripts/Commands/cs_modify.cpp src/server/scripts/Kalimdor/zone_moonglade.cpp src/server/scripts/Spells/spell_hunter.cpp src/server/scripts/Spells/spell_item.cpp src/server/scripts/Spells/spell_rogue.cpp
This commit is contained in:
commit
6dfaec3d97
119 files changed
+3776
-2162
No files matched your search
@@ -51,6 +51,7 @@
|
||||
#include "SpellScript.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "SpellHistory.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "Battlefield.h"
|
||||
#include "BattlefieldMgr.h"
|
||||
@@ -3235,7 +3236,7 @@ void Spell::cast(bool skipCheck)
|
||||
|
||||
//Clear spell cooldowns after every spell is cast if .cheat cooldown is enabled.
|
||||
if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_COOLDOWN))
|
||||
m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
|
||||
m_caster->GetSpellHistory()->ResetCooldown(m_spellInfo->Id, true);
|
||||
}
|
||||
|
||||
SetExecutedCurrently(false);
|
||||
@@ -3442,30 +3443,7 @@ void Spell::_handle_finish_phase()
|
||||
|
||||
void Spell::SendSpellCooldown()
|
||||
{
|
||||
Player* _player = m_caster->ToPlayer();
|
||||
if (!_player)
|
||||
{
|
||||
// Handle pet cooldowns here if needed instead of in PetAI to avoid hidden cooldown restarts
|
||||
Creature* _creature = m_caster->ToCreature();
|
||||
if (_creature && (_creature->IsPet() || _creature->IsGuardian()))
|
||||
_creature->AddCreatureSpellCooldown(m_spellInfo->Id);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// mana/health/etc potions, disabled by client (until combat out as declarate)
|
||||
if (m_CastItem && (m_CastItem->IsPotion() || m_spellInfo->IsCooldownStartedOnEvent()))
|
||||
{
|
||||
// need in some way provided data for Spell::finish SendCooldownEvent
|
||||
_player->SetLastPotionId(m_CastItem->GetEntry());
|
||||
return;
|
||||
}
|
||||
|
||||
// have infinity cooldown but set at aura apply // do not set cooldown for triggered spells (needed by reincarnation)
|
||||
if (m_spellInfo->IsCooldownStartedOnEvent() || m_spellInfo->IsPassive() || (_triggeredCastFlags & TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD))
|
||||
return;
|
||||
|
||||
_player->AddSpellAndCategoryCooldowns(m_spellInfo, m_CastItem ? m_CastItem->GetEntry() : 0, this);
|
||||
m_caster->GetSpellHistory()->HandleCooldowns(m_spellInfo, m_CastItem, this);
|
||||
}
|
||||
|
||||
void Spell::update(uint32 difftime)
|
||||
@@ -4702,23 +4680,26 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
return SPELL_FAILED_CASTER_DEAD;
|
||||
|
||||
// check cooldowns to prevent cheating
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE))
|
||||
if (!m_spellInfo->IsPassive())
|
||||
{
|
||||
//can cast triggered (by aura only?) spells while have this flag
|
||||
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_CASTER_AURASTATE) && m_caster->ToPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY))
|
||||
return SPELL_FAILED_SPELL_IN_PROGRESS;
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
//can cast triggered (by aura only?) spells while have this flag
|
||||
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_CASTER_AURASTATE) && m_caster->ToPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY))
|
||||
return SPELL_FAILED_SPELL_IN_PROGRESS;
|
||||
|
||||
if (m_caster->ToPlayer()->HasSpellCooldown(m_spellInfo->Id))
|
||||
// check if we are using a potion in combat for the 2nd+ time. Cooldown is added only after caster gets out of combat
|
||||
if (m_caster->ToPlayer()->GetLastPotionId() && m_CastItem && (m_CastItem->IsPotion() || m_spellInfo->IsCooldownStartedOnEvent()))
|
||||
return SPELL_FAILED_NOT_READY;
|
||||
}
|
||||
|
||||
if (!m_caster->GetSpellHistory()->IsReady(m_spellInfo))
|
||||
{
|
||||
if (m_triggeredByAuraSpell)
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
else
|
||||
return SPELL_FAILED_NOT_READY;
|
||||
}
|
||||
|
||||
// check if we are using a potion in combat for the 2nd+ time. Cooldown is added only after caster gets out of combat
|
||||
if (m_caster->ToPlayer()->GetLastPotionId() && m_CastItem && (m_CastItem->IsPotion() || m_spellInfo->IsCooldownStartedOnEvent()))
|
||||
return SPELL_FAILED_NOT_READY;
|
||||
}
|
||||
|
||||
if (m_spellInfo->HasAttribute(SPELL_ATTR7_IS_CHEAT_SPELL) && !m_caster->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_ALLOW_CHEAT_SPELLS))
|
||||
@@ -5570,13 +5551,13 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
|
||||
}
|
||||
|
||||
// cooldown
|
||||
if (Creature const* creatureCaster = m_caster->ToCreature())
|
||||
if (creatureCaster->HasSpellCooldown(m_spellInfo->Id))
|
||||
if (Creature* creatureCaster = m_caster->ToCreature())
|
||||
if (!creatureCaster->GetSpellHistory()->IsReady(m_spellInfo))
|
||||
return SPELL_FAILED_NOT_READY;
|
||||
|
||||
// Check if spell is affected by GCD
|
||||
if (m_spellInfo->StartRecoveryCategory > 0)
|
||||
if (m_caster->GetCharmInfo() && m_caster->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(m_spellInfo))
|
||||
if (m_caster->GetCharmInfo() && m_caster->GetSpellHistory()->HasGlobalCooldown(m_spellInfo))
|
||||
return SPELL_FAILED_NOT_READY;
|
||||
|
||||
return CheckCast(true);
|
||||
@@ -5899,7 +5880,7 @@ SpellCastResult Spell::CheckItems()
|
||||
if (!proto)
|
||||
return SPELL_FAILED_ITEM_NOT_READY;
|
||||
|
||||
for (uint8 i = 0; i < MAX_ITEM_SPELLS; ++i)
|
||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||
if (proto->Spells[i].SpellCharges)
|
||||
if (m_CastItem->GetSpellCharges(i) == 0)
|
||||
return SPELL_FAILED_NO_CHARGES_REMAIN;
|
||||
@@ -7283,13 +7264,11 @@ enum GCDLimits
|
||||
|
||||
bool Spell::HasGlobalCooldown() const
|
||||
{
|
||||
// Only player or controlled units have global cooldown
|
||||
if (m_caster->GetCharmInfo())
|
||||
return m_caster->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(m_spellInfo);
|
||||
else if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
return m_caster->ToPlayer()->GetGlobalCooldownMgr().HasGlobalCooldown(m_spellInfo);
|
||||
else
|
||||
// Only players or controlled units have global cooldown
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER && !m_caster->GetCharmInfo())
|
||||
return false;
|
||||
|
||||
return m_caster->GetSpellHistory()->HasGlobalCooldown(m_spellInfo);
|
||||
}
|
||||
|
||||
void Spell::TriggerGlobalCooldown()
|
||||
@@ -7298,6 +7277,10 @@ void Spell::TriggerGlobalCooldown()
|
||||
if (!gcd)
|
||||
return;
|
||||
|
||||
// Only players or controlled units have global cooldown
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER && !m_caster->GetCharmInfo())
|
||||
return;
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
if (m_caster->ToPlayer()->GetCommandStatus(CHEAT_COOLDOWN))
|
||||
return;
|
||||
@@ -7319,11 +7302,7 @@ void Spell::TriggerGlobalCooldown()
|
||||
gcd = MAX_GCD;
|
||||
}
|
||||
|
||||
// Only players or controlled units have global cooldown
|
||||
if (m_caster->GetCharmInfo())
|
||||
m_caster->GetCharmInfo()->GetGlobalCooldownMgr().AddGlobalCooldown(m_spellInfo, gcd);
|
||||
else if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
m_caster->ToPlayer()->GetGlobalCooldownMgr().AddGlobalCooldown(m_spellInfo, gcd);
|
||||
m_caster->GetSpellHistory()->AddGlobalCooldown(m_spellInfo, gcd);
|
||||
}
|
||||
|
||||
void Spell::CancelGlobalCooldown()
|
||||
@@ -7336,10 +7315,10 @@ void Spell::CancelGlobalCooldown()
|
||||
return;
|
||||
|
||||
// Only players or controlled units have global cooldown
|
||||
if (m_caster->GetCharmInfo())
|
||||
m_caster->GetCharmInfo()->GetGlobalCooldownMgr().CancelGlobalCooldown(m_spellInfo);
|
||||
else if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
m_caster->ToPlayer()->GetGlobalCooldownMgr().CancelGlobalCooldown(m_spellInfo);
|
||||
if (m_caster->GetTypeId() != TYPEID_PLAYER && !m_caster->GetCharmInfo())
|
||||
return;
|
||||
|
||||
m_caster->GetSpellHistory()->CancelGlobalCooldown(m_spellInfo);
|
||||
}
|
||||
|
||||
namespace Trinity
|
||||
@@ -7458,7 +7437,7 @@ bool WorldObjectSpellConeTargetCheck::operator()(WorldObject* target)
|
||||
}
|
||||
else if (_spellInfo->HasAttribute(SPELL_ATTR0_CU_CONE_LINE))
|
||||
{
|
||||
if (!_caster->HasInLine(target, _caster->GetObjectSize()))
|
||||
if (!_caster->HasInLine(target, _caster->GetObjectSize() + target->GetObjectSize()))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -7475,7 +7454,7 @@ WorldObjectSpellTrajTargetCheck::WorldObjectSpellTrajTargetCheck(float range, Po
|
||||
bool WorldObjectSpellTrajTargetCheck::operator()(WorldObject* target)
|
||||
{
|
||||
// return all targets on missile trajectory (0 - size of a missile)
|
||||
if (!_caster->HasInLine(target, 0))
|
||||
if (!_caster->HasInLine(target, target->GetObjectSize()))
|
||||
return false;
|
||||
return WorldObjectSpellAreaTargetCheck::operator ()(target);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user