diff --git a/.pkgmeta b/.pkgmeta
index 9f85109..fedd3d5 100644
--- a/.pkgmeta
+++ b/.pkgmeta
@@ -2,7 +2,9 @@ package-as: RepHub
externals:
Libs/LibStub: https://repos.wowace.com/wow/libstub/trunk
+ Libs/LibDataBroker-1.1: https://github.com/tekkub/libdatabroker-1-1
Libs/AceAddon-3.0: https://repos.curseforge.com/wow/ace3/trunk/AceAddon-3.0
Libs/AceDB-3.0: https://repos.curseforge.com/wow/ace3/trunk/AceDB-3.0
+ Libs/AceGUI-3.0: https://repos.curseforge.com/wow/ace3/trunk/AceGUI-3.0
Libs/LibDBIcon-1.0: https://repos.curseforge.com/wow/libdbicon-1-0/trunk/LibDBIcon-1.0
- Libs/LibDataBroker-1.1: https://github.com/tekkub/libdatabroker-1-1
\ No newline at end of file
+ Libs/lib-st: https://repos.wowace.com/wow/lib-st/trunk
\ No newline at end of file
diff --git a/embeds.xml b/Libs.xml
similarity index 80%
rename from embeds.xml
rename to Libs.xml
index e95c67e..eeb6208 100755
--- a/embeds.xml
+++ b/Libs.xml
@@ -4,5 +4,7 @@
+
+
diff --git a/RepHub.lua b/RepHub.lua
index 359fdb6..407ca47 100755
--- a/RepHub.lua
+++ b/RepHub.lua
@@ -1,34 +1,108 @@
-local RepHub = LibStub("AceAddon-3.0"):NewAddon("RepHub")
-local RepHubLDB = LibStub("LibDataBroker-1.1"):NewDataObject("RepHub", {
- type = "data source",
- text = "RepHub",
- icon = "Interface\\Icons\\Achievement_Reputation_01",
- OnTooltipShow = function(tooltip)
- tooltip:AddLine("RepHub")
-
- local numFactions = C_Reputation.GetNumFactions()
- local factionIndex = 1
- while (factionIndex <= numFactions) do
- local factionData = C_Reputation.GetFactionDataByIndex(factionIndex)
- if factionData.isHeader then
- tooltip:AddLine(factionData.name)
- else
- tooltip:AddLine("-- " .. factionData.name .. " - " .. factionData.currentStanding)
- end
- factionIndex = factionIndex + 1
- end
+local RepHub = LibStub("AceAddon-3.0"):NewAddon("RepHub")
+local AceGUI = LibStub("AceGUI-3.0")
+local RepHubLDB = LibStub("LibDataBroker-1.1"):NewDataObject("RepHub", {
+ type = "data source",
+ text = "RepHub",
+ icon = "Interface\\Icons\\Achievement_Reputation_01",
+ OnTooltipShow = function(tooltip)
+ tooltip:AddLine("Click to show RepHub")
+ end,
+ OnClick = function()
+ RepHub:ShowRepHubFrame()
end,
-})
-local icon = LibStub("LibDBIcon-1.0")
+})
+local LibDBIcon = LibStub("LibDBIcon-1.0")
+local RepHubFrameShown = false
function RepHub:OnInitialize()
-- Assuming you have a ## SavedVariables: RepHubDB line in your TOC
- self.db = LibStub("AceDB-3.0"):New("RepHubDB", {
- profile = {
- minimap = {
- hide = false,
- },
- },
- })
- icon:Register("RepHub", RepHubLDB, self.db.profile.minimap)
+ self.db = LibStub("AceDB-3.0"):New("RepHubDB", {
+ profile = {
+ minimap = {
+ hide = false,
+ },
+ },
+ global = {
+ ReputationList = {},
+ },
+ })
+ LibDBIcon:Register("RepHub", RepHubLDB, self.db.profile.minimap)
+ RepHub:RefreshReputationGlobalDB()
+end
+
+function RepHub:RefreshReputationGlobalDB()
+ local characterName = UnitName("player")
+
+ local currentGroup = nil
+
+ local numFactions = C_Reputation.GetNumFactions()
+ local factionIndex = 1
+ while (factionIndex <= numFactions) do
+ local factionData = C_Reputation.GetFactionDataByIndex(factionIndex)
+ if factionData.isHeader then
+ currentGroup = factionData.name
+
+ if factionData.isCollapsed then
+ C_Reputation.ExpandFactionHeader(factionIndex)
+ numFactions = C_Reputation.GetNumFactions()
+ end
+ end
+ if self.db.global.ReputationList[factionData.factionID] == nil then
+ self.db.global.ReputationList[factionData.factionID] = factionData
+ self.db.global.ReputationList[factionData.factionID].currentGroup = currentGroup
+ self.db.global.ReputationList[factionData.factionID].highestStanding = factionData.currentStanding
+ self.db.global.ReputationList[factionData.factionID].highestStandingCharacterName = characterName
+ elseif self.db.global.ReputationList[factionData.factionID].highestStanding < factionData.currentStanding and not factionData.isAccountWide then
+ self.db.global.ReputationList[factionData.factionID].highestStanding = factionData.currentStanding
+ self.db.global.ReputationList[factionData.factionID].highestStandingCharacterName = characterName
+ end
+ factionIndex = factionIndex + 1
+ end
+end
+
+function RepHub:ShowRepHubFrame()
+ if RepHubFrameShown then
+ return
+ end
+
+ local RepHubFrame = AceGUI:Create("Frame")
+ RepHubFrame:SetTitle("RepHub")
+ RepHubFrame:SetStatusText("RepHub is a simple account-wide reputation tracker")
+ RepHubFrame:SetCallback(
+ "OnClose",
+ function(widget)
+ AceGUI:Release(widget)
+ RepHubFrameShown = false
+ end
+ )
+
+ local columnsArr = {
+ { ["name"] = "Rep Name", ["width"] = 205, },
+ { ["name"] = "Group", ["width"] = 205, },
+ { ["name"] = "Highest Standing", ["width"] = 205, },
+ }
+ local dataArr = {}
+
+ local characterName = UnitName("player")
+
+ table.foreach(
+ self.db.global.ReputationList,
+ function(factionID, factionData)
+ if not factionData.isHeader then
+ local highestStandingText = ""
+ if factionData.isAccountWide then
+ highestStandingText = "Account-wide"
+ else
+ highestStandingText = factionData.highestStanding .. " (" .. factionData.highestStandingCharacterName .. ")"
+ end
+ table.insert(dataArr, {factionData.name, factionData.currentGroup, highestStandingText })
+ end
+ end
+ )
+
+ local ScrollingTable = LibStub("ScrollingTable")
+ local Table = ScrollingTable:CreateST(columnsArr, 27, nil, nil, RepHubFrame.frame)
+ Table:SetData(dataArr, true)
+
+ RepHubFrameShown = true
end
\ No newline at end of file
diff --git a/RepHub.toc b/RepHub.toc
index 00c9ee7..f95cb89 100755
--- a/RepHub.toc
+++ b/RepHub.toc
@@ -1,9 +1,9 @@
## Interface: 110002
## Title: RepHub
-## Description: RepHub is an account-wide reputation tracker for World of Warcraft.
+## Description: RepHub is a simple account-wide reputation tracker
## Author: Alwayspizza
## SavedVariables: RepHubDB
## X-Curse-Project-ID: 1094884
-embeds.xml
+Libs.xml
Rephub.lua
\ No newline at end of file