From e99c8dafc5e549cefb82e383ab2dc704f5c72ef2 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Sun, 23 Jan 2022 20:27:45 -0500 Subject: [PATCH] spellbar lock bug fix (#1943) --- zone/client.h | 1 + zone/client_packet.cpp | 4 ++++ zone/spells.cpp | 16 ++++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/zone/client.h b/zone/client.h index c6e12071e..598d12f6a 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1491,6 +1491,7 @@ public: void LeaveRaidXTargets(Raid *r); bool GroupFollow(Client* inviter); inline bool GetRunMode() const { return runmode; } + void SendItemRecastTimer(uint32 recast_type, uint32 recast_delay = 0); inline bool AggroMeterAvailable() const { return ((m_ClientVersionBit & EQ::versions::maskRoF2AndLater)) && RuleB(Character, EnableAggroMeter); } // RoF untested inline void SetAggroMeterLock(int in) { m_aggrometer.set_lock_id(in); } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 0e1556623..9965778fc 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -8887,6 +8887,9 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) if (item->RecastDelay > 0) { if (!GetPTimers().Expired(&database, (pTimerItemStart + item->RecastType), false)) { + SendItemRecastTimer(item->RecastType); //Problem: When you loot corpse, recast display is not present. This causes it to display again. Could not get to display when sending from looting. + MessageString(Chat::Red, SPELL_RECAST); + SendSpellBarEnable(item->Click.Effect); LogSpells("Casting of [{}] canceled: item spell reuse timer not expired", spell_id); return; } @@ -8926,6 +8929,7 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) if (!GetPTimers().Expired(&database, (pTimerItemStart + augitem->RecastType), false)) { LogSpells("Casting of [{}] canceled: item spell reuse timer from augment not expired", spell_id); MessageString(Chat::Red, SPELL_RECAST); + SendSpellBarEnable(augitem->Click.Effect); return; } } diff --git a/zone/spells.cpp b/zone/spells.cpp index 716f3b343..a3db1d736 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -6284,6 +6284,22 @@ void Client::SendSpellAnim(uint16 targetid, uint16 spell_id) entity_list.QueueCloseClients(this, &app, false, RuleI(Range, SpellParticles)); } +void Client::SendItemRecastTimer(uint32 recast_type, uint32 recast_delay) +{ + if (!recast_delay) { + recast_delay = GetPTimers().GetRemainingTime(pTimerItemStart + recast_type); + } + + if (recast_delay) { + auto outapp = new EQApplicationPacket(OP_ItemRecastDelay, sizeof(ItemRecastDelay_Struct)); + ItemRecastDelay_Struct *ird = (ItemRecastDelay_Struct *)outapp->pBuffer; + ird->recast_delay = recast_delay; + ird->recast_type = recast_type; + QueuePacket(outapp); + safe_delete(outapp); + } +} + void Mob::CalcDestFromHeading(float heading, float distance, float MaxZDiff, float StartX, float StartY, float &dX, float &dY, float &dZ) { if (!distance) { return; }