Core/Misc: Replace time(NULL) with GameTime::GetGameTime()
(ported commit: 12701cb0c6c45eb105ad449eb9a56e76d84d691e)
This commit is contained in:
1 parent
ba38f74816
commit
5fe3a1f7f9
68 files changed
+335
-259
No files matched your search
@@ -27,6 +27,7 @@ EndScriptData */
|
||||
#include "CharacterCache.h"
|
||||
#include "Chat.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -285,7 +286,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()))
|
||||
active = true;
|
||||
bool permanent = (fields[1].GetUInt64() == uint64(0));
|
||||
std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true);
|
||||
@@ -343,7 +344,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()))
|
||||
active = true;
|
||||
bool permanent = (fields[1].GetUInt32() == uint32(0));
|
||||
std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt32(), true);
|
||||
|
||||
@@ -24,6 +24,7 @@ EndScriptData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "GameTime.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
@@ -116,8 +117,8 @@ public:
|
||||
std::string endTimeStr = TimeToTimestampStr(eventData.end);
|
||||
|
||||
uint32 delay = sGameEventMgr->NextCheck(eventId);
|
||||
time_t nextTime = time(nullptr) + delay;
|
||||
std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(time(nullptr) + delay) : "-";
|
||||
time_t nextTime = GameTime::GetGameTime() + delay;
|
||||
std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(GameTime::GetGameTime() + delay) : "-";
|
||||
|
||||
std::string occurenceStr = secsToTimeString(eventData.occurence * MINUTE);
|
||||
std::string lengthStr = secsToTimeString(eventData.length * MINUTE);
|
||||
|
||||
@@ -26,6 +26,7 @@ EndScriptData */
|
||||
#include "Chat.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GameTime.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
@@ -344,7 +345,7 @@ public:
|
||||
|
||||
if (target)
|
||||
{
|
||||
int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - time(nullptr));
|
||||
int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - GameTime::GetGameTime());
|
||||
if (curRespawnDelay < 0)
|
||||
curRespawnDelay = 0;
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ EndScriptData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
#include "InstanceScript.h"
|
||||
@@ -85,7 +86,7 @@ public:
|
||||
for (Player::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
|
||||
{
|
||||
InstanceSave* save = itr->second.save;
|
||||
std::string timeleft = GetTimeString(save->GetResetTime() - time(nullptr));
|
||||
std::string timeleft = GetTimeString(save->GetResetTime() - GameTime::GetGameTime());
|
||||
handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_INFO, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", itr->second.extendState == EXTEND_STATE_EXPIRED ? "expired" : itr->second.extendState == EXTEND_STATE_EXTENDED ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
|
||||
counter++;
|
||||
}
|
||||
@@ -101,7 +102,7 @@ public:
|
||||
for (Group::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
|
||||
{
|
||||
InstanceSave* save = itr->second.save;
|
||||
std::string timeleft = GetTimeString(save->GetResetTime() - time(nullptr));
|
||||
std::string timeleft = GetTimeString(save->GetResetTime() - GameTime::GetGameTime());
|
||||
handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_INFO, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", "-", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
|
||||
counter++;
|
||||
}
|
||||
@@ -144,7 +145,7 @@ public:
|
||||
InstanceSave* save = itr->second.save;
|
||||
if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficulty()))
|
||||
{
|
||||
std::string timeleft = GetTimeString(save->GetResetTime() - time(nullptr));
|
||||
std::string timeleft = GetTimeString(save->GetResetTime() - GameTime::GetGameTime());
|
||||
handler->PSendSysMessage(LANG_COMMAND_INST_UNBIND_UNBINDING, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
|
||||
player->UnbindInstance(itr, Difficulty(i));
|
||||
counter++;
|
||||
|
||||
@@ -28,6 +28,7 @@ EndScriptData */
|
||||
#include "Creature.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GameTime.h"
|
||||
#include "GameObject.h"
|
||||
#include "Language.h"
|
||||
#include "MapManager.h"
|
||||
@@ -715,7 +716,7 @@ public:
|
||||
uint32 gridY = ri->gridId / MAX_NUMBER_OF_GRIDS;
|
||||
uint32 gridX = ri->gridId % MAX_NUMBER_OF_GRIDS;
|
||||
|
||||
std::string respawnTime = ri->respawnTime > time(nullptr) ? secsToTimeString(uint64(ri->respawnTime - time(nullptr)), true) : stringOverdue;
|
||||
std::string respawnTime = ri->respawnTime > GameTime::GetGameTime() ? secsToTimeString(uint64(ri->respawnTime - GameTime::GetGameTime()), true) : stringOverdue;
|
||||
handler->PSendSysMessage("%u | %u | [%02u,%02u] | %s (%u) | %s", ri->spawnId, ri->entry, gridX, gridY, GetZoneName(ri->zoneId, handler->GetSessionDbcLocale()), ri->zoneId, map->IsSpawnGroupActive(data->spawnGroupData->groupId) ? respawnTime.c_str() : "inactive");
|
||||
}
|
||||
|
||||
@@ -736,7 +737,7 @@ public:
|
||||
uint32 gridY = ri->gridId / MAX_NUMBER_OF_GRIDS;
|
||||
uint32 gridX = ri->gridId % MAX_NUMBER_OF_GRIDS;
|
||||
|
||||
std::string respawnTime = ri->respawnTime > time(nullptr) ? secsToTimeString(uint64(ri->respawnTime - time(nullptr)), true) : stringOverdue;
|
||||
std::string respawnTime = ri->respawnTime > GameTime::GetGameTime() ? secsToTimeString(uint64(ri->respawnTime - GameTime::GetGameTime()), true) : stringOverdue;
|
||||
handler->PSendSysMessage("%u | %u | [% 02u, % 02u] | %s (%u) | %s", ri->spawnId, ri->entry, gridX, gridY, GetZoneName(ri->zoneId, handler->GetSessionDbcLocale()), ri->zoneId, map->IsSpawnGroupActive(data->spawnGroupData->groupId) ? respawnTime.c_str() : "inactive");
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -1790,11 +1790,11 @@ 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->GetTrinityString(LANG_PERMANENTLY), bannedBy.c_str());
|
||||
handler->PSendSysMessage(LANG_PINFO_BANNED, banType.c_str(), banReason.c_str(), banTime > 0 ? secsToTimeString(banTime - GameTime::GetGameTime(), true).c_str() : handler->GetTrinityString(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(), true).c_str(), muteBy.c_str());
|
||||
|
||||
// Output V. LANG_PINFO_ACC_ACCOUNT
|
||||
handler->PSendSysMessage(LANG_PINFO_ACC_ACCOUNT, userName.c_str(), accId, security);
|
||||
@@ -1967,7 +1967,7 @@ public:
|
||||
if (target)
|
||||
{
|
||||
// Target is online, mute will be in effect right away.
|
||||
int64 muteTime = time(nullptr) + notSpeakTime * MINUTE;
|
||||
int64 muteTime = GameTime::GetGameTime() + notSpeakTime * MINUTE;
|
||||
target->GetSession()->m_muteTime = muteTime;
|
||||
stmt->setInt64(0, muteTime);
|
||||
std::string nameLink = handler->playerLink(targetName);
|
||||
|
||||
@@ -28,6 +28,7 @@ EndScriptData */
|
||||
#include "CreatureGroups.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "FollowMovementGenerator.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "Map.h"
|
||||
@@ -784,7 +785,7 @@ public:
|
||||
uint32 displayid = target->GetDisplayId();
|
||||
uint32 nativeid = target->GetNativeDisplayId();
|
||||
uint32 entry = target->GetEntry();
|
||||
int64 curRespawnDelay = target->GetRespawnCompatibilityMode() ? target->GetRespawnTimeEx() - time(nullptr) : target->GetMap()->GetCreatureRespawnTime(target->GetSpawnId()) - time(nullptr);
|
||||
int64 curRespawnDelay = target->GetRespawnCompatibilityMode() ? target->GetRespawnTimeEx() - GameTime::GetGameTime() : target->GetMap()->GetCreatureRespawnTime(target->GetSpawnId()) - GameTime::GetGameTime();
|
||||
|
||||
if (curRespawnDelay < 0)
|
||||
curRespawnDelay = 0;
|
||||
|
||||
@@ -403,7 +403,7 @@ public:
|
||||
return false;
|
||||
|
||||
bool summoned = false;
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
for (int32 i = first; i <= last; ++i)
|
||||
{
|
||||
if (_respawnCooldowns[i] > now)
|
||||
@@ -431,7 +431,7 @@ public:
|
||||
void ClearSlot(PassengerSlots slot)
|
||||
{
|
||||
_controlledSlots[slot].Clear();
|
||||
_respawnCooldowns[slot] = time(nullptr) + _slotInfo[slot].Cooldown;
|
||||
_respawnCooldowns[slot] = GameTime::GetGameTime() + _slotInfo[slot].Cooldown;
|
||||
}
|
||||
|
||||
bool SlotsNeedRefill(PassengerSlots first, PassengerSlots last) const
|
||||
@@ -858,7 +858,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
|
||||
_controller.SetTransport(creature->GetMapTransport());
|
||||
me->setRegeneratingHealth(false);
|
||||
me->m_CombatDistance = 70.0f;
|
||||
_firstMageCooldown = time(nullptr) + 60;
|
||||
_firstMageCooldown = GameTime::GetGameTime() + 60;
|
||||
_axethrowersYellCooldown = time_t(0);
|
||||
_rocketeersYellCooldown = time_t(0);
|
||||
}
|
||||
@@ -868,7 +868,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
|
||||
ScriptedAI::InitializeAI();
|
||||
|
||||
_events.Reset();
|
||||
_firstMageCooldown = time(nullptr) + 60;
|
||||
_firstMageCooldown = GameTime::GetGameTime() + 60;
|
||||
_axethrowersYellCooldown = time_t(0);
|
||||
_rocketeersYellCooldown = time_t(0);
|
||||
}
|
||||
@@ -920,7 +920,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
|
||||
}
|
||||
else if (action == ACTION_SPAWN_MAGE)
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
if (_firstMageCooldown > now)
|
||||
_events.ScheduleEvent(EVENT_SUMMON_MAGE, (_firstMageCooldown - now) * IN_MILLISECONDS);
|
||||
else
|
||||
@@ -1054,10 +1054,10 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
|
||||
case EVENT_CHECK_RIFLEMAN:
|
||||
if (_controller.SummonCreatures(SLOT_RIFLEMAN_1, Is25ManRaid() ? SLOT_RIFLEMAN_8 : SLOT_RIFLEMAN_4))
|
||||
{
|
||||
if (_axethrowersYellCooldown < time(nullptr))
|
||||
if (_axethrowersYellCooldown < GameTime::GetGameTime())
|
||||
{
|
||||
Talk(SAY_SAURFANG_AXETHROWERS);
|
||||
_axethrowersYellCooldown = time(nullptr) + 5;
|
||||
_axethrowersYellCooldown = GameTime::GetGameTime() + 5;
|
||||
}
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_CHECK_RIFLEMAN, 1000);
|
||||
@@ -1065,10 +1065,10 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
|
||||
case EVENT_CHECK_MORTAR:
|
||||
if (_controller.SummonCreatures(SLOT_MORTAR_1, Is25ManRaid() ? SLOT_MORTAR_4 : SLOT_MORTAR_2))
|
||||
{
|
||||
if (_rocketeersYellCooldown < time(nullptr))
|
||||
if (_rocketeersYellCooldown < GameTime::GetGameTime())
|
||||
{
|
||||
Talk(SAY_SAURFANG_ROCKETEERS);
|
||||
_rocketeersYellCooldown = time(nullptr) + 5;
|
||||
_rocketeersYellCooldown = GameTime::GetGameTime() + 5;
|
||||
}
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_CHECK_MORTAR, 1000);
|
||||
@@ -1127,7 +1127,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
|
||||
_controller.SetTransport(creature->GetMapTransport());
|
||||
me->setRegeneratingHealth(false);
|
||||
me->m_CombatDistance = 70.0f;
|
||||
_firstMageCooldown = time(nullptr) + 60;
|
||||
_firstMageCooldown = GameTime::GetGameTime() + 60;
|
||||
_riflemanYellCooldown = time_t(0);
|
||||
_mortarYellCooldown = time_t(0);
|
||||
}
|
||||
@@ -1137,7 +1137,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
|
||||
ScriptedAI::InitializeAI();
|
||||
|
||||
_events.Reset();
|
||||
_firstMageCooldown = time(nullptr) + 60;
|
||||
_firstMageCooldown = GameTime::GetGameTime() + 60;
|
||||
_riflemanYellCooldown = time_t(0);
|
||||
_mortarYellCooldown = time_t(0);
|
||||
}
|
||||
@@ -1189,7 +1189,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
|
||||
}
|
||||
else if (action == ACTION_SPAWN_MAGE)
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
if (_firstMageCooldown > now)
|
||||
_events.ScheduleEvent(EVENT_SUMMON_MAGE, (_firstMageCooldown - now) * IN_MILLISECONDS);
|
||||
else
|
||||
@@ -1327,10 +1327,10 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
|
||||
case EVENT_CHECK_RIFLEMAN:
|
||||
if (_controller.SummonCreatures(SLOT_RIFLEMAN_1, Is25ManRaid() ? SLOT_RIFLEMAN_8 : SLOT_RIFLEMAN_4))
|
||||
{
|
||||
if (_riflemanYellCooldown < time(nullptr))
|
||||
if (_riflemanYellCooldown < GameTime::GetGameTime())
|
||||
{
|
||||
Talk(SAY_MURADIN_RIFLEMAN);
|
||||
_riflemanYellCooldown = time(nullptr) + 5;
|
||||
_riflemanYellCooldown = GameTime::GetGameTime() + 5;
|
||||
}
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_CHECK_RIFLEMAN, 1000);
|
||||
@@ -1338,10 +1338,10 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
|
||||
case EVENT_CHECK_MORTAR:
|
||||
if (_controller.SummonCreatures(SLOT_MORTAR_1, Is25ManRaid() ? SLOT_MORTAR_4 : SLOT_MORTAR_2))
|
||||
{
|
||||
if (_mortarYellCooldown < time(nullptr))
|
||||
if (_mortarYellCooldown < GameTime::GetGameTime())
|
||||
{
|
||||
Talk(SAY_MURADIN_MORTAR);
|
||||
_mortarYellCooldown = time(nullptr) + 5;
|
||||
_mortarYellCooldown = GameTime::GetGameTime() + 5;
|
||||
}
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_CHECK_MORTAR, 1000);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "BattlefieldMgr.h"
|
||||
#include "BattlefieldWG.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GameTime.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "Player.h"
|
||||
@@ -306,7 +307,7 @@ class npc_wg_queue : public CreatureScript
|
||||
else
|
||||
{
|
||||
uint32 timer = wintergrasp->GetTimer() / 1000;
|
||||
player->SendUpdateWorldState(4354, time(nullptr) + timer);
|
||||
player->SendUpdateWorldState(4354, GameTime::GetGameTime() + timer);
|
||||
if (timer < 15 * MINUTE)
|
||||
{
|
||||
AddGossipItemFor(player, GOSSIP_ICON_CHAT, player->GetSession()->GetTrinityString(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
|
||||
|
||||
@@ -2914,7 +2914,7 @@ class spell_item_crystal_prison_dummy_dnd : public SpellScriptLoader
|
||||
if (Creature* target = GetHitCreature())
|
||||
if (target->isDead() && !target->IsPet())
|
||||
{
|
||||
GetCaster()->SummonGameObject(OBJECT_IMPRISONED_DOOMGUARD, *target, QuaternionData(), uint32(target->GetRespawnTime()-time(nullptr)));
|
||||
GetCaster()->SummonGameObject(OBJECT_IMPRISONED_DOOMGUARD, *target, QuaternionData(), uint32(target->GetRespawnTime()-GameTime::GetGameTime()));
|
||||
target->DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1816,7 +1816,7 @@ public:
|
||||
void DamageTaken(Unit* doneBy, uint32& damage) override
|
||||
{
|
||||
me->AddThreat(doneBy, float(damage)); // just to create threat reference
|
||||
_damageTimes[doneBy->GetGUID()] = time(nullptr);
|
||||
_damageTimes[doneBy->GetGUID()] = GameTime::GetGameTime();
|
||||
damage = 0;
|
||||
}
|
||||
|
||||
@@ -1855,7 +1855,7 @@ public:
|
||||
{
|
||||
case EVENT_TD_CHECK_COMBAT:
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
for (std::unordered_map<ObjectGuid, time_t>::iterator itr = _damageTimes.begin(); itr != _damageTimes.end();)
|
||||
{
|
||||
// If unit has not dealt damage to training dummy for 5 seconds, remove him from combat
|
||||
|
||||
Reference in new issue
Block a user