diff --git a/LeoAltholic.lua b/LeoAltholic.lua
index a3e22a0..5764cfb 100644
--- a/LeoAltholic.lua
+++ b/LeoAltholic.lua
@@ -484,30 +484,18 @@ local function initCharsData()
end
char.champion = {}
- for _, attribute in ipairs({ATTRIBUTE_HEALTH, ATTRIBUTE_MAGICKA, ATTRIBUTE_STAMINA}) do
- char.champion[attribute] = {}
- char.champion[attribute].spent = 0
- char.champion[attribute].unspent = GetNumUnspentChampionPoints(attribute)
- char.champion[attribute].disciplines = {}
- end
-
- --[[
- for i = 1, GetNumChampionDisciplines() do
- local attribute = GetChampionDisciplineAttribute(i)
- char.champion[attribute].disciplines[i] = {
- spent = GetNumPointsSpentInChampionDiscipline(i),
+ for disciplineIndex = 1, GetNumChampionDisciplines() do
+ local disciplineId = GetChampionDisciplineId(disciplineIndex)
+ char.champion[disciplineIndex] = {
+ spent = GetNumSpentChampionPoints(disciplineId),
+ unspent = GetNumUnspentChampionPoints(disciplineId),
skills = {}
}
- char.champion[attribute].spent = char.champion[attribute].spent + char.champion[attribute].disciplines[i].spent
- for j = 1, GetNumChampionDisciplineSkills(i) do
- if WillChampionSkillBeUnlocked(i, j) then
- char.champion[attribute].disciplines[i].skills[j] = true
- else
- char.champion[attribute].disciplines[i].skills[j] = GetNumPointsSpentOnChampionSkill(i, j)
- end
+ for skill = 1, GetNumChampionDisciplineSkills(disciplineIndex) do
+ local id = GetChampionSkillId(disciplineIndex, skill)
+ char.champion[disciplineIndex].skills[skill] = GetNumPointsSpentOnChampionSkill(id)
end
end
- ]]
char.inventory = {}
char.inventory.size = GetBagSize(BAG_BACKPACK)
@@ -1161,6 +1149,21 @@ local function migrateDataToV2()
end
end
+local function migrateDataToV3()
+ if LeoAltholic.globalData.CharList == nil then return end -- fresh install?
+ for charName, char in pairs(LeoAltholic.globalData.CharList) do
+ for i = 1, GetNumChampionDisciplines() do
+ if LeoAltholic.globalData.CharList[charName].champion[i].disciplines or not LeoAltholic.globalData.CharList[charName].champion[i].spent then
+ LeoAltholic.globalData.CharList[charName].champion[i] = {
+ spent = 0,
+ unspent = 0,
+ skills = {}
+ }
+ end
+ end
+ end
+end
+
local function initializeVars()
local charDefault = {
settings = {
@@ -1215,11 +1218,16 @@ local function initializeVars()
migrateDataToV2()
LeoAltholic.globalData.dataVersion = 2
end
+ if LeoAltholic.globalData.dataVersion < 3 then
+ migrateDataToV3()
+ LeoAltholic.globalData.dataVersion = 3
+ end
if LeoAltholic.globalData.settings.inventory == nil then
LeoAltholic.globalData.settings.inventory = {
enabled = true
}
end
+
initCharsData()
initAccountData()
end
@@ -1353,6 +1361,23 @@ local function onRidingSkillImprovement(ridingSkill, previous, current, source)
LeoAltholicUI.bioList:RefreshData()
end
+local function onChampionPointsChanged()
+ LeoAltholic.globalData.CharList[LeoAltholic.CharName].champion = {}
+ for disciplineIndex = 1, GetNumChampionDisciplines() do
+ local disciplineId = GetChampionDisciplineId(disciplineIndex)
+ LeoAltholic.globalData.CharList[LeoAltholic.CharName].champion[disciplineIndex] = {
+ spent = GetNumSpentChampionPoints(disciplineId),
+ unspent = GetNumUnspentChampionPoints(disciplineId),
+ skills = {}
+ }
+ for skill = 1, GetNumChampionDisciplineSkills(disciplineIndex) do
+ local id = GetChampionSkillId(disciplineIndex, skill)
+ LeoAltholic.globalData.CharList[LeoAltholic.CharName].champion[disciplineIndex].skills[skill] = GetNumPointsSpentOnChampionSkill(id)
+ end
+ end
+ LeoAltholicUI.championList:RefreshData()
+end
+
local function onAddOnLoaded(event, addonName)
if addonName ~= LeoAltholic.name then return end
@@ -1410,6 +1435,9 @@ local function onAddOnLoaded(event, addonName)
ZO_PreHookHandler(ZO_MainMenuCategoryBar, "OnShow", onGameMenuEnter)
ZO_PreHookHandler(ZO_MainMenuCategoryBar, "OnHide", onGameMenuExit)
+ EVENT_MANAGER:RegisterForEvent(LeoAltholic.name, EVENT_CHAMPION_PURCHASE_RESULT, onChampionPointsChanged)
+ EVENT_MANAGER:RegisterForEvent(LeoAltholic.name, EVENT_CHAMPION_POINT_GAINED, onChampionPointsChanged)
+
LeoAltholic.log("started.")
end
diff --git a/LeoAltholic.txt b/LeoAltholic.txt
index f5235b0..fcaefff 100644
--- a/LeoAltholic.txt
+++ b/LeoAltholic.txt
@@ -1,7 +1,7 @@
## Title: Leo's Altholic
-## APIVersion: 100034
-## Version: 1.8.1
-## AddOnVersion: 1801
+## APIVersion: 100035
+## Version: 1.9.0
+## AddOnVersion: 1900
## Author: |c39B027@LeandroSilva|r
## SavedVariables: LeoAltholicSavedVariables LeoAltholicCharVariables
## DependsOn: LibFeedback LibAddonMenu-2.0
diff --git a/LeoAltholic.xml b/LeoAltholic.xml
index e079fe3..1fbe612 100644
--- a/LeoAltholic.xml
+++ b/LeoAltholic.xml
@@ -1671,21 +1671,21 @@
<Dimensions x="180" y="32" />
<Anchor point="TOPLEFT" relativeTo="$(parent)BG" relativePoint="TOPLEFT"/>
</Label>
- <Label name="$(parent)Disc234" font="LeoAltholicLargeFont" verticalAlignment="CENTER" horizontalAlignment="LEFT" mouseEnabled="true">
+ <Label name="$(parent)Disc1" font="LeoAltholicLargeFont" verticalAlignment="CENTER" horizontalAlignment="LEFT" mouseEnabled="true">
<Dimensions x="250" y="32" />
<Anchor point="TOPLEFT" relativeTo="$(parent)Name" relativePoint="TOPRIGHT" offsetX="10"/>
<OnMouseEnter> LeoAltholicUI.TooltipChampionSkill(self, true) </OnMouseEnter>
<OnMouseExit> LeoAltholicUI.TooltipChampionSkill(self, false) </OnMouseExit>
</Label>
- <Label name="$(parent)Disc567" font="LeoAltholicLargeFont" verticalAlignment="CENTER" horizontalAlignment="LEFT" mouseEnabled="true">
+ <Label name="$(parent)Disc2" font="LeoAltholicLargeFont" verticalAlignment="CENTER" horizontalAlignment="LEFT" mouseEnabled="true">
<Dimensions x="250" y="32" />
- <Anchor point="TOPLEFT" relativeTo="$(parent)Disc234" relativePoint="TOPRIGHT" offsetX="10"/>
+ <Anchor point="TOPLEFT" relativeTo="$(parent)Disc1" relativePoint="TOPRIGHT" offsetX="10"/>
<OnMouseEnter> LeoAltholicUI.TooltipChampionSkill(self, true) </OnMouseEnter>
<OnMouseExit> LeoAltholicUI.TooltipChampionSkill(self, false) </OnMouseExit>
</Label>
- <Label name="$(parent)Disc891" font="LeoAltholicLargeFont" verticalAlignment="CENTER" horizontalAlignment="LEFT" mouseEnabled="true">
+ <Label name="$(parent)Disc3" font="LeoAltholicLargeFont" verticalAlignment="CENTER" horizontalAlignment="LEFT" mouseEnabled="true">
<Dimensions x="250" y="32" />
- <Anchor point="TOPLEFT" relativeTo="$(parent)Disc567" relativePoint="TOPRIGHT" offsetX="10"/>
+ <Anchor point="TOPLEFT" relativeTo="$(parent)Disc2" relativePoint="TOPRIGHT" offsetX="10"/>
<OnMouseEnter> LeoAltholicUI.TooltipChampionSkill(self, true) </OnMouseEnter>
<OnMouseExit> LeoAltholicUI.TooltipChampionSkill(self, false) </OnMouseExit>
</Label>
diff --git a/LeoAltholicInit.lua b/LeoAltholicInit.lua
index 066f04b..293ffc8 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.8.0"
+LeoAltholic.version = "1.9.0"
LeoAltholic.chatPrefix = "|c39B027" .. LeoAltholic.name .. "|r: "
LeoAltholic.TAB_BIO = "Bio"
@@ -19,6 +19,10 @@ LeoAltholic.TAB_WRITS = "Writs"
LeoAltholic.TAB_INVENTORY = "Inventory"
LeoAltholic.TAB_RESEARCH = "Research"
+LeoAltholic.CHAMPION_WARFARE = 1
+LeoAltholic.CHAMPION_FITNESS = 2
+LeoAltholic.CHAMPION_CRAFT = 3
+
LeoAltholic.panelList = {
LeoAltholic.TAB_BIO,
LeoAltholic.TAB_STATS,
diff --git a/LeoAltholicUI.lua b/LeoAltholicUI.lua
index 63f15e0..f2e7c20 100644
--- a/LeoAltholicUI.lua
+++ b/LeoAltholicUI.lua
@@ -135,8 +135,8 @@ function LeoAltholicUI.InitPanels()
LeoAltholicUI.statsList = LeoAltholicStatsList:New(LeoAltholicWindowStatsPanelListScroll)
LeoAltholicUI.statsList:RefreshData()
- -- LeoAltholicUI.championList = LeoAltholicChampionList:New(LeoAltholicWindowChampionPanelListScroll)
- -- LeoAltholicUI.championList:RefreshData()
+ LeoAltholicUI.championList = LeoAltholicChampionList:New(LeoAltholicWindowChampionPanelListScroll)
+ LeoAltholicUI.championList:RefreshData()
LeoAltholicUI.skillsList = LeoAltholicSkillsList:New(LeoAltholicWindowSkillsPanelListScroll)
LeoAltholicUI.skillsList:RefreshData()
diff --git a/ui/champion.lua b/ui/champion.lua
index 1158e2f..72274f5 100644
--- a/ui/champion.lua
+++ b/ui/champion.lua
@@ -22,43 +22,30 @@ function LeoAltholicChampionList:New(control)
end
function LeoAltholicChampionList:SetupEntry(control, data)
-
control.data = data
control.name = GetControl(control, "Name")
control.name:SetText(data.name)
- local total, color
+ local icons = {
+ [LeoAltholic.CHAMPION_WARFARE] = "champion_points_magicka_icon",
+ [LeoAltholic.CHAMPION_FITNESS] = "champion_points_health_icon",
+ [LeoAltholic.CHAMPION_CRAFT] = "champion_points_stamina_icon"
+ }
- control.disc234 = GetControl(control, "Disc234")
- total = data.champion[ATTRIBUTE_HEALTH].spent + data.champion[ATTRIBUTE_HEALTH].unspent
- color = '|c'..LeoAltholic.color.hex.green
- if data.champion[ATTRIBUTE_HEALTH].unspent > 0 then
- color = '|c'..LeoAltholic.color.hex.red
- end
- control.disc234:SetText("|t24:24:esoui/art/tutorial/champion_points_health_icon.dds|t "..color .. data.champion[ATTRIBUTE_HEALTH].spent .. '/' .. total .. '|r ' .. data.champion[ATTRIBUTE_HEALTH].disciplines[2].spent .." / ".. data.champion[ATTRIBUTE_HEALTH].disciplines[3].spent .." / ".. data.champion[ATTRIBUTE_HEALTH].disciplines[4].spent)
- control.disc234.champion = data.champion
- control.disc234.attribute = ATTRIBUTE_HEALTH
-
- control.disc567 = GetControl(control, "Disc567")
- total = data.champion[ATTRIBUTE_MAGICKA].spent + data.champion[ATTRIBUTE_MAGICKA].unspent
- color = '|c'..LeoAltholic.color.hex.green
- if data.champion[ATTRIBUTE_MAGICKA].unspent > 0 then
- color = '|c'..LeoAltholic.color.hex.red
- end
- control.disc567:SetText("|t24:24:esoui/art/tutorial/champion_points_magicka_icon.dds|t "..color .. data.champion[ATTRIBUTE_MAGICKA].spent .. '/' .. total .. '|r ' .. data.champion[ATTRIBUTE_MAGICKA].disciplines[5].spent .." / ".. data.champion[ATTRIBUTE_MAGICKA].disciplines[6].spent .." / ".. data.champion[ATTRIBUTE_MAGICKA].disciplines[7].spent)
- control.disc567.champion = data.champion
- control.disc567.attribute = ATTRIBUTE_MAGICKA
-
- control.disc891 = GetControl(control, "Disc891")
- total = data.champion[ATTRIBUTE_STAMINA].spent + data.champion[ATTRIBUTE_STAMINA].unspent
- color = '|c'..LeoAltholic.color.hex.green
- if data.champion[ATTRIBUTE_STAMINA].unspent > 0 then
- color = '|c'..LeoAltholic.color.hex.red
+ control.disc = {};
+ for disciplineIndex = 1, GetNumChampionDisciplines() do
+ local disciplineId = GetChampionDisciplineId(disciplineIndex)
+ control.disc[disciplineIndex] = GetControl(control, "Disc" .. disciplineIndex)
+ local total = data.champion[disciplineIndex].spent + data.champion[disciplineIndex].unspent
+ local color = '|c'..LeoAltholic.color.hex.green
+ if data.champion[disciplineIndex].unspent > 0 then
+ color = '|c'..LeoAltholic.color.hex.red
+ end
+ control.disc[disciplineIndex]:SetText("|t24:24:esoui/art/tutorial/" .. icons[disciplineId] .. ".dds|t "..color .. data.champion[disciplineIndex].spent .. '/' .. total .. '|r ')
+ control.disc[disciplineIndex].champion = data.champion
+ control.disc[disciplineIndex].attribute = disciplineIndex
end
- control.disc891:SetText("|t24:24:esoui/art/tutorial/champion_points_stamina_icon.dds|t "..color .. data.champion[ATTRIBUTE_STAMINA].spent .. '/' .. total .. '|r ' .. data.champion[ATTRIBUTE_STAMINA].disciplines[8].spent .." / ".. data.champion[ATTRIBUTE_STAMINA].disciplines[9].spent .." / ".. data.champion[ATTRIBUTE_STAMINA].disciplines[1].spent)
- control.disc891.champion = data.champion
- control.disc891.attribute = ATTRIBUTE_STAMINA
ZO_SortFilterList.SetupRow(self, control, data)
end
@@ -104,22 +91,21 @@ end
function LeoAltholicUI.TooltipChampionSkill(control, visible)
+ local disciplineIndex = control.attribute
+ local disciplineId = GetChampionDisciplineId(control.attribute)
if visible then
- if not parent then parent = control end
-
InitializeTooltip(InformationTooltip, control, LEFT, 5, 0)
-
- 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, ZO_CachedStrFormat(SI_ABILITY_NAME, GetChampionDisciplineName(i)).." "..control.champion[control.attribute].disciplines[i].spent)
- for j = 1, GetNumChampionDisciplineSkills(i) do
- 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, ZO_SELECTED_TEXT)
- elseif points == true then
- addLine(InformationTooltip, "|c" ..LeoAltholic.color.hex.eso.. skillName .. "|r |c21A121"..GetString(LEOALT_UNLOCKED).."|r")
+ if control.champion[control.attribute] then
+ addLineTitle(InformationTooltip, GetChampionDisciplineName(disciplineId).." "..control.champion[control.attribute].spent)
+ for skill = 1, GetNumChampionDisciplineSkills(disciplineIndex) do
+ local id = GetChampionSkillId(disciplineIndex, skill)
+ local skillName = GetChampionSkillName(id)
+ local points = 0
+ if control.champion[control.attribute].skills[skill] then
+ points = control.champion[control.attribute].skills[skill]
+ if points > 0 then
+ addLine(InformationTooltip, "|c" ..LeoAltholic.color.hex.eso.. skillName .. "|r " .. points, ZO_SELECTED_TEXT)
+ end
end
end
end