# Conflicts:
#	src/server/game/AI/SmartScripts/SmartScript.cpp
This commit is contained in:
Ovahlord
2018-05-17 12:44:55 +02:00
140 changed files with 7191 additions and 2692 deletions

View File

@@ -26,6 +26,7 @@ EndScriptData */
#include "Chat.h"
#include "DatabaseEnv.h"
#include "DBCStores.h"
#include "DisableMgr.h"
#include "ObjectMgr.h"
#include "Player.h"
#include "ReputationMgr.h"
@@ -73,7 +74,7 @@ public:
Quest const* quest = sObjectMgr->GetQuestTemplate(entry);
if (!quest)
if (!quest || DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, entry, nullptr))
{
handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
handler->SetSentErrorMessage(true);
@@ -185,7 +186,8 @@ public:
Quest const* quest = sObjectMgr->GetQuestTemplate(entry);
// If player doesn't have the quest
if (!quest || player->GetQuestStatus(entry) == QUEST_STATUS_NONE)
if (!quest || player->GetQuestStatus(entry) == QUEST_STATUS_NONE
|| DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, entry, nullptr))
{
handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
handler->SetSentErrorMessage(true);
@@ -289,7 +291,8 @@ public:
Quest const* quest = sObjectMgr->GetQuestTemplate(entry);
// If player doesn't have the quest
if (!quest || player->GetQuestStatus(entry) != QUEST_STATUS_COMPLETE)
if (!quest || player->GetQuestStatus(entry) != QUEST_STATUS_COMPLETE
|| DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, entry, nullptr))
{
handler->PSendSysMessage(LANG_COMMAND_QUEST_NOTFOUND, entry);
handler->SetSentErrorMessage(true);

View File

@@ -997,7 +997,8 @@ class npc_saurfang_event : public CreatureScript
void SetData(uint32 type, uint32 data) override
{
ASSERT(!type && data && data < 6);
if (!(!type && data && data < 6))
return;
_index = data;
}

View File

@@ -281,7 +281,10 @@ class instance_ulduar : public InstanceMapScript
case NPC_SALVAGED_DEMOLISHER:
case NPC_SALVAGED_SIEGE_ENGINE:
case NPC_SALVAGED_CHOPPER:
LeviathanVehicleGUIDs.push_back(creature->GetGUID());
if (GetBossState(BOSS_LEVIATHAN) == DONE)
DespawnLeviatanVehicle(creature);
else
LeviathanVehicleGUIDs.push_back(creature->GetGUID());
break;
// XT-002 Deconstructor
@@ -1043,17 +1046,8 @@ class instance_ulduar : public InstanceMapScript
// Eject all players from vehicles and make them untargetable.
// They will be despawned after a while
for (auto const& vehicleGuid : LeviathanVehicleGUIDs)
{
if (Creature* vehicleCreature = instance->GetCreature(vehicleGuid))
{
if (Vehicle* vehicle = vehicleCreature->GetVehicleKit())
{
vehicle->RemoveAllPassengers();
vehicleCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
vehicleCreature->DespawnOrUnsummon(5 * MINUTE * IN_MILLISECONDS);
}
}
}
DespawnLeviatanVehicle(vehicleCreature);
break;
case EVENT_LEVIATHAN_BREAK_DOOR:
if (Creature* leviathan = GetCreature(BOSS_LEVIATHAN))
@@ -1065,6 +1059,16 @@ class instance_ulduar : public InstanceMapScript
}
}
void DespawnLeviatanVehicle(Creature* vehicleCreature)
{
if (Vehicle* vehicle = vehicleCreature->GetVehicleKit())
{
vehicle->RemoveAllPassengers();
vehicleCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
vehicleCreature->DespawnOrUnsummon(5 * MINUTE * IN_MILLISECONDS);
}
}
void UpdateDoorState(GameObject* door) override
{
// Leviathan doors are set to DOOR_TYPE_ROOM except the one it uses to enter the room