Created
January 22, 2014 00:16
-
-
Save benphelps/8551181 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local AceGUI = LibStub("AceGUI-3.0") | |
local AceConfig = LibStub("AceConfig-3.0") | |
local AceConfigDialog = LibStub("AceConfigDialog-3.0") | |
soapyOptions = { | |
-- a group, args holds sub groups | |
cooldowns = { | |
name = "Cooldowns", | |
type = "group", | |
args = { | |
-- This is the group in the tree on the left | |
defensive = { | |
name = "Defensive", | |
type = "group", | |
args = { | |
-- this is the group inside the right pane | |
spells = { | |
name = "Spells", | |
type = "group", | |
args = { | |
-- just some prefix text | |
header1 = { | |
type = "header", | |
name = "Defensive Spell Cooldowns", | |
order = 1, | |
}, | |
info1 = { | |
type = "description", | |
name = "Customize how the rotation handles the usage of defensive cooldowns.", | |
order = 2, | |
}, | |
-- This is the group for Devotion Aura | |
devotion_aura = { | |
type = "group", | |
name = "Devotion Aura", | |
inline = true, | |
width = "full", | |
-- these are your config points | |
-- this deep their access point is | |
-- soapbox_cooldowns_defensive_spells_devotion_aura_ | |
-- Long, but it looks nice, right ?! | |
args = { | |
use = { | |
name = "Use Devotion Aura", | |
desc = "Use Devotion Aura", | |
type = "toggle", | |
width = "full", | |
}, | |
percent = { | |
name = "Devotion Aura Percent", | |
desc = "When to use Devotion Aura", | |
type = "range", | |
width = "full", | |
min = 0, | |
max = 1, | |
step = 0.1, | |
isPercent = true | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
}, | |
} | |
-- this bit would be inside the core but its here for now | |
-- you'd only see the top part | |
injectBase = { } | |
injectBase['soapbox'] = { | |
type = "group", | |
name = "Soapbox", | |
childGroups = "tree", | |
args = soapyOptions | |
} | |
coreBase = { | |
type = "group", | |
name = "Soapbox Config", | |
width = "full", | |
set = function(info, ...) | |
local key = table.concat(info, '_') | |
local t = { } | |
for n = 1, select('#', ...) do | |
local e = select(n, ...) | |
t[n] = e | |
end | |
ProbablyEngine.config.write(key, t) | |
end, | |
get = function(info) | |
local key = table.concat(info, '_') | |
return unpack(ProbablyEngine.config.read(key) or { }) | |
end, | |
args = injectBase | |
} | |
AceConfig:RegisterOptionsTable("Soapbox", coreBase, "/soap" ) | |
-- This will open the config window | |
-- AceConfigDialog:Open('Soapbox') | |
-- Inside a library call | |
-- using the percent method gives 0 to 1 value, so * 100 | |
-- local value = ProbablyEngine.config.read('soapbox_cooldowns_defensive_spells_devotion_aura_percent') * 100 | |
-- local evaul = ProbablyEngine.dsl.eval('target.health <= '.. , 'target', 'Spell') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My example of what the config tables will look like and how we'll use them in PE 2.