From 26a1372d87003bbbf83d3c3d64420355257724f5 Mon Sep 17 00:00:00 2001 From: Vae Date: Mon, 12 Dec 2022 12:58:54 -1000 Subject: [PATCH] Update to fix talent scan error --- ConRO.toc | 2 +- buttons.lua | 4 +-- core.lua | 94 ++++++++++++++++++++++++++++++++++++++++++++++------- helper.lua | 5 ++- 4 files changed, 89 insertions(+), 16 deletions(-) diff --git a/ConRO.toc b/ConRO.toc index 85f50d0..b18bc33 100644 --- a/ConRO.toc +++ b/ConRO.toc @@ -1,6 +1,6 @@ ## Title:-|cffFFFFFFConRO|r- Conflict Rotation Optimizer ## Notes: Rotation helper framework. -## Version: 10.0.15 +## Version: 10.0.16 ## Author: Vae ## Interface: 100002 ## SavedVariables: ConROPreferences diff --git a/buttons.lua b/buttons.lua index 2232c40..935905a 100644 --- a/buttons.lua +++ b/buttons.lua @@ -2898,7 +2898,7 @@ function ConRO:GlowSpell(spellID) end self.SpellsGlowing[spellID] = 1; else - if UnitAffectingCombat('player') and not _IsSwapSpell then + if UnitAffectingCombat('player') and not _IsSwapSpell and not ConRO:Dragonriding() then if spellName ~= nil then self:Print(self.Colors.Error .. 'Spell not found on action bars: ' .. ' ' .. spellName .. ' ' .. '(' .. spellID .. ')'); else @@ -2921,7 +2921,7 @@ function ConRO:GlowDef(spellID) end self.DefGlowing[spellID] = 1; else - if UnitAffectingCombat('player') then + if UnitAffectingCombat('player') and not _IsSwapSpell and not ConRO:Dragonriding() then if spellName ~= nil then self:Print(self.Colors.Error .. 'Spell not found on action bars: ' .. ' ' .. spellName .. ' ' .. '(' .. spellID .. ')'); else diff --git a/core.lua b/core.lua index 2c0cec9..7ff1048 100644 --- a/core.lua +++ b/core.lua @@ -2131,14 +2131,17 @@ end function ConRO:OnEnable() self:RegisterEvent('PLAYER_TARGET_CHANGED'); self:RegisterEvent('ACTIVE_PLAYER_SPECIALIZATION_CHANGED'); + self:RegisterEvent('ACTIVE_COMBAT_CONFIG_CHANGED'); self:RegisterEvent('TRAIT_CONFIG_UPDATED'); self:RegisterEvent('ACTIONBAR_SLOT_CHANGED'); self:RegisterEvent('PLAYER_REGEN_DISABLED'); self:RegisterEvent('PLAYER_REGEN_ENABLED'); self:RegisterEvent('PLAYER_ENTERING_WORLD'); + self:RegisterEvent('PLAYER_LEAVING_WORLD'); self:RegisterEvent('UPDATE_SHAPESHIFT_FORM'); self:RegisterEvent('UPDATE_STEALTH'); - + self:RegisterEvent('LOADING_SCREEN_ENABLED'); + self:RegisterEvent('LOADING_SCREEN_DISABLED'); self:RegisterEvent('ACTIONBAR_HIDEGRID'); self:RegisterEvent('ACTIONBAR_PAGE_CHANGED'); self:RegisterEvent('LEARNED_SPELL_IN_TAB'); @@ -2166,7 +2169,7 @@ function ConRO:ACTIVE_PLAYER_SPECIALIZATION_CHANGED() self:LoadModule(); self:EnableRotation(); self:EnableDefense(); - + if ConRO:HealSpec() then ConROWindow:Hide(); ConRONextWindow:Hide(); @@ -2180,8 +2183,60 @@ function ConRO:ACTIVE_PLAYER_SPECIALIZATION_CHANGED() ConRONextWindow:Hide(); ConRONext2Window:Hide(); end + + ConRO:ButtonFetch() end +function ConRO:ACTIVE_COMBAT_CONFIG_CHANGED() + --self:Print(self.Colors.Success .. 'Talent'); + self:DisableRotation(); + self:DisableDefense(); + self:LoadModule(); + self:EnableRotation(); + self:EnableDefense(); + + if ConRO:HealSpec() then + ConROWindow:Hide(); + ConRONextWindow:Hide(); + ConRONext2Window:Hide(); + elseif ConRO.db.profile.enableWindow and not ConRO.db.profile.combatWindow then + ConROWindow:Show(); + ConRONextWindow:Show(); + ConRONext2Window:Show(); + else + ConROWindow:Hide(); + ConRONextWindow:Hide(); + ConRONext2Window:Hide(); + end + + ConRO:ButtonFetch() + end + +function ConRO:PLAYER_SPECIALIZATION_CHANGED() + --self:Print(self.Colors.Success .. 'Talent'); + self:DisableRotation(); + self:DisableDefense(); + self:LoadModule(); + self:EnableRotation(); + self:EnableDefense(); + + if ConRO:HealSpec() then + ConROWindow:Hide(); + ConRONextWindow:Hide(); + ConRONext2Window:Hide(); + elseif ConRO.db.profile.enableWindow and not ConRO.db.profile.combatWindow then + ConROWindow:Show(); + ConRONextWindow:Show(); + ConRONext2Window:Show(); + else + ConROWindow:Hide(); + ConRONextWindow:Hide(); + ConRONext2Window:Hide(); + end + + ConRO:ButtonFetch() + end + function ConRO:TRAIT_CONFIG_UPDATED() --self:Print(self.Colors.Success .. 'Talent'); self:DisableRotation(); @@ -2204,6 +2259,8 @@ function ConRO:TRAIT_CONFIG_UPDATED() ConRONextWindow:Hide(); ConRONext2Window:Hide(); end + + ConRO:ButtonFetch() end function ConRO:ACTIONBAR_HIDEGRID() @@ -2301,6 +2358,12 @@ function ConRO:PLAYER_CONTROL_GAINED() end end +function ConRO:PLAYER_LEAVING_WORLD() + -- self:Print(self.Colors.Success .. 'Lost Control!'); + self:DisableRotation(); + self:DisableDefense(); +end + function ConRO:PLAYER_ENTERING_WORLD() self:UpdateButtonGlow(); if not self.rotationEnabled and not UnitHasVehicleUI("player") and not ConRO:Dragonriding() then @@ -2312,6 +2375,23 @@ function ConRO:PLAYER_ENTERING_WORLD() end end +function ConRO:LOADING_SCREEN_ENABLED() + -- self:Print(self.Colors.Success .. 'Lost Control!'); + self:DisableRotation(); + self:DisableDefense(); +end + +function ConRO:LOADING_SCREEN_DISABLED() + self:UpdateButtonGlow(); + if not self.rotationEnabled and not UnitHasVehicleUI("player") and not ConRO:Dragonriding() then + self:Print(self.Colors.Success .. 'Auto enable on login!'); + self:Print(self.Colors.Info .. 'Loading class module'); + self:LoadModule(); + self:EnableRotation(); + self:EnableDefense(); + end +end + function ConRO:PLAYER_TARGET_CHANGED() -- self:Print(self.Colors.Success .. 'Target Changed!'); @@ -2360,15 +2440,6 @@ end function ConRO:ACTIONBAR_SLOT_CHANGED() self:UpdateButtonGlow(); - if ConRO:Dragonriding() and self.ModuleLoaded and self.rotationEnabled then - self:DisableRotation(); - self:DisableDefense(); - elseif not ConRO:Dragonriding() and not self.rotationEnabled then - self:LoadModule(); - self:EnableRotation(); - self:EnableDefense(); - end - ConRO:ButtonFetch() end @@ -2389,7 +2460,6 @@ ConRO.UPDATE_SHAPESHIFT_FORM = ConRO.ButtonFetch; ConRO.UPDATE_STEALTH = ConRO.ButtonFetch; ConRO.LEARNED_SPELL_IN_TAB = ConRO.ButtonFetch; ConRO.CHARACTER_POINTS_CHANGED = ConRO.ButtonFetch; -ConRO.PLAYER_SPECIALIZATION_CHANGED = ConRO.ButtonFetch; ConRO.ACTIVE_TALENT_GROUP_CHANGED = ConRO.ButtonFetch; ConRO.UPDATE_MACROS = ConRO.ButtonFetch; ConRO.VEHICLE_UPDATE = ConRO.ButtonFetch; diff --git a/helper.lua b/helper.lua index b28202c..994757a 100644 --- a/helper.lua +++ b/helper.lua @@ -18,7 +18,10 @@ function ConRO:CheckTalents() wipe(self.PlayerTalents) if select(1, GetSpecialization()) ~= 5 then local specID = PlayerUtil.GetCurrentSpecID(); - local configID = C_ClassTalents.GetLastSelectedSavedConfigID(specID) or C_ClassTalents.GetActiveConfigID(); + local configID = C_ClassTalents.GetLastSelectedSavedConfigID(specID); + if configID == nil then + configID = C_ClassTalents.GetActiveConfigID(); + end local configInfo = C_Traits.GetConfigInfo(configID); if configInfo == nil then configID = C_ClassTalents.GetActiveConfigID();