seblindfors / Immersion

Immersive questing addon for World of Warcraft
Artistic License 2.0
26 stars 15 forks source link

prepatch bug report #37

Open swallowsoul opened 1 month ago

swallowsoul commented 1 month ago

hey, I got this report from bugsack when trying to complete a quest in darkmoon faire, apparently if the quest requires things like archeology fragments or coins the UI bugs, and you can't turn on the quest.

1x Immersion/Components/Elements.lua:78: attempt to call global 'GetQuestCurrencyInfo' (a nil value)
[string "@Immersion/Components/Elements.lua"]:78: in function <Immersion/Components/Elements.lua:49>
[string "@Immersion/Components/Elements.lua"]:788: in function `ShowProgress'
[string "@Immersion/Logic/Events.lua"]:27: in function `?'
[string "@Immersion/Logic/Frame.lua"]:11: in function <Immersion/Logic/Frame.lua:7>

Locals:
self = ImmersionProgressItem1 {
 type = "required"
 NameFrame = ImmersionProgressItem1NameFrame {
 }
 InAnim = AnimationGroup {
 }
 Mask = MaskTexture {
 }
 Border = ImmersionProgressItem1Borderexture {
 }
 Count = ImmersionProgressItem1Count {
 }
 Name = ImmersionProgressItem1Name {
 }
 objectType = "currency"
 Icon = ImmersionProgressItem1IconTexture {
 }
 container = Button {
 }
}
showMissing = nil
(*temporary) = nil
(*temporary) = "required"
(*temporary) = 1
(*temporary) = "attempt to call global 'GetQuestCurrencyInfo' (a nil value)"
neun0eil commented 4 weeks ago

Maybe a workaround (need more tests for sure):

diff --git "a/Components/Elements.lua" "b/Components/Elements.lua"
index 387a074..121fc87 100644
--- "a/Components/Elements.lua"
+++ "b/Components/Elements.lua" 
@@ -46,6 +46,20 @@ local function GetItemButton(parentFrame, index, buttonType)
    return rewardButtons[index]
 end

+local function GetQuestCurrencyInfo(itemType, currencyIndex)
+   if C_QuestOffer then
+       if itemType == 'reward' then
+           local i = C_QuestOffer.GetQuestRewardCurrencyInfo(itemType, currencyIndex)
+           return i.name, i.texture, i.totalRewardAmount, i.quality
+       else
+           local i = C_QuestOffer.GetQuestRequiredCurrencyInfo(currencyIndex)
+           return i.name, i.texture, i.requiredAmount, i.quality
+       end
+   else
+       return _G.GetQuestCurrencyInfo(itemType, currencyIndex)
+   end
+end
+
 local function UpdateItemInfo(self, showMissing)
    assert(self.type)
    assert(self:GetID())
seblindfors commented 2 weeks ago

Thanks for the code @neun0eil, I'll add it to the wrapper.