Jewel_of_the_Resolute = 390000 Jewel_of_the_Valorous = 390100 Jewel_of_the_Hunt = 390200 Jewel_of_the_Reckless = 390300 Jewel_of_the_Immovable = 390400 Jewel_of_the_Relentless = 390500 Jewel_of_the_Devious = 390600 Jewel_of_the_Primeval = 390700 Jewel_of_the_Cosmos = 390800 Jewel_of_the_Underworld = 390900 Jewel_of_the_Devourer = 391000 Jewel_of_the_Storm = 391100 Jewel_of_the_Darkness = 391200 Jewel_of_the_Prince = 391300 Jewel_of_the_Dark_Moon = 391400 Jewel_of_the_Sinner = 391500 Jewel_of_the_Forge = 391600 Jewel_of_the_Righteous = 391700 Jewel_of_the_Crucible = 391800 Jewel_of_the_Ancients = 391900 Jewel_of_the_Flayer = 392000 Jewel_of_the_Mindless = 392100 Jewel_of_the_Wounded = 392200 Jewel_of_the_Sealed = 392300 Jewel_of_the_Ancestors = 392400 Jewel_of_the_Alchemist = 392500 Jewel_of_the_Chained = 392600 -- Jewel: Spellban local jewelSpEffects = { { JewelSpEffect = Jewel_of_the_Resolute, AllowedSpellsIndex = nil }, -- Jewel of the Resolute { JewelSpEffect = Jewel_of_the_Valorous, AllowedSpellsIndex = nil }, -- Jewel of the Valorous { JewelSpEffect = Jewel_of_the_Hunt, AllowedSpellsIndex = nil }, -- Jewel of the Hunt { JewelSpEffect = Jewel_of_the_Reckless, AllowedSpellsIndex = nil }, -- Jewel of the Reckless { JewelSpEffect = Jewel_of_the_Immovable, AllowedSpellsIndex = nil }, -- Jewel of the Immovable { JewelSpEffect = Jewel_of_the_Relentless, AllowedSpellsIndex = nil }, -- Jewel of the Relentless { JewelSpEffect = Jewel_of_the_Devious, AllowedSpellsIndex = nil }, -- Jewel of the Devious { JewelSpEffect = Jewel_of_the_Primeval, AllowedSpellsIndex = 1 }, -- Jewel of the Primeval { JewelSpEffect = Jewel_of_the_Cosmos, AllowedSpellsIndex = 2 }, -- Jewel of the Cosmos { JewelSpEffect = Jewel_of_the_Underworld, AllowedSpellsIndex = 3 }, -- Jewel of the Underworld { JewelSpEffect = Jewel_of_the_Devourer, AllowedSpellsIndex = 4 }, -- Jewel of the Devourer { JewelSpEffect = Jewel_of_the_Storm, AllowedSpellsIndex = 5 }, -- Jewel of the Storm { JewelSpEffect = Jewel_of_the_Darkness, AllowedSpellsIndex = 6 }, -- Jewel of the Darkness { JewelSpEffect = Jewel_of_the_Prince, AllowedSpellsIndex = 7 }, -- Jewel of the Prince { JewelSpEffect = Jewel_of_the_Dark_Moon, AllowedSpellsIndex = 8 }, -- Jewel of the Dark Moon { JewelSpEffect = Jewel_of_the_Sinner, AllowedSpellsIndex = 9 }, -- Jewel of the Sinner { JewelSpEffect = Jewel_of_the_Forge, AllowedSpellsIndex = 10 }, -- Jewel of the Forge { JewelSpEffect = Jewel_of_the_Righteous, AllowedSpellsIndex = 11 }, -- Jewel of the Righteous { JewelSpEffect = Jewel_of_the_Crucible, AllowedSpellsIndex = 12 }, -- Jewel of the Crucible { JewelSpEffect = Jewel_of_the_Ancients, AllowedSpellsIndex = 13 }, -- Jewel of the Ancients { JewelSpEffect = Jewel_of_the_Flayer, AllowedSpellsIndex = 14 }, -- Jewel of the Flayer { JewelSpEffect = Jewel_of_the_Mindless, AllowedSpellsIndex = 15 }, -- Jewel of the Mindless { JewelSpEffect = Jewel_of_the_Wounded, AllowedSpellsIndex = 16 }, -- Jewel of the Wounded { JewelSpEffect = Jewel_of_the_Sealed, AllowedSpellsIndex = 17 }, -- Jewel of the Sealed { JewelSpEffect = Jewel_of_the_Ancestors, AllowedSpellsIndex = 18 }, -- Jewel of the Ancestors { JewelSpEffect = Jewel_of_the_Alchemist, AllowedSpellsIndex = nil }, -- Jewel of the Alchemist --{ Jewel_of_the_Chained, __allSpells }, -- Jewel of the Chained } local activeJewelIndex = -1 local activeSpellbanState = 0 function JewelSpellBan() if activeJewelIndex > 0 and env(GetSpEffectID, jewelSpEffects[activeJewelIndex].JewelSpEffect) == TRUE then return end for index, data in ipairs(jewelSpEffects) do local jewelSpEffect = data.JewelSpEffect if env(GetSpEffectID, jewelSpEffect) == TRUE then activeJewelIndex = index local allowedSpellsIndex = data.AllowedSpellsIndex CultStacks_HandleJewelSwap(jewelSpEffect) -- Martials if allowedSpellsIndex == nil then if activeSpellbanState == -1 then -- All Spells are already banned, no need to reapply return end if activeSpellbanState ~= 0 then -- Only ban the previously allowed spell list BanSpells(__allSpells[activeSpellbanState]) else for _, classSpells in ipairs(__allSpells) do BanSpells(classSpells) end end activeSpellbanState = -1 -- Magic classes but no spell ban is applied yet elseif activeSpellbanState == 0 then for classIndex, classSpells in ipairs(__allSpells) do if classIndex == allowedSpellsIndex then AllowSpells(classSpells) else BanSpells(classSpells) end end activeSpellbanState = allowedSpellsIndex -- Magic class after martials (all classes already banned) elseif activeSpellbanState == -1 then AllowSpells(__allSpells[allowedSpellsIndex]) activeSpellbanState = allowedSpellsIndex -- Magic classes had jewel swapped elseif activeSpellbanState ~= allowedSpellsIndex then BanSpells(__allSpells[activeSpellbanState]) AllowSpells(__allSpells[allowedSpellsIndex]) activeSpellbanState = allowedSpellsIndex end return end end if activeJewelIndex == 0 then return end -- Nothing changed since last check, no need to log or reapply spell bans activeJewelIndex = 0 -- No Jewels detected, remove all spell bans CultStacks_HandleJewelSwap(0) if activeSpellbanState == 0 then return end for index, classSpells in ipairs(__allSpells) do if index ~= activeSpellbanState then AllowSpells(classSpells) end end activeSpellbanState = 0 end function AllowSpells(spellList) for spellId, spellData in pairs(spellList) do if GetParamValue(PARAM.Magic.MAX_USES, spellId) ~= -1 then SetParamValue(PARAM.Magic.MAX_USES, spellId, -1) end end end function BanSpells(spellList) for spellId, spellData in pairs(spellList) do ClearSpEffectArray(spellData.SpEffects) if GetParamValue(PARAM.Magic.MAX_USES, spellId) ~= 0 then SetParamValue(PARAM.Magic.MAX_USES, spellId, 0) end end end