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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 02-13-2010, 07:28 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
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
 


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 07:06 AM.


 

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