Jump to content

Auto Announcer with NextID and MangChat support


Guest xeross155

Recommended Posts

I had an error: Patch malformed

$ patch -p1 < announce.patch

patching file `src/game/Language.h'

Hunk #1 succeeded at 832 (offset 54 lines).

patching file `src/game/World.cpp'

Hunk #1 succeeded at 61 (offset -1 lines).

Hunk #2 FAILED at 95.

Hunk #3 succeeded at 851 (offset -235 lines).

Hunk #4 succeeded at 1516 with fuzz 2 (offset 16 lines).

Hunk #5 succeeded at 1423 with fuzz 1 (offset -232 lines).

Hunk #6 succeeded at 2370 with fuzz 2 (offset 175 lines).

1 out of 6 hunks FAILED -- saving rejects to src/game/World.cpp.rej

patching file `src/game/World.h'

Hunk #2 FAILED at 223.

Hunk #3 succeeded at 356 (offset 15 lines).

Hunk #4 succeeded at 632 (offset 21 lines).

1 out of 4 hunks FAILED -- saving rejects to src/game/World.h.rej

patching file `src/mangosd/mangosd.conf.dist.in'

patch unexpectedly ends in middle of line

patch: **** malformed patch at line 197:

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 106
  • Created
  • Last Reply

Top Posters In This Topic

I 've conflicts :

CONFLICT (content): Merge conflict in src/game/World.cpp

Auto-merged src/game/World.h

CONFLICT (content): Merge conflict in src/game/World.h

Auto-merged src/mangosd/mangosd.conf.dist.in

CONFLICT (content): Merge conflict in src/mangosd/mangosd.conf.dist.in

Link to comment
Share on other sites

  • 2 weeks later...

Tryed to update for 9582:

diff --git a/sql/broadcast/mangos_mangos_string.sql b/sql/broadcast/mangos_mangos_string.sql
new file mode 100644
index 0000000..ff5dc4e
--- /dev/null
+++ b/sql/broadcast/mangos_mangos_string.sql
@@ -0,0 +1 @@
+INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES
(11000, '|cffffcc00[server]: |cff00ff00%s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
\\ No newline at end of file
diff --git a/sql/broadcast/realmd_broadcast_strings.sql b/sql/broadcast/realmd_broadcast_strings.sql
new file mode 100644
index 0000000..37b1813
--- /dev/null
+++ b/sql/broadcast/realmd_broadcast_strings.sql
@@ -0,0 +1,6 @@
+CREATE TABLE IF NOT EXISTS `broadcast_strings` (
+  `id` int(11) unsigned NOT NULL auto_increment,
+  `text` text NOT NULL,
+  `next` int(11) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
\\ No newline at end of file
diff --git a/src/game/Language.h b/src/game/Language.h
index 9f9f7af..857d6b9 100644
--- a/src/game/Language.h
+++ b/src/game/Language.h
@@ -832,6 +832,8 @@ enum MangosStrings
    //                                    10000-10999

    // Use for custom patches             11000-11999
+    // Broadcaster
+    LANG_AUTO_BROADCAST                 = 11000,

    // NOT RESERVED IDS                   12000-1999999999
    // `db_script_string` table index     2000000000-2000009999 (MIN_DB_SCRIPT_STRING_ID-MAX_DB_SCRIPT_STRING_ID)
diff --git a/src/game/World.cpp b/src/game/World.cpp
index ca23473..ab5edf4 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -61,6 +61,7 @@
#include "WaypointManager.h"
#include "GMTicketMgr.h"
#include "Util.h"
+#include "Language.h"

INSTANTIATE_SINGLETON_1( World );

@@ -94,6 +95,9 @@ World::World()

    m_defaultDbcLocale = LOCALE_enUS;
    m_availableDbcLocaleMask = 0;
+
+    // Initialize broadcaster nextId
+    m_nextId = 0;

   for(int i = 0; i < CONFIG_UINT32_VALUE_COUNT; ++i)
       m_configUint32Values[i] = 0;
@@ -848,6 +852,11 @@ void World::LoadConfigSettings(bool reload)
    sLog.outString( "WORLD: VMap support included. LineOfSight:%i, getHeight:%i",enableLOS, enableHeight);
    sLog.outString( "WORLD: VMap data directory is: %svmaps",m_dataPath.c_str());
    sLog.outString( "WORLD: VMap config keys are: vmap.enableLOS, vmap.enableHeight, vmap.ignoreMapIds, vmap.ignoreSpellIds");
+
+    // Broadcaster
+    setConfig(CONFIG_UINT32_BROADCAST_ENABLED, "Broadcast.Enabled", true);
+    setConfig(CONFIG_UINT32_BROADCAST_INTERVAL, "Broadcast.Interval", 150000);
+    setConfig(CONFIG_UINT32_BROADCAST_POSITION, "Broadcast.Position", 1);
}

/// Initialize the World
@@ -1274,6 +1283,9 @@ void World::SetInitialWorldSettings()
    uint32 nextGameEvent = sGameEventMgr.Initialize();
    m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent);    //depend on next event

+    sLog.outString("Starting Autobroadcast system..." );
+    m_timers[WUPDATE_BROADCAST].SetInterval(m_configUint32Values[CONFIG_UINT32_BROADCAST_INTERVAL]);
+
    sLog.outString( "WORLD: World initialized" );

    uint32 uStartInterval = getMSTimeDiff(uStartTime, getMSTime());
@@ -1429,6 +1441,13 @@ void World::Update(uint32 diff)
        m_timers[WUPDATE_EVENTS].Reset();
    }

+    ///- Process autobroadcaster
+    if(getConfig(CONFIG_UINT32_BROADCAST_ENABLED) && m_timers[WUPDATE_BROADCAST].Passed())
+    {
+        m_timers[WUPDATE_BROADCAST].Reset();
+        SendBroadcast();
+    }
+
    /// [/list]
    ///- Move all creatures with "delayed move" and remove and delete all objects with "delayed remove"
    sMapMgr.DoDelayedMovesAndRemoves();
@@ -1960,3 +1979,42 @@ void World::LoadDBVersion()
    if(m_CreatureEventAIVersion.empty())
        m_CreatureEventAIVersion = "Unknown creature EventAI.";
}
+
+/// Broadcast a message
+void World::SendBroadcast()
+{
+    std::string message;
+
+    QueryResult *result;
+    if(m_nextId > 0)
+        result = loginDatabase.PQuery("SELECT `text`, `next` FROM `broadcast_strings` WHERE `id` = %u;", m_nextId);
+    else
+        result = loginDatabase.PQuery("SELECT `text`, `next` FROM `broadcast_strings` ORDER BY RAND();", m_nextId);
+
+    if(!result)
+        return;
+
+    Field *fields = result->Fetch();
+    m_nextId  = fields[1].GetUInt32();
+    message = fields[0].GetString();
+
+    delete result, fields;
+
+    if((getConfig(CONFIG_UINT32_BROADCAST_POSITION) & BROADCAST_LOCATION_CHAT) == BROADCAST_LOCATION_CHAT)
+        sWorld.SendWorldText(LANG_AUTO_BROADCAST, message.c_str());
+    if((getConfig(CONFIG_UINT32_BROADCAST_POSITION) & BROADCAST_LOCATION_TOP) == BROADCAST_LOCATION_TOP)
+    {
+        WorldPacket data(SMSG_NOTIFICATION, (message.size()+1));
+        data << message;
+        sWorld.SendGlobalMessage(&data);
+    }
+
+    if((getConfig(CONFIG_UINT32_BROADCAST_POSITION) & BROADCAST_LOCATION_IRC) == BROADCAST_LOCATION_IRC)
+#ifdef MANGCHAT_INSTALLED
+        sIRC.Send_IRC_Channel(sIRC._irc_chan[sIRC.anchn].c_str(), "\\00311[server]: " + message);
+#else
+        sLog.outError("AutoBroadcaster: You have IRC broadcasting enabled but we couldn't detect mangchat");
+#endif
+
+    sLog.outString("AutoBroadcast: '%s'",message.c_str());
+}
\\ No newline at end of file
diff --git a/src/game/World.h b/src/game/World.h
index 170fc2a..12e20bd 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -77,7 +77,8 @@ enum WorldTimers
    WUPDATE_UPTIME      = 4,
    WUPDATE_CORPSES     = 5,
    WUPDATE_EVENTS      = 6,
-    WUPDATE_COUNT       = 7
+    WUPDATE_BROADCAST   = 7,
+    WUPDATE_COUNT       = 8
};

/// Configuration elements
@@ -173,6 +174,12 @@ enum WorldConfigs
    CONFIG_UINT32_TIMERBAR_BREATH_MAX,
    CONFIG_UINT32_TIMERBAR_FIRE_GMLEVEL,
    CONFIG_UINT32_TIMERBAR_FIRE_MAX,
+  
+    // Broadcaster
+    CONFIG_UINT32_BROADCAST_ENABLED,
+    CONFIG_UINT32_BROADCAST_INTERVAL,
+    CONFIG_UINT32_BROADCAST_POSITION,
+  
    CONFIG_UINT32_VALUE_COUNT
};

@@ -351,6 +358,13 @@ enum RealmZone
    REALM_ZONE_CN9           = 29                           // basic-Latin at create, any at login
};

+enum BroadcastLocation
+{
+    BROADCAST_LOCATION_CHAT = 1,
+    BROADCAST_LOCATION_TOP = 2,
+    BROADCAST_LOCATION_IRC = 4,
+};
+
// DB scripting commands
#define SCRIPT_COMMAND_TALK                  0              // source = unit, target=any, datalong ( 0=say, 1=whisper, 2=yell, 3=emote text)
#define SCRIPT_COMMAND_EMOTE                 1              // source = unit, datalong = anim_id
@@ -642,6 +656,10 @@ class World
        std::string m_DBVersion;
        std::string m_CreatureEventAIVersion;
        std::string m_ScriptsVersion;
+
+        //Broadcaster
+        uint32 m_nextId;
+        void SendBroadcast();
};

extern uint32 realmID;

This worked so far, but the last part giving merge conflicts, althought i just copied it out of Git gui *confused*

diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in
index f4abaa1..78470ae 100644
--- a/src/mangosd/mangosd.conf.dist.in
+++ b/src/mangosd/mangosd.conf.dist.in
@@ -1423,3 +1423,25 @@ SOAP.Enabled = 0
SOAP.IP = 127.0.0.1
SOAP.Port = 7878

+###################################################################################################################
+# Automatic Broadcaster
+#
+#    AutoBroadcast.Enabled
+#        Enable/Disable the broadcaster
+#        Default: 0 - off
+#                 1 - on
+#
+#    AutoBroadcast.Position
+#        Where to display the message (Just add the values for multiple)
+#        Default: 1 - In the in-game chat window
+#                 2 - In the top-middle of the screen
+#                 4 - In the announcements IRC channel (if mangchat is installed)
+#
+#    AutoBroadcast.Interval
+#        Interval at which to broadcast messages in miliseconds
+#
+###################################################################################################################
+
+Broadcast.Enabled = 1
+Broadcast.Position = 1
+Broadcast.Interval = 1800000

Maybe you guys can help out.

Link to comment
Share on other sites

Ok f**cking edit funktion takes ages for loading. Someone should really fix it -.-

I have solved the merge conflicts, some stupic whitespaces...

Tested on 9591. Enjoy!

diff --git a/sql/broadcast/mangos_mangos_string.sql b/sql/broadcast/mangos_mangos_string.sql
new file mode 100644
index 0000000..ff5dc4e
--- /dev/null
+++ b/sql/broadcast/mangos_mangos_string.sql
@@ -0,0 +1 @@
+INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES
(11000, '|cffffcc00[server]: |cff00ff00%s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
\\ No newline at end of file
diff --git a/sql/broadcast/realmd_broadcast_strings.sql b/sql/broadcast/realmd_broadcast_strings.sql
new file mode 100644
index 0000000..37b1813
--- /dev/null
+++ b/sql/broadcast/realmd_broadcast_strings.sql
@@ -0,0 +1,6 @@
+CREATE TABLE IF NOT EXISTS `broadcast_strings` (
+  `id` int(11) unsigned NOT NULL auto_increment,
+  `text` text NOT NULL,
+  `next` int(11) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
\\ No newline at end of file
diff --git a/src/game/Language.h b/src/game/Language.h
index 9f9f7af..857d6b9 100644
--- a/src/game/Language.h
+++ b/src/game/Language.h
@@ -832,6 +832,8 @@ enum MangosStrings
    //                                    10000-10999

    // Use for custom patches             11000-11999
+    // Broadcaster
+    LANG_AUTO_BROADCAST                 = 11000,

    // NOT RESERVED IDS                   12000-1999999999
    // `db_script_string` table index     2000000000-2000009999 (MIN_DB_SCRIPT_STRING_ID-MAX_DB_SCRIPT_STRING_ID)
diff --git a/src/game/World.cpp b/src/game/World.cpp
index ca23473..ab5edf4 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -61,6 +61,7 @@
#include "WaypointManager.h"
#include "GMTicketMgr.h"
#include "Util.h"
+#include "Language.h"

INSTANTIATE_SINGLETON_1( World );

@@ -94,6 +95,9 @@ World::World()

    m_defaultDbcLocale = LOCALE_enUS;
    m_availableDbcLocaleMask = 0;
+
+    // Initialize broadcaster nextId
+    m_nextId = 0;

   for(int i = 0; i < CONFIG_UINT32_VALUE_COUNT; ++i)
       m_configUint32Values[i] = 0;
@@ -848,6 +852,11 @@ void World::LoadConfigSettings(bool reload)
    sLog.outString( "WORLD: VMap support included. LineOfSight:%i, getHeight:%i",enableLOS, enableHeight);
    sLog.outString( "WORLD: VMap data directory is: %svmaps",m_dataPath.c_str());
    sLog.outString( "WORLD: VMap config keys are: vmap.enableLOS, vmap.enableHeight, vmap.ignoreMapIds, vmap.ignoreSpellIds");
+
+    // Broadcaster
+    setConfig(CONFIG_UINT32_BROADCAST_ENABLED, "Broadcast.Enabled", true);
+    setConfig(CONFIG_UINT32_BROADCAST_INTERVAL, "Broadcast.Interval", 150000);
+    setConfig(CONFIG_UINT32_BROADCAST_POSITION, "Broadcast.Position", 1);
}

/// Initialize the World
@@ -1274,6 +1283,9 @@ void World::SetInitialWorldSettings()
    uint32 nextGameEvent = sGameEventMgr.Initialize();
    m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent);    //depend on next event

+    sLog.outString("Starting Autobroadcast system..." );
+    m_timers[WUPDATE_BROADCAST].SetInterval(m_configUint32Values[CONFIG_UINT32_BROADCAST_INTERVAL]);
+
    sLog.outString( "WORLD: World initialized" );

    uint32 uStartInterval = getMSTimeDiff(uStartTime, getMSTime());
@@ -1429,6 +1441,13 @@ void World::Update(uint32 diff)
        m_timers[WUPDATE_EVENTS].Reset();
    }

+    ///- Process autobroadcaster
+    if(getConfig(CONFIG_UINT32_BROADCAST_ENABLED) && m_timers[WUPDATE_BROADCAST].Passed())
+    {
+        m_timers[WUPDATE_BROADCAST].Reset();
+        SendBroadcast();
+    }
+
    /// [/list]
    ///- Move all creatures with "delayed move" and remove and delete all objects with "delayed remove"
    sMapMgr.DoDelayedMovesAndRemoves();
@@ -1960,3 +1979,42 @@ void World::LoadDBVersion()
    if(m_CreatureEventAIVersion.empty())
        m_CreatureEventAIVersion = "Unknown creature EventAI.";
}
+
+/// Broadcast a message
+void World::SendBroadcast()
+{
+    std::string message;
+
+    QueryResult *result;
+    if(m_nextId > 0)
+        result = loginDatabase.PQuery("SELECT `text`, `next` FROM `broadcast_strings` WHERE `id` = %u;", m_nextId);
+    else
+        result = loginDatabase.PQuery("SELECT `text`, `next` FROM `broadcast_strings` ORDER BY RAND();", m_nextId);
+
+    if(!result)
+        return;
+
+    Field *fields = result->Fetch();
+    m_nextId  = fields[1].GetUInt32();
+    message = fields[0].GetString();
+
+    delete result, fields;
+
+    if((getConfig(CONFIG_UINT32_BROADCAST_POSITION) & BROADCAST_LOCATION_CHAT) == BROADCAST_LOCATION_CHAT)
+        sWorld.SendWorldText(LANG_AUTO_BROADCAST, message.c_str());
+    if((getConfig(CONFIG_UINT32_BROADCAST_POSITION) & BROADCAST_LOCATION_TOP) == BROADCAST_LOCATION_TOP)
+    {
+        WorldPacket data(SMSG_NOTIFICATION, (message.size()+1));
+        data << message;
+        sWorld.SendGlobalMessage(&data);
+    }
+
+    if((getConfig(CONFIG_UINT32_BROADCAST_POSITION) & BROADCAST_LOCATION_IRC) == BROADCAST_LOCATION_IRC)
+#ifdef MANGCHAT_INSTALLED
+        sIRC.Send_IRC_Channel(sIRC._irc_chan[sIRC.anchn].c_str(), "\\00311[server]: " + message);
+#else
+        sLog.outError("AutoBroadcaster: You have IRC broadcasting enabled but we couldn't detect mangchat");
+#endif
+
+    sLog.outString("AutoBroadcast: '%s'",message.c_str());
+}
\\ No newline at end of file
diff --git a/src/game/World.h b/src/game/World.h
index 170fc2a..12e20bd 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -77,7 +77,8 @@ enum WorldTimers
    WUPDATE_UPTIME      = 4,
    WUPDATE_CORPSES     = 5,
    WUPDATE_EVENTS      = 6,
-    WUPDATE_COUNT       = 7
+    WUPDATE_BROADCAST   = 7,
+    WUPDATE_COUNT       = 8
};

/// Configuration elements
@@ -173,6 +174,12 @@ enum eConfigUint32Values
    CONFIG_UINT32_TIMERBAR_BREATH_MAX,
    CONFIG_UINT32_TIMERBAR_FIRE_GMLEVEL,
    CONFIG_UINT32_TIMERBAR_FIRE_MAX,
+  
+    // Broadcaster
+    CONFIG_UINT32_BROADCAST_ENABLED,
+    CONFIG_UINT32_BROADCAST_INTERVAL,
+    CONFIG_UINT32_BROADCAST_POSITION,
+  
    CONFIG_UINT32_VALUE_COUNT
};

@@ -351,6 +358,13 @@ enum RealmZone
    REALM_ZONE_CN9           = 29                           // basic-Latin at create, any at login
};

+enum BroadcastLocation
+{
+    BROADCAST_LOCATION_CHAT = 1,
+    BROADCAST_LOCATION_TOP = 2,
+    BROADCAST_LOCATION_IRC = 4,
+};
+
// DB scripting commands
#define SCRIPT_COMMAND_TALK                  0              // source = unit, target=any, datalong ( 0=say, 1=whisper, 2=yell, 3=emote text)
#define SCRIPT_COMMAND_EMOTE                 1              // source = unit, datalong = anim_id
@@ -642,6 +656,10 @@ class World
        std::string m_DBVersion;
        std::string m_CreatureEventAIVersion;
        std::string m_ScriptsVersion;
+
+        //Broadcaster
+        uint32 m_nextId;
+        void SendBroadcast();
};

extern uint32 realmID;
diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in
index f4abaa1..78470ae 100644
--- a/src/mangosd/mangosd.conf.dist.in
+++ b/src/mangosd/mangosd.conf.dist.in
@@ -1423,3 +1423,25 @@ SOAP.Enabled = 0
SOAP.IP = 127.0.0.1
SOAP.Port = 7878

+###################################################################################################################
+# Automatic Broadcaster
+#
+#    AutoBroadcast.Enabled
+#        Enable/Disable the broadcaster
+#        Default: 0 - off
+#                 1 - on
+#
+#    AutoBroadcast.Position
+#        Where to display the message (Just add the values for multiple)
+#        Default: 1 - In the in-game chat window
+#                 2 - In the top-middle of the screen
+#                 4 - In the announcements IRC channel (if mangchat is installed)
+#
+#    AutoBroadcast.Interval
+#        Interval at which to broadcast messages in miliseconds
+#
+###################################################################################################################
+
+Broadcast.Enabled = 1
+Broadcast.Position = 1
+Broadcast.Interval = 1800000

Link to comment
Share on other sites

$ patch -p1 < anouncer.patch

patching file `sql/broadcast/mangos_mangos_string.sql'

patching file `sql/broadcast/realmd_broadcast_strings.sql'

patching file `src/game/Language.h'

patching file `src/game/World.cpp'

Hunk #2 succeeded at 95 with fuzz 2.

Hunk #5 succeeded at 1441 with fuzz 1.

Hunk #6 succeeded at 2142 with fuzz 2 (offset 163 lines).

patching file `src/game/World.h'

patching file `src/mangosd/mangosd.conf.dist.in'

patch unexpectedly ends in middle of line

patch: **** malformed patch at line 214:

Link to comment
Share on other sites

Having problems using this with multiple realms. Runs fine on one, but the second one crashes immediately on finishing the startup sequence. I can't figure out for the life of me why. Using latest revision of MaNGOS (9610), Latest SD2 (1644) and broadcaster branch merged in.

Crash log I picked out, the rest are very similar to this also.

Revision: * * 9610 a4c9182f037522dead6253b4aaa6f2d2c6769463
Date 21:3:2010. Time 0:25 
//=====================================================
*** Hardware ***
Processor: Intel(R) Xeon(R) CPU           E5520  @ 2.27GHz
Number Of Processors: 1
Physical Memory: 523612 KB (Available: 93448 KB)
Commit Charge Limit: 1271152 KB

*** Operation System ***
Microsoft Windows Server 2003 Datacenter Edition Service Pack 2 (Version 5.2, Build 3790)

//=====================================================
Exception code: E06D7363 
Fault address:  7D4E237E 01:0001237E C:\\WINDOWS\\syswow64\\kernel32.dll

Registers:
EAX:09ADFC74
EBX:F5ACD030
ECX:00000000
EDX:00000002
ESI:09ADFCFC
EDI:008B3570
CS:EIP:F0023:7D4E237E
SS:ESP:F5AA002B:09ADFC70  EBP:09ADFCC4
DS:9AD002B  ES:F5AA002B  FS:F5AA0053  GS:F5AA002B
Flags:00000206

Call stack:
Address   Frame     Function      SourceFile
7D4E237E  00000000  RaiseException+4E
7857DBF9  00000000  

Second try, a little later, after changing the announce timer from 300000 ms (5mins) to 600000ms (10mins, same as my other realm), I get this:

Revision: * * 9610 a4c9182f037522dead6253b4aaa6f2d2c6769463
Date 21:3:2010. Time 0:39 
//=====================================================
*** Hardware ***
Processor: Intel(R) Xeon(R) CPU           E5520  @ 2.27GHz
Number Of Processors: 1
Physical Memory: 523612 KB (Available: 43456 KB)
Commit Charge Limit: 1271152 KB

*** Operation System ***
Microsoft Windows Server 2003 Datacenter Edition Service Pack 2 (Version 5.2, Build 3790)

//=====================================================
Exception code: C0000005 ACCESS_VIOLATION
Fault address:  00990358 02:00056358 C:\\KaylithWoW\\Vidar\\mangosd.exe

Registers:
EAX:0093B408
EBX:F5ACD030
ECX:F5A44000
EDX:00990358
ESI:00000000
EDI:008B3570
CS:EIP:0023:00990358
SS:ESP:002B:09ADFD00  EBP:09ADFD74
DS:002B  ES:002B  FS:0053  GS:002B
Flags:00010202

Call stack:
Address   Frame     Function      SourceFile
00990358  00000000  ?full@barGoLink@@0QBDB+4A2C
0062AF90  00000000  ??0CreatureEventAI@@QAE@ABV0@@Z+5720
0045230E  00000000  ?getSource@?$Reference@V?$GridRefManager@VCorpse@@@@VCorpse@@@@QBEPAVCorpse@@XZ+3AB6E
008B3589  00000000  ?GetFloatDefault@Config@@QAEMPBDM@Z+DC9
003214D4  00000000  ?invoke@ACE_OS_Thread_Adapter@@UAEKXZ+74
78543433  00000000  _endthreadex+44
785434C7  00000000  _endthreadex+D8
7D4DFE37  00000000  FlsSetValue+13C

Call stack:
Address   Frame     Function      SourceFile
7D61C846  00000000  NtWaitForSingleObject+15
7D4D8C0D  00000000  WaitForSingleObject+12

Call stack:
Address   Frame     Function      SourceFile
7D61D06F  00000000  ZwWaitForMultipleObjects+15
7D63F9A8  00000000  RtlSetEnvironmentStrings+9A8
7D4DFE37  00000000  FlsSetValue+13C

Call stack:
Address   Frame     Function      SourceFile
7D61CCC6  00000000  NtDelayExecution+15
7D4D14EF  00000000  Sleep+F
008B37A0  00000000  ?GetFloatDefault@Config@@QAEMPBDM@Z+FE0
008B9970  00000000  ?step@barGoLink@@QAEXXZ+1E10
008B3589  00000000  ?GetFloatDefault@Config@@QAEMPBDM@Z+DC9
003214D4  00000000  ?invoke@ACE_OS_Thread_Adapter@@UAEKXZ+74
78543433  00000000  _endthreadex+44
785434C7  00000000  _endthreadex+D8
7D4DFE37  00000000  FlsSetValue+13C

Call stack:
Address   Frame     Function      SourceFile
7D61CCC6  00000000  NtDelayExecution+15
7D4D14EF  00000000  Sleep+F
008B37A0  00000000  ?GetFloatDefault@Config@@QAEMPBDM@Z+FE0
008B9970  00000000  ?step@barGoLink@@QAEXXZ+1E10
008B3589  00000000  ?GetFloatDefault@Config@@QAEMPBDM@Z+DC9
003214D4  00000000  ?invoke@ACE_OS_Thread_Adapter@@UAEKXZ+74
78543433  00000000  _endthreadex+44
785434C7  00000000  _endthreadex+D8
7D4DFE37  00000000  FlsSetValue+13C

Call stack:
Address   Frame     Function      SourceFile
7D61CCC6  00000000  NtDelayExecution+15
7D4D14EF  00000000  Sleep+F
008B37A0  00000000  ?GetFloatDefault@Config@@QAEMPBDM@Z+FE0
008B9970  00000000  ?step@barGoLink@@QAEXXZ+1E10
008B3589  00000000  ?GetFloatDefault@Config@@QAEMPBDM@Z+DC9
003214D4  00000000  ?invoke@ACE_OS_Thread_Adapter@@UAEKXZ+74
78543433  00000000  _endthreadex+44
785434C7  00000000  _endthreadex+D8
7D4DFE37  00000000  FlsSetValue+13C

Call stack:
Address   Frame     Function      SourceFile
7D61D6E4  00000000  NtGetContextThread+12
09ADED24  00000000  0000:00000000 
FF50D845  FFFFFFFF  

EDIT:

Some time later, I got this log, BUT, this was the second crash, the first one came up with: "R6025 - pure virtual function call" in the console, and did not create a crash log.

Revision: * * 9610 a4c9182f037522dead6253b4aaa6f2d2c6769463
Date 21:3:2010. Time 20:32 
//=====================================================
*** Hardware ***
Processor: Intel(R) Xeon(R) CPU           E5520  @ 2.27GHz
Number Of Processors: 1
Physical Memory: 523612 KB (Available: 125596 KB)
Commit Charge Limit: 1271152 KB

*** Operation System ***
Microsoft Windows Server 2003 Datacenter Edition Service Pack 2 (Version 5.2, Build 3790)

//=====================================================
Exception code: E06D7363 
Fault address:  7D4E237E 01:0001237E C:\\WINDOWS\\syswow64\\kernel32.dll

Registers:
EAX:09ADFC74
EBX:F5ACD030
ECX:00000000
EDX:00000002
ESI:09ADFCFC
EDI:008B3570
CS:EIP:F0023:7D4E237E
SS:ESP:F5AA002B:09ADFC70  EBP:09ADFCC4
DS:9AD002B  ES:F5AA002B  FS:F5AA0053  GS:F5AA002B
Flags:00000206

Call stack:
Address   Frame     Function      SourceFile

Link to comment
Share on other sites

I have a feature request. I would love it, if you could implement ingame commands, such as:

.bc list 'List all messages in the database'

.bc add 'Text ' 'Next Id'

.bc change 'Id' 'Text ' 'Next Id'

.bc remove 'Id'

.bc settime 'Set Interval in miliseconds'

.bc on/off

.bc say 'Id' - Immediantly say this message, not depend on timerinterval

This a lot i know, but you could pick the most important and add them one by one.

Thanks in advance.

Link to comment
Share on other sites

I have a feature request. I would love it, if you could implement ingame commands, such as:

.bc list 'List all messages in the database'

.bc add 'Text ' 'Next Id'

.bc change 'Id' 'Text ' 'Next Id'

.bc remove 'Id'

.bc settime 'Set Interval in miliseconds'

.bc on/off

.bc say 'Id' - Immediantly say this message, not depend on timerinterval

This a lot i know, but you could pick the most important and add them one by one.

Thanks in advance.

That would be a nice challenge, will look at it soon, just don't use the in-game commands all that often.

Having problems using this with multiple realms. Runs fine on one, but the second one crashes immediately on finishing the startup sequence. I can't figure out for the life of me why. Using latest revision of MaNGOS (9610), Latest SD2 (1644) and broadcaster branch merged in.

Crash log I picked out, the rest are very similar to this also.

Revision: * * 9610 a4c9182f037522dead6253b4aaa6f2d2c6769463
Date 21:3:2010. Time 0:25 
//=====================================================
*** Hardware ***
Processor: Intel(R) Xeon(R) CPU           E5520  @ 2.27GHz
Number Of Processors: 1
Physical Memory: 523612 KB (Available: 93448 KB)
Commit Charge Limit: 1271152 KB

*** Operation System ***
Microsoft Windows Server 2003 Datacenter Edition Service Pack 2 (Version 5.2, Build 3790)

//=====================================================
Exception code: E06D7363 
Fault address:  7D4E237E 01:0001237E C:\\WINDOWS\\syswow64\\kernel32.dll

Registers:
EAX:09ADFC74
EBX:F5ACD030
ECX:00000000
EDX:00000002
ESI:09ADFCFC
EDI:008B3570
CS:EIP:F0023:7D4E237E
SS:ESP:F5AA002B:09ADFC70  EBP:09ADFCC4
DS:9AD002B  ES:F5AA002B  FS:F5AA0053  GS:F5AA002B
Flags:00000206

Call stack:
Address   Frame     Function      SourceFile
7D4E237E  00000000  RaiseException+4E
7857DBF9  00000000  

Second try, a little later, after changing the announce timer from 300000 ms (5mins) to 600000ms (10mins, same as my other realm), I get this:

Revision: * * 9610 a4c9182f037522dead6253b4aaa6f2d2c6769463
Date 21:3:2010. Time 0:39 
//=====================================================
*** Hardware ***
Processor: Intel(R) Xeon(R) CPU           E5520  @ 2.27GHz
Number Of Processors: 1
Physical Memory: 523612 KB (Available: 43456 KB)
Commit Charge Limit: 1271152 KB

*** Operation System ***
Microsoft Windows Server 2003 Datacenter Edition Service Pack 2 (Version 5.2, Build 3790)

//=====================================================
Exception code: C0000005 ACCESS_VIOLATION
Fault address:  00990358 02:00056358 C:\\KaylithWoW\\Vidar\\mangosd.exe

Registers:
EAX:0093B408
EBX:F5ACD030
ECX:F5A44000
EDX:00990358
ESI:00000000
EDI:008B3570
CS:EIP:0023:00990358
SS:ESP:002B:09ADFD00  EBP:09ADFD74
DS:002B  ES:002B  FS:0053  GS:002B
Flags:00010202

Call stack:
Address   Frame     Function      SourceFile
00990358  00000000  ?full@barGoLink@@0QBDB+4A2C
0062AF90  00000000  ??0CreatureEventAI@@QAE@ABV0@@Z+5720
0045230E  00000000  ?getSource@?$Reference@V?$GridRefManager@VCorpse@@@@VCorpse@@@@QBEPAVCorpse@@XZ+3AB6E
008B3589  00000000  ?GetFloatDefault@Config@@QAEMPBDM@Z+DC9
003214D4  00000000  ?invoke@ACE_OS_Thread_Adapter@@UAEKXZ+74
78543433  00000000  _endthreadex+44
785434C7  00000000  _endthreadex+D8
7D4DFE37  00000000  FlsSetValue+13C

Call stack:
Address   Frame     Function      SourceFile
7D61C846  00000000  NtWaitForSingleObject+15
7D4D8C0D  00000000  WaitForSingleObject+12

Call stack:
Address   Frame     Function      SourceFile
7D61D06F  00000000  ZwWaitForMultipleObjects+15
7D63F9A8  00000000  RtlSetEnvironmentStrings+9A8
7D4DFE37  00000000  FlsSetValue+13C

Call stack:
Address   Frame     Function      SourceFile
7D61CCC6  00000000  NtDelayExecution+15
7D4D14EF  00000000  Sleep+F
008B37A0  00000000  ?GetFloatDefault@Config@@QAEMPBDM@Z+FE0
008B9970  00000000  ?step@barGoLink@@QAEXXZ+1E10
008B3589  00000000  ?GetFloatDefault@Config@@QAEMPBDM@Z+DC9
003214D4  00000000  ?invoke@ACE_OS_Thread_Adapter@@UAEKXZ+74
78543433  00000000  _endthreadex+44
785434C7  00000000  _endthreadex+D8
7D4DFE37  00000000  FlsSetValue+13C

Call stack:
Address   Frame     Function      SourceFile
7D61CCC6  00000000  NtDelayExecution+15
7D4D14EF  00000000  Sleep+F
008B37A0  00000000  ?GetFloatDefault@Config@@QAEMPBDM@Z+FE0
008B9970  00000000  ?step@barGoLink@@QAEXXZ+1E10
008B3589  00000000  ?GetFloatDefault@Config@@QAEMPBDM@Z+DC9
003214D4  00000000  ?invoke@ACE_OS_Thread_Adapter@@UAEKXZ+74
78543433  00000000  _endthreadex+44
785434C7  00000000  _endthreadex+D8
7D4DFE37  00000000  FlsSetValue+13C

Call stack:
Address   Frame     Function      SourceFile
7D61CCC6  00000000  NtDelayExecution+15
7D4D14EF  00000000  Sleep+F
008B37A0  00000000  ?GetFloatDefault@Config@@QAEMPBDM@Z+FE0
008B9970  00000000  ?step@barGoLink@@QAEXXZ+1E10
008B3589  00000000  ?GetFloatDefault@Config@@QAEMPBDM@Z+DC9
003214D4  00000000  ?invoke@ACE_OS_Thread_Adapter@@UAEKXZ+74
78543433  00000000  _endthreadex+44
785434C7  00000000  _endthreadex+D8
7D4DFE37  00000000  FlsSetValue+13C

Call stack:
Address   Frame     Function      SourceFile
7D61D6E4  00000000  NtGetContextThread+12
09ADED24  00000000  0000:00000000 
FF50D845  FFFFFFFF  

Please, help me, I'm lost. :(

And what happens if you stop the first realm and only run the second realm ?

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

[9723] Auto Announcer with NextID and MangChat support

diff --git a/sql/broadcast/mangos_mangos_string.sql b/sql/broadcast/mangos_mangos_string.sql
new file mode 100644
index 0000000..ff5dc4e
--- /dev/null
+++ b/sql/broadcast/mangos_mangos_string.sql
@@ -0,0 +1 @@
+INSERT INTO `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) VALUES
(11000, '|cffffcc00[server]: |cff00ff00%s|r', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
\\ No newline at end of file
diff --git a/sql/broadcast/realmd_broadcast_strings.sql b/sql/broadcast/realmd_broadcast_strings.sql
new file mode 100644
index 0000000..5f70aa4
--- /dev/null
+++ b/sql/broadcast/realmd_broadcast_strings.sql
@@ -0,0 +1,6 @@
+CREATE TABLE IF NOT EXISTS `broadcast_strings` (
+  `id` int(11) unsigned NOT NULL auto_increment,
+  `text` text NOT NULL,
+  `next` int(11) unsigned NOT NULL,
+  PRIMARY KEY  (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ;
\\ No newline at end of file
diff --git a/src/game/Language.h b/src/game/Language.h
index 2802c68..a505a47 100644
--- a/src/game/Language.h
+++ b/src/game/Language.h
@@ -834,6 +834,8 @@ enum MangosStrings
    //                                    10000-10999

    // Use for custom patches             11000-11999
+    // Broadcaster
+    LANG_AUTO_BROADCAST                 = 11000,

    // NOT RESERVED IDS                   12000-1999999999
    // `db_script_string` table index     2000000000-2000009999 (MIN_DB_SCRIPT_STRING_ID-MAX_DB_SCRIPT_STRING_ID)
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 6bf621c..0741e61 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -60,6 +60,7 @@
#include "WaypointManager.h"
#include "GMTicketMgr.h"
#include "Util.h"
+#include "Language.h"

INSTANTIATE_SINGLETON_1( World );

@@ -94,12 +95,14 @@ World::World()

    m_defaultDbcLocale = LOCALE_enUS;
    m_availableDbcLocaleMask = 0;
+    
+    // Initialize broadcaster nextId
+    m_nextId = 0;

    for(int i = 0; i < CONFIG_UINT32_VALUE_COUNT; ++i)
        m_configUint32Values[i] = 0;

    for(int i = 0; i < CONFIG_INT32_VALUE_COUNT; ++i)
-        m_configInt32Values[i] = 0;

    for(int i = 0; i < CONFIG_FLOAT_VALUE_COUNT; ++i)
        m_configFloatValues[i] = 0.0f;
@@ -854,6 +857,11 @@ void World::LoadConfigSettings(bool reload)
    sLog.outString( "WORLD: VMap support included. LineOfSight:%i, getHeight:%i",enableLOS, enableHeight);
    sLog.outString( "WORLD: VMap data directory is: %svmaps",m_dataPath.c_str());
    sLog.outString( "WORLD: VMap config keys are: vmap.enableLOS, vmap.enableHeight, vmap.ignoreMapIds, vmap.ignoreSpellIds");
+
+    // Broadcaster
+    setConfig(CONFIG_BOOL_BROADCAST_ENABLED     , "Broadcast.Enabled"   , false);
+    setConfig(CONFIG_UINT32_BROADCAST_INTERVAL  , "Broadcast.Interval"  , 60000);
+    setConfig(CONFIG_UINT32_BROADCAST_POSITION    , "Broadcast.Position"  , 1);
}

/// Initialize the World
@@ -1279,6 +1287,9 @@ void World::SetInitialWorldSettings()
    uint32 nextGameEvent = sGameEventMgr.Initialize();
    m_timers[WUPDATE_EVENTS].SetInterval(nextGameEvent);    //depend on next event

+    sLog.outString("Starting Autobroadcast system..." );
+    m_timers[WUPDATE_BROADCAST].SetInterval(m_configUint32Values[CONFIG_UINT32_BROADCAST_INTERVAL]);
+
    sLog.outString( "WORLD: World initialized" );

    uint32 uStartInterval = getMSTimeDiff(uStartTime, getMSTime());
@@ -1443,6 +1454,13 @@ void World::Update(uint32 diff)
        m_timers[WUPDATE_EVENTS].Reset();
    }

+    ///- Process autobroadcaster
+    if(getConfig(CONFIG_BOOL_BROADCAST_ENABLED) && m_timers[WUPDATE_BROADCAST].Passed())
+    {
+        m_timers[WUPDATE_BROADCAST].Reset();
+        SendBroadcast();
+    }
+
    /// [/list]
    ///- Move all creatures with "delayed move" and remove and delete all objects with "delayed remove"
    sMapMgr.RemoveAllObjectsInRemoveList();
@@ -2178,3 +2196,42 @@ bool World::configNoReload(bool reload, eConfigBoolValues index, char const* fie

    return false;
}
+
+// Broadcast a message
+void World::SendBroadcast()
+{
+    std::string message;
+
+    QueryResult *result;
+    if(m_nextId > 0)
+        result = loginDatabase.PQuery("SELECT `text`, `next` FROM `broadcast_strings` WHERE `id` = %u;", m_nextId);
+    else
+        result = loginDatabase.PQuery("SELECT `text`, `next` FROM `broadcast_strings` ORDER BY RAND();", m_nextId);
+
+    if(!result)
+        return;
+
+    Field *fields = result->Fetch();
+    m_nextId  = fields[1].GetUInt32();
+    message = fields[0].GetString();
+
+    delete result, fields;
+
+    if((getConfig(CONFIG_UINT32_BROADCAST_POSITION) & BROADCAST_LOCATION_CHAT) == BROADCAST_LOCATION_CHAT)
+        sWorld.SendWorldText(LANG_AUTO_BROADCAST, message.c_str());
+    if((getConfig(CONFIG_UINT32_BROADCAST_POSITION) & BROADCAST_LOCATION_TOP) == BROADCAST_LOCATION_TOP)
+    {
+        WorldPacket data(SMSG_NOTIFICATION, (message.size()+1));
+        data << message;
+        sWorld.SendGlobalMessage(&data);
+    }
+
+    if((getConfig(CONFIG_UINT32_BROADCAST_POSITION) & BROADCAST_LOCATION_IRC) == BROADCAST_LOCATION_IRC)
+#ifdef MANGCHAT_INSTALLED
+        sIRC.Send_IRC_Channel(sIRC._irc_chan[sIRC.anchn].c_str(), "\\00311[server]: " + message);
+#else
+        sLog.outError("AutoBroadcaster: You have IRC broadcasting enabled but we couldn't detect mangchat");
+#endif
+
+    sLog.outString("AutoBroadcast: '%s'",message.c_str());
+}
\\ No newline at end of file
diff --git a/src/game/World.h b/src/game/World.h
index a4e4f6f..f564451 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -77,7 +77,8 @@ enum WorldTimers
    WUPDATE_UPTIME      = 4,
    WUPDATE_CORPSES     = 5,
    WUPDATE_EVENTS      = 6,
-    WUPDATE_COUNT       = 7
+    WUPDATE_BROADCAST   = 7,
+    WUPDATE_COUNT       = 8
};

/// Configuration elements
@@ -176,6 +177,8 @@ enum eConfigUInt32Values
    CONFIG_UINT32_TIMERBAR_BREATH_MAX,
    CONFIG_UINT32_TIMERBAR_FIRE_GMLEVEL,
    CONFIG_UINT32_TIMERBAR_FIRE_MAX,
+    CONFIG_UINT32_BROADCAST_INTERVAL,  // Broadcaster
+    CONFIG_UINT32_BROADCAST_POSITION,  // Broadcaster
    CONFIG_UINT32_MIN_LEVEL_STAT_SAVE,
    CONFIG_UINT32_VALUE_COUNT
};
@@ -306,6 +309,7 @@ enum eConfigBoolValues
    CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_JOIN,
    CONFIG_BOOL_ARENA_QUEUE_ANNOUNCER_EXIT,
    CONFIG_BOOL_KICK_PLAYER_ON_BAD_PACKET,
+    CONFIG_BOOL_BROADCAST_ENABLED, // Broadcaster
    CONFIG_BOOL_STATS_SAVE_ONLY_ON_LOGOUT,
    CONFIG_BOOL_VALUE_COUNT
};
@@ -380,6 +384,13 @@ enum RealmZone
    REALM_ZONE_CN5_8         = 37                           // basic-Latin at create, any at login
};

+enum BroadcastLocation
+{
+    BROADCAST_LOCATION_CHAT = 1,
+    BROADCAST_LOCATION_TOP = 2,
+    BROADCAST_LOCATION_IRC = 4,
+};
+
// DB scripting commands
#define SCRIPT_COMMAND_TALK                  0              // source = unit, target=any, datalong ( 0=say, 1=whisper, 2=yell, 3=emote text)
#define SCRIPT_COMMAND_EMOTE                 1              // source = unit, datalong = anim_id
@@ -675,6 +686,10 @@ class World
        std::string m_DBVersion;
        std::string m_CreatureEventAIVersion;
        std::string m_ScriptsVersion;
+
+        //Broadcaster
+        uint32 m_nextId;
+        void SendBroadcast();
};

extern uint32 realmID;
diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in
index 5d4053f..7190fde 100644
--- a/src/mangosd/mangosd.conf.dist.in
+++ b/src/mangosd/mangosd.conf.dist.in
@@ -1451,3 +1451,26 @@ SOAP.Enabled = 0
SOAP.IP = 127.0.0.1
SOAP.Port = 7878

+###################################################################################################################
+# Automatic Broadcaster
+#
+#    Broadcast.Enabled
+#        Enable/Disable the broadcaster
+#        Default: 0 - off
+#                 1 - on
+#
+#    Broadcast.Position
+#        Where to display the message (Just add the values for multiple)
+#        Default: 1 - In the in-game chat window
+#                 2 - In the top-middle of the screen
+#                 4 - In the announcements IRC channel (if mangchat is installed)
+#
+#    Broadcast.Interval
+#        Interval at which to broadcast messages
+#
+###################################################################################################################
+
+Broadcast.Enabled = 1
+Broadcast.Position = 2
+Broadcast.Interval = 30000
+

Link to comment
Share on other sites

What I like about this core mod the most is the ability to broadcast a message at regular intervals when I need to notify everyone of some important tidbit of info, such as server/client updates. It's been so useful to me in the past that I consider it an important member in my short list of "must-have" additions to my server.

I know it's not considered to be like retail, but something this handy for administrators ought to at least be an option in mangosd.conf as a regular part of the core.

I hope you'll have a fresh update for it, once you have AHBot sorted out, xeross. :)

Link to comment
Share on other sites

AHBot is fixed and the only update we need is in-game command support (I prefer a web-based interface over that though).

And there's the multi-realm crash, does that still happen ?

Sorry, I've been away from my PC for some time, I haven't had a chance to try out the multi-realm issue again since. I've pulled the latest revision of the branch, and your patch doesn't apply now, mainly conflicts in world.h.

I'm useless with C++, so I've tried in vain to fix it, and quite obviously failed.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use