diff --git a/sql/base/mangos.sql b/sql/base/mangos.sql index 240711a0866..1357bf6ea2b 100644 --- a/sql/base/mangos.sql +++ b/sql/base/mangos.sql @@ -23,7 +23,7 @@ DROP TABLE IF EXISTS `db_version`; CREATE TABLE `db_version` ( `version` varchar(120) DEFAULT NULL, `creature_ai_version` varchar(120) DEFAULT NULL, - `required_s2463_01_mangos_spawn_data_equip` bit(1) DEFAULT NULL + `required_s2464_01_mangos_string_id` bit(1) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Used DB version notes'; -- diff --git a/sql/updates/mangos/s0000_01_mangos_string_id.sql b/sql/updates/mangos/s2464_01_mangos_string_id.sql similarity index 56% rename from sql/updates/mangos/s0000_01_mangos_string_id.sql rename to sql/updates/mangos/s2464_01_mangos_string_id.sql index dcdba7d20a4..945503d036c 100644 --- a/sql/updates/mangos/s0000_01_mangos_string_id.sql +++ b/sql/updates/mangos/s2464_01_mangos_string_id.sql @@ -1,3 +1,5 @@ +ALTER TABLE db_version CHANGE COLUMN required_s2463_01_mangos_spawn_data_equip required_s2464_01_mangos_string_id bit; + DROP TABLE IF EXISTS `string_id`; CREATE TABLE `string_id`( `Id` INT(11) UNSIGNED NOT NULL, @@ -11,4 +13,9 @@ ALTER TABLE spawn_group ADD COLUMN `StringId` INT(11) UNSIGNED NOT NULL DEFAULT ALTER TABLE creature_template ADD COLUMN `StringId1` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `SpellList`; ALTER TABLE creature_template ADD COLUMN `StringId2` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `StringId1`; ALTER TABLE gameobject_template ADD COLUMN `StringId` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `maxgold`; +ALTER TABLE `creature_spawn_data_template` ADD COLUMN `Name` VARCHAR(200) NOT NULL; +UPDATE creature_spawn_data_template SET Name='GENERIC - NONE - DO NOT EDIT' WHERE entry IN(0); +UPDATE creature_spawn_data_template SET Name='GENERIC - SPAWN FLAG RUN' WHERE entry IN(0); +UPDATE creature_spawn_data_template SET Name='GENERIC - SPAWN FLAG HOVER' WHERE entry IN(0); +UPDATE creature_spawn_data_template SET Name='GENERIC - SPAWN FLAG RUN + HOVER' WHERE entry IN(0); diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp index e0267330739..020b61568eb 100644 --- a/src/game/Globals/ObjectMgr.cpp +++ b/src/game/Globals/ObjectMgr.cpp @@ -1829,7 +1829,7 @@ void ObjectMgr::LoadCreatureSpawnDataTemplates() { m_creatureSpawnTemplateMap.clear(); - std::unique_ptr result(WorldDatabase.Query("SELECT Entry, NpcFlags, UnitFlags, Faction, ModelId, EquipmentId, CurHealth, CurMana, SpawnFlags, RelayId FROM creature_spawn_data_template")); + std::unique_ptr result(WorldDatabase.Query("SELECT Entry, NpcFlags, UnitFlags, Faction, ModelId, EquipmentId, CurHealth, CurMana, SpawnFlags, RelayId, StringId, Name FROM creature_spawn_data_template")); if (!result) { BarGoLink bar(1); @@ -1849,17 +1849,21 @@ void ObjectMgr::LoadCreatureSpawnDataTemplates() Field* fields = result->Fetch(); - uint32 entry = fields[0].GetUInt32(); - int32 npcFlags = int32(fields[1].GetUInt32()); - int64 unitFlags = int64(fields[2].GetUInt64()); - uint32 faction = fields[3].GetUInt32(); - uint32 modelId = fields[4].GetUInt32(); - int32 equipmentId = fields[5].GetInt32(); - uint32 curHealth = fields[6].GetUInt32(); - uint32 curMana = fields[7].GetUInt32(); - uint32 spawnFlags = fields[8].GetUInt32(); - uint32 relayId = fields[9].GetUInt32(); - uint32 stringId = fields[10].GetUInt32(); + uint32 entry = fields[0].GetUInt32(); + int32 npcFlags = int32(fields[1].GetUInt32()); + int64 unitFlags = int64(fields[2].GetUInt64()); + uint32 faction = fields[3].GetUInt32(); + uint32 modelId = fields[4].GetUInt32(); + int32 equipmentId = fields[5].GetInt32(); + uint32 curHealth = fields[6].GetUInt32(); + uint32 curMana = fields[7].GetUInt32(); + uint32 spawnFlags = fields[8].GetUInt32(); + uint32 relayId = fields[9].GetUInt32(); + uint32 stringId = fields[10].GetUInt32(); + std::string name = fields[11].GetCppString(); + + if (name.empty()) + sLog.outErrorDb("Table creature_spawn_data_template for entry %u has empty name", entry); if (stringId && !sScriptMgr.ExistsStringId(stringId)) { diff --git a/src/game/Loot/LootMgr.cpp b/src/game/Loot/LootMgr.cpp index 2f5417da1b2..ebb7f1fd374 100644 --- a/src/game/Loot/LootMgr.cpp +++ b/src/game/Loot/LootMgr.cpp @@ -237,6 +237,9 @@ void LootStore::LoadAndCheckReferenceNames() uint32 entry = fields[0].GetUInt32(); std::string name = fields[1].GetCppString(); + if (name.empty()) + sLog.outErrorDb("Table reference_loot_template_names for entry %u has empty name", entry); + if (foundIds.find(entry) != foundIds.end()) foundIds.erase(entry); else diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 342db24627e..04436ce876d 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -3,5 +3,5 @@ #define REVISION_DB_REALMD "required_s2455_01_realmd_platform" #define REVISION_DB_LOGS "required_s2433_01_logs_anticheat" #define REVISION_DB_CHARACTERS "required_s2452_01_characters_fishingSteps" - #define REVISION_DB_MANGOS "required_s2463_01_mangos_spawn_data_equip" + #define REVISION_DB_MANGOS "required_s2464_01_mangos_string_id" #endif // __REVISION_SQL_H__