LeoAltholicSkillsList = ZO_SortFilterList:Subclass() function LeoAltholicSkillsList:New(control) ZO_SortFilterList.InitializeSortFilterList(self, control) local sorterKeys = { ["name"] = {}, } self.masterList = {} self.currentSortKey = "name" self.currentSortOrder = ZO_SORT_ORDER_UP ZO_ScrollList_AddDataType(self.list, 1, "LeoAltholicSkillsListTemplate", 32, function(control, data) self:SetupEntry(control, data) end) self.sortFunction = function(listEntry1, listEntry2) return ZO_TableOrderingFunction(listEntry1.data, listEntry2.data, self.currentSortKey, sorterKeys, self.currentSortOrder) end return self end function LeoAltholicSkillsList:SetupEntry(control, data) control.data = data control.name = GetControl(control, "Name") control.name:SetText(data.name) control.craft = {} for i = 1, 7 do control.craft[i] = GetControl(control, "Craft"..i) if data.skills.craft[i] then control.craft[i]:SetText(data.skills.craft[i].rank) control.craft[i].number = tonumber(data.skills.craft[i].rank) else control.craft[i]:SetText("-") control.craft[i].number = tonumber(0) end control.craft[i].max = tonumber(50) end control.armor = {} for i = 1, 3 do control.armor[i] = GetControl(control, "Armor"..i) if data.skills.armor[i] then control.armor[i]:SetText(data.skills.armor[i].rank) control.armor[i].number = tonumber(data.skills.armor[i].rank) else control.armor[i]:SetText("-") control.armor[i].number = tonumber(0) end control.armor[i].max = tonumber(50) end control.weapon = {} for i = 1, 6 do control.weapon[i] = GetControl(control, "Weapon"..i) if data.skills.weapon[i] then control.weapon[i]:SetText(data.skills.weapon[i].rank) control.weapon[i].number = tonumber(data.skills.weapon[i].rank) else control.weapon[i]:SetText("-") control.weapon[i].number = tonumber(0) end control.weapon[i].max = tonumber(50) end control.class = {} for i = 1, 3 do control.class[i] = GetControl(control, "Class"..i) if data.skills.class[i] then control.class[i]:SetText(data.skills.class[i].rank) control.class[i].number = tonumber(data.skills.class[i].rank) else control.class[i]:SetText("-") control.class[i].number = tonumber(0) end control.class[i].max = tonumber(50) end control.racial = GetControl(control, "Racial") if data.skills.racial[1] then control.racial:SetText(data.skills.racial[1].rank) control.racial.number = tonumber(data.skills.racial[1].rank) else control.racial:SetText("-") control.racial.number = tonumber(0) end control.racial.max = tonumber(50) ZO_SortFilterList.SetupRow(self, control, data) end function LeoAltholicSkillsList:ColorRow(control, data, mouseIsOver) local color = ZO_SECOND_CONTRAST_TEXT local r, g, b = GetInterfaceColor(INTERFACE_COLOR_TYPE_ITEM_QUALITY_COLORS, ITEM_QUALITY_MAGIC) for i = 1, control:GetNumChildren() do local child = control:GetChild(i) if child:GetType() == CT_LABEL and string.find(child:GetName(), 'Name$') then if data.name == LeoAltholic.CharName then child:SetColor(r, g, b) else child:SetColor(color:UnpackRGBA()) end end if not child.nonRecolorable and child.number ~= nil then if child.number == child.max then child:SetColor(0, 1, 0, 1) elseif child.number > child.max * 0.8 then child:SetColor(1, 1, 0, 1) elseif child.number > child.max * 0.1 then child:SetColor(color:UnpackRGBA()) else child:SetColor(1, 0, 0, 1) end end end end function LeoAltholicSkillsList:BuildMasterList() self.masterList = {} local list = LeoAltholic.ExportCharacters(true) for k, v in ipairs(list) do local data = { name = v.bio.name, skills = v.skills } data.queueIndex = k table.insert(self.masterList, data) end end function LeoAltholicSkillsList:SortScrollList() local scrollData = ZO_ScrollList_GetDataList(self.list) table.sort(scrollData, self.sortFunction) end function LeoAltholicSkillsList:FilterScrollList() local scrollData = ZO_ScrollList_GetDataList(self.list) ZO_ClearNumericallyIndexedTable(scrollData) for i = 1, #self.masterList do local data = self.masterList[i] table.insert(scrollData, ZO_ScrollList_CreateDataEntry(1, data)) end end