diff --git a/Ele_GUI.lua b/Ele_GUI.lua index 5a2c8da..43191de 100755 --- a/Ele_GUI.lua +++ b/Ele_GUI.lua @@ -277,14 +277,16 @@ function Elementarist:CreateConfig() if (Elementarist.configPanel ~= nil) then return; end - if (not ElementaristDB.version) then - ElementaristDB.version = Elementarist.versionNumber; - if (not ElementaristDB.modules) then - ElementaristDB.modules = {} - end - ElementaristDB.modules.elemental = true; - ElementaristDB.modules.restoration = not ElementaristDB.disableIfNotEle; - end + + -----------this is propely covered in the Elementarist:InitSettings() function to create the table and when modules register themselves for each indivual specification + -- if (not ElementaristDB.version) then + -- ElementaristDB.version = Elementarist.versionNumber; + -- if (not ElementaristDB.modules) then + -- ElementaristDB.modules = {} + -- end + -- ElementaristDB.modules.elemental = true; + -- ElementaristDB.modules.restoration = not ElementaristDB.disableIfNotEle; + -- end Elementarist.configPanel = CreateFrame( "Frame", "ElementaristConfigPanel", UIParent ); -- Register in the Interface Addon Options GUI @@ -470,6 +472,7 @@ function Elementarist:CreateConfig() -- create module panels local i,i2,v,v2; + -- for each module which registed itself from the modules folder if (Elementarist.modules) then for i,v in pairs(Elementarist.modules) do local vposition = -20; @@ -480,14 +483,17 @@ function Elementarist:CreateConfig() if (not ElementaristDB.modules) then ElementaristDB.modules = {}; end + -- if a module is registered but has no settings.. set it to enabled if (ElementaristDB.modules[i] == nil) then ElementaristDB.modules[i] = {}; ElementaristDB.modules[i].enabled = true; end + -- Create a checkBox to enable/disable each module and save it within ElemenatistDB local checkBox = Elementarist:CreateCheckButton(childPanel.name .. " enabled", childPanel, ElementaristDB.modules, i, false); checkBox:SetPoint('TOPLEFT', 10, vposition); vposition = vposition - 40; + -- read in from each file the configuration settings within the file for i2,v2 in pairs(Elementarist[i].Configuration) do if (v2.type == "DropDown") then local dropDown = Elementarist:CreateDropDownMenu(v2.label, childPanel, ElementaristDB, i2, v2.options, 200); diff --git a/Elementarist.lua b/Elementarist.lua index 03d956c..10376e6 100755 --- a/Elementarist.lua +++ b/Elementarist.lua @@ -43,7 +43,8 @@ Elementarist.SFHistory = { ["int"] = nil } Elementarist.iLvl = 0; -Elementarist.talent = "" +Elementarist.talent = "" -- name of the specialization +Elementarist.playerClass = "SHAMAN" -- name of the class for the addon Elementarist.role = "" Elementarist.faction = nil Elementarist.talentUnsure = true @@ -182,7 +183,7 @@ end function Elementarist:GetDebugFrame() for i=1,NUM_CHAT_WINDOWS do local windowName = GetChatWindowInfo(i); - if windowName == "EleDBG" then + if windowName == "Debug" then return getglobal("ChatFrame" .. i) end end @@ -252,14 +253,14 @@ function Elementarist.events.ADDON_LOADED(addon) SlashCmdList["Elementarist"] = function(msg) if (msg=='debug') then if (ElementaristDB.DebugMode) then - Elementarist:Debug("Debug ended", GetTime()) + Elementarist:Debug("Debug ended", "") end ElementaristDB.DebugMode = not ( ElementaristDB.DebugMode ) local debugStatus = "disabled" if (ElementaristDB.DebugMode) then Elementarist.DebugChat = Elementarist:GetDebugFrame() debugStatus = "enabled. Using frame: " .. Elementarist.DebugChat:GetID() - Elementarist:Debug("Debug started", GetTime()) + Elementarist:Debug("Debug started", "") end DEFAULT_CHAT_FRAME:AddMessage("Elementarist Debug " .. debugStatus) else @@ -312,6 +313,7 @@ function Elementarist.events.ADDON_LOADED(addon) end function Elementarist:RegisterModule(talent) + -- save the registration of the module for each specialization file in modules folder Elementarist.modules[talent] = true; print (talent .. " Elementarist module registered"); end; @@ -335,6 +337,7 @@ function Elementarist:InitSettings() if not ElementaristDB then ElementaristDB = {} -- fresh start end + if (not ElementaristDB.modules) then ElementaristDB.modules = {} end if not ElementaristDB.scale then ElementaristDB.scale = 1 end if not ElementaristDB.debuffscale then ElementaristDB.debuffscale = 1 end if not ElementaristDB.shieldscale then ElementaristDB.shieldscale = 1 end @@ -398,30 +401,26 @@ function Elementarist:detectiLevel() end function Elementarist:detectTalent() - local spec = GetSpecialization() - local _,playerClass; - local talent = ""; - - _,playerClass = UnitClass("player") - - if playerClass ~= "SHAMAN" then + -- return to calling function after disabling addon if the current class is not the correct class + local talent = "" + local _,playerClass = UnitClass("player") + if playerClass ~= Elementarist.playerClass then talent = ""; Elementarist.enabled = false; return; end - if (spec == 1) then - talent = "elemental" - end - if (spec == 2) then - talent = "enhancement" - end - if (spec == 3) then - talent = "restoration" + + -- get the class and specialization infomration for current player + local spec = GetSpecialization() --saves the number of the Specialisation active + if spec then + _,talent = GetSpecializationInfo(spec) --saves the Name of the Specialisation active + if talent then talent=string.lower(talent) end end _, Elementarist.tier4Talent = GetTalentRowSelectionInfo(4); _, Elementarist.tier6Talent = GetTalentRowSelectionInfo(6); _, Elementarist.tier7Talent = GetTalentRowSelectionInfo(7); + -- check there is a registed module for the specicilisation and configuration infomration is saved in the ElemenatlistDB varriables if (talent ~= "") and (talent ~= Elementarist.talent) then if (Elementarist.modules) and (ElementaristDB.modules) and (Elementarist.modules[talent]) and (ElementaristDB.modules[talent]) and (Elementarist[talent].Initialize) then Elementarist.callbacks = {}; @@ -430,6 +429,7 @@ function Elementarist:detectTalent() Elementarist.talent = talent; end; + -- set a flag so calling functions know this check has been passed previously if (spec == nil) or (talent == "") then Elementarist.talentUnsure = true else @@ -657,13 +657,13 @@ end function Elementarist.events.PLAYER_REGEN_DISABLED(...) -- Entered combat Elementarist.inCombat = true - Elementarist:Debug('Entering Combat:', GetTime() ) + Elementarist:Debug('Entering Combat:', "" ) end function Elementarist.events.PLAYER_REGEN_ENABLED(...) -- left combat Elementarist.inCombat = false - Elementarist:Debug('Exited Combat:', GetTime() ) + Elementarist:Debug('Exited Combat:', "" ) Elementarist.person["friend"] = {} Elementarist.person["friendCount"] = 0 Elementarist.person["foe"] = {} diff --git a/modules/elemental.lua b/modules/elemental.lua index 1b1dd77..c22428f 100755 --- a/modules/elemental.lua +++ b/modules/elemental.lua @@ -359,7 +359,7 @@ Elementarist.elemental = { eqCharges = eqCharges + 1; end eqCharges = eqCharges - Elementarist:Count(Elementarist.SpellList["Earthquake"],spellInCast,exspell1,exspell2); - eclBuff, _, _, _, _, _, eclExp = Elementarist:hasBuff("player",Elementarist.SpellList["EnhancedChainLightningBuff"]); + eclBuff, _, _, _, _, _, eclExp = Elementarist:hasBuff("player",Elementarist.SpellList["Enhanced Chain Lightning"]); if (eqCharges > 0) and (eclBuff) then d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earthquake"]) if (d) and (d<0.5) then @@ -534,6 +534,17 @@ Elementarist.elemental = { IntSpell = function(self) -- interruptions, purge, and AoE on target local d + local eclBuff, _, _, _, _, _, eclExp = Elementarist:hasBuff("player",Elementarist.SpellList["Enhanced Chain Lightning"]) + + ---- Earthquake with Enhanced chain lightning buff + if Elementarist:SpellAvailable(Elementarist.SpellList["Earthquake"]) then + if (eclBuff) then + d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earthquake"]) + if (d) and (d<0.5) then + return Elementarist.SpellList["Earthquake"] + end + end + end if Elementarist:SpellAvailable(Elementarist.SpellList["Wind Shear"]) then d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Wind Shear"]) @@ -547,27 +558,20 @@ Elementarist.elemental = { end --- windshear to interupt channel spell - spell, _, _, _, _, _, _, notInterruptible = UnitChannelInfo("target") - if (spell) and (not notInterruptible) then + _, _, _, _, _, _, _, notInterruptible = UnitChannelInfo("target") + if (not notInterruptible) then return Elementarist.SpellList["Wind Shear"] end --- windshear to interupt cast spell - spell, _, _, _, _, _, _, _, notInterruptible = UnitCastingInfo("target") - if (spell) and (not notInterruptible) then + _, _, _, _, _, _, _, _, notInterruptible = UnitCastingInfo("target") + if if (not notInterruptible) then then return Elementarist.SpellList["Wind Shear"] end end end - ---- Earthquake with Enhanced chain lightning buff - d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earthquake"]) - if (d) and (d<0.5) then - eclBuff, _, _, _, _, _, eclExp = Elementarist:hasBuff("player",Elementarist.SpellList["EnhancedChainLightningBuff"]); - if (eclBuff) then - return Elementarist.SpellList["Earthquake"] - end - end + if (Elementarist.person["foeCount"]>2) then ---- Lava beam if available @@ -579,26 +583,18 @@ Elementarist.elemental = { end ---- Earth shock if Lightning Shield count >=17 and not on cd - d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earth Shock"]) - if (d) and (d<0.5) then - local _, _, _, lscount = Elementarist:hasBuff("player",Elementarist.SpellList["Lightning Shield"]) - if (lscount) then - lscount= lscount + (Elementarist:Count(Elementarist.SpellList["Lightning Bolt"],spellInCast,exspell1,exspell2)); - lscount= lscount + (Elementarist:Count(Elementarist.SpellList["Lava Burst"],spellInCast,exspell1,exspell2)); - else - lscount=0; - end - if (lscount>=17) then - return Elementarist.SpellList["Earth Shock"] - end - end - - ---- When Earthquake available get Enhanced chain lightning buff - if (not eclBuff) then - d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earthquake"]) - if (d) and (d<0.5 + Elementarist.lastBaseGCD) then - if Elementarist:SpellAvailable(Elementarist.SpellList["Chain Lightning"]) then - return Elementarist.SpellList["Chain Lightning"] + if Elementarist:SpellAvailable(Elementarist.SpellList["Earth Shock"]) then + d = Elementarist:GetSpellCooldownRemaining(Elementarist.SpellList["Earth Shock"]) + if (d) and (d<0.5) then + local _, _, _, lscount = Elementarist:hasBuff("player",Elementarist.SpellList["Lightning Shield"]) + if (lscount) then + lscount= lscount + (Elementarist:Count(Elementarist.SpellList["Lightning Bolt"],spellInCast,exspell1,exspell2)); + lscount= lscount + (Elementarist:Count(Elementarist.SpellList["Lava Burst"],spellInCast,exspell1,exspell2)); + else + lscount=0; + end + if (lscount>=17) then + return Elementarist.SpellList["Earth Shock"] end end end