Closed IvanJeDivan closed 9 years ago
Thanks for share bute corona have already include a autobroadcaster https://github.com/CoronaCore/OneServer/commit/bce8da2fcf6b3a8eda3f37c7f13a5015f4f33254
Aww.. but I prefer modularity.
Well i plan to add a custom file and add all stuff in there broadccaster and some other stuff
Hello, I'd like to share code for those who want an autobroadcaster. Warm suggestions to implement it, it can also be reloaded by a command but I was too lazy to write that.
From dd524511ea67bf2e0ee44ac4fd88598f135b7f6b Mon Sep 17 00:00:00 2001 From: IvanJeDivan Date: Mon, 8 Dec 2014 23:42:18 +0100 Subject: [PATCH] Autobroadcast Implementation
sql/updates/autobroadcast.sql | 11 ++++++++++ src/game/Autobroadcast.cpp | 44 ++++++++++++++++++++++++++++++++++++++++ src/game/Autobroadcast.h | 13 ++++++++++++ src/game/CMakeLists.txt | 2 ++ src/game/Language.h | 2 ++ src/game/World.cpp | 11 ++++++++++ src/game/World.h | 6 ++++++ src/mangosd/mangosd.conf.dist.in | 17 ++++++++++++++++ win/VC120/game.vcxproj | 2 ++ win/VC120/game.vcxproj.filters | 8 +++++++- 10 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 sql/updates/autobroadcast.sql create mode 100644 src/game/Autobroadcast.cpp create mode 100644 src/game/Autobroadcast.h
diff --git a/sql/updates/autobroadcast.sql b/sql/updates/autobroadcast.sql new file mode 100644 index 0000000..f837bc9 --- /dev/null +++ b/sql/updates/autobroadcast.sql @@ -0,0 +1,11 @@ +-- ---------------------------- +-- Table structure for autobroadcast +-- ---------------------------- +DROP TABLE IF EXISTS
autobroadcast
; +CREATE TABLEautobroadcast
(Id
int(10) unsigned NOT NULL AUTO_INCREMENT,text
varchar(255) DEFAULT NULL COMMENT 'Text that''ll be shown in the world.',Id
) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +INSERT INTOmangos_string
(entry
,content_default
) VALUES ('2000', '[Autobroadcast]: %s') \ No newline at end of file diff --git a/src/game/Autobroadcast.cpp b/src/game/Autobroadcast.cpp new file mode 100644 index 0000000..eb1a1ab --- /dev/null +++ b/src/game/Autobroadcast.cpp @@ -0,0 +1,44 @@ +#include "Autobroadcast.h" +#include "Language.h" +#include "World.h" +#include+}; \ No newline at end of file diff --git a/src/game/CMakeLists.txt b/src/game/CMakeLists.txt index cd6bd11..0e17bc2 100644 --- a/src/game/CMakeLists.txt +++ b/src/game/CMakeLists.txt @@ -298,6 +298,8 @@ set(SRC_GRP_VMAPS )
set(SRC_GRP_WORLD_HANDLERS
Autobroadcast.h AccountMgr.cpp AccountMgr.h AddonHandler.cpp diff --git a/src/game/Language.h b/src/game/Language.h index d408bfd..b6ab7b7 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -1017,6 +1017,8 @@ enum MangosStrings
// FREE IDS 1700-9999
diff --git a/src/game/World.cpp b/src/game/World.cpp index 10541f4..ed1bdac 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -115,6 +115,8 @@ World::World() m_configBoolValues[i] = false;
+
Broadcaster = Autobroadcast(); }
/// World destructor @@ -762,6 +764,9 @@ void World::LoadConfigSettings(bool reload)
setConfig(CONFIG_BOOL_PLAYER_COMMANDS, "PlayerCommands", true);
setConfig(CONFIG_UINT32_AUTOBROADCAST_TIMER, "Autobroadcast.Timer", 1500); + setConfig(CONFIG_UINT32_INSTANT_LOGOUT, "InstantLogout", SEC_MODERATOR);
setConfigMin(CONFIG_UINT32_GUILD_EVENT_LOG_COUNT, "Guild.EventLogRecordsCount", GUILD_EVENTLOG_MAX_RECORDS, GUILD_EVENTLOG_MAX_RECORDS); @@ -1397,6 +1402,10 @@ void World::SetInitialWorldSettings() sLog.outString("---------------------------------------"); sLog.outString();
sLog.outString(); + uint32 uStartInterval = WorldTimer::getMSTimeDiff(uStartTime, WorldTimer::getMSTime()); sLog.outString("SERVER STARTUP TIME: %i minutes %i seconds", uStartInterval / 60000, (uStartInterval % 60000) / 1000); sLog.outString(); @@ -1577,6 +1586,8 @@ void World::Update(uint32 diff)
// cleanup unused GridMap objects as well as VMaps sTerrainMgr.Update(diff); +
Broadcaster.Update(diff); }
namespace MaNGOS diff --git a/src/game/World.h b/src/game/World.h index 5868236..1cb719b 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -27,6 +27,7 @@
include "Timer.h"
include "Policies/Singleton.h"
include "SharedDefines.h"
+#include "Autobroadcast.h"
include
include
@@ -179,6 +180,7 @@ enum eConfigUInt32Values CONFIG_UINT32_GUID_RESERVE_SIZE_CREATURE, CONFIG_UINT32_GUID_RESERVE_SIZE_GAMEOBJECT, CONFIG_UINT32_CREATURE_RESPAWN_AGGRO_DELAY,
@@ -330,6 +332,7 @@ enum eConfigBoolValues CONFIG_BOOL_MMAP_ENABLED, CONFIG_BOOL_ELUNA_ENABLED, CONFIG_BOOL_PLAYER_COMMANDS,
@@ -441,6 +444,9 @@ class World
+ WorldSession* FindSession(uint32 id) const; void AddSession(WorldSession* s); bool RemoveSession(uint32 id); diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in index af3eb30..c9b5dc4 100644 --- a/src/mangosd/mangosd.conf.dist.in +++ b/src/mangosd/mangosd.conf.dist.in @@ -1673,3 +1673,20 @@ CharDelete.KeepDays = 30
Eluna.Enabled = 1 Eluna.ScriptPath = "lua_scripts" + +################################################################################################################### +# AUTOBROADCAST SETTINGS +# +# Autobroadcast.Enabled +# Enable world auto broadcast messages +# Default: 1 (Enabled) +# 0 (Disabled) +# +# Autobroadcast.Timer +# Timer settings for message broadcast in SECONDS. +# Default: 1500 +# +################################################################################################################### + +Autobroadcast.Enabled = 0 +Autobroadcast.Timer = 1500 \ No newline at end of file diff --git a/win/VC120/game.vcxproj b/win/VC120/game.vcxproj index 6ae3328..b052452 100644 --- a/win/VC120/game.vcxproj +++ b/win/VC120/game.vcxproj @@ -381,6 +381,7 @@
@@ -554,6 +555,7 @@
diff --git a/win/VC120/game.vcxproj.filters b/win/VC120/game.vcxproj.filters index 8144e3c..a37d3ea 100644 --- a/win/VC120/game.vcxproj.filters +++ b/win/VC120/game.vcxproj.filters @@ -547,6 +547,9 @@