aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-14 14:34:46 -0500
committermegamage <none@none>2009-08-14 14:34:46 -0500
commit1211aabb282447dd313350e376582c5056f8df6e (patch)
tree984f96fb8bda5940f075c517f949d0965fbd4f3d /src
parent5ebba6e2feba94c9b4ee2f476fdd8f5412d1a6f1 (diff)
[8364] Implement possibility reset client cache data from server side. Author: Fog
Implemented 2 way set cache data "version": * New db_version.cache_id field let set cache data version by DB content creators. This can be used for content releases by seting some unique value at each release. This value used by default. * New mangosd.conf config option let set (overwrite DB value) or use 0 for ignore. This can be used by serever admin for reset cache at some local changes. Note: values use at client login and then must be unique for long period time to avoid ignored at login some long not connected client with old same cache version value. --HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/World.cpp23
-rw-r--r--src/game/World.h1
-rw-r--r--src/trinitycore/trinitycore.conf.dist6
3 files changed, 27 insertions, 3 deletions
diff --git a/src/game/World.cpp b/src/game/World.cpp
index bfd7893c7b6..e3be8c8420c 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -251,6 +251,11 @@ World::AddSession_ (WorldSession* s)
s->SendPacket (&packet);
s->SendAddonsInfo();
+
+ WorldPacket pkt(SMSG_CLIENTCACHE_VERSION, 4);
+ pkt << uint32(sWorld.getConfig(CONFIG_CLIENTCACHE_VERSION));
+ s->SendPacket(&pkt);
+
s->SendTutorialsData();
UpdateMaxSessionCounters ();
@@ -922,7 +927,7 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_MAX_OVERSPEED_PINGS] = sConfig.GetIntDefault("MaxOverspeedPings",2);
if(m_configs[CONFIG_MAX_OVERSPEED_PINGS] != 0 && m_configs[CONFIG_MAX_OVERSPEED_PINGS] < 2)
{
- sLog.outError("MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check. Set to 2.",m_configs[CONFIG_MAX_OVERSPEED_PINGS]);
+ sLog.outError("MaxOverspeedPings (%i) must be in range 2..infinity (or 0 to disable check). Set to 2.",m_configs[CONFIG_MAX_OVERSPEED_PINGS]);
m_configs[CONFIG_MAX_OVERSPEED_PINGS] = 2;
}
@@ -1010,6 +1015,15 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_OFFHAND_CHECK_AT_TALENTS_RESET] = sConfig.GetBoolDefault("OffhandCheckAtTalentsReset", false);
+ if(int clientCacheId = sConfig.GetIntDefault("ClientCacheVersion", 0))
+ {
+ // overwrite DB/old value
+ if(clientCacheId > 0)
+ m_configs[CONFIG_CLIENTCACHE_VERSION] = clientCacheId;
+ else
+ sLog.outError("ClientCacheVersion can't be negative %d, ignored.", clientCacheId);
+ }
+
m_configs[CONFIG_INSTANT_LOGOUT] = sConfig.GetIntDefault("InstantLogout", SEC_MODERATOR);
m_VisibleUnitGreyDistance = sConfig.GetFloatDefault("Visibility.Distance.Grey.Unit", 1);
@@ -2500,14 +2514,17 @@ void World::UpdateMaxSessionCounters()
void World::LoadDBVersion()
{
- QueryResult* result = WorldDatabase.Query("SELECT db_version, script_version FROM version LIMIT 1");
- //QueryResult* result = WorldDatabase.Query("SELECT version, creature_ai_version FROM db_version LIMIT 1");
+ QueryResult* result = WorldDatabase.Query("SELECT db_version, script_version, cache_id FROM version LIMIT 1");
+ //QueryResult* result = WorldDatabase.Query("SELECT version, creature_ai_version, cache_id FROM db_version LIMIT 1");
if(result)
{
Field* fields = result->Fetch();
m_DBVersion = fields[0].GetCppString();
m_CreatureEventAIVersion = fields[1].GetCppString();
+
+ // will be overwrite by config values if different and non-0
+ m_configs[CONFIG_CLIENTCACHE_VERSION] = fields[2].GetUInt32();
delete result;
}
diff --git a/src/game/World.h b/src/game/World.h
index 783b57d0175..9d1813f9752 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -255,6 +255,7 @@ enum WorldConfigs
CONFIG_CHATLOG_BGROUND,
CONFIG_LOGDB_CLEARINTERVAL,
CONFIG_LOGDB_CLEARTIME,
+ CONFIG_CLIENTCACHE_VERSION,
CONFIG_VALUE_COUNT
};
diff --git a/src/trinitycore/trinitycore.conf.dist b/src/trinitycore/trinitycore.conf.dist
index 414515337b8..b2dec2148cc 100644
--- a/src/trinitycore/trinitycore.conf.dist
+++ b/src/trinitycore/trinitycore.conf.dist
@@ -713,6 +713,11 @@ ChatLogTimestamp = 0
# Default: 0 - recheck offhand slot weapon only at zone update
# 1 - recheck offhand slot weapon at talent reset also
#
+#
+# ClientCacheVersion
+# Client resets cache if WDB files' version is not equal to this value.
+# Default: 0 (no real meaning)
+#
# Event.Announce
# Default: 0 (false)
# 1 (true)
@@ -777,6 +782,7 @@ MailDeliveryDelay = 3600
SkillChance.Prospecting = 0
SkillChance.Milling = 0
OffhandCheckAtTalentsReset = 0
+ClientCacheVersion = 0
Event.Announce = 0
BeepAtStart = 1
Motd = "Welcome to a Trinity Core server."