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