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