mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-21 20:56:23 +00:00
fix(Scripts/AhnKahet): fix Jedoga Shadowseeker's ritual not starting (#23921)
This commit is contained in:
@@ -15,12 +15,13 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptedCreature.h"
|
||||
#include "Cell.h"
|
||||
#include "CellImpl.h"
|
||||
#include "Containers.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "Spell.h"
|
||||
#include "TemporarySummon.h"
|
||||
|
||||
@@ -141,6 +142,23 @@ Creature* SummonList::GetCreatureWithEntry(uint32 entry) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Creature* SummonList::GetRandomCreatureWithEntry(uint32 entry) const
|
||||
{
|
||||
std::vector<ObjectGuid> candidates;
|
||||
candidates.reserve(storage_.size());
|
||||
|
||||
for (auto const guid : storage_)
|
||||
if (Creature* summon = ObjectAccessor::GetCreature(*me, guid))
|
||||
if (summon->GetEntry() == entry)
|
||||
candidates.push_back(guid);
|
||||
|
||||
if (candidates.empty())
|
||||
return nullptr;
|
||||
|
||||
ObjectGuid randomGuid = Acore::Containers::SelectRandomContainerElement(candidates);
|
||||
return ObjectAccessor::GetCreature(*me, randomGuid);
|
||||
}
|
||||
|
||||
bool SummonList::IsAnyCreatureAlive() const
|
||||
{
|
||||
for (auto const& guid : storage_)
|
||||
|
||||
@@ -157,6 +157,7 @@ public:
|
||||
uint32 GetEntryCount(uint32 entry) const;
|
||||
void Respawn();
|
||||
Creature* GetCreatureWithEntry(uint32 entry) const;
|
||||
Creature* GetRandomCreatureWithEntry(uint32 entry) const;
|
||||
|
||||
private:
|
||||
Creature* me;
|
||||
|
||||
Reference in New Issue
Block a user