mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-15 00:06:11 +00:00
feat(Core/Time): Implement saparated manager for game time (#8630)
This commit is contained in:
@@ -26,6 +26,7 @@ EndScriptData */
|
||||
#include "BanMgr.h"
|
||||
#include "CharacterCache.h"
|
||||
#include "Chat.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -305,7 +306,7 @@ public:
|
||||
|
||||
time_t unbanDate = time_t(fields[3].GetUInt32());
|
||||
bool active = false;
|
||||
if (fields[2].GetBool() && (fields[1].GetUInt64() == uint64(0) || unbanDate >= time(nullptr)))
|
||||
if (fields[2].GetBool() && (fields[1].GetUInt64() == uint64(0) || unbanDate >= GameTime::GetGameTime().count()))
|
||||
active = true;
|
||||
bool permanent = (fields[1].GetUInt64() == uint64(0));
|
||||
std::string banTime = permanent ? handler->GetAcoreString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true);
|
||||
@@ -353,7 +354,7 @@ public:
|
||||
Field* fields = result->Fetch();
|
||||
time_t unbanDate = time_t(fields[3].GetUInt32());
|
||||
bool active = false;
|
||||
if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbanDate >= time(nullptr)))
|
||||
if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbanDate >= GameTime::GetGameTime().count()))
|
||||
active = true;
|
||||
bool permanent = (fields[1].GetUInt32() == uint32(0));
|
||||
std::string banTime = permanent ? handler->GetAcoreString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include "Chat.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
@@ -116,8 +117,8 @@ public:
|
||||
std::string endTimeStr = Acore::Time::TimeToTimestampStr(Seconds(eventData.end));
|
||||
|
||||
uint32 delay = sGameEventMgr->NextCheck(eventId);
|
||||
time_t nextTime = time(nullptr) + delay;
|
||||
std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? Acore::Time::TimeToTimestampStr(Seconds(time(nullptr) + delay)) : "-";
|
||||
time_t nextTime = GameTime::GetGameTime().count() + delay;
|
||||
std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? Acore::Time::TimeToTimestampStr(Seconds(nextTime)) : "-";
|
||||
|
||||
std::string occurenceStr = secsToTimeString(eventData.occurence * MINUTE, true);
|
||||
std::string lengthStr = secsToTimeString(eventData.length * MINUTE, true);
|
||||
|
||||
@@ -25,6 +25,7 @@ EndScriptData */
|
||||
#include "Chat.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "MapMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -280,7 +281,7 @@ public:
|
||||
|
||||
if (target)
|
||||
{
|
||||
int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - time(nullptr));
|
||||
int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - GameTime::GetGameTime().count());
|
||||
if (curRespawnDelay < 0)
|
||||
curRespawnDelay = 0;
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
EndScriptData */
|
||||
|
||||
#include "Chat.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
#include "InstanceScript.h"
|
||||
@@ -73,7 +74,7 @@ public:
|
||||
{
|
||||
InstanceSave const* save = bind.save;
|
||||
uint32 resetTime = bind.extended ? save->GetExtendedResetTime() : save->GetResetTime();
|
||||
uint32 ttr = (resetTime >= time(nullptr) ? resetTime - time(nullptr) : 0);
|
||||
uint32 ttr = (resetTime >= GameTime::GetGameTime().count() ? resetTime - GameTime::GetGameTime().count() : 0);
|
||||
std::string timeleft = secsToTimeString(ttr);
|
||||
handler->PSendSysMessage("map: %d, inst: %d, perm: %s, diff: %d, canReset: %s, TTR: %s%s",
|
||||
mapId, save->GetInstanceId(), bind.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str(), (bind.extended ? " (extended)" : ""));
|
||||
@@ -111,7 +112,7 @@ public:
|
||||
if (itr->first != player->GetMapId() && (!mapId || mapId == itr->first) && (!difficultyArg || difficultyArg == save->GetDifficulty()))
|
||||
{
|
||||
uint32 resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime();
|
||||
uint32 ttr = (resetTime >= time(nullptr) ? resetTime - time(nullptr) : 0);
|
||||
uint32 ttr = (resetTime >= GameTime::GetGameTime().count() ? resetTime - GameTime::GetGameTime().count() : 0);
|
||||
std::string timeleft = secsToTimeString(ttr);
|
||||
handler->PSendSysMessage("unbinding map: %d, inst: %d, perm: %s, diff: %d, canReset: %s, TTR: %s%s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str(), (itr->second.extended ? " (extended)" : ""));
|
||||
sInstanceSaveMgr->PlayerUnbindInstance(player->GetGUID(), itr->first, Difficulty(i), true, player);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "CharacterCache.h"
|
||||
#include "Chat.h"
|
||||
#include "GameGraveyard.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "Group.h"
|
||||
#include "GuildMgr.h"
|
||||
@@ -2131,13 +2132,13 @@ public:
|
||||
// Output III. LANG_PINFO_BANNED if ban exists and is applied
|
||||
if (banTime >= 0)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_PINFO_BANNED, banType.c_str(), banReason.c_str(), banTime > 0 ? secsToTimeString(banTime - time(nullptr), true).c_str() : handler->GetAcoreString(LANG_PERMANENTLY), bannedBy.c_str());
|
||||
handler->PSendSysMessage(LANG_PINFO_BANNED, banType.c_str(), banReason.c_str(), banTime > 0 ? secsToTimeString(banTime - GameTime::GetGameTime().count(), true).c_str() : handler->GetAcoreString(LANG_PERMANENTLY), bannedBy.c_str());
|
||||
}
|
||||
|
||||
// Output IV. LANG_PINFO_MUTED if mute is applied
|
||||
if (muteTime > 0)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_PINFO_MUTED, muteReason.c_str(), secsToTimeString(muteTime - time(nullptr), true).c_str(), muteBy.c_str());
|
||||
handler->PSendSysMessage(LANG_PINFO_MUTED, muteReason.c_str(), secsToTimeString(muteTime - GameTime::GetGameTime().count(), true).c_str(), muteBy.c_str());
|
||||
}
|
||||
|
||||
// Output V. LANG_PINFO_ACC_ACCOUNT
|
||||
@@ -2409,7 +2410,7 @@ public:
|
||||
if (target)
|
||||
{
|
||||
// Target is online, mute will be in effect right away.
|
||||
int64 muteTime = time(nullptr) + notSpeakTime * MINUTE;
|
||||
int64 muteTime = GameTime::GetGameTime().count() + notSpeakTime * MINUTE;
|
||||
target->GetSession()->m_muteTime = muteTime;
|
||||
stmt->setInt64(0, muteTime);
|
||||
std::string nameLink = handler->playerLink(player->GetName());
|
||||
|
||||
@@ -25,6 +25,7 @@ EndScriptData */
|
||||
#include "Chat.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "CreatureGroups.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Pet.h"
|
||||
@@ -605,7 +606,7 @@ public:
|
||||
id3 = cData->id3;
|
||||
}
|
||||
|
||||
int64 curRespawnDelay = target->GetRespawnTimeEx() - time(nullptr);
|
||||
int64 curRespawnDelay = target->GetRespawnTimeEx() - GameTime::GetGameTime().count();
|
||||
if (curRespawnDelay < 0)
|
||||
curRespawnDelay = 0;
|
||||
std::string curRespawnDelayStr = secsToTimeString(uint64(curRespawnDelay), true);
|
||||
|
||||
@@ -23,6 +23,7 @@ Category: commandscripts
|
||||
EndScriptData */
|
||||
|
||||
#include "Chat.h"
|
||||
#include "GameTime.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "ReputationMgr.h"
|
||||
@@ -379,7 +380,7 @@ public:
|
||||
// fill mail
|
||||
MailDraft draft(quest->GetTitle(), std::string());
|
||||
|
||||
for (auto itr : questItems)
|
||||
for (auto const& itr : questItems)
|
||||
{
|
||||
if (Item* item = Item::CreateItem(itr.first, itr.second))
|
||||
{
|
||||
@@ -615,7 +616,7 @@ public:
|
||||
// fill mail
|
||||
MailDraft draft(quest->GetTitle(), "This quest has been manually rewarded to you. This mail contains your quest rewards.");
|
||||
|
||||
for (auto itr : questRewardItems)
|
||||
for (auto const& itr : questRewardItems)
|
||||
{
|
||||
if (!itr.first || !itr.second)
|
||||
{
|
||||
@@ -652,7 +653,7 @@ public:
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_DAILYQUESTSTATUS);
|
||||
stmt->setUInt32(0, guid);
|
||||
stmt->setUInt32(1, entry);
|
||||
stmt->setUInt64(2, time(nullptr));
|
||||
stmt->setUInt64(2, GameTime::GetGameTime().count());
|
||||
trans->Append(stmt);
|
||||
}
|
||||
else if (quest->IsWeekly())
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
Category: commandscripts
|
||||
EndScriptData */
|
||||
|
||||
#include "AvgDiffTracker.h"
|
||||
#include "Chat.h"
|
||||
#include "Config.h"
|
||||
#include "GameTime.h"
|
||||
#include "GitRevision.h"
|
||||
#include "Language.h"
|
||||
#include "ModuleMgr.h"
|
||||
@@ -34,6 +34,7 @@
|
||||
#include "ScriptMgr.h"
|
||||
#include "ServerMotd.h"
|
||||
#include "StringConvert.h"
|
||||
#include "UpdateTime.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "VMapMgr2.h"
|
||||
#include <boost/version.hpp>
|
||||
@@ -77,7 +78,6 @@ public:
|
||||
|
||||
static ChatCommandTable serverSetCommandTable =
|
||||
{
|
||||
{ "difftime", HandleServerSetDiffTimeCommand, SEC_CONSOLE, Console::Yes },
|
||||
{ "loglevel", HandleServerSetLogLevelCommand, SEC_CONSOLE, Console::Yes },
|
||||
{ "motd", HandleServerSetMotdCommand, SEC_ADMINISTRATOR, Console::Yes },
|
||||
{ "closed", HandleServerSetClosedCommand, SEC_CONSOLE, Console::Yes },
|
||||
@@ -238,23 +238,16 @@ public:
|
||||
uint32 activeSessionCount = sWorld->GetActiveSessionCount();
|
||||
uint32 queuedSessionCount = sWorld->GetQueuedSessionCount();
|
||||
uint32 connPeak = sWorld->GetMaxActiveSessionCount();
|
||||
std::string uptime = secsToTimeString(sWorld->GetUptime()).append(".");
|
||||
uint32 updateTime = sWorld->GetUpdateTime();
|
||||
uint32 avgUpdateTime = avgDiffTracker.getAverage();
|
||||
|
||||
handler->PSendSysMessage("%s", GitRevision::GetFullVersion());
|
||||
if (!queuedSessionCount)
|
||||
handler->PSendSysMessage("Connected players: %u. Characters in world: %u.", activeSessionCount, playerCount);
|
||||
else
|
||||
handler->PSendSysMessage("Connected players: %u. Characters in world: %u. Queue: %u.", activeSessionCount, playerCount, queuedSessionCount);
|
||||
handler->PSendSysMessage("Connection peak: %u.", connPeak);
|
||||
handler->PSendSysMessage(LANG_UPTIME, uptime.c_str());
|
||||
handler->PSendSysMessage("Update time diff: %ums, average: %ums.", updateTime, avgUpdateTime);
|
||||
|
||||
if (handler->GetSession())
|
||||
if (Player* p = handler->GetSession()->GetPlayer())
|
||||
if (p->IsDeveloper())
|
||||
handler->PSendSysMessage("DEV wavg: %ums, nsmax: %ums, nsavg: %ums. LFG avg: %ums, max: %ums.", avgDiffTracker.getTimeWeightedAverage(), devDiffTracker.getMax(), devDiffTracker.getAverage(), lfgDiffTracker.getAverage(), lfgDiffTracker.getMax());
|
||||
handler->PSendSysMessage("Connection peak: %u.", connPeak);
|
||||
handler->PSendSysMessage(LANG_UPTIME, secsToTimeString(GameTime::GetUptime().count()).c_str());
|
||||
handler->PSendSysMessage("Update time diff: %ums, average: %ums.", sWorldUpdateTime.GetLastUpdateTime(), sWorldUpdateTime.GetAverageUpdateTime());
|
||||
|
||||
//! Can't use sWorld->ShutdownMsg here in case of console command
|
||||
if (sWorld->IsShuttingDown())
|
||||
@@ -439,18 +432,6 @@ public:
|
||||
sLog->SetLogLevel(name, level, isLogger);
|
||||
return true;
|
||||
}
|
||||
|
||||
// set diff time record interval
|
||||
static bool HandleServerSetDiffTimeCommand(ChatHandler* /*handler*/, int32 newTime)
|
||||
{
|
||||
if (newTime < 0)
|
||||
return false;
|
||||
|
||||
sWorld->SetRecordDiffInterval(newTime);
|
||||
printf("Record diff every %u ms\n", newTime);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_server_commandscript()
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "blackrock_depths.h"
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
@@ -154,7 +155,7 @@ public:
|
||||
{
|
||||
if (InstanceScript* instance = player->GetInstanceScript())
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime().count();
|
||||
if (instance->GetData(TYPE_RING_OF_LAW) == IN_PROGRESS || instance->GetData(TYPE_RING_OF_LAW) == DONE)
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -15,12 +15,13 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GameTime.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "blackrock_depths.h"
|
||||
|
||||
#define MAX_ENCOUNTER 6
|
||||
constexpr auto MAX_ENCOUNTER = 6;
|
||||
|
||||
enum Timers
|
||||
{
|
||||
@@ -462,7 +463,7 @@ public:
|
||||
{
|
||||
TempSummonGrimstone->RemoveFromWorld();
|
||||
TempSummonGrimstone = nullptr;
|
||||
timeRingFail = time(nullptr);
|
||||
timeRingFail = GameTime::GetGameTime().count();
|
||||
}
|
||||
SetData(TYPE_RING_OF_LAW, NOT_STARTED);
|
||||
break;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "CellImpl.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "Group.h"
|
||||
#include "LFGMgr.h"
|
||||
@@ -99,7 +100,7 @@ struct npc_brewfest_keg_reciver : public ScriptedAI
|
||||
{
|
||||
if (Aura* aur = player->GetAura(SPELL_RAM_AURA))
|
||||
{
|
||||
int32 diff = aur->GetApplyTime() - (time(nullptr) - (HOUR * 18) + spellCooldown);
|
||||
int32 diff = aur->GetApplyTime() - (GameTime::GetGameTime().count() - (HOUR * 18) + spellCooldown);
|
||||
if (diff > 10) // aura applied later
|
||||
return;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
@@ -198,7 +199,7 @@ public:
|
||||
Position pos;
|
||||
pos.Relocate(posVec.at(num));
|
||||
me->m_last_notify_position.Relocate(0.0f, 0.0f, 0.0f);
|
||||
me->m_last_notify_mstime = World::GetGameTimeMS() + 10000;
|
||||
me->m_last_notify_mstime = GameTime::GetGameTimeMS().count() + 10000;
|
||||
|
||||
me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
|
||||
}
|
||||
@@ -310,7 +311,7 @@ public:
|
||||
}
|
||||
|
||||
// Achievement
|
||||
if ((time(nullptr) - GetApplyTime()) > 60 && target->GetTypeId() == TYPEID_PLAYER)
|
||||
if ((GameTime::GetGameTime().count() - GetApplyTime()) > 60 && target->GetTypeId() == TYPEID_PLAYER)
|
||||
target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58934, 0, target);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
@@ -348,7 +349,7 @@ public:
|
||||
c->DespawnOrUnsummon(10000);
|
||||
if( Creature* c = instance->GetCreature(NPC_DreadscaleGUID) )
|
||||
c->DespawnOrUnsummon(10000);
|
||||
if( AchievementTimer + 10 >= time(nullptr) )
|
||||
if( AchievementTimer + 10 >= GameTime::GetGameTime().count() )
|
||||
DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_JORMUNGAR_ACHIEV);
|
||||
AchievementTimer = 0;
|
||||
|
||||
@@ -365,7 +366,7 @@ public:
|
||||
}
|
||||
else // first one died, start timer for achievement
|
||||
{
|
||||
AchievementTimer = time(nullptr);
|
||||
AchievementTimer = GameTime::GetGameTime().count();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -447,14 +448,14 @@ public:
|
||||
|
||||
HandleGameObject(GO_EnterGateGUID, true);
|
||||
|
||||
if( AchievementTimer + 60 >= time(nullptr) )
|
||||
if( AchievementTimer + 60 >= GameTime::GetGameTime().count() )
|
||||
DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_RESILIENCE_WILL_FIX_IT_CREDIT);
|
||||
AchievementTimer = 0;
|
||||
|
||||
SaveToDB();
|
||||
}
|
||||
else if( Counter == 1 )
|
||||
AchievementTimer = time(nullptr);
|
||||
AchievementTimer = GameTime::GetGameTime().count();
|
||||
}
|
||||
break;
|
||||
case TYPE_FACTION_CHAMPIONS_START:
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "CreatureTextMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "MoveSpline.h"
|
||||
#include "MoveSplineInit.h"
|
||||
#include "ScriptMgr.h"
|
||||
@@ -424,7 +425,7 @@ public:
|
||||
return false;
|
||||
|
||||
bool summoned = false;
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime().count();
|
||||
for (int32 i = first; i <= last; ++i)
|
||||
{
|
||||
if (_respawnCooldowns[i] > now)
|
||||
@@ -460,7 +461,7 @@ public:
|
||||
void ClearSlot(PassengerSlots slot)
|
||||
{
|
||||
_controlledSlots[slot].Clear();
|
||||
_respawnCooldowns[slot] = time(nullptr) + _slotInfo[slot].Cooldown;
|
||||
_respawnCooldowns[slot] = GameTime::GetGameTime().count() + _slotInfo[slot].Cooldown;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -749,7 +750,7 @@ public:
|
||||
_controller.ResetSlots(TEAM_HORDE, creature->GetTransport()->ToMotionTransport());
|
||||
me->SetRegeneratingHealth(false);
|
||||
me->m_CombatDistance = 70.0f;
|
||||
_firstMageCooldown = time(nullptr) + 45;
|
||||
_firstMageCooldown = GameTime::GetGameTime().count() + 45;
|
||||
_axethrowersYellCooldown = time_t(0);
|
||||
_rocketeersYellCooldown = time_t(0);
|
||||
checkTimer = 1000;
|
||||
@@ -814,7 +815,7 @@ public:
|
||||
}
|
||||
else if (action == ACTION_SPAWN_MAGE)
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime().count();
|
||||
if (_firstMageCooldown > now)
|
||||
_events.ScheduleEvent(EVENT_SUMMON_MAGE, (_firstMageCooldown - now) * IN_MILLISECONDS);
|
||||
else
|
||||
@@ -989,10 +990,10 @@ public:
|
||||
case EVENT_CHECK_RIFLEMAN:
|
||||
if (_controller.SummonCreatures(me, SLOT_RIFLEMAN_1, Is25ManRaid() ? SLOT_RIFLEMAN_8 : SLOT_RIFLEMAN_4))
|
||||
{
|
||||
if (_axethrowersYellCooldown < time(nullptr))
|
||||
if (_axethrowersYellCooldown < GameTime::GetGameTime().count())
|
||||
{
|
||||
Talk(SAY_SAURFANG_AXETHROWERS);
|
||||
_axethrowersYellCooldown = time(nullptr) + 5;
|
||||
_axethrowersYellCooldown = GameTime::GetGameTime().count() + 5;
|
||||
}
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_CHECK_RIFLEMAN, 1500);
|
||||
@@ -1000,10 +1001,10 @@ public:
|
||||
case EVENT_CHECK_MORTAR:
|
||||
if (_controller.SummonCreatures(me, SLOT_MORTAR_1, Is25ManRaid() ? SLOT_MORTAR_4 : SLOT_MORTAR_2))
|
||||
{
|
||||
if (_rocketeersYellCooldown < time(nullptr))
|
||||
if (_rocketeersYellCooldown < GameTime::GetGameTime().count())
|
||||
{
|
||||
Talk(SAY_SAURFANG_ROCKETEERS);
|
||||
_rocketeersYellCooldown = time(nullptr) + 5;
|
||||
_rocketeersYellCooldown = GameTime::GetGameTime().count() + 5;
|
||||
}
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_CHECK_MORTAR, 1500);
|
||||
@@ -1084,7 +1085,7 @@ public:
|
||||
_controller.ResetSlots(TEAM_ALLIANCE, creature->GetTransport()->ToMotionTransport());
|
||||
me->SetRegeneratingHealth(false);
|
||||
me->m_CombatDistance = 70.0f;
|
||||
_firstMageCooldown = time(nullptr) + 45;
|
||||
_firstMageCooldown = GameTime::GetGameTime().count() + 45;
|
||||
_riflemanYellCooldown = time_t(0);
|
||||
_mortarYellCooldown = time_t(0);
|
||||
checkTimer = 1000;
|
||||
@@ -1150,7 +1151,7 @@ public:
|
||||
}
|
||||
else if (action == ACTION_SPAWN_MAGE)
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime().count();
|
||||
if (_firstMageCooldown > now)
|
||||
_events.ScheduleEvent(EVENT_SUMMON_MAGE, (_firstMageCooldown - now) * IN_MILLISECONDS);
|
||||
else
|
||||
@@ -1328,10 +1329,10 @@ public:
|
||||
case EVENT_CHECK_RIFLEMAN:
|
||||
if (_controller.SummonCreatures(me, SLOT_RIFLEMAN_1, Is25ManRaid() ? SLOT_RIFLEMAN_8 : SLOT_RIFLEMAN_4))
|
||||
{
|
||||
if (_riflemanYellCooldown < time(nullptr))
|
||||
if (_riflemanYellCooldown < GameTime::GetGameTime().count())
|
||||
{
|
||||
Talk(SAY_MURADIN_RIFLEMAN);
|
||||
_riflemanYellCooldown = time(nullptr) + 5;
|
||||
_riflemanYellCooldown = GameTime::GetGameTime().count() + 5;
|
||||
}
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_CHECK_RIFLEMAN, 1500);
|
||||
@@ -1339,10 +1340,10 @@ public:
|
||||
case EVENT_CHECK_MORTAR:
|
||||
if (_controller.SummonCreatures(me, SLOT_MORTAR_1, Is25ManRaid() ? SLOT_MORTAR_4 : SLOT_MORTAR_2))
|
||||
{
|
||||
if (_mortarYellCooldown < time(nullptr))
|
||||
if (_mortarYellCooldown < GameTime::GetGameTime().count())
|
||||
{
|
||||
Talk(SAY_MURADIN_MORTAR);
|
||||
_mortarYellCooldown = time(nullptr) + 5;
|
||||
_mortarYellCooldown = GameTime::GetGameTime().count() + 5;
|
||||
}
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_CHECK_MORTAR, 1500);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
@@ -950,7 +951,7 @@ public:
|
||||
if (!spellInfo)
|
||||
return false;
|
||||
|
||||
uint32 currMSTime = World::GetGameTimeMS();
|
||||
uint32 currMSTime = GameTime::GetGameTimeMS().count();
|
||||
std::map<uint32, uint32>::iterator itr = _lastMSTimeForSpell.find(spellInfo->Id);
|
||||
if (itr != _lastMSTimeForSpell.end())
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "Cell.h"
|
||||
#include "CellImpl.h"
|
||||
#include "CreatureTextMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -720,9 +721,9 @@ public:
|
||||
|
||||
void KilledUnit(Unit* victim) override
|
||||
{
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER && !me->IsInEvadeMode() && _phase != PHASE_OUTRO && _lastTalkTimeKill + 5 < time(nullptr))
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER && !me->IsInEvadeMode() && _phase != PHASE_OUTRO && _lastTalkTimeKill + 5 < GameTime::GetGameTime().count())
|
||||
{
|
||||
_lastTalkTimeKill = time(nullptr);
|
||||
_lastTalkTimeKill = GameTime::GetGameTime().count();
|
||||
Talk(SAY_LK_KILL);
|
||||
}
|
||||
}
|
||||
@@ -751,7 +752,7 @@ public:
|
||||
events.RescheduleEvent(EVENT_START_ATTACK, 1000);
|
||||
EntryCheckPredicate pred(NPC_STRANGULATE_VEHICLE);
|
||||
summons.DoAction(ACTION_TELEPORT_BACK, pred);
|
||||
if (!IsHeroic() && _phase != PHASE_OUTRO && me->IsInCombat() && _lastTalkTimeBuff + 5 <= time(nullptr))
|
||||
if (!IsHeroic() && _phase != PHASE_OUTRO && me->IsInCombat() && _lastTalkTimeBuff + 5 <= GameTime::GetGameTime().count())
|
||||
Talk(SAY_LK_FROSTMOURNE_ESCAPE);
|
||||
}
|
||||
break;
|
||||
@@ -906,9 +907,9 @@ public:
|
||||
|
||||
void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override
|
||||
{
|
||||
if (spell->Id == HARVESTED_SOUL_BUFF && me->IsInCombat() && !IsHeroic() && _phase != PHASE_OUTRO && _lastTalkTimeBuff + 5 <= time(nullptr))
|
||||
if (spell->Id == HARVESTED_SOUL_BUFF && me->IsInCombat() && !IsHeroic() && _phase != PHASE_OUTRO && _lastTalkTimeBuff + 5 <= GameTime::GetGameTime().count())
|
||||
{
|
||||
_lastTalkTimeBuff = time(nullptr);
|
||||
_lastTalkTimeBuff = GameTime::GetGameTime().count();
|
||||
Talk(SAY_LK_FROSTMOURNE_KILL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
@@ -276,10 +277,10 @@ public:
|
||||
if (id == 1337)
|
||||
{
|
||||
if (lastShatterMSTime)
|
||||
if (getMSTimeDiff(lastShatterMSTime, World::GetGameTimeMS()) <= 5000)
|
||||
if (getMSTimeDiff(lastShatterMSTime, GameTime::GetGameTimeMS().count()) <= 5000)
|
||||
bShattered = true;
|
||||
|
||||
lastShatterMSTime = World::GetGameTimeMS();
|
||||
lastShatterMSTime = GameTime::GetGameTimeMS().count();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GameTime.h"
|
||||
#include "MapMgr.h"
|
||||
#include "PassiveAI.h"
|
||||
#include "Player.h"
|
||||
@@ -455,7 +456,7 @@ public:
|
||||
case EVENT_SPAWN_FLAMES_INITIAL:
|
||||
{
|
||||
if (changeAllowedFlameSpreadTime)
|
||||
allowedFlameSpreadTime = time(nullptr);
|
||||
allowedFlameSpreadTime = GameTime::GetGameTime().count();
|
||||
|
||||
std::vector<Player*> pg;
|
||||
Map::PlayerList const& pl = me->GetMap()->GetPlayers();
|
||||
@@ -2204,7 +2205,7 @@ public:
|
||||
|
||||
bool Load() override
|
||||
{
|
||||
lastMSTime = World::GetGameTimeMS();
|
||||
lastMSTime = GameTime::GetGameTimeMS().count();
|
||||
lastOrientation = -1.0f;
|
||||
return true;
|
||||
}
|
||||
@@ -2215,14 +2216,14 @@ public:
|
||||
{
|
||||
if (c->GetTypeId() != TYPEID_UNIT)
|
||||
return;
|
||||
uint32 diff = getMSTimeDiff(lastMSTime, World::GetGameTimeMS());
|
||||
uint32 diff = getMSTimeDiff(lastMSTime, GameTime::GetGameTimeMS().count());
|
||||
if (lastOrientation == -1.0f)
|
||||
{
|
||||
lastOrientation = (c->ToCreature()->AI()->GetData(0) * 2 * M_PI) / 100.0f;
|
||||
diff = 0;
|
||||
}
|
||||
float new_o = Position::NormalizeOrientation(lastOrientation - (M_PI / 60) * (diff / 250.0f));
|
||||
lastMSTime = World::GetGameTimeMS();
|
||||
lastMSTime = GameTime::GetGameTimeMS().count();
|
||||
lastOrientation = new_o;
|
||||
c->SetFacingTo(new_o);
|
||||
|
||||
@@ -2283,7 +2284,7 @@ public:
|
||||
{
|
||||
npc_ulduar_flames_initialAI(Creature* pCreature) : NullCreatureAI(pCreature)
|
||||
{
|
||||
CreateTime = time(nullptr);
|
||||
CreateTime = GameTime::GetGameTime().count();
|
||||
events.Reset();
|
||||
events.ScheduleEvent(EVENT_FLAMES_SPREAD, 5750);
|
||||
if( Creature* flame = me->SummonCreature(NPC_FLAMES_SPREAD, me->GetPositionX(), me->GetPositionY(), 364.32f, 0.0f) )
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
@@ -1013,10 +1014,10 @@ public:
|
||||
}
|
||||
else if (unit->GetTypeId() == TYPEID_UNIT && unit->GetAreaId() == 4656 /*Conservatory of Life*/)
|
||||
{
|
||||
if (time(nullptr) > (m_conspeedatoryAttempt + DAY))
|
||||
if (GameTime::GetGameTime().count() > (m_conspeedatoryAttempt + DAY))
|
||||
{
|
||||
DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, 21597 /*CON-SPEED-ATORY_TIMED_CRITERIA*/);
|
||||
m_conspeedatoryAttempt = time(nullptr);
|
||||
m_conspeedatoryAttempt = GameTime::GetGameTime().count();
|
||||
SaveToDB();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "Battlefield.h"
|
||||
#include "BattlefieldMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
@@ -190,13 +191,13 @@ public:
|
||||
switch (type)
|
||||
{
|
||||
case EVENT_ARCHAVON:
|
||||
ArchavonDeath = time(nullptr);
|
||||
ArchavonDeath = GameTime::GetGameTime().count();
|
||||
break;
|
||||
case EVENT_EMALON:
|
||||
EmalonDeath = time(nullptr);
|
||||
EmalonDeath = GameTime::GetGameTime().count();
|
||||
break;
|
||||
case EVENT_KORALON:
|
||||
KoralonDeath = time(nullptr);
|
||||
KoralonDeath = GameTime::GetGameTime().count();
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "CombatAI.h"
|
||||
#include "GameGraveyard.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "GameTime.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "PoolMgr.h"
|
||||
@@ -294,7 +295,7 @@ public:
|
||||
else
|
||||
{
|
||||
uint32 timer = wintergrasp->GetTimer() / 1000;
|
||||
player->SendUpdateWorldState(4354, time(nullptr) + timer);
|
||||
player->SendUpdateWorldState(4354, GameTime::GetGameTime().count() + timer);
|
||||
if (timer < 15 * MINUTE)
|
||||
{
|
||||
AddGossipItemFor(player, GOSSIP_ICON_CHAT, "Queue for Wintergrasp.", GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GameTime.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "the_botanica.h"
|
||||
@@ -163,7 +164,7 @@ public:
|
||||
{
|
||||
if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo())
|
||||
{
|
||||
if ((spellInfo->GetSchoolMask() & _lastSchool) && _swapTime > time(nullptr))
|
||||
if ((spellInfo->GetSchoolMask() & _lastSchool) && _swapTime > GameTime::GetGameTime().count())
|
||||
return false;
|
||||
|
||||
uint32 form = 0;
|
||||
@@ -187,7 +188,7 @@ public:
|
||||
|
||||
if (form)
|
||||
{
|
||||
_swapTime = time(nullptr) + 6;
|
||||
_swapTime = GameTime::GetGameTime().count() + 6;
|
||||
_lastSchool = spellInfo->GetSchoolMask();
|
||||
GetUnitOwner()->RemoveAurasDueToSpell(_lastForm);
|
||||
_lastForm = form;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "Cell.h"
|
||||
#include "CellImpl.h"
|
||||
#include "Chat.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "Group.h"
|
||||
#include "InstanceScript.h"
|
||||
@@ -2250,12 +2251,12 @@ class spell_gen_turkey_marker : public AuraScript
|
||||
{
|
||||
if (GetStackAmount() > stackAmount)
|
||||
{
|
||||
_applyTimes.push_back(World::GetGameTimeMS());
|
||||
_applyTimes.push_back(GameTime::GetGameTimeMS().count());
|
||||
stackAmount++;
|
||||
}
|
||||
|
||||
// pop stack if it expired for us
|
||||
if (_applyTimes.front() + GetMaxDuration() < World::GetGameTimeMS())
|
||||
if (_applyTimes.front() + GetMaxDuration() < GameTime::GetGameTimeMS().count())
|
||||
{
|
||||
stackAmount--;
|
||||
ModStackAmount(-1, AURA_REMOVE_BY_EXPIRE);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
*/
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
@@ -2716,11 +2717,13 @@ class spell_item_crystal_prison_dummy_dnd : public SpellScript
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
if (Creature* target = GetHitCreature())
|
||||
{
|
||||
if (target->isDead() && !target->IsPet())
|
||||
{
|
||||
GetCaster()->SummonGameObject(OBJECT_IMPRISONED_DOOMGUARD, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0, 0, 0, 0, uint32(target->GetRespawnTime() - time(nullptr)));
|
||||
GetCaster()->SummonGameObject(OBJECT_IMPRISONED_DOOMGUARD, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation(), 0, 0, 0, 0, uint32(target->GetRespawnTime() - GameTime::GetGameTime().count()));
|
||||
target->DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -34,6 +34,7 @@ at_brewfest
|
||||
at_area_52_entrance
|
||||
EndContentData */
|
||||
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
@@ -384,7 +385,7 @@ public:
|
||||
{
|
||||
uint32 triggerId = trigger->entry;
|
||||
// Second trigger happened too early after first, skip for now
|
||||
if (sWorld->GetGameTime() - _triggerTimes[triggerId] < AREATRIGGER_TALK_COOLDOWN)
|
||||
if (GameTime::GetGameTime().count() - _triggerTimes[triggerId] < AREATRIGGER_TALK_COOLDOWN)
|
||||
return false;
|
||||
|
||||
switch (triggerId)
|
||||
@@ -401,7 +402,7 @@ public:
|
||||
break;
|
||||
}
|
||||
|
||||
_triggerTimes[triggerId] = sWorld->GetGameTime();
|
||||
_triggerTimes[triggerId] = GameTime::GetGameTime().count();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -441,7 +442,7 @@ public:
|
||||
return false;
|
||||
|
||||
uint32 triggerId = trigger->entry;
|
||||
if (sWorld->GetGameTime() - _triggerTimes[trigger->entry] < SUMMON_COOLDOWN)
|
||||
if (GameTime::GetGameTime().count() - _triggerTimes[trigger->entry] < SUMMON_COOLDOWN)
|
||||
return false;
|
||||
|
||||
switch (triggerId)
|
||||
@@ -470,7 +471,7 @@ public:
|
||||
|
||||
player->SummonCreature(NPC_SPOTLIGHT, x, y, z, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 5000);
|
||||
player->AddAura(SPELL_A52_NEURALYZER, player);
|
||||
_triggerTimes[trigger->entry] = sWorld->GetGameTime();
|
||||
_triggerTimes[trigger->entry] = GameTime::GetGameTime().count();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ EndContentData */
|
||||
|
||||
#include "CellImpl.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
@@ -1414,7 +1415,7 @@ class go_inconspicuous_landmark : public GameObjectScript
|
||||
public:
|
||||
go_inconspicuous_landmark() : GameObjectScript("go_inconspicuous_landmark")
|
||||
{
|
||||
_lastUsedTime = time(nullptr);
|
||||
_lastUsedTime = GameTime::GetGameTime().count();
|
||||
}
|
||||
|
||||
bool OnGossipHello(Player* player, GameObject* /*go*/) override
|
||||
@@ -1422,10 +1423,10 @@ public:
|
||||
if (player->HasItemCount(ITEM_CUERGOS_KEY))
|
||||
return true;
|
||||
|
||||
if (_lastUsedTime > time(nullptr))
|
||||
if (_lastUsedTime > GameTime::GetGameTime().count())
|
||||
return true;
|
||||
|
||||
_lastUsedTime = time(nullptr) + MINUTE;
|
||||
_lastUsedTime = GameTime::GetGameTime().count() + MINUTE;
|
||||
player->CastSpell(player, SPELL_SUMMON_PIRATES_TREASURE_AND_TRIGGER_MOB, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "npc_stave_of_ancients.h"
|
||||
#include "CreatureGroups.h"
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
@@ -602,7 +603,7 @@ public:
|
||||
if (Precious()->isDead())
|
||||
{
|
||||
// Make it so that Precious respawns after Simone
|
||||
uint32 respawnTime = me->GetRespawnTime() - time(nullptr);
|
||||
uint32 respawnTime = me->GetRespawnTime() - GameTime::GetGameTime().count();
|
||||
Precious()->SetRespawnTime(respawnTime);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ EndContentData */
|
||||
#include "CreatureTextMgr.h"
|
||||
#include "DBCStructure.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "PassiveAI.h"
|
||||
|
||||
Reference in New Issue
Block a user