i.e. world update start
This commit is contained in:
parent
1b7522ff0e
commit
51b8773528
108 changed files with 933 additions and 509 deletions
|
|
@ -9,6 +9,7 @@
|
|||
#include "Pet.h"
|
||||
#include "Player.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GameTime.h"
|
||||
#include "Spell.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "SpellMgr.h"
|
||||
|
|
@ -51,7 +52,7 @@ bool PetAI::_needToStop()
|
|||
if (!me->_CanDetectFeignDeathOf(me->GetVictim()))
|
||||
return true;
|
||||
|
||||
if (me->isTargetNotAcceptableByMMaps(me->GetVictim()->GetGUID(), sWorld->GetGameTime(), me->GetVictim()))
|
||||
if (me->isTargetNotAcceptableByMMaps(me->GetVictim()->GetGUID(), GameTime::GetGameTime(), me->GetVictim()))
|
||||
return true;
|
||||
|
||||
return !me->CanCreatureAttack(me->GetVictim());
|
||||
|
|
@ -433,7 +434,7 @@ Unit* PetAI::SelectNextTarget(bool allowAutoSelect) const
|
|||
|
||||
// Check pet attackers first so we don't drag a bunch of targets to the owner
|
||||
if (Unit* myAttacker = me->getAttackerForHelper())
|
||||
if (!myAttacker->HasBreakableByDamageCrowdControlAura() && me->_CanDetectFeignDeathOf(myAttacker) && me->CanCreatureAttack(myAttacker) && !me->isTargetNotAcceptableByMMaps(myAttacker->GetGUID(), sWorld->GetGameTime(), myAttacker))
|
||||
if (!myAttacker->HasBreakableByDamageCrowdControlAura() && me->_CanDetectFeignDeathOf(myAttacker) && me->CanCreatureAttack(myAttacker) && !me->isTargetNotAcceptableByMMaps(myAttacker->GetGUID(), GameTime::GetGameTime(), myAttacker))
|
||||
return myAttacker;
|
||||
|
||||
// Check pet's attackers first to prevent dragging mobs back to owner
|
||||
|
|
@ -454,13 +455,13 @@ Unit* PetAI::SelectNextTarget(bool allowAutoSelect) const
|
|||
|
||||
// Check owner attackers
|
||||
if (Unit* ownerAttacker = owner->getAttackerForHelper())
|
||||
if (!ownerAttacker->HasBreakableByDamageCrowdControlAura() && me->_CanDetectFeignDeathOf(ownerAttacker) && me->CanCreatureAttack(ownerAttacker) && !me->isTargetNotAcceptableByMMaps(ownerAttacker->GetGUID(), sWorld->GetGameTime(), ownerAttacker))
|
||||
if (!ownerAttacker->HasBreakableByDamageCrowdControlAura() && me->_CanDetectFeignDeathOf(ownerAttacker) && me->CanCreatureAttack(ownerAttacker) && !me->isTargetNotAcceptableByMMaps(ownerAttacker->GetGUID(), GameTime::GetGameTime(), ownerAttacker))
|
||||
return ownerAttacker;
|
||||
|
||||
// Check owner victim
|
||||
// 3.0.2 - Pets now start attacking their owners victim in defensive mode as soon as the hunter does
|
||||
if (Unit* ownerVictim = owner->GetVictim())
|
||||
if (me->_CanDetectFeignDeathOf(ownerVictim) && me->CanCreatureAttack(ownerVictim) && !me->isTargetNotAcceptableByMMaps(ownerVictim->GetGUID(), sWorld->GetGameTime(), ownerVictim))
|
||||
if (me->_CanDetectFeignDeathOf(ownerVictim) && me->CanCreatureAttack(ownerVictim) && !me->isTargetNotAcceptableByMMaps(ownerVictim->GetGUID(), GameTime::GetGameTime(), ownerVictim))
|
||||
return ownerVictim;
|
||||
|
||||
// Neither pet or owner had a target and aggressive pets can pick any target
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include "Spell.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "GameTime.h"
|
||||
#include "Cell.h"
|
||||
#include "CellImpl.h"
|
||||
#include "ObjectMgr.h"
|
||||
|
|
@ -417,9 +418,9 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea()
|
|||
if (me->IsInEvadeMode() || !me->IsInCombat())
|
||||
return false;
|
||||
|
||||
if (_evadeCheckCooldown == time(NULL))
|
||||
if (_evadeCheckCooldown == GameTime::GetGameTime())
|
||||
return false;
|
||||
_evadeCheckCooldown = time(NULL);
|
||||
_evadeCheckCooldown = GameTime::GetGameTime();
|
||||
|
||||
if (!CheckEvadeIfOutOfCombatArea())
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include "DBCEnums.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
|
|
@ -434,7 +435,7 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
|
|||
birthday_tm.tm_year += birthday_login.nth_birthday;
|
||||
|
||||
time_t birthday = mktime(&birthday_tm);
|
||||
time_t now = sWorld->GetGameTime();
|
||||
time_t now = GameTime::GetGameTime();
|
||||
return now <= birthday + DAY && now >= birthday;
|
||||
}
|
||||
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_KNOWN_TITLE:
|
||||
|
|
@ -642,7 +643,7 @@ void AchievementMgr::LoadFromDB(PreparedQueryResult achievementResult, PreparedQ
|
|||
continue;
|
||||
}
|
||||
|
||||
if (criteria->timeLimit && time_t(date + criteria->timeLimit) < time(NULL))
|
||||
if (criteria->timeLimit && time_t(date + criteria->timeLimit) < GameTime::GetGameTime())
|
||||
continue;
|
||||
|
||||
CriteriaProgress& progress = m_criteriaProgress[id];
|
||||
|
|
@ -701,7 +702,7 @@ void AchievementMgr::SendAchievementEarned(AchievementEntry const* achievement)
|
|||
WorldPacket data(SMSG_ACHIEVEMENT_EARNED, 8+4+8);
|
||||
data.append(GetPlayer()->GetPackGUID());
|
||||
data << uint32(achievement->ID);
|
||||
data.AppendPackedTime(time(NULL));
|
||||
data.AppendPackedTime(GameTime::GetGameTime());
|
||||
data << uint32(0);
|
||||
GetPlayer()->SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY), true);
|
||||
}
|
||||
|
|
@ -2043,7 +2044,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
|
|||
}
|
||||
|
||||
progress->changed = true;
|
||||
progress->date = time(NULL); // set the date to the latest update.
|
||||
progress->date = GameTime::GetGameTime(); // set the date to the latest update.
|
||||
|
||||
uint32 timeElapsed = 0;
|
||||
bool timedCompleted = false;
|
||||
|
|
@ -2163,7 +2164,7 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
|
|||
|
||||
SendAchievementEarned(achievement);
|
||||
CompletedAchievementData& ca = m_completedAchievements[achievement->ID];
|
||||
ca.date = time(NULL);
|
||||
ca.date = GameTime::GetGameTime();
|
||||
ca.changed = true;
|
||||
|
||||
sScriptMgr->OnAchievementComplete(GetPlayer(), achievement);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include "World.h"
|
||||
#include "Map.h"
|
||||
#include "Battleground.h"
|
||||
#include "GameTime.h"
|
||||
#include "Pet.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
|
|
@ -178,7 +179,7 @@ namespace ArenaSpectator
|
|||
SpellCooldowns const& sc = plr->GetSpellCooldownMap();
|
||||
for (SpellCooldowns::const_iterator itrc = sc.begin(); itrc != sc.end(); ++itrc)
|
||||
if (itrc->second.sendToSpectator && itrc->second.maxduration >= SPECTATOR_COOLDOWN_MIN*IN_MILLISECONDS && itrc->second.maxduration <= SPECTATOR_COOLDOWN_MAX*IN_MILLISECONDS)
|
||||
if (uint32 cd = (getMSTimeDiff(World::GetGameTimeMS(), itrc->second.end)/1000))
|
||||
if (uint32 cd = (getMSTimeDiff(GameTime::GetGameTimeMS(), itrc->second.end)/1000))
|
||||
SendCommand_Cooldown(p, itr->first, "ACD", itrc->first, cd, itrc->second.maxduration/1000);
|
||||
|
||||
// send all visible "AUR"
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include "Item.h"
|
||||
#include "Language.h"
|
||||
#include "Logging/Log.h"
|
||||
#include "GameTime.h"
|
||||
#include <vector>
|
||||
#include "AvgDiffTracker.h"
|
||||
#include "AsyncAuctionListing.h"
|
||||
|
|
@ -424,7 +425,7 @@ bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction)
|
|||
|
||||
void AuctionHouseObject::Update()
|
||||
{
|
||||
time_t checkTime = sWorld->GetGameTime() + 60;
|
||||
time_t checkTime = GameTime::GetGameTime() + 60;
|
||||
///- Handle expired auctions
|
||||
|
||||
// If storage is empty, no need to update. next == NULL in this case.
|
||||
|
|
@ -522,7 +523,7 @@ bool AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
|
|||
return true;
|
||||
}
|
||||
|
||||
time_t curTime = sWorld->GetGameTime();
|
||||
time_t curTime = GameTime::GetGameTime();
|
||||
|
||||
int loc_idx = player->GetSession()->GetSessionDbLocaleIndex();
|
||||
int locdbc_idx = player->GetSession()->GetSessionDbcLocale();
|
||||
|
|
@ -531,7 +532,7 @@ bool AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
|
|||
{
|
||||
if (AsyncAuctionListingMgr::IsAuctionListingAllowed() == false) // pussywizard: World::Update is waiting for us...
|
||||
if ((itrcounter++) % 100 == 0) // check condition every 100 iterations
|
||||
if (avgDiffTracker.getAverage() >= 30 || getMSTimeDiff(World::GetGameTimeMS(), getMSTime()) >= 10) // pussywizard: stop immediately if diff is high or waiting too long
|
||||
if (avgDiffTracker.getAverage() >= 30 || getMSTimeDiff(GameTime::GetGameTimeMS(), getMSTime()) >= 10) // pussywizard: stop immediately if diff is high or waiting too long
|
||||
return false;
|
||||
|
||||
AuctionEntry* Aentry = itr->second;
|
||||
|
|
@ -669,7 +670,7 @@ bool AuctionEntry::BuildAuctionInfo(WorldPacket& data) const
|
|||
data << uint32(bid ? GetAuctionOutBid() : 0);
|
||||
// Minimal outbid
|
||||
data << uint32(buyout); // Auction->buyout
|
||||
data << uint32((expire_time - time(NULL)) * IN_MILLISECONDS); // time left
|
||||
data << uint32((expire_time - GameTime::GetGameTime()) * IN_MILLISECONDS); // time left
|
||||
data << uint64(bidder); // auction->bidder current
|
||||
data << uint32(bid); // current bid
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "BattlefieldMgr.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "Map.h"
|
||||
#include "MapManager.h"
|
||||
#include "Group.h"
|
||||
|
|
@ -77,7 +78,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(NULL) + (player->IsGameMaster() ? 30*MINUTE : 10);
|
||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = GameTime::GetGameTime() + (player->IsGameMaster() ? 30*MINUTE : 10);
|
||||
InvitePlayerToQueue(player);
|
||||
}
|
||||
}
|
||||
|
|
@ -167,7 +168,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(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
for (int team = 0; team < 2; team++)
|
||||
for (PlayerTimerMap::iterator itr = m_InvitedPlayers[team].begin(); itr != m_InvitedPlayers[team].end(); ++itr)
|
||||
if (itr->second <= now)
|
||||
|
|
@ -253,7 +254,7 @@ void Battlefield::InvitePlayersInZoneToWar()
|
|||
if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer)
|
||||
InvitePlayerToWar(player);
|
||||
else if (m_PlayersWillBeKick[player->GetTeamId()].count(player->GetGUID()) == 0)// Battlefield is full of players
|
||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + 10;
|
||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = GameTime::GetGameTime() + 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -277,7 +278,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(NULL) + 10;
|
||||
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = GameTime::GetGameTime() + 10;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -286,7 +287,7 @@ void Battlefield::InvitePlayerToWar(Player* player)
|
|||
return;
|
||||
|
||||
m_PlayersWillBeKick[player->GetTeamId()].erase(player->GetGUID());
|
||||
m_InvitedPlayers[player->GetTeamId()][player->GetGUID()] = time(NULL) + m_TimeForAcceptInvite;
|
||||
m_InvitedPlayers[player->GetTeamId()][player->GetGUID()] = GameTime::GetGameTime() + m_TimeForAcceptInvite;
|
||||
player->GetSession()->SendBfInvitePlayerToWar(m_BattleId, m_ZoneId, m_TimeForAcceptInvite);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "Common.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
|
|
@ -25,7 +26,7 @@ void WorldSession::SendBfInvitePlayerToWar(uint32 BattleId, uint32 ZoneId, uint3
|
|||
WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTRY_INVITE, 12);
|
||||
data << uint32(BattleId);
|
||||
data << uint32(ZoneId);
|
||||
data << uint32((time(NULL) + p_time));
|
||||
data << uint32((GameTime::GetGameTime() + p_time));
|
||||
|
||||
//Sending the packet to player
|
||||
SendPacket(&data);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "BattlefieldWG.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Player.h"
|
||||
#include "SpellAuras.h"
|
||||
|
|
@ -888,7 +889,7 @@ void BattlefieldWG::FillInitialWorldStates(WorldPacket& data)
|
|||
data << uint32(BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE) << uint32(IsWarTime() ? 1 : 0);
|
||||
|
||||
for (uint32 i = 0; i < 2; ++i)
|
||||
data << ClockWorldState[i] << uint32(time(NULL) + (m_Timer / 1000));
|
||||
data << ClockWorldState[i] << uint32(GameTime::GetGameTime() + (m_Timer / 1000));
|
||||
|
||||
data << uint32(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H) << uint32(GetData(BATTLEFIELD_WG_DATA_VEHICLE_H));
|
||||
data << uint32(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H) << GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "ArenaTeamMgr.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "GameTime.h"
|
||||
|
||||
#include "ArenaTeam.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
|
|
@ -129,7 +130,7 @@ void BattlegroundMgr::Update(uint32 diff)
|
|||
{
|
||||
if (m_AutoDistributionTimeChecker < diff)
|
||||
{
|
||||
if (time(NULL) > m_NextAutoDistributionTime)
|
||||
if (GameTime::GetGameTime() > m_NextAutoDistributionTime)
|
||||
{
|
||||
sArenaTeamMgr->DistributeArenaPoints();
|
||||
m_NextAutoDistributionTime = m_NextAutoDistributionTime + BATTLEGROUND_ARENA_POINT_DISTRIBUTION_DAY * sWorld->getIntConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_INTERVAL_DAYS);
|
||||
|
|
@ -694,7 +695,7 @@ void BattlegroundMgr::InitAutomaticArenaPointDistribution()
|
|||
return;
|
||||
|
||||
time_t wstime = time_t(sWorld->getWorldState(WS_ARENA_DISTRIBUTION_TIME));
|
||||
time_t curtime = time(NULL);
|
||||
time_t curtime = GameTime::GetGameTime();
|
||||
sLog->outString("AzerothCore Battleground: Initializing Automatic Arena Point Distribution");
|
||||
if (wstime < curtime)
|
||||
{
|
||||
|
|
@ -1051,7 +1052,7 @@ void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, T
|
|||
if (bg->isArena() && bg->isRated())
|
||||
bg->SetArenaTeamIdForTeam(ginfo->teamId, ginfo->ArenaTeamId);
|
||||
|
||||
ginfo->RemoveInviteTime = World::GetGameTimeMS() + INVITE_ACCEPT_WAIT_TIME;
|
||||
ginfo->RemoveInviteTime = GameTime::GetGameTimeMS() + INVITE_ACCEPT_WAIT_TIME;
|
||||
|
||||
// loop through the players
|
||||
for (std::set<uint64>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "ArenaTeamMgr.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "BattlegroundQueue.h"
|
||||
#include "GameTime.h"
|
||||
#include "Chat.h"
|
||||
#include "Group.h"
|
||||
#include "Log.h"
|
||||
|
|
@ -124,7 +125,7 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, PvPDiffi
|
|||
ginfo->ArenaTeamId = arenateamid;
|
||||
ginfo->IsRated = isRated;
|
||||
ginfo->IsInvitedToBGInstanceGUID = 0;
|
||||
ginfo->JoinTime = World::GetGameTimeMS();
|
||||
ginfo->JoinTime = GameTime::GetGameTimeMS();
|
||||
ginfo->RemoveInviteTime = 0;
|
||||
ginfo->teamId = leader->GetTeamId();
|
||||
ginfo->ArenaTeamRating = ArenaRating;
|
||||
|
|
@ -210,7 +211,7 @@ GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, PvPDiffi
|
|||
|
||||
void BattlegroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo)
|
||||
{
|
||||
uint32 timeInQueue = std::max<uint32>(1, getMSTimeDiff(ginfo->JoinTime, World::GetGameTimeMS()));
|
||||
uint32 timeInQueue = std::max<uint32>(1, getMSTimeDiff(ginfo->JoinTime, GameTime::GetGameTimeMS()));
|
||||
|
||||
// team_index: bg alliance - TEAM_ALLIANCE, bg horde - TEAM_HORDE, arena skirmish - TEAM_ALLIANCE, arena rated - TEAM_HORDE
|
||||
uint8 team_index;
|
||||
|
|
@ -538,7 +539,7 @@ bool BattlegroundQueue::CheckPremadeMatch(BattlegroundBracketId bracket_id, uint
|
|||
// this happens if timer has expired or group size lowered
|
||||
|
||||
uint32 premade_time = sWorld->getIntConfig(CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH);
|
||||
uint32 time_before = World::GetGameTimeMS() >= premade_time ? World::GetGameTimeMS() - premade_time : 0;
|
||||
uint32 time_before = GameTime::GetGameTimeMS() >= premade_time ? GameTime::GetGameTimeMS() - premade_time : 0;
|
||||
|
||||
for (uint32 i = 0; i < BG_TEAMS_COUNT; i++)
|
||||
if (!m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE + i].empty())
|
||||
|
|
@ -789,7 +790,7 @@ void BattlegroundQueue::BattlegroundQueueUpdate(BattlegroundBracketId bracket_id
|
|||
{
|
||||
// pussywizard: everything inside this section is mine, do NOT destroy!
|
||||
|
||||
const uint32 currMSTime = World::GetGameTimeMS();
|
||||
const uint32 currMSTime = GameTime::GetGameTimeMS();
|
||||
const uint32 discardTime = sBattlegroundMgr->GetRatingDiscardTimer();
|
||||
const uint32 maxDefaultRatingDifference = (MaxPlayersPerTeam > 2 ? 300 : 200);
|
||||
const uint32 maxCountedMMR = 2500;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include "Creature.h"
|
||||
#include "Language.h"
|
||||
#include "Object.h"
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
#include "Util.h"
|
||||
#include "WorldSession.h"
|
||||
|
|
@ -56,7 +57,7 @@ void BattlegroundEY::PostUpdateImpl(uint32 diff)
|
|||
AddPoints(TEAM_ALLIANCE, BG_EY_TickPoints[_ownedPointsCount[TEAM_ALLIANCE] - 1]);
|
||||
if (_ownedPointsCount[TEAM_HORDE] > 0)
|
||||
AddPoints(TEAM_HORDE, BG_EY_TickPoints[_ownedPointsCount[TEAM_HORDE] - 1]);
|
||||
_bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, BG_EY_FPOINTS_TICK_TIME - (World::GetGameTimeMS() % BG_EY_FPOINTS_TICK_TIME));
|
||||
_bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, BG_EY_FPOINTS_TICK_TIME - (GameTime::GetGameTimeMS() % BG_EY_FPOINTS_TICK_TIME));
|
||||
break;
|
||||
case BG_EY_EVENT_FLAG_ON_GROUND:
|
||||
RespawnFlagAfterDrop();
|
||||
|
|
@ -66,7 +67,7 @@ void BattlegroundEY::PostUpdateImpl(uint32 diff)
|
|||
break;
|
||||
case BG_EY_EVENT_CHECK_CPOINTS:
|
||||
UpdatePointsState();
|
||||
_bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, BG_EY_FPOINTS_CHECK_TIME - (World::GetGameTimeMS() % BG_EY_FPOINTS_CHECK_TIME));
|
||||
_bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, BG_EY_FPOINTS_CHECK_TIME - (GameTime::GetGameTimeMS() % BG_EY_FPOINTS_CHECK_TIME));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include "WorldPacket.h"
|
||||
#include "GameObject.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "Vehicle.h"
|
||||
#include "Transport.h"
|
||||
#include "WorldSession.h"
|
||||
|
|
@ -127,7 +128,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
|||
{
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(catapult->GetGUIDLow());
|
||||
if (itr == respawnMap.end() || time(NULL) < itr->second)
|
||||
if (itr == respawnMap.end() || GameTime::GetGameTime() < itr->second)
|
||||
continue;
|
||||
|
||||
catapult->Relocate(BG_IC_DocksVehiclesCatapults[j].GetPositionX(), BG_IC_DocksVehiclesCatapults[j].GetPositionY(), BG_IC_DocksVehiclesCatapults[j].GetPositionZ(), BG_IC_DocksVehiclesCatapults[j].GetOrientation());
|
||||
|
|
@ -145,7 +146,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
|||
{
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(glaiveThrower->GetGUIDLow());
|
||||
if (itr == respawnMap.end() || time(NULL) < itr->second)
|
||||
if (itr == respawnMap.end() || GameTime::GetGameTime() < itr->second)
|
||||
continue;
|
||||
|
||||
glaiveThrower->Relocate(BG_IC_DocksVehiclesGlaives[j].GetPositionX(), BG_IC_DocksVehiclesGlaives[j].GetPositionY(), BG_IC_DocksVehiclesGlaives[j].GetPositionZ(), BG_IC_DocksVehiclesGlaives[j].GetOrientation());
|
||||
|
|
@ -174,7 +175,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
|||
{
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(siege->GetGUIDLow());
|
||||
if (itr == respawnMap.end() || time(NULL) < itr->second)
|
||||
if (itr == respawnMap.end() || GameTime::GetGameTime() < itr->second)
|
||||
continue;
|
||||
|
||||
siege->Relocate(BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(), BG_IC_WorkshopVehicles[4].GetPositionZ(), BG_IC_WorkshopVehicles[4].GetOrientation());
|
||||
|
|
@ -192,7 +193,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
|||
{
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(demolisher->GetGUIDLow());
|
||||
if (itr == respawnMap.end() || time(NULL) < itr->second)
|
||||
if (itr == respawnMap.end() || GameTime::GetGameTime() < itr->second)
|
||||
continue;
|
||||
|
||||
demolisher->Relocate(BG_IC_WorkshopVehicles[u].GetPositionX(), BG_IC_WorkshopVehicles[u].GetPositionY(), BG_IC_WorkshopVehicles[u].GetPositionZ(), BG_IC_WorkshopVehicles[u].GetOrientation());
|
||||
|
|
@ -520,7 +521,7 @@ void BattlegroundIC::HandleKillUnit(Creature* unit, Player* killer)
|
|||
// Xinef: Add to respawn list
|
||||
if (entry == NPC_DEMOLISHER || entry == NPC_SIEGE_ENGINE_H || entry == NPC_SIEGE_ENGINE_A ||
|
||||
entry == NPC_GLAIVE_THROWER_A || entry == NPC_GLAIVE_THROWER_H || entry == NPC_CATAPULT)
|
||||
respawnMap[unit->GetGUIDLow()] = time(NULL) + VEHICLE_RESPAWN_TIME;
|
||||
respawnMap[unit->GetGUIDLow()] = GameTime::GetGameTime() + VEHICLE_RESPAWN_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -867,7 +868,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
|||
if (!siegeVehicle->IsVehicleInUse())
|
||||
Unit::Kill(siegeEngine, siegeEngine);
|
||||
|
||||
respawnMap[siegeEngine->GetGUIDLow()] = time(NULL) + VEHICLE_RESPAWN_TIME;
|
||||
respawnMap[siegeEngine->GetGUIDLow()] = GameTime::GetGameTime() + VEHICLE_RESPAWN_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "Player.h"
|
||||
#include "GameObject.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "GameGraveyard.h"
|
||||
|
|
@ -1059,11 +1060,11 @@ void BattlegroundSA::UpdateDemolisherSpawns()
|
|||
// Demolisher is not in list
|
||||
if (DemoliserRespawnList.find(i) == DemoliserRespawnList.end())
|
||||
{
|
||||
DemoliserRespawnList[i] = World::GetGameTimeMS()+30000;
|
||||
DemoliserRespawnList[i] = GameTime::GetGameTimeMS()+30000;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (DemoliserRespawnList[i] < World::GetGameTimeMS())
|
||||
if (DemoliserRespawnList[i] < GameTime::GetGameTimeMS())
|
||||
{
|
||||
Demolisher->Relocate(BG_SA_NpcSpawnlocs[i][0], BG_SA_NpcSpawnlocs[i][1],
|
||||
BG_SA_NpcSpawnlocs[i][2], BG_SA_NpcSpawnlocs[i][3]);
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ file(GLOB_RECURSE sources_Spells Spells/*.cpp Spells/*.h)
|
|||
file(GLOB_RECURSE sources_Texts Texts/*.cpp Texts/*.h)
|
||||
file(GLOB_RECURSE sources_Tools Tools/*.cpp Tools/*.h)
|
||||
file(GLOB_RECURSE sources_Tickets Tickets/*.cpp Tickets/*.h)
|
||||
file(GLOB_RECURSE sources_Time Time/*.cpp Time/*.h)
|
||||
file(GLOB_RECURSE sources_Warden Warden/*.cpp Warden/*.h)
|
||||
file(GLOB_RECURSE sources_Weather Weather/*.cpp Weather/*.h)
|
||||
file(GLOB_RECURSE sources_World World/*.cpp World/*.h)
|
||||
|
|
@ -103,6 +104,7 @@ set(game_STAT_SRCS
|
|||
${sources_Texts}
|
||||
${sources_Tools}
|
||||
${sources_Tickets}
|
||||
${sources_Time}
|
||||
${sources_Warden}
|
||||
${sources_Weather}
|
||||
${sources_World}
|
||||
|
|
@ -203,6 +205,7 @@ include_directories(
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/Texts
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Tools
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Tickets
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Time
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Warden
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Warden/Modules
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Weather
|
||||
|
|
|
|||
|
|
@ -8,10 +8,14 @@
|
|||
#include "QueryResult.h"
|
||||
#include "Log.h"
|
||||
#include "Player.h"
|
||||
#include "GameTime.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Opcodes.h"
|
||||
|
||||
CalendarInvite::CalendarInvite() : _inviteId(1), _eventId(0), _invitee(), _senderGUID(), _statusTime(GameTime::GetGameTime()),
|
||||
_status(CALENDAR_STATUS_INVITED), _rank(CALENDAR_RANK_PLAYER), _text("") { }
|
||||
|
||||
CalendarInvite::~CalendarInvite()
|
||||
{
|
||||
sCalendarMgr->FreeInviteId(_inviteId);
|
||||
|
|
|
|||
|
|
@ -130,8 +130,7 @@ struct CalendarInvite
|
|||
_text = calendarInvite.GetText();
|
||||
}
|
||||
|
||||
CalendarInvite() : _inviteId(1), _eventId(0), _invitee(0), _senderGUID(0), _statusTime(time(NULL)),
|
||||
_status(CALENDAR_STATUS_INVITED), _rank(CALENDAR_RANK_PLAYER), _text("") { }
|
||||
CalendarInvite();
|
||||
|
||||
CalendarInvite(uint64 inviteId, uint64 eventId, uint64 invitee, uint64 senderGUID, time_t statusTime,
|
||||
CalendarInviteStatus status, CalendarModerationRank rank, std::string text) :
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "ChannelMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "SocialMgr.h"
|
||||
#include "World.h"
|
||||
#include "DatabaseEnv.h"
|
||||
|
|
@ -22,6 +23,7 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId,
|
|||
_channelDBId(channelDBId),
|
||||
_teamId(teamId),
|
||||
_ownerGUID(0),
|
||||
lastSpeakTime(0),
|
||||
_name(name),
|
||||
_password("")
|
||||
{
|
||||
|
|
@ -83,7 +85,7 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId,
|
|||
bool Channel::IsBanned(uint64 guid) const
|
||||
{
|
||||
BannedContainer::const_iterator itr = bannedStore.find(GUID_LOPART(guid));
|
||||
return itr != bannedStore.end() && itr->second > time(NULL);
|
||||
return itr != bannedStore.end() && itr->second > GameTime::GetGameTime();
|
||||
}
|
||||
|
||||
void Channel::UpdateChannelInDB() const
|
||||
|
|
@ -198,7 +200,6 @@ void Channel::JoinChannel(Player* player, std::string const& pass)
|
|||
PlayerInfo pinfo;
|
||||
pinfo.player = guid;
|
||||
pinfo.flags = MEMBER_FLAG_NONE;
|
||||
pinfo.lastSpeakTime = 0;
|
||||
pinfo.plrPtr = player;
|
||||
|
||||
playersStore[guid] = pinfo;
|
||||
|
|
@ -405,8 +406,8 @@ void Channel::KickOrBan(Player const* player, std::string const& badname, bool b
|
|||
{
|
||||
if (!IsBanned(victim))
|
||||
{
|
||||
bannedStore[GUID_LOPART(victim)] = time(NULL) + CHANNEL_BAN_DURATION;
|
||||
AddChannelBanToDB(GUID_LOPART(victim), time(NULL) + CHANNEL_BAN_DURATION);
|
||||
bannedStore[GUID_LOPART(victim)] = GameTime::GetGameTime() + CHANNEL_BAN_DURATION;
|
||||
AddChannelBanToDB(GUID_LOPART(victim), GameTime::GetGameTime() + CHANNEL_BAN_DURATION);
|
||||
|
||||
if (notify)
|
||||
{
|
||||
|
|
@ -786,9 +787,9 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
|
|||
else if (playersStore.size() >= 10)
|
||||
speakDelay = 5;
|
||||
|
||||
if (!pinfo.IsAllowedToSpeak(speakDelay))
|
||||
if (IsAllowedToSpeak(speakDelay))
|
||||
{
|
||||
std::string timeStr = secsToTimeString(pinfo.lastSpeakTime + speakDelay - sWorld->GetGameTime());
|
||||
std::string timeStr = secsToTimeString(lastSpeakTime + speakDelay - GameTime::GetGameTime());
|
||||
if (_channelRights.speakMessage.length() > 0)
|
||||
player->GetSession()->SendNotification("%s", _channelRights.speakMessage.c_str());
|
||||
player->GetSession()->SendNotification("You must wait %s before speaking again.", timeStr.c_str());
|
||||
|
|
@ -1235,3 +1236,14 @@ void Channel::RemoveWatching(Player* p)
|
|||
if (itr != playersWatchingStore.end())
|
||||
playersWatchingStore.erase(itr);
|
||||
}
|
||||
|
||||
bool Channel::IsAllowedToSpeak(uint32 speakDelay)
|
||||
{
|
||||
if (lastSpeakTime+speakDelay <= GameTime::GetGameTime())
|
||||
{
|
||||
lastSpeakTime = GameTime::GetGameTime();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include <string>
|
||||
|
||||
#include "Common.h"
|
||||
#include "GameTime.h"
|
||||
|
||||
#include "Opcodes.h"
|
||||
#include "WorldPacket.h"
|
||||
|
|
@ -139,7 +140,6 @@ class Channel
|
|||
{
|
||||
uint64 player;
|
||||
uint8 flags;
|
||||
uint32 lastSpeakTime; // pussywizard
|
||||
Player* plrPtr; // pussywizard
|
||||
|
||||
bool HasFlag(uint8 flag) const { return flags & flag; }
|
||||
|
|
@ -162,16 +162,6 @@ class Channel
|
|||
if (state) flags |= MEMBER_FLAG_MUTED;
|
||||
else flags &= ~MEMBER_FLAG_MUTED;
|
||||
}
|
||||
bool IsAllowedToSpeak(uint32 speakDelay) // pussywizard
|
||||
{
|
||||
if (lastSpeakTime+speakDelay <= sWorld->GetGameTime())
|
||||
{
|
||||
lastSpeakTime = sWorld->GetGameTime();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
|
|
@ -219,6 +209,7 @@ class Channel
|
|||
// pussywizard:
|
||||
void AddWatching(Player* p);
|
||||
void RemoveWatching(Player* p);
|
||||
bool IsAllowedToSpeak(uint32 speakDelay); // pussywizard
|
||||
|
||||
private:
|
||||
// initial packet data (notify type and channel name)
|
||||
|
|
@ -320,6 +311,7 @@ class Channel
|
|||
uint32 _channelDBId;
|
||||
TeamId _teamId;
|
||||
uint64 _ownerGUID;
|
||||
uint32 lastSpeakTime;
|
||||
std::string _name;
|
||||
std::string _password;
|
||||
ChannelRights _channelRights;
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include "Map.h"
|
||||
#include "Player.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "GameTime.h"
|
||||
#include "UnitEvents.h"
|
||||
#include "SpellAuras.h"
|
||||
#include "SpellMgr.h"
|
||||
|
|
@ -295,7 +296,7 @@ HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileR
|
|||
HostileReference* currentRef = NULL;
|
||||
bool found = false;
|
||||
bool noPriorityTargetFound = false;
|
||||
uint32 currTime = sWorld->GetGameTime();
|
||||
uint32 currTime = GameTime::GetGameTime();
|
||||
|
||||
// pussywizard: currentVictim is needed to compare if threat was exceeded by 10%/30% for melee/range targets (only then switching current target)
|
||||
if (currentVictim)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "DBCStores.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "SocialMgr.h"
|
||||
#include "Language.h"
|
||||
#include "LFGMgr.h"
|
||||
|
|
@ -260,7 +261,7 @@ void LFGMgr::Update(uint32 tdiff, uint8 task)
|
|||
|
||||
if (task == 0)
|
||||
{
|
||||
time_t currTime = time(NULL);
|
||||
time_t currTime = GameTime::GetGameTime();
|
||||
|
||||
// Remove obsolete role checks
|
||||
for (LfgRoleCheckContainer::iterator it = RoleChecksStore.begin(); it != RoleChecksStore.end();)
|
||||
|
|
@ -650,7 +651,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
|
|||
// Create new rolecheck
|
||||
LfgRoleCheck& roleCheck = RoleChecksStore[gguid];
|
||||
roleCheck.roles.clear(); // pussywizard: NEW rolecheck, not old one with trash data >_>
|
||||
roleCheck.cancelTime = time_t(time(NULL)) + LFG_TIME_ROLECHECK;
|
||||
roleCheck.cancelTime = time_t(GameTime::GetGameTime()) + LFG_TIME_ROLECHECK;
|
||||
roleCheck.state = LFG_ROLECHECK_INITIALITING;
|
||||
roleCheck.leader = guid;
|
||||
roleCheck.dungeons = dungeons;
|
||||
|
|
@ -688,7 +689,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
|
|||
LfgRolesMap rolesMap;
|
||||
rolesMap[guid] = roles;
|
||||
LFGQueue& queue = GetQueue(guid);
|
||||
queue.AddQueueData(guid, time(NULL), dungeons, rolesMap);
|
||||
queue.AddQueueData(guid, GameTime::GetGameTime(), dungeons, rolesMap);
|
||||
|
||||
if (!isContinue)
|
||||
{
|
||||
|
|
@ -887,7 +888,7 @@ void LFGMgr::UpdateRaidBrowser(uint32 diff)
|
|||
m_raidBrowserUpdateTimer[team] = 0;
|
||||
}
|
||||
|
||||
if (getMSTimeDiff(World::GetGameTimeMS(), getMSTime()) > (70*7)/5) // prevent lagging
|
||||
if (getMSTimeDiff(GameTime::GetGameTimeMS(), getMSTime()) > (70*7)/5) // prevent lagging
|
||||
return;
|
||||
|
||||
uint64 guid, groupGuid, instanceGuid;
|
||||
|
|
@ -1355,7 +1356,7 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /*
|
|||
{
|
||||
SetState(gguid, LFG_STATE_QUEUED);
|
||||
LFGQueue& queue = GetQueue(gguid);
|
||||
queue.AddQueueData(gguid, time_t(time(NULL)), 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)
|
||||
|
|
@ -1632,7 +1633,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept)
|
|||
|
||||
bool sendUpdate = proposal.state != LFG_PROPOSAL_SUCCESS;
|
||||
proposal.state = LFG_PROPOSAL_SUCCESS;
|
||||
time_t joinTime = time(NULL);
|
||||
time_t joinTime = GameTime::GetGameTime();
|
||||
|
||||
LFGQueue& queue = GetQueue(guid);
|
||||
LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_GROUP_FOUND);
|
||||
|
|
@ -1818,7 +1819,7 @@ void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string co
|
|||
|
||||
LfgPlayerBoot& boot = BootsStore[gguid];
|
||||
boot.inProgress = true;
|
||||
boot.cancelTime = time_t(time(NULL)) + LFG_TIME_BOOT;
|
||||
boot.cancelTime = time_t(GameTime::GetGameTime()) + LFG_TIME_BOOT;
|
||||
boot.reason = reason;
|
||||
boot.victim = victim;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include "Containers.h"
|
||||
#include "DBCStructure.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "LFGQueue.h"
|
||||
#include "LFGMgr.h"
|
||||
|
|
@ -29,6 +30,9 @@
|
|||
namespace lfg
|
||||
{
|
||||
|
||||
LfgQueueData::LfgQueueData() : joinTime(GameTime::GetGameTime()), lastRefreshTime(joinTime), tanks(LFG_TANKS_NEEDED), healers(LFG_HEALERS_NEEDED), dps(LFG_DPS_NEEDED)
|
||||
{ }
|
||||
|
||||
void LFGQueue::AddToQueue(uint64 guid, bool failedProposal)
|
||||
{
|
||||
//sLog->outString("ADD AddToQueue: %u, failed proposal: %u", GUID_LOPART(guid), failedProposal ? 1 : 0);
|
||||
|
|
@ -409,7 +413,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const
|
|||
return LFG_COMPATIBILITY_PENDING;
|
||||
|
||||
// Create a new proposal
|
||||
proposal.cancelTime = time(NULL) + LFG_TIME_PROPOSAL;
|
||||
proposal.cancelTime = GameTime::GetGameTime() + LFG_TIME_PROPOSAL;
|
||||
proposal.state = LFG_PROPOSAL_INITIATING;
|
||||
proposal.leader = 0;
|
||||
proposal.dungeonId = Trinity::Containers::SelectRandomContainerElement(proposalDungeons);
|
||||
|
|
@ -445,7 +449,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const
|
|||
|
||||
void LFGQueue::UpdateQueueTimers(uint32 diff)
|
||||
{
|
||||
time_t currTime = time(NULL);
|
||||
time_t currTime = GameTime::GetGameTime();
|
||||
bool sendQueueStatus = false;
|
||||
|
||||
if (m_QueueStatusTimer > LFG_QUEUEUPDATE_INTERVAL)
|
||||
|
|
|
|||
|
|
@ -28,9 +28,7 @@ enum LfgCompatibility
|
|||
/// Stores player or group queue info
|
||||
struct LfgQueueData
|
||||
{
|
||||
LfgQueueData(): joinTime(time_t(time(NULL))), lastRefreshTime(joinTime), 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), lastRefreshTime(_joinTime), tanks(LFG_TANKS_NEEDED), healers(LFG_HEALERS_NEEDED),
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "Common.h"
|
||||
#include "Corpse.h"
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
#include "UpdateMask.h"
|
||||
#include "ObjectAccessor.h"
|
||||
|
|
@ -23,7 +24,7 @@ Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES), m_type(type
|
|||
|
||||
m_valuesCount = CORPSE_END;
|
||||
|
||||
m_time = time(NULL);
|
||||
m_time = GameTime::GetGameTime();
|
||||
|
||||
lootRecipient = NULL;
|
||||
}
|
||||
|
|
@ -132,6 +133,11 @@ void Corpse::DeleteFromDB(SQLTransaction& trans)
|
|||
trans->Append(stmt);
|
||||
}
|
||||
|
||||
void Corpse::ResetGhostTime()
|
||||
{
|
||||
m_time = GameTime::GetGameTime();
|
||||
}
|
||||
|
||||
bool Corpse::LoadCorpseFromDB(uint32 guid, Field* fields)
|
||||
{
|
||||
uint32 ownerGuid = fields[17].GetUInt32();
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class Corpse : public WorldObject, public GridObject<Corpse>
|
|||
uint64 GetOwnerGUID() const { return GetUInt64Value(CORPSE_FIELD_OWNER); }
|
||||
|
||||
time_t const& GetGhostTime() const { return m_time; }
|
||||
void ResetGhostTime() { m_time = time(NULL); }
|
||||
void ResetGhostTime();
|
||||
CorpseType GetType() const { return m_type; }
|
||||
|
||||
GridCoord const& GetGridCoord() const { return _gridCoord; }
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include "DatabaseEnv.h"
|
||||
#include "Formulas.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "GossipDef.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
|
|
@ -46,6 +47,9 @@
|
|||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
||||
VendorItemCount::VendorItemCount(uint32 _item, uint32 _count)
|
||||
: itemId(_item), count(_count), lastIncrementTime(GameTime::GetGameTime()) { }
|
||||
|
||||
TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const
|
||||
{
|
||||
TrainerSpellMap::const_iterator itr = spellList.find(spell_id);
|
||||
|
|
@ -268,7 +272,7 @@ void Creature::RemoveCorpse(bool setSpawnTime, bool skipVisibility)
|
|||
if (getDeathState() != CORPSE)
|
||||
return;
|
||||
|
||||
m_corpseRemoveTime = time(NULL);
|
||||
m_corpseRemoveTime = GameTime::GetGameTime();
|
||||
setDeathState(DEAD);
|
||||
RemoveAllAuras();
|
||||
if (!skipVisibility) // pussywizard
|
||||
|
|
@ -281,7 +285,7 @@ void Creature::RemoveCorpse(bool setSpawnTime, bool skipVisibility)
|
|||
// Should get removed later, just keep "compatibility" with scripts
|
||||
if (setSpawnTime)
|
||||
{
|
||||
m_respawnTime = time(NULL) + respawnDelay;
|
||||
m_respawnTime = GameTime::GetGameTime() + respawnDelay;
|
||||
//SaveRespawnTime();
|
||||
}
|
||||
|
||||
|
|
@ -506,7 +510,7 @@ void Creature::Update(uint32 diff)
|
|||
break;
|
||||
case DEAD:
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
if (m_respawnTime <= now)
|
||||
{
|
||||
bool allowed = IsAIEnabled ? AI()->CanRespawn() : true; // First check if there are any scripts that object to us respawning
|
||||
|
|
@ -548,7 +552,7 @@ void Creature::Update(uint32 diff)
|
|||
}
|
||||
else m_groupLootTimer -= diff;
|
||||
}
|
||||
else if (m_corpseRemoveTime <= time(NULL))
|
||||
else if (m_corpseRemoveTime <= GameTime::GetGameTime())
|
||||
{
|
||||
RemoveCorpse(false);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
|
|
@ -1477,7 +1481,7 @@ bool Creature::IsInvisibleDueToDespawn() const
|
|||
if (Unit::IsInvisibleDueToDespawn())
|
||||
return true;
|
||||
|
||||
if (IsAlive() || m_corpseRemoveTime > time(NULL))
|
||||
if (IsAlive() || m_corpseRemoveTime > GameTime::GetGameTime())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
@ -1542,8 +1546,8 @@ void Creature::setDeathState(DeathState s, bool despawn)
|
|||
|
||||
if (s == JUST_DIED)
|
||||
{
|
||||
m_corpseRemoveTime = time(NULL) + m_corpseDelay;
|
||||
m_respawnTime = time(NULL) + m_respawnDelay + m_corpseDelay;
|
||||
m_corpseRemoveTime = GameTime::GetGameTime() + m_corpseDelay;
|
||||
m_respawnTime = GameTime::GetGameTime() + m_respawnDelay + m_corpseDelay;
|
||||
|
||||
// always save boss respawn time at death to prevent crash cheating
|
||||
if (GetMap()->IsDungeon() || isWorldBoss() || GetCreatureTemplate()->rank >= CREATURE_ELITE_ELITE)
|
||||
|
|
@ -2126,7 +2130,7 @@ bool Creature::CanCreatureAttack(Unit const* victim, bool skipDistCheck) const
|
|||
|
||||
// pussywizard: don't check distance to home position if recently damaged (allow kiting away from spawnpoint!)
|
||||
// xinef: this should include taunt auras
|
||||
if (!isWorldBoss() && (GetLastDamagedTime() > sWorld->GetGameTime() || HasAuraType(SPELL_AURA_MOD_TAUNT)))
|
||||
if (!isWorldBoss() && (GetLastDamagedTime() > GameTime::GetGameTime() || HasAuraType(SPELL_AURA_MOD_TAUNT)))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -2294,7 +2298,7 @@ void Creature::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs
|
|||
{
|
||||
for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
|
||||
if (idSchoolMask & (1 << i))
|
||||
m_ProhibitSchoolTime[i] = World::GetGameTimeMS() + unTimeMs;
|
||||
m_ProhibitSchoolTime[i] = GameTime::GetGameTimeMS() + unTimeMs;
|
||||
}
|
||||
|
||||
bool Creature::IsSpellProhibited(SpellSchoolMask idSchoolMask) const
|
||||
|
|
@ -2305,7 +2309,7 @@ bool Creature::IsSpellProhibited(SpellSchoolMask idSchoolMask) const
|
|||
|
||||
for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
|
||||
if (idSchoolMask & (1 << i))
|
||||
if (m_ProhibitSchoolTime[i] >= World::GetGameTimeMS())
|
||||
if (m_ProhibitSchoolTime[i] >= GameTime::GetGameTimeMS())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
@ -2313,7 +2317,7 @@ bool Creature::IsSpellProhibited(SpellSchoolMask idSchoolMask) const
|
|||
|
||||
void Creature::_AddCreatureSpellCooldown(uint32 spell_id, uint32 end_time)
|
||||
{
|
||||
m_CreatureSpellCooldowns[spell_id] = World::GetGameTimeMS()+end_time;
|
||||
m_CreatureSpellCooldowns[spell_id] = GameTime::GetGameTimeMS()+end_time;
|
||||
}
|
||||
|
||||
void Creature::AddSpellCooldown(uint32 spell_id, uint32 /*itemid*/, uint32 end_time, bool /*needSendToClient*/, bool /*forceSendToSpectator*/)
|
||||
|
|
@ -2360,13 +2364,13 @@ uint32 Creature::GetSpellCooldown(uint32 spell_id) const
|
|||
if (itr == m_CreatureSpellCooldowns.end())
|
||||
return 0;
|
||||
|
||||
return itr->second > World::GetGameTimeMS() ? itr->second - World::GetGameTimeMS() : 0;
|
||||
return itr->second > GameTime::GetGameTimeMS() ? itr->second - GameTime::GetGameTimeMS() : 0;
|
||||
}
|
||||
|
||||
bool Creature::HasSpellCooldown(uint32 spell_id) const
|
||||
{
|
||||
CreatureSpellCooldowns::const_iterator itr = m_CreatureSpellCooldowns.find(spell_id);
|
||||
return (itr != m_CreatureSpellCooldowns.end() && itr->second > World::GetGameTimeMS());
|
||||
return (itr != m_CreatureSpellCooldowns.end() && itr->second > GameTime::GetGameTimeMS());
|
||||
}
|
||||
|
||||
bool Creature::HasSpell(uint32 spellID) const
|
||||
|
|
@ -2380,13 +2384,18 @@ bool Creature::HasSpell(uint32 spellID) const
|
|||
|
||||
time_t Creature::GetRespawnTimeEx() const
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
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_DBTableGuid)
|
||||
|
|
@ -2431,7 +2440,7 @@ void Creature::AllLootRemovedFromCorpse()
|
|||
{
|
||||
if (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE))
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
if (m_corpseRemoveTime <= now)
|
||||
return;
|
||||
|
||||
|
|
@ -2445,7 +2454,7 @@ void Creature::AllLootRemovedFromCorpse()
|
|||
|
||||
// corpse skinnable, but without skinning flag, and then skinned, corpse will despawn next update
|
||||
if (cinfo && cinfo->SkinLootId)
|
||||
m_corpseRemoveTime = time(NULL);
|
||||
m_corpseRemoveTime = GameTime::GetGameTime();
|
||||
else
|
||||
m_corpseRemoveTime -= diff;
|
||||
}
|
||||
|
|
@ -2499,7 +2508,7 @@ uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem)
|
|||
|
||||
VendorItemCount* vCount = &*itr;
|
||||
|
||||
time_t ptime = time(NULL);
|
||||
time_t ptime = GameTime::GetGameTime();
|
||||
|
||||
if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime)
|
||||
{
|
||||
|
|
@ -2538,7 +2547,7 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us
|
|||
|
||||
VendorItemCount* vCount = &*itr;
|
||||
|
||||
time_t ptime = time(NULL);
|
||||
time_t ptime = GameTime::GetGameTime();
|
||||
|
||||
if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime)
|
||||
{
|
||||
|
|
@ -2857,3 +2866,13 @@ float Creature::GetAttackDistance(Unit const* player) const
|
|||
|
||||
return (retDistance*aggroRate);
|
||||
}
|
||||
|
||||
void Creature::SetPickPocketLootTime()
|
||||
{
|
||||
lootPickPocketRestoreTime = GameTime::GetGameTime() + MINUTE + GetCorpseDelay() + GetRespawnTime();
|
||||
}
|
||||
|
||||
bool Creature::CanGeneratePickPocketLoot() const
|
||||
{
|
||||
return (lootPickPocketRestoreTime == 0 || lootPickPocketRestoreTime < GameTime::GetGameTime());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -370,8 +370,7 @@ struct VendorItemData
|
|||
|
||||
struct VendorItemCount
|
||||
{
|
||||
explicit VendorItemCount(uint32 _item, uint32 _count)
|
||||
: itemId(_item), count(_count), lastIncrementTime(time(NULL)) {}
|
||||
VendorItemCount(uint32 _item, uint32 _count);
|
||||
|
||||
uint32 itemId;
|
||||
uint32 count;
|
||||
|
|
@ -573,8 +572,8 @@ class Creature : public Unit, public GridObject<Creature>, public MovableMapObje
|
|||
Group* GetLootRecipientGroup() const;
|
||||
bool hasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; }
|
||||
bool isTappedBy(Player const* player) const; // return true if the creature is tapped by the player or a member of his party.
|
||||
bool CanGeneratePickPocketLoot() const { return lootPickPocketRestoreTime == 0 || lootPickPocketRestoreTime < time(NULL); }
|
||||
void SetPickPocketLootTime() { lootPickPocketRestoreTime = time(NULL) + MINUTE + GetCorpseDelay() + GetRespawnTime(); }
|
||||
bool CanGeneratePickPocketLoot() const;
|
||||
void SetPickPocketLootTime();
|
||||
void ResetPickPocketLootTime() { lootPickPocketRestoreTime = 0; }
|
||||
|
||||
void SetLootRecipient (Unit* unit, bool withGroup = true);
|
||||
|
|
@ -627,7 +626,7 @@ class Creature : public Unit, public GridObject<Creature>, public MovableMapObje
|
|||
|
||||
time_t const& GetRespawnTime() const { return m_respawnTime; }
|
||||
time_t GetRespawnTimeEx() const;
|
||||
void SetRespawnTime(uint32 respawn) { m_respawnTime = respawn ? time(NULL) + respawn : 0; }
|
||||
void SetRespawnTime(uint32 respawn);
|
||||
void Respawn(bool force = false);
|
||||
void SaveRespawnTime();
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
#include "World.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "CellImpl.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
|
|
@ -107,7 +108,7 @@ bool DynamicObject::CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spe
|
|||
SetByteValue(DYNAMICOBJECT_BYTES, 0, type);
|
||||
SetUInt32Value(DYNAMICOBJECT_SPELLID, spellId);
|
||||
SetFloatValue(DYNAMICOBJECT_RADIUS, radius);
|
||||
SetUInt32Value(DYNAMICOBJECT_CASTTIME, World::GetGameTimeMS());
|
||||
SetUInt32Value(DYNAMICOBJECT_CASTTIME, GameTime::GetGameTimeMS());
|
||||
|
||||
if (IsWorldObject())
|
||||
setActive(true); //must before add to map to be put in world container
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <G3D/Quat.h>
|
||||
#include "GameObjectAI.h"
|
||||
#include "GameTime.h"
|
||||
#include "BattlegroundAV.h"
|
||||
#include "CellImpl.h"
|
||||
#include "CreatureAISelector.h"
|
||||
|
|
@ -376,9 +377,9 @@ void GameObject::Update(uint32 diff)
|
|||
GameObjectTemplate const* goInfo = GetGOInfo();
|
||||
// Bombs
|
||||
if (goInfo->trap.type == 2)
|
||||
m_cooldownTime = World::GetGameTimeMS()+10*IN_MILLISECONDS; // Hardcoded tooltip value
|
||||
m_cooldownTime = GameTime::GetGameTimeMS()+10*IN_MILLISECONDS; // Hardcoded tooltip value
|
||||
else if (GetOwner())
|
||||
m_cooldownTime = World::GetGameTimeMS()+goInfo->trap.startDelay*IN_MILLISECONDS;
|
||||
m_cooldownTime = GameTime::GetGameTimeMS()+goInfo->trap.startDelay*IN_MILLISECONDS;
|
||||
|
||||
m_lootState = GO_READY;
|
||||
break;
|
||||
|
|
@ -386,7 +387,7 @@ void GameObject::Update(uint32 diff)
|
|||
case GAMEOBJECT_TYPE_FISHINGNODE:
|
||||
{
|
||||
// fishing code (bobber ready)
|
||||
if (time(NULL) > m_respawnTime - FISHING_BOBBER_READY_TIME)
|
||||
if (GameTime::GetGameTime() > m_respawnTime - FISHING_BOBBER_READY_TIME)
|
||||
{
|
||||
// splash bobber (bobber ready now)
|
||||
Unit* caster = GetOwner();
|
||||
|
|
@ -410,7 +411,7 @@ void GameObject::Update(uint32 diff)
|
|||
}
|
||||
case GAMEOBJECT_TYPE_SUMMONING_RITUAL:
|
||||
{
|
||||
if (World::GetGameTimeMS() < m_cooldownTime)
|
||||
if (GameTime::GetGameTimeMS() < m_cooldownTime)
|
||||
return;
|
||||
GameObjectTemplate const* info = GetGOInfo();
|
||||
if (info->summoningRitual.animSpell)
|
||||
|
|
@ -484,7 +485,7 @@ void GameObject::Update(uint32 diff)
|
|||
{
|
||||
if (m_respawnTime > 0) // timer on
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
if (m_respawnTime <= now) // timer expired
|
||||
{
|
||||
uint64 dbtableHighGuid = MAKE_NEW_GUID(m_DBTableGuid, GetEntry(), HIGHGUID_GAMEOBJECT);
|
||||
|
|
@ -560,7 +561,7 @@ void GameObject::Update(uint32 diff)
|
|||
GameObjectTemplate const* goInfo = GetGOInfo();
|
||||
if (goInfo->type == GAMEOBJECT_TYPE_TRAP)
|
||||
{
|
||||
if (World::GetGameTimeMS() < m_cooldownTime)
|
||||
if (GameTime::GetGameTimeMS() < m_cooldownTime)
|
||||
break;
|
||||
|
||||
// Type 2 - Bomb (will go away after casting it's spell)
|
||||
|
|
@ -620,7 +621,7 @@ void GameObject::Update(uint32 diff)
|
|||
if (goInfo->trap.spellId)
|
||||
CastSpell(target, goInfo->trap.spellId);
|
||||
|
||||
m_cooldownTime = World::GetGameTimeMS()+(goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4))*IN_MILLISECONDS; // template or 4 seconds
|
||||
m_cooldownTime = GameTime::GetGameTimeMS()+(goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4))*IN_MILLISECONDS; // template or 4 seconds
|
||||
|
||||
if (goInfo->trap.type == 1)
|
||||
SetLootState(GO_JUST_DEACTIVATED);
|
||||
|
|
@ -652,11 +653,11 @@ void GameObject::Update(uint32 diff)
|
|||
{
|
||||
case GAMEOBJECT_TYPE_DOOR:
|
||||
case GAMEOBJECT_TYPE_BUTTON:
|
||||
if (GetGOInfo()->GetAutoCloseTime() && World::GetGameTimeMS() >= m_cooldownTime)
|
||||
if (GetGOInfo()->GetAutoCloseTime() && GameTime::GetGameTimeMS() >= m_cooldownTime)
|
||||
ResetDoorOrButton();
|
||||
break;
|
||||
case GAMEOBJECT_TYPE_GOOBER:
|
||||
if (World::GetGameTimeMS() >= m_cooldownTime)
|
||||
if (GameTime::GetGameTimeMS() >= m_cooldownTime)
|
||||
{
|
||||
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
|
||||
|
||||
|
|
@ -728,7 +729,7 @@ void GameObject::Update(uint32 diff)
|
|||
return;
|
||||
}
|
||||
|
||||
m_respawnTime = time(NULL) + m_respawnDelayTime;
|
||||
m_respawnTime = GameTime::GetGameTime() + m_respawnDelayTime;
|
||||
|
||||
// if option not set then object will be saved at grid unload
|
||||
if (GetMap()->IsDungeon())
|
||||
|
|
@ -941,7 +942,7 @@ bool GameObject::LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap)
|
|||
m_respawnTime = GetMap()->GetGORespawnTime(m_DBTableGuid);
|
||||
|
||||
// ready to respawn
|
||||
if (m_respawnTime && m_respawnTime <= time(NULL))
|
||||
if (m_respawnTime && m_respawnTime <= GameTime::GetGameTime())
|
||||
{
|
||||
m_respawnTime = 0;
|
||||
GetMap()->RemoveGORespawnTime(m_DBTableGuid);
|
||||
|
|
@ -1025,7 +1026,7 @@ Unit* GameObject::GetOwner() const
|
|||
|
||||
void GameObject::SaveRespawnTime()
|
||||
{
|
||||
if (m_goData && m_goData->dbData && m_respawnTime > time(NULL) && m_spawnedByDefault)
|
||||
if (m_goData && m_goData->dbData && m_respawnTime > GameTime::GetGameTime() && m_spawnedByDefault)
|
||||
GetMap()->SaveGORespawnTime(m_DBTableGuid, m_respawnTime);
|
||||
}
|
||||
|
||||
|
|
@ -1080,11 +1081,26 @@ bool GameObject::IsInvisibleDueToDespawn() const
|
|||
return false;
|
||||
}
|
||||
|
||||
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(NULL);
|
||||
m_respawnTime = GameTime::GetGameTime();
|
||||
GetMap()->RemoveGORespawnTime(m_DBTableGuid);
|
||||
}
|
||||
}
|
||||
|
|
@ -1212,7 +1228,7 @@ void GameObject::UseDoorOrButton(uint32 time_to_restore, bool alternative /* = f
|
|||
SwitchDoorOrButton(true, alternative);
|
||||
SetLootState(GO_ACTIVATED, user);
|
||||
|
||||
m_cooldownTime = World::GetGameTimeMS()+time_to_restore;
|
||||
m_cooldownTime = GameTime::GetGameTimeMS()+time_to_restore;
|
||||
}
|
||||
|
||||
void GameObject::SetGoArtKit(uint8 kit)
|
||||
|
|
@ -1279,10 +1295,10 @@ void GameObject::Use(Unit* user)
|
|||
// If cooldown data present in template
|
||||
if (uint32 cooldown = GetGOInfo()->GetCooldown())
|
||||
{
|
||||
if (World::GetGameTimeMS() < m_cooldownTime)
|
||||
if (GameTime::GetGameTimeMS() < m_cooldownTime)
|
||||
return;
|
||||
|
||||
m_cooldownTime = World::GetGameTimeMS()+cooldown*IN_MILLISECONDS;
|
||||
m_cooldownTime = GameTime::GetGameTimeMS()+cooldown*IN_MILLISECONDS;
|
||||
}
|
||||
|
||||
switch (GetGoType())
|
||||
|
|
@ -1316,7 +1332,7 @@ void GameObject::Use(Unit* user)
|
|||
if (goInfo->trap.spellId)
|
||||
CastSpell(user, goInfo->trap.spellId);
|
||||
|
||||
m_cooldownTime = World::GetGameTimeMS()+(goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4))*IN_MILLISECONDS; // template or 4 seconds
|
||||
m_cooldownTime = GameTime::GetGameTimeMS()+(goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4))*IN_MILLISECONDS; // template or 4 seconds
|
||||
|
||||
if (goInfo->trap.type == 1) // Deactivate after trigger
|
||||
SetLootState(GO_JUST_DEACTIVATED);
|
||||
|
|
@ -1469,7 +1485,7 @@ void GameObject::Use(Unit* user)
|
|||
if (info->goober.customAnim)
|
||||
SendCustomAnim(GetGoAnimProgress());
|
||||
|
||||
m_cooldownTime = World::GetGameTimeMS()+info->GetAutoCloseTime();
|
||||
m_cooldownTime = GameTime::GetGameTimeMS()+info->GetAutoCloseTime();
|
||||
|
||||
// cast this spell later if provided
|
||||
spellId = info->goober.spellId;
|
||||
|
|
@ -1643,7 +1659,7 @@ void GameObject::Use(Unit* user)
|
|||
if (!info->summoningRitual.animSpell)
|
||||
m_cooldownTime = 0;
|
||||
else // channel ready, maintain this
|
||||
m_cooldownTime = World::GetGameTimeMS()+5*IN_MILLISECONDS;
|
||||
m_cooldownTime = GameTime::GetGameTimeMS()+5*IN_MILLISECONDS;
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
@ -2196,6 +2212,11 @@ void GameObject::SetLootState(LootState state, Unit* unit)
|
|||
}*/
|
||||
}
|
||||
|
||||
void GameObject::SetLootGenerationTime()
|
||||
{
|
||||
m_lootGenerationTime = GameTime::GetGameTime();
|
||||
}
|
||||
|
||||
void GameObject::SetGoState(GOState state)
|
||||
{
|
||||
SetByteValue(GAMEOBJECT_BYTES_1, 0, state);
|
||||
|
|
|
|||
|
|
@ -700,20 +700,9 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Mov
|
|||
uint32 GetSpellId() const { return m_spellId;}
|
||||
|
||||
time_t GetRespawnTime() const { return m_respawnTime; }
|
||||
time_t GetRespawnTimeEx() const
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
if (m_respawnTime > now)
|
||||
return m_respawnTime;
|
||||
else
|
||||
return now;
|
||||
}
|
||||
|
||||
void SetRespawnTime(int32 respawn)
|
||||
{
|
||||
m_respawnTime = respawn > 0 ? time(NULL) + respawn : 0;
|
||||
m_respawnDelayTime = respawn > 0 ? respawn : 0;
|
||||
}
|
||||
time_t GetRespawnTimeEx() const;
|
||||
|
||||
void SetRespawnTime(int32 respawn);
|
||||
void Respawn();
|
||||
bool isSpawned() const
|
||||
{
|
||||
|
|
@ -782,7 +771,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Mov
|
|||
bool HasLootRecipient() const { return m_lootRecipient || m_lootRecipientGroup; }
|
||||
uint32 m_groupLootTimer; // (msecs)timer used for group loot
|
||||
uint32 lootingGroupLowGUID; // used to find group which is looting
|
||||
void SetLootGenerationTime() { m_lootGenerationTime = time(NULL); }
|
||||
void SetLootGenerationTime();
|
||||
uint32 GetLootGenerationTime() const { return m_lootGenerationTime; }
|
||||
|
||||
bool hasQuest(uint32 quest_id) const;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "ObjectMgr.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "ItemEnchantmentMgr.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "SpellInfo.h"
|
||||
|
|
@ -236,7 +237,7 @@ Item::Item()
|
|||
m_container = NULL;
|
||||
m_lootGenerated = false;
|
||||
mb_in_trade = false;
|
||||
m_lastPlayedTimeUpdate = time(NULL);
|
||||
m_lastPlayedTimeUpdate = GameTime::GetGameTime();
|
||||
|
||||
m_refundRecipient = 0;
|
||||
m_paidMoney = 0;
|
||||
|
|
@ -1140,7 +1141,7 @@ void Item::UpdatePlayedTime(Player* owner)
|
|||
// Get current played time
|
||||
uint32 current_playtime = GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME);
|
||||
// Calculate time elapsed since last played time update
|
||||
time_t curtime = time(NULL);
|
||||
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
|
||||
|
|
@ -1161,7 +1162,7 @@ void Item::UpdatePlayedTime(Player* owner)
|
|||
|
||||
uint32 Item::GetPlayedTime()
|
||||
{
|
||||
time_t curtime = time(NULL);
|
||||
time_t curtime = GameTime::GetGameTime();
|
||||
uint32 elapsed = uint32(curtime - m_lastPlayedTimeUpdate);
|
||||
return GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME) + elapsed;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include "Player.h"
|
||||
#include "Vehicle.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "UpdateData.h"
|
||||
#include "UpdateMask.h"
|
||||
#include "Util.h"
|
||||
|
|
@ -940,7 +941,7 @@ void MovementInfo::OutDebug()
|
|||
sLog->outString("guid " UI64FMTD, guid);
|
||||
sLog->outString("flags %u", flags);
|
||||
sLog->outString("flags2 %u", flags2);
|
||||
sLog->outString("time %u current time " UI64FMTD "", flags2, uint64(::time(NULL)));
|
||||
sLog->outString("time %u current time " UI64FMTD "", flags2, uint64(::GameTime::GetGameTime()));
|
||||
sLog->outString("position: `%s`", pos.ToString().c_str());
|
||||
if (flags & MOVEMENTFLAG_ONTRANSPORT)
|
||||
{
|
||||
|
|
@ -2885,13 +2886,13 @@ void WorldObject::AddToNotify(uint16 f)
|
|||
{
|
||||
uint32 EVENT_VISIBILITY_DELAY = u->FindMap() ? DynamicVisibilityMgr::GetVisibilityNotifyDelay(u->FindMap()->GetEntry()->map_type) : 1000;
|
||||
|
||||
uint32 diff = getMSTimeDiff(u->m_last_notify_mstime, World::GetGameTimeMS());
|
||||
uint32 diff = getMSTimeDiff(u->m_last_notify_mstime, GameTime::GetGameTimeMS());
|
||||
if (diff >= EVENT_VISIBILITY_DELAY/2)
|
||||
EVENT_VISIBILITY_DELAY /= 2;
|
||||
else
|
||||
EVENT_VISIBILITY_DELAY -= diff;
|
||||
u->m_delayed_unit_relocation_timer = EVENT_VISIBILITY_DELAY;
|
||||
u->m_last_notify_mstime = World::GetGameTimeMS()+EVENT_VISIBILITY_DELAY-1;
|
||||
u->m_last_notify_mstime = GameTime::GetGameTimeMS()+EVENT_VISIBILITY_DELAY-1;
|
||||
}
|
||||
else if (f & NOTIFY_AI_RELOCATION)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "Log.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "Pet.h"
|
||||
#include "Formulas.h"
|
||||
|
|
@ -237,7 +238,7 @@ void Pet::SavePetToDB(PetSaveMode mode, bool logout)
|
|||
stmt->setUInt32(12, curhealth);
|
||||
stmt->setUInt32(13, curmana);
|
||||
stmt->setUInt32(14, GetPower(POWER_HAPPINESS));
|
||||
stmt->setUInt32(15, time(NULL));
|
||||
stmt->setUInt32(15, GameTime::GetGameTime());
|
||||
|
||||
std::ostringstream ss;
|
||||
for (uint32 i = ACTION_BAR_INDEX_START; i < ACTION_BAR_INDEX_END; ++i)
|
||||
|
|
@ -321,7 +322,7 @@ void Pet::Update(uint32 diff)
|
|||
{
|
||||
case CORPSE:
|
||||
{
|
||||
if (getPetType() != HUNTER_PET || m_corpseRemoveTime <= time(NULL))
|
||||
if (getPetType() != HUNTER_PET || m_corpseRemoveTime <= GameTime::GetGameTime())
|
||||
{
|
||||
Remove(PET_SAVE_NOT_IN_SLOT); //hunters' pets never get removed because of death, NEVER!
|
||||
return;
|
||||
|
|
@ -1059,7 +1060,7 @@ void Pet::_LoadSpellCooldowns(PreparedQueryResult result)
|
|||
|
||||
if (result)
|
||||
{
|
||||
time_t curTime = time(NULL);
|
||||
time_t curTime = GameTime::GetGameTime();
|
||||
|
||||
PacketCooldowns cooldowns;
|
||||
WorldPacket data;
|
||||
|
|
@ -1105,8 +1106,8 @@ void Pet::_SaveSpellCooldowns(SQLTransaction& trans, bool logout)
|
|||
stmt->setUInt32(0, m_charmInfo->GetPetNumber());
|
||||
trans->Append(stmt);
|
||||
|
||||
time_t curTime = time(NULL);
|
||||
uint32 checkTime = World::GetGameTimeMS() + 30*IN_MILLISECONDS;
|
||||
time_t curTime = GameTime::GetGameTime();
|
||||
uint32 checkTime = GameTime::GetGameTimeMS() + 30*IN_MILLISECONDS;
|
||||
|
||||
// remove oudated and save active
|
||||
CreatureSpellCooldowns::iterator itr, itr2;
|
||||
|
|
@ -1114,11 +1115,11 @@ void Pet::_SaveSpellCooldowns(SQLTransaction& trans, bool logout)
|
|||
{
|
||||
itr2 = itr;
|
||||
++itr;
|
||||
if (itr2->second <= World::GetGameTimeMS()+1000)
|
||||
if (itr2->second <= GameTime::GetGameTimeMS()+1000)
|
||||
m_CreatureSpellCooldowns.erase(itr2);
|
||||
else if (logout || itr2->second > checkTime)
|
||||
{
|
||||
uint32 cooldown = ((itr2->second-World::GetGameTimeMS())/IN_MILLISECONDS) + curTime;
|
||||
uint32 cooldown = ((itr2->second-GameTime::GetGameTimeMS())/IN_MILLISECONDS) + curTime;
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PET_SPELL_COOLDOWN);
|
||||
stmt->setUInt32(0, m_charmInfo->GetPetNumber());
|
||||
stmt->setUInt32(1, itr2->first);
|
||||
|
|
@ -2143,7 +2144,7 @@ void Pet::HandleAsynchLoadFailed(AsynchPetSummon* info, Player* player, uint8 as
|
|||
pet->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000);
|
||||
pet->SetFullHealth();
|
||||
pet->SetPower(POWER_MANA, pet->GetMaxPower(POWER_MANA));
|
||||
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped in this case
|
||||
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime())); // cast can't be helped in this case
|
||||
}
|
||||
|
||||
map->AddToMap(pet->ToCreature(), true);
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include "DisableMgr.h"
|
||||
#include "Formulas.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "GossipDef.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
|
|
@ -774,7 +775,7 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this)
|
|||
for (uint8 j = 0; j < PLAYER_MAX_BATTLEGROUND_QUEUES; ++j)
|
||||
m_bgBattlegroundQueueID[j] = BATTLEGROUND_QUEUE_NONE;
|
||||
|
||||
m_logintime = time(NULL);
|
||||
m_logintime = GameTime::GetGameTime();
|
||||
m_Last_tick = m_logintime;
|
||||
m_Played_time[PLAYED_TIME_TOTAL] = 0;
|
||||
m_Played_time[PLAYED_TIME_LEVEL] = 0;
|
||||
|
|
@ -847,7 +848,7 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this)
|
|||
m_spellPenetrationItemMod = 0;
|
||||
|
||||
// Honor System
|
||||
m_lastHonorUpdateTime = time(NULL);
|
||||
m_lastHonorUpdateTime = GameTime::GetGameTime();
|
||||
|
||||
m_IsBGRandomWinner = false;
|
||||
|
||||
|
|
@ -1101,7 +1102,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
|
|||
}
|
||||
|
||||
// Played time
|
||||
m_Last_tick = time(NULL);
|
||||
m_Last_tick = GameTime::GetGameTime();
|
||||
m_Played_time[PLAYED_TIME_TOTAL] = 0;
|
||||
m_Played_time[PLAYED_TIME_LEVEL] = 0;
|
||||
|
||||
|
|
@ -1544,7 +1545,7 @@ void Player::Update(uint32 p_time)
|
|||
sScriptMgr->OnBeforePlayerUpdate(this, p_time);
|
||||
|
||||
// undelivered mail
|
||||
if (m_nextMailDelivereTime && m_nextMailDelivereTime <= time(NULL))
|
||||
if (m_nextMailDelivereTime && m_nextMailDelivereTime <= GameTime::GetGameTime())
|
||||
{
|
||||
SendNewMail();
|
||||
++unReadMails;
|
||||
|
|
@ -1558,7 +1559,7 @@ void Player::Update(uint32 p_time)
|
|||
Unit::Update(p_time);
|
||||
SetMustDelayTeleport(false);
|
||||
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
|
||||
UpdatePvPFlag(now);
|
||||
|
||||
|
|
@ -1709,7 +1710,7 @@ void Player::Update(uint32 p_time)
|
|||
{
|
||||
if (now > m_Last_tick && _restTime > 0) // freeze update
|
||||
{
|
||||
time_t currTime = time(NULL);
|
||||
time_t currTime = GameTime::GetGameTime();
|
||||
time_t timeDiff = currTime - _restTime;
|
||||
if (timeDiff >= 10) // freeze update
|
||||
{
|
||||
|
|
@ -1958,7 +1959,7 @@ void Player::setDeathState(DeathState s, bool /*despawn = false*/)
|
|||
void Player::SetRestState(uint32 triggerId)
|
||||
{
|
||||
_innTriggerId = triggerId;
|
||||
_restTime = time(NULL);
|
||||
_restTime = GameTime::GetGameTime();
|
||||
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
|
||||
}
|
||||
|
||||
|
|
@ -2274,7 +2275,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
|||
if (MustDelayTeleport())
|
||||
{
|
||||
SetHasDelayedTeleport(true);
|
||||
SetSemaphoreTeleportNear(time(NULL));
|
||||
SetSemaphoreTeleportNear(GameTime::GetGameTime());
|
||||
//lets save teleport destination for player
|
||||
teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
|
||||
teleportStore_options = options;
|
||||
|
|
@ -2296,11 +2297,11 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
|||
|
||||
// this will be used instead of the current location in SaveToDB
|
||||
teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
|
||||
SetFallInformation(time(NULL), z);
|
||||
SetFallInformation(GameTime::GetGameTime(), z);
|
||||
|
||||
// code for finish transfer called in WorldSession::HandleMovementOpcodes()
|
||||
// at client packet MSG_MOVE_TELEPORT_ACK
|
||||
SetSemaphoreTeleportNear(time(NULL));
|
||||
SetSemaphoreTeleportNear(GameTime::GetGameTime());
|
||||
// near teleport, triggering send MSG_MOVE_TELEPORT_ACK from client at landing
|
||||
if (!GetSession()->PlayerLogout())
|
||||
{
|
||||
|
|
@ -2336,7 +2337,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
|||
if (MustDelayTeleport())
|
||||
{
|
||||
SetHasDelayedTeleport(true);
|
||||
SetSemaphoreTeleportFar(time(NULL));
|
||||
SetSemaphoreTeleportFar(GameTime::GetGameTime());
|
||||
//lets save teleport destination for player
|
||||
teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
|
||||
teleportStore_options = options;
|
||||
|
|
@ -2403,7 +2404,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
|||
}
|
||||
|
||||
teleportStore_dest = WorldLocation(mapid, x, y, z, orientation);
|
||||
SetFallInformation(time(NULL), z);
|
||||
SetFallInformation(GameTime::GetGameTime(), z);
|
||||
// if the player is saved before worldportack (at logout for example)
|
||||
// this will be used instead of the current location in SaveToDB
|
||||
|
||||
|
|
@ -2422,7 +2423,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
|||
|
||||
// move packet sent by client always after far teleport
|
||||
// code for finish transfer to new map called in WorldSession::HandleMoveWorldportAckOpcode at client packet
|
||||
SetSemaphoreTeleportFar(time(NULL));
|
||||
SetSemaphoreTeleportFar(GameTime::GetGameTime());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -3468,8 +3469,8 @@ void Player::InitStatsForLevel(bool reapplyMods)
|
|||
|
||||
void Player::SendInitialSpells()
|
||||
{
|
||||
uint32 curTime = World::GetGameTimeMS();
|
||||
uint32 infTime = World::GetGameTimeMS()+infinityCooldownDelayCheck;
|
||||
uint32 curTime = GameTime::GetGameTimeMS();
|
||||
uint32 infTime = GameTime::GetGameTimeMS()+infinityCooldownDelayCheck;
|
||||
|
||||
uint16 spellCount = 0;
|
||||
|
||||
|
|
@ -3597,7 +3598,7 @@ void Player::UpdateNextMailTimeAndUnreads()
|
|||
{
|
||||
// calculate next delivery time (min. from non-delivered mails
|
||||
// and recalculate unReadMail
|
||||
time_t cTime = time(NULL);
|
||||
time_t cTime = GameTime::GetGameTime();
|
||||
m_nextMailDelivereTime = 0;
|
||||
unReadMails = 0;
|
||||
for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr)
|
||||
|
|
@ -3614,7 +3615,7 @@ void Player::UpdateNextMailTimeAndUnreads()
|
|||
|
||||
void Player::AddNewMailDeliverTime(time_t deliver_time)
|
||||
{
|
||||
if (deliver_time <= time(NULL)) // ready now
|
||||
if (deliver_time <= GameTime::GetGameTime()) // ready now
|
||||
{
|
||||
++unReadMails;
|
||||
SendNewMail();
|
||||
|
|
@ -4257,7 +4258,7 @@ void Player::RemoveCategoryCooldown(uint32 cat)
|
|||
void Player::RemoveArenaSpellCooldowns(bool removeActivePetCooldowns)
|
||||
{
|
||||
// remove cooldowns on spells that have < 10 min CD
|
||||
uint32 infTime = World::GetGameTimeMS()+infinityCooldownDelayCheck;
|
||||
uint32 infTime = GameTime::GetGameTimeMS()+infinityCooldownDelayCheck;
|
||||
SpellCooldowns::iterator itr, next;
|
||||
for (itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); itr = next)
|
||||
{
|
||||
|
|
@ -4289,7 +4290,7 @@ void Player::RemoveArenaSpellCooldowns(bool removeActivePetCooldowns)
|
|||
|
||||
void Player::RemoveAllSpellCooldown()
|
||||
{
|
||||
uint32 infTime = World::GetGameTimeMS()+infinityCooldownDelayCheck;
|
||||
uint32 infTime = GameTime::GetGameTimeMS()+infinityCooldownDelayCheck;
|
||||
if (!m_spellCooldowns.empty())
|
||||
{
|
||||
for (SpellCooldowns::const_iterator itr = m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr)
|
||||
|
|
@ -4308,7 +4309,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result)
|
|||
|
||||
if (result)
|
||||
{
|
||||
time_t curTime = time(NULL);
|
||||
time_t curTime = GameTime::GetGameTime();
|
||||
|
||||
do
|
||||
{
|
||||
|
|
@ -4344,8 +4345,8 @@ void Player::_SaveSpellCooldowns(SQLTransaction& trans, bool logout)
|
|||
stmt->setUInt32(0, GetGUIDLow());
|
||||
trans->Append(stmt);
|
||||
|
||||
time_t curTime = time(NULL);
|
||||
uint32 curMSTime = World::GetGameTimeMS();
|
||||
time_t curTime = GameTime::GetGameTime();
|
||||
uint32 curMSTime = GameTime::GetGameTimeMS();
|
||||
uint32 infTime = curMSTime + infinityCooldownDelayCheck;
|
||||
|
||||
bool first_round = true;
|
||||
|
|
@ -4399,7 +4400,7 @@ uint32 Player::resetTalentsCost() const
|
|||
return 10*GOLD;
|
||||
else
|
||||
{
|
||||
uint64 months = (sWorld->GetGameTime() - m_resetTalentsTime)/MONTH;
|
||||
uint64 months = (GameTime::GetGameTime() - m_resetTalentsTime)/MONTH;
|
||||
if (months > 0)
|
||||
{
|
||||
// This cost will be reduced by a rate of 5 gold per month
|
||||
|
|
@ -4508,7 +4509,7 @@ bool Player::resetTalents(bool noResetCost)
|
|||
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_NUMBER_OF_TALENT_RESETS, 1);
|
||||
|
||||
m_resetTalentsCost = resetCost;
|
||||
m_resetTalentsTime = time(NULL);
|
||||
m_resetTalentsTime = GameTime::GetGameTime();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -5049,7 +5050,7 @@ void Player::DeleteOldCharacters(uint32 keepDays)
|
|||
sLog->outString("Player::DeleteOldChars: Deleting all characters which have been deleted %u days before...", keepDays);
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_OLD_CHARS);
|
||||
stmt->setUInt32(0, uint32(time(NULL) - time_t(keepDays * DAY)));
|
||||
stmt->setUInt32(0, uint32(GameTime::GetGameTime() - time_t(keepDays * DAY)));
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
|
||||
if (result)
|
||||
|
|
@ -7166,8 +7167,8 @@ void Player::RewardReputation(Quest const* quest)
|
|||
void Player::UpdateHonorFields()
|
||||
{
|
||||
/// called when rewarding honor and at each save
|
||||
time_t now = time_t(time(NULL));
|
||||
time_t today = time_t(time(NULL) / DAY) * DAY;
|
||||
time_t now = time_t(GameTime::GetGameTime());
|
||||
time_t today = time_t(GameTime::GetGameTime() / DAY * DAY);
|
||||
|
||||
if (m_lastHonorUpdateTime < today)
|
||||
{
|
||||
|
|
@ -8977,7 +8978,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
|
|||
|
||||
// Xinef: loot was generated and respawntime has passed since then, allow to recreate loot
|
||||
// Xinef: to avoid bugs, this rule covers spawned gameobjects only
|
||||
if (go->isSpawnedByDefault() && go->getLootState() == GO_ACTIVATED && !go->loot.isLooted() && go->GetLootGenerationTime()+go->GetRespawnDelay() < time(NULL))
|
||||
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)
|
||||
|
|
@ -10015,7 +10016,7 @@ void Player::SendBattlefieldWorldStates()
|
|||
SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_SHOW_WORLDSTATE, wg->IsWarTime() ? 1 : 0);
|
||||
|
||||
for (uint32 i = 0; i < 2; ++i)
|
||||
SendUpdateWorldState(ClockWorldState[i], uint32(time(NULL) + (wg->GetTimer() / 1000)));
|
||||
SendUpdateWorldState(ClockWorldState[i], uint32(GameTime::GetGameTime() + (wg->GetTimer() / 1000)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13916,7 +13917,7 @@ void Player::AddItemToBuyBackSlot(Item* pItem)
|
|||
#endif
|
||||
|
||||
m_items[slot] = pItem;
|
||||
time_t base = time(NULL);
|
||||
time_t base = GameTime::GetGameTime();
|
||||
uint32 etime = uint32(base - m_logintime + (30 * 3600));
|
||||
uint32 eslot = slot - BUYBACK_SLOT_START;
|
||||
|
||||
|
|
@ -15670,7 +15671,7 @@ void Player::AddQuest(Quest const* quest, Object* questGiver)
|
|||
|
||||
AddTimedQuest(quest_id);
|
||||
questStatusData.Timer = timeAllowed * IN_MILLISECONDS;
|
||||
qtime = static_cast<uint32>(time(NULL)) + timeAllowed;
|
||||
qtime = static_cast<uint32>(GameTime::GetGameTime()) + timeAllowed;
|
||||
}
|
||||
else
|
||||
questStatusData.Timer = 0;
|
||||
|
|
@ -18059,7 +18060,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
|||
|
||||
SaveRecallPosition();
|
||||
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
time_t logoutTime = time_t(fields[27].GetUInt32());
|
||||
|
||||
// since last logout (in seconds)
|
||||
|
|
@ -18227,7 +18228,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder)
|
|||
SetUInt32Value(PLAYER_CHOSEN_TITLE, curTitle);
|
||||
|
||||
// has to be called after last Relocate() in Player::LoadFromDB
|
||||
SetFallInformation(time(NULL), GetPositionZ());
|
||||
SetFallInformation(GameTime::GetGameTime(), GetPositionZ());
|
||||
|
||||
_LoadSpellCooldowns(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_SPELL_COOLDOWNS));
|
||||
|
||||
|
|
@ -19095,10 +19096,10 @@ void Player::_LoadQuestStatus(PreparedQueryResult result)
|
|||
{
|
||||
AddTimedQuest(quest_id);
|
||||
|
||||
if (quest_time <= sWorld->GetGameTime())
|
||||
if (quest_time <= GameTime::GetGameTime())
|
||||
questStatusData.Timer = 1;
|
||||
else
|
||||
questStatusData.Timer = uint32((quest_time - sWorld->GetGameTime()) * IN_MILLISECONDS);
|
||||
questStatusData.Timer = uint32((quest_time - GameTime::GetGameTime()) * IN_MILLISECONDS);
|
||||
}
|
||||
else
|
||||
quest_time = 0;
|
||||
|
|
@ -19363,7 +19364,7 @@ void Player::SendRaidInfo()
|
|||
size_t p_counter = data.wpos();
|
||||
data << uint32(counter); // placeholder
|
||||
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
|
||||
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
|
||||
{
|
||||
|
|
@ -20033,7 +20034,7 @@ void Player::_SaveQuestStatus(SQLTransaction& trans)
|
|||
stmt->setUInt32(index++, statusItr->first);
|
||||
stmt->setUInt8(index++, uint8(statusItr->second.Status));
|
||||
stmt->setBool(index++, statusItr->second.Explored);
|
||||
stmt->setUInt32(index++, uint32(statusItr->second.Timer / IN_MILLISECONDS+ sWorld->GetGameTime()));
|
||||
stmt->setUInt32(index++, uint32(statusItr->second.Timer / IN_MILLISECONDS+ GameTime::GetGameTime()));
|
||||
|
||||
for (uint8 i = 0; i < QUEST_OBJECTIVES_COUNT; i++)
|
||||
stmt->setUInt16(index++, statusItr->second.CreatureOrGOCount[i]);
|
||||
|
|
@ -20956,7 +20957,7 @@ void Player::PetSpellInitialize()
|
|||
uint8 cooldownsCount = pet->m_CreatureSpellCooldowns.size();
|
||||
data << uint8(cooldownsCount);
|
||||
|
||||
uint32 curTime = World::GetGameTimeMS();
|
||||
uint32 curTime = GameTime::GetGameTimeMS();
|
||||
|
||||
for (CreatureSpellCooldowns::const_iterator itr = pet->m_CreatureSpellCooldowns.begin(); itr != pet->m_CreatureSpellCooldowns.end(); ++itr)
|
||||
{
|
||||
|
|
@ -21050,7 +21051,7 @@ void Player::VehicleSpellInitialize()
|
|||
// Cooldowns
|
||||
data << uint8(cooldownCount);
|
||||
|
||||
uint32 curTime = World::GetGameTimeMS();
|
||||
uint32 curTime = GameTime::GetGameTimeMS();
|
||||
|
||||
for (CreatureSpellCooldowns::const_iterator itr = vehicle->m_CreatureSpellCooldowns.begin(); itr != vehicle->m_CreatureSpellCooldowns.end(); ++itr)
|
||||
{
|
||||
|
|
@ -22231,7 +22232,7 @@ void Player::UpdatePvPState(bool onlyFFA)
|
|||
else // in friendly area
|
||||
{
|
||||
if (IsPvP() && !HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_IN_PVP) && pvpInfo.EndTimer == 0)
|
||||
pvpInfo.EndTimer = time(NULL); // start toggle-off
|
||||
pvpInfo.EndTimer = GameTime::GetGameTime(); // start toggle-off
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -22244,7 +22245,7 @@ void Player::UpdatePvP(bool state, bool _override)
|
|||
}
|
||||
else
|
||||
{
|
||||
pvpInfo.EndTimer = time(NULL);
|
||||
pvpInfo.EndTimer = GameTime::GetGameTime();
|
||||
SetPvP(state);
|
||||
}
|
||||
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_PVP_TIMER);
|
||||
|
|
@ -22368,7 +22369,7 @@ void Player::AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 ite
|
|||
void Player::AddSpellCooldown(uint32 spellid, uint32 itemid, uint32 end_time, bool needSendToClient, bool forceSendToSpectator)
|
||||
{
|
||||
SpellCooldown sc;
|
||||
sc.end = World::GetGameTimeMS()+end_time;
|
||||
sc.end = GameTime::GetGameTimeMS()+end_time;
|
||||
sc.itemid = itemid;
|
||||
sc.maxduration = end_time;
|
||||
sc.sendToSpectator = false;
|
||||
|
|
@ -22651,7 +22652,7 @@ void Player::LeaveBattleground(Battleground* bg)
|
|||
}
|
||||
|
||||
// xinef: reset corpse reclaim time
|
||||
m_deathExpireTime = time(NULL);
|
||||
m_deathExpireTime = GameTime::GetGameTime();
|
||||
|
||||
// pussywizard: clear movement, because after porting player will move to arena cords
|
||||
GetMotionMaster()->MovementExpired();
|
||||
|
|
@ -23120,7 +23121,7 @@ void Player::SendInitialPacketsBeforeAddToMap()
|
|||
SendEquipmentSetList();
|
||||
|
||||
data.Initialize(SMSG_LOGIN_SETTIMESPEED, 4 + 4 + 4);
|
||||
data.AppendPackedTime(sWorld->GetGameTime());
|
||||
data.AppendPackedTime(GameTime::GetGameTime());
|
||||
data << float(0.01666667f); // game speed
|
||||
data << uint32(0); // added in 3.1.2
|
||||
GetSession()->SendPacket(&data);
|
||||
|
|
@ -23302,7 +23303,7 @@ void Player::ApplyEquipCooldown(Item* pItem)
|
|||
|
||||
// Don't replace longer cooldowns by equip cooldown if we have any.
|
||||
SpellCooldowns::iterator itr = m_spellCooldowns.find(spellData.SpellId);
|
||||
if (itr != m_spellCooldowns.end() && itr->second.itemid == pItem->GetEntry() && itr->second.end > time(NULL) + 30)
|
||||
if (itr != m_spellCooldowns.end() && itr->second.itemid == pItem->GetEntry() && itr->second.end > GameTime::GetGameTime() + 30)
|
||||
continue;
|
||||
|
||||
// xinef: dont apply eqiup cooldown for spells with this attribute
|
||||
|
|
@ -23474,7 +23475,7 @@ void Player::SetDailyQuestStatus(uint32 quest_id)
|
|||
if (!GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx))
|
||||
{
|
||||
SetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx, quest_id);
|
||||
m_lastDailyQuestTime = time(NULL); // last daily quest time
|
||||
m_lastDailyQuestTime = GameTime::GetGameTime(); // last daily quest time
|
||||
m_DailyQuestChanged = true;
|
||||
break;
|
||||
}
|
||||
|
|
@ -23482,7 +23483,7 @@ void Player::SetDailyQuestStatus(uint32 quest_id)
|
|||
} else
|
||||
{
|
||||
m_DFQuests.insert(quest_id);
|
||||
m_lastDailyQuestTime = time(NULL);
|
||||
m_lastDailyQuestTime = GameTime::GetGameTime();
|
||||
m_DailyQuestChanged = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -23740,7 +23741,7 @@ void Player::SummonIfPossible(bool agree, uint32 summoner_guid)
|
|||
}
|
||||
|
||||
// expire and auto declined
|
||||
if (m_summon_expire < time(NULL))
|
||||
if (m_summon_expire < GameTime::GetGameTime())
|
||||
return;
|
||||
|
||||
// drop flag at summon
|
||||
|
|
@ -24262,7 +24263,7 @@ uint32 Player::GetCorpseReclaimDelay(bool pvp) const
|
|||
else if (!sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE))
|
||||
return 0;
|
||||
|
||||
time_t now = time(NULL);
|
||||
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;
|
||||
|
|
@ -24277,7 +24278,7 @@ void Player::UpdateCorpseReclaimDelay()
|
|||
(!pvp && !sWorld->getBoolConfig(CONFIG_DEATH_CORPSE_RECLAIM_DELAY_PVE)))
|
||||
return;
|
||||
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
|
||||
if (now < m_deathExpireTime)
|
||||
{
|
||||
|
|
@ -24321,7 +24322,7 @@ int32 Player::CalculateCorpseReclaimDelay(bool load)
|
|||
}
|
||||
|
||||
time_t expected_time = corpse->GetGhostTime() + copseReclaimDelay[count];
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
|
||||
if (now >= expected_time)
|
||||
return -1;
|
||||
|
|
@ -26287,7 +26288,7 @@ void Player::_SaveCharacter(bool create, SQLTransaction& trans)
|
|||
stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_TOTAL]);
|
||||
stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_LEVEL]);
|
||||
stmt->setFloat(index++, finiteAlways(_restBonus));
|
||||
stmt->setUInt32(index++, uint32(time(NULL)));
|
||||
stmt->setUInt32(index++, uint32(GameTime::GetGameTime()));
|
||||
stmt->setUInt8(index++, (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0));
|
||||
//save, far from tavern/city
|
||||
//save, but in tavern/city
|
||||
|
|
@ -26419,7 +26420,7 @@ void Player::_SaveCharacter(bool create, SQLTransaction& trans)
|
|||
stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_TOTAL]);
|
||||
stmt->setUInt32(index++, m_Played_time[PLAYED_TIME_LEVEL]);
|
||||
stmt->setFloat(index++, finiteAlways(_restBonus));
|
||||
stmt->setUInt32(index++, uint32(time(NULL)));
|
||||
stmt->setUInt32(index++, uint32(GameTime::GetGameTime()));
|
||||
stmt->setUInt8(index++, (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) ? 1 : 0));
|
||||
//save, far from tavern/city
|
||||
//save, but in tavern/city
|
||||
|
|
@ -26867,7 +26868,7 @@ void Player::ResetTimeSync()
|
|||
m_timeSyncCounter = 0;
|
||||
m_timeSyncTimer = 0;
|
||||
m_timeSyncClient = 0;
|
||||
m_timeSyncServer = World::GetGameTimeMS();
|
||||
m_timeSyncServer = GameTime::GetGameTimeMS();
|
||||
}
|
||||
|
||||
void Player::SendTimeSync()
|
||||
|
|
@ -26878,7 +26879,7 @@ void Player::SendTimeSync()
|
|||
|
||||
// Schedule next sync in 10 sec
|
||||
m_timeSyncTimer = 10000;
|
||||
m_timeSyncServer = World::GetGameTimeMS();
|
||||
m_timeSyncServer = GameTime::GetGameTimeMS();
|
||||
}
|
||||
|
||||
void Player::SetReputation(uint32 factionentry, uint32 value)
|
||||
|
|
@ -27330,7 +27331,7 @@ void Player::_LoadBrewOfTheMonth(PreparedQueryResult result)
|
|||
lastEventId = fields[0].GetUInt32();
|
||||
}
|
||||
|
||||
time_t curtime = time(NULL);
|
||||
time_t curtime = GameTime::GetGameTime();
|
||||
tm localTime;
|
||||
ACE_OS::localtime_r(&curtime, &localTime);
|
||||
|
||||
|
|
@ -27413,7 +27414,7 @@ bool Player::SetCanFly(bool apply, bool packetOnly /*= false*/)
|
|||
return false;
|
||||
|
||||
if (!apply)
|
||||
SetFallInformation(time(NULL), GetPositionZ());
|
||||
SetFallInformation(GameTime::GetGameTime(), GetPositionZ());
|
||||
|
||||
WorldPacket data(apply ? SMSG_MOVE_SET_CAN_FLY : SMSG_MOVE_UNSET_CAN_FLY, 12);
|
||||
data.append(GetPackGUID());
|
||||
|
|
@ -27497,3 +27498,36 @@ void Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
|
|||
AsynchPetSummon* asynchPetInfo = new AsynchPetSummon(entry, pos, petType, duration, createdBySpell, casterGUID);
|
||||
Pet::LoadPetFromDB(this, asynchLoadType, entry, 0, false, asynchPetInfo);
|
||||
}
|
||||
|
||||
void Player::SetSummonPoint(uint32 mapid, float x, float y, float z, uint32 delay, bool asSpectator)
|
||||
{
|
||||
m_summon_expire = GameTime::GetGameTime() + (delay ? delay : MAX_PLAYER_SUMMON_DELAY);
|
||||
m_summon_mapid = mapid;
|
||||
m_summon_x = x;
|
||||
m_summon_y = y;
|
||||
m_summon_z = z;
|
||||
m_summon_asSpectator = asSpectator;
|
||||
}
|
||||
|
||||
bool Player::IsSummonAsSpectator() const
|
||||
{
|
||||
return m_summon_asSpectator && m_summon_expire >= GameTime::GetGameTime();
|
||||
}
|
||||
|
||||
bool Player::HasSpellCooldown(uint32 spell_id) const
|
||||
{
|
||||
SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id);
|
||||
return itr != m_spellCooldowns.end() && itr->second.end > GameTime::GetGameTimeMS();
|
||||
}
|
||||
|
||||
bool Player::HasSpellItemCooldown(uint32 spell_id, uint32 itemid) const
|
||||
{
|
||||
SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id);
|
||||
return itr != m_spellCooldowns.end() && itr->second.end > GameTime::GetGameTimeMS() && itr->second.itemid == itemid;
|
||||
}
|
||||
|
||||
uint32 Player::GetSpellCooldownDelay(uint32 spell_id) const
|
||||
{
|
||||
SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id);
|
||||
return uint32(itr != m_spellCooldowns.end() && itr->second.end > GameTime::GetGameTimeMS() ? itr->second.end - GameTime::GetGameTimeMS() : 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1104,16 +1104,8 @@ class Player : public Unit, public GridObject<Player>
|
|||
}
|
||||
bool TeleportToEntryPoint();
|
||||
|
||||
void SetSummonPoint(uint32 mapid, float x, float y, float z, uint32 delay = 0, bool asSpectator = false)
|
||||
{
|
||||
m_summon_expire = time(NULL) + (delay ? delay : MAX_PLAYER_SUMMON_DELAY);
|
||||
m_summon_mapid = mapid;
|
||||
m_summon_x = x;
|
||||
m_summon_y = y;
|
||||
m_summon_z = z;
|
||||
m_summon_asSpectator = asSpectator;
|
||||
}
|
||||
bool IsSummonAsSpectator() const { return m_summon_asSpectator && m_summon_expire >= time(NULL); }
|
||||
void SetSummonPoint(uint32 mapid, float x, float y, float z, uint32 delay = 0, bool asSpectator = false);
|
||||
bool IsSummonAsSpectator() const;
|
||||
void SetSummonAsSpectator(bool on) { m_summon_asSpectator = on; }
|
||||
void SummonIfPossible(bool agree, uint32 summoner_guid);
|
||||
time_t GetSummonExpireTimer() const { return m_summon_expire; }
|
||||
|
|
@ -1738,21 +1730,9 @@ class Player : public Unit, public GridObject<Player>
|
|||
|
||||
static uint32 const infinityCooldownDelay = 0x9A7EC800; // used for set "infinity cooldowns" for spells and check, MONTH*IN_MILLISECONDS
|
||||
static uint32 const infinityCooldownDelayCheck = 0x4D3F6400; //MONTH*IN_MILLISECONDS/2;
|
||||
virtual bool HasSpellCooldown(uint32 spell_id) const
|
||||
{
|
||||
SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id);
|
||||
return itr != m_spellCooldowns.end() && itr->second.end > World::GetGameTimeMS();
|
||||
}
|
||||
virtual bool HasSpellItemCooldown(uint32 spell_id, uint32 itemid) const
|
||||
{
|
||||
SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id);
|
||||
return itr != m_spellCooldowns.end() && itr->second.end > World::GetGameTimeMS() && itr->second.itemid == itemid;
|
||||
}
|
||||
uint32 GetSpellCooldownDelay(uint32 spell_id) const
|
||||
{
|
||||
SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id);
|
||||
return uint32(itr != m_spellCooldowns.end() && itr->second.end > World::GetGameTimeMS() ? itr->second.end - World::GetGameTimeMS() : 0);
|
||||
}
|
||||
virtual bool HasSpellCooldown(uint32 spell_id) const;
|
||||
virtual bool HasSpellItemCooldown(uint32 spell_id, uint32 itemid) const;
|
||||
uint32 GetSpellCooldownDelay(uint32 spell_id) const;
|
||||
void AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 itemId, Spell* spell = NULL, bool infinityCooldown = false);
|
||||
virtual void AddSpellCooldown(uint32 spell_id, uint32 itemid, uint32 end_time, bool needSendToClient = false, bool forceSendToSpectator = false);
|
||||
void ModifySpellCooldown(uint32 spellId, int32 cooldown);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
#include "Vehicle.h"
|
||||
#include "MapReference.h"
|
||||
#include "Player.h"
|
||||
#include "GameTime.h"
|
||||
#include "Cell.h"
|
||||
#include "CellImpl.h"
|
||||
#include "WorldModel.h"
|
||||
|
|
@ -281,7 +282,7 @@ void MotionTransport::RemovePassenger(WorldObject* passenger, bool withAll)
|
|||
if (Player* plr = passenger->ToPlayer())
|
||||
{
|
||||
sScriptMgr->OnRemovePassenger(ToTransport(), plr);
|
||||
plr->SetFallInformation(time(NULL), plr->GetPositionZ());
|
||||
plr->SetFallInformation(GameTime::GetGameTime(), plr->GetPositionZ());
|
||||
}
|
||||
|
||||
if (withAll)
|
||||
|
|
@ -955,7 +956,7 @@ void StaticTransport::RemovePassenger(WorldObject* passenger, bool withAll)
|
|||
if (Player* plr = passenger->ToPlayer())
|
||||
{
|
||||
sScriptMgr->OnRemovePassenger(ToTransport(), plr);
|
||||
plr->SetFallInformation(time(NULL), plr->GetPositionZ());
|
||||
plr->SetFallInformation(GameTime::GetGameTime(), plr->GetPositionZ());
|
||||
}
|
||||
|
||||
if (withAll)
|
||||
|
|
|
|||
|
|
@ -278,12 +278,12 @@ i_motionMaster(new MotionMaster(this)), m_regenTimer(0), m_ThreatManager(this),
|
|||
bool GlobalCooldownMgr::HasGlobalCooldown(SpellInfo const* spellInfo) const
|
||||
{
|
||||
GlobalCooldownList::const_iterator itr = m_GlobalCooldowns.find(spellInfo->StartRecoveryCategory);
|
||||
return itr != m_GlobalCooldowns.end() && itr->second.duration && getMSTimeDiff(itr->second.cast_time, World::GetGameTimeMS()) < itr->second.duration;
|
||||
return itr != m_GlobalCooldowns.end() && itr->second.duration && getMSTimeDiff(itr->second.cast_time, GameTime::GetGameTimeMS()) < itr->second.duration;
|
||||
}
|
||||
|
||||
void GlobalCooldownMgr::AddGlobalCooldown(SpellInfo const* spellInfo, uint32 gcd)
|
||||
{
|
||||
m_GlobalCooldowns[spellInfo->StartRecoveryCategory] = GlobalCooldown(gcd, World::GetGameTimeMS());
|
||||
m_GlobalCooldowns[spellInfo->StartRecoveryCategory] = GlobalCooldown(gcd, GameTime::GetGameTimeMS());
|
||||
}
|
||||
|
||||
void GlobalCooldownMgr::CancelGlobalCooldown(SpellInfo const* spellInfo)
|
||||
|
|
@ -446,7 +446,7 @@ void Unit::SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint32 T
|
|||
|
||||
data << uint8(0); // new in 3.1
|
||||
data << GetPositionX() << GetPositionY() << GetPositionZ() + GetHoverHeight();
|
||||
data << World::GetGameTimeMS();
|
||||
data << GameTime::GetGameTimeMS();
|
||||
data << uint8(0);
|
||||
data << uint32(sf);
|
||||
data << TransitTime; // Time in between points
|
||||
|
|
@ -894,7 +894,7 @@ uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage
|
|||
{
|
||||
// Part of Evade mechanics. DoT's and Thorns / Retribution Aura do not contribute to this
|
||||
if (damagetype != DOT && damage > 0 && !IS_PLAYER_GUID(victim->GetOwnerGUID()) && (!spellProto || !spellProto->HasAura(SPELL_AURA_DAMAGE_SHIELD)))
|
||||
victim->ToCreature()->SetLastDamagedTime(sWorld->GetGameTime()+MAX_AGGRO_RESET_TIME);
|
||||
victim->ToCreature()->SetLastDamagedTime(GameTime::GetGameTime()+MAX_AGGRO_RESET_TIME);
|
||||
|
||||
if (attacker)
|
||||
victim->AddThreat(attacker, float(damage), damageSchoolMask, spellProto);
|
||||
|
|
@ -5137,7 +5137,7 @@ uint32 Unit::GetDiseasesByCaster(uint64 casterGUID, uint8 mode)
|
|||
{
|
||||
Aura* aura = (*i)->GetBase();
|
||||
if (aura && !aura->IsRemoved() && aura->GetDuration() > 0)
|
||||
if ((aura->GetApplyTime() + aura->GetMaxDuration()/1000 + 8) > (time(NULL) + aura->GetDuration()/1000))
|
||||
if ((aura->GetApplyTime() + aura->GetMaxDuration()/1000 + 8) > (GameTime::GetGameTime() + aura->GetDuration()/1000))
|
||||
aura->SetDuration(aura->GetDuration()+3000);
|
||||
}
|
||||
}
|
||||
|
|
@ -6819,7 +6819,7 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
|||
if (AuraEffect* aurEff = victim->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x100000, 0, 0, GetGUID()))
|
||||
if (Aura* aur = aurEff->GetBase())
|
||||
if (!aur->IsRemoved() && aur->GetDuration() > 0)
|
||||
if ((aur->GetApplyTime() + aur->GetMaxDuration()/1000 + 5) > (time(NULL) + aur->GetDuration()/1000) )
|
||||
if ((aur->GetApplyTime() + aur->GetMaxDuration()/1000 + 5) > (GameTime::GetGameTime() + aur->GetDuration()/1000) )
|
||||
{
|
||||
aur->SetDuration(aur->GetDuration()+2000);
|
||||
return true;
|
||||
|
|
@ -12334,7 +12334,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
|
|||
|
||||
WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
|
||||
data.append(GetPackGUID());
|
||||
data << uint32(sWorld->GetGameTime()); // Packet counter
|
||||
data << uint32(GameTime::GetGameTime()); // Packet counter
|
||||
data << player->GetCollisionHeight(true);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
|
@ -12354,7 +12354,7 @@ void Unit::Dismount()
|
|||
{
|
||||
WorldPacket data(SMSG_MOVE_SET_COLLISION_HGT, GetPackGUID().size() + 4 + 4);
|
||||
data.append(GetPackGUID());
|
||||
data << uint32(sWorld->GetGameTime()); // Packet counter
|
||||
data << uint32(GameTime::GetGameTime()); // Packet counter
|
||||
data << thisPlayer->GetCollisionHeight(false);
|
||||
thisPlayer->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
|
@ -13543,17 +13543,17 @@ Unit* Creature::SelectVictim()
|
|||
// pussywizard: if victim is not acceptable only due to mmaps, it may be for example a knockback, wait for a few secs before evading
|
||||
if (!target && !isWorldBoss() && !GetInstanceId() && IsAlive() && (!CanHaveThreatList() || !getThreatManager().isThreatListEmpty()))
|
||||
if (Unit* v = GetVictim())
|
||||
if (isTargetNotAcceptableByMMaps(v->GetGUID(), sWorld->GetGameTime(), v))
|
||||
if (isTargetNotAcceptableByMMaps(v->GetGUID(), GameTime::GetGameTime(), v))
|
||||
if (_CanDetectFeignDeathOf(v) && CanCreatureAttack(v))
|
||||
{
|
||||
if (m_mmapNotAcceptableStartTime)
|
||||
{
|
||||
if (sWorld->GetGameTime() <= m_mmapNotAcceptableStartTime+4)
|
||||
if (GameTime::GetGameTime() <= m_mmapNotAcceptableStartTime+4)
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_mmapNotAcceptableStartTime = sWorld->GetGameTime();
|
||||
m_mmapNotAcceptableStartTime = GameTime::GetGameTime();
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -13792,7 +13792,7 @@ DiminishingLevels Unit::GetDiminishing(DiminishingGroup group)
|
|||
return DIMINISHING_LEVEL_1;
|
||||
|
||||
// If last spell was casted more than 15 seconds ago - reset the count.
|
||||
if (i->stack == 0 && getMSTimeDiff(i->hitTime, World::GetGameTimeMS()) > 15000)
|
||||
if (i->stack == 0 && getMSTimeDiff(i->hitTime, GameTime::GetGameTimeMS()) > 15000)
|
||||
{
|
||||
i->hitCount = DIMINISHING_LEVEL_1;
|
||||
return DIMINISHING_LEVEL_1;
|
||||
|
|
@ -13815,7 +13815,7 @@ void Unit::IncrDiminishing(DiminishingGroup group)
|
|||
i->hitCount += 1;
|
||||
return;
|
||||
}
|
||||
m_Diminishing.push_back(DiminishingReturn(group, World::GetGameTimeMS(), DIMINISHING_LEVEL_2));
|
||||
m_Diminishing.push_back(DiminishingReturn(group, GameTime::GetGameTimeMS(), DIMINISHING_LEVEL_2));
|
||||
}
|
||||
|
||||
float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration, Unit* caster, DiminishingLevels Level, int32 limitduration)
|
||||
|
|
@ -13894,7 +13894,7 @@ void Unit::ApplyDiminishingAura(DiminishingGroup group, bool apply)
|
|||
i->stack -= 1;
|
||||
// Remember time after last aura from group removed
|
||||
if (i->stack == 0)
|
||||
i->hitTime = World::GetGameTimeMS();
|
||||
i->hitTime = GameTime::GetGameTimeMS();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -15919,7 +15919,7 @@ float Unit::GetAPMultiplier(WeaponAttackType attType, bool normalized)
|
|||
|
||||
bool Unit::IsUnderLastManaUseEffect() const
|
||||
{
|
||||
return getMSTimeDiff(m_lastManaUse, World::GetGameTimeMS()) < 5000;
|
||||
return getMSTimeDiff(m_lastManaUse, GameTime::GetGameTimeMS()) < 5000;
|
||||
}
|
||||
|
||||
void Unit::SetContestedPvP(Player* attackedPlayer)
|
||||
|
|
@ -17106,7 +17106,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
|
|||
GetCharmInfo()->SetPetNumber(sObjectMgr->GeneratePetNumber(), true);
|
||||
|
||||
// if charmed two demons the same session, the 2nd gets the 1st one's name
|
||||
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped
|
||||
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime())); // cast can't be helped
|
||||
}
|
||||
}
|
||||
GetMotionMaster()->MoveFollow(charmer, PET_FOLLOW_DIST, GetFollowAngle());
|
||||
|
|
@ -18331,7 +18331,7 @@ void Unit::_ExitVehicle(Position const* exitPosition)
|
|||
AddUnitState(UNIT_STATE_MOVE);
|
||||
|
||||
if (player)
|
||||
player->SetFallInformation(time(NULL), GetPositionZ());
|
||||
player->SetFallInformation(GameTime::GetGameTime(), GetPositionZ());
|
||||
else if (HasUnitMovementFlag(MOVEMENTFLAG_ROOT))
|
||||
{
|
||||
WorldPacket data(SMSG_SPLINE_MOVE_UNROOT, 8);
|
||||
|
|
@ -18412,7 +18412,7 @@ void Unit::BuildMovementPacket(ByteBuffer *data) const
|
|||
else
|
||||
*data << uint32(GetUnitMovementFlags()); // movement flags
|
||||
*data << uint16(GetExtraUnitMovementFlags()); // 2.3.0
|
||||
*data << uint32(World::GetGameTimeMS()); // time / counter
|
||||
*data << uint32(GameTime::GetGameTimeMS()); // time / counter
|
||||
*data << GetPositionX();
|
||||
*data << GetPositionY();
|
||||
*data << GetPositionZ() + GetHoverHeight();
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include "MapManager.h"
|
||||
#include "GossipDef.h"
|
||||
#include "Player.h"
|
||||
#include "GameTime.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "UnitAI.h"
|
||||
#include "GameObjectAI.h"
|
||||
|
|
@ -30,7 +31,7 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
|
|||
default:
|
||||
case GAMEEVENT_NORMAL:
|
||||
{
|
||||
time_t currenttime = time(NULL);
|
||||
time_t currenttime = GameTime::GetGameTime();
|
||||
// Get the event information
|
||||
return mGameEvent[entry].start < currenttime
|
||||
&& currenttime < mGameEvent[entry].end
|
||||
|
|
@ -47,7 +48,7 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
|
|||
// if inactive world event, check the prerequisite events
|
||||
case GAMEEVENT_WORLD_INACTIVE:
|
||||
{
|
||||
time_t currenttime = time(NULL);
|
||||
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
|
||||
|
|
@ -63,7 +64,7 @@ bool GameEventMgr::CheckOneGameEvent(uint16 entry) const
|
|||
|
||||
uint32 GameEventMgr::NextCheck(uint16 entry) const
|
||||
{
|
||||
time_t currenttime = time(NULL);
|
||||
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)
|
||||
|
|
@ -123,7 +124,7 @@ bool GameEventMgr::StartEvent(uint16 event_id, bool overwrite)
|
|||
ApplyNewEvent(event_id);
|
||||
if (overwrite)
|
||||
{
|
||||
mGameEvent[event_id].start = time(NULL);
|
||||
mGameEvent[event_id].start = GameTime::GetGameTime();
|
||||
if (data.end <= data.start)
|
||||
data.end = data.start + data.length;
|
||||
}
|
||||
|
|
@ -171,7 +172,7 @@ void GameEventMgr::StopEvent(uint16 event_id, bool overwrite)
|
|||
|
||||
if (overwrite && !serverwide_evt)
|
||||
{
|
||||
data.start = time(NULL) - data.length * MINUTE;
|
||||
data.start = GameTime::GetGameTime() - data.length * MINUTE;
|
||||
if (data.end <= data.start)
|
||||
data.end = data.start + data.length;
|
||||
}
|
||||
|
|
@ -1086,7 +1087,7 @@ void GameEventMgr::StartArenaSeason()
|
|||
|
||||
uint32 GameEventMgr::Update() // return the next event delay in ms
|
||||
{
|
||||
time_t currenttime = time(NULL);
|
||||
time_t currenttime = GameTime::GetGameTime();
|
||||
uint32 nextEventDelay = max_ge_check_delay; // 1 day
|
||||
uint32 calcDelay;
|
||||
std::set<uint16> activate, deactivate;
|
||||
|
|
@ -1668,7 +1669,7 @@ bool GameEventMgr::CheckOneGameEventConditions(uint16 event_id)
|
|||
// set the followup events' start time
|
||||
if (!mGameEvent[event_id].nextstart)
|
||||
{
|
||||
time_t currenttime = time(NULL);
|
||||
time_t currenttime = GameTime::GetGameTime();
|
||||
mGameEvent[event_id].nextstart = currenttime + mGameEvent[event_id].length * 60;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -1765,7 +1766,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(NULL);
|
||||
time_t curTime = GameTime::GetGameTime();
|
||||
for (int i = 0; i < MAX_HOLIDAY_DATES && holiday->Date[i]; ++i)
|
||||
{
|
||||
uint32 date = holiday->Date[i];
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include "Opcodes.h"
|
||||
#include "Pet.h"
|
||||
#include "Player.h"
|
||||
#include "GameTime.h"
|
||||
#include "Vehicle.h"
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
|
|
@ -381,7 +382,7 @@ Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia
|
|||
|
||||
void ObjectAccessor::RemoveOldCorpses()
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
Player2CorpsesMapType::iterator next;
|
||||
for (Player2CorpsesMapType::iterator itr = i_player2corpse.begin(); itr != i_player2corpse.end(); itr = next)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include "Chat.h"
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GossipDef.h"
|
||||
|
|
@ -1023,7 +1024,7 @@ void ObjectMgr::LoadCreatureAddons()
|
|||
|
||||
void ObjectMgr::LoadGameObjectAddons()
|
||||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
uint32 oldMSTime = GameTime::GetGameTimeMS();
|
||||
|
||||
// 0 1 2
|
||||
QueryResult result = WorldDatabase.Query("SELECT guid, invisibilityType, invisibilityValue FROM gameobject_addon");
|
||||
|
|
@ -5506,7 +5507,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
|
|||
{
|
||||
uint32 oldMSTime = getMSTime();
|
||||
|
||||
time_t curTime = time(NULL);
|
||||
time_t curTime = GameTime::GetGameTime();
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_EXPIRED_MAIL);
|
||||
stmt->setUInt32(0, curTime);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "GroupMgr.h"
|
||||
#include "Log.h"
|
||||
|
|
@ -2326,3 +2327,13 @@ void Group::ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply)
|
|||
slot->flags &= ~flag;
|
||||
}
|
||||
|
||||
uint32 Group::GetDifficultyChangePreventionTime() const
|
||||
{
|
||||
return _difficultyChangePreventionTime > GameTime::GetGameTime() ? _difficultyChangePreventionTime - GameTime::GetGameTime() : 0;
|
||||
}
|
||||
|
||||
void Group::SetDifficultyChangePrevention(DifficultyPreventionChangeType type)
|
||||
{
|
||||
_difficultyChangePreventionTime = GameTime::GetGameTime() + MINUTE;
|
||||
_difficultyChangePreventionType = type;
|
||||
}
|
||||
|
|
@ -299,13 +299,9 @@ class Group
|
|||
bool IsLfgHeroic() const { return isLFGGroup() && (m_lfgGroupFlags & GROUP_LFG_FLAG_IS_HEROIC); }
|
||||
|
||||
// Difficulty Change
|
||||
uint32 GetDifficultyChangePreventionTime() const { return _difficultyChangePreventionTime > time(NULL) ? _difficultyChangePreventionTime - time(NULL) : 0; }
|
||||
uint32 GetDifficultyChangePreventionTime() const;
|
||||
DifficultyPreventionChangeType GetDifficultyChangePreventionReason() const { return _difficultyChangePreventionType; }
|
||||
void SetDifficultyChangePrevention(DifficultyPreventionChangeType type)
|
||||
{
|
||||
_difficultyChangePreventionTime = time(NULL) + MINUTE;
|
||||
_difficultyChangePreventionType = type;
|
||||
}
|
||||
void SetDifficultyChangePrevention(DifficultyPreventionChangeType type);
|
||||
|
||||
protected:
|
||||
void _homebindIfInstance(Player* player);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "Chat.h"
|
||||
#include "Config.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "Language.h"
|
||||
|
|
@ -160,6 +161,8 @@ inline uint32 Guild::LogHolder::GetNextGUID()
|
|||
return m_nextGUID;
|
||||
}
|
||||
|
||||
Guild::LogEntry::LogEntry(uint32 guildId, uint32 guid) : m_guildId(guildId), m_guid(guid), m_timestamp(GameTime::GetGameTime()) { }
|
||||
|
||||
// EventLogEntry
|
||||
void Guild::EventLogEntry::SaveToDB(SQLTransaction& trans) const
|
||||
{
|
||||
|
|
@ -193,7 +196,7 @@ void Guild::EventLogEntry::WritePacket(WorldPacket& data) const
|
|||
if (m_eventType == GUILD_EVENT_LOG_PROMOTE_PLAYER || m_eventType == GUILD_EVENT_LOG_DEMOTE_PLAYER)
|
||||
data << uint8(m_newRank);
|
||||
// Event timestamp
|
||||
data << uint32(::time(NULL) - m_timestamp);
|
||||
data << uint32(::GameTime::GetGameTime() - m_timestamp);
|
||||
}
|
||||
|
||||
// BankEventLogEntry
|
||||
|
|
@ -243,7 +246,7 @@ void Guild::BankEventLogEntry::WritePacket(WorldPacket& data) const
|
|||
data << uint32(m_itemOrMoney);
|
||||
}
|
||||
|
||||
data << uint32(time(NULL) - m_timestamp);
|
||||
data << uint32(GameTime::GetGameTime() - m_timestamp);
|
||||
}
|
||||
|
||||
// RankInfo
|
||||
|
|
@ -638,6 +641,11 @@ void Guild::Member::ChangeRank(uint8 newRank)
|
|||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
void Guild::Member::UpdateLogoutTime()
|
||||
{
|
||||
m_logoutTime = GameTime::GetGameTime();
|
||||
}
|
||||
|
||||
void Guild::Member::SaveToDB(SQLTransaction& trans) const
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GUILD_MEMBER);
|
||||
|
|
@ -708,7 +716,7 @@ void Guild::Member::WritePacket(WorldPacket& data, bool sendOfficerNote) const
|
|||
<< uint32(m_zoneId);
|
||||
|
||||
if (!m_flags)
|
||||
data << float(float(::time(NULL) - m_logoutTime) / DAY);
|
||||
data << float(float(::GameTime::GetGameTime() - m_logoutTime) / DAY);
|
||||
|
||||
data << m_publicNote;
|
||||
|
||||
|
|
@ -1161,7 +1169,7 @@ bool Guild::Create(Player* pLeader, std::string const& name)
|
|||
m_info = "";
|
||||
m_motd = "No message set.";
|
||||
m_bankMoney = 0;
|
||||
m_createdDate = sWorld->GetGameTime();
|
||||
m_createdDate = GameTime::GetGameTime();
|
||||
_CreateLogHolders();
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
|
|
|
|||
|
|
@ -281,7 +281,6 @@ public: // pussywizard: public class Member
|
|||
m_level(0),
|
||||
m_class(0),
|
||||
m_flags(GUILDMEMBER_STATUS_NONE),
|
||||
m_logoutTime(::time(NULL)),
|
||||
m_accountId(0),
|
||||
m_rankId(rankId)
|
||||
{
|
||||
|
|
@ -320,7 +319,7 @@ public: // pussywizard: public class Member
|
|||
|
||||
void ChangeRank(uint8 newRank);
|
||||
|
||||
inline void UpdateLogoutTime() { m_logoutTime = ::time(NULL); }
|
||||
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(uint64 guid) const { return m_guid == guid; }
|
||||
|
|
@ -375,7 +374,7 @@ private:
|
|||
class LogEntry
|
||||
{
|
||||
public:
|
||||
LogEntry(uint32 guildId, uint32 guid) : m_guildId(guildId), m_guid(guid), m_timestamp(::time(NULL)) { }
|
||||
LogEntry(uint32 guildId, uint32 guid);
|
||||
LogEntry(uint32 guildId, uint32 guid, time_t timestamp) : m_guildId(guildId), m_guid(guid), m_timestamp(timestamp) { }
|
||||
virtual ~LogEntry() { }
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include "AuctionHouseMgr.h"
|
||||
#include "Log.h"
|
||||
#include "Language.h"
|
||||
#include "GameTime.h"
|
||||
#include "Opcodes.h"
|
||||
#include "UpdateMask.h"
|
||||
#include "Util.h"
|
||||
|
|
@ -278,7 +279,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
|
|||
AH->bidder = 0;
|
||||
AH->bid = 0;
|
||||
AH->buyout = buyout;
|
||||
AH->expire_time = time(NULL) + auctionTime;
|
||||
AH->expire_time = GameTime::GetGameTime() + auctionTime;
|
||||
AH->deposit = deposit;
|
||||
AH->auctionHouseEntry = auctionHouseEntry;
|
||||
|
||||
|
|
@ -320,7 +321,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
|
|||
AH->bidder = 0;
|
||||
AH->bid = 0;
|
||||
AH->buyout = buyout;
|
||||
AH->expire_time = time(NULL) + auctionTime;
|
||||
AH->expire_time = GameTime::GetGameTime() + auctionTime;
|
||||
AH->deposit = deposit;
|
||||
AH->auctionHouseEntry = auctionHouseEntry;
|
||||
|
||||
|
|
@ -648,7 +649,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recvData)
|
|||
{
|
||||
// pussywizard:
|
||||
const uint32 delay = 4500;
|
||||
const uint32 now = World::GetGameTimeMS();
|
||||
const uint32 now = GameTime::GetGameTimeMS();
|
||||
if (_lastAuctionListOwnerItemsMSTime > now) // list is pending
|
||||
return;
|
||||
uint32 diff = getMSTimeDiff(_lastAuctionListOwnerItemsMSTime, now);
|
||||
|
|
@ -665,7 +666,7 @@ void WorldSession::HandleAuctionListOwnerItemsEvent(WorldPacket & recvData)
|
|||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AUCTION_LIST_OWNER_ITEMS");
|
||||
#endif
|
||||
|
||||
_lastAuctionListOwnerItemsMSTime = World::GetGameTimeMS(); // pussywizard
|
||||
_lastAuctionListOwnerItemsMSTime = GameTime::GetGameTimeMS(); // pussywizard
|
||||
|
||||
uint32 listfrom;
|
||||
uint64 guid;
|
||||
|
|
@ -740,7 +741,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recvData)
|
|||
|
||||
// pussywizard:
|
||||
const uint32 delay = 2000;
|
||||
const uint32 now = World::GetGameTimeMS();
|
||||
const uint32 now = GameTime::GetGameTimeMS();
|
||||
uint32 diff = getMSTimeDiff(_lastAuctionListItemsMSTime, now);
|
||||
if (diff > delay)
|
||||
diff = delay;
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include "ArenaTeam.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "Battleground.h"
|
||||
#include "GameTime.h"
|
||||
#include "Chat.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
|
|
@ -535,7 +536,7 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recvData*/)
|
|||
if (!bg)
|
||||
continue;
|
||||
|
||||
uint32 remainingTime = (World::GetGameTimeMS() < ginfo.RemoveInviteTime ? getMSTimeDiff(World::GetGameTimeMS(), ginfo.RemoveInviteTime) : 1);
|
||||
uint32 remainingTime = (GameTime::GetGameTimeMS() < ginfo.RemoveInviteTime ? getMSTimeDiff(GameTime::GetGameTimeMS(), ginfo.RemoveInviteTime) : 1);
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, i, STATUS_WAIT_JOIN, remainingTime, 0, ginfo.ArenaType, TEAM_NEUTRAL, bg->isRated(), ginfo.BgTypeId);
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
|
@ -552,7 +553,7 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recvData*/)
|
|||
continue;
|
||||
|
||||
uint32 avgWaitTime = bgQueue.GetAverageQueueWaitTime(&ginfo);
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bgt, i, STATUS_WAIT_QUEUE, avgWaitTime, getMSTimeDiff(ginfo.JoinTime, World::GetGameTimeMS()), ginfo.ArenaType, TEAM_NEUTRAL, ginfo.IsRated);
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bgt, i, STATUS_WAIT_QUEUE, avgWaitTime, getMSTimeDiff(ginfo.JoinTime, GameTime::GetGameTimeMS()), ginfo.ArenaType, TEAM_NEUTRAL, ginfo.IsRated);
|
||||
SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ Copied events should probably have a new owner
|
|||
#include "ObjectMgr.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "WorldSession.h"
|
||||
|
|
@ -41,7 +42,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
|
|||
uint64 guid = _player->GetGUID();
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid);
|
||||
|
||||
time_t currTime = time(NULL);
|
||||
time_t currTime = GameTime::GetGameTime();
|
||||
|
||||
WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 1000); // Average size if no instance
|
||||
|
||||
|
|
@ -228,7 +229,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
|
|||
|
||||
// prevent events in the past
|
||||
// To Do: properly handle timezones and remove the "- time_t(86400L)" hack
|
||||
if (time_t(eventPackedTime) < (time(NULL) - time_t(86400L)))
|
||||
if (time_t(eventPackedTime) < (GameTime::GetGameTime() - time_t(86400L)))
|
||||
{
|
||||
recvData.rfinish();
|
||||
return;
|
||||
|
|
@ -320,7 +321,7 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
|
|||
|
||||
// prevent events in the past
|
||||
// To Do: properly handle timezones and remove the "- time_t(86400L)" hack
|
||||
if (time_t(eventPackedTime) < (time(NULL) - time_t(86400L)))
|
||||
if (time_t(eventPackedTime) < (GameTime::GetGameTime() - time_t(86400L)))
|
||||
{
|
||||
recvData.rfinish();
|
||||
return;
|
||||
|
|
@ -377,7 +378,7 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData)
|
|||
|
||||
// prevent events in the past
|
||||
// To Do: properly handle timezones and remove the "- time_t(86400L)" hack
|
||||
if (time_t(eventTime) < (time(NULL) - time_t(86400L)))
|
||||
if (time_t(eventTime) < (GameTime::GetGameTime() - time_t(86400L)))
|
||||
{
|
||||
recvData.rfinish();
|
||||
return;
|
||||
|
|
@ -517,7 +518,7 @@ void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData)
|
|||
}
|
||||
|
||||
CalendarInviteStatus status = tentative ? CALENDAR_STATUS_TENTATIVE : CALENDAR_STATUS_SIGNED_UP;
|
||||
CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), eventId, guid, guid, time(NULL), status, CALENDAR_RANK_PLAYER, "");
|
||||
CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), eventId, guid, guid, GameTime::GetGameTime(), status, CALENDAR_RANK_PLAYER, "");
|
||||
sCalendarMgr->AddInvite(calendarEvent, invite);
|
||||
sCalendarMgr->SendCalendarClearPendingAction(guid);
|
||||
}
|
||||
|
|
@ -549,7 +550,7 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData)
|
|||
if (CalendarInvite* invite = sCalendarMgr->GetInvite(inviteId))
|
||||
{
|
||||
invite->SetStatus(CalendarInviteStatus(status));
|
||||
invite->SetStatusTime(time(NULL));
|
||||
invite->SetStatusTime(GameTime::GetGameTime());
|
||||
|
||||
sCalendarMgr->UpdateInvite(invite);
|
||||
sCalendarMgr->SendCalendarEventStatus(*calendarEvent, *invite);
|
||||
|
|
@ -613,7 +614,7 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData)
|
|||
{
|
||||
invite->SetStatus((CalendarInviteStatus)status);
|
||||
// not sure if we should set response time when moderator changes invite status
|
||||
//invite->SetStatusTime(time(NULL));
|
||||
//invite->SetStatusTime(GameTime::GetGameTime());
|
||||
|
||||
sCalendarMgr->UpdateInvite(invite);
|
||||
sCalendarMgr->SendCalendarEventStatus(*calendarEvent, *invite);
|
||||
|
|
@ -713,7 +714,7 @@ void WorldSession::HandleSetSavedInstanceExtend(WorldPacket& recvData)
|
|||
void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "%s", add ? "SMSG_CALENDAR_RAID_LOCKOUT_ADDED" : "SMSG_CALENDAR_RAID_LOCKOUT_REMOVED");
|
||||
time_t currTime = time(NULL);
|
||||
time_t currTime = GameTime::GetGameTime();
|
||||
|
||||
WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_REMOVED, (add ? 4 : 0) + 4 + 4 + 4 + 8);
|
||||
if (add)
|
||||
|
|
@ -731,7 +732,7 @@ void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add)
|
|||
|
||||
void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save, bool isExtended)
|
||||
{
|
||||
time_t currTime = time(NULL);
|
||||
time_t currTime = GameTime::GetGameTime();
|
||||
time_t resetTime = isExtended ? save->GetExtendedResetTime() : save->GetResetTime();
|
||||
time_t resetTimeOp = isExtended ? save->GetResetTime() : save->GetExtendedResetTime();
|
||||
WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_UPDATED, 4 + 4 + 4 + 4 + 8);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include "Chat.h"
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
|
|
@ -109,7 +110,7 @@ bool LoginQueryHolder::Initialize()
|
|||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_MAILCOUNT);
|
||||
stmt->setUInt32(0, lowGuid);
|
||||
stmt->setUInt64(1, uint64(time(NULL)));
|
||||
stmt->setUInt64(1, uint64(GameTime::GetGameTime()));
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAIL_COUNT, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_MAILDATE);
|
||||
|
|
@ -1002,7 +1003,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
|
|||
stmt->setUInt32(1, GetAccountId());
|
||||
LoginDatabase.Execute(stmt);
|
||||
|
||||
pCurrChar->SetInGameTime(World::GetGameTimeMS());
|
||||
pCurrChar->SetInGameTime(GameTime::GetGameTimeMS());
|
||||
|
||||
// announce group about member online (must be after add to player list to receive announce to self)
|
||||
if (Group* group = pCurrChar->GetGroup())
|
||||
|
|
@ -1017,7 +1018,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
|
|||
if (mapDiff->resetTime)
|
||||
if (time_t timeReset = sInstanceSaveMgr->GetResetTimeFor(pCurrChar->GetMap()->GetId(), pCurrChar->GetMap()->GetDifficulty()))
|
||||
{
|
||||
uint32 timeleft = uint32(timeReset - time(NULL));
|
||||
uint32 timeleft = uint32(timeReset - GameTime::GetGameTime());
|
||||
pCurrChar->SendInstanceResetWarning(pCurrChar->GetMap()->GetId(), pCurrChar->GetMap()->GetDifficulty(), timeleft, true);
|
||||
}
|
||||
|
||||
|
|
@ -1263,7 +1264,7 @@ void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar)
|
|||
uint32 currZone, currArea;
|
||||
pCurrChar->GetZoneAndAreaId(currZone, currArea, false);
|
||||
pCurrChar->SendInitWorldStates(currZone, currArea);
|
||||
pCurrChar->SetInGameTime(World::GetGameTimeMS());
|
||||
pCurrChar->SetInGameTime(GameTime::GetGameTimeMS());
|
||||
|
||||
// Xinef: we need to resend all spell mods
|
||||
for (uint16 Opcode = SMSG_SET_FLAT_SPELL_MODIFIER; Opcode <= SMSG_SET_PCT_SPELL_MODIFIER; ++Opcode) // PCT = FLAT+1
|
||||
|
|
@ -1308,7 +1309,7 @@ void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar)
|
|||
if (mapDiff->resetTime)
|
||||
if (time_t timeReset = sInstanceSaveMgr->GetResetTimeFor(pCurrChar->GetMap()->GetId(), pCurrChar->GetMap()->GetDifficulty()))
|
||||
{
|
||||
uint32 timeleft = uint32(timeReset - time(NULL));
|
||||
uint32 timeleft = uint32(timeReset - GameTime::GetGameTime());
|
||||
GetPlayer()->SendInstanceResetWarning(pCurrChar->GetMap()->GetId(), pCurrChar->GetMap()->GetDifficulty(), timeleft, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
|
|||
|
||||
if (!_player->CanSpeak())
|
||||
{
|
||||
std::string timeStr = secsToTimeString(m_muteTime - time(NULL));
|
||||
std::string timeStr = secsToTimeString(m_muteTime - GameTime::GetGameTime());
|
||||
SendNotification(GetTrinityString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str());
|
||||
return;
|
||||
}
|
||||
|
|
@ -666,7 +666,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket & recvData)
|
|||
|
||||
if (!GetPlayer()->CanSpeak())
|
||||
{
|
||||
std::string timeStr = secsToTimeString(m_muteTime - time(NULL));
|
||||
std::string timeStr = secsToTimeString(m_muteTime - GameTime::GetGameTime());
|
||||
SendNotification(GetTrinityString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str());
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "Common.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "GameTime.h"
|
||||
#include "Log.h"
|
||||
#include "Opcodes.h"
|
||||
#include "UpdateData.h"
|
||||
|
|
@ -35,7 +36,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
|
|||
sLog->outStaticDebug("Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName().c_str());
|
||||
#endif
|
||||
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
player->duel->startTimer = now;
|
||||
plTarget->duel->startTimer = now;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "LFGMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "Player.h"
|
||||
#include "Opcodes.h"
|
||||
|
|
@ -548,7 +549,7 @@ void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot)
|
|||
lfg::LfgAnswer playerVote = boot.votes.find(guid)->second;
|
||||
uint8 votesNum = 0;
|
||||
uint8 agreeNum = 0;
|
||||
uint32 secsleft = boot.cancelTime - time(NULL);
|
||||
uint32 secsleft = boot.cancelTime - GameTime::GetGameTime();
|
||||
for (lfg::LfgAnswerContainer::const_iterator it = boot.votes.begin(); it != boot.votes.end(); ++it)
|
||||
{
|
||||
if (it->second != lfg::LFG_ANSWER_PENDING)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "Opcodes.h"
|
||||
#include "GameTime.h"
|
||||
#include "Log.h"
|
||||
#include "World.h"
|
||||
#include "ObjectMgr.h"
|
||||
|
|
@ -365,7 +366,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recvData)
|
|||
|
||||
Player* player = _player;
|
||||
Mail* m = player->GetMail(mailId);
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime())
|
||||
{
|
||||
player->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
|
|
@ -430,7 +431,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recvData)
|
|||
Player* player = _player;
|
||||
|
||||
Mail* m = player->GetMail(mailId);
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime())
|
||||
{
|
||||
player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
|
|
@ -530,7 +531,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket& recvData)
|
|||
Player* player = _player;
|
||||
|
||||
Mail* m = player->GetMail(mailId);
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL))
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime())
|
||||
{
|
||||
player->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
|
|
@ -579,7 +580,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recvData)
|
|||
WorldPacket data(SMSG_MAIL_LIST_RESULT, (200)); // guess size
|
||||
data << uint32(0); // real mail's count
|
||||
data << uint8(0); // mail's count
|
||||
time_t cur_time = time(NULL);
|
||||
time_t cur_time = GameTime::GetGameTime();
|
||||
|
||||
for (PlayerMails::iterator itr = player->GetMailBegin(); itr != player->GetMailEnd(); ++itr)
|
||||
{
|
||||
|
|
@ -626,7 +627,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recvData)
|
|||
data << uint32((*itr)->stationery); // stationery (Stationery.dbc)
|
||||
data << uint32((*itr)->money); // Gold
|
||||
data << uint32((*itr)->checked); // flags
|
||||
data << float(float((*itr)->expire_time-time(NULL))/DAY); // Time
|
||||
data << float(float((*itr)->expire_time-GameTime::GetGameTime())/DAY); // Time
|
||||
data << uint32((*itr)->mailTemplateId); // mail template (MailTemplate.dbc)
|
||||
data << (*itr)->subject; // Subject string - once 00, when mail type = 3, max 256
|
||||
data << (*itr)->body; // message? max 8000
|
||||
|
|
@ -690,7 +691,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recvData)
|
|||
Player* player = _player;
|
||||
|
||||
Mail* m = player->GetMail(mailId);
|
||||
if (!m || (m->body.empty() && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL) || (m->checked & MAIL_CHECK_MASK_COPIED))
|
||||
if (!m || (m->body.empty() && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime() || (m->checked & MAIL_CHECK_MASK_COPIED))
|
||||
{
|
||||
player->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
|
|
@ -757,7 +758,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recvData*/)
|
|||
data << uint32(0); // count
|
||||
|
||||
uint32 count = 0;
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
std::set<uint32> sentSenders;
|
||||
for (PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include "World.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "WorldSession.h"
|
||||
#include "BigNumber.h"
|
||||
#include "SHA1.h"
|
||||
|
|
@ -218,7 +219,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData)
|
|||
{
|
||||
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_WHO Message");
|
||||
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
if (now < timeWhoCommandAllowed)
|
||||
return;
|
||||
timeWhoCommandAllowed = now + 3;
|
||||
|
|
@ -466,7 +467,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/)
|
|||
GetPlayer()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
|
||||
}
|
||||
|
||||
LogoutRequest(time(NULL));
|
||||
LogoutRequest(GameTime::GetGameTime());
|
||||
}
|
||||
|
||||
void WorldSession::HandlePlayerLogoutOpcode(WorldPacket & /*recv_data*/)
|
||||
|
|
@ -817,7 +818,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data)
|
|||
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(NULL)))
|
||||
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))
|
||||
|
|
@ -1524,7 +1525,7 @@ void WorldSession::HandleTimeSyncResp(WorldPacket & recv_data)
|
|||
{
|
||||
uint32 counter, clientTicks;
|
||||
recv_data >> counter >> clientTicks;
|
||||
//uint32 ourTicks = clientTicks + (World::GetGameTimeMS() - _player->m_timeSyncServer);
|
||||
//uint32 ourTicks = clientTicks + (GameTime::GetGameTimeMS() - _player->m_timeSyncServer);
|
||||
_player->m_timeSyncClient = clientTicks;
|
||||
}
|
||||
|
||||
|
|
@ -1858,7 +1859,7 @@ void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& /*recv_data*/)
|
|||
#endif
|
||||
|
||||
WorldPacket data(SMSG_WORLD_STATE_UI_TIMER_UPDATE, 4);
|
||||
data << uint32(time(NULL));
|
||||
data << uint32(GameTime::GetGameTime());
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
|||
_player->SetIsSpectator(false);
|
||||
|
||||
GetPlayer()->SetPendingSpectatorForBG(0);
|
||||
timeWhoCommandAllowed = time(NULL) + sWorld->GetNextWhoListUpdateDelaySecs() + 1; // after exiting arena Subscribe will scan for a player and cached data says he is still in arena, so disallow until next update
|
||||
timeWhoCommandAllowed = GameTime::GetGameTime() + sWorld->GetNextWhoListUpdateDelaySecs() + 1; // after exiting arena Subscribe will scan for a player and cached data says he is still in arena, so disallow until next update
|
||||
|
||||
if (uint32 inviteInstanceId = _player->GetPendingSpectatorInviteInstanceId())
|
||||
{
|
||||
|
|
@ -193,7 +193,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
|||
if (mapDiff->resetTime)
|
||||
if (time_t timeReset = sInstanceSaveMgr->GetResetTimeFor(mEntry->MapID, diff))
|
||||
{
|
||||
uint32 timeleft = uint32(timeReset - time(NULL));
|
||||
uint32 timeleft = uint32(timeReset - GameTime::GetGameTime());
|
||||
GetPlayer()->SendInstanceResetWarning(mEntry->MapID, diff, timeleft, true);
|
||||
}
|
||||
allowMount = mInstance->AllowMount;
|
||||
|
|
@ -408,7 +408,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recvData)
|
|||
if (mover->GetGUID() != _player->GetGUID())
|
||||
movementInfo.flags &= ~MOVEMENTFLAG_WALKING;
|
||||
|
||||
uint32 mstime = World::GetGameTimeMS();
|
||||
uint32 mstime = GameTime::GetGameTimeMS();
|
||||
/*----------------------*/
|
||||
if(m_clientTimeDelay == 0)
|
||||
m_clientTimeDelay = mstime > movementInfo.time ? std::min(mstime - movementInfo.time, (uint32)100) : 0;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "Log.h"
|
||||
#include "Opcodes.h"
|
||||
|
|
@ -128,7 +129,7 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result,
|
|||
Map* map = owner->GetMap();
|
||||
uint32 guid = sObjectMgr->GenerateLowGuid(HIGHGUID_PET);
|
||||
Pet* pet = new Pet(owner, pet_type);
|
||||
LoadPetFromDBQueryHolder* holder = new LoadPetFromDBQueryHolder(pet_number, current, uint32(time(NULL) - fields[14].GetUInt32()), fields[13].GetString(), savedhealth, savedmana);
|
||||
LoadPetFromDBQueryHolder* holder = new LoadPetFromDBQueryHolder(pet_number, current, uint32(GameTime::GetGameTime() - fields[14].GetUInt32()), fields[13].GetString(), savedhealth, savedmana);
|
||||
if (!pet->Create(guid, map, owner->GetPhaseMask(), petentry, pet_number) || !holder->Initialize())
|
||||
{
|
||||
delete pet;
|
||||
|
|
@ -198,7 +199,7 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result,
|
|||
break;
|
||||
}
|
||||
|
||||
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped here
|
||||
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime())); // cast can't be helped here
|
||||
pet->SetCreatorGUID(owner->GetGUID());
|
||||
owner->SetMinion(pet, true);
|
||||
|
||||
|
|
@ -552,7 +553,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
|
|||
|
||||
// pussywizard:
|
||||
if (Creature* creaturePet = pet->ToCreature())
|
||||
if (!creaturePet->_CanDetectFeignDeathOf(TargetUnit) || !creaturePet->CanCreatureAttack(TargetUnit) || creaturePet->isTargetNotAcceptableByMMaps(TargetUnit->GetGUID(), sWorld->GetGameTime(), TargetUnit))
|
||||
if (!creaturePet->_CanDetectFeignDeathOf(TargetUnit) || !creaturePet->CanCreatureAttack(TargetUnit) || creaturePet->isTargetNotAcceptableByMMaps(TargetUnit->GetGUID(), GameTime::GetGameTime(), TargetUnit))
|
||||
return;
|
||||
|
||||
// Not let attack through obstructions
|
||||
|
|
@ -1191,7 +1192,7 @@ void WorldSession::HandlePetRename(WorldPacket & recvData)
|
|||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped
|
||||
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime())); // cast can't be helped
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetAbandon(WorldPacket & recvData)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "Common.h"
|
||||
#include "Language.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "Opcodes.h"
|
||||
|
|
@ -72,8 +73,8 @@ void WorldSession::HandleQueryTimeOpcode(WorldPacket & /*recvData*/)
|
|||
void WorldSession::SendQueryTimeResponse()
|
||||
{
|
||||
WorldPacket data(SMSG_QUERY_TIME_RESPONSE, 4+4);
|
||||
data << uint32(time(NULL));
|
||||
data << uint32(sWorld->GetNextDailyQuestsResetTime() - time(NULL));
|
||||
data << uint32(GameTime::GetGameTime());
|
||||
data << uint32(sWorld->GetNextDailyQuestsResetTime() - GameTime::GetGameTime());
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "Language.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Opcodes.h"
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
#include "TicketMgr.h"
|
||||
#include "Util.h"
|
||||
|
|
@ -237,7 +238,7 @@ void WorldSession::HandleReportLag(WorldPacket& recv_data)
|
|||
stmt->setFloat (4, y);
|
||||
stmt->setFloat (5, z);
|
||||
stmt->setUInt32(6, GetLatency());
|
||||
stmt->setUInt32(7, time(NULL));
|
||||
stmt->setUInt32(7, GameTime::GetGameTime());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#include "ObjectMgr.h"
|
||||
#include "World.h"
|
||||
#include "Group.h"
|
||||
#include "GameTime.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
|
|
@ -77,7 +78,7 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance
|
|||
}
|
||||
else
|
||||
{
|
||||
resetTime = time(NULL) + 3*DAY; // normals expire after 3 days even if someone is still bound to them, cleared on startup
|
||||
resetTime = GameTime::GetGameTime() + 3*DAY; // normals expire after 3 days even if someone is still bound to them, cleared on startup
|
||||
extendedResetTime = 0;
|
||||
}
|
||||
InstanceSave* save = new InstanceSave(mapId, instanceId, difficulty, resetTime, extendedResetTime);
|
||||
|
|
@ -239,7 +240,7 @@ void InstanceSaveManager::LoadInstances()
|
|||
|
||||
void InstanceSaveManager::LoadResetTimes()
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
time_t today = (now / DAY) * DAY;
|
||||
|
||||
// load the global respawn times for raid/heroic instances
|
||||
|
|
@ -400,7 +401,7 @@ void InstanceSaveManager::ScheduleReset(time_t time, InstResetEvent event)
|
|||
|
||||
void InstanceSaveManager::Update()
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
time_t t;
|
||||
bool resetOccurred = false;
|
||||
|
||||
|
|
@ -499,7 +500,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
|
|||
if (!mapEntry->Instanceable())
|
||||
return;
|
||||
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
|
||||
if (!warn)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "Log.h"
|
||||
#include "World.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
#include "Unit.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
|
|
@ -175,7 +176,7 @@ void MailDraft::SendMailTo(SQLTransaction& trans, MailReceiver const& receiver,
|
|||
|
||||
uint32 mailId = sObjectMgr->GenerateMailID();
|
||||
|
||||
time_t deliver_time = time(NULL) + 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;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "Vehicle.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "LFGMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "Chat.h"
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
|
|
@ -2648,7 +2649,7 @@ bool InstanceMap::AddPlayerToMap(Player* player)
|
|||
// increase current instances (hourly limit)
|
||||
// xinef: specific instances are still limited
|
||||
if (!group || !group->isLFGGroup() || !group->IsLfgRandomInstance())
|
||||
player->AddInstanceEnterTime(GetInstanceId(), time(NULL));
|
||||
player->AddInstanceEnterTime(GetInstanceId(), GameTime::GetGameTime());
|
||||
|
||||
if (!playerBind->perm && !mapSave->CanReset() && (!group || !group->isLFGGroup() || !group->IsLfgRandomInstance()))
|
||||
{
|
||||
|
|
@ -2994,7 +2995,7 @@ void Map::SaveCreatureRespawnTime(uint32 dbGuid, time_t& respawnTime)
|
|||
return;
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
if (GetInstanceResetPeriod() > 0 && respawnTime-now+5 >= GetInstanceResetPeriod())
|
||||
respawnTime = now+YEAR;
|
||||
|
||||
|
|
@ -3028,7 +3029,7 @@ void Map::SaveGORespawnTime(uint32 dbGuid, time_t& respawnTime)
|
|||
return;
|
||||
}
|
||||
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
if (GetInstanceResetPeriod() > 0 && respawnTime-now+5 >= GetInstanceResetPeriod())
|
||||
respawnTime = now+YEAR;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "MotionMaster.h"
|
||||
#include "CreatureAISelector.h"
|
||||
#include "Creature.h"
|
||||
#include "GameTime.h"
|
||||
|
||||
#include "ConfusedMovementGenerator.h"
|
||||
#include "FleeingMovementGenerator.h"
|
||||
|
|
@ -535,7 +536,7 @@ void MotionMaster::MoveFall(uint32 id /*=0*/, bool addFlagForNPC)
|
|||
{
|
||||
_owner->AddUnitMovementFlag(MOVEMENTFLAG_FALLING);
|
||||
_owner->m_movementInfo.SetFallTime(0);
|
||||
_owner->ToPlayer()->SetFallInformation(time(NULL), _owner->GetPositionZ());
|
||||
_owner->ToPlayer()->SetFallInformation(GameTime::GetGameTime(), _owner->GetPositionZ());
|
||||
}
|
||||
else if (_owner->GetTypeId() == TYPEID_UNIT && addFlagForNPC) // pussywizard
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include "MoveSplineInit.h"
|
||||
#include "MoveSpline.h"
|
||||
#include "Player.h"
|
||||
#include "GameTime.h"
|
||||
#include "Spell.h"
|
||||
#include "BattlegroundRV.h"
|
||||
#include "VehicleDefines.h"
|
||||
|
|
@ -66,7 +67,7 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T* owner, bool ini
|
|||
if (useMMaps && !inRange && (!isPlayerPet || i_target->GetPositionZ()-z > 50.0f))
|
||||
{
|
||||
//useMMaps = false;
|
||||
owner->m_targetsNotAcceptable[i_target->GetGUID()] = MMapTargetData(sWorld->GetGameTime()+DISALLOW_TIME_AFTER_FAIL, owner, i_target.getTarget());
|
||||
owner->m_targetsNotAcceptable[i_target->GetGUID()] = MMapTargetData(GameTime::GetGameTime()+DISALLOW_TIME_AFTER_FAIL, owner, i_target.getTarget());
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -174,7 +175,7 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T* owner, bool ini
|
|||
}
|
||||
}
|
||||
|
||||
if (!forceDest && getMSTimeDiff(lastPathingFailMSTime, World::GetGameTimeMS()) < 1000)
|
||||
if (!forceDest && getMSTimeDiff(lastPathingFailMSTime, GameTime::GetGameTimeMS()) < 1000)
|
||||
{
|
||||
lastOwnerXYZ.Relocate(-5000.0f, -5000.0f, -5000.0f);
|
||||
return;
|
||||
|
|
@ -186,8 +187,8 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T* owner, bool ini
|
|||
float maxDist = MELEE_RANGE + owner->GetMeleeReach() + i_target->GetMeleeReach();
|
||||
if (!forceDest && (i_path->GetPathType() & PATHFIND_NOPATH || (!i_offset && !isPlayerPet && i_target->GetExactDistSq(i_path->GetActualEndPosition().x, i_path->GetActualEndPosition().y, i_path->GetActualEndPosition().z) > maxDist*maxDist)))
|
||||
{
|
||||
lastPathingFailMSTime = World::GetGameTimeMS();
|
||||
owner->m_targetsNotAcceptable[i_target->GetGUID()] = MMapTargetData(sWorld->GetGameTime()+DISALLOW_TIME_AFTER_FAIL, owner, i_target.getTarget());
|
||||
lastPathingFailMSTime = GameTime::GetGameTimeMS();
|
||||
owner->m_targetsNotAcceptable[i_target->GetGUID()] = MMapTargetData(GameTime::GetGameTime()+DISALLOW_TIME_AFTER_FAIL, owner, i_target.getTarget());
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "ObjectMgr.h"
|
||||
#include "World.h"
|
||||
#include "Transport.h"
|
||||
#include "GameTime.h"
|
||||
//Flightmaster grid preloading
|
||||
#include "MapManager.h"
|
||||
//Creature-specific headers
|
||||
|
|
@ -317,7 +318,7 @@ void FlightPathMovementGenerator::DoFinalize(Player* player)
|
|||
// this prevent cheating with landing point at lags
|
||||
// when client side flight end early in comparison server side
|
||||
player->StopMoving();
|
||||
player->SetFallInformation(time(NULL), player->GetPositionZ());
|
||||
player->SetFallInformation(GameTime::GetGameTime(), player->GetPositionZ());
|
||||
}
|
||||
|
||||
player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_TAXI_BENCHMARK);
|
||||
|
|
@ -406,7 +407,7 @@ bool FlightPathMovementGenerator::DoUpdate(Player* player, uint32 /*diff*/)
|
|||
if (i_currentNode >= i_path.size() - 1)
|
||||
{
|
||||
player->CleanupAfterTaxiFlight();
|
||||
player->SetFallInformation(time(NULL), player->GetPositionZ());
|
||||
player->SetFallInformation(GameTime::GetGameTime(), player->GetPositionZ());
|
||||
if (player->pvpInfo.IsHostile)
|
||||
player->CastSpell(player, 2479, true);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include "MapManager.h"
|
||||
#include "MapRefManager.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "Pet.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
|
@ -43,7 +44,7 @@ void Map::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, O
|
|||
sa.ownerGUID = ownerGUID;
|
||||
|
||||
sa.script = &iter->second;
|
||||
m_scriptSchedule.insert(ScriptScheduleMap::value_type(time_t(sWorld->GetGameTime() + iter->first), sa));
|
||||
m_scriptSchedule.insert(ScriptScheduleMap::value_type(time_t(GameTime::GetGameTime() + iter->first), sa));
|
||||
if (iter->first == 0)
|
||||
immedScript = true;
|
||||
|
||||
|
|
@ -73,7 +74,7 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou
|
|||
sa.ownerGUID = ownerGUID;
|
||||
|
||||
sa.script = &script;
|
||||
m_scriptSchedule.insert(ScriptScheduleMap::value_type(time_t(sWorld->GetGameTime() + delay), sa));
|
||||
m_scriptSchedule.insert(ScriptScheduleMap::value_type(time_t(GameTime::GetGameTime() + delay), sa));
|
||||
|
||||
sScriptMgr->IncreaseScheduledScriptsCount();
|
||||
|
||||
|
|
@ -280,7 +281,7 @@ void Map::ScriptsProcess()
|
|||
///- Process overdue queued scripts
|
||||
ScriptScheduleMap::iterator iter = m_scriptSchedule.begin();
|
||||
// ok as multimap is a *sorted* associative container
|
||||
while (!m_scriptSchedule.empty() && (iter->first <= sWorld->GetGameTime()))
|
||||
while (!m_scriptSchedule.empty() && (iter->first <= GameTime::GetGameTime()))
|
||||
{
|
||||
ScriptAction const& step = iter->second;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "Config.h"
|
||||
#include "ByteBuffer.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "GameTime.h"
|
||||
|
||||
PacketLog::PacketLog() : _file(NULL)
|
||||
{
|
||||
|
|
@ -40,7 +41,7 @@ void PacketLog::LogPacket(WorldPacket const& packet, Direction direction)
|
|||
ByteBuffer data(4+4+4+1+packet.size());
|
||||
data << int32(packet.GetOpcode());
|
||||
data << int32(packet.size());
|
||||
data << uint32(time(NULL));
|
||||
data << uint32(GameTime::GetGameTime());
|
||||
data << uint8(direction);
|
||||
|
||||
for (uint32 i = 0; i < packet.size(); i++)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include "GuildMgr.h"
|
||||
#include "Group.h"
|
||||
#include "Guild.h"
|
||||
#include "GameTime.h"
|
||||
#include "World.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
|
|
@ -197,13 +198,13 @@ void WorldSession::SendPacket(WorldPacket const* packet)
|
|||
static uint64 sendPacketCount = 0;
|
||||
static uint64 sendPacketBytes = 0;
|
||||
|
||||
static time_t firstTime = time(NULL);
|
||||
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(NULL);
|
||||
time_t cur_time = GameTime::GetGameTime();
|
||||
|
||||
if ((cur_time - lastTime) < 60)
|
||||
{
|
||||
|
|
@ -389,7 +390,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
|
|||
|
||||
if (updater.ProcessLogout())
|
||||
{
|
||||
time_t currTime = time(NULL);
|
||||
time_t currTime = GameTime::GetGameTime();
|
||||
if (ShouldLogOut(currTime) && !m_playerLoading)
|
||||
LogoutPlayer(true);
|
||||
|
||||
|
|
@ -426,7 +427,7 @@ void WorldSession::HandleTeleportTimeout(bool updateInSessions)
|
|||
// pussywizard: handle teleport ack timeout
|
||||
if (m_Socket && !m_Socket->IsClosed() && GetPlayer() && GetPlayer()->IsBeingTeleported())
|
||||
{
|
||||
time_t currTime = time(NULL);
|
||||
time_t currTime = GameTime::GetGameTime();
|
||||
if (updateInSessions) // session update from World::UpdateSessions
|
||||
{
|
||||
if (GetPlayer()->IsBeingTeleportedFar() && GetPlayer()->GetSemaphoreTeleportFar()+sWorld->getIntConfig(CONFIG_TELEPORT_TIMEOUT_FAR) < currTime)
|
||||
|
|
@ -769,7 +770,7 @@ void WorldSession::SetAccountData(AccountDataType type, time_t tm, std::string c
|
|||
void WorldSession::SendAccountDataTimes(uint32 mask)
|
||||
{
|
||||
WorldPacket data(SMSG_ACCOUNT_DATA_TIMES, 4 + 1 + 4 + 8 * 4); // changed in WotLK
|
||||
data << uint32(time(NULL)); // unix time of something
|
||||
data << uint32(GameTime::GetGameTime()); // unix time of something
|
||||
data << uint8(1);
|
||||
data << uint32(mask); // type mask
|
||||
for (uint32 i = 0; i < NUM_ACCOUNT_DATA_TYPES; ++i)
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "ByteBuffer.h"
|
||||
#include "Opcodes.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "BigNumber.h"
|
||||
#include "SHA1.h"
|
||||
#include "WorldSession.h"
|
||||
|
|
@ -839,7 +840,7 @@ int WorldSocket::HandleAuthSession(WorldPacket& recvPacket)
|
|||
//! Negative mutetime indicates amount of seconds to be muted effective on next login - which is now.
|
||||
if (mutetime < 0)
|
||||
{
|
||||
mutetime = time(NULL) + llabs(mutetime);
|
||||
mutetime = GameTime::GetGameTime() + llabs(mutetime);
|
||||
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_MUTE_TIME_LOGIN);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include "Formulas.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "GameTime.h"
|
||||
#include "CellImpl.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "Vehicle.h"
|
||||
|
|
@ -2843,7 +2844,7 @@ void AuraEffect::HandleAuraFeatherFall(AuraApplication const* aurApp, uint8 mode
|
|||
|
||||
// start fall from current height
|
||||
if (!apply && target->GetTypeId() == TYPEID_PLAYER)
|
||||
target->ToPlayer()->SetFallInformation(time(NULL), target->GetPositionZ());
|
||||
target->ToPlayer()->SetFallInformation(GameTime::GetGameTime(), target->GetPositionZ());
|
||||
}
|
||||
|
||||
void AuraEffect::HandleAuraHover(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include "Util.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "GameTime.h"
|
||||
#include "CellImpl.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SpellScript.h"
|
||||
|
|
@ -395,7 +396,7 @@ Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owne
|
|||
|
||||
Aura::Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, uint64 casterGUID) :
|
||||
m_spellInfo(spellproto), m_casterGuid(casterGUID ? casterGUID : caster->GetGUID()),
|
||||
m_castItemGuid(castItem ? castItem->GetGUID() : 0),m_castItemEntry(castItem ? castItem->GetEntry() : 0), m_applyTime(time(NULL)),
|
||||
m_castItemGuid(castItem ? castItem->GetGUID() : 0),m_castItemEntry(castItem ? castItem->GetEntry() : 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)
|
||||
|
|
@ -2015,7 +2016,7 @@ bool Aura::IsProcOnCooldown() const
|
|||
{
|
||||
/*if (m_procCooldown)
|
||||
{
|
||||
if (m_procCooldown > time(NULL))
|
||||
if (m_procCooldown > GameTime::GetGameTime())
|
||||
return true;
|
||||
}*/
|
||||
return false;
|
||||
|
|
@ -2023,7 +2024,7 @@ bool Aura::IsProcOnCooldown() const
|
|||
|
||||
void Aura::AddProcCooldown(uint32 /*msec*/)
|
||||
{
|
||||
//m_procCooldown = time(NULL) + msec;
|
||||
//m_procCooldown = GameTime::GetGameTime() + msec;
|
||||
}
|
||||
|
||||
void Aura::PrepareProcToTrigger(AuraApplication* aurApp, ProcEventInfo& eventInfo)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include "Spell.h"
|
||||
#include "DynamicObject.h"
|
||||
#include "Group.h"
|
||||
#include "GameTime.h"
|
||||
#include "UpdateData.h"
|
||||
#include "MapManager.h"
|
||||
#include "ObjectAccessor.h"
|
||||
|
|
@ -2576,7 +2577,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target)
|
|||
|
||||
// Xinef: absorb delayed projectiles for 500ms
|
||||
if (getState() == SPELL_STATE_DELAYED && !m_spellInfo->IsTargetingArea() && !m_spellInfo->IsPositive() &&
|
||||
(World::GetGameTimeMS() - target->timeDelay) <= effectUnit->m_lastSanctuaryTime && World::GetGameTimeMS() < (effectUnit->m_lastSanctuaryTime + 500) &&
|
||||
(GameTime::GetGameTimeMS() - target->timeDelay) <= effectUnit->m_lastSanctuaryTime && GameTime::GetGameTimeMS() < (effectUnit->m_lastSanctuaryTime + 500) &&
|
||||
effectUnit->FindMap() && !effectUnit->FindMap()->IsDungeon()
|
||||
)
|
||||
return; // No missinfo in that case
|
||||
|
|
@ -4517,7 +4518,7 @@ void Spell::SendSpellGo()
|
|||
data << uint8(m_cast_count); // pending spell cast?
|
||||
data << uint32(m_spellInfo->Id); // spellId
|
||||
data << uint32(castFlags); // cast flags
|
||||
data << uint32(World::GetGameTimeMS()); // timestamp
|
||||
data << uint32(GameTime::GetGameTimeMS()); // timestamp
|
||||
|
||||
WriteSpellGoTargets(&data);
|
||||
|
||||
|
|
@ -5000,7 +5001,7 @@ void Spell::TakePower()
|
|||
|
||||
// Set the five second timer
|
||||
if (powerType == POWER_MANA && m_powerCost > 0)
|
||||
m_caster->SetLastManaUse(World::GetGameTimeMS());
|
||||
m_caster->SetLastManaUse(GameTime::GetGameTimeMS());
|
||||
}
|
||||
|
||||
void Spell::TakeAmmo()
|
||||
|
|
@ -6022,7 +6023,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
// Xinef: Implement summon pending error
|
||||
if (target->GetSummonExpireTimer() > time(NULL))
|
||||
if (target->GetSummonExpireTimer() > GameTime::GetGameTime())
|
||||
return SPELL_FAILED_SUMMON_PENDING;
|
||||
|
||||
// check if our map is dungeon
|
||||
|
|
@ -6062,7 +6063,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
// Xinef: Implement summon pending error
|
||||
if (target->GetSummonExpireTimer() > time(NULL))
|
||||
if (target->GetSummonExpireTimer() > GameTime::GetGameTime())
|
||||
return SPELL_FAILED_SUMMON_PENDING;
|
||||
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include "SpellAuras.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "Group.h"
|
||||
#include "GameTime.h"
|
||||
#include "UpdateData.h"
|
||||
#include "MapManager.h"
|
||||
#include "ObjectAccessor.h"
|
||||
|
|
@ -702,7 +703,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
|
|||
case 17731:
|
||||
case 69294:
|
||||
{
|
||||
if( !gameObjTarget || gameObjTarget->GetRespawnTime() > time(NULL) )
|
||||
if( !gameObjTarget || gameObjTarget->GetRespawnTime() > GameTime::GetGameTime() )
|
||||
return;
|
||||
|
||||
gameObjTarget->SetRespawnTime(10);
|
||||
|
|
@ -4210,7 +4211,7 @@ void Spell::EffectSanctuary(SpellEffIndex /*effIndex*/)
|
|||
}
|
||||
|
||||
// Xinef: Set last sanctuary time
|
||||
unitTarget->m_lastSanctuaryTime = World::GetGameTimeMS();
|
||||
unitTarget->m_lastSanctuaryTime = GameTime::GetGameTimeMS();
|
||||
|
||||
// Vanish allows to remove all threat and cast regular stealth so other spells can be used
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER
|
||||
|
|
@ -4942,7 +4943,7 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
|
|||
|
||||
// charge changes fall time
|
||||
if( m_caster->GetTypeId() == TYPEID_PLAYER )
|
||||
m_caster->ToPlayer()->SetFallInformation(time(NULL), m_caster->GetPositionZ());
|
||||
m_caster->ToPlayer()->SetFallInformation(GameTime::GetGameTime(), m_caster->GetPositionZ());
|
||||
|
||||
if (m_pathFinder)
|
||||
{
|
||||
|
|
@ -5063,7 +5064,7 @@ void Spell::EffectLeapBack(SpellEffIndex effIndex)
|
|||
|
||||
// xinef: changes fall time
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
m_caster->ToPlayer()->SetFallInformation(time(NULL), m_caster->GetPositionZ());
|
||||
m_caster->ToPlayer()->SetFallInformation(GameTime::GetGameTime(), m_caster->GetPositionZ());
|
||||
}
|
||||
|
||||
void Spell::EffectQuestClear(SpellEffIndex effIndex)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "Common.h"
|
||||
#include "TicketMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "WorldPacket.h"
|
||||
|
|
@ -16,7 +17,7 @@
|
|||
#include "Player.h"
|
||||
#include "Opcodes.h"
|
||||
|
||||
inline float GetAge(uint64 t) { return float(time(NULL) - t) / DAY; }
|
||||
inline float GetAge(uint64 t) { return float(GameTime::GetGameTime() - t) / DAY; }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// GM ticket
|
||||
|
|
@ -24,7 +25,7 @@ GmTicket::GmTicket() : _id(0), _playerGuid(0), _type(TICKET_TYPE_OPEN), _posX(0)
|
|||
_closedBy(0), _resolvedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false),
|
||||
_needResponse(false), _needMoreHelp(false) { }
|
||||
|
||||
GmTicket::GmTicket(Player* player) : _type(TICKET_TYPE_OPEN), _createTime(time(NULL)), _lastModifiedTime(time(NULL)), _closedBy(0), _resolvedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), _needMoreHelp(false)
|
||||
GmTicket::GmTicket(Player* player) : _type(TICKET_TYPE_OPEN), _createTime(GameTime::GetGameTime()), _lastModifiedTime(GameTime::GetGameTime()), _closedBy(0), _resolvedBy(0), _assignedTo(0), _completed(false), _escalatedStatus(TICKET_UNASSIGNED), _viewed(false), _needMoreHelp(false)
|
||||
{
|
||||
_id = sTicketMgr->GenerateTicketId();
|
||||
_playerName = player->GetName();
|
||||
|
|
@ -147,7 +148,7 @@ void GmTicket::SendResponse(WorldSession* session) const
|
|||
|
||||
std::string GmTicket::FormatMessageString(ChatHandler& handler, bool detailed) const
|
||||
{
|
||||
time_t curTime = time(NULL);
|
||||
time_t curTime = GameTime::GetGameTime();
|
||||
|
||||
std::stringstream ss;
|
||||
ss << handler.PGetParseString(LANG_COMMAND_TICKETLISTGUID, _id);
|
||||
|
|
@ -186,6 +187,12 @@ std::string GmTicket::FormatMessageString(ChatHandler& handler, const char* szCl
|
|||
return ss.str();
|
||||
}
|
||||
|
||||
void GmTicket::SetMessage(std::string const& message)
|
||||
{
|
||||
_message = message;
|
||||
_lastModifiedTime = uint64(GameTime::GetGameTime());
|
||||
}
|
||||
|
||||
void GmTicket::SetUnassigned()
|
||||
{
|
||||
_assignedTo = 0;
|
||||
|
|
@ -235,7 +242,7 @@ void GmTicket::SetChatLog(std::list<uint32> time, std::string const& log)
|
|||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Ticket manager
|
||||
TicketMgr::TicketMgr() : _status(true), _lastTicketId(0), _lastSurveyId(0), _openTicketCount(0), _lastChange(time(NULL)) { }
|
||||
TicketMgr::TicketMgr() : _status(true), _lastTicketId(0), _lastSurveyId(0), _openTicketCount(0), _lastChange(GameTime::GetGameTime()) { }
|
||||
|
||||
TicketMgr::~TicketMgr()
|
||||
{
|
||||
|
|
@ -369,6 +376,10 @@ void TicketMgr::ResolveAndCloseTicket(uint32 ticketId, int64 source)
|
|||
}
|
||||
}
|
||||
|
||||
void TicketMgr::UpdateLastChange()
|
||||
{
|
||||
_lastChange = uint64(GameTime::GetGameTime());
|
||||
}
|
||||
|
||||
void TicketMgr::ShowList(ChatHandler& handler, bool onlineOnly) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -118,11 +118,7 @@ public:
|
|||
void SetClosedBy(int64 value) { _closedBy = value; _type = TICKET_TYPE_CLOSED; }
|
||||
void SetResolvedBy(int64 value) { _resolvedBy = value; }
|
||||
void SetCompleted() { _completed = true; }
|
||||
void SetMessage(std::string const& message)
|
||||
{
|
||||
_message = message;
|
||||
_lastModifiedTime = uint64(time(NULL));
|
||||
}
|
||||
void SetMessage(std::string const& message);
|
||||
void SetComment(std::string const& comment) { _comment = comment; }
|
||||
void SetViewed() { _viewed = true; }
|
||||
void SetUnassigned();
|
||||
|
|
@ -219,7 +215,7 @@ public:
|
|||
void SetStatus(bool status) { _status = status; }
|
||||
|
||||
uint64 GetLastChange() const { return _lastChange; }
|
||||
void UpdateLastChange() { _lastChange = uint64(time(NULL)); }
|
||||
void UpdateLastChange();
|
||||
|
||||
uint32 GenerateTicketId() { return ++_lastTicketId; }
|
||||
uint32 GetOpenTicketCount() const { return _openTicketCount; }
|
||||
|
|
|
|||
57
src/server/game/Time/GameTime.cpp
Normal file
57
src/server/game/Time/GameTime.cpp
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
|
||||
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
#include "GameTime.h"
|
||||
#include "Timer.h"
|
||||
|
||||
namespace GameTime
|
||||
{
|
||||
time_t const StartTime = time(nullptr);
|
||||
|
||||
time_t GameTime = time(nullptr);
|
||||
uint32 GameMSTime = 0;
|
||||
|
||||
std::chrono::system_clock::time_point GameTimeSystemPoint = std::chrono::system_clock::time_point::min();
|
||||
std::chrono::steady_clock::time_point GameTimeSteadyPoint = std::chrono::steady_clock::time_point::min();
|
||||
|
||||
time_t GetStartTime()
|
||||
{
|
||||
return StartTime;
|
||||
}
|
||||
|
||||
time_t GetGameTime()
|
||||
{
|
||||
return GameTime;
|
||||
}
|
||||
|
||||
uint32 GetGameTimeMS()
|
||||
{
|
||||
return GameMSTime;
|
||||
}
|
||||
|
||||
std::chrono::system_clock::time_point GetGameTimeSystemPoint()
|
||||
{
|
||||
return GameTimeSystemPoint;
|
||||
}
|
||||
|
||||
std::chrono::steady_clock::time_point GetGameTimeSteadyPoint()
|
||||
{
|
||||
return GameTimeSteadyPoint;
|
||||
}
|
||||
|
||||
uint32 GetUptime()
|
||||
{
|
||||
return uint32(GameTime - StartTime);
|
||||
}
|
||||
|
||||
void UpdateGameTimers()
|
||||
{
|
||||
GameTime = time(nullptr);
|
||||
GameMSTime = getMSTime();
|
||||
GameTimeSystemPoint = std::chrono::system_clock::now();
|
||||
GameTimeSteadyPoint = std::chrono::steady_clock::now();
|
||||
}
|
||||
}
|
||||
37
src/server/game/Time/GameTime.h
Normal file
37
src/server/game/Time/GameTime.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
|
||||
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
#ifndef __GAMETIME_H
|
||||
#define __GAMETIME_H
|
||||
|
||||
#include "Define.h"
|
||||
|
||||
#include <chrono>
|
||||
|
||||
namespace GameTime
|
||||
{
|
||||
// Server start time
|
||||
time_t GetStartTime();
|
||||
|
||||
// Current server time (unix) in seconds
|
||||
time_t GetGameTime();
|
||||
|
||||
// Milliseconds since server start
|
||||
uint32 GetGameTimeMS();
|
||||
|
||||
/// Current chrono system_clock time point
|
||||
std::chrono::system_clock::time_point GetGameTimeSystemPoint();
|
||||
|
||||
/// Current chrono steady_clock time point
|
||||
std::chrono::steady_clock::time_point GetGameTimeSteadyPoint();
|
||||
|
||||
/// Uptime (in secs)
|
||||
uint32 GetUptime();
|
||||
|
||||
void UpdateGameTimers();
|
||||
};
|
||||
|
||||
#endif
|
||||
124
src/server/game/Time/UpdateTime.cpp
Normal file
124
src/server/game/Time/UpdateTime.cpp
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
|
||||
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
#include "UpdateTime.h"
|
||||
#include "Timer.h"
|
||||
#include "Config.h"
|
||||
#include "Log.h"
|
||||
|
||||
// create instance
|
||||
WorldUpdateTime sWorldUpdateTime;
|
||||
|
||||
UpdateTime::UpdateTime()
|
||||
{
|
||||
_averageUpdateTime = 0;
|
||||
_totalUpdateTime = 0;
|
||||
_updateTimeTableIndex = 0;
|
||||
_maxUpdateTime = 0;
|
||||
_maxUpdateTimeOfLastTable = 0;
|
||||
_maxUpdateTimeOfCurrentTable = 0;
|
||||
|
||||
_updateTimeDataTable = { };
|
||||
}
|
||||
|
||||
uint32 UpdateTime::GetAverageUpdateTime() const
|
||||
{
|
||||
return _averageUpdateTime;
|
||||
}
|
||||
|
||||
uint32 UpdateTime::GetTimeWeightedAverageUpdateTime() const
|
||||
{
|
||||
uint32 sum = 0, weightsum = 0;
|
||||
for (uint32 diff : _updateTimeDataTable)
|
||||
{
|
||||
sum += diff * diff;
|
||||
weightsum += diff;
|
||||
}
|
||||
return sum / weightsum;
|
||||
}
|
||||
|
||||
uint32 UpdateTime::GetMaxUpdateTime() const
|
||||
{
|
||||
return _maxUpdateTime;
|
||||
}
|
||||
|
||||
uint32 UpdateTime::GetMaxUpdateTimeOfCurrentTable() const
|
||||
{
|
||||
return std::max(_maxUpdateTimeOfCurrentTable, _maxUpdateTimeOfLastTable);
|
||||
}
|
||||
|
||||
uint32 UpdateTime::GetLastUpdateTime() const
|
||||
{
|
||||
return _updateTimeDataTable[_updateTimeTableIndex != 0 ? _updateTimeTableIndex - 1 : _updateTimeDataTable.size() - 1];
|
||||
}
|
||||
|
||||
void UpdateTime::UpdateWithDiff(uint32 diff)
|
||||
{
|
||||
_totalUpdateTime = _totalUpdateTime - _updateTimeDataTable[_updateTimeTableIndex] + diff;
|
||||
_updateTimeDataTable[_updateTimeTableIndex] = diff;
|
||||
|
||||
if (diff > _maxUpdateTime)
|
||||
_maxUpdateTime = diff;
|
||||
|
||||
if (diff > _maxUpdateTimeOfCurrentTable)
|
||||
_maxUpdateTimeOfCurrentTable = diff;
|
||||
|
||||
if (++_updateTimeTableIndex >= _updateTimeDataTable.size())
|
||||
{
|
||||
_updateTimeTableIndex = 0;
|
||||
_maxUpdateTimeOfLastTable = _maxUpdateTimeOfCurrentTable;
|
||||
_maxUpdateTimeOfCurrentTable = 0;
|
||||
}
|
||||
|
||||
if (_updateTimeDataTable[_updateTimeDataTable.size() - 1])
|
||||
_averageUpdateTime = _totalUpdateTime / _updateTimeDataTable.size();
|
||||
else if (_updateTimeTableIndex)
|
||||
_averageUpdateTime = _totalUpdateTime / _updateTimeTableIndex;
|
||||
}
|
||||
|
||||
void UpdateTime::RecordUpdateTimeReset()
|
||||
{
|
||||
_recordedTime = getMSTime();
|
||||
}
|
||||
|
||||
void UpdateTime::_RecordUpdateTimeDuration(std::string const& text, uint32 minUpdateTime)
|
||||
{
|
||||
uint32 thisTime = getMSTime();
|
||||
uint32 diff = getMSTimeDiff(_recordedTime, thisTime);
|
||||
|
||||
if (diff > minUpdateTime)
|
||||
sLog->outError("Recored Update Time of %s: %u.", text.c_str(), diff);
|
||||
|
||||
_recordedTime = thisTime;
|
||||
}
|
||||
|
||||
void WorldUpdateTime::LoadFromConfig()
|
||||
{
|
||||
_recordUpdateTimeInverval = sConfigMgr->GetIntDefault("RecordUpdateTimeDiffInterval", 60000);
|
||||
_recordUpdateTimeMin = sConfigMgr->GetIntDefault("MinRecordUpdateTimeDiff", 100);
|
||||
}
|
||||
|
||||
void WorldUpdateTime::SetRecordUpdateTimeInterval(uint32 t)
|
||||
{
|
||||
_recordUpdateTimeInverval = t;
|
||||
}
|
||||
|
||||
void WorldUpdateTime::RecordUpdateTime(uint32 gameTimeMs, uint32 diff, uint32 sessionCount)
|
||||
{
|
||||
if (_recordUpdateTimeInverval > 0 && diff > _recordUpdateTimeMin)
|
||||
{
|
||||
if (getMSTimeDiff(_lastRecordTime, gameTimeMs) > _recordUpdateTimeInverval)
|
||||
{
|
||||
sLog->outError("Update time diff: %u. Players online: %u.", GetAverageUpdateTime(), sessionCount);
|
||||
_lastRecordTime = gameTimeMs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WorldUpdateTime::RecordUpdateTimeDuration(std::string const& text)
|
||||
{
|
||||
_RecordUpdateTimeDuration(text, _recordUpdateTimeMin);
|
||||
}
|
||||
65
src/server/game/Time/UpdateTime.h
Normal file
65
src/server/game/Time/UpdateTime.h
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-GPL2
|
||||
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
#ifndef __UPDATETIME_H
|
||||
#define __UPDATETIME_H
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "Define.h"
|
||||
|
||||
#define AVG_DIFF_COUNT 500
|
||||
|
||||
class UpdateTime
|
||||
{
|
||||
using DiffTableArray = std::array<uint32, AVG_DIFF_COUNT>;
|
||||
|
||||
public:
|
||||
uint32 GetAverageUpdateTime() const;
|
||||
uint32 GetTimeWeightedAverageUpdateTime() const;
|
||||
uint32 GetMaxUpdateTime() const;
|
||||
uint32 GetMaxUpdateTimeOfCurrentTable() const;
|
||||
uint32 GetLastUpdateTime() const;
|
||||
|
||||
void UpdateWithDiff(uint32 diff);
|
||||
|
||||
void RecordUpdateTimeReset();
|
||||
|
||||
protected:
|
||||
UpdateTime();
|
||||
|
||||
void _RecordUpdateTimeDuration(std::string const& text, uint32 minUpdateTime);
|
||||
|
||||
private:
|
||||
DiffTableArray _updateTimeDataTable;
|
||||
uint32 _averageUpdateTime;
|
||||
uint32 _totalUpdateTime;
|
||||
uint32 _updateTimeTableIndex;
|
||||
uint32 _maxUpdateTime;
|
||||
uint32 _maxUpdateTimeOfLastTable;
|
||||
uint32 _maxUpdateTimeOfCurrentTable;
|
||||
|
||||
uint32 _recordedTime;
|
||||
};
|
||||
|
||||
class WorldUpdateTime : public UpdateTime
|
||||
{
|
||||
public:
|
||||
WorldUpdateTime() : UpdateTime(), _recordUpdateTimeInverval(0), _recordUpdateTimeMin(0), _lastRecordTime(0) { }
|
||||
void LoadFromConfig();
|
||||
void SetRecordUpdateTimeInterval(uint32 t);
|
||||
void RecordUpdateTime(uint32 gameTimeMs, uint32 diff, uint32 sessionCount);
|
||||
void RecordUpdateTimeDuration(std::string const& text);
|
||||
|
||||
private:
|
||||
uint32 _recordUpdateTimeInverval;
|
||||
uint32 _recordUpdateTimeMin;
|
||||
uint32 _lastRecordTime;
|
||||
};
|
||||
|
||||
extern WorldUpdateTime sWorldUpdateTime;
|
||||
|
||||
#endif
|
||||
|
|
@ -13,6 +13,7 @@
|
|||
#include <openssl/md5.h>
|
||||
#include <openssl/sha.h>
|
||||
#include "World.h"
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
#include "Util.h"
|
||||
#include "Warden.h"
|
||||
|
|
@ -88,7 +89,7 @@ void Warden::Update()
|
|||
{
|
||||
if (_initialized)
|
||||
{
|
||||
uint32 currentTimestamp = World::GetGameTimeMS();
|
||||
uint32 currentTimestamp = GameTime::GetGameTimeMS();
|
||||
uint32 diff = getMSTimeDiff(_previousTimestamp, currentTimestamp);
|
||||
_previousTimestamp = currentTimestamp;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include "ByteBuffer.h"
|
||||
#include <openssl/md5.h>
|
||||
#include "World.h"
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
#include "Util.h"
|
||||
#include "WardenMac.h"
|
||||
|
|
@ -189,7 +190,7 @@ void WardenMac::HandleHashResult(ByteBuffer &buff)
|
|||
|
||||
_initialized = true;
|
||||
|
||||
_previousTimestamp = World::GetGameTimeMS();
|
||||
_previousTimestamp = GameTime::GetGameTimeMS();
|
||||
}
|
||||
|
||||
void WardenMac::RequestData()
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#include <openssl/md5.h>
|
||||
#include "Database/DatabaseEnv.h"
|
||||
#include "World.h"
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
#include "Util.h"
|
||||
#include "WardenWin.h"
|
||||
|
|
@ -183,7 +184,7 @@ void WardenWin::HandleHashResult(ByteBuffer &buff)
|
|||
|
||||
_initialized = true;
|
||||
|
||||
_previousTimestamp = World::GetGameTimeMS();
|
||||
_previousTimestamp = GameTime::GetGameTimeMS();
|
||||
}
|
||||
|
||||
void WardenWin::RequestData()
|
||||
|
|
@ -199,7 +200,7 @@ void WardenWin::RequestData()
|
|||
if (_otherChecksTodo.empty())
|
||||
_otherChecksTodo.assign(sWardenCheckMgr->OtherChecksIdPool.begin(), sWardenCheckMgr->OtherChecksIdPool.end());
|
||||
|
||||
_serverTicks = World::GetGameTimeMS();
|
||||
_serverTicks = GameTime::GetGameTimeMS();
|
||||
|
||||
uint16 id;
|
||||
uint8 type;
|
||||
|
|
@ -387,7 +388,7 @@ void WardenWin::HandleData(ByteBuffer &buff)
|
|||
buff >> newClientTicks;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
uint32 ticksNow = World::GetGameTimeMS();
|
||||
uint32 ticksNow = GameTime::GetGameTimeMS();
|
||||
uint32 ourTicks = newClientTicks + (ticksNow - _serverTicks);
|
||||
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "ServerTicks %u", ticksNow); // Now
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include "WorldPacket.h"
|
||||
#include "Player.h"
|
||||
#include "World.h"
|
||||
#include "GameTime.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Util.h"
|
||||
|
|
@ -82,7 +83,7 @@ bool Weather::ReGenerate()
|
|||
|
||||
//78 days between January 1st and March 20nd; 365/4=91 days by season
|
||||
// season source http://aa.usno.navy.mil/data/docs/EarthSeasons.html
|
||||
time_t gtime = sWorld->GetGameTime();
|
||||
time_t gtime = GameTime::GetGameTime();
|
||||
struct tm ltime;
|
||||
ACE_OS::localtime_r(>ime, <ime);
|
||||
uint32 season = ((ltime.tm_yday - 78 + 365)/91)%4;
|
||||
|
|
|
|||
|
|
@ -78,6 +78,8 @@
|
|||
#include "ServerMotd.h"
|
||||
#include "GameGraveyard.h"
|
||||
#include <VMapManager2.h>
|
||||
#include "GameTime.h"
|
||||
#include "UpdateTime.h"
|
||||
#ifdef ELUNA
|
||||
#include "LuaEngine.h"
|
||||
#endif
|
||||
|
|
@ -85,7 +87,6 @@
|
|||
ACE_Atomic_Op<ACE_Thread_Mutex, bool> World::m_stopEvent = false;
|
||||
uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE;
|
||||
uint32 World::m_worldLoopCounter = 0;
|
||||
uint32 World::m_gameMSTime = 0;
|
||||
|
||||
float World::m_MaxVisibleDistanceOnContinents = DEFAULT_VISIBILITY_DISTANCE;
|
||||
float World::m_MaxVisibleDistanceInInstances = DEFAULT_VISIBILITY_INSTANCE;
|
||||
|
|
@ -99,9 +100,6 @@ World::World()
|
|||
m_allowMovement = true;
|
||||
m_ShutdownMask = 0;
|
||||
m_ShutdownTimer = 0;
|
||||
m_gameTime = time(NULL);
|
||||
m_gameMSTime = getMSTime();
|
||||
m_startTime = m_gameTime;
|
||||
m_maxActiveSessionCount = 0;
|
||||
m_maxQueuedSessionCount = 0;
|
||||
m_PlayerCount = 0;
|
||||
|
|
@ -115,8 +113,6 @@ World::World()
|
|||
m_defaultDbcLocale = LOCALE_enUS;
|
||||
|
||||
mail_expire_check_timer = 0;
|
||||
m_updateTime = 0;
|
||||
m_updateTimeSum = 0;
|
||||
|
||||
m_isClosed = false;
|
||||
|
||||
|
|
@ -261,7 +257,7 @@ void World::AddSession_(WorldSession* s)
|
|||
WorldSession* oldSession = old->second;
|
||||
|
||||
if (!RemoveQueuedPlayer(oldSession) && getIntConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE))
|
||||
m_disconnects[s->GetAccountId()] = time(NULL);
|
||||
m_disconnects[s->GetAccountId()] = GameTime::GetGameTime();
|
||||
|
||||
// pussywizard:
|
||||
if (oldSession->HandleSocketClosed())
|
||||
|
|
@ -275,7 +271,7 @@ void World::AddSession_(WorldSession* s)
|
|||
tmp->SetShouldSetOfflineInDB(false);
|
||||
delete tmp;
|
||||
}
|
||||
oldSession->SetOfflineTime(time(NULL));
|
||||
oldSession->SetOfflineTime(GameTime::GetGameTime());
|
||||
m_offlineSessions[oldSession->GetAccountId()] = oldSession;
|
||||
}
|
||||
else
|
||||
|
|
@ -317,7 +313,7 @@ bool World::HasRecentlyDisconnected(WorldSession* session)
|
|||
{
|
||||
for (DisconnectMap::iterator i = m_disconnects.begin(); i != m_disconnects.end();)
|
||||
{
|
||||
if ((time(NULL) - i->second) < tolerance)
|
||||
if ((GameTime::GetGameTime() - i->second) < tolerance)
|
||||
{
|
||||
if (i->first == session->GetAccountId())
|
||||
return true;
|
||||
|
|
@ -463,6 +459,9 @@ void World::LoadConfigSettings(bool reload)
|
|||
// to change log confs at start
|
||||
sLog->ReloadConfig();
|
||||
|
||||
// load update time related configs
|
||||
sWorldUpdateTime.LoadFromConfig();
|
||||
|
||||
///- Read the player limit and the Message of the day from the config file
|
||||
if (!reload)
|
||||
SetPlayerAmountLimit(sConfigMgr->GetIntDefault("PlayerLimit", 100));
|
||||
|
|
@ -1231,8 +1230,6 @@ void World::LoadConfigSettings(bool reload)
|
|||
|
||||
m_bool_configs[CONFIG_NO_RESET_TALENT_COST] = sConfigMgr->GetBoolDefault("NoResetTalentsCost", false);
|
||||
m_bool_configs[CONFIG_SHOW_KICK_IN_WORLD] = sConfigMgr->GetBoolDefault("ShowKickInWorld", false);
|
||||
m_int_configs[CONFIG_INTERVAL_LOG_UPDATE] = sConfigMgr->GetIntDefault("RecordUpdateTimeDiffInterval", 60000);
|
||||
m_int_configs[CONFIG_MIN_LOG_UPDATE] = sConfigMgr->GetIntDefault("MinRecordUpdateTimeDiff", 100);
|
||||
m_int_configs[CONFIG_NUMTHREADS] = sConfigMgr->GetIntDefault("MapUpdate.Threads", 1);
|
||||
m_int_configs[CONFIG_MAX_RESULTS_LOOKUP_COMMANDS] = sConfigMgr->GetIntDefault("Command.LookupMaxResults", 0);
|
||||
|
||||
|
|
@ -1317,7 +1314,7 @@ void World::SetInitialWorldSettings()
|
|||
uint32 startupBegin = getMSTime();
|
||||
|
||||
///- Initialize the random number generator
|
||||
srand((unsigned int)time(NULL));
|
||||
srand((unsigned int)GameTime::GetGameTime());
|
||||
|
||||
///- Initialize detour memory management
|
||||
dtAllocSetCustom(dtCustomAlloc, dtCustomFree);
|
||||
|
|
@ -1834,11 +1831,10 @@ void World::SetInitialWorldSettings()
|
|||
|
||||
///- Initialize game time and timers
|
||||
sLog->outString("Initialize game time and timers");
|
||||
m_gameTime = time(NULL);
|
||||
m_startTime = m_gameTime;
|
||||
GameTime::UpdateGameTimers();
|
||||
|
||||
LoginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, uptime, revision) VALUES(%u, %u, 0, '%s')",
|
||||
realmID, uint32(m_startTime), GitRevision::GetFullVersion()); // One-time query
|
||||
realmID, uint32(GameTime::GetStartTime()), GitRevision::GetFullVersion()); // One-time query
|
||||
|
||||
|
||||
|
||||
|
|
@ -1859,7 +1855,7 @@ void World::SetInitialWorldSettings()
|
|||
// our speed up
|
||||
m_timers[WUPDATE_5_SECS].SetInterval(5*IN_MILLISECONDS);
|
||||
|
||||
mail_expire_check_timer = time(NULL) + 6*3600;
|
||||
mail_expire_check_timer = GameTime::GetGameTime() + 6*3600;
|
||||
|
||||
///- Initilize static helper structures
|
||||
AIRegistry::Initialize();
|
||||
|
|
@ -2047,18 +2043,14 @@ void World::LoadAutobroadcasts()
|
|||
/// Update the World !
|
||||
void World::Update(uint32 diff)
|
||||
{
|
||||
m_updateTime = diff;
|
||||
///- Update the game time and check for shutdown time
|
||||
_UpdateGameTime();
|
||||
time_t currentGameTime = GameTime::GetGameTime();
|
||||
|
||||
if (m_int_configs[CONFIG_INTERVAL_LOG_UPDATE])
|
||||
{
|
||||
m_updateTimeSum += diff;
|
||||
if (m_updateTimeSum > m_int_configs[CONFIG_INTERVAL_LOG_UPDATE])
|
||||
{
|
||||
sLog->outBasic("Average update time diff: %u. Players online: %u.", avgDiffTracker.getAverage(), (uint32)GetActiveSessionCount());
|
||||
m_updateTimeSum = 0;
|
||||
}
|
||||
}
|
||||
sWorldUpdateTime.UpdateWithDiff(diff);
|
||||
|
||||
// Record update if recording set in log and diff is greater then minimum set in log
|
||||
sWorldUpdateTime.RecordUpdateTime(GameTime::GetGameTimeMS(), diff, GetActiveSessionCount());
|
||||
DynamicVisibilityMgr::Update(GetActiveSessionCount());
|
||||
|
||||
///- Update the different timers
|
||||
|
|
@ -2083,25 +2075,22 @@ void World::Update(uint32 diff)
|
|||
WhoListCacheMgr::Update();
|
||||
}
|
||||
|
||||
///- Update the game time and check for shutdown time
|
||||
_UpdateGameTime();
|
||||
|
||||
/// Handle daily quests reset time
|
||||
if (m_gameTime > m_NextDailyQuestReset)
|
||||
if (currentGameTime > m_NextDailyQuestReset)
|
||||
ResetDailyQuests();
|
||||
|
||||
/// Handle weekly quests reset time
|
||||
if (m_gameTime > m_NextWeeklyQuestReset)
|
||||
if (currentGameTime > m_NextWeeklyQuestReset)
|
||||
ResetWeeklyQuests();
|
||||
|
||||
/// Handle monthly quests reset time
|
||||
if (m_gameTime > m_NextMonthlyQuestReset)
|
||||
if (currentGameTime > m_NextMonthlyQuestReset)
|
||||
ResetMonthlyQuests();
|
||||
|
||||
if (m_gameTime > m_NextRandomBGReset)
|
||||
if (currentGameTime > m_NextRandomBGReset)
|
||||
ResetRandomBG();
|
||||
|
||||
if (m_gameTime > m_NextGuildReset)
|
||||
if (currentGameTime > m_NextGuildReset)
|
||||
ResetGuildCap();
|
||||
|
||||
// pussywizard:
|
||||
|
|
@ -2122,13 +2111,15 @@ void World::Update(uint32 diff)
|
|||
|
||||
AsyncAuctionListingMgr::Update(diff);
|
||||
|
||||
if (m_gameTime > mail_expire_check_timer)
|
||||
if (currentGameTime > mail_expire_check_timer)
|
||||
{
|
||||
sObjectMgr->ReturnOrDeleteOldMails(true);
|
||||
mail_expire_check_timer = m_gameTime + 6*3600;
|
||||
mail_expire_check_timer = currentGameTime + 6*3600;
|
||||
}
|
||||
|
||||
sWorldUpdateTime.RecordUpdateTimeReset();
|
||||
UpdateSessions(diff);
|
||||
sWorldUpdateTime.RecordUpdateTimeDuration("UpdateSessions");
|
||||
}
|
||||
// end of section with mutex
|
||||
AsyncAuctionListingMgr::SetAuctionListingAllowed(true);
|
||||
|
|
@ -2156,9 +2147,12 @@ void World::Update(uint32 diff)
|
|||
}
|
||||
}
|
||||
|
||||
sWorldUpdateTime.RecordUpdateTimeReset();
|
||||
sLFGMgr->Update(diff, 0); // pussywizard: remove obsolete stuff before finding compatibility during map update
|
||||
sWorldUpdateTime.RecordUpdateTimeDuration("UpdateLFGMgr");
|
||||
|
||||
sMapMgr->Update(diff);
|
||||
sWorldUpdateTime.RecordUpdateTimeDuration("UpdateMapMgr");
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_AUTOBROADCAST))
|
||||
{
|
||||
|
|
@ -2170,20 +2164,25 @@ void World::Update(uint32 diff)
|
|||
}
|
||||
|
||||
sBattlegroundMgr->Update(diff);
|
||||
sWorldUpdateTime.RecordUpdateTimeDuration("UpdateBattlegroundMgr");
|
||||
|
||||
sOutdoorPvPMgr->Update(diff);
|
||||
sWorldUpdateTime.RecordUpdateTimeDuration("UpdateOutdoorPvPMgr");
|
||||
|
||||
sBattlefieldMgr->Update(diff);
|
||||
sWorldUpdateTime.RecordUpdateTimeDuration("BattlefieldMgr");
|
||||
|
||||
sLFGMgr->Update(diff, 2); // pussywizard: handle created proposals
|
||||
sWorldUpdateTime.RecordUpdateTimeDuration("UpdateLFGMgr2");
|
||||
|
||||
// execute callbacks from sql queries that were queued recently
|
||||
ProcessQueryCallbacks();
|
||||
sWorldUpdateTime.RecordUpdateTimeDuration("ProcessQueryCallbacks");
|
||||
|
||||
/// <li> Update uptime table
|
||||
if (m_timers[WUPDATE_UPTIME].Passed())
|
||||
{
|
||||
uint32 tmpDiff = uint32(m_gameTime - m_startTime);
|
||||
uint32 tmpDiff = GameTime::GetUptime();
|
||||
uint32 maxOnlinePlayers = GetMaxPlayerCount();
|
||||
|
||||
m_timers[WUPDATE_UPTIME].Reset();
|
||||
|
|
@ -2193,7 +2192,7 @@ void World::Update(uint32 diff)
|
|||
stmt->setUInt32(0, tmpDiff);
|
||||
stmt->setUInt16(1, uint16(maxOnlinePlayers));
|
||||
stmt->setUInt32(2, realmID);
|
||||
stmt->setUInt32(3, uint32(m_startTime));
|
||||
stmt->setUInt32(3, uint32(GameTime::GetStartTime()));
|
||||
|
||||
LoginDatabase.Execute(stmt);
|
||||
}
|
||||
|
|
@ -2497,7 +2496,7 @@ BanReturn World::BanAccount(BanMode mode, std::string const& nameOrIP, std::stri
|
|||
PreparedStatement* stmtx = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BANNED);
|
||||
stmtx->setUInt32(0, account);
|
||||
PreparedQueryResult banresultx = LoginDatabase.Query(stmtx);
|
||||
if (banresultx && ((*banresultx)[0].GetUInt32() == (*banresultx)[1].GetUInt32() || ((*banresultx)[1].GetUInt32() > time(NULL)+duration_secs && duration_secs)))
|
||||
if (banresultx && ((*banresultx)[0].GetUInt32() == (*banresultx)[1].GetUInt32() || ((*banresultx)[1].GetUInt32() > GameTime::GetGameTime()+duration_secs && duration_secs)))
|
||||
return BAN_LONGER_EXISTS;
|
||||
|
||||
// make sure there is only one active ban
|
||||
|
|
@ -2616,10 +2615,10 @@ bool World::RemoveBanCharacter(std::string const& name)
|
|||
void World::_UpdateGameTime()
|
||||
{
|
||||
///- update the time
|
||||
time_t thisTime = time(NULL);
|
||||
uint32 elapsed = uint32(thisTime - m_gameTime);
|
||||
m_gameTime = thisTime;
|
||||
m_gameMSTime = getMSTime();
|
||||
time_t lastGameTime = GameTime::GetGameTime();
|
||||
GameTime::UpdateGameTimers();
|
||||
|
||||
uint32 elapsed = uint32(GameTime::GetGameTime() - lastGameTime);
|
||||
|
||||
///- if there is a shutdown timer
|
||||
if (!IsStopped() && m_ShutdownTimer > 0 && elapsed > 0)
|
||||
|
|
@ -2752,7 +2751,7 @@ void World::UpdateSessions(uint32 diff)
|
|||
if (pSession->HandleSocketClosed())
|
||||
{
|
||||
if (!RemoveQueuedPlayer(pSession) && getIntConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE))
|
||||
m_disconnects[pSession->GetAccountId()] = time(NULL);
|
||||
m_disconnects[pSession->GetAccountId()] = GameTime::GetGameTime();
|
||||
m_sessions.erase(itr);
|
||||
// there should be no offline session if current one is logged onto a character
|
||||
SessionMap::iterator iter;
|
||||
|
|
@ -2763,7 +2762,7 @@ void World::UpdateSessions(uint32 diff)
|
|||
tmp->SetShouldSetOfflineInDB(false);
|
||||
delete tmp;
|
||||
}
|
||||
pSession->SetOfflineTime(time(NULL));
|
||||
pSession->SetOfflineTime(GameTime::GetGameTime());
|
||||
m_offlineSessions[pSession->GetAccountId()] = pSession;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -2771,7 +2770,7 @@ void World::UpdateSessions(uint32 diff)
|
|||
if (!pSession->Update(diff, updater))
|
||||
{
|
||||
if (!RemoveQueuedPlayer(pSession) && getIntConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE))
|
||||
m_disconnects[pSession->GetAccountId()] = time(NULL);
|
||||
m_disconnects[pSession->GetAccountId()] = GameTime::GetGameTime();
|
||||
m_sessions.erase(itr);
|
||||
if (m_offlineSessions.find(pSession->GetAccountId()) != m_offlineSessions.end()) // pussywizard: don't set offline in db because offline session for that acc is present (character is in world)
|
||||
pSession->SetShouldSetOfflineInDB(false);
|
||||
|
|
@ -2782,7 +2781,7 @@ void World::UpdateSessions(uint32 diff)
|
|||
// pussywizard:
|
||||
if (m_offlineSessions.empty())
|
||||
return;
|
||||
uint32 currTime = time(NULL);
|
||||
uint32 currTime = GameTime::GetGameTime();
|
||||
for (SessionMap::iterator itr = m_offlineSessions.begin(), next; itr != m_offlineSessions.end(); itr = next)
|
||||
{
|
||||
next = itr;
|
||||
|
|
@ -2920,7 +2919,7 @@ time_t World::GetNextTimeWithDayAndHour(int8 dayOfWeek, int8 hour)
|
|||
{
|
||||
if (hour < 0 || hour > 23)
|
||||
hour = 0;
|
||||
time_t curr = time(NULL);
|
||||
time_t curr = GameTime::GetGameTime();
|
||||
tm localTm;
|
||||
ACE_OS::localtime_r(&curr, &localTm);
|
||||
localTm.tm_hour = hour;
|
||||
|
|
@ -2941,7 +2940,7 @@ time_t World::GetNextTimeWithMonthAndHour(int8 month, int8 hour)
|
|||
{
|
||||
if (hour < 0 || hour > 23)
|
||||
hour = 0;
|
||||
time_t curr = time(NULL);
|
||||
time_t curr = GameTime::GetGameTime();
|
||||
tm localTm;
|
||||
ACE_OS::localtime_r(&curr, &localTm);
|
||||
localTm.tm_mday = 1;
|
||||
|
|
|
|||
|
|
@ -292,8 +292,6 @@ enum WorldIntConfigs
|
|||
CONFIG_PVP_TOKEN_MAP_TYPE,
|
||||
CONFIG_PVP_TOKEN_ID,
|
||||
CONFIG_PVP_TOKEN_COUNT,
|
||||
CONFIG_INTERVAL_LOG_UPDATE,
|
||||
CONFIG_MIN_LOG_UPDATE,
|
||||
CONFIG_ENABLE_SINFO_LOGIN,
|
||||
CONFIG_PLAYER_ALLOW_COMMANDS,
|
||||
CONFIG_NUMTHREADS,
|
||||
|
|
@ -620,18 +618,6 @@ class World
|
|||
/// Get the path where data (dbc, maps) are stored on disk
|
||||
std::string const& GetDataPath() const { return m_dataPath; }
|
||||
|
||||
/// When server started?
|
||||
time_t const& GetStartTime() const { return m_startTime; }
|
||||
/// What time is it?
|
||||
time_t const& GetGameTime() const { return m_gameTime; }
|
||||
/// What time is it? in ms
|
||||
static uint32 GetGameTimeMS() { return m_gameMSTime; }
|
||||
/// Uptime (in secs)
|
||||
uint32 GetUptime() const { return uint32(m_gameTime - m_startTime); }
|
||||
/// Update time
|
||||
uint32 GetUpdateTime() const { return m_updateTime; }
|
||||
void SetRecordDiffInterval(int32 t) { if (t >= 0) m_int_configs[CONFIG_INTERVAL_LOG_UPDATE] = (uint32)t; }
|
||||
|
||||
/// Next daily quests and random bg reset time
|
||||
time_t GetNextDailyQuestsResetTime() const { return m_NextDailyQuestReset; }
|
||||
time_t GetNextWeeklyQuestsResetTime() const { return m_NextWeeklyQuestReset; }
|
||||
|
|
@ -812,12 +798,8 @@ class World
|
|||
|
||||
bool m_isClosed;
|
||||
|
||||
time_t m_startTime;
|
||||
time_t m_gameTime;
|
||||
IntervalTimer m_timers[WUPDATE_COUNT];
|
||||
time_t mail_expire_check_timer;
|
||||
uint32 m_updateTime, m_updateTimeSum;
|
||||
static uint32 m_gameMSTime;
|
||||
|
||||
SessionMap m_sessions;
|
||||
SessionMap m_offlineSessions;
|
||||
|
|
|
|||
|
|
@ -168,6 +168,7 @@ include_directories(
|
|||
${CMAKE_SOURCE_DIR}/src/server/game/Spells/Auras
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Texts
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Tickets
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Time
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Tools
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Warden
|
||||
${CMAKE_SOURCE_DIR}/src/server/game/Warden/Modules
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ EndScriptData */
|
|||
#include "ObjectAccessor.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "GameTime.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
class ban_commandscript : public CommandScript
|
||||
|
|
@ -245,7 +246,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);
|
||||
|
|
@ -293,7 +294,7 @@ public:
|
|||
Field* fields = result->Fetch();
|
||||
time_t unbanDate = time_t(fields[3].GetUInt32());
|
||||
bool active = false;
|
||||
if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbanDate >= time(nullptr)))
|
||||
if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbanDate >= GameTime::GetGameTime()))
|
||||
active = true;
|
||||
bool permanent = (fields[1].GetUInt32() == uint32(0));
|
||||
std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ EndScriptData */
|
|||
#include "GameEventMgr.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
#include "GameTime.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
class event_commandscript : public CommandScript
|
||||
|
|
@ -104,8 +105,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, true);
|
||||
std::string lengthStr = secsToTimeString(eventData.length * MINUTE, true);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ EndScriptData */
|
|||
#include "Chat.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
#include "GameTime.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Transport.h"
|
||||
#include "GameObject.h"
|
||||
|
|
@ -310,7 +311,7 @@ public:
|
|||
|
||||
if (target)
|
||||
{
|
||||
int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - time(nullptr));
|
||||
int32 curRespawnDelay = int32(target->GetRespawnTimeEx() - GameTime::GetGameTime());
|
||||
if (curRespawnDelay < 0)
|
||||
curRespawnDelay = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ EndScriptData */
|
|||
#include "InstanceScript.h"
|
||||
#include "MapManager.h"
|
||||
#include "Player.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
|
||||
class instance_commandscript : public CommandScript
|
||||
|
|
@ -71,7 +72,7 @@ public:
|
|||
{
|
||||
InstanceSave* save = itr->second.save;
|
||||
uint32 resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime();
|
||||
uint32 ttr = (resetTime >= time(nullptr) ? resetTime - time(nullptr) : 0);
|
||||
uint32 ttr = (resetTime >= GameTime::GetGameTime() ? resetTime - GameTime::GetGameTime() : 0);
|
||||
std::string timeleft = GetTimeString(ttr);
|
||||
handler->PSendSysMessage("map: %d, inst: %d, perm: %s, diff: %d, canReset: %s, TTR: %s%s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str(), (itr->second.extended ? " (extended)" : ""));
|
||||
counter++;
|
||||
|
|
@ -115,7 +116,7 @@ public:
|
|||
if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficulty()))
|
||||
{
|
||||
uint32 resetTime = itr->second.extended ? save->GetExtendedResetTime() : save->GetResetTime();
|
||||
uint32 ttr = (resetTime >= time(nullptr) ? resetTime - time(nullptr) : 0);
|
||||
uint32 ttr = (resetTime >= GameTime::GetGameTime() ? resetTime - GameTime::GetGameTime() : 0);
|
||||
std::string timeleft = GetTimeString(ttr);
|
||||
handler->PSendSysMessage("unbinding map: %d, inst: %d, perm: %s, diff: %d, canReset: %s, TTR: %s%s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str(), (itr->second.extended ? " (extended)" : ""));
|
||||
sInstanceSaveMgr->PlayerUnbindInstance(player->GetGUIDLow(), itr->first, Difficulty(i), true, player);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include "WeatherMgr.h"
|
||||
#include "ace/INET_Addr.h"
|
||||
#include "Player.h"
|
||||
#include "GameTime.h"
|
||||
#include "Pet.h"
|
||||
#include "LFG.h"
|
||||
#include "GroupMgr.h"
|
||||
|
|
@ -1997,11 +1998,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);
|
||||
|
|
@ -2240,7 +2241,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);
|
||||
ChatHandler(target->GetSession()).PSendSysMessage(LANG_YOUR_CHAT_DISABLED, notSpeakTime, muteBy.c_str(), muteReasonStr.c_str());
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ EndScriptData */
|
|||
#include "TargetedMovementGenerator.h" // for HandleNpcUnFollowCommand
|
||||
#include "CreatureAI.h"
|
||||
#include "Player.h"
|
||||
#include "GameTime.h"
|
||||
#include "Pet.h"
|
||||
|
||||
struct NpcFlagText
|
||||
|
|
@ -719,7 +720,7 @@ public:
|
|||
uint32 nativeid = target->GetNativeDisplayId();
|
||||
uint32 Entry = target->GetEntry();
|
||||
|
||||
int64 curRespawnDelay = target->GetRespawnTimeEx()-time(nullptr);
|
||||
int64 curRespawnDelay = target->GetRespawnTimeEx()-GameTime::GetGameTime();
|
||||
if (curRespawnDelay < 0)
|
||||
curRespawnDelay = 0;
|
||||
std::string curRespawnDelayStr = secsToTimeString(uint64(curRespawnDelay), true);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ EndScriptData */
|
|||
#include "Config.h"
|
||||
#include "Language.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "GameTime.h"
|
||||
#include "UpdateTime.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "GitRevision.h"
|
||||
|
|
@ -96,8 +98,8 @@ public:
|
|||
uint32 activeSessionCount = sWorld->GetActiveSessionCount();
|
||||
uint32 queuedSessionCount = sWorld->GetQueuedSessionCount();
|
||||
uint32 connPeak = sWorld->GetMaxActiveSessionCount();
|
||||
std::string uptime = secsToTimeString(sWorld->GetUptime()).append(".");
|
||||
uint32 updateTime = sWorld->GetUpdateTime();
|
||||
std::string uptime = secsToTimeString(GameTime::GetUptime());
|
||||
uint32 updateTime = sWorldUpdateTime.GetLastUpdateTime();
|
||||
uint32 avgUpdateTime = avgDiffTracker.getAverage();
|
||||
|
||||
handler->PSendSysMessage("%s", GitRevision::GetFullVersion());
|
||||
|
|
@ -355,7 +357,7 @@ public:
|
|||
if (newTime < 0)
|
||||
return false;
|
||||
|
||||
sWorld->SetRecordDiffInterval(newTime);
|
||||
sWorldUpdateTime.SetRecordUpdateTimeInterval(newTime);
|
||||
printf("Record diff every %u ms\n", newTime);
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include "SpellScript.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "Group.h"
|
||||
#include "GameTime.h"
|
||||
#include "LFGMgr.h"
|
||||
#include "PassiveAI.h"
|
||||
#include "CellImpl.h"
|
||||
|
|
@ -435,7 +436,7 @@ class npc_brewfest_keg_reciver : public CreatureScript
|
|||
{
|
||||
if (Aura* aur = player->GetAura(SPELL_RAM_AURA))
|
||||
{
|
||||
int32 diff = aur->GetApplyTime() - (time(NULL)-(HOUR*18)+spellCooldown);
|
||||
int32 diff = aur->GetApplyTime() - (GameTime::GetGameTime()-(HOUR*18)+spellCooldown);
|
||||
if (diff > 10) // aura applied later
|
||||
return;
|
||||
|
||||
|
|
@ -843,7 +844,7 @@ class npc_dark_iron_attack_generator : public CreatureScript
|
|||
|
||||
bool AllowStart()
|
||||
{
|
||||
time_t curtime = time(NULL);
|
||||
time_t curtime = GameTime::GetGameTime();
|
||||
tm strDate;
|
||||
ACE_OS::localtime_r(&curtime, &strDate);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
// Scripted by Xinef
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptedGossip.h"
|
||||
#include "Spell.h"
|
||||
|
|
@ -184,7 +185,7 @@ class npc_midsummer_torch_target : public CreatureScript
|
|||
Position pos;
|
||||
pos.Relocate(posVec.at(num));
|
||||
me->m_last_notify_position.Relocate(0.0f, 0.0f, 0.0f);
|
||||
me->m_last_notify_mstime = World::GetGameTimeMS() + 10000;
|
||||
me->m_last_notify_mstime = GameTime::GetGameTimeMS() + 10000;
|
||||
|
||||
me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation());
|
||||
}
|
||||
|
|
@ -300,7 +301,7 @@ public:
|
|||
}
|
||||
|
||||
// Achievement
|
||||
if ((time(NULL) - GetApplyTime()) > 60 && target->GetTypeId() == TYPEID_PLAYER)
|
||||
if ((GameTime::GetGameTime() - GetApplyTime()) > 60 && target->GetTypeId() == TYPEID_PLAYER)
|
||||
target->ToPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58934, 0, target);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
#include "ScriptedCreature.h"
|
||||
#include "trial_of_the_crusader.h"
|
||||
#include "Group.h"
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
|
||||
#define CLEANUP_CHECK_INTERVAL 5000
|
||||
|
|
@ -322,7 +323,7 @@ public:
|
|||
c->DespawnOrUnsummon(10000);
|
||||
if( Creature* c = instance->GetCreature(NPC_DreadscaleGUID) )
|
||||
c->DespawnOrUnsummon(10000);
|
||||
if( AchievementTimer+10 >= time(NULL) )
|
||||
if( AchievementTimer+10 >= GameTime::GetGameTime() )
|
||||
DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_JORMUNGAR_ACHIEV);
|
||||
AchievementTimer = 0;
|
||||
|
||||
|
|
@ -339,7 +340,7 @@ public:
|
|||
}
|
||||
else // first one died, start timer for achievement
|
||||
{
|
||||
AchievementTimer = time(NULL);
|
||||
AchievementTimer = GameTime::GetGameTime();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -428,14 +429,14 @@ public:
|
|||
|
||||
HandleGameObject(GO_EnterGateGUID, true);
|
||||
|
||||
if( AchievementTimer+60 >= time(NULL) )
|
||||
if( AchievementTimer+60 >= GameTime::GetGameTime() )
|
||||
DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_RESILIENCE_WILL_FIX_IT_CREDIT);
|
||||
AchievementTimer = 0;
|
||||
|
||||
SaveToDB();
|
||||
}
|
||||
else if( Counter == 1 )
|
||||
AchievementTimer = time(NULL);
|
||||
AchievementTimer = GameTime::GetGameTime();
|
||||
}
|
||||
break;
|
||||
case TYPE_FACTION_CHAMPIONS_START:
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "ScriptedGossip.h"
|
||||
#include "trial_of_the_crusader.h"
|
||||
#include "Player.h"
|
||||
#include "GameTime.h"
|
||||
|
||||
enum MenuTexts
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include "TransportMgr.h"
|
||||
#include "Vehicle.h"
|
||||
#include "icecrown_citadel.h"
|
||||
#include "GameTime.h"
|
||||
|
||||
enum Texts
|
||||
{
|
||||
|
|
@ -406,7 +407,7 @@ public:
|
|||
return false;
|
||||
|
||||
bool summoned = false;
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
for (int32 i = first; i <= last; ++i)
|
||||
{
|
||||
if (_respawnCooldowns[i] > now)
|
||||
|
|
@ -442,7 +443,7 @@ public:
|
|||
void ClearSlot(PassengerSlots slot)
|
||||
{
|
||||
_controlledSlots[slot] = 0;
|
||||
_respawnCooldowns[slot] = time(NULL) + _slotInfo[slot].Cooldown;
|
||||
_respawnCooldowns[slot] = GameTime::GetGameTime() + _slotInfo[slot].Cooldown;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -731,7 +732,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
|
|||
_controller.ResetSlots(TEAM_HORDE, creature->GetTransport()->ToMotionTransport());
|
||||
me->SetRegeneratingHealth(false);
|
||||
me->m_CombatDistance = 70.0f;
|
||||
_firstMageCooldown = time(NULL) + 45;
|
||||
_firstMageCooldown = GameTime::GetGameTime() + 45;
|
||||
_axethrowersYellCooldown = time_t(0);
|
||||
_rocketeersYellCooldown = time_t(0);
|
||||
checkTimer = 1000;
|
||||
|
|
@ -796,7 +797,7 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
|
|||
}
|
||||
else if (action == ACTION_SPAWN_MAGE)
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
if (_firstMageCooldown > now)
|
||||
_events.ScheduleEvent(EVENT_SUMMON_MAGE, (_firstMageCooldown - now) * IN_MILLISECONDS);
|
||||
else
|
||||
|
|
@ -971,10 +972,10 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
|
|||
case EVENT_CHECK_RIFLEMAN:
|
||||
if (_controller.SummonCreatures(me, SLOT_RIFLEMAN_1, Is25ManRaid() ? SLOT_RIFLEMAN_8 : SLOT_RIFLEMAN_4))
|
||||
{
|
||||
if (_axethrowersYellCooldown < time(NULL))
|
||||
if (_axethrowersYellCooldown < GameTime::GetGameTime())
|
||||
{
|
||||
Talk(SAY_SAURFANG_AXETHROWERS);
|
||||
_axethrowersYellCooldown = time(NULL) + 5;
|
||||
_axethrowersYellCooldown = GameTime::GetGameTime() + 5;
|
||||
}
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_CHECK_RIFLEMAN, 1500);
|
||||
|
|
@ -982,10 +983,10 @@ class npc_high_overlord_saurfang_igb : public CreatureScript
|
|||
case EVENT_CHECK_MORTAR:
|
||||
if (_controller.SummonCreatures(me, SLOT_MORTAR_1, Is25ManRaid() ? SLOT_MORTAR_4 : SLOT_MORTAR_2))
|
||||
{
|
||||
if (_rocketeersYellCooldown < time(NULL))
|
||||
if (_rocketeersYellCooldown < GameTime::GetGameTime())
|
||||
{
|
||||
Talk(SAY_SAURFANG_ROCKETEERS);
|
||||
_rocketeersYellCooldown = time(NULL) + 5;
|
||||
_rocketeersYellCooldown = GameTime::GetGameTime() + 5;
|
||||
}
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_CHECK_MORTAR, 1500);
|
||||
|
|
@ -1066,7 +1067,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
|
|||
_controller.ResetSlots(TEAM_ALLIANCE, creature->GetTransport()->ToMotionTransport());
|
||||
me->SetRegeneratingHealth(false);
|
||||
me->m_CombatDistance = 70.0f;
|
||||
_firstMageCooldown = time(NULL) + 45;
|
||||
_firstMageCooldown = GameTime::GetGameTime() + 45;
|
||||
_riflemanYellCooldown = time_t(0);
|
||||
_mortarYellCooldown = time_t(0);
|
||||
checkTimer = 1000;
|
||||
|
|
@ -1132,7 +1133,7 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
|
|||
}
|
||||
else if (action == ACTION_SPAWN_MAGE)
|
||||
{
|
||||
time_t now = time(NULL);
|
||||
time_t now = GameTime::GetGameTime();
|
||||
if (_firstMageCooldown > now)
|
||||
_events.ScheduleEvent(EVENT_SUMMON_MAGE, (_firstMageCooldown - now) * IN_MILLISECONDS);
|
||||
else
|
||||
|
|
@ -1310,10 +1311,10 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
|
|||
case EVENT_CHECK_RIFLEMAN:
|
||||
if (_controller.SummonCreatures(me, SLOT_RIFLEMAN_1, Is25ManRaid() ? SLOT_RIFLEMAN_8 : SLOT_RIFLEMAN_4))
|
||||
{
|
||||
if (_riflemanYellCooldown < time(NULL))
|
||||
if (_riflemanYellCooldown < GameTime::GetGameTime())
|
||||
{
|
||||
Talk(SAY_MURADIN_RIFLEMAN);
|
||||
_riflemanYellCooldown = time(NULL) + 5;
|
||||
_riflemanYellCooldown = GameTime::GetGameTime() + 5;
|
||||
}
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_CHECK_RIFLEMAN, 1500);
|
||||
|
|
@ -1321,10 +1322,10 @@ class npc_muradin_bronzebeard_igb : public CreatureScript
|
|||
case EVENT_CHECK_MORTAR:
|
||||
if (_controller.SummonCreatures(me, SLOT_MORTAR_1, Is25ManRaid() ? SLOT_MORTAR_4 : SLOT_MORTAR_2))
|
||||
{
|
||||
if (_mortarYellCooldown < time(NULL))
|
||||
if (_mortarYellCooldown < GameTime::GetGameTime())
|
||||
{
|
||||
Talk(SAY_MURADIN_MORTAR);
|
||||
_mortarYellCooldown = time(NULL) + 5;
|
||||
_mortarYellCooldown = GameTime::GetGameTime() + 5;
|
||||
}
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_CHECK_MORTAR, 1500);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "ObjectMgr.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "icecrown_citadel.h"
|
||||
#include "Player.h"
|
||||
|
|
@ -948,7 +949,7 @@ class spell_sindragosa_unchained_magic : public SpellScriptLoader
|
|||
if (!spellInfo)
|
||||
return false;
|
||||
|
||||
uint32 currMSTime = World::GetGameTimeMS();
|
||||
uint32 currMSTime = GameTime::GetGameTimeMS();
|
||||
std::map<uint32, uint32>::iterator itr = _lastMSTimeForSpell.find(spellInfo->Id);
|
||||
if (itr != _lastMSTimeForSpell.end())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#include "SpellScript.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "Spell.h"
|
||||
#include "GameTime.h"
|
||||
#include "Vehicle.h"
|
||||
#include "Unit.h"
|
||||
#include "Cell.h"
|
||||
|
|
@ -686,9 +687,9 @@ class boss_the_lich_king : public CreatureScript
|
|||
|
||||
void KilledUnit(Unit* victim)
|
||||
{
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER && !me->IsInEvadeMode() && _phase != PHASE_OUTRO && _lastTalkTimeKill+5 < time(NULL))
|
||||
if (victim->GetTypeId() == TYPEID_PLAYER && !me->IsInEvadeMode() && _phase != PHASE_OUTRO && _lastTalkTimeKill+5 < GameTime::GetGameTime())
|
||||
{
|
||||
_lastTalkTimeKill = time(NULL);
|
||||
_lastTalkTimeKill = GameTime::GetGameTime();
|
||||
Talk(SAY_LK_KILL);
|
||||
}
|
||||
}
|
||||
|
|
@ -717,7 +718,7 @@ class boss_the_lich_king : public CreatureScript
|
|||
events.RescheduleEvent(EVENT_START_ATTACK, 1000);
|
||||
EntryCheckPredicate pred(NPC_STRANGULATE_VEHICLE);
|
||||
summons.DoAction(ACTION_TELEPORT_BACK, pred);
|
||||
if (!IsHeroic() && _phase != PHASE_OUTRO && me->IsInCombat() && _lastTalkTimeBuff+5 <= time(NULL))
|
||||
if (!IsHeroic() && _phase != PHASE_OUTRO && me->IsInCombat() && _lastTalkTimeBuff+5 <= GameTime::GetGameTime())
|
||||
Talk(SAY_LK_FROSTMOURNE_ESCAPE);
|
||||
}
|
||||
break;
|
||||
|
|
@ -874,9 +875,9 @@ class boss_the_lich_king : public CreatureScript
|
|||
|
||||
void SpellHit(Unit* /*caster*/, SpellInfo const* spell)
|
||||
{
|
||||
if (spell->Id == HARVESTED_SOUL_BUFF && me->IsInCombat() && !IsHeroic() && _phase != PHASE_OUTRO && _lastTalkTimeBuff+5 <= time(NULL))
|
||||
if (spell->Id == HARVESTED_SOUL_BUFF && me->IsInCombat() && !IsHeroic() && _phase != PHASE_OUTRO && _lastTalkTimeBuff+5 <= GameTime::GetGameTime())
|
||||
{
|
||||
_lastTalkTimeBuff = time(NULL);
|
||||
_lastTalkTimeBuff = GameTime::GetGameTime();
|
||||
Talk(SAY_LK_FROSTMOURNE_KILL);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "SpellScript.h"
|
||||
#include "GameTime.h"
|
||||
#include "ulduar.h"
|
||||
#include "Vehicle.h"
|
||||
#include "SpellAuras.h"
|
||||
|
|
@ -261,10 +262,10 @@ public:
|
|||
if (id == 1337)
|
||||
{
|
||||
if (lastShatterMSTime)
|
||||
if (getMSTimeDiff(lastShatterMSTime, World::GetGameTimeMS()) <= 5000)
|
||||
if (getMSTimeDiff(lastShatterMSTime, GameTime::GetGameTimeMS()) <= 5000)
|
||||
bShattered = true;
|
||||
|
||||
lastShatterMSTime = World::GetGameTimeMS();
|
||||
lastShatterMSTime = GameTime::GetGameTimeMS();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "SpellScript.h"
|
||||
#include "GameTime.h"
|
||||
#include "ulduar.h"
|
||||
#include "Vehicle.h"
|
||||
#include "Spell.h"
|
||||
|
|
@ -452,7 +453,7 @@ public:
|
|||
case EVENT_SPAWN_FLAMES_INITIAL:
|
||||
{
|
||||
if (changeAllowedFlameSpreadTime)
|
||||
allowedFlameSpreadTime = time(NULL);
|
||||
allowedFlameSpreadTime = GameTime::GetGameTime();
|
||||
|
||||
std::vector<Player*> pg;
|
||||
Map::PlayerList const &pl = me->GetMap()->GetPlayers();
|
||||
|
|
@ -2236,7 +2237,7 @@ public:
|
|||
|
||||
bool Load()
|
||||
{
|
||||
lastMSTime = World::GetGameTimeMS();
|
||||
lastMSTime = GameTime::GetGameTimeMS();
|
||||
lastOrientation = -1.0f;
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2247,14 +2248,14 @@ public:
|
|||
{
|
||||
if (c->GetTypeId() != TYPEID_UNIT)
|
||||
return;
|
||||
uint32 diff = getMSTimeDiff(lastMSTime, World::GetGameTimeMS());
|
||||
uint32 diff = getMSTimeDiff(lastMSTime, GameTime::GetGameTimeMS());
|
||||
if (lastOrientation == -1.0f)
|
||||
{
|
||||
lastOrientation = (c->ToCreature()->AI()->GetData(0)*2*M_PI)/100.0f;
|
||||
diff = 0;
|
||||
}
|
||||
float new_o = Position::NormalizeOrientation(lastOrientation-(M_PI/60)*(diff/250.0f));
|
||||
lastMSTime = World::GetGameTimeMS();
|
||||
lastMSTime = GameTime::GetGameTimeMS();
|
||||
lastOrientation = new_o;
|
||||
c->SetOrientation(new_o);
|
||||
c->SetFacingTo(new_o);
|
||||
|
|
@ -2316,7 +2317,7 @@ public:
|
|||
{
|
||||
npc_ulduar_flames_initialAI(Creature *pCreature) : NullCreatureAI(pCreature)
|
||||
{
|
||||
CreateTime = time(NULL);
|
||||
CreateTime = GameTime::GetGameTime();
|
||||
events.Reset();
|
||||
events.ScheduleEvent(EVENT_FLAMES_SPREAD, 5750);
|
||||
if( Creature* flame = me->SummonCreature(NPC_FLAMES_SPREAD, me->GetPositionX(), me->GetPositionY(), 364.32f, 0.0f) )
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "ulduar.h"
|
||||
#include "Vehicle.h"
|
||||
#include "Player.h"
|
||||
#include "GameTime.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "Transport.h"
|
||||
|
|
@ -887,10 +888,10 @@ public:
|
|||
}
|
||||
else if (unit->GetTypeId() == TYPEID_UNIT && unit->GetAreaId() == 4656 /*Conservatory of Life*/)
|
||||
{
|
||||
if (time(NULL) > (m_conspeedatoryAttempt + DAY))
|
||||
if (GameTime::GetGameTime() > (m_conspeedatoryAttempt + DAY))
|
||||
{
|
||||
DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, 21597 /*CON-SPEED-ATORY_TIMED_CRITERIA*/);
|
||||
m_conspeedatoryAttempt = time(NULL);
|
||||
m_conspeedatoryAttempt = GameTime::GetGameTime();
|
||||
SaveToDB();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue