Core/PacketIO: Send the expected value in available hotfixes packet - realm address, not arbitrary number (it no longer has any effect for clearing client cache)

This commit is contained in:
Shauren
2020-08-13 14:15:26 +02:00
parent 5a6970e556
commit 2c99678118
9 changed files with 11 additions and 29 deletions

View File

@@ -0,0 +1 @@
ALTER TABLE `version` DROP `hotfix_cache_id`;

View File

@@ -22,6 +22,7 @@
#include "HotfixPackets.h"
#include "Log.h"
#include "ObjectDefines.h"
#include "Realm.h"
#include "World.h"
void WorldSession::HandleDBQueryBulk(WorldPackets::Hotfix::DBQueryBulk& dbQuery)
@@ -55,9 +56,9 @@ void WorldSession::HandleDBQueryBulk(WorldPackets::Hotfix::DBQueryBulk& dbQuery)
}
}
void WorldSession::SendAvailableHotfixes(int32 version)
void WorldSession::SendAvailableHotfixes()
{
SendPacket(WorldPackets::Hotfix::AvailableHotfixes(version, sDB2Manager.GetHotfixCount(), sDB2Manager.GetHotfixData()).Write());
SendPacket(WorldPackets::Hotfix::AvailableHotfixes(realm.Id.GetAddress(), sDB2Manager.GetHotfixCount(), sDB2Manager.GetHotfixData()).Write());
}
void WorldSession::HandleHotfixRequest(WorldPackets::Hotfix::HotfixRequest& hotfixQuery)

View File

@@ -63,7 +63,7 @@ WorldPacket const* DBReply::Write()
WorldPacket const* AvailableHotfixes::Write()
{
_worldPacket << int32(HotfixCacheVersion);
_worldPacket << int32(VirtualRealmAddress);
_worldPacket << uint32(HotfixCount);
for (DB2Manager::HotfixRecord const& hotfixRecord : Hotfixes)
_worldPacket << hotfixRecord;

View File

@@ -61,12 +61,12 @@ namespace WorldPackets
class AvailableHotfixes final : public ServerPacket
{
public:
AvailableHotfixes(int32 hotfixCacheVersion, uint32 hotfixCount, DB2Manager::HotfixContainer const& hotfixes)
: ServerPacket(SMSG_AVAILABLE_HOTFIXES), HotfixCacheVersion(hotfixCacheVersion), HotfixCount(hotfixCount), Hotfixes(hotfixes) { }
AvailableHotfixes(int32 virtualRealmAddress, uint32 hotfixCount, DB2Manager::HotfixContainer const& hotfixes)
: ServerPacket(SMSG_AVAILABLE_HOTFIXES), VirtualRealmAddress(virtualRealmAddress), HotfixCount(hotfixCount), Hotfixes(hotfixes) { }
WorldPacket const* Write() override;
int32 HotfixCacheVersion;
int32 VirtualRealmAddress;
uint32 HotfixCount;
DB2Manager::HotfixContainer const& Hotfixes;
};

View File

@@ -1078,7 +1078,7 @@ void WorldSession::InitializeSessionCallback(LoginDatabaseQueryHolder* realmHold
SendSetTimeZoneInformation();
SendFeatureSystemStatusGlueScreen();
SendClientCacheVersion(sWorld->getIntConfig(CONFIG_CLIENTCACHE_VERSION));
SendAvailableHotfixes(int32(sWorld->getIntConfig(CONFIG_HOTFIX_CACHE_VERSION)));
SendAvailableHotfixes();
SendTutorialsData();
if (PreparedQueryResult characterCountsResult = holder->GetPreparedResult(AccountInfoQueryHolder::GLOBAL_REALM_CHARACTER_COUNTS))

View File

@@ -930,7 +930,7 @@ class TC_GAME_API WorldSession
void SendAuthResponse(uint32 code, bool queued, uint32 queuePos = 0);
void SendClientCacheVersion(uint32 version);
void SendAvailableHotfixes(int32 version);
void SendAvailableHotfixes();
void InitializeSession();
void InitializeSessionCallback(LoginDatabaseQueryHolder* realmHolder, CharacterDatabaseQueryHolder* holder);

View File

@@ -1216,16 +1216,6 @@ void World::LoadConfigSettings(bool reload)
}
TC_LOG_INFO("server.loading", "Client cache version set to: %u", m_int_configs[CONFIG_CLIENTCACHE_VERSION]);
if (int32 hotfixCacheId = sConfigMgr->GetIntDefault("HotfixCacheVersion", 0))
{
// overwrite DB/old value
if (hotfixCacheId > 0)
m_int_configs[CONFIG_HOTFIX_CACHE_VERSION] = hotfixCacheId;
else
TC_LOG_ERROR("server.loading", "HotfixCacheVersion can't be negative %d, ignored.", hotfixCacheId);
}
TC_LOG_INFO("server.loading", "Hotfix cache version set to: %u", m_int_configs[CONFIG_HOTFIX_CACHE_VERSION]);
m_int_configs[CONFIG_GUILD_NEWS_LOG_COUNT] = sConfigMgr->GetIntDefault("Guild.NewsLogRecordsCount", GUILD_NEWSLOG_MAX_RECORDS);
if (m_int_configs[CONFIG_GUILD_NEWS_LOG_COUNT] > GUILD_NEWSLOG_MAX_RECORDS)
m_int_configs[CONFIG_GUILD_NEWS_LOG_COUNT] = GUILD_NEWSLOG_MAX_RECORDS;
@@ -3440,14 +3430,13 @@ void World::UpdateMaxSessionCounters()
void World::LoadDBVersion()
{
if (QueryResult result = WorldDatabase.Query("SELECT db_version, cache_id, hotfix_cache_id FROM version LIMIT 1"))
if (QueryResult result = WorldDatabase.Query("SELECT db_version, cache_id FROM version LIMIT 1"))
{
Field* fields = result->Fetch();
m_DBVersion = fields[0].GetString();
// will be overwrite by config values if different and non-0
m_int_configs[CONFIG_CLIENTCACHE_VERSION] = fields[1].GetUInt32();
m_int_configs[CONFIG_HOTFIX_CACHE_VERSION] = fields[2].GetUInt32();
}
if (m_DBVersion.empty())

View File

@@ -340,7 +340,6 @@ enum WorldIntConfigs
CONFIG_LOGDB_CLEARINTERVAL,
CONFIG_LOGDB_CLEARTIME,
CONFIG_CLIENTCACHE_VERSION,
CONFIG_HOTFIX_CACHE_VERSION,
CONFIG_GUILD_NEWS_LOG_COUNT,
CONFIG_GUILD_EVENT_LOG_COUNT,
CONFIG_GUILD_BANK_EVENT_LOG_COUNT,

View File

@@ -1193,14 +1193,6 @@ OffhandCheckAtSpellUnlearn = 1
ClientCacheVersion = 0
#
# HotfixCacheVersion
# Description: Hotfix cache version for hotfix cache data reset. Use any value different
# from DB and not recently been used to trigger client side cache reset.
# Default: 0 - (Use DB value from world DB version.hotfix_id field)
HotfixCacheVersion = 0
#
# Event.Announce
# Description: Announce events.