PDA

View Full Version : #fixmob Command Adjustments


trevius
05-10-2008, 06:14 AM
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:

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|n exthelm|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):

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|n exthelm|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

trevius
05-10-2008, 07:03 AM
Just compiled this and it works great! Now if I can only learn enough code to start fixing things that are actually important! :P

Knightly
05-10-2008, 03:18 PM
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 ;-)

Scorpious2k
06-18-2008, 07:26 PM
This will be in version 1113.