Merge branch 'azerothcore:master' into Playerbot

This commit is contained in:
ZhengPeiRu21
2022-05-23 09:04:16 -06:00
committed by GitHub
67 changed files with 339 additions and 201 deletions
+2 -2
View File
@@ -43,14 +43,14 @@ void GuardAI::EnterEvadeMode(EvadeReason /*why*/)
{
me->GetMotionMaster()->MoveIdle();
me->CombatStop(true);
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
return;
}
LOG_DEBUG("entities.unit", "Guard entry: {} enters evade mode.", me->GetEntry());
me->RemoveAllAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
// Remove ChaseMovementGenerator from MotionMaster stack list, and add HomeMovementGenerator instead
+1 -1
View File
@@ -563,7 +563,7 @@ void PetAI::HandleReturnMovement()
me->GetCharmInfo()->SetForcedTargetGUID();
// xinef: remember that npcs summoned by npcs can also be pets
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->ClearInPetCombat();
}
+1 -1
View File
@@ -305,7 +305,7 @@ bool CreatureAI::_EnterEvadeMode(EvadeReason /*why*/)
me->ClearComboPointHolders(); // Remove all combo points targeting this unit
// sometimes bosses stuck in combat?
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->LoadCreaturesAddon(true);
me->SetLootRecipient(nullptr);
@@ -201,7 +201,7 @@ void npc_escortAI::ReturnToLastPoint()
void npc_escortAI::EnterEvadeMode(EvadeReason /*why*/)
{
me->RemoveAllAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->SetLootRecipient(nullptr);
@@ -153,7 +153,7 @@ void FollowerAI::JustRespawned()
void FollowerAI::EnterEvadeMode(EvadeReason /*why*/)
{
me->RemoveAllAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->SetLootRecipient(nullptr);
+7
View File
@@ -406,6 +406,13 @@ ThreatMgr::ThreatMgr(Unit* owner) : iCurrentVictim(nullptr), iOwner(owner), iUpd
{
}
void ThreatMgr::ClearAllThreat()
{
if (iOwner->CanHaveThreatList() && !isThreatListEmpty())
iOwner->SendClearThreatListOpcode();
clearReferences();
}
//============================================================
void ThreatMgr::clearReferences()
+2
View File
@@ -236,6 +236,8 @@ public:
// -- compatibility layer for combat rewrite
void ResetAllThreat() { resetAllAggro(); }
void ClearAllThreat();
// Reset all aggro of unit in threadlist satisfying the predicate.
template<class PREDICATE> void resetAggro(PREDICATE predicate)
{
@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "SpellAuraEffects.h"
#include "GameTime.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
@@ -26,7 +27,7 @@
#include "World.h"
DynamicObject::DynamicObject(bool isWorldObject) : WorldObject(isWorldObject), MovableMapObject(),
_aura(nullptr), _removedAura(nullptr), _caster(nullptr), _duration(0), _isViewpoint(false)
_aura(nullptr), _removedAura(nullptr), _caster(nullptr), _duration(0), _isViewpoint(false), _updateViewerVisibilityTimer(0)
{
m_objectType |= TYPEMASK_DYNAMICOBJECT;
m_objectTypeId = TYPEID_DYNAMICOBJECT;
@@ -125,15 +126,17 @@ bool DynamicObject::CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caste
SetFloatValue(DYNAMICOBJECT_RADIUS, radius);
SetUInt32Value(DYNAMICOBJECT_CASTTIME, GameTime::GetGameTimeMS().count());
if (IsWorldObject())
setActive(true); //must before add to map to be put in world container
if (!GetMap()->AddToMap(this, true))
{
// Returning false will cause the object to be deleted - remove from transport
return false;
}
if (IsWorldObject())
{
setActive(true);
}
return true;
}
@@ -165,7 +168,22 @@ void DynamicObject::Update(uint32 p_time)
if (expired)
Remove();
else
{
if (_updateViewerVisibilityTimer)
{
if (_updateViewerVisibilityTimer <= p_time)
{
_updateViewerVisibilityTimer = 0;
if (Player* playerCaster = _caster->ToPlayer())
playerCaster->UpdateVisibilityForPlayer();
}
else
_updateViewerVisibilityTimer -= p_time;
}
sScriptMgr->OnDynamicObjectUpdate(this, p_time);
}
}
void DynamicObject::Remove()
@@ -214,13 +232,22 @@ void DynamicObject::RemoveAura()
_removedAura->_Remove(AURA_REMOVE_BY_DEFAULT);
}
void DynamicObject::SetCasterViewpoint()
void DynamicObject::SetCasterViewpoint(bool updateViewerVisibility)
{
if (Player* caster = _caster->ToPlayer())
{
// Remove old farsight viewpoint
if (Unit* farsightObject = ObjectAccessor::GetUnit(*caster, caster->GetGuidValue(PLAYER_FARSIGHT)))
{
_oldFarsightGUID = caster->GetGuidValue(PLAYER_FARSIGHT);
caster->SetViewpoint(farsightObject, false);
}
caster->SetViewpoint(this, true);
_isViewpoint = true;
}
_updateViewerVisibilityTimer = updateViewerVisibility ? 100 : 0;
}
void DynamicObject::RemoveCasterViewpoint()
@@ -229,6 +256,13 @@ void DynamicObject::RemoveCasterViewpoint()
{
caster->SetViewpoint(this, false);
_isViewpoint = false;
// Restore prev farsight viewpoint
if (Unit* farsightObject = ObjectAccessor::GetUnit(*caster, _oldFarsightGUID))
{
caster->SetViewpoint(farsightObject, true);
}
_oldFarsightGUID.Clear();
}
}
@@ -50,7 +50,7 @@ public:
void Delay(int32 delaytime);
void SetAura(Aura* aura);
void RemoveAura();
void SetCasterViewpoint();
void SetCasterViewpoint(bool updateViewerVisibility);
void RemoveCasterViewpoint();
[[nodiscard]] Unit* GetCaster() const { return _caster; }
void BindToCaster();
@@ -60,11 +60,15 @@ public:
[[nodiscard]] float GetRadius() const { return GetFloatValue(DYNAMICOBJECT_RADIUS); }
[[nodiscard]] bool IsViewpoint() const { return _isViewpoint; }
ObjectGuid const& GetOldFarsightGUID() const { return _oldFarsightGUID; }
protected:
Aura* _aura;
Aura* _removedAura;
Unit* _caster;
int32 _duration; // for non-aura dynobjects
bool _isViewpoint;
uint32 _updateViewerVisibilityTimer;
ObjectGuid _oldFarsightGUID;
};
#endif
+6 -6
View File
@@ -65,7 +65,7 @@ constexpr float VisibilityDistances[AsUnderlyingType(VisibilityDistanceType::Max
VISIBILITY_DISTANCE_SMALL,
VISIBILITY_DISTANCE_LARGE,
VISIBILITY_DISTANCE_GIGANTIC,
MAX_VISIBILITY_DISTANCE
VISIBILITY_DISTANCE_INFINITE
};
Object::Object() : m_PackGUID(sizeof(uint64) + 1)
@@ -1631,7 +1631,7 @@ float WorldObject::GetGridActivationRange() const
{
return ToCreature()->m_SightDistance;
}
else if (GetTypeId() == TYPEID_GAMEOBJECT && ToGameObject()->IsTransport() && isActiveObject())
else if (((GetTypeId() == TYPEID_GAMEOBJECT && ToGameObject()->IsTransport()) || GetTypeId() == TYPEID_DYNAMICOBJECT) && isActiveObject())
{
return GetMap()->GetVisibilityRange();
}
@@ -1643,7 +1643,7 @@ float WorldObject::GetVisibilityRange() const
{
if (IsVisibilityOverridden() && GetTypeId() == TYPEID_UNIT)
{
return MAX_VISIBILITY_DISTANCE;
return *m_visibilityDistanceOverride;
}
else if (GetTypeId() == TYPEID_GAMEOBJECT)
{
@@ -1654,7 +1654,7 @@ float WorldObject::GetVisibilityRange() const
}
else if (IsVisibilityOverridden())
{
return MAX_VISIBILITY_DISTANCE;
return *m_visibilityDistanceOverride;
}
else
{
@@ -1676,7 +1676,7 @@ float WorldObject::GetSightRange(WorldObject const* target) const
{
if (target->IsVisibilityOverridden() && target->GetTypeId() == TYPEID_UNIT)
{
return MAX_VISIBILITY_DISTANCE;
return *target->m_visibilityDistanceOverride;
}
else if (target->GetTypeId() == TYPEID_GAMEOBJECT)
{
@@ -1686,7 +1686,7 @@ float WorldObject::GetSightRange(WorldObject const* target) const
}
else if (target->IsVisibilityOverridden())
{
return MAX_VISIBILITY_DISTANCE;
return *target->m_visibilityDistanceOverride;
}
else if (ToPlayer()->GetCinematicMgr()->IsOnCinematic())
{
@@ -31,6 +31,7 @@
#define MAX_VISIBILITY_DISTANCE 250.0f // max distance for visible objects, experimental
#define SIGHT_RANGE_UNIT 50.0f
#define MAX_SEARCHER_DISTANCE 150.0f // pussywizard: replace the use of MAX_VISIBILITY_DISTANCE in searchers, because MAX_VISIBILITY_DISTANCE is quite too big for this purpose
#define VISIBILITY_DISTANCE_INFINITE 533.0f
#define VISIBILITY_DISTANCE_GIGANTIC 400.0f
#define VISIBILITY_DISTANCE_LARGE 200.0f
#define VISIBILITY_DISTANCE_NORMAL 100.0f
+3 -3
View File
@@ -6967,7 +6967,7 @@ void Player::ApplyItemEquipSpell(Item* item, bool apply, bool form_change)
continue;
// Spells that should stay on the caster after removing the item.
constexpr std::array<uint32, 1> spellExceptions = { /*Electromagnetic Gigaflux Reactivator*/ 11826 };
constexpr std::array<int32, 1> spellExceptions = { /*Electromagnetic Gigaflux Reactivator*/ 11826 };
const auto found = std::find(std::begin(spellExceptions), std::end(spellExceptions), spellData.SpellId);
// wrong triggering type
@@ -12830,7 +12830,7 @@ void Player::SetViewpoint(WorldObject* target, bool apply)
if (!AddGuidValue(PLAYER_FARSIGHT, target->GetGUID()))
{
LOG_FATAL("entities.player", "Player::CreateViewpoint: Player {} cannot add new viewpoint!", GetName());
LOG_DEBUG("entities.player", "Player::CreateViewpoint: Player {} cannot add new viewpoint!", GetName());
return;
}
@@ -12850,7 +12850,7 @@ void Player::SetViewpoint(WorldObject* target, bool apply)
if (!RemoveGuidValue(PLAYER_FARSIGHT, target->GetGUID()))
{
LOG_FATAL("entities.player", "Player::CreateViewpoint: Player {} cannot remove current viewpoint!", GetName());
LOG_DEBUG("entities.player", "Player::CreateViewpoint: Player {} cannot remove current viewpoint!", GetName());
return;
}
+1
View File
@@ -1356,6 +1356,7 @@ public:
void ApplyEnchantment(Item* item, bool apply);
void UpdateSkillEnchantments(uint16 skill_id, uint16 curr_value, uint16 new_value);
void SendEnchantmentDurations();
void UpdateEnchantmentDurations();
void BuildEnchantmentsInfoData(WorldPacket* data);
void AddItemDurations(Item* item);
void RemoveItemDurations(Item* item);
@@ -4758,6 +4758,14 @@ void Player::SendEnchantmentDurations()
}
}
void Player::UpdateEnchantmentDurations()
{
for (EnchantDurationList::iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end(); ++itr)
{
itr->item->SetEnchantmentDuration(itr->slot, itr->leftduration, this);
}
}
void Player::SendItemDurations()
{
for (ItemDurationList::const_iterator itr = m_itemDuration.begin(); itr != m_itemDuration.end(); ++itr)
+4
View File
@@ -97,6 +97,10 @@ void Totem::InitSummon()
{
SetReactState(REACT_AGGRESSIVE);
GetOwner()->CastSpell(this, 6277, true);
// Farsight objects should be active
setActive(true);
SetVisibilityDistanceOverride(VisibilityDistanceType::Infinite);
}
if (!IsInWater())
+22 -31
View File
@@ -893,7 +893,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage
if (attacker && shareDamageTarget->GetTypeId() == TYPEID_PLAYER)
attacker->SendSpellNonMeleeDamageLog(shareDamageTarget, spell, shareDamage, damageSchoolMask, shareAbsorb, shareResist, damagetype == DIRECT_DAMAGE, 0, false);
Unit::DealDamage(attacker, shareDamageTarget, shareDamage, cleanDamage, NODAMAGE, damageSchoolMask, spellProto, false);
Unit::DealDamage(attacker, shareDamageTarget, shareDamage, cleanDamage, NODAMAGE, damageSchoolMask, spellProto, false, false, damageSpell);
}
}
@@ -1007,7 +1007,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage
//if (attacker && victim->GetTypeId() == TYPEID_PLAYER && victim != attacker)
//victim->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED, health); // pussywizard: optimization
Unit::Kill(attacker, victim, durabilityLoss, cleanDamage ? cleanDamage->attackType : BASE_ATTACK, spellProto);
Unit::Kill(attacker, victim, durabilityLoss, cleanDamage ? cleanDamage->attackType : BASE_ATTACK, spellProto, damageSpell);
}
else
{
@@ -3605,8 +3605,10 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell)
if (pSpell == m_currentSpells[CSpellType]) // avoid breaking self
return;
bool bySelf = m_currentSpells[CSpellType] && m_currentSpells[CSpellType]->m_spellInfo->Id == pSpell->m_spellInfo->Id;
// break same type spell if it is not delayed
InterruptSpell(CSpellType, false);
InterruptSpell(CSpellType, false, true, bySelf);
// special breakage effects:
switch (CSpellType)
@@ -3635,7 +3637,7 @@ void Unit::SetCurrentCastedSpell(Spell* pSpell)
{
// channel spells always break generic non-delayed and any channeled spells
InterruptSpell(CURRENT_GENERIC_SPELL, false);
InterruptSpell(CURRENT_CHANNELED_SPELL);
InterruptSpell(CURRENT_CHANNELED_SPELL, true, true, bySelf);
// it also does break autorepeat if not Auto Shot
if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL] &&
@@ -5729,10 +5731,12 @@ DynamicObject* Unit::GetDynObject(uint32 spellId)
return nullptr;
}
void Unit::RemoveDynObject(uint32 spellId)
bool Unit::RemoveDynObject(uint32 spellId)
{
if (m_dynObj.empty())
return;
return false;
bool result = false;
for (DynObjectList::iterator i = m_dynObj.begin(); i != m_dynObj.end();)
{
DynamicObject* dynObj = *i;
@@ -5740,10 +5744,13 @@ void Unit::RemoveDynObject(uint32 spellId)
{
dynObj->Remove();
i = m_dynObj.begin();
result = true;
}
else
++i;
}
return result;
}
void Unit::RemoveAllDynObjects()
@@ -9940,7 +9947,7 @@ bool Unit::Attack(Unit* victim, bool meleeAttack)
}
// switch target
InterruptSpell(CURRENT_MELEE_SPELL);
InterruptSpell(CURRENT_MELEE_SPELL, true, true, true);
if (!meleeAttack)
ClearUnitState(UNIT_STATE_MELEE_ATTACKING);
}
@@ -13928,7 +13935,7 @@ void Unit::setDeathState(DeathState s, bool despawn)
if (s != ALIVE && s != JUST_RESPAWNED)
{
CombatStop();
DeleteThreatList();
GetThreatMgr().ClearAllThreat();
getHostileRefMgr().deleteReferences();
ClearComboPointHolders(); // any combo points pointed to unit lost at it death
@@ -14029,15 +14036,6 @@ void Unit::AddThreat(Unit* victim, float fThreat, SpellSchoolMask schoolMask, Sp
//======================================================================
void Unit::DeleteThreatList()
{
if (CanHaveThreatList() && !m_ThreatMgr.isThreatListEmpty())
SendClearThreatListOpcode();
m_ThreatMgr.clearReferences();
}
//======================================================================
void Unit::TauntApply(Unit* taunter)
{
ASSERT(GetTypeId() == TYPEID_UNIT);
@@ -15108,7 +15106,7 @@ void Unit::CleanupBeforeRemoveFromMap(bool finalCleanup)
CombatStop();
ClearComboPoints();
ClearComboPointHolders();
DeleteThreatList();
GetThreatMgr().ClearAllThreat();
getHostileRefMgr().deleteReferences();
GetMotionMaster()->Clear(false); // remove different non-standard movement generators.
}
@@ -17233,7 +17231,7 @@ bool Unit::HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura)
return true;
}
void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackType attackType, SpellInfo const* spellProto)
void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackType attackType, SpellInfo const* spellProto, Spell const* spell /*= nullptr*/)
{
// Prevent killing unit twice (and giving reward from kill twice)
if (!victim->GetHealth())
@@ -17350,15 +17348,15 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp
if (killer && (killer->IsPet() || killer->IsTotem()))
if (Unit* owner = killer->GetOwner())
{
owner->ProcDamageAndSpell(victim, PROC_FLAG_KILL, PROC_FLAG_NONE, PROC_EX_NONE, 0, attackType, spellProto);
owner->ProcDamageAndSpell(victim, PROC_FLAG_KILL, PROC_FLAG_NONE, PROC_EX_NONE, 0, attackType, spellProto, nullptr, -1, spell);
sScriptMgr->OnCreatureKilledByPet( killer->GetCharmerOrOwnerPlayerOrPlayerItself(), victim->ToCreature());
}
if (killer != victim && !victim->IsCritter())
killer->ProcDamageAndSpell(victim, killer ? PROC_FLAG_KILL : 0, PROC_FLAG_KILLED, PROC_EX_NONE, 0, attackType, spellProto);
killer->ProcDamageAndSpell(victim, killer ? PROC_FLAG_KILL : 0, PROC_FLAG_KILLED, PROC_EX_NONE, 0, attackType, spellProto, nullptr, -1, spell);
// Proc auras on death - must be before aura/combat remove
victim->ProcDamageAndSpell(nullptr, PROC_FLAG_DEATH, PROC_FLAG_NONE, PROC_EX_NONE, 0, attackType, spellProto);
victim->ProcDamageAndSpell(nullptr, PROC_FLAG_DEATH, PROC_FLAG_NONE, PROC_EX_NONE, 0, attackType, spellProto, nullptr, -1, spell);
// update get killing blow achievements, must be done before setDeathState to be able to require auras on target
// and before Spirit of Redemption as it also removes auras
@@ -17457,7 +17455,7 @@ void Unit::Kill(Unit* killer, Unit* victim, bool durabilityLoss, WeaponAttackTyp
if (!creature->IsPet() && creature->GetLootMode() > 0)
{
creature->DeleteThreatList();
creature->GetThreatMgr().ClearAllThreat();
// must be after setDeathState which resets dynamic flags
if (!creature->loot.isLooted())
@@ -17952,14 +17950,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
if (GetTypeId() == TYPEID_UNIT)
{
if (MovementGenerator* movementGenerator = GetMotionMaster()->GetMotionSlot(MOTION_SLOT_IDLE))
{
movementGenerator->Pause(0);
}
GetMotionMaster()->Clear(MOTION_SLOT_ACTIVE);
StopMoving();
GetMotionMaster()->MoveIdle();
if (charmer->GetTypeId() == TYPEID_PLAYER &&
charmer->getClass() == CLASS_WARLOCK)
+2 -3
View File
@@ -1518,7 +1518,7 @@ public:
uint16 GetMaxSkillValueForLevel(Unit const* target = nullptr) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; }
static void DealDamageMods(Unit const* victim, uint32& damage, uint32* absorb);
static uint32 DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage = nullptr, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* spellProto = nullptr, bool durabilityLoss = true, bool allowGM = false, Spell const* spell = nullptr);
static void Kill(Unit* killer, Unit* victim, bool durabilityLoss = true, WeaponAttackType attackType = BASE_ATTACK, SpellInfo const* spellProto = nullptr);
static void Kill(Unit* killer, Unit* victim, bool durabilityLoss = true, WeaponAttackType attackType = BASE_ATTACK, SpellInfo const* spellProto = nullptr, Spell const* spell = nullptr);
static int32 DealHeal(Unit* healer, Unit* victim, uint32 addhealth);
void ProcDamageAndSpell(Unit* victim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellInfo const* procSpellInfo = nullptr, SpellInfo const* procAura = nullptr, int8 procAuraEffectIndex = -1, Spell const* procSpell = nullptr, DamageInfo* damageInfo = nullptr, HealInfo* healInfo = nullptr, uint32 procPhase = 2 /*PROC_SPELL_PHASE_HIT*/);
@@ -2107,7 +2107,6 @@ public:
[[nodiscard]] bool CanHaveThreatList() const;
void AddThreat(Unit* victim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = nullptr);
float ApplyTotalThreatModifier(float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL);
void DeleteThreatList();
void TauntApply(Unit* victim);
void TauntFadeOut(Unit* taunter);
ThreatMgr& GetThreatMgr() { return m_ThreatMgr; }
@@ -2142,7 +2141,7 @@ public:
void _RegisterDynObject(DynamicObject* dynObj);
void _UnregisterDynObject(DynamicObject* dynObj);
DynamicObject* GetDynObject(uint32 spellId);
void RemoveDynObject(uint32 spellId);
bool RemoveDynObject(uint32 spellId);
void RemoveAllDynObjects();
[[nodiscard]] GameObject* GetGameObject(uint32 spellId) const;
@@ -243,6 +243,11 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData)
}
});
if (err)
{
err = grp->CanJoinBattlegroundQueue(bg, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
}
if (err <= 0)
{
grp->DoForAllMembers([err](Player* member)
@@ -255,9 +260,6 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData)
return;
}
ASSERT(err > 0);
err = grp->CanJoinBattlegroundQueue(bg, bgQueueTypeId, 0, bg->GetMaxPlayersPerTeam(), false, 0);
isPremade = (grp->GetMembersCount() >= bg->GetMinPlayersPerTeam() && bgTypeId != BATTLEGROUND_RB);
uint32 avgWaitTime = 0;
+27 -4
View File
@@ -1225,14 +1225,37 @@ void WorldSession::HandleFarSightOpcode(WorldPacket& recvData)
if (WorldObject* target = _player->GetViewpoint())
_player->SetSeer(target);
else
{
LOG_DEBUG("network.opcode", "Player {} requests non-existing seer {}", _player->GetName(), _player->GetGuidValue(PLAYER_FARSIGHT).ToString());
}
}
else
{
LOG_DEBUG("network", "Player {} set vision to self", _player->GetGUID().ToString());
_player->SetSeer(_player);
WorldObject* newFarsightobject = nullptr;
if (WorldObject* viewpoint = _player->GetViewpoint())
{
if (DynamicObject* viewpointDynamicObject = viewpoint->ToDynObject())
{
newFarsightobject = ObjectAccessor::GetUnit(*viewpointDynamicObject, viewpointDynamicObject->GetOldFarsightGUID());
}
else if (DynamicObject* viewpointDynamicObject = _player->GetDynObject(_player->GetUInt32Value(UNIT_CHANNEL_SPELL)))
{
if (viewpointDynamicObject->IsViewpoint() && viewpointDynamicObject->GetCasterGUID() == _player->GetGUID())
{
newFarsightobject = viewpointDynamicObject;
}
}
}
if (newFarsightobject)
{
LOG_DEBUG("network", "Player {} set vision to old farsight {}", _player->GetGUID().ToString(), newFarsightobject->GetGUID().ToString());
_player->SetViewpoint(_player->GetViewpoint(), false);
_player->SetViewpoint(newFarsightobject, true);
}
else
{
LOG_DEBUG("network", "Player {} set vision to self", _player->GetGUID().ToString());
_player->SetSeer(_player);
}
}
GetPlayer()->UpdateVisibilityForPlayer();
+1 -1
View File
@@ -576,7 +576,7 @@ void WorldSession::HandleCancelChanneling(WorldPacket& recvData)
if (mover != _player && mover->GetTypeId() == TYPEID_PLAYER)
return;
mover->InterruptSpell(CURRENT_CHANNELED_SPELL, true, true, true);
mover->InterruptSpell(CURRENT_CHANNELED_SPELL);
}
void WorldSession::HandleTotemDestroyed(WorldPackets::Totem::TotemDestroyed& totemDestroyed)
+28 -53
View File
@@ -3639,8 +3639,15 @@ SpellCastResult Spell::prepare(SpellCastTargets const* targets, AuraEffect const
// skip triggered spell (item equip spell casting and other not explicit character casts/item uses)
if (!(_triggeredCastFlags & TRIGGERED_IGNORE_AURA_INTERRUPT_FLAGS) && m_spellInfo->IsBreakingStealth())
{
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST, 0, m_spellInfo->Id == 75);
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_SPELL_ATTACK, 0, m_spellInfo->Id == 75);
// Farsight spells exception
uint32 exceptSpellId = 0;
if (m_spellInfo->HasEffect(SPELL_EFFECT_ADD_FARSIGHT))
{
exceptSpellId = m_spellInfo->Id;
}
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CAST, exceptSpellId, m_spellInfo->Id == 75);
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_SPELL_ATTACK, exceptSpellId, m_spellInfo->Id == 75);
}
m_caster->SetCurrentCastedSpell(this);
@@ -3700,14 +3707,17 @@ void Spell::cancel(bool bySelf)
break;
case SPELL_STATE_CASTING:
for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
if ((*ihit).missCondition == SPELL_MISS_NONE)
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 (!bySelf)
{
for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
if ((*ihit).missCondition == SPELL_MISS_NONE)
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);
SendChannelUpdate(0);
SendInterrupted(0);
SendCastResult(SPELL_FAILED_INTERRUPTED);
SendChannelUpdate(0);
SendInterrupted(0);
SendCastResult(SPELL_FAILED_INTERRUPTED);
}
if (m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->ToPlayer()->NeedSendSpectatorData())
ArenaSpectator::SendCommand_Spell(m_caster->FindMap(), m_caster->GetGUID(), "SPE", m_spellInfo->Id, bySelf ? 99998 : 99999);
@@ -3718,7 +3728,6 @@ void Spell::cancel(bool bySelf)
m_appliedMods.clear();
break;
default:
break;
}
@@ -3727,7 +3736,12 @@ void Spell::cancel(bool bySelf)
if (m_selfContainer && *m_selfContainer == this)
*m_selfContainer = nullptr;
m_caster->RemoveDynObject(m_spellInfo->Id);
// Do not remove current far sight object (already done in Spell::EffectAddFarsight) to prevent from reset viewpoint to player
if (!(bySelf && m_spellInfo->HasEffect(SPELL_EFFECT_ADD_FARSIGHT)))
{
m_caster->RemoveDynObject(m_spellInfo->Id);
}
if (m_spellInfo->IsChanneled()) // if not channeled then the object for the current cast wasn't summoned yet
m_caster->RemoveGameObject(m_spellInfo->Id, true);
@@ -8191,7 +8205,6 @@ void Spell::HandleLaunchPhase()
PrepareTargetProcessing();
bool firstTarget = true;
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
TargetInfo& target = *ihit;
@@ -8225,14 +8238,14 @@ void Spell::HandleLaunchPhase()
break;
}
}
DoAllEffectOnLaunchTarget(target, multiplier, firstTarget);
firstTarget = false;
DoAllEffectOnLaunchTarget(target, multiplier);
}
FinishTargetProcessing();
}
void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier, bool firstTarget)
void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier)
{
Unit* unit = nullptr;
// In case spell hit target, do all effect on that target
@@ -8244,7 +8257,6 @@ void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier,
if (!unit)
return;
uint8 ssEffect = MAX_SPELL_EFFECTS;
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (targetInfo.effectMask & (1 << i))
@@ -8275,18 +8287,6 @@ void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier,
m_damageMultipliers[i] *= multiplier[i];
}
targetInfo.damage += m_damage;
// Sweeping Strikes
switch (m_spellInfo->Effects[i].Effect)
{
case SPELL_EFFECT_SCHOOL_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE:
case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL:
case SPELL_EFFECT_NORMALIZED_WEAPON_DMG:
case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE:
ssEffect = i;
break;
}
}
}
@@ -8303,31 +8303,6 @@ void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier,
float critChance = caster->SpellDoneCritChance(unit, m_spellInfo, m_spellSchoolMask, m_attackType, false);
critChance = unit->SpellTakenCritChance(caster, m_spellInfo, m_spellSchoolMask, critChance, m_attackType, false);
targetInfo.crit = roll_chance_f(std::max(0.0f, critChance));
// Sweeping strikes
if (m_caster->getClass() == CLASS_WARRIOR && ssEffect < MAX_SPELL_EFFECTS && m_spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR &&
((m_spellInfo->Id != 50622 && m_spellInfo->Id != 44949) || firstTarget))
{
if (Aura* aur = m_caster->GetAura(12328))
{
Unit* target = m_caster->SelectNearbyNoTotemTarget(unit);
if (!target || target == unit)
return; // finish
int32 mdmg = m_damage;
int32 basepoints = 0;
m_damage = 0;
HandleEffects(target, nullptr, nullptr, ssEffect, SPELL_EFFECT_HANDLE_LAUNCH_TARGET);
basepoints = (targetInfo.crit ? Unit::SpellCriticalDamageBonus(m_caster, m_spellInfo, m_damage, target) : m_damage);
m_damage = mdmg;
m_caster->CastCustomSpell(target, 26654, &basepoints, nullptr, nullptr, true);
if (m_spellInfo->Id != 44949)
aur->DropCharge();
}
}
}
SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& skillId, int32& reqSkillValue, int32& skillValue)
+1 -1
View File
@@ -708,7 +708,7 @@ public:
bool UpdateChanneledTargetList();
bool IsValidDeadOrAliveTarget(Unit const* target) const;
void HandleLaunchPhase();
void DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier, bool firstTarget);
void DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier);
void PrepareTargetProcessing();
void FinishTargetProcessing();
+7 -10
View File
@@ -2213,6 +2213,9 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex)
if (!pNewItem)
return;
// Client-side enchantment durations update
player->UpdateEnchantmentDurations();
for (uint8 j = PERM_ENCHANTMENT_SLOT; j <= TEMP_ENCHANTMENT_SLOT; ++j)
if (m_CastItem->GetEnchantmentId(EnchantmentSlot(j)))
pNewItem->SetEnchantment(EnchantmentSlot(j), m_CastItem->GetEnchantmentId(EnchantmentSlot(j)), m_CastItem->GetEnchantmentDuration(EnchantmentSlot(j)), m_CastItem->GetEnchantmentCharges(EnchantmentSlot(j)));
@@ -2719,6 +2722,9 @@ void Spell::EffectAddFarsight(SpellEffIndex effIndex)
if (!m_caster->IsInWorld())
return;
// Remove old farsight if exist
bool updateViewerVisibility = m_caster->RemoveDynObject(m_spellInfo->Id);
DynamicObject* dynObj = new DynamicObject(true);
if (!dynObj->CreateDynamicObject(m_caster->GetMap()->GenerateLowGuid<HighGuid::DynamicObject>(), m_caster, m_spellInfo->Id, *destTarget, radius, DYNAMIC_OBJECT_FARSIGHT_FOCUS))
{
@@ -2727,9 +2733,7 @@ void Spell::EffectAddFarsight(SpellEffIndex effIndex)
}
dynObj->SetDuration(duration);
dynObj->SetCasterViewpoint();
m_caster->ToPlayer()->UpdateVisibilityForPlayer();
dynObj->SetCasterViewpoint(updateViewerVisibility);
}
void Spell::EffectUntrainTalents(SpellEffIndex /*effIndex*/)
@@ -3348,13 +3352,6 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex)
AddPct(totalDamagePercentMod, unitTarget->GetDiseasesByCaster(m_caster->GetGUID(), 1) * 30.0f);
break;
}
// sweeping strikes
case 26654:
{
this->damage = 0;
m_damage = m_spellValue->EffectBasePoints[effIndex];
return;
}
}
break;
}
@@ -203,7 +203,7 @@ public:
void EnterEvadeMode(EvadeReason /*why*/) override
{
me->RemoveAllAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->LoadCreaturesAddon(true);
if (me->IsAlive())
@@ -779,7 +779,7 @@ public:
//do not call EnterEvadeMode(), it will create infinit loops
boss->Respawn();
boss->RemoveAllAuras();
boss->DeleteThreatList();
boss->GetThreatMgr().ClearAllThreat();
boss->CombatStop(true);
boss->LoadCreaturesAddon(true);
boss->GetMotionMaster()->MoveTargetedHome();
@@ -1243,7 +1243,7 @@ public:
Julianne->GetMotionMaster()->Clear();
Julianne->setDeathState(JUST_DIED);
Julianne->CombatStop(true);
Julianne->DeleteThreatList();
Julianne->GetThreatMgr().ClearAllThreat();
Julianne->ReplaceAllDynamicFlags(UNIT_DYNFLAG_LOOTABLE);
}
return;
@@ -1546,7 +1546,7 @@ void boss_julianne::boss_julianneAI::DamageTaken(Unit* /*done_by*/, uint32& dama
Romulo->GetMotionMaster()->Clear();
Romulo->setDeathState(JUST_DIED);
Romulo->CombatStop(true);
Romulo->DeleteThreatList();
Romulo->GetThreatMgr().ClearAllThreat();
Romulo->ReplaceAllDynamicFlags(UNIT_DYNFLAG_LOOTABLE);
}
@@ -242,7 +242,7 @@ public:
void EnterEvadeMode(EvadeReason /*why*/) override
{
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(false);
me->SetLootRecipient(nullptr);
@@ -697,13 +697,13 @@ public:
if (Creature* summon = ObjectAccessor::GetCreature(*me, *itr))
{
summon->CombatStop(true);
summon->DeleteThreatList();
summon->GetThreatMgr().ClearAllThreat();
summon->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
summon->SetReactState(REACT_PASSIVE);
summon->GetMotionMaster()->Clear(false);
}
me->CombatStop(true);
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC);
me->SetReactState(REACT_PASSIVE);
me->GetMotionMaster()->Clear(false);
@@ -329,7 +329,7 @@ public:
me->SetTarget();
me->SetReactState(REACT_PASSIVE);
me->RemoveAllAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->SetRegeneratingHealth(false);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->HandleEmoteCommand(EMOTE_ONESHOT_DROWN);
@@ -137,31 +137,31 @@ public:
if (DoGetThreat(me->GetVictim()))
DoModifyThreatPercent(target, -100);
Creature* SacrificedTroll;
SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX() + 2, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, TeleportLoc.m_positionX + 2, TeleportLoc.m_positionY, TeleportLoc.m_positionZ, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (SacrificedTroll)
SacrificedTroll->AI()->AttackStart(target);
SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX() - 2, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, TeleportLoc.m_positionX - 2, TeleportLoc.m_positionY, TeleportLoc.m_positionZ, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (SacrificedTroll)
SacrificedTroll->AI()->AttackStart(target);
SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX() + 4, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, TeleportLoc.m_positionX + 4, TeleportLoc.m_positionY, TeleportLoc.m_positionZ, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (SacrificedTroll)
SacrificedTroll->AI()->AttackStart(target);
SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX() - 4, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, TeleportLoc.m_positionX - 4, TeleportLoc.m_positionY, TeleportLoc.m_positionZ, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (SacrificedTroll)
SacrificedTroll->AI()->AttackStart(target);
SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX(), target->GetPositionY() + 2, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, TeleportLoc.m_positionX, TeleportLoc.m_positionY + 2, TeleportLoc.m_positionZ, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (SacrificedTroll)
SacrificedTroll->AI()->AttackStart(target);
SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX(), target->GetPositionY() - 2, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, TeleportLoc.m_positionX, TeleportLoc.m_positionY - 2, TeleportLoc.m_positionZ, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (SacrificedTroll)
SacrificedTroll->AI()->AttackStart(target);
SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX(), target->GetPositionY() + 4, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, TeleportLoc.m_positionX, TeleportLoc.m_positionY + 4, TeleportLoc.m_positionZ, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (SacrificedTroll)
SacrificedTroll->AI()->AttackStart(target);
SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX(), target->GetPositionY() - 4, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, TeleportLoc.m_positionX, TeleportLoc.m_positionY - 4, TeleportLoc.m_positionZ, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (SacrificedTroll)
SacrificedTroll->AI()->AttackStart(target);
SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, target->GetPositionX() + 3, target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
SacrificedTroll = me->SummonCreature(NPC_SACRIFICED_TROLL, TeleportLoc.m_positionX + 3, TeleportLoc.m_positionY, TeleportLoc.m_positionZ, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
if (SacrificedTroll)
SacrificedTroll->AI()->AttackStart(target);
}
@@ -71,8 +71,8 @@ public:
if (player->GetQuestStatus(592) == QUEST_STATUS_INCOMPLETE) //Yenniku's Release
{
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_STUN);
me->CombatStop(); //stop combat
me->DeleteThreatList(); //unsure of this
me->CombatStop(); //stop combat
me->GetThreatMgr().ClearAllThreat(); //unsure of this
me->SetFaction(FACTION_HORDE_GENERIC);
bReset = true;
@@ -104,7 +104,7 @@ public:
if (player->GetTeamId() == TEAM_HORDE)
{
me->CombatStop();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
}
}
}
@@ -1013,7 +1013,7 @@ public:
void EnterEvadeMode(EvadeReason /*why*/) override
{
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->SetLootRecipient(nullptr);
@@ -2356,7 +2356,7 @@ public:
void EnterEvadeMode(EvadeReason /*why*/) override
{
me->RemoveAura(SPELL_HEROIC_VANGUARD);
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->SetLootRecipient(nullptr);
@@ -118,7 +118,7 @@ public:
me->RestoreFaction();
me->RemoveAllAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
SetRun(false);
@@ -410,7 +410,7 @@ void hyjalAI::EnterEvadeMode(EvadeReason /*why*/)
{
if (me->GetEntry() != JAINA)
me->RemoveAllAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->LoadCreaturesAddon(true);
@@ -178,7 +178,7 @@ public:
void DoFriend()
{
me->RemoveAllAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->StopMoving();
@@ -550,7 +550,7 @@ public:
me->SetReactState(REACT_PASSIVE);
me->RemoveAllAuras();
AddCreatureAddonAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->GetMotionMaster()->Clear();
me->StopMoving();
@@ -580,7 +580,7 @@ public:
me->SetReactState(REACT_PASSIVE);
me->RemoveAllAuras();
AddCreatureAddonAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->GetMotionMaster()->Clear();
me->SetRegeneratingHealth(false);
@@ -133,7 +133,7 @@ public:
{
t->RemoveAura(SPELL_CHANGE_VEHICLE);
me->RemoveAllAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->SetHealth(me->GetMaxHealth());
if( pInstance )
@@ -523,7 +523,7 @@ public:
if (TeamIdInInstance == TEAM_ALLIANCE)
c->UpdateEntry(NPC_JAINA_PART2);
}
c->DeleteThreatList();
c->GetThreatMgr().ClearAllThreat();
c->CombatStop(true);
c->InterruptNonMeleeSpells(true);
c->GetMotionMaster()->Clear();
@@ -540,7 +540,7 @@ public:
}
if (Creature* c = instance->GetCreature(NPC_LichKingGUID))
{
c->DeleteThreatList();
c->GetThreatMgr().ClearAllThreat();
c->CombatStop(true);
c->InterruptNonMeleeSpells(true);
c->GetMotionMaster()->Clear();
@@ -915,7 +915,7 @@ public:
if (TrashActive[i])
if (Creature* c = instance->GetCreature(NPC_TrashGUID[i]))
{
c->DeleteThreatList();
c->GetThreatMgr().ClearAllThreat();
c->CombatStop(true);
c->InterruptNonMeleeSpells(true);
c->SetUnitFlag(UNIT_FLAG_IMMUNE_TO_PC | UNIT_FLAG_IMMUNE_TO_NPC | UNIT_FLAG_NOT_SELECTABLE);
@@ -1126,7 +1126,7 @@ public:
if (Creature* c = instance->GetCreature(NPC_LichKingGUID))
{
c->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE);
c->DeleteThreatList();
c->GetThreatMgr().ClearAllThreat();
c->CombatStop(true);
c->InterruptNonMeleeSpells(true);
c->SetVisible(false);
@@ -1123,7 +1123,7 @@ public:
return;
me->RemoveEvadeAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->LoadCreaturesAddon(true);
me->SetLootRecipient(nullptr);
@@ -1202,7 +1202,7 @@ public:
if (!attacker || attacker == me || attacker == me->GetVictim() || (det != DIRECT_DAMAGE && det != SPELL_DIRECT_DAMAGE))
return;
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->AddThreat(attacker, 500000000.0f);
}
@@ -784,7 +784,7 @@ public:
{
if (!me->IsAlive())
return;
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->GetMotionMaster()->MoveTargetedHome();
Reset();
@@ -1120,7 +1120,7 @@ public:
{
if (!me->IsAlive())
return;
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->GetMotionMaster()->MoveTargetedHome();
Reset();
@@ -1496,7 +1496,7 @@ struct gunship_npc_AI : public ScriptedAI
{
if (!me->IsAlive() || !me->IsInCombat())
return;
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->GetMotionMaster()->MoveTargetedHome();
Reset();
@@ -1557,7 +1557,7 @@ struct npc_gunship_boarding_addAI : public ScriptedAI
{
if (!me->IsAlive() || !me->IsInCombat())
return;
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->GetMotionMaster()->MoveTargetedHome();
Reset();
@@ -515,7 +515,7 @@ public:
{
darnavan->RemoveAllAuras();
darnavan->SetFaction(FACTION_FRIENDLY);
darnavan->DeleteThreatList();
darnavan->GetThreatMgr().ClearAllThreat();
darnavan->CombatStop(true);
darnavan->GetMotionMaster()->MoveIdle();
darnavan->StopMoving();
@@ -1139,7 +1139,7 @@ public:
void StartAttack()
{
GetCaster()->ClearUnitState(UNIT_STATE_CASTING);
GetCaster()->DeleteThreatList();
GetCaster()->GetThreatMgr().ClearAllThreat();
GetCaster()->ToCreature()->SetInCombatWithZone();
GetCaster()->ToCreature()->AI()->AttackStart(GetHitUnit());
GetCaster()->AddThreat(GetHitUnit(), 500000000.0f); // value seen in sniff
@@ -1647,7 +1647,7 @@ public:
return;
}
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(false);
}
@@ -3370,7 +3370,7 @@ public:
if (!me->IsAlive())
return;
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(false);
}
};
@@ -766,7 +766,7 @@ public:
_handledWP4 = false;
me->CombatStop();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
}
}
@@ -710,7 +710,7 @@ public:
me->SendMeleeAttackStop(me->GetVictim());
me->GetMotionMaster()->MoveTakeoff(MI_POINT_PH_3_FIGHT_POSITION, CenterPos.GetPositionX(), CenterPos.GetPositionY(), CenterPos.GetPositionZ() - 5.0f, me->GetSpeed(MOVE_RUN));
me->DeleteThreatList(); // players on vehicle are unattackable -> leads to EnterEvadeMode() because target is not acceptable!
me->GetThreatMgr().ClearAllThreat(); // players on vehicle are unattackable -> leads to EnterEvadeMode() because target is not acceptable!
// mount players:
Map::PlayerList const& PlayerList = me->GetMap()->GetPlayers();
@@ -239,7 +239,7 @@ public:
if (!_allowDeath)
{
me->RemoveAllAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
damage = 0;
@@ -208,7 +208,7 @@ public:
void LeaveCombat()
{
me->RemoveAllAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->LoadCreaturesAddon(true);
me->SetLootRecipient(nullptr);
@@ -258,7 +258,7 @@ public:
if (param == ACTION_CALLBACK)
{
me->SetSpeed(MOVE_RUN, 2.5f);
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->GetMotionMaster()->MoveTargetedHome();
returning = true;
@@ -384,7 +384,7 @@ struct violet_hold_trashAI : public npc_escortAI
me->SetHomePosition(1845.577759f + rand_norm() * 5 - 2.5f, 800.681152f + rand_norm() * 5 - 2.5f, 44.104248f, M_PI);
}
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
if (HasEscortState(STATE_ESCORT_ESCORTING))
{
@@ -74,7 +74,7 @@ public:
Creature* owner = GetOwner()->ToCreature();
owner->RemoveAllAurasExceptType(SPELL_AURA_DUMMY);
owner->CombatStop(true);
owner->DeleteThreatList();
owner->GetThreatMgr().ClearAllThreat();
owner->GetMotionMaster()->Clear(false);
owner->GetMotionMaster()->MoveFollow(GetCaster(), 4.0f, M_PI, MOTION_SLOT_ACTIVE);
owner->CastSpell(owner, SPELL_SUBDUED, true);
@@ -127,7 +127,7 @@ public:
me->SetFaction(FACTION_FRIENDLY);
me->SetNpcFlag(UNIT_NPC_FLAG_QUESTGIVER);
me->RemoveAllAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
Talk(SAY_FREE);
return;
@@ -374,7 +374,7 @@ public:
me->SetFaction(FACTION_FRIENDLY);
me->SetStandState(UNIT_STAND_STATE_SIT);
me->RemoveAllAuras();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
UnkorUnfriendly_Timer = 60000;
}
+1 -1
View File
@@ -52,7 +52,7 @@ struct npc_pet_hunter_snake_trap : public ScriptedAI
void EnterEvadeMode(EvadeReason /*why*/) override
{
// _EnterEvadeMode();
me->DeleteThreatList();
me->GetThreatMgr().ClearAllThreat();
me->CombatStop(true);
me->LoadCreaturesAddon(true);
me->SetLootRecipient(nullptr);
+1 -1
View File
@@ -283,7 +283,7 @@ class spell_hun_taming_the_beast : public AuraScript
{
if (Creature* creature = target->ToCreature())
{
creature->DeleteThreatList();
creature->GetThreatMgr().ClearAllThreat();
}
}
}
+17 -1
View File
@@ -841,7 +841,23 @@ class spell_pri_vampiric_touch : public AuraScript
bool CheckProc(ProcEventInfo& eventInfo)
{
return eventInfo.GetActionTarget() && eventInfo.GetActionTarget()->IsAlive() && GetOwner()->GetGUID() == eventInfo.GetActionTarget()->GetGUID();
if (!eventInfo.GetActionTarget() || GetOwner()->GetGUID() != eventInfo.GetActionTarget()->GetGUID())
return false;
if (eventInfo.GetTypeMask() & PROC_FLAG_KILLED)
{
if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo())
{
if (spellInfo->SpellFamilyName == SPELLFAMILY_PRIEST && (spellInfo->SpellFamilyFlags[0] & 0x00002000))
{
return true;
}
}
return false;
}
return eventInfo.GetActionTarget()->IsAlive();
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
+33 -16
View File
@@ -50,14 +50,16 @@ enum WarriorSpells
SPELL_WARRIOR_RETALIATION_DAMAGE = 22858,
SPELL_WARRIOR_SLAM = 50783,
SPELL_WARRIOR_SUNDER_ARMOR = 58567,
SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK = 26654,
SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK_1 = 12723,
SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK_2 = 26654,
SPELL_WARRIOR_TAUNT = 355,
SPELL_WARRIOR_UNRELENTING_ASSAULT_RANK_1 = 46859,
SPELL_WARRIOR_UNRELENTING_ASSAULT_RANK_2 = 46860,
SPELL_WARRIOR_UNRELENTING_ASSAULT_TRIGGER_1 = 64849,
SPELL_WARRIOR_UNRELENTING_ASSAULT_TRIGGER_2 = 64850,
SPELL_WARRIOR_VIGILANCE_PROC = 50725,
SPELL_WARRIOR_VIGILANCE_REDIRECT_THREAT = 59665
SPELL_WARRIOR_VIGILANCE_REDIRECT_THREAT = 59665,
SPELL_WARRIOR_WHIRLWIND_OFF = 44949
};
enum WarriorSpellIcons
@@ -613,7 +615,7 @@ class spell_warr_sweeping_strikes : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK });
return ValidateSpellInfo({ SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK_1, SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK_2 });
}
bool Load() override
@@ -624,21 +626,27 @@ class spell_warr_sweeping_strikes : public AuraScript
bool CheckProc(ProcEventInfo& eventInfo)
{
if (!eventInfo.GetActor() || eventInfo.GetProcTarget())
Unit* actor = eventInfo.GetActor();
if (!actor)
{
return false;
}
if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo())
{
switch (spellInfo->Id)
{
case SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK_1:
case SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK_2:
case SPELL_WARRIOR_WHIRLWIND_OFF:
return false;
default:
break;
}
}
_procTarget = eventInfo.GetActor()->SelectNearbyNoTotemTarget(eventInfo.GetProcTarget());
DamageInfo* damageInfo = eventInfo.GetDamageInfo();
if (!damageInfo || !damageInfo->GetSpellInfo())
{
return false;
}
return _procTarget && !damageInfo->GetSpellInfo();
return _procTarget != nullptr;
}
void HandleProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
@@ -646,8 +654,17 @@ class spell_warr_sweeping_strikes : public AuraScript
PreventDefaultAction();
if (DamageInfo* damageInfo = eventInfo.GetDamageInfo())
{
int32 damage = damageInfo->GetUnmitigatedDamage();
GetTarget()->CastCustomSpell(_procTarget, SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK, &damage, 0, 0, true, nullptr, aurEff);
SpellInfo const* spellInfo = damageInfo->GetSpellInfo();
if (spellInfo && spellInfo->Id == SPELL_WARRIOR_EXECUTE && !_procTarget->HasAuraState(AURA_STATE_HEALTHLESS_20_PERCENT))
{
// If triggered by Execute (while target is not under 20% hp) deals normalized weapon damage
GetTarget()->CastSpell(_procTarget, SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK_2, aurEff);
}
else
{
int32 damage = damageInfo->GetUnmitigatedDamage();
GetTarget()->CastCustomSpell(_procTarget, SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK_1, &damage, 0, 0, true, nullptr, aurEff);
}
}
}
@@ -658,7 +675,7 @@ class spell_warr_sweeping_strikes : public AuraScript
}
private:
Unit* _procTarget;
Unit* _procTarget = nullptr;
};
// 50720 - Vigilance