TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
GameObjectAI.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef TRINITY_GAMEOBJECTAI_H
20 #define TRINITY_GAMEOBJECTAI_H
21 
22 #include "Define.h"
23 #include <list>
24 #include "Object.h"
25 #include "QuestDef.h"
26 #include "GameObject.h"
27 #include "CreatureAI.h"
28 
30 {
31  protected:
32  GameObject* const go;
33  public:
34  explicit GameObjectAI(GameObject* g) : go(g) { }
35  virtual ~GameObjectAI() { }
36 
37  virtual void UpdateAI(uint32 /*diff*/) { }
38 
39  virtual void InitializeAI() { Reset(); }
40 
41  virtual void Reset() { }
42 
43  // Pass parameters between AI
44  virtual void DoAction(int32 /*param = 0 */) { }
45  virtual void SetGUID(uint64 /*guid*/, int32 /*id = 0 */) { }
46  virtual uint64 GetGUID(int32 /*id = 0 */) const { return 0; }
47 
48  static int Permissible(GameObject const* go);
49 
50  virtual bool GossipHello(Player* /*player*/) { return false; }
51  virtual bool GossipSelect(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/) { return false; }
52  virtual bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, char const* /*code*/) { return false; }
53  virtual bool QuestAccept(Player* /*player*/, Quest const* /*quest*/) { return false; }
54  virtual bool QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }
56  virtual void Destroyed(Player* /*player*/, uint32 /*eventId*/) { }
57  virtual uint32 GetData(uint32 /*id*/) const { return 0; }
58  virtual void SetData64(uint32 /*id*/, uint64 /*value*/) { }
59  virtual uint64 GetData64(uint32 /*id*/) const { return 0; }
60  virtual void SetData(uint32 /*id*/, uint32 /*value*/) { }
61  virtual void OnGameEvent(bool /*start*/, uint16 /*eventId*/) { }
62  virtual void OnStateChanged(uint32 /*state*/, Unit* /*unit*/) { }
63  virtual void EventInform(uint32 /*eventId*/) { }
64 };
65 
67 {
68  public:
69  explicit NullGameObjectAI(GameObject* g);
70 
71  void UpdateAI(uint32 /*diff*/) override { }
72 
73  static int Permissible(GameObject const* /*go*/) { return PERMIT_BASE_IDLE; }
74 };
75 #endif
static int Permissible(GameObject const *)
Definition: GameObjectAI.h:73
virtual bool QuestAccept(Player *, Quest const *)
Definition: GameObjectAI.h:53
virtual uint64 GetGUID(int32) const
Definition: GameObjectAI.h:46
virtual void OnStateChanged(uint32, Unit *)
Definition: GameObjectAI.h:62
virtual void OnGameEvent(bool, uint16)
Definition: GameObjectAI.h:61
Definition: QuestDef.h:279
virtual uint32 GetDialogStatus(Player *)
Definition: GameObjectAI.h:55
virtual uint32 GetData(uint32) const
Definition: GameObjectAI.h:57
virtual bool GossipSelect(Player *, uint32, uint32)
Definition: GameObjectAI.h:51
virtual void DoAction(int32)
Definition: GameObjectAI.h:44
virtual bool GossipSelectCode(Player *, uint32, uint32, char const *)
Definition: GameObjectAI.h:52
Definition: QuestDef.h:136
virtual void SetData64(uint32, uint64)
Definition: GameObjectAI.h:58
virtual void SetData(uint32, uint32)
Definition: GameObjectAI.h:60
Definition: GameObjectAI.h:29
virtual void UpdateAI(uint32)
Definition: GameObjectAI.h:37
virtual bool GossipHello(Player *)
Definition: GameObjectAI.h:50
virtual bool QuestReward(Player *, Quest const *, uint32)
Definition: GameObjectAI.h:54
Definition: CreatureAI.h:208
virtual void SetGUID(uint64, int32)
Definition: GameObjectAI.h:45
GameObjectAI(GameObject *g)
Definition: GameObjectAI.h:34
virtual void Destroyed(Player *, uint32)
Definition: GameObjectAI.h:56
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
uint64_t uint64
Definition: Define.h:149
void UpdateAI(uint32) override
Definition: GameObjectAI.h:71
uint16_t uint16
Definition: Define.h:151
Definition: GameObject.h:880
virtual ~GameObjectAI()
Definition: GameObjectAI.h:35
virtual void InitializeAI()
Definition: GameObjectAI.h:39
#define TC_GAME_API
Definition: Define.h:134
virtual uint64 GetData64(uint32) const
Definition: GameObjectAI.h:59
virtual void Reset()
Definition: GameObjectAI.h:41
Definition: FactoryHolder.h:52
GameObject *const go
Definition: GameObjectAI.h:32
virtual void EventInform(uint32)
Definition: GameObjectAI.h:63
Definition: GameObjectAI.h:66
Definition: Unit.h:1305