 |
06/22/09, 8:52 PM
|
#76
|
|
Piston Honda
|
Sofa: This indicator should do exactly what you want. It will display the letters that you had in your code, colored grey or blue. It checks for the appropriate buff family, which is handy for nearly all these buffs.

local i = 1
local int,fort,spirit,shadow,mark,kings,wisdom,might= false,false,false,false,false,false,false,false,false
local air,aig,aib = 127,127,127
local fr,fg,fb = 127,127,127
local sr,sg,sb = 127,127,127
local spr,spg,spb = 127,127,127
local wr,wg,wb = 127,127,127
local bkr,bkg,bkb = 127,127,127
local bwr,bwg,bwb = 127,127,127
local bmr,bmg,bmb = 127,127,127
while true do
local name,_,icon = UnitAura(unit,i,"HELPFUL")
if not name then
break
elseif name == "Arcane Intellect" then
in = true
elseif name == "Dalaran Intellect" then
int = true
elseif name == "Arcane Brilliance" then
int = true
elseif name == "Dalaran Brilliance" then
int = true
elseif name == "Power Word: Fortitude" then
fort = true
elseif name == "Prayer of Fortitude" then
fort = true
elseif name == "Divine Spirit" then
spirit = true
elseif name == "Prayer of Spirit" then
spirit = true
elseif name == "shadow Protection" then
shadow = true
elseif name == "Prayer of Shadow Protection" then
shadow = true
elseif name == "Mark of the Wild" then
mark = true
elseif name == "Gift of the Wild" then
mark = true
elseif name == "Blessing of Kings" then
kings = true
elseif name == "Greater Blessing of Kings" then
kings = true
elseif name == "Blessing of Wisdom" then
wisdom = true
elseif name == "Greater Blessing of Wisdom" then
wisdom = true
elseif name == "Blessing of Might" then
might = true
elseif name == "Greater Blessing of Might" then
might = true
end
i = i + 1
end
if int then
air,aig,aib = 0,138,255
end
if fort then
fr,fg,fb = 0,138,255
end
if spirit then
sr,sg,sb = 0,138,255
end
if shadow then
spr,spg,spb = 0,138,255
end
if mark then
wr,wg,wb = 0,138,255
end
if kings then
bkr,bkg,bkb = 0,138,255
end
if wisdom then
bwr,bwg,bwb = 0,138,255
end
if might then
bmr,bmg,bmb = 0,138,255
end
return "|cff%02x%02x%02xAI|r |cff%02x%02x%02xF|r |cff%02x%02x%02xS|r |cff%02x%02x%02xSP|r |cff%02x%02x%02xW|r |cff%02x%02x%02xBK|r |cff%02x%02x%02xBW|r |cff%02x%02x%02xBM|r" ,air,aig,aib,fr,fg,fb,sr,sg,sb,spr,spg,spb,wr,wg,wb,bkr,bkg,bkb,bwr,bwg,bwb,bmr,bmg,bmb
Last edited by Hotan : 06/22/09 at 9:06 PM.
|
correlation =/= causation
|
|
|
06/23/09, 7:33 PM
|
#77
|
|
Von Kaiser
|
Just a note. I know a lot of people have questions. But please don't PM me your questions. Just post them here. It's better if I answer them here because then everyone benefits from my answers. Alternatively, someone else might be able to answer your question before I can and then you get a faster answer.
Thanks.
|
|
|
|
|
06/23/09, 11:11 PM
|
#78
|
|
Glass Joe
|
I'm trying to come up with an lua code to show the status of my rejuv and regrowth on a raid member. Basically I'd want the indicators (which in my case would be the letters J and G) to be green if the duration of the hot is greater than 6 seconds, yellow if it's 3-6 seconds, and red if it's on its last tick. It's also important that it only shows *my* hots, of course - but I think i've gotten that part down.
This is what I'm using at the moment. It doesn't update in colors at all.
local i=1
rj,rg='','',''
while true do
local n,_,_,c,_,_,e,u=UnitAura(unit,i,"HELPFUL")
if not n then
break
elseif u=="player" then
if n=="Rejuvenation" then
rj='|cFF00FF00J|r'
elseif n=="Regrowth" then
rg='|cFF00FF00G|r'
end
end
i=i+1
end
return '%s%s',rg,rj
For lifebloom I'm using the wonderful code listed on p91 of the WowAce thread. It changes color based on the number of stacks, and a number is given indicating how much time is left. This is absolutely positively perfect for its purpose, and I don't want to change a thing. I was hoping that I'd be able to glean the information I needed from it to modify the above code, but thus far I've been unsuccessful.
For reference:
if not lifebloom_count then
lifebloom_count = {}
end
if not lifebloom_expire then
lifebloom_expire = {}
end
if event ~= "_timer" then
local i=1
local found = false
while true do
local n,_,_,c,_,_,e,u=UnitAura(unit,i,"HELPFUL")
if not n then
break
elseif u=="player" then
if n=="Lifebloom" then
found = true
lifebloom_count[font_string] = c
lifebloom_expire[font_string] = e
end
end
i = i + 1
end
if not found then
lifebloom_count[font_string] = nil
lifebloom_expire[font_string] = nil
end
end
local c = lifebloom_count[font_string]
local e = lifebloom_expire[font_string] or 0
local d=ceil(e-GetTime(),1)
if d > 0 then
UpdateIn(0.2)
if c==3 then
return '|cFF00FF00%s|r',d
elseif c==2 then
return '|cFFFFFF00%s|r',d
elseif c==1 then
return '|cFFFF0000%s|r',d
end
end
Any help would be most appreciated. I'm sure there are lots of druids out there wanting the same info.
Last edited by Crytz : 06/23/09 at 11:14 PM.
Reason: Oops! copied the wrong code
|
|
|
|
|
06/24/09, 5:10 PM
|
#79
|
|
Glass Joe
Blood Elf Priest
Tarren Mill (EU)
|
I know this a lot to ask, but if someone could find the time to convert some of these tags it would be greatly appreciated.
[if IsMouseOver then
HP:Hide(0)
else
PercentHP:Short:Hide(100):Hide(0) Alpha(0.75)
end]
[(if HasMagicDebuff then
"!"
end) Alpha(0.75)]
[(if IsMouseOver then
PercentMP:Hide(100):Short
else
PercentHP:Hide(100):Hide(0):Short
end) Alpha(0.75)]
[(if CastName then
CastName:Lower
else
Name:Lower
end) Alpha(0.75)]
[(if HasAura("Power Word: Fortitude") or HasAura("Prayer of Fortitude") or Dead or Offline then
""
else
"! "
end) (if HasMagicDebuff then
"magic "
end) (if HasDiseaseDebuff then
"disease "
end) PercentHP:Short:Hide(100):Hide(0) (if Dead then
"dead"
end) (if Offline then
"off"
end) Alpha(0.5)]
|
|
|
|
|
06/24/09, 6:07 PM
|
#80
|
|
Piston Honda
|
Originally Posted by henrik_s
[if IsMouseOver then
HP:Hide(0)
else
PercentHP:Short:Hide(100):Hide(0) Alpha(0.75)
end]
|
local cur,max = HP(unit),MaxHP(unit)
if cur~=0 then
if IsMouseOver() then
return cur
else
Alpha(0.75)
return "%s%%",Percent(cur,max)
end
end
Originally Posted by henrik_s
[(if HasMagicDebuff then
"!"
end) Alpha(0.75)]
|
local mag=false
while true do
local type = UnitDebuff(unit,i,false)
if not type then
break
elseif type=="Magic" then
mag=true
end
end
if mag then
Alpha(0.75)
return "!"
end
Originally Posted by henrik_s
[(if CastName then
CastName:Lower
else
Name:Lower
end) Alpha(0.75)]
|
local spell = UnitCastingInfo(unit)
Alpha(0.75)
if not spell then
spell = UnitChannelInfo(unit)
end
if spell then
return spell
else
return Name(unit)
end
Originally Posted by henrik_s
[(if IsMouseOver then
PercentMP:Hide(100):Short
else
PercentHP:Hide(100):Hide(0):Short
end) Alpha(0.75)]
|
I'm not sure what the point of the "Short" is, so I left it out
if IsMouseOver() then
local curmp,maxmp=Power(unit),MaxPower(unit)
if curmp~=maxmp then
return "%s%%",Percent(curmp,maxmp)
end
else
local curhp,maxhp=HP(unit),MaxHP(unit)
if curhp~=maxhp then
Alpha(0.75)
return "%s%%",Percent(curhp,maxhp)
end
end
Originally Posted by henrik_s
[(if HasAura("Power Word: Fortitude") or HasAura("Prayer of Fortitude") or Dead or Offline then
""
else
"! "
end) (if HasMagicDebuff then
"magic "
end) (if HasDiseaseDebuff then
"disease "
end) PercentHP:Short:Hide(100):Hide(0) (if Dead then
"dead"
end) (if Offline then
"off"
end) Alpha(0.5)]
|
local fort,mag,dis=true,false,false
local s=Status(unit)
local i=1
Alpha(0.5)
while true do
local name,_,icon = UnitAura(unit,i,"HELPFUL")
if not name then
break
elseif name == "Power Word: Fortitude" then
fort = false
elseif name == "Prayer of Fortitude" then
fort = false
end
i=i+1
end
i=1
while true do
local type = UnitDebuff(unit,i,false)
if not type then
break
elseif type == "Magic" then
mag = true
elseif type == "Disease" then
dis = true
end
i=i+1
end
if s=='Dead' then
s='dead'
elseif s=='offline' then
s='off'
else
s=''
end
if s then
fort=false
end
return "%s%s%s%s",fort and "!",mag and "magic",dis and "disease",s
Last edited by Hotan : 06/28/09 at 9:18 PM.
Reason: added alphas
|
correlation =/= causation
|
|
|
06/24/09, 6:22 PM
|
#81
|
|
Glass Joe
Night Elf Priest
Azjol-Nerub (EU)
|
Right now im using
local s = Status(unit)
if s then
return s
end
local cur, max = HP(unit), MaxHP(unit)
if UnitIsFriend(unit,"player") then
local miss = max - cur
if miss ~= 0 then
return "-%d",miss
else
return VeryShort(max)
end
else
return "%s/%s",Short(cur,true),Short(max,true)
end
But the status part shows "feign death" and im wondering if/how to make feign death display some other text (like FD or perhapps Feigned) to make it fit better into my pretty small raidframes.
I have [Name][druidform 2 letters][Mana] --- [HP/status] when someone is dead or DC the Mana text hides making room for the longer text, but not with FD
Last edited by Zeelian : 06/24/09 at 6:27 PM.
|
|
|
|
|
06/24/09, 7:00 PM
|
#82
|
|
Piston Honda
|
Originally Posted by Zeelian
But the status part shows "feign death" and im wondering if/how to make feign death display some other text (like FD or perhapps Feigned) to make it fit better into my pretty small raidframes.
|
local s = Status(unit)
if s=="Feign Death" then
s="Feign"
end
if s then
return s
end
local cur, max = HP(unit), MaxHP(unit)
if UnitIsFriend(unit,"player") then
local miss = max - cur
if miss ~= 0 then
return "-%d",miss
else
return VeryShort(max)
end
else
return "%s/%s",Short(cur,true),Short(max,true)
end
I just added this bit:
if s=="Feign Death" then
s="Feign"
end
If my capitalization is incorrect, just make the minor change in that regards, although I am assuming it isn't 'feign death'
|
correlation =/= causation
|
|
|
06/24/09, 7:35 PM
|
#83
|
|
Von Kaiser
|
Originally Posted by Hotan
I just added this bit:
if s=="Feign Death" then
s="Feign"
end
If my capitalization is incorrect, just make the minor change in that regards, although I am assuming it isn't 'feign death'
|
I'd do this:
if s then
if s == "Feign Death" then
s = "FD"
end
return s
end
Just a slightly nitpicky change. We already have to test s to see if it's nil, no point in testing it twice when unless it passes one of the tests the other one is irrelevent. If the code used s later on down then it would have to change. But in this case the above is better.
|
|
|
|
|
06/24/09, 7:37 PM
|
#84
|
|
Von Kaiser
|
Originally Posted by Hotan
I'm not sure what the point of the "Short" is, so I left it out
|
There is no point. Somehow it ended up on some of the percent tags in the default tags for PB in the past and it's been in many modified tags as a result. If you want to drop the decimal parts of the percent Round is what you should use. But Short is entirely pointless on a percent.
|
|
|
|
|
06/24/09, 8:55 PM
|
#85
|
|
Glass Joe
Night Elf Priest
Azjol-Nerub (EU)
|
Managed to make some changes to my mana code to make the FD short a bit redundant for Raid on the healer, but will be well used on the smaller raidframes planned for the non healers.
Basically changed my mana text to:
local s = Status(unit)
if s then
return ''
else
if UnitPowerType(unit) == 0 then
local max = MaxPower(unit)
local cur = Power(unit)
if max > 0 and cur ~= max then
return "%s%%",Percent(cur,max)
else
return Short(max)
end
end
end
Causing it to hide whenever the status part of the HP text is triggered, making plenty of room for it to show without cutting into any other text.
Probably far from optimized code, but its working.
|
|
|
|
|
06/25/09, 8:50 AM
|
#86
|
|
Glass Joe
Blood Elf Priest
Tarren Mill (EU)
|
|
Originally Posted by Hotan
*snip*
|
Wow, thanks a bunch!
edit:
I'm having a few problems. The biggest one is that the Fortitude/Status/Debuff tag is causing WoW to crash.
Is there a way to drop the decimals in the health percentage? I tried adding %02x to no avail. Also, it doesn't seem to hide at 100% HP.
The name/castname is working great, updating much faster than the DogTag one. I would love it to be in lower case letters though, is this possible in Lua?
Whereas in TBC I raided with PitBull (raid frames) and Discord (player/target) simultaneously, now both (on their own) bog my performance down enormously. I was shocked entering my first LK raid, suddenly dropping to 2-5 FPS in combat. I had to raid without custom unit frames. When the PitBull4 alpha was released I was excited to find out I could replicate my Discord frames coupled with the awesome powers of DogTags. Unfortunately It didn't work out as I had hoped. The performance tax is not as bad as Discord, but i reckon it still halves my FPS. If LuaTexts can help this, I would be a happy camper. And I guess it would be worth it to learn some Lua, even though it's quite intimidating to a programming illiterate such as myself.
|
There is no point. Somehow it ended up on some of the percent tags in the default tags for PB in the past and it's been in many modified tags as a result. If you want to drop the decimal parts of the percent Round is what you should use. But Short is entirely pointless on a percent.
|
Seems to work for me.
Last edited by henrik_s : 06/25/09 at 10:45 AM.
|
|
|
|
|
06/25/09, 2:11 PM
|
#87
|
|
Piston Honda
|
Originally Posted by henrik_s
I'm having a few problems. The biggest one is that the Fortitude/Status/Debuff tag is causing WoW to crash.
|
No idea
Originally Posted by henrik_s
Is there a way to drop the decimals in the health percentage? I tried adding %02x to no avail. Also, it doesn't seem to hide at 100% HP.
|
local cur,max = HP(unit),MaxHP(unit)
if cur~=0 then
if IsMouseOver() then
return cur
else
return "%s%%",Round(Percent(cur,max),0)
end
end
Originally Posted by henrik_s
The name/castname is working great, updating much faster than the DogTag one. I would love it to be in lower case letters though, is this possible in Lua?
|
local spell = UnitCastingInfo(unit)
if not spell then
spell = UnitChannelInfo(unit)
end
if spell then
return strlower(spell)
else
return strlower(Name(unit))
end
|
correlation =/= causation
|
|
|
06/25/09, 2:26 PM
|
#88
|
|
Glass Joe
Blood Elf Priest
Tarren Mill (EU)
|
Excellent! Thanks again.
I'll try splitting up the larger tag and see what happens.
|
Too cool for holy school.
|
|
|
06/25/09, 4:00 PM
|
#89
|
|
Von Kaiser
|
Originally Posted by henrik_s
Wow, thanks a bunch! 
I'm having a few problems. The biggest one is that the Fortitude/Status/Debuff tag is causing WoW to crash.
|
The code is missing the i = i + 1 that it needed. Making it an infinite loop and thus the wow crash.
local fort,mag,dis=true,false,false
local s=Status(unit)
local i = 1
while true do
local name,_,icon = UnitAura(unit,i,"HELPFUL")
if not name then
break
elseif name == "Power Word: Fortitude" then
fort = false
elseif name == "Prayer of Fortitude" then
fort = false
end
i = i + 1
end
i = 1
while true do
local type = UnitDebuff(unit,i,false)
if not type then
break
elseif type == "Magic" then
mag = true
elseif type == "Disease" then
dis = true
end
i = i + 1
end
if s=='Dead' then
s='dead'
elseif s=='offline' then
s='off'
else
s=''
end
if s then
fort=false
end
return "%s%s%s%s",fort and "!",mag and "magic",dis and "disease",s
That should fix the crashes. I haven't tested the code though.
|
Is there a way to drop the decimals in the health percentage? I tried adding %02x to no avail. Also, it doesn't seem to hide at 100% HP.
|
You've got a couple options... If you want to round it you can use:
Round(percent,0) where the percent is the percent you need to Round. If you just want to drop the decimal you can just use %d as the format string.
|
The name/castname is working great, updating much faster than the DogTag one. I would love it to be in lower case letters though, is this possible in Lua?
|
Use string.lower on the variable. E.G.
return "%s",string.lower(x)
Where x is what you wanted in lower case.
|
Whereas in TBC I raided with PitBull (raid frames) and Discord (player/target) simultaneously, now both (on their own) bog my performance down enormously. I was shocked entering my first LK raid, suddenly dropping to 2-5 FPS in combat. I had to raid without custom unit frames. When the PitBull4 alpha was released I was excited to find out I could replicate my Discord frames coupled with the awesome powers of DogTags. Unfortunately It didn't work out as I had hoped. The performance tax is not as bad as Discord, but i reckon it still halves my FPS. If LuaTexts can help this, I would be a happy camper. And I guess it would be worth it to learn some Lua, even though it's quite intimidating to a programming illiterate such as myself.
|
At this point I think PB4 even with DogTags has roughly the same performance as PB3. So if you were doing it with PB3 you could probably do it now.
|
|
|
|
|
06/25/09, 8:30 PM
|
#90
|
|
Glass Joe
Night Elf Druid
Bloodhoof (EU)
|
>
Removed, posted in wrong thread by mistake
Last edited by JasonD : 06/25/09 at 8:33 PM.
Reason: DogTag Question in wrong thread... doh
|
|
|
|
|
06/27/09, 1:30 PM
|
#91
|
|
Piston Honda
Human Paladin
Kul Tiras (EU)
|
Originally Posted by Shaewyn
Is there currently any way to get my raid group in a LuaText? I haven't seen it as any of the stated functions, and I haven't had any luck looking for other ways to get Pitbull to display which raid group I'm in (on my unit frame)
|
If anyone has any ideas on how to get the equivalent of [RaidGroup] in LuaText, it'd be much appreciated.
|
|
|
|
|
06/27/09, 2:16 PM
|
#92
|
|
Glass Joe
Tauren Shaman
Azshara (EU)
|
I wrote a little pom-tracker for your player-frame:
if UnitInRaid(unit) then
local raid=GetNumRaidMembers()
for r=1,raid do
local un = "raid"..r
local i=1
while true do
local name,_,_,count,_,_,expTime,unCstr,_= UnitAura(un,i,"HELPFUL")
if not name then
break
end
if name=="Prayer of Mending"and unCstr==unit and count and expTime then
local r,g,b = ClassColor(un)
return "|cff%02x%02x%02x%s|r: %d - %d",r,g,b,UnitName(un),count,expTime-GetTime()
end
i=i+1
end
end
end
For people who are interested in other people's POM can set this tag up at the target-frame.
In case you want to track other Buffs/Debuffs just edit the spellname.
Currently I'm looking for a smooth way for determinating if the player is in a raid or a party and setting up the unit-ids according to this.
I thought of something like this:
local pre
if UnitInRaid(unit) or GetNumPartyMembers() > 0 then
if GetNumRaidMembers() == 0 then pre="party" else pre="raid" end
end
The pre variable then works as an affix with the loop-id to create the unit-id. I'm still missing an option to implement the case when the player is not in a party, because in that special case the unit-id isn't player1 but player.
|
|
|
|
|
06/27/09, 4:04 PM
|
#93
|
|
Von Kaiser
|

Originally Posted by Uhman
I wrote a little pom-tracker for your player-frame:
if UnitInRaid(unit) then
local raid=GetNumRaidMembers()
for r=1,raid do
local un = "raid"..r
local i=1
while true do
local name,_,_,count,_,_,expTime,unCstr,_= UnitAura(un,i,"HELPFUL")
if not name then
break
end
if name=="Prayer of Mending"and unCstr==unit and count and expTime then
local r,g,b = ClassColor(un)
return "|cff%02x%02x%02x%s|r: %d - %d",r,g,b,UnitName(un),count,expTime-GetTime()
end
i=i+1
end
end
end
For people who are interested in other people's POM can set this tag up at the target-frame.
In case you want to track other Buffs/Debuffs just edit the spellname.
Currently I'm looking for a smooth way for determinating if the player is in a raid or a party and setting up the unit-ids according to this.
I thought of something like this:
local pre
if UnitInRaid(unit) or GetNumPartyMembers() > 0 then
if GetNumRaidMembers() == 0 then pre="party" else pre="raid" end
end
The pre variable then works as an affix with the loop-id to create the unit-id. I'm still missing an option to implement the case when the player is not in a party, because in that special case the unit-id isn't player1 but player.
|
local pre,size,start = "raid",GetNumRaidMembers(),1
if size <= 0 then
pre = "party"
size = GetNumPartyMembers()
start = 0
end
for i=start,size do
local unit
if i == 0 then
unit = "player"
else
unit = pre .. i
end
-- Whatever you want here
end
|
|
|
|
|
06/27/09, 7:41 PM
|
#94
|
|
Piston Honda
|
Originally Posted by Camaris
If anyone has any ideas on how to get the equivalent of [RaidGroup] in LuaText, it'd be much appreciated.
|
if UnitInRaid(unit) then
local size = GetNumRaidMembers()
local uname=Name(unit)
i=1
while i<=size do
local name,_,subgroup = GetRaidRosterInfo(i)
if uname==name then
return "(%s)", subgroup
end
i=i+1
end
end
You will need to add the event RAID_ROSTER_UPDATE and select Update for All.
edit: I added a version with class coloring, since that is how I want to use it.
if UnitInRaid(unit) then
local size = GetNumRaidMembers()
local r,g,b=ClassColor(unit)
local uname=Name(unit)
i=1
while i<=size do
local name,_,subgroup = GetRaidRosterInfo(i)
if uname==name then
return "|cff%02x%02x%02x(%s)|r",r,g,b,subgroup
end
i=i+1
end
end
Last edited by Hotan : 06/27/09 at 7:47 PM.
|
correlation =/= causation
|
|
|
06/28/09, 7:40 AM
|
#95
|
|
Piston Honda
Human Paladin
Kul Tiras (EU)
|
I discovered that this
local _,_, subgroup = GetRaidRosterInfo(GetNumRaidMembers())
makes subgroup the number of the raidgroup you yourself are in. If like me you're using the "RaidGroup" text on the player frame only (for the "group 4 goes left!" type of situations), this will suffice instead of the loop above.
Maybe a nice excercise for a sunday afternoon... a LuaText version of [TalentTree] (the tag that gives you "Protection", "Affliction", etc.).
|
|
|
|
|
06/29/09, 1:16 AM
|
#96
|
|
Von Kaiser
|
Originally Posted by Camaris
Maybe a nice excercise for a sunday afternoon... a LuaText version of [TalentTree] (the tag that gives you "Protection", "Affliction", etc.).
|
NotifyInspect(unit)
local talents = {}
for tab = 1, GetNumTalentTabs(true) do
local name, _, spent = GetTalentTabInfo(tab, true)
tinsert(talents, {Name = name, Spent = spent})
end
table.sort(talents, function(a, b) return a.Spent > b.Spent end)
return talents[1].Name
Depending on how LuaTexts handles updates the above might not be ideal, since you probably don't want to be creating a bunch of otherwise disposable tables on every update. It's the only way I could think to do it though, and worst case scenario is that is gives you a solid start.
|
|
|
|
|
06/29/09, 5:38 AM
|
#97
|
|
Glass Joe
Gnome Death Knight
Barthilas
|
I was a little unsatisfied with the Rune module in Pitbull4, so I decided to write a LuaTexts that did things exactly the way I like:
if UnitIsUnit("player",unit) and select(2, UnitClass(unit)) == "DEATHKNIGHT" then
local GetRuneCooldown = GetRuneCooldown
local GetRuneType = GetRuneType
local incomplete
local GetRuneString = function(rune)
local _, _, ready = GetRuneCooldown(rune)
if ready then
if GetRuneType(rune) == 1 then
return "|cffff0000B|r"
elseif GetRuneType(rune) == 2 then
return "|cff00ff00U|r"
elseif GetRuneType(rune) == 3 then
return "|cff0077ffF|r"
else
return "|cffff00ffD|r"
end
else
incomplete = true
if GetRuneType(rune) == 1 then
return "|cff333333B|r"
elseif GetRuneType(rune) == 2 then
return "|cff333333U|r"
elseif GetRuneType(rune) == 3 then
return "|cff333333F|r"
else
return "|cff333333D|r"
end
end
end
local runestring = ""
for i = 1, 6 do
runestring = runestring .. GetRuneString(i)
end
if incomplete or UnitAffectingCombat(unit) then return runestring end
end
This string is only visible on the player frame (for Death Knights only), and only when at least some of the runes are on cooldown or if we are in combat. Also, instead of that hard to read spiral, I've just got runes turning grey if they aren't ready: on or off.
It would be trivial to replace the text style with links to the blizzard icons or whatever. Hope someone finds it handy. Also, if I'm doing something plain sub-optimal or stupid then let me know.
EDIT: just stripped out some unnecessary variables and concatenations
EDIT: FYI, I've got this text listening to RUNE_POWER_UPDATE, RUNE_TYPE_UPDATE, UNIT_FLAGS.
Last edited by jokeyrhyme : 06/29/09 at 5:48 AM.
Reason: adding events
|
|
|
|
|
06/29/09, 6:13 AM
|
#98
|
|
Glass Joe
Night Elf Hunter
Blood Furnace
|
Hello there I was using the [HappyNum] Dogtag to color my pet's name according to its happiness. I was wondering how I could do this with luatext? Any help would be greatly appreciated.
Umm.. I did some looking around @ lua and i came up with this
local happiness, damagePercentage, loyaltyRate = GetPetHappiness()
local happy = ({"cffC41F3B", "cffFFF569", "cffABD473"})[happiness]
return '|%s%s|r',happy,Name(unit)
I am just wondering if this is the most efficient way of doing this?
Last edited by Methyl : 06/29/09 at 6:33 AM.
|
|
|
|
|
06/29/09, 9:35 AM
|
#99
|
|
Piston Honda
|
Originally Posted by Gorsgo
NotifyInspect(unit)
local talents = {}
for tab = 1, GetNumTalentTabs(true) do
local name, _, spent = GetTalentTabInfo(tab, true)
tinsert(talents, {Name = name, Spent = spent})
end
table.sort(talents, function(a, b) return a.Spent > b.Spent end)
return talents[1].Name
Depending on how LuaTexts handles updates the above might not be ideal, since you probably don't want to be creating a bunch of otherwise disposable tables on every update. It's the only way I could think to do it though, and worst case scenario is that is gives you a solid start.
|
You can't use NotifyInspect() like this. Once you request it, you have to wait for the server to send the event INSPECT_TALENT_READY before you can retrieve talent data from your target. Meanwhile, the player may have switched targets to someone else, and/or another addon may have requested talent data for someone else. It's therefore recommended to hook NotifyInspect() securely to prevent that.
You also need checks to make sure that the target is within interacting distance, that it's not an NPC, that it's not a PvP-flagged player of the opposite faction and that it's not the player targetting himself. You could get rid of the for loop by assuming 3 talent trees and checking that the target isn't a pet (unless you really want to know a pet's talent tree). A check for players with no talent points used (say below lvl 10 or respeccing) is also probably needed. Finally, a re-scan is probably needed if the target changes spec while it's targetted.
That's all the issues I can come up with in 5 minutes. Not sure how to take care of all this in LuaTexts. This might need to be one of the helper functions in PitBull 4, if Shefki thinks it's worth considering.
|
|
|
|
|
06/29/09, 2:44 PM
|
#100
|
|
Von Kaiser
|
Originally Posted by ShadowEric
That's all the issues I can come up with in 5 minutes. Not sure how to take care of all this in LuaTexts. This might need to be one of the helper functions in PitBull 4, if Shefki thinks it's worth considering.
|
In order to do the talent stuff right you have to use LibTalentQuery or whatever the lib is called. I really don't want to suck in an extra dependency for a very very very few people that might use this. However you can use the library from within a LuaText. You'd just have to be sure to install it yourself if you don't already have it from some other addon. If I do anything it'll be writing an example how to do it. I doubt I'm gonna add a helper to do it since I consider the use really rare and the overhead of an extra library for the people that don't need it is unacceptable IMHO.
|
|
|
|
|
|