|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
02-12-2010, 07:34 AM
|
|
Developer
|
|
Join Date: Mar 2003
Posts: 1,497
|
|
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);
|
02-12-2010, 07:37 AM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
Was something changed? I add wps all of the time set to 0 and they work fine...
|
02-12-2010, 07:39 AM
|
|
Developer
|
|
Join Date: Mar 2003
Posts: 1,497
|
|
Ah, then disregard. I didn't test. I just assumed that he had done it properly.
|
02-12-2010, 07:47 AM
|
|
Developer
|
|
Join Date: Aug 2006
Location: USA
Posts: 5,946
|
|
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
|
02-12-2010, 07:48 AM
|
|
Developer
|
|
Join Date: Mar 2003
Posts: 1,497
|
|
Hehe, ok. Glad I'm not going crazy!!
|
02-12-2010, 09:31 AM
|
|
Developer
|
|
Join Date: Mar 2003
Posts: 1,497
|
|
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.
|
|
|
|
02-13-2010, 07:28 AM
|
|
Developer
|
|
Join Date: Mar 2003
Posts: 1,497
|
|
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 ***/
|
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 03:32 AM.
|
|
|
|
|
|
|
|
|
|
|
|
|