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

Reply
 
Thread Tools Display Modes
  #1  
Old 02-12-2010, 07:34 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,490
Default COMMITTED: Manual WP Add Fix

In reference to http://www.eqemulator.org/forums/showthread.php?t=30564

Waypoint pauses were not able to be set to 0 when using the #wpadd command.

Code:
Index: command.cpp
===================================================================
--- command.cpp	(revision 1245)
+++ command.cpp	(working copy)
@@ -5908,7 +5908,7 @@
 		{   if (sep->arg[1] && !strcasecmp(strlwr(sep->arg[1]),"circular")) type1=0;
 		if (sep->arg[1] && !strcasecmp(strlwr(sep->arg[1]),"random"))	type1=2;
 		if (sep->arg[1] && !strcasecmp(strlwr(sep->arg[1]),"patrol"))	type1=3;
-		if (sep->arg[2] && atoi(sep->arg[2]) > 0)	pause=atoi(sep->arg[2]);
+		if (sep->arg[2] && atoi(sep->arg[2]) >= 0)	pause=atoi(sep->arg[2]);
 		    int32 tmp_grid = database.AddWPForSpawn(c, s2info->GetID(), c->GetX(),c->GetY(),c->GetZ(), pause, type1, type2, zone->GetZoneID());
 		if (tmp_grid)
 			t->CastToNPC()->SetGrid(tmp_grid);
Reply With Quote
  #2  
Old 02-12-2010, 07:37 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Was something changed? I add wps all of the time set to 0 and they work fine...
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #3  
Old 02-12-2010, 07:39 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,490
Default

Ah, then disregard. I didn't test. I just assumed that he had done it properly.
Reply With Quote
  #4  
Old 02-12-2010, 07:47 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Oh, no, you are correct. I use #wp, not #wpadd. I didn't even know about the #wpadd command lol. Your change looks good to me now that I see the code for that command. I dunno how people were even using it as it was :P
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #5  
Old 02-12-2010, 07:48 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,490
Default

Hehe, ok. Glad I'm not going crazy!!
Reply With Quote
  #6  
Old 02-12-2010, 09:31 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,490
Default

May want to hold off on committing this... This sub is kinda ugly. Will add a little more functionality and fix a couple of other items I noticed inside.
Reply With Quote
  #7  
Old 02-13-2010, 07:28 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,490
Default

I think this better suits the intent. This will now add the waypoint with the optional pause. No need to keep declaring the wander type as it is only used in the initial setup for an NPC not already on a grid. It will still create the grid if the NPC needs it, but it defaults to wander/pause types of 0/0. The pause is defaulted to 0 also rather than 14.

Code:
Index: command.cpp
===================================================================
--- command.cpp	(revision 1245)
+++ command.cpp	(working copy)
@@ -236,7 +236,7 @@
 		command_add("setpass","[accountname] [password] - Set local password for accountname",150,command_setpass) ||
 		command_add("grid","[add/delete] [grid_num] [wandertype] [pausetype] - Create/delete a wandering grid",170,command_grid) ||
 		command_add("wp","[add/delete] [grid_num] [pause] [wp_num] - Add/delete a waypoint to/from a wandering grid",170,command_wp) ||
-		command_add("wpadd","[circular/random/patrol] [pause] - Add your current location as a waypoint to your NPC target's AI path",170,command_wpadd) ||
+		command_add("wpadd","[pause] - Add your current location as a waypoint to your NPC target's AI path",170,command_wpadd) ||
 		command_add("wpinfo","- Show waypoint info about your NPC target",170,command_wpinfo) ||
 		command_add("iplookup","[charname] - Look up IP address of charname",200,command_iplookup) ||
 		command_add("size","[size] - Change size of you or your target",50,command_size) ||
@@ -5893,30 +5893,34 @@
 void command_wpadd(Client *c, const Seperator *sep)
 {
 	int	type1=0,
-		type2=1,
-		pause=14;	// Defaults for a new grid if the arguments are omitted from the command
+		type2=0,
+		pause=0;	// Defaults for a new grid
 
 	Mob *t=c->GetTarget();
 	if (t && t->IsNPC())
-	{	Spawn2* s2info = t->CastToNPC()->respawn2;
-
+	{
+		Spawn2* s2info = t->CastToNPC()->respawn2;
 		if(s2info == NULL)	// Can't figure out where this mob's spawn came from... maybe a dynamic mob created by #spawn
 		{	c->Message(0,"#wpadd FAILED -- Can't determine which spawn record in the database this mob came from!");
 			return;
 		}
-		else 
-		{   if (sep->arg[1] && !strcasecmp(strlwr(sep->arg[1]),"circular")) type1=0;
-		if (sep->arg[1] && !strcasecmp(strlwr(sep->arg[1]),"random"))	type1=2;
-		if (sep->arg[1] && !strcasecmp(strlwr(sep->arg[1]),"patrol"))	type1=3;
-		if (sep->arg[2] && atoi(sep->arg[2]) > 0)	pause=atoi(sep->arg[2]);
-		    int32 tmp_grid = database.AddWPForSpawn(c, s2info->GetID(), c->GetX(),c->GetY(),c->GetZ(), pause, type1, type2, zone->GetZoneID());
-		if (tmp_grid)
-			t->CastToNPC()->SetGrid(tmp_grid);
+		if (sep->arg[1][0])
+		{
+			if (atoi(sep->arg[1]) >= 0)
+				pause=atoi(sep->arg[1]);
+			else
+			{
+				c->Message(0,"Usage: #wpadd [pause]");
+				return;
+			}
+		}
+		int32 tmp_grid = database.AddWPForSpawn(c, s2info->GetID(), c->GetX(),c->GetY(),c->GetZ(), pause, type1, type2, zone->GetZoneID());
+		if (tmp_grid) t->CastToNPC()->SetGrid(tmp_grid);
 		t->CastToNPC()->AssignWaypoints(t->CastToNPC()->GetGrid());
+		c->Message(0,"Waypoint added. Use #wpinfo to see waypoints for this NPC.");
 	}
-	}
 	else
-		c->Message(0,"Usage: #wpadd [circular/random/patrol] [pause]");
+		c->Message(0,"You must target an NPC to use this.");
 } /*** END command_wpadd ***/
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 05:38 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