Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Scripts/BlackTemple): Implement emotes when opening Najentus and … #19946

Merged
merged 2 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions data/sql/updates/pending_db_world/rev_1726132179936077700.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--
UPDATE `creature_text` SET `TextRange` = 3 WHERE `CreatureId` = 22984;
18 changes: 18 additions & 0 deletions src/server/game/Instances/InstanceScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,24 @@ void InstanceScript::LoadInstanceSavedGameobjectStateData()
}
}

bool InstanceScript::AllBossesDone() const
{
for (auto const& boss : bosses)
if (boss.state != DONE)
return false;

return true;
}

bool InstanceScript::AllBossesDone(std::initializer_list<uint32> bossIds) const
{
for (auto const& bossId : bossIds)
if (!IsBossDone(bossId))
return false;

return true;
}

std::string InstanceScript::GetBossStateName(uint8 state)
{
// See enum EncounterState in InstanceScript.h
Expand Down
4 changes: 4 additions & 0 deletions src/server/game/Instances/InstanceScript.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ class InstanceScript : public ZoneScript

void LoadInstanceSavedGameobjectStateData();

[[nodiscard]] bool IsBossDone(uint32 bossId) const { return GetBossState(bossId) == DONE; };
[[nodiscard]] bool AllBossesDone() const;
[[nodiscard]] bool AllBossesDone(std::initializer_list<uint32> bossIds) const;

TaskScheduler scheduler;
protected:
void SetHeaders(std::string const& dataHeaders);
Expand Down
12 changes: 10 additions & 2 deletions src/server/scripts/Outland/BlackTemple/black_temple.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ enum DataTypes
DATA_GATHIOS_THE_SHATTERER = 12,
DATA_HIGH_NETHERMANCER_ZEREVOR = 13,
DATA_LADY_MALANDE = 14,
DATA_VERAS_DARKSHADOW = 15
DATA_VERAS_DARKSHADOW = 15,
DATA_BLACK_TEMPLE_TRIGGER = 16
};

enum CreatureIds
Expand Down Expand Up @@ -82,7 +83,8 @@ enum CreatureIds
NPC_ASHTONGUE_STALKER = 23374,
NPC_STORM_FURY = 22848,

NPC_DRAGON_TURTLE = 22885
NPC_DRAGON_TURTLE = 22885,
NPC_BLACK_TEMPLE_TRIGGER = 22984
};

enum GameObjectIds
Expand Down Expand Up @@ -113,6 +115,12 @@ enum MiscIds
SPELL_SUMMON_SHADOWFIENDS = 41159
};

enum Texts
{
EMOTE_NAJENTUS_DEFEATED = 0,
EMOTE_LOWER_TEMPLE_DEFEATED = 1
};

template <class AI, class T>
inline AI* GetBlackTempleAI(T* obj)
{
Expand Down
34 changes: 24 additions & 10 deletions src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ ObjectData const creatureData[] =
{ NPC_VERAS_DARKSHADOW, DATA_VERAS_DARKSHADOW },
{ NPC_AKAMA_ILLIDAN, DATA_AKAMA_ILLIDAN },
{ NPC_ILLIDAN_STORMRAGE, DATA_ILLIDAN_STORMRAGE },
{ NPC_BLACK_TEMPLE_TRIGGER, DATA_BLACK_TEMPLE_TRIGGER },
{ 0, 0 }
};

Expand Down Expand Up @@ -165,18 +166,31 @@ class instance_black_temple : public InstanceMapScript
if (!InstanceScript::SetBossState(type, state))
return false;

if (type == DATA_SHADE_OF_AKAMA && state == DONE)
if (state == DONE)
{
for (ObjectGuid const& guid : ashtongueGUIDs)
if (Creature* ashtongue = instance->GetCreature(guid))
ashtongue->SetFaction(FACTION_ASHTONGUE_DEATHSWORN);
}
else if (type == DATA_ILLIDARI_COUNCIL && state == DONE)
{
if (Creature* akama = GetCreature(DATA_AKAMA_ILLIDAN))
akama->AI()->DoAction(0);
}
switch (type)
{
case DATA_HIGH_WARLORD_NAJENTUS:
if (Creature* trigger = GetCreature(DATA_BLACK_TEMPLE_TRIGGER))
trigger->AI()->Talk(EMOTE_NAJENTUS_DEFEATED);
break;
case DATA_SHADE_OF_AKAMA:
for (ObjectGuid const& guid : ashtongueGUIDs)
if (Creature* ashtongue = instance->GetCreature(guid))
ashtongue->SetFaction(FACTION_ASHTONGUE_DEATHSWORN);
break;
case DATA_ILLIDARI_COUNCIL:
if (Creature* akama = GetCreature(DATA_AKAMA_ILLIDAN))
akama->AI()->DoAction(0);
break;
default:
break;
}

if (AllBossesDone({ DATA_SHADE_OF_AKAMA, DATA_TERON_GOREFIEND, DATA_GURTOGG_BLOODBOIL, DATA_RELIQUARY_OF_SOULS }))
if (Creature* trigger = GetCreature(DATA_BLACK_TEMPLE_TRIGGER))
trigger->AI()->Talk(EMOTE_LOWER_TEMPLE_DEFEATED);
}
return true;
}

Expand Down
Loading