View Single Post
06-09-22, 09:41 AM   #1
morpheusxeno
A Flamescale Wyrmkin
 
morpheusxeno's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 126
Shows on Character panel vs always showing

I have some code from a WA

Currently it only shows when the character panel is open. Can some one modify this so that it always shows regardless of the character panel being opened or closed ?

Lua Code:
  1. --CREATE FRAME
  2. if not aura_env.AvoidanceFrame then
  3.   local f = CreateFrame("Frame", nil, aura_env.region)
  4.  
  5.   f:SetAllPoints()
  6.  
  7.   f.text = f:CreateFontString(nil, "OVERLAY")
  8.   f.text:SetFontObject("GameFontHighlight")
  9.   f.text:SetPoint("TOP", 0, -5)
  10.   f.text:SetText(avoidance(GetDodgeChance()))
  11.  
  12.   f:RegisterEvent("COMBAT_RATING_UPDATE")
  13.   f:RegisterEvent("PLAYER_ENTERING_WORLD")
  14.   f:RegisterEvent("PLAYER_DAMAGE_DONE_MODS")
  15.   f:SetScript("OnEvent", function(self)
  16.       f.text:SetText(avoidance(GetDodgeChance()))    
  17.   end)
  18.  
  19.  
  20.       GameTooltip:SetOwner(self, "ANCHOR_BOTTOM", 0, -10)
  21.       GameTooltip:AddLine("|cffffffffDefensive Stats|r")
  22.       GameTooltip:AddLine("Miss: " .. string.format("%.2f", missChance(getDefense())).."%")
  23.       GameTooltip:AddLine("Dodge: " .. string.format("%.2f", GetDodgeChance()).."%")
  24.      
  25.      
  26.       -- dont put block chance on tooltip if bear
  27.       if class == 1 or class == 2 then
  28.         GameTooltip:AddLine("Parry: " .. string.format("%.2f", GetParryChance()).."%")
  29.         GameTooltip:AddLine("---\n")
  30.         GameTooltip:AddLine("Block: " .. string.format("%.2f", GetBlockChance()).."%")
  31.         GameTooltip:AddLine("Block val: " .. GetShieldBlock())
  32.         GameTooltip:AddLine("---\n")
  33.       else
  34.         GameTooltip:AddLine("---\n")
  35.       end
  36.      
  37.       GameTooltip:AddLine("With MotW & Kings:")
  38.       GameTooltip:AddLine(getAvoidance(getBuffedDodge()) .. "% / 102.4%")
  39.       GameTooltip:AddLine("---\n")
  40.       GameTooltip:AddLine("Illidan Shear:")
  41.       GameTooltip:AddLine("Unbuffed: " .. getAvoidance(GetDodgeChance()) - missChance(getDefense()) .. " / 102.4%")
  42.       GameTooltip:AddLine("Buffed: " .. getAvoidance(getBuffedDodge()) - missChance(getDefense()) .. " / 102.4%")
  43.       GameTooltip:Show()
  44.   end)
  45.  
  46.   f:SetScript("OnLeave", function()
  47.       GameTooltip:Hide()
  48.   end)
  49.  
  50.   aura_env.AvoidanceFrame = f
  51. end
__________________
My mother-in-law fell down a wishing well. I was amazed; I never knew they worked...
  Reply With Quote