-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathevent.h
148 lines (116 loc) · 5.92 KB
/
event.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#ifndef __BOTRIX_EVENT_H__
#define __BOTRIX_EVENT_H__
#include <good/memory.h>
#include "types.h"
#include "server_plugin.h"
//****************************************************************************************************************
/// Game event (like player hurt, game start, etc).
//****************************************************************************************************************
class CEvent: public IGameEventListener2
{
public:
/// Constructor.
CEvent( const char* szType ): m_sType(szType)
{
CBotrixPlugin::pGameEventManager->AddListener(this, szType, true);
}
/// Destructor.
virtual ~CEvent()
{
CBotrixPlugin::pGameEventManager->RemoveListener(this);
}
/// Return name of this event.
const good::string& GetName() const { return m_sType; }
/// Called directly by EventManager if event just occured.
virtual void FireGameEvent( IGameEvent* pEvent ) = 0;
protected:
good::string m_sType;
};
typedef good::shared_ptr<CEvent> CEventPtr; ///< Typedef for unique_ptr of CEvent.
//================================================================================================================
/// This event is fired when player finished connecting to server.
//================================================================================================================
class CPlayerActivateEvent: public CEvent
{
public:
CPlayerActivateEvent(): CEvent("player_activate") {}
virtual void FireGameEvent( IGameEvent* pEvent );
};
//================================================================================================================
/// This event is fired every time player changes team.
//================================================================================================================
class CPlayerTeamEvent: public CEvent
{
public:
CPlayerTeamEvent(): CEvent("player_team") {}
virtual void FireGameEvent( IGameEvent* pEvent );
};
//================================================================================================================
/// This event is fired every time player spawns on server.
//================================================================================================================
class CPlayerSpawnEvent: public CEvent
{
public:
CPlayerSpawnEvent(): CEvent("player_spawn") {}
virtual void FireGameEvent( IGameEvent* pEvent );
};
//================================================================================================================
/// This event is fired when player chats.
//================================================================================================================
class CPlayerChatEvent: public CEvent
{
public:
CPlayerChatEvent(): CEvent("player_say") {}
virtual void FireGameEvent( IGameEvent* pEvent );
};
//================================================================================================================
/// This event is fired when player is hurted by another player.
//================================================================================================================
class CPlayerHurtEvent: public CEvent
{
public:
CPlayerHurtEvent(): CEvent("player_hurt") {}
virtual void FireGameEvent( IGameEvent* pEvent );
};
//================================================================================================================
/// This event is fired when player is dead.
//================================================================================================================
class CPlayerDeathEvent: public CEvent
{
public:
CPlayerDeathEvent(): CEvent("player_death") {}
virtual void FireGameEvent( IGameEvent* pEvent );
};
//TODO: MOVE TO TF2 EVENTS.
/*class CRoundStartEvent: public CEvent
{
public:
CRoundStartEvent(): CEvent("teamplay_round_start")
{
CBotrixPlugin::pGameEventManager->AddListener(this, "teamplay_round_selected", true);
CBotrixPlugin::pGameEventManager->AddListener(this, "teamplay_round_active", true);
CBotrixPlugin::pGameEventManager->AddListener(this, "teamplay_waiting_begins", true);
CBotrixPlugin::pGameEventManager->AddListener(this, "teamplay_waiting_ends", true);
CBotrixPlugin::pGameEventManager->AddListener(this, "teamplay_waiting_abouttoend", true);
CBotrixPlugin::pGameEventManager->AddListener(this, "teamplay_restart_round", true);
CBotrixPlugin::pGameEventManager->AddListener(this, "teamplay_ready_restart", true);
CBotrixPlugin::pGameEventManager->AddListener(this, "teamplay_round_restart_seconds", true);
CBotrixPlugin::pGameEventManager->AddListener(this, "teamplay_team_ready", true);
CBotrixPlugin::pGameEventManager->AddListener(this, "teamplay_round_win", true);
CBotrixPlugin::pGameEventManager->AddListener(this, "arena_player_notification", true);
CBotrixPlugin::pGameEventManager->AddListener(this, "arena_match_maxstreak", true);
CBotrixPlugin::pGameEventManager->AddListener(this, "arena_round_start", true);
CBotrixPlugin::pGameEventManager->AddListener(this, "arena_win_panel", true);
CBotrixPlugin::pGameEventManager->AddListener(this, "player_spawn", true);
CBotrixPlugin::pGameEventManager->AddListener(this, "teamplay_pre_round_time_left", true);
// CBotrixPlugin::pGameEventManager->AddListener(this, "", true);
// CBotrixPlugin::pGameEventManager->AddListener(this, "", true);
// CBotrixPlugin::pGameEventManager->AddListener(this, "", true);
// CBotrixPlugin::pGameEventManager->AddListener(this, "", true);
// CBotrixPlugin::pGameEventManager->AddListener(this, "", true);
// CBotrixPlugin::pGameEventManager->AddListener(this, "", true);
}
virtual void FireGameEvent( IGameEvent* pEvent );
};
*/
#endif // __BOTRIX_EVENT_H__