[Feature] Allow assigning Helm Texture independently of Body Texture for Horses (#4759)

This commit is contained in:
catapultam-habeo 2025-03-07 20:59:12 -08:00 committed by GitHub
parent a2ed6be1f5
commit a0634adb3c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 56 additions and 32 deletions

View File

@ -6938,6 +6938,18 @@ CREATE TABLE `character_pet_name` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; ) 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 // -- template; copy/paste this when you need to create a new entry
// ManifestEntry{ // ManifestEntry{
// .version = 9228, // .version = 9228,

View File

@ -24,6 +24,7 @@ public:
int16_t race; int16_t race;
int8_t gender; int8_t gender;
int8_t texture; int8_t texture;
int8_t helmtexture;
float mountspeed; float mountspeed;
std::string notes; std::string notes;
}; };
@ -41,6 +42,7 @@ public:
"race", "race",
"gender", "gender",
"texture", "texture",
"helmtexture",
"mountspeed", "mountspeed",
"notes", "notes",
}; };
@ -54,6 +56,7 @@ public:
"race", "race",
"gender", "gender",
"texture", "texture",
"helmtexture",
"mountspeed", "mountspeed",
"notes", "notes",
}; };
@ -96,13 +99,14 @@ public:
{ {
Horses e{}; Horses e{};
e.id = 0; e.id = 0;
e.filename = ""; e.filename = "";
e.race = 216; e.race = 216;
e.gender = 0; e.gender = 0;
e.texture = 0; e.texture = 0;
e.mountspeed = 0.75; e.helmtexture = -1;
e.notes = "Notes"; e.mountspeed = 0.75;
e.notes = "Notes";
return e; return e;
} }
@ -139,13 +143,14 @@ public:
if (results.RowCount() == 1) { if (results.RowCount() == 1) {
Horses e{}; Horses e{};
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0; e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.filename = row[1] ? row[1] : ""; e.filename = row[1] ? row[1] : "";
e.race = row[2] ? static_cast<int16_t>(atoi(row[2])) : 216; e.race = row[2] ? static_cast<int16_t>(atoi(row[2])) : 216;
e.gender = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0; e.gender = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
e.texture = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0; e.texture = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0;
e.mountspeed = row[5] ? strtof(row[5], nullptr) : 0.75; e.helmtexture = row[5] ? static_cast<int8_t>(atoi(row[5])) : -1;
e.notes = row[6] ? row[6] : "Notes"; e.mountspeed = row[6] ? strtof(row[6], nullptr) : 0.75;
e.notes = row[7] ? row[7] : "Notes";
return e; return e;
} }
@ -183,8 +188,9 @@ public:
v.push_back(columns[2] + " = " + std::to_string(e.race)); v.push_back(columns[2] + " = " + std::to_string(e.race));
v.push_back(columns[3] + " = " + std::to_string(e.gender)); v.push_back(columns[3] + " = " + std::to_string(e.gender));
v.push_back(columns[4] + " = " + std::to_string(e.texture)); v.push_back(columns[4] + " = " + std::to_string(e.texture));
v.push_back(columns[5] + " = " + std::to_string(e.mountspeed)); v.push_back(columns[5] + " = " + std::to_string(e.helmtexture));
v.push_back(columns[6] + " = '" + Strings::Escape(e.notes) + "'"); v.push_back(columns[6] + " = " + std::to_string(e.mountspeed));
v.push_back(columns[7] + " = '" + Strings::Escape(e.notes) + "'");
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@ -211,6 +217,7 @@ public:
v.push_back(std::to_string(e.race)); v.push_back(std::to_string(e.race));
v.push_back(std::to_string(e.gender)); v.push_back(std::to_string(e.gender));
v.push_back(std::to_string(e.texture)); 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(std::to_string(e.mountspeed));
v.push_back("'" + Strings::Escape(e.notes) + "'"); 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.race));
v.push_back(std::to_string(e.gender)); v.push_back(std::to_string(e.gender));
v.push_back(std::to_string(e.texture)); 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(std::to_string(e.mountspeed));
v.push_back("'" + Strings::Escape(e.notes) + "'"); v.push_back("'" + Strings::Escape(e.notes) + "'");
@ -282,13 +290,14 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
Horses e{}; Horses e{};
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0; e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.filename = row[1] ? row[1] : ""; e.filename = row[1] ? row[1] : "";
e.race = row[2] ? static_cast<int16_t>(atoi(row[2])) : 216; e.race = row[2] ? static_cast<int16_t>(atoi(row[2])) : 216;
e.gender = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0; e.gender = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
e.texture = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0; e.texture = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0;
e.mountspeed = row[5] ? strtof(row[5], nullptr) : 0.75; e.helmtexture = row[5] ? static_cast<int8_t>(atoi(row[5])) : -1;
e.notes = row[6] ? row[6] : "Notes"; e.mountspeed = row[6] ? strtof(row[6], nullptr) : 0.75;
e.notes = row[7] ? row[7] : "Notes";
all_entries.push_back(e); all_entries.push_back(e);
} }
@ -313,13 +322,14 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
Horses e{}; Horses e{};
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0; e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.filename = row[1] ? row[1] : ""; e.filename = row[1] ? row[1] : "";
e.race = row[2] ? static_cast<int16_t>(atoi(row[2])) : 216; e.race = row[2] ? static_cast<int16_t>(atoi(row[2])) : 216;
e.gender = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0; e.gender = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
e.texture = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0; e.texture = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0;
e.mountspeed = row[5] ? strtof(row[5], nullptr) : 0.75; e.helmtexture = row[5] ? static_cast<int8_t>(atoi(row[5])) : -1;
e.notes = row[6] ? row[6] : "Notes"; e.mountspeed = row[6] ? strtof(row[6], nullptr) : 0.75;
e.notes = row[7] ? row[7] : "Notes";
all_entries.push_back(e); 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.race));
v.push_back(std::to_string(e.gender)); v.push_back(std::to_string(e.gender));
v.push_back(std::to_string(e.texture)); 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(std::to_string(e.mountspeed));
v.push_back("'" + Strings::Escape(e.notes) + "'"); 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.race));
v.push_back(std::to_string(e.gender)); v.push_back(std::to_string(e.gender));
v.push_back(std::to_string(e.texture)); 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(std::to_string(e.mountspeed));
v.push_back("'" + Strings::Escape(e.notes) + "'"); v.push_back("'" + Strings::Escape(e.notes) + "'");

View File

@ -42,7 +42,7 @@
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt * 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 #define CURRENT_BINARY_BOTS_DATABASE_VERSION 9054
#endif #endif

View File

@ -108,7 +108,7 @@ const NPCType *Horse::BuildHorseType(uint16 spell_id)
n->npc_id = 0; n->npc_id = 0;
n->loottable_id = 0; n->loottable_id = 0;
n->texture = e.texture; n->texture = e.texture;
n->helmtexture = e.texture; n->helmtexture = e.helmtexture == -1 ? e.texture : e.helmtexture;
n->runspeed = e.mountspeed; n->runspeed = e.mountspeed;
n->light = 0; n->light = 0;
n->STR = 75; n->STR = 75;