castbar enable/disable
This commit is contained in:
		@@ -19,6 +19,7 @@ local Gladdy = LibStub("Gladdy")
 | 
				
			|||||||
local L = Gladdy.L
 | 
					local L = Gladdy.L
 | 
				
			||||||
local AceGUIWidgetLSMlists = AceGUIWidgetLSMlists
 | 
					local AceGUIWidgetLSMlists = AceGUIWidgetLSMlists
 | 
				
			||||||
local Castbar = Gladdy:NewModule("Cast Bar", 70, {
 | 
					local Castbar = Gladdy:NewModule("Cast Bar", 70, {
 | 
				
			||||||
 | 
					    castBarEnabled = true,
 | 
				
			||||||
    castBarHeight = 20,
 | 
					    castBarHeight = 20,
 | 
				
			||||||
    castBarWidth = 160,
 | 
					    castBarWidth = 160,
 | 
				
			||||||
    castBarIconSize = 22,
 | 
					    castBarIconSize = 22,
 | 
				
			||||||
@@ -439,6 +440,7 @@ end
 | 
				
			|||||||
---------------------------
 | 
					---------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function Castbar:JOINED_ARENA()
 | 
					function Castbar:JOINED_ARENA()
 | 
				
			||||||
 | 
					    if Gladdy.db.castBarEnabled then
 | 
				
			||||||
        for i=1, Gladdy.curBracket do
 | 
					        for i=1, Gladdy.curBracket do
 | 
				
			||||||
            local unit = "arena" .. i
 | 
					            local unit = "arena" .. i
 | 
				
			||||||
            local castBar = self.frames[unit]
 | 
					            local castBar = self.frames[unit]
 | 
				
			||||||
@@ -458,23 +460,21 @@ function Castbar:JOINED_ARENA()
 | 
				
			|||||||
            --Castbar.OnEvent(castBar, "PLAYER_ENTERING_WORLD")
 | 
					            --Castbar.OnEvent(castBar, "PLAYER_ENTERING_WORLD")
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function Castbar:ResetUnit(unit)
 | 
					function Castbar:ResetUnit(unit)
 | 
				
			||||||
    local castBar = self.frames[unit]
 | 
					    local castBar = self.frames[unit]
 | 
				
			||||||
    castBar:UnregisterEvent("UNIT_SPELLCAST_INTERRUPTED")
 | 
					    castBar:UnregisterAllEvents()
 | 
				
			||||||
    castBar:UnregisterEvent("UNIT_SPELLCAST_DELAYED")
 | 
					 | 
				
			||||||
    castBar:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_START")
 | 
					 | 
				
			||||||
    castBar:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE")
 | 
					 | 
				
			||||||
    castBar:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_STOP")
 | 
					 | 
				
			||||||
    castBar:UnregisterEvent("UNIT_SPELLCAST_START")
 | 
					 | 
				
			||||||
    castBar:UnregisterEvent("UNIT_SPELLCAST_STOP")
 | 
					 | 
				
			||||||
    castBar:UnregisterEvent("UNIT_SPELLCAST_FAILED")
 | 
					 | 
				
			||||||
    castBar:SetScript("OnEvent", nil)
 | 
					    castBar:SetScript("OnEvent", nil)
 | 
				
			||||||
    castBar:SetScript("OnUpdate", nil)
 | 
					    castBar:SetScript("OnUpdate", nil)
 | 
				
			||||||
    castBar.fadeOut = nil
 | 
					    castBar.fadeOut = nil
 | 
				
			||||||
    self:CAST_STOP(unit)
 | 
					    self:CAST_STOP(unit)
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function Castbar:Reset()
 | 
				
			||||||
 | 
					    self.test = nil
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
---------------------------
 | 
					---------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- TEST
 | 
					-- TEST
 | 
				
			||||||
@@ -482,6 +482,8 @@ end
 | 
				
			|||||||
---------------------------
 | 
					---------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function Castbar:Test(unit)
 | 
					function Castbar:Test(unit)
 | 
				
			||||||
 | 
					    self.test = true
 | 
				
			||||||
 | 
					    if Gladdy.db.castBarEnabled then
 | 
				
			||||||
        local spell, _, icon, value, maxValue, event, endTime, startTime
 | 
					        local spell, _, icon, value, maxValue, event, endTime, startTime
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (unit == "arena2") then
 | 
					        if (unit == "arena2") then
 | 
				
			||||||
@@ -502,6 +504,9 @@ function Castbar:Test(unit)
 | 
				
			|||||||
        if (spell) then
 | 
					        if (spell) then
 | 
				
			||||||
            self:CAST_START(unit, spell, icon, value, maxValue, event)
 | 
					            self:CAST_START(unit, spell, icon, value, maxValue, event)
 | 
				
			||||||
        end
 | 
					        end
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        self:CAST_STOP(unit)
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
---------------------------
 | 
					---------------------------
 | 
				
			||||||
@@ -541,11 +546,17 @@ function Castbar:GetOptions()
 | 
				
			|||||||
            name = L["Cast Bar"],
 | 
					            name = L["Cast Bar"],
 | 
				
			||||||
            order = 2,
 | 
					            order = 2,
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
 | 
					        castBarEnabled = option({
 | 
				
			||||||
 | 
					            type = "toggle",
 | 
				
			||||||
 | 
					            name = L["Enabled"],
 | 
				
			||||||
 | 
					            desc = L["If test is running, type \"/gladdy test\" again"],
 | 
				
			||||||
 | 
					            order = 3,
 | 
				
			||||||
 | 
					        }),
 | 
				
			||||||
        group = {
 | 
					        group = {
 | 
				
			||||||
            type = "group",
 | 
					            type = "group",
 | 
				
			||||||
            childGroups = "tree",
 | 
					            childGroups = "tree",
 | 
				
			||||||
            name = L["Frame"],
 | 
					            name = L["Frame"],
 | 
				
			||||||
            order = 3,
 | 
					            order = 4,
 | 
				
			||||||
            args = {
 | 
					            args = {
 | 
				
			||||||
                barFrame = {
 | 
					                barFrame = {
 | 
				
			||||||
                    type = "group",
 | 
					                    type = "group",
 | 
				
			||||||
@@ -565,6 +576,7 @@ function Castbar:GetOptions()
 | 
				
			|||||||
                            min = 0,
 | 
					                            min = 0,
 | 
				
			||||||
                            max = 50,
 | 
					                            max = 50,
 | 
				
			||||||
                            step = 1,
 | 
					                            step = 1,
 | 
				
			||||||
 | 
					                            width = "full",
 | 
				
			||||||
                        }),
 | 
					                        }),
 | 
				
			||||||
                        castBarWidth = option({
 | 
					                        castBarWidth = option({
 | 
				
			||||||
                            type = "range",
 | 
					                            type = "range",
 | 
				
			||||||
@@ -574,6 +586,7 @@ function Castbar:GetOptions()
 | 
				
			|||||||
                            min = 0,
 | 
					                            min = 0,
 | 
				
			||||||
                            max = 300,
 | 
					                            max = 300,
 | 
				
			||||||
                            step = 1,
 | 
					                            step = 1,
 | 
				
			||||||
 | 
					                            width = "full",
 | 
				
			||||||
                        }),
 | 
					                        }),
 | 
				
			||||||
                        headerTexture = {
 | 
					                        headerTexture = {
 | 
				
			||||||
                            type = "header",
 | 
					                            type = "header",
 | 
				
			||||||
@@ -614,6 +627,7 @@ function Castbar:GetOptions()
 | 
				
			|||||||
                            min = 0.5,
 | 
					                            min = 0.5,
 | 
				
			||||||
                            max = Gladdy.db.castBarHeight/2,
 | 
					                            max = Gladdy.db.castBarHeight/2,
 | 
				
			||||||
                            step = 0.5,
 | 
					                            step = 0.5,
 | 
				
			||||||
 | 
					                            width = "full",
 | 
				
			||||||
                        }),
 | 
					                        }),
 | 
				
			||||||
                        castBarBorderStyle = option({
 | 
					                        castBarBorderStyle = option({
 | 
				
			||||||
                            type = "select",
 | 
					                            type = "select",
 | 
				
			||||||
@@ -647,6 +661,7 @@ function Castbar:GetOptions()
 | 
				
			|||||||
                            min = 0,
 | 
					                            min = 0,
 | 
				
			||||||
                            max = 100,
 | 
					                            max = 100,
 | 
				
			||||||
                            step = 1,
 | 
					                            step = 1,
 | 
				
			||||||
 | 
					                            width = "full",
 | 
				
			||||||
                        }),
 | 
					                        }),
 | 
				
			||||||
                        headerBorder = {
 | 
					                        headerBorder = {
 | 
				
			||||||
                            type = "header",
 | 
					                            type = "header",
 | 
				
			||||||
@@ -723,6 +738,7 @@ function Castbar:GetOptions()
 | 
				
			|||||||
                            order = 4,
 | 
					                            order = 4,
 | 
				
			||||||
                            min = 1,
 | 
					                            min = 1,
 | 
				
			||||||
                            max = 20,
 | 
					                            max = 20,
 | 
				
			||||||
 | 
					                            width = "full",
 | 
				
			||||||
                        }),
 | 
					                        }),
 | 
				
			||||||
                        headerFormat = {
 | 
					                        headerFormat = {
 | 
				
			||||||
                            type = "header",
 | 
					                            type = "header",
 | 
				
			||||||
@@ -781,6 +797,7 @@ function Castbar:GetOptions()
 | 
				
			|||||||
                            min = -400,
 | 
					                            min = -400,
 | 
				
			||||||
                            max = 400,
 | 
					                            max = 400,
 | 
				
			||||||
                            step = 0.1,
 | 
					                            step = 0.1,
 | 
				
			||||||
 | 
					                            width = "full",
 | 
				
			||||||
                        }),
 | 
					                        }),
 | 
				
			||||||
                        castBarYOffset = option({
 | 
					                        castBarYOffset = option({
 | 
				
			||||||
                            type = "range",
 | 
					                            type = "range",
 | 
				
			||||||
@@ -789,6 +806,7 @@ function Castbar:GetOptions()
 | 
				
			|||||||
                            min = -400,
 | 
					                            min = -400,
 | 
				
			||||||
                            max = 400,
 | 
					                            max = 400,
 | 
				
			||||||
                            step = 0.1,
 | 
					                            step = 0.1,
 | 
				
			||||||
 | 
					                            width = "full",
 | 
				
			||||||
                        }),
 | 
					                        }),
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user