-
Notifications
You must be signed in to change notification settings - Fork 372
Expand file tree
/
Copy pathEvent.h
More file actions
109 lines (96 loc) · 3.05 KB
/
Event.h
File metadata and controls
109 lines (96 loc) · 3.05 KB
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
#pragma once
namespace ai
{
/**
* @brief Represents an event in the AI system
*/
class Event
{
public:
/**
* @brief Copy constructor
*
* @param other The other event to copy from
*/
Event(Event const& other)
{
source = other.source;
param = other.param;
packet = other.packet;
owner = other.owner;
}
/**
* @brief Default constructor
*/
Event() : owner(nullptr) {} // Initialize owner to nullptr
/**
* @brief Constructor with source
*
* @param source The source of the event
*/
Event(string source) : source(source), owner(nullptr) {} // Initialize owner to nullptr
/**
* @brief Constructor with source, parameter, and owner
*
* @param source The source of the event
* @param param The parameter of the event
* @param owner The owner of the event
*/
Event(string source, string param, Player* owner = NULL) : source(source), param(param), owner(owner) {}
/**
* @brief Constructor with source, packet, and owner
*
* @param source The source of the event
* @param packet The packet associated with the event
* @param owner The owner of the event
*/
Event(string source, WorldPacket &packet, Player* owner = NULL) : source(source), packet(packet), owner(owner) {}
/**
* @brief Destructor
*/
virtual ~Event() {}
public:
/**
* @brief Get the source of the event
*
* @return string The source of the event
*/
const string& getSource() { return source; }
/**
* @brief Get the parameter of the event
*
* @return string The parameter of the event
*/
const string& getParam() { return param; }
/**
* @brief Get the packet associated with the event
*
* @return WorldPacket& The packet associated with the event
*/
WorldPacket& getPacket() { return packet; }
/**
* @brief Get the object associated with the event
*
* @return ObjectGuid The object associated with the event
*/
ObjectGuid getObject();
/**
* @brief Get the owner of the event
*
* @return Player* The owner of the event
*/
Player* getOwner() { return owner; }
/**
* @brief Check if the event is valid
*
* @return true if the event is valid, false otherwise
*/
bool operator! () const { return source.empty(); }
protected:
string source; /**< The source of the event */
string param; /**< The parameter of the event */
WorldPacket packet; /**< The packet associated with the event */
ObjectGuid object; /**< The object associated with the event */
Player* owner; /**< The owner of the event */
};
}