diff options
23 files changed, 425 insertions, 396 deletions
diff --git a/sql/updates/world/2015_12_09_00_world.sql b/sql/updates/world/2015_12_09_00_world.sql new file mode 100644 index 00000000000..cfa8399c350 --- /dev/null +++ b/sql/updates/world/2015_12_09_00_world.sql @@ -0,0 +1,5 @@ +UPDATE `creature_template` SET `ScriptName`='npc_brann_bronzebeard_ulduar_intro' WHERE `entry`=33579; +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=48750 AND `spell_effect`=48770; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_gen_burning_depths_necrolyte_image'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(48750, 'spell_gen_burning_depths_necrolyte_image'); diff --git a/src/common/Common.h b/src/common/Common.h index 09d64acc795..4c209f89ec8 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -39,6 +39,7 @@ #include <sstream> #include <algorithm> #include <memory> +#include <vector> #include "Debugging/Errors.h" diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index d9061dfb106..e268b376b34 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -570,7 +570,7 @@ void LoadDBCStores(const std::string& dataPath) // fill data for (uint32 i = 1; i < sTaxiPathNodeStore.GetNumRows(); ++i) if (TaxiPathNodeEntry const* entry = sTaxiPathNodeStore.LookupEntry(i)) - sTaxiPathNodesByPath[entry->PathID].set(entry->NodeIndex, entry); + sTaxiPathNodesByPath[entry->PathID][entry->NodeIndex] = entry; // Initialize global taxinodes mask // include existed nodes that have at least single not spell base (scripted) path diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index c680494cd72..092ef714145 100644 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -22,13 +22,8 @@ #include "Common.h" #include "DBCEnums.h" #include "Define.h" -#include "Path.h" #include "Util.h" -#include <map> -#include <set> -#include <vector> - // Structures using to access raw DBC data and required packing to portability #pragma pack(push, 1) @@ -2211,15 +2206,7 @@ struct TaxiPathBySourceAndDestination typedef std::map<uint32, TaxiPathBySourceAndDestination> TaxiPathSetForSource; typedef std::map<uint32, TaxiPathSetForSource> TaxiPathSetBySource; -struct TaxiPathNodePtr -{ - TaxiPathNodePtr() : i_ptr(NULL) { } - TaxiPathNodePtr(TaxiPathNodeEntry const* ptr) : i_ptr(ptr) { } - TaxiPathNodeEntry const* i_ptr; - operator TaxiPathNodeEntry const& () const { return *i_ptr; } -}; - -typedef Path<TaxiPathNodePtr, TaxiPathNodeEntry const> TaxiPathNodeList; +typedef std::vector<TaxiPathNodeEntry const*> TaxiPathNodeList; typedef std::vector<TaxiPathNodeList> TaxiPathNodesByPath; #define TaxiMaskSize 14 diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index a4f55d0c257..9556a55c4e1 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -21158,6 +21158,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc // fill destinations path tail uint32 sourcepath = 0; uint32 totalcost = 0; + uint32 firstcost = 0; uint32 prevnode = sourcenode; uint32 lastnode = 0; @@ -21176,6 +21177,8 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc } totalcost += cost; + if (i == 1) + firstcost = cost; if (prevnode == sourcenode) sourcepath = path; @@ -21214,8 +21217,6 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc } //Checks and preparations done, DO FLIGHT - ModifyMoney(-(int32)totalcost); - UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING, totalcost); UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_FLIGHT_PATHS_TAKEN, 1); // prevent stealth flight @@ -21226,11 +21227,15 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc TaxiNodesEntry const* lastPathNode = sTaxiNodesStore.LookupEntry(nodes[nodes.size()-1]); ASSERT(lastPathNode); m_taxi.ClearTaxiDestinations(); + ModifyMoney(-(int32)totalcost); + UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING, totalcost); TeleportTo(lastPathNode->map_id, lastPathNode->x, lastPathNode->y, lastPathNode->z, GetOrientation()); return false; } else { + ModifyMoney(-(int32)firstcost); + UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING, firstcost); GetSession()->SendActivateTaxiReply(ERR_TAXIOK); GetSession()->SendDoFlight(mount_display_id, sourcepath); } @@ -21281,30 +21286,30 @@ void Player::ContinueTaxiFlight() float distPrev = MAP_SIZE*MAP_SIZE; float distNext = - (nodeList[0].LocX-GetPositionX())*(nodeList[0].LocX-GetPositionX())+ - (nodeList[0].LocY-GetPositionY())*(nodeList[0].LocY-GetPositionY())+ - (nodeList[0].LocZ-GetPositionZ())*(nodeList[0].LocZ-GetPositionZ()); + (nodeList[0]->LocX - GetPositionX())*(nodeList[0]->LocX - GetPositionX()) + + (nodeList[0]->LocY - GetPositionY())*(nodeList[0]->LocY - GetPositionY()) + + (nodeList[0]->LocZ - GetPositionZ())*(nodeList[0]->LocZ - GetPositionZ()); for (uint32 i = 1; i < nodeList.size(); ++i) { - TaxiPathNodeEntry const& node = nodeList[i]; - TaxiPathNodeEntry const& prevNode = nodeList[i-1]; + TaxiPathNodeEntry const* node = nodeList[i]; + TaxiPathNodeEntry const* prevNode = nodeList[i-1]; // skip nodes at another map - if (node.MapID != GetMapId()) + if (node->MapID != GetMapId()) continue; distPrev = distNext; distNext = - (node.LocX-GetPositionX())*(node.LocX-GetPositionX())+ - (node.LocY-GetPositionY())*(node.LocY-GetPositionY())+ - (node.LocZ-GetPositionZ())*(node.LocZ-GetPositionZ()); + (node->LocX - GetPositionX())*(node->LocX - GetPositionX()) + + (node->LocY - GetPositionY())*(node->LocY - GetPositionY()) + + (node->LocZ - GetPositionZ())*(node->LocZ - GetPositionZ()); float distNodes = - (node.LocX-prevNode.LocX)*(node.LocX-prevNode.LocX)+ - (node.LocY-prevNode.LocY)*(node.LocY-prevNode.LocY)+ - (node.LocZ-prevNode.LocZ)*(node.LocZ-prevNode.LocZ); + (node->LocX - prevNode->LocX)*(node->LocX - prevNode->LocX) + + (node->LocY - prevNode->LocY)*(node->LocY - prevNode->LocY) + + (node->LocZ - prevNode->LocZ)*(node->LocZ - prevNode->LocZ); if (distNext + distPrev < distNodes) { diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index a031840a1d8..94d0fa5697c 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -952,6 +952,8 @@ class PlayerTaxi m_TaxiDestinations.pop_front(); return GetTaxiDestination(); } + + std::deque<uint32> const& GetPath() const { return m_TaxiDestinations; } bool empty() const { return m_TaxiDestinations.empty(); } friend std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi); diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 7b701f681b5..85d770e2ceb 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -3990,7 +3990,7 @@ void ObjectMgr::LoadQuests() "ItemDrop1, ItemDrop2, ItemDrop3, ItemDrop4, ItemDropQuantity1, ItemDropQuantity2, ItemDropQuantity3, ItemDropQuantity4, " // 87 88 89 90 91 92 93 94 95 96 97 98 "RequiredItemId1, RequiredItemId2, RequiredItemId3, RequiredItemId4, RequiredItemId5, RequiredItemId6, RequiredItemCount1, RequiredItemCount2, RequiredItemCount3, RequiredItemCount4, RequiredItemCount5, RequiredItemCount6, " - // 99 100 101 102 103 + // 99 100 101 102 103 "Unknown0, ObjectiveText1, ObjectiveText2, ObjectiveText3, ObjectiveText4" " FROM quest_template"); if (!result) @@ -4011,7 +4011,7 @@ void ObjectMgr::LoadQuests() } while (result->NextRow()); std::map<uint32, uint32> usedMailTemplates; - + // Load `quest_details` // 0 1 2 3 4 5 6 7 8 result = WorldDatabase.Query("SELECT ID, Emote1, Emote2, Emote3, Emote4, EmoteDelay1, EmoteDelay2, EmoteDelay3, EmoteDelay4 FROM quest_details"); @@ -5090,13 +5090,13 @@ void ObjectMgr::LoadEventScripts() { for (size_t node_idx = 0; node_idx < sTaxiPathNodesByPath[path_idx].size(); ++node_idx) { - TaxiPathNodeEntry const& node = sTaxiPathNodesByPath[path_idx][node_idx]; + TaxiPathNodeEntry const* node = sTaxiPathNodesByPath[path_idx][node_idx]; - if (node.ArrivalEventID) - evt_scripts.insert(node.ArrivalEventID); + if (node->ArrivalEventID) + evt_scripts.insert(node->ArrivalEventID); - if (node.DepartureEventID) - evt_scripts.insert(node.DepartureEventID); + if (node->DepartureEventID) + evt_scripts.insert(node->DepartureEventID); } } diff --git a/src/server/game/Handlers/TaxiHandler.cpp b/src/server/game/Handlers/TaxiHandler.cpp index af0f5b0fc75..a671250c17d 100644 --- a/src/server/game/Handlers/TaxiHandler.cpp +++ b/src/server/game/Handlers/TaxiHandler.cpp @@ -24,7 +24,6 @@ #include "Log.h" #include "ObjectMgr.h" #include "Player.h" -#include "Path.h" #include "WaypointMovementGenerator.h" void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvData) @@ -212,7 +211,7 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData) MovementInfo movementInfo; // used only for proper packet read ReadMovementInfo(recvData, &movementInfo); - recvData.read_skip<uint32>(); // unk + recvData.read_skip<uint32>(); // spline id // in taxi flight packet received in 2 case: // 1) end taxi path in far (multi-node) flight @@ -220,59 +219,32 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData) // we need process only (1) uint32 curDest = GetPlayer()->m_taxi.GetTaxiDestination(); - if (!curDest) - return; - - TaxiNodesEntry const* curDestNode = sTaxiNodesStore.LookupEntry(curDest); - - // far teleport case - if (curDestNode && curDestNode->map_id != GetPlayer()->GetMapId()) + if (curDest) { - if (GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE) - { - // short preparations to continue flight - FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top()); - - flight->SetCurrentNodeAfterTeleport(); - TaxiPathNodeEntry const& node = flight->GetPath()[flight->GetCurrentNode()]; - flight->SkipCurrentNode(); + TaxiNodesEntry const* curDestNode = sTaxiNodesStore.LookupEntry(curDest); - GetPlayer()->TeleportTo(curDestNode->map_id, node.LocX, node.LocY, node.LocZ, GetPlayer()->GetOrientation()); - } - return; - } - - uint32 destinationnode = GetPlayer()->m_taxi.NextTaxiDestination(); - if (destinationnode > 0) // if more destinations to go - { - // current source node for next destination - uint32 sourcenode = GetPlayer()->m_taxi.GetTaxiSource(); - - // Add to taximask middle hubs in taxicheat mode (to prevent having player with disabled taxicheat and not having back flight path) - if (GetPlayer()->isTaxiCheater()) + // far teleport case + if (curDestNode && curDestNode->map_id != GetPlayer()->GetMapId()) { - if (GetPlayer()->m_taxi.SetTaximaskNode(sourcenode)) + if (GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE) { - WorldPacket data(SMSG_NEW_TAXI_PATH, 0); - _player->GetSession()->SendPacket(&data); - } - } + // short preparations to continue flight + FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top()); - TC_LOG_DEBUG("network", "WORLD: Taxi has to go from %u to %u", sourcenode, destinationnode); + flight->SetCurrentNodeAfterTeleport(); + TaxiPathNodeEntry const* node = flight->GetPath()[flight->GetCurrentNode()]; + flight->SkipCurrentNode(); - uint32 mountDisplayId = sObjectMgr->GetTaxiMountDisplayId(sourcenode, GetPlayer()->GetTeam()); - - uint32 path, cost; - sObjectMgr->GetTaxiPath(sourcenode, destinationnode, path, cost); + GetPlayer()->TeleportTo(curDestNode->map_id, node->LocX, node->LocY, node->LocZ, GetPlayer()->GetOrientation()); + } + } - if (path && mountDisplayId) - SendDoFlight(mountDisplayId, path, 1); // skip start fly node - else - GetPlayer()->m_taxi.ClearTaxiDestinations(); // clear problematic path and next return; } - else - GetPlayer()->m_taxi.ClearTaxiDestinations(); // not destinations, clear source node + + // at this point only 1 node is expected (final destination) + if (GetPlayer()->m_taxi.GetPath().size() != 1) + return; GetPlayer()->CleanupAfterTaxiFlight(); GetPlayer()->SetFallInformation(0, GetPlayer()->GetPositionZ()); diff --git a/src/server/game/Maps/TransportMgr.cpp b/src/server/game/Maps/TransportMgr.cpp index dadc2eeeac3..e5815a415e7 100644 --- a/src/server/game/Maps/TransportMgr.cpp +++ b/src/server/game/Maps/TransportMgr.cpp @@ -112,7 +112,7 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl Movement::PointsArray splinePath, allPoints; bool mapChange = false; for (size_t i = 0; i < path.size(); ++i) - allPoints.push_back(G3D::Vector3(path[i].LocX, path[i].LocY, path[i].LocZ)); + allPoints.push_back(G3D::Vector3(path[i]->LocX, path[i]->LocY, path[i]->LocZ)); // Add extra points to allow derivative calculations for all path nodes allPoints.insert(allPoints.begin(), allPoints.front().lerp(allPoints[1], -0.2f)); @@ -128,8 +128,8 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl { if (!mapChange) { - TaxiPathNodeEntry const& node_i = path[i]; - if (i != path.size() - 1 && (node_i.Flags & 1 || node_i.MapID != path[i + 1].MapID)) + TaxiPathNodeEntry const* node_i = path[i]; + if (i != path.size() - 1 && (node_i->Flags & 1 || node_i->MapID != path[i + 1]->MapID)) { keyFrames.back().Teleport = true; mapChange = true; @@ -142,7 +142,7 @@ void TransportMgr::GeneratePath(GameObjectTemplate const* goInfo, TransportTempl k.InitialOrientation = Position::NormalizeOrientation(std::atan2(h.y, h.x) + float(M_PI)); keyFrames.push_back(k); - splinePath.push_back(G3D::Vector3(node_i.LocX, node_i.LocY, node_i.LocZ)); + splinePath.push_back(G3D::Vector3(node_i->LocX, node_i->LocY, node_i->LocZ)); transport->mapsUsed.insert(k.Node->MapID); } } diff --git a/src/server/game/Maps/TransportMgr.h b/src/server/game/Maps/TransportMgr.h index fff7b9d8afa..c273ea7fb15 100644 --- a/src/server/game/Maps/TransportMgr.h +++ b/src/server/game/Maps/TransportMgr.h @@ -37,7 +37,7 @@ typedef std::unordered_map<uint32, std::set<uint32> > TransportInstanceMap; struct KeyFrame { - explicit KeyFrame(TaxiPathNodeEntry const& _node) : Index(0), Node(&_node), InitialOrientation(0.0f), + explicit KeyFrame(TaxiPathNodeEntry const* node) : Index(0), Node(node), InitialOrientation(0.0f), DistSinceStop(-1.0f), DistUntilStop(-1.0f), DistFromPrev(-1.0f), TimeFrom(0.0f), TimeTo(0.0f), Teleport(false), ArriveTime(0), DepartureTime(0), Spline(NULL), NextDistFromPrev(0.0f), NextArriveTime(0) { diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index b69322f5720..2bcb4aeb3b3 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -563,7 +563,8 @@ void MotionMaster::MoveTaxiFlight(uint32 path, uint32 pathnode) if (path < sTaxiPathNodesByPath.size()) { TC_LOG_DEBUG("misc", "%s taxi to (Path %u node %u)", _owner->GetName().c_str(), path, pathnode); - FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(sTaxiPathNodesByPath[path], pathnode); + FlightPathMovementGenerator* mgen = new FlightPathMovementGenerator(pathnode); + mgen->LoadPath(_owner->ToPlayer()); Mutate(mgen, MOTION_SLOT_CONTROLLED); } else diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index f91fc1985d5..8a5ac387f19 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -245,17 +245,62 @@ bool WaypointMovementGenerator<Creature>::GetResetPos(Creature*, float& x, float uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const { - if (i_currentNode >= i_path->size()) - return i_path->size(); + if (i_currentNode >= i_path.size()) + return i_path.size(); - uint32 curMapId = (*i_path)[i_currentNode].MapID; - for (uint32 i = i_currentNode; i < i_path->size(); ++i) - { - if ((*i_path)[i].MapID != curMapId) + uint32 curMapId = i_path[i_currentNode]->MapID; + for (uint32 i = i_currentNode; i < i_path.size(); ++i) + if (i_path[i]->MapID != curMapId) return i; - } - return i_path->size(); + return i_path.size(); +} + +#define SKIP_SPLINE_POINT_DISTANCE_SQ (40.0f * 40.0f) + +bool IsNodeIncludedInShortenedPath(TaxiPathNodeEntry const* p1, TaxiPathNodeEntry const* p2) +{ + return p1->MapID != p2->MapID || std::pow(p1->LocX - p2->LocX, 2) + std::pow(p1->LocY - p2->LocY, 2) > SKIP_SPLINE_POINT_DISTANCE_SQ; +} + +void FlightPathMovementGenerator::LoadPath(Player* player) +{ + _pointsForPathSwitch.clear(); + std::deque<uint32> const& taxi = player->m_taxi.GetPath(); + for (uint32 src = 0, dst = 1; dst < taxi.size(); src = dst++) + { + uint32 path, cost; + sObjectMgr->GetTaxiPath(taxi[src], taxi[dst], path, cost); + if (path > sTaxiPathNodesByPath.size()) + return; + + TaxiPathNodeList const& nodes = sTaxiPathNodesByPath[path]; + if (!nodes.empty()) + { + TaxiPathNodeEntry const* start = nodes[0]; + TaxiPathNodeEntry const* end = nodes[nodes.size() - 1]; + bool passedPreviousSegmentProximityCheck = false; + for (uint32 i = 0; i < nodes.size(); ++i) + { + if (passedPreviousSegmentProximityCheck || !src || i_path.empty() || IsNodeIncludedInShortenedPath(i_path[i_path.size() - 1], nodes[i])) + { + if ((!src || (IsNodeIncludedInShortenedPath(start, nodes[i]) && i >= 2)) && + (dst == taxi.size() - 1 || (IsNodeIncludedInShortenedPath(end, nodes[i]) && i < nodes.size() - 1))) + { + passedPreviousSegmentProximityCheck = true; + i_path.push_back(nodes[i]); + } + } + else + { + i_path.pop_back(); + --_pointsForPathSwitch.back().PathIndex; + } + } + } + + _pointsForPathSwitch.push_back({ uint32(i_path.size() - 1), int32(cost) }); + } } void FlightPathMovementGenerator::DoInitialize(Player* player) @@ -296,7 +341,7 @@ void FlightPathMovementGenerator::DoReset(Player* player) uint32 end = GetPathAtMapEnd(); for (uint32 i = GetCurrentNode(); i != end; ++i) { - G3D::Vector3 vertice((*i_path)[i].LocX, (*i_path)[i].LocY, (*i_path)[i].LocZ); + G3D::Vector3 vertice(i_path[i]->LocX, i_path[i]->LocY, i_path[i]->LocZ); init.Path().push_back(vertice); } init.SetFirstPointId(GetCurrentNode()); @@ -313,9 +358,21 @@ bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/) bool departureEvent = true; do { - DoEventIfAny(player, (*i_path)[i_currentNode], departureEvent); + DoEventIfAny(player, i_path[i_currentNode], departureEvent); + while (!_pointsForPathSwitch.empty() && _pointsForPathSwitch.front().PathIndex <= i_currentNode) + { + _pointsForPathSwitch.pop_front(); + player->m_taxi.NextTaxiDestination(); + if (!_pointsForPathSwitch.empty()) + { + player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_SPENT_FOR_TRAVELLING, _pointsForPathSwitch.front().Cost); + player->ModifyMoney(-_pointsForPathSwitch.front().Cost); + } + } + if (pointId == i_currentNode) break; + if (i_currentNode == _preloadTargetNode) PreloadEndGrid(); i_currentNode += (uint32)departureEvent; @@ -324,18 +381,18 @@ bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/) while (true); } - return i_currentNode < (i_path->size()-1); + return i_currentNode < (i_path.size() - 1); } void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport() { - if (i_path->empty()) + if (i_path.empty() || i_currentNode >= i_path.size()) return; - uint32 map0 = (*i_path)[0].MapID; - for (size_t i = 1; i < i_path->size(); ++i) + uint32 map0 = i_path[i_currentNode]->MapID; + for (size_t i = i_currentNode + 1; i < i_path.size(); ++i) { - if ((*i_path)[i].MapID != map0) + if (i_path[i]->MapID != map0) { i_currentNode = i; return; @@ -343,19 +400,21 @@ void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport() } } -void FlightPathMovementGenerator::DoEventIfAny(Player* player, TaxiPathNodeEntry const& node, bool departure) +void FlightPathMovementGenerator::DoEventIfAny(Player* player, TaxiPathNodeEntry const* node, bool departure) { - if (uint32 eventid = departure ? node.DepartureEventID : node.ArrivalEventID) + if (uint32 eventid = departure ? node->DepartureEventID : node->ArrivalEventID) { - TC_LOG_DEBUG("maps.script", "Taxi %s event %u of node %u of path %u for player %s", departure ? "departure" : "arrival", eventid, node.NodeIndex, node.PathID, player->GetName().c_str()); + TC_LOG_DEBUG("maps.script", "Taxi %s event %u of node %u of path %u for player %s", departure ? "departure" : "arrival", eventid, node->NodeIndex, node->PathID, player->GetName().c_str()); player->GetMap()->ScriptsStart(sEventScripts, eventid, player, player); } } bool FlightPathMovementGenerator::GetResetPos(Player*, float& x, float& y, float& z) { - const TaxiPathNodeEntry& node = (*i_path)[i_currentNode]; - x = node.LocX; y = node.LocY; z = node.LocZ; + TaxiPathNodeEntry const* node = i_path[i_currentNode]; + x = node->LocX; + y = node->LocY; + z = node->LocZ; return true; } @@ -363,11 +422,11 @@ void FlightPathMovementGenerator::InitEndGridInfo() { /*! Storage to preload flightmaster grid at end of flight. For multi-stop flights, this will be reinitialized for each flightmaster at the end of each spline (or stop) in the flight. */ - uint32 nodeCount = (*i_path).size(); //! Number of nodes in path. - _endMapId = (*i_path)[nodeCount - 1].MapID; //! MapId of last node + uint32 nodeCount = i_path.size(); //! Number of nodes in path. + _endMapId = i_path[nodeCount - 1]->MapID; //! MapId of last node _preloadTargetNode = nodeCount - 3; - _endGridX = (*i_path)[nodeCount - 1].LocX; - _endGridY = (*i_path)[nodeCount - 1].LocY; + _endGridX = i_path[nodeCount - 1]->LocX; + _endGridY = i_path[nodeCount - 1]->LocY; } void FlightPathMovementGenerator::PreloadEndGrid() @@ -378,7 +437,7 @@ void FlightPathMovementGenerator::PreloadEndGrid() // Load the grid if (endMap) { - TC_LOG_DEBUG("misc", "Preloading rid (%f, %f) for map %u at node index %u/%u", _endGridX, _endGridY, _endMapId, _preloadTargetNode, (uint32)(i_path->size()-1)); + TC_LOG_DEBUG("misc", "Preloading rid (%f, %f) for map %u at node index %u/%u", _endGridX, _endGridY, _endMapId, _preloadTargetNode, (uint32)(i_path.size() - 1)); endMap->LoadGrid(_endGridX, _endGridY); } else diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h index eb8533159a9..caf76b5ea19 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h @@ -27,13 +27,8 @@ #include "MovementGenerator.h" #include "WaypointManager.h" -#include "Path.h" - #include "Player.h" -#include <vector> -#include <set> - #define FLIGHT_TRAVEL_UPDATE 100 #define STOP_TIME_FOR_PLAYER 3 * MINUTE * IN_MILLISECONDS // 3 Minutes #define TIMEDIFF_NEXT_WP 250 @@ -42,11 +37,9 @@ template<class T, class P> class PathMovementBase { public: - PathMovementBase() : i_path(NULL), i_currentNode(0) { } + PathMovementBase() : i_path(), i_currentNode(0) { } virtual ~PathMovementBase() { }; - // template pattern, not defined .. override required - void LoadPath(T &); uint32 GetCurrentNode() const { return i_currentNode; } protected: @@ -110,30 +103,30 @@ class WaypointMovementGenerator<Creature> : public MovementGeneratorMedium< Crea * and hence generates ground and activities for the player. */ class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, FlightPathMovementGenerator >, - public PathMovementBase<Player, TaxiPathNodeList const*> + public PathMovementBase<Player, TaxiPathNodeList> { public: - explicit FlightPathMovementGenerator(TaxiPathNodeList const& pathnodes, uint32 startNode = 0) + explicit FlightPathMovementGenerator(uint32 startNode = 0) { - i_path = &pathnodes; i_currentNode = startNode; _endGridX = 0.0f; _endGridY = 0.0f; _endMapId = 0; _preloadTargetNode = 0; } + void LoadPath(Player* player); void DoInitialize(Player*); void DoReset(Player*); void DoFinalize(Player*); bool DoUpdate(Player*, uint32); MovementGeneratorType GetMovementGeneratorType() const override { return FLIGHT_MOTION_TYPE; } - TaxiPathNodeList const& GetPath() { return *i_path; } + TaxiPathNodeList const& GetPath() { return i_path; } uint32 GetPathAtMapEnd() const; - bool HasArrived() const { return (i_currentNode >= i_path->size()); } + bool HasArrived() const { return (i_currentNode >= i_path.size()); } void SetCurrentNodeAfterTeleport(); void SkipCurrentNode() { ++i_currentNode; } - void DoEventIfAny(Player* player, TaxiPathNodeEntry const& node, bool departure); + void DoEventIfAny(Player* player, TaxiPathNodeEntry const* node, bool departure); bool GetResetPos(Player*, float& x, float& y, float& z); @@ -141,9 +134,18 @@ class FlightPathMovementGenerator : public MovementGeneratorMedium< Player, Flig void PreloadEndGrid(); private: - float _endGridX; //! X coord of last node location - float _endGridY; //! Y coord of last node location - uint32 _endMapId; //! map Id of last node location - uint32 _preloadTargetNode; //! node index where preloading starts + + float _endGridX; //! X coord of last node location + float _endGridY; //! Y coord of last node location + uint32 _endMapId; //! map Id of last node location + uint32 _preloadTargetNode; //! node index where preloading starts + + struct TaxiNodeChangeInfo + { + uint32 PathIndex; + int32 Cost; + }; + + std::deque<TaxiNodeChangeInfo> _pointsForPathSwitch; //! node indexes and costs where TaxiPath changes }; #endif diff --git a/src/server/game/Movement/Waypoints/Path.h b/src/server/game/Movement/Waypoints/Path.h deleted file mode 100644 index bb8abc37eb3..00000000000 --- a/src/server/game/Movement/Waypoints/Path.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/> - * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/> - * - * 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, see <http://www.gnu.org/licenses/>. - */ - -#ifndef TRINITYCORE_PATH_H -#define TRINITYCORE_PATH_H - -#include "Common.h" -#include <deque> - -struct PathNode -{ - PathNode(): x(0.0f), y(0.0f), z(0.0f) { } - PathNode(float _x, float _y, float _z): x(_x), y(_y), z(_z) { } - float x, y, z; -}; -template<typename PathElem, typename PathNode = PathElem> - -class Path -{ - public: - size_t size() const { return i_nodes.size(); } - bool empty() const { return i_nodes.empty(); } - void resize(unsigned int sz) { i_nodes.resize(sz); } - void clear() { i_nodes.clear(); } - void erase(uint32 idx) { i_nodes.erase(i_nodes.begin()+idx); } - void crop(unsigned int start, unsigned int end) - { - while (start && !i_nodes.empty()) - { - i_nodes.pop_front(); - --start; - } - - while (end && !i_nodes.empty()) - { - i_nodes.pop_back(); - --end; - } - } - - float GetTotalLength(uint32 start, uint32 end) const - { - float len = 0.0f; - for (uint32 idx=start+1; idx < end; ++idx) - { - PathNode const& node = i_nodes[idx]; - PathNode const& prev = i_nodes[idx-1]; - float xd = node.x - prev.x; - float yd = node.y - prev.y; - float zd = node.z - prev.z; - len += std::sqrt(xd*xd + yd*yd + zd*zd); - } - return len; - } - - float GetTotalLength() const { return GetTotalLength(0, size()); } - - float GetPassedLength(uint32 curnode, float x, float y, float z) const - { - float len = GetTotalLength(0, curnode); - - if (curnode > 0) - { - PathNode const& node = i_nodes[curnode-1]; - float xd = x - node.x; - float yd = y - node.y; - float zd = z - node.z; - len += std::sqrt(xd*xd + yd*yd + zd*zd); - } - - return len; - } - - PathNode& operator[](size_t idx) { return i_nodes[idx]; } - PathNode const& operator[](size_t idx) const { return i_nodes[idx]; } - - void set(size_t idx, PathElem elem) { i_nodes[idx] = elem; } - - protected: - std::deque<PathElem> i_nodes; -}; - -typedef Path<PathNode> SimplePath; - -#endif diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index 4fce8d9adde..58bc4915d3f 100644 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -102,6 +102,9 @@ Quest::Quest(Field* questRecord) for (int i = 0; i < QUEST_OBJECTIVES_COUNT; ++i) ObjectiveText[i] = questRecord[100+i].GetString(); + EmoteOnIncomplete = 0; + EmoteOnComplete = 0; + //int32 VerifiedBuild = questRecord[104].GetInt32(); _reqItemsCount = 0; diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp index 5fc3cc618e5..b609dfe18dd 100644 --- a/src/server/scripts/Commands/cs_ticket.cpp +++ b/src/server/scripts/Commands/cs_ticket.cpp @@ -113,7 +113,7 @@ public: // If assigned to different player other than current, leave //! Console can override though - Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL; + Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr; if (player && ticket->IsAssignedNotTo(player->GetGUID())) { handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId(), target.c_str()); @@ -146,7 +146,7 @@ public: // Ticket should be assigned to the player who tries to close it. // Console can override though - Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL; + Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr; if (player && ticket->IsAssignedNotTo(player->GetGUID())) { handler->PSendSysMessage(LANG_COMMAND_TICKETCANNOTCLOSE, ticket->GetId()); @@ -190,7 +190,7 @@ public: // Cannot comment ticket assigned to someone else //! Console excluded - Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL; + Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr; if (player && ticket->IsAssignedNotTo(player->GetGUID())) { handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId()); @@ -220,7 +220,9 @@ public: if (!*args) return false; - uint32 ticketId = atoi(args); + char* ticketIdStr = strtok((char*)args, " "); + uint32 ticketId = atoi(ticketIdStr); + GmTicket* ticket = sTicketMgr->GetTicket(ticketId); if (!ticket || ticket->IsClosed() || ticket->IsCompleted()) { @@ -228,6 +230,21 @@ public: return true; } + char* response = strtok(NULL, "\n"); + if (response) + { + // Cannot add response to ticket, assigned to someone else + //! Console excluded + Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr; + if (player && ticket->IsAssignedNotTo(player->GetGUID())) + { + handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId()); + return true; + } + + ticket->AppendResponse(response); + } + if (Player* player = ticket->GetPlayer()) ticket->SendResponse(player->GetSession()); @@ -476,7 +493,7 @@ public: // Cannot add response to ticket, assigned to someone else //! Console excluded - Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : NULL; + Player* player = handler->GetSession() ? handler->GetSession()->GetPlayer() : nullptr; if (player && ticket->IsAssignedNotTo(player->GetGUID())) { handler->PSendSysMessage(LANG_COMMAND_TICKETALREADYASSIGNED, ticket->GetId()); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp index f5842181358..2ca55ee570b 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_patchwerk.cpp @@ -49,6 +49,11 @@ enum Misc ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT = 10286 }; +enum HatefulThreatAmounts +{ + HATEFUL_THREAT_AMT = 1000, +}; + class boss_patchwerk : public CreatureScript { public: @@ -92,8 +97,8 @@ public: _EnterCombat(); Enraged = false; Talk(SAY_AGGRO); - events.ScheduleEvent(EVENT_HATEFUL, 1000); - events.ScheduleEvent(EVENT_BERSERK, 360000); + events.ScheduleEvent(EVENT_HATEFUL, 1 * IN_MILLISECONDS); + events.ScheduleEvent(EVENT_BERSERK, 6 * MINUTE * IN_MILLISECONDS); instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_MAKE_QUICK_WERK_OF_HIM_STARTING_EVENT); } @@ -111,37 +116,68 @@ public: { case EVENT_HATEFUL: { - //Cast Hateful strike on the player with the highest - //amount of HP within melee distance - uint32 MostHP = 0; - Unit* pMostHPTarget = NULL; + // Hateful Strike targets the highest non-MT threat in melee range on 10man + // and the higher HP target out of the two highest non-MT threats in melee range on 25man + float MostThreat = 0.0f; + Unit* secondThreatTarget = NULL; + Unit* thirdThreatTarget = NULL; + std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); for (; i != me->getThreatManager().getThreatList().end(); ++i) - { + { // find second highest Unit* target = (*i)->getTarget(); - if (target->IsAlive() && target != me->GetVictim() && target->GetHealth() > MostHP && me->IsWithinMeleeRange(target)) + if (target->IsAlive() && target != me->GetVictim() && (*i)->getThreat() >= MostThreat && me->IsWithinMeleeRange(target)) + { + MostThreat = (*i)->getThreat(); + secondThreatTarget = target; + } + } + + if (secondThreatTarget && Is25ManRaid()) + { // find third highest + MostThreat = 0.0f; + i = me->getThreatManager().getThreatList().begin(); + for (; i != me->getThreatManager().getThreatList().end(); ++i) { - MostHP = target->GetHealth(); - pMostHPTarget = target; + Unit* target = (*i)->getTarget(); + if (target->IsAlive() && target != me->GetVictim() && target != secondThreatTarget && (*i)->getThreat() >= MostThreat && me->IsWithinMeleeRange(target)) + { + MostThreat = (*i)->getThreat(); + thirdThreatTarget = target; + } } } - if (!pMostHPTarget) - pMostHPTarget = me->GetVictim(); + Unit* pHatefulTarget = NULL; + if (!thirdThreatTarget) + pHatefulTarget = secondThreatTarget; + else if (secondThreatTarget) + pHatefulTarget = (secondThreatTarget->GetHealth() < thirdThreatTarget->GetHealth()) ? thirdThreatTarget : secondThreatTarget; + + if (!pHatefulTarget) + pHatefulTarget = me->GetVictim(); + + DoCast(pHatefulTarget, SPELL_HATEFUL_STRIKE, true); - DoCast(pMostHPTarget, SPELL_HATEFUL_STRIKE, true); + // add threat to highest threat targets + if (me->GetVictim() && me->IsWithinMeleeRange(me->GetVictim())) + me->getThreatManager().addThreat(me->GetVictim(), HATEFUL_THREAT_AMT); + if (secondThreatTarget) + me->getThreatManager().addThreat(secondThreatTarget, HATEFUL_THREAT_AMT); + if (thirdThreatTarget) + me->getThreatManager().addThreat(thirdThreatTarget, HATEFUL_THREAT_AMT); // this will only ever be used in 25m - events.ScheduleEvent(EVENT_HATEFUL, 1000); + events.ScheduleEvent(EVENT_HATEFUL, 1 * IN_MILLISECONDS); break; } case EVENT_BERSERK: DoCast(me, SPELL_BERSERK, true); Talk(EMOTE_BERSERK); - events.ScheduleEvent(EVENT_SLIME, 2000); + events.ScheduleEvent(EVENT_SLIME, 2 * IN_MILLISECONDS); break; case EVENT_SLIME: DoCastVictim(SPELL_SLIME_BOLT, true); - events.ScheduleEvent(EVENT_SLIME, 2000); + events.ScheduleEvent(EVENT_SLIME, 2 * IN_MILLISECONDS); break; } } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp index ee482c23d1b..02a7aa570e5 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp @@ -43,6 +43,7 @@ enum Spells SPELL_BERSERK = 26662, SPELL_DIES = 29357, SPELL_CHILL = 28547, + SPELL_CHECK_RESISTS = 60539, }; enum Phases @@ -67,7 +68,8 @@ enum Events EVENT_EXPLOSION, EVENT_LAND, EVENT_GROUND, - EVENT_BIRTH + EVENT_BIRTH, + EVENT_CHECK_RESISTS }; enum Misc @@ -90,10 +92,9 @@ class boss_sapphiron : public CreatureScript struct boss_sapphironAI : public BossAI { boss_sapphironAI(Creature* creature) : - BossAI(creature, BOSS_SAPPHIRON), _map(me->GetMap()) + BossAI(creature, BOSS_SAPPHIRON), _iceboltCount(0), _map(me->GetMap()) { Initialize(); - _iceboltCount = 0; } void Initialize() @@ -101,7 +102,6 @@ class boss_sapphiron : public CreatureScript _phase = PHASE_NULL; _canTheHundredClub = true; - _checkFrostResistTimer = 5 * IN_MILLISECONDS; } void InitializeAI() override @@ -123,7 +123,16 @@ class boss_sapphiron : public CreatureScript _Reset(); if (_phase == PHASE_FLIGHT) + { ClearIceBlock(); + me->SetReactState(REACT_AGGRESSIVE); + if (me->IsHovering()) + { + me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); + me->SetHover(false); + } + me->SetDisableGravity(false); + } Initialize(); } @@ -134,22 +143,30 @@ class boss_sapphiron : public CreatureScript me->CastSpell(me, SPELL_FROST_AURA, true); + DoCast(me, SPELL_CHECK_RESISTS); + events.ScheduleEvent(EVENT_CHECK_RESISTS, 30 * IN_MILLISECONDS); events.ScheduleEvent(EVENT_BERSERK, 15 * MINUTE * IN_MILLISECONDS); EnterPhaseGround(); - - CheckPlayersFrostResist(); } void SpellHitTarget(Unit* target, SpellInfo const* spell) override { - if (spell->Id == SPELL_ICEBOLT) + switch(spell->Id) { - IceBlockMap::iterator itr = _iceblocks.find(target->GetGUID()); - if (itr != _iceblocks.end() && !itr->second) + case SPELL_ICEBOLT: { - if (GameObject* iceblock = me->SummonGameObject(GO_ICEBLOCK, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, 0, 0, 0, 0, 25)) - itr->second = iceblock->GetGUID(); + IceBlockMap::iterator itr = _iceblocks.find(target->GetGUID()); + if (itr != _iceblocks.end() && !itr->second) + { + if (GameObject* iceblock = me->SummonGameObject(GO_ICEBLOCK, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, 0, 0, 0, 0, 25)) + itr->second = iceblock->GetGUID(); + } + break; } + case SPELL_CHECK_RESISTS: + if (target && target->GetResistance(SPELL_SCHOOL_FROST) > MAX_FROST_RESISTANCE) + _canTheHundredClub = false; + break; } } @@ -157,8 +174,6 @@ class boss_sapphiron : public CreatureScript { _JustDied(); me->CastSpell(me, SPELL_DIES, true); - - CheckPlayersFrostResist(); } void MovementInform(uint32 /*type*/, uint32 id) override @@ -176,22 +191,6 @@ class boss_sapphiron : public CreatureScript } } - void CheckPlayersFrostResist() - { - if (_canTheHundredClub && _map && _map->IsRaid()) - { - Map::PlayerList const &players = _map->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if (itr->GetSource()->GetResistance(SPELL_SCHOOL_FROST) > MAX_FROST_RESISTANCE) - { - _canTheHundredClub = false; - break; - } - } - } - } - void EnterPhaseGround() { _phase = PHASE_GROUND; @@ -235,23 +234,16 @@ class boss_sapphiron : public CreatureScript if ((_phase != PHASE_BIRTH && !UpdateVictim()) || !CheckInRoom()) return; - if (_canTheHundredClub) - { - if (_checkFrostResistTimer <= diff) - { - CheckPlayersFrostResist(); - _checkFrostResistTimer = 5 * IN_MILLISECONDS; - } - else - _checkFrostResistTimer -= diff; - } - if (_phase == PHASE_GROUND) { while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { + case EVENT_CHECK_RESISTS: + DoCast(me, SPELL_CHECK_RESISTS); + events.ScheduleEvent(EVENT_CHECK_RESISTS, 30 * IN_MILLISECONDS); + return; case EVENT_BERSERK: Talk(EMOTE_ENRAGE); DoCast(me, SPELL_BERSERK); @@ -270,7 +262,6 @@ class boss_sapphiron : public CreatureScript return; case EVENT_BLIZZARD: { - //DoCastAOE(SPELL_SUMMON_BLIZZARD); if (Creature* summon = DoSummon(NPC_BLIZZARD, me, 0.0f, urand(25, 30) * IN_MILLISECONDS, TEMPSUMMON_TIMED_DESPAWN)) summon->GetMotionMaster()->MoveRandom(40); events.ScheduleEvent(EVENT_BLIZZARD, RAID_MODE(20, 7) * IN_MILLISECONDS, 0, PHASE_GROUND); @@ -300,9 +291,14 @@ class boss_sapphiron : public CreatureScript { switch (eventId) { + case EVENT_CHECK_RESISTS: + DoCast(me, SPELL_CHECK_RESISTS); + events.ScheduleEvent(EVENT_CHECK_RESISTS, 30 * IN_MILLISECONDS); + return; case EVENT_LIFTOFF: Talk(EMOTE_AIR_PHASE); me->SetDisableGravity(true); + me->SetHover(true); events.ScheduleEvent(EVENT_ICEBOLT, 1500); _iceboltCount = RAID_MODE(2, 3); return; @@ -346,6 +342,7 @@ class boss_sapphiron : public CreatureScript case EVENT_LAND: me->HandleEmoteCommand(EMOTE_ONESHOT_LAND); Talk(EMOTE_GROUND_PHASE); + me->SetHover(false); me->SetDisableGravity(false); events.ScheduleEvent(EVENT_GROUND, 1500); return; @@ -406,7 +403,6 @@ class boss_sapphiron : public CreatureScript uint32 _iceboltCount; IceBlockMap _iceblocks; bool _canTheHundredClub; - uint32 _checkFrostResistTimer; Map* _map; }; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index 61d64413178..b31436f656a 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -97,9 +97,6 @@ enum Creatures NPC_MIMIRON_TARGET_BEACON = 33369, NPC_HODIR_TARGET_BEACON = 33108, NPC_FREYA_TARGET_BEACON = 33366, - NPC_LOREKEEPER = 33686, // Hard mode starter - NPC_BRANZ_BRONZBEARD = 33579, - NPC_DELORAH = 33701, NPC_ULDUAR_GAUNTLET_GENERATOR = 33571, // Trigger tied to towers }; @@ -1167,9 +1164,49 @@ class npc_freya_ward_summon : public CreatureScript } }; -//npc lore keeper -#define GOSSIP_ITEM_1 "Activate secondary defensive systems" -#define GOSSIP_ITEM_2 "Confirmed" +enum BrannBronzebeardGossips +{ + GOSSIP_MENU_BRANN_BRONZEBEARD = 10355, + GOSSIP_OPTION_BRANN_BRONZEBEARD = 0 +}; + +class npc_brann_bronzebeard_ulduar_intro : public CreatureScript +{ + public: + npc_brann_bronzebeard_ulduar_intro() : CreatureScript("npc_brann_bronzebeard_ulduar_intro") { } + + struct npc_brann_bronzebeard_ulduar_introAI : public ScriptedAI + { + npc_brann_bronzebeard_ulduar_introAI(Creature* creature) : ScriptedAI(creature) + { + _instance = creature->GetInstanceScript(); + } + + void sGossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override + { + if (menuId == GOSSIP_MENU_BRANN_BRONZEBEARD && gossipListId == GOSSIP_OPTION_BRANN_BRONZEBEARD) + { + player->PlayerTalkClass->SendCloseGossip(); + if (Creature* loreKeeper = _instance->GetCreature(DATA_LORE_KEEPER_OF_NORGANNON)) + loreKeeper->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + } + + private: + InstanceScript* _instance; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetUlduarAI<npc_brann_bronzebeard_ulduar_introAI>(creature); + } +}; + +enum LoreKeeperGossips +{ + GOSSIP_MENU_LORE_KEEPER = 10477, + GOSSIP_OPTION_LORE_KEEPER = 0 +}; class npc_lorekeeper : public CreatureScript { @@ -1180,6 +1217,7 @@ class npc_lorekeeper : public CreatureScript { npc_lorekeeperAI(Creature* creature) : ScriptedAI(creature) { + _instance = creature->GetInstanceScript(); } void DoAction(int32 action) override @@ -1187,66 +1225,42 @@ class npc_lorekeeper : public CreatureScript // Start encounter if (action == ACTION_SPAWN_VEHICLES) { - for (int32 i = 0; i < RAID_MODE(2, 5); ++i) + for (uint8 i = 0; i < RAID_MODE(2, 5); ++i) DoSummon(VEHICLE_SIEGE, PosSiege[i], 3000, TEMPSUMMON_CORPSE_TIMED_DESPAWN); - for (int32 i = 0; i < RAID_MODE(2, 5); ++i) + for (uint8 i = 0; i < RAID_MODE(2, 5); ++i) DoSummon(VEHICLE_CHOPPER, PosChopper[i], 3000, TEMPSUMMON_CORPSE_TIMED_DESPAWN); - for (int32 i = 0; i < RAID_MODE(2, 5); ++i) + for (uint8 i = 0; i < RAID_MODE(2, 5); ++i) DoSummon(VEHICLE_DEMOLISHER, PosDemolisher[i], 3000, TEMPSUMMON_CORPSE_TIMED_DESPAWN); - return; } } - }; - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override - { - player->CLOSE_GOSSIP_MENU(); - InstanceScript* instance = creature->GetInstanceScript(); - if (!instance) - return true; - switch (action) + void sGossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override { - case GOSSIP_ACTION_INFO_DEF+1: - player->PrepareGossipMenu(creature); - instance->instance->LoadGrid(364, -16); //make sure leviathan is loaded + if (menuId == GOSSIP_MENU_LORE_KEEPER && gossipListId == GOSSIP_OPTION_LORE_KEEPER) + { + player->PlayerTalkClass->SendCloseGossip(); + _instance->instance->LoadGrid(364, -16); // make sure leviathan is loaded - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - if (Creature* leviathan = instance->instance->GetCreature(instance->GetGuidData(BOSS_LEVIATHAN))) + if (Creature* leviathan = _instance->instance->GetCreature(_instance->GetGuidData(BOSS_LEVIATHAN))) { leviathan->AI()->DoAction(ACTION_START_HARD_MODE); - creature->SetVisible(false); - creature->AI()->DoAction(ACTION_SPAWN_VEHICLES); // spawn the vehicles - if (Creature* Delorah = creature->FindNearestCreature(NPC_DELORAH, 1000, true)) + me->SetVisible(false); + DoAction(ACTION_SPAWN_VEHICLES); // spawn the vehicles + if (Creature* delorah = _instance->GetCreature(DATA_DELLORAH)) { - if (Creature* Branz = creature->FindNearestCreature(NPC_BRANZ_BRONZBEARD, 1000, true)) + if (Creature* brann = _instance->GetCreature(DATA_BRANN_BRONZEBEARD_INTRO)) { - Delorah->GetMotionMaster()->MovePoint(0, Branz->GetPositionX()-4, Branz->GetPositionY(), Branz->GetPositionZ()); - /// @todo Delorah->AI()->Talk(xxxx, Branz->GetGUID()); when reached at branz + delorah->GetMotionMaster()->MovePoint(0, brann->GetPositionX() - 4, brann->GetPositionY(), brann->GetPositionZ()); + /// @todo delorah->AI()->Talk(xxxx, brann->GetGUID()); when reached at branz } } } - break; + } } - return true; - } - - bool OnGossipHello(Player* player, Creature* creature) override - { - InstanceScript* instance = creature->GetInstanceScript(); - if (instance && instance->GetData(BOSS_LEVIATHAN) != DONE && player) - { - player->PrepareGossipMenu(creature); - - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - } - return true; - } + private: + InstanceScript* _instance; + }; CreatureAI* GetAI(Creature* creature) const override { @@ -1254,56 +1268,6 @@ class npc_lorekeeper : public CreatureScript } }; -//enable hardmode -////npc_brann_bronzebeard this requires more work involving area triggers. if reached this guy speaks through his radio.. -//#define GOSSIP_ITEM_1 "xxxxx" -//#define GOSSIP_ITEM_2 "xxxxx" -// -/* -class npc_brann_bronzebeard : public CreatureScript -{ -public: - npc_brann_bronzebeard() : CreatureScript("npc_brann_bronzebeard") { } - - //bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) override - //{ - // player->PlayerTalkClass->ClearMenus(); - // switch (action) - // { - // case GOSSIP_ACTION_INFO_DEF+1: - // if (player) - // { - // player->PrepareGossipMenu(creature); - // - // player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - // player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - // } - // break; - // case GOSSIP_ACTION_INFO_DEF+2: - // if (player) - // player->CLOSE_GOSSIP_MENU(); - // if (Creature* Lorekeeper = creature->FindNearestCreature(NPC_LOREKEEPER, 1000, true)) //lore keeper of lorgannon - // Lorekeeper->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - // break; - // } - // return true; - //} - //bool OnGossipHello(Player* player, Creature* creature) override - //{ - // InstanceScript* instance = creature->GetInstanceScript(); - // if (instance && instance->GetData(BOSS_LEVIATHAN) !=DONE) - // { - // player->PrepareGossipMenu(creature); - // - // player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - // player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - // } - // return true; - //} - // -} -*/ - class go_ulduar_tower : public GameObjectScript { public: @@ -1836,8 +1800,8 @@ void AddSC_boss_flame_leviathan() new npc_hodirs_fury(); new npc_freyas_ward(); new npc_freya_ward_summon(); + new npc_brann_bronzebeard_ulduar_intro(); new npc_lorekeeper(); - // new npc_brann_bronzebeard(); new go_ulduar_tower(); new achievement_three_car_garage_demolisher(); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp index 818bb0041a9..6958b5d78a5 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_freya.cpp @@ -749,8 +749,8 @@ class boss_elder_brightleaf : public CreatureScript case EVENT_SOLAR_FLARE: { uint8 stackAmount = 0; - if (me->GetAura(SPELL_FLUX_AURA)) - stackAmount = me->GetAura(SPELL_FLUX_AURA)->GetStackAmount(); + if (Aura* aura = me->GetAura(SPELL_FLUX_AURA)) + stackAmount = aura->GetStackAmount(); me->CastCustomSpell(SPELL_SOLAR_FLARE, SPELLVALUE_MAX_TARGETS, stackAmount, me, false); events.ScheduleEvent(EVENT_SOLAR_FLARE, urand(5000, 10000)); break; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index 0c7df100f60..f2edfa816a0 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -54,6 +54,15 @@ MinionData const minionData[] = { 0, 0, } }; +ObjectData const creatureData[] = +{ + { NPC_BRANN_BRONZEBEARD_INTRO, DATA_BRANN_BRONZEBEARD_INTRO }, + { NPC_LORE_KEEPER_OF_NORGANNON, DATA_LORE_KEEPER_OF_NORGANNON }, + { NPC_HIGH_EXPLORER_DELLORAH, DATA_DELLORAH }, + { NPC_BRONZEBEARD_RADIO, DATA_BRONZEBEARD_RADIO }, + { 0, 0, } +}; + class instance_ulduar : public InstanceMapScript { public: @@ -68,6 +77,7 @@ class instance_ulduar : public InstanceMapScript LoadDoorData(doorData); LoadMinionData(minionData); + LoadObjectData(creatureData, nullptr); _algalonTimer = 61; _maxArmorItemLevel = 0; @@ -420,6 +430,8 @@ class instance_ulduar : public InstanceMapScript algalon->AI()->JustSummoned(creature); break; } + + InstanceScript::OnCreatureCreate(creature); } void OnCreatureRemove(Creature* creature) override @@ -446,6 +458,8 @@ class instance_ulduar : public InstanceMapScript default: break; } + + InstanceScript::OnCreatureRemove(creature); } void OnGameObjectCreate(GameObject* gameObject) override diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h index 9f640c410ef..834ab32864f 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h @@ -80,6 +80,23 @@ enum UlduarNPCs NPC_YOGG_SARON = 33288, NPC_ALGALON = 32871, + // Flame Leviathan + NPC_ULDUAR_COLOSSUS = 33237, + NPC_BRANN_BRONZEBEARD_INTRO = 33579, + NPC_BRANN_BRONZEBEARD_FLYING_MACHINE = 34119, + NPC_BRANN_S_FLYING_MACHINE = 34120, + NPC_ARCHMAGE_PENTARUS = 33624, + NPC_ARCHMAGE_RHYDIAN = 33696, + NPC_LORE_KEEPER_OF_NORGANNON = 33686, + NPC_HIGH_EXPLORER_DELLORAH = 33701, + NPC_BRONZEBEARD_RADIO = 34054, + NPC_FLAME_LEVIATHAN = 33113, + NPC_FLAME_LEVIATHAN_SEAT = 33114, + NPC_FLAME_LEVIATHAN_TURRET = 33139, + NPC_LEVIATHAN_DEFENSE_TURRET = 33142, + NPC_OVERLOAD_CONTROL_DEVICE = 33143, + NPC_ORBITAL_SUPPORT = 34286, + // Mimiron NPC_LEVIATHAN_MKII = 33432, NPC_VX_001 = 33651, @@ -382,6 +399,12 @@ enum UlduarData DATA_UNIVERSE_GLOBE, DATA_ALGALON_TRAPDOOR, DATA_BRANN_BRONZEBEARD_ALG, + + // Misc + DATA_BRANN_BRONZEBEARD_INTRO, + DATA_LORE_KEEPER_OF_NORGANNON, + DATA_DELLORAH, + DATA_BRONZEBEARD_RADIO }; enum UlduarWorldStates diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 68c115f9faf..0ab7c2fcb54 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -614,6 +614,47 @@ class spell_gen_burn_brutallus : public SpellScriptLoader } }; +// 48750 - Burning Depths Necrolyte Image +class spell_gen_burning_depths_necrolyte_image : public SpellScriptLoader +{ + public: + spell_gen_burning_depths_necrolyte_image() : SpellScriptLoader("spell_gen_burning_depths_necrolyte_image") { } + + class spell_gen_burning_depths_necrolyte_image_AuraScript : public AuraScript + { + PrepareAuraScript(spell_gen_burning_depths_necrolyte_image_AuraScript); + + bool Validate(SpellInfo const* spellInfo) override + { + if (!sSpellMgr->GetSpellInfo(uint32(spellInfo->Effects[EFFECT_2].CalcValue()))) + return false; + return true; + } + + void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + caster->CastSpell(GetTarget(), uint32(GetSpellInfo()->Effects[EFFECT_2].CalcValue())); + } + + void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(uint32(GetSpellInfo()->Effects[EFFECT_2].CalcValue()), GetCasterGUID()); + } + + void Register() override + { + AfterEffectApply += AuraEffectApplyFn(spell_gen_burning_depths_necrolyte_image_AuraScript::HandleApply, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_gen_burning_depths_necrolyte_image_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const override + { + return new spell_gen_burning_depths_necrolyte_image_AuraScript(); + } +}; + enum CannibalizeSpells { SPELL_CANNIBALIZE_TRIGGERED = 20578 @@ -4093,6 +4134,7 @@ void AddSC_generic_spell_scripts() new spell_gen_break_shield("spell_gen_break_shield"); new spell_gen_break_shield("spell_gen_tournament_counterattack"); new spell_gen_burn_brutallus(); + new spell_gen_burning_depths_necrolyte_image(); new spell_gen_cannibalize(); new spell_gen_chaos_blast(); new spell_gen_clone(); |