Jump to content

All Buffs at once (a solution)


Bugreporter

Recommended Posts

The following Code is a LUA-Script without a LUA-Script with a LUA-Condition that never wil be true. And it works fine! :-)

 

1.) Lua Script Spell.

With a Lua Script we can use our own fantasy Spell name, instead of a real script, because Lua Scripts are bad to be supported (insert,delete,insert) and they are very ugly in the settings window. So we use only the Word "--Buffs" as lua script. Because we don't have a real LUA script here, we use the comment signs "--" . (see note below the code)

 

2.) Lua Script Condition.

This do the work. The script do all needed checks for the buffs. It checks, if we are in combat (at least 1 Combo Point at a living and exiting target.) and then it check if the buffs (idBuffs) are known and cast them if they needed. The local variable buffed is only needed for debugging.

    <FightClassSpell>
      <SpellName>--Buffs</SpellName>
      <FightClassConditions>
        <FightClassCondition>
          <ContionType>LuaScript</ContionType>
          <Param xsi:type="FightClassConditionLua">
            <LuaScript>local buffed=0
if UnitExists("target") and not UnitIsFriend("player", "target") and not (UnitIsDead("target")) then
    comboPoints = GetComboPoints("player", "target")
    if (comboPoints &gt; 0) then
--[[                Adrenalin,Combat Readiness,Shadow Blades,Berserking,lifeblood,Blood Flurry ]]
        local idBuffs={13750,74001,121471,26297,121279,20572}
        local idStealth=1784
        local spellname=GetSpellInfo(idStealth)
        local start, duration, enabled = GetSpellCooldown(spellname)
        if (enabled==1) then
            for i=1, 6 do
                if (IsPlayerSpell(idBuffs[i])) then
                    local start, duration, enabled = GetSpellCooldown(idBuffs[i])
                    if (duration==0) then
                        local spellname=GetSpellInfo(idBuffs[i])
                        CastSpellByName(spellname)
                        print("buff: "..spellname)
                        buffed=buffed+1
                    end
                end
            end
            
        end
    end
end
result=(buffed&gt;0)
</LuaScript>
            <VarRet>result</VarRet>
            <ValueRet>true</ValueRet>
          </Param>
        </FightClassCondition>
      </FightClassConditions>
      <Priority>23</Priority>
      <AddToSettings>true</AddToSettings>
      <NotSpellIsLuaScript>true</NotSpellIsLuaScript>
      <DescriptionSpell>Set all known buffs</DescriptionSpell>
    </FightClassSpell>


based on WoW 5.4.2.

 

 

Note:

 

In a previous version I use "Buffs" instead of "--Buffs". I changed this to get an entry in the log-file. If you dont like "--Buffs" in the settings window, you can change it back to "Buffs" (or what ever you want). But then you have also change "<ValueRet>true</ValueRet>" to "<ValueRet>notNeeded</ValueRet>". You don't get any logfile entrys in this case, but the script works fine.

Link to comment
Share on other sites

Hello,
 
You can use spell option "Not a spell, is lua script" and use timer (all 1000 or 2000 ms for avoid spamming) (or others conditions).
 
But good code, and if this works you can keep your code.
Link to comment
Share on other sites

I use the spell option "Not a spell, is lua script" to use a fantasy spell name.

 

A timer wouldn't work because

 

  1. the duration/cd could be changed, because of items (i.e http://ptr.wowhead.com/item=102292) or other buffs
  2. the buffs have CD
  3. the buffs should be available at fight start.

 

And the solution above do a good job

Link to comment
Share on other sites

  • 2 months later...

Ok so I'm wondering what I would have to change to make this work for a Blood DK, Frost DK, or Unholy DK?

Im going to add this to my Fight Class Profiles I have posted and If I can see a full break down of this I can figure out how to add this to all my Fight Classes.

 

Example of what I have come up with:

 

Blood Death Knight:

 

   <FightClassSpell>
      <SpellName>--Buffs</SpellName>
      <FightClassConditions>
        <FightClassCondition>
          <ContionType>LuaScript</ContionType>
          <Param xsi:type="FightClassConditionLua">
            <LuaScript>local buffed=0
if UnitExists("target") and not UnitIsFriend("player", "target") and not (UnitIsDead("target")) then
    Blood Shield = Getbuff("player", "player")
    if (Blood Shield &gt; 0) then
--[[                Empower Rune Weapon,Blood Tap,Dancing Rune Weapon, Anti-Magic Shell, Icebound Fortitude, Remorseless Winter, Raise Dead, Vampiric Blood, Rune Tap, Conversion, Horn of Winter, Lichborne  ]]
        local idBuffs={48707,49222,119975,49028,96268,47568,57330,48792,49039,46584,108200}
        local idBlood Shield=77513
        local spellname=GetSpellInfo(idBlood Shield)
        local start, duration, enabled = GetSpellCooldown(spellname)
        if (enabled==1) then
            for i=1, 6 do
                if (IsPlayerSpell(idBuffs)) then
                    local start, duration, enabled = GetSpellCooldown(idBuffs)
                    if (duration==0) then
                        local spellname=GetSpellInfo(idBuffs)
                        CastSpellByName(spellname)
                        print("buff: "..spellname)
                        buffed=buffed+1
                    end
                end
            end
            
        end
    end
end

 

 

Can there be multiple debug sources like rune power and Runes?

Link to comment
Share on other sites

I'm also having trouble cut and pasting this to my fight profile can you please show me a example of the snippet in the fight profile so I can customize this for each of my profile. Ok I got it to load the profile with out error but when I open up the profile not spell is listed named ==Buffs?????

Link to comment
Share on other sites

Thats right. in the log you only see "--buffs", because in the log you see only the name of the "spell." In this case the lua script ist the "spell" and named "--buffs"

 

You have to change the for-loop variable form 6 to 11 (if I count your buffs right)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...