[Objects] Add fix_z column to ground spawns (#3992)

* [Objects] Add is_floating column to objects/ground spawns

# Notes
- Allows ground spawns/objects to float without having `FixZ()` called.

* Remove from object.

* Database version

* Fix

* Change to fix_z
This commit is contained in:
Alex King
2024-02-01 05:42:51 -05:00
committed by GitHub
parent 6297c56db2
commit 71f47dbcef
9 changed files with 368 additions and 232 deletions
@@ -5241,6 +5241,17 @@ DROP TABLE IF EXISTS item_tick
.sql = R"(
ALTER TABLE `spawngroup`
MODIFY COLUMN `name` varchar(200) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' AFTER `id`;
)"
},
ManifestEntry{
.version = 9257,
.description = "2024_01_16_ground_spawns_fix_z.sql",
.check = "SHOW COLUMNS FROM `ground_spawns` LIKE `fix_z`",
.condition = "empty",
.match = "",
.sql = R"(
ALTER TABLE `ground_spawns`
ADD COLUMN `fix_z` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 AFTER `respawn_timer`;
)"
}
// -- template; copy/paste this when you need to create a new entry
+14 -11
View File
@@ -3451,18 +3451,21 @@ struct Make_Pet_Struct { //Simple struct for getting pet info
uint32 min_dmg;
uint32 max_dmg;
};
struct GroundSpawn{
float max_x;
float max_y;
float min_x;
float min_y;
float max_z;
float heading;
char name[20];
uint32 item;
uint32 max_allowed;
uint32 respawntimer;
struct GroundSpawn {
float max_x = 0.0f;
float max_y = 0.0f;
float min_x = 0.0f;
float min_y = 0.0f;
float max_z = 0.0f;
float heading = 0.0f;
std::string name = std::string();
uint32 item_id = 0;
uint32 max_allowed = 1;
uint32 respawn_timer = 1;
bool fix_z = true;
};
struct GroundSpawns {
struct GroundSpawn spawn[50]; //Assigned max number to allow
};
@@ -33,6 +33,7 @@ public:
uint32_t max_allowed;
std::string comment;
uint32_t respawn_timer;
uint8_t fix_z;
int8_t min_expansion;
int8_t max_expansion;
std::string content_flags;
@@ -61,6 +62,7 @@ public:
"max_allowed",
"comment",
"respawn_timer",
"fix_z",
"min_expansion",
"max_expansion",
"content_flags",
@@ -85,6 +87,7 @@ public:
"max_allowed",
"comment",
"respawn_timer",
"fix_z",
"min_expansion",
"max_expansion",
"content_flags",
@@ -143,6 +146,7 @@ public:
e.max_allowed = 1;
e.comment = "";
e.respawn_timer = 300;
e.fix_z = 1;
e.min_expansion = -1;
e.max_expansion = -1;
e.content_flags = "";
@@ -197,10 +201,11 @@ public:
e.max_allowed = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 1;
e.comment = row[12] ? row[12] : "";
e.respawn_timer = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 300;
e.min_expansion = row[14] ? static_cast<int8_t>(atoi(row[14])) : -1;
e.max_expansion = row[15] ? static_cast<int8_t>(atoi(row[15])) : -1;
e.content_flags = row[16] ? row[16] : "";
e.content_flags_disabled = row[17] ? row[17] : "";
e.fix_z = row[14] ? static_cast<uint8_t>(strtoul(row[14], nullptr, 10)) : 1;
e.min_expansion = row[15] ? static_cast<int8_t>(atoi(row[15])) : -1;
e.max_expansion = row[16] ? static_cast<int8_t>(atoi(row[16])) : -1;
e.content_flags = row[17] ? row[17] : "";
e.content_flags_disabled = row[18] ? row[18] : "";
return e;
}
@@ -247,10 +252,11 @@ public:
v.push_back(columns[11] + " = " + std::to_string(e.max_allowed));
v.push_back(columns[12] + " = '" + Strings::Escape(e.comment) + "'");
v.push_back(columns[13] + " = " + std::to_string(e.respawn_timer));
v.push_back(columns[14] + " = " + std::to_string(e.min_expansion));
v.push_back(columns[15] + " = " + std::to_string(e.max_expansion));
v.push_back(columns[16] + " = '" + Strings::Escape(e.content_flags) + "'");
v.push_back(columns[17] + " = '" + Strings::Escape(e.content_flags_disabled) + "'");
v.push_back(columns[14] + " = " + std::to_string(e.fix_z));
v.push_back(columns[15] + " = " + std::to_string(e.min_expansion));
v.push_back(columns[16] + " = " + std::to_string(e.max_expansion));
v.push_back(columns[17] + " = '" + Strings::Escape(e.content_flags) + "'");
v.push_back(columns[18] + " = '" + Strings::Escape(e.content_flags_disabled) + "'");
auto results = db.QueryDatabase(
fmt::format(
@@ -286,6 +292,7 @@ public:
v.push_back(std::to_string(e.max_allowed));
v.push_back("'" + Strings::Escape(e.comment) + "'");
v.push_back(std::to_string(e.respawn_timer));
v.push_back(std::to_string(e.fix_z));
v.push_back(std::to_string(e.min_expansion));
v.push_back(std::to_string(e.max_expansion));
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
@@ -333,6 +340,7 @@ public:
v.push_back(std::to_string(e.max_allowed));
v.push_back("'" + Strings::Escape(e.comment) + "'");
v.push_back(std::to_string(e.respawn_timer));
v.push_back(std::to_string(e.fix_z));
v.push_back(std::to_string(e.min_expansion));
v.push_back(std::to_string(e.max_expansion));
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
@@ -384,10 +392,11 @@ public:
e.max_allowed = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 1;
e.comment = row[12] ? row[12] : "";
e.respawn_timer = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 300;
e.min_expansion = row[14] ? static_cast<int8_t>(atoi(row[14])) : -1;
e.max_expansion = row[15] ? static_cast<int8_t>(atoi(row[15])) : -1;
e.content_flags = row[16] ? row[16] : "";
e.content_flags_disabled = row[17] ? row[17] : "";
e.fix_z = row[14] ? static_cast<uint8_t>(strtoul(row[14], nullptr, 10)) : 1;
e.min_expansion = row[15] ? static_cast<int8_t>(atoi(row[15])) : -1;
e.max_expansion = row[16] ? static_cast<int8_t>(atoi(row[16])) : -1;
e.content_flags = row[17] ? row[17] : "";
e.content_flags_disabled = row[18] ? row[18] : "";
all_entries.push_back(e);
}
@@ -426,10 +435,11 @@ public:
e.max_allowed = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 1;
e.comment = row[12] ? row[12] : "";
e.respawn_timer = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 300;
e.min_expansion = row[14] ? static_cast<int8_t>(atoi(row[14])) : -1;
e.max_expansion = row[15] ? static_cast<int8_t>(atoi(row[15])) : -1;
e.content_flags = row[16] ? row[16] : "";
e.content_flags_disabled = row[17] ? row[17] : "";
e.fix_z = row[14] ? static_cast<uint8_t>(strtoul(row[14], nullptr, 10)) : 1;
e.min_expansion = row[15] ? static_cast<int8_t>(atoi(row[15])) : -1;
e.max_expansion = row[16] ? static_cast<int8_t>(atoi(row[16])) : -1;
e.content_flags = row[17] ? row[17] : "";
e.content_flags_disabled = row[18] ? row[18] : "";
all_entries.push_back(e);
}
@@ -518,6 +528,7 @@ public:
v.push_back(std::to_string(e.max_allowed));
v.push_back("'" + Strings::Escape(e.comment) + "'");
v.push_back(std::to_string(e.respawn_timer));
v.push_back(std::to_string(e.fix_z));
v.push_back(std::to_string(e.min_expansion));
v.push_back(std::to_string(e.max_expansion));
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
@@ -558,6 +569,7 @@ public:
v.push_back(std::to_string(e.max_allowed));
v.push_back("'" + Strings::Escape(e.comment) + "'");
v.push_back(std::to_string(e.respawn_timer));
v.push_back(std::to_string(e.fix_z));
v.push_back(std::to_string(e.min_expansion));
v.push_back(std::to_string(e.max_expansion));
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
+1 -1
View File
@@ -42,7 +42,7 @@
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/
#define CURRENT_BINARY_DATABASE_VERSION 9256
#define CURRENT_BINARY_DATABASE_VERSION 9257
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9042