Guest Ajuga

LuaTexts - The new DogTags

236 posts in this topic

So I'm working on some Raid Frames that will essentially replace grid for my non-healers. I need it to show Name (4 letters max), Missing HP (in place of name, if HP is not full), AFK/DC/FD/FI/Dead (in place of name, if unit is AFK or Offline or Feigning Death or Divine Intervention'd or Dead/Ghost).

Here is what I have so far:


local AFK = Afk(unit)

local AFKTIME = AFKDuration(unit)

local DC = Offline(unit)

local DCTIME = OfflineDuration(unit)

local DEAD = Dead(unit)

local DEADTIME = DeadDuration(unit)

local FD = UnitAura(unit,"FEIGN DEATH")

local DI = UnitAura(unit,"DIVINE INTERVENTION")

local cur,max = HP(unit),MaxHP(unit)

local miss = max-cur


if AFK then

return "AFK\n%s",AFKTIME

elseif DC then

return "DC\n%s",DCTIME

elseif DEAD then

return "AFK\n%s",DEADTIME

elseif FD then

return "FD"

elseif DI then

return "DI"

elseif miss ~= 0 then

return "- %s",Short(miss)

else

return Name(unit):sub(1,4)

So far, Name, FD (and I assume DI, since they are functionally identical with different buffs), AFK are confirmed to work. I have not tested DEAD, DC, miss.

My issue is that AFKTIME displays as a massively huge decimal number. I had a fix for this before, but I have no idea what it was.

Anyone know how to fix it?

Share this post


Link to post
Share on other sites

Does anyone know how to view the unit-player's group number when in a raid? The DogTag is pretty simple, however I'm having a really hard time researching the code to display the player's group number (in Pitbull, that is).

Share this post


Link to post
Share on other sites

return "AFK\n%s",AFKTIME
change that into
return "AFK\n%.2f",AFKTIME

That should display the afk time as a 'float' with only 2 decimal places.

Share this post


Link to post
Share on other sites

Simply trying to get KGPanels to be class colored unless the until has aggro, then red.

I'm using

local _, class = UnitClass("player");

if class == "WARRIOR" then

self:SetBackdropBorderColor(0.95, 0.23, 0.23, 0.50)

elseif class == "PRIEST" then

self:SetBackdropBorderColor(1, 0.96, 0.98, 0.50)

elseif class == "MAGE" then

self:SetBackdropBorderColor(0.00, 1, 1, 0.50)

elseif class == "DRUID" then

self:SetBackdropBorderColor(1, 0.49, 0.04, 0.50)

elseif class == "PALADIN" then

self:SetBackdropBorderColor(0.92, 0.22, 0.46, 0.50)

elseif class == "HUNTER" then

self:SetBackdropBorderColor(0.33, 0.86, 0.00, 0.50)

elseif class == "ROGUE" then

self:SetBackdropBorderColor(1, 0.94, 0.16, 0.50)

elseif class == "SHAMAN" then

self:SetBackdropBorderColor(0.13, 0.42, 1, 0.50)

elseif class == "WARLOCK" then

self:SetBackdropBorderColor(0.36, 0.18, 1, 0.50)

elseif class == "DEATHKNIGHT" then

self:SetBackdropBorderColor(0.77, 0.12, 0.23, 0.50)

end

for the class colored, simply want to add aggro indicator to it.

Share this post


Link to post
Share on other sites
Simply trying to get KGPanels to be class colored unless the until has aggro, then red.

I'm using

local _, class = UnitClass("player");

if class == "WARRIOR" then

self:SetBackdropBorderColor(0.95, 0.23, 0.23, 0.50)

elseif class == "PRIEST" then

self:SetBackdropBorderColor(1, 0.96, 0.98, 0.50)

elseif class == "MAGE" then

self:SetBackdropBorderColor(0.00, 1, 1, 0.50)

elseif class == "DRUID" then

self:SetBackdropBorderColor(1, 0.49, 0.04, 0.50)

elseif class == "PALADIN" then

self:SetBackdropBorderColor(0.92, 0.22, 0.46, 0.50)

elseif class == "HUNTER" then

self:SetBackdropBorderColor(0.33, 0.86, 0.00, 0.50)

elseif class == "ROGUE" then

self:SetBackdropBorderColor(1, 0.94, 0.16, 0.50)

elseif class == "SHAMAN" then

self:SetBackdropBorderColor(0.13, 0.42, 1, 0.50)

elseif class == "WARLOCK" then

self:SetBackdropBorderColor(0.36, 0.18, 1, 0.50)

elseif class == "DEATHKNIGHT" then

self:SetBackdropBorderColor(0.77, 0.12, 0.23, 0.50)

end

for the class colored, simply want to add aggro indicator to it.

You'll likely want to use UnitThreatSituation (API UnitThreatSituation - WoWWiki - Your guide to the World of Warcraft) to accomplish this. It should be as easy as adding another IF case before any of the class coloring -- IF the unit has aggro, color it red, ELSE check what class it is.

Skip using the second argument for UnitThreatSituation since you want to check for any aggro, instead of aggro of a specific unit.

Share this post


Link to post
Share on other sites

Is it possible to just show the level of something.

The same way "[Level: DifficultyColor]" did with dogtags.

Share this post


Link to post
Share on other sites

I am having difficulty trying to print the name of my target's owner (in case my target is a pet). What is the UnitId for it? Right now I have:

if IsPet() then

return '%s',Name(unit)

end

Which just prints the pet's name.

Share this post


Link to post
Share on other sites

Hi there. Just before my WoW subscription ended, I put together a very large LuaText to display multiple auras, with animated timer bars, on PitBull4 unit frames. The bottom line of this image shows the default layout of the text for a resto druid, showing Swiftmend, Wild Growth, Rejuvenation, Regrowth, and Lifebloom. (There are defaults for all classes, both healer-oriented and dps-oriented)

Text_auras__resto_druid_15fps__-_WoW_2011-03-02_19-05-56-26.gif

The project page (link to curseforge) contains a few animations showing the text in action.

If you give this a try, please post your thoughts at the project page.

The LuaText is so huge that it's inconvenient to edit. If several people express interest, I may be able to resubscribe for a bit and restructure the code as an addon you can call from a short LuaText.

Share this post


Link to post
Share on other sites

I am looking for someone to help me with some code. What I am trying to display is absorption percent based on 1/3 of my max health (for illuminated healing).

 

The code I have to just show absorb absolute short is:

 

local current=0

for s,ss in pairs(PitBull4_Shields_combatFrame.shields) do
current = current + (ss.cur[unitGUID(unit)] or 0)
end
return string.format("|cffff0000%0.1fk",current/1000)

 

Thanks in advance.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.