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

06-15-2003, 01:42 PM
|
Fire Beetle
|
|
Join Date: Mar 2003
Posts: 23
|
|
#spawnfix command
Here's a quick command I put together to fix spawngroups' coordinates and headings on the fly. Just target a mob and it automatically updates coords and heading, to the character you're currently using coords and headings, in the db. Use #repop for effects to instantly show up. Here's the diff file for it.
Quote:
--- client.cpp 2003-06-15 21:25:24.000000000 -0400
+++ client.cpp 2003-06-15 21:08:29.000000000 -0400
@@ -4104,6 +4104,38 @@
else if (strcasecmp(sep->arg[0], "#npcspawn") == 0) {
NPCSpawn(sep);
}
+ else if (strcasecmp(sep->arg[0], "#spawnfix") == 0) {
+ if (target==0) {
+ Message(0, "Error: #spawnfix: No Target.");
+ }
+ else {
+ int32 tmp = 0;
+ char errbuf[MYSQL_ERRMSG_SIZE];
+ char *query = 0;
+ MYSQL_RES *result;
+ MYSQL_ROW row;
+
+ if (database.RunQuery(query, MakeAnyLenString(&query, "SELECT id from spawn2 where zone='%s' AND x='%f' AND y='%f' AND heading='%f'", zone->GetShortName(), target->GetX(), target->GetY(), target->GetHeading()), errbuf, &result)) {
+ row = mysql_fetch_row(result);
+
+ if (row[0])
+ tmp = atoi(row[0]);
+
+ query = 0;
+ if(database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawn2 SET x='%f', y='%f', z='%f', heading='%f' WHERE id='%i'",this->GetX(), this->GetY(), this->GetZ(), this->GetHeading(),tmp), errbuf, 0))
+ Message(0, "Updating coordinates successful!");
+
+ delete[] query;
+ mysql_free_result(result);
+
+ }
+ else {
+ mysql_free_result(result);
+ Message(0, "Upating coordinates failed!");
+ }
+ }
+ }
+
else
return false;
return true;
@@ -4523,6 +4555,7 @@
Message(0, " #zsave [file name] - Save the current zone header to ./cfg/<filename>.cfg");
Message(0, " #dbspawn2 [spawngroup] [respawn] [variance]");
Message(0, " #npcspawn [create|add|update|remove|delete]");
+ Message(0, " #spawnfix - Fixes coordinates and heading for spawn groups");
Message(0, " #fixmob [nextrace|prevrace|gender|nexttexture|prevtexture|n exthelm|prevhelm]");
}
if ((strcasecmp(sep->arg[1], "debug") == 0 || strcasecmp(sep->arg[1], "all") == 0) && admin >= 201)
|
I've done some minor testing and didn't run into any troubles using it.
|
 |
|
 |

06-15-2003, 02:23 PM
|
Demi-God
|
|
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
|
|
Thats really handy! I'm throwing this into CVS now.. I'm sure the database developers will really appreciate this one.
Just tested it out... Thats going to make modifying spawn placement so much nicer.. Once all the mobs are dumped into the zone, it'll be a cinch to place them using this.
Great update Wolf, thanks!
__________________
Quitters never win, and winners never quit, but those who never win and never quit are idiots.
|

06-15-2003, 11:22 PM
|
Dragon
|
|
Join Date: Jun 2002
Posts: 776
|
|
Very nice, look forward to playing with this command. 
|

06-16-2003, 11:42 AM
|
Sarnak
|
|
Join Date: Apr 2003
Posts: 53
|
|
yay!
i kludge something similar into my own code, but i like yours better, hehe
|
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 02:21 PM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |