Advertisement
andriuspel

Untitled

May 18th, 2011
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.73 KB | None | 0 0
  1. Index: src/scripts/src/Common/Base.cpp
  2. ===================================================================
  3. --- src/scripts/src/Common/Base.cpp (revision 4203)
  4. +++ src/scripts/src/Common/Base.cpp (working copy)
  5. @@ -19,6 +19,60 @@
  6.  
  7.  #include "Setup.h"
  8.  
  9. +void MoonScriptCreatureAI::DoScriptText(uint32 TextId, bool UseEvent, EventType pEventType)
  10. +{
  11. +   QueryResult* ScriptTextData = WorldDatabase.Query( "SELECT `Text`, `TextType`, `SoundId`, `EmoteId` FROM `script_texts` WHERE `id`='%u'", TextId);
  12. +
  13. +   if(!ScriptTextData)
  14. +       return;
  15. +
  16. +   Field* CurrentField = NULL;
  17. +   CurrentField = ScriptTextData->Fetch();
  18. +
  19. +   // Setting data types
  20. +   const char * pText; // In table text should'nt be NULL
  21. +   uint8 pTextType;    // Default: Text_Say
  22. +   uint32 pSoundId;
  23. +   uint8 pEmote;
  24. +
  25. +   // Setting gathered data from table
  26. +   pText = CurrentField[0].GetString();
  27. +   pTextType = CurrentField[1].GetUInt8();
  28. +   pSoundId = CurrentField[2].GetUInt32();
  29. +   pEmote = CurrentField[3].GetUInt8();
  30. +
  31. +   if(pText == NULL)
  32. +   {
  33. +       sLog.outDebug("ArcScripts2: Text entry %u hasn't text, skipping...", TextId);
  34. +       return;
  35. +   }else if(pText == NULL || pEmote)
  36. +   {
  37. +       sLog.outDebug("ArcScripts2: Text entry %u hasn't text, but has EmoteId, skipping...", TextId);
  38. +       return;
  39. +   }else if(UseEvent==true || pEventType==Event_None)
  40. +   {
  41. +       sLog.outDebug("ArcScripts2: Text entry %u has wrong event type, check it in scripts, skipping...", TextId);
  42. +       return;
  43. +   }
  44. +
  45. +   if(UseEvent==false)
  46. +   {
  47. +       Emote(pText, (TextType)pTextType, pSoundId);
  48. +       if(pEmote!=0)
  49. +       {
  50. +           _unit->SetEmoteState(pEmote);
  51. +       }
  52. +   }else
  53. +   {
  54. +       AddEmote(pEventType, pText, (TextType)pTextType, pSoundId);
  55. +
  56. +       if(pEmote!=0)
  57. +       {
  58. +           _unit->SetEmoteState(pEmote);
  59. +       }
  60. +   }
  61. +};
  62. +
  63.  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  64.  //Class TargetType
  65.  TargetType::TargetType( uint32 pTargetGen, TargetFilter pTargetFilter, uint32 pMinTargetNumber, uint32 pMaxTargetNumber )
  66. Index: src/scripts/src/Common/Base.h
  67. ===================================================================
  68. --- src/scripts/src/Common/Base.h   (revision 4203)
  69. +++ src/scripts/src/Common/Base.h   (working copy)
  70. @@ -54,6 +54,7 @@
  71.  
  72.  enum EventType
  73.  {
  74. +   Event_None = -1,
  75.     Event_OnCombatStart,
  76.     Event_OnTargetDied,
  77.     Event_OnDied,
  78. @@ -392,6 +393,7 @@
  79.  
  80.     //Emotes
  81.     EmoteDesc*              AddEmote(EventType pEventType, const char* pText, TextType pType, uint32 pSoundId=0);
  82. +   void                    DoScriptText(uint32 TextId, bool Event = false, EventType pEventType=Event_None);
  83.     void                    RemoveEmote(EventType pEventType, EmoteDesc* pEmote);
  84.     void                    RemoveAllEmotes(EventType pEventType);
  85.     void                    Emote(EmoteDesc* pEmote);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement