DB/Quest: Convert & update support for 'A Slow Death' to SAI

Closes #25399

Based on dr-j's script

(cherry picked from commit 29b39ae606)
This commit is contained in:
offl
2020-09-12 22:20:19 +03:00
committed by Shauren
parent 7090fe5c18
commit 2b515f97a6
2 changed files with 64 additions and 92 deletions

View File

@@ -465,97 +465,6 @@ public:
}
};
/*#####
# npc_dragonmaw_peon
#####*/
class npc_dragonmaw_peon : public CreatureScript
{
public:
npc_dragonmaw_peon() : CreatureScript("npc_dragonmaw_peon") { }
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_dragonmaw_peonAI(creature);
}
struct npc_dragonmaw_peonAI : public ScriptedAI
{
npc_dragonmaw_peonAI(Creature* creature) : ScriptedAI(creature)
{
Initialize();
}
void Initialize()
{
PlayerGUID.Clear();
Tapped = false;
PoisonTimer = 0;
}
ObjectGuid PlayerGUID;
bool Tapped;
uint32 PoisonTimer;
void Reset() override
{
Initialize();
}
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (!caster)
return;
if (caster->GetTypeId() == TYPEID_PLAYER && spellInfo->Id == 40468 && !Tapped)
{
PlayerGUID = caster->GetGUID();
Tapped = true;
float x, y, z;
caster->GetClosePoint(x, y, z, me->GetCombatReach());
me->SetWalk(false);
me->GetMotionMaster()->MovePoint(1, x, y, z);
}
}
void MovementInform(uint32 type, uint32 id) override
{
if (type != POINT_MOTION_TYPE)
return;
if (id)
{
me->SetEmoteState(EMOTE_ONESHOT_EAT);
PoisonTimer = 15000;
}
}
void UpdateAI(uint32 diff) override
{
if (PoisonTimer)
{
if (PoisonTimer <= diff)
{
if (!PlayerGUID.IsEmpty())
{
Player* player = ObjectAccessor::GetPlayer(*me, PlayerGUID);
if (player && player->GetQuestStatus(11020) == QUEST_STATUS_INCOMPLETE)
player->KilledMonsterCredit(23209);
}
PoisonTimer = 0;
me->KillSelf();
} else PoisonTimer -= diff;
}
if (!UpdateVictim())
return;
DoMeleeAttackIfReady();
}
};
};
/*####
# npc_earthmender_wilda
####*/
@@ -1683,7 +1592,6 @@ void AddSC_shadowmoon_valley()
new npc_infernal_attacker();
new npc_mature_netherwing_drake();
new npc_enslaved_netherwing_drake();
new npc_dragonmaw_peon();
new npc_earthmender_wilda();
new npc_lord_illidan_stormrage();
new go_crystal_prison();