summaryrefslogtreecommitdiff
path: root/src/server/game/Scripting/ScriptDefines/AllGameObjectScript.h
blob: 2dd5ba2a762c1c0cae5e9096f7c0b303a28057f8 (plain)
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
/*
 * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by the
 * Free Software Foundation; either version 3 of the License, or (at your
 * option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef SCRIPT_OBJECT_ALL_GAMEOBJECT_SCRIPT_H_
#define SCRIPT_OBJECT_ALL_GAMEOBJECT_SCRIPT_H_

#include "ScriptObject.h"

class AllGameObjectScript : public ScriptObject
{
protected:
    AllGameObjectScript(const char* name);

public:
    /**
     * @brief This hook runs after add game object in world
     *
     * @param go Contains information about the GameObject
     */
    virtual void OnGameObjectAddWorld(GameObject* /*go*/) { }
    /**
     * @brief This hook runs after the game object iis saved to the database
     *
     * @param go Contains information about the GameObject
     */
    virtual void OnGameObjectSaveToDB(GameObject* /*go*/) { }
    /**
     * @brief This hook runs after remove game object in world
     *
     * @param go Contains information about the GameObject
     */
    virtual void OnGameObjectRemoveWorld(GameObject* /*go*/) { }

    /**
     * @brief This hook runs after remove game object in world
     *
     * @param go Contains information about the GameObject
     */
    virtual void OnGameObjectUpdate(GameObject* /*go*/, uint32 /*diff*/) { }

    // Called when a player opens a gossip dialog with the gameobject.
    [[nodiscard]] virtual bool CanGameObjectGossipHello(Player* /*player*/, GameObject* /*go*/) { return false; }

    // Called when a player selects a gossip item in the gameobject's gossip menu.
    [[nodiscard]] virtual bool CanGameObjectGossipSelect(Player* /*player*/, GameObject* /*go*/, uint32 /*sender*/, uint32 /*action*/) { return false; }

    // Called when a player selects a gossip with a code in the gameobject's gossip menu.
    [[nodiscard]] virtual bool CanGameObjectGossipSelectCode(Player* /*player*/, GameObject* /*go*/, uint32 /*sender*/, uint32 /*action*/, const char* /*code*/) { return false; }

    // Called when a player accepts a quest from the gameobject.
    [[nodiscard]] virtual bool CanGameObjectQuestAccept(Player* /*player*/, GameObject* /*go*/, Quest const* /*quest*/) { return false; }

    // Called when a player selects a quest reward.
    [[nodiscard]] virtual bool CanGameObjectQuestReward(Player* /*player*/, GameObject* /*go*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }

    // Called when the game object is destroyed (destructible buildings only).
    virtual void OnGameObjectDestroyed(GameObject* /*go*/, Player* /*player*/) { }

    // Called when the game object is damaged (destructible buildings only).
    virtual void OnGameObjectDamaged(GameObject* /*go*/, Player* /*player*/) { }

    // Called when the health of a game object is modified (destructible buildings only).
    virtual void OnGameObjectModifyHealth(GameObject* /*go*/, Unit* /*attackerOrHealer*/, int32& /*change*/, SpellInfo const* /*spellInfo*/) { }

    // Called when the game object loot state is changed.
    virtual void OnGameObjectLootStateChanged(GameObject* /*go*/, uint32 /*state*/, Unit* /*unit*/) { }

    // Called when the game object state is changed.
    virtual void OnGameObjectStateChanged(GameObject* /*go*/, uint32 /*state*/) { }

    // Called when a GameObjectAI object is needed for the gameobject.
    virtual GameObjectAI* GetGameObjectAI(GameObject* /*go*/) const { return nullptr; }
};

#endif