DB/Quest: Move Priest Garments quest series from c++ to database (#30627)

Co-authored-by: Jonne733 <40151102+Jonne733@users.noreply.github.com>
This commit is contained in:
CraftedRO
2025-02-02 21:21:44 +02:00
committed by GitHub
parent 8268ab34b7
commit 7782a17bc2
2 changed files with 215 additions and 170 deletions

View File

@@ -912,175 +912,6 @@ void npc_doctor::npc_doctorAI::UpdateAI(uint32 diff)
}
}
/*######
## npc_garments_of_quests
######*/
/// @todo get text for each NPC
enum Garments
{
SPELL_LESSER_HEAL_R2 = 2052,
SPELL_FORTITUDE_R1 = 1243,
QUEST_MOON = 5621,
QUEST_LIGHT_1 = 5624,
QUEST_LIGHT_2 = 5625,
QUEST_SPIRIT = 5648,
QUEST_DARKNESS = 5650,
ENTRY_SHAYA = 12429,
ENTRY_ROBERTS = 12423,
ENTRY_DOLF = 12427,
ENTRY_KORJA = 12430,
ENTRY_DG_KEL = 12428,
// used by 12429, 12423, 12427, 12430, 12428, but signed for 12429
SAY_THANKS = 0,
SAY_GOODBYE = 1,
SAY_HEALED = 2,
};
class npc_garments_of_quests : public CreatureScript
{
public:
npc_garments_of_quests() : CreatureScript("npc_garments_of_quests") { }
struct npc_garments_of_questsAI : public EscortAI
{
npc_garments_of_questsAI(Creature* creature) : EscortAI(creature)
{
switch (me->GetEntry())
{
case ENTRY_SHAYA:
quest = QUEST_MOON;
break;
case ENTRY_ROBERTS:
quest = QUEST_LIGHT_1;
break;
case ENTRY_DOLF:
quest = QUEST_LIGHT_2;
break;
case ENTRY_KORJA:
quest = QUEST_SPIRIT;
break;
case ENTRY_DG_KEL:
quest = QUEST_DARKNESS;
break;
default:
quest = 0;
break;
}
Initialize();
}
void Initialize()
{
IsHealed = false;
CanRun = false;
RunAwayTimer = 5000;
}
ObjectGuid CasterGUID;
bool IsHealed;
bool CanRun;
uint32 RunAwayTimer;
uint32 quest;
void Reset() override
{
CasterGUID.Clear();
Initialize();
me->SetStandState(UNIT_STAND_STATE_KNEEL);
// expect database to have RegenHealth=0
me->SetHealth(me->CountPctFromMaxHealth(70));
}
void JustEngagedWith(Unit* /*who*/) override { }
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_LESSER_HEAL_R2 || spellInfo->Id == SPELL_FORTITUDE_R1)
{
//not while in combat
if (me->IsInCombat())
return;
//nothing to be done now
if (IsHealed && CanRun)
return;
if (Player* player = caster->ToPlayer())
{
if (quest && player->GetQuestStatus(quest) == QUEST_STATUS_INCOMPLETE)
{
if (IsHealed && !CanRun && spellInfo->Id == SPELL_FORTITUDE_R1)
{
Talk(SAY_THANKS, player);
CanRun = true;
}
else if (!IsHealed && spellInfo->Id == SPELL_LESSER_HEAL_R2)
{
CasterGUID = player->GetGUID();
me->SetStandState(UNIT_STAND_STATE_STAND);
Talk(SAY_HEALED, player);
IsHealed = true;
}
}
// give quest credit, not expect any special quest objectives
if (CanRun)
player->TalkedToCreature(me->GetEntry(), me->GetGUID());
}
}
}
void UpdateAI(uint32 diff) override
{
if (CanRun && !me->IsInCombat())
{
if (RunAwayTimer <= diff)
{
if (Unit* unit = ObjectAccessor::GetUnit(*me, CasterGUID))
{
switch (me->GetEntry())
{
case ENTRY_SHAYA:
case ENTRY_ROBERTS:
case ENTRY_DOLF:
case ENTRY_KORJA:
case ENTRY_DG_KEL:
Talk(SAY_GOODBYE, unit);
break;
}
Start(false, true);
}
else
EnterEvadeMode(); //something went wrong
RunAwayTimer = 30000;
}
else
RunAwayTimer -= diff;
}
EscortAI::UpdateAI(diff);
}
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_garments_of_questsAI(creature);
}
};
/*######
## npc_guardian
######*/
@@ -2456,7 +2287,6 @@ void AddSC_npcs_special()
new npc_midsummer_bunny_pole();
new npc_doctor();
new npc_injured_patient();
new npc_garments_of_quests();
new npc_guardian();
new npc_steam_tonk();
new npc_tournament_mount();