Skip to content

Commit

Permalink
[s2464] Add creature_spawn_data_template Name
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Mar 6, 2023
1 parent 03d2904 commit 68726e8
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 14 deletions.
2 changes: 1 addition & 1 deletion sql/base/mangos.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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';

--
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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(1);
UPDATE creature_spawn_data_template SET Name='GENERIC - SPAWN FLAG HOVER' WHERE entry IN(2);
UPDATE creature_spawn_data_template SET Name='GENERIC - SPAWN FLAG RUN + HOVER' WHERE entry IN(3);

28 changes: 16 additions & 12 deletions src/game/Globals/ObjectMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1829,7 +1829,7 @@ void ObjectMgr::LoadCreatureSpawnDataTemplates()
{
m_creatureSpawnTemplateMap.clear();

std::unique_ptr<QueryResult> result(WorldDatabase.Query("SELECT Entry, NpcFlags, UnitFlags, Faction, ModelId, EquipmentId, CurHealth, CurMana, SpawnFlags, RelayId FROM creature_spawn_data_template"));
std::unique_ptr<QueryResult> 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);
Expand All @@ -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))
{
Expand Down
3 changes: 3 additions & 0 deletions src/game/Loot/LootMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_sql.h
Original file line number Diff line number Diff line change
Expand Up @@ -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__

0 comments on commit 68726e8

Please sign in to comment.