AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
DialogueHelper Class Reference
Inheritance diagram for DialogueHelper:
npc_ranshalla::npc_ranshallaAI

Public Member Functions

 DialogueHelper (DialogueEntry const *dialogueArray)
 
void StartNextDialogueText (int32 textEntry)
 
void DialogueUpdate (uint32 diff)
 

Protected Member Functions

virtual void JustDidDialogueStep (int32)
 Will be called when a dialogue step was done.
 
virtual CreatureGetSpeakerByEntry (int32)
 Will be called to get a speaker, MUST be implemented if not used in instances.
 

Private Member Functions

void DoNextDialogueStep ()
 

Private Attributes

DialogueEntry const * _dialogueArray
 
DialogueEntry const * _currentEntry
 
uint32 _actionTimer
 

Detailed Description

Constructor & Destructor Documentation

◆ DialogueHelper()

DialogueHelper::DialogueHelper ( DialogueEntry const *  dialogueArray)
inline
110 :
111 _dialogueArray(dialogueArray),
112 _currentEntry(nullptr),
113 _actionTimer(0)
114 { }
uint32 _actionTimer
Definition zone_winterspring.cpp:190
DialogueEntry const * _dialogueArray
Definition zone_winterspring.cpp:187
DialogueEntry const * _currentEntry
Definition zone_winterspring.cpp:188

Member Function Documentation

◆ DialogueUpdate()

void DialogueHelper::DialogueUpdate ( uint32  diff)
inline
142 {
143 if (_actionTimer)
144 {
145 if (_actionTimer <= diff)
147 else
148 _actionTimer -= diff;
149 }
150 }
void DoNextDialogueStep()
Definition zone_winterspring.cpp:159

References _actionTimer, and DoNextDialogueStep().

Referenced by npc_ranshalla::npc_ranshallaAI::UpdateEscortAI().

◆ DoNextDialogueStep()

void DialogueHelper::DoNextDialogueStep ( )
inlineprivate
160 {
161 // Last Dialogue Entry done?
163 {
164 _actionTimer = 0;
165 return;
166 }
167
168 // Get Text, SpeakerEntry and Timer
169 int32 textEntry = _currentEntry->TextEntry;
170 uint32 sayerEntry = _currentEntry->SayerEntry;
172
173 // Simulate Case
174 if (sayerEntry && textEntry >= 0)
175 {
176 // Use Speaker if directly provided
177 if (Creature* speaker = GetSpeakerByEntry(sayerEntry))
178 speaker->AI()->Talk(textEntry);
179 }
180
182
183 // Increment position
185 }
std::int32_t int32
Definition Define.h:103
std::uint32_t uint32
Definition Define.h:107
Definition Creature.h:47
virtual Creature * GetSpeakerByEntry(int32)
Will be called to get a speaker, MUST be implemented if not used in instances.
Definition zone_winterspring.cpp:156
virtual void JustDidDialogueStep(int32)
Will be called when a dialogue step was done.
Definition zone_winterspring.cpp:154
int32 TextEntry
To be said text entry.
Definition zone_winterspring.cpp:101
int32 SayerEntry
Entry of the mob who should say.
Definition zone_winterspring.cpp:102
uint32 SayTimer
Time delay until next text of array is said (0 stops)
Definition zone_winterspring.cpp:103

References _actionTimer, _currentEntry, GetSpeakerByEntry(), JustDidDialogueStep(), DialogueEntry::SayerEntry, DialogueEntry::SayTimer, and DialogueEntry::TextEntry.

Referenced by DialogueUpdate(), and StartNextDialogueText().

◆ GetSpeakerByEntry()

virtual Creature * DialogueHelper::GetSpeakerByEntry ( int32  )
inlineprotectedvirtual

Will be called to get a speaker, MUST be implemented if not used in instances.

Reimplemented in npc_ranshalla::npc_ranshallaAI.

156{ return nullptr; }

Referenced by DoNextDialogueStep().

◆ JustDidDialogueStep()

virtual void DialogueHelper::JustDidDialogueStep ( int32  )
inlineprotectedvirtual

Will be called when a dialogue step was done.

Reimplemented in npc_ranshalla::npc_ranshallaAI.

154{ }

Referenced by DoNextDialogueStep().

◆ StartNextDialogueText()

void DialogueHelper::StartNextDialogueText ( int32  textEntry)
inline

Function to initialize the dialogue helper for instances. If not used with instances, GetSpeakerByEntry MUST be overwritten to obtain the speakers Set if take first entries or second entries

121 {
122 // Find textEntry
123 bool found = false;
124
125 for (DialogueEntry const* entry = _dialogueArray; entry->TextEntry; ++entry)
126 {
127 if (entry->TextEntry == textEntry)
128 {
129 _currentEntry = entry;
130 found = true;
131 break;
132 }
133 }
134
135 if (!found)
136 return;
137
139 }
Definition zone_winterspring.cpp:100

References _currentEntry, _dialogueArray, DoNextDialogueStep(), and DialogueEntry::TextEntry.

Referenced by npc_ranshalla::npc_ranshallaAI::SummonedMovementInform(), npc_ranshalla::npc_ranshallaAI::UpdateEscortAI(), and npc_ranshalla::npc_ranshallaAI::WaypointReached().

Member Data Documentation

◆ _actionTimer

uint32 DialogueHelper::_actionTimer
private

◆ _currentEntry

DialogueEntry const* DialogueHelper::_currentEntry
private

◆ _dialogueArray

DialogueEntry const* DialogueHelper::_dialogueArray
private

Referenced by StartNextDialogueText().


The documentation for this class was generated from the following file: