LeoAltholic.hidden = true LeoAltholic.listingInventoryFor = 0 function LeoAltholic:OnWindowMoveStop() LeoAltholic.savedVariables.position = { left = LeoAltholicWindow:GetLeft(), top = LeoAltholicWindow:GetTop() } end function LeoAltholic:isHidden() return LeoAltholic.hidden end function LeoAltholic.RestorePosition() local position = LeoAltholic.savedVariables.position or { left = 100; top = 100; } local left = position.left local top = position.top LeoAltholicWindow:ClearAnchors() LeoAltholicWindow:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, left, top) end function LeoAltholic.ChangeInventoryUI(bagId) LeoAltholic.ShowInventoryUI(LeoAltholic.listingInventoryFor, bagId) end function LeoAltholic.ShowInventoryUI(charId, bagId) LeoAltholic.listingInventoryFor = charId SCENE_MANAGER:ShowTopLevel(LeoAltholicInventoryWindow) LeoAltholicInventoryWindow:SetHidden(false) local char = LeoAltholic.GetCharacters()[charId] local sc = WINDOW_MANAGER:GetControlByName("LeoAltholicInventoryWindowListScrollChild") sc:SetHidden(false) local i = 1 for x = 1, sc:GetNumChildren() do sc:GetChild(x):SetHidden(true) end for _, item in pairs(LeoAltholic.GetItems(char, bagId)) do local row = WINDOW_MANAGER:GetControlByName("LeoAltholicInventoryWindowRow" .. i) if not row then row = CreateControlFromVirtual("LeoAltholicInventoryWindowRow" .. i, sc, "LeoAltholicInventoryTemplate") end local control = row:GetNamedChild("Item") control:SetHidden(false) local qty = "" if item.count > 1 then qty = " (" .. item.count ..")" end control:SetText(zo_iconFormat(GetItemLinkIcon(item.link), 25, 25) .." ".. item.link .. qty) control:SetHandler("OnMouseEnter", function(self) InitializeTooltip(LeoAltholicItemToolTip, LeoAltholicInventoryWindow, TOPLEFT, -450, 50, TOPLEFT) LeoAltholicItemToolTip:SetLink(item.link) end ) control:SetHandler("OnMouseExit", function(self) ClearTooltip(LeoAltholicItemToolTip) end ) row:SetAnchor(TOPLEFT, sc, TOPLEFT, 2, (i - 1) * 30) row:SetHidden(false) i = i + 1 end sc:SetHeight(i * 30) end function LeoAltholic.HideInventoryUI() SCENE_MANAGER:HideTopLevel(LeoAltholicInventoryWindow) LeoAltholicInventoryWindow:SetHidden(true) end function LeoAltholic.ShowUI() SCENE_MANAGER:ShowTopLevel(LeoAltholicWindow) LeoAltholicWindow:SetHidden(false) LeoAltholic.hidden = false; LeoAltholic.ShowTab(LeoAltholic.savedVariables.activeTab or "Bio") end function LeoAltholic.HideUI() SCENE_MANAGER:HideTopLevel(LeoAltholicWindow) LeoAltholicWindow:SetHidden(true) LeoAltholic.HideInventoryUI() LeoAltholic.hidden = true; end function LeoAltholic.ToggleUI() if LeoAltholic:isHidden() then LeoAltholic.ShowUI() else LeoAltholic.HideUI() end end function LeoAltholic.ShowTab(tab) LeoAltholic.savedVariables.activeTab = tab LeoAltholicWindowTitle:SetText(LeoAltholic.displayName .. " v" .. LeoAltholic.version .. " - " .. tab) local control for _,panel in ipairs(LeoAltholic.panelList) do control = WINDOW_MANAGER:GetControlByName('LeoAltholicWindow' .. panel .. 'Panel') control:SetHidden(true) end control = WINDOW_MANAGER:GetControlByName("LeoAltholicWindow" .. tab .. "Panel") control:SetHidden(false) end function LeoAltholic.InitializeCharacterFrames() for x,char in pairs(LeoAltholic.GetCharacters()) do for _,panel in ipairs(LeoAltholic.panelList) do local sc = WINDOW_MANAGER:GetControlByName("LeoAltholicWindow"..panel.."PanelScrollChild") local row = CreateControlFromVirtual("LeoAltholic"..panel.."Row" .. x, sc, "LeoAltholic"..panel.."RowTemplate") row:SetHidden(false) local anchorY = 109; if panel == "Champion" then anchorY = 139 elseif panel == "Research" then anchorY = 262 elseif panel == "Skills" then anchorY = 522 end row:SetAnchor(TOPLEFT,sc,TOPLEFT,0,(x - 1) * anchorY) if char.bio.name == LeoAltholic.CharName then local control = row:GetNamedChild("BG") control:SetCenterColor(unpack({0.2,0.2,0.2,1 })) control:SetEdgeColor(0.22,0.77,0.22,1) end if panel == "Champion" then for i = 1, GetNumChampionDisciplines() do local dispName = GetChampionDisciplineName(i) local dAttribute = GetChampionDisciplineAttribute(i) local label = row:GetNamedChild("Disc"..i.."Label") label:SetText(dispName) label:SetHandler('OnMouseEnter', function(self) LeoAltholic.TooltipChampionSkill(self, true, x, dAttribute, i) end) label:SetHandler('OnMouseExit', function(self) LeoAltholic.TooltipChampionSkill(self, false) end) end elseif panel == "Inventory" then control = row:GetNamedChild("ListButton") control:SetHandler('OnClicked', function() LeoAltholic.ShowInventoryUI(x, BAG_BACKPACK) end) elseif panel == "Research" then for _,craft in pairs(LeoAltholic.craftResearch) do local label = row:GetNamedChild("Craft"..craft.."Label") label:SetText(GetCraftingSkillName(craft)) end elseif panel == "Skills" then local c = 1 for i = 1, 3 do if char.skills.class[i] then control = row:GetNamedChild("Class"..c.."Label") control:SetText(char.skills.class[i].name) control:SetHandler('OnMouseEnter', function(self) LeoAltholic.TooltipSkill(self, true, x, "class", i) end) control:SetHandler('OnMouseExit', function(self) LeoAltholic.TooltipSkill(self, false) end) control = row:GetNamedChild("Class"..c.."Rank") control:SetText(char.skills.class[i].rank) c = c + 1 end end c = 1 for i = 1, 3 do if char.skills.armor[i] then control = row:GetNamedChild("Armor"..c.."Label") control:SetText(char.skills.armor[i].name) control:SetHandler('OnMouseEnter', function(self) LeoAltholic.TooltipSkill(self, true, x, "armor", i) end) control:SetHandler('OnMouseExit', function(self) LeoAltholic.TooltipSkill(self, false) end) control = row:GetNamedChild("Armor"..c.."Rank") control:SetText(char.skills.armor[i].rank) c = c + 1 end end c = 1 for i = 1, 6 do if char.skills.weapon[i] then control = row:GetNamedChild("Weapon"..c.."Label") control:SetText(char.skills.weapon[i].name) control:SetHandler('OnMouseEnter', function(self) LeoAltholic.TooltipSkill(self, true, x, "weapon", i) end) control:SetHandler('OnMouseExit', function(self) LeoAltholic.TooltipSkill(self, false) end) control = row:GetNamedChild("Weapon"..c.."Rank") control:SetText(char.skills.weapon[i].rank) c = c + 1 end end c = 1 for i = 1, 7 do if char.skills.craft[i] then control = row:GetNamedChild("Craft"..c.."Label") control:SetText(char.skills.craft[i].name) control:SetHandler('OnMouseEnter', function(self) LeoAltholic.TooltipSkill(self, true, x, "craft", i) end) control:SetHandler('OnMouseExit', function(self) LeoAltholic.TooltipSkill(self, false) end) control = row:GetNamedChild("Craft"..c.."Rank") control:SetText(char.skills.craft[i].rank) c = c + 1 end end c = 1 for i = 1, 6 do if char.skills.guild[i] then control = row:GetNamedChild("Guild"..c.."Label") control:SetText(char.skills.guild[i].name) control:SetHandler('OnMouseEnter', function(self) LeoAltholic.TooltipSkill(self, true, x, "guild", i) end) control:SetHandler('OnMouseExit', function(self) LeoAltholic.TooltipSkill(self, false) end) control = row:GetNamedChild("Guild"..c.."Rank") control:SetText(char.skills.guild[i].rank) c = c + 1 end end c = 1 for i = 1, 4 do if char.skills.world[i] then control = row:GetNamedChild("World"..c.."Label") control:SetText(char.skills.world[i].name) control:SetHandler('OnMouseEnter', function(self) LeoAltholic.TooltipSkill(self, true, x, "world", i) end) control:SetHandler('OnMouseExit', function(self) LeoAltholic.TooltipSkill(self, false) end) control = row:GetNamedChild("World"..c.."Rank") control:SetText(char.skills.world[i].rank) c = c + 1 end end c = 1 for i = 1, 3 do if char.skills.ava[i] then control = row:GetNamedChild("Alliance"..c.."Label") control:SetText(char.skills.ava[i].name) control:SetHandler('OnMouseEnter', function(self) LeoAltholic.TooltipSkill(self, true, x, "ava", i) end) control:SetHandler('OnMouseExit', function(self) LeoAltholic.TooltipSkill(self, false) end) control = row:GetNamedChild("Alliance"..c.."Rank") control:SetText(char.skills.ava[i].rank) c = c + 1 end end if char.skills.racial[1] then control = row:GetNamedChild("Racial1Label") control:SetText(char.skills.racial[1].name) control:SetHandler('OnMouseEnter', function(self) LeoAltholic.TooltipSkill(self, true, x, "racial", 1) end) control:SetHandler('OnMouseExit', function(self) LeoAltholic.TooltipSkill(self, false) end) control = row:GetNamedChild("Racial1Rank") control:SetText(char.skills.racial[1].rank) end end end end end function LeoAltholic.GetTime(seconds) if seconds and seconds > 0 then local ss = seconds % 60 local mm = math.floor(seconds / 60) local hh = math.floor(mm / 60) mm = mm % 60 local dn = math.floor(hh / 24) local result = '' if dn > 0 then result = tostring(dn) .. "d " .. tostring (hh - (dn*24)) .. "h" elseif hh > 0 then result = tostring (hh) .. "h " .. tostring (mm) .. "m" elseif mm > 0 then result = mm .. "m " .. ss .. "s" end return result else return '|cFF4020finished|r' end end function LeoAltholic.TooltipChampionSkill(control, visible, charId, attribute, discipline) if visible then if not parent then parent = control end control.text = InformationTooltip InitializeTooltip(control.text,control,2,1,0,8) local char = LeoAltholic.GetCharacters()[charId] local added = false for j = 1, GetNumChampionDisciplineSkills(discipline) do local skillName = GetChampionSkillName(discipline, j) local points = char.champion[attribute].disciplines[discipline].skills[j] if type(points) == 'number' and points > 0 then control.text:AddLine("|cE8DFAF" .. skillName .. "|r " .. points) added = true elseif points == true then control.text:AddLine("|cE8DFAF" .. skillName .. "|r |c21A121unlocked|r") added = true end end if added then control.text:SetHidden(false) else control.text:SetHidden(true) end else ClearTooltip(control.text) control.text:SetHidden(true) control.text = nil end end function LeoAltholic.TooltipSkill(control, visible, charId, line, lineId) if visible then if not parent then parent = control end control.text = InformationTooltip InitializeTooltip(control.text,control,2,1,0,8) local char = LeoAltholic.GetCharacters()[charId] local added = false for _, s in pairs(char.skills[line][lineId].list) do local skillName = s.name local rank = s.earnedRank control.text:AddLine("|cE8DFAF" .. skillName .. "|r " .. rank) added = true end if added then control.text:SetHidden(false) else control.text:SetHidden(true) end else ClearTooltip(control.text) control.text:SetHidden(true) control.text = nil end end function LeoAltholic.DisplayCharacterFrames() local control for _,panel in ipairs(LeoAltholic.panelList) do control = WINDOW_MANAGER:GetControlByName('LeoAltholicWindow' .. panel .. 'PanelScrollChild') control:SetHeight(#LeoAltholic.GetCharacters() * 109) end control = WINDOW_MANAGER:GetControlByName('LeoAltholicWindowChampionPanelScrollChild') control:SetHeight(#LeoAltholic.GetCharacters() * 139) control = WINDOW_MANAGER:GetControlByName('LeoAltholicWindowResearchPanelScrollChild') control:SetHeight(#LeoAltholic.GetCharacters() * 262) control = WINDOW_MANAGER:GetControlByName('LeoAltholicWindowSkillsPanelScrollChild') control:SetHeight(#LeoAltholic.GetCharacters() * 522) for x,char in pairs(LeoAltholic.GetCharacters()) do for _,panel in ipairs(LeoAltholic.panelList) do local row = WINDOW_MANAGER:GetControlByName('LeoAltholic' .. panel .. 'Row'..x) control = row:GetNamedChild("Alliance") local icon = ZO_GetAllianceIcon(char.bio.alliance.id) control:SetText("|cF1FF77|t50:90:" .. icon .. "|t|r ") control.data = char.bio.alliance.name control = row:GetNamedChild("Name") control:SetText(char.bio.name) control = row:GetNamedChild("RaceClass") control:SetText(char.bio.race .. " " .. char.bio.class) end local row = WINDOW_MANAGER:GetControlByName('LeoAltholicBioRow'..x) control = row:GetNamedChild("Level") if char.bio.isChampion then control:SetText("|t24:24:esoui/art/champion/champion_icon.dds|t" .. char.bio.championPoints) else control:SetText(char.bio.level) end control = row:GetNamedChild("AllianceRank") control:SetText(GetAvARankName(char.bio.gender, char.bio.alliance.rank)) control = row:GetNamedChild("AttributePoints") control:SetText(char.attributes.unspent) control = row:GetNamedChild("Played") control:SetText(LeoAltholic.GetTime(char.secondsPlayed)) control = row:GetNamedChild("Bounty") control:SetText(char.bounty .. " |t14:14:esoui/art/currency/currency_gold.dds|t") local riding = '|t20:20:esoui/art/mounts/ridingskill_speed.dds|t ' .. char.attributes.riding.speed .. '%' .. ' |t20:20:esoui/art/mounts/ridingskill_stamina.dds|t ' .. char.attributes.riding.stamina .. ' |t20:20:esoui/art/mounts/ridingskill_capacity.dds|t ' .. char.attributes.riding.capacity .. ' |t22:22:esoui/art/miscellaneous/timer_32.dds|t ' .. LeoAltholic.GetTime(char.attributes.riding.time - GetTimeStamp()) control = row:GetNamedChild("Riding") control:SetText(riding) row = WINDOW_MANAGER:GetControlByName('LeoAltholicStatsRow'..x) control = row:GetNamedChild("AttributePoints") control:SetText("|c596cfd" .. char.attributes.magicka.points .. "|r / |cCB110E" .. char.attributes.health.points .. "|r / |c21A121" .. char.attributes.stamina.points .. "|r") control = row:GetNamedChild("MaxAttributes") control:SetText("|c596cfd" .. char.attributes.magicka.max .. "|r / |cCB110E" .. char.attributes.health.max .. "|r / |c21A121" .. char.attributes.stamina.max .. "|r") control = row:GetNamedChild("RecoveryAttributes") control:SetText("|c596cfd" .. char.attributes.magicka.recovery .. "|r / |cCB110E" .. char.attributes.health.recovery .. "|r / |c21A121" .. char.attributes.stamina.recovery .. "|r") control = row:GetNamedChild("SpellPoints") control:SetText(string.format("%.1f%%", char.attributes.spell.criticalChance)) control = row:GetNamedChild("WeaponPoints") control:SetText(string.format("%.1f%%", char.attributes.weapon.criticalChance)) row = WINDOW_MANAGER:GetControlByName('LeoAltholicChampionRow'..x) for _, attribute in ipairs({ATTRIBUTE_MAGICKA, ATTRIBUTE_HEALTH, ATTRIBUTE_STAMINA}) do control = row:GetNamedChild("Attribute" .. attribute) local total = char.champion[attribute].spent + char.champion[attribute].unspent local color = '|c21A121' if char.champion[attribute].unspent > 0 then color = '|cCB110E' end control:SetText(color .. char.champion[attribute].spent .. '/' .. total .. '|r') end for i = 1, GetNumChampionDisciplines() do local dAttribute = GetChampionDisciplineAttribute(i) control = row:GetNamedChild("Disc" .. i) control:SetText(char.champion[dAttribute].disciplines[i].spent) end row = WINDOW_MANAGER:GetControlByName('LeoAltholicInventoryRow'..x) local color = '|c21A121' if char.inventory.free <= 25 then color = '|c596cfd' end if char.inventory.free <= 10 then color = '|cCB110E' end control = row:GetNamedChild("Bag") control:SetText(color .. char.inventory.used .. "|r / " .. char.inventory.size) control = row:GetNamedChild("SoulGems") control:SetText("|c21A121" .. char.inventory.soulGemFilled .. '|r / ' .. char.inventory.soulGemEmpty) control = row:GetNamedChild("Gold") control:SetText(LeoAltholic.formatNumber(char.inventory.gold)) control = row:GetNamedChild("AP") control:SetText(LeoAltholic.formatNumber(char.inventory.ap)) control = row:GetNamedChild("TelVar") control:SetText(LeoAltholic.formatNumber(char.inventory.telvar)) control = row:GetNamedChild("Writ") control:SetText(LeoAltholic.formatNumber(char.inventory.writVoucher)) row = WINDOW_MANAGER:GetControlByName('LeoAltholicResearchRow'..x) for _,craft in pairs(LeoAltholic.craftResearch) do local i = 1 local researching = 0 for line = 1, GetNumSmithingResearchLines(craft) do local lineName, lineIcon = GetSmithingResearchLineInfo(craft, line) for trait = 1, LeoAltholic.maxTraits do local traitType = GetSmithingResearchLineTraitInfo(craft, line, trait) local traitName = GetString('SI_ITEMTRAITTYPE',traitType) local traitData = char.research[craft][line][trait] if type(traitData) == 'number' then control = row:GetNamedChild("Craft"..craft.."Label"..i) control:SetText(' |t28:28:'..lineIcon..'|t ' .. traitName) control:SetHandler('OnMouseEnter', function(self) ZO_Tooltips_ShowTextTooltip(self, TOP, lineName) end) control:SetHandler("OnMouseExit", function () ZO_Tooltips_HideTextTooltip() end) control = row:GetNamedChild("Craft"..craft.."Timer"..i) control:SetText(LeoAltholic.GetTime(traitData - GetTimeStamp())) i = i + 1 researching = researching + 1 end end end control = row:GetNamedChild("Craft"..craft) color = '|c21A121' if researching < char.research[craft].max then color = '|cCB110E' end control:SetText(color .. researching .. '/' .. char.research[craft].max .. '|r') end end end function LeoAltholic:OnUpdate() if LeoAltholic:isHidden() then return end local control for x,char in pairs(LeoAltholic.GetCharacters()) do local riding = '|t20:20:esoui/art/mounts/ridingskill_speed.dds|t ' .. char.attributes.riding.speed .. '%' .. ' |t20:20:esoui/art/mounts/ridingskill_stamina.dds|t ' .. char.attributes.riding.stamina .. ' |t20:20:esoui/art/mounts/ridingskill_capacity.dds|t ' .. char.attributes.riding.capacity .. ' |t22:22:esoui/art/miscellaneous/timer_32.dds|t ' .. LeoAltholic.GetTime(char.attributes.riding.time - GetTimeStamp()) local row = WINDOW_MANAGER:GetControlByName('LeoAltholicBioRow'..x) control = row:GetNamedChild('Riding') control:SetText(riding) row = WINDOW_MANAGER:GetControlByName('LeoAltholicResearchRow'..x) for _,craft in pairs(LeoAltholic.craftResearch) do local i = 1 for line = 1, GetNumSmithingResearchLines(craft) do for trait = 1, LeoAltholic.maxTraits do local traitData = char.research[craft][line][trait] if type(traitData) == 'number' then control = row:GetNamedChild("Craft"..craft.."Timer"..i) control:SetText(LeoAltholic.GetTime(traitData - GetTimeStamp())) i = i + 1 end end end end end end ZO_CreateStringId('SI_BINDING_NAME_LEOALTHOLIC_TOGGLE_WINDOW', "Show/Hide Main Window")