From 5cab5e1d4c2e63e6357ce6033f1a810f825b4269 Mon Sep 17 00:00:00 2001 From: shagu Date: Sun, 5 Jul 2020 22:19:56 +0200 Subject: [PATCH] questitem: show current and required item counts --- modules/questitem.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/questitem.lua b/modules/questitem.lua index 13d588f5..9c40e281 100644 --- a/modules/questitem.lua +++ b/modules/questitem.lua @@ -41,6 +41,14 @@ pfUI:RegisterModule("questitem", function () -- read difficulty color local color = GetDifficultyColor(level) + -- read item counts + if itemcache[item] and itemcache[item] ~= false then + local _, _, required = strfind(string.lower(questlog[itemcache[item]]), "_"..string.lower(item).."_(.-)_") + if required then + quest = string.format("%s |cffaaaaaa[%s/%s]", quest, (GetItemCount(item) or 0), required) + end + end + -- add quest to quest item if replace then _G[frame:GetName().."TextLeft2"]:SetText("|cffffffff"..ITEM_BIND_QUEST..": |r" .. quest) @@ -90,7 +98,12 @@ pfUI:RegisterModule("questitem", function () if objcount > 0 then for i=1, objcount do objtext = GetQuestLogLeaderBoard(i) - questlog[quest] = string.format("%s:%s", questlog[quest], (objtext or "")) + local _, _, obj, cur, req = strfind((objtext or ""), "(.*):%s*([%d]+)%s*/%s*([%d]+)") + if obj and req then + questlog[quest] = string.format("%s:_%s_%s_", questlog[quest], obj, req) + else + questlog[quest] = string.format("%s:%s", questlog[quest], (objtext or "")) + end end end else