From a4b91e2cc4a4d0a09bce01c686df1fc7c812a12a Mon Sep 17 00:00:00 2001 From: Kudlaty Date: Sun, 16 Aug 2009 18:34:45 +0200 Subject: Merge [SD2] r1311 Move SetData from Reset to JustReachedHome for channelers and boss. r1312 Added class for FollowerAI. Note this is under development and may have issues in some situations. FollowerAI is generally to be used for escort quests where NPC follow leader instead of using a predefined path. --HG-- branch : trunk --- src/bindings/scripts/base/escortAI.cpp | 409 ------------------------------ src/bindings/scripts/base/escortAI.h | 107 -------- src/bindings/scripts/base/escort_ai.cpp | 409 ++++++++++++++++++++++++++++++ src/bindings/scripts/base/escort_ai.h | 107 ++++++++ src/bindings/scripts/base/follower_ai.cpp | 309 ++++++++++++++++++++++ src/bindings/scripts/base/follower_ai.h | 50 ++++ 6 files changed, 875 insertions(+), 516 deletions(-) delete mode 100644 src/bindings/scripts/base/escortAI.cpp delete mode 100644 src/bindings/scripts/base/escortAI.h create mode 100644 src/bindings/scripts/base/escort_ai.cpp create mode 100644 src/bindings/scripts/base/escort_ai.h create mode 100644 src/bindings/scripts/base/follower_ai.cpp create mode 100644 src/bindings/scripts/base/follower_ai.h (limited to 'src/bindings/scripts/base') diff --git a/src/bindings/scripts/base/escortAI.cpp b/src/bindings/scripts/base/escortAI.cpp deleted file mode 100644 index 2c9b968d281..00000000000 --- a/src/bindings/scripts/base/escortAI.cpp +++ /dev/null @@ -1,409 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software licensed under GPL version 2 - * Please see the included DOCS/LICENSE.TXT for more information */ - -/* ScriptData -SDName: Npc_EscortAI -SD%Complete: 100 -SDComment: -SDCategory: Npc -EndScriptData */ - -#include "precompiled.h" -#include "escortAI.h" - -enum -{ - POINT_LAST_POINT = 0xFFFFFF, - POINT_HOME = 0xFFFFFE -}; - -extern std::list PointMovementList; - -void npc_escortAI::AttackStart(Unit* pWho) -{ - if (!pWho) - return; - - if (m_creature->Attack(pWho, true)) - { - if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) - m_creature->GetMotionMaster()->MovementExpired(); - - if (IsCombatMovement()) - m_creature->GetMotionMaster()->MoveChase(pWho); - } -} - -void npc_escortAI::MoveInLineOfSight(Unit* pWho) -{ - if (IsBeingEscorted && !m_bIsActiveAttacker) - return; - - ScriptedAI::MoveInLineOfSight(pWho); -} - -void npc_escortAI::JustDied(Unit* pKiller) -{ - if (!IsBeingEscorted || !PlayerGUID || !m_pQuestForEscort) - return; - - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) - { - if (Group* pGroup = pPlayer->GetGroup()) - { - for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) - { - if (Player* pMember = pRef->getSource()) - { - if (pPlayer->GetQuestStatus(m_pQuestForEscort->GetQuestId()) == QUEST_STATUS_INCOMPLETE) - pPlayer->FailQuest(m_pQuestForEscort->GetQuestId()); - } - } - } - else - { - if (pPlayer->GetQuestStatus(m_pQuestForEscort->GetQuestId()) == QUEST_STATUS_INCOMPLETE) - pPlayer->FailQuest(m_pQuestForEscort->GetQuestId()); - } - } -} - -void npc_escortAI::JustRespawned() -{ - IsBeingEscorted = false; - IsOnHold = false; - - if (!IsCombatMovement()) - SetCombatMovement(true); - - //add a small delay before going to first waypoint, normal in near all cases - m_uiWPWaitTimer = 2500; - - if (m_creature->getFaction() != m_creature->GetCreatureInfo()->faction_A) - me->RestoreFaction(); - - Reset(); -} - -void npc_escortAI::ReturnToLastPoint() -{ - float x, y, z, o; - m_creature->GetHomePosition(x, y, z, o); - m_creature->GetMotionMaster()->MovePoint(POINT_LAST_POINT, x, y, z); -} - -void npc_escortAI::EnterEvadeMode() -{ - m_creature->RemoveAllAuras(); - m_creature->DeleteThreatList(); - m_creature->CombatStop(true); - m_creature->SetLootRecipient(NULL); - - if (IsBeingEscorted) - { - m_bIsReturning = true; - ReturnToLastPoint(); - debug_log("TSCR: EscortAI has left combat and is now returning to last point"); - } - else - m_creature->GetMotionMaster()->MoveTargetedHome(); - - Reset(); -} - -void npc_escortAI::UpdateAI(const uint32 uiDiff) -{ - //Waypoint Updating - if (IsBeingEscorted && !m_creature->getVictim() && m_uiWPWaitTimer && !m_bIsReturning) - { - if (m_uiWPWaitTimer <= uiDiff) - { - //End of the line - if (CurrentWP == WaypointList.end()) - { - if (DespawnAtEnd) - { - debug_log("TSCR: EscortAI reached end of waypoints"); - - if (m_bCanReturnToStart) - { - float fRetX, fRetY, fRetZ; - m_creature->GetRespawnCoord(fRetX, fRetY, fRetZ); - - m_creature->GetMotionMaster()->MovePoint(POINT_HOME, fRetX, fRetY, fRetZ); - - m_uiWPWaitTimer = 0; - - debug_log("TSCR: EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ); - return; - } - - if (m_bCanInstantRespawn) - { - m_creature->setDeathState(JUST_DIED); - m_creature->Respawn(); - } - else - m_creature->ForcedDespawn(); - - return; - } - else - { - debug_log("TSCR: EscortAI reached end of waypoints with Despawn off"); - - return; - } - } - - if (!IsOnHold) - { - m_creature->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); - debug_log("TSCR: EscortAI Next WP is: %u, %f, %f, %f", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); - m_uiWPWaitTimer = 0; - } - } - else - m_uiWPWaitTimer -= uiDiff; - } - - //Check if player or any member of his group is within range - if (IsBeingEscorted && PlayerGUID && !m_creature->getVictim() && !m_bIsReturning) - { - if (m_uiPlayerCheckTimer < uiDiff) - { - bool bIsMaxRangeExceeded = true; - - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) - { - if (Group* pGroup = pPlayer->GetGroup()) - { - for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) - { - Player* pMember = pRef->getSource(); - - if (pMember && m_creature->IsWithinDistInMap(pMember, GetMaxPlayerDistance())) - { - bIsMaxRangeExceeded = false; - break; - } - } - } - else - { - if (m_creature->IsWithinDistInMap(pPlayer, GetMaxPlayerDistance())) - bIsMaxRangeExceeded = false; - } - } - - if (DespawnAtFar && bIsMaxRangeExceeded) - { - debug_log("TSCR: EscortAI failed because player/group was to far away or not found"); - - if (m_bCanInstantRespawn) - { - m_creature->setDeathState(JUST_DIED); - m_creature->Respawn(); - } - else - m_creature->ForcedDespawn(); - - return; - } - - m_uiPlayerCheckTimer = 1000; - } - else - m_uiPlayerCheckTimer -= uiDiff; - } - - if (CanMelee && UpdateVictim()) - DoMeleeAttackIfReady(); -} - -void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId) -{ - if (uiMoveType != POINT_MOTION_TYPE || !IsBeingEscorted) - return; - - //Combat start position reached, continue waypoint movement - if (uiPointId == POINT_LAST_POINT) - { - debug_log("TSCR: EscortAI has returned to original position before combat"); - - if (m_bIsRunning && m_creature->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE)) - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - else if (!m_bIsRunning && !m_creature->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE)) - m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - - m_bIsReturning = false; - - if (!m_uiWPWaitTimer) - m_uiWPWaitTimer = 1; - } - else if (uiPointId == POINT_HOME) - { - debug_log("TSCR: EscortAI has returned to original home location and will continue from beginning of waypoint list."); - - CurrentWP = WaypointList.begin(); - m_uiWPWaitTimer = 1; - } - else - { - //Make sure that we are still on the right waypoint - if (CurrentWP->id != uiPointId) - { - debug_log("TSCR ERROR: EscortAI reached waypoint out of order %d, expected %d", uiPointId, CurrentWP->id); - return; - } - - debug_log("TSCR: EscortAI Waypoint %d reached", CurrentWP->id); - - //Call WP function - WaypointReached(CurrentWP->id); - - m_uiWPWaitTimer = CurrentWP->WaitTimeMs + 1; - - ++CurrentWP; - } -} - -/* -void npc_escortAI::OnPossess(bool apply) -{ - // We got possessed in the middle of being escorted, store the point - // where we left off to come back to when possess is removed - if (IsBeingEscorted) - { - if (apply) - m_creature->GetPosition(LastPos.x, LastPos.y, LastPos.z); - else - { - Returning = true; - m_creature->GetMotionMaster()->MovementExpired(); - m_creature->GetMotionMaster()->MovePoint(WP_LAST_POINT, LastPos.x, LastPos.y, LastPos.z); - } - } -} -*/ - -void npc_escortAI::AddWaypoint(uint32 id, float x, float y, float z, uint32 WaitTimeMs) -{ - Escort_Waypoint t(id, x, y, z, WaitTimeMs); - - WaypointList.push_back(t); - - // i think SD2 no longer uses this function - ScriptWP = true; - /*PointMovement wp; - wp.m_uiCreatureEntry = me->GetEntry(); - wp.m_uiPointId = id; - wp.m_fX = x; - wp.m_fY = y; - wp.m_fZ = z; - wp.m_uiWaitTime = WaitTimeMs; - PointMovementMap[wp.m_uiCreatureEntry].push_back(wp);*/ -} - -void npc_escortAI::FillPointMovementListForCreature() -{ - UNORDERED_MAP >::iterator pPointsEntries = PointMovementMap.find(m_creature->GetEntry()); - - if (pPointsEntries != PointMovementMap.end()) - { - std::vector::iterator itr; - - for (itr = pPointsEntries->second.begin(); itr != pPointsEntries->second.end(); ++itr) - { - Escort_Waypoint pPoint(itr->m_uiPointId,itr->m_fX,itr->m_fY,itr->m_fZ,itr->m_uiWaitTime); - WaypointList.push_back(pPoint); - } - } -} - -void npc_escortAI::SetRun(bool bRun) -{ - if (bRun) - { - if (!m_bIsRunning) - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - else - debug_log("TSCR: EscortAI attempt to set run mode, but is already running."); - } - else - { - if (m_bIsRunning) - m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - else - debug_log("TSCR: EscortAI attempt to set walk mode, but is already walking."); - } - m_bIsRunning = bRun; -} - -//TODO: get rid of this many variables passed in function. -void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID, const Quest* pQuest, bool bInstantRespawn, bool bCanLoopPath) -{ - if (m_creature->getVictim()) - { - debug_log("TSCR ERROR: EscortAI attempt to Start while in combat"); - return; - } - - if (IsBeingEscorted) - { - error_log("TSCR: EscortAI attempt to Start while already escorting"); - return; - } - - if(!ScriptWP) // sd2 never adds wp in script, but tc does - { - - if (!WaypointList.empty()) - WaypointList.clear(); - - FillPointMovementListForCreature(); - - } - - if (WaypointList.empty()) - { - error_db_log("TSCR: EscortAI Start with 0 waypoints (possible missing entry in script_waypoint)"); - return; - } - - //set variables - m_bIsActiveAttacker = bIsActiveAttacker; - m_bIsRunning = bRun; - - PlayerGUID = uiPlayerGUID; - m_pQuestForEscort = pQuest; - - m_bCanInstantRespawn = bInstantRespawn; - m_bCanReturnToStart = bCanLoopPath; - - if (m_bCanReturnToStart && m_bCanInstantRespawn) - debug_log("TSCR: EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn."); - - if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) - { - m_creature->GetMotionMaster()->MovementExpired(); - m_creature->GetMotionMaster()->MoveIdle(); - debug_log("TSCR: EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle."); - } - - //disable npcflags - m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - - debug_log("TSCR: EscortAI started with %d waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = %d", WaypointList.size(), m_bIsActiveAttacker, m_bIsRunning, PlayerGUID); - - CurrentWP = WaypointList.begin(); - - //Set initial speed - if (m_bIsRunning) - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - else - m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - - IsBeingEscorted = true; -} diff --git a/src/bindings/scripts/base/escortAI.h b/src/bindings/scripts/base/escortAI.h deleted file mode 100644 index 8ce82eb370a..00000000000 --- a/src/bindings/scripts/base/escortAI.h +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software licensed under GPL version 2 - * Please see the included DOCS/LICENSE.TXT for more information */ - -#ifndef SC_ESCORTAI_H -#define SC_ESCORTAI_H - -#define DEFAULT_MAX_PLAYER_DISTANCE 50 - -extern UNORDERED_MAP > PointMovementMap; - -struct Escort_Waypoint -{ - Escort_Waypoint(uint32 _id, float _x, float _y, float _z, uint32 _w) - { - id = _id; - x = _x; - y = _y; - z = _z; - WaitTimeMs = _w; - } - - uint32 id; - float x; - float y; - float z; - uint32 WaitTimeMs; -}; - -struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI -{ - public: - explicit npc_escortAI(Creature* pCreature) : ScriptedAI(pCreature), - IsBeingEscorted(false), IsOnHold(false), PlayerGUID(0), MaxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), CanMelee(true), m_uiPlayerCheckTimer(1000), m_uiWPWaitTimer(2500), m_bIsReturning(false), m_bIsActiveAttacker(true), m_bIsRunning(false), DespawnAtEnd(true), DespawnAtFar(true), m_pQuestForEscort(NULL), m_bCanInstantRespawn(false), m_bCanReturnToStart(false), ScriptWP(false) {} - ~npc_escortAI() {} - - // Pure Virtual Functions - virtual void WaypointReached(uint32) = 0; - - // CreatureAI functions - void AttackStart(Unit* who); - - void MoveInLineOfSight(Unit* who); - - void JustDied(Unit*); - - void JustRespawned(); - - void ReturnToLastPoint(); - - void EnterEvadeMode(); - - void UpdateAI(const uint32); - - void MovementInform(uint32, uint32); - - // EscortAI functions - void AddWaypoint(uint32 id, float x, float y, float z, uint32 WaitTimeMs = 0); - - void FillPointMovementListForCreature(); - - void Start(bool bIsActiveAttacker = true, bool bRun = false, uint64 uiPlayerGUID = 0, const Quest* pQuest = NULL, bool bInstantRespawn = false, bool bCanLoopPath = false); - - void SetRun(bool bRun = true); - - void SetMaxPlayerDistance(float newMax) { MaxPlayerDistance = newMax; } - float GetMaxPlayerDistance() { return MaxPlayerDistance; } - - bool IsEscorted() {return IsBeingEscorted;} - - void SetCanMelee(bool usemelee) { CanMelee = usemelee; } - void SetDespawnAtEnd(bool despawn) { DespawnAtEnd = despawn; } - void SetDespawnAtFar(bool despawn) { DespawnAtFar = despawn; } - bool GetAttack() { return m_bIsActiveAttacker; }//used in EnterEvadeMode override - bool GetIsBeingEscorted() { return IsBeingEscorted; }//used in EnterEvadeMode override - void SetReturning(bool returning) { m_bIsReturning = returning; }//used in EnterEvadeMode override - void SetCanAttack(bool attack) { m_bIsActiveAttacker = attack; } - uint64 GetEventStarterGUID() { return PlayerGUID; } - - // EscortAI variables - protected: - uint64 PlayerGUID; - bool IsBeingEscorted; - bool IsOnHold; - - private: - uint32 m_uiWPWaitTimer; - uint32 m_uiPlayerCheckTimer; - float MaxPlayerDistance; - - const Quest* m_pQuestForEscort; //generally passed in Start() when regular escort script. - - std::list WaypointList; - std::list::iterator CurrentWP; - - bool m_bIsActiveAttacker; //possible obsolete, and should be determined with db only (civilian) - bool m_bIsReturning; //in use when creature leave combat, and are returning to combat start position - bool m_bIsRunning; //all creatures are walking by default (has flag MOVEMENTFLAG_WALK) - bool m_bCanInstantRespawn; //if creature should respawn instantly after escort over (if not, database respawntime are used) - bool m_bCanReturnToStart; //if creature can walk same path (loop) without despawn. Not for regular escort quests. - bool CanMelee; - bool DespawnAtEnd; - bool DespawnAtFar; - bool ScriptWP; -}; -#endif - diff --git a/src/bindings/scripts/base/escort_ai.cpp b/src/bindings/scripts/base/escort_ai.cpp new file mode 100644 index 00000000000..3f4c8601f90 --- /dev/null +++ b/src/bindings/scripts/base/escort_ai.cpp @@ -0,0 +1,409 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +/* ScriptData +SDName: Npc_EscortAI +SD%Complete: 100 +SDComment: +SDCategory: Npc +EndScriptData */ + +#include "precompiled.h" +#include "escort_ai.h" + +enum +{ + POINT_LAST_POINT = 0xFFFFFF, + POINT_HOME = 0xFFFFFE +}; + +extern std::list PointMovementList; + +void npc_escortAI::AttackStart(Unit* pWho) +{ + if (!pWho) + return; + + if (m_creature->Attack(pWho, true)) + { + if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == POINT_MOTION_TYPE) + m_creature->GetMotionMaster()->MovementExpired(); + + if (IsCombatMovement()) + m_creature->GetMotionMaster()->MoveChase(pWho); + } +} + +void npc_escortAI::MoveInLineOfSight(Unit* pWho) +{ + if (IsBeingEscorted && !m_bIsActiveAttacker) + return; + + ScriptedAI::MoveInLineOfSight(pWho); +} + +void npc_escortAI::JustDied(Unit* pKiller) +{ + if (!IsBeingEscorted || !PlayerGUID || !m_pQuestForEscort) + return; + + if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + { + if (Group* pGroup = pPlayer->GetGroup()) + { + for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + { + if (Player* pMember = pRef->getSource()) + { + if (pPlayer->GetQuestStatus(m_pQuestForEscort->GetQuestId()) == QUEST_STATUS_INCOMPLETE) + pPlayer->FailQuest(m_pQuestForEscort->GetQuestId()); + } + } + } + else + { + if (pPlayer->GetQuestStatus(m_pQuestForEscort->GetQuestId()) == QUEST_STATUS_INCOMPLETE) + pPlayer->FailQuest(m_pQuestForEscort->GetQuestId()); + } + } +} + +void npc_escortAI::JustRespawned() +{ + IsBeingEscorted = false; + IsOnHold = false; + + if (!IsCombatMovement()) + SetCombatMovement(true); + + //add a small delay before going to first waypoint, normal in near all cases + m_uiWPWaitTimer = 2500; + + if (m_creature->getFaction() != m_creature->GetCreatureInfo()->faction_A) + me->RestoreFaction(); + + Reset(); +} + +void npc_escortAI::ReturnToLastPoint() +{ + float x, y, z, o; + m_creature->GetHomePosition(x, y, z, o); + m_creature->GetMotionMaster()->MovePoint(POINT_LAST_POINT, x, y, z); +} + +void npc_escortAI::EnterEvadeMode() +{ + m_creature->RemoveAllAuras(); + m_creature->DeleteThreatList(); + m_creature->CombatStop(true); + m_creature->SetLootRecipient(NULL); + + if (IsBeingEscorted) + { + m_bIsReturning = true; + ReturnToLastPoint(); + debug_log("TSCR: EscortAI has left combat and is now returning to last point"); + } + else + m_creature->GetMotionMaster()->MoveTargetedHome(); + + Reset(); +} + +void npc_escortAI::UpdateAI(const uint32 uiDiff) +{ + //Waypoint Updating + if (IsBeingEscorted && !m_creature->getVictim() && m_uiWPWaitTimer && !m_bIsReturning) + { + if (m_uiWPWaitTimer <= uiDiff) + { + //End of the line + if (CurrentWP == WaypointList.end()) + { + if (DespawnAtEnd) + { + debug_log("TSCR: EscortAI reached end of waypoints"); + + if (m_bCanReturnToStart) + { + float fRetX, fRetY, fRetZ; + m_creature->GetRespawnCoord(fRetX, fRetY, fRetZ); + + m_creature->GetMotionMaster()->MovePoint(POINT_HOME, fRetX, fRetY, fRetZ); + + m_uiWPWaitTimer = 0; + + debug_log("TSCR: EscortAI are returning home to spawn location: %u, %f, %f, %f", POINT_HOME, fRetX, fRetY, fRetZ); + return; + } + + if (m_bCanInstantRespawn) + { + m_creature->setDeathState(JUST_DIED); + m_creature->Respawn(); + } + else + m_creature->ForcedDespawn(); + + return; + } + else + { + debug_log("TSCR: EscortAI reached end of waypoints with Despawn off"); + + return; + } + } + + if (!IsOnHold) + { + m_creature->GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); + debug_log("TSCR: EscortAI Next WP is: %u, %f, %f, %f", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); + m_uiWPWaitTimer = 0; + } + } + else + m_uiWPWaitTimer -= uiDiff; + } + + //Check if player or any member of his group is within range + if (IsBeingEscorted && PlayerGUID && !m_creature->getVictim() && !m_bIsReturning) + { + if (m_uiPlayerCheckTimer < uiDiff) + { + bool bIsMaxRangeExceeded = true; + + if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + { + if (Group* pGroup = pPlayer->GetGroup()) + { + for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + { + Player* pMember = pRef->getSource(); + + if (pMember && m_creature->IsWithinDistInMap(pMember, GetMaxPlayerDistance())) + { + bIsMaxRangeExceeded = false; + break; + } + } + } + else + { + if (m_creature->IsWithinDistInMap(pPlayer, GetMaxPlayerDistance())) + bIsMaxRangeExceeded = false; + } + } + + if (DespawnAtFar && bIsMaxRangeExceeded) + { + debug_log("TSCR: EscortAI failed because player/group was to far away or not found"); + + if (m_bCanInstantRespawn) + { + m_creature->setDeathState(JUST_DIED); + m_creature->Respawn(); + } + else + m_creature->ForcedDespawn(); + + return; + } + + m_uiPlayerCheckTimer = 1000; + } + else + m_uiPlayerCheckTimer -= uiDiff; + } + + if (CanMelee && UpdateVictim()) + DoMeleeAttackIfReady(); +} + +void npc_escortAI::MovementInform(uint32 uiMoveType, uint32 uiPointId) +{ + if (uiMoveType != POINT_MOTION_TYPE || !IsBeingEscorted) + return; + + //Combat start position reached, continue waypoint movement + if (uiPointId == POINT_LAST_POINT) + { + debug_log("TSCR: EscortAI has returned to original position before combat"); + + if (m_bIsRunning && m_creature->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE)) + m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + else if (!m_bIsRunning && !m_creature->HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE)) + m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + + m_bIsReturning = false; + + if (!m_uiWPWaitTimer) + m_uiWPWaitTimer = 1; + } + else if (uiPointId == POINT_HOME) + { + debug_log("TSCR: EscortAI has returned to original home location and will continue from beginning of waypoint list."); + + CurrentWP = WaypointList.begin(); + m_uiWPWaitTimer = 1; + } + else + { + //Make sure that we are still on the right waypoint + if (CurrentWP->id != uiPointId) + { + debug_log("TSCR ERROR: EscortAI reached waypoint out of order %d, expected %d", uiPointId, CurrentWP->id); + return; + } + + debug_log("TSCR: EscortAI Waypoint %d reached", CurrentWP->id); + + //Call WP function + WaypointReached(CurrentWP->id); + + m_uiWPWaitTimer = CurrentWP->WaitTimeMs + 1; + + ++CurrentWP; + } +} + +/* +void npc_escortAI::OnPossess(bool apply) +{ + // We got possessed in the middle of being escorted, store the point + // where we left off to come back to when possess is removed + if (IsBeingEscorted) + { + if (apply) + m_creature->GetPosition(LastPos.x, LastPos.y, LastPos.z); + else + { + Returning = true; + m_creature->GetMotionMaster()->MovementExpired(); + m_creature->GetMotionMaster()->MovePoint(WP_LAST_POINT, LastPos.x, LastPos.y, LastPos.z); + } + } +} +*/ + +void npc_escortAI::AddWaypoint(uint32 id, float x, float y, float z, uint32 WaitTimeMs) +{ + Escort_Waypoint t(id, x, y, z, WaitTimeMs); + + WaypointList.push_back(t); + + // i think SD2 no longer uses this function + ScriptWP = true; + /*PointMovement wp; + wp.m_uiCreatureEntry = me->GetEntry(); + wp.m_uiPointId = id; + wp.m_fX = x; + wp.m_fY = y; + wp.m_fZ = z; + wp.m_uiWaitTime = WaitTimeMs; + PointMovementMap[wp.m_uiCreatureEntry].push_back(wp);*/ +} + +void npc_escortAI::FillPointMovementListForCreature() +{ + UNORDERED_MAP >::iterator pPointsEntries = PointMovementMap.find(m_creature->GetEntry()); + + if (pPointsEntries != PointMovementMap.end()) + { + std::vector::iterator itr; + + for (itr = pPointsEntries->second.begin(); itr != pPointsEntries->second.end(); ++itr) + { + Escort_Waypoint pPoint(itr->m_uiPointId,itr->m_fX,itr->m_fY,itr->m_fZ,itr->m_uiWaitTime); + WaypointList.push_back(pPoint); + } + } +} + +void npc_escortAI::SetRun(bool bRun) +{ + if (bRun) + { + if (!m_bIsRunning) + m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + else + debug_log("TSCR: EscortAI attempt to set run mode, but is already running."); + } + else + { + if (m_bIsRunning) + m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + else + debug_log("TSCR: EscortAI attempt to set walk mode, but is already walking."); + } + m_bIsRunning = bRun; +} + +//TODO: get rid of this many variables passed in function. +void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID, const Quest* pQuest, bool bInstantRespawn, bool bCanLoopPath) +{ + if (m_creature->getVictim()) + { + debug_log("TSCR ERROR: EscortAI attempt to Start while in combat"); + return; + } + + if (IsBeingEscorted) + { + error_log("TSCR: EscortAI attempt to Start while already escorting"); + return; + } + + if(!ScriptWP) // sd2 never adds wp in script, but tc does + { + + if (!WaypointList.empty()) + WaypointList.clear(); + + FillPointMovementListForCreature(); + + } + + if (WaypointList.empty()) + { + error_db_log("TSCR: EscortAI Start with 0 waypoints (possible missing entry in script_waypoint)"); + return; + } + + //set variables + m_bIsActiveAttacker = bIsActiveAttacker; + m_bIsRunning = bRun; + + PlayerGUID = uiPlayerGUID; + m_pQuestForEscort = pQuest; + + m_bCanInstantRespawn = bInstantRespawn; + m_bCanReturnToStart = bCanLoopPath; + + if (m_bCanReturnToStart && m_bCanInstantRespawn) + debug_log("TSCR: EscortAI is set to return home after waypoint end and instant respawn at waypoint end. Creature will never despawn."); + + if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) + { + m_creature->GetMotionMaster()->MovementExpired(); + m_creature->GetMotionMaster()->MoveIdle(); + debug_log("TSCR: EscortAI start with WAYPOINT_MOTION_TYPE, changed to MoveIdle."); + } + + //disable npcflags + m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + + debug_log("TSCR: EscortAI started with %d waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = %d", WaypointList.size(), m_bIsActiveAttacker, m_bIsRunning, PlayerGUID); + + CurrentWP = WaypointList.begin(); + + //Set initial speed + if (m_bIsRunning) + m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + else + m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); + + IsBeingEscorted = true; +} diff --git a/src/bindings/scripts/base/escort_ai.h b/src/bindings/scripts/base/escort_ai.h new file mode 100644 index 00000000000..8ce82eb370a --- /dev/null +++ b/src/bindings/scripts/base/escort_ai.h @@ -0,0 +1,107 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +#ifndef SC_ESCORTAI_H +#define SC_ESCORTAI_H + +#define DEFAULT_MAX_PLAYER_DISTANCE 50 + +extern UNORDERED_MAP > PointMovementMap; + +struct Escort_Waypoint +{ + Escort_Waypoint(uint32 _id, float _x, float _y, float _z, uint32 _w) + { + id = _id; + x = _x; + y = _y; + z = _z; + WaitTimeMs = _w; + } + + uint32 id; + float x; + float y; + float z; + uint32 WaitTimeMs; +}; + +struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI +{ + public: + explicit npc_escortAI(Creature* pCreature) : ScriptedAI(pCreature), + IsBeingEscorted(false), IsOnHold(false), PlayerGUID(0), MaxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), CanMelee(true), m_uiPlayerCheckTimer(1000), m_uiWPWaitTimer(2500), m_bIsReturning(false), m_bIsActiveAttacker(true), m_bIsRunning(false), DespawnAtEnd(true), DespawnAtFar(true), m_pQuestForEscort(NULL), m_bCanInstantRespawn(false), m_bCanReturnToStart(false), ScriptWP(false) {} + ~npc_escortAI() {} + + // Pure Virtual Functions + virtual void WaypointReached(uint32) = 0; + + // CreatureAI functions + void AttackStart(Unit* who); + + void MoveInLineOfSight(Unit* who); + + void JustDied(Unit*); + + void JustRespawned(); + + void ReturnToLastPoint(); + + void EnterEvadeMode(); + + void UpdateAI(const uint32); + + void MovementInform(uint32, uint32); + + // EscortAI functions + void AddWaypoint(uint32 id, float x, float y, float z, uint32 WaitTimeMs = 0); + + void FillPointMovementListForCreature(); + + void Start(bool bIsActiveAttacker = true, bool bRun = false, uint64 uiPlayerGUID = 0, const Quest* pQuest = NULL, bool bInstantRespawn = false, bool bCanLoopPath = false); + + void SetRun(bool bRun = true); + + void SetMaxPlayerDistance(float newMax) { MaxPlayerDistance = newMax; } + float GetMaxPlayerDistance() { return MaxPlayerDistance; } + + bool IsEscorted() {return IsBeingEscorted;} + + void SetCanMelee(bool usemelee) { CanMelee = usemelee; } + void SetDespawnAtEnd(bool despawn) { DespawnAtEnd = despawn; } + void SetDespawnAtFar(bool despawn) { DespawnAtFar = despawn; } + bool GetAttack() { return m_bIsActiveAttacker; }//used in EnterEvadeMode override + bool GetIsBeingEscorted() { return IsBeingEscorted; }//used in EnterEvadeMode override + void SetReturning(bool returning) { m_bIsReturning = returning; }//used in EnterEvadeMode override + void SetCanAttack(bool attack) { m_bIsActiveAttacker = attack; } + uint64 GetEventStarterGUID() { return PlayerGUID; } + + // EscortAI variables + protected: + uint64 PlayerGUID; + bool IsBeingEscorted; + bool IsOnHold; + + private: + uint32 m_uiWPWaitTimer; + uint32 m_uiPlayerCheckTimer; + float MaxPlayerDistance; + + const Quest* m_pQuestForEscort; //generally passed in Start() when regular escort script. + + std::list WaypointList; + std::list::iterator CurrentWP; + + bool m_bIsActiveAttacker; //possible obsolete, and should be determined with db only (civilian) + bool m_bIsReturning; //in use when creature leave combat, and are returning to combat start position + bool m_bIsRunning; //all creatures are walking by default (has flag MOVEMENTFLAG_WALK) + bool m_bCanInstantRespawn; //if creature should respawn instantly after escort over (if not, database respawntime are used) + bool m_bCanReturnToStart; //if creature can walk same path (loop) without despawn. Not for regular escort quests. + bool CanMelee; + bool DespawnAtEnd; + bool DespawnAtFar; + bool ScriptWP; +}; +#endif + diff --git a/src/bindings/scripts/base/follower_ai.cpp b/src/bindings/scripts/base/follower_ai.cpp new file mode 100644 index 00000000000..eb847c219db --- /dev/null +++ b/src/bindings/scripts/base/follower_ai.cpp @@ -0,0 +1,309 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +/* ScriptData +SDName: FollowerAI +SD%Complete: 50 +SDComment: This AI is under development +SDCategory: Npc +EndScriptData */ + +#include "precompiled.h" +#include "follower_ai.h" + +const float MAX_PLAYER_DISTANCE = 100.0f; + +enum +{ + POINT_COMBAT_START = 0xFFFFFF +}; + +FollowerAI::FollowerAI(Creature* pCreature) : ScriptedAI(pCreature), + m_uiLeaderGUID(0), + m_pQuestForFollow(NULL), + m_uiUpdateFollowTimer(2500), + m_bIsFollowing(false), + m_bIsReturnToLeader(false), + m_bIsFollowComplete(false) +{} + +void FollowerAI::AttackStart(Unit* pWho) +{ + if (!pWho) + return; + + if (m_creature->Attack(pWho, true)) + { + m_creature->AddThreat(pWho, 0.0f); + m_creature->SetInCombatWith(pWho); + pWho->SetInCombatWith(m_creature); + + if (m_creature->hasUnitState(UNIT_STAT_FOLLOW)) + m_creature->clearUnitState(UNIT_STAT_FOLLOW); + + if (IsCombatMovement()) + m_creature->GetMotionMaster()->MoveChase(pWho); + } +} + +void FollowerAI::MoveInLineOfSight(Unit* pWho) +{ + if (!m_creature->hasUnitState(UNIT_STAT_STUNNED) && pWho->isTargetableForAttack() && + m_creature->IsHostileTo(pWho) && pWho->isInAccessiblePlaceFor(m_creature)) + { + if (!m_creature->canFly() && m_creature->GetDistanceZ(pWho) > CREATURE_Z_ATTACK_RANGE) + return; + + //This part provides assistance to a player that are attacked by pWho, even if out of normal aggro range + //It will cause m_creature to attack pWho that are attacking _any_ player (which has been confirmed may happen also on offi) + //The flag (type_flag) is unconfirmed, but used here for further research and is a good candidate. + if (m_creature->hasUnitState(UNIT_STAT_FOLLOW) && + m_creature->GetCreatureInfo()->type_flags & 0x01000 && + pWho->getVictim() && + pWho->getVictim()->GetCharmerOrOwnerPlayerOrPlayerItself() && + m_creature->IsWithinDistInMap(pWho, MAX_PLAYER_DISTANCE) && + m_creature->IsWithinLOSInMap(pWho)) + { + pWho->RemoveAurasDueToSpell(SPELL_AURA_MOD_STEALTH); + AttackStart(pWho); + } + else + { + float attackRadius = m_creature->GetAttackDistance(pWho); + if (m_creature->IsWithinDistInMap(pWho, attackRadius) && m_creature->IsWithinLOSInMap(pWho)) + { + if (!m_creature->getVictim()) + { + pWho->RemoveAurasDueToSpell(SPELL_AURA_MOD_STEALTH); + AttackStart(pWho); + } + else if (m_creature->GetMap()->IsDungeon()) + { + pWho->SetInCombatWith(m_creature); + m_creature->AddThreat(pWho, 0.0f); + } + } + } + } +} + +void FollowerAI::JustDied(Unit* pKiller) +{ + if (!m_bIsFollowing || !m_uiLeaderGUID) + return; + + //TODO: need a better check for quests with time limit. + if (Player* pPlayer = GetLeaderForFollower()) + { + if (Group* pGroup = pPlayer->GetGroup()) + { + for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + { + if (Player* pMember = pRef->getSource()) + { + if (pPlayer->GetQuestStatus(m_pQuestForFollow->GetQuestId()) == QUEST_STATUS_INCOMPLETE) + pPlayer->FailQuest(m_pQuestForFollow->GetQuestId()); + } + } + } + else + { + if (pPlayer->GetQuestStatus(m_pQuestForFollow->GetQuestId()) == QUEST_STATUS_INCOMPLETE) + pPlayer->FailQuest(m_pQuestForFollow->GetQuestId()); + } + } +} + +void FollowerAI::JustRespawned() +{ + m_bIsFollowing = false; + m_bIsReturnToLeader = false; + m_bIsFollowComplete = false; + + if (!IsCombatMovement()) + SetCombatMovement(true); + + if (m_creature->getFaction() != m_creature->GetCreatureInfo()->faction_A) + m_creature->setFaction(m_creature->GetCreatureInfo()->faction_A); + + Reset(); +} + +void FollowerAI::EnterEvadeMode() +{ + m_creature->RemoveAllAuras(); + m_creature->DeleteThreatList(); + m_creature->CombatStop(true); + m_creature->SetLootRecipient(NULL); + + if (m_bIsFollowing) + { + debug_log("SD2: FollowerAI left combat, returning to CombatStartPosition."); + + if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) + { + float fPosX, fPosY, fPosZ; + m_creature->GetPosition(fPosX, fPosY, fPosZ); + m_creature->GetMotionMaster()->MovePoint(POINT_COMBAT_START, fPosX, fPosY, fPosZ); + } + } + else + { + if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) + m_creature->GetMotionMaster()->MoveTargetedHome(); + } + + Reset(); +} + +void FollowerAI::UpdateAI(const uint32 uiDiff) +{ + if (m_bIsFollowing && !m_creature->getVictim()) + { + if (m_uiUpdateFollowTimer < uiDiff) + { + if (m_bIsFollowComplete) + { + debug_log("SD2: FollowerAI is set completed, despawns."); + m_creature->ForcedDespawn(); + return; + } + + bool bIsMaxRangeExceeded = true; + + if (Player* pPlayer = GetLeaderForFollower()) + { + if (m_bIsReturnToLeader) + { + debug_log("SD2: FollowerAI is returning to leader."); + m_creature->GetMotionMaster()->MoveFollow(pPlayer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + m_bIsReturnToLeader = false; + return; + } + + if (Group* pGroup = pPlayer->GetGroup()) + { + for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + { + Player* pMember = pRef->getSource(); + + if (pMember && m_creature->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE)) + { + bIsMaxRangeExceeded = false; + break; + } + } + } + else + { + if (m_creature->IsWithinDistInMap(pPlayer, MAX_PLAYER_DISTANCE)) + bIsMaxRangeExceeded = false; + } + } + + if (bIsMaxRangeExceeded) + { + debug_log("SD2: FollowerAI failed because player/group was to far away or not found"); + m_creature->ForcedDespawn(); + return; + } + + m_uiUpdateFollowTimer = 1000; + } + else + m_uiUpdateFollowTimer -= uiDiff; + } + + UpdateFollowerAI(uiDiff); +} + +void FollowerAI::UpdateFollowerAI(const uint32 uiDiff) +{ + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); +} + +void FollowerAI::MovementInform(uint32 uiMotionType, uint32 uiPointId) +{ + if (uiMotionType != POINT_MOTION_TYPE || !m_bIsFollowing) + return; + + if (uiPointId == POINT_COMBAT_START) + { + if (GetLeaderForFollower()) + m_bIsReturnToLeader = true; + else + m_creature->ForcedDespawn(); + } +} + +void FollowerAI::StartFollow(Player* pLeader, uint32 uiFactionForFollower, const Quest* pQuest) +{ + if (m_creature->getVictim()) + { + debug_log("SD2: FollowerAI attempt to StartFollow while in combat."); + return; + } + + if (m_bIsFollowing) + { + error_log("SD2: FollowerAI attempt to StartFollow while already following."); + return; + } + + //set variables + m_uiLeaderGUID = pLeader->GetGUID(); + + if (uiFactionForFollower) + m_creature->setFaction(uiFactionForFollower); + + m_pQuestForFollow = pQuest; + + if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) + { + m_creature->GetMotionMaster()->Clear(); + m_creature->GetMotionMaster()->MoveIdle(); + debug_log("SD2: FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle."); + } + + m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); + + m_creature->GetMotionMaster()->MoveFollow(pLeader, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); + + m_bIsFollowing = true; + + debug_log("SD2: FollowerAI start follow %s (GUID %u)", pLeader->GetName(), m_uiLeaderGUID); +} + +Player* FollowerAI::GetLeaderForFollower() +{ + if (Player* pLeader = (Player*)Unit::GetUnit(*m_creature, m_uiLeaderGUID)) + { + if (pLeader->isAlive()) + return pLeader; + else + { + if (Group* pGroup = pLeader->GetGroup()) + { + for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + { + Player* pMember = pRef->getSource(); + + if (pMember && pMember->isAlive() && m_creature->IsWithinDistInMap(pMember, MAX_PLAYER_DISTANCE)) + { + debug_log("SD2: FollowerAI GetLeader changed and returned new leader."); + m_uiLeaderGUID = pMember->GetGUID(); + return pMember; + break; + } + } + } + } + } + + debug_log("SD2: FollowerAI GetLeader can not find suitable leader."); + return NULL; +} diff --git a/src/bindings/scripts/base/follower_ai.h b/src/bindings/scripts/base/follower_ai.h new file mode 100644 index 00000000000..d62980d4951 --- /dev/null +++ b/src/bindings/scripts/base/follower_ai.h @@ -0,0 +1,50 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +#ifndef SC_FOLLOWERAI_H +#define SC_FOLLOWERAI_H + +class TRINITY_DLL_DECL FollowerAI : public ScriptedAI +{ + public: + explicit FollowerAI(Creature* pCreature); + ~FollowerAI() {} + + //virtual void WaypointReached(uint32 uiPointId) = 0; + + void MovementInform(uint32 uiMotionType, uint32 uiPointId); + + void AttackStart(Unit*); + + void MoveInLineOfSight(Unit*); + + void EnterEvadeMode(); + + void JustDied(Unit*); + + void JustRespawned(); + + void UpdateAI(const uint32); //the "internal" update, calls UpdateFollowerAI() + virtual void UpdateFollowerAI(const uint32); //used when it's needed to add code in update (abilities, scripted events, etc) + + void StartFollow(Player* pPlayer, uint32 uiFactionForFollower = 0, const Quest* pQuest = NULL); + + protected: + void SetFollowComplete() { m_bIsFollowComplete = true; } + bool IsFollowComplete() { return m_bIsFollowComplete; } + + Player* GetLeaderForFollower(); + + private: + uint64 m_uiLeaderGUID; + uint32 m_uiUpdateFollowTimer; + + bool m_bIsFollowing; + bool m_bIsReturnToLeader; + bool m_bIsFollowComplete; + + const Quest* m_pQuestForFollow; //normally we have a quest +}; + +#endif -- cgit v1.2.3 From 81ee07fa2a2ac050e56ed5666892e96997dd17bf Mon Sep 17 00:00:00 2001 From: Kudlaty Date: Sun, 16 Aug 2009 19:38:18 +0200 Subject: Merge [SD2] r1313 Implement new class SystemMgr for storage and management of script data. Move database load to new class and instead use functions in class to retrieve data from storage. --HG-- branch : trunk --- src/bindings/scripts/ScriptMgr.cpp | 312 ++++------------------------- src/bindings/scripts/base/escort_ai.cpp | 26 ++- src/bindings/scripts/base/escort_ai.h | 5 +- src/bindings/scripts/include/sc_creature.h | 10 - src/bindings/scripts/system/system.cpp | 233 +++++++++++++++++++++ src/bindings/scripts/system/system.h | 70 +++++++ 6 files changed, 362 insertions(+), 294 deletions(-) (limited to 'src/bindings/scripts/base') diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index 84215e01a0c..29744ccec9a 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -9,6 +9,7 @@ #include "ObjectMgr.h" #include "ProgressBar.h" #include "../system/ScriptLoader.h" +#include "../system/system.h" #define _FULLVERSION "TrinityScript" @@ -19,26 +20,8 @@ int num_sc_scripts; Script *m_scripts[MAX_SCRIPTS]; -DatabaseType TScriptDB; Config TScriptConfig; -// String text additional data, used in TextMap -struct StringTextData -{ - uint32 SoundId; - uint8 Type; - uint32 Language; - uint32 Emote; -}; - -#define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available - -// Text Maps -UNORDERED_MAP TextMap; - -// Waypoint map (escorts) -UNORDERED_MAP > PointMovementMap; - void FillSpellSummary(); void LoadOverridenSQLData(); void LoadOverridenDBCData(); @@ -56,228 +39,21 @@ void LoadDatabase() //Initialize connection to DB if (!dbstring.empty() && TScriptDB.Initialize(dbstring.c_str())) - outstring_log("TSCR: TrinityScript database: %s",dbstring.c_str()); - else - { - error_log("TSCR: Unable to connect to Database. Load database aborted."); - return; - } - - //***Preform all DB queries here*** - QueryResult *result; - - //Get Version information - result = TScriptDB.PQuery("SELECT script_version FROM version LIMIT 1"); - - if (result) - { - Field *fields = result->Fetch(); - outstring_log("TSCR: Database version is: %s", fields[0].GetString()); - outstring_log(""); - delete result; - - }else { - error_log("TSCR: Missing `version.script_version` information."); + outstring_log("TSCR: TrinityScript database at %s initialized", dbstring.c_str()); outstring_log(""); - } - - // Drop Existing Text Map, only done once and we are ready to add data from multiple sources. - TextMap.clear(); - - // Load Script Text - outstring_log("TSCR: Loading Script Texts..."); - LoadTrinityStrings(TScriptDB,"script_texts",TEXT_SOURCE_RANGE,1+(TEXT_SOURCE_RANGE*2)); - - // Gather Additional data from Script Texts - result = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM script_texts"); - - outstring_log("TSCR: Loading Script Texts additional data..."); - if (result) - { - barGoLink bar(result->GetRowCount()); - uint32 count = 0; - do - { - bar.step(); - Field* fields = result->Fetch(); - StringTextData temp; - - int32 i = fields[0].GetInt32(); - temp.SoundId = fields[1].GetInt32(); - temp.Type = fields[2].GetInt32(); - temp.Language = fields[3].GetInt32(); - temp.Emote = fields[4].GetInt32(); - - if (i >= 0) - { - error_db_log("TSCR: Entry %i in table `script_texts` is not a negative value.",i); - continue; - } - - if (i > TEXT_SOURCE_RANGE || i <= TEXT_SOURCE_RANGE*2) - { - error_db_log("TSCR: Entry %i in table `script_texts` is out of accepted entry range for table.",i); - continue; - } - - if (temp.SoundId) - { - if (!GetSoundEntriesStore()->LookupEntry(temp.SoundId)) - error_db_log("TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.",i, temp.SoundId); - } - - if (!GetLanguageDescByID(temp.Language)) - error_db_log("TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.",i, temp.Language); - - if (temp.Type > CHAT_TYPE_ZONE_YELL) - error_db_log("TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.",i, temp.Type); - - TextMap[i] = temp; - ++count; - } while (result->NextRow()); - - delete result; - - outstring_log(""); - outstring_log(">> TSCR: Loaded %u additional Script Texts data.", count); - }else - { - barGoLink bar(1); - bar.step(); - outstring_log(""); - outstring_log(">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty."); - } - - // Load Custom Text - outstring_log("TSCR: Loading Custom Texts..."); - LoadTrinityStrings(TScriptDB,"custom_texts",TEXT_SOURCE_RANGE*2,1+(TEXT_SOURCE_RANGE*3)); - - // Gather Additional data from Custom Texts - result = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM custom_texts"); - - outstring_log("TSCR: Loading Custom Texts additional data..."); - if (result) - { - barGoLink bar(result->GetRowCount()); - uint32 count = 0; - - do - { - bar.step(); - Field* fields = result->Fetch(); - StringTextData temp; - - int32 i = fields[0].GetInt32(); - temp.SoundId = fields[1].GetInt32(); - temp.Type = fields[2].GetInt32(); - temp.Language = fields[3].GetInt32(); - temp.Emote = fields[4].GetInt32(); - - if (i >= 0) - { - error_db_log("TSCR: Entry %i in table `custom_texts` is not a negative value.",i); - continue; - } - - if (i > TEXT_SOURCE_RANGE*2 || i <= TEXT_SOURCE_RANGE*3) - { - error_db_log("TSCR: Entry %i in table `custom_texts` is out of accepted entry range for table.",i); - continue; - } - - if (temp.SoundId) - { - if (!GetSoundEntriesStore()->LookupEntry(temp.SoundId)) - error_db_log("TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.",i, temp.SoundId); - } - - if (!GetLanguageDescByID(temp.Language)) - error_db_log("TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.",i, temp.Language); - - if (temp.Type > CHAT_TYPE_ZONE_YELL) - error_db_log("TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.",i, temp.Type); - - TextMap[i] = temp; - ++count; - } while (result->NextRow()); - - delete result; - - outstring_log(""); - outstring_log(">> Loaded %u additional Custom Texts data.", count); - }else - { - barGoLink bar(1); - bar.step(); - outstring_log(""); - outstring_log(">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty."); - } - - // Drop Existing Waypoint list - PointMovementMap.clear(); - uint64 uiCreatureCount = 0; - - // Load Waypoints - result = TScriptDB.PQuery("SELECT COUNT(entry) FROM script_waypoint GROUP BY entry"); - if (result) - { - uiCreatureCount = result->GetRowCount(); - delete result; - } - - outstring_log("TSCR: Loading Script Waypoints for %u creature(s)...", uiCreatureCount); - - result = TScriptDB.PQuery("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid"); - - if (result) - { - barGoLink bar(result->GetRowCount()); - uint32 uiNodeCount = 0; - - do - { - bar.step(); - Field* pFields = result->Fetch(); - PointMovement pTemp; - - pTemp.m_uiCreatureEntry = pFields[0].GetUInt32(); - uint32 uiCreatureEntry = pTemp.m_uiCreatureEntry; - pTemp.m_uiPointId = pFields[1].GetUInt32(); - pTemp.m_fX = pFields[2].GetFloat(); - pTemp.m_fY = pFields[3].GetFloat(); - pTemp.m_fZ = pFields[4].GetFloat(); - pTemp.m_uiWaitTime = pFields[5].GetUInt32(); - - CreatureInfo const* pCInfo = GetCreatureTemplateStore(pTemp.m_uiCreatureEntry); - if (!pCInfo) - { - error_db_log("TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", pTemp.m_uiCreatureEntry); - continue; - } - - if (!pCInfo->ScriptID) - error_db_log("TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", pTemp.m_uiCreatureEntry); - - PointMovementMap[uiCreatureEntry].push_back(pTemp); - ++uiNodeCount; - } while (result->NextRow()); - - delete result; - - outstring_log(""); - outstring_log(">> Loaded %u Script Waypoint nodes.", uiNodeCount); + pSystemMgr.LoadVersion(); + pSystemMgr.LoadScriptTexts(); + pSystemMgr.LoadScriptTextsCustom(); + pSystemMgr.LoadScriptWaypoints(); } else { - barGoLink bar(1); - bar.step(); - outstring_log(""); - outstring_log(">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty."); + error_log("TSCR: Unable to connect to Database. Load database aborted."); + return; } - //Free database thread and resources TScriptDB.HaltDelayThread(); } @@ -303,8 +79,6 @@ void ScriptsFree() TRINITY_DLL_EXPORT void ScriptsInit(char const* cfg_file = "trinitycore.conf") { - bool CanLoadDB = true; - //Trinity Script startup outstring_log(" _____ _ _ _ ____ _ _"); outstring_log("|_ _| __(_)_ __ (_) |_ _ _/ ___| ___ _ __(_)_ __ | |_ "); @@ -317,17 +91,14 @@ void ScriptsInit(char const* cfg_file = "trinitycore.conf") //Get configuration file if (!TScriptConfig.SetSource(cfg_file)) - { - CanLoadDB = false; error_log("TSCR: Unable to open configuration file. Database will be unaccessible. Configuration values will use default."); - } - else outstring_log("TSCR: Using configuration file %s",cfg_file); + else + outstring_log("TSCR: Using configuration file %s",cfg_file); outstring_log(""); - //Load database (must be called after TScriptConfig.SetSource). In case it failed, no need to even try load. - if (CanLoadDB) - LoadDatabase(); + //Load database (must be called after SD2Config.SetSource). + LoadDatabase(); outstring_log("TSCR: Loading C++ scripts"); barGoLink bar(1); @@ -352,78 +123,78 @@ void ScriptsInit(char const* cfg_file = "trinitycore.conf") //********************************* //*** Functions used globally *** -void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target) +void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* pTarget) { if (!pSource) { - error_log("TSCR: DoScriptText entry %i, invalid Source pointer.",textEntry); + error_log("TSCR: DoScriptText entry %i, invalid Source pointer.", iTextEntry); return; } - if (textEntry >= 0) + if (iTextEntry >= 0) { - error_log("TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.",pSource->GetEntry(),pSource->GetTypeId(),pSource->GetGUIDLow(),textEntry); + error_log("TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) attempts to process text entry %i, but text entry must be negative.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry); return; } - UNORDERED_MAP::iterator i = TextMap.find(textEntry); + const StringTextData* pData = pSystemMgr.GetTextData(iTextEntry); - if (i == TextMap.end()) + if (!pData) { - error_log("TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.",pSource->GetEntry(),pSource->GetTypeId(),pSource->GetGUIDLow(),textEntry); + error_log("TSCR: DoScriptText with source entry %u (TypeId=%u, guid=%u) could not find text entry %i.", pSource->GetEntry(), pSource->GetTypeId(), pSource->GetGUIDLow(), iTextEntry); return; } - debug_log("TSCR: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u",textEntry,(*i).second.SoundId,(*i).second.Type,(*i).second.Language,(*i).second.Emote); + debug_log("TSCR: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u", iTextEntry, pData->uiSoundId, pData->uiType, pData->uiLanguage, pData->uiEmote); - if((*i).second.SoundId) + if(pData->uiSoundId) { - if(GetSoundEntriesStore()->LookupEntry((*i).second.SoundId)) + if(GetSoundEntriesStore()->LookupEntry(pData->uiSoundId)) { - pSource->SendPlaySound((*i).second.SoundId, false); + pSource->SendPlaySound(pData->uiSoundId, false); } else - error_log("TSCR: DoScriptText entry %i tried to process invalid sound id %u.",textEntry,(*i).second.SoundId); + error_log("TSCR: DoScriptText entry %i tried to process invalid sound id %u.", iTextEntry, pData->uiSoundId); } - if((*i).second.Emote) + if(pData->uiEmote) { if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER) - { - ((Unit*)pSource)->HandleEmoteCommand((*i).second.Emote); - } + ((Unit*)pSource)->HandleEmoteCommand(pData->uiEmote); else - error_log("TSCR: DoScriptText entry %i tried to process emote for invalid TypeId (%u).",textEntry, pSource->GetTypeId()); + error_log("TSCR: DoScriptText entry %i tried to process emote for invalid TypeId (%u).", iTextEntry, pSource->GetTypeId()); } - switch((*i).second.Type) + switch(pData->uiType) { case CHAT_TYPE_SAY: - pSource->MonsterSay(textEntry, (*i).second.Language, target ? target->GetGUID() : 0); + pSource->MonsterSay(iTextEntry, pData->uiLanguage, pTarget ? pTarget->GetGUID() : 0); break; case CHAT_TYPE_YELL: - pSource->MonsterYell(textEntry, (*i).second.Language, target ? target->GetGUID() : 0); + pSource->MonsterYell(iTextEntry, pData->uiLanguage, pTarget ? pTarget->GetGUID() : 0); break; case CHAT_TYPE_TEXT_EMOTE: - pSource->MonsterTextEmote(textEntry, target ? target->GetGUID() : 0); + pSource->MonsterTextEmote(iTextEntry, pTarget ? pTarget->GetGUID() : 0); break; case CHAT_TYPE_BOSS_EMOTE: - pSource->MonsterTextEmote(textEntry, target ? target->GetGUID() : 0, true); + pSource->MonsterTextEmote(iTextEntry, pTarget ? pTarget->GetGUID() : 0, true); break; case CHAT_TYPE_WHISPER: { - if (target && target->GetTypeId() == TYPEID_PLAYER) - pSource->MonsterWhisper(textEntry, target->GetGUID()); - else error_log("TSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry); + if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) + pSource->MonsterWhisper(iTextEntry, pTarget->GetGUID()); + else + error_log("TSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry); }break; case CHAT_TYPE_BOSS_WHISPER: { - if (target && target->GetTypeId() == TYPEID_PLAYER) - pSource->MonsterWhisper(textEntry, target->GetGUID(), true); - else error_log("TSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", textEntry); + if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) + pSource->MonsterWhisper(iTextEntry, pTarget->GetGUID(), true); + else + error_log("TSCR: DoScriptText entry %i cannot whisper without target unit (TYPEID_PLAYER).", iTextEntry); }break; case CHAT_TYPE_ZONE_YELL: - pSource->MonsterYellToZone(textEntry, (*i).second.Language, target ? target->GetGUID() : 0); + pSource->MonsterYellToZone(iTextEntry, pData->uiLanguage, pTarget ? pTarget->GetGUID() : 0); break; } } @@ -454,6 +225,7 @@ char const* ScriptsVersion() { return "Default Trinity scripting library"; } + TRINITY_DLL_EXPORT bool GossipHello (Player * pPlayer, Creature* pCreature) { diff --git a/src/bindings/scripts/base/escort_ai.cpp b/src/bindings/scripts/base/escort_ai.cpp index 3f4c8601f90..f4979487d31 100644 --- a/src/bindings/scripts/base/escort_ai.cpp +++ b/src/bindings/scripts/base/escort_ai.cpp @@ -11,6 +11,7 @@ EndScriptData */ #include "precompiled.h" #include "escort_ai.h" +#include "../system/system.h" enum { @@ -18,8 +19,6 @@ enum POINT_HOME = 0xFFFFFE }; -extern std::list PointMovementList; - void npc_escortAI::AttackStart(Unit* pWho) { if (!pWho) @@ -218,6 +217,11 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff) m_uiPlayerCheckTimer -= uiDiff; } + UpdateEscortAI(uiDiff); +} + +void npc_escortAI::UpdateEscortAI(const uint32 uiDiff) +{ if (CanMelee && UpdateVictim()) DoMeleeAttackIfReady(); } @@ -308,17 +312,17 @@ void npc_escortAI::AddWaypoint(uint32 id, float x, float y, float z, uint32 Wait void npc_escortAI::FillPointMovementListForCreature() { - UNORDERED_MAP >::iterator pPointsEntries = PointMovementMap.find(m_creature->GetEntry()); + std::vector const &pPointsEntries = pSystemMgr.GetPointMoveList(m_creature->GetEntry()); - if (pPointsEntries != PointMovementMap.end()) - { - std::vector::iterator itr; + if (pPointsEntries.empty()) + return; - for (itr = pPointsEntries->second.begin(); itr != pPointsEntries->second.end(); ++itr) - { - Escort_Waypoint pPoint(itr->m_uiPointId,itr->m_fX,itr->m_fY,itr->m_fZ,itr->m_uiWaitTime); - WaypointList.push_back(pPoint); - } + std::vector::const_iterator itr; + + for (itr = pPointsEntries.begin(); itr != pPointsEntries.end(); ++itr) + { + Escort_Waypoint pPoint(itr->uiPointId, itr->fX, itr->fY, itr->fZ, itr->uiWaitTime); + WaypointList.push_back(pPoint); } } diff --git a/src/bindings/scripts/base/escort_ai.h b/src/bindings/scripts/base/escort_ai.h index 8ce82eb370a..5d27aebfec6 100644 --- a/src/bindings/scripts/base/escort_ai.h +++ b/src/bindings/scripts/base/escort_ai.h @@ -7,8 +7,6 @@ #define DEFAULT_MAX_PLAYER_DISTANCE 50 -extern UNORDERED_MAP > PointMovementMap; - struct Escort_Waypoint { Escort_Waypoint(uint32 _id, float _x, float _y, float _z, uint32 _w) @@ -50,7 +48,8 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI void EnterEvadeMode(); - void UpdateAI(const uint32); + void UpdateAI(const uint32); //the "internal" update, calls UpdateEscortAI() + virtual void UpdateEscortAI(const uint32); //used when it's needed to add code in update (abilities, scripted events, etc) void MovementInform(uint32, uint32); diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h index b0a885643fc..6baac76a8dd 100644 --- a/src/bindings/scripts/include/sc_creature.h +++ b/src/bindings/scripts/include/sc_creature.h @@ -41,16 +41,6 @@ class SummonList : private std::list Creature *m_creature; }; -struct PointMovement -{ - uint32 m_uiCreatureEntry; - uint32 m_uiPointId; - float m_fX; - float m_fY; - float m_fZ; - uint32 m_uiWaitTime; -}; - struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI { explicit ScriptedAI(Creature* creature); diff --git a/src/bindings/scripts/system/system.cpp b/src/bindings/scripts/system/system.cpp index ab62e530681..4ed51825262 100644 --- a/src/bindings/scripts/system/system.cpp +++ b/src/bindings/scripts/system/system.cpp @@ -19,4 +19,237 @@ */ #include "precompiled.h" +#include "system.h" +#include "ProgressBar.h" +#include "ObjectMgr.h" +#include "Database/DatabaseEnv.h" +DatabaseType TScriptDB; + +SystemMgr::SystemMgr() +{ +} + +SystemMgr& SystemMgr::Instance() +{ + static SystemMgr pSysMgr; + return pSysMgr; +} + +void SystemMgr::LoadVersion() +{ + //Get Version information + QueryResult* pResult = TScriptDB.PQuery("SELECT script_version FROM version LIMIT 1"); + + if (pResult) + { + Field* pFields = pResult->Fetch(); + + outstring_log("TSCR: Database version is: %s", pFields[0].GetString()); + outstring_log(""); + } + else + { + error_log("TSCR: Missing `version`.`script_version` information."); + outstring_log(""); + } +} + +void SystemMgr::LoadScriptTexts() +{ + outstring_log("TSCR: Loading Script Texts..."); + LoadTrinityStrings(TScriptDB,"script_texts",TEXT_SOURCE_RANGE,1+(TEXT_SOURCE_RANGE*2)); + + QueryResult* pResult = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM script_texts"); + + outstring_log("TSCR: Loading Script Texts additional data..."); + + if (pResult) + { + barGoLink bar(pResult->GetRowCount()); + uint32 uiCount = 0; + + do + { + bar.step(); + Field* pFields = pResult->Fetch(); + StringTextData pTemp; + + int32 iId = pFields[0].GetInt32(); + pTemp.uiSoundId = pFields[1].GetUInt32(); + pTemp.uiType = pFields[2].GetUInt32(); + pTemp.uiLanguage = pFields[3].GetUInt32(); + pTemp.uiEmote = pFields[4].GetUInt32(); + + if (iId >= 0) + { + error_db_log("TSCR: Entry %i in table `script_texts` is not a negative value.", iId); + continue; + } + + if (iId > TEXT_SOURCE_RANGE || iId <= TEXT_SOURCE_RANGE*2) + { + error_db_log("TSCR: Entry %i in table `script_texts` is out of accepted entry range for table.", iId); + continue; + } + + if (pTemp.uiSoundId) + { + if (!GetSoundEntriesStore()->LookupEntry(pTemp.uiSoundId)) + error_db_log("TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.", iId, pTemp.uiSoundId); + } + + if (!GetLanguageDescByID(pTemp.uiLanguage)) + error_db_log("TSCR: Entry %i in table `script_texts` using Language %u but Language does not exist.", iId, pTemp.uiLanguage); + + if (pTemp.uiType > CHAT_TYPE_ZONE_YELL) + error_db_log("TSCR: Entry %i in table `script_texts` has Type %u but this Chat Type does not exist.", iId, pTemp.uiType); + + m_mTextDataMap[iId] = pTemp; + ++uiCount; + } while (pResult->NextRow()); + + outstring_log(""); + outstring_log(">> Loaded %u additional Script Texts data.", uiCount); + } + else + { + barGoLink bar(1); + bar.step(); + outstring_log(""); + outstring_log(">> Loaded 0 additional Script Texts data. DB table `script_texts` is empty."); + } +} + +void SystemMgr::LoadScriptTextsCustom() +{ + outstring_log("TSCR: Loading Custom Texts..."); + LoadTrinityStrings(TScriptDB,"custom_texts",TEXT_SOURCE_RANGE*2,1+(TEXT_SOURCE_RANGE*3)); + + QueryResult* pResult = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM custom_texts"); + + outstring_log("TSCR: Loading Custom Texts additional data..."); + + if (pResult) + { + barGoLink bar(pResult->GetRowCount()); + uint32 uiCount = 0; + + do + { + bar.step(); + Field* pFields = pResult->Fetch(); + StringTextData pTemp; + + int32 iId = pFields[0].GetInt32(); + pTemp.uiSoundId = pFields[1].GetUInt32(); + pTemp.uiType = pFields[2].GetUInt32(); + pTemp.uiLanguage = pFields[3].GetUInt32(); + pTemp.uiEmote = pFields[4].GetUInt32(); + + if (iId >= 0) + { + error_db_log("TSCR: Entry %i in table `custom_texts` is not a negative value.", iId); + continue; + } + + if (iId > TEXT_SOURCE_RANGE*2 || iId <= TEXT_SOURCE_RANGE*3) + { + error_db_log("TSCR: Entry %i in table `custom_texts` is out of accepted entry range for table.", iId); + continue; + } + + if (pTemp.uiSoundId) + { + if (!GetSoundEntriesStore()->LookupEntry(pTemp.uiSoundId)) + error_db_log("TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, pTemp.uiSoundId); + } + + if (!GetLanguageDescByID(pTemp.uiLanguage)) + error_db_log("TSCR: Entry %i in table `custom_texts` using Language %u but Language does not exist.", iId, pTemp.uiLanguage); + + if (pTemp.uiType > CHAT_TYPE_ZONE_YELL) + error_db_log("TSCR: Entry %i in table `custom_texts` has Type %u but this Chat Type does not exist.", iId, pTemp.uiType); + + m_mTextDataMap[iId] = pTemp; + ++uiCount; + } while (pResult->NextRow()); + + outstring_log(""); + outstring_log(">> Loaded %u additional Custom Texts data.", uiCount); + } + else + { + barGoLink bar(1); + bar.step(); + outstring_log(""); + outstring_log(">> Loaded 0 additional Custom Texts data. DB table `custom_texts` is empty."); + } +} + +void SystemMgr::LoadScriptWaypoints() +{ + // Drop Existing Waypoint list + m_mPointMoveMap.clear(); + + uint64 uiCreatureCount = 0; + + // Load Waypoints + QueryResult* pResult = TScriptDB.PQuery("SELECT COUNT(entry) FROM script_waypoint GROUP BY entry"); + if (pResult) + { + uiCreatureCount = pResult->GetRowCount(); + delete pResult; + } + + outstring_log("TSCR: Loading Script Waypoints for %u creature(s)...", uiCreatureCount); + + pResult = TScriptDB.PQuery("SELECT entry, pointid, location_x, location_y, location_z, waittime FROM script_waypoint ORDER BY pointid"); + + if (pResult) + { + barGoLink bar(pResult->GetRowCount()); + uint32 uiNodeCount = 0; + + do + { + bar.step(); + Field* pFields = pResult->Fetch(); + ScriptPointMove pTemp; + + pTemp.uiCreatureEntry = pFields[0].GetUInt32(); + uint32 uiEntry = pTemp.uiCreatureEntry; + pTemp.uiPointId = pFields[1].GetUInt32(); + pTemp.fX = pFields[2].GetFloat(); + pTemp.fY = pFields[3].GetFloat(); + pTemp.fZ = pFields[4].GetFloat(); + pTemp.uiWaitTime = pFields[5].GetUInt32(); + + CreatureInfo const* pCInfo = GetCreatureTemplateStore(pTemp.uiCreatureEntry); + + if (!pCInfo) + { + error_db_log("TSCR: DB table script_waypoint has waypoint for non-existant creature entry %u", pTemp.uiCreatureEntry); + continue; + } + + if (!pCInfo->ScriptID) + error_db_log("TSCR: DB table script_waypoint has waypoint for creature entry %u, but creature does not have ScriptName defined and then useless.", pTemp.uiCreatureEntry); + + m_mPointMoveMap[uiEntry].push_back(pTemp); + ++uiNodeCount; + } while (pResult->NextRow()); + + delete pResult; + + outstring_log(""); + outstring_log(">> Loaded %u Script Waypoint nodes.", uiNodeCount); + } + else + { + barGoLink bar(1); + bar.step(); + outstring_log(""); + outstring_log(">> Loaded 0 Script Waypoints. DB table `script_waypoint` is empty."); + } +} diff --git a/src/bindings/scripts/system/system.h b/src/bindings/scripts/system/system.h index 886f31355a9..a9d35b6f3f0 100644 --- a/src/bindings/scripts/system/system.h +++ b/src/bindings/scripts/system/system.h @@ -5,4 +5,74 @@ #ifndef SC_SYSTEM_H #define SC_SYSTEM_H +extern DatabaseType TScriptDB; + +#define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available + +struct ScriptPointMove +{ + uint32 uiCreatureEntry; + uint32 uiPointId; + float fX; + float fY; + float fZ; + uint32 uiWaitTime; +}; + +struct StringTextData +{ + uint32 uiSoundId; + uint8 uiType; + uint32 uiLanguage; + uint32 uiEmote; +}; + +#define pSystemMgr SystemMgr::Instance() + +class SystemMgr +{ + public: + SystemMgr(); + ~SystemMgr() {} + + static SystemMgr& Instance(); + + //Maps and lists + typedef UNORDERED_MAP TextDataMap; + typedef UNORDERED_MAP > PointMoveMap; + + //Database + void LoadVersion(); + void LoadScriptTexts(); + void LoadScriptTextsCustom(); + void LoadScriptWaypoints(); + + //Retrive from storage + StringTextData const* GetTextData(int32 uiTextId) const + { + TextDataMap::const_iterator itr = m_mTextDataMap.find(uiTextId); + + if (itr == m_mTextDataMap.end()) + return NULL; + + return &itr->second; + } + + std::vector const &GetPointMoveList(uint32 uiCreatureEntry) const + { + static std::vector vEmpty; + + PointMoveMap::const_iterator itr = m_mPointMoveMap.find(uiCreatureEntry); + + if (itr == m_mPointMoveMap.end()) + return vEmpty; + + return itr->second; + } + + protected: + TextDataMap m_mTextDataMap; //additional data for text strings + PointMoveMap m_mPointMoveMap; //coordinates for waypoints +}; + #endif -- cgit v1.2.3 From 91f3d69edf754c4e62d973cf1ae81e9a2e36d7bc Mon Sep 17 00:00:00 2001 From: Kudlaty Date: Sun, 16 Aug 2009 21:46:31 +0200 Subject: Merge [SD2] r1314 Correct some spellId's and apply SD2 code style r1315 Correct more spells and apply SD2 code style r1316 Replace magic number with enum type name UNIT_DYNFLAG_DEAD r1317 Add support for quest 1249. Patch by jotapdiez r1318 Move AI's implementation from headers. Original patch/idea by DasBlub r1319 Convert script related to quest 938 to use followerAI r1320 Add new virtual function WaypointStart() to escortAI. --HG-- branch : trunk --- sql/FULL/world_script_waypoints.sql | 10 ++ sql/FULL/world_scripts_full.sql | 2 + sql/updates/5096_world_scripts.sql | 12 ++ src/bindings/scripts/CMakeLists.txt | 1 + src/bindings/scripts/VC80/80ScriptDev2.vcproj | 4 + src/bindings/scripts/VC90/90ScriptDev2.vcproj | 4 + src/bindings/scripts/base/escort_ai.cpp | 24 ++- src/bindings/scripts/base/escort_ai.h | 6 +- src/bindings/scripts/base/guard_ai.cpp | 5 + src/bindings/scripts/base/guard_ai.h | 4 +- src/bindings/scripts/include/sc_creature.cpp | 6 +- src/bindings/scripts/include/sc_creature.h | 2 +- .../scripts/eastern_kingdoms/dun_morogh.cpp | 2 +- .../scripts/eastern_kingdoms/elwynn_forest.cpp | 2 +- .../scholomance/boss_doctor_theolen_krastinov.cpp | 64 ++++---- .../eastern_kingdoms/scholomance/boss_vectus.cpp | 59 ++++---- .../scripts/scripts/eastern_kingdoms/wetlands.cpp | 167 +++++++++++++++++++++ .../scripts/scripts/kalimdor/teldrassil.cpp | 107 +++---------- src/bindings/scripts/scripts/outland/nagrand.cpp | 2 +- src/bindings/scripts/system/ScriptLoader.cpp | 2 + 20 files changed, 332 insertions(+), 153 deletions(-) create mode 100644 sql/updates/5096_world_scripts.sql create mode 100644 src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp (limited to 'src/bindings/scripts/base') diff --git a/sql/FULL/world_script_waypoints.sql b/sql/FULL/world_script_waypoints.sql index e6884155154..9dfa805c30f 100644 --- a/sql/FULL/world_script_waypoints.sql +++ b/sql/FULL/world_script_waypoints.sql @@ -13,6 +13,16 @@ CREATE TABLE script_waypoint ( PRIMARY KEY (entry, pointid) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Creature waypoints'; +DELETE FROM script_waypoint WHERE entry=4962; +INSERT INTO script_waypoint VALUES +(4962, 0, -3804.438965, -828.048035, 10.093068, 0, ''), +(4962, 1, -3803.934326, -835.772400, 10.077722, 0, ''), +(4962, 2, -3792.629150, -835.670898, 9.655657, 0, ''), +(4962, 3, -3772.433838, -835.345947, 10.868981, 0, ''), +(4962, 4, -3765.937256, -840.128601, 10.885593, 0, ''), +(4962, 5, -3738.633789, -830.997498, 11.057384, 0, ''), +(4962, 6, -3690.224121, -862.261597, 9.960449, 0, ''); + DELETE FROM script_waypoint WHERE entry=10638; INSERT INTO script_waypoint VALUES (10638, 0, -4903.521973, -1368.339844, -52.611, 5000, 'SAY_KAN_START'), diff --git a/sql/FULL/world_scripts_full.sql b/sql/FULL/world_scripts_full.sql index af5e9af4800..88f51044f53 100644 --- a/sql/FULL/world_scripts_full.sql +++ b/sql/FULL/world_scripts_full.sql @@ -1086,6 +1086,8 @@ UPDATE `creature_template` SET `ScriptName`='npc_defias_traitor' WHERE `entry`=4 UPDATE `creature_template` SET `ScriptName`='npc_daphne_stilwell' WHERE `entry`=6182; /* WETLANDS */ +UPDATE creature_template SET ScriptName='npc_tapoke_slim_jahn' WHERE entry=4962; +UPDATE creature_template SET ScriptName='npc_mikhail' WHERE entry=4963; /* WINTERSPRING */ UPDATE `creature_template` SET `ScriptName`='npc_lorax' WHERE `entry`=10918; diff --git a/sql/updates/5096_world_scripts.sql b/sql/updates/5096_world_scripts.sql new file mode 100644 index 00000000000..37bf49f3d7d --- /dev/null +++ b/sql/updates/5096_world_scripts.sql @@ -0,0 +1,12 @@ +UPDATE creature_template SET ScriptName='npc_tapoke_slim_jahn' WHERE entry=4962; +UPDATE creature_template SET ScriptName='npc_mikhail' WHERE entry=4963; + +DELETE FROM script_waypoint WHERE entry=4962; +INSERT INTO script_waypoint VALUES +(4962, 0, -3804.438965, -828.048035, 10.093068, 0, ''), +(4962, 1, -3803.934326, -835.772400, 10.077722, 0, ''), +(4962, 2, -3792.629150, -835.670898, 9.655657, 0, ''), +(4962, 3, -3772.433838, -835.345947, 10.868981, 0, ''), +(4962, 4, -3765.937256, -840.128601, 10.885593, 0, ''), +(4962, 5, -3738.633789, -830.997498, 11.057384, 0, ''), +(4962, 6, -3690.224121, -862.261597, 9.960449, 0, ''); diff --git a/src/bindings/scripts/CMakeLists.txt b/src/bindings/scripts/CMakeLists.txt index 571dbc1b2a9..285fb004c59 100644 --- a/src/bindings/scripts/CMakeLists.txt +++ b/src/bindings/scripts/CMakeLists.txt @@ -192,6 +192,7 @@ SET(trinityscript_LIB_SRCS scripts/eastern_kingdoms/undercity.cpp scripts/eastern_kingdoms/western_plaguelands.cpp scripts/eastern_kingdoms/westfall.cpp + scripts/eastern_kingdoms/wetlands.cpp scripts/examples/example_creature.cpp scripts/examples/example_escort.cpp scripts/examples/example_gossip_codebox.cpp diff --git a/src/bindings/scripts/VC80/80ScriptDev2.vcproj b/src/bindings/scripts/VC80/80ScriptDev2.vcproj index ee1a8c87592..635f9356908 100644 --- a/src/bindings/scripts/VC80/80ScriptDev2.vcproj +++ b/src/bindings/scripts/VC80/80ScriptDev2.vcproj @@ -1162,6 +1162,10 @@ RelativePath="..\scripts\eastern_kingdoms\westfall.cpp" > + + + + GetMotionMaster()->MovePoint(CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); - debug_log("TSCR: EscortAI Next WP is: %u, %f, %f, %f", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); + debug_log("TSCR: EscortAI start waypoint %u (%f, %f, %f).", CurrentWP->id, CurrentWP->x, CurrentWP->y, CurrentWP->z); + + WaypointStart(CurrentWP->id); + m_uiWPWaitTimer = 0; } } diff --git a/src/bindings/scripts/base/escort_ai.h b/src/bindings/scripts/base/escort_ai.h index 5d27aebfec6..663e11d79f6 100644 --- a/src/bindings/scripts/base/escort_ai.h +++ b/src/bindings/scripts/base/escort_ai.h @@ -28,12 +28,12 @@ struct Escort_Waypoint struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI { public: - explicit npc_escortAI(Creature* pCreature) : ScriptedAI(pCreature), - IsBeingEscorted(false), IsOnHold(false), PlayerGUID(0), MaxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), CanMelee(true), m_uiPlayerCheckTimer(1000), m_uiWPWaitTimer(2500), m_bIsReturning(false), m_bIsActiveAttacker(true), m_bIsRunning(false), DespawnAtEnd(true), DespawnAtFar(true), m_pQuestForEscort(NULL), m_bCanInstantRespawn(false), m_bCanReturnToStart(false), ScriptWP(false) {} + explicit npc_escortAI(Creature* pCreature); ~npc_escortAI() {} // Pure Virtual Functions - virtual void WaypointReached(uint32) = 0; + virtual void WaypointReached(uint32 uiPointId) = 0; + virtual void WaypointStart(uint32 uiPointId) {} // CreatureAI functions void AttackStart(Unit* who); diff --git a/src/bindings/scripts/base/guard_ai.cpp b/src/bindings/scripts/base/guard_ai.cpp index 7f1daa1e2df..b55eae2dbad 100644 --- a/src/bindings/scripts/base/guard_ai.cpp +++ b/src/bindings/scripts/base/guard_ai.cpp @@ -32,6 +32,11 @@ EndScriptData */ #define SAY_GUARD_SIL_AGGRO2 -1070002 #define SAY_GUARD_SIL_AGGRO3 -1070003 +guardAI::guardAI(Creature* pCreature) : ScriptedAI(pCreature), + GlobalCooldown(0), + BuffTimer(0) +{} + void guardAI::Reset() { GlobalCooldown = 0; diff --git a/src/bindings/scripts/base/guard_ai.h b/src/bindings/scripts/base/guard_ai.h index 85baa30fb9d..a7fff32e3ab 100644 --- a/src/bindings/scripts/base/guard_ai.h +++ b/src/bindings/scripts/base/guard_ai.h @@ -9,7 +9,9 @@ struct TRINITY_DLL_DECL guardAI : public ScriptedAI { - guardAI(Creature *c) : ScriptedAI(c) {} + public: + explicit guardAI(Creature* pCreature); + ~guardAI() {} uint32 GlobalCooldown; //This variable acts like the global cooldown that players have (1.5 seconds) uint32 BuffTimer; //This variable keeps track of buffs diff --git a/src/bindings/scripts/include/sc_creature.cpp b/src/bindings/scripts/include/sc_creature.cpp index 1d423574f42..aa64a6fcbf1 100644 --- a/src/bindings/scripts/include/sc_creature.cpp +++ b/src/bindings/scripts/include/sc_creature.cpp @@ -80,7 +80,11 @@ void SummonList::DespawnAll() } } -ScriptedAI::ScriptedAI(Creature* creature) : CreatureAI(creature), m_creature(creature), IsFleeing(false), m_bCombatMovement(true), m_uiEvadeCheckCooldown(2500) +ScriptedAI::ScriptedAI(Creature* pCreature) : CreatureAI(pCreature), + m_creature(pCreature), + IsFleeing(false), + m_bCombatMovement(true), + m_uiEvadeCheckCooldown(2500) { HeroicMode = m_creature->GetMap()->IsHeroic(); } diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h index 6baac76a8dd..74eea9ad599 100644 --- a/src/bindings/scripts/include/sc_creature.h +++ b/src/bindings/scripts/include/sc_creature.h @@ -43,7 +43,7 @@ class SummonList : private std::list struct TRINITY_DLL_DECL ScriptedAI : public CreatureAI { - explicit ScriptedAI(Creature* creature); + explicit ScriptedAI(Creature* pCreature); ~ScriptedAI() {} //************* diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/dun_morogh.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/dun_morogh.cpp index 7e61df13575..29731ca83e3 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/dun_morogh.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/dun_morogh.cpp @@ -43,7 +43,7 @@ struct TRINITY_DLL_DECL npc_narm_faulkAI : public ScriptedAI void Reset() { lifeTimer = 120000; - m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 32); + m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); m_creature->SetStandState(UNIT_STAND_STATE_DEAD); spellHit = false; } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/elwynn_forest.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/elwynn_forest.cpp index 67456755cd2..e44081d72ba 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/elwynn_forest.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/elwynn_forest.cpp @@ -43,7 +43,7 @@ struct TRINITY_DLL_DECL npc_henze_faulkAI : public ScriptedAI void Reset() { lifeTimer = 120000; - m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 32); + m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); m_creature->SetStandState(UNIT_STAND_STATE_DEAD); // lay down spellHit = false; } diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_doctor_theolen_krastinov.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_doctor_theolen_krastinov.cpp index badea0761e4..c4590243571 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_doctor_theolen_krastinov.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_doctor_theolen_krastinov.cpp @@ -24,30 +24,33 @@ EndScriptData */ #include "precompiled.h" #include "def_scholomance.h" -#define EMOTE_GENERIC_FRENZY_KILL -1000001 +enum +{ + EMOTE_GENERIC_FRENZY_KILL = -1000001, -#define SPELL_REND 18106 -#define SPELL_CLEAVE 15584 -#define SPELL_FRENZY 28371 + SPELL_REND = 16509, + SPELL_BACKHAND = 18103, + SPELL_FRENZY = 8269 +}; struct TRINITY_DLL_DECL boss_theolenkrastinovAI : public ScriptedAI { boss_theolenkrastinovAI(Creature *c) : ScriptedAI(c) {} - uint32 Rend_Timer; - uint32 Cleave_Timer; - uint32 Frenzy_Timer; + uint32 m_uiRend_Timer; + uint32 m_uiBackhand_Timer; + uint32 m_uiFrenzy_Timer; void Reset() { - Rend_Timer = 8000; - Cleave_Timer = 9000; - Frenzy_Timer =0; + m_uiRend_Timer = 8000; + m_uiBackhand_Timer = 9000; + m_uiFrenzy_Timer = 1000; } - void JustDied(Unit *killer) + void JustDied(Unit* pKiller) { - ScriptedInstance *pInstance = (m_creature->GetInstanceData()) ? (m_creature->GetInstanceData()) : NULL; + ScriptedInstance* pInstance = (m_creature->GetInstanceData()) ? (m_creature->GetInstanceData()) : NULL; if (pInstance) { pInstance->SetData(DATA_DOCTORTHEOLENKRASTINOV_DEATH, 0); @@ -57,44 +60,47 @@ struct TRINITY_DLL_DECL boss_theolenkrastinovAI : public ScriptedAI } } - void EnterCombat(Unit *who) - { - } - - void UpdateAI(const uint32 diff) + void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; //Rend_Timer - if (Rend_Timer < diff) + if (m_uiRend_Timer < uiDiff) { - DoCast(m_creature->getVictim(),SPELL_REND); - Rend_Timer = 10000; - }else Rend_Timer -= diff; + DoCast(m_creature->getVictim(), SPELL_REND); + m_uiRend_Timer = 10000; + } + else + m_uiRend_Timer -= uiDiff; - //Cleave_Timer - if (Cleave_Timer < diff) + //Backhand_Timer + if (m_uiBackhand_Timer < uiDiff) { - DoCast(m_creature->getVictim(),SPELL_CLEAVE); - Cleave_Timer = 10000; - }else Cleave_Timer -= diff; + DoCast(m_creature->getVictim(), SPELL_BACKHAND); + m_uiBackhand_Timer = 10000; + } + else + m_uiBackhand_Timer -= uiDiff; //Frenzy_Timer if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 26) { - if (Frenzy_Timer < diff) + if (m_uiFrenzy_Timer < uiDiff) { DoCast(m_creature,SPELL_FRENZY); DoScriptText(EMOTE_GENERIC_FRENZY_KILL, m_creature); - Frenzy_Timer = 8000; - }else Frenzy_Timer -= diff; + m_uiFrenzy_Timer = 120000; + } + else + m_uiFrenzy_Timer -= uiDiff; } DoMeleeAttackIfReady(); } }; + CreatureAI* GetAI_boss_theolenkrastinov(Creature* pCreature) { return new boss_theolenkrastinovAI (pCreature); diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_vectus.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_vectus.cpp index 9d343d26a7e..f12b5473abf 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_vectus.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scholomance/boss_vectus.cpp @@ -23,65 +23,72 @@ EndScriptData */ #include "precompiled.h" -#define EMOTE_GENERIC_FRENZY_KILL -1000001 +enum +{ + EMOTE_GENERIC_FRENZY_KILL = -1000001, -#define SPELL_FIRESHIELD 19626 -#define SPELL_BLASTWAVE 13021 -#define SPELL_FRENZY 28371 + SPELL_FLAMESTRIKE = 18399, + SPELL_BLAST_WAVE = 16046, + SPELL_FIRESHIELD = 19626, + SPELL_FRENZY = 8269 //28371, +}; struct TRINITY_DLL_DECL boss_vectusAI : public ScriptedAI { boss_vectusAI(Creature *c) : ScriptedAI(c) {} - uint32 FireShield_Timer; - uint32 BlastWave_Timer; - uint32 Frenzy_Timer; + uint32 m_uiFireShield_Timer; + uint32 m_uiBlastWave_Timer; + uint32 m_uiFrenzy_Timer; void Reset() { - FireShield_Timer = 2000; - BlastWave_Timer = 14000; - Frenzy_Timer = 0; - } - - void EnterCombat(Unit *who) - { + m_uiFireShield_Timer = 2000; + m_uiBlastWave_Timer = 14000; + m_uiFrenzy_Timer = 0; } - void UpdateAI(const uint32 diff) + void UpdateAI(const uint32 uiDiff) { if (!UpdateVictim()) return; //FireShield_Timer - if (FireShield_Timer < diff) + if (m_uiFireShield_Timer < uiDiff) { DoCast(m_creature, SPELL_FIRESHIELD); - FireShield_Timer = 90000; - }else FireShield_Timer -= diff; + m_uiFireShield_Timer = 90000; + } + else + m_uiFireShield_Timer -= uiDiff; //BlastWave_Timer - if (BlastWave_Timer < diff) + if (m_uiBlastWave_Timer < uiDiff) { - DoCast(m_creature->getVictim(),SPELL_BLASTWAVE); - BlastWave_Timer = 12000; - }else BlastWave_Timer -= diff; + DoCast(m_creature->getVictim(), SPELL_BLAST_WAVE); + m_uiBlastWave_Timer = 12000; + } + else + m_uiBlastWave_Timer -= uiDiff; //Frenzy_Timer if (m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 25) { - if (Frenzy_Timer < diff) + if (m_uiFrenzy_Timer < uiDiff) { - DoCast(m_creature,SPELL_FRENZY); + DoCast(m_creature, SPELL_FRENZY); DoScriptText(EMOTE_GENERIC_FRENZY_KILL, m_creature); - Frenzy_Timer = 24000; - }else Frenzy_Timer -= diff; + m_uiFrenzy_Timer = 24000; + } + else + m_uiFrenzy_Timer -= uiDiff; } DoMeleeAttackIfReady(); } }; + CreatureAI* GetAI_boss_vectus(Creature* pCreature) { return new boss_vectusAI (pCreature); diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp new file mode 100644 index 00000000000..4a9d944cb3e --- /dev/null +++ b/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp @@ -0,0 +1,167 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Wetlands +SD%Complete: 80 +SDComment: Quest support: 1249 +SDCategory: Wetlands +EndScriptData */ + +/* ContentData +npc_mikhail +npc_tapoke_slim_jahn +EndContentData */ + +#include "precompiled.h" +#include "escort_ai.h" + +/*###### +## npc_tapoke_slim_jahn +######*/ + +enum +{ + QUEST_MISSING_DIPLO_PT11 = 1249, + FACTION_ENEMY = 168, + SPELL_STEALTH = 1785, + NPC_SLIMS_FRIEND = 4971, + NPC_TAPOKE_SLIM_JAHN = 4962 +}; + +struct TRINITY_DLL_DECL npc_tapoke_slim_jahnAI : public npc_escortAI +{ + npc_tapoke_slim_jahnAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + bool m_bFriendSummoned; + + void Reset() + { + if (!IsBeingEscorted) + m_bFriendSummoned = false; + } + + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 2: + if (m_creature->HasStealthAura()) + m_creature->RemoveAurasDueToSpell(SPELL_AURA_MOD_STEALTH); + + SetRun(); + m_creature->setFaction(FACTION_ENEMY); + break; + } + } + + void Aggro(Unit* pWho) + { + Unit* pPlayer = Unit::GetUnit(*m_creature, PlayerGUID); + + if (IsBeingEscorted && !m_bFriendSummoned && pPlayer) + { + m_creature->SummonCreature(NPC_SLIMS_FRIEND, 0.0f, 0.0f, 0.0f, 3.10f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + m_creature->SummonCreature(NPC_SLIMS_FRIEND, 0.0f, 0.0f, 0.0f, 2.35f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + m_creature->SummonCreature(NPC_SLIMS_FRIEND, 0.0f, 0.0f, 0.0f, 2.02f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + m_bFriendSummoned = true; + } + } + + void JustSummoned(Creature* pSummoned) + { + if (Unit* pPlayer = Unit::GetPlayer(PlayerGUID)) + pSummoned->AI()->AttackStart(pPlayer); + } + + void AttackedBy(Unit* pAttacker) + { + if (m_creature->getVictim()) + return; + + if (m_creature->IsFriendlyTo(pAttacker)) + return; + + AttackStart(pAttacker); + } + + void DamageTaken(Unit* pDoneBy, uint32& uiDamage) + { + if (m_creature->GetHealth()*100 < m_creature->GetMaxHealth()*20) + { + if (Unit* pPlayer = Unit::GetUnit(*m_creature, PlayerGUID)) + { + if (pPlayer->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(pPlayer)->GroupEventHappens(QUEST_MISSING_DIPLO_PT11, m_creature); + + uiDamage = 0; + + me->RestoreFaction(); + m_creature->RemoveAllAuras(); + m_creature->DeleteThreatList(); + m_creature->CombatStop(true); + + SetRun(false); + } + } + } +}; + +CreatureAI* GetAI_npc_tapoke_slim_jahn(Creature* pCreature) +{ + return new npc_tapoke_slim_jahnAI(pCreature); +} + +/*###### +## npc_mikhail +######*/ + +bool QuestAccept_npc_mikhail(Player* pPlayer, Creature* pCreature, const Quest* pQuest) +{ + if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT11) + { + Creature* pSlim = pCreature->FindNearestCreature(NPC_TAPOKE_SLIM_JAHN, 25.0f); + + if (!pSlim) + return false; + + if (!pSlim->HasStealthAura()) + pSlim->CastSpell(pSlim, SPELL_STEALTH, true); + + if (npc_tapoke_slim_jahnAI* pEscortAI = CAST_AI(npc_tapoke_slim_jahnAI, pSlim->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); + } + return false; +} + +/*###### +## AddSC +######*/ + +void AddSC_wetlands() +{ + Script *newscript; + + newscript = new Script; + newscript->Name = "npc_tapoke_slim_jahn"; + newscript->GetAI = &GetAI_npc_tapoke_slim_jahn; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_mikhail"; + newscript->pQuestAccept = &QuestAccept_npc_mikhail; + newscript->RegisterSelf(); +} diff --git a/src/bindings/scripts/scripts/kalimdor/teldrassil.cpp b/src/bindings/scripts/scripts/kalimdor/teldrassil.cpp index 58cb2a55b2f..40e849fbbe6 100644 --- a/src/bindings/scripts/scripts/kalimdor/teldrassil.cpp +++ b/src/bindings/scripts/scripts/kalimdor/teldrassil.cpp @@ -26,6 +26,7 @@ npc_mist EndContentData */ #include "precompiled.h" +#include "follower_ai.h" /*#### # npc_mist @@ -37,31 +38,20 @@ enum EMOTE_AT_HOME = -1000412, QUEST_MIST = 938, NPC_ARYNIA = 3519, + FACTION_DARNASSUS = 79 }; -struct TRINITY_DLL_DECL npc_mistAI : public ScriptedAI +struct TRINITY_DLL_DECL npc_mistAI : public FollowerAI { - npc_mistAI(Creature *c) : ScriptedAI(c) - { - uiNpcFlags = c->GetUInt32Value(UNIT_NPC_FLAGS); - uiPlayerGUID = 0; - } - - uint64 uiPlayerGUID; - uint32 uiNpcFlags; - uint32 uiCheckPlayerTimer; - - void Reset() - { - uiCheckPlayerTimer = 2500; + npc_mistAI(Creature* pCreature) : FollowerAI(pCreature) { } - if (!uiPlayerGUID) - m_creature->SetUInt32Value(UNIT_NPC_FLAGS, uiNpcFlags); - } + void Reset() { } void MoveInLineOfSight(Unit *pWho) { - if (pWho->GetEntry() == NPC_ARYNIA) + FollowerAI::MoveInLineOfSight(pWho); + + if (!m_creature->getVictim() && !IsFollowComplete() && pWho->GetEntry() == NPC_ARYNIA) { if (m_creature->IsWithinDistInMap(pWho, 10.0f)) { @@ -71,43 +61,11 @@ struct TRINITY_DLL_DECL npc_mistAI : public ScriptedAI } } - void EnterEvadeMode() - { - m_creature->RemoveAllAuras(); - m_creature->DeleteThreatList(); - m_creature->CombatStop(true); - m_creature->LoadCreaturesAddon(); - - if (m_creature->isAlive()) - { - if (Player* pPlayer = Unit::GetPlayer(uiPlayerGUID)) - m_creature->GetMotionMaster()->MoveFollow(pPlayer, PET_FOLLOW_DIST, m_creature->GetFollowAngle()); - else - { - m_creature->GetMotionMaster()->MovementExpired(); - m_creature->GetMotionMaster()->MoveTargetedHome(); - } - } - - m_creature->SetLootRecipient(NULL); - - Reset(); - } - - void DoStart(uint64 uiPlayer) - { - uiPlayerGUID = uiPlayer; - m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - - if (Player* pPlayer = Unit::GetPlayer(uiPlayer)) - m_creature->GetMotionMaster()->MoveFollow(pPlayer, PET_FOLLOW_DIST, m_creature->GetFollowAngle()); - } - void DoComplete() { DoScriptText(EMOTE_AT_HOME, m_creature); - if (Player* pPlayer = Unit::GetPlayer(uiPlayerGUID)) + if (Player* pPlayer = GetLeaderForFollower()) { if (pPlayer->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE) { @@ -115,55 +73,25 @@ struct TRINITY_DLL_DECL npc_mistAI : public ScriptedAI if (uiQuestLogSlot < MAX_QUEST_LOG_SIZE) { + //This will be wrong, need to check all group members (if any) for state before event if (pPlayer->GetQuestSlotState(uiQuestLogSlot) != QUEST_STATE_FAIL) pPlayer->AreaExploredOrEventHappens(QUEST_MIST); } } } - uiPlayerGUID = 0; - EnterEvadeMode(); - } - - void EnterCombat(Unit* who) { } - - void JustDied(Unit* pKiller) - { - if (Player* pPlayer = Unit::GetPlayer(uiPlayerGUID)) - pPlayer->FailQuest(QUEST_MIST); - - uiPlayerGUID = 0; - m_creature->GetMotionMaster()->MovementExpired(); + //The follow is over (and for later development to indicate a post event can now run) + SetFollowComplete(); } - void UpdateAI(const uint32 diff) + //call not needed here, no known abilities + /*void UpdateFollowerAI(const uint32 uiDiff) { - if (uiPlayerGUID) - { - if (!m_creature->isInCombat()) - { - if (uiCheckPlayerTimer < diff) - { - uiCheckPlayerTimer = 5000; - - Player* pPlayer = Unit::GetPlayer(uiPlayerGUID); - - if (pPlayer && !pPlayer->isAlive()) - { - uiPlayerGUID = 0; - EnterEvadeMode(); - } - } - else - uiCheckPlayerTimer -= diff; - } - } - if (!UpdateVictim()) return; DoMeleeAttackIfReady(); - } + }*/ }; CreatureAI* GetAI_npc_mist(Creature* pCreature) @@ -174,7 +102,10 @@ CreatureAI* GetAI_npc_mist(Creature* pCreature) bool QuestAccept_npc_mist(Player* pPlayer, Creature* pCreature, Quest const* pQuest) { if (pQuest->GetQuestId() == QUEST_MIST) - CAST_AI(npc_mistAI, (pCreature->AI()))->DoStart(pPlayer->GetGUID()); + { + if (npc_mistAI* pMistAI = CAST_AI(npc_mistAI, pCreature->AI())) + pMistAI->StartFollow(pPlayer, FACTION_DARNASSUS, pQuest); + } return true; } diff --git a/src/bindings/scripts/scripts/outland/nagrand.cpp b/src/bindings/scripts/scripts/outland/nagrand.cpp index 09435b91efe..865fc24f922 100644 --- a/src/bindings/scripts/scripts/outland/nagrand.cpp +++ b/src/bindings/scripts/scripts/outland/nagrand.cpp @@ -237,7 +237,7 @@ struct TRINITY_DLL_DECL mob_sunspring_villagerAI : public ScriptedAI void Reset() { - m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, 32); + m_creature->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); m_creature->SetStandState(UNIT_STAND_STATE_DEAD); } diff --git a/src/bindings/scripts/system/ScriptLoader.cpp b/src/bindings/scripts/system/ScriptLoader.cpp index 85221f5cb7e..024fbe7b7a1 100644 --- a/src/bindings/scripts/system/ScriptLoader.cpp +++ b/src/bindings/scripts/system/ScriptLoader.cpp @@ -188,6 +188,7 @@ extern void AddSC_tirisfal_glades(); extern void AddSC_undercity(); extern void AddSC_western_plaguelands(); extern void AddSC_westfall(); +extern void AddSC_wetlands(); //kalimdor extern void AddSC_instance_blackfathom_deeps(); //Blackfathom Depths @@ -573,6 +574,7 @@ void AddScripts() AddSC_undercity(); AddSC_western_plaguelands(); AddSC_westfall(); + AddSC_wetlands(); //kalimdor AddSC_instance_blackfathom_deeps(); //Blackfathom Depths -- cgit v1.2.3 From 5d2d8d8074eb7f845627fcc97645c8d0081be2ba Mon Sep 17 00:00:00 2001 From: Kudlaty Date: Sun, 16 Aug 2009 22:21:57 +0200 Subject: Merge [SD2] r1321 Add support for quest 863. Some cleanup in existing script. r1322 Correct database info for current supported Mangos revision (8273+) (Windows may use from 8190+) - skip r1323 Make escortAI function IsPlayerOrGroupInRange and move existing code to this. r1324 Fixed IsEncounterInProgress for Arcatraz, The Eye and Shadow Labyrinth r1325 Renamed aunchindoun to auchindoun. Fixed comment typos. --HG-- branch : trunk --- sql/FULL/world_script_waypoints.sql | 68 ++++ sql/FULL/world_scripts_full.sql | 1 + sql/updates/5097_world_scripts.sql | 69 ++++ src/bindings/scripts/CMakeLists.txt | 28 +- src/bindings/scripts/VC80/80ScriptDev2.vcproj | 28 +- src/bindings/scripts/VC90/90ScriptDev2.vcproj | 28 +- src/bindings/scripts/base/escort_ai.cpp | 52 +-- src/bindings/scripts/base/escort_ai.h | 2 + .../scripts/eastern_kingdoms/hinterlands.cpp | 168 ++++++-- .../auchenai_crypts/boss_exarch_maladaar.cpp | 358 +++++++++++++++++ .../boss_shirrak_the_dead_watcher.cpp | 212 ++++++++++ .../mana_tombs/boss_nexusprince_shaffar.cpp | 369 +++++++++++++++++ .../auchindoun/mana_tombs/boss_pandemonius.cpp | 138 +++++++ .../sethekk_halls/boss_darkweaver_syth.cpp | 438 +++++++++++++++++++++ .../sethekk_halls/boss_tailonking_ikiss.cpp | 221 +++++++++++ .../auchindoun/sethekk_halls/def_sethekk_halls.h | 14 + .../sethekk_halls/instance_sethekk_halls.cpp | 91 +++++ .../shadow_labyrinth/boss_ambassador_hellmaw.cpp | 217 ++++++++++ .../boss_blackheart_the_inciter.cpp | 177 +++++++++ .../shadow_labyrinth/boss_grandmaster_vorpil.cpp | 321 +++++++++++++++ .../auchindoun/shadow_labyrinth/boss_murmur.cpp | 207 ++++++++++ .../shadow_labyrinth/def_shadow_labyrinth.h | 15 + .../shadow_labyrinth/instance_shadow_labyrinth.cpp | 227 +++++++++++ .../auchenai_crypts/boss_exarch_maladaar.cpp | 358 ----------------- .../boss_shirrak_the_dead_watcher.cpp | 212 ---------- .../mana_tombs/boss_nexusprince_shaffar.cpp | 369 ----------------- .../aunchindoun/mana_tombs/boss_pandemonius.cpp | 138 ------- .../sethekk_halls/boss_darkweaver_syth.cpp | 438 --------------------- .../sethekk_halls/boss_tailonking_ikiss.cpp | 221 ----------- .../aunchindoun/sethekk_halls/def_sethekk_halls.h | 14 - .../sethekk_halls/instance_sethekk_halls.cpp | 91 ----- .../shadow_labyrinth/boss_ambassador_hellmaw.cpp | 217 ---------- .../boss_blackheart_the_inciter.cpp | 177 --------- .../shadow_labyrinth/boss_grandmaster_vorpil.cpp | 321 --------------- .../aunchindoun/shadow_labyrinth/boss_murmur.cpp | 207 ---------- .../shadow_labyrinth/def_shadow_labyrinth.h | 15 - .../shadow_labyrinth/instance_shadow_labyrinth.cpp | 227 ----------- .../tempest_keep/arcatraz/instance_arcatraz.cpp | 3 +- src/bindings/scripts/system/ScriptLoader.cpp | 16 +- 39 files changed, 3367 insertions(+), 3106 deletions(-) create mode 100644 sql/updates/5097_world_scripts.sql create mode 100644 src/bindings/scripts/scripts/outland/auchindoun/auchenai_crypts/boss_exarch_maladaar.cpp create mode 100644 src/bindings/scripts/scripts/outland/auchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp create mode 100644 src/bindings/scripts/scripts/outland/auchindoun/mana_tombs/boss_nexusprince_shaffar.cpp create mode 100644 src/bindings/scripts/scripts/outland/auchindoun/mana_tombs/boss_pandemonius.cpp create mode 100644 src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/boss_darkweaver_syth.cpp create mode 100644 src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/boss_tailonking_ikiss.cpp create mode 100644 src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/def_sethekk_halls.h create mode 100644 src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/instance_sethekk_halls.cpp create mode 100644 src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp create mode 100644 src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp create mode 100644 src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp create mode 100644 src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp create mode 100644 src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/def_shadow_labyrinth.h create mode 100644 src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp delete mode 100644 src/bindings/scripts/scripts/outland/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp delete mode 100644 src/bindings/scripts/scripts/outland/aunchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp delete mode 100644 src/bindings/scripts/scripts/outland/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp delete mode 100644 src/bindings/scripts/scripts/outland/aunchindoun/mana_tombs/boss_pandemonius.cpp delete mode 100644 src/bindings/scripts/scripts/outland/aunchindoun/sethekk_halls/boss_darkweaver_syth.cpp delete mode 100644 src/bindings/scripts/scripts/outland/aunchindoun/sethekk_halls/boss_tailonking_ikiss.cpp delete mode 100644 src/bindings/scripts/scripts/outland/aunchindoun/sethekk_halls/def_sethekk_halls.h delete mode 100644 src/bindings/scripts/scripts/outland/aunchindoun/sethekk_halls/instance_sethekk_halls.cpp delete mode 100644 src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp delete mode 100644 src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp delete mode 100644 src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp delete mode 100644 src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/boss_murmur.cpp delete mode 100644 src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/def_shadow_labyrinth.h delete mode 100644 src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp (limited to 'src/bindings/scripts/base') diff --git a/sql/FULL/world_script_waypoints.sql b/sql/FULL/world_script_waypoints.sql index 9dfa805c30f..86aee4a71ac 100644 --- a/sql/FULL/world_script_waypoints.sql +++ b/sql/FULL/world_script_waypoints.sql @@ -13,6 +13,74 @@ CREATE TABLE script_waypoint ( PRIMARY KEY (entry, pointid) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Creature waypoints'; +DELETE FROM script_waypoint WHERE entry=7806; +INSERT INTO script_waypoint VALUES +(7806, 0, 495.404358, -3478.350830, 114.837, 0, ''), +(7806, 1, 492.704742, -3486.112549, 108.627, 0, ''), +(7806, 2, 487.249756, -3485.764404, 107.890, 0, ''), +(7806, 3, 476.851959, -3489.875977, 99.985, 0, ''), +(7806, 4, 467.212402, -3493.355469, 99.819, 0, ''), +(7806, 5, 460.017029, -3496.984375, 104.481, 0, ''), +(7806, 6, 439.619446, -3500.730225, 110.534, 0, ''), +(7806, 7, 428.326385, -3495.874756, 118.662, 0, ''), +(7806, 8, 424.664032, -3489.381592, 121.999, 0, ''), +(7806, 9, 424.137299, -3470.952637, 124.333, 0, ''), +(7806, 10, 421.791107, -3449.242676, 119.126, 0, ''), +(7806, 11, 404.247070, -3429.376953, 117.644, 0, ''), +(7806, 12, 335.465271, -3430.717773, 116.456, 0, ''), +(7806, 13, 317.160126, -3426.708984, 116.226, 0, ''), +(7806, 14, 331.180115, -3464.002197, 117.143, 0, ''), +(7806, 15, 336.393616, -3501.877441, 118.201, 0, ''), +(7806, 16, 337.251312, -3544.764648, 117.284, 0, ''), +(7806, 17, 337.748932, -3565.415527, 116.797, 0, ''), +(7806, 18, 336.010925, -3597.363037, 118.225, 0, ''), +(7806, 19, 324.619141, -3622.884033, 119.811, 0, ''), +(7806, 20, 308.027466, -3648.600098, 123.047, 0, ''), +(7806, 21, 276.325409, -3685.738525, 128.356, 0, ''), +(7806, 22, 239.981064, -3717.330811, 131.874, 0, ''), +(7806, 23, 224.950974, -3730.169678, 132.125, 0, ''), +(7806, 24, 198.707870, -3768.292725, 129.420, 0, ''), +(7806, 25, 183.758316, -3791.068848, 128.045, 0, ''), +(7806, 26, 178.110657, -3801.575439, 128.370, 3000, 'SAY_OOX_DANGER'), +(7806, 27, 162.215225, -3827.014160, 129.424, 0, ''), +(7806, 28, 141.664734, -3864.519287, 131.419, 0, ''), +(7806, 29, 135.301697, -3880.089111, 132.120, 0, ''), +(7806, 30, 122.461151, -3910.071533, 135.605, 0, ''), +(7806, 31, 103.376175, -3937.725098, 137.342, 0, ''), +(7806, 32, 81.414474, -3958.614258, 138.469, 0, ''), +(7806, 33, 55.378139, -3982.004639, 136.520, 0, ''), +(7806, 34, 13.983131, -4013.952881, 126.903, 0, ''), +(7806, 35, -21.658007, -4048.713623, 118.068, 0, ''), +(7806, 36, -52.443058, -4081.209717, 117.477, 0, ''), +(7806, 37, -102.710854, -4116.760742, 118.666, 0, ''), +(7806, 38, -92.996193, -4135.847168, 119.310, 0, ''), +(7806, 39, -86.391273, -4153.331055, 122.502, 0, ''), +(7806, 40, -85.746086, -4163.600586, 121.892, 0, ''), +(7806, 41, -90.544006, -4183.577637, 117.587, 0, ''), +(7806, 42, -110.223564, -4205.861328, 121.878, 0, ''), +(7806, 43, -115.257607, -4211.962402, 121.878, 3000, 'SAY_OOX_DANGER'), +(7806, 44, -128.594650, -4233.343750, 117.766, 0, ''), +(7806, 45, -135.358917, -4258.120117, 117.562, 0, ''), +(7806, 46, -156.832428, -4258.961914, 120.059, 0, ''), +(7806, 47, -167.119873, -4274.102539, 117.062, 0, ''), +(7806, 48, -176.291016, -4287.594727, 118.721, 0, ''), +(7806, 49, -196.992981, -4315.815430, 117.588, 0, ''), +(7806, 50, -209.329300, -4331.671387, 115.142, 0, ''), +(7806, 51, -232.292236, -4356.015625, 108.543, 0, ''), +(7806, 52, -232.159683, -4370.904297, 102.815, 0, ''), +(7806, 53, -210.271133, -4389.896973, 84.167, 0, ''), +(7806, 54, -187.940186, -4407.532715, 70.987, 0, ''), +(7806, 55, -181.353577, -4418.771973, 64.778, 0, ''), +(7806, 56, -170.529861, -4440.438965, 58.943, 0, ''), +(7806, 57, -141.428543, -4465.323242, 45.963, 0, ''), +(7806, 58, -120.993629, -4487.088379, 32.075, 0, ''), +(7806, 59, -104.134621, -4501.837402, 25.051, 0, ''), +(7806, 60, -84.154663, -4529.436523, 11.952, 0, ''), +(7806, 61, -88.698898, -4544.626465, 9.055, 0, ''), +(7806, 62, -100.603447, -4575.034180, 11.388, 0, ''), +(7806, 63, -106.908669, -4600.407715, 11.046, 0, ''), +(7806, 64, -106.831703, -4620.503418, 11.057, 3000, 'SAY_OOX_COMPLETE'); + DELETE FROM script_waypoint WHERE entry=4962; INSERT INTO script_waypoint VALUES (4962, 0, -3804.438965, -828.048035, 10.093068, 0, ''), diff --git a/sql/FULL/world_scripts_full.sql b/sql/FULL/world_scripts_full.sql index 88f51044f53..ae503cd4e47 100644 --- a/sql/FULL/world_scripts_full.sql +++ b/sql/FULL/world_scripts_full.sql @@ -555,6 +555,7 @@ UPDATE `creature_template` SET `ScriptName`='npc_tracy_proudwell' WHERE `entry`= /* HILLSBRAD FOOTHILLS */ /* HINTERLANDS */ +UPDATE `creature_template` SET `ScriptName`='npc_00x09hl' WHERE `entry`=7806; UPDATE `creature_template` SET `ScriptName`='npc_rinji' WHERE `entry`=7780; /* ICECROWN */ diff --git a/sql/updates/5097_world_scripts.sql b/sql/updates/5097_world_scripts.sql new file mode 100644 index 00000000000..6a4f6f8cd61 --- /dev/null +++ b/sql/updates/5097_world_scripts.sql @@ -0,0 +1,69 @@ +UPDATE creature_template SET ScriptName='npc_00x09hl' WHERE entry=7806; + +DELETE FROM script_waypoint WHERE entry=7806; +INSERT INTO script_waypoint VALUES +(7806, 0, 495.404358, -3478.350830, 114.837, 0, ''), +(7806, 1, 492.704742, -3486.112549, 108.627, 0, ''), +(7806, 2, 487.249756, -3485.764404, 107.890, 0, ''), +(7806, 3, 476.851959, -3489.875977, 99.985, 0, ''), +(7806, 4, 467.212402, -3493.355469, 99.819, 0, ''), +(7806, 5, 460.017029, -3496.984375, 104.481, 0, ''), +(7806, 6, 439.619446, -3500.730225, 110.534, 0, ''), +(7806, 7, 428.326385, -3495.874756, 118.662, 0, ''), +(7806, 8, 424.664032, -3489.381592, 121.999, 0, ''), +(7806, 9, 424.137299, -3470.952637, 124.333, 0, ''), +(7806, 10, 421.791107, -3449.242676, 119.126, 0, ''), +(7806, 11, 404.247070, -3429.376953, 117.644, 0, ''), +(7806, 12, 335.465271, -3430.717773, 116.456, 0, ''), +(7806, 13, 317.160126, -3426.708984, 116.226, 0, ''), +(7806, 14, 331.180115, -3464.002197, 117.143, 0, ''), +(7806, 15, 336.393616, -3501.877441, 118.201, 0, ''), +(7806, 16, 337.251312, -3544.764648, 117.284, 0, ''), +(7806, 17, 337.748932, -3565.415527, 116.797, 0, ''), +(7806, 18, 336.010925, -3597.363037, 118.225, 0, ''), +(7806, 19, 324.619141, -3622.884033, 119.811, 0, ''), +(7806, 20, 308.027466, -3648.600098, 123.047, 0, ''), +(7806, 21, 276.325409, -3685.738525, 128.356, 0, ''), +(7806, 22, 239.981064, -3717.330811, 131.874, 0, ''), +(7806, 23, 224.950974, -3730.169678, 132.125, 0, ''), +(7806, 24, 198.707870, -3768.292725, 129.420, 0, ''), +(7806, 25, 183.758316, -3791.068848, 128.045, 0, ''), +(7806, 26, 178.110657, -3801.575439, 128.370, 3000, 'SAY_OOX_DANGER'), +(7806, 27, 162.215225, -3827.014160, 129.424, 0, ''), +(7806, 28, 141.664734, -3864.519287, 131.419, 0, ''), +(7806, 29, 135.301697, -3880.089111, 132.120, 0, ''), +(7806, 30, 122.461151, -3910.071533, 135.605, 0, ''), +(7806, 31, 103.376175, -3937.725098, 137.342, 0, ''), +(7806, 32, 81.414474, -3958.614258, 138.469, 0, ''), +(7806, 33, 55.378139, -3982.004639, 136.520, 0, ''), +(7806, 34, 13.983131, -4013.952881, 126.903, 0, ''), +(7806, 35, -21.658007, -4048.713623, 118.068, 0, ''), +(7806, 36, -52.443058, -4081.209717, 117.477, 0, ''), +(7806, 37, -102.710854, -4116.760742, 118.666, 0, ''), +(7806, 38, -92.996193, -4135.847168, 119.310, 0, ''), +(7806, 39, -86.391273, -4153.331055, 122.502, 0, ''), +(7806, 40, -85.746086, -4163.600586, 121.892, 0, ''), +(7806, 41, -90.544006, -4183.577637, 117.587, 0, ''), +(7806, 42, -110.223564, -4205.861328, 121.878, 0, ''), +(7806, 43, -115.257607, -4211.962402, 121.878, 3000, 'SAY_OOX_DANGER'), +(7806, 44, -128.594650, -4233.343750, 117.766, 0, ''), +(7806, 45, -135.358917, -4258.120117, 117.562, 0, ''), +(7806, 46, -156.832428, -4258.961914, 120.059, 0, ''), +(7806, 47, -167.119873, -4274.102539, 117.062, 0, ''), +(7806, 48, -176.291016, -4287.594727, 118.721, 0, ''), +(7806, 49, -196.992981, -4315.815430, 117.588, 0, ''), +(7806, 50, -209.329300, -4331.671387, 115.142, 0, ''), +(7806, 51, -232.292236, -4356.015625, 108.543, 0, ''), +(7806, 52, -232.159683, -4370.904297, 102.815, 0, ''), +(7806, 53, -210.271133, -4389.896973, 84.167, 0, ''), +(7806, 54, -187.940186, -4407.532715, 70.987, 0, ''), +(7806, 55, -181.353577, -4418.771973, 64.778, 0, ''), +(7806, 56, -170.529861, -4440.438965, 58.943, 0, ''), +(7806, 57, -141.428543, -4465.323242, 45.963, 0, ''), +(7806, 58, -120.993629, -4487.088379, 32.075, 0, ''), +(7806, 59, -104.134621, -4501.837402, 25.051, 0, ''), +(7806, 60, -84.154663, -4529.436523, 11.952, 0, ''), +(7806, 61, -88.698898, -4544.626465, 9.055, 0, ''), +(7806, 62, -100.603447, -4575.034180, 11.388, 0, ''), +(7806, 63, -106.908669, -4600.407715, 11.046, 0, ''), +(7806, 64, -106.831703, -4620.503418, 11.057, 3000, 'SAY_OOX_COMPLETE'); diff --git a/src/bindings/scripts/CMakeLists.txt b/src/bindings/scripts/CMakeLists.txt index 285fb004c59..58b91096c18 100644 --- a/src/bindings/scripts/CMakeLists.txt +++ b/src/bindings/scripts/CMakeLists.txt @@ -405,20 +405,20 @@ SET(trinityscript_LIB_SRCS scripts/northrend/sholazar_basin.cpp scripts/northrend/wintergrasp.cpp scripts/northrend/zuldrak.cpp - scripts/outland/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp - scripts/outland/aunchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp - scripts/outland/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp - scripts/outland/aunchindoun/mana_tombs/boss_pandemonius.cpp - scripts/outland/aunchindoun/sethekk_halls/boss_darkweaver_syth.cpp - scripts/outland/aunchindoun/sethekk_halls/boss_tailonking_ikiss.cpp - scripts/outland/aunchindoun/sethekk_halls/def_sethekk_halls.h - scripts/outland/aunchindoun/sethekk_halls/instance_sethekk_halls.cpp - scripts/outland/aunchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp - scripts/outland/aunchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp - scripts/outland/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp - scripts/outland/aunchindoun/shadow_labyrinth/boss_murmur.cpp - scripts/outland/aunchindoun/shadow_labyrinth/def_shadow_labyrinth.h - scripts/outland/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp + scripts/outland/auchindoun/auchenai_crypts/boss_exarch_maladaar.cpp + scripts/outland/auchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp + scripts/outland/auchindoun/mana_tombs/boss_nexusprince_shaffar.cpp + scripts/outland/auchindoun/mana_tombs/boss_pandemonius.cpp + scripts/outland/auchindoun/sethekk_halls/boss_darkweaver_syth.cpp + scripts/outland/auchindoun/sethekk_halls/boss_tailonking_ikiss.cpp + scripts/outland/auchindoun/sethekk_halls/def_sethekk_halls.h + scripts/outland/auchindoun/sethekk_halls/instance_sethekk_halls.cpp + scripts/outland/auchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp + scripts/outland/auchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp + scripts/outland/auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp + scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp + scripts/outland/auchindoun/shadow_labyrinth/def_shadow_labyrinth.h + scripts/outland/auchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp scripts/outland/black_temple/black_temple.cpp scripts/outland/black_temple/boss_bloodboil.cpp scripts/outland/black_temple/boss_illidan.cpp diff --git a/src/bindings/scripts/VC80/80ScriptDev2.vcproj b/src/bindings/scripts/VC80/80ScriptDev2.vcproj index 635f9356908..4c98db9abb2 100644 --- a/src/bindings/scripts/VC80/80ScriptDev2.vcproj +++ b/src/bindings/scripts/VC80/80ScriptDev2.vcproj @@ -2172,11 +2172,11 @@ Name="Auchenai Crypts" > @@ -2184,11 +2184,11 @@ Name="Mana Tombs" > @@ -2196,19 +2196,19 @@ Name="Sethekk Halls" > @@ -2216,27 +2216,27 @@ Name="Shadow Labyrinth" > diff --git a/src/bindings/scripts/VC90/90ScriptDev2.vcproj b/src/bindings/scripts/VC90/90ScriptDev2.vcproj index c6f403470cb..ee30f353115 100644 --- a/src/bindings/scripts/VC90/90ScriptDev2.vcproj +++ b/src/bindings/scripts/VC90/90ScriptDev2.vcproj @@ -2169,11 +2169,11 @@ Name="Auchenai Crypts" > @@ -2181,11 +2181,11 @@ Name="Mana Tombs" > @@ -2193,19 +2193,19 @@ Name="Sethekk Halls" > @@ -2213,27 +2213,27 @@ Name="Shadow Labyrinth" > diff --git a/src/bindings/scripts/base/escort_ai.cpp b/src/bindings/scripts/base/escort_ai.cpp index 2c28aa6b9a6..37c8c31981b 100644 --- a/src/bindings/scripts/base/escort_ai.cpp +++ b/src/bindings/scripts/base/escort_ai.cpp @@ -130,6 +130,32 @@ void npc_escortAI::EnterEvadeMode() Reset(); } +bool npc_escortAI::IsPlayerOrGroupInRange() +{ + if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + { + if (Group* pGroup = pPlayer->GetGroup()) + { + for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) + { + Player* pMember = pRef->getSource(); + + if (pMember && m_creature->IsWithinDistInMap(pMember, GetMaxPlayerDistance())) + { + return true; + break; + } + } + } + else + { + if (m_creature->IsWithinDistInMap(pPlayer, GetMaxPlayerDistance())) + return true; + } + } + return false; +} + void npc_escortAI::UpdateAI(const uint32 uiDiff) { //Waypoint Updating @@ -194,31 +220,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff) { if (m_uiPlayerCheckTimer < uiDiff) { - bool bIsMaxRangeExceeded = true; - - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) - { - if (Group* pGroup = pPlayer->GetGroup()) - { - for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next()) - { - Player* pMember = pRef->getSource(); - - if (pMember && m_creature->IsWithinDistInMap(pMember, GetMaxPlayerDistance())) - { - bIsMaxRangeExceeded = false; - break; - } - } - } - else - { - if (m_creature->IsWithinDistInMap(pPlayer, GetMaxPlayerDistance())) - bIsMaxRangeExceeded = false; - } - } - - if (DespawnAtFar && bIsMaxRangeExceeded) + if (DespawnAtFar && !IsPlayerOrGroupInRange()) { debug_log("TSCR: EscortAI failed because player/group was to far away or not found"); diff --git a/src/bindings/scripts/base/escort_ai.h b/src/bindings/scripts/base/escort_ai.h index 663e11d79f6..243e64d6d21 100644 --- a/src/bindings/scripts/base/escort_ai.h +++ b/src/bindings/scripts/base/escort_ai.h @@ -56,6 +56,8 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI // EscortAI functions void AddWaypoint(uint32 id, float x, float y, float z, uint32 WaitTimeMs = 0); + bool IsPlayerOrGroupInRange(); + void FillPointMovementListForCreature(); void Start(bool bIsActiveAttacker = true, bool bRun = false, uint64 uiPlayerGUID = 0, const Quest* pQuest = NULL, bool bInstantRespawn = false, bool bCanLoopPath = false); diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp index b02d3fb918b..6b661dad5ef 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp @@ -17,17 +17,125 @@ /* ScriptData SDName: Hinterlands SD%Complete: 100 -SDComment: Quest support: 2742 +SDComment: Quest support: 863, 2742 SDCategory: The Hinterlands EndScriptData */ /* ContentData +npc_00x09hl npc_rinji EndContentData */ #include "precompiled.h" #include "escort_ai.h" +/*###### +## npc_00x09hl +######*/ + +enum +{ + SAY_OOX_START = -1000416, + SAY_OOX_AGGRO = -1000417, + SAY_OOX_DANGER = -1000418, + SAY_OOX_COMPLETE = -1000419, + + QUEST_RESQUE_OOX_09 = 836, + + NPC_MARAUDING_OWL = 7808, + NPC_VILE_AMBUSHER = 7809, + + FACTION_ESCORTEE_A = 774, + FACTION_ESCORTEE_H = 775 +}; + +struct MANGOS_DLL_DECL npc_00x09hlAI : public npc_escortAI +{ + npc_00x09hlAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + void Reset() { } + + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 26: + DoScriptText(SAY_OOX_DANGER, m_creature); + break; + case 43: + DoScriptText(SAY_OOX_DANGER, m_creature); + break; + case 64: + DoScriptText(SAY_OOX_COMPLETE, m_creature); + if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + pPlayer->GroupEventHappens(QUEST_RESQUE_OOX_09, m_creature); + break; + } + } + + void WaypointStart(uint32 uiPointId) + { + switch(uiPointId) + { + case 27: + for(int i = 0; i < 3; ++i) + { + float fX, fY, fZ; + m_creature->GetRandomPoint(147.927444, -3851.513428, 130.893, 7.0f, fX, fY, fZ); + + m_creature->SummonCreature(NPC_MARAUDING_OWL, fX, fY, fZ, 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 25000); + } + break; + case 44: + for(int i = 0; i < 3; ++i) + { + float fX, fY, fZ; + m_creature->GetRandomPoint(-141.151581, -4291.213867, 120.130, 7.0f, fX, fY, fZ); + + m_creature->SummonCreature(NPC_VILE_AMBUSHER, fX, fY, fZ, 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 25000); + } + break; + } + } + + void Aggro(Unit* pWho) + { + if (pWho->GetEntry() == NPC_MARAUDING_OWL || pWho->GetEntry() == NPC_VILE_AMBUSHER) + return; + + DoScriptText(SAY_OOX_AGGRO, m_creature); + } + + void JustSummoned(Creature* pSummoned) + { + pSummoned->GetMotionMaster()->MovePoint(0, m_creature->GetPositionX(), m_creature->GetPositionY(), m_creature->GetPositionZ()); + } +}; + +bool QuestAccept_npc_00x09hl(Player* pPlayer, Creature* pCreature, const Quest* pQuest) +{ + if (pQuest->GetQuestId() == QUEST_RESQUE_OOX_09) + { + pCreature->SetStandState(UNIT_STAND_STATE_STAND); + + if (pPlayer->GetTeam() == ALLIANCE) + pCreature->setFaction(FACTION_ESCORTEE_A); + else if (pPlayer->GetTeam() == HORDE) + pCreature->setFaction(FACTION_ESCORTEE_H); + + DoScriptText(SAY_OOX_START, pCreature, pPlayer); + + if (npc_00x09hlAI* pEscortAI = CAST_AI(npc_00x09hlAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); + } + return true; +} + +CreatureAI* GetAI_npc_00x09hl(Creature* pCreature) +{ + return new npc_00x09hlAI(pCreature); +} + /*###### ## npc_rinji ######*/ @@ -164,39 +272,45 @@ struct TRINITY_DLL_DECL npc_rinjiAI : public npc_escortAI } } - void UpdateAI(const uint32 uiDiff) + void UpdateEscortAI(const uint32 uiDiff) { - npc_escortAI::UpdateAI(uiDiff); - - if (IsBeingEscorted && m_uiPostEventCount && !m_creature->getVictim()) + //Check if we have a current target + if (!UpdateVictim()) { - if (m_uiPostEventTimer < uiDiff) + if (IsBeingEscorted && m_uiPostEventCount) { - m_uiPostEventTimer = 3000; - - if (Unit* pPlayer = Unit::GetUnit(*m_creature, PlayerGUID)) + if (m_uiPostEventTimer < uiDiff) { - switch(m_uiPostEventCount) + m_uiPostEventTimer = 3000; + + if (Unit* pPlayer = Unit::GetUnit(*m_creature, PlayerGUID)) + { + switch(m_uiPostEventCount) + { + case 1: + DoScriptText(SAY_RIN_PROGRESS_1, m_creature, pPlayer); + ++m_uiPostEventCount; + break; + case 2: + DoScriptText(SAY_RIN_PROGRESS_2, m_creature, pPlayer); + m_uiPostEventCount = 0; + break; + } + } + else { - case 1: - DoScriptText(SAY_RIN_PROGRESS_1, m_creature, pPlayer); - ++m_uiPostEventCount; - break; - case 2: - DoScriptText(SAY_RIN_PROGRESS_2, m_creature, pPlayer); - m_uiPostEventCount = 0; - break; + m_creature->ForcedDespawn(); + return; } } else - { - m_creature->ForcedDespawn(); - return; - } + m_uiPostEventTimer -= uiDiff; } - else - m_uiPostEventTimer -= uiDiff; + + return; } + + DoMeleeAttackIfReady(); } }; @@ -222,6 +336,12 @@ void AddSC_hinterlands() { Script* newscript; + newscript = new Script; + newscript->Name = "npc_00x09hl"; + newscript->GetAI = &GetAI_npc_00x09hl; + newscript->pQuestAccept = &QuestAccept_npc_00x09hl; + newscript->RegisterSelf(); + newscript = new Script; newscript->Name = "npc_rinji"; newscript->GetAI = &GetAI_npc_rinji; diff --git a/src/bindings/scripts/scripts/outland/auchindoun/auchenai_crypts/boss_exarch_maladaar.cpp b/src/bindings/scripts/scripts/outland/auchindoun/auchenai_crypts/boss_exarch_maladaar.cpp new file mode 100644 index 00000000000..414804a6576 --- /dev/null +++ b/src/bindings/scripts/scripts/outland/auchindoun/auchenai_crypts/boss_exarch_maladaar.cpp @@ -0,0 +1,358 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Boss_Exarch_Maladaar +SD%Complete: 95 +SDComment: Most of event implemented, some adjustments to timers remain and possibly make some better code for switching his dark side in to better "images" of player. +SDCategory: Auchindoun, Auchenai Crypts +EndScriptData */ + +/* ContentData +mob_stolen_soul +boss_exarch_maladaar +mob_avatar_of_martyred +EndContentData */ + +#include "precompiled.h" + +#define SPELL_MOONFIRE 37328 +#define SPELL_FIREBALL 37329 +#define SPELL_MIND_FLAY 37330 +#define SPELL_HEMORRHAGE 37331 +#define SPELL_FROSTSHOCK 37332 +#define SPELL_CURSE_OF_AGONY 37334 +#define SPELL_MORTAL_STRIKE 37335 +#define SPELL_FREEZING_TRAP 37368 +#define SPELL_HAMMER_OF_JUSTICE 37369 + +struct TRINITY_DLL_DECL mob_stolen_soulAI : public ScriptedAI +{ + mob_stolen_soulAI(Creature *c) : ScriptedAI(c) {} + + uint8 myClass; + uint32 Class_Timer; + + void Reset() + { + Class_Timer = 1000; + } + + void EnterCombat(Unit *who) + { } + + void SetMyClass(uint8 myclass) + { + myClass = myclass; + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (Class_Timer < diff) + { + switch (myClass) + { + case CLASS_WARRIOR: + DoCast(m_creature->getVictim(), SPELL_MORTAL_STRIKE); + Class_Timer = 6000; + break; + case CLASS_PALADIN: + DoCast(m_creature->getVictim(), SPELL_HAMMER_OF_JUSTICE); + Class_Timer = 6000; + break; + case CLASS_HUNTER: + DoCast(m_creature->getVictim(), SPELL_FREEZING_TRAP); + Class_Timer = 20000; + break; + case CLASS_ROGUE: + DoCast(m_creature->getVictim(), SPELL_HEMORRHAGE); + Class_Timer = 10000; + break; + case CLASS_PRIEST: + DoCast(m_creature->getVictim(), SPELL_MIND_FLAY); + Class_Timer = 5000; + break; + case CLASS_SHAMAN: + DoCast(m_creature->getVictim(), SPELL_FROSTSHOCK); + Class_Timer = 8000; + break; + case CLASS_MAGE: + DoCast(m_creature->getVictim(), SPELL_FIREBALL); + Class_Timer = 5000; + break; + case CLASS_WARLOCK: + DoCast(m_creature->getVictim(), SPELL_CURSE_OF_AGONY); + Class_Timer = 20000; + break; + case CLASS_DRUID: + DoCast(m_creature->getVictim(), SPELL_MOONFIRE); + Class_Timer = 10000; + break; + } + } else Class_Timer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_mob_stolen_soul(Creature* pCreature) +{ + return new mob_stolen_soulAI (pCreature); +} + +#define SAY_INTRO -1558000 +#define SAY_SUMMON -1558001 + +#define SAY_AGGRO_1 -1558002 +#define SAY_AGGRO_2 -1558003 +#define SAY_AGGRO_3 -1558004 + +#define SAY_ROAR -1558005 +#define SAY_SOUL_CLEAVE -1558006 + +#define SAY_SLAY_1 -1558007 +#define SAY_SLAY_2 -1558008 + +#define SAY_DEATH -1558009 + +#define SPELL_RIBBON_OF_SOULS 32422 +#define SPELL_SOUL_SCREAM 32421 + +#define SPELL_STOLEN_SOUL 32346 +#define SPELL_STOLEN_SOUL_VISUAL 32395 + +#define SPELL_SUMMON_AVATAR 32424 + +#define ENTRY_STOLEN_SOUL 18441 + +struct TRINITY_DLL_DECL boss_exarch_maladaarAI : public ScriptedAI +{ + boss_exarch_maladaarAI(Creature *c) : ScriptedAI(c) + { + HasTaunted = false; + } + + uint32 soulmodel; + uint64 soulholder; + uint8 soulclass; + + uint32 Fear_timer; + uint32 Ribbon_of_Souls_timer; + uint32 StolenSoul_Timer; + + bool HasTaunted; + bool Avatar_summoned; + + void Reset() + { + soulmodel = 0; + soulholder = 0; + soulclass = 0; + + Fear_timer = 15000 + rand()% 5000; + Ribbon_of_Souls_timer = 5000; + StolenSoul_Timer = 25000 + rand()% 10000; + + Avatar_summoned = false; + } + + void MoveInLineOfSight(Unit *who) + { + if (!HasTaunted && m_creature->IsWithinDistInMap(who, 150.0)) + { + DoScriptText(SAY_INTRO, m_creature); + HasTaunted = true; + } + + ScriptedAI::MoveInLineOfSight(who); + } + + + void EnterCombat(Unit *who) + { + switch (rand()%3) + { + case 0: DoScriptText(SAY_AGGRO_1, m_creature); break; + case 1: DoScriptText(SAY_AGGRO_2, m_creature); break; + case 2: DoScriptText(SAY_AGGRO_3, m_creature); break; + } + } + + void JustSummoned(Creature *summoned) + { + if (summoned->GetEntry() == ENTRY_STOLEN_SOUL) + { + //SPELL_STOLEN_SOUL_VISUAL has shapeshift effect, but not implemented feature in Trinity for this spell. + summoned->CastSpell(summoned,SPELL_STOLEN_SOUL_VISUAL,false); + summoned->SetDisplayId(soulmodel); + summoned->setFaction(m_creature->getFaction()); + + if (Unit *target = Unit::GetUnit(*m_creature,soulholder)) + { + + CAST_AI(mob_stolen_soulAI, summoned->AI())->SetMyClass(soulclass); + summoned->AI()->AttackStart(target); + } + } + } + + void KilledUnit(Unit* victim) + { + if (rand()%2) + return; + + switch (rand()%2) + { + case 0: DoScriptText(SAY_SLAY_1, m_creature); break; + case 1: DoScriptText(SAY_SLAY_2, m_creature); break; + } + } + + void JustDied(Unit* Killer) + { + DoScriptText(SAY_DEATH, m_creature); + //When Exarch Maladar is defeated D'ore appear. + m_creature->SummonCreature(19412, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 600000); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (!Avatar_summoned && ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 25)) + { + if (m_creature->IsNonMeleeSpellCasted(false)) + m_creature->InterruptNonMeleeSpells(true); + + DoScriptText(SAY_SUMMON, m_creature); + + DoCast(m_creature, SPELL_SUMMON_AVATAR); + Avatar_summoned = true; + StolenSoul_Timer = 15000 + rand()% 15000; + } + + if (StolenSoul_Timer < diff) + { + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + if (target->GetTypeId() == TYPEID_PLAYER) + { + if (m_creature->IsNonMeleeSpellCasted(false)) + m_creature->InterruptNonMeleeSpells(true); + + uint32 i = urand(1,2); + if (i == 1) + DoScriptText(SAY_ROAR, m_creature); + else + DoScriptText(SAY_SOUL_CLEAVE, m_creature); + + soulmodel = target->GetDisplayId(); + soulholder = target->GetGUID(); + soulclass = target->getClass(); + + DoCast(target,SPELL_STOLEN_SOUL); + m_creature->SummonCreature(ENTRY_STOLEN_SOUL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); + + StolenSoul_Timer = 20000 + rand()% 10000; + } else StolenSoul_Timer = 1000; + } + }else StolenSoul_Timer -= diff; + + if (Ribbon_of_Souls_timer < diff) + { + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_RIBBON_OF_SOULS); + + Ribbon_of_Souls_timer = 5000 + (rand()%20 * 1000); + }else Ribbon_of_Souls_timer -= diff; + + if (Fear_timer < diff) + { + DoCast(m_creature,SPELL_SOUL_SCREAM); + Fear_timer = 15000 + rand()% 15000; + }else Fear_timer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_exarch_maladaar(Creature* pCreature) +{ + return new boss_exarch_maladaarAI (pCreature); +} + +#define SPELL_AV_MORTAL_STRIKE 16856 +#define SPELL_AV_SUNDER_ARMOR 16145 + +struct TRINITY_DLL_DECL mob_avatar_of_martyredAI : public ScriptedAI +{ + mob_avatar_of_martyredAI(Creature *c) : ScriptedAI(c) {} + + uint32 Mortal_Strike_timer; + + void Reset() + { + Mortal_Strike_timer = 10000; + } + + void EnterCombat(Unit *who) + { + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (Mortal_Strike_timer < diff) + { + DoCast(m_creature->getVictim(), SPELL_AV_MORTAL_STRIKE); + Mortal_Strike_timer = 10000 + rand()%20 * 1000; + } else Mortal_Strike_timer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_mob_avatar_of_martyred(Creature* pCreature) +{ + return new mob_avatar_of_martyredAI (pCreature); +} + +void AddSC_boss_exarch_maladaar() +{ + Script *newscript; + + newscript = new Script; + newscript->Name="boss_exarch_maladaar"; + newscript->GetAI = &GetAI_boss_exarch_maladaar; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="mob_avatar_of_martyred"; + newscript->GetAI = &GetAI_mob_avatar_of_martyred; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="mob_stolen_soul"; + newscript->GetAI = &GetAI_mob_stolen_soul; + newscript->RegisterSelf(); +} + diff --git a/src/bindings/scripts/scripts/outland/auchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp b/src/bindings/scripts/scripts/outland/auchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp new file mode 100644 index 00000000000..4dfdd407731 --- /dev/null +++ b/src/bindings/scripts/scripts/outland/auchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp @@ -0,0 +1,212 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +Name: Boss_Shirrak_the_dead_watcher +%Complete: 80 +Comment: InhibitMagic should stack slower far from the boss, proper Visual for Focus Fire, heroic implemented +Category: Auchindoun, Auchenai Crypts +EndScriptData */ + +#include "precompiled.h" + +#define SPELL_INHIBITMAGIC 32264 +#define SPELL_ATTRACTMAGIC 32265 +#define N_SPELL_CARNIVOROUSBITE 36383 +#define H_SPELL_CARNIVOROUSBITE 39382 +#define SPELL_CARNIVOROUSBITE (HeroicMode?H_SPELL_CARNIVOROUSBITE:N_SPELL_CARNIVOROUSBITE) + +#define ENTRY_FOCUS_FIRE 18374 + +#define N_SPELL_FIERY_BLAST 32302 +#define H_SPELL_FIERY_BLAST 38382 +#define SPELL_FIERY_BLAST (HeroicMode?H_SPELL_FIERY_BLAST:N_SPELL_FIERY_BLAST) +#define SPELL_FOCUS_FIRE_VISUAL 42075 //need to find better visual + +struct TRINITY_DLL_DECL boss_shirrak_the_dead_watcherAI : public ScriptedAI +{ + boss_shirrak_the_dead_watcherAI(Creature *c) : ScriptedAI(c) + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + } + + uint32 Inhibitmagic_Timer; + uint32 Attractmagic_Timer; + uint32 Carnivorousbite_Timer; + uint32 FocusFire_Timer; + bool HeroicMode; + Unit *focusedTarget; + + void Reset() + { + Inhibitmagic_Timer = 0; + Attractmagic_Timer = 28000; + Carnivorousbite_Timer = 10000; + FocusFire_Timer = 17000; + focusedTarget = NULL; + } + + void EnterCombat(Unit *who) + { } + + void JustSummoned(Creature *summoned) + { + if (summoned && summoned->GetEntry() == ENTRY_FOCUS_FIRE) + { + summoned->CastSpell(summoned,SPELL_FOCUS_FIRE_VISUAL,false); + summoned->setFaction(m_creature->getFaction()); + summoned->SetLevel(m_creature->getLevel()); + summoned->addUnitState(UNIT_STAT_ROOT); + + if (focusedTarget) + summoned->AI()->AttackStart(focusedTarget); + } + } + + void UpdateAI(const uint32 diff) + { + //Inhibitmagic_Timer + if (Inhibitmagic_Timer < diff) + { + float dist; + Map* pMap = m_creature->GetMap(); + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (Player* i_pl = i->getSource()) + if (i_pl->isAlive() && (dist = i_pl->IsWithinDist(m_creature, 45))) + { + i_pl->RemoveAurasDueToSpell(SPELL_INHIBITMAGIC); + m_creature->AddAura(SPELL_INHIBITMAGIC, i_pl); + if (dist < 35) + m_creature->AddAura(SPELL_INHIBITMAGIC, i_pl); + if (dist < 25) + m_creature->AddAura(SPELL_INHIBITMAGIC, i_pl); + if (dist < 15) + m_creature->AddAura(SPELL_INHIBITMAGIC, i_pl); + } + Inhibitmagic_Timer = 3000+(rand()%1000); + }else Inhibitmagic_Timer -= diff; + + //Return since we have no target + if (!UpdateVictim()) + return; + + //Attractmagic_Timer + if (Attractmagic_Timer < diff) + { + DoCast(m_creature,SPELL_ATTRACTMAGIC); + Attractmagic_Timer = 30000; + Carnivorousbite_Timer = 1500; + }else Attractmagic_Timer -= diff; + + //Carnivorousbite_Timer + if (Carnivorousbite_Timer < diff) + { + DoCast(m_creature,SPELL_CARNIVOROUSBITE); + Carnivorousbite_Timer = 10000; + }else Carnivorousbite_Timer -= diff; + + //FocusFire_Timer + if (FocusFire_Timer < diff) + { + // Summon Focus Fire & Emote + Unit *target = SelectUnit(SELECT_TARGET_RANDOM,1); + if (target && target->GetTypeId() == TYPEID_PLAYER && target->isAlive()) + { + focusedTarget = target; + m_creature->SummonCreature(ENTRY_FOCUS_FIRE,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,5500); + + // TODO: Find better way to handle emote + // Emote + std::string *emote = new std::string("focuses on "); + emote->append(target->GetName()); + emote->append("!"); + const char* text = emote->c_str(); + m_creature->MonsterTextEmote(text, 0, true); + delete emote; + } + FocusFire_Timer = 15000+(rand()%5000); + }else FocusFire_Timer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_shirrak_the_dead_watcher(Creature* pCreature) +{ + return new boss_shirrak_the_dead_watcherAI (pCreature); +} + +struct TRINITY_DLL_DECL mob_focus_fireAI : public ScriptedAI +{ + mob_focus_fireAI(Creature *c) : ScriptedAI(c) + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + } + + bool HeroicMode; + uint32 FieryBlast_Timer; + bool fiery1, fiery2; + + void Reset() + { + FieryBlast_Timer = 3000+(rand()%1000); + fiery1 = fiery2 = true; + } + + void EnterCombat(Unit *who) + { } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //FieryBlast_Timer + if (fiery2 && FieryBlast_Timer < diff) + { + DoCast(m_creature,SPELL_FIERY_BLAST); + + if (fiery1) fiery1 = false; + else if (fiery2) fiery2 = false; + + FieryBlast_Timer = 1000; + }else FieryBlast_Timer -= diff; + + //DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_mob_focus_fire(Creature* pCreature) +{ + return new mob_focus_fireAI (pCreature); +} + +void AddSC_boss_shirrak_the_dead_watcher() +{ + Script *newscript; + newscript = new Script; + newscript->Name="boss_shirrak_the_dead_watcher"; + newscript->GetAI = &GetAI_boss_shirrak_the_dead_watcher; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="mob_focus_fire"; + newscript->GetAI = &GetAI_mob_focus_fire; + newscript->RegisterSelf(); +} + diff --git a/src/bindings/scripts/scripts/outland/auchindoun/mana_tombs/boss_nexusprince_shaffar.cpp b/src/bindings/scripts/scripts/outland/auchindoun/mana_tombs/boss_nexusprince_shaffar.cpp new file mode 100644 index 00000000000..dcaaefee8c2 --- /dev/null +++ b/src/bindings/scripts/scripts/outland/auchindoun/mana_tombs/boss_nexusprince_shaffar.cpp @@ -0,0 +1,369 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Boss_NexusPrince_Shaffar +SD%Complete: 80 +SDComment: Need more tuning of spell timers, it should not be as linear fight as current. Also should possibly find a better way to deal with his three initial beacons to make sure all aggro. +SDCategory: Auchindoun, Mana Tombs +EndScriptData */ + +/* ContentData +boss_nexusprince_shaffar +mob_ethereal_beacon +EndContentData */ + +#include "precompiled.h" + +enum +{ + SAY_INTRO = -1557000, + SAY_AGGRO_1 = -1557001, + SAY_AGGRO_2 = -1557002, + SAY_AGGRO_3 = -1557003, + SAY_SLAY_1 = -1557004, + SAY_SLAY_2 = -1557005, + SAY_SUMMON = -1557006, + SAY_DEAD = -1557007, + + SPELL_BLINK = 34605, + SPELL_FROSTBOLT = 32364, + SPELL_FIREBALL = 32363, + SPELL_FROSTNOVA = 32365, + + SPELL_ETHEREAL_BEACON = 32371, // Summons NPC_BEACON + SPELL_ETHEREAL_BEACON_VISUAL = 32368, + + NPC_BEACON = 18431, + NPC_SHAFFAR = 18344, + + NR_INITIAL_BEACONS = 3 +}; + +struct TRINITY_DLL_DECL boss_nexusprince_shaffarAI : public ScriptedAI +{ + boss_nexusprince_shaffarAI(Creature *c) : ScriptedAI(c), summons(me) { HasTaunted = false; } + + uint32 Blink_Timer; + uint32 Beacon_Timer; + uint32 FireBall_Timer; + uint32 Frostbolt_Timer; + uint32 FrostNova_Timer; + + SummonList summons; + + bool HasTaunted; + bool CanBlink; + + void Reset() + { + Blink_Timer = 1500; + Beacon_Timer = 10000; + FireBall_Timer = 8000; + Frostbolt_Timer = 4000; + FrostNova_Timer = 15000; + + CanBlink = false; + + float dist = 8.0f; + float posX, posY, posZ, angle; + m_creature->GetHomePosition(posX, posY, posZ, angle); + + m_creature->SummonCreature(NPC_BEACON, posX - dist, posY - dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); + m_creature->SummonCreature(NPC_BEACON, posX - dist, posY + dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); + m_creature->SummonCreature(NPC_BEACON, posX + dist, posY, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); + } + + void EnterEvadeMode() + { + summons.DespawnAll(); + ScriptedAI::EnterEvadeMode(); + } + + void MoveInLineOfSight(Unit *who) + { + if (!HasTaunted && who->GetTypeId() == TYPEID_PLAYER && m_creature->IsWithinDistInMap(who, 100.0f)) + { + DoScriptText(SAY_INTRO, m_creature); + HasTaunted = true; + } + } + + void EnterCombat(Unit *who) + { + switch(rand()%3) + { + case 0: DoScriptText(SAY_AGGRO_1, m_creature); break; + case 1: DoScriptText(SAY_AGGRO_2, m_creature); break; + case 2: DoScriptText(SAY_AGGRO_3, m_creature); break; + } + + DoZoneInCombat(); + summons.DoZoneInCombat(); + } + + void JustSummoned(Creature *summoned) + { + if (summoned->GetEntry() == NPC_BEACON) + { + summoned->CastSpell(summoned,SPELL_ETHEREAL_BEACON_VISUAL,false); + + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) + summoned->AI()->AttackStart(target); + } + + summons.Summon(summoned); + } + + void SummonedCreatureDespawn(Creature *summon) + { + summons.Despawn(summon); + } + + void KilledUnit(Unit* victim) + { + switch(rand()%2) + { + case 0: DoScriptText(SAY_SLAY_1, m_creature); break; + case 1: DoScriptText(SAY_SLAY_2, m_creature); break; + } + } + + void JustDied(Unit* Killer) + { + DoScriptText(SAY_DEAD, m_creature); + summons.DespawnAll(); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (FrostNova_Timer < diff) + { + if (m_creature->IsNonMeleeSpellCasted(false)) + m_creature->InterruptNonMeleeSpells(true); + + DoCast(m_creature,SPELL_FROSTNOVA); + FrostNova_Timer = 17500 + rand()%7500; + CanBlink = true; + }else FrostNova_Timer -= diff; + + if (Frostbolt_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_FROSTBOLT); + Frostbolt_Timer = 4500 + rand()%1500; + }else Frostbolt_Timer -= diff; + + if (FireBall_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_FIREBALL); + FireBall_Timer = 4500 + rand()%1500; + }else FireBall_Timer -= diff; + + if (CanBlink) + { + if (Blink_Timer < diff) + { + if (m_creature->IsNonMeleeSpellCasted(false)) + m_creature->InterruptNonMeleeSpells(true); + + //expire movement, will prevent from running right back to victim after cast + //(but should MoveChase be used again at a certain time or should he not move?) + if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) + m_creature->GetMotionMaster()->MovementExpired(); + + DoCast(m_creature,SPELL_BLINK); + Blink_Timer = 1000 + rand()%1500; + CanBlink = false; + }else Blink_Timer -= diff; + } + + if (Beacon_Timer < diff) + { + if (m_creature->IsNonMeleeSpellCasted(false)) + m_creature->InterruptNonMeleeSpells(true); + + if (!urand(0,3)) + DoScriptText(SAY_SUMMON, m_creature); + + DoCast(m_creature,SPELL_ETHEREAL_BEACON, true); + + Beacon_Timer = 10000; + }else Beacon_Timer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_nexusprince_shaffar(Creature* pCreature) +{ + return new boss_nexusprince_shaffarAI (pCreature); +} + +enum +{ + SPELL_ARCANE_BOLT = 15254, + SPELL_ETHEREAL_APPRENTICE = 32372 // Summon 18430 +}; + +struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI +{ + mob_ethereal_beaconAI(Creature *c) : ScriptedAI(c) + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + } + + bool HeroicMode; + uint32 Apprentice_Timer; + uint32 ArcaneBolt_Timer; + uint32 Check_Timer; + + void KillSelf() + { + m_creature->Kill(m_creature); + } + + void Reset() + { + Apprentice_Timer = (HeroicMode ? 10000 : 20000); + ArcaneBolt_Timer = 1000; + Check_Timer = 1000; + } + + void EnterCombat(Unit *who) + { + // Send Shaffar to fight + Creature* Shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100); + if (!Shaffar || Shaffar->isDead()) + { + KillSelf(); + return; + } + if (!Shaffar->isInCombat()) + Shaffar->AI()->AttackStart(who); + } + + void JustSummoned(Creature *summoned) + { + summoned->AI()->AttackStart(m_creature->getVictim()); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (Check_Timer < diff) + { + Creature *Shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100); + if (!Shaffar || Shaffar->isDead() || !Shaffar->isInCombat()) + { + KillSelf(); + return; + } + Check_Timer = 1000; + }else Check_Timer -= diff; + + if (ArcaneBolt_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_ARCANE_BOLT); + ArcaneBolt_Timer = 2000 + rand()%2500; + }else ArcaneBolt_Timer -= diff; + + if (Apprentice_Timer < diff) + { + if (m_creature->IsNonMeleeSpellCasted(false)) + m_creature->InterruptNonMeleeSpells(true); + + m_creature->CastSpell(m_creature,SPELL_ETHEREAL_APPRENTICE,true); + m_creature->ForcedDespawn(); + return; + }else Apprentice_Timer -= diff; + } +}; + +CreatureAI* GetAI_mob_ethereal_beacon(Creature* pCreature) +{ + return new mob_ethereal_beaconAI (pCreature); +} + +enum +{ + SPELL_ETHEREAL_APPRENTICE_FIREBOLT = 32369, + SPELL_ETHEREAL_APPRENTICE_FROSTBOLT = 32370 +}; + +struct TRINITY_DLL_DECL mob_ethereal_apprenticeAI : public ScriptedAI +{ + mob_ethereal_apprenticeAI(Creature *c) : ScriptedAI(c) {} + + uint32 Cast_Timer; + + bool isFireboltTurn; + + void Reset() + { + Cast_Timer = 3000; + isFireboltTurn = true; + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (Cast_Timer < diff) + { + if (isFireboltTurn) + { + m_creature->CastSpell(m_creature->getVictim(), SPELL_ETHEREAL_APPRENTICE_FIREBOLT, true); + isFireboltTurn = false; + }else{ + m_creature->CastSpell(m_creature->getVictim(), SPELL_ETHEREAL_APPRENTICE_FROSTBOLT, true); + isFireboltTurn = true; + } + Cast_Timer = 3000; + }else Cast_Timer -= diff; + } +}; + +CreatureAI* GetAI_mob_ethereal_apprentice(Creature* pCreature) +{ + return new mob_ethereal_apprenticeAI (pCreature); +} + +void AddSC_boss_nexusprince_shaffar() +{ + Script *newscript; + + newscript = new Script; + newscript->Name="boss_nexusprince_shaffar"; + newscript->GetAI = &GetAI_boss_nexusprince_shaffar; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="mob_ethereal_beacon"; + newscript->GetAI = &GetAI_mob_ethereal_beacon; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="mob_ethereal_apprentice"; + newscript->GetAI = &GetAI_mob_ethereal_apprentice; + newscript->RegisterSelf(); +} + diff --git a/src/bindings/scripts/scripts/outland/auchindoun/mana_tombs/boss_pandemonius.cpp b/src/bindings/scripts/scripts/outland/auchindoun/mana_tombs/boss_pandemonius.cpp new file mode 100644 index 00000000000..77e1c535340 --- /dev/null +++ b/src/bindings/scripts/scripts/outland/auchindoun/mana_tombs/boss_pandemonius.cpp @@ -0,0 +1,138 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Boss_Pandemonius +SD%Complete: 75 +SDComment: Not known how void blast is done (amount of rapid cast seems to be related to players in party). All mobs remaining in surrounding area should aggro when engaged. +SDCategory: Auchindoun, Mana Tombs +EndScriptData */ + +#include "precompiled.h" + +#define SAY_AGGRO_1 -1557008 +#define SAY_AGGRO_2 -1557009 +#define SAY_AGGRO_3 -1557010 + +#define SAY_KILL_1 -1557011 +#define SAY_KILL_2 -1557012 + +#define SAY_DEATH -1557013 + +#define EMOTE_DARK_SHELL -1557014 + +#define SPELL_VOID_BLAST 32325 +#define H_SPELL_VOID_BLAST 38760 +#define SPELL_DARK_SHELL 32358 +#define H_SPELL_DARK_SHELL 38759 + +struct TRINITY_DLL_DECL boss_pandemoniusAI : public ScriptedAI +{ + boss_pandemoniusAI(Creature *c) : ScriptedAI(c) + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + } + + bool HeroicMode; + uint32 VoidBlast_Timer; + uint32 DarkShell_Timer; + uint32 VoidBlast_Counter; + + void Reset() + { + VoidBlast_Timer = 8000+rand()%15000; + DarkShell_Timer = 20000; + VoidBlast_Counter = 0; + } + + void JustDied(Unit* Killer) + { + DoScriptText(SAY_DEATH, m_creature); + } + + void KilledUnit(Unit* victim) + { + switch(rand()%2) + { + case 0: DoScriptText(SAY_KILL_1, m_creature); break; + case 1: DoScriptText(SAY_KILL_2, m_creature); break; + } + } + + void EnterCombat(Unit *who) + { + switch(rand()%3) + { + case 0: DoScriptText(SAY_AGGRO_1, m_creature); break; + case 1: DoScriptText(SAY_AGGRO_2, m_creature); break; + case 2: DoScriptText(SAY_AGGRO_3, m_creature); break; + } + + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (VoidBlast_Timer < diff) + { + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + { + DoCast(target,HeroicMode ? H_SPELL_VOID_BLAST : SPELL_VOID_BLAST); + VoidBlast_Timer = 500; + ++VoidBlast_Counter; + } + + if (VoidBlast_Counter == 5) + { + VoidBlast_Timer = 15000+rand()%10000; + VoidBlast_Counter = 0; + } + }else VoidBlast_Timer -= diff; + + if (!VoidBlast_Counter) + { + if (DarkShell_Timer < diff) + { + if (m_creature->IsNonMeleeSpellCasted(false)) + m_creature->InterruptNonMeleeSpells(true); + + DoScriptText(EMOTE_DARK_SHELL, m_creature); + + DoCast(m_creature,HeroicMode ? H_SPELL_DARK_SHELL : SPELL_DARK_SHELL); + DarkShell_Timer = 20000; + }else DarkShell_Timer -= diff; + } + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_pandemonius(Creature* pCreature) +{ + return new boss_pandemoniusAI (pCreature); +} + +void AddSC_boss_pandemonius() +{ + Script *newscript; + newscript = new Script; + newscript->Name="boss_pandemonius"; + newscript->GetAI = &GetAI_boss_pandemonius; + newscript->RegisterSelf(); +} + diff --git a/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/boss_darkweaver_syth.cpp b/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/boss_darkweaver_syth.cpp new file mode 100644 index 00000000000..00e43fa257d --- /dev/null +++ b/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/boss_darkweaver_syth.cpp @@ -0,0 +1,438 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Boss_Darkweaver_Syth +SD%Complete: 85 +SDComment: Shock spells/times need more work. Heroic partly implemented. +SDCategory: Auchindoun, Sethekk Halls +EndScriptData */ + +#include "precompiled.h" + +#define SAY_SUMMON -1556000 + +#define SAY_AGGRO_1 -1556001 +#define SAY_AGGRO_2 -1556002 +#define SAY_AGGRO_3 -1556003 + +#define SAY_SLAY_1 -1556004 +#define SAY_SLAY_2 -1556005 + +#define SAY_DEATH -1556006 + +#define SPELL_FROST_SHOCK 21401 //37865 +#define SPELL_FLAME_SHOCK 34354 +#define SPELL_SHADOW_SHOCK 30138 +#define SPELL_ARCANE_SHOCK 37132 + +#define SPELL_CHAIN_LIGHTNING 15659 //15305 + +#define SPELL_SUMMON_SYTH_FIRE 33537 // Spawns 19203 +#define SPELL_SUMMON_SYTH_ARCANE 33538 // Spawns 19205 +#define SPELL_SUMMON_SYTH_FROST 33539 // Spawns 19204 +#define SPELL_SUMMON_SYTH_SHADOW 33540 // Spawns 19206 + +#define SPELL_FLAME_BUFFET (HeroicMode?38141:33526) +#define SPELL_ARCANE_BUFFET (HeroicMode?38138:33527) +#define SPELL_FROST_BUFFET (HeroicMode?38142:33528) +#define SPELL_SHADOW_BUFFET (HeroicMode?38143:33529) + +struct TRINITY_DLL_DECL boss_darkweaver_sythAI : public ScriptedAI +{ + boss_darkweaver_sythAI(Creature *c) : ScriptedAI(c) + + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + } + + uint32 flameshock_timer; + uint32 arcaneshock_timer; + uint32 frostshock_timer; + uint32 shadowshock_timer; + uint32 chainlightning_timer; + + bool summon90; + bool summon50; + bool summon10; + bool HeroicMode; + + void Reset() + { + flameshock_timer = 2000; + arcaneshock_timer = 4000; + frostshock_timer = 6000; + shadowshock_timer = 8000; + chainlightning_timer = 15000; + + summon90 = false; + summon50 = false; + summon10 = false; + } + + void EnterCombat(Unit *who) + { + switch(rand()%3) + { + case 0: DoScriptText(SAY_AGGRO_1, m_creature); break; + case 1: DoScriptText(SAY_AGGRO_2, m_creature); break; + case 2: DoScriptText(SAY_AGGRO_3, m_creature); break; + } + } + + void JustDied(Unit* Killer) + { + DoScriptText(SAY_DEATH, m_creature); + } + + void KilledUnit(Unit* victim) + { + if (rand()%2) + return; + + switch(rand()%2) + { + case 0: DoScriptText(SAY_SLAY_1, m_creature); break; + case 1: DoScriptText(SAY_SLAY_2, m_creature); break; + } + } + + void JustSummoned(Creature *summoned) + { + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) + summoned->AI()->AttackStart(target); + } + + void SythSummoning() + { + DoScriptText(SAY_SUMMON, m_creature); + + if (m_creature->IsNonMeleeSpellCasted(false)) + m_creature->InterruptNonMeleeSpells(false); + + DoCast(m_creature,SPELL_SUMMON_SYTH_ARCANE,true); //front + DoCast(m_creature,SPELL_SUMMON_SYTH_FIRE,true); //back + DoCast(m_creature,SPELL_SUMMON_SYTH_FROST,true); //left + DoCast(m_creature,SPELL_SUMMON_SYTH_SHADOW,true); //right + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 90) && !summon90) + { + SythSummoning(); + summon90 = true; + } + + if (((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 50) && !summon50) + { + SythSummoning(); + summon50 = true; + } + + if (((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 10) && !summon10) + { + SythSummoning(); + summon10 = true; + } + + if (flameshock_timer < diff) + { + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_FLAME_SHOCK); + + flameshock_timer = 10000 + rand()%5000; + } else flameshock_timer -= diff; + + if (arcaneshock_timer < diff) + { + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_ARCANE_SHOCK); + + arcaneshock_timer = 10000 + rand()%5000; + } else arcaneshock_timer -= diff; + + if (frostshock_timer < diff) + { + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_FROST_SHOCK); + + frostshock_timer = 10000 + rand()%5000; + } else frostshock_timer -= diff; + + if (shadowshock_timer < diff) + { + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_SHADOW_SHOCK); + + shadowshock_timer = 10000 + rand()%5000; + } else shadowshock_timer -= diff; + + if (chainlightning_timer < diff) + { + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_CHAIN_LIGHTNING); + + chainlightning_timer = 25000; + } else chainlightning_timer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_darkweaver_syth(Creature* pCreature) +{ + return new boss_darkweaver_sythAI (pCreature); +} + +/* ELEMENTALS */ + +struct TRINITY_DLL_DECL mob_syth_fireAI : public ScriptedAI +{ + mob_syth_fireAI(Creature *c) : ScriptedAI(c) + + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + } + + uint32 flameshock_timer; + uint32 flamebuffet_timer; + bool HeroicMode; + + void Reset() + { + m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); + flameshock_timer = 2500; + flamebuffet_timer = 5000; + } + + void EnterCombat(Unit *who) { } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (flameshock_timer < diff) + { + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_FLAME_SHOCK); + + flameshock_timer = 5000; + }else flameshock_timer -= diff; + + if (flamebuffet_timer < diff) + { + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_FLAME_BUFFET); + + flamebuffet_timer = 5000; + }else flamebuffet_timer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_mob_syth_fire(Creature* pCreature) +{ + return new mob_syth_fireAI (pCreature); +} + +struct TRINITY_DLL_DECL mob_syth_arcaneAI : public ScriptedAI +{ + mob_syth_arcaneAI(Creature *c) : ScriptedAI(c) + + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + } + + uint32 arcaneshock_timer; + uint32 arcanebuffet_timer; + bool HeroicMode; + + void Reset() + { + m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_ARCANE, true); + arcaneshock_timer = 2500; + arcanebuffet_timer = 5000; + } + + void EnterCombat(Unit *who) { } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (arcaneshock_timer < diff) + { + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_ARCANE_SHOCK); + + arcaneshock_timer = 5000; + }else arcaneshock_timer -= diff; + + if (arcanebuffet_timer < diff) + { + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_ARCANE_BUFFET); + + arcanebuffet_timer = 5000; + }else arcanebuffet_timer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_mob_syth_arcane(Creature* pCreature) +{ + return new mob_syth_arcaneAI (pCreature); +} + +struct TRINITY_DLL_DECL mob_syth_frostAI : public ScriptedAI +{ + mob_syth_frostAI(Creature *c) : ScriptedAI(c) + + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + } + + uint32 frostshock_timer; + uint32 frostbuffet_timer; + bool HeroicMode; + + void Reset() + { + m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); + frostshock_timer = 2500; + frostbuffet_timer = 5000; + } + + void EnterCombat(Unit *who) { } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (frostshock_timer < diff) + { + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_FROST_SHOCK); + + frostshock_timer = 5000; + }else frostshock_timer -= diff; + + if (frostbuffet_timer < diff) + { + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_FROST_BUFFET); + + frostbuffet_timer = 5000; + }else frostbuffet_timer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_mob_syth_frost(Creature* pCreature) +{ + return new mob_syth_frostAI (pCreature); +} + +struct TRINITY_DLL_DECL mob_syth_shadowAI : public ScriptedAI +{ + mob_syth_shadowAI(Creature *c) : ScriptedAI(c) + + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + } + + uint32 shadowshock_timer; + uint32 shadowbuffet_timer; + bool HeroicMode; + + void Reset() + { + m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_SHADOW, true); + shadowshock_timer = 2500; + shadowbuffet_timer = 5000; + } + + void EnterCombat(Unit *who) { } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (shadowshock_timer < diff) + { + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_SHADOW_SHOCK); + + shadowshock_timer = 5000; + }else shadowshock_timer -= diff; + + if (shadowbuffet_timer < diff) + { + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target,SPELL_SHADOW_BUFFET); + + shadowbuffet_timer = 5000; + }else shadowbuffet_timer -= diff; + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_mob_syth_shadow(Creature* pCreature) +{ + return new mob_syth_shadowAI (pCreature); +} + +void AddSC_boss_darkweaver_syth() +{ + Script *newscript; + newscript = new Script; + newscript->Name="boss_darkweaver_syth"; + newscript->GetAI = &GetAI_boss_darkweaver_syth; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="mob_syth_fire"; + newscript->GetAI = &GetAI_mob_syth_arcane; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="mob_syth_arcane"; + newscript->GetAI = &GetAI_mob_syth_arcane; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="mob_syth_frost"; + newscript->GetAI = &GetAI_mob_syth_frost; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="mob_syth_shadow"; + newscript->GetAI = &GetAI_mob_syth_shadow; + newscript->RegisterSelf(); +} + diff --git a/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/boss_tailonking_ikiss.cpp b/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/boss_tailonking_ikiss.cpp new file mode 100644 index 00000000000..7830fc10645 --- /dev/null +++ b/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/boss_tailonking_ikiss.cpp @@ -0,0 +1,221 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Boss_Talon_King_Ikiss +SD%Complete: 80 +SDComment: Heroic supported. Some details missing, but most are spell related. +SDCategory: Auchindoun, Sethekk Halls +EndScriptData */ + +#include "precompiled.h" +#include "def_sethekk_halls.h" + +#define SAY_INTRO -1556007 + +#define SAY_AGGRO_1 -1556008 +#define SAY_AGGRO_2 -1556009 +#define SAY_AGGRO_3 -1556010 + +#define SAY_SLAY_1 -1556011 +#define SAY_SLAY_2 -1556012 +#define SAY_DEATH -1556013 +#define EMOTE_ARCANE_EXP -1556015 + +#define SPELL_BLINK 38194 +#define SPELL_BLINK_TELEPORT 38203 +#define SPELL_MANA_SHIELD 38151 +#define SPELL_ARCANE_BUBBLE 9438 +#define H_SPELL_SLOW 35032 + +#define SPELL_POLYMORPH 38245 +#define H_SPELL_POLYMORPH 43309 + +#define SPELL_ARCANE_VOLLEY 35059 +#define H_SPELL_ARCANE_VOLLEY 40424 + +#define SPELL_ARCANE_EXPLOSION 38197 +#define H_SPELL_ARCANE_EXPLOSION 40425 + +struct TRINITY_DLL_DECL boss_talon_king_ikissAI : public ScriptedAI +{ + boss_talon_king_ikissAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceData(); + } + + ScriptedInstance* pInstance; + + bool HeroicMode; + + uint32 ArcaneVolley_Timer; + uint32 Sheep_Timer; + uint32 Blink_Timer; + uint32 Slow_Timer; + + bool ManaShield; + bool Blink; + bool Intro; + + void Reset() + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + + ArcaneVolley_Timer = 5000; + Sheep_Timer = 8000; + Blink_Timer = 35000; + Slow_Timer = 15000+rand()%15000; + Blink = false; + Intro = false; + ManaShield = false; + } + + void MoveInLineOfSight(Unit *who) + { + if (!m_creature->getVictim() && who->isTargetableForAttack() && (m_creature->IsHostileTo(who)) && who->isInAccessiblePlaceFor(m_creature)) + { + if (!Intro && m_creature->IsWithinDistInMap(who, 100)) + { + Intro = true; + DoScriptText(SAY_INTRO, m_creature); + } + + if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) + return; + + float attackRadius = m_creature->GetAttackDistance(who); + if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) + { + //who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); + AttackStart(who); + } + } + } + + void EnterCombat(Unit *who) + { + switch(rand()%3) + { + case 0: DoScriptText(SAY_AGGRO_1, m_creature); break; + case 1: DoScriptText(SAY_AGGRO_2, m_creature); break; + case 2: DoScriptText(SAY_AGGRO_3, m_creature); break; + } + } + + void JustDied(Unit* Killer) + { + DoScriptText(SAY_DEATH, m_creature); + + if (pInstance) + pInstance->SetData(DATA_IKISSDOOREVENT, DONE); + } + + void KilledUnit(Unit* victim) + { + switch(rand()%2) + { + case 0: DoScriptText(SAY_SLAY_1, m_creature); break; + case 1: DoScriptText(SAY_SLAY_2, m_creature); break; + } + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (Blink) + { + DoCast(m_creature,HeroicMode ? H_SPELL_ARCANE_EXPLOSION : SPELL_ARCANE_EXPLOSION); + m_creature->CastSpell(m_creature,SPELL_ARCANE_BUBBLE,true); + Blink = false; + } + + if (ArcaneVolley_Timer < diff) + { + DoCast(m_creature,HeroicMode ? H_SPELL_ARCANE_VOLLEY : SPELL_ARCANE_VOLLEY); + ArcaneVolley_Timer = 7000+rand()%5000; + }else ArcaneVolley_Timer -= diff; + + if (Sheep_Timer < diff) + { + //second top aggro target in normal, random target in heroic correct? + Unit *target = NULL; + target = HeroicMode ? SelectUnit(SELECT_TARGET_RANDOM,0) : SelectUnit(SELECT_TARGET_TOPAGGRO,1); + if (target) + DoCast(target,HeroicMode ? H_SPELL_POLYMORPH : SPELL_POLYMORPH); + Sheep_Timer = 15000+rand()%2500; + }else Sheep_Timer -= diff; + + //may not be correct time to cast + if (!ManaShield && ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 20)) + { + DoCast(m_creature,SPELL_MANA_SHIELD); + ManaShield = true; + } + + if (HeroicMode) + { + if (Slow_Timer < diff) + { + DoCast(m_creature,H_SPELL_SLOW); + Slow_Timer = 15000+rand()%25000; + }else Slow_Timer -= diff; + } + + if (Blink_Timer < diff) + { + DoScriptText(EMOTE_ARCANE_EXP, m_creature); + + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + if (m_creature->IsNonMeleeSpellCasted(false)) + m_creature->InterruptNonMeleeSpells(false); + + //Spell doesn't work, but we use for visual effect at least + DoCast(target,SPELL_BLINK); + + float X = target->GetPositionX(); + float Y = target->GetPositionY(); + float Z = target->GetPositionZ(); + + DoTeleportTo(X,Y,Z); + + DoCast(target,SPELL_BLINK_TELEPORT); + Blink = true; + } + Blink_Timer = 35000+rand()%5000; + }else Blink_Timer -= diff; + + if (!Blink) + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_talon_king_ikiss(Creature* pCreature) +{ + return new boss_talon_king_ikissAI (pCreature); +} + +void AddSC_boss_talon_king_ikiss() +{ + Script *newscript; + newscript = new Script; + newscript->Name="boss_talon_king_ikiss"; + newscript->GetAI = &GetAI_boss_talon_king_ikiss; + newscript->RegisterSelf(); +} + diff --git a/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/def_sethekk_halls.h b/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/def_sethekk_halls.h new file mode 100644 index 00000000000..6156f354d84 --- /dev/null +++ b/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/def_sethekk_halls.h @@ -0,0 +1,14 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +#ifndef DEF_SETHEKK_HALLS_H +#define DEF_SETHEKK_HALLS_H + +enum +{ + DATA_IKISSDOOREVENT = 1, + TYPE_ANZU_ENCOUNTER = 2, +}; +#endif + diff --git a/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/instance_sethekk_halls.cpp b/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/instance_sethekk_halls.cpp new file mode 100644 index 00000000000..060e09a1325 --- /dev/null +++ b/src/bindings/scripts/scripts/outland/auchindoun/sethekk_halls/instance_sethekk_halls.cpp @@ -0,0 +1,91 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Instance - Sethekk Halls +SD%Complete: 50 +SDComment: Instance Data for Sethekk Halls instance +SDCategory: Auchindoun, Sethekk Halls +EndScriptData */ + +#include "precompiled.h" +#include "def_sethekk_halls.h" + +enum +{ + NPC_ANZU = 23035, + IKISS_DOOR = 177203, +}; + +struct TRINITY_DLL_DECL instance_sethekk_halls : public ScriptedInstance +{ + instance_sethekk_halls(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + + uint32 AnzuEncounter; + uint64 m_uiIkissDoorGUID; + + void Initialize() + { + AnzuEncounter = NOT_STARTED; + m_uiIkissDoorGUID = 0; + } + + void OnCreatureCreate(Creature* pCreature, bool add) + { + if (pCreature->GetEntry() == NPC_ANZU && AnzuEncounter >= IN_PROGRESS) + { + pCreature->DealDamage(pCreature, pCreature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + pCreature->RemoveCorpse(); + } else { + AnzuEncounter = IN_PROGRESS; + } + } + + void OnGameObjectCreate(GameObject* pGo, bool add) + { + if (pGo->GetEntry() == IKISS_DOOR) + m_uiIkissDoorGUID = pGo->GetGUID(); + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_IKISSDOOREVENT: + if (data == DONE) + DoUseDoorOrButton(m_uiIkissDoorGUID,DAY*IN_MILISECONDS); + break; + case TYPE_ANZU_ENCOUNTER: + AnzuEncounter = data; + break; + } + } +}; + +InstanceData* GetInstanceData_instance_sethekk_halls(Map* pMap) +{ + return new instance_sethekk_halls(pMap); +} + +void AddSC_instance_sethekk_halls() +{ + Script *newscript; + newscript = new Script; + newscript->Name = "instance_sethekk_halls"; + newscript->GetInstanceData = &GetInstanceData_instance_sethekk_halls; + newscript->RegisterSelf(); +} + diff --git a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp new file mode 100644 index 00000000000..66e6b3a108d --- /dev/null +++ b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp @@ -0,0 +1,217 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Boss_Ambassador_Hellmaw +SD%Complete: 80 +SDComment: Enrage spell missing/not known +SDCategory: Auchindoun, Shadow Labyrinth +EndScriptData */ + +#include "precompiled.h" +#include "escort_ai.h" +#include "def_shadow_labyrinth.h" + +enum +{ + SAY_INTRO = -1555000, + SAY_AGGRO1 = -1555001, + SAY_AGGRO2 = -1555002, + SAY_AGGRO3 = -1555003, + SAY_HELP = -1555004, + SAY_SLAY1 = -1555005, + SAY_SLAY2 = -1555006, + SAY_DEATH = -1555007, + + SPELL_BANISH = 30231, + SPELL_CORROSIVE_ACID = 33551, + SPELL_FEAR = 33547, + SPELL_ENRAGE = 34970 +}; + +struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public npc_escortAI +{ + boss_ambassador_hellmawAI(Creature* pCreature) : npc_escortAI(pCreature) + { + m_pInstance = pCreature->GetInstanceData(); + HeroicMode = pCreature->GetMap()->IsHeroic(); + } + + ScriptedInstance* m_pInstance; + bool HeroicMode; + + uint32 EventCheck_Timer; + uint32 CorrosiveAcid_Timer; + uint32 Fear_Timer; + uint32 Enrage_Timer; + bool Intro; + bool IsBanished; + bool Enraged; + + void Reset() + { + EventCheck_Timer = 5000; + CorrosiveAcid_Timer = 5000 + rand()%5000; + Fear_Timer = 25000 + rand()%5000; + Enrage_Timer = 180000; + Intro = false; + IsBanished = true; + Enraged = false; + + if (m_pInstance && m_creature->isAlive()) + { + if (m_pInstance->GetData(TYPE_OVERSEER) != DONE) + m_creature->CastSpell(m_creature, SPELL_BANISH, true); + } + } + + void JustReachedHome() + { + if (m_pInstance) + m_pInstance->SetData(TYPE_HELLMAW, FAIL); + } + + void MoveInLineOfSight(Unit* pWho) + { + if (m_creature->HasAura(SPELL_BANISH)) + return; + + npc_escortAI::MoveInLineOfSight(pWho); + } + + void WaypointReached(uint32 i) + { + } + + void DoIntro() + { + if (m_creature->HasAura(SPELL_BANISH)) + m_creature->RemoveAurasDueToSpell(SPELL_BANISH); + + IsBanished = false; + Intro = true; + + if (m_pInstance) + { + if (m_pInstance->GetData(TYPE_HELLMAW) != FAIL) + { + DoScriptText(SAY_INTRO, m_creature); + Start(true, false, 0, NULL, false, true); + } + + m_pInstance->SetData(TYPE_HELLMAW, IN_PROGRESS); + } + } + + void EnterCombat(Unit *who) + { + switch(rand()%3) + { + case 0: DoScriptText(SAY_AGGRO1, m_creature); break; + case 1: DoScriptText(SAY_AGGRO2, m_creature); break; + case 2: DoScriptText(SAY_AGGRO3, m_creature); break; + } + } + + void KilledUnit(Unit *victim) + { + switch(rand()%2) + { + case 0: DoScriptText(SAY_SLAY1, m_creature); break; + case 1: DoScriptText(SAY_SLAY2, m_creature); break; + } + } + + void JustDied(Unit *victim) + { + DoScriptText(SAY_DEATH, m_creature); + + if (m_pInstance) + m_pInstance->SetData(TYPE_HELLMAW, DONE); + } + + void UpdateAI(const uint32 diff) + { + if (!Intro && !IsBeingEscorted) + { + if (EventCheck_Timer < diff) + { + if (m_pInstance) + { + if (m_pInstance->GetData(TYPE_OVERSEER) == DONE) + { + DoIntro(); + return; + } + } + EventCheck_Timer = 5000; + return; + } + else + { + EventCheck_Timer -= diff; + return; + } + } + + npc_escortAI::UpdateAI(diff); + + if (!UpdateVictim()) + return; + + if (m_creature->HasAura(SPELL_BANISH, 0)) + { + EnterEvadeMode(); + return; + } + + if (CorrosiveAcid_Timer < diff) + { + DoCast(m_creature->getVictim(),SPELL_CORROSIVE_ACID); + CorrosiveAcid_Timer = 15000 + rand()%10000; + }else CorrosiveAcid_Timer -= diff; + + if (Fear_Timer < diff) + { + DoCast(m_creature,SPELL_FEAR); + Fear_Timer = 20000 + rand()%15000; + }else Fear_Timer -= diff; + + if (HeroicMode) + { + if (!Enraged && Enrage_Timer < diff) + { + DoCast(m_creature,SPELL_ENRAGE); + Enraged = true; + }else Enrage_Timer -= diff; + } + } +}; + +CreatureAI* GetAI_boss_ambassador_hellmaw(Creature* pCreature) +{ + return new boss_ambassador_hellmawAI(pCreature); +} + +void AddSC_boss_ambassador_hellmaw() +{ + Script *newscript; + newscript = new Script; + newscript->Name="boss_ambassador_hellmaw"; + newscript->GetAI = &GetAI_boss_ambassador_hellmaw; + newscript->RegisterSelf(); +} + diff --git a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp new file mode 100644 index 00000000000..73374c08f8c --- /dev/null +++ b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp @@ -0,0 +1,177 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Boss_Blackheart_the_Inciter +SD%Complete: 75 +SDComment: Incite Chaos not functional since core lacks Mind Control support +SDCategory: Auchindoun, Shadow Labyrinth +EndScriptData */ + +#include "precompiled.h" +#include "def_shadow_labyrinth.h" + +#define SPELL_INCITE_CHAOS 33676 +#define SPELL_INCITE_CHAOS_B 33684 //debuff applied to each member of party +#define SPELL_CHARGE 33709 +#define SPELL_WAR_STOMP 33707 + +#define SAY_INTRO1 -1555008 +#define SAY_INTRO2 -1555009 +#define SAY_INTRO3 -1555010 +#define SAY_AGGRO1 -1555011 +#define SAY_AGGRO2 -1555012 +#define SAY_AGGRO3 -1555013 +#define SAY_SLAY1 -1555014 +#define SAY_SLAY2 -1555015 +#define SAY_HELP -1555016 +#define SAY_DEATH -1555017 + +#define SAY2_INTRO1 -1555018 +#define SAY2_INTRO2 -1555019 +#define SAY2_INTRO3 -1555020 +#define SAY2_AGGRO1 -1555021 +#define SAY2_AGGRO2 -1555022 +#define SAY2_AGGRO3 -1555023 +#define SAY2_SLAY1 -1555024 +#define SAY2_SLAY2 -1555025 +#define SAY2_HELP -1555026 +#define SAY2_DEATH -1555027 + +struct TRINITY_DLL_DECL boss_blackheart_the_inciterAI : public ScriptedAI +{ + boss_blackheart_the_inciterAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceData(); + } + + ScriptedInstance *pInstance; + + bool InciteChaos; + uint32 InciteChaos_Timer; + uint32 InciteChaosWait_Timer; + uint32 Charge_Timer; + uint32 Knockback_Timer; + + void Reset() + { + InciteChaos = false; + InciteChaos_Timer = 20000; + InciteChaosWait_Timer = 15000; + Charge_Timer = 5000; + Knockback_Timer = 15000; + + if (pInstance) + pInstance->SetData(DATA_BLACKHEARTTHEINCITEREVENT, NOT_STARTED); + } + + void KilledUnit(Unit *victim) + { + switch(rand()%2) + { + case 0: DoScriptText(SAY_SLAY1, m_creature); break; + case 1: DoScriptText(SAY_SLAY2, m_creature); break; + } + } + + void JustDied(Unit *victim) + { + DoScriptText(SAY_DEATH, m_creature); + + if (pInstance) + pInstance->SetData(DATA_BLACKHEARTTHEINCITEREVENT, DONE); + } + + void EnterCombat(Unit *who) + { + switch(rand()%3) + { + case 0: DoScriptText(SAY_AGGRO1, m_creature); break; + case 1: DoScriptText(SAY_AGGRO2, m_creature); break; + case 2: DoScriptText(SAY_AGGRO3, m_creature); break; + } + + if (pInstance) + pInstance->SetData(DATA_BLACKHEARTTHEINCITEREVENT, IN_PROGRESS); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (InciteChaos) + { + if (InciteChaosWait_Timer < diff) + { + InciteChaos = false; + InciteChaosWait_Timer = 15000; + }else InciteChaosWait_Timer -= diff; + + return; + } + + if (InciteChaos_Timer < diff) + { + DoCast(m_creature, SPELL_INCITE_CHAOS); + + std::list t_list = m_creature->getThreatManager().getThreatList(); + for(std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + { + Unit* target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); + if (target && target->GetTypeId() == TYPEID_PLAYER) + target->CastSpell(target,SPELL_INCITE_CHAOS_B,true); + } + + DoResetThreat(); + InciteChaos = true; + InciteChaos_Timer = 40000; + return; + }else InciteChaos_Timer -= diff; + + //Charge_Timer + if (Charge_Timer < diff) + { + if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(target, SPELL_CHARGE); + Charge_Timer = 15000 + rand()%10000; + }else Charge_Timer -= diff; + + //Knockback_Timer + if (Knockback_Timer < diff) + { + DoCast(m_creature, SPELL_WAR_STOMP); + Knockback_Timer = 18000 + rand()%6000; + }else Knockback_Timer -= diff; + + DoMeleeAttackIfReady(); + } +}; +CreatureAI* GetAI_boss_blackheart_the_inciter(Creature* pCreature) +{ + return new boss_blackheart_the_inciterAI (pCreature); +} + +void AddSC_boss_blackheart_the_inciter() +{ + Script *newscript; + newscript = new Script; + newscript->Name="boss_blackheart_the_inciter"; + newscript->GetAI = &GetAI_boss_blackheart_the_inciter; + newscript->RegisterSelf(); +} + diff --git a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp new file mode 100644 index 00000000000..0cc6255f3cf --- /dev/null +++ b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp @@ -0,0 +1,321 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Boss_Grandmaster_Vorpil +SD%Complete: 100 +SDComment: +SDCategory: Auchindoun, Shadow Labyrinth +EndScriptData */ + +#include "precompiled.h" +#include "def_shadow_labyrinth.h" + +#define SAY_INTRO -1555028 +#define SAY_AGGRO1 -1555029 +#define SAY_AGGRO2 -1555030 +#define SAY_AGGRO3 -1555031 +#define SAY_HELP -1555032 +#define SAY_SLAY1 -1555033 +#define SAY_SLAY2 -1555034 +#define SAY_DEATH -1555035 + +#define SPELL_RAIN_OF_FIRE 33617 +#define H_SPELL_RAIN_OF_FIRE 39363 + +#define SPELL_DRAW_SHADOWS 33563 +#define SPELL_SHADOWBOLT_VOLLEY 33841 +#define SPELL_BANISH 38791 + +#define MOB_VOID_TRAVELER 19226 +#define SPELL_SACRIFICE 33587 +#define SPELL_SHADOW_NOVA 33846 +#define SPELL_EMPOWERING_SHADOWS 33783 +#define H_SPELL_EMPOWERING_SHADOWS 39364 + +#define MOB_VOID_PORTAL 19224 +#define SPELL_VOID_PORTAL_VISUAL 33569 + +float VorpilPosition[3] = {-252.8820,-264.3030,17.1}; + +float VoidPortalCoords[5][3] = +{ + {-283.5894, -239.5718, 12.7}, + {-306.5853, -258.4539, 12.7}, + {-295.8789, -269.0899, 12.7}, + {-209.3401, -262.7564, 17.1}, + {-261.4533, -297.3298, 17.1} +}; + +struct TRINITY_DLL_DECL mob_voidtravelerAI : public ScriptedAI +{ + mob_voidtravelerAI(Creature *c) : ScriptedAI(c) + { + HeroicMode = m_creature->GetMap()->IsHeroic(); + } + + bool HeroicMode; + Unit *Vorpil; + uint32 move; + bool sacrificed; + + void Reset() + { + Vorpil = NULL; + move = 0; + sacrificed = false; + } + + void EnterCombat(Unit *who){} + + void UpdateAI(const uint32 diff) + { + if (!Vorpil) + { + m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + return; + } + if (move < diff) + { + if (sacrificed) + { + SpellEntry *spell = GET_SPELL(HeroicMode?H_SPELL_EMPOWERING_SHADOWS:SPELL_EMPOWERING_SHADOWS); + if (spell) + Vorpil->AddAura(new Aura(spell, 1, NULL, Vorpil, m_creature)); + Vorpil->SetHealth(Vorpil->GetHealth()+Vorpil->GetMaxHealth()/25); + DoCast(m_creature, SPELL_SHADOW_NOVA, true); + m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + return; + } + m_creature->GetMotionMaster()->MoveFollow(Vorpil,0,0); + if (m_creature->IsWithinDist(Vorpil, 3)) + { + DoCast(m_creature, SPELL_SACRIFICE, false); + sacrificed = true; + move = 500; + return; + } + if (!Vorpil->isInCombat() || Vorpil->isDead()) + { + m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + return; + } + move = 1000; + }else move -= diff; + } +}; +CreatureAI* GetAI_mob_voidtraveler(Creature* pCreature) +{ + return new mob_voidtravelerAI (pCreature); +} + +struct TRINITY_DLL_DECL boss_grandmaster_vorpilAI : public ScriptedAI +{ + boss_grandmaster_vorpilAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceData(); + HeroicMode = m_creature->GetMap()->IsHeroic(); + Intro = false; + } + + ScriptedInstance *pInstance; + bool Intro, HelpYell; + bool sumportals; + bool HeroicMode; + + uint32 ShadowBoltVolley_Timer; + uint32 DrawShadows_Timer; + uint32 summonTraveler_Timer; + uint32 banish_Timer; + uint64 PortalsGuid[5]; + + void Reset() + { + ShadowBoltVolley_Timer = 7000 + rand()%7000; + DrawShadows_Timer = 45000; + summonTraveler_Timer = 90000; + banish_Timer = 17000; + HelpYell = false; + destroyPortals(); + + if (pInstance) + pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, NOT_STARTED); + } + + void summonPortals() + { + if (!sumportals) + { + for (int i = 0;i<5; ++i) + { + Creature *Portal = NULL; + Portal = m_creature->SummonCreature(MOB_VOID_PORTAL,VoidPortalCoords[i][0],VoidPortalCoords[i][1],VoidPortalCoords[i][2],0,TEMPSUMMON_CORPSE_DESPAWN,3000000); + if (Portal) + { + PortalsGuid[i] = Portal->GetGUID(); + Portal->CastSpell(Portal,SPELL_VOID_PORTAL_VISUAL,false); + } + } + sumportals = true; + summonTraveler_Timer = 5000; + } + } + + void destroyPortals() + { + if (sumportals) + { + for (int i = 0;i < 5; i ++) + { + Unit *Portal = Unit::GetUnit((*m_creature), PortalsGuid[i]); + if (Portal && Portal->isAlive()) + Portal->DealDamage(Portal, Portal->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + PortalsGuid[i] = 0; + } + sumportals = false; + } + } + + void spawnVoidTraveler() + { + int pos = rand()%5; + m_creature->SummonCreature(MOB_VOID_TRAVELER,VoidPortalCoords[pos][0],VoidPortalCoords[pos][1],VoidPortalCoords[pos][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,5000); + if (!HelpYell) + { + DoScriptText(SAY_HELP, m_creature); + HelpYell = true; + } + } + + void JustSummoned(Creature *summoned) + { + if (summoned && summoned->GetEntry() == MOB_VOID_TRAVELER) + CAST_AI(mob_voidtravelerAI, summoned->AI())->Vorpil = m_creature; + } + + void KilledUnit(Unit *victim) + { + switch(rand()%2) + { + case 0: DoScriptText(SAY_SLAY1, m_creature); break; + case 1: DoScriptText(SAY_SLAY2, m_creature); break; + } + } + + void JustDied(Unit *victim) + { + DoScriptText(SAY_DEATH, m_creature); + destroyPortals(); + + if (pInstance) + pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, DONE); + } + + void EnterCombat(Unit *who) + { + switch(rand()%3) + { + case 0: DoScriptText(SAY_AGGRO1, m_creature); break; + case 1: DoScriptText(SAY_AGGRO2, m_creature); break; + case 2: DoScriptText(SAY_AGGRO3, m_creature); break; + } + summonPortals(); + + if (pInstance) + pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, IN_PROGRESS); + } + + void MoveInLineOfSight(Unit *who) + { + ScriptedAI::MoveInLineOfSight(who); + + if (!Intro && m_creature->IsWithinLOSInMap(who)&& m_creature->IsWithinDistInMap(who, 100) && m_creature->IsHostileTo(who)) + { + DoScriptText(SAY_INTRO, m_creature); + Intro = true; + } + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (ShadowBoltVolley_Timer < diff) + { + DoCast(m_creature,SPELL_SHADOWBOLT_VOLLEY); + ShadowBoltVolley_Timer = 15000 + rand()%15000;; + }else ShadowBoltVolley_Timer -= diff; + + if (HeroicMode && banish_Timer < diff) + { + Unit *target = SelectTarget(SELECT_TARGET_RANDOM,0,30,false); + if (target) + { + DoCast(target,SPELL_BANISH); + banish_Timer = 16000; + } + }else banish_Timer -= diff; + + if (DrawShadows_Timer < diff) + { + Map* pMap = m_creature->GetMap(); + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + if (Player* i_pl = i->getSource()) + if (i_pl->isAlive() && !i_pl->HasAura(SPELL_BANISH)) + i_pl->TeleportTo(m_creature->GetMapId(), VorpilPosition[0],VorpilPosition[1],VorpilPosition[2], 0, TELE_TO_NOT_LEAVE_COMBAT); + + m_creature->GetMap()->CreatureRelocation(m_creature, VorpilPosition[0],VorpilPosition[1],VorpilPosition[2],0.0f); + DoCast(m_creature,SPELL_DRAW_SHADOWS,true); + + DoCast(m_creature,HeroicMode?H_SPELL_RAIN_OF_FIRE:SPELL_RAIN_OF_FIRE); + + ShadowBoltVolley_Timer = 6000; + DrawShadows_Timer = 30000; + }else DrawShadows_Timer -= diff; + + if (summonTraveler_Timer < diff) + { + spawnVoidTraveler(); + summonTraveler_Timer = 10000; + //enrage at 20% + if ((m_creature->GetHealth()*5) < m_creature->GetMaxHealth()) + summonTraveler_Timer = 5000; + }else summonTraveler_Timer -=diff; + + DoMeleeAttackIfReady(); + } +}; +CreatureAI* GetAI_boss_grandmaster_vorpil(Creature* pCreature) +{ + return new boss_grandmaster_vorpilAI (pCreature); +} + +void AddSC_boss_grandmaster_vorpil() +{ + Script *newscript; + newscript = new Script; + newscript->Name="boss_grandmaster_vorpil"; + newscript->GetAI = &GetAI_boss_grandmaster_vorpil; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="mob_voidtraveler"; + newscript->GetAI = &GetAI_mob_voidtraveler; + newscript->RegisterSelf(); +} + diff --git a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp new file mode 100644 index 00000000000..259f6091af6 --- /dev/null +++ b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_murmur.cpp @@ -0,0 +1,207 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Boss_Murmur +SD%Complete: 90 +SDComment: Timers may be incorrect +SDCategory: Auchindoun, Shadow Labyrinth +EndScriptData */ + +#include "precompiled.h" +#include "def_shadow_labyrinth.h" + +#define EMOTE_SONIC_BOOM -1555036 + +#define SPELL_SONIC_BOOM_CAST (HeroicMode?38796:33923) +#define SPELL_SONIC_BOOM_EFFECT (HeroicMode?38795:33666) +#define SPELL_RESONANCE 33657 +#define SPELL_MURMURS_TOUCH (HeroicMode?38794:33711) +#define SPELL_MAGNETIC_PULL 33689 +#define SPELL_SONIC_SHOCK 38797 +#define SPELL_THUNDERING_STORM 39365 + +struct TRINITY_DLL_DECL boss_murmurAI : public ScriptedAI +{ + boss_murmurAI(Creature *c) : ScriptedAI(c) + { + SetCombatMovement(false); + HeroicMode = m_creature->GetMap()->IsHeroic(); + } + + uint32 SonicBoom_Timer; + uint32 MurmursTouch_Timer; + uint32 Resonance_Timer; + uint32 MagneticPull_Timer; + uint32 SonicShock_Timer; + uint32 ThunderingStorm_Timer; + bool HeroicMode; + bool SonicBoom; + + void Reset() + { + SonicBoom_Timer = 30000; + MurmursTouch_Timer = 8000 + rand()%12000; + Resonance_Timer = 5000; + MagneticPull_Timer = 15000 + rand()%15000; + ThunderingStorm_Timer = 15000; + SonicShock_Timer = 10000; + SonicBoom = false; + + //database should have `RegenHealth`=0 to prevent regen + uint32 hp = (m_creature->GetMaxHealth()*40)/100; + if (hp) m_creature->SetHealth(hp); + m_creature->ResetPlayerDamageReq(); + } + + void SonicBoomEffect() + { + std::list t_list = m_creature->getThreatManager().getThreatList(); + for(std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + { + Unit* target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); + if (target && target->GetTypeId() == TYPEID_PLAYER) + { + //Not do anything without aura, spell can be resisted! + if (target->HasAura(SPELL_SONIC_BOOM_CAST) && m_creature->IsWithinDistInMap(target, 34.0f)) + { + //This will be wrong calculation. Also, comments suggest it must deal damage + target->SetHealth(uint32(target->GetMaxHealth() - target->GetMaxHealth() * 0.8)); + } + } + } + } + + void EnterCombat(Unit *who) { } + + // Sonic Boom instant damage (needs core fix instead of this) + void SpellHitTarget(Unit *target, const SpellEntry *spell) + { + if (target && target->isAlive() && spell && spell->Id == SPELL_SONIC_BOOM_EFFECT) + m_creature->DealDamage(target,(target->GetHealth()*90)/100,NULL,SPELL_DIRECT_DAMAGE,SPELL_SCHOOL_MASK_NATURE,spell); + } + + void UpdateAI(const uint32 diff) + { + //Return since we have no target or casting + if (!UpdateVictim() || m_creature->IsNonMeleeSpellCasted(false)) + return; + + // Sonic Boom + if (SonicBoom) + { + DoCast(m_creature, SPELL_SONIC_BOOM_EFFECT, true); + SonicBoomEffect(); + + SonicBoom = false; + Resonance_Timer = 1500; + } + if (SonicBoom_Timer < diff) + { + DoScriptText(EMOTE_SONIC_BOOM, m_creature); + DoCast(m_creature, SPELL_SONIC_BOOM_CAST); + SonicBoom_Timer = 30000; + SonicBoom = true; + return; + }else SonicBoom_Timer -= diff; + + // Murmur's Touch + if (MurmursTouch_Timer < diff) + { + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM,0,80,true)) + DoCast(target, SPELL_MURMURS_TOUCH); + MurmursTouch_Timer = 25000 + rand()%10000; + }else MurmursTouch_Timer -= diff; + + // Resonance + if (!SonicBoom && !(m_creature->IsWithinMeleeRange(m_creature->getVictim()))) + { + if (Resonance_Timer < diff) + { + DoCast(m_creature, SPELL_RESONANCE); + Resonance_Timer = 5000; + }else Resonance_Timer -= diff; + } + + // Magnetic Pull + if (MagneticPull_Timer < diff) + { + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + if (target->GetTypeId() == TYPEID_PLAYER && target->isAlive()) + { + DoCast(target, SPELL_MAGNETIC_PULL); + MagneticPull_Timer = 15000+rand()%15000; + return; + } + MagneticPull_Timer = 500; + }else MagneticPull_Timer -= diff; + + if (HeroicMode) + { + // Thundering Storm + if (ThunderingStorm_Timer < diff) + { + std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); + for(std::list::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) + if (Unit* target = Unit::GetUnit((*m_creature),(*i)->getUnitGuid())) + if (target->isAlive() && !m_creature->IsWithinDist(target, 35, false)) + DoCast(target, SPELL_THUNDERING_STORM, true); + ThunderingStorm_Timer = 15000; + }else ThunderingStorm_Timer -= diff; + + // Sonic Shock + if (SonicShock_Timer < diff) + { + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM,0,20,false)) + if (target->isAlive()) + DoCast(target, SPELL_SONIC_SHOCK); + SonicShock_Timer = 10000+rand()%10000; + }else SonicShock_Timer -= diff; + } + + // Select nearest most aggro target if top aggro too far + if (!m_creature->isAttackReady()) + return; + if (!m_creature->IsWithinMeleeRange(m_creature->getVictim())) + { + std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); + for(std::list::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) + if (Unit* target = Unit::GetUnit((*m_creature),(*i)->getUnitGuid())) + if (target->isAlive() && m_creature->IsWithinMeleeRange(target)) + { + m_creature->TauntApply(target); + break; + } + } + + DoMeleeAttackIfReady(); + } +}; + +CreatureAI* GetAI_boss_murmur(Creature* pCreature) +{ + return new boss_murmurAI (pCreature); +} + +void AddSC_boss_murmur() +{ + Script *newscript; + newscript = new Script; + newscript->Name="boss_murmur"; + newscript->GetAI = &GetAI_boss_murmur; + newscript->RegisterSelf(); +} + diff --git a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/def_shadow_labyrinth.h b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/def_shadow_labyrinth.h new file mode 100644 index 00000000000..a78955368bf --- /dev/null +++ b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/def_shadow_labyrinth.h @@ -0,0 +1,15 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software licensed under GPL version 2 + * Please see the included DOCS/LICENSE.TXT for more information */ + +#ifndef DEF_SHADOW_LABYRINTH_H +#define DEF_SHADOW_LABYRINTH_H + +#define TYPE_HELLMAW 1 +#define TYPE_OVERSEER 2 +#define DATA_BLACKHEARTTHEINCITEREVENT 3 +#define DATA_GRANDMASTERVORPILEVENT 4 +#define DATA_MURMUREVENT 5 +#define DATA_GRANDMASTERVORPIL 6 +#endif + diff --git a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp new file mode 100644 index 00000000000..f8f3b73bffa --- /dev/null +++ b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp @@ -0,0 +1,227 @@ +/* Copyright (C) 2006 - 2009 ScriptDev2 + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* ScriptData +SDName: Instance_Shadow_Labyrinth +SD%Complete: 85 +SDComment: Some cleanup left along with save +SDCategory: Auchindoun, Shadow Labyrinth +EndScriptData */ + +#include "precompiled.h" +#include "def_shadow_labyrinth.h" + +#define MAX_ENCOUNTER 5 + +#define REFECTORY_DOOR 183296 //door opened when blackheart the inciter dies +#define SCREAMING_HALL_DOOR 183295 //door opened when grandmaster vorpil dies + +/* Shadow Labyrinth encounters: +1 - Ambassador Hellmaw event +2 - Blackheart the Inciter event +3 - Grandmaster Vorpil event +4 - Murmur event +*/ + +struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance +{ + instance_shadow_labyrinth(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; + + uint32 m_auiEncounter[MAX_ENCOUNTER]; + std::string str_data; + + uint64 m_uiRefectoryDoorGUID; + uint64 m_uiScreamingHallDoorGUID; + + uint64 m_uiGrandmasterVorpil; + uint32 m_uiFelOverseerCount; + + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + m_uiRefectoryDoorGUID = 0; + m_uiScreamingHallDoorGUID = 0; + + m_uiGrandmasterVorpil = 0; + m_uiFelOverseerCount = 0; + } + + bool IsEncounterInProgress() const + { + for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; + + return false; + } + + void OnGameObjectCreate(GameObject* pGo, bool add) + { + switch(pGo->GetEntry()) + { + case REFECTORY_DOOR: + m_uiRefectoryDoorGUID = pGo->GetGUID(); + if (m_auiEncounter[2] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + break; + case SCREAMING_HALL_DOOR: + m_uiScreamingHallDoorGUID = pGo->GetGUID(); + if (m_auiEncounter[3] == DONE) + pGo->SetGoState(GO_STATE_ACTIVE); + break; + } + } + + void OnCreatureCreate(Creature* pCreature, bool add) + { + switch(pCreature->GetEntry()) + { + case 18732: + m_uiGrandmasterVorpil = pCreature->GetGUID(); + break; + case 18796: + if (pCreature->isAlive()) + { + ++m_uiFelOverseerCount; + debug_log("TSCR: Shadow Labyrinth: counting %u Fel Overseers.",m_uiFelOverseerCount); + } + break; + } + } + + void SetData(uint32 type, uint32 uiData) + { + switch(type) + { + case TYPE_HELLMAW: + m_auiEncounter[0] = uiData; + break; + + case TYPE_OVERSEER: + if (uiData != DONE) + { + error_log("TSCR: Shadow Labyrinth: TYPE_OVERSEER did not expect other data than DONE"); + return; + } + if (m_uiFelOverseerCount) + { + --m_uiFelOverseerCount; + + if (m_uiFelOverseerCount) + debug_log("TSCR: Shadow Labyrinth: %u Fel Overseers left to kill.",m_uiFelOverseerCount); + else + { + m_auiEncounter[1] = DONE; + debug_log("TSCR: Shadow Labyrinth: TYPE_OVERSEER == DONE"); + } + } + break; + + case DATA_BLACKHEARTTHEINCITEREVENT: + if (uiData == DONE) + DoUseDoorOrButton(m_uiRefectoryDoorGUID); + m_auiEncounter[2] = uiData; + break; + + case DATA_GRANDMASTERVORPILEVENT: + if (uiData == DONE) + DoUseDoorOrButton(m_uiScreamingHallDoorGUID); + m_auiEncounter[3] = uiData; + break; + + case DATA_MURMUREVENT: + m_auiEncounter[4] = uiData; + break; + } + + if (uiData == DONE) + { + if (type == TYPE_OVERSEER && m_uiFelOverseerCount != 0) + return; + + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " + << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4]; + + str_data = saveStream.str(); + + SaveToDB(); + OUT_SAVE_INST_DATA_COMPLETE; + } + } + + uint32 GetData(uint32 type) + { + switch(type) + { + case TYPE_HELLMAW: return m_auiEncounter[0]; + case TYPE_OVERSEER: return m_auiEncounter[1]; + case DATA_GRANDMASTERVORPILEVENT: return m_auiEncounter[3]; + case DATA_MURMUREVENT: return m_auiEncounter[4]; + } + return false; + } + + uint64 GetData64(uint32 identifier) + { + if (identifier == DATA_GRANDMASTERVORPIL) + return m_uiGrandmasterVorpil; + + return 0; + } + + std::string GetSaveData() + { + return str_data; + } + + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + std::istringstream loadStream(in); + loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> m_auiEncounter[4]; + + for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + + OUT_LOAD_INST_DATA_COMPLETE; + } +}; + +InstanceData* GetInstanceData_instance_shadow_labyrinth(Map* pMap) +{ + return new instance_shadow_labyrinth(pMap); +} + +void AddSC_instance_shadow_labyrinth() +{ + Script *newscript; + newscript = new Script; + newscript->Name = "instance_shadow_labyrinth"; + newscript->GetInstanceData = &GetInstanceData_instance_shadow_labyrinth; + newscript->RegisterSelf(); +} + diff --git a/src/bindings/scripts/scripts/outland/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp b/src/bindings/scripts/scripts/outland/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp deleted file mode 100644 index 414804a6576..00000000000 --- a/src/bindings/scripts/scripts/outland/aunchindoun/auchenai_crypts/boss_exarch_maladaar.cpp +++ /dev/null @@ -1,358 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Boss_Exarch_Maladaar -SD%Complete: 95 -SDComment: Most of event implemented, some adjustments to timers remain and possibly make some better code for switching his dark side in to better "images" of player. -SDCategory: Auchindoun, Auchenai Crypts -EndScriptData */ - -/* ContentData -mob_stolen_soul -boss_exarch_maladaar -mob_avatar_of_martyred -EndContentData */ - -#include "precompiled.h" - -#define SPELL_MOONFIRE 37328 -#define SPELL_FIREBALL 37329 -#define SPELL_MIND_FLAY 37330 -#define SPELL_HEMORRHAGE 37331 -#define SPELL_FROSTSHOCK 37332 -#define SPELL_CURSE_OF_AGONY 37334 -#define SPELL_MORTAL_STRIKE 37335 -#define SPELL_FREEZING_TRAP 37368 -#define SPELL_HAMMER_OF_JUSTICE 37369 - -struct TRINITY_DLL_DECL mob_stolen_soulAI : public ScriptedAI -{ - mob_stolen_soulAI(Creature *c) : ScriptedAI(c) {} - - uint8 myClass; - uint32 Class_Timer; - - void Reset() - { - Class_Timer = 1000; - } - - void EnterCombat(Unit *who) - { } - - void SetMyClass(uint8 myclass) - { - myClass = myclass; - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (Class_Timer < diff) - { - switch (myClass) - { - case CLASS_WARRIOR: - DoCast(m_creature->getVictim(), SPELL_MORTAL_STRIKE); - Class_Timer = 6000; - break; - case CLASS_PALADIN: - DoCast(m_creature->getVictim(), SPELL_HAMMER_OF_JUSTICE); - Class_Timer = 6000; - break; - case CLASS_HUNTER: - DoCast(m_creature->getVictim(), SPELL_FREEZING_TRAP); - Class_Timer = 20000; - break; - case CLASS_ROGUE: - DoCast(m_creature->getVictim(), SPELL_HEMORRHAGE); - Class_Timer = 10000; - break; - case CLASS_PRIEST: - DoCast(m_creature->getVictim(), SPELL_MIND_FLAY); - Class_Timer = 5000; - break; - case CLASS_SHAMAN: - DoCast(m_creature->getVictim(), SPELL_FROSTSHOCK); - Class_Timer = 8000; - break; - case CLASS_MAGE: - DoCast(m_creature->getVictim(), SPELL_FIREBALL); - Class_Timer = 5000; - break; - case CLASS_WARLOCK: - DoCast(m_creature->getVictim(), SPELL_CURSE_OF_AGONY); - Class_Timer = 20000; - break; - case CLASS_DRUID: - DoCast(m_creature->getVictim(), SPELL_MOONFIRE); - Class_Timer = 10000; - break; - } - } else Class_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_mob_stolen_soul(Creature* pCreature) -{ - return new mob_stolen_soulAI (pCreature); -} - -#define SAY_INTRO -1558000 -#define SAY_SUMMON -1558001 - -#define SAY_AGGRO_1 -1558002 -#define SAY_AGGRO_2 -1558003 -#define SAY_AGGRO_3 -1558004 - -#define SAY_ROAR -1558005 -#define SAY_SOUL_CLEAVE -1558006 - -#define SAY_SLAY_1 -1558007 -#define SAY_SLAY_2 -1558008 - -#define SAY_DEATH -1558009 - -#define SPELL_RIBBON_OF_SOULS 32422 -#define SPELL_SOUL_SCREAM 32421 - -#define SPELL_STOLEN_SOUL 32346 -#define SPELL_STOLEN_SOUL_VISUAL 32395 - -#define SPELL_SUMMON_AVATAR 32424 - -#define ENTRY_STOLEN_SOUL 18441 - -struct TRINITY_DLL_DECL boss_exarch_maladaarAI : public ScriptedAI -{ - boss_exarch_maladaarAI(Creature *c) : ScriptedAI(c) - { - HasTaunted = false; - } - - uint32 soulmodel; - uint64 soulholder; - uint8 soulclass; - - uint32 Fear_timer; - uint32 Ribbon_of_Souls_timer; - uint32 StolenSoul_Timer; - - bool HasTaunted; - bool Avatar_summoned; - - void Reset() - { - soulmodel = 0; - soulholder = 0; - soulclass = 0; - - Fear_timer = 15000 + rand()% 5000; - Ribbon_of_Souls_timer = 5000; - StolenSoul_Timer = 25000 + rand()% 10000; - - Avatar_summoned = false; - } - - void MoveInLineOfSight(Unit *who) - { - if (!HasTaunted && m_creature->IsWithinDistInMap(who, 150.0)) - { - DoScriptText(SAY_INTRO, m_creature); - HasTaunted = true; - } - - ScriptedAI::MoveInLineOfSight(who); - } - - - void EnterCombat(Unit *who) - { - switch (rand()%3) - { - case 0: DoScriptText(SAY_AGGRO_1, m_creature); break; - case 1: DoScriptText(SAY_AGGRO_2, m_creature); break; - case 2: DoScriptText(SAY_AGGRO_3, m_creature); break; - } - } - - void JustSummoned(Creature *summoned) - { - if (summoned->GetEntry() == ENTRY_STOLEN_SOUL) - { - //SPELL_STOLEN_SOUL_VISUAL has shapeshift effect, but not implemented feature in Trinity for this spell. - summoned->CastSpell(summoned,SPELL_STOLEN_SOUL_VISUAL,false); - summoned->SetDisplayId(soulmodel); - summoned->setFaction(m_creature->getFaction()); - - if (Unit *target = Unit::GetUnit(*m_creature,soulholder)) - { - - CAST_AI(mob_stolen_soulAI, summoned->AI())->SetMyClass(soulclass); - summoned->AI()->AttackStart(target); - } - } - } - - void KilledUnit(Unit* victim) - { - if (rand()%2) - return; - - switch (rand()%2) - { - case 0: DoScriptText(SAY_SLAY_1, m_creature); break; - case 1: DoScriptText(SAY_SLAY_2, m_creature); break; - } - } - - void JustDied(Unit* Killer) - { - DoScriptText(SAY_DEATH, m_creature); - //When Exarch Maladar is defeated D'ore appear. - m_creature->SummonCreature(19412, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 600000); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (!Avatar_summoned && ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 25)) - { - if (m_creature->IsNonMeleeSpellCasted(false)) - m_creature->InterruptNonMeleeSpells(true); - - DoScriptText(SAY_SUMMON, m_creature); - - DoCast(m_creature, SPELL_SUMMON_AVATAR); - Avatar_summoned = true; - StolenSoul_Timer = 15000 + rand()% 15000; - } - - if (StolenSoul_Timer < diff) - { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - { - if (target->GetTypeId() == TYPEID_PLAYER) - { - if (m_creature->IsNonMeleeSpellCasted(false)) - m_creature->InterruptNonMeleeSpells(true); - - uint32 i = urand(1,2); - if (i == 1) - DoScriptText(SAY_ROAR, m_creature); - else - DoScriptText(SAY_SOUL_CLEAVE, m_creature); - - soulmodel = target->GetDisplayId(); - soulholder = target->GetGUID(); - soulclass = target->getClass(); - - DoCast(target,SPELL_STOLEN_SOUL); - m_creature->SummonCreature(ENTRY_STOLEN_SOUL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 10000); - - StolenSoul_Timer = 20000 + rand()% 10000; - } else StolenSoul_Timer = 1000; - } - }else StolenSoul_Timer -= diff; - - if (Ribbon_of_Souls_timer < diff) - { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_RIBBON_OF_SOULS); - - Ribbon_of_Souls_timer = 5000 + (rand()%20 * 1000); - }else Ribbon_of_Souls_timer -= diff; - - if (Fear_timer < diff) - { - DoCast(m_creature,SPELL_SOUL_SCREAM); - Fear_timer = 15000 + rand()% 15000; - }else Fear_timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_exarch_maladaar(Creature* pCreature) -{ - return new boss_exarch_maladaarAI (pCreature); -} - -#define SPELL_AV_MORTAL_STRIKE 16856 -#define SPELL_AV_SUNDER_ARMOR 16145 - -struct TRINITY_DLL_DECL mob_avatar_of_martyredAI : public ScriptedAI -{ - mob_avatar_of_martyredAI(Creature *c) : ScriptedAI(c) {} - - uint32 Mortal_Strike_timer; - - void Reset() - { - Mortal_Strike_timer = 10000; - } - - void EnterCombat(Unit *who) - { - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (Mortal_Strike_timer < diff) - { - DoCast(m_creature->getVictim(), SPELL_AV_MORTAL_STRIKE); - Mortal_Strike_timer = 10000 + rand()%20 * 1000; - } else Mortal_Strike_timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_mob_avatar_of_martyred(Creature* pCreature) -{ - return new mob_avatar_of_martyredAI (pCreature); -} - -void AddSC_boss_exarch_maladaar() -{ - Script *newscript; - - newscript = new Script; - newscript->Name="boss_exarch_maladaar"; - newscript->GetAI = &GetAI_boss_exarch_maladaar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_avatar_of_martyred"; - newscript->GetAI = &GetAI_mob_avatar_of_martyred; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_stolen_soul"; - newscript->GetAI = &GetAI_mob_stolen_soul; - newscript->RegisterSelf(); -} - diff --git a/src/bindings/scripts/scripts/outland/aunchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp b/src/bindings/scripts/scripts/outland/aunchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp deleted file mode 100644 index 4dfdd407731..00000000000 --- a/src/bindings/scripts/scripts/outland/aunchindoun/auchenai_crypts/boss_shirrak_the_dead_watcher.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -Name: Boss_Shirrak_the_dead_watcher -%Complete: 80 -Comment: InhibitMagic should stack slower far from the boss, proper Visual for Focus Fire, heroic implemented -Category: Auchindoun, Auchenai Crypts -EndScriptData */ - -#include "precompiled.h" - -#define SPELL_INHIBITMAGIC 32264 -#define SPELL_ATTRACTMAGIC 32265 -#define N_SPELL_CARNIVOROUSBITE 36383 -#define H_SPELL_CARNIVOROUSBITE 39382 -#define SPELL_CARNIVOROUSBITE (HeroicMode?H_SPELL_CARNIVOROUSBITE:N_SPELL_CARNIVOROUSBITE) - -#define ENTRY_FOCUS_FIRE 18374 - -#define N_SPELL_FIERY_BLAST 32302 -#define H_SPELL_FIERY_BLAST 38382 -#define SPELL_FIERY_BLAST (HeroicMode?H_SPELL_FIERY_BLAST:N_SPELL_FIERY_BLAST) -#define SPELL_FOCUS_FIRE_VISUAL 42075 //need to find better visual - -struct TRINITY_DLL_DECL boss_shirrak_the_dead_watcherAI : public ScriptedAI -{ - boss_shirrak_the_dead_watcherAI(Creature *c) : ScriptedAI(c) - { - HeroicMode = m_creature->GetMap()->IsHeroic(); - } - - uint32 Inhibitmagic_Timer; - uint32 Attractmagic_Timer; - uint32 Carnivorousbite_Timer; - uint32 FocusFire_Timer; - bool HeroicMode; - Unit *focusedTarget; - - void Reset() - { - Inhibitmagic_Timer = 0; - Attractmagic_Timer = 28000; - Carnivorousbite_Timer = 10000; - FocusFire_Timer = 17000; - focusedTarget = NULL; - } - - void EnterCombat(Unit *who) - { } - - void JustSummoned(Creature *summoned) - { - if (summoned && summoned->GetEntry() == ENTRY_FOCUS_FIRE) - { - summoned->CastSpell(summoned,SPELL_FOCUS_FIRE_VISUAL,false); - summoned->setFaction(m_creature->getFaction()); - summoned->SetLevel(m_creature->getLevel()); - summoned->addUnitState(UNIT_STAT_ROOT); - - if (focusedTarget) - summoned->AI()->AttackStart(focusedTarget); - } - } - - void UpdateAI(const uint32 diff) - { - //Inhibitmagic_Timer - if (Inhibitmagic_Timer < diff) - { - float dist; - Map* pMap = m_creature->GetMap(); - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (Player* i_pl = i->getSource()) - if (i_pl->isAlive() && (dist = i_pl->IsWithinDist(m_creature, 45))) - { - i_pl->RemoveAurasDueToSpell(SPELL_INHIBITMAGIC); - m_creature->AddAura(SPELL_INHIBITMAGIC, i_pl); - if (dist < 35) - m_creature->AddAura(SPELL_INHIBITMAGIC, i_pl); - if (dist < 25) - m_creature->AddAura(SPELL_INHIBITMAGIC, i_pl); - if (dist < 15) - m_creature->AddAura(SPELL_INHIBITMAGIC, i_pl); - } - Inhibitmagic_Timer = 3000+(rand()%1000); - }else Inhibitmagic_Timer -= diff; - - //Return since we have no target - if (!UpdateVictim()) - return; - - //Attractmagic_Timer - if (Attractmagic_Timer < diff) - { - DoCast(m_creature,SPELL_ATTRACTMAGIC); - Attractmagic_Timer = 30000; - Carnivorousbite_Timer = 1500; - }else Attractmagic_Timer -= diff; - - //Carnivorousbite_Timer - if (Carnivorousbite_Timer < diff) - { - DoCast(m_creature,SPELL_CARNIVOROUSBITE); - Carnivorousbite_Timer = 10000; - }else Carnivorousbite_Timer -= diff; - - //FocusFire_Timer - if (FocusFire_Timer < diff) - { - // Summon Focus Fire & Emote - Unit *target = SelectUnit(SELECT_TARGET_RANDOM,1); - if (target && target->GetTypeId() == TYPEID_PLAYER && target->isAlive()) - { - focusedTarget = target; - m_creature->SummonCreature(ENTRY_FOCUS_FIRE,target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,5500); - - // TODO: Find better way to handle emote - // Emote - std::string *emote = new std::string("focuses on "); - emote->append(target->GetName()); - emote->append("!"); - const char* text = emote->c_str(); - m_creature->MonsterTextEmote(text, 0, true); - delete emote; - } - FocusFire_Timer = 15000+(rand()%5000); - }else FocusFire_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_shirrak_the_dead_watcher(Creature* pCreature) -{ - return new boss_shirrak_the_dead_watcherAI (pCreature); -} - -struct TRINITY_DLL_DECL mob_focus_fireAI : public ScriptedAI -{ - mob_focus_fireAI(Creature *c) : ScriptedAI(c) - { - HeroicMode = m_creature->GetMap()->IsHeroic(); - } - - bool HeroicMode; - uint32 FieryBlast_Timer; - bool fiery1, fiery2; - - void Reset() - { - FieryBlast_Timer = 3000+(rand()%1000); - fiery1 = fiery2 = true; - } - - void EnterCombat(Unit *who) - { } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - //FieryBlast_Timer - if (fiery2 && FieryBlast_Timer < diff) - { - DoCast(m_creature,SPELL_FIERY_BLAST); - - if (fiery1) fiery1 = false; - else if (fiery2) fiery2 = false; - - FieryBlast_Timer = 1000; - }else FieryBlast_Timer -= diff; - - //DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_mob_focus_fire(Creature* pCreature) -{ - return new mob_focus_fireAI (pCreature); -} - -void AddSC_boss_shirrak_the_dead_watcher() -{ - Script *newscript; - newscript = new Script; - newscript->Name="boss_shirrak_the_dead_watcher"; - newscript->GetAI = &GetAI_boss_shirrak_the_dead_watcher; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_focus_fire"; - newscript->GetAI = &GetAI_mob_focus_fire; - newscript->RegisterSelf(); -} - diff --git a/src/bindings/scripts/scripts/outland/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp b/src/bindings/scripts/scripts/outland/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp deleted file mode 100644 index dcaaefee8c2..00000000000 --- a/src/bindings/scripts/scripts/outland/aunchindoun/mana_tombs/boss_nexusprince_shaffar.cpp +++ /dev/null @@ -1,369 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Boss_NexusPrince_Shaffar -SD%Complete: 80 -SDComment: Need more tuning of spell timers, it should not be as linear fight as current. Also should possibly find a better way to deal with his three initial beacons to make sure all aggro. -SDCategory: Auchindoun, Mana Tombs -EndScriptData */ - -/* ContentData -boss_nexusprince_shaffar -mob_ethereal_beacon -EndContentData */ - -#include "precompiled.h" - -enum -{ - SAY_INTRO = -1557000, - SAY_AGGRO_1 = -1557001, - SAY_AGGRO_2 = -1557002, - SAY_AGGRO_3 = -1557003, - SAY_SLAY_1 = -1557004, - SAY_SLAY_2 = -1557005, - SAY_SUMMON = -1557006, - SAY_DEAD = -1557007, - - SPELL_BLINK = 34605, - SPELL_FROSTBOLT = 32364, - SPELL_FIREBALL = 32363, - SPELL_FROSTNOVA = 32365, - - SPELL_ETHEREAL_BEACON = 32371, // Summons NPC_BEACON - SPELL_ETHEREAL_BEACON_VISUAL = 32368, - - NPC_BEACON = 18431, - NPC_SHAFFAR = 18344, - - NR_INITIAL_BEACONS = 3 -}; - -struct TRINITY_DLL_DECL boss_nexusprince_shaffarAI : public ScriptedAI -{ - boss_nexusprince_shaffarAI(Creature *c) : ScriptedAI(c), summons(me) { HasTaunted = false; } - - uint32 Blink_Timer; - uint32 Beacon_Timer; - uint32 FireBall_Timer; - uint32 Frostbolt_Timer; - uint32 FrostNova_Timer; - - SummonList summons; - - bool HasTaunted; - bool CanBlink; - - void Reset() - { - Blink_Timer = 1500; - Beacon_Timer = 10000; - FireBall_Timer = 8000; - Frostbolt_Timer = 4000; - FrostNova_Timer = 15000; - - CanBlink = false; - - float dist = 8.0f; - float posX, posY, posZ, angle; - m_creature->GetHomePosition(posX, posY, posZ, angle); - - m_creature->SummonCreature(NPC_BEACON, posX - dist, posY - dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); - m_creature->SummonCreature(NPC_BEACON, posX - dist, posY + dist, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); - m_creature->SummonCreature(NPC_BEACON, posX + dist, posY, posZ, angle, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 7200000); - } - - void EnterEvadeMode() - { - summons.DespawnAll(); - ScriptedAI::EnterEvadeMode(); - } - - void MoveInLineOfSight(Unit *who) - { - if (!HasTaunted && who->GetTypeId() == TYPEID_PLAYER && m_creature->IsWithinDistInMap(who, 100.0f)) - { - DoScriptText(SAY_INTRO, m_creature); - HasTaunted = true; - } - } - - void EnterCombat(Unit *who) - { - switch(rand()%3) - { - case 0: DoScriptText(SAY_AGGRO_1, m_creature); break; - case 1: DoScriptText(SAY_AGGRO_2, m_creature); break; - case 2: DoScriptText(SAY_AGGRO_3, m_creature); break; - } - - DoZoneInCombat(); - summons.DoZoneInCombat(); - } - - void JustSummoned(Creature *summoned) - { - if (summoned->GetEntry() == NPC_BEACON) - { - summoned->CastSpell(summoned,SPELL_ETHEREAL_BEACON_VISUAL,false); - - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - summoned->AI()->AttackStart(target); - } - - summons.Summon(summoned); - } - - void SummonedCreatureDespawn(Creature *summon) - { - summons.Despawn(summon); - } - - void KilledUnit(Unit* victim) - { - switch(rand()%2) - { - case 0: DoScriptText(SAY_SLAY_1, m_creature); break; - case 1: DoScriptText(SAY_SLAY_2, m_creature); break; - } - } - - void JustDied(Unit* Killer) - { - DoScriptText(SAY_DEAD, m_creature); - summons.DespawnAll(); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (FrostNova_Timer < diff) - { - if (m_creature->IsNonMeleeSpellCasted(false)) - m_creature->InterruptNonMeleeSpells(true); - - DoCast(m_creature,SPELL_FROSTNOVA); - FrostNova_Timer = 17500 + rand()%7500; - CanBlink = true; - }else FrostNova_Timer -= diff; - - if (Frostbolt_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_FROSTBOLT); - Frostbolt_Timer = 4500 + rand()%1500; - }else Frostbolt_Timer -= diff; - - if (FireBall_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_FIREBALL); - FireBall_Timer = 4500 + rand()%1500; - }else FireBall_Timer -= diff; - - if (CanBlink) - { - if (Blink_Timer < diff) - { - if (m_creature->IsNonMeleeSpellCasted(false)) - m_creature->InterruptNonMeleeSpells(true); - - //expire movement, will prevent from running right back to victim after cast - //(but should MoveChase be used again at a certain time or should he not move?) - if (m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == TARGETED_MOTION_TYPE) - m_creature->GetMotionMaster()->MovementExpired(); - - DoCast(m_creature,SPELL_BLINK); - Blink_Timer = 1000 + rand()%1500; - CanBlink = false; - }else Blink_Timer -= diff; - } - - if (Beacon_Timer < diff) - { - if (m_creature->IsNonMeleeSpellCasted(false)) - m_creature->InterruptNonMeleeSpells(true); - - if (!urand(0,3)) - DoScriptText(SAY_SUMMON, m_creature); - - DoCast(m_creature,SPELL_ETHEREAL_BEACON, true); - - Beacon_Timer = 10000; - }else Beacon_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_nexusprince_shaffar(Creature* pCreature) -{ - return new boss_nexusprince_shaffarAI (pCreature); -} - -enum -{ - SPELL_ARCANE_BOLT = 15254, - SPELL_ETHEREAL_APPRENTICE = 32372 // Summon 18430 -}; - -struct TRINITY_DLL_DECL mob_ethereal_beaconAI : public ScriptedAI -{ - mob_ethereal_beaconAI(Creature *c) : ScriptedAI(c) - { - HeroicMode = m_creature->GetMap()->IsHeroic(); - } - - bool HeroicMode; - uint32 Apprentice_Timer; - uint32 ArcaneBolt_Timer; - uint32 Check_Timer; - - void KillSelf() - { - m_creature->Kill(m_creature); - } - - void Reset() - { - Apprentice_Timer = (HeroicMode ? 10000 : 20000); - ArcaneBolt_Timer = 1000; - Check_Timer = 1000; - } - - void EnterCombat(Unit *who) - { - // Send Shaffar to fight - Creature* Shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100); - if (!Shaffar || Shaffar->isDead()) - { - KillSelf(); - return; - } - if (!Shaffar->isInCombat()) - Shaffar->AI()->AttackStart(who); - } - - void JustSummoned(Creature *summoned) - { - summoned->AI()->AttackStart(m_creature->getVictim()); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (Check_Timer < diff) - { - Creature *Shaffar = me->FindNearestCreature(NPC_SHAFFAR, 100); - if (!Shaffar || Shaffar->isDead() || !Shaffar->isInCombat()) - { - KillSelf(); - return; - } - Check_Timer = 1000; - }else Check_Timer -= diff; - - if (ArcaneBolt_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_ARCANE_BOLT); - ArcaneBolt_Timer = 2000 + rand()%2500; - }else ArcaneBolt_Timer -= diff; - - if (Apprentice_Timer < diff) - { - if (m_creature->IsNonMeleeSpellCasted(false)) - m_creature->InterruptNonMeleeSpells(true); - - m_creature->CastSpell(m_creature,SPELL_ETHEREAL_APPRENTICE,true); - m_creature->ForcedDespawn(); - return; - }else Apprentice_Timer -= diff; - } -}; - -CreatureAI* GetAI_mob_ethereal_beacon(Creature* pCreature) -{ - return new mob_ethereal_beaconAI (pCreature); -} - -enum -{ - SPELL_ETHEREAL_APPRENTICE_FIREBOLT = 32369, - SPELL_ETHEREAL_APPRENTICE_FROSTBOLT = 32370 -}; - -struct TRINITY_DLL_DECL mob_ethereal_apprenticeAI : public ScriptedAI -{ - mob_ethereal_apprenticeAI(Creature *c) : ScriptedAI(c) {} - - uint32 Cast_Timer; - - bool isFireboltTurn; - - void Reset() - { - Cast_Timer = 3000; - isFireboltTurn = true; - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (Cast_Timer < diff) - { - if (isFireboltTurn) - { - m_creature->CastSpell(m_creature->getVictim(), SPELL_ETHEREAL_APPRENTICE_FIREBOLT, true); - isFireboltTurn = false; - }else{ - m_creature->CastSpell(m_creature->getVictim(), SPELL_ETHEREAL_APPRENTICE_FROSTBOLT, true); - isFireboltTurn = true; - } - Cast_Timer = 3000; - }else Cast_Timer -= diff; - } -}; - -CreatureAI* GetAI_mob_ethereal_apprentice(Creature* pCreature) -{ - return new mob_ethereal_apprenticeAI (pCreature); -} - -void AddSC_boss_nexusprince_shaffar() -{ - Script *newscript; - - newscript = new Script; - newscript->Name="boss_nexusprince_shaffar"; - newscript->GetAI = &GetAI_boss_nexusprince_shaffar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_ethereal_beacon"; - newscript->GetAI = &GetAI_mob_ethereal_beacon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_ethereal_apprentice"; - newscript->GetAI = &GetAI_mob_ethereal_apprentice; - newscript->RegisterSelf(); -} - diff --git a/src/bindings/scripts/scripts/outland/aunchindoun/mana_tombs/boss_pandemonius.cpp b/src/bindings/scripts/scripts/outland/aunchindoun/mana_tombs/boss_pandemonius.cpp deleted file mode 100644 index 77e1c535340..00000000000 --- a/src/bindings/scripts/scripts/outland/aunchindoun/mana_tombs/boss_pandemonius.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Boss_Pandemonius -SD%Complete: 75 -SDComment: Not known how void blast is done (amount of rapid cast seems to be related to players in party). All mobs remaining in surrounding area should aggro when engaged. -SDCategory: Auchindoun, Mana Tombs -EndScriptData */ - -#include "precompiled.h" - -#define SAY_AGGRO_1 -1557008 -#define SAY_AGGRO_2 -1557009 -#define SAY_AGGRO_3 -1557010 - -#define SAY_KILL_1 -1557011 -#define SAY_KILL_2 -1557012 - -#define SAY_DEATH -1557013 - -#define EMOTE_DARK_SHELL -1557014 - -#define SPELL_VOID_BLAST 32325 -#define H_SPELL_VOID_BLAST 38760 -#define SPELL_DARK_SHELL 32358 -#define H_SPELL_DARK_SHELL 38759 - -struct TRINITY_DLL_DECL boss_pandemoniusAI : public ScriptedAI -{ - boss_pandemoniusAI(Creature *c) : ScriptedAI(c) - { - HeroicMode = m_creature->GetMap()->IsHeroic(); - } - - bool HeroicMode; - uint32 VoidBlast_Timer; - uint32 DarkShell_Timer; - uint32 VoidBlast_Counter; - - void Reset() - { - VoidBlast_Timer = 8000+rand()%15000; - DarkShell_Timer = 20000; - VoidBlast_Counter = 0; - } - - void JustDied(Unit* Killer) - { - DoScriptText(SAY_DEATH, m_creature); - } - - void KilledUnit(Unit* victim) - { - switch(rand()%2) - { - case 0: DoScriptText(SAY_KILL_1, m_creature); break; - case 1: DoScriptText(SAY_KILL_2, m_creature); break; - } - } - - void EnterCombat(Unit *who) - { - switch(rand()%3) - { - case 0: DoScriptText(SAY_AGGRO_1, m_creature); break; - case 1: DoScriptText(SAY_AGGRO_2, m_creature); break; - case 2: DoScriptText(SAY_AGGRO_3, m_creature); break; - } - - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (VoidBlast_Timer < diff) - { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0)) - { - DoCast(target,HeroicMode ? H_SPELL_VOID_BLAST : SPELL_VOID_BLAST); - VoidBlast_Timer = 500; - ++VoidBlast_Counter; - } - - if (VoidBlast_Counter == 5) - { - VoidBlast_Timer = 15000+rand()%10000; - VoidBlast_Counter = 0; - } - }else VoidBlast_Timer -= diff; - - if (!VoidBlast_Counter) - { - if (DarkShell_Timer < diff) - { - if (m_creature->IsNonMeleeSpellCasted(false)) - m_creature->InterruptNonMeleeSpells(true); - - DoScriptText(EMOTE_DARK_SHELL, m_creature); - - DoCast(m_creature,HeroicMode ? H_SPELL_DARK_SHELL : SPELL_DARK_SHELL); - DarkShell_Timer = 20000; - }else DarkShell_Timer -= diff; - } - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_pandemonius(Creature* pCreature) -{ - return new boss_pandemoniusAI (pCreature); -} - -void AddSC_boss_pandemonius() -{ - Script *newscript; - newscript = new Script; - newscript->Name="boss_pandemonius"; - newscript->GetAI = &GetAI_boss_pandemonius; - newscript->RegisterSelf(); -} - diff --git a/src/bindings/scripts/scripts/outland/aunchindoun/sethekk_halls/boss_darkweaver_syth.cpp b/src/bindings/scripts/scripts/outland/aunchindoun/sethekk_halls/boss_darkweaver_syth.cpp deleted file mode 100644 index 00e43fa257d..00000000000 --- a/src/bindings/scripts/scripts/outland/aunchindoun/sethekk_halls/boss_darkweaver_syth.cpp +++ /dev/null @@ -1,438 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Boss_Darkweaver_Syth -SD%Complete: 85 -SDComment: Shock spells/times need more work. Heroic partly implemented. -SDCategory: Auchindoun, Sethekk Halls -EndScriptData */ - -#include "precompiled.h" - -#define SAY_SUMMON -1556000 - -#define SAY_AGGRO_1 -1556001 -#define SAY_AGGRO_2 -1556002 -#define SAY_AGGRO_3 -1556003 - -#define SAY_SLAY_1 -1556004 -#define SAY_SLAY_2 -1556005 - -#define SAY_DEATH -1556006 - -#define SPELL_FROST_SHOCK 21401 //37865 -#define SPELL_FLAME_SHOCK 34354 -#define SPELL_SHADOW_SHOCK 30138 -#define SPELL_ARCANE_SHOCK 37132 - -#define SPELL_CHAIN_LIGHTNING 15659 //15305 - -#define SPELL_SUMMON_SYTH_FIRE 33537 // Spawns 19203 -#define SPELL_SUMMON_SYTH_ARCANE 33538 // Spawns 19205 -#define SPELL_SUMMON_SYTH_FROST 33539 // Spawns 19204 -#define SPELL_SUMMON_SYTH_SHADOW 33540 // Spawns 19206 - -#define SPELL_FLAME_BUFFET (HeroicMode?38141:33526) -#define SPELL_ARCANE_BUFFET (HeroicMode?38138:33527) -#define SPELL_FROST_BUFFET (HeroicMode?38142:33528) -#define SPELL_SHADOW_BUFFET (HeroicMode?38143:33529) - -struct TRINITY_DLL_DECL boss_darkweaver_sythAI : public ScriptedAI -{ - boss_darkweaver_sythAI(Creature *c) : ScriptedAI(c) - - { - HeroicMode = m_creature->GetMap()->IsHeroic(); - } - - uint32 flameshock_timer; - uint32 arcaneshock_timer; - uint32 frostshock_timer; - uint32 shadowshock_timer; - uint32 chainlightning_timer; - - bool summon90; - bool summon50; - bool summon10; - bool HeroicMode; - - void Reset() - { - flameshock_timer = 2000; - arcaneshock_timer = 4000; - frostshock_timer = 6000; - shadowshock_timer = 8000; - chainlightning_timer = 15000; - - summon90 = false; - summon50 = false; - summon10 = false; - } - - void EnterCombat(Unit *who) - { - switch(rand()%3) - { - case 0: DoScriptText(SAY_AGGRO_1, m_creature); break; - case 1: DoScriptText(SAY_AGGRO_2, m_creature); break; - case 2: DoScriptText(SAY_AGGRO_3, m_creature); break; - } - } - - void JustDied(Unit* Killer) - { - DoScriptText(SAY_DEATH, m_creature); - } - - void KilledUnit(Unit* victim) - { - if (rand()%2) - return; - - switch(rand()%2) - { - case 0: DoScriptText(SAY_SLAY_1, m_creature); break; - case 1: DoScriptText(SAY_SLAY_2, m_creature); break; - } - } - - void JustSummoned(Creature *summoned) - { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - summoned->AI()->AttackStart(target); - } - - void SythSummoning() - { - DoScriptText(SAY_SUMMON, m_creature); - - if (m_creature->IsNonMeleeSpellCasted(false)) - m_creature->InterruptNonMeleeSpells(false); - - DoCast(m_creature,SPELL_SUMMON_SYTH_ARCANE,true); //front - DoCast(m_creature,SPELL_SUMMON_SYTH_FIRE,true); //back - DoCast(m_creature,SPELL_SUMMON_SYTH_FROST,true); //left - DoCast(m_creature,SPELL_SUMMON_SYTH_SHADOW,true); //right - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 90) && !summon90) - { - SythSummoning(); - summon90 = true; - } - - if (((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 50) && !summon50) - { - SythSummoning(); - summon50 = true; - } - - if (((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 10) && !summon10) - { - SythSummoning(); - summon10 = true; - } - - if (flameshock_timer < diff) - { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_FLAME_SHOCK); - - flameshock_timer = 10000 + rand()%5000; - } else flameshock_timer -= diff; - - if (arcaneshock_timer < diff) - { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_ARCANE_SHOCK); - - arcaneshock_timer = 10000 + rand()%5000; - } else arcaneshock_timer -= diff; - - if (frostshock_timer < diff) - { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_FROST_SHOCK); - - frostshock_timer = 10000 + rand()%5000; - } else frostshock_timer -= diff; - - if (shadowshock_timer < diff) - { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_SHADOW_SHOCK); - - shadowshock_timer = 10000 + rand()%5000; - } else shadowshock_timer -= diff; - - if (chainlightning_timer < diff) - { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_CHAIN_LIGHTNING); - - chainlightning_timer = 25000; - } else chainlightning_timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_darkweaver_syth(Creature* pCreature) -{ - return new boss_darkweaver_sythAI (pCreature); -} - -/* ELEMENTALS */ - -struct TRINITY_DLL_DECL mob_syth_fireAI : public ScriptedAI -{ - mob_syth_fireAI(Creature *c) : ScriptedAI(c) - - { - HeroicMode = m_creature->GetMap()->IsHeroic(); - } - - uint32 flameshock_timer; - uint32 flamebuffet_timer; - bool HeroicMode; - - void Reset() - { - m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); - flameshock_timer = 2500; - flamebuffet_timer = 5000; - } - - void EnterCombat(Unit *who) { } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (flameshock_timer < diff) - { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_FLAME_SHOCK); - - flameshock_timer = 5000; - }else flameshock_timer -= diff; - - if (flamebuffet_timer < diff) - { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_FLAME_BUFFET); - - flamebuffet_timer = 5000; - }else flamebuffet_timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_mob_syth_fire(Creature* pCreature) -{ - return new mob_syth_fireAI (pCreature); -} - -struct TRINITY_DLL_DECL mob_syth_arcaneAI : public ScriptedAI -{ - mob_syth_arcaneAI(Creature *c) : ScriptedAI(c) - - { - HeroicMode = m_creature->GetMap()->IsHeroic(); - } - - uint32 arcaneshock_timer; - uint32 arcanebuffet_timer; - bool HeroicMode; - - void Reset() - { - m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_ARCANE, true); - arcaneshock_timer = 2500; - arcanebuffet_timer = 5000; - } - - void EnterCombat(Unit *who) { } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (arcaneshock_timer < diff) - { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_ARCANE_SHOCK); - - arcaneshock_timer = 5000; - }else arcaneshock_timer -= diff; - - if (arcanebuffet_timer < diff) - { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_ARCANE_BUFFET); - - arcanebuffet_timer = 5000; - }else arcanebuffet_timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_mob_syth_arcane(Creature* pCreature) -{ - return new mob_syth_arcaneAI (pCreature); -} - -struct TRINITY_DLL_DECL mob_syth_frostAI : public ScriptedAI -{ - mob_syth_frostAI(Creature *c) : ScriptedAI(c) - - { - HeroicMode = m_creature->GetMap()->IsHeroic(); - } - - uint32 frostshock_timer; - uint32 frostbuffet_timer; - bool HeroicMode; - - void Reset() - { - m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FROST, true); - frostshock_timer = 2500; - frostbuffet_timer = 5000; - } - - void EnterCombat(Unit *who) { } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (frostshock_timer < diff) - { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_FROST_SHOCK); - - frostshock_timer = 5000; - }else frostshock_timer -= diff; - - if (frostbuffet_timer < diff) - { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_FROST_BUFFET); - - frostbuffet_timer = 5000; - }else frostbuffet_timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_mob_syth_frost(Creature* pCreature) -{ - return new mob_syth_frostAI (pCreature); -} - -struct TRINITY_DLL_DECL mob_syth_shadowAI : public ScriptedAI -{ - mob_syth_shadowAI(Creature *c) : ScriptedAI(c) - - { - HeroicMode = m_creature->GetMap()->IsHeroic(); - } - - uint32 shadowshock_timer; - uint32 shadowbuffet_timer; - bool HeroicMode; - - void Reset() - { - m_creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_SHADOW, true); - shadowshock_timer = 2500; - shadowbuffet_timer = 5000; - } - - void EnterCombat(Unit *who) { } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (shadowshock_timer < diff) - { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_SHADOW_SHOCK); - - shadowshock_timer = 5000; - }else shadowshock_timer -= diff; - - if (shadowbuffet_timer < diff) - { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target,SPELL_SHADOW_BUFFET); - - shadowbuffet_timer = 5000; - }else shadowbuffet_timer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_mob_syth_shadow(Creature* pCreature) -{ - return new mob_syth_shadowAI (pCreature); -} - -void AddSC_boss_darkweaver_syth() -{ - Script *newscript; - newscript = new Script; - newscript->Name="boss_darkweaver_syth"; - newscript->GetAI = &GetAI_boss_darkweaver_syth; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_syth_fire"; - newscript->GetAI = &GetAI_mob_syth_arcane; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_syth_arcane"; - newscript->GetAI = &GetAI_mob_syth_arcane; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_syth_frost"; - newscript->GetAI = &GetAI_mob_syth_frost; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_syth_shadow"; - newscript->GetAI = &GetAI_mob_syth_shadow; - newscript->RegisterSelf(); -} - diff --git a/src/bindings/scripts/scripts/outland/aunchindoun/sethekk_halls/boss_tailonking_ikiss.cpp b/src/bindings/scripts/scripts/outland/aunchindoun/sethekk_halls/boss_tailonking_ikiss.cpp deleted file mode 100644 index 7830fc10645..00000000000 --- a/src/bindings/scripts/scripts/outland/aunchindoun/sethekk_halls/boss_tailonking_ikiss.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Boss_Talon_King_Ikiss -SD%Complete: 80 -SDComment: Heroic supported. Some details missing, but most are spell related. -SDCategory: Auchindoun, Sethekk Halls -EndScriptData */ - -#include "precompiled.h" -#include "def_sethekk_halls.h" - -#define SAY_INTRO -1556007 - -#define SAY_AGGRO_1 -1556008 -#define SAY_AGGRO_2 -1556009 -#define SAY_AGGRO_3 -1556010 - -#define SAY_SLAY_1 -1556011 -#define SAY_SLAY_2 -1556012 -#define SAY_DEATH -1556013 -#define EMOTE_ARCANE_EXP -1556015 - -#define SPELL_BLINK 38194 -#define SPELL_BLINK_TELEPORT 38203 -#define SPELL_MANA_SHIELD 38151 -#define SPELL_ARCANE_BUBBLE 9438 -#define H_SPELL_SLOW 35032 - -#define SPELL_POLYMORPH 38245 -#define H_SPELL_POLYMORPH 43309 - -#define SPELL_ARCANE_VOLLEY 35059 -#define H_SPELL_ARCANE_VOLLEY 40424 - -#define SPELL_ARCANE_EXPLOSION 38197 -#define H_SPELL_ARCANE_EXPLOSION 40425 - -struct TRINITY_DLL_DECL boss_talon_king_ikissAI : public ScriptedAI -{ - boss_talon_king_ikissAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; - - bool HeroicMode; - - uint32 ArcaneVolley_Timer; - uint32 Sheep_Timer; - uint32 Blink_Timer; - uint32 Slow_Timer; - - bool ManaShield; - bool Blink; - bool Intro; - - void Reset() - { - HeroicMode = m_creature->GetMap()->IsHeroic(); - - ArcaneVolley_Timer = 5000; - Sheep_Timer = 8000; - Blink_Timer = 35000; - Slow_Timer = 15000+rand()%15000; - Blink = false; - Intro = false; - ManaShield = false; - } - - void MoveInLineOfSight(Unit *who) - { - if (!m_creature->getVictim() && who->isTargetableForAttack() && (m_creature->IsHostileTo(who)) && who->isInAccessiblePlaceFor(m_creature)) - { - if (!Intro && m_creature->IsWithinDistInMap(who, 100)) - { - Intro = true; - DoScriptText(SAY_INTRO, m_creature); - } - - if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) - return; - - float attackRadius = m_creature->GetAttackDistance(who); - if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) - { - //who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); - AttackStart(who); - } - } - } - - void EnterCombat(Unit *who) - { - switch(rand()%3) - { - case 0: DoScriptText(SAY_AGGRO_1, m_creature); break; - case 1: DoScriptText(SAY_AGGRO_2, m_creature); break; - case 2: DoScriptText(SAY_AGGRO_3, m_creature); break; - } - } - - void JustDied(Unit* Killer) - { - DoScriptText(SAY_DEATH, m_creature); - - if (pInstance) - pInstance->SetData(DATA_IKISSDOOREVENT, DONE); - } - - void KilledUnit(Unit* victim) - { - switch(rand()%2) - { - case 0: DoScriptText(SAY_SLAY_1, m_creature); break; - case 1: DoScriptText(SAY_SLAY_2, m_creature); break; - } - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (Blink) - { - DoCast(m_creature,HeroicMode ? H_SPELL_ARCANE_EXPLOSION : SPELL_ARCANE_EXPLOSION); - m_creature->CastSpell(m_creature,SPELL_ARCANE_BUBBLE,true); - Blink = false; - } - - if (ArcaneVolley_Timer < diff) - { - DoCast(m_creature,HeroicMode ? H_SPELL_ARCANE_VOLLEY : SPELL_ARCANE_VOLLEY); - ArcaneVolley_Timer = 7000+rand()%5000; - }else ArcaneVolley_Timer -= diff; - - if (Sheep_Timer < diff) - { - //second top aggro target in normal, random target in heroic correct? - Unit *target = NULL; - target = HeroicMode ? SelectUnit(SELECT_TARGET_RANDOM,0) : SelectUnit(SELECT_TARGET_TOPAGGRO,1); - if (target) - DoCast(target,HeroicMode ? H_SPELL_POLYMORPH : SPELL_POLYMORPH); - Sheep_Timer = 15000+rand()%2500; - }else Sheep_Timer -= diff; - - //may not be correct time to cast - if (!ManaShield && ((m_creature->GetHealth()*100) / m_creature->GetMaxHealth() < 20)) - { - DoCast(m_creature,SPELL_MANA_SHIELD); - ManaShield = true; - } - - if (HeroicMode) - { - if (Slow_Timer < diff) - { - DoCast(m_creature,H_SPELL_SLOW); - Slow_Timer = 15000+rand()%25000; - }else Slow_Timer -= diff; - } - - if (Blink_Timer < diff) - { - DoScriptText(EMOTE_ARCANE_EXP, m_creature); - - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM,0)) - { - if (m_creature->IsNonMeleeSpellCasted(false)) - m_creature->InterruptNonMeleeSpells(false); - - //Spell doesn't work, but we use for visual effect at least - DoCast(target,SPELL_BLINK); - - float X = target->GetPositionX(); - float Y = target->GetPositionY(); - float Z = target->GetPositionZ(); - - DoTeleportTo(X,Y,Z); - - DoCast(target,SPELL_BLINK_TELEPORT); - Blink = true; - } - Blink_Timer = 35000+rand()%5000; - }else Blink_Timer -= diff; - - if (!Blink) - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_talon_king_ikiss(Creature* pCreature) -{ - return new boss_talon_king_ikissAI (pCreature); -} - -void AddSC_boss_talon_king_ikiss() -{ - Script *newscript; - newscript = new Script; - newscript->Name="boss_talon_king_ikiss"; - newscript->GetAI = &GetAI_boss_talon_king_ikiss; - newscript->RegisterSelf(); -} - diff --git a/src/bindings/scripts/scripts/outland/aunchindoun/sethekk_halls/def_sethekk_halls.h b/src/bindings/scripts/scripts/outland/aunchindoun/sethekk_halls/def_sethekk_halls.h deleted file mode 100644 index 6156f354d84..00000000000 --- a/src/bindings/scripts/scripts/outland/aunchindoun/sethekk_halls/def_sethekk_halls.h +++ /dev/null @@ -1,14 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software licensed under GPL version 2 - * Please see the included DOCS/LICENSE.TXT for more information */ - -#ifndef DEF_SETHEKK_HALLS_H -#define DEF_SETHEKK_HALLS_H - -enum -{ - DATA_IKISSDOOREVENT = 1, - TYPE_ANZU_ENCOUNTER = 2, -}; -#endif - diff --git a/src/bindings/scripts/scripts/outland/aunchindoun/sethekk_halls/instance_sethekk_halls.cpp b/src/bindings/scripts/scripts/outland/aunchindoun/sethekk_halls/instance_sethekk_halls.cpp deleted file mode 100644 index 060e09a1325..00000000000 --- a/src/bindings/scripts/scripts/outland/aunchindoun/sethekk_halls/instance_sethekk_halls.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Instance - Sethekk Halls -SD%Complete: 50 -SDComment: Instance Data for Sethekk Halls instance -SDCategory: Auchindoun, Sethekk Halls -EndScriptData */ - -#include "precompiled.h" -#include "def_sethekk_halls.h" - -enum -{ - NPC_ANZU = 23035, - IKISS_DOOR = 177203, -}; - -struct TRINITY_DLL_DECL instance_sethekk_halls : public ScriptedInstance -{ - instance_sethekk_halls(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - - uint32 AnzuEncounter; - uint64 m_uiIkissDoorGUID; - - void Initialize() - { - AnzuEncounter = NOT_STARTED; - m_uiIkissDoorGUID = 0; - } - - void OnCreatureCreate(Creature* pCreature, bool add) - { - if (pCreature->GetEntry() == NPC_ANZU && AnzuEncounter >= IN_PROGRESS) - { - pCreature->DealDamage(pCreature, pCreature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - pCreature->RemoveCorpse(); - } else { - AnzuEncounter = IN_PROGRESS; - } - } - - void OnGameObjectCreate(GameObject* pGo, bool add) - { - if (pGo->GetEntry() == IKISS_DOOR) - m_uiIkissDoorGUID = pGo->GetGUID(); - } - - void SetData(uint32 type, uint32 data) - { - switch(type) - { - case DATA_IKISSDOOREVENT: - if (data == DONE) - DoUseDoorOrButton(m_uiIkissDoorGUID,DAY*IN_MILISECONDS); - break; - case TYPE_ANZU_ENCOUNTER: - AnzuEncounter = data; - break; - } - } -}; - -InstanceData* GetInstanceData_instance_sethekk_halls(Map* pMap) -{ - return new instance_sethekk_halls(pMap); -} - -void AddSC_instance_sethekk_halls() -{ - Script *newscript; - newscript = new Script; - newscript->Name = "instance_sethekk_halls"; - newscript->GetInstanceData = &GetInstanceData_instance_sethekk_halls; - newscript->RegisterSelf(); -} - diff --git a/src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp b/src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp deleted file mode 100644 index 66e6b3a108d..00000000000 --- a/src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/boss_ambassador_hellmaw.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Boss_Ambassador_Hellmaw -SD%Complete: 80 -SDComment: Enrage spell missing/not known -SDCategory: Auchindoun, Shadow Labyrinth -EndScriptData */ - -#include "precompiled.h" -#include "escort_ai.h" -#include "def_shadow_labyrinth.h" - -enum -{ - SAY_INTRO = -1555000, - SAY_AGGRO1 = -1555001, - SAY_AGGRO2 = -1555002, - SAY_AGGRO3 = -1555003, - SAY_HELP = -1555004, - SAY_SLAY1 = -1555005, - SAY_SLAY2 = -1555006, - SAY_DEATH = -1555007, - - SPELL_BANISH = 30231, - SPELL_CORROSIVE_ACID = 33551, - SPELL_FEAR = 33547, - SPELL_ENRAGE = 34970 -}; - -struct TRINITY_DLL_DECL boss_ambassador_hellmawAI : public npc_escortAI -{ - boss_ambassador_hellmawAI(Creature* pCreature) : npc_escortAI(pCreature) - { - m_pInstance = pCreature->GetInstanceData(); - HeroicMode = pCreature->GetMap()->IsHeroic(); - } - - ScriptedInstance* m_pInstance; - bool HeroicMode; - - uint32 EventCheck_Timer; - uint32 CorrosiveAcid_Timer; - uint32 Fear_Timer; - uint32 Enrage_Timer; - bool Intro; - bool IsBanished; - bool Enraged; - - void Reset() - { - EventCheck_Timer = 5000; - CorrosiveAcid_Timer = 5000 + rand()%5000; - Fear_Timer = 25000 + rand()%5000; - Enrage_Timer = 180000; - Intro = false; - IsBanished = true; - Enraged = false; - - if (m_pInstance && m_creature->isAlive()) - { - if (m_pInstance->GetData(TYPE_OVERSEER) != DONE) - m_creature->CastSpell(m_creature, SPELL_BANISH, true); - } - } - - void JustReachedHome() - { - if (m_pInstance) - m_pInstance->SetData(TYPE_HELLMAW, FAIL); - } - - void MoveInLineOfSight(Unit* pWho) - { - if (m_creature->HasAura(SPELL_BANISH)) - return; - - npc_escortAI::MoveInLineOfSight(pWho); - } - - void WaypointReached(uint32 i) - { - } - - void DoIntro() - { - if (m_creature->HasAura(SPELL_BANISH)) - m_creature->RemoveAurasDueToSpell(SPELL_BANISH); - - IsBanished = false; - Intro = true; - - if (m_pInstance) - { - if (m_pInstance->GetData(TYPE_HELLMAW) != FAIL) - { - DoScriptText(SAY_INTRO, m_creature); - Start(true, false, 0, NULL, false, true); - } - - m_pInstance->SetData(TYPE_HELLMAW, IN_PROGRESS); - } - } - - void EnterCombat(Unit *who) - { - switch(rand()%3) - { - case 0: DoScriptText(SAY_AGGRO1, m_creature); break; - case 1: DoScriptText(SAY_AGGRO2, m_creature); break; - case 2: DoScriptText(SAY_AGGRO3, m_creature); break; - } - } - - void KilledUnit(Unit *victim) - { - switch(rand()%2) - { - case 0: DoScriptText(SAY_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_SLAY2, m_creature); break; - } - } - - void JustDied(Unit *victim) - { - DoScriptText(SAY_DEATH, m_creature); - - if (m_pInstance) - m_pInstance->SetData(TYPE_HELLMAW, DONE); - } - - void UpdateAI(const uint32 diff) - { - if (!Intro && !IsBeingEscorted) - { - if (EventCheck_Timer < diff) - { - if (m_pInstance) - { - if (m_pInstance->GetData(TYPE_OVERSEER) == DONE) - { - DoIntro(); - return; - } - } - EventCheck_Timer = 5000; - return; - } - else - { - EventCheck_Timer -= diff; - return; - } - } - - npc_escortAI::UpdateAI(diff); - - if (!UpdateVictim()) - return; - - if (m_creature->HasAura(SPELL_BANISH, 0)) - { - EnterEvadeMode(); - return; - } - - if (CorrosiveAcid_Timer < diff) - { - DoCast(m_creature->getVictim(),SPELL_CORROSIVE_ACID); - CorrosiveAcid_Timer = 15000 + rand()%10000; - }else CorrosiveAcid_Timer -= diff; - - if (Fear_Timer < diff) - { - DoCast(m_creature,SPELL_FEAR); - Fear_Timer = 20000 + rand()%15000; - }else Fear_Timer -= diff; - - if (HeroicMode) - { - if (!Enraged && Enrage_Timer < diff) - { - DoCast(m_creature,SPELL_ENRAGE); - Enraged = true; - }else Enrage_Timer -= diff; - } - } -}; - -CreatureAI* GetAI_boss_ambassador_hellmaw(Creature* pCreature) -{ - return new boss_ambassador_hellmawAI(pCreature); -} - -void AddSC_boss_ambassador_hellmaw() -{ - Script *newscript; - newscript = new Script; - newscript->Name="boss_ambassador_hellmaw"; - newscript->GetAI = &GetAI_boss_ambassador_hellmaw; - newscript->RegisterSelf(); -} - diff --git a/src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp b/src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp deleted file mode 100644 index 73374c08f8c..00000000000 --- a/src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/boss_blackheart_the_inciter.cpp +++ /dev/null @@ -1,177 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Boss_Blackheart_the_Inciter -SD%Complete: 75 -SDComment: Incite Chaos not functional since core lacks Mind Control support -SDCategory: Auchindoun, Shadow Labyrinth -EndScriptData */ - -#include "precompiled.h" -#include "def_shadow_labyrinth.h" - -#define SPELL_INCITE_CHAOS 33676 -#define SPELL_INCITE_CHAOS_B 33684 //debuff applied to each member of party -#define SPELL_CHARGE 33709 -#define SPELL_WAR_STOMP 33707 - -#define SAY_INTRO1 -1555008 -#define SAY_INTRO2 -1555009 -#define SAY_INTRO3 -1555010 -#define SAY_AGGRO1 -1555011 -#define SAY_AGGRO2 -1555012 -#define SAY_AGGRO3 -1555013 -#define SAY_SLAY1 -1555014 -#define SAY_SLAY2 -1555015 -#define SAY_HELP -1555016 -#define SAY_DEATH -1555017 - -#define SAY2_INTRO1 -1555018 -#define SAY2_INTRO2 -1555019 -#define SAY2_INTRO3 -1555020 -#define SAY2_AGGRO1 -1555021 -#define SAY2_AGGRO2 -1555022 -#define SAY2_AGGRO3 -1555023 -#define SAY2_SLAY1 -1555024 -#define SAY2_SLAY2 -1555025 -#define SAY2_HELP -1555026 -#define SAY2_DEATH -1555027 - -struct TRINITY_DLL_DECL boss_blackheart_the_inciterAI : public ScriptedAI -{ - boss_blackheart_the_inciterAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance *pInstance; - - bool InciteChaos; - uint32 InciteChaos_Timer; - uint32 InciteChaosWait_Timer; - uint32 Charge_Timer; - uint32 Knockback_Timer; - - void Reset() - { - InciteChaos = false; - InciteChaos_Timer = 20000; - InciteChaosWait_Timer = 15000; - Charge_Timer = 5000; - Knockback_Timer = 15000; - - if (pInstance) - pInstance->SetData(DATA_BLACKHEARTTHEINCITEREVENT, NOT_STARTED); - } - - void KilledUnit(Unit *victim) - { - switch(rand()%2) - { - case 0: DoScriptText(SAY_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_SLAY2, m_creature); break; - } - } - - void JustDied(Unit *victim) - { - DoScriptText(SAY_DEATH, m_creature); - - if (pInstance) - pInstance->SetData(DATA_BLACKHEARTTHEINCITEREVENT, DONE); - } - - void EnterCombat(Unit *who) - { - switch(rand()%3) - { - case 0: DoScriptText(SAY_AGGRO1, m_creature); break; - case 1: DoScriptText(SAY_AGGRO2, m_creature); break; - case 2: DoScriptText(SAY_AGGRO3, m_creature); break; - } - - if (pInstance) - pInstance->SetData(DATA_BLACKHEARTTHEINCITEREVENT, IN_PROGRESS); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - - if (InciteChaos) - { - if (InciteChaosWait_Timer < diff) - { - InciteChaos = false; - InciteChaosWait_Timer = 15000; - }else InciteChaosWait_Timer -= diff; - - return; - } - - if (InciteChaos_Timer < diff) - { - DoCast(m_creature, SPELL_INCITE_CHAOS); - - std::list t_list = m_creature->getThreatManager().getThreatList(); - for(std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - { - Unit* target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); - if (target && target->GetTypeId() == TYPEID_PLAYER) - target->CastSpell(target,SPELL_INCITE_CHAOS_B,true); - } - - DoResetThreat(); - InciteChaos = true; - InciteChaos_Timer = 40000; - return; - }else InciteChaos_Timer -= diff; - - //Charge_Timer - if (Charge_Timer < diff) - { - if (Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(target, SPELL_CHARGE); - Charge_Timer = 15000 + rand()%10000; - }else Charge_Timer -= diff; - - //Knockback_Timer - if (Knockback_Timer < diff) - { - DoCast(m_creature, SPELL_WAR_STOMP); - Knockback_Timer = 18000 + rand()%6000; - }else Knockback_Timer -= diff; - - DoMeleeAttackIfReady(); - } -}; -CreatureAI* GetAI_boss_blackheart_the_inciter(Creature* pCreature) -{ - return new boss_blackheart_the_inciterAI (pCreature); -} - -void AddSC_boss_blackheart_the_inciter() -{ - Script *newscript; - newscript = new Script; - newscript->Name="boss_blackheart_the_inciter"; - newscript->GetAI = &GetAI_boss_blackheart_the_inciter; - newscript->RegisterSelf(); -} - diff --git a/src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp b/src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp deleted file mode 100644 index 0cc6255f3cf..00000000000 --- a/src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp +++ /dev/null @@ -1,321 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Boss_Grandmaster_Vorpil -SD%Complete: 100 -SDComment: -SDCategory: Auchindoun, Shadow Labyrinth -EndScriptData */ - -#include "precompiled.h" -#include "def_shadow_labyrinth.h" - -#define SAY_INTRO -1555028 -#define SAY_AGGRO1 -1555029 -#define SAY_AGGRO2 -1555030 -#define SAY_AGGRO3 -1555031 -#define SAY_HELP -1555032 -#define SAY_SLAY1 -1555033 -#define SAY_SLAY2 -1555034 -#define SAY_DEATH -1555035 - -#define SPELL_RAIN_OF_FIRE 33617 -#define H_SPELL_RAIN_OF_FIRE 39363 - -#define SPELL_DRAW_SHADOWS 33563 -#define SPELL_SHADOWBOLT_VOLLEY 33841 -#define SPELL_BANISH 38791 - -#define MOB_VOID_TRAVELER 19226 -#define SPELL_SACRIFICE 33587 -#define SPELL_SHADOW_NOVA 33846 -#define SPELL_EMPOWERING_SHADOWS 33783 -#define H_SPELL_EMPOWERING_SHADOWS 39364 - -#define MOB_VOID_PORTAL 19224 -#define SPELL_VOID_PORTAL_VISUAL 33569 - -float VorpilPosition[3] = {-252.8820,-264.3030,17.1}; - -float VoidPortalCoords[5][3] = -{ - {-283.5894, -239.5718, 12.7}, - {-306.5853, -258.4539, 12.7}, - {-295.8789, -269.0899, 12.7}, - {-209.3401, -262.7564, 17.1}, - {-261.4533, -297.3298, 17.1} -}; - -struct TRINITY_DLL_DECL mob_voidtravelerAI : public ScriptedAI -{ - mob_voidtravelerAI(Creature *c) : ScriptedAI(c) - { - HeroicMode = m_creature->GetMap()->IsHeroic(); - } - - bool HeroicMode; - Unit *Vorpil; - uint32 move; - bool sacrificed; - - void Reset() - { - Vorpil = NULL; - move = 0; - sacrificed = false; - } - - void EnterCombat(Unit *who){} - - void UpdateAI(const uint32 diff) - { - if (!Vorpil) - { - m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - return; - } - if (move < diff) - { - if (sacrificed) - { - SpellEntry *spell = GET_SPELL(HeroicMode?H_SPELL_EMPOWERING_SHADOWS:SPELL_EMPOWERING_SHADOWS); - if (spell) - Vorpil->AddAura(new Aura(spell, 1, NULL, Vorpil, m_creature)); - Vorpil->SetHealth(Vorpil->GetHealth()+Vorpil->GetMaxHealth()/25); - DoCast(m_creature, SPELL_SHADOW_NOVA, true); - m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - return; - } - m_creature->GetMotionMaster()->MoveFollow(Vorpil,0,0); - if (m_creature->IsWithinDist(Vorpil, 3)) - { - DoCast(m_creature, SPELL_SACRIFICE, false); - sacrificed = true; - move = 500; - return; - } - if (!Vorpil->isInCombat() || Vorpil->isDead()) - { - m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - return; - } - move = 1000; - }else move -= diff; - } -}; -CreatureAI* GetAI_mob_voidtraveler(Creature* pCreature) -{ - return new mob_voidtravelerAI (pCreature); -} - -struct TRINITY_DLL_DECL boss_grandmaster_vorpilAI : public ScriptedAI -{ - boss_grandmaster_vorpilAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - HeroicMode = m_creature->GetMap()->IsHeroic(); - Intro = false; - } - - ScriptedInstance *pInstance; - bool Intro, HelpYell; - bool sumportals; - bool HeroicMode; - - uint32 ShadowBoltVolley_Timer; - uint32 DrawShadows_Timer; - uint32 summonTraveler_Timer; - uint32 banish_Timer; - uint64 PortalsGuid[5]; - - void Reset() - { - ShadowBoltVolley_Timer = 7000 + rand()%7000; - DrawShadows_Timer = 45000; - summonTraveler_Timer = 90000; - banish_Timer = 17000; - HelpYell = false; - destroyPortals(); - - if (pInstance) - pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, NOT_STARTED); - } - - void summonPortals() - { - if (!sumportals) - { - for (int i = 0;i<5; ++i) - { - Creature *Portal = NULL; - Portal = m_creature->SummonCreature(MOB_VOID_PORTAL,VoidPortalCoords[i][0],VoidPortalCoords[i][1],VoidPortalCoords[i][2],0,TEMPSUMMON_CORPSE_DESPAWN,3000000); - if (Portal) - { - PortalsGuid[i] = Portal->GetGUID(); - Portal->CastSpell(Portal,SPELL_VOID_PORTAL_VISUAL,false); - } - } - sumportals = true; - summonTraveler_Timer = 5000; - } - } - - void destroyPortals() - { - if (sumportals) - { - for (int i = 0;i < 5; i ++) - { - Unit *Portal = Unit::GetUnit((*m_creature), PortalsGuid[i]); - if (Portal && Portal->isAlive()) - Portal->DealDamage(Portal, Portal->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - PortalsGuid[i] = 0; - } - sumportals = false; - } - } - - void spawnVoidTraveler() - { - int pos = rand()%5; - m_creature->SummonCreature(MOB_VOID_TRAVELER,VoidPortalCoords[pos][0],VoidPortalCoords[pos][1],VoidPortalCoords[pos][2],0,TEMPSUMMON_CORPSE_TIMED_DESPAWN,5000); - if (!HelpYell) - { - DoScriptText(SAY_HELP, m_creature); - HelpYell = true; - } - } - - void JustSummoned(Creature *summoned) - { - if (summoned && summoned->GetEntry() == MOB_VOID_TRAVELER) - CAST_AI(mob_voidtravelerAI, summoned->AI())->Vorpil = m_creature; - } - - void KilledUnit(Unit *victim) - { - switch(rand()%2) - { - case 0: DoScriptText(SAY_SLAY1, m_creature); break; - case 1: DoScriptText(SAY_SLAY2, m_creature); break; - } - } - - void JustDied(Unit *victim) - { - DoScriptText(SAY_DEATH, m_creature); - destroyPortals(); - - if (pInstance) - pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, DONE); - } - - void EnterCombat(Unit *who) - { - switch(rand()%3) - { - case 0: DoScriptText(SAY_AGGRO1, m_creature); break; - case 1: DoScriptText(SAY_AGGRO2, m_creature); break; - case 2: DoScriptText(SAY_AGGRO3, m_creature); break; - } - summonPortals(); - - if (pInstance) - pInstance->SetData(DATA_GRANDMASTERVORPILEVENT, IN_PROGRESS); - } - - void MoveInLineOfSight(Unit *who) - { - ScriptedAI::MoveInLineOfSight(who); - - if (!Intro && m_creature->IsWithinLOSInMap(who)&& m_creature->IsWithinDistInMap(who, 100) && m_creature->IsHostileTo(who)) - { - DoScriptText(SAY_INTRO, m_creature); - Intro = true; - } - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - if (ShadowBoltVolley_Timer < diff) - { - DoCast(m_creature,SPELL_SHADOWBOLT_VOLLEY); - ShadowBoltVolley_Timer = 15000 + rand()%15000;; - }else ShadowBoltVolley_Timer -= diff; - - if (HeroicMode && banish_Timer < diff) - { - Unit *target = SelectTarget(SELECT_TARGET_RANDOM,0,30,false); - if (target) - { - DoCast(target,SPELL_BANISH); - banish_Timer = 16000; - } - }else banish_Timer -= diff; - - if (DrawShadows_Timer < diff) - { - Map* pMap = m_creature->GetMap(); - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - for(Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (Player* i_pl = i->getSource()) - if (i_pl->isAlive() && !i_pl->HasAura(SPELL_BANISH)) - i_pl->TeleportTo(m_creature->GetMapId(), VorpilPosition[0],VorpilPosition[1],VorpilPosition[2], 0, TELE_TO_NOT_LEAVE_COMBAT); - - m_creature->GetMap()->CreatureRelocation(m_creature, VorpilPosition[0],VorpilPosition[1],VorpilPosition[2],0.0f); - DoCast(m_creature,SPELL_DRAW_SHADOWS,true); - - DoCast(m_creature,HeroicMode?H_SPELL_RAIN_OF_FIRE:SPELL_RAIN_OF_FIRE); - - ShadowBoltVolley_Timer = 6000; - DrawShadows_Timer = 30000; - }else DrawShadows_Timer -= diff; - - if (summonTraveler_Timer < diff) - { - spawnVoidTraveler(); - summonTraveler_Timer = 10000; - //enrage at 20% - if ((m_creature->GetHealth()*5) < m_creature->GetMaxHealth()) - summonTraveler_Timer = 5000; - }else summonTraveler_Timer -=diff; - - DoMeleeAttackIfReady(); - } -}; -CreatureAI* GetAI_boss_grandmaster_vorpil(Creature* pCreature) -{ - return new boss_grandmaster_vorpilAI (pCreature); -} - -void AddSC_boss_grandmaster_vorpil() -{ - Script *newscript; - newscript = new Script; - newscript->Name="boss_grandmaster_vorpil"; - newscript->GetAI = &GetAI_boss_grandmaster_vorpil; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="mob_voidtraveler"; - newscript->GetAI = &GetAI_mob_voidtraveler; - newscript->RegisterSelf(); -} - diff --git a/src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/boss_murmur.cpp b/src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/boss_murmur.cpp deleted file mode 100644 index 259f6091af6..00000000000 --- a/src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/boss_murmur.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Boss_Murmur -SD%Complete: 90 -SDComment: Timers may be incorrect -SDCategory: Auchindoun, Shadow Labyrinth -EndScriptData */ - -#include "precompiled.h" -#include "def_shadow_labyrinth.h" - -#define EMOTE_SONIC_BOOM -1555036 - -#define SPELL_SONIC_BOOM_CAST (HeroicMode?38796:33923) -#define SPELL_SONIC_BOOM_EFFECT (HeroicMode?38795:33666) -#define SPELL_RESONANCE 33657 -#define SPELL_MURMURS_TOUCH (HeroicMode?38794:33711) -#define SPELL_MAGNETIC_PULL 33689 -#define SPELL_SONIC_SHOCK 38797 -#define SPELL_THUNDERING_STORM 39365 - -struct TRINITY_DLL_DECL boss_murmurAI : public ScriptedAI -{ - boss_murmurAI(Creature *c) : ScriptedAI(c) - { - SetCombatMovement(false); - HeroicMode = m_creature->GetMap()->IsHeroic(); - } - - uint32 SonicBoom_Timer; - uint32 MurmursTouch_Timer; - uint32 Resonance_Timer; - uint32 MagneticPull_Timer; - uint32 SonicShock_Timer; - uint32 ThunderingStorm_Timer; - bool HeroicMode; - bool SonicBoom; - - void Reset() - { - SonicBoom_Timer = 30000; - MurmursTouch_Timer = 8000 + rand()%12000; - Resonance_Timer = 5000; - MagneticPull_Timer = 15000 + rand()%15000; - ThunderingStorm_Timer = 15000; - SonicShock_Timer = 10000; - SonicBoom = false; - - //database should have `RegenHealth`=0 to prevent regen - uint32 hp = (m_creature->GetMaxHealth()*40)/100; - if (hp) m_creature->SetHealth(hp); - m_creature->ResetPlayerDamageReq(); - } - - void SonicBoomEffect() - { - std::list t_list = m_creature->getThreatManager().getThreatList(); - for(std::list::iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) - { - Unit* target = Unit::GetUnit(*m_creature, (*itr)->getUnitGuid()); - if (target && target->GetTypeId() == TYPEID_PLAYER) - { - //Not do anything without aura, spell can be resisted! - if (target->HasAura(SPELL_SONIC_BOOM_CAST) && m_creature->IsWithinDistInMap(target, 34.0f)) - { - //This will be wrong calculation. Also, comments suggest it must deal damage - target->SetHealth(uint32(target->GetMaxHealth() - target->GetMaxHealth() * 0.8)); - } - } - } - } - - void EnterCombat(Unit *who) { } - - // Sonic Boom instant damage (needs core fix instead of this) - void SpellHitTarget(Unit *target, const SpellEntry *spell) - { - if (target && target->isAlive() && spell && spell->Id == SPELL_SONIC_BOOM_EFFECT) - m_creature->DealDamage(target,(target->GetHealth()*90)/100,NULL,SPELL_DIRECT_DAMAGE,SPELL_SCHOOL_MASK_NATURE,spell); - } - - void UpdateAI(const uint32 diff) - { - //Return since we have no target or casting - if (!UpdateVictim() || m_creature->IsNonMeleeSpellCasted(false)) - return; - - // Sonic Boom - if (SonicBoom) - { - DoCast(m_creature, SPELL_SONIC_BOOM_EFFECT, true); - SonicBoomEffect(); - - SonicBoom = false; - Resonance_Timer = 1500; - } - if (SonicBoom_Timer < diff) - { - DoScriptText(EMOTE_SONIC_BOOM, m_creature); - DoCast(m_creature, SPELL_SONIC_BOOM_CAST); - SonicBoom_Timer = 30000; - SonicBoom = true; - return; - }else SonicBoom_Timer -= diff; - - // Murmur's Touch - if (MurmursTouch_Timer < diff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM,0,80,true)) - DoCast(target, SPELL_MURMURS_TOUCH); - MurmursTouch_Timer = 25000 + rand()%10000; - }else MurmursTouch_Timer -= diff; - - // Resonance - if (!SonicBoom && !(m_creature->IsWithinMeleeRange(m_creature->getVictim()))) - { - if (Resonance_Timer < diff) - { - DoCast(m_creature, SPELL_RESONANCE); - Resonance_Timer = 5000; - }else Resonance_Timer -= diff; - } - - // Magnetic Pull - if (MagneticPull_Timer < diff) - { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - if (target->GetTypeId() == TYPEID_PLAYER && target->isAlive()) - { - DoCast(target, SPELL_MAGNETIC_PULL); - MagneticPull_Timer = 15000+rand()%15000; - return; - } - MagneticPull_Timer = 500; - }else MagneticPull_Timer -= diff; - - if (HeroicMode) - { - // Thundering Storm - if (ThunderingStorm_Timer < diff) - { - std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); - for(std::list::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) - if (Unit* target = Unit::GetUnit((*m_creature),(*i)->getUnitGuid())) - if (target->isAlive() && !m_creature->IsWithinDist(target, 35, false)) - DoCast(target, SPELL_THUNDERING_STORM, true); - ThunderingStorm_Timer = 15000; - }else ThunderingStorm_Timer -= diff; - - // Sonic Shock - if (SonicShock_Timer < diff) - { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM,0,20,false)) - if (target->isAlive()) - DoCast(target, SPELL_SONIC_SHOCK); - SonicShock_Timer = 10000+rand()%10000; - }else SonicShock_Timer -= diff; - } - - // Select nearest most aggro target if top aggro too far - if (!m_creature->isAttackReady()) - return; - if (!m_creature->IsWithinMeleeRange(m_creature->getVictim())) - { - std::list& m_threatlist = m_creature->getThreatManager().getThreatList(); - for(std::list::iterator i = m_threatlist.begin(); i != m_threatlist.end(); ++i) - if (Unit* target = Unit::GetUnit((*m_creature),(*i)->getUnitGuid())) - if (target->isAlive() && m_creature->IsWithinMeleeRange(target)) - { - m_creature->TauntApply(target); - break; - } - } - - DoMeleeAttackIfReady(); - } -}; - -CreatureAI* GetAI_boss_murmur(Creature* pCreature) -{ - return new boss_murmurAI (pCreature); -} - -void AddSC_boss_murmur() -{ - Script *newscript; - newscript = new Script; - newscript->Name="boss_murmur"; - newscript->GetAI = &GetAI_boss_murmur; - newscript->RegisterSelf(); -} - diff --git a/src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/def_shadow_labyrinth.h b/src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/def_shadow_labyrinth.h deleted file mode 100644 index a78955368bf..00000000000 --- a/src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/def_shadow_labyrinth.h +++ /dev/null @@ -1,15 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software licensed under GPL version 2 - * Please see the included DOCS/LICENSE.TXT for more information */ - -#ifndef DEF_SHADOW_LABYRINTH_H -#define DEF_SHADOW_LABYRINTH_H - -#define TYPE_HELLMAW 1 -#define TYPE_OVERSEER 2 -#define DATA_BLACKHEARTTHEINCITEREVENT 3 -#define DATA_GRANDMASTERVORPILEVENT 4 -#define DATA_MURMUREVENT 5 -#define DATA_GRANDMASTERVORPIL 6 -#endif - diff --git a/src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp b/src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp deleted file mode 100644 index f8f3b73bffa..00000000000 --- a/src/bindings/scripts/scripts/outland/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp +++ /dev/null @@ -1,227 +0,0 @@ -/* Copyright (C) 2006 - 2009 ScriptDev2 - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* ScriptData -SDName: Instance_Shadow_Labyrinth -SD%Complete: 85 -SDComment: Some cleanup left along with save -SDCategory: Auchindoun, Shadow Labyrinth -EndScriptData */ - -#include "precompiled.h" -#include "def_shadow_labyrinth.h" - -#define MAX_ENCOUNTER 5 - -#define REFECTORY_DOOR 183296 //door opened when blackheart the inciter dies -#define SCREAMING_HALL_DOOR 183295 //door opened when grandmaster vorpil dies - -/* Shadow Labyrinth encounters: -1 - Ambassador Hellmaw event -2 - Blackheart the Inciter event -3 - Grandmaster Vorpil event -4 - Murmur event -*/ - -struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance -{ - instance_shadow_labyrinth(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; - - uint64 m_uiRefectoryDoorGUID; - uint64 m_uiScreamingHallDoorGUID; - - uint64 m_uiGrandmasterVorpil; - uint32 m_uiFelOverseerCount; - - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - m_uiRefectoryDoorGUID = 0; - m_uiScreamingHallDoorGUID = 0; - - m_uiGrandmasterVorpil = 0; - m_uiFelOverseerCount = 0; - } - - bool IsEncounterInProgress() const - { - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; - - return false; - } - - void OnGameObjectCreate(GameObject* pGo, bool add) - { - switch(pGo->GetEntry()) - { - case REFECTORY_DOOR: - m_uiRefectoryDoorGUID = pGo->GetGUID(); - if (m_auiEncounter[2] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - break; - case SCREAMING_HALL_DOOR: - m_uiScreamingHallDoorGUID = pGo->GetGUID(); - if (m_auiEncounter[3] == DONE) - pGo->SetGoState(GO_STATE_ACTIVE); - break; - } - } - - void OnCreatureCreate(Creature* pCreature, bool add) - { - switch(pCreature->GetEntry()) - { - case 18732: - m_uiGrandmasterVorpil = pCreature->GetGUID(); - break; - case 18796: - if (pCreature->isAlive()) - { - ++m_uiFelOverseerCount; - debug_log("TSCR: Shadow Labyrinth: counting %u Fel Overseers.",m_uiFelOverseerCount); - } - break; - } - } - - void SetData(uint32 type, uint32 uiData) - { - switch(type) - { - case TYPE_HELLMAW: - m_auiEncounter[0] = uiData; - break; - - case TYPE_OVERSEER: - if (uiData != DONE) - { - error_log("TSCR: Shadow Labyrinth: TYPE_OVERSEER did not expect other data than DONE"); - return; - } - if (m_uiFelOverseerCount) - { - --m_uiFelOverseerCount; - - if (m_uiFelOverseerCount) - debug_log("TSCR: Shadow Labyrinth: %u Fel Overseers left to kill.",m_uiFelOverseerCount); - else - { - m_auiEncounter[1] = DONE; - debug_log("TSCR: Shadow Labyrinth: TYPE_OVERSEER == DONE"); - } - } - break; - - case DATA_BLACKHEARTTHEINCITEREVENT: - if (uiData == DONE) - DoUseDoorOrButton(m_uiRefectoryDoorGUID); - m_auiEncounter[2] = uiData; - break; - - case DATA_GRANDMASTERVORPILEVENT: - if (uiData == DONE) - DoUseDoorOrButton(m_uiScreamingHallDoorGUID); - m_auiEncounter[3] = uiData; - break; - - case DATA_MURMUREVENT: - m_auiEncounter[4] = uiData; - break; - } - - if (uiData == DONE) - { - if (type == TYPE_OVERSEER && m_uiFelOverseerCount != 0) - return; - - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " - << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4]; - - str_data = saveStream.str(); - - SaveToDB(); - OUT_SAVE_INST_DATA_COMPLETE; - } - } - - uint32 GetData(uint32 type) - { - switch(type) - { - case TYPE_HELLMAW: return m_auiEncounter[0]; - case TYPE_OVERSEER: return m_auiEncounter[1]; - case DATA_GRANDMASTERVORPILEVENT: return m_auiEncounter[3]; - case DATA_MURMUREVENT: return m_auiEncounter[4]; - } - return false; - } - - uint64 GetData64(uint32 identifier) - { - if (identifier == DATA_GRANDMASTERVORPIL) - return m_uiGrandmasterVorpil; - - return 0; - } - - std::string GetSaveData() - { - return str_data; - } - - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - std::istringstream loadStream(in); - loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> m_auiEncounter[4]; - - for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - - OUT_LOAD_INST_DATA_COMPLETE; - } -}; - -InstanceData* GetInstanceData_instance_shadow_labyrinth(Map* pMap) -{ - return new instance_shadow_labyrinth(pMap); -} - -void AddSC_instance_shadow_labyrinth() -{ - Script *newscript; - newscript = new Script; - newscript->Name = "instance_shadow_labyrinth"; - newscript->GetInstanceData = &GetInstanceData_instance_shadow_labyrinth; - newscript->RegisterSelf(); -} - diff --git a/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/instance_arcatraz.cpp b/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/instance_arcatraz.cpp index 081c80c56e5..ebf5484671c 100644 --- a/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/instance_arcatraz.cpp +++ b/src/bindings/scripts/scripts/outland/tempest_keep/arcatraz/instance_arcatraz.cpp @@ -84,8 +84,7 @@ struct TRINITY_DLL_DECL instance_arcatraz : public ScriptedInstance bool IsEncounterInProgress() const { for(uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - return true; + if (m_auiEncounter[i] == IN_PROGRESS) return true; return false; } diff --git a/src/bindings/scripts/system/ScriptLoader.cpp b/src/bindings/scripts/system/ScriptLoader.cpp index 024fbe7b7a1..236dab3bfcc 100644 --- a/src/bindings/scripts/system/ScriptLoader.cpp +++ b/src/bindings/scripts/system/ScriptLoader.cpp @@ -307,14 +307,14 @@ extern void AddSC_wintergrasp(); extern void AddSC_zuldrak(); //outland -extern void AddSC_boss_exarch_maladaar(); //Aunchindoun Auchenai Crypts +extern void AddSC_boss_exarch_maladaar(); //Auchindoun Auchenai Crypts extern void AddSC_boss_shirrak_the_dead_watcher(); -extern void AddSC_boss_nexusprince_shaffar(); //Aunchindoun Mana Tombs +extern void AddSC_boss_nexusprince_shaffar(); //Auchindoun Mana Tombs extern void AddSC_boss_pandemonius(); -extern void AddSC_boss_darkweaver_syth(); //Aunchindoun Sekketh Halls +extern void AddSC_boss_darkweaver_syth(); //Auchindoun Sekketh Halls extern void AddSC_boss_talon_king_ikiss(); extern void AddSC_instance_sethekk_halls(); -extern void AddSC_instance_shadow_labyrinth(); //Aunchindoun Shadow Labyrinth +extern void AddSC_instance_shadow_labyrinth(); //Auchindoun Shadow Labyrinth extern void AddSC_boss_ambassador_hellmaw(); extern void AddSC_boss_blackheart_the_inciter(); extern void AddSC_boss_grandmaster_vorpil(); @@ -693,14 +693,14 @@ void AddScripts() AddSC_zuldrak(); //outland - AddSC_boss_exarch_maladaar(); //Aunchindoun Auchenai Crypts + AddSC_boss_exarch_maladaar(); //Auchindoun Auchenai Crypts AddSC_boss_shirrak_the_dead_watcher(); - AddSC_boss_nexusprince_shaffar(); //Aunchindoun Mana Tombs + AddSC_boss_nexusprince_shaffar(); //Auchindoun Mana Tombs AddSC_boss_pandemonius(); - AddSC_boss_darkweaver_syth(); //Aunchindoun Sekketh Halls + AddSC_boss_darkweaver_syth(); //Auchindoun Sekketh Halls AddSC_boss_talon_king_ikiss(); AddSC_instance_sethekk_halls(); - AddSC_instance_shadow_labyrinth(); //Aunchindoun Shadow Labyrinth + AddSC_instance_shadow_labyrinth(); //Auchindoun Shadow Labyrinth AddSC_boss_ambassador_hellmaw(); AddSC_boss_blackheart_the_inciter(); AddSC_boss_grandmaster_vorpil(); -- cgit v1.2.3 From cad925e31d0cf71ead219d717ce34e6fea8be251 Mon Sep 17 00:00:00 2001 From: Kudlaty Date: Mon, 17 Aug 2009 00:29:53 +0200 Subject: Merge [SD2] r1326 Correct waypoints and details for quest 863 r1327 Add function GetPlayerForEscort to escortAI (not used by escortAI yet) r1328 Updated 0.12 patch and redesigned Karathress for better maintenance. Fixed an issue with Karathres's speech and a little casting bug. - skip r1329 Remove use of old uint64 variable for player guid in escortAI and use function to retrieve pointer to player instead. r1330 Restore compile and use FailQuest instead of no longer existing FailTimedQuest (ref Mangos 8355). Move all waypoints to db --HG-- branch : trunk --- sql/FULL/world_script_waypoints.sql | 312 +++++++++++++++++++++ sql/updates/5105_world_scripts.sql | 311 ++++++++++++++++++++ src/bindings/scripts/base/escort_ai.cpp | 14 +- src/bindings/scripts/base/escort_ai.h | 9 +- .../scripts/eastern_kingdoms/arathi_highlands.cpp | 5 +- .../scripts/eastern_kingdoms/eversong_woods.cpp | 13 +- .../scripts/eastern_kingdoms/ghostlands.cpp | 2 +- .../scripts/eastern_kingdoms/hinterlands.cpp | 6 +- .../scarlet_enclave/the_scarlet_enclave.cpp | 2 +- .../scripts/eastern_kingdoms/silverpine_forest.cpp | 34 +-- .../scripts/scripts/eastern_kingdoms/westfall.cpp | 4 +- .../scripts/scripts/eastern_kingdoms/wetlands.cpp | 6 +- .../scripts/scripts/examples/example_escort.cpp | 16 +- .../scripts/scripts/kalimdor/ashenvale.cpp | 12 +- .../scripts/scripts/kalimdor/azuremyst_isle.cpp | 2 +- .../old_hillsbrad/old_hillsbrad.cpp | 9 +- .../scripts/scripts/kalimdor/darkshore.cpp | 7 +- src/bindings/scripts/scripts/kalimdor/feralas.cpp | 2 +- .../kalimdor/razorfen_kraul/razorfen_kraul.cpp | 66 +---- .../scripts/kalimdor/stonetalon_mountains.cpp | 6 +- src/bindings/scripts/scripts/kalimdor/tanaris.cpp | 104 +------ .../scripts/scripts/kalimdor/the_barrens.cpp | 195 +++++++------ .../scripts/scripts/kalimdor/thousand_needles.cpp | 6 +- .../scripts/scripts/kalimdor/ungoro_crater.cpp | 79 +----- .../scripts/scripts/northrend/sholazar_basin.cpp | 11 +- .../scripts/scripts/outland/hellfire_peninsula.cpp | 6 +- .../scripts/scripts/outland/netherstorm.cpp | 55 +--- .../scripts/scripts/outland/shadowmoon_valley.cpp | 12 +- .../scripts/scripts/outland/shattrath_city.cpp | 82 +++--- .../scripts/scripts/outland/terokkar_forest.cpp | 82 +----- .../scripts/scripts/outland/zangarmarsh.cpp | 16 +- 31 files changed, 888 insertions(+), 598 deletions(-) create mode 100644 sql/updates/5105_world_scripts.sql (limited to 'src/bindings/scripts/base') diff --git a/sql/FULL/world_script_waypoints.sql b/sql/FULL/world_script_waypoints.sql index 86aee4a71ac..940ef9920ce 100644 --- a/sql/FULL/world_script_waypoints.sql +++ b/sql/FULL/world_script_waypoints.sql @@ -13,6 +13,318 @@ CREATE TABLE script_waypoint ( PRIMARY KEY (entry, pointid) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Script Creature waypoints'; +DELETE FROM script_waypoint WHERE entry = 20415; +INSERT INTO script_waypoint VALUES +(20415 ,0, 2488.77, 2184.89, 104.64, 0, ''), +(20415 ,1, 2478.72, 2184.77, 98.58, 0, ''), +(20415 ,2, 2473.52, 2184.71, 99.00, 0, ''), +(20415 ,3, 2453.15, 2184.96, 97.09,4000, ''), +(20415 ,4, 2424.18, 2184.15, 94.11, 0, ''), +(20415 ,5, 2413.18, 2184.15, 93.42, 0, ''), +(20415 ,6, 2402.02, 2183.90, 87.59, 0, ''), +(20415 ,7, 2333.31, 2181.63, 90.03,4000, ''), +(20415 ,8, 2308.73, 2184.34, 92.04, 0, ''), +(20415 ,9, 2303.10, 2196.89, 94.94, 0, ''), +(20415 ,10, 2304.58, 2272.23, 96.67, 0, ''), +(20415 ,11, 2297.09, 2271.40, 95.16, 0, ''), +(20415 ,12, 2297.68, 2266.79, 95.07,4000, ''), +(20415 ,13, 2297.67, 2266.76, 95.07,4000, ''); + +DELETE FROM script_waypoint WHERE entry = 18760; +INSERT INTO script_waypoint VALUES +(18760 ,0, -2265.21, 3091.14, 13.91, 0, ''), +(18760 ,1, -2266.80, 3091.33, 13.82, 1000, ''), +(18760 ,2, -2268.20, 3091.14, 13.82, 7000, 'progress1'), +(18760 ,3, -2278.32, 3098.98, 13.82, 0, ''), +(18760 ,4, -2294.82, 3110.59, 13.82, 0, ''), +(18760 ,5, -2300.71, 3114.60, 13.82, 20000, 'progress2'), +(18760 ,6, -2300.71, 3114.60, 13.82, 3000, 'progress3'), +(18760 ,7, -2307.36, 3122.76, 13.79, 0, ''), +(18760 ,8, -2312.83, 3130.55, 12.04, 0, ''), +(18760 ,9, -2345.02, 3151.00, 8.38, 0, ''), +(18760 ,10, -2351.97, 3157.61, 6.27, 0, ''), +(18760 ,11, -2360.35, 3171.48, 3.31, 0, ''), +(18760 ,12, -2371.44, 3185.41, 0.89, 0, ''), +(18760 ,13, -2371.21, 3197.92, -0.96, 0, ''), +(18760 ,14, -2380.35, 3210.45, -1.08, 0, ''), +(18760 ,15, -2384.74, 3221.25, -1.17, 0, ''), +(18760 ,16, -2386.15, 3233.39, -1.29, 0, ''), +(18760 ,17, -2383.45, 3247.79, -1.32, 0, ''), +(18760 ,18, -2367.50, 3265.64, -1.33, 0, ''), +(18760 ,19, -2354.90, 3273.30, -1.50, 0, ''), +(18760 ,20, -2348.88, 3280.58, -0.09, 0, ''), +(18760 ,21, -2349.06, 3295.86, -0.95, 0, ''), +(18760 ,22, -2350.43, 3328.27, -2.10, 0, ''), +(18760 ,23, -2346.76, 3356.27, -2.82, 0, ''), +(18760 ,24, -2340.56, 3370.68, -4.02, 0, ''), +(18760 ,25, -2318.84, 3384.60, -7.61, 0, ''), +(18760 ,26, -2313.99, 3398.61, -10.40, 0, ''), +(18760 ,27, -2320.85, 3414.49, -11.49, 0, ''), +(18760 ,28, -2338.26, 3426.06, -11.46, 0, ''), +(18760 ,29, -2342.67, 3439.44, -11.32, 12000, 'progress4'), +(18760 ,30, -2342.67, 3439.44, -11.32, 7000, 'emote bye'), +(18760 ,31, -2342.67, 3439.44, -11.32, 5000, 'cat form'), +(18760 ,32, -2344.60, 3461.27, -10.44, 0, ''), +(18760 ,33, -2396.81, 3517.17, -3.55, 0, ''), +(18760 ,34, -2439.23, 3523.00, -1.05, 0, ''); + +DELETE FROM script_waypoint WHERE entry = 9623; +INSERT INTO script_waypoint VALUES +(9623 ,1, -6380.38, -1965.14, -258.292, 5000, ''), +(9623 ,2, -6383.06, -1962.9, -258.936, 0, ''), +(9623 ,3, -6391.09, -1956.13, -260.291, 0, ''), +(9623 ,4, -6395.29, -1933.58, -262.949, 0, ''), +(9623 ,5, -6396.58, -1919.93, -263.838, 0, ''), +(9623 ,6, -6389.01, -1912.64, -260.689, 0, ''), +(9623 ,7, -6369.19, -1892.87, -255.924, 0, ''), +(9623 ,8, -6373.77, -1879.36, -259.268, 0, ''), +(9623 ,9, -6377.55, -1869.56, -260.503, 0, ''), +(9623 ,10, -6376.58, -1860.79, -260.026, 0, ''), +(9623 ,11, -6373.13, -1847.22, -259.249, 0, ''), +(9623 ,12, -6370.54, -1837.04, -260.007, 0, ''), +(9623 ,13, -6372.52, -1829.16, -260.071, 0, ''), +(9623 ,14, -6377.13, -1815.94, -262.632, 0, ''), +(9623 ,15, -6380.27, -1806.95, -265.53, 0, ''), +(9623 ,16, -6386.04, -1790.43, -268.546, 0, ''), +(9623 ,17, -6386.72, -1776.29, -269.851, 0, ''), +(9623 ,18, -6385.92, -1762.31, -271.494, 0, ''), +(9623 ,19, -6384.69, -1744.86, -272.196, 0, ''), +(9623 ,20, -6383.8, -1732.66, -272.222, 0, ''), +(9623 ,21, -6382.66, -1716.96, -272.235, 0, ''), +(9623 ,22, -6381.5, -1703.01, -272.964, 0, ''), +(9623 ,23, -6379.96, -1685.58, -272.842, 0, ''), +(9623 ,24, -6379.34, -1678.61, -272.34, 0, ''), +(9623 ,25, -6364.45, -1636.27, -271.065, 0, ''), +(9623 ,26, -6371.85, -1626.36, -272.188, 0, ''), +(9623 ,27, -6383.5, -1629.01, -272.206, 0, ''), +(9623 ,28, -6388.09, -1635.37, -272.105, 5000, ''), +(9623 ,29, -6375.42, -1637.33, -272.193, 0, ''), +(9623 ,30, -6365.46, -1617.25, -272.141, 0, ''), +(9623 ,31, -6353.79, -1603.48, -271.932, 0, ''), +(9623 ,32, -6340.24, -1592.41, -269.435, 0, ''), +(9623 ,33, -6329.45, -1566.89, -269.895, 0, ''), +(9623 ,34, -6312.2, -1499.06, -269.507, 0, ''), +(9623 ,35, -6304.55, -1468.5, -269.431, 0, ''), +(9623 ,36, -6310.36, -1440.94, -268.427, 0, ''), +(9623 ,37, -6321, -1418.91, -266.525, 0, ''), +(9623 ,38, -6358.76, -1389.97, -267.522, 0, ''), +(9623 ,39, -6378.65, -1375.67, -271.749, 0, ''), +(9623 ,40, -6387.22, -1360.95, -272.109, 0, ''), +(9623 ,41, -6406.95, -1323.87, -271.586, 0, ''), +(9623 ,42, -6405, -1311.92, -271.906, 0, ''), +(9623 ,43, -6395.56, -1303.62, -271.902, 0, ''), +(9623 ,44, -6375.97, -1296.08, -271.865, 0, ''), +(9623 ,45, -6364.39, -1281.23, -269.012, 0, ''), +(9623 ,46, -6353.71, -1263.19, -267.95, 0, ''), +(9623 ,47, -6340.09, -1248.65, -267.441, 0, ''), +(9623 ,48, -6338.21, -1237.11, -267.844, 0, ''), +(9623 ,49, -6336.6, -1219.69, -269.196, 0, ''), +(9623 ,50, -6334.44, -1202.33, -271.527, 0, ''), +(9623 ,51, -6329.56, -1189.82, -270.947, 0, ''), +(9623 ,52, -6324.66, -1179.46, -270.103, 0, ''), +(9623 ,53, -6315.08, -1176.74, -269.735, 0, ''), +(9623 ,54, -6308.49, -1179.12, -269.57, 0, ''), +(9623 ,55, -6302.43, -1181.32, -269.328, 5000, ''), +(9623 ,56, -6298.87, -1185.79, -269.278, 0, ''); + +DELETE FROM script_waypoint WHERE entry = 4508; +INSERT INTO script_waypoint VALUES +(4508 ,0, 2194.38, 1791.65, 65.48, 5000, ''), +(4508 ,1, 2188.56, 1805.87, 64.45, 0, ''), +(4508 ,2, 2187, 1843.49, 59.33, 0, ''), +(4508 ,3, 2163.27, 1851.67, 56.73, 5000, ''), +(4508 ,4, 2137.66, 1843.98, 48.08, 5000, ''), +(4508 ,5, 2140.22, 1845.02, 48.32, 0, ''), +(4508 ,6, 2131.5, 1804.29, 46.85, 0, ''), +(4508 ,7, 2096.18, 1789.03, 51.13, 0, ''), +(4508 ,8, 2074.46, 1780.09, 55.64, 3000, ''), +(4508 ,9, 2055.12, 1768.67, 58.46, 5000, ''), +(4508 ,10, 2037.83, 1748.62, 60.27, 0, ''), +(4508 ,11, 2037.51, 1728.94, 60.85, 0, ''), +(4508 ,12, 2044.7, 1711.71, 59.71, 0, ''), +(4508 ,13, 2067.66, 1701.84, 57.77, 3000, ''), +(4508 ,14, 2078.91, 1704.54, 56.77, 3000, ''), +(4508 ,15, 2097.65, 1715.24, 54.74, 0, ''), +(4508 ,16, 2106.44, 1720.98, 54.41, 0, ''), +(4508 ,17, 2123.96, 1732.56, 52.27, 0, ''), +(4508 ,18, 2153.82, 1728.73, 51.92, 0, ''), +(4508 ,19, 2163.49, 1706.33, 54.42, 0, ''), +(4508 ,20, 2158.75, 1695.98, 55.70, 0, ''), +(4508 ,21, 2142.6, 1680.72, 58.24, 0, ''), +(4508 ,22, 2118.31, 1671.54, 59.21, 0, ''), +(4508 ,23, 2086.02, 1672.04, 61.24, 0, ''), +(4508 ,24, 2068.81, 1658.93, 61.24, 0, ''), +(4508 ,25, 2062.82, 1633.31, 64.35, 3000, ''), +(4508 ,26, 2063.05, 1589.16, 63.26, 0, ''), +(4508 ,27, 2063.67, 1577.22, 65.89, 0, ''), +(4508 ,28, 2057.94, 1560.68, 68.40, 0, ''), +(4508 ,29, 2052.56, 1548.05, 73.35, 0, ''), +(4508 ,30, 2045.22, 1543.4, 76.65, 0, ''), +(4508 ,31, 2034.35, 1543.01, 79.70, 0, ''), +(4508 ,32, 2029.95, 1542.94, 80.79, 0, ''), +(4508 ,33, 2021.34, 1538.67, 80.8, 0, ''), +(4508 ,34, 2012.45, 1549.48, 79.93, 0, ''), +(4508 ,35, 2008.05, 1554.92, 80.44, 0, ''), +(4508 ,36, 2006.54, 1562.72, 81.11, 0, ''), +(4508 ,37, 2003.8, 1576.43, 81.57, 0, ''), +(4508 ,38, 2000.57, 1590.06, 80.62, 0, ''), +(4508 ,39, 1998.96, 1596.87, 80.22, 0, ''), +(4508 ,40, 1991.19, 1600.82, 79.39, 0, ''), +(4508 ,41, 1980.71, 1601.44, 79.77, 3000, ''), +(4508 ,42, 1967.22, 1600.18, 80.62, 3000, ''), +(4508 ,43, 1956.43, 1596.97, 81.75, 3000, ''), +(4508 ,44, 1954.87, 1592.02, 82.18, 0, ''), +(4508 ,45, 1948.35, 1571.35, 80.96, 30000, ''), +(4508 ,46, 1947.02, 1566.42, 81.80, 30000, ''); + +DELETE FROM script_waypoint WHERE entry = 7784; +INSERT INTO script_waypoint VALUES +(7784 ,0, -8843.73, -4374.44, 43.71, 0, ''), +(7784 ,1, -8834.68, -4373.88, 45.71, 0, ''), +(7784 ,2, -8832.93, -4373.85, 45.67, 0, ''), +(7784 ,3, -8829.21, -4373.72, 44.14, 0, ''), +(7784 ,4, -8825.10, -4373.56, 41.44, 0, ''), +(7784 ,5, -8818.88, -4372.75, 36.43, 0, ''), +(7784 ,6, -8803.37, -4369.68, 30.06, 0, ''), +(7784 ,7, -8786.68, -4366.18, 23.91, 0, ''), +(7784 ,8, -8764.97, -4366.94, 25.23, 0, ''), +(7784 ,9, -8745.49, -4363.16, 22.80, 0, ''), +(7784 ,10, -8724.13, -4353.55, 20.72, 0, ''), +(7784 ,11, -8706.77, -4346.14, 16.12, 0, ''), +(7784 ,12, -8688.27, -4372.85, 13.64, 0, ''), +(7784 ,13, -8668.76, -4380.38, 11.69, 0, ''), +(7784 ,14, -8645.19, -4388.62, 12.56, 0, ''), +(7784 ,15, -8614.73, -4398.60, 9.86, 0, ''), +(7784 ,16, -8560.33, -4411.27, 13.17, 0, ''), +(7784 ,17, -8536.45, -4416.49, 11.84, 0, ''), +(7784 ,18, -8503.48, -4423.70, 13.59, 0, ''), +(7784 ,19, -8471.91, -4430.60, 9.56, 0, ''), +(7784 ,20, -8441.36, -4435.31, 9.40, 0, ''), +(7784 ,21, -8403.41, -4441.16, 11.83, 0, ''), +(7784 ,22, -8371.24, -4446.13, 9.47, 0, ''), +(7784 ,23, -8353.96, -4448.79, 10.10, 0, 'Scorpid'), +(7784 ,24, -8336.40, -4446.39, 8.98, 0, ''), +(7784 ,25, -8303.78, -4441.96, 11.89, 0, ''), +(7784 ,26, -8272.20, -4433.31, 9.60, 0, ''), +(7784 ,27, -8224.76, -4419.39, 13.03, 0, ''), +(7784 ,28, -8193.31, -4406.04, 10.17, 0, ''), +(7784 ,29, -8155.65, -4397.74, 8.99, 0, ''), +(7784 ,30, -8129.25, -4394.57, 10.92, 0, ''), +(7784 ,31, -8104.86, -4399.03, 8.93, 0, ''), +(7784 ,32, -8063.15, -4423.40, 10.07, 0, ''), +(7784 ,33, -8032.15, -4443.47, 9.97, 0, ''), +(7784 ,34, -8015.39, -4454.33, 9.39, 0, ''), +(7784 ,35, -7981.64, -4482.44, 10.32, 0, ''), +(7784 ,36, -7958.83, -4503.98, 9.69, 0, ''), +(7784 ,37, -7932.45, -4528.91, 10.08, 0, ''), +(7784 ,38, -7904.09, -4566.67, 12.59, 0, ''), +(7784 ,39, -7883.33, -4593.91, 12.15, 0, ''), +(7784 ,40, -7862.83, -4624.53, 10.21, 0, ''), +(7784 ,41, -7840.79, -4654.26, 9.45, 0, ''), +(7784 ,42, -7826.17, -4673.99, 10.61, 0, ''), +(7784 ,43, -7807.86, -4698.69, 11.24, 0, ''), +(7784 ,44, -7793.88, -4717.55, 10.48, 0, ''), +(7784 ,45, -7778.68, -4738.05, 8.89, 0, ''), +(7784 ,46, -7746.42, -4780.39, 9.84, 0, ''), +(7784 ,47, -7724.11, -4772.75, 10.28, 0, ''), +(7784 ,48, -7697.98, -4763.80, 9.52, 0, ''), +(7784 ,49, -7665.33, -4752.62, 10.56, 0, ''), +(7784 ,50, -7641.47, -4750.33, 8.94, 0, ''), +(7784 ,51, -7620.08, -4753.96, 8.93, 0, ''), +(7784 ,52, -7603.15, -4757.53, 9.06, 0, ''), +(7784 ,53, -7579.43, -4767.07, 8.93, 0, ''), +(7784 ,54, -7558.51, -4779.01, 9.64, 0, ''), +(7784 ,55, -7536.40, -4789.32, 8.92, 0, ''), +(7784 ,56, -7512.07, -4793.50, 9.35, 0, 'Wastewander'), +(7784 ,57, -7490.79, -4788.80, 10.53, 0, ''), +(7784 ,58, -7469.10, -4785.11, 10.42, 0, ''), +(7784 ,59, -7453.18, -4782.41, 9.15, 0, ''), +(7784 ,60, -7426.27, -4777.83, 9.54, 0, ''), +(7784 ,61, -7393.84, -4770.19, 12.57, 0, ''), +(7784 ,62, -7367.25, -4764.17, 11.92, 0, ''), +(7784 ,63, -7341.00, -4752.11, 10.17, 0, ''), +(7784 ,64, -7321.62, -4744.97, 11.58, 0, ''), +(7784 ,65, -7302.35, -4744.35, 11.97, 0, ''), +(7784 ,66, -7281.00, -4743.66, 11.21, 0, ''), +(7784 ,67, -7258.33, -4742.93, 9.64, 0, ''), +(7784 ,68, -7236.70, -4742.24, 10.16, 0, ''), +(7784 ,69, -7217.52, -4743.87, 10.79, 0, ''), +(7784 ,70, -7201.86, -4746.32, 9.58, 0, ''), +(7784 ,71, -7182.01, -4749.41, 9.09, 0, ''), +(7784 ,72, -7159.61, -4752.90, 9.52, 0, ''), +(7784 ,73, -7139.58, -4756.02, 9.53, 0, ''), +(7784 ,74, -7122.60, -4754.91, 9.66, 0, ''), +(7784 ,75, -7101.06, -4753.87, 8.92, 0, ''), +(7784 ,76, -7082.79, -4752.99, 9.97, 0, ''), +(7784 ,77, -7061.81, -4751.98, 9.26, 0, ''), +(7784 ,78, -7035.12, -4754.39, 9.19, 0, ''), +(7784 ,79, -7013.90, -4758.64, 10.28, 0, ''), +(7784 ,80, -7001.71, -4769.73, 10.59, 0, ''), +(7784 ,81, -6984.95, -4788.61, 9.30, 0, ''), +(7784 ,82, -6970.41, -4788.77, 9.42, 0, ''), +(7784 ,83, -6957.16, -4788.92, 6.26, 0, ''), +(7784 ,84, -6951.29, -4802.73, 4.45, 0, ''), +(7784 ,85, -6944.81, -4816.58, 1.60, 0, ''), +(7784 ,86, -6942.06, -4839.40, 0.66, 5000, ''); + +DELETE FROM script_waypoint WHERE entry = 1978; +INSERT INTO script_waypoint VALUES +(1978, 0, 1406.32, 1083.10, 52.55, 0, ''), +(1978, 1, 1400.49, 1080.42, 52.50, 0, 'first say'), +(1978, 2, 1388.48, 1083.10, 52.52, 0, ''), +(1978, 3, 1370.16, 1084.02, 52.30, 0, ''), +(1978, 4, 1359.02, 1080.85, 52.46, 0, ''), +(1978, 5, 1341.43, 1087.39, 52.69, 0, ''), +(1978, 6, 1321.93, 1090.51, 50.66, 0, ''), +(1978, 7, 1312.98, 1095.91, 47.49, 0, ''), +(1978, 8, 1301.09, 1102.94, 47.76, 0, ''), +(1978, 9, 1297.73, 1106.35, 50.18, 0, ''), +(1978, 10, 1295.49, 1124.32, 50.49, 0, ''), +(1978, 11, 1294.84, 1137.25, 51.75, 0, ''), +(1978, 12, 1292.89, 1158.99, 52.65, 0, ''), +(1978, 13, 1290.75, 1168.67, 52.56, 1000, 'complete quest and say last'), +(1978, 14, 1287.12, 1203.49, 52.66, 5000, ''), +(1978, 15, 1287.12, 1203.49, 52.66, 4000, ''), +(1978, 16, 1287.12, 1203.49, 52.66, 5000, ''), +(1978, 17, 1287.12, 1203.49, 52.66, 4000, ''), +(1978, 18, 1290.72, 1207.44, 52.69, 0, ''), +(1978, 19, 1297.50, 1207.18, 53.74, 0, ''), +(1978, 20, 1301.32, 1220.90, 53.74, 0, ''), +(1978, 21, 1298.55, 1220.43, 53.74, 0, ''), +(1978, 22, 1297.59, 1211.23, 58.47, 0, ''), +(1978, 23, 1305.01, 1206.10, 58.51, 0, ''), +(1978, 24, 1310.51, 1207.36, 58.51, 5000, ''), +(1978, 25, 1310.51, 1207.36, 58.51, 5000, ''), +(1978, 26, 1310.51, 1207.36, 58.51, 2000, ''); + +DELETE FROM script_waypoint WHERE entry=3439; +INSERT INTO script_waypoint VALUES +(3439, 0, 1105.090332, -3101.254150, 82.706, 1000, 'SAY_STARTUP1'), +(3439, 1, 1103.204468, -3104.345215, 83.113, 1000, ''), +(3439, 2, 1107.815186, -3106.495361, 82.739, 1000, ''), +(3439, 3, 1104.733276, -3100.830811, 82.747, 1000, ''), +(3439, 4, 1103.242554, -3106.270020, 83.133, 1000, ''), +(3439, 5, 1112.807373, -3106.285400, 82.320, 1000, ''), +(3439, 6, 1112.826782, -3108.908691, 82.377, 1000, ''), +(3439, 7, 1108.053955, -3115.156738, 82.894, 0, ''), +(3439, 8, 1108.355591, -3104.365234, 82.377, 5000, ''), +(3439, 9, 1100.306763, -3097.539063, 83.150, 0, 'SAY_STARTUP2'), +(3439, 10, 1100.562378, -3082.721924, 82.768, 0, ''), +(3439, 11, 1097.512939, -3069.226563, 82.206, 0, ''), +(3439, 12, 1092.964966, -3053.114746, 82.351, 0, ''), +(3439, 13, 1094.010986, -3036.958496, 82.888, 0, ''), +(3439, 14, 1095.623901, -3025.760254, 83.392, 0, ''), +(3439, 15, 1107.656494, -3013.530518, 85.653, 0, ''), +(3439, 16, 1119.647705, -3006.928223, 87.019, 0, ''), +(3439, 17, 1129.991211, -3002.410645, 91.232, 7000, 'SAY_MERCENARY'), +(3439, 18, 1133.328735, -2997.710693, 91.675, 1000, 'SAY_PROGRESS_1'), +(3439, 19, 1131.799316, -2987.948242, 91.976, 1000, ''), +(3439, 20, 1122.028687, -2993.397461, 91.536, 0, ''), +(3439, 21, 1116.614868, -2981.916748, 92.103, 0, ''), +(3439, 22, 1102.239136, -2994.245117, 92.074, 0, ''), +(3439, 23, 1096.366211, -2978.306885, 91.873, 0, ''), +(3439, 24, 1091.971558, -2985.919189, 91.730, 40000, 'SAY_PROGRESS_2'); + DELETE FROM script_waypoint WHERE entry=7806; INSERT INTO script_waypoint VALUES (7806, 0, 495.404358, -3478.350830, 114.837, 0, ''), diff --git a/sql/updates/5105_world_scripts.sql b/sql/updates/5105_world_scripts.sql new file mode 100644 index 00000000000..33a32fcc254 --- /dev/null +++ b/sql/updates/5105_world_scripts.sql @@ -0,0 +1,311 @@ +DELETE FROM script_waypoint WHERE entry=3439; +INSERT INTO script_waypoint VALUES +(3439, 0, 1105.090332, -3101.254150, 82.706, 1000, 'SAY_STARTUP1'), +(3439, 1, 1103.204468, -3104.345215, 83.113, 1000, ''), +(3439, 2, 1107.815186, -3106.495361, 82.739, 1000, ''), +(3439, 3, 1104.733276, -3100.830811, 82.747, 1000, ''), +(3439, 4, 1103.242554, -3106.270020, 83.133, 1000, ''), +(3439, 5, 1112.807373, -3106.285400, 82.320, 1000, ''), +(3439, 6, 1112.826782, -3108.908691, 82.377, 1000, ''), +(3439, 7, 1108.053955, -3115.156738, 82.894, 0, ''), +(3439, 8, 1108.355591, -3104.365234, 82.377, 5000, ''), +(3439, 9, 1100.306763, -3097.539063, 83.150, 0, 'SAY_STARTUP2'), +(3439, 10, 1100.562378, -3082.721924, 82.768, 0, ''), +(3439, 11, 1097.512939, -3069.226563, 82.206, 0, ''), +(3439, 12, 1092.964966, -3053.114746, 82.351, 0, ''), +(3439, 13, 1094.010986, -3036.958496, 82.888, 0, ''), +(3439, 14, 1095.623901, -3025.760254, 83.392, 0, ''), +(3439, 15, 1107.656494, -3013.530518, 85.653, 0, ''), +(3439, 16, 1119.647705, -3006.928223, 87.019, 0, ''), +(3439, 17, 1129.991211, -3002.410645, 91.232, 7000, 'SAY_MERCENARY'), +(3439, 18, 1133.328735, -2997.710693, 91.675, 1000, 'SAY_PROGRESS_1'), +(3439, 19, 1131.799316, -2987.948242, 91.976, 1000, ''), +(3439, 20, 1122.028687, -2993.397461, 91.536, 0, ''), +(3439, 21, 1116.614868, -2981.916748, 92.103, 0, ''), +(3439, 22, 1102.239136, -2994.245117, 92.074, 0, ''), +(3439, 23, 1096.366211, -2978.306885, 91.873, 0, ''), +(3439, 24, 1091.971558, -2985.919189, 91.730, 40000, 'SAY_PROGRESS_2'); + +DELETE FROM script_waypoint WHERE entry = 1978; +INSERT INTO script_waypoint VALUES +(1978, 0, 1406.32, 1083.10, 52.55, 0, ''), +(1978, 1, 1400.49, 1080.42, 52.50, 0, 'first say'), +(1978, 2, 1388.48, 1083.10, 52.52, 0, ''), +(1978, 3, 1370.16, 1084.02, 52.30, 0, ''), +(1978, 4, 1359.02, 1080.85, 52.46, 0, ''), +(1978, 5, 1341.43, 1087.39, 52.69, 0, ''), +(1978, 6, 1321.93, 1090.51, 50.66, 0, ''), +(1978, 7, 1312.98, 1095.91, 47.49, 0, ''), +(1978, 8, 1301.09, 1102.94, 47.76, 0, ''), +(1978, 9, 1297.73, 1106.35, 50.18, 0, ''), +(1978, 10, 1295.49, 1124.32, 50.49, 0, ''), +(1978, 11, 1294.84, 1137.25, 51.75, 0, ''), +(1978, 12, 1292.89, 1158.99, 52.65, 0, ''), +(1978, 13, 1290.75, 1168.67, 52.56, 1000, 'complete quest and say last'), +(1978, 14, 1287.12, 1203.49, 52.66, 5000, ''), +(1978, 15, 1287.12, 1203.49, 52.66, 4000, ''), +(1978, 16, 1287.12, 1203.49, 52.66, 5000, ''), +(1978, 17, 1287.12, 1203.49, 52.66, 4000, ''), +(1978, 18, 1290.72, 1207.44, 52.69, 0, ''), +(1978, 19, 1297.50, 1207.18, 53.74, 0, ''), +(1978, 20, 1301.32, 1220.90, 53.74, 0, ''), +(1978, 21, 1298.55, 1220.43, 53.74, 0, ''), +(1978, 22, 1297.59, 1211.23, 58.47, 0, ''), +(1978, 23, 1305.01, 1206.10, 58.51, 0, ''), +(1978, 24, 1310.51, 1207.36, 58.51, 5000, ''), +(1978, 25, 1310.51, 1207.36, 58.51, 5000, ''), +(1978, 26, 1310.51, 1207.36, 58.51, 2000, ''); + +DELETE FROM script_waypoint WHERE entry = 7784; +INSERT INTO script_waypoint VALUES +(7784 ,0, -8843.73, -4374.44, 43.71, 0, ''), +(7784 ,1, -8834.68, -4373.88, 45.71, 0, ''), +(7784 ,2, -8832.93, -4373.85, 45.67, 0, ''), +(7784 ,3, -8829.21, -4373.72, 44.14, 0, ''), +(7784 ,4, -8825.10, -4373.56, 41.44, 0, ''), +(7784 ,5, -8818.88, -4372.75, 36.43, 0, ''), +(7784 ,6, -8803.37, -4369.68, 30.06, 0, ''), +(7784 ,7, -8786.68, -4366.18, 23.91, 0, ''), +(7784 ,8, -8764.97, -4366.94, 25.23, 0, ''), +(7784 ,9, -8745.49, -4363.16, 22.80, 0, ''), +(7784 ,10, -8724.13, -4353.55, 20.72, 0, ''), +(7784 ,11, -8706.77, -4346.14, 16.12, 0, ''), +(7784 ,12, -8688.27, -4372.85, 13.64, 0, ''), +(7784 ,13, -8668.76, -4380.38, 11.69, 0, ''), +(7784 ,14, -8645.19, -4388.62, 12.56, 0, ''), +(7784 ,15, -8614.73, -4398.60, 9.86, 0, ''), +(7784 ,16, -8560.33, -4411.27, 13.17, 0, ''), +(7784 ,17, -8536.45, -4416.49, 11.84, 0, ''), +(7784 ,18, -8503.48, -4423.70, 13.59, 0, ''), +(7784 ,19, -8471.91, -4430.60, 9.56, 0, ''), +(7784 ,20, -8441.36, -4435.31, 9.40, 0, ''), +(7784 ,21, -8403.41, -4441.16, 11.83, 0, ''), +(7784 ,22, -8371.24, -4446.13, 9.47, 0, ''), +(7784 ,23, -8353.96, -4448.79, 10.10, 0, 'Scorpid'), +(7784 ,24, -8336.40, -4446.39, 8.98, 0, ''), +(7784 ,25, -8303.78, -4441.96, 11.89, 0, ''), +(7784 ,26, -8272.20, -4433.31, 9.60, 0, ''), +(7784 ,27, -8224.76, -4419.39, 13.03, 0, ''), +(7784 ,28, -8193.31, -4406.04, 10.17, 0, ''), +(7784 ,29, -8155.65, -4397.74, 8.99, 0, ''), +(7784 ,30, -8129.25, -4394.57, 10.92, 0, ''), +(7784 ,31, -8104.86, -4399.03, 8.93, 0, ''), +(7784 ,32, -8063.15, -4423.40, 10.07, 0, ''), +(7784 ,33, -8032.15, -4443.47, 9.97, 0, ''), +(7784 ,34, -8015.39, -4454.33, 9.39, 0, ''), +(7784 ,35, -7981.64, -4482.44, 10.32, 0, ''), +(7784 ,36, -7958.83, -4503.98, 9.69, 0, ''), +(7784 ,37, -7932.45, -4528.91, 10.08, 0, ''), +(7784 ,38, -7904.09, -4566.67, 12.59, 0, ''), +(7784 ,39, -7883.33, -4593.91, 12.15, 0, ''), +(7784 ,40, -7862.83, -4624.53, 10.21, 0, ''), +(7784 ,41, -7840.79, -4654.26, 9.45, 0, ''), +(7784 ,42, -7826.17, -4673.99, 10.61, 0, ''), +(7784 ,43, -7807.86, -4698.69, 11.24, 0, ''), +(7784 ,44, -7793.88, -4717.55, 10.48, 0, ''), +(7784 ,45, -7778.68, -4738.05, 8.89, 0, ''), +(7784 ,46, -7746.42, -4780.39, 9.84, 0, ''), +(7784 ,47, -7724.11, -4772.75, 10.28, 0, ''), +(7784 ,48, -7697.98, -4763.80, 9.52, 0, ''), +(7784 ,49, -7665.33, -4752.62, 10.56, 0, ''), +(7784 ,50, -7641.47, -4750.33, 8.94, 0, ''), +(7784 ,51, -7620.08, -4753.96, 8.93, 0, ''), +(7784 ,52, -7603.15, -4757.53, 9.06, 0, ''), +(7784 ,53, -7579.43, -4767.07, 8.93, 0, ''), +(7784 ,54, -7558.51, -4779.01, 9.64, 0, ''), +(7784 ,55, -7536.40, -4789.32, 8.92, 0, ''), +(7784 ,56, -7512.07, -4793.50, 9.35, 0, 'Wastewander'), +(7784 ,57, -7490.79, -4788.80, 10.53, 0, ''), +(7784 ,58, -7469.10, -4785.11, 10.42, 0, ''), +(7784 ,59, -7453.18, -4782.41, 9.15, 0, ''), +(7784 ,60, -7426.27, -4777.83, 9.54, 0, ''), +(7784 ,61, -7393.84, -4770.19, 12.57, 0, ''), +(7784 ,62, -7367.25, -4764.17, 11.92, 0, ''), +(7784 ,63, -7341.00, -4752.11, 10.17, 0, ''), +(7784 ,64, -7321.62, -4744.97, 11.58, 0, ''), +(7784 ,65, -7302.35, -4744.35, 11.97, 0, ''), +(7784 ,66, -7281.00, -4743.66, 11.21, 0, ''), +(7784 ,67, -7258.33, -4742.93, 9.64, 0, ''), +(7784 ,68, -7236.70, -4742.24, 10.16, 0, ''), +(7784 ,69, -7217.52, -4743.87, 10.79, 0, ''), +(7784 ,70, -7201.86, -4746.32, 9.58, 0, ''), +(7784 ,71, -7182.01, -4749.41, 9.09, 0, ''), +(7784 ,72, -7159.61, -4752.90, 9.52, 0, ''), +(7784 ,73, -7139.58, -4756.02, 9.53, 0, ''), +(7784 ,74, -7122.60, -4754.91, 9.66, 0, ''), +(7784 ,75, -7101.06, -4753.87, 8.92, 0, ''), +(7784 ,76, -7082.79, -4752.99, 9.97, 0, ''), +(7784 ,77, -7061.81, -4751.98, 9.26, 0, ''), +(7784 ,78, -7035.12, -4754.39, 9.19, 0, ''), +(7784 ,79, -7013.90, -4758.64, 10.28, 0, ''), +(7784 ,80, -7001.71, -4769.73, 10.59, 0, ''), +(7784 ,81, -6984.95, -4788.61, 9.30, 0, ''), +(7784 ,82, -6970.41, -4788.77, 9.42, 0, ''), +(7784 ,83, -6957.16, -4788.92, 6.26, 0, ''), +(7784 ,84, -6951.29, -4802.73, 4.45, 0, ''), +(7784 ,85, -6944.81, -4816.58, 1.60, 0, ''), +(7784 ,86, -6942.06, -4839.40, 0.66, 5000, ''); + +DELETE FROM script_waypoint WHERE entry = 4508; +INSERT INTO script_waypoint VALUES +(4508 ,0, 2194.38, 1791.65, 65.48, 5000, ''), +(4508 ,1, 2188.56, 1805.87, 64.45, 0, ''), +(4508 ,2, 2187, 1843.49, 59.33, 0, ''), +(4508 ,3, 2163.27, 1851.67, 56.73, 5000, ''), +(4508 ,4, 2137.66, 1843.98, 48.08, 5000, ''), +(4508 ,5, 2140.22, 1845.02, 48.32, 0, ''), +(4508 ,6, 2131.5, 1804.29, 46.85, 0, ''), +(4508 ,7, 2096.18, 1789.03, 51.13, 0, ''), +(4508 ,8, 2074.46, 1780.09, 55.64, 3000, ''), +(4508 ,9, 2055.12, 1768.67, 58.46, 5000, ''), +(4508 ,10, 2037.83, 1748.62, 60.27, 0, ''), +(4508 ,11, 2037.51, 1728.94, 60.85, 0, ''), +(4508 ,12, 2044.7, 1711.71, 59.71, 0, ''), +(4508 ,13, 2067.66, 1701.84, 57.77, 3000, ''), +(4508 ,14, 2078.91, 1704.54, 56.77, 3000, ''), +(4508 ,15, 2097.65, 1715.24, 54.74, 0, ''), +(4508 ,16, 2106.44, 1720.98, 54.41, 0, ''), +(4508 ,17, 2123.96, 1732.56, 52.27, 0, ''), +(4508 ,18, 2153.82, 1728.73, 51.92, 0, ''), +(4508 ,19, 2163.49, 1706.33, 54.42, 0, ''), +(4508 ,20, 2158.75, 1695.98, 55.70, 0, ''), +(4508 ,21, 2142.6, 1680.72, 58.24, 0, ''), +(4508 ,22, 2118.31, 1671.54, 59.21, 0, ''), +(4508 ,23, 2086.02, 1672.04, 61.24, 0, ''), +(4508 ,24, 2068.81, 1658.93, 61.24, 0, ''), +(4508 ,25, 2062.82, 1633.31, 64.35, 3000, ''), +(4508 ,26, 2063.05, 1589.16, 63.26, 0, ''), +(4508 ,27, 2063.67, 1577.22, 65.89, 0, ''), +(4508 ,28, 2057.94, 1560.68, 68.40, 0, ''), +(4508 ,29, 2052.56, 1548.05, 73.35, 0, ''), +(4508 ,30, 2045.22, 1543.4, 76.65, 0, ''), +(4508 ,31, 2034.35, 1543.01, 79.70, 0, ''), +(4508 ,32, 2029.95, 1542.94, 80.79, 0, ''), +(4508 ,33, 2021.34, 1538.67, 80.8, 0, ''), +(4508 ,34, 2012.45, 1549.48, 79.93, 0, ''), +(4508 ,35, 2008.05, 1554.92, 80.44, 0, ''), +(4508 ,36, 2006.54, 1562.72, 81.11, 0, ''), +(4508 ,37, 2003.8, 1576.43, 81.57, 0, ''), +(4508 ,38, 2000.57, 1590.06, 80.62, 0, ''), +(4508 ,39, 1998.96, 1596.87, 80.22, 0, ''), +(4508 ,40, 1991.19, 1600.82, 79.39, 0, ''), +(4508 ,41, 1980.71, 1601.44, 79.77, 3000, ''), +(4508 ,42, 1967.22, 1600.18, 80.62, 3000, ''), +(4508 ,43, 1956.43, 1596.97, 81.75, 3000, ''), +(4508 ,44, 1954.87, 1592.02, 82.18, 0, ''), +(4508 ,45, 1948.35, 1571.35, 80.96, 30000, ''), +(4508 ,46, 1947.02, 1566.42, 81.80, 30000, ''); + +DELETE FROM script_waypoint WHERE entry = 9623; +INSERT INTO script_waypoint VALUES +(9623 ,1, -6380.38, -1965.14, -258.292, 5000, ''), +(9623 ,2, -6383.06, -1962.9, -258.936, 0, ''), +(9623 ,3, -6391.09, -1956.13, -260.291, 0, ''), +(9623 ,4, -6395.29, -1933.58, -262.949, 0, ''), +(9623 ,5, -6396.58, -1919.93, -263.838, 0, ''), +(9623 ,6, -6389.01, -1912.64, -260.689, 0, ''), +(9623 ,7, -6369.19, -1892.87, -255.924, 0, ''), +(9623 ,8, -6373.77, -1879.36, -259.268, 0, ''), +(9623 ,9, -6377.55, -1869.56, -260.503, 0, ''), +(9623 ,10, -6376.58, -1860.79, -260.026, 0, ''), +(9623 ,11, -6373.13, -1847.22, -259.249, 0, ''), +(9623 ,12, -6370.54, -1837.04, -260.007, 0, ''), +(9623 ,13, -6372.52, -1829.16, -260.071, 0, ''), +(9623 ,14, -6377.13, -1815.94, -262.632, 0, ''), +(9623 ,15, -6380.27, -1806.95, -265.53, 0, ''), +(9623 ,16, -6386.04, -1790.43, -268.546, 0, ''), +(9623 ,17, -6386.72, -1776.29, -269.851, 0, ''), +(9623 ,18, -6385.92, -1762.31, -271.494, 0, ''), +(9623 ,19, -6384.69, -1744.86, -272.196, 0, ''), +(9623 ,20, -6383.8, -1732.66, -272.222, 0, ''), +(9623 ,21, -6382.66, -1716.96, -272.235, 0, ''), +(9623 ,22, -6381.5, -1703.01, -272.964, 0, ''), +(9623 ,23, -6379.96, -1685.58, -272.842, 0, ''), +(9623 ,24, -6379.34, -1678.61, -272.34, 0, ''), +(9623 ,25, -6364.45, -1636.27, -271.065, 0, ''), +(9623 ,26, -6371.85, -1626.36, -272.188, 0, ''), +(9623 ,27, -6383.5, -1629.01, -272.206, 0, ''), +(9623 ,28, -6388.09, -1635.37, -272.105, 5000, ''), +(9623 ,29, -6375.42, -1637.33, -272.193, 0, ''), +(9623 ,30, -6365.46, -1617.25, -272.141, 0, ''), +(9623 ,31, -6353.79, -1603.48, -271.932, 0, ''), +(9623 ,32, -6340.24, -1592.41, -269.435, 0, ''), +(9623 ,33, -6329.45, -1566.89, -269.895, 0, ''), +(9623 ,34, -6312.2, -1499.06, -269.507, 0, ''), +(9623 ,35, -6304.55, -1468.5, -269.431, 0, ''), +(9623 ,36, -6310.36, -1440.94, -268.427, 0, ''), +(9623 ,37, -6321, -1418.91, -266.525, 0, ''), +(9623 ,38, -6358.76, -1389.97, -267.522, 0, ''), +(9623 ,39, -6378.65, -1375.67, -271.749, 0, ''), +(9623 ,40, -6387.22, -1360.95, -272.109, 0, ''), +(9623 ,41, -6406.95, -1323.87, -271.586, 0, ''), +(9623 ,42, -6405, -1311.92, -271.906, 0, ''), +(9623 ,43, -6395.56, -1303.62, -271.902, 0, ''), +(9623 ,44, -6375.97, -1296.08, -271.865, 0, ''), +(9623 ,45, -6364.39, -1281.23, -269.012, 0, ''), +(9623 ,46, -6353.71, -1263.19, -267.95, 0, ''), +(9623 ,47, -6340.09, -1248.65, -267.441, 0, ''), +(9623 ,48, -6338.21, -1237.11, -267.844, 0, ''), +(9623 ,49, -6336.6, -1219.69, -269.196, 0, ''), +(9623 ,50, -6334.44, -1202.33, -271.527, 0, ''), +(9623 ,51, -6329.56, -1189.82, -270.947, 0, ''), +(9623 ,52, -6324.66, -1179.46, -270.103, 0, ''), +(9623 ,53, -6315.08, -1176.74, -269.735, 0, ''), +(9623 ,54, -6308.49, -1179.12, -269.57, 0, ''), +(9623 ,55, -6302.43, -1181.32, -269.328, 5000, ''), +(9623 ,56, -6298.87, -1185.79, -269.278, 0, ''); + +DELETE FROM script_waypoint WHERE entry = 18760; +INSERT INTO script_waypoint VALUES +(18760 ,0, -2265.21, 3091.14, 13.91, 0, ''), +(18760 ,1, -2266.80, 3091.33, 13.82, 1000, ''), +(18760 ,2, -2268.20, 3091.14, 13.82, 7000, 'progress1'), +(18760 ,3, -2278.32, 3098.98, 13.82, 0, ''), +(18760 ,4, -2294.82, 3110.59, 13.82, 0, ''), +(18760 ,5, -2300.71, 3114.60, 13.82, 20000, 'progress2'), +(18760 ,6, -2300.71, 3114.60, 13.82, 3000, 'progress3'), +(18760 ,7, -2307.36, 3122.76, 13.79, 0, ''), +(18760 ,8, -2312.83, 3130.55, 12.04, 0, ''), +(18760 ,9, -2345.02, 3151.00, 8.38, 0, ''), +(18760 ,10, -2351.97, 3157.61, 6.27, 0, ''), +(18760 ,11, -2360.35, 3171.48, 3.31, 0, ''), +(18760 ,12, -2371.44, 3185.41, 0.89, 0, ''), +(18760 ,13, -2371.21, 3197.92, -0.96, 0, ''), +(18760 ,14, -2380.35, 3210.45, -1.08, 0, ''), +(18760 ,15, -2384.74, 3221.25, -1.17, 0, ''), +(18760 ,16, -2386.15, 3233.39, -1.29, 0, ''), +(18760 ,17, -2383.45, 3247.79, -1.32, 0, ''), +(18760 ,18, -2367.50, 3265.64, -1.33, 0, ''), +(18760 ,19, -2354.90, 3273.30, -1.50, 0, ''), +(18760 ,20, -2348.88, 3280.58, -0.09, 0, ''), +(18760 ,21, -2349.06, 3295.86, -0.95, 0, ''), +(18760 ,22, -2350.43, 3328.27, -2.10, 0, ''), +(18760 ,23, -2346.76, 3356.27, -2.82, 0, ''), +(18760 ,24, -2340.56, 3370.68, -4.02, 0, ''), +(18760 ,25, -2318.84, 3384.60, -7.61, 0, ''), +(18760 ,26, -2313.99, 3398.61, -10.40, 0, ''), +(18760 ,27, -2320.85, 3414.49, -11.49, 0, ''), +(18760 ,28, -2338.26, 3426.06, -11.46, 0, ''), +(18760 ,29, -2342.67, 3439.44, -11.32, 12000, 'progress4'), +(18760 ,30, -2342.67, 3439.44, -11.32, 7000, 'emote bye'), +(18760 ,31, -2342.67, 3439.44, -11.32, 5000, 'cat form'), +(18760 ,32, -2344.60, 3461.27, -10.44, 0, ''), +(18760 ,33, -2396.81, 3517.17, -3.55, 0, ''), +(18760 ,34, -2439.23, 3523.00, -1.05, 0, ''); + +DELETE FROM script_waypoint WHERE entry = 20415; +INSERT INTO script_waypoint VALUES +(20415 ,0, 2488.77, 2184.89, 104.64, 0, ''), +(20415 ,1, 2478.72, 2184.77, 98.58, 0, ''), +(20415 ,2, 2473.52, 2184.71, 99.00, 0, ''), +(20415 ,3, 2453.15, 2184.96, 97.09,4000, ''), +(20415 ,4, 2424.18, 2184.15, 94.11, 0, ''), +(20415 ,5, 2413.18, 2184.15, 93.42, 0, ''), +(20415 ,6, 2402.02, 2183.90, 87.59, 0, ''), +(20415 ,7, 2333.31, 2181.63, 90.03,4000, ''), +(20415 ,8, 2308.73, 2184.34, 92.04, 0, ''), +(20415 ,9, 2303.10, 2196.89, 94.94, 0, ''), +(20415 ,10, 2304.58, 2272.23, 96.67, 0, ''), +(20415 ,11, 2297.09, 2271.40, 95.16, 0, ''), +(20415 ,12, 2297.68, 2266.79, 95.07,4000, ''), +(20415 ,13, 2297.67, 2266.76, 95.07,4000, ''); diff --git a/src/bindings/scripts/base/escort_ai.cpp b/src/bindings/scripts/base/escort_ai.cpp index 37c8c31981b..34b4efcbe60 100644 --- a/src/bindings/scripts/base/escort_ai.cpp +++ b/src/bindings/scripts/base/escort_ai.cpp @@ -22,7 +22,7 @@ enum npc_escortAI::npc_escortAI(Creature* pCreature) : ScriptedAI(pCreature), IsBeingEscorted(false), IsOnHold(false), - PlayerGUID(0), + m_uiPlayerGUID(0), MaxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), CanMelee(true), m_uiPlayerCheckTimer(1000), @@ -63,10 +63,10 @@ void npc_escortAI::MoveInLineOfSight(Unit* pWho) void npc_escortAI::JustDied(Unit* pKiller) { - if (!IsBeingEscorted || !PlayerGUID || !m_pQuestForEscort) + if (!IsBeingEscorted || !m_uiPlayerGUID || !m_pQuestForEscort) return; - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { if (Group* pGroup = pPlayer->GetGroup()) { @@ -132,7 +132,7 @@ void npc_escortAI::EnterEvadeMode() bool npc_escortAI::IsPlayerOrGroupInRange() { - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { if (Group* pGroup = pPlayer->GetGroup()) { @@ -216,7 +216,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff) } //Check if player or any member of his group is within range - if (IsBeingEscorted && PlayerGUID && !m_creature->getVictim() && !m_bIsReturning) + if (IsBeingEscorted && m_uiPlayerGUID && !m_creature->getVictim() && !m_bIsReturning) { if (m_uiPlayerCheckTimer < uiDiff) { @@ -404,7 +404,7 @@ void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID, m_bIsActiveAttacker = bIsActiveAttacker; m_bIsRunning = bRun; - PlayerGUID = uiPlayerGUID; + m_uiPlayerGUID = uiPlayerGUID; m_pQuestForEscort = pQuest; m_bCanInstantRespawn = bInstantRespawn; @@ -423,7 +423,7 @@ void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID, //disable npcflags m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - debug_log("TSCR: EscortAI started with %d waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = %d", WaypointList.size(), m_bIsActiveAttacker, m_bIsRunning, PlayerGUID); + debug_log("TSCR: EscortAI started with %d waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = %d", WaypointList.size(), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID); CurrentWP = WaypointList.begin(); diff --git a/src/bindings/scripts/base/escort_ai.h b/src/bindings/scripts/base/escort_ai.h index 243e64d6d21..60e555dcfd4 100644 --- a/src/bindings/scripts/base/escort_ai.h +++ b/src/bindings/scripts/base/escort_ai.h @@ -58,6 +58,11 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI bool IsPlayerOrGroupInRange(); + Player* GetPlayerForEscort() + { + return Unit::GetPlayer(m_uiPlayerGUID); + } + void FillPointMovementListForCreature(); void Start(bool bIsActiveAttacker = true, bool bRun = false, uint64 uiPlayerGUID = 0, const Quest* pQuest = NULL, bool bInstantRespawn = false, bool bCanLoopPath = false); @@ -76,15 +81,15 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI bool GetIsBeingEscorted() { return IsBeingEscorted; }//used in EnterEvadeMode override void SetReturning(bool returning) { m_bIsReturning = returning; }//used in EnterEvadeMode override void SetCanAttack(bool attack) { m_bIsActiveAttacker = attack; } - uint64 GetEventStarterGUID() { return PlayerGUID; } + uint64 GetEventStarterGUID() { return m_uiPlayerGUID; } // EscortAI variables protected: - uint64 PlayerGUID; bool IsBeingEscorted; bool IsOnHold; private: + uint64 m_uiPlayerGUID; uint32 m_uiWPWaitTimer; uint32 m_uiPlayerCheckTimer; float MaxPlayerDistance; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/arathi_highlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/arathi_highlands.cpp index c5325da12d3..e9169ae60f6 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/arathi_highlands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/arathi_highlands.cpp @@ -55,7 +55,10 @@ struct TRINITY_DLL_DECL npc_professor_phizzlethorpeAI : public npc_escortAI void WaypointReached(uint32 uiPointId) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; switch(uiPointId) { diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp index 929fea7f41a..f63baa7a18f 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp @@ -52,7 +52,7 @@ struct TRINITY_DLL_DECL npc_prospector_anvilwardAI : public npc_escortAI // Pure Virtual Functions void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -65,21 +65,14 @@ struct TRINITY_DLL_DECL npc_prospector_anvilwardAI : public npc_escortAI } } - void EnterCombat(Unit* who) { } - void Reset() { - m_creature->setFaction(35); + me->RestoreFaction(); } void JustDied(Unit* killer) { - m_creature->setFaction(35); - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + me->RestoreFaction(); } }; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp index 42122c1f002..849ed2e029a 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp @@ -159,7 +159,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp index 6b661dad5ef..f8ae2bc66ff 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp @@ -67,7 +67,7 @@ struct MANGOS_DLL_DECL npc_00x09hlAI : public npc_escortAI break; case 64: DoScriptText(SAY_OOX_COMPLETE, m_creature); - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_RESQUE_OOX_09, m_creature); break; } @@ -247,7 +247,7 @@ struct TRINITY_DLL_DECL npc_rinjiAI : public npc_escortAI void WaypointReached(uint32 uiPointId) { - Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -283,7 +283,7 @@ struct TRINITY_DLL_DECL npc_rinjiAI : public npc_escortAI { m_uiPostEventTimer = 3000; - if (Unit* pPlayer = Unit::GetUnit(*m_creature, PlayerGUID)) + if (Unit* pPlayer = GetPlayerForEscort()) { switch(m_uiPostEventCount) { diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp index 1a081a49050..96a4dbdc2c4 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp @@ -564,7 +564,7 @@ struct TRINITY_DLL_DECL npc_koltira_deathweaverAI : public npc_escortAI void JustSummoned(Creature* pSummoned) { - if (Unit* pPlayer = Unit::GetUnit(*m_creature, PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { pSummoned->AI()->AttackStart(pPlayer); pSummoned->AddThreat(m_creature, 0.0f); diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/silverpine_forest.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/silverpine_forest.cpp index 07b1979f87f..409d6702d2b 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/silverpine_forest.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/silverpine_forest.cpp @@ -119,7 +119,7 @@ struct TRINITY_DLL_DECL npc_deathstalker_erlandAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -176,37 +176,7 @@ bool QuestAccept_npc_deathstalker_erland(Player* pPlayer, Creature* pCreature, Q CreatureAI* GetAI_npc_deathstalker_erlandAI(Creature* pCreature) { - npc_deathstalker_erlandAI* deathstalker_erlandAI = new npc_deathstalker_erlandAI(pCreature); - - deathstalker_erlandAI->AddWaypoint(0, 1406.32, 1083.10, 52.55); - deathstalker_erlandAI->AddWaypoint(1, 1400.49, 1080.42, 52.50); //first say - deathstalker_erlandAI->AddWaypoint(2, 1388.48, 1083.10, 52.52); - deathstalker_erlandAI->AddWaypoint(3, 1370.16, 1084.02, 52.30); - deathstalker_erlandAI->AddWaypoint(4, 1359.02, 1080.85, 52.46); - deathstalker_erlandAI->AddWaypoint(5, 1341.43, 1087.39, 52.69); - deathstalker_erlandAI->AddWaypoint(6, 1321.93, 1090.51, 50.66); - deathstalker_erlandAI->AddWaypoint(7, 1312.98, 1095.91, 47.49); - deathstalker_erlandAI->AddWaypoint(8, 1301.09, 1102.94, 47.76); - deathstalker_erlandAI->AddWaypoint(9, 1297.73, 1106.35, 50.18); - deathstalker_erlandAI->AddWaypoint(10, 1295.49, 1124.32, 50.49); - deathstalker_erlandAI->AddWaypoint(11, 1294.84, 1137.25, 51.75); - deathstalker_erlandAI->AddWaypoint(12, 1292.89, 1158.99, 52.65); - deathstalker_erlandAI->AddWaypoint(13, 1290.75, 1168.67, 52.56, 1000); //complete quest and say last - deathstalker_erlandAI->AddWaypoint(14, 1287.12, 1203.49, 52.66, 5000); - deathstalker_erlandAI->AddWaypoint(15, 1287.12, 1203.49, 52.66, 4000); - deathstalker_erlandAI->AddWaypoint(16, 1287.12, 1203.49, 52.66, 5000); - deathstalker_erlandAI->AddWaypoint(17, 1287.12, 1203.49, 52.66, 4000); - deathstalker_erlandAI->AddWaypoint(18, 1290.72, 1207.44, 52.69); - deathstalker_erlandAI->AddWaypoint(19, 1297.50, 1207.18, 53.74); - deathstalker_erlandAI->AddWaypoint(20, 1301.32, 1220.90, 53.74); - deathstalker_erlandAI->AddWaypoint(21, 1298.55, 1220.43, 53.74); - deathstalker_erlandAI->AddWaypoint(22, 1297.59, 1211.23, 58.47); - deathstalker_erlandAI->AddWaypoint(23, 1305.01, 1206.10, 58.51); - deathstalker_erlandAI->AddWaypoint(24, 1310.51, 1207.36, 58.51, 5000); - deathstalker_erlandAI->AddWaypoint(25, 1310.51, 1207.36, 58.51, 5000); - deathstalker_erlandAI->AddWaypoint(26, 1310.51, 1207.36, 58.51, 2000); - - return deathstalker_erlandAI; + return new npc_deathstalker_erlandAI(pCreature); } /*###### diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/westfall.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/westfall.cpp index d6cbea99fb5..0799f745a70 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/westfall.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/westfall.cpp @@ -73,7 +73,7 @@ struct TRINITY_DLL_DECL npc_daphne_stilwellAI : public npc_escortAI void WaypointReached(uint32 uiPoint) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -197,7 +197,7 @@ struct TRINITY_DLL_DECL npc_defias_traitorAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp index 4a9d944cb3e..3568c7e555b 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp @@ -70,7 +70,7 @@ struct TRINITY_DLL_DECL npc_tapoke_slim_jahnAI : public npc_escortAI void Aggro(Unit* pWho) { - Unit* pPlayer = Unit::GetUnit(*m_creature, PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (IsBeingEscorted && !m_bFriendSummoned && pPlayer) { @@ -83,7 +83,7 @@ struct TRINITY_DLL_DECL npc_tapoke_slim_jahnAI : public npc_escortAI void JustSummoned(Creature* pSummoned) { - if (Unit* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pSummoned->AI()->AttackStart(pPlayer); } @@ -102,7 +102,7 @@ struct TRINITY_DLL_DECL npc_tapoke_slim_jahnAI : public npc_escortAI { if (m_creature->GetHealth()*100 < m_creature->GetMaxHealth()*20) { - if (Unit* pPlayer = Unit::GetUnit(*m_creature, PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { if (pPlayer->GetTypeId() == TYPEID_PLAYER) CAST_PLR(pPlayer)->GroupEventHappens(QUEST_MISSING_DIPLO_PT11, m_creature); diff --git a/src/bindings/scripts/scripts/examples/example_escort.cpp b/src/bindings/scripts/scripts/examples/example_escort.cpp index e603d3ce79c..4fdc1b7e1ad 100644 --- a/src/bindings/scripts/scripts/examples/example_escort.cpp +++ b/src/bindings/scripts/scripts/examples/example_escort.cpp @@ -76,12 +76,12 @@ struct TRINITY_DLL_DECL example_escortAI : public npc_escortAI m_creature->SummonCreature(NPC_FELBOAR, m_creature->GetPositionX()+5.0f, m_creature->GetPositionY()+7.0f, m_creature->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000); break; case 4: - if (Unit* pTmpPlayer = Unit::GetUnit(*m_creature, PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { //pTmpPlayer is the target of the text - DoScriptText(SAY_WP_3, m_creature, pTmpPlayer); + DoScriptText(SAY_WP_3, m_creature, pPlayer); //pTmpPlayer is the source of the text - DoScriptText(SAY_WP_4, pTmpPlayer); + DoScriptText(SAY_WP_4, pPlayer); } break; } @@ -91,8 +91,8 @@ struct TRINITY_DLL_DECL example_escortAI : public npc_escortAI { if (IsBeingEscorted) { - if (Unit* pTemp = Unit::GetUnit(*m_creature, PlayerGUID)) - DoScriptText(SAY_AGGRO1, m_creature, pTemp); + if (Player* pPlayer = GetPlayerForEscort()) + DoScriptText(SAY_AGGRO1, m_creature, pPlayer); } else DoScriptText(SAY_AGGRO2, m_creature); @@ -108,15 +108,15 @@ struct TRINITY_DLL_DECL example_escortAI : public npc_escortAI { if (IsBeingEscorted) { - if (Unit *pTemp = Unit::GetUnit(*m_creature,PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { // not a likely case, code here for the sake of example if (pKiller == m_creature) { - DoScriptText(SAY_DEATH_1, m_creature, pTemp); + DoScriptText(SAY_DEATH_1, m_creature, pPlayer); } else - DoScriptText(SAY_DEATH_2, m_creature, pTemp); + DoScriptText(SAY_DEATH_2, m_creature, pPlayer); } } else diff --git a/src/bindings/scripts/scripts/kalimdor/ashenvale.cpp b/src/bindings/scripts/scripts/kalimdor/ashenvale.cpp index 88572bf3463..7bb193b98be 100644 --- a/src/bindings/scripts/scripts/kalimdor/ashenvale.cpp +++ b/src/bindings/scripts/scripts/kalimdor/ashenvale.cpp @@ -59,7 +59,7 @@ struct TRINITY_DLL_DECL npc_torekAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -81,8 +81,8 @@ struct TRINITY_DLL_DECL npc_torekAI : public npc_escortAI case 20: DoScriptText(SAY_WIN, m_creature, pPlayer); Completed = true; - if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_TOREK_ASSULT,m_creature); + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_TOREK_ASSULT, m_creature); break; case 21: DoScriptText(SAY_END, m_creature, pPlayer); @@ -160,7 +160,7 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -185,8 +185,8 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI break; case 21:{ - if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_FREEDOM_TO_RUUL,m_creature); + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_FREEDOM_TO_RUUL, m_creature); break; } } diff --git a/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp b/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp index 0e21a4b310d..f881715ca64 100644 --- a/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp +++ b/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp @@ -338,7 +338,7 @@ struct TRINITY_DLL_DECL npc_magwinAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp index 7c0290fe565..d8471deb96b 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp @@ -329,14 +329,11 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI case 106: { - if (!PlayerGUID) - break; - //trigger taretha to run down outside - if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA)) + if (Creature* Taretha = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TARETHA))) { - if (Creature* Taretha = (Unit::GetCreature(*m_creature, TarethaGUID))) - CAST_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, PlayerGUID); + if (Player* pPlayer = GetPlayerForEscort()) + CAST_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, pPlayer->GetGUID()); } //kill credit Creature for quest diff --git a/src/bindings/scripts/scripts/kalimdor/darkshore.cpp b/src/bindings/scripts/scripts/kalimdor/darkshore.cpp index 6c2520cd8b5..8ff16a53832 100644 --- a/src/bindings/scripts/scripts/kalimdor/darkshore.cpp +++ b/src/bindings/scripts/scripts/kalimdor/darkshore.cpp @@ -62,7 +62,7 @@ struct TRINITY_DLL_DECL npc_prospector_remtravelAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -136,11 +136,6 @@ struct TRINITY_DLL_DECL npc_prospector_remtravelAI : public npc_escortAI //unsure if it should be any //pSummoned->AI()->AttackStart(m_creature); } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; CreatureAI* GetAI_npc_prospector_remtravel(Creature* pCreature) diff --git a/src/bindings/scripts/scripts/kalimdor/feralas.cpp b/src/bindings/scripts/scripts/kalimdor/feralas.cpp index 08c00a9a5a7..99090b06039 100644 --- a/src/bindings/scripts/scripts/kalimdor/feralas.cpp +++ b/src/bindings/scripts/scripts/kalimdor/feralas.cpp @@ -111,7 +111,7 @@ struct TRINITY_DLL_DECL npc_oox22feAI : public npc_escortAI case 37: DoScriptText(SAY_END,m_creature); // Award quest credit - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { pPlayer->GroupEventHappens(QUEST_RESCUE_OOX22FE, m_creature); } diff --git a/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/razorfen_kraul.cpp b/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/razorfen_kraul.cpp index 5c51e64f5a2..b24a51cb3cb 100644 --- a/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/razorfen_kraul.cpp +++ b/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/razorfen_kraul.cpp @@ -51,7 +51,7 @@ struct TRINITY_DLL_DECL npc_willixAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -114,16 +114,8 @@ struct TRINITY_DLL_DECL npc_willixAI : public npc_escortAI void JustDied(Unit* killer) { - if (PlayerGUID) - { - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) - CAST_PLR(pPlayer)->FailQuest(QUEST_WILLIX_THE_IMPORTER); - } - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + if (Player* pPlayer = GetPlayerForEscort()) + CAST_PLR(pPlayer)->FailQuest(QUEST_WILLIX_THE_IMPORTER); } }; @@ -181,57 +173,7 @@ CreatureAI* GetAI_npc_deaths_head_ward_keeper(Creature* pCreature) CreatureAI* GetAI_npc_willix(Creature* pCreature) { - npc_willixAI* thisAI = new npc_willixAI(pCreature); - - thisAI->AddWaypoint(0, 2194.38, 1791.65, 65.48, 5000); - thisAI->AddWaypoint(1, 2188.56, 1805.87, 64.45); - thisAI->AddWaypoint(2, 2187, 1843.49, 59.33); - thisAI->AddWaypoint(3, 2163.27, 1851.67, 56.73, 5000); - thisAI->AddWaypoint(4, 2137.66, 1843.98, 48.08, 5000); - thisAI->AddWaypoint(5, 2140.22, 1845.02, 48.32); - thisAI->AddWaypoint(6, 2131.5, 1804.29, 46.85); - thisAI->AddWaypoint(7, 2096.18, 1789.03, 51.13); - thisAI->AddWaypoint(8, 2074.46, 1780.09, 55.64, 3000); - thisAI->AddWaypoint(9, 2055.12, 1768.67, 58.46, 5000); - thisAI->AddWaypoint(10, 2037.83, 1748.62, 60.27); - thisAI->AddWaypoint(11, 2037.51, 1728.94, 60.85); - thisAI->AddWaypoint(12, 2044.7, 1711.71, 59.71); - thisAI->AddWaypoint(13, 2067.66, 1701.84, 57.77, 3000); - thisAI->AddWaypoint(14, 2078.91, 1704.54, 56.77, 3000); - thisAI->AddWaypoint(15, 2097.65, 1715.24, 54.74); - thisAI->AddWaypoint(16, 2106.44, 1720.98, 54.41); - thisAI->AddWaypoint(17, 2123.96, 1732.56, 52.27); - thisAI->AddWaypoint(18, 2153.82, 1728.73, 51.92); - thisAI->AddWaypoint(19, 2163.49, 1706.33, 54.42); - thisAI->AddWaypoint(20, 2158.75, 1695.98, 55.70); - thisAI->AddWaypoint(21, 2142.6, 1680.72, 58.24); - thisAI->AddWaypoint(22, 2118.31, 1671.54, 59.21); - thisAI->AddWaypoint(23, 2086.02, 1672.04, 61.24); - thisAI->AddWaypoint(24, 2068.81, 1658.93, 61.24); - thisAI->AddWaypoint(25, 2062.82, 1633.31, 64.35, 3000); - thisAI->AddWaypoint(26, 2063.05, 1589.16, 63.26); - thisAI->AddWaypoint(27, 2063.67, 1577.22, 65.89); - thisAI->AddWaypoint(28, 2057.94, 1560.68, 68.40); - thisAI->AddWaypoint(29, 2052.56, 1548.05, 73.35); - thisAI->AddWaypoint(30, 2045.22, 1543.4, 76.65); - thisAI->AddWaypoint(31, 2034.35, 1543.01, 79.70); - thisAI->AddWaypoint(32, 2029.95, 1542.94, 80.79); - thisAI->AddWaypoint(33, 2021.34, 1538.67, 80.8); - thisAI->AddWaypoint(34, 2012.45, 1549.48, 79.93); - thisAI->AddWaypoint(35, 2008.05, 1554.92, 80.44); - thisAI->AddWaypoint(36, 2006.54, 1562.72, 81.11); - thisAI->AddWaypoint(37, 2003.8, 1576.43, 81.57); - thisAI->AddWaypoint(38, 2000.57, 1590.06, 80.62); - thisAI->AddWaypoint(39, 1998.96, 1596.87, 80.22); - thisAI->AddWaypoint(40, 1991.19, 1600.82, 79.39); - thisAI->AddWaypoint(41, 1980.71, 1601.44, 79.77, 3000); - thisAI->AddWaypoint(42, 1967.22, 1600.18, 80.62, 3000); - thisAI->AddWaypoint(43, 1956.43, 1596.97, 81.75, 3000); - thisAI->AddWaypoint(44, 1954.87, 1592.02, 82.18); - thisAI->AddWaypoint(45, 1948.35, 1571.35, 80.96, 30000); - thisAI->AddWaypoint(46, 1947.02, 1566.42, 81.80, 30000); - - return thisAI; + return new npc_willixAI(pCreature); } void AddSC_razorfen_kraul() diff --git a/src/bindings/scripts/scripts/kalimdor/stonetalon_mountains.cpp b/src/bindings/scripts/scripts/kalimdor/stonetalon_mountains.cpp index 2b927af4852..272cef3d33b 100644 --- a/src/bindings/scripts/scripts/kalimdor/stonetalon_mountains.cpp +++ b/src/bindings/scripts/scripts/kalimdor/stonetalon_mountains.cpp @@ -101,7 +101,7 @@ struct TRINITY_DLL_DECL npc_kaya_flathoofAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -116,8 +116,8 @@ struct TRINITY_DLL_DECL npc_kaya_flathoofAI : public npc_escortAI break; case 18: m_creature->SetInFront(pPlayer); DoScriptText(SAY_END, m_creature, pPlayer); - if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_PROTECT_KAYA, m_creature); + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_PROTECT_KAYA, m_creature); break; } } diff --git a/src/bindings/scripts/scripts/kalimdor/tanaris.cpp b/src/bindings/scripts/scripts/kalimdor/tanaris.cpp index 9745fce9966..813e178b6f0 100644 --- a/src/bindings/scripts/scripts/kalimdor/tanaris.cpp +++ b/src/bindings/scripts/scripts/kalimdor/tanaris.cpp @@ -153,7 +153,7 @@ struct TRINITY_DLL_DECL npc_custodian_of_timeAI : public npc_escortAI void WaypointReached(uint32 i) { - Player *pPlayer = Unit::GetPlayer(PlayerGUID); + Player *pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -357,7 +357,7 @@ struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -424,97 +424,7 @@ bool QuestAccept_npc_OOX17(Player* pPlayer, Creature* pCreature, Quest const* qu CreatureAI* GetAI_npc_OOX17(Creature* pCreature) { - npc_OOX17AI* OOX17AI = new npc_OOX17AI(pCreature); - - OOX17AI->AddWaypoint(0, -8843.73, -4374.44, 43.71); - OOX17AI->AddWaypoint(1, -8834.68, -4373.88, 45.71); - OOX17AI->AddWaypoint(2, -8832.93, -4373.85, 45.67); - OOX17AI->AddWaypoint(3, -8829.21, -4373.72, 44.14); - OOX17AI->AddWaypoint(4, -8825.10, -4373.56, 41.44); - OOX17AI->AddWaypoint(5, -8818.88, -4372.75, 36.43); - OOX17AI->AddWaypoint(6, -8803.37, -4369.68, 30.06); - OOX17AI->AddWaypoint(7, -8786.68, -4366.18, 23.91); - OOX17AI->AddWaypoint(8, -8764.97, -4366.94, 25.23); - OOX17AI->AddWaypoint(9, -8745.49, -4363.16, 22.80); - OOX17AI->AddWaypoint(10, -8724.13, -4353.55, 20.72); - OOX17AI->AddWaypoint(11, -8706.77, -4346.14, 16.12); - OOX17AI->AddWaypoint(12, -8688.27, -4372.85, 13.64); - OOX17AI->AddWaypoint(13, -8668.76, -4380.38, 11.69); - OOX17AI->AddWaypoint(14, -8645.19, -4388.62, 12.56); - OOX17AI->AddWaypoint(15, -8614.73, -4398.60, 9.86); - OOX17AI->AddWaypoint(16, -8560.33, -4411.27, 13.17); - OOX17AI->AddWaypoint(17, -8536.45, -4416.49, 11.84); - OOX17AI->AddWaypoint(18, -8503.48, -4423.70, 13.59); - OOX17AI->AddWaypoint(19, -8471.91, -4430.60, 9.56); - OOX17AI->AddWaypoint(20, -8441.36, -4435.31, 9.40); - OOX17AI->AddWaypoint(21, -8403.41, -4441.16, 11.83); - OOX17AI->AddWaypoint(22, -8371.24, -4446.13, 9.47); - OOX17AI->AddWaypoint(23, -8353.96, -4448.79, 10.10); //Scorpid - OOX17AI->AddWaypoint(24, -8336.40, -4446.39, 8.98); - OOX17AI->AddWaypoint(25, -8303.78, -4441.96, 11.89); - OOX17AI->AddWaypoint(26, -8272.20, -4433.31, 9.60); - OOX17AI->AddWaypoint(27, -8224.76, -4419.39, 13.03); - OOX17AI->AddWaypoint(28, -8193.31, -4406.04, 10.17); - OOX17AI->AddWaypoint(29, -8155.65, -4397.74, 8.99); - OOX17AI->AddWaypoint(30, -8129.25, -4394.57, 10.92); - OOX17AI->AddWaypoint(31, -8104.86, -4399.03, 8.93); - OOX17AI->AddWaypoint(32, -8063.15, -4423.40, 10.07); - OOX17AI->AddWaypoint(33, -8032.15, -4443.47, 9.97); - OOX17AI->AddWaypoint(34, -8015.39, -4454.33, 9.39); - OOX17AI->AddWaypoint(35, -7981.64, -4482.44, 10.32); - OOX17AI->AddWaypoint(36, -7958.83, -4503.98, 9.69); - OOX17AI->AddWaypoint(37, -7932.45, -4528.91, 10.08); - OOX17AI->AddWaypoint(38, -7904.09, -4566.67, 12.59); - OOX17AI->AddWaypoint(39, -7883.33, -4593.91, 12.15); - OOX17AI->AddWaypoint(40, -7862.83, -4624.53, 10.21); - OOX17AI->AddWaypoint(41, -7840.79, -4654.26, 9.45); - OOX17AI->AddWaypoint(42, -7826.17, -4673.99, 10.61); - OOX17AI->AddWaypoint(43, -7807.86, -4698.69, 11.24); - OOX17AI->AddWaypoint(44, -7793.88, -4717.55, 10.48); - OOX17AI->AddWaypoint(45, -7778.68, -4738.05, 8.89); - OOX17AI->AddWaypoint(46, -7746.42, -4780.39, 9.84); - OOX17AI->AddWaypoint(47, -7724.11, -4772.75, 10.28); - OOX17AI->AddWaypoint(48, -7697.98, -4763.80, 9.52); - OOX17AI->AddWaypoint(49, -7665.33, -4752.62, 10.56); - OOX17AI->AddWaypoint(50, -7641.47, -4750.33, 8.94); - OOX17AI->AddWaypoint(51, -7620.08, -4753.96, 8.93); - OOX17AI->AddWaypoint(52, -7603.15, -4757.53, 9.06); - OOX17AI->AddWaypoint(53, -7579.43, -4767.07, 8.93); - OOX17AI->AddWaypoint(54, -7558.51, -4779.01, 9.64); - OOX17AI->AddWaypoint(55, -7536.40, -4789.32, 8.92); - OOX17AI->AddWaypoint(56, -7512.07, -4793.50, 9.35); //Wastewander - OOX17AI->AddWaypoint(57, -7490.79, -4788.80, 10.53); - OOX17AI->AddWaypoint(58, -7469.10, -4785.11, 10.42); - OOX17AI->AddWaypoint(59, -7453.18, -4782.41, 9.15); - OOX17AI->AddWaypoint(60, -7426.27, -4777.83, 9.54); - OOX17AI->AddWaypoint(61, -7393.84, -4770.19, 12.57); - OOX17AI->AddWaypoint(62, -7367.25, -4764.17, 11.92); - OOX17AI->AddWaypoint(63, -7341.00, -4752.11, 10.17); - OOX17AI->AddWaypoint(64, -7321.62, -4744.97, 11.58); - OOX17AI->AddWaypoint(65, -7302.35, -4744.35, 11.97); - OOX17AI->AddWaypoint(66, -7281.00, -4743.66, 11.21); - OOX17AI->AddWaypoint(67, -7258.33, -4742.93, 9.64); - OOX17AI->AddWaypoint(68, -7236.70, -4742.24, 10.16); - OOX17AI->AddWaypoint(69, -7217.52, -4743.87, 10.79); - OOX17AI->AddWaypoint(70, -7201.86, -4746.32, 9.58); - OOX17AI->AddWaypoint(71, -7182.01, -4749.41, 9.09); - OOX17AI->AddWaypoint(72, -7159.61, -4752.90, 9.52); - OOX17AI->AddWaypoint(73, -7139.58, -4756.02, 9.53); - OOX17AI->AddWaypoint(74, -7122.60, -4754.91, 9.66); - OOX17AI->AddWaypoint(75, -7101.06, -4753.87, 8.92); - OOX17AI->AddWaypoint(76, -7082.79, -4752.99, 9.97); - OOX17AI->AddWaypoint(77, -7061.81, -4751.98, 9.26); - OOX17AI->AddWaypoint(78, -7035.12, -4754.39, 9.19); - OOX17AI->AddWaypoint(79, -7013.90, -4758.64, 10.28); - OOX17AI->AddWaypoint(80, -7001.71, -4769.73, 10.59); - OOX17AI->AddWaypoint(81, -6984.95, -4788.61, 9.30); - OOX17AI->AddWaypoint(82, -6970.41, -4788.77, 9.42); - OOX17AI->AddWaypoint(83, -6957.16, -4788.92, 6.26); - OOX17AI->AddWaypoint(84, -6951.29, -4802.73, 4.45); - OOX17AI->AddWaypoint(85, -6944.81, -4816.58, 1.60); - OOX17AI->AddWaypoint(86, -6942.06, -4839.40, 0.66,5000); - - return OOX17AI; + return new npc_OOX17AI(pCreature); } /*#### @@ -631,8 +541,7 @@ struct MANGOS_DLL_DECL npc_toogaAI : public ScriptedAI void JustRespawned() { - if (m_creature->getFaction() != m_creature->GetCreatureInfo()->faction_A) - m_creature->setFaction(m_creature->GetCreatureInfo()->faction_A); + me->RestoreFaction(); m_creature->SetUInt32Value(UNIT_NPC_FLAGS, m_creature->GetCreatureInfo()->npcflag); @@ -684,7 +593,10 @@ struct MANGOS_DLL_DECL npc_toogaAI : public ScriptedAI void JustDied(Unit* pKiller) { if (Player* pPlayer = Unit::GetPlayer(m_uiPlayerGUID)) - pPlayer->FailQuest(QUEST_TOOGA); + { + if (pPlayer->GetQuestStatus(QUEST_TOOGA) == QUEST_STATUS_INCOMPLETE) + pPlayer->FailQuest(QUEST_TOOGA); + } m_uiPlayerGUID = 0; m_creature->GetMotionMaster()->MovementExpired(); diff --git a/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp b/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp index d17d0b06cd1..d957ba26ae7 100644 --- a/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp +++ b/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp @@ -94,7 +94,7 @@ struct TRINITY_DLL_DECL npc_giltharesAI : public npc_escortAI void WaypointReached(uint32 uiPointId) { - Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -507,75 +507,143 @@ CreatureAI* GetAI_npc_twiggy_flathead(Creature* pCreature) enum { - SAY_PROGRESS_1 = -1000272, - SAY_PROGRESS_2 = -1000273, - SAY_PROGRESS_3 = -1000274, - - SAY_MERCENARY_4 = -1000275, - - SAY_PROGRESS_5 = -1000276, - SAY_PROGRESS_6 = -1000277, - SAY_PROGRESS_7 = -1000278, - SAY_PROGRESS_8 = -1000279, + SAY_START = -1000272, + SAY_STARTUP1 = -1000273, + SAY_STARTUP2 = -1000274, + SAY_MERCENARY = -1000275, + SAY_PROGRESS_1 = -1000276, + SAY_PROGRESS_2 = -1000277, + SAY_PROGRESS_3 = -1000278, + SAY_END = -1000279, QUEST_ESCAPE = 863, FACTION_RATCHET = 637, - NPC_PILOT = 3451, - MOB_MERCENARY = 3282, + NPC_PILOT_WIZZ = 3451, + NPC_MERCENARY = 3282, }; struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI { - npc_wizzlecrank_shredderAI(Creature* c) : npc_escortAI(c) { } + npc_wizzlecrank_shredderAI(Creature* pCreature) : npc_escortAI(pCreature) + { + m_bIsPostEvent = false; + m_uiPostEventTimer = 1000; + m_uiPostEventCount = 0; + } - bool Completed; + bool m_bIsPostEvent; + uint32 m_uiPostEventTimer; + uint32 m_uiPostEventCount; - void WaypointReached(uint32 i) + void Reset() { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + if (!IsBeingEscorted) + { + if (m_creature->getStandState() == UNIT_STAND_STATE_DEAD) + m_creature->SetStandState(UNIT_STAND_STATE_STAND); + + m_bIsPostEvent = false; + m_uiPostEventTimer = 1000; + m_uiPostEventCount = 0; + } + } + + void WaypointReached(uint32 uiPointId) + { + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; - switch(i) + switch(uiPointId) { - case 0: DoScriptText(SAY_PROGRESS_1, m_creature); - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; - case 1: DoScriptText(SAY_PROGRESS_2, m_creature); break; - case 10: DoScriptText(SAY_PROGRESS_3, m_creature, pPlayer); - m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; - case 20:{ - Unit* Mercenary = m_creature->FindNearestCreature(MOB_MERCENARY, 99); - if (Mercenary) + case 0: + DoScriptText(SAY_STARTUP1, m_creature); + break; + case 9: + SetRun(false); + break; + case 17: + if (Creature* pTemp = m_creature->SummonCreature(NPC_MERCENARY, 1128.489f, -3037.611f, 92.701f, 1.472f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000)) { - DoScriptText(SAY_MERCENARY_4, Mercenary); - CAST_CRE(Mercenary)->AI()->AttackStart(m_creature); - AttackStart(Mercenary); + DoScriptText(SAY_MERCENARY, pTemp); + m_creature->SummonCreature(NPC_MERCENARY, 1160.172f, -2980.168f, 97.313f, 3.690f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); } - }break; - case 21: DoScriptText(SAY_PROGRESS_5, m_creature); - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; - case 28: DoScriptText(SAY_PROGRESS_6, m_creature); break; - case 29: DoScriptText(SAY_PROGRESS_7, m_creature); break; - case 30: DoScriptText(SAY_PROGRESS_8, m_creature); break; - case 31: m_creature->SummonCreature(NPC_PILOT, 1088.77, -2985.39, 91.84, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 300000); - m_creature->setDeathState(JUST_DIED); - Completed = true; - pPlayer->GroupEventHappens(QUEST_ESCAPE, m_creature); + break; + case 24: + m_bIsPostEvent = true; break; } } - void Reset() + void WaypointStart(uint32 uiPointId) { - m_creature->setDeathState(ALIVE); - Completed = false; - if (!IsBeingEscorted) + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(uiPointId) { - if (m_creature->getStandState() == UNIT_STAND_STATE_DEAD) - m_creature->SetStandState(UNIT_STAND_STATE_STAND); + case 9: + DoScriptText(SAY_STARTUP2, m_creature, pPlayer); + break; + case 18: + DoScriptText(SAY_PROGRESS_1, m_creature, pPlayer); + SetRun(); + break; } } + + void JustSummoned(Creature* pSummoned) + { + if (pSummoned->GetEntry() == NPC_PILOT_WIZZ) + m_creature->SetStandState(UNIT_STAND_STATE_DEAD); + + if (pSummoned->GetEntry() == NPC_MERCENARY) + pSummoned->AI()->AttackStart(m_creature); + } + + void UpdateEscortAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + { + if (m_bIsPostEvent) + { + if (m_uiPostEventTimer < uiDiff) + { + switch(m_uiPostEventCount) + { + case 0: + DoScriptText(SAY_PROGRESS_2, m_creature); + break; + case 1: + DoScriptText(SAY_PROGRESS_3, m_creature); + break; + case 2: + DoScriptText(SAY_END, m_creature); + break; + case 3: + if (Player* pPlayer = GetPlayerForEscort()) + { + pPlayer->GroupEventHappens(QUEST_ESCAPE, m_creature); + m_creature->SummonCreature(NPC_PILOT_WIZZ, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 180000); + } + break; + } + + ++m_uiPostEventCount; + m_uiPostEventTimer = 5000; + } + else + m_uiPostEventTimer -= uiDiff; + } + + return; + } + + DoMeleeAttackIfReady(); + } }; bool QuestAccept_npc_wizzlecrank_shredder(Player* pPlayer, Creature* pCreature, Quest const* quest) @@ -591,42 +659,7 @@ bool QuestAccept_npc_wizzlecrank_shredder(Player* pPlayer, Creature* pCreature, CreatureAI* GetAI_npc_wizzlecrank_shredderAI(Creature* pCreature) { - npc_wizzlecrank_shredderAI* thisAI = new npc_wizzlecrank_shredderAI(pCreature); - - thisAI->AddWaypoint(0, 1109.15, -3104.11, 82.41, 6000); - thisAI->AddWaypoint(1, 1105.39, -3102.86, 82.74, 2000); - thisAI->AddWaypoint(2, 1104.97, -3108.52, 83.10, 1000); - thisAI->AddWaypoint(3, 1110.01, -3110.48, 82.81, 1000); - thisAI->AddWaypoint(4, 1111.72, -3103.03, 82.21, 1000); - thisAI->AddWaypoint(5, 1106.98, -3099.44, 82.18, 1000); - thisAI->AddWaypoint(6, 1103.74, -3103.29, 83.05, 1000); - thisAI->AddWaypoint(7, 1112.55, -3106.56, 82.31, 1000); - thisAI->AddWaypoint(8, 1108.12, -3111.04, 82.99, 1000); - thisAI->AddWaypoint(9, 1109.32, -3100.39, 82.08, 1000); - thisAI->AddWaypoint(10, 1109.32, -3100.39, 82.08, 6000); - thisAI->AddWaypoint(11, 1098.92, -3095.14, 82.97); - thisAI->AddWaypoint(12, 1100.94, -3082.60, 82.83); - thisAI->AddWaypoint(13, 1101.12, -3068.83, 82.53); - thisAI->AddWaypoint(14, 1096.97, -3051.99, 82.50); - thisAI->AddWaypoint(15, 1094.06, -3036.79, 82.70); - thisAI->AddWaypoint(16, 1098.22, -3027.84, 83.79); - thisAI->AddWaypoint(17, 1109.51, -3015.92, 85.73); - thisAI->AddWaypoint(18, 1119.87, -3007.21, 87.08); - thisAI->AddWaypoint(19, 1130.23, -3002.49, 91.27, 5000); - thisAI->AddWaypoint(20, 1130.23, -3002.49, 91.27, 3000); - thisAI->AddWaypoint(21, 1130.23, -3002.49, 91.27, 4000); - thisAI->AddWaypoint(22, 1129.73, -2985.89, 92.46); - thisAI->AddWaypoint(23, 1124.10, -2983.29, 92.81); - thisAI->AddWaypoint(24, 1111.74, -2992.38, 91.59); - thisAI->AddWaypoint(25, 1111.06, -2976.54, 91.81); - thisAI->AddWaypoint(26, 1099.91, -2991.17, 91.67); - thisAI->AddWaypoint(27, 1096.32, -2981.55, 91.73); - thisAI->AddWaypoint(28, 1091.28, -2985.82, 91.74, 4000); - thisAI->AddWaypoint(29, 1091.28, -2985.82, 91.74, 3000); - thisAI->AddWaypoint(30, 1091.28, -2985.82, 91.74, 7000); - thisAI->AddWaypoint(31, 1091.28, -2985.82, 91.74, 3000); - - return thisAI; + return new npc_wizzlecrank_shredderAI(pCreature); } void AddSC_the_barrens() diff --git a/src/bindings/scripts/scripts/kalimdor/thousand_needles.cpp b/src/bindings/scripts/scripts/kalimdor/thousand_needles.cpp index be0c2db5aa9..24e6a21e743 100644 --- a/src/bindings/scripts/scripts/kalimdor/thousand_needles.cpp +++ b/src/bindings/scripts/scripts/kalimdor/thousand_needles.cpp @@ -60,7 +60,7 @@ struct TRINITY_DLL_DECL npc_kanatiAI : public npc_escortAI DoSpawnGalak(); break; case 1: - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_PROTECT_KANATI, m_creature); break; } @@ -149,7 +149,7 @@ struct TRINITY_DLL_DECL npc_lakota_windsongAI : public npc_escortAI DoSpawnBandits(ID_AMBUSH_3); break; case 45: - if (Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_FREE_AT_LAST, m_creature); break; } @@ -222,7 +222,7 @@ struct TRINITY_DLL_DECL npc_paoka_swiftmountainAI : public npc_escortAI DoScriptText(SAY_COMPLETE, m_creature); break; case 27: - if (Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_HOMEWARD, m_creature); break; } diff --git a/src/bindings/scripts/scripts/kalimdor/ungoro_crater.cpp b/src/bindings/scripts/scripts/kalimdor/ungoro_crater.cpp index 323faf67814..81f122d61db 100644 --- a/src/bindings/scripts/scripts/kalimdor/ungoro_crater.cpp +++ b/src/bindings/scripts/scripts/kalimdor/ungoro_crater.cpp @@ -51,7 +51,7 @@ struct TRINITY_DLL_DECL npc_ameAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -76,21 +76,18 @@ struct TRINITY_DLL_DECL npc_ameAI : public npc_escortAI break; case 55: DoScriptText(SAY_FINISH, m_creature, pPlayer); - if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_CHASING_AME,m_creature); + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_CHASING_AME,m_creature); break; } - } + } void Reset() { DEMORALIZINGSHOUT_Timer = 5000; } - void EnterCombat(Unit* who) - {} - void JustSummoned(Creature* summoned) { summoned->AI()->AttackStart(m_creature); @@ -98,11 +95,8 @@ struct TRINITY_DLL_DECL npc_ameAI : public npc_escortAI void JustDied(Unit* killer) { - if (PlayerGUID) - { - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) - CAST_PLR(pPlayer)->FailQuest(QUEST_CHASING_AME); - } + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->FailQuest(QUEST_CHASING_AME); } void UpdateAI(const uint32 diff) @@ -135,66 +129,7 @@ bool QuestAccept_npc_ame(Player* pPlayer, Creature* pCreature, Quest const* ques CreatureAI* GetAI_npc_ame(Creature* pCreature) { - npc_ameAI* thisAI = new npc_ameAI(pCreature); - - thisAI->AddWaypoint(1, -6380.38, -1965.14, -258.292, 5000); - thisAI->AddWaypoint(2, -6383.06, -1962.9, -258.936); - thisAI->AddWaypoint(3, -6391.09, -1956.13, -260.291); - thisAI->AddWaypoint(4, -6395.29, -1933.58, -262.949); - thisAI->AddWaypoint(5, -6396.58, -1919.93, -263.838); - thisAI->AddWaypoint(6, -6389.01, -1912.64, -260.689); - thisAI->AddWaypoint(7, -6369.19, -1892.87, -255.924); - thisAI->AddWaypoint(8, -6373.77, -1879.36, -259.268); - thisAI->AddWaypoint(9, -6377.55, -1869.56, -260.503); - thisAI->AddWaypoint(10, -6376.58, -1860.79, -260.026); - thisAI->AddWaypoint(11, -6373.13, -1847.22, -259.249); - thisAI->AddWaypoint(12, -6370.54, -1837.04, -260.007); - thisAI->AddWaypoint(13, -6372.52, -1829.16, -260.071); - thisAI->AddWaypoint(14, -6377.13, -1815.94, -262.632); - thisAI->AddWaypoint(15, -6380.27, -1806.95, -265.53); - thisAI->AddWaypoint(16, -6386.04, -1790.43, -268.546); - thisAI->AddWaypoint(17, -6386.72, -1776.29, -269.851); - thisAI->AddWaypoint(18, -6385.92, -1762.31, -271.494); - thisAI->AddWaypoint(19, -6384.69, -1744.86, -272.196); - thisAI->AddWaypoint(20, -6383.8, -1732.66, -272.222); - thisAI->AddWaypoint(21, -6382.66, -1716.96, -272.235); - thisAI->AddWaypoint(22, -6381.5, -1703.01, -272.964); - thisAI->AddWaypoint(23, -6379.96, -1685.58, -272.842); - thisAI->AddWaypoint(24, -6379.34, -1678.61, -272.34); - thisAI->AddWaypoint(25, -6364.45, -1636.27, -271.065); - thisAI->AddWaypoint(26, -6371.85, -1626.36, -272.188); - thisAI->AddWaypoint(27, -6383.5, -1629.01, -272.206); - thisAI->AddWaypoint(28, -6388.09, -1635.37, -272.105, 5000); - thisAI->AddWaypoint(29, -6375.42, -1637.33, -272.193); - thisAI->AddWaypoint(30, -6365.46, -1617.25, -272.141); - thisAI->AddWaypoint(31, -6353.79, -1603.48, -271.932); - thisAI->AddWaypoint(32, -6340.24, -1592.41, -269.435); - thisAI->AddWaypoint(33, -6329.45, -1566.89, -269.895); - thisAI->AddWaypoint(34, -6312.2, -1499.06, -269.507); - thisAI->AddWaypoint(35, -6304.55, -1468.5, -269.431); - thisAI->AddWaypoint(36, -6310.36, -1440.94, -268.427); - thisAI->AddWaypoint(37, -6321, -1418.91, -266.525); - thisAI->AddWaypoint(38, -6358.76, -1389.97, -267.522); - thisAI->AddWaypoint(39, -6378.65, -1375.67, -271.749); - thisAI->AddWaypoint(40, -6387.22, -1360.95, -272.109); - thisAI->AddWaypoint(41, -6406.95, -1323.87, -271.586); - thisAI->AddWaypoint(42, -6405, -1311.92, -271.906); - thisAI->AddWaypoint(43, -6395.56, -1303.62, -271.902); - thisAI->AddWaypoint(44, -6375.97, -1296.08, -271.865); - thisAI->AddWaypoint(45, -6364.39, -1281.23, -269.012); - thisAI->AddWaypoint(46, -6353.71, -1263.19, -267.95); - thisAI->AddWaypoint(47, -6340.09, -1248.65, -267.441); - thisAI->AddWaypoint(48, -6338.21, -1237.11, -267.844); - thisAI->AddWaypoint(49, -6336.6, -1219.69, -269.196); - thisAI->AddWaypoint(50, -6334.44, -1202.33, -271.527); - thisAI->AddWaypoint(51, -6329.56, -1189.82, -270.947); - thisAI->AddWaypoint(52, -6324.66, -1179.46, -270.103); - thisAI->AddWaypoint(53, -6315.08, -1176.74, -269.735); - thisAI->AddWaypoint(54, -6308.49, -1179.12, -269.57); - thisAI->AddWaypoint(55, -6302.43, -1181.32, -269.328, 5000); - thisAI->AddWaypoint(56, -6298.87, -1185.79, -269.278); - - return thisAI; + return new npc_ameAI(pCreature); } void AddSC_ungoro_crater() diff --git a/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp b/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp index bb97fb12d18..41454f330f1 100644 --- a/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp +++ b/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp @@ -64,7 +64,7 @@ struct TRINITY_DLL_DECL npc_injured_rainspeaker_oracleAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -90,7 +90,7 @@ struct TRINITY_DLL_DECL npc_injured_rainspeaker_oracleAI : public npc_escortAI m_creature->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING); break; case 28: - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_FORTUNATE_MISUNDERSTANDINGS, m_creature); // me->RestoreFaction(); DoScriptText(SAY_END_IRO,m_creature); @@ -104,17 +104,12 @@ struct TRINITY_DLL_DECL npc_injured_rainspeaker_oracleAI : public npc_escortAI if (!IsBeingEscorted) return; - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { if (pPlayer->GetQuestStatus(QUEST_FORTUNATE_MISUNDERSTANDINGS) != QUEST_STATUS_COMPLETE) pPlayer->FailQuest(QUEST_FORTUNATE_MISUNDERSTANDINGS); } } - - void UpdateAI(Player* pPlayer, Creature* pCreature,const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; diff --git a/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp b/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp index 209d11c3509..9e7e6145178 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp @@ -70,8 +70,6 @@ struct TRINITY_DLL_DECL npc_aeranasAI : public ScriptedAI DoScriptText(SAY_SUMMON, m_creature); } - void EnterCombat(Unit *who) {} - void UpdateAI(const uint32 diff) { if (Faction_Timer) @@ -227,9 +225,9 @@ struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer || pPlayer->GetTypeId() != TYPEID_PLAYER) + if (!pPlayer) return; switch (i) diff --git a/src/bindings/scripts/scripts/outland/netherstorm.cpp b/src/bindings/scripts/scripts/outland/netherstorm.cpp index 1e3c4349116..8d1aa2c3b3c 100644 --- a/src/bindings/scripts/scripts/outland/netherstorm.cpp +++ b/src/bindings/scripts/scripts/outland/netherstorm.cpp @@ -803,20 +803,15 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI npc_bessyAI(Creature *c) : npc_escortAI(c) {} - bool Completed; - void JustDied(Unit* killer) { - if (PlayerGUID) - { - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) - CAST_PLR(pPlayer)->FailQuest(Q_ALMABTRIEB); - } + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->FailQuest(Q_ALMABTRIEB); } void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -836,17 +831,12 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI case 12: if (pPlayer) - { - CAST_PLR(pPlayer)->GroupEventHappens(Q_ALMABTRIEB, m_creature); - Completed = true; - } - {Unit* Thadell = me->FindNearestCreature(N_THADELL, 30); - if (Thadell) - DoScriptText(SAY_THADELL_1, m_creature);}break; + pPlayer->GroupEventHappens(Q_ALMABTRIEB, m_creature); + if (Unit* Thadell = me->FindNearestCreature(N_THADELL, 30)) + DoScriptText(SAY_THADELL_1, m_creature); break; case 13: - {Unit* Thadell = me->FindNearestCreature(N_THADELL, 30); - if (Thadell) - DoScriptText(SAY_THADELL_2, m_creature, pPlayer);}break; + if (Unit* Thadell = me->FindNearestCreature(N_THADELL, 30)) + DoScriptText(SAY_THADELL_2, m_creature, pPlayer); break; } } @@ -855,17 +845,9 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI summoned->AI()->AttackStart(m_creature); } - void EnterCombat(Unit* who){} - void Reset() { - Completed = false; - m_creature->setFaction(35); - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + me->RestoreFaction(); } }; @@ -883,24 +865,7 @@ bool QuestAccept_npc_bessy(Player* pPlayer, Creature* pCreature, Quest const* qu CreatureAI* GetAI_npc_bessy(Creature* pCreature) { - npc_bessyAI* bessyAI = new npc_bessyAI(pCreature); - - bessyAI->AddWaypoint(0, 2488.77, 2184.89, 104.64); - bessyAI->AddWaypoint(1, 2478.72, 2184.77, 98.58); - bessyAI->AddWaypoint(2, 2473.52, 2184.71, 99.00); - bessyAI->AddWaypoint(3, 2453.15, 2184.96, 97.09,4000); - bessyAI->AddWaypoint(4, 2424.18, 2184.15, 94.11); - bessyAI->AddWaypoint(5, 2413.18, 2184.15, 93.42); - bessyAI->AddWaypoint(6, 2402.02, 2183.90, 87.59); - bessyAI->AddWaypoint(7, 2333.31, 2181.63, 90.03,4000); - bessyAI->AddWaypoint(8, 2308.73, 2184.34, 92.04); - bessyAI->AddWaypoint(9, 2303.10, 2196.89, 94.94); - bessyAI->AddWaypoint(10, 2304.58, 2272.23, 96.67); - bessyAI->AddWaypoint(11, 2297.09, 2271.40, 95.16); - bessyAI->AddWaypoint(12, 2297.68, 2266.79, 95.07,4000); - bessyAI->AddWaypoint(13, 2297.67, 2266.76, 95.07,4000); - - return bessyAI; + return new npc_bessyAI(pCreature); } /*###### diff --git a/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp b/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp index 998cedf9c1e..5ef2be74bf9 100644 --- a/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp +++ b/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp @@ -83,8 +83,6 @@ struct TRINITY_DLL_DECL mob_mature_netherwing_drakeAI : public ScriptedAI CastTimer = 5000; } - void EnterCombat(Unit* who) { } - void SpellHit(Unit* pCaster, SpellEntry const* pSpell) { if (bCanEat || bIsEating) @@ -205,8 +203,6 @@ struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI m_creature->SetVisibility(VISIBILITY_ON); } - void EnterCombat(Unit* who) { } - void SpellHit(Unit* caster, const SpellEntry* spell) { if (!caster) @@ -325,8 +321,6 @@ struct TRINITY_DLL_DECL mob_dragonmaw_peonAI : public ScriptedAI PoisonTimer = 0; } - void EnterCombat(Unit* who) { } - void SpellHit(Unit* caster, const SpellEntry* spell) { if (!caster) @@ -696,8 +690,6 @@ struct TRINITY_DLL_DECL npc_overlord_morghorAI : public ScriptedAI Event = false; } - void EnterCombat(Unit* who){} - void StartEvent() { m_creature->SetUInt32Value(UNIT_NPC_FLAGS, 0); @@ -891,7 +883,7 @@ struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI void WaypointReached(uint32 uiPointId) { - Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -944,7 +936,7 @@ struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI case 50: DoScriptText(SAY_WIL_END, m_creature, pPlayer); - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_ESCAPE_COILSCAR, m_creature); break; } diff --git a/src/bindings/scripts/scripts/outland/shattrath_city.cpp b/src/bindings/scripts/scripts/outland/shattrath_city.cpp index 5e0904f7661..23d54ce83b6 100644 --- a/src/bindings/scripts/scripts/outland/shattrath_city.cpp +++ b/src/bindings/scripts/scripts/outland/shattrath_city.cpp @@ -61,12 +61,9 @@ struct TRINITY_DLL_DECL npc_raliq_the_drunkAI : public ScriptedAI void Reset() { Uppercut_Timer = 5000; - if (m_creature->getFaction() != m_uiNormFaction) - m_creature->setFaction(m_uiNormFaction); + me->RestoreFaction(); } - void EnterCombat(Unit *who) {} - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) @@ -126,11 +123,9 @@ struct TRINITY_DLL_DECL npc_salsalabimAI : public ScriptedAI void Reset() { MagneticPull_Timer = 15000; - m_creature->setFaction(FACTION_FRIENDLY_SA); + me->RestoreFaction(); } - void EnterCombat(Unit *who) {} - void DamageTaken(Unit *done_by, uint32 &damage) { if (done_by->GetTypeId() == TYPEID_PLAYER) @@ -288,71 +283,60 @@ public: void WaypointReached(uint32 i) { - Unit *pTemp = Unit::GetUnit(*m_creature,PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); - if (!pTemp) + if (!pPlayer) return; switch(i) { - case 0: DoScriptText(SAY1, m_creature, pTemp); break; - case 4: DoScriptText(WHISP1, m_creature, pTemp); break; - case 6: DoScriptText(WHISP2, m_creature, pTemp); break; - case 7: DoScriptText(WHISP3, m_creature, pTemp); break; - case 8: DoScriptText(WHISP4, m_creature, pTemp); break; - case 17: DoScriptText(WHISP5, m_creature, pTemp); break; - case 18: DoScriptText(WHISP6, m_creature, pTemp); break; - case 19: DoScriptText(WHISP7, m_creature, pTemp); break; - case 33: DoScriptText(WHISP8, m_creature, pTemp); break; - case 34: DoScriptText(WHISP9, m_creature, pTemp); break; - case 35: DoScriptText(WHISP10, m_creature, pTemp); break; - case 36: DoScriptText(WHISP11, m_creature, pTemp); break; - case 43: DoScriptText(WHISP12, m_creature, pTemp); break; - case 44: DoScriptText(WHISP13, m_creature, pTemp); break; - case 49: DoScriptText(WHISP14, m_creature, pTemp); break; - case 50: DoScriptText(WHISP15, m_creature, pTemp); break; - case 51: DoScriptText(WHISP16, m_creature, pTemp); break; - case 52: DoScriptText(WHISP17, m_creature, pTemp); break; - case 53: DoScriptText(WHISP18, m_creature, pTemp); break; - case 54: DoScriptText(WHISP19, m_creature, pTemp); break; - case 55: DoScriptText(WHISP20, m_creature, pTemp); break; - case 56: DoScriptText(WHISP21, m_creature, pTemp); - if (PlayerGUID) - { - Player* pPlayer = (Unit::GetPlayer(PlayerGUID)); - if (pPlayer) - pPlayer->GroupEventHappens(10211,m_creature); - } + case 0: DoScriptText(SAY1, m_creature, pPlayer); break; + case 4: DoScriptText(WHISP1, m_creature, pPlayer); break; + case 6: DoScriptText(WHISP2, m_creature, pPlayer); break; + case 7: DoScriptText(WHISP3, m_creature, pPlayer); break; + case 8: DoScriptText(WHISP4, m_creature, pPlayer); break; + case 17: DoScriptText(WHISP5, m_creature, pPlayer); break; + case 18: DoScriptText(WHISP6, m_creature, pPlayer); break; + case 19: DoScriptText(WHISP7, m_creature, pPlayer); break; + case 33: DoScriptText(WHISP8, m_creature, pPlayer); break; + case 34: DoScriptText(WHISP9, m_creature, pPlayer); break; + case 35: DoScriptText(WHISP10, m_creature, pPlayer); break; + case 36: DoScriptText(WHISP11, m_creature, pPlayer); break; + case 43: DoScriptText(WHISP12, m_creature, pPlayer); break; + case 44: DoScriptText(WHISP13, m_creature, pPlayer); break; + case 49: DoScriptText(WHISP14, m_creature, pPlayer); break; + case 50: DoScriptText(WHISP15, m_creature, pPlayer); break; + case 51: DoScriptText(WHISP16, m_creature, pPlayer); break; + case 52: DoScriptText(WHISP17, m_creature, pPlayer); break; + case 53: DoScriptText(WHISP18, m_creature, pPlayer); break; + case 54: DoScriptText(WHISP19, m_creature, pPlayer); break; + case 55: DoScriptText(WHISP20, m_creature, pPlayer); break; + case 56: DoScriptText(WHISP21, m_creature, pPlayer); + if (pPlayer) + pPlayer->GroupEventHappens(10211,m_creature); break; } } - void EnterCombat(Unit* who) {} - - void MoveInLineOfSight(Unit *who) + void MoveInLineOfSight(Unit* pWho) { if (IsBeingEscorted) return; - if (who->GetTypeId() == TYPEID_PLAYER) + if (pWho->GetTypeId() == TYPEID_PLAYER) { - if (CAST_PLR(who)->GetQuestStatus(10211) == QUEST_STATUS_INCOMPLETE) + if (CAST_PLR(pWho)->GetQuestStatus(10211) == QUEST_STATUS_INCOMPLETE) { float Radius = 10.0; - if (m_creature->IsWithinDistInMap(who, Radius)) + if (m_creature->IsWithinDistInMap(pWho, Radius)) { - Start(false, false, who->GetGUID()); + Start(false, false, pWho->GetGUID()); } } } } void Reset() {} - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; CreatureAI* GetAI_npc_kservantAI(Creature* pCreature) { diff --git a/src/bindings/scripts/scripts/outland/terokkar_forest.cpp b/src/bindings/scripts/scripts/outland/terokkar_forest.cpp index b2c658c0eef..bfce48a17dd 100644 --- a/src/bindings/scripts/scripts/outland/terokkar_forest.cpp +++ b/src/bindings/scripts/scripts/outland/terokkar_forest.cpp @@ -179,7 +179,7 @@ public: void WaypointReached(uint32 i) { - Player *pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -412,11 +412,9 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI { npc_isla_starmaneAI(Creature* c) : npc_escortAI(c) {} - bool Completed; - void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -435,11 +433,11 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI case 29:DoScriptText(SAY_PROGRESS_4, m_creature, pPlayer); if (pPlayer) { - if (CAST_PLR(pPlayer)->GetTeam() == ALLIANCE) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_EFTW_A, m_creature); - else if (CAST_PLR(pPlayer)->GetTeam() == HORDE) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_EFTW_H, m_creature); - } Completed = true; + if (pPlayer->GetTeam() == ALLIANCE) + pPlayer->GroupEventHappens(QUEST_EFTW_A, m_creature); + else if (pPlayer->GetTeam() == HORDE) + pPlayer->GroupEventHappens(QUEST_EFTW_H, m_creature); + } m_creature->SetInFront(pPlayer); break; case 30: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break; case 31: DoCast(m_creature, SPELL_CAT); @@ -449,31 +447,19 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI void Reset() { - Completed = false; - m_creature->setFaction(1660); + me->RestoreFaction(); } - void EnterCombat(Unit* who){} - void JustDied(Unit* killer) { - if (PlayerGUID) + if (Player* pPlayer = GetPlayerForEscort()) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); - if (pPlayer && !Completed) - { - if (CAST_PLR(pPlayer)->GetTeam() == ALLIANCE) - CAST_PLR(pPlayer)->FailQuest(QUEST_EFTW_A); - else if (CAST_PLR(pPlayer)->GetTeam() == HORDE) - CAST_PLR(pPlayer)->FailQuest(QUEST_EFTW_H); - } + if (pPlayer->GetTeam() == ALLIANCE) + pPlayer->FailQuest(QUEST_EFTW_A); + else if (pPlayer->GetTeam() == HORDE) + pPlayer->FailQuest(QUEST_EFTW_H); } } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; bool QuestAccept_npc_isla_starmane(Player* pPlayer, Creature* pCreature, Quest const* quest) @@ -488,45 +474,7 @@ bool QuestAccept_npc_isla_starmane(Player* pPlayer, Creature* pCreature, Quest c CreatureAI* GetAI_npc_isla_starmaneAI(Creature* pCreature) { - npc_isla_starmaneAI* thisAI = new npc_isla_starmaneAI(pCreature); - - thisAI->AddWaypoint(0, -2265.21, 3091.14, 13.91); - thisAI->AddWaypoint(1, -2266.80, 3091.33, 13.82, 1000); - thisAI->AddWaypoint(2, -2268.20, 3091.14, 13.82, 7000);//progress1 - thisAI->AddWaypoint(3, -2278.32, 3098.98, 13.82); - thisAI->AddWaypoint(4, -2294.82, 3110.59, 13.82); - thisAI->AddWaypoint(5, -2300.71, 3114.60, 13.82, 20000);//progress2 - thisAI->AddWaypoint(6, -2300.71, 3114.60, 13.82, 3000);//progress3 - thisAI->AddWaypoint(7, -2307.36, 3122.76, 13.79); - thisAI->AddWaypoint(8, -2312.83, 3130.55, 12.04); - thisAI->AddWaypoint(9, -2345.02, 3151.00, 8.38); - thisAI->AddWaypoint(10, -2351.97, 3157.61, 6.27); - thisAI->AddWaypoint(11, -2360.35, 3171.48, 3.31); - thisAI->AddWaypoint(12, -2371.44, 3185.41, 0.89); - thisAI->AddWaypoint(13, -2371.21, 3197.92, -0.96); - thisAI->AddWaypoint(14, -2380.35, 3210.45, -1.08); - thisAI->AddWaypoint(15, -2384.74, 3221.25, -1.17); - thisAI->AddWaypoint(16, -2386.15, 3233.39, -1.29); - thisAI->AddWaypoint(17, -2383.45, 3247.79, -1.32); - thisAI->AddWaypoint(18, -2367.50, 3265.64, -1.33); - thisAI->AddWaypoint(19, -2354.90, 3273.30, -1.50); - thisAI->AddWaypoint(20, -2348.88, 3280.58, -0.09); - thisAI->AddWaypoint(21, -2349.06, 3295.86, -0.95); - thisAI->AddWaypoint(22, -2350.43, 3328.27, -2.10); - thisAI->AddWaypoint(23, -2346.76, 3356.27, -2.82); - thisAI->AddWaypoint(24, -2340.56, 3370.68, -4.02); - thisAI->AddWaypoint(25, -2318.84, 3384.60, -7.61); - thisAI->AddWaypoint(26, -2313.99, 3398.61, -10.40); - thisAI->AddWaypoint(27, -2320.85, 3414.49, -11.49); - thisAI->AddWaypoint(28, -2338.26, 3426.06, -11.46); - thisAI->AddWaypoint(29, -2342.67, 3439.44, -11.32, 12000);//progress4 - thisAI->AddWaypoint(30, -2342.67, 3439.44, -11.32, 7000);//emote bye - thisAI->AddWaypoint(31, -2342.67, 3439.44, -11.32, 5000);//cat form - thisAI->AddWaypoint(32, -2344.60, 3461.27, -10.44); - thisAI->AddWaypoint(33, -2396.81, 3517.17, -3.55); - thisAI->AddWaypoint(34, -2439.23, 3523.00, -1.05); - - return thisAI; + return new npc_isla_starmaneAI(pCreature); } /*###### @@ -624,7 +572,7 @@ struct TRINITY_DLL_DECL npc_akunoAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if(!pPlayer) return; diff --git a/src/bindings/scripts/scripts/outland/zangarmarsh.cpp b/src/bindings/scripts/scripts/outland/zangarmarsh.cpp index 0ce14cc0aee..2d505a5183a 100644 --- a/src/bindings/scripts/scripts/outland/zangarmarsh.cpp +++ b/src/bindings/scripts/scripts/outland/zangarmarsh.cpp @@ -284,34 +284,34 @@ struct TRINITY_DLL_DECL npc_kayra_longmaneAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pUnit = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); - if (!pUnit) + if (!pPlayer) return; switch(i) { case 4: - DoScriptText(SAY_AMBUSH1, m_creature, pUnit); + DoScriptText(SAY_AMBUSH1, m_creature, pPlayer); DoSpawnCreature(NPC_SLAVEBINDER, -10.0f, -5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); DoSpawnCreature(NPC_SLAVEBINDER, -8.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; case 5: - DoScriptText(SAY_PROGRESS, m_creature, pUnit); + DoScriptText(SAY_PROGRESS, m_creature, pPlayer); SetRun(); break; case 16: - DoScriptText(SAY_AMBUSH2, m_creature, pUnit); + DoScriptText(SAY_AMBUSH2, m_creature, pPlayer); DoSpawnCreature(NPC_SLAVEBINDER, -10.0f, -5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); DoSpawnCreature(NPC_SLAVEBINDER, -8.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; case 17: SetRun(false); - DoScriptText(SAY_NEAR_END, m_creature, pUnit); + DoScriptText(SAY_NEAR_END, m_creature, pPlayer); break; case 25: - DoScriptText(SAY_END, m_creature, pUnit); - pUnit->GroupEventHappens(QUEST_ESCAPE_FROM, m_creature); + DoScriptText(SAY_END, m_creature, pPlayer); + pPlayer->GroupEventHappens(QUEST_ESCAPE_FROM, m_creature); break; } } -- cgit v1.2.3 From 418b161bdc33786dab1eefd4567573a4e1ec3a69 Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 16 Aug 2009 18:03:26 -0500 Subject: *Fix build. --HG-- branch : trunk --- src/bindings/scripts/base/escort_ai.h | 3 ++- .../scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter2.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/bindings/scripts/base') diff --git a/src/bindings/scripts/base/escort_ai.h b/src/bindings/scripts/base/escort_ai.h index 60e555dcfd4..b66bb435163 100644 --- a/src/bindings/scripts/base/escort_ai.h +++ b/src/bindings/scripts/base/escort_ai.h @@ -88,8 +88,9 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI bool IsBeingEscorted; bool IsOnHold; - private: uint64 m_uiPlayerGUID; + + private: uint32 m_uiWPWaitTimer; uint32 m_uiPlayerCheckTimer; float MaxPlayerDistance; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter2.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter2.cpp index e0e50364d18..8423fa99d46 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter2.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter2.cpp @@ -234,7 +234,7 @@ struct TRINITY_DLL_DECL npc_koltira_deathweaverAI : public npc_escortAI void JustSummoned(Creature* pSummoned) { - if (Unit* pPlayer = Unit::GetUnit(*me, PlayerGUID)) + if (Unit* pPlayer = Unit::GetUnit(*me, m_uiPlayerGUID)) { pSummoned->AI()->AttackStart(pPlayer); pSummoned->AddThreat(me, 0.0f); -- cgit v1.2.3 From 48e699745399ab4cd1fffa6fb2b66493807fb5c8 Mon Sep 17 00:00:00 2001 From: Kudlaty Date: Mon, 17 Aug 2009 01:10:34 +0200 Subject: Revert last rev and fix in correct way. Also some clean up after merge --HG-- branch : trunk --- src/bindings/scripts/base/escort_ai.h | 3 +- .../eastern_kingdoms/scarlet_enclave/chapter2.cpp | 2 +- .../scarlet_enclave/the_scarlet_enclave.cpp | 1139 -------------------- 3 files changed, 2 insertions(+), 1142 deletions(-) (limited to 'src/bindings/scripts/base') diff --git a/src/bindings/scripts/base/escort_ai.h b/src/bindings/scripts/base/escort_ai.h index b66bb435163..60e555dcfd4 100644 --- a/src/bindings/scripts/base/escort_ai.h +++ b/src/bindings/scripts/base/escort_ai.h @@ -88,9 +88,8 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI bool IsBeingEscorted; bool IsOnHold; - uint64 m_uiPlayerGUID; - private: + uint64 m_uiPlayerGUID; uint32 m_uiWPWaitTimer; uint32 m_uiPlayerCheckTimer; float MaxPlayerDistance; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter2.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter2.cpp index 8423fa99d46..87033b9899f 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter2.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter2.cpp @@ -234,7 +234,7 @@ struct TRINITY_DLL_DECL npc_koltira_deathweaverAI : public npc_escortAI void JustSummoned(Creature* pSummoned) { - if (Unit* pPlayer = Unit::GetUnit(*me, m_uiPlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { pSummoned->AI()->AttackStart(pPlayer); pSummoned->AddThreat(me, 0.0f); diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp index 08b1f818335..b9945e4015f 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp @@ -17,11 +17,6 @@ */ #include "precompiled.h" -#include "Vehicle.h" -#include "ObjectMgr.h" -#include "escort_ai.h" - -#define GCD_CAST 1 /*###### ## npc_a_special_surprise @@ -480,1070 +475,6 @@ CreatureAI* GetAI_npc_a_special_surprise(Creature* pCreature) return new npc_a_special_surpriseAI(pCreature); } -/*###### -## npc_koltira_deathweaver -######*/ - -enum eKoltira -{ - SAY_BREAKOUT1 = -1609079, - SAY_BREAKOUT2 = -1609080, - SAY_BREAKOUT3 = -1609081, - SAY_BREAKOUT4 = -1609082, - SAY_BREAKOUT5 = -1609083, - SAY_BREAKOUT6 = -1609084, - SAY_BREAKOUT7 = -1609085, - SAY_BREAKOUT8 = -1609086, - SAY_BREAKOUT9 = -1609087, - SAY_BREAKOUT10 = -1609088, - - SPELL_KOLTIRA_TRANSFORM = 52899, - SPELL_ANTI_MAGIC_ZONE = 52894, - - QUEST_BREAKOUT = 12727, - - NPC_CRIMSON_ACOLYTE = 29007, - NPC_HIGH_INQUISITOR_VALROTH = 29001, - NPC_KOLTIRA_ALT = 28447, - - //not sure about this id - //NPC_DEATH_KNIGHT_MOUNT = 29201, - MODEL_DEATH_KNIGHT_MOUNT = 25278 -}; - -struct TRINITY_DLL_DECL npc_koltira_deathweaverAI : public npc_escortAI -{ - npc_koltira_deathweaverAI(Creature *pCreature) : npc_escortAI(pCreature) { } - - uint32 m_uiWave; - uint32 m_uiWave_Timer; - uint64 m_uiValrothGUID; - - void Reset() - { - if (!IsBeingEscorted) - { - m_uiWave = 0; - m_uiWave_Timer = 3000; - m_uiValrothGUID = 0; - } - } - - void WaypointReached(uint32 uiPointId) - { - switch(uiPointId) - { - case 0: - DoScriptText(SAY_BREAKOUT1, m_creature); - break; - case 1: - m_creature->SetStandState(UNIT_STAND_STATE_KNEEL); - break; - case 2: - m_creature->SetStandState(UNIT_STAND_STATE_STAND); - //m_creature->UpdateEntry(NPC_KOLTIRA_ALT); //unclear if we must update or not - DoCast(m_creature, SPELL_KOLTIRA_TRANSFORM); - break; - case 3: - IsOnHold = true; - m_creature->SetStandState(UNIT_STAND_STATE_KNEEL); - DoScriptText(SAY_BREAKOUT2, m_creature); - DoCast(m_creature, SPELL_ANTI_MAGIC_ZONE); // cast again that makes bubble up - break; - case 4: - SetRun(true); - break; - case 9: - m_creature->Mount(MODEL_DEATH_KNIGHT_MOUNT); - break; - case 10: - m_creature->Unmount(); - break; - } - } - - void JustSummoned(Creature* pSummoned) - { - if (Player* pPlayer = GetPlayerForEscort()) - { - pSummoned->AI()->AttackStart(pPlayer); - pSummoned->AddThreat(m_creature, 0.0f); - } - - if (pSummoned->GetEntry() == NPC_HIGH_INQUISITOR_VALROTH) - m_uiValrothGUID = pSummoned->GetGUID(); - } - - void SummonAcolyte(uint32 uiAmount) - { - for(uint32 i = 0; i < uiAmount; ++i) - m_creature->SummonCreature(NPC_CRIMSON_ACOLYTE, 1642.329, -6045.818, 127.583, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); - } - - void UpdateAI(const uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); - - if (IsOnHold) - { - if (m_uiWave_Timer < uiDiff) - { - switch(m_uiWave) - { - case 0: - DoScriptText(SAY_BREAKOUT3, m_creature); - SummonAcolyte(3); - m_uiWave_Timer = 20000; - break; - case 1: - DoScriptText(SAY_BREAKOUT4, m_creature); - SummonAcolyte(3); - m_uiWave_Timer = 20000; - break; - case 2: - DoScriptText(SAY_BREAKOUT5, m_creature); - SummonAcolyte(4); - m_uiWave_Timer = 20000; - break; - case 3: - DoScriptText(SAY_BREAKOUT6, m_creature); - m_creature->SummonCreature(NPC_HIGH_INQUISITOR_VALROTH, 1642.329, -6045.818, 127.583, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 1000); - m_uiWave_Timer = 1000; - break; - case 4: - { - Unit* pTemp = Unit::GetUnit(*m_creature, m_uiValrothGUID); - - if (!pTemp || !pTemp->isAlive()) - { - DoScriptText(SAY_BREAKOUT8, m_creature); - m_uiWave_Timer = 5000; - } - else - { - m_uiWave_Timer = 2500; - return; //return, we don't want m_uiWave to increment now - } - break; - } - case 5: - DoScriptText(SAY_BREAKOUT9, m_creature); - m_creature->RemoveAurasDueToSpell(SPELL_ANTI_MAGIC_ZONE); - m_uiWave_Timer = 2500; - break; - case 6: - DoScriptText(SAY_BREAKOUT10, m_creature); - IsOnHold = false; - break; - } - - ++m_uiWave; - } - else - m_uiWave_Timer -= uiDiff; - } - } -}; - -CreatureAI* GetAI_npc_koltira_deathweaver(Creature* pCreature) -{ - return new npc_koltira_deathweaverAI(pCreature); -} - -bool QuestAccept_npc_koltira_deathweaver(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_BREAKOUT) - { - pCreature->SetStandState(UNIT_STAND_STATE_STAND); - - if (npc_escortAI* pEscortAI = CAST_AI(npc_koltira_deathweaverAI,pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID()); - } - return true; -} - -/*###### -##Quest 12848 -######*/ - -enum -{ - SPELL_SOUL_PRISON_CHAIN_SELF = 54612, - SPELL_SOUL_PRISON_CHAIN = 54613, - SPELL_DK_INITIATE_VISUAL = 51519, - - SPELL_ICY_TOUCH = 52372, - SPELL_PLAGUE_STRIKE = 52373, - SPELL_BLOOD_STRIKE = 52374, - SPELL_DEATH_COIL = 52375 -}; - -#define EVENT_ICY_TOUCH 1 -#define EVENT_PLAGUE_STRIKE 2 -#define EVENT_BLOOD_STRIKE 3 -#define EVENT_DEATH_COIL 4 - -int32 say_event_start[8] = -{ - -1609000,-1609001,-1609002,-1609003, - -1609004,-1609005,-1609006,-1609007 -}; - -int32 say_event_attack[9] = -{ - -1609008,-1609009,-1609010,-1609011,-1609012, - -1609013,-1609014,-1609015,-1609016 -}; - -uint32 acherus_soul_prison[12] = -{ - 191577, - 191580, - 191581, - 191582, - 191583, - 191584, - 191585, - 191586, - 191587, - 191588, - 191589, - 191590 -}; - -uint32 acherus_unworthy_initiate[5] = -{ - 29519, - 29520, - 29565, - 29566, - 29567 -}; - -enum UnworthyInitiatePhase -{ - PHASE_CHAINED, - PHASE_TO_EQUIP, - PHASE_EQUIPING, - PHASE_TO_ATTACK, - PHASE_ATTACKING, -}; - -struct TRINITY_DLL_DECL npc_unworthy_initiateAI : public ScriptedAI -{ - npc_unworthy_initiateAI(Creature *c) : ScriptedAI(c) - { - me->SetReactState(REACT_PASSIVE); - if (!me->GetEquipmentId()) - if (const CreatureInfo *info = GetCreatureInfo(28406)) - if (info->equipmentId) - const_cast(me->GetCreatureInfo())->equipmentId = info->equipmentId; - } - - bool event_startet; - uint64 event_starter; - UnworthyInitiatePhase phase; - uint32 wait_timer; - float targ_x,targ_y,targ_z; - uint64 anchorGUID; - - EventMap events; - - void Reset() - { - anchorGUID = 0; - phase = PHASE_CHAINED; - events.Reset(); - m_creature->setFaction(7); - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); - m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 8); - me->LoadEquipment(0, true); - event_startet = false; - } - - void EnterCombat(Unit *who) - { - events.ScheduleEvent(EVENT_ICY_TOUCH, 1000, GCD_CAST); - events.ScheduleEvent(EVENT_PLAGUE_STRIKE, 3000, GCD_CAST); - events.ScheduleEvent(EVENT_BLOOD_STRIKE, 2000, GCD_CAST); - events.ScheduleEvent(EVENT_DEATH_COIL, 5000, GCD_CAST); - } - - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; - - if (id == 1) - { - wait_timer = 5000; - m_creature->CastSpell(m_creature,SPELL_DK_INITIATE_VISUAL,true); - - if (Unit* starter = Unit::GetUnit((*m_creature),event_starter)) - DoScriptText(say_event_attack[rand()%9],m_creature,starter); - - phase = PHASE_TO_ATTACK; - } - } - - void EventStart(Creature* anchor, Player* target) - { - wait_timer = 5000; - phase = PHASE_TO_EQUIP; - - m_creature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - m_creature->RemoveAurasDueToSpell(SPELL_SOUL_PRISON_CHAIN_SELF); - m_creature->RemoveAurasDueToSpell(SPELL_SOUL_PRISON_CHAIN); - - float z; - anchor->GetContactPoint(me, targ_x, targ_y, z, 1.0f); - - event_starter = target->GetGUID(); - DoScriptText(say_event_start[rand()%8], m_creature, target); - } - - void UpdateAI(const uint32 diff); -}; - -CreatureAI* GetAI_npc_unworthy_initiate(Creature* pCreature) -{ - return new npc_unworthy_initiateAI(pCreature); -} - -struct TRINITY_DLL_DECL npc_unworthy_initiate_anchorAI : public PassiveAI -{ - npc_unworthy_initiate_anchorAI(Creature *c) : PassiveAI(c), prisonerGUID(0) {} - - uint64 prisonerGUID; - - void SetGUID(const uint64 &guid, int32 id) - { - if (!prisonerGUID) - prisonerGUID = guid; - } - - uint64 GetGUID(int32 id) { return prisonerGUID; } -}; - -void npc_unworthy_initiateAI::UpdateAI(const uint32 diff) -{ - switch(phase) - { - case PHASE_CHAINED: - if (!anchorGUID) - { - float x, y, z; - float dist = 99.0f; - GameObject *prison = NULL; - - for(uint8 i = 0; i < 12; ++i) - { - if (GameObject* temp_prison = m_creature->FindNearestGameObject(acherus_soul_prison[i],30)) - { - if (dist == 99.0f || m_creature->IsWithinDist(temp_prison, dist, false)) - { - temp_prison->GetPosition(x, y, z); - dist = m_creature->GetDistance2d(temp_prison); - prison = temp_prison; - } - } - } - - if (!prison) - return; - - prison->ResetDoorOrButton(); - - if (Creature* anchor = me->FindNearestCreature(29521, 30)) - { - anchor->GetPosition(targ_x, targ_y, targ_z); - anchor->AI()->SetGUID(m_creature->GetGUID()); - anchor->CastSpell(me, SPELL_SOUL_PRISON_CHAIN, true); - anchorGUID = anchor->GetGUID(); - } - } - return; - case PHASE_TO_EQUIP: - if (wait_timer) - { - if (wait_timer < diff) - { - m_creature->GetMotionMaster()->MovePoint(1,targ_x,targ_y,m_creature->GetPositionZ()); - phase = PHASE_EQUIPING; - wait_timer = 0; - }else wait_timer -= diff; - } - return; - case PHASE_TO_ATTACK: - if (wait_timer) - { - if (wait_timer < diff) - { - m_creature->setFaction(14); - m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); - phase = PHASE_ATTACKING; - - if (Unit* target = Unit::GetUnit((*m_creature),event_starter)) - m_creature->AI()->AttackStart(target); - wait_timer = 0; - }else wait_timer -= diff; - } - return; - case PHASE_ATTACKING: - if (!UpdateVictim()) - return; - - events.Update(diff); - - while(uint32 eventId = events.ExecuteEvent()) - { - switch(eventId) - { - case EVENT_ICY_TOUCH: - DoCast(m_creature->getVictim(), SPELL_ICY_TOUCH); - events.DelayEvents(1000, GCD_CAST); - events.ScheduleEvent(EVENT_ICY_TOUCH, 5000, GCD_CAST); - break; - case EVENT_PLAGUE_STRIKE: - DoCast(m_creature->getVictim(), SPELL_PLAGUE_STRIKE); - events.DelayEvents(1000, GCD_CAST); - events.ScheduleEvent(SPELL_PLAGUE_STRIKE, 5000, GCD_CAST); - break; - case EVENT_BLOOD_STRIKE: - DoCast(m_creature->getVictim(), SPELL_BLOOD_STRIKE); - events.DelayEvents(1000, GCD_CAST); - events.ScheduleEvent(EVENT_BLOOD_STRIKE, 5000, GCD_CAST); - break; - case EVENT_DEATH_COIL: - DoCast(m_creature->getVictim(), SPELL_DEATH_COIL); - events.DelayEvents(1000, GCD_CAST); - events.ScheduleEvent(EVENT_DEATH_COIL, 5000, GCD_CAST); - break; - } - } - - DoMeleeAttackIfReady(); - return; - } -} - -CreatureAI* GetAI_npc_unworthy_initiate_anchor(Creature* pCreature) -{ - return new npc_unworthy_initiate_anchorAI(pCreature); -} - -bool GOHello_go_acherus_soul_prison(Player* pPlayer, GameObject* pGo) -{ - if (Creature *anchor = pGo->FindNearestCreature(29521, 15)) - if (uint64 prisonerGUID = anchor->AI()->GetGUID()) - if (Creature* prisoner = Creature::GetCreature(*pPlayer, prisonerGUID)) - CAST_AI(npc_unworthy_initiateAI, (prisoner->AI()))->EventStart(anchor, pPlayer); - - return false; -} - -/*###### -## npc_death_knight_initiate -######*/ - -#define GOSSIP_ACCEPT_DUEL "I challenge you, death knight!" - -enum -{ - SAY_DUEL_A = -1609080, - SAY_DUEL_B = -1609081, - SAY_DUEL_C = -1609082, - SAY_DUEL_D = -1609083, - SAY_DUEL_E = -1609084, - SAY_DUEL_F = -1609085, - SAY_DUEL_G = -1609086, - SAY_DUEL_H = -1609087, - SAY_DUEL_I = -1609088, - - SPELL_DUEL = 52996, - SPELL_DUEL_TRIGGERED = 52990, - SPELL_DUEL_VICTORY = 52994, - SPELL_DUEL_FLAG = 52991, - - QUEST_DEATH_CHALLENGE = 12733, - FACTION_HOSTILE = 2068 -}; - -int32 m_auiRandomSay[] = -{ - SAY_DUEL_A, SAY_DUEL_B, SAY_DUEL_C, SAY_DUEL_D, SAY_DUEL_E, SAY_DUEL_F, SAY_DUEL_G, SAY_DUEL_H, SAY_DUEL_I -}; - -struct TRINITY_DLL_DECL npc_death_knight_initiateAI : public SpellAI -{ - npc_death_knight_initiateAI(Creature* pCreature) : SpellAI(pCreature) - { - m_bIsDuelInProgress = false; - } - - bool lose; - uint64 m_uiDuelerGUID; - uint32 m_uiDuelTimer; - bool m_bIsDuelInProgress; - - void Reset() - { - lose = false; - me->RestoreFaction(); - SpellAI::Reset(); - - m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); - - m_uiDuelerGUID = 0; - m_uiDuelTimer = 5000; - m_bIsDuelInProgress = false; - } - - void SpellHit(Unit* pCaster, const SpellEntry* pSpell) - { - if (!m_bIsDuelInProgress && pSpell->Id == SPELL_DUEL_TRIGGERED) - { - m_uiDuelerGUID = pCaster->GetGUID(); - m_bIsDuelInProgress = true; - } - } - - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) - { - if (m_bIsDuelInProgress && pDoneBy->IsControlledByPlayer()) - { - if (pDoneBy->GetGUID() != m_uiDuelerGUID && pDoneBy->GetOwnerGUID() != m_uiDuelerGUID) // other players cannot help - uiDamage = 0; - else if (uiDamage >= m_creature->GetHealth()) - { - uiDamage = 0; - - if (!lose) - { - pDoneBy->RemoveGameObject(SPELL_DUEL_FLAG, true); - pDoneBy->AttackStop(); - me->CastSpell(pDoneBy, SPELL_DUEL_VICTORY, true); - lose = true; - me->CastSpell(me, 7267, true); - me->RestoreFaction(); - } - } - } - } - - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - { - if (m_bIsDuelInProgress) - { - if (m_uiDuelTimer < uiDiff) - { - m_creature->setFaction(FACTION_HOSTILE); - - if (Unit* pUnit = Unit::GetUnit(*m_creature, m_uiDuelerGUID)) - AttackStart(pUnit); - } - else - m_uiDuelTimer -= uiDiff; - } - return; - } - - if (m_bIsDuelInProgress) - { - if (lose) - { - if (!me->HasAura(7267)) - EnterEvadeMode(); - return; - } - else if (me->getVictim()->GetTypeId() == TYPEID_PLAYER - && me->getVictim()->GetHealth() * 10 < me->getVictim()->GetMaxHealth()) - { - me->getVictim()->CastSpell(me->getVictim(), 7267, true); // beg - me->getVictim()->RemoveGameObject(SPELL_DUEL_FLAG, true); - EnterEvadeMode(); - return; - } - } - - // TODO: spells - - SpellAI::UpdateAI(uiDiff); - } -}; - -CreatureAI* GetAI_npc_death_knight_initiate(Creature* pCreature) -{ - return new npc_death_knight_initiateAI(pCreature); -} - -bool GossipHello_npc_death_knight_initiate(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_DEATH_CHALLENGE) == QUEST_STATUS_INCOMPLETE && pCreature->GetHealth() == pCreature->GetMaxHealth()) - { - if (pPlayer->GetHealth() * 10 < pPlayer->GetMaxHealth()) - return true; - - if (pPlayer->isInCombat() || pCreature->isInCombat()) - return true; - - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ACCEPT_DUEL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pCreature->GetNpcTextId(),pCreature->GetGUID()); - } - return true; -} - -bool GossipSelect_npc_death_knight_initiate(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) - { - pPlayer->CLOSE_GOSSIP_MENU(); - - if (pPlayer->isInCombat() || pCreature->isInCombat()) - return true; - - if (npc_death_knight_initiateAI* pInitiateAI = CAST_AI(npc_death_knight_initiateAI, pCreature->AI())) - { - if (pInitiateAI->m_bIsDuelInProgress) - return true; - } - - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); - - int32 uiSayId = rand()% (sizeof(m_auiRandomSay)/sizeof(int32)); - DoScriptText(m_auiRandomSay[uiSayId], pCreature, pPlayer); - - pCreature->CastSpell(pPlayer, SPELL_DUEL, false); - pPlayer->CastSpell(pPlayer, SPELL_DUEL_FLAG, true); - } - return true; -} - -/*###### -## npc_dark_rider_of_acherus -######*/ - -#define DESPAWN_HORSE 52267 - -struct TRINITY_DLL_DECL npc_dark_rider_of_acherusAI : public ScriptedAI -{ - npc_dark_rider_of_acherusAI(Creature *c) : ScriptedAI(c) {} - - uint32 PhaseTimer; - uint32 Phase; - bool Intro; - Unit *Target; - - void Reset() - { - PhaseTimer = 4000; - Phase = 0; - Intro = false; - Target = NULL; - } - - void UpdateAI(const uint32 diff) - { - if (!Intro) - return; - - if (PhaseTimer < diff) - { - switch(Phase) - { - case 0: - m_creature->MonsterSay("The realm of shadows awaits...", LANG_UNIVERSAL, 0); - PhaseTimer = 5000; - Phase = 1; - break; - case 1: - DoCast(Target, DESPAWN_HORSE, true); - PhaseTimer = 3000; - Phase = 2; - break; - case 2: - m_creature->SetVisibility(VISIBILITY_OFF); - PhaseTimer = 2000; - Phase = 3; - break; - case 3: - m_creature->ForcedDespawn(); - break; - default: - break; - } - }else PhaseTimer -= diff; - - } - - void InitDespawnHorse(Unit *who) - { - if (!who) - return; - - Target = who; - m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - m_creature->SetSpeed(MOVE_RUN, 0.4f); - m_creature->GetMotionMaster()->MoveChase(Target); - m_creature->SetUInt64Value(UNIT_FIELD_TARGET, Target->GetGUID()); - Intro = true; - } - -}; - -CreatureAI* GetAI_npc_dark_rider_of_acherus(Creature* pCreature) -{ - return new npc_dark_rider_of_acherusAI(pCreature); -} - -/*###### -## npc_salanar_the_horseman -######*/ - -enum -{ - REALM_OF_SHADOWS = 52693, - DELIVER_STOLEN_HORSE = 52264, - CALL_DARK_RIDER = 52266 -}; - -struct TRINITY_DLL_DECL npc_salanar_the_horsemanAI : public ScriptedAI -{ - npc_salanar_the_horsemanAI(Creature *c) : ScriptedAI(c) {} - - void SpellHit(Unit *caster, const SpellEntry *spell) - { - if (spell->Id == DELIVER_STOLEN_HORSE) - { - if (caster->GetTypeId() == TYPEID_UNIT && CAST_CRE(caster)->isVehicle()) - { - if (Unit *charmer = caster->GetCharmer()) - { - charmer->ExitVehicle(); - caster->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - caster->setFaction(35); - DoCast(caster, CALL_DARK_RIDER, true); - if (Creature* Dark_Rider = m_creature->FindNearestCreature(28654, 15)) - CAST_AI(npc_dark_rider_of_acherusAI, Dark_Rider->AI())->InitDespawnHorse(caster); - } - } - } - } - - void MoveInLineOfSight(Unit *who) - { - ScriptedAI::MoveInLineOfSight(who); - - if (who->GetTypeId() == TYPEID_UNIT && CAST_CRE(who)->isVehicle() && me->IsWithinDistInMap(who, 10.0f)) - { - if (Unit *charmer = who->GetCharmer()) - { - if (charmer->GetTypeId() == TYPEID_PLAYER) - { - switch(me->GetEntry()) - { - // for quest Into the Realm of Shadows(12687) - case 28788: - if (CAST_PLR(charmer)->GetQuestStatus(12687) == QUEST_STATUS_INCOMPLETE) - { - if (CAST_PLR(charmer)->HasAura(REALM_OF_SHADOWS)) - charmer->RemoveAurasDueToSpell(REALM_OF_SHADOWS); - CAST_PLR(charmer)->GroupEventHappens(12687, me); - } - break; - default: - return; - } - CAST_PLR(charmer)->ExitVehicle(); - CAST_CRE(who)->Respawn(true); - } - } - } - } -}; - -CreatureAI* GetAI_npc_salanar_the_horseman(Creature* pCreature) -{ - return new npc_salanar_the_horsemanAI(pCreature); -} - -/*###### -## npc_ros_dark_rider -######*/ - -struct TRINITY_DLL_DECL npc_ros_dark_riderAI : public ScriptedAI -{ - npc_ros_dark_riderAI(Creature *c) : ScriptedAI(c) {} - - void EnterCombat(Unit *who) - { - me->ExitVehicle(); - } - - void Reset() - { - Creature* deathcharger = me->FindNearestCreature(28782, 30); - if (!deathcharger) return; - deathcharger->RestoreFaction(); - deathcharger->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - deathcharger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - if (!me->m_Vehicle && deathcharger->isVehicle() && CAST_VEH(deathcharger)->HasEmptySeat(0)) - me->EnterVehicle(CAST_VEH(deathcharger)); - } - - void JustDied(Unit *killer) - { - Creature* deathcharger = me->FindNearestCreature(28782, 30); - if (!deathcharger) return; - if (killer->GetTypeId() == TYPEID_PLAYER && deathcharger->GetTypeId() == TYPEID_UNIT && deathcharger->isVehicle()) - { - deathcharger->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK); - deathcharger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - deathcharger->setFaction(2096); - } - } -}; - -CreatureAI* GetAI_npc_ros_dark_rider(Creature* pCreature) -{ - return new npc_ros_dark_riderAI(pCreature); -} - -// correct way: 52312 52314 52555 ... -struct TRINITY_DLL_DECL npc_dkc1_gothikAI : public ScriptedAI -{ - npc_dkc1_gothikAI(Creature *c) : ScriptedAI(c) {} - - void MoveInLineOfSight(Unit *who) - { - ScriptedAI::MoveInLineOfSight(who); - - if (who->GetEntry() == 28845 && me->IsWithinDistInMap(who, 10.0f)) - { - if (Unit *owner = who->GetOwner()) - { - if (owner->GetTypeId() == TYPEID_PLAYER) - { - if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_INCOMPLETE) - { - CAST_CRE(who)->CastSpell(owner, 52517, true); - CAST_CRE(who)->ForcedDespawn(); - } - } - } - } - } -}; - -CreatureAI* GetAI_npc_dkc1_gothik(Creature* pCreature) -{ - return new npc_dkc1_gothikAI(pCreature); -} - - -/*#### -## npc_scarlet_miner_cart -####*/ - -#define SPELL_CART_CHECK 54173 -#define SPELL_CART_DRAG 52465 - -struct TRINITY_DLL_DECL npc_scarlet_miner_cartAI : public PassiveAI -{ - npc_scarlet_miner_cartAI(Creature *c) : PassiveAI(c), minerGUID(0) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2); - me->SetDisplayId(me->GetCreatureInfo()->DisplayID_A[0]); // H0 is horse - } - - uint64 minerGUID; - - void SetGUID(const uint64 &guid, int32 id) - { - minerGUID = guid; - } - - void DoAction(const int32 param) - { - if(Creature *miner = Unit::GetCreature(*me, minerGUID)) - { - // very bad visual effect - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); - //me->SetSpeed(MOVE_WALK, miner->GetSpeed(MOVE_WALK)); - me->SetSpeed(MOVE_RUN, miner->GetSpeed(MOVE_RUN)); - me->GetMotionMaster()->MoveFollow(miner, 1.0f, 0); - } - } - - void PassengerLeft(Unit *who, int8 seatId) - { - if(Creature *miner = Unit::GetCreature(*me, minerGUID)) - miner->DisappearAndDie(); - } -}; - -CreatureAI* GetAI_npc_scarlet_miner_cart(Creature *_Creature) -{ - return new npc_scarlet_miner_cartAI(_Creature); -} - -/*#### -## npc_scarlet_miner -####*/ - -struct TRINITY_DLL_DECL npc_scarlet_minerAI : public npc_escortAI -{ - npc_scarlet_minerAI(Creature *c) : npc_escortAI(c) - { - me->SetReactState(REACT_PASSIVE); - } - - uint32 IntroTimer; - uint32 IntroPhase; - uint64 carGUID; - - void Reset() - { - carGUID = 0; - IntroTimer = 0; - IntroPhase = 0; - } - - void InitWaypoint() - { - AddWaypoint(1, 2389.03, -5902.74, 109.014, 5000); - AddWaypoint(2, 2341.812012, -5900.484863, 102.619743); - AddWaypoint(3, 2306.561279, -5901.738281, 91.792419 ); - AddWaypoint(4, 2300.098389, -5912.618652, 86.014885 ); - AddWaypoint(5, 2294.142090, -5927.274414, 75.316849 ); - AddWaypoint(6, 2286.984375, -5944.955566, 63.714966 ); - AddWaypoint(7, 2280.001709, -5961.186035, 54.228283 ); - AddWaypoint(8, 2259.389648, -5974.197754, 42.359348 ); - AddWaypoint(9, 2242.882812, -5984.642578, 32.827850 ); - AddWaypoint(10, 2217.265625, -6028.959473, 7.675705 ); - AddWaypoint(11, 2202.595947, -6061.325684, 5.882018 ); - AddWaypoint(12, 2188.974609, -6080.866699, 3.370027 ); - - if(rand()%2) - { - AddWaypoint(13, 2176.483887, -6110.407227, 1.855181 ); - AddWaypoint(14, 2172.516602, -6146.752441, 1.074235 ); - AddWaypoint(15, 2138.918457, -6158.920898, 1.342926 ); - AddWaypoint(16, 2129.866699, -6174.107910, 4.380779 ); - AddWaypoint(17, 2117.709473, -6193.830078, 13.3542, 10000); - } - else - { - AddWaypoint(13, 2184.190186, -6166.447266, 0.968877 ); - AddWaypoint(14, 2234.265625, -6163.741211, 0.916021 ); - AddWaypoint(15, 2268.071777, -6158.750977, 1.822252 ); - AddWaypoint(16, 2270.028320, -6176.505859, 6.340538 ); - AddWaypoint(17, 2271.739014, -6195.401855, 13.3542, 10000); - } - } - - void InitCartQuest(Player *who) - { - carGUID = who->m_Vehicle->GetGUID(); - InitWaypoint(); - Start(false, false, who->GetGUID()); - SetDespawnAtFar(false); - } - - void WaypointReached(uint32 i) - { - switch (i) - { - case 1: - if(Unit *car = Unit::GetCreature(*me, carGUID)) - { - me->SetInFront(car); - me->SendMovementFlagUpdate(); - } - me->MonsterSay("Where'd this come from? I better get this down to the ships before the foreman sees it!",LANG_UNIVERSAL,NULL); - SetRun(true); - IntroTimer = 4000; - IntroPhase = 1; - break; - case 17: - if(Unit *car = Unit::GetCreature(*me, carGUID)) - { - me->SetInFront(car); - me->SendMovementFlagUpdate(); - car->Relocate(car->GetPositionX(), car->GetPositionY(), me->GetPositionZ()); - car->SendMonsterStop(); - //this make player fall under ground, dunno why - //car->GetMotionMaster()->MovePoint(0, car->GetPositionX(), car->GetPositionY(), me->GetPositionZ()); - car->RemoveAura(SPELL_CART_DRAG); - } - me->MonsterSay("Now I can have a rest!",LANG_UNIVERSAL,NULL); - break; - default: - break; - } - } - - void UpdateAI(const uint32 diff) - { - if (IntroPhase) - { - if (IntroTimer < diff) - { - if (IntroPhase == 1) - { - if(Creature *car = Unit::GetCreature(*me, carGUID)) - DoCast(car, SPELL_CART_DRAG); - IntroTimer = 800; - IntroPhase = 2; - } - else - { - if(Creature *car = Unit::GetCreature(*me, carGUID)) - car->AI()->DoAction(); - IntroPhase = 0; - } - }else IntroTimer-=diff; - } - npc_escortAI::UpdateAI(diff); - } -}; - -CreatureAI* GetAI_npc_scarlet_miner(Creature *_Creature) -{ - return new npc_scarlet_minerAI(_Creature); -} - -/*###### -## go_inconspicuous_mine_car -######*/ - -#define SPELL_CART_SUMM 52463 - -bool GOHello_go_inconspicuous_mine_car(Player* pPlayer, GameObject* pGO) -{ - if (pPlayer->GetQuestStatus(12701) == QUEST_STATUS_INCOMPLETE) - { - // Hack Why Trinity Dont Support Custom Summon Location - if(Creature *miner = pPlayer->SummonCreature(28841, 2383.869629, -5900.312500, 107.996086, pPlayer->GetOrientation(),TEMPSUMMON_DEAD_DESPAWN, 1)) - { - pPlayer->CastSpell(pPlayer, SPELL_CART_SUMM, true); - if(Vehicle *car = pPlayer->m_Vehicle) - { - if(car->GetEntry() == 28817) - { - car->AI()->SetGUID(miner->GetGUID()); - CAST_AI(npc_scarlet_minerAI, miner->AI())->InitCartQuest(pPlayer); - }else error_log("TSCR: GOHello_go_inconspicuous_mine_car vehicle entry is not correct."); - }else error_log("TSCR: GOHello_go_inconspicuous_mine_car player is not on the vehicle."); - }else error_log("TSCR: GOHello_go_inconspicuous_mine_car Scarlet Miner cant be found by script."); - } - return true; -} - -// npc 28912 quest 17217 boss 29001 mob 29007 go 191092 - /*#### ## npc_valkyr_battle_maiden ####*/ @@ -1636,76 +567,6 @@ void AddSC_the_scarlet_enclave() newscript->GetAI = &GetAI_npc_valkyr_battle_maiden; newscript->RegisterSelf(); - // 12848 The Endless Hunger - newscript = new Script; - newscript->Name="npc_unworthy_initiate"; - newscript->GetAI = &GetAI_npc_unworthy_initiate; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="npc_unworthy_initiate_anchor"; - newscript->GetAI = &GetAI_npc_unworthy_initiate_anchor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="go_acherus_soul_prison"; - newscript->pGOHello = &GOHello_go_acherus_soul_prison; - newscript->RegisterSelf(); - - // Death's Challenge - newscript = new Script; - newscript->Name="npc_death_knight_initiate"; - newscript->GetAI = &GetAI_npc_death_knight_initiate; - newscript->pGossipHello = &GossipHello_npc_death_knight_initiate; - newscript->pGossipSelect = &GossipSelect_npc_death_knight_initiate; - newscript->RegisterSelf(); - - // 12680 Grand Theft Palomino - newscript = new Script; - newscript->Name="npc_salanar_the_horseman"; - newscript->GetAI = &GetAI_npc_salanar_the_horseman; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="npc_dark_rider_of_acherus"; - newscript->GetAI = &GetAI_npc_dark_rider_of_acherus; - newscript->RegisterSelf(); - - // 12687 Into the Realm of Shadows - newscript = new Script; - newscript->Name="npc_ros_dark_rider"; - newscript->GetAI = &GetAI_npc_ros_dark_rider; - newscript->RegisterSelf(); - - // 12698 The Gift That Keeps On Giving - newscript = new Script; - newscript->Name="npc_dkc1_gothik"; - newscript->GetAI = &GetAI_npc_dkc1_gothik; - newscript->RegisterSelf(); - - // Massacre At Light's Point - newscript = new Script; - newscript->Name="npc_scarlet_miner"; - newscript->GetAI = &GetAI_npc_scarlet_miner; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="npc_scarlet_miner_cart"; - newscript->GetAI = &GetAI_npc_scarlet_miner_cart; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="go_inconspicuous_mine_car"; - newscript->pGOHello = &GOHello_go_inconspicuous_mine_car; - newscript->RegisterSelf(); - - // 12727 Bloody Breakout - newscript = new Script; - newscript->Name = "npc_koltira_deathweaver"; - newscript->GetAI = &GetAI_npc_koltira_deathweaver; - newscript->pQuestAccept = &QuestAccept_npc_koltira_deathweaver; - newscript->RegisterSelf(); - // A Special Suprise newscript = new Script; newscript->Name = "npc_a_special_surprise"; -- cgit v1.2.3