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

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

Reply
 
Thread Tools Display Modes
  #1  
Old 08-18-2006, 02:35 PM
WildcardX
Developer
 
Join Date: Apr 2003
Posts: 589
Default New Spawnstatus Command

I found the existing spawnstatus command to be limiting and have enhanced it to provide additional functionality that I think most server operators will applaud. Unfortunately, I don't have a diff file for this code so please accept what I can offer, the code snippets below...

Replace the existing "command_spawnstatus()" method with the following in the command.cpp file...

Code:
void command_spawnstatus(Client *c, const Seperator *sep)
{
	if((isalpha(sep->arg[1][0])) | (sep->arg[1][0] == 0))
	{
		if((sep->arg[1][0] == 'e') | (sep->arg[1][0] == 'E'))
		{
			// show only enabled spawns
			zone->ShowEnabledSpawnStatus(c);
		}
		else if((sep->arg[1][0] == 'd') | (sep->arg[1][0] == 'D'))
		{
			// show only disabled spawns
			zone->ShowDisabledSpawnStatus(c);
		}
		else if((sep->arg[1][0] == 'a') | (sep->arg[1][0] == 'A'))
		{
			// show all spawn staus with no filters
			zone->SpawnStatus(c);
		}
		else
		{
			c->Message(0, "Usage: #spawnstatus <all | disabled | enabled | {Spawn2 ID}>");
		}
	}
	else
	{
		// show spawn status by spawn2 id
		zone->ShowSpawnStatusByID(c, atoi(sep->arg[1]));
	}
}
Add the following declarations in zone.h...

Code:
void	ShowEnabledSpawnStatus(Mob* client);
void    ShowDisabledSpawnStatus(Mob* client);
void    ShowSpawnStatusByID(Mob* client, uint32 spawnid);
Add the following methods to the zone.cpp file...

Code:
void Zone::ShowEnabledSpawnStatus(Mob* client)
{
	LinkedListIterator<Spawn2*> iterator(spawn2_list);
	int x = 0;
	int iEnabledCount = 0;

	iterator.Reset();

	while(iterator.MoreElements())
	{
		if (iterator.GetData()->timer.GetRemainingTime() != 0xFFFFFFFF)
		{
			client->Message(0, "  %d:  %1.1f, %1.1f, %1.1f:  %1.2f", iterator.GetData()->GetID(), iterator.GetData()->GetX(), iterator.GetData()->GetY(), iterator.GetData()->GetZ(), (float)iterator.GetData()->timer.GetRemainingTime() / 1000);
			iEnabledCount++;
		}

		x++;
		iterator.Advance();
	}

	client->Message(0, "%i of %i spawns listed.", iEnabledCount, x);
}

void Zone::ShowDisabledSpawnStatus(Mob* client)
{
	LinkedListIterator<Spawn2*> iterator(spawn2_list);
	int x = 0;
	int iDisabledCount = 0;

	iterator.Reset();

	while(iterator.MoreElements())
	{
		if (iterator.GetData()->timer.GetRemainingTime() == 0xFFFFFFFF)
		{
			client->Message(0, "  %d:  %1.1f, %1.1f, %1.1f:  disabled", iterator.GetData()->GetID(), iterator.GetData()->GetX(), iterator.GetData()->GetY(), iterator.GetData()->GetZ());
			iDisabledCount++;
		}

		x++;
		iterator.Advance();
	}

	client->Message(0, "%i of %i spawns listed.", iDisabledCount, x);
}

void Zone::ShowSpawnStatusByID(Mob* client, uint32 spawnid)
{
	LinkedListIterator<Spawn2*> iterator(spawn2_list);
	int x = 0;
	int iSpawnIDCount = 0;

	iterator.Reset();

	while(iterator.MoreElements())
	{
		if (iterator.GetData()->GetID() == spawnid)
		{
			if (iterator.GetData()->timer.GetRemainingTime() == 0xFFFFFFFF)
				client->Message(0, "  %d:  %1.1f, %1.1f, %1.1f:  disabled", iterator.GetData()->GetID(), iterator.GetData()->GetX(), iterator.GetData()->GetY(), iterator.GetData()->GetZ());
			else
				client->Message(0, "  %d:  %1.1f, %1.1f, %1.1f:  %1.2f", iterator.GetData()->GetID(), iterator.GetData()->GetX(), iterator.GetData()->GetY(), iterator.GetData()->GetZ(), (float)iterator.GetData()->timer.GetRemainingTime() / 1000);

			iSpawnIDCount++;

			break;
		}

		x++;
		iterator.Advance();
	}

	if(iSpawnIDCount > 0)
		client->Message(0, "%i of %i spawns listed.", iSpawnIDCount, x);
	else
		client->Message(0, "No matching spawn id was found in this zone.");
}
I have implemented and tested this code on EQEmu 0.7.0-843, enjoy.
Reply With Quote
  #2  
Old 09-21-2006, 02:40 AM
WildcardX
Developer
 
Join Date: Apr 2003
Posts: 589
Default

Just wanted to bump this to get it into the next code release.
__________________
Read my developer notes at my blog.

Quote:
If it's not on IRC, it ain't l33t!
Reply With Quote
  #3  
Old 10-02-2006, 02:45 PM
fathernitwit
Developer
 
Join Date: Jul 2004
Posts: 773
Default

I put in a slightly modified version for you.
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 04:11 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