Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Development > Archive::Tools

Archive::Tools Archive area for Tools's posts that were moved here after an inactivity period of 90 days.

Reply
 
Thread Tools Display Modes
  #1  
Old 01-29-2004, 02:23 AM
farce
Hill Giant
 
Join Date: Feb 2003
Posts: 126
Default

here ya go:

Code:
diff -r -C 5 53_dr3_orig/common/database.cpp 53_dr3_zp/common/database.cpp
*** 53_dr3_orig/common/database.cpp	2004-01-24 15:30:30.000000000 -0600
--- 53_dr3_zp/common/database.cpp	2004-01-28 14:19:25.000000000 -0600
***************
*** 6114,6123 ****
--- 6114,6177 ----
  	}
  	return true;
  }
  #endif
  
+ #ifdef ZONEPROXY
+ // Function to return whether a zone is third-party or not.  This is so the server knows
+ // whether it needs to use ZoneProxy to swap zones.
+ int8 Database::GetZoneThirdParty(const char* zonename) {
+     char errbuf[MYSQL_ERRMSG_SIZE];
+     char *query = 0;
+     MYSQL_RES *result;
+     MYSQL_ROW row;
+                                                                                                                                                 
+     if (RunQuery(query, MakeAnyLenString(&query, "SELECT thirdparty FROM zone WHERE short_name='%s'", zonename), errbuf, &result))
+     {
+         delete[] query;
+         if (mysql_num_rows(result) == 1) {
+             row = mysql_fetch_row(result);
+             int8 tmp = atoi(row[0]);
+             mysql_free_result(result);
+             return tmp;
+         }
+         mysql_free_result(result);
+     }
+                                                                                                                                                 
+     else {
+         cerr << "Error in GetZoneThirdParty query '" << query << "' " << errbuf << endl;
+         delete[] query;
+     }
+     return 0;
+ }
+                                                                                                                                                 
+ int8 Database::GetZoneThirdPartyByID(int32 zoneid) {
+     char errbuf[MYSQL_ERRMSG_SIZE];
+     char *query = 0;
+     MYSQL_RES *result;
+     MYSQL_ROW row;
+                                                                                                                                                 
+     if (RunQuery(query, MakeAnyLenString(&query, "SELECT thirdparty FROM zone WHERE zoneidnumber=%i", zoneid), errbuf, &result))
+     {
+         delete[] query;
+         if (mysql_num_rows(result) == 1) {
+             row = mysql_fetch_row(result);
+             int8 tmp = atoi(row[0]);
+             mysql_free_result(result);
+             return tmp;
+         }
+         mysql_free_result(result);
+     }
+                                                                                                                                                 
+     else {
+         cerr << "Error in GetZoneThirdPartyByID query '" << query << "' " << errbuf << endl;
+         delete[] query;
+     }
+     return 0;
+ }
+ #endif
+ 
  //Functions for weather
  int8 Database::GetZoneW(int32 zoneid) {
  	char errbuf[MYSQL_ERRMSG_SIZE];
      char *query = 0;
      MYSQL_RES *result;
diff -r -C 5 53_dr3_orig/common/database.h 53_dr3_zp/common/database.h
*** 53_dr3_orig/common/database.h	2004-01-24 15:30:40.000000000 -0600
--- 53_dr3_zp/common/database.h	2004-01-28 14:20:03.000000000 -0600
***************
*** 180,189 ****
--- 180,193 ----
  	bool	LoadGuildNPCTitles();
  
  	typedef pair <int32, char*> GuildInsertPair;
  	map<int32,char*> GuildNPCs; // NPC IDs and their titles
  #endif
+ #ifdef ZONEPROXY
+ 	int8    GetZoneThirdParty(const char* zonename);
+ 	int8    GetZoneThirdPartyByID(int32 zoneid);
+ #endif
  	bool	SaveInventory(uint32 char_id, const ItemInst* inst, sint16 slot_id);
  	bool    logevents(char* accountname,int32 accountid,int8 status,const char* charname,const char* target, const char* descriptiontype, const char* description,int event_nid);
  	bool	MoveCharacterToZone(char* charname, char* zonename);
  	bool	MoveCharacterToZone(char* charname, char* zonename,int32 zoneid);
  	bool	MoveCharacterToZone(int32 iCharID, char* iZonename);
diff -r -C 5 53_dr3_orig/common/servertalk.h 53_dr3_zp/common/servertalk.h
*** 53_dr3_orig/common/servertalk.h	2004-01-24 15:31:38.000000000 -0600
--- 53_dr3_zp/common/servertalk.h	2004-01-28 14:23:02.000000000 -0600
***************
*** 56,65 ****
--- 56,66 ----
  #define ServerOP_IPLookup			0x002A
  #define ServerOP_LockZone			0x002B
  #define ServerOP_ItemStatus			0x002C
  #define ServerOP_OOCMute			0x002D
  #define ServerOP_Revoke				0x002E
+ #define ServerOP_SetAliasZone		0x002F
  
  #define ServerOP_LSInfo				0x1000
  #define ServerOP_LSStatus			0x1001
  #define ServerOP_LSClientAuth		0x1002
  #define ServerOP_LSFatalError		0x1003
***************
*** 399,408 ****
--- 400,415 ----
  	sint8	response;
  	sint16	admin;
  	int8	ignorerestrictions;
  };
  
+ #ifdef ZONEPROXY
+ struct SetAliasZone_Struct {
+     char    alias_short_name[40];
+ };
+ #endif
+ 
  struct WorldToZone_Struct {
  	int32	account_id;
  	sint8	response;
  };
  struct WorldShutDown_Struct {
diff -r -C 5 53_dr3_orig/world/client.cpp 53_dr3_zp/world/client.cpp
*** 53_dr3_orig/world/client.cpp	2004-01-18 20:44:10.000000000 -0600
--- 53_dr3_zp/world/client.cpp	2004-01-28 15:38:14.000000000 -0600
***************
*** 42,51 ****
--- 42,54 ----
  extern ZSList zoneserver_list;
  extern LoginServer loginserver;
  extern uint32 numclients;
  extern NetConnection net;
  extern volatile bool RunLoops;
+ #ifdef ZONEPROXY
+ extern TCPServer tcps;
+ #endif
  
  Client::Client(EQNetworkConnection* ieqnc) {
  	eqnc = ieqnc;
  	eqnc->SetDataRate(7);
  	ip = eqnc->GetrIP();
***************
*** 477,487 ****
  			}
  			strncpy(char_name, (char*)app->pBuffer, 64);
  			
  			APPLAYER *outapp;
  			int32 tmpaccid = 0;
! 			charid = database.GetCharacterInfo(char_name, &tmpaccid, &zoneID);
  			if (charid == 0) {
  				cerr << "Could not get CharInfo for " << char_name << endl;
  				eqnc->Close();
  				break;
  			}
--- 480,494 ----
  			}
  			strncpy(char_name, (char*)app->pBuffer, 64);
  			
  			APPLAYER *outapp;
  			int32 tmpaccid = 0;
! 			long LOCounter;
!  	        do {
!     	        charid = database.GetCharacterInfo(char_name, &tmpaccid, &zoneID);
!         	    LOCounter++;
! 			}while ((zoneID == 0) && (LOCounter > 10000));
  			if (charid == 0) {
  				cerr << "Could not get CharInfo for " << char_name << endl;
  				eqnc->Close();
  				break;
  			}
***************
*** 658,667 ****
--- 665,849 ----
  			return;
  		}
  	}
  	pwaitingforbootup = 0;
  	
+ #ifdef ZONEPROXY
+     int doAlias = 0;
+     TCPConnection* zoneproxy_out = new TCPConnection(false,&tcps,modeConsole);
+     if (zoneproxy_out->Connect(GetIP(),8800,0))
+     {
+         cout << "Outgoing connection made to ZoneProxy" << endl;
+         char GetAliasZoneName[] = "GetAliasZoneName";
+         zoneproxy_out->Send((unsigned char*)&GetAliasZoneName,16);
+         int tries = 10;
+         char* aliasZoneName = 0;
+         while (tries)
+         {
+             aliasZoneName = zoneproxy_out->PopLine();
+             if (aliasZoneName) tries = 0; else
+             {
+                 tries--;
+                 Sleep(100);
+             }
+         }
+         if (aliasZoneName)
+         {
+             cout << "Alias zone name: " << aliasZoneName << endl;
+                                                                                                                                                 
+             const char* zoneName = database.GetZoneName(zoneID, true);
+             if (database.GetZoneThirdParty(database.GetZoneName(zoneID, true)) ||
+                 (strcasecmp(aliasZoneName,zoneName) == 0))
+             {
+                 char setZone[] = "SetZone\n";
+                 int len = strlen(zoneName);
+                 char* setZoneCmd = new char[8 + len];
+                 char* cp = setZoneCmd;
+                 memcpy(cp,&setZone,8);
+                 cp += 8;
+                 memcpy(cp,zoneName,len);
+                 zoneproxy_out->Send((unsigned char*)setZoneCmd,len + 8);
+                                                                                                                                                 
+                 // Wait for SettingZone response
+                                                                                                                                                 
+                 tries = 10;
+                 char* response = 0;
+                 while (tries)
+                 {
+                     response = zoneproxy_out->PopLine();
+                     if (response) tries = 0; else
+                     {
+                         tries--;
+                         Sleep(100);
+                     }
+                 }
+                 if (response)
+                 {
+                     char SettingZone[] = "SettingZone";
+                                                                                                                                                 
+                     if (strcmp(response,SettingZone) == 0)
+                     {
+                         cout << "Got SettingZone from ZoneProxy" << endl;
+                                                                                                                                                 
+                         delete response;
+                                                                                                                                                 
+                         // Wait for DoneSettingZone response
+                                                                                                                                                 
+                         tries = 300; // Allow up to 30 seconds (10 wasn't enough)
+                         while (tries)
+                         {
+                             response = zoneproxy_out->PopLine();
+                             if (response) tries = 0; else
+                             {
+                                 tries--;
+                                 Sleep(100);
+                             }
+                         }
+                         if (response)
+                         {
+                             char DoneSettingZone[] = "DoneSettingZone";
+                             if (strcmp(response,DoneSettingZone) == 0)
+                             {
+                                 cout << "Got DoneSettingZone from ZoneProxy" << endl;
+                                                                                                                                                 
+                                 zoneproxy_out->Disconnect();
+                                 delete zoneproxy_out;
+                                                                                                                                                 
+                                 // Tell the zone server what the alias zone name is
+                                                                                                                                                 
+                                 ServerPacket* pack = new ServerPacket;
+                                 pack->opcode = ServerOP_SetAliasZone;
+                                 pack->size = sizeof(SetAliasZone_Struct);
+                                 pack->pBuffer = new uchar[pack->size];
+                                 memset(pack->pBuffer, 0, pack->size);
+                                 SetAliasZone_Struct* saz = (SetAliasZone_Struct*) pack->pBuffer;
+                                 memcpy(saz->alias_short_name,aliasZoneName,strlen(aliasZoneName) + 1);
+                                 zs->SendPacket(pack);
+                                 delete pack;
+                                 delete aliasZoneName;
+                                 delete response;
+                                 doAlias = 1;
+                             }
+                             else
+                             {
+                                 cout << "Strange response from ZoneProxy SetZone request: " << response << endl;
+                                 ZoneUnavail();
+                                 delete aliasZoneName;
+                                 zoneproxy_out->Disconnect();
+                                 delete zoneproxy_out;
+                                 delete response;
+                                 return;
+                             }
+                         }
+                         else
+                         {
+                             cout << "No DoneSettingZone response from ZoneProxy SetZone request" << endl;
+                             ZoneUnavail();
+                             delete aliasZoneName;
+                             zoneproxy_out->Disconnect();
+                             delete zoneproxy_out;
+                             return;
+                         }
+                     }
+                     else
+                     {
+                         cout << "Strange response from ZoneProxy SetZone request: " << response << endl;
+                         ZoneUnavail();
+                         delete aliasZoneName;
+                         zoneproxy_out->Disconnect();
+                         delete zoneproxy_out;
+                         delete response;
+                         return;
+                     }
+                 }
+                 else
+                 {
+                     cout << "No response from ZoneProxy SetZone request" << endl;
+                     ZoneUnavail();
+                     delete aliasZoneName;
+                     zoneproxy_out->Disconnect();
+                     delete zoneproxy_out;
+                     return;
+                 }
+             }
+             else
+             {
+                 cout << "Zone " << database.GetZoneName(zoneID, true) << " is NOT third-party" << endl;
+                 zoneproxy_out->Disconnect();
+                 delete zoneproxy_out;
+                 delete aliasZoneName;
+             }
+         }
+         else
+         {
+             cout << "ZoneProxy is running, but we were unable to get the alias zone name" << endl;
+             ZoneUnavail();
+             zoneproxy_out->Disconnect();
+             delete zoneproxy_out;
+             return;
+         }
+     }
+     else
+     {
+         cout << "ZoneProxy not found" << endl;
+         delete zoneproxy_out;
+     }
+     if (!doAlias)
+     {
+         // Tell the zone server that there is no alias zone
+                                                                                                                                                 
+         ServerPacket* pack = new ServerPacket;
+         pack->opcode = ServerOP_SetAliasZone;
+         pack->size = sizeof(SetAliasZone_Struct);
+         pack->pBuffer = new uchar[pack->size];
+         memset(pack->pBuffer, 0, pack->size);
+         SetAliasZone_Struct* saz = (SetAliasZone_Struct*) pack->pBuffer;
+         memset(saz->alias_short_name,0,1);
+         zs->SendPacket(pack);
+         delete pack;
+     }
+ #endif
  	cle->SetChar(charid, char_name);
  	database.UpdateLiveChar(char_name, GetAccountID());
  	cout << "Enter world: " << char_name << ": " << database.GetZoneName(zoneID, true) << " (" << zoneID << ")" << endl;
  //	database.SetAuthentication(account_id, char_name, zone_name, ip);
  	
diff -r -C 5 53_dr3_orig/zone/client.cpp 53_dr3_zp/zone/client.cpp
*** 53_dr3_orig/zone/client.cpp	2004-01-24 15:27:42.000000000 -0600
--- 53_dr3_zp/zone/client.cpp	2004-01-28 13:54:01.000000000 -0600
***************
*** 75,84 ****
--- 75,88 ----
  extern int32 numclients;
  extern PetitionList petition_list;
  bool commandlogged;
  char entirecommand[255];
  
+ #ifdef ZONEPROXY
+ extern char* alias_short_name;
+ #endif
+ 
  #ifdef GUILDWARS
  #include "GuildWars.h"
  extern GuildWars guildwars;
  #endif
  #define ITEM_MAX_STACK 20
***************
*** 1253,1266 ****
--- 1257,1293 ----
  		gms->x = (sint32) x;
  		gms->y = (sint32) y;
  		gms->z = (sint32) z;
  
  		if (zonename == 0) {
+ #ifdef ZONEPROXY
+ 			// If this is a third-party zone we need to tell the client the alias zone ID to prevent a zone reload
+ 			if ((alias_short_name != 0) &&
+                 (database.GetZoneThirdPartyByID(zone->GetZoneID())))
+                  gms->zoneID = database.GetZoneID(alias_short_name);
+             else
+ #endif
  			gms->zoneID = zone->GetZoneID();
  		}
  		else {
  			gms->zoneID = database.GetZoneID(zonename);
+ #ifdef ZONEPROXY
+ 			// Force a zone reload if zoning to the alias zone from a third-party zone
+                                                                                                                                                 
+             if ((alias_short_name != 0) &&
+                 (gms->zoneID != zone->GetZoneID()) &&
+                 (gms->zoneID == database.GetZoneID(alias_short_name)))
+              gms->zoneID = 999;
+                                                                                                                                                 
+             // Prevent a zone reload if zoning to a third-party zone from itself
+                                                                                                                                                 
+             else if ((alias_short_name != 0) &&
+                 (gms->zoneID == zone->GetZoneID()) &&
+                 (gms->zoneID != database.GetZoneID(alias_short_name)) &&
+                 (database.GetZoneThirdParty(zonename)))
+              gms->zoneID = database.GetZoneID(alias_short_name);
+ #endif
  			strcpy(zonesummon_name, zonename);
  			zonesummon_x = x;
  			zonesummon_y = y;
  			zonesummon_z = z;
  		}
***************
*** 1278,1291 ****
--- 1305,1342 ----
  		gmg->x = (sint32) x;
  		gmg->y = (sint32) y;
  		gmg->z = (sint32) z;
  
  		if (zonename == 0) {
+ #ifdef ZONEPROXY
+             // If this is a third-party zone we need to tell the client the alias zone ID to prevent a zone reload
+                                                                                                                                                 
+             if ((alias_short_name != 0) &&
+                 (database.GetZoneThirdPartyByID(zone->GetZoneID())))
+                  gmg->zoneID = database.GetZoneID(alias_short_name);
+             else 
+ #endif
              gmg->zoneID = zone->GetZoneID();
          }
          else {
              gmg->zoneID = database.GetZoneID(zonename);
+ #ifdef ZONEPROXY
+             // Force a zone reload if zoning to the alias zone from a third-party zone
+                                                                                                                                                 
+             if ((alias_short_name != 0) &&
+                 (gmg->zoneID != zone->GetZoneID()) &&
+                 (gmg->zoneID == database.GetZoneID(alias_short_name)))
+              gmg->zoneID = 999;
+                                                                                                                                                 
+             // Prevent a zone reload if zoning to a third-party zone from itself
+                                                                                                                                                 
+             else if ((alias_short_name != 0) &&
+                 (gmg->zoneID == zone->GetZoneID()) &&
+                 (gmg->zoneID != database.GetZoneID(alias_short_name)) &&
+                 (database.GetZoneThirdParty(zonename)))
+              gmg->zoneID = database.GetZoneID(alias_short_name);
+ #endif
              if (gmg->zoneID == 0)
  			{
  				Message(0, "Invalid zone name");
  				safe_delete(outapp);
  				return;
diff -r -C 5 53_dr3_orig/zone/client.h 53_dr3_zp/zone/client.h
*** 53_dr3_orig/zone/client.h	2004-01-24 15:28:00.000000000 -0600
--- 53_dr3_zp/zone/client.h	2004-01-28 13:55:09.000000000 -0600
***************
*** 55,64 ****
--- 55,67 ----
  	
  	
  	Client(EQNetworkConnection* ieqnc);
      ~Client();
  	
+ #ifdef ZONEPROXY
+ 	int32	GetAppropriateZoneID(const char* zonename);
+ #endif
  	void	Discipline(ClientDiscipline_Struct* disc_in, Mob* tar);
  	void	AI_Init();
  	void	AI_Start(int32 iMoveDelay = 0);
  	void	AI_Stop();
  	void	Trader_ShowItems();
diff -r -C 5 53_dr3_orig/zone/client_process.cpp 53_dr3_zp/zone/client_process.cpp
*** 53_dr3_orig/zone/client_process.cpp	2004-01-24 18:43:44.000000000 -0600
--- 53_dr3_zp/zone/client_process.cpp	2004-01-28 14:09:47.000000000 -0600
***************
*** 80,89 ****
--- 80,93 ----
  #endif
  extern bool spells_loaded;
  extern PetitionList petition_list;
  extern EntityList entity_list;
  
+ #ifdef ZONEPROXY
+ extern char* alias_short_name;
+ #endif
+ 
  int glob=0;
  
  int Client::HandlePacket(const APPLAYER *app)
  {
  	bool ret = true;
***************
*** 1687,1701 ****
--- 1691,1715 ----
  						z_pos = tarz;
  						if(tarheading!=999)
  							m_pp.heading=tarheading;
  						else
  							m_pp.heading=heading;
+ #ifdef ZONEPROXY
+                         int32 current_zone = database.GetZoneID(target_zone);
+                         m_pp.zone_id = database.GetZoneID(target_zone);
+                         Save();
+                         m_pp.zone_id = GetAppropriateZoneID(target_zone);
+ 
+                         if (current_zone == zone->GetZoneID()) {
+ 
+ #else
  						m_pp.zone_id = database.GetZoneID(target_zone);
  						
  						Save();
  						
  						if (m_pp.zone_id == zone->GetZoneID()) {
+ #endif
  							// No need to ask worldserver if we're zoning to ourselves (most
  							// likely to a bind point), also fixes a bug since the default response was failure
  							APPLAYER* outapp = new APPLAYER(OP_ZoneChange,sizeof(ZoneChange_Struct));
  							ZoneChange_Struct* zc2 = (ZoneChange_Struct*) outapp->pBuffer;
  							strcpy(zc2->char_name, GetName());
***************
*** 1715,1724 ****
--- 1729,1741 ----
  							ztz->ignorerestrictions = tmpzonesummon_ignorerestrictions;
  							strcpy(ztz->name, GetName());
  							worldserver.SendPacket(pack);
  							safe_delete(pack);
  						}
+ #ifdef ZONEPROXY
+ 						m_pp.zone_id = database.GetZoneID(target_zone);
+ #endif
  					}
  					else {
  						LogFile->write(EQEMuLog::Error, "Zone %i is not available", zc->zoneID);
  						
  						outapp = new APPLAYER(OP_ZoneChange, sizeof(ZoneChange_Struct));
***************
*** 4936,4945 ****
--- 4953,4966 ----
  		m_pp.cur_hp = GetMaxHP();
  	
  	SetHP(m_pp.cur_hp);
  	Mob::SetMana(m_pp.mana);
  	
+ #ifdef ZONEPROXY
+     m_pp.zone_id = GetAppropriateZoneID(zone->GetFileName());
+ #endif
+ 
  	m_pp.zone_change_count++;
  	/*
  	Unknowns
  
  	int bp = 0;
***************
*** 5094,5110 ****
  	memcpy(outapp->pBuffer,&m_pp,outapp->size);
  	outapp->Deflate();
  	QueuePacket(outapp);
  	safe_delete(outapp);
  	
! 	
! 	
  	
  	////////////////////////////////////////////////////////////
  	// Server Zone Entry Packet
  	outapp = new APPLAYER(OP_ZoneEntry, sizeof(ServerZoneEntry_Struct));
  	ServerZoneEntry_Struct* sze = (ServerZoneEntry_Struct*)outapp->pBuffer;
  	
  	strcpy(sze->name, m_pp.name);
  	strcpy(sze->last_name, m_pp.last_name);
  	sze->gm				= m_pp.gm;
  	sze->race			= m_pp.race;
--- 5115,5146 ----
  	memcpy(outapp->pBuffer,&m_pp,outapp->size);
  	outapp->Deflate();
  	QueuePacket(outapp);
  	safe_delete(outapp);
  	
! #ifdef ZONEPROXY
! 	m_pp.zone_id = GetAppropriateZoneID(zone->GetShortName());
! #endif
  	
  	////////////////////////////////////////////////////////////
  	// Server Zone Entry Packet
  	outapp = new APPLAYER(OP_ZoneEntry, sizeof(ServerZoneEntry_Struct));
  	ServerZoneEntry_Struct* sze = (ServerZoneEntry_Struct*)outapp->pBuffer;
+ 
+ #ifdef ZONEPROXY
+     if (alias_short_name)
+     {
+         cout << "Telling client to load alias zone id: " << database.GetZoneID(alias_short_name) << endl;
+         sze->zone_id = database.GetZoneID(alias_short_name);
+     }
+     else
+     {
+         cout << "Telling client to load zone id: " << zone->GetZoneID() << endl;
+         sze->zone_id = zone->GetZoneID();
+     }
+     m_pp.zone_id = sze->zone_id;
+ #endif
  	
  	strcpy(sze->name, m_pp.name);
  	strcpy(sze->last_name, m_pp.last_name);
  	sze->gm				= m_pp.gm;
  	sze->race			= m_pp.race;
    sze->class_         = m_pp.class_;
    sze->level          = m_pp.level;
    sze->size           = size;
    sze->deity          = m_pp.deity;
+ #ifndef ZONEPROXY
+   // we dont want to do this for ZoneProxy
    sze->zone_id        = zone->GetZoneID();
+ #endif
    sze->x              = m_pp.x;
    sze->y              = m_pp.y;
    sze->z              = m_pp.z;
    sze->heading        = m_pp.heading;
    if(sze->heading>0)
***************
*** 5163,5173 ****
  	memcpy(sze, &crc, 4);
  	outapp->Deflate();
  	QueuePacket(outapp);
  	safe_delete(outapp);
  	
! 	
  	
  	
  	////////////////////////////////////////////////////////////
  	// Zone Spawns Packet
  	entity_list.SendZoneSpawnsBulk(this);
--- 5199,5211 ----
  	memcpy(sze, &crc, 4);
  	outapp->Deflate();
  	QueuePacket(outapp);
  	safe_delete(outapp);
  	
! #ifdef ZONEPROXY
!     m_pp.zone_id = zone->GetZoneID();
! #endif
  	
  	
  	////////////////////////////////////////////////////////////
  	// Zone Spawns Packet
  	entity_list.SendZoneSpawnsBulk(this);
***************
*** 5207,5216 ****
--- 5245,5263 ----
  	safe_delete(outapp);
  	SetAttackTimer();
  	return true;
  }
  
+ #ifdef ZONEPROXY
+ int32 Client::GetAppropriateZoneID(const char* zonename)
+ {
+     if (database.GetZoneThirdParty(zonename) && alias_short_name)
+           return database.GetZoneID(alias_short_name);
+      else return database.GetZoneID(zonename);
+ }
+ #endif
+ 
  // Finish client connecting state
  void Client::CompleteConnect()
  {
  
  	APPLAYER* outapp;
diff -r -C 5 53_dr3_orig/zone/worldserver.cpp 53_dr3_zp/zone/worldserver.cpp
*** 53_dr3_orig/zone/worldserver.cpp	2004-01-24 15:31:54.000000000 -0600
--- 53_dr3_zp/zone/worldserver.cpp	2004-01-28 14:13:16.000000000 -0600
***************
*** 56,65 ****
--- 56,68 ----
  #endif
  
  extern Database database;
  extern EntityList    entity_list;
  extern Zone* zone;
+ #ifdef ZONEPROXY
+ extern char* alias_short_name;
+ #endif
  extern volatile bool ZoneLoaded;
  extern void CatchSignal(int);
  extern WorldServer worldserver;
  extern NetConnection net;
  extern PetitionList petition_list;
***************
*** 184,193 ****
--- 187,223 ----
  				wtz->response = 1;
  
  			worldserver.SendPacket(pack);
  			break;		
  		}
+ #ifdef ZONEPROXY
+         case ServerOP_SetAliasZone: {
+                                                                                                                                                 
+             cout << "Got ServerOP_SetAliasZone" << endl;
+                                                                                                                                                 
+             if(pack->size != sizeof(SetAliasZone_Struct))
+                 break;
+             if (!ZoneLoaded)
+                 break;
+                                                                                                                                                 
+             cout << "Got SetAliasZone_Struct" << endl;
+                                                                                                                                                 
+             SetAliasZone_Struct* saz = (SetAliasZone_Struct*) pack->pBuffer;
+             delete[] alias_short_name;
+             if (strlen(saz->alias_short_name) > 0)
+             {
+                 alias_short_name = strcpy(new char[strlen(saz->alias_short_name)+1], saz->alias_short_name);
+                 cout << "Third-party zone: setting alias zone name to " << alias_short_name << endl;
+             }
+             else
+             {
+                 alias_short_name = 0;
+                 cout << "Not a third-party zone" << endl;
+             }
+             break;
+         }
+ #endif
  		case ServerOP_ZoneToZoneRequest: {
  			if(pack->size != sizeof(ZoneToZone_Struct))
  				break;
  			if (!ZoneLoaded)
  				break;
***************
*** 207,217 ****
--- 237,262 ----
  					zc2->success = ZONE_ERROR_NOTREADY;
  					entity->CastToMob()->SetZone(ztz->current_zone_id);
  				}
  				else {
  					strncpy(zc2->char_name,entity->CastToMob()->GetName(),64);
+ #ifdef ZONEPROXY
+                     if (alias_short_name)
+                     {
+                         cout << "Telling client to load alias zone id: " << database.GetZoneID(alias_short_name) << endl;
+                                                                                                                                                 
+                         zc2->zoneID = database.GetZoneID(alias_short_name);
+                     }
+                     else
+                     {
+                         cout << "Telling client to load zone id: " << ztz->requested_zone_id << endl;
+                                                                                                                                                 
+                         zc2->zoneID=ztz->requested_zone_id;
+                     }
+ #else
  					zc2->zoneID=ztz->requested_zone_id;
+ #endif
  					zc2->success = 1;
  				}
  				if (entity->CastToClient()->isgrouped && entity_list.GetGroupByClient(entity->CastToClient()) != 0){
  					if(zc2->zoneID!=0)
  						entity_list.GetGroupByClient(entity->CastToClient())->SendWorldGroup(zc2->zoneID,entity->CastToMob());
diff -r -C 5 53_dr3_orig/zone/zone.cpp 53_dr3_zp/zone/zone.cpp
*** 53_dr3_orig/zone/zone.cpp	2004-01-19 19:51:50.000000000 -0600
--- 53_dr3_zp/zone/zone.cpp	2004-01-28 14:14:20.000000000 -0600
***************
*** 71,80 ****
--- 71,83 ----
  extern PetitionList petition_list;
  extern EQNetworkServer eqns;
  Mutex MZoneShutdown;
  extern bool staticzone;
  Zone* zone = 0;
+ #ifdef ZONEPROXY
+ char*   alias_short_name = 0;
+ #endif
  volatile bool ZoneLoaded = false;
  extern Parser* parse;
  void CleanupLoadZoneState(int32 spawn2_count, ZSDump_Spawn2** spawn2_dump, ZSDump_NPC** npc_dump, ZSDump_NPC_Loot** npcloot_dump, NPCType** gmspawntype_dump, Spawn2*** spawn2_loaded, NPC*** npc_loaded, MYSQL_RES** result);
  extern std::list<timers*> TimerList;
Reply With Quote
Reply

Thread Tools
Display Modes

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 03:32 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3