Public feed
#891478
----------------------------------------------------------- Spell Alertlocal formatgs = function(gstring, anchor) gstring = string.gsub(gstring,"([%^%(%)%.%[%]%*%+%-%?])","%%%1") gstring = string.gsub(gstring,"%%s","(.+)") gstring = string.gsub(gstring,"%%d","(%-?%%d+)") if anchor then gstring = "^"..gstring end return gstringendlocal casting = formatgs(SPELLCASTOTHERSTART)local totem = formatgs(SPELLCASTGOOTHER)local buff = formatgs(AURAADDEDOTHERHELPFUL)local istotem = "Totem"if GetLocale()=="koKR" then istotem = "토템"elseif GetLocale()=="zhCN" then istotem = "图腾"elseif GetLocale()=="zhTW" then istotem = "圖騰"elseif GetLocale()=="esES" then istotem = "Tótem"endlocal inparty = function(unit) for i = 1, GetNumPartyMembers() do local name = UnitName("party"..i) if name == unit then return true end endendlocal spellevent = function() local unit, spell if event == "CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE" then for unit, spell in string.gmatch(arg1, casting) do if not inparty(unit) then Nurfed_SpellAlert:AddMessage("nrf:"..format(SPELLCASTOTHERSTART, unit, "|cffff0000"..spell.."|r")) end end elseif event == "CHAT_MSG_SPELL_HOSTILEPLAYER_BUFF" then for unit, spell in string.gmatch(arg1, casting) do if not inparty(unit) then Nurfed_SpellAlert:AddMessage("nrf:"..format(SPELLCASTOTHERSTART, unit, "|cffffff00"..spell.."|r")) end return end for unit, spell in string.gmatch(arg1, totem) do if not inparty(unit) and string.find(spell, istotem) then Nurfed_SpellAlert:AddMessage("nrf:"..format(SPELLCASTGOOTHER, unit, "|cff999999"..spell.."|r")) end return end for unit, spell in string.gmatch(arg1, buff) do if string.find(spell, "^%a") then Nurfed_BuffAlert:AddMessage("nrf:"..format(AURAADDEDOTHERHELPFUL, unit, "|cff00ff00"..spell.."|r")) end return end elseif event == "CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_BUFFS" then for unit, spell in string.gmatch(arg1, buff) do if string.find(spell, "^%a") then Nurfed_BuffAlert:AddMessage("nrf:"..format(AURAADDEDOTHERHELPFUL, unit, "|cff00ff00"..spell.."|r")) end end endend-- Drag Handle by Apocolocal createhandle = function(name, title) if not name or not title then return end local f = CreateFrame("Frame", name, UIParent) f:SetWidth(110) f:SetHeight(13) f:SetBackdrop({ bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = true, tileSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0 } }) f:SetBackdropColor(0,0,0) f:SetMovable() f:EnableMouse() f:RegisterForDrag("LeftButton") f:SetClampedToScreen() f:Hide() if not f:IsUserPlaced() then f:SetPoint("CENTER") end -- font f.text = f:CreateFontString(nil, "OVERLAY") f.text:SetPoint("CENTER") f.text:SetFontObject("GameFontNormalSmall") f.text:SetText(title) f.text:SetTextColor(1,1,1) -- dragging f:SetScript("OnDragStart", function(self) if (not NRF_LOCKED and not InCombatLockdown() and IsAddOnLoaded("Nurfed")) or not IsAddOnLoaded("Nurfed") then self:StartMoving() end end) f:SetScript("OnDragStop", function(self) if (not NRF_LOCKED and not InCombatLockdown() and IsAddOnLoaded("Nurfed")) or not IsAddOnLoaded("Nurfed") then self:StopMovingOrSizing() self:SetUserPlaced(true) end end)endcreatehandle("Nrf_SpellAlert", "Nurfed_SpellAlert")CreateFrame("MessageFrame", "Nurfed_SpellAlert", UIParent)Nurfed_SpellAlert:SetWidth(UIParent:GetWidth())Nurfed_SpellAlert:SetHeight(20)Nurfed_SpellAlert:SetInsertMode("TOP")Nurfed_SpellAlert:SetFrameStrata("HIGH")Nurfed_SpellAlert:SetTimeVisible(1)Nurfed_SpellAlert:SetFadeDuration(0.5)Nurfed_SpellAlert:SetFont("Fonts\\FRIZQT__.TTF", 18, "OUTLINE")Nurfed_SpellAlert:SetPoint("CENTER", "Nrf_SpellAlert", 0, -13)Nurfed_SpellAlert:RegisterEvent("CHAT_MSG_SPELL_HOSTILEPLAYER_DAMAGE")Nurfed_SpellAlert:RegisterEvent("CHAT_MSG_SPELL_HOSTILEPLAYER_BUFF")Nurfed_SpellAlert:RegisterEvent("CHAT_MSG_SPELL_PERIODIC_HOSTILEPLAYER_BUFFS")Nurfed_SpellAlert:SetScript("OnEvent", spellevent)createhandle("Nrf_BuffAlert", "Nurfed_BuffAlert")CreateFrame("MessageFrame", "Nurfed_BuffAlert", UIParent)Nurfed_BuffAlert:SetWidth(UIParent:GetWidth())Nurfed_BuffAlert:SetHeight(20)Nurfed_BuffAlert:SetInsertMode("TOP")Nurfed_BuffAlert:SetFrameStrata("HIGH")Nurfed_BuffAlert:SetTimeVisible(1)Nurfed_BuffAlert:SetFadeDuration(0.5)Nurfed_BuffAlert:SetFont("Fonts\\FRIZQT__.TTF", 18, "OUTLINE")Nurfed_BuffAlert:SetPoint("CENTER", "Nrf_BuffAlert", 0, -13)if IsAddOnLoaded("Nurfed") then Nurfed:regevent("NURFED_LOCK", function() if NRF_LOCKED then Nrf_BuffAlert:Hide() Nrf_SpellAlert:Hide() else Nrf_BuffAlert:Show() Nrf_SpellAlert:Show() end end)end