Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Feature Requests

Development::Feature Requests Post suggestions/feature requests here.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 08-20-2008, 01:21 AM
AndMetal
Developer
 
Join Date: Mar 2007
Location: Ohio
Posts: 648
Default

Here's the code for the wp command:
zone/command.cpp
Code:
 2256 void command_wp(Client *c, const Seperator *sep)
 2257 {
 2258 	if (strcasecmp("add",sep->arg[1]) == 0)
 2259 		database.AddWP(c, atoi(sep->arg[2]),atoi(sep->arg[4]), c->GetX(), c->GetY(), c->GetZ(), atoi(sep->arg[3]),zone->GetZoneID());
 2260 	else if (strcasecmp("delete",sep->arg[1]) == 0)
 2261 		database.DeleteWaypoint(c, atoi(sep->arg[2]),atoi(sep->arg[4]),zone->GetZoneID());
 2262 	else
 2263 		c->Message(0,"Usage: #wp add/delete grid_num pause wp_num");
 2264 }
I'm not sure if this will actually work, but you might be able to do something like this:
zone/zonedb.h
Code:
	/*
	 * Grids/Paths
	 */
	int32	GetFreeGrid(int16 zoneid);
	void	DeleteGrid(Client *c, int32 sg2, int32 grid_num, bool grid_too,int16 zoneid);
	void	DeleteWaypoint(Client *c, int32 grid_num, int32 wp_num,int16 zoneid);
//	int32	AddWP(Client *c, int32 sg2, int16 grid_num, int8 wp_num, float xpos, float ypos, float zpos, int32 pause, float xpos1, float ypos1, float zpos1, int type1, int type2,int16 zoneid);
	void	AddWP(Client *c, int32 gridid, int32 wpnum, float xpos, float ypos, float zpos, int32 pause, int16 zoneid);
	int32	AddWPForSpawn(Client *c, int32 spawn2id, float xpos, float ypos, float zpos, int32 pause, int type1, int type2, int16 zoneid);
	void	ModifyGrid(Client *c, bool remove, int32 id, int8 type = 0, int8 type2 = 0,int16 zoneid = 0);
	void    ModifyWP(Client *c, int32 grid_id, int32 wp_num, float xpos, float ypos, float zpos, int32 script=0,int16 zoneid =0);
	int8    GetGridType(int32 grid,int32 zoneid);
	int8    GetGridType2(int32 grid, int16 zoneid);
	bool    GetWaypoints(int32 grid, int16 zoneid, int32 num, wplist* wp);
	void	AssignGrid(Client *client, float x, float y, int32 id);
	int		GetHighestGrid(uint32 zoneid);
	int	GetHighestWaypoint(uint32 zoneid, int32 gridid);
zone/waypoints.cpp
Code:
int ZoneDatabase::GetHighestWaypoint(uint32 zoneid, int32 gridid) {
	char *query = 0;
	char errbuff[MYSQL_ERRMSG_SIZE];
	MYSQL_RES *result;
	MYSQL_ROW row;
	int res = 0;
	if (RunQuery(query, MakeAnyLenString(&query,
		"SELECT COALESCE(MAX(number), 0) FROM grid_entries WHERE zoneid = %i AND gridid = %i",
		zoneid, gridid),errbuff,&result)) {
		safe_delete_array(query);
		if (mysql_num_rows(result) == 1) {
			row = mysql_fetch_row(result);
			res = atoi( row[0] );
		}
		mysql_free_result(result);
	} else {
		LogFile->write(EQEMuLog::Error, "Error in GetHighestWaypoint query '%s': %s", query, errbuff);
		safe_delete_array(query);
	}

	return(res);
}
zone/command.cpp
Code:
void command_wp(Client *c, const Seperator *sep)
{
	if (sep->arg[4] == NULL)
		int wp = database.GetHighestWaypoint(zone->GetZoneID(), atoi(sep->arg[2]));
	else
		int wp = atoi(sep->arg[4]);
	if (strcasecmp("add",sep->arg[1]) == 0)
		database.AddWP(c, atoi(sep->arg[2]),wp, c->GetX(), c->GetY(), c->GetZ(), atoi(sep->arg[3]),zone->GetZoneID());
	else if (strcasecmp("delete",sep->arg[1]) == 0)
		database.DeleteWaypoint(c, atoi(sep->arg[2]),atoi(sep->arg[4]),zone->GetZoneID());
	else
		c->Message(0,"Usage: #wp add/delete grid_num pause wp_num");
}
Hope this helps.
__________________
GM-Impossible of 'A work in progress'
A non-legit PEQ DB server
How to create your own non-legit server

My Contributions to the Wiki
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:52 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