Skip to content
Closed

test #12

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
3854 commits
Select commit Hold shift + click to select a range
b2a02c0
Update Player.cpp
biglad Jun 16, 2025
7a1ca2c
Update Player.cpp
biglad Jun 16, 2025
07f41a1
Update Player.cpp
biglad Jun 16, 2025
7b06712
Update Player.cpp
biglad Jun 16, 2025
3d0a72d
Update Player.cpp
biglad Jun 16, 2025
69d167c
123
biglad Jun 17, 2025
211dcba
Update Player.cpp
biglad Jun 17, 2025
c16ef32
Update Player.cpp
biglad Jun 17, 2025
68daf91
Update Player.cpp
biglad Jun 17, 2025
7b5277a
Update Player.cpp
biglad Jun 17, 2025
7fb246d
Update Player.cpp
biglad Jun 17, 2025
0642f8a
Update Player.cpp
biglad Jun 17, 2025
75289ff
Update World.cpp
biglad Jun 17, 2025
473644e
Update World.h
biglad Jun 17, 2025
44add62
Update Player.cpp
biglad Jun 17, 2025
6800902
Update Player.cpp
biglad Jun 17, 2025
3fa9625
Update Player.cpp
biglad Jun 17, 2025
7bf241e
Update Player.cpp
biglad Jun 17, 2025
2b4c3cf
Update Player.cpp
biglad Jun 17, 2025
74dd92e
Update Player.cpp
biglad Jun 17, 2025
fe467b1
Update Player.cpp
biglad Jun 17, 2025
d8f6deb
Update Player.cpp
biglad Jun 17, 2025
70a748f
Update Player.cpp
biglad Jun 17, 2025
ab88769
Update Player.cpp
biglad Jun 17, 2025
b8c3284
Update Player.cpp
biglad Jun 17, 2025
99023bc
Update Player.cpp
biglad Jun 17, 2025
1651a01
Update Player.cpp
biglad Jun 17, 2025
71c5035
Update Player.cpp
biglad Jun 17, 2025
c3fd244
Update Player.cpp
biglad Jun 17, 2025
0eff8a1
Update Player.cpp
biglad Jun 17, 2025
f2b2ee6
Update Player.cpp
biglad Jun 17, 2025
dc2efb7
Update Player.cpp
biglad Jun 17, 2025
0c0fae4
Update Player.cpp
biglad Jun 17, 2025
aaa5cb0
Update Player.cpp
biglad Jun 17, 2025
05f847f
Update Player.cpp
biglad Jun 17, 2025
1e75989
Update Player.cpp
biglad Jun 17, 2025
3efafda
Update Player.cpp
biglad Jun 17, 2025
2d7f322
123
biglad Jun 17, 2025
1491b37
Update Player.h
biglad Jun 17, 2025
2c4640c
Update Player.h
biglad Jun 17, 2025
c2d07e1
Update Player.cpp
biglad Jun 17, 2025
5074806
Update Player.cpp
biglad Jun 17, 2025
2d39d9f
Update Player.cpp
biglad Jun 17, 2025
379c4a8
Update Player.cpp
biglad Jun 17, 2025
ee2b6d4
Update Player.cpp
biglad Jun 17, 2025
8606435
Update npc_proff_master.cpp
biglad Jun 17, 2025
5edb717
Update npc_proff_master.cpp
biglad Jun 17, 2025
533144b
Update npc_proff_master.cpp
biglad Jun 17, 2025
85b30f9
Update npc_proff_master.cpp
biglad Jun 17, 2025
02bb7d6
Update npc_proff_master.cpp
biglad Jun 17, 2025
7f56b3d
Update npc_proff_master.cpp
biglad Jun 17, 2025
85f7e8a
Update npc_voters_zone.cpp
biglad Jun 17, 2025
e7f6d52
Update npc_voters_zone.cpp
biglad Jun 17, 2025
e21df4e
Update npc_voters_zone.cpp
biglad Jun 17, 2025
66b8d6c
Update npc_megaboss_starter.cpp
biglad Jun 20, 2025
0ad4223
Update server_hooks.cpp
biglad Jun 21, 2025
c397eb6
Update server_hooks.cpp
biglad Jun 21, 2025
61c64c8
Update server_hooks.cpp
biglad Jun 21, 2025
913df5b
Update mga_boss_one.cpp
biglad Jun 22, 2025
fa895ba
Update mga_boss_one.cpp
biglad Jun 22, 2025
52b9ad0
Update mga_boss_one.cpp
biglad Jun 22, 2025
199dada
Update mga_boss_one.cpp
biglad Jun 22, 2025
c2e181b
Update mga_boss_one.cpp
biglad Jun 22, 2025
948a6c6
Update mga_boss_one.cpp
biglad Jun 22, 2025
764b591
Update mga_boss_one.cpp
biglad Jun 22, 2025
01c56f2
Update mga_boss_one.cpp
biglad Jun 22, 2025
26fa507
Update mga_boss_one.cpp
biglad Jun 22, 2025
7bc7451
Update mga_boss_one.cpp
biglad Jun 22, 2025
fd1763f
Update mga_boss_one.cpp
biglad Jun 22, 2025
ab62590
Update mga_boss_one.cpp
biglad Jun 22, 2025
67a0fc3
Update mga_boss_one.cpp
biglad Jun 22, 2025
929949b
Update mga_boss_one.cpp
biglad Jun 22, 2025
10e0bbf
Update mga_boss_one.cpp
biglad Jun 22, 2025
90f8eaa
Update mga_boss_one.cpp
biglad Jun 22, 2025
4d4b7af
Update mga_boss_one.cpp
biglad Jun 22, 2025
f0ab5b9
Update mga_boss_one.cpp
biglad Jun 22, 2025
d0e9bfc
Update mga_boss_one.cpp
biglad Jun 22, 2025
eb2efd9
Update mga_boss_one.cpp
biglad Jun 22, 2025
2a37c44
Update mga_boss_one.cpp
biglad Jun 22, 2025
40e7b15
Update mga_boss_one.cpp
biglad Jun 22, 2025
0b53221
Update mga_boss_one.cpp
biglad Jun 22, 2025
d70e5fa
Update mga_boss_one.cpp
biglad Jun 22, 2025
69d30e0
Update mga_boss_one.cpp
biglad Jun 22, 2025
a10977e
Update mga_boss_one.cpp
biglad Jun 22, 2025
4fb6029
Update mga_boss_one.cpp
biglad Jun 22, 2025
ffaa665
Update mga_boss_one.cpp
biglad Jun 22, 2025
3725279
Update mga_boss_one.cpp
biglad Jun 22, 2025
f76eed8
Update mga_boss_one.cpp
biglad Jun 22, 2025
d9fc51d
Update mga_boss_one.cpp
biglad Jun 22, 2025
2e91df8
Update mga_boss_one.cpp
biglad Jun 22, 2025
f1cf536
Update mga_boss_one.cpp
biglad Jun 22, 2025
f3e63e1
Update mga_boss_one.cpp
biglad Jun 22, 2025
23519ba
Update mga_boss_one.cpp
biglad Jun 22, 2025
bcfe65e
Update mga_boss_one.cpp
biglad Jun 22, 2025
04f31f2
Update mga_boss_one.cpp
biglad Jun 22, 2025
b01e27a
Update mga_boss_one.cpp
biglad Jun 22, 2025
fa34895
Update mga_boss_one.cpp
biglad Jun 22, 2025
d556f1d
Update mga_boss_one.cpp
biglad Jun 22, 2025
e962c18
Update mga_boss_one.cpp
biglad Jun 22, 2025
15086f5
Update mga_boss_one.cpp
biglad Jun 22, 2025
df34332
Update npc_megaboss_starter.cpp
biglad Jun 22, 2025
758a756
Update mga_boss_one.cpp
biglad Jun 22, 2025
9851fcf
Update mga_boss_one.cpp
biglad Jun 23, 2025
e0e2f0a
Update mga_boss_one.cpp
biglad Jun 23, 2025
a1d2a77
Update mga_boss_one.cpp
biglad Jun 23, 2025
8ee66ab
Update mga_boss_one.cpp
biglad Jun 23, 2025
8c1f7ae
Update player_hooks.cpp
biglad Jun 23, 2025
16f37f7
Update player_hooks.cpp
biglad Jun 23, 2025
92d6979
Update player_hooks.cpp
biglad Jun 23, 2025
a5cd2cf
Update mga_boss_one.cpp
biglad Jun 23, 2025
f853dd8
123
biglad Jun 23, 2025
a43f6bf
Update player_hooks.cpp
biglad Jun 23, 2025
c966115
Update CharacterHandler.cpp
biglad Jun 23, 2025
0448659
Update CharacterHandler.cpp
biglad Jun 23, 2025
5251857
Update CharacterHandler.cpp
biglad Jun 23, 2025
282cd59
Update CharacterHandler.cpp
biglad Jun 23, 2025
416e533
Update CharacterHandler.cpp
biglad Jun 23, 2025
bea0a5e
Update mga_boss_one.cpp
biglad Jun 23, 2025
1f40a78
Update mga_boss_one.cpp
biglad Jun 23, 2025
b7d23b5
123
biglad Jun 24, 2025
8925187
Update AchievementMgr.cpp
biglad Jun 24, 2025
02ff8a8
Update mga_boss_one.cpp
biglad Jun 29, 2025
292fb46
Update mga_boss_one.cpp
biglad Jun 29, 2025
bd7bffb
Create Trinity_Jukebox.sql
biglad Jun 29, 2025
9b52d85
Create world2.zip
biglad Jun 29, 2025
3c06b11
123
biglad Jun 30, 2025
0387ac8
Update instance_stormwind_vault.cpp
biglad Jun 30, 2025
97edf9c
Merge branch 'trickerer:npcbots_3.3.5' into npcbots_3.3.5
biglad Jul 5, 2025
7e47603
Update player_hooks.cpp
biglad Jul 10, 2025
4b9afbb
Update player_hooks.cpp
biglad Jul 10, 2025
3c21a26
Update player_hooks.cpp
biglad Jul 10, 2025
68f7142
Update Player.cpp
biglad Jul 17, 2025
c21ae74
Update Player.cpp
biglad Jul 17, 2025
51ca9b0
321
biglad Jul 18, 2025
17d5adc
Update AchievementMgr.cpp
biglad Jul 18, 2025
39413fe
Update player_hooks.cpp
biglad Jul 18, 2025
08f52a6
Update player_hooks.cpp
biglad Jul 18, 2025
a0edbd7
Update CharacterHandler.cpp
biglad Jul 18, 2025
2a7a9e9
Update CharacterHandler.cpp
biglad Jul 18, 2025
78265ea
Update CharacterHandler.cpp
biglad Jul 18, 2025
30a764a
Update DiscordWebhookMgr.cpp
biglad Jul 19, 2025
16e9fa2
321
biglad Jul 19, 2025
bd5c90e
123
biglad Jul 19, 2025
e5024b3
Update server_hooks.cpp
biglad Jul 19, 2025
9ccf345
Update player_hooks.cpp
biglad Jul 19, 2025
ef191e3
Update DiscordWebhookMgr.cpp
biglad Jul 19, 2025
a491462
Update player_hooks.cpp
biglad Jul 19, 2025
3c7fa51
123
biglad Jul 19, 2025
5aa2ce0
XP flask
biglad Jul 20, 2025
7fd9f5c
Update xp_boost_spell.cpp
biglad Jul 20, 2025
f7877af
Update npc_voters_zone.cpp
biglad Jul 20, 2025
b7f4e74
Update npc_voters_zone.cpp
biglad Jul 21, 2025
93f8811
Update npc_voters_zone.cpp
biglad Jul 21, 2025
1ebb43a
who list
biglad Jul 22, 2025
19c3ee9
Update npc_token_exchange.cpp
biglad Jul 22, 2025
6a46442
Update npc_vote_teleport.cpp
biglad Jul 22, 2025
3745a0d
Update npc_token_exchange.cpp
biglad Jul 22, 2025
168c936
123
biglad Jul 22, 2025
cdc5f06
Update botcommands.cpp
biglad Aug 1, 2025
26eb04f
Update botcommands.cpp
biglad Aug 1, 2025
ec3d1ea
Merge branch 'trickerer:npcbots_3.3.5' into npcbots_3.3.5
biglad Aug 12, 2025
321c6ba
Update Player.cpp
biglad Aug 18, 2025
65b3e3a
Update server_hooks.cpp
biglad Aug 18, 2025
ea89be1
Update server_hooks.cpp
biglad Aug 18, 2025
f509397
Update SpellAuraEffects.cpp
biglad Aug 21, 2025
235891a
Merge branch 'trickerer:npcbots_3.3.5' into npcbots_3.3.5
biglad Aug 24, 2025
baba076
123
biglad Aug 31, 2025
28edd98
Merge branch 'trickerer:npcbots_3.3.5' into npcbots_3.3.5
biglad Aug 31, 2025
3f6ea2d
123
biglad Sep 8, 2025
be50440
321
biglad Sep 8, 2025
a104f5e
Update GitRevision.cpp
biglad Sep 8, 2025
a814246
Merge branch 'trickerer:npcbots_3.3.5' into npcbots_3.3.5
biglad Sep 8, 2025
b334602
Update GitRevision.cpp
biglad Sep 8, 2025
ba3a0ca
Merge branch 'npcbots_3.3.5' of https://github.com/biglad/Core into n…
biglad Sep 8, 2025
8123d62
Create CMakeOutput.log
biglad Sep 10, 2025
f20d73b
Merge branch 'trickerer:npcbots_3.3.5' into npcbots_3.3.5
biglad Sep 13, 2025
8633dc4
Merge branch 'trickerer:npcbots_3.3.5' into npcbots_3.3.5
biglad Sep 21, 2025
f7f78f5
Merge branch 'trickerer:npcbots_3.3.5' into npcbots_3.3.5
biglad Sep 28, 2025
139c3fb
Update SharedDefines.h
biglad Oct 7, 2025
ca61edb
Update TransportMgr.cpp
biglad Oct 7, 2025
54f86d6
Update Guild.cpp
biglad Oct 7, 2025
ea57bb9
Update Player.h
biglad Oct 7, 2025
a1c3700
Update Player.cpp
biglad Oct 7, 2025
ca38a91
Update Bag.cpp
biglad Oct 7, 2025
42cda51
Update Item.cpp
biglad Oct 7, 2025
f296dd5
Update action_ip_logger.cpp
biglad Oct 7, 2025
d2a5bd1
Update instance_icecrown_citadel.cpp
biglad Oct 7, 2025
f043897
Update boss_sindragosa.cpp
biglad Oct 7, 2025
1b1c887
Update cs_wp.cpp
biglad Oct 7, 2025
55bc50b
Update cs_misc.cpp
biglad Oct 7, 2025
851351c
Update cs_list.cpp
biglad Oct 7, 2025
32e0290
Update MailHandler.cpp
biglad Oct 7, 2025
06e3fb5
Update CharacterHandler.cpp
biglad Oct 7, 2025
0dad585
Update Guild.cpp
biglad Oct 7, 2025
ca0f29f
group
biglad Oct 7, 2025
6483c7e
Update ObjectMgr.h
biglad Oct 7, 2025
13dd8a7
Update ObjectMgr.cpp
biglad Oct 7, 2025
70da071
Update GameEventMgr.cpp
biglad Oct 7, 2025
243a444
Update VehicleDefines.h
biglad Oct 7, 2025
6b4e268
Update Player.h
biglad Oct 7, 2025
ae4bb61
Update Player.h
biglad Oct 7, 2025
55c6e99
Update Player.cpp
biglad Oct 7, 2025
a4e836e
Update Pet.cpp
biglad Oct 7, 2025
fe154cd
Update Object.cpp
biglad Oct 7, 2025
73a7f10
Update CreatureGroups.h
biglad Oct 7, 2025
b666ed9
Update Corpse.cpp
biglad Oct 7, 2025
42f1d09
Update SmartScriptMgr.cpp
biglad Oct 7, 2025
216c571
Update CharacterDatabase.h
biglad Oct 7, 2025
597c603
Update CharacterDatabase.cpp
biglad Oct 7, 2025
5a8d697
Update action_ip_logger.cpp
biglad Oct 7, 2025
baaa4b8
Update isle_of_conquest.cpp
biglad Oct 7, 2025
5ab2266
123
biglad Oct 7, 2025
3879da2
Update CreatureTextMgr.cpp
biglad Oct 7, 2025
8bd3a61
Update SpellEffects.cpp
biglad Oct 7, 2025
f1aa738
Update Spell.cpp
biglad Oct 7, 2025
d50a6a7
Update SpellAuras.cpp
biglad Oct 7, 2025
f84eb14
Update WorldSession.h
biglad Oct 7, 2025
7f76c48
Update WorldSession.cpp
biglad Oct 7, 2025
42c87e6
Update MoveSplineInitArgs.h
biglad Oct 7, 2025
2b83f7b
Update MoveSplineInit.cpp
biglad Oct 7, 2025
01b4011
Update MoveSpline.cpp
biglad Oct 7, 2025
233aff5
Update MapScripts.cpp
biglad Oct 7, 2025
daab403
Update Mail.cpp
biglad Oct 7, 2025
10a982a
Update VehicleHandler.cpp
biglad Oct 7, 2025
aed7cff
Update SocialHandler.cpp
biglad Oct 7, 2025
06b9094
Update PetitionsHandler.cpp
biglad Oct 7, 2025
ffe3e38
Update MailHandler.cpp
biglad Oct 7, 2025
d1bb169
Update LootHandler.cpp
biglad Oct 7, 2025
0d5a44c
Update ChatHandler.cpp
biglad Oct 7, 2025
bbc8203
Update CharacterHandler.cpp
biglad Oct 7, 2025
563ac18
Update BattleGroundHandler.cpp
biglad Oct 7, 2025
015aa3d
Update AuctionHouseHandler.cpp
biglad Oct 7, 2025
f80d053
Update Guild.cpp
biglad Oct 7, 2025
a27788a
Update Group.cpp
biglad Oct 7, 2025
82867b9
Update Vehicle.cpp
biglad Oct 7, 2025
624be27
Update Unit.cpp
biglad Oct 7, 2025
18dbf40
Update Transport.cpp
biglad Oct 7, 2025
bfb17e3
Update Player.cpp
biglad Oct 7, 2025
32ba956
Update ObjectGuid.h
biglad Oct 7, 2025
de8290f
Update ObjectGuid.cpp
biglad Oct 7, 2025
4aeb163
Update Object.cpp
biglad Oct 7, 2025
992a1ea
Update Item.h
biglad Oct 7, 2025
b7e9937
Update Item.cpp
biglad Oct 7, 2025
17562a0
Update Hyperlinks.h
biglad Oct 7, 2025
014022f
Update Battlefield.cpp
biglad Oct 7, 2025
776bf1d
ah
biglad Oct 7, 2025
32caf17
Update AchievementMgr.cpp
biglad Oct 7, 2025
4ea21ee
Update SmartScript.cpp
biglad Oct 7, 2025
70c8758
Update CharacterDatabase.cpp
biglad Oct 7, 2025
9e24e0c
Update AchievementMgr.cpp
biglad Oct 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
113 changes: 113 additions & 0 deletions ArkChat/IRCClient.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
* Copyright (C) 2005 - 2012 MaNGOS <http://www.getmangos.com/>
*
* Copyright (C) 2008 - 2012 Trinity <http://www.trinitycore.org/>
*
* Copyright (C) 2010 - 2012 ProjectSkyfire <http://www.projectskyfire.org/>
*
* Copyright (C) 2011 - 2012 ArkCORE <http://www.arkania.net/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#include "gamePCH.h"
#include "IRCClient.h"
#include "../game/World/World.h"
#include "../Globals/ObjectMgr.h"
#include "../game/Maps/MapManager.h"

#include "../../../../dep/acelite/ace/Singleton.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 (trinitycore)
void IRCClient::run()
{
sIRC.iLog.WriteLog(" %s : ****** ArkCORE With ArkChat Has Been Started ******", sIRC.iLog.GetLogDateTimeStr().c_str());

// before we begin we wait a few
// mangos is still starting up.
ACE_Based::Thread::Sleep(500);
sLog->outString("\n%s\n%s\n%s\n%s",
"***************************************",
"** ArkChat Threaded IRC Client **",
"** With Enhanced GM Control. **",
"***************************************");
sLog->outString("****** ArkChat: %s ********", sIRC._Mver.c_str());
int cCount = 1;
// Clean Up MySQL Tables
sLog->outString("*** ArkChat: Cleaning Up 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::IsStopped())
{
// Initialize socket library
if(this->InitSock())
{
// Connect To The IRC Server
sLog->outString("*** ArkChat: 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("*** ArkChat: Connected And Logging In*");
// Login to the IRC server
if(this->Login(sIRC._Nick, sIRC._User, sIRC._Pass))
{
sLog->outString("*** ArkChat: Logged In And Running!! *");
// While we are connected to the irc server keep listening for data on the socket
while(sIRC.Connected && !World::IsStopped()){ sIRC.SockRecv(); }
}
sLog->outString("*** ArkChat: 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)
ACE_Based::Thread::Sleep(sIRC._wct);
}
else
{
// Socket could not initialize cancel
sIRC.Active = false;
sLog->outError("** ArkChat: Could not initialize socket");
}
}
while(!World::IsStopped()){};
}

std::string IRCClient::GetChatLine(int nItem)
{
return sIRC.ILINES[nItem];
}
253 changes: 253 additions & 0 deletions ArkChat/IRCClient.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
/*
* Copyright (C) 2005 - 2012 MaNGOS <http://www.getmangos.com/>
*
* Copyright (C) 2008 - 2012 Trinity <http://www.trinitycore.org/>
*
* Copyright (C) 2010 - 2012 ProjectSkyfire <http://www.projectskyfire.org/>
*
* Copyright (C) 2011 - 2012 ArkCORE <http://www.arkania.net/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#ifndef _IRC_CLIENT_H
#define _IRC_CLIENT_H

#include "../../../../dep/acelite/ace/Singleton.h"
#include "../Entities/Player/Player.h"
#include "IRCLog.h"
#include "IRCCmd.h"

using namespace std;
// The maximum ammount of channels used, must be >= config option
#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
};
// 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 ACE_Based::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);
//bool BeenToGMI(float posx, float posy, std::string player, std::string from);
// 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;
//Password for in-game channel
std::string _irc_pass[MAX_CONF_CHANNELS];
// 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;
string logchan;
string logchanpw;
int logmask;
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 CRECONNECT;
int CRELOAD;
int CREVIVE;
int CSAVEALL;
int CSERVERCMD;
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;

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 (*ACE_Singleton<IRCClient, ACE_Null_Mutex>::instance())
Loading