[39] | 1 | #ifndef _IRC_CMD_H |
---|
| 2 | #define _IRC_CMD_H |
---|
| 3 | |
---|
| 4 | #define MAX_CLIENTS 50 |
---|
| 5 | #include "Common.h" |
---|
| 6 | #include "Player.h" |
---|
| 7 | #include "ObjectAccessor.h" |
---|
| 8 | |
---|
| 9 | struct ChannelUser |
---|
| 10 | { |
---|
| 11 | int UserType; |
---|
| 12 | std::string Name; |
---|
| 13 | std::string UName; |
---|
| 14 | int UserLevel; |
---|
| 15 | }; |
---|
| 16 | |
---|
| 17 | struct _client |
---|
| 18 | { |
---|
| 19 | bool LoggedIn; |
---|
| 20 | std::string Name; |
---|
| 21 | std::string UName; |
---|
| 22 | int GMLevel; |
---|
| 23 | }; |
---|
| 24 | struct _CDATA |
---|
| 25 | { |
---|
| 26 | std::string CMD; |
---|
| 27 | std::string USER; |
---|
| 28 | std::string FROM; |
---|
| 29 | std::string PARAMS; |
---|
| 30 | std::string TYPE; |
---|
| 31 | int PCOUNT; |
---|
| 32 | }; |
---|
| 33 | enum APVERR |
---|
| 34 | { |
---|
| 35 | E_OK, |
---|
| 36 | E_SIZE, |
---|
| 37 | E_AUTH, |
---|
| 38 | E_IVALID, |
---|
| 39 | }; |
---|
| 40 | enum ESOUNDS |
---|
| 41 | { |
---|
| 42 | S_ENTERWORLD = 602, |
---|
| 43 | S_QUESTFAILED = 847, |
---|
| 44 | S_INVITE = 880, |
---|
| 45 | S_LEVELUP = 888, |
---|
| 46 | S_COINSOUND = 895, |
---|
| 47 | S_WHISPER = 3081, |
---|
| 48 | S_STEALTH = 3325, |
---|
| 49 | }; |
---|
| 50 | class IRCCmd |
---|
| 51 | { |
---|
| 52 | public: |
---|
| 53 | IRCCmd(); |
---|
| 54 | ~IRCCmd(); |
---|
| 55 | |
---|
| 56 | void Handle_Logout(_CDATA *CD); |
---|
| 57 | bool IsLoggedIn(std::string USER); |
---|
| 58 | bool IsValid(std::string USER, std::string FROM, std::string CHAT, std::string TYPE); |
---|
| 59 | bool AcctIsLoggedIn(std::string USER); |
---|
| 60 | _client *GetClient(std::string cname); |
---|
| 61 | |
---|
| 62 | public: |
---|
| 63 | static std::string MakeMsg(const char *sLine, ... ); |
---|
| 64 | static std::string ChanOrPM(_CDATA *CD); |
---|
| 65 | int AcctLevel(std::string plnme); |
---|
| 66 | int GetLevel(std::string sName); |
---|
| 67 | std::string MakeUpper(std::string Channel); |
---|
| 68 | std::string AcctIsBanned(std::string ACCT); |
---|
| 69 | std::list<_client*> _CLIENTS; |
---|
| 70 | Player* GetPlayer(std::string WHO); |
---|
| 71 | |
---|
| 72 | private: |
---|
| 73 | // MangChat Commands |
---|
| 74 | void Handle_Login(_CDATA *CD); |
---|
| 75 | void Account_Player(_CDATA *CD); |
---|
| 76 | void Ban_Player(_CDATA *CD); |
---|
| 77 | void Chan_Control(_CDATA *CD); |
---|
| 78 | void Char_Player(_CDATA *CD); |
---|
| 79 | void Fun_Player(_CDATA *CD); |
---|
| 80 | void Help_IRC(_CDATA *CD); |
---|
| 81 | void Item_Player(_CDATA *CD); |
---|
| 82 | void Inchan_Server(_CDATA *CD); |
---|
| 83 | void Info_Server(_CDATA *CD); |
---|
| 84 | void Jail_Player(_CDATA *CD); |
---|
| 85 | void Kick_Player(_CDATA *CD); |
---|
| 86 | void Kill_Player(_CDATA *CD); |
---|
| 87 | void Level_Player(_CDATA *CD); |
---|
| 88 | void Lookup_Player(_CDATA *CD); |
---|
| 89 | void Money_Player(_CDATA *CD); |
---|
| 90 | void Mute_Player(_CDATA *CD); |
---|
| 91 | void Online_Players(_CDATA *CD); |
---|
| 92 | void PM_Player(_CDATA *CD); |
---|
| 93 | void Revive_Player(_CDATA *CD); |
---|
| 94 | void Saveall_Player(_CDATA *CD); |
---|
| 95 | void Shutdown_Mangos(_CDATA *CD); |
---|
| 96 | void Spell_Player(_CDATA *CD); |
---|
| 97 | void Sysmsg_Server(_CDATA *CD); |
---|
| 98 | void Tele_Player(_CDATA *CD); |
---|
| 99 | void Top_Player(_CDATA *CD); |
---|
| 100 | void Who_Logged(_CDATA *CD); |
---|
| 101 | bool CanUse(std::string USER, int nLevel); |
---|
| 102 | bool ValidParams(std::string PARAMS, int nCount = 1); |
---|
| 103 | bool ParamsValid(_CDATA *CD, int pCnt); |
---|
| 104 | int ParamsValid(_CDATA *CD, int pCnt, int rLev); |
---|
| 105 | std::string GetAccName(std::string sName); |
---|
| 106 | std::string GetNameFromAcct(std::string sName); |
---|
| 107 | std::string GetAcctNameFromID(uint32 acctid); |
---|
| 108 | std::string GetIPFromPlayer(std::string player); |
---|
| 109 | std::string SecToDay(std::string secons); |
---|
| 110 | int GetAcctIDFromName(std::string sName); |
---|
| 111 | std::string* getArray(std::string PARAMS, int nCount = 1); |
---|
| 112 | }; |
---|
| 113 | inline void MakeLower(std::string& str) |
---|
| 114 | { |
---|
| 115 | std::transform( str.begin(), str.end(), str.begin(), ::tolower ); |
---|
| 116 | } |
---|
| 117 | #endif |
---|