forked from ike3/mangosbot-bots
-
Notifications
You must be signed in to change notification settings - Fork 1
/
PlayerbotMgr.h
73 lines (54 loc) · 2.01 KB
/
PlayerbotMgr.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef _PLAYERBOTMGR_H
#define _PLAYERBOTMGR_H
#include "Common.h"
#include "PlayerbotAIBase.h"
#include "../botpch.h"
class WorldPacket;
class Player;
class Unit;
class Object;
class Item;
typedef map<uint64, Player*> PlayerBotMap;
class PlayerbotHolder : public PlayerbotAIBase
{
public:
PlayerbotHolder();
virtual ~PlayerbotHolder();
void AddPlayerBot(uint64 guid, uint32 masterAccountId);
void HandlePlayerBotLoginCallback(QueryResult * dummy, SqlQueryHolder * holder);
void LogoutPlayerBot(uint64 guid);
Player* GetPlayerBot (uint64 guid) const;
PlayerBotMap::const_iterator GetPlayerBotsBegin() const { return playerBots.begin(); }
PlayerBotMap::const_iterator GetPlayerBotsEnd() const { return playerBots.end(); }
virtual void UpdateAIInternal(uint32 elapsed);
void UpdateSessions(uint32 elapsed);
void LogoutAllBots();
void OnBotLogin(Player * const bot);
list<string> HandlePlayerbotCommand(char const* args, Player* master = NULL);
string ProcessBotCommand(string cmd, ObjectGuid guid, bool admin, uint32 masterAccountId, uint32 masterGuildId);
uint32 GetAccountId(string name);
string ListBots(Player* master);
protected:
virtual void OnBotLoginInternal(Player * const bot) = 0;
protected:
PlayerBotMap playerBots;
};
class PlayerbotMgr : public PlayerbotHolder
{
public:
PlayerbotMgr(Player* const master);
virtual ~PlayerbotMgr();
static bool HandlePlayerbotMgrCommand(ChatHandler* handler, char const* args);
void HandleMasterIncomingPacket(const WorldPacket& packet);
void HandleMasterOutgoingPacket(const WorldPacket& packet);
void HandleCommand(uint32 type, const string& text);
void OnPlayerLogin(Player* player);
virtual void UpdateAIInternal(uint32 elapsed);
Player* GetMaster() const { return master; };
void SaveToDB();
protected:
virtual void OnBotLoginInternal(Player * const bot);
private:
Player* const master;
};
#endif