I got the support for the new features added to the illusion function, but the fields will still need to be identified in the SoF illusion_struct before we can use any of the new fields. It would be cool to identify armor tint in there as well, because I am pretty sure it is in there somewhere and then we could use it for setting the new armor tint stuff from in game.
I started work on updating the #fixmob command, but I suck at coding from scratch. I can't get it to compile this yet because of the case settings, and I don't really know how to do the switch from the command argument properly.
Here is what I have so far to rewrite it so that it doesn't get ridiculously long when I add in the other features. It will still be long, but the old way was just WAY too long lol.
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 {
int16 Race = target->GetRace();
int8 Gender = target->GetGender();
int8 Texture = target->GetTexture();
int8 HelmTexture = target->GetHelmTexture();
int8 HairColor = target->GetHairColor();
int8 BeardColor = target->GetBeardColor();
int8 EyeColor1 = target->GetEyeColor1();
int8 EyeColor2 = target->GetEyeColor2();
int8 HairStyle = target->GetHairStyle();
int8 LuclinFace = target->GetLuclinFace();
int8 Beard = target->GetBeard();
int32 DrakkinHeritage = target->GetDrakkinHeritage();
int32 DrakkinTattoo = target->GetDrakkinTattoo();
int32 DrakkinDetails = target->GetDrakkinDetails();
char ChangeType;
int32 ChangeSetting;
switch(sep->arg[1]) {
case nextrace:
{
if(Race == 586)
Race = 0;
else
Race = Race + 1;
ChangeType = "Race";
ChangeSetting = Race;
break;
}
case prevrace:
{
if(Race == 0)
Race = 586;
else
Race = Race - 1;
ChangeType = "Race";
ChangeSetting = Race;
break;
}
case gender:
{
if(Gender == 2)
Gender = 0;
else
Gender = Gender + 1;
ChangeType = "Gender";
ChangeSetting = Gender;
break;
}
case nexttexture:
{
if(Texture == 25)
Texture = 0;
else
Texture = Texture + 1;
ChangeType = "Texture";
ChangeSetting = Texture;
break;
}
case prevtexture:
{
if(Texture == 0)
Texture = 25;
else
Texture = Texture - 1;
ChangeType = "Texture";
ChangeSetting = Texture;
break;
}
case nexthelm:
{
if(HelmTexture == 25)
HelmTexture = 0;
else
HelmTexture = HelmTexture + 1;
ChangeType = "HelmTexture";
ChangeSetting = HelmTexture;
break;
}
case prevhelm:
{
if(HelmTexture == 0)
HelmTexture = 25;
else
HelmTexture = HelmTexture - 1;
ChangeType = "HelmTexture";
ChangeSetting = HelmTexture;
break;
}
}
target->SendIllusionPacket(Race, Gender, Texture, HelmTexture, HairColor, BeardColor,
EyeColor1, EyeColor2, HairStyle, LuclinFace, Beard, 0xFF,
DrakkinHeritage, DrakkinTattoo, DrakkinDetails);
c->Message(0, "%c=%i", ChangeType, ChangeSetting);
}
}
Anyone wanna help me figure out what I am doing wrong with that case switch? Seems like I should be getting close to something that would work to replace the current code for the command as it is. I am sure I could get this stuff in the long way, but it would just make more very ugly coding.
Once this is working for the current #fixmob arguments, I will get the others added in. Then, we will just need to identify the rest of the SoF illusion struct and we should be set. As a bonus, I bet we could get that new armor tint setting working in this afterward, but I don't really know much about breaking the separate color fields out of the single armortint int32 field.
The new illusion function features are on the SVN already, so this stuff should be fairly easy to add in once it is written properly.
Also, I was thinking it would probably be a good idea to add in some commands to set the new features similar to the #texture command. I know #face has been in the code and not working forever, but I bet I can probably fix that pretty easily now lol.
###EDIT###
Went ahead and tried implementing #face and it seems to work fine and wasn't hard at all to add. I think we can probably just do the same thing for the other features. The #face command was already in, but wasn't coded properly. Here is the correct code to change it to in the command.cpp:
Code:
void command_face(Client *c, const Seperator *sep)
{
Mob *target=c->GetTarget();
if (!sep->IsNumber(1))
c->Message(0,"Usage: #face [number of face]");
else if (!target)
c->Message(0,"Error: this command requires a target");
else {
target->SendIllusionPacket(0, 255, 255, 255, 255, 255, 255, 255, 255, atoi(sep->arg[1]));
c->Message(0,"Face = %i", atoi(sep->arg[1]));
}
}
That seems to work anyway. I will get this added with my next SVN update. May have to play with it a bit to make sure it can maintain previous settings when changing face, though.