feat(core): Ensure that all actions are compared to fixed point in time (#1236) (#1458)

i.e. world update start
This commit is contained in:
Viste(Кирилл)
2019-02-14 21:22:17 +03:00
committed by Francesco Borzì
parent 1b7522ff0e
commit 51b8773528
108 changed files with 933 additions and 509 deletions

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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)

View File

@@ -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)
{

View File

@@ -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);
}

View File

@@ -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;

View File

@@ -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)

View File

@@ -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);
}

View File

@@ -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);
}