Revert "Core/Misc: Replace time(NULL) with GameTime::GetGameTime()"

This reverts commit 5fe3a1f7f9.
This commit is contained in:
Ovahlord committed 2019-07-08 15:56:29 +02:00
1 parent 4dc27b53eb
commit c074c3a9c6
69 files changed
+258 -357

No files matched your search

@@ -24,7 +24,6 @@
#include "DatabaseEnv.h"
#include "DBCEnums.h"
#include "DisableMgr.h"
#include "GameTime.h"
#include "GameEventMgr.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
@@ -694,7 +693,7 @@ void AchievementMgr<Player>::LoadFromDB(PreparedQueryResult achievementResult, P
if (criteriaResult)
{
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
do
{
Field* fields = criteriaResult->Fetch();
@@ -757,7 +756,7 @@ void AchievementMgr<Guild>::LoadFromDB(PreparedQueryResult achievementResult, Pr
if (criteriaResult)
{
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
do
{
Field* fields = criteriaResult->Fetch();
@@ -896,7 +895,7 @@ void AchievementMgr<T>::SendAchievementEarned(AchievementEntry const* achievemen
WorldPacket data(SMSG_ACHIEVEMENT_EARNED, 8+4+8);
data << GetOwner()->GetPackGUID();
data << uint32(achievement->ID);
data.AppendPackedTime(GameTime::GetGameTime());
data.AppendPackedTime(time(nullptr));
data << uint32(0); // does not notify player ingame
GetOwner()->SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), true);
}
@@ -917,7 +916,7 @@ void AchievementMgr<Guild>::SendAchievementEarned(AchievementEntry const* achiev
data.WriteBit(guid[5]);
data.WriteByteSeq(guid[2]);
data.AppendPackedTime(GameTime::GetGameTime());
data.AppendPackedTime(time(nullptr));
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[1]);
@@ -1858,7 +1857,7 @@ void AchievementMgr<T>::SetCriteriaProgress(AchievementCriteriaEntry const* entr
}
progress->changed = true;
progress->date = GameTime::GetGameTime(); // set the date to the latest update.
progress->date = time(nullptr); // set the date to the latest update.
AchievementEntry const* achievement = sAchievementMgr->GetAchievement(entry->achievement);
uint32 timeElapsed = 0;
@@ -1975,7 +1974,7 @@ void AchievementMgr<Player>::CompletedAchievement(AchievementEntry const* achiev
achievement->ID, GetOwner()->GetName().c_str(), GetOwner()->GetGUID().GetCounter());
CompletedAchievementData& ca = m_completedAchievements[achievement->ID];
ca.date = GameTime::GetGameTime();
ca.date = time(nullptr);
ca.changed = true;
sAchievementMgr->SetRealmCompleted(achievement, GetOwner()->GetInstanceId());
@@ -2056,7 +2055,7 @@ void AchievementMgr<Guild>::CompletedAchievement(AchievementEntry const* achieve
SendAchievementEarned(achievement);
CompletedAchievementData& ca = m_completedAchievements[achievement->ID];
ca.date = GameTime::GetGameTime();
ca.date = time(nullptr);
ca.changed = true;
if (achievement->flags & ACHIEVEMENT_FLAG_SHOW_GUILD_MEMBERS)
@@ -549,7 +549,7 @@ void AuctionHouseMgr::UpdatePendingAuctions()
{
AuctionEntry* AH = (*AHitr);
++AHitr;
AH->expire_time = GameTime::GetGameTime();
AH->expire_time = time(nullptr);
AH->DeleteFromDB(trans);
AH->SaveToDB(trans);
}
@@ -864,7 +864,7 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket& data, Item* sourceItem) const
data << uint64(bid ? GetAuctionOutBid() : 0);
// Minimal outbid
data << uint64(buyout); // Auction->buyout
data << uint32((expire_time - GameTime::GetGameTime()) * IN_MILLISECONDS); // time left
data << uint32((expire_time - time(nullptr)) * IN_MILLISECONDS); // time left
data << uint64(bidder); // auction->bidder current
data << uint64(bid); // current bid
return true;
@@ -17,7 +17,6 @@
#include "AuctionHouseBotBuyer.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "Item.h"
#include "ItemTemplate.h"
#include "Log.h"
@@ -98,7 +97,7 @@ bool AuctionBotBuyer::Update(AuctionHouseType houseType)
uint32 AuctionBotBuyer::GetItemInformation(BuyerConfiguration& config)
{
config.SameItemInfo.clear();
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
uint32 count = 0;
AuctionHouseObject* house = sAuctionMgr->GetAuctionsMap(config.GetHouseType());
@@ -238,7 +237,7 @@ bool AuctionBotBuyer::RollBidChance(BuyerItemInfo const* ahInfo, Item const* ite
void AuctionBotBuyer::PrepareListOfEntry(BuyerConfiguration& config)
{
// now - 5 seconds to leave out all old entries but keep the ones just updated a moment ago
time_t now = GameTime::GetGameTime() - 5;
time_t now = time(nullptr) - 5;
for (CheckEntryMap::iterator itr = config.EligibleItems.begin(); itr != config.EligibleItems.end();)
{
@@ -254,7 +253,7 @@ void AuctionBotBuyer::PrepareListOfEntry(BuyerConfiguration& config)
// Tries to bid and buy items based on their prices and chances set in configs
void AuctionBotBuyer::BuyAndBidItems(BuyerConfiguration& config)
{
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(config.GetHouseType());
CheckEntryMap& items = config.EligibleItems;
@@ -21,7 +21,6 @@
#include "DatabaseEnv.h"
#include "DBCStores.h"
#include "DB2Stores.h"
#include "GameTime.h"
#include "Item.h"
#include "Log.h"
#include "ObjectMgr.h"
@@ -1036,7 +1035,7 @@ void AuctionBotSeller::AddNewAuctions(SellerConfiguration& config)
auctionEntry->bid = 0;
auctionEntry->deposit = sAuctionMgr->GetAuctionDeposit(ahEntry, etime, item, stackCount);
auctionEntry->auctionHouseEntry = ahEntry;
auctionEntry->expire_time = GameTime::GetGameTime() + urand(config.GetMinTime(), config.GetMaxTime()) * HOUR;
auctionEntry->expire_time = time(nullptr) + urand(config.GetMinTime(), config.GetMaxTime()) * HOUR;
item->SaveToDB(trans);
sAuctionMgr->AddAItem(item);
+5 -6
View File
@@ -21,7 +21,6 @@
#include "CellImpl.h"
#include "CreatureTextMgr.h"
#include "DBCStores.h"
#include "GameTime.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
@@ -86,7 +85,7 @@ void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/)
else // No more vacant places
{
/// @todo Send a packet to announce it to player
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = GameTime::GetGameTime() + 10;
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(nullptr) + 10;
InvitePlayerToQueue(player);
}
}
@@ -165,7 +164,7 @@ bool Battlefield::Update(uint32 diff)
// Kick players who chose not to accept invitation to the battle
if (m_uiKickDontAcceptTimer <= diff)
{
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
for (uint8 team = 0; team < BG_TEAMS_COUNT; ++team)
for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); ++itr)
if (itr->second <= now)
@@ -251,7 +250,7 @@ void Battlefield::InvitePlayersInZoneToWar()
if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer)
InvitePlayerToWar(player);
else // Battlefield is full of players
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = GameTime::GetGameTime() + 10;
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(nullptr) + 10;
}
}
}
@@ -276,7 +275,7 @@ void Battlefield::InvitePlayerToWar(Player* player)
if (player->getLevel() < m_MinLevel)
{
if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0)
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = GameTime::GetGameTime() + 10;
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(nullptr) + 10;
return;
}
@@ -285,7 +284,7 @@ void Battlefield::InvitePlayerToWar(Player* player)
return;
m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID());
m_InvitedPlayers[player->GetTeamId()][player->GetGUID()] = GameTime::GetGameTime() + m_TimeForAcceptInvite;
m_InvitedPlayers[player->GetTeamId()][player->GetGUID()] = time(nullptr) + m_TimeForAcceptInvite;
player->GetSession()->SendBfInvitePlayerToWar(m_Guid, m_ZoneId, m_TimeForAcceptInvite);
}
@@ -26,7 +26,6 @@
#include "BattlefieldTB.h"
#include "Battleground.h"
#include "Creature.h"
#include "GameTime.h"
#include "GameObject.h"
#include "MapManager.h"
#include "ObjectAccessor.h"
@@ -570,8 +569,8 @@ void BattlefieldTB::FillInitialWorldStates(WorldPacket& data)
data << uint32(TB_WS_ALLIANCE_CONTROLS_SHOW) << int32(!IsWarTime() && GetDefenderTeam() == TEAM_ALLIANCE ? 1 : 0);
data << uint32(TB_WS_HORDE_CONTROLS_SHOW) << int32(!IsWarTime() && GetDefenderTeam() == TEAM_HORDE ? 1 : 0);
data << uint32(TB_WS_TIME_BATTLE_END) << int32(IsWarTime() ? GameTime::GetGameTime() + (m_Timer / 1000) : 0);
data << uint32(TB_WS_TIME_NEXT_BATTLE) << int32(!IsWarTime() ? GameTime::GetGameTime() + (m_Timer / 1000) : 0);
data << uint32(TB_WS_TIME_BATTLE_END) << int32(IsWarTime() ? time(nullptr) + (m_Timer / 1000) : 0);
data << uint32(TB_WS_TIME_NEXT_BATTLE) << int32(!IsWarTime() ? time(nullptr) + (m_Timer / 1000) : 0);
// Not sure if TB
//packet.Worldstates.emplace_back(uint32(TB_WS_65_UNKNOWN), int32(0));
@@ -969,7 +968,7 @@ void BattlefieldTB::TowerDestroyed(TBTowerId tbTowerId)
// Add 5 minute bonus time
m_Timer += m_BonusTime;
SendUpdateWorldState(TB_WS_TIME_BATTLE_END, uint32(GameTime::GetGameTime() + (m_Timer / 1000)));
SendUpdateWorldState(TB_WS_TIME_BATTLE_END, uint32(time(nullptr) + (m_Timer / 1000)));
SendWarning(TBTowers[tbTowerId].textDamaged);
@@ -23,7 +23,6 @@
#include "AchievementMgr.h"
#include "Battleground.h"
#include "CreatureTextMgr.h"
#include "GameTime.h"
#include "GameObject.h"
#include "Log.h"
#include "MapManager.h"
@@ -1148,7 +1147,7 @@ void BattlefieldWG::FillInitialWorldStates(WorldPacket& data)
data << uint32(BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE) << uint32(IsWarTime() ? 1 : 0);
for (uint32 i = 0; i < 2; ++i)
data << ClockWorldState[i] << uint32(GameTime::GetGameTime() + (m_Timer / 1000));
data << ClockWorldState[i] << uint32(time(nullptr) + (m_Timer / 1000));
data << uint32(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_H));
data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H) << uint32(GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H));
-4
View File
@@ -18,7 +18,6 @@
#include "CalendarMgr.h"
#include "CharacterCache.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "Guild.h"
#include "GuildMgr.h"
#include "Log.h"
@@ -28,9 +27,6 @@
#include "Player.h"
#include "WorldPacket.h"
CalendarInvite::CalendarInvite() : _inviteId(1), _eventId(0), _invitee(), _senderGUID(), _statusTime(GameTime::GetGameTime()),
_status(CALENDAR_STATUS_INVITED), _rank(CALENDAR_RANK_PLAYER), _text("") { }
CalendarInvite::~CalendarInvite()
{
sCalendarMgr->FreeInviteId(_inviteId);
+2 -1
View File
@@ -147,7 +147,8 @@ struct TC_GAME_API CalendarInvite
_text = calendarInvite.GetText();
}
CalendarInvite();
CalendarInvite() : _inviteId(1), _eventId(0), _invitee(), _senderGUID(), _statusTime(time(nullptr)),
_status(CALENDAR_STATUS_INVITED), _rank(CALENDAR_RANK_PLAYER), _text("") { }
CalendarInvite(uint64 inviteId, uint64 eventId, ObjectGuid invitee, ObjectGuid senderGUID, time_t statusTime,
CalendarInviteStatus status, CalendarModerationRank rank, std::string text) :
+7 -8
View File
@@ -20,7 +20,6 @@
#include "DatabaseEnv.h"
#include "DBCStores.h"
#include "DisableMgr.h"
#include "GameTime.h"
#include "GameEventMgr.h"
#include "Group.h"
#include "GroupMgr.h"
@@ -298,7 +297,7 @@ void LFGMgr::Update(uint32 diff)
if (!isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
return;
time_t currTime = GameTime::GetGameTime();
time_t currTime = time(nullptr);
// Remove obsolete role checks
for (LfgRoleCheckContainer::iterator it = RoleChecksStore.begin(); it != RoleChecksStore.end();)
@@ -583,13 +582,13 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
ticket.RequesterGuid = guid;
ticket.Id = GetQueueId(gguid);
ticket.Type = WorldPackets::LFG::RideType::Lfg;
ticket.Time = int32(GameTime::GetGameTime());
ticket.Time = int32(time(nullptr));
std::string debugNames = "";
if (grp) // Begin rolecheck
{
// Create new rolecheck
LfgRoleCheck& roleCheck = RoleChecksStore[gguid];
roleCheck.cancelTime = time_t(GameTime::GetGameTime()) + LFG_TIME_ROLECHECK;
roleCheck.cancelTime = time_t(time(nullptr)) + LFG_TIME_ROLECHECK;
roleCheck.state = LFG_ROLECHECK_INITIALITING;
roleCheck.leader = guid;
roleCheck.dungeons = dungeons;
@@ -628,7 +627,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
LfgRolesMap rolesMap;
rolesMap[guid] = roles;
LFGQueue& queue = GetQueue(guid);
queue.AddQueueData(guid, GameTime::GetGameTime(), dungeons, rolesMap);
queue.AddQueueData(guid, time(nullptr), dungeons, rolesMap);
if (!isContinue)
{
@@ -824,7 +823,7 @@ void LFGMgr::UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid /* = ObjectGuid::
{
SetState(gguid, LFG_STATE_QUEUED);
LFGQueue& queue = GetQueue(gguid);
queue.AddQueueData(gguid, time_t(GameTime::GetGameTime()), roleCheck.dungeons, roleCheck.roles);
queue.AddQueueData(gguid, time_t(time(nullptr)), roleCheck.dungeons, roleCheck.roles);
RoleChecksStore.erase(itRoleCheck);
}
else if (roleCheck.state != LFG_ROLECHECK_INITIALITING)
@@ -1124,7 +1123,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, ObjectGuid guid, bool accept)
bool sendUpdate = proposal.state != LFG_PROPOSAL_SUCCESS;
proposal.state = LFG_PROPOSAL_SUCCESS;
time_t joinTime = GameTime::GetGameTime();
time_t joinTime = time(nullptr);
LFGQueue& queue = GetQueue(guid);
LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_GROUP_FOUND, GetSelectedDungeons(guid), GetComment(guid));
@@ -1290,7 +1289,7 @@ void LFGMgr::InitBoot(ObjectGuid gguid, ObjectGuid kicker, ObjectGuid victim, st
LfgPlayerBoot& boot = BootsStore[gguid];
boot.inProgress = true;
boot.cancelTime = time_t(GameTime::GetGameTime()) + LFG_TIME_BOOT;
boot.cancelTime = time_t(time(nullptr)) + LFG_TIME_BOOT;
boot.reason = reason;
boot.victim = victim;
+1 -7
View File
@@ -19,7 +19,6 @@
#include "Containers.h"
#include "DBCStructure.h"
#include "DBCStores.h"
#include "GameTime.h"
#include "Group.h"
#include "LFGQueue.h"
#include "LFGMgr.h"
@@ -81,11 +80,6 @@ char const* GetCompatibleString(LfgCompatibility compatibles)
}
}
LfgQueueData::LfgQueueData() : joinTime(GameTime::GetGameTime())
{
InitializeGroupSetup();
}
void LfgQueueData::InitializeGroupSetup()
{
tanks = 0;
@@ -569,7 +563,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check)
}
// Create a new proposal
proposal.cancelTime = GameTime::GetGameTime() + LFG_TIME_PROPOSAL;
proposal.cancelTime = time(nullptr) + LFG_TIME_PROPOSAL;
proposal.state = LFG_PROPOSAL_INITIATING;
proposal.leader.Clear();
+4 -1
View File
@@ -51,7 +51,10 @@ struct LfgCompatibilityData
/// Stores player or group queue info
struct LfgQueueData
{
LfgQueueData();
LfgQueueData(): joinTime(time_t(time(nullptr)))
{
InitializeGroupSetup();
}
LfgQueueData(time_t _joinTime, LfgDungeonSet const& _dungeons, LfgRolesMap const& _roles) :
joinTime(_joinTime), dungeons(_dungeons), roles(_roles)
+1 -7
View File
@@ -20,7 +20,6 @@
#include "CharacterCache.h"
#include "Common.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "Log.h"
#include "Map.h"
#include "ObjectAccessor.h"
@@ -39,7 +38,7 @@ Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES), m_type(type
m_valuesCount = CORPSE_END;
m_time = GameTime::GetGameTime();
m_time = time(nullptr);
lootForBody = false;
lootRecipient = nullptr;
@@ -149,11 +148,6 @@ void Corpse::DeleteFromDB(ObjectGuid const& ownerGuid, SQLTransaction& trans)
CharacterDatabase.ExecuteOrAppend(trans, stmt);
}
void Corpse::ResetGhostTime()
{
m_time = GameTime::GetGameTime();
}
bool Corpse::LoadCorpseFromDB(ObjectGuid::LowType guid, Field* fields)
{
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
+1 -1
View File
@@ -67,7 +67,7 @@ class TC_GAME_API Corpse : public WorldObject, public GridObject<Corpse>
ObjectGuid GetOwnerGUID() const { return GetGuidValue(CORPSE_FIELD_OWNER); }
time_t const& GetGhostTime() const { return m_time; }
void ResetGhostTime();
void ResetGhostTime() { m_time = time(nullptr); }
CorpseType GetType() const { return m_type; }
CellCoord const& GetCellCoord() const { return _cellCoord; }
+15 -23
View File
@@ -70,9 +70,6 @@ std::string CreatureMovementData::ToString() const
return str.str();
}
VendorItemCount::VendorItemCount(uint32 _item, uint32 _count)
: itemId(_item), count(_count), lastIncrementTime(GameTime::GetGameTime()) { }
TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const
{
TrainerSpellMap::const_iterator itr = spellList.find(spell_id);
@@ -344,7 +341,7 @@ void Creature::RemoveCorpse(bool setSpawnTime)
if (m_respawnCompatibilityMode)
{
m_corpseRemoveTime = GameTime::GetGameTime();
m_corpseRemoveTime = time(nullptr);
setDeathState(DEAD);
RemoveAllAuras();
DestroyForNearbyPlayers(); // old UpdateObjectVisibility()
@@ -355,7 +352,7 @@ void Creature::RemoveCorpse(bool setSpawnTime)
// Should get removed later, just keep "compatibility" with scripts
if (setSpawnTime)
m_respawnTime = std::max<time_t>(GameTime::GetGameTime() + respawnDelay, m_respawnTime);
m_respawnTime = std::max<time_t>(time(nullptr) + respawnDelay, m_respawnTime);
// if corpse was removed during falling, the falling will continue and override relocation to respawn position
if (IsFalling())
@@ -389,7 +386,7 @@ void Creature::RemoveCorpse(bool setSpawnTime)
if (setSpawnTime)
{
uint32 respawnDelay = m_respawnDelay;
m_respawnTime = std::max<time_t>(GameTime::GetGameTime() + respawnDelay, m_respawnTime);
m_respawnTime = std::max<time_t>(time(nullptr) + respawnDelay, m_respawnTime);
SaveRespawnTime(0, false);
}
@@ -619,7 +616,7 @@ void Creature::Update(uint32 diff)
TC_LOG_ERROR("entities.unit", "Creature (GUID: %u Entry: %u) in wrong state: DEAD (3)", GetGUID().GetCounter(), GetEntry());
break;
}
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
if (m_respawnTime <= now)
{
// Delay respawn if spawn group is not active
@@ -675,7 +672,7 @@ void Creature::Update(uint32 diff)
}
else m_groupLootTimer -= diff;
}
else if (m_corpseRemoveTime <= GameTime::GetGameTime())
else if (m_corpseRemoveTime <= time(nullptr))
{
RemoveCorpse(false);
TC_LOG_DEBUG("entities.unit", "Removing corpse... %u ", GetUInt32Value(OBJECT_FIELD_ENTRY));
@@ -1710,7 +1707,7 @@ bool Creature::IsInvisibleDueToDespawn() const
if (Unit::IsInvisibleDueToDespawn())
return true;
if (IsAlive() || isDying() || m_corpseRemoveTime > GameTime::GetGameTime())
if (IsAlive() || isDying() || m_corpseRemoveTime > time(nullptr))
return false;
return true;
@@ -1832,7 +1829,7 @@ void Creature::setDeathState(DeathState s)
if (s == JUST_DIED)
{
m_corpseRemoveTime = GameTime::GetGameTime() + m_corpseDelay;
m_corpseRemoveTime = time(nullptr) + m_corpseDelay;
uint32 respawnDelay = m_respawnDelay;
if (uint32 scalingMode = sWorld->getIntConfig(CONFIG_RESPAWN_DYNAMICMODE))
GetMap()->ApplyDynamicModeRespawnScaling(this, m_spawnId, respawnDelay, scalingMode);
@@ -1842,14 +1839,14 @@ void Creature::setDeathState(DeathState s)
if (IsDungeonBoss() && !m_respawnDelay)
m_respawnTime = std::numeric_limits<time_t>::max(); // never respawn in this instance
else
m_respawnTime = GameTime::GetGameTime() + respawnDelay + m_corpseDelay;
m_respawnTime = time(nullptr) + respawnDelay + m_corpseDelay;
}
else
{
if (IsDungeonBoss() && !m_respawnDelay)
m_respawnTime = std::numeric_limits<time_t>::max(); // never respawn in this instance
else
m_respawnTime = GameTime::GetGameTime() + respawnDelay;
m_respawnTime = time(nullptr) + respawnDelay;
}
// always save boss respawn time at death to prevent crash cheating
@@ -2424,7 +2421,7 @@ bool Creature::CanCreatureAttack(Unit const* victim, bool /*force*/) const
// if the mob is actively being damaged, do not reset due to distance unless it's a world boss
if (!isWorldBoss())
if (GameTime::GetGameTime() - GetLastDamagedTime() <= MAX_AGGRO_RESET_TIME)
if (time(nullptr) - GetLastDamagedTime() <= MAX_AGGRO_RESET_TIME)
return true;
//Use AttackDistance in distance check if threat radius is lower. This prevents creature bounce in and out of combat every update tick.
@@ -2587,7 +2584,7 @@ bool Creature::HasSpell(uint32 spellID) const
time_t Creature::GetRespawnTimeEx() const
{
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
if (m_respawnTime > now)
return m_respawnTime;
else
@@ -2637,7 +2634,7 @@ void Creature::AllLootRemovedFromCorpse()
if (LootTemplates_Skinning.HaveLootFor(GetCreatureTemplate()->SkinLootId))
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
// Do not reset corpse remove time if corpse is already removed
if (m_corpseRemoveTime <= now)
return;
@@ -2705,7 +2702,7 @@ uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem)
VendorItemCount* vCount = &*itr;
time_t ptime = GameTime::GetGameTime();
time_t ptime = time(nullptr);
if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime)
if (ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item))
@@ -2743,7 +2740,7 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us
VendorItemCount* vCount = &*itr;
time_t ptime = GameTime::GetGameTime();
time_t ptime = time(nullptr);
if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime)
if (ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item))
@@ -3114,12 +3111,7 @@ bool Creature::IsMovementPreventedByCasting() const
void Creature::StartPickPocketRefillTimer()
{
_pickpocketLootRestore = GameTime::GetGameTime() + sWorld->getIntConfig(CONFIG_CREATURE_PICKPOCKET_REFILL);
}
bool Creature::CanGeneratePickPocketLoot() const
{
return _pickpocketLootRestore <= GameTime::GetGameTime();
_pickpocketLootRestore = time(nullptr) + sWorld->getIntConfig(CONFIG_CREATURE_PICKPOCKET_REFILL);
}
void Creature::SetTextRepeatId(uint8 textGroup, uint8 id)
+3 -2
View File
@@ -40,7 +40,8 @@ enum MovementGeneratorType : uint8;
struct VendorItemCount
{
VendorItemCount(uint32 _item, uint32 _count);
VendorItemCount(uint32 _item, uint32 _count)
: itemId(_item), count(_count), lastIncrementTime(time(nullptr)) { }
uint32 itemId;
uint32 count;
@@ -183,7 +184,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
Loot loot;
void StartPickPocketRefillTimer();
void ResetPickPocketRefillTimer() { _pickpocketLootRestore = 0; }
bool CanGeneratePickPocketLoot() const;
bool CanGeneratePickPocketLoot() const { return _pickpocketLootRestore <= time(nullptr); }
void SetSkinner(ObjectGuid guid) { _skinner = guid; }
ObjectGuid GetSkinner() const { return _skinner; } // Returns the player who skinned this creature
Player* GetLootRecipient() const;
@@ -394,7 +394,7 @@ void GameObject::Update(uint32 diff)
case GAMEOBJECT_TYPE_FISHINGNODE:
{
// fishing code (bobber ready)
if (GameTime::GetGameTime() > m_respawnTime - FISHING_BOBBER_READY_TIME)
if (time(nullptr) > m_respawnTime - FISHING_BOBBER_READY_TIME)
{
// splash bobber (bobber ready now)
Unit* caster = GetOwner();
@@ -428,7 +428,7 @@ void GameObject::Update(uint32 diff)
{
if (m_respawnTime > 0) // timer on
{
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
if (m_respawnTime <= now) // timer expired
{
ObjectGuid dbtableHighGuid(HighGuid::GameObject, GetEntry(), m_spawnId);
@@ -712,7 +712,7 @@ void GameObject::Update(uint32 diff)
uint32 respawnDelay = m_respawnDelayTime;
if (uint32 scalingMode = sWorld->getIntConfig(CONFIG_RESPAWN_DYNAMICMODE))
GetMap()->ApplyDynamicModeRespawnScaling(this, this->m_spawnId, respawnDelay, scalingMode);
m_respawnTime = GameTime::GetGameTime() + respawnDelay;
m_respawnTime = time(nullptr) + respawnDelay;
// if option not set then object will be saved at grid unload
// Otherwise just save respawn time to map object memory
@@ -957,7 +957,7 @@ bool GameObject::LoadFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap
m_respawnTime = GetMap()->GetGORespawnTime(m_spawnId);
// ready to respawn
if (m_respawnTime && m_respawnTime <= GameTime::GetGameTime())
if (m_respawnTime && m_respawnTime <= time(nullptr))
{
m_respawnTime = 0;
GetMap()->RemoveRespawnTime(SPAWN_TYPE_GAMEOBJECT, m_spawnId);
@@ -1077,7 +1077,7 @@ void GameObject::SaveRespawnTime(uint32 forceDelay, bool savetodb)
return;
}
uint32 thisRespawnTime = forceDelay ? GameTime::GetGameTime() + forceDelay : m_respawnTime;
uint32 thisRespawnTime = forceDelay ? time(nullptr) + forceDelay : m_respawnTime;
GetMap()->SaveRespawnTime(SPAWN_TYPE_GAMEOBJECT, m_spawnId, GetEntry(), thisRespawnTime, GetZoneId(), Trinity::ComputeGridCoord(GetPositionX(), GetPositionY()).GetId(), m_goData->dbData ? savetodb : false);
}
}
@@ -1160,7 +1160,7 @@ void GameObject::Respawn()
{
if (m_spawnedByDefault && m_respawnTime > 0)
{
m_respawnTime = GameTime::GetGameTime();
m_respawnTime = time(nullptr);
GetMap()->RemoveRespawnTime(SPAWN_TYPE_GAMEOBJECT, m_spawnId, true);
}
}
@@ -2252,11 +2252,6 @@ void GameObject::SetLootState(LootState state, Unit* unit)
}
}
void GameObject::SetLootGenerationTime()
{
m_lootGenerationTime = GameTime::GetGameTime();
}
void GameObject::SetGoState(GOState state)
{
SetByteValue(GAMEOBJECT_BYTES_1, 0, state);
@@ -183,7 +183,7 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
void AddLootMode(uint16 lootMode) { m_LootMode |= lootMode; }
void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; }
void ResetLootMode() { m_LootMode = LOOT_MODE_DEFAULT; }
void SetLootGenerationTime();
void SetLootGenerationTime() { m_lootGenerationTime = time(nullptr); }
uint32 GetLootGenerationTime() const { return m_lootGenerationTime; }
void AddToSkillupList(ObjectGuid::LowType PlayerGuidLow) { m_SkillupList.push_back(PlayerGuidLow); }
+3 -4
View File
@@ -22,7 +22,6 @@
#include "ConditionMgr.h"
#include "DatabaseEnv.h"
#include "DBCStores.h"
#include "GameTime.h"
#include "ItemEnchantmentMgr.h"
#include "Log.h"
#include "LootItemStorage.h"
@@ -262,7 +261,7 @@ Item::Item()
m_container = nullptr;
m_lootGenerated = false;
mb_in_trade = false;
m_lastPlayedTimeUpdate = GameTime::GetGameTime();
m_lastPlayedTimeUpdate = time(nullptr);
m_refundRecipient = 0;
m_paidMoney = 0;
@@ -1101,7 +1100,7 @@ void Item::UpdatePlayedTime(Player* owner)
// Get current played time
uint32 current_playtime = GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME);
// Calculate time elapsed since last played time update
time_t curtime = GameTime::GetGameTime();
time_t curtime = time(nullptr);
uint32 elapsed = uint32(curtime - m_lastPlayedTimeUpdate);
uint32 new_playtime = current_playtime + elapsed;
// Check if the refund timer has expired yet
@@ -1122,7 +1121,7 @@ void Item::UpdatePlayedTime(Player* owner)
uint32 Item::GetPlayedTime()
{
time_t curtime = GameTime::GetGameTime();
time_t curtime = time(nullptr);
uint32 elapsed = uint32(curtime - m_lastPlayedTimeUpdate);
return GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME) + elapsed;
}
+1 -1
View File
@@ -1147,7 +1147,7 @@ void MovementInfo::OutDebug()
TC_LOG_DEBUG("misc", "%s", guid.ToString().c_str());
TC_LOG_DEBUG("misc", "flags %u", flags);
TC_LOG_DEBUG("misc", "flags2 %u", flags2);
TC_LOG_DEBUG("misc", "time %u current time " UI64FMTD "", flags2, uint64(::GameTime::GetGameTime()));
TC_LOG_DEBUG("misc", "time %u current time " UI64FMTD "", flags2, uint64(::time(nullptr)));
TC_LOG_DEBUG("misc", "position: `%s`", pos.ToString().c_str());
if (transport.guid)
{
+5 -5
View File
@@ -230,7 +230,7 @@ bool Pet::LoadPetData(Player* owner, uint32 petEntry, uint32 petnumber, bool cur
break;
}
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime())); // cast can't be helped here
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(nullptr))); // cast can't be helped here
SetCreatorGUID(owner->GetGUID());
InitStatsForLevel(petlevel);
@@ -301,7 +301,7 @@ bool Pet::LoadPetData(Player* owner, uint32 petEntry, uint32 petnumber, bool cur
InitTalentForLevel(); // set original talents points before spell loading
uint32 timediff = uint32(GameTime::GetGameTime() - playerPetData->Timediff);
uint32 timediff = uint32(time(nullptr) - playerPetData->Timediff);
_LoadAuras(timediff);
// load action bar, if data broken will fill later by default spells.
@@ -454,7 +454,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
stmt->setString(13, GenerateActionBarData());
stmt->setUInt32(14, GameTime::GetGameTime()); // unsure about this
stmt->setUInt32(14, time(nullptr)); // unsure about this
stmt->setUInt32(15, GetUInt32Value(UNIT_CREATED_BY_SPELL));
stmt->setUInt8(16, getPetType());
trans->Append(stmt);
@@ -478,7 +478,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
playerPetData->SavedHealth = curhealth;
playerPetData->SavedMana = curmana;
playerPetData->Actionbar = GenerateActionBarData();
playerPetData->Timediff = GameTime::GetGameTime();
playerPetData->Timediff = time(nullptr);
playerPetData->SummonSpellId = GetUInt32Value(UNIT_CREATED_BY_SPELL);
playerPetData->Type = getPetType();
@@ -557,7 +557,7 @@ void Pet::Update(uint32 diff)
{
case CORPSE:
{
if (!IsHunterPet() || m_corpseRemoveTime <= GameTime::GetGameTime())
if (!IsHunterPet() || m_corpseRemoveTime <= time(nullptr))
{
Remove(PET_SAVE_DISMISS); //hunters' pets never get removed because of death, NEVER!
return;
+33 -33
View File
@@ -280,7 +280,7 @@ Player::Player(WorldSession* session): Unit(true)
m_bgBattlegroundQueueID[j].invitedToInstance = 0;
}
m_logintime = GameTime::GetGameTime();
m_logintime = time(nullptr);
m_Last_tick = m_logintime;
m_Played_time[PLAYED_TIME_TOTAL] = 0;
m_Played_time[PLAYED_TIME_LEVEL] = 0;
@@ -343,7 +343,7 @@ Player::Player(WorldSession* session): Unit(true)
m_spellPenetrationItemMod = 0;
// Honor System
m_lastHonorUpdateTime = GameTime::GetGameTime();
m_lastHonorUpdateTime = time(nullptr);
m_IsBGRandomWinner = false;
@@ -585,7 +585,7 @@ bool Player::Create(ObjectGuid::LowType guidlow, CharacterCreateInfo* createInfo
SetCurrency(CURRENCY_TYPE_CONQUEST_POINTS, sWorld->getIntConfig(CONFIG_CURRENCY_START_CONQUEST_POINTS));
// Played time
m_Last_tick = GameTime::GetGameTime();
m_Last_tick = time(nullptr);
m_Played_time[PLAYED_TIME_TOTAL] = 0;
m_Played_time[PLAYED_TIME_LEVEL] = 0;
@@ -1039,7 +1039,7 @@ void Player::Update(uint32 p_time)
return;
// undelivered mail
if (m_nextMailDelivereTime && m_nextMailDelivereTime <= GameTime::GetGameTime())
if (m_nextMailDelivereTime && m_nextMailDelivereTime <= time(nullptr))
{
SendNewMail();
++unReadMails;
@@ -1061,7 +1061,7 @@ void Player::Update(uint32 p_time)
Unit::Update(p_time);
SetCanDelayTeleport(false);
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
UpdatePvPFlag(now);
@@ -1202,7 +1202,7 @@ void Player::Update(uint32 p_time)
{
if (roll_chance_i(3) && _restTime > 0) // freeze update
{
time_t currTime = GameTime::GetGameTime();
time_t currTime = time(nullptr);
time_t timeDiff = currTime - _restTime;
if (timeDiff >= 10) // freeze update
{
@@ -3126,7 +3126,7 @@ void Player::UpdateNextMailTimeAndUnreads()
{
// calculate next delivery time (min. from non-delivered mails
// and recalculate unReadMail
time_t cTime = GameTime::GetGameTime();
time_t cTime = time(nullptr);
m_nextMailDelivereTime = 0;
unReadMails = 0;
for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
@@ -3143,7 +3143,7 @@ void Player::UpdateNextMailTimeAndUnreads()
void Player::AddNewMailDeliverTime(time_t deliver_time)
{
if (deliver_time <= GameTime::GetGameTime()) // ready now
if (deliver_time <= time(nullptr)) // ready now
{
++unReadMails;
SendNewMail();
@@ -4003,7 +4003,7 @@ bool Player::ResetTalents(bool no_cost)
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS, 1);
SetTalentResetCost(cost);
SetTalentResetTime(GameTime::GetGameTime());
SetTalentResetTime(time(nullptr));
}
/* when prev line will dropped use next line
@@ -4576,7 +4576,7 @@ void Player::DeleteOldCharacters(uint32 keepDays)
TC_LOG_INFO("entities.player", "Player::DeleteOldCharacters: Deleting all characters which have been deleted %u days before...", keepDays);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_OLD_CHARS);
stmt->setUInt32(0, uint32(GameTime::GetGameTime() - time_t(keepDays * DAY)));
stmt->setUInt32(0, uint32(time(nullptr) - time_t(keepDays * DAY)));
PreparedQueryResult result = CharacterDatabase.Query(stmt);
if (result)
@@ -6815,8 +6815,8 @@ void Player::RewardReputation(Quest const* quest)
void Player::UpdateHonorFields()
{
/// called when rewarding honor and at each save
time_t now = GameTime::GetGameTime();
time_t today = GameTime::GetGameTime() / DAY * DAY;
time_t now = time_t(time(nullptr));
time_t today = time_t(time(nullptr) / DAY) * DAY;
if (m_lastHonorUpdateTime < today)
{
@@ -9757,7 +9757,7 @@ void Player::SendBattlefieldWorldStates() const
{
SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, wg->IsWarTime() ? 0 : 1);
uint32 timer = wg->IsWarTime() ? 0 : (wg->GetTimer() / 1000); // 0 - Time to next battle
SendUpdateWorldState(ClockWorldState[1], uint32(GameTime::GetGameTime() + timer));
SendUpdateWorldState(ClockWorldState[1], uint32(time(nullptr) + timer));
}
}
@@ -9767,8 +9767,8 @@ void Player::SendBattlefieldWorldStates() const
{
SendUpdateWorldState(TB_WS_FACTION_CONTROLLING, uint32(tb->GetDefenderTeam() + 1));
uint32 timer = tb->GetTimer() / 1000;
SendUpdateWorldState(TB_WS_TIME_BATTLE_END, uint32(tb->IsWarTime() ? uint32(GameTime::GetGameTime() + timer) : 0));
SendUpdateWorldState(TB_WS_TIME_NEXT_BATTLE, uint32(!tb->IsWarTime() ? uint32(GameTime::GetGameTime() + timer) : 0));
SendUpdateWorldState(TB_WS_TIME_BATTLE_END, uint32(tb->IsWarTime() ? uint32(time(nullptr) + timer) : 0));
SendUpdateWorldState(TB_WS_TIME_NEXT_BATTLE, uint32(!tb->IsWarTime() ? uint32(time(nullptr) + timer) : 0));
}
}
}
@@ -13208,7 +13208,7 @@ void Player::AddItemToBuyBackSlot(Item* pItem)
GetName().c_str(), GetGUID().ToString().c_str(), pItem->GetEntry(), slot);
m_items[slot] = pItem;
time_t base = GameTime::GetGameTime();
time_t base = time(nullptr);
uint32 etime = uint32(base - m_logintime + (30 * 3600));
uint32 eslot = slot - BUYBACK_SLOT_START;
@@ -15217,7 +15217,7 @@ void Player::AddQuest(Quest const* quest, Object* questGiver)
AddTimedQuest(quest_id);
questStatusData.Timer = timeAllowed * IN_MILLISECONDS;
qtime = static_cast<uint32>(GameTime::GetGameTime()) + timeAllowed;
qtime = static_cast<uint32>(time(nullptr)) + timeAllowed;
}
else
questStatusData.Timer = 0;
@@ -17901,7 +17901,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SQLQueryHolder* holder)
SaveRecallPosition();
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
time_t logoutTime = time_t(fields[27].GetUInt32());
// since last logout (in seconds)
@@ -19565,7 +19565,7 @@ void Player::SendRaidInfo()
size_t p_counter = data.wpos();
data << uint32(counter); // placeholder
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
{
@@ -19948,7 +19948,7 @@ void Player::SaveToDB(bool create /*=false*/)
stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_TOTAL]);
stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_LEVEL]);
stmt->setFloat(index++, finiteAlways(m_rest_bonus));
stmt->setUInt32(index++, uint32(GameTime::GetGameTime()));
stmt->setUInt32(index++, uint32(time(nullptr)));
stmt->setUInt8(index++, (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0));
//save, far from tavern/city
//save, but in tavern/city
@@ -20088,7 +20088,7 @@ void Player::SaveToDB(bool create /*=false*/)
stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_TOTAL]);
stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_LEVEL]);
stmt->setFloat(index++, finiteAlways(m_rest_bonus));
stmt->setUInt32(index++, uint32(GameTime::GetGameTime()));
stmt->setUInt32(index++, uint32(time(nullptr)));
stmt->setUInt8(index++, (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0));
//save, far from tavern/city
//save, but in tavern/city
@@ -20996,7 +20996,7 @@ void Player::UpdateSpeakTime()
if (GetSession()->HasPermission(rbac::RBAC_PERM_SKIP_CHECK_CHAT_SPAM))
return;
time_t current = GameTime::GetGameTime();
time_t current = time(nullptr);
if (m_speakTime > current)
{
uint32 max_count = sWorld->getIntConfig(CONFIG_CHATFLOOD_MESSAGE_COUNT);
@@ -22995,7 +22995,7 @@ void Player::UpdatePvPState(bool onlyFFA)
else // in friendly area
{
if (IsPvP() && !HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP) && !pvpInfo.EndTimer)
pvpInfo.EndTimer = GameTime::GetGameTime(); // start toggle-off
pvpInfo.EndTimer = time(nullptr); // start toggle-off
}
}
@@ -23015,7 +23015,7 @@ void Player::UpdatePvP(bool state, bool _override)
}
else
{
pvpInfo.EndTimer = GameTime::GetGameTime();
pvpInfo.EndTimer = time(nullptr);
SetPvP(state);
}
}
@@ -24349,7 +24349,7 @@ void Player::SetDailyQuestStatus(uint32 quest_id)
if (!GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx))
{
SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1 + quest_daily_idx, quest_id);
m_lastDailyQuestTime = GameTime::GetGameTime(); // last daily quest time
m_lastDailyQuestTime = time(nullptr); // last daily quest time
m_DailyQuestChanged = true;
break;
}
@@ -24727,7 +24727,7 @@ void Player::UpdateVisibleGameobjectsOrSpellClicks()
bool Player::HasSummonPending() const
{
return m_summon_expire >= GameTime::GetGameTime();
return m_summon_expire >= time(nullptr);
}
void Player::SendSummonRequestFrom(Unit* summoner)
@@ -24743,7 +24743,7 @@ void Player::SendSummonRequestFrom(Unit* summoner)
if (HasAura(23445))
return;
m_summon_expire = GameTime::GetGameTime() + MAX_PLAYER_SUMMON_DELAY;
m_summon_expire = time(nullptr) + MAX_PLAYER_SUMMON_DELAY;
m_summon_location.WorldRelocate(*summoner);
WorldPacket data(SMSG_SUMMON_REQUEST, 8 + 4 + 4);
@@ -24762,7 +24762,7 @@ void Player::SummonIfPossible(bool agree)
}
// expire and auto declined
if (m_summon_expire < GameTime::GetGameTime())
if (m_summon_expire < time(nullptr))
return;
// stop taxi flight at summon
@@ -25249,7 +25249,7 @@ uint32 Player::GetCorpseReclaimDelay(bool pvp) const
else if (!sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE))
return 0;
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
// 0..2 full period
// should be ceil(x)-1 but not floor(x)
uint64 count = (now < m_deathExpireTime - 1) ? (m_deathExpireTime - 1 - now) / DEATH_EXPIRE_STEP : 0;
@@ -25264,7 +25264,7 @@ void Player::UpdateCorpseReclaimDelay()
(!pvp && !sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE)))
return;
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
if (now < m_deathExpireTime)
{
@@ -25308,7 +25308,7 @@ int32 Player::CalculateCorpseReclaimDelay(bool load) const
}
time_t expected_time = corpse->GetGhostTime() + copseReclaimDelay[count];
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
if (now >= expected_time)
return -1;
@@ -28060,7 +28060,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
pet->SetByteValue(UNIT_FIELD_BYTES_0, UNIT_BYTES_0_OFFSET_CLASS, CLASS_MAGE);
pet->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
pet->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000);
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime())); // cast can't be helped in this case
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(nullptr))); // cast can't be helped in this case
break;
default:
break;
@@ -28519,7 +28519,7 @@ void Player::SetRestFlag(RestFlag restFlag, uint32 triggerId /*= 0*/)
if (!oldRestMask && _restFlagMask) // only set flag/time on the first rest state
{
_restTime = GameTime::GetGameTime();
_restTime = time(nullptr);
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
}
+2 -2
View File
@@ -12313,7 +12313,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
// if charmed two demons the same session, the 2nd gets the 1st one's name
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime())); // cast can't be helped
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(nullptr))); // cast can't be helped
}
}
playerCharmer->CharmSpellInitialize();
@@ -14740,7 +14740,7 @@ void Unit::UpdateLastDamagedTime(SpellInfo const* spellProto)
if (spellProto && spellProto->HasAura(SPELL_AURA_DAMAGE_SHIELD))
return;
SetLastDamagedTime(GameTime::GetGameTime());
SetLastDamagedTime(time(nullptr));
}
bool Unit::IsHighestExclusiveAura(Aura const* aura, bool removeOtherAuraApplications /*= false*/)
+8 -8
View File
@@ -47,7 +47,7 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
default:
case GAMEEVENT_NORMAL:
{
time_t currenttime = GameTime::GetGameTime();
time_t currenttime = time(nullptr);
// Get the event information
return mGameEvent[entry].start < currenttime
&& currenttime < mGameEvent[entry].end
@@ -64,7 +64,7 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
// if inactive world event, check the prerequisite events
case GAMEEVENT_WORLD_INACTIVE:
{
time_t currenttime = GameTime::GetGameTime();
time_t currenttime = time(nullptr);
for (std::set<uint16>::const_iterator itr = mGameEvent[entry].prerequisite_events.begin(); itr != mGameEvent[entry].prerequisite_events.end(); ++itr)
{
if ((mGameEvent[*itr].state != GAMEEVENT_WORLD_NEXTPHASE && mGameEvent[*itr].state != GAMEEVENT_WORLD_FINISHED) || // if prereq not in nextphase or finished state, then can't start this one
@@ -80,7 +80,7 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
uint32 GameEventMgr::NextCheck(uint16 entry) const
{
time_t currenttime = GameTime::GetGameTime();
time_t currenttime = time(nullptr);
// for NEXTPHASE state world events, return the delay to start the next event, so the followup event will be checked correctly
if ((mGameEvent[entry].state == GAMEEVENT_WORLD_NEXTPHASE || mGameEvent[entry].state == GAMEEVENT_WORLD_FINISHED) && mGameEvent[entry].nextstart >= currenttime)
@@ -140,13 +140,13 @@ bool GameEventMgr::StartEvent(uint16 event_id, bool overwrite)
ApplyNewEvent(event_id);
if (overwrite)
{
mGameEvent[event_id].start = GameTime::GetGameTime();
mGameEvent[event_id].start = time(nullptr);
if (data.end <= data.start)
data.end = data.start + data.length;
}
// When event is started, set its worldstate to current time
sWorld->setWorldState(event_id, GameTime::GetGameTime());
sWorld->setWorldState(event_id, time(nullptr));
return false;
}
else
@@ -187,7 +187,7 @@ void GameEventMgr::StopEvent(uint16 event_id, bool overwrite)
if (overwrite && !serverwide_evt)
{
data.start = GameTime::GetGameTime() - data.length * MINUTE;
data.start = time(nullptr) - data.length * MINUTE;
if (data.end <= data.start)
data.end = data.start + data.length;
}
@@ -1060,7 +1060,7 @@ void GameEventMgr::StartArenaSeason()
uint32 GameEventMgr::Update() // return the next event delay in ms
{
time_t currenttime = GameTime::GetGameTime();
time_t currenttime = time(nullptr);
uint32 nextEventDelay = max_ge_check_delay; // 1 day
uint32 calcDelay;
std::set<uint16> activate, deactivate;
@@ -1656,7 +1656,7 @@ bool GameEventMgr::CheckOneGameEventConditions(uint16 event_id)
// set the followup events' start time
if (!mGameEvent[event_id].nextstart)
{
time_t currenttime = GameTime::GetGameTime();
time_t currenttime = time(nullptr);
mGameEvent[event_id].nextstart = currenttime + mGameEvent[event_id].length * 60;
}
return true;
+1 -13
View File
@@ -30,7 +30,6 @@
#include "DisableMgr.h"
#include "GameObject.h"
#include "GameObjectAIFactory.h"
#include "GameTime.h"
#include "GossipDef.h"
#include "GroupMgr.h"
#include "GuildMgr.h"
@@ -6197,7 +6196,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
{
uint32 oldMSTime = getMSTime();
time_t curTime = GameTime::GetGameTime();
time_t curTime = time(nullptr);
tm lt;
localtime_r(&curTime, &lt);
uint64 basetime(curTime);
@@ -10456,14 +10455,3 @@ uint32 ObjectMgr::GetGameObjectTypeByEntry(uint32 entry) const
return MAX_GAMEOBJECT_TYPE;
}
time_t ObjectMgr::GetHotfixDate(uint32 entry, uint32 type) const
{
time_t ret = 0;
for (HotfixData::const_iterator itr = _hotfixData.begin(); itr != _hotfixData.end(); ++itr)
if (itr->Entry == entry && itr->Type == type)
if (time_t(itr->Timestamp) > ret)
ret = time_t(itr->Timestamp);
return ret ? ret : GameTime::GetGameTime();
}
+10 -1
View File
@@ -1556,7 +1556,16 @@ class TC_GAME_API ObjectMgr
void LoadHotfixData();
HotfixData const& GetHotfixData() const { return _hotfixData; }
time_t GetHotfixDate(uint32 entry, uint32 type) const;
time_t GetHotfixDate(uint32 entry, uint32 type) const
{
time_t ret = 0;
for (HotfixData::const_iterator itr = _hotfixData.begin(); itr != _hotfixData.end(); ++itr)
if (itr->Entry == entry && itr->Type == type)
if (time_t(itr->Timestamp) > ret)
ret = time_t(itr->Timestamp);
return ret ? ret : time(nullptr);
}
void LoadMissingKeyChains();
+6 -14
View File
@@ -25,7 +25,6 @@
#include "Chat.h"
#include "Config.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "GuildFinderMgr.h"
#include "GuildMgr.h"
#include "Language.h"
@@ -180,8 +179,6 @@ inline void Guild::LogHolder::WritePacket(WorldPacket& data) const
data.append(buffer);
}
Guild::LogEntry::LogEntry(ObjectGuid::LowType guildId, uint32 guid) : m_guildId(guildId), m_guid(guid), m_timestamp(GameTime::GetGameTime()) { }
inline uint32 Guild::LogHolder::GetNextGUID()
{
// Next guid was not initialized. It means there are no records for this holder in DB yet.
@@ -247,7 +244,7 @@ void Guild::EventLogEntry::WritePacket(WorldPacket& data, ByteBuffer& content) c
content.WriteByteSeq(guid1[4]);
// Event timestamp
content << uint32(::GameTime::GetGameTime() - m_timestamp);
content << uint32(::time(nullptr) - m_timestamp);
content.WriteByteSeq(guid1[7]);
content.WriteByteSeq(guid1[3]);
@@ -329,7 +326,7 @@ void Guild::BankEventLogEntry::WritePacket(WorldPacket& data, ByteBuffer& conten
if (hasItem)
content << uint32(m_itemOrMoney);
content << uint32(GameTime::GetGameTime() - m_timestamp);
content << uint32(time(nullptr) - m_timestamp);
if (IsMoneyEvent())
content << uint64(m_itemOrMoney);
@@ -667,7 +664,7 @@ Guild::Member::Member(ObjectGuid::LowType guildId, ObjectGuid guid, uint8 rankId
m_level(0),
m_class(0),
m_flags(GUILDMEMBER_STATUS_NONE),
m_logoutTime(::GameTime::GetGameTime()),
m_logoutTime(::time(nullptr)),
m_accountId(0),
m_rankId(rankId),
m_achievementPoints(0),
@@ -753,11 +750,6 @@ void Guild::Member::AddActivity(uint64 activity)
CharacterDatabase.Execute(stmt);
}
void Guild::Member::UpdateLogoutTime()
{
m_logoutTime = GameTime::GetGameTime();
}
void Guild::Member::SaveToDB(SQLTransaction& trans) const
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_MEMBER);
@@ -1340,7 +1332,7 @@ bool Guild::Create(Player* pLeader, std::string const& name)
m_info = "";
m_motd = "No message set.";
m_bankMoney = 0;
m_createdDate = ::GameTime::GetGameTime();
m_createdDate = ::time(nullptr);
_level = 1;
_experience = 0;
_todayExperience = 0;
@@ -1585,7 +1577,7 @@ void Guild::HandleRoster(WorldSession* session)
memberData.WriteByteSeq(guid[4]);
memberData << uint8(0); // unk
memberData.WriteByteSeq(guid[1]);
memberData << float(member->IsOnline() ? 0.0f : float(::GameTime::GetGameTime() - member->GetLogoutTime()) / DAY);
memberData << float(member->IsOnline() ? 0.0f : float(::time(nullptr) - member->GetLogoutTime()) / DAY);
if (offNoteLength)
memberData.WriteString(member->GetOfficerNote());
@@ -3079,7 +3071,7 @@ void Guild::DeleteMember(SQLTransaction& trans, ObjectGuid guid, bool isDisbandi
stmt->setUInt32(0, lowguid);
stmt->setUInt32(1, m_id);
stmt->setUInt32(2, member->GetWeekReputation());
stmt->setUInt64(3, uint32(::GameTime::GetGameTime()));
stmt->setUInt64(3, uint32(::time(nullptr)));
CharacterDatabase.Execute(stmt);
}
delete member;
+2 -2
View File
@@ -387,7 +387,7 @@ private:
void ChangeRank(SQLTransaction& trans, uint8 newRank);
inline void UpdateLogoutTime();
inline void UpdateLogoutTime() { m_logoutTime = ::time(nullptr); }
inline bool IsRank(uint8 rankId) const { return m_rankId == rankId; }
inline bool IsRankNotLower(uint8 rankId) const { return m_rankId <= rankId; }
inline bool IsSamePlayer(ObjectGuid guid) const { return m_guid == guid; }
@@ -430,7 +430,7 @@ private:
class LogEntry
{
public:
LogEntry(ObjectGuid::LowType guildId, uint32 guid);
LogEntry(ObjectGuid::LowType guildId, uint32 guid) : m_guildId(guildId), m_guid(guid), m_timestamp(::time(nullptr)) { }
LogEntry(ObjectGuid::LowType guildId, uint32 guid, time_t timestamp) : m_guildId(guildId), m_guid(guid), m_timestamp(timestamp) { }
virtual ~LogEntry() { }
+1 -2
View File
@@ -19,7 +19,6 @@
#include "CharacterCache.h"
#include "DatabaseEnv.h"
#include "DBCStores.h"
#include "GameTime.h"
#include "Guild.h"
#include "GuildMgr.h"
#include "Log.h"
@@ -27,7 +26,7 @@
#include "Player.h"
#include "World.h"
MembershipRequest::MembershipRequest() : _guildId(0), _availability(0), _classRoles(0), _interests(0), _time(GameTime::GetGameTime())
MembershipRequest::MembershipRequest() : _guildId(0), _availability(0), _classRoles(0), _interests(0), _time(time(nullptr))
{
}
+1 -2
View File
@@ -18,7 +18,6 @@
#include "GuildMgr.h"
#include "AchievementMgr.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "Guild.h"
#include "Log.h"
#include "ObjectMgr.h"
@@ -588,7 +587,7 @@ void GuildMgr::ResetTimes(bool week)
// Delete too old old guild member
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_OLD_OLD_GUILD_MEMBER);
stmt->setUInt32(0, uint32(GameTime::GetGameTime() - time_t(30 * DAY)));
stmt->setUInt32(0, uint32(time(nullptr) - time_t(30 * DAY)));
CharacterDatabase.Execute(stmt);
// Reset week reputation for old guild member
@@ -23,7 +23,6 @@
#include "Creature.h"
#include "DatabaseEnv.h"
#include "DBCStructure.h"
#include "GameTime.h"
#include "Item.h"
#include "Language.h"
#include "Log.h"
@@ -333,7 +332,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
AH->bidder = 0;
AH->bid = 0;
AH->buyout = buyout;
AH->expire_time = GameTime::GetGameTime() + auctionTime;
AH->expire_time = time(nullptr) + auctionTime;
AH->deposit = deposit;
AH->etime = etime;
AH->auctionHouseEntry = auctionHouseEntry;
@@ -390,7 +389,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
AH->bidder = 0;
AH->bid = 0;
AH->buyout = buyout;
AH->expire_time = GameTime::GetGameTime() + auctionTime;
AH->expire_time = time(nullptr) + auctionTime;
AH->deposit = deposit;
AH->etime = etime;
AH->auctionHouseEntry = auctionHouseEntry;
@@ -18,7 +18,6 @@
#include "WorldSession.h"
#include "Battlefield.h"
#include "BattlefieldMgr.h"
#include "GameTime.h"
#include "Log.h"
#include "Object.h"
#include "Opcodes.h"
@@ -54,7 +53,7 @@ void WorldSession::SendBfInvitePlayerToWar(ObjectGuid guid, uint32 zoneId, uint3
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[0]);
data << uint32(GameTime::GetGameTime() + acceptTime); // Invite lasts until
data << uint32(time(nullptr) + acceptTime); // Invite lasts until
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[5]);
SendPacket(&data);
+9 -10
View File
@@ -41,7 +41,6 @@ Copied events should probably have a new owner
#include "CharacterCache.h"
#include "DatabaseEnv.h"
#include "DBCStores.h"
#include "GameTime.h"
#include "GameEventMgr.h"
#include "Guild.h"
#include "GuildMgr.h"
@@ -59,7 +58,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
ObjectGuid guid = _player->GetGUID();
TC_LOG_DEBUG("network", "CMSG_CALENDAR_GET_CALENDAR [%s]", guid.ToString().c_str());
time_t currTime = GameTime::GetGameTime();
time_t currTime = time(nullptr);
WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 1000); // Average size if no instance
@@ -244,7 +243,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
// prevent events in the past
// To Do: properly handle timezones and remove the "- time_t(86400L)" hack
if (time_t(eventPackedTime) < (GameTime::GetGameTime() - time_t(86400L)))
if (time_t(eventPackedTime) < (time(nullptr) - time_t(86400L)))
{
recvData.rfinish();
return;
@@ -337,7 +336,7 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
// prevent events in the past
// To Do: properly handle timezones and remove the "- time_t(86400L)" hack
if (time_t(eventPackedTime) < (GameTime::GetGameTime() - time_t(86400L)))
if (time_t(eventPackedTime) < (time(nullptr) - time_t(86400L)))
{
recvData.rfinish();
return;
@@ -394,7 +393,7 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData)
// prevent events in the past
// To Do: properly handle timezones and remove the "- time_t(86400L)" hack
if (time_t(eventTime) < (GameTime::GetGameTime() - time_t(86400L)))
if (time_t(eventTime) < (time(nullptr) - time_t(86400L)))
{
recvData.rfinish();
return;
@@ -537,7 +536,7 @@ void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData)
}
CalendarInviteStatus status = tentative ? CALENDAR_STATUS_TENTATIVE : CALENDAR_STATUS_SIGNED_UP;
CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), eventId, guid, guid, GameTime::GetGameTime(), status, CALENDAR_RANK_PLAYER, "");
CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), eventId, guid, guid, time(nullptr), status, CALENDAR_RANK_PLAYER, "");
sCalendarMgr->AddInvite(calendarEvent, invite);
sCalendarMgr->SendCalendarClearPendingAction(guid);
}
@@ -569,7 +568,7 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData)
if (CalendarInvite* invite = sCalendarMgr->GetInvite(inviteId))
{
invite->SetStatus(CalendarInviteStatus(status));
invite->SetStatusTime(GameTime::GetGameTime());
invite->SetStatusTime(time(nullptr));
sCalendarMgr->UpdateInvite(invite);
sCalendarMgr->SendCalendarEventStatus(*calendarEvent, *invite);
@@ -632,7 +631,7 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData)
{
invite->SetStatus((CalendarInviteStatus)status);
// not sure if we should set response time when moderator changes invite status
//invite->SetStatusTime(GameTime::GetGameTime());
//invite->SetStatusTime(time(nullptr));
sCalendarMgr->UpdateInvite(invite);
sCalendarMgr->SendCalendarEventStatus(*calendarEvent, *invite);
@@ -739,7 +738,7 @@ void WorldSession::HandleSetSavedInstanceExtend(WorldPacket& recvData)
void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add)
{
TC_LOG_DEBUG("network", "%s", add ? "SMSG_CALENDAR_RAID_LOCKOUT_ADDED" : "SMSG_CALENDAR_RAID_LOCKOUT_REMOVED");
time_t currTime = GameTime::GetGameTime();
time_t currTime = time(nullptr);
WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_REMOVED, (add ? 4 : 0) + 4 + 4 + 4 + 8);
if (add)
@@ -764,7 +763,7 @@ void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save)
TC_LOG_DEBUG("network", "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [%s] Map: %u, Difficulty %u",
guid.ToString().c_str(), save->GetMapId(), save->GetDifficulty());
time_t currTime = GameTime::GetGameTime();
time_t currTime = time(nullptr);
WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_UPDATED, 4 + 4 + 4 + 4 + 8);
data.AppendPackedTime(currTime);
@@ -133,7 +133,7 @@ bool LoginQueryHolder::Initialize()
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_MAILCOUNT);
stmt->setUInt32(0, lowGuid);
stmt->setUInt64(1, uint64(GameTime::GetGameTime()));
stmt->setUInt64(1, uint64(time(nullptr)));
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL_COUNT, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_MAILDATE);
+2 -3
View File
@@ -25,7 +25,6 @@
#include "Common.h"
#include "DatabaseEnv.h"
#include "DBCStores.h"
#include "GameTime.h"
#include "GridNotifiersImpl.h"
#include "Group.h"
#include "Guild.h"
@@ -214,7 +213,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
if (!sender->CanSpeak())
{
std::string timeStr = secsToTimeString(m_muteTime - GameTime::GetGameTime());
std::string timeStr = secsToTimeString(m_muteTime - time(nullptr));
SendNotification(GetTrinityString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str());
recvData.rfinish(); // Prevent warnings
return;
@@ -754,7 +753,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recvData)
if (!GetPlayer()->CanSpeak())
{
std::string timeStr = secsToTimeString(m_muteTime - GameTime::GetGameTime());
std::string timeStr = secsToTimeString(m_muteTime - time(nullptr));
SendNotification(GetTrinityString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str());
return;
}
+1 -2
View File
@@ -17,7 +17,6 @@
*/
#include "Common.h"
#include "GameTime.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include "Log.h"
@@ -44,7 +43,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
TC_LOG_DEBUG("network", "Player 1 is: %u (%s)", player->GetGUID().GetCounter(), player->GetName().c_str());
TC_LOG_DEBUG("network", "Player 2 is: %u (%s)", plTarget->GetGUID().GetCounter(), plTarget->GetName().c_str());
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
player->duel->startTimer = now;
plTarget->duel->startTimer = now;
@@ -17,7 +17,6 @@
#include "WorldSession.h"
#include "AchievementMgr.h"
#include "GameTime.h"
#include "Guild.h"
#include "GuildFinderMgr.h"
#include "GuildMgr.h"
@@ -75,7 +74,7 @@ void WorldSession::HandleGuildFinderAddRecruit(WorldPacket& recvPacket)
if (!(guildInterests & ALL_INTERESTS) || guildInterests > ALL_INTERESTS)
return;
MembershipRequest request = MembershipRequest(GetPlayer()->GetGUID(), guildLowGuid, availability, classRoles, guildInterests, comment, GameTime::GetGameTime());
MembershipRequest request = MembershipRequest(GetPlayer()->GetGUID(), guildLowGuid, availability, classRoles, guildInterests, comment, time(nullptr));
sGuildFinderMgr->AddMembershipRequest(guildLowGuid, request);
}
@@ -247,7 +246,7 @@ void WorldSession::HandleGuildFinderGetApplications(WorldPacket& /*recvPacket*/)
bufferData.WriteString(guild->GetName());
bufferData << uint32(guildSettings.GetAvailability());
bufferData << uint32(request.GetExpiryTime() - GameTime::GetGameTime()); // Time left to application expiry (seconds)
bufferData << uint32(request.GetExpiryTime() - time(nullptr)); // Time left to application expiry (seconds)
bufferData.WriteByteSeq(guildGuid[0]);
bufferData.WriteByteSeq(guildGuid[6]);
@@ -259,7 +258,7 @@ void WorldSession::HandleGuildFinderGetApplications(WorldPacket& /*recvPacket*/)
bufferData.WriteByteSeq(guildGuid[4]);
bufferData.WriteByteSeq(guildGuid[1]);
bufferData << uint32(GameTime::GetGameTime() - request.GetSubmitTime()); // Time since application (seconds)
bufferData << uint32(time(nullptr) - request.GetSubmitTime()); // Time since application (seconds)
bufferData << uint32(guildSettings.GetInterests());
}
@@ -308,7 +307,7 @@ void WorldSession::HandleGuildFinderGetRecruits(WorldPacket& recvPacket)
dataBuffer.WriteByteSeq(playerGuid[4]);
dataBuffer << int32(GameTime::GetGameTime() <= request.GetExpiryTime());
dataBuffer << int32(time(nullptr) <= request.GetExpiryTime());
dataBuffer.WriteByteSeq(playerGuid[3]);
dataBuffer.WriteByteSeq(playerGuid[0]);
@@ -320,11 +319,11 @@ void WorldSession::HandleGuildFinderGetRecruits(WorldPacket& recvPacket)
dataBuffer.WriteByteSeq(playerGuid[7]);
dataBuffer.WriteByteSeq(playerGuid[2]);
dataBuffer << int32(GameTime::GetGameTime() - request.GetSubmitTime()); // Time in seconds since application submitted.
dataBuffer << int32(time(nullptr) - request.GetSubmitTime()); // Time in seconds since application submitted.
dataBuffer << int32(request.GetAvailability());
dataBuffer << int32(request.GetClassRoles());
dataBuffer << int32(request.GetInterests());
dataBuffer << int32(request.GetExpiryTime() - GameTime::GetGameTime()); // TIme in seconds until application expires.
dataBuffer << int32(request.GetExpiryTime() - time(nullptr)); // TIme in seconds until application expires.
dataBuffer.WriteString(request.GetName());
dataBuffer.WriteString(request.GetComment());
@@ -336,7 +335,7 @@ void WorldSession::HandleGuildFinderGetRecruits(WorldPacket& recvPacket)
data.FlushBits();
data.append(dataBuffer);
data << uint32(GameTime::GetGameTime()); // Unk time
data << uint32(time(nullptr)); // Unk time
player->SendDirectMessage(&data);
}
+2 -3
View File
@@ -20,7 +20,6 @@
#include "AchievementMgr.h"
#include "Common.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "Guild.h"
#include "GuildMgr.h"
#include "Log.h"
@@ -781,7 +780,7 @@ void WorldSession::HandleGuildRewardsQueryOpcode(WorldPacket& recvPacket)
data << uint32(0); // Unused
data << uint32(rewards[i].AchievementId);
}
data << uint32(GameTime::GetGameTime());
data << uint32(time(nullptr));
SendPacket(&data);
}
}
@@ -1039,7 +1038,7 @@ void WorldSession::HandleGuildChallengeRequest(WorldPacket& recvPacket)
if (Guild::ChallengesMgr* challengesMgr = pGuild->GetChallengesMgr())
{
// First check if it's time to reset the challenges.
time_t thisTime = GameTime::GetGameTime();
time_t thisTime = time(nullptr);
if (pGuild->GetChallengesMgr()->CompletedFirstChallenge(pGuild->GetId()) && pGuild->GetChallengesMgr()->GetFirstCompletedChallengeTime(pGuild->GetId()) + WEEK <= thisTime)
pGuild->GetChallengesMgr()->ResetWeeklyChallenges();
+1 -2
View File
@@ -16,7 +16,6 @@
*/
#include "LFGMgr.h"
#include "GameTime.h"
#include "Group.h"
#include "LFGPackets.h"
#include "Log.h"
@@ -543,7 +542,7 @@ void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot)
lfg::LfgAnswer playerVote = boot.votes.find(GetPlayer()->GetGUID())->second;
uint8 votesNum = 0;
uint8 agreeNum = 0;
int32 secsleft = int32((boot.cancelTime - GameTime::GetGameTime()) / 1000);
int32 secsleft = int32((boot.cancelTime - time(nullptr)) / 1000);
for (const auto& vote : boot.votes)
{
if (vote.second != lfg::LFG_ANSWER_PENDING)
+7 -8
View File
@@ -21,7 +21,6 @@
#include "CharacterCache.h"
#include "DatabaseEnv.h"
#include "DBCStores.h"
#include "GameTime.h"
#include "Guild.h"
#include "GuildMgr.h"
#include "Item.h"
@@ -461,7 +460,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket& recvData)
Player* player = _player;
Mail* m = player->GetMail(mailId);
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime())
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(nullptr))
{
player->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_ERR_INTERNAL_ERROR);
return;
@@ -520,7 +519,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
Player* player = _player;
Mail* m = player->GetMail(mailId);
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime())
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(nullptr))
{
player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_INTERNAL_ERROR);
return;
@@ -624,7 +623,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket& recvData)
Player* player = _player;
Mail* m = player->GetMail(mailId);
if ((!m || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime()) ||
if ((!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(nullptr)) ||
(money > 0 && m->money != money))
{
player->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_ERR_INTERNAL_ERROR);
@@ -674,7 +673,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData)
WorldPacket data(SMSG_MAIL_LIST_RESULT, 200); // guess size
data << uint32(0); // real mail's count
data << uint8(0); // mail's count
time_t cur_time = GameTime::GetGameTime();
time_t cur_time = time(nullptr);
for (PlayerMails::iterator itr = player->GetMailBegin(); itr != player->GetMailEnd(); ++itr)
{
@@ -721,7 +720,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData)
data << uint32((*itr)->stationery); // stationery (Stationery.dbc)
data << uint64((*itr)->money); // Gold
data << uint32((*itr)->checked); // flags
data << float(float((*itr)->expire_time-GameTime::GetGameTime())/DAY); // Time
data << float(float((*itr)->expire_time-time(nullptr))/DAY); // Time
data << uint32((*itr)->mailTemplateId); // mail template (MailTemplate.dbc)
data << (*itr)->subject; // Subject string - once 00, when mail type = 3, max 256
data << (*itr)->body; // message? max 8000
@@ -786,7 +785,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket& recvData)
Player* player = _player;
Mail* m = player->GetMail(mailId);
if (!m || (m->body.empty() && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime() || (m->checked & MAIL_CHECK_MASK_COPIED))
if (!m || (m->body.empty() && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > time(nullptr) || (m->checked & MAIL_CHECK_MASK_COPIED))
{
player->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
return;
@@ -848,7 +847,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket& /*recvData*/)
data << uint32(0); // count
uint32 count = 0;
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
std::set<uint32> sentSenders;
for (PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr)
{
+5 -5
View File
@@ -401,7 +401,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recvData*/)
GetPlayer()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
}
LogoutRequest(GameTime::GetGameTime());
LogoutRequest(time(nullptr));
}
void WorldSession::HandlePlayerLogoutOpcode(WorldPacket& /*recvData*/)
@@ -462,7 +462,7 @@ void WorldSession::HandleTogglePvP(WorldPacket& recvData)
else
{
if (!GetPlayer()->pvpInfo.IsHostile && GetPlayer()->IsPvP())
GetPlayer()->pvpInfo.EndTimer = GameTime::GetGameTime(); // start toggle-off
GetPlayer()->pvpInfo.EndTimer = time(nullptr); // start toggle-off
}
//if (OutdoorPvP* pvp = _player->GetOutdoorPvP())
@@ -587,7 +587,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recvData)
return;
// prevent resurrect before 30-sec delay after body release not finished
if (time_t(corpse->GetGhostTime() + _player->GetCorpseReclaimDelay(corpse->GetType() == CORPSE_RESURRECTABLE_PVP)) > time_t(GameTime::GetGameTime()))
if (time_t(corpse->GetGhostTime() + _player->GetCorpseReclaimDelay(corpse->GetType() == CORPSE_RESURRECTABLE_PVP)) > time_t(time(nullptr)))
return;
if (!corpse->IsWithinDistInMap(_player, CORPSE_RECLAIM_RADIUS, true))
@@ -1536,7 +1536,7 @@ void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& /*recvData*/)
TC_LOG_DEBUG("network", "WORLD: CMSG_WORLD_STATE_UI_TIMER_UPDATE");
WorldPacket data(SMSG_WORLD_STATE_UI_TIMER_UPDATE, 4);
data << uint32(GameTime::GetGameTime());
data << uint32(time(nullptr));
SendPacket(&data);
}
@@ -1681,7 +1681,7 @@ void WorldSession::HandleRequestHotfix(WorldPacket& recvPacket)
WorldPacket data(SMSG_DB_REPLY, 4 * 4);
data << -int32(entry);
data << uint32(store->GetHash());
data << uint32(GameTime::GetGameTime());
data << uint32(time(nullptr));
data << uint32(0);
SendPacket(&data);
continue;
+1 -1
View File
@@ -179,7 +179,7 @@ void WorldSession::HandleMoveWorldportAck()
{
if (time_t timeReset = sInstanceSaveMgr->GetResetTimeFor(mEntry->ID, diff))
{
uint32 timeleft = uint32(timeReset - GameTime::GetGameTime());
uint32 timeleft = uint32(timeReset - time(nullptr));
GetPlayer()->SendInstanceResetWarning(mEntry->ID, diff, timeleft, true);
}
}
+1 -1
View File
@@ -693,7 +693,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData)
CharacterDatabase.CommitTransaction(trans);
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime())); // cast can't be helped
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(nullptr))); // cast can't be helped
}
void WorldSession::HandlePetAbandon(WorldPacket& recvData)
+2 -3
View File
@@ -21,7 +21,6 @@
#include "Common.h"
#include "DatabaseEnv.h"
#include "DBCStores.h"
#include "GameTime.h"
#include "Log.h"
#include "MapManager.h"
#include "NPCHandler.h"
@@ -84,8 +83,8 @@ void WorldSession::HandleQueryTimeOpcode(WorldPacket & /*recvData*/)
void WorldSession::SendQueryTimeResponse()
{
WorldPacket data(SMSG_QUERY_TIME_RESPONSE, 4+4);
data << uint32(GameTime::GetGameTime());
data << uint32(sWorld->GetNextDailyQuestsResetTime() - GameTime::GetGameTime());
data << uint32(time(nullptr));
data << uint32(sWorld->GetNextDailyQuestsResetTime() - time(nullptr));
SendPacket(&data);
}
+1 -2
View File
@@ -19,7 +19,6 @@
#include "WorldSession.h"
#include "Common.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "Language.h"
#include "Log.h"
#include "ObjectMgr.h"
@@ -252,7 +251,7 @@ void WorldSession::HandleReportLag(WorldPacket& recvData)
stmt->setFloat (4, y);
stmt->setFloat (5, z);
stmt->setUInt32(6, GetLatency());
stmt->setUInt32(7, GameTime::GetGameTime());
stmt->setUInt32(7, time(nullptr));
CharacterDatabase.Execute(stmt);
}
@@ -21,7 +21,6 @@
#include "Config.h"
#include "DatabaseEnv.h"
#include "DBCStores.h"
#include "GameTime.h"
#include "GridNotifiers.h"
#include "GridStates.h"
#include "Group.h"
@@ -106,7 +105,7 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance
resetTime = GetResetTimeFor(mapId, difficulty);
else
{
resetTime = GameTime::GetGameTime() + 2 * HOUR;
resetTime = time(nullptr) + 2 * HOUR;
// normally this will be removed soon after in InstanceMap::Add, prevent error
ScheduleReset(true, resetTime, InstResetEvent(0, mapId, difficulty, instanceId));
}
@@ -301,7 +300,7 @@ void InstanceSaveManager::LoadInstances()
void InstanceSaveManager::LoadResetTimes()
{
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
time_t today = (now / DAY) * DAY;
// NOTE: Use DirectPExecute for tables that will be queried later
@@ -512,12 +511,12 @@ void InstanceSaveManager::ForceGlobalReset(uint32 mapId, Difficulty difficulty)
ScheduleReset(false, 0, InstResetEvent(1, mapId, difficulty, 0));
ScheduleReset(false, 0, InstResetEvent(4, mapId, difficulty, 0));
// force global reset on the instance
_ResetOrWarnAll(mapId, difficulty, false, GameTime::GetGameTime());
_ResetOrWarnAll(mapId, difficulty, false, time(nullptr));
}
void InstanceSaveManager::Update()
{
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
time_t t;
while (!m_resetTimeQueue.empty())
@@ -634,7 +633,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
return;
TC_LOG_DEBUG("misc", "InstanceSaveManager::ResetOrWarnAll: Processing map %s (%u) on difficulty %u (warn? %u)", mapEntry->Name, mapid, uint8(difficulty), warn);
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
if (!warn)
{
+1 -2
View File
@@ -22,7 +22,6 @@
#include "CalendarMgr.h"
#include "CharacterCache.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "Item.h"
#include "Log.h"
#include "LootMgr.h"
@@ -191,7 +190,7 @@ void MailDraft::SendMailTo(SQLTransaction& trans, MailReceiver const& receiver,
uint32 mailId = sObjectMgr->GenerateMailID();
time_t deliver_time = GameTime::GetGameTime() + deliver_delay;
time_t deliver_time = time(nullptr) + deliver_delay;
//expire time if COD 3 days, if no COD 30 days, if auction sale pending 1 hour
uint32 expire_delay;
+2 -2
View File
@@ -3875,7 +3875,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
// increase current instances (hourly limit)
if (!group || !group->isLFGGroup())
player->AddInstanceEnterTime(GetInstanceId(), GameTime::GetGameTime());
player->AddInstanceEnterTime(GetInstanceId(), time(nullptr));
// get or create an instance save for the map
InstanceSave* mapSave = sInstanceSaveMgr->GetInstanceSave(GetInstanceId());
@@ -4686,7 +4686,7 @@ Corpse* Map::ConvertCorpseToBones(ObjectGuid const& ownerGuid, bool insignia /*=
void Map::RemoveOldCorpses()
{
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
std::vector<ObjectGuid> corpses;
corpses.reserve(_corpsesByPlayer.size());
@@ -17,7 +17,6 @@
#include "PacketLog.h"
#include "Config.h"
#include "GameTime.h"
#include "IpAddress.h"
#include "Timer.h"
#include "WorldPacket.h"
@@ -97,7 +96,7 @@ void PacketLog::Initialize()
header.Build = 15595;
header.Locale[0] = 'e'; header.Locale[1] = 'n'; header.Locale[2] = 'U'; header.Locale[3] = 'S';
std::memset(header.SessionKey, 0, sizeof(header.SessionKey));
header.SniffStartUnixtime = GameTime::GetGameTime();
header.SniffStartUnixtime = time(nullptr);
header.SniffStartTicks = getMSTime();
header.OptionalDataSize = 0;
+5 -5
View File
@@ -28,7 +28,6 @@
#include "Common.h"
#include "Config.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "Group.h"
#include "Guild.h"
#include "GuildMgr.h"
@@ -249,7 +248,7 @@ void WorldSession::SendPacket(WorldPacket const* packet, bool forced /*= false*/
static uint64 sendLastPacketCount = 0;
static uint64 sendLastPacketBytes = 0;
time_t cur_time = GameTime::GetGameTime();
time_t cur_time = time(nullptr);
if ((cur_time - lastTime) < 60)
{
@@ -320,7 +319,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
bool deletePacket = true;
std::vector<WorldPacket*> requeuePackets;
uint32 processedPackets = 0;
time_t currentTime = GameTime::GetGameTime();
time_t currentTime = time(nullptr);
while (m_Socket && _recvQueue.next(packet, updater))
{
@@ -456,8 +455,9 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
//logout procedure should happen only in World::UpdateSessions() method!!!
if (updater.ProcessUnsafe())
{
time_t currTime = time(nullptr);
///- If necessary, log the player out
if (ShouldLogOut(currentTime) && !m_playerLoading)
if (ShouldLogOut(currTime) && !m_playerLoading)
LogoutPlayer(true);
if (m_Socket && GetPlayer() && _warden)
@@ -810,7 +810,7 @@ void WorldSession::SetAccountData(AccountDataType type, time_t tm, std::string c
void WorldSession::SendAccountDataTimes(uint32 mask)
{
WorldPacket data(SMSG_ACCOUNT_DATA_TIMES, 4 + 1 + 4 + NUM_ACCOUNT_DATA_TYPES * 4);
data << uint32(GameTime::GetGameTime()); // Server time
data << uint32(time(nullptr)); // Server time
data << uint8(1);
data << uint32(mask); // type mask
for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
+1 -2
View File
@@ -20,7 +20,6 @@
#include "BattlenetAccountMgr.h"
#include "BigNumber.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "IPLocation.h"
#include "Opcodes.h"
#include "PacketLog.h"
@@ -644,7 +643,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<AuthSession> authSes
//! Negative mutetime indicates amount of seconds to be muted effective on next login - which is now.
if (mutetime < 0)
{
mutetime = GameTime::GetGameTime() + llabs(mutetime);
mutetime = time(nullptr) + llabs(mutetime);
stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME_LOGIN);
stmt->setInt64(0, mutetime);
@@ -18,7 +18,6 @@
#include "Archaeology.h"
#include "DatabaseEnv.h"
#include "DBCStores.h"
#include "GameTime.h"
#include "Log.h"
#include "Player.h"
@@ -191,11 +190,11 @@ void Archaeology::CompleteProject(uint16 projectId)
if (_completedProjects.find(projectId) == _completedProjects.end())
{
_completedProjects[projectId].first = GameTime::GetGameTime();
_completedProjects[projectId].first = time(nullptr);
_completedProjects[projectId].second = 1;
CharacterDatabase.PExecute("REPLACE INTO character_archaeology_completed VALUES (%u, %u, %u, 1);",
_player->GetGUID(), projectId, GameTime::GetGameTime());
_player->GetGUID(), projectId, time(nullptr));
}
else
{
+1 -1
View File
@@ -351,7 +351,7 @@ Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owne
Aura::Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, ObjectGuid casterGUID) :
m_spellInfo(spellproto), m_casterGuid(casterGUID ? casterGUID : caster->GetGUID()),
m_castItemGuid(castItem ? castItem->GetGUID() : ObjectGuid::Empty), m_applyTime(GameTime::GetGameTime()),
m_castItemGuid(castItem ? castItem->GetGUID() : ObjectGuid::Empty), m_applyTime(time(nullptr)),
m_owner(owner), m_timeCla(0), m_updateTargetMapInterval(0),
m_casterLevel(caster ? caster->getLevel() : m_spellInfo->SpellLevel), m_procCharges(0), m_stackAmount(1),
m_isRemoved(false), m_isLimitedTarget(false), m_isUsingCharges(false), m_dropEvent(nullptr),
+4 -16
View File
@@ -21,7 +21,6 @@
#include "Chat.h"
#include "Common.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "Language.h"
#include "Log.h"
#include "ObjectAccessor.h"
@@ -31,7 +30,7 @@
#include "WorldPacket.h"
#include "WorldSession.h"
inline float GetAge(uint64 t) { return float(GameTime::GetGameTime() - t) / DAY; }
inline float GetAge(uint64 t) { return float(time(nullptr) - t) / DAY; }
///////////////////////////////////////////////////////////////////////////////////////////////////
// GM ticket
@@ -39,7 +38,7 @@ GmTicket::GmTicket() : _id(0), _type(TICKET_TYPE_OPEN), _posX(0), _posY(0), _pos
_completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false),
_needResponse(false), _needMoreHelp(false) { }
GmTicket::GmTicket(Player* player) : _type(TICKET_TYPE_OPEN), _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(GameTime::GetGameTime()), _lastModifiedTime(GameTime::GetGameTime()),
GmTicket::GmTicket(Player* player) : _type(TICKET_TYPE_OPEN), _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(time(nullptr)), _lastModifiedTime(time(nullptr)),
_completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false),
_needResponse(false), _needMoreHelp(false)
{
@@ -179,7 +178,7 @@ void GmTicket::SendResponse(WorldSession* session) const
std::string GmTicket::FormatMessageString(ChatHandler& handler, bool detailed) const
{
time_t curTime = GameTime::GetGameTime();
time_t curTime = time(nullptr);
std::stringstream ss;
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTGUID, _id);
@@ -220,12 +219,6 @@ std::string GmTicket::FormatMessageString(ChatHandler& handler, char const* szCl
return ss.str();
}
void GmTicket::SetMessage(std::string const& message)
{
_message = message;
_lastModifiedTime = uint64(GameTime::GetGameTime());
}
void GmTicket::SetUnassigned()
{
_assignedTo.Clear();
@@ -276,7 +269,7 @@ void GmTicket::SetChatLog(std::list<uint32> time, std::string const& log)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Ticket manager
TicketMgr::TicketMgr() : _status(true), _lastTicketId(0), _lastSurveyId(0), _openTicketCount(0),
_lastChange(GameTime::GetGameTime()) { }
_lastChange(time(nullptr)) { }
TicketMgr::~TicketMgr()
{
@@ -419,11 +412,6 @@ void TicketMgr::RemoveTicket(uint32 ticketId)
}
}
void TicketMgr::UpdateLastChange()
{
_lastChange = uint64(GameTime::GetGameTime());
}
void TicketMgr::ShowList(ChatHandler& handler, bool onlineOnly) const
{
handler.SendSysMessage(onlineOnly ? LANG_COMMAND_TICKETSHOWONLINELIST : LANG_COMMAND_TICKETSHOWLIST);
+6 -2
View File
@@ -123,7 +123,11 @@ public:
void SetClosedBy(ObjectGuid value) { _closedBy = value; _type = TICKET_TYPE_CLOSED; }
void SetResolvedBy(ObjectGuid value) { _resolvedBy = value; }
void SetCompleted() { _completed = true; }
void SetMessage(std::string const& message);
void SetMessage(std::string const& message)
{
_message = message;
_lastModifiedTime = uint64(time(nullptr));
}
void SetComment(std::string const& comment) { _comment = comment; }
void SetViewed() { _viewed = true; }
void SetUnassigned();
@@ -220,7 +224,7 @@ public:
void SetStatus(bool status) { _status = status; }
uint64 GetLastChange() const { return _lastChange; }
void UpdateLastChange();
void UpdateLastChange() { _lastChange = uint64(time(nullptr)); }
uint32 GenerateTicketId() { return ++_lastTicketId; }
uint32 GetOpenTicketCount() const { return _openTicketCount; }
+3 -3
View File
@@ -20,9 +20,9 @@
namespace GameTime
{
time_t const StartTime = GameTime::GetGameTime();
time_t const StartTime = time(nullptr);
time_t GameTime = time(nullptr);
time_t GameTime = 0;
uint32 GameMSTime = 0;
std::chrono::system_clock::time_point GameTimeSystemPoint = std::chrono::system_clock::time_point::min();
@@ -60,7 +60,7 @@ namespace GameTime
void UpdateGameTimers()
{
GameTime = GameTime::GetGameTime();
GameTime = time(nullptr);
GameMSTime = getMSTime();
GameTimeSystemPoint = std::chrono::system_clock::now();
GameTimeSteadyPoint = std::chrono::steady_clock::now();
+14 -14
View File
@@ -141,7 +141,7 @@ World::World()
_guidWarn = false;
_guidAlert = false;
_warnDiff = 0;
_warnShutdownTime = GameTime::GetGameTime();
_warnShutdownTime = time(nullptr);
}
/// World destructor
@@ -377,7 +377,7 @@ bool World::HasRecentlyDisconnected(WorldSession* session)
{
for (DisconnectMap::iterator i = m_disconnects.begin(); i != m_disconnects.end();)
{
if (difftime(i->second, GameTime::GetGameTime()) < tolerance)
if (difftime(i->second, time(nullptr)) < tolerance)
{
if (i->first == session->GetAccountId())
return true;
@@ -1569,7 +1569,7 @@ void World::SetInitialWorldSettings()
uint32 startupBegin = getMSTime();
///- Initialize the random number generator
srand((unsigned int)GameTime::GetGameTime());
srand((unsigned int)time(nullptr));
///- Initialize detour memory management
dtAllocSetCustom(dtCustomAlloc, dtCustomFree);
@@ -3042,7 +3042,7 @@ void World::UpdateSessions(uint32 diff)
if (!pSession->Update(diff, updater)) // As interval = 0
{
if (!RemoveQueuedPlayer(itr->second) && itr->second && getIntConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE))
m_disconnects[itr->second->GetAccountId()] = GameTime::GetGameTime();
m_disconnects[itr->second->GetAccountId()] = time(nullptr);
RemoveQueuedPlayer(pSession);
m_sessions.erase(itr);
delete pSession;
@@ -3166,7 +3166,7 @@ void World::_UpdateRealmCharCount(PreparedQueryResult resultCharCount)
void World::InitWeeklyQuestResetTime()
{
time_t wstime = uint64(sWorld->getWorldState(WS_WEEKLY_QUEST_RESET_TIME));
time_t curtime = GameTime::GetGameTime();
time_t curtime = time(nullptr);
m_NextWeeklyQuestReset = wstime < curtime ? curtime : time_t(wstime);
}
@@ -3185,7 +3185,7 @@ void World::InitDailyQuestResetTime(bool loading)
}
// FIX ME: client not show day start time
time_t curTime = GameTime::GetGameTime();
time_t curTime = time(nullptr);
tm localTm;
localtime_r(&curTime, &localTm);
localTm.tm_hour = getIntConfig(CONFIG_DAILY_QUEST_RESET_TIME_HOUR);
@@ -3208,7 +3208,7 @@ void World::InitDailyQuestResetTime(bool loading)
void World::InitMonthlyQuestResetTime()
{
time_t wstime = uint64(sWorld->getWorldState(WS_MONTHLY_QUEST_RESET_TIME));
time_t curtime = GameTime::GetGameTime();
time_t curtime = time(nullptr);
m_NextMonthlyQuestReset = wstime < curtime ? curtime : time_t(wstime);
}
@@ -3216,10 +3216,10 @@ void World::InitRandomBGResetTime()
{
time_t bgtime = uint64(sWorld->getWorldState(WS_BG_DAILY_RESET_TIME));
if (!bgtime)
m_NextRandomBGReset = time_t(GameTime::GetGameTime()); // game time not yet init
m_NextRandomBGReset = time_t(time(nullptr)); // game time not yet init
// generate time by config
time_t curTime = GameTime::GetGameTime();
time_t curTime = time(nullptr);
tm localTm;
localtime_r(&curTime, &localTm);
localTm.tm_hour = getIntConfig(CONFIG_RANDOM_BG_RESET_HOUR);
@@ -3244,10 +3244,10 @@ void World::InitGuildResetTime()
{
time_t gtime = uint64(getWorldState(WS_GUILD_DAILY_RESET_TIME));
if (!gtime)
m_NextGuildReset = time_t(GameTime::GetGameTime()); // game time not yet init
m_NextGuildReset = time_t(time(nullptr)); // game time not yet init
// generate time by config
time_t curTime = GameTime::GetGameTime();
time_t curTime = time(nullptr);
tm localTm;
localtime_r(&curTime, &localTm);
localTm.tm_hour = getIntConfig(CONFIG_GUILD_RESET_HOUR);
@@ -3272,10 +3272,10 @@ void World::InitCurrencyResetTime()
{
time_t currencytime = uint64(sWorld->getWorldState(WS_CURRENCY_RESET_TIME));
if (!currencytime)
m_NextCurrencyReset = time_t(GameTime::GetGameTime()); // game time not yet init
m_NextCurrencyReset = time_t(time(nullptr)); // game time not yet init
// generate time by config
time_t curTime = GameTime::GetGameTime();
time_t curTime = time(nullptr);
tm localTm = *localtime(&curTime);
localTm.tm_wday = getIntConfig(CONFIG_CURRENCY_RESET_DAY);
@@ -3393,7 +3393,7 @@ void World::ResetMonthlyQuests()
itr->second->GetPlayer()->ResetMonthlyQuestStatus();
// generate time
time_t curTime = GameTime::GetGameTime();
time_t curTime = time(nullptr);
tm localTm;
localtime_r(&curTime, &localTm);
+2 -3
View File
@@ -27,7 +27,6 @@ EndScriptData */
#include "CharacterCache.h"
#include "Chat.h"
#include "DatabaseEnv.h"
#include "GameTime.h"
#include "Language.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
@@ -286,7 +285,7 @@ public:
time_t unbanDate = time_t(fields[3].GetUInt32());
bool active = false;
if (fields[2].GetBool() && (fields[1].GetUInt64() == uint64(0) || unbanDate >= GameTime::GetGameTime()))
if (fields[2].GetBool() && (fields[1].GetUInt64() == uint64(0) || unbanDate >= time(nullptr)))
active = true;
bool permanent = (fields[1].GetUInt64() == uint64(0));
std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true);
@@ -344,7 +343,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 >= GameTime::GetGameTime()))
if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbanDate >= time(nullptr)))
active = true;
bool permanent = (fields[1].GetUInt32() == uint32(0));
std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt32(), true);
+2 -3
View File
@@ -24,7 +24,6 @@ EndScriptData */
#include "ScriptMgr.h"
#include "Chat.h"
#include "GameTime.h"
#include "GameEventMgr.h"
#include "Language.h"
#include "Player.h"
@@ -117,8 +116,8 @@ public:
std::string endTimeStr = TimeToTimestampStr(eventData.end);
uint32 delay = sGameEventMgr->NextCheck(eventId);
time_t nextTime = GameTime::GetGameTime() + delay;
std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(GameTime::GetGameTime() + delay) : "-";
time_t nextTime = time(nullptr) + delay;
std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(time(nullptr) + delay) : "-";
std::string occurenceStr = secsToTimeString(eventData.occurence * MINUTE);
std::string lengthStr = secsToTimeString(eventData.length * MINUTE);
+1 -2
View File
@@ -26,7 +26,6 @@ EndScriptData */
#include "Chat.h"
#include "DatabaseEnv.h"
#include "DBCStores.h"
#include "GameTime.h"
#include "GameEventMgr.h"
#include "Language.h"
#include "Log.h"
@@ -345,7 +344,7 @@ public:
if (target)
{
int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - GameTime::GetGameTime());
int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - time(nullptr));
if (curRespawnDelay < 0)
curRespawnDelay = 0;
+3 -4
View File
@@ -24,7 +24,6 @@ EndScriptData */
#include "ScriptMgr.h"
#include "Chat.h"
#include "GameTime.h"
#include "Group.h"
#include "InstanceSaveMgr.h"
#include "InstanceScript.h"
@@ -86,7 +85,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() - GameTime::GetGameTime());
std::string timeleft = GetTimeString(save->GetResetTime() - time(nullptr));
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++;
}
@@ -102,7 +101,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() - GameTime::GetGameTime());
std::string timeleft = GetTimeString(save->GetResetTime() - time(nullptr));
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++;
}
@@ -145,7 +144,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() - GameTime::GetGameTime());
std::string timeleft = GetTimeString(save->GetResetTime() - time(nullptr));
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++;
+2 -3
View File
@@ -28,7 +28,6 @@ EndScriptData */
#include "Creature.h"
#include "DatabaseEnv.h"
#include "DBCStores.h"
#include "GameTime.h"
#include "GameObject.h"
#include "Language.h"
#include "MapManager.h"
@@ -716,7 +715,7 @@ public:
uint32 gridY = ri->gridId / MAX_NUMBER_OF_GRIDS;
uint32 gridX = ri->gridId % MAX_NUMBER_OF_GRIDS;
std::string respawnTime = ri->respawnTime > GameTime::GetGameTime() ? secsToTimeString(uint64(ri->respawnTime - GameTime::GetGameTime()), true) : stringOverdue;
std::string respawnTime = ri->respawnTime > time(nullptr) ? secsToTimeString(uint64(ri->respawnTime - time(nullptr)), 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");
}
@@ -737,7 +736,7 @@ public:
uint32 gridY = ri->gridId / MAX_NUMBER_OF_GRIDS;
uint32 gridX = ri->gridId % MAX_NUMBER_OF_GRIDS;
std::string respawnTime = ri->respawnTime > GameTime::GetGameTime() ? secsToTimeString(uint64(ri->respawnTime - GameTime::GetGameTime()), true) : stringOverdue;
std::string respawnTime = ri->respawnTime > time(nullptr) ? secsToTimeString(uint64(ri->respawnTime - time(nullptr)), 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;
+3 -3
View File
@@ -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 - GameTime::GetGameTime(), 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 - time(nullptr), 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 - GameTime::GetGameTime(), true).c_str(), muteBy.c_str());
handler->PSendSysMessage(LANG_PINFO_MUTED, muteReason.c_str(), secsToTimeString(muteTime - time(nullptr), 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 = GameTime::GetGameTime() + notSpeakTime * MINUTE;
int64 muteTime = time(nullptr) + notSpeakTime * MINUTE;
target->GetSession()->m_muteTime = muteTime;
stmt->setInt64(0, muteTime);
std::string nameLink = handler->playerLink(targetName);
+1 -2
View File
@@ -28,7 +28,6 @@ EndScriptData */
#include "CreatureGroups.h"
#include "DatabaseEnv.h"
#include "FollowMovementGenerator.h"
#include "GameTime.h"
#include "Language.h"
#include "Log.h"
#include "Map.h"
@@ -785,7 +784,7 @@ public:
uint32 displayid = target->GetDisplayId();
uint32 nativeid = target->GetNativeDisplayId();
uint32 entry = target->GetEntry();
int64 curRespawnDelay = target->GetRespawnCompatibilityMode() ? target->GetRespawnTimeEx() - GameTime::GetGameTime() : target->GetMap()->GetCreatureRespawnTime(target->GetSpawnId()) - GameTime::GetGameTime();
int64 curRespawnDelay = target->GetRespawnCompatibilityMode() ? target->GetRespawnTimeEx() - time(nullptr) : target->GetMap()->GetCreatureRespawnTime(target->GetSpawnId()) - time(nullptr);
if (curRespawnDelay < 0)
curRespawnDelay = 0;
@@ -403,7 +403,7 @@ public:
return false;
bool summoned = false;
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
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] = GameTime::GetGameTime() + _slotInfo[slot].Cooldown;
_respawnCooldowns[slot] = time(nullptr) + _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 = GameTime::GetGameTime() + 60;
_firstMageCooldown = time(nullptr) + 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 = GameTime::GetGameTime() + 60;
_firstMageCooldown = time(nullptr) + 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 = GameTime::GetGameTime();
time_t now = time(nullptr);
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 < GameTime::GetGameTime())
if (_axethrowersYellCooldown < time(nullptr))
{
Talk(SAY_SAURFANG_AXETHROWERS);
_axethrowersYellCooldown = GameTime::GetGameTime() + 5;
_axethrowersYellCooldown = time(nullptr) + 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 < GameTime::GetGameTime())
if (_rocketeersYellCooldown < time(nullptr))
{
Talk(SAY_SAURFANG_ROCKETEERS);
_rocketeersYellCooldown = GameTime::GetGameTime() + 5;
_rocketeersYellCooldown = time(nullptr) + 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 = GameTime::GetGameTime() + 60;
_firstMageCooldown = time(nullptr) + 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 = GameTime::GetGameTime() + 60;
_firstMageCooldown = time(nullptr) + 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 = GameTime::GetGameTime();
time_t now = time(nullptr);
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 < GameTime::GetGameTime())
if (_riflemanYellCooldown < time(nullptr))
{
Talk(SAY_MURADIN_RIFLEMAN);
_riflemanYellCooldown = GameTime::GetGameTime() + 5;
_riflemanYellCooldown = time(nullptr) + 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 < GameTime::GetGameTime())
if (_mortarYellCooldown < time(nullptr))
{
Talk(SAY_MURADIN_MORTAR);
_mortarYellCooldown = GameTime::GetGameTime() + 5;
_mortarYellCooldown = time(nullptr) + 5;
}
}
_events.ScheduleEvent(EVENT_CHECK_MORTAR, 1000);
@@ -19,7 +19,6 @@
#include "BattlefieldMgr.h"
#include "BattlefieldWG.h"
#include "DBCStores.h"
#include "GameTime.h"
#include "GameObject.h"
#include "GameObjectAI.h"
#include "Player.h"
@@ -307,7 +306,7 @@ class npc_wg_queue : public CreatureScript
else
{
uint32 timer = wintergrasp->GetTimer() / 1000;
player->SendUpdateWorldState(4354, GameTime::GetGameTime() + timer);
player->SendUpdateWorldState(4354, time(nullptr) + timer);
if (timer < 15 * MINUTE)
{
AddGossipItemFor(player, GOSSIP_ICON_CHAT, player->GetSession()->GetTrinityString(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
@@ -4975,28 +4975,6 @@ class spell_gen_launch_quest : public SpellScript
}
};
// Used for some spells cast by vehicles or charmed creatures that do not send a cooldown event on their own
class spell_gen_charmed_unit_spell_cooldown : public SpellScript
{
PrepareSpellScript(spell_gen_charmed_unit_spell_cooldown);
void HandleCast()
{
Unit* caster = GetCaster();
if (Player* owner = caster->GetCharmerOrOwnerPlayerOrPlayerItself())
{
WorldPacket data;
caster->GetSpellHistory()->BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, GetSpellInfo()->Id, GetSpellInfo()->RecoveryTime);
owner->SendDirectMessage(&data);
}
}
void Register() override
{
OnCast += SpellCastFn(spell_gen_charmed_unit_spell_cooldown::HandleCast);
}
};
void AddSC_generic_spell_scripts()
{
new spell_gen_absorb0_hitlimit1();
@@ -5111,5 +5089,4 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_mirror_image_aura);
RegisterSpellScript(spell_gen_reverse_cast_ride_vehicle);
RegisterSpellScript(spell_gen_launch_quest);
RegisterSpellScript(spell_gen_charmed_unit_spell_cooldown);
}
+1 -1
View File
@@ -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()-GameTime::GetGameTime()));
GetCaster()->SummonGameObject(OBJECT_IMPRISONED_DOOMGUARD, *target, QuaternionData(), uint32(target->GetRespawnTime()-time(nullptr)));
target->DespawnOrUnsummon();
}
}
+2 -2
View File
@@ -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()] = GameTime::GetGameTime();
_damageTimes[doneBy->GetGUID()] = time(nullptr);
damage = 0;
}
@@ -1855,7 +1855,7 @@ public:
{
case EVENT_TD_CHECK_COMBAT:
{
time_t now = GameTime::GetGameTime();
time_t now = time(nullptr);
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