Fixing writ tab

Leandro Silva [10-19-18 - 19:06]
Fixing writ tab
Filename
LeoAltholic.lua
LeoAltholic.txt
LeoAltholic.xml
LeoAltholicInit.lua
ui/bio.lua
ui/writs.lua
diff --git a/LeoAltholic.lua b/LeoAltholic.lua
index eef72bc..845deab 100644
--- a/LeoAltholic.lua
+++ b/LeoAltholic.lua
@@ -61,6 +61,20 @@ local function loadPlayerDataPart(skillType, baseElem)
     end
 end

+function LeoAltholic.GetCraftFromQuest(questName)
+    if not string.find(zo_strformat("<<z:1>>",questName), zo_strformat("<<z:1>>",GetString(LEOALT_WRIT))) then return nil end
+
+    if string.find(zo_strformat("<<z:1>>",questName), zo_strformat("<<z:1>>",GetString(LEOALT_ALCHEMIST))) then return CRAFTING_TYPE_ALCHEMY end
+    if string.find(zo_strformat("<<z:1>>",questName), zo_strformat("<<z:1>>",GetString(LEOALT_BLACKSMITH))) then return CRAFTING_TYPE_BLACKSMITHING end
+    if string.find(zo_strformat("<<z:1>>",questName), zo_strformat("<<z:1>>",GetString(LEOALT_CLOTHIER))) then return CRAFTING_TYPE_CLOTHIER end
+    if string.find(zo_strformat("<<z:1>>",questName), zo_strformat("<<z:1>>",GetString(LEOALT_ENCHANTER))) then return CRAFTING_TYPE_ENCHANTING end
+    if string.find(zo_strformat("<<z:1>>",questName), zo_strformat("<<z:1>>",GetString(LEOALT_JEWELRY))) then return CRAFTING_TYPE_JEWELRYCRAFTING end
+    if string.find(zo_strformat("<<z:1>>",questName), zo_strformat("<<z:1>>",GetString(LEOALT_PROVISIONER))) then return CRAFTING_TYPE_PROVISIONING end
+    if string.find(zo_strformat("<<z:1>>",questName), zo_strformat("<<z:1>>",GetString(LEOALT_WOODWORKER))) then return CRAFTING_TYPE_WOODWORKING end
+
+    return nil
+end
+
 local function createQuestEntry(questId)
     local questName,backgroundText,activeStepText,activeStepType, activeStepTrackerOverrideText, completed, tracked, questLevel,pushed,questType,instanceDisplayType = GetJournalQuestInfo(questId)
     local repeatType = GetJournalQuestRepeatType(questId)
@@ -86,6 +100,9 @@ local function createQuestEntry(questId)
         isDaily = repeatType == QUEST_REPEAT_DAILY,
         isCrafting = questType == QUEST_TYPE_CRAFTING
     }
+    if quest.isCrafting then
+        quest.craft = LeoAltholic.GetCraftFromQuest(quest.name)
+    end
     return quest
 end

@@ -409,42 +426,14 @@ local function initCharsList()
     LeoAltholic.savedVariables.CharList[LeoAltholic.CharName] = char
 end

-function LeoAltholic.GetCraftFromQuest(questName)
-    if not string.find(zo_strformat("<<z:1>>",questName), zo_strformat("<<z:1>>",GetString(LEOALT_WRIT))) then return nil end
-
-    if string.find(zo_strformat("<<z:1>>",questName), zo_strformat("<<z:1>>",GetString(LEOALT_ALCHEMIST))) then return CRAFTING_TYPE_ALCHEMY end
-    if string.find(zo_strformat("<<z:1>>",questName), zo_strformat("<<z:1>>",GetString(LEOALT_BLACKSMITH))) then return CRAFTING_TYPE_BLACKSMITHING end
-    if string.find(zo_strformat("<<z:1>>",questName), zo_strformat("<<z:1>>",GetString(LEOALT_CLOTHIER))) then return CRAFTING_TYPE_CLOTHIER end
-    if string.find(zo_strformat("<<z:1>>",questName), zo_strformat("<<z:1>>",GetString(LEOALT_ENCHANTER))) then return CRAFTING_TYPE_ENCHANTING end
-    if string.find(zo_strformat("<<z:1>>",questName), zo_strformat("<<z:1>>",GetString(LEOALT_JEWELRY))) then return CRAFTING_TYPE_JEWELRYCRAFTING end
-    if string.find(zo_strformat("<<z:1>>",questName), zo_strformat("<<z:1>>",GetString(LEOALT_PROVISIONER))) then return CRAFTING_TYPE_PROVISIONING end
-    if string.find(zo_strformat("<<z:1>>",questName), zo_strformat("<<z:1>>",GetString(LEOALT_WOODWORKER))) then return CRAFTING_TYPE_WOODWORKING end
-
-    return nil
-end
-
-local function fixTrackedQuest()
-    for trackedId, trackedQuest in pairs(LeoAltholic.savedVariables.CharList[LeoAltholic.CharName].quests.tracked) do
-        if trackedQuest.questType == nil then
-            LeoAltholic.savedVariables.CharList[LeoAltholic.CharName].quests.tracked[trackedId] = nil
-        end
-        if trackedQuest.questType == QUEST_TYPE_CRAFTING then
-            local craft = LeoAltholic.GetCraftFromQuest(trackedQuest.name)
-            if craft ~= nil then
-                LeoAltholic.savedVariables.CharList[LeoAltholic.CharName].quests.writs[craft] = trackedQuest
-            end
-            LeoAltholic.savedVariables.CharList[LeoAltholic.CharName].quests.tracked[trackedId] = nil
-        end
-    end
-    for _, char in pairs(LeoAltholic.GetCharacters()) do
-        for trackedId, trackedQuest in pairs(char.quests.tracked) do
-            if trackedQuest.questType == QUEST_TYPE_CRAFTING then
+local function fixWrits()
+    for charName, char in pairs(LeoAltholic.savedVariables.CharList) do
+        for trackedId, trackedQuest in pairs(char.quests.writs) do
+            if trackedQuest.craft == nil then
                 local craft = LeoAltholic.GetCraftFromQuest(trackedQuest.name)
                 if craft ~= nil then
-                    if char.quests.writs == nil then char.quests.writs = {} end
-                    char.quests.writs[craft] = trackedQuest
+                    LeoAltholic.savedVariables.CharList[charName].quests.writs[trackedId].craft = craft
                 end
-                char.quests.tracked[trackedId] = nil
             end
         end
     end
@@ -841,7 +830,7 @@ local function initialize()
     LeoAltholic.RestorePosition()

     initCharsList()
-    fixTrackedQuest()
+    fixWrits()
     LeoAltholicUI.InitPanels()
     createMessageQueue()

@@ -906,12 +895,12 @@ function ZO_QuestJournalNavigationEntry_OnMouseUp(label, button, upInside)
 end

 local function onNewMovementInUIMode(eventCode)
-    if not LeoAltholicWindow:IsHidden() then LeoAltholic:HideUI() end
+    if not LeoAltholicWindow:IsHidden() then LeoAltholic.CloseUI() end
 end

 local function onChampionPerksSceneStateChange(oldState,newState)
     if newState == SCENE_SHOWING then
-        if not LeoAltholicWindow:IsHidden() then LeoAltholic:HideUI() end
+        if not LeoAltholicWindow:IsHidden() then LeoAltholic.CloseUI() end
     end
 end

diff --git a/LeoAltholic.txt b/LeoAltholic.txt
index 17aef43..b4ff77f 100644
--- a/LeoAltholic.txt
+++ b/LeoAltholic.txt
@@ -1,6 +1,6 @@
 ## Title: Leo's Altholic
 ## APIVersion: 100024 100025
-## Version: 1.3.3
+## Version: 1.3.4
 ## Author: |c39B027@LeandroSilva|r
 ## SavedVariables: LeoAltholicSavedVariables
 ## OptionalDependsOn: LibStub LibFeedback LibAddonMenu-2.0
diff --git a/LeoAltholic.xml b/LeoAltholic.xml
index 47ac34f..e5f0a6e 100644
--- a/LeoAltholic.xml
+++ b/LeoAltholic.xml
@@ -836,62 +836,48 @@
                                                     ZO_SortHeader_Initialize(self, GetString(SI_ADDON_MANAGER_NAME), "name", ZO_SORT_ORDER_DOWN, TEXT_ALIGN_LEFT, "LeoAltholicSmallFont")
                                                 </OnInitialized>
                                             </Control>
-                                            <Label name="$(parent)Craft1" font="LeoAltholicSmallFont" color="C4C4A0" horizontalAlignment="CENTER">
-                                                <Anchor point="TOPLEFT" relativeTo="$(parent)Name" relativePoint="TOPRIGHT" offsetX="10" />
-                                                <Dimensions x="100" y="20" />
-                                                <OnInitialized>
-                                                    self:SetText(GetCraftingSkillName(1))
-                                                    self:SetModifyTextType(MODIFY_TEXT_TYPE_UPPERCASE)
-                                                </OnInitialized>
-                                            </Label>
-                                            <Label name="$(parent)Craft2" font="LeoAltholicSmallFont" color="C4C4A0" horizontalAlignment="CENTER">
-                                                <Anchor point="TOPLEFT" relativeTo="$(parent)Craft1" relativePoint="TOPRIGHT" offsetX="10" />
-                                                <Dimensions x="100" y="20" />
-                                                <OnInitialized>
-                                                    self:SetText(GetCraftingSkillName(2))
-                                                    self:SetModifyTextType(MODIFY_TEXT_TYPE_UPPERCASE)
-                                                </OnInitialized>
-                                            </Label>
-                                            <Label name="$(parent)Craft6" font="LeoAltholicSmallFont" color="C4C4A0" horizontalAlignment="CENTER">
-                                                <Anchor point="TOPLEFT" relativeTo="$(parent)Craft2" relativePoint="TOPRIGHT" offsetX="10" />
-                                                <Dimensions x="100" y="20" />
-                                                <OnInitialized>
-                                                    self:SetText(GetCraftingSkillName(6))
-                                                    self:SetModifyTextType(MODIFY_TEXT_TYPE_UPPERCASE)
-                                                </OnInitialized>
-                                            </Label>
-                                            <Label name="$(parent)Craft7" font="LeoAltholicSmallFont" color="C4C4A0" horizontalAlignment="CENTER">
-                                                <Anchor point="TOPLEFT" relativeTo="$(parent)Craft6" relativePoint="TOPRIGHT" offsetX="10" />
-                                                <Dimensions x="100" y="20" />
-                                                <OnInitialized>
-                                                    self:SetText(GetString(SI_ITEMFILTERTYPE25))
-                                                    self:SetModifyTextType(MODIFY_TEXT_TYPE_UPPERCASE)
-                                                </OnInitialized>
-                                            </Label>
-                                            <Label name="$(parent)Craft3" font="LeoAltholicSmallFont" color="C4C4A0" horizontalAlignment="CENTER">
-                                                <Anchor point="TOPLEFT" relativeTo="$(parent)Craft7" relativePoint="TOPRIGHT" offsetX="10" />
-                                                <Dimensions x="100" y="20" />
-                                                <OnInitialized>
-                                                    self:SetText(GetCraftingSkillName(3))
-                                                    self:SetModifyTextType(MODIFY_TEXT_TYPE_UPPERCASE)
-                                                </OnInitialized>
-                                            </Label>
-                                            <Label name="$(parent)Craft4" font="LeoAltholicSmallFont" color="C4C4A0" horizontalAlignment="CENTER">
-                                                <Anchor point="TOPLEFT" relativeTo="$(parent)Craft3" relativePoint="TOPRIGHT" offsetX="10" />
-                                                <Dimensions x="100" y="20" />
-                                                <OnInitialized>
-                                                    self:SetText(GetCraftingSkillName(4))
-                                                    self:SetModifyTextType(MODIFY_TEXT_TYPE_UPPERCASE)
-                                                </OnInitialized>
-                                            </Label>
-                                            <Label name="$(parent)Craft5" font="LeoAltholicSmallFont" color="C4C4A0" horizontalAlignment="CENTER">
-                                                <Anchor point="TOPLEFT" relativeTo="$(parent)Craft4" relativePoint="TOPRIGHT" offsetX="10" />
-                                                <Dimensions x="100" y="20" />
-                                                <OnInitialized>
-                                                    self:SetText(GetCraftingSkillName(5))
-                                                    self:SetModifyTextType(MODIFY_TEXT_TYPE_UPPERCASE)
-                                                </OnInitialized>
-                                            </Label>
+                                            <Texture name="$(parent)1Label" mouseEnabled="true" textureFile="/esoui/art/inventory/inventory_tabicon_craftbag_blacksmithing_up.dds">
+                                                <Dimensions x="38" y="38"/>
+                                                <Anchor point="TOPLEFT" relativeTo="$(parent)Name" relativePoint="TOPRIGHT" offsetX="16" offsetY="-8"/>
+                                                <OnMouseEnter> ZO_Tooltips_ShowTextTooltip(self, TOP, GetString(SI_ITEMFILTERTYPE13)) </OnMouseEnter>
+                                                <OnMouseExit> ZO_Tooltips_HideTextTooltip() </OnMouseExit>
+                                            </Texture>
+                                            <Texture name="$(parent)2Label" mouseEnabled="true" textureFile="/esoui/art/inventory/inventory_tabicon_craftbag_clothing_up.dds">
+                                                <Dimensions x="38" y="38"/>
+                                                <Anchor point="TOPLEFT" relativeTo="$(parent)1Label" relativePoint="TOPRIGHT" offsetX="44"/>
+                                                <OnMouseEnter> ZO_Tooltips_ShowTextTooltip(self, TOP, GetString(SI_ITEMFILTERTYPE14)) </OnMouseEnter>
+                                                <OnMouseExit> ZO_Tooltips_HideTextTooltip() </OnMouseExit>
+                                            </Texture>
+                                            <Texture name="$(parent)6Label" mouseEnabled="true" textureFile="/esoui/art/inventory/inventory_tabicon_craftbag_woodworking_up.dds">
+                                                <Dimensions x="38" y="38"/>
+                                                <Anchor point="TOPLEFT" relativeTo="$(parent)2Label" relativePoint="TOPRIGHT" offsetX="44"/>
+                                                <OnMouseEnter> ZO_Tooltips_ShowTextTooltip(self, TOP, GetString(SI_ITEMFILTERTYPE15)) </OnMouseEnter>
+                                                <OnMouseExit> ZO_Tooltips_HideTextTooltip() </OnMouseExit>
+                                            </Texture>
+                                            <Texture name="$(parent)7Label" mouseEnabled="true" textureFile="/esoui/art/inventory/inventory_tabicon_craftbag_jewelrycrafting_up.dds">
+                                                <Dimensions x="38" y="38"/>
+                                                <Anchor point="TOPLEFT" relativeTo="$(parent)6Label" relativePoint="TOPRIGHT" offsetX="44"/>
+                                                <OnMouseEnter> ZO_Tooltips_ShowTextTooltip(self, TOP, GetString(SI_ITEMFILTERTYPE24)) </OnMouseEnter>
+                                                <OnMouseExit> ZO_Tooltips_HideTextTooltip() </OnMouseExit>
+                                            </Texture>
+                                            <Texture name="$(parent)3Label" mouseEnabled="true" textureFile="/esoui/art/inventory/inventory_tabicon_craftbag_enchanting_up.dds">
+                                                <Dimensions x="38" y="38"/>
+                                                <Anchor point="TOPLEFT" relativeTo="$(parent)7Label" relativePoint="TOPRIGHT" offsetX="44"/>
+                                                <OnMouseEnter> ZO_Tooltips_ShowTextTooltip(self, TOP, GetString(SI_ITEMFILTERTYPE17)) </OnMouseEnter>
+                                                <OnMouseExit> ZO_Tooltips_HideTextTooltip() </OnMouseExit>
+                                            </Texture>
+                                            <Texture name="$(parent)4Label" mouseEnabled="true" textureFile="/esoui/art/inventory/inventory_tabicon_craftbag_alchemy_up.dds">
+                                                <Dimensions x="38" y="38"/>
+                                                <Anchor point="TOPLEFT" relativeTo="$(parent)3Label" relativePoint="TOPRIGHT" offsetX="44"/>
+                                                <OnMouseEnter> ZO_Tooltips_ShowTextTooltip(self, TOP, GetString(SI_ITEMFILTERTYPE16)) </OnMouseEnter>
+                                                <OnMouseExit> ZO_Tooltips_HideTextTooltip() </OnMouseExit>
+                                            </Texture>
+                                            <Texture name="$(parent)5Label" mouseEnabled="true" textureFile="/esoui/art/inventory/inventory_tabicon_craftbag_provisioning_up.dds">
+                                                <Dimensions x="38" y="38"/>
+                                                <Anchor point="TOPLEFT" relativeTo="$(parent)4Label" relativePoint="TOPRIGHT" offsetX="44"/>
+                                                <OnMouseEnter> ZO_Tooltips_ShowTextTooltip(self, TOP, GetString(SI_ITEMFILTERTYPE18)) </OnMouseEnter>
+                                                <OnMouseExit> ZO_Tooltips_HideTextTooltip() </OnMouseExit>
+                                            </Texture>
                                         </Controls>
                                 </Control>
                                 <Control name="$(parent)List" inherits="ZO_ScrollList">
@@ -1101,31 +1087,31 @@
                 </Label>

                 <Label name="$(parent)Craft1Status" mouseEnabled="true" font="LeoAltholicLargeFont" verticalAlignment="CENTER" horizontalAlignment="LEFT" resizeToFitDescendents="false">
-                    <Dimensions x="100" y="28"/>
+                    <Dimensions x="70" y="28"/>
                     <Anchor point="TOPLEFT" relativeTo="$(parent)Name" relativePoint="TOPRIGHT" offsetX="10" offsetY="0"/>
                 </Label>
                 <Label name="$(parent)Craft2Status" mouseEnabled="true" font="LeoAltholicLargeFont" verticalAlignment="CENTER" horizontalAlignment="LEFT" resizeToFitDescendents="false">
-                    <Dimensions x="100" y="28"/>
+                    <Dimensions x="70" y="28"/>
                     <Anchor point="TOPLEFT" relativeTo="$(parent)Craft1Status" relativePoint="TOPRIGHT" offsetX="12"/>
                 </Label>
                 <Label name="$(parent)Craft6Status" mouseEnabled="true" font="LeoAltholicLargeFont" verticalAlignment="CENTER" horizontalAlignment="LEFT" resizeToFitDescendents="false">
-                    <Dimensions x="100" y="28"/>
+                    <Dimensions x="70" y="28"/>
                     <Anchor point="TOPLEFT" relativeTo="$(parent)Craft2Status" relativePoint="TOPRIGHT" offsetX="12"/>
                 </Label>
                 <Label name="$(parent)Craft7Status" mouseEnabled="true" font="LeoAltholicLargeFont" verticalAlignment="CENTER" horizontalAlignment="LEFT" resizeToFitDescendents="false">
-                    <Dimensions x="100" y="28"/>
+                    <Dimensions x="70" y="28"/>
                     <Anchor point="TOPLEFT" relativeTo="$(parent)Craft6Status" relativePoint="TOPRIGHT" offsetX="12"/>
                 </Label>
                 <Label name="$(parent)Craft3Status" mouseEnabled="true" font="LeoAltholicLargeFont" verticalAlignment="CENTER" horizontalAlignment="LEFT" resizeToFitDescendents="false">
-                    <Dimensions x="100" y="28"/>
+                    <Dimensions x="70" y="28"/>
                     <Anchor point="TOPLEFT" relativeTo="$(parent)Craft7Status" relativePoint="TOPRIGHT" offsetX="12"/>
                 </Label>
                 <Label name="$(parent)Craft4Status" mouseEnabled="true" font="LeoAltholicLargeFont" verticalAlignment="CENTER" horizontalAlignment="LEFT" resizeToFitDescendents="false">
-                    <Dimensions x="100" y="28"/>
+                    <Dimensions x="70" y="28"/>
                     <Anchor point="TOPLEFT" relativeTo="$(parent)Craft3Status" relativePoint="TOPRIGHT" offsetX="12"/>
                 </Label>
                 <Label name="$(parent)Craft5Status" mouseEnabled="true" font="LeoAltholicLargeFont" verticalAlignment="CENTER" horizontalAlignment="LEFT" resizeToFitDescendents="false">
-                    <Dimensions x="100" y="28"/>
+                    <Dimensions x="70" y="28"/>
                     <Anchor point="TOPLEFT" relativeTo="$(parent)Craft4Status" relativePoint="TOPRIGHT" offsetX="12"/>
                 </Label>
             </Controls>
diff --git a/LeoAltholicInit.lua b/LeoAltholicInit.lua
index c84d26d..0626caf 100644
--- a/LeoAltholicInit.lua
+++ b/LeoAltholicInit.lua
@@ -4,5 +4,5 @@ LeoAltholicUI = LeoAltholicUI or {}

 LeoAltholic.name = "LeoAltholic"
 LeoAltholic.displayName = "Leo's Altholic"
-LeoAltholic.version = "1.3.3"
+LeoAltholic.version = "1.3.4"
 LeoAltholic.chatPrefix = "|c39B027" .. LeoAltholic.name .. "|r: "
diff --git a/ui/bio.lua b/ui/bio.lua
index b85e1bf..52b2e3f 100644
--- a/ui/bio.lua
+++ b/ui/bio.lua
@@ -63,10 +63,10 @@ function LeoAltholicBioList:SetupEntry(control, data)
     control.alliance:SetText("|t30:30:" .. icon .. "|t ".. data.alliance.name)

     control.riding = GetControl(control, "Riding")
-    local riding = '|t20:20:esoui/art/mounts/ridingskill_speed.dds|t ' .. data.riding.speed .. '%' ..
-            ' |t20:20:esoui/art/mounts/ridingskill_stamina.dds|t ' .. data.riding.stamina ..
-            ' |t20:20:esoui/art/mounts/ridingskill_capacity.dds|t ' .. data.riding.capacity ..
-            ' |t22:22:esoui/art/miscellaneous/timer_32.dds|t ' .. LeoAltholic.GetTime(data.riding.time - GetTimeStamp())
+    local riding = '|t20:20:esoui/art/mounts/ridingskill_speed.dds|t' .. string.format("%02d%%", data.riding.speed) ..
+            ' |t20:20:esoui/art/mounts/ridingskill_stamina.dds|t' .. string.format("%02d", data.riding.stamina) ..
+            ' |t20:20:esoui/art/mounts/ridingskill_capacity.dds|t' .. string.format("%02d", data.riding.capacity) ..
+            ' |t22:22:esoui/art/miscellaneous/timer_32.dds|t' .. LeoAltholic.GetTime(data.riding.time - GetTimeStamp(), true)
     control.riding:SetText(riding)
     control.riding.riding = data.riding

@@ -136,10 +136,10 @@ function LeoAltholicUI:updateBio()
     local control = LeoAltholicWindowBioPanelListScrollListContents
     for i = 1, control:GetNumChildren() do
         local child = control:GetChild(i):GetChild(8)
-        local riding = '|t20:20:esoui/art/mounts/ridingskill_speed.dds|t ' .. child.riding.speed .. '%' ..
-                ' |t20:20:esoui/art/mounts/ridingskill_stamina.dds|t ' .. child.riding.stamina ..
-                ' |t20:20:esoui/art/mounts/ridingskill_capacity.dds|t ' .. child.riding.capacity ..
-                ' |t22:22:esoui/art/miscellaneous/timer_32.dds|t ' .. LeoAltholic.GetTime(child.riding.time - GetTimeStamp(), true)
+        local riding = '|t20:20:esoui/art/mounts/ridingskill_speed.dds|t' .. string.format("%02d%%", child.riding.speed) ..
+                ' |t20:20:esoui/art/mounts/ridingskill_stamina.dds|t' .. string.format("%02d", child.riding.stamina) ..
+                ' |t20:20:esoui/art/mounts/ridingskill_capacity.dds|t' .. string.format("%02d", child.riding.capacity) ..
+                ' |t22:22:esoui/art/miscellaneous/timer_32.dds|t' .. LeoAltholic.GetTime(child.riding.time - GetTimeStamp(), true)
         child:SetText(riding)
     end
 end
diff --git a/ui/writs.lua b/ui/writs.lua
index d93cf8a..9a75d1f 100644
--- a/ui/writs.lua
+++ b/ui/writs.lua
@@ -32,45 +32,32 @@ function LeoAltholicWritsList:SetupEntry(control, data)
     local child
     for _, craft in pairs({CRAFTING_TYPE_ALCHEMY,CRAFTING_TYPE_BLACKSMITHING,CRAFTING_TYPE_CLOTHIER,CRAFTING_TYPE_ENCHANTING,CRAFTING_TYPE_JEWELRYCRAFTING,CRAFTING_TYPE_PROVISIONING,CRAFTING_TYPE_WOODWORKING}) do
         child = GetControl(control, "Craft"..craft.."Status")
-        local shown = false
         local icon = "esoui/art/tutorial/menubar_help_up.dds"
         local color = {1,1,1,1}
         local ago = ""
-        if data.writs[craft] ~= nil then
-            color = {1,0,0,1}
-            if
-            (craft == CRAFTING_TYPE_ALCHEMY and string.find(zo_strformat("<<z:1>>",data.writs[craft].name), zo_strformat("<<z:1>>",GetString(LEOALT_ALCHEMIST)))) or
-                    (craft == CRAFTING_TYPE_BLACKSMITHING and string.find(zo_strformat("<<z:1>>",data.writs[craft].name), zo_strformat("<<z:1>>",GetString(LEOALT_BLACKSMITH)))) or
-                    (craft == CRAFTING_TYPE_CLOTHIER and string.find(zo_strformat("<<z:1>>",data.writs[craft].name), zo_strformat("<<z:1>>",GetString(LEOALT_CLOTHIER)))) or
-                    (craft == CRAFTING_TYPE_ENCHANTING and string.find(zo_strformat("<<z:1>>",data.writs[craft].name), zo_strformat("<<z:1>>",GetString(LEOALT_ENCHANTER)))) or
-                    (craft == CRAFTING_TYPE_JEWELRYCRAFTING and string.find(zo_strformat("<<z:1>>",data.writs[craft].name), zo_strformat("<<z:1>>",GetString(LEOALT_JEWELRY)))) or
-                    (craft == CRAFTING_TYPE_PROVISIONING and string.find(zo_strformat("<<z:1>>",data.writs[craft].name), zo_strformat("<<z:1>>",GetString(LEOALT_PROVISIONER)))) or
-                    (craft == CRAFTING_TYPE_WOODWORKING and string.find(zo_strformat("<<z:1>>",data.writs[craft].name), zo_strformat("<<z:1>>",GetString(LEOALT_WOODWORKER)))) then
-                if data.writs[craft].lastDone ~= nil and data.writs[craft].lastDone > LeoAltholic.TodayReset() then
+        for _, writ in pairs(data.writs) do
+            if craft == writ.craft then
+                if writ.lastDone ~= nil and writ.lastDone > LeoAltholic.TodayReset() then
                     color = {0,1,0,1}
+                else
+                    color = {1,0,0,1}
                 end
                 icon = "esoui/art/buttons/accept_up.dds"
-                --child:SetColor(unpack(color))
-                if data.writs[craft].lastDone ~= nil then
-                    local diff = GetTimeStamp() - data.writs[craft].lastDone
+                if writ.lastDone ~= nil then
+                    local diff = GetTimeStamp() - writ.lastDone
                     if diff < 3600 then
-                        ago = zo_strformat(GetString(SI_TIME_DURATION_AGO), zo_strformat(GetString(SI_TIME_FORMAT_MINUTES), math.floor(diff / 60)))
+                        ago = zo_strformat(GetString(SI_TIME_FORMAT_MINUTES), math.floor(diff / 60))
                     elseif diff < 86400 then
-                        ago = zo_strformat(GetString(SI_TIME_DURATION_AGO), zo_strformat(GetString(SI_TIME_FORMAT_HOURS), math.floor(diff / 3600)))
+                        ago = zo_strformat(GetString(SI_TIME_FORMAT_HOURS), math.floor(diff / 3600))
                     else
-                        ago = zo_strformat(GetString(SI_TIME_DURATION_AGO), zo_strformat(GetString(SI_TIME_FORMAT_DAYS), math.floor(diff / 86400)))
+                        ago = zo_strformat(GetString(SI_TIME_FORMAT_DAYS), math.floor(diff / 86400))
                     end
                 else
                     ago  = "|cCB110E"..GetString(SI_STR_TIME_UNKNOWN).."|r"
                 end
-                shown = true
+                break
             end
         end
-        if shown == false then
-            icon = "esoui/art/tutorial/menubar_help_up.dds"
-            color = {1,1,1,1}
-            ago = ""
-        end
         child:SetText("|t24:24:"..icon.."|t ".. ago)
         child:SetColor(unpack(color))
     end