From a315baeb77319dfc51a66041100f1dc8fa082bb7 Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Wed, 31 Dec 2008 12:33:54 +0100 Subject: *Option to define emote to play with any text from database text tables. - by Lightguard --HG-- branch : trunk --- src/bindings/scripts/ScriptMgr.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'src/bindings/scripts/ScriptMgr.cpp') diff --git a/src/bindings/scripts/ScriptMgr.cpp b/src/bindings/scripts/ScriptMgr.cpp index 5d78d40030d..0dc71482df8 100644 --- a/src/bindings/scripts/ScriptMgr.cpp +++ b/src/bindings/scripts/ScriptMgr.cpp @@ -29,6 +29,7 @@ struct StringTextData uint32 SoundId; uint8 Type; uint32 Language; + uint32 Emote; }; // Enums used by StringTextData::Type @@ -654,7 +655,7 @@ void LoadDatabase() LoadTrinityStrings(TScriptDB,"eventai_texts",-1,1+(TEXT_SOURCE_RANGE)); // Gather Additional data from EventAI Texts - result = TScriptDB.PQuery("SELECT entry, sound, type, language FROM eventai_texts"); + result = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM eventai_texts"); outstring_log("TSCR: Loading EventAI Texts additional data..."); if (result) @@ -672,6 +673,7 @@ void LoadDatabase() temp.SoundId = fields[1].GetInt32(); temp.Type = fields[2].GetInt32(); temp.Language = fields[3].GetInt32(); + temp.Emote = fields[4].GetInt32(); if (i >= 0) { @@ -736,6 +738,7 @@ void LoadDatabase() temp.SoundId = fields[1].GetInt32(); temp.Type = fields[2].GetInt32(); temp.Language = fields[3].GetInt32(); + temp.Emote = fields[4].GetInt32(); if (i >= 0) { @@ -782,7 +785,7 @@ void LoadDatabase() LoadTrinityStrings(TScriptDB,"custom_texts",TEXT_SOURCE_RANGE*2,1+(TEXT_SOURCE_RANGE*3)); // Gather Additional data from Custom Texts - result = TScriptDB.PQuery("SELECT entry, sound, type, language FROM custom_texts"); + result = TScriptDB.PQuery("SELECT entry, sound, type, language, emote FROM custom_texts"); outstring_log("TSCR: Loading Custom Texts additional data..."); if (result) @@ -800,6 +803,7 @@ void LoadDatabase() temp.SoundId = fields[1].GetInt32(); temp.Type = fields[2].GetInt32(); temp.Language = fields[3].GetInt32(); + temp.Emote = fields[4].GetInt32(); if (i >= 0) { @@ -1838,7 +1842,7 @@ void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target) return; } - debug_log("TSCR: DoScriptText: text entry=%i, Sound=%u, Type=%u, Language=%u",textEntry,(*i).second.SoundId,(*i).second.Type,(*i).second.Language); + debug_log("TSCR: 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); if((*i).second.SoundId) { @@ -1850,6 +1854,16 @@ void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target) error_log("TSCR: DoScriptText entry %i tried to process invalid sound id %u.",textEntry,(*i).second.SoundId); } + if((*i).second.Emote) + { + if (pSource->GetTypeId() == TYPEID_UNIT || pSource->GetTypeId() == TYPEID_PLAYER) + { + ((Unit*)pSource)->HandleEmoteCommand((*i).second.Emote); + } + else + error_log("TSCR: DoScriptText entry %i tried to process emote for invalid TypeId (%u).",textEntry,pSource->GetTypeId()); + } + switch((*i).second.Type) { case CHAT_TYPE_SAY: -- cgit v1.2.3