Sub CheckBuffs
/doevents
/if (!${BuffsOn} || ${IAmDead} || ${Me.Invis}) /return
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs CheckBuffs: Enter
/declare i int local
/declare j int local
/declare k int local
/declare l int local
/declare FullText string local 0
/declare 1stPart string local 0
/declare 2ndPart string local 0
/declare 3rdPart string local 0
/declare 4thPart string local 0
/declare AuraName string local
/declare SummonAttempts int local 0
/declare TempAura string local
/declare SpellRange int local
| Assign var IniIDList all the spawn ids from buff ini file 2345|2195|2391| etc
/declare IniIDList string local ${Ini["KissAssist_Buffs.ini"]}
/declare IniIDCount int local ${Math.Calc[${IniIDList.Count[|]}-1]}
/declare IniBuffCount int local 0
/declare IniBBuffList string local
/declare IniBuffList string local
/declare IniStackCheck[50] string local
/declare PBTimerID int local
/declare IniTempBuff string local
/declare MATargetID int local
/declare BookSpellTT string local 0
/declare ClassCheck string local
| Group Buffs
/for i 1 to ${Buffs.Size}
/doevents
/if (${ChaseAssist} && !${CombatStart}) /call DoWeMove
| If Buffs=NULL skip to next buff
/if (${Buffs[${i}].Equal[null]} || ${Buffs[${i}].Arg[3,|].Equal[0]} || ${Buffs[${i}].Arg[2,|].Equal[0]}) /goto :SkipBuff
| Check for combat and skip redundant subs called in combat routines.
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs Buff${i}: ${Buffs[${i}]}
| Check for spells with 2 parts such as Exigent Focusing Rk. II,Talisman of Soul's Unity Rk. II - Set Buffs to the buff
/if (${Buffs[${i}].Arg[2,|].Length}) {
/varset FullText ${Buffs[${i}]}
/varset 1stPart ${Buffs[${i}].Arg[1,|]}
/varset 2ndPart ${Buffs[${i}].Arg[2,|]}
/varset 3rdPart ${Buffs[${i}].Arg[3,|]}
/varset 4thPart ${Buffs[${i}].Arg[4,|]}
/if (${2ndPart.Find[:]}) {
/varset ClassCheck ${2ndPart.Right[${Math.Calc[${2ndPart.Length}-${2ndPart.Find[:]}]}]}
/varset 2ndPart ${2ndPart.left[${Math.Calc[${2ndPart.Find[:]}-1]}]}
} else {
/varset ClassCheck
}
/if (${FullText.Arg[2,|].Equal[Mana]}) /varset 2ndPart Mana
/if (${FullText.Arg[2,|].Equal[Aura]}) /varset 2ndPart Aura
/if (${FullText.Arg[2,|].Equal[Mount]}) /varset 2ndPart Mount
/if (${FullText.Arg[2,|].Equal[Dual]}) /varset 2ndPart Dual
/if (${FullText.Arg[2,|].Equal[Me]}) /varset 2ndPart Me
/if (${FullText.Arg[2,|].Equal[MA]}) /varset 2ndPart MA
/if (${FullText.Arg[2,|].Equal[!MA]}) /varset 2ndPart !MA
/if (${FullText.Arg[2,|].Equal[Summon]}) /varset 2ndPart Summon
/if (${FullText.Arg[2,|].Equal[End]}) /varset 2ndPart End
/if (${FullText.Arg[2,|].Equal[Melee]}) /varset 2ndPart Melee
/if (${FullText.Arg[2,|].Equal[Caster]}) /varset 2ndPart Caster
/if (${FullText.Arg[2,|].Equal[Remove]}) /varset 2ndPart Remove
/if (${FullText.Arg[2,|].Equal[Dual]} && ${4thPart.Equal[MA]}) /varset 2ndPart DualMA
/varset SpellRange ${Spell[${1stPart}].Range}
} else {
/varset 1stPart ${Buffs[${i}]}
/varset 2ndPart
/varset 3rdPart
/varset 4thPart
/varset SpellRange ${Spell[${Buffs[${i}]}].Range}
}
/if (${DebugBuffs}) /echo DEBUGBUFFS ${1stPart} ${2ndPart} ${3rdPart} ${4thPart}
/if (${Me.Book[${1stPart}]}) /varset BookSpellTT ${Spell[${Me.Book[${Me.Book[${1stPart}]}].ID}].TargetType}
/if (${BookSpellTT.Find[0]} && ${Spell[${Buffs[${i}]}].TargetType.Find[Group]} || ${BookSpellTT.Find[group]}) /varset SpellRange ${Spell[${Buffs[${i}]}].AERange}
/if (${Spell[${Buffs[${i}]}].TargetType.Find[Group]}) /varset SpellRange ${Spell[${Buffs[${i}]}].AERange}
/if (!${SpellRange}) /varset SpellRange 100
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs ${i} 1stPart: ${1stPart} 2ndPart: ${2ndPart} FullText: ${Buffs[${i}]} Type: ${Spell[${1stPart}].TargetType}
/if (${AggroTargetID} || ${CombatStart} || ${IAmDead} || ${ReadBuffsTimer}) /goto :SkipBuff
/if (${2ndPart.Equal[Remove]} && ${Me.Buff[${1stPart}].ID}) {
/removebuff ${1stPart}
/goto :SkipBuff
}
/if (${HealsOn}) /call CheckHealth
| If buff cost more mana than I have skip it
/if ((${Spell[${1stPart}].Mana} || ${Spell[${Buffs[${i}]}].Mana})>${Me.PctMana}) /goto :SkipBuff
| Combat check to skip all buffs but mana regen || ${Me.Buff[Resurrection Sickness].ID} || ${Me.Buff[Revival Sickness].ID}
/if (${CombatStart}) /goto :SkipBuff
| Check if aura is up
/if (${2ndPart.Equal[Aura]}) {
| Strip the Rk II/III out of the spell to check against aura window
/if (${1stPart.Find[ Rk. III]}) {
/varset AuraName ${1stPart.Left[-8]}
} else /if (${1stPart.Find[ Rk. II]}) {
/varset AuraName ${1stPart.Left[-7]}
} else /if (${1stPart.Find[ Rk.II]}) {
/varset AuraName ${1stPart.Left[-6]}
} else {
/varset AuraName ${1stPart}
}
| Correct typo from SOE in monks 55 level aura
/if (${1stPart.Find[Disciple's Aura]}) /varset AuraName Disciples Aura
| Cleric exception for Reverent Aura
/if (${Me.Class.Name.Equal[cleric]} && ${1stPart.Find[Reverent]}) /varset AuraName Reverent Aura
| Enchanter exception for Mana Recursion Auras
/if ( ${1stPart.Find[Mana Reverberation]} || ${1stPart.Find[Mana Repercussion]} || ${1stPart.Find[Mana Reiteration]}) /varset AuraName Mana Recursion Aura
| Enchanter exception for Mana Reverberation Aura lv 100
/if (${1stPart.Find[Mana Reiterate]}) /varset AuraName Mana Reiterate Aura
/if (${1stPart.Find[Mana Reverberation]}) /varset AuraName Mana Rev.
/if (${1stPart.Find[Mana Resurgence]}) /varset AuraName Mana Resurgence Aura
/if (${1stPart.Find[Mana Repercussion Aura]}) /varset AuraName Mana Rep. Aura
/if (${1stPart.Find[Runic Radiance Aura]}) /varset AuraName Runic Rad. Aura
| Mage exceptions because aura is on pet not in aura window and other fucked up shit
/if (${1stPart.Find[Arcane Distillect]}) /varset TempAura Arcane Distillect
/if (${1stPart.Find[Earthen Strength]}) /varset TempAura Earthen Strength Effect
/if (${1stPart.Find[Rathe's Strength]}) /varset TempAura Rathe's Strength Effect
| Check if aura is up 4 parts - Mage | Everyone else | 2 auras cleric | 2 auras enchamter
/if (${Me.Pet.ID} && ${Select[${Me.Class.ShortName},MAG]} && ${Me.Pet.Distance}<175 && (!${TempAura.Find[effect]} && !${Me.Aura[1].Find[${TempAura}]} || ${TempAura.Find[effect]} && !${Me.PetBuff[${TempAura}]}) || ${Select[${Me.Class.ShortName},CLR,ENC,MAG]}==0 && !${Me.Aura[1].Find[${AuraName}]} || ${Select[${Me.Class.ShortName},CLR]} && !${Me.Aura[1].Find[${AuraName}]} && !${Me.AltAbility[Spirit Mastery]} || !${Me.Aura[1].Find[${AuraName}]} && !${Me.Aura[2].Find[${AuraName}]} && ${Me.AltAbility[Spirit Mastery]} || ${Select[${Me.Class.ShortName},ENC]} && !${Me.Aura[1].Find[${AuraName}]} && !${Me.AltAbility[Auroria Mastery]} || !${Me.Aura[1].Find[${AuraName}]} && !${Me.Aura[2].Find[${AuraName}]} && ${Me.AltAbility[Auroria Mastery]}) {
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs Aura
| - Mutant Bards do this
/if (${Me.Class.ShortName.Equal[BRD]}) {
/if (!${Me.Gem[${1stPart}]}) {
/memorize "${1stPart}" gem${MiscGem}
/delay 15s ${Me.Gem[${MiscGem}].Name.Equal[${1stPart}]}
}
/squelch /twist once ${Me.Gem[${1stPart}]}
/delay 50
/goto :SkipBuff
}
| - Normal casting
/if (${Select[${Me.Class.ShortName},BER,MNK,ROG,WAR]} && ${Me.CurrentEndurance}>500) {
/disc ${1stPart}
} else {
/call MQ2Cast "${1stPart}" ${MiscGem}
}
/if (${Macro.Return.Equal[CAST_SUCCESS]}) /echo Casting Aura >> ${1stPart} <<
}
/goto :SkipBuff
}
| Check and Cast endurance discs - 2nd wind, respite, etc
/if (${2ndPart.Equal[End]}) {
/if (${Me.PctEndurance}<=${3rdPart} && ${Me.CombatAbilityReady[${1stPart}]} && !${Melee.DiscID}) {
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs Endurance Regen
/if (${Me.Sitting}) /stand
/delay 5
/docommand /disc ${1stPart}
/delay 10
/echo Casting >> ${1stPart} << for endurance
/goto :SkipBuff
}
}
| Summon items ini example Buffs1=The Guardian's Pouch|Summon|Guardian Blade|200
/if (${2ndPart.Equal[Summon]}) {
/if (${FindItemCount[=${3rdPart}]}<${4thPart}) {
:summonagain
/if (${Twist}) /multiline ; /squelch /twist off ; /varset Twisting 0
/if (${Me.FreeInventory}==0) {
/echo No room in inventory skipping summoning >> ${3rdPart} <<.
/goto :summondone
}
| Summon axes for zerkers had to be hard coded because spell is same name as tm item summoned.
/if (${Select[${Me.Class.ShortName},BER]} && ${1stPart.Find[axe]} && ${Me.CombatAbilityReady[${1stPart}]}) {
/docommand /disc ${1stPart}
/delay 80 ${Cursor.ID}
/varcalc SummonAttempts ${SummonAttempts}+1
/goto :inventory
}
| Summon stuff
/if (!${Select[${Me.Class.ShortName},BER]} && !${1stPart.Find[axe]}) /call CastWhat "${1stPart}" ${Me.ID} Buffs
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs summon item cast result ${Macro.Return}
/if (${Macro.Return.Equal[CAST_SUCCESS]}) {
/delay 15s ${Cursor.ID}
/echo Summoned >> ${3rdPart} <<
/varcalc SummonAttempts ${SummonAttempts}+1
:inventory
/autoinventory
/delay 10
/if (${Cursor.ID}) /goto :inventory
/if (${FindItemCount[=${3rdPart}]}==0 && ${SummonAttempts}>0) {
/echo Summoning >> ${3rdPart} << Failed - Check reagents, timer, etc
/echo -- Turning off ${1stPart} - ${1stPart}|Summon|${3rdPart}|0
/varset FullText ${1stPart}|Summon|${3rdPart}|0
/varset SummonAttempts 0
/goto :summondone
}
}
/if (${Macro.Return.Equal[CAST_COMPONENTS]}) {
/echo You are missing components. Turning Off ${Buffs[${i}]}.
/varset FullText NULL
/goto :SkipBuff
}
/if (${FindItemCount[=${3rdPart}]}<${4thPart}) /goto :summonagain
:summondone
/echo I now have ${4thPart} >> ${3rdPart} <<
/goto :SkipBuff
}
}
| Voice of Thule AA fix. MQ2 confuses aa and spell.
/if (${1stPart.Equal[Voice of Thule]}) {
/if (${Buff${i}GM${j}}>=1 || ${Me.Buff[Voice of Thule].ID} && ${MainAssist.Equal[${Me}]}) /goto :SkipBuff
/if (${Select[${Role},tank]}) {
/call CastWhat "${1stPart}" ${Me.ID} Buffs
} else {
/call CastWhat "${1stPart}" ${Spawn[=${MainAssist}].ID} Buffs
}
/if (${Macro.Return.Equal[CAST_SUCCESS]}) {
/varcalc Buff${i}GM${j} (${Spell[${1stPart}].Duration.TotalSeconds}*${DurationMod})*10
/echo Buffing ${Buffs[${i}]} on ${Spawn[=${MainAssist}].CleanName}
}
/goto :SkipBuff
}
/if (${Select[${2ndPart},Aura,End,Mount,Mana,Summon]}) /goto :SkipBuff
| Check for spells with 2 parts such as Exigent Focusing Rk. II,Talisman of Soul's Unity Rk. II - Set Buffs to buff part of spell
/if (${2ndPart.Equal[Dual]} || ${2ndPart.Find[DualMA]}) /varset Buffs[${i}] ${3rdPart}
/if (${Select[${2ndPart},Me,MA,!MA,Caster,Melee]}) /varset Buffs[${i}] ${1stPart}
| Cast buffs on MA && ${Spell[${Buffs[${i}]}].TargetType.Find[self]}
/if ((${2ndPart.Equal[MA]} || ${2ndPart.Equal[DualMA]}) && ${Spawn[=${MainAssist}].Distance}<=${SpellRange} && !${Spawn[=${MainAssist}].Moving} && ${Spawn[=${MainAssist}].ID} && ${Buff${i}GM7}==0) {
/if (${DebugBuffs}) /echo DEBUGBUFFS Cast buffs with MA tag
| Check buffs in file to see if MA has buff or its blocked
/if (${Ini["KissAssist_Buffs.ini",${Spawn[${MainAssistType} ${MainAssist}].ID},"Buffs"].Find[${Buffs[${i}]}]} || ${Ini["KissAssist_Buffs.ini",${Spawn[${MainAssistType} ${MainAssist}].ID},"Blockedbuffs"].Find[${Buffs[${i}]}]}) /goto :SkipBuff
/if (${2ndPart.Equal[Dual]} || ${2ndPart.Find[DualMA]}) /varset Buffs[${i}] ${1stPart}
| If its a group spell cast on mercs - owner
/if (${Spawn[=${MainAssist}].Type.Equal[mercenary]} && ${Spell[${Buffs[${i}]}].TargetType.Find[group]}) {
/varset MATargetID ${Spawn[=${MainAssist}].Owner.ID}
} else {
/varset MATargetID ${Spawn[=${MainAssist}].ID}
}
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs: MA Buff /call CastWhat "${Buffs[${i}]}" ${MATargetID} Buffs
/call CastWhat "${Buffs[${i}]}" ${MATargetID} Buffs
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs: MA Buff MacroReturn: ${Macro.Return}
/delay 60 !${Me.Casting.ID}
/if (${Macro.Return.Equal[CAST_SUCCESS]} || (!${Spawn[${MainAssistType} ${MainAssist} group].ID} && ${Macro.Return.Equal[CAST_TAKEHOLD]} )) {
/echo Buffing MA >> ${Spawn[=${MainAssist}].CleanName} << with ${Buffs[${i}]}.
| For dual tag need to asssign spell duration of the 3rd part
/if (${2ndPart.Equal[Dual]} || ${2ndPart.Find[DualMA]}) /varset Buffs[${i}] ${3rdPart}
/varcalc Buff${i}GM7 (${Spell[${Buffs[${i}]}].Duration.TotalSeconds}*${DurationMod})*10
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs MA Buff Timer ${Buff${i}GM7}
/varset WriteBuffsTimer 0
/call WriteBuffs
/goto :SkipBuff
}
/if (${Macro.Return.Equal[CAST_COMPONENTS]}) {
/echo You are missing components. Turning off ${Buffs[${i}]}.
/varset Buffs[${i}] NULL
/varset FullText NULL
/goto :SkipBuff
}
}
| Skip to next spell if Tag MA
/if (${2ndPart.Equal[MA]}) /goto :SkipBuff
| Check if buff is up and if it stacks with existing buffs
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs BuffSlot: ${Me.Buff[${Buffs[${i}]}].ID} SongSlot: ${Me.Song[${Buffs[${i}]}].ID} Stacks: ${Spell[${Buffs[${i}]}].Stacks[0]} 2nd Part: ${Select[${2ndPart},Aura,Mount,Mana,End,Summon]}<1 Tar Type: ${Spell[${Buffs[${i}]}].TargetType}
/if (!${Me.Buff[${Buffs[${i}]}].ID} && ${Spell[${Buffs[${i}]}].Stacks[0]}) {
| Check for spells with 2 parts such as Exigent Focusing Rk. II,Talisman of Soul's Unity Rk. II - Set Buffs to actual spell
/if (${2ndPart.Equal[Dual]}) /varset Buffs[${i}] ${1stPart}
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs -- 2nd asssigned: ${Buffs[${i}]}
| If Target.Type=Group then buff self with group buff
/if (${BookSpellTT.Find[0]} && ${Spell[${Buffs[${i}]}].TargetType.Find[group]} || ${BookSpellTT.Find[group]} ) {
/call CastWhat "${Buffs[${i}]}" ${Me.ID} Buffs
/if (${Macro.Return.Equal[CAST_SUCCESS]}) {
/echo Buffing >> ${Buffs[${i}]} <<
/doevents flush Worn_off
/varset WriteBuffsTimer 0
/call WriteBuffs
/varset IniNextTimer 35s
}
}
| If Target.Type=Single then buff each party member with single buff
/if (${BookSpellTT.Find[0]} && ${Spell[${Buffs[${i}]}].TargetType.Find[single]} || ${BookSpellTT.Find[single]}) {
/if (${2ndPart.Equal[Dual]}) /varset Buffs[${i}] ${1stPart}
/if (${Group} && ${Me.CurrentMana}>${Spell[${Buffs[${i}]}].Mana}*(${Group})) {
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs Single Type Group Buff
/for j 0 to ${Group}
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs !${Group.Member[${j}].ID} || ${Spawn[${Group.Member[${j}]}].Distance}>=${SpellRange} || ${2ndPart.Equal[Me]} && ${j}>=1 || ${2ndPart.Equal[MA]} && ${Group.Member[${j}].ID}!=${Spawn[${MainAssistType} ${MainAssist}].ID} || ${Buff${i}GM${j}}
| Check if party member is alive in zone and within spell range and spell timer does not exist
/if (!${Group.Member[${j}].ID} || ${Spawn[${Group.Member[${j}]}].Distance}>=${SpellRange} || ${Buff${i}GM${j}}) /goto :nextmember
/if (${2ndPart.Equal[Me]} && ${j}>=1) /goto :nextmember
/if (${2ndPart.Equal[caster]} && ${Select[${Group.Member[${j}].Class.ShortName},CLR,DRU,SHM,BST,ENC,MAG,NEC,PAL,SHD,RNG,WIZ]}==0 || ${2ndPart.Equal[Melee]} && ${Select[${Group.Member[${j}].Class.ShortName},BRD,BER,BST,MNK,PAL,ROG,RNG,SHD,WAR]}==0) /goto :nextmember
/if (${ClassCheck.Length} && ((!${ClassCheck.Find[!]} && ${Group.Member[${j}].Class.ShortName.NotEqual[${ClassCheck}]}) || (${ClassCheck.Find[!]} && ${Group.Member[${j}].Class.ShortName.Equal[${ClassCheck.Right[-1]}]}))) /goto :nextmember
/if (${Me.CurrentMana}<${Spell[${Buffs[${i}]}].Mana}) /goto :nextmember
/if ( ${2ndPart.Equal[!MA]} && ${Group.Member[${j}].ID}==${Spawn[${MainAssistType} ${MainAssist}].ID}) /goto :nextmember
/delay 7s ${Cast.Ready[${Buffs[${i}]}]}
/call CastWhat "${Buffs[${i}]}" ${Group.Member[${j}].ID} Buffs
/if (${Macro.Return.Equal[CAST_SUCCESS]}) {
/echo Buffing ${Buffs[${i}]} on ${Group.Member[${j}].CleanName}
| assisgn buff 3rd part of dual tag for actual duration
/if (${2ndPart.Equal[Dual]}) /varset Buffs[${i}] ${3rdPart}
/varcalc Buff${i}GM${j} (${Spell[${Buffs[${i}]}].Duration.TotalSeconds}*${DurationMod})*10
/doevents flush Worn_off
/varset WriteBuffsTimer 0
/call WriteBuffs
}
:nextmember
/next j
} else /if (${Select[${2ndPart},MA,Melee,Caster]}==0) {
/call CastWhat "${Buffs[${i}]}" ${Me.ID} Buffs
}
}
| If Target.Type=self then buff self
/if (!${FindItem[=${Buffs[${i}]}].ID} && ${BookSpellTT.Find[0]} && ${Spell[${Buffs[${i}]}].TargetType.Find[self]} || ${BookSpellTT.Find[self]}) {
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs Self Buff
/call CastWhat "${Buffs[${i}]}" ${Me.ID} Buffs
/if (${Macro.Return.Equal[CAST_COMPONENTS]}) {
/echo You are missing components. Turning off ${Buffs[${i}]}.
/varset Buffs[${i}] NULL
/varset FullText NULL
/delay 5
/goto :SkipBuff
}
/if (${Macro.Return.Equal[CAST_SUCCESS]}) {
/echo Casting ${Buffs[${i}]} on me.
/delay 20
}
}
| Check if buff needs pet as target ie Mage's Symbiosis line of mana buffs
/if (${Me.Pet.ID} && (${BookSpellTT.Find[0]} && ${Spell[${Buffs[${i}]}].TargetType.Find[pet]} || ${Select[${Spell[${Spell[${Buffs[${i}]}].ID}].Name.Arg[2,]},Symbiosis,Siphon,Simulacrum]})) {
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs Self Buff that targets pet ie mage mana buff line
/call CastWhat "${Buffs[${i}]}" ${Me.Pet} Buffs
}
}
| If buff is an item click it
/if (${FindItem[${Buffs[${i}]}].Spell.Stacks[0]} && !${Me.Buff[${FindItem["${Buffs[${i}]}"].Spell}].ID} && ${FindItem[${Buffs[${i}]}].Timer}==0 && ${Select[${2ndPart},Aura,Mount,Mana]}<1) {
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs Items
| Call of the wild ear fix
/if (${Buffs[${i}].Equal[Call of the Wild]}) {
/call MQ2Cast 133851 item
/delay 15
} else {
/call CastWhat "${Buffs[${i}]}" ${Me.ID} Buffs
}
/if (${Macro.Return.Equal[CAST_SUCCESS]}) /echo Clicking > ${Buffs[${i}]} <
}
| Check Buffs from ini
/if (${Redguides} && !${IniNextTimer}) {
| IniIDCount = number of Char IDs counted in ini file. If 0 skip || Buff is null the the process.
/if (${IniIDCount}<=0 || ${Buffs[${i}].Equal[null]}) /goto :SkipBuff
| Start scan of buffs listed on toons in ini file
/for k 1 to ${IniIDCount}
| If the Spawn ID is not in the zone and not a PC/merc and not me skip to next ID
/if (!${Spawn[${IniIDList.Arg[${k},|]}].ID} || ${Select[${Spawn[${IniIDList.Arg[${k},|]}].Type},AURA,BANNER,CAMPFIRE,CORPSE,CHEST,ITEM,NPC,TRIGGER,TRAP,TIMER,MOUNT]} || ${IniIDList.Arg[${k},|]}==${Me.ID}) /goto :NextCharCheck
| If Buff is a Mana,Aura,Mount,Me,Summon,End, an item, self buff or Spawn ID is me skip because none of these are cast on others
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs IniBuffCheck 1: Mana,Aura,Mount,Me,Summon,End:${Select[${2ndPart},Mana,Aura,Mount,Me,Summon,End,0]} Item:${FindItemCount[${Buffs[${i}]}]}>=1 Self:${Spell[${Buffs[${i}]}].TargetType.Find[self]}
/if (${Select[${2ndPart},Mana,Aura,Mount,Me,Summon,End,0]} || ${FindItemCount[${Buffs[${i}]}]}>=1 || ${BookSpellTT.Find[0]} && ${Spell[${Buffs[${i}]}].TargetType.Find[self]} || ${BookSpellTT.Find[self]} || ${BookSpellTT.Find[pet]}) /goto :NextCharCheck
| Set buff to correct spell to check for with Dual tag
/if (${2ndPart.Equal[Dual]}) /varset Buffs[${i}] ${3rdPart}
| If buff marked MA skipped if spawn ID isn't MA
/if (${2ndPart.Equal[MA]} && ${Spawn[${IniIDList.Arg[${k},|]}].CleanName.NotEqual[${MainAssist}]} || ${2ndPart.Equal[!MA]} && ${Spawn[${IniIDList.Arg[${k},|]}].CleanName.Equal[${MainAssist}]}) /goto :NextCharCheck
/if ((${2ndPart.Equal[Caster]} && ${Select[${Spawn[${IniIDList.Arg[${k},|]}].Class.ShortName},CLR,DRU,SHM,BST,ENC,MAG,NEC,PAL,SHD,RNG,WIZ]}==0) || (${2ndPart.Equal[Melee]} && ${Select[${Spawn[${IniIDList.Arg[${k},|]}].Class.ShortName},BRD,BER,BST,MNK,PAL,ROG,RNG,SHD,WAR]}==0)) /goto :NextCharCheck
| Temp variable to store buff name after stripping rk stuff makes it easier to compare
/varset IniTempBuff ${Buffs[${i}]}
/if (${Buffs[${i}].Find[ Rk. III]}) /varset IniTempBuff ${Buffs[${i}].Left[-8]}
/if (${Buffs[${i}].Find[ Rk. II]}) /varset IniTempBuff ${Buffs[${i}].Left[-7]}
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs IniBuffCheck 2: ${Spawn[${IniIDList.Arg[${k},|]}].Name} ${IniIDList.Arg[${k},|]} ${IniTempBuff} ${Buffs[${i}]}
| Assign var IniBBuffList blocked buffs list from ini file
/varset IniBBuffList ${Ini["KissAssist_Buffs.ini",${IniIDList.Arg[${k},|]},"Blockedbuffs"]}
| If the current buff is on the blocked buff list skip it.
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs IniBuffCheck 3: ${IniBBuffList.Find[${IniTempBuff}]} Buff blocked?
/if (${IniBBuffList.Find[${IniTempBuff}]}) /goto :NextCharCheck
| Assign var IniBuffList buffs list from ini file
/varset IniBuffList ${Ini["KissAssist_Buffs.ini",${IniIDList.Arg[${k},|]},"Buffs"]}
| If current buff is on the buff list skip it
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs IniBuffCheck 4: ${IniTempBuff} ${IniBuffList.Find[${IniTempBuff}]}
/if (${IniBuffList.Find[${IniTempBuff}]}) /goto :NextCharCheck
| Assign buff count
/varset IniBuffCount ${Math.Calc[${IniBuffList.Count[|]}]}
| Check if current buff stacks will all existing buffs in list
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs IniBuffCheck 5: ${Spawn[${IniIDList.Arg[${k},|]}].Name} ${IniBuffCount} ${i} ${Buffs[${i}]}
/for l 1 to ${IniBuffCount}
| Fix for stacking issues with Perfected Group Levitation there are a lot
/if (${IniBuffList.Arg[${l},|].Find[Group Perfected Levitation]} && !${Buffs[${i}].Find[Group Perfected Levitation]}) /goto :PGLevFix
/if (${Select[${Spell[${IniBuffList.Arg[${l},|]}].WillStack[${Buffs[${i}]}]},TRUE,FALSE,NULL]}>=2) {
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs IniBuffCheck Stack: ${IniBuffList.Arg[${l},|]} !Stack ${Buffs[${i}]}
/goto :NextCharCheck
}
:PGLevFix
/next l
| If buff has dual tag assign current buff to spell that needs to be cast
/if (${2ndPart.Equal[Dual]}) /varset Buffs[${i}] ${1stPart}
| varset ini buff timer toon Id spell Id to shorten var and clarity
/varset PBTimerID ${PIniNum.Arg[${k},|]}${Spell[${Buffs[${i}]}].ID}
| Define timer for spell i am about to cast
/if (!${Defined[IniBuffTimer${PBTimerID}]}) /declare IniBuffTimer${PBTimerID} timer outer
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs IniBuffCheck 6: ${Spawn[${IniIDList.Arg[${k},|]}].Name} ${IniBuffList} Temp:${IniTempBuff} OnList:${IniBuffList.Find[${IniTempBuff}]} Timer:${IniBuffTimer${PBTimerID}}
| Check if toon is within spell range and cast buff
/if (${Spawn[${IniIDList.Arg[${k},|]}].Distance}<=${SpellRange} && !${IniBuffTimer${PBTimerID}}) {
/call CastWhat "${Buffs[${i}]}" ${IniIDList.Arg[${k},|]} Buffs
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs IniBuffCheck 7: /call CastWhat "${Buffs[${i}]}" ${IniIDList.Arg[${k},|]} Buffs
/if (${Macro.Return.Equal[CAST_SUCCESS]}) {
/echo Buffing >> ${Buffs[${i}]} << on ${Spawn[${IniIDList.Arg[${k},|]}].CleanName}
/varset IniBuffTimer${PBTimerID} 60s
/varset IniNextTimer 0
/doevents flush Worn_off
/varset WriteBuffsTimer 0
/call WriteBuffs
}
}
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs IniBuffCheck 8: IniBuffTimer${PBTimerID}:${IniBuffTimer${PBTimerID}} IniNextTimer:${IniNextTimer}
:NextCharCheck
/if (${2ndPart.Equal[Dual]}) /varset Buffs[${i}] ${3rdPart}
/next k
}
:SkipBuff
| Reset spell vars
/if (${FullText.Arg[2,|].Length}) {
/varset Buffs[${i}] ${FullText}
/varset FullText 0
| /varset 1stPart 0
| /varset 2ndPart 0
| /varset 3rdPart 0
| /varset 4thPart 0
}
/varset 1stPart 0
/varset BookSpellTT 0
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs reset var ${i} ${Buffs[${i}]}
/next i
/if (!${ReadBuffsTimer} && !${AggroTargetID}) /varset ReadBuffsTimer ${CheckBuffsTimer}s
/if (${DebugBuffs}) /echo DEBUGBUFFS CheckBuffs Leave
/return