View Single Post
09-23-14, 09:53 AM   #6
liquidbase
A Warpwood Thunder Caller
 
liquidbase's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2010
Posts: 97
After moving these two values into the OnEvent-function it works. I had replace GUID and Name in the function with UnitGUID("player") and UnitName("player") and it works. Code looks now posted below and ist works.

Lua Code:
  1. local D, C, L = unpack(select(2, ...))
  2. if C["duffed"].spellannounce ~= true then return end
  3.  
  4. D.Spells = {
  5.     -- Death Knight
  6.     [48792] = true, -- Icebound Fortitude
  7.     [48707] = true, -- Anti-Magic-Shell
  8.     [55233] = true, -- Vampric Blood
  9.     [61999] = true, -- Raise Ally
  10.     [113072] = true, -- Symbiosis (Might of Ursoc)
  11.  
  12.     -- Druid
  13.     [61336] = true, -- Survival Insticts
  14.     [106922] = true, -- Might of Ursoc
  15.  
  16.     -- Monk
  17.     [115203] = true, -- Fortifying Brew
  18.     [115213] = true, -- Avert Harm
  19.     [113306] = true, -- Symbiosis (Survival Insticts)
  20.  
  21.     -- Paladin
  22.     [498] = true, -- Divine Protection
  23.     [642] = true, -- Divine Shield
  24.     [31850] = true, -- Ardent Defender
  25.     [113075] = true, -- Symbiosis (Barkskin)
  26.    
  27.     -- Priest
  28.     [33206] = true, -- Pain Supression
  29.     [47788] = true, -- Guardian Spirit
  30.     [62618] = true, -- PW: Barrier
  31.     [109964] = true, -- Spirit Shell
  32.  
  33.     -- Shaman
  34.     [16190] = true, -- Mana Tide Totem
  35.     [98008] = true, -- Spirit Link Totem
  36.     [108280] = true, -- Healing Tide Totem
  37.     [120668] = true, -- Stormlash Totem
  38.  
  39.     -- Warlock
  40.     [20707] = true, -- Soulstone
  41.  
  42.     -- Warrior
  43.     [871] = true, -- Shield Wall
  44.     [12975] = true, -- Last Stand
  45.     [97462] = true, -- Rallying Cry
  46.     [114192] = true, -- Mocking Banner
  47.     [114203] = true, -- Demoralizing Banner
  48.     [114207] = true, -- Skull Banner
  49.     [122286] = true, -- Symbiosis (Savage Defense)
  50. }
  51.  
  52. local select = select
  53. local SendChatMessage = SendChatMessage
  54. local UnitAura = UnitAura
  55. local WaitTable = {}
  56.  
  57. local OnEvent = function(self, event, ...)
  58.     local Time, Type, HideCaster, SourceGUID, SourceName, SourceFlags, SourceRaidFlags, DestGUID, DestName, DestFlags, DestRaidFlags, SpellID, SpellName = ...
  59.  
  60.     if (SourceGUID ~= UnitGUID("player")) then return end
  61.  
  62.     if (D.Spells[SpellID] and Type == "SPELL_CAST_SUCCESS") then
  63.         if (not DestName) then DestName = SourceName end
  64.  
  65.         local Duration = select(6, UnitAura(DestName, SpellName)) or 10
  66.         local SpellString = "\124cff71d5ff\124Hspell:" .. SpellID .. "\124h[" .. SpellName .. "]\124h\124r"
  67.         local AnnounceTo = C["duffed"].announcechannel
  68.  
  69.         if (DestName ~= UnitName("player")) then
  70.             if (Duration == nil) then
  71.                 SendChatMessage("++ ".. SpellString .. " on " .. DestName .. "!", AnnounceTo)
  72.             else
  73.                 SendChatMessage("++ ".. SpellString .. " on " .. DestName .. " for " .. Duration .. " s", AnnounceTo)
  74.             end
  75.         else
  76.             SendChatMessage("++ ".. SpellString .. " for " .. Duration .. " s", AnnounceTo)
  77.         end
  78.         D.Delay(Duration, SendChatMessage, "-- ".. SpellString, AnnounceTo)
  79.     end
  80. end
  81.  
  82. local AnnounceFrame = CreateFrame("Frame")
  83. AnnounceFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  84. AnnounceFrame:SetScript("OnEvent", OnEvent)

Thanks Duugu, you have point me in the correct direction with your help