View Single Post
09-04-12, 08:08 PM   #5
MiRai
A Warpwood Thunder Caller
Join Date: Jul 2011
Posts: 96
Originally Posted by Phanx View Post
If by "odd texture issue" you mean you're seeing a green texture you didn't put there, try running frame:SetNormalTexture(nil) on your frames.
Apologies for getting back to this late, but I haven't had a chance to really play much lately. Here's the error I'm seeing upon entering a party/raid/instance/etc:



It actually seems to be an error with the Warrior's old ability Vigilance (50720) and I don't see where oUF_Fail is looking for it. Here's what it's doing to my party/raid frames:




Now, here's AuraWatch.lua:

lua Code:
  1. --[[------------------------------------------------------------------------------------------------------
  2. oUF_AuraWatch by Astromech
  3. Please leave comments, suggestions, and bug reports on this addon's WoWInterface page
  4.  
  5. To setup, create a table named AuraWatch in your unit frame. There are several options
  6. you can specify, as explained below.
  7.    
  8.     icons
  9.         Mandatory!
  10.         A table of frames to be used as icons. oUF_Aurawatch does not position
  11.         these frames, so you must do so yourself. Each icon needs a spellID entry,
  12.         which is the spell ID of the aura to watch. Table should be set up
  13.         such that values are icon frames, but the keys can be anything.
  14.        
  15.         Note each icon can have several options set as well. See below.
  16.     strictMatching
  17.         Default: false
  18.         If true, AuraWatch will only show an icon if the specific aura
  19.         with the specified spell id is on the unit. If false, AuraWatch
  20.         will show the icon if any aura with the same name and icon texture
  21.         is on the unit. Strict matching can be undesireable because most
  22.         ranks of an aura have different spell ids.
  23.     missingAlpha
  24.         Default 0.75
  25.         The alpha value for icons of auras which have faded from the unit.
  26.     presentAlpha
  27.         Default 1
  28.         The alpha value for icons or auras present on the unit.
  29.     onlyShowMissing
  30.         Default false
  31.         If this is true, oUF_AW will hide icons if they are present on the unit.
  32.     onlyShowPresent
  33.         Default false
  34.         If this is true, oUF_AW will hide icons if they have expired from the unit.
  35.     customIcons
  36.         Default false
  37.         If this is true, oUF_AW will not create any frames or textures for your
  38.         icons. It assumes you will handle it.
  39.     fromUnits
  40.         Default {["player"] = true, ["pet"] = true, ["vehicle"] = true}
  41.         A table of units from which auras can originate. Have the units be the keys
  42.         and "true" be the values.
  43.     anyUnit
  44.         Default false
  45.         Set to true for oUF_AW to to show an aura no matter what unit it
  46.         originates from. This will override any fromUnits setting.
  47.     PostCreateIcon
  48.         Default nil
  49.         A function to call when an icon is created to modify it, such as adding
  50.         a border or repositioning the count fontstring. Leave as nil to ignore.
  51.         The arguements are: AuraWatch table, icon, auraSpellID, auraName, unitFrame
  52.     PostResetIcon
  53.         Default nil
  54.         A function to call when an icon is reset, that is an aura has been applied
  55.         or refreshed. This is passed the AuraWatch frame, the icon, aura stack count,
  56.         duration, and remaining time, as per a UnitAura call.
  57.     PostExpireIcon
  58.         Default nil
  59.         A function to call when an icon is expired, that is an aura has disappeared.
  60.         This is passed the AuraWatch frame and the icon.
  61.     OverrideResetIcon
  62.         Default nil
  63.         Provide this function to handle the ResetIcon process yourself.
  64.     OverrideExpireIcon
  65.         Default nil
  66.         Provide this function to handle the ExpireIcon process yourself.
  67.  
  68. Below are options set on a per icon basis. Set these as fields in the icon frames.
  69.  
  70. The following settings can be overridden from the AuraWatch table on a per-aura basis:
  71.     onlyShowMissing
  72.     onlyShowPresent
  73.     fromUnits
  74.     anyUnit
  75.        
  76. The following settings are unique to icons:
  77.    
  78.     spellID
  79.         Mandatory!
  80.         The spell id of the aura, as explained above.
  81.    
  82. Here is an example of how to set oUF_AW up:
  83.  
  84.     local createAuraWatch = function(self, unit)
  85.         local auras = {}
  86.        
  87.         -- A table of spellIDs to create icons for
  88.         -- To find spellIDs, look up a spell on [url]www.wowhead.com[/url] and look at the URL
  89.         -- [url]http://www.wowhead.com/?spell=SPELL_ID[/url]
  90.         local spellIDs = { ... }
  91.        
  92.         auras.presentAlpha = 1
  93.         auras.missingAlpha = .7
  94.         auras.PostCreateIcon = myCustomIconSkinnerFunction
  95.         -- Set any other AuraWatch settings
  96.         auras.icons = {}
  97.         for i, sid in pairs(spellIDs) do
  98.             local icon = CreateFrame("Frame", nil, self)
  99.             icon.spellID = sid
  100.             -- set the dimensions and positions
  101.             icon:SetWidth(24)
  102.             icon:SetHeight(24)
  103.             icon:SetPoint("BOTTOM", self, "BOTTOM", 0, 28 * i)
  104.             auras.icons[sid] = icon
  105.             -- Set any other AuraWatch icon settings
  106.         end
  107.         self.AuraWatch = auras
  108.     end
  109. -----------------------------------------------------------------------------------------------------------]]
  110.  
  111. local _, ns = ...
  112. local oUF = ns.oUF or _G.oUF
  113. assert(oUF, "oUF_AuraWatch cannot find an instance of oUF. If your oUF is embedded into a layout, it may not be embedded properly.")
  114.  
  115. local UnitAura, UnitGUID = UnitAura, UnitGUID
  116. local GUIDs = {}
  117.  
  118. local PLAYER_UNITS = {
  119.     player = true,
  120.     vehicle = true,
  121.     pet = true,
  122. }
  123.  
  124. local SetupGUID
  125. do
  126.     local cache = setmetatable({}, {__type = "k"})
  127.  
  128.     local frame = CreateFrame"Frame"
  129.     frame:SetScript("OnEvent", function(self, event)
  130.         for k,t in pairs(GUIDs) do
  131.             GUIDs[k] = nil
  132.             wipe(t)
  133.             cache[t] = true
  134.         end
  135.     end)
  136.     frame:RegisterEvent"PLAYER_REGEN_ENABLED"
  137.     frame:RegisterEvent"PLAYER_ENTERING_WORLD"
  138.    
  139.     function SetupGUID(guid)
  140.         local t = next(cache)
  141.         if t then
  142.             cache[t] = nil
  143.         else
  144.             t = {}
  145.         end
  146.         GUIDs[guid] = t
  147.     end
  148. end
  149.  
  150. local function DefaultResetIcon(watch, icon, count, duration, remaining)
  151.     if not icon.onlyShowMissing then
  152.         if icon.cd then
  153.             if duration and duration > 0 then
  154.                 icon.cd:SetCooldown(remaining - duration, duration)
  155.                 icon.cd:Show()
  156.             else
  157.                 icon.cd:Hide()
  158.             end
  159.         end
  160.         if icon.count then
  161.             icon.count:SetText(count > 1 and count)
  162.         end
  163.         if icon.overlay then
  164.             icon.overlay:Hide()
  165.         end
  166.         icon:SetAlpha(watch.presentAlpha)
  167.         icon:Show()
  168.         if watch.PostResetIcon then watch.PostResetIcon(watch, icon) end
  169.     end
  170. end
  171.  
  172. local function ResetIcon(watch, icon, ...)
  173.     if watch.OverrideResetIcon then
  174.         watch.OverrideResetIcon(watch, icon, ...)
  175.     else
  176.         DefaultResetIcon(watch, icon, ...)
  177.     end
  178. end
  179.  
  180. local function DefaultExpireIcon(watch, icon)
  181.     if not icon.onlyShowPresent then
  182.         if icon.cd then
  183.             icon.cd:Hide()
  184.         end
  185.         if icon.count then
  186.             icon.count:SetText()
  187.         end
  188.         icon:SetAlpha(watch.missingAlpha)
  189.         if icon.overlay then
  190.             icon.overlay:Show()
  191.         end
  192.         icon:Show()
  193.         if watch.PostExpireIcon then watch.PostExpireIcon(watch, icon) end
  194.     end
  195. end
  196.  
  197. local function ExpireIcon(watch, icon, ...)
  198.     if watch.OverrideExpireIcon then
  199.         watch.OverrideExpireIcon(watch, icon, ...)
  200.     else
  201.         DefaultExpireIcon(watch, icon, ...)
  202.     end
  203. end
  204.  
  205. local Update
  206. do
  207.     local found = {}
  208.     function Update(frame, event, unit)
  209.         if frame.unit ~= unit then return end
  210.         local watch = frame.AuraWatch
  211.         local index, icons = 1, watch.watched
  212.         local _, name, texture, count, duration, remaining, caster, key, icon, spellid
  213.         local filter = "HELPFUL"
  214.         local guid = UnitGUID(unit)
  215.         if not GUIDs[guid] then SetupGUID(guid) end
  216.        
  217.         for key, icon in pairs(icons) do
  218.             icon:Hide()
  219.         end
  220.        
  221.         while true do
  222.             name, _, texture, count, _, duration, remaining, caster, _, _, spellid = UnitAura(unit, index, filter)
  223.             if not name then
  224.                 if filter == "HELPFUL" then
  225.                     filter = "HARMFUL"
  226.                     index = 1
  227.                 else
  228.                     break
  229.                 end
  230.             else
  231.                 if watch.strictMatching then
  232.                     key = spellid
  233.                 else
  234.                     key = name..texture
  235.                 end
  236.                 icon = icons[key]
  237.                 if icon and (icon.anyUnit or (caster and icon.fromUnits[caster])) then
  238.                     ResetIcon(watch, icon, count, duration, remaining)
  239.                     GUIDs[guid][key] = true
  240.                     found[key] = true
  241.                 end
  242.                 index = index + 1
  243.             end
  244.         end
  245.        
  246.         for key in pairs(GUIDs[guid]) do
  247.             if icons[key] and not found[key] then
  248.                 ExpireIcon(watch, icons[key])
  249.             end
  250.         end
  251.        
  252.         wipe(found)
  253.     end
  254. end
  255.  
  256. local function SetupIcons(self)
  257.  
  258.     local watch = self.AuraWatch
  259.     local icons = watch.icons
  260.     watch.watched = {}
  261.     if not watch.missingAlpha then watch.missingAlpha = 0.75 end
  262.     if not watch.presentAlpha then watch.presentAlpha = 1 end
  263.    
  264.     for _,icon in pairs(icons) do
  265.    
  266.         local name, _, image = GetSpellInfo(icon.spellID)
  267.         if not name then error("oUF_AuraWatch error: no spell with "..tostring(icon.spellID).." spell ID exists") end
  268.         icon.name = name
  269.    
  270.         if not watch.customIcons then
  271.             local cd = CreateFrame("Cooldown", nil, icon)
  272.             cd:SetAllPoints(icon)
  273.             icon.cd = cd
  274.  
  275.             local tex = icon:CreateTexture(nil, "BACKGROUND")
  276.             tex:SetAllPoints(icon)
  277.             tex:SetTexture(image)
  278.             icon.icon = tex
  279.            
  280.             local overlay = icon:CreateTexture(nil, "OVERLAY")
  281.             overlay:SetTexture"Interface\\Buttons\\UI-Debuff-Overlays"
  282.             overlay:SetAllPoints(icon)
  283.             overlay:SetTexCoord(.296875, .5703125, 0, .515625)
  284.             overlay:SetVertexColor(1, 0, 0)
  285.             icon.overlay = overlay
  286.  
  287.             local count = icon:CreateFontString(nil, "OVERLAY")
  288.             count:SetFontObject(NumberFontNormal)
  289.             count:SetPoint("BOTTOMRIGHT", icon, "BOTTOMRIGHT", -1, 0)
  290.             icon.count = count
  291.         end
  292.  
  293.         if icon.onlyShowMissing == nil then
  294.             icon.onlyShowMissing = watch.onlyShowMissing
  295.         end
  296.         if icon.onlyShowPresent == nil then
  297.             icon.onlyShowPresent = watch.onlyShowPresent
  298.         end
  299.         if icon.fromUnits == nil then
  300.             icon.fromUnits = watch.fromUnits or PLAYER_UNITS
  301.         end
  302.         if icon.anyUnit == nil then
  303.             icon.anyUnit = watch.anyUnit
  304.         end
  305.        
  306.         if watch.strictMatching then
  307.             watch.watched[icon.spellID] = icon
  308.         else
  309.             watch.watched[name..image] = icon
  310.         end
  311.  
  312.         if watch.PostCreateIcon then watch:PostCreateIcon(icon, icon.spellID, name, self) end
  313.     end
  314. end
  315.  
  316. local function ForceUpdate(element)
  317.     return Update(element.__owner, 'ForceUpdate', element.__owner.unit)
  318. end
  319.  
  320. local function Enable(self)
  321.     if self.AuraWatch then
  322.         self.AuraWatch.__owner = self
  323.         self.AuraWatch.ForceUpdate = ForceUpdate
  324.        
  325.         self:RegisterEvent("UNIT_AURA", Update)
  326.         SetupIcons(self)
  327.         return true
  328.     else
  329.         return false
  330.     end
  331. end
  332.  
  333. local function Disable(self)
  334.     if self.AuraWatch then
  335.         self:UnregisterEvent("UNIT_AURA", Update)
  336.         for _,icon in pairs(self.AuraWatch.icons) do
  337.             icon:Hide()
  338.         end
  339.     end
  340. end
  341.  
  342. oUF:AddElement("AuraWatch", Update, Enable, Disable)

Here's the block of code in question [256 - 314]:

(Line 12 in this block is 267)
lua Code:
  1. local function SetupIcons(self)
  2.  
  3.     local watch = self.AuraWatch
  4.     local icons = watch.icons
  5.     watch.watched = {}
  6.     if not watch.missingAlpha then watch.missingAlpha = 0.75 end
  7.     if not watch.presentAlpha then watch.presentAlpha = 1 end
  8.    
  9.     for _,icon in pairs(icons) do
  10.    
  11.         local name, _, image = GetSpellInfo(icon.spellID)
  12.         if not name then error("oUF_AuraWatch error: no spell with "..tostring(icon.spellID).." spell ID exists") end
  13.         icon.name = name
  14.    
  15.         if not watch.customIcons then
  16.             local cd = CreateFrame("Cooldown", nil, icon)
  17.             cd:SetAllPoints(icon)
  18.             icon.cd = cd
  19.  
  20.             local tex = icon:CreateTexture(nil, "BACKGROUND")
  21.             tex:SetAllPoints(icon)
  22.             tex:SetTexture(image)
  23.             icon.icon = tex
  24.            
  25.             local overlay = icon:CreateTexture(nil, "OVERLAY")
  26.             overlay:SetTexture"Interface\\Buttons\\UI-Debuff-Overlays"
  27.             overlay:SetAllPoints(icon)
  28.             overlay:SetTexCoord(.296875, .5703125, 0, .515625)
  29.             overlay:SetVertexColor(1, 0, 0)
  30.             icon.overlay = overlay
  31.  
  32.             local count = icon:CreateFontString(nil, "OVERLAY")
  33.             count:SetFontObject(NumberFontNormal)
  34.             count:SetPoint("BOTTOMRIGHT", icon, "BOTTOMRIGHT", -1, 0)
  35.             icon.count = count
  36.         end
  37.  
  38.         if icon.onlyShowMissing == nil then
  39.             icon.onlyShowMissing = watch.onlyShowMissing
  40.         end
  41.         if icon.onlyShowPresent == nil then
  42.             icon.onlyShowPresent = watch.onlyShowPresent
  43.         end
  44.         if icon.fromUnits == nil then
  45.             icon.fromUnits = watch.fromUnits or PLAYER_UNITS
  46.         end
  47.         if icon.anyUnit == nil then
  48.             icon.anyUnit = watch.anyUnit
  49.         end
  50.        
  51.         if watch.strictMatching then
  52.             watch.watched[icon.spellID] = icon
  53.         else
  54.             watch.watched[name..image] = icon
  55.         end
  56.  
  57.         if watch.PostCreateIcon then watch:PostCreateIcon(icon, icon.spellID, name, self) end
  58.     end
  59. end

I'm unsure of what exactly I'm supposed to be looking for because neither "50720" nor "Vigilance" are anywhere in that file. At the moment this seems to only be Warrior-specific as it's not happening with my Paladin (but she's another story altogether). If anyone needs me to link other Lua files from this layout, do not hesitate to ask.
  Reply With Quote