comparison CombatLog.lua @ 137:6dc0e8e9f960 v64

uldir for auto-logging
author yellowfive
date Mon, 03 Sep 2018 19:19:38 -0700
parents a0894ffebd15
children a3507735dfd9
comparison
equal deleted inserted replaced
136:5f3dde81a118 137:6dc0e8e9f960
18 _autoChecks[instanceId][difficultyId] = chk 18 _autoChecks[instanceId][difficultyId] = chk
19 return chk 19 return chk
20 end 20 end
21 21
22 -- render a group of controls for auto-logging of a raid zone 22 -- render a group of controls for auto-logging of a raid zone
23 local function renderAutoLogSection(instanceId, container) 23 local function renderAutoLogSection(instanceId, container, i, autoLbls, autoChks)
24 _autoChecks[instanceId] = {} 24 _autoChecks[instanceId] = {}
25 25
26 local lbl = AceGUI:Create("AmrUiLabel") 26 local lbl = AceGUI:Create("AmrUiLabel")
27 container:AddChild(lbl) 27 container:AddChild(lbl)
28 lbl:SetWidth(200) 28 lbl:SetWidth(200)
29 lbl:SetText(L.InstanceNames[instanceId]) 29 lbl:SetText(L.InstanceNames[instanceId])
30 lbl:SetFont(Amr.CreateFont("Regular", 20, Amr.Colors.White)) 30 lbl:SetFont(Amr.CreateFont("Regular", 20, Amr.Colors.White))
31 31
32 if i == 1 then
33 lbl:SetPoint("TOPLEFT", _chkAutoAll.frame, "BOTTOMLEFT", -1, -15)
34 elseif i % 2 == 0 then
35 lbl:SetPoint("TOPLEFT", autoLbls[i - 1].frame, "TOPRIGHT", 40, 0)
36 else
37 lbl:SetPoint("TOPLEFT", autoChks[i - 2].frame, "BOTTOMLEFT", 0, -30)
38 end
39
32 local line = AceGUI:Create("AmrUiPanel") 40 local line = AceGUI:Create("AmrUiPanel")
41 container:AddChild(line)
33 line:SetHeight(1) 42 line:SetHeight(1)
34 line:SetBackgroundColor(Amr.Colors.White) 43 line:SetBackgroundColor(Amr.Colors.White)
35 container:AddChild(line)
36 line:SetPoint("TOPLEFT", lbl.frame, "BOTTOMLEFT", 1, -7) 44 line:SetPoint("TOPLEFT", lbl.frame, "BOTTOMLEFT", 1, -7)
37 line:SetPoint("TOPRIGHT", lbl.frame, "BOTTOMRIGHT", 0, -7) 45 line:SetPoint("TOPRIGHT", lbl.frame, "BOTTOMRIGHT", 0, -7)
38 46
39 local chkMythic = createDifficultyCheckBox(instanceId, Amr.Difficulties.Mythic) 47 local chkMythic = createDifficultyCheckBox(instanceId, Amr.Difficulties.Mythic)
40 container:AddChild(chkMythic) 48 container:AddChild(chkMythic)
41 chkMythic:SetPoint("TOPLEFT", line.frame, "BOTTOMLEFT", 0, -8) 49 chkMythic:SetPoint("TOPLEFT", line.frame, "BOTTOMLEFT", 0, -8)
42 50
43 local chkNormal = createDifficultyCheckBox(instanceId, Amr.Difficulties.Normal) 51 local chkNormal = createDifficultyCheckBox(instanceId, Amr.Difficulties.Normal)
44 container:AddChild(chkNormal) 52 container:AddChild(chkNormal)
45 chkNormal:SetPoint("TOPLEFT", line.frame, "BOTTOMLEFT", 0, -30) 53 chkNormal:SetPoint("TOPLEFT", line.frame, "BOTTOMLEFT", 0, -30)
46 54
47 -- find the widest of mythic/normal 55 -- find the widest of mythic/normal
48 local w = math.max(chkMythic:GetWidth(), chkNormal:GetWidth()) 56 local w = math.max(chkMythic:GetWidth(), chkNormal:GetWidth())
49 57
50 local chkHeroic = createDifficultyCheckBox(instanceId, Amr.Difficulties.Heroic) 58 local chkHeroic = createDifficultyCheckBox(instanceId, Amr.Difficulties.Heroic)
51 container:AddChild(chkHeroic) 59 container:AddChild(chkHeroic)
52 chkHeroic:SetPoint("TOPLEFT", line.frame, "BOTTOMLEFT", w + 20, -8) 60 chkHeroic:SetPoint("TOPLEFT", line.frame, "BOTTOMLEFT", w + 20, -8)
53 61
54 local chkLfr = createDifficultyCheckBox(instanceId, Amr.Difficulties.Lfr) 62 local chkLfr = createDifficultyCheckBox(instanceId, Amr.Difficulties.Lfr)
55 container:AddChild(chkLfr) 63 container:AddChild(chkLfr)
56 chkLfr:SetPoint("TOPLEFT", line.frame, "BOTTOMLEFT", w + 20, -30) 64 chkLfr:SetPoint("TOPLEFT", line.frame, "BOTTOMLEFT", w + 20, -30)
57 65
58 return lbl, chkNormal 66 return lbl, chkNormal
59 end 67 end
60 68
61 -- renders the main UI for the Combat Log tab 69 -- renders the main UI for the Combat Log tab
62 function Amr:RenderTabLog(container) 70 function Amr:RenderTabLog(container)
177 185
178 -- go through all supported instances, rendering in a left->right pattern, 2 per row 186 -- go through all supported instances, rendering in a left->right pattern, 2 per row
179 local autoLbls = {} 187 local autoLbls = {}
180 local autoChks = {} 188 local autoChks = {}
181 for i, instanceId in ipairs(Amr.InstanceIdsOrdered) do 189 for i, instanceId in ipairs(Amr.InstanceIdsOrdered) do
182 local autoLbl, autoChk = renderAutoLogSection(instanceId, container) 190 local autoLbl, autoChk = renderAutoLogSection(instanceId, container, i, autoLbls, autoChks)
183 if i == 1 then
184 autoLbl:SetPoint("TOPLEFT", _chkAutoAll.frame, "BOTTOMLEFT", -1, -15)
185 elseif i % 2 == 0 then
186 autoLbl:SetPoint("TOPLEFT", autoLbls[i - 1].frame, "TOPRIGHT", 40, 0)
187 else
188 autoLbl:SetPoint("TOPLEFT", autoChks[i - 2].frame, "BOTTOMLEFT", 0, -30)
189 end
190 191
191 table.insert(autoLbls, autoLbl) 192 table.insert(autoLbls, autoLbl)
192 table.insert(autoChks, autoChk) 193 table.insert(autoChks, autoChk)
193 end 194 end
194 autoLbls = nil 195 autoLbls = nil
292 end 293 end
293 294
294 Amr.db.char.Logging.LastZone = zone 295 Amr.db.char.Logging.LastZone = zone
295 Amr.db.char.Logging.LastDiff = difficultyId 296 Amr.db.char.Logging.LastDiff = difficultyId
296 297
297 if not Amr.db.profile.Logging.Auto[tonumber(instanceId)] then 298 if Amr.IsSupportedInstanceId(instanceId) then
298 Amr.db.profile.Logging.Auto[tonumber(instanceId)] = {} 299 if not Amr.db.profile.Logging.Auto[tonumber(instanceId)] then
300 Amr.db.profile.Logging.Auto[tonumber(instanceId)] = {}
301 end
299 end 302 end
300 303
301 if Amr.IsSupportedInstanceId(instanceId) and Amr.db.profile.Logging.Auto[tonumber(instanceId)][tonumber(difficultyId)] then 304 if Amr.IsSupportedInstanceId(instanceId) and Amr.db.profile.Logging.Auto[tonumber(instanceId)][tonumber(difficultyId)] then
302 -- we are in a supported zone that we want to auto-log, turn logging on 305 -- we are in a supported zone that we want to auto-log, turn logging on
303 306
624 end 627 end
625 ]] 628 ]]
626 end 629 end
627 630
628 function Amr:InitializeCombatLog() 631 function Amr:InitializeCombatLog()
629 --updateAutoLogging() 632 updateAutoLogging()
630 end 633 end
631 634
632 Amr:AddEventHandler("UPDATE_INSTANCE_INFO", updateAutoLogging) 635 Amr:AddEventHandler("UPDATE_INSTANCE_INFO", updateAutoLogging)
633 Amr:AddEventHandler("PLAYER_DIFFICULTY_CHANGED", updateAutoLogging) 636 Amr:AddEventHandler("PLAYER_DIFFICULTY_CHANGED", updateAutoLogging)
634 Amr:AddEventHandler("ENCOUNTER_START", updateAutoLogging) 637 Amr:AddEventHandler("ENCOUNTER_START", updateAutoLogging)