aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.cpp9
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.h2
-rw-r--r--src/server/game/Entities/Item/Item.cpp2
-rw-r--r--src/server/game/Entities/Player/Player.cpp4
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp1
-rw-r--r--src/server/game/Handlers/GuildHandler.cpp7
-rw-r--r--src/server/game/Loot/LootMgr.cpp9
-rw-r--r--src/server/game/Loot/LootMgr.h1
-rw-r--r--src/server/game/Reputation/ReputationMgr.cpp2
-rw-r--r--src/server/scripts/Battlegrounds/DalaranSewers/arena_dalaran_sewers.cpp315
10 files changed, 194 insertions, 158 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 2733f2c8df7..6a3ee1df3ab 100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -187,7 +187,7 @@ LFGDungeonData const* LFGMgr::GetLFGDungeon(uint32 id)
return nullptr;
}
-void LFGMgr::LoadLFGDungeons(bool reload /* = false */)
+void LFGMgr::LoadLFGDungeons()
{
uint32 oldMSTime = getMSTime();
@@ -231,7 +231,7 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */)
LFGDungeonContainer::iterator dungeonItr = LfgDungeonStore.find(dungeonId);
if (dungeonItr == LfgDungeonStore.end())
{
- TC_LOG_ERROR("sql.sql", "table `lfg_entrances` contains coordinates for wrong dungeon {}", dungeonId);
+ TC_LOG_ERROR("sql.sql", "table `lfg_dungeon_template` contains coordinates for wrong dungeon {}", dungeonId);
continue;
}
@@ -248,6 +248,8 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */)
TC_LOG_INFO("server.loading", ">> Loaded {} lfg dungeon templates in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
+ CachedDungeonMapStore.clear();
+
// Fill all other teleport coords from areatriggers
for (LFGDungeonContainer::iterator itr = LfgDungeonStore.begin(); itr != LfgDungeonStore.end(); ++itr)
{
@@ -274,9 +276,6 @@ void LFGMgr::LoadLFGDungeons(bool reload /* = false */)
CachedDungeonMapStore[dungeon.group].insert(dungeon.id);
CachedDungeonMapStore[0].insert(dungeon.id);
}
-
- if (reload)
- CachedDungeonMapStore.clear();
}
LFGMgr* LFGMgr::instance()
diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h
index b31b1d1b9ac..b20a5fad3b9 100644
--- a/src/server/game/DungeonFinding/LFGMgr.h
+++ b/src/server/game/DungeonFinding/LFGMgr.h
@@ -339,7 +339,7 @@ class TC_GAME_API LFGMgr
/// Loads rewards for random dungeons
void LoadRewards();
/// Loads dungeons from dbc and adds teleport coords
- void LoadLFGDungeons(bool reload = false);
+ void LoadLFGDungeons();
// Multiple files
/// Check if given guid applied for random dungeon
diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp
index 7fa5ba63d37..5401c0c9c45 100644
--- a/src/server/game/Entities/Item/Item.cpp
+++ b/src/server/game/Entities/Item/Item.cpp
@@ -1421,12 +1421,10 @@ bool Item::HasEnchantRequiredSkill(Player const* player) const
{
// Check all enchants for required skill
for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot)
- {
if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot)))
if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id))
if (enchantEntry->RequiredSkillID && player->GetSkillValue(enchantEntry->RequiredSkillID) < enchantEntry->RequiredSkillRank)
return false;
- }
return true;
}
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 89bf5831d36..c8c75eb8279 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -2316,7 +2316,7 @@ void Player::GiveLevel(uint8 level)
UpdateAllStats();
- _ApplyAllLevelScaleItemMods(true); // Moved to above SetFullHealth so player will have full health from Heirlooms
+ _ApplyAllLevelScaleItemMods(true);
if (Aura const* artifactAura = GetAura(ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE))
if (Item* artifact = GetItemByGuid(artifactAura->GetCastItemGUID()))
@@ -25983,7 +25983,7 @@ bool Player::isHonorOrXPTarget(Unit const* victim) const
if (v_level < k_grey && !sWorld->getIntConfig(CONFIG_MIN_CREATURE_SCALED_XP_RATIO))
return false;
- if (Creature const* const creature = victim->ToCreature())
+ if (Creature const* creature = victim->ToCreature())
{
if (creature->IsCritter() || creature->IsTotem())
return false;
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 075875e7fe5..72be6ff52fb 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -6089,6 +6089,7 @@ void ObjectMgr::LoadSpellScriptNames()
TC_LOG_ERROR("sql.sql", "Scriptname: `{}` spell (Id: {}) is not first rank of spell.", scriptName, fields[0].GetInt32());
continue;
}
+
while (spellInfo)
{
_spellScriptsStore.insert(SpellScriptsContainer::value_type(spellInfo->Id, std::make_pair(GetScriptId(scriptName), true)));
diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp
index 2dbc1c5e02a..f8d41200177 100644
--- a/src/server/game/Handlers/GuildHandler.cpp
+++ b/src/server/game/Handlers/GuildHandler.cpp
@@ -589,8 +589,11 @@ void WorldSession::HandleGuildReplaceGuildMaster(WorldPackets::Guild::GuildRepla
void WorldSession::HandleGuildSetGuildMaster(WorldPackets::Guild::GuildSetGuildMaster& packet)
{
- if (Guild* guild = GetPlayer()->GetGuild())
- guild->HandleSetNewGuildMaster(this, packet.NewMasterName, false);
+ TC_LOG_DEBUG("guild", "CMSG_GUILD_SET_GUILD_MASTER [{}]: Target: {}", GetPlayerInfo(), packet.NewMasterName);
+
+ if (normalizePlayerName(packet.NewMasterName))
+ if (Guild* guild = GetPlayer()->GetGuild())
+ guild->HandleSetNewGuildMaster(this, packet.NewMasterName, false);
}
void WorldSession::HandleGuildSetAchievementTracking(WorldPackets::Guild::GuildSetAchievementTracking& packet)
diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp
index 5c8999b99e7..650c7190c92 100644
--- a/src/server/game/Loot/LootMgr.cpp
+++ b/src/server/game/Loot/LootMgr.cpp
@@ -236,11 +236,6 @@ void LootStore::ReportUnusedIds(LootIdSet const& lootIdSet) const
TC_LOG_ERROR("sql.sql", "Table '{}' Entry {} isn't {} and not referenced from loot, and thus useless.", GetName(), lootId, GetEntryName());
}
-void LootStore::ReportNonExistingId(uint32 lootId) const
-{
- TC_LOG_ERROR("sql.sql", "Table '{}' Entry {} does not exist", GetName(), lootId);
-}
-
void LootStore::ReportNonExistingId(uint32 lootId, char const* ownerType, uint32 ownerId) const
{
TC_LOG_ERROR("sql.sql", "Table '{}' Entry {} does not exist but it is used by {} {}", GetName(), lootId, ownerType, ownerId);
@@ -1127,7 +1122,7 @@ void LoadLootTemplates_Disenchant()
{
uint32 lootid = disenchant->ID;
if (!lootIdSet.contains(lootid))
- LootTemplates_Disenchant.ReportNonExistingId(lootid);
+ LootTemplates_Disenchant.ReportNonExistingId(lootid, "ItemDisenchantLoot", lootid);
else
lootIdSetUsed.insert(lootid);
}
@@ -1139,7 +1134,7 @@ void LoadLootTemplates_Disenchant()
uint32 lootid = itemBonus->Value[0];
if (!lootIdSet.contains(lootid))
- LootTemplates_Disenchant.ReportNonExistingId(lootid);
+ LootTemplates_Disenchant.ReportNonExistingId(lootid, "ItemBonusList", itemBonus->ParentItemBonusListID);
else
lootIdSetUsed.insert(lootid);
}
diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h
index 808cf529201..8d9ed8df8f0 100644
--- a/src/server/game/Loot/LootMgr.h
+++ b/src/server/game/Loot/LootMgr.h
@@ -87,7 +87,6 @@ class TC_GAME_API LootStore
uint32 LoadAndCollectLootIds(LootIdSet& lootIdSet);
void CheckLootRefs(LootIdSet* ref_set = nullptr) const; // check existence reference and remove it from ref_set
void ReportUnusedIds(LootIdSet const& lootIdSet) const;
- void ReportNonExistingId(uint32 lootId) const;
void ReportNonExistingId(uint32 lootId, char const* ownerType, uint32 ownerId) const;
bool HaveLootFor(uint32 loot_id) const { return m_LootTemplates.contains(loot_id); }
diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp
index f5463a420d3..574969a1cc0 100644
--- a/src/server/game/Reputation/ReputationMgr.cpp
+++ b/src/server/game/Reputation/ReputationMgr.cpp
@@ -209,7 +209,7 @@ std::string ReputationMgr::GetReputationRankName(FactionEntry const* factionEntr
{
ReputationRank rank = GetRank(factionEntry);
if (!factionEntry->FriendshipRepID)
- return sObjectMgr->GetTrinityString(ReputationRankStrIndex[GetRank(factionEntry)], _player->GetSession()->GetSessionDbcLocale());
+ return sObjectMgr->GetTrinityString(ReputationRankStrIndex[rank], _player->GetSession()->GetSessionDbcLocale());
if (DB2Manager::FriendshipRepReactionSet const* friendshipReactions = sDB2Manager.GetFriendshipRepReactions(factionEntry->FriendshipRepID))
{
diff --git a/src/server/scripts/Battlegrounds/DalaranSewers/arena_dalaran_sewers.cpp b/src/server/scripts/Battlegrounds/DalaranSewers/arena_dalaran_sewers.cpp
index bbdf5d4ab3b..24b16f3b904 100644
--- a/src/server/scripts/Battlegrounds/DalaranSewers/arena_dalaran_sewers.cpp
+++ b/src/server/scripts/Battlegrounds/DalaranSewers/arena_dalaran_sewers.cpp
@@ -25,64 +25,74 @@
#include "ObjectAccessor.h"
#include "Player.h"
#include "ScriptMgr.h"
+#include "SpellAuraEffects.h"
+#include "SpellInfo.h"
+#include "SpellMgr.h"
+#include "SpellScript.h"
#include "TaskScheduler.h"
-struct arena_dalaran_sewers : ArenaScript
+namespace DalaranSewers
{
- enum GameObjects
+ namespace Creatures
{
- BG_DS_OBJECT_TYPE_DOOR_1 = 192642,
- BG_DS_OBJECT_TYPE_DOOR_2 = 192643,
- BG_DS_OBJECT_TYPE_WATER_1 = 194395, // Collision
- BG_DS_OBJECT_TYPE_WATER_2 = 191877,
- BG_DS_OBJECT_TYPE_BUFF_1 = 184663,
- BG_DS_OBJECT_TYPE_BUFF_2 = 184664
- };
-
- enum Events
+ static constexpr uint32 WaterSpout = 28567;
+ }
+
+ namespace Events
+ {
+ static constexpr uint32 WaterfallWarning = 1;
+ static constexpr uint32 WaterfallOn = 2;
+ static constexpr uint32 WaterfallOff = 3;
+ static constexpr uint32 WaterfallKnockBack = 4;
+ }
+
+ namespace GameObjects
{
- BG_DS_EVENT_WATERFALL_WARNING = 1, // Water starting to fall, but no LoS Blocking nor movement blocking
- BG_DS_EVENT_WATERFALL_ON = 2, // LoS and Movement blocking active
- BG_DS_EVENT_WATERFALL_OFF = 3,
- BG_DS_EVENT_WATERFALL_KNOCKBACK = 4,
+ static constexpr uint32 Door01 = 192642;
+ static constexpr uint32 Door02 = 192643;
- BG_DS_EVENT_PIPE_KNOCKBACK = 5
- };
+ static constexpr uint32 WaterCollision = 194395;
+ static constexpr uint32 Waterfall = 191877;
+ }
- enum Creatures
+ namespace MapIds
{
- BG_DS_NPC_TYPE_WATER_SPOUT = 28567
- };
+ static constexpr uint32 DalaranSewers = 617;
+ }
- enum Spells
+ namespace Spells
{
- BG_DS_SPELL_FLUSH = 57405, // Visual and target selector for the starting knockback from the pipe
- BG_DS_SPELL_FLUSH_KNOCKBACK = 61698, // Knockback effect for previous spell (triggered, not needed to be cast)
- BG_DS_SPELL_WATER_SPOUT = 58873, // Knockback effect of the central waterfall
+ static constexpr uint32 PipeFlushKnockbackSearchTrigger = 96539;
+ static constexpr uint32 DalaranSewersPetTeleport = 254013;
+ static constexpr uint32 WaterSpout = 58873; // Knock back
+ static constexpr uint32 Flush = 57405;
+
+ static constexpr uint32 WarlockDemonicCircle = 48018;
+ }
- SPELL_WARL_DEMONIC_CIRCLE = 48018 // Demonic Circle Summon
- };
+ namespace StringIds
+ {
+ static constexpr std::string_view WaterSpoutPipe = "arena_dalaran_sewers_water_spout_pipe";
+ static constexpr std::string_view WaterSpoutCenter = "arena_dalaran_sewers_water_spout_center";
+ }
- enum Data
+ namespace Timers
{
- // These values are NOT blizzlike... need the correct data!
- BG_DS_PIPE_KNOCKBACK_FIRST_DELAY = 5000,
- BG_DS_PIPE_KNOCKBACK_DELAY = 3000
- };
-
- // These values are NOT blizzlike... need the correct data!
- static constexpr Seconds BG_DS_WATERFALL_TIMER_MIN = 30s;
- static constexpr Seconds BG_DS_WATERFALL_TIMER_MAX = 60s;
- static constexpr Seconds BG_DS_WATERFALL_WARNING_DURATION = 5s;
- static constexpr Seconds BG_DS_WATERFALL_DURATION = 30s;
- static constexpr Milliseconds BG_DS_WATERFALL_KNOCKBACK_TIMER = 1500ms;
- static constexpr uint32 BG_DS_DATA_PIPE_KNOCKBACK_COUNT = 1;
- static constexpr uint32 BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT = 2;
-
- explicit arena_dalaran_sewers(BattlegroundMap* map) : ArenaScript(map), _pipeKnockBackTimer(BG_DS_PIPE_KNOCKBACK_FIRST_DELAY), _pipeKnockBackCount(0) { }
+ static constexpr Seconds Waterfall = 30s;
+ static constexpr Seconds WaterfallWarningDuration = 5s;
+ static constexpr Seconds WaterfallDuration = 30s;
+ static constexpr Milliseconds WaterfallKnockBack = 1500ms;
+ }
+}
+
+struct arena_dalaran_sewers : ArenaScript
+{
+ explicit arena_dalaran_sewers(BattlegroundMap* map) : ArenaScript(map) { }
void OnUpdate(uint32 diff) override
{
+ ArenaScript::OnUpdate(diff);
+
if (battleground->GetStatus() != STATUS_IN_PROGRESS)
return;
@@ -93,75 +103,44 @@ struct arena_dalaran_sewers : ArenaScript
{
switch (eventId)
{
- case BG_DS_EVENT_WATERFALL_WARNING:
+ case DalaranSewers::Events::WaterfallWarning:
// Add the water
- if (GameObject* go = battlegroundMap->GetGameObject(_water2GUID))
- go->ResetDoorOrButton();
- _events.ScheduleEvent(BG_DS_EVENT_WATERFALL_ON, BG_DS_WATERFALL_WARNING_DURATION);
+ if (GameObject* go = battlegroundMap->GetGameObject(_waterfallGUID))
+ go->UseDoorOrButton();
+ _events.ScheduleEvent(DalaranSewers::Events::WaterfallOn, DalaranSewers::Timers::WaterfallWarningDuration);
break;
- case BG_DS_EVENT_WATERFALL_ON:
+ case DalaranSewers::Events::WaterfallOn:
// Active collision and start knockback timer
- if (GameObject* go = battlegroundMap->GetGameObject(_water1GUID))
- go->ResetDoorOrButton();
- _events.ScheduleEvent(BG_DS_EVENT_WATERFALL_OFF, BG_DS_WATERFALL_DURATION);
- _events.ScheduleEvent(BG_DS_EVENT_WATERFALL_KNOCKBACK, BG_DS_WATERFALL_KNOCKBACK_TIMER);
- break;
- case BG_DS_EVENT_WATERFALL_OFF:
- // Remove collision and water
- if (GameObject* go = battlegroundMap->GetGameObject(_water1GUID))
+ if (GameObject* go = battlegroundMap->GetGameObject(_waterCollisionGUID))
go->UseDoorOrButton();
- if (GameObject* go = battlegroundMap->GetGameObject(_water2GUID))
- go->UseDoorOrButton();
- _events.CancelEvent(BG_DS_EVENT_WATERFALL_KNOCKBACK);
- _events.ScheduleEvent(BG_DS_EVENT_WATERFALL_WARNING, BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX);
+ _events.ScheduleEvent(DalaranSewers::Events::WaterfallOff, DalaranSewers::Timers::WaterfallDuration);
+ _events.ScheduleEvent(DalaranSewers::Events::WaterfallKnockBack, DalaranSewers::Timers::WaterfallKnockBack);
break;
- case BG_DS_EVENT_WATERFALL_KNOCKBACK:
- // Repeat knockback while the waterfall still active
- if (Creature* waterSpout = battlegroundMap->GetCreature(_waterfallCreatureGUID))
- waterSpout->CastSpell(waterSpout, BG_DS_SPELL_WATER_SPOUT, true);
- _events.ScheduleEvent(eventId, BG_DS_WATERFALL_KNOCKBACK_TIMER);
+ case DalaranSewers::Events::WaterfallOff:
+ // Remove collision and water
+ if (GameObject* go = battlegroundMap->GetGameObject(_waterCollisionGUID))
+ go->ResetDoorOrButton();
+ if (GameObject* go = battlegroundMap->GetGameObject(_waterfallGUID))
+ go->ResetDoorOrButton();
+ _events.CancelEvent(DalaranSewers::Events::WaterfallKnockBack);
+ _events.ScheduleEvent(DalaranSewers::Events::WaterfallWarning, DalaranSewers::Timers::Waterfall);
break;
- case BG_DS_EVENT_PIPE_KNOCKBACK:
- for (ObjectGuid const& guid : _pipeCreatureGUIDs)
- if (Creature* waterSpout = battlegroundMap->GetCreature(guid))
- waterSpout->CastSpell(waterSpout, BG_DS_SPELL_FLUSH, true);
+ case DalaranSewers::Events::WaterfallKnockBack:
+ // Repeat knock back while the waterfall still active
+ if (Creature* waterSpout = battlegroundMap->GetCreature(_waterSpoutCenterGUID))
+ waterSpout->CastSpell(waterSpout, DalaranSewers::Spells::WaterSpout, true);
+ _events.ScheduleEvent(eventId, DalaranSewers::Timers::WaterfallKnockBack);
break;
default:
break;
}
}
-
- if (_pipeKnockBackCount < BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT)
- {
- if (_pipeKnockBackTimer < diff)
- {
- for (ObjectGuid const& guid : _pipeCreatureGUIDs)
- if (Creature* waterSpout = battlegroundMap->GetCreature(guid))
- waterSpout->CastSpell(waterSpout, BG_DS_SPELL_FLUSH, true);
-
- ++_pipeKnockBackCount;
- _pipeKnockBackTimer = BG_DS_PIPE_KNOCKBACK_DELAY;
- }
- else
- _pipeKnockBackTimer -= diff;
- }
-
- }
-
- void OnInit() override
- {
- AddObject(BG_DS_OBJECT_TYPE_DOOR_1, 1350.95f, 817.2f, 20.8096f, 3.15f, 0, 0, 0.99627f, 0.0862864f, GO_STATE_READY, _doorGUIDs);
- AddObject(BG_DS_OBJECT_TYPE_DOOR_2, 1232.65f, 764.913f, 20.0729f, 6.3f, 0, 0, 0.0310211f, -0.999519f, GO_STATE_READY, _doorGUIDs);
-
- if (GameObject const* go = CreateObject(BG_DS_OBJECT_TYPE_WATER_1, 1291.56f, 790.837f, 7.1f, 3.14238f, 0, 0, 0.694215f, -0.719768f, GO_STATE_READY))
- _water1GUID = go->GetGUID();
-
- if (GameObject const* go = CreateObject(BG_DS_OBJECT_TYPE_WATER_2, 1291.56f, 790.837f, 7.1f, 3.14238f, 0, 0, 0.694215f, -0.719768f, GO_STATE_READY))
- _water2GUID = go->GetGUID();
}
void OnStart() override
{
+ ArenaScript::OnStart();
+
for (ObjectGuid const& guid : _doorGUIDs)
{
if (GameObject* door = battlegroundMap->GetGameObject(guid))
@@ -171,57 +150,79 @@ struct arena_dalaran_sewers : ArenaScript
}
}
- _scheduler.Schedule(1min, [&](TaskContext)
- {
- CreateObject(BG_DS_OBJECT_TYPE_BUFF_1, 1291.7f, 813.424f, 7.11472f, 4.64562f, 0, 0, 0.730314f, -0.683111f);
- CreateObject(BG_DS_OBJECT_TYPE_BUFF_2, 1291.7f, 768.911f, 7.11472f, 1.55194f, 0, 0, 0.700409f, 0.713742f);
- });
- _events.ScheduleEvent(BG_DS_EVENT_WATERFALL_WARNING, BG_DS_WATERFALL_TIMER_MIN, BG_DS_WATERFALL_TIMER_MAX);
- _pipeKnockBackTimer = BG_DS_PIPE_KNOCKBACK_FIRST_DELAY;
+ _events.ScheduleEvent(DalaranSewers::Events::WaterfallWarning, DalaranSewers::Timers::Waterfall);
// Remove collision and water
- if (GameObject* go = battlegroundMap->GetGameObject(_water1GUID))
- go->UseDoorOrButton();
- if (GameObject* go = battlegroundMap->GetGameObject(_water2GUID))
- go->UseDoorOrButton();
+ if (GameObject* go = battlegroundMap->GetGameObject(_waterCollisionGUID))
+ go->ResetDoorOrButton();
+ if (GameObject* go = battlegroundMap->GetGameObject(_waterfallGUID))
+ go->ResetDoorOrButton();
for (const auto& [playerGuid, _] : battleground->GetPlayers())
if (Player* player = ObjectAccessor::FindPlayer(playerGuid))
- player->RemoveAurasDueToSpell(SPELL_WARL_DEMONIC_CIRCLE);
- }
+ player->RemoveAurasDueToSpell(DalaranSewers::Spells::WarlockDemonicCircle);
- void AddObject(uint32 entry, float x, float y, float z, float o, float rotation0, float rotation1, float rotation2, float rotation3, GOState goState, GuidVector guidVector) const
- {
- if (GameObject const* go = CreateObject(entry, x, y, z, o, rotation0, rotation1, rotation2, rotation3, goState))
- guidVector.emplace_back(go->GetGUID());
+ _scheduler.Schedule(6s, [&](TaskContext)
+ {
+ for (ObjectGuid const& guid : _waterSpoutEntranceGUIDs)
+ {
+ if (Creature* creature = battlegroundMap->GetCreature(guid))
+ {
+ creature->CastSpell(nullptr, DalaranSewers::Spells::Flush, CastSpellExtraArgsInit{
+ .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR
+ });
+ creature->CastSpell(creature, DalaranSewers::Spells::PipeFlushKnockbackSearchTrigger, CastSpellExtraArgsInit{
+ .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR
+ });
+ }
+ }
+ });
}
- void SetData(uint32 dataId, uint32 value) override
+ void OnCreatureCreate(Creature* creature) override
{
- ArenaScript::SetData(dataId, value);
- if (dataId == BG_DS_DATA_PIPE_KNOCKBACK_COUNT)
- _pipeKnockBackCount = value;
+ switch (creature->GetEntry())
+ {
+ case DalaranSewers::Creatures::WaterSpout:
+ if (creature->HasStringId(DalaranSewers::StringIds::WaterSpoutPipe))
+ _waterSpoutEntranceGUIDs.push_back(creature->GetGUID());
+ else if (creature->HasStringId(DalaranSewers::StringIds::WaterSpoutCenter))
+ _waterSpoutCenterGUID = creature->GetGUID();
+ break;
+ default:
+ break;
+ }
}
- uint32 GetData(uint32 dataId) const override
+ void OnGameObjectCreate(GameObject* gameobject) override
{
- if (dataId == BG_DS_DATA_PIPE_KNOCKBACK_COUNT)
- return _pipeKnockBackCount;
-
- return ArenaScript::GetData(dataId);
+ switch (gameobject->GetEntry())
+ {
+ case DalaranSewers::GameObjects::Door01:
+ case DalaranSewers::GameObjects::Door02:
+ _doorGUIDs.push_back(gameobject->GetGUID());
+ break;
+ case DalaranSewers::GameObjects::WaterCollision:
+ _waterCollisionGUID = gameobject->GetGUID();
+ break;
+ case DalaranSewers::GameObjects::Waterfall:
+ _waterfallGUID = gameobject->GetGUID();
+ break;
+ default:
+ break;
+ }
}
private:
GuidVector _doorGUIDs;
- ObjectGuid _water1GUID;
- ObjectGuid _water2GUID;
- ObjectGuid _waterfallCreatureGUID;
- GuidVector _pipeCreatureGUIDs;
- TaskScheduler _scheduler;
+ ObjectGuid _waterCollisionGUID;
+ ObjectGuid _waterfallGUID;
EventMap _events;
- uint32 _pipeKnockBackTimer;
- uint8 _pipeKnockBackCount;
+ GuidVector _waterSpoutEntranceGUIDs;
+ ObjectGuid _waterSpoutCenterGUID;
+
+ TaskScheduler _scheduler;
};
class at_ds_pipe_knockback : public AreaTriggerScript
@@ -229,7 +230,7 @@ class at_ds_pipe_knockback : public AreaTriggerScript
public:
at_ds_pipe_knockback() : AreaTriggerScript("at_ds_pipe_knockback") { }
- void Trigger(Player* player) const
+ static void Trigger(Player* player)
{
if (Battleground const* battleground = player->GetBattleground())
{
@@ -237,12 +238,8 @@ public:
return;
// Remove effects of Demonic Circle Summon
- player->RemoveAurasDueToSpell(arena_dalaran_sewers::SPELL_WARL_DEMONIC_CIRCLE);
-
- // Someone has get back into the pipes and the knockback has already been performed,
- // so we reset the knockback count for kicking the player again into the arena.
- if (battleground->GetBgMap()->GetBattlegroundScript()->GetData(arena_dalaran_sewers::BG_DS_DATA_PIPE_KNOCKBACK_COUNT) >= arena_dalaran_sewers::BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT)
- battleground->GetBgMap()->GetBattlegroundScript()->SetData(arena_dalaran_sewers::BG_DS_DATA_PIPE_KNOCKBACK_COUNT, 0);
+ player->RemoveAurasDueToSpell(DalaranSewers::Spells::WarlockDemonicCircle);
+ player->CastSpell(nullptr, DalaranSewers::Spells::DalaranSewersPetTeleport);
}
}
@@ -259,8 +256,52 @@ public:
}
};
+// 96538 - Pipe Flush Knockback Search Effect
+class spell_arena_dalaran_sewers_pipe_flush_knockback_search_trigger : public SpellScript
+{
+ bool Validate(SpellInfo const* spellInfo) override
+ {
+ return ValidateSpellInfo({
+ static_cast<uint32>(spellInfo->GetEffect(EFFECT_0).CalcValue())
+ });
+ }
+
+ void HandleDummy(SpellEffIndex /*effIndex*/) const
+ {
+ GetCaster()->CastSpell(nullptr, GetSpellInfo()->GetEffect(EFFECT_0).CalcValue(), CastSpellExtraArgsInit
+ {
+ .TriggerFlags = TRIGGERED_IGNORE_CAST_IN_PROGRESS | TRIGGERED_DONT_REPORT_CAST_ERROR
+ });
+ }
+
+ void Register() override
+ {
+ OnEffectHit += SpellEffectFn(spell_arena_dalaran_sewers_pipe_flush_knockback_search_trigger::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+};
+
+// 61698 - Flush - Knockback effect (SERVERSIDE)
+class spell_arena_dalaran_sewers_flush_knock_back_effect : public SpellScript
+{
+ void HandleDummy(SpellEffIndex /*effIndex*/) const
+ {
+ static constexpr float SpeedXY = 30.0f;
+ static constexpr float SpeedZ = 19.0f;
+
+ Unit* caster = GetCaster();
+ Unit const* target = GetHitUnit();
+ caster->KnockbackFrom(target->GetPosition(), SpeedXY, SpeedZ);
+ }
+
+ void Register() override
+ {
+ OnEffectHitTarget += SpellEffectFn(spell_arena_dalaran_sewers_flush_knock_back_effect::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
+ }
+};
+
void AddSC_arena_dalaran_sewers()
{
- RegisterBattlegroundMapScript(arena_dalaran_sewers, 617);
+ RegisterBattlegroundMapScript(arena_dalaran_sewers, DalaranSewers::MapIds::DalaranSewers);
new at_ds_pipe_knockback();
+ RegisterSpellScript(spell_arena_dalaran_sewers_flush_knock_back_effect);
}