| Tested: | Hour of Twilight 4.3 |
| Updated: | 04-03-12 09:10 PM |
| Created: | 01-21-10 01:48 AM |
| Downloads: | 2,223 |
| Favorites: | 7 |
| MD5: |
File Name |
Version |
Size |
Author |
Date |
113 |
13kB |
Lonny |
10-30-10 10:40 AM |
|
112 |
13kB |
Lonny |
05-29-10 06:39 PM |
|
111 |
12kB |
Lonny |
05-12-10 02:32 AM |
|
110 |
13kB |
Lonny |
03-16-10 12:32 PM |
|
100 |
7kB |
Lonny |
01-21-10 01:48 AM |
![]() |
Comment Options |
|
|
|
|
A Murloc Raider
Forum posts: 4
File comments: 63
Uploads: 0
|
Lonny,
I beat most of the time you don't hear this - I truly appreciate all the help you have given me. I have learned a lot from you so far. It amazes me that alot of addons have very complex to color text with class color, however your solution has to be about the most efficient that i have seen. What would you should for a panel? I am looking to be able to just place individual modules literally wherever i would like - other then that nothing much as far as features. |
|
|
|
|
|
|
Guest
Join Date: Not Yet
Forum posts: 0
File comments: 0
Uploads: 0
|
I've tested the panel, and unfortunately there is no way to tell the panel to resize the buttons to the same size of the content.
I'd suggest you to change panel, or write the author of the panel there's an issue and that he should deal with it. So to fix this, you can just remove the rested part from the title, like so. Code:
local _name, _addon = ...
local class = select(2, UnitClass("player"))
local UnitXP = UnitXP
local UnitXPMax = UnitXPMax
local GetXPExhaustion = GetXPExhaustion
local function toClassColor(text)
local color = RAID_CLASS_COLORS[class]
return ("|cff%.2x%.2x%.2x%s|r"):format(color.r * 255, color.g * 255, color.b * 255, text)
end
function _addon:GetXpStats()
local xp, xpMax = UnitXP("player"), UnitXPMax("player")
local xpPercent = xp / xpMax * 100
local rested = GetXPExhaustion() or 0
local restedPercent = rested / xpMax * 100
local tnl = xpMax - xp
local tnlPercent = (xpMax - xp) / xpMax * 100
return xp, xpMax, xpPercent, rested, restedPercent, tnl, tnlPercent
end
function _addon:ShowXpStats(tooltip)
tooltip:ClearLines()
tooltip:AddLine(self.name, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1)
tooltip:AddLine(" ")
local xp, xpMax, xpPercent, rested, restedPercent, tnl, tnlPercent = self:GetXpStats()
tooltip:AddDoubleLine("XP: ", ("|cffffffff%s / %s (%.1f%%)|r"):format(xp, xpMax, xpPercent))
if rested ~= 0 then
tooltip:AddDoubleLine("Rested: ", ("|cffffffff%s (%.1f%%)|r"):format(rested, restedPercent))
end
tooltip:AddDoubleLine("TNL: ", ("|cffffffff%s (%.1f%%)|r"):format(tnl, tnlPercent))
tooltip:Show()
end
function _addon:GetXpTitle()
local _, _, xpPercent = self:GetXpStats()
return toClassColor("Xp: ")..("%d%%"):format(xpPercent)
end
Last edited by : 01-27-10 at 04:35 PM.
|
|
|
|
|
|
|
A Murloc Raider
Forum posts: 4
File comments: 63
Uploads: 0
|
I think i figured it out (and this is fun trying)
function _addon:GetXpTitle() local _, _, xpPercent, rested, restedPercent = self:GetXpStats() local class = select(2, UnitClass("player")) if rested ~= 0 then return format("%s%s|r %.0f%% (%.0f%%)", toColorCode(RAID_CLASS_COLORS[class]), "XP: ", xpPercent, restedPercent) else return format("%s%s|r %.0f%%", toColorCode(RAID_CLASS_COLORS[class]), "XP: ", xpPercent) end end I have uploaded a screenshot of the look i was going for and the "doubleline" thing that happens when i have over 100% rested - any idea how to fix that (im using statblockcore) http://img718.imageshack.us/i/wowscrnshot012710163928.jpg/ ** your great addon is located just left of bags about 1/3 of the way in from the way left-top
Last edited by bossmansmith : 01-27-10 at 03:43 PM.
|
|
|
|
|
||
|
A Murloc Raider
Forum posts: 4
File comments: 63
Uploads: 0
|
Very close to what i wanted thanks for help.
To fine tune it - i would want the display to say "XP: 17%" with the XP: in class color and the 17% in default color. I really do appreciate your help.
|
|
|
|
|
|
||
|
A Murloc Raider
Forum posts: 4
File comments: 63
Uploads: 0
|
|
|
|
|
|
|
|
|
A Murloc Raider
Forum posts: 4
File comments: 63
Uploads: 0
|
I am trying to figure out how i can add classcolored "XP:" in front of the displayed value.
I have zero LUA programming before but this is where i am at: function _addon:GetXpTitle() local classColors = { ["DEATHKNIGHT"] = "c41f3b", ["DRUID"] = "ff7d0a", ["HUNTER"] = "abd473", ["MAGE"] = "69ccf0", ["PALADIN"] = "f58cba", ["PRIEST"] = "ffffff", ["ROGUE"] = "fff569", ["SHAMAN"] = "2459ff", ["WARLOCK"] = "9482ca", ["WARRIOR"] = "c79c6e", } local class = UnitClass("player") local classColor = classColors[class] local coloredXP = format("%s%s|r", classColor, "XP:") local _, _, xpPercent, rested, restedPercent = self:GetXpStats() if rested ~= 0 then return format("%.0f%% (%.0f%%)", xpPercent, restedPercent) --return format("%.1f%% (%.1f%%)", xpPercent, restedPercent) else return format("%s %.0f%%", coloredXP, xpPercent) end end i keep getting an error here : local coloredXP = format("%s%s|r", classColor, "XP:") saying: Interface\AddOns\Broker_LonnyXp\Internals.lua:50: bad argument #2 to 'format' (string expected, got nil) I know that class is registering correctly because i can get it to say "Druid" in front of the value just cant get druid colored XP: to show up I commented out the orginal 1 decimal place to make it fit correctly Your help would be aprpeciated
Last edited by bossmansmith : 01-27-10 at 12:16 PM.
|
|
|
|
|
||
|
Guest
Join Date: Not Yet
Forum posts: 0
File comments: 0
Uploads: 0
|
![]() |
|
|
|
|
|
|
|
A Murloc Raider
Forum posts: 4
File comments: 63
Uploads: 0
|
i figured out how to drop the decimal pt so it fits now - dont worry about the text saying xp not really worth it would be way too big
The text next to the icon went from one line 7.7% [150%] to 2 lines with 17.7% on top line and [150%] on 2nd line
Last edited by bossmansmith : 01-25-10 at 08:05 PM.
|
|
|
|
|
||
|
Guest
Join Date: Not Yet
Forum posts: 0
File comments: 0
Uploads: 0
|
I'm not going to add features to this addon as I want it to be as small as possible.
Last edited by : 01-25-10 at 07:56 PM.
|
|
|
|
|
|
|
|
A Murloc Raider
Forum posts: 4
File comments: 63
Uploads: 0
|
I had setup the broker addon and it was showing correctly until i logged to another character and the display went from 1 lines to 2 because the xp went from 7.7% to 28.3%.
Any way to fix this? Also is there a way to show xp as 1,500,000/3.500,000 as an option? And is there way to drop the decimal place from the % display? |
|
|
![]() |
You have just downloaded by the author . If you like this AddOn why not consider supporting the author? This author has set up a donation account. Donations ensure that authors can continue to develop useful tools for everyone.