Skip to content

Commit

Permalink
Update for 11.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
azuraji committed Dec 20, 2024
1 parent 089e01b commit a8e6151
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Elements/friends.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion Elements/guild.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 6 additions & 6 deletions Elements/memory.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
74 changes: 50 additions & 24 deletions Elements/reputation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Elements/zonetext.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion SLDataText.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 100005
## Interface: 110007
## Title: SLDataText
## Author: Taffu
## Notes: Simple Light Data Text! Updated by azuraji
Expand Down

0 comments on commit a8e6151

Please sign in to comment.