diff --git a/Elements/friends.lua b/Elements/friends.lua index b32bc88..4c182c7 100644 --- a/Elements/friends.lua +++ b/Elements/friends.lua @@ -187,7 +187,7 @@ local function OnInit() SLDT.Friends:Enable() end -if ( IsAddOnLoaded("SLDataText") ) then +if ( C_AddOns.IsAddOnLoaded("SLDataText") ) then SLDT.Friends:RegisterEvent("PLAYER_ENTERING_WORLD") SLDT.Friends:SetScript("OnEvent", OnInit) end diff --git a/Elements/guild.lua b/Elements/guild.lua index 8e9b3d3..00b4fbe 100644 --- a/Elements/guild.lua +++ b/Elements/guild.lua @@ -192,7 +192,7 @@ local function OnInit() SLDT.Guild:Enable() end -if ( IsAddOnLoaded("SLDataText") ) then +if ( C_AddOns.IsAddOnLoaded("SLDataText") ) then SLDT.Guild:RegisterEvent("PLAYER_ENTERING_WORLD") SLDT.Guild:SetScript("OnEvent", OnInit) end diff --git a/Elements/memory.lua b/Elements/memory.lua index e33e94f..3ccd7f5 100644 --- a/Elements/memory.lua +++ b/Elements/memory.lua @@ -12,10 +12,10 @@ local function SetupToolTip() GameTooltip:SetOwner(this, db.aF) UpdateAddOnMemoryUsage() local addons, total = {}, 0 - for i = 1, GetNumAddOns() do - if ( IsAddOnLoaded(i) ) then - local memUse = GetAddOnMemoryUsage(i) - table.insert(addons, { GetAddOnInfo(i), memUse }) + for i = 1, C_AddOns.GetNumAddOns() do + if ( C_AddOns.IsAddOnLoaded(i) ) then + local memUse = C_AddOns.GetAddOnMemoryUsage(i) + table.insert(addons, { C_AddOns.GetAddOnInfo(i), memUse }) total = total + memUse end end @@ -77,8 +77,8 @@ end local tags = { ["MA"] = function() local total = 0 - for i = 1, GetNumAddOns() do - if ( IsAddOnLoaded(i) ) then total = total + GetAddOnMemoryUsage(i) end + for i = 1, C_AddOns.GetNumAddOns() do + if ( C_AddOns.IsAddOnLoaded(i) ) then total = total + GetAddOnMemoryUsage(i) end end return string.format("|cffffffff%.1f|r|cff%s", total/1024, SLDT.db.profile.cCol and SLDT.classColor or "ffffff") end, diff --git a/Elements/reputation.lua b/Elements/reputation.lua index 76338d3..a87a06e 100644 --- a/Elements/reputation.lua +++ b/Elements/reputation.lua @@ -8,18 +8,6 @@ if ( SLDT ) then SLDT.Reputation = CreateFrame("Frame") end local L = SLDT.Locale local db, frame, text, tool, tip, noWatch -local standingTbl = { - [1] = L["Hated"], - [2] = L["Hostile"], - [3] = L["Unfriendly"], - [4] = L["Neutral"], - [5] = L["Friendly"], - [6] = L["Honored"], - [7] = L["Revered"], - [8] = L["Exalted"], - [9] = L["Paragon"], -} - local stdCol = { [1] = { r = 0.8, g = 0.3, b = 0.22 }, [2] = { r = 0.8, g = 0.3, b = 0.22 }, @@ -38,7 +26,7 @@ local function SetupToolTip() tip = SLT:GetTooltip("SLDT_Reputation", false) SLT:AddHeader("SLDT_Reputation", repTbl[1], repTbl[2], { 1, 1, 1 }) - SLT:AddDoubleLine("SLDT_Reputation", standingTbl[repTbl[3]], string.format("%i/%i", repTbl[6]-repTbl[4], repTbl[5]-repTbl[4]), { stdCol[repTbl[3]].r, stdCol[repTbl[3]].g, stdCol[repTbl[3]].b }, nil) + SLT:AddDoubleLine("SLDT_Reputation", repTbl[7], string.format("%i/%i", repTbl[6]-repTbl[4], repTbl[5]-repTbl[4]), { stdCol[repTbl[3]].r, stdCol[repTbl[3]].g, stdCol[repTbl[3]].b }, nil) if ( not InCombatLockdown() ) then SLT:ShowTooltip("SLDT_Reputation", frame) end end @@ -75,7 +63,7 @@ end local repCheckTimer = function() SLDT.Reputation:SetScript("OnUpdate", function(self, elapsed) - if ( GetNumFactions() > 0 ) then + if ( C_Reputation.GetNumFactions() > 0 ) then self:SetScript("OnUpdate", nil) self:Refresh() end @@ -85,20 +73,58 @@ end function SLDT.Reputation:Refresh() if ( db.enabled or SLDataText.db.profile.configMode ) then if ( not self.firstRun ) then self.firstRun = true; SLDT:UpdateBaseText(self, db) end - if ( GetNumFactions() == 0 ) then repCheckTimer(); return end + if ( C_Reputation.GetNumFactions() == 0 ) then repCheckTimer(); return end noWatch = true SLDT.Reputation.repTbl = {} - for i = 1, GetNumFactions() do - local name, desc, sID, barMin, barMax, barVal, _, _, isHeader, _, hasRep, isWatched, _ = GetFactionInfo(i) - if ( not isHeader ) then - if ( isWatched ) then - -- Store for tooltip use - SLDT.Reputation.repTbl = { name, desc, sID, barMin, barMax, barVal } + for i = 1, C_Reputation.GetNumFactions() do + local factionData = C_Reputation.GetFactionDataByIndex(i) + if ( not factionData.isHeader ) then + if ( factionData.isWatched ) then + local minRep = factionData.currentReactionThreshold + local maxRep = factionData.nextReactionThreshold + local currentRep = factionData.currentStanding + local factionStandingLabel = _G["FACTION_STANDING_LABEL" .. factionData.reaction] + + local renownReputationData = C_MajorFactions.GetMajorFactionData(factionData.factionID) + local currentRepParagon, maxRepParagon = C_Reputation.GetFactionParagonInfo(factionData.factionID) + local friendshipReputationInfo = C_GossipInfo.GetFriendshipReputation(factionData.factionID) - local repPer = (100/(barMax-barMin))*(barVal-barMin) - text:SetFormattedText("|cff%s%s:|r %.0f%%", SLDT.db.profile.cCol and SLDT.classColor or "ffffff", name, repPer) - text:SetTextColor(stdCol[sID].r, stdCol[sID].g, stdCol[sID].b) + + if renownReputationData ~= nil then --Renown + minRep = 0 + maxRep = renownReputationData.renownLevelThreshold + currentRep = renownReputationData.renownReputationEarned + factionStandingLabel = "Renown " .. renownReputationData.renownLevel + + if currentRepParagon ~= nil then --Renown + Paragon + maxRep = maxRepParagon + currentRep = currentRepParagon % maxRepParagon + factionStandingLabel = factionStandingLabel .. " + Paragon" + end + elseif currentRepParagon ~= nil then --Paragon + minRep = 0 + maxRep = maxRepParagon + currentRep = currentRepParagon % maxRepParagon + factionStandingLabel = "Paragon" + elseif friendshipReputationInfo and friendshipReputationInfo.friendshipFactionID == factionData.factionID then --Friendship + minRep = 0 + maxRep = friendshipReputationInfo.nextThreshold and friendshipReputationInfo.nextThreshold - friendshipReputationInfo.reactionThreshold or friendshipReputationInfo.maxRep + currentRep = maxRep - (friendshipReputationInfo.nextThreshold and friendshipReputationInfo.nextThreshold - friendshipReputationInfo.standing or 0) + factionStandingLabel = friendshipReputationInfo.reaction + end + + -- Store for tooltip use + SLDT.Reputation.repTbl = { factionData.name, factionData.description, factionData.reaction, minRep, maxRep, currentRep, factionStandingLabel } + local repPer = (100 / (maxRep - minRep)) * (currentRep - minRep) + text:SetFormattedText("|cff%s%s:|r %.0f%%", SLDT.db.profile.cCol and SLDT.classColor or "ffffff", factionData.name, repPer) + + if (stdCol[factionData.reaction] == nil) then + text:SetTextColor(1, 1, 1) + else + text:SetTextColor(stdCol[factionData.reaction].r, stdCol[factionData.reaction].g, stdCol[factionData.reaction].b) + end + noWatch = false end end diff --git a/Elements/zonetext.lua b/Elements/zonetext.lua index d96de74..57cf293 100644 --- a/Elements/zonetext.lua +++ b/Elements/zonetext.lua @@ -50,7 +50,7 @@ local function FixFrames(t) -- MinimapBorderTop.Show = MiniMapWorldMapButton.Hide -- MiniMapWorldMapButton.Show = MiniMapWorldMapButton.Hide - if ( IsAddOnLoaded("Chinchilla") ) then + if ( C_AddOns.IsAddOnLoaded("Chinchilla") ) then if ( Chinchilla_Location_Frame and Chinchilla_Location_Frame:IsShown() ) then Chinchilla_Location_Frame:Hide() end @@ -60,7 +60,7 @@ local function FixFrames(t) -- MinimapBorderTop.Show = MiniMapWorldMapButton.Show -- MiniMapWorldMapButton.Show = MiniMapWorldMapButton.Show - if ( IsAddOnLoaded("Chinchilla") ) then + if ( C_AddOns.IsAddOnLoaded("Chinchilla") ) then if ( Chinchilla_Location_Frame and not Chinchilla_Location_Frame:IsShown() ) then Chinchilla_Location_Frame:Show() end diff --git a/SLDataText.toc b/SLDataText.toc index 060fad9..d88e28d 100644 --- a/SLDataText.toc +++ b/SLDataText.toc @@ -1,4 +1,4 @@ -## Interface: 100005 +## Interface: 110007 ## Title: SLDataText ## Author: Taffu ## Notes: Simple Light Data Text! Updated by azuraji