-- Grab a copy of the local data local addonName, addonData = ... local Translate = addonData.Translate local expansionLevel = GetExpansionLevel() addonData.ValidateSpellCast = function(self,status,caster,spellName,spellRank) if ( caster ~= "player" or not spellName ) then return false end local spellID = nil local spellDump = nil local spellLink = GetSpellLink(spellName,"") if ( not spellLink ) then return false end local found, spellDump, spellString = string.find(spellLink,"^|c%x+|H(.+)|h%[.*%]") if ( found ) then spellDump,spellID = strsplit(":",spellString) end spellID = tonumber(spellID) if ( not spellID ) then return false end local portalSpell = false local teleportSpell = false for i,v in pairs(self.PortalDB) do v.spellID = tonumber(v.spellID) if ( v.spellID == spellID ) then portalSpell = true break end end for i,v in pairs(self.TeleportDB) do v.spellID = tonumber(v.spellID) if ( v.spellID == spellID ) then teleportSpell = true break end end if ( status == "STOP" ) then if ( portalSpell or teleportSpell ) then return true end return false end local isGrouped = ( GetNumGroupMembers() > 0 ) if ( isGrouped ) then if ( teleportSpell ) then UIErrorsFrame:AddMessage(Translate["PARTY_TELEPORT"], 1.0,1.0,0.0) end else if ( portalSpell ) then UIErrorsFrame:AddMessage(Translate["SOLO_PORTAL"], 1.0,1.0,0.0) end end if ( portalSpell or teleportSpell ) then return true end return false end local function OnEvent(self,event,...) local arg1,arg2,arg3 = ... if event == "UNIT_SPELLCAST_START" then if ( addonData:ValidateSpellCast("START", arg1, arg2, arg3) ) then end elseif event == "UNIT_SPELLCAST_STOP" then if ( addonData:ValidateSpellCast("STOP", arg1, arg2, arg3) ) then end end end local SpellCastEventWatcher = CreateFrame("Frame","XMP_ValidateSpellCasts",UIParent) SpellCastEventWatcher:SetScript( "OnEvent", OnEvent ); SpellCastEventWatcher:RegisterEvent( "UNIT_SPELLCAST_START" ); SpellCastEventWatcher:RegisterEvent( "UNIT_SPELLCAST_STOP" );