Core/Instance: stop updating the instance resettimes based on creature respawns
This commit is contained in:
1 parent
0d6c2978ae
commit
c17fa0bcc5
8 files changed
+53
-46
No files matched your search
@@ -1531,7 +1531,7 @@ DROP TABLE IF EXISTS `creature_respawn`;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `creature_respawn` (
|
||||
`guid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier',
|
||||
`respawnTime` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`respawnTime` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`mapId` smallint(10) unsigned NOT NULL DEFAULT '0',
|
||||
`instanceId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Instance Identifier',
|
||||
PRIMARY KEY (`guid`,`instanceId`),
|
||||
@@ -1605,7 +1605,7 @@ DROP TABLE IF EXISTS `gameobject_respawn`;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `gameobject_respawn` (
|
||||
`guid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Global Unique Identifier',
|
||||
`respawnTime` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`respawnTime` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`mapId` smallint(10) unsigned NOT NULL DEFAULT '0',
|
||||
`instanceId` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Instance Identifier',
|
||||
PRIMARY KEY (`guid`,`instanceId`),
|
||||
@@ -2219,7 +2219,7 @@ DROP TABLE IF EXISTS `instance`;
|
||||
CREATE TABLE `instance` (
|
||||
`id` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`map` smallint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`resettime` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`resettime` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
`difficulty` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
`completedEncounters` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`data` tinytext NOT NULL,
|
||||
@@ -2249,7 +2249,7 @@ DROP TABLE IF EXISTS `instance_reset`;
|
||||
CREATE TABLE `instance_reset` (
|
||||
`mapid` smallint(5) unsigned NOT NULL DEFAULT '0',
|
||||
`difficulty` tinyint(3) unsigned NOT NULL DEFAULT '0',
|
||||
`resettime` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
`resettime` bigint(20) unsigned NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`mapid`,`difficulty`),
|
||||
KEY `difficulty` (`difficulty`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
@@ -2814,7 +2814,7 @@ CREATE TABLE `updates` (
|
||||
|
||||
LOCK TABLES `updates` WRITE;
|
||||
/*!40000 ALTER TABLE `updates` DISABLE KEYS */;
|
||||
INSERT INTO `updates` VALUES ('2014_10_28_00_characters.sql','DCC0367E2784919FBE6ED44D60057179','ARCHIVED','2014-10-28 21:00:00',0),('2015_03_20_00_characters.sql','B761760804EA73BD297F296C5C1919687DF7191C','ARCHIVED','2015-03-21 21:44:15',0),('2015_03_20_01_characters.sql','894F08B70449A5481FFAF394EE5571D7FC4D8A3A','ARCHIVED','2015-03-21 21:44:15',0),('2015_03_20_02_characters.sql','97D7BE0CAADC79F3F11B9FD296B8C6CD40FE593B','ARCHIVED','2015-03-21 21:44:51',0),('2015_06_26_00_characters_335.sql','f8230a59a9e878a6f54f421d6621f1595bd93861','ARCHIVED','2015-03-21 21:44:51',0),('2016_01_11_00_characters_from_335.sql','AAECE4BA6FDCF0C34A57FADD11DB68DAFD8AE9CD','ARCHIVED','2016-01-10 21:57:56',0),('2016_01_11_01_characters_from_335.sql','F8682A431D50E54BDC4AC0E7DBED21AE8AAB6AD4','ARCHIVED','2015-09-29 22:23:32',0),('2016_01_11_02_characters_from_335.sql','4555A7F35C107E54C13D74D20F141039ED42943E','ARCHIVED','2015-10-29 20:32:37',0),('2016_01_14_from_335_2015_10_06_00_characters.sql','16842FDD7E8547F2260D3312F53EFF8761EFAB35','ARCHIVED','2015-10-11 19:47:41',0),('2016_01_14_from_335_2015_10_07_00_characters.sql','E15AB463CEBE321001D7BFDEA4B662FF618728FD','ARCHIVED','2015-10-11 19:47:41',0),('2016_01_14_from_335_2015_10_12_00_characters.sql','D6F9927BDED72AD0A81D6EC2C6500CBC34A39FA2','ARCHIVED','2015-10-13 01:06:25',0),('2016_01_14_from_335_2015_10_28_00_characters.sql','622A9CA8FCE690429EBE23BA071A37C7A007BF8B','ARCHIVED','2015-10-28 21:49:52',0),('2016_01_14_from_335_2015_11_03_00_characters.sql','CC045717B8FDD9733351E52A5302560CD08AAD57','ARCHIVED','2015-11-03 22:56:17',0),('2016_02_21_from_335_2016_02_10_00_characters.sql','F1B4DA202819CABC7319A4470A2D224A34609E97','ARCHIVED','2016-02-10 00:00:00',0),('2016_03_12_00_characters.sql','0ACDD35EC9745231BCFA701B78056DEF94D0CC53','ARCHIVED','2016-03-12 00:00:00',0), ('2016_07_17_00_characters.sql', '41BF94C59FE13A61067E6721092F6187E184F37B', 'ARCHIVED', '2016-07-18 21:05:05', 0), ('2016_08_28_00_characters.sql', '111B0E4A6770A79093CC3CFFB9CE3475', 'ARCHIVED', '2016-08-28 21:05:05', 0),('2016_09_14_00_characters_from_335_was_2016_09_13_00_characters.sql','27A04615B11B2CFC3A26778F52F74C071E4F9C54','ARCHIVED','2016-07-06 18:55:18',0),('2016_09_28_00_characters.sql','18F026197AAF80B9CFB82BE308D7011E','ARCHIVED','2016-09-28 18:55:18',0),('2016_11_02_00_characters_from_335_was_2016_10_30_00_characters.sql','ED4A7CB8D560E3DB0CA26E27A9523707','ARCHIVED','2016-11-02 04:30:18',0),('2016_11_06_00_characters.sql','D62680982E2AD86CC7CDB8B3B8E45D26','ARCHIVED','2016-11-06 17:11:18',0),('2017_01_12_00_characters.sql','C864FD9142682A7FA80DD20247046AC7','ARCHIVED','2017-01-12 00:00:00',0),('2017_02_11_00_characters.sql','528E8BF7A489518A251C07CD0A1527D4','ARCHIVED','2017-02-11 00:00:00',0),('2017_03_16_00_characters.sql','53A9F270A0BCDA0152326D42FA152F8B','RELEASED','2017-03-16 00:00:00',0),('2017_04_09_00_characters_from_335_was_2017_04_03_00_characters.sql','E401D35E81CDC38135392C99AABC8A53','ARCHIVED','2017-04-03 00:00:00',0);
|
||||
INSERT INTO `updates` VALUES ('2014_10_28_00_characters.sql','DCC0367E2784919FBE6ED44D60057179','ARCHIVED','2014-10-28 21:00:00',0),('2015_03_20_00_characters.sql','B761760804EA73BD297F296C5C1919687DF7191C','ARCHIVED','2015-03-21 21:44:15',0),('2015_03_20_01_characters.sql','894F08B70449A5481FFAF394EE5571D7FC4D8A3A','ARCHIVED','2015-03-21 21:44:15',0),('2015_03_20_02_characters.sql','97D7BE0CAADC79F3F11B9FD296B8C6CD40FE593B','ARCHIVED','2015-03-21 21:44:51',0),('2015_06_26_00_characters_335.sql','f8230a59a9e878a6f54f421d6621f1595bd93861','ARCHIVED','2015-03-21 21:44:51',0),('2016_01_11_00_characters_from_335.sql','AAECE4BA6FDCF0C34A57FADD11DB68DAFD8AE9CD','ARCHIVED','2016-01-10 21:57:56',0),('2016_01_11_01_characters_from_335.sql','F8682A431D50E54BDC4AC0E7DBED21AE8AAB6AD4','ARCHIVED','2015-09-29 22:23:32',0),('2016_01_11_02_characters_from_335.sql','4555A7F35C107E54C13D74D20F141039ED42943E','ARCHIVED','2015-10-29 20:32:37',0),('2016_01_14_from_335_2015_10_06_00_characters.sql','16842FDD7E8547F2260D3312F53EFF8761EFAB35','ARCHIVED','2015-10-11 19:47:41',0),('2016_01_14_from_335_2015_10_07_00_characters.sql','E15AB463CEBE321001D7BFDEA4B662FF618728FD','ARCHIVED','2015-10-11 19:47:41',0),('2016_01_14_from_335_2015_10_12_00_characters.sql','D6F9927BDED72AD0A81D6EC2C6500CBC34A39FA2','ARCHIVED','2015-10-13 01:06:25',0),('2016_01_14_from_335_2015_10_28_00_characters.sql','622A9CA8FCE690429EBE23BA071A37C7A007BF8B','ARCHIVED','2015-10-28 21:49:52',0),('2016_01_14_from_335_2015_11_03_00_characters.sql','CC045717B8FDD9733351E52A5302560CD08AAD57','ARCHIVED','2015-11-03 22:56:17',0),('2016_02_21_from_335_2016_02_10_00_characters.sql','F1B4DA202819CABC7319A4470A2D224A34609E97','ARCHIVED','2016-02-10 00:00:00',0),('2016_03_12_00_characters.sql','0ACDD35EC9745231BCFA701B78056DEF94D0CC53','ARCHIVED','2016-03-12 00:00:00',0), ('2016_07_17_00_characters.sql', '41BF94C59FE13A61067E6721092F6187E184F37B', 'ARCHIVED', '2016-07-18 21:05:05', 0), ('2016_08_28_00_characters.sql', '111B0E4A6770A79093CC3CFFB9CE3475', 'ARCHIVED', '2016-08-28 21:05:05', 0),('2016_09_14_00_characters_from_335_was_2016_09_13_00_characters.sql','27A04615B11B2CFC3A26778F52F74C071E4F9C54','ARCHIVED','2016-07-06 18:55:18',0),('2016_09_28_00_characters.sql','18F026197AAF80B9CFB82BE308D7011E','ARCHIVED','2016-09-28 18:55:18',0),('2016_11_02_00_characters_from_335_was_2016_10_30_00_characters.sql','ED4A7CB8D560E3DB0CA26E27A9523707','ARCHIVED','2016-11-02 04:30:18',0),('2016_11_06_00_characters.sql','D62680982E2AD86CC7CDB8B3B8E45D26','ARCHIVED','2016-11-06 17:11:18',0),('2017_01_12_00_characters.sql','C864FD9142682A7FA80DD20247046AC7','ARCHIVED','2017-01-12 00:00:00',0),('2017_02_11_00_characters.sql','528E8BF7A489518A251C07CD0A1527D4','ARCHIVED','2017-02-11 00:00:00',0),('2017_03_16_00_characters.sql','53A9F270A0BCDA0152326D42FA152F8B','RELEASED','2017-03-16 00:00:00',0),('2017_04_09_00_characters_from_335_was_2017_04_03_00_characters.sql','E401D35E81CDC38135392C99AABC8A53','ARCHIVED','2017-04-03 00:00:00',0),('2017_04_14_00_characters_from_335_was_2017_04_12_01_characters.sql','CDF589A2AE1FB78DF74DC0508B9EB73D','RELEASED','2017-04-12 00:00:00',0);
|
||||
/*!40000 ALTER TABLE `updates` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
ALTER TABLE `creature_respawn` CHANGE `respawnTime` `respawnTime` bigint(20) unsigned NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `gameobject_respawn` CHANGE `respawnTime` `respawnTime` bigint(20) unsigned NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `instance` CHANGE `resettime` `resettime` bigint(20) unsigned NOT NULL DEFAULT '0';
|
||||
ALTER TABLE `instance_reset` CHANGE `resettime` `resettime` bigint(20) unsigned NOT NULL DEFAULT '0';
|
||||
@@ -337,7 +337,6 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(CHAR_REP_CREATURE_RESPAWN, "REPLACE INTO creature_respawn (guid, respawnTime, mapId, instanceId) VALUES (?, ?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_CREATURE_RESPAWN, "DELETE FROM creature_respawn WHERE guid = ? AND mapId = ? AND instanceId = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE, "DELETE FROM creature_respawn WHERE mapId = ? AND instanceId = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_SEL_MAX_CREATURE_RESPAWNS, "SELECT MAX(respawnTime), instanceId FROM creature_respawn WHERE instanceId > 0 GROUP BY instanceId", CONNECTION_SYNCH);
|
||||
|
||||
// Gameobject respawn
|
||||
PrepareStatement(CHAR_SEL_GO_RESPAWNS, "SELECT guid, respawnTime FROM gameobject_respawn WHERE mapId = ? AND instanceId = ?", CONNECTION_SYNCH);
|
||||
@@ -411,7 +410,9 @@ void CharacterDatabaseConnection::DoPrepareStatements()
|
||||
PrepareStatement(CHAR_DEL_GROUP_INSTANCE_BY_GUID, "DELETE FROM group_instance WHERE guid = ? AND instance = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_REP_GROUP_INSTANCE, "REPLACE INTO group_instance (guid, instance, permanent) VALUES (?, ?, ?)", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_INSTANCE_RESETTIME, "UPDATE instance SET resettime = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_GLOBAL_INSTANCE_RESETTIME, "UPDATE instance_reset SET resettime = ? WHERE mapid = ? AND difficulty = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_INS_GLOBAL_INSTANCE_RESETTIME, "INSERT INTO instance_reset (mapid, difficulty, resettime) VALUES (?, ?, ?)", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_DEL_GLOBAL_INSTANCE_RESETTIME, "DELETE FROM instance_reset WHERE mapid = ? AND difficulty = ?", CONNECTION_SYNCH);
|
||||
PrepareStatement(CHAR_UPD_GLOBAL_INSTANCE_RESETTIME, "UPDATE instance_reset SET resettime = ? WHERE mapid = ? AND difficulty = ?", CONNECTION_BOTH);
|
||||
PrepareStatement(CHAR_UPD_CHAR_ONLINE, "UPDATE characters SET online = 1 WHERE guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_CHAR_NAME_AT_LOGIN, "UPDATE characters set name = ?, at_login = ? WHERE guid = ?", CONNECTION_ASYNC);
|
||||
PrepareStatement(CHAR_UPD_WORLDSTATE, "UPDATE worldstates SET value = ? WHERE entry = ?", CONNECTION_ASYNC);
|
||||
|
||||
@@ -283,7 +283,6 @@ enum CharacterDatabaseStatements
|
||||
CHAR_REP_CREATURE_RESPAWN,
|
||||
CHAR_DEL_CREATURE_RESPAWN,
|
||||
CHAR_DEL_CREATURE_RESPAWN_BY_INSTANCE,
|
||||
CHAR_SEL_MAX_CREATURE_RESPAWNS,
|
||||
|
||||
CHAR_SEL_GO_RESPAWNS,
|
||||
CHAR_REP_GO_RESPAWN,
|
||||
@@ -336,6 +335,8 @@ enum CharacterDatabaseStatements
|
||||
CHAR_DEL_GROUP_INSTANCE_BY_GUID,
|
||||
CHAR_REP_GROUP_INSTANCE,
|
||||
CHAR_UPD_INSTANCE_RESETTIME,
|
||||
CHAR_INS_GLOBAL_INSTANCE_RESETTIME,
|
||||
CHAR_DEL_GLOBAL_INSTANCE_RESETTIME,
|
||||
CHAR_UPD_GLOBAL_INSTANCE_RESETTIME,
|
||||
CHAR_UPD_CHAR_ONLINE,
|
||||
CHAR_UPD_CHAR_NAME_AT_LOGIN,
|
||||
|
||||
@@ -18860,7 +18860,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
|
||||
@@ -18873,7 +18874,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
|
||||
|
||||
@@ -14250,7 +14250,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);
|
||||
|
||||
@@ -155,7 +155,7 @@ void InstanceSaveManager::RemoveInstanceSave(uint32 InstanceId)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_INSTANCE_RESETTIME);
|
||||
|
||||
stmt->setUInt32(0, uint32(resettime));
|
||||
stmt->setUInt64(0, uint64(resettime));
|
||||
stmt->setUInt32(1, InstanceId);
|
||||
|
||||
CharacterDatabase.Execute(stmt);
|
||||
@@ -209,7 +209,7 @@ void InstanceSave::SaveToDB()
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_INSTANCE_SAVE);
|
||||
stmt->setUInt32(0, m_instanceid);
|
||||
stmt->setUInt16(1, GetMapId());
|
||||
stmt->setUInt32(2, uint32(GetResetTimeForDB()));
|
||||
stmt->setUInt64(2, uint64(GetResetTimeForDB()));
|
||||
stmt->setUInt8(3, uint8(GetDifficulty()));
|
||||
stmt->setUInt32(4, completedEncounters);
|
||||
stmt->setString(5, data);
|
||||
@@ -315,8 +315,7 @@ void InstanceSaveManager::LoadResetTimes()
|
||||
typedef std::pair<ResetTimeMapDiffInstances::const_iterator, ResetTimeMapDiffInstances::const_iterator> ResetTimeMapDiffInstancesBounds;
|
||||
ResetTimeMapDiffInstances mapDiffResetInstances;
|
||||
|
||||
QueryResult result = CharacterDatabase.Query("SELECT id, map, difficulty, resettime FROM instance ORDER BY id ASC");
|
||||
if (result)
|
||||
if (QueryResult result = CharacterDatabase.Query("SELECT id, map, difficulty, resettime FROM instance ORDER BY id ASC"))
|
||||
{
|
||||
do
|
||||
{
|
||||
@@ -332,7 +331,7 @@ void InstanceSaveManager::LoadResetTimes()
|
||||
// Mark instance id as being used
|
||||
sMapMgr->RegisterInstanceId(instanceId);
|
||||
|
||||
if (time_t resettime = time_t(fields[3].GetUInt32()))
|
||||
if (time_t resettime = time_t(fields[3].GetUInt64()))
|
||||
{
|
||||
uint32 mapid = fields[1].GetUInt16();
|
||||
uint32 difficulty = fields[2].GetUInt8();
|
||||
@@ -343,24 +342,6 @@ void InstanceSaveManager::LoadResetTimes()
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
// update reset time for normal instances with the max creature respawn time + X hours
|
||||
if (PreparedQueryResult result2 = CharacterDatabase.Query(CharacterDatabase.GetPreparedStatement(CHAR_SEL_MAX_CREATURE_RESPAWNS)))
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result2->Fetch();
|
||||
uint32 instance = fields[1].GetUInt32();
|
||||
time_t resettime = time_t(fields[0].GetUInt32() + 2 * HOUR);
|
||||
InstResetTimeMapDiffType::iterator itr = instResetTime.find(instance);
|
||||
if (itr != instResetTime.end() && itr->second.second != resettime)
|
||||
{
|
||||
CharacterDatabase.DirectPExecute("UPDATE instance SET resettime = '" UI64FMTD "' WHERE id = '%u'", uint64(resettime), instance);
|
||||
itr->second.second = resettime;
|
||||
}
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
// schedule the reset times
|
||||
for (InstResetTimeMapDiffType::iterator itr = instResetTime.begin(); itr != instResetTime.end(); ++itr)
|
||||
if (itr->second.second > now)
|
||||
@@ -369,28 +350,37 @@ void InstanceSaveManager::LoadResetTimes()
|
||||
|
||||
// load the global respawn times for raid/heroic instances
|
||||
uint32 diff = sWorld->getIntConfig(CONFIG_INSTANCE_RESET_TIME_HOUR) * HOUR;
|
||||
result = CharacterDatabase.Query("SELECT mapid, difficulty, resettime FROM instance_reset");
|
||||
if (result)
|
||||
if (QueryResult result = CharacterDatabase.Query("SELECT mapid, difficulty, resettime FROM instance_reset"))
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 mapid = fields[0].GetUInt16();
|
||||
Difficulty difficulty = Difficulty(fields[1].GetUInt8());
|
||||
uint64 oldresettime = fields[2].GetUInt32();
|
||||
uint64 oldresettime = fields[2].GetUInt64();
|
||||
|
||||
MapDifficulty const* mapDiff = GetMapDifficultyData(mapid, difficulty);
|
||||
if (!mapDiff)
|
||||
{
|
||||
TC_LOG_ERROR("misc", "InstanceSaveManager::LoadResetTimes: invalid mapid(%u)/difficulty(%u) pair in instance_reset!", mapid, difficulty);
|
||||
CharacterDatabase.DirectPExecute("DELETE FROM instance_reset WHERE mapid = '%u' AND difficulty = '%u'", mapid, difficulty);
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GLOBAL_INSTANCE_RESETTIME);
|
||||
stmt->setUInt16(0, uint16(mapid));
|
||||
stmt->setUInt8(1, uint8(difficulty));
|
||||
CharacterDatabase.DirectExecute(stmt);
|
||||
continue;
|
||||
}
|
||||
|
||||
// update the reset time if the hour in the configs changes
|
||||
uint64 newresettime = (oldresettime / DAY) * DAY + diff;
|
||||
if (oldresettime != newresettime)
|
||||
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '%u' WHERE mapid = '%u' AND difficulty = '%u'", uint32(newresettime), mapid, difficulty);
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GLOBAL_INSTANCE_RESETTIME);
|
||||
stmt->setUInt64(0, uint64(newresettime));
|
||||
stmt->setUInt16(1, uint16(mapid));
|
||||
stmt->setUInt8(2, uint8(difficulty));
|
||||
CharacterDatabase.DirectExecute(stmt);
|
||||
}
|
||||
|
||||
InitializeResetTimeFor(mapid, difficulty, newresettime);
|
||||
} while (result->NextRow());
|
||||
@@ -417,7 +407,12 @@ void InstanceSaveManager::LoadResetTimes()
|
||||
{
|
||||
// initialize the reset time
|
||||
t = today + period + diff;
|
||||
CharacterDatabase.DirectPExecute("INSERT INTO instance_reset VALUES ('%u', '%u', '%u')", mapid, difficulty, (uint32)t);
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GLOBAL_INSTANCE_RESETTIME);
|
||||
stmt->setUInt16(0, uint16(mapid));
|
||||
stmt->setUInt8(1, uint8(difficulty));
|
||||
stmt->setUInt64(2, uint64(t));
|
||||
CharacterDatabase.DirectExecute(stmt);
|
||||
}
|
||||
|
||||
if (t < now)
|
||||
@@ -426,7 +421,12 @@ void InstanceSaveManager::LoadResetTimes()
|
||||
// calculate the next reset time
|
||||
t = (t / DAY) * DAY;
|
||||
t += ((today - t) / period + 1) * period + diff;
|
||||
CharacterDatabase.DirectPExecute("UPDATE instance_reset SET resettime = '" UI64FMTD "' WHERE mapid = '%u' AND difficulty= '%u'", (uint64)t, mapid, difficulty);
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GLOBAL_INSTANCE_RESETTIME);
|
||||
stmt->setUInt64(0, uint64(t));
|
||||
stmt->setUInt16(1, uint16(mapid));
|
||||
stmt->setUInt8(2, uint8(difficulty));
|
||||
CharacterDatabase.DirectExecute(stmt);
|
||||
}
|
||||
|
||||
InitializeResetTimeFor(mapid, difficulty, t);
|
||||
@@ -678,7 +678,7 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b
|
||||
// Update it in the DB
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GLOBAL_INSTANCE_RESETTIME);
|
||||
|
||||
stmt->setUInt32(0, next_reset);
|
||||
stmt->setUInt64(0, uint64(next_reset));
|
||||
stmt->setUInt16(1, uint16(mapid));
|
||||
stmt->setUInt8(2, uint8(difficulty));
|
||||
|
||||
|
||||
@@ -3505,7 +3505,7 @@ void Map::SaveCreatureRespawnTime(ObjectGuid::LowType dbGuid, time_t respawnTime
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CREATURE_RESPAWN);
|
||||
stmt->setUInt32(0, dbGuid);
|
||||
stmt->setUInt32(1, uint32(respawnTime));
|
||||
stmt->setUInt64(1, uint64(respawnTime));
|
||||
stmt->setUInt16(2, GetId());
|
||||
stmt->setUInt32(3, GetInstanceId());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
@@ -3535,7 +3535,7 @@ void Map::SaveGORespawnTime(ObjectGuid::LowType dbGuid, time_t respawnTime)
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_GO_RESPAWN);
|
||||
stmt->setUInt32(0, dbGuid);
|
||||
stmt->setUInt32(1, uint32(respawnTime));
|
||||
stmt->setUInt64(1, uint64(respawnTime));
|
||||
stmt->setUInt16(2, GetId());
|
||||
stmt->setUInt32(3, GetInstanceId());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
@@ -3563,7 +3563,7 @@ void Map::LoadRespawnTimes()
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
ObjectGuid::LowType loguid = fields[0].GetUInt32();
|
||||
uint32 respawnTime = fields[1].GetUInt32();
|
||||
uint64 respawnTime = fields[1].GetUInt64();
|
||||
|
||||
_creatureRespawnTimes[loguid] = time_t(respawnTime);
|
||||
} while (result->NextRow());
|
||||
@@ -3578,7 +3578,7 @@ void Map::LoadRespawnTimes()
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
ObjectGuid::LowType loguid = fields[0].GetUInt32();
|
||||
uint32 respawnTime = fields[1].GetUInt32();
|
||||
uint64 respawnTime = fields[1].GetUInt64();
|
||||
|
||||
_goRespawnTimes[loguid] = time_t(respawnTime);
|
||||
} while (result->NextRow());
|
||||
|
||||
Reference in new issue
Block a user