Add Pet XP Bar #28


  • Declined
  • Patch
Closed
Assigned to nevcairiel
  • Xit_Draka created this issue Oct 25, 2008

    It's real easy to do:
    RepXPBar.lua - Add this code:
    -- register module
    local PetXPBarMod = Bartender4:NewModule("PetXPBar")

    -- create prototype information
    local PetXPBar = setmetatable({}, {__index = Bar})

    function PetXPBarMod:OnInitialize()
        self.db = Bartender4.db:RegisterNamespace("PetXPBar", defaults)
        self:SetEnabledState(self.db.profile.enabled)
    end

    function PetXPBarMod:OnEnable()
        if not self.bar then
            self.bar = setmetatable(Bartender4.Bar:Create("PetXP", self.db.profile, L["PetXP Bar"]), {__index = PetXPBar})
            self.bar.content= PetPaperDollFrameExpBar

            self.bar.content:SetParent(self.bar)
            self.bar.content:Show()
            self.bar.content:SetFrameLevel(self.bar:GetFrameLevel() + 1)

            -- TODO: real start position
            self.bar:SetPoint("CENTER")
        end
        self.bar:Enable()
        self:ToggleOptions()
        self.bar:ApplyConfig(self.db.profile)
    end

    PetXPBarMod.ApplyConfig = RepBarMod.ApplyConfig
    PetXPBar.ApplyConfig = RepBar.ApplyConfig
    PetXPBar.PerformLayout = RepBar.PerformLayout

    In Options directory:
    RepXPBar.lua - Add this code:
    local PetXPBarMod = Bartender4:GetModule("PetXPBar")

    function PetXPBarMod:SetupOptions()
        if not self.options then
            self.optionobject = Bar:GetOptionObject()
            local enabled = {
                type = "toggle",
                order = 1,
                name = L["Enabled"],
                desc = L["Enable the PetXP Bar"],
                get = function() return self.db.profile.enabled end,
                set = "ToggleModule",
                handler = self,
            }
            self.optionobject:AddElement("general", "enabled", enabled)

            self.disabledoptions = {
                general = {
                    type = "group",
                    name = L["General Settings"],
                    cmdInline = true,
                    order = 1,
                    args = {
                        enabled = enabled,
                    }
                }
            }
            self.options = {
                order = 101,
                type = "group",
                name = L["PetXP Bar"],
                desc = L["Configure the PetXP Bar"],
                childGroups = "tab",
            }
            Bartender4:RegisterBarOptions("PetXP", self.options)
        end
        self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
    end

    In locale directory:
    enUS.lua - Add entries:
    L["Configure the PetXP Bar"] = true
    L["Enable the PetXP Bar"] = true
    L["PetXP Bar"] = true

    --
    Hodor, Draka.

  • Xit_Draka added the tags New Patch Oct 25, 2008
  • Xit_Draka removed a tag Defect Oct 26, 2008
  • Xit_Draka added a tag Patch Oct 26, 2008
  • nevcairiel posted a comment Oct 28, 2008

    Is the Pet XP Bar something thats usually displayed in the BottomBar Cluster? I don't think it is, thats why BT4 won't touch it.

  • nevcairiel removed a tag New Oct 28, 2008
  • nevcairiel added a tag Declined Oct 28, 2008
  • nevcairiel closed issue Oct 28, 2008
  • Xit_Draka posted a comment Nov 8, 2008

    Ahh, I see. Guess I'll patch it in on my own then (and again after every release.)


To post a comment, please login or register a new account.