mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[9883] Change SCRIPT_COMMAND_TALK to support CHAT_TYPE_* using enum ChatType
Making data consistent with other, similar tables like EventAI's text tables. This convert existing data and also adds support for all chat types. Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
parent
41c58f3be9
commit
b208effca6
8 changed files with 57 additions and 17 deletions
|
|
@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
|
|||
`version` varchar(120) default NULL,
|
||||
`creature_ai_version` varchar(120) default NULL,
|
||||
`cache_id` int(10) default '0',
|
||||
`required_9881_01_mangos_scripts` bit(1) default NULL
|
||||
`required_9883_01_mangos_scripts` bit(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||
|
||||
--
|
||||
|
|
|
|||
25
sql/updates/9883_01_mangos_scripts.sql
Normal file
25
sql/updates/9883_01_mangos_scripts.sql
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
ALTER TABLE db_version CHANGE COLUMN required_9881_01_mangos_scripts required_9883_01_mangos_scripts bit;
|
||||
|
||||
-- convert to CHAT_TYPE_WHISPER
|
||||
UPDATE event_scripts SET datalong=4 WHERE command=0 AND datalong=1;
|
||||
UPDATE gameobject_scripts SET datalong=4 WHERE command=0 AND datalong=1;
|
||||
UPDATE gossip_scripts SET datalong=4 WHERE command=0 AND datalong=1;
|
||||
UPDATE quest_end_scripts SET datalong=4 WHERE command=0 AND datalong=1;
|
||||
UPDATE quest_start_scripts SET datalong=4 WHERE command=0 AND datalong=1;
|
||||
UPDATE spell_scripts SET datalong=4 WHERE command=0 AND datalong=1;
|
||||
|
||||
-- convert to CHAT_TYPE_YELL
|
||||
UPDATE event_scripts SET datalong=1 WHERE command=0 AND datalong=2;
|
||||
UPDATE gameobject_scripts SET datalong=1 WHERE command=0 AND datalong=2;
|
||||
UPDATE gossip_scripts SET datalong=1 WHERE command=0 AND datalong=2;
|
||||
UPDATE quest_end_scripts SET datalong=1 WHERE command=0 AND datalong=2;
|
||||
UPDATE quest_start_scripts SET datalong=1 WHERE command=0 AND datalong=2;
|
||||
UPDATE spell_scripts SET datalong=1 WHERE command=0 AND datalong=2;
|
||||
|
||||
-- convert to CHAT_TYPE_TEXT_EMOTE
|
||||
UPDATE event_scripts SET datalong=2 WHERE command=0 AND datalong=3;
|
||||
UPDATE gameobject_scripts SET datalong=2 WHERE command=0 AND datalong=3;
|
||||
UPDATE gossip_scripts SET datalong=2 WHERE command=0 AND datalong=3;
|
||||
UPDATE quest_end_scripts SET datalong=2 WHERE command=0 AND datalong=3;
|
||||
UPDATE quest_start_scripts SET datalong=2 WHERE command=0 AND datalong=3;
|
||||
UPDATE spell_scripts SET datalong=2 WHERE command=0 AND datalong=3;
|
||||
|
|
@ -59,6 +59,7 @@ pkgdata_DATA = \
|
|||
9849_01_characters_saved_variables.sql \
|
||||
9854_01_mangos_spell_bonus_data.sql \
|
||||
9881_01_mangos_scripts.sql \
|
||||
9883_01_mangos_scripts.sql \
|
||||
README
|
||||
|
||||
## Additional files to include when running 'make dist'
|
||||
|
|
@ -98,4 +99,5 @@ EXTRA_DIST = \
|
|||
9849_01_characters_saved_variables.sql \
|
||||
9854_01_mangos_spell_bonus_data.sql \
|
||||
9881_01_mangos_scripts.sql \
|
||||
9883_01_mangos_scripts.sql \
|
||||
README
|
||||
|
|
|
|||
|
|
@ -2860,7 +2860,7 @@ void Map::ScriptsProcess()
|
|||
break;
|
||||
}
|
||||
|
||||
if (source->GetTypeId()!=TYPEID_UNIT)
|
||||
if (source->GetTypeId() != TYPEID_UNIT)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_TALK (script id %u) call for non-creature (TypeId: %u), skipping.", step.script->id, source->GetTypeId());
|
||||
break;
|
||||
|
|
@ -2868,25 +2868,38 @@ void Map::ScriptsProcess()
|
|||
|
||||
uint64 unit_target = target ? target->GetGUID() : 0;
|
||||
|
||||
//datalong 0=normal say, 1=whisper, 2=yell, 3=emote text
|
||||
switch(step.script->datalong)
|
||||
{
|
||||
case 0: // Say
|
||||
((Creature *)source)->Say(step.script->dataint, LANG_UNIVERSAL, unit_target);
|
||||
case CHAT_TYPE_SAY:
|
||||
((Creature*)source)->Say(step.script->dataint, LANG_UNIVERSAL, unit_target);
|
||||
break;
|
||||
case 1: // Whisper
|
||||
case CHAT_TYPE_YELL:
|
||||
((Creature*)source)->Yell(step.script->dataint, LANG_UNIVERSAL, unit_target);
|
||||
break;
|
||||
case CHAT_TYPE_TEXT_EMOTE:
|
||||
((Creature*)source)->TextEmote(step.script->dataint, unit_target);
|
||||
break;
|
||||
case CHAT_TYPE_BOSS_EMOTE:
|
||||
((Creature*)source)->TextEmote(step.script->dataint, unit_target, true);
|
||||
break;
|
||||
case CHAT_TYPE_WHISPER:
|
||||
if (!unit_target)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_TALK (script id %u) attempt to whisper (%u) NULL, skipping.", step.script->id, step.script->datalong);
|
||||
sLog.outError("SCRIPT_COMMAND_TALK (script id %u) attempt to whisper (%u) 0-guid, skipping.", step.script->id, step.script->datalong);
|
||||
break;
|
||||
}
|
||||
((Creature *)source)->Whisper(step.script->dataint, unit_target);
|
||||
((Creature*)source)->Whisper(step.script->dataint, unit_target);
|
||||
break;
|
||||
case 2: // Yell
|
||||
((Creature *)source)->Yell(step.script->dataint, LANG_UNIVERSAL, unit_target);
|
||||
case CHAT_TYPE_BOSS_WHISPER:
|
||||
if (!unit_target)
|
||||
{
|
||||
sLog.outError("SCRIPT_COMMAND_TALK (script id %u) attempt to whisper (%u) 0-guid, skipping.", step.script->id, step.script->datalong);
|
||||
break;
|
||||
case 3: // Emote text
|
||||
((Creature *)source)->TextEmote(step.script->dataint, unit_target);
|
||||
}
|
||||
((Creature*)source)->Whisper(step.script->dataint, unit_target, true);
|
||||
break;
|
||||
case CHAT_TYPE_ZONE_YELL:
|
||||
((Creature*)source)->YellToZone(step.script->dataint, LANG_UNIVERSAL, unit_target);
|
||||
break;
|
||||
default:
|
||||
break; // must be already checked at load
|
||||
|
|
|
|||
|
|
@ -4200,9 +4200,9 @@ void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
|
|||
{
|
||||
case SCRIPT_COMMAND_TALK:
|
||||
{
|
||||
if(tmp.datalong > 3)
|
||||
if(tmp.datalong > CHAT_TYPE_ZONE_YELL)
|
||||
{
|
||||
sLog.outErrorDb("Table `%s` has invalid talk type (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u",tablename,tmp.datalong,tmp.id);
|
||||
sLog.outErrorDb("Table `%s` has invalid CHAT_TYPE_ (datalong = %u) in SCRIPT_COMMAND_TALK for script id %u",tablename,tmp.datalong,tmp.id);
|
||||
continue;
|
||||
}
|
||||
if(tmp.dataint==0)
|
||||
|
|
|
|||
|
|
@ -386,7 +386,7 @@ enum RealmZone
|
|||
};
|
||||
|
||||
// DB scripting commands
|
||||
#define SCRIPT_COMMAND_TALK 0 // source = unit, target=any, datalong ( 0=say, 1=whisper, 2=yell, 3=emote text)
|
||||
#define SCRIPT_COMMAND_TALK 0 // source = unit, target=any, datalong (see enum ChatType for supported CHAT_TYPE_'s)
|
||||
#define SCRIPT_COMMAND_EMOTE 1 // source = unit, datalong = anim_id
|
||||
#define SCRIPT_COMMAND_FIELD_SET 2 // source = any, datalong = field_id, datalog2 = value
|
||||
#define SCRIPT_COMMAND_MOVE_TO 3 // source = Creature, datalog2 = time, x/y/z
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9882"
|
||||
#define REVISION_NR "9883"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef __REVISION_SQL_H__
|
||||
#define __REVISION_SQL_H__
|
||||
#define REVISION_DB_CHARACTERS "required_9849_01_characters_saved_variables"
|
||||
#define REVISION_DB_MANGOS "required_9881_01_mangos_scripts"
|
||||
#define REVISION_DB_MANGOS "required_9883_01_mangos_scripts"
|
||||
#define REVISION_DB_REALMD "required_9748_01_realmd_realmlist"
|
||||
#endif // __REVISION_SQL_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue