mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 00:46:46 +00:00
[Dynamic Zones] Implement dz switch id (#2343)
This adds the `dz_switch_id` field to doors and dynamic_zones. It will allow for compasses to be automatically added to dz entrances and will support moving clients to the dz on use without needing to script it. These can be imported for switches/doors from live packet dumps. Also removes compass packet encoders (same struct in all clients)
This commit is contained in:
@@ -50,6 +50,7 @@ public:
|
||||
float buffer;
|
||||
int client_version_mask;
|
||||
int is_ldon_door;
|
||||
int dz_switch_id;
|
||||
int min_expansion;
|
||||
int max_expansion;
|
||||
std::string content_flags;
|
||||
@@ -95,6 +96,7 @@ public:
|
||||
"buffer",
|
||||
"client_version_mask",
|
||||
"is_ldon_door",
|
||||
"dz_switch_id",
|
||||
"min_expansion",
|
||||
"max_expansion",
|
||||
"content_flags",
|
||||
@@ -136,6 +138,7 @@ public:
|
||||
"buffer",
|
||||
"client_version_mask",
|
||||
"is_ldon_door",
|
||||
"dz_switch_id",
|
||||
"min_expansion",
|
||||
"max_expansion",
|
||||
"content_flags",
|
||||
@@ -211,6 +214,7 @@ public:
|
||||
entry.buffer = 0;
|
||||
entry.client_version_mask = 4294967295;
|
||||
entry.is_ldon_door = 0;
|
||||
entry.dz_switch_id = 0;
|
||||
entry.min_expansion = -1;
|
||||
entry.max_expansion = -1;
|
||||
entry.content_flags = "";
|
||||
@@ -281,10 +285,11 @@ public:
|
||||
entry.buffer = static_cast<float>(atof(row[28]));
|
||||
entry.client_version_mask = atoi(row[29]);
|
||||
entry.is_ldon_door = atoi(row[30]);
|
||||
entry.min_expansion = atoi(row[31]);
|
||||
entry.max_expansion = atoi(row[32]);
|
||||
entry.content_flags = row[33] ? row[33] : "";
|
||||
entry.content_flags_disabled = row[34] ? row[34] : "";
|
||||
entry.dz_switch_id = atoi(row[31]);
|
||||
entry.min_expansion = atoi(row[32]);
|
||||
entry.max_expansion = atoi(row[33]);
|
||||
entry.content_flags = row[34] ? row[34] : "";
|
||||
entry.content_flags_disabled = row[35] ? row[35] : "";
|
||||
|
||||
return entry;
|
||||
}
|
||||
@@ -348,10 +353,11 @@ public:
|
||||
update_values.push_back(columns[28] + " = " + std::to_string(doors_entry.buffer));
|
||||
update_values.push_back(columns[29] + " = " + std::to_string(doors_entry.client_version_mask));
|
||||
update_values.push_back(columns[30] + " = " + std::to_string(doors_entry.is_ldon_door));
|
||||
update_values.push_back(columns[31] + " = " + std::to_string(doors_entry.min_expansion));
|
||||
update_values.push_back(columns[32] + " = " + std::to_string(doors_entry.max_expansion));
|
||||
update_values.push_back(columns[33] + " = '" + Strings::Escape(doors_entry.content_flags) + "'");
|
||||
update_values.push_back(columns[34] + " = '" + Strings::Escape(doors_entry.content_flags_disabled) + "'");
|
||||
update_values.push_back(columns[31] + " = " + std::to_string(doors_entry.dz_switch_id));
|
||||
update_values.push_back(columns[32] + " = " + std::to_string(doors_entry.min_expansion));
|
||||
update_values.push_back(columns[33] + " = " + std::to_string(doors_entry.max_expansion));
|
||||
update_values.push_back(columns[34] + " = '" + Strings::Escape(doors_entry.content_flags) + "'");
|
||||
update_values.push_back(columns[35] + " = '" + Strings::Escape(doors_entry.content_flags_disabled) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -404,6 +410,7 @@ public:
|
||||
insert_values.push_back(std::to_string(doors_entry.buffer));
|
||||
insert_values.push_back(std::to_string(doors_entry.client_version_mask));
|
||||
insert_values.push_back(std::to_string(doors_entry.is_ldon_door));
|
||||
insert_values.push_back(std::to_string(doors_entry.dz_switch_id));
|
||||
insert_values.push_back(std::to_string(doors_entry.min_expansion));
|
||||
insert_values.push_back(std::to_string(doors_entry.max_expansion));
|
||||
insert_values.push_back("'" + Strings::Escape(doors_entry.content_flags) + "'");
|
||||
@@ -468,6 +475,7 @@ public:
|
||||
insert_values.push_back(std::to_string(doors_entry.buffer));
|
||||
insert_values.push_back(std::to_string(doors_entry.client_version_mask));
|
||||
insert_values.push_back(std::to_string(doors_entry.is_ldon_door));
|
||||
insert_values.push_back(std::to_string(doors_entry.dz_switch_id));
|
||||
insert_values.push_back(std::to_string(doors_entry.min_expansion));
|
||||
insert_values.push_back(std::to_string(doors_entry.max_expansion));
|
||||
insert_values.push_back("'" + Strings::Escape(doors_entry.content_flags) + "'");
|
||||
@@ -536,10 +544,11 @@ public:
|
||||
entry.buffer = static_cast<float>(atof(row[28]));
|
||||
entry.client_version_mask = atoi(row[29]);
|
||||
entry.is_ldon_door = atoi(row[30]);
|
||||
entry.min_expansion = atoi(row[31]);
|
||||
entry.max_expansion = atoi(row[32]);
|
||||
entry.content_flags = row[33] ? row[33] : "";
|
||||
entry.content_flags_disabled = row[34] ? row[34] : "";
|
||||
entry.dz_switch_id = atoi(row[31]);
|
||||
entry.min_expansion = atoi(row[32]);
|
||||
entry.max_expansion = atoi(row[33]);
|
||||
entry.content_flags = row[34] ? row[34] : "";
|
||||
entry.content_flags_disabled = row[35] ? row[35] : "";
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
@@ -595,10 +604,11 @@ public:
|
||||
entry.buffer = static_cast<float>(atof(row[28]));
|
||||
entry.client_version_mask = atoi(row[29]);
|
||||
entry.is_ldon_door = atoi(row[30]);
|
||||
entry.min_expansion = atoi(row[31]);
|
||||
entry.max_expansion = atoi(row[32]);
|
||||
entry.content_flags = row[33] ? row[33] : "";
|
||||
entry.content_flags_disabled = row[34] ? row[34] : "";
|
||||
entry.dz_switch_id = atoi(row[31]);
|
||||
entry.min_expansion = atoi(row[32]);
|
||||
entry.max_expansion = atoi(row[33]);
|
||||
entry.content_flags = row[34] ? row[34] : "";
|
||||
entry.content_flags_disabled = row[35] ? row[35] : "";
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ public:
|
||||
int leader_id;
|
||||
int min_players;
|
||||
int max_players;
|
||||
int dz_switch_id;
|
||||
int compass_zone_id;
|
||||
float compass_x;
|
||||
float compass_y;
|
||||
@@ -59,6 +60,7 @@ public:
|
||||
"leader_id",
|
||||
"min_players",
|
||||
"max_players",
|
||||
"dz_switch_id",
|
||||
"compass_zone_id",
|
||||
"compass_x",
|
||||
"compass_y",
|
||||
@@ -87,6 +89,7 @@ public:
|
||||
"leader_id",
|
||||
"min_players",
|
||||
"max_players",
|
||||
"dz_switch_id",
|
||||
"compass_zone_id",
|
||||
"compass_x",
|
||||
"compass_y",
|
||||
@@ -149,6 +152,7 @@ public:
|
||||
entry.leader_id = 0;
|
||||
entry.min_players = 0;
|
||||
entry.max_players = 0;
|
||||
entry.dz_switch_id = 0;
|
||||
entry.compass_zone_id = 0;
|
||||
entry.compass_x = 0;
|
||||
entry.compass_y = 0;
|
||||
@@ -206,20 +210,21 @@ public:
|
||||
entry.leader_id = atoi(row[5]);
|
||||
entry.min_players = atoi(row[6]);
|
||||
entry.max_players = atoi(row[7]);
|
||||
entry.compass_zone_id = atoi(row[8]);
|
||||
entry.compass_x = static_cast<float>(atof(row[9]));
|
||||
entry.compass_y = static_cast<float>(atof(row[10]));
|
||||
entry.compass_z = static_cast<float>(atof(row[11]));
|
||||
entry.safe_return_zone_id = atoi(row[12]);
|
||||
entry.safe_return_x = static_cast<float>(atof(row[13]));
|
||||
entry.safe_return_y = static_cast<float>(atof(row[14]));
|
||||
entry.safe_return_z = static_cast<float>(atof(row[15]));
|
||||
entry.safe_return_heading = static_cast<float>(atof(row[16]));
|
||||
entry.zone_in_x = static_cast<float>(atof(row[17]));
|
||||
entry.zone_in_y = static_cast<float>(atof(row[18]));
|
||||
entry.zone_in_z = static_cast<float>(atof(row[19]));
|
||||
entry.zone_in_heading = static_cast<float>(atof(row[20]));
|
||||
entry.has_zone_in = atoi(row[21]);
|
||||
entry.dz_switch_id = atoi(row[8]);
|
||||
entry.compass_zone_id = atoi(row[9]);
|
||||
entry.compass_x = static_cast<float>(atof(row[10]));
|
||||
entry.compass_y = static_cast<float>(atof(row[11]));
|
||||
entry.compass_z = static_cast<float>(atof(row[12]));
|
||||
entry.safe_return_zone_id = atoi(row[13]);
|
||||
entry.safe_return_x = static_cast<float>(atof(row[14]));
|
||||
entry.safe_return_y = static_cast<float>(atof(row[15]));
|
||||
entry.safe_return_z = static_cast<float>(atof(row[16]));
|
||||
entry.safe_return_heading = static_cast<float>(atof(row[17]));
|
||||
entry.zone_in_x = static_cast<float>(atof(row[18]));
|
||||
entry.zone_in_y = static_cast<float>(atof(row[19]));
|
||||
entry.zone_in_z = static_cast<float>(atof(row[20]));
|
||||
entry.zone_in_heading = static_cast<float>(atof(row[21]));
|
||||
entry.has_zone_in = atoi(row[22]);
|
||||
|
||||
return entry;
|
||||
}
|
||||
@@ -260,20 +265,21 @@ public:
|
||||
update_values.push_back(columns[5] + " = " + std::to_string(dynamic_zones_entry.leader_id));
|
||||
update_values.push_back(columns[6] + " = " + std::to_string(dynamic_zones_entry.min_players));
|
||||
update_values.push_back(columns[7] + " = " + std::to_string(dynamic_zones_entry.max_players));
|
||||
update_values.push_back(columns[8] + " = " + std::to_string(dynamic_zones_entry.compass_zone_id));
|
||||
update_values.push_back(columns[9] + " = " + std::to_string(dynamic_zones_entry.compass_x));
|
||||
update_values.push_back(columns[10] + " = " + std::to_string(dynamic_zones_entry.compass_y));
|
||||
update_values.push_back(columns[11] + " = " + std::to_string(dynamic_zones_entry.compass_z));
|
||||
update_values.push_back(columns[12] + " = " + std::to_string(dynamic_zones_entry.safe_return_zone_id));
|
||||
update_values.push_back(columns[13] + " = " + std::to_string(dynamic_zones_entry.safe_return_x));
|
||||
update_values.push_back(columns[14] + " = " + std::to_string(dynamic_zones_entry.safe_return_y));
|
||||
update_values.push_back(columns[15] + " = " + std::to_string(dynamic_zones_entry.safe_return_z));
|
||||
update_values.push_back(columns[16] + " = " + std::to_string(dynamic_zones_entry.safe_return_heading));
|
||||
update_values.push_back(columns[17] + " = " + std::to_string(dynamic_zones_entry.zone_in_x));
|
||||
update_values.push_back(columns[18] + " = " + std::to_string(dynamic_zones_entry.zone_in_y));
|
||||
update_values.push_back(columns[19] + " = " + std::to_string(dynamic_zones_entry.zone_in_z));
|
||||
update_values.push_back(columns[20] + " = " + std::to_string(dynamic_zones_entry.zone_in_heading));
|
||||
update_values.push_back(columns[21] + " = " + std::to_string(dynamic_zones_entry.has_zone_in));
|
||||
update_values.push_back(columns[8] + " = " + std::to_string(dynamic_zones_entry.dz_switch_id));
|
||||
update_values.push_back(columns[9] + " = " + std::to_string(dynamic_zones_entry.compass_zone_id));
|
||||
update_values.push_back(columns[10] + " = " + std::to_string(dynamic_zones_entry.compass_x));
|
||||
update_values.push_back(columns[11] + " = " + std::to_string(dynamic_zones_entry.compass_y));
|
||||
update_values.push_back(columns[12] + " = " + std::to_string(dynamic_zones_entry.compass_z));
|
||||
update_values.push_back(columns[13] + " = " + std::to_string(dynamic_zones_entry.safe_return_zone_id));
|
||||
update_values.push_back(columns[14] + " = " + std::to_string(dynamic_zones_entry.safe_return_x));
|
||||
update_values.push_back(columns[15] + " = " + std::to_string(dynamic_zones_entry.safe_return_y));
|
||||
update_values.push_back(columns[16] + " = " + std::to_string(dynamic_zones_entry.safe_return_z));
|
||||
update_values.push_back(columns[17] + " = " + std::to_string(dynamic_zones_entry.safe_return_heading));
|
||||
update_values.push_back(columns[18] + " = " + std::to_string(dynamic_zones_entry.zone_in_x));
|
||||
update_values.push_back(columns[19] + " = " + std::to_string(dynamic_zones_entry.zone_in_y));
|
||||
update_values.push_back(columns[20] + " = " + std::to_string(dynamic_zones_entry.zone_in_z));
|
||||
update_values.push_back(columns[21] + " = " + std::to_string(dynamic_zones_entry.zone_in_heading));
|
||||
update_values.push_back(columns[22] + " = " + std::to_string(dynamic_zones_entry.has_zone_in));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -303,6 +309,7 @@ public:
|
||||
insert_values.push_back(std::to_string(dynamic_zones_entry.leader_id));
|
||||
insert_values.push_back(std::to_string(dynamic_zones_entry.min_players));
|
||||
insert_values.push_back(std::to_string(dynamic_zones_entry.max_players));
|
||||
insert_values.push_back(std::to_string(dynamic_zones_entry.dz_switch_id));
|
||||
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_zone_id));
|
||||
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_x));
|
||||
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_y));
|
||||
@@ -354,6 +361,7 @@ public:
|
||||
insert_values.push_back(std::to_string(dynamic_zones_entry.leader_id));
|
||||
insert_values.push_back(std::to_string(dynamic_zones_entry.min_players));
|
||||
insert_values.push_back(std::to_string(dynamic_zones_entry.max_players));
|
||||
insert_values.push_back(std::to_string(dynamic_zones_entry.dz_switch_id));
|
||||
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_zone_id));
|
||||
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_x));
|
||||
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_y));
|
||||
@@ -409,20 +417,21 @@ public:
|
||||
entry.leader_id = atoi(row[5]);
|
||||
entry.min_players = atoi(row[6]);
|
||||
entry.max_players = atoi(row[7]);
|
||||
entry.compass_zone_id = atoi(row[8]);
|
||||
entry.compass_x = static_cast<float>(atof(row[9]));
|
||||
entry.compass_y = static_cast<float>(atof(row[10]));
|
||||
entry.compass_z = static_cast<float>(atof(row[11]));
|
||||
entry.safe_return_zone_id = atoi(row[12]);
|
||||
entry.safe_return_x = static_cast<float>(atof(row[13]));
|
||||
entry.safe_return_y = static_cast<float>(atof(row[14]));
|
||||
entry.safe_return_z = static_cast<float>(atof(row[15]));
|
||||
entry.safe_return_heading = static_cast<float>(atof(row[16]));
|
||||
entry.zone_in_x = static_cast<float>(atof(row[17]));
|
||||
entry.zone_in_y = static_cast<float>(atof(row[18]));
|
||||
entry.zone_in_z = static_cast<float>(atof(row[19]));
|
||||
entry.zone_in_heading = static_cast<float>(atof(row[20]));
|
||||
entry.has_zone_in = atoi(row[21]);
|
||||
entry.dz_switch_id = atoi(row[8]);
|
||||
entry.compass_zone_id = atoi(row[9]);
|
||||
entry.compass_x = static_cast<float>(atof(row[10]));
|
||||
entry.compass_y = static_cast<float>(atof(row[11]));
|
||||
entry.compass_z = static_cast<float>(atof(row[12]));
|
||||
entry.safe_return_zone_id = atoi(row[13]);
|
||||
entry.safe_return_x = static_cast<float>(atof(row[14]));
|
||||
entry.safe_return_y = static_cast<float>(atof(row[15]));
|
||||
entry.safe_return_z = static_cast<float>(atof(row[16]));
|
||||
entry.safe_return_heading = static_cast<float>(atof(row[17]));
|
||||
entry.zone_in_x = static_cast<float>(atof(row[18]));
|
||||
entry.zone_in_y = static_cast<float>(atof(row[19]));
|
||||
entry.zone_in_z = static_cast<float>(atof(row[20]));
|
||||
entry.zone_in_heading = static_cast<float>(atof(row[21]));
|
||||
entry.has_zone_in = atoi(row[22]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
@@ -455,20 +464,21 @@ public:
|
||||
entry.leader_id = atoi(row[5]);
|
||||
entry.min_players = atoi(row[6]);
|
||||
entry.max_players = atoi(row[7]);
|
||||
entry.compass_zone_id = atoi(row[8]);
|
||||
entry.compass_x = static_cast<float>(atof(row[9]));
|
||||
entry.compass_y = static_cast<float>(atof(row[10]));
|
||||
entry.compass_z = static_cast<float>(atof(row[11]));
|
||||
entry.safe_return_zone_id = atoi(row[12]);
|
||||
entry.safe_return_x = static_cast<float>(atof(row[13]));
|
||||
entry.safe_return_y = static_cast<float>(atof(row[14]));
|
||||
entry.safe_return_z = static_cast<float>(atof(row[15]));
|
||||
entry.safe_return_heading = static_cast<float>(atof(row[16]));
|
||||
entry.zone_in_x = static_cast<float>(atof(row[17]));
|
||||
entry.zone_in_y = static_cast<float>(atof(row[18]));
|
||||
entry.zone_in_z = static_cast<float>(atof(row[19]));
|
||||
entry.zone_in_heading = static_cast<float>(atof(row[20]));
|
||||
entry.has_zone_in = atoi(row[21]);
|
||||
entry.dz_switch_id = atoi(row[8]);
|
||||
entry.compass_zone_id = atoi(row[9]);
|
||||
entry.compass_x = static_cast<float>(atof(row[10]));
|
||||
entry.compass_y = static_cast<float>(atof(row[11]));
|
||||
entry.compass_z = static_cast<float>(atof(row[12]));
|
||||
entry.safe_return_zone_id = atoi(row[13]);
|
||||
entry.safe_return_x = static_cast<float>(atof(row[14]));
|
||||
entry.safe_return_y = static_cast<float>(atof(row[15]));
|
||||
entry.safe_return_z = static_cast<float>(atof(row[16]));
|
||||
entry.safe_return_heading = static_cast<float>(atof(row[17]));
|
||||
entry.zone_in_x = static_cast<float>(atof(row[18]));
|
||||
entry.zone_in_y = static_cast<float>(atof(row[19]));
|
||||
entry.zone_in_z = static_cast<float>(atof(row[20]));
|
||||
entry.zone_in_heading = static_cast<float>(atof(row[21]));
|
||||
entry.has_zone_in = atoi(row[22]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ public:
|
||||
int max_players;
|
||||
int instance_id;
|
||||
int type;
|
||||
int dz_switch_id;
|
||||
int compass_zone_id;
|
||||
float compass_x;
|
||||
float compass_y;
|
||||
@@ -109,6 +110,7 @@ public:
|
||||
dynamic_zones.max_players,
|
||||
dynamic_zones.instance_id,
|
||||
dynamic_zones.type,
|
||||
dynamic_zones.dz_switch_id,
|
||||
dynamic_zones.compass_zone_id,
|
||||
dynamic_zones.compass_x,
|
||||
dynamic_zones.compass_y,
|
||||
@@ -147,6 +149,7 @@ public:
|
||||
entry.max_players = strtol(row[col++], nullptr, 10);
|
||||
entry.instance_id = strtol(row[col++], nullptr, 10);
|
||||
entry.type = strtol(row[col++], nullptr, 10);
|
||||
entry.dz_switch_id = strtol(row[col++], nullptr, 10);
|
||||
entry.compass_zone_id = strtol(row[col++], nullptr, 10);
|
||||
entry.compass_x = strtof(row[col++], nullptr);
|
||||
entry.compass_y = strtof(row[col++], nullptr);
|
||||
@@ -261,6 +264,18 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
static void UpdateSwitchID(Database& db, uint32_t dz_id, int dz_switch_id)
|
||||
{
|
||||
if (dz_id != 0)
|
||||
{
|
||||
std::string query = fmt::format(SQL(
|
||||
UPDATE {} SET dz_switch_id = {} WHERE {} = {};
|
||||
), TableName(), dz_switch_id, PrimaryKey(), dz_id);
|
||||
|
||||
db.QueryDatabase(query);
|
||||
}
|
||||
}
|
||||
|
||||
struct DynamicZoneInstancePlayerCount
|
||||
{
|
||||
uint32_t id;
|
||||
|
||||
Reference in New Issue
Block a user