Core/InstanceScript: std::chrono-ify DoRespawnGameObject

This commit is contained in:
Carbenium
2020-07-25 20:09:03 +02:00
committed by Peter Keresztes Schmidt
parent d5de96e46b
commit d7ff8c272a
8 changed files with 10 additions and 9 deletions

View File

@@ -523,7 +523,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))
{
@@ -543,7 +543,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 <map>
#include <memory>
#include <set>
@@ -210,7 +211,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

@@ -415,7 +415,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

@@ -216,7 +216,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
DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_DEFEAT_FACTION_CHAMPIONS);
if (ResilienceWillFixItTimer > 0)
DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 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(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
if (Creature* fordring = GetCreature(DATA_FORDRING))