mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +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:
@@ -84,6 +84,7 @@ SET(common_sources
|
||||
unix.cpp
|
||||
platform.cpp
|
||||
json/jsoncpp.cpp
|
||||
zone_store.cpp
|
||||
net/console_server.cpp
|
||||
net/console_server_connection.cpp
|
||||
net/crc32.cpp
|
||||
@@ -597,6 +598,7 @@ SET(common_headers
|
||||
useperl.h
|
||||
version.h
|
||||
zone_numbers.h
|
||||
zone_store.h
|
||||
event/event_loop.h
|
||||
event/task.h
|
||||
event/timer.h
|
||||
|
||||
+3
-103
@@ -51,6 +51,7 @@
|
||||
#include "http/uri.h"
|
||||
|
||||
#include "repositories/zone_repository.h"
|
||||
#include "zone_store.h"
|
||||
|
||||
extern Client client;
|
||||
|
||||
@@ -1018,97 +1019,6 @@ void Database::SetAccountCRCField(uint32 account_id, std::string field_name, uin
|
||||
);
|
||||
}
|
||||
|
||||
// Get zone starting points from DB
|
||||
bool Database::GetSafePoints(const char* zone_short_name, uint32 instance_version, float* safe_x, float* safe_y, float* safe_z, float* safe_heading, int16* min_status, uint8* min_level, char *flag_needed) {
|
||||
|
||||
if (zone_short_name == nullptr)
|
||||
return false;
|
||||
|
||||
std::string query = fmt::format(
|
||||
SQL(
|
||||
SELECT
|
||||
`safe_x`, `safe_y`, `safe_z`, `safe_heading`, `min_status`, `min_level`, `flag_needed`
|
||||
FROM
|
||||
zone
|
||||
WHERE
|
||||
`short_name` = '{}'
|
||||
AND
|
||||
(`version` = {} OR `version` = 0)
|
||||
ORDER BY `version` DESC
|
||||
), zone_short_name, instance_version
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return false;
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
if (safe_x != nullptr)
|
||||
*safe_x = atof(row[0]);
|
||||
|
||||
if (safe_y != nullptr)
|
||||
*safe_y = atof(row[1]);
|
||||
|
||||
if (safe_z != nullptr)
|
||||
*safe_z = atof(row[2]);
|
||||
|
||||
if (safe_heading != nullptr)
|
||||
*safe_heading = atof(row[3]);
|
||||
|
||||
if (min_status != nullptr)
|
||||
*min_status = atoi(row[4]);
|
||||
|
||||
if (min_level != nullptr)
|
||||
*min_level = atoi(row[5]);
|
||||
|
||||
if (flag_needed != nullptr)
|
||||
strcpy(flag_needed, row[6]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Database::GetZoneLongName(const char* short_name, char** long_name, char* file_name, float* safe_x, float* safe_y, float* safe_z, uint32* graveyard_id, uint32* maxclients) {
|
||||
|
||||
std::string query = StringFormat("SELECT long_name, file_name, safe_x, safe_y, safe_z, graveyard_id, maxclients FROM zone WHERE short_name='%s' AND version=0", short_name);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return false;
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
if (long_name != nullptr)
|
||||
*long_name = strcpy(new char[strlen(row[0])+1], row[0]);
|
||||
|
||||
if (file_name != nullptr) {
|
||||
if (row[1] == nullptr)
|
||||
strcpy(file_name, short_name);
|
||||
else
|
||||
strcpy(file_name, row[1]);
|
||||
}
|
||||
|
||||
if (safe_x != nullptr)
|
||||
*safe_x = atof(row[2]);
|
||||
if (safe_y != nullptr)
|
||||
*safe_y = atof(row[3]);
|
||||
if (safe_z != nullptr)
|
||||
*safe_z = atof(row[4]);
|
||||
if (graveyard_id != nullptr)
|
||||
*graveyard_id = atoi(row[5]);
|
||||
if (maxclients != nullptr)
|
||||
*maxclients = atoi(row[6]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Database::GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid, float* graveyard_x, float* graveyard_y, float* graveyard_z, float* graveyard_heading) {
|
||||
|
||||
std::string query = StringFormat("SELECT zone_id, x, y, z, heading FROM graveyard WHERE id=%i", graveyard_id);
|
||||
@@ -1138,20 +1048,10 @@ bool Database::GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zon
|
||||
}
|
||||
|
||||
uint8 Database::GetPEQZone(uint32 zone_id, uint32 version){
|
||||
std::string query = fmt::format(
|
||||
"SELECT peqzone FROM zone WHERE zoneidnumber = {} AND (version = {} OR version = 0) ORDER BY version DESC LIMIT 1",
|
||||
zone_id,
|
||||
version
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success() || !results.RowCount()) {
|
||||
return 0;
|
||||
}
|
||||
auto z = GetZoneVersionWithFallback(zone_id, version);
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
return static_cast<uint8>(std::stoi(row[0]));
|
||||
return z ? z->peqzone : 0;
|
||||
}
|
||||
|
||||
bool Database::CheckNameFilter(std::string name, bool surname)
|
||||
|
||||
@@ -246,9 +246,7 @@ public:
|
||||
|
||||
/* General Queries */
|
||||
|
||||
bool GetSafePoints(const char* zone_short_name, uint32 instance_version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, float* safe_heading = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr);
|
||||
bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0);
|
||||
bool GetZoneLongName(const char* short_name, char** long_name, char* file_name = 0, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, uint32* graveyard_id = 0, uint32* maxclients = 0);
|
||||
bool LoadPTimers(uint32 charid, PTimerList &into);
|
||||
|
||||
uint8 GetPEQZone(uint32 zone_id, uint32 version);
|
||||
|
||||
+11
-11
@@ -374,18 +374,18 @@ struct NewZone_Struct {
|
||||
/*0684*/ uint16 zone_id;
|
||||
/*0686*/ uint16 zone_instance;
|
||||
/*0688*/ uint32 unknown688;
|
||||
/*0692*/ uint8 unknown692[8];
|
||||
/*0692*/ uint8 unknown692[8];
|
||||
// Titanium doesn't have a translator, but we can still safely add stuff under here without issues since client memcpy's only what it knows
|
||||
// Just wastes some bandwidth sending to tit clients /shrug
|
||||
/*0700*/ float fog_density;
|
||||
/*0704*/ uint32 SuspendBuffs;
|
||||
/*0708*/ uint32 FastRegenHP;
|
||||
/*0712*/ uint32 FastRegenMana;
|
||||
/*0716*/ uint32 FastRegenEndurance;
|
||||
/*0720*/ uint32 NPCAggroMaxDist;
|
||||
/*0724*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, if this value is 0, it prevents you from running off edges that would end up underworld
|
||||
/*0728*/ uint32 LavaDamage; // Seen 50
|
||||
/*0732*/ uint32 MinLavaDamage; // Seen 10
|
||||
/*0700*/ float fog_density;
|
||||
/*0704*/ uint32 suspend_buffs;
|
||||
/*0708*/ uint32 fast_regen_hp;
|
||||
/*0712*/ uint32 fast_regen_mana;
|
||||
/*0716*/ uint32 fast_regen_endurance;
|
||||
/*0720*/ uint32 npc_aggro_max_dist;
|
||||
/*0724*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, if this value is 0, it prevents you from running off edges that would end up underworld
|
||||
/*0728*/ uint32 lava_damage; // Seen 50
|
||||
/*0732*/ uint32 min_lava_damage; // Seen 10
|
||||
/*0736*/
|
||||
};
|
||||
|
||||
@@ -3642,7 +3642,7 @@ struct MerchantList {
|
||||
uint8 probability;
|
||||
std::string bucket_name;
|
||||
std::string bucket_value;
|
||||
uint8 bucket_comparison;
|
||||
uint8 bucket_comparison;
|
||||
};
|
||||
|
||||
struct TempMerchantList {
|
||||
|
||||
@@ -1814,10 +1814,10 @@ namespace RoF
|
||||
OUT_str(zone_short_name2);
|
||||
OUT(zone_id);
|
||||
OUT(zone_instance);
|
||||
OUT(SuspendBuffs);
|
||||
OUT(FastRegenHP);
|
||||
OUT(FastRegenMana);
|
||||
OUT(FastRegenEndurance);
|
||||
OUT(suspend_buffs);
|
||||
OUT(fast_regen_hp);
|
||||
OUT(fast_regen_mana);
|
||||
OUT(fast_regen_endurance);
|
||||
OUT(underworld_teleport_index);
|
||||
|
||||
eq->FogDensity = emu->fog_density;
|
||||
@@ -1825,8 +1825,8 @@ namespace RoF
|
||||
/*fill in some unknowns with observed values, hopefully it will help */
|
||||
eq->unknown800 = -1;
|
||||
eq->unknown844 = 600;
|
||||
OUT(LavaDamage);
|
||||
OUT(MinLavaDamage);
|
||||
OUT(lava_damage);
|
||||
OUT(min_lava_damage);
|
||||
eq->unknown888 = 1;
|
||||
eq->unknown889 = 0;
|
||||
eq->unknown890 = 1;
|
||||
|
||||
+21
-21
@@ -1863,13 +1863,13 @@ namespace RoF2
|
||||
OUT_str(zone_short_name2);
|
||||
OUT(zone_id);
|
||||
OUT(zone_instance);
|
||||
OUT(SuspendBuffs);
|
||||
OUT(FastRegenHP);
|
||||
OUT(FastRegenMana);
|
||||
OUT(FastRegenEndurance);
|
||||
OUT(suspend_buffs);
|
||||
OUT(fast_regen_hp);
|
||||
OUT(fast_regen_mana);
|
||||
OUT(fast_regen_endurance);
|
||||
OUT(underworld_teleport_index);
|
||||
|
||||
eq->FogDensity = emu->fog_density;
|
||||
eq->fog_density = emu->fog_density;
|
||||
|
||||
/*fill in some unknowns with observed values, hopefully it will help */
|
||||
eq->ZoneTimeZone = 0;
|
||||
@@ -1881,22 +1881,22 @@ namespace RoF2
|
||||
eq->SkyRelated2 = -1;
|
||||
eq->NPCAggroMaxDist = 600;
|
||||
eq->FilterID = 2008; // Guild Lobby observed value
|
||||
OUT(LavaDamage);
|
||||
OUT(MinLavaDamage);
|
||||
eq->bDisallowManaStone = 1;
|
||||
eq->bNoBind = 0;
|
||||
eq->bNoAttack = 0;
|
||||
eq->bNoCallOfHero = 0;
|
||||
eq->bNoFlux = 0;
|
||||
eq->bNoFear = 0;
|
||||
eq->fall_damage = 0; // 0 = Fall Damage on, 1 = Fall Damage off
|
||||
eq->unknown895 = 0;
|
||||
eq->CanPlaceCampsite = 2;
|
||||
eq->CanPlaceGuildBanner = 2;
|
||||
eq->FishingRelated = -1; // Set from PoK Example
|
||||
eq->ForageRelated = -1; // Set from PoK Example
|
||||
eq->bNoLevitate = 0;
|
||||
eq->Blooming = 1.0; // Set from PoK Example
|
||||
OUT(lava_damage);
|
||||
OUT(min_lava_damage);
|
||||
eq->bDisallowManaStone = 1;
|
||||
eq->bNoBind = 0;
|
||||
eq->bNoAttack = 0;
|
||||
eq->bNoCallOfHero = 0;
|
||||
eq->bNoFlux = 0;
|
||||
eq->bNoFear = 0;
|
||||
eq->fall_damage = 0; // 0 = Fall Damage on, 1 = Fall Damage off
|
||||
eq->unknown895 = 0;
|
||||
eq->can_place_campsite = 2;
|
||||
eq->can_place_guild_banner = 2;
|
||||
eq->fishing_related = -1; // Set from PoK Example
|
||||
eq->forage_related = -1; // Set from PoK Example
|
||||
eq->b_no_levitate = 0;
|
||||
eq->blooming = 1.0; // Set from PoK Example
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -620,40 +620,40 @@ struct NewZone_Struct {
|
||||
/*0800*/ int32 SkyRelated2; //seen -1 -- maybe some default sky time?
|
||||
/*0804*/ char WeatherString2[32]; //
|
||||
/*0836*/ float WeatherChangeTime; // not sure :P
|
||||
/*0840*/ uint32 Climate;
|
||||
/*0844*/ int32 NPCAggroMaxDist; //seen 600
|
||||
/*0848*/ int32 FilterID; //seen 2008 -- maybe zone guide related?
|
||||
/*0852*/ uint16 zone_id; // this might just be instance ID got 1736 for time
|
||||
/*0854*/ uint16 zone_instance;
|
||||
/*0856*/ uint32 scriptNPCReceivedanItem;
|
||||
/*0860*/ uint32 bCheck; // padded bool
|
||||
/*0864*/ uint32 scriptIDSomething;
|
||||
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
||||
/*0872*/ uint32 scriptIDSomething3;
|
||||
/*0876*/ uint32 SuspendBuffs; // padded bool
|
||||
/*0880*/ uint32 LavaDamage; // LavaDamage value
|
||||
/*0884*/ uint32 MinLavaDamage; // min cap after resist calcs
|
||||
/*0888*/ uint8 bDisallowManaStone; // can't use manastone in this zone
|
||||
/*0889*/ uint8 bNoBind; // can't bind even if outdoor says we can!
|
||||
/*0890*/ uint8 bNoAttack; // non-attack zone
|
||||
/*0891*/ uint8 bNoCallOfHero; // coth line disabled
|
||||
/*0892*/ uint8 bNoFlux; // gflux no worky
|
||||
/*0893*/ uint8 bNoFear; // fear spells no worky
|
||||
/*0894*/ uint8 fall_damage; // 0 = Fall Damage on, 1 = Fall Damage off MQ2 calls bNoEncumber
|
||||
/*0895*/ uint8 unknown895; // padding
|
||||
/*0896*/ uint32 FastRegenHP; // percentage I think?
|
||||
/*0900*/ uint32 FastRegenMana; // percentage I think?
|
||||
/*0904*/ uint32 FastRegenEndurance; // percentage I think?
|
||||
/*0908*/ uint32 CanPlaceCampsite; // 0 = no, 1 = can place, 2 = place and goto
|
||||
/*0912*/ uint32 CanPlaceGuildBanner; // ^
|
||||
/*0916*/ float FogDensity; // Most zones have this set to 0.33 Blightfire had 0.16
|
||||
/*0920*/ uint32 bAdjustGamma; // padded bool
|
||||
/*0924*/ uint32 TimeStringID; // Seen 0
|
||||
/*0928*/ uint32 bNoMercenaries; // padded bool
|
||||
/*0932*/ int32 FishingRelated; // Seen -1 idk
|
||||
/*0936*/ int32 ForageRelated; // Seen -1 idk
|
||||
/*0940*/ uint32 bNoLevitate; // padded bool
|
||||
/*0944*/ float Blooming; // Seen 1.0 in PoK, and 0.25 in Guild Lobby
|
||||
/*0840*/ uint32 Climate;
|
||||
/*0844*/ int32 NPCAggroMaxDist; //seen 600
|
||||
/*0848*/ int32 FilterID; //seen 2008 -- maybe zone guide related?
|
||||
/*0852*/ uint16 zone_id; // this might just be instance ID got 1736 for time
|
||||
/*0854*/ uint16 zone_instance;
|
||||
/*0856*/ uint32 scriptNPCReceivedanItem;
|
||||
/*0860*/ uint32 bCheck; // padded bool
|
||||
/*0864*/ uint32 scriptIDSomething;
|
||||
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
||||
/*0872*/ uint32 scriptIDSomething3;
|
||||
/*0876*/ uint32 suspend_buffs; // padded bool
|
||||
/*0880*/ uint32 lava_damage; // lava_damage value
|
||||
/*0884*/ uint32 min_lava_damage; // min cap after resist calcs
|
||||
/*0888*/ uint8 bDisallowManaStone; // can't use manastone in this zone
|
||||
/*0889*/ uint8 bNoBind; // can't bind even if outdoor says we can!
|
||||
/*0890*/ uint8 bNoAttack; // non-attack zone
|
||||
/*0891*/ uint8 bNoCallOfHero; // coth line disabled
|
||||
/*0892*/ uint8 bNoFlux; // gflux no worky
|
||||
/*0893*/ uint8 bNoFear; // fear spells no worky
|
||||
/*0894*/ uint8 fall_damage; // 0 = Fall Damage on, 1 = Fall Damage off MQ2 calls bNoEncumber
|
||||
/*0895*/ uint8 unknown895; // padding
|
||||
/*0896*/ uint32 fast_regen_hp; // percentage I think?
|
||||
/*0900*/ uint32 fast_regen_mana; // percentage I think?
|
||||
/*0904*/ uint32 fast_regen_endurance; // percentage I think?
|
||||
/*0908*/ uint32 can_place_campsite; // 0 = no, 1 = can place, 2 = place and goto
|
||||
/*0912*/ uint32 can_place_guild_banner; // ^
|
||||
/*0916*/ float fog_density; // Most zones have this set to 0.33 Blightfire had 0.16
|
||||
/*0920*/ uint32 b_adjust_gamma; // padded bool
|
||||
/*0924*/ uint32 time_string_id; // Seen 0
|
||||
/*0928*/ uint32 b_no_mercenaries; // padded bool
|
||||
/*0932*/ int32 fishing_related; // Seen -1 idk
|
||||
/*0936*/ int32 forage_related; // Seen -1 idk
|
||||
/*0940*/ uint32 b_no_levitate; // padded bool
|
||||
/*0944*/ float blooming; // Seen 1.0 in PoK, and 0.25 in Guild Lobby
|
||||
/*0948*/
|
||||
};
|
||||
|
||||
@@ -3476,7 +3476,7 @@ struct TraderClick_Struct{
|
||||
/*000*/ uint32 Code;
|
||||
/*004*/ uint32 TraderID;
|
||||
/*008*/ uint32 Approval;
|
||||
/*012*/
|
||||
/*012*/
|
||||
};
|
||||
|
||||
struct FormattedMessage_Struct{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -571,39 +571,39 @@ struct NewZone_Struct {
|
||||
/*0704*/ char zone_short_name2[96]; //zone file name? excludes instance number which can be in previous version.
|
||||
/*0800*/ int32 unknown800; //seen -1
|
||||
/*0804*/ char unknown804[40]; //
|
||||
/*0844*/ int32 unknown844; //seen 600
|
||||
/*0848*/ int32 unknown848;
|
||||
/*0852*/ uint16 zone_id;
|
||||
/*0854*/ uint16 zone_instance;
|
||||
/*0856*/ uint32 scriptNPCReceivedanItem;
|
||||
/*0860*/ uint32 bCheck; // padded bool
|
||||
/*0864*/ uint32 scriptIDSomething;
|
||||
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
||||
/*0872*/ uint32 scriptIDSomething3;
|
||||
/*0876*/ uint32 SuspendBuffs;
|
||||
/*0880*/ uint32 LavaDamage; // Seen 50
|
||||
/*0884*/ uint32 MinLavaDamage; // Seen 10
|
||||
/*0888*/ uint8 unknown888; // Seen 1
|
||||
/*0889*/ uint8 unknown889; // Seen 0 (POK) or 1 (rujj)
|
||||
/*0890*/ uint8 unknown890; // Seen 1
|
||||
/*0891*/ uint8 unknown891; // Seen 0
|
||||
/*0892*/ uint8 unknown892; // Seen 0
|
||||
/*0893*/ uint8 unknown893; // Seen 0 - 00
|
||||
/*0894*/ uint8 fall_damage; // 0 = Fall Damage on, 1 = Fall Damage off
|
||||
/*0895*/ uint8 unknown895; // Seen 0 - 00
|
||||
/*0896*/ uint32 FastRegenHP; // Seen 180
|
||||
/*0900*/ uint32 FastRegenMana; // Seen 180
|
||||
/*0904*/ uint32 FastRegenEndurance; // Seen 180
|
||||
/*0908*/ uint32 unknown908; // Seen 2
|
||||
/*0912*/ uint32 unknown912; // Seen 2
|
||||
/*0916*/ float FogDensity; // Most zones have this set to 0.33 Blightfire had 0.16
|
||||
/*0920*/ uint32 unknown920; // Seen 0
|
||||
/*0924*/ uint32 unknown924; // Seen 0
|
||||
/*0928*/ uint32 unknown928; // Seen 0
|
||||
/*0844*/ int32 unknown844; //seen 600
|
||||
/*0848*/ int32 unknown848;
|
||||
/*0852*/ uint16 zone_id;
|
||||
/*0854*/ uint16 zone_instance;
|
||||
/*0856*/ uint32 scriptNPCReceivedanItem;
|
||||
/*0860*/ uint32 bCheck; // padded bool
|
||||
/*0864*/ uint32 scriptIDSomething;
|
||||
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
||||
/*0872*/ uint32 scriptIDSomething3;
|
||||
/*0876*/ uint32 suspend_buffs;
|
||||
/*0880*/ uint32 lava_damage; // Seen 50
|
||||
/*0884*/ uint32 min_lava_damage; // Seen 10
|
||||
/*0888*/ uint8 unknown888; // Seen 1
|
||||
/*0889*/ uint8 unknown889; // Seen 0 (POK) or 1 (rujj)
|
||||
/*0890*/ uint8 unknown890; // Seen 1
|
||||
/*0891*/ uint8 unknown891; // Seen 0
|
||||
/*0892*/ uint8 unknown892; // Seen 0
|
||||
/*0893*/ uint8 unknown893; // Seen 0 - 00
|
||||
/*0894*/ uint8 fall_damage; // 0 = Fall Damage on, 1 = Fall Damage off
|
||||
/*0895*/ uint8 unknown895; // Seen 0 - 00
|
||||
/*0896*/ uint32 fast_regen_hp; // Seen 180
|
||||
/*0900*/ uint32 fast_regen_mana; // Seen 180
|
||||
/*0904*/ uint32 fast_regen_endurance; // Seen 180
|
||||
/*0908*/ uint32 unknown908; // Seen 2
|
||||
/*0912*/ uint32 unknown912; // Seen 2
|
||||
/*0916*/ float FogDensity; // Most zones have this set to 0.33 Blightfire had 0.16
|
||||
/*0920*/ uint32 unknown920; // Seen 0
|
||||
/*0924*/ uint32 unknown924; // Seen 0
|
||||
/*0928*/ uint32 unknown928; // Seen 0
|
||||
/*0932*/ int32 unknown932; // Seen -1
|
||||
/*0936*/ int32 unknown936; // Seen -1
|
||||
/*0940*/ uint32 unknown940; // Seen 0
|
||||
/*0944*/ float unknown944; // Seen 1.0
|
||||
/*0940*/ uint32 unknown940; // Seen 0
|
||||
/*0944*/ float unknown944; // Seen 1.0
|
||||
/*0948*/
|
||||
};
|
||||
|
||||
|
||||
@@ -1341,17 +1341,17 @@ namespace SoD
|
||||
OUT_str(zone_short_name2);
|
||||
OUT(zone_id);
|
||||
OUT(zone_instance);
|
||||
OUT(SuspendBuffs);
|
||||
OUT(FastRegenHP);
|
||||
OUT(FastRegenMana);
|
||||
OUT(FastRegenEndurance);
|
||||
OUT(suspend_buffs);
|
||||
OUT(fast_regen_hp);
|
||||
OUT(fast_regen_mana);
|
||||
OUT(fast_regen_endurance);
|
||||
OUT(underworld_teleport_index);
|
||||
|
||||
/*fill in some unknowns with observed values, hopefully it will help */
|
||||
eq->unknown800 = -1;
|
||||
eq->unknown844 = 600;
|
||||
OUT(LavaDamage);
|
||||
OUT(MinLavaDamage);
|
||||
OUT(lava_damage);
|
||||
OUT(min_lava_damage);
|
||||
eq->unknown888 = 1;
|
||||
eq->unknown889 = 0;
|
||||
eq->unknown890 = 1;
|
||||
@@ -1361,8 +1361,8 @@ namespace SoD
|
||||
eq->fall_damage = 0; // 0 = Fall Damage on, 1 = Fall Damage off
|
||||
eq->unknown895 = 0;
|
||||
eq->unknown908 = 2;
|
||||
eq->unknown912 = 2;
|
||||
eq->FogDensity = emu->fog_density;
|
||||
eq->unknown912 = 2;
|
||||
eq->fog_density = emu->fog_density;
|
||||
|
||||
FINISH_ENCODE();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -440,35 +440,35 @@ struct NewZone_Struct {
|
||||
/*0704*/ char zone_short_name2[96]; //zone file name? excludes instance number which can be in previous version.
|
||||
/*0800*/ int32 unknown800; //seen -1
|
||||
/*0804*/ char unknown804[40]; //
|
||||
/*0844*/ int32 unknown844; //seen 600
|
||||
/*0848*/ int32 unknown848;
|
||||
/*0852*/ uint16 zone_id;
|
||||
/*0854*/ uint16 zone_instance;
|
||||
/*0856*/ uint32 scriptNPCReceivedanItem;
|
||||
/*0860*/ uint32 bCheck; // padded bool
|
||||
/*0864*/ uint32 scriptIDSomething;
|
||||
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
||||
/*0872*/ uint32 scriptIDSomething3;
|
||||
/*0876*/ uint32 SuspendBuffs;
|
||||
/*0880*/ uint32 LavaDamage; //seen 50
|
||||
/*0884*/ uint32 MinLavaDamage; //seen 10
|
||||
/*0888*/ uint8 unknown888; //seen 1
|
||||
/*0889*/ uint8 unknown889; //seen 0 (POK) or 1 (rujj)
|
||||
/*0890*/ uint8 unknown890; //seen 1
|
||||
/*0891*/ uint8 unknown891; //seen 0
|
||||
/*0892*/ uint8 unknown892; //seen 0
|
||||
/*0893*/ uint8 unknown893; //seen 0 - 00
|
||||
/*0894*/ uint8 fall_damage; // 0 = Fall Damage on, 1 = Fall Damage off
|
||||
/*0895*/ uint8 unknown895; //seen 0 - 00
|
||||
/*0896*/ uint32 FastRegenHP; //seen 180
|
||||
/*0900*/ uint32 FastRegenMana; //seen 180
|
||||
/*0904*/ uint32 FastRegenEndurance; //seen 180
|
||||
/*0908*/ uint32 unknown908; //seen 2
|
||||
/*0912*/ uint32 unknown912; //seen 2
|
||||
/*0916*/ float FogDensity; //Of about 10 or so zones tested, all but one have this set to 0.33 Blightfire had 0.16
|
||||
/*0920*/ uint32 unknown920; //seen 0
|
||||
/*0924*/ uint32 unknown924; //seen 0
|
||||
/*0928*/ uint32 unknown928; //seen 0
|
||||
/*0844*/ int32 unknown844; //seen 600
|
||||
/*0848*/ int32 unknown848;
|
||||
/*0852*/ uint16 zone_id;
|
||||
/*0854*/ uint16 zone_instance;
|
||||
/*0856*/ uint32 scriptNPCReceivedanItem;
|
||||
/*0860*/ uint32 bCheck; // padded bool
|
||||
/*0864*/ uint32 scriptIDSomething;
|
||||
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
||||
/*0872*/ uint32 scriptIDSomething3;
|
||||
/*0876*/ uint32 suspend_buffs;
|
||||
/*0880*/ uint32 lava_damage; //seen 50
|
||||
/*0884*/ uint32 min_lava_damage; //seen 10
|
||||
/*0888*/ uint8 unknown888; //seen 1
|
||||
/*0889*/ uint8 unknown889; //seen 0 (POK) or 1 (rujj)
|
||||
/*0890*/ uint8 unknown890; //seen 1
|
||||
/*0891*/ uint8 unknown891; //seen 0
|
||||
/*0892*/ uint8 unknown892; //seen 0
|
||||
/*0893*/ uint8 unknown893; //seen 0 - 00
|
||||
/*0894*/ uint8 fall_damage; // 0 = Fall Damage on, 1 = Fall Damage off
|
||||
/*0895*/ uint8 unknown895; //seen 0 - 00
|
||||
/*0896*/ uint32 fast_regen_hp; //seen 180
|
||||
/*0900*/ uint32 fast_regen_mana; //seen 180
|
||||
/*0904*/ uint32 fast_regen_endurance; //seen 180
|
||||
/*0908*/ uint32 unknown908; //seen 2
|
||||
/*0912*/ uint32 unknown912; //seen 2
|
||||
/*0916*/ float fog_density; //Of about 10 or so zones tested, all but one have this set to 0.33 Blightfire had 0.16
|
||||
/*0920*/ uint32 unknown920; //seen 0
|
||||
/*0924*/ uint32 unknown924; //seen 0
|
||||
/*0928*/ uint32 unknown928; //seen 0
|
||||
/*0932*/
|
||||
};
|
||||
|
||||
|
||||
@@ -1019,17 +1019,17 @@ namespace SoF
|
||||
OUT_str(zone_short_name2);
|
||||
OUT(zone_id);
|
||||
OUT(zone_instance);
|
||||
OUT(SuspendBuffs);
|
||||
OUT(FastRegenHP);
|
||||
OUT(FastRegenMana);
|
||||
OUT(FastRegenEndurance);
|
||||
OUT(suspend_buffs);
|
||||
OUT(fast_regen_hp);
|
||||
OUT(fast_regen_mana);
|
||||
OUT(fast_regen_endurance);
|
||||
OUT(underworld_teleport_index);
|
||||
|
||||
/*fill in some unknowns with observed values, hopefully it will help */
|
||||
eq->unknown796 = -1;
|
||||
eq->unknown840 = 600;
|
||||
OUT(LavaDamage);
|
||||
OUT(MinLavaDamage);
|
||||
OUT(lava_damage);
|
||||
OUT(min_lava_damage);
|
||||
eq->unknown884 = 1;
|
||||
eq->unknown885 = 0;
|
||||
eq->unknown886 = 1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -444,31 +444,31 @@ struct NewZone_Struct {
|
||||
/*0700*/ char zone_short_name2[96]; //zone file name? excludes instance number which can be in previous version.
|
||||
/*0796*/ int32 unknown796; //seen -1
|
||||
/*0800*/ char unknown800[40]; //
|
||||
/*0840*/ int32 unknown840; //seen 600
|
||||
/*0844*/ int32 unknown844;
|
||||
/*0848*/ uint16 zone_id;
|
||||
/*0850*/ uint16 zone_instance;
|
||||
/*0852*/ uint32 scriptNPCReceivedanItem;
|
||||
/*0856*/ uint32 bCheck; // padded bool
|
||||
/*0860*/ uint32 scriptIDSomething;
|
||||
/*0864*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
||||
/*0868*/ uint32 scriptIDSomething3;
|
||||
/*0872*/ uint32 SuspendBuffs;
|
||||
/*0876*/ uint32 LavaDamage; //seen 50
|
||||
/*0880*/ uint32 MinLavaDamage; //seen 10
|
||||
/*0884*/ uint8 unknown884; //seen 1
|
||||
/*0885*/ uint8 unknown885; //seen 0 (POK) or 1 (rujj)
|
||||
/*0886*/ uint8 unknown886; //seen 1
|
||||
/*0887*/ uint8 unknown887; //seen 0
|
||||
/*0888*/ uint8 unknown888; //seen 0
|
||||
/*0893*/ uint8 unknown889; //seen 0 - 00
|
||||
/*0894*/ uint8 fall_damage; // 0 = Fall Damage on, 1 = Fall Damage off
|
||||
/*0895*/ uint8 unknown891; //seen 0 - 00
|
||||
/*0892*/ uint32 FastRegenHP; //seen 180
|
||||
/*0896*/ uint32 FastRegenMana; //seen 180
|
||||
/*0900*/ uint32 FastRegenEndurance; //seen 180
|
||||
/*0904*/ uint32 unknown904; //seen 2
|
||||
/*0908*/ uint32 unknown908; //seen 2
|
||||
/*0840*/ int32 unknown840; //seen 600
|
||||
/*0844*/ int32 unknown844;
|
||||
/*0848*/ uint16 zone_id;
|
||||
/*0850*/ uint16 zone_instance;
|
||||
/*0852*/ uint32 scriptNPCReceivedanItem;
|
||||
/*0856*/ uint32 bCheck; // padded bool
|
||||
/*0860*/ uint32 scriptIDSomething;
|
||||
/*0864*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
||||
/*0868*/ uint32 scriptIDSomething3;
|
||||
/*0872*/ uint32 suspend_buffs;
|
||||
/*0876*/ uint32 lava_damage; //seen 50
|
||||
/*0880*/ uint32 min_lava_damage; //seen 10
|
||||
/*0884*/ uint8 unknown884; //seen 1
|
||||
/*0885*/ uint8 unknown885; //seen 0 (POK) or 1 (rujj)
|
||||
/*0886*/ uint8 unknown886; //seen 1
|
||||
/*0887*/ uint8 unknown887; //seen 0
|
||||
/*0888*/ uint8 unknown888; //seen 0
|
||||
/*0893*/ uint8 unknown889; //seen 0 - 00
|
||||
/*0894*/ uint8 fall_damage; // 0 = Fall Damage on, 1 = Fall Damage off
|
||||
/*0895*/ uint8 unknown891; //seen 0 - 00
|
||||
/*0892*/ uint32 fast_regen_hp; //seen 180
|
||||
/*0896*/ uint32 fast_regen_mana; //seen 180
|
||||
/*0900*/ uint32 fast_regen_endurance; //seen 180
|
||||
/*0904*/ uint32 unknown904; //seen 2
|
||||
/*0908*/ uint32 unknown908; //seen 2
|
||||
/*0912*/
|
||||
};
|
||||
|
||||
|
||||
@@ -1565,19 +1565,19 @@ namespace UF
|
||||
OUT_str(zone_short_name2);
|
||||
OUT(zone_id);
|
||||
OUT(zone_instance);
|
||||
OUT(SuspendBuffs);
|
||||
OUT(FastRegenHP);
|
||||
OUT(FastRegenMana);
|
||||
OUT(FastRegenEndurance);
|
||||
OUT(suspend_buffs);
|
||||
OUT(fast_regen_hp);
|
||||
OUT(fast_regen_mana);
|
||||
OUT(fast_regen_endurance);
|
||||
OUT(underworld_teleport_index);
|
||||
|
||||
eq->FogDensity = emu->fog_density;
|
||||
eq->fog_density = emu->fog_density;
|
||||
|
||||
/*fill in some unknowns with observed values, hopefully it will help */
|
||||
eq->unknown800 = -1;
|
||||
eq->unknown844 = 600;
|
||||
OUT(LavaDamage);
|
||||
OUT(MinLavaDamage);
|
||||
OUT(lava_damage);
|
||||
OUT(min_lava_damage);
|
||||
eq->unknown888 = 1;
|
||||
eq->unknown889 = 0;
|
||||
eq->unknown890 = 1;
|
||||
|
||||
+31
-31
@@ -1,5 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -440,35 +440,35 @@ struct NewZone_Struct {
|
||||
/*0704*/ char zone_short_name2[96]; //zone file name? excludes instance number which can be in previous version.
|
||||
/*0800*/ int32 unknown800; //seen -1
|
||||
/*0804*/ char unknown804[40]; //
|
||||
/*0844*/ int32 unknown844; //seen 600
|
||||
/*0848*/ int32 unknown848;
|
||||
/*0852*/ uint16 zone_id;
|
||||
/*0854*/ uint16 zone_instance;
|
||||
/*0856*/ uint32 scriptNPCReceivedanItem;
|
||||
/*0860*/ uint32 bCheck; // padded bool
|
||||
/*0864*/ uint32 scriptIDSomething;
|
||||
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
||||
/*0872*/ uint32 scriptIDSomething3;
|
||||
/*0876*/ uint32 SuspendBuffs;
|
||||
/*0880*/ uint32 LavaDamage; //seen 50
|
||||
/*0884*/ uint32 MinLavaDamage; //seen 10
|
||||
/*0888*/ uint8 unknown888; //seen 1
|
||||
/*0889*/ uint8 unknown889; //seen 0 (POK) or 1 (rujj)
|
||||
/*0890*/ uint8 unknown890; //seen 1
|
||||
/*0891*/ uint8 unknown891; //seen 0
|
||||
/*0892*/ uint8 unknown892; //seen 0
|
||||
/*0893*/ uint8 unknown893; //seen 0 - 00
|
||||
/*0894*/ uint8 fall_damage; // 0 = Fall Damage on, 1 = Fall Damage off
|
||||
/*0895*/ uint8 unknown895; //seen 0 - 00
|
||||
/*0896*/ uint32 FastRegenHP; //seen 180
|
||||
/*0900*/ uint32 FastRegenMana; //seen 180
|
||||
/*0904*/ uint32 FastRegenEndurance; //seen 180
|
||||
/*0908*/ uint32 unknown908; //seen 2
|
||||
/*0912*/ uint32 unknown912; //seen 2
|
||||
/*0916*/ float FogDensity; //Of about 10 or so zones tested, all but one have this set to 0.33 Blightfire had 0.16
|
||||
/*0920*/ uint32 unknown920; //seen 0
|
||||
/*0924*/ uint32 unknown924; //seen 0
|
||||
/*0928*/ uint32 unknown928; //seen 0
|
||||
/*0844*/ int32 unknown844; //seen 600
|
||||
/*0848*/ int32 unknown848;
|
||||
/*0852*/ uint16 zone_id;
|
||||
/*0854*/ uint16 zone_instance;
|
||||
/*0856*/ uint32 scriptNPCReceivedanItem;
|
||||
/*0860*/ uint32 bCheck; // padded bool
|
||||
/*0864*/ uint32 scriptIDSomething;
|
||||
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
|
||||
/*0872*/ uint32 scriptIDSomething3;
|
||||
/*0876*/ uint32 suspend_buffs;
|
||||
/*0880*/ uint32 lava_damage; //seen 50
|
||||
/*0884*/ uint32 min_lava_damage; //seen 10
|
||||
/*0888*/ uint8 unknown888; //seen 1
|
||||
/*0889*/ uint8 unknown889; //seen 0 (POK) or 1 (rujj)
|
||||
/*0890*/ uint8 unknown890; //seen 1
|
||||
/*0891*/ uint8 unknown891; //seen 0
|
||||
/*0892*/ uint8 unknown892; //seen 0
|
||||
/*0893*/ uint8 unknown893; //seen 0 - 00
|
||||
/*0894*/ uint8 fall_damage; // 0 = Fall Damage on, 1 = Fall Damage off
|
||||
/*0895*/ uint8 unknown895; //seen 0 - 00
|
||||
/*0896*/ uint32 fast_regen_hp; //seen 180
|
||||
/*0900*/ uint32 fast_regen_mana; //seen 180
|
||||
/*0904*/ uint32 fast_regen_endurance; //seen 180
|
||||
/*0908*/ uint32 unknown908; //seen 2
|
||||
/*0912*/ uint32 unknown912; //seen 2
|
||||
/*0916*/ float fog_density; //Of about 10 or so zones tested, all but one have this set to 0.33 Blightfire had 0.16
|
||||
/*0920*/ uint32 unknown920; //seen 0
|
||||
/*0924*/ uint32 unknown924; //seen 0
|
||||
/*0928*/ uint32 unknown928; //seen 0
|
||||
/*0932*/ uint8 unknown932[12];
|
||||
};
|
||||
|
||||
@@ -3997,7 +3997,7 @@ struct ItemSerializationHeaderFinish
|
||||
{
|
||||
uint16 ornamentIcon;
|
||||
/*060*/ uint8 unknown060; //0
|
||||
/*061*/ uint8 unknown061; //0 -
|
||||
/*061*/ uint8 unknown061; //0 -
|
||||
/*062*/ uint8 isCopied; // New to Underfoot // Copied flag on item
|
||||
/*063*/ uint8 ItemClass; //0, 1, or 2
|
||||
};
|
||||
|
||||
@@ -246,6 +246,7 @@
|
||||
#define ServerOP_ReloadWorld 0x4120
|
||||
#define ServerOP_ReloadZonePoints 0x4121
|
||||
#define ServerOP_ReloadDzTemplates 0x4122
|
||||
#define ServerOP_ReloadZoneData 0x4123
|
||||
|
||||
#define ServerOP_CZDialogueWindow 0x4500
|
||||
#define ServerOP_CZLDoNUpdate 0x4501
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
/**
|
||||
* 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 "zone_store.h"
|
||||
#include "../common/content/world_content_service.h"
|
||||
|
||||
ZoneStore::ZoneStore() = default;
|
||||
ZoneStore::~ZoneStore() = default;
|
||||
|
||||
// cache record of zones for fast successive retrieval
|
||||
void ZoneStore::LoadZones(Database &db)
|
||||
{
|
||||
m_zones = ZoneRepository::All(db);
|
||||
|
||||
LogInfo("[ZoneStore] Loaded [{}] zones", m_zones.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param in_zone_name
|
||||
* @return
|
||||
*/
|
||||
uint32 ZoneStore::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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param zone_name
|
||||
* @return
|
||||
*/
|
||||
uint32 ZoneStore::GetZoneID(std::string zone_name)
|
||||
{
|
||||
for (auto &z: m_zones) {
|
||||
if (z.short_name == zone_name) {
|
||||
return z.zoneidnumber;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param zone_id
|
||||
* @param error_unknown
|
||||
* @return
|
||||
*/
|
||||
const char *ZoneStore::GetZoneName(uint32 zone_id, bool error_unknown)
|
||||
{
|
||||
for (auto &z: m_zones) {
|
||||
if (z.zoneidnumber == zone_id) {
|
||||
return z.short_name.c_str();
|
||||
}
|
||||
}
|
||||
|
||||
if (error_unknown) {
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param zone_id
|
||||
* @param error_unknown
|
||||
* @return
|
||||
*/
|
||||
const char *ZoneStore::GetZoneLongName(uint32 zone_id, bool error_unknown)
|
||||
{
|
||||
for (auto &z: m_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 ZoneStore::GetZoneName(uint32 zone_id)
|
||||
{
|
||||
for (auto &z: m_zones) {
|
||||
if (z.zoneidnumber == zone_id) {
|
||||
return z.short_name;
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param zone_id
|
||||
* @return
|
||||
*/
|
||||
std::string ZoneStore::GetZoneLongName(uint32 zone_id)
|
||||
{
|
||||
for (auto &z: m_zones) {
|
||||
if (z.zoneidnumber == zone_id) {
|
||||
return z.long_name;
|
||||
}
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param zone_id
|
||||
* @param version
|
||||
* @return
|
||||
*/
|
||||
ZoneRepository::Zone *ZoneStore::GetZone(uint32 zone_id, int version)
|
||||
{
|
||||
for (auto &z: m_zones) {
|
||||
if (z.zoneidnumber == zone_id && z.version == version) {
|
||||
return &z;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param in_zone_name
|
||||
* @return
|
||||
*/
|
||||
ZoneRepository::Zone *ZoneStore::GetZone(const char *in_zone_name)
|
||||
{
|
||||
for (auto &z: m_zones) {
|
||||
if (z.short_name == in_zone_name) {
|
||||
return &z;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const std::vector<ZoneRepository::Zone> &ZoneStore::GetZones() const
|
||||
{
|
||||
return m_zones;
|
||||
}
|
||||
|
||||
// gets zone data by using explicit version and falling back to version 0 if not found
|
||||
ZoneRepository::Zone *ZoneStore::GetZoneWithFallback(uint32 zone_id, int version)
|
||||
{
|
||||
for (auto &z: m_zones) {
|
||||
if (z.zoneidnumber == zone_id && z.version == version) {
|
||||
return &z;
|
||||
}
|
||||
}
|
||||
|
||||
// second pass, default to version 0 if specific doesn't exist
|
||||
for (auto &z: m_zones) {
|
||||
if (z.zoneidnumber == zone_id && z.version == 0) {
|
||||
return &z;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
/**
|
||||
* 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_ZONE_STORE_H
|
||||
#define EQEMU_ZONE_STORE_H
|
||||
|
||||
#include "../common/repositories/zone_repository.h"
|
||||
#include "../common/repositories/base/base_content_flags_repository.h"
|
||||
|
||||
class ZoneStore {
|
||||
public:
|
||||
ZoneStore();
|
||||
virtual ~ZoneStore();
|
||||
|
||||
const std::vector<ZoneRepository::Zone> &GetZones() const;
|
||||
|
||||
void LoadZones(Database &db);
|
||||
|
||||
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);
|
||||
ZoneRepository::Zone *GetZoneWithFallback(uint32 zone_id, int version = 0);
|
||||
private:
|
||||
std::vector<ZoneRepository::Zone> m_zones;
|
||||
};
|
||||
|
||||
extern ZoneStore zone_store;
|
||||
|
||||
/**
|
||||
* Global helpers
|
||||
*/
|
||||
inline uint32 ZoneID(const char *in_zone_name) { return zone_store.GetZoneID(in_zone_name); }
|
||||
inline uint32 ZoneID(std::string zone_name) { return zone_store.GetZoneID(zone_name); }
|
||||
inline const char *ZoneName(uint32 zone_id, bool error_unknown = false)
|
||||
{
|
||||
return zone_store.GetZoneName(
|
||||
zone_id,
|
||||
error_unknown
|
||||
);
|
||||
}
|
||||
inline const char *ZoneLongName(uint32 zone_id, bool error_unknown = false)
|
||||
{
|
||||
return zone_store.GetZoneLongName(
|
||||
zone_id,
|
||||
error_unknown
|
||||
);
|
||||
}
|
||||
inline ZoneRepository::Zone *GetZone(uint32 zone_id, int version = 0) { return zone_store.GetZone(zone_id, version); };
|
||||
inline ZoneRepository::Zone *GetZone(const char *in_zone_name) { return zone_store.GetZone(in_zone_name); };
|
||||
inline ZoneRepository::Zone *GetZone(const char *in_zone_name, int version = 0)
|
||||
{
|
||||
return zone_store.GetZone(
|
||||
ZoneID(
|
||||
in_zone_name
|
||||
), version
|
||||
);
|
||||
};
|
||||
inline ZoneRepository::Zone *GetZoneVersionWithFallback(uint32 zone_id, int version = 0)
|
||||
{
|
||||
return zone_store.GetZoneWithFallback(
|
||||
zone_id,
|
||||
version
|
||||
);
|
||||
};
|
||||
|
||||
#endif //EQEMU_ZONE_STORE_H
|
||||
Reference in New Issue
Block a user