SavedInstances

SavedInstances

11M Downloads

Problem with adding custom rares

Bombademar opened this issue · 5 comments

commented

Hey, I tried to add Karokta to show in SavedInstances as described in this thread. #415

What I did is put the following code right behind the TorghastReset function (line 244):

local function RareMobUpdate(index)
SI.db.Toons[SI.thisToon].Progress[index] = wipe(SI.db.Toons[SI.thisToon].Progress[index] or {})
local data = {
unlocked = true,
isComplete = IsQuestFlaggedCompleted(Module.TrackedQuest[index].quest),
}
SI.db.Toons[SI.thisToon].Progress[index] = data

end

local function RareMobShow(toon, index)
local t = SI.db.Toons[toon]
if not t or not t.Progress or not t.Progress[index] then return end
local data = t.Progress[index]
local text
if data.isComplete then
text = "\124T" .. READY_CHECK_READY_TEXTURE .. ":0|t"
else
text = ""
end
return text
end

local function RareMobReset(toon, index)
local t = SI.db.Toons[toon]
if not t or not t.Progress or not t.Progress[index] then return end

local prev = t.Progress[index]
t.Progress[index] = {
unlocked = prev.unlocked,
isComplete = false,
}
end

and then I added Karokta in the Module.TrackedQuest like this:

-- Rares

{
name = "Karokta",
quest = 75333,
daily = true,
func = RareMobUpdate,
showFunc = RareMobShow,
resetFunc = RareMobReset,
},

Doing it like this worked for me in Shadowlands, now I can get the Rare to show up in the SavedInstances window but it never puts the green checkmark when I've killed it for the day. I double checked for the questID and it is correct, but even when it shows as "true" ingame, I still dont get the checkmark in the addon.

Has anything changed with this method, so the old code from shadowlands doesn't work anymore? Maybe a slight change in the raremob functions to get it working again?

thx a lot :)

commented

The IsQuestFlaggedCompleted alias is no longer in the Progress.lua after #617 . Changing it to C_QuestLog.IsQuestFlaggedCompleted will work.

commented

@Bombademar Did you get it to work in the end? I tried to do it myself but getting lua error so must have done something wrong ☹️

commented

@Bombademar Did you get it to work in the end? I tried to do it myself but getting lua error so must have done something wrong ☹️

Yes, with the change LiangYuxuan suggested it works for me now (thanks!). All I did was change this line:

isComplete = IsQuestFlaggedCompleted(Module.TrackedQuest[index].quest),

to

isComplete = C_QuestLog.IsQuestFlaggedCompleted(Module.TrackedQuest[index].quest),

Other than that I used the code I posted above. Hope this works for you :)

commented

@Bombademar Did you get it to work in the end? I tried to do it myself but getting lua error so must have done something wrong ☹️

Yes, with the change LiangYuxuan suggested it works for me now (thanks!). All I did was change this line:

isComplete = IsQuestFlaggedCompleted(Module.TrackedQuest[index].quest),

to

isComplete = C_QuestLog.IsQuestFlaggedCompleted(Module.TrackedQuest[index].quest),

Other than that I used the code I posted above. Hope this works for you :)

Ahhh woopsie I put the code in the wrong spot first time, got it working now thx :)

commented

Seems a bit buggy tho, It shows I'm not saved on some of the alts but when I logon the alts to double check it gets the check mark back again and
/run print(C_QuestLog.IsQuestFlaggedCompleted(75333))
returns true in chat :/

E: Now that the Zaralek Cavern rares are on a 4 day rotation it doesn't get tracked properly with this code, the addon seem to reset it daily, you can only kill Karokta 1 time every 4 days now so the checkmark should not be removed until the zone has been reset again but no idea how to code so can't do that myself :P

2023-05-28_21-22-35