aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBlaymoira <none@none>2009-01-11 02:23:11 +0100
committerBlaymoira <none@none>2009-01-11 02:23:11 +0100
commitca1c3cf7938c6a0d88769936e86b158072ec13f6 (patch)
tree0822f1a51a5508e7c12199890295c3316948a914 /src
parent7233c671c173ac4783fc4654d89135cd9809ab66 (diff)
*Support for quest 11129 - by Silver1ce
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/scripts/zone/mulgore/mulgore.cpp115
1 files changed, 112 insertions, 3 deletions
diff --git a/src/bindings/scripts/scripts/zone/mulgore/mulgore.cpp b/src/bindings/scripts/scripts/zone/mulgore/mulgore.cpp
index 44de5eab777..72125a8e2d9 100644
--- a/src/bindings/scripts/scripts/zone/mulgore/mulgore.cpp
+++ b/src/bindings/scripts/scripts/zone/mulgore/mulgore.cpp
@@ -17,12 +17,13 @@
/* ScriptData
SDName: Mulgore
SD%Complete: 100
-SDComment: Skorn Whitecloud: Just a story if not rewarded for quest
+SDComment: Support for quest: 11129
SDCategory: Mulgore
EndScriptData */
/* ContentData
npc_skorn_whitecloud
+npc_kyle_frenzied
EndContentData */
#include "precompiled.h"
@@ -52,13 +53,121 @@ bool GossipSelect_npc_skorn_whitecloud(Player *player, Creature *_Creature, uint
return true;
}
+/*#####
+# npc_kyle_frenzied
+######*/
+
+struct TRINITY_DLL_DECL npc_kyle_frenziedAI : public ScriptedAI
+{
+ npc_kyle_frenziedAI(Creature *c) : ScriptedAI(c) {Reset();}
+
+ int STATE;
+ uint32 wait;
+ uint64 player;
+
+ void Reset()
+ {
+ STATE = 0;
+ m_creature->SetDefaultMovementType(WAYPOINT_MOTION_TYPE);
+ m_creature->GetMotionMaster()->Initialize();
+ }
+ void Aggro(Unit* who){}
+
+ void SpellHit(Unit *caster, const SpellEntry* spell)
+ { // we can feed him without any quest
+ if(spell->Id == 42222 && caster->GetTypeId() == TYPEID_PLAYER && ((Player*)caster)->GetTeam() == HORDE)
+ {
+ STATE = 1;
+ player = caster->GetGUID();
+ float x, y, z, z2;
+ caster->GetPosition(x, y, z);
+ x = x + 3.7*cos(caster->GetOrientation());
+ y = y + 3.7*sin(caster->GetOrientation());
+ z2 = m_creature->GetBaseMap()->GetHeight(x,y,z,false);
+ z = (z2 <= INVALID_HEIGHT) ? z : z2;
+ m_creature->SetDefaultMovementType(IDLE_MOTION_TYPE); //there is other way to stop waypoint movement?
+ m_creature->GetMotionMaster()->Initialize();
+ m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+ m_creature->GetMotionMaster()->MovePoint(0,x, y, z);
+ }
+ }
+
+ void MovementInform(uint32 type, uint32 id)
+ {
+ if(type == POINT_MOTION_TYPE)
+ {
+ switch(STATE)
+ {
+ case 1:
+ {
+ Unit *plr = Unit::GetUnit((*m_creature),player);
+ if(plr)
+ m_creature->SetOrientation(m_creature->GetAngle(plr));
+ m_creature->HandleEmoteCommand(EMOTE_STATE_USESTANDING); //eat
+ WorldPacket data;
+ m_creature->BuildHeartBeatMsg(&data);
+ m_creature->SendMessageToSet(&data,true);
+ wait = 3000;
+ STATE = 2;
+ break;
+ }
+ case 4:
+ m_creature->setDeathState(JUST_DIED);
+ m_creature->Respawn();
+ break;
+ }
+ }
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if (!STATE || STATE == 4)
+ return;
+ if(wait < diff)
+ {
+ switch(STATE)
+ {
+ case 2:
+ STATE = 3; wait = 7000;
+ m_creature->UpdateEntry(23622,HORDE);
+ m_creature->HandleEmoteCommand(EMOTE_ONESHOT_DANCE);
+ break;
+ case 3:
+ STATE = 4; //go home
+ Unit *plr = Unit::GetUnit((*m_creature),player);
+ if(plr && ((Player*)plr)->GetQuestStatus(11129) == QUEST_STATUS_INCOMPLETE)
+ ((Player*)plr)->CompleteQuest(11129);
+ float x, y, z, z2, angle;
+ angle = m_creature->GetAngle(-2146, -430);
+ m_creature->GetPosition(x,y,z);
+ x = x + 40*cos(angle);
+ y = y + 40*sin(angle);
+ z2 = m_creature->GetBaseMap()->GetHeight(x,y,MAX_HEIGHT,false);
+ z = (z2 <= INVALID_HEIGHT) ? z : z2;
+ m_creature->GetMotionMaster()->MovePoint(0,x,y,z);
+ break;
+ }
+ }else wait -= diff;
+ }
+};
+
+CreatureAI* GetAI_npc_kyle_frenzied(Creature *_Creature)
+{
+ return new npc_kyle_frenziedAI (_Creature);
+}
+
void AddSC_mulgore()
{
Script *newscript;
newscript = new Script;
newscript->Name="npc_skorn_whitecloud";
- newscript->pGossipHello = &GossipHello_npc_skorn_whitecloud;
- newscript->pGossipSelect = &GossipSelect_npc_skorn_whitecloud;
+ newscript->pGossipHello = &GossipHello_npc_skorn_whitecloud;
+ newscript->pGossipSelect = &GossipSelect_npc_skorn_whitecloud;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name="npc_kyle_frenzied";
+ newscript->GetAI = &GetAI_npc_kyle_frenzied;
newscript->RegisterSelf();
}