LibStatsPane-1.0

Warning: This project is experimental. Its files will not synchronize across the CurseForge network.

LibStatsPane-1.0 is a library to assist in adding custom data in the new character stats pane in 4.0.

Usage example, with results show in image:

local StatsPane = LibStub("LibStatsPane-1.0")

local function test(statFrame, unit)
  PaperDollFrame_SetLabelAndText(statFrame, "Hello", 3.33)
  statFrame.tooltip = HIGHLIGHT_FONT_COLOR_CODE.."Test is the tooltip title"..FONT_COLOR_CODE_CLOSE
  statFrame.tooltip2 = "Tooltip lines"
  statFrame:Show()
end

local function test2(statFrame, label, value, ispercent, tip1, tip2)
  PaperDollFrame_SetLabelAndText(statFrame, label, value, ispercent)
  statFrame.tooltip = HIGHLIGHT_FONT_COLOR_CODE..tip1..FONT_COLOR_CODE_CLOSE
  statFrame.tooltip2 = tip2
  -- custom scripts
  statFrame:SetScript("OnMouseDown", function(self, button) print("ClickEvent: ", button) end)
  statFrame:Show()
end

local pane = {
  -- Category: string
  -- * indexes PAPERDOLL_STATCATEGORIES[categoryFrame.Category], needs to be a globally unique key
  -- * also used for the display title, set to _G["STAT_CATEGORY_"..categoryFrame.Category]
  Category = "Stat Modifiers", -- string
  StatInfo = {
    {
      -- id: string
      -- * indexes PAPERDOLL_STATINFO[stat], needs to be a globally unique key
      id = "MyAddon_Stat1",
      -- updateFunc: function
      -- * takes 2 arguments, the statFrame frame and the unit string
      updateFunc = test,
    },
    {
      id = "MyAddon_Stat2",
      updateFunc = function(statFrame, unit)
        test2(statFrame, "Hello2", 6.66, 1, "Test is the tooltip title2", "Tooltip lines2")
      end,
    },
  },
}
StatsPane:AddPane(pane)

Comments

Posts Quoted:
Reply
Clear All Quotes

About This Project

Categories

Members

Recent Files

WoW Retail

  • r3
    Oct 9, 2010
  • r4
    Apr 26, 2011