mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-15 00:06:11 +00:00
feat(Core/Time): Implement saparated manager for game time (#8630)
This commit is contained in:
@@ -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())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user