TrinityCore
Loading...
Searching...
No Matches
ConversationAI.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_CONVERSATIONAI_H
19#define TRINITY_CONVERSATIONAI_H
20
21#include "Define.h"
22#include "ObjectGuid.h"
23
24class Conversation;
25class Unit;
26class Player;
27
29{
31
32 protected:
34 public:
35 explicit ConversationAI(Conversation* c, uint32 scriptId = {}) noexcept;
40 virtual ~ConversationAI();
41
42 // Called when the Conversation has just been initialized, just before added to map
43 virtual void OnInitialize() {}
44
45 // Called when Conversation is created but not added to Map yet.
46 virtual void OnCreate([[maybe_unused]] Unit* creator) { }
47
48 // Called when Conversation is started
49 virtual void OnStart() { }
50
51 // Called when player sends CMSG_CONVERSATION_LINE_STARTED with valid conversation guid
52 virtual void OnLineStarted([[maybe_unused]] uint32 lineId, [[maybe_unused]] Player* sender) { }
53
54 // Called for each update tick
55 virtual void OnUpdate([[maybe_unused]] uint32 diff) { }
56
57 // Called when the Conversation is removed
58 virtual void OnRemove() { }
59
60 // Pass parameters between AI
61 virtual void DoAction([[maybe_unused]] int32 param) { }
62 virtual uint32 GetData([[maybe_unused]] uint32 id) const { return 0; }
63 virtual void SetData([[maybe_unused]] uint32 id, [[maybe_unused]] uint32 value) { }
64 virtual void SetGUID([[maybe_unused]] ObjectGuid const& guid, [[maybe_unused]] int32 id) { }
65 virtual ObjectGuid GetGUID([[maybe_unused]] int32 id) const { return ObjectGuid::Empty; }
66
67 // Gets the id of the AI (script id)
68 uint32 GetId() const { return _scriptId; }
69};
70
72{
73 public:
75};
76
77#endif
#define TC_GAME_API
Definition Define.h:129
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
virtual void OnInitialize()
virtual void DoAction(int32 param)
virtual void OnLineStarted(uint32 lineId, Player *sender)
virtual ~ConversationAI()
ConversationAI(ConversationAI const &)=delete
virtual void OnCreate(Unit *creator)
Conversation *const conversation
virtual void OnRemove()
ConversationAI(Conversation *c, uint32 scriptId={}) noexcept
ConversationAI(ConversationAI &&)=delete
virtual void SetData(uint32 id, uint32 value)
ConversationAI & operator=(ConversationAI &&)=delete
virtual ObjectGuid GetGUID(int32 id) const
uint32 GetId() const
ConversationAI & operator=(ConversationAI const &)=delete
virtual void OnUpdate(uint32 diff)
virtual void SetGUID(ObjectGuid const &guid, int32 id)
virtual uint32 GetData(uint32 id) const
virtual void OnStart()
static ObjectGuid const Empty
Definition ObjectGuid.h:314
Definition Unit.h:635