feat(Core/Time): Implement saparated manager for game time (#8630)
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
#include "AsyncAuctionListing.h"
|
||||
#include "AuctionHouseMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -299,7 +300,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
AH->bidder = ObjectGuid::Empty;
|
||||
AH->bid = 0;
|
||||
AH->buyout = buyout;
|
||||
AH->expire_time = time(nullptr) + auctionTime;
|
||||
AH->expire_time = GameTime::GetGameTime().count() + auctionTime;
|
||||
AH->deposit = deposit;
|
||||
AH->auctionHouseEntry = auctionHouseEntry;
|
||||
|
||||
@@ -340,7 +341,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
AH->bidder = ObjectGuid::Empty;
|
||||
AH->bid = 0;
|
||||
AH->buyout = buyout;
|
||||
AH->expire_time = time(nullptr) + auctionTime;
|
||||
AH->expire_time = GameTime::GetGameTime().count() + auctionTime;
|
||||
AH->deposit = deposit;
|
||||
AH->auctionHouseEntry = auctionHouseEntry;
|
||||
|
||||
@@ -661,7 +662,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData)
|
||||
|
||||
// pussywizard:
|
||||
const uint32 delay = 4500;
|
||||
const uint32 now = World::GetGameTimeMS();
|
||||
const uint32 now = GameTime::GetGameTimeMS().count();
|
||||
if (_lastAuctionListOwnerItemsMSTime > now) // list is pending
|
||||
return;
|
||||
uint32 diff = getMSTimeDiff(_lastAuctionListOwnerItemsMSTime, now);
|
||||
@@ -676,7 +677,7 @@ void WorldSession::HandleAuctionListOwnerItemsEvent(ObjectGuid creatureGuid)
|
||||
{
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_OWNER_ITEMS");
|
||||
|
||||
_lastAuctionListOwnerItemsMSTime = World::GetGameTimeMS(); // pussywizard
|
||||
_lastAuctionListOwnerItemsMSTime = GameTime::GetGameTimeMS().count(); // pussywizard
|
||||
|
||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(creatureGuid, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!creature)
|
||||
@@ -750,7 +751,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recvData)
|
||||
|
||||
// pussywizard:
|
||||
const uint32 delay = 2000;
|
||||
const uint32 now = World::GetGameTimeMS();
|
||||
const uint32 now = GameTime::GetGameTimeMS().count();
|
||||
uint32 diff = getMSTimeDiff(_lastAuctionListItemsMSTime, now);
|
||||
if (diff > delay)
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "Language.h"
|
||||
#include "ObjectAccessor.h"
|
||||
@@ -548,7 +549,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().count() < ginfo.RemoveInviteTime ? getMSTimeDiff(GameTime::GetGameTimeMS().count(), ginfo.RemoveInviteTime) : 1);
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, i, STATUS_WAIT_JOIN, remainingTime, 0, ginfo.ArenaType, TEAM_NEUTRAL, bg->isRated(), ginfo.BgTypeId);
|
||||
SendPacket(&data);
|
||||
}
|
||||
@@ -565,7 +566,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().count()), ginfo.ArenaType, TEAM_NEUTRAL, ginfo.IsRated);
|
||||
SendPacket(&data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ Copied events should probably have a new owner
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
#include "Log.h"
|
||||
@@ -46,14 +47,14 @@ Copied events should probably have a new owner
|
||||
#include "Player.h"
|
||||
#include "SocialMgr.h"
|
||||
#include "WorldSession.h"
|
||||
#include "utf8.h"
|
||||
#include <utf8.h>
|
||||
|
||||
void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
|
||||
{
|
||||
ObjectGuid guid = _player->GetGUID();
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_GET_CALENDAR [%s]", guid.ToString().c_str());
|
||||
|
||||
time_t currTime = time(nullptr);
|
||||
time_t currTime = GameTime::GetGameTime().count();
|
||||
|
||||
WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 1000); // Average size if no instance
|
||||
|
||||
@@ -260,7 +261,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
|
||||
|
||||
// prevent events in the past
|
||||
// To Do: properly handle timezones and remove the "- time_t(86400L)" hack
|
||||
if (time_t(eventPackedTime) < (time(nullptr) - time_t(86400L)))
|
||||
if (time_t(eventPackedTime) < (GameTime::GetGameTime().count() - time_t(86400L)))
|
||||
{
|
||||
recvData.rfinish();
|
||||
sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_PASSED);
|
||||
@@ -298,13 +299,13 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
|
||||
}
|
||||
}
|
||||
|
||||
if (GetCalendarEventCreationCooldown() > time(nullptr))
|
||||
if (GetCalendarEventCreationCooldown() > GameTime::GetGameTime().count())
|
||||
{
|
||||
recvData.rfinish();
|
||||
sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_INTERNAL);
|
||||
return;
|
||||
}
|
||||
SetCalendarEventCreationCooldown(time(nullptr) + CALENDAR_CREATE_EVENT_COOLDOWN);
|
||||
SetCalendarEventCreationCooldown(GameTime::GetGameTime().count() + CALENDAR_CREATE_EVENT_COOLDOWN);
|
||||
|
||||
CalendarEvent* calendarEvent = new CalendarEvent(sCalendarMgr->GetFreeEventId(), guid, 0, CalendarEventType(type), dungeonId,
|
||||
time_t(eventPackedTime), flags, time_t(unkPackedTime), title, description);
|
||||
@@ -392,7 +393,7 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
|
||||
|
||||
// prevent events in the past
|
||||
// To Do: properly handle timezones and remove the "- time_t(86400L)" hack
|
||||
if (time_t(eventPackedTime) < (time(nullptr) - time_t(86400L)))
|
||||
if (time_t(eventPackedTime) < (GameTime::GetGameTime().count() - time_t(86400L)))
|
||||
{
|
||||
recvData.rfinish();
|
||||
return;
|
||||
@@ -449,7 +450,7 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData)
|
||||
|
||||
// prevent events in the past
|
||||
// To Do: properly handle timezones and remove the "- time_t(86400L)" hack
|
||||
if (time_t(eventTime) < (time(nullptr) - time_t(86400L)))
|
||||
if (time_t(eventTime) < (GameTime::GetGameTime().count() - time_t(86400L)))
|
||||
{
|
||||
recvData.rfinish();
|
||||
sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_EVENT_PASSED);
|
||||
@@ -494,12 +495,12 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData)
|
||||
}
|
||||
}
|
||||
|
||||
if (GetCalendarEventCreationCooldown() > time(nullptr))
|
||||
if (GetCalendarEventCreationCooldown() > GameTime::GetGameTime().count())
|
||||
{
|
||||
sCalendarMgr->SendCalendarCommandResult(guid, CALENDAR_ERROR_INTERNAL);
|
||||
return;
|
||||
}
|
||||
SetCalendarEventCreationCooldown(time(nullptr) + CALENDAR_CREATE_EVENT_COOLDOWN);
|
||||
SetCalendarEventCreationCooldown(GameTime::GetGameTime().count() + CALENDAR_CREATE_EVENT_COOLDOWN);
|
||||
|
||||
CalendarEvent* newEvent = new CalendarEvent(*oldEvent, sCalendarMgr->GetFreeEventId());
|
||||
newEvent->SetEventTime(time_t(eventTime));
|
||||
@@ -633,7 +634,7 @@ void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
CalendarInviteStatus status = tentative ? CALENDAR_STATUS_TENTATIVE : CALENDAR_STATUS_SIGNED_UP;
|
||||
CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), eventId, guid, guid, time(nullptr), status, CALENDAR_RANK_PLAYER, "");
|
||||
CalendarInvite* invite = new CalendarInvite(sCalendarMgr->GetFreeInviteId(), eventId, guid, guid, GameTime::GetGameTime().count(), status, CALENDAR_RANK_PLAYER, "");
|
||||
sCalendarMgr->AddInvite(calendarEvent, invite);
|
||||
sCalendarMgr->SendCalendarClearPendingAction(guid);
|
||||
}
|
||||
@@ -665,7 +666,7 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData)
|
||||
if (CalendarInvite* invite = sCalendarMgr->GetInvite(inviteId))
|
||||
{
|
||||
invite->SetStatus(CalendarInviteStatus(status));
|
||||
invite->SetStatusTime(time(nullptr));
|
||||
invite->SetStatusTime(GameTime::GetGameTime().count());
|
||||
|
||||
sCalendarMgr->UpdateInvite(invite);
|
||||
sCalendarMgr->SendCalendarEventStatus(*calendarEvent, *invite);
|
||||
@@ -725,7 +726,7 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData)
|
||||
if (CalendarInvite* invite = sCalendarMgr->GetInvite(inviteId))
|
||||
{
|
||||
invite->SetStatus((CalendarInviteStatus)status);
|
||||
invite->SetStatusTime(time(nullptr));
|
||||
invite->SetStatusTime(GameTime::GetGameTime().count());
|
||||
|
||||
sCalendarMgr->UpdateInvite(invite);
|
||||
sCalendarMgr->SendCalendarEventStatus(*calendarEvent, *invite);
|
||||
@@ -824,7 +825,7 @@ void WorldSession::HandleSetSavedInstanceExtend(WorldPacket& recvData)
|
||||
void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add)
|
||||
{
|
||||
LOG_DEBUG("network", "%s", add ? "SMSG_CALENDAR_RAID_LOCKOUT_ADDED" : "SMSG_CALENDAR_RAID_LOCKOUT_REMOVED");
|
||||
time_t currTime = time(nullptr);
|
||||
time_t currTime = GameTime::GetGameTime().count();
|
||||
|
||||
WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_REMOVED, (add ? 4 : 0) + 4 + 4 + 4 + 8);
|
||||
if (add)
|
||||
@@ -842,7 +843,7 @@ void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add)
|
||||
|
||||
void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save, bool isExtended)
|
||||
{
|
||||
time_t currTime = time(nullptr);
|
||||
time_t currTime = GameTime::GetGameTime().count();
|
||||
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);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "Chat.h"
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "GitRevision.h"
|
||||
#include "Group.h"
|
||||
#include "Guild.h"
|
||||
@@ -124,7 +125,7 @@ bool LoginQueryHolder::Initialize()
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAIL);
|
||||
stmt->setUInt32(0, lowGuid);
|
||||
stmt->setUInt32(1, uint32(time(nullptr)));
|
||||
stmt->setUInt32(1, uint32(GameTime::GetGameTime().count()));
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_MAILS, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAILITEMS);
|
||||
@@ -914,7 +915,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder)
|
||||
loginStmt->setUInt32(1, GetAccountId());
|
||||
LoginDatabase.Execute(loginStmt);
|
||||
|
||||
pCurrChar->SetInGameTime(World::GetGameTimeMS());
|
||||
pCurrChar->SetInGameTime(GameTime::GetGameTimeMS().count());
|
||||
|
||||
// announce group about member online (must be after add to player list to receive announce to self)
|
||||
if (Group* group = pCurrChar->GetGroup())
|
||||
@@ -928,7 +929,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder const& holder)
|
||||
if (mapDiff->resetTime)
|
||||
if (time_t timeReset = sInstanceSaveMgr->GetResetTimeFor(pCurrChar->GetMap()->GetId(), pCurrChar->GetMap()->GetDifficulty()))
|
||||
{
|
||||
uint32 timeleft = uint32(timeReset - time(nullptr));
|
||||
uint32 timeleft = uint32(timeReset - GameTime::GetGameTime().count());
|
||||
pCurrChar->SendInstanceResetWarning(pCurrChar->GetMap()->GetId(), pCurrChar->GetMap()->GetDifficulty(), timeleft, true);
|
||||
}
|
||||
|
||||
@@ -1179,7 +1180,7 @@ void WorldSession::HandlePlayerLoginToCharInWorld(Player* pCurrChar)
|
||||
uint32 currZone, currArea;
|
||||
pCurrChar->GetZoneAndAreaId(currZone, currArea);
|
||||
pCurrChar->SendInitWorldStates(currZone, currArea);
|
||||
pCurrChar->SetInGameTime(World::GetGameTimeMS());
|
||||
pCurrChar->SetInGameTime(GameTime::GetGameTimeMS().count());
|
||||
|
||||
// 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
|
||||
@@ -1224,7 +1225,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(nullptr));
|
||||
uint32 timeleft = uint32(timeReset - GameTime::GetGameTime().count());
|
||||
GetPlayer()->SendInstanceResetWarning(pCurrChar->GetMap()->GetId(), pCurrChar->GetMap()->GetDifficulty(), timeleft, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "Chat.h"
|
||||
#include "ChatPackets.h"
|
||||
#include "Common.h"
|
||||
#include "GameTime.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "Group.h"
|
||||
#include "Guild.h"
|
||||
@@ -297,7 +298,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
||||
|
||||
if (!_player->CanSpeak())
|
||||
{
|
||||
std::string timeStr = secsToTimeString(m_muteTime - time(nullptr));
|
||||
std::string timeStr = secsToTimeString(m_muteTime - GameTime::GetGameTime().count());
|
||||
SendNotification(GetAcoreString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str());
|
||||
return;
|
||||
}
|
||||
@@ -729,7 +730,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recvData)
|
||||
|
||||
if (!GetPlayer()->CanSpeak())
|
||||
{
|
||||
std::string timeStr = secsToTimeString(m_muteTime - time(nullptr));
|
||||
std::string timeStr = secsToTimeString(m_muteTime - GameTime::GetGameTime().count());
|
||||
SendNotification(GetAcoreString(LANG_WAIT_BEFORE_SPEAKING), timeStr.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GameTime.h"
|
||||
#include "Log.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Player.h"
|
||||
@@ -38,7 +39,7 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
|
||||
LOG_DEBUG("network.opcode", "Player 1 is: %s (%s)", player->GetGUID().ToString().c_str(), player->GetName().c_str());
|
||||
LOG_DEBUG("network.opcode", "Player 2 is: %s (%s)", target->GetGUID().ToString().c_str(), target->GetName().c_str());
|
||||
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime().count();
|
||||
player->duel->StartTime = now + 3;
|
||||
target->duel->StartTime = now + 3;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "LFGMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
@@ -524,7 +525,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(nullptr);
|
||||
uint32 secsleft = boot.cancelTime - GameTime::GetGameTime().count();
|
||||
for (lfg::LfgAnswerContainer::const_iterator it = boot.votes.begin(); it != boot.votes.end(); ++it)
|
||||
{
|
||||
if (it->second != lfg::LFG_ANSWER_PENDING)
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "CharacterCache.h"
|
||||
#include "DBCStores.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameTime.h"
|
||||
#include "Item.h"
|
||||
#include "Language.h"
|
||||
#include "Log.h"
|
||||
@@ -401,7 +402,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket& recvData)
|
||||
|
||||
Player* player = _player;
|
||||
Mail* m = player->GetMail(mailId);
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(nullptr))
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime().count())
|
||||
{
|
||||
player->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
@@ -465,7 +466,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
|
||||
Player* player = _player;
|
||||
|
||||
Mail* m = player->GetMail(mailId);
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(nullptr))
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime().count())
|
||||
{
|
||||
player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
@@ -571,7 +572,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket& recvData)
|
||||
Player* player = _player;
|
||||
|
||||
Mail* m = player->GetMail(mailId);
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(nullptr))
|
||||
if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime().count())
|
||||
{
|
||||
player->SendMailResult(mailId, MAIL_MONEY_TAKEN, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
@@ -613,7 +614,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData)
|
||||
WorldPacket data(SMSG_MAIL_LIST_RESULT, (200)); // guess size
|
||||
data << uint32(0); // real mail's count
|
||||
data << uint8(0); // mail's count
|
||||
time_t cur_time = time(nullptr);
|
||||
time_t cur_time = GameTime::GetGameTime().count();
|
||||
|
||||
for (Mail const* mail : player->GetMails())
|
||||
{
|
||||
@@ -675,7 +676,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData)
|
||||
data << uint32(mail->stationery); // stationery (Stationery.dbc)
|
||||
data << uint32(mail->money); // Gold
|
||||
data << uint32(mail->checked); // flags
|
||||
data << float(float(mail->expire_time - time(nullptr)) / DAY); // Time
|
||||
data << float(float(mail->expire_time - GameTime::GetGameTime().count()) / DAY); // Time
|
||||
data << uint32(mail->mailTemplateId); // mail template (MailTemplate.dbc)
|
||||
data << subject; // Subject string - once 00, when mail type = 3, max 256
|
||||
data << body; // message? max 8000
|
||||
@@ -739,7 +740,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket& recvData)
|
||||
Player* player = _player;
|
||||
|
||||
Mail* m = player->GetMail(mailId);
|
||||
if (!m || (m->body.empty() && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > time(nullptr) || (m->checked & MAIL_CHECK_MASK_COPIED))
|
||||
if (!m || (m->body.empty() && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > GameTime::GetGameTime().count() || (m->checked & MAIL_CHECK_MASK_COPIED))
|
||||
{
|
||||
player->SendMailResult(mailId, MAIL_MADE_PERMANENT, MAIL_ERR_INTERNAL_ERROR);
|
||||
return;
|
||||
@@ -802,7 +803,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket& /*recvData*/)
|
||||
data << uint32(0); // count
|
||||
|
||||
uint32 count = 0;
|
||||
time_t now = time(nullptr);
|
||||
time_t now = GameTime::GetGameTime().count();
|
||||
std::set<uint32> sentSenders;
|
||||
for (Mail const* mail : _player->GetMails())
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "DBCEnums.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "GameTime.h"
|
||||
#include "GossipDef.h"
|
||||
#include "Group.h"
|
||||
#include "GuildMgr.h"
|
||||
@@ -464,7 +465,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPackets::Character::LogoutRequ
|
||||
GetPlayer()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
|
||||
}
|
||||
|
||||
SetLogoutStartTime(time(nullptr));
|
||||
SetLogoutStartTime(GameTime::GetGameTime().count());
|
||||
}
|
||||
|
||||
void WorldSession::HandlePlayerLogoutOpcode(WorldPackets::Character::PlayerLogout& /*playerLogout*/)
|
||||
@@ -651,7 +652,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(nullptr)))
|
||||
if (time_t(corpse->GetGhostTime() + _player->GetCorpseReclaimDelay(corpse->GetType() == CORPSE_RESURRECTABLE_PVP)) > time_t(GameTime::GetGameTime().count()))
|
||||
return;
|
||||
|
||||
if (!corpse->IsWithinDistInMap(_player, CORPSE_RECLAIM_RADIUS, true))
|
||||
@@ -1570,7 +1571,7 @@ void WorldSession::HandleWorldStateUITimerUpdate(WorldPacket& /*recv_data*/)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_WORLD_STATE_UI_TIMER_UPDATE");
|
||||
|
||||
WorldPacket data(SMSG_WORLD_STATE_UI_TIMER_UPDATE, 4);
|
||||
data << uint32(time(nullptr));
|
||||
data << uint32(GameTime::GetGameTime().count());
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "Chat.h"
|
||||
#include "Corpse.h"
|
||||
#include "GameGraveyard.h"
|
||||
#include "GameTime.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
#include "Log.h"
|
||||
#include "MapMgr.h"
|
||||
@@ -216,7 +217,7 @@ void WorldSession::HandleMoveWorldportAck()
|
||||
if (mapDiff->resetTime)
|
||||
if (time_t timeReset = sInstanceSaveMgr->GetResetTimeFor(mEntry->MapID, diff))
|
||||
{
|
||||
uint32 timeleft = uint32(timeReset - time(nullptr));
|
||||
uint32 timeleft = uint32(timeReset - GameTime::GetGameTime().count());
|
||||
GetPlayer()->SendInstanceResetWarning(mEntry->MapID, diff, timeleft, true);
|
||||
}
|
||||
allowMount = mInstance->AllowMount;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "Common.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "Log.h"
|
||||
#include "ObjectAccessor.h"
|
||||
@@ -923,7 +924,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData)
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(nullptr))); // cast can't be helped
|
||||
pet->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(GameTime::GetGameTime().count())); // cast can't be helped
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetAbandon(WorldPacket& recvData)
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
#include "GameTime.h"
|
||||
#include "Log.h"
|
||||
#include "MapMgr.h"
|
||||
#include "NPCHandler.h"
|
||||
@@ -81,9 +82,11 @@ void WorldSession::HandleQueryTimeOpcode(WorldPacket& /*recvData*/)
|
||||
|
||||
void WorldSession::SendQueryTimeResponse()
|
||||
{
|
||||
auto timeResponse = sWorld->GetNextDailyQuestsResetTime() - GameTime::GetGameTime();
|
||||
|
||||
WorldPacket data(SMSG_QUERY_TIME_RESPONSE, 4 + 4);
|
||||
data << uint32(time(nullptr));
|
||||
data << uint32(sWorld->GetNextDailyQuestsResetTime() - time(nullptr));
|
||||
data << uint32(GameTime::GetGameTime().count());
|
||||
data << uint32(timeResponse.count());
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "Chat.h"
|
||||
#include "GameTime.h"
|
||||
#include "Language.h"
|
||||
#include "Opcodes.h"
|
||||
#include "Player.h"
|
||||
@@ -24,7 +25,7 @@
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
#include "zlib.h"
|
||||
#include <zlib.h>
|
||||
|
||||
void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData)
|
||||
{
|
||||
@@ -272,7 +273,7 @@ void WorldSession::HandleReportLag(WorldPacket& recv_data)
|
||||
stmt->setFloat (4, y);
|
||||
stmt->setFloat (5, z);
|
||||
stmt->setUInt32(6, GetLatency());
|
||||
stmt->setUInt32(7, time(nullptr));
|
||||
stmt->setUInt32(7, GameTime::GetGameTime().count());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user