From 4c593f12caa162c1bfb831bdbed934bb39155ddb Mon Sep 17 00:00:00 2001 From: ariel- Date: Tue, 11 Apr 2017 23:57:29 -0300 Subject: Core/Instance: stop updating the instance resettimes based on creature respawns - Rather update normal instance reset time to 2 hours after last creature kill - This fixes yet another integer overflow due to the possibility of having time_t max showing up - Also change respawntime and resettime fields to bigint on respawn/instance related tables - Start using prepared statements on the InstanceSaveMgr --- src/server/game/Entities/Player/Player.cpp | 5 +++-- src/server/game/Entities/Unit/Unit.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/server/game/Entities') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 6f2ba8dcdd8..5db36e22530 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -18721,7 +18721,8 @@ void Player::_LoadBoundInstances(PreparedQueryResult result) Group* group = GetGroup(); - //QueryResult* result = CharacterDatabase.PQuery("SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = '%u'", GUID_LOPART(m_guid)); + // 0 1 2 3 4 5 + // SELECT id, permanent, map, difficulty, extendState, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = ? if (result) { do @@ -18734,7 +18735,7 @@ void Player::_LoadBoundInstances(PreparedQueryResult result) uint8 difficulty = fields[3].GetUInt8(); BindExtensionState extendState = BindExtensionState(fields[4].GetUInt8()); - time_t resetTime = time_t(fields[5].GetUInt32()); + time_t resetTime = time_t(fields[5].GetUInt64()); // the resettime for normal instances is only saved when the InstanceSave is unloaded // so the value read from the DB may be wrong here but only if the InstanceSave is loaded // and in that case it is not used diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 6646254bc60..ffffdc1ea01 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -12132,7 +12132,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) { // the reset time is set but not added to the scheduler // until the players leave the instance - time_t resettime = creature->GetRespawnTimeEx() + 2 * HOUR; + time_t resettime = GameTime::GetGameTime() + 2 * HOUR; if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(creature->GetInstanceId())) if (save->GetResetTime() < resettime) save->SetResetTime(resettime); -- cgit v1.2.3