[Bug Fix] Hero Forge armor graphics not displaying properly to other clients in zone. (#1883)

* fix part1

* updates

* Update inventory.cpp

* fixed

* Update inventory.cpp

* update

* [Bug Fix] Hero Forge armor graphics not displaying properly to other clients in zone.
This commit is contained in:
KayenEQ 2021-12-14 11:26:59 -05:00 committed by GitHub
parent 26b21673ad
commit 6da7116c66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 51 additions and 21 deletions

View File

@ -270,6 +270,8 @@ Client::Client(EQStreamInterface* ieqs)
if (RuleI(World, PVPMinLevel) > 0 && level >= RuleI(World, PVPMinLevel) && m_pp.pvp == 0) SetPVP(true, false);
dynamiczone_removal_timer.Disable();
heroforge_wearchange_timer.Disable();
//for good measure:
memset(&m_pp, 0, sizeof(m_pp));
memset(&m_epp, 0, sizeof(m_epp));

View File

@ -1870,6 +1870,8 @@ private:
Timer dynamiczone_removal_timer;
Timer task_request_timer;
Timer heroforge_wearchange_timer;
glm::vec3 m_Proximity;
glm::vec4 last_position_before_bulk_update;

View File

@ -747,28 +747,11 @@ void Client::CompleteConnect()
entity_list.SendAppearanceEffects(this);
int x;
for (x = EQ::textures::textureBegin; x <= EQ::textures::LastTexture; x++) {
SendWearChange(x);
}
// added due to wear change above
UpdateActiveLight();
SendAppearancePacket(AT_Light, GetActiveLightType());
Mob *pet = GetPet();
if (pet != nullptr) {
for (x = EQ::textures::textureBegin; x <= EQ::textures::LastTexture; x++) {
pet->SendWearChange(x);
}
// added due to wear change above
pet->UpdateActiveLight();
pet->SendAppearancePacket(AT_Light, pet->GetActiveLightType());
}
entity_list.SendTraders(this);
if (GetPet()) {
GetPet()->SendPetBuffsToClient();
Mob *pet = GetPet();
if (pet) {
pet->SendPetBuffsToClient();
}
if (GetGroup())
@ -918,6 +901,8 @@ void Client::CompleteConnect()
worldserver.SendPacket(p);
safe_delete(p);
}
heroforge_wearchange_timer.Start(250);
}
// connecting opcode handlers

View File

@ -199,6 +199,25 @@ bool Client::Process() {
instalog = true;
}
if (heroforge_wearchange_timer.Check()) {
/*
This addresses bug where on zone in heroforge models would not be sent to other clients when this was
in Client::CompleteConnect(). Sending after a small 250 ms delay after that function resolves the issue.
Unclear the underlying reason for this, if a better solution can be found then can move this back.
*/
if (queue_wearchange_slot >= 0) { //Resend slot from Client::SwapItem if heroforge item is swapped.
SendWearChange(static_cast<uint8>(queue_wearchange_slot));
}
else { //Send from Client::CompleteConnect()
SendWearChangeAndLighting(EQ::textures::LastTexture);
Mob *pet = GetPet();
if (pet) {
pet->SendWearChangeAndLighting(EQ::textures::LastTexture);
}
}
heroforge_wearchange_timer.Disable();
}
if (IsStunned() && stunned_timer.Check())
Mob::UnStun();

View File

@ -2224,9 +2224,13 @@ bool Client::SwapItem(MoveItem_Struct* move_in) {
}
int matslot = SlotConvert2(dst_slot_id);
if (dst_slot_id <= EQ::invslot::EQUIPMENT_END && matslot != EQ::textures::armorHead) { // think this is to allow the client to update with /showhelm
if (dst_slot_id <= EQ::invslot::EQUIPMENT_END) {// on Titanium and ROF2 /showhelm works even if sending helm slot
SendWearChange(matslot);
}
// This is part of a bug fix to ensure heroforge graphics display to other clients in zone.
if (queue_wearchange_slot >= 0) {
heroforge_wearchange_timer.Start(100);
}
// Step 7: Save change to the database
if (src_slot_id == EQ::invslot::slotCursor) {

View File

@ -495,6 +495,8 @@ Mob::Mob(
use_double_melee_round_dmg_bonus = false;
dw_same_delay = 0;
queue_wearchange_slot = -1;
#ifdef BOTS
m_manual_follow = false;
#endif
@ -3168,6 +3170,16 @@ bool Mob::UpdateActiveLight()
return (m_Light.Level[EQ::lightsource::LightActive] != old_light_level);
}
void Mob::SendWearChangeAndLighting(int8 last_texture) {
for (int i = EQ::textures::textureBegin; i <= last_texture; i++) {
SendWearChange(i);
}
UpdateActiveLight();
SendAppearancePacket(AT_Light, GetActiveLightType());
}
void Mob::ChangeSize(float in_size = 0, bool bNoRestriction) {
// Size Code
if (!bNoRestriction)

View File

@ -911,6 +911,7 @@ public:
virtual void UpdateEquipmentLight() { m_Light.Type[EQ::lightsource::LightEquipment] = 0; m_Light.Level[EQ::lightsource::LightEquipment] = 0; }
inline void SetSpellLightType(uint8 light_type) { m_Light.Type[EQ::lightsource::LightSpell] = (light_type & 0x0F); m_Light.Level[EQ::lightsource::LightSpell] = EQ::lightsource::TypeToLevel(m_Light.Type[EQ::lightsource::LightSpell]); }
void SendWearChangeAndLighting(int8 last_texture);
inline uint8 GetActiveLightType() { return m_Light.Type[EQ::lightsource::LightActive]; }
bool UpdateActiveLight(); // returns true if change, false if no change
@ -1516,6 +1517,8 @@ protected:
int32 appearance_effects_id[MAX_APPEARANCE_EFFECTS];
int32 appearance_effects_slot[MAX_APPEARANCE_EFFECTS];
int queue_wearchange_slot;
Timer shield_timer;
uint32 m_shield_target_id;
uint32 m_shielder_id;

View File

@ -433,6 +433,9 @@ void Mob::SendWearChange(uint8 material_slot, Client *one_client)
wear_change->wear_slot_id = material_slot;
// Part of a bug fix to ensure heroforge models send to other clients in zone.
queue_wearchange_slot = wear_change->hero_forge_model ? material_slot : -1;
if (!one_client) {
entity_list.QueueClients(this, packet);
}