Skip to content

Commit da0d569

Browse files
author
NoFantasy
committed
[1596] Add basic script for dalaran guards
Add basic script for dalaran guards git-svn-id: https://scriptdev2.svn.sourceforge.net/svnroot/scriptdev2@1596 5f9c896b-1e26-0410-94da-f77f675e2462
1 parent 5655f45 commit da0d569

4 files changed

Lines changed: 57 additions & 1 deletion

File tree

scripts/northrend/dalaran.cpp

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,59 @@ SDCategory: Dalaran
2222
EndScriptData */
2323

2424
/* ContentData
25+
npc_dalaran_guardian_mage
2526
npc_zirdomi
2627
EndContentData */
2728

2829
#include "precompiled.h"
2930

31+
enum
32+
{
33+
SPELL_TRESPASSER_H = 54028,
34+
SPELL_TRESPASSER_A = 54029,
35+
36+
AREA_ID_SUNREAVER = 4616,
37+
AREA_ID_SILVER_ENCLAVE = 4740
38+
};
39+
40+
struct MANGOS_DLL_DECL npc_dalaran_guardian_mageAI : public ScriptedAI
41+
{
42+
npc_dalaran_guardian_mageAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); }
43+
44+
void MoveInLineOfSight(Unit* pWho)
45+
{
46+
if (m_creature->GetDistanceZ(pWho) > CREATURE_Z_ATTACK_RANGE)
47+
return;
48+
49+
if (pWho->isTargetableForAttack() && m_creature->IsHostileTo(pWho))
50+
{
51+
if (m_creature->IsWithinDistInMap(pWho, m_creature->GetAttackDistance(pWho)) && m_creature->IsWithinLOSInMap(pWho))
52+
{
53+
if (Player* pPlayer = pWho->GetCharmerOrOwnerPlayerOrPlayerItself())
54+
{
55+
// it's mentioned that pet may also be teleported, if so, we need to tune script to apply to those in addition.
56+
57+
if (pPlayer->GetAreaId() == AREA_ID_SILVER_ENCLAVE)
58+
DoCastSpellIfCan(pPlayer, SPELL_TRESPASSER_A);
59+
else if (pPlayer->GetAreaId() == AREA_ID_SUNREAVER)
60+
DoCastSpellIfCan(pPlayer, SPELL_TRESPASSER_H);
61+
}
62+
}
63+
}
64+
}
65+
66+
void AttackedBy(Unit* /*pAttacker*/) {}
67+
68+
void Reset() {}
69+
70+
void UpdateAI(const uint32 /*uiDiff*/) {}
71+
};
72+
73+
CreatureAI* GetAI_npc_dalaran_guardian_mage(Creature* pCreature)
74+
{
75+
return new npc_dalaran_guardian_mageAI(pCreature);
76+
}
77+
3078
/*######
3179
## npc_zidormi
3280
######*/
@@ -64,6 +112,11 @@ void AddSC_dalaran()
64112
{
65113
Script *newscript;
66114

115+
newscript = new Script;
116+
newscript->Name = "npc_dalaran_guardian_mage";
117+
newscript->GetAI = &GetAI_npc_dalaran_guardian_mage;
118+
newscript->RegisterSelf();
119+
67120
newscript = new Script;
68121
newscript->Name = "npc_zidormi";
69122
newscript->pGossipHello = &GossipHello_npc_zidormi;

sql/Updates/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,5 @@ pkgdata_DATA = \
5151
r1592_mangos.sql \
5252
r1593_mangos.sql \
5353
r1594_mangos.sql \
54-
r1595_mangos.sql
54+
r1595_mangos.sql \
55+
r1596_mangos.sql

sql/Updates/r1596_mangos.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
UPDATE creature_template SET ScriptName='npc_dalaran_guardian_mage' WHERE entry IN (29255, 29254);

sql/mangos_scriptname_full.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ UPDATE creature_template SET ScriptName='mob_shield_generator_channel' WHERE ent
403403

404404

405405
/* DALARAN */
406+
UPDATE creature_template SET ScriptName='npc_dalaran_guardian_mage' WHERE entry IN (29255, 29254);
406407
UPDATE creature_template SET ScriptName='npc_zidormi' WHERE entry=31848;
407408

408409
/* DARKSHORE */

0 commit comments

Comments
 (0)