mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 01:37:37 +01:00
*Option to define emote to play with any text from database text tables. - by Lightguard
--HG-- branch : trunk
This commit is contained in:
3
sql/updates/724_world.sql
Normal file
3
sql/updates/724_world.sql
Normal file
@@ -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;
|
||||
@@ -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:
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user