diff --git a/common/database/database_update_manifest.cpp b/common/database/database_update_manifest.cpp index a70c4edea..7a33a03c7 100644 --- a/common/database/database_update_manifest.cpp +++ b/common/database/database_update_manifest.cpp @@ -6938,6 +6938,18 @@ CREATE TABLE `character_pet_name` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; )", }, + ManifestEntry{ + .version = 9310, + .description = "2025_03_7_expand_horse_def.sql", + .check = "SHOW COLUMNS FROM `horses` LIKE `helmtexture", + .condition = "missing", + .match = "TINYINT(2)", + .sql = R"( +ALTER TABLE `horses` + ADD COLUMN `helmtexture` TINYINT(2) NOT NULL DEFAULT -1 AFTER `texture`; +)", + .content_schema_update = true + }, // -- template; copy/paste this when you need to create a new entry // ManifestEntry{ // .version = 9228, diff --git a/common/repositories/base/base_horses_repository.h b/common/repositories/base/base_horses_repository.h index 5b12d52a6..5c49b9967 100644 --- a/common/repositories/base/base_horses_repository.h +++ b/common/repositories/base/base_horses_repository.h @@ -24,6 +24,7 @@ public: int16_t race; int8_t gender; int8_t texture; + int8_t helmtexture; float mountspeed; std::string notes; }; @@ -41,6 +42,7 @@ public: "race", "gender", "texture", + "helmtexture", "mountspeed", "notes", }; @@ -54,6 +56,7 @@ public: "race", "gender", "texture", + "helmtexture", "mountspeed", "notes", }; @@ -96,13 +99,14 @@ public: { Horses e{}; - e.id = 0; - e.filename = ""; - e.race = 216; - e.gender = 0; - e.texture = 0; - e.mountspeed = 0.75; - e.notes = "Notes"; + e.id = 0; + e.filename = ""; + e.race = 216; + e.gender = 0; + e.texture = 0; + e.helmtexture = -1; + e.mountspeed = 0.75; + e.notes = "Notes"; return e; } @@ -139,13 +143,14 @@ public: if (results.RowCount() == 1) { Horses e{}; - e.id = row[0] ? static_cast(atoi(row[0])) : 0; - e.filename = row[1] ? row[1] : ""; - e.race = row[2] ? static_cast(atoi(row[2])) : 216; - e.gender = row[3] ? static_cast(atoi(row[3])) : 0; - e.texture = row[4] ? static_cast(atoi(row[4])) : 0; - e.mountspeed = row[5] ? strtof(row[5], nullptr) : 0.75; - e.notes = row[6] ? row[6] : "Notes"; + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.filename = row[1] ? row[1] : ""; + e.race = row[2] ? static_cast(atoi(row[2])) : 216; + e.gender = row[3] ? static_cast(atoi(row[3])) : 0; + e.texture = row[4] ? static_cast(atoi(row[4])) : 0; + e.helmtexture = row[5] ? static_cast(atoi(row[5])) : -1; + e.mountspeed = row[6] ? strtof(row[6], nullptr) : 0.75; + e.notes = row[7] ? row[7] : "Notes"; return e; } @@ -183,8 +188,9 @@ public: v.push_back(columns[2] + " = " + std::to_string(e.race)); v.push_back(columns[3] + " = " + std::to_string(e.gender)); v.push_back(columns[4] + " = " + std::to_string(e.texture)); - v.push_back(columns[5] + " = " + std::to_string(e.mountspeed)); - v.push_back(columns[6] + " = '" + Strings::Escape(e.notes) + "'"); + v.push_back(columns[5] + " = " + std::to_string(e.helmtexture)); + v.push_back(columns[6] + " = " + std::to_string(e.mountspeed)); + v.push_back(columns[7] + " = '" + Strings::Escape(e.notes) + "'"); auto results = db.QueryDatabase( fmt::format( @@ -211,6 +217,7 @@ public: v.push_back(std::to_string(e.race)); v.push_back(std::to_string(e.gender)); v.push_back(std::to_string(e.texture)); + v.push_back(std::to_string(e.helmtexture)); v.push_back(std::to_string(e.mountspeed)); v.push_back("'" + Strings::Escape(e.notes) + "'"); @@ -247,6 +254,7 @@ public: v.push_back(std::to_string(e.race)); v.push_back(std::to_string(e.gender)); v.push_back(std::to_string(e.texture)); + v.push_back(std::to_string(e.helmtexture)); v.push_back(std::to_string(e.mountspeed)); v.push_back("'" + Strings::Escape(e.notes) + "'"); @@ -282,13 +290,14 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Horses e{}; - e.id = row[0] ? static_cast(atoi(row[0])) : 0; - e.filename = row[1] ? row[1] : ""; - e.race = row[2] ? static_cast(atoi(row[2])) : 216; - e.gender = row[3] ? static_cast(atoi(row[3])) : 0; - e.texture = row[4] ? static_cast(atoi(row[4])) : 0; - e.mountspeed = row[5] ? strtof(row[5], nullptr) : 0.75; - e.notes = row[6] ? row[6] : "Notes"; + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.filename = row[1] ? row[1] : ""; + e.race = row[2] ? static_cast(atoi(row[2])) : 216; + e.gender = row[3] ? static_cast(atoi(row[3])) : 0; + e.texture = row[4] ? static_cast(atoi(row[4])) : 0; + e.helmtexture = row[5] ? static_cast(atoi(row[5])) : -1; + e.mountspeed = row[6] ? strtof(row[6], nullptr) : 0.75; + e.notes = row[7] ? row[7] : "Notes"; all_entries.push_back(e); } @@ -313,13 +322,14 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { Horses e{}; - e.id = row[0] ? static_cast(atoi(row[0])) : 0; - e.filename = row[1] ? row[1] : ""; - e.race = row[2] ? static_cast(atoi(row[2])) : 216; - e.gender = row[3] ? static_cast(atoi(row[3])) : 0; - e.texture = row[4] ? static_cast(atoi(row[4])) : 0; - e.mountspeed = row[5] ? strtof(row[5], nullptr) : 0.75; - e.notes = row[6] ? row[6] : "Notes"; + e.id = row[0] ? static_cast(atoi(row[0])) : 0; + e.filename = row[1] ? row[1] : ""; + e.race = row[2] ? static_cast(atoi(row[2])) : 216; + e.gender = row[3] ? static_cast(atoi(row[3])) : 0; + e.texture = row[4] ? static_cast(atoi(row[4])) : 0; + e.helmtexture = row[5] ? static_cast(atoi(row[5])) : -1; + e.mountspeed = row[6] ? strtof(row[6], nullptr) : 0.75; + e.notes = row[7] ? row[7] : "Notes"; all_entries.push_back(e); } @@ -399,6 +409,7 @@ public: v.push_back(std::to_string(e.race)); v.push_back(std::to_string(e.gender)); v.push_back(std::to_string(e.texture)); + v.push_back(std::to_string(e.helmtexture)); v.push_back(std::to_string(e.mountspeed)); v.push_back("'" + Strings::Escape(e.notes) + "'"); @@ -428,6 +439,7 @@ public: v.push_back(std::to_string(e.race)); v.push_back(std::to_string(e.gender)); v.push_back(std::to_string(e.texture)); + v.push_back(std::to_string(e.helmtexture)); v.push_back(std::to_string(e.mountspeed)); v.push_back("'" + Strings::Escape(e.notes) + "'"); diff --git a/common/version.h b/common/version.h index 4028603ed..c299be5c6 100644 --- a/common/version.h +++ b/common/version.h @@ -42,7 +42,7 @@ * Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9309 +#define CURRENT_BINARY_DATABASE_VERSION 9310 #define CURRENT_BINARY_BOTS_DATABASE_VERSION 9054 #endif diff --git a/zone/horse.cpp b/zone/horse.cpp index a5e24e0f8..c705a7c04 100644 --- a/zone/horse.cpp +++ b/zone/horse.cpp @@ -108,7 +108,7 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id) n->npc_id = 0; n->loottable_id = 0; n->texture = e.texture; - n->helmtexture = e.texture; + n->helmtexture = e.helmtexture == -1 ? e.texture : e.helmtexture; n->runspeed = e.mountspeed; n->light = 0; n->STR = 75;