Originally Posted by Baertram
Maybe your approach is not the correct one.
You'd need to find out each experience bar's name and then the control name of this bar, then use controlName:GetBarTypInfo(...) which is imo too much work.
Why don't you use events that give you the current and new XP + the reason why it was updated so you can easily see and get what you need?
http://wiki.esoui.com/Events#Experience
|
Thank you for your input Baertram!
That I noticed..
The problem Is that I'm already
always showing the PlayerProgressBar, so any time I gain Mages Guild experience, or Fighters Guild experience the appropriate bar fades in, show the current progress and then fall back to showing the player experience bar.
The PlayerProgressBar has a shared
total experience and
experience gain label anchored to the bar and the gain label has a
fade in/fade out effect that goes out of sync with the PlayerProgressBar fading in and out when I receive experience from different sources.
I have already registered to the different experience events, but I'm having trouble syncing my own fade effect with the default bar fade effect.
This Is roughly what I want:
Lua Code:
local function OnProgressBarShow(control)
-- find out what type of bar this is and display the values
end
local function OnProgressBarHide(control)
-- hide the labels
end
ZO_PreHookHandler(PLAYER_PROGRESS_BAR.control, 'OnShow', OnProgressBarShow);
ZO_PreHookHandler(PLAYER_PROGRESS_BAR.control, 'OnHide', OnProgressBarHide);
If you're interested you can see the source code here:
https://github.com/jwldnr/wProgressB...rogressBar.lua
Edit:
I understand that there are similar addons out there, doing roughly the same thing, but none of them handle "skill/guild experience" in a good way. The closest I can get is Harvens All Experience Bars but im having trouble adapting the code to suit my needs.
Another way to approach my problem would be to have individual experience labels for different skill lines, I already have a way of building the skill line index. (see code below)
The problem still remains: I don't know for how long the bar will be shown, so that I can switch back to player experience label once Mages Guild Progress is hidden again.
Lua Code:
function Addon:UpdateSkillLines()
self.skills = {};
for skillType = 1, GetNumSkillTypes() do
for skillIndex = 1, GetNumSkillLines(skillType) do
local lastRankXP, nextRankXP, currentXP = GetSkillLineXPInfo(skillType, skillIndex);
local current = GetPlayerSkillXP(currentXP, lastRankXP);
local index = skillType .. skillIndex;
self.skills[index] = {
gain = 0,
currentXP = current
};
end
end
end