mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-02 04:16:46 +00:00
[Code Cleanup] Zone Data Loading Refactor (#2388)
* [Code Cleanup] Zone data loading refactor * Update client_packet.cpp * strcpy adjustments * Ensure safe points get reloaded properly * Simplify GetPEQZone and getZoneShutDownDelay * Bring in zone_store where needed * Update client.cpp * Signature * Signature * Convert helpers to using pointers * PR comment * Update worlddb.cpp * Fix loading for instances * Fix zoning with fallback as well * Another place for instance fallback
This commit is contained in:
@@ -32,7 +32,6 @@ SET(world_sources
|
||||
world_server_command_handler.cpp
|
||||
worlddb.cpp
|
||||
world_boot.cpp
|
||||
world_store.cpp
|
||||
zonelist.cpp
|
||||
zoneserver.cpp
|
||||
)
|
||||
@@ -71,7 +70,6 @@ SET(world_headers
|
||||
worlddb.h
|
||||
world_boot.h
|
||||
world_event_scheduler.h
|
||||
world_store.h
|
||||
zonelist.h
|
||||
zoneserver.h
|
||||
)
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
#include "zonelist.h"
|
||||
#include "clientlist.h"
|
||||
#include "cliententry.h"
|
||||
#include "world_store.h"
|
||||
#include "../common/zone_store.h"
|
||||
|
||||
extern ZSList zoneserver_list;
|
||||
extern ClientList client_list;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "zonelist.h"
|
||||
#include "clientlist.h"
|
||||
#include "cliententry.h"
|
||||
#include "world_store.h"
|
||||
#include "../common/zone_store.h"
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
+7
-2
@@ -46,7 +46,7 @@
|
||||
#include "clientlist.h"
|
||||
#include "wguild_mgr.h"
|
||||
#include "sof_char_create_data.h"
|
||||
#include "world_store.h"
|
||||
#include "../common/zone_store.h"
|
||||
#include "../common/repositories/account_repository.h"
|
||||
|
||||
#include <iostream>
|
||||
@@ -1733,7 +1733,12 @@ bool Client::OPCharCreate(char *name, CharCreate_Struct *cc)
|
||||
/* Overrides if we have the tutorial flag set! */
|
||||
if (cc->tutorial && RuleB(World, EnableTutorialButton)) {
|
||||
pp.zone_id = RuleI(World, TutorialZoneID);
|
||||
content_db.GetSafePoints(ZoneName(pp.zone_id), 0, &pp.x, &pp.y, &pp.z);
|
||||
auto z = GetZone(pp.zone_id);
|
||||
if (z) {
|
||||
pp.x = z->safe_x;
|
||||
pp.y = z->safe_y;
|
||||
pp.z = z->safe_z;
|
||||
}
|
||||
}
|
||||
|
||||
/* Will either be the same as home or tutorial if enabled. */
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "../common/event_sub.h"
|
||||
#include "web_interface.h"
|
||||
#include "wguild_mgr.h"
|
||||
#include "world_store.h"
|
||||
#include "../common/zone_store.h"
|
||||
#include <set>
|
||||
|
||||
extern WebInterfaceList web_interface;
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@
|
||||
#include "../common/strings.h"
|
||||
#include "../common/md5.h"
|
||||
#include "eqemu_api_world_data_service.h"
|
||||
#include "world_store.h"
|
||||
#include "../common/zone_store.h"
|
||||
#include <fmt/format.h>
|
||||
|
||||
extern ClientList client_list;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "launcher_link.h"
|
||||
#include "launcher_list.h"
|
||||
#include "../common/strings.h"
|
||||
#include "world_store.h"
|
||||
#include "../common/zone_store.h"
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
|
||||
+2
-2
@@ -91,12 +91,12 @@ union semun {
|
||||
#include "world_server_command_handler.h"
|
||||
#include "../common/content/world_content_service.h"
|
||||
#include "../common/repositories/character_task_timers_repository.h"
|
||||
#include "world_store.h"
|
||||
#include "../common/zone_store.h"
|
||||
#include "world_event_scheduler.h"
|
||||
#include "shared_task_manager.h"
|
||||
#include "world_boot.h"
|
||||
|
||||
WorldStore world_store;
|
||||
ZoneStore zone_store;
|
||||
ClientList client_list;
|
||||
GroupLFPList LFPGroupList;
|
||||
ZSList zoneserver_list;
|
||||
|
||||
@@ -19,11 +19,12 @@
|
||||
#include "world_config.h"
|
||||
#include "world_event_scheduler.h"
|
||||
#include "world_server_command_handler.h"
|
||||
#include "world_store.h"
|
||||
#include "../common/zone_store.h"
|
||||
#include "worlddb.h"
|
||||
#include "zonelist.h"
|
||||
#include "zoneserver.h"
|
||||
#include "../common/ip_util.h"
|
||||
#include "../common/zone_store.h"
|
||||
|
||||
extern ZSList zoneserver_list;
|
||||
extern WorldConfig Config;
|
||||
@@ -310,7 +311,7 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
|
||||
|
||||
LogInfo("Loading zones");
|
||||
|
||||
world_store.LoadZones();
|
||||
zone_store.LoadZones(content_db);
|
||||
|
||||
LogInfo("Clearing groups");
|
||||
database.ClearGroup();
|
||||
|
||||
@@ -1,152 +0,0 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#include "world_store.h"
|
||||
|
||||
WorldStore::WorldStore() = default;
|
||||
WorldStore::~WorldStore() = default;
|
||||
|
||||
void WorldStore::LoadZones()
|
||||
{
|
||||
zones = ZoneRepository::All(content_db);
|
||||
}
|
||||
|
||||
uint32 WorldStore::GetZoneID(const char *in_zone_name)
|
||||
{
|
||||
if (in_zone_name == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string zone_name = Strings::ToLower(in_zone_name);
|
||||
|
||||
return GetZoneID(zone_name);
|
||||
}
|
||||
|
||||
uint32 WorldStore::GetZoneID(std::string zone_name)
|
||||
{
|
||||
for (auto &z: zones) {
|
||||
if (z.short_name == zone_name) {
|
||||
return z.zoneidnumber;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param zone_id
|
||||
* @param error_unknown
|
||||
* @return
|
||||
*/
|
||||
const char *WorldStore::GetZoneName(uint32 zone_id, bool error_unknown)
|
||||
{
|
||||
for (auto &z: zones) {
|
||||
if (z.zoneidnumber == zone_id) {
|
||||
return z.short_name.c_str();
|
||||
}
|
||||
}
|
||||
|
||||
if (error_unknown) {
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param zone_id
|
||||
* @return
|
||||
*/
|
||||
std::string WorldStore::GetZoneName(uint32 zone_id)
|
||||
{
|
||||
for (auto &z: zones) {
|
||||
if (z.zoneidnumber == zone_id) {
|
||||
return z.short_name;
|
||||
}
|
||||
}
|
||||
|
||||
return std::string();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param zone_id
|
||||
* @param error_unknown
|
||||
* @return
|
||||
*/
|
||||
const char *WorldStore::GetZoneLongName(uint32 zone_id, bool error_unknown)
|
||||
{
|
||||
for (auto &z: zones) {
|
||||
if (z.zoneidnumber == zone_id) {
|
||||
return z.long_name.c_str();
|
||||
}
|
||||
}
|
||||
|
||||
if (error_unknown) {
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param zone_id
|
||||
* @return
|
||||
*/
|
||||
std::string WorldStore::GetZoneLongName(uint32 zone_id)
|
||||
{
|
||||
for (auto &z: zones) {
|
||||
if (z.zoneidnumber == zone_id) {
|
||||
return z.long_name;
|
||||
}
|
||||
}
|
||||
|
||||
return std::string();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param zone_id
|
||||
* @param version
|
||||
* @return
|
||||
*/
|
||||
ZoneRepository::Zone WorldStore::GetZone(uint32 zone_id, int version)
|
||||
{
|
||||
for (auto &z: zones) {
|
||||
if (z.zoneidnumber == zone_id && z.version == version) {
|
||||
return z;
|
||||
}
|
||||
}
|
||||
|
||||
return ZoneRepository::Zone();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param in_zone_name
|
||||
* @return
|
||||
*/
|
||||
ZoneRepository::Zone WorldStore::GetZone(const char *in_zone_name)
|
||||
{
|
||||
for (auto &z: zones) {
|
||||
if (z.short_name == in_zone_name) {
|
||||
return z;
|
||||
}
|
||||
}
|
||||
|
||||
return ZoneRepository::Zone();
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
* are required to give you total support for your newly bought product;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_WORLD_STORE_H
|
||||
#define EQEMU_WORLD_STORE_H
|
||||
|
||||
#include "worlddb.h"
|
||||
#include "../common/repositories/zone_repository.h"
|
||||
|
||||
class WorldStore {
|
||||
public:
|
||||
WorldStore();
|
||||
virtual ~WorldStore();
|
||||
|
||||
std::vector<ZoneRepository::Zone> zones{};
|
||||
|
||||
void LoadZones();
|
||||
|
||||
ZoneRepository::Zone GetZone(uint32 zone_id, int version = 0);
|
||||
ZoneRepository::Zone GetZone(const char *in_zone_name);
|
||||
uint32 GetZoneID(const char *in_zone_name);
|
||||
uint32 GetZoneID(std::string zone_name);
|
||||
std::string GetZoneName(uint32 zone_id);
|
||||
std::string GetZoneLongName(uint32 zone_id);
|
||||
const char *GetZoneName(uint32 zone_id, bool error_unknown = false);
|
||||
const char *GetZoneLongName(uint32 zone_id, bool error_unknown = false);
|
||||
};
|
||||
|
||||
extern WorldStore world_store;
|
||||
|
||||
/**
|
||||
* Global helpers
|
||||
*/
|
||||
inline uint32 ZoneID(const char *in_zone_name) { return world_store.GetZoneID(in_zone_name); }
|
||||
inline uint32 ZoneID(std::string zone_name) { return world_store.GetZoneID(zone_name); }
|
||||
inline const char *ZoneName(uint32 zone_id, bool error_unknown = false)
|
||||
{
|
||||
return world_store.GetZoneName(
|
||||
zone_id,
|
||||
error_unknown
|
||||
);
|
||||
}
|
||||
inline const char *ZoneLongName(uint32 zone_id, bool error_unknown = false)
|
||||
{
|
||||
return world_store.GetZoneLongName(
|
||||
zone_id,
|
||||
error_unknown
|
||||
);
|
||||
}
|
||||
inline ZoneRepository::Zone GetZone(uint32 zone_id, int version = 0) { return world_store.GetZone(zone_id, version); };
|
||||
inline ZoneRepository::Zone GetZone(const char *in_zone_name) { return world_store.GetZone(in_zone_name); };
|
||||
|
||||
#endif //EQEMU_WORLD_STORE_H
|
||||
+100
-103
@@ -27,7 +27,7 @@
|
||||
#include "sof_char_create_data.h"
|
||||
#include "../common/repositories/character_instance_safereturns_repository.h"
|
||||
#include "../common/repositories/criteria/content_filter_criteria.h"
|
||||
#include "world_store.h"
|
||||
#include "../common/zone_store.h"
|
||||
|
||||
WorldDatabase database;
|
||||
WorldDatabase content_db;
|
||||
@@ -113,10 +113,10 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
|
||||
buff_ptr += sizeof(CharacterSelect_Struct);
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterSelectEntry_Struct *p_character_select_entry_struct = (CharacterSelectEntry_Struct *) buff_ptr;
|
||||
PlayerProfile_Struct player_profile_struct;
|
||||
EQ::InventoryProfile inventory_profile;
|
||||
PlayerProfile_Struct pp;
|
||||
EQ::InventoryProfile inventory_profile;
|
||||
|
||||
player_profile_struct.SetPlayerProfileVersion(EQ::versions::ConvertClientVersionToMobVersion(client_version));
|
||||
pp.SetPlayerProfileVersion(EQ::versions::ConvertClientVersionToMobVersion(client_version));
|
||||
inventory_profile.SetInventoryVersion(client_version);
|
||||
inventory_profile.SetGMInventory(true); // charsel can not interact with items..but, no harm in setting to full expansion support
|
||||
|
||||
@@ -124,7 +124,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
|
||||
uint8 has_home = 0;
|
||||
uint8 has_bind = 0;
|
||||
|
||||
memset(&player_profile_struct, 0, sizeof(PlayerProfile_Struct));
|
||||
memset(&pp, 0, sizeof(PlayerProfile_Struct));
|
||||
memset(p_character_select_entry_struct->Name, 0, sizeof(p_character_select_entry_struct->Name));
|
||||
strcpy(p_character_select_entry_struct->Name, row[1]);
|
||||
p_character_select_entry_struct->Class = (uint8) atoi(row[4]);
|
||||
@@ -198,12 +198,12 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
|
||||
has_home = 1;
|
||||
// If our bind count is less than 5, we need to actually make use of this data so lets parse it
|
||||
if (bind_count < 5) {
|
||||
player_profile_struct.binds[4].zone_id = atoi(row_b[0]);
|
||||
player_profile_struct.binds[4].instance_id = atoi(row_b[1]);
|
||||
player_profile_struct.binds[4].x = atof(row_b[2]);
|
||||
player_profile_struct.binds[4].y = atof(row_b[3]);
|
||||
player_profile_struct.binds[4].z = atof(row_b[4]);
|
||||
player_profile_struct.binds[4].heading = atof(row_b[5]);
|
||||
pp.binds[4].zone_id = atoi(row_b[0]);
|
||||
pp.binds[4].instance_id = atoi(row_b[1]);
|
||||
pp.binds[4].x = atof(row_b[2]);
|
||||
pp.binds[4].y = atof(row_b[3]);
|
||||
pp.binds[4].z = atof(row_b[4]);
|
||||
pp.binds[4].heading = atof(row_b[5]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,40 +234,39 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
|
||||
for (auto row_d = results_bind.begin(); row_d != results_bind.end(); ++row_d) {
|
||||
/* If a bind_id is specified, make them start there */
|
||||
if (atoi(row_d[1]) != 0) {
|
||||
player_profile_struct.binds[4].zone_id = (uint32) atoi(row_d[1]);
|
||||
content_db.GetSafePoints(
|
||||
ZoneName(player_profile_struct.binds[4].zone_id, true),
|
||||
0,
|
||||
&player_profile_struct.binds[4].x,
|
||||
&player_profile_struct.binds[4].y,
|
||||
&player_profile_struct.binds[4].z,
|
||||
&player_profile_struct.binds[4].heading
|
||||
);
|
||||
pp.binds[4].zone_id = (uint32) atoi(row_d[1]);
|
||||
|
||||
auto z = GetZone(pp.binds[4].zone_id);
|
||||
if (z) {
|
||||
pp.binds[4].x = z->safe_x;
|
||||
pp.binds[4].y = z->safe_y;
|
||||
pp.binds[4].z = z->safe_z;
|
||||
pp.binds[4].heading = z->safe_heading;
|
||||
}
|
||||
}
|
||||
/* Otherwise, use the zone and coordinates given */
|
||||
else {
|
||||
player_profile_struct.binds[4].zone_id = (uint32) atoi(row_d[0]);
|
||||
pp.binds[4].zone_id = (uint32) atoi(row_d[0]);
|
||||
float x = atof(row_d[2]);
|
||||
float y = atof(row_d[3]);
|
||||
float z = atof(row_d[4]);
|
||||
float heading = atof(row_d[5]);
|
||||
if (x == 0 && y == 0 && z == 0 && heading == 0) {
|
||||
content_db.GetSafePoints(
|
||||
ZoneName(player_profile_struct.binds[4].zone_id, true),
|
||||
0,
|
||||
&x,
|
||||
&y,
|
||||
&z,
|
||||
&heading
|
||||
);
|
||||
auto zone = GetZone(pp.binds[4].zone_id);
|
||||
if (zone) {
|
||||
x = zone->safe_x;
|
||||
y = zone->safe_y;
|
||||
z = zone->safe_z;
|
||||
heading = zone->safe_heading;
|
||||
}
|
||||
}
|
||||
player_profile_struct.binds[4].x = x;
|
||||
player_profile_struct.binds[4].y = y;
|
||||
player_profile_struct.binds[4].z = z;
|
||||
player_profile_struct.binds[4].heading = heading;
|
||||
pp.binds[4].x = x;
|
||||
pp.binds[4].y = y;
|
||||
pp.binds[4].z = z;
|
||||
pp.binds[4].heading = heading;
|
||||
}
|
||||
}
|
||||
player_profile_struct.binds[0] = player_profile_struct.binds[4];
|
||||
pp.binds[0] = pp.binds[4];
|
||||
/* If no home bind set, set it */
|
||||
if (has_home == 0) {
|
||||
std::string query = fmt::format(
|
||||
@@ -278,12 +277,12 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
|
||||
VALUES ({}, {}, {}, {}, {}, {}, {}, {})
|
||||
),
|
||||
character_id,
|
||||
player_profile_struct.binds[4].zone_id,
|
||||
pp.binds[4].zone_id,
|
||||
0,
|
||||
player_profile_struct.binds[4].x,
|
||||
player_profile_struct.binds[4].y,
|
||||
player_profile_struct.binds[4].z,
|
||||
player_profile_struct.binds[4].heading,
|
||||
pp.binds[4].x,
|
||||
pp.binds[4].y,
|
||||
pp.binds[4].z,
|
||||
pp.binds[4].heading,
|
||||
4
|
||||
);
|
||||
auto results_bset = QueryDatabase(query);
|
||||
@@ -298,12 +297,12 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
|
||||
VALUES ({}, {}, {}, {}, {}, {}, {}, {})
|
||||
),
|
||||
character_id,
|
||||
player_profile_struct.binds[0].zone_id,
|
||||
pp.binds[0].zone_id,
|
||||
0,
|
||||
player_profile_struct.binds[0].x,
|
||||
player_profile_struct.binds[0].y,
|
||||
player_profile_struct.binds[0].z,
|
||||
player_profile_struct.binds[0].heading,
|
||||
pp.binds[0].x,
|
||||
pp.binds[0].y,
|
||||
pp.binds[0].z,
|
||||
pp.binds[0].heading,
|
||||
0
|
||||
);
|
||||
auto results_bset = QueryDatabase(query);
|
||||
@@ -314,7 +313,7 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
|
||||
// we know that home and main bind must be valid here, so we don't check those
|
||||
// we also use home to fill in the null data like live does.
|
||||
for (int i = 1; i < 4; i++) {
|
||||
if (player_profile_struct.binds[i].zone_id != 0) // we assume 0 is the only invalid one ...
|
||||
if (pp.binds[i].zone_id != 0) // we assume 0 is the only invalid one ...
|
||||
continue;
|
||||
|
||||
std::string query = fmt::format(
|
||||
@@ -325,12 +324,12 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
|
||||
VALUES ({}, {}, {}, {}, {}, {}, {}, {})
|
||||
),
|
||||
character_id,
|
||||
player_profile_struct.binds[4].zone_id,
|
||||
pp.binds[4].zone_id,
|
||||
0,
|
||||
player_profile_struct.binds[4].x,
|
||||
player_profile_struct.binds[4].y,
|
||||
player_profile_struct.binds[4].z,
|
||||
player_profile_struct.binds[4].heading,
|
||||
pp.binds[4].x,
|
||||
pp.binds[4].y,
|
||||
pp.binds[4].z,
|
||||
pp.binds[4].heading,
|
||||
i
|
||||
);
|
||||
auto results_bset = QueryDatabase(query);
|
||||
@@ -352,10 +351,10 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
|
||||
uint8 slot = 0;
|
||||
for (auto row_b = results_b.begin(); row_b != results_b.end(); ++row_b) {
|
||||
slot = atoi(row_b[0]);
|
||||
player_profile_struct.item_tint.Slot[slot].Red = atoi(row_b[1]);
|
||||
player_profile_struct.item_tint.Slot[slot].Green = atoi(row_b[2]);
|
||||
player_profile_struct.item_tint.Slot[slot].Blue = atoi(row_b[3]);
|
||||
player_profile_struct.item_tint.Slot[slot].UseTint = atoi(row_b[4]);
|
||||
pp.item_tint.Slot[slot].Red = atoi(row_b[1]);
|
||||
pp.item_tint.Slot[slot].Green = atoi(row_b[2]);
|
||||
pp.item_tint.Slot[slot].Blue = atoi(row_b[3]);
|
||||
pp.item_tint.Slot[slot].UseTint = atoi(row_b[4]);
|
||||
}
|
||||
|
||||
if (GetCharSelInventory(account_id, p_character_select_entry_struct->Name, &inventory_profile)) {
|
||||
@@ -394,8 +393,8 @@ void WorldDatabase::GetCharSelectInfo(uint32 account_id, EQApplicationPacket **o
|
||||
} else {
|
||||
// Armor Materials/Models
|
||||
uint32 color = (
|
||||
player_profile_struct.item_tint.Slot[matslot].UseTint ?
|
||||
player_profile_struct.item_tint.Slot[matslot].Color :
|
||||
pp.item_tint.Slot[matslot].UseTint ?
|
||||
pp.item_tint.Slot[matslot].Color :
|
||||
inst->GetColor()
|
||||
);
|
||||
p_character_select_entry_struct->Equip[matslot].Material = item->Material;
|
||||
@@ -527,7 +526,7 @@ int WorldDatabase::MoveCharacterToInstanceSafeReturn(
|
||||
}
|
||||
|
||||
bool WorldDatabase::GetStartZone(
|
||||
PlayerProfile_Struct *p_player_profile_struct,
|
||||
PlayerProfile_Struct *pp,
|
||||
CharCreate_Struct *p_char_create_struct,
|
||||
bool is_titanium
|
||||
)
|
||||
@@ -539,20 +538,20 @@ bool WorldDatabase::GetStartZone(
|
||||
// For now, if no row matching row is found, send them to Crescent Reach, as that is probably the most likely
|
||||
// reason for no match being found.
|
||||
//
|
||||
if (!p_player_profile_struct || !p_char_create_struct) {
|
||||
if (!pp || !p_char_create_struct) {
|
||||
return false;
|
||||
}
|
||||
|
||||
p_player_profile_struct->x = 0;
|
||||
p_player_profile_struct->y = 0;
|
||||
p_player_profile_struct->z = 0;
|
||||
p_player_profile_struct->heading = 0;
|
||||
p_player_profile_struct->zone_id = 0;
|
||||
p_player_profile_struct->binds[0].x = 0;
|
||||
p_player_profile_struct->binds[0].y = 0;
|
||||
p_player_profile_struct->binds[0].z = 0;
|
||||
p_player_profile_struct->binds[0].zone_id = 0;
|
||||
p_player_profile_struct->binds[0].instance_id = 0;
|
||||
pp->x = 0;
|
||||
pp->y = 0;
|
||||
pp->z = 0;
|
||||
pp->heading = 0;
|
||||
pp->zone_id = 0;
|
||||
pp->binds[0].x = 0;
|
||||
pp->binds[0].y = 0;
|
||||
pp->binds[0].z = 0;
|
||||
pp->binds[0].zone_id = 0;
|
||||
pp->binds[0].instance_id = 0;
|
||||
|
||||
// see if we have an entry for start_zone. We can support both titanium & SOF+ by having two entries per class/race/deity combo with different zone_ids
|
||||
std::string query;
|
||||
@@ -592,53 +591,51 @@ bool WorldDatabase::GetStartZone(
|
||||
|
||||
if (results.RowCount() == 0) {
|
||||
printf("No start_zones entry in database, using defaults\n");
|
||||
is_titanium ? SetTitaniumDefaultStartZone(p_player_profile_struct, p_char_create_struct) : SetSoFDefaultStartZone(p_player_profile_struct, p_char_create_struct);
|
||||
is_titanium ? SetTitaniumDefaultStartZone(pp, p_char_create_struct) : SetSoFDefaultStartZone(pp, p_char_create_struct);
|
||||
}
|
||||
else {
|
||||
LogInfo("Found starting location in start_zones");
|
||||
auto row = results.begin();
|
||||
p_player_profile_struct->x = atof(row[0]);
|
||||
p_player_profile_struct->y = atof(row[1]);
|
||||
p_player_profile_struct->z = atof(row[2]);
|
||||
p_player_profile_struct->heading = atof(row[3]);
|
||||
p_player_profile_struct->zone_id = atoi(row[4]);
|
||||
p_player_profile_struct->binds[0].zone_id = atoi(row[5]);
|
||||
p_player_profile_struct->binds[0].x = atof(row[6]);
|
||||
p_player_profile_struct->binds[0].y = atof(row[7]);
|
||||
p_player_profile_struct->binds[0].z = atof(row[8]);
|
||||
p_player_profile_struct->binds[0].heading = atof(row[3]);
|
||||
pp->x = atof(row[0]);
|
||||
pp->y = atof(row[1]);
|
||||
pp->z = atof(row[2]);
|
||||
pp->heading = atof(row[3]);
|
||||
pp->zone_id = atoi(row[4]);
|
||||
pp->binds[0].zone_id = atoi(row[5]);
|
||||
pp->binds[0].x = atof(row[6]);
|
||||
pp->binds[0].y = atof(row[7]);
|
||||
pp->binds[0].z = atof(row[8]);
|
||||
pp->binds[0].heading = atof(row[3]);
|
||||
}
|
||||
|
||||
if (
|
||||
p_player_profile_struct->x == 0 &&
|
||||
p_player_profile_struct->y == 0 &&
|
||||
p_player_profile_struct->z == 0 &&
|
||||
p_player_profile_struct->heading == 0
|
||||
pp->x == 0 &&
|
||||
pp->y == 0 &&
|
||||
pp->z == 0 &&
|
||||
pp->heading == 0
|
||||
) {
|
||||
content_db.GetSafePoints(
|
||||
ZoneName(p_player_profile_struct->zone_id, true),
|
||||
0,
|
||||
&p_player_profile_struct->x,
|
||||
&p_player_profile_struct->y,
|
||||
&p_player_profile_struct->z,
|
||||
&p_player_profile_struct->heading
|
||||
);
|
||||
auto zone = GetZone(pp->zone_id);
|
||||
if (zone) {
|
||||
pp->x = zone->safe_x;
|
||||
pp->y = zone->safe_y;
|
||||
pp->z = zone->safe_z;
|
||||
pp->heading = zone->safe_heading;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
p_player_profile_struct->binds[0].x == 0 &&
|
||||
p_player_profile_struct->binds[0].y == 0 &&
|
||||
p_player_profile_struct->binds[0].z == 0 &&
|
||||
p_player_profile_struct->binds[0].heading == 0
|
||||
pp->binds[0].x == 0 &&
|
||||
pp->binds[0].y == 0 &&
|
||||
pp->binds[0].z == 0 &&
|
||||
pp->binds[0].heading == 0
|
||||
) {
|
||||
content_db.GetSafePoints(
|
||||
ZoneName(p_player_profile_struct->binds[0].zone_id, true),
|
||||
0,
|
||||
&p_player_profile_struct->binds[0].x,
|
||||
&p_player_profile_struct->binds[0].y,
|
||||
&p_player_profile_struct->binds[0].z,
|
||||
&p_player_profile_struct->binds[0].heading
|
||||
);
|
||||
auto zone = GetZone(pp->binds[0].zone_id);
|
||||
if (zone) {
|
||||
pp->binds[0].x = zone->safe_x;
|
||||
pp->binds[0].y = zone->safe_y;
|
||||
pp->binds[0].z = zone->safe_z;
|
||||
pp->binds[0].heading = zone->safe_heading;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ struct CharacterSelect_Struct;
|
||||
|
||||
class WorldDatabase : public SharedDatabase {
|
||||
public:
|
||||
bool GetStartZone(PlayerProfile_Struct* p_player_profile_struct, CharCreate_Struct* p_char_create_struct, bool is_titanium);
|
||||
bool GetStartZone(PlayerProfile_Struct* pp, CharCreate_Struct* p_char_create_struct, bool is_titanium);
|
||||
void GetCharSelectInfo(uint32 account_id, EQApplicationPacket **out_app, uint32 client_version_bit);
|
||||
int MoveCharacterToBind(int character_id, uint8 bind_number = 0);
|
||||
int MoveCharacterToInstanceSafeReturn(int character_id, int instance_zone_id, int instance_id);
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "../common/json/json.h"
|
||||
#include "../common/event_sub.h"
|
||||
#include "web_interface.h"
|
||||
#include "world_store.h"
|
||||
#include "../common/zone_store.h"
|
||||
|
||||
extern uint32 numzones;
|
||||
extern EQ::Random emu_random;
|
||||
|
||||
@@ -35,7 +35,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "adventure_manager.h"
|
||||
#include "ucs.h"
|
||||
#include "queryserv.h"
|
||||
#include "world_store.h"
|
||||
#include "../common/zone_store.h"
|
||||
#include "dynamic_zone.h"
|
||||
#include "dynamic_zone_manager.h"
|
||||
#include "expedition_message.h"
|
||||
@@ -1324,6 +1324,7 @@ void ZoneServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) {
|
||||
case ServerOP_ReloadVeteranRewards:
|
||||
case ServerOP_ReloadWorld:
|
||||
case ServerOP_ReloadZonePoints:
|
||||
case ServerOP_ReloadZoneData:
|
||||
case ServerOP_RezzPlayerAccept:
|
||||
case ServerOP_SpawnStatusChange:
|
||||
case ServerOP_UpdateSpawn:
|
||||
|
||||
Reference in New Issue
Block a user