diff options
author | Blaymoira <none@none> | 2008-12-31 12:33:54 +0100 |
---|---|---|
committer | Blaymoira <none@none> | 2008-12-31 12:33:54 +0100 |
commit | a315baeb77319dfc51a66041100f1dc8fa082bb7 (patch) | |
tree | 10b957a3affc07bbf669e52ca5e83e9d44abf5a2 | |
parent | 8e812a2ca651ad1f7c7f6192c422aaf966094047 (diff) |
*Option to define emote to play with any text from database text tables. - by Lightguard
--HG--
branch : trunk
-rw-r--r-- | sql/updates/724_world.sql | 3 | ||||
-rw-r--r-- | src/bindings/scripts/ScriptMgr.cpp | 20 | ||||
-rw-r--r-- | src/bindings/scripts/docs/Text-tables.txt | 1 |
3 files changed, 21 insertions, 3 deletions
diff --git a/sql/updates/724_world.sql b/sql/updates/724_world.sql new file mode 100644 index 00000000000..36a2d007de3 --- /dev/null +++ b/sql/updates/724_world.sql @@ -0,0 +1,3 @@ +ALTER TABLE custom_texts ADD COLUMN emote tinyint(3) UNSIGNED DEFAULT '0' NOT NULL AFTER language; +ALTER TABLE eventai_texts ADD COLUMN emote tinyint(3) UNSIGNED DEFAULT '0' NOT NULL AFTER language; +ALTER TABLE script_texts ADD COLUMN emote tinyint(3) UNSIGNED DEFAULT '0' NOT NULL AFTER language;
\ No newline at end of file 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: diff --git a/src/bindings/scripts/docs/Text-tables.txt b/src/bindings/scripts/docs/Text-tables.txt index c335ce41d58..6db1ce9d852 100644 --- a/src/bindings/scripts/docs/Text-tables.txt +++ b/src/bindings/scripts/docs/Text-tables.txt @@ -37,6 +37,7 @@ content_loc8 This is the actual text presented in the Localization #8 C sound This value is the Sound ID that corresponds to the actual text used (Defined in SoundEntries.dbc). type Variables used to define type of text (Say/Yell/Textemote/Whisper). language This value is the Language that the text is native in (Defined in Languages.dbc). +emote Value from enum Emote (defined in Emotes.dbc). Only source of text will play this emote (not target, if target are defined in DoScriptText) comment This is a comment regarding the text entry (For ACID, accepted format is to use Creature ID of NPC using it). Note: Fields `content_loc1` to `content_loc8` are NULL values by default and are handled by seperate localization projects. |