• 0

    posted a message on LuaTexts Official Thread
    Quote from Psychophan7
    # Class Info
    [Level: DifficultyColor] [Class:Classcolor]
    [Guild:Angle]
    local dr,dg,db=DifficultyColor(unit)
    local cr,cg,cb=ClassColor(unit)
    return "|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r %s%s%s"
            ,dr,dg,db,Level(unit),cr,cg,cb,Class(unit),Angle(GetGuildInfo(unit))
    OR
    local dr,dg,db=DifficultyColor(unit)
    if UnitIsPlayer(unit) then
     local cr,cg,cb=ClassColor(unit)
    else
     local cr,cg,cb=HostileColor(unit)
    end
    return "|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r %s%s%s"
            ,dr,dg,db,Level(unit),cr,cg,cb,Class(unit),Angle(GetGuildInfo(unit))

    # Class Info
    [Level: DifficultyColor] [SmartRace:ClassColor]


    local dr,dg,db=DifficultyColor(unit)
    local cr,cg,cb=ClassColor(unit)
    return "|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r",dr,dg,db,Level(unit),cr,cg,cb,Race(unit)
    OR
    local dr,dg,db=DifficultyColor(unit)
    if UnitIsPlayer(unit) then
     local cr,cg,cb=ClassColor(unit)
    else
     local cr,cg,cb=HostileColor(unit)
    end
    return "|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r",dr,dg,db,Level(unit),cr,cg,cb,Race(unit)


    # Show health when not at full, name when full
    [IsMaxHP ? Name ! FractionalHP]
    local cur,max=HP(unit),MaxHP(unit)
    if cur==max then
     return Name(unit)
    else
     return "%s/%s",cur,max
    end


    # Color MP based on percent, percent MP
    [(~IsMaxMP ? ((MP < MaxMP * 0.2):Red | (MP < MaxMP * 0.5):Yellow | (MP > MaxMP * 0.5):White) " | ") PercentMP:Round:Percent]
    local cur,max=Power(unit),MaxPower(unit)
    local per=Percent(cur,max)
    if per<20 then
     return "|cffff0000%d%%|r,per
    elseif per<50 then
     return "|cffffff00%d%%|r,per 
    else 
     return "|cffffffff%d%%|r,per  
    end
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    This should do the job of only showing for buffs cast by you. Replace "Myname" with your name and it should work like a charm.
    local i = 1
    local renew,shield,mending = false,false,false
    while true do
      local name,_,_,_,_,_,_,caster= UnitAura(unit,i)
      if not name then
        break
      elseif name == "Power Word: Shield" then
        shield = true
      elseif name == "Weakened Soul" then
        shield = true
      elseif name == "Renew" and caster == "Myname" then
        renew = true
      elseif name == "Prayer of Mending" and caster == "Myname" then
        mending = true
      end
      i = i + 1
    end
    Outline()
    return "%s%s%s",shield and "|cffFFFF00.|r" or '',renew and "|cff00C000.|r" or '',mending and "|cff00C5CD.|r" or ''

    The reason Shefki didn't use the "HELPFUL" filter before was that he was referencing both buffs and debuffs in the same loop, this filtering will reduce your number of function calls by however many debuffs are on the target.

    As for the way the location of the coloring, I changed it back, and I am guessing it has to do with efficiency when the value is false.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    tzirean: You don't need to define icon from UnitAura() since you don't use it, not that it really hurts much of anything. Also, you should add "HELPFUL" to your UnitAura() call. Also, that SetFormated is going to produce some garbage from what I remember Shefki saying. This would have the exact same appearance and be cleaner:
    local i = 1
    local renew,mending = false,false
    while true do
      local name = UnitAura(unit,i,HELPFUL)
      if not name then
        break
      elseif name == "Renew" then
        renew = true
      elseif name == "Prayer of Mending" then
        mending = true
      end
      i = i + 1
    end
    Outline()
    return "|cff00C000%s|r|cff00C5CD%s|r",renew and "." or '',mending and "." or ''
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from Kelem

    This without the level function
    I also removed the Classifcation text, because that is just an extension of level, in my opinion.
    local name = Name(unit)
    if UnitIsPlayer(unit) then
     local cr,cg,cb = ClassColor(unit)
     local form = DruidForm(unit)
     if form then
      form = strsub(form,1,1)
      return "|cff%02x%02x%02x%s (%s)|r" ,cr,cg,cb,name,form
     else
      return "|cff%02x%02x%02x%s|r" ,cr,cg,cb,name
     end
    else
      return name
    end
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    My bad, I misread which part you wanted to modify. It is fixed to show #.##k rather than #### in all portions.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    I missed copying an 'end' at the very end of the code. fixed.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    This is the Health:Smart with #### displaying as #.##k. This variation on Short() is actually somewhat commonly requested.
    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 > 9999  then
        return "|cffff7f7f%s|r",Short(miss,true)
      elseif mis > 999 then
        return "|cffff7f7f%.2fk|r",miss/1000
      else
        return "|cffff7f7f%s|r",miss
      end
    else
     if max > 9999 then
      if cur > 9999 then
       return "%s/%s",Short(cur,true),Short(max,true)
      elseif cur >999 then
       return "%.2fk/%s",cur/1000,Short(max,true)
      else
       return "%s/%s",cur,Short(max,true)
      end
     elseif max > 999 then
      if cur >999 then
       return "%.2fk/%.2fk",cur/1000,max/1000
      else
       return "%s/%.2fk",cur,max/1000
      end 
     else
       return "%s/%s",cur,cur
     end
    end
    Posted in: Unit Frames
  • 0

    posted a message on PitBull 4.0
    tzirean: You need to control the Events which trigger changes. For example, the two tags I created need the UNIT_AURA event.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    tzirean: If it isn't working atm I have absolutely no idea. Try recopying the code from my original post. It works exactly as advertised for me.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Quote from tzirean
    No, totally understood, I should have noticed it long before I did, too.

    As for the sheep text, it seems like it's never setting poly to true, but I have no idea why; everything looks like it should work.
    That shouldn't be the issue. It would return BROKEN! if that were true. The issue definitely lies in the Dead() check.

    So the poly works for me just fine (I'm a mage). I changed the positioning of the Dead(unit), but that shouldn't matter. I also added an UpdateIn(1) call, if poly is true, since there is no other good way to provide checks for changing duration.

    Shefko (or somebody with more skill than me): Another addition that would rock, but I'm not sure how to do, would be to have a variable set more globally to only run this tag if the mob was a sheep at some point since it became that frame. I kind of know what to do for it, but I am pretty sure I will do things sub-optimally.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    Yeah, sorry about the HARMFUL/HELPFUL mistake, I was wiriting that code in a hurry before I left for the evening. It is fixed in the original post, but I don't get the sheep problem either.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    tzirean:

    sheep thing:
    if not Dead(unit) then
     Outline()
     local poly = false
     local i=1
     while true do
      local name,_,_,_,_,_,exp = UnitAura(unit,i,"HARMFUL")
      if not name then
       break
      elseif name == "Polymorph" then
       poly = true
       rem = exp - GetTime()
       break
      end
      i=i+1
     end
     if poly then
      UpdateIn(1)
      if rem > 10 then
       return "|cff00ffffSheeped|r"
      elseif rem > 5 then
       return "|cff00ff00Soon!|r"
      else
       return "|cffffff00Resheep!|r"
      end
     else
       return "|cffff0000BROKEN!|r"
     end
    end


    buff check:
    Outline()
    if Class('player')=='Mage' then
     local ab,ai=false,false
     local i=1
     while true do
      local name = UnitAura(unit,i,"HELPFUL")
      if not name then
       break
      elseif name == "Arcane Brilliance" or name =="Dalaran Brilliance" then
       ab = true
       break
      elseif name == "Arcane Intellect" or name =="Dalaran Intellect" then
       ai = true
       break
      end
      i=i+1
     end
     if ai then
      return "|cff0066ff.|r"
     elseif ab then
      return "|cff00ffff.|r" 
     end
    elseif Class('player')=='Druid' then
     local g,m=false,false
     local i=1
     while true do
      local name = UnitAura(unit,i,"HELPFUL")
      if not name then
       break
      elseif name == "Gift of the Wild" then
       g = true
       break
      elseif name == "Mark of the Wild" then
       m = true
       break
      end
      i=i+1
     end
     if g then
      return "|cffffff00.|r"
     elseif m then
      return "|cff00ff00.|r" 
     end
    elseif Class('player')=='Priest' then
     local f,pf,s,ps=false,false,false,false
     local i=1
     while true do
      local name = UnitAura(unit,i,"HELPFUL")
      if not name then
       break
      elseif name == "Power Word: Fortitude" then
       f = true
      elseif name == "Prayer of Fortitude" then
       pf = true
      elseif name == "Shadow Protection" then
       s = true
      elseif name == "Prayer of Shadow Protection" then
       ps = true
      end
      i=i+1
     end
     if f and s then
      return "|cffffffff.|r|cffff00ff.|r"
     elseif pf and s then
      return "|cff666666.|r|cffff00ff.|r"
     elseif f and ps then
      return "|cffffffff.|r|cffff0000.|r"
     elseif pf and ps then
      return "|cff666666.|r|cffff0000.|r"
     elseif f then
      return "|cffffffff.|r"
     elseif pf then
      return "|cff666666.|r"
     elseif s then
      return "|cffff00ff.|r"
     elseif ps then
      return "|cffff0000.|r"
     end
    end
    While this buff check is pretty efficient since it checks class before it bothers to do anything else, it is still really long and cumbersome.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    cremor: Add the event MODIFIER_STATE_CHANGED via the LuaTexts Module sub menu. You can use that for key modifiers.
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    [Name:ClassColor:Truncate(32) (~IsMaxHP ? ~Dead ? " || " PercentHP:HPColor "%":HPColor) (Dead ? " || " "Dead":Color("922E21"))] [Offline ? "Offline":Color("8D8483")]

    local name=strsub(Name(unit),1,32)
    local cur,max=HP(unit),MaxHP(unit)
    local s=Status(unit)
    local r,g,b=ClassColor(unit)
    local hr,hg,hb=HPColor(cur,max)
    if cur==max then
     if s=='Offline' then
      return "|cff%02x%02x%02x%s|r |cff8D8483Offline|r"
             ,r,g,b,name
     else
      return "|cff%02x%02x%02x%s|r"
             ,r,g,b,name
     end
    else
     if s=='Dead' then
      return "|cff%02x%02x%02x%s|r || |cff922E21Dead|r"
              ,r,g,b,name
     elseif s=='Offline' then
      return "|cff%02x%02x%02x%s|r || |cff%02x%02x%02x%s%%|r |cff8D8483Offline|r"
              ,r,g,b,name,hr,hg,hb,Percent(cur,max)
     else
      return "|cff%02x%02x%02x%s|r || |cff%02x%02x%02x%s%%|r"
             ,r,g,b,name,hr,hg,hb,Percent(cur,max)
     end
    end
    Posted in: Unit Frames
  • 0

    posted a message on LuaTexts Official Thread
    cp9831: this should work
    local dr,dg,db = DifficultyColor(unit)
    local lvl = Level(unit)
    local race = SmartRace(unit)
    if UnitIsFriend(unit,'player') then
     dr,dg,db = 255,255,255
    end
    if race == "Not specified" then
     race = ''
    end
    if UnitIsPlayer(unit) then
     local cr,cg,cb = ClassColor(unit)
     local form = DruidForm(unit)
     local class = Class(unit)
     if form then
      return "|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r %s (%s)"
                      ,dr,dg,db,lvl,cr,cg,cb,class,race,form
     else
      return "|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r %s"
                      ,dr,dg,db,lvl,cr,cg,cb,class,race
     end
    else
     return "|cff%02x%02x%02x%s|r |cffffcc00%s|r %s"
                     ,dr,dg,db,lvl,Classification(unit) or '',race or ''
    end
    Posted in: Unit Frames
  • To post a comment, please or register a new account.