fix inventory and max skills

Leandro Silva [02-03-20 - 13:56]
fix inventory and max skills
Filename
LeoAltholic.lua
LeoAltholic.txt
LeoAltholicInit.lua
LeoAltholicUI.lua
ui/skills.lua
ui/skills2.lua
diff --git a/LeoAltholic.lua b/LeoAltholic.lua
index 0431e96..c201c67 100644
--- a/LeoAltholic.lua
+++ b/LeoAltholic.lua
@@ -8,6 +8,33 @@ LeoAltholic.numUpdates = 0
 LeoAltholic.maxTraits = select(3,GetSmithingResearchLineInfo(1,1))
 LeoAltholic.jewelryMaxTraits = select(3,GetSmithingResearchLineInfo(7,1))

+local DARK_BROTHERHOOD = 118
+local THIEVES_GUILD = 117
+local LEGERDEMAIN = 111
+
+function LeoAltholic.GetMaxRank(skillType, skillLine)
+	if skillType == SKILL_TYPE_AVA or
+        skillType == SKILL_TYPE_GUILD then
+		local _, _, _, skillLineId = GetSkillLineInfo(skillType, skillLine)
+		if skillLineId == THIEVES_GUILD then
+			return 12
+		end
+		if skillLineId == DARK_BROTHERHOOD then
+			return 12
+		end
+		return 10
+	end
+	if skillType == SKILL_TYPE_WORLD then
+		local _, _, _, skillLineId = GetSkillLineInfo(skillType, skillLine)
+		if skillLineId == LEGERDEMAIN then
+			return 20
+		else
+			return 10
+		end
+	end
+	return 50
+end
+
 local function loadPlayerDataPart(skillType, baseElem)
     if skillType == nil then
         return
diff --git a/LeoAltholic.txt b/LeoAltholic.txt
index 1529254..33a2f4a 100644
--- a/LeoAltholic.txt
+++ b/LeoAltholic.txt
@@ -1,7 +1,7 @@
 ## Title: Leo's Altholic
 ## APIVersion: 100029 100030
-## Version: 1.7.1
-## AddOnVersion: 171
+## Version: 1.7.2
+## AddOnVersion: 172
 ## Author: |c39B027@LeandroSilva|r
 ## SavedVariables: LeoAltholicSavedVariables LeoAltholicCharVariables
 ## DependsOn: LibStub LibFeedback LibAddonMenu-2.0
diff --git a/LeoAltholicInit.lua b/LeoAltholicInit.lua
index 94dac25..00ecc82 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.7.1"
+LeoAltholic.version = "1.7.2"
 LeoAltholic.chatPrefix = "|c39B027" .. LeoAltholic.name .. "|r: "

 LeoAltholic.TAB_BIO = "Bio"
diff --git a/LeoAltholicUI.lua b/LeoAltholicUI.lua
index cd8a793..f2e7c20 100644
--- a/LeoAltholicUI.lua
+++ b/LeoAltholicUI.lua
@@ -66,8 +66,8 @@ function LeoAltholic.ShowInventoryUI(charName, bagId)
         texture:SetHidden(false)
         label:SetHidden(false)
         texture:SetTexture(GetItemLinkIcon(item.link))
+        local qty = row:GetNamedChild("Qty")
         if item.count > 1 then
-            local qty = row:GetNamedChild("Qty")
             qty:SetText(item.count)
             qty:SetHidden(false)
         else
diff --git a/ui/skills.lua b/ui/skills.lua
index d9fa161..8b1a117 100644
--- a/ui/skills.lua
+++ b/ui/skills.lua
@@ -31,12 +31,14 @@ function LeoAltholicSkillsList:SetupEntry(control, data)
     control.craft = {}
     for i = 1, 7 do
         control.craft[i] = GetControl(control, "Craft"..i)
+        control.craft[i].max = tonumber(50)
         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)
             control.craft[i].tooltip = {
                 name = data.skills.craft[i].name,
                 rank = data.skills.craft[i].rank,
+                max = control.craft[i].max,
                 id = data.skills.craft[i].id,
                 list = {}
             }
@@ -49,18 +51,19 @@ function LeoAltholicSkillsList:SetupEntry(control, data)
             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)
+        control.armor[i].max = tonumber(50)
         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)
             control.armor[i].tooltip = {
                 name = data.skills.armor[i].name,
                 rank = data.skills.armor[i].rank,
+                max = control.armor[i].max,
                 id = data.skills.armor[i].id,
                 list = {}
             }
@@ -73,18 +76,19 @@ function LeoAltholicSkillsList:SetupEntry(control, data)
             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)
+        control.weapon[i].max = tonumber(50)
         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)
             control.weapon[i].tooltip = {
                 name = data.skills.weapon[i].name,
                 rank = data.skills.weapon[i].rank,
+                max = control.weapon[i].max,
                 id = data.skills.weapon[i].id,
                 list = {}
             }
@@ -97,18 +101,19 @@ function LeoAltholicSkillsList:SetupEntry(control, data)
             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)
+        control.class[i].max = tonumber(50)
         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)
             control.class[i].tooltip = {
                 name = data.skills.class[i].name,
                 rank = data.skills.class[i].rank,
+                max = control.class[i].max,
                 id = data.skills.class[i].id,
                 list = {}
             }
@@ -121,16 +126,17 @@ function LeoAltholicSkillsList:SetupEntry(control, data)
             control.class[i]:SetText("-")
             control.class[i].number = tonumber(0)
         end
-        control.class[i].max = tonumber(50)
     end

     control.racial = GetControl(control, "Racial")
+    control.racial.max = tonumber(50)
     if data.skills.racial[1] then
         control.racial:SetText(data.skills.racial[1].rank)
         control.racial.number = tonumber(data.skills.racial[1].rank)
         control.racial.tooltip = {
             name = data.skills.racial[1].name,
             rank = data.skills.racial[1].rank,
+            max = control.racial.max,
             list = {}
         }
         if data.skills.racial[1].list then
@@ -144,7 +150,6 @@ function LeoAltholicSkillsList:SetupEntry(control, data)
         control.racial:SetText("-")
         control.racial.number = tonumber(0)
     end
-    control.racial.max = tonumber(50)


     ZO_SortFilterList.SetupRow(self, control, data)
@@ -227,9 +232,12 @@ function LeoAltholicUI.TooltipSkill(control, visible)
         InitializeTooltip(InformationTooltip, control, LEFT, 5, 0)

         local title = ZO_CachedStrFormat(SI_ABILITY_NAME, control.tooltip.name)
-        if  control.tooltip.rank then
+        if control.tooltip.rank then
             title = title  .." - ".. control.tooltip.rank
         end
+        if control.tooltip.max then
+            title = title  .." / ".. control.tooltip.max
+        end
         addLineTitle(InformationTooltip, title)

         for _, skill in pairs(control.tooltip.list) do
diff --git a/ui/skills2.lua b/ui/skills2.lua
index 6bf791d..1321bb4 100644
--- a/ui/skills2.lua
+++ b/ui/skills2.lua
@@ -32,12 +32,14 @@ function LeoAltholicSkills2List:SetupEntry(control, data)
     control.world = {}
     for i = 1, 4 do
         control.world[i] = GetControl(control, "World"..i)
+        control.world[i].max = LeoAltholic.GetMaxRank(SKILL_TYPE_WORLD, i)
         if data.skills.world[i] then
             control.world[i]:SetText(data.skills.world[i].rank)
             control.world[i].number = tonumber(data.skills.world[i].rank)
             control.world[i].tooltip = {
                 name = data.skills.world[i].name,
                 rank = data.skills.world[i].rank,
+                max = control.world[i].max,
                 id = data.skills.world[i].id,
                 list = {}
             }
@@ -50,23 +52,18 @@ function LeoAltholicSkills2List:SetupEntry(control, data)
             control.world[i]:SetText("-")
             control.world[i].number = tonumber(0)
         end
-        if i == 1 then
-            control.world[i].max = tonumber(20)
-        elseif i == 2 then
-            control.world[i].max = tonumber(6)
-        else
-            control.world[i].max = tonumber(10)
-        end
     end
     control.guild = {}
     for i = 1, 6 do
         control.guild[i] = GetControl(control, "Guild"..i)
+        control.guild[i].max = LeoAltholic.GetMaxRank(SKILL_TYPE_GUILD, i)
         if data.skills.guild[i] then
             control.guild[i]:SetText(data.skills.guild[i].rank)
             control.guild[i].number = tonumber(data.skills.guild[i].rank)
             control.guild[i].tooltip = {
                 name = data.skills.guild[i].name,
                 rank = data.skills.guild[i].rank,
+                max = control.guild[i].max,
                 id = data.skills.guild[i].id,
                 list = {}
             }
@@ -79,18 +76,19 @@ function LeoAltholicSkills2List:SetupEntry(control, data)
             control.guild[i]:SetText("-")
             control.guild[i].number = tonumber(0)
         end
-        control.guild[i].max = tonumber(10)
     end

     control.ava = {}
     for i = 1, 3 do
         control.ava[i] = GetControl(control, "AvA"..i)
+        control.ava[i].max = LeoAltholic.GetMaxRank(SKILL_TYPE_AVA, i)
         if data.skills.ava[i] then
             control.ava[i]:SetText(data.skills.ava[i].rank)
             control.ava[i].number = tonumber(data.skills.ava[i].rank)
             control.ava[i].tooltip = {
                 name = data.skills.ava[i].name,
                 rank = data.skills.ava[i].rank,
+                max = control.ava[i].max,
                 id = data.skills.ava[i].id,
                 list = {}
             }
@@ -103,7 +101,6 @@ function LeoAltholicSkills2List:SetupEntry(control, data)
             control.ava[i]:SetText("-")
             control.ava[i].number = tonumber(0)
         end
-        control.ava[i].max = tonumber(50)
     end

     ZO_SortFilterList.SetupRow(self, control, data)