mirror of
https://github.com/EQEmu/Server.git
synced 2026-08-28 15:57:58 +00:00
Merge pull request #964 from EQEmu/feature/hot-reload
Feature - Hot Reload
This commit is contained in:
+3
-1
@@ -141,6 +141,7 @@ SET(zone_sources
|
||||
zone.cpp
|
||||
zone_config.cpp
|
||||
zonedb.cpp
|
||||
zone_reload.cpp
|
||||
zoning.cpp
|
||||
)
|
||||
|
||||
@@ -247,7 +248,8 @@ SET(zone_headers
|
||||
zone.h
|
||||
zone_config.h
|
||||
zonedb.h
|
||||
zonedump.h)
|
||||
zonedump.h
|
||||
zone_reload.h )
|
||||
|
||||
ADD_EXECUTABLE(zone ${zone_sources} ${zone_headers})
|
||||
|
||||
|
||||
+28
-2
@@ -51,6 +51,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "worldserver.h"
|
||||
#include "zone.h"
|
||||
#include "zone_config.h"
|
||||
#include "zone_reload.h"
|
||||
|
||||
|
||||
extern EntityList entity_list;
|
||||
@@ -1945,15 +1946,40 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
|
||||
case ServerOP_ReloadWorld:
|
||||
{
|
||||
ReloadWorld_Struct* RW = (ReloadWorld_Struct*)pack->pBuffer;
|
||||
auto* reload_world = (ReloadWorld_Struct*)pack->pBuffer;
|
||||
if (zone) {
|
||||
zone->ReloadWorld(RW->Option);
|
||||
zone->ReloadWorld(reload_world->Option);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ServerOP_HotReloadQuests:
|
||||
{
|
||||
if (!zone) {
|
||||
break;
|
||||
}
|
||||
|
||||
auto *hot_reload_quests = (HotReloadQuestsStruct *) pack->pBuffer;
|
||||
|
||||
LogHotReloadDetail(
|
||||
"Receiving request [HotReloadQuests] | request_zone [{}] current_zone [{}]",
|
||||
hot_reload_quests->zone_short_name,
|
||||
zone->GetShortName()
|
||||
);
|
||||
|
||||
std::string request_zone_short_name = hot_reload_quests->zone_short_name;
|
||||
std::string local_zone_short_name = zone->GetShortName();
|
||||
|
||||
if (request_zone_short_name == local_zone_short_name || request_zone_short_name == "all"){
|
||||
zone->SetQuestHotReloadQueued(true);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case ServerOP_ChangeSharedMem:
|
||||
{
|
||||
std::string hotfix_name = std::string((char*)pack->pBuffer);
|
||||
|
||||
+34
-1
@@ -55,6 +55,7 @@
|
||||
#include "mob_movement_manager.h"
|
||||
#include "npc_scale_manager.h"
|
||||
#include "../common/data_verification.h"
|
||||
#include "zone_reload.h"
|
||||
|
||||
#include <time.h>
|
||||
#include <ctime>
|
||||
@@ -771,6 +772,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name)
|
||||
autoshutdown_timer((RuleI(Zone, AutoShutdownDelay))),
|
||||
clientauth_timer(AUTHENTICATION_TIMEOUT * 1000),
|
||||
spawn2_timer(1000),
|
||||
hot_reload_timer(1000),
|
||||
qglobal_purge_timer(30000),
|
||||
hotzone_timer(120000),
|
||||
m_SafePoint(0.0f,0.0f,0.0f),
|
||||
@@ -874,6 +876,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name)
|
||||
mMovementManager = &MobMovementManager::Get();
|
||||
|
||||
SetNpcPositionUpdateDistance(0);
|
||||
SetQuestHotReloadQueued(false);
|
||||
}
|
||||
|
||||
Zone::~Zone() {
|
||||
@@ -1231,6 +1234,27 @@ bool Zone::Process() {
|
||||
}
|
||||
}
|
||||
|
||||
if (hot_reload_timer.Check() && IsQuestHotReloadQueued()) {
|
||||
|
||||
LogHotReloadDetail("Hot reload timer check...");
|
||||
|
||||
bool perform_reload = true;
|
||||
|
||||
if (RuleB(HotReload, QuestsRepopWhenPlayersNotInCombat)) {
|
||||
for (auto &it : entity_list.GetClientList()) {
|
||||
auto client = it.second;
|
||||
if (client->GetAggroCount() > 0) {
|
||||
perform_reload = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (perform_reload) {
|
||||
ZoneReload::HotReloadQuests();
|
||||
}
|
||||
}
|
||||
|
||||
if(initgrids_timer.Check()) {
|
||||
//delayed grid loading stuff.
|
||||
initgrids_timer.Disable();
|
||||
@@ -1540,7 +1564,6 @@ void Zone::RepopClose(const glm::vec4& client_position, uint32 repop_distance)
|
||||
|
||||
void Zone::Repop(uint32 delay)
|
||||
{
|
||||
|
||||
if (!Depop()) {
|
||||
return;
|
||||
}
|
||||
@@ -2422,3 +2445,13 @@ void Zone::CalculateNpcUpdateDistanceSpread()
|
||||
combined_spread
|
||||
);
|
||||
}
|
||||
|
||||
bool Zone::IsQuestHotReloadQueued() const
|
||||
{
|
||||
return quest_hot_reload_queued;
|
||||
}
|
||||
|
||||
void Zone::SetQuestHotReloadQueued(bool in_quest_hot_reload_queued)
|
||||
{
|
||||
quest_hot_reload_queued = in_quest_hot_reload_queued;
|
||||
}
|
||||
|
||||
@@ -204,6 +204,7 @@ public:
|
||||
|
||||
time_t weather_timer;
|
||||
Timer spawn2_timer;
|
||||
Timer hot_reload_timer;
|
||||
|
||||
uint8 weather_intensity;
|
||||
uint8 zone_weather;
|
||||
@@ -270,6 +271,9 @@ public:
|
||||
void UpdateQGlobal(uint32 qid, QGlobal newGlobal);
|
||||
void weatherSend(Client *client = nullptr);
|
||||
|
||||
bool IsQuestHotReloadQueued() const;
|
||||
void SetQuestHotReloadQueued(bool in_quest_hot_reload_queued);
|
||||
|
||||
WaterMap *watermap;
|
||||
ZonePoint *GetClosestZonePoint(const glm::vec3 &location, uint32 to, Client *client, float max_distance = 40000.0f);
|
||||
ZonePoint *GetClosestZonePointWithoutZone(float x, float y, float z, Client *client, float max_distance = 40000.0f);
|
||||
@@ -340,6 +344,9 @@ private:
|
||||
bool m_ucss_available;
|
||||
bool staticzone;
|
||||
bool zone_has_current_time;
|
||||
bool quest_hot_reload_queued;
|
||||
|
||||
private:
|
||||
double max_movement_update_range;
|
||||
char *long_name;
|
||||
char *map_name;
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* 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_reload.h"
|
||||
#include "quest_parser_collection.h"
|
||||
|
||||
void ZoneReload::HotReloadQuests()
|
||||
{
|
||||
BenchTimer timer;
|
||||
|
||||
entity_list.ClearAreas();
|
||||
|
||||
parse->ReloadQuests(RuleB(HotReload, QuestsResetTimersWithReload));
|
||||
|
||||
if (RuleB(HotReload, QuestsRepopWithReload)) {
|
||||
zone->Repop(0);
|
||||
}
|
||||
|
||||
zone->SetQuestHotReloadQueued(false);
|
||||
|
||||
LogHotReload(
|
||||
"[Quests] Reloading [{}] repop [{}] reset_timers [{}] repop_when_not_in_combat [{}] Time [{:.4f}]",
|
||||
zone->GetShortName(),
|
||||
(RuleB(HotReload, QuestsRepopWithReload) ? "true" : "false"),
|
||||
(RuleB(HotReload, QuestsResetTimersWithReload) ? "true" : "false"),
|
||||
(RuleB(HotReload, QuestsRepopWhenPlayersNotInCombat) ? "true" : "false"),
|
||||
timer.elapsed()
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* 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_RELOAD_H
|
||||
#define EQEMU_ZONE_RELOAD_H
|
||||
|
||||
|
||||
class ZoneReload {
|
||||
public:
|
||||
static void HotReloadQuests();
|
||||
};
|
||||
|
||||
|
||||
#endif //EQEMU_ZONE_RELOAD_H
|
||||
Reference in New Issue
Block a user