fix(Script/Quest): Conversing With the Depths adjustments & zone_dragonblight move to db from hardcode (#11795)

* Update zone_dragonblight.cpp

* Update zone_dragonblight.cpp
This commit is contained in:
avarishd
2022-05-22 00:29:28 +03:00
committed by GitHub
parent ee596047d9
commit 634b2e101c

View File

@@ -15,16 +15,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* ScriptData
SDName: Dragonblight
SD%Complete: 100
SDComment:
SDCategory: Dragonblight
EndScriptData */
/* ContentData
EndContentData */
#include "CellImpl.h" #include "CellImpl.h"
#include "Chat.h" #include "Chat.h"
#include "CombatAI.h" #include "CombatAI.h"
@@ -43,19 +33,33 @@ EndContentData */
/******** /********
QUEST Conversing With the Depths (12032) QUEST Conversing With the Depths (12032)
********/ ********/
#define QUEST_CONVERSING_WITH_THE_DEPTHS 12032
#define DEEPDIVING_PEARL_BUFF 41273 enum DepthsMisc
#define NPC_OACHANOA 26648 {
#define NPC_CONVERSING_WITH_THE_DEPTHS_TRIGGER 70100 QUEST_CONVERSING_WITH_THE_DEPTHS = 12032,
#define OACHANOA_T_1_1 "Little " DEEPDIVING_PEARL_BUFF = 41273,
#define OACHANOA_T_1_2 ", why do you call me forth? Are you working with the trolls of this land? Have you come to kill me and take my power as your own?" NPC_OACHANOA = 26648,
#define OACHANOA_T_2 "I sense uncertainty in you, and I do not trust it whether you are with them, or not. If you wish my augury for the Kalu'ak, you will have to prove yourself first." NPC_CONVERSING_WITH_THE_DEPTHS_TRIGGER = 70100,
#define OACHANOA_T_3 "I will lay a mild compulsion upon you. Jump into the depths before me so that you put yourself into my element and thereby display your submission." };
#define OACHANOA_T_4_1 "Well done, "
#define OACHANOA_T_4_2 ". Your display of respect is duly noted. Now, I have information for you that you must convey to the Kalu'ak." enum DepthsTexts
#define OACHANOA_T_5 "Simply put, you must tell the tuskarr that they cannot run. If they do so, their spirits will be destroyed by the evil rising within Northrend." {
#define OACHANOA_T_6 "Tell the mystic that his people are to stand and fight alongside the Horde and Alliance against the forces of Malygos and the Lich King." // Oacha'noa being summoned
#define OACHANOA_T_7_1 "Now swim back with the knowledge I have granted you. Do what you can for them " SAY_OACHANOA_SUMMONED_0 = 0,
SAY_OACHANOA_SUMMONED_1 = 1,
SAY_OACHANOA_SUMMONED_2 = 2,
SAY_OACHANOA_SUMMONED_3 = 3,
//SAY_OACHANOA_SUMMONED_4 = 4, // Unused(no source) and no BroadcastTextId
// If success
SAY_OACHANOA_SUCCESS = 5,
WHISPER_OACHANOA_SUCCESS_0 = 6,
WHISPER_OACHANOA_SUCCESS_1 = 7,
WHISPER_OACHANOA_SUCCESS_2 = 8,
// If failed
SAY_OACHANOA_FAILED = 9,
};
class npc_conversing_with_the_depths_trigger : public CreatureScript class npc_conversing_with_the_depths_trigger : public CreatureScript
{ {
@@ -73,15 +77,20 @@ public:
bool running; bool running;
bool secondpart; bool secondpart;
bool canjump;
int32 timer; int32 timer;
uint8 step; uint8 step;
ObjectGuid pGUID; ObjectGuid pGUID;
ObjectGuid oachanoaGUID; ObjectGuid oachanoaGUID;
Creature* GetOachanoa() {return ObjectAccessor::GetCreature(*me, oachanoaGUID);}
Player* GetPlayer() {return ObjectAccessor::GetPlayer(*me, pGUID);}
void Reset() override void Reset() override
{ {
running = false; running = false;
secondpart = false; secondpart = false;
canjump = false;
timer = 0; timer = 0;
step = 0; step = 0;
pGUID.Clear(); pGUID.Clear();
@@ -94,63 +103,48 @@ public:
timer = time; timer = time;
} }
void Say(std::string text, bool yell)
{
Creature* c = ObjectAccessor::GetCreature(*me, oachanoaGUID);
Player* player = ObjectAccessor::GetPlayer(*me, pGUID);
if (!c || !player)
{
Reset();
return;
}
if (yell)
c->Yell(text.c_str(), LANG_UNIVERSAL, player);
else
c->Whisper(text.c_str(), LANG_UNIVERSAL, player);
}
void DespawnOachanoa() void DespawnOachanoa()
{ {
if (Creature* c = ObjectAccessor::GetCreature(*me, oachanoaGUID)) if (Creature* c = GetOachanoa())
c->DespawnOrUnsummon(); c->DespawnOrUnsummon();
} }
void UpdateAI(uint32 diff) override void UpdateAI(uint32 diff) override
{ {
if( running ) if (running)
{ {
if( Player* p = ObjectAccessor::GetPlayer(*me, pGUID) ) if (Player* p = GetPlayer())
if( p->GetPositionZ() < 1.0f && !secondpart ) if (p->GetPositionZ() < 1.0f && !secondpart) // Player is in the water
{ {
if( p->HasAura(DEEPDIVING_PEARL_BUFF) ) if (p->HasAura(DEEPDIVING_PEARL_BUFF) && canjump)
{ {
NextStep(500); NextStep(500);
secondpart = true; secondpart = true;
} }
else else // Despawn and fail quest if player jumps too early
{ {
p->SendQuestFailed(QUEST_CONVERSING_WITH_THE_DEPTHS);
DespawnOachanoa(); DespawnOachanoa();
Reset(); Reset();
} }
} }
if( timer != 0 ) if (timer != 0)
{ {
timer -= diff; timer -= diff;
if( timer < 0 ) if (timer < 0)
timer = 0; timer = 0;
} }
else else
switch( step ) switch (step)
{ {
case 0: case 0:
NextStep(10000); NextStep(10000);
break; break;
case 1: case 1: // Oacha'noa being summoned
{ {
Creature* c = me->SummonCreature(NPC_OACHANOA, 2406.24f, 1701.98f, 0.1f, 0.3f, TEMPSUMMON_TIMED_DESPAWN, 90000, 0); Creature* c = me->SummonCreature(NPC_OACHANOA, 2406.24f, 1701.98f, 0.1f, 0.3f, TEMPSUMMON_TIMED_DESPAWN, 90000, 0);
if( !c ) if (!c)
{ {
Reset(); Reset();
return; return;
@@ -158,85 +152,111 @@ public:
c->SetCanFly(true); c->SetCanFly(true);
c->GetMotionMaster()->MovePoint(0, 2406.25f, 1701.98f, 0.1f); c->GetMotionMaster()->MovePoint(0, 2406.25f, 1701.98f, 0.1f);
oachanoaGUID = c->GetGUID(); oachanoaGUID = c->GetGUID();
NextStep(3000); NextStep(3000);
break; break;
} }
case 2: case 2:
{ {
Player* p = ObjectAccessor::GetPlayer(*me, pGUID); Player* p = GetPlayer();
if( !p ) if (!p)
{ {
Reset(); Reset();
return; return;
} }
std::string text = (OACHANOA_T_1_1 + p->GetName() + OACHANOA_T_1_2); if (Creature* c = GetOachanoa())
Say(text, true); c->AI()->Talk(SAY_OACHANOA_SUMMONED_0, p);
NextStep(6000); NextStep(6000);
break; break;
} }
case 3: case 3:
Say(OACHANOA_T_2, true); {
NextStep(6000); if (Creature* c = GetOachanoa())
break; c->AI()->Talk(SAY_OACHANOA_SUMMONED_1);
NextStep(6000);
break;
}
case 4: case 4:
{ {
Say(OACHANOA_T_3, true); if (Creature* c = GetOachanoa())
Player* p = ObjectAccessor::GetPlayer(*me, pGUID); c->AI()->Talk(SAY_OACHANOA_SUMMONED_2);
if( !p ) Player* p = GetPlayer();
if (!p)
{ {
Reset(); Reset();
return; return;
} }
p->CastSpell(p, DEEPDIVING_PEARL_BUFF, true); p->CastSpell(p, DEEPDIVING_PEARL_BUFF, true);
NextStep(30000);
break;
}
case 5:
DespawnOachanoa();
Reset();
break;
case 6:
{
Player* p = ObjectAccessor::GetPlayer(*me, pGUID);
if( !p )
{
Reset();
return;
}
std::string text = (OACHANOA_T_4_1 + p->GetName() + OACHANOA_T_4_2);
Say(text, true);
NextStep(6000); NextStep(6000);
break; break;
} }
case 7: case 5: // 20s countdown starts, the player can jump now
Say(OACHANOA_T_5, false); {
NextStep(6000); canjump = true;
break; if (Creature* c = GetOachanoa())
c->AI()->Talk(SAY_OACHANOA_SUMMONED_3);
NextStep(20500);
break;
}
case 6: // If failed (player DOESN'T jump within 20 seconds)
{
Player* p = GetPlayer();
if (Creature* c = GetOachanoa())
c->AI()->Talk(SAY_OACHANOA_FAILED, p);
DespawnOachanoa();
Reset();
break;
}
case 7: // If success (player jumps)
{
Player* p = GetPlayer();
if (!p)
{
Reset();
return;
}
if (Creature* c = GetOachanoa())
c->AI()->Talk(SAY_OACHANOA_SUCCESS, p);
NextStep(6000);
break;
}
case 8: case 8:
Say(OACHANOA_T_6, false); {
NextStep(6000); Player* p = GetPlayer();
break; if (Creature* c = GetOachanoa())
c->AI()->Talk(WHISPER_OACHANOA_SUCCESS_0, p);
NextStep(6000);
break;
}
case 9: case 9:
{ {
Player* p = ObjectAccessor::GetPlayer(*me, pGUID); Player* p = GetPlayer();
if( !p ) if (Creature* c = GetOachanoa())
{ c->AI()->Talk(WHISPER_OACHANOA_SUCCESS_1, p);
Reset();
return; NextStep(6000);
} break;
const char* name_races[RACE_DRAENEI] = {"human", "orc", "dwarf", "nightelf", "undead", "tauren", "gnome", "troll", "", "bloodelf", "draenei"}; }
if( p->getRace() > 11 ) case 10:
{
Player* p = GetPlayer();
if (!p)
{ {
Reset(); Reset();
return; return;
} }
std::string text = (OACHANOA_T_7_1 + std::string(name_races[p->getRace() - 1])); if (Creature* c = GetOachanoa())
Say(text, true); c->AI()->Talk(WHISPER_OACHANOA_SUCCESS_2, p);
p->AreaExploredOrEventHappens(12032); p->AreaExploredOrEventHappens(QUEST_CONVERSING_WITH_THE_DEPTHS);
DespawnOachanoa(); DespawnOachanoa();
Reset(); Reset();