Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #1  
Old 05-10-2008, 06:14 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default #fixmob Command Adjustments

I recently started using this command to help with checking for spawns available to certain zones if they aren't all listed in the eqemu guidebook. Many of the newer ones are missing, so I was just trying to use this to go through them manually. I found there were a couple of things that I think could use adjustments. One thing I noticed is that the command only goes up to race 329 and then cycles back to race 1. I have increased that to 473 which is the highest known race (Fairy). Also, it doesn't allow you to change texture to 0 with this command, so I adjusted that as well. Last, it cycles through 4 genders (0, 1, 2, 3), so I removed gender 3, since I don't think that is used ever.

Here is the original source from 1108 in the command.cpp file:

Code:
void command_fixmob(Client *c, const Seperator *sep)
{
	Mob *target=c->GetTarget();

	if (!sep->arg[1])
		c->Message(0,"Usage: #fixmob [nextrace|prevrace|gender|nexttexture|prevtexture|nexthelm|prevhelm]");
	else if (!target)
		c->Message(0,"Error: this command requires an NPC target");
	else if (strcasecmp(sep->arg[1], "nextrace") == 0) {
		// Set to next race
		if (target->GetRace() == 329) {
			target->SendIllusionPacket(1);
			c->Message(0, "Race=1");
		}
		else {
			target->SendIllusionPacket(target->GetRace()+1);
			c->Message(0, "Race=%i",target->GetRace());
		}
	}
	else if (strcasecmp(sep->arg[1], "prevrace") == 0) {
		// Set to previous race
		if (target->GetRace() == 1) {
			target->SendIllusionPacket(329);
			c->Message(0, "Race=%i",329);
		}
		else {
			target->SendIllusionPacket(target->GetRace()-1);
			c->Message(0, "Race=%i",target->GetRace());
		}
	}
	else if (strcasecmp(sep->arg[1], "gender") == 0) {
		// Cycle through the 3 gender modes
		if (target->GetGender() == 0) {
			target->SendIllusionPacket(target->GetRace(), 3);
			c->Message(0, "Gender=%i",3);
		}
		else {
			target->SendIllusionPacket(target->GetRace(), target->GetGender()-1);
			c->Message(0, "Gender=%i",target->GetGender());
		}
	}
	else if (strcasecmp(sep->arg[1], "nexttexture") == 0) {
		// Set to next texture
		if (target->GetTexture() == 25) {
			target->SendIllusionPacket(target->GetRace(), target->GetGender(), 1);
			c->Message(0, "Texture=1");
		}
		else {
			target->SendIllusionPacket(target->GetRace(), target->GetGender(), target->GetTexture()+1);
			c->Message(0, "Texture=%i",target->GetTexture());
		}
	}
	else if (strcasecmp(sep->arg[1], "prevtexture") == 0) {
		// Set to previous texture
		if (target->GetTexture() == 1) {
			target->SendIllusionPacket(target->GetRace(), target->GetGender(), 25);
			c->Message(0, "Texture=%i",25);
		}
		else {
			target->SendIllusionPacket(target->GetRace(), target->GetGender(), target->GetTexture()-1);
			c->Message(0, "Texture=%i",target->GetTexture());
		}
	}
	else if (strcasecmp(sep->arg[1], "nexthelm") == 0) {
		// Set to next helm.  Only noticed a difference on giants.
		if (target->GetHelmTexture() == 25) {
			target->SendIllusionPacket(target->GetRace(), target->GetGender(), target->GetTexture(), 1);
			c->Message(0, "HelmTexture=1");
		}
		else {
			target->SendIllusionPacket(target->GetRace(), target->GetGender(), target->GetTexture(), target->GetHelmTexture()+1);
			c->Message(0, "HelmTexture=%i",target->GetHelmTexture());
		}
	}
	else if (strcasecmp(sep->arg[1], "prevhelm") == 0) {
		// Set to previous helm.  Only noticed a difference on giants.
		if (target->GetHelmTexture() == 1) {
			target->SendIllusionPacket(target->GetRace(), target->GetGender(), target->GetTexture(), 25);
			c->Message(0, "HelmTexture=%i",25);
		}
		else {
			target->SendIllusionPacket(target->GetRace(), target->GetGender(), target->GetTexture(), target->GetHelmTexture()-1);
			c->Message(0, "HelmTexture=%i",target->GetHelmTexture());
		}
	}
}
And here are the code change suggestions that I have made (changes marked in red):

Code:
void command_fixmob(Client *c, const Seperator *sep)
{
	Mob *target=c->GetTarget();

	if (!sep->arg[1])
		c->Message(0,"Usage: #fixmob [nextrace|prevrace|gender|nexttexture|prevtexture|nexthelm|prevhelm]");
	else if (!target)
		c->Message(0,"Error: this command requires an NPC target");
	else if (strcasecmp(sep->arg[1], "nextrace") == 0) {
		// Set to next race
		if (target->GetRace() == 473) {
			target->SendIllusionPacket(0);
			c->Message(0, "Race=0");
		}
		else {
			target->SendIllusionPacket(target->GetRace()+1);
			c->Message(0, "Race=%i",target->GetRace());
		}
	}
	else if (strcasecmp(sep->arg[1], "prevrace") == 0) {
		// Set to previous race
		if (target->GetRace() == 0) {
			target->SendIllusionPacket(473);
			c->Message(0, "Race=%i",473);
		}
		else {
			target->SendIllusionPacket(target->GetRace()-1);
			c->Message(0, "Race=%i",target->GetRace());
		}
	}
	else if (strcasecmp(sep->arg[1], "gender") == 0) {
		// Cycle through the 3 gender modes
		if (target->GetGender() == 0) {
			target->SendIllusionPacket(target->GetRace(), 2);
			c->Message(0, "Gender=%i",2);
		}
		else {
			target->SendIllusionPacket(target->GetRace(), target->GetGender()-1);
			c->Message(0, "Gender=%i",target->GetGender());
		}
	}
	else if (strcasecmp(sep->arg[1], "nexttexture") == 0) {
		// Set to next texture
		if (target->GetTexture() == 25) {
			target->SendIllusionPacket(target->GetRace(), target->GetGender(), 0);
			c->Message(0, "Texture=0");
		}
		else {
			target->SendIllusionPacket(target->GetRace(), target->GetGender(), target->GetTexture()+1);
			c->Message(0, "Texture=%i",target->GetTexture());
		}
	}
	else if (strcasecmp(sep->arg[1], "prevtexture") == 0) {
		// Set to previous texture
		if (target->GetTexture() == 0) {
			target->SendIllusionPacket(target->GetRace(), target->GetGender(), 25);
			c->Message(0, "Texture=%i",25);
		}
		else {
			target->SendIllusionPacket(target->GetRace(), target->GetGender(), target->GetTexture()-1);
			c->Message(0, "Texture=%i",target->GetTexture());
		}
	}
	else if (strcasecmp(sep->arg[1], "nexthelm") == 0) {
		// Set to next helm.  Only noticed a difference on giants.
		if (target->GetHelmTexture() == 25) {
			target->SendIllusionPacket(target->GetRace(), target->GetGender(), target->GetTexture(), 0);
			c->Message(0, "HelmTexture=0");
		}
		else {
			target->SendIllusionPacket(target->GetRace(), target->GetGender(), target->GetTexture(), target->GetHelmTexture()+1);
			c->Message(0, "HelmTexture=%i",target->GetHelmTexture());
		}
	}
	else if (strcasecmp(sep->arg[1], "prevhelm") == 0) {
		// Set to previous helm.  Only noticed a difference on giants.
		if (target->GetHelmTexture() == 0) {
			target->SendIllusionPacket(target->GetRace(), target->GetGender(), target->GetTexture(), 25);
			c->Message(0, "HelmTexture=%i",25);
		}
		else {
			target->SendIllusionPacket(target->GetRace(), target->GetGender(), target->GetTexture(), target->GetHelmTexture()-1);
			c->Message(0, "HelmTexture=%i",target->GetHelmTexture());
		}
	}
}
I am no coder, so someone will probably want to check this over. I am gonna try to get it compiled and make sure it works. I will post here if I notice any problems. This is just a minor fix, but I guess something is better than nothing lol. If I am gonna start learning to code I have to start somewhere :P
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!

Last edited by KLS; 06-07-2008 at 01:10 AM..
Reply With Quote
  #2  
Old 05-10-2008, 07:03 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Just compiled this and it works great! Now if I can only learn enough code to start fixing things that are actually important! :P
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #3  
Old 05-10-2008, 03:18 PM
Knightly
Accomplished Programmer
 
Join Date: Nov 2006
Location: Honolulu, HI
Posts: 91
Default

Quote:
Now if I can only learn enough code to start fixing things that are actually important!
Bah, everything's important. Small fixes, big fixes, it's all useful in the end. Fix what you can fix...fix what you want to fix. It's the best way to keep you fixing things
Reply With Quote
  #4  
Old 06-18-2008, 07:26 PM
Scorpious2k's Avatar
Scorpious2k
Demi-God
 
Join Date: Mar 2003
Location: USA
Posts: 1,067
Default

This will be in version 1113.
__________________
Maybe I should try making one of these servers...
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 03:58 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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3