Core/Misc: Replace time(NULL) with GameTime::GetGameTime()
(ported commit: 12701cb0c6c45eb105ad449eb9a56e76d84d691e)
This commit is contained in:
1 parent
ba38f74816
commit
5fe3a1f7f9
68 files changed
+335
-259
No files matched your search
@@ -24,6 +24,7 @@
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCEnums.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Group.h"
|
||||
@@ -693,7 +694,7 @@ void AchievementMgr<Player>::LoadFromDB(PreparedQueryResult achievementResult, P
|
||||
|
||||
if (criteriaResult)
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
do
|
||||
{
|
||||
Field* fields = criteriaResult->Fetch();
|
||||
@@ -756,7 +757,7 @@ void AchievementMgr<Guild>::LoadFromDB(PreparedQueryResult achievementResult, Pr
|
||||
|
||||
if (criteriaResult)
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
do
|
||||
{
|
||||
Field* fields = criteriaResult->Fetch();
|
||||
@@ -895,7 +896,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(time(nullptr));
|
||||
data.AppendPackedTime(GameTime::GetGameTime());
|
||||
data << uint32(0); // does not notify player ingame
|
||||
GetOwner()->SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), true);
|
||||
}
|
||||
@@ -916,7 +917,7 @@ void AchievementMgr<Guild>::SendAchievementEarned(AchievementEntry const* achiev
|
||||
data.WriteBit(guid[5]);
|
||||
|
||||
data.WriteByteSeq(guid[2]);
|
||||
data.AppendPackedTime(time(nullptr));
|
||||
data.AppendPackedTime(GameTime::GetGameTime());
|
||||
data.WriteByteSeq(guid[0]);
|
||||
data.WriteByteSeq(guid[4]);
|
||||
data.WriteByteSeq(guid[1]);
|
||||
@@ -1857,7 +1858,7 @@ void AchievementMgr<T>::SetCriteriaProgress(AchievementCriteriaEntry const* entr
|
||||
}
|
||||
|
||||
progress->changed = true;
|
||||
progress->date = time(nullptr); // set the date to the latest update.
|
||||
progress->date = GameTime::GetGameTime(); // set the date to the latest update.
|
||||
|
||||
AchievementEntry const* achievement = sAchievementMgr->GetAchievement(entry->achievement);
|
||||
uint32 timeElapsed = 0;
|
||||
@@ -1974,7 +1975,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 = time(nullptr);
|
||||
ca.date = GameTime::GetGameTime();
|
||||
ca.changed = true;
|
||||
|
||||
sAchievementMgr->SetRealmCompleted(achievement, GetOwner()->GetInstanceId());
|
||||
@@ -2055,7 +2056,7 @@ void AchievementMgr<Guild>::CompletedAchievement(AchievementEntry const* achieve
|
||||
|
||||
SendAchievementEarned(achievement);
|
||||
CompletedAchievementData& ca = m_completedAchievements[achievement->ID];
|
||||
ca.date = time(nullptr);
|
||||
ca.date = GameTime::GetGameTime();
|
||||
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 = time(nullptr);
|
||||
AH->expire_time = GameTime::GetGameTime();
|
||||
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 - time(nullptr)) * IN_MILLISECONDS); // time left
|
||||
data << uint32((expire_time - GameTime::GetGameTime()) * IN_MILLISECONDS); // time left
|
||||
data << uint64(bidder); // auction->bidder current
|
||||
data << uint64(bid); // current bid
|
||||
return true;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "AuctionHouseBotBuyer.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Item.h"
|
||||
#include "ItemTemplate.h"
|
||||
#include "Log.h"
|
||||
@@ -97,7 +98,7 @@ bool AuctionBotBuyer::Update(AuctionHouseType houseType)
|
||||
uint32 AuctionBotBuyer::GetItemInformation(BuyerConfiguration& config)
|
||||
{
|
||||
config.SameItemInfo.clear();
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
uint32 count = 0;
|
||||
|
||||
AuctionHouseObject* house = sAuctionMgr->GetAuctionsMap(config.GetHouseType());
|
||||
@@ -237,7 +238,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 = time(nullptr) - 5;
|
||||
time_t now = GameTime::GetGameTime() - 5;
|
||||
|
||||
for (CheckEntryMap::iterator itr = config.EligibleItems.begin(); itr != config.EligibleItems.end();)
|
||||
{
|
||||
@@ -253,7 +254,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 = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(config.GetHouseType());
|
||||
CheckEntryMap& items = config.EligibleItems;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStores.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "GameTime.h"
|
||||
#include "Item.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -1035,7 +1036,7 @@ void AuctionBotSeller::AddNewAuctions(SellerConfiguration& config)
|
||||
auctionEntry->bid = 0;
|
||||
auctionEntry->deposit = sAuctionMgr->GetAuctionDeposit(ahEntry, etime, item, stackCount);
|
||||
auctionEntry->auctionHouseEntry = ahEntry;
|
||||
auctionEntry->expire_time = time(nullptr) + urand(config.GetMinTime(), config.GetMaxTime()) * HOUR;
|
||||
auctionEntry->expire_time = GameTime::GetGameTime() + urand(config.GetMinTime(), config.GetMaxTime()) * HOUR;
|
||||
|
||||
item->SaveToDB(trans);
|
||||
sAuctionMgr->AddAItem(item);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "CellImpl.h"
|
||||
#include "CreatureTextMgr.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Group.h"
|
||||
@@ -85,7 +86,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()] = time(nullptr) + 10;
|
||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = GameTime::GetGameTime() + 10;
|
||||
InvitePlayerToQueue(player);
|
||||
}
|
||||
}
|
||||
@@ -164,7 +165,7 @@ bool Battlefield::Update(uint32 diff)
|
||||
// Kick players who chose not to accept invitation to the battle
|
||||
if (m_uiKickDontAcceptTimer <= diff)
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
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)
|
||||
@@ -250,7 +251,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()] = time(nullptr) + 10;
|
||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = GameTime::GetGameTime() + 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -275,7 +276,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()] = time(nullptr) + 10;
|
||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = GameTime::GetGameTime() + 10;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -284,7 +285,7 @@ void Battlefield::InvitePlayerToWar(Player* player)
|
||||
return;
|
||||
|
||||
m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID());
|
||||
m_InvitedPlayers[player->GetTeamId()][player->GetGUID()] = time(nullptr) + m_TimeForAcceptInvite;
|
||||
m_InvitedPlayers[player->GetTeamId()][player->GetGUID()] = GameTime::GetGameTime() + m_TimeForAcceptInvite;
|
||||
player->GetSession()->SendBfInvitePlayerToWar(m_Guid, m_ZoneId, m_TimeForAcceptInvite);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "BattlefieldTB.h"
|
||||
#include "Battleground.h"
|
||||
#include "Creature.h"
|
||||
#include "GameTime.h"
|
||||
#include "GameObject.h"
|
||||
#include "MapManager.h"
|
||||
#include "ObjectAccessor.h"
|
||||
@@ -569,8 +570,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() ? time(nullptr) + (m_Timer / 1000) : 0);
|
||||
data << uint32(TB_WS_TIME_NEXT_BATTLE) << int32(!IsWarTime() ? time(nullptr) + (m_Timer / 1000) : 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);
|
||||
|
||||
// Not sure if TB
|
||||
//packet.Worldstates.emplace_back(uint32(TB_WS_65_UNKNOWN), int32(0));
|
||||
@@ -968,7 +969,7 @@ void BattlefieldTB::TowerDestroyed(TBTowerId tbTowerId)
|
||||
// Add 5 minute bonus time
|
||||
m_Timer += m_BonusTime;
|
||||
|
||||
SendUpdateWorldState(TB_WS_TIME_BATTLE_END, uint32(time(nullptr) + (m_Timer / 1000)));
|
||||
SendUpdateWorldState(TB_WS_TIME_BATTLE_END, uint32(GameTime::GetGameTime() + (m_Timer / 1000)));
|
||||
|
||||
SendWarning(TBTowers[tbTowerId].textDamaged);
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "AchievementMgr.h"
|
||||
#include "Battleground.h"
|
||||
#include "CreatureTextMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "GameObject.h"
|
||||
#include "Log.h"
|
||||
#include "MapManager.h"
|
||||
@@ -1147,7 +1148,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(time(nullptr) + (m_Timer / 1000));
|
||||
data << ClockWorldState[i] << uint32(GameTime::GetGameTime() + (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));
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "CalendarMgr.h"
|
||||
#include "CharacterCache.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "Log.h"
|
||||
@@ -27,6 +28,9 @@
|
||||
#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);
|
||||
|
||||
@@ -147,8 +147,7 @@ struct TC_GAME_API CalendarInvite
|
||||
_text = calendarInvite.GetText();
|
||||
}
|
||||
|
||||
CalendarInvite() : _inviteId(1), _eventId(0), _invitee(), _senderGUID(), _statusTime(time(nullptr)),
|
||||
_status(CALENDAR_STATUS_INVITED), _rank(CALENDAR_RANK_PLAYER), _text("") { }
|
||||
CalendarInvite();
|
||||
|
||||
CalendarInvite(uint64 inviteId, uint64 eventId, ObjectGuid invitee, ObjectGuid senderGUID, time_t statusTime,
|
||||
CalendarInviteStatus status, CalendarModerationRank rank, std::string text) :
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStores.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "Group.h"
|
||||
#include "GroupMgr.h"
|
||||
@@ -297,7 +298,7 @@ void LFGMgr::Update(uint32 diff)
|
||||
if (!isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
time_t currTime = time(nullptr);
|
||||
time_t currTime = GameTime::GetGameTime();
|
||||
|
||||
// Remove obsolete role checks
|
||||
for (LfgRoleCheckContainer::iterator it = RoleChecksStore.begin(); it != RoleChecksStore.end();)
|
||||
@@ -582,13 +583,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(time(nullptr));
|
||||
ticket.Time = int32(GameTime::GetGameTime());
|
||||
std::string debugNames = "";
|
||||
if (grp) // Begin rolecheck
|
||||
{
|
||||
// Create new rolecheck
|
||||
LfgRoleCheck& roleCheck = RoleChecksStore[gguid];
|
||||
roleCheck.cancelTime = time_t(time(nullptr)) + LFG_TIME_ROLECHECK;
|
||||
roleCheck.cancelTime = time_t(GameTime::GetGameTime()) + LFG_TIME_ROLECHECK;
|
||||
roleCheck.state = LFG_ROLECHECK_INITIALITING;
|
||||
roleCheck.leader = guid;
|
||||
roleCheck.dungeons = dungeons;
|
||||
@@ -627,7 +628,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
|
||||
LfgRolesMap rolesMap;
|
||||
rolesMap[guid] = roles;
|
||||
LFGQueue& queue = GetQueue(guid);
|
||||
queue.AddQueueData(guid, time(nullptr), dungeons, rolesMap);
|
||||
queue.AddQueueData(guid, GameTime::GetGameTime(), dungeons, rolesMap);
|
||||
|
||||
if (!isContinue)
|
||||
{
|
||||
@@ -823,7 +824,7 @@ void LFGMgr::UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid /* = ObjectGuid::
|
||||
{
|
||||
SetState(gguid, LFG_STATE_QUEUED);
|
||||
LFGQueue& queue = GetQueue(gguid);
|
||||
queue.AddQueueData(gguid, time_t(time(nullptr)), roleCheck.dungeons, roleCheck.roles);
|
||||
queue.AddQueueData(gguid, time_t(GameTime::GetGameTime()), roleCheck.dungeons, roleCheck.roles);
|
||||
RoleChecksStore.erase(itRoleCheck);
|
||||
}
|
||||
else if (roleCheck.state != LFG_ROLECHECK_INITIALITING)
|
||||
@@ -1123,7 +1124,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 = time(nullptr);
|
||||
time_t joinTime = GameTime::GetGameTime();
|
||||
|
||||
LFGQueue& queue = GetQueue(guid);
|
||||
LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_GROUP_FOUND, GetSelectedDungeons(guid), GetComment(guid));
|
||||
@@ -1289,7 +1290,7 @@ void LFGMgr::InitBoot(ObjectGuid gguid, ObjectGuid kicker, ObjectGuid victim, st
|
||||
|
||||
LfgPlayerBoot& boot = BootsStore[gguid];
|
||||
boot.inProgress = true;
|
||||
boot.cancelTime = time_t(time(nullptr)) + LFG_TIME_BOOT;
|
||||
boot.cancelTime = time_t(GameTime::GetGameTime()) + LFG_TIME_BOOT;
|
||||
boot.reason = reason;
|
||||
boot.victim = victim;
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "Containers.h"
|
||||
#include "DBCStructure.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "LFGQueue.h"
|
||||
#include "LFGMgr.h"
|
||||
@@ -80,6 +81,11 @@ char const* GetCompatibleString(LfgCompatibility compatibles)
|
||||
}
|
||||
}
|
||||
|
||||
LfgQueueData::LfgQueueData() : joinTime(GameTime::GetGameTime())
|
||||
{
|
||||
InitializeGroupSetup();
|
||||
}
|
||||
|
||||
void LfgQueueData::InitializeGroupSetup()
|
||||
{
|
||||
tanks = 0;
|
||||
@@ -563,7 +569,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check)
|
||||
}
|
||||
|
||||
// Create a new proposal
|
||||
proposal.cancelTime = time(nullptr) + LFG_TIME_PROPOSAL;
|
||||
proposal.cancelTime = GameTime::GetGameTime() + LFG_TIME_PROPOSAL;
|
||||
proposal.state = LFG_PROPOSAL_INITIATING;
|
||||
proposal.leader.Clear();
|
||||
|
||||
|
||||
@@ -51,10 +51,7 @@ struct LfgCompatibilityData
|
||||
/// Stores player or group queue info
|
||||
struct LfgQueueData
|
||||
{
|
||||
LfgQueueData(): joinTime(time_t(time(nullptr)))
|
||||
{
|
||||
InitializeGroupSetup();
|
||||
}
|
||||
LfgQueueData();
|
||||
|
||||
LfgQueueData(time_t _joinTime, LfgDungeonSet const& _dungeons, LfgRolesMap const& _roles) :
|
||||
joinTime(_joinTime), dungeons(_dungeons), roles(_roles)
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "CharacterCache.h"
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Log.h"
|
||||
#include "Map.h"
|
||||
#include "ObjectAccessor.h"
|
||||
@@ -38,7 +39,7 @@ Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES), m_type(type
|
||||
|
||||
m_valuesCount = CORPSE_END;
|
||||
|
||||
m_time = time(nullptr);
|
||||
m_time = GameTime::GetGameTime();
|
||||
|
||||
lootForBody = false;
|
||||
lootRecipient = nullptr;
|
||||
@@ -148,6 +149,11 @@ 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
|
||||
|
||||
@@ -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() { m_time = time(nullptr); }
|
||||
void ResetGhostTime();
|
||||
CorpseType GetType() const { return m_type; }
|
||||
|
||||
CellCoord const& GetCellCoord() const { return _cellCoord; }
|
||||
|
||||
@@ -70,6 +70,9 @@ 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);
|
||||
@@ -341,7 +344,7 @@ void Creature::RemoveCorpse(bool setSpawnTime)
|
||||
|
||||
if (m_respawnCompatibilityMode)
|
||||
{
|
||||
m_corpseRemoveTime = time(nullptr);
|
||||
m_corpseRemoveTime = GameTime::GetGameTime();
|
||||
setDeathState(DEAD);
|
||||
RemoveAllAuras();
|
||||
DestroyForNearbyPlayers(); // old UpdateObjectVisibility()
|
||||
@@ -352,7 +355,7 @@ void Creature::RemoveCorpse(bool setSpawnTime)
|
||||
|
||||
// Should get removed later, just keep "compatibility" with scripts
|
||||
if (setSpawnTime)
|
||||
m_respawnTime = std::max<time_t>(time(nullptr) + respawnDelay, m_respawnTime);
|
||||
m_respawnTime = std::max<time_t>(GameTime::GetGameTime() + respawnDelay, m_respawnTime);
|
||||
|
||||
// if corpse was removed during falling, the falling will continue and override relocation to respawn position
|
||||
if (IsFalling())
|
||||
@@ -386,7 +389,7 @@ void Creature::RemoveCorpse(bool setSpawnTime)
|
||||
if (setSpawnTime)
|
||||
{
|
||||
uint32 respawnDelay = m_respawnDelay;
|
||||
m_respawnTime = std::max<time_t>(time(nullptr) + respawnDelay, m_respawnTime);
|
||||
m_respawnTime = std::max<time_t>(GameTime::GetGameTime() + respawnDelay, m_respawnTime);
|
||||
|
||||
SaveRespawnTime(0, false);
|
||||
}
|
||||
@@ -616,7 +619,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 = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
if (m_respawnTime <= now)
|
||||
{
|
||||
// Delay respawn if spawn group is not active
|
||||
@@ -672,7 +675,7 @@ void Creature::Update(uint32 diff)
|
||||
}
|
||||
else m_groupLootTimer -= diff;
|
||||
}
|
||||
else if (m_corpseRemoveTime <= time(nullptr))
|
||||
else if (m_corpseRemoveTime <= GameTime::GetGameTime())
|
||||
{
|
||||
RemoveCorpse(false);
|
||||
TC_LOG_DEBUG("entities.unit", "Removing corpse... %u ", GetUInt32Value(OBJECT_FIELD_ENTRY));
|
||||
@@ -1707,7 +1710,7 @@ bool Creature::IsInvisibleDueToDespawn() const
|
||||
if (Unit::IsInvisibleDueToDespawn())
|
||||
return true;
|
||||
|
||||
if (IsAlive() || isDying() || m_corpseRemoveTime > time(nullptr))
|
||||
if (IsAlive() || isDying() || m_corpseRemoveTime > GameTime::GetGameTime())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -1829,7 +1832,7 @@ void Creature::setDeathState(DeathState s)
|
||||
|
||||
if (s == JUST_DIED)
|
||||
{
|
||||
m_corpseRemoveTime = time(nullptr) + m_corpseDelay;
|
||||
m_corpseRemoveTime = GameTime::GetGameTime() + m_corpseDelay;
|
||||
uint32 respawnDelay = m_respawnDelay;
|
||||
if (uint32 scalingMode = sWorld->getIntConfig(CONFIG_RESPAWN_DYNAMICMODE))
|
||||
GetMap()->ApplyDynamicModeRespawnScaling(this, m_spawnId, respawnDelay, scalingMode);
|
||||
@@ -1839,14 +1842,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 = time(nullptr) + respawnDelay + m_corpseDelay;
|
||||
m_respawnTime = GameTime::GetGameTime() + respawnDelay + m_corpseDelay;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsDungeonBoss() && !m_respawnDelay)
|
||||
m_respawnTime = std::numeric_limits<time_t>::max(); // never respawn in this instance
|
||||
else
|
||||
m_respawnTime = time(nullptr) + respawnDelay;
|
||||
m_respawnTime = GameTime::GetGameTime() + respawnDelay;
|
||||
}
|
||||
|
||||
// always save boss respawn time at death to prevent crash cheating
|
||||
@@ -2421,7 +2424,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 (time(nullptr) - GetLastDamagedTime() <= MAX_AGGRO_RESET_TIME)
|
||||
if (GameTime::GetGameTime() - 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.
|
||||
@@ -2584,7 +2587,7 @@ bool Creature::HasSpell(uint32 spellID) const
|
||||
|
||||
time_t Creature::GetRespawnTimeEx() const
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
if (m_respawnTime > now)
|
||||
return m_respawnTime;
|
||||
else
|
||||
@@ -2634,7 +2637,7 @@ void Creature::AllLootRemovedFromCorpse()
|
||||
if (LootTemplates_Skinning.HaveLootFor(GetCreatureTemplate()->SkinLootId))
|
||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
|
||||
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
// Do not reset corpse remove time if corpse is already removed
|
||||
if (m_corpseRemoveTime <= now)
|
||||
return;
|
||||
@@ -2702,7 +2705,7 @@ uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem)
|
||||
|
||||
VendorItemCount* vCount = &*itr;
|
||||
|
||||
time_t ptime = time(nullptr);
|
||||
time_t ptime = GameTime::GetGameTime();
|
||||
|
||||
if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime)
|
||||
if (ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item))
|
||||
@@ -2740,7 +2743,7 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us
|
||||
|
||||
VendorItemCount* vCount = &*itr;
|
||||
|
||||
time_t ptime = time(nullptr);
|
||||
time_t ptime = GameTime::GetGameTime();
|
||||
|
||||
if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime)
|
||||
if (ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item))
|
||||
@@ -3111,7 +3114,12 @@ bool Creature::IsMovementPreventedByCasting() const
|
||||
|
||||
void Creature::StartPickPocketRefillTimer()
|
||||
{
|
||||
_pickpocketLootRestore = time(nullptr) + sWorld->getIntConfig(CONFIG_CREATURE_PICKPOCKET_REFILL);
|
||||
_pickpocketLootRestore = GameTime::GetGameTime() + sWorld->getIntConfig(CONFIG_CREATURE_PICKPOCKET_REFILL);
|
||||
}
|
||||
|
||||
bool Creature::CanGeneratePickPocketLoot() const
|
||||
{
|
||||
return _pickpocketLootRestore <= GameTime::GetGameTime();
|
||||
}
|
||||
|
||||
void Creature::SetTextRepeatId(uint8 textGroup, uint8 id)
|
||||
|
||||
@@ -40,8 +40,7 @@ enum MovementGeneratorType : uint8;
|
||||
|
||||
struct VendorItemCount
|
||||
{
|
||||
VendorItemCount(uint32 _item, uint32 _count)
|
||||
: itemId(_item), count(_count), lastIncrementTime(time(nullptr)) { }
|
||||
VendorItemCount(uint32 _item, uint32 _count);
|
||||
|
||||
uint32 itemId;
|
||||
uint32 count;
|
||||
@@ -184,7 +183,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
||||
Loot loot;
|
||||
void StartPickPocketRefillTimer();
|
||||
void ResetPickPocketRefillTimer() { _pickpocketLootRestore = 0; }
|
||||
bool CanGeneratePickPocketLoot() const { return _pickpocketLootRestore <= time(nullptr); }
|
||||
bool CanGeneratePickPocketLoot() const;
|
||||
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 (time(nullptr) > m_respawnTime - FISHING_BOBBER_READY_TIME)
|
||||
if (GameTime::GetGameTime() > 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 = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
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 = time(nullptr) + respawnDelay;
|
||||
m_respawnTime = GameTime::GetGameTime() + 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 <= time(nullptr))
|
||||
if (m_respawnTime && m_respawnTime <= GameTime::GetGameTime())
|
||||
{
|
||||
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 ? time(nullptr) + forceDelay : m_respawnTime;
|
||||
uint32 thisRespawnTime = forceDelay ? GameTime::GetGameTime() + 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 = time(nullptr);
|
||||
m_respawnTime = GameTime::GetGameTime();
|
||||
GetMap()->RemoveRespawnTime(SPAWN_TYPE_GAMEOBJECT, m_spawnId, true);
|
||||
}
|
||||
}
|
||||
@@ -2252,6 +2252,11 @@ 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() { m_lootGenerationTime = time(nullptr); }
|
||||
void SetLootGenerationTime();
|
||||
uint32 GetLootGenerationTime() const { return m_lootGenerationTime; }
|
||||
|
||||
void AddToSkillupList(ObjectGuid::LowType PlayerGuidLow) { m_SkillupList.push_back(PlayerGuidLow); }
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "ConditionMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GameTime.h"
|
||||
#include "ItemEnchantmentMgr.h"
|
||||
#include "Log.h"
|
||||
#include "LootItemStorage.h"
|
||||
@@ -261,7 +262,7 @@ Item::Item()
|
||||
m_container = nullptr;
|
||||
m_lootGenerated = false;
|
||||
mb_in_trade = false;
|
||||
m_lastPlayedTimeUpdate = time(nullptr);
|
||||
m_lastPlayedTimeUpdate = GameTime::GetGameTime();
|
||||
|
||||
m_refundRecipient = 0;
|
||||
m_paidMoney = 0;
|
||||
@@ -1100,7 +1101,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 = time(nullptr);
|
||||
time_t curtime = GameTime::GetGameTime();
|
||||
uint32 elapsed = uint32(curtime - m_lastPlayedTimeUpdate);
|
||||
uint32 new_playtime = current_playtime + elapsed;
|
||||
// Check if the refund timer has expired yet
|
||||
@@ -1121,7 +1122,7 @@ void Item::UpdatePlayedTime(Player* owner)
|
||||
|
||||
uint32 Item::GetPlayedTime()
|
||||
{
|
||||
time_t curtime = time(nullptr);
|
||||
time_t curtime = GameTime::GetGameTime();
|
||||
uint32 elapsed = uint32(curtime - m_lastPlayedTimeUpdate);
|
||||
return GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME) + elapsed;
|
||||
}
|
||||
|
||||
@@ -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(::time(nullptr)));
|
||||
TC_LOG_DEBUG("misc", "time %u current time " UI64FMTD "", flags2, uint64(::GameTime::GetGameTime()));
|
||||
TC_LOG_DEBUG("misc", "position: `%s`", pos.ToString().c_str());
|
||||
if (transport.guid)
|
||||
{
|
||||
|
||||
@@ -230,7 +230,7 @@ bool Pet::LoadPetData(Player* owner, uint32 petEntry, uint32 petnumber, bool cur
|
||||
break;
|
||||
}
|
||||
|
||||
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(nullptr))); // cast can't be helped here
|
||||
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime())); // 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(time(nullptr) - playerPetData->Timediff);
|
||||
uint32 timediff = uint32(GameTime::GetGameTime() - 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, time(nullptr)); // unsure about this
|
||||
stmt->setUInt32(14, GameTime::GetGameTime()); // 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 = time(nullptr);
|
||||
playerPetData->Timediff = GameTime::GetGameTime();
|
||||
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 <= time(nullptr))
|
||||
if (!IsHunterPet() || m_corpseRemoveTime <= GameTime::GetGameTime())
|
||||
{
|
||||
Remove(PET_SAVE_DISMISS); //hunters' pets never get removed because of death, NEVER!
|
||||
return;
|
||||
|
||||
@@ -280,7 +280,7 @@ Player::Player(WorldSession* session): Unit(true)
|
||||
m_bgBattlegroundQueueID[j].invitedToInstance = 0;
|
||||
}
|
||||
|
||||
m_logintime = time(nullptr);
|
||||
m_logintime = GameTime::GetGameTime();
|
||||
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 = time(nullptr);
|
||||
m_lastHonorUpdateTime = GameTime::GetGameTime();
|
||||
|
||||
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 = time(nullptr);
|
||||
m_Last_tick = GameTime::GetGameTime();
|
||||
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 <= time(nullptr))
|
||||
if (m_nextMailDelivereTime && m_nextMailDelivereTime <= GameTime::GetGameTime())
|
||||
{
|
||||
SendNewMail();
|
||||
++unReadMails;
|
||||
@@ -1061,7 +1061,7 @@ void Player::Update(uint32 p_time)
|
||||
Unit::Update(p_time);
|
||||
SetCanDelayTeleport(false);
|
||||
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
|
||||
UpdatePvPFlag(now);
|
||||
|
||||
@@ -1202,7 +1202,7 @@ void Player::Update(uint32 p_time)
|
||||
{
|
||||
if (roll_chance_i(3) && _restTime > 0) // freeze update
|
||||
{
|
||||
time_t currTime = time(nullptr);
|
||||
time_t currTime = GameTime::GetGameTime();
|
||||
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 = time(nullptr);
|
||||
time_t cTime = GameTime::GetGameTime();
|
||||
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 <= time(nullptr)) // ready now
|
||||
if (deliver_time <= GameTime::GetGameTime()) // 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(time(nullptr));
|
||||
SetTalentResetTime(GameTime::GetGameTime());
|
||||
}
|
||||
|
||||
/* 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(time(nullptr) - time_t(keepDays * DAY)));
|
||||
stmt->setUInt32(0, uint32(GameTime::GetGameTime() - 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 = time_t(time(nullptr));
|
||||
time_t today = time_t(time(nullptr) / DAY) * DAY;
|
||||
time_t now = time_t(GameTime::GetGameTime());
|
||||
time_t today = time_t(GameTime::GetGameTime() / 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(time(nullptr) + timer));
|
||||
SendUpdateWorldState(ClockWorldState[1], uint32(GameTime::GetGameTime() + 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(time(nullptr) + timer) : 0));
|
||||
SendUpdateWorldState(TB_WS_TIME_NEXT_BATTLE, uint32(!tb->IsWarTime() ? uint32(time(nullptr) + timer) : 0));
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 = time(nullptr);
|
||||
time_t base = GameTime::GetGameTime();
|
||||
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>(time(nullptr)) + timeAllowed;
|
||||
qtime = static_cast<uint32>(GameTime::GetGameTime()) + timeAllowed;
|
||||
}
|
||||
else
|
||||
questStatusData.Timer = 0;
|
||||
@@ -17901,7 +17901,7 @@ bool Player::LoadFromDB(ObjectGuid guid, SQLQueryHolder* holder)
|
||||
|
||||
SaveRecallPosition();
|
||||
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
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 = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
|
||||
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(time(nullptr)));
|
||||
stmt->setUInt32(index++, uint32(GameTime::GetGameTime()));
|
||||
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(time(nullptr)));
|
||||
stmt->setUInt32(index++, uint32(GameTime::GetGameTime()));
|
||||
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 = time(nullptr);
|
||||
time_t current = GameTime::GetGameTime();
|
||||
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 = time(nullptr); // start toggle-off
|
||||
pvpInfo.EndTimer = GameTime::GetGameTime(); // start toggle-off
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23015,7 +23015,7 @@ void Player::UpdatePvP(bool state, bool _override)
|
||||
}
|
||||
else
|
||||
{
|
||||
pvpInfo.EndTimer = time(nullptr);
|
||||
pvpInfo.EndTimer = GameTime::GetGameTime();
|
||||
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 = time(nullptr); // last daily quest time
|
||||
m_lastDailyQuestTime = GameTime::GetGameTime(); // last daily quest time
|
||||
m_DailyQuestChanged = true;
|
||||
break;
|
||||
}
|
||||
@@ -24727,7 +24727,7 @@ void Player::UpdateVisibleGameobjectsOrSpellClicks()
|
||||
|
||||
bool Player::HasSummonPending() const
|
||||
{
|
||||
return m_summon_expire >= time(nullptr);
|
||||
return m_summon_expire >= GameTime::GetGameTime();
|
||||
}
|
||||
|
||||
void Player::SendSummonRequestFrom(Unit* summoner)
|
||||
@@ -24743,7 +24743,7 @@ void Player::SendSummonRequestFrom(Unit* summoner)
|
||||
if (HasAura(23445))
|
||||
return;
|
||||
|
||||
m_summon_expire = time(nullptr) + MAX_PLAYER_SUMMON_DELAY;
|
||||
m_summon_expire = GameTime::GetGameTime() + 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 < time(nullptr))
|
||||
if (m_summon_expire < GameTime::GetGameTime())
|
||||
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 = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
// 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 = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
|
||||
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 = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
|
||||
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(time(nullptr))); // cast can't be helped in this case
|
||||
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime())); // 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 = time(nullptr);
|
||||
_restTime = GameTime::GetGameTime();
|
||||
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
|
||||
}
|
||||
|
||||
|
||||
@@ -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(time(nullptr))); // cast can't be helped
|
||||
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime())); // 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(time(nullptr));
|
||||
SetLastDamagedTime(GameTime::GetGameTime());
|
||||
}
|
||||
|
||||
bool Unit::IsHighestExclusiveAura(Aura const* aura, bool removeOtherAuraApplications /*= false*/)
|
||||
|
||||
@@ -47,7 +47,7 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
|
||||
default:
|
||||
case GAMEEVENT_NORMAL:
|
||||
{
|
||||
time_t currenttime = time(nullptr);
|
||||
time_t currenttime = GameTime::GetGameTime();
|
||||
// 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 = time(nullptr);
|
||||
time_t currenttime = GameTime::GetGameTime();
|
||||
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 = time(nullptr);
|
||||
time_t currenttime = GameTime::GetGameTime();
|
||||
|
||||
// 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 = time(nullptr);
|
||||
mGameEvent[event_id].start = GameTime::GetGameTime();
|
||||
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, time(nullptr));
|
||||
sWorld->setWorldState(event_id, GameTime::GetGameTime());
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -187,7 +187,7 @@ void GameEventMgr::StopEvent(uint16 event_id, bool overwrite)
|
||||
|
||||
if (overwrite && !serverwide_evt)
|
||||
{
|
||||
data.start = time(nullptr) - data.length * MINUTE;
|
||||
data.start = GameTime::GetGameTime() - 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 = time(nullptr);
|
||||
time_t currenttime = GameTime::GetGameTime();
|
||||
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 = time(nullptr);
|
||||
time_t currenttime = GameTime::GetGameTime();
|
||||
mGameEvent[event_id].nextstart = currenttime + mGameEvent[event_id].length * 60;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "DisableMgr.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameObjectAIFactory.h"
|
||||
#include "GameTime.h"
|
||||
#include "GossipDef.h"
|
||||
#include "GroupMgr.h"
|
||||
#include "GuildMgr.h"
|
||||
@@ -6196,7 +6197,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
time_t curTime = time(nullptr);
|
||||
time_t curTime = GameTime::GetGameTime();
|
||||
tm lt;
|
||||
localtime_r(&curTime, <);
|
||||
uint64 basetime(curTime);
|
||||
@@ -10455,3 +10456,14 @@ 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();
|
||||
}
|
||||
@@ -1556,16 +1556,7 @@ class TC_GAME_API ObjectMgr
|
||||
|
||||
void LoadHotfixData();
|
||||
HotfixData const& GetHotfixData() const { return _hotfixData; }
|
||||
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);
|
||||
}
|
||||
time_t GetHotfixDate(uint32 entry, uint32 type) const;
|
||||
|
||||
void LoadMissingKeyChains();
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "Chat.h"
|
||||
#include "Config.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "GuildFinderMgr.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "Language.h"
|
||||
@@ -179,6 +180,8 @@ 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.
|
||||
@@ -244,7 +247,7 @@ void Guild::EventLogEntry::WritePacket(WorldPacket& data, ByteBuffer& content) c
|
||||
content.WriteByteSeq(guid1[4]);
|
||||
|
||||
// Event timestamp
|
||||
content << uint32(::time(nullptr) - m_timestamp);
|
||||
content << uint32(::GameTime::GetGameTime() - m_timestamp);
|
||||
|
||||
content.WriteByteSeq(guid1[7]);
|
||||
content.WriteByteSeq(guid1[3]);
|
||||
@@ -326,7 +329,7 @@ void Guild::BankEventLogEntry::WritePacket(WorldPacket& data, ByteBuffer& conten
|
||||
if (hasItem)
|
||||
content << uint32(m_itemOrMoney);
|
||||
|
||||
content << uint32(time(nullptr) - m_timestamp);
|
||||
content << uint32(GameTime::GetGameTime() - m_timestamp);
|
||||
|
||||
if (IsMoneyEvent())
|
||||
content << uint64(m_itemOrMoney);
|
||||
@@ -664,7 +667,7 @@ Guild::Member::Member(ObjectGuid::LowType guildId, ObjectGuid guid, uint8 rankId
|
||||
m_level(0),
|
||||
m_class(0),
|
||||
m_flags(GUILDMEMBER_STATUS_NONE),
|
||||
m_logoutTime(::time(nullptr)),
|
||||
m_logoutTime(::GameTime::GetGameTime()),
|
||||
m_accountId(0),
|
||||
m_rankId(rankId),
|
||||
m_achievementPoints(0),
|
||||
@@ -750,6 +753,11 @@ 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);
|
||||
@@ -1332,7 +1340,7 @@ bool Guild::Create(Player* pLeader, std::string const& name)
|
||||
m_info = "";
|
||||
m_motd = "No message set.";
|
||||
m_bankMoney = 0;
|
||||
m_createdDate = ::time(nullptr);
|
||||
m_createdDate = ::GameTime::GetGameTime();
|
||||
_level = 1;
|
||||
_experience = 0;
|
||||
_todayExperience = 0;
|
||||
@@ -1577,7 +1585,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(::time(nullptr) - member->GetLogoutTime()) / DAY);
|
||||
memberData << float(member->IsOnline() ? 0.0f : float(::GameTime::GetGameTime() - member->GetLogoutTime()) / DAY);
|
||||
|
||||
if (offNoteLength)
|
||||
memberData.WriteString(member->GetOfficerNote());
|
||||
@@ -3071,7 +3079,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(::time(nullptr)));
|
||||
stmt->setUInt64(3, uint32(::GameTime::GetGameTime()));
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
delete member;
|
||||
|
||||
@@ -387,7 +387,7 @@ private:
|
||||
|
||||
void ChangeRank(SQLTransaction& trans, uint8 newRank);
|
||||
|
||||
inline void UpdateLogoutTime() { m_logoutTime = ::time(nullptr); }
|
||||
inline void UpdateLogoutTime();
|
||||
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) : m_guildId(guildId), m_guid(guid), m_timestamp(::time(nullptr)) { }
|
||||
LogEntry(ObjectGuid::LowType guildId, uint32 guid);
|
||||
LogEntry(ObjectGuid::LowType guildId, uint32 guid, time_t timestamp) : m_guildId(guildId), m_guid(guid), m_timestamp(timestamp) { }
|
||||
virtual ~LogEntry() { }
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "CharacterCache.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GameTime.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "Log.h"
|
||||
@@ -26,7 +27,7 @@
|
||||
#include "Player.h"
|
||||
#include "World.h"
|
||||
|
||||
MembershipRequest::MembershipRequest() : _guildId(0), _availability(0), _classRoles(0), _interests(0), _time(time(nullptr))
|
||||
MembershipRequest::MembershipRequest() : _guildId(0), _availability(0), _classRoles(0), _interests(0), _time(GameTime::GetGameTime())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "GuildMgr.h"
|
||||
#include "AchievementMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Guild.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -587,7 +588,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(time(nullptr) - time_t(30 * DAY)));
|
||||
stmt->setUInt32(0, uint32(GameTime::GetGameTime() - time_t(30 * DAY)));
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
// Reset week reputation for old guild member
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "Creature.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStructure.h"
|
||||
#include "GameTime.h"
|
||||
#include "Item.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
@@ -332,7 +333,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
AH->bidder = 0;
|
||||
AH->bid = 0;
|
||||
AH->buyout = buyout;
|
||||
AH->expire_time = time(nullptr) + auctionTime;
|
||||
AH->expire_time = GameTime::GetGameTime() + auctionTime;
|
||||
AH->deposit = deposit;
|
||||
AH->etime = etime;
|
||||
AH->auctionHouseEntry = auctionHouseEntry;
|
||||
@@ -389,7 +390,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
AH->bidder = 0;
|
||||
AH->bid = 0;
|
||||
AH->buyout = buyout;
|
||||
AH->expire_time = time(nullptr) + auctionTime;
|
||||
AH->expire_time = GameTime::GetGameTime() + auctionTime;
|
||||
AH->deposit = deposit;
|
||||
AH->etime = etime;
|
||||
AH->auctionHouseEntry = auctionHouseEntry;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "WorldSession.h"
|
||||
#include "Battlefield.h"
|
||||
#include "BattlefieldMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "Log.h"
|
||||
#include "Object.h"
|
||||
#include "Opcodes.h"
|
||||
@@ -53,7 +54,7 @@ void WorldSession::SendBfInvitePlayerToWar(ObjectGuid guid, uint32 zoneId, uint3
|
||||
data.WriteByteSeq(guid[4]);
|
||||
data.WriteByteSeq(guid[2]);
|
||||
data.WriteByteSeq(guid[0]);
|
||||
data << uint32(time(nullptr) + acceptTime); // Invite lasts until
|
||||
data << uint32(GameTime::GetGameTime() + acceptTime); // Invite lasts until
|
||||
data.WriteByteSeq(guid[7]);
|
||||
data.WriteByteSeq(guid[5]);
|
||||
SendPacket(&data);
|
||||
|
||||
@@ -41,6 +41,7 @@ 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"
|
||||
@@ -58,7 +59,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 = time(nullptr);
|
||||
time_t currTime = GameTime::GetGameTime();
|
||||
|
||||
WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 1000); // Average size if no instance
|
||||
|
||||
@@ -243,7 +244,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) < (time(nullptr) - time_t(86400L)))
|
||||
if (time_t(eventPackedTime) < (GameTime::GetGameTime() - time_t(86400L)))
|
||||
{
|
||||
recvData.rfinish();
|
||||
return;
|
||||
@@ -336,7 +337,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) < (time(nullptr) - time_t(86400L)))
|
||||
if (time_t(eventPackedTime) < (GameTime::GetGameTime() - time_t(86400L)))
|
||||
{
|
||||
recvData.rfinish();
|
||||
return;
|
||||
@@ -393,7 +394,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) < (time(nullptr) - time_t(86400L)))
|
||||
if (time_t(eventTime) < (GameTime::GetGameTime() - time_t(86400L)))
|
||||
{
|
||||
recvData.rfinish();
|
||||
return;
|
||||
@@ -536,7 +537,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, time(nullptr), status, CALENDAR_RANK_PLAYER, "");
|
||||
CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), eventId, guid, guid, GameTime::GetGameTime(), status, CALENDAR_RANK_PLAYER, "");
|
||||
sCalendarMgr->AddInvite(calendarEvent, invite);
|
||||
sCalendarMgr->SendCalendarClearPendingAction(guid);
|
||||
}
|
||||
@@ -568,7 +569,7 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData)
|
||||
if (CalendarInvite* invite = sCalendarMgr->GetInvite(inviteId))
|
||||
{
|
||||
invite->SetStatus(CalendarInviteStatus(status));
|
||||
invite->SetStatusTime(time(nullptr));
|
||||
invite->SetStatusTime(GameTime::GetGameTime());
|
||||
|
||||
sCalendarMgr->UpdateInvite(invite);
|
||||
sCalendarMgr->SendCalendarEventStatus(*calendarEvent, *invite);
|
||||
@@ -631,7 +632,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(time(nullptr));
|
||||
//invite->SetStatusTime(GameTime::GetGameTime());
|
||||
|
||||
sCalendarMgr->UpdateInvite(invite);
|
||||
sCalendarMgr->SendCalendarEventStatus(*calendarEvent, *invite);
|
||||
@@ -738,7 +739,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 = time(nullptr);
|
||||
time_t currTime = GameTime::GetGameTime();
|
||||
|
||||
WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_REMOVED, (add ? 4 : 0) + 4 + 4 + 4 + 8);
|
||||
if (add)
|
||||
@@ -763,7 +764,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 = time(nullptr);
|
||||
time_t currTime = GameTime::GetGameTime();
|
||||
|
||||
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(time(nullptr)));
|
||||
stmt->setUInt64(1, uint64(GameTime::GetGameTime()));
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL_COUNT, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_MAILDATE);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Group.h"
|
||||
#include "Guild.h"
|
||||
@@ -213,7 +214,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
||||
|
||||
if (!sender->CanSpeak())
|
||||
{
|
||||
std::string timeStr = secsToTimeString(m_muteTime - time(nullptr));
|
||||
std::string timeStr = secsToTimeString(m_muteTime - GameTime::GetGameTime());
|
||||
SendNotification(GetTrinityString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str());
|
||||
recvData.rfinish(); // Prevent warnings
|
||||
return;
|
||||
@@ -753,7 +754,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recvData)
|
||||
|
||||
if (!GetPlayer()->CanSpeak())
|
||||
{
|
||||
std::string timeStr = secsToTimeString(m_muteTime - time(nullptr));
|
||||
std::string timeStr = secsToTimeString(m_muteTime - GameTime::GetGameTime());
|
||||
SendNotification(GetTrinityString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "GameTime.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "Log.h"
|
||||
@@ -43,7 +44,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 = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
player->duel->startTimer = now;
|
||||
plTarget->duel->startTimer = now;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "WorldSession.h"
|
||||
#include "AchievementMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildFinderMgr.h"
|
||||
#include "GuildMgr.h"
|
||||
@@ -74,7 +75,7 @@ void WorldSession::HandleGuildFinderAddRecruit(WorldPacket& recvPacket)
|
||||
if (!(guildInterests & ALL_INTERESTS) || guildInterests > ALL_INTERESTS)
|
||||
return;
|
||||
|
||||
MembershipRequest request = MembershipRequest(GetPlayer()->GetGUID(), guildLowGuid, availability, classRoles, guildInterests, comment, time(nullptr));
|
||||
MembershipRequest request = MembershipRequest(GetPlayer()->GetGUID(), guildLowGuid, availability, classRoles, guildInterests, comment, GameTime::GetGameTime());
|
||||
sGuildFinderMgr->AddMembershipRequest(guildLowGuid, request);
|
||||
}
|
||||
|
||||
@@ -246,7 +247,7 @@ void WorldSession::HandleGuildFinderGetApplications(WorldPacket& /*recvPacket*/)
|
||||
bufferData.WriteString(guild->GetName());
|
||||
|
||||
bufferData << uint32(guildSettings.GetAvailability());
|
||||
bufferData << uint32(request.GetExpiryTime() - time(nullptr)); // Time left to application expiry (seconds)
|
||||
bufferData << uint32(request.GetExpiryTime() - GameTime::GetGameTime()); // Time left to application expiry (seconds)
|
||||
|
||||
bufferData.WriteByteSeq(guildGuid[0]);
|
||||
bufferData.WriteByteSeq(guildGuid[6]);
|
||||
@@ -258,7 +259,7 @@ void WorldSession::HandleGuildFinderGetApplications(WorldPacket& /*recvPacket*/)
|
||||
bufferData.WriteByteSeq(guildGuid[4]);
|
||||
bufferData.WriteByteSeq(guildGuid[1]);
|
||||
|
||||
bufferData << uint32(time(nullptr) - request.GetSubmitTime()); // Time since application (seconds)
|
||||
bufferData << uint32(GameTime::GetGameTime() - request.GetSubmitTime()); // Time since application (seconds)
|
||||
bufferData << uint32(guildSettings.GetInterests());
|
||||
}
|
||||
|
||||
@@ -307,7 +308,7 @@ void WorldSession::HandleGuildFinderGetRecruits(WorldPacket& recvPacket)
|
||||
|
||||
dataBuffer.WriteByteSeq(playerGuid[4]);
|
||||
|
||||
dataBuffer << int32(time(nullptr) <= request.GetExpiryTime());
|
||||
dataBuffer << int32(GameTime::GetGameTime() <= request.GetExpiryTime());
|
||||
|
||||
dataBuffer.WriteByteSeq(playerGuid[3]);
|
||||
dataBuffer.WriteByteSeq(playerGuid[0]);
|
||||
@@ -319,11 +320,11 @@ void WorldSession::HandleGuildFinderGetRecruits(WorldPacket& recvPacket)
|
||||
dataBuffer.WriteByteSeq(playerGuid[7]);
|
||||
dataBuffer.WriteByteSeq(playerGuid[2]);
|
||||
|
||||
dataBuffer << int32(time(nullptr) - request.GetSubmitTime()); // Time in seconds since application submitted.
|
||||
dataBuffer << int32(GameTime::GetGameTime() - request.GetSubmitTime()); // Time in seconds since application submitted.
|
||||
dataBuffer << int32(request.GetAvailability());
|
||||
dataBuffer << int32(request.GetClassRoles());
|
||||
dataBuffer << int32(request.GetInterests());
|
||||
dataBuffer << int32(request.GetExpiryTime() - time(nullptr)); // TIme in seconds until application expires.
|
||||
dataBuffer << int32(request.GetExpiryTime() - GameTime::GetGameTime()); // TIme in seconds until application expires.
|
||||
|
||||
dataBuffer.WriteString(request.GetName());
|
||||
dataBuffer.WriteString(request.GetComment());
|
||||
@@ -335,7 +336,7 @@ void WorldSession::HandleGuildFinderGetRecruits(WorldPacket& recvPacket)
|
||||
|
||||
data.FlushBits();
|
||||
data.append(dataBuffer);
|
||||
data << uint32(time(nullptr)); // Unk time
|
||||
data << uint32(GameTime::GetGameTime()); // Unk time
|
||||
|
||||
player->SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "AchievementMgr.h"
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "Log.h"
|
||||
@@ -780,7 +781,7 @@ void WorldSession::HandleGuildRewardsQueryOpcode(WorldPacket& recvPacket)
|
||||
data << uint32(0); // Unused
|
||||
data << uint32(rewards[i].AchievementId);
|
||||
}
|
||||
data << uint32(time(nullptr));
|
||||
data << uint32(GameTime::GetGameTime());
|
||||
SendPacket(&data);
|
||||
}
|
||||
}
|
||||
@@ -1038,7 +1039,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 = time(nullptr);
|
||||
time_t thisTime = GameTime::GetGameTime();
|
||||
if (pGuild->GetChallengesMgr()->CompletedFirstChallenge(pGuild->GetId()) && pGuild->GetChallengesMgr()->GetFirstCompletedChallengeTime(pGuild->GetId()) + WEEK <= thisTime)
|
||||
pGuild->GetChallengesMgr()->ResetWeeklyChallenges();
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "LFGMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "LFGPackets.h"
|
||||
#include "Log.h"
|
||||
@@ -542,7 +543,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 - time(nullptr)) / 1000);
|
||||
int32 secsleft = int32((boot.cancelTime - GameTime::GetGameTime()) / 1000);
|
||||
for (const auto& vote : boot.votes)
|
||||
{
|
||||
if (vote.second != lfg::LFG_ANSWER_PENDING)
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "CharacterCache.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GameTime.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "Item.h"
|
||||
@@ -460,7 +461,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket& recvData)
|
||||
|
||||
Player* player = _player;
|
||||
Mail* m = player->GetMail(mailId);
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(nullptr))
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime())
|
||||
{
|
||||
player->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
@@ -519,7 +520,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
|
||||
Player* player = _player;
|
||||
|
||||
Mail* m = player->GetMail(mailId);
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(nullptr))
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime())
|
||||
{
|
||||
player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
@@ -623,7 +624,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket& recvData)
|
||||
Player* player = _player;
|
||||
|
||||
Mail* m = player->GetMail(mailId);
|
||||
if ((!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(nullptr)) ||
|
||||
if ((!m || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime()) ||
|
||||
(money > 0 && m->money != money))
|
||||
{
|
||||
player->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||
@@ -673,7 +674,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 = time(nullptr);
|
||||
time_t cur_time = GameTime::GetGameTime();
|
||||
|
||||
for (PlayerMails::iterator itr = player->GetMailBegin(); itr != player->GetMailEnd(); ++itr)
|
||||
{
|
||||
@@ -720,7 +721,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-time(nullptr))/DAY); // Time
|
||||
data << float(float((*itr)->expire_time-GameTime::GetGameTime())/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
|
||||
@@ -785,7 +786,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 > time(nullptr) || (m->checked & MAIL_CHECK_MASK_COPIED))
|
||||
if (!m || (m->body.empty() && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime() || (m->checked & MAIL_CHECK_MASK_COPIED))
|
||||
{
|
||||
player->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
@@ -847,7 +848,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket& /*recvData*/)
|
||||
data << uint32(0); // count
|
||||
|
||||
uint32 count = 0;
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
std::set<uint32> sentSenders;
|
||||
for (PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr)
|
||||
{
|
||||
|
||||
@@ -401,7 +401,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recvData*/)
|
||||
GetPlayer()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
|
||||
}
|
||||
|
||||
LogoutRequest(time(nullptr));
|
||||
LogoutRequest(GameTime::GetGameTime());
|
||||
}
|
||||
|
||||
void WorldSession::HandlePlayerLogoutOpcode(WorldPacket& /*recvData*/)
|
||||
@@ -462,7 +462,7 @@ void WorldSession::HandleTogglePvP(WorldPacket& recvData)
|
||||
else
|
||||
{
|
||||
if (!GetPlayer()->pvpInfo.IsHostile && GetPlayer()->IsPvP())
|
||||
GetPlayer()->pvpInfo.EndTimer = time(nullptr); // start toggle-off
|
||||
GetPlayer()->pvpInfo.EndTimer = GameTime::GetGameTime(); // 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(time(nullptr)))
|
||||
if (time_t(corpse->GetGhostTime() + _player->GetCorpseReclaimDelay(corpse->GetType() == CORPSE_RESURRECTABLE_PVP)) > time_t(GameTime::GetGameTime()))
|
||||
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(time(nullptr));
|
||||
data << uint32(GameTime::GetGameTime());
|
||||
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(time(nullptr));
|
||||
data << uint32(GameTime::GetGameTime());
|
||||
data << uint32(0);
|
||||
SendPacket(&data);
|
||||
continue;
|
||||
|
||||
@@ -179,7 +179,7 @@ void WorldSession::HandleMoveWorldportAck()
|
||||
{
|
||||
if (time_t timeReset = sInstanceSaveMgr->GetResetTimeFor(mEntry->ID, diff))
|
||||
{
|
||||
uint32 timeleft = uint32(timeReset - time(nullptr));
|
||||
uint32 timeleft = uint32(timeReset - GameTime::GetGameTime());
|
||||
GetPlayer()->SendInstanceResetWarning(mEntry->ID, diff, timeleft, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -693,7 +693,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData)
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(nullptr))); // cast can't be helped
|
||||
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime())); // cast can't be helped
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetAbandon(WorldPacket& recvData)
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GameTime.h"
|
||||
#include "Log.h"
|
||||
#include "MapManager.h"
|
||||
#include "NPCHandler.h"
|
||||
@@ -83,8 +84,8 @@ void WorldSession::HandleQueryTimeOpcode(WorldPacket & /*recvData*/)
|
||||
void WorldSession::SendQueryTimeResponse()
|
||||
{
|
||||
WorldPacket data(SMSG_QUERY_TIME_RESPONSE, 4+4);
|
||||
data << uint32(time(nullptr));
|
||||
data << uint32(sWorld->GetNextDailyQuestsResetTime() - time(nullptr));
|
||||
data << uint32(GameTime::GetGameTime());
|
||||
data << uint32(sWorld->GetNextDailyQuestsResetTime() - GameTime::GetGameTime());
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "WorldSession.h"
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -251,7 +252,7 @@ void WorldSession::HandleReportLag(WorldPacket& recvData)
|
||||
stmt->setFloat (4, y);
|
||||
stmt->setFloat (5, z);
|
||||
stmt->setUInt32(6, GetLatency());
|
||||
stmt->setUInt32(7, time(nullptr));
|
||||
stmt->setUInt32(7, GameTime::GetGameTime());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "Config.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridStates.h"
|
||||
#include "Group.h"
|
||||
@@ -105,7 +106,7 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance
|
||||
resetTime = GetResetTimeFor(mapId, difficulty);
|
||||
else
|
||||
{
|
||||
resetTime = time(nullptr) + 2 * HOUR;
|
||||
resetTime = GameTime::GetGameTime() + 2 * HOUR;
|
||||
// normally this will be removed soon after in InstanceMap::Add, prevent error
|
||||
ScheduleReset(true, resetTime, InstResetEvent(0, mapId, difficulty, instanceId));
|
||||
}
|
||||
@@ -300,7 +301,7 @@ void InstanceSaveManager::LoadInstances()
|
||||
|
||||
void InstanceSaveManager::LoadResetTimes()
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
time_t today = (now / DAY) * DAY;
|
||||
|
||||
// NOTE: Use DirectPExecute for tables that will be queried later
|
||||
@@ -511,12 +512,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, time(nullptr));
|
||||
_ResetOrWarnAll(mapId, difficulty, false, GameTime::GetGameTime());
|
||||
}
|
||||
|
||||
void InstanceSaveManager::Update()
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
time_t t;
|
||||
|
||||
while (!m_resetTimeQueue.empty())
|
||||
@@ -633,7 +634,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 = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
|
||||
if (!warn)
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "CalendarMgr.h"
|
||||
#include "CharacterCache.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Item.h"
|
||||
#include "Log.h"
|
||||
#include "LootMgr.h"
|
||||
@@ -190,7 +191,7 @@ void MailDraft::SendMailTo(SQLTransaction& trans, MailReceiver const& receiver,
|
||||
|
||||
uint32 mailId = sObjectMgr->GenerateMailID();
|
||||
|
||||
time_t deliver_time = time(nullptr) + deliver_delay;
|
||||
time_t deliver_time = GameTime::GetGameTime() + deliver_delay;
|
||||
|
||||
//expire time if COD 3 days, if no COD 30 days, if auction sale pending 1 hour
|
||||
uint32 expire_delay;
|
||||
|
||||
@@ -3875,7 +3875,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
|
||||
|
||||
// increase current instances (hourly limit)
|
||||
if (!group || !group->isLFGGroup())
|
||||
player->AddInstanceEnterTime(GetInstanceId(), time(nullptr));
|
||||
player->AddInstanceEnterTime(GetInstanceId(), GameTime::GetGameTime());
|
||||
|
||||
// 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 = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
|
||||
std::vector<ObjectGuid> corpses;
|
||||
corpses.reserve(_corpsesByPlayer.size());
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "PacketLog.h"
|
||||
#include "Config.h"
|
||||
#include "GameTime.h"
|
||||
#include "IpAddress.h"
|
||||
#include "Timer.h"
|
||||
#include "WorldPacket.h"
|
||||
@@ -96,7 +97,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 = time(nullptr);
|
||||
header.SniffStartUnixtime = GameTime::GetGameTime();
|
||||
header.SniffStartTicks = getMSTime();
|
||||
header.OptionalDataSize = 0;
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "Common.h"
|
||||
#include "Config.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
@@ -242,13 +243,13 @@ void WorldSession::SendPacket(WorldPacket const* packet, bool forced /*= false*/
|
||||
static uint64 sendPacketCount = 0;
|
||||
static uint64 sendPacketBytes = 0;
|
||||
|
||||
static time_t firstTime = time(nullptr);
|
||||
static time_t firstTime = GameTime::GetGameTime();
|
||||
static time_t lastTime = firstTime; // next 60 secs start time
|
||||
|
||||
static uint64 sendLastPacketCount = 0;
|
||||
static uint64 sendLastPacketBytes = 0;
|
||||
|
||||
time_t cur_time = time(nullptr);
|
||||
time_t cur_time = GameTime::GetGameTime();
|
||||
|
||||
if ((cur_time - lastTime) < 60)
|
||||
{
|
||||
@@ -319,7 +320,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
||||
bool deletePacket = true;
|
||||
std::vector<WorldPacket*> requeuePackets;
|
||||
uint32 processedPackets = 0;
|
||||
time_t currentTime = time(nullptr);
|
||||
time_t currentTime = GameTime::GetGameTime();
|
||||
|
||||
while (m_Socket && _recvQueue.next(packet, updater))
|
||||
{
|
||||
@@ -455,9 +456,8 @@ 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(currTime) && !m_playerLoading)
|
||||
if (ShouldLogOut(currentTime) && !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(time(nullptr)); // Server time
|
||||
data << uint32(GameTime::GetGameTime()); // Server time
|
||||
data << uint8(1);
|
||||
data << uint32(mask); // type mask
|
||||
for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "BattlenetAccountMgr.h"
|
||||
#include "BigNumber.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "IPLocation.h"
|
||||
#include "Opcodes.h"
|
||||
#include "PacketLog.h"
|
||||
@@ -643,7 +644,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 = time(nullptr) + llabs(mutetime);
|
||||
mutetime = GameTime::GetGameTime() + llabs(mutetime);
|
||||
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME_LOGIN);
|
||||
stmt->setInt64(0, mutetime);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "Archaeology.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GameTime.h"
|
||||
#include "Log.h"
|
||||
#include "Player.h"
|
||||
|
||||
@@ -190,11 +191,11 @@ void Archaeology::CompleteProject(uint16 projectId)
|
||||
|
||||
if (_completedProjects.find(projectId) == _completedProjects.end())
|
||||
{
|
||||
_completedProjects[projectId].first = time(nullptr);
|
||||
_completedProjects[projectId].first = GameTime::GetGameTime();
|
||||
_completedProjects[projectId].second = 1;
|
||||
|
||||
CharacterDatabase.PExecute("REPLACE INTO character_archaeology_completed VALUES (%u, %u, %u, 1);",
|
||||
_player->GetGUID(), projectId, time(nullptr));
|
||||
_player->GetGUID(), projectId, GameTime::GetGameTime());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -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(time(nullptr)),
|
||||
m_castItemGuid(castItem ? castItem->GetGUID() : ObjectGuid::Empty), m_applyTime(GameTime::GetGameTime()),
|
||||
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),
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "Chat.h"
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectAccessor.h"
|
||||
@@ -30,7 +31,7 @@
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
inline float GetAge(uint64 t) { return float(time(nullptr) - t) / DAY; }
|
||||
inline float GetAge(uint64 t) { return float(GameTime::GetGameTime() - t) / DAY; }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// GM ticket
|
||||
@@ -38,7 +39,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(time(nullptr)), _lastModifiedTime(time(nullptr)),
|
||||
GmTicket::GmTicket(Player* player) : _type(TICKET_TYPE_OPEN), _posX(0), _posY(0), _posZ(0), _mapId(0), _createTime(GameTime::GetGameTime()), _lastModifiedTime(GameTime::GetGameTime()),
|
||||
_completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false),
|
||||
_needResponse(false), _needMoreHelp(false)
|
||||
{
|
||||
@@ -178,7 +179,7 @@ void GmTicket::SendResponse(WorldSession* session) const
|
||||
|
||||
std::string GmTicket::FormatMessageString(ChatHandler& handler, bool detailed) const
|
||||
{
|
||||
time_t curTime = time(nullptr);
|
||||
time_t curTime = GameTime::GetGameTime();
|
||||
|
||||
std::stringstream ss;
|
||||
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTGUID, _id);
|
||||
@@ -219,6 +220,12 @@ 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();
|
||||
@@ -269,7 +276,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(time(nullptr)) { }
|
||||
_lastChange(GameTime::GetGameTime()) { }
|
||||
|
||||
TicketMgr::~TicketMgr()
|
||||
{
|
||||
@@ -412,6 +419,11 @@ 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);
|
||||
|
||||
@@ -123,11 +123,7 @@ 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)
|
||||
{
|
||||
_message = message;
|
||||
_lastModifiedTime = uint64(time(nullptr));
|
||||
}
|
||||
void SetMessage(std::string const& message);
|
||||
void SetComment(std::string const& comment) { _comment = comment; }
|
||||
void SetViewed() { _viewed = true; }
|
||||
void SetUnassigned();
|
||||
@@ -224,7 +220,7 @@ public:
|
||||
void SetStatus(bool status) { _status = status; }
|
||||
|
||||
uint64 GetLastChange() const { return _lastChange; }
|
||||
void UpdateLastChange() { _lastChange = uint64(time(nullptr)); }
|
||||
void UpdateLastChange();
|
||||
|
||||
uint32 GenerateTicketId() { return ++_lastTicketId; }
|
||||
uint32 GetOpenTicketCount() const { return _openTicketCount; }
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
|
||||
namespace GameTime
|
||||
{
|
||||
time_t const StartTime = time(nullptr);
|
||||
time_t const StartTime = GameTime::GetGameTime();
|
||||
|
||||
time_t GameTime = 0;
|
||||
time_t GameTime = time(nullptr);
|
||||
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 = time(nullptr);
|
||||
GameTime = GameTime::GetGameTime();
|
||||
GameMSTime = getMSTime();
|
||||
GameTimeSystemPoint = std::chrono::system_clock::now();
|
||||
GameTimeSteadyPoint = std::chrono::steady_clock::now();
|
||||
|
||||
@@ -141,7 +141,7 @@ World::World()
|
||||
_guidWarn = false;
|
||||
_guidAlert = false;
|
||||
_warnDiff = 0;
|
||||
_warnShutdownTime = time(nullptr);
|
||||
_warnShutdownTime = GameTime::GetGameTime();
|
||||
}
|
||||
|
||||
/// 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, time(nullptr)) < tolerance)
|
||||
if (difftime(i->second, GameTime::GetGameTime()) < 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)time(nullptr));
|
||||
srand((unsigned int)GameTime::GetGameTime());
|
||||
|
||||
///- 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()] = time(nullptr);
|
||||
m_disconnects[itr->second->GetAccountId()] = GameTime::GetGameTime();
|
||||
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 = time(nullptr);
|
||||
time_t curtime = GameTime::GetGameTime();
|
||||
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 = time(nullptr);
|
||||
time_t curTime = GameTime::GetGameTime();
|
||||
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 = time(nullptr);
|
||||
time_t curtime = GameTime::GetGameTime();
|
||||
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(time(nullptr)); // game time not yet init
|
||||
m_NextRandomBGReset = time_t(GameTime::GetGameTime()); // game time not yet init
|
||||
|
||||
// generate time by config
|
||||
time_t curTime = time(nullptr);
|
||||
time_t curTime = GameTime::GetGameTime();
|
||||
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(time(nullptr)); // game time not yet init
|
||||
m_NextGuildReset = time_t(GameTime::GetGameTime()); // game time not yet init
|
||||
|
||||
// generate time by config
|
||||
time_t curTime = time(nullptr);
|
||||
time_t curTime = GameTime::GetGameTime();
|
||||
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(time(nullptr)); // game time not yet init
|
||||
m_NextCurrencyReset = time_t(GameTime::GetGameTime()); // game time not yet init
|
||||
|
||||
// generate time by config
|
||||
time_t curTime = time(nullptr);
|
||||
time_t curTime = GameTime::GetGameTime();
|
||||
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 = time(nullptr);
|
||||
time_t curTime = GameTime::GetGameTime();
|
||||
tm localTm;
|
||||
localtime_r(&curTime, &localTm);
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ EndScriptData */
|
||||
#include "CharacterCache.h"
|
||||
#include "Chat.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -285,7 +286,7 @@ public:
|
||||
|
||||
time_t unbanDate = time_t(fields[3].GetUInt32());
|
||||
bool active = false;
|
||||
if (fields[2].GetBool() && (fields[1].GetUInt64() == uint64(0) || unbanDate >= time(nullptr)))
|
||||
if (fields[2].GetBool() && (fields[1].GetUInt64() == uint64(0) || unbanDate >= GameTime::GetGameTime()))
|
||||
active = true;
|
||||
bool permanent = (fields[1].GetUInt64() == uint64(0));
|
||||
std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true);
|
||||
@@ -343,7 +344,7 @@ public:
|
||||
Field* fields = result->Fetch();
|
||||
time_t unbanDate = time_t(fields[3].GetUInt32());
|
||||
bool active = false;
|
||||
if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbanDate >= time(nullptr)))
|
||||
if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbanDate >= GameTime::GetGameTime()))
|
||||
active = true;
|
||||
bool permanent = (fields[1].GetUInt32() == uint32(0));
|
||||
std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt32(), true);
|
||||
|
||||
@@ -24,6 +24,7 @@ EndScriptData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "GameTime.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
@@ -116,8 +117,8 @@ public:
|
||||
std::string endTimeStr = TimeToTimestampStr(eventData.end);
|
||||
|
||||
uint32 delay = sGameEventMgr->NextCheck(eventId);
|
||||
time_t nextTime = time(nullptr) + delay;
|
||||
std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(time(nullptr) + delay) : "-";
|
||||
time_t nextTime = GameTime::GetGameTime() + delay;
|
||||
std::string nextStr = nextTime >= eventData.start && nextTime < eventData.end ? TimeToTimestampStr(GameTime::GetGameTime() + delay) : "-";
|
||||
|
||||
std::string occurenceStr = secsToTimeString(eventData.occurence * MINUTE);
|
||||
std::string lengthStr = secsToTimeString(eventData.length * MINUTE);
|
||||
|
||||
@@ -26,6 +26,7 @@ EndScriptData */
|
||||
#include "Chat.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GameTime.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
@@ -344,7 +345,7 @@ public:
|
||||
|
||||
if (target)
|
||||
{
|
||||
int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - time(nullptr));
|
||||
int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - GameTime::GetGameTime());
|
||||
if (curRespawnDelay < 0)
|
||||
curRespawnDelay = 0;
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ EndScriptData */
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
#include "InstanceScript.h"
|
||||
@@ -85,7 +86,7 @@ public:
|
||||
for (Player::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
|
||||
{
|
||||
InstanceSave* save = itr->second.save;
|
||||
std::string timeleft = GetTimeString(save->GetResetTime() - time(nullptr));
|
||||
std::string timeleft = GetTimeString(save->GetResetTime() - GameTime::GetGameTime());
|
||||
handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_INFO, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", itr->second.extendState == EXTEND_STATE_EXPIRED ? "expired" : itr->second.extendState == EXTEND_STATE_EXTENDED ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
|
||||
counter++;
|
||||
}
|
||||
@@ -101,7 +102,7 @@ public:
|
||||
for (Group::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr)
|
||||
{
|
||||
InstanceSave* save = itr->second.save;
|
||||
std::string timeleft = GetTimeString(save->GetResetTime() - time(nullptr));
|
||||
std::string timeleft = GetTimeString(save->GetResetTime() - GameTime::GetGameTime());
|
||||
handler->PSendSysMessage(LANG_COMMAND_LIST_BIND_INFO, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", "-", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
|
||||
counter++;
|
||||
}
|
||||
@@ -144,7 +145,7 @@ public:
|
||||
InstanceSave* save = itr->second.save;
|
||||
if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficulty()))
|
||||
{
|
||||
std::string timeleft = GetTimeString(save->GetResetTime() - time(nullptr));
|
||||
std::string timeleft = GetTimeString(save->GetResetTime() - GameTime::GetGameTime());
|
||||
handler->PSendSysMessage(LANG_COMMAND_INST_UNBIND_UNBINDING, itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str());
|
||||
player->UnbindInstance(itr, Difficulty(i));
|
||||
counter++;
|
||||
|
||||
@@ -28,6 +28,7 @@ EndScriptData */
|
||||
#include "Creature.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GameTime.h"
|
||||
#include "GameObject.h"
|
||||
#include "Language.h"
|
||||
#include "MapManager.h"
|
||||
@@ -715,7 +716,7 @@ public:
|
||||
uint32 gridY = ri->gridId / MAX_NUMBER_OF_GRIDS;
|
||||
uint32 gridX = ri->gridId % MAX_NUMBER_OF_GRIDS;
|
||||
|
||||
std::string respawnTime = ri->respawnTime > time(nullptr) ? secsToTimeString(uint64(ri->respawnTime - time(nullptr)), true) : stringOverdue;
|
||||
std::string respawnTime = ri->respawnTime > GameTime::GetGameTime() ? secsToTimeString(uint64(ri->respawnTime - GameTime::GetGameTime()), true) : stringOverdue;
|
||||
handler->PSendSysMessage("%u | %u | [%02u,%02u] | %s (%u) | %s", ri->spawnId, ri->entry, gridX, gridY, GetZoneName(ri->zoneId, handler->GetSessionDbcLocale()), ri->zoneId, map->IsSpawnGroupActive(data->spawnGroupData->groupId) ? respawnTime.c_str() : "inactive");
|
||||
}
|
||||
|
||||
@@ -736,7 +737,7 @@ public:
|
||||
uint32 gridY = ri->gridId / MAX_NUMBER_OF_GRIDS;
|
||||
uint32 gridX = ri->gridId % MAX_NUMBER_OF_GRIDS;
|
||||
|
||||
std::string respawnTime = ri->respawnTime > time(nullptr) ? secsToTimeString(uint64(ri->respawnTime - time(nullptr)), true) : stringOverdue;
|
||||
std::string respawnTime = ri->respawnTime > GameTime::GetGameTime() ? secsToTimeString(uint64(ri->respawnTime - GameTime::GetGameTime()), true) : stringOverdue;
|
||||
handler->PSendSysMessage("%u | %u | [% 02u, % 02u] | %s (%u) | %s", ri->spawnId, ri->entry, gridX, gridY, GetZoneName(ri->zoneId, handler->GetSessionDbcLocale()), ri->zoneId, map->IsSpawnGroupActive(data->spawnGroupData->groupId) ? respawnTime.c_str() : "inactive");
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -1790,11 +1790,11 @@ public:
|
||||
|
||||
// Output III. LANG_PINFO_BANNED if ban exists and is applied
|
||||
if (banTime >= 0)
|
||||
handler->PSendSysMessage(LANG_PINFO_BANNED, banType.c_str(), banReason.c_str(), banTime > 0 ? secsToTimeString(banTime - time(nullptr), true).c_str() : handler->GetTrinityString(LANG_PERMANENTLY), bannedBy.c_str());
|
||||
handler->PSendSysMessage(LANG_PINFO_BANNED, banType.c_str(), banReason.c_str(), banTime > 0 ? secsToTimeString(banTime - GameTime::GetGameTime(), true).c_str() : handler->GetTrinityString(LANG_PERMANENTLY), bannedBy.c_str());
|
||||
|
||||
// Output IV. LANG_PINFO_MUTED if mute is applied
|
||||
if (muteTime > 0)
|
||||
handler->PSendSysMessage(LANG_PINFO_MUTED, muteReason.c_str(), secsToTimeString(muteTime - time(nullptr), true).c_str(), muteBy.c_str());
|
||||
handler->PSendSysMessage(LANG_PINFO_MUTED, muteReason.c_str(), secsToTimeString(muteTime - GameTime::GetGameTime(), true).c_str(), muteBy.c_str());
|
||||
|
||||
// Output V. LANG_PINFO_ACC_ACCOUNT
|
||||
handler->PSendSysMessage(LANG_PINFO_ACC_ACCOUNT, userName.c_str(), accId, security);
|
||||
@@ -1967,7 +1967,7 @@ public:
|
||||
if (target)
|
||||
{
|
||||
// Target is online, mute will be in effect right away.
|
||||
int64 muteTime = time(nullptr) + notSpeakTime * MINUTE;
|
||||
int64 muteTime = GameTime::GetGameTime() + notSpeakTime * MINUTE;
|
||||
target->GetSession()->m_muteTime = muteTime;
|
||||
stmt->setInt64(0, muteTime);
|
||||
std::string nameLink = handler->playerLink(targetName);
|
||||
|
||||
@@ -28,6 +28,7 @@ EndScriptData */
|
||||
#include "CreatureGroups.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "FollowMovementGenerator.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "Map.h"
|
||||
@@ -784,7 +785,7 @@ public:
|
||||
uint32 displayid = target->GetDisplayId();
|
||||
uint32 nativeid = target->GetNativeDisplayId();
|
||||
uint32 entry = target->GetEntry();
|
||||
int64 curRespawnDelay = target->GetRespawnCompatibilityMode() ? target->GetRespawnTimeEx() - time(nullptr) : target->GetMap()->GetCreatureRespawnTime(target->GetSpawnId()) - time(nullptr);
|
||||
int64 curRespawnDelay = target->GetRespawnCompatibilityMode() ? target->GetRespawnTimeEx() - GameTime::GetGameTime() : target->GetMap()->GetCreatureRespawnTime(target->GetSpawnId()) - GameTime::GetGameTime();
|
||||
|
||||
if (curRespawnDelay < 0)
|
||||
curRespawnDelay = 0;
|
||||
|
||||
@@ -403,7 +403,7 @@ public:
|
||||
return false;
|
||||
|
||||
bool summoned = false;
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
for (int32 i = first; i <= last; ++i)
|
||||
{
|
||||
if (_respawnCooldowns[i] > now)
|
||||
@@ -431,7 +431,7 @@ public:
|
||||
void ClearSlot(PassengerSlots slot)
|
||||
{
|
||||
_controlledSlots[slot].Clear();
|
||||
_respawnCooldowns[slot] = time(nullptr) + _slotInfo[slot].Cooldown;
|
||||
_respawnCooldowns[slot] = GameTime::GetGameTime() + _slotInfo[slot].Cooldown;
|
||||
}
|
||||
|
||||
bool SlotsNeedRefill(PassengerSlots first, PassengerSlots last) const
|
||||
@@ -858,7 +858,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
|
||||
_controller.SetTransport(creature->GetMapTransport());
|
||||
me->setRegeneratingHealth(false);
|
||||
me->m_CombatDistance = 70.0f;
|
||||
_firstMageCooldown = time(nullptr) + 60;
|
||||
_firstMageCooldown = GameTime::GetGameTime() + 60;
|
||||
_axethrowersYellCooldown = time_t(0);
|
||||
_rocketeersYellCooldown = time_t(0);
|
||||
}
|
||||
@@ -868,7 +868,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
|
||||
ScriptedAI::InitializeAI();
|
||||
|
||||
_events.Reset();
|
||||
_firstMageCooldown = time(nullptr) + 60;
|
||||
_firstMageCooldown = GameTime::GetGameTime() + 60;
|
||||
_axethrowersYellCooldown = time_t(0);
|
||||
_rocketeersYellCooldown = time_t(0);
|
||||
}
|
||||
@@ -920,7 +920,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
|
||||
}
|
||||
else if (action == ACTION_SPAWN_MAGE)
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
if (_firstMageCooldown > now)
|
||||
_events.ScheduleEvent(EVENT_SUMMON_MAGE, (_firstMageCooldown - now) * IN_MILLISECONDS);
|
||||
else
|
||||
@@ -1054,10 +1054,10 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
|
||||
case EVENT_CHECK_RIFLEMAN:
|
||||
if (_controller.SummonCreatures(SLOT_RIFLEMAN_1, Is25ManRaid() ? SLOT_RIFLEMAN_8 : SLOT_RIFLEMAN_4))
|
||||
{
|
||||
if (_axethrowersYellCooldown < time(nullptr))
|
||||
if (_axethrowersYellCooldown < GameTime::GetGameTime())
|
||||
{
|
||||
Talk(SAY_SAURFANG_AXETHROWERS);
|
||||
_axethrowersYellCooldown = time(nullptr) + 5;
|
||||
_axethrowersYellCooldown = GameTime::GetGameTime() + 5;
|
||||
}
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_CHECK_RIFLEMAN, 1000);
|
||||
@@ -1065,10 +1065,10 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
|
||||
case EVENT_CHECK_MORTAR:
|
||||
if (_controller.SummonCreatures(SLOT_MORTAR_1, Is25ManRaid() ? SLOT_MORTAR_4 : SLOT_MORTAR_2))
|
||||
{
|
||||
if (_rocketeersYellCooldown < time(nullptr))
|
||||
if (_rocketeersYellCooldown < GameTime::GetGameTime())
|
||||
{
|
||||
Talk(SAY_SAURFANG_ROCKETEERS);
|
||||
_rocketeersYellCooldown = time(nullptr) + 5;
|
||||
_rocketeersYellCooldown = GameTime::GetGameTime() + 5;
|
||||
}
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_CHECK_MORTAR, 1000);
|
||||
@@ -1127,7 +1127,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
|
||||
_controller.SetTransport(creature->GetMapTransport());
|
||||
me->setRegeneratingHealth(false);
|
||||
me->m_CombatDistance = 70.0f;
|
||||
_firstMageCooldown = time(nullptr) + 60;
|
||||
_firstMageCooldown = GameTime::GetGameTime() + 60;
|
||||
_riflemanYellCooldown = time_t(0);
|
||||
_mortarYellCooldown = time_t(0);
|
||||
}
|
||||
@@ -1137,7 +1137,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
|
||||
ScriptedAI::InitializeAI();
|
||||
|
||||
_events.Reset();
|
||||
_firstMageCooldown = time(nullptr) + 60;
|
||||
_firstMageCooldown = GameTime::GetGameTime() + 60;
|
||||
_riflemanYellCooldown = time_t(0);
|
||||
_mortarYellCooldown = time_t(0);
|
||||
}
|
||||
@@ -1189,7 +1189,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
|
||||
}
|
||||
else if (action == ACTION_SPAWN_MAGE)
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
if (_firstMageCooldown > now)
|
||||
_events.ScheduleEvent(EVENT_SUMMON_MAGE, (_firstMageCooldown - now) * IN_MILLISECONDS);
|
||||
else
|
||||
@@ -1327,10 +1327,10 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
|
||||
case EVENT_CHECK_RIFLEMAN:
|
||||
if (_controller.SummonCreatures(SLOT_RIFLEMAN_1, Is25ManRaid() ? SLOT_RIFLEMAN_8 : SLOT_RIFLEMAN_4))
|
||||
{
|
||||
if (_riflemanYellCooldown < time(nullptr))
|
||||
if (_riflemanYellCooldown < GameTime::GetGameTime())
|
||||
{
|
||||
Talk(SAY_MURADIN_RIFLEMAN);
|
||||
_riflemanYellCooldown = time(nullptr) + 5;
|
||||
_riflemanYellCooldown = GameTime::GetGameTime() + 5;
|
||||
}
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_CHECK_RIFLEMAN, 1000);
|
||||
@@ -1338,10 +1338,10 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
|
||||
case EVENT_CHECK_MORTAR:
|
||||
if (_controller.SummonCreatures(SLOT_MORTAR_1, Is25ManRaid() ? SLOT_MORTAR_4 : SLOT_MORTAR_2))
|
||||
{
|
||||
if (_mortarYellCooldown < time(nullptr))
|
||||
if (_mortarYellCooldown < GameTime::GetGameTime())
|
||||
{
|
||||
Talk(SAY_MURADIN_MORTAR);
|
||||
_mortarYellCooldown = time(nullptr) + 5;
|
||||
_mortarYellCooldown = GameTime::GetGameTime() + 5;
|
||||
}
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_CHECK_MORTAR, 1000);
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "BattlefieldMgr.h"
|
||||
#include "BattlefieldWG.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GameTime.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "Player.h"
|
||||
@@ -306,7 +307,7 @@ class npc_wg_queue : public CreatureScript
|
||||
else
|
||||
{
|
||||
uint32 timer = wintergrasp->GetTimer() / 1000;
|
||||
player->SendUpdateWorldState(4354, time(nullptr) + timer);
|
||||
player->SendUpdateWorldState(4354, GameTime::GetGameTime() + timer);
|
||||
if (timer < 15 * MINUTE)
|
||||
{
|
||||
AddGossipItemFor(player, GOSSIP_ICON_CHAT, player->GetSession()->GetTrinityString(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF);
|
||||
|
||||
@@ -2914,7 +2914,7 @@ class spell_item_crystal_prison_dummy_dnd : public SpellScriptLoader
|
||||
if (Creature* target = GetHitCreature())
|
||||
if (target->isDead() && !target->IsPet())
|
||||
{
|
||||
GetCaster()->SummonGameObject(OBJECT_IMPRISONED_DOOMGUARD, *target, QuaternionData(), uint32(target->GetRespawnTime()-time(nullptr)));
|
||||
GetCaster()->SummonGameObject(OBJECT_IMPRISONED_DOOMGUARD, *target, QuaternionData(), uint32(target->GetRespawnTime()-GameTime::GetGameTime()));
|
||||
target->DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1816,7 +1816,7 @@ public:
|
||||
void DamageTaken(Unit* doneBy, uint32& damage) override
|
||||
{
|
||||
me->AddThreat(doneBy, float(damage)); // just to create threat reference
|
||||
_damageTimes[doneBy->GetGUID()] = time(nullptr);
|
||||
_damageTimes[doneBy->GetGUID()] = GameTime::GetGameTime();
|
||||
damage = 0;
|
||||
}
|
||||
|
||||
@@ -1855,7 +1855,7 @@ public:
|
||||
{
|
||||
case EVENT_TD_CHECK_COMBAT:
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
for (std::unordered_map<ObjectGuid, time_t>::iterator itr = _damageTimes.begin(); itr != _damageTimes.end();)
|
||||
{
|
||||
// If unit has not dealt damage to training dummy for 5 seconds, remove him from combat
|
||||
|
||||
Reference in new issue
Block a user