mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-25 14:46:24 +00:00
refactor(Scripts/Stormwind): Move Bartleby script to SAI (#17731)
This commit is contained in:
@@ -18,13 +18,12 @@
|
||||
/* ScriptData
|
||||
SDName: Stormwind_City
|
||||
SD%Complete: 100
|
||||
SDComment: Quest support: 1640, 1447, 4185, 11223, 434.
|
||||
SDComment: Quest support: 1447, 4185, 11223, 434.
|
||||
SDCategory: Stormwind City
|
||||
EndScriptData */
|
||||
|
||||
/* ContentData
|
||||
npc_archmage_malin
|
||||
npc_bartleby
|
||||
npc_tyrion
|
||||
npc_tyrion_spybot
|
||||
npc_marzon_silent_blade
|
||||
@@ -37,76 +36,6 @@ EndContentData */
|
||||
#include "ScriptedEscortAI.h"
|
||||
#include "ScriptedGossip.h"
|
||||
|
||||
/*######
|
||||
## npc_bartleby
|
||||
######*/
|
||||
|
||||
enum Bartleby
|
||||
{
|
||||
QUEST_BEAT = 1640
|
||||
};
|
||||
|
||||
class npc_bartleby : public CreatureScript
|
||||
{
|
||||
public:
|
||||
npc_bartleby() : CreatureScript("npc_bartleby") { }
|
||||
|
||||
bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) override
|
||||
{
|
||||
if (quest->GetQuestId() == QUEST_BEAT)
|
||||
{
|
||||
creature->SetFaction(FACTION_ENEMY);
|
||||
creature->AI()->AttackStart(player);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new npc_bartlebyAI(creature);
|
||||
}
|
||||
|
||||
struct npc_bartlebyAI : public ScriptedAI
|
||||
{
|
||||
npc_bartlebyAI(Creature* creature) : ScriptedAI(creature)
|
||||
{
|
||||
m_uiNormalFaction = creature->GetFaction();
|
||||
}
|
||||
|
||||
uint32 m_uiNormalFaction;
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
if (me->GetFaction() != m_uiNormalFaction)
|
||||
me->SetFaction(m_uiNormalFaction);
|
||||
}
|
||||
|
||||
void AttackedBy(Unit* pAttacker) override
|
||||
{
|
||||
if (me->GetVictim())
|
||||
return;
|
||||
|
||||
if (me->IsFriendlyTo(pAttacker))
|
||||
return;
|
||||
|
||||
AttackStart(pAttacker);
|
||||
}
|
||||
|
||||
void DamageTaken(Unit* pDoneBy, uint32& uiDamage, DamageEffectType, SpellSchoolMask) override
|
||||
{
|
||||
if (pDoneBy && (uiDamage >= me->GetHealth() || me->HealthBelowPctDamaged(15, uiDamage)))
|
||||
{
|
||||
//Take 0 damage
|
||||
uiDamage = 0;
|
||||
|
||||
if (Player* player = pDoneBy->ToPlayer())
|
||||
player->AreaExploredOrEventHappens(QUEST_BEAT);
|
||||
EnterEvadeMode();
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/*######
|
||||
## npc_lord_gregor_lescovar
|
||||
######*/
|
||||
@@ -546,7 +475,6 @@ public:
|
||||
|
||||
void AddSC_stormwind_city()
|
||||
{
|
||||
new npc_bartleby();
|
||||
new npc_tyrion();
|
||||
new npc_tyrion_spybot();
|
||||
new npc_lord_gregor_lescovar();
|
||||
|
||||
Reference in New Issue
Block a user