Go Back   EQEmulator Home > EQEmulator Forums > Development > Development: Custom Code

Development: Custom Code This is for code thatdoes not emulate live and wont be added to the official code.

Reply
 
Thread Tools Display Modes
  #1  
Old 02-27-2013, 12:19 PM
Drajor's Avatar
Drajor
Developer
 
Join Date: Nov 2012
Location: Halas
Posts: 355
Default Command: #setspawngroup

My apologies if this already exists. I searched the source and the forums but found nothing related.
Due to the way I populate zones I needed to be able to target an NPC and set the spawn group. The following command can be added to achieve this.

Code:
void command_setspawngroup(Client* pClient, const Seperator* pSep) {
	if ( !pClient ) return;
	// Test: Valid Target (NPC)
	if ( !pClient->GetTarget() || !pClient->GetTarget()->IsNPC() ) {
		pClient->Message(13, "You must target an NPC to use this command.");
		return;
	}
	// Test: Valid Command Parameter
	if ( pSep->arg[1][0] ) {
		const NPC* npc = pClient->GetTarget()->CastToNPC();
		const uint32 sp2ID = npc->GetSpawnPointID();
		const uint32 newSGID = atoi(pSep->arg[1]);

		// DB Changes.
		char errbuf[MYSQL_ERRMSG_SIZE];
		char *query = 0;
		database.RunQuery(query, MakeAnyLenString(&query, "UPDATE spawn2 SET spawngroupID=%i WHERE id=%i", newSGID, sp2ID), errbuf);
		safe_delete_array(query);

		return;
	}
	pClient->Message(13, "Usage: #setspawngroup [spawngroupID]");
}
__________________
Drajor regards you indifferently -- what would you like your tombstone to say?

Last edited by Drajor; 02-27-2013 at 12:24 PM.. Reason: Error in parameter check
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 09:23 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 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3