Skip to content

Commit

Permalink
Creature/Script: Move "Bartleby" script to SAI
Browse files Browse the repository at this point in the history
  • Loading branch information
Rushor authored and Killyana committed Feb 13, 2019
1 parent 59682bb commit d69ef2a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 60 deletions.
12 changes: 12 additions & 0 deletions sql/updates/world/3.3.5/2019_02_13_00_world_335.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Bartleby SAI
SET @ENTRY := 6090;
UPDATE `creature_template` SET `AIName`="SmartAI", `ScriptName`="" WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0;
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`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,0,25,0,100,0,0,0,0,0,2,84,0,0,0,0,0,1,0,0,0,0,0,0,0,"Bartleby - On Reset - Set Faction 84"),
(@ENTRY,0,1,2,19,0,100,0,1640,0,0,0,2,168,0,0,0,0,0,1,0,0,0,0,0,0,0,"Bartleby - On Quest 'Beat Bartleby' Taken - Set Faction 168"),
(@ENTRY,0,2,6,61,0,100,0,0,0,0,0,49,0,0,0,0,0,0,21,100,0,0,0,0,0,0,"Bartleby - On Quest Taken - Start Attacking"),
(@ENTRY,0,3,0,25,0,100,0,0,0,0,0,42,1,0,0,0,0,0,1,0,0,0,0,0,0,0,"Bartleby - On Reset - Set Invincibility Hp 1"),
(@ENTRY,0,4,5,2,0,100,0,0,15,0,0,15,1640,0,0,0,0,0,12,1,0,0,0,0,0,0,"Bartleby - Between 0-15% Health - Quest Credit 'Beat Bartleby'"),
(@ENTRY,0,5,0,61,0,100,0,0,0,0,0,24,0,0,0,0,0,0,1,0,0,0,0,0,0,0,"Bartleby - Between 0-15% Health - Evade"),
(@ENTRY,0,6,0,61,0,100,0,0,0,0,0,64,1,0,0,0,0,0,7,0,0,0,0,0,0,0,"Bartleby - On Quest Taken - Store Targetlist");
60 changes: 0 additions & 60 deletions src/server/scripts/EasternKingdoms/zone_stormwind_city.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ SDCategory: Stormwind City
EndScriptData */

/* ContentData
npc_bartleby
npc_tyrion
npc_tyrion_spybot
npc_marzon_silent_blade
Expand All @@ -39,64 +38,6 @@ EndContentData */
#include "ScriptedGossip.h"
#include "TemporarySummon.h"

/*######
## npc_bartleby
######*/

enum Bartleby
{
QUEST_BEAT = 1640
};

class npc_bartleby : public CreatureScript
{
public:
npc_bartleby() : CreatureScript("npc_bartleby") { }

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 DamageTaken(Unit* pDoneBy, uint32 &uiDamage) override
{
if (uiDamage > me->GetHealth() || me->HealthBelowPctDamaged(15, uiDamage))
{
//Take 0 damage
uiDamage = 0;

if (pDoneBy && pDoneBy->GetTypeId() == TYPEID_PLAYER)
pDoneBy->ToPlayer()->AreaExploredOrEventHappens(QUEST_BEAT);
EnterEvadeMode();
}
}

void QuestAccept(Player* player, Quest const* quest) override
{
if (quest->GetQuestId() == QUEST_BEAT)
{
me->SetFaction(FACTION_ENEMY);
AttackStart(player);
}
}
};

CreatureAI* GetAI(Creature* creature) const override
{
return new npc_bartlebyAI(creature);
}
};

/*######
## npc_lord_gregor_lescovar
######*/
Expand Down Expand Up @@ -555,7 +496,6 @@ class npc_tyrion : public CreatureScript

void AddSC_stormwind_city()
{
new npc_bartleby();
new npc_tyrion();
new npc_tyrion_spybot();
new npc_lord_gregor_lescovar();
Expand Down

2 comments on commit d69ef2a

@qxpf666
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SmartAIMgr::LoadSmartAIFromDB: Entry 6090 SourceType 0, Event 4, Missing Repeat flag.

@Killyana
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix here fc72983

Please sign in to comment.