amrok
Members-
Posts
7 -
Joined
-
Last visited
Never -
Donations
0.00 GBP
amrok's Achievements
Newbie (1/3)
0
Reputation
-
[Patch] Auto Announcer(With Next ID)
amrok replied to Auntie Mangos's topic in OldCore modifications
diff --git a/src/game/World.cpp b/src/game/World.cpp index abf002d..daabc68 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -1386,8 +1386,10 @@ void World::SetInitialWorldSettings() sprintf( isoDate, "%04d-%02d-%02d %02d:%02d:%02d", local.tm_year+1900, local.tm_mon+1, local.tm_mday, local.tm_hour, local.tm_min, local.tm_sec); - loginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, startstring, uptime) VALUES('%u', " I64FMTD ", '%s', 0)", - realmID, uint64(m_startTime), isoDate); + loginDatabase.PExecute("INSERT INTO uptime (realmid, starttime, startstring, uptime) VALUES('%u', " I64FMTD ", '%s', 0)", realmID, uint64(m_startTime), isoDate); + + static uint32 abtimer = 0; + abtimer = sConfig.GetIntDefault("AutoBroadcast.Timer", 60000); m_timers[WUPDATE_OBJECTS].SetInterval(0); m_timers[WUPDATE_SESSIONS].SetInterval(0); @@ -1397,6 +1399,7 @@ void World::SetInitialWorldSettings() //Update "uptime" table based on configuration entry in minutes. m_timers[WUPDATE_CORPSES].SetInterval(20*MINUTE*IN_MILISECONDS); //erase corpses every 20 minutes + m_timers[WUPDATE_AUTOBROADCAST].SetInterval(abtimer); //to set mailtimer to return mails every day between 4 and 5 am //mailtimer is increased when updating auctions @@ -1440,6 +1443,8 @@ void World::SetInitialWorldSettings() uint32 nextGameEvent = gameeventmgr.Initialize(); m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent); //depend on next event + sLog.outString("Starting Autobroadcast system..." ); + sLog.outString( "WORLD: World initialized" ); } @@ -1598,6 +1603,17 @@ void World::Update(uint32 diff) m_timers[WUPDATE_EVENTS].Reset(); } + static uint32 autobroadcaston = 0; + autobroadcaston = sConfig.GetIntDefault("AutoBroadcast.On", 0); + if(autobroadcaston == 1) + { + if (m_timers[WUPDATE_AUTOBROADCAST].Passed()) + { + m_timers[WUPDATE_AUTOBROADCAST].Reset(); + SendBroadcast(); + } + } + /// [/list] ///- Move all creatures with "delayed move" and remove and delete all objects with "delayed remove" MapManager::Instance().DoDelayedMovesAndRemoves(); @@ -2762,6 +2778,56 @@ void World::ProcessCliCommands() zprint("mangos>"); } +void World::SendBroadcast() +{ + std::string msg; + static int nextid; + + QueryResult *result; + if(nextid != 0) + { + result = loginDatabase.PQuery("SELECT `text`, `next` FROM `autobroadcast` WHERE `id` = %u", nextid); + } + else + { + result = loginDatabase.PQuery("SELECT `text`, `next` FROM `autobroadcast` ORDER BY RAND() LIMIT 1"); + } + + if(!result) + return; + + Field *fields = result->Fetch(); + nextid = fields[1].GetUInt32(); + msg = fields[0].GetString(); + delete result; + + static uint32 abcenter = 0; + abcenter = sConfig.GetIntDefault("AutoBroadcast.Center", 0); + if(abcenter == 0) + { + sWorld.SendWorldText(LANG_AUTO_BROADCAST, msg.c_str()); + + sLog.outString("AutoBroadcast: '%s'",msg.c_str()); + } + if(abcenter == 1) + { + WorldPacket data(SMSG_NOTIFICATION, (msg.size()+1)); + data << msg; + sWorld.SendGlobalMessage(&data); + + sLog.outString("AutoBroadcast: '%s'",msg.c_str()); + } + if(abcenter == 2) + { + sWorld.SendWorldText(LANG_AUTO_BROADCAST, msg.c_str()); + + WorldPacket data(SMSG_NOTIFICATION, (msg.size()+1)); + data << msg; + sWorld.SendGlobalMessage(&data); + + sLog.outString("AutoBroadcast: '%s'",msg.c_str()); + } +} + void World::InitResultQueue() { m_resultQueue = new SqlResultQueue; diff --git a/src/game/World.h b/src/game/World.h index 3e4b24c..6b41cd3 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -66,7 +66,8 @@ enum WorldTimers WUPDATE_UPTIME = 4, WUPDATE_CORPSES = 5, WUPDATE_EVENTS = 6, - WUPDATE_COUNT = 7 + WUPDATE_AUTOBROADCAST = 7, + WUPDATE_COUNT = 8 }; /// Configuration elements @@ -360,6 +361,7 @@ class World WorldSession* FindSession(uint32 id) const; void AddSession(WorldSession *s); + void SendBroadcast(); bool RemoveSession(uint32 id); /// Get the number of current active sessions void UpdateMaxSessionCounters(); have fun! PS: autobroadcast table moved from world to realmd db -
thanks nice work
-
[7428] New .map file format and some fixes
amrok replied to Auntie Mangos's topic in ... acceptedOld
got the same bug... Breath Timer is also not working... -
oh thanks but if this is really blizzlike?... I think this can cause errors with other mobs when they cast her aura spells... Its a bit hacky
-
is it possible that this patch causes a graveyard bug?^^ if i release my spirit nothing happens... game_graveyard_zone table is fine
-
[7428] New .map file format and some fixes
amrok replied to Auntie Mangos's topic in ... acceptedOld
but my game_graveyard_zone table is full ive never got problems with it... im using newest release of ytdb -
[7428] New .map file format and some fixes
amrok replied to Auntie Mangos's topic in ... acceptedOld
graveyards arent working since i've added this maps to my core....
Contact Us
To contact us
click here
You can also email us at [email protected]
Privacy Policy | Terms & Conditions
You can also email us at [email protected]
Privacy Policy | Terms & Conditions
Copyright © getMaNGOS. All rights Reserved.
This website is in no way associated with or endorsed by Blizzard Entertainment®
This website is in no way associated with or endorsed by Blizzard Entertainment®