aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-09-03 16:06:43 +0200
committerShauren <shauren.trinity@gmail.com>2023-09-03 16:06:43 +0200
commitba224f70ad81fa0e5d1f0c4daf197e143317cdaa (patch)
tree53eadbca61d84cb25cd81a1cd9ff3e42bd72c306
parentaa32feddb7cc071266417978b422845bf3354c87 (diff)
Core/Auras: Defined and implemented new aura interrupt flags
-rw-r--r--src/server/game/Battlegrounds/Battleground.cpp4
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp25
-rw-r--r--src/server/game/Entities/Unit/Unit.h5
-rw-r--r--src/server/game/Instances/InstanceScript.cpp6
-rw-r--r--src/server/game/Maps/ZoneScript.h7
-rw-r--r--src/server/game/Spells/SpellDefines.h5
6 files changed, 42 insertions, 10 deletions
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp
index 59db44658c8..35c037159f9 100644
--- a/src/server/game/Battlegrounds/Battleground.cpp
+++ b/src/server/game/Battlegrounds/Battleground.cpp
@@ -419,7 +419,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
for (auto const& [guid, _] : GetPlayers())
if (Player* player = ObjectAccessor::FindPlayer(guid))
- player->AtStartOfEncounter();
+ player->AtStartOfEncounter(EncounterType::Battleground);
// Remove preparation
if (isArena())
@@ -856,7 +856,7 @@ void Battleground::RemovePlayerAtLeave(ObjectGuid guid, bool Transport, bool Sen
player->RemoveAura(SPELL_MERCENARY_SHAPESHIFT);
player->RemovePlayerFlagEx(PLAYER_FLAGS_EX_MERCENARY_MODE);
- player->AtEndOfEncounter();
+ player->AtEndOfEncounter(EncounterType::Battleground);
player->RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2::LeaveArenaOrBattleground);
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index b3a7746bc4c..dd1525cb783 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -509,18 +509,39 @@ void Unit::MonsterMoveWithSpeed(float x, float y, float z, float speed, bool gen
GetMotionMaster()->LaunchMoveSpline(std::move(initializer), 0, MOTION_PRIORITY_NORMAL, POINT_MOTION_TYPE);
}
-void Unit::AtStartOfEncounter()
+void Unit::AtStartOfEncounter(EncounterType type)
{
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2::StartOfEncounter);
+ switch (type)
+ {
+ case EncounterType::DungeonEncounter:
+ RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2::StartOfDungeonEncounter);
+ break;
+ case EncounterType::MythicPlusRun:
+ RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2::StartOfMythicPlusRun);
+ break;
+ default:
+ break;
+ }
+
if (IsAlive())
Unit::ProcSkillsAndAuras(this, nullptr, PROC_FLAG_ENCOUNTER_START, PROC_FLAG_NONE, PROC_SPELL_TYPE_MASK_ALL, PROC_SPELL_PHASE_NONE, PROC_HIT_NONE, nullptr, nullptr, nullptr);
}
-void Unit::AtEndOfEncounter()
+void Unit::AtEndOfEncounter(EncounterType type)
{
RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2::EndOfEncounter);
+ switch (type)
+ {
+ case EncounterType::DungeonEncounter:
+ RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags2::EndOfDungeonEncounter);
+ break;
+ default:
+ break;
+ }
+
GetSpellHistory()->ResetCooldowns([](SpellHistory::CooldownStorageType::iterator itr)
{
SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(itr->first, DIFFICULTY_NONE);
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index fd45dfb1a7e..bc4b402259c 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -99,6 +99,7 @@ class UnitAura;
class Vehicle;
class VehicleJoinEvent;
+enum class EncounterType : uint8;
enum class PetActionFeedback : uint8;
enum MovementGeneratorType : uint8;
enum ProcFlagsHit : uint32;
@@ -2025,8 +2026,8 @@ class TC_GAME_API Unit : public WorldObject
virtual void AtDisengage() {}
public:
- void AtStartOfEncounter();
- void AtEndOfEncounter();
+ void AtStartOfEncounter(EncounterType type);
+ void AtEndOfEncounter(EncounterType type);
private:
diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp
index bbe13257978..cea02363830 100644
--- a/src/server/game/Instances/InstanceScript.cpp
+++ b/src/server/game/Instances/InstanceScript.cpp
@@ -409,7 +409,7 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state)
instance->DoOnPlayers([](Player* player)
{
- player->AtStartOfEncounter();
+ player->AtStartOfEncounter(EncounterType::DungeonEncounter);
});
break;
}
@@ -420,7 +420,7 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state)
instance->DoOnPlayers([](Player* player)
{
- player->AtEndOfEncounter();
+ player->AtEndOfEncounter(EncounterType::DungeonEncounter);
});
break;
}
@@ -437,7 +437,7 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state)
instance->DoOnPlayers([](Player* player)
{
- player->AtEndOfEncounter();
+ player->AtEndOfEncounter(EncounterType::DungeonEncounter);
});
break;
}
diff --git a/src/server/game/Maps/ZoneScript.h b/src/server/game/Maps/ZoneScript.h
index 792989f6a61..46d3e680647 100644
--- a/src/server/game/Maps/ZoneScript.h
+++ b/src/server/game/Maps/ZoneScript.h
@@ -31,6 +31,13 @@ struct CreatureData;
enum class FlagState : uint8;
+enum class EncounterType : uint8
+{
+ DungeonEncounter,
+ Battleground,
+ MythicPlusRun
+};
+
class TC_GAME_API ZoneScript
{
public:
diff --git a/src/server/game/Spells/SpellDefines.h b/src/server/game/Spells/SpellDefines.h
index caa2ef5ddd3..ef9a3b0f79b 100644
--- a/src/server/game/Spells/SpellDefines.h
+++ b/src/server/game/Spells/SpellDefines.h
@@ -137,7 +137,10 @@ enum class SpellAuraInterruptFlags2 : uint32
TouchingGround = 0x00040000, // NYI
ChromieTime = 0x00080000, // NYI
SplineFlightOrFreeFlight = 0x00100000, // NYI
- ProcOrPeriodicAttacking = 0x00200000 // NYI
+ ProcOrPeriodicAttacking = 0x00200000, // NYI
+ StartOfMythicPlusRun = 0x00400000, // Implemented in Unit::AtStartOfEncounter
+ StartOfDungeonEncounter = 0x00800000, // Implemented in Unit::AtStartOfEncounter - Similar to StartOfEncounter (but only with bosses, not m+ run or battleground)
+ EndOfDungeonEncounter = 0x01000000, // Implemented in Unit::AtEndOfEncounter - Similar to EndOfEncounter (but only with bosses, not m+ run or battleground)
};
DEFINE_ENUM_FLAG(SpellAuraInterruptFlags2);