CheckBuffs.INC - Click Off Unwanted Buffs

A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot. MQ2Data format only!

Moderator: MacroQuest Developers

Agripa
a ghoul
a ghoul
Posts: 97
Joined: Tue Nov 23, 2004 10:16 pm

CheckBuffs.INC - Click Off Unwanted Buffs

Post by Agripa » Mon Oct 03, 2005 1:25 pm

I am considering:

1. Code to check for debuffs that need to be cured. This would probably just return a flag for further macro processing. - Done
2. Adding a logical evaluation to each buff. This would allow buffs to be clicked off based on zone or other criteria. - Done

Code: Select all

|* CheckBuffs.INC - http://www.macroquest2.com/phpBB2/viewtopic.php?t=12204
|*
|* 0.30 - 20051021 Agripa
|*      - Added the option <all>.
|* 0.22 - 20051009 Agripa
|*      - Added an optional logical evaluation to each buff for custom click off logic.
|* 0.21 - 20051004 Agripa
|*      - Fixed the Buffs - Expanded code so that the original checkbuffs_class is not lost.
|* 0.20 - 20051004 Agripa
|*      - Added code to handle returning a flag like Poisoned or Cursed for selected buffs.
|* 0.10 - 20051003 Agripa
|*
|* This sub scans a toons current buffs one at a time per invocation and checks them against
|* a list stored in the file CheckBuffs.INI.  If a checked buff meets specific requirements, it
|* is clicked off.
|*
|* Each buff entry in the .INI file has a list of classes that goes through an expansion routine.
|* Examine Sub ExpandClass for details.
|*
|* If the toon's name is in the list in the form "-${Me.Name}-", then the buff is not clicked off.
|*
|* If a buff is marked "-Selective-", then it is only removed if no buff slots are open.
|*
|* If ${Me.Buff[].Name}_Flag exists, then this data is returned and the buff is not clicked off:
|*
|*    Curse of Rhag`Zadune=-All-
|*    Curse of Rhag`Zadune_Flag=Cursed
|*
|* Returns "Cursed" if any class has this buff instead of trying to click it off.
|*
|* If ${Me.Buff[].Name}_Evaluation exists, then it is evaluated before clicking off the buff.
|*
|*    Dead Men Floating=-All-
|*    Dead Men Floating_Evaluation=( !${Spawn[MyMain PC].ID} || !${Spawn[MyMain PC].Levitating} )
|*
|* Clicks off Dead Men Floating for any class but only if MyMain is not in zone or is not levitating.
|*
|* Options:
|*
|*    <all> - Checks all buffs instead of just one.  Handy for clicking off buffs before using
|*          - clickies so they will stick.  May or may not return a flag.
|*
|* Installation:
|*
|*    Save as CheckBuffs.INC and use #include CheckBuffs.INC in your macro.
|*    Create the file CheckBuffs.INI.
|*
|* Example:
|* 
|* #include CheckBuffs.INC
|* 
|* Sub Main
|* 
|*    :restart
|* 
|*    /call CheckBuffs
|*    /if ( ${Macro.Return.NotEqual[Empty]} ) {
|*       /echo Help!  Help!  I'm ${Macro.Return}!
|*    }
|* 
|*    /goto :restart
|* 
|* /return

Sub CheckBuffs(string options)
   /declare L1 bool local
   /declare L2 bool local
   /declare L3 bool local

   /declare checkbuffs_buffname string local ${Me.Buff[${checkbuffs_index}].Name}
   /declare checkbuffs_class    string local ${Ini[CheckBuffs.INI,Buffs - Expanded,${checkbuffs_buffname},Empty]}
   /declare checkbuffs_flag     string local ${Ini[CheckBuffs.INI,Buffs,${checkbuffs_buffname}_Flag,Empty]}

   /if ( !${Defined[checkbuffs_index]} ) {
      /declare checkbuffs_index   int    outer   0
      /declare checkbuffs_max     int    outer   ${Math.Calc[${Me.FreeBuffSlots}+${Me.CountBuffs}]}
   }

   /if ( !${Defined[options]} ) /declare options string

   /if ( ${options.Find[<all>]} ) /varset checkbuffs_index 0

   :CheckBuffs_all

   /if ( ${checkbuffs_index}<${checkbuffs_max} ) {
      /varcalc checkbuffs_index ${checkbuffs_index}+1
   } else {
      /varcalc checkbuffs_index 1
   }

   /if ( ${Me.Buff[${checkbuffs_index}].ID} ) {

      /varset checkbuffs_buffname ${Me.Buff[${checkbuffs_index}].Name}
      /varset checkbuffs_class    ${Ini[CheckBuffs.INI,Buffs - Expanded,${checkbuffs_buffname},Empty]}
      /varset checkbuffs_flag     ${Ini[CheckBuffs.INI,Buffs,${checkbuffs_buffname}_Flag,Empty]}

      /if ( ${checkbuffs_class.Equal[Empty]} ) {
         /varset checkbuffs_class ${Ini[CheckBuffs.INI,Buffs,${checkbuffs_buffname},Empty]}
         /if ( !${checkbuffs_class.Equal[Empty]} ) {
            /call ExpandClass ${checkbuffs_class}
            /varset checkbuffs_class ${checkbuffs_class} ${Macro.Return}
            /ini "CheckBuffs.INI" "Buffs - Expanded" "${checkbuffs_buffname}" "${checkbuffs_class}"
         }
      }

      /varcalc L1 (  ${checkbuffs_class.Find[-${Me.Class}-]}     )
      /varcalc L2 ( !${checkbuffs_class.Find[-${Me.CleanName}-]} )
      /varcalc L3 ( !${checkbuffs_class.Find[-Selective-]}       || ${Me.FreeBuffSlots}<1 )

      /if ( ${L1} && ${L2} && ${L3} ) {
         /if ( ${checkbuffs_flag.Equal[Empty]} && ${Ini[CheckBuffs.INI,Buffs,${checkbuffs_buffname}_Evaluation,TRUE]} ) {
            /notify BuffWindow Buff${Int[${Math.Calc[${checkbuffs_index}-1]}]} leftmouseup
         }
      }

   }

   /if ( ${options.Find[<all>]} && ${checkbuffs_index}<${checkbuffs_max} ) /goto :CheckBuffs_all

/return ${checkbuffs_flag}

Sub ExpandClass(string foo)
   /declare S string local ${foo}

   |* -All-          Bard Beastlord Berserker Cleric Druid Enchanter Magician Monk Necromancer Paladin Ranger Rogue Shadow Knight Shaman Warrior Wizard
   |* -Self-         ${Me.CleanName}
   |*
   |* -Caster-       Beastlord Cleric Druid Enchanter Magician Necromancer Paladin Ranger Shadow Knight Shaman Wizard
   |* -NonCaster-    Bard Berserker Monk Rogue Warrior
   |* -PureCaster-   Enchanter Magician Necromancer Wizard
   |*
   |* -Priest-       Cleric Druid Shaman
   |*
   |* -Melee-        Bard Beastlord Berserker Monk Paladin Ranger Rogue Shadow Knight Warrior
   |* -NonMelee-     Cleric Druid Enchanter Magician Necromancer Shaman Wizard
   |* -Tank-         Paladin Shadow Knight Warrior
   |* -NonTank-      Bard Beastlord Berserker Cleric Druid Enchanter Magician Monk Necromancer Rogue Shaman Wizard

   /if ( ${foo.Find[-Self-]} ) {
      /varset S ${S} -${Me.CleanName}-
   }

   /if ( ${foo.Find[-All-]} ) {
      /varset S ${S} -Bard- -Beastlord- -Berserker- -Cleric- -Druid- -Enchanter- -Magician- -Monk- -Necromancer- -Paladin- -Ranger- -Rogue- -Shadow- -Knight- -Shaman- -Warrior- -Wizard-
   }

   /if ( ${foo.Find[-Caster-]} ) {
      /varset S ${S} -Beastlord- -Cleric- -Druid- -Enchanter- -Magician- -Necromancer- -Paladin- -Ranger- -Shaman- -Shadow Knight- -Wizard-
   }
   /if ( ${foo.Find[-NonCaster-]} ) {
      /varset S ${S} -Bard- -Berserker- -Monk- -Rogue- -Warrior-
   }
   /if ( ${foo.Find[-PureCaster-]} ) {
      /varset S ${S} -Enchanter- -Magician- -Necromancer- -Wizard-
   }

   /if ( ${foo.Find[-Priest-]} ) {
      /varset S ${S} -Cleric- -Druid- -Shaman-
   }

   /if ( ${foo.Find[-Melee-]} ) {
      /varset S ${S} -Bard- -Beastlord- -Berserker- -Monk- -Paladin- -Ranger- -Rogue- -Shadow Knight- -Warrior-
   }
   /if ( ${foo.Find[-NonMelee-]} ) {
      /varset S ${S} -Cleric- -Druid- -Enchanter- -Magician- -Necromancer- -Shaman- -Wizard-
   }
   /if ( ${foo.Find[-Tank-]} ) {
      /varset S ${S} -Paladin- -Shadow Knight- -Warrior-
   }
   /if ( ${foo.Find[-NonTank-]} ) {
      /varset S ${S} -Bard- -Beastlord- -Berserker- -Cleric- -Druid- -Enchanter- -Magician- -Monk- -Necromancer- -Ranger- -Rogue- -Shaman- -Wizard-
   }

/return ${S}
Example CheckBuffs.INI:

Code: Select all

[Buffs]

; Blind

Lightcrawler Flash=-All-
Lightcrawler Flash_Flag=Blind

; Curse

; Note that "Sun Revenant's Curse" dispite the name is not a curse.  Thanks SOE.

Chaotica=-All-
Chaotic_Flag=Cursed
Curse of Rhag`Zadune=-All-
Curse of Rhag`Zadune_Flag=Cursed
Torturing Winds=-All-
Torturing Winds_Flag=Cursed

; Disease

Forlorn Deeds=-All-
Forlorn Deeds_Flag=Diseased
Tagar's Insects=-All-
Tagar's Insects_Flag=Diseased
Tepid Deeds=-All-
Tepid Deeds_Flag=Diseased

; Poison

Howl of Tashan=-Melee-
Howl of Tashan_Flag=Poisoned
Tashania=-Melee-
Tashania_Flag=Poisoned
Wind of Tashani=-Melee-
Wind of Tashani_Flag=Poisoned

; Useless

;                            Necromancer   Levitation
Dead Men Floating=-All-
;                            Shaman        See Invisible   Ultravision
Acumen of Dar Khura=-All-
;                            Shaman        50 Haste
Talisman of Alacrity=-All-

; Interferes with Attack Clicky

;                              Beastlord    75 Hit Points   10 Attack
Spiritual Brawn=-All-
;                              Beastlord   150 Hit Points   25 Attack
Spiritual Strength=-All-
;                              Beastlord   225 Hit Points   40 Attack
Spiritual Vigor=-All-
;                              Beastlord   290 Hit Points   52 Attack
Spiritual Vitality=-All-
;                              Ranger       75 Hit Points   25 Attack
Strength of Nature=-All-
;                              Ranger      125 Hit Points   60 Attack
Strength of Tunare=-All-
;                              Ranger      155 Hit Points   75 Attack
Strength of the Hunter=-All-

; NonCaster Click Off Buffs

;                                   Cleric      10% Spell Haste
Aura of Reverence=-NonCaster-
;                                   Cleric      10% Spell Haste
Blessing of Reverence=-NonCaster-
;                                   Cleric      10% Spell Haste up to Level 70
Blessing of Devotion=-NonCaster-
;                                   Enchanter
Voice of Quellious=-NonCaster-

; NonTank Click Off Buffs

;                              Cleric   37 Armor Class
Bulwark of Faith=-NonTank-
;                              Cleric   72 Armor Class
Ward of Valiance=-NonTank-
;                              Ranger   10 Damage Shield   34 Armor Class
Call of the Rathe=-NonTank-
;                              Ranger   ?? Damage Shield   ?? Armor Class
Guard of the Earth=-NonTank-
;                              Druid    40 Damage Shield
Circle of Nettles=-NonTank-
;                              Druid    ?? Damage Shield
Legacy of Bracken=-NonTank-
;                              Druid    24 Damage Shield
Legacy of Spike=-NonTank-

; NonMelee Click Off Buffs

;                                 Enchanter   Haste
Speed of the Shissar=-NonMelee-   
;                                 Enchanter   Haste
Speed of Vallon=-NonMelee-
;                                 Enchanter   Haste
Vallon's Quickening=-NonMelee-
;                                 Enchanter   Haste
Speed of Salik=-NonMelee-
;                                 Shaman    15 Attack   55 Speed
Spirit of Bih`Li=-NonMelee-
;                                 Bard      30 Attack   55 Haste   30 Strength
Dance of the Blade=-NonMelee-
;                                   Ranger    40 Attack
Call of the Predator=-NonMelee-
;                                   Ranger    70 Attack
Spirit of the Predator=-NonMelee-
;                                   Ranger    90 Attack
Howl of the Predator=-NonMelee-
;                                   Shaman   140 Attack   140 Agility   140 Strength   140 Dexterity
Ferine Avatar=-NonMelee-

; Selective Click Offs

;                                             Shaman   50 Dexterity
Dexterity=-All- -Selective-
;                                          58 Shaman   60 Dexterity
Mortal Deftness=-All- -Selective-
;                                             Shaman   52 Agility
Deliriously Nimble=-All- -Selective-
;                                             Shaman   60 Agility
Talisman of the Wrulan=-All- -Selective-

;                                          Mage     48 Damage Shield   45 Fire Resist
Maelstrom of Ro=-NonTank- -Selective-
;                                          Mage     62 Damage Shield   45 Fire Resist
Circle of Fireskin=-NonTank- -Selective-

;                                           Shaman   40 Stamina
Stamina=-All- -Selective-
;                                           Shaman   50 Stamina
Riotous Health=-All- -Selective-
;                                           Shaman   60 Stamina
Talisman of the Boar=-All- -Selective-
;                                           Shaman   75 Stamina   40 Stamina Cap
Spirit of Fortitude=-All- -Selective-
;                                           Shaman   75 Stamina   40 Stamina Cap
Talisman of Fortitude=-All- -Selective-

;                                           Shaman                45 Strength   35 Dexterity
Talisman of the Diaku=-All- -Selective-
;                                           Shaman   45 Stamina   50 Strength   55 Dexterity
Infusion of Spirit=-All- -Selective-

;                                           Ranger    125 Hit Points   60 Attack
Strength of Tunare=-All- -Selective-
;                                           Ranger    155 Hit Points   75 Attack
Strength of the Hunter=-All- -Selective-
;                                           Paladin   330 Hit Points
Brell's Stalwart Shield=-All- -Selective-
;                                           Shaman    365 Hit Points
Talisman of Kragg=-All- -Selective-
;                                           Paladin   412 Hit Points
Brell's Brawny Bulwark=-All- -Selective-
Last edited by Agripa on Fri Oct 21, 2005 2:35 pm, edited 2 times in total.

nightgod
a ghoul
a ghoul
Posts: 122
Joined: Sun Nov 02, 2003 4:39 am

Post by nightgod » Tue Oct 04, 2005 7:34 pm

Why not just use the BuffBlock plugin?

Teh_Hidden
a lesser mummy
a lesser mummy
Posts: 43
Joined: Wed Mar 16, 2005 12:42 am

Post by Teh_Hidden » Tue Oct 04, 2005 9:07 pm

Not everyone has VIP.

Agripa
a ghoul
a ghoul
Posts: 97
Joined: Tue Nov 23, 2004 10:16 pm

Post by Agripa » Mon Oct 10, 2005 10:39 am

I agree that for most players, the buffblock plugin is a better choice. It is easier to use and has higher performance.

With the addition of the evaluation and checking for debuffs, this code now replaces several sections of inline macro code that was hard to maintain. I also did not want buffs to be clicked off so quickly that it would attract attention.

larry1024
a ghoul
a ghoul
Posts: 131
Joined: Tue Apr 19, 2005 11:28 pm

Post by larry1024 » Tue Nov 29, 2005 2:04 am

Ok I feel like I'm an idot here but what entry to i put in to just have it remove certain buffs; don't care about it checking for any others; just intrested in having it drop specified buffs automaticly ; like ALL RANGER buffs :)

Agripa
a ghoul
a ghoul
Posts: 97
Joined: Tue Nov 23, 2004 10:16 pm

Post by Agripa » Tue Dec 06, 2005 1:18 am

That would be neet but unfortunately, it does not work that way. It clicks off buffs based on ${Me.Class} and the name of the buff. So you can set all of your toons to click off ranger buffs listed by individual spell or you could just have your non melee toons click them off which is what I do.

It sounds like you want something like:

Code: Select all

Call of the Predator=-All- 
Spirit of the Predator=-All- 
Howl of the Predator=-All-
That will click off those buffs, which happen to be ranger buffs, for all classes of your toons.

xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: CheckBuffs.INC - Click Off Unwanted Buffs

Post by xyilla » Tue Jun 17, 2025 4:05 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: CheckBuffs.INC - Click Off Unwanted Buffs

Post by xyilla » Tue Jun 17, 2025 4:42 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: CheckBuffs.INC - Click Off Unwanted Buffs

Post by xyilla » Tue Jun 17, 2025 4:43 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: CheckBuffs.INC - Click Off Unwanted Buffs

Post by xyilla » Tue Jun 17, 2025 4:44 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: CheckBuffs.INC - Click Off Unwanted Buffs

Post by xyilla » Tue Jun 17, 2025 4:45 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: CheckBuffs.INC - Click Off Unwanted Buffs

Post by xyilla » Tue Jun 17, 2025 4:46 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: CheckBuffs.INC - Click Off Unwanted Buffs

Post by xyilla » Tue Jun 17, 2025 4:47 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: CheckBuffs.INC - Click Off Unwanted Buffs

Post by xyilla » Tue Jun 17, 2025 4:49 pm


xyilla
naggy
naggy
Posts: 33673
Joined: Sun Feb 23, 2025 5:36 am

Re: CheckBuffs.INC - Click Off Unwanted Buffs

Post by xyilla » Tue Jun 17, 2025 4:50 pm