From 5718cabd9ca5e2c9627daf45071fd98981924fdb Mon Sep 17 00:00:00 2001 From: _manuel_ Date: Sat, 29 May 2010 14:19:00 -0300 Subject: [PATCH] Implemented script for Sunreaver Guardian and Silver Covenant Guardian. --HG-- branch : trunk --- sql/FULL/world_scripts_full.sql | 1 + sql/updates/8334_world_scriptname.sql | 1 + src/scripts/northrend/icecrown.cpp | 46 +++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) create mode 100644 sql/updates/8334_world_scriptname.sql diff --git a/sql/FULL/world_scripts_full.sql b/sql/FULL/world_scripts_full.sql index 0e2372d16c..7277ab1f3d 100644 --- a/sql/FULL/world_scripts_full.sql +++ b/sql/FULL/world_scripts_full.sql @@ -819,6 +819,7 @@ UPDATE `creature_template` SET `ScriptName`='npc_squire_david' WHERE `entry`=334 UPDATE `creature_template` SET `ScriptName`='npc_argent_valiant' WHERE `entry`=33448; UPDATE `creature_template` SET `ScriptName`='npc_argent_tournament_post' WHERE `entry`=35473; UPDATE `creature_template` SET `ScriptName`='npc_alorah_and_grimmin' WHERE `entry` IN (36101,36102); +UPDATE `creature_template` SET `ScriptName`='npc_guardian_pavilion' WHERE `entry` IN (33543,33643); /* IRONFORGE */ UPDATE `creature_template` SET `ScriptName`='npc_royal_historian_archesonus' WHERE `entry`=8879; diff --git a/sql/updates/8334_world_scriptname.sql b/sql/updates/8334_world_scriptname.sql new file mode 100644 index 0000000000..1ad9829e90 --- /dev/null +++ b/sql/updates/8334_world_scriptname.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `ScriptName`='npc_guardian_pavilion' WHERE `entry` IN (33543,33643); \ No newline at end of file diff --git a/src/scripts/northrend/icecrown.cpp b/src/scripts/northrend/icecrown.cpp index 84bc655ac2..76608bdb73 100644 --- a/src/scripts/northrend/icecrown.cpp +++ b/src/scripts/northrend/icecrown.cpp @@ -337,6 +337,47 @@ CreatureAI* GetAI_npc_alorah_and_grimmin(Creature* pCreature) return new npc_alorah_and_grimminAI (pCreature); } +/*###### +## npc_guardian_pavilion +######*/ + +enum eGuardianPavilion +{ + SPELL_TRESPASSER_H = 63987, + AREA_SUNREAVER_PAVILION = 4676, + + AREA_SILVER_COVENANT_PAVILION = 4677, + SPELL_TRESPASSER_A = 63986, +}; + +struct npc_guardian_pavilionAI : public Scripted_NoMovementAI +{ + npc_guardian_pavilionAI(Creature* pCreature) : Scripted_NoMovementAI(pCreature) {} + + void MoveInLineOfSight(Unit* pWho) + { + if (me->GetAreaId() != AREA_SUNREAVER_PAVILION && me->GetAreaId() != AREA_SILVER_COVENANT_PAVILION) + return; + + if (!pWho || pWho->GetTypeId() != TYPEID_PLAYER || !me->IsHostileTo(pWho) || !me->isInBackInMap(pWho, 5.0f)) + return; + + if (pWho->HasAura(SPELL_TRESPASSER_H) || pWho->HasAura(SPELL_TRESPASSER_A)) + return; + + if (pWho->ToPlayer()->GetTeamId() == TEAM_ALLIANCE) + pWho->CastSpell(pWho, SPELL_TRESPASSER_H, true); + else + pWho->CastSpell(pWho, SPELL_TRESPASSER_A, true); + + } +}; + +CreatureAI* GetAI_npc_guardian_pavilion(Creature* pCreature) +{ + return new npc_guardian_pavilionAI (pCreature); +} + void AddSC_icecrown() { Script *newscript; @@ -373,4 +414,9 @@ void AddSC_icecrown() newscript->Name = "npc_alorah_and_grimmin"; newscript->GetAI = &GetAI_npc_alorah_and_grimmin; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_guardian_pavilion"; + newscript->GetAI = &GetAI_npc_guardian_pavilion; + newscript->RegisterSelf(); }