Skip to content
View in the app

A better way to browse. Learn more.

WRobot

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Solved] How to detect debuff Type ?

Featured Replies

Hello,

 

I want an Lua script to detect debuff type only. Like if its  magic / poison / curse..etc If its poison = Cast my spell..?

 

I don't want to type debuff names such as Crippling, Wound....etc. That would be very very long list, I just want to check the debuff "type" and cast my spell based on that.

 

 

  • Author
2 minutes ago, reapler said:

Hello, i guess you need this in .xml fightclass? If yes you may specify what it should return or in which context you need this.

Well basically, I added Abolish poison in my fightclass which is .xml. And I want to Cast Abolish poison whenever I am inflected by a poison using condition "Lua script"

So i've researched a bit, because i'm not .xml fan :)

This snippet can be pasted, if you add a new condtion on your spell with "C Sharp Code" in the right pane on the textbox "Value":

                                Lua.LuaDoString<bool>(@"
                                    for i=1,25 do 
	                                local _, _, _, _, d  = UnitDebuff('player',i);
	                                if d == 'Poison' then
                                    return true
                                    end
                                end")

 

  • Author
19 minutes ago, reapler said:

So i've researched a bit, because i'm not .xml fan :)

This snippet can be pasted, if you add a new condtion on your spell with "C Sharp Code" in the right pane on the textbox "Value":


                                Lua.LuaDoString<bool>(@"
                                    for i=1,25 do 
	                                local _, _, _, _, d  = UnitDebuff('player',i);
	                                if d == 'Poison' then
                                    return true
                                    end
                                end")

 

This didn't work..Sorry for the trouble my friend and I appreciate your help.

9 minutes ago, lonellywolf said:

This didn't work..Sorry for the trouble my friend and I appreciate your help.

This is a C# condition. If you want to use raw lua just take the lua command (the string part) and put it into your lua condition.

 

EDIT: Nvm reapler still wrote that it is c# code :laugh:

4 minutes ago, iMod said:

EDIT: Nvm reapler still wrote that it is c# code :laugh:

Yep, that's not a secret that i love c# ;)

13 minutes ago, lonellywolf said:

This didn't work..Sorry for the trouble my friend and I appreciate your help.

I've tried on wotlk, it works flawless: Abolish Poison test.xml

Dunno how it will work on tbc, but in the wow api i haven't found any considerable changes.

  • Author
3 minutes ago, reapler said:

Yep, that's not a secret that i love c# ;)

I've tried on wotlk, it works flawless: Abolish Poison test.xml

Dunno how it will work on tbc, but in the wow api i haven't found any considerable changes.

I copied it from your sample file and worked!  I think I had some spaces or something the first time! THANK YOU SO MUCH!! Thats amazing!

  • 5 years later...

Reviving this from way back.  I am trying to do this but with magic and coming up empty.  This is for 3.3.5

    <FightClassSpell>
      <FightClassConditions>
        <FightClassCondition>
          <ContionType>CSharpCode</ContionType>
          <Param xsi:type="FightClassConditionString">
            <Value>                                Lua.LuaDoString&lt;bool&gt;(@"
                                    for i=1,25 do 
                                    local _, _, _, _, d  = UnitDebuff('player',i);
                                    if d == 'Magic' then
                                    return true
                                    end
                                end")</Value>
          </Param>
        </FightClassCondition>
      </FightClassConditions>
      <SpellName>CastSpellByID(100503);</SpellName>
      <Priority>13</Priority>
      <CombatOnly>false</CombatOnly>
      <CheckIfKnow>false</CheckIfKnow>
      <CheckIfSpellUsable>false</CheckIfSpellUsable>
      <CheckSpellDistance>false</CheckSpellDistance>
      <CheckIfView>false</CheckIfView>
      <NotSpellIsLuaScript>true</NotSpellIsLuaScript>
      <Debug>true</Debug>
      <WaitDuringCasting>false</WaitDuringCasting>
    </FightClassSpell>

 

Ive also tried this

      <FightClassConditions>
        <FightClassCondition>
          <ContionType>LuaScript</ContionType>
          <Param xsi:type="FightClassConditionLua">
            <LuaScript>anyCurse = false;
for i=1,40 do
    local name, rank, icon, count, debuffAuraType = UnitAura("player", i);
    if name and debuffAuraType and debuffAuraType == "Magic" then
        anyCurse = true;
        return;
    end
end</LuaScript>
            <VarRet>anyCurse</VarRet>
            <ValueRet>true</ValueRet>
          </Param>
        </FightClassCondition>
      </FightClassConditions>
      <SpellName>CastSpellByID(100503);</SpellName>
      <Priority>13</Priority>
      <CombatOnly>false</CombatOnly>
      <CheckIfKnow>false</CheckIfKnow>
      <CheckIfSpellUsable>false</CheckIfSpellUsable>
      <CheckSpellDistance>false</CheckSpellDistance>
      <CheckIfView>false</CheckIfView>
      <NotSpellIsLuaScript>true</NotSpellIsLuaScript>
      <Debug>true</Debug>
      <WaitDuringCasting>false</WaitDuringCasting>
    </FightClassSpell>

 

 

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.