[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:
hg
2022-07-30 22:00:11 -04:00
committed by GitHub
parent 1351f147f4
commit 676467cbdc
42 changed files with 349 additions and 235 deletions
+24
View File
@@ -79,6 +79,7 @@ void DynamicZoneBase::LoadRepositoryResult(DynamicZonesRepository::DynamicZoneIn
m_max_players = dz_entry.max_players;
m_instance_id = dz_entry.instance_id;
m_type = static_cast<DynamicZoneType>(dz_entry.type);
m_dz_switch_id = dz_entry.dz_switch_id;
m_compass.zone_id = dz_entry.compass_zone_id;
m_compass.x = dz_entry.compass_x;
m_compass.y = dz_entry.compass_y;
@@ -129,6 +130,7 @@ uint32_t DynamicZoneBase::SaveToDatabase()
insert_dz.max_players = m_max_players;
insert_dz.instance_id = m_instance_id,
insert_dz.type = static_cast<int>(m_type);
insert_dz.dz_switch_id = m_dz_switch_id;
insert_dz.compass_zone_id = m_compass.zone_id;
insert_dz.compass_x = m_compass.x;
insert_dz.compass_y = m_compass.y;
@@ -316,6 +318,17 @@ void DynamicZoneBase::SetZoneInLocation(float x, float y, float z, float heading
SetZoneInLocation({ 0, x, y, z, heading }, update_db);
}
void DynamicZoneBase::SetSwitchID(int dz_switch_id, bool update_db)
{
m_dz_switch_id = dz_switch_id;
if (update_db)
{
DynamicZonesRepository::UpdateSwitchID(GetDatabase(), m_id, dz_switch_id);
SendServerPacket(CreateServerDzSwitchIDPacket().get());
}
}
void DynamicZoneBase::SetLeader(const DynamicZoneMember& new_leader, bool update_db)
{
m_leader = new_leader;
@@ -403,6 +416,17 @@ std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerDzLocationPacket(
return pack;
}
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerDzSwitchIDPacket()
{
constexpr uint32_t pack_size = sizeof(ServerDzSwitchID_Struct);
auto pack = std::make_unique<ServerPacket>(ServerOP_DzSetSwitchID, pack_size);
auto buf = reinterpret_cast<ServerDzSwitchID_Struct*>(pack->pBuffer);
buf->dz_id = GetID();
buf->dz_switch_id = GetSwitchID();
return pack;
}
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerMemberStatusPacket(
uint32_t character_id, DynamicZoneMemberStatus status)
{
+6
View File
@@ -85,6 +85,7 @@ public:
uint16_t GetZoneID() const { return static_cast<uint16_t>(m_zone_id); }
uint32_t GetZoneIndex() const { return (m_instance_id << 16) | (m_zone_id & 0xffff); }
uint32_t GetZoneVersion() const { return m_zone_version; }
int GetSwitchID() const { return m_dz_switch_id; }
DynamicZoneType GetType() const { return m_type; }
const std::string& GetLeaderName() const { return m_leader.name; }
const std::string& GetName() const { return m_name; }
@@ -127,6 +128,7 @@ public:
void SetName(const std::string& name) { m_name = name; }
void SetSafeReturn(const DynamicZoneLocation& location, bool update_db = false);
void SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db = false);
void SetSwitchID(int dz_switch_id, bool update_db = false);
void SetType(DynamicZoneType type) { m_type = type; }
void SetUUID(std::string uuid) { m_uuid = std::move(uuid); }
void SetZoneInLocation(const DynamicZoneLocation& location, bool update_db = false);
@@ -141,6 +143,7 @@ protected:
virtual void ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed);
virtual bool ProcessMemberStatusChange(uint32_t member_id, DynamicZoneMemberStatus status);
virtual void ProcessRemoveAllMembers(bool silent = false) { m_members.clear(); }
virtual void ProcessSetSwitchID(int dz_switch_id) { m_dz_switch_id = dz_switch_id; }
virtual bool SendServerPacket(ServerPacket* packet) = 0;
void AddInternalMember(const DynamicZoneMember& member);
@@ -153,6 +156,7 @@ protected:
std::unique_ptr<ServerPacket> CreateServerDzCreatePacket(uint16_t origin_zone_id, uint16_t origin_instance_id);
std::unique_ptr<ServerPacket> CreateServerDzLocationPacket(uint16_t server_opcode, const DynamicZoneLocation& location);
std::unique_ptr<ServerPacket> CreateServerDzSwitchIDPacket();
std::unique_ptr<ServerPacket> CreateServerMemberAddRemovePacket(const DynamicZoneMember& member, bool removed);
std::unique_ptr<ServerPacket> CreateServerMemberStatusPacket(uint32_t character_id, DynamicZoneMemberStatus status);
std::unique_ptr<ServerPacket> CreateServerMemberSwapPacket(const DynamicZoneMember& remove_member, const DynamicZoneMember& add_member);
@@ -164,6 +168,7 @@ protected:
uint32_t m_zone_version = 0;
uint32_t m_min_players = 0;
uint32_t m_max_players = 0;
int m_dz_switch_id = 0;
bool m_never_expires = false;
bool m_has_zonein = false;
bool m_has_member_statuses = false;
@@ -190,6 +195,7 @@ public:
m_zone_version,
m_min_players,
m_max_players,
m_dz_switch_id,
m_never_expires,
m_has_zonein,
m_has_member_statuses,
+1 -1
View File
@@ -5006,7 +5006,7 @@ struct DynamicZoneCompassEntry_Struct
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*008*/ uint32 unknown008;
/*008*/ uint32 dz_switch_id;
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
-24
View File
@@ -736,30 +736,6 @@ namespace RoF
FINISH_ENCODE();
}
ENCODE(OP_DzCompass)
{
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
sizeof(structs::DynamicZoneCompass_Struct) +
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
);
OUT(client_id);
OUT(count);
for (uint32 i = 0; i < emu->count; ++i)
{
OUT(entries[i].dz_zone_id);
OUT(entries[i].dz_instance_id);
OUT(entries[i].dz_type);
OUT(entries[i].x);
OUT(entries[i].y);
OUT(entries[i].z);
}
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionEndsWarning)
{
ENCODE_LENGTH_EXACT(ExpeditionExpireWarning);
-24
View File
@@ -785,30 +785,6 @@ namespace RoF2
FINISH_ENCODE();
}
ENCODE(OP_DzCompass)
{
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
sizeof(structs::DynamicZoneCompass_Struct) +
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
);
OUT(client_id);
OUT(count);
for (uint32 i = 0; i < emu->count; ++i)
{
OUT(entries[i].dz_zone_id);
OUT(entries[i].dz_instance_id);
OUT(entries[i].dz_type);
OUT(entries[i].x);
OUT(entries[i].y);
OUT(entries[i].z);
}
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionEndsWarning)
{
ENCODE_LENGTH_EXACT(ExpeditionExpireWarning);
-1
View File
@@ -59,7 +59,6 @@ E(OP_DeleteItem)
E(OP_DeleteSpawn)
E(OP_DisciplineUpdate)
E(OP_DzChooseZone)
E(OP_DzCompass)
E(OP_DzExpeditionEndsWarning)
E(OP_DzExpeditionInfo)
E(OP_DzExpeditionInvite)
+1 -1
View File
@@ -4989,7 +4989,7 @@ struct DynamicZoneCompassEntry_Struct
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*008*/ uint32 unknown008;
/*008*/ uint32 dz_switch_id;
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
-1
View File
@@ -45,7 +45,6 @@ E(OP_DeleteItem)
E(OP_DeleteSpawn)
E(OP_DisciplineUpdate)
E(OP_DzChooseZone)
E(OP_DzCompass)
E(OP_DzExpeditionEndsWarning)
E(OP_DzExpeditionInfo)
E(OP_DzExpeditionInvite)
+1 -1
View File
@@ -4921,7 +4921,7 @@ struct DynamicZoneCompassEntry_Struct
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*008*/ uint32 unknown008;
/*008*/ uint32 dz_switch_id;
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
-24
View File
@@ -509,30 +509,6 @@ namespace SoD
FINISH_ENCODE();
}
ENCODE(OP_DzCompass)
{
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
sizeof(structs::DynamicZoneCompass_Struct) +
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
);
OUT(client_id);
OUT(count);
for (uint32 i = 0; i < emu->count; ++i)
{
OUT(entries[i].dz_zone_id);
OUT(entries[i].dz_instance_id);
OUT(entries[i].dz_type);
OUT(entries[i].x);
OUT(entries[i].y);
OUT(entries[i].z);
}
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionEndsWarning)
{
ENCODE_LENGTH_EXACT(ExpeditionExpireWarning);
-1
View File
@@ -36,7 +36,6 @@ E(OP_Damage)
E(OP_DeleteCharge)
E(OP_DeleteItem)
E(OP_DzChooseZone)
E(OP_DzCompass)
E(OP_DzExpeditionEndsWarning)
E(OP_DzExpeditionInfo)
E(OP_DzExpeditionInvite)
+1 -1
View File
@@ -4276,7 +4276,7 @@ struct DynamicZoneCompassEntry_Struct
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*008*/ uint32 unknown008;
/*008*/ uint32 dz_switch_id;
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
-24
View File
@@ -497,30 +497,6 @@ namespace SoF
FINISH_ENCODE();
}
ENCODE(OP_DzCompass)
{
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
sizeof(structs::DynamicZoneCompass_Struct) +
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
);
OUT(client_id);
OUT(count);
for (uint32 i = 0; i < emu->count; ++i)
{
OUT(entries[i].dz_zone_id);
OUT(entries[i].dz_instance_id);
OUT(entries[i].dz_type);
OUT(entries[i].x);
OUT(entries[i].y);
OUT(entries[i].z);
}
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionEndsWarning)
{
ENCODE_LENGTH_EXACT(ExpeditionExpireWarning);
-1
View File
@@ -37,7 +37,6 @@ E(OP_DeleteCharge)
E(OP_DeleteItem)
E(OP_DeleteSpawn)
E(OP_DzChooseZone)
E(OP_DzCompass)
E(OP_DzExpeditionEndsWarning)
E(OP_DzExpeditionInfo)
E(OP_DzExpeditionInvite)
+1 -1
View File
@@ -4186,7 +4186,7 @@ struct DynamicZoneCompassEntry_Struct
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*008*/ uint32 unknown008;
/*008*/ uint32 dz_switch_id;
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
-24
View File
@@ -440,30 +440,6 @@ namespace Titanium
FINISH_ENCODE();
}
ENCODE(OP_DzCompass)
{
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
sizeof(structs::DynamicZoneCompass_Struct) +
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
);
OUT(client_id);
OUT(count);
for (uint32 i = 0; i < emu->count; ++i)
{
OUT(entries[i].dz_zone_id);
OUT(entries[i].dz_instance_id);
OUT(entries[i].dz_type);
OUT(entries[i].x);
OUT(entries[i].y);
OUT(entries[i].z);
}
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionEndsWarning)
{
ENCODE_LENGTH_EXACT(ExpeditionExpireWarning);
-1
View File
@@ -33,7 +33,6 @@ E(OP_DeleteCharge)
E(OP_DeleteItem)
E(OP_DeleteSpawn)
E(OP_DzChooseZone)
E(OP_DzCompass)
E(OP_DzExpeditionEndsWarning)
E(OP_DzExpeditionInfo)
E(OP_DzExpeditionInvite)
+1 -1
View File
@@ -3396,7 +3396,7 @@ struct DynamicZoneCompassEntry_Struct
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*008*/ uint32 unknown008;
/*008*/ uint32 dz_switch_id;
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
-24
View File
@@ -639,30 +639,6 @@ namespace UF
FINISH_ENCODE();
}
ENCODE(OP_DzCompass)
{
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
sizeof(structs::DynamicZoneCompass_Struct) +
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
);
OUT(client_id);
OUT(count);
for (uint32 i = 0; i < emu->count; ++i)
{
OUT(entries[i].dz_zone_id);
OUT(entries[i].dz_instance_id);
OUT(entries[i].dz_type);
OUT(entries[i].x);
OUT(entries[i].y);
OUT(entries[i].z);
}
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionEndsWarning)
{
ENCODE_LENGTH_EXACT(ExpeditionExpireWarning);
-1
View File
@@ -39,7 +39,6 @@ E(OP_DeleteCharge)
E(OP_DeleteItem)
E(OP_DisciplineUpdate)
E(OP_DzChooseZone)
E(OP_DzCompass)
E(OP_DzExpeditionEndsWarning)
E(OP_DzExpeditionInfo)
E(OP_DzExpeditionInvite)
+1 -1
View File
@@ -4357,7 +4357,7 @@ struct DynamicZoneCompassEntry_Struct
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*008*/ uint32 unknown008;
/*008*/ uint32 dz_switch_id;
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
@@ -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;
+14
View File
@@ -169,6 +169,8 @@
#define ServerOP_DzExpireWarning 0x045b
#define ServerOP_DzCreated 0x045c
#define ServerOP_DzDeleted 0x045d
#define ServerOP_DzSetSwitchID 0x045e
#define ServerOP_DzMovePC 0x045f
#define ServerOP_LSInfo 0x1000
#define ServerOP_LSStatus 0x1001
@@ -1671,6 +1673,13 @@ struct ServerDzMemberStatuses_Struct {
ServerDzMemberStatusEntry_Struct entries[0];
};
struct ServerDzMovePC_Struct {
uint32 dz_id;
uint16 sender_zone_id;
uint16 sender_instance_id;
uint32 character_id;
};
struct ServerExpeditionLockout_Struct {
uint32 expedition_id;
uint64 expire_time;
@@ -1752,6 +1761,11 @@ struct ServerDzLocation_Struct {
float heading;
};
struct ServerDzSwitchID_Struct {
uint32 dz_id;
int dz_switch_id;
};
struct ServerDzMember_Struct {
uint32 dz_id;
uint16 dz_zone_id;
+1 -1
View File
@@ -34,7 +34,7 @@
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/
#define CURRENT_BINARY_DATABASE_VERSION 9193
#define CURRENT_BINARY_DATABASE_VERSION 9194
#ifdef BOTS
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9029