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 glm::vec4 &client_position = client->GetPosition();
const float distance_max = (600.0 * 600.0); const float distance_max = (600.0 * 600.0);
for (auto it = mob_list.begin(); it != mob_list.end(); ++it) { for (auto & it : mob_list) {
spawn = it->second; spawn = it.second;
if (spawn && spawn->GetID() > 0 && spawn->Spawned()) { if (spawn && spawn->GetID() > 0 && spawn->Spawned()) {
if (!spawn->ShouldISpawnFor(client)) { if (!spawn->ShouldISpawnFor(client)) {
continue; continue;

View File

@ -1206,15 +1206,22 @@ void Mob::FillSpawnStruct(NewSpawn_Struct* ns, Mob* ForWho)
strn0cpy(ns->spawn.lastName, lastname, sizeof(ns->spawn.lastName)); strn0cpy(ns->spawn.lastName, lastname, sizeof(ns->spawn.lastName));
//for (i = 0; i < _MaterialCount; i++) //for (i = 0; i < _MaterialCount; i++)
for (i = 0; i < 9; i++) for (i = 0; i < 9; i++) {
{
// Only Player Races Wear Armor // 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].Material = GetEquipmentMaterial(i); ns->spawn.equipment.Slot[i].EliteModel = IsEliteMaterialItem(i);
ns->spawn.equipment.Slot[i].EliteModel = IsEliteMaterialItem(i);
ns->spawn.equipment.Slot[i].HerosForgeModel = GetHerosForgeModel(i); ns->spawn.equipment.Slot[i].HerosForgeModel = GetHerosForgeModel(i);
ns->spawn.equipment_tint.Slot[i].Color = GetEquipmentColor(i); ns->spawn.equipment_tint.Slot[i].Color = GetEquipmentColor(i);
}
}
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;
} }
} }
@ -1757,78 +1764,69 @@ void Mob::SendIllusionPacket(
float in_size float in_size
) )
{ {
uint8 new_texture = in_texture; uint8 new_texture = in_texture;
uint8 new_helmtexture = in_helmtexture; uint8 new_helmtexture = in_helmtexture;
uint8 new_haircolor; uint8 new_haircolor;
uint8 new_beardcolor; uint8 new_beardcolor;
uint8 new_eyecolor1; uint8 new_eyecolor1;
uint8 new_eyecolor2; uint8 new_eyecolor2;
uint8 new_hairstyle; uint8 new_hairstyle;
uint8 new_luclinface; uint8 new_luclinface;
uint8 new_beard; uint8 new_beard;
uint8 new_aa_title; uint8 new_aa_title;
uint32 new_drakkin_heritage; uint32 new_drakkin_heritage;
uint32 new_drakkin_tattoo; uint32 new_drakkin_tattoo;
uint32 new_drakkin_details; uint32 new_drakkin_details;
race = in_race; race = in_race;
if (race == 0) if (race == 0) {
{
race = (use_model) ? use_model : GetBaseRace(); race = (use_model) ? use_model : GetBaseRace();
} }
if (in_gender != 0xFF) if (in_gender != 0xFF) {
{
gender = in_gender; gender = in_gender;
} }
else else {
{
gender = (in_race) ? GetDefaultGender(race, gender) : GetBaseGender(); gender = (in_race) ? GetDefaultGender(race, gender) : GetBaseGender();
} }
if (in_texture == 0xFF && !IsPlayerRace(in_race)) if (in_texture == 0xFF && !IsPlayerRace(in_race)) {
{
new_texture = GetTexture(); new_texture = GetTexture();
} }
if (in_helmtexture == 0xFF && !IsPlayerRace(in_race)) if (in_helmtexture == 0xFF && !IsPlayerRace(in_race)) {
{
new_helmtexture = GetHelmTexture(); new_helmtexture = GetHelmTexture();
} }
new_haircolor = (in_haircolor == 0xFF) ? GetHairColor() : in_haircolor; new_haircolor = (in_haircolor == 0xFF) ? GetHairColor() : in_haircolor;
new_beardcolor = (in_beardcolor == 0xFF) ? GetBeardColor() : in_beardcolor; new_beardcolor = (in_beardcolor == 0xFF) ? GetBeardColor() : in_beardcolor;
new_eyecolor1 = (in_eyecolor1 == 0xFF) ? GetEyeColor1() : in_eyecolor1; new_eyecolor1 = (in_eyecolor1 == 0xFF) ? GetEyeColor1() : in_eyecolor1;
new_eyecolor2 = (in_eyecolor2 == 0xFF) ? GetEyeColor2() : in_eyecolor2; new_eyecolor2 = (in_eyecolor2 == 0xFF) ? GetEyeColor2() : in_eyecolor2;
new_hairstyle = (in_hairstyle == 0xFF) ? GetHairStyle() : in_hairstyle; new_hairstyle = (in_hairstyle == 0xFF) ? GetHairStyle() : in_hairstyle;
new_luclinface = (in_luclinface == 0xFF) ? GetLuclinFace() : in_luclinface; new_luclinface = (in_luclinface == 0xFF) ? GetLuclinFace() : in_luclinface;
new_beard = (in_beard == 0xFF) ? GetBeard() : in_beard; new_beard = (in_beard == 0xFF) ? GetBeard() : in_beard;
new_drakkin_heritage = new_drakkin_heritage = (in_drakkin_heritage == 0xFFFFFFFF) ? GetDrakkinHeritage() : in_drakkin_heritage;
(in_drakkin_heritage == 0xFFFFFFFF) ? GetDrakkinHeritage() : in_drakkin_heritage; new_drakkin_tattoo = (in_drakkin_tattoo == 0xFFFFFFFF) ? GetDrakkinTattoo() : in_drakkin_tattoo;
new_drakkin_tattoo = new_drakkin_details = (in_drakkin_details == 0xFFFFFFFF) ? GetDrakkinDetails() : in_drakkin_details;
(in_drakkin_tattoo == 0xFFFFFFFF) ? GetDrakkinTattoo() : in_drakkin_tattoo; new_aa_title = in_aa_title;
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 // Reset features to Base from the Player Profile
if (IsClient() && in_race == 0) { if (IsClient() && in_race == 0) {
race = CastToClient()->GetBaseRace(); race = CastToClient()->GetBaseRace();
gender = CastToClient()->GetBaseGender(); gender = CastToClient()->GetBaseGender();
new_texture = texture = 0xFF; new_texture = texture = 0xFF;
new_helmtexture = helmtexture = 0xFF; new_helmtexture = helmtexture = 0xFF;
new_haircolor = haircolor = CastToClient()->GetBaseHairColor(); new_haircolor = haircolor = CastToClient()->GetBaseHairColor();
new_beardcolor = beardcolor = CastToClient()->GetBaseBeardColor(); new_beardcolor = beardcolor = CastToClient()->GetBaseBeardColor();
new_eyecolor1 = eyecolor1 = CastToClient()->GetBaseEyeColor(); new_eyecolor1 = eyecolor1 = CastToClient()->GetBaseEyeColor();
new_eyecolor2 = eyecolor2 = CastToClient()->GetBaseEyeColor(); new_eyecolor2 = eyecolor2 = CastToClient()->GetBaseEyeColor();
new_hairstyle = hairstyle = CastToClient()->GetBaseHairStyle(); new_hairstyle = hairstyle = CastToClient()->GetBaseHairStyle();
new_luclinface = luclinface = CastToClient()->GetBaseFace(); new_luclinface = luclinface = CastToClient()->GetBaseFace();
new_beard = beard = CastToClient()->GetBaseBeard(); new_beard = beard = CastToClient()->GetBaseBeard();
new_aa_title = aa_title = 0xFF; new_aa_title = aa_title = 0xFF;
new_drakkin_heritage = drakkin_heritage = CastToClient()->GetBaseHeritage(); new_drakkin_heritage = drakkin_heritage = CastToClient()->GetBaseHeritage();
new_drakkin_tattoo = drakkin_tattoo = CastToClient()->GetBaseTattoo(); new_drakkin_tattoo = drakkin_tattoo = CastToClient()->GetBaseTattoo();
new_drakkin_details = drakkin_details = CastToClient()->GetBaseDetails(); new_drakkin_details = drakkin_details = CastToClient()->GetBaseDetails();
switch (race) { switch (race) {
case OGRE: case OGRE:
size = 9; size = 9;
@ -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)); auto outapp = new EQApplicationPacket(OP_Illusion, sizeof(Illusion_Struct));
Illusion_Struct *is = (Illusion_Struct *) outapp->pBuffer; Illusion_Struct *is = (Illusion_Struct *) outapp->pBuffer;
is->spawnid = GetID(); is->spawnid = GetID();
@ -1883,9 +1896,10 @@ void Mob::SendIllusionPacket(
safe_delete(outapp); safe_delete(outapp);
/* Refresh armor and tints after send illusion packet */ /* 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, race,
gender, gender,
new_texture, new_texture,
@ -1899,7 +1913,8 @@ void Mob::SendIllusionPacket(
new_drakkin_heritage, new_drakkin_heritage,
new_drakkin_tattoo, new_drakkin_tattoo,
new_drakkin_details, new_drakkin_details,
size); size
);
} }
bool Mob::RandomizeFeatures(bool send_illusion, bool set_variables) 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) if (in_size > 255.0)
in_size = 255.0; in_size = 255.0;
//End of Size Code //End of Size Code
this->size = in_size; size = in_size;
SendAppearancePacket(AT_Size, (uint32) in_size); SendAppearancePacket(AT_Size, (uint32) in_size);
} }