mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 18:10:26 +00:00
fix(Scripts/MoltenCore): Solve edge case that caused Majordomo to spawn double adds (#10076)
* fix(Scripts/MoltenCore): Remove minions from Majordomo's spawn list if they still exist * fix domo for good
This commit is contained in:
@@ -127,6 +127,7 @@ struct MajordomoAddData
|
||||
uint32 creatureEntry;
|
||||
Position spawnPos;
|
||||
|
||||
MajordomoAddData() { }
|
||||
MajordomoAddData(ObjectGuid _guid, uint32 _creatureEntry, Position _spawnPos) : guid(_guid), creatureEntry(_creatureEntry), spawnPos(_spawnPos) { }
|
||||
};
|
||||
|
||||
@@ -172,7 +173,7 @@ public:
|
||||
if (summon)
|
||||
{
|
||||
static_minionsGUIDS.insert(summon->GetGUID());
|
||||
majordomoSummonsData.push_back(MajordomoAddData(summon->GetGUID(), summon->GetEntry(), summon->GetPosition()));
|
||||
majordomoSummonsData[summon->GetGUID().GetCounter()] = MajordomoAddData(summon->GetGUID(), summon->GetEntry(), summon->GetPosition());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -197,18 +198,19 @@ public:
|
||||
events.SetPhase(PHASE_COMBAT);
|
||||
instance->SetBossState(DATA_MAJORDOMO_EXECUTUS, NOT_STARTED);
|
||||
|
||||
for (auto summon : majordomoSummonsData)
|
||||
for (auto const& summon : majordomoSummonsData)
|
||||
{
|
||||
if (ObjectAccessor::GetCreature(*me, summon.guid))
|
||||
if (ObjectAccessor::GetCreature(*me, summon.second.guid))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Creature* spawn = me->SummonCreature(summon.creatureEntry, summon.spawnPos))
|
||||
if (Creature* spawn = me->SummonCreature(summon.second.creatureEntry, summon.second.spawnPos))
|
||||
{
|
||||
static_minionsGUIDS.erase(summon.guid); // Erase the guid from the previous, no longer existing, spawn.
|
||||
static_minionsGUIDS.erase(summon.second.guid); // Erase the guid from the previous, no longer existing, spawn.
|
||||
static_minionsGUIDS.insert(spawn->GetGUID());
|
||||
summon.guid = spawn->GetGUID();
|
||||
majordomoSummonsData.erase(summon.second.guid.GetCounter());
|
||||
majordomoSummonsData[spawn->GetGUID().GetCounter()] = MajordomoAddData(spawn->GetGUID(), spawn->GetEntry(), spawn->GetPosition());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -521,7 +523,7 @@ public:
|
||||
private:
|
||||
GuidSet static_minionsGUIDS; // contained data should be changed on encounter completion
|
||||
GuidSet aliveMinionsGUIDS; // used for calculations
|
||||
std::list<MajordomoAddData> majordomoSummonsData;
|
||||
std::unordered_map<uint32, MajordomoAddData> majordomoSummonsData;
|
||||
};
|
||||
|
||||
bool OnGossipHello(Player* player, Creature* creature) override
|
||||
|
||||
Reference in New Issue
Block a user