From 89ee8cbac1252edc50282b8ac1216f78d1946f8e Mon Sep 17 00:00:00 2001 From: w1sht0l1v3 Date: Sun, 15 Dec 2013 14:09:49 +0200 Subject: Core/Unit: Add switch to prevent COMMAND_ATTACK being added to action bar for supplied creature entries. --- src/server/game/Entities/Unit/Unit.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index da5edc0ea6c..025e0b21a92 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -13617,6 +13617,8 @@ void CharmInfo::InitPossessCreateSpells() // Adding entrys to this switch will prevent COMMAND_ATTACK being added to pet bar. switch (_unit->GetEntry()) { + case 40281: //Crashin' Thrashin' Racer + case 27664: //Crashin' Thrashin' Racer case 23575: // Mindless Abomination break; default: -- cgit v1.2.3 From f0a742a8c471ba948d5d86c1ab5e3a74329a9a92 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sun, 15 Dec 2013 13:37:49 +0100 Subject: Core/Misc: Remove unused code Remove unused debugging code added in MaNGOS r5067. Remove dead code from a switch found by Coverity. --- src/server/game/Entities/Unit/Unit.cpp | 3 --- src/server/game/Maps/MapManager.cpp | 36 ---------------------------------- src/server/game/Maps/MapManager.h | 5 ----- 3 files changed, 44 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 025e0b21a92..de331d5caf8 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -15904,9 +15904,6 @@ void Unit::RemoveCharmedBy(Unit* charmer) } } break; - default: - case CHARM_TYPE_CONVERT: - break; } } diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index 75ca3de3fe9..3ac965acbb4 100644 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -37,14 +37,10 @@ #include "WorldSession.h" #include "Opcodes.h" -extern GridState* si_GridStates[]; // debugging code, should be deleted some day - MapManager::MapManager() { i_gridCleanUpDelay = sWorld->getIntConfig(CONFIG_INTERVAL_GRIDCLEAN); i_timer.SetInterval(sWorld->getIntConfig(CONFIG_INTERVAL_MAPUPDATE)); - memset(i_GridStates, 0, sizeof(i_GridStates)); - i_GridStateErrorCount = 0; _nextInstanceId = 0; } @@ -54,13 +50,6 @@ void MapManager::Initialize() { Map::InitStateMachine(); - // debugging code, should be deleted some day - { - for (uint8 i = 0; i < MAX_GRID_STATE; ++i) - i_GridStates[i] = si_GridStates[i]; - - i_GridStateErrorCount = 0; - } int num_threads(sWorld->getIntConfig(CONFIG_NUMTHREADS)); // Start mtmaps if needed. if (num_threads > 0 && m_updater.activate(num_threads) == -1) @@ -73,31 +62,6 @@ void MapManager::InitializeVisibilityDistanceInfo() (*iter).second->InitVisibilityDistance(); } -// debugging code, should be deleted some day -void MapManager::checkAndCorrectGridStatesArray() -{ - bool ok = true; - for (int i=0; icheckMagic()) - { - ok = false; - si_GridStates[i]->setMagic(); - } - #endif - } - if (!ok) - ++i_GridStateErrorCount; -} - Map* MapManager::CreateBaseMap(uint32 id) { Map* map = FindBaseMap(id); diff --git a/src/server/game/Maps/MapManager.h b/src/server/game/Maps/MapManager.h index 230b4648f4a..48537558057 100644 --- a/src/server/game/Maps/MapManager.h +++ b/src/server/game/Maps/MapManager.h @@ -129,11 +129,6 @@ class MapManager typedef UNORDERED_MAP MapMapType; typedef std::vector InstanceIds; - // debugging code, should be deleted some day - void checkAndCorrectGridStatesArray(); // just for debugging to find some memory overwrites - GridState* i_GridStates[MAX_GRID_STATE]; // shadow entries to the global array in Map.cpp - int i_GridStateErrorCount; - MapManager(); ~MapManager(); -- cgit v1.2.3 From a2e7191b2665cb8dafeb9623e114b5c2f339b82c Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sun, 15 Dec 2013 13:43:18 -0330 Subject: Core/Unit: prevent COMMAND_ATTACK being added for Trained Rock Falcon. Also added spells for Trained Rock Falcon to db. --- sql/updates/world/2013_12_15_00_world_creature_template.sql | 2 ++ src/server/game/Entities/Unit/Unit.cpp | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 sql/updates/world/2013_12_15_00_world_creature_template.sql (limited to 'src') diff --git a/sql/updates/world/2013_12_15_00_world_creature_template.sql b/sql/updates/world/2013_12_15_00_world_creature_template.sql new file mode 100644 index 00000000000..a7b1c9ea6eb --- /dev/null +++ b/sql/updates/world/2013_12_15_00_world_creature_template.sql @@ -0,0 +1,2 @@ +-- Trained Rock Falcon spells for quest 11470 "There Exists No Honor Among Birds" +UPDATE `creature_template` SET `spell1`=44422,`spell2`=44423,`spell3`=44424 WHERE `entry`=24783; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index de331d5caf8..93831ab0387 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -13617,9 +13617,10 @@ void CharmInfo::InitPossessCreateSpells() // Adding entrys to this switch will prevent COMMAND_ATTACK being added to pet bar. switch (_unit->GetEntry()) { - case 40281: //Crashin' Thrashin' Racer - case 27664: //Crashin' Thrashin' Racer case 23575: // Mindless Abomination + case 24783: // Trained Rock Falcon + case 27664: // Crashin' Thrashin' Racer + case 40281: // Crashin' Thrashin' Racer break; default: InitEmptyActionBar(); -- cgit v1.2.3 From dd4a774c4ca7d9a4a5c9df84235e5cfe52d5d2d3 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sun, 15 Dec 2013 18:51:34 +0100 Subject: Core/Transports: Fix memory leak on shutdown Fix world transports not being deleted on shutdown. --- src/server/game/Maps/Map.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 411e023eab1..b57b50dd422 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -68,12 +68,8 @@ Map::~Map() Transport* transport = *itr; ++itr; - // Destroy local transports - if (transport->GetTransportTemplate()->inInstance) - { - transport->RemoveFromWorld(); - delete transport; - } + transport->RemoveFromWorld(); + delete transport; } if (!m_scriptSchedule.empty()) -- cgit v1.2.3 From e90a7f82d4417400ff2db4c9da0f324190fa4e27 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sun, 15 Dec 2013 21:14:47 +0100 Subject: Core/AI: Fix CreatureAI left uninitialized Fix CreatureAI left uninitialized for 1 server tick for Creatures with DeathState:DEAD . This is a workaround required after c9cf2f059f8f33c3fcb58ad472871515e59df7c3 changes . Valgrind log: Conditional jump or move depends on uninitialised value(s) at : npc_draenei_survivor::npc_draenei_survivorAI::MoveInLineOfSight(Unit*) (zone_azuremyst_isle.cpp:104) by : CreatureAI::MoveInLineOfSight_Safe(Unit*) (CreatureAI.cpp:123) by : CreatureUnitRelocationWorker(Creature*, Unit*) (GridNotifiers.cpp:134) by : Trinity::AIRelocationNotifier::Visit(GridRefManager&) (GridNotifiers.cpp:252) Uninitialised value was created by a heap allocation at : operator new(unsigned long) (vg_replace_malloc.c:319) by : npc_draenei_survivor::GetAI(Creature*) const (zone_azuremyst_isle.cpp:66) by : ScriptMgr::GetCreatureAI(Creature*) (ScriptMgr.cpp:792) by : FactorySelector::selectAI(Creature*) (CreatureAISelector.cpp:41) by : Creature::AIM_Initialize(CreatureAI*) (Creature.cpp:716) by : Creature::AddToWorld() (Creature.cpp:190) --- src/server/game/Entities/Creature/Creature.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index dfc35bcce56..d039ee385ec 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -1533,7 +1533,11 @@ void Creature::Respawn(bool force) //Call AI respawn virtual function if (IsAIEnabled) + { + //reset the AI to be sure no dirty or uninitialized values will be used till next tick + AI()->Reset(); TriggerJustRespawned = true;//delay event to next tick so all creatures are created on the map before processing + } uint32 poolid = GetDBTableGUIDLow() ? sPoolMgr->IsPartOfAPool(GetDBTableGUIDLow()) : 0; if (poolid) -- cgit v1.2.3 From f1a82a578be525624c416ba5f882b2f1a7e13536 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Sun, 15 Dec 2013 20:26:11 -0330 Subject: Core/Waypoints: Stop creatures from skipping at waypoint nodes and add smoothing to pathing. --- .../MovementGenerators/WaypointMovementGenerator.cpp | 12 +++++++++--- src/server/game/Movement/Spline/MoveSpline.h | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index 45b61c828f9..a7674755bce 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -74,19 +74,24 @@ void WaypointMovementGenerator::OnArrived(Creature* creature) if (m_isArrivalDone) return; - creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); m_isArrivalDone = true; if (i_path->at(i_currentNode)->event_id && urand(0, 99) < i_path->at(i_currentNode)->event_chance) { TC_LOG_DEBUG("maps.script", "Creature movement start script %u at point %u for " UI64FMTD ".", i_path->at(i_currentNode)->event_id, i_currentNode, creature->GetGUID()); + creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); creature->GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, creature, NULL); } // Inform script MovementInform(creature); creature->UpdateWaypointID(i_currentNode); - Stop(i_path->at(i_currentNode)->delay); + + if (i_path->at(i_currentNode)->delay) + { + creature->ClearUnitState(UNIT_STATE_ROAMING_MOVE); + Stop(i_path->at(i_currentNode)->delay); + } } bool WaypointMovementGenerator::StartMove(Creature* creature) @@ -188,7 +193,8 @@ bool WaypointMovementGenerator::DoUpdate(Creature* creature, uint32 di { if (creature->IsStopped()) Stop(STOP_TIME_FOR_PLAYER); - else if (creature->movespline->Finalized()) + // Checking just before reaching waypoint gives smother movement than using FinalDestination + else if (creature->movespline->timeElapsed() < 150) { OnArrived(creature); return StartMove(creature); diff --git a/src/server/game/Movement/Spline/MoveSpline.h b/src/server/game/Movement/Spline/MoveSpline.h index 209f978d658..5a788201e7f 100644 --- a/src/server/game/Movement/Spline/MoveSpline.h +++ b/src/server/game/Movement/Spline/MoveSpline.h @@ -79,10 +79,10 @@ namespace Movement UpdateResult _updateState(int32& ms_time_diff); int32 next_timestamp() const { return spline.length(point_Idx + 1); } int32 segment_time_elapsed() const { return next_timestamp() - time_passed; } - int32 timeElapsed() const { return Duration() - time_passed; } int32 timePassed() const { return time_passed; } public: + int32 timeElapsed() const { return Duration() - time_passed; } int32 Duration() const { return spline.length(); } MySpline const& _Spline() const { return spline; } int32 _currentSplineIdx() const { return point_Idx; } -- cgit v1.2.3 From b8908606fc511a02fd61faa38e6fb275bf6bf02e Mon Sep 17 00:00:00 2001 From: jackpoz Date: Mon, 16 Dec 2013 19:38:49 +0100 Subject: Core/AH: Fix memory leak Fix memory leak in Auction House when creating an auction with stackable items and a stack of the same amount in the inventory. Leak added in 15a2acfb528728b824291cb49cdd9196e6f0d57d . --- src/server/game/Handlers/AuctionHouseHandler.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index 8e86f43f19f..1e5c35cf3ff 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -332,6 +332,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) item2->DeleteFromInventoryDB(trans); item2->DeleteFromDB(trans); CharacterDatabase.CommitTransaction(trans); + delete item2; } else // Item stack count is bigger than required count, update item stack count and save to database - cloned item will be used for auction { -- cgit v1.2.3 From b3c810a0fbb09c17085af0f9010b723b0d48d0fc Mon Sep 17 00:00:00 2001 From: jackpoz Date: Mon, 16 Dec 2013 19:52:50 +0100 Subject: Core/Misc: Fix warning Partially revert f0a742a8c471ba948d5d86c1ab5e3a74329a9a92 to fix a warning about unhandled switch case (the same case that Coverity reported as dead code) . --- src/server/game/Entities/Unit/Unit.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 93831ab0387..32dfee3409b 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -15905,6 +15905,8 @@ void Unit::RemoveCharmedBy(Unit* charmer) } } break; + case CHARM_TYPE_CONVERT: + break; } } -- cgit v1.2.3 From b8f9442ec9659ac9617c9b1647148f6b1727db24 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Mon, 16 Dec 2013 18:50:51 -0330 Subject: Core/Player: Fix logic for questgiver cast spell --- src/server/game/Entities/Player/Player.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 402713100c7..94c2f2e9f26 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -15379,7 +15379,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, if (quest->GetRewSpellCast() > 0) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(quest->GetRewSpellCast()); - if (questGiver->isType(TYPEMASK_UNIT) && (!spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL) || !spellInfo->HasEffect(SPELL_EFFECT_CREATE_ITEM))) + if (questGiver->isType(TYPEMASK_UNIT) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL) && !spellInfo->HasEffect(SPELL_EFFECT_CREATE_ITEM)) { if (Creature* creature = GetMap()->GetCreature(questGiver->GetGUID())) creature->CastSpell(this, quest->GetRewSpellCast(), true); @@ -15390,7 +15390,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver, else if (quest->GetRewSpell() > 0) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(quest->GetRewSpell()); - if (questGiver->isType(TYPEMASK_UNIT) && (!spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL) || !spellInfo->HasEffect(SPELL_EFFECT_CREATE_ITEM))) + if (questGiver->isType(TYPEMASK_UNIT) && !spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL) && !spellInfo->HasEffect(SPELL_EFFECT_CREATE_ITEM)) { if (Creature* creature = GetMap()->GetCreature(questGiver->GetGUID())) creature->CastSpell(this, quest->GetRewSpell(), true); -- cgit v1.2.3 From 54b7162f1def59387ecf3c031705f56fa1b10b02 Mon Sep 17 00:00:00 2001 From: Discover- Date: Tue, 17 Dec 2013 09:44:06 +0100 Subject: Core/SAI: Make SMART_ACTION_SET_INGAME_PHASE_MASK set the phasemask of the target_type instead of always the source calling the action type. --- src/server/game/AI/SmartScripts/SmartScript.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index a272cb79f51..164ace2eb44 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1046,8 +1046,18 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_SET_INGAME_PHASE_MASK: { - if (WorldObject* baseObj = GetBaseObject()) - baseObj->SetPhaseMask(e.action.ingamePhaseMask.mask, true); + ObjectList* targets = GetTargets(e, unit); + + if (!targets) + break; + + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) + { + if (!IsUnit(*itr)) + continue; + + (*itr)->ToUnit()->SetPhaseMask(e.action.ingamePhaseMask.mask, true); + } break; } -- cgit v1.2.3 From 20a22662df5442ba9b171f2cde22be50ed75bdc3 Mon Sep 17 00:00:00 2001 From: Discover- Date: Tue, 17 Dec 2013 10:12:23 +0100 Subject: Core/SAI: Using SMART_ACTION_SET_FOLLOW with target_type 0 (SMART_TARGET_NONE) will now stop the following completely. Fixes 6 scripts in a clean TDB already using this functionality even though it wasn't implemented. --- src/server/game/AI/SmartScripts/SmartAI.cpp | 48 +++++++++++++++---------- src/server/game/AI/SmartScripts/SmartAI.h | 1 + src/server/game/AI/SmartScripts/SmartScript.cpp | 3 ++ 3 files changed, 33 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 1c78b97866f..1ced9e79672 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -339,27 +339,10 @@ void SmartAI::UpdateAI(uint32 diff) { if (me->FindNearestCreature(mFollowArrivedEntry, INTERACTION_DISTANCE, true)) { - if (Player* player = ObjectAccessor::GetPlayer(*me, mFollowGuid)) - { - if (!mFollowCreditType) - player->RewardPlayerAndGroupAtEvent(mFollowCredit, me); - else - player->GroupEventHappens(mFollowCredit, me); - } - mFollowGuid = 0; - mFollowDist = 0; - mFollowAngle = 0; - mFollowCredit = 0; - mFollowArrivedTimer = 1000; - mFollowArrivedEntry = 0; - mFollowCreditType = 0; - SetDespawnTime(5000); - me->StopMoving(); - me->GetMotionMaster()->MoveIdle(); - StartDespawn(); - GetScript()->ProcessEventsFor(SMART_EVENT_FOLLOW_COMPLETED); + StopFollow(); return; } + mFollowArrivedTimer = 1000; } else @@ -803,7 +786,11 @@ void SmartAI::SetCombatMove(bool on) void SmartAI::SetFollow(Unit* target, float dist, float angle, uint32 credit, uint32 end, uint32 creditType) { if (!target) + { + StopFollow(); return; + } + SetRun(mRun); mFollowGuid = target->GetGUID(); mFollowDist = dist >= 0.0f ? dist : PET_FOLLOW_DIST; @@ -815,6 +802,29 @@ void SmartAI::SetFollow(Unit* target, float dist, float angle, uint32 credit, ui mFollowCreditType = creditType; } +void SmartAI::StopFollow() +{ + if (Player* player = ObjectAccessor::GetPlayer(*me, mFollowGuid)) + { + if (!mFollowCreditType) + player->RewardPlayerAndGroupAtEvent(mFollowCredit, me); + else + player->GroupEventHappens(mFollowCredit, me); + } + + mFollowGuid = 0; + mFollowDist = 0; + mFollowAngle = 0; + mFollowCredit = 0; + mFollowArrivedTimer = 1000; + mFollowArrivedEntry = 0; + mFollowCreditType = 0; + SetDespawnTime(5000); + me->StopMoving(); + me->GetMotionMaster()->MoveIdle(); + StartDespawn(); + GetScript()->ProcessEventsFor(SMART_EVENT_FOLLOW_COMPLETED); +} void SmartAI::SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker) { if (invoker) diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index 085859a6d85..5c56736a673 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -63,6 +63,7 @@ class SmartAI : public CreatureAI void SetCombatMove(bool on); bool CanCombatMove() { return mCanCombatMove; } void SetFollow(Unit* target, float dist = 0.0f, float angle = 0.0f, uint32 credit = 0, uint32 end = 0, uint32 creditType = 0); + void StopFollow(); void SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker); SmartScript* GetScript() { return &mScript; } diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 164ace2eb44..50434649125 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -825,7 +825,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u ObjectList* targets = GetTargets(e, unit); if (!targets) + { + CAST_AI(SmartAI, me->AI())->StopFollow(); break; + } for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { -- cgit v1.2.3 From 1f4d585bef865747994d5358f95f06dc86e59a37 Mon Sep 17 00:00:00 2001 From: Discover- Date: Tue, 17 Dec 2013 11:06:07 +0100 Subject: Core/SAI: In all npc flag related action_types we now check if the target is a creature instead of an unit (creature/player). --- src/server/game/AI/SmartScripts/SmartScript.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 50434649125..e72d9af160d 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1145,6 +1145,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (WorldObject* baseObj = GetBaseObject()) baseObj->setActive(e.action.active.state); + break; } case SMART_ACTION_ATTACK_START: @@ -1661,7 +1662,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) - if (IsUnit(*itr)) + if (IsCreature(*itr)) (*itr)->ToUnit()->SetUInt32Value(UNIT_NPC_FLAGS, e.action.unitFlag.flag); delete targets; @@ -1674,7 +1675,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) - if (IsUnit(*itr)) + if (IsCreature(*itr)) (*itr)->ToUnit()->SetFlag(UNIT_NPC_FLAGS, e.action.unitFlag.flag); delete targets; @@ -1687,7 +1688,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u break; for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) - if (IsUnit(*itr)) + if (IsCreature(*itr)) (*itr)->ToUnit()->RemoveFlag(UNIT_NPC_FLAGS, e.action.unitFlag.flag); delete targets; -- cgit v1.2.3 From 154ee466eb74c9b5d00a7838c7c6231f2786469b Mon Sep 17 00:00:00 2001 From: Discover- Date: Tue, 17 Dec 2013 11:10:23 +0100 Subject: Core/SAI: Using the action_type SMART_ACTION_SET_REACT_STATE now sets the react state of the target_type. Won't break any scripts as all current cases of this action_type have target_type 1 (SMART_TARGET_SELF). --- src/server/game/AI/SmartScripts/SmartScript.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index e72d9af160d..f0a469496bd 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -367,12 +367,14 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { if (IsPlayer(*itr)) + { if (Quest const* q = sObjectMgr->GetQuestTemplate(e.action.quest.quest)) { (*itr)->ToPlayer()->AddQuestAndCheckCompletion(q, NULL); TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_ADD_QUEST: Player guidLow %u add quest %u", (*itr)->GetGUIDLow(), e.action.quest.quest); } + } } delete targets; @@ -380,12 +382,18 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_SET_REACT_STATE: { - if (!me) + ObjectList* targets = GetTargets(e, unit); + if (!targets) break; - me->SetReactState(ReactStates(e.action.react.state)); - TC_LOG_DEBUG("scripts.ai", "SmartScript::ProcessAction:: SMART_ACTION_SET_REACT_STATE: Creature guidLow %u set reactstate %u", - me->GetGUIDLow(), e.action.react.state); + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) + { + if (!IsUnit(*itr)) + continue; + + (*itr)->ToUnit()->SetReactState(ReactStates(e.action.react.state)); + } + break; } case SMART_ACTION_RANDOM_EMOTE: -- cgit v1.2.3 From a0f7fee922e4f568fe24223234461f9824cc7307 Mon Sep 17 00:00:00 2001 From: Discover- Date: Tue, 17 Dec 2013 11:38:29 +0100 Subject: Core/SAI: Fix compile Core/SAI: Don't limit SMART_ACTION_SET_INGAME_PHASE_MASK to unit targets only. Thanks to @Shauren for the notice. --- src/server/game/AI/SmartScripts/SmartScript.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index f0a469496bd..9b97124de64 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -388,10 +388,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - if (!IsUnit(*itr)) + if (!IsCreature(*itr)) continue; - (*itr)->ToUnit()->SetReactState(ReactStates(e.action.react.state)); + (*itr)->ToCreature()->SetReactState(ReactStates(e.action.react.state)); } break; @@ -1064,10 +1064,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - if (!IsUnit(*itr)) - continue; - - (*itr)->ToUnit()->SetPhaseMask(e.action.ingamePhaseMask.mask, true); + if (IsUnit(*itr)) + (*itr)->ToUnit()->SetPhaseMask(e.action.ingamePhaseMask.mask, true); + else if (IsGameObject(*itr)) + (*itr)->ToGameObject()->SetPhaseMask(e.action.ingamePhaseMask.mask, true); } break; -- cgit v1.2.3 From e5f7beecf5fabefa13fbe2645cc7d7ca707e46e8 Mon Sep 17 00:00:00 2001 From: Discover- Date: Wed, 18 Dec 2013 10:06:19 +0100 Subject: Core/SAI: Using SMART_ACTION_FORCE_DESPAWN now despawns the given target_type instead of always the creature itself. --- src/server/game/AI/SmartScripts/SmartScript.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 9b97124de64..a36621f87d5 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1040,18 +1040,24 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u } case SMART_ACTION_FORCE_DESPAWN: { - if (!IsSmart()) + ObjectList* targets = GetTargets(e, unit); + + if (!targets) break; - // The AI is only updated if the creature is alive - if (me->IsAlive()) + for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - CAST_AI(SmartAI, me->AI())->SetDespawnTime(e.action.forceDespawn.delay + 1); // Next tick - CAST_AI(SmartAI, me->AI())->StartDespawn(); + if (!IsCreature(*itr)) + continue; + + if ((*itr)->ToUnit()->IsAlive() && IsSmart((*itr)->ToCreature())) + { + CAST_AI(SmartAI, (*itr)->ToCreature()->AI())->SetDespawnTime(e.action.forceDespawn.delay + 1); // Next tick + CAST_AI(SmartAI, (*itr)->ToCreature()->AI())->StartDespawn(); + } + else + (*itr)->ToCreature()->DespawnOrUnsummon(e.action.forceDespawn.delay); } - // Otherwise we call the despawn directly - else - me->DespawnOrUnsummon(e.action.forceDespawn.delay); break; } -- cgit v1.2.3 From 676baa890fc8d32b883f6eed581fb708e49a2493 Mon Sep 17 00:00:00 2001 From: Malcrom Date: Wed, 18 Dec 2013 18:06:30 -0330 Subject: Scripting/Dragonblight: Commander Eligor Dawnbringer now scripted. Purely cosmetic but it was a fun thing to script :) --- sql/updates/world/2013_12_18_00_world_misc.sql | 161 ++++++++++ src/server/scripts/Northrend/zone_dragonblight.cpp | 336 ++++++++++++++++++++- 2 files changed, 492 insertions(+), 5 deletions(-) create mode 100644 sql/updates/world/2013_12_18_00_world_misc.sql (limited to 'src') diff --git a/sql/updates/world/2013_12_18_00_world_misc.sql b/sql/updates/world/2013_12_18_00_world_misc.sql new file mode 100644 index 00000000000..1ea7b8550eb --- /dev/null +++ b/sql/updates/world/2013_12_18_00_world_misc.sql @@ -0,0 +1,161 @@ +-- Add script to Commander Eligor Dawnbringer +UPDATE creature_template SET `AIName`= '',ScriptName = 'npc_commander_eligor_dawnbringer' WHERE entry=27784; + +-- NPC talk text insert for Commander Eligor Dawnbringer +DELETE FROM `creature_text` WHERE `entry`=27784; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(27784,0,0, 'Next, I shall speak of the most powerful entities within the pinnacle of Naxxramas. Truly, these are two of the greatest threats to all of Northrend.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer - Pinnacle of Naxxramas'), +(27784,1,0, 'Next, I shall speak of the death knight wing of Naxxramas. Within its corrupted halls, the echo of battle rings day and night, as our finest warriors are corrupted and twisted into the Scourge''s greatest warriors.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer - Death knight wing of Naxxramas'), +(27784,2,0, 'Next, I shall speak of the blighted abomination wing of Naxxramas. There, the Scourge develop the strongest and most hideous aberrations of their armies.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer - Blighted abomination wing of Naxxramas'), +(27784,3,0, 'Next, I shall speak of the accursed spider wing of Naxxramas. It is there that the Scourge breed even more poisonous and dangerous versions of their kin.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer - Accursed spider wing of Naxxramas'), +(27784,4,0, 'Next, I shall speak of the dread plague wing of Naxxramas, where the scourge seek to improve upon the deadly blight which they spread upon Lordaeron.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer - Dread plague wing of Naxxramas'), +(27784,5,0, 'I shall leave this image on display for your perusal. Study your opponents'' strengths, for a creature''s strength can also be its weakness.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer - End of talk'), +(27784,6,0, 'Sapphiron. Once a noble blue dragon within the mountains of Northrend, Sapphiron was slain by Arthas during his campaign through the frozen north. Resurrected to serve him, Sapphiron guards Kel''Thuzad''s lair eternally, awaiting those who would dare tresspass upon his master.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,7,0, 'The Lich, Kel''Thuzad. He serves the Lich King without question, a necromancer of great prowess in life, turned to a master of necromancy after his death. It is said he is the most loyal of the Lich King''s subjects.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,8,0, 'Kel''Thuzad has survived trials that would have long since shattered the souls of even the greatest of the Brotherhood. He readily gave his life at Arthas''s hand, later to be brought back - reborn in the power of the Sunwell.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,9,0, 'In the plaguelands, Kel''Thuzad was again defeated by the agents of the Argent Dawn. However, his phylactery was delivered to a false agent of the brotherhood. We have yet to discover who stole his phylactery or why.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,10,0, 'Pay attention. This is Instructor Razuvious, Kel''Thuzad''s appointed trainer of all death knights. It is said that his own technique is so potent, only a disciple of his could possibly withstand his might.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,11,0, 'Gothik, the Harvester. A master of necromancy and conjuration, Gothik is said to be able to beckon forth legions of the undead at a moment''s notice. It is with his guidance that even the weakest of Death Knights can raise the dead.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,12,0, 'The most powerful Death Knights within Naxxramas are the four horsemen. They represent the pinnacle of Kel''Thuzad''s guard. The first, Thane Korth''azz, holds the power of flame.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,13,0, 'The next, Lady Blaumeux, calls forth the power of shadows, drawing the souls of the living into the voracious embrace.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,14,0, 'Sir Zeliek, a paladin in life, so strong in his faith, that even in undeath, the power of the light still heeds his call, smiting his foes in battle.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,15,0, 'The final Death Knight, Lord Mograine, was the finest warrior that the Death Knights had ever seen. However, after the events in Azeroth, he vanished without a trace. Kel''Thuzad has appointed Baron Rivendare in his place.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,16,0, 'Behold, Patchwerk. When word of his existence first reached the ears of the Brotherhood, none believed the tales of an abomination with such immense speed and strength. Fewer still believed it when he fell the first time...',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,17,0, 'Grobbulus, the first of what was to be an army of flesh giants. It carried the plague slime of Naxxramas within its body, injecting the living ooze into the bodies of its foe. The recipient of this foul injection would usually flee to his allies, bringing them down with him.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,18,0, 'Gluth, the foul plague-dog of Naxxramas, was said to have an appetitie so voracious that even the living were not enough to satisfy his hunger. Feugen was said to feed him an army of Zombies daily, recycling the remains of undead too weak to use in combat.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,19,0, 'Thaddius, built from the flesh of women and children, it is said that their souls are fused together - eternally bound within that foul prison of flesh.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,20,0, 'Anub''Rekhan, one of the finest Spider Lords of Azjol''Nerub, was brought under the control of the Scourge when he and his former commander, Anub''arak, were finally defeated by the Lich King many years ago. It is said that he was the most loyal of Anub''arak''s commanders.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,21,0, 'The Grand Widow Faerlina, a botanist in life, breeder and caretaker of arachnids in death, she oversees the spider wing, developing the most potent of poisons for the Lich King.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,22,0, 'Maexxna, born deep within the mountains of Northrend many ages ago, she was captured within the dread citadel Naxxramas, where she gives birth to her brood, feeding them the corpses of all who dare venture too deeply into Naxxramas.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,23,0, 'Behold, Noth, the Plaguebringer. Responsible for the creation of the process that distills the souls of the living and places them within the cold cage of undeath, Noth was observed to be refining this process even now.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,24,0, 'Observe, Heigan the Unclean. The mastermind behind the plague cauldrons that turned the wilderness of Azeroth into the Plaguelands.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,25,0, 'It is said that Heigan has rigged the very walls and floors of Naxxramas itself with a vast array of traps, which he can trigger at will.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'), +(27784,26,0, 'Loatheb. The hideous result of fusing the living plague of the plaguelands with the bog beasts of Azeroth, Loatheb is said to control the power of healing itself.',12,7,100,0,0,0, 'Commander Eligor Dawnbringer'); + +-- 7th Legion Sentinel SAI +SET @ENTRY := 27162; +UPDATE `creature_template` SET `AIName`="SmartAI" WHERE `entry`=@ENTRY; +DELETE FROM `creature_addon` WHERE `guid` IN (SELECT `guid` FROM `creature` WHERE `id`=@ENTRY) AND `emote`=376; +DELETE FROM `creature_template_addon` WHERE `entry`=@ENTRY; +INSERT INTO `creature_template_addon` (`entry`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES (@ENTRY,0,258,376, ''); +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,11,0,100,0,0,0,0,0,11,18950,0,0,0,0,0,1,0,0,0,0,0,0,0,"7th Legion Sentinel - On Spawn - Cast Invisibility and Stealth Detection"), +(@ENTRY,0,1,0,0,0,100,0,0,0,2300,3900,11,15547,64,0,0,0,0,2,0,0,0,0,0,0,0,"7th Legion Sentinel - In Combat CMC - Cast Shoot"), +(@ENTRY,0,2,0,0,0,100,0,9000,14000,17000,22000,11,49481,1,0,0,0,0,5,0,0,0,0,0,0,0,"7th Legion Sentinel - In Combat - Cast Glaive Throw"); + +-- Remove some duplicate spawns +DELETE FROM `creature` WHERE `guid` IN (131126, 131132, 131133, 131251, 131253, 131182, 131183, 107389, 107814, 131184, 131249); +DELETE FROM `creature_addon` WHERE `guid` IN (131126, 131132, 131133, 131251, 131253, 131182, 131183, 107389, 107814, 131184, 131249); + +-- remove random movement +UPDATE `creature` SET `spawndist`=0, `MovementType`=0 WHERE `guid`=133347; + +UPDATE `creature` SET `id`=27776 WHERE `guid`=107609; +UPDATE `creature` SET `modelid`=0, `curhealth`=1 WHERE `id` IN (27766,27768,27773,27776,27779); +UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry` IN (27766,27768,27773,27776,27779); + +UPDATE `creature_template` SET `InhabitType`=4 WHERE `entry` BETWEEN 27766 AND 27782; +DELETE FROM `creature_template_addon` WHERE `entry` BETWEEN 27766 AND 27782; +INSERT INTO `creature_template_addon` (`entry`,`bytes1`,`bytes2`) VALUES +(27766,0,1),(27767,0,1),(27768,0,1),(27769,0,1),(27770,0,1),(27771,0,1), +(27772,0,1),(27773,0,1),(27774,0,1),(27775,0,1),(27776,0,1),(27777,0,1), +(27778,0,1),(27779,0,1),(27780,0,1),(27781,0,1),(27782,0,1); + +-- Commander Eligor Dawnbringer and gang +UPDATE `creature` SET `position_x`=3798.05,`position_y`=-680.611,`position_z`=222.9825, `orientation`=6.038839 WHERE `guid`=133420; +UPDATE `creature` SET `orientation`=3.384053 WHERE `guid`=131157; +UPDATE `creature` SET `orientation`=3.649463 WHERE `guid`=131171; +UPDATE `creature` SET `orientation`=3.633209 WHERE `guid`=133210; +UPDATE `creature` SET `orientation`=1.793558 WHERE `guid`=131154; +UPDATE `creature` SET `orientation`=1.942263 WHERE `guid`=131155; +UPDATE `creature` SET `orientation`=2.368085 WHERE `guid`=131170; +UPDATE `creature` SET `orientation`=2.026036 WHERE `guid`=133225; +UPDATE `creature` SET `orientation`=3.397538 WHERE `guid`=133227; +UPDATE `creature` SET `orientation`=3.839286 WHERE `guid`=131172; +UPDATE `creature` SET `orientation`=2.225338 WHERE `guid`=131173; + +-- Condition for spell targets +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=49519; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 1, 49519, 0, 0, 31, 0, 3, 23033, 0, 0, 0, 0, '', 'Heroic Image Channel Targets Invisible Stalker (Floating)'); + +-- Pathing for Invisible Stalker (Floating) Entry: 23033 +SET @NPC := 131250; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=3804.403,`position_y`=-695.9564,`position_z`=224.0008 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,1,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,3804.403,-695.9564,224.0008,0,0,0,0,100,0), +(@PATH,2,3805.12,-693.7753,224.1427,0,0,0,0,100,0), +(@PATH,3,3807.3,-691.3777,224.4204,0,0,0,0,100,0), +(@PATH,4,3811.286,-692.7845,224.0623,0,0,0,0,100,0), +(@PATH,5,3813.058,-695.1207,224.999,0,0,0,0,100,0), +(@PATH,6,3813.632,-697.7827,224.9997,0,0,0,0,100,0), +(@PATH,7,3812.425,-700.1073,224.0008,0,0,0,0,100,0), +(@PATH,8,3809.649,-700.7341,224.0008,0,0,0,0,100,0), +(@PATH,9,3805.123,-698.4109,224.0008,0,0,0,0,100,0); + +-- Pathing for Invisible Stalker (Floating) Entry: 23033 +SET @NPC := 131252; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=3804.225,`position_y`=-669.8109,`position_z`=224.8465 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,1,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,3804.225,-669.8109,224.8465,0,0,0,0,100,0), +(@PATH,2,3806.744,-669.3193,224.8465,0,0,0,0,100,0), +(@PATH,3,3809.637,-670.4093,224.8465,0,0,0,0,100,0), +(@PATH,4,3810.651,-674.6262,224.8465,0,0,0,0,100,0), +(@PATH,5,3808.057,-677.2673,224.8465,0,0,0,0,100,0), +(@PATH,6,3804.191,-676.4904,224.8465,0,0,0,0,100,0), +(@PATH,7,3802.311,-673.4647,224.8465,0,0,0,0,100,0); + +-- Pathing for Invisible Stalker (Floating) Entry: 23033 +SET @NPC := 133899; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=3816.468,`position_y`=-672.7212,`position_z`=224.0009 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,1,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,3816.468,-672.7212,224.0009,0,0,0,0,100,0), +(@PATH,2,3819.056,-673.5551,222.9989,0,0,0,0,100,0), +(@PATH,3,3820.681,-676.2151,224.0009,0,0,0,0,100,0), +(@PATH,4,3819.998,-679.0777,224.0009,0,0,0,0,100,0), +(@PATH,5,3815.454,-680.2464,224.0009,0,0,0,0,100,0), +(@PATH,6,3813.004,-677.2374,224.0009,0,0,0,0,100,0), +(@PATH,7,3814.027,-673.7756,224.0009,0,0,0,0,100,0); + +-- Pathing for Invisible Stalker (Floating) Entry: 23033 +SET @NPC := 133894; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=3805.747,`position_y`=-687.1393,`position_z`=224.1568 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,1,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,3805.747,-687.1393,224.1568,0,0,0,0,100,0), +(@PATH,2,3804.891,-684.0416,224.1568,0,0,0,0,100,0), +(@PATH,3,3807.519,-679.4173,224.1568,0,0,0,0,100,0), +(@PATH,4,3811.978,-681.2499,224.1568,0,0,0,0,100,0), +(@PATH,5,3811.325,-686.3337,224.1568,0,0,0,0,100,0), +(@PATH,6,3808.847,-687.7697,224.1568,0,0,0,0,100,0); + +-- Pathing for Invisible Stalker (Floating) Entry: 23033 +SET @NPC := 133900; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=3794.607,`position_y`=-693.5101,`position_z`=224.7538 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,1,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`orientation`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,3794.607,-693.5101,224.7538,0,0,0,0,100,0), +(@PATH,2,3794.899,-689.9442,224.7538,0,0,0,0,100,0), +(@PATH,3,3798.899,-687.9035,224.7538,0,0,0,0,100,0), +(@PATH,4,3802.577,-690.2576,224.7538,0,0,0,0,100,0), +(@PATH,5,3801.8,-694.2828,224.7538,0,0,0,0,100,0), +(@PATH,6,3797.656,-695.3698,224.7538,0,0,0,0,100,0); diff --git a/src/server/scripts/Northrend/zone_dragonblight.cpp b/src/server/scripts/Northrend/zone_dragonblight.cpp index 76ce586aa9d..2c311e20a79 100644 --- a/src/server/scripts/Northrend/zone_dragonblight.cpp +++ b/src/server/scripts/Northrend/zone_dragonblight.cpp @@ -37,6 +37,331 @@ EndContentData */ #include "CombatAI.h" #include "Player.h" +/*##### +# npc_commander_eligor_dawnbringer +#####*/ + +enum CommanderEligorDawnbringer +{ + MODEL_IMAGE_OF_KELTHUZAD = 24787, // Image of Kel'Thuzad + MODEL_IMAGE_OF_SAPPHIRON = 24788, // Image of Sapphiron + MODEL_IMAGE_OF_RAZUVIOUS = 24799, // Image of Razuvious + MODEL_IMAGE_OF_GOTHIK = 24804, // Image of Gothik + MODEL_IMAGE_OF_THANE = 24802, // Image of Thane Korth'azz + MODEL_IMAGE_OF_BLAUMEUX = 24794, // Image of Lady Blaumeux + MODEL_IMAGE_OF_ZELIEK = 24800, // Image of Sir Zeliek + MODEL_IMAGE_OF_PATCHWERK = 24798, // Image of Patchwerk + MODEL_IMAGE_OF_GROBBULUS = 24792, // Image of Grobbulus + MODEL_IMAGE_OF_THADDIUS = 24801, // Image of Thaddius + MODEL_IMAGE_OF_GLUTH = 24803, // Image of Gluth + MODEL_IMAGE_OF_ANUBREKHAN = 24789, // Image of Anub'rekhan + MODEL_IMAGE_OF_FAERLINA = 24790, // Image of Faerlina + MODEL_IMAGE_OF_MAEXXNA = 24796, // Image of Maexxna + MODEL_IMAGE_OF_NOTH = 24797, // Image of Noth + MODEL_IMAGE_OF_HEIGAN = 24793, // Image of Heigan + MODEL_IMAGE_OF_LOATHEB = 24795, // Image of Loatheb + + NPC_IMAGE_OF_KELTHUZAD = 27766, // Image of Kel'Thuzad + NPC_IMAGE_OF_SAPPHIRON = 27767, // Image of Sapphiron + NPC_IMAGE_OF_RAZUVIOUS = 27768, // Image of Razuvious + NPC_IMAGE_OF_GOTHIK = 27769, // Image of Gothik + NPC_IMAGE_OF_THANE = 27770, // Image of Thane Korth'azz + NPC_IMAGE_OF_BLAUMEUX = 27771, // Image of Lady Blaumeux + NPC_IMAGE_OF_ZELIEK = 27772, // Image of Sir Zeliek + NPC_IMAGE_OF_PATCHWERK = 27773, // Image of Patchwerk + NPC_IMAGE_OF_GROBBULUS = 27774, // Image of Grobbulus + NPC_IMAGE_OF_THADDIUS = 27775, // Image of Thaddius + NPC_IMAGE_OF_GLUTH = 27782, // Image of Gluth + NPC_IMAGE_OF_ANUBREKHAN = 27776, // Image of Anub'rekhan + NPC_IMAGE_OF_FAERLINA = 27777, // Image of Faerlina + NPC_IMAGE_OF_MAEXXNA = 27778, // Image of Maexxna + NPC_IMAGE_OF_NOTH = 27779, // Image of Noth + NPC_IMAGE_OF_HEIGAN = 27780, // Image of Heigan + NPC_IMAGE_OF_LOATHEB = 27781, // Image of Loatheb + + NPC_INFANTRYMAN = 27160, // Add in case I randomize the spawning + NPC_SENTINAL = 27162, + NPC_BATTLE_MAGE = 27164, + + // Five platforms to choose from + SAY_PINNACLE = 0, + SAY_DEATH_KNIGHT_WING = 1, + SAY_ABOMINATION_WING = 2, + SAY_SPIDER_WING = 3, + SAY_PLAGUE_WING = 4, + // Used in all talks + SAY_TALK_COMPLETE = 5, + // Pinnacle of Naxxramas + SAY_SAPPHIRON = 6, + SAY_KELTHUZAD_1 = 7, + SAY_KELTHUZAD_2 = 8, + SAY_KELTHUZAD_3 = 9, + // Death knight wing of Naxxramas + SAY_RAZUVIOUS = 10, + SAY_GOTHIK = 11, + SAY_DEATH_KNIGHTS_1 = 12, + SAY_DEATH_KNIGHTS_2 = 13, + SAY_DEATH_KNIGHTS_3 = 14, + SAY_DEATH_KNIGHTS_4 = 15, + // Blighted abomination wing of Naxxramas + SAY_PATCHWERK = 16, + SAY_GROBBULUS = 17, + SAY_GLUTH = 18, + SAY_THADDIUS = 19, + // Accursed spider wing of Naxxramas + SAY_ANUBREKHAN = 20, + SAY_FAERLINA = 21, + SAY_MAEXXNA = 22, + // Dread plague wing of Naxxramas + SAY_NOTH = 23, + SAY_HEIGAN_1 = 24, + SAY_HEIGAN_2 = 25, + SAY_LOATHEB = 26, + + SPELL_HEROIC_IMAGE_CHANNEL = 49519, + + EVENT_START_RANDOM = 1, + EVENT_MOVE_TO_POINT = 2, + EVENT_TALK_COMPLETE = 3, + EVENT_GET_TARGETS = 4, + EVENT_KELTHUZAD_2 = 5, + EVENT_KELTHUZAD_3 = 6, + EVENT_DEATH_KNIGHTS_2 = 7, + EVENT_DEATH_KNIGHTS_3 = 8, + EVENT_DEATH_KNIGHTS_4 = 9, + EVENT_HEIGAN_2 = 10 +}; + +uint32 const AudienceMobs[3] = { NPC_INFANTRYMAN, NPC_SENTINAL, NPC_BATTLE_MAGE }; + +Position const PosTalkLocations[6] = +{ + { 3805.453f, -682.9075f, 222.2917f, 2.793398f }, // Pinnacle of Naxxramas + { 3807.508f, -691.0882f, 221.9688f, 2.094395f }, // Death knight wing of Naxxramas + { 3797.228f, -690.3555f, 222.5019f, 1.134464f }, // Blighted abomination wing of Naxxramas + { 3804.038f, -672.3098f, 222.5019f, 4.578917f }, // Accursed spider wing of Naxxramas + { 3815.097f, -680.2596f, 221.9777f, 2.86234f }, // Dread plague wing of Naxxramas + { 3798.05f, -680.611f, 222.9825f, 6.038839f }, // Home +}; + +class npc_commander_eligor_dawnbringer : public CreatureScript +{ + public: npc_commander_eligor_dawnbringer() : CreatureScript("npc_commander_eligor_dawnbringer") {} + + struct npc_commander_eligor_dawnbringerAI : public ScriptedAI + { + npc_commander_eligor_dawnbringerAI(Creature* creature) : ScriptedAI(creature) { } + + void Reset() OVERRIDE + { + talkWing = 0; + memset(audienceList, 0, sizeof(audienceList)); + memset(imageList, 0, sizeof(imageList)); + _events.ScheduleEvent(EVENT_GET_TARGETS, 5000); + _events.ScheduleEvent(EVENT_START_RANDOM, 20000); + } + + void MovementInform(uint32 type, uint32 id) OVERRIDE + { + if (type == POINT_MOTION_TYPE) + { + if (id == 1) + { + me->SetFacingTo(PosTalkLocations[talkWing].m_orientation); + TurnAudience(); + + switch (talkWing) + { + case 0: // Pinnacle of Naxxramas + { + switch (urand (0, 1)) + { + case 0: ChangeImage(NPC_IMAGE_OF_KELTHUZAD, MODEL_IMAGE_OF_KELTHUZAD, SAY_KELTHUZAD_1); + _events.ScheduleEvent(EVENT_KELTHUZAD_2, 8000); break; + case 1: ChangeImage(NPC_IMAGE_OF_SAPPHIRON, MODEL_IMAGE_OF_SAPPHIRON, SAY_SAPPHIRON); break; + } + } + break; + case 1: // Death knight wing of Naxxramas + { + switch (urand (0, 2)) + { + case 0: ChangeImage(NPC_IMAGE_OF_RAZUVIOUS, MODEL_IMAGE_OF_RAZUVIOUS, SAY_RAZUVIOUS); break; + case 1: ChangeImage(NPC_IMAGE_OF_GOTHIK, MODEL_IMAGE_OF_GOTHIK, SAY_GOTHIK); break; + case 2: ChangeImage(NPC_IMAGE_OF_THANE, MODEL_IMAGE_OF_THANE, SAY_DEATH_KNIGHTS_1); + _events.ScheduleEvent(EVENT_DEATH_KNIGHTS_2, 10000); break; + } + } + break; + case 2: // Blighted abomination wing of Naxxramas + { + switch (urand (0, 3)) + { + case 0: ChangeImage(NPC_IMAGE_OF_PATCHWERK, MODEL_IMAGE_OF_PATCHWERK, SAY_PATCHWERK); break; + case 1: ChangeImage(NPC_IMAGE_OF_GROBBULUS, MODEL_IMAGE_OF_GROBBULUS, SAY_GROBBULUS); break; + case 2: ChangeImage(NPC_IMAGE_OF_THADDIUS, MODEL_IMAGE_OF_THADDIUS, SAY_THADDIUS); break; + case 3: ChangeImage(NPC_IMAGE_OF_GLUTH, MODEL_IMAGE_OF_GLUTH, SAY_GLUTH); break; + } + } + break; + case 3: // Accursed spider wing of Naxxramas + { + switch (urand (0, 2)) + { + case 0: ChangeImage(NPC_IMAGE_OF_ANUBREKHAN, MODEL_IMAGE_OF_ANUBREKHAN, SAY_ANUBREKHAN); break; + case 1: ChangeImage(NPC_IMAGE_OF_FAERLINA, MODEL_IMAGE_OF_FAERLINA, SAY_FAERLINA); break; + case 2: ChangeImage(NPC_IMAGE_OF_MAEXXNA, MODEL_IMAGE_OF_MAEXXNA, SAY_MAEXXNA); break; + } + } + break; + case 4: // Dread plague wing of Naxxramas + { + switch (urand (0, 2)) + { + case 0: ChangeImage(NPC_IMAGE_OF_NOTH, MODEL_IMAGE_OF_NOTH, SAY_NOTH); break; + case 1: ChangeImage(NPC_IMAGE_OF_HEIGAN, MODEL_IMAGE_OF_HEIGAN, SAY_HEIGAN_1); + _events.ScheduleEvent(EVENT_HEIGAN_2, 8000); break; + case 2: ChangeImage(NPC_IMAGE_OF_LOATHEB, MODEL_IMAGE_OF_LOATHEB, SAY_LOATHEB); break; + } + } + break; + case 5: // Home + _events.ScheduleEvent(EVENT_START_RANDOM, 30000); + break; + } + } + } + } + + void StoreTargets() + { + uint8 creaturecount; + + creaturecount = 0; + + for (uint8 ii = 0; ii < 3; ++ii) + { + std::list creatureList; + GetCreatureListWithEntryInGrid(creatureList, me, AudienceMobs[ii], 15.0f); + for (std::list::iterator itr = creatureList.begin(); itr != creatureList.end(); ++itr) + { + if (Creature* creatureList = *itr) + { + audienceList[creaturecount] = creatureList->GetGUID(); + ++creaturecount; + } + } + } + + if (Creature* creature = me->FindNearestCreature(NPC_IMAGE_OF_KELTHUZAD, 20.0f, true)) + imageList[0] = creature->GetGUID(); + if (Creature* creature = me->FindNearestCreature(NPC_IMAGE_OF_RAZUVIOUS, 20.0f, true)) + imageList[1] = creature->GetGUID(); + if (Creature* creature = me->FindNearestCreature(NPC_IMAGE_OF_PATCHWERK, 20.0f, true)) + imageList[2] = creature->GetGUID(); + if (Creature* creature = me->FindNearestCreature(NPC_IMAGE_OF_ANUBREKHAN, 20.0f, true)) + imageList[3] = creature->GetGUID(); + if (Creature* creature = me->FindNearestCreature(NPC_IMAGE_OF_NOTH, 20.0f, true)) + imageList[4] = creature->GetGUID(); + } + + void ChangeImage(uint32 entry, uint32 model, uint8 text) + { + if (Creature* creature = ObjectAccessor::GetCreature(*me, imageList[talkWing])) + { + Talk(text); + creature->SetEntry(entry); + creature->SetDisplayId(model); + creature->CastSpell(creature, SPELL_HEROIC_IMAGE_CHANNEL); + _events.ScheduleEvent(EVENT_TALK_COMPLETE, 40000); + } + } + + void TurnAudience() + { + for (uint8 i = 0; i < 10; ++i) + { + if (Creature* creature = ObjectAccessor::GetCreature(*me, audienceList[i])) + creature->SetFacingToObject(me); + } + } + + void UpdateAI(uint32 diff) OVERRIDE + { + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_START_RANDOM: + talkWing = urand (0, 4); + Talk(talkWing); + _events.ScheduleEvent(EVENT_MOVE_TO_POINT, 8000); + break; + case EVENT_MOVE_TO_POINT: + me->SetWalk(true); + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(1, PosTalkLocations[talkWing].m_positionX, PosTalkLocations[talkWing].m_positionY, PosTalkLocations[talkWing].m_positionZ); + break; + case EVENT_TALK_COMPLETE: + talkWing = 5; + Talk(talkWing); + _events.ScheduleEvent(EVENT_MOVE_TO_POINT, 5000); + break; + case EVENT_GET_TARGETS: + StoreTargets(); + break; + case EVENT_KELTHUZAD_2: + Talk(SAY_KELTHUZAD_2); + _events.ScheduleEvent(EVENT_KELTHUZAD_3, 8000); + break; + case EVENT_KELTHUZAD_3: + Talk(SAY_KELTHUZAD_3); + break; + case EVENT_DEATH_KNIGHTS_2: + Talk(SAY_DEATH_KNIGHTS_2); + if (Creature* creature = ObjectAccessor::GetCreature(*me, imageList[talkWing])) + { + creature->SetEntry(NPC_IMAGE_OF_BLAUMEUX); + creature->SetDisplayId(MODEL_IMAGE_OF_BLAUMEUX); + } + _events.ScheduleEvent(EVENT_DEATH_KNIGHTS_3, 10000); + break; + case EVENT_DEATH_KNIGHTS_3: + Talk(SAY_DEATH_KNIGHTS_3); + if (Creature* creature = ObjectAccessor::GetCreature(*me, imageList[talkWing])) + { + creature->SetEntry(NPC_IMAGE_OF_ZELIEK); + creature->SetDisplayId(MODEL_IMAGE_OF_ZELIEK); + } + _events.ScheduleEvent(EVENT_DEATH_KNIGHTS_4, 10000); + break; + case EVENT_DEATH_KNIGHTS_4: + Talk(SAY_DEATH_KNIGHTS_4); + break; + case EVENT_HEIGAN_2: + Talk(SAY_HEIGAN_2); + break; + default: + break; + } + } + DoMeleeAttackIfReady(); + } + private: + EventMap _events; + uint64 audienceList[10]; + uint64 imageList[5]; + uint8 talkWing; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return new npc_commander_eligor_dawnbringerAI(creature); + } +}; + enum AlexstraszaWrGate { // Quest @@ -405,9 +730,10 @@ class npc_torturer_lecraft : public CreatureScript void AddSC_dragonblight() { - new npc_alexstrasza_wr_gate; - new spell_q12096_q12092_dummy; - new spell_q12096_q12092_bark; - new npc_wyrmrest_defender; - new npc_torturer_lecraft; + new npc_commander_eligor_dawnbringer(); + new npc_alexstrasza_wr_gate(); + new spell_q12096_q12092_dummy(); + new spell_q12096_q12092_bark(); + new npc_wyrmrest_defender(); + new npc_torturer_lecraft(); } -- cgit v1.2.3