Core/InstanceScript: std::chrono-ify DoRespawnGameObject

(cherry picked from commit d7ff8c272a)
This commit is contained in:
Carbenium
2020-07-25 20:09:03 +02:00
committed by Shauren
parent 7c43afa471
commit 5f296fb7c7
8 changed files with 10 additions and 9 deletions

View File

@@ -556,7 +556,7 @@ void InstanceScript::DoCloseDoorOrButton(ObjectGuid guid)
TC_LOG_DEBUG("scripts", "InstanceScript: DoCloseDoorOrButton failed");
}
void InstanceScript::DoRespawnGameObject(ObjectGuid guid, uint32 timeToDespawn /*= MINUTE*/)
void InstanceScript::DoRespawnGameObject(ObjectGuid guid, Seconds timeToDespawn /*= 1min */)
{
if (GameObject* go = instance->GetGameObject(guid))
{
@@ -576,7 +576,7 @@ void InstanceScript::DoRespawnGameObject(ObjectGuid guid, uint32 timeToDespawn /
if (go->isSpawned())
return;
go->SetRespawnTime(timeToDespawn);
go->SetRespawnTime(timeToDespawn.count());
}
else
TC_LOG_DEBUG("scripts", "InstanceScript: DoRespawnGameObject failed");

View File

@@ -20,6 +20,7 @@
#include "ZoneScript.h"
#include "Common.h"
#include "Duration.h"
#include <iosfwd>
#include <map>
#include <memory>
@@ -213,7 +214,7 @@ class TC_GAME_API InstanceScript : public ZoneScript
void DoCloseDoorOrButton(ObjectGuid guid);
// Respawns a GO having negative spawntimesecs in gameobject-table
void DoRespawnGameObject(ObjectGuid guid, uint32 timeToDespawn = MINUTE);
void DoRespawnGameObject(ObjectGuid guid, Seconds timeToDespawn = 1min);
// Sends world state update to all players in instance
void DoUpdateWorldState(uint32 worldstateId, uint32 worldstateValue);

View File

@@ -81,7 +81,7 @@ class boss_gloomrel : public CreatureScript
case GOSSIP_ACTION_INFO_DEF + 22:
CloseGossipMenuFor(player);
//are 5 minutes expected? go template may have data to despawn when used at quest
instance->DoRespawnGameObject(instance->GetGuidData(DATA_GO_CHALICE), MINUTE * 5);
instance->DoRespawnGameObject(instance->GetGuidData(DATA_GO_CHALICE), 5min);
break;
}
return true;

View File

@@ -393,7 +393,7 @@ public:
void TombOfSevenEnd()
{
DoRespawnGameObject(GoChestGUID, DAY);
DoRespawnGameObject(GoChestGUID, 24h);
HandleGameObject(GoTombExitGUID, true);//event done, open exit door
HandleGameObject(GoTombEnterGUID, true);//event done, open entrance door
TombEventStarterGUID.Clear();

View File

@@ -133,7 +133,7 @@ class instance_molten_core : public InstanceMapScript
SummonMajordomoExecutus();
if (bossId == BOSS_MAJORDOMO_EXECUTUS && state == DONE)
DoRespawnGameObject(_cacheOfTheFirelordGUID, 7 * DAY);
DoRespawnGameObject(_cacheOfTheFirelordGUID, 7_days);
return true;
}

View File

@@ -168,7 +168,7 @@ public:
break;
case DATA_CHESS:
if (state == DONE)
DoRespawnGameObject(DustCoveredChest, DAY);
DoRespawnGameObject(DustCoveredChest, 24h);
break;
default:
break;

View File

@@ -217,7 +217,7 @@ public:
for (GuidList::const_iterator itr = m_uiAncientGemGUID.begin(); itr != m_uiAncientGemGUID.end(); ++itr)
{
//don't know how long it expected
DoRespawnGameObject(*itr, DAY);
DoRespawnGameObject(*itr, 24h);
}
}
}

View File

@@ -208,7 +208,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
DoUpdateCriteria(CriteriaType::BeSpellTarget, SPELL_DEFEAT_FACTION_CHAMPIONS);
if (ResilienceWillFixItTimer > 0)
DoUpdateCriteria(CriteriaType::BeSpellTarget, SPELL_CHAMPIONS_KILLED_IN_MINUTE);
DoRespawnGameObject(GetGuidData(DATA_CRUSADERS_CHEST), 7 * DAY);
DoRespawnGameObject(GetGuidData(DATA_CRUSADERS_CHEST), 7_days);
if (GameObject* cache = GetGameObject(DATA_CRUSADERS_CHEST))
cache->RemoveFlag(GO_FLAG_NOT_SELECTABLE);
if (Creature* fordring = GetCreature(DATA_FORDRING))