mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-19 21:02:41 +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:
parent
ab3e31154c
commit
33917fe2a9
@ -548,6 +548,7 @@ struct ServerConnectInfo {
|
|||||||
char address[250];
|
char address[250];
|
||||||
char local_address[250];
|
char local_address[250];
|
||||||
uint16 port;
|
uint16 port;
|
||||||
|
uint32 process_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ServerGMGoto_Struct {
|
struct ServerGMGoto_Struct {
|
||||||
|
|||||||
@ -283,57 +283,84 @@ void ZSList::ListLockedZones(const char* to, WorldTCPConnection* connection) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ZSList::SendZoneStatus(const char* to, int16 admin, WorldTCPConnection* connection) {
|
void ZSList::SendZoneStatus(const char* to, int16 admin, WorldTCPConnection* connection) {
|
||||||
|
|
||||||
LinkedListIterator<ZoneServer*> iterator(list);
|
LinkedListIterator<ZoneServer*> iterator(list);
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
|
|
||||||
iterator.Reset();
|
iterator.Reset();
|
||||||
char locked[4];
|
char locked[4];
|
||||||
if (WorldConfig::get()->Locked == true)
|
if (WorldConfig::get()->Locked == true){
|
||||||
strcpy(locked, "Yes");
|
strcpy(locked, "Yes");
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
strcpy(locked, "No");
|
strcpy(locked, "No");
|
||||||
|
}
|
||||||
|
|
||||||
char* output = 0;
|
char* output = 0;
|
||||||
uint32 outsize = 0, outlen = 0;
|
uint32 outsize = 0, outlen = 0;
|
||||||
if (connection->IsConsole())
|
|
||||||
|
if (connection->IsConsole()){
|
||||||
AppendAnyLenString(&output, &outsize, &outlen, "World Locked: %s\r\n", locked);
|
AppendAnyLenString(&output, &outsize, &outlen, "World Locked: %s\r\n", locked);
|
||||||
else
|
}
|
||||||
|
else{
|
||||||
AppendAnyLenString(&output, &outsize, &outlen, "World Locked: %s^", locked);
|
AppendAnyLenString(&output, &outsize, &outlen, "World Locked: %s^", locked);
|
||||||
if (connection->IsConsole())
|
}
|
||||||
|
if (connection->IsConsole()){
|
||||||
AppendAnyLenString(&output, &outsize, &outlen, "Zoneservers online:\r\n");
|
AppendAnyLenString(&output, &outsize, &outlen, "Zoneservers online:\r\n");
|
||||||
else
|
}
|
||||||
|
else{
|
||||||
AppendAnyLenString(&output, &outsize, &outlen, "Zoneservers online:^");
|
AppendAnyLenString(&output, &outsize, &outlen, "Zoneservers online:^");
|
||||||
// connection->SendEmoteMessage(to, 0, 0, 0, "World Locked: %s", locked);
|
}
|
||||||
// connection->SendEmoteMessage(to, 0, 0, 0, "Zoneservers online:");
|
|
||||||
int v=0, w=0, x=0, y=0, z=0;
|
|
||||||
char tmpStatic[2] = { 0, 0 }, tmpZone[64];
|
|
||||||
memset(tmpZone, 0, sizeof(tmpZone));
|
|
||||||
ZoneServer* zs = 0;
|
|
||||||
while(iterator.MoreElements()) {
|
|
||||||
zs = iterator.GetData();
|
|
||||||
in.s_addr = zs->GetIP();
|
|
||||||
|
|
||||||
if(zs->IsStaticZone())
|
int v = 0, w = 0, x = 0, y = 0, z = 0;
|
||||||
|
char is_static_string[2] = { 0, 0 }, zone_data_string[64];
|
||||||
|
memset(zone_data_string, 0, sizeof(zone_data_string));
|
||||||
|
|
||||||
|
ZoneServer* zone_server_data = 0;
|
||||||
|
|
||||||
|
while (iterator.MoreElements()) {
|
||||||
|
zone_server_data = iterator.GetData();
|
||||||
|
in.s_addr = zone_server_data->GetIP();
|
||||||
|
|
||||||
|
if (zone_server_data->IsStaticZone()){
|
||||||
z++;
|
z++;
|
||||||
else if (zs->GetZoneID() != 0)
|
}
|
||||||
|
else if (zone_server_data->GetZoneID() != 0){
|
||||||
w++;
|
w++;
|
||||||
else if(zs->GetZoneID() == 0 && !zs->IsBootingUp())
|
}
|
||||||
|
else if (zone_server_data->GetZoneID() == 0 && !zone_server_data->IsBootingUp()){
|
||||||
v++;
|
v++;
|
||||||
|
}
|
||||||
|
|
||||||
if (zs->IsStaticZone())
|
if (zone_server_data->IsStaticZone())
|
||||||
tmpStatic[0] = 'S';
|
is_static_string[0] = 'S';
|
||||||
else
|
else
|
||||||
tmpStatic[0] = ' ';
|
is_static_string[0] = 'D';
|
||||||
|
|
||||||
if (admin >= 150) {
|
if (admin >= 150) {
|
||||||
if (zs->GetZoneID())
|
if (zone_server_data->GetZoneID()){
|
||||||
snprintf(tmpZone, sizeof(tmpZone), "%s (%i)", zs->GetZoneName(), zs->GetZoneID());
|
snprintf(zone_data_string, sizeof(zone_data_string), "%s (%i)", zone_server_data->GetZoneName(), zone_server_data->GetZoneID());
|
||||||
else if (zs->IsBootingUp())
|
}
|
||||||
strcpy(tmpZone, "...");
|
else if (zone_server_data->IsBootingUp()){
|
||||||
else
|
strcpy(zone_data_string, "...");
|
||||||
tmpZone[0] = 0;
|
}
|
||||||
|
else{
|
||||||
|
zone_data_string[0] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
AppendAnyLenString(&output, &outsize, &outlen, " #%-3i %s %15s:%-5i %2i %s:%i %s", zs->GetID(), tmpStatic, inet_ntoa(in), zs->GetPort(), zs->NumPlayers(), zs->GetCAddress(), zs->GetCPort(), tmpZone);
|
AppendAnyLenString(&output, &outsize, &outlen,
|
||||||
|
"#%-3i :: %s :: %15s:%-5i :: %2i :: %s:%i :: %s :: (%u)",
|
||||||
|
zone_server_data->GetID(),
|
||||||
|
is_static_string,
|
||||||
|
inet_ntoa(in),
|
||||||
|
zone_server_data->GetPort(),
|
||||||
|
zone_server_data->NumPlayers(),
|
||||||
|
zone_server_data->GetCAddress(),
|
||||||
|
zone_server_data->GetCPort(),
|
||||||
|
zone_data_string,
|
||||||
|
zone_server_data->GetZoneOSProcessID()
|
||||||
|
);
|
||||||
|
|
||||||
if (outlen >= 3584) {
|
if (outlen >= 3584) {
|
||||||
connection->SendEmoteMessageRaw(to, 0, 0, 10, output);
|
connection->SendEmoteMessageRaw(to, 0, 0, 10, output);
|
||||||
safe_delete(output);
|
safe_delete(output);
|
||||||
@ -348,12 +375,12 @@ void ZSList::SendZoneStatus(const char* to, int16 admin, WorldTCPConnection* con
|
|||||||
}
|
}
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
else if (zs->GetZoneID() != 0) {
|
else if (zone_server_data->GetZoneID() != 0) {
|
||||||
if (zs->GetZoneID())
|
if (zone_server_data->GetZoneID())
|
||||||
strcpy(tmpZone, zs->GetZoneName());
|
strcpy(zone_data_string, zone_server_data->GetZoneName());
|
||||||
else
|
else
|
||||||
tmpZone[0] = 0;
|
zone_data_string[0] = 0;
|
||||||
AppendAnyLenString(&output, &outsize, &outlen, " #%i %s %s", zs->GetID(), tmpStatic, tmpZone);
|
AppendAnyLenString(&output, &outsize, &outlen, " #%i %s %s", zone_server_data->GetID(), is_static_string, zone_data_string);
|
||||||
if (outlen >= 3584) {
|
if (outlen >= 3584) {
|
||||||
connection->SendEmoteMessageRaw(to, 0, 0, 10, output);
|
connection->SendEmoteMessageRaw(to, 0, 0, 10, output);
|
||||||
safe_delete(output);
|
safe_delete(output);
|
||||||
@ -361,25 +388,32 @@ void ZSList::SendZoneStatus(const char* to, int16 admin, WorldTCPConnection* con
|
|||||||
outlen = 0;
|
outlen = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (connection->IsConsole())
|
if (connection->IsConsole()){
|
||||||
AppendAnyLenString(&output, &outsize, &outlen, "\r\n");
|
AppendAnyLenString(&output, &outsize, &outlen, "\r\n");
|
||||||
else
|
}
|
||||||
|
else{
|
||||||
AppendAnyLenString(&output, &outsize, &outlen, "^");
|
AppendAnyLenString(&output, &outsize, &outlen, "^");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
y++;
|
y++;
|
||||||
iterator.Advance();
|
iterator.Advance();
|
||||||
}
|
}
|
||||||
if (connection->IsConsole())
|
|
||||||
|
if (connection->IsConsole()){
|
||||||
AppendAnyLenString(&output, &outsize, &outlen, "%i servers listed. %i servers online.\r\n", x, y);
|
AppendAnyLenString(&output, &outsize, &outlen, "%i servers listed. %i servers online.\r\n", x, y);
|
||||||
else
|
}
|
||||||
|
else {
|
||||||
AppendAnyLenString(&output, &outsize, &outlen, "%i servers listed. %i servers online.^", x, y);
|
AppendAnyLenString(&output, &outsize, &outlen, "%i servers listed. %i servers online.^", x, y);
|
||||||
AppendAnyLenString(&output, &outsize, &outlen, "%i zones are static zones, %i zones are booted zones, %i zones available.",z,w,v);
|
}
|
||||||
// connection->SendEmoteMessage(to, 0, 0, "%i servers listed. %i servers online.", x, y);
|
|
||||||
// connection->SendEmoteMessage(to,0,0,"%i zones are static zones, %i zones are booted zones, %i zones available.",z,w,v);
|
AppendAnyLenString(&output, &outsize, &outlen, "%i zones are static zones, %i zones are booted zones, %i zones available.", z, w, v);
|
||||||
if (output)
|
|
||||||
|
if (output){
|
||||||
connection->SendEmoteMessageRaw(to, 0, 0, 10, output);
|
connection->SendEmoteMessageRaw(to, 0, 0, 10, output);
|
||||||
|
}
|
||||||
|
|
||||||
safe_delete(output);
|
safe_delete(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -49,20 +49,24 @@ extern QueryServConnection QSLink;
|
|||||||
void CatchSignal(int sig_num);
|
void CatchSignal(int sig_num);
|
||||||
|
|
||||||
ZoneServer::ZoneServer(EmuTCPConnection* itcpc)
|
ZoneServer::ZoneServer(EmuTCPConnection* itcpc)
|
||||||
: WorldTCPConnection(), tcpc(itcpc), ls_zboot(5000) {
|
: WorldTCPConnection(), tcpc(itcpc), zone_boot_timer(5000) {
|
||||||
ID = zoneserver_list.GetNextID();
|
|
||||||
|
/* Set Process tracking variable defaults */
|
||||||
|
|
||||||
memset(zone_name, 0, sizeof(zone_name));
|
memset(zone_name, 0, sizeof(zone_name));
|
||||||
memset(compiled, 0, sizeof(compiled));
|
memset(compiled, 0, sizeof(compiled));
|
||||||
zoneID = 0;
|
memset(client_address, 0, sizeof(client_address));
|
||||||
instanceID = 0;
|
memset(client_local_address, 0, sizeof(client_local_address));
|
||||||
|
|
||||||
memset(clientaddress, 0, sizeof(clientaddress));
|
zone_server_id = zoneserver_list.GetNextID();
|
||||||
memset(clientlocaladdress, 0, sizeof(clientlocaladdress));
|
zone_server_zone_id = 0;
|
||||||
clientport = 0;
|
instance_id = 0;
|
||||||
BootingUp = false;
|
zone_os_process_id = 0;
|
||||||
authenticated = false;
|
client_port = 0;
|
||||||
staticzone = false;
|
is_booting_up = false;
|
||||||
pNumPlayers = 0;
|
is_authenticated = false;
|
||||||
|
is_static_zone = false;
|
||||||
|
zone_player_count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZoneServer::~ZoneServer() {
|
ZoneServer::~ZoneServer() {
|
||||||
@ -72,7 +76,7 @@ ZoneServer::~ZoneServer() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
|
bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
|
||||||
BootingUp = false;
|
is_booting_up = false;
|
||||||
|
|
||||||
const char* zn = MakeLowerString(database.GetZoneName(iZoneID));
|
const char* zn = MakeLowerString(database.GetZoneName(iZoneID));
|
||||||
char* longname;
|
char* longname;
|
||||||
@ -81,17 +85,17 @@ bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
|
|||||||
Log.Out(Logs::Detail, Logs::World_Server,"Setting to '%s' (%d:%d)%s",(zn) ? zn : "",iZoneID, iInstanceID,
|
Log.Out(Logs::Detail, Logs::World_Server,"Setting to '%s' (%d:%d)%s",(zn) ? zn : "",iZoneID, iInstanceID,
|
||||||
iStaticZone ? " (Static)" : "");
|
iStaticZone ? " (Static)" : "");
|
||||||
|
|
||||||
zoneID = iZoneID;
|
zone_server_zone_id = iZoneID;
|
||||||
instanceID = iInstanceID;
|
instance_id = iInstanceID;
|
||||||
if(iZoneID!=0)
|
if(iZoneID!=0)
|
||||||
oldZoneID = iZoneID;
|
zone_server_previous_zone_id = iZoneID;
|
||||||
if (zoneID == 0) {
|
if (zone_server_zone_id == 0) {
|
||||||
client_list.CLERemoveZSRef(this);
|
client_list.CLERemoveZSRef(this);
|
||||||
pNumPlayers = 0;
|
zone_player_count = 0;
|
||||||
LSSleepUpdate(GetPrevZoneID());
|
LSSleepUpdate(GetPrevZoneID());
|
||||||
}
|
}
|
||||||
|
|
||||||
staticzone = iStaticZone;
|
is_static_zone = iStaticZone;
|
||||||
|
|
||||||
if (zn)
|
if (zn)
|
||||||
{
|
{
|
||||||
@ -111,7 +115,7 @@ bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
client_list.ZoneBootup(this);
|
client_list.ZoneBootup(this);
|
||||||
ls_zboot.Start();
|
zone_boot_timer.Start();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -172,19 +176,19 @@ void ZoneServer::LSSleepUpdate(uint32 zoneid){
|
|||||||
bool ZoneServer::Process() {
|
bool ZoneServer::Process() {
|
||||||
if (!tcpc->Connected())
|
if (!tcpc->Connected())
|
||||||
return false;
|
return false;
|
||||||
if(ls_zboot.Check()){
|
if(zone_boot_timer.Check()){
|
||||||
LSBootUpdate(GetZoneID(), true);
|
LSBootUpdate(GetZoneID(), true);
|
||||||
ls_zboot.Disable();
|
zone_boot_timer.Disable();
|
||||||
}
|
}
|
||||||
ServerPacket *pack = 0;
|
ServerPacket *pack = 0;
|
||||||
while((pack = tcpc->PopPacket())) {
|
while((pack = tcpc->PopPacket())) {
|
||||||
if (!authenticated) {
|
if (!is_authenticated) {
|
||||||
if (WorldConfig::get()->SharedKey.length() > 0) {
|
if (WorldConfig::get()->SharedKey.length() > 0) {
|
||||||
if (pack->opcode == ServerOP_ZAAuth && pack->size == 16) {
|
if (pack->opcode == ServerOP_ZAAuth && pack->size == 16) {
|
||||||
uint8 tmppass[16];
|
uint8 tmppass[16];
|
||||||
MD5::Generate((const uchar*) WorldConfig::get()->SharedKey.c_str(), WorldConfig::get()->SharedKey.length(), tmppass);
|
MD5::Generate((const uchar*) WorldConfig::get()->SharedKey.c_str(), WorldConfig::get()->SharedKey.length(), tmppass);
|
||||||
if (memcmp(pack->pBuffer, tmppass, 16) == 0)
|
if (memcmp(pack->pBuffer, tmppass, 16) == 0)
|
||||||
authenticated = true;
|
is_authenticated = true;
|
||||||
else {
|
else {
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
in.s_addr = GetIP();
|
in.s_addr = GetIP();
|
||||||
@ -210,7 +214,7 @@ bool ZoneServer::Process() {
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Log.Out(Logs::Detail, Logs::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthroized zone access.");
|
Log.Out(Logs::Detail, Logs::World_Server,"**WARNING** You have not configured a world shared key in your config file. You should add a <key>STRING</key> element to your <world> element to prevent unauthroized zone access.");
|
||||||
authenticated = true;
|
is_authenticated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch(pack->opcode) {
|
switch(pack->opcode) {
|
||||||
@ -582,29 +586,33 @@ bool ZoneServer::Process() {
|
|||||||
ServerConnectInfo* sci = (ServerConnectInfo*) pack->pBuffer;
|
ServerConnectInfo* sci = (ServerConnectInfo*) pack->pBuffer;
|
||||||
|
|
||||||
if (!sci->port) {
|
if (!sci->port) {
|
||||||
clientport = zoneserver_list.GetAvailableZonePort();
|
client_port = zoneserver_list.GetAvailableZonePort();
|
||||||
|
|
||||||
ServerPacket p(ServerOP_SetConnectInfo, sizeof(ServerConnectInfo));
|
ServerPacket p(ServerOP_SetConnectInfo, sizeof(ServerConnectInfo));
|
||||||
memset(p.pBuffer,0,sizeof(ServerConnectInfo));
|
memset(p.pBuffer,0,sizeof(ServerConnectInfo));
|
||||||
ServerConnectInfo* sci = (ServerConnectInfo*) p.pBuffer;
|
ServerConnectInfo* sci = (ServerConnectInfo*) p.pBuffer;
|
||||||
sci->port = clientport;
|
sci->port = client_port;
|
||||||
SendPacket(&p);
|
SendPacket(&p);
|
||||||
Log.Out(Logs::Detail, Logs::World_Server,"Auto zone port configuration. Telling zone to use port %d",clientport);
|
Log.Out(Logs::Detail, Logs::World_Server,"Auto zone port configuration. Telling zone to use port %d",client_port);
|
||||||
} else {
|
} else {
|
||||||
clientport = sci->port;
|
client_port = sci->port;
|
||||||
Log.Out(Logs::Detail, Logs::World_Server,"Zone specified port %d.",clientport);
|
Log.Out(Logs::Detail, Logs::World_Server,"Zone specified port %d.",client_port);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sci->address[0]) {
|
if(sci->address[0]) {
|
||||||
strn0cpy(clientaddress, sci->address, 250);
|
strn0cpy(client_address, sci->address, 250);
|
||||||
Log.Out(Logs::Detail, Logs::World_Server, "Zone specified address %s.", sci->address);
|
Log.Out(Logs::Detail, Logs::World_Server, "Zone specified address %s.", sci->address);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sci->local_address[0]) {
|
if(sci->local_address[0]) {
|
||||||
strn0cpy(clientlocaladdress, sci->local_address, 250);
|
strn0cpy(client_local_address, sci->local_address, 250);
|
||||||
Log.Out(Logs::Detail, Logs::World_Server, "Zone specified local address %s.", sci->address);
|
Log.Out(Logs::Detail, Logs::World_Server, "Zone specified local address %s.", sci->address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sci->process_id){
|
||||||
|
zone_os_process_id = sci->process_id;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
case ServerOP_SetLaunchName: {
|
case ServerOP_SetLaunchName: {
|
||||||
if(pack->size != sizeof(LaunchName_Struct))
|
if(pack->size != sizeof(LaunchName_Struct))
|
||||||
@ -1411,13 +1419,13 @@ void ZoneServer::ChangeWID(uint32 iCharID, uint32 iWID) {
|
|||||||
|
|
||||||
|
|
||||||
void ZoneServer::TriggerBootup(uint32 iZoneID, uint32 iInstanceID, const char* adminname, bool iMakeStatic) {
|
void ZoneServer::TriggerBootup(uint32 iZoneID, uint32 iInstanceID, const char* adminname, bool iMakeStatic) {
|
||||||
BootingUp = true;
|
is_booting_up = true;
|
||||||
zoneID = iZoneID;
|
zone_server_zone_id = iZoneID;
|
||||||
instanceID = iInstanceID;
|
instance_id = iInstanceID;
|
||||||
|
|
||||||
auto pack = new ServerPacket(ServerOP_ZoneBootup, sizeof(ServerZoneStateChange_struct));
|
auto pack = new ServerPacket(ServerOP_ZoneBootup, sizeof(ServerZoneStateChange_struct));
|
||||||
ServerZoneStateChange_struct* s = (ServerZoneStateChange_struct *) pack->pBuffer;
|
ServerZoneStateChange_struct* s = (ServerZoneStateChange_struct *) pack->pBuffer;
|
||||||
s->ZoneServerID = ID;
|
s->ZoneServerID = zone_server_id;
|
||||||
if (adminname != 0)
|
if (adminname != 0)
|
||||||
strcpy(s->adminname, adminname);
|
strcpy(s->adminname, adminname);
|
||||||
|
|
||||||
@ -1434,7 +1442,7 @@ void ZoneServer::TriggerBootup(uint32 iZoneID, uint32 iInstanceID, const char* a
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ZoneServer::IncomingClient(Client* client) {
|
void ZoneServer::IncomingClient(Client* client) {
|
||||||
BootingUp = true;
|
is_booting_up = true;
|
||||||
auto pack = new ServerPacket(ServerOP_ZoneIncClient, sizeof(ServerZoneIncomingClient_Struct));
|
auto pack = new ServerPacket(ServerOP_ZoneIncClient, sizeof(ServerZoneIncomingClient_Struct));
|
||||||
ServerZoneIncomingClient_Struct* s = (ServerZoneIncomingClient_Struct*) pack->pBuffer;
|
ServerZoneIncomingClient_Struct* s = (ServerZoneIncomingClient_Struct*) pack->pBuffer;
|
||||||
s->zoneid = GetZoneID();
|
s->zoneid = GetZoneID();
|
||||||
|
|||||||
@ -44,7 +44,7 @@ public:
|
|||||||
void LSBootUpdate(uint32 zoneid, uint32 iInstanceID = 0, bool startup = false);
|
void LSBootUpdate(uint32 zoneid, uint32 iInstanceID = 0, bool startup = false);
|
||||||
void LSSleepUpdate(uint32 zoneid);
|
void LSSleepUpdate(uint32 zoneid);
|
||||||
void LSShutDownUpdate(uint32 zoneid);
|
void LSShutDownUpdate(uint32 zoneid);
|
||||||
uint32 GetPrevZoneID() { return oldZoneID; }
|
uint32 GetPrevZoneID() { return zone_server_previous_zone_id; }
|
||||||
void ChangeWID(uint32 iCharID, uint32 iWID);
|
void ChangeWID(uint32 iCharID, uint32 iWID);
|
||||||
void SendGroupIDs();
|
void SendGroupIDs();
|
||||||
|
|
||||||
@ -52,41 +52,45 @@ public:
|
|||||||
inline const char* GetZoneLongName() const { return long_name; }
|
inline const char* GetZoneLongName() const { return long_name; }
|
||||||
const char* GetCompileTime() const{ return compiled; }
|
const char* GetCompileTime() const{ return compiled; }
|
||||||
void SetCompile(char* in_compile){ strcpy(compiled,in_compile); }
|
void SetCompile(char* in_compile){ strcpy(compiled,in_compile); }
|
||||||
inline uint32 GetZoneID() const { return zoneID; }
|
inline uint32 GetZoneID() const { return zone_server_zone_id; }
|
||||||
inline uint32 GetIP() const { return tcpc->GetrIP(); }
|
inline uint32 GetIP() const { return tcpc->GetrIP(); }
|
||||||
inline uint16 GetPort() const { return tcpc->GetrPort(); }
|
inline uint16 GetPort() const { return tcpc->GetrPort(); }
|
||||||
inline const char* GetCAddress() const { return clientaddress; }
|
inline const char* GetCAddress() const { return client_address; }
|
||||||
inline const char* GetCLocalAddress() const { return clientlocaladdress; }
|
inline const char* GetCLocalAddress() const { return client_local_address; }
|
||||||
inline uint16 GetCPort() const { return clientport; }
|
inline uint16 GetCPort() const { return client_port; }
|
||||||
inline uint32 GetID() const { return ID; }
|
inline uint32 GetID() const { return zone_server_id; }
|
||||||
inline bool IsBootingUp() const { return BootingUp; }
|
inline bool IsBootingUp() const { return is_booting_up; }
|
||||||
inline bool IsStaticZone() const{ return staticzone; }
|
inline bool IsStaticZone() const{ return is_static_zone; }
|
||||||
inline uint32 NumPlayers() const { return pNumPlayers; }
|
inline uint32 NumPlayers() const { return zone_player_count; }
|
||||||
inline void AddPlayer() { pNumPlayers++; }
|
inline void AddPlayer() { zone_player_count++; }
|
||||||
inline void RemovePlayer() { pNumPlayers--; }
|
inline void RemovePlayer() { zone_player_count--; }
|
||||||
inline const char * GetLaunchName() const { return(launcher_name.c_str()); }
|
inline const char * GetLaunchName() const { return(launcher_name.c_str()); }
|
||||||
inline const char * GetLaunchedName() const { return(launched_name.c_str()); }
|
inline const char * GetLaunchedName() const { return(launched_name.c_str()); }
|
||||||
|
|
||||||
inline uint32 GetInstanceID() { return instanceID; }
|
inline uint32 GetInstanceID() { return instance_id; }
|
||||||
inline void SetInstanceID(uint32 i) { instanceID = i; }
|
inline void SetInstanceID(uint32 i) { instance_id = i; }
|
||||||
|
|
||||||
|
inline uint32 GetZoneOSProcessID() { return zone_os_process_id; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EmuTCPConnection* const tcpc;
|
EmuTCPConnection* const tcpc;
|
||||||
|
|
||||||
uint32 ID;
|
uint32 zone_server_id;
|
||||||
char clientaddress[250];
|
char client_address[250];
|
||||||
char clientlocaladdress[250];
|
char client_local_address[250];
|
||||||
uint16 clientport;
|
uint16 client_port;
|
||||||
bool BootingUp;
|
bool is_booting_up;
|
||||||
bool staticzone;
|
bool is_static_zone;
|
||||||
bool authenticated;
|
bool is_authenticated;
|
||||||
uint32 pNumPlayers;
|
uint32 zone_player_count;
|
||||||
char compiled[25];
|
char compiled[25];
|
||||||
char zone_name[32];
|
char zone_name[32];
|
||||||
char long_name[256];
|
char long_name[256];
|
||||||
uint32 zoneID;
|
uint32 zone_server_zone_id;
|
||||||
uint32 oldZoneID;
|
uint32 zone_server_previous_zone_id;
|
||||||
Timer ls_zboot;
|
Timer zone_boot_timer;
|
||||||
uint32 instanceID; //instance ids contain a zone id, and a zone version
|
uint32 instance_id; //instance ids contain a zone id, and a zone version
|
||||||
|
uint32 zone_os_process_id;
|
||||||
std::string launcher_name; //the launcher which started us
|
std::string launcher_name; //the launcher which started us
|
||||||
std::string launched_name; //the name of the zone we launched.
|
std::string launched_name; //the name of the zone we launched.
|
||||||
};
|
};
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
#include "quest_parser_collection.h"
|
#include "quest_parser_collection.h"
|
||||||
#include "../common/string_util.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
|
// 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) {
|
Bot::Bot(NPCType npcTypeData, Client* botOwner) : NPC(&npcTypeData, nullptr, glm::vec4(), 0, false), rest_timer(1) {
|
||||||
|
|||||||
@ -53,7 +53,7 @@ extern volatile bool RunLoops;
|
|||||||
extern QueryServ* QServ;
|
extern QueryServ* QServ;
|
||||||
extern EntityList entity_list;
|
extern EntityList entity_list;
|
||||||
extern Zone* zone;
|
extern Zone* zone;
|
||||||
extern volatile bool ZoneLoaded;
|
extern volatile bool is_zone_loaded;
|
||||||
extern WorldServer worldserver;
|
extern WorldServer worldserver;
|
||||||
extern uint32 numclients;
|
extern uint32 numclients;
|
||||||
extern PetitionList petition_list;
|
extern PetitionList petition_list;
|
||||||
@ -371,7 +371,7 @@ Client::~Client() {
|
|||||||
GetTarget()->IsTargeted(-1);
|
GetTarget()->IsTargeted(-1);
|
||||||
|
|
||||||
//if we are in a group and we are not zoning, force leave the group
|
//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();
|
LeaveGroup();
|
||||||
|
|
||||||
UpdateWho(2);
|
UpdateWho(2);
|
||||||
|
|||||||
@ -66,7 +66,7 @@
|
|||||||
|
|
||||||
extern QueryServ* QServ;
|
extern QueryServ* QServ;
|
||||||
extern Zone* zone;
|
extern Zone* zone;
|
||||||
extern volatile bool ZoneLoaded;
|
extern volatile bool is_zone_loaded;
|
||||||
extern WorldServer worldserver;
|
extern WorldServer worldserver;
|
||||||
extern PetitionList petition_list;
|
extern PetitionList petition_list;
|
||||||
extern EntityList entity_list;
|
extern EntityList entity_list;
|
||||||
|
|||||||
@ -55,7 +55,7 @@
|
|||||||
|
|
||||||
extern QueryServ* QServ;
|
extern QueryServ* QServ;
|
||||||
extern Zone* zone;
|
extern Zone* zone;
|
||||||
extern volatile bool ZoneLoaded;
|
extern volatile bool is_zone_loaded;
|
||||||
extern WorldServer worldserver;
|
extern WorldServer worldserver;
|
||||||
extern PetitionList petition_list;
|
extern PetitionList petition_list;
|
||||||
extern EntityList entity_list;
|
extern EntityList entity_list;
|
||||||
|
|||||||
@ -51,7 +51,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern Zone *zone;
|
extern Zone *zone;
|
||||||
extern volatile bool ZoneLoaded;
|
extern volatile bool is_zone_loaded;
|
||||||
extern WorldServer worldserver;
|
extern WorldServer worldserver;
|
||||||
extern NetConnection net;
|
extern NetConnection net;
|
||||||
extern uint32 numclients;
|
extern uint32 numclients;
|
||||||
@ -2340,7 +2340,7 @@ void EntityList::Clear()
|
|||||||
|
|
||||||
void EntityList::UpdateWho(bool iSendFullUpdate)
|
void EntityList::UpdateWho(bool iSendFullUpdate)
|
||||||
{
|
{
|
||||||
if ((!worldserver.Connected()) || !ZoneLoaded)
|
if ((!worldserver.Connected()) || !is_zone_loaded)
|
||||||
return;
|
return;
|
||||||
uint32 tmpNumUpdates = numclients + 5;
|
uint32 tmpNumUpdates = numclients + 5;
|
||||||
ServerPacket* pack = 0;
|
ServerPacket* pack = 0;
|
||||||
|
|||||||
@ -29,7 +29,7 @@ ZoneGuildManager guild_mgr;
|
|||||||
GuildBankManager *GuildBanks;
|
GuildBankManager *GuildBanks;
|
||||||
|
|
||||||
extern WorldServer worldserver;
|
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) {
|
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);
|
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:
|
case ServerOP_GuildRankUpdate:
|
||||||
{
|
{
|
||||||
if(ZoneLoaded)
|
if(is_zone_loaded)
|
||||||
{
|
{
|
||||||
if(pack->size != sizeof(ServerGuildRankUpdate_Struct))
|
if(pack->size != sizeof(ServerGuildRankUpdate_Struct))
|
||||||
{
|
{
|
||||||
@ -388,7 +388,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
|||||||
{
|
{
|
||||||
ServerGuildMemberUpdate_Struct *sgmus = (ServerGuildMemberUpdate_Struct*)pack->pBuffer;
|
ServerGuildMemberUpdate_Struct *sgmus = (ServerGuildMemberUpdate_Struct*)pack->pBuffer;
|
||||||
|
|
||||||
if(ZoneLoaded)
|
if(is_zone_loaded)
|
||||||
{
|
{
|
||||||
EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildMemberUpdate, sizeof(GuildMemberUpdate_Struct));
|
EQApplicationPacket *outapp = new EQApplicationPacket(OP_GuildMemberUpdate, sizeof(GuildMemberUpdate_Struct));
|
||||||
|
|
||||||
@ -407,7 +407,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ServerOP_OnlineGuildMembersResponse:
|
case ServerOP_OnlineGuildMembersResponse:
|
||||||
if (ZoneLoaded)
|
if (is_zone_loaded)
|
||||||
{
|
{
|
||||||
char *Buffer = (char *)pack->pBuffer;
|
char *Buffer = (char *)pack->pBuffer;
|
||||||
|
|
||||||
@ -443,7 +443,7 @@ void ZoneGuildManager::ProcessWorldPacket(ServerPacket *pack) {
|
|||||||
|
|
||||||
case ServerOP_LFGuildUpdate:
|
case ServerOP_LFGuildUpdate:
|
||||||
{
|
{
|
||||||
if(ZoneLoaded)
|
if(is_zone_loaded)
|
||||||
{
|
{
|
||||||
char GuildName[33];
|
char GuildName[33];
|
||||||
char Comments[257];
|
char Comments[257];
|
||||||
|
|||||||
@ -18,7 +18,7 @@
|
|||||||
#include "../common/string_util.h"
|
#include "../common/string_util.h"
|
||||||
#include "../common/rulesys.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)
|
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)
|
: 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);
|
merc->SetFollowID(0);
|
||||||
|
|
||||||
if (group->GroupCount() <= 2 && merc->GetGroup() == group && ZoneLoaded)
|
if (group->GroupCount() <= 2 && merc->GetGroup() == group && is_zone_loaded)
|
||||||
{
|
{
|
||||||
group->DisbandGroup();
|
group->DisbandGroup();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,7 +84,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
volatile bool RunLoops = true;
|
volatile bool RunLoops = true;
|
||||||
extern volatile bool ZoneLoaded;
|
extern volatile bool is_zone_loaded;
|
||||||
|
|
||||||
TimeoutManager timeout_manager;
|
TimeoutManager timeout_manager;
|
||||||
NetConnection net;
|
NetConnection net;
|
||||||
@ -437,12 +437,12 @@ int main(int argc, char** argv) {
|
|||||||
worldwasconnected = true;
|
worldwasconnected = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (worldwasconnected && ZoneLoaded)
|
if (worldwasconnected && is_zone_loaded)
|
||||||
entity_list.ChannelMessageFromWorld(0, 0, 6, 0, 0, "WARNING: World server connection lost");
|
entity_list.ChannelMessageFromWorld(0, 0, 6, 0, 0, "WARNING: World server connection lost");
|
||||||
worldwasconnected = false;
|
worldwasconnected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ZoneLoaded && zoneupdate_timer.Check()) {
|
if (is_zone_loaded && zoneupdate_timer.Check()) {
|
||||||
{
|
{
|
||||||
if(net.group_timer.Enabled() && net.group_timer.Check())
|
if(net.group_timer.Enabled() && net.group_timer.Check())
|
||||||
entity_list.GroupProcess();
|
entity_list.GroupProcess();
|
||||||
|
|||||||
@ -53,7 +53,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern Zone* zone;
|
extern Zone* zone;
|
||||||
extern volatile bool ZoneLoaded;
|
extern volatile bool is_zone_loaded;
|
||||||
extern EntityList entity_list;
|
extern EntityList entity_list;
|
||||||
|
|
||||||
NPC::NPC(const NPCType* d, Spawn2* in_respawn, const glm::vec4& position, int iflymode, bool IsCorpse)
|
NPC::NPC(const NPCType* d, Spawn2* in_respawn, const glm::vec4& position, int iflymode, bool IsCorpse)
|
||||||
|
|||||||
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
|
|
||||||
extern Zone* zone;
|
extern Zone* zone;
|
||||||
extern volatile bool ZoneLoaded;
|
extern volatile bool is_zone_loaded;
|
||||||
extern WorldServer worldserver;
|
extern WorldServer worldserver;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -101,7 +101,7 @@ Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
|||||||
|
|
||||||
|
|
||||||
extern Zone* zone;
|
extern Zone* zone;
|
||||||
extern volatile bool ZoneLoaded;
|
extern volatile bool is_zone_loaded;
|
||||||
extern WorldServer worldserver;
|
extern WorldServer worldserver;
|
||||||
|
|
||||||
// this is run constantly for every mob
|
// this is run constantly for every mob
|
||||||
|
|||||||
@ -53,7 +53,7 @@
|
|||||||
|
|
||||||
extern EntityList entity_list;
|
extern EntityList entity_list;
|
||||||
extern Zone* zone;
|
extern Zone* zone;
|
||||||
extern volatile bool ZoneLoaded;
|
extern volatile bool is_zone_loaded;
|
||||||
extern void CatchSignal(int);
|
extern void CatchSignal(int);
|
||||||
extern WorldServer worldserver;
|
extern WorldServer worldserver;
|
||||||
extern NetConnection net;
|
extern NetConnection net;
|
||||||
@ -85,7 +85,7 @@ WorldServer::~WorldServer() {
|
|||||||
safe_delete(pack);
|
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));
|
ServerPacket* pack = new ServerPacket(ServerOP_SetZone, sizeof(SetZone_Struct));
|
||||||
SetZone_Struct* szs = (SetZone_Struct*) pack->pBuffer;
|
SetZone_Struct* szs = (SetZone_Struct*) pack->pBuffer;
|
||||||
szs->zoneid = iZoneID;
|
szs->zoneid = iZoneID;
|
||||||
@ -99,10 +99,9 @@ void WorldServer::SetZone(uint32 iZoneID, uint32 iInstanceID) {
|
|||||||
|
|
||||||
void WorldServer::OnConnected() {
|
void WorldServer::OnConnected() {
|
||||||
WorldConnection::OnConnected();
|
WorldConnection::OnConnected();
|
||||||
|
|
||||||
ServerPacket* pack;
|
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));
|
pack = new ServerPacket(ServerOP_SetLaunchName,sizeof(LaunchName_Struct));
|
||||||
LaunchName_Struct* ln = (LaunchName_Struct*)pack->pBuffer;
|
LaunchName_Struct* ln = (LaunchName_Struct*)pack->pBuffer;
|
||||||
strn0cpy(ln->launcher_name, m_launcherName.c_str(), 32);
|
strn0cpy(ln->launcher_name, m_launcherName.c_str(), 32);
|
||||||
@ -110,28 +109,38 @@ void WorldServer::OnConnected() {
|
|||||||
SendPacket(pack);
|
SendPacket(pack);
|
||||||
safe_delete(pack);
|
safe_delete(pack);
|
||||||
|
|
||||||
|
/* Tell the Worldserver basic information about this zone process */
|
||||||
pack = new ServerPacket(ServerOP_SetConnectInfo, sizeof(ServerConnectInfo));
|
pack = new ServerPacket(ServerOP_SetConnectInfo, sizeof(ServerConnectInfo));
|
||||||
ServerConnectInfo* sci = (ServerConnectInfo*) pack->pBuffer;
|
ServerConnectInfo* sci = (ServerConnectInfo*) pack->pBuffer;
|
||||||
|
|
||||||
auto config = ZoneConfig::get();
|
auto config = ZoneConfig::get();
|
||||||
sci->port = ZoneConfig::get()->ZonePort;
|
sci->port = ZoneConfig::get()->ZonePort;
|
||||||
if(config->WorldAddress.length() > 0) {
|
if(config->WorldAddress.length() > 0) {
|
||||||
strn0cpy(sci->address, config->WorldAddress.c_str(), 250);
|
strn0cpy(sci->address, config->WorldAddress.c_str(), 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(config->LocalAddress.length() > 0) {
|
if(config->LocalAddress.length() > 0) {
|
||||||
strn0cpy(sci->local_address, config->LocalAddress.c_str(), 250);
|
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);
|
SendPacket(pack);
|
||||||
safe_delete(pack);
|
safe_delete(pack);
|
||||||
|
|
||||||
if (ZoneLoaded) {
|
if (is_zone_loaded) {
|
||||||
this->SetZone(zone->GetZoneID(), zone->GetInstanceID());
|
this->SetZoneData(zone->GetZoneID(), zone->GetInstanceID());
|
||||||
entity_list.UpdateWho(true);
|
entity_list.UpdateWho(true);
|
||||||
this->SendEmoteMessage(0, 0, 15, "Zone connect: %s", zone->GetLongName());
|
this->SendEmoteMessage(0, 0, 15, "Zone connect: %s", zone->GetLongName());
|
||||||
zone->GetTimeSync();
|
zone->GetTimeSync();
|
||||||
} else {
|
}
|
||||||
this->SetZone(0);
|
else {
|
||||||
|
this->SetZoneData(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
pack = new ServerPacket(ServerOP_LSZoneBoot,sizeof(ZoneBoot_Struct));
|
pack = new ServerPacket(ServerOP_LSZoneBoot,sizeof(ZoneBoot_Struct));
|
||||||
@ -174,7 +183,7 @@ void WorldServer::Process() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ServerOP_ChannelMessage: {
|
case ServerOP_ChannelMessage: {
|
||||||
if (!ZoneLoaded)
|
if (!is_zone_loaded)
|
||||||
break;
|
break;
|
||||||
ServerChannelMessage_Struct* scm = (ServerChannelMessage_Struct*) pack->pBuffer;
|
ServerChannelMessage_Struct* scm = (ServerChannelMessage_Struct*) pack->pBuffer;
|
||||||
if (scm->deliverto[0] == 0) {
|
if (scm->deliverto[0] == 0) {
|
||||||
@ -207,7 +216,7 @@ void WorldServer::Process() {
|
|||||||
}
|
}
|
||||||
case ServerOP_VoiceMacro: {
|
case ServerOP_VoiceMacro: {
|
||||||
|
|
||||||
if (!ZoneLoaded)
|
if (!is_zone_loaded)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ServerVoiceMacro_Struct* svm = (ServerVoiceMacro_Struct*) pack->pBuffer;
|
ServerVoiceMacro_Struct* svm = (ServerVoiceMacro_Struct*) pack->pBuffer;
|
||||||
@ -264,7 +273,7 @@ void WorldServer::Process() {
|
|||||||
case ServerOP_SpawnCondition: {
|
case ServerOP_SpawnCondition: {
|
||||||
if(pack->size != sizeof(ServerSpawnCondition_Struct))
|
if(pack->size != sizeof(ServerSpawnCondition_Struct))
|
||||||
break;
|
break;
|
||||||
if (!ZoneLoaded)
|
if (!is_zone_loaded)
|
||||||
break;
|
break;
|
||||||
ServerSpawnCondition_Struct* ssc = (ServerSpawnCondition_Struct*) pack->pBuffer;
|
ServerSpawnCondition_Struct* ssc = (ServerSpawnCondition_Struct*) pack->pBuffer;
|
||||||
|
|
||||||
@ -274,7 +283,7 @@ void WorldServer::Process() {
|
|||||||
case ServerOP_SpawnEvent: {
|
case ServerOP_SpawnEvent: {
|
||||||
if(pack->size != sizeof(ServerSpawnEvent_Struct))
|
if(pack->size != sizeof(ServerSpawnEvent_Struct))
|
||||||
break;
|
break;
|
||||||
if (!ZoneLoaded)
|
if (!is_zone_loaded)
|
||||||
break;
|
break;
|
||||||
ServerSpawnEvent_Struct* sse = (ServerSpawnEvent_Struct*) pack->pBuffer;
|
ServerSpawnEvent_Struct* sse = (ServerSpawnEvent_Struct*) pack->pBuffer;
|
||||||
|
|
||||||
@ -285,7 +294,7 @@ void WorldServer::Process() {
|
|||||||
case ServerOP_AcceptWorldEntrance: {
|
case ServerOP_AcceptWorldEntrance: {
|
||||||
if(pack->size != sizeof(WorldToZone_Struct))
|
if(pack->size != sizeof(WorldToZone_Struct))
|
||||||
break;
|
break;
|
||||||
if (!ZoneLoaded)
|
if (!is_zone_loaded)
|
||||||
break;
|
break;
|
||||||
WorldToZone_Struct* wtz = (WorldToZone_Struct*) pack->pBuffer;
|
WorldToZone_Struct* wtz = (WorldToZone_Struct*) pack->pBuffer;
|
||||||
|
|
||||||
@ -300,7 +309,7 @@ void WorldServer::Process() {
|
|||||||
case ServerOP_ZoneToZoneRequest: {
|
case ServerOP_ZoneToZoneRequest: {
|
||||||
if(pack->size != sizeof(ZoneToZone_Struct))
|
if(pack->size != sizeof(ZoneToZone_Struct))
|
||||||
break;
|
break;
|
||||||
if (!ZoneLoaded)
|
if (!is_zone_loaded)
|
||||||
break;
|
break;
|
||||||
ZoneToZone_Struct* ztz = (ZoneToZone_Struct*) pack->pBuffer;
|
ZoneToZone_Struct* ztz = (ZoneToZone_Struct*) pack->pBuffer;
|
||||||
|
|
||||||
@ -376,7 +385,7 @@ void WorldServer::Process() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ServerOP_WhoAllReply:{
|
case ServerOP_WhoAllReply:{
|
||||||
if(!ZoneLoaded)
|
if(!is_zone_loaded)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
@ -403,7 +412,7 @@ void WorldServer::Process() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ServerOP_EmoteMessage: {
|
case ServerOP_EmoteMessage: {
|
||||||
if (!ZoneLoaded)
|
if (!is_zone_loaded)
|
||||||
break;
|
break;
|
||||||
ServerEmoteMessage_Struct* sem = (ServerEmoteMessage_Struct*) pack->pBuffer;
|
ServerEmoteMessage_Struct* sem = (ServerEmoteMessage_Struct*) pack->pBuffer;
|
||||||
if (sem->to[0] != 0) {
|
if (sem->to[0] != 0) {
|
||||||
@ -461,8 +470,8 @@ void WorldServer::Process() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Annouce the change to the world
|
// Annouce the change to the world
|
||||||
if (!ZoneLoaded) {
|
if (!is_zone_loaded) {
|
||||||
SetZone(0);
|
SetZoneData(0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SendEmoteMessage(0, 0, 15, "Zone shutdown: %s", zone->GetLongName());
|
SendEmoteMessage(0, 0, 15, "Zone shutdown: %s", zone->GetLongName());
|
||||||
@ -479,8 +488,8 @@ void WorldServer::Process() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ServerZoneStateChange_struct* zst = (ServerZoneStateChange_struct *) pack->pBuffer;
|
ServerZoneStateChange_struct* zst = (ServerZoneStateChange_struct *) pack->pBuffer;
|
||||||
if (ZoneLoaded) {
|
if (is_zone_loaded) {
|
||||||
SetZone(zone->GetZoneID(), zone->GetInstanceID());
|
SetZoneData(zone->GetZoneID(), zone->GetInstanceID());
|
||||||
if (zst->zoneid == zone->GetZoneID()) {
|
if (zst->zoneid == zone->GetZoneID()) {
|
||||||
// This packet also doubles as "incoming client" notification, lets not shut down before they get here
|
// This packet also doubles as "incoming client" notification, lets not shut down before they get here
|
||||||
zone->StartShutdownTimer(AUTHENTICATION_TIMEOUT * 1000);
|
zone->StartShutdownTimer(AUTHENTICATION_TIMEOUT * 1000);
|
||||||
@ -503,8 +512,8 @@ void WorldServer::Process() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ServerZoneIncomingClient_Struct* szic = (ServerZoneIncomingClient_Struct*) pack->pBuffer;
|
ServerZoneIncomingClient_Struct* szic = (ServerZoneIncomingClient_Struct*) pack->pBuffer;
|
||||||
if (ZoneLoaded) {
|
if (is_zone_loaded) {
|
||||||
SetZone(zone->GetZoneID(), zone->GetInstanceID());
|
SetZoneData(zone->GetZoneID(), zone->GetInstanceID());
|
||||||
if (szic->zoneid == zone->GetZoneID()) {
|
if (szic->zoneid == zone->GetZoneID()) {
|
||||||
zone->AddAuth(szic);
|
zone->AddAuth(szic);
|
||||||
// This packet also doubles as "incoming client" notification, lets not shut down before they get here
|
// 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 (client != 0) {
|
||||||
if (skp->adminrank >= client->Admin()) {
|
if (skp->adminrank >= client->Admin()) {
|
||||||
client->WorldKick();
|
client->WorldKick();
|
||||||
if (ZoneLoaded)
|
if (is_zone_loaded)
|
||||||
SendEmoteMessage(skp->adminname, 0, 0, "Remote Kick: %s booted in zone %s.", skp->name, zone->GetShortName());
|
SendEmoteMessage(skp->adminname, 0, 0, "Remote Kick: %s booted in zone %s.", skp->name, zone->GetShortName());
|
||||||
else
|
else
|
||||||
SendEmoteMessage(skp->adminname, 0, 0, "Remote Kick: %s booted.", skp->name);
|
SendEmoteMessage(skp->adminname, 0, 0, "Remote Kick: %s booted.", skp->name);
|
||||||
@ -556,7 +565,7 @@ void WorldServer::Process() {
|
|||||||
if (client != 0) {
|
if (client != 0) {
|
||||||
if (skp->admin >= client->Admin()) {
|
if (skp->admin >= client->Admin()) {
|
||||||
client->GMKill();
|
client->GMKill();
|
||||||
if (ZoneLoaded)
|
if (is_zone_loaded)
|
||||||
SendEmoteMessage(skp->gmname, 0, 0, "Remote Kill: %s killed in zone %s.", skp->target, zone->GetShortName());
|
SendEmoteMessage(skp->gmname, 0, 0, "Remote Kill: %s killed in zone %s.", skp->target, zone->GetShortName());
|
||||||
else
|
else
|
||||||
SendEmoteMessage(skp->gmname, 0, 0, "Remote Kill: %s killed.", skp->target);
|
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;
|
std::cout << "Wrong size on ServerOP_GMGoto. Got: " << pack->size << ", Expected: " << sizeof(ServerGMGoto_Struct) << std::endl;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!ZoneLoaded)
|
if (!is_zone_loaded)
|
||||||
break;
|
break;
|
||||||
ServerGMGoto_Struct* gmg = (ServerGMGoto_Struct*) pack->pBuffer;
|
ServerGMGoto_Struct* gmg = (ServerGMGoto_Struct*) pack->pBuffer;
|
||||||
Client* client = entity_list.GetClientByName(gmg->gotoname);
|
Client* client = entity_list.GetClientByName(gmg->gotoname);
|
||||||
|
|||||||
@ -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, uint32 type, const char* message, ...);
|
||||||
bool SendEmoteMessage(const char* to, uint32 to_guilddbid, int16 to_minstatus, 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);
|
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();
|
uint32 SendGroupIdRequest();
|
||||||
bool RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 dbid, uint16 opcode);
|
bool RezzPlayer(EQApplicationPacket* rpack, uint32 rezzexp, uint32 dbid, uint16 opcode);
|
||||||
bool IsOOCMuted() const { return(oocmuted); }
|
bool IsOOCMuted() const { return(oocmuted); }
|
||||||
|
|||||||
@ -74,7 +74,7 @@ extern Zone* zone;
|
|||||||
|
|
||||||
Mutex MZoneShutdown;
|
Mutex MZoneShutdown;
|
||||||
|
|
||||||
volatile bool ZoneLoaded = false;
|
volatile bool is_zone_loaded = false;
|
||||||
Zone* zone = 0;
|
Zone* zone = 0;
|
||||||
|
|
||||||
bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
|
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)
|
if (iZoneID == 0 || zonename == 0)
|
||||||
return false;
|
return false;
|
||||||
if (zone != 0 || ZoneLoaded) {
|
if (zone != 0 || is_zone_loaded) {
|
||||||
std::cerr << "Error: Zone::Bootup call when zone already booted!" << std::endl;
|
std::cerr << "Error: Zone::Bootup call when zone already booted!" << std::endl;
|
||||||
worldserver.SetZone(0);
|
worldserver.SetZoneData(0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ bool Zone::Bootup(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
|
|||||||
if (!zone->Init(iStaticZone)) {
|
if (!zone->Init(iStaticZone)) {
|
||||||
safe_delete(zone);
|
safe_delete(zone);
|
||||||
std::cerr << "Zone->Init failed" << std::endl;
|
std::cerr << "Zone->Init failed" << std::endl;
|
||||||
worldserver.SetZone(0);
|
worldserver.SetZoneData(0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
zone->zonemap = Map::LoadMapFile(zone->map_name);
|
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)
|
if(iInstanceID != 0)
|
||||||
{
|
{
|
||||||
ServerPacket *pack = new ServerPacket(ServerOP_AdventureZoneData, sizeof(uint16));
|
ServerPacket *pack = new ServerPacket(ServerOP_AdventureZoneData, sizeof(uint16));
|
||||||
@ -660,12 +660,12 @@ void Zone::LoadMercSpells(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Zone::IsLoaded() {
|
bool Zone::IsLoaded() {
|
||||||
return ZoneLoaded;
|
return is_zone_loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Zone::Shutdown(bool quite)
|
void Zone::Shutdown(bool quite)
|
||||||
{
|
{
|
||||||
if (!ZoneLoaded)
|
if (!is_zone_loaded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
entity_list.StopMobAI();
|
entity_list.StopMobAI();
|
||||||
@ -699,7 +699,7 @@ void Zone::Shutdown(bool quite)
|
|||||||
zone->SetZoneHasCurrentTime(false);
|
zone->SetZoneHasCurrentTime(false);
|
||||||
if (!quite)
|
if (!quite)
|
||||||
Log.Out(Logs::General, Logs::Normal, "Zone shutdown: going to sleep");
|
Log.Out(Logs::General, Logs::Normal, "Zone shutdown: going to sleep");
|
||||||
ZoneLoaded = false;
|
is_zone_loaded = false;
|
||||||
|
|
||||||
zone->ResetAuth();
|
zone->ResetAuth();
|
||||||
safe_delete(zone);
|
safe_delete(zone);
|
||||||
@ -846,7 +846,7 @@ Zone::~Zone() {
|
|||||||
safe_delete(watermap);
|
safe_delete(watermap);
|
||||||
safe_delete(pathing);
|
safe_delete(pathing);
|
||||||
if (worldserver.Connected()) {
|
if (worldserver.Connected()) {
|
||||||
worldserver.SetZone(0);
|
worldserver.SetZoneData(0);
|
||||||
}
|
}
|
||||||
safe_delete_array(short_name);
|
safe_delete_array(short_name);
|
||||||
safe_delete_array(long_name);
|
safe_delete_array(long_name);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user