From 5ce2889210ced81b2d7642456815cb4334bd4d3b Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 3 Feb 2022 22:04:15 -0500 Subject: [PATCH] [Bug Fix] Illusions will now properly display armor to other clients when they zone in. (#1958) * Fix for illusion wear change On zone in, mobs with illusions were not displaying correct armor. * [Bug Fix] Illusions will now properly display armor to other clients when they zone in better looping --- zone/bonuses.cpp | 8 ++++++++ zone/client_packet.cpp | 2 ++ zone/common.h | 1 + zone/entity.cpp | 19 +++++++++++++++++++ zone/entity.h | 1 + zone/mob.h | 1 + zone/spell_effects.cpp | 20 ++++++++++++++++++++ 7 files changed, 52 insertions(+) diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index 73f388fe1..29306ebdb 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -1460,6 +1460,10 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon) break; } + case SE_Illusion: + newbon->Illusion = true; + break; + case SE_IllusionPersistence: newbon->IllusionPersistence = base_value; break; @@ -3541,6 +3545,10 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne break; } + case SE_Illusion: + new_bonus->Illusion = true; + break; + case SE_IllusionPersistence: new_bonus->IllusionPersistence = effect_value; break; diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 585878092..9a532362d 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -747,6 +747,8 @@ void Client::CompleteConnect() entity_list.SendAppearanceEffects(this); + entity_list.SendIllusionWearChange(this); + entity_list.SendTraders(this); Mob *pet = GetPet(); diff --git a/zone/common.h b/zone/common.h index e79293388..648432213 100644 --- a/zone/common.h +++ b/zone/common.h @@ -559,6 +559,7 @@ struct StatBonuses { int32 WeaponStance[WEAPON_STANCE_TYPE_MAX +1];// base = trigger spell id, base2 = 0 is 2h, 1 is shield, 2 is dual wield, [0]spid 2h, [1]spid shield, [2]spid DW bool ZoneSuspendMinion; // base 1 allows suspended minions to zone bool CompleteHealBuffBlocker; // Use in SPA 101 to prevent recast of complete heal from this effect till blocker buff is removed. + bool Illusion; // check if illusion is present. // AAs int32 TrapCircumvention; // reduce chance to trigger a trap. diff --git a/zone/entity.cpp b/zone/entity.cpp index 860331ef0..ad9da930d 100644 --- a/zone/entity.cpp +++ b/zone/entity.cpp @@ -4686,6 +4686,25 @@ void EntityList::SendAppearanceEffects(Client *c) } } +void EntityList::SendIllusionWearChange(Client *c) +{ + if (!c) { + return; + } + + for (auto &e : mob_list) { + auto &mob = e.second; + + if (mob) { + if (mob == c) { + continue; + } + + mob->SendIllusionWearChange(c); + } + } +} + void EntityList::ZoneWho(Client *c, Who_All_Struct *Who) { // This is only called for SoF clients, as regular /who is now handled server-side for that client. diff --git a/zone/entity.h b/zone/entity.h index 54a5a2fff..c92a3d4f5 100644 --- a/zone/entity.h +++ b/zone/entity.h @@ -382,6 +382,7 @@ public: void SendNimbusEffects(Client *c); void SendUntargetable(Client *c); void SendAppearanceEffects(Client *c); + void SendIllusionWearChange(Client *c); void DuelMessage(Mob* winner, Mob* loser, bool flee); void QuestJournalledSayClose(Mob *sender, float dist, const char* mobname, const char* message, Journal::Options &opts); void GroupMessage(uint32 gid, const char *from, const char *message); diff --git a/zone/mob.h b/zone/mob.h index f17c5c058..2e77ef415 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -357,6 +357,7 @@ public: void ConeDirectional(uint16 spell_id, int16 resist_adjust); void TryOnSpellFinished(Mob *caster, Mob *target, uint16 spell_id); void ApplySpellEffectIllusion(int32 spell_id, Mob* caster, int buffslot, int base, int limit, int max); + void SendIllusionWearChange(Client* c); //Buff void BuffProcess(); diff --git a/zone/spell_effects.cpp b/zone/spell_effects.cpp index 51c0f99ef..e92e2cd92 100644 --- a/zone/spell_effects.cpp +++ b/zone/spell_effects.cpp @@ -8963,6 +8963,26 @@ void Mob::SetProcLimitTimer(int32 base_spell_id, uint32 proc_reuse_time, int pro } } +void Mob::SendIllusionWearChange(Client* c) { + + /* + We send this to client on Client::CompleteConnect() to properly update textures of + other mobs in zone with illusions on them. + */ + if (!c) { + return; + } + + if (!spellbonuses.Illusion && !itembonuses.Illusion && !aabonuses.Illusion) { + return; + } + + for (int x = EQ::textures::textureBegin; x <= EQ::textures::LastTintableTexture; x++) { + SendWearChange(x, c); + } +} + + void Mob::ApplySpellEffectIllusion(int32 spell_id, Mob *caster, int buffslot, int base, int limit, int max) { // Gender Illusions