SendIllusion Update Internal Values (#1130)

* Fix scenarios where quest calls to SendIllusion also update internal values so that new clients that zone in see the correct appearance

* Typo [skip ci]
This commit is contained in:
Chris Miles 2020-10-25 21:48:29 -05:00 committed by GitHub
parent e9d312fa86
commit 62efae2e00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 83 additions and 68 deletions

View File

@ -1322,8 +1322,8 @@ void EntityList::SendZoneSpawnsBulk(Client *client)
const glm::vec4 &client_position = client->GetPosition();
const float distance_max = (600.0 * 600.0);
for (auto it = mob_list.begin(); it != mob_list.end(); ++it) {
spawn = it->second;
for (auto & it : mob_list) {
spawn = it.second;
if (spawn && spawn->GetID() > 0 && spawn->Spawned()) {
if (!spawn->ShouldISpawnFor(client)) {
continue;

View File

@ -1206,11 +1206,9 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
strn0cpy(ns->spawn.lastName, lastname, sizeof(ns->spawn.lastName));
//for (i = 0; i < _MaterialCount; i++)
for (i = 0; i < 9; i++)
{
for (i = 0; i < 9; i++) {
// Only Player Races Wear Armor
if (Mob::IsPlayerRace(race) || i > 6)
{
if (Mob::IsPlayerRace(race) || i > 6) {
ns->spawn.equipment.Slot[i].Material = GetEquipmentMaterial(i);
ns->spawn.equipment.Slot[i].EliteModel = IsEliteMaterialItem(i);
ns->spawn.equipment.Slot[i].HerosForgeModel = GetHerosForgeModel(i);
@ -1218,6 +1216,15 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
}
}
if (texture > 0) {
for (i = 0; i < 9; i++) {
if (i == EQ::textures::weaponPrimary || i == EQ::textures::weaponSecondary || texture == 255) {
continue;
}
ns->spawn.equipment.Slot[i].Material = texture;
}
}
memset(ns->spawn.set_to_0xFF, 0xFF, sizeof(ns->spawn.set_to_0xFF));
if(IsNPC() && IsDestructibleObject())
{
@ -1772,27 +1779,22 @@ void Mob::SendIllusionPacket(
uint32 new_drakkin_details;
race = in_race;
if (race == 0)
{
if (race == 0) {
race = (use_model) ? use_model : GetBaseRace();
}
if (in_gender != 0xFF)
{
if (in_gender != 0xFF) {
gender = in_gender;
}
else
{
else {
gender = (in_race) ? GetDefaultGender(race, gender) : GetBaseGender();
}
if (in_texture == 0xFF && !IsPlayerRace(in_race))
{
if (in_texture == 0xFF && !IsPlayerRace(in_race)) {
new_texture = GetTexture();
}
if (in_helmtexture == 0xFF && !IsPlayerRace(in_race))
{
if (in_helmtexture == 0xFF && !IsPlayerRace(in_race)) {
new_helmtexture = GetHelmTexture();
}
@ -1803,14 +1805,10 @@ void Mob::SendIllusionPacket(
new_hairstyle = (in_hairstyle == 0xFF) ? GetHairStyle() : in_hairstyle;
new_luclinface = (in_luclinface == 0xFF) ? GetLuclinFace() : in_luclinface;
new_beard = (in_beard == 0xFF) ? GetBeard() : in_beard;
new_drakkin_heritage =
(in_drakkin_heritage == 0xFFFFFFFF) ? GetDrakkinHeritage() : in_drakkin_heritage;
new_drakkin_tattoo =
(in_drakkin_tattoo == 0xFFFFFFFF) ? GetDrakkinTattoo() : in_drakkin_tattoo;
new_drakkin_details =
(in_drakkin_details == 0xFFFFFFFF) ? GetDrakkinDetails() : in_drakkin_details;
new_drakkin_heritage = (in_drakkin_heritage == 0xFFFFFFFF) ? GetDrakkinHeritage() : in_drakkin_heritage;
new_drakkin_tattoo = (in_drakkin_tattoo == 0xFFFFFFFF) ? GetDrakkinTattoo() : in_drakkin_tattoo;
new_drakkin_details = (in_drakkin_details == 0xFFFFFFFF) ? GetDrakkinDetails() : in_drakkin_details;
new_aa_title = in_aa_title;
size = (in_size <= 0.0f) ? GetSize() : in_size;
// Reset features to Base from the Player Profile
if (IsClient() && in_race == 0) {
@ -1859,6 +1857,21 @@ void Mob::SendIllusionPacket(
}
}
// update internal values for mob
size = (in_size <= 0.0f) ? GetSize() : in_size;
texture = new_texture;
helmtexture = new_helmtexture;
haircolor = new_haircolor;
beardcolor = new_beardcolor;
eyecolor1 = new_eyecolor1;
eyecolor2 = new_eyecolor2;
hairstyle = new_hairstyle;
luclinface = new_luclinface;
beard = new_beard;
drakkin_heritage = new_drakkin_heritage;
drakkin_tattoo = new_drakkin_tattoo;
drakkin_details = new_drakkin_details;
auto outapp = new EQApplicationPacket(OP_Illusion, sizeof(Illusion_Struct));
Illusion_Struct *is = (Illusion_Struct *) outapp->pBuffer;
is->spawnid = GetID();
@ -1883,9 +1896,10 @@ void Mob::SendIllusionPacket(
safe_delete(outapp);
/* Refresh armor and tints after send illusion packet */
this->SendArmorAppearance();
SendArmorAppearance();
LogSpells("Illusion: Race = [{}], Gender = [{}], Texture = [{}], HelmTexture = [{}], HairColor = [{}], BeardColor = [{}], EyeColor1 = [{}], EyeColor2 = [{}], HairStyle = [{}], Face = [{}], DrakkinHeritage = [{}], DrakkinTattoo = [{}], DrakkinDetails = [{}], Size = [{}]",
LogSpells(
"Illusion: Race [{}] Gender [{}] Texture [{}] HelmTexture [{}] HairColor [{}] BeardColor [{}] EyeColor1 [{}] EyeColor2 [{}] HairStyle [{}] Face [{}] DrakkinHeritage [{}] DrakkinTattoo [{}] DrakkinDetails [{}] Size [{}]",
race,
gender,
new_texture,
@ -1899,7 +1913,8 @@ void Mob::SendIllusionPacket(
new_drakkin_heritage,
new_drakkin_tattoo,
new_drakkin_details,
size);
size
);
}
bool Mob::RandomizeFeatures(bool send_illusion, bool set_variables)
@ -2405,7 +2420,7 @@ void Mob::ChangeSize(float in_size = 0, bool bNoRestriction) {
if (in_size > 255.0)
in_size = 255.0;
//End of Size Code
this->size = in_size;
size = in_size;
SendAppearancePacket(AT_Size, (uint32) in_size);
}