Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #1  
Old 03-31-2016, 03:47 PM
superemu
Sarnak
 
Join Date: May 2014
Posts: 79
Default Fix to #zone to handle nektulos instances

Hi all. Noobie here. I posted this on the PEQ forums and figured I should post it here as well. I hope I am doing this right.

I noticed that with the current release of the database and the current EQEmulator code, using #zone to go to nektulos with the Underfoot client would place the player in the wrong instance of nek. The terrain would be right since the UF eqg file is the new version of the zone. However, the NPC and object placement would be all wrong. Bridge guards would be swimming in the river, the PoK book would be gone, the zones wouldn't work, etc. Doing the same zone command in the Titanium client worked properly, because it was putting the player in the old version of zone. The problem is that the EQEmulator zone command code does not account for zone instances. New nek is run as an instance (instance number 1).

I endeavored to change the code to handle the zone command to nek the same way the doors and zone-points tables handle it. I needed a mapping between instance number and client version mask for each zone that can be instanced (in this case, only nektulos). I figured that I could add a client_version_mask column to the zone table that would be used to determine which instance of the zone to zone to based on the version of the current client being run. But rather than change the structure of an existing system table I decided to add a new table called 'zone_command_instances'.

Here is the SQL to create the table and build the nektulos records and the changed version for the zone command code (in zone\command.cpp):

Code:
create table if not exists zone_command_instances
(
	zoneidnumber int(4),
	instance smallint(5) unsigned,
	client_version_mask int(10) unsigned default '4294967295',
	index zoneidnumber (zoneidnumber),
	unique index zoneinstance (zoneidnumber, instance)
);

insert into zone_command_instances
(zoneidnumber, instance, client_version_mask)
values
(25, 0, 3),
(25, 1, 4294967292)
on duplicate key update client_version_mask = values(client_version_mask);
Code:
diff --git a/zone/command.cpp b/zone/command.cpp
index dbbed07..5ec733a 100644
--- a/zone/command.cpp
+++ b/zone/command.cpp
@@ -1094,13 +1094,26 @@ void command_zone(Client *c, const Seperator *sep)
 		Bot::ProcessClientZoneChange(c);
 #endif
 
+	// Yarko 3/31/2016 - Use new zone_command_instances table to determine which version of the zone to go to
+	uint32 instance = 0;
+	std::string query = StringFormat("SELECT instance FROM zone_command_instances WHERE zoneidnumber = %i AND client_version_mask & %i", zoneid, c->GetClientVersionBit());
+	auto results = database.QueryDatabase(query);
+	if (results.Success() && results.RowCount() > 0) {
+		instance = atoi(results.begin()[0]);
+	}
+	// End Yarko update
+
 	if (sep->IsNumber(2) || sep->IsNumber(3) || sep->IsNumber(4)){
 		//zone to specific coords
-		c->MovePC(zoneid, (float)atof(sep->arg[2]), atof(sep->arg[3]), atof(sep->arg[4]), 0.0f, 0);
-		}
+		// Yarko 3/31/2016 - include instance number
+		//c->MovePC(zoneid, (float)atof(sep->arg[2]), atof(sep->arg[3]), atof(sep->arg[4]), 0.0f, 0);
+		c->MovePC(zoneid, instance, (float)atof(sep->arg[2]), atof(sep->arg[3]), atof(sep->arg[4]), 0.0f, 0);
+	}
 	else
 		//zone to safe coords
-		c->MovePC(zoneid, 0.0f, 0.0f, 0.0f, 0.0f, 0, ZoneToSafeCoords);
+		// Yarko 3/31/2016 - include instance number
+		//c->MovePC(zoneid, 0.0f, 0.0f, 0.0f, 0.0f, 0, ZoneToSafeCoords);
+		c->MovePC(zoneid, instance, 0.0f, 0.0f, 0.0f, 0.0f, 0, ZoneToSafeCoords);
 }
 
 //todo: fix this so it checks if you're in the instance set
Reply With Quote
  #2  
Old 03-31-2016, 05:47 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,497
Default

I thought there was a zone instance type command.
Reply With Quote
  #3  
Old 03-31-2016, 05:50 PM
Kingly_Krab
Administrator
 
Join Date: May 2013
Location: United States
Posts: 1,594
Default

There is, #zoneinstance.
Reply With Quote
  #4  
Old 03-31-2016, 07:30 PM
superemu
Sarnak
 
Join Date: May 2014
Posts: 79
Default

Ah. Thank you for pointing that out. I actually didn't see that command until after I was done with the work I did! It's ok, though. I wanted the #zone command to choose which version automatically based on the running client version as the PoK book does. So, I am still happy with my work.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 08:41 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3