@@ -24,6 +24,7 @@ struct StringTextData
2424 uint32 SoundId;
2525 uint8 Type;
2626 uint32 Language;
27+ uint32 Emote;
2728};
2829
2930// Enums used by StringTextData::Type
@@ -626,7 +627,7 @@ void LoadDatabase()
626627 LoadMangosStrings (SD2Database," eventai_texts" ,-1 ,1 +(TEXT_SOURCE_RANGE ));
627628
628629 // Gather Additional data from EventAI Texts
629- result = SD2Database.PQuery (" SELECT entry, sound, type, language FROM eventai_texts" );
630+ result = SD2Database.PQuery (" SELECT entry, sound, type, language, emote FROM eventai_texts" );
630631
631632 outstring_log (" SD2: Loading EventAI Texts additional data..." );
632633 if (result)
@@ -644,6 +645,7 @@ void LoadDatabase()
644645 temp.SoundId = fields[1 ].GetInt32 ();
645646 temp.Type = fields[2 ].GetInt32 ();
646647 temp.Language = fields[3 ].GetInt32 ();
648+ temp.Emote = fields[4 ].GetInt32 ();
647649
648650 if (i >= 0 )
649651 {
@@ -690,7 +692,7 @@ void LoadDatabase()
690692 LoadMangosStrings (SD2Database," script_texts" ,TEXT_SOURCE_RANGE ,1 +(TEXT_SOURCE_RANGE *2 ));
691693
692694 // Gather Additional data from Script Texts
693- result = SD2Database.PQuery (" SELECT entry, sound, type, language FROM script_texts" );
695+ result = SD2Database.PQuery (" SELECT entry, sound, type, language, emote FROM script_texts" );
694696
695697 outstring_log (" SD2: Loading Script Texts additional data..." );
696698 if (result)
@@ -708,6 +710,7 @@ void LoadDatabase()
708710 temp.SoundId = fields[1 ].GetInt32 ();
709711 temp.Type = fields[2 ].GetInt32 ();
710712 temp.Language = fields[3 ].GetInt32 ();
713+ temp.Emote = fields[4 ].GetInt32 ();
711714
712715 if (i >= 0 )
713716 {
@@ -754,7 +757,7 @@ void LoadDatabase()
754757 LoadMangosStrings (SD2Database," custom_texts" ,TEXT_SOURCE_RANGE *2 ,1 +(TEXT_SOURCE_RANGE *3 ));
755758
756759 // Gather Additional data from Custom Texts
757- result = SD2Database.PQuery (" SELECT entry, sound, type, language FROM custom_texts" );
760+ result = SD2Database.PQuery (" SELECT entry, sound, type, language, emote FROM custom_texts" );
758761
759762 outstring_log (" SD2: Loading Custom Texts additional data..." );
760763 if (result)
@@ -772,6 +775,7 @@ void LoadDatabase()
772775 temp.SoundId = fields[1 ].GetInt32 ();
773776 temp.Type = fields[2 ].GetInt32 ();
774777 temp.Language = fields[3 ].GetInt32 ();
778+ temp.Emote = fields[4 ].GetInt32 ();
775779
776780 if (i >= 0 )
777781 {
@@ -1796,11 +1800,11 @@ void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target)
17961800 return ;
17971801 }
17981802
1799- debug_log (" SD2: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u" ,textEntry,(*i).second .SoundId ,(*i).second .Type ,(*i).second .Language );
1803+ debug_log (" SD2: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u, Emote=%u " ,textEntry,(*i).second .SoundId ,(*i).second .Type ,(*i).second .Language ,(*i). second . Emote );
18001804
18011805 if ((*i).second .SoundId )
18021806 {
1803- if ( GetSoundEntriesStore ()->LookupEntry ((*i).second .SoundId ) )
1807+ if ( GetSoundEntriesStore ()->LookupEntry ((*i).second .SoundId ))
18041808 {
18051809 WorldPacket data (4 );
18061810 data.SetOpcode (SMSG_PLAY_SOUND );
@@ -1811,6 +1815,16 @@ void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target)
18111815 error_log (" SD2: DoScriptText entry %i tried to process invalid sound id %u." ,textEntry,(*i).second .SoundId );
18121816 }
18131817
1818+ if ((*i).second .Emote )
1819+ {
1820+ if (pSource->GetTypeId () == TYPEID_UNIT || pSource->GetTypeId () == TYPEID_PLAYER )
1821+ {
1822+ ((Unit*)pSource)->HandleEmoteCommand ((*i).second .Emote );
1823+ }
1824+ else
1825+ error_log (" SD2: DoScriptText entry %i tried to process emote for invalid TypeId (%u)." ,textEntry,pSource->GetTypeId ());
1826+ }
1827+
18141828 switch ((*i).second .Type )
18151829 {
18161830 case CHAT_TYPE_SAY :
0 commit comments