View Single Post
10-25-12, 11:27 AM   #1
Monolit
A Black Drake
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 81
UNIT_SPELLCAST_SENT for 'active' world objects

It's not there... it's just not!

So I have a custom lag / safezone display for my cast bars, but for some weird reason UNIT_SPELLCAST_SENT event just doesn't fire for objects like Untiled Soil (farm).

and here's the problem:
with normal cast or opening normal objects (like chests or anything else with a cogwheel icon) it's all nice and fancy http://i.imgur.com/PLiHS.jpg

but when we try to use untiled soil UNIT_SPELLCAST_SENT just never happens
http://i.imgur.com/PaUsc.jpg

lua Code:
  1. cast.OnCastSent = function(self, event, unit, spell, rank)
  2.     if self.unit ~= unit or not self.Castbar.SafeZone then return end
  3.     self.Castbar.SafeZone.sendTime = GetTime()
  4.     --print('DEBUG: sending cast')
  5. end
from https://github.com/Strigoy/MonoUI/bl...ds/Castbar.lua
lua Code:
  1. lib.gen_castbar = function(f)
  2.     local s = CreateFrame("StatusBar", "oUF_monoCastbar"..f.mystyle, f)
  3.  
  4. ...
  5.  
  6.     elseif f.mystyle == "player" then
  7.       if cfg.playerCBuserplaced then
  8.         s:SetSize(cfg.playerCBwidth,cfg.playerCBheight)
  9.         s:SetPoint(unpack(cfg.playerCBposition))
  10.         i:SetSize(s:GetHeight()-2,s:GetHeight()-2)
  11.         sp:SetHeight(s:GetHeight()*2.5)
  12.       else
  13.         s:SetPoint("TOPRIGHT",f.Power,"BOTTOMRIGHT",0,-4)
  14.       end
  15.       --latency only for player unit
  16.       local z = s:CreateTexture(nil, "OVERLAY")
  17.       z:SetBlendMode("ADD")
  18.       z:SetTexture(cfg.statusbar_texture)
  19.       -- it should never fill the entire castbar when GetNetStats() returns 0
  20.       z:SetVertexColor(.8,.31,.45)
  21.       z:SetPoint("TOPRIGHT")
  22.       z:SetPoint("BOTTOMRIGHT")
  23.       --if UnitInVehicle("player") then z:Hide() end
  24.       s.SafeZone = z
  25.       --custom latency display
  26.       local l = lib.gen_fontstring(s, cfg.font, 10, "THINOUTLINE")
  27.       l:SetPoint("CENTER", -2, 16)
  28.       l:SetJustifyH("RIGHT")
  29.       s.Lag = l
  30.       f:RegisterEvent("UNIT_SPELLCAST_SENT", cast.OnCastSent)
  31.     elseif f.mystyle == "target" and cfg.targetCBuserplaced then
  32.       s:SetSize(cfg.targetCBwidth,cfg.targetCBheight)
  33.       s:SetPoint(unpack(cfg.targetCBposition))
  34.       i:SetSize(s:GetHeight()-2,s:GetHeight()-2)
  35.       sp:SetHeight(s:GetHeight()*2.5)
  36.     else
  37.       s:SetPoint("TOPRIGHT",f.Power,"BOTTOMRIGHT",0,-4)
  38.     end
  39.  
  40.     s.OnUpdate = cast.OnCastbarUpdate
  41.     s.PostCastStart = cast.PostCastStart
  42.     s.PostChannelStart = cast.PostCastStart
  43.     s.PostCastStop = cast.PostCastStop
  44.     s.PostChannelStop = cast.PostChannelStop
  45.     s.PostCastFailed = cast.PostCastFailed
  46.     s.PostCastInterrupted = cast.PostCastFailed
  47.    
  48.     f.Castbar = s
  49.     f.Castbar.Text = txt
  50.     f.Castbar.Time = t
  51.     f.Castbar.Icon = i
  52.     f.Castbar.Spark = sp
  53.   end
from https://github.com/Strigoy/MonoUI/bl...F_mono/lib.lua


Am I missing something or is there some workaround for that problem?

Last edited by Monolit : 10-25-12 at 11:40 AM.
  Reply With Quote