[Commands] #reload Command Overhaul. (#2162)

* [Commands] #reload Command Overhaul.
- Consolidated #reloadaa, #reloadallrules, #reloadcontentflags, #reloademote, #reloadlevelmods, #reloadmerchants, #reloadperlexportsettings, #reloadqst, #reloadstatic, #reloadtitles, #relaodtraps, #reloadworld, and #reloadzps in to one command.
- #reload has 15 different sub commands you may use, including Log Settings and Tasks reloading.
- All the reload commands are a part of the Developer Tools Menu messages now, as well as part of the documentation.
- Fixes the commands that weren't actually sending their packet to zone server to globally reload stuff.
- Added Variables table reloading to command.

* Consistency.

* Hot reload.

* Final big push.
This commit is contained in:
Kinglykrab
2022-05-10 06:19:07 -04:00
committed by GitHub
parent 209b0eb273
commit d120cf8a40
29 changed files with 1083 additions and 525 deletions
+45 -47
View File
@@ -86,7 +86,7 @@ Zone* zone = 0;
void UpdateWindowTitle(char* iNewTitle);
bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool is_static) {
const char* zonename = ZoneName(iZoneID);
if (iZoneID == 0 || zonename == 0)
@@ -103,7 +103,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
zone = new Zone(iZoneID, iInstanceID, zonename);
//init the zone, loads all the data, etc
if (!zone->Init(iStaticZone)) {
if (!zone->Init(is_static)) {
safe_delete(zone);
std::cerr << "Zone->Init failed" << std::endl;
worldserver.SetZoneData(0);
@@ -151,14 +151,14 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
LogInfo("---- Zone server [{}], listening on port:[{}] ----", zonename, ZoneConfig::get()->ZonePort);
LogInfo("Zone Bootup: [{}] [{}] ([{}]: [{}])",
(iStaticZone) ? "Static" : "Dynamic", zonename, iZoneID, iInstanceID);
(is_static) ? "Static" : "Dynamic", zonename, iZoneID, iInstanceID);
parse->Init();
UpdateWindowTitle(nullptr);
// Dynamic zones need to Sync here.
// Static zones sync when they connect in worldserver.cpp.
// Static zones cannot sync here as request is ignored by worldserver.
if (!iStaticZone)
if (!is_static)
{
zone->GetTimeSync();
}
@@ -925,21 +925,19 @@ void Zone::Shutdown(bool quiet)
}
}
void Zone::LoadZoneDoors(const char* zone, int16 version)
void Zone::LoadZoneDoors()
{
LogInfo("Loading doors for [{}] ", zone);
LogInfo("Loading doors for [{}] ", GetShortName());
auto door_entries = content_db.LoadDoors(zone, version);
if (door_entries.empty())
{
auto door_entries = content_db.LoadDoors(GetShortName(), GetInstanceVersion());
if (door_entries.empty()) {
LogInfo("No doors loaded");
return;
}
for (const auto& entry : door_entries)
{
auto newdoor = new Doors(entry);
entity_list.AddDoor(newdoor);
for (const auto &entry : door_entries) {
auto d = new Doors(entry);
entity_list.AddDoor(d);
LogDoorsDetail("Door added to entity list, db id: [{}], door_id: [{}]", entry.id, entry.doorid);
}
}
@@ -1081,14 +1079,14 @@ Zone::~Zone() {
}
//Modified for timezones.
bool Zone::Init(bool iStaticZone) {
SetStaticZone(iStaticZone);
bool Zone::Init(bool is_static) {
SetStaticZone(is_static);
//load the zone config file.
if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion())) { // try loading the zone name...
if (!LoadZoneCFG(GetShortName(), GetInstanceVersion())) { // try loading the zone name...
LoadZoneCFG(
zone->GetFileName(),
zone->GetInstanceVersion()
GetFileName(),
GetInstanceVersion()
);
} // if that fails, try the file name, then load defaults
@@ -1099,9 +1097,9 @@ bool Zone::Init(bool iStaticZone) {
}
}
zone->zonemap = Map::LoadMapFile(zone->map_name);
zone->watermap = WaterMap::LoadWaterMapfile(zone->map_name);
zone->pathing = IPathfinder::Load(zone->map_name);
zonemap = Map::LoadMapFile(map_name);
watermap = WaterMap::LoadWaterMapfile(map_name);
pathing = IPathfinder::Load(map_name);
LogInfo("Loading spawn conditions");
if(!spawn_conditions.LoadSpawnConditions(short_name, instanceid)) {
@@ -1158,8 +1156,8 @@ bool Zone::Init(bool iStaticZone) {
LogInfo("Flushing old respawn timers");
database.QueryDatabase("DELETE FROM `respawn_times` WHERE (`start` + `duration`) < UNIX_TIMESTAMP(NOW())");
zone->LoadZoneDoors(zone->GetShortName(), zone->GetInstanceVersion());
zone->LoadZoneBlockedSpells(zone->GetZoneID());
LoadZoneDoors();
LoadZoneBlockedSpells();
//clear trader items if we are loading the bazaar
if (strncasecmp(short_name, "bazaar", 6) == 0) {
@@ -1167,30 +1165,31 @@ bool Zone::Init(bool iStaticZone) {
database.DeleteBuyLines(0);
}
zone->LoadLDoNTraps();
zone->LoadLDoNTrapEntries();
zone->LoadVeteranRewards();
zone->LoadAlternateCurrencies();
zone->LoadNPCEmotes(&NPCEmoteList);
LoadLDoNTraps();
LoadLDoNTrapEntries();
LoadVeteranRewards();
LoadAlternateCurrencies();
LoadNPCEmotes(&NPCEmoteList);
LoadAlternateAdvancement();
content_db.LoadGlobalLoot();
//Load merchant data
zone->GetMerchantDataForZoneLoad();
GetMerchantDataForZoneLoad();
//Load temporary merchant data
zone->LoadTempMerchantData();
LoadTempMerchantData();
// Merc data
if (RuleB(Mercs, AllowMercs)) {
zone->LoadMercTemplates();
zone->LoadMercSpells();
LoadMercTemplates();
LoadMercSpells();
}
if (RuleB(Zone, LevelBasedEXPMods))
zone->LoadLevelEXPMods();
if (RuleB(Zone, LevelBasedEXPMods)) {
LoadLevelEXPMods();
}
petition_list.ClearPetitions();
petition_list.ReadDatabase();
@@ -1202,9 +1201,9 @@ bool Zone::Init(bool iStaticZone) {
Expedition::CacheAllFromDatabase();
LogInfo("Loading timezone data");
zone->zone_time.setEQTimeZone(content_db.GetZoneTZ(zoneid, GetInstanceVersion()));
zone_time.setEQTimeZone(content_db.GetZoneTZ(zoneid, GetInstanceVersion()));
LogInfo("Init Finished: ZoneID = [{}], Time Offset = [{}]", zoneid, zone->zone_time.getEQTimeZone());
LogInfo("Init Finished: ZoneID = [{}], Time Offset = [{}]", zoneid, zone_time.getEQTimeZone());
LoadGrids();
LoadTickItems();
@@ -1219,7 +1218,6 @@ void Zone::ReloadStaticData() {
LogInfo("Reloading Zone Static Data");
LogInfo("Reloading static zone points");
zone_point_list.Clear();
if (!content_db.LoadStaticZonePoints(&zone_point_list, GetShortName(), GetInstanceVersion())) {
LogError("Loading static zone points failed");
}
@@ -1245,19 +1243,19 @@ void Zone::ReloadStaticData() {
}
entity_list.RemoveAllDoors();
zone->LoadZoneDoors(zone->GetShortName(), zone->GetInstanceVersion());
LoadZoneDoors();
entity_list.RespawnAllDoors();
zone->LoadVeteranRewards();
zone->LoadAlternateCurrencies();
LoadVeteranRewards();
LoadAlternateCurrencies();
NPCEmoteList.Clear();
zone->LoadNPCEmotes(&NPCEmoteList);
LoadNPCEmotes(&NPCEmoteList);
//load the zone config file.
if (!LoadZoneCFG(zone->GetShortName(), zone->GetInstanceVersion())) { // try loading the zone name...
if (!LoadZoneCFG(GetShortName(), GetInstanceVersion())) { // try loading the zone name...
LoadZoneCFG(
zone->GetFileName(),
zone->GetInstanceVersion()
GetFileName(),
GetInstanceVersion()
);
} // if that fails, try the file name, then load defaults
@@ -2101,13 +2099,13 @@ void Zone::SetGraveyard(uint32 zoneid, const glm::vec4& graveyardPosition) {
m_Graveyard = graveyardPosition;
}
void Zone::LoadZoneBlockedSpells(uint32 zone_id)
void Zone::LoadZoneBlockedSpells()
{
if (!blocked_spells) {
zone_total_blocked_spells = content_db.GetBlockedSpellsCount(zone_id);
zone_total_blocked_spells = content_db.GetBlockedSpellsCount(GetZoneID());
if (zone_total_blocked_spells > 0) {
blocked_spells = new ZoneSpellsBlocked[zone_total_blocked_spells];
if (!content_db.LoadBlockedSpells(zone_total_blocked_spells, blocked_spells, zone_id)) {
if (!content_db.LoadBlockedSpells(zone_total_blocked_spells, blocked_spells, GetZoneID())) {
LogError(" Failed to load blocked spells");
ClearBlockedSpells();
}