View Single Post
  #38  
Old 12-19-2007, 06:16 AM
Cripp's Avatar
Cripp
Discordant
 
Join Date: Oct 2003
Location: The Shire
Posts: 474
Default

heres what i came up with today...

Code:
--- mob.h	2007/12/17 02:26:10	1.25
+++ mob.h	2007/12/19 18:08:39	1.26
@@ -902,8 +902,11 @@
 //	uint32	guildeqid; // guild's EQ ID, 0-511, 0xFFFFFFFF = none
 	
 	int8    light;
-	
+#ifdef CRIPP_Z
+	sint16	fixedZ;
+#else
 	float	fixedZ;
+#endif
 	EmuAppearance    _appearance;
 	int8	pRunAnimSpeed;
Code:
--- npc.cpp	2007/12/17 02:26:10	1.20
+++ npc.cpp	2007/12/19 18:08:39	1.21
@@ -152,6 +152,9 @@
 	guard_z = 0;
 	guard_heading = 0;
 	swarmInfoPtr = NULL;
+#ifdef CRIPP_Z
+	fixz = 1;
+#endif
 	
 //	SaveSpawnSpot();
Code:
--- npc.h	2007/12/17 02:26:10	1.15
+++ npc.h	2007/12/19 18:08:39	1.16
@@ -225,6 +225,9 @@
 	//aza77 GWFear
 	void SpawnFearGridNPC(const char* feargrids, float in_x, float in_y, float in_z);
 #endif
+#ifdef CRIPP_Z
+	sint16 fixz;
+#endif
 
 protected:
Code:
--- spawn2.cpp	2006/11/01 20:36:21	1.3
+++ spawn2.cpp	2007/12/19 18:08:39	1.4
@@ -67,7 +67,11 @@
 Spawn2::Spawn2(int32 in_spawn2_id, int32 spawngroup_id, 
 	float in_x, float in_y, float in_z, float in_heading, 
 	int32 respawn, int32 variance, int32 timeleft, int32 grid,
+#ifdef CRIPP_Z
+	uint16 in_cond_id, sint16 in_min_value, sint16 fixZhop)
+#else
 	uint16 in_cond_id, sint16 in_min_value)
+#endif
 : timer(100000)
 {
 	spawn2_id = in_spawn2_id;
@@ -82,6 +86,9 @@
 	condition_id = in_cond_id;
 	condition_min_value = in_min_value;
 	npcthis = NULL;
+#ifdef CRIPP_Z
+	FixedZ = fixZhop;
+#endif
 	
 	if(timeleft == 0xFFFFFFFF) {
 		//special disable timeleft
@@ -169,6 +176,9 @@
 		npcthis = npc;
 		npc->AddLootTable();
 		npc->SetSp2(spawngroup_id_);
+#ifdef CRIPP_Z
+		npc->fixz = FixedZ;
+#endif
 		entity_list.AddNPC(npc);
 		//this limit add must be done after the AddNPC since we need the entity ID.
 		entity_list.LimitAddNPC(npc);
@@ -229,7 +239,11 @@
 	MYSQL_RES *result;
 	MYSQL_ROW row;
 	
+#ifdef CRIPP_Z
+	MakeAnyLenString(&query, "SELECT id, spawngroupID, x, y, z, heading, respawntime, variance, pathgrid, timeleft, _condition, cond_value, fixZ FROM spawn2 WHERE zone='%s'", zone_name);
+#else
 	MakeAnyLenString(&query, "SELECT id, spawngroupID, x, y, z, heading, respawntime, variance, pathgrid, timeleft, _condition, cond_value FROM spawn2 WHERE zone='%s'", zone_name);
+#endif
 	
 	if (RunQuery(query, strlen(query), errbuf, &result))
 	{
@@ -237,7 +251,11 @@
 		while((row = mysql_fetch_row(result)))
 		{
 			Spawn2* newSpawn = 0;
+#ifdef CRIPP_Z
+			newSpawn = new Spawn2(atoi(row[0]), atoi(row[1]), atof(row[2]), atof(row[3]), atof(row[4]), atof(row[5]), atoi(row[6]), atoi(row[7]), atoi(row[9]), atoi(row[8]), atoi(row[10]), atoi(row[11]), atoi(row[12]));
+#else
 			newSpawn = new Spawn2(atoi(row[0]), atoi(row[1]), atof(row[2]), atof(row[3]), atof(row[4]), atof(row[5]), atoi(row[6]), atoi(row[7]), atoi(row[9]), atoi(row[8]), atoi(row[10]), atoi(row[11]));
+#endif
 			//newSpawn->Repop(repopdelay);
 			spawn2_list.Insert( newSpawn );
 		}
@@ -260,12 +278,20 @@
 	MYSQL_RES *result;
 	MYSQL_ROW row;
 
+#ifdef CRIPP_Z
+	if (RunQuery(query, MakeAnyLenString(&query, "SELECT id, spawngroupID, x, y, z, heading, respawntime, variance, pathgrid, _condition, cond_value, fixZ FROM spawn2 WHERE id=%i", spawn2id), errbuf, &result))
+#else
 	if (RunQuery(query, MakeAnyLenString(&query, "SELECT id, spawngroupID, x, y, z, heading, respawntime, variance, pathgrid, _condition, cond_value FROM spawn2 WHERE id=%i", spawn2id), errbuf, &result))
+#endif
 	{
 		if (mysql_num_rows(result) == 1)
 		{
 			row = mysql_fetch_row(result);
+#ifdef CRIPP_Z
+			Spawn2* newSpawn = new Spawn2(atoi(row[0]), atoi(row[1]), atof(row[2]), atof(row[3]), atof(row[4]), atof(row[5]), atoi(row[6]), atoi(row[7]), timeleft, atoi(row[8]), atoi(row[9]), atoi(row[10]), atoi(row[11]));
+#else
 			Spawn2* newSpawn = new Spawn2(atoi(row[0]), atoi(row[1]), atof(row[2]), atof(row[3]), atof(row[4]), atof(row[5]), atoi(row[6]), atoi(row[7]), timeleft, atoi(row[8]), atoi(row[9]), atoi(row[10]));
+#endif
 			spawn2_list.Insert( newSpawn );
 			mysql_free_result(result);
 			safe_delete_array(query);
Code:
--- spawn2.h	2006/06/20 02:36:21	1.2
+++ spawn2.h	2007/12/19 18:08:40	1.3
@@ -35,7 +35,11 @@
 		float x, float y, float z, float heading, 
 		int32 respawn, int32 variance, 
 		int32 timeleft = 0, int32 grid = 0,
+#ifdef CRIPP_Z
+		uint16 cond_id = SC_AlwaysEnabled, sint16 min_value = 0, sint16 fixZhop = 1);
+#else
 		uint16 cond_id = SC_AlwaysEnabled, sint16 min_value = 0);
+#endif
 	~Spawn2();
 
 	void	LoadGrid();
@@ -74,6 +78,9 @@
 	int32	grid_;
 	uint16	condition_id;
 	sint16	condition_min_value;
+#ifdef CRIPP
+	sint16	FixedZ;
+#endif
 };
 
 class SpawnCondition {
Code:
--- waypoints.cpp	2007/12/01 18:11:14	1.7
+++ waypoints.cpp	2007/12/19 18:08:40	1.8
@@ -670,7 +670,9 @@
 					newwp.x = atof(row[0]);
 					newwp.y = atof(row[1]);
 					newwp.z = atof(row[2]);

 					if(zone->map != NULL && RuleB(Map, FixPathingZWhenLoading) ) {
 						// Experimental. This code will send any waypoint that is 'in the air' down to ground level.
 	
@@ -685,14 +687,17 @@
 							float newz = zone->map->FindBestZ(n, dest, NULL, NULL);
 							// The following test is a sanity check. 45 is an arbitrary value, chosen during testing
 							// because all the Z co-ordinates of the waypoints in The Grey where <45 units above the ground.
 							if( (newz > -2000) && ABS(newz-dest.z) < RuleR(Map, FixPathingZMaxDeltaLoading)) {
#ifdef CRIPP_Z
 								if (fixz != 0) {
#endif
 								newwp.z = newz+1;
 								// printf("Updated Z for Grid %d, Waypoint %d from %.3f to %.3f\n",  grid, newwp.index,dest.z,newwp.z);
#ifdef CRIPP_Z
 								}
#endif
 							}
 							//else if(newz > -2000) 
 							//	printf("Delta Z %.3f too big for Grid %d, Waypoint %d from %.3f to %.3f\n", ABS(newz-dest.z), grid, newwp.index,dest.z,newz);
 						}
 					}
 
 					newwp.pause = atoi(row[3]);
 					Waypoints.push_back(newwp);
added definition CRIPP_Z to toggle to default or not... just incase it didnt work.. but i tested once and it seemed to work..

let me know

EDIT:: forgot.. you have to add column in spawn2 table... fixZ tinyint[4] 0 no null default 1
__________________
Nug Blazers - ServerOP / founder
^^comming... later!

www.nugblazers.com

Last edited by Cripp; 12-19-2007 at 11:13 PM..
Reply With Quote