[Bug Fix] Fix Appearance Issues (#3520)

* [Bug Fix] Fix Appearance Issues

# Notes
- Changing race, gender, or texture of a Mob could result in it changing sizes due to use not sending the size as part of the appearance packet.
- Also converts the parameterized method to a struct parameter so that we can optionally send things without back-filling multiple arguments.

* Gender cleanup.

* Fix.

* Formatting.
This commit is contained in:
Alex King
2023-07-31 21:15:13 -04:00
committed by GitHub
parent 6cff433d23
commit fb20d92166
26 changed files with 963 additions and 592 deletions
+5 -2
View File
@@ -22,8 +22,11 @@ void SetGender(Client *c, const Seperator *sep)
}
t->SendIllusionPacket(
t->GetRace(),
gender_id
AppearanceStruct{
.gender_id = gender_id,
.race_id = t->GetRace(),
.size = t->GetSize(),
}
);
c->Message(
+7 -1
View File
@@ -30,7 +30,13 @@ void SetGenderPermanent(Client *c, const Seperator *sep)
t->SetBaseGender(gender_id);
t->Save();
t->SendIllusionPacket(t->GetRace(), gender_id);
t->SendIllusionPacket(
AppearanceStruct{
.gender_id = gender_id,
.race_id = t->GetRace(),
.size = t->GetSize(),
}
);
c->Message(
Chat::White,
+6 -1
View File
@@ -37,7 +37,12 @@ void SetRace(Client *c, const Seperator *sep)
return;
}
t->SendIllusionPacket(race_id);
t->SendIllusionPacket(
AppearanceStruct{
.race_id = race_id,
.size = t->GetSize(),
}
);
c->Message(
Chat::White,
+7 -1
View File
@@ -31,7 +31,13 @@ void SetRacePermanent(Client *c, const Seperator *sep)
t->SetBaseRace(race_id);
t->SetBaseGender(gender_id);
t->Save();
t->SendIllusionPacket(race_id, gender_id);
t->SendIllusionPacket(
AppearanceStruct{
.gender_id = gender_id,
.race_id = race_id,
.size = t->GetSize()
}
);
c->Message(
Chat::White,
+8 -6
View File
@@ -8,8 +8,8 @@ void SetTexture(Client *c, const Seperator *sep)
return;
}
const uint16 texture = Strings::ToUnsignedInt(sep->arg[2]);
const uint8 helmet_texture = (
const uint8 texture = Strings::ToUnsignedInt(sep->arg[2]);
const uint8 helmet_texture = (
sep->IsNumber(3) ?
Strings::ToUnsignedInt(sep->arg[3]) :
0
@@ -30,10 +30,12 @@ void SetTexture(Client *c, const Seperator *sep)
}
} else { // Non-Player Races only need Illusion Packets to be sent for texture
t->SendIllusionPacket(
t->GetModel(),
t->GetGender(),
texture,
helmet_texture
AppearanceStruct{
.gender_id = t->GetGender(),
.helmet_texture = helmet_texture,
.race_id = t->GetModel(),
.texture = texture,
}
);
}