Thread Tools Display Modes
Prev Previous Post   Next Post Next
09-18-14, 03:32 PM   #1
remusa
A Defias Bandit
Join Date: Sep 2014
Posts: 2
Set raid icons with successful spell

Hello everybody, I've been using the addon "Arena Raid Icons" or scripts to put raid icons on party members in arena. I modified the script trying to make it set icons when I use an ability (for abilities that remove raid icons, I think vanish,shadowmeld,etc. still do this).

If I use a macro with "SetRaidTarget" it doesn't toggle the icon, "SetRaidTargetIcon" does. I'm using SetRaidTarget in the script but it keeps toggling on and off whenever I use an ability, I'd like any help in order to avoid this.

Here's the code:
Code:
    local f = CreateFrame("Frame")
    local MAGE = GetSpellInfo(61316)            --Dalaran Brilliance
    local ROGUE = GetSpellInfo(1784)            --Stealth
    local MONK = GetSpellInfo(115921)           --Legacy of the White Tiger
    local PRIEST = GetSpellInfo(21562)          --Power Word: Fortitude
    local SHAMAN = GetSpellInfo(52127)          --Water Shield
    local DRUID = GetSpellInfo(1126)            --Mark of the Wild
    local PALADIN = GetSpellInfo(20217)         --Blessing of Kings
    local DEATHKNIGHT = GetSpellInfo(57330)     --Horn of Winter
    local WARLOCK = GetSpellInfo(109773)        --Dark Intent
    local WARRIOR = GetSpellInfo(6673)          --Battle Shout
    local HUNTER = GetSpellInfo(13165)          --Aspect of the Hawk
    f:RegisterEvent("UNIT_SPELLCAST_SENT")
    f:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
    f:SetScript("OnEvent",
    function(self, event, arg1, arg2)
        if arg1 == "player" and (arg2 == MAGE) then
            if event == "UNIT_SPELLCAST_SUCCEEDED" then
                members = GetNumGroupMembers();
                ci={ROGUE=1,DRUID=2,WARLOCK=3,PALADIN=3,HUNTER=4,MONK=4,PRIEST=6,MAGE=5,SHAMAN=6,WARRIOR=7,DEATHKNIGHT=8}
                SetRaidTarget('player',ci[select(2,UnitClass('player'))])
                for i=1,(members-1) do
                    SetRaidTarget('party'..i,ci[select(2,UnitClass('party'..i))])
                end
            end
        elseif arg1 == "player" and arg2 == ROGUE then
            if event == "UNIT_SPELLCAST_SUCCEEDED" then
                members = GetNumGroupMembers();
                ci={ROGUE=1,DRUID=2,WARLOCK=3,PALADIN=3,HUNTER=4,MONK=4,PRIEST=5,MAGE=5,SHAMAN=6,WARRIOR=7,DEATHKNIGHT=8}
                SetRaidTarget('player',ci[select(2,UnitClass('player'))])
                for i=1,(members-1) do
                    SetRaidTarget('party'..i,ci[select(2,UnitClass('party'..i))])
                end
            end
        elseif arg1 == "player" and arg2 == MONK then
            if event == "UNIT_SPELLCAST_SUCCEEDED" then
                members = GetNumGroupMembers();
                ci={ROGUE=1,DRUID=2,WARLOCK=3,PALADIN=3,HUNTER=4,MONK=4,PRIEST=5,MAGE=5,SHAMAN=6,WARRIOR=7,DEATHKNIGHT=8}
                SetRaidTarget('player',ci[select(2,UnitClass('player'))])
                for i=1,(members-1) do
                    SetRaidTarget('party'..i,ci[select(2,UnitClass('party'..i))])
                end
            end
        elseif arg1 == "player" and arg2 == PRIEST then
            if event == "UNIT_SPELLCAST_SUCCEEDED" then
                members = GetNumGroupMembers();
                ci={ROGUE=1,DRUID=2,WARLOCK=3,PALADIN=3,HUNTER=4,MONK=4,PRIEST=5,MAGE=6,SHAMAN=6,WARRIOR=7,DEATHKNIGHT=8}
                SetRaidTarget('player',ci[select(2,UnitClass('player'))])
                for i=1,(members-1) do
                    SetRaidTarget('party'..i,ci[select(2,UnitClass('party'..i))])
                end
            end
        elseif arg1 == "player" and arg2 == SHAMAN then
            if event == "UNIT_SPELLCAST_SUCCEEDED" then
                members = GetNumGroupMembers();
                ci={ROGUE=1,DRUID=2,WARLOCK=3,PALADIN=3,HUNTER=4,MONK=4,PRIEST=5,MAGE=5,SHAMAN=6,WARRIOR=7,DEATHKNIGHT=8}
                SetRaidTarget('player',ci[select(2,UnitClass('player'))])
                for i=1,(members-1) do
                    SetRaidTarget('party'..i,ci[select(2,UnitClass('party'..i))])
                end
            end
        elseif arg1 == "player" and arg2 == DRUID then
            if event == "UNIT_SPELLCAST_SUCCEEDED" then
                members = GetNumGroupMembers();
                ci={ROGUE=1,DRUID=2,WARLOCK=3,PALADIN=3,HUNTER=4,MONK=4,PRIEST=5,MAGE=5,SHAMAN=6,WARRIOR=7,DEATHKNIGHT=8}
                SetRaidTarget('player',ci[select(2,UnitClass('player'))])
                for i=1,(members-1) do
                    SetRaidTarget('party'..i,ci[select(2,UnitClass('party'..i))])
                end
            end
        elseif arg1 == "player" and arg2 == PALADIN then
            if event == "UNIT_SPELLCAST_SUCCEEDED" then
                members = GetNumGroupMembers();
                ci={ROGUE=1,DRUID=2,WARLOCK=2,PALADIN=3,HUNTER=4,MONK=4,PRIEST=5,MAGE=5,SHAMAN=6,WARRIOR=7,DEATHKNIGHT=8}
                SetRaidTarget('player',ci[select(2,UnitClass('player'))])
                for i=1,(members-1) do
                    SetRaidTarget('party'..i,ci[select(2,UnitClass('party'..i))])
                end
            end
        elseif arg1 == "player" and arg2 == DEATHKNIGHT then
            if event == "UNIT_SPELLCAST_SUCCEEDED" then
                members = GetNumGroupMembers();
                ci={ROGUE=1,DRUID=2,WARLOCK=3,PALADIN=3,HUNTER=4,MONK=4,PRIEST=5,MAGE=5,SHAMAN=6,WARRIOR=7,DEATHKNIGHT=8}
                SetRaidTarget('player',ci[select(2,UnitClass('player'))])
                for i=1,(members-1) do
                    SetRaidTarget('party'..i,ci[select(2,UnitClass('party'..i))])
                end
            end
        elseif arg1 == "player" and arg2 == WARLOCK then
            if event == "UNIT_SPELLCAST_SUCCEEDED" then
                members = GetNumGroupMembers();
                ci={ROGUE=1,DRUID=2,WARLOCK=3,PALADIN=6,HUNTER=4,MONK=4,PRIEST=5,MAGE=5,SHAMAN=6,WARRIOR=7,DEATHKNIGHT=8}
                SetRaidTarget('player',ci[select(2,UnitClass('player'))])
                for i=1,(members-1) do
                    SetRaidTarget('party'..i,ci[select(2,UnitClass('party'..i))])
                end
            end
        elseif arg1 == "player" and arg2 == WARRIOR then
            if event == "UNIT_SPELLCAST_SUCCEEDED" then
                members = GetNumGroupMembers();
                ci={ROGUE=1,DRUID=2,WARLOCK=3,PALADIN=3,HUNTER=4,MONK=4,PRIEST=5,MAGE=5,SHAMAN=6,WARRIOR=7,DEATHKNIGHT=8}
                SetRaidTarget('player',ci[select(2,UnitClass('player'))])
                for i=1,(members-1) do
                    SetRaidTarget('party'..i,ci[select(2,UnitClass('party'..i))])
                end
            end
        elseif arg1 == "player" and arg2 == HUNTER then
            if event == "UNIT_SPELLCAST_SUCCEEDED" then
                members = GetNumGroupMembers();
                ci={ROGUE=1,DRUID=2,WARLOCK=2,PALADIN=3,HUNTER=4,MONK=2,PRIEST=5,MAGE=5,SHAMAN=6,WARRIOR=7,DEATHKNIGHT=8}
                SetRaidTarget('player',ci[select(2,UnitClass('player'))])
                for i=1,(members-1) do
                    SetRaidTarget('party'..i,ci[select(2,UnitClass('party'..i))])
                end
            end
        end
    end
    )
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Set raid icons with successful spell


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off