#include "StdAfx.h" #include "Setup.h" /************************************************************************/ /* ShatPrayer.cpp Script by Pepsi 1x1 based on */ /* EmoteScript.cpp Script by M4ksiu many thanks */ /************************************************************************/ // Shattrath City uint32 GAwpCheck; uint32 GAspeechFinished; #define CN_ALDOR_ANCHORITE 19142 class AnchoritePrayer : public CreatureAIScript { public: ADD_CREATURE_FACTORY_FUNCTION(AnchoritePrayer); AnchoritePrayer(Creature* pCreature) : CreatureAIScript(pCreature) { RegisterAIUpdateEvent(1000); // let's set 1sec AIUpdate voiding frequency -- first time when server starts if (pCreature->spawnid == 74135) { GAwpCheck = 0; EmoteTimerDefault = 5; } EmoteTimer = EmoteTimerDefault; } void OnSpawn() { RegisterAIUpdateEvent(1000); // let's set 1sec AIUpdate voiding frequency -- everytime creature is killed and respawned } void OnCombatStop(Unit *mTarget) { _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); _unit->GetAIInterface()->SetAIState(STATE_IDLE); RemoveAIUpdateEvent(); } void OnDied(Unit * mKiller) { RemoveAIUpdateEvent(); } void AIUpdate() { if (_unit->isAlive() && !(_unit->CombatStatus.IsInCombat())) // we don't want mob to say anything about prayer when fighting :P { if (GAwpCheck==2) { _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_WANTEDWP); _unit->GetAIInterface()->MoveTo( -1857.835571f, 5406.411621f, -12.427333f, 1.916788f); _unit->SetStandState(STANDSTATE_SIT); _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_DONTMOVEWP); if (GAspeechFinished==1) { EmoteTimer--; if(EmoteTimer<=0) { _unit->SetStandState(STANDSTATE_STAND); _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "May it be so."); EmoteTimer=EmoteTimerDefault; _unit->GetAIInterface()->setMoveType(MOVEMENTTYPE_WANTEDWP); _unit->GetAIInterface()->MoveTo( -1851.676880f, 5383.230469f, -12.427333f, 1.510737f); GAspeechFinished=0; } } } } } protected: int EmoteTimerDefault; // Timers in seconds! int EmoteTimer; }; #define CN_ALDOR_MARKSMAN 19337 class MarksmanPrayer : public CreatureAIScript { public: ADD_CREATURE_FACTORY_FUNCTION(MarksmanPrayer); MarksmanPrayer(Creature* pCreature) : CreatureAIScript(pCreature) { RegisterAIUpdateEvent(1000); // let's set 1sec AIUpdate voiding frequency -- first time when server starts switch (pCreature->spawnid) { case 74140: //Aldor Marksman spawn emoteID = EMOTE_ONESHOT_KNEEL; _unit->SetStandState(STANDSTATE_SIT); emoteTimerDefault = 13; break; default: { emoteID = EMOTE_ONESHOT_NONE; emoteID2 = EMOTE_ONESHOT_NONE; emoteTimerDefault = 0; emoteTimerDefault2 = 0; }; } emoteTimer = emoteTimerDefault; emoteTimer2 = emoteTimerDefault2; } void OnSpawn() { RegisterAIUpdateEvent(1000); // let's set 1sec AIUpdate voiding frequency -- everytime creature is killed and respawned } void OnCombatStop(Unit *mTarget) { _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); _unit->GetAIInterface()->SetAIState(STATE_IDLE); RemoveAIUpdateEvent(); } void OnDied(Unit * mKiller) { RemoveAIUpdateEvent(); } void AIUpdate() { if (_unit->isAlive() && !(_unit->CombatStatus.IsInCombat())) // we don't want mob to say anything about prayer when fighting :P { emoteTimer--; emoteTimer2--; if (!emoteTimer && emoteTimer2) { _unit->Emote(emoteID); emoteTimer = emoteTimerDefault; _unit->SetStandState(STANDSTATE_STAND); _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "May it be so."); } if (!emoteTimer2 && emoteTimer) { _unit->Emote(emoteID2); emoteTimer2 = emoteTimerDefault2; } if (!emoteTimer && !emoteTimer2) { _unit->Emote(emoteID); _unit->SetStandState(STANDSTATE_SIT); emoteTimer = emoteTimerDefault; emoteTimer2 = emoteTimerDefault2; } } } protected: int emoteTimerDefault; // Timers in seconds! EmoteType emoteID; int emoteTimerDefault2; EmoteType emoteID2; int emoteTimer; int emoteTimer2; }; #define CN_ALDOR_NEOPHYTE 19153 class NeophytePrayer : public CreatureAIScript { public: ADD_CREATURE_FACTORY_FUNCTION(NeophytePrayer); NeophytePrayer(Creature* pCreature) : CreatureAIScript(pCreature) { RegisterAIUpdateEvent(1000); // let's set 1sec AIUpdate voiding frequency -- first time when server starts switch (pCreature->spawnid) { case 74307: //Aldor Neophyte spawn emoteID = EMOTE_ONESHOT_KNEEL; _unit->SetStandState(STANDSTATE_SIT); emoteTimerDefault = 15; break; default: { emoteID = EMOTE_ONESHOT_NONE; emoteID2 = EMOTE_ONESHOT_NONE; emoteTimerDefault = 0; emoteTimerDefault2 = 0; }; } emoteTimer = emoteTimerDefault; emoteTimer2 = emoteTimerDefault2; } void OnSpawn() { RegisterAIUpdateEvent(1000); // let's set 1sec AIUpdate voiding frequency -- everytime creature is killed and respawned } void OnCombatStop(Unit *mTarget) { _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); _unit->GetAIInterface()->SetAIState(STATE_IDLE); RemoveAIUpdateEvent(); } void OnDied(Unit * mKiller) { RemoveAIUpdateEvent(); } void AIUpdate() { if (_unit->isAlive() && !(_unit->CombatStatus.IsInCombat())) // we don't want mob to say anything about prayer when fighting :P { emoteTimer--; emoteTimer2--; if (!emoteTimer && emoteTimer2) { _unit->Emote(emoteID); emoteTimer = emoteTimerDefault; _unit->SetStandState(STANDSTATE_STAND); _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "May it be so."); } if (!emoteTimer2 && emoteTimer) { _unit->Emote(emoteID2); emoteTimer2 = emoteTimerDefault2; } if (!emoteTimer && !emoteTimer2) { _unit->Emote(emoteID); _unit->SetStandState(STANDSTATE_SIT); emoteTimer = emoteTimerDefault; emoteTimer2 = emoteTimerDefault2; } } } protected: int emoteTimerDefault; // Timers in seconds! EmoteType emoteID; int emoteTimerDefault2; EmoteType emoteID2; int emoteTimer; int emoteTimer2; }; #define CN_HARBINGER_ARGOMEN 19272 class ArgomenPrayer : public CreatureAIScript { public: ADD_CREATURE_FACTORY_FUNCTION(ArgomenPrayer); ArgomenPrayer(Creature* pCreature) : CreatureAIScript(pCreature) { RegisterAIUpdateEvent(1000); // let's set 1sec AIUpdate voiding frequency -- first time when server starts switch (pCreature->spawnid) { case 74497: //Harbinger Argomen spawn emoteID = EMOTE_ONESHOT_KNEEL; _unit->SetStandState(STANDSTATE_SIT); emoteTimerDefault = 16; break; default: { emoteID = EMOTE_ONESHOT_NONE; emoteID2 = EMOTE_ONESHOT_NONE; emoteTimerDefault = 0; emoteTimerDefault2 = 0; }; } emoteTimer = emoteTimerDefault; emoteTimer2 = emoteTimerDefault2; } void OnSpawn() { RegisterAIUpdateEvent(1000); // let's set 1sec AIUpdate voiding frequency -- everytime creature is killed and respawned } void OnCombatStop(Unit *mTarget) { _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); _unit->GetAIInterface()->SetAIState(STATE_IDLE); RemoveAIUpdateEvent(); } void OnDied(Unit * mKiller) { RemoveAIUpdateEvent(); } void AIUpdate() { if (_unit->isAlive() && !(_unit->CombatStatus.IsInCombat())) // we don't want mob to say anything about prayer when fighting :P { emoteTimer--; emoteTimer2--; if (!emoteTimer && emoteTimer2) //this controls only case { _unit->Emote(emoteID); emoteTimer = emoteTimerDefault; _unit->SetStandState(STANDSTATE_STAND); _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "May it be as you say, Grand Anchorite."); } if (!emoteTimer2 && emoteTimer) { _unit->Emote(emoteID2); emoteTimer2 = emoteTimerDefault2; } if (!emoteTimer && !emoteTimer2) //this controls all other than case { _unit->Emote(emoteID); _unit->SetStandState(STANDSTATE_SIT); emoteTimer = emoteTimerDefault; emoteTimer2 = emoteTimerDefault2; } } } protected: int emoteTimerDefault; // Timers in seconds! EmoteType emoteID; int emoteTimerDefault2; EmoteType emoteID2; int emoteTimer; int emoteTimer2; }; #define CN_GRAND_ANCHORITE_ALMONEN 19216 class AlmonenPrayer : public CreatureAIScript { public: ADD_CREATURE_FACTORY_FUNCTION(AlmonenPrayer); AlmonenPrayer(Creature* pCreature) : CreatureAIScript(pCreature) { RegisterAIUpdateEvent(1000); // let's set 1sec AIUpdate voiding frequency -- first time when server starts switch (pCreature->spawnid) { case 74137: //GRAND_ANCHORITE_ALMONEN spawn emoteID = EMOTE_ONESHOT_KNEEL; emoteTimerDefault = 10; break; default: { emoteID = EMOTE_ONESHOT_NONE; emoteID2 = EMOTE_ONESHOT_NONE; emoteTimerDefault = 0; emoteTimerDefault2 = 0; }; } emoteTimer = emoteTimerDefault; emoteTimer2 = emoteTimerDefault2; } void OnSpawn() { RegisterAIUpdateEvent(1000); // let's set 1sec AIUpdate voiding frequency -- everytime creature is killed and respawned } void OnCombatStop(Unit *mTarget) { _unit->GetAIInterface()->setCurrentAgent(AGENT_NULL); _unit->GetAIInterface()->SetAIState(STATE_IDLE); RemoveAIUpdateEvent(); } void OnDied(Unit * mKiller) { RemoveAIUpdateEvent(); } void AIUpdate() { if (_unit->isAlive() && !(_unit->CombatStatus.IsInCombat())) // we don't want mob to say anything about prayer when fighting :P { emoteTimer--; emoteTimer2--; if (!emoteTimer && emoteTimer2) { _unit->Emote(emoteID); emoteTimer = emoteTimerDefault; _unit->SendChatMessage(CHAT_MSG_MONSTER_SAY, LANG_UNIVERSAL, "By the naaru, may it be so."); GAwpCheck = 2; GAspeechFinished = 1; } if (!emoteTimer2 && emoteTimer) { _unit->Emote(emoteID2); emoteTimer2 = emoteTimerDefault2; } if (!emoteTimer && !emoteTimer2) { _unit->Emote(emoteID); emoteTimer = emoteTimerDefault; emoteTimer2 = emoteTimerDefault2; } } } protected: int emoteTimerDefault; // Timers in seconds! EmoteType emoteID; int emoteTimerDefault2; EmoteType emoteID2; int emoteTimer; int emoteTimer2; }; void SetupShatPrayer(ScriptMgr * mgr) { mgr->register_creature_script(CN_GRAND_ANCHORITE_ALMONEN, &AlmonenPrayer::Create); mgr->register_creature_script(CN_ALDOR_ANCHORITE, &AnchoritePrayer::Create); mgr->register_creature_script(CN_ALDOR_MARKSMAN, &MarksmanPrayer::Create); mgr->register_creature_script(CN_ALDOR_NEOPHYTE, &NeophytePrayer::Create); mgr->register_creature_script(CN_HARBINGER_ARGOMEN, &ArgomenPrayer::Create); }