TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
DialogueHelper Class Reference

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. More...
 
virtual CreatureGetSpeakerByEntry (int32)
 Will be called to get a speaker, MUST be implemented if not used in instances. More...
 

Private Member Functions

void DoNextDialogueStep ()
 

Private Attributes

DialogueEntry const_dialogueArray
 
DialogueEntry const_currentEntry
 
uint32 _actionTimer
 

Constructor & Destructor Documentation

DialogueHelper::DialogueHelper ( DialogueEntry const dialogueArray)
inline
158  :
159  _dialogueArray(dialogueArray),
161  _actionTimer(0)
162  { }
uint32 _actionTimer
Definition: zone_winterspring.cpp:238
arena_t NULL
Definition: jemalloc_internal.h:624
DialogueEntry const * _dialogueArray
Definition: zone_winterspring.cpp:235
DialogueEntry const * _currentEntry
Definition: zone_winterspring.cpp:236

Member Function Documentation

void DialogueHelper::DialogueUpdate ( uint32  diff)
inline
190  {
191  if (_actionTimer)
192  {
193  if (_actionTimer <= diff)
195  else
196  _actionTimer -= diff;
197  }
198  }
uint32 _actionTimer
Definition: zone_winterspring.cpp:238
void DoNextDialogueStep()
Definition: zone_winterspring.cpp:207

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void DialogueHelper::DoNextDialogueStep ( )
inlineprivate
208  {
209  // Last Dialogue Entry done?
211  {
212  _actionTimer = 0;
213  return;
214  }
215 
216  // Get Text, SpeakerEntry and Timer
217  int32 textEntry = _currentEntry->TextEntry;
218  uint32 sayerEntry = _currentEntry->SayerEntry;
220 
221  // Simulate Case
222  if (sayerEntry && textEntry >= 0)
223  {
224  // Use Speaker if directly provided
225  if (Creature* speaker = GetSpeakerByEntry(sayerEntry))
226  speaker->AI()->Talk(textEntry);
227  }
228 
230 
231  // Increment position
232  ++_currentEntry;
233  }
uint32 SayTimer
Time delay until next text of array is said (0 stops)
Definition: zone_winterspring.cpp:151
uint32 _actionTimer
Definition: zone_winterspring.cpp:238
int32 SayerEntry
Entry of the mob who should say.
Definition: zone_winterspring.cpp:150
Definition: Creature.h:467
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
virtual Creature * GetSpeakerByEntry(int32)
Will be called to get a speaker, MUST be implemented if not used in instances.
Definition: zone_winterspring.cpp:204
DialogueEntry const * _currentEntry
Definition: zone_winterspring.cpp:236
int32 TextEntry
To be said text entry.
Definition: zone_winterspring.cpp:149
virtual void JustDidDialogueStep(int32)
Will be called when a dialogue step was done.
Definition: zone_winterspring.cpp:202

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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.

204 { return NULL; }
arena_t NULL
Definition: jemalloc_internal.h:624

+ Here is the caller graph for this function:

virtual void DialogueHelper::JustDidDialogueStep ( int32  )
inlineprotectedvirtual

Will be called when a dialogue step was done.

Reimplemented in npc_ranshalla::npc_ranshallaAI.

202 { }

+ Here is the caller graph for this function:

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

169  {
170  // Find textEntry
171  bool found = false;
172 
173  for (DialogueEntry const* entry = _dialogueArray; entry->TextEntry; ++entry)
174  {
175  if (entry->TextEntry == textEntry)
176  {
177  _currentEntry = entry;
178  found = true;
179  break;
180  }
181  }
182 
183  if (!found)
184  return;
185 
187  }
void DoNextDialogueStep()
Definition: zone_winterspring.cpp:207
DialogueEntry const * _dialogueArray
Definition: zone_winterspring.cpp:235
DialogueEntry const * _currentEntry
Definition: zone_winterspring.cpp:236
Definition: zone_winterspring.cpp:147
int32 TextEntry
To be said text entry.
Definition: zone_winterspring.cpp:149

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

uint32 DialogueHelper::_actionTimer
private
DialogueEntry const* DialogueHelper::_currentEntry
private
DialogueEntry const* DialogueHelper::_dialogueArray
private

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