TrinityCore
AreaTriggerAI.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITY_AREATRIGGERAI_H
19#define TRINITY_AREATRIGGERAI_H
20
21#include "Define.h"
22#include "ObjectGuid.h"
23
24class AreaTrigger;
25class Spell;
26class Unit;
27
29{
31
32 protected:
34 public:
35 explicit AreaTriggerAI(AreaTrigger* a, uint32 scriptId = {});
36 virtual ~AreaTriggerAI();
37
38 // Called when the AreaTrigger has just been initialized, just before added to map
39 virtual void OnInitialize() { }
40
41 // Called when the AreaTrigger has just been created
42 virtual void OnCreate([[maybe_unused]] Spell const* creatingSpell) { }
43
44 // Called on each AreaTrigger update
45 virtual void OnUpdate([[maybe_unused]] uint32 diff) { }
46
47 // Called when the AreaTrigger reach splineIndex
48 virtual void OnSplineIndexReached([[maybe_unused]] int32 splineIndex) { }
49
50 // Called when the AreaTrigger reach its destination
51 virtual void OnDestinationReached() { }
52
53 // Called when an unit enter the AreaTrigger
54 virtual void OnUnitEnter([[maybe_unused]] Unit* unit) { }
55
56 // Called when an unit exit the AreaTrigger, or when the AreaTrigger is removed
57 virtual void OnUnitExit([[maybe_unused]] Unit* unit) { }
58
59 // Called when the AreaTrigger is removed
60 virtual void OnRemove() { }
61
62 // Pass parameters between AI
63 virtual void DoAction([[maybe_unused]] int32 param) { }
64 virtual uint32 GetData([[maybe_unused]] uint32 id = 0) const { return 0; }
65 virtual void SetData([[maybe_unused]] uint32 id, [[maybe_unused]] uint32 value) { }
66 virtual void SetGUID([[maybe_unused]] ObjectGuid const& guid, [[maybe_unused]] int32 id = 0) { }
67 virtual ObjectGuid GetGUID([[maybe_unused]] int32 id = 0) const { return ObjectGuid::Empty; }
68
69 // Gets the id of the AI (script id)
70 uint32 GetId() const { return _scriptId; }
71};
72
74{
75 public:
77};
78
79#endif
#define TC_GAME_API
Definition: Define.h:123
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
virtual void DoAction(int32 param)
Definition: AreaTriggerAI.h:63
virtual void OnCreate(Spell const *creatingSpell)
Definition: AreaTriggerAI.h:42
virtual void OnDestinationReached()
Definition: AreaTriggerAI.h:51
virtual void OnUnitEnter(Unit *unit)
Definition: AreaTriggerAI.h:54
virtual void OnSplineIndexReached(int32 splineIndex)
Definition: AreaTriggerAI.h:48
virtual void OnInitialize()
Definition: AreaTriggerAI.h:39
uint32 _scriptId
Definition: AreaTriggerAI.h:30
virtual void OnUnitExit(Unit *unit)
Definition: AreaTriggerAI.h:57
virtual void SetData(uint32 id, uint32 value)
Definition: AreaTriggerAI.h:65
virtual void SetGUID(ObjectGuid const &guid, int32 id=0)
Definition: AreaTriggerAI.h:66
uint32 GetId() const
Definition: AreaTriggerAI.h:70
AreaTrigger *const at
Definition: AreaTriggerAI.h:33
AreaTriggerAI(AreaTrigger *a, uint32 scriptId={})
virtual void OnRemove()
Definition: AreaTriggerAI.h:60
virtual void OnUpdate(uint32 diff)
Definition: AreaTriggerAI.h:45
virtual uint32 GetData(uint32 id=0) const
Definition: AreaTriggerAI.h:64
virtual ObjectGuid GetGUID(int32 id=0) const
Definition: AreaTriggerAI.h:67
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
Definition: Spell.h:255
Definition: Unit.h:627