mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +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/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ScriptedCreature.h"
|
|
||||||
#include "Cell.h"
|
#include "Cell.h"
|
||||||
#include "CellImpl.h"
|
#include "CellImpl.h"
|
||||||
|
#include "Containers.h"
|
||||||
#include "GameTime.h"
|
#include "GameTime.h"
|
||||||
#include "GridNotifiers.h"
|
#include "GridNotifiers.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
|
#include "ScriptedCreature.h"
|
||||||
#include "Spell.h"
|
#include "Spell.h"
|
||||||
#include "TemporarySummon.h"
|
#include "TemporarySummon.h"
|
||||||
|
|
||||||
@@ -141,6 +142,23 @@ Creature* SummonList::GetCreatureWithEntry(uint32 entry) const
|
|||||||
return nullptr;
|
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
|
bool SummonList::IsAnyCreatureAlive() const
|
||||||
{
|
{
|
||||||
for (auto const& guid : storage_)
|
for (auto const& guid : storage_)
|
||||||
|
|||||||
@@ -157,6 +157,7 @@ public:
|
|||||||
uint32 GetEntryCount(uint32 entry) const;
|
uint32 GetEntryCount(uint32 entry) const;
|
||||||
void Respawn();
|
void Respawn();
|
||||||
Creature* GetCreatureWithEntry(uint32 entry) const;
|
Creature* GetCreatureWithEntry(uint32 entry) const;
|
||||||
|
Creature* GetRandomCreatureWithEntry(uint32 entry) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Creature* me;
|
Creature* me;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "AchievementCriteriaScript.h"
|
#include "AchievementCriteriaScript.h"
|
||||||
#include "Containers.h"
|
|
||||||
#include "CreatureScript.h"
|
#include "CreatureScript.h"
|
||||||
#include "ObjectAccessor.h"
|
#include "ObjectAccessor.h"
|
||||||
#include "ScriptedCreature.h"
|
#include "ScriptedCreature.h"
|
||||||
@@ -209,7 +208,7 @@ struct boss_jedoga_shadowseeker : public BossAI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sacraficeTarget_GUID.Clear();
|
sacrificeTargetGUID.Clear();
|
||||||
sayPreachTimer = 120000;
|
sayPreachTimer = 120000;
|
||||||
ritualTriggered = false;
|
ritualTriggered = false;
|
||||||
volunteerWork = true;
|
volunteerWork = true;
|
||||||
@@ -268,12 +267,12 @@ struct boss_jedoga_shadowseeker : public BossAI
|
|||||||
}
|
}
|
||||||
case NPC_TWILIGHT_VOLUNTEER:
|
case NPC_TWILIGHT_VOLUNTEER:
|
||||||
{
|
{
|
||||||
if (sacraficeTarget_GUID && summon->GetGUID() != sacraficeTarget_GUID)
|
if (sacrificeTargetGUID && summon->GetGUID() != sacrificeTargetGUID)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (killer != me && killer->GetGUID() != sacraficeTarget_GUID)
|
if (killer != me && killer->GetGUID() != sacrificeTargetGUID)
|
||||||
{
|
{
|
||||||
volunteerWork = false;
|
volunteerWork = false;
|
||||||
}
|
}
|
||||||
@@ -315,7 +314,7 @@ struct boss_jedoga_shadowseeker : public BossAI
|
|||||||
{
|
{
|
||||||
if (action == ACTION_SACRAFICE)
|
if (action == ACTION_SACRAFICE)
|
||||||
{
|
{
|
||||||
if (Creature* target = ObjectAccessor::GetCreature(*me, sacraficeTarget_GUID))
|
if (Creature* target = ObjectAccessor::GetCreature(*me, sacrificeTargetGUID))
|
||||||
{
|
{
|
||||||
Unit::Kill(me, target);
|
Unit::Kill(me, target);
|
||||||
}
|
}
|
||||||
@@ -395,9 +394,9 @@ struct boss_jedoga_shadowseeker : public BossAI
|
|||||||
me->SetFacingTo(5.66f);
|
me->SetFacingTo(5.66f);
|
||||||
if (!summons.empty())
|
if (!summons.empty())
|
||||||
{
|
{
|
||||||
sacraficeTarget_GUID = Acore::Containers::SelectRandomContainerElement(summons);
|
if (Creature* creature = summons.GetRandomCreatureWithEntry(NPC_TWILIGHT_VOLUNTEER))
|
||||||
if (ObjectAccessor::GetCreature(*me, sacraficeTarget_GUID))
|
|
||||||
{
|
{
|
||||||
|
sacrificeTargetGUID = creature->GetGUID();
|
||||||
events.ScheduleEvent(EVENT_JEDGA_START_RITUAL, 3s, 0, PHASE_RITUAL);
|
events.ScheduleEvent(EVENT_JEDGA_START_RITUAL, 3s, 0, PHASE_RITUAL);
|
||||||
}
|
}
|
||||||
// Something failed, let players continue but do not grant achievement
|
// Something failed, let players continue but do not grant achievement
|
||||||
@@ -518,15 +517,16 @@ struct boss_jedoga_shadowseeker : public BossAI
|
|||||||
}
|
}
|
||||||
case EVENT_JEDGA_START_RITUAL:
|
case EVENT_JEDGA_START_RITUAL:
|
||||||
{
|
{
|
||||||
sacraficeTarget_GUID = Acore::Containers::SelectRandomContainerElement(summons);
|
if (Creature* creature = summons.GetRandomCreatureWithEntry(NPC_TWILIGHT_VOLUNTEER))
|
||||||
if (Creature* volunteer = ObjectAccessor::GetCreature(*me, sacraficeTarget_GUID))
|
|
||||||
{
|
{
|
||||||
|
sacrificeTargetGUID = creature->GetGUID();
|
||||||
Talk(SAY_SACRIFICE_1);
|
Talk(SAY_SACRIFICE_1);
|
||||||
sacraficeTarget_GUID = volunteer->GetGUID();
|
creature->AI()->DoAction(ACTION_RITUAL_BEGIN);
|
||||||
volunteer->AI()->DoAction(ACTION_RITUAL_BEGIN);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -546,7 +546,7 @@ struct boss_jedoga_shadowseeker : public BossAI
|
|||||||
private:
|
private:
|
||||||
GuidList oocSummons;
|
GuidList oocSummons;
|
||||||
GuidList oocTriggers;
|
GuidList oocTriggers;
|
||||||
ObjectGuid sacraficeTarget_GUID;
|
ObjectGuid sacrificeTargetGUID;
|
||||||
uint32 sayPreachTimer;
|
uint32 sayPreachTimer;
|
||||||
bool combatSummonsSummoned;
|
bool combatSummonsSummoned;
|
||||||
bool ritualTriggered;
|
bool ritualTriggered;
|
||||||
|
|||||||
Reference in New Issue
Block a user