Repository navigation
Expand file tree
/
Copy pathGameObjectScript.cpp
More file actions
73 lines (66 loc) · 2.42 KB
/
Copy pathGameObjectScript.cpp
File metadata and controls
73 lines (66 loc) · 2.42 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
#include "HookMacros.h"
#include "ScriptMgr.h"
#include "GameObject.h"
#include "Player.h"
class PythonGameObjectScript : public GameObjectScript
{
public:
PythonGameObjectScript() : GameObjectScript("PythonGameObjectScript") {}
/**
* @brief Disable database binding requirement and suppress errors like:
* Script named '<PythonEntityScript>' is not assigned in the database.
*
* @todo should use AllGameObjectScript instead?
*/
bool IsDatabaseBound() const override { return false; }
/**
* @brief Called when a player opens a gossip dialog with the GameObject
*
* @param player Contains information about the Player
* @param go Contains information about the GameObject
* @return False if you want to continue, true if you want to disable
*/
bool OnGossipHello(Player* player, GameObject* go) override
{
TRIGGER_GAMEOBJECT_HOOK(ON_GOSSIP_HELLO, go->GetEntry(), player, go);
return false;
}
/**
* @brief Called when a player selects a gossip item in the GameObject's gossip menu
*
* @param player Contains information about the Player
* @param go Contains information about the GameObject
* @param sender Contains information about the sender type
* @param action Contains information about the action id
* @return False if you want to continue, true if you want to disable
*/
bool OnGossipSelect(Player* player, GameObject* go, uint32 sender, uint32 action) override
{
TRIGGER_GAMEOBJECT_HOOK(ON_GOSSIP_SELECT, go->GetEntry(), player, go, sender, action);
return false;
}
/**
* @brief Called when the GameObject is destroyed (destructible buildings only)
*
* @param go Contains information about the GameObject
* @param player Contains information about the Player
*/
void OnDestroyed(GameObject* go, Player* player) override
{
TRIGGER_GAMEOBJECT_HOOK(ON_REMOVE_WORLD, go->GetEntry(), go, player);
}
/**
* @brief Called when the GameObject is damaged (destructible buildings only)
*
* @param go Contains information about the GameObject
* @param player Contains information about the Player
*/
void OnDamaged(GameObject* go, Player* player) override
{
TRIGGER_GAMEOBJECT_HOOK(ON_ADD_WORLD, go->GetEntry(), go, player);
}
};
void AddSC_PythonGameObjectScripts()
{
new PythonGameObjectScript();
}