Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2024-08-18 23:02:22 +08:00
50 changed files with 2365 additions and 1344 deletions

View File

@@ -20,6 +20,7 @@
#include "BattlefieldMgr.h"
#include "Battleground.h"
#include "BattlegroundIC.h"
#include "CharmInfo.h"
#include "CellImpl.h"
#include "Common.h"
#include "ConditionMgr.h"
@@ -3738,6 +3739,10 @@ void Spell::cancel(bool bySelf)
if (Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID))
unit->RemoveOwnedAura(m_spellInfo->Id, m_originalCasterGUID, 0, AURA_REMOVE_BY_CANCEL);
if (m_caster->GetTypeId() == TYPEID_PLAYER)
if (m_spellInfo->HasAttribute(SPELL_ATTR0_COOLDOWN_ON_EVENT))
m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
SendChannelUpdate(0);
SendInterrupted(SPELL_FAILED_INTERRUPTED);
}
@@ -4104,6 +4109,9 @@ void Spell::handle_immediate()
if (m_spellInfo->IsChanneled())
{
int32 duration = m_spellInfo->GetDuration();
if (HasTriggeredCastFlag(TRIGGERED_IGNORE_EFFECTS))
duration = -1;
if (duration > 0)
{
// First mod_duration then haste - see Missile Barrage
@@ -4370,8 +4378,12 @@ void Spell::SendSpellCooldown()
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() || (HasTriggeredCastFlag(TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD) && !m_CastItem))
// 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()
|| (HasTriggeredCastFlag(TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD) && !m_CastItem)
|| HasTriggeredCastFlag(TRIGGERED_IGNORE_EFFECTS))
return;
_player->AddSpellAndCategoryCooldowns(m_spellInfo, m_CastItem ? m_CastItem->GetEntry() : 0, this);
@@ -5600,6 +5612,9 @@ void Spell::HandleThreatSpells()
void Spell::HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGOTarget, uint32 i, SpellEffectHandleMode mode)
{
if (HasTriggeredCastFlag(TRIGGERED_IGNORE_EFFECTS))
return;
effectHandleMode = mode;
unitTarget = pUnitTarget;
itemTarget = pItemTarget;
@@ -6016,6 +6031,11 @@ SpellCastResult Spell::CheckCast(bool strict)
return castResult;
}
if (HasTriggeredCastFlag(TRIGGERED_IGNORE_EFFECTS))
{
return SPELL_CAST_OK;
}
// xinef: do not skip triggered spells if they posses prevention type (eg. Bladestorm vs Hand of Protection)
if (!HasTriggeredCastFlag(TRIGGERED_IGNORE_CASTER_AURAS) || (m_spellInfo->PreventionType > SPELL_PREVENTION_TYPE_NONE && m_triggeredByAuraSpell && m_triggeredByAuraSpell.spellInfo->IsPositive()))
{
@@ -6453,7 +6473,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_BAD_TARGETS;
Player* target = ObjectAccessor::FindPlayer(m_caster->ToPlayer()->GetTarget());
if (!target || m_caster->ToPlayer() == target || (!target->IsInSameRaidWith(m_caster->ToPlayer()) && m_spellInfo->Id != 48955)) // refer-a-friend spell
if (!target || (!target->IsInSameRaidWith(m_caster->ToPlayer()) && m_spellInfo->Id != 48955)) // refer-a-friend spell
return SPELL_FAILED_BAD_TARGETS;
// Xinef: Implement summon pending error
@@ -8056,6 +8076,9 @@ bool Spell::IsAutoActionResetSpell() const
bool Spell::IsNeedSendToClient(bool go) const
{
if (HasTriggeredCastFlag(TRIGGERED_IGNORE_EFFECTS))
return false;
return m_spellInfo->SpellVisual[0] || m_spellInfo->SpellVisual[1] || m_spellInfo->IsChanneled() ||
m_spellInfo->Speed > 0.0f || (!m_triggeredByAuraSpell && !IsTriggered()) ||
(go && m_triggeredByAuraSpell && m_triggeredByAuraSpell.spellInfo->IsChanneled());