mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 07:48:02 +00:00
refactor(Scripts/Stormwind): Move Bartleby script to SAI (#17731)
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
--
|
||||
UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = 6090;
|
||||
|
||||
DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 6090);
|
||||
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
|
||||
(6090, 0, 0, 1, 19, 0, 100, 0, 1640, 0, 0, 0, 0, 0, 2, 168, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Bartleby - On Quest \'Beat Bartleby\' Taken - Set Faction 168'),
|
||||
(6090, 0, 1, 4, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 49, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Bartleby - On Quest \'Beat Bartleby\' Taken - Start Attacking'),
|
||||
(6090, 0, 2, 3, 2, 0, 100, 0, 0, 15, 0, 0, 0, 0, 15, 1640, 0, 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 'Bartleby - Between 0-15% Health - Quest Credit \'Beat Bartleby\''),
|
||||
(6090, 0, 3, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Bartleby - Between 0-15% Health - Evade'),
|
||||
(6090, 0, 4, 6, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 42, 0, 15, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Bartleby - On Quest \'Beat Bartleby\' Taken - Set Invincibility Hp 15%'),
|
||||
(6090, 0, 5, 0, 25, 0, 100, 0, 0, 0, 0, 0, 0, 0, 2, 84, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Bartleby - On Reset - Set Faction 84'),
|
||||
(6090, 0, 6, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 'Bartleby - On Quest \'Beat Bartleby\' Taken - Store Targetlist');
|
||||
|
||||
@@ -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