aboutsummaryrefslogtreecommitdiff
path: root/src/bindings/scripts
diff options
context:
space:
mode:
authorKudlaty <none@none>2009-08-14 15:59:01 +0200
committerKudlaty <none@none>2009-08-14 15:59:01 +0200
commit65ba3044dc380911d0024e423cf5162015713f67 (patch)
tree98598d6560598ec3065969b1a990e35329579e9b /src/bindings/scripts
parent75faad4b9346d6d1983e56d2e5054c2fab17ddcc (diff)
parent172befc3608426601f7aba28c0c4e959207819f3 (diff)
merge
--HG-- branch : trunk
Diffstat (limited to 'src/bindings/scripts')
-rw-r--r--src/bindings/scripts/scripts/npc/npcs_special.cpp98
-rw-r--r--src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp88
2 files changed, 182 insertions, 4 deletions
diff --git a/src/bindings/scripts/scripts/npc/npcs_special.cpp b/src/bindings/scripts/scripts/npc/npcs_special.cpp
index 1764708d0e3..68c3e0e2559 100644
--- a/src/bindings/scripts/scripts/npc/npcs_special.cpp
+++ b/src/bindings/scripts/scripts/npc/npcs_special.cpp
@@ -1685,6 +1685,91 @@ CreatureAI* GetAI_npc_mirror_image(Creature* pCreature)
return new npc_mirror_image (pCreature);
}
+struct TRINITY_DLL_DECL npc_ebon_gargoyleAI : SpellCasterAI
+{
+ npc_ebon_gargoyleAI(Creature *c) : SpellCasterAI(c) {}
+
+ int despawnTimer;
+
+ void InitializeAI()
+ {
+ SpellCasterAI::InitializeAI();
+ Unit * owner = me->GetOwner();
+ if (!owner)
+ return;
+ // Not needed to be despawned now
+ despawnTimer = 0;
+ // Find victim of Summon Gargoyle spell
+ std::list<Unit*> targets;
+ Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(m_creature, m_creature, 30);
+ Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(m_creature, targets, u_check);
+ m_creature->VisitNearbyObject(30, searcher);
+ for(std::list<Unit*>::iterator iter = targets.begin(); iter != targets.end(); ++iter)
+ if((*iter)->GetAura(49206,owner->GetGUID()))
+ {
+ me->Attack((*iter),false);
+ break;
+ }
+ }
+
+ void JustDied(Unit *killer)
+ {
+ // Stop Feeding Gargoyle when it dies
+ if (Unit *owner = me->GetOwner())
+ owner->RemoveAurasDueToSpell(50514);
+ }
+
+ // Fly away when dismissed
+ void SpellHit(Unit *source, const SpellEntry *spell)
+ {
+ if(spell->Id != 50515 || !me->isAlive() )
+ return;
+
+ Unit *owner = me->GetOwner();
+
+ if (!owner || owner != source)
+ return;
+
+ // Stop Fighting
+ me->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE, true);
+ // Sanctuary
+ me->CastSpell(m_creature, 54661, true);
+ me->SetReactState(REACT_PASSIVE);
+
+ // Fly Away
+ me->AddUnitMovementFlag(MOVEMENTFLAG_FLY_MODE);
+ me->SetSpeed(MOVE_FLIGHT, 0.25f, true);
+ me->SetSpeed(MOVE_RUN, 0.25f, true);
+ float x = me->GetPositionX() + 10 * cos(me->GetOrientation());
+ float y = me->GetPositionY() + 10 * sin(me->GetOrientation());
+ float z = me->GetPositionZ() + 25;
+ me->GetMotionMaster()->MovePoint(0, x, y, z);
+
+ // Despawn as soon as possible
+ despawnTimer = 4 * IN_MILISECONDS;
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (despawnTimer > 0)
+ {
+ if (despawnTimer > diff)
+ despawnTimer -= diff;
+ else
+ {
+ me->ForcedDespawn();
+ }
+ return;
+ }
+ SpellCasterAI::UpdateAI(diff);
+ }
+};
+
+CreatureAI* GetAI_npc_ebon_gargoyle(Creature* pCreature)
+{
+ return new npc_ebon_gargoyleAI (pCreature);
+}
+
//TODO: 30% Attackdamage check for Lightwell
struct TRINITY_DLL_DECL npc_lightwellAI : public PassiveAI
{
@@ -1853,13 +1938,18 @@ void AddSC_npcs_special()
newscript->RegisterSelf();
newscript = new Script;
- newscript->Name="npc_lightwell";
- newscript->GetAI = &GetAI_npc_lightwellAI;
+ newscript->Name="npc_mirror_image";
+ newscript->GetAI = &GetAI_npc_mirror_image;
newscript->RegisterSelf();
newscript = new Script;
- newscript->Name="npc_mirror_image";
- newscript->GetAI = &GetAI_npc_mirror_image;
+ newscript->Name="npc_ebon_gargoyle";
+ newscript->GetAI = &GetAI_npc_ebon_gargoyle;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name="npc_lightwell";
+ newscript->GetAI = &GetAI_npc_lightwellAI;
newscript->RegisterSelf();
newscript = new Script;
diff --git a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp
index 5616ecfcd88..d875a721b7e 100644
--- a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp
+++ b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp
@@ -613,6 +613,88 @@ bool GossipSelect_npc_slim(Player* pPlayer, Creature* pCreature, uint32 uiSender
return true;
}
+/*########
+####npc_Akuno
+#####*/
+
+#define QUEST_NPC_AKUNO 10887
+#define Summon 21661
+
+struct TRINITY_DLL_DECL npc_akunoAI : public npc_escortAI
+{
+ npc_akunoAI(Creature *c) : npc_escortAI(c) {}
+
+ bool IsWalking;
+
+
+ void WaypointReached(uint32 i)
+ {
+ Player* player = Unit::GetPlayer(PlayerGUID);
+
+ if(!player)
+ return;
+
+ if(IsWalking && !m_creature->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE))
+ m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+
+
+ switch(i)
+ {
+ case 0 : m_creature->setFaction(5);break;
+ case 3 : m_creature->SummonCreature(Summon,-2795.99,5420.33,-34.53,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ m_creature->SummonCreature(Summon,-2793.55,5412.79,-34.53,0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
+ break;
+ case 11 : {
+ if(player && player->GetTypeId() == TYPEID_PLAYER)
+ ((Player*)player)->GroupEventHappens(QUEST_NPC_AKUNO,m_creature);
+ m_creature->setFaction(18);break;
+ }
+ }
+ }
+ void Aggro(Unit* who)
+ {}
+
+ void Reset()
+ {
+ if (IsWalking && !m_creature->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE))
+ {
+ m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+ return;
+ }
+ IsWalking=false;
+ }
+
+ void JustDied(Unit* killer)
+ {
+ if (PlayerGUID)
+ {
+ if (Player* player = Unit::GetPlayer(PlayerGUID))
+ player->FailQuest(QUEST_NPC_AKUNO);
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ npc_escortAI::UpdateAI(diff);
+ }
+};
+
+ bool QuestAccept_npc_akuno(Player* player, Creature* creature, Quest const* quest)
+ {
+ if(quest->GetQuestId() == QUEST_NPC_AKUNO)
+ {
+ ((npc_escortAI*)creature->AI())->Start(false,true,player->GetGUID());
+ }
+ return true;
+ }
+
+CreatureAI* GetAI_npc_akuno(Creature *_Creature)
+{
+ npc_akunoAI* thisAI = new npc_akunoAI(_Creature);
+ thisAI->FillPointMovementListForCreature();
+ return(CreatureAI*)thisAI;
+}
+
void AddSC_terokkar_forest()
{
Script *newscript;
@@ -666,5 +748,11 @@ void AddSC_terokkar_forest()
newscript->pGossipHello = &GossipHello_npc_slim;
newscript->pGossipSelect = &GossipSelect_npc_slim;
newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name="npc_akuno";
+ newscript->GetAI = &GetAI_npc_akuno;
+ newscript->pQuestAccept = &QuestAccept_npc_akuno;
+ newscript->RegisterSelf();
}