mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
- Add Zone Process ID (OS PID) as information passed back to world, ultimately with the ability to display it in the telnet console under 'zonestatus'
- Refactored some zoneserver/worldserver code for readability
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@
|
||||
#include "quest_parser_collection.h"
|
||||
#include "../common/string_util.h"
|
||||
|
||||
extern volatile bool ZoneLoaded;
|
||||
extern volatile bool is_zone_loaded;
|
||||
|
||||
// This constructor is used during the bot create command
|
||||
Bot::Bot(NPCType npcTypeData, Client* botOwner) : NPC(&npcTypeData, nullptr, glm::vec4(), 0, false), rest_timer(1) {
|
||||
|
||||
+2
-2
@@ -53,7 +53,7 @@ extern volatile bool RunLoops;
|
||||
extern QueryServ* QServ;
|
||||
extern EntityList entity_list;
|
||||
extern Zone* zone;
|
||||
extern volatile bool ZoneLoaded;
|
||||
extern volatile bool is_zone_loaded;
|
||||
extern WorldServer worldserver;
|
||||
extern uint32 numclients;
|
||||
extern PetitionList petition_list;
|
||||
@@ -371,7 +371,7 @@ Client::~Client() {
|
||||
GetTarget()->IsTargeted(-1);
|
||||
|
||||
//if we are in a group and we are not zoning, force leave the group
|
||||
if(isgrouped && !zoning && ZoneLoaded)
|
||||
if(isgrouped && !zoning && is_zone_loaded)
|
||||
LeaveGroup();
|
||||
|
||||
UpdateWho(2);
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
|
||||
extern QueryServ* QServ;
|
||||
extern Zone* zone;
|
||||
extern volatile bool ZoneLoaded;
|
||||
extern volatile bool is_zone_loaded;
|
||||
extern WorldServer worldserver;
|
||||
extern PetitionList petition_list;
|
||||
extern EntityList entity_list;
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
extern QueryServ* QServ;
|
||||
extern Zone* zone;
|
||||
extern volatile bool ZoneLoaded;
|
||||
extern volatile bool is_zone_loaded;
|
||||
extern WorldServer worldserver;
|
||||
extern PetitionList petition_list;
|
||||
extern EntityList entity_list;
|
||||
|
||||
+2
-2
@@ -51,7 +51,7 @@
|
||||
#endif
|
||||
|
||||
extern Zone *zone;
|
||||
extern volatile bool ZoneLoaded;
|
||||
extern volatile bool is_zone_loaded;
|
||||
extern WorldServer worldserver;
|
||||
extern NetConnection net;
|
||||
extern uint32 numclients;
|
||||
@@ -2340,7 +2340,7 @@ void EntityList::Clear()
|
||||
|
||||
void EntityList::UpdateWho(bool iSendFullUpdate)
|
||||
{
|
||||
if ((!worldserver.Connected()) || !ZoneLoaded)
|
||||
if ((!worldserver.Connected()) || !is_zone_loaded)
|
||||
return;
|
||||
uint32 tmpNumUpdates = numclients + 5;
|
||||
ServerPacket* pack = 0;
|
||||
|
||||
+5
-5
@@ -29,7 +29,7 @@ ZoneGuildManager guild_mgr;
|
||||
GuildBankManager *GuildBanks;
|
||||
|
||||
extern WorldServer worldserver;
|
||||
extern volatile bool ZoneLoaded;
|
||||
extern volatile bool is_zone_loaded;
|
||||
|
||||
void ZoneGuildManager::SendGuildRefresh(uint32 guild_id, bool name, bool motd, bool rank, bool relation) {
|
||||
Log.Out(Logs::Detail, Logs::Guilds, "Sending guild refresh for %d to world, changes: name=%d, motd=%d, rank=d, relation=%d", guild_id, name, motd, rank, relation);
|
||||
@@ -334,7 +334,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
||||
|
||||
case ServerOP_GuildRankUpdate:
|
||||
{
|
||||
if(ZoneLoaded)
|
||||
if(is_zone_loaded)
|
||||
{
|
||||
if(pack->size != sizeof(ServerGuildRankUpdate_Struct))
|
||||
{
|
||||
@@ -388,7 +388,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
||||
{
|
||||
ServerGuildMemberUpdate_Struct *sgmus = (ServerGuildMemberUpdate_Struct*)pack->pBuffer;
|
||||
|
||||
if(ZoneLoaded)
|
||||
if(is_zone_loaded)
|
||||
{
|
||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildMemberUpdate, sizeof(GuildMemberUpdate_Struct));
|
||||
|
||||
@@ -407,7 +407,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
||||
break;
|
||||
}
|
||||
case ServerOP_OnlineGuildMembersResponse:
|
||||
if (ZoneLoaded)
|
||||
if (is_zone_loaded)
|
||||
{
|
||||
char *Buffer = (char *)pack->pBuffer;
|
||||
|
||||
@@ -443,7 +443,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
||||
|
||||
case ServerOP_LFGuildUpdate:
|
||||
{
|
||||
if(ZoneLoaded)
|
||||
if(is_zone_loaded)
|
||||
{
|
||||
char GuildName[33];
|
||||
char Comments[257];
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@
|
||||
#include "../common/string_util.h"
|
||||
#include "../common/rulesys.h"
|
||||
|
||||
extern volatile bool ZoneLoaded;
|
||||
extern volatile bool is_zone_loaded;
|
||||
|
||||
Merc::Merc(const NPCType* d, float x, float y, float z, float heading)
|
||||
: NPC(d, nullptr, glm::vec4(x, y, z, heading), 0, false), endupkeep_timer(1000), rest_timer(1), confidence_timer(6000), check_target_timer(2000)
|
||||
@@ -5777,7 +5777,7 @@ bool Merc::RemoveMercFromGroup(Merc* merc, Group* group) {
|
||||
{
|
||||
merc->SetFollowID(0);
|
||||
|
||||
if (group->GroupCount() <= 2 && merc->GetGroup() == group && ZoneLoaded)
|
||||
if (group->GroupCount() <= 2 && merc->GetGroup() == group && is_zone_loaded)
|
||||
{
|
||||
group->DisbandGroup();
|
||||
}
|
||||
|
||||
+3
-3
@@ -84,7 +84,7 @@
|
||||
#endif
|
||||
|
||||
volatile bool RunLoops = true;
|
||||
extern volatile bool ZoneLoaded;
|
||||
extern volatile bool is_zone_loaded;
|
||||
|
||||
TimeoutManager timeout_manager;
|
||||
NetConnection net;
|
||||
@@ -437,12 +437,12 @@ int main(int argc, char** argv) {
|
||||
worldwasconnected = true;
|
||||
}
|
||||
else {
|
||||
if (worldwasconnected && ZoneLoaded)
|
||||
if (worldwasconnected && is_zone_loaded)
|
||||
entity_list.ChannelMessageFromWorld(0, 0, 6, 0, 0, "WARNING: World server connection lost");
|
||||
worldwasconnected = false;
|
||||
}
|
||||
|
||||
if (ZoneLoaded && zoneupdate_timer.Check()) {
|
||||
if (is_zone_loaded && zoneupdate_timer.Check()) {
|
||||
{
|
||||
if(net.group_timer.Enabled() && net.group_timer.Check())
|
||||
entity_list.GroupProcess();
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@
|
||||
#endif
|
||||
|
||||
extern Zone* zone;
|
||||
extern volatile bool ZoneLoaded;
|
||||
extern volatile bool is_zone_loaded;
|
||||
extern EntityList entity_list;
|
||||
|
||||
NPC::NPC(const NPCType* d, Spawn2* in_respawn, const glm::vec4& position, int iflymode, bool IsCorpse)
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
|
||||
extern Zone* zone;
|
||||
extern volatile bool ZoneLoaded;
|
||||
extern volatile bool is_zone_loaded;
|
||||
extern WorldServer worldserver;
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
|
||||
|
||||
extern Zone* zone;
|
||||
extern volatile bool ZoneLoaded;
|
||||
extern volatile bool is_zone_loaded;
|
||||
extern WorldServer worldserver;
|
||||
|
||||
// this is run constantly for every mob
|
||||
|
||||
+36
-27
@@ -53,7 +53,7 @@
|
||||
|
||||
extern EntityList entity_list;
|
||||
extern Zone* zone;
|
||||
extern volatile bool ZoneLoaded;
|
||||
extern volatile bool is_zone_loaded;
|
||||
extern void CatchSignal(int);
|
||||
extern WorldServer worldserver;
|
||||
extern NetConnection net;
|
||||
@@ -85,7 +85,7 @@ WorldServer::~WorldServer() {
|
||||
safe_delete(pack);
|
||||
}*/
|
||||
|
||||
void WorldServer::SetZone(uint32 iZoneID, uint32 iInstanceID) {
|
||||
void WorldServer::SetZoneData(uint32 iZoneID, uint32 iInstanceID) {
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_SetZone, sizeof(SetZone_Struct));
|
||||
SetZone_Struct* szs = (SetZone_Struct*) pack->pBuffer;
|
||||
szs->zoneid = iZoneID;
|
||||
@@ -99,10 +99,9 @@ void WorldServer::SetZone(uint32 iZoneID, uint32 iInstanceID) {
|
||||
|
||||
void WorldServer::OnConnected() {
|
||||
WorldConnection::OnConnected();
|
||||
|
||||
ServerPacket* pack;
|
||||
|
||||
//tell the launcher what name we were started with.
|
||||
/* Tell the launcher what our information is */
|
||||
pack = new ServerPacket(ServerOP_SetLaunchName,sizeof(LaunchName_Struct));
|
||||
LaunchName_Struct* ln = (LaunchName_Struct*)pack->pBuffer;
|
||||
strn0cpy(ln->launcher_name, m_launcherName.c_str(), 32);
|
||||
@@ -110,28 +109,38 @@ void WorldServer::OnConnected() {
|
||||
SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
|
||||
/* Tell the Worldserver basic information about this zone process */
|
||||
pack = new ServerPacket(ServerOP_SetConnectInfo, sizeof(ServerConnectInfo));
|
||||
ServerConnectInfo* sci = (ServerConnectInfo*) pack->pBuffer;
|
||||
|
||||
auto config = ZoneConfig::get();
|
||||
sci->port = ZoneConfig::get()->ZonePort;
|
||||
if(config->WorldAddress.length() > 0) {
|
||||
strn0cpy(sci->address, config->WorldAddress.c_str(), 250);
|
||||
}
|
||||
|
||||
if(config->LocalAddress.length() > 0) {
|
||||
strn0cpy(sci->local_address, config->LocalAddress.c_str(), 250);
|
||||
}
|
||||
|
||||
/* Fetch process ID */
|
||||
if (getpid()){
|
||||
sci->process_id = getpid();
|
||||
}
|
||||
else {
|
||||
sci->process_id = 0;
|
||||
}
|
||||
|
||||
SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
|
||||
if (ZoneLoaded) {
|
||||
this->SetZone(zone->GetZoneID(), zone->GetInstanceID());
|
||||
if (is_zone_loaded) {
|
||||
this->SetZoneData(zone->GetZoneID(), zone->GetInstanceID());
|
||||
entity_list.UpdateWho(true);
|
||||
this->SendEmoteMessage(0, 0, 15, "Zone connect: %s", zone->GetLongName());
|
||||
zone->GetTimeSync();
|
||||
} else {
|
||||
this->SetZone(0);
|
||||
zone->GetTimeSync();
|
||||
}
|
||||
else {
|
||||
this->SetZoneData(0);
|
||||
}
|
||||
|
||||
pack = new ServerPacket(ServerOP_LSZoneBoot,sizeof(ZoneBoot_Struct));
|
||||
@@ -174,7 +183,7 @@ void WorldServer::Process() {
|
||||
break;
|
||||
}
|
||||
case ServerOP_ChannelMessage: {
|
||||
if (!ZoneLoaded)
|
||||
if (!is_zone_loaded)
|
||||
break;
|
||||
ServerChannelMessage_Struct* scm = (ServerChannelMessage_Struct*) pack->pBuffer;
|
||||
if (scm->deliverto[0] == 0) {
|
||||
@@ -207,7 +216,7 @@ void WorldServer::Process() {
|
||||
}
|
||||
case ServerOP_VoiceMacro: {
|
||||
|
||||
if (!ZoneLoaded)
|
||||
if (!is_zone_loaded)
|
||||
break;
|
||||
|
||||
ServerVoiceMacro_Struct* svm = (ServerVoiceMacro_Struct*) pack->pBuffer;
|
||||
@@ -264,7 +273,7 @@ void WorldServer::Process() {
|
||||
case ServerOP_SpawnCondition: {
|
||||
if(pack->size != sizeof(ServerSpawnCondition_Struct))
|
||||
break;
|
||||
if (!ZoneLoaded)
|
||||
if (!is_zone_loaded)
|
||||
break;
|
||||
ServerSpawnCondition_Struct* ssc = (ServerSpawnCondition_Struct*) pack->pBuffer;
|
||||
|
||||
@@ -274,7 +283,7 @@ void WorldServer::Process() {
|
||||
case ServerOP_SpawnEvent: {
|
||||
if(pack->size != sizeof(ServerSpawnEvent_Struct))
|
||||
break;
|
||||
if (!ZoneLoaded)
|
||||
if (!is_zone_loaded)
|
||||
break;
|
||||
ServerSpawnEvent_Struct* sse = (ServerSpawnEvent_Struct*) pack->pBuffer;
|
||||
|
||||
@@ -285,7 +294,7 @@ void WorldServer::Process() {
|
||||
case ServerOP_AcceptWorldEntrance: {
|
||||
if(pack->size != sizeof(WorldToZone_Struct))
|
||||
break;
|
||||
if (!ZoneLoaded)
|
||||
if (!is_zone_loaded)
|
||||
break;
|
||||
WorldToZone_Struct* wtz = (WorldToZone_Struct*) pack->pBuffer;
|
||||
|
||||
@@ -300,7 +309,7 @@ void WorldServer::Process() {
|
||||
case ServerOP_ZoneToZoneRequest: {
|
||||
if(pack->size != sizeof(ZoneToZone_Struct))
|
||||
break;
|
||||
if (!ZoneLoaded)
|
||||
if (!is_zone_loaded)
|
||||
break;
|
||||
ZoneToZone_Struct* ztz = (ZoneToZone_Struct*) pack->pBuffer;
|
||||
|
||||
@@ -376,7 +385,7 @@ void WorldServer::Process() {
|
||||
break;
|
||||
}
|
||||
case ServerOP_WhoAllReply:{
|
||||
if(!ZoneLoaded)
|
||||
if(!is_zone_loaded)
|
||||
break;
|
||||
|
||||
|
||||
@@ -403,7 +412,7 @@ void WorldServer::Process() {
|
||||
break;
|
||||
}
|
||||
case ServerOP_EmoteMessage: {
|
||||
if (!ZoneLoaded)
|
||||
if (!is_zone_loaded)
|
||||
break;
|
||||
ServerEmoteMessage_Struct* sem = (ServerEmoteMessage_Struct*) pack->pBuffer;
|
||||
if (sem->to[0] != 0) {
|
||||
@@ -461,8 +470,8 @@ void WorldServer::Process() {
|
||||
break;
|
||||
}
|
||||
// Annouce the change to the world
|
||||
if (!ZoneLoaded) {
|
||||
SetZone(0);
|
||||
if (!is_zone_loaded) {
|
||||
SetZoneData(0);
|
||||
}
|
||||
else {
|
||||
SendEmoteMessage(0, 0, 15, "Zone shutdown: %s", zone->GetLongName());
|
||||
@@ -479,8 +488,8 @@ void WorldServer::Process() {
|
||||
break;
|
||||
}
|
||||
ServerZoneStateChange_struct* zst = (ServerZoneStateChange_struct *) pack->pBuffer;
|
||||
if (ZoneLoaded) {
|
||||
SetZone(zone->GetZoneID(), zone->GetInstanceID());
|
||||
if (is_zone_loaded) {
|
||||
SetZoneData(zone->GetZoneID(), zone->GetInstanceID());
|
||||
if (zst->zoneid == zone->GetZoneID()) {
|
||||
// This packet also doubles as "incoming client" notification, lets not shut down before they get here
|
||||
zone->StartShutdownTimer(AUTHENTICATION_TIMEOUT * 1000);
|
||||
@@ -503,8 +512,8 @@ void WorldServer::Process() {
|
||||
break;
|
||||
}
|
||||
ServerZoneIncomingClient_Struct* szic = (ServerZoneIncomingClient_Struct*) pack->pBuffer;
|
||||
if (ZoneLoaded) {
|
||||
SetZone(zone->GetZoneID(), zone->GetInstanceID());
|
||||
if (is_zone_loaded) {
|
||||
SetZoneData(zone->GetZoneID(), zone->GetInstanceID());
|
||||
if (szic->zoneid == zone->GetZoneID()) {
|
||||
zone->AddAuth(szic);
|
||||
// This packet also doubles as "incoming client" notification, lets not shut down before they get here
|
||||
@@ -540,7 +549,7 @@ void WorldServer::Process() {
|
||||
if (client != 0) {
|
||||
if (skp->adminrank >= client->Admin()) {
|
||||
client->WorldKick();
|
||||
if (ZoneLoaded)
|
||||
if (is_zone_loaded)
|
||||
SendEmoteMessage(skp->adminname, 0, 0, "Remote Kick: %s booted in zone %s.", skp->name, zone->GetShortName());
|
||||
else
|
||||
SendEmoteMessage(skp->adminname, 0, 0, "Remote Kick: %s booted.", skp->name);
|
||||
@@ -556,7 +565,7 @@ void WorldServer::Process() {
|
||||
if (client != 0) {
|
||||
if (skp->admin >= client->Admin()) {
|
||||
client->GMKill();
|
||||
if (ZoneLoaded)
|
||||
if (is_zone_loaded)
|
||||
SendEmoteMessage(skp->gmname, 0, 0, "Remote Kill: %s killed in zone %s.", skp->target, zone->GetShortName());
|
||||
else
|
||||
SendEmoteMessage(skp->gmname, 0, 0, "Remote Kill: %s killed.", skp->target);
|
||||
@@ -594,7 +603,7 @@ void WorldServer::Process() {
|
||||
std::cout << "Wrong size on ServerOP_GMGoto. Got: " << pack->size << ", Expected: " << sizeof(ServerGMGoto_Struct) << std::endl;
|
||||
break;
|
||||
}
|
||||
if (!ZoneLoaded)
|
||||
if (!is_zone_loaded)
|
||||
break;
|
||||
ServerGMGoto_Struct* gmg = (ServerGMGoto_Struct*) pack->pBuffer;
|
||||
Client* client = entity_list.GetClientByName(gmg->gotoname);
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@ public:
|
||||
bool SendEmoteMessage(const char* to, uint32 to_guilddbid, uint32 type, const char* message, ...);
|
||||
bool SendEmoteMessage(const char* to, uint32 to_guilddbid, int16 to_minstatus, uint32 type, const char* message, ...);
|
||||
bool SendVoiceMacro(Client* From, uint32 Type, char* Target, uint32 MacroNumber, uint32 GroupOrRaidID = 0);
|
||||
void SetZone(uint32 iZoneID, uint32 iInstanceID = 0);
|
||||
void SetZoneData(uint32 iZoneID, uint32 iInstanceID = 0);
|
||||
uint32 SendGroupIdRequest();
|
||||
bool RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 dbid, uint16 opcode);
|
||||
bool IsOOCMuted() const { return(oocmuted); }
|
||||
|
||||
+10
-10
@@ -74,7 +74,7 @@ extern Zone* zone;
|
||||
|
||||
Mutex MZoneShutdown;
|
||||
|
||||
volatile bool ZoneLoaded = false;
|
||||
volatile bool is_zone_loaded = false;
|
||||
Zone* zone = 0;
|
||||
|
||||
bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
|
||||
@@ -82,9 +82,9 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
|
||||
|
||||
if (iZoneID == 0 || zonename == 0)
|
||||
return false;
|
||||
if (zone != 0 || ZoneLoaded) {
|
||||
if (zone != 0 || is_zone_loaded) {
|
||||
std::cerr << "Error: Zone::Bootup call when zone already booted!" << std::endl;
|
||||
worldserver.SetZone(0);
|
||||
worldserver.SetZoneData(0);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
|
||||
if (!zone->Init(iStaticZone)) {
|
||||
safe_delete(zone);
|
||||
std::cerr << "Zone->Init failed" << std::endl;
|
||||
worldserver.SetZone(0);
|
||||
worldserver.SetZoneData(0);
|
||||
return false;
|
||||
}
|
||||
zone->zonemap = Map::LoadMapFile(zone->map_name);
|
||||
@@ -131,9 +131,9 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
|
||||
}
|
||||
}
|
||||
|
||||
ZoneLoaded = true;
|
||||
is_zone_loaded = true;
|
||||
|
||||
worldserver.SetZone(iZoneID, iInstanceID);
|
||||
worldserver.SetZoneData(iZoneID, iInstanceID);
|
||||
if(iInstanceID != 0)
|
||||
{
|
||||
ServerPacket *pack = new ServerPacket(ServerOP_AdventureZoneData, sizeof(uint16));
|
||||
@@ -660,12 +660,12 @@ void Zone::LoadMercSpells(){
|
||||
}
|
||||
|
||||
bool Zone::IsLoaded() {
|
||||
return ZoneLoaded;
|
||||
return is_zone_loaded;
|
||||
}
|
||||
|
||||
void Zone::Shutdown(bool quite)
|
||||
{
|
||||
if (!ZoneLoaded)
|
||||
if (!is_zone_loaded)
|
||||
return;
|
||||
|
||||
entity_list.StopMobAI();
|
||||
@@ -699,7 +699,7 @@ void Zone::Shutdown(bool quite)
|
||||
zone->SetZoneHasCurrentTime(false);
|
||||
if (!quite)
|
||||
Log.Out(Logs::General, Logs::Normal, "Zone shutdown: going to sleep");
|
||||
ZoneLoaded = false;
|
||||
is_zone_loaded = false;
|
||||
|
||||
zone->ResetAuth();
|
||||
safe_delete(zone);
|
||||
@@ -846,7 +846,7 @@ Zone::~Zone() {
|
||||
safe_delete(watermap);
|
||||
safe_delete(pathing);
|
||||
if (worldserver.Connected()) {
|
||||
worldserver.SetZone(0);
|
||||
worldserver.SetZoneData(0);
|
||||
}
|
||||
safe_delete_array(short_name);
|
||||
safe_delete_array(long_name);
|
||||
|
||||
Reference in New Issue
Block a user