From 453925153fed89e7939910aeeae808511778187e Mon Sep 17 00:00:00 2001 From: "Veit F." <52582670+HoodOG1@users.noreply.github.com> Date: Sun, 22 Jun 2025 00:08:47 +0200 Subject: [PATCH] [URGENT Fix] Trinket proc effects are getting cast even if they are not onUse - Leads to big server lags (#1385) * fix: :ambulance: Add spellProcFlag check for flag 2 at UseTrinket Context-Action Bots will "learn" the trinket proc, so CanCastSpell() will be true e.g. on Item https://www.wowhead.com/wotlk/item=44074/oracle-talisman-of-ablution leading to constant casting of the proc spell onto themselfes https://www.wowhead.com/wotlk/spell=59787/oracle-ablutions. This will lead to multiple hundreds of entries in m_appliedAuras -> Once killing an enemy -> Big diff time spikes. See diagnosis * perf: :zap: Should futher reduce the problems, hindering trinkets with other proc flags of being used, see https://www.azerothcore.org/wiki/spell_proc_event I have tested bots with active trinkets and they are still using them, as well as onhit trinkets are still being triggered like they should. Could also fix some other weird behavior. --- src/strategy/actions/GenericSpellActions.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/strategy/actions/GenericSpellActions.cpp b/src/strategy/actions/GenericSpellActions.cpp index 3ac2a7e4..bbae9e30 100644 --- a/src/strategy/actions/GenericSpellActions.cpp +++ b/src/strategy/actions/GenericSpellActions.cpp @@ -304,7 +304,6 @@ bool UseTrinketAction::Execute(Event event) return true; Item* trinket2 = bot->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_TRINKET2); - if (trinket2 && UseTrinket(trinket2)) return true; @@ -333,6 +332,15 @@ bool UseTrinketAction::UseTrinket(Item* item) if (item->GetTemplate()->Spells[i].SpellId > 0 && item->GetTemplate()->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE) { spellId = item->GetTemplate()->Spells[i].SpellId; + uint32 spellProcFlag = sSpellMgr->GetSpellInfo(spellId)->ProcFlags; + + // Handle items with procflag "if you kill a target that grants honor or experience" + // Bots will "learn" the trinket proc, so CanCastSpell() will be true + // e.g. on Item https://www.wowhead.com/wotlk/item=44074/oracle-talisman-of-ablution leading to + // constant casting of the proc spell onto themselfes https://www.wowhead.com/wotlk/spell=59787/oracle-ablutions + // This will lead to multiple hundreds of entries in m_appliedAuras -> Once killing an enemy -> Big diff time spikes + if (spellProcFlag != 0) return false; + if (!botAI->CanCastSpell(spellId, bot, false)) { return false;