Core/WorldRunnable: Convert autobroadcast to trinity standards (properly cache configs, change function name to better reflect purpose)
--HG-- branch : trunk
This commit is contained in:
@@ -1212,6 +1212,10 @@ void World::LoadConfigSettings(bool reload)
|
|||||||
// Dungeon finder
|
// Dungeon finder
|
||||||
m_bool_configs[CONFIG_DUNGEON_FINDER_ENABLE] = sConfig.GetBoolDefault("DungeonFinder.Enable", false);
|
m_bool_configs[CONFIG_DUNGEON_FINDER_ENABLE] = sConfig.GetBoolDefault("DungeonFinder.Enable", false);
|
||||||
|
|
||||||
|
// AutoBroadcast
|
||||||
|
m_bool_configs[CONFIG_AUTOBROADCAST] = sConfig.GetBoolDefault("AutoBroadcast.On", false);
|
||||||
|
m_int_configs[CONFIG_AUTOBROADCAST_CENTER] = sConfig.GetIntDefault("AutoBroadcast.Center", 0);
|
||||||
|
|
||||||
sScriptMgr.OnConfigLoad(reload);
|
sScriptMgr.OnConfigLoad(reload);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1930,15 +1934,13 @@ void World::Update(uint32 diff)
|
|||||||
///- Update objects when the timer has passed (maps, transport, creatures,...)
|
///- Update objects when the timer has passed (maps, transport, creatures,...)
|
||||||
sMapMgr.Update(diff); // As interval = 0
|
sMapMgr.Update(diff); // As interval = 0
|
||||||
|
|
||||||
static uint32 autobroadcaston = 0;
|
if (sWorld.getBoolConfig(CONFIG_AUTOBROADCAST))
|
||||||
autobroadcaston = sConfig.GetIntDefault("AutoBroadcast.On", 0);
|
|
||||||
if (autobroadcaston == 1)
|
|
||||||
{
|
{
|
||||||
if (m_timers[WUPDATE_AUTOBROADCAST].Passed())
|
if (m_timers[WUPDATE_AUTOBROADCAST].Passed())
|
||||||
{
|
{
|
||||||
m_timers[WUPDATE_AUTOBROADCAST].Reset();
|
m_timers[WUPDATE_AUTOBROADCAST].Reset();
|
||||||
SendRNDBroadcast();
|
SendAutoBroadcast();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sBattlegroundMgr.Update(diff);
|
sBattlegroundMgr.Update(diff);
|
||||||
@@ -2440,7 +2442,7 @@ void World::ProcessCliCommands()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void World::SendRNDBroadcast()
|
void World::SendAutoBroadcast()
|
||||||
{
|
{
|
||||||
if (m_Autobroadcasts.empty())
|
if (m_Autobroadcasts.empty())
|
||||||
return;
|
return;
|
||||||
@@ -2451,8 +2453,7 @@ void World::SendRNDBroadcast()
|
|||||||
std::advance(itr, rand() % m_Autobroadcasts.size());
|
std::advance(itr, rand() % m_Autobroadcasts.size());
|
||||||
msg = *itr;
|
msg = *itr;
|
||||||
|
|
||||||
static uint32 abcenter = 0;
|
uint32 abcenter = sWorld.getIntConfig(CONFIG_AUTOBROADCAST_CENTER);
|
||||||
abcenter = sConfig.GetIntDefault("AutoBroadcast.Center", 0);
|
|
||||||
if (abcenter == 0)
|
if (abcenter == 0)
|
||||||
{
|
{
|
||||||
sWorld.SendWorldText(LANG_AUTO_BROADCAST, msg.c_str());
|
sWorld.SendWorldText(LANG_AUTO_BROADCAST, msg.c_str());
|
||||||
|
|||||||
@@ -162,6 +162,7 @@ enum WorldBoolConfigs
|
|||||||
CONFIG_CHATLOG_ADDON,
|
CONFIG_CHATLOG_ADDON,
|
||||||
CONFIG_CHATLOG_BGROUND,
|
CONFIG_CHATLOG_BGROUND,
|
||||||
CONFIG_DUNGEON_FINDER_ENABLE,
|
CONFIG_DUNGEON_FINDER_ENABLE,
|
||||||
|
CONFIG_AUTOBROADCAST,
|
||||||
BOOL_CONFIG_VALUE_COUNT
|
BOOL_CONFIG_VALUE_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -300,6 +301,7 @@ enum WorldIntConfigs
|
|||||||
CONFIG_CHARDELETE_KEEP_DAYS,
|
CONFIG_CHARDELETE_KEEP_DAYS,
|
||||||
CONFIG_CHARDELETE_METHOD,
|
CONFIG_CHARDELETE_METHOD,
|
||||||
CONFIG_CHARDELETE_MIN_LEVEL,
|
CONFIG_CHARDELETE_MIN_LEVEL,
|
||||||
|
CONFIG_AUTOBROADCAST_CENTER,
|
||||||
INT_CONFIG_VALUE_COUNT
|
INT_CONFIG_VALUE_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -513,7 +515,7 @@ class World
|
|||||||
|
|
||||||
WorldSession* FindSession(uint32 id) const;
|
WorldSession* FindSession(uint32 id) const;
|
||||||
void AddSession(WorldSession *s);
|
void AddSession(WorldSession *s);
|
||||||
void SendRNDBroadcast();
|
void SendAutoBroadcast();
|
||||||
bool RemoveSession(uint32 id);
|
bool RemoveSession(uint32 id);
|
||||||
/// Get the number of current active sessions
|
/// Get the number of current active sessions
|
||||||
void UpdateMaxSessionCounters();
|
void UpdateMaxSessionCounters();
|
||||||
|
|||||||
Reference in New Issue
Block a user