· 8 years ago · Apr 18, 2018, 03:28 PM
1diff --git a/configure.ac b/configure.ac
2index 7ccdd04..d80a1d9 100644
3--- a/configure.ac
4+++ b/configure.ac
5@@ -275,6 +275,8 @@ AC_CONFIG_FILES([
6 src/realmd/realmd.conf.dist
7 src/mangosd/Makefile
8 src/mangosd/mangosd.conf.dist
9+ src/mangosd/mangchat.conf.dist
10+ src/game/mangchat/IRCConf.h
11 src/bindings/Makefile
12 src/bindings/ScriptDev2/Makefile
13 src/bindings/ScriptDev2/scriptdev2.conf.dist
14diff --git a/sql/mangchat.sql b/sql/mangchat.sql
15new file mode 100644
16index 0000000..c826c97
17--- /dev/null
18+++ b/sql/mangchat.sql
19@@ -0,0 +1,75 @@
20+SET FOREIGN_KEY_CHECKS=0;
21+-- ----------------------------
22+-- Table structure for IRC_Commands
23+-- ----------------------------
24+DROP TABLE IF EXISTS `IRC_Commands`;
25+CREATE TABLE `IRC_Commands` (
26+ `Command` varchar(10) NOT NULL default '',
27+ `Description` varchar(150) NOT NULL default '',
28+ `gmlevel` tinyint(3) unsigned NOT NULL default '0',
29+ PRIMARY KEY (`Command`)
30+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='IRC Module System';
31+
32+-- ----------------------------
33+-- Records
34+-- ----------------------------
35+INSERT INTO `IRC_Commands` VALUES ('acct', '[acct <Player> <(un)lock/mail/pass/rename>] : Perform Action To <Player> Account.', '3');
36+INSERT INTO `IRC_Commands` VALUES ('ban', '[ban <Player/IP> <ip/acct/unban/reason>] : Ban/Unban <Player>', '3');
37+INSERT INTO `IRC_Commands` VALUES ('chan', '[chan <op/deop/voice/devoice> <*IRC Nick*>] : Set Mode On Yourself, If <IRC Nick> Is Specified Then Set mode On Nick.', '3');
38+INSERT INTO `IRC_Commands` VALUES ('char', '[char <Player> <mailcheat/taxicheat/maxskill/setskill>] : Perform Action To Character.', '3');
39+INSERT INTO `IRC_Commands` VALUES ('fun', '[fun <Player> <Sound/Say>] : Do Selected Fun Action To <Player>.', '3');
40+INSERT INTO `IRC_Commands` VALUES ('help', '[help Command] : Use No Paramaters For List Of Available Commands.', '0');
41+INSERT INTO `IRC_Commands` VALUES ('inchan', '[inchan <Channel>] : Display Users In Selected In Game <Channel>', '0');
42+INSERT INTO `IRC_Commands` VALUES ('info', '[info] : Display Server Info. (Number Of Players Online/Max Since Last Restart/Uptime)', '0');
43+INSERT INTO `IRC_Commands` VALUES ('item', '[item <Player> <add> <ItemID/[ItemName]> <Amount>] : Additem To <Player>, Use <ItemID> Or <[Exact Item Name]>.', '3');
44+INSERT INTO `IRC_Commands` VALUES ('jail', '[jail <Player> <release/Reason>] : Jail Selected <Player> For <Reason>. Using release As <Reason> Releases Player.', '3');
45+INSERT INTO `IRC_Commands` VALUES ('kick', '[kick <Player> <Reason>] : Kick <Player> For <Reason>.', '3');
46+INSERT INTO `IRC_Commands` VALUES ('kill', '[kill <Player> <Reason>] : Kill <Player> For <Reason>.', '3');
47+INSERT INTO `IRC_Commands` VALUES ('level', '[level <Player> <NewLevel>] : Level <Player> To <NewLevel>. *Can Be Done Offline*', '3');
48+INSERT INTO `IRC_Commands` VALUES ('lookup', '[lookup <acct/char/creature/faction/go/item/quest/skill/spell/tele> <ID/Name>] : ', '3');
49+INSERT INTO `IRC_Commands` VALUES ('login', '[login <UserName> <Password>] : Login To MangChat Admin Mode. (Must Be Done In A PM)', '0');
50+INSERT INTO `IRC_Commands` VALUES ('logout', '[logout] : Logout Of MangChat Admin Mode.', '0');
51+INSERT INTO `IRC_Commands` VALUES ('money', '[money <Player> <(-)Money>] : Give Money To <Player>, Use - To Take Money. *Can Be Done Offline*', '3');
52+INSERT INTO `IRC_Commands` VALUES ('mute', '[mute <Player> <release/TimeInMins> <Reason>] : Mute Player For Reason, For <TimeInMins>. Using release As Time Releases Player. *Can Be Done Offline*', '3');
53+INSERT INTO `IRC_Commands` VALUES ('online', '[online] : Display All Users Logged In Game.', '0');
54+INSERT INTO `IRC_Commands` VALUES ('pm', '[pm <Player> <Message>] : Whisper <Player> In WoW <Message>.', '3');
55+INSERT INTO `IRC_Commands` VALUES ('reload', '[reload] : Reload MangChat Config Options And Security Level From DataBase.', '3');
56+INSERT INTO `IRC_Commands` VALUES ('restart', '[restart] : Restart MangChat, NOT MaNGOS World Server Itself. Forces Reconnection To IRC Server.', '3');
57+INSERT INTO `IRC_Commands` VALUES ('revive', '[revive <Player>] : Revive <Player>.', '3');
58+INSERT INTO `IRC_Commands` VALUES ('saveall', '[saveall] : Forces MaNGOS To Save All Players.', '3');
59+INSERT INTO `IRC_Commands` VALUES ('shutdown', '[shutdown <TimeInSeconds>] : Shuts The Server Down In <TimeInSeconds>, Use 0 For Immediate Shut Down', '3');
60+INSERT INTO `IRC_Commands` VALUES ('spell', '[spell <Player> <Cast/Learn/UnLearn> <SpellID>] : Make <Player> <Learn> Or <UnLearn> A Spell, Or <Cast> A Spell On A <Player>.', '3');
61+INSERT INTO `IRC_Commands` VALUES ('sysmsg', '[sysmsg <a/n/e/add/del/list> <Message>] : Broadcasts A System Message. (a-Broadcast System Message)(n-Broadcast Notify Message)(e-Event Message)', '3');
62+INSERT INTO `IRC_Commands` VALUES ('tele', '[tele <Player> <l/c/r/to> <Loc.Name/MAPID X Y Z/Recall/Player>] : Teleport Player To Location, Coords, Or Another Player. (l-Location)(c-Coords)', '3');
63+INSERT INTO `IRC_Commands` VALUES ('top', '[top <accttime/chartime/money> <limit>] : Display top stats for given option. Only GM Higher Than Config Option Can Use Limit.', '3');
64+INSERT INTO `IRC_Commands` VALUES ('who', '[who] : Displays Users Currently Logged In To MangChat.', '1');
65+
66+SET FOREIGN_KEY_CHECKS=0;
67+-- ----------------------------
68+-- Table structure for IRC_Inchan
69+-- ----------------------------
70+DROP TABLE IF EXISTS `IRC_Inchan`;
71+CREATE TABLE `IRC_Inchan` (
72+ `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier',
73+ `name` varchar(12) NOT NULL default '',
74+ `channel` varchar(15) NOT NULL default '',
75+ PRIMARY KEY (`guid`,`channel`)
76+) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='IRC Module System';
77+
78+SET FOREIGN_KEY_CHECKS=0;
79+-- ----------------------------
80+-- Table structure for IRC_AutoAnnounce
81+-- ----------------------------
82+DROP TABLE IF EXISTS `IRC_AutoAnnounce`;
83+CREATE TABLE `IRC_AutoAnnounce` (
84+ `id` int(11) NOT NULL AUTO_INCREMENT,
85+ `message` longtext NOT NULL,
86+ `addedby` varchar(12) NOT NULL default '',
87+ PRIMARY KEY (`id`)
88+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='IRC Module System';
89+
90+
91+INSERT INTO mangos_string
92+ (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`)
93+VALUES
94+ (3000, '|cffff0000[Server Announcement]: %s|r', '', '', '', '', '', '', '', '');
95\ No newline at end of file
96diff --git a/src/game/AuctionHouseHandler.cpp b/src/game/AuctionHouseHandler.cpp
97index e99fd76..80ff642 100644
98--- a/src/game/AuctionHouseHandler.cpp
99+++ b/src/game/AuctionHouseHandler.cpp
100@@ -27,6 +27,7 @@
101 #include "AuctionHouseMgr.h"
102 #include "Util.h"
103 #include "AuctionHouseBot.h"
104+#include "mangchat/IRCClient.h"
105
106 //please DO NOT use iterator++, because it is slower than ++iterator!!!
107 //post-incrementation is always slower than pre-incrementation !
108@@ -272,6 +273,9 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
109 pl->SaveInventoryAndGoldToDB();
110 CharacterDatabase.CommitTransaction();
111
112+ if((sIRC.BOTMASK & 1024) != 0)
113+ sIRC.AHFunc(it->GetEntry(), it->GetProto()->Name1, pl->GetName());
114+
115 SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, AUCTION_OK);
116 }
117
118diff --git a/src/game/Channel.cpp b/src/game/Channel.cpp
119index e0fca88..0b1183f 100644
120--- a/src/game/Channel.cpp
121+++ b/src/game/Channel.cpp
122@@ -20,6 +20,7 @@
123 #include "ObjectMgr.h"
124 #include "World.h"
125 #include "SocialMgr.h"
126+#include "mangchat/IRCClient.h"
127
128 Channel::Channel(const std::string& name, uint32 channel_id)
129 : m_announce(true), m_moderate(false), m_name(name), m_flags(0), m_channelId(channel_id), m_ownerGUID(0)
130@@ -112,14 +113,9 @@ void Channel::Join(uint64 p, const char *pass)
131 MakeYouJoined(&data);
132 SendToOne(&data, p);
133
134+ sIRC.Handle_WoW_Channel(m_name, objmgr.GetPlayer(p), CHANNEL_JOIN);
135 JoinNotify(p);
136
137- // if no owner first logged will become
138- if(!IsConstant() && !m_ownerGUID)
139- {
140- SetOwner(p, (players.size() > 1 ? true : false));
141- players[p].SetModerator(true);
142- }
143 }
144
145 void Channel::Leave(uint64 p, bool send)
146@@ -159,6 +155,7 @@ void Channel::Leave(uint64 p, bool send)
147
148 LeaveNotify(p);
149
150+ sIRC.Handle_WoW_Channel(m_name, objmgr.GetPlayer(p), CHANNEL_LEAVE);
151 if(changeowner)
152 {
153 uint64 newowner = !players.empty() ? players.begin()->second.player : 0;
154diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
155index 0714cf6..7a5e648 100644
156--- a/src/game/Chat.cpp
157+++ b/src/game/Chat.cpp
158@@ -652,7 +652,8 @@ ChatCommand * ChatHandler::getCommandTable()
159 { "flusharenapoints",SEC_ADMINISTRATOR, false, &ChatHandler::HandleFlushArenaPointsCommand, "", NULL },
160 { "repairitems", SEC_GAMEMASTER, true, &ChatHandler::HandleRepairitemsCommand, "", NULL },
161 { "waterwalk", SEC_GAMEMASTER, false, &ChatHandler::HandleWaterwalkCommand, "", NULL },
162-
163+ { "ircpm", SEC_PLAYER, false, &ChatHandler::HandleIRCpmCommand, "", NULL },
164+
165 { NULL, 0, false, NULL, "", NULL }
166 };
167
168diff --git a/src/game/Chat.h b/src/game/Chat.h
169index ea9ff81..616e17b 100644
170--- a/src/game/Chat.h
171+++ b/src/game/Chat.h
172@@ -490,6 +490,7 @@ class ChatHandler
173 bool HandleFlushArenaPointsCommand(const char *args);
174 bool HandleRepairitemsCommand(const char* args);
175 bool HandleWaterwalkCommand(const char* args);
176+ bool HandleIRCpmCommand(const char* args);
177
178 //! Development Commands
179 bool HandleSaveAllCommand(const char* args);
180diff --git a/src/game/ChatHandler.cpp b/src/game/ChatHandler.cpp
181index edd647e..556d827 100644
182--- a/src/game/ChatHandler.cpp
183+++ b/src/game/ChatHandler.cpp
184@@ -33,6 +33,7 @@
185 #include "Player.h"
186 #include "SpellAuras.h"
187 #include "Language.h"
188+#include "mangchat/IRCClient.h"
189 #include "Util.h"
190 #include "GridNotifiersImpl.h"
191 #include "CellImpl.h"
192@@ -441,6 +442,8 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
193 if(msg.empty())
194 break;
195
196+ sIRC.Send_WoW_IRC(_player, channel, msg);
197+
198 if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
199 {
200 if(Channel *chn = cMgr->GetChannel(channel,_player))
201diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h
202index b7ea272..5012851 100644
203--- a/src/game/DBCStructure.h
204+++ b/src/game/DBCStructure.h
205@@ -620,7 +620,7 @@ struct ChrClassesEntry
206 // 1, unused
207 uint32 powerType; // 2
208 // 3-4, unused
209- //char* name[16]; // 5-20 unused
210+ char* name[16]; // 5-20 unused
211 // 21 string flag, unused
212 //char* nameFemale[16]; // 21-36 unused, if different from base (male) case
213 // 37 string flag, unused
214diff --git a/src/game/DBCfmt.h b/src/game/DBCfmt.h
215index da26a14..c40b61d 100644
216--- a/src/game/DBCfmt.h
217+++ b/src/game/DBCfmt.h
218@@ -32,7 +32,7 @@ const char CharStartOutfitEntryfmt[]="diiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxx
219 const char CharTitlesEntryfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi";
220 const char ChatChannelsEntryfmt[]="iixssssssssssssssssxxxxxxxxxxxxxxxxxx";
221 // ChatChannelsEntryfmt, index not used (more compact store)
222-const char ChrClassesEntryfmt[]="nxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixii";
223+const char ChrClassesEntryfmt[]="nxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixii";
224 const char ChrRacesEntryfmt[]="nxixiixxixxxxissssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi";
225 const char CinematicSequencesEntryfmt[]="nxxxxxxxxx";
226 const char CreatureDisplayInfofmt[]="nxxxfxxxxxxxxxxx";
227diff --git a/src/game/GMTicketHandler.cpp b/src/game/GMTicketHandler.cpp
228index ffdfae5..c378aa7 100644
229--- a/src/game/GMTicketHandler.cpp
230+++ b/src/game/GMTicketHandler.cpp
231@@ -24,6 +24,7 @@
232 #include "ObjectAccessor.h"
233 #include "Player.h"
234 #include "Chat.h"
235+#include "mangchat/IRCClient.h"
236
237 void WorldSession::SendGMTicketGetTicket(uint32 status, char const* text)
238 {
239@@ -77,6 +78,16 @@ void WorldSession::HandleGMTicketDeleteTicketOpcode( WorldPacket & /*recv_data*/
240 SendPacket( &data );
241
242 SendGMTicketGetTicket(0x0A, 0);
243+
244+ std::string msg; // Start addition of IRC handling for GM Ticket
245+ msg = GetPlayer()->GetName();
246+ std::string str = "|cffff0000[GM Ticket]:|r";
247+ str += msg;
248+ std::string ircchan = "#";
249+ ircchan += sIRC._irc_chan[sIRC.Status].c_str();
250+ sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 GM Ticket Deleted For:\00304,08\037/!\\\037\017 %s", "%s", msg.c_str()), true);
251+ // End of IRC handling
252+
253 }
254
255 void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data )
256@@ -121,6 +132,16 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data )
257 if(itr->second->GetSession()->GetSecurity() >= SEC_GAMEMASTER && itr->second->isAcceptTickets())
258 ChatHandler(itr->second).PSendSysMessage(LANG_COMMAND_TICKETNEW,GetPlayer()->GetName());
259 }
260+ std::string msg; // Start addition of IRC handling for GM Ticket
261+ std::string msg2;
262+ msg = GetPlayer()->GetName();
263+ msg2 = ticketText;
264+ std::string str = "|cffff0000[GM Ticket]:|r";
265+ str += msg;
266+ std::string ircchan = "#";
267+ ircchan += sIRC._irc_chan[sIRC.Status].c_str();
268+ sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 New GM Ticket from:\00304,08\037/!\\\037\017 %s", "%s", msg.c_str()), true);
269+ sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 Ticket Details:\00304,08\037/!\\\037\017 %s", "%s", msg2.c_str()), true);// End of IRC handling
270 }
271
272 void WorldSession::HandleGMTicketSystemStatusOpcode( WorldPacket & /*recv_data*/ )
273diff --git a/src/game/GMTicketMgr.cpp b/src/game/GMTicketMgr.cpp
274index 621c18b..d199724 100644
275--- a/src/game/GMTicketMgr.cpp
276+++ b/src/game/GMTicketMgr.cpp
277@@ -25,6 +25,7 @@
278 #include "Policies/SingletonImp.h"
279 #include "Player.h"
280 #include "ObjectDefines.h"
281+#include "mangchat/IRCClient.h"
282
283 INSTANTIATE_SINGLETON_1(GMTicketMgr);
284
285@@ -77,4 +78,13 @@ void GMTicketMgr::DeleteAll()
286 }
287 CharacterDatabase.PExecute("DELETE FROM character_ticket");
288 m_GMTicketMap.clear();
289+
290+ std::string msg; // Start addition of IRC handling for GM Ticket
291+ msg = "";
292+ std::string str = "|cffff0000[All Tickets Deleted]:|r";
293+ str += msg;
294+ std::string ircchan = "#";
295+ ircchan += sIRC._irc_chan[sIRC.Status].c_str();
296+ sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 All Tickets Deleted\00304,08\037/!\\\037\017 %s", "%s", msg.c_str()), true); // End of IRC handling
297+
298 }
299diff --git a/src/game/GameEventMgr.cpp b/src/game/GameEventMgr.cpp
300index 2ff2f92..254743c 100644
301--- a/src/game/GameEventMgr.cpp
302+++ b/src/game/GameEventMgr.cpp
303@@ -25,6 +25,7 @@
304 #include "Log.h"
305 #include "MapManager.h"
306 #include "Policies/SingletonImp.h"
307+#include "mangchat/IRCClient.h"
308
309 INSTANTIATE_SINGLETON_1(GameEventMgr);
310
311@@ -486,7 +487,13 @@ void GameEventMgr::ApplyNewEvent(uint16 event_id)
312 break;
313 case 1: // announce events
314 sWorld.SendWorldText(LANG_EVENTMESSAGE, mGameEvent[event_id].description.c_str());
315- break;
316+ if((sIRC.BOTMASK & 256) != 0)
317+ {
318+ std::string ircchan = "#";
319+ ircchan += sIRC._irc_chan[sIRC.anchn].c_str();
320+ sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 Game Event \00304,08\037/!\\\037\017 %s", "%s", mGameEvent[event_id].description.c_str()), true);
321+ }
322+ break;
323 }
324
325 sLog.outString("GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str());
326diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp
327index ceff91a..7eee58d 100644
328--- a/src/game/Level1.cpp
329+++ b/src/game/Level1.cpp
330@@ -32,6 +32,7 @@
331 #include "CellImpl.h"
332 #include "InstanceSaveMgr.h"
333 #include "Util.h"
334+#include "mangchat/IRCClient.h"
335 #ifdef _DEBUG_VMAPS
336 #include "VMapFactory.h"
337 #endif
338@@ -129,7 +130,15 @@ bool ChatHandler::HandleAnnounceCommand(const char* args)
339 return false;
340
341 sWorld.SendWorldText(LANG_SYSTEMMESSAGE,args);
342- return true;
343+
344+ if((sIRC.BOTMASK & 256) != 0)
345+ {
346+ std::string ircchan = "#";
347+ ircchan += sIRC._irc_chan[sIRC.anchn].c_str();
348+ sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 System Message \00304,08\037/!\\\037\017 %s", "%s", args), true);
349+ }
350+
351+ return true;
352 }
353
354 //notification player at the screen
355@@ -145,7 +154,14 @@ bool ChatHandler::HandleNotifyCommand(const char* args)
356 data << str;
357 sWorld.SendGlobalMessage(&data);
358
359- return true;
360+ if((sIRC.BOTMASK & 256) != 0)
361+ {
362+ std::string ircchan = "#";
363+ ircchan += sIRC._irc_chan[sIRC.anchn].c_str();
364+ sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 Global Notify \00304,08\037/!\\\037\017 %s", "%s", args), true);
365+ }
366+
367+ return true;
368 }
369
370 //Enable\Dissable GM Mode
371@@ -2525,3 +2541,20 @@ bool ChatHandler::HandleModifyDrunkCommand(const char* args)
372
373 return true;
374 }
375+bool ChatHandler::HandleIRCpmCommand(const char* args)
376+{
377+ std::string Msg = args;
378+ if (Msg.find(" ") == std::string::npos)
379+ return false;
380+ std::string To = Msg.substr(0, Msg.find(" "));
381+ Msg = Msg.substr(Msg.find(" ") + 1);
382+ std::size_t pos;
383+ while((pos = To.find("||")) != std::string::npos)
384+ {
385+ std::size_t find1 = To.find("||", pos);
386+ To.replace(pos, find1 - pos + 2, "|");
387+ }
388+ sIRC.SendIRC("PRIVMSG "+To+" : <WoW>["+m_session->GetPlayerName()+"] : " + Msg);
389+ sIRC.Send_WoW_Player(m_session->GetPlayer(), "|cffCC4ACCTo ["+To+"]: "+Msg);
390+ return true;
391+}
392\ No newline at end of file
393diff --git a/src/game/Makefile.am b/src/game/Makefile.am
394index 4e14fda..178de4f 100644
395--- a/src/game/Makefile.am
396+++ b/src/game/Makefile.am
397@@ -154,6 +154,20 @@ libmangosgame_a_SOURCES = \
398 InstanceData.h \
399 InstanceSaveMgr.cpp \
400 InstanceSaveMgr.h \
401+ mangchat/IRCClient.cpp \
402+ mangchat/IRCClient.h \
403+ mangchat/IRCCmd.cpp \
404+ mangchat/IRCCmd.h \
405+ mangchat/IRCCmde.cpp \
406+ mangchat/IRCConf.cpp \
407+ mangchat/IRCConf.h \
408+ mangchat/IRCFunc.h \
409+ mangchat/IRCIO.cpp \
410+ mangchat/IRCLog.cpp \
411+ mangchat/IRCLog.h \
412+ mangchat/IRCSock.cpp \
413+ mangchat/MCS_OnlinePlayers.cpp \
414+ mangchat/MCS_OnlinePlayers.h \
415 Item.cpp \
416 Item.h \
417 ItemEnchantmentMgr.cpp \
418diff --git a/src/game/Player.cpp b/src/game/Player.cpp
419index fbc3f3e..e115f02 100644
420--- a/src/game/Player.cpp
421+++ b/src/game/Player.cpp
422@@ -58,6 +58,7 @@
423 #include "Spell.h"
424 #include "SocialMgr.h"
425 #include "AchievementMgr.h"
426+#include "mangchat/IRCClient.h"
427
428 #include <cmath>
429
430@@ -1886,6 +1887,8 @@ void Player::AddToWorld()
431 {
432 if(m_items[i])
433 m_items[i]->AddToWorld();
434+ if(sIRC.ajoin == 1)
435+ sIRC.AutoJoinChannel(this);
436 }
437 }
438
439@@ -2457,6 +2460,17 @@ void Player::GiveLevel(uint32 level)
440
441 UpdateAllStats();
442
443+ if((sIRC.BOTMASK & 64) != 0)
444+ {
445+ char temp [5];
446+ sprintf(temp, "%u", level);
447+ std::string plevel = temp;
448+ std::string pname = GetName();
449+ std::string ircchan = "#";
450+ ircchan += sIRC._irc_chan[sIRC.anchn].c_str();
451+ sIRC.Send_IRC_Channel(ircchan, "\00311["+pname+"] : Has Reached Level: "+plevel, true);
452+ }
453+
454 // set current level health and mana/energy to maximum after applying all mods.
455 SetHealth(GetMaxHealth());
456 SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
457diff --git a/src/game/World.cpp b/src/game/World.cpp
458index b505036..d01848a 100644
459--- a/src/game/World.cpp
460+++ b/src/game/World.cpp
461@@ -62,9 +62,9 @@
462 #include "InstanceSaveMgr.h"
463 #include "WaypointManager.h"
464 #include "GMTicketMgr.h"
465+#include "mangchat/IRCClient.h"
466 #include "Util.h"
467 #include "AuctionHouseBot.h"
468-
469 INSTANTIATE_SINGLETON_1( World );
470
471 volatile bool World::m_stopEvent = false;
472@@ -1483,6 +1483,9 @@ void World::SetInitialWorldSettings()
473 static uint32 abtimer = 0;
474 abtimer = sConfig.GetIntDefault("AutoBroadcast.Timer", 60000);
475
476+ static uint32 autoanc = 1;
477+ autoanc = sIRC.autoanc;
478+
479 m_timers[WUPDATE_OBJECTS].SetInterval(0);
480 m_timers[WUPDATE_SESSIONS].SetInterval(0);
481 m_timers[WUPDATE_WEATHERS].SetInterval(1*IN_MILISECONDS);
482@@ -1490,7 +1493,7 @@ void World::SetInitialWorldSettings()
483 m_timers[WUPDATE_UPTIME].SetInterval(m_configs[CONFIG_UPTIME_UPDATE]*MINUTE*IN_MILISECONDS);
484 //Update "uptime" table based on configuration entry in minutes.
485 m_timers[WUPDATE_CORPSES].SetInterval(20*MINUTE*IN_MILISECONDS);
486- //erase corpses every 20 minutes
487+ m_timers[WUPDATE_AUTOANC].SetInterval(autoanc*MINUTE*1000); //IRC autoannounce time
488 m_timers[WUPDATE_AUTOBROADCAST].SetInterval(abtimer);
489 //to set mailtimer to return mails every day between 4 and 5 am
490 //mailtimer is increased when updating auctions
491@@ -1698,6 +1701,12 @@ void World::Update(uint32 diff)
492 SendBroadcast();
493 }
494 }
495+
496+ if (m_timers[WUPDATE_AUTOANC].Passed())
497+ {
498+ m_timers[WUPDATE_AUTOANC].Reset();
499+ SendRNDBroadcast();
500+ }
501
502
503 /// </ul>
504@@ -2164,7 +2173,21 @@ void World::SendBroadcast()
505 sLog.outString("AutoBroadcast: '%s'",msg.c_str());
506 }
507 }
508-
509+void World::SendRNDBroadcast()
510+{
511+ std::string msg;
512+ QueryResult *result = WorldDatabase.PQuery("SELECT `message` FROM `IRC_AutoAnnounce` ORDER BY RAND() LIMIT 1");
513+ if(!result)
514+ return;
515+ msg = result->Fetch()[0].GetString();
516+ delete result;
517+ std::string str = "|cffff0000[Automatic]:|r";
518+ str += msg;
519+ sWorld.SendWorldText(3000,msg.c_str());
520+ std::string ircchan = "#";
521+ ircchan += sIRC._irc_chan[sIRC.anchn].c_str();
522+ sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 Automatic System Message \00304,08\037/!\\\037\017 %s", "%s", msg.c_str()), true);
523+}
524 void World::InitResultQueue()
525 {
526 m_resultQueue = new SqlResultQueue;
527@@ -2282,4 +2305,4 @@ void World::LoadDBVersion()
528
529 if(m_CreatureEventAIVersion.empty())
530 m_CreatureEventAIVersion = "Unknown creature EventAI.";
531-}
532+}
533\ No newline at end of file
534diff --git a/src/game/World.h b/src/game/World.h
535index c50beb8..e90af6e 100644
536--- a/src/game/World.h
537+++ b/src/game/World.h
538@@ -78,7 +78,8 @@ enum WorldTimers
539 WUPDATE_CORPSES = 5,
540 WUPDATE_EVENTS = 6,
541 WUPDATE_AUTOBROADCAST = 7,
542- WUPDATE_COUNT = 8
543+ WUPDATE_AUTOANC = 8,
544+ WUPDATE_COUNT = 9
545 };
546
547 /// Configuration elements
548@@ -377,6 +378,9 @@ class World
549 ~World();
550
551 WorldSession* FindSession(uint32 id) const;
552+
553+ void SendRNDBroadcast();
554+
555 void AddSession(WorldSession *s);
556 void SendBroadcast();
557 bool RemoveSession(uint32 id);
558diff --git a/src/game/mangchat/IRCClient.cpp b/src/game/mangchat/IRCClient.cpp
559new file mode 100644
560index 0000000..4a0c0c6
561--- /dev/null
562+++ b/src/game/mangchat/IRCClient.cpp
563@@ -0,0 +1,98 @@
564+/*
565+ * MangChat By |Death| And Cybrax
566+ *
567+ * This Program Is Free Software; You Can Redistribute It And/Or Modify It Under The Terms
568+ * Of The GNU General Public License
569+ * Written and Developed by Cybrax. cybraxvd@gmail.com
570+ * |Death| <death@hell360.net>, Lice <lice@yeuxverts.net>, Dj_baby & Sanaell, Tase
571+ * Conversion to MangChat version 1.7.2 for Mangos 7252 by Shinzon <shinzon@wowgollum.com>
572+ * With Help And Support From The MaNGOS Project Community.
573+ * PLEASE RETAIN THE COPYRIGHT OF THE AUTHORS.
574+ */
575+#include "IRCClient.h"
576+#include "../World.h"
577+#i