/
## SavedVariables: Broker_GroupConfig |
## X-Embeds: Ace3, Deformat |
## X-Category: Miscellaneous |
## Version: 2.1 |
## Version: 2.2 |
## X-WoWI-ID: 10702 |
embeds.xml |
-- f:AddChild(btn) |
-- @class file |
-- @name AceGUI-3.0 |
-- @release $Id: AceGUI-3.0.lua 815 2009-07-08 20:58:17Z nevcairiel $ |
-- @release $Id: AceGUI-3.0.lua 831 2009-08-30 14:52:04Z nevcairiel $ |
local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 25 |
local AceGUI, oldminor = LibStub:NewLibrary(ACEGUI_MAJOR, ACEGUI_MINOR) |
:OnHeightSet(height) - Called when the height of the widget is changed |
Widgets should not use the OnSizeChanged events of thier frame or content members, use these methods instead |
AceGUI already sets a handler to the event |
:OnLayoutFinished(width, height) - called after a layout has finished, the width and height will be the width and height of the |
:LayoutFinished(width, height) - called after a layout has finished, the width and height will be the width and height of the |
area used for controls. These can be nil if the layout used the existing size to layout the controls. |
]] |
-------------------------- |
do |
local Type = "Label" |
local Version = 10 |
local Version = 11 |
local function OnAcquire(self) |
self:SetHeight(18) |
else |
--image on the left |
image:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0) |
label:SetPoint("TOPLEFT",image,"TOPRIGHT",0,0) |
label:SetPoint("TOPLEFT",image,"TOPRIGHT",4,0) |
label:SetWidth(width - imagewidth) |
height = math.max(image:GetHeight(), label:GetHeight()) |
end |
]] |
do |
local Type = "CheckBox" |
local Version = 7 |
local Version = 9 |
local function OnAcquire(self) |
self:SetValue(false) |
self.checked = nil |
self:SetType() |
self:SetDisabled(false) |
self:SetDescription(nil) |
end |
local function CheckBox_OnEnter(this) |
self.text:SetText(label) |
end |
local function SetDescription(self, desc) |
if desc then |
if not self.desc then |
local desc = self.frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") |
desc:ClearAllPoints() |
desc:SetPoint("TOPLEFT", self.check, "TOPRIGHT", 5, -20) |
desc:SetWidth(self.frame.width - 25) |
desc:SetJustifyH("LEFT") |
desc:SetJustifyV("TOP") |
self.desc = desc |
end |
self.desc:Show() |
--self.text:SetFontObject(GameFontNormal) |
self.desc:SetText(desc) |
self:SetHeight(24 + self.desc:GetHeight()) |
else |
if self.desc then |
self.desc:SetText("") |
self.desc:Hide() |
end |
self.text:SetFontObject(GameFontHighlight) |
self:SetHeight(24) |
end |
end |
local function OnWidthSet(self, width) |
if self.desc and self.desc:GetText() ~= "" then |
self.desc:SetWidth(width - 25) |
self:SetHeight(24 + self.desc:GetHeight()) |
end |
end |
local function Constructor() |
local frame = CreateFrame("Button",nil,UIParent) |
local self = {} |
self.ToggleChecked = ToggleChecked |
self.SetLabel = SetLabel |
self.SetTriState = SetTriState |
self.SetDescription = SetDescription |
self.OnWidthSet = OnWidthSet |
self.frame = frame |
frame.obj = self |
self.checkbg = checkbg |
checkbg:SetWidth(24) |
checkbg:SetHeight(24) |
checkbg:SetPoint("LEFT",frame,"LEFT",0,0) |
checkbg:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0) |
checkbg:SetTexture("Interface\\Buttons\\UI-CheckBox-Up") |
local check = frame:CreateTexture(nil,"OVERLAY") |
self.check = check |
text:SetHeight(18) |
text:SetPoint("LEFT",check,"RIGHT",0,0) |
text:SetPoint("RIGHT",frame,"RIGHT",0,0) |
AceGUI:RegisterAsWidget(self) |
return self |
end |
--[[ $Id: AceGUIWidget-DropDown.lua 815 2009-07-08 20:58:17Z nevcairiel $ ]]-- |
--[[ $Id: AceGUIWidget-DropDown.lua 828 2009-08-28 08:47:06Z ammo $ ]]-- |
local min, max, floor = math.min, math.max, math.floor |
local AceGUI = LibStub("AceGUI-3.0") |
do |
local widgetType = "Dropdown-Pullout" |
local widgetVersion = 2 |
local widgetVersion = 3 |
--[[ Static data ]]-- |
local backdrop = { |
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background", |
bgFile = "Interface\\ChatFrame\\ChatFrameBackground", |
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", |
edgeSize = 32, |
tileSize = 32, |
--- AceConfigRegistry-3.0 handles central registration of options tables in use by addons and modules. |
-- Options tables can be registered as raw tables, or as function refs that return a table.\\ |
-- These functions receive two arguments: "uiType" and "uiName". \\ |
-- Valid "uiTypes": "cmd", "dropdown", "dialog". This is verified by the library at call time. \\ |
-- The "uiName" field is expected to contain the full name of the calling addon, including version, e.g. "FooBar-1.0". This is verified by the library at call time.\\ |
-- :IterateOptionsTables() and :GetOptionsTable() always return a function reference that the requesting config handling addon must call with the above arguments. |
--- AceConfigRegistry-3.0 handles central registration of options tables in use by addons and modules.\\ |
-- Options tables can be registered as raw tables, OR as function refs that return a table.\\ |
-- Such functions receive three arguments: "uiType", "uiName", "appName". \\ |
-- * Valid **uiTypes**: "cmd", "dropdown", "dialog". This is verified by the library at call time. \\ |
-- * The **uiName** field is expected to contain the full name of the calling addon, including version, e.g. "FooBar-1.0". This is verified by the library at call time.\\ |
-- * The **appName** field is the options table name as given at registration time \\ |
-- |
-- :IterateOptionsTables() (and :GetOptionsTable() if only given one argument) return a function reference that the requesting config handling addon must call with valid "uiType", "uiName". |
-- @class file |
-- @name AceConfigRegistry-3.0 |
-- @release $Id: AceConfigRegistry-3.0.lua 785 2009-04-05 14:57:29Z nevcairiel $ |
local MAJOR, MINOR = "AceConfigRegistry-3.0", 9 |
-- @release $Id: AceConfigRegistry-3.0.lua 832 2009-09-01 11:03:04Z nevcairiel $ |
local MAJOR, MINOR = "AceConfigRegistry-3.0", 11 |
local AceConfigRegistry = LibStub:NewLibrary(MAJOR, MINOR) |
if not AceConfigRegistry then return end |
type=isstring, |
name=isstringfunc, |
desc=optstringfunc, |
descStyle=optstring, |
order=optmethodnumber, |
validate=optmethodfalse, |
confirm=optmethodbool, |
end |
end |
-- ------------------------------------------------------------------- |
-- :ValidateOptionsTable(options,name,errlvl) |
-- - options - the table |
-- - name - (string) name of table, used in error reports |
-- - errlvl - (optional number) error level offset, default 0 |
-- |
-- Validates basic structure and integrity of an options table |
--- Validates basic structure and integrity of an options table \\ |
-- Does NOT verify that get/set etc actually exist, since they can be defined at any depth |
-- @param options The table to be validated |
-- @param name The name of the table to be validated (shown in any error message) |
-- @param errlvl (optional number) error level offset, default 0 (=errors point to the function calling :ValidateOptionsTable) |
function AceConfigRegistry:ValidateOptionsTable(options,name,errlvl) |
errlvl=(errlvl or 0)+1 |
name = name or "Optionstable" |
validate(options,errlvl,name) |
end |
--- Fires a ConfigTableChange callback for those listening in on it, allowing config GUIs to refresh. |
--- Fires a "ConfigTableChange" callback for those listening in on it, allowing config GUIs to refresh. |
-- You should call this function if your options table changed from any outside event, like a game event |
-- or a timer. |
-- @param appName The application name as given to `:RegisterOptionsTable()` |
--- Register an options table with the config registry. |
-- @param appName The application name as given to `:RegisterOptionsTable()` |
-- @param options The options table or a function reference that generates it on demand. |
-- @param options The options table, OR a function reference that generates it on demand. \\ |
-- See the top of the page for info on arguments passed to such functions. |
function AceConfigRegistry:RegisterOptionsTable(appName, options) |
if type(options)=="table" then |
if options.type~="group" then -- quick sanity checker |
AceConfigRegistry.tables[appName] = function(uiType, uiName, errlvl) |
errlvl=(errlvl or 0)+1 |
validateGetterArgs(uiType, uiName, errlvl) |
local tab = assert(options(uiType, uiName)) |
local tab = assert(options(uiType, uiName, appName)) |
if not AceConfigRegistry.validated[uiType][appName] then |
AceConfigRegistry:ValidateOptionsTable(tab, appName, errlvl) -- upgradable |
AceConfigRegistry.validated[uiType][appName] = true |
end |
--------------------------------------------------------------------- |
-- :GetOptionsTable(appName) |
-- - appName - which addon to retreive the options table of |
-- Optional: |
-- - uiType - "cmd", "dropdown", "dialog" |
-- - uiName - e.g. "MyLib-1.0" |
-- |
--- Query the registry for a specific options table. |
-- can call with (uiType,uiName) to get the table.\\ |
-- If uiType&uiName are given, the table is returned. |
-- @param appName The application name as given to `:RegisterOptionsTable()` |
-- @param uiType The type of UI to get the table for. |
-- @param uiName The name of the library/addon querying the table. |
-- @param uiType The type of UI to get the table for, one of "cmd", "dropdown", "dialog" |
-- @param uiName The name of the library/addon querying for the table, e.g. "MyLib-1.0" |
function AceConfigRegistry:GetOptionsTable(appName, uiType, uiName) |
local f = AceConfigRegistry.tables[appName] |
if not f then |
--- AceConfigDialog-3.0 generates AceGUI-3.0 based windows based on option tables. |
-- @class file |
-- @name AceConfigDialog-3.0 |
-- @release $Id: AceConfigDialog-3.0.lua 796 2009-04-07 15:48:54Z nevcairiel $ |
-- @release $Id: AceConfigDialog-3.0.lua 834 2009-09-01 11:23:08Z nevcairiel $ |
local LibStub = LibStub |
local MAJOR, MINOR = "AceConfigDialog-3.0", 34 |
local MAJOR, MINOR = "AceConfigDialog-3.0", 36 |
local AceConfigDialog = LibStub:NewLibrary(MAJOR, MINOR) |
if not AceConfigDialog then return end |
--Is Never a function or method |
local allIsLiteral = { |
type = true, |
descStyle = true, |
imageWidth = true, |
imageHeight = true, |
} |
local name = GetOptionsMemberValue("name", opt, options, path, appName) |
local desc = GetOptionsMemberValue("desc", opt, options, path, appName) |
local usage = GetOptionsMemberValue("usage", opt, options, path, appName) |
local descStyle = opt.descStyle |
if descStyle and descStyle ~= "tooltip" then return end |
GameTooltip:SetText(name, 1, .82, 0, 1) |
if opt.type == 'multiselect' then |
--validate function returned a message to display |
if rootframe.SetStatusText then |
rootframe:SetStatusText(validated) |
else |
-- TODO: do something else. |
end |
PlaySound("igPlayerInviteDecline") |
del(info) |
rootframe:SetStatusText(name..": Invalid Value") |
end |
end |
else |
-- TODO: do something else |
end |
PlaySound("igPlayerInviteDecline") |
del(info) |
local value = GetOptionsMemberValue("get",v, options, path, appName) |
control:SetValue(value) |
control:SetCallback("OnValueChanged",ActivateControl) |
if v.descStyle == "inline" then |
local desc = GetOptionsMemberValue("desc", v, options, path, appName) |
control:SetDescription(desc) |
end |
elseif v.type == "range" then |
control = gui:Create("Slider") |
L["Difficulty type"] = true |
L["Set the difficulty type text shown on the button/block. 'Auto' means the difficulty will only be shown if you are grouped and will reflect your group type."] = true |
L["Show loot method"] = true |
L["Toggles loot method display on the button/block."] = true |
--L["Difficulty type"] = true |
--L["Set the difficulty type text shown on the button/block. 'Auto' means the difficulty will only be shown if you are grouped and will reflect your group type."] = true |
--L["Show loot method"] = true |
--L["Toggles loot method display on the button/block."] = true |
--L["Difficulty type"] = true |
--L["Set the difficulty type text shown on the button/block. 'Auto' means the difficulty will only be shown if you are grouped and will reflect your group type."] = true |
--L["Show loot method"] = true |
--L["Toggles loot method display on the button/block."] = true |
--L["Difficulty type"] = true |
--L["Set the difficulty type text shown on the button/block. 'Auto' means the difficulty will only be shown if you are grouped and will reflect your group type."] = true |
--L["Show loot method"] = true |
--L["Toggles loot method display on the button/block."] = true |
end |
}) |
local shortdifftable = { |
[_G["DUNGEON_DIFFICULTY1"]] = L["5 N"], |
[_G["DUNGEON_DIFFICULTY2"]] = L["5 H"], |
[_G["RAID_DIFFICULTY1"]] = L["10 N"], |
[_G["RAID_DIFFICULTY2"]] = L["25 N"], |
[_G["RAID_DIFFICULTY3"]] = L["10 H"], |
[_G["RAID_DIFFICULTY4"]] = L["25 H"] |
} |
local rollers = nil |
local lastAnnouncement = nil |
cmdHidden = true |
}, |
optoutofloot = { |
order = 11, type = "toggle", width = "full", |
order = 12, type = "toggle", |
name = L["Pass on random loot"], |
desc = L["Enable this setting to auto-pass on random loot."], |
get = function() return GetOptOutOfLoot() end, |
end, |
}, |
standard = { |
order = 12, type = "toggle", width = "full", |
order = 13, type = "toggle", width = "full", |
name = L["Only accept 1-100"], |
desc = L["Accept standard (1-100) rolls only."], |
get = function() return Broker_GroupConfig.StandardRollsOnly end, |
set = function(_,v) Broker_GroupConfig.StandardRollsOnly = v end, |
}, |
click = { |
order = 13, type = "toggle", width = "full", |
order = 14, type = "toggle", width = "full", |
name = L["Perform roll when clicked"], |
desc = L["Perform a standard 1-100 roll when the plugin is clicked."], |
get = function() return Broker_GroupConfig.RollOnClick end, |
["AUTO"] = L["Auto (based on group)"], |
}, |
}, |
showdiffshort = { |
order = 10, type = "toggle", width = "full", |
name = L["Short text for instance difficulty"], |
desc = L["Trims the instance difficulty text label. For example 25 player Heroic difficulty will display as '25 H'."], |
get = function() return Broker_GroupConfig.DungeonDiffShortText end, |
set = function(_,v) Broker_GroupConfig.DungeonDiffShortText = v BRGroup:Update() end, |
}, |
showloottype = { |
order = 10, type = "toggle", width = "full", |
order = 11, type = "toggle", |
name = L["Show loot method"], |
desc = L["Toggles loot method display on the button/block."], |
get = function() return Broker_GroupConfig.DisplayLootTypeButton end, |
disabled = function() return not Broker_GroupConfig.DisplayDungeonDiff end, |
}, |
leaveparty = { |
order = 14, type = "execute", |
order = 15, type = "execute", |
name = L["Leave Party"], |
desc = L["Leave your current party or raid."], |
disabled = function() |
func = LeaveParty, |
}, |
resetinstance = { |
order = 15, type = "execute", |
order = 16, type = "execute", |
name = L["Reset Instances"], |
desc = L["Reset all available instance the group leader has active."], |
func = function() StaticPopup_Show("CONFIRM_RESET_INSTANCES") end, |
StandardRollsOnly = true, |
LootThreshold = 2, |
LootMethod = "group", |
DisplayLootTypeButton = true |
DisplayLootTypeButton = true, |
DungeonDiffShortText = false |
} |
end |
-- added config options for 2.2 |
if not Broker_GroupConfig.DungeonDiffShortText then Broker_GroupConfig.DungeonDiffShortText = false end |
-- added config options for 2.1 |
if Broker_GroupConfig.DisplayLootTypeButton == nil then Broker_GroupConfig.DisplayLootTypeButton = true end |
if Broker_GroupConfig.DungeonDiffType == nil then Broker_GroupConfig.DungeonDiffType = "AUTO" end |
if Broker_GroupConfig.DisplayLootTypeButton then pluginlabel = self:GetLootTypeText() separator = " " withpar = true end |
if Broker_GroupConfig.DungeonDiffType == "DUNGEON" then |
-- Dungeon |
pluginlabel = pluginlabel..separator..self:GetDungeonDifficultyText(false, withpar) |
pluginlabel = pluginlabel..separator..self:GetDungeonDifficultyText(false, withpar, Broker_GroupConfig.DungeonDiffShortText) |
elseif Broker_GroupConfig.DungeonDiffType == "RAID" then |
-- Raid |
pluginlabel = pluginlabel..separator..self:GetDungeonDifficultyText(true, withpar) |
pluginlabel = pluginlabel..separator..self:GetDungeonDifficultyText(true, withpar, Broker_GroupConfig.DungeonDiffShortText) |
elseif Broker_GroupConfig.DungeonDiffType == "AUTO" then |
-- Auto |
if UnitExists("party1") and (GetNumRaidMembers() == 0 or GetNumRaidMembers() < 0) then pluginlabel = pluginlabel..separator..self:GetDungeonDifficultyText(false, withpar) end |
if GetNumRaidMembers() > 0 then pluginlabel = pluginlabel..separator..self:GetDungeonDifficultyText(true, withpar) end |
if UnitExists("party1") and (GetNumRaidMembers() == 0 or GetNumRaidMembers() < 0) then pluginlabel = pluginlabel..separator..self:GetDungeonDifficultyText(false, withpar, Broker_GroupConfig.DungeonDiffShortText) end |
if GetNumRaidMembers() > 0 then pluginlabel = pluginlabel..separator..self:GetDungeonDifficultyText(true, withpar, Broker_GroupConfig.DungeonDiffShortText) end |
end |
self.obj.text = pluginlabel |
else |
end |
function BRGroup:GetDungeonDifficultyText(isRaid, withpar) |
function BRGroup:GetDungeonDifficultyText(isRaid, withpar, shortText) |
local par1, par2 = "", "" |
if withpar then par1, par2 = "(", ")" end |
local diffstr = "|cffffff9a"..par1.._G["UNKNOWN"]..par2.."|r" |
-- remove () chars from difficulty |
local tmpstr = string.gsub(_G["RAID_DIFFICULTY"..tostring(diff)], "%(", "") |
tmpstr = string.gsub(tmpstr, "%)", "") |
if shortText and shortdifftable[_G["RAID_DIFFICULTY"..tostring(diff)]] then tmpstr = shortdifftable[_G["RAID_DIFFICULTY"..tostring(diff)]] end -- account for shortText label |
if diff == 3 or diff == 4 then |
diffstr = _G["RED_FONT_COLOR_CODE"]..par1..tmpstr..par2.."|r" |
else |
-- remove () chars from difficulty |
local tmpstr = string.gsub(_G["DUNGEON_DIFFICULTY"..tostring(diff)], "%(", "") |
tmpstr = string.gsub(tmpstr, "%)", "") |
if shortText and shortdifftable[_G["DUNGEON_DIFFICULTY"..tostring(diff)]] then tmpstr = shortdifftable[_G["DUNGEON_DIFFICULTY"..tostring(diff)]] end -- account for shortText label |
if diff == 2 then |
diffstr = _G["RED_FONT_COLOR_CODE"]..par1..tmpstr..par2.."|r" |
else |