aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/updates/world/master/2023_09_19_01_world.sql5
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.cpp32
-rw-r--r--src/server/game/DungeonFinding/LFGMgr.h3
-rw-r--r--src/server/game/Entities/Creature/CreatureData.h2
-rw-r--r--src/server/game/Entities/Player/KillRewarder.cpp5
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp107
-rw-r--r--src/server/game/Globals/ObjectMgr.h25
-rw-r--r--src/server/game/Instances/InstanceScript.cpp56
-rw-r--r--src/server/game/Instances/InstanceScript.h7
-rw-r--r--src/server/game/Maps/ZoneScript.h2
-rw-r--r--src/server/game/World/World.cpp3
-rw-r--r--src/server/scripts/Commands/cs_go.cpp11
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp1
-rw-r--r--src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp1
-rw-r--r--src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp8
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp29
17 files changed, 56 insertions, 242 deletions
diff --git a/sql/updates/world/master/2023_09_19_01_world.sql b/sql/updates/world/master/2023_09_19_01_world.sql
new file mode 100644
index 00000000000..d82316fb5f0
--- /dev/null
+++ b/sql/updates/world/master/2023_09_19_01_world.sql
@@ -0,0 +1,5 @@
+UPDATE `creature_template` SET `flags_extra`=`flags_extra`|0x10000000 WHERE `entry` IN (SELECT `creditEntry` FROM `instance_encounters` WHERE `creditType`=0);
+
+DROP TABLE IF EXISTS `instance_encounters`;
+
+DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_gen_dungeon_credit';
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 9d990ff17f9..e99faab32c1 100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -43,7 +43,7 @@ namespace lfg
{
LFGDungeonData::LFGDungeonData() : id(0), name(), map(0), type(0), expansion(0), group(0), contentTuningId(0),
- difficulty(DIFFICULTY_NONE), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f), requiredItemLevel(0)
+ difficulty(DIFFICULTY_NONE), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f), requiredItemLevel(0), finalDungeonEncounterId(0)
{
}
@@ -51,8 +51,10 @@ LFGDungeonData::LFGDungeonData(LFGDungeonsEntry const* dbc) : id(dbc->ID), name(
type(uint8(dbc->TypeID)), expansion(uint8(dbc->ExpansionLevel)), group(uint8(dbc->GroupID)),
contentTuningId(uint32(dbc->ContentTuningID)), difficulty(Difficulty(dbc->DifficultyID)),
seasonal((dbc->Flags[0] & LFG_FLAG_SEASONAL) != 0), x(0.0f), y(0.0f), z(0.0f), o(0.0f),
- requiredItemLevel(0)
+ requiredItemLevel(0), finalDungeonEncounterId(0)
{
+ if (JournalEncounterEntry const* journalEncounter = sJournalEncounterStore.LookupEntry(dbc->FinalEncounterID))
+ finalDungeonEncounterId = journalEncounter->DungeonEncounterID;
}
LFGMgr::LFGMgr() : m_QueueTimer(0), m_lfgProposalId(1),
@@ -1440,9 +1442,33 @@ void LFGMgr::TeleportPlayer(Player* player, bool out, bool fromOpcode /*= false*
}
/**
+ Check if dungeon can be rewarded, if any.
+
+ @param[in] gguid Group guid
+ @param[in] dungeonEncounterIds DungeonEncounter that was just completed
+ @param[in] currMap Map of the instance where encounter was completed
+*/
+void LFGMgr::OnDungeonEncounterDone(ObjectGuid gguid, std::array<uint32, 4> const& dungeonEncounterIds, Map const* currMap)
+{
+ if (GetState(gguid) == LFG_STATE_FINISHED_DUNGEON) // Shouldn't happen. Do not reward multiple times
+ {
+ TC_LOG_DEBUG("lfg.dungeon.finish", "Group: {} already rewarded", gguid.ToString());
+ return;
+ }
+
+ uint32 gDungeonId = GetDungeon(gguid);
+ LFGDungeonData const* dungeonDone = GetLFGDungeon(gDungeonId);
+ // LFGDungeons can point to a DungeonEncounter from any difficulty so we need this kind of lenient check
+ if (std::find(dungeonEncounterIds.begin(), dungeonEncounterIds.end(), dungeonDone->finalDungeonEncounterId) == dungeonEncounterIds.end())
+ return;
+
+ FinishDungeon(gguid, gDungeonId, currMap);
+}
+
+/**
Finish a dungeon and give reward, if any.
- @param[in] guid Group guid
+ @param[in] gguid Group guid
@param[in] dungeonId Dungeonid
*/
void LFGMgr::FinishDungeon(ObjectGuid gguid, const uint32 dungeonId, Map const* currMap)
diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h
index d33e111d2be..99a0a46be84 100644
--- a/src/server/game/DungeonFinding/LFGMgr.h
+++ b/src/server/game/DungeonFinding/LFGMgr.h
@@ -306,6 +306,7 @@ struct LFGDungeonData
bool seasonal;
float x, y, z, o;
uint16 requiredItemLevel;
+ uint32 finalDungeonEncounterId;
// Helpers
uint32 Entry() const { return id + (type << 24); }
@@ -329,6 +330,8 @@ class TC_GAME_API LFGMgr
void Update(uint32 diff);
// World.cpp
+ /// Check dungeon completion on encounter completion
+ void OnDungeonEncounterDone(ObjectGuid gguid, std::array<uint32, 4> const& dungeonEncounterId, Map const* currMap);
/// Finish the dungeon for the given group. All check are performed using internal lfg data
void FinishDungeon(ObjectGuid gguid, uint32 dungeonId, Map const* currMap);
/// Loads rewards for random dungeons
diff --git a/src/server/game/Entities/Creature/CreatureData.h b/src/server/game/Entities/Creature/CreatureData.h
index 3d1d896b0f0..949c4ab3fa7 100644
--- a/src/server/game/Entities/Creature/CreatureData.h
+++ b/src/server/game/Entities/Creature/CreatureData.h
@@ -359,7 +359,7 @@ enum CreatureFlagsExtra : uint32
CREATURE_FLAG_EXTRA_UNUSED_25 = 0x02000000,
CREATURE_FLAG_EXTRA_UNUSED_26 = 0x04000000,
CREATURE_FLAG_EXTRA_UNUSED_27 = 0x08000000,
- CREATURE_FLAG_EXTRA_DUNGEON_BOSS = 0x10000000, // creature is a dungeon boss (SET DYNAMICALLY, DO NOT ADD IN DB)
+ CREATURE_FLAG_EXTRA_DUNGEON_BOSS = 0x10000000, // creature is a dungeon boss
CREATURE_FLAG_EXTRA_IGNORE_PATHFINDING = 0x20000000, // creature ignore pathfinding
CREATURE_FLAG_EXTRA_IMMUNITY_KNOCKBACK = 0x40000000, // creature is immune to knockback effects
CREATURE_FLAG_EXTRA_UNUSED_31 = 0x80000000,
diff --git a/src/server/game/Entities/Player/KillRewarder.cpp b/src/server/game/Entities/Player/KillRewarder.cpp
index 921bf521a92..aaabd7b90dd 100644
--- a/src/server/game/Entities/Player/KillRewarder.cpp
+++ b/src/server/game/Entities/Player/KillRewarder.cpp
@@ -23,7 +23,6 @@
#include "Group.h"
#include "Guild.h"
#include "GuildMgr.h"
-#include "InstanceScript.h"
#include "Pet.h"
#include "Player.h"
#include "Scenario.h"
@@ -292,10 +291,6 @@ void KillRewarder::Reward()
// 7. Credit scenario criterias
if (Creature* victim = _victim->ToCreature())
{
- if (victim->IsDungeonBoss())
- if (InstanceScript* instance = _victim->GetInstanceScript())
- instance->UpdateEncounterStateForKilledCreature(_victim->GetEntry(), _victim);
-
if (_killers.begin() != _killers.end())
{
if (ObjectGuid::LowType guildId = victim->GetMap()->GetOwnerGuildId())
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 6e932aeeb8f..18dbc889c7a 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -6214,105 +6214,6 @@ InstanceTemplate const* ObjectMgr::GetInstanceTemplate(uint32 mapID) const
return nullptr;
}
-void ObjectMgr::LoadInstanceEncounters()
-{
- uint32 oldMSTime = getMSTime();
-
- // 0 1 2 3
- QueryResult result = WorldDatabase.Query("SELECT entry, creditType, creditEntry, lastEncounterDungeon FROM instance_encounters");
- if (!result)
- {
- TC_LOG_INFO("server.loading", ">> Loaded 0 instance encounters, table is empty!");
- return;
- }
-
- uint32 count = 0;
- std::map<uint32, std::pair<uint32, DungeonEncounterEntry const*>> dungeonLastBosses;
- do
- {
- Field* fields = result->Fetch();
- uint32 entry = fields[0].GetUInt32();
- uint8 creditType = fields[1].GetUInt8();
- uint32 creditEntry = fields[2].GetUInt32();
- uint32 lastEncounterDungeon = fields[3].GetUInt16();
- DungeonEncounterEntry const* dungeonEncounter = sDungeonEncounterStore.LookupEntry(entry);
- if (!dungeonEncounter)
- {
- TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid encounter id {}, skipped!", entry);
- continue;
- }
-
- if (lastEncounterDungeon && !sLFGMgr->GetLFGDungeonEntry(lastEncounterDungeon))
- {
- TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an encounter {} ({}) marked as final for invalid dungeon id {}, skipped!",
- entry, dungeonEncounter->Name[sWorld->GetDefaultDbcLocale()], lastEncounterDungeon);
- continue;
- }
-
- auto itr = dungeonLastBosses.find(lastEncounterDungeon);
- if (lastEncounterDungeon)
- {
- if (itr != dungeonLastBosses.end())
- {
- TC_LOG_ERROR("sql.sql", "Table `instance_encounters` specified encounter {} ({}) as last encounter but {} ({}) is already marked as one, skipped!",
- entry, dungeonEncounter->Name[sWorld->GetDefaultDbcLocale()], itr->second.first, itr->second.second->Name[sWorld->GetDefaultDbcLocale()]);
- continue;
- }
-
- dungeonLastBosses[lastEncounterDungeon] = std::make_pair(entry, dungeonEncounter);
- }
-
- switch (creditType)
- {
- case ENCOUNTER_CREDIT_KILL_CREATURE:
- {
- CreatureTemplate const* creatureInfo = GetCreatureTemplate(creditEntry);
- if (!creatureInfo)
- {
- TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid creature (entry {}) linked to the encounter {} ({}), skipped!",
- creditEntry, entry, dungeonEncounter->Name[sWorld->GetDefaultDbcLocale()]);
- continue;
- }
- const_cast<CreatureTemplate*>(creatureInfo)->flags_extra |= CREATURE_FLAG_EXTRA_DUNGEON_BOSS;
- break;
- }
- case ENCOUNTER_CREDIT_CAST_SPELL:
- if (!sSpellMgr->GetSpellInfo(creditEntry, DIFFICULTY_NONE))
- {
- TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid spell (entry {}) linked to the encounter {} ({}), skipped!",
- creditEntry, entry, dungeonEncounter->Name[sWorld->GetDefaultDbcLocale()]);
- continue;
- }
- break;
- default:
- TC_LOG_ERROR("sql.sql", "Table `instance_encounters` has an invalid credit type ({}) for encounter {} ({}), skipped!",
- creditType, entry, dungeonEncounter->Name[sWorld->GetDefaultDbcLocale()]);
- continue;
- }
-
- if (!dungeonEncounter->DifficultyID)
- {
- for (DifficultyEntry const* difficulty : sDifficultyStore)
- {
- if (sDB2Manager.GetMapDifficultyData(dungeonEncounter->MapID, Difficulty(difficulty->ID)))
- {
- DungeonEncounterList& encounters = _dungeonEncounterStore[MAKE_PAIR64(dungeonEncounter->MapID, difficulty->ID)];
- encounters.emplace_back(dungeonEncounter, EncounterCreditType(creditType), creditEntry, lastEncounterDungeon);
- }
- }
- }
- else
- {
- DungeonEncounterList& encounters = _dungeonEncounterStore[MAKE_PAIR64(dungeonEncounter->MapID, dungeonEncounter->DifficultyID)];
- encounters.emplace_back(dungeonEncounter, EncounterCreditType(creditType), creditEntry, lastEncounterDungeon);
- }
-
- ++count;
- } while (result->NextRow());
-
- TC_LOG_INFO("server.loading", ">> Loaded {} instance encounters in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
-}
-
NpcText const* ObjectMgr::GetNpcText(uint32 Text_ID) const
{
NpcTextContainer::const_iterator itr = _npcTextStore.find(Text_ID);
@@ -10568,14 +10469,6 @@ VehicleAccessoryList const* ObjectMgr::GetVehicleAccessoryList(Vehicle* veh) con
return nullptr;
}
-DungeonEncounterList const* ObjectMgr::GetDungeonEncounterList(uint32 mapId, Difficulty difficulty) const
-{
- auto itr = _dungeonEncounterStore.find(MAKE_PAIR64(mapId, difficulty));
- if (itr != _dungeonEncounterStore.end())
- return &itr->second;
- return nullptr;
-}
-
PlayerInfo const* ObjectMgr::GetPlayerInfo(uint32 race, uint32 class_) const
{
if (race >= MAX_RACES)
diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h
index ec298506588..fd5b9e7b668 100644
--- a/src/server/game/Globals/ObjectMgr.h
+++ b/src/server/game/Globals/ObjectMgr.h
@@ -48,7 +48,6 @@ enum class GossipOptionFlags : int32;
enum class GossipOptionNpc : uint8;
struct AccessRequirement;
struct DeclinedName;
-struct DungeonEncounterEntry;
struct FactionEntry;
struct PlayerInfo;
struct PlayerLevelInfo;
@@ -992,26 +991,6 @@ struct ExtendedPlayerName
ExtendedPlayerName ExtractExtendedPlayerName(std::string const& name);
-enum EncounterCreditType : uint8
-{
- ENCOUNTER_CREDIT_KILL_CREATURE = 0,
- ENCOUNTER_CREDIT_CAST_SPELL = 1
-};
-
-struct DungeonEncounter
-{
- DungeonEncounter(DungeonEncounterEntry const* _dbcEntry, EncounterCreditType _creditType, uint32 _creditEntry, uint32 _lastEncounterDungeon)
- : dbcEntry(_dbcEntry), creditType(_creditType), creditEntry(_creditEntry), lastEncounterDungeon(_lastEncounterDungeon) { }
-
- DungeonEncounterEntry const* dbcEntry;
- EncounterCreditType creditType;
- uint32 creditEntry;
- uint32 lastEncounterDungeon;
-};
-
-typedef std::vector<DungeonEncounter> DungeonEncounterList;
-typedef std::unordered_map<uint64, DungeonEncounterList> DungeonEncounterContainer;
-
struct TerrainSwapInfo
{
uint32 Id;
@@ -1289,8 +1268,6 @@ class TC_GAME_API ObjectMgr
VehicleTemplate const* GetVehicleTemplate(Vehicle* veh) const;
VehicleAccessoryList const* GetVehicleAccessoryList(Vehicle* veh) const;
- DungeonEncounterList const* GetDungeonEncounterList(uint32 mapId, Difficulty difficulty) const;
-
void LoadQuests();
void LoadQuestStartersAndEnders();
void LoadGameobjectQuestStarters();
@@ -1365,7 +1342,6 @@ class TC_GAME_API ObjectMgr
void LoadGossipMenuItemsLocales();
void LoadPointOfInterestLocales();
void LoadInstanceTemplate();
- void LoadInstanceEncounters();
void LoadMailLevelRewards();
void LoadVehicleTemplateAccessories();
void LoadVehicleTemplate();
@@ -1817,7 +1793,6 @@ class TC_GAME_API ObjectMgr
AreaTriggerContainer _areaTriggerStore;
AreaTriggerScriptContainer _areaTriggerScriptStore;
AccessRequirementContainer _accessRequirementStore;
- DungeonEncounterContainer _dungeonEncounterStore;
std::unordered_map<uint32, WorldSafeLocsEntry> _worldSafeLocs;
EventContainer _eventStore;
diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp
index b2c06da1a90..f407ad4ec45 100644
--- a/src/server/game/Instances/InstanceScript.cpp
+++ b/src/server/game/Instances/InstanceScript.cpp
@@ -435,6 +435,8 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state)
SendBossKillCredit(dungeonEncounter->ID);
if (dungeonEncounter->CompleteWorldStateID)
DoUpdateWorldState(dungeonEncounter->CompleteWorldStateID, 1);
+
+ UpdateLfgEncounterState(bossInfo);
}
instance->DoOnPlayers([](Player* player)
@@ -857,61 +859,27 @@ void InstanceScript::SendBossKillCredit(uint32 encounterId)
instance->SendToPlayers(bossKillCreditMessage.Write());
}
-void InstanceScript::UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Unit* /*source*/)
+void InstanceScript::UpdateLfgEncounterState(BossInfo const* bossInfo)
{
- DungeonEncounterList const* encounters = sObjectMgr->GetDungeonEncounterList(instance->GetId(), instance->GetDifficultyID());
- if (!encounters)
- return;
-
- uint32 dungeonId = 0;
-
- for (auto const& encounter : *encounters)
- {
- if (encounter.creditType == type && encounter.creditEntry == creditEntry)
- {
- if (encounter.dbcEntry->CompleteWorldStateID)
- DoUpdateWorldState(encounter.dbcEntry->CompleteWorldStateID, 1);
-
- if (encounter.lastEncounterDungeon)
- {
- dungeonId = encounter.lastEncounterDungeon;
- TC_LOG_DEBUG("lfg", "UpdateEncounterState: Instance {} (instanceId {}) completed encounter {}. Credit Dungeon: {}",
- instance->GetMapName(), instance->GetInstanceId(), encounter.dbcEntry->Name[sWorld->GetDefaultDbcLocale()], dungeonId);
- break;
- }
- }
- }
-
- if (dungeonId)
+ for (auto const& ref : instance->GetPlayers())
{
- Map::PlayerList const& players = instance->GetPlayers();
- for (auto const& ref : players)
+ if (Player* player = ref.GetSource())
{
- if (Player* player = ref.GetSource())
+ if (Group* grp = player->GetGroup())
{
- if (Group* grp = player->GetGroup())
+ if (grp->isLFGGroup())
{
- if (grp->isLFGGroup())
- {
- sLFGMgr->FinishDungeon(grp->GetGUID(), dungeonId, instance);
- return;
- }
+ std::array<uint32, MAX_DUNGEON_ENCOUNTERS_PER_BOSS> dungeonEncounterIds;
+ std::transform(bossInfo->DungeonEncounters.begin(), bossInfo->DungeonEncounters.end(), dungeonEncounterIds.begin(),
+ [](DungeonEncounterEntry const* entry) { return entry->ID; });
+ sLFGMgr->OnDungeonEncounterDone(grp->GetGUID(), dungeonEncounterIds, instance);
+ break;
}
}
}
}
}
-void InstanceScript::UpdateEncounterStateForKilledCreature(uint32 creatureId, Unit* source)
-{
- UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, creatureId, source);
-}
-
-void InstanceScript::UpdateEncounterStateForSpellCast(uint32 spellId, Unit* source)
-{
- UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, spellId, source);
-}
-
void InstanceScript::UpdatePhasing()
{
instance->DoOnPlayers([](Player const* player)
diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h
index 414f53b04d9..d62233768a8 100644
--- a/src/server/game/Instances/InstanceScript.h
+++ b/src/server/game/Instances/InstanceScript.h
@@ -50,7 +50,6 @@ struct InstanceSpawnGroupInfo;
enum class CriteriaType : uint8;
enum class CriteriaStartEvent : uint8;
enum Difficulty : uint8;
-enum EncounterCreditType : uint8;
enum EncounterFrameType
{
@@ -284,10 +283,6 @@ class TC_GAME_API InstanceScript : public ZoneScript
// Checks boss requirements (one boss required to kill other)
virtual bool CheckRequiredBosses(uint32 /*bossId*/, Player const* /*player*/ = nullptr) const { return true; }
- // Checks encounter state at kill/spellcast
- void UpdateEncounterStateForKilledCreature(uint32 creatureId, Unit* source);
- void UpdateEncounterStateForSpellCast(uint32 spellId, Unit* source);
-
bool IsEncounterCompleted(uint32 dungeonEncounterId) const;
bool IsEncounterCompletedInMaskByBossId(uint32 completedEncountersMask, uint32 bossId) const;
@@ -365,7 +360,7 @@ class TC_GAME_API InstanceScript : public ZoneScript
private:
static void LoadObjectData(ObjectData const* creatureData, ObjectInfoMap& objectInfo);
void LoadDungeonEncounterData(uint32 bossId, std::array<uint32, MAX_DUNGEON_ENCOUNTERS_PER_BOSS> const& dungeonEncounterIds);
- void UpdateEncounterState(EncounterCreditType type, uint32 creditEntry, Unit* source);
+ void UpdateLfgEncounterState(BossInfo const* bossInfo);
std::string headers;
std::vector<BossInfo> bosses;
diff --git a/src/server/game/Maps/ZoneScript.h b/src/server/game/Maps/ZoneScript.h
index 46d3e680647..f782d2645c7 100644
--- a/src/server/game/Maps/ZoneScript.h
+++ b/src/server/game/Maps/ZoneScript.h
@@ -60,7 +60,7 @@ class TC_GAME_API ZoneScript
virtual void OnAreaTriggerCreate([[maybe_unused]] AreaTrigger* areaTrigger) { }
virtual void OnAreaTriggerRemove([[maybe_unused]] AreaTrigger* areaTrigger) { }
- virtual void OnUnitDeath(Unit*) { }
+ virtual void OnUnitDeath([[maybe_unused]] Unit* unit) { }
//All-purpose data storage ObjectGuid
virtual ObjectGuid GetGuidData(uint32 /*DataId*/) const { return ObjectGuid::Empty; }
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index e311b19e106..c1838f8058f 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -2117,9 +2117,6 @@ void World::SetInitialWorldSettings()
TC_LOG_INFO("server.loading", "Loading LFG entrance positions..."); // Must be after areatriggers
sLFGMgr->LoadLFGDungeons();
- TC_LOG_INFO("server.loading", "Loading Dungeon boss data...");
- sObjectMgr->LoadInstanceEncounters();
-
TC_LOG_INFO("server.loading", "Loading LFG rewards...");
sLFGMgr->LoadRewards();
diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp
index fc78d8dc93d..5ab5395612f 100644
--- a/src/server/scripts/Commands/cs_go.cpp
+++ b/src/server/scripts/Commands/cs_go.cpp
@@ -520,16 +520,13 @@ public:
if (needles.empty())
return false;
- std::multimap<uint32, CreatureTemplate const*> matches;
+ std::multimap<uint32, CreatureTemplate const*, std::greater<uint32>> matches;
std::unordered_map<uint32, std::vector<CreatureData const*>> spawnLookup;
// find all boss flagged mobs that match our needles
for (auto const& pair : sObjectMgr->GetCreatureTemplates())
{
CreatureTemplate const& data = pair.second;
- if (!(data.flags_extra & CREATURE_FLAG_EXTRA_DUNGEON_BOSS))
- continue;
-
uint32 count = 0;
std::string const& scriptName = sObjectMgr->GetScriptName(data.ScriptID);
for (std::string_view label : needles)
@@ -539,7 +536,7 @@ public:
if (count)
{
matches.emplace(count, &data);
- (void)spawnLookup[data.Entry]; // inserts default-constructed vector
+ spawnLookup.try_emplace(data.Entry); // inserts default-constructed vector
}
}
@@ -567,7 +564,7 @@ public:
}
// see if we have multiple equal matches left
- auto it = matches.crbegin(), end = matches.crend();
+ auto it = matches.cbegin(), end = matches.cend();
uint32 const maxCount = it->first;
if ((++it) != end && it->first == maxCount)
{
@@ -580,7 +577,7 @@ public:
return false;
}
- CreatureTemplate const* const boss = matches.crbegin()->second;
+ CreatureTemplate const* const boss = matches.cbegin()->second;
std::vector<CreatureData const*> const& spawns = spawnLookup[boss->Entry];
ASSERT(!spawns.empty());
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
index ecf63179523..23ae53ad34f 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/BlackrockDepths/blackrock_depths.cpp
@@ -228,7 +228,6 @@ public:
Event_Timer = 5000;
break;
case 5:
- instance->UpdateEncounterStateForKilledCreature(NPC_GRIMSTONE, me);
instance->SetData(TYPE_RING_OF_LAW, DONE);
TC_LOG_DEBUG("scripts", "npc_grimstone: event reached end and set complete.");
break;
diff --git a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp
index 5315cb727e1..fe41d2608ca 100644
--- a/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp
+++ b/src/server/scripts/EasternKingdoms/BlackrockMountain/MoltenCore/boss_majordomo_executus.cpp
@@ -103,7 +103,6 @@ struct boss_majordomo : public BossAI
if (!me->FindNearestCreature(NPC_FLAMEWAKER_HEALER, 100.0f) && !me->FindNearestCreature(NPC_FLAMEWAKER_ELITE, 100.0f))
{
- instance->UpdateEncounterStateForKilledCreature(me->GetEntry(), me);
me->SetFaction(FACTION_FRIENDLY);
EnterEvadeMode();
Talk(SAY_DEFEAT);
diff --git a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp
index 7690575d1da..4995eb48c02 100644
--- a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp
+++ b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp
@@ -184,7 +184,6 @@ public:
HandleGameObject(StageDoorRightGUID, true);
if (GameObject* sideEntrance = instance->GetGameObject(SideEntranceDoor))
sideEntrance->RemoveFlag(GO_FLAG_LOCKED);
- UpdateEncounterStateForKilledCreature(16812, nullptr);
}
break;
case DATA_CHESS:
diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
index 7568ef2d8e3..933114916cf 100644
--- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
+++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp
@@ -333,14 +333,6 @@ class instance_violet_hold : public InstanceMapScript
switch (type)
{
- case DATA_1ST_BOSS:
- if (state == DONE)
- UpdateEncounterStateForKilledCreature(NPC_EREKEM, nullptr);
- break;
- case DATA_2ND_BOSS:
- if (state == DONE)
- UpdateEncounterStateForKilledCreature(NPC_MORAGG, nullptr);
- break;
case DATA_CYANIGOSA:
if (state == DONE)
SetData(DATA_MAIN_EVENT_STATE, DONE);
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 273be7a68bb..fb16c4a9581 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -31,7 +31,6 @@
#include "DB2Stores.h"
#include "GameTime.h"
#include "GridNotifiersImpl.h"
-#include "InstanceScript.h"
#include "Item.h"
#include "Log.h"
#include "MotionMaster.h"
@@ -1416,33 +1415,6 @@ class spell_gen_ds_flush_knockback : public SpellScript
}
};
-class spell_gen_dungeon_credit : public SpellScript
-{
- bool Load() override
- {
- return GetCaster()->GetTypeId() == TYPEID_UNIT;
- }
-
- void CreditEncounter()
- {
- // This hook is executed for every target, make sure we only credit instance once
- if (_handled)
- return;
-
- _handled = true;
- Unit* caster = GetCaster();
- if (InstanceScript* instance = caster->GetInstanceScript())
- instance->UpdateEncounterStateForSpellCast(GetSpellInfo()->Id, caster);
- }
-
- void Register() override
- {
- AfterHit += SpellHitFn(spell_gen_dungeon_credit::CreditEncounter);
- }
-
- bool _handled = false;
-};
-
// 50051 - Ethereal Pet Aura
enum EtherealPet
{
@@ -5396,7 +5368,6 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_despawn_target);
RegisterSpellScript(spell_gen_divine_storm_cd_reset);
RegisterSpellScript(spell_gen_ds_flush_knockback);
- RegisterSpellScript(spell_gen_dungeon_credit);
RegisterSpellScript(spell_ethereal_pet_aura);
RegisterSpellScript(spell_ethereal_pet_onsummon);
RegisterSpellScript(spell_ethereal_pet_aura_remove);