aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/FULL/world_scripts_full.sql4
-rw-r--r--sql/updates/6873_world_scriptnames.sql1
-rw-r--r--src/bindings/scripts/scripts/world/npcs_special.cpp37
3 files changed, 40 insertions, 2 deletions
diff --git a/sql/FULL/world_scripts_full.sql b/sql/FULL/world_scripts_full.sql
index 26e8464fbb0..871f2a7b21b 100644
--- a/sql/FULL/world_scripts_full.sql
+++ b/sql/FULL/world_scripts_full.sql
@@ -1,4 +1,4 @@
--- Up to TC2 6859
+-- Up to TC2 6873
-- Cleanup first
UPDATE `creature_template` SET `ScriptName`='';
@@ -138,7 +138,7 @@ UPDATE `creature_template` SET `AIName`='ArchorAI', `ScriptName`='' WHERE `entry
UPDATE `creature_template` SET `AIName`='TurretAI', `ScriptName`='' WHERE `entry`=29104;
UPDATE `creature_template` SET `ScriptName`='npc_highlord_darion_mograine' WHERE `entry`=29173;
UPDATE `creature_template` SET `ScriptName`='npc_the_lich_king_tirion_dawn' WHERE `entry` IN (29183,29175);
-
+UPDATE `creature_template` SET `ScriptName`='npc_shadowfiend' WHERE `entry` = 19668;
/* */
/* ZONE */
diff --git a/sql/updates/6873_world_scriptnames.sql b/sql/updates/6873_world_scriptnames.sql
new file mode 100644
index 00000000000..3031b9b8652
--- /dev/null
+++ b/sql/updates/6873_world_scriptnames.sql
@@ -0,0 +1 @@
+UPDATE creature_template SET ScriptName = 'npc_shadowfiend' WHERE entry = 19668;
diff --git a/src/bindings/scripts/scripts/world/npcs_special.cpp b/src/bindings/scripts/scripts/world/npcs_special.cpp
index 74c9cf8b0c0..c7a3f259c9a 100644
--- a/src/bindings/scripts/scripts/world/npcs_special.cpp
+++ b/src/bindings/scripts/scripts/world/npcs_special.cpp
@@ -36,6 +36,7 @@ npc_mount_vendor 100% Regular mount vendors all over the world. Displa
npc_rogue_trainer 80% Scripted trainers, so they are able to offer item 17126 for class quest 6681
npc_sayge 100% Darkmoon event fortune teller, buff player based on answers given
npc_snake_trap_serpents 80% AI for snakes that summoned by Snake Trap
+npc_shadowfiend 100% restore 5% of owner's mana when shadowfiend die from damage
EndContentData */
#include "precompiled.h"
@@ -1954,6 +1955,37 @@ CreatureAI* GetAI_npc_training_dummy(Creature* pCreature)
return new npc_training_dummy (pCreature);
}
+/*######
+# npc_shadowfiend
+######*/
+#define GLYPH_OF_SHADOWFIEND_MANA 58227
+#define GLYPH_OF_SHADOWFIEND 58228
+
+struct TRINITY_DLL_DECL npc_shadowfiendAI : public ScriptedAI
+{
+ npc_shadowfiendAI(Creature *c) : ScriptedAI(c) {}
+
+ void DamageTaken(Unit *killer, uint32 &damage)
+ {
+ if (Unit * Owner = CAST_SUM(m_creature)->GetSummoner())
+ {
+ if (Owner->HasAura(GLYPH_OF_SHADOWFIEND))
+ if (damage >= m_creature->GetHealth())
+ Owner->CastSpell(Owner,GLYPH_OF_SHADOWFIEND_MANA,true);
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_npc_shadowfiend(Creature* pCreature)
+{
+ return new npc_shadowfiendAI(pCreature);
+}
+
void AddSC_npcs_special()
{
Script *newscript;
@@ -2075,5 +2107,10 @@ void AddSC_npcs_special()
newscript->Name = "npc_training_dummy";
newscript->GetAI = &GetAI_npc_training_dummy;
newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name = "npc_shadowfiend";
+ newscript->GetAI = &GetAI_npc_shadowfiend;
+ newscript->RegisterSelf();
}