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
144 :
145 _dialogueArray(dialogueArray),
146 _currentEntry(nullptr),
147 _actionTimer(0)
148 { }
uint32 _actionTimer
Definition zone_winterspring.cpp:224
DialogueEntry const * _dialogueArray
Definition zone_winterspring.cpp:221
DialogueEntry const * _currentEntry
Definition zone_winterspring.cpp:222

Member Function Documentation

◆ DialogueUpdate()

void DialogueHelper::DialogueUpdate ( uint32  diff)
inline
176 {
177 if (_actionTimer)
178 {
179 if (_actionTimer <= diff)
181 else
182 _actionTimer -= diff;
183 }
184 }
void DoNextDialogueStep()
Definition zone_winterspring.cpp:193

References _actionTimer, and DoNextDialogueStep().

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

◆ DoNextDialogueStep()

void DialogueHelper::DoNextDialogueStep ( )
inlineprivate
194 {
195 // Last Dialogue Entry done?
197 {
198 _actionTimer = 0;
199 return;
200 }
201
202 // Get Text, SpeakerEntry and Timer
203 int32 textEntry = _currentEntry->TextEntry;
204 uint32 sayerEntry = _currentEntry->SayerEntry;
206
207 // Simulate Case
208 if (sayerEntry && textEntry >= 0)
209 {
210 // Use Speaker if directly provided
211 if (Creature* speaker = GetSpeakerByEntry(sayerEntry))
212 speaker->AI()->Talk(textEntry);
213 }
214
216
217 // Increment position
219 }
std::int32_t int32
Definition Define.h:103
std::uint32_t uint32
Definition Define.h:107
Definition Creature.h:43
virtual Creature * GetSpeakerByEntry(int32)
Will be called to get a speaker, MUST be implemented if not used in instances.
Definition zone_winterspring.cpp:190
virtual void JustDidDialogueStep(int32)
Will be called when a dialogue step was done.
Definition zone_winterspring.cpp:188
int32 TextEntry
To be said text entry.
Definition zone_winterspring.cpp:135
int32 SayerEntry
Entry of the mob who should say.
Definition zone_winterspring.cpp:136
uint32 SayTimer
Time delay until next text of array is said (0 stops)
Definition zone_winterspring.cpp:137

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.

190{ 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.

188{ }

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

155 {
156 // Find textEntry
157 bool found = false;
158
159 for (DialogueEntry const* entry = _dialogueArray; entry->TextEntry; ++entry)
160 {
161 if (entry->TextEntry == textEntry)
162 {
163 _currentEntry = entry;
164 found = true;
165 break;
166 }
167 }
168
169 if (!found)
170 return;
171
173 }
Definition zone_winterspring.cpp:134

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: