diff options
author | DDuarte <dnpd.dd@gmail.com> | 2014-09-13 02:45:51 +0100 |
---|---|---|
committer | DDuarte <dnpd.dd@gmail.com> | 2014-09-13 02:45:51 +0100 |
commit | 27479cf571cf65c9e1657e9c465974449173dc3f (patch) | |
tree | d1d15118488d9bb6dd98b689c02e4ba68369a17b | |
parent | f5a3913d95146077c6bae0a4c9541a64cb10a45d (diff) |
Core/Scripts: Nuke db_script_string table and make SCRIPT_COMMAND_TALK with broadcast_text instead
Original code by @Ascathor with modifications
Closes #13092
-rw-r--r-- | sql/updates/world/2014_09_12_04_world_texts.sql | 185 | ||||
-rw-r--r-- | src/server/game/Entities/Object/Object.cpp | 22 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 50 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.h | 4 | ||||
-rw-r--r-- | src/server/game/Miscellaneous/Language.h | 1 | ||||
-rw-r--r-- | src/server/game/Scripting/MapScripts.cpp | 3 | ||||
-rw-r--r-- | src/server/game/World/World.cpp | 3 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_npc.cpp | 21 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_reload.cpp | 10 |
9 files changed, 225 insertions, 74 deletions
diff --git a/sql/updates/world/2014_09_12_04_world_texts.sql b/sql/updates/world/2014_09_12_04_world_texts.sql new file mode 100644 index 00000000000..7fe155bc6b7 --- /dev/null +++ b/sql/updates/world/2014_09_12_04_world_texts.sql @@ -0,0 +1,185 @@ +DROP TABLE `db_script_string`; -- RIP + +UPDATE `waypoint_scripts` SET `dataint` = 5960 WHERE `dataint` = 2000005018; +UPDATE `waypoint_scripts` SET `dataint` = 22392 WHERE `dataint` = 2000005019; +UPDATE `waypoint_scripts` SET `dataint` = 22050 WHERE `dataint` = 2000005020; +UPDATE `waypoint_scripts` SET `dataint` = 22051 WHERE `dataint` = 2000005021; +UPDATE `waypoint_scripts` SET `dataint` = 22052 WHERE `dataint` = 2000005022; +UPDATE `waypoint_scripts` SET `dataint` = 10141 WHERE `dataint` = 2000005023; +UPDATE `waypoint_scripts` SET `dataint` = 10146 WHERE `dataint` = 2000005024; +UPDATE `waypoint_scripts` SET `dataint` = 10152 WHERE `dataint` = 2000005025; +UPDATE `waypoint_scripts` SET `dataint` = 10126 WHERE `dataint` = 2000005026; +UPDATE `waypoint_scripts` SET `dataint` = 7194 WHERE `dataint` = 2000005027; +UPDATE `waypoint_scripts` SET `dataint` = 7193 WHERE `dataint` = 2000005028; +UPDATE `waypoint_scripts` SET `dataint` = 7191 WHERE `dataint` = 2000005029; +UPDATE `waypoint_scripts` SET `dataint` = 10139 WHERE `dataint` = 2000005030; -- 4.x text +UPDATE `waypoint_scripts` SET `dataint` = 6406 WHERE `dataint` = 2000005031; +UPDATE `waypoint_scripts` SET `dataint` = 6405 WHERE `dataint` = 2000005032; +UPDATE `waypoint_scripts` SET `dataint` = 10158 WHERE `dataint` = 2000005033; +UPDATE `waypoint_scripts` SET `dataint` = 22544 WHERE `dataint` = 2000005034; +UPDATE `waypoint_scripts` SET `dataint` = 10146 WHERE `dataint` = 2000005035; +UPDATE `waypoint_scripts` SET `dataint` = 12835 WHERE `dataint` = 2000005036; +UPDATE `waypoint_scripts` SET `dataint` = 12832 WHERE `dataint` = 2000005037; +UPDATE `waypoint_scripts` SET `dataint` = 12833 WHERE `dataint` = 2000005038; +UPDATE `waypoint_scripts` SET `dataint` = 14565 WHERE `dataint` = 2000005039; +UPDATE `waypoint_scripts` SET `dataint` = 14567 WHERE `dataint` = 2000005040; +UPDATE `waypoint_scripts` SET `dataint` = 15144 WHERE `dataint` = 2000005041; +UPDATE `waypoint_scripts` SET `dataint` = 15373 WHERE `dataint` = 2000005042; +UPDATE `waypoint_scripts` SET `dataint` = 17569 WHERE `dataint` = 2000005043; -- doesn't exist anywhere, picked a random text from the same npc +UPDATE `waypoint_scripts` SET `dataint` = 17563 WHERE `dataint` = 2000005044; -- doesn't exist anywhere, picked a random text from the same npc +UPDATE `waypoint_scripts` SET `dataint` = 16059 WHERE `dataint` = 2000005045; +UPDATE `waypoint_scripts` SET `dataint` = 10119 WHERE `dataint` = 2000005048; +UPDATE `waypoint_scripts` SET `dataint` = 17035 WHERE `dataint` = 2000005049; +UPDATE `waypoint_scripts` SET `dataint` = 17045 WHERE `dataint` = 2000005050; +UPDATE `waypoint_scripts` SET `dataint` = 17056 WHERE `dataint` = 2000005051; +UPDATE `waypoint_scripts` SET `dataint` = 17486 WHERE `dataint` = 2000005052; +UPDATE `waypoint_scripts` SET `dataint` = 17485 WHERE `dataint` = 2000005053; +UPDATE `waypoint_scripts` SET `dataint` = 17485 WHERE `dataint` = 2000005054; +UPDATE `waypoint_scripts` SET `dataint` = 17485 WHERE `dataint` = 2000005055; +UPDATE `waypoint_scripts` SET `dataint` = 18816 WHERE `dataint` = 2000005056; +UPDATE `waypoint_scripts` SET `dataint` = 709 WHERE `dataint` = 2000005057; +UPDATE `waypoint_scripts` SET `dataint` = 710 WHERE `dataint` = 2000005058; +UPDATE `waypoint_scripts` SET `dataint` = 705 WHERE `dataint` = 2000005059; +UPDATE `waypoint_scripts` SET `dataint` = 693 WHERE `dataint` = 2000005060; +UPDATE `waypoint_scripts` SET `dataint` = 710 WHERE `dataint` = 2000005061; +UPDATE `waypoint_scripts` SET `dataint` = 706 WHERE `dataint` = 2000005062; +UPDATE `waypoint_scripts` SET `dataint` = 709 WHERE `dataint` = 2000005063; +UPDATE `waypoint_scripts` SET `dataint` = 710 WHERE `dataint` = 2000005064; +UPDATE `waypoint_scripts` SET `dataint` = 705 WHERE `dataint` = 2000005065; +UPDATE `waypoint_scripts` SET `dataint` = 693 WHERE `dataint` = 2000005066; +UPDATE `waypoint_scripts` SET `dataint` = 710 WHERE `dataint` = 2000005067; +UPDATE `waypoint_scripts` SET `dataint` = 706 WHERE `dataint` = 2000005068; +UPDATE `waypoint_scripts` SET `dataint` = 709 WHERE `dataint` = 2000005069; +UPDATE `waypoint_scripts` SET `dataint` = 710 WHERE `dataint` = 2000005070; +UPDATE `waypoint_scripts` SET `dataint` = 705 WHERE `dataint` = 2000005071; +UPDATE `waypoint_scripts` SET `dataint` = 693 WHERE `dataint` = 2000005072; +UPDATE `waypoint_scripts` SET `dataint` = 710 WHERE `dataint` = 2000005073; +UPDATE `waypoint_scripts` SET `dataint` = 706 WHERE `dataint` = 2000005074; +UPDATE `waypoint_scripts` SET `dataint` = 709 WHERE `dataint` = 2000005075; +UPDATE `waypoint_scripts` SET `dataint` = 710 WHERE `dataint` = 2000005076; +UPDATE `waypoint_scripts` SET `dataint` = 705 WHERE `dataint` = 2000005077; +UPDATE `waypoint_scripts` SET `dataint` = 694 WHERE `dataint` = 2000005078; +UPDATE `waypoint_scripts` SET `dataint` = 694 WHERE `dataint` = 2000005079; +UPDATE `waypoint_scripts` SET `dataint` = 696 WHERE `dataint` = 2000005080; +UPDATE `waypoint_scripts` SET `dataint` = 694 WHERE `dataint` = 2000005081; +UPDATE `waypoint_scripts` SET `dataint` = 694 WHERE `dataint` = 2000005082; +UPDATE `waypoint_scripts` SET `dataint` = 694 WHERE `dataint` = 2000005083; +UPDATE `waypoint_scripts` SET `dataint` = 694 WHERE `dataint` = 2000005084; +UPDATE `waypoint_scripts` SET `dataint` = 694 WHERE `dataint` = 2000005085; +UPDATE `waypoint_scripts` SET `dataint` = 696 WHERE `dataint` = 2000005086; +UPDATE `waypoint_scripts` SET `dataint` = 694 WHERE `dataint` = 2000005087; +UPDATE `waypoint_scripts` SET `dataint` = 694 WHERE `dataint` = 2000005088; +UPDATE `waypoint_scripts` SET `dataint` = 694 WHERE `dataint` = 2000005089; +UPDATE `waypoint_scripts` SET `dataint` = 694 WHERE `dataint` = 2000005090; +UPDATE `waypoint_scripts` SET `dataint` = 694 WHERE `dataint` = 2000005091; +UPDATE `waypoint_scripts` SET `dataint` = 696 WHERE `dataint` = 2000005092; +UPDATE `waypoint_scripts` SET `dataint` = 694 WHERE `dataint` = 2000005093; +UPDATE `waypoint_scripts` SET `dataint` = 694 WHERE `dataint` = 2000005094; +UPDATE `waypoint_scripts` SET `dataint` = 694 WHERE `dataint` = 2000005095; +UPDATE `waypoint_scripts` SET `dataint` = 694 WHERE `dataint` = 2000005096; +UPDATE `waypoint_scripts` SET `dataint` = 694 WHERE `dataint` = 2000005097; +UPDATE `waypoint_scripts` SET `dataint` = 696 WHERE `dataint` = 2000005098; +UPDATE `waypoint_scripts` SET `dataint` = 1101 WHERE `dataint` = 2000005099; +UPDATE `waypoint_scripts` SET `dataint` = 1103 WHERE `dataint` = 2000005100; +UPDATE `waypoint_scripts` SET `dataint` = 4013 WHERE `dataint` = 2000005101; +UPDATE `waypoint_scripts` SET `dataint` = 1104 WHERE `dataint` = 2000005102; +UPDATE `waypoint_scripts` SET `dataint` = 1110 WHERE `dataint` = 2000005103; +UPDATE `waypoint_scripts` SET `dataint` = 1105 WHERE `dataint` = 2000005104; +UPDATE `waypoint_scripts` SET `dataint` = 1108 WHERE `dataint` = 2000005105; +UPDATE `waypoint_scripts` SET `dataint` = 1106 WHERE `dataint` = 2000005106; +UPDATE `waypoint_scripts` SET `dataint` = 1107 WHERE `dataint` = 2000005107; +UPDATE `waypoint_scripts` SET `dataint` = 1112 WHERE `dataint` = 2000005108; +UPDATE `waypoint_scripts` SET `dataint` = 151 WHERE `dataint` = 2000005109; +UPDATE `waypoint_scripts` SET `dataint` = 151 WHERE `dataint` = 2000005110; +UPDATE `waypoint_scripts` SET `dataint` = 155 WHERE `dataint` = 2000005111; +UPDATE `waypoint_scripts` SET `dataint` = 154 WHERE `dataint` = 2000005112; +UPDATE `waypoint_scripts` SET `dataint` = 152 WHERE `dataint` = 2000005113; +UPDATE `waypoint_scripts` SET `dataint` = 177 WHERE `dataint` = 2000005114; +UPDATE `waypoint_scripts` SET `dataint` = 149 WHERE `dataint` = 2000005115; +UPDATE `waypoint_scripts` SET `dataint` = 173 WHERE `dataint` = 2000005116; +UPDATE `waypoint_scripts` SET `dataint` = 174 WHERE `dataint` = 2000005117; +UPDATE `waypoint_scripts` SET `dataint` = 172 WHERE `dataint` = 2000005118; +UPDATE `waypoint_scripts` SET `dataint` = 173 WHERE `dataint` = 2000005119; +UPDATE `waypoint_scripts` SET `dataint` = 172 WHERE `dataint` = 2000005120; +UPDATE `waypoint_scripts` SET `dataint` = 176 WHERE `dataint` = 2000005121; +UPDATE `waypoint_scripts` SET `dataint` = 178 WHERE `dataint` = 2000005122; +UPDATE `waypoint_scripts` SET `dataint` = 169 WHERE `dataint` = 2000005123; +UPDATE `waypoint_scripts` SET `dataint` = 147 WHERE `dataint` = 2000005124; +UPDATE `waypoint_scripts` SET `dataint` = 157 WHERE `dataint` = 2000005125; +UPDATE `waypoint_scripts` SET `dataint` = 168 WHERE `dataint` = 2000005126; +UPDATE `waypoint_scripts` SET `dataint` = 147 WHERE `dataint` = 2000005127; +UPDATE `waypoint_scripts` SET `dataint` = 157 WHERE `dataint` = 2000005128; +UPDATE `waypoint_scripts` SET `dataint` = 167 WHERE `dataint` = 2000005129; +UPDATE `waypoint_scripts` SET `dataint` = 157 WHERE `dataint` = 2000005130; +UPDATE `waypoint_scripts` SET `dataint` = 147 WHERE `dataint` = 2000005131; +UPDATE `waypoint_scripts` SET `dataint` = 2874 WHERE `dataint` = 2000005132; +UPDATE `waypoint_scripts` SET `dataint` = 10119 WHERE `dataint` = 2000005133; +UPDATE `waypoint_scripts` SET `dataint` = 1129 WHERE `dataint` = 2000005134; +UPDATE `waypoint_scripts` SET `dataint` = 1154 WHERE `dataint` = 2000005135; +UPDATE `waypoint_scripts` SET `dataint` = 1155 WHERE `dataint` = 2000005136; +UPDATE `waypoint_scripts` SET `dataint` = 1140 WHERE `dataint` = 2000005137; +UPDATE `waypoint_scripts` SET `dataint` = 1161 WHERE `dataint` = 2000005138; +UPDATE `waypoint_scripts` SET `dataint` = 1162 WHERE `dataint` = 2000005139; +UPDATE `waypoint_scripts` SET `dataint` = 1163 WHERE `dataint` = 2000005140; +UPDATE `waypoint_scripts` SET `dataint` = 1165 WHERE `dataint` = 2000005141; +UPDATE `waypoint_scripts` SET `dataint` = 1166 WHERE `dataint` = 2000005142; +UPDATE `waypoint_scripts` SET `dataint` = 13580 WHERE `dataint` = 2000005144; +UPDATE `waypoint_scripts` SET `dataint` = 13576 WHERE `dataint` = 2000005145; +UPDATE `waypoint_scripts` SET `dataint` = 15119 WHERE `dataint` = 2000005147; +UPDATE `waypoint_scripts` SET `dataint` = 209 WHERE `dataint` = 2000005148; +UPDATE `waypoint_scripts` SET `dataint` = 224 WHERE `dataint` = 2000005149; +UPDATE `waypoint_scripts` SET `dataint` = 225 WHERE `dataint` = 2000005150; +UPDATE `waypoint_scripts` SET `dataint` = 213 WHERE `dataint` = 2000005151; +UPDATE `waypoint_scripts` SET `dataint` = 225 WHERE `dataint` = 2000005152; +UPDATE `waypoint_scripts` SET `dataint` = 225 WHERE `dataint` = 2000005153; +UPDATE `waypoint_scripts` SET `dataint` = 224 WHERE `dataint` = 2000005154; +UPDATE `waypoint_scripts` SET `dataint` = 214 WHERE `dataint` = 2000005155; +UPDATE `waypoint_scripts` SET `dataint` = 217 WHERE `dataint` = 2000005156; +UPDATE `waypoint_scripts` SET `dataint` = 210 WHERE `dataint` = 2000005157; +UPDATE `waypoint_scripts` SET `dataint` = 205 WHERE `dataint` = 2000005158; +UPDATE `waypoint_scripts` SET `dataint` = 216 WHERE `dataint` = 2000005159; +UPDATE `waypoint_scripts` SET `dataint` = 212 WHERE `dataint` = 2000005160; +UPDATE `waypoint_scripts` SET `dataint` = 208 WHERE `dataint` = 2000005161; +UPDATE `waypoint_scripts` SET `dataint` = 214 WHERE `dataint` = 2000005162; +UPDATE `waypoint_scripts` SET `dataint` = 215 WHERE `dataint` = 2000005163; +UPDATE `waypoint_scripts` SET `dataint` = 206 WHERE `dataint` = 2000005164; +UPDATE `waypoint_scripts` SET `dataint` = 212 WHERE `dataint` = 2000005165; +UPDATE `waypoint_scripts` SET `dataint` = 214 WHERE `dataint` = 2000005166; +UPDATE `waypoint_scripts` SET `dataint` = 1153 WHERE `dataint` = 2000005167; +UPDATE `waypoint_scripts` SET `dataint` = 1130 WHERE `dataint` = 2000005168; +UPDATE `waypoint_scripts` SET `dataint` = 201 WHERE `dataint` = 2000005169; +UPDATE `waypoint_scripts` SET `dataint` = 218 WHERE `dataint` = 2000005170; +UPDATE `waypoint_scripts` SET `dataint` = 222 WHERE `dataint` = 2000005171; +UPDATE `waypoint_scripts` SET `dataint` = 221 WHERE `dataint` = 2000005172; +UPDATE `waypoint_scripts` SET `dataint` = 204 WHERE `dataint` = 2000005173; +UPDATE `waypoint_scripts` SET `dataint` = 222 WHERE `dataint` = 2000005174; +UPDATE `waypoint_scripts` SET `dataint` = 219 WHERE `dataint` = 2000005175; +UPDATE `waypoint_scripts` SET `dataint` = 218 WHERE `dataint` = 2000005176; +UPDATE `waypoint_scripts` SET `dataint` = 221 WHERE `dataint` = 2000005177; +UPDATE `waypoint_scripts` SET `dataint` = 219 WHERE `dataint` = 2000005178; +UPDATE `waypoint_scripts` SET `dataint` = 222 WHERE `dataint` = 2000005179; +UPDATE `waypoint_scripts` SET `dataint` = 587 WHERE `dataint` = 2000005180; +UPDATE `waypoint_scripts` SET `dataint` = 589 WHERE `dataint` = 2000005181; +UPDATE `waypoint_scripts` SET `dataint` = 590 WHERE `dataint` = 2000005182; +UPDATE `waypoint_scripts` SET `dataint` = 588 WHERE `dataint` = 2000005183; +UPDATE `waypoint_scripts` SET `dataint` = 1091 WHERE `dataint` = 2000005184; +UPDATE `waypoint_scripts` SET `dataint` = 24425 WHERE `dataint` = 2000005200; +UPDATE `waypoint_scripts` SET `dataint` = 24425 WHERE `dataint` = 2000005201; +UPDATE `waypoint_scripts` SET `dataint` = 22216 WHERE `dataint` = 2000005202; +UPDATE `waypoint_scripts` SET `dataint` = 22211 WHERE `dataint` = 2000005203; +UPDATE `waypoint_scripts` SET `dataint` = 22206 WHERE `dataint` = 2000005204; +UPDATE `waypoint_scripts` SET `dataint` = 25086 WHERE `dataint` = 2000005205; +UPDATE `waypoint_scripts` SET `dataint` = 25073 WHERE `dataint` = 2000005206; +UPDATE `waypoint_scripts` SET `dataint` = 25074 WHERE `dataint` = 2000005207; +UPDATE `waypoint_scripts` SET `dataint` = 25075 WHERE `dataint` = 2000005208; +UPDATE `waypoint_scripts` SET `dataint` = 25076 WHERE `dataint` = 2000005209; +UPDATE `waypoint_scripts` SET `dataint` = 23842 WHERE `dataint` = 2000005210; +UPDATE `waypoint_scripts` SET `dataint` = 328 WHERE `dataint` = 2000005400; +UPDATE `waypoint_scripts` SET `dataint` = 327 WHERE `dataint` = 2000005401; +UPDATE `waypoint_scripts` SET `dataint` = 5956 WHERE `dataint` = 2000005402; +UPDATE `waypoint_scripts` SET `dataint` = 5957 WHERE `dataint` = 2000005403; +UPDATE `waypoint_scripts` SET `dataint` = 5960 WHERE `dataint` = 2000005404; +UPDATE `waypoint_scripts` SET `dataint` = 5959 WHERE `dataint` = 2000005405; +UPDATE `waypoint_scripts` SET `dataint` = 24439 WHERE `dataint` = 2000005406; +UPDATE `waypoint_scripts` SET `dataint` = 24443 WHERE `dataint` = 2000005407; +UPDATE `waypoint_scripts` SET `dataint` = 36 WHERE `dataint` = 2000005408; diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 45450a0c129..1f3c9a2e8c7 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1908,8 +1908,17 @@ namespace Trinity : i_object(obj), i_msgtype(msgtype), i_textId(textId), i_language(Language(language)), i_target(target) { } void operator()(WorldPacket& data, LocaleConstant loc_idx) { - char const* text = sObjectMgr->GetTrinityString(i_textId, loc_idx); - ChatHandler::BuildChatPacket(data, i_msgtype, i_language, i_object, i_target, text, 0, "", loc_idx); + if (BroadcastText const* broadcastText = sObjectMgr->GetBroadcastText(i_textId)) + { + uint8 gender = GENDER_MALE; + if (Unit const* unit = i_object->ToUnit()) + gender = unit->getGender(); + + std::string text = broadcastText->GetText(loc_idx, gender); + ChatHandler::BuildChatPacket(data, i_msgtype, i_language, i_object, i_target, text, 0, "", loc_idx); + } + else + TC_LOG_ERROR("entities.unit", "MonsterChatBuilder: `broadcast_text` id %i missing", i_textId); } private: @@ -2034,10 +2043,15 @@ void WorldObject::MonsterWhisper(int32 textId, Player const* target, bool IsBoss if (!target) return; + uint8 gender = GENDER_MALE; + if (Unit const* unit = ToUnit()) + gender = unit->getGender(); + LocaleConstant loc_idx = target->GetSession()->GetSessionDbLocaleIndex(); - char const* text = sObjectMgr->GetTrinityString(textId, loc_idx); + BroadcastText const* broadcastText = sObjectMgr->GetBroadcastText(textId); + std::string text = broadcastText->GetText(loc_idx, gender); WorldPacket data; - ChatHandler::BuildChatPacket(data, IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, this, target, text, 0, "", loc_idx); + ChatHandler::BuildChatPacket(data, IsBossWhisper ? CHAT_MSG_RAID_BOSS_WHISPER : CHAT_MSG_MONSTER_WHISPER, LANG_UNIVERSAL, this, target, text.c_str(), 0, "", loc_idx); target->GetSession()->SendPacket(&data); } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 7ab843943f8..48f544cba2b 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -4608,12 +4608,6 @@ void ObjectMgr::LoadScripts(ScriptsType type) tableName.c_str(), tmp.Talk.TextID, tmp.id); continue; } - if (tmp.Talk.TextID < MIN_DB_SCRIPT_STRING_ID || tmp.Talk.TextID >= MAX_DB_SCRIPT_STRING_ID) - { - TC_LOG_ERROR("sql.sql", "Table `%s` has out of range text id (dataint = %i expected %u-%u) in SCRIPT_COMMAND_TALK for script id %u", - tableName.c_str(), tmp.Talk.TextID, MIN_DB_SCRIPT_STRING_ID, MAX_DB_SCRIPT_STRING_ID, tmp.id); - continue; - } break; } @@ -8635,33 +8629,6 @@ uint32 ObjectMgr::GetScriptId(const char *name) return uint32(itr - _scriptNamesStore.begin()); } -void ObjectMgr::CheckScripts(ScriptsType type, std::set<int32>& ids) -{ - ScriptMapMap* scripts = GetScriptsMapByType(type); - if (!scripts) - return; - - for (ScriptMapMap::const_iterator itrMM = scripts->begin(); itrMM != scripts->end(); ++itrMM) - { - for (ScriptMap::const_iterator itrM = itrMM->second.begin(); itrM != itrMM->second.end(); ++itrM) - { - switch (itrM->second.command) - { - case SCRIPT_COMMAND_TALK: - { - if (!GetTrinityStringLocale (itrM->second.Talk.TextID)) - TC_LOG_ERROR("sql.sql", "Table `%s` references invalid text id %u from `db_script_string`, script id: %u.", GetScriptsTableNameByType(type).c_str(), itrM->second.Talk.TextID, itrMM->first); - - if (ids.find(itrM->second.Talk.TextID) != ids.end()) - ids.erase(itrM->second.Talk.TextID); - } - default: - break; - } - } - } -} - void ObjectMgr::LoadBroadcastTexts() { uint32 oldMSTime = getMSTime(); @@ -8797,23 +8764,6 @@ void ObjectMgr::LoadBroadcastTextLocales() TC_LOG_INFO("server.loading", ">> Loaded %u broadcast text locales in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } -void ObjectMgr::LoadDbScriptStrings() -{ - LoadTrinityStrings("db_script_string", MIN_DB_SCRIPT_STRING_ID, MAX_DB_SCRIPT_STRING_ID); - - std::set<int32> ids; - - for (int32 i = MIN_DB_SCRIPT_STRING_ID; i < MAX_DB_SCRIPT_STRING_ID; ++i) - if (GetTrinityStringLocale(i)) - ids.insert(i); - - for (int type = SCRIPTS_FIRST; type < SCRIPTS_LAST; ++type) - CheckScripts(ScriptsType(type), ids); - - for (std::set<int32>::const_iterator itr = ids.begin(); itr != ids.end(); ++itr) - TC_LOG_ERROR("sql.sql", "Table `db_script_string` has unused string id %u", *itr); -} - CreatureBaseStats const* ObjectMgr::GetCreatureBaseStats(uint8 level, uint8 unitClass) { CreatureBaseStatsContainer::const_iterator it = _creatureBaseStatsStore.find(MAKE_PAIR16(level, unitClass)); diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index dc9196dd0df..d15ca257d67 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -466,8 +466,6 @@ typedef std::unordered_map<uint32/*(mapid, spawnMode) pair*/, CellObjectGuidsMap // Trinity string ranges #define MIN_TRINITY_STRING_ID 1 // 'trinity_string' #define MAX_TRINITY_STRING_ID 2000000000 -#define MIN_DB_SCRIPT_STRING_ID MAX_TRINITY_STRING_ID // 'db_script_string' -#define MAX_DB_SCRIPT_STRING_ID 2000010000 // Trinity Trainer Reference start range #define TRINITY_TRAINER_START_REF 200000 @@ -968,7 +966,6 @@ class ObjectMgr void LoadBroadcastTextLocales(); bool LoadTrinityStrings(char const* table, int32 min_value, int32 max_value); bool LoadTrinityStrings() { return LoadTrinityStrings("trinity_string", MIN_TRINITY_STRING_ID, MAX_TRINITY_STRING_ID); } - void LoadDbScriptStrings(); void LoadCreatureClassLevelStats(); void LoadCreatureLocales(); void LoadCreatureTemplates(); @@ -1386,7 +1383,6 @@ class ObjectMgr private: void LoadScripts(ScriptsType type); - void CheckScripts(ScriptsType type, std::set<int32>& ids); void LoadQuestRelationsHelper(QuestRelations& map, QuestRelationsReverse* reverseMap, std::string const& table, bool starter, bool go); void PlayerCreateInfoAddItemHelper(uint32 race_, uint32 class_, uint32 itemId, int32 count); diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index c1de3aae7cb..814deba78db 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -1194,7 +1194,6 @@ enum TrinityStrings LANG_NPCINFO_FLAGS_EXTRA = 11009 // NOT RESERVED IDS 12000-1999999999 - // `db_script_string` table index 2000000000-2000009999 (MIN_DB_SCRIPT_STRING_ID-MAX_DB_SCRIPT_STRING_ID) // For other tables maybe 2000010000-2147483647 (max index) }; #endif diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index 3ccc876e1a2..b32fa288185 100644 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -383,7 +383,8 @@ void Map::ScriptsProcess() if (Player* player = _GetScriptPlayerSourceOrTarget(source, target, step.script)) { LocaleConstant loc_idx = player->GetSession()->GetSessionDbLocaleIndex(); - std::string text(sObjectMgr->GetTrinityString(step.script->Talk.TextID, loc_idx)); + BroadcastText const* broadcastText = sObjectMgr->GetBroadcastText(step.script->Talk.TextID); + std::string text = broadcastText->GetText(loc_idx, player->getGender()); switch (step.script->Talk.ChatType) { diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 58e3cffa8de..35ad588c0aa 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1702,9 +1702,6 @@ void World::SetInitialWorldSettings() sObjectMgr->LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data) sObjectMgr->LoadWaypointScripts(); - TC_LOG_INFO("server.loading", "Loading Scripts text locales..."); // must be after Load*Scripts calls - sObjectMgr->LoadDbScriptStrings(); - TC_LOG_INFO("server.loading", "Loading spell script names..."); sObjectMgr->LoadSpellScriptNames(); diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 66988b499d2..9737b1dd5b9 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -1297,14 +1297,29 @@ public: static bool HandleNpcWhisperCommand(ChatHandler* handler, char const* args) { if (!*args) + { + handler->SendSysMessage(LANG_CMD_SYNTAX); + handler->SetSentErrorMessage(true); return false; + } char* receiver_str = strtok((char*)args, " "); char* text = strtok(NULL, ""); + if (!receiver_str || !text) + { + handler->SendSysMessage(LANG_CMD_SYNTAX); + handler->SetSentErrorMessage(true); + return false; + } + Creature* creature = handler->getSelectedCreature(); - if (!creature || !receiver_str || !text) + if (!creature) + { + handler->SendSysMessage(LANG_SELECT_CREATURE); + handler->SetSentErrorMessage(true); return false; + } uint64 receiver_guid = atol(receiver_str); @@ -1320,7 +1335,11 @@ public: static bool HandleNpcYellCommand(ChatHandler* handler, char const* args) { if (!*args) + { + handler->SendSysMessage(LANG_CMD_SYNTAX); + handler->SetSentErrorMessage(true); return false; + } Creature* creature = handler->getSelectedCreature(); if (!creature) diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index 70aacbfc227..5f061fab595 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -88,7 +88,6 @@ public: { "creature_queststarter", rbac::RBAC_PERM_COMMAND_RELOAD_CREATURE_QUESTSTARTER, true, &HandleReloadCreatureQuestStarterCommand, "", NULL }, { "creature_summon_groups", rbac::RBAC_PERM_COMMAND_RELOAD_CREATURE_SUMMON_GROUPS, true, &HandleReloadCreatureSummonGroupsCommand, "", NULL }, { "creature_template", rbac::RBAC_PERM_COMMAND_RELOAD_CREATURE_TEMPLATE, true, &HandleReloadCreatureTemplateCommand, "", NULL }, - //{ "db_script_string", rbac::RBAC_PERM_COMMAND_RELOAD_, true, &HandleReloadDbScriptStringCommand, "", NULL }, { "disables", rbac::RBAC_PERM_COMMAND_RELOAD_DISABLES, true, &HandleReloadDisablesCommand, "", NULL }, { "disenchant_loot_template", rbac::RBAC_PERM_COMMAND_RELOAD_DISENCHANT_LOOT_TEMPLATE, true, &HandleReloadLootTemplatesDisenchantCommand, "", NULL }, { "event_scripts", rbac::RBAC_PERM_COMMAND_RELOAD_EVENT_SCRIPTS, true, &HandleReloadEventScriptsCommand, "", NULL }, @@ -266,7 +265,6 @@ public: HandleReloadEventScriptsCommand(handler, "a"); HandleReloadSpellScriptsCommand(handler, "a"); handler->SendGlobalGMSysMessage("DB tables `*_scripts` reloaded."); - HandleReloadDbScriptStringCommand(handler, "a"); HandleReloadWpScriptsCommand(handler, "a"); HandleReloadWpCommand(handler, "a"); return true; @@ -960,14 +958,6 @@ public: return true; } - static bool HandleReloadDbScriptStringCommand(ChatHandler* handler, const char* /*args*/) - { - TC_LOG_INFO("misc", "Re-Loading Script strings from `db_script_string`..."); - sObjectMgr->LoadDbScriptStrings(); - handler->SendGlobalGMSysMessage("DB table `db_script_string` reloaded."); - return true; - } - static bool HandleReloadGameGraveyardZoneCommand(ChatHandler* handler, const char* /*args*/) { TC_LOG_INFO("misc", "Re-Loading Graveyard-zone links..."); |