TrinityCore
Loading...
Searching...
No Matches
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;
27enum class AreaTriggerExitReason : uint8;
28
30{
32
33 protected:
35 public:
36 explicit AreaTriggerAI(AreaTrigger* a, uint32 scriptId = {}) noexcept;
37 AreaTriggerAI(AreaTriggerAI const&) = delete;
41 virtual ~AreaTriggerAI();
42
43 // Called when the AreaTrigger has just been initialized, just before added to map
44 virtual void OnInitialize() { }
45
46 // Called when the AreaTrigger has just been created
47 virtual void OnCreate([[maybe_unused]] Spell const* creatingSpell) { }
48
49 // Called on each AreaTrigger update
50 virtual void OnUpdate([[maybe_unused]] uint32 diff) { }
51
52 // Called when the AreaTrigger reach splineIndex
53 virtual void OnSplineIndexReached([[maybe_unused]] int32 splineIndex) { }
54
55 // Called when the AreaTrigger reach its destination
56 virtual void OnDestinationReached() { }
57
58 // Called when an unit enter the AreaTrigger
59 virtual void OnUnitEnter([[maybe_unused]] Unit* unit) { }
60
61 // Called when an unit exit the AreaTrigger, or when the AreaTrigger is removed
62 virtual void OnUnitExit([[maybe_unused]] Unit* unit, [[maybe_unused]] AreaTriggerExitReason reason) { }
63
64 // Called when the AreaTrigger is removed
65 virtual void OnRemove() { }
66
67 // Pass parameters between AI
68 virtual void DoAction([[maybe_unused]] int32 param) { }
69 virtual uint32 GetData([[maybe_unused]] uint32 id) const { return 0; }
70 virtual void SetData([[maybe_unused]] uint32 id, [[maybe_unused]] uint32 value) { }
71 virtual void SetGUID([[maybe_unused]] ObjectGuid const& guid, [[maybe_unused]] int32 id) { }
72 virtual ObjectGuid GetGUID([[maybe_unused]] int32 id) const { return ObjectGuid::Empty; }
73
74 // Gets the id of the AI (script id)
75 uint32 GetId() const { return _scriptId; }
76};
77
79{
80 public:
82};
83
84#endif
AreaTriggerExitReason
Definition AreaTrigger.h:69
#define TC_GAME_API
Definition Define.h:129
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
virtual void DoAction(int32 param)
virtual void OnUnitExit(Unit *unit, AreaTriggerExitReason reason)
virtual ObjectGuid GetGUID(int32 id) const
virtual void OnCreate(Spell const *creatingSpell)
virtual void OnDestinationReached()
virtual void OnUnitEnter(Unit *unit)
virtual void OnSplineIndexReached(int32 splineIndex)
virtual void OnInitialize()
virtual void SetData(uint32 id, uint32 value)
AreaTriggerAI(AreaTriggerAI &&)=delete
uint32 GetId() const
AreaTrigger *const at
AreaTriggerAI(AreaTriggerAI const &)=delete
AreaTriggerAI(AreaTrigger *a, uint32 scriptId={}) noexcept
virtual void OnRemove()
AreaTriggerAI & operator=(AreaTriggerAI const &)=delete
virtual void OnUpdate(uint32 diff)
AreaTriggerAI & operator=(AreaTriggerAI &&)=delete
virtual void SetGUID(ObjectGuid const &guid, int32 id)
virtual ~AreaTriggerAI()
virtual uint32 GetData(uint32 id) const
static ObjectGuid const Empty
Definition ObjectGuid.h:314
Definition Spell.h:277
Definition Unit.h:635