diff --git a/LeoAltholic.lua b/LeoAltholic.lua index 0b23cae..2807ee9 100644 --- a/LeoAltholic.lua +++ b/LeoAltholic.lua @@ -35,7 +35,7 @@ local function loadPlayerDataPart(skillType, baseElem) local currentUpgradeLevel, maxUpgradeLevel = GetSkillAbilityUpgradeInfo(skillType, i, aj) if rank >= earnedRank then local _, _, nextUpgradeEarnedRank = GetSkillAbilityNextUpgradeInfo(skillType, i, aj) - local plainName = zo_strformat(SI_ABILITY_NAME, name2) + local plainName = ZO_CachedStrFormat(SI_ABILITY_NAME, name2) name2 = ZO_Skills_GenerateAbilityName(SI_ABILITY_NAME_AND_UPGRADE_LEVELS, name2, currentUpgradeLevel, maxUpgradeLevel, progressionIndex) baseElemTable.list[aj] = {} local selL = baseElemTable.list[aj] @@ -58,15 +58,15 @@ local function loadPlayerDataPart(skillType, baseElem) 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 not string.find(ZO_CachedStrFormat("<<z:1>>",questName), ZO_CachedStrFormat("<<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 + if string.find(ZO_CachedStrFormat("<<z:1>>",questName), ZO_CachedStrFormat("<<z:1>>",GetString(LEOALT_ALCHEMIST))) then return CRAFTING_TYPE_ALCHEMY end + if string.find(ZO_CachedStrFormat("<<z:1>>",questName), ZO_CachedStrFormat("<<z:1>>",GetString(LEOALT_BLACKSMITH))) then return CRAFTING_TYPE_BLACKSMITHING end + if string.find(ZO_CachedStrFormat("<<z:1>>",questName), ZO_CachedStrFormat("<<z:1>>",GetString(LEOALT_CLOTHIER))) then return CRAFTING_TYPE_CLOTHIER end + if string.find(ZO_CachedStrFormat("<<z:1>>",questName), ZO_CachedStrFormat("<<z:1>>",GetString(LEOALT_ENCHANTER))) then return CRAFTING_TYPE_ENCHANTING end + if string.find(ZO_CachedStrFormat("<<z:1>>",questName), ZO_CachedStrFormat("<<z:1>>",GetString(LEOALT_JEWELRY))) then return CRAFTING_TYPE_JEWELRYCRAFTING end + if string.find(ZO_CachedStrFormat("<<z:1>>",questName), ZO_CachedStrFormat("<<z:1>>",GetString(LEOALT_PROVISIONER))) then return CRAFTING_TYPE_PROVISIONING end + if string.find(ZO_CachedStrFormat("<<z:1>>",questName), ZO_CachedStrFormat("<<z:1>>",GetString(LEOALT_WOODWORKER))) then return CRAFTING_TYPE_WOODWORKING end return nil end @@ -136,7 +136,29 @@ local function checkQuestForWrits(questName) end end -local function initCharsList() +local function initAccountData() + if LeoAltholic.globalData.AccountData == nil then LeoAltholic.globalData.AccountData = {} end + + local data = {} + + data.inventory = {} + data.inventory[BAG_BANK] = { + size = GetBagSize(BAG_BANK), + used = GetNumBagUsedSlots(BAG_BANK), + free = GetNumBagFreeSlots(BAG_BANK) + } + data.inventory[BAG_SUBSCRIBER_BANK] = { + size = GetBagSize(BAG_SUBSCRIBER_BANK), + used = GetNumBagUsedSlots(BAG_SUBSCRIBER_BANK), + free = GetNumBagFreeSlots(BAG_SUBSCRIBER_BANK) + } + + data.inventory.money = GetBankedMoney() + + LeoAltholic.globalData.AccountData = data +end + +local function initCharsData() if LeoAltholic.globalData.CharList == nil then LeoAltholic.globalData.CharList = {} end @@ -323,7 +345,7 @@ local function initCharsList() local data = { id = '$M' .. char.bio.name, name = char.bio.name, - info = zo_strformat(GetString(LEOALT_MOUNT_FINISHED), char.bio.name), + info = ZO_CachedStrFormat(GetString(LEOALT_MOUNT_FINISHED), char.bio.name), time = char.attributes.riding.time } LeoAltholic.AddToQueue(data) @@ -349,13 +371,13 @@ local function initCharsList() craft = craft, line = line, trait = trait, - time = remaining, - timeDone = remaining + GetTimeStamp() + remaining = remaining, + doneAt = remaining + GetTimeStamp() }) local data = { id = '$R' .. char.bio.name..craft..line..trait, charName = char.bio.name, - info = zo_strformat( + info = ZO_CachedStrFormat( GetString(LEOALT_RESEARCH_FINISHED) .. ': |c00FF00<<C:2>> <<C:3>>|r.', char.bio.name, GetString('SI_ITEMTRAITTYPE',traitType), @@ -369,7 +391,7 @@ local function initCharsList() end end table.sort(char.research.doing[craft], function(a, b) - return a.time < b.time + return a.remaining < b.remaining end) end @@ -442,7 +464,6 @@ local function initCharsList() if IsValidQuestIndex(i) then local quest = createQuestEntry(i) table.insert(char.quests.actives, quest) - checkQuestForWrits(quest.name) n = n + 1 end end @@ -608,8 +629,8 @@ local function onResearchStarted(eventCode, craft, line, trait) craft = craft, line = line, trait = trait, - time = remaining, - timeDone = remaining + GetTimeStamp() + remaining = remaining, + doneAt = remaining + GetTimeStamp() }) if LeoAltholic.IsTabVisible(LeoAltholic.TAB_RESEARCH) then LeoAltholicUI.researchList:RefreshData() @@ -641,7 +662,7 @@ local function onResearchCompleted(eventCode, craft, line, trait) local traitType = GetSmithingResearchLineTraitInfo(craft, line, trait) local name = GetUnitName("player") - local msg = zo_strformat( + local msg = ZO_CachedStrFormat( GetString(LEOALT_RESEARCH_FINISHED) .. ': |c00FF00<<C:2>> <<C:3>>|r.', name, GetString('SI_ITEMTRAITTYPE',traitType), @@ -693,7 +714,7 @@ local function createMessageQueue() local data = { id = '$M' .. char.bio.name, name = char.bio.name, - info = zo_strformat(GetString(LEOALT_MOUNT_FINISHED), char.bio.name), + info = ZO_CachedStrFormat(GetString(LEOALT_MOUNT_FINISHED), char.bio.name), time = char.attributes.riding.time } LeoAltholic.AddToQueue(data) @@ -704,23 +725,21 @@ local function createMessageQueue() local lineName, lineIcon = GetSmithingResearchLineInfo(research.craft, research.line) local traitType = GetSmithingResearchLineTraitInfo(research.craft, research.line, research.trait) local time - if research.timeDone ~= nil then - time = research.timeDone - else - time = research.time + GetTimeStamp() + if research.doneAt ~= nil then + time = research.doneAt + local data = { + id = '$R' .. char.bio.name..research.craft..research.line..research.trait, + charName = char.bio.name, + info = ZO_CachedStrFormat( + GetString(LEOALT_RESEARCH_FINISHED) .. ': |c00FF00<<C:2>> <<C:3>>|r.', + char.bio.name, + GetString('SI_ITEMTRAITTYPE',traitType), + lineName + ), + time = time + } + LeoAltholic.AddToQueue(data) end - local data = { - id = '$R' .. char.bio.name..research.craft..research.line..research.trait, - charName = char.bio.name, - info = zo_strformat( - GetString(LEOALT_RESEARCH_FINISHED) .. ': |c00FF00<<C:2>> <<C:3>>|r.', - char.bio.name, - GetString('SI_ITEMTRAITTYPE',traitType), - lineName - ), - time = time - } - LeoAltholic.AddToQueue(data) end end end @@ -812,7 +831,7 @@ local function trackQuest(questId, automatically) for _,trackedQuest in pairs(lookInto) do if (trackedQuest.name == quest.name) then if automatically ~= true then - LeoAltholic.log(zo_strformat(GetString(LEOALT_QUEST_ALREADY_TRACKED), quest.name)) + LeoAltholic.log(ZO_CachedStrFormat(GetString(LEOALT_QUEST_ALREADY_TRACKED), quest.name)) end return end @@ -884,7 +903,7 @@ local function onQuestComplete(eventCode, questName, level, previousExperience, for i,trackedQuest in pairs(LeoAltholic.globalData.CharList[LeoAltholic.CharName].quests.writs) do if (trackedQuest.name == questName) then LeoAltholic.globalData.CharList[LeoAltholic.CharName].quests.writs[i].lastDone = GetTimeStamp() - LeoAltholic.log(zo_strformat(GetString(LEOALT_QUEST_DONE_TODAY), questName)) + LeoAltholic.log(ZO_CachedStrFormat(GetString(LEOALT_QUEST_DONE_TODAY), questName)) LeoAltholicUI.writsList:RefreshData() LeoAltholicChecklistUI.doneWrit(trackedQuest.craft) return @@ -893,7 +912,7 @@ local function onQuestComplete(eventCode, questName, level, previousExperience, for i,trackedQuest in pairs(LeoAltholic.globalData.CharList[LeoAltholic.CharName].quests.tracked) do if (trackedQuest.name == questName) then LeoAltholic.globalData.CharList[LeoAltholic.CharName].quests.tracked[i].lastDone = GetTimeStamp() - LeoAltholic.log(zo_strformat(GetString(LEOALT_QUEST_DONE_TODAY), questName)) + LeoAltholic.log(ZO_CachedStrFormat(GetString(LEOALT_QUEST_DONE_TODAY), questName)) return end end @@ -975,7 +994,8 @@ local function initializeVars() migrateDataToV2() LeoAltholic.globalData.dataVersion = 2 end - initCharsList() + initCharsData() + initAccountData() end local function onGameMenuEnter() @@ -1047,8 +1067,9 @@ local function initialize() LeoAltholic.initialized = true CALLBACK_MANAGER:FireCallbacks("LeoAltholicInitialized") LeoAltholicToolbarUI:update() - LeoAltholicChecklistUI.updateQuests() + LeoAltholicChecklistUI.initializeQuests() LeoAltholicChecklistUI.update() + LeoAltholicUI:updateResearch() end local orig_ZO_QuestJournalNavigationEntry_OnMouseUp = ZO_QuestJournalNavigationEntry_OnMouseUp @@ -1078,7 +1099,8 @@ end local function onPlayerDeactivated(event, addonName) EVENT_MANAGER:UnregisterForEvent(LeoAltholic.Name, EVENT_PLAYER_DEACTIVATED) - initCharsList() + initCharsData() + initAccountData() end local function onRidingSkillImprovement(ridingSkill, previous, current, source) @@ -1096,6 +1118,7 @@ local function onRidingSkillImprovement(ridingSkill, previous, current, source) time = ridetime } LeoAltholicChecklistUI.doneRiding() + LeoAltholicUI.bioList:RefreshData() end local function onAddOnLoaded(event, addonName) diff --git a/LeoAltholic.txt b/LeoAltholic.txt index 8ead4e6..7ce4fe8 100644 --- a/LeoAltholic.txt +++ b/LeoAltholic.txt @@ -1,6 +1,6 @@ ## Title: Leo's Altholic ## APIVersion: 100024 100025 -## Version: 1.5.0 +## Version: 1.5.1 ## Author: |c39B027@LeandroSilva|r ## SavedVariables: LeoAltholicSavedVariables LeoAltholicCharVariables ## OptionalDependsOn: LibStub LibFeedback LibAddonMenu-2.0 diff --git a/LeoAltholic.xml b/LeoAltholic.xml index 8507f17..fdfb278 100644 --- a/LeoAltholic.xml +++ b/LeoAltholic.xml @@ -837,7 +837,8 @@ <Edge edgeSize="1"/> <Controls> <Control name="$(parent)ListScroll" inheritAlpha="true"> - <AnchorFill/> + <Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT" offsetX="0" offsetY="0" /> + <Dimensions x="1000" y="550"/> <Controls> <Control name="$(parent)Headers"> <Anchor point="TOPLEFT" relativeTo="$(parent)" relativePoint="TOPLEFT" offsetX="20" offsetY="20" /> @@ -888,7 +889,7 @@ </Controls> </Control> <Control name="$(parent)List" inherits="ZO_ScrollList"> - <Dimensions x="990" y="600" /> + <Dimensions x="990" y="500" /> <Anchor point="TOPLEFT" relativeTo="$(parent)Headers" relativePoint="BOTTOMLEFT" offsetY="30" /> </Control> </Controls> @@ -1823,6 +1824,7 @@ </Control> </Controls> </Backdrop> + </Controls> </TopLevelControl> @@ -1996,21 +1998,13 @@ <Dimensions x="30" y="30"/> <Anchor point="TOPRIGHT" relativeTo="$(parent)BGHeader" relativePoint="TOPRIGHT" offsetX="-2" offsetY="4"/> <Textures normal="/esoui/art/chatwindow/maximize_up.dds" mouseOver="/esoui/art/chatwindow/maximize_over.dds" mouseDown="esoui/art/chatwindow/maximize_down.dds" /> - <OnClicked> - LeoAltholicChecklistPanel:SetHidden(true) - LeoAltholicChecklistMinButton:SetHidden(true) - LeoAltholicChecklistMaxButton:SetHidden(false) - </OnClicked> + <OnClicked> LeoAltholicChecklistUI:MinimizeUI() </OnClicked> </Button> <Button name="$(parent)MaxButton" hidden="true" clickSound="Click" inheritAlpha="false"> <Dimensions x="30" y="30"/> <Anchor point="TOPRIGHT" relativeTo="$(parent)BGHeader" relativePoint="TOPRIGHT" offsetX="-2" offsetY="4"/> <Textures normal="/esoui/art/chatwindow/minimize_up.dds" mouseOver="/esoui/art/chatwindow/minimize_over.dds" mouseDown="esoui/art/chatwindow/minimize_down.dds" /> - <OnClicked> - LeoAltholicChecklistPanel:SetHidden(false) - LeoAltholicChecklistMinButton:SetHidden(false) - LeoAltholicChecklistMaxButton:SetHidden(true) - </OnClicked> + <OnClicked> LeoAltholicChecklistUI:MaximizeUI() </OnClicked> </Button> <Backdrop name="$(parent)Panel" centerColor="000000" edgeColor="222222" alpha="0.3" hidden="false"> diff --git a/LeoAltholicInit.lua b/LeoAltholicInit.lua index 9b8df86..0469c3d 100644 --- a/LeoAltholicInit.lua +++ b/LeoAltholicInit.lua @@ -6,7 +6,7 @@ LeoAltholicToolbarUI = LeoAltholicToolbarUI or {} LeoAltholic.name = "LeoAltholic" LeoAltholic.displayName = "Leo's Altholic" -LeoAltholic.version = "1.5.0" +LeoAltholic.version = "1.5.1" LeoAltholic.chatPrefix = "|c39B027" .. LeoAltholic.name .. "|r: " LeoAltholic.TAB_BIO = "Bio" diff --git a/LeoAltholicUI.lua b/LeoAltholicUI.lua index cb44761..39b28dd 100644 --- a/LeoAltholicUI.lua +++ b/LeoAltholicUI.lua @@ -29,7 +29,7 @@ function LeoAltholic.RestorePosition() LeoAltholicWindow:ClearAnchors() LeoAltholicWindow:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, left, top) LeoAltholicWindow:SetDrawLayer(DL_OVERLAY) - LeoAltholicWindow:SetDrawTier(DT_HIGH) + LeoAltholicWindow:SetDrawTier(DT_MEDIUM) end function LeoAltholic.ChangeInventoryUI(bagId) @@ -39,6 +39,8 @@ end function LeoAltholic.ShowInventoryUI(charName, bagId) LeoAltholic.listingInventoryFor = charName SCENE_MANAGER:ShowTopLevel(LeoAltholicInventoryWindow) + LeoAltholicInventoryWindow:SetDrawLayer(DL_OVERLAY) + LeoAltholicInventoryWindow:SetDrawTier(DT_MEDIUM) local char = LeoAltholic.GetCharByName(charName) local sc = WINDOW_MANAGER:GetControlByName("LeoAltholicInventoryWindowListScrollChild") sc:SetHidden(false) diff --git a/LeoAltholic_API.lua b/LeoAltholic_API.lua index 7a7cf76..0b09541 100644 --- a/LeoAltholic_API.lua +++ b/LeoAltholic_API.lua @@ -33,6 +33,7 @@ function LeoAltholic.FormatTime(seconds, short, colorizeCountdown) hms = SI_TIME_FORMAT_HHMMSS_DESC_SHORT, hour = SI_TIME_FORMAT_HOURS, ms = SI_TIME_FORMAT_MMSS_DESC_SHORT, + m = SI_TIME_FORMAT_MINUTES } if seconds and seconds > 0 then local ss = seconds % 60 @@ -50,17 +51,17 @@ function LeoAltholic.FormatTime(seconds, short, colorizeCountdown) local result = '' if dn > 0 then if short then - result = zo_strformat(GetString(formats.day), dn) .." "..zo_strformat(GetString(formats.hour), hhdnF) + result = ZO_CachedStrFormat(GetString(formats.day), dn) .." "..ZO_CachedStrFormat(GetString(formats.hour), hhdnF) else - result = zo_strformat(GetString(formats.dhm), dn, hhdnF, mmF) + result = ZO_CachedStrFormat(GetString(formats.dhm), dn, hhdnF, mmF) end elseif hh > 0 then if short then - result = zo_strformat(GetString(formats.hm), hhF, mmF) + result = ZO_CachedStrFormat(GetString(formats.hm), hhF, mmF) else - result = zo_strformat(GetString(formats.hms), hhF, mmF, ssF) + result = ZO_CachedStrFormat(GetString(formats.hms), hhF, mmF, ssF) end - elseif mm >= 0 then result = zo_strformat(GetString(formats.ms), mmF, ssF) + elseif mm >= 0 then result = ZO_CachedStrFormat(GetString(formats.ms), mmF, ssF) end if colorizeCountdown == true then if seconds < 3600 then result = '|c'..LeoAltholic.color.hex.red..result..'|r' @@ -69,7 +70,7 @@ function LeoAltholic.FormatTime(seconds, short, colorizeCountdown) else result = '|c'..LeoAltholic.color.hex.green..result..'|r' end end return result - else return '|cFF4020'..GetString(SI_GAMEPAD_CAMPAIGN_SCORING_DURATION_REMAINING_DONE)..'|r' end + else return '|cFF4020'..ZO_CachedStrFormat(GetString(formats.m), 0)..'|r' end end --[[ @@ -152,7 +153,7 @@ function LeoAltholic.GetResearchCounters(craft, charName) local lowest = -1 if #char.research.doing[craft] > 0 then local research = char.research.doing[craft][1] - lowest = research.time + lowest = research.doneAt end return #char.research.doing[craft], char.research.done[craft].max, lowest end diff --git a/Settings.lua b/Settings.lua index 74110d3..54b9313 100644 --- a/Settings.lua +++ b/Settings.lua @@ -170,11 +170,9 @@ function LeoAltholic_Settings:CreatePanel() type = "checkbox", name = GetString(LEOALT_BUMP_COMPASS), default = true, - getFunc = function() return LeoAltholic.globalData.settings.toolbar.bumpCompass end, - setFunc = function(value) - LeoAltholic.globalData.settings.toolbar.bumpCompass = value - LeoAltholicToolbarUI.bumpCompass() - end, + disabled = function() return not LeoAltholicToolbarUI.IsEnabled() end, + getFunc = LeoAltholicToolbarUI.GetBumpCompass, + setFunc = LeoAltholicToolbarUI.SetBumpCompass, },{ type = "submenu", name = GetString(SI_INVENTORY_MODE_ITEMS), diff --git a/ui/bio.lua b/ui/bio.lua index 9782975..03bb029 100644 --- a/ui/bio.lua +++ b/ui/bio.lua @@ -42,22 +42,22 @@ function LeoAltholicBioList:SetupEntry(control, data) control.race = GetControl(control, "Race") local raceName = GetRaceName(data.gender, data.raceId) or GetString(SI_UNKNOWN_RACE) - control.race:SetText(zo_strformat(SI_RACE_NAME, raceName)) + control.race:SetText(ZO_CachedStrFormat(SI_RACE_NAME, raceName)) control.class = GetControl(control, "Class") - control.class:SetText(zo_strformat(SI_CLASS_NAME, GetClassName(data.gender, data.classId))) + control.class:SetText(ZO_CachedStrFormat(SI_CLASS_NAME, GetClassName(data.gender, data.classId))) control.alliance = GetControl(control, "Alliance") local color, icon, allianceName if data.alliance.id == ALLIANCE_ALDMERI_DOMINION then icon = 'esoui/art/guild/guildbanner_icon_aldmeri.dds' - allianceName = zo_strformat(SI_ALLIANCE_NAME, GetAllianceName(ALLIANCE_ALDMERI_DOMINION)) + allianceName = ZO_CachedStrFormat(SI_ALLIANCE_NAME, GetAllianceName(ALLIANCE_ALDMERI_DOMINION)) elseif data.alliance.id == ALLIANCE_EBONHEART_PACT then icon = 'esoui/art/guild/guildbanner_icon_ebonheart.dds' - allianceName = zo_strformat(SI_ALLIANCE_NAME, GetAllianceName(ALLIANCE_EBONHEART_PACT)) + allianceName = ZO_CachedStrFormat(SI_ALLIANCE_NAME, GetAllianceName(ALLIANCE_EBONHEART_PACT)) elseif data.alliance.id == ALLIANCE_DAGGERFALL_COVENANT then icon = 'esoui/Art/guild/guildbanner_icon_daggerfall.dds' - allianceName = zo_strformat(SI_ALLIANCE_NAME, GetAllianceName(ALLIANCE_DAGGERFALL_COVENANT)) + allianceName = ZO_CachedStrFormat(SI_ALLIANCE_NAME, GetAllianceName(ALLIANCE_DAGGERFALL_COVENANT)) end control.alliance:SetText("|t30:30:" .. icon .. "|t ".. allianceName) diff --git a/ui/champion.lua b/ui/champion.lua index f700440..1158e2f 100644 --- a/ui/champion.lua +++ b/ui/champion.lua @@ -112,18 +112,19 @@ function LeoAltholicUI.TooltipChampionSkill(control, visible) local start = 2+(control.attribute-1)*3 for i=start, start+2 do if i == 10 then i = 1 end -- the lord exception - addLineTitle(InformationTooltip, GetChampionDisciplineName(i).." "..control.champion[control.attribute].disciplines[i].spent) + addLineTitle(InformationTooltip, ZO_CachedStrFormat(SI_ABILITY_NAME, GetChampionDisciplineName(i)).." "..control.champion[control.attribute].disciplines[i].spent) for j = 1, GetNumChampionDisciplineSkills(i) do - local skillName = GetChampionSkillName(i, j) + local skillName = ZO_CachedStrFormat(SI_ABILITY_NAME, GetChampionSkillName(i, j)) local points = control.champion[control.attribute].disciplines[i].skills[j] if type(points) == 'number' and points > 0 then - addLine(InformationTooltip, "|c" ..LeoAltholic.color.hex.eso.. skillName .. "|r " .. points) + addLine(InformationTooltip, "|c" ..LeoAltholic.color.hex.eso.. skillName .. "|r " .. points, ZO_SELECTED_TEXT) elseif points == true then addLine(InformationTooltip, "|c" ..LeoAltholic.color.hex.eso.. skillName .. "|r |c21A121"..GetString(LEOALT_UNLOCKED).."|r") end end end InformationTooltip:SetHidden(false) + InformationTooltipTopLevel:BringWindowToTop() else ClearTooltip(InformationTooltip) InformationTooltip:SetHidden(true) diff --git a/ui/checklist.lua b/ui/checklist.lua index 412e69d..799ce18 100644 --- a/ui/checklist.lua +++ b/ui/checklist.lua @@ -22,6 +22,14 @@ end function LeoAltholicChecklistUI.GetFontScale() return LeoAltholic.globalData.settings.checklist.fontScale or 100 end +function LeoAltholicChecklistUI.SetMinimized(value) + LeoAltholic.globalData.settings.checklist.minimized = value + LeoAltholicChecklistUI.update() +end +function LeoAltholicChecklistUI.IsMinimized() + if LeoAltholic.globalData.settings.checklist.minimized == nil then LeoAltholic.globalData.settings.checklist.minimized = false end + return LeoAltholic.globalData.settings.checklist.minimized +end function LeoAltholicChecklistUI.SetDisplayName(value) LeoAltholic.globalData.settings.checklist.displayName = value LeoAltholicChecklistUI.update() @@ -99,18 +107,63 @@ function LeoAltholicChecklistUI.RestorePosition() if LeoAltholicChecklistUI.IsEnabled() and not LeoAltholicChecklistUI.IsHideWhenToolbar() then if not LeoAltholicChecklistUI.checkAllDone() then LeoAltholicChecklist:SetHidden(false) + if LeoAltholicChecklistUI.IsMinimized() then + LeoAltholicChecklistUI.MinimizeUI() + end end else LeoAltholicChecklist:SetHidden(true) end end -local SPACE = 32 +local SPACE = 34 local checklist = WINDOW_MANAGER:GetControlByName("LeoAltholicChecklist") local panel = GetControl(checklist, "Panel") local height = 0 +local checklistHeight = 0 +local checklistSavedTop = 0 local lastChecklist = GetTimeStamp() +function LeoAltholicChecklistUI.MinimizeUI() + if not LeoAltholicChecklistUI.IsEnabled() then return end + + checklistSavedTop = checklist:GetTop() + + local header = GetControl(checklist, "BGHeader") + local headerHeight = header:GetHeight() + local headerTop = header:GetTop() + local headerBottom = header:GetBottom() + + panel:SetHidden(true) + LeoAltholicChecklistMinButton:SetHidden(true) + LeoAltholicChecklistMaxButton:SetHidden(false) + + checklist:SetHeight(headerHeight) + checklist:ClearAnchors() + + if LeoAltholicChecklistUI.IsUpwards() then + checklist:SetAnchor(BOTTOMLEFT, GuiRoot, TOPLEFT, checklist:GetLeft(), headerBottom) + else + checklist:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, checklist:GetLeft(), headerTop) + end + + LeoAltholicChecklistUI.SetMinimized(true) +end + +function LeoAltholicChecklistUI.MaximizeUI() + if not LeoAltholicChecklistUI.IsEnabled() then return end + + panel:SetHidden(false) + LeoAltholicChecklistMinButton:SetHidden(false) + LeoAltholicChecklistMaxButton:SetHidden(true) + + checklist:ClearAnchors() + checklist:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, checklist:GetLeft(), checklistSavedTop) + checklist:SetHeight(checklistHeight) + + LeoAltholicChecklistUI.SetMinimized(false) +end + local function createItem(label, labelText, texture, craftIcon, canShow) if canShow == true then texture:SetTexture("esoui/art/buttons/decline_up.dds") @@ -119,7 +172,8 @@ local function createItem(label, labelText, texture, craftIcon, canShow) texture:SetAnchor(TOPLEFT, panel, TOPLEFT, 10, height) texture.tooltip = "Quest not started" - height = height + SPACE + local scaledSpace = SPACE * (LeoAltholicChecklistUI.GetFontScale() / 100) + height = height + scaledSpace if LeoAltholicChecklistUI.DisplayName() then label:SetText(labelText) label:SetHidden(false) @@ -241,19 +295,38 @@ function LeoAltholicChecklistUI.doneRiding() doneItem(label, texture) end -function LeoAltholicChecklistUI.updateQuests() +function LeoAltholicChecklistUI.initializeQuests() for i,trackedQuest in pairs(LeoAltholic.globalData.CharList[LeoAltholic.CharName].quests.writs) do for questIndex = 1, MAX_JOURNAL_QUESTS do if IsValidQuestIndex(questIndex) and GetJournalQuestName(questIndex) == trackedQuest.name then + LeoAltholic.globalData.CharList[LeoAltholic.CharName].quests.writs[i].questIndex = questIndex + LeoAltholic.globalData.CharList[LeoAltholic.CharName].quests.writs[i].lastStarted = GetTimeStamp() + LeoAltholic.globalData.CharList[LeoAltholic.CharName].quests.writs[i].lastPreDeliver = nil + LeoAltholic.globalData.CharList[LeoAltholic.CharName].quests.writs[i].lastUpdated = nil + LeoAltholic.globalData.CharList[LeoAltholic.CharName].quests.writs[i].lastDone = nil + LeoAltholicChecklistUI.startedWrit(trackedQuest.craft) + + local hasUpdated = false local numConditions = GetJournalQuestNumConditions(questIndex, QUEST_MAIN_STEP_INDEX) for condition = 1, numConditions do + local current, max = GetJournalQuestConditionValues(questIndex, QUEST_MAIN_STEP_INDEX, condition) + if hasUpdated == false and current > 0 then + hasUpdated = true + end local condText = GetJournalQuestConditionInfo(questIndex, QUEST_MAIN_STEP_INDEX, condition) if string.find(condText, GetString(LEOALT_DELIVER)) then LeoAltholic.globalData.CharList[LeoAltholic.CharName].quests.writs[i].lastPreDeliver = GetTimeStamp() LeoAltholicChecklistUI.preDeliverWrit(trackedQuest.craft) + LeoAltholic.globalData.CharList[LeoAltholic.CharName].quests.writs[i].lastDone = nil + return end end + if hasUpdated then + LeoAltholic.globalData.CharList[LeoAltholic.CharName].quests.writs[i].lastUpdated = GetTimeStamp() + LeoAltholicChecklistUI.updateWrit(trackedQuest.craft) + LeoAltholic.globalData.CharList[LeoAltholic.CharName].quests.writs[i].lastDone = nil + end break end end @@ -274,11 +347,8 @@ function LeoAltholicChecklistUI.update() for _, craft in pairs(LeoAltholic.allCrafts) do label = GetControl(panel, "Craft"..craft) - label:SetScale(scale) craftIcon = GetControl(panel, "Craft"..craft.."Icon") - craftIcon:SetScale(scale) texture = GetControl(panel, "Craft"..craft.."Status") - texture:SetScale(scale) local isDone = false local isPreDeliver = false @@ -300,7 +370,7 @@ function LeoAltholicChecklistUI.update() local canShow = LeoAltholicChecklistUI.GetCraft(craft) - createItem(label, GetCraftingSkillName(craft), texture, craftIcon, canShow) + createItem(label, ZO_CachedStrFormat(SI_ABILITY_NAME, ZO_GetCraftingSkillName(craft)), texture, craftIcon, canShow) if canShow then if isDone then doneItem(label, texture) @@ -328,8 +398,9 @@ function LeoAltholicChecklistUI.update() LeoAltholicChecklistUI.checkAllDone() end - checklist:SetHeight(60 + height) - panel:SetHeight(10 + height) + checklistHeight = height + 2*(100 - LeoAltholicChecklistUI.GetFontScale()) + checklist:SetHeight(checklistHeight) + panel:SetHeight(checklistHeight) panel:ClearAnchors() local header = GetControl(checklist, "BGHeader") header:ClearAnchors() @@ -338,7 +409,7 @@ function LeoAltholicChecklistUI.update() panel:SetAnchor(BOTTOMLEFT, header, TOPLEFT, 0, 2) else header:SetAnchor(TOPLEFT, checklist, TOPLEFT, 0, 0) - panel:SetAnchor(TOPLEFT, checklist, TOPLEFT, 0, 40) + panel:SetAnchor(TOPLEFT, header, BOTTOMLEFT, 0, 2) end local width = 200 @@ -348,4 +419,6 @@ function LeoAltholicChecklistUI.update() checklist:SetWidth(width) panel:SetWidth(width) header:SetWidth(width) + + checklist:SetScale(scale) end diff --git a/ui/inventory.lua b/ui/inventory.lua index c1818e9..268ac50 100644 --- a/ui/inventory.lua +++ b/ui/inventory.lua @@ -140,3 +140,22 @@ function LeoAltholicInventoryList:FilterScrollList() table.insert(scrollData, ZO_ScrollList_CreateDataEntry(1, data)) end end + +function LeoAltholicUI.updateInventory() + + local data = LeoAltholic.globalData.AccountData + local panel = WINDOW_MANAGER:GetControlByName("LeoAltholicWindowInventoryPanel") + + local free = data.inventory[BAG_BANK].free + data.inventory[BAG_SUBSCRIBER_BANK].free + local used = data.inventory[BAG_BANK].used + data.inventory[BAG_SUBSCRIBER_BANK].used + local size = data.inventory[BAG_BANK].size + data.inventory[BAG_SUBSCRIBER_BANK].size + local color = '|c'..LeoAltholic.color.hex.green + if free <= 25 then color = '|c'..LeoAltholic.color.hex.orange end + if free <= 10 then color = '|c'..LeoAltholic.color.hex.red end + local bank = GetControl(panel, "Bank") + bank:SetText(color .. used .. "|r / " .. size) + + local control = GetControl(panel, "Gold") + control:SetText(formatNumber(data.inventory.money)) + +end diff --git a/ui/research.lua b/ui/research.lua index 05e0e36..171fd6a 100644 --- a/ui/research.lua +++ b/ui/research.lua @@ -43,16 +43,20 @@ function LeoAltholicResearchList:SetupEntry(control, data) local traitType = GetSmithingResearchLineTraitInfo(craft, research.line, research.trait) local traitName = GetString('SI_ITEMTRAITTYPE', traitType) - table.insert(list, { + local d = { craft = craft, line = research.line, trait = research.trait, lineName = lineName, lineIcon = lineIcon, traitName = traitName, - time = research.time, - timer = LeoAltholic.FormatTime(research.time, false, true) - }) + doneAt = research.doneAt, + timer = '' + } + if research.doneAt ~= nil then + d.timer = LeoAltholic.FormatTime(research.doneAt - GetTimeStamp(), false, true) + end + table.insert(list, d) end color = '|c'..LeoAltholic.color.hex.green if researching < data.research.done[craft].max then @@ -61,11 +65,13 @@ function LeoAltholicResearchList:SetupEntry(control, data) if researching > data.research.done[craft].max then researching = data.research.done[craft].max end local output = color .. researching .. '/' .. data.research.done[craft].max .. '|r' color = '|c'..LeoAltholic.color.hex.white - if first and first.time <= 3600 then + if first and first.doneAt ~= nil and first.doneAt - GetTimeStamp() <= 3600 then color = '|c'..LeoAltholic.color.hex.yellow end if #list > 0 then - output = output .. " " .. color..LeoAltholic.FormatTime(first.time, false, true) .. '|r' + if first.doneAt ~= nil then + output = output .. " " .. color..LeoAltholic.FormatTime(first.doneAt - GetTimeStamp(), false, true) .. '|r' + end end control.craft[craft]:SetText(output) control.craft[craft].list = list @@ -134,13 +140,14 @@ function LeoAltholicUI.TooltipResearch(control, visible) InitializeTooltip(InformationTooltip, control, LEFT, -30, 0) - addLineTitle(InformationTooltip, GetCraftingSkillName(control.list[1].craft)) + addLineTitle(InformationTooltip, ZO_CachedStrFormat(SI_ABILITY_NAME, GetCraftingSkillName(control.list[1].craft))) for _, trait in pairs(control.list) do addLine(InformationTooltip, "|t30:30:"..trait.lineIcon.."|t "..trait.lineName.." "..trait.traitName.." |cff0000"..trait.timer) end InformationTooltip:SetHidden(false) + InformationTooltipTopLevel:BringWindowToTop() else ClearTooltip(InformationTooltip) InformationTooltip:SetHidden(true) diff --git a/ui/skills.lua b/ui/skills.lua index 28aa386..d9fa161 100644 --- a/ui/skills.lua +++ b/ui/skills.lua @@ -226,16 +226,17 @@ function LeoAltholicUI.TooltipSkill(control, visible) InitializeTooltip(InformationTooltip, control, LEFT, 5, 0) - local title = control.tooltip.name + local title = ZO_CachedStrFormat(SI_ABILITY_NAME, control.tooltip.name) if control.tooltip.rank then title = title .." - ".. control.tooltip.rank end addLineTitle(InformationTooltip, title) for _, skill in pairs(control.tooltip.list) do - addLine(InformationTooltip, skill) + addLine(InformationTooltip, ZO_CachedStrFormat(SI_ABILITY_NAME, skill)) end InformationTooltip:SetHidden(false) + InformationTooltipTopLevel:BringWindowToTop() else ClearTooltip(InformationTooltip) InformationTooltip:SetHidden(true) diff --git a/ui/skills2.lua b/ui/skills2.lua index 9f4d6aa..6bf791d 100644 --- a/ui/skills2.lua +++ b/ui/skills2.lua @@ -43,7 +43,7 @@ function LeoAltholicSkills2List:SetupEntry(control, data) } for k, skill in ipairs(data.skills.world[i].list) do if data.skills.world[i].list[k].level == nil or data.skills.world[i].list[k].level > 0 then - table.insert(control.world[i].tooltip.list, data.skills.world[i].list[k].name) + table.insert(control.world[i].tooltip.list, ZO_CachedStrFormat(SI_ABILITY_NAME, data.skills.world[i].list[k].name)) end end else @@ -72,7 +72,7 @@ function LeoAltholicSkills2List:SetupEntry(control, data) } for k, skill in ipairs(data.skills.guild[i].list) do if data.skills.guild[i].list[k].level == nil or data.skills.guild[i].list[k].level > 0 then - table.insert(control.guild[i].tooltip.list, data.skills.guild[i].list[k].name) + table.insert(control.guild[i].tooltip.list, ZO_CachedStrFormat(SI_ABILITY_NAME, data.skills.guild[i].list[k].name)) end end else @@ -96,7 +96,7 @@ function LeoAltholicSkills2List:SetupEntry(control, data) } for k, skill in ipairs(data.skills.ava[i].list) do if data.skills.ava[i].list[k].level == nil or data.skills.ava[i].list[k].level > 0 then - table.insert(control.ava[i].tooltip.list, data.skills.ava[i].list[k].name) + table.insert(control.ava[i].tooltip.list, ZO_CachedStrFormat(SI_ABILITY_NAME, data.skills.ava[i].list[k].name)) end end else diff --git a/ui/toolbar.lua b/ui/toolbar.lua index b2fbe18..d6ddcdb 100644 --- a/ui/toolbar.lua +++ b/ui/toolbar.lua @@ -32,7 +32,7 @@ end function LeoAltholicToolbarUI.SetBumpCompass(value) LeoAltholic.globalData.settings.toolbar.bumpCompass = value - LeoAltholicToolbarUI.update() + LeoAltholicToolbarUI.BumpCompass() end function LeoAltholicToolbarUI.GetBumpCompass() if LeoAltholic.globalData.settings.toolbar.bumpCompass == nil then LeoAltholic.globalData.settings.toolbar.bumpCompass = false end @@ -58,6 +58,7 @@ function LeoAltholicToolbarUI.OnWindowMoveStop() x = LeoAltholicToolbar:GetLeft() + (guiRootX - x) LeoAltholicToolbar:ClearAnchors() LeoAltholicToolbar:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, x, LeoAltholicToolbar:GetTop()) + LeoAltholicToolbarUI.SetPosition(x, LeoAltholicToolbar:GetTop()) end LeoAltholicToolbarUI.SetPosition(LeoAltholicToolbar:GetLeft(), LeoAltholicToolbar:GetTop()) end @@ -123,6 +124,7 @@ function LeoAltholicUI.TooltipWarning(control, visible) end InformationTooltip:SetHidden(false) + InformationTooltipTopLevel:BringWindowToTop() else ClearTooltip(InformationTooltip) InformationTooltip:SetHidden(true) @@ -217,7 +219,7 @@ function LeoAltholicToolbarUI.update() if researching < total then color = '|cCB110E' end - label:SetText(color .. researching .. '/' .. total .. '|r ' .. LeoAltholic.FormatTime(lowest, true, true)) + label:SetText(color .. researching .. '/' .. total .. '|r ' .. LeoAltholic.FormatTime(lowest - GetTimeStamp(), true, true)) label:SetHidden(false) texture:SetHidden(false) texture:SetAnchor(TOPLEFT, toolbar, TOPLEFT, offsetX, 0) @@ -275,9 +277,10 @@ function LeoAltholicToolbarUI.update() end end + icon = GetControl(checklist, "RidingIcon") + icon:SetHidden(true) if char.attributes.riding.time - GetTimeStamp() < 0 then shownChecklist = true - icon = GetControl(checklist, "RidingIcon") icon:SetHidden(false) icon:SetColor(1,0,0,1) icon:SetAnchor(TOPLEFT, checklist, TOPLEFT, checklistOffsetX, -4) diff --git a/ui/tracked.lua b/ui/tracked.lua index d28c99e..6f8e0c4 100644 --- a/ui/tracked.lua +++ b/ui/tracked.lua @@ -51,7 +51,7 @@ function LeoAltholicUI.InitTrackedPanel() label:SetText(char.quests.tracked[i].name) label:SetHandler('OnMouseUp', function(control, button, upInside) if upInside == true and button == MOUSE_BUTTON_INDEX_RIGHT then - LeoAltholic.log(zo_strformat(GetString(LEOALT_REMOVED_FROM), label:GetText(), char.bio.name)) + LeoAltholic.log(ZO_CachedStrFormat(GetString(LEOALT_REMOVED_FROM), label:GetText(), char.bio.name)) table.remove(LeoAltholic.globalData.CharList[char.bio.name].quests.tracked, i) control:SetHidden(true) control:GetParent():GetNamedChild("Quest" .. index .. "Done"):SetHidden(true) @@ -63,11 +63,11 @@ function LeoAltholicUI.InitTrackedPanel() else local diff = GetTimeStamp() - char.quests.tracked[i].lastDone if diff < 3600 then - done:SetText(zo_strformat(GetString(SI_TIME_DURATION_AGO), zo_strformat(GetString(SI_TIME_FORMAT_MINUTES_DESC), math.floor(diff / 60)))) + done:SetText(ZO_CachedStrFormat(GetString(SI_TIME_DURATION_AGO), ZO_CachedStrFormat(GetString(SI_TIME_FORMAT_MINUTES_DESC), math.floor(diff / 60)))) elseif diff < 86400 then - done:SetText(zo_strformat(GetString(SI_TIME_DURATION_AGO), zo_strformat(GetString(SI_TIME_FORMAT_HOURS_DESC), math.floor(diff / 3600)))) + done:SetText(ZO_CachedStrFormat(GetString(SI_TIME_DURATION_AGO), ZO_CachedStrFormat(GetString(SI_TIME_FORMAT_HOURS_DESC), math.floor(diff / 3600)))) else - done:SetText(zo_strformat(GetString(SI_TIME_DURATION_AGO), zo_strformat(GetString(SI_TIME_FORMAT_DAYS_DESC), math.floor(diff / 86400)))) + done:SetText(ZO_CachedStrFormat(GetString(SI_TIME_DURATION_AGO), ZO_CachedStrFormat(GetString(SI_TIME_FORMAT_DAYS_DESC), math.floor(diff / 86400)))) end end else diff --git a/ui/writs.lua b/ui/writs.lua index a1ca831..57c2ccd 100644 --- a/ui/writs.lua +++ b/ui/writs.lua @@ -46,14 +46,14 @@ function LeoAltholicWritsList:SetupEntry(control, data) if writ.lastDone ~= nil then local diff = GetTimeStamp() - writ.lastDone if diff < 3600 then - ago = zo_strformat(GetString(SI_TIME_FORMAT_MINUTES), math.floor(diff / 60)) + ago = ZO_CachedStrFormat(GetString(SI_TIME_FORMAT_MINUTES), math.floor(diff / 60)) elseif diff < 86400 then - ago = zo_strformat(GetString(SI_TIME_FORMAT_HOURS), math.floor(diff / 3600)) + ago = ZO_CachedStrFormat(GetString(SI_TIME_FORMAT_HOURS), math.floor(diff / 3600)) else - ago = zo_strformat(GetString(SI_TIME_FORMAT_DAYS), math.floor(diff / 86400)) + ago = ZO_CachedStrFormat(GetString(SI_TIME_FORMAT_DAYS), math.floor(diff / 86400)) end else - ago = "|cCB110E"..GetString(SI_STR_TIME_UNKNOWN).."|r" + ago = "|cCB110E -- |r" end break end