View Single Post
08-12-08, 01:52 AM   #5
Olvar
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 10
Maybe IsHarmfulSpell() is what you are looking for?

For some reason I didn't find it on WoWwiki, just WoWprogramming. I hope this function actually works, because I didn't test it:

http://wowprogramming.com/docs/api/IsHarmfulSpell

Depending on when you want to distinguish spells you might also do so with the new combat log event. Here is an excerpt from my Pull Warning that decides if an enemy was the target of someone in my party or raid:

Code:
function PullWarning_OnEvent(self, event, ...)
  -- Check if a non-outsider performed a cast onto a hostile target
  if event == "COMBAT_LOG_EVENT_UNFILTERED" then
    -- Get more information from the combat log event
    local _, _, _, srcName, srcFlags, _, destName, destFlags, spellID, spellName = ...
    -- Is the spell on the ignore list?
    if IgnoreSpell[spellID] then
      return
    end
    -- Isn't the target hostile?
    if bitand(destFlags, COMBATLOG_OBJECT_REACTION_HOSTILE) == 0 then
      return
    end
    -- If pull warning was forced only my own spells with hostile targets are interesting
    if PullWarningForced then
      if bitand(srcFlags,  COMBATLOG_OBJECT_AFFILIATION_MINE) ~= 0 then
        PullWarningForced = false
        PullWarningInProgress = true
        PullWarning_DisplayWarning(PullWarningTargetFormat, srcName, destName)
        frame:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
      end
    -- Was the spell cast onto an enemy by me or someone in my party or raid?
    elseif bitand(srcFlags, ( COMBATLOG_OBJECT_AFFILIATION_MINE +
                              COMBATLOG_OBJECT_AFFILIATION_PARTY +
                              COMBATLOG_OBJECT_AFFILIATION_RAID )) ~= 0 then
      PullWarningInProgress = true
      PullWarning_DisplayWarning(PullWarningTargetFormat, srcName, destName)
      frame:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    end
  Reply With Quote