Core/Misc: Replace time(NULL) with GameTime::GetGameTime()
(cherry picked from commit 12701cb0c6c45eb105ad449eb9a56e76d84d691e) Conflicts: src/server/game/Achievements/AchievementMgr.cpp src/server/game/AuctionHouse/AuctionHouseMgr.cpp src/server/game/AuctionHouseBot/AuctionHouseBotBuyer.cpp src/server/game/AuctionHouseBot/AuctionHouseBotSeller.cpp src/server/game/Battlefield/Battlefield.cpp src/server/game/Battlefield/Zones/BattlefieldWG.cpp src/server/game/Battlegrounds/BattlegroundMgr.cpp src/server/game/Calendar/CalendarMgr.h src/server/game/DungeonFinding/LFGQueue.cpp src/server/game/Entities/Corpse/Corpse.cpp src/server/game/Entities/Creature/Creature.cpp src/server/game/Entities/Item/Item.cpp src/server/game/Entities/Pet/Pet.cpp src/server/game/Entities/Player/Player.cpp src/server/game/Entities/Unit/Unit.cpp src/server/game/Globals/ObjectMgr.cpp src/server/game/Grids/ObjectGridLoader.cpp src/server/game/Guilds/Guild.cpp src/server/game/Handlers/AuctionHouseHandler.cpp src/server/game/Handlers/BattlefieldHandler.cpp src/server/game/Handlers/CalendarHandler.cpp src/server/game/Handlers/CharacterHandler.cpp src/server/game/Handlers/ChatHandler.cpp src/server/game/Handlers/LFGHandler.cpp src/server/game/Handlers/MailHandler.cpp src/server/game/Handlers/MiscHandler.cpp src/server/game/Handlers/MovementHandler.cpp src/server/game/Handlers/PetHandler.cpp src/server/game/Handlers/QueryHandler.cpp src/server/game/Handlers/TicketHandler.cpp src/server/game/Instances/InstanceSaveMgr.cpp src/server/game/Server/WorldSession.cpp src/server/game/Server/WorldSocket.cpp src/server/game/Spells/Auras/SpellAuras.cpp src/server/game/Tickets/TicketMgr.cpp src/server/game/Tickets/TicketMgr.h src/server/game/World/World.cpp src/server/scripts/Commands/cs_gobject.cpp src/server/scripts/Commands/cs_instance.cpp src/server/scripts/Commands/cs_list.cpp src/server/scripts/Northrend/zone_wintergrasp.cpp src/server/scripts/Spells/spell_item.cpp
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#include "CellImpl.h"
|
||||
#include "ChatTextBuilder.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Group.h"
|
||||
#include "Guild.h"
|
||||
@@ -265,7 +266,7 @@ void PlayerAchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, Pre
|
||||
|
||||
if (criteriaResult)
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
do
|
||||
{
|
||||
Field* fields = criteriaResult->Fetch();
|
||||
@@ -505,7 +506,7 @@ void PlayerAchievementMgr::CompletedAchievement(AchievementEntry const* achievem
|
||||
TC_LOG_INFO("criteria.achievement", "PlayerAchievementMgr::CompletedAchievement(%u). %s", achievement->ID, GetOwnerInfo().c_str());
|
||||
|
||||
CompletedAchievementData& ca = _completedAchievements[achievement->ID];
|
||||
ca.Date = time(nullptr);
|
||||
ca.Date = GameTime::GetGameTime();
|
||||
ca.Changed = true;
|
||||
|
||||
if (achievement->Flags & (ACHIEVEMENT_FLAG_REALM_FIRST_REACH | ACHIEVEMENT_FLAG_REALM_FIRST_KILL))
|
||||
@@ -668,7 +669,7 @@ void PlayerAchievementMgr::SendAchievementEarned(AchievementEntry const* achieve
|
||||
achievementEarned.Earner = _owner->GetGUID();
|
||||
achievementEarned.EarnerNativeRealm = achievementEarned.EarnerVirtualRealm = GetVirtualRealmAddress();
|
||||
achievementEarned.AchievementID = achievement->ID;
|
||||
achievementEarned.Time = time(nullptr);
|
||||
achievementEarned.Time = GameTime::GetGameTime();
|
||||
if (!(achievement->Flags & ACHIEVEMENT_FLAG_TRACKING_FLAG))
|
||||
_owner->SendMessageToSetInRange(achievementEarned.Write(), sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), true);
|
||||
else
|
||||
@@ -699,7 +700,7 @@ void GuildAchievementMgr::Reset()
|
||||
WorldPackets::Achievement::GuildAchievementDeleted guildAchievementDeleted;
|
||||
guildAchievementDeleted.AchievementID = iter->first;
|
||||
guildAchievementDeleted.GuildGUID = guid;
|
||||
guildAchievementDeleted.TimeDeleted = time(nullptr);
|
||||
guildAchievementDeleted.TimeDeleted = GameTime::GetGameTime();
|
||||
SendPacket(guildAchievementDeleted.Write());
|
||||
}
|
||||
|
||||
@@ -751,7 +752,7 @@ void GuildAchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, Prep
|
||||
|
||||
if (criteriaResult)
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
do
|
||||
{
|
||||
Field* fields = criteriaResult->Fetch();
|
||||
@@ -940,7 +941,7 @@ void GuildAchievementMgr::CompletedAchievement(AchievementEntry const* achieveme
|
||||
|
||||
SendAchievementEarned(achievement);
|
||||
CompletedAchievementData& ca = _completedAchievements[achievement->ID];
|
||||
ca.Date = time(nullptr);
|
||||
ca.Date = GameTime::GetGameTime();
|
||||
ca.Changed = true;
|
||||
|
||||
if (achievement->Flags & ACHIEVEMENT_FLAG_SHOW_GUILD_MEMBERS)
|
||||
@@ -1006,7 +1007,7 @@ void GuildAchievementMgr::SendAchievementEarned(AchievementEntry const* achievem
|
||||
WorldPackets::Achievement::GuildAchievementEarned guildAchievementEarned;
|
||||
guildAchievementEarned.AchievementID = achievement->ID;
|
||||
guildAchievementEarned.GuildGUID = _owner->GetGUID();
|
||||
guildAchievementEarned.TimeEarned = time(nullptr);
|
||||
guildAchievementEarned.TimeEarned = GameTime::GetGameTime();
|
||||
SendPacket(guildAchievementEarned.Write());
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "DB2Stores.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "Garrison.h"
|
||||
#include "Group.h"
|
||||
#include "InstanceScript.h"
|
||||
@@ -978,7 +979,7 @@ void CriteriaHandler::SetCriteriaProgress(Criteria const* criteria, uint64 chang
|
||||
}
|
||||
|
||||
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.
|
||||
progress->PlayerGUID = referencePlayer ? referencePlayer->GetGUID() : ObjectGuid::Empty;
|
||||
|
||||
Seconds timeElapsed = Seconds::zero();
|
||||
|
||||
@@ -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->GetAuctionsById(sAuctionBotConfig->GetAuctionHouseId(config.GetHouseType()));
|
||||
@@ -254,7 +255,7 @@ bool AuctionBotBuyer::RollBidChance(BuyerItemInfo const* ahInfo, AuctionPosting
|
||||
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();)
|
||||
{
|
||||
@@ -270,7 +271,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->GetAuctionsById(sAuctionBotConfig->GetAuctionHouseId(config.GetHouseType()));
|
||||
CheckEntryMap& items = config.EligibleItems;
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "CellImpl.h"
|
||||
#include "CreatureTextMgr.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Group.h"
|
||||
@@ -86,7 +87,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);
|
||||
}
|
||||
}
|
||||
@@ -165,7 +166,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)
|
||||
@@ -251,7 +252,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -281,7 +282,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;
|
||||
}
|
||||
|
||||
@@ -290,7 +291,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(GetQueueId(), m_ZoneId, m_TimeForAcceptInvite);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "Battleground.h"
|
||||
#include "CreatureTextMgr.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameTime.h"
|
||||
#include "MapManager.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Player.h"
|
||||
@@ -346,8 +347,8 @@ void BattlefieldTB::FillInitialWorldStates(WorldPackets::WorldState::InitWorldSt
|
||||
packet.Worldstates.emplace_back(uint32(TB_WS_ALLIANCE_CONTROLS_SHOW), int32(!IsWarTime() && GetDefenderTeam() == TEAM_ALLIANCE ? 1 : 0));
|
||||
packet.Worldstates.emplace_back(uint32(TB_WS_HORDE_CONTROLS_SHOW), int32(!IsWarTime() && GetDefenderTeam() == TEAM_HORDE ? 1 : 0));
|
||||
|
||||
packet.Worldstates.emplace_back(uint32(TB_WS_TIME_BATTLE_END), int32(IsWarTime() ? time(nullptr) + (m_Timer / 1000) : 0));
|
||||
packet.Worldstates.emplace_back(uint32(TB_WS_TIME_NEXT_BATTLE), int32(!IsWarTime() ? time(nullptr) + (m_Timer / 1000) : 0));
|
||||
packet.Worldstates.emplace_back(uint32(TB_WS_TIME_BATTLE_END), int32(IsWarTime() ? GameTime::GetGameTime() + (m_Timer / 1000) : 0));
|
||||
packet.Worldstates.emplace_back(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));
|
||||
@@ -745,7 +746,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);
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "Battleground.h"
|
||||
#include "CreatureTextMgr.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameTime.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "Log.h"
|
||||
#include "MapManager.h"
|
||||
@@ -1150,7 +1151,7 @@ void BattlefieldWG::FillInitialWorldStates(WorldPackets::WorldState::InitWorldSt
|
||||
packet.Worldstates.emplace_back(uint32(BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE), int32(IsWarTime() ? 1 : 0));
|
||||
|
||||
for (uint32 i = 0; i < 2; ++i)
|
||||
packet.Worldstates.emplace_back(ClockWorldState[i], int32(time(nullptr) + (m_Timer / 1000)));
|
||||
packet.Worldstates.emplace_back(ClockWorldState[i], int32(GameTime::GetGameTime() + (m_Timer / 1000)));
|
||||
|
||||
packet.Worldstates.emplace_back(uint32(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H), int32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_H)));
|
||||
packet.Worldstates.emplace_back(uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H), int32(GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H)));
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "CharacterCache.h"
|
||||
#include "Containers.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Item.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
@@ -110,7 +111,7 @@ void BlackMarketMgr::LoadAuctions()
|
||||
return;
|
||||
}
|
||||
|
||||
_lastUpdate = time(nullptr); //Set update time before loading
|
||||
_lastUpdate = GameTime::GetGameTime(); //Set update time before loading
|
||||
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
do
|
||||
@@ -143,7 +144,7 @@ void BlackMarketMgr::LoadAuctions()
|
||||
void BlackMarketMgr::Update(bool updateTime)
|
||||
{
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
for (BlackMarketEntryMap::iterator itr = _auctions.begin(); itr != _auctions.end(); ++itr)
|
||||
{
|
||||
BlackMarketEntry* entry = itr->second;
|
||||
@@ -405,12 +406,12 @@ BlackMarketTemplate const* BlackMarketEntry::GetTemplate() const
|
||||
|
||||
uint32 BlackMarketEntry::GetSecondsRemaining() const
|
||||
{
|
||||
return _secondsRemaining - (time(nullptr) - sBlackMarketMgr->GetLastUpdate());
|
||||
return _secondsRemaining - (GameTime::GetGameTime() - sBlackMarketMgr->GetLastUpdate());
|
||||
}
|
||||
|
||||
time_t BlackMarketEntry::GetExpirationTime() const
|
||||
{
|
||||
return time(nullptr) + GetSecondsRemaining();
|
||||
return GameTime::GetGameTime() + GetSecondsRemaining();
|
||||
}
|
||||
|
||||
bool BlackMarketEntry::IsCompleted() const
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
#include "Player.h"
|
||||
#include <sstream>
|
||||
|
||||
CalendarInvite::CalendarInvite() : _inviteId(1), _eventId(0), _invitee(), _senderGUID(), _responseTime(0),
|
||||
_status(CALENDAR_STATUS_INVITED), _rank(CALENDAR_RANK_PLAYER), _note("") { }
|
||||
|
||||
CalendarInvite::~CalendarInvite()
|
||||
{
|
||||
sCalendarMgr->FreeInviteId(_inviteId);
|
||||
|
||||
@@ -148,8 +148,7 @@ struct TC_GAME_API CalendarInvite
|
||||
_note = calendarInvite.GetNote();
|
||||
}
|
||||
|
||||
CalendarInvite() : _inviteId(1), _eventId(0), _invitee(), _senderGUID(), _responseTime(0),
|
||||
_status(CALENDAR_STATUS_INVITED), _rank(CALENDAR_RANK_PLAYER), _note("") { }
|
||||
CalendarInvite();
|
||||
|
||||
CalendarInvite(uint64 inviteId, uint64 eventId, ObjectGuid invitee, ObjectGuid senderGUID, time_t responseTime,
|
||||
CalendarInviteStatus status, CalendarModerationRank rank, std::string note) :
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "DB2Stores.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "GroupMgr.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
@@ -287,7 +288,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();)
|
||||
@@ -540,13 +541,13 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons)
|
||||
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;
|
||||
@@ -585,7 +586,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons)
|
||||
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)
|
||||
{
|
||||
@@ -770,7 +771,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)
|
||||
@@ -1039,7 +1040,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);
|
||||
@@ -1208,7 +1209,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;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "ObjectDefines.h"
|
||||
#include "Containers.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "LFGQueue.h"
|
||||
#include "LFGMgr.h"
|
||||
@@ -79,6 +80,10 @@ char const* GetCompatibleString(LfgCompatibility compatibles)
|
||||
}
|
||||
}
|
||||
|
||||
LfgQueueData::LfgQueueData() : joinTime(GameTime::GetGameTime()), tanks(LFG_TANKS_NEEDED),
|
||||
healers(LFG_HEALERS_NEEDED), dps(LFG_DPS_NEEDED)
|
||||
{ }
|
||||
|
||||
std::string LFGQueue::GetDetailedMatchRoles(GuidList const& check) const
|
||||
{
|
||||
if (check.empty())
|
||||
@@ -535,7 +540,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();
|
||||
proposal.dungeonId = Trinity::Containers::SelectRandomContainerElement(proposalDungeons);
|
||||
|
||||
@@ -52,9 +52,7 @@ struct LfgCompatibilityData
|
||||
/// Stores player or group queue info
|
||||
struct LfgQueueData
|
||||
{
|
||||
LfgQueueData(): joinTime(time_t(time(nullptr))), tanks(LFG_TANKS_NEEDED),
|
||||
healers(LFG_HEALERS_NEEDED), dps(LFG_DPS_NEEDED)
|
||||
{ }
|
||||
LfgQueueData();
|
||||
|
||||
LfgQueueData(time_t _joinTime, LfgDungeonSet const& _dungeons, LfgRolesMap const& _roles):
|
||||
joinTime(_joinTime), tanks(LFG_TANKS_NEEDED), healers(LFG_HEALERS_NEEDED),
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "Corpse.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "GameTime.h"
|
||||
#include "Log.h"
|
||||
#include "Map.h"
|
||||
#include "ObjectAccessor.h"
|
||||
@@ -36,7 +37,7 @@ Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES), m_type(type
|
||||
|
||||
m_updateFlag.Stationary = true;
|
||||
|
||||
m_time = time(nullptr);
|
||||
m_time = GameTime::GetGameTime();
|
||||
|
||||
lootRecipient = nullptr;
|
||||
}
|
||||
@@ -164,6 +165,11 @@ void Corpse::DeleteFromDB(ObjectGuid const& ownerGuid, CharacterDatabaseTransact
|
||||
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 15
|
||||
|
||||
@@ -102,7 +102,7 @@ class TC_GAME_API Corpse : public WorldObject, public GridObject<Corpse>
|
||||
}
|
||||
|
||||
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; }
|
||||
|
||||
@@ -56,6 +56,9 @@
|
||||
#include <G3D/g3dmath.h>
|
||||
#include <sstream>
|
||||
|
||||
VendorItemCount::VendorItemCount(uint32 _item, uint32 _count)
|
||||
: itemId(_item), count(_count), lastIncrementTime(GameTime::GetGameTime()) { }
|
||||
|
||||
bool VendorItem::IsGoldRequired(ItemTemplate const* pProto) const
|
||||
{
|
||||
return pProto->GetFlags2() & ITEM_FLAG2_DONT_IGNORE_BUY_PRICE || !ExtendedCost;
|
||||
@@ -410,7 +413,7 @@ void Creature::RemoveCorpse(bool setSpawnTime, bool destroyForNearbyPlayers)
|
||||
|
||||
if (m_respawnCompatibilityMode)
|
||||
{
|
||||
m_corpseRemoveTime = time(nullptr);
|
||||
m_corpseRemoveTime = GameTime::GetGameTime();
|
||||
setDeathState(DEAD);
|
||||
RemoveAllAuras();
|
||||
loot.clear();
|
||||
@@ -423,7 +426,7 @@ void Creature::RemoveCorpse(bool setSpawnTime, bool destroyForNearbyPlayers)
|
||||
|
||||
// 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())
|
||||
@@ -456,7 +459,7 @@ void Creature::RemoveCorpse(bool setSpawnTime, bool destroyForNearbyPlayers)
|
||||
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);
|
||||
}
|
||||
@@ -695,7 +698,7 @@ void Creature::Update(uint32 diff)
|
||||
break;
|
||||
case DEAD:
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
if (m_respawnTime <= now)
|
||||
{
|
||||
// First check if there are any scripts that object to us respawning
|
||||
@@ -752,7 +755,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 ", GetEntry());
|
||||
@@ -1698,7 +1701,7 @@ bool Creature::LoadFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap,
|
||||
|
||||
// Is the creature script objecting to us spawning? If yes, delay by a little bit (then re-check in ::Update)
|
||||
if (m_respawnCompatibilityMode && !m_respawnTime && !sScriptMgr->CanSpawn(spawnId, GetEntry(), GetCreatureData(), map))
|
||||
m_respawnTime = time(nullptr)+urand(4,7);
|
||||
m_respawnTime = GameTime::GetGameTime()+urand(4,7);
|
||||
|
||||
if (m_respawnTime) // respawn on Update
|
||||
{
|
||||
@@ -1851,7 +1854,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;
|
||||
@@ -1976,7 +1979,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))
|
||||
@@ -1987,14 +1990,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
|
||||
@@ -2184,7 +2187,7 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn, Seconds const& forceRespawn
|
||||
uint32 respawnDelay = m_respawnDelay;
|
||||
if (uint32 scalingMode = sWorld->getIntConfig(CONFIG_RESPAWN_DYNAMICMODE))
|
||||
GetMap()->ApplyDynamicModeRespawnScaling(this, m_spawnId, respawnDelay, scalingMode);
|
||||
m_respawnTime = time(nullptr) + respawnDelay;
|
||||
m_respawnTime = GameTime::GetGameTime() + respawnDelay;
|
||||
SaveRespawnTime();
|
||||
}
|
||||
|
||||
@@ -2468,7 +2471,7 @@ void Creature::SaveRespawnTime(uint32 forceDelay, bool savetodb)
|
||||
return;
|
||||
}
|
||||
|
||||
time_t thisRespawnTime = forceDelay ? time(nullptr) + forceDelay : m_respawnTime;
|
||||
time_t thisRespawnTime = forceDelay ? GameTime::GetGameTime() + forceDelay : m_respawnTime;
|
||||
GetMap()->SaveRespawnTime(SPAWN_TYPE_CREATURE, m_spawnId, GetEntry(), thisRespawnTime, GetMap()->GetZoneId(GetPhaseShift(), GetHomePosition()), Trinity::ComputeGridCoord(GetHomePosition().GetPositionX(), GetHomePosition().GetPositionY()).GetId(), savetodb && m_creatureData && m_creatureData->dbData);
|
||||
}
|
||||
|
||||
@@ -2670,13 +2673,18 @@ 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
|
||||
return now;
|
||||
}
|
||||
|
||||
void Creature::SetRespawnTime(uint32 respawn)
|
||||
{
|
||||
m_respawnTime = respawn ? GameTime::GetGameTime() + respawn : 0;
|
||||
}
|
||||
|
||||
void Creature::GetRespawnPosition(float &x, float &y, float &z, float* ori, float* dist) const
|
||||
{
|
||||
if (m_creatureData)
|
||||
@@ -2707,7 +2715,7 @@ void Creature::AllLootRemovedFromCorpse()
|
||||
if (LootTemplates_Skinning.HaveLootFor(GetCreatureTemplate()->SkinLootId))
|
||||
AddUnitFlag(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;
|
||||
@@ -2867,7 +2875,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))
|
||||
@@ -2905,7 +2913,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))
|
||||
@@ -3235,7 +3243,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;
|
||||
@@ -192,7 +191,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;
|
||||
ObjectGuid GetLootRecipientGUID() const { return m_lootRecipient; }
|
||||
Player* GetLootRecipient() const;
|
||||
Group* GetLootRecipientGroup() const;
|
||||
@@ -240,7 +239,7 @@ class TC_GAME_API Creature : public Unit, public GridObject<Creature>, public Ma
|
||||
|
||||
time_t const& GetRespawnTime() const { return m_respawnTime; }
|
||||
time_t GetRespawnTimeEx() const;
|
||||
void SetRespawnTime(uint32 respawn) { m_respawnTime = respawn ? time(nullptr) + respawn : 0; }
|
||||
void SetRespawnTime(uint32 respawn);
|
||||
void Respawn(bool force = false);
|
||||
void SaveRespawnTime(uint32 forceDelay = 0, bool savetodb = true) override;
|
||||
|
||||
|
||||
@@ -589,7 +589,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();
|
||||
@@ -623,7 +623,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 = ObjectGuid::Create<HighGuid::GameObject>(GetMapId(), GetEntry(), m_spawnId);
|
||||
@@ -903,7 +903,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
|
||||
@@ -1139,7 +1139,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);
|
||||
@@ -1246,7 +1246,7 @@ Unit* GameObject::GetOwner() const
|
||||
|
||||
void GameObject::SaveRespawnTime(uint32 forceDelay, bool savetodb)
|
||||
{
|
||||
if (m_goData && m_respawnTime > time(nullptr) && m_spawnedByDefault)
|
||||
if (m_goData && m_respawnTime > GameTime::GetGameTime() && m_spawnedByDefault)
|
||||
{
|
||||
if (m_respawnCompatibilityMode)
|
||||
{
|
||||
@@ -1254,7 +1254,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);
|
||||
}
|
||||
}
|
||||
@@ -1319,11 +1319,26 @@ uint8 GameObject::GetLevelForTarget(WorldObject const* target) const
|
||||
return 1;
|
||||
}
|
||||
|
||||
time_t GameObject::GetRespawnTimeEx() const
|
||||
{
|
||||
time_t now = GameTime::GetGameTime();
|
||||
if (m_respawnTime > now)
|
||||
return m_respawnTime;
|
||||
else
|
||||
return now;
|
||||
}
|
||||
|
||||
void GameObject::SetRespawnTime(int32 respawn)
|
||||
{
|
||||
m_respawnTime = respawn > 0 ? GameTime::GetGameTime() + respawn : 0;
|
||||
m_respawnDelayTime = respawn > 0 ? respawn : 0;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -2454,6 +2469,11 @@ void GameObject::SetLootState(LootState state, Unit* unit)
|
||||
}
|
||||
}
|
||||
|
||||
void GameObject::SetLootGenerationTime()
|
||||
{
|
||||
m_lootGenerationTime = GameTime::GetGameTime();
|
||||
}
|
||||
|
||||
void GameObject::SetGoState(GOState state)
|
||||
{
|
||||
SetUpdateFieldValue(m_values.ModifyValue(&GameObject::m_gameObjectData).ModifyValue(&UF::GameObjectData::State), state);
|
||||
|
||||
@@ -150,20 +150,9 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
|
||||
uint32 GetSpellId() const { return m_spellId;}
|
||||
|
||||
time_t GetRespawnTime() const { return m_respawnTime; }
|
||||
time_t GetRespawnTimeEx() const
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
if (m_respawnTime > now)
|
||||
return m_respawnTime;
|
||||
else
|
||||
return now;
|
||||
}
|
||||
time_t GetRespawnTimeEx() const;
|
||||
|
||||
void SetRespawnTime(int32 respawn)
|
||||
{
|
||||
m_respawnTime = respawn > 0 ? time(nullptr) + respawn : 0;
|
||||
m_respawnDelayTime = respawn > 0 ? respawn : 0;
|
||||
}
|
||||
void SetRespawnTime(int32 respawn);
|
||||
void Respawn();
|
||||
bool isSpawned() const
|
||||
{
|
||||
@@ -210,7 +199,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 const& PlayerGuidLow) { m_SkillupList.insert(PlayerGuidLow); }
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "GameTables.h"
|
||||
#include "GameTime.h"
|
||||
#include "ItemEnchantmentMgr.h"
|
||||
#include "ItemPackets.h"
|
||||
#include "Log.h"
|
||||
@@ -432,7 +433,7 @@ Item::Item()
|
||||
m_container = nullptr;
|
||||
m_lootGenerated = false;
|
||||
mb_in_trade = false;
|
||||
m_lastPlayedTimeUpdate = time(nullptr);
|
||||
m_lastPlayedTimeUpdate = GameTime::GetGameTime();
|
||||
|
||||
m_paidMoney = 0;
|
||||
m_paidExtendedCost = 0;
|
||||
@@ -1743,7 +1744,7 @@ void Item::UpdatePlayedTime(Player* owner)
|
||||
// Get current played time
|
||||
uint32 current_playtime = m_itemData->CreatePlayedTime;
|
||||
// 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
|
||||
@@ -1764,7 +1765,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 *m_itemData->CreatePlayedTime + elapsed;
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
|
||||
break;
|
||||
}
|
||||
|
||||
SetPetNameTimestamp(uint32(time(nullptr)));
|
||||
SetPetNameTimestamp(uint32(GameTime::GetGameTime()));
|
||||
SetCreatorGUID(owner->GetGUID());
|
||||
|
||||
InitStatsForLevel(petlevel);
|
||||
@@ -317,7 +317,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
|
||||
owner->SetMinion(this, true);
|
||||
map->AddToMap(ToCreature());
|
||||
|
||||
uint32 timediff = uint32(time(nullptr) - fields[13].GetUInt32());
|
||||
uint32 timediff = uint32(GameTime::GetGameTime() - fields[13].GetUInt32());
|
||||
_LoadAuras(timediff);
|
||||
|
||||
// load action bar, if data broken will fill later by default spells.
|
||||
@@ -472,7 +472,7 @@ void Pet::SavePetToDB(PetSaveMode mode)
|
||||
|
||||
stmt->setString(12, GenerateActionBarData());
|
||||
|
||||
stmt->setUInt32(13, time(nullptr));
|
||||
stmt->setUInt32(13, GameTime::GetGameTime());
|
||||
stmt->setUInt32(14, m_unitData->CreatedBySpell);
|
||||
stmt->setUInt8(15, getPetType());
|
||||
stmt->setUInt16(16, m_petSpecialization);
|
||||
@@ -556,7 +556,7 @@ void Pet::Update(uint32 diff)
|
||||
{
|
||||
case CORPSE:
|
||||
{
|
||||
if (getPetType() != HUNTER_PET || m_corpseRemoveTime <= time(nullptr))
|
||||
if (getPetType() != HUNTER_PET || m_corpseRemoveTime <= GameTime::GetGameTime())
|
||||
{
|
||||
Remove(PET_SAVE_NOT_IN_SLOT); //hunters' pets never get removed because of death, NEVER!
|
||||
return;
|
||||
|
||||
@@ -230,7 +230,7 @@ Player::Player(WorldSession* session) : Unit(true), m_sceneMgr(this)
|
||||
m_bgBattlegroundQueueID[j].joinTime = 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;
|
||||
@@ -288,7 +288,7 @@ Player::Player(WorldSession* session) : Unit(true), m_sceneMgr(this)
|
||||
m_spellPenetrationItemMod = 0;
|
||||
|
||||
// Honor System
|
||||
m_lastHonorUpdateTime = time(nullptr);
|
||||
m_lastHonorUpdateTime = GameTime::GetGameTime();
|
||||
|
||||
m_IsBGRandomWinner = false;
|
||||
|
||||
@@ -495,7 +495,7 @@ bool Player::Create(ObjectGuid::LowType guidlow, WorldPackets::Character::Charac
|
||||
SetCreateCurrency(CURRENCY_TYPE_JUSTICE_POINTS, sWorld->getIntConfig(CONFIG_CURRENCY_START_JUSTICE_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;
|
||||
|
||||
@@ -911,7 +911,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;
|
||||
@@ -933,7 +933,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);
|
||||
|
||||
@@ -2653,7 +2653,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)
|
||||
@@ -2670,7 +2670,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();
|
||||
@@ -3458,7 +3458,7 @@ bool Player::ResetTalents(bool noCost)
|
||||
UpdateCriteria(CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS, 1);
|
||||
|
||||
SetTalentResetCost(cost);
|
||||
SetTalentResetTime(time(nullptr));
|
||||
SetTalentResetTime(GameTime::GetGameTime());
|
||||
}
|
||||
|
||||
/* when prev line will dropped use next line
|
||||
@@ -4213,7 +4213,7 @@ void Player::DeleteOldCharacters(uint32 keepDays)
|
||||
TC_LOG_INFO("entities.player", "Player::DeleteOldCharacters: Deleting all characters which have been deleted %u days before...", keepDays);
|
||||
|
||||
CharacterDatabasePreparedStatement* 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)
|
||||
@@ -6451,8 +6451,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 = GameTime::GetGameTime();
|
||||
time_t today = GameTime::GetGameTime() / DAY * DAY;
|
||||
|
||||
if (m_lastHonorUpdateTime < today)
|
||||
{
|
||||
@@ -8739,7 +8739,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type, bool aeLooting/* = fa
|
||||
|
||||
// loot was generated and respawntime has passed since then, allow to recreate loot
|
||||
// to avoid bugs, this rule covers spawned gameobjects only
|
||||
if (go->isSpawnedByDefault() && go->getLootState() == GO_ACTIVATED && !go->loot.isLooted() && go->GetLootGenerationTime() + go->GetRespawnDelay() < time(nullptr))
|
||||
if (go->isSpawnedByDefault() && go->getLootState() == GO_ACTIVATED && !go->loot.isLooted() && go->GetLootGenerationTime() + go->GetRespawnDelay() < GameTime::GetGameTime())
|
||||
go->SetLootState(GO_READY);
|
||||
|
||||
if (go->getLootState() == GO_READY)
|
||||
@@ -9771,7 +9771,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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9781,8 +9781,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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13847,7 +13847,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;
|
||||
|
||||
@@ -15585,7 +15585,7 @@ void Player::AddQuest(Quest const* quest, Object* questGiver)
|
||||
|
||||
AddTimedQuest(quest_id);
|
||||
questStatusData.Timer = limittime * IN_MILLISECONDS;
|
||||
qtime = static_cast<uint32>(time(nullptr)) + limittime;
|
||||
qtime = static_cast<uint32>(GameTime::GetGameTime()) + limittime;
|
||||
}
|
||||
else
|
||||
questStatusData.Timer = 0;
|
||||
@@ -18579,8 +18579,8 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder* holder)
|
||||
|
||||
SaveRecallPosition();
|
||||
|
||||
time_t now = time(nullptr);
|
||||
time_t logoutTime = fields.logout_time;
|
||||
time_t now = GameTime::GetGameTime();
|
||||
time_t logoutTime = time_t(fields.logout_time);
|
||||
|
||||
// since last logout (in seconds)
|
||||
uint32 time_diff = uint32(now - logoutTime); //uint64 is excessive for a time_diff in seconds.. uint32 allows for 136~ year difference.
|
||||
@@ -20305,7 +20305,7 @@ void Player::SendRaidInfo()
|
||||
{
|
||||
WorldPackets::Instance::InstanceInfo instanceInfo;
|
||||
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
|
||||
for (auto difficultyItr = m_boundInstances.begin(); difficultyItr != m_boundInstances.end(); ++difficultyItr)
|
||||
{
|
||||
@@ -20659,7 +20659,7 @@ void Player::SaveToDB(LoginDatabaseTransaction loginTransaction, CharacterDataba
|
||||
stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_TOTAL]);
|
||||
stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_LEVEL]);
|
||||
stmt->setFloat(index++, finiteAlways(_restMgr->GetRestBonus(REST_TYPE_XP)));
|
||||
stmt->setUInt64(index++, time(nullptr));
|
||||
stmt->setUInt64(index++, GameTime::GetGameTime());
|
||||
stmt->setUInt8(index++, (HasPlayerFlag(PLAYER_FLAGS_RESTING) ? 1 : 0));
|
||||
//save, far from tavern/city
|
||||
//save, but in tavern/city
|
||||
@@ -20801,7 +20801,7 @@ void Player::SaveToDB(LoginDatabaseTransaction loginTransaction, CharacterDataba
|
||||
stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_TOTAL]);
|
||||
stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_LEVEL]);
|
||||
stmt->setFloat(index++, finiteAlways(_restMgr->GetRestBonus(REST_TYPE_XP)));
|
||||
stmt->setUInt64(index++, time(nullptr));
|
||||
stmt->setUInt64(index++, GameTime::GetGameTime());
|
||||
stmt->setUInt8(index++, (HasPlayerFlag(PLAYER_FLAGS_RESTING) ? 1 : 0));
|
||||
//save, far from tavern/city
|
||||
//save, but in tavern/city
|
||||
@@ -20963,7 +20963,7 @@ void Player::SaveToDB(LoginDatabaseTransaction loginTransaction, CharacterDataba
|
||||
loginStmt->setUInt32(3, realm.Id.Realm);
|
||||
loginStmt->setString(4, GetName());
|
||||
loginStmt->setUInt64(5, GetGUID().GetCounter());
|
||||
loginStmt->setUInt32(6, time(nullptr));
|
||||
loginStmt->setUInt32(6, GameTime::GetGameTime());
|
||||
loginTransaction->Append(loginStmt);
|
||||
|
||||
// save pet (hunter pet level and experience and all type pets health/mana).
|
||||
@@ -21794,7 +21794,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);
|
||||
@@ -23648,7 +23648,7 @@ void Player::UpdatePvPState(bool onlyFFA)
|
||||
else // in friendly area
|
||||
{
|
||||
if (IsPvP() && !HasPlayerFlag(PLAYER_FLAGS_IN_PVP) && !pvpInfo.EndTimer)
|
||||
pvpInfo.EndTimer = time(nullptr); // start toggle-off
|
||||
pvpInfo.EndTimer = GameTime::GetGameTime(); // start toggle-off
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23668,7 +23668,7 @@ void Player::UpdatePvP(bool state, bool _override)
|
||||
}
|
||||
else
|
||||
{
|
||||
pvpInfo.EndTimer = time(nullptr);
|
||||
pvpInfo.EndTimer = GameTime::GetGameTime();
|
||||
SetPvP(state);
|
||||
}
|
||||
}
|
||||
@@ -25019,13 +25019,13 @@ void Player::SetDailyQuestStatus(uint32 quest_id)
|
||||
if (!qQuest->IsDFQuest())
|
||||
{
|
||||
AddDynamicUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::DailyQuestsCompleted)) = quest_id;
|
||||
m_lastDailyQuestTime = time(nullptr); // last daily quest time
|
||||
m_lastDailyQuestTime = GameTime::GetGameTime(); // last daily quest time
|
||||
m_DailyQuestChanged = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_DFQuests.insert(quest_id);
|
||||
m_lastDailyQuestTime = time(nullptr);
|
||||
m_lastDailyQuestTime = GameTime::GetGameTime();
|
||||
m_DailyQuestChanged = true;
|
||||
}
|
||||
}
|
||||
@@ -25419,7 +25419,7 @@ void Player::UpdateForQuestWorldObjects()
|
||||
|
||||
bool Player::HasSummonPending() const
|
||||
{
|
||||
return m_summon_expire >= time(nullptr);
|
||||
return m_summon_expire >= GameTime::GetGameTime();
|
||||
}
|
||||
|
||||
void Player::SendSummonRequestFrom(Unit* summoner)
|
||||
@@ -25435,7 +25435,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);
|
||||
|
||||
WorldPackets::Movement::SummonRequest summonRequest;
|
||||
@@ -25454,7 +25454,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
|
||||
@@ -25895,7 +25895,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;
|
||||
@@ -25910,7 +25910,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)
|
||||
{
|
||||
@@ -25954,7 +25954,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;
|
||||
@@ -28592,7 +28592,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
|
||||
pet->SetPetNextLevelExperience(1000);
|
||||
pet->SetFullHealth();
|
||||
pet->SetFullPower(POWER_MANA);
|
||||
pet->SetPetNameTimestamp(uint32(time(nullptr)));
|
||||
pet->SetPetNameTimestamp(uint32(GameTime::GetGameTime()));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "RestMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "Log.h"
|
||||
#include "Player.h"
|
||||
#include "Random.h"
|
||||
@@ -100,7 +101,7 @@ void RestMgr::SetRestFlag(RestFlag restFlag, uint32 triggerID)
|
||||
|
||||
if (!oldRestMask && _restFlagMask) // only set flag/time on the first rest state
|
||||
{
|
||||
_restTime = time(nullptr);
|
||||
_restTime = GameTime::GetGameTime();
|
||||
_player->AddPlayerFlag(PLAYER_FLAGS_RESTING);
|
||||
}
|
||||
|
||||
|
||||
@@ -12211,7 +12211,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
|
||||
SetPetNameTimestamp(uint32(time(nullptr)));
|
||||
SetPetNameTimestamp(uint32(GameTime::GetGameTime()));
|
||||
}
|
||||
}
|
||||
playerCharmer->CharmSpellInitialize();
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "DB2Stores.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "MapManager.h"
|
||||
@@ -45,7 +46,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
|
||||
@@ -62,7 +63,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
|
||||
@@ -78,7 +79,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)
|
||||
@@ -138,13 +139,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
|
||||
@@ -185,7 +186,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;
|
||||
}
|
||||
@@ -1023,7 +1024,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;
|
||||
@@ -1618,7 +1619,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;
|
||||
@@ -1734,7 +1735,7 @@ void GameEventMgr::SetHolidayEventTime(GameEventData& event)
|
||||
|
||||
bool singleDate = ((holiday->Date[0] >> 24) & 0x1F) == 31; // Events with fixed date within year have - 1
|
||||
|
||||
time_t curTime = time(nullptr);
|
||||
time_t curTime = GameTime::GetGameTime();
|
||||
for (int i = 0; i < MAX_HOLIDAY_DATES && holiday->Date[i]; ++i)
|
||||
{
|
||||
uint32 date = holiday->Date[i];
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameTime.h"
|
||||
#include "GarrisonMgr.h"
|
||||
#include "Log.h"
|
||||
#include "Map.h"
|
||||
@@ -386,7 +387,7 @@ void Garrison::PlaceBuilding(uint32 garrPlotInstanceId, uint32 garrBuildingId)
|
||||
{
|
||||
placeBuildingResult.BuildingInfo.GarrPlotInstanceID = garrPlotInstanceId;
|
||||
placeBuildingResult.BuildingInfo.GarrBuildingID = garrBuildingId;
|
||||
placeBuildingResult.BuildingInfo.TimeBuilt = time(nullptr);
|
||||
placeBuildingResult.BuildingInfo.TimeBuilt = GameTime::GetGameTime();
|
||||
|
||||
Plot* plot = GetPlot(garrPlotInstanceId);
|
||||
uint32 oldBuildingId = 0;
|
||||
@@ -461,7 +462,7 @@ void Garrison::CancelBuildingConstruction(uint32 garrPlotInstanceId)
|
||||
placeBuildingResult.Result = GARRISON_SUCCESS;
|
||||
placeBuildingResult.BuildingInfo.GarrPlotInstanceID = garrPlotInstanceId;
|
||||
placeBuildingResult.BuildingInfo.GarrBuildingID = restored;
|
||||
placeBuildingResult.BuildingInfo.TimeBuilt = time(nullptr);
|
||||
placeBuildingResult.BuildingInfo.TimeBuilt = GameTime::GetGameTime();
|
||||
placeBuildingResult.BuildingInfo.Active = true;
|
||||
|
||||
plot->SetBuildingInfo(placeBuildingResult.BuildingInfo, _owner);
|
||||
@@ -832,7 +833,7 @@ bool Garrison::Building::CanActivate() const
|
||||
if (PacketInfo)
|
||||
{
|
||||
GarrBuildingEntry const* building = sGarrBuildingStore.AssertEntry(PacketInfo->GarrBuildingID);
|
||||
if (PacketInfo->TimeBuilt + building->BuildSeconds <= time(nullptr))
|
||||
if (PacketInfo->TimeBuilt + building->BuildSeconds <= GameTime::GetGameTime())
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "GameObject.h"
|
||||
#include "GameObjectAIFactory.h"
|
||||
#include "GameTables.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridDefines.h"
|
||||
#include "GossipDef.h"
|
||||
#include "GroupMgr.h"
|
||||
@@ -6050,7 +6051,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
time_t curTime = time(nullptr);
|
||||
time_t curTime = GameTime::GetGameTime();
|
||||
tm lt;
|
||||
localtime_r(&curTime, <);
|
||||
TC_LOG_INFO("misc", "Returning mails current time: hour: %d, minute: %d, second: %d ", lt.tm_hour, lt.tm_min, lt.tm_sec);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "CreatureAI.h"
|
||||
#include "DynamicObject.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameTime.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -148,7 +149,7 @@ void LoadHelper(CellGuidSet const& guid_set, CellCoord &cell, GridRefManager<T>
|
||||
// If script is blocking spawn, don't spawn but queue for a re-check in a little bit
|
||||
if (!(group->flags & SPAWNGROUP_FLAG_COMPATIBILITY_MODE) && !sScriptMgr->CanSpawn(guid, cdata->id, cdata, map))
|
||||
{
|
||||
map->SaveRespawnTime(SPAWN_TYPE_CREATURE, guid, cdata->id, time(nullptr) + urand(4,7), map->GetZoneId(PhasingHandler::GetEmptyPhaseShift(), cdata->spawnPoint), Trinity::ComputeGridCoord(cdata->spawnPoint.GetPositionX(), cdata->spawnPoint.GetPositionY()).GetId(), false);
|
||||
map->SaveRespawnTime(SPAWN_TYPE_CREATURE, guid, cdata->id, GameTime::GetGameTime() + urand(4,7), map->GetZoneId(PhasingHandler::GetEmptyPhaseShift(), cdata->spawnPoint), Trinity::ComputeGridCoord(cdata->spawnPoint.GetPositionX(), cdata->spawnPoint.GetPositionY()).GetId(), false);
|
||||
delete obj;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "Config.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "GameTime.h"
|
||||
#include "GuildFinderMgr.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "GuildPackets.h"
|
||||
@@ -118,6 +119,8 @@ inline uint32 Guild::LogHolder::GetNextGUID()
|
||||
return m_nextGUID;
|
||||
}
|
||||
|
||||
Guild::LogEntry::LogEntry(ObjectGuid::LowType guildId, uint32 guid) : m_guildId(guildId), m_guid(guid), m_timestamp(GameTime::GetGameTime()) { }
|
||||
|
||||
// EventLogEntry
|
||||
void Guild::EventLogEntry::SaveToDB(CharacterDatabaseTransaction& trans) const
|
||||
{
|
||||
@@ -147,7 +150,7 @@ void Guild::EventLogEntry::WritePacket(WorldPackets::Guild::GuildEventLogQueryRe
|
||||
eventEntry.PlayerGUID = playerGUID;
|
||||
eventEntry.OtherGUID = otherGUID;
|
||||
eventEntry.TransactionType = uint8(m_eventType);
|
||||
eventEntry.TransactionDate = uint32(::time(nullptr) - m_timestamp);
|
||||
eventEntry.TransactionDate = uint32(GameTime::GetGameTime() - m_timestamp);
|
||||
eventEntry.RankID = uint8(m_newRank);
|
||||
packet.Entry.push_back(eventEntry);
|
||||
}
|
||||
@@ -190,7 +193,7 @@ void Guild::BankEventLogEntry::WritePacket(WorldPackets::Guild:: GuildBankLogQue
|
||||
|
||||
WorldPackets::Guild::GuildBankLogEntry bankLogEntry;
|
||||
bankLogEntry.PlayerGUID = logGuid;
|
||||
bankLogEntry.TimeOffset = int32(time(nullptr) - m_timestamp);
|
||||
bankLogEntry.TimeOffset = int32(GameTime::GetGameTime() - m_timestamp);
|
||||
bankLogEntry.EntryType = int8(m_eventType);
|
||||
|
||||
if (hasStack)
|
||||
@@ -517,7 +520,7 @@ Guild::Member::Member(ObjectGuid::LowType guildId, ObjectGuid guid, uint8 rankId
|
||||
m_class(0),
|
||||
_gender(0),
|
||||
m_flags(GUILDMEMBER_STATUS_NONE),
|
||||
m_logoutTime(::time(nullptr)),
|
||||
m_logoutTime(GameTime::GetGameTime()),
|
||||
m_accountId(0),
|
||||
m_rankId(rankId),
|
||||
m_bankWithdrawMoney(0),
|
||||
@@ -592,6 +595,11 @@ void Guild::Member::ChangeRank(CharacterDatabaseTransaction& trans, uint8 newRan
|
||||
CharacterDatabase.ExecuteOrAppend(trans, stmt);
|
||||
}
|
||||
|
||||
void Guild::Member::UpdateLogoutTime()
|
||||
{
|
||||
m_logoutTime = GameTime::GetGameTime();
|
||||
}
|
||||
|
||||
void Guild::Member::SaveToDB(CharacterDatabaseTransaction& trans) const
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_MEMBER);
|
||||
@@ -662,7 +670,7 @@ float Guild::Member::GetInactiveDays() const
|
||||
{
|
||||
if (IsOnline())
|
||||
return 0.0f;
|
||||
return float(::time(nullptr) - GetLogoutTime()) / float(DAY);
|
||||
return float(GameTime::GetGameTime() - GetLogoutTime()) / float(DAY);
|
||||
}
|
||||
|
||||
// Decreases amount of slots left for today.
|
||||
@@ -1146,7 +1154,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();
|
||||
_CreateLogHolders();
|
||||
|
||||
TC_LOG_DEBUG("guild", "GUILD: creating guild [%s] for leader %s (%s)",
|
||||
|
||||
@@ -355,7 +355,7 @@ class TC_GAME_API Guild
|
||||
|
||||
void ChangeRank(CharacterDatabaseTransaction& 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; }
|
||||
@@ -401,7 +401,7 @@ class TC_GAME_API Guild
|
||||
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() { }
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "GuildFinderMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "GameTime.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "GuildFinderPackets.h"
|
||||
@@ -26,7 +27,7 @@
|
||||
#include "Player.h"
|
||||
#include "World.h"
|
||||
|
||||
MembershipRequest::MembershipRequest() : _availability(0), _classRoles(0), _interests(0), _time(time(nullptr))
|
||||
MembershipRequest::MembershipRequest() : _availability(0), _classRoles(0), _interests(0), _time(GameTime::GetGameTime())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "Battlefield.h"
|
||||
#include "BattlefieldMgr.h"
|
||||
#include "BattlefieldPackets.h"
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
|
||||
/**
|
||||
@@ -35,7 +36,7 @@ void WorldSession::SendBfInvitePlayerToWar(uint64 queueId, uint32 zoneId, uint32
|
||||
WorldPackets::Battlefield::BFMgrEntryInvite bfMgrEntryInvite;
|
||||
bfMgrEntryInvite.QueueID = queueId;
|
||||
bfMgrEntryInvite.AreaID = zoneId;
|
||||
bfMgrEntryInvite.ExpireTime = time(nullptr) + acceptTime;
|
||||
bfMgrEntryInvite.ExpireTime = GameTime::GetGameTime() + acceptTime;
|
||||
SendPacket(bfMgrEntryInvite.Write());
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ Copied events should probably have a new owner
|
||||
#include "CharacterCache.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "GameTime.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
@@ -54,7 +55,7 @@ Copied events should probably have a new owner
|
||||
void WorldSession::HandleCalendarGetCalendar(WorldPackets::Calendar::CalendarGetCalendar& /*calendarGetCalendar*/)
|
||||
{
|
||||
ObjectGuid guid = _player->GetGUID();
|
||||
time_t currTime = time(nullptr);
|
||||
time_t currTime = GameTime::GetGameTime();
|
||||
|
||||
WorldPackets::Calendar::CalendarSendCalendar packet;
|
||||
packet.ServerTime = currTime;
|
||||
@@ -136,7 +137,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPackets::Calendar::CalendarAddEve
|
||||
|
||||
// prevent events in the past
|
||||
// To Do: properly handle timezones and remove the "- time_t(86400L)" hack
|
||||
if (calendarAddEvent.EventInfo.Time < (time(nullptr) - time_t(86400L)))
|
||||
if (calendarAddEvent.EventInfo.Time < (GameTime::GetGameTime() - time_t(86400L)))
|
||||
return;
|
||||
|
||||
CalendarEvent* calendarEvent = new CalendarEvent(sCalendarMgr->GetFreeEventId(), guid, UI64LIT(0), CalendarEventType(calendarAddEvent.EventInfo.EventType), calendarAddEvent.EventInfo.TextureID,
|
||||
@@ -181,7 +182,7 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPackets::Calendar::CalendarUpd
|
||||
|
||||
// prevent events in the past
|
||||
// To Do: properly handle timezones and remove the "- time_t(86400L)" hack
|
||||
if (calendarUpdateEvent.EventInfo.Time < (time(nullptr) - time_t(86400L)))
|
||||
if (calendarUpdateEvent.EventInfo.Time < (GameTime::GetGameTime() - time_t(86400L)))
|
||||
return;
|
||||
|
||||
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(calendarUpdateEvent.EventInfo.EventID))
|
||||
@@ -214,7 +215,7 @@ void WorldSession::HandleCalendarCopyEvent(WorldPackets::Calendar::CalendarCopyE
|
||||
|
||||
// prevent events in the past
|
||||
// To Do: properly handle timezones and remove the "- time_t(86400L)" hack
|
||||
if (calendarCopyEvent.Date < (time(nullptr) - time_t(86400L)))
|
||||
if (calendarCopyEvent.Date < (GameTime::GetGameTime() - time_t(86400L)))
|
||||
return;
|
||||
|
||||
if (CalendarEvent* oldEvent = sCalendarMgr->GetEvent(calendarCopyEvent.EventID))
|
||||
@@ -339,7 +340,7 @@ void WorldSession::HandleCalendarEventSignup(WorldPackets::Calendar::CalendarEve
|
||||
}
|
||||
|
||||
CalendarInviteStatus status = calendarEventSignUp.Tentative ? CALENDAR_STATUS_TENTATIVE : CALENDAR_STATUS_SIGNED_UP;
|
||||
CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEventSignUp.EventID, guid, guid, time(nullptr), status, CALENDAR_RANK_PLAYER, "");
|
||||
CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), calendarEventSignUp.EventID, guid, guid, GameTime::GetGameTime(), status, CALENDAR_RANK_PLAYER, "");
|
||||
sCalendarMgr->AddInvite(calendarEvent, invite);
|
||||
sCalendarMgr->SendCalendarClearPendingAction(guid);
|
||||
}
|
||||
@@ -363,7 +364,7 @@ void WorldSession::HandleCalendarRsvp(WorldPackets::Calendar::CalendarRSVP& cale
|
||||
if (CalendarInvite* invite = sCalendarMgr->GetInvite(calendarRSVP.InviteID))
|
||||
{
|
||||
invite->SetStatus(CalendarInviteStatus(calendarRSVP.Status));
|
||||
invite->SetResponseTime(time(nullptr));
|
||||
invite->SetResponseTime(GameTime::GetGameTime());
|
||||
|
||||
sCalendarMgr->UpdateInvite(invite);
|
||||
sCalendarMgr->SendCalendarEventStatus(*calendarEvent, *invite);
|
||||
@@ -500,7 +501,7 @@ void WorldSession::HandleSetSavedInstanceExtend(WorldPackets::Calendar::SetSaved
|
||||
|
||||
void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add)
|
||||
{
|
||||
time_t currTime = time(nullptr);
|
||||
time_t currTime = GameTime::GetGameTime();
|
||||
if (add)
|
||||
{
|
||||
WorldPackets::Calendar::CalendarRaidLockoutAdded calendarRaidLockoutAdded;
|
||||
@@ -529,7 +530,7 @@ void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save)
|
||||
ObjectGuid guid = _player->GetGUID();
|
||||
TC_LOG_DEBUG("network", "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [%s] Map: %u, Difficulty %u", guid.ToString().c_str(), save->GetMapId(), save->GetDifficultyID());
|
||||
|
||||
time_t currTime = time(nullptr);
|
||||
time_t currTime = GameTime::GetGameTime();
|
||||
|
||||
WorldPackets::Calendar::CalendarRaidLockoutUpdated packet;
|
||||
packet.DifficultyID = save->GetDifficultyID();
|
||||
|
||||
@@ -187,7 +187,7 @@ bool LoginQueryHolder::Initialize()
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_MAILCOUNT);
|
||||
stmt->setUInt64(0, lowGuid);
|
||||
stmt->setUInt64(1, uint64(time(nullptr)));
|
||||
stmt->setUInt64(1, GameTime::GetGameTime());
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL_COUNT, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_MAILDATE);
|
||||
@@ -2579,7 +2579,7 @@ void WorldSession::HandleUndeleteCooldownStatusCallback(PreparedQueryResult resu
|
||||
if (result)
|
||||
{
|
||||
uint32 lastUndelete = result->Fetch()[0].GetUInt32();
|
||||
uint32 now = uint32(time(nullptr));
|
||||
uint32 now = uint32(GameTime::GetGameTime());
|
||||
if (lastUndelete + maxCooldown > now)
|
||||
cooldown = std::max<uint32>(0, lastUndelete + maxCooldown - now);
|
||||
}
|
||||
@@ -2606,7 +2606,7 @@ void WorldSession::HandleCharUndeleteOpcode(WorldPackets::Character::UndeleteCha
|
||||
{
|
||||
uint32 lastUndelete = result->Fetch()[0].GetUInt32();
|
||||
uint32 maxCooldown = sWorld->getIntConfig(CONFIG_FEATURE_SYSTEM_CHARACTER_UNDELETE_COOLDOWN);
|
||||
if (lastUndelete && (lastUndelete + maxCooldown > time(nullptr)))
|
||||
if (lastUndelete && (lastUndelete + maxCooldown > GameTime::GetGameTime()))
|
||||
{
|
||||
SendUndeleteCharacterResponse(CHARACTER_UNDELETE_RESULT_ERROR_COOLDOWN, undeleteInfo.get());
|
||||
return;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "Common.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Group.h"
|
||||
#include "Guild.h"
|
||||
@@ -170,7 +171,7 @@ void WorldSession::HandleChatMessage(ChatMsg type, uint32 lang, std::string msg,
|
||||
|
||||
if (!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;
|
||||
}
|
||||
@@ -588,7 +589,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPackets::Chat::CTextEmote& packet)
|
||||
|
||||
if (!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 "DuelPackets.h"
|
||||
#include "GameTime.h"
|
||||
#include "WorldSession.h"
|
||||
#include "Log.h"
|
||||
#include "Player.h"
|
||||
@@ -68,7 +69,7 @@ void WorldSession::HandleDuelAccepted()
|
||||
TC_LOG_DEBUG("network", "Player 1 is: %s (%s)", player->GetGUID().ToString().c_str(), player->GetName().c_str());
|
||||
TC_LOG_DEBUG("network", "Player 2 is: %s (%s)", plTarget->GetGUID().ToString().c_str(), 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 "CharacterCache.h"
|
||||
#include "WorldSession.h"
|
||||
#include "GameTime.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildFinderMgr.h"
|
||||
#include "GuildFinderPackets.h"
|
||||
@@ -42,7 +43,7 @@ void WorldSession::HandleGuildFinderAddRecruit(WorldPackets::GuildFinder::LFGuil
|
||||
return;
|
||||
|
||||
MembershipRequest request = MembershipRequest(GetPlayer()->GetGUID(), lfGuildAddRecruit.GuildGUID, lfGuildAddRecruit.Availability,
|
||||
lfGuildAddRecruit.ClassRoles, lfGuildAddRecruit.PlayStyle, lfGuildAddRecruit.Comment, time(nullptr));
|
||||
lfGuildAddRecruit.ClassRoles, lfGuildAddRecruit.PlayStyle, lfGuildAddRecruit.Comment, GameTime::GetGameTime());
|
||||
sGuildFinderMgr->AddMembershipRequest(lfGuildAddRecruit.GuildGUID, request);
|
||||
}
|
||||
|
||||
@@ -125,8 +126,8 @@ void WorldSession::HandleGuildFinderGetApplications(WorldPackets::GuildFinder::L
|
||||
applicationData.ClassRoles = guildSettings.GetClassRoles();
|
||||
applicationData.PlayStyle = guildSettings.GetInterests();
|
||||
applicationData.Availability = guildSettings.GetAvailability();
|
||||
applicationData.SecondsSinceCreated = time(nullptr) - application->GetSubmitTime();
|
||||
applicationData.SecondsUntilExpiration = application->GetExpiryTime() - time(nullptr);
|
||||
applicationData.SecondsSinceCreated = GameTime::GetGameTime() - application->GetSubmitTime();
|
||||
applicationData.SecondsUntilExpiration = application->GetExpiryTime() - GameTime::GetGameTime();
|
||||
applicationData.Comment = application->GetComment();
|
||||
}
|
||||
|
||||
@@ -165,7 +166,7 @@ void WorldSession::HandleGuildFinderGetRecruits(WorldPackets::GuildFinder::LFGui
|
||||
if (!guild)
|
||||
return;
|
||||
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
WorldPackets::GuildFinder::LFGuildRecruits lfGuildRecruits;
|
||||
lfGuildRecruits.UpdateTime = now;
|
||||
if (std::unordered_map<ObjectGuid, MembershipRequest> const* recruitsList = sGuildFinderMgr->GetAllMembershipRequestsForGuild(guild->GetGUID()))
|
||||
|
||||
@@ -52,7 +52,7 @@ void WorldSession::HandleDBQueryBulk(WorldPackets::Hotfix::DBQueryBulk& dbQuery)
|
||||
else
|
||||
{
|
||||
TC_LOG_TRACE("network", "CMSG_DB_QUERY_BULK: %s requested non-existing entry %u in datastore: %u", GetPlayerInfo().c_str(), record.RecordID, dbQuery.TableHash);
|
||||
dbReply.Timestamp = time(nullptr);
|
||||
dbReply.Timestamp = GameTime::GetGameTime();
|
||||
}
|
||||
|
||||
SendPacket(dbReply.Write());
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "CharacterCache.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "WorldSession.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "LFGMgr.h"
|
||||
#include "LFGPackets.h"
|
||||
@@ -418,7 +419,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)
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "GossipDef.h"
|
||||
#include "GameTime.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "Item.h"
|
||||
@@ -384,7 +385,7 @@ void WorldSession::HandleMailReturnToSender(WorldPackets::Mail::MailReturnToSend
|
||||
|
||||
Player* player = _player;
|
||||
Mail* m = player->GetMail(packet.MailID);
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(nullptr) || m->sender != packet.SenderGUID.GetCounter())
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime() || m->sender != packet.SenderGUID.GetCounter())
|
||||
{
|
||||
player->SendMailResult(packet.MailID, MAIL_RETURNED_TO_SENDER, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
@@ -438,7 +439,7 @@ void WorldSession::HandleMailTakeItem(WorldPackets::Mail::MailTakeItem& packet)
|
||||
Player* player = _player;
|
||||
|
||||
Mail* m = player->GetMail(packet.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(packet.MailID, MAIL_ITEM_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
@@ -534,7 +535,7 @@ void WorldSession::HandleMailTakeMoney(WorldPackets::Mail::MailTakeMoney& packet
|
||||
Player* player = _player;
|
||||
|
||||
Mail* m = player->GetMail(packet.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()) ||
|
||||
(packet.Money > 0 && m->money != uint64(packet.Money)))
|
||||
{
|
||||
player->SendMailResult(packet.MailID, MAIL_MONEY_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||
@@ -573,7 +574,7 @@ void WorldSession::HandleGetMailList(WorldPackets::Mail::MailGetList& packet)
|
||||
player->_LoadMail();
|
||||
|
||||
WorldPackets::Mail::MailListResult response;
|
||||
time_t curTime = time(nullptr);
|
||||
time_t curTime = GameTime::GetGameTime();
|
||||
|
||||
for (Mail* m : player->GetMails())
|
||||
{
|
||||
@@ -605,7 +606,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPackets::Mail::MailCreateTextIt
|
||||
Player* player = _player;
|
||||
|
||||
Mail* m = player->GetMail(packet.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(packet.MailID, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
@@ -663,7 +664,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPackets::Mail::MailQueryNextMail
|
||||
{
|
||||
result.NextMailTime = 0.0f;
|
||||
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
std::set<ObjectGuid::LowType> sentSenders;
|
||||
|
||||
for (Mail* mail : _player->GetMails())
|
||||
|
||||
@@ -283,7 +283,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPackets::Character::LogoutRequ
|
||||
GetPlayer()->AddUnitFlag(UNIT_FLAG_STUNNED);
|
||||
}
|
||||
|
||||
SetLogoutStartTime(time(nullptr));
|
||||
SetLogoutStartTime(GameTime::GetGameTime());
|
||||
}
|
||||
|
||||
void WorldSession::HandleLogoutCancelOpcode(WorldPackets::Character::LogoutCancel& /*logoutCancel*/)
|
||||
@@ -317,7 +317,7 @@ void WorldSession::HandleTogglePvP(WorldPackets::Misc::TogglePvP& /*packet*/)
|
||||
GetPlayer()->RemovePlayerFlag(PLAYER_FLAGS_IN_PVP);
|
||||
GetPlayer()->AddPlayerFlag(PLAYER_FLAGS_PVP_TIMER);
|
||||
if (!GetPlayer()->pvpInfo.IsHostile && GetPlayer()->IsPvP())
|
||||
GetPlayer()->pvpInfo.EndTimer = time(nullptr); // start toggle-off
|
||||
GetPlayer()->pvpInfo.EndTimer = GameTime::GetGameTime(); // start toggle-off
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -335,7 +335,7 @@ void WorldSession::HandleSetPvP(WorldPackets::Misc::SetPvP& packet)
|
||||
GetPlayer()->RemovePlayerFlag(PLAYER_FLAGS_IN_PVP);
|
||||
GetPlayer()->AddPlayerFlag(PLAYER_FLAGS_PVP_TIMER);
|
||||
if (!GetPlayer()->pvpInfo.IsHostile && GetPlayer()->IsPvP())
|
||||
GetPlayer()->pvpInfo.EndTimer = time(nullptr); // start toggle-off
|
||||
GetPlayer()->pvpInfo.EndTimer = GameTime::GetGameTime(); // start toggle-off
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -412,7 +412,7 @@ void WorldSession::HandleReclaimCorpse(WorldPackets::Misc::ReclaimCorpse& /*pack
|
||||
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))
|
||||
|
||||
@@ -186,7 +186,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -595,7 +595,7 @@ void WorldSession::HandlePetRename(WorldPackets::Pet::PetRename& packet)
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
pet->SetPetNameTimestamp(uint32(time(nullptr)));
|
||||
pet->SetPetNameTimestamp(uint32(GameTime::GetGameTime()));
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetAbandon(WorldPackets::Pet::PetAbandon& packet)
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "Config.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridStates.h"
|
||||
#include "Group.h"
|
||||
@@ -112,7 +113,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));
|
||||
}
|
||||
@@ -312,7 +313,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
|
||||
@@ -526,12 +527,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())
|
||||
@@ -648,7 +649,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->MapName[sWorld->GetDefaultDbcLocale()], mapid, uint8(difficulty), warn);
|
||||
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
|
||||
if (!warn)
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "CalendarMgr.h"
|
||||
#include "CharacterCache.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Item.h"
|
||||
#include "Log.h"
|
||||
#include "LootMgr.h"
|
||||
@@ -194,7 +195,7 @@ void MailDraft::SendMailTo(CharacterDatabaseTransaction& trans, MailReceiver con
|
||||
|
||||
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;
|
||||
|
||||
@@ -3133,7 +3133,7 @@ bool Map::CheckRespawn(RespawnInfo* info)
|
||||
: ObjectGuid::Create<HighGuid::Creature>(GetId(), info->entry, info->spawnId);
|
||||
if (time_t linkedTime = GetLinkedRespawnTime(thisGUID))
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
time_t respawnTime;
|
||||
if (linkedTime == std::numeric_limits<time_t>::max())
|
||||
respawnTime = linkedTime;
|
||||
@@ -3164,7 +3164,7 @@ bool Map::CheckRespawn(RespawnInfo* info)
|
||||
{
|
||||
if (!sScriptMgr->CanSpawn(info->spawnId, info->entry, sObjectMgr->GetCreatureData(info->spawnId), this))
|
||||
{ // if a script blocks our respawn, schedule next check in a little bit
|
||||
info->respawnTime = time(nullptr) + urand(4, 7);
|
||||
info->respawnTime = GameTime::GetGameTime() + urand(4, 7);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -3337,7 +3337,7 @@ void Map::RemoveRespawnTime(RespawnVector& respawnData, bool doRespawn, Characte
|
||||
|
||||
void Map::ProcessRespawns()
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
while (!_respawnTimes.empty())
|
||||
{
|
||||
RespawnInfo* next = _respawnTimes.top();
|
||||
@@ -3434,7 +3434,7 @@ bool Map::SpawnGroupSpawn(uint32 groupId, bool ignoreRespawn, bool force, std::v
|
||||
continue;
|
||||
|
||||
time_t respawnTime = GetRespawnTime(data->type, data->spawnId);
|
||||
if (respawnTime && respawnTime > time(nullptr))
|
||||
if (respawnTime && respawnTime > GameTime::GetGameTime())
|
||||
{
|
||||
if (!force && !ignoreRespawn)
|
||||
continue;
|
||||
@@ -3897,7 +3897,7 @@ bool InstanceMap::AddPlayerToMap(Player* player, bool initPlayer /*= true*/)
|
||||
|
||||
// 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());
|
||||
@@ -4756,7 +4756,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());
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "AchievementPackets.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DB2Structure.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "Log.h"
|
||||
#include "Map.h"
|
||||
@@ -87,7 +88,7 @@ void QuestObjectiveCriteriaMgr::LoadFromDB(PreparedQueryResult objectiveResult,
|
||||
|
||||
if (criteriaResult)
|
||||
{
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
do
|
||||
{
|
||||
Field* fields = criteriaResult->Fetch();
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "InstanceScenario.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "GameTime.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
#include "Log.h"
|
||||
#include "Map.h"
|
||||
@@ -97,7 +98,7 @@ void InstanceScenario::LoadInstanceData(uint32 instanceId)
|
||||
if (result)
|
||||
{
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
|
||||
std::vector<CriteriaTree const*> criteriaTrees;
|
||||
do
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "MailPackets.h"
|
||||
#include "GameTime.h"
|
||||
#include "Item.h"
|
||||
#include "Mail.h"
|
||||
#include "Player.h"
|
||||
@@ -100,7 +101,7 @@ WorldPackets::Mail::MailListEntry::MailListEntry(::Mail const* mail, ::Player* p
|
||||
StationeryID = mail->stationery;
|
||||
SentMoney = mail->money;
|
||||
Flags = mail->checked;
|
||||
DaysLeft = float(mail->expire_time - time(nullptr)) / DAY;
|
||||
DaysLeft = float(mail->expire_time - GameTime::GetGameTime()) / DAY;
|
||||
MailTemplateID = mail->mailTemplateId;
|
||||
Subject = mail->subject;
|
||||
Body = mail->body;
|
||||
@@ -250,7 +251,7 @@ WorldPackets::Mail::MailQueryNextTimeResult::MailNextTimeEntry::MailNextTimeEntr
|
||||
break;
|
||||
}
|
||||
|
||||
TimeLeft = mail->deliver_time - time(nullptr);
|
||||
TimeLeft = mail->deliver_time - GameTime::GetGameTime();
|
||||
AltSenderType = mail->messageType;
|
||||
StationeryID = mail->stationery;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "PacketLog.h"
|
||||
#include "Config.h"
|
||||
#include "GameTime.h"
|
||||
#include "IpAddress.h"
|
||||
#include "Realm.h"
|
||||
#include "Timer.h"
|
||||
@@ -100,7 +101,7 @@ void PacketLog::Initialize()
|
||||
header.Build = realm.Build;
|
||||
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;
|
||||
|
||||
|
||||
@@ -261,13 +261,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)
|
||||
{
|
||||
@@ -336,7 +336,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[CONNECTION_TYPE_REALM] && _recvQueue.next(packet, updater))
|
||||
{
|
||||
@@ -456,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.IsEmpty())
|
||||
if (ShouldLogOut(currentTime) && m_playerLoading.IsEmpty())
|
||||
LogoutPlayer(true);
|
||||
|
||||
if (m_Socket[CONNECTION_TYPE_REALM] && GetPlayer() && _warden)
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "CryptoRandom.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Errors.h"
|
||||
#include "GameTime.h"
|
||||
#include "HMAC.h"
|
||||
#include "IPLocation.h"
|
||||
#include "PacketLog.h"
|
||||
@@ -810,7 +811,7 @@ void WorldSocket::HandleAuthSessionCallback(std::shared_ptr<WorldPackets::Auth::
|
||||
//! 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);
|
||||
|
||||
@@ -348,7 +348,7 @@ Aura::Aura(SpellInfo const* spellproto, ObjectGuid castId, WorldObject* owner, U
|
||||
m_spellInfo(spellproto), m_castDifficulty(castDifficulty), m_castGuid(castId), m_casterGuid(!casterGUID.IsEmpty() ? casterGUID : caster->GetGUID()),
|
||||
m_castItemGuid(castItem ? castItem->GetGUID() : castItemGuid), m_castItemId(castItem ? castItem->GetEntry() : castItemId),
|
||||
m_castItemLevel(castItemLevel), m_spellVisual({ caster ? caster->GetCastSpellXSpellVisualId(spellproto) : spellproto->GetSpellXSpellVisualId(), 0 }),
|
||||
m_applyTime(time(nullptr)), m_owner(owner), m_timeCla(0), m_updateTargetMapInterval(0),
|
||||
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_isSingleTarget(false), m_isUsingCharges(false), m_dropEvent(nullptr),
|
||||
m_procCooldown(std::chrono::steady_clock::time_point::min()),
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "CharacterCache.h"
|
||||
#include "Chat.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectAccessor.h"
|
||||
@@ -28,11 +29,11 @@
|
||||
#include "World.h"
|
||||
#include <sstream>
|
||||
|
||||
inline time_t GetAge(uint64 t) { return (time(nullptr) - t) / DAY; }
|
||||
inline time_t GetAge(uint64 t) { return (GameTime::GetGameTime() - t) / DAY; }
|
||||
|
||||
Ticket::Ticket() : _id(0), _mapId(0), _createTime(0) { }
|
||||
|
||||
Ticket::Ticket(Player* player) : _id(0), _mapId(0), _createTime(time(nullptr))
|
||||
Ticket::Ticket(Player* player) : _id(0), _mapId(0), _createTime(GameTime::GetGameTime())
|
||||
{
|
||||
_playerGuid = player->GetGUID();
|
||||
}
|
||||
@@ -156,7 +157,7 @@ void BugTicket::DeleteFromDB()
|
||||
|
||||
std::string BugTicket::FormatViewMessageString(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);
|
||||
@@ -280,7 +281,7 @@ void ComplaintTicket::DeleteFromDB()
|
||||
|
||||
std::string ComplaintTicket::FormatViewMessageString(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);
|
||||
@@ -367,7 +368,7 @@ void SuggestionTicket::DeleteFromDB()
|
||||
|
||||
std::string SuggestionTicket::FormatViewMessageString(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);
|
||||
@@ -796,5 +797,5 @@ TC_GAME_API void SupportMgr::ShowClosedList<SuggestionTicket>(ChatHandler& handl
|
||||
|
||||
void SupportMgr::UpdateLastChange()
|
||||
{
|
||||
_lastChange = uint64(time(nullptr));
|
||||
_lastChange = GameTime::GetGameTime();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
namespace GameTime
|
||||
{
|
||||
time_t const StartTime = time(nullptr);
|
||||
time_t const StartTime = GameTime::GetGameTime();
|
||||
|
||||
time_t GameTime = 0;
|
||||
uint32 GameMSTime = 0;
|
||||
@@ -68,7 +68,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();
|
||||
|
||||
@@ -152,7 +152,7 @@ World::World()
|
||||
_guidWarn = false;
|
||||
_guidAlert = false;
|
||||
_warnDiff = 0;
|
||||
_warnShutdownTime = time(nullptr);
|
||||
_warnShutdownTime = GameTime::GetGameTime();
|
||||
}
|
||||
|
||||
/// World destructor
|
||||
@@ -419,7 +419,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;
|
||||
@@ -1641,7 +1641,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);
|
||||
@@ -2581,7 +2581,7 @@ void World::Update(uint32 diff)
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_OLD_LOGS);
|
||||
|
||||
stmt->setUInt32(0, sWorld->getIntConfig(CONFIG_LOGDB_CLEARTIME));
|
||||
stmt->setUInt32(1, uint32(time(nullptr)));
|
||||
stmt->setUInt32(1, uint32(GameTime::GetGameTime()));
|
||||
stmt->setUInt32(2, realm.Id.Realm);
|
||||
|
||||
LoginDatabase.Execute(stmt);
|
||||
@@ -3220,7 +3220,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;
|
||||
@@ -3308,7 +3308,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);
|
||||
}
|
||||
|
||||
@@ -3327,7 +3327,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);
|
||||
@@ -3350,7 +3350,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);
|
||||
}
|
||||
|
||||
@@ -3358,10 +3358,10 @@ void World::InitRandomBGResetTime()
|
||||
{
|
||||
time_t bgtime = sWorld->getWorldState(WS_BG_DAILY_RESET_TIME);
|
||||
if (!bgtime)
|
||||
m_NextRandomBGReset = time(nullptr); // game time not yet init
|
||||
m_NextRandomBGReset = 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);
|
||||
@@ -3386,10 +3386,10 @@ void World::InitGuildResetTime()
|
||||
{
|
||||
time_t gtime = getWorldState(WS_GUILD_DAILY_RESET_TIME);
|
||||
if (!gtime)
|
||||
m_NextGuildReset = time(nullptr); // game time not yet init
|
||||
m_NextGuildReset = 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);
|
||||
@@ -3414,10 +3414,10 @@ void World::InitCurrencyResetTime()
|
||||
{
|
||||
time_t currencytime = sWorld->getWorldState(WS_CURRENCY_RESET_TIME);
|
||||
if (!currencytime)
|
||||
m_NextCurrencyReset = time(nullptr); // game time not yet init
|
||||
m_NextCurrencyReset = 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);
|
||||
|
||||
@@ -3520,7 +3520,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"
|
||||
@@ -284,7 +285,7 @@ public:
|
||||
|
||||
time_t unbanDate = time_t(fields[3].GetUInt32());
|
||||
bool active = false;
|
||||
if (fields[2].GetBool() && (fields[1].GetUInt64() == uint64(0) || unbanDate >= 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);
|
||||
@@ -340,7 +341,7 @@ public:
|
||||
Field* fields = result->Fetch();
|
||||
time_t unbanDate = fields[3].GetInt64();
|
||||
bool active = false;
|
||||
if (fields[2].GetUInt8() && (!fields[1].GetInt64() || unbanDate >= time(nullptr)))
|
||||
if (fields[2].GetUInt8() && (!fields[1].GetInt64() || unbanDate >= GameTime::GetGameTime()))
|
||||
active = true;
|
||||
bool permanent = (fields[1].GetInt64() == SI64LIT(0));
|
||||
std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetInt64(), true);
|
||||
|
||||
@@ -25,6 +25,7 @@ EndScriptData */
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
#include "RBAC.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);
|
||||
|
||||
@@ -28,6 +28,7 @@ EndScriptData */
|
||||
#include "DB2Stores.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "MapManager.h"
|
||||
@@ -323,7 +324,7 @@ public:
|
||||
|
||||
if (target)
|
||||
{
|
||||
int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - time(nullptr));
|
||||
int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - GameTime::GetGameTime());
|
||||
if (curRespawnDelay < 0)
|
||||
curRespawnDelay = 0;
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ EndScriptData */
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
#include "InstanceScript.h"
|
||||
@@ -89,7 +90,7 @@ public:
|
||||
for (auto itr = binds->second.begin(); itr != binds->second.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->GetDifficultyID(), save->CanReset() ? "yes" : "no", timeleft.c_str());
|
||||
counter++;
|
||||
}
|
||||
@@ -108,7 +109,7 @@ public:
|
||||
for (auto itr = binds->second.begin(); itr != binds->second.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->GetDifficultyID(), save->CanReset() ? "yes" : "no", timeleft.c_str());
|
||||
counter++;
|
||||
}
|
||||
@@ -154,7 +155,7 @@ public:
|
||||
InstanceSave* save = itr->second.save;
|
||||
if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficultyID()))
|
||||
{
|
||||
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->GetDifficultyID(), save->CanReset() ? "yes" : "no", timeleft.c_str());
|
||||
player->UnbindInstance(itr, binds);
|
||||
counter++;
|
||||
|
||||
@@ -29,6 +29,7 @@ EndScriptData */
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DB2Stores.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "MapManager.h"
|
||||
#include "ObjectAccessor.h"
|
||||
@@ -714,7 +715,7 @@ public:
|
||||
uint32 gridY = ri->gridId / MAX_NUMBER_OF_GRIDS;
|
||||
uint32 gridX = ri->gridId % MAX_NUMBER_OF_GRIDS;
|
||||
|
||||
std::string respawnTime = ri->respawnTime > time(NULL) ? 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(UI64FMTD " | %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");
|
||||
}
|
||||
|
||||
@@ -735,7 +736,7 @@ public:
|
||||
uint32 gridY = ri->gridId / MAX_NUMBER_OF_GRIDS;
|
||||
uint32 gridX = ri->gridId % MAX_NUMBER_OF_GRIDS;
|
||||
|
||||
std::string respawnTime = ri->respawnTime > time(NULL) ? 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(UI64FMTD " | %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;
|
||||
|
||||
@@ -1843,11 +1843,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);
|
||||
@@ -2020,7 +2020,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);
|
||||
|
||||
@@ -27,6 +27,7 @@ EndScriptData */
|
||||
#include "CreatureAI.h"
|
||||
#include "CreatureGroups.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "Map.h"
|
||||
@@ -823,7 +824,7 @@ public:
|
||||
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;
|
||||
|
||||
@@ -404,7 +404,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)
|
||||
@@ -432,7 +432,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
|
||||
@@ -853,7 +853,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
|
||||
_controller.SetTransport(creature->GetTransport());
|
||||
me->SetRegenerateHealth(false);
|
||||
me->m_CombatDistance = 70.0f;
|
||||
_firstMageCooldown = time(nullptr) + 60;
|
||||
_firstMageCooldown = GameTime::GetGameTime() + 60;
|
||||
_axethrowersYellCooldown = time_t(0);
|
||||
_rocketeersYellCooldown = time_t(0);
|
||||
}
|
||||
@@ -863,7 +863,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);
|
||||
}
|
||||
@@ -915,7 +915,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
|
||||
@@ -1049,10 +1049,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);
|
||||
@@ -1060,10 +1060,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);
|
||||
@@ -1122,7 +1122,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
|
||||
_controller.SetTransport(creature->GetTransport());
|
||||
me->SetRegenerateHealth(false);
|
||||
me->m_CombatDistance = 70.0f;
|
||||
_firstMageCooldown = time(nullptr) + 60;
|
||||
_firstMageCooldown = GameTime::GetGameTime() + 60;
|
||||
_riflemanYellCooldown = time_t(0);
|
||||
_mortarYellCooldown = time_t(0);
|
||||
}
|
||||
@@ -1132,7 +1132,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);
|
||||
}
|
||||
@@ -1184,7 +1184,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
|
||||
@@ -1322,10 +1322,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);
|
||||
@@ -1333,10 +1333,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);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "vault_of_archavon.h"
|
||||
|
||||
@@ -64,13 +65,13 @@ class instance_vault_of_archavon : public InstanceMapScript
|
||||
switch (type)
|
||||
{
|
||||
case DATA_ARCHAVON:
|
||||
ArchavonDeath = time(nullptr);
|
||||
ArchavonDeath = GameTime::GetGameTime();
|
||||
break;
|
||||
case DATA_EMALON:
|
||||
EmalonDeath = time(nullptr);
|
||||
EmalonDeath = GameTime::GetGameTime();
|
||||
break;
|
||||
case DATA_KORALON:
|
||||
KoralonDeath = time(nullptr);
|
||||
KoralonDeath = GameTime::GetGameTime();
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "DB2Stores.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "GameTime.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptedCreature.h"
|
||||
@@ -309,7 +310,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);
|
||||
|
||||
@@ -2386,7 +2386,7 @@ class spell_item_crystal_prison_dummy_dnd : public SpellScript
|
||||
if (Creature* target = GetHitCreature())
|
||||
if (target->isDead() && !target->IsPet())
|
||||
{
|
||||
GetCaster()->SummonGameObject(OBJECT_IMPRISONED_DOOMGUARD, *target, QuaternionData::fromEulerAnglesZYX(target->GetOrientation(), 0.0f, 0.0f), uint32(target->GetRespawnTime()-time(nullptr)));
|
||||
GetCaster()->SummonGameObject(OBJECT_IMPRISONED_DOOMGUARD, *target, QuaternionData::fromEulerAnglesZYX(target->GetOrientation(), 0.0f, 0.0f), uint32(target->GetRespawnTime() - GameTime::GetGameTime()));
|
||||
target->DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ class spell_pal_ardent_defender : public SpellScriptLoader
|
||||
|
||||
int32 healAmount = int32(victim->CountPctFromMaxHealth(static_cast<uint32>(lroundf(_healPct * defenseFactor))));
|
||||
victim->CastCustomSpell(victim, PAL_SPELL_ARDENT_DEFENDER_HEAL, &healAmount, nullptr, nullptr, true, nullptr, aurEff);
|
||||
victim->ToPlayer()->AddSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, time(nullptr) + 120);
|
||||
victim->ToPlayer()->AddSpellCooldown(PAL_SPELL_ARDENT_DEFENDER_HEAL, 0, GameTime::GetGameTime() + 120);
|
||||
}
|
||||
else if (remainingHealth < int32(allowedHealth))
|
||||
{
|
||||
|
||||
@@ -1786,7 +1786,7 @@ public:
|
||||
void DamageTaken(Unit* doneBy, uint32& damage) override
|
||||
{
|
||||
AddThreat(doneBy, float(damage)); // just to create threat reference
|
||||
_damageTimes[doneBy->GetGUID()] = time(nullptr);
|
||||
_damageTimes[doneBy->GetGUID()] = GameTime::GetGameTime();
|
||||
damage = 0;
|
||||
}
|
||||
|
||||
@@ -1806,7 +1806,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