Skip to content

Commit

Permalink
🐛 FIX: Call the db here directly, cause it doesn't exist sometimes on…
Browse files Browse the repository at this point in the history
… profile switch
  • Loading branch information
Merathilis committed Aug 31, 2024
1 parent 865a028 commit ab7b6a6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
30 changes: 14 additions & 16 deletions ElvUI_MerathilisUI/Modules/Armory/Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ function module:UpdatePageInfo(_, _, which)
end

function module:UpdatePageStrings(slotId, _, slotItem, slotInfo, which)
local db = E.db.mui.armory
if which ~= "Character" then
return
end
Expand All @@ -721,8 +722,8 @@ function module:UpdatePageStrings(slotId, _, slotItem, slotInfo, which)
end

-- Enchant/Socket Text Handling
if module.db.pageInfo.enchantTextEnabled and slotInfo.itemLevelColors and next(slotInfo.itemLevelColors) then
if module.db.pageInfo.missingSocketText and slotOptions.needsSocket then
if db.pageInfo.enchantTextEnabled and slotInfo.itemLevelColors and next(slotInfo.itemLevelColors) then
if db.pageInfo.missingSocketText and slotOptions.needsSocket then
if not slotOptions.warningCondition or module:CheckMessageCondition(slotOptions) then
local missingGemSlots = 2 - #slotInfo.gems
if missingGemSlots > 0 then
Expand All @@ -744,17 +745,17 @@ function module:UpdatePageStrings(slotId, _, slotItem, slotInfo, which)
local text = slotInfo.enchantTextShort
-- Strip color
text = F.String.StripColor(text)
if module.db.pageInfo.abbreviateEnchantText then
if db.pageInfo.abbreviateEnchantText then
text = module:EnchantAbbreviate(slotInfo.enchantText)
end

if module.db.pageInfo.useEnchantClassColor then
if db.pageInfo.useEnchantClassColor then
slotItem.enchantText:SetText(F.String.Class(text))
else
slotItem.enchantText:SetText(text)
end
end
elseif module.db.pageInfo.missingEnchantText and slotOptions.needsEnchant and not E.TimerunningID then
elseif db.pageInfo.missingEnchantText and slotOptions.needsEnchant and not E.TimerunningID then
if not slotOptions.warningCondition or module:CheckMessageCondition(slotOptions) then
slotItem.enchantText:SetText(F.String.Error("Add enchant"))
else
Expand Down Expand Up @@ -794,10 +795,7 @@ function module:UpdatePageStrings(slotId, _, slotItem, slotInfo, which)
end

-- Update Size
slotItem.MERGradient:SetSize(
module.db.pageInfo.itemQualityGradientWidth,
module.db.pageInfo.itemQualityGradientHeight
)
slotItem.MERGradient:SetSize(db.pageInfo.itemQualityGradientWidth, db.pageInfo.itemQualityGradientHeight)

-- Update Colors
if slotOptions.direction == module.enumDirection.LEFT then
Expand All @@ -807,11 +805,11 @@ function module:UpdatePageStrings(slotId, _, slotItem, slotInfo, which)
r,
g,
b,
module.db.pageInfo.itemQualityGradientStartAlpha,
db.pageInfo.itemQualityGradientStartAlpha,
r,
g,
b,
module.db.pageInfo.itemQualityGradientEndAlpha
db.pageInfo.itemQualityGradientEndAlpha
)
elseif slotOptions.direction == module.enumDirection.RIGHT then
F.SetGradientRGB(
Expand All @@ -820,28 +818,28 @@ function module:UpdatePageStrings(slotId, _, slotItem, slotInfo, which)
r,
g,
b,
module.db.pageInfo.itemQualityGradientEndAlpha,
db.pageInfo.itemQualityGradientEndAlpha,
r,
g,
b,
module.db.pageInfo.itemQualityGradientStartAlpha
db.pageInfo.itemQualityGradientStartAlpha
)
end

if module.db.pageInfo.itemQualityGradientEnabled then
if db.pageInfo.itemQualityGradientEnabled then
slotItem.MERGradient:Show()
else
slotItem.MERGradient:Hide()
end
end

-- iLvL Text Handling
if not module.db.pageInfo.itemLevelTextEnabled then
if not db.pageInfo.itemLevelTextEnabled then
slotItem.iLvlText:SetText("")
end

-- Icons Handling
if not module.db.pageInfo.itemLevelTextEnabled or not module.db.pageInfo.iconsEnabled then
if not db.pageInfo.itemLevelTextEnabled or not db.pageInfo.iconsEnabled then
for x = 1, 10 do
local essenceType = slotItem["textureSlotEssenceType" .. x]
if essenceType then
Expand Down
11 changes: 6 additions & 5 deletions ElvUI_MerathilisUI/Modules/Blizzard/ObjectiveTracker.lua
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ function module:CosmeticBar(header)
end

function module:ObjectiveTrackerModule_Update(tracker)
local db = E.db.mui.blizzard.objectiveTracker
local NumQuests = select(2, GetNumQuestLogEntries())

if tracker and tracker.Header and tracker.Header.Text then
Expand All @@ -193,19 +194,19 @@ function module:ObjectiveTrackerModule_Update(tracker)
tracker.Header.Text:SetText(format("|Cffff0000%d/%d|r - %s", NumQuests, MAX_QUESTS, _G.QUESTS_LABEL))
end
self:CosmeticBar(tracker.Header)
F.SetFontDB(tracker.Header.Text, self.db.header)
F.SetFontDB(tracker.Header.Text, db.header)
if not tracker.Header.Text.__MERUnbind then
tracker.Header.Text.__MERUnbind = true
tracker.Header.Text:SetFontObject(nil)
tracker.Header.Text.SetFontObject = E.noop
end

local r = self.db.header.classColor and MER.ClassColor.r or self.db.header.color.r
local g = self.db.header.classColor and MER.ClassColor.g or self.db.header.color.g
local b = self.db.header.classColor and MER.ClassColor.b or self.db.header.color.b
local r = db and db.header.classColor and MER.ClassColor.r or db.header.color.r
local g = db and db.header.classColor and MER.ClassColor.g or db.header.color.g
local b = db and db.header.classColor and MER.ClassColor.b or db.header.color.b

tracker.Header.Text:SetTextColor(r, g, b)
if self.db.header.shortHeader then
if db and db.header.shortHeader then
tracker.Header.Text:SetText(self:ShortTitle(tracker.Header.Text:GetText()))
end
end
Expand Down

0 comments on commit ab7b6a6

Please sign in to comment.