[svn] * Various small changes here and there.

* Implementing MangChat IRC system.
* Added new config option, MAX_WHO, can be used to set the limit of characters being sent in a /who request from client.

--HG--
branch : trunk
This commit is contained in:
XTZGZoReX committed 2008-10-12 14:03:38 -05:00
1 parent e539b4ca7f
commit 054725122f
42 files changed
+5363 -13568

No files matched your search

+3
View File
@@ -20,6 +20,9 @@ similar to this one:
Thanks to the ScriptDev2 team (http://www.scriptdev2.com) for scripts.
Thanks to death and xeqt (http://mangchat.visualdreams-its.com) for the IRC
system/bot.
The easiest policy with this file is to thank everyone who contributes to the
project, without judging the value of the contribution.
+1
View File
@@ -314,6 +314,7 @@ AC_CONFIG_FILES([
src/game/Makefile
src/trinityrealm/Makefile
src/trinitycore/Makefile
src/game/IRCConf.h
src/bindings/Makefile
src/bindings/interface/Makefile
])
+75
View File
@@ -0,0 +1,75 @@
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for IRC_Commands
-- ----------------------------
DROP TABLE IF EXISTS `IRC_Commands`;
CREATE TABLE `IRC_Commands` (
`Command` varchar(10) NOT NULL default '',
`Description` varchar(150) NOT NULL default '',
`gmlevel` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`Command`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='IRC Module System';
-- ----------------------------
-- Records
-- ----------------------------
INSERT INTO `IRC_Commands` VALUES ('acct', '[acct <Player> <(un)lock/mail/pass/rename>] : Perform Action To <Player> Account.', '3');
INSERT INTO `IRC_Commands` VALUES ('ban', '[ban <Player/IP> <ip/acct/unban/reason>] : Ban/Unban <Player>', '3');
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');
INSERT INTO `IRC_Commands` VALUES ('char', '[char <Player> <mailcheat/taxicheat/maxskill/setskill>] : Perform Action To Character.', '3');
INSERT INTO `IRC_Commands` VALUES ('fun', '[fun <Player> <Sound/Say>] : Do Selected Fun Action To <Player>.', '3');
INSERT INTO `IRC_Commands` VALUES ('help', '[help Command] : Use No Paramaters For List Of Available Commands.', '0');
INSERT INTO `IRC_Commands` VALUES ('inchan', '[inchan <Channel>] : Display Users In Selected In Game <Channel>', '0');
INSERT INTO `IRC_Commands` VALUES ('info', '[info] : Display Server Info. (Number Of Players Online/Max Since Last Restart/Uptime)', '0');
INSERT INTO `IRC_Commands` VALUES ('item', '[item <Player> <add> <ItemID/[ItemName]> <Amount>] : Additem To <Player>, Use <ItemID> Or <[Exact Item Name]>.', '3');
INSERT INTO `IRC_Commands` VALUES ('jail', '[jail <Player> <release/Reason>] : Jail Selected <Player> For <Reason>. Using release As <Reason> Releases Player.', '3');
INSERT INTO `IRC_Commands` VALUES ('kick', '[kick <Player> <Reason>] : Kick <Player> For <Reason>.', '3');
INSERT INTO `IRC_Commands` VALUES ('kill', '[kill <Player> <Reason>] : Kill <Player> For <Reason>.', '3');
INSERT INTO `IRC_Commands` VALUES ('level', '[level <Player> <NewLevel>] : Level <Player> To <NewLevel>. *Can Be Done Offline*', '3');
INSERT INTO `IRC_Commands` VALUES ('lookup', '[lookup <acct/char/creature/faction/go/item/quest/skill/spell/tele> <ID/Name>] : ', '3');
INSERT INTO `IRC_Commands` VALUES ('login', '[login <UserName> <Password>] : Login To MangChat Admin Mode. (Must Be Done In A PM)', '0');
INSERT INTO `IRC_Commands` VALUES ('logout', '[logout] : Logout Of MangChat Admin Mode.', '0');
INSERT INTO `IRC_Commands` VALUES ('money', '[money <Player> <(-)Money>] : Give Money To <Player>, Use - To Take Money. *Can Be Done Offline*', '3');
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');
INSERT INTO `IRC_Commands` VALUES ('online', '[online] : Display All Users Logged In Game.', '0');
INSERT INTO `IRC_Commands` VALUES ('pm', '[pm <Player> <Message>] : Whisper <Player> In WoW <Message>.', '3');
INSERT INTO `IRC_Commands` VALUES ('reload', '[reload] : Reload MangChat Config Options And Security Level From DataBase.', '3');
INSERT INTO `IRC_Commands` VALUES ('restart', '[restart] : Restart MangChat, NOT MaNGOS World Server Itself. Forces Reconnection To IRC Server.', '3');
INSERT INTO `IRC_Commands` VALUES ('revive', '[revive <Player>] : Revive <Player>.', '3');
INSERT INTO `IRC_Commands` VALUES ('saveall', '[saveall] : Forces MaNGOS To Save All Players.', '3');
INSERT INTO `IRC_Commands` VALUES ('shutdown', '[shutdown <TimeInSeconds>] : Shuts The Server Down In <TimeInSeconds>, Use 0 For Immediate Shut Down', '3');
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');
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');
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');
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');
INSERT INTO `IRC_Commands` VALUES ('who', '[who] : Displays Users Currently Logged In To MangChat.', '1');
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for IRC_Inchan
-- ----------------------------
DROP TABLE IF EXISTS `IRC_Inchan`;
CREATE TABLE `IRC_Inchan` (
`guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier',
`name` varchar(12) NOT NULL default '',
`channel` varchar(15) NOT NULL default '',
PRIMARY KEY (`guid`,`channel`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='IRC Module System';
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for IRC_AutoAnnounce
-- ----------------------------
DROP TABLE IF EXISTS `IRC_AutoAnnounce`;
CREATE TABLE `IRC_AutoAnnounce` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`message` longtext NOT NULL,
`addedby` varchar(12) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='IRC Module System';
-- Add ircpm command.
insert into `command` (`name`, `security`, `help`) values ('ircpm', 0, 'Syntax: .ircpm <user> <text>\n\nSends a PM with <text> to <user> on IRC.');
-- Add auto announce string.
insert into `mangos_string` (`entry`, `content_default`, `content_loc1`, `content_loc2`, `content_loc3`, `content_loc4`, `content_loc5`, `content_loc6`, `content_loc7`, `content_loc8`) values('746','|cffff0000[Automatic]:|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
+383 -13552
View File
File diff suppressed because it is too large. Load diff
+4
View File
@@ -26,6 +26,7 @@
#include "UpdateMask.h"
#include "AuctionHouseObject.h"
#include "Util.h"
#include "IRCClient.h"
//please DO NOT use iterator++, because it is slower than ++iterator!!!
//post-incrementation is always slower than pre-incrementation !
@@ -313,6 +314,9 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
pl->SaveInventoryAndGoldToDB();
CharacterDatabase.CommitTransaction();
if((sIRC.BOTMASK & 1024) != 0)
sIRC.AHFunc(it->GetEntry(), it->GetProto()->Name1, pl->GetName(), location);
SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, AUCTION_OK);
}
+5 -7
View File
@@ -20,6 +20,7 @@
#include "ObjectMgr.h"
#include "World.h"
#include "SocialMgr.h"
#include "IRCClient.h"
Channel::Channel(std::string name, uint32 channel_id)
: m_name(name), m_announce(true), m_moderate(false), m_channelId(channel_id), m_ownerGUID(0), m_password(""), m_flags(0)
@@ -112,14 +113,9 @@ void Channel::Join(uint64 p, const char *pass)
MakeYouJoined(&data);
SendToOne(&data, p);
JoinNotify(p);
sIRC.Handle_WoW_Channel(m_name, objmgr.GetPlayer(p), CHANNEL_JOIN);
// if no owner first logged will become
if(!IsConstant() && !m_ownerGUID)
{
SetOwner(p, (players.size() > 1 ? true : false));
players[p].SetModerator(true);
}
JoinNotify(p);
}
void Channel::Leave(uint64 p, bool send)
@@ -159,6 +155,8 @@ void Channel::Leave(uint64 p, bool send)
LeaveNotify(p);
sIRC.Handle_WoW_Channel(m_name, objmgr.GetPlayer(p), CHANNEL_LEAVE);
if(changeowner)
{
uint64 newowner = !players.empty() ? players.begin()->second.player : 0;
+1
View File
@@ -456,6 +456,7 @@ ChatCommand * ChatHandler::getCommandTable()
{ "movegens", SEC_ADMINISTRATOR, &ChatHandler::HandleMovegensCommand, "", NULL },
{ "cometome", SEC_ADMINISTRATOR, &ChatHandler::HandleComeToMeCommand, "", NULL },
{ "damage", SEC_ADMINISTRATOR, &ChatHandler::HandleDamageCommand, "", NULL },
{ "ircpm", SEC_PLAYER, &ChatHandler::HandleIRCpmCommand, "", NULL },
{ "combatstop", SEC_GAMEMASTER, &ChatHandler::HandleCombatStopCommand, "", NULL },
{ "flusharenapoints", SEC_ADMINISTRATOR, &ChatHandler::HandleFlushArenaPointsCommand, "", NULL },
+2
View File
@@ -108,6 +108,8 @@ class ChatHandler
bool HandleGroupTeleCommand(const char* args);
bool HandleDrunkCommand(const char* args);
bool HandleIRCpmCommand(const char* args);
bool HandleEventActiveListCommand(const char* args);
bool HandleEventStartCommand(const char* args);
bool HandleEventStopCommand(const char* args);
+3
View File
@@ -34,6 +34,7 @@
#include "Player.h"
#include "SpellAuras.h"
#include "Language.h"
#include "IRCClient.h"
#include "Util.h"
void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
@@ -427,6 +428,8 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if(msg.empty())
break;
sIRC.Send_WoW_IRC(_player, channel, msg);
if(ChannelMgr* cMgr = channelMgr(_player->GetTeam()))
{
if(Channel *chn = cMgr->GetChannel(channel,_player))
+9
View File
@@ -24,6 +24,7 @@
#include "Log.h"
#include "MapManager.h"
#include "Policies/SingletonImp.h"
#include "IRCClient.h"
INSTANTIATE_SINGLETON_1(GameEvent);
@@ -421,6 +422,14 @@ void GameEvent::ApplyNewEvent(uint16 event_id)
}
sLog.outString("GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str());
if((sIRC.BOTMASK & 256) != 0)
{
std::string ircchan = "#";
ircchan += sIRC._irc_chan[sIRC.anchn].c_str();
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);
}
// spawn positive event tagget objects
GameEventSpawn(event_id);
// un-spawn negative event tagged objects
+91
View File
@@ -0,0 +1,91 @@
/*
* MangChat By |Death| And Cybrax
*
* This Program Is Free Software; You Can Redistribute It And/Or Modify It Under The Terms
* Of The GNU General Public License
* Written and Developed by Cybrax. cybraxvd@gmail.com
* |Death| <death@hell360.net>, Lice <lice@yeuxverts.net>, Dj_baby & Sanaell, Tase
* With Help And Support From The MaNGOS Project Community.
* PLEASE RETAIN THE COPYRIGHT OF THE AUTHORS.
*/
#include "IRCClient.h"
#include "World.h"
#include "ObjectMgr.h"
#include "MapManager.h"
#include "Policies/SingletonImp.h"
INSTANTIATE_SINGLETON_1( IRCClient );
#ifdef WIN32
#define Delay(x) Sleep(x)
#else
#define Delay(x) sleep(x / 1000)
#endif
// IRCClient Constructor
IRCClient::IRCClient()
{
for(int i = 0;i > 5;i++)
sIRC.Script_Lock[i] = false;
}
// IRCClient Destructor
IRCClient::~IRCClient(){}
// ZThread Entry This function is called when the thread is created in Master.cpp (mangosd)
void IRCClient::run()
{
sIRC.iLog.WriteLog(" %s : IRC bot started.", sIRC.iLog.GetLogDateTimeStr().c_str());
// before we begin we wait a few
// mangos is still starting up.
ZThread::Thread::sleep(500);
int cCount = 0;
// Clean Up MySQL Tables
sLog.outString("Cleaning up IRC_Inchan table...");
WorldDatabase.PExecute("DELETE FROM `IRC_Inchan`");
sIRC._Max_Script_Inst = 0;
// Create a loop to keep the thread running untill active is set to false
while(sIRC.Active && !World::m_stopEvent)
{
// Initialize socket library
if(this->InitSock())
{
// Connect To The IRC Server
sLog.outString("IRC: Connecting to %s Try # %d ******", sIRC._Host.c_str(), cCount);
if(this->Connect(sIRC._Host.c_str(), sIRC._Port))
{
// On connection success reset the connection counter
cCount = 0;
sLog.outString("IRC connected and logging in");
// Login to the IRC server
if(this->Login(sIRC._Nick, sIRC._User, sIRC._Pass))
{
sLog.outString("IRC logged in and running");
// While we are connected to the irc server keep listening for data on the socket
while(sIRC.Connected && !World::m_stopEvent){ sIRC.SockRecv(); }
}
sLog.outString("Connection to IRC server lost!");
}
// When an error occures or connection lost cleanup
Disconnect();
// Increase the connection counter
cCount++;
// if MAX_CONNECT_ATTEMPT is reached stop trying
if(sIRC._MCA != 0 && cCount == sIRC._MCA)
sIRC.Active = false;
// If we need to reattempt a connection wait WAIT_CONNECT_TIME milli seconds before we try again
if(sIRC.Active)
ZThread::Thread::sleep(sIRC._wct);
}
else
{
// Socket could not initialize cancel
sIRC.Active = false;
sLog.outError("IRC: Could not initialize socket");
}
}
// we need to keep the thread alive or mangos will crash
// when sending chat or join/leave channels.
// even when we are not connected the functions must still
// be availlable where chat is sent to so we keep it running
while(!World::m_stopEvent){};
}
+230
View File
@@ -0,0 +1,230 @@
#ifndef _IRC_CLIENT_H
#define _IRC_CLIENT_H
#include "Policies/Singleton.h"
#include "Player.h"
#include "IRCLog.h"
#include "IRCCmd.h"
using namespace std;
// The maximum ammount of channels used
// in the channel array you can have as much channels as you
// want, but it is important to always have at least equal or more
// channels then you specify in your mangosd.conf
#define MAX_CONF_CHANNELS 10
#define MAX_CHAT_LINES 10
// time we need to wait before we try another connecton attempt
// Default is 30 seconds
#define MAX_SCRIPT_INST 10
// CLINES is used for the default chatlines
// By using the GetChatLine function its easier and faster
// to receieve the line you need.
enum CLINES
{
IRC_WOW = 0,
WOW_IRC = 1,
JOIN_WOW = 2,
JOIN_IRC = 3,
LEAVE_WOW = 4,
LEAVE_IRC = 5,
CHANGE_NICK = 6
}; // Chatlines
// CACTION is used by the Handle_WoW_Channel function
// this function is called in channel.h when a player
// joins or leave a channel inside the client.
enum CACTION
{
CHANNEL_JOIN,
CHANNEL_LEAVE,
};
enum script_Names
{
MCS_Players_Online = 0,
};
// IRCClient main class
class IRCClient : public ZThread::Runnable
{
public:
// IRCClient Constructor
IRCClient();
// IRCClient Destructor
~IRCClient();
// ZThread Entry
void run();
public:
// AH Function
void AHFunc(uint64 itmid, std::string itmnme, std::string plname, uint32 faction);
// IRCClient active
bool Active;
// Connected to IRC
bool Connected;
// Socket indentifier
int SOCKET;
fd_set sfdset;
// Send data to IRC, in addition the endline is added \n
bool SendIRC(std::string data);
// This function is called in ChatHandler.cpp and processes the chat from game to IRC
void Send_WoW_IRC(Player *plr, std::string Channel, std::string Msg);
// Sends a message to all players on the specified channel
void Send_WoW_Channel(const char *channel, std::string chat);
// Send a system message to all players
void Send_WoW_System(std::string Message);
// Send a message to the specified IRC channel
void Send_IRC_Channel(std::string sChannel, std::string sMsg, bool NoPrefix = false, std::string nType = "PRIVMSG");
// Sends a message to all IRC Channels
void Send_IRC_Channels(std::string sMsg);
std::string MakeMsg(std::string msg, std::string var, std::string val)
{
std::size_t start = msg.find(var);
if (start != std::string::npos)
msg.replace(start, var.length(), val);
return msg;
}
void Send_WoW_Player(string sPlayer, string sMsg);
void Send_WoW_Player(Player *plr, string sMsg);
// This function is called in Channel.cpp and processes Join/leave messages
void Handle_WoW_Channel(std::string Channel, Player *plr, int nAction);
void ResetIRC();
public:
void AutoJoinChannel(Player *plr);
public:
bool Script_Lock[5];
bool _AmiOp;
public:
string _Mver;
// IRC Server host
string _Host;
// IRC Server Port
int _Port;
// IRC Username
string _User;
// IRC Password
string _Pass;
// IRC Nickname
string _Nick;
// Authentication type
int _Auth;
string _Auth_Nick;
// IRC Connect code
string _ICC;
// IRC Default channel
string _defchan;
// IRC Leave Default channel
int _ldefc;
// Wait Connect Time
int _wct;
// BotMask Options
int Botmask;
// Status Channel
int Status;
// Announce Channel
int anchn;
int autoanc;
// IRC Channel count
int _chan_count;
// IRC Channel list
// Array to store our IRC channels
// each element will corrospond
// with _wow_chan array below.
std::string _irc_chan[MAX_CONF_CHANNELS];
// Game Channel list
std::string _wow_chan[MAX_CONF_CHANNELS];
// AutoJoin Options
int ajoin;
string ajchan;
// Online Command Max Results
int onlrslt;
// Channel OnJoin/Restart/Kick Messages
string JoinMsg;
string RstMsg;
string kikmsg;
// Misc Options
string ojGM1;
string ojGM2;
string ojGM3;
string ojGM4;
string ojGM5;
string logfile;
int games;
int gmlog;
// IRC Commands Security Level
int CACCT;
int CBAN;
int CCHAN;
int CCHAR;
int CFUN;
int CHELP;
int CINCHAN;
int CINFO;
int CITEM;
int CJAIL;
int CKICK;
int _KILL;
int CLEVEL;
int CLOOKUP;
int CMONEY;
int CMUTE;
int CONLINE;
int CPM;
int CRESTART;
int CREVIVE;
int CSAVEALL;
int CSHUTDOWN;
int CSPELL;
int CSYSMSG;
int CTELE;
int CTOP;
int CWHO;
// BotMask
int BOTMASK;
// Max connect attempt
int _MCA;
// Auto rejoin when kicked from irc
int _autojoinkick;
// IRC Command prefix
string _cmd_prefx;
int _op_gm;
int _op_gm_lev;
// Array that contains our chatlines from the conf file
// To increase this value change the MAX_CHAT_LINE define above
// Make sure the number of elements must match your items
// (remeber this starts at 0 so 0..9 is 10 items)
// and that you load the line in the LoadConfig function.
string ILINES[MAX_CHAT_LINES];
string GetChatLine(int nItem);
int _Max_Script_Inst;
// MAX_SCRIPT_INST
IRCLog iLog;
public:
// Load MangChat configuration file
bool LoadConfig(char const* cfgfile);
void SetCfg(char const* cfgfile);
char const* CfgFile;
private:
// Returns default chatline based on enum CLINES
// Initialize socket library
bool InitSock();
// Connect to IRC Server
bool Connect(const char *cHost, int nPort);
// Login to IRC Server
bool Login(std::string sNick, std::string sUser, std::string sPass);
// Send raw data to IRC
bool SendData(const char *data);
// Disconnect from IRC and cleanup socket
void Disconnect();
// Processes the data receieved from IRC
void Handle_IRC(std::string sData);
// Receieves data from the socket.
void SockRecv();
};
#endif
#define sIRC MaNGOS::Singleton<IRCClient>::Instance()
+827
View File
@@ -0,0 +1,827 @@
/*
* MangChat By |Death| And Cybrax
*
* This Program Is Free Software; You Can Redistribute It And/Or Modify It Under The Terms
* Of The GNU General Public License
* Written and Developed by Cybrax. cybraxvd@gmail.com
* |Death| <death@hell360.net>, Lice <lice@yeuxverts.net>, Dj_baby & Sanaell, Tase
* With Help And Support From The MaNGOS Project Community.
* PLEASE RETAIN THE COPYRIGHT OF THE AUTHORS.
*/
#include "IRCCmd.h"
#include "IRCClient.h"
#include "Database/DatabaseEnv.h"
#include "ObjectMgr.h"
#include "MapManager.h"
// Constructor
IRCCmd::IRCCmd(){}
// Destructor
IRCCmd::~IRCCmd(){}
std::string IRCCmd::MakeUpper(std::string Channel)
{
std::string tmpchan = Channel;
std::transform(tmpchan.begin(), tmpchan.end(), tmpchan.begin(), towupper);
return tmpchan;
}
bool IRCCmd::ParamsValid(_CDATA *CD, int pCnt)
{
CD->PCOUNT = pCnt;
if(CD->PARAMS.size() == 0)
return false;
return ValidParams(CD->PARAMS, pCnt);
}
int IRCCmd::ParamsValid(_CDATA *CD, int pCnt, int rLev)
{
//CD->PCOUNT = pCnt;
if(!CanUse(CD->USER, rLev))
return E_AUTH;
else if(pCnt == 0)
return E_OK;
else if(CD->PARAMS.size() == 0)
return E_SIZE;
else if(!ValidParams(CD->PARAMS, pCnt))
return E_SIZE;
return E_OK;
}
// This function checks if chat from irc is a command or not
// return true on yes and false on no
bool IRCCmd::IsValid(std::string USER, std::string FROM, std::string CHAT, std::string TYPE)
{
// If the first line of our chat is the command prefix we have a command
if(CHAT.substr(0, 1) == sIRC._cmd_prefx && CHAT.size() > 1 )
{
_CDATA CDATA;
bool cValid = false;
bool AuthValid = true;
bool dontlog = true;
std::string* _PARAMS = getArray(CHAT, 2);
CDATA.USER = USER;
CDATA.FROM = FROM;
CDATA.TYPE = TYPE;
CDATA.PCOUNT = 0;
CDATA.CMD = MakeUpper(_PARAMS[0].substr(1, _PARAMS[0].size() - 1));
CDATA.PARAMS = _PARAMS[1];
if(CDATA.CMD == "LOGIN")
{
if(FROM == sIRC._Nick)
{
if(ParamsValid(&CDATA, 2))
Handle_Login(&CDATA);
else
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"login <Player> <Password> )", true, "ERROR");
}
else
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Please Send A PM To Login!", true, "ERROR");
if(GetLevel(USER) >= sIRC.gmlog)
dontlog = false;
cValid = true;
}
else if(CDATA.CMD == "LOGOUT")
{
if(FROM == sIRC._Nick)
{
Handle_Logout(&CDATA);
}
else
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Please Send A PM To Logout!", true, "ERROR");
cValid = true;
}
else if(CDATA.CMD == "ACCT")
{
switch(ParamsValid(&CDATA, 2, sIRC.CACCT))
{
case E_OK:
Account_Player(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"acct <Player> <(un)lock/mail/pass/rename> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "BAN")
{
switch(ParamsValid(&CDATA, 2, sIRC.CBAN))
{
case E_OK:
Ban_Player(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"ban <Player> <acct/ip> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "CHAN")
{
switch(ParamsValid(&CDATA, 1, sIRC.CCHAN))
{
case E_OK:
Chan_Control(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"chan <op> <IRC User> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "CHAR")
{
switch(ParamsValid(&CDATA, 2, sIRC.CCHAR))
{
case E_OK:
Char_Player(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"char <Player> <mailcheat/taxicheat/maxskill/setskill> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "FUN")
{
switch(ParamsValid(&CDATA, 2, sIRC.CFUN))
{
case E_OK:
Fun_Player(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"fun <Player> <Sound/Say> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "HELP")
{
switch(ParamsValid(&CDATA, 0, sIRC.CHELP))
{
case E_OK:
Help_IRC(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"help <Command> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "INCHAN")
{
switch(ParamsValid(&CDATA, 1, sIRC.CINCHAN))
{
case E_OK:
Inchan_Server(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"inchan <Channel> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "INFO")
{
switch(ParamsValid(&CDATA, 0, sIRC.CINFO))
{
case E_OK:
Info_Server(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"info )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "ITEM")
{
CDATA.PCOUNT = 3;
switch(ParamsValid(&CDATA, 2, sIRC.CITEM))
{
case E_OK:
Item_Player(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"item <Player> <add> <ItemID/[ItemName]> <Amount> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "JAIL")
{
CDATA.PCOUNT = 3;
switch(ParamsValid(&CDATA, 1, sIRC.CJAIL))
{
case E_OK:
Jail_Player(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"jail <Player> <release/Reason>)", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "KICK")
{
CDATA.PCOUNT = 2;
switch(ParamsValid(&CDATA, 1, sIRC.CKICK))
{
case E_OK:
Kick_Player(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"kick <Player> <Reason> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "KILL")
{
CDATA.PCOUNT = 2;
switch(ParamsValid(&CDATA, 1, sIRC._KILL))
{
case E_OK:
Kill_Player(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"kill <Player> <Reason> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "LEVEL")
{
CDATA.PCOUNT = 2;
switch(ParamsValid(&CDATA, 2, sIRC.CLEVEL))
{
case E_OK:
Level_Player(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"level <Player> <NewLevel> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "LOOKUP")
{
CDATA.PCOUNT = 2;
switch(ParamsValid(&CDATA, 2, sIRC.CLOOKUP))
{
case E_OK:
Lookup_Player(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"lookup <acct/char/creature/faction/go/item/quest/skill/spell/tele> <ID/Name> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "MONEY")
{
CDATA.PCOUNT = 2;
switch(ParamsValid(&CDATA, 2, sIRC.CMONEY))
{
case E_OK:
Money_Player(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"money <Player> <(-)Money> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "MUTE")
{
switch(ParamsValid(&CDATA, 2, sIRC.CMUTE))
{
case E_OK:
Mute_Player(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"mute <Player> <release/TimeInMins> <Reason> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "ONLINE")
{
switch(ParamsValid(&CDATA, 0, sIRC.CONLINE))
{
case E_OK:
Online_Players(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"online )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "PM")
{
switch(ParamsValid(&CDATA, 2, sIRC.CPM))
{
case E_OK:
PM_Player(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"pm <Player> <Message> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "RELOAD")
{
switch(ParamsValid(&CDATA, 0, sIRC.CRESTART))
{
case E_OK:
sIRC.Send_IRC_Channels("Reloading MangChat Config Options. (Command Disabled)");
//sIRC.LoadConfig();
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "RESTART")
{
switch(ParamsValid(&CDATA, 0, sIRC.CRESTART))
{
case E_OK:
sIRC.Send_IRC_Channels(sIRC.RstMsg);
sIRC.ResetIRC();
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "REVIVE")
{
CDATA.PCOUNT = 2;
switch(ParamsValid(&CDATA, 1, sIRC.CREVIVE))
{
case E_OK:
Revive_Player(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"revive <Player> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "SAVEALL")
{
switch(ParamsValid(&CDATA, 0, sIRC.CSAVEALL))
{
case E_OK:
Saveall_Player(&CDATA);
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "SHUTDOWN")
{
switch(ParamsValid(&CDATA, 1, sIRC.CSHUTDOWN))
{
case E_OK:
Shutdown_Mangos(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"shutdown <TimeInSeconds> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "SPELL")
{
switch(ParamsValid(&CDATA, 2, sIRC.CSPELL))
{
case E_OK:
Spell_Player(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"spell <Player> <Cast/Learn/UnLearn> <SpellID> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "SYSMSG")
{
CDATA.PCOUNT = 2;
switch(ParamsValid(&CDATA, 2, sIRC.CSYSMSG))
{
case E_OK:
Sysmsg_Server(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"sysmsg <a/e/n/add/del/list> <Message> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "TELE")
{
switch(ParamsValid(&CDATA, 2, sIRC.CTELE))
{
case E_OK:
Tele_Player(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"tele <Player> <l/c/r/to> <Loc.Name/MAPID X Y Z/Recall/Player> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "TOP")
{
CDATA.PCOUNT = 1;
switch(ParamsValid(&CDATA, 1, sIRC.CTOP))
{
case E_OK:
Top_Player(&CDATA);
break;
case E_SIZE:
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Syntax Error! ( "+sIRC._cmd_prefx+"top <accttime/chartime/money> <limit> )", true, "ERROR");
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
else if(CDATA.CMD == "WHO")
{
switch(ParamsValid(&CDATA, 0, sIRC.CWHO))
{
case E_OK:
Who_Logged(&CDATA);
break;
case E_AUTH:
AuthValid = false;
break;
}
cValid = true;
}
if(!AuthValid && IsLoggedIn(USER))
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Access Denied! Your Security Level Is Too Low To Use This Command!", true, "ERROR");
if(cValid == false && (sIRC.BOTMASK & 4) != 0)
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : Unknown Command!", true, "ERROR");
if(cValid && dontlog)
{
sIRC.iLog.WriteLog(" %s : [ %s(%d) ] Used Command: [ %s ] With Parameters: [ %s ]", sIRC.iLog.GetLogDateTimeStr().c_str(), CDATA.USER.c_str(), GetLevel(USER), CDATA.CMD.c_str(), CDATA.PARAMS.c_str());
}
return cValid;
}
return false;
}
bool IRCCmd::CanUse(std::string USER, int nLevel)
{
if(IsLoggedIn(USER))
{
if(GetLevel(USER) >= nLevel)
return true;
else
return false;
}
else if(nLevel == 0)
{
return true;
}
else
sIRC.Send_IRC_Channel(USER, "\0034[ERROR] : You Are Not Logged In!", true, "ERROR");
return false;
}
std::string IRCCmd::ChanOrPM(_CDATA *CD)
{
if(CD->FROM == sIRC._Nick)
return CD->USER;
else
return CD->FROM;
}
Player *IRCCmd::GetPlayer(std::string WHO)
{
normalizePlayerName(WHO);
return ObjectAccessor::Instance().FindPlayerByName(WHO.c_str());
}
_client *IRCCmd::GetClient(std::string cname)
{
for(std::list<_client*>::iterator i=_CLIENTS.begin(); i!=_CLIENTS.end();i++)
{
if((*i)->Name == cname)
return (*i);
}
return (NULL);
}
bool IRCCmd::IsLoggedIn(std::string USER)
{
for(std::list<_client*>::iterator i=_CLIENTS.begin(); i!=_CLIENTS.end();i++)
{
if((*i)->Name == USER)
return true;
}
return false;
}
bool IRCCmd::AcctIsLoggedIn(std::string USER)
{
for(std::list<_client*>::iterator i=_CLIENTS.begin(); i!=_CLIENTS.end();i++)
{
if(MakeUpper((*i)->UName) == MakeUpper(USER))
return true;
}
return false;
}
std::string IRCCmd::AcctIsBanned(std::string ACCT)
{
uint32 acctid = objmgr.GetAccountByAccountName(ACCT);
std::string banned = "NOTBANNED";
QueryResult *result = loginDatabase.PQuery("SELECT banreason FROM ip_banned WHERE ip=(SELECT last_ip FROM account WHERE id = '%i')", acctid);
if(result)
{
banned = (*result)[0].GetCppString();
delete result;
return "IP Banned. Reason:" + banned;
}
QueryResult *result2 = loginDatabase.PQuery("SELECT banreason FROM account_banned WHERE id='%i'", acctid);
if(result2)
{
banned = (*result2)[0].GetCppString();
delete result2;
return "Account Banned. Reason:" + banned;
}
return banned;
}
int IRCCmd::GetLevel(std::string sName)
{
for(std::list<_client*>::iterator i=_CLIENTS.begin(); i!=_CLIENTS.end();i++)
{
if((*i)->Name == sName)
return (*i)->GMLevel;
}
return 0;
}
int IRCCmd::AcctLevel(std::string plnme)
{
uint64 guid = objmgr.GetPlayerGUIDByName(plnme);
uint32 account_id = 0;
uint32 security = 0;
account_id = objmgr.GetPlayerAccountIdByGUID(guid);
security = objmgr.GetSecurityByAccount(account_id);
return security;
}
std::string IRCCmd::GetAccName(std::string sName)
{
for(std::list<_client*>::iterator i=_CLIENTS.begin(); i!=_CLIENTS.end();i++)
{
if((*i)->Name == sName)
return (*i)->UName;
}
return "";
}
std::string IRCCmd::GetNameFromAcct(std::string sName)
{
for(std::list<_client*>::iterator i=_CLIENTS.begin(); i!=_CLIENTS.end();i++)
{
if((*i)->UName == sName)
return (*i)->Name;
}
return "";
}
int IRCCmd::GetAcctIDFromName(std::string sName)
{
for(std::list<_client*>::iterator i=_CLIENTS.begin(); i!=_CLIENTS.end();i++)
{
if((*i)->Name == sName)
{
uint32 acct_id = 0;
acct_id = objmgr.GetAccountByAccountName((*i)->UName.c_str());
return acct_id;
}
}
return 0;
}
std::string IRCCmd::GetAcctNameFromID(uint32 acctid)
{
QueryResult *result = loginDatabase.PQuery("SELECT username FROM account WHERE id = '%d'", acctid);
if(result)
{
std::string name = (*result)[0].GetCppString();
delete result;
return name;
}
return "";
}
std::string IRCCmd::GetIPFromPlayer(std::string player)
{
QueryResult *result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name = '%s'", player.c_str());
if(result)
{
std::string acctid = (*result)[0].GetCppString();
delete result;
QueryResult *result2 = loginDatabase.PQuery("SELECT last_ip FROM account WHERE id = '%s'", acctid.c_str());
if(result2)
{
std::string ip = (*result2)[0].GetCppString();
delete result2;
return ip;
}
}
return "";
}
std::string IRCCmd::SecToDay(std::string secons)
{
unsigned int seconds = atoi(secons.c_str());
unsigned int days = seconds / 86400;
unsigned int hours = seconds / 3600 % 24;
unsigned int mins = seconds / 60 % 60;
char tottime[1000];
sprintf(tottime, "%iDays:%iHours:%iMinutes", days, hours, mins);
return tottime;
}
bool IRCCmd::ValidParams(std::string PARAMS, int nCount)
{
if(nCount == 1 && PARAMS.size() == 0)
return false;
int pcount = 0;
size_t p = -1;
for(int i = 0;i < nCount;i++)
{
p = PARAMS.find(" ", p + 1);
if(p == -1)
break;
else
pcount++;
}
nCount--;
if(pcount >= nCount)
return true;
else
return false;
}
std::string* IRCCmd::getArray(std::string PARAMS, int nCount)
{
std::string *array = new std::string[nCount];
if(PARAMS.size() > 0)
{
int pcnt = 0;
size_t ps = 0;
size_t pc = -1;
for(int i = 0;i < nCount;i++)
{
pc = PARAMS.find(" ", pc + 1);
if(i + 1 == nCount && nCount != 1)
{
if(ps > 0 && pc > 0)
array[i] = PARAMS.substr(ps, PARAMS.size() - ps);
}
else
array[i] = PARAMS.substr(ps, pc - ps);
ps = pc + 1;
}
}
return array;
}
std::string IRCCmd::MakeMsg(const char *sLine, ... )
{
va_list ap;
char tmpoutp[1024];
va_start(ap, sLine);
vsnprintf(tmpoutp, 1024, sLine, ap );
va_end(ap);
std::string outp = tmpoutp;
return outp;
}
void IRCClient::AHFunc(uint64 itmid, std::string itmnme, std::string plname, uint32 faction)
{
IRCCmd Command;
Player* plr = Command.GetPlayer(plname);
if(plr)
{
std::string itemname = itmnme;
char temp [7];
sprintf(temp, "%u", itmid);
std::string itemid = temp;
std::string wowname = "";
std::string ircname = "";
switch (plr->GetTeam())
{
case 67:wowname="|cffff0000"+plname+"|r";ircname="\0034"+plname;break; //horde
case 469:wowname="|cff1589FF"+plname+"|r";ircname="\00312"+plname;break; //alliance
}
std::string wowfact = "|cffFF8040[Auction House]:|r";
std::string ircfact = "\00304,08\037/!\\\037\017\00307 Auction House \00304,08\037/!\\\037\017";
switch(faction)
{
//neutral
case 7:wowfact="|cffff8040[Neutral Auction House]:|r";ircfact="\00304,08\037/!\\\037\017\00307 Neutral Auction House \00304,08\037/!\\\037\017";break;
//horde
case 6:wowfact="|cffff0000[Horde Auction House]:|r";ircfact="\00304,08\037/!\\\037\017\00304 Horde Auction House \00304,08\037/!\\\037\017";break;
//alliance
case 2:wowfact="|cff1589FF[Alliance Auction House]:|r";ircfact="\00304,08\037/!\\\037\017\00312 Alliance Auction House \00304,08\037/!\\\037\017";break;
}
std::string wowstr = Command.MakeMsg("%s A New Item Has Been Added |cffffffff|Hitem:%s:0:0:0:0:0:0:0|h[%s]|h|r. By: %s",wowfact.c_str(), itemid.c_str(), itemname.c_str(), wowname.c_str());
std::string ircstr = Command.MakeMsg("%s A New Item Has Been Added [%s]. By: %s", ircfact.c_str(), itemname.c_str(), ircname.c_str());
sIRC.Send_WoW_Channel(sIRC._wow_chan[sIRC.Status].c_str(), wowstr.c_str());
sIRC.Send_IRC_Channel(sIRC._irc_chan[sIRC.Status].c_str(), ircstr.c_str());
}
}
+117
View File
@@ -0,0 +1,117 @@
#ifndef _IRC_CMD_H
#define _IRC_CMD_H
#define MAX_CLIENTS 50
#include "Common.h"
#include "Player.h"
#include "ObjectAccessor.h"
struct ChannelUser
{
int UserType;
std::string Name;
std::string UName;
int UserLevel;
};
struct _client
{
bool LoggedIn;
std::string Name;
std::string UName;
int GMLevel;
};
struct _CDATA
{
std::string CMD;
std::string USER;
std::string FROM;
std::string PARAMS;
std::string TYPE;
int PCOUNT;
};
enum APVERR
{
E_OK,
E_SIZE,
E_AUTH,
E_IVALID,
};
enum ESOUNDS
{
S_ENTERWORLD = 602,
S_QUESTFAILED = 847,
S_INVITE = 880,
S_LEVELUP = 888,
S_COINSOUND = 895,
S_WHISPER = 3081,
S_STEALTH = 3325,
};
class IRCCmd
{
public:
IRCCmd();
~IRCCmd();
void Handle_Logout(_CDATA *CD);
bool IsLoggedIn(std::string USER);
bool IsValid(std::string USER, std::string FROM, std::string CHAT, std::string TYPE);
bool AcctIsLoggedIn(std::string USER);
_client *GetClient(std::string cname);
public:
static std::string MakeMsg(const char *sLine, ... );
static std::string ChanOrPM(_CDATA *CD);
int AcctLevel(std::string plnme);
int GetLevel(std::string sName);
std::string MakeUpper(std::string Channel);
std::string AcctIsBanned(std::string ACCT);
std::list<_client*> _CLIENTS;
Player* GetPlayer(std::string WHO);
private:
// MangChat Commands
void Handle_Login(_CDATA *CD);
void Account_Player(_CDATA *CD);
void Ban_Player(_CDATA *CD);
void Chan_Control(_CDATA *CD);
void Char_Player(_CDATA *CD);
void Fun_Player(_CDATA *CD);
void Help_IRC(_CDATA *CD);
void Item_Player(_CDATA *CD);
void Inchan_Server(_CDATA *CD);
void Info_Server(_CDATA *CD);
void Jail_Player(_CDATA *CD);
void Kick_Player(_CDATA *CD);
void Kill_Player(_CDATA *CD);
void Level_Player(_CDATA *CD);
void Lookup_Player(_CDATA *CD);
void Money_Player(_CDATA *CD);
void Mute_Player(_CDATA *CD);
void Online_Players(_CDATA *CD);
void PM_Player(_CDATA *CD);
void Revive_Player(_CDATA *CD);
void Saveall_Player(_CDATA *CD);
void Shutdown_Mangos(_CDATA *CD);
void Spell_Player(_CDATA *CD);
void Sysmsg_Server(_CDATA *CD);
void Tele_Player(_CDATA *CD);
void Top_Player(_CDATA *CD);
void Who_Logged(_CDATA *CD);
bool CanUse(std::string USER, int nLevel);
bool ValidParams(std::string PARAMS, int nCount = 1);
bool ParamsValid(_CDATA *CD, int pCnt);
int ParamsValid(_CDATA *CD, int pCnt, int rLev);
std::string GetAccName(std::string sName);
std::string GetNameFromAcct(std::string sName);
std::string GetAcctNameFromID(uint32 acctid);
std::string GetIPFromPlayer(std::string player);
std::string SecToDay(std::string secons);
int GetAcctIDFromName(std::string sName);
std::string* getArray(std::string PARAMS, int nCount = 1);
};
inline void MakeLower(std::string& str)
{
std::transform( str.begin(), str.end(), str.begin(), ::tolower );
}
#endif
+1884
View File
File diff suppressed because it is too large. Load diff
+172
View File
@@ -0,0 +1,172 @@
/*
* MangChat By |Death| And Cybrax
*
* This Program Is Free Software; You Can Redistribute It And/Or Modify It Under The Terms
* Of The GNU General Public License
* Written and Developed by Cybrax. cybraxvd@gmail.com
* |Death| <death@hell360.net>, Lice <lice@yeuxverts.net>, Dj_baby & Sanaell, Tase
* With Help And Support From The MaNGOS Project Community.
* PLEASE RETAIN THE COPYRIGHT OF THE AUTHORS.
*/
#include "IRCClient.h"
#include "IRCCmd.h"
#include "../shared/Config/Config.h"
#include "IRCConf.h"
Config MCConfig;
void IRCClient::SetCfg(char const* cfgfile)
{
sIRC.CfgFile = cfgfile;
}
bool IRCClient::LoadConfig(char const* cfgfile)
{
if (!MCConfig.SetSource(cfgfile))
sLog.outString("*** MangChat: Unable to open configuration file, All default options are being used.");
else sLog.outString("*** MangChat: Found the configuration file, %s", cfgfile);
int ConfCnt = 0;
sIRC._chan_count = 0;
if(MCConfig.GetIntDefault("irc.active", 1) == 1)
sIRC.Active = true;
else
sIRC.Active = false;
sIRC._Host = MCConfig.GetStringDefault("irc.host", "irc.freenode.net");
if(sIRC._Host.size() > 0)
ConfCnt++;
sIRC._Mver = MCConfig.GetStringDefault("irc.mver", "Version 1.6.5");
sIRC._Port = MCConfig.GetIntDefault("irc.port", 6667);
sIRC._User = MCConfig.GetStringDefault("irc.user", "MangChat");
sIRC._Pass = MCConfig.GetStringDefault("irc.pass", "MyDumbPass");
sIRC._Nick = MCConfig.GetStringDefault("irc.nick", "MangChat");
sIRC._Auth = MCConfig.GetIntDefault("irc.auth", 0);
sIRC._Auth_Nick = MCConfig.GetStringDefault("irc.auth.nick", "AuthNick");
sIRC._ICC = MCConfig.GetStringDefault("irc.icc", "001");
sIRC._defchan = MCConfig.GetStringDefault("irc.defchan", "lobby");
sIRC._ldefc = MCConfig.GetIntDefault("irc.ldef", 0);
sIRC._wct = MCConfig.GetIntDefault("irc.wct", 30000);
sIRC.ajoin = MCConfig.GetIntDefault("irc.ajoin", 1);
sIRC.ajchan = MCConfig.GetStringDefault("irc.ajchan", "world");
sIRC.onlrslt = MCConfig.GetIntDefault("irc.online.result", 10);
sIRC.BOTMASK = MCConfig.GetIntDefault("Botmask", 0);
sIRC.logfile = MCConfig.GetStringDefault("irc.logfile.prefix", "IRC_");
for(int i = 1; i < MAX_CONF_CHANNELS;i++)
{
std::ostringstream ss;
ss << i;
std::string ci = "irc.chan_" + ss.str();
std::string t_chan = MCConfig.GetStringDefault(ci.c_str(), "");
if(t_chan.size() > 0)
{
sIRC._chan_count++;
sIRC._irc_chan[sIRC._chan_count] = t_chan;
ci = "wow.chan_" + ss.str();
sIRC._wow_chan[sIRC._chan_count] = MCConfig.GetStringDefault(ci.c_str(), t_chan.c_str());
}
}
sIRC.JoinMsg = MCConfig.GetStringDefault("irc.joinmsg", "Whhaaazzzzaaaa, MangChat $Ver Baby!!");
sIRC.RstMsg = MCConfig.GetStringDefault("irc.rstmsg", "MangChat Is Restarting, I Will Be Right Back!");
sIRC.kikmsg = MCConfig.GetStringDefault("irc.kickmsg", "Do Not Kick Me Again, Severe Actions Will Be Taken!");
// IRC LINES
sIRC.ILINES[WOW_IRC] = MCConfig.GetStringDefault("chat.wow_irc", "\003<WoW>[\002$Name($Level)\002\003] $Msg");
sIRC.ILINES[IRC_WOW] = MCConfig.GetStringDefault("chat.irc_wow", "\003<IRC>[$Name]: $Msg");
sIRC.ILINES[JOIN_WOW] = MCConfig.GetStringDefault("chat.join_wow", "\00312>>\00304 $Name \003Joined The Channel!");
sIRC.ILINES[JOIN_IRC] = MCConfig.GetStringDefault("chat.join_irc", "\003[$Name]: Has Joined IRC!");
sIRC.ILINES[LEAVE_WOW] = MCConfig.GetStringDefault("chat.leave_wow", "\00312<<\00304 $Name \003Left The Channel!");
sIRC.ILINES[LEAVE_IRC] = MCConfig.GetStringDefault("chat.leave_irc", "\003[$Name]: Has Left IRC!");
sIRC.ILINES[CHANGE_NICK] = MCConfig.GetStringDefault("chat.change_nick", "\003<> $Name Is Now Known As $NewName!");
// MangChat Options
sIRC._MCA = MCConfig.GetIntDefault("irc.maxattempt", 10);
sIRC._autojoinkick = MCConfig.GetIntDefault("irc.autojoin_kick", 1);
sIRC._cmd_prefx = MCConfig.GetStringDefault("irc.command_prefix", ".");
sIRC._op_gm = MCConfig.GetIntDefault("irc.op_gm_login", 0);
sIRC._op_gm_lev = MCConfig.GetIntDefault("irc.op_gm_level", 3);
// Misc Options
sIRC.games = MCConfig.GetIntDefault("irc.fun.games", 0);
sIRC.gmlog = MCConfig.GetIntDefault("irc.gmlog", 1);
sIRC.BOTMASK = MCConfig.GetIntDefault("BotMask", 0);
sIRC.Status = MCConfig.GetIntDefault("irc.StatusChannel", 1);
sIRC.anchn = MCConfig.GetIntDefault("irc.AnnounceChannel", 1);
sIRC.autoanc = MCConfig.GetIntDefault("irc.auto.announce", 30);
sIRC.ojGM1 = MCConfig.GetStringDefault("irc.gm1", "[Moderator]");
sIRC.ojGM2 = MCConfig.GetStringDefault("irc.gm2", "[Game Master]");
sIRC.ojGM3 = MCConfig.GetStringDefault("irc.gm3", "[BugTracker]");
sIRC.ojGM4 = MCConfig.GetStringDefault("irc.gm4", "[DevTeam Admin]");
sIRC.ojGM5 = MCConfig.GetStringDefault("irc.gm5", "[Root Admin]");
// REQUIRED GM LEVEL
QueryResult *result = WorldDatabase.PQuery("SELECT `Command`, `gmlevel` FROM `IRC_Commands` ORDER BY `Command`");
if(result)
{
Field *fields = result->Fetch();
for (uint64 i=0; i < result->GetRowCount(); i++)
{
std::string command = fields[0].GetCppString();
uint32 gmlvl = fields[1].GetUInt32();
if(command == "acct") sIRC.CACCT = gmlvl;
if(command == "ban") sIRC.CBAN = gmlvl;
if(command == "char") sIRC.CCHAN = gmlvl;
if(command == "char") sIRC.CCHAR = gmlvl;
if(command == "fun") sIRC.CFUN = gmlvl;
if(command == "help") sIRC.CHELP = gmlvl;
if(command == "inchan") sIRC.CINCHAN = gmlvl;
if(command == "info") sIRC.CINFO = gmlvl;
if(command == "item") sIRC.CITEM = gmlvl;
if(command == "jail") sIRC.CJAIL = gmlvl;
if(command == "kick") sIRC.CKICK = gmlvl;
if(command == "kill") sIRC._KILL = gmlvl;
if(command == "level") sIRC.CLEVEL = gmlvl;
if(command == "lookup") sIRC.CLOOKUP = gmlvl;
if(command == "money") sIRC.CMONEY = gmlvl;
if(command == "mute") sIRC.CMUTE = gmlvl;
if(command == "online") sIRC.CONLINE = gmlvl;
if(command == "pm") sIRC.CPM = gmlvl;
if(command == "restart") sIRC.CRESTART = gmlvl;
if(command == "revive") sIRC.CREVIVE = gmlvl;
if(command == "saveall") sIRC.CSAVEALL = gmlvl;
if(command == "shutdown") sIRC.CSHUTDOWN = gmlvl;
if(command == "spell") sIRC.CSPELL = gmlvl;
if(command == "sysmsg") sIRC.CSYSMSG = gmlvl;
if(command == "tele") sIRC.CTELE = gmlvl;
if(command == "top") sIRC.CTOP = gmlvl;
if(command == "who") sIRC.CWHO = gmlvl;
result->NextRow();
}
delete result;
}
else
{
sIRC.CACCT = 3;
sIRC.CBAN = 3;
sIRC.CCHAN = 3;
sIRC.CCHAR = 3;
sIRC.CFUN = 3;
sIRC.CHELP = 3;
sIRC.CINCHAN = 3;
sIRC.CINFO = 3;
sIRC.CITEM = 3;
sIRC.CJAIL = 3;
sIRC.CKICK = 3;
sIRC._KILL = 3;
sIRC.CLEVEL = 3;
sIRC.CLOOKUP = 3;
sIRC.CMONEY = 3;
sIRC.CMUTE = 3;
sIRC.CONLINE = 3;
sIRC.CPM = 3;
sIRC.CRESTART = 3;
sIRC.CREVIVE = 3;
sIRC.CSAVEALL = 3;
sIRC.CSHUTDOWN = 3;
sIRC.CSPELL = 3;
sIRC.CSYSMSG = 3;
sIRC.CTELE = 3;
sIRC.CTOP = 3;
sIRC.CWHO = 3;
}
return true;
}
std::string IRCClient::GetChatLine(int nItem)
{
return sIRC.ILINES[nItem];
}
+16
View File
@@ -0,0 +1,16 @@
#ifndef MC_CONFIG_H
#define MC_CONFIG_H
#include "../framework/Platform/CompilerDefs.h"
// Format is YYYYMMDDRR where RR is the change in the conf file
// for that day.
#define MANGCHAT_CONF_VERSION 2008011901
#if PLATFORM == PLATFORM_WINDOWS
#define _MANGCHAT_CONFIG "trinitycore.conf"
#else
#define _MANGCHAT_CONFIG "@sysconfdir@/trinitycore.conf"
#endif
#endif
+16
View File
@@ -0,0 +1,16 @@
#ifndef MC_CONFIG_H
#define MC_CONFIG_H
#include "../framework/Platform/CompilerDefs.h"
// Format is YYYYMMDDRR where RR is the change in the conf file
// for that day.
#define MANGCHAT_CONF_VERSION 2008011901
#if PLATFORM == PLATFORM_WINDOWS
#define _MANGCHAT_CONFIG "trinitycore.conf"
#else
#define _MANGCHAT_CONFIG "@sysconfdir@/trinitycore.conf"
#endif
#endif
+251
View File
@@ -0,0 +1,251 @@
#ifndef _IRC_CLIENT_FUNC
#define _IRC_CLIENT_FUNC
std::string GetUser(std::string szU)
{
int pos = szU.find("!");
return szU.substr(0, pos);
}
// Delink will remove anything considered "non chat" from a string
// Linked items (items that players can click on to see a description)
// contain extra characters wich the client filter out, this function
// makes sure people on irc do not see those characters.
std::string Delink(std::string msg)
{
std::size_t pos;
while((pos = msg.find("|Hitem")) != std::string::npos)
{
std::size_t find1 = msg.find("|h", pos);
std::size_t find2 = msg.find("|h", find1 + 2);
msg.replace(pos, find1 - pos + 2, "\x2");
msg.replace(msg.find("|h", pos), 2, "\x2");
}
while((pos = msg.find("|Henchant")) != std::string::npos)
{
std::size_t find1 = msg.find("|h", pos);
std::size_t find2 = msg.find("|h", find1 + 2);
msg.replace(pos, find1 - pos + 2, "\x2");
msg.replace(msg.find("|h", pos), 2, "\x2");
//msg.replace(find2, 2, "\x2");
}
return msg;
}
// This function converts the characters used by the client to identify colour to IRC format.
std::string WoWcol2IRC(std::string msg)
{
std::size_t pos;
char IRCCol[9][4] = { "\xF", "\xF", "\x3\x31\x34", "\x3\x30\x33", "\x3\x31\x32", "\x3\x30\x36", "\x3\x30\x37", "\x3\x30\x34", "\x3\x30\x37"};
char WoWCol[9][12] = { "|r", "|cffffffff", "|cff9d9d9d", "|cff1eff00", "|cff0070dd", "|cffa335ee", "|cffff8000", "|cffe6cc80", "|cffffd000"};
for (int i=0; i<=8; i++)
{
while ((pos = msg.find(WoWCol[i])) != std::string::npos)
{
if (i == 0)
msg.replace(pos, 2, IRCCol[i]);
else
msg.replace(pos, 10, IRCCol[i]);
}
}
return msg;
}
// This function converts the characters used by IRC to identify colour to a format the client can understand.
std::string IRCcol2WoW(std::string msg)
{
std::size_t pos;
char IRCCol[16][4] = { "\x3\x30", "\x3\x31", "\x3\x32", "\x3\x33", "\x3\x34", "\x3\x35", "\x3\x36", "\x3\x37", "\x3\x38", "\x3\x39", "\x3\x31\x30", "\x3\x31\x31", "\x3\x31\x32", "\x3\x31\x33", "\x3\x31\x34", "\x3\x31\x35"};
char IRCCol2[10][4] = { "\x3\x30\x30", "\x3\x30\x31", "\x3\x30\x32", "\x3\x30\x33", "\x3\x30\x34", "\x3\x30\x35", "\x3\x30\x36", "\x3\x30\x37", "\x3\x30\x38", "\x3\x30\x39"};
char WoWcol[16][12] = { "|cffffffff", "|cff000000", "|cff00007f", "|cff009300", "|cffff0000", "|cff7f0000", "|cff9c009c", "|cfffc9300", "|cffffff00", "|cff00fc00", "|cff009393", "|cff00ffff", "|cff0000fc", "|cffff00ff", "|cff7f7f7f", "|cffd2d2d2"};
for (int i=15; i>=0; i--)
{
if (i<10)
{
while ((pos = msg.find(IRCCol2[i])) != std::string::npos)
{
msg.replace(pos, 3, WoWcol[i]);
}
while ((pos = msg.find(IRCCol[i])) != std::string::npos)
{
msg.replace(pos, 2, WoWcol[i]);
}
}
else
{
while ((pos = msg.find(IRCCol[i])) != std::string::npos)
{
msg.replace(pos, 3, WoWcol[i]);
}
}
// Remove Bold, Reverse, Underline from IRC
char Checker[3][3] = {"\x2","\x16","\x1F"}; // This is the Hex part not Dec. In Decimal its (2,22,31)
for(int I=0; I < 3; I++)
{
while ((pos = msg.find(Checker[I])) != std::string::npos)
{
msg.replace(pos, 1, "");
}
}
// Finished Removing !
}
while ((pos = msg.find("\x3")) != std::string::npos)
{
msg.replace(pos, 1, "|r");
}
while ((pos = msg.find("\xF")) != std::string::npos)
{
msg.replace(pos, 1, "|r");
}
return msg;
}
// This function compares 2 strings
int nocase_cmp(const string & s1, const string& s2)
{
string::const_iterator it1=s1.begin();
string::const_iterator it2=s2.begin();
//stop when either string's end has been reached
while ( (it1!=s1.end()) && (it2!=s2.end()) )
{
if(::toupper(*it1) != ::toupper(*it2)) //letters differ?
// return -1 to indicate smaller than, 1 otherwise
return (::toupper(*it1) < ::toupper(*it2)) ? -1 : 1;
//proceed to the next character in each string
++it1;
++it2;
}
size_t size1=s1.size(), size2=s2.size(); // cache lengths
//return -1,0 or 1 according to strings' lengths
if (size1==size2)
return 0;
return (size1<size2) ? -1 : 1;
}
std::string MakeMsgA(const char *sLine, ... )
{
va_list ap;
char tmpoutp[1024];
va_start(ap, sLine);
vsnprintf(tmpoutp, 1024, sLine, ap );
va_end(ap);
std::string outp = tmpoutp;
return outp;
}
std::string MakeMsgP(int CLINE, std::string Msg, Player *plr)
{
// std::string ChatTag = "";
// switch (plr->GetTeam())
// {
// case 67:ChatTag.append("4");break; //horde
// case 469:ChatTag.append("12");break; //alliance
// }
std::string sMsg = sIRC.MakeMsg(sIRC.GetChatLine(CLINE), "$Msg", Msg);
// sMsg = ChatTag + MakeMsg(sMsg, "$Name", plr->GetName());
if (plr->GetTeam() == 67)
sMsg = sIRC.MakeMsg(sMsg, "$Name", MakeMsgA("\0034%s\003", plr->GetName()));
else if (plr->GetTeam() == 469)
sMsg = sIRC.MakeMsg(sMsg, "$Name", MakeMsgA("\00312%s\003", plr->GetName()));
if(plr->isAFK())
sMsg = sIRC.MakeMsg(sMsg, "$Tag", "<AFK>");
else if(plr->isDND())
sMsg = sIRC.MakeMsg(sMsg, "$Tag", "<DND>");
else
sMsg = sIRC.MakeMsg(sMsg, "$Tag", "");
sMsg = sIRC.MakeMsg(sMsg, "$Level", MakeMsgA("%d", plr->getLevel()));
sMsg = Delink(sMsg);
sMsg = WoWcol2IRC(sMsg);
return sMsg;
}
/*
std::string MakeMsg(std::string msg, std::string var, int val)
{
std::ostringstream ss;
ss << val;
std::string nval = ss.str();
std::size_t start = msg.find(var);
if (start != std::string::npos)
msg.replace(start, var.length(), val);
return msg;
}
*/
/*
std::string MakeMsg(const char *sLine, ... )
{
va_list ap;
char tmpoutp[1024];
va_start(ap, sLine);
vsnprintf(tmpoutp, 1024, sLine, ap );
va_end(ap);
std::string outp = tmpoutp;
return outp;
}
*/
// This function checks if a channel exists in out configuration
// Mangchat supports as many channels as you like
// However the default has been set to 10
// if you wish to increase this you must edit the:
// MAX_CONF_CHANNELS variable in IRCClient.h
bool Channel_Valid(std::string Channel)
{
for(int i=1;i < sIRC._chan_count + 1;i++)
{
if(nocase_cmp(sIRC._wow_chan[i], Channel)==0)
return true;
}
return false;
}
std::string GetWoWChannel(std::string Channel)
{
for(int i=1;i < sIRC._chan_count + 1;i++)
{
if("#" + sIRC._irc_chan[i] == Channel)
return sIRC._wow_chan[i];
}
return "";
}
std::string GetIRCChannel(std::string Channel)
{
for(int i=1;i < sIRC._chan_count + 1;i++)
{
if(sIRC._wow_chan[i] == Channel)
return sIRC._irc_chan[i];
}
return "";
}
std::string* getArray(std::string PARAMS, int nCount, std::string )
{
std::string *array = new std::string[nCount];
if(PARAMS.size() > 0)
{
int pcnt = 0;
size_t ps = 0;
size_t pc = -1;
for(int i = 0;i < nCount;i++)
{
pc = PARAMS.find(" ", pc + 1);
if(i + 1 == nCount && nCount != 1)
{
if(ps > 0 && pc > 0)
array[i] = PARAMS.substr(ps, PARAMS.size() - ps);
}
else
array[i] = PARAMS.substr(ps, pc - ps);
ps = pc + 1;
}
}
return array;
}
#endif
+436
View File
@@ -0,0 +1,436 @@
#include "IRCClient.h"
#include "IRCCmd.h"
#include "IRCFunc.h"
#include "ObjectAccessor.h"
#include "ObjectMgr.h"
#include "WorldPacket.h"
#include "ChannelMgr.h"
#include "Config/ConfigEnv.h"
#include "Channel.h"
#include "World.h"
IRCCmd Command;
void IRCClient::Handle_IRC(std::string sData)
{
sLog.outDebug(sData.c_str());
// If first 5 chars are ERROR then something is wrong
// either link is being closed, nickserv ghost command, etc...
if(sData.substr(0, 5) == "ERROR")
{
Disconnect();
return;
}
if(sData.substr(0, 4) == "PING")
{
// if the first 4 characters contain PING
// the server is checking if we are still alive
// sen back PONG back plus whatever the server send with it
SendIRC("PONG " + sData.substr(4, sData.size() - 4));
}
else
{
// if the first line contains : its an irc message
// such as private messages channel join etc.
if(sData.substr(0, 1) == ":")
{
// find the spaces in the receieved line
size_t p1 = sData.find(" ");
size_t p2 = sData.find(" ", p1 + 1);
// because the irc protocol uses simple spaces
// to seperate data we can easy pick them out
// since we know the position of the spaces
std::string USR = sData.substr(1, p1 - 1);
std::string CMD = sData.substr(p1 + 1, p2 - p1 - 1);
// trasform the commands to lowercase to make sure they always match
std::transform(CMD.begin(), CMD.end(), CMD.begin(), towlower);
// Extract the username from the first part
std::string szUser = GetUser(USR);
// if we receieved the internet connect code
// we know for sure that were in and we can
// authenticate ourself.
if(CMD == sIRC._ICC)
{
// _Auth is defined in mangosd.conf (irc.auth)
// 0 do not authenticate
// 1 use nickserv
// 2 use quakenet
// aditionally you can provide you own authentication method here
switch(sIRC._Auth)
{
case 1:
SendIRC("PRIVMSG nickserv :IDENTIFY " + sIRC._Pass);
break;
case 2:
SendIRC("PRIVMSG nickserv :IDENTIFY " + sIRC._Auth_Nick + " " + sIRC._Pass);
break;
case 3:
SendIRC("PRIVMSG Q@CServe.quakenet.org :AUTH " + sIRC._Nick + " " + sIRC._Pass);
break;
case 4:
SendIRC("PRIVMSG Q@CServe.quakenet.org :AUTH " + sIRC._Auth_Nick + " " + sIRC._Pass);
break;
}
// if we join a default channel leave this now.
if(sIRC._ldefc==1)
SendIRC("PART #" + sIRC._defchan);
// Loop thru the channel array and send a command to join them on IRC.
for(int i=1;i < sIRC._chan_count + 1;i++)
{
SendIRC("JOIN #" + sIRC._irc_chan[i]);
}
}
// someone joined the channel this could be the bot or another user
if(CMD == "join")
{
size_t p = sData.find(":", p1);
std::string CHAN = sData.substr(p + 1, sData.size() - p - 2);
// if the user is us it means we join the channel
if ((szUser == sIRC._Nick) )
{
// its us that joined the channel
Send_IRC_Channel(CHAN, MakeMsg(MakeMsg(sIRC.JoinMsg, "$Ver", sIRC._Mver.c_str()), "$Trigger", sIRC._cmd_prefx.c_str()), true);
}
else
{
// if the user is not us its someone else that joins
// so we construct a message and send this to the clients.
// MangChat now uses Send_WoW_Channel to send to the client
// this makes MangChat handle the packets instead of previously the world.
if((sIRC.BOTMASK & 2) != 0)
Send_WoW_Channel(GetWoWChannel(CHAN).c_str(), IRCcol2WoW(MakeMsg(MakeMsg(GetChatLine(JOIN_IRC), "$Name", szUser), "$Channel", GetWoWChannel(CHAN))));
}
}
// someone on irc left or quit the channel
if(CMD == "part" || CMD == "quit")
{
size_t p3 = sData.find(" ", p2 + 1);
std::string CHAN = sData.substr(p2 + 1, p3 - p2 - 1);
// Logout IRC Nick From MangChat If User Leaves Or Quits IRC.
if(Command.IsLoggedIn(szUser))
{
_CDATA CDATA;
CDATA.USER = szUser;
Command.Handle_Logout(&CDATA);
}
// Construct a message and inform the clients on the same channel.
if((sIRC.BOTMASK & 2) != 0)
Send_WoW_Channel(GetWoWChannel(CHAN).c_str(), IRCcol2WoW(MakeMsg(MakeMsg(GetChatLine(LEAVE_IRC), "$Name", szUser), "$Channel", GetWoWChannel(CHAN))));
}
// someone changed their nick
if (CMD == "nick" && (sIRC.BOTMASK & 128) != 0)
{
MakeMsg(MakeMsg(GetChatLine(CHANGE_NICK), "$Name", szUser), "$NewName", sData.substr(sData.find(":", p2) + 1));
// If the user is logged in and changes their nick
// then we want to either log them out or update
// their nick in the bot. I chose to update the bots user list.
if(Command.IsLoggedIn(szUser))
{
std::string NewNick = sData.substr(sData.find(":", p2) + 1);
// On freenode I noticed the server sends an extra character
// at the end of the string, so we need to erase the last
// character of the string. if you have a problem with getting
// the last letter of your nick erased, then remove the - 1.
NewNick.erase(NewNick.length() - 1, 1);
for(std::list<_client*>::iterator i=Command._CLIENTS.begin(); i!=Command._CLIENTS.end();i++)
{
if((*i)->Name == szUser)
{
(*i)->Name = NewNick;
sIRC.Send_IRC_Channel(NewNick.c_str(), "I Noticed You Changed Your Nick, I Have Updated My Internal Database Accordingly.", true, "NOTICE");
// Figure why not output to the logfile, makes tracing problems easier.
sIRC.iLog.WriteLog(" %s : %s Changed Nick To: %s", sIRC.iLog.GetLogDateTimeStr().c_str(), szUser.c_str(), NewNick.c_str());
}
}
}
}
// someone was kicked from irc
if (CMD == "kick")
{
// extract the details
size_t p3 = sData.find(" ", p2 + 1);
size_t p4 = sData.find(" ", p3 + 1);
size_t p5 = sData.find(":", p4);
std::string CHAN = sData.substr(p2 + 1, p3 - p2 - 1);
std::string WHO = sData.substr(p3 + 1, p4 - p3 - 1);
std::string BY = sData.substr(p4 + 1, sData.size() - p4 - 1);
// if the one kicked was us
if(WHO == sIRC._Nick)
{
// and autojoin is enabled
// return to the channel
if(sIRC._autojoinkick == 1)
{
SendIRC("JOIN " + CHAN);
Send_IRC_Channel(CHAN, sIRC.kikmsg, true);
}
}
else
{
// if it is not us who was kicked we need to inform the clients someone
// was removed from the channel
// construct a message and send it to the players.
Send_WoW_Channel(GetWoWChannel(CHAN).c_str(), "<IRC>[" + WHO + "]: Was Kicked From " + CHAN + " By: " + szUser);
}
}
// a private chat message was receieved.
if(CMD == "privmsg" || CMD == "notice")
{
// extract the values
size_t p = sData.find(" ", p2 + 1);
std::string FROM = sData.substr(p2 + 1, p - p2 - 1);
std::string CHAT = sData.substr(p + 2, sData.size() - p - 3);
// if this is our username it means we recieved a PM
if(FROM == sIRC._Nick)
{
if(CHAT.find("\001VERSION\001") < CHAT.size())
{
Send_IRC_Channel(szUser, MakeMsg("\001VERSION MangChat %s ©2008 |Death|\001", "%s" , sIRC._Mver.c_str()), true, "PRIVMSG");
}
// a pm is required for certain commands
// such as login. to validate the command
// we send it to the command class wich handles
// evrything else.
Command.IsValid(szUser, FROM, CHAT, CMD);
}
else
{
// if our name is not in it, it means we receieved chat on one of the channels
// magchat is in. the first thing we do is check if it is a command or not
if(!Command.IsValid(szUser, FROM, CHAT, CMD))
{
Send_WoW_Channel(GetWoWChannel(FROM).c_str(), IRCcol2WoW(MakeMsg(MakeMsg(GetChatLine(IRC_WOW), "$Name", szUser), "$Msg", CHAT)));
}
// if we indeed receieved a command we do not want to display this to the players
// so only incanse the isvalid command returns false it will be sent to all player.
// the isvalid function will automaitcly process the command on true.
}
}
if(CMD == "mode")
{
// extract the mode details
size_t p3 = sData.find(" ", p2 + 1);
size_t p4 = sData.find(" ", p3 + 1);
size_t p5 = sData.find(" ", p4 + 1);
std::string CHAN = sData.substr(p2 + 1, p3 - p2 - 1);
std::string MODE = sData.substr(p3 + 1, p4 - p3 - 1);
std::string NICK = sData.substr(p4 + 1, p5 - p4 - 1);
bool _AmiOp;
_AmiOp = false;
//A mode was changed on us
if(NICK.c_str() == sIRC._Nick)
_AmiOp = true;
}
}
}
}
// This function is called in Channel.h
// based on nAction it will inform the people on
// irc when someone leaves one of the game channels.
// nAction is based on the struct CACTION
void IRCClient::Handle_WoW_Channel(std::string Channel, Player *plr, int nAction)
{
// make sure that we are connected
if(sIRC.Connected && (sIRC.BOTMASK & 1)!= 0)
{
if(Channel_Valid(Channel))
{
std::string GMRank = "";
std::string pname = plr->GetName();
bool DoGMAnnounce = false;
if (plr->GetSession()->GetSecurity() > 0 && (sIRC.BOTMASK & 8)!= 0)
DoGMAnnounce = true;
if (plr->isGameMaster() && (sIRC.BOTMASK & 16)!= 0)
DoGMAnnounce = true;
if(DoGMAnnounce)
{
switch(plr->GetSession()->GetSecurity()) //switch case to determine what rank the "gm" is
{
case 0: GMRank = "";break;
case 1: GMRank = "\0037"+sIRC.ojGM1;break;
case 2: GMRank = "\0037"+sIRC.ojGM2;break;
case 3: GMRank = "\0037"+sIRC.ojGM3;break;
case 4: GMRank = "\0037"+sIRC.ojGM4;break;
case 5: GMRank = "\0037"+sIRC.ojGM5;break;
}
}
std::string ChatTag = "";
switch (plr->GetTeam())
{
case 67:ChatTag.append("\0034");break; //horde
case 469:ChatTag.append("\00312");break; //alliance
}
std::string query = "INSERT INTO `IRC_Inchan` VALUES (%d,'"+pname+"','"+Channel+"')";
std::string lchan = "DELETE FROM `IRC_Inchan` WHERE `guid` = %d AND `channel` = '"+Channel+"'";
switch(nAction)
{
case CHANNEL_JOIN:
Send_IRC_Channel(GetIRCChannel(Channel), MakeMsg(MakeMsg(MakeMsg(GetChatLine(JOIN_WOW), "$Name", ChatTag + plr->GetName()), "$Channel", Channel), "$GM", GMRank));
WorldDatabase.PExecute(lchan.c_str(), plr->GetGUID());
WorldDatabase.PExecute(query.c_str(), plr->GetGUID());
break;
case CHANNEL_LEAVE:
Send_IRC_Channel(GetIRCChannel(Channel), MakeMsg(MakeMsg(MakeMsg(GetChatLine(LEAVE_WOW), "$Name", ChatTag + plr->GetName()), "$Channel", Channel), "$GM", GMRank));
WorldDatabase.PExecute(lchan.c_str(), plr->GetGUID());
break;
}
}
}
}
// This function sends chat to a irc channel or user
// to prevent the # beeing appended to send a msg to a user
// set the NoPrefix to true
void IRCClient::Send_IRC_Channel(std::string sChannel, std::string sMsg, bool NoPrefix, std::string nType)
{
std::string mType = "PRIVMSG";
if(Command.MakeUpper(nType.c_str()) == "NOTICE")
mType = "NOTICE";
if(Command.MakeUpper(nType.c_str()) == "ERROR" && (sIRC.BOTMASK & 32)!= 0)
mType = "NOTICE";
if(sIRC.Connected)
{
if(NoPrefix)
SendIRC(mType + " " + sChannel + " :" + sMsg);
else
SendIRC(mType + " #" + sChannel + " :" + sMsg);
}
}
// This function sends a message to all irc channels
// that mangchat has in its configuration
void IRCClient::Send_IRC_Channels(std::string sMsg)
{
for(int i=1;i < sIRC._chan_count + 1;i++)
Send_IRC_Channel(sIRC._irc_chan[i], sMsg);
}
// This function is called in ChatHandler.cpp, any channel chat from wow will come
// to this function, validates the channel and constructs a message that is send to IRC
void IRCClient::Send_WoW_IRC(Player *plr, std::string Channel, std::string Msg)
{
// Check if the channel exist in our configuration
if(Channel_Valid(Channel) && Msg.substr(0, 1) != ".")
Send_IRC_Channel(GetIRCChannel(Channel), MakeMsgP(WOW_IRC, Msg, plr));
}
void IRCClient::Send_WoW_Player(std::string sPlayer, std::string sMsg)
{
normalizePlayerName(sPlayer);
if (Player* plr = ObjectAccessor::Instance().FindPlayerByName(sPlayer.c_str()))
Send_WoW_Player(plr, sMsg);
}
void IRCClient::Send_WoW_Player(Player *plr, string sMsg)
{
WorldPacket data(SMSG_MESSAGECHAT, 200);
data << (uint8)CHAT_MSG_SYSTEM;
data << (uint32)LANG_UNIVERSAL;
data << (uint64)plr->GetGUID();
data << (uint32)0;
data << (uint64)plr->GetGUID();
data << (uint32)(sMsg.length()+1);
data << sMsg;
data << (uint8)0;
plr->GetSession()->SendPacket(&data);
}
// This function will construct and send a packet to all players
// on the given channel ingame. (previuosly found in world.cpp)
// it loops thru all sessions and checks if they are on the channel
// if so construct a packet and send it.
void IRCClient::Send_WoW_Channel(const char *channel, std::string chat)
{
if(!(strlen(channel) > 0))
return;
#ifdef USE_UTF8
std::string chat2 = chat;
if(ConvertUTF8(chat2.c_str(), chat2))
chat = chat2;
#endif
HashMapHolder<Player>::MapType& m = ObjectAccessor::Instance().GetPlayers();
for(HashMapHolder<Player>::MapType::iterator itr = m.begin(); itr != m.end(); ++itr)
{
if (itr->second && itr->second->GetSession()->GetPlayer() && itr->second->GetSession()->GetPlayer()->IsInWorld())
{
if(ChannelMgr* cMgr = channelMgr(itr->second->GetSession()->GetPlayer()->GetTeam()))
{
if(Channel *chn = cMgr->GetChannel(channel, itr->second->GetSession()->GetPlayer()))
{
WorldPacket data;
data.Initialize(SMSG_MESSAGECHAT);
data << (uint8)CHAT_MSG_CHANNEL;
data << (uint32)LANG_UNIVERSAL;
data << (uint64)0;
data << (uint32)0;
data << channel;
data << (uint64)0;
data << (uint32) (strlen(chat.c_str()) + 1);
data << IRCcol2WoW(chat.c_str());
data << (uint8)0;
itr->second->GetSession()->SendPacket(&data);
}
}
}
}
}
void IRCClient::Send_WoW_System(std::string Message)
{
HashMapHolder<Player>::MapType& m = ObjectAccessor::Instance().GetPlayers();
for(HashMapHolder<Player>::MapType::iterator itr = m.begin(); itr != m.end(); ++itr)
{
if (itr->second && itr->second->GetSession()->GetPlayer() && itr->second->GetSession()->GetPlayer()->IsInWorld())
{
WorldPacket data;
data.Initialize(CHAT_MSG_SYSTEM);
data << (uint8)CHAT_MSG_SYSTEM;
data << (uint32)LANG_UNIVERSAL;
data << (uint64)0;
data << (uint32)0;
data << (uint64)0;
data << (uint32) (strlen(Message.c_str()) + 1);
data << Message.c_str();
data << (uint8)0;
itr->second->GetSession()->SendPacket(&data);
}
}
}
void IRCClient::ResetIRC()
{
SendData("QUIT");
Disconnect();
}
#define CHAT_INVITE_NOTICE 0x18
// this function should be called on player login Player::AddToWorld
void IRCClient::AutoJoinChannel(Player *plr)
{
//this will work if at least 1 player is logged in regrdless if he is on the channel or not
// the first person that login empty server is the one with bad luck and wont be invited,
// if at least 1 player is online the player will be inited to the chanel
std::string m_name = sIRC.ajchan;
WorldPacket data;
data.Initialize(SMSG_CHANNEL_NOTIFY, 1+m_name.size()+1);
data << uint8(CHAT_INVITE_NOTICE);
data << m_name.c_str();
HashMapHolder<Player>::MapType& m = ObjectAccessor::Instance().GetPlayers();
for(HashMapHolder<Player>::MapType::iterator itr = m.begin(); itr != m.end(); ++itr)
{
if (itr->second && itr->second->GetSession()->GetPlayer() && itr->second->GetSession()->GetPlayer()->IsInWorld())
{
data << uint64(itr->second->GetGUID());
break;
}
}
plr->GetSession()->SendPacket(&data);
}
+60
View File
@@ -0,0 +1,60 @@
#include "IRCLog.h"
#include "Config/ConfigEnv.h"
#include "IRCClient.h"
#include <stdarg.h>
IRCLog::IRCLog()
{
std::string logsDir = sConfig.GetStringDefault("LogsDir","");
std::string ircLogName = logsDir + "/IRC_";
std::string ircLogTimestamp = GetLogDateStr();
ircLogName += ircLogTimestamp +".log";
ircLogfile.open (ircLogName.c_str(), std::ios::app);
}
IRCLog::~IRCLog()
{
ircLogfile.close();
}
// Was added because using the time for logs is very annoying... one log per day.. much cleaner looking..
std::string IRCLog::GetLogDateStr() const
{
time_t t = time(NULL);
tm* aTm = localtime(&t);
// YYYY year
// MM month (2 digits 01-12)
// DD day (2 digits 01-31)
// HH hour (2 digits 00-23)
// MM minutes (2 digits 00-59)
// SS seconds (2 digits 00-59)
char buf[20];
snprintf(buf,20,"%04d-%02d-%02d",aTm->tm_year+1900,aTm->tm_mon+1,aTm->tm_mday);
return std::string(buf);
}
std::string IRCLog::GetLogDateTimeStr() const
{
time_t t = time(NULL);
tm* aTm = localtime(&t);
// YYYY year
// MM month (2 digits 01-12)
// DD day (2 digits 01-31)
// HH hour (2 digits 00-23)
// MM minutes (2 digits 00-59)
// SS seconds (2 digits 00-59)
char buf[30];
snprintf(buf,30,"[ %04d-%02d-%02d ] [ %02d:%02d:%02d ]",aTm->tm_year+1900,aTm->tm_mon+1,aTm->tm_mday,aTm->tm_hour,aTm->tm_min,aTm->tm_sec);
return std::string(buf);
}
void IRCLog::WriteLog(const char *what, ...)
{
va_list ap;
char tmpoutp[1024];
va_start(ap, what);
vsnprintf(tmpoutp, 1024, what, ap );
va_end(ap);
ircLogfile << tmpoutp;
ircLogfile << "\n";
ircLogfile.flush();
}
+22
View File
@@ -0,0 +1,22 @@
#ifndef _IRC_LOG_H
#define _IRC_LOG_H
#include "Common.h"
#include <fstream>
class IRCLog
{
public:
IRCLog();
~IRCLog();
public:
void WriteLog(const char *what, ...);
std::string GetLogDateStr() const;
std::string GetLogDateTimeStr() const;
private:
std::ofstream ircLogfile;
};
#endif
+146
View File
@@ -0,0 +1,146 @@
#include "IRCClient.h"
#define MAXDATASIZE 512
#include <fcntl.h>
#include <stdio.h>
#include <sys/types.h>
#define _UNICODE
#ifdef _MBCS
#undef _MBCS
#endif
bool IRCClient::InitSock()
{
#ifdef _WIN32
WSADATA wsaData; //WSAData
if(WSAStartup(MAKEWORD(2,0),&wsaData) != 0)
{
sLog.outError("IRC Error: Winsock Initialization Error");
return false;
}
#endif
if ((sIRC.SOCKET = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1)
{
sLog.outError("IRC Error: Socket Error");
return false;
}
int on = 1;
if ( setsockopt ( sIRC.SOCKET, SOL_SOCKET, SO_REUSEADDR, ( const char* ) &on, sizeof ( on ) ) == -1 )
{
sLog.outError("IRC Error: Invalid Socket");
return false;
}
#ifdef _WIN32
u_long iMode = 0;
ioctlsocket(sIRC.SOCKET, FIONBIO, &iMode);
#else
fcntl(sIRC.SOCKET, F_SETFL, O_NONBLOCK); // set to non-blocking
fcntl(sIRC.SOCKET, F_SETFL, O_ASYNC); // set to asynchronous I/O
#endif
return true;
}
bool IRCClient::Connect(const char *cHost, int nPort)
{
sIRC.Connected = false;
struct hostent *he;
if ((he=gethostbyname(cHost)) == NULL)
{
sLog.outError("IRCLIENT: Could not resolve host: %s", cHost);
return false;
}
struct sockaddr_in their_addr;
their_addr.sin_family = AF_INET;
their_addr.sin_port = htons(nPort);
their_addr.sin_addr = *((struct in_addr *)he->h_addr);
memset(&(their_addr.sin_zero), '\0', 8);
if (::connect(sIRC.SOCKET, (struct sockaddr *)&their_addr, sizeof(struct sockaddr)) == -1)
{
sLog.outError("IRCLIENT: Cannot connect to %s", cHost);
return false;
}
//FD_ZERO(&sIRC.sfdset);
//FD_SET(sIRC.SOCKET,&sIRC.sfdset);
sIRC.Connected = true;
return true;
}
bool IRCClient::Login(std::string sNick, std::string sUser, std::string sPass)
{
char hostname[128];
gethostname(hostname, sizeof(hostname));
if(SendIRC("HELLO"))
if(SendIRC("PASS " + sPass))
if(SendIRC("NICK " + sNick))
if(SendIRC("USER " + sUser + " " + (std::string)hostname + " MangChat :MangChat "+sIRC._Mver.c_str()))
return true;
return false;
}
bool IRCClient::SendData(const char *data)
{
if(sIRC.Connected)
{
if (send(sIRC.SOCKET, data, strlen(data), 0) == -1)
{
sLog.outError("IRC Error: Socket Receieve ** \n");
//Disconnect();
return false;
}
}
return true;
}
bool IRCClient::SendIRC(std::string data)
{
std::string RealData = data + "\n";
return SendData(RealData.c_str());
}
void IRCClient::Disconnect()
{
if(sIRC.SOCKET)
{
#ifdef _WIN32
closesocket(sIRC.SOCKET);
//WSACleanup();
#else
close(sIRC.SOCKET);
#endif
}
}
void IRCClient::SockRecv()
{
// wchar_t bufferdata;
char szBuffer[MAXDATASIZE];
memset(szBuffer, 0, MAXDATASIZE );
int nBytesRecv = ::recv(sIRC.SOCKET, szBuffer, MAXDATASIZE - 1, 0 );
if ( nBytesRecv == -1 )
{
sLog.outError("Connection lost.");
sIRC.Connected = false;
}
else
{
if (-1 == nBytesRecv)
{
sLog.outError("Error occurred while receiving from socket.");
}
else
{
std::string reply;
std::istringstream iss(szBuffer);
while(getline(iss, reply))
{
Handle_IRC(reply);
}
}
}
}
+2
View File
@@ -640,6 +640,8 @@ enum MangosStrings
LANG_ARENA_TESTING = 745,
LANG_AUTO_ANN = 746,
// in game strings
LANG_PET_INVALID_NAME = 800,
LANG_NOT_ENOUGH_GOLD = 801,
+35
View File
@@ -31,6 +31,7 @@
#include "Language.h"
#include "CellImpl.h"
#include "InstanceSaveMgr.h"
#include "IRCClient.h"
#include "Util.h"
#ifdef _DEBUG_VMAPS
#include "VMapFactory.h"
@@ -123,6 +124,14 @@ bool ChatHandler::HandleAnnounceCommand(const char* args)
return false;
sWorld.SendWorldText(LANG_SYSTEMMESSAGE,args);
if((sIRC.BOTMASK & 256) != 0)
{
std::string ircchan = "#";
ircchan += sIRC._irc_chan[sIRC.anchn].c_str();
sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 System Message \00304,08\037/!\\\037\017 %s", "%s", args), true);
}
return true;
}
@@ -139,6 +148,13 @@ bool ChatHandler::HandleNotifyCommand(const char* args)
data << str;
sWorld.SendGlobalMessage(&data);
if((sIRC.BOTMASK & 256) != 0)
{
std::string ircchan = "#";
ircchan += sIRC._irc_chan[sIRC.anchn].c_str();
sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 Global Notify \00304,08\037/!\\\037\017 %s", "%s", args), true);
}
return true;
}
@@ -2348,6 +2364,25 @@ bool ChatHandler::HandleGoXYZCommand(const char* args)
return true;
}
bool ChatHandler::HandleIRCpmCommand(const char* args)
{
std::string Msg = args;
if (Msg.find(" ") == std::string::npos)
return false;
std::string To = Msg.substr(0, Msg.find(" "));
Msg = Msg.substr(Msg.find(" ") + 1);
std::size_t pos;
while((pos = To.find("||")) != std::string::npos)
{
std::size_t find1 = To.find("||", pos);
To.replace(pos, find1 - pos + 2, "|");
}
sIRC.SendIRC("PRIVMSG "+To+" : <WoW>["+m_session->GetPlayerName()+"] : " + Msg);
//Msg = "|cffCC4ACCTo [" + To + "]: " + Msg + "|r";
sIRC.Send_WoW_Player(m_session->GetPlayer(), "|cffCC4ACCTo ["+To+"]: "+Msg);
return true;
}
//teleport at coordinates
bool ChatHandler::HandleGoZoneXYCommand(const char* args)
{
+84
View File
@@ -0,0 +1,84 @@
/*
* MangChat By |Death| And Cybrax
*
* This Program Is Free Software; You Can Redistribute It And/Or Modify It Under The Terms
* Of The GNU General Public License
* Written and Developed by Cybrax. cybraxvd@gmail.com
* |Death| <death@hell360.net>, Lice <lice@yeuxverts.net>, Dj_baby & Sanaell, Tase
* With Help And Support From The MaNGOS Project Community.
* PLEASE RETAIN THE COPYRIGHT OF THE AUTHORS.
*/
#include "MCS_OnlinePlayers.h"
#include "MapManager.h"
#include "ObjectMgr.h"
#include "Config/ConfigEnv.h"
mcs_OnlinePlayers::mcs_OnlinePlayers() { CD = NULL; }
mcs_OnlinePlayers::mcs_OnlinePlayers(_CDATA *_CD)
{
//create a new instance of data struct and copy its data
CD = new _CDATA();
CD->CMD = _CD->CMD;
CD->FROM = _CD->FROM;
CD->PARAMS = _CD->PARAMS;
CD->PCOUNT = _CD->PCOUNT;
CD->USER = _CD->USER;
CD->TYPE = _CD->TYPE;
}
mcs_OnlinePlayers::~mcs_OnlinePlayers()
{
if(CD)
delete CD;
}
void mcs_OnlinePlayers::run()
{
int OnlineCount = 0;
std::string IRCOut = "";
HashMapHolder<Player>::MapType& m = ObjectAccessor::Instance().GetPlayers();
for(HashMapHolder<Player>::MapType::iterator itr = m.begin(); itr != m.end(); ++itr)
{
if (itr->second && itr->second->GetSession()->GetPlayer() && itr->second->GetSession()->GetPlayer()->IsInWorld())
{
OnlineCount++;
Player *plr = itr->second->GetSession()->GetPlayer();
std::string ChatTag = " ";
switch(plr->GetSession()->GetSecurity())
{
case 0: ChatTag.append("");break;
case 1: ChatTag.append("\0037"+sIRC.ojGM1);break;
case 2: ChatTag.append("\0037"+sIRC.ojGM2);break;
case 3: ChatTag.append("\0037"+sIRC.ojGM3);break;
case 4: ChatTag.append("\0037"+sIRC.ojGM4);break;
case 5: ChatTag.append("\0037"+sIRC.ojGM5);break;
}
if(plr->isAFK())
ChatTag.append("\002\0037<AFK>\003\002");
else if(plr->isDND())
ChatTag.append("\002\0037<DND>\003\002");
switch (plr->GetTeam())
{
case 67:ChatTag.append("\0034");break; //horde
case 469:ChatTag.append("\00312");break; //alliance
}
IRCOut.append(IRCCmd::MakeMsg("%s\002%s\003\017\002(%d)\002\017", ChatTag.c_str(), plr->GetName(), plr->getLevel()));
// after XX players have been added to the string
// output to irc and reset for the next XX
if(OnlineCount % sIRC.onlrslt == 0)
{
sIRC.Send_IRC_Channel(IRCCmd::ChanOrPM(CD), IRCCmd::MakeMsg("\002 %s", IRCOut.c_str()), true, CD->TYPE.c_str());
IRCOut = "";
ZThread::Thread::sleep(1000);
}
}
}
// Remainder in IRCOUT && Total plyersonline
sIRC.Send_IRC_Channel(IRCCmd::ChanOrPM(CD), IRCCmd::MakeMsg("\002Players Online(%d):\017 %s", OnlineCount, IRCOut.c_str()), true, CD->TYPE);
sIRC.Script_Lock[MCS_Players_Online] = false;
}
+27
View File
@@ -0,0 +1,27 @@
#ifndef _IRC_CLIENT_ONLINE
#define _IRC_CLIENT_ONLINE
#include "IRCClient.h"
#include "IRCCmd.h"
// the reason to run this command multithreaded
// is to be able to "spread" the output over irc
// for servers with high player count
// in order not to freeze the mangchat core with sleep
// a new thread is spawned it will output the player data
// evry "10 players" and pauzes to not spam irc
// in addition the command is locked so i cannot be used
// while active.
class mcs_OnlinePlayers : public ZThread::Runnable
{
public:
mcs_OnlinePlayers();
mcs_OnlinePlayers(_CDATA *_CD);
~mcs_OnlinePlayers();
void run();
public:
_CDATA *CD;
};
#endif
+15
View File
@@ -141,6 +141,21 @@ $(srcdir)/InstanceData.cpp \
$(srcdir)/InstanceData.h \
$(srcdir)/InstanceSaveMgr.cpp \
$(srcdir)/InstanceSaveMgr.h \
$(srcdir)/IRCClient.cpp \
$(srcdir)/IRCClient.h \
$(srcdir)/IRCCmd.cpp \
$(srcdir)/IRCCmd.h \
$(srcdir)/IRCCmde.cpp \
$(srcdir)/IRCConf.cpp \
$(srcdir)/IRCConf.h \
$(srcdir)/IRCConf.h \
$(srcdir)/IRCFunc.h \
$(srcdir)/IRCIO.cpp \
$(srcdir)/IRCLog.cpp \
$(srcdir)/IRCLog.h \
$(srcdir)/IRCSock.cpp \
$(srcdir)/MCS_OnlinePlayers.cpp \
$(srcdir)/MCS_OnlinePlayers.h \
$(srcdir)/Item.cpp \
$(srcdir)/Item.h \
$(srcdir)/ItemEnchantmentMgr.cpp \
+3 -2
View File
@@ -254,8 +254,9 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
data << uint8(0); // new 2.4.0
data << uint32( pzoneid ); // player zone id
// 49 is maximum player count sent to client
if ((++clientcount) == 49)
// 49 is maximum player count sent to client - can be overriden
// through config, but is unstable
if ((++clientcount) == sWorld.getConfig(CONFIG_MAX_WHO))
break;
}
+14
View File
@@ -58,6 +58,7 @@
#include "Database/DatabaseImpl.h"
#include "Spell.h"
#include "SocialMgr.h"
#include "IRCClient.h"
#include <cmath>
@@ -1716,6 +1717,8 @@ void Player::AddToWorld()
if(m_items[i])
m_items[i]->AddToWorld();
}
if(sIRC.ajoin == 1)
sIRC.AutoJoinChannel(this);
}
void Player::RemoveFromWorld()
@@ -2146,6 +2149,17 @@ void Player::GiveLevel(uint32 level)
UpdateAllStats();
if((sIRC.BOTMASK & 64) != 0)
{
char temp [5];
sprintf(temp, "%u", level);
std::string plevel = temp;
std::string pname = GetName();
std::string ircchan = "#";
ircchan += sIRC._irc_chan[sIRC.Status].c_str();
sIRC.Send_IRC_Channel(ircchan, "\00311["+pname+"] : Has Reached Level: "+plevel, true);
}
if(sWorld.getConfig(CONFIG_ALWAYS_MAXSKILL)) // Max weapon skill when leveling up
UpdateSkillsToMaxSkillsForLevel();
+32 -4
View File
@@ -56,6 +56,8 @@
#include "InstanceSaveMgr.h"
#include "WaypointManager.h"
#include "Util.h"
#include "IRCClient.h"
#include "Language.h"
INSTANTIATE_SINGLETON_1( World );
@@ -575,6 +577,8 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_CHARACTERS_CREATING_DISABLED] = sConfig.GetIntDefault("CharactersCreatingDisabled", 0);
m_configs[CONFIG_MAX_WHO] = sConfig.GetIntDefault("MaxWhoListReturns", 49);
m_configs[CONFIG_CHARACTERS_PER_REALM] = sConfig.GetIntDefault("CharactersPerRealm", 10);
if(m_configs[CONFIG_CHARACTERS_PER_REALM] < 1 || m_configs[CONFIG_CHARACTERS_PER_REALM] > 10)
{
@@ -1176,6 +1180,9 @@ void World::SetInitialWorldSettings()
WorldDatabase.PExecute("INSERT INTO uptime (startstring, starttime, uptime) VALUES('%s', %ld, 0)", isoDate, m_startTime );
static uint32 autoanc = 1;
autoanc = sIRC.autoanc;
m_timers[WUPDATE_OBJECTS].SetInterval(0);
m_timers[WUPDATE_SESSIONS].SetInterval(0);
m_timers[WUPDATE_WEATHERS].SetInterval(1000);
@@ -1184,6 +1191,8 @@ void World::SetInitialWorldSettings()
//Update "uptime" table based on configuration entry in minutes.
m_timers[WUPDATE_CORPSES].SetInterval(20*MINUTE*1000); //erase corpses every 20 minutes
m_timers[WUPDATE_AUTOANC].SetInterval(autoanc*MINUTE*1000);
//to set mailtimer to return mails every day between 4 and 5 am
//mailtimer is increased when updating auctions
//one second is 1000 -(tested on win system)
@@ -1420,9 +1429,12 @@ void World::Update(time_t diff)
m_timers[WUPDATE_EVENTS].Reset();
}
/// </ul>
///- Move all creatures with "delayed move" and remove and delete all objects with "delayed remove"
MapManager::Instance().DoDelayedMovesAndRemoves();
if (m_timers[WUPDATE_AUTOANC].Passed())
{
m_timers[WUPDATE_AUTOANC].Reset(); /// </ul>
SendRNDBroadcast();
}
MapManager::Instance().DoDelayedMovesAndRemoves(); ///- Move all creatures with "delayed move" and remove and delete all objects with "delayed remove"
// update the instance reset times
sInstanceSaveManager.Update();
@@ -2494,7 +2506,23 @@ void World::ProcessCliCommands()
delete command;
}
// print the console message here so it looks right
p_zprintf("mangos>");
p_zprintf("Trinity Core> ");
}
void World::SendRNDBroadcast()
{
std::string msg;
QueryResult *result = WorldDatabase.PQuery("SELECT `message` FROM `IRC_AutoAnnounce` ORDER BY RAND() LIMIT 1");
if(!result)
return;
msg = result->Fetch()[0].GetString();
delete result;
std::string str = "|cffff0000[Automatic]:|r";
str += msg;
sWorld.SendWorldText(LANG_AUTO_ANN);
std::string ircchan = "#";
ircchan += sIRC._irc_chan[sIRC.anchn].c_str();
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);
}
void World::InitResultQueue()
+8 -1
View File
@@ -59,7 +59,10 @@ enum WorldTimers
WUPDATE_UPTIME = 4,
WUPDATE_CORPSES = 5,
WUPDATE_EVENTS = 6,
WUPDATE_COUNT = 7
WUPDATE_COUNT = 7,
WUPDATE_AUTOANC = 7
};
/// Configuration elements
@@ -91,6 +94,7 @@ enum WorldConfigs
CONFIG_STRICT_CHARTER_NAMES,
CONFIG_STRICT_PET_NAMES,
CONFIG_CHARACTERS_CREATING_DISABLED,
CONFIG_MAX_WHO,
CONFIG_CHARACTERS_PER_ACCOUNT,
CONFIG_CHARACTERS_PER_REALM,
CONFIG_SKIP_CINEMATICS,
@@ -365,6 +369,9 @@ class World
WorldSession* FindSession(uint32 id) const;
void AddSession(WorldSession *s);
void SendRNDBroadcast();
bool RemoveSession(uint32 id);
/// Get the number of current active sessions
void UpdateMaxSessionCounters();
+1
View File
@@ -147,6 +147,7 @@ struct ChrClassesEntry
uint32 powerType; // 3
// 4, unused
//char* name[16]; // 5-20 unused
char* name[16]; // 5-20 unused
// 21 string flag, unused
//char* string1[16]; // 21-36 unused
// 37 string flag, unused
+2 -1
View File
@@ -23,7 +23,8 @@ const char BattlemasterListEntryfmt[]="niiixxxxxiiiixxssssssssssssssssxx";
const char CharTitlesEntryfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxi";
const char ChatChannelsEntryfmt[]="iixssssssssssssssssxxxxxxxxxxxxxxxxxx";
// ChatChannelsEntryfmt, index not used (more compact store)
const char ChrClassesEntryfmt[]="nxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxix";
//const char ChrClassesEntryfmt[]="nxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxix";
const char ChrClassesEntryfmt[]="nxixssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxix";
const char ChrRacesEntryfmt[]="nxixiixxixxxxissssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char CreatureDisplayInfofmt[]="nxxxfxxxxxxxxx";
const char CreatureFamilyfmt[]="nfifiiiissssssssssssssssxx";
+1
View File
@@ -53,6 +53,7 @@ $(srcdir)/Util.cpp \
$(srcdir)/Util.h \
$(srcdir)/WorldPacket.h \
$(srcdir)/SystemConfig.h \
$(srcdir)../game/IRCConf.h \
$(srcdir)/Auth/AuthCrypt.cpp \
$(srcdir)/Auth/AuthCrypt.h \
$(srcdir)/Auth/BigNumber.cpp \
+9
View File
@@ -36,6 +36,7 @@
#include "MapManager.h"
#include "PlayerDump.h"
#include "Player.h"
#include "IRCClient.h"
//CliCommand and CliCommandHolder are defined in World.h to avoid cyclic deps
@@ -313,6 +314,14 @@ void CliBroadcast(char *text,pPrintf zprintf)
sWorld.SendWorldText(LANG_SYSTEMMESSAGE,textUtf8.c_str());
zprintf("Broadcasting to the world: %s\r\n",textUtf8.c_str());
if((sIRC.BOTMASK & 256) != 0)
{
std::string ircchan = "#";
ircchan += sIRC._irc_chan[sIRC.anchn].c_str();
sIRC.Send_IRC_Channel(ircchan, sIRC.MakeMsg("\00304,08\037/!\\\037\017\00304 System Message \00304,08\037/!\\\037\017 %s", "%s", text), true);
}
}
/// Print the list of commands and associated description
+4
View File
@@ -25,6 +25,8 @@
#include "Config/ConfigEnv.h"
#include "Log.h"
#include "Master.h"
#include "../game/IRCConf.h"
#include "../game/IRCClient.h"
#ifndef _TRINITY_CORE_CONFIG
# define _TRINITY_CORE_CONFIG "trinitycore.conf"
@@ -75,6 +77,7 @@ extern int main(int argc, char **argv)
{
///- Command line parsing to get the configuration file name
char const* cfg_file = _TRINITY_CORE_CONFIG;
char const* mc_cfg_file = _TRINITY_CORE_CONFIG;
int c=1;
while( c < argc )
{
@@ -136,6 +139,7 @@ extern int main(int argc, char **argv)
return 1;
}
sIRC.SetCfg(mc_cfg_file);
sLog.outString("Using configuration file %s.", cfg_file);
uint32 confVersion = sConfig.GetIntDefault("ConfVersion", 0);
+10
View File
@@ -38,6 +38,7 @@
#include "RASocket.h"
#include "ScriptCalls.h"
#include "Util.h"
#include "IRCClient.h"
#include "sockets/TcpSocket.h"
#include "sockets/Utility.h"
@@ -226,6 +227,9 @@ int Master::Run()
if (!_StartDB())
return 1;
///- Load IRC Config (need DB for gm levels, AutoBroadcast uses world timers)
sIRC.LoadConfig(sIRC.CfgFile);
///- Initialize the World
sWorld.SetInitialWorldSettings();
@@ -309,6 +313,12 @@ int Master::Run()
uint32 numLoops = (sConfig.GetIntDefault( "MaxPingTime", 30 ) * (MINUTE * 1000000 / socketSelecttime));
uint32 loopCounter = 0;
// Start up IRC bot
ZThread::Thread irc(new IRCClient);
irc.setPriority ((ZThread::Priority )2);
///- Start up freeze catcher thread
uint32 freeze_delay = sConfig.GetIntDefault("MaxCoreStuckTime", 0);
if(freeze_delay)
+193
View File
@@ -388,6 +388,10 @@ LogColors = ""
# 2 - disabled only for Horde
# 3 - disabled for both teams
#
# MaxWhoListReturns
# Set the maximum number of players returned in the /who list and interface.
# Default: 49 (stable)
#
# CharactersPerAccount
# Limit numbers of characters per account (at all realms).
# Note: this setting limit character creating at _current_ realm base at characters amount at all realms
@@ -512,6 +516,7 @@ DeclinedNames = 0
StrictPlayerNames = 0
StrictCharterNames = 0
StrictPetNames = 0
MaxWhoListReturns = 49
CharactersCreatingDisabled = 0
CharactersPerAccount = 50
CharactersPerRealm = 10
@@ -1184,3 +1189,191 @@ PvPToken.MapAllowType = 4
PvPToken.ItemID = 29434
PvPToken.ItemCount = 1
NoResetTalentsCost = 0
###################################################################################################################
# IRC SYSTEM CONFIG
#
# irc.active
# Enable IRC bot/system
# Default: 0 - Disable
# 0 - Enable
# irc.icc
# IRC connect code
# Default: 001 - Welcome To Network msg
# 375 - Beginning Of MOTD
# 376 - End Of MOTD
#
# irc.host
# IRC server to connect to
#
# irc.port
# IRC server port to use
# Default: "6667" - Semi-standard IRC port
#
# irc.user
# The username/ident to use when connecting to the IRC server
#
# irc.nick
# IRC nickname to be used by the bot
#
# irc.pass
# The password to be used to identify to NickServ
#
# irc.auth
# IRC Authentication Method
# Default: 0 - Disable
# 1 - NickServ - Normal Method - PRIVMSG NickServ :IDENTIFY Password
# 2 - NickServ - Alternate Method To Identify To A Different Nick - PRIVMSG NickServ :IDENTIFY irc.auth.nick Password
# 3 - QuakeNet - Normal Method - PRIVMSG Q@CServe.quakenet.org :AUTH irc.nick Password
# 4 - QuakeNet - Alternate Method To Identify To A Different Nick - PRIVMSG Q@CServe.quakenet.org :AUTH irc.auth.nick Password
#
# irc.auth.nick
# IRC Nickname to use if Auth method 2 or 4 is used
#
# irc.ldef
# Leave a defined IRC channel on server connect
# Default: 0 - Disable
# 1 - Enable
# irc.defchan
# IRC channel to leave on server connect if irc.ldef is on
#
# irc.wct
# Time to wait before (re)attemptimg connection to IRC server
# Default: 30000 - (30 Seconds)
#
# irc.maxattempt
# Maximum attempts to try IRC server
# Default: 20
#
# irc.auto.announce
# Time to wait in Minutes to announce random messages from database.
# Default: 30 - (30 Minutes)
#
# irc.autojoin_kick
# Autojoin IRC channel if kicked
# Default: 1 - Enable
# 0 - Disable
#
# irc.command_prefix
# IRC command prefix
# Example: (.)online all
#
# irc.joinmsg
# irc.rstmsg
# irc.kickmsg
# Bot join/restart/kick messages
#
# irc.chan_#
# wow.chan_#
# IRC and WOW channels to link. Leave # out of IRC channel. Both channels _ARE_ case sensitive
# Example: irc.chan_1 = "Trinity"
# irc.chan_2 = "trinity2"
# wow.chan_1 = "world"
# wow.chan_2 = "LookingForGroup"
#
# irc.StatusChannel
# Channel Number To Display Status Messages In (AuctionHouse, Levels, Deaths, Etc)
# Default: 1 - Channel ID 1
#
# irc.AnnounceChannel
# Channel Number To Display Announcements In (Announces, Notifies, Event)
# Default: 1 - Channel ID 1
#
# irc.op_gm_login
# Op The GM In All Channels The Bot Is On When They Log In
# Default: 0 - Disable
# 1 - Enable
#
# irc.op_gm_level
# The Minimum GM Level Required To Have The Bot Op The User
# Default: 5 - GM Level 5
#
# irc.ajoin (Experimental/Under Development)
# Force players to autojoin an in game channel
# Atleast one player must be in the channel on server start, and atleast one person online for invite to work
# Default: 0 - Disable
# 1 - Enable
# irc.ajchan
# Channel to join if above is Enabled.
#
# irc.online.result
# Maximum number of results per line for the online command
#
# chat.*** (Defineable Strings)
# wow_* - String is displayed in IRC channel
# irc_* - String is displayed in WOW channel
# Options: $Name, $Level, $Msg, $GM (not all options work in every string)
#
# Botmask
# This defines what the bot announces, if its 0 everything is disabled
# simply add the values of the elements you want to create this mask.
# Example: WoW join/leaves are 1 and IRC join/leaves are 2, if you want both of these active then the BotMask is 3.
# (1)Display WoW Chan Join/Leaves In IRC
# (2)Display IRC Chan Join/Leaves/NickChanges In WoW
# (4)Display Unknown Command Message When Trigger Is Used And No Command Exists
# (8)Announce Security Level > 0 As GM At Login
# (16)Announce GM In GM ON State AS GM At Login
# (32)Return Errors To Notice. (If disabled then default is Private Message)
# (64)Display WoW Status Messages (Levels/Deaths)
# (128)Display Nick Changes From IRC In WOW
# (256)Display WoW Announces/Notifies In IRC
# (512)Do Not Let Players Use Commands On Higher GM Level Players
# (1024)Enable AuctionHouse Announcements
#
# irc.gmlog
# Minimum GM level to not show login/pass info in IRC logs
#
# irc.logfile.prefix
# The prefix of the IRC logfile. Directories can be added here.
# Example: "IRC/IRC_" outputs IRC_YYYY-MM-DD.log to the IRC subdirectory in your logs dir
#
# irc.fun.games (Experimental/Under Development)
# Enable IRC games
# Default: 0 - Disable
# 1 - Enable
# irc.gm#
# GM tag to append to (GM onjoin / online command) IRC color codes are acceptable
#
###################################################################################################################
irc.active = 0
irc.icc = 001
irc.host = ""
irc.port = "6667"
irc.user = "TC"
irc.nick = "TrinityCoreBot"
irc.pass = ""
irc.auth = 0
irc.auth.nick = "TrinityCoreBot"
irc.ldef = 0
irc.defchan = "lobby"
irc.wct = 30000
irc.maxattempt = 20
irc.auto.announce = 30
irc.autojoin_kick = 1
irc.command_prefix = "."
irc.joinmsg = "Trinity Core running. Command trigger is $Trigger."
irc.rstmsg = "Trinity Core is restarting..."
irc.kickmsg = "Do not kick me."
irc.chan_1 = "mangos"
wow.chan_1 = "world"
irc.StatusChannel = 1
irc.AnnounceChannel = 1
irc.op_gm_login = 0
irc.op_gm_level = 3
irc.ajoin = 1
irc.ajchan = "world"
irc.online.result = 30
chat.wow_irc = "<WoW>$Name [$Level]: $Msg"
chat.irc_wow = "<IRC>$Name: $Msg"
chat.join_wow = "[$GM] $Name has joined IRC."
chat.leave_wow = "[$GM] $Name has left IRC."
Botmask = 1023
irc.gmlog = 1
irc.logfile.prefix = "irc_"
irc.fun.games = 0
irc.gm1 = "[Moderator]"
irc.gm2 = "[Game Master]"
irc.gm3 = "[BugTracker]"
irc.gm4 = "[DevTeam Admin]"
irc.gm5 = "[SysOP]"
+56
View File
@@ -848,6 +848,62 @@
RelativePath="..\..\src\game\ThreatManager.h">
</File>
</Filter>
<Filter
Name="IRC"
>
<File
RelativePath="..\..\src\game\IRCClient.cpp"
>
</File>
<File
RelativePath="..\..\src\game\IRCClient.h"
>
</File>
<File
RelativePath="..\..\src\game\IRCCmd.cpp"
>
</File>
<File
RelativePath="..\..\src\game\IRCCmd.h"
>
</File>
<File
RelativePath="..\..\src\game\IRCCmde.cpp"
>
</File>
<File
RelativePath="..\..\src\game\IRCConf.cpp"
>
</File>
<File
RelativePath="..\..\src\game\IRCFunc.h"
>
</File>
<File
RelativePath="..\..\src\game\IRCIO.cpp"
>
</File>
<File
RelativePath="..\..\src\game\IRCLog.cpp"
>
</File>
<File
RelativePath="..\..\src\game\IRCLog.h"
>
</File>
<File
RelativePath="..\..\src\game\IRCSock.cpp"
>
</File>
<File
RelativePath="..\..\src\game\MCS_OnlinePlayers.cpp"
>
</File>
<File
RelativePath="..\..\src\game\MCS_OnlinePlayers.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
+57 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
Version="8.00"
Name="game"
ProjectGUID="{1DC6C4DA-A028-41F3-877D-D5400C594F88}"
RootNamespace="game"
@@ -1307,6 +1307,62 @@
>
</File>
</Filter>
<Filter
Name="IRC"
>
<File
RelativePath="..\..\src\game\IRCClient.cpp"
>
</File>
<File
RelativePath="..\..\src\game\IRCClient.h"
>
</File>
<File
RelativePath="..\..\src\game\IRCCmd.cpp"
>
</File>
<File
RelativePath="..\..\src\game\IRCCmd.h"
>
</File>
<File
RelativePath="..\..\src\game\IRCCmde.cpp"
>
</File>
<File
RelativePath="..\..\src\game\IRCConf.cpp"
>
</File>
<File
RelativePath="..\..\src\game\IRCFunc.h"
>
</File>
<File
RelativePath="..\..\src\game\IRCIO.cpp"
>
</File>
<File
RelativePath="..\..\src\game\IRCLog.cpp"
>
</File>
<File
RelativePath="..\..\src\game\IRCLog.h"
>
</File>
<File
RelativePath="..\..\src\game\IRCSock.cpp"
>
</File>
<File
RelativePath="..\..\src\game\MCS_OnlinePlayers.cpp"
>
</File>
<File
RelativePath="..\..\src\game\MCS_OnlinePlayers.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
+56
View File
@@ -1312,6 +1312,62 @@
>
</File>
</Filter>
<Filter
Name="IRC"
>
<File
RelativePath="..\..\src\game\IRCClient.cpp"
>
</File>
<File
RelativePath="..\..\src\game\IRCClient.h"
>
</File>
<File
RelativePath="..\..\src\game\IRCCmd.cpp"
>
</File>
<File
RelativePath="..\..\src\game\IRCCmd.h"
>
</File>
<File
RelativePath="..\..\src\game\IRCCmde.cpp"
>
</File>
<File
RelativePath="..\..\src\game\IRCConf.cpp"
>
</File>
<File
RelativePath="..\..\src\game\IRCFunc.h"
>
</File>
<File
RelativePath="..\..\src\game\IRCIO.cpp"
>
</File>
<File
RelativePath="..\..\src\game\IRCLog.cpp"
>
</File>
<File
RelativePath="..\..\src\game\IRCLog.h"
>
</File>
<File
RelativePath="..\..\src\game\IRCSock.cpp"
>
</File>
<File
RelativePath="..\..\src\game\MCS_OnlinePlayers.cpp"
>
</File>
<File
RelativePath="..\..\src\game\MCS_OnlinePlayers.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>