Creation:
FuBarPlugin:GetInstance("version") added 1.1
FuBarPlugin:GetInstance("version"):new({ .. }) added 1.1
Provided for you:
self:SetText(text)
self:GetText()
self:GetTitle()
self:DisableHideWithoutStandby()
self:EnableHideWithoutStandby()
self:Update()
self:UpdateDisplay() added 1.1
self:Show()
self:Hide()
self:AddImpliedMenuOptions(level)
self:CheckWidth([force]) added 0.3.0
self:SetIcon(path)
self:GetIcon()
self:IsIconShown() pre-0.3.0: self:GetShowIcon()
self:ToggleIconShown() pre-0.3.0: self:ToggleShowIcon()
self:ShowIcon() added 0.3.0
self:HideIcon() added 0.3.0
self:IsIconShown() added 0.4.5
self:ToggleIconShown() added 0.4.5
self:ShowIcon() added 0.4.5
self:HideIcon() added 0.4.5
self:OpenChildFrame(child)
self:RegisterForLoad()
self:HookIntoPlugin(plugin [, "style"]) added 0.9.0
self.hookedPlugin added 0.9.0
self:SwitchPluginHook() added 0.9.0
self:IsCurrentPluginHookSwitch() added 0.9.0
self:DetachTooltip() added 0.9.99
self:ReattachTooltip() added 0.9.99
self:IsTooltipDetached() added 0.9.99
self.realName
self.versionNumber
self.data
self.charData
self.realmData
self.classData
self.fullData
self.data.version
self.charData.version added 0.4.21
self.realmData.version added 0.4.21
self.classData.version added 0.4.21
self.fullData.version added 0.4.21
User-defined Options:
self.name
self.description
self.version
self.releaseDate
self.aceCompatible
self.author
self.email
self.website
self.category
self.db (optional)
self.defaults (optional)
self.charDefaults (optional) added 0.4.20
self.classDefaults (optional) added 0.4.20
self.fullDefaults (optional) added 0.4.20
self.realmDefaults (optional) added 0.4.20
self.cmd
self.hasIcon (optional)
self.hasNoText (optional)
self.hasNoColor (optional) added 0.9.4
self.cannotHideText (optional) added 1.1
self.overrideMenu (optional)
self.overrideTooltip (optional) added 0.4.6
self.defaultPosition (optional) added 1.1
self.defaultMinimapPosition (optional) added 1.1
self.frame (optional) added 0.3.7
self.iconFrame (optional) added 0.3.7
self.textFrame (optional) added 0.3.7
self.clickableTooltip (optional) added 0.9.7
self.chardb (optional) added 0.9.8
self.loadCondition (optional) added 0.9.8
self.cannotDetachTooltip (optional) added 0.9.99
User-defined Methods (All the below are optional):
self:Initialize()
self:Enable()
self:Disable()
self:Report()
self:MenuSettings(level, value, inTooltip, valueN_1, valueN_2, valueN_3, valueN_4) Updated 1.1
self:UpdateData()
self:UpdateText()
self:UpdateTooltip()
self:OnClick()
self:OnDoubleClick()
self:OnMouseDown(button) added 0.3.0
self:OnMouseUp(button)
self:ShowTooltip() (not optional if self.overrideTooltip is set) added 0.4.6
self:HideTooltip() added 0.4.6
self:ACE_PROFILE_LOADED() updated 1.1
Localized constants:
FuBarLocals.MAP_ONOFF
Utility functions/constants:
FuBarUtils.COLOR_HEX_RED
FuBarUtils.COLOR_HEX_ORANGE
FuBarUtils.COLOR_HEX_YELLOW
FuBarUtils.COLOR_HEX_GREEN
FuBarUtils.COLOR_HEX_WHITE
FuBarUtils.COLOR_HEX_COPPER
FuBarUtils.COLOR_HEX_SILVER
FuBarUtils.COLOR_HEX_GOLD
FuBarUtils.Colorize(hexColor, text)
FuBarUtils.Red(text)
FuBarUtils.Orange(text)
FuBarUtils.Yellow(text)
FuBarUtils.Green(text)
FuBarUtils.White(text)
FuBarUtils.GetThresholdHexColor(quality [, worst, worse, normal, better, best])
FuBarUtils.GetThresholdColor(quality [, worst, worse, normal, better, best])
FuBarUtils.GetThresholdHexColorTrivial(quality [, worst, worse, normal, better, best]) added 0.4.12
FuBarUtils.GetThresholdColorTrivial(quality [, worst, worse, normal, better, best]) added 0.4.12
FuBarUtils.AddSpacerDropDownMenu()
FuBarUtils.FormatMoneyExtended(copper [, colorize [, textColor]]) added 1.1
FuBarUtils.FormatMoneyFull(copper [, colorize [, textColor]]) updated 1.1
FuBarUtils.FormatMoneyShort(copper [, colorize [, textColor]]) updated 1.1
FuBarUtils.FormatMoneyCondensed(copper [, colorize [, textColor]]) updated 1.1
FuBarUtils.FormatDurationExtended(seconds [, colorize] [, hideSeconds]) added 1.1
FuBarUtils.FormatDurationFull(seconds [, colorize] [, hideSeconds]) pre-0.3.1: FuBarUtils.GetFullDurationText(seconds [, colorize])
FuBarUtils.FormatDurationShort(seconds [, colorize] [, hideSeconds]) pre-0.3.1: FuBarUtils.GetShortDurationText(seconds [, colorize])
FuBarUtils.FormatDurationCondensed(seconds [, colorize] [, hideSeconds]) added 0.3.1
FuBarUtils.VersionToNumber(version) added 0.4.7
FuBarUtils.GetVersionPoint(version, point) added 0.4.7
FuBarUtils.GetMajorNumber(version) added 0.4.7
FuBarUtils.GetMinorNumber(version) added 0.4.7
FuBarUtils.GetRevisionNumber(version) added 0.4.7
FuBarUtils.GetTrivialNumber(version) added 0.4.7
FuBarUtils.Deformat("text", "pattern") DEPRECATED
FuBarUtils.LocalizedClassToEnglish("class") DEPRECATED
FuBarUtils.EnglishClassToLocalized("class") DEPRECATED
FuBarUtils.GetColorByClass("class") DEPRECATED
FuBarUtils.GetHexColorByClass("class") DEPRECATED
FuBarUtils.LocalizedZoneToEnglish("zone") DEPRECATED
FuBarUtils.EnglishZoneToLocalized("zone") DEPRECATED
Other:
FuBar:RegisterSkin("name", "file") added 1.1
FuBar:CreateBasicPluginFrame("name") added 0.9.5
FUBAR_DEFAULTS added 1.0
FUBAR_DEFAULTS_<CLASS> added 1.0
Creation:
FuBarPlugin:GetInstance("version") added 1.1
Returns a version of FuBarPlugin to adhere to.
Arguments:
("version")
text:
String - API version to adhere to.
Returns:
A version of FuBarPlugin to adhere to.
Example:
PluginFu = FuBarPlugin:GetInstance("1.2"):new({ ... })
FuBarPlugin:GetInstance("version"):new([{ ... }]) added 1.1
Returns a plugin to manipulate.
Arguments:
([{ ... }])
{ ... }:
Table - a table with which to hold basic data about your plugin.
Returns:
A plugin to manipulate
Example:
PluginFu = FuBarPlugin:GetInstance("1.2"):new({ ... })
Provided for you:
self:SetText(text)
Sets the text of the plugin. Should only be called from within self:UpdateText()
Arguments:
([text])
text:
String - text to set the plugin to. If not given, set to title.
Returns:
nil
See Also:
self:GetText()
self.hasNoText
self:GetTitle()
Example:
UpdateText = function(self)
    self:SetText("Hello")
end
self:GetText()
Returns the current text of the plugin.
Arguments:
()
Returns:
String - The current text of the plugin.
See Also:
self:SetText(text)
self.hasNoText
Example:
local text = self:GetText()
self:GetTitle()
Returns the localized name of the plugin, not including the "FuBar - " part.
Arguments:
()
Returns:
String - The localized name of the plugin, not including the "FuBar - " part.
Example:
local title = self:GetTitle()
self:DisableHideWithoutStandby()
Turns off the ability to hide the plugin without disabling it.
Arguments:
()
Returns:
nil
See Also:
self:EnableHideWithoutStandby()
self.hideWithoutStandby
Example:
self:DisableHideWithoutStandby()
self:EnableHideWithoutStandby()
Turns on the ability to hide the plugin without disabling it.
Arguments:
()
Returns:
nil
See Also:
self:DisableHideWithoutStandby()
self.hideWithoutStandby
Example:
self:EnableHideWithoutStandby()
self:Update()
Calls self:UpdateData(), self:UpdateText(), and self:UpdateTooltip() if tooltip is shown, in that order.
Arguments:
()
Returns:
nil
See Also:
self:UpdateData()
self:UpdateText()
self:UpdateTooltip()
self:UpdateDisplay()
Example:
OnUpdate = function(self, timeSinceLast)
    self:Update()
end
self:UpdateDisplay()
Calls self:UpdateText() and self:UpdateTooltip(), if tooltip is shown, in that order.
Arguments:
()
Returns:
nil
See Also:
self:UpdateData()
self:UpdateText()
self:UpdateTooltip()
self:Update()
Example:
OnUpdate = function(self, timeSinceLast)
    self:UpdateDisplay()
end
self:Show()
Shows the plugin, enables the plugin if previously disabled, and calls self:Update().
Arguments:
()
Returns:
nil
See Also:
self:Hide()
self:Update()
Example:
self:Show()
self:Hide()
Hides the plugin, disables the plugin if cannot hide without standby.
Arguments:
()
Returns:
nil
See Also:
self:Show()
self:DisableHideWithoutStandby()
self:EnableWithoutStandby()
self.hideWithoutStandby
Example:
self:Hide()
self:AddImpliedMenuOptions(level)
This is called during the menu creation phase. Can be added within self:MenuSettings().
Arguments:
([level])
level:
Integer - Current level in the dropdown tree. If not given, 1 (toplevel) is assumed.
Returns:
nil
See Also:
self:MenuSettings(level, value, inTooltip, valueN_1, valueN_2, valueN_3, valueN_4)
self.overrideMenu
Example:
MenuSettings = function(self, level, value)
    self:AddImpliedMenuOptions(level)
end
self:SetIcon(path)
Sets the path to the icon for the plugin.
Arguments:
([path])
path:
String - The path to the icon. If not given, "icon.tga" or "icon.blp" in the plugin's directory is assumed.
Returns:
nil
See Also:
self:GetIcon()
self.hasIcon
Example:
self:SetIcon("Interface\\AddOns\\" .. self.realName .. "\\otherIcon")
self:GetIcon()
Returns the path to the icon for the plugin, or nil if plugin has no icon.
Arguments:
()
Returns:
The path to the icon for the plugin.
See Also:
self:SetIcon()
self.hasIcon
Example:
local path = self:GetIcon()
self:CheckWidth([force]) added 0.3.0
Checks the current width of the icon and text, then updates frame to expand/shrink to it if necessary.
Arguments:
([force]) force Boolean - true - Shrink/expand no matter what. false (default) - If the width is less than 8 pixels smaller, don't shrink
Returns:
nil
See Also:
self:SetText()
Remarks:
In almost all cases, there is no need to call this, as it is automatically called when text is changed or icon is changed.
Example:
self:CheckWidth(true)
self:IsIconShown() pre-0.3.0: self:GetShowIcon()
Returns whether the icon for the plugin is showing.
Arguments:
()
Returns:
Boolean - whether the icon for the plugin is showing.
See Also:
self:ToggleIconShown()
Example:
local isIconShowing = self:IsIconShown()
self:ToggleIconShown() pre-0.3.0: self:ToggleShowIcon()
Toggles whether the icon for the plugin is showing.
Arguments:
()
Returns:
Boolean - whether the icon for the plugin is showing (new value)
See Also:
self:IsIconShown()
self:ShowIcon()
self:HideIcon()
Example:
local isIconShowing = self:ToggleIconShown()
self:ShowIcon() added 0.3.0
Shows the icon of the plugin if hidden.
Arguments:
()
Returns:
nil
See Also:
self:ToggleIconShown()
self:HideIcon()
Example:
self:ShowIcon()
self:HideIcon() added 0.3.0
Hides the icon of the plugin if shown.
Arguments:
()
Returns:
nil
See Also:
self:ToggleIconShown()
self:ShowIcon()
Example:
self:HideIcon()
self:IsTextShown() added 0.4.5
Returns whether the text for the plugin is showing.
Arguments:
()
Returns:
Boolean - whether the text for the plugin is showing.
See Also:
self:ToggleTextShown()
Example:
local isTextShowing = self:IsTextShown()
self:ToggleTextShown() added 0.4.5
Toggles whether the text for the plugin is showing.
Arguments:
()
Returns:
Boolean - whether the text for the plugin is showing (new value)
See Also:
self:IsTextShown()
self:ShowText()
self:HideText()
Example:
local istextShowing = self:ToggleTextShown()
self:ShowText() added 0.4.5
Shows the text of the plugin if hidden.
Arguments:
()
Returns:
nil
See Also:
self:ToggleTextShown()
self:HideText()
Example:
self:ShowText()
self:HideText() added 0.4.5
Hides the text of the plugin if shown.
Arguments:
()
Returns:
nil
See Also:
self:ToggleTextShown()
self:ShowText()
Example:
self:HideText()
self:OpenChildFrame(child)
Opens a child frame next to the plugin.
Arguments:
(child)
child:
Frame - child to open next to the plugin.
Returns:
nil
Example:
self:OpenChildFrame(getglobal(self.realName .. "OptionsFrame"))
self:RegisterForLoad()
Registers the plugin with FuBar.
Arguments:
()
Returns:
nil
Example:
FuBar_MyPlugin = FuBarPlugin:new({
    ...
})

FuBar_MyPlugin:RegisterForLoad()
self:HookIntoPlugin(plugin [, "style"]) added 0.9.0
Hooks the current plugin into another plugin if able.
Arguments:
(plugin [, "style"])
plugin
Plugin - Other plugin to merge into.
"style"
String - either "INLINE", "SWITCH", or "SWITCHTEXT". You can also append "_TITLE" to this to show the title (only aplies to "INLINE" and "SWITCHTEXT".
Returns:
Boolean - whether hook was successful
Remarks:
If this is not called and successful, self.hookedPlugin, self.SwitchPluginHook, and self.IsCurrentPluginHookSwitch will remain nil. Also, if style is "INLINE", then self.SwitchPluginHook and self.IsCurrentPluginHookSwitch will be nil.
See Also:
self.hookedPlugin
self:SwitchPluginHook()
self:IsCurrentPluginHookSwitch()
self.hookedPlugin added 0.9.0
Plugin - The plugin currently hooked into. nil if not applicable.
See Also:
self:HookIntoPlugin(plugin, "style")
self:SwitchPluginHook()
self:IsCurrentPluginHookSwitch()
self:SwitchPluginHook() added 0.9.0
Switches between the hooked plugin view and this plugin's view.
Arguments:
()
Returns:
nil
Remarks:
This method will not exist if the hook style is "INLINE".
See Also:
self:HookIntoPlugin(plugin, "style")
self.hookedPlugin
self:IsCurrentPluginHookSwitch()
self:IsCurrentPluginHookSwitch() added 0.9.0
Returns whether this plugin is in the current view.
Arguments:
()
Returns:
Whether this plugin is in the current view.
Remarks:
This method will not exist if the hook style is "INLINE".
See Also:
self:HookIntoPlugin(plugin, "style")
self.hookedPlugin
self:SwitchPluginHook()
self:DetachTooltip() added 0.9.99
Detaches the tooltip from the plugin.
Arguments:
()
Returns:
nil
Remarks:
This does nothing if already detached.
See Also:
self.canDetachTooltip
self:ReattachTooltip()
self:IsTooltipDetached()
self:ReattachTooltip() added 0.9.99
Reattaches the tooltip to the plugin.
Arguments:
()
Returns:
nil
Remarks:
This does nothing if already attached.
See Also:
self.canDetachTooltip
self:DetachTooltip()
self:IsTooltipDetached()
self:IsTooltipDetached() added 0.9.99
Returns whether the tooltip is detached.
Arguments:
()
Returns:
Whether the tooltip is detached.
See Also:
self.canDetachTooltip
self:DetachTooltip()
self:ReattachTooltip()
self.realName
String - The name of your plugin (non-localized). It should be the name of your plugin's folder as well.
self.versionNumber
Number - the version of the plugin in number form.
Remarks:
All this is is FuBarUtils.VersionToNumber(self.version)
self.data
Table - table of your profile-specific database. Will be set to the same path as self.db if set, otherwise, the data will be part of FuBarDB (not recommended).
See Also:
self.charData
self.realmData
self.classData
self.fullData
Example:
self.data.value = 5
-- imagine a reload
assert(self.data.value == 5)
self.charData
Table - table of your character-specific database. Will be set to the same path as self.db if set, otherwise, the data will be part of FuBarDB (not recommended).
See Also:
self.data
self.realmData
self.classData
self.fullData self.chardb
Example:
self.charData.value = 6
-- imagine a reload (must be to the same character)
assert(self.charData.value == 6)
self.realmData
Table - table of your realm-specific database. Will be set to the same path as self.db if set, otherwise, the data will be part of FuBarDB (not recommended).
Remarks:
A Horde character and an Alliance character are not seen as being on the same realm by this.
See Also:
self.data
self.charData
self.classData
self.fullData
Example:
self.realmData.value = 7
-- imagine a reload (to any character on the same realm/faction)
assert(self.realmData.value == 7)
self.classData
Table - table of your class-specific database. Will be set to the same path as self.db if set, otherwise, the data will be part of FuBarDB (not recommended).
See Also:
self.data
self.charData
self.realmData
self.fullData
Example:
self.classData.value = 9
-- imagine a reload (to any character with the same class)
assert(self.classData.value == 9)
self.fullData
Table - table of a full database, available between realms, classes, etc. Will be set to the same path as self.db if set, otherwise, the data will be part of FuBarDB (not recommended).
See Also:
self.data
self.charData
self.realmData
self.classData
Example:
self.fullData.value = 10
-- imagine a reload (to any character whatsoever)
assert(self.fullData.value == 10)
self.data.version
Number - version of the current plugin the last time it was initialized or on a profile update.
Remarks:
This is for handling backwards compatibility for your addons, if you change variables or whatnot. It is reset after Initialize() is called, so it should be dealt with there.
Unlike the other self.*Data.version's, it is also set after self:AceProfileLoaded() is called, because self.data is changed there.
Example:
Initialize = function()
    if self.data.version < self.versionNumber then
        self:DoSomething()
    end
end
self.charData.version
Number - version of the current plugin the last time it was initialized.
Remarks:
This is for handling backwards compatibility for your addons, if you change variables or whatnot. It is reset after Initialize() is called, so it should be dealt with there.
Example:
Initialize = function()
    if self.charData.version < self.versionNumber then
        self:DoSomething()
    end
end
self.realmData.version
String - version of the current plugin the last time it was initialized.
Remarks:
This is for handling backwards compatibility for your addons, if you change variables or whatnot. It is reset after Initialize() is called, so it should be dealt with there.
Example:
Initialize = function()
    if self.realmData.version < self.versionNumber then
        self:DoSomething()
    end
end
self.classData.version
String - version of the current plugin the last time it was initialized.
Remarks:
This is for handling backwards compatibility for your addons, if you change variables or whatnot. It is reset after Initialize() is called, so it should be dealt with there.
Example:
Initialize = function()
    if self.classData.version < self.versionNumber then
        self:DoSomething()
    end
end
self.fullData.version
String - version of the current plugin the last time it was initialized.
Remarks:
This is for handling backwards compatibility for your addons, if you change variables or whatnot. It is reset after Initialize() is called, so it should be dealt with there.
Example:
Initialize = function()
    if self.fullData.version < self.versionNumber then
        self:DoSomething()
    end
end
User-defined Options:
self.name
String - The name of the plugin.
Remarks:
Should be in the form of "FuBar - MyPlugin".
Use a localization file for this.
self.description
String - The description of the plugin.
Remarks:
Use a localization file for this.
self.version
String - The version of the plugin.
Remarks:
Should be in the form of x.y.z, which is Major.Minor.Revision.
Typically, you will start at 0.0.1 and increase upwards from there. The revision point is typically for small changes.
Until 1.0.0, 0.x.0 is a time for API changes.
At 1.0.0 until the switch to 2.0.0, the API is typically expected to stay constant.
Version 0.0.10 is higher than 0.0.2
self.releaseDate
String - The release date of the plugin.
Remarks:
Should be in the form of "MM-DD-YYYY".
self.aceCompatible
Integer - The ace compatibility number this plugin was based on.
Remarks:
As it stands (2006-02-09), the number is 103.
self.author
String - The name of the plugin's author.
Remarks:
This can be your real name, a handle, or a nickname.
If more than one author, list with commas by amount contributed.
If discrepency on who contributed more, go alphabetically (by last name if available).
self.email
String - The e-mail address of the plugin's author.
Remarks:
If more than one author, should match the order of self.author
self.website
String - The website this addon is published on.
self.category
String - The category of this addon.
Remarks:
The available categories are as follows:
CategoryDescription
barsInterface Bars
chatChat/Communications
classClass Enhancement
combatCombat/Casting
compilationsCompilations
interfaceInterface Enhancements
inventoryInventory/Item Enhancements
mapMap Enhancements
othersOther
professionsProfessions
questsQuest Enhancements
raidRaid Assistance
self.db (optional)
AceDatabase - An AceDatabase of your saved variables
Remarks:
It is declared in the form of AceDatabase:new("FuBar_MyPluginDB")
self.defaults (optional)
Table - The default values to be put into self.data if it does not exist.
self.charDefaults (optional) added 0.4.20
Table - The default values to be put into self.charData if it does not exist.
self.classDefaults (optional) added 0.4.20
Table - The default values to be put into self.classData if it does not exist.
self.fullDefaults (optional) added 0.4.20
Table - The default values to be put into self.fullData if it does not exist.
self.realmDefaults (optional) added 0.4.20
Table - The default values to be put into self.realmData if it does not exist.
self.cmd
AceChatCmd - An AceChatCmd to allow the plugin to access the message box easily.
See Also:
http://wowace.com/?page=usage for more information.
self.hasIcon (optional)
Boolean -
true - Set icon to the "icon.tga" or "icon.blp" file in the plugin's directory
false (default) - no icon at all
String - Set icon to the path defined.
See Also:
self:SetIcon([path])
self:GetIcon()
self.hasNoText
self.hasNoText (optional)
Boolean -
true - plugin has no text, prevents from hiding icon.
false (default) - plugin can have text in it.
See Also:
self:SetText([text])
self:GetText()
self.hasNoColor (optional) added 0.9.4
Boolean -
true - plugin has no color, thus you can't turn on uncoloring.
false (default) - plugin can support turning on uncoloring.
Remarks:
All this does is prevent the menu item "Show color" from appearing.
self.cannotHideText (optional) (added 1.1)
Boolean -
true - plugin has the ability to hide its text.
false (default) - plugin cannot hide its text.
See Also:
self:IsTextShown()
self:ToggleTextShown()
self:ShowText()
self:HideText()
self.overrideMenu (optional)
Boolean -
true - right-click menu will not automatically show the Hide/About/etc. buttons.
false (default) - right-click will show the implied buttons in toplevel of the right-click menu.
Remarks:
Do _not_ set this to true if you do not call self:AddImpliedMenuOptions([level]) somewhere in your self:MenuSettings(level, value, inTooltip, valueN_1, valueN_2, valueN_3, valueN_4)
See Also:
self:MenuSettings(level, value, inTooltip, valueN_1, valueN_2, valueN_3, valueN_4)
self.overrideTooltip (optional)
Boolean -
true - self:ShowTooltip() and self:HideTooltip() will the called at the appropriate times.
false (default) - normal tooltip will be shown/hidden.
Remarks:
If you set this to true, you must declare self:ShowTooltip(). self:HideTooltip() can be declared optionally.
See Also:
self:ShowTooltip()
self:HideTooltip()
self.defaultPosition (optional) added 1.1
String -
"LEFT" - show on the left. (default if not given)
"CENTER" - show in the center.
"RIGHT" - show on the right.
"MINIMAP" - show on the minimap.
self.defaultMinimapPosition (optional) added 1.1
Number -
Angle on the minimap, in degrees. [0, 360)
self.frame (optional) (added 0.3.7)
Button -
This points to a user-defined button, typically written in XML.
Remarks:
In your XML, the button should derive from ckknightPluginBasicFrameTemplate
If you set this, you have to declare self:SetFontSize(size), which should scale your frame and its innards by the size given.
See Also:
self.iconFrame
self.textFrame
self.iconFrame (optional) (added 0.3.7)
Texture -
This points to a user-defined texture, typically written in XML.
Remarks:
This should be a child of self.frame, this will not be used unless self.frame is set.
See Also:
self.frame
self.textFrame
self.textFrame (optional) (added 0.3.7)
FontString -
This points to a user-defined FontString, typically written in XML.
Remarks:
This should be a child of self.frame, this will not be used unless self.frame is set.
See Also:
self.frame
self.iconFrame
self.clickableTooltip (optional) added 0.9.7
Boolean -
Whether you can drag your mouse onto the tooltip and click a line
See Also:
self.tooltip:AddCategory("name" [, "lText"] [, "rText"] [, func or "method"] [, checked] [, "checkTexture"] [, hideBlankLine])
self.tooltip:AddLine("category", "text" [, r, g, b] [, wrap] [, justify] [, size or font] [, "id"] [, func or "method"] [, checked] [, "checkTexture"])
self.tooltip:AddDoubleLine("category", "lText", "rText" [, lr, lg, lb] [, rr, rg, rb] [, size or font] [, "id"] [, func or "method"] [, checked] [, "checkTexture"])
self.chardb (optional) added 0.9.8
String -
Name of the SavedVariablesPerChar that you will use.
Remarks:
This is only really useful if you put a lot of data into self.charData, by having a SavedVariablesPerChar, you don't load other characters' data needlessly.
See Also:
self.charData
self.loadCondition (optional) added 0.9.8
String -
innards of a function to determine whether to load or not.
Remarks:
This is run to determine whether a plugin should be loaded in the current game.
It is run in the following form:
function(fuVersion)
<your code here>
end

The variable fuVersion is available to you. It's FuBar's version number.
Be sure to return a value in this. A true (non-false, non-nil) value will load the plugin (if not disabled), and a false (or nil) value will not load the plugin even if it normally would be enabled.
See Also:
self.charData
self.cannotDetachTooltip (optional) added 0.9.99
Boolean -
Whether the tooltip cannot be detached from the plugin text.
Remarks:
Normally, a tooltip can detach. This should be set if there is no relevant data in the tooltip.
See Also:
self:DetachTooltip()
self:ReattachTooltip()
self:IsTooltipDetached()
User-defined Methods (All the below are optional):
self:Initialize()
Called when the plugin is first initialized or when the UI is reloaded.
Arguments:
()
Returns:
nil
Remarks:
Do not call this on your own.
See Also:
self:Enable()
self:Disable()
Example:
Initialize = function(self)
    if (not self.data.values) then
        self.data.values = {}
    end
end
self:Enable()
Called when the plugin is first loaded (after self:Initialize()) or after coming back from standby.
Arguments:
()
Returns:
nil
Remarks:
Do not call this on your own, if you want to take the addon back from standby, call self:EnableAddon()
See Also:
self:Initialize()
self:Disable()
Example:
Enable = function(self)
    self.data.values.one = 1
end
self:Disable()
Called when the plugin is put on standby.
Arguments:
()
Returns:
nil
Remarks:
Do not call this on your own, if you want to put the addon on standby, call self:DisableAddon()
See Also:
self:Initialize()
self:Disable()
Example:
Enable = function(self)
    self.data.values.one = 1
end
self:Report()
Called when "/myaddon report" is entered or the About button for this plugin is clicked. Displays the status of the plugin.
Arguments:
()
Returns:
nil
Remarks:
Do not call this on your own.
Example:
Report = function(self)
    self.cmd:report({
        {
            text = FuBar_MyPluginLocals.ARGUMENT_GOOD,
            val = (self:GetGood() and 1 or 0),
            map = FuBarLocals.MAP_ONOFF
        },
    })
end
Gives the info for the right-click menu of the addon.
Arguments:
(level, value, inTooltip, valueN_1, valueN_2, valueN_3, valueN_4)
level:
Integer - The depth of the menu. 1 means toplevel, 2 means 2nd level, etc.
value:
String - The value provided from your last expanding button.
inTooltip:
Boolean - Whether the right click initiated from a detached tooltip.
valueN_1:
String - The value provided from your level N-1, where N is the current level.
valueN_2:
String - The value provided from your level N-1.
valueN_3:
String - The value provided from your level N-1.
valueN_4:
String - The value provided from your level N-1.
Returns:
nil
See Also:
self.overrideMenu
self.AddImplicitMenuOptions([level])
Remarks:
If you set self.overrideMenu to true, be sure to call self:AddImplicitMenuOptions([level]).
You only need to check for inTooltip if you set self.canDetachTooltip to true.
Example:
MenuSettings = function(self, level, value, inTooltip)
    if not inTooltip then
        UIDropDownMenu_AddButton({
            text = FuBar_MyPluginLocals.MENU_IS_GOOD,
            func = function()
                self:ToggleGoodness()
            end,
            checked = self:IsGood(),
            keepShowOnClick = true
        })
    end
end
self:UpdateData()
Called when data should be updated.
Arguments:
()
Returns:
nil
Remarks:
Feel free to call this on your own, but recognize when it is better to call self:Update() instead.
See Also:
self:Update()
self:UpdateText()
self:UpdateTooltip()
Example:
UpdateData = function(self)
    self.data.flag = not self.data.flag
end
self:UpdateText()
Called when text should be updated.
Arguments:
()
Returns:
nil
Remarks:
Feel free to call this on your own, but recognize when it is better to call self:Update() instead.
See Also:
self:Update()
self:UpdateData()
self:UpdateTooltip()
Example:
UpdateText = function(self)
    self:SetText(self.data.flag and "On" or "Off")
end
self:UpdateTooltip()
Called when the tooltip should be updated, if the tooltip is hidden, this will not be called from self:Update()
Arguments:
()
Returns:
nil
Remarks:
Feel free to call this on your own, but recognize when it is better to call self:Update() instead.
See Also:
self:Update()
self:UpdateData()
self:UpdateText()
Example:
UpdateTooltip = function(self)
    tablet:AddCategory(...)
end
self:OnClick()
Called when the plugin is clicked by the user.
()
Returns:
nil
Remarks:
This only catches left-button clicks. If you need to know the button that was clicked, use self:OnMouseUp(button).
Example:
OnClick = function(self)
    self:ToggleStyle()
end
See Also:
self:OnDoubleClick()
self:OnMouseUp(button)
self:OnDoubleClick()
Called when the plugin is double-clicked by the user.
()
Returns:
nil
Example:
OnDoubleClick = function(self)
    self:ToggleStyle()
end
See Also:
self:OnClick()
self:OnMouseUp(button)
self:OnMouseUp(button)
Called when the mouse is lifted from the plugin. (un-click)
(button)
button
String - the button clicked. Either "LeftButton", "RightButton", "MiddleButton", "MouseButton4", "MouseButton5", or so on.
Returns:
nil
Example:
OnMouseUp = function(self, button)
    if (button == "LeftButton") then
        self:ToggleStyle()
    end
end
See Also:
self:OnMouseDown(button)
self:OnClick()
self:OnDoubleClick()
self:OnMouseDown(button) added 0.3.0
Called when the mouse is pressed on the plugin. (click, but not un-click)
(button)
button
String - the button clicked. Either "LeftButton", "RightButton", "MiddleButton", "MouseButton4", "MouseButton5", or so on.
Returns:
nil
Remarks:
Does not catch right-clicks.
Example:
OnMouseDown = function(self, button)
    if (button == "LeftButton") then
        self:DoSomethingImportant()
    end
end
See Also:
self:OnMouseUp(button)
self:OnClick()
self:ShowTooltip() (not optional if self.overrideTooltip is set) added 0.4.6
Called when the plugin is hovered over by the mouse
()
Returns:
nil
Remarks:
This is only called if self.overrideTooltip is set to true, otherwise the standard tooltip will be shown.
Despite this being required, self:HideTooltip() is optional.
Example:
ShowTooltip = function(self)
    self:OpenChildFrame(self.child)
end
See Also:
self.overrideTooltip
self:HideTooltip()
self:OpenChildFrame()
self:HideTooltip() added 0.4.6
Called when the plugin is no longer hovered by the mouse.
()
Returns:
nil
Remarks:
This is only called if self.overrideTooltip is set to true, otherwise the standard tooltip will be shown.
Despite this being optional, self:ShowTooltip() is required.
If you do not define this, you should set up a system to hide the child frame after a timeout.
Example:
HideTooltip = function(self)
    self.child:Hide()
end
See Also:
self.overrideTooltip
self:ShowTooltip()
self:ACE_PROFILE_LOADED() updated 1.1
Called when a new profile is loaded.
()
Returns:
nil
Example:
ACE_PROFILE_LOADED = function(self)
    self:DoSomething()
end
Localized constants:
FuBarLocals.MAP_ONOFF = {[0]="|cffff0000Off|r",[1]="|cff00ff00On|r"}
Utility functions/constants:
FuBarUtils.COLOR_HEX_RED = "ff0000"
FuBarUtils.COLOR_HEX_ORANGE = "ff7f00"
FuBarUtils.COLOR_HEX_YELLOW = "ffff00"
FuBarUtils.COLOR_HEX_GREEN = "00ff00"
FuBarUtils.COLOR_HEX_WHITE = "ffffff"
FuBarUtils.COLOR_HEX_COPPER = "eda55f"
FuBarUtils.COLOR_HEX_SILVER = "c7c7cf"
FuBarUtils.COLOR_HEX_GOLD = "ffd700"
FuBarUtils.Colorize(hexColor, text)
Returns a colorized form of the given text.
Arguments:
(hexColor, text)
hexColor:
String - a hexadecimal color in the form of "RRGGBB".
text:
String - text to colorize.
Returns:
String - A colorized form of the given text.
Example:
self:SetText(FuBarUtils.Colorize(FuBarUtils.COLOR_HEX_GOLD, "Gold!")
FuBarUtils.Red(text)
Returns the given text colored red.
Arguments:
(text)
text:
String - text to colorize.
Returns:
String - The given text colored red.
Example:
self:SetText(FuBarUtils.Red("Red!")
FuBarUtils.Orange(text)
Returns the given text colored orange.
Arguments:
(text)
text:
String - text to colorize.
Returns:
String - The given text colored orange.
Example:
self:SetText(FuBarUtils.Orange("Orange!")
FuBarUtils.Yellow(text)
Returns the given text colored yellow.
Arguments:
(text)
text:
String - text to colorize.
Returns:
String - The given text colored yellow.
Example:
self:SetText(FuBarUtils.Yellow("Yellow!")
FuBarUtils.Green(text)
Returns the given text colored green.
Arguments:
(text)
text:
String - text to colorize.
Returns:
String - The given text colored green.
Example:
self:SetText(FuBarUtils.Green("Green!")
FuBarUtils.White(text)
Returns the given text colored white.
Arguments:
(text)
text:
String - text to colorize.
Returns:
String - The given text colored white.
Example:
self:SetText(FuBarUtils.White("White!")
FuBarUtils.GetThresholdHexColor(quality [, worst, worse, normal, better, best])
Returns a hexidecimal color calculated by the thresholds of the given quality.
Arguments:
(quality [, worst, rose, better, best])
quality:
Number - number to determine quality of.
worst:
Number - lowest threshold. If quality is below this, it will be colored red. If not given, 0.2 is assumed.
worse
Number - second-to-lowest threshold. If quality is below this, it will be colored red-orange. If not given, 0.4 is assumed.
normal:
Number - middle threshold. If quality is below this, it will be colored orange-yellow. If not given, 0.6 is assumed.
better:
Number - second-highest threshold. If quality is below this, it will be colored yellow-green.
best:
Number - highest threshold. If quality is below this, it will be colored yellowish-green. Anything above will be colored green. If not given, 1.0 is assumed.
Returns:
String - A hexidecimal color calculated by the thresholds of the given quality.
Remarks:
The thresholds do not have to be increasing, they can be decreasing.
The thresholds do not have to be linear, just in order.
See Also:
GetThresholdColor(quality [, worst, worse, better, best]) GetThresholdHexColorTrivial(quality [, worst, worse, better, best])
Example:
self:SetText(format("|cff%s%d%%|r", FuBarUtils.GetThresholdHexColor(percent), percent * 100))
FuBarUtils.GetThresholdColor(quality [, worst, worse, better, best])
Returns 3 unpacked percent values of color calculated by the thresholds of the given quality.
Arguments:
(quality [, worst, rose, better, best])
quality
Number - number to determine quality of.
worst:
Number - lowest threshold. If quality is below this, it will be colored red. If not given, 0.2 is assumed.
worse
Number - second-to-lowest threshold. If quality is below this, it will be colored red-orange. If not given, 0.4 is assumed.
normal:
Number - middle threshold. If quality is below this, it will be colored orange-yellow. If not given, 0.6 is assumed.
better:
Number - second-highest threshold. If quality is below this, it will be colored yellow-green.
best:
Number - highest threshold. If quality is below this, it will be colored yellowish-green. Anything above will be colored green. If not given, 1.0 is assumed.
Returns:
r, g, b
r:
Integer - A red value between 0 and 1
g:
Integer - A green value between 0 and 1
b:
Integer - A blue value between 0 and 1
Remarks:
The thresholds do not have to be increasing, they can be decreasing.
The thresholds do not have to be linear, just in order.
This is extremely handy in self.tooltip:AddLine(text [, r, g, b]) and self.tooltip:AddDoubleLine(text1, text2 [, r1, g1, b1] [, r2, g2, b2])
See Also:
GetThresholdHexColor(quality [, worst, worse, better, best]) GetThresholdColorTrivial(quality [, worst, worse, better, best]) self.tooltip:AddLine(text [, r, g, b]) self.tooltip:AddDoubleLine(text1, text2 [, r1, g1, b1] [, r2, g2, b2])
Example:
UpdateTooltip = function(self)
    ckknightTooltip:AddDoubleLine("Percent:", format("%d%%", self.data.percent), 1, 1, 0, FuBarUtils.GetThresholdColor(percent))
end
FuBarUtils.GetThresholdHexColorTrivial(quality [, worst, worse, normal, better, best]) added 0.4.12
Returns a hexidecimal color calculated by the thresholds of the given quality.
Arguments:
(quality [, worst, rose, better, best])
quality:
Number - number to determine quality of.
worst:
Number - lowest threshold. If quality is below this, it will be colored red. If not given, 0.2 is assumed.
worse
Number - second-to-lowest threshold. If quality is below this, it will be colored red-orange. If not given, 0.4 is assumed.
normal:
Number - middle threshold. If quality is below this, it will be colored orange-yellow. If not given, 0.6 is assumed.
better:
Number - second-highest threshold. If quality is below this, it will be colored yellow-green.
best:
Number - highest threshold. If quality is below this, it will be colored green. Anything above will be colored gray. If not given, 1.0 is assumed.
Returns:
String - A hexidecimal color calculated by the thresholds of the given quality.
Remarks:
The thresholds do not have to be increasing, they can be decreasing.
The thresholds do not have to be linear, just in order.
See Also:
GetThresholdColorTrivial(quality [, worst, worse, better, best]) GetThresholdHexColor(quality [, worst, worse, better, best])
Example:
self:SetText(format("|cff%s%d%%|r", FuBarUtils.GetThresholdHexColorTrivial(percent), percent * 100))
FuBarUtils.GetThresholdColorTrivial(quality [, worst, worse, better, best]) added 0.4.12
Returns 3 unpacked percent values of color calculated by the thresholds of the given quality.
Arguments:
(quality [, worst, rose, better, best])
quality
Number - number to determine quality of.
worst:
Number - lowest threshold. If quality is below this, it will be colored red. If not given, 0.2 is assumed.
worse
Number - second-to-lowest threshold. If quality is below this, it will be colored red-orange. If not given, 0.4 is assumed.
normal:
Number - middle threshold. If quality is below this, it will be colored orange-yellow. If not given, 0.6 is assumed.
better:
Number - second-highest threshold. If quality is below this, it will be colored yellow-green.
best:
Number - highest threshold. If quality is below this, it will be colored green-gray. Anything above will be colored gray. If not given, 1.0 is assumed.
Returns:
r, g, b
r:
Integer - A red value between 0 and 1
g:
Integer - A green value between 0 and 1
b:
Integer - A blue value between 0 and 1
Remarks:
The thresholds do not have to be increasing, they can be decreasing.
The thresholds do not have to be linear, just in order.
This is extremely handy in self.tooltip:AddLine(text [, r, g, b]) and self.tooltip:AddDoubleLine(text1, text2 [, r1, g1, b1] [, r2, g2, b2])
See Also:
GetThresholdHexColorTrivial(quality [, worst, worse, better, best]) GetThresholdColor(quality [, worst, worse, better, best]) self.tooltip:AddLine(text [, r, g, b]) self.tooltip:AddDoubleLine(text1, text2 [, r1, g1, b1] [, r2, g2, b2])
Example:
UpdateTooltip = function(self)
    ckknightTooltip:AddDoubleLine("Percent:", format("%d%%", self.data.percent), 1, 1, 0, FuBarUtils.GetThresholdColorTrivial(percent))
end
FuBarUtils.AddSpacerDropDownMenu()
Adds a spacer to the current dropdown menu.
Arguments:
()
Returns:
nil
Example:
MenuSettings = function(self, level, value)
    ...
    FuBarUtils.AddSpacerDropDownMenu()
    ...
end
FuBarUtils.FormatMoneyExtended(copper [, colorize [, textColor]]) added 1.1
Returns a colored (or not) string showing the amount of gold, silver, and copper
Arguments:
(copper [, colorize [, textColor]])
copper:
Integer - amount of copper. 100 means 1 silver, 10000 means 1 gold.
colorize:
Boolean -
true - Colorizes the text.
false (default) - keeps the text plain.
textColor:
Boolean -
true - Colorizes the numbers in the text.
false (default) - keeps the numbers plain.
Returns:
String - A colored string showing the amount of gold, silver, and copper. It will be in the form of ## Gold ## Silver ## Copper. The numbers will be white (or red if negative) and the labels (Gold, Silver, Copper) will be their associated colors.
Example:
assert(FuBarUtils.FormatMoney(10101) == "1 Gold 1 Silver 1 Copper")
FuBarUtils.FormatMoneyFull(copper [, colorize [, textColor]]) updated 1.1
Returns a colored (or not) string showing the amount of gold, silver, and copper
Arguments:
(copper [, colorize [, textColor]])
copper:
Integer - amount of copper. 100 means 1 silver, 10000 means 1 gold.
colorize:
Boolean -
true - Colorizes the text.
false (default) - keeps the text plain.
textColor:
Boolean -
true - Colorizes the numbers in the text.
false (default) - keeps the numbers plain.
Returns:
String - A colored string showing the amount of gold, silver, and copper. It will be in the form of either ##g ##s ##c, ##s ##c, or ##c. The numbers will be white (or red if negative) and the labels (g, s, and c) will be their associated colors.
Example:
assert(FuBarUtils.FormatMoney(10101) == "1g 1s 1c")
FuBarUtils.FormatMoneyShort(copper [, colorize [, textColor]]) updated 1.1
Returns a colored (or not) string showing the amount of money given.
Arguments:
(copper [, colorize [, textColor]])
copper:
Integer - amount of copper. 100 means 1 silver, 10000 means 1 gold.
colorize:
Boolean -
true - Colorizes the text.
false (default) - keeps the text plain.
Returns:
String - A colored string showing the amount of money given. It will be in the form of either #.#g, #.#s, or #.#c. The numbers will be white (or red if negative) and the labels (g, s, and c) will be their associated colors.
Example:
assert(FuBarUtils_FormatMoneyShort(10101) == "1.0g")
FuBarUtils.FormatMoneyCondensed(copper [, colorize]) updated 1.1
Returns a colored (or not) string showing the amount of money given in a condensed format.
Arguments:
(copper [, colorize [, textColor]])
copper:
Integer - amount of copper. 100 means 1 silver, 10000 means 1 gold.
colorize:
Boolean -
true - Colorizes the text.
false (default) - keeps the text plain.
textColor:
Boolean -
true - Colorizes the parentheses around your text, if negative.
false (default) - keeps the parentheses plain.
Returns:
String - A colored string showing the amount of money given. It will be in the form of either #.##.##, #.##, or #. The numbers will be their associated colors (gold, silver, and copper). If negative, it will show -(#.##.##)
Example:
assert(FuBarUtils_FormatMoneyShort(10101) == "1.01.01")
FuBarUtils.FormatDurationExtended(seconds [, colorize] [, hideSeconds]) added 1.1
Returns a colored (or not) string showing the amount of days, hours, minutes, and seconds.
Arguments:
(seconds [, colorize])
seconds:
Integer - amount of seconds.
colorize
Boolean -
true - Colorizes the text.
false (default) - keeps the text plain.
hideSeconds
Boolean -
true - Don't show seconds.
false (default) - Show seconds.
textColor:
Boolean -
true - Colorizes the numbers in the text.
false (default) - keeps the numbers plain.
Returns:
String - Aa colored string showing the amount of days, hours, minutes, and seconds It will be in the form of ## Days ## Hrs ## Mins ## Secs. The numbers will be white and the labels will be the normal yellow.
Example:
assert(FuBarUtils.FormatDurationFull(98765) == "1 Day 3 Hours 26 Mins 05 Secs")
FuBarUtils.FormatDurationFull(seconds [, colorize] [, hideSeconds]) pre-0.3.1: FuBarUtils.GetFullDurationText(seconds [, colorize])
Returns a colored (or not) string showing the amount of days, hours, minutes, and seconds.
Arguments:
(seconds [, colorize])
seconds:
Integer - amount of seconds.
colorize
Boolean -
true - Colorizes the text.
false (default) - keeps the text plain.
hideSeconds
Boolean -
true - Don't show seconds.
false (default) - Show seconds.
textColor:
Boolean -
true - Colorizes the numbers in the text.
false (default) - keeps the numbers plain.
Returns:
String - Aa colored string showing the amount of days, hours, minutes, and seconds It will be in the form of either ##d ##h ##m ##s, ##h ##m ##s, ##m ##s, ##s. The numbers will be white and the labels will be the normal yellow.
Example:
assert(FuBarUtils.FormatDurationFull(98765) == "1d 03h 26m 05s")
FuBarUtils.FormatDurationShort(seconds [, colorize] [, hideSeconds]) pre-0.3.1: FuBarUtils.GetShortDurationText(seconds [, colorize])
Returns a colored (or not) string showing the amount of time given.
Arguments:
(seconds [, colorize])
seconds:
Integer - amount of seconds.
colorize
Boolean -
true - Colorizes the text.
false (default) - keeps the text plain.
hideSeconds
Boolean -
true - Don't show seconds.
false (default) - Show seconds.
Returns:
String - A colored (or not) string showing the amount of time given. It will be in the form of either ## days, ## hours, ## mins, or ## secs. The nubmers will be white and the labels will be the normal yellow.
Example:
assert(FuBarUtils.FormatDurationShort(98765) == "27.4 hours")
FuBarUtils.FormatDurationCondensed(seconds [, colorize] [, hideSeconds]) added 0.3.1
Returns a colored (or not) string showing the amount of time given.
Arguments:
(seconds [, colorize])
seconds:
Integer - amount of seconds.
colorize
Boolean -
true - Colorizes the text.
false (default) - keeps the text plain.
hideSeconds
Boolean -
true - Don't show seconds.
false (default) - Show seconds.
Returns:
String - A colored (or not) string showing the amount of time given. It will be in the form of either #:##:##:##, #:##:##, or #:##. The nubmers will be white and the labels will be the normal yellow.
Example:
assert(FuBarUtils.FormatDurationShort(98765) == "1:03:26:05")
FuBarUtils.VersionToNumber(version) added 0.4.7
Returns a numeric representation of the version given.
Arguments:
(version)
version:
String - version given in the form of "Major.Minor.Revision.Trivial".
Remarks:
If version is nil, then this will return 0.
Returns:
Number - A numeric representation of the version given.
Example:
assert(FuBarUtils.VersionToNumber("1.2.3.4") == 10203.0004)
assert(FuBarUtils.VersionToNumber("1.2.3") == 10203)
assert(FuBarUtils.VersionToNumber("1.2") == 10200)
assert(FuBarUtils.VersionToNumber("0.4.6") == 406)
FuBarUtils.GetVersionPoint(version, point) added 0.4.7
Returns a point within a version.
Arguments:
(version, point)
version:
String - version given in the form of "Major.Minor.Revision.Trivial".
point:
Integer - placement of the point to retrieve.
Returns:
Integer - A point within the given version.
Example:
assert(FuBarUtils.GetVersionPoint("1.3.5.7", 1) == 1)
assert(FuBarUtils.GetVersionPoint("1.3.5.7", 2) == 3)
assert(FuBarUtils.GetVersionPoint("1.3.5.7", 3) == 5)
assert(FuBarUtils.GetVersionPoint("1.3.5.7", 4) == 7)
assert(FuBarUtils.GetVersionPoint("1.3.5", 4) == 0)
FuBarUtils.GetMajorNumber(version) added 0.4.7
Returns the major number of a version.
Arguments:
(version)
version:
String - version given in the form of "Major.Minor.Revision.Trivial".
Returns:
Integer - the major number of the given version.
Example:
assert(FuBarUtils.GetMajorNumber("1.2.3.4") == 1)
assert(FuBarUtils.GetMajorNumber("0.4.7") == 0)
FuBarUtils.GetMinorNumber(version) added 0.4.7
Returns the minor number of a version.
Arguments:
(version)
version:
String - version given in the form of "Major.Minor.Revision.Trivial".
Returns:
Integer - the minor number of the given version.
Example:
assert(FuBarUtils.GetMinorNumber("1.2.3.4") == 2)
assert(FuBarUtils.GetMinorNumber("0.4.7") == 4)
FuBarUtils.GetRevisionNumber(version) added 0.4.7
Returns the revision number of a version.
Arguments:
(version)
version:
String - version given in the form of "Major.Minor.Revision.Trivial".
Returns:
Integer - the revision number of the given version.
Example:
assert(FuBarUtils.GetRevisionNumber("1.2.3.4") == 3)
assert(FuBarUtils.GetRevisionNumber("0.4.7") == 7)
FuBarUtils.GetTrivialNumber(version) added 0.4.7
Returns the trivial number of a version.
Arguments:
(version)
version:
String - version given in the form of "Major.Minor.Revision.Trivial".
Returns:
Integer - the trivial number of the given version.
Example:
assert(FuBarUtils.GetTrivialNumber("1.2.3.4") == 4)
assert(FuBarUtils.GetTrivialNumber("0.4.7") == 0)
FuBarUtils.Deformat("text", "pattern") DEPRECATED
This function has been deprecated. Instead, use BabbleLib:GetInstance("1.0").Deformat("text", "pattern")
Returns the variables which would be fed into string.format("pattern", ...)
Arguments:
("text", "pattern")
"text":
String - outputted text from a string.format("pattern", ...)
"pattern":
String - pattern within string.format("pattern", ...)
Returns:
alpha, bravo, charlie, delta, echo, foxtrot, golf, hotel, india 9 possible strings (or nils) that went into string.format("pattern", alpha, bravo, charlie, delta, echo, foxtrot, golf, hotel, india)
Remarks:
This will not work on every single pattern, but it should work on all patterns within Blizzard's GlobalStrings.lua, even the ones that have mismatched patterns, such as "%2$d / %1$d"
Example:
local value, max = FuBarUtils.Deformat(text, DURABILITY_TEMPLATE)
FuBarUtils.LocalizedClassToEnglish("class") DEPRECATED
This function has been deprecated. Instead, use BabbleLib:GetInstance("1.0").GetEnglishClass("class")
Returns a capitalized English string of a given class.
Arguments:
("class")
"class":
String - Localized class
Returns:
String - capitalized English string of the given class, or the string back if not found.
Remarks:
This only works on your own culture, and if an incorrect string is fed in, the string you gave is returned.
Example:
assert(FuBarUtils.LocalizedClassToEnglish("Warlock") == "WARLOCK")
-- now assume deDE
assert(FuBarUtils.LocalizedClassToEnglish("Hexenmeister") == "WARLOCK")
FuBarUtils.EnglishClassToLocalized("class") DEPRECATED
This function has been deprecated. Instead, use BabbleLib:GetInstance("1.0").GetLocalizedClass("class")
Returns a localized string of a given class.
Arguments:
("class")
"class":
String - capitalized English class
Returns:
String - localized class or the same class back
Example:
assert(FuBarUtils.EnglishClassToLocalized("WARLOCK") == "Warlock")
-- now assume deDE
assert(FuBarUtils.EnglishClassToLocalized("WARLOCK") == "Hexenmeister")
FuBarUtils.GetColorByClass("class") DEPRECATED
This function has been deprecated. Instead, use BabbleLib:GetInstance("1.0").GetClassColor("class")
Returns the r, g, b values for a certain class.
Arguments:
("class")
"class":
String - Localized class, e.g. "Warlock" or capitalized English class, e.g. "WARLOCK".
Returns:
r - Number between 0 and 1 of the red value
g - Number between 0 and 1 of the green value
b - Number between 0 and 1 of the blue value
Remarks:
If a color can't be found black (0, 0, 0) is returned.
Example:
text:SetTextColor(FuBarUtils.GetColorByClass(UnitClass("target")))
FuBarUtils.GetHexColorByClass("class") DEPRECATED
This function has been deprecated. Instead, use BabbleLib:GetInstance("1.0").GetClassHexColor("class")
Returns the rrggbb hex values for a certain class.
Arguments:
("class")
"class":
String - Localized class, e.g. "Warlock" or capitalized English class, e.g. "WARLOCK".
Returns:
String - rrggbb hex values.
Remarks:
If a color can't be found black (000000) is returned.
Example:
local color = FuBarUtils.GetColorByClass(UnitClass("target"))
text:SetText(format("|cff%sdata|r", color)
FuBarUtils.LocalizedZoneToEnglish("zone") DEPRECATED
This function has been deprecated. Instead, use BabbleLib:GetInstance("1.0").GetEnglishZone("zone")
Returns a capitalized English string of a given zone.
Arguments:
("zone")
"zone":
String - Localized zone
Returns:
String - capitalized English string of the given zone, or the string back if not found.
Remarks:
This only works on your own culture, and if an incorrect string is fed in, the string you gave is returned.
Example:
assert(FuBarUtils.LocalizedClassToEnglish("The Barrens") == "BARRENS")
-- now assume deDE
assert(FuBarUtils.LocalizedClassToEnglish("Das Brachland") == "BARRENS")
FuBarUtils.EnglishZoneToLocalized("zone") DEPRECATED
This function has been deprecated. Instead, use BabbleLib:GetInstance("1.0").GetLocalizedZone("zone")
Returns a localized string of a given zone.
Arguments:
("zone")
"zone":
String - capitalized English zone
Returns:
String - localized zone or the same zone back
Example:
assert(FuBarUtils.EnglishClassToLocalized("BARRENS") == "The Barrens")
-- now assume deDE
assert(FuBarUtils.EnglishClassToLocalized("BARRENS") == "Das Brachland")
Other:
FuBar:RegisterSkin("name", "file") added 1.1
Adds a background skin to FuBar.
Arguments:
("name", "file")
"name"
Name of your background skin.
"file"
File path to your background skin
Returns:
nil
Remarks:
If a skin with the same file is added, it keeps the old name.
Backgrounds are a 256x256 file, either tga or blp. The top half should be considered what you'd see at the bottom of your screen, and vice versa.
It wraps horizontally, and you should not worry about it wrapping vertically.
Example:
FuBar:RegisterSkin("My skin", "Interface\\AddOns\\Myskin\\background.tga")
FuBar:CreateBasicPluginFrame("name") added 0.9.5
Returns a frame set up and ready to customize.
Arguments:
("name")
"name"
String - name of the frame
Returns:
Frame - a frame with the basic scripts to be considered a plugin frame.
Example:
self.frame = FuBar:CreateBasicPluginFrame("FuBar_MyPluginFrame"0
FUBAR_DEFAULTS added 1.0
Handles the default settings of FuBar, had it not been loaded before.
Remarks:
This should only be set for compilations or whatnot.
The table this should be set to should resemble your saved variables. Likely you can copy-paste from `FuBarDB.profiles.default.
FUBAR_DEFAULTS can either be a table or a function which returns a table.
Example:
FUBAR_DEFAULTS = {
    fontSize = 16,
    panels = {
        [1] = {
            "LocationFu"
        }
    }
}
-- this would set your default font size to 16, and have 1 panel, with only LocationFu's position set.
FUBAR_DEFAULTS_<CLASS> added 1.0
Handles the default settings of FuBar, had it not been loaded before, specific to a specified class.
Remarks:
This is the same as FUBAR_DEFAULTS, except that it is loaded on class-specific and char-specific profiles, to the specified class.
The name is not actually FUBAR_DEFAULTS_<CLASS>, it is one of the following 9: FUBAR_DEFAULTS_MAGE, FUBAR_DEFAULTS_WARLOCK, FUBAR_DEFAULTS_DRUID, FUBAR_DEFAULTS_SHAMAN, FUBAR_DEFAULTS_PALADIN, FUBAR_DEFUALTS_PRIEST, FUBAR_DEFAULTS_WARRIOR, FUBAR_DEFAULTS_ROGUE, or FUBAR_DEFAULTS_HUNTER.
It is highly recommended that you either check the class before setting these, or to use a function which returns a table (thus saving memory usage).