Discussion in 'EQ2Bot (Freeware)' started by b0ylard, May 23, 2012.

  1. b0ylard

    b0ylard Member

    Messages:
    20
    [ Edit: Sorry, I didn't realise this was the wrong forum for questions. Please feel free to move or delete. ]



    Hi there. I was testing out the Warden and it doesn't seem to use Thunderspike at all. It's not a huge problem but I thought I'd have a look and see if I could understand it.

    I had a quick look in the script and the two relevant sections seem to be

    ; Thunderspike
    Action[10]:Set[ThunderSpike]
    SpellRange[10,1]:Set[383]

    and

    case ThunderSpike
    case NatureBlade
    case PrimordialStrike
    {
    if ${MeleeMode} && ${Me.Ability[${SpellType[${SpellRange[${xAction},1]}]}].IsReady}
    call CastSpellRange ${SpellRange[${xAction},1]} 0 1 0 ${KillTarget}
    }

    I'm guessing that's acting like a normal switch, so ThunderSpike falls through to the code below. However it seems to use Natureblade and PrimordialStrike without a problem.

    Would that suggest that 'Set[383]' is incorrect? I'm not sure how to check on what the 383 is referencing so I'm having trouble figuring it out.
    Last edited: May 23, 2012
  2. pr517

    pr517 Active Member

    Messages:
    118
    I don't see any issues with the code. The only things I can think of are either you don't actually have the AA spent in the Druid tree for that ability or it is performing other duties and never makes it down to action 10 before the mob is dead. Both 'NatureBlade' and 'PrimordialStrike' have higher (numerically lower) action priorities so the likelihood of those being used is higher.

    Check your "EQ2Bot/Spell List/Warden.xml" file and make sure this is in there:
    Code (Text):
    <Setting name="10,383">Thunderspike</Setting>
  3. b0ylard

    b0ylard Member

    Messages:
    20
    Thanks for the response, I'll have a look again. It could have just been that I was expecting it to fire more often (or earlier) than it does.
  4. TheHaydens

    TheHaydens Member

    Messages:
    66
    I find it best to scratch the "Combat_Init()" and set it to ";priority casting". It makes modifying the casting order in the "function Combat_Routine(int xAction)" later much more easier (When they nerf spells or make some better) Like when they prestige came out, it was so much easier to just copy/paste and move it where it fits better in the rotation... Your way you would have to rechange the "order count" and "set counts", plus kind of hard to keep track of 100 different cases.. Just a suggestions, example in my custom built Warden script

    PHP:
    ;*************************************************************
    ;Warden.iss
    ;Improved by TheHaydens on 6/01/2012
    ; Tinkerer abilities + Prestige + More dps
    ;*************************************************************

    #ifndef _Eq2Botlib_
        #include "${LavishScript.HomeDirectory}/Scripts/${Script.Filename}/Class Routines/EQ2BotLib.iss"
    #endif

    function Class_Declaration()
    {
      ;;;; When Updating Version, be sure to also set the corresponding version variable at the top of EQ2Bot.iss ;;;;
      declare ClassFileVersion int script 20090617
      ;;;;

        declare SpellMode bool script
        declare AoEMode bool script
        declare CureMode bool script
        declare CureCurseSelfMode bool script 1
        declare CureCurseOthersMode bool script 1
        declare GenesisMode bool script
        declare InfusionMode bool script
        declare KeepReactiveUp bool script
        declare MeleeMode bool script 1
        declare BuffThorns bool script 1
        declare CombatRez bool script 1
        declare StartHO bool script 1
        declare PetMode bool script 1
        declare KeepMTHOTUp bool script 0
        declare KeepGroupHOTUp bool script 0
        declare RaidHealMode bool script 1
        declare ShiftForm int script
        declare PreviousShiftForm int script -1
        declare LitanyStance int script
        declare PreviousLitanyStance int script -1
        declare WardenStance int script
        declare PreviousWardenStance int script -1
        declare UseRoot bool script
        declare UseSOW bool script
        declare SOWStartTime time script
        declare BuffBatGroupMember string script
        declare BuffInstinctGroupMember string script
        declare BuffCritMitGroupMember string script
        declare BuffSporesGroupMember string script
        declare BuffVigorGroupMember string script
        declare CureCurseGroupMember string script
        declare TortShellAnnounceText string script
        declare SpeedCures bool script 1
       
        call EQ2BotLib_Init

        SpellMode:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[Cast Offensive Spells,FALSE]}]
        AoEMode:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[Cast AoE Spells,FALSE]}]
        CureMode:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[Cast Cure Spells,FALSE]}]
        GenesisMode:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[Cast Genesis,FALSE]}]
        InfusionMode:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[InfusionMode,FALSE]}]
        KeepReactiveUp:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[KeepReactiveUp,FALSE]}]
        MeleeMode:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[Use Melee,TRUE]}]
        CombatRez:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[Combat Rez,FALSE]}]
        StartHO:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[Start HOs,FALSE]}]
        BuffThorns:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[Buff Thorns,FALSE]}]
        PetMode:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[Use Pets,TRUE]}]
        KeepMTHOTUp:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[KeepMTHOTUp,FALSE]}]
        KeepGroupHOTUp:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[KeepGroupHOTUp,FALSE]}]
        RaidHealMode:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[Use Raid Heals,TRUE]}]
        ShiftForm:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[ShiftForm,1]}]
        LitanyStance:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[LitanyStance,1]}]
        WardenStance:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[WardenStance,1]}]
        UseRoot:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[UseRoot,FALSE]}]
        UseSOW:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[UseSOW,FALSE]}]
        BuffBatGroupMember:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[BuffBatGroupMember,]}]
        BuffCritMitGroupMember:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[BuffCritGroupMember,]}]
        BuffInstinctGroupMember:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[BuffInstinctGroupMember,]}]
        BuffSporesGroupMember:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[BuffSporesGroupMember,]}]
        BuffVigorGroupMember:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[BuffVigorGroupMember,]}]
        CureCurseGroupMember:Set[${CharacterSet.FindSet[${Me.SubClass}].FindSetting[CureCurseGroupMember,]}]

    }

    function Pulse()
    {
        ;;;;;;;;;;;;
        ;; Note:  This function will be called every pulse, so intensive routines may cause lag.  Therefore, the variable 'ClassPulseTimer' is
        ;;        provided to assist with this.  An example is provided.
        ;
        ;           if (${Script.RunningTime} >= ${Math.Calc64[${ClassPulseTimer}+2000]})
        ;           {
        ;               Debug:Echo["Anything within this bracket will be called every two seconds.
        ;           }
        ;
        ;         Also, do not forget that a 'pulse' of EQ2Bot may take as long as 2000 ms.  So, even if you use a lower value, it may not be called
        ;         that often (though, if the number is lower than a typical pulse duration, then it would automatically be called on the next pulse.)
        ;;;;;;;;;;;;

        ;; check this at least every 0.5 seconds
        if (${Script.RunningTime} >= ${Math.Calc64[${ClassPulseTimer}+500]})
        {
            if ${Actor[${MainTankID}].InCombatMode}
            {
                if (!${RetainAutoFollowInCombat} && ${Me.ToActor.WhoFollowing(exists)})
                {
                    EQ2Execute /stopfollow
                    AutoFollowingMA:Set[FALSE]
                    waitframe
                }
            }
           
            if ${CureMode}
                call CheckCures
            call CombatRez
       
            call DoTortShell
           
            if ${KeepReactiveUp}
                call CheckHOTs 
        }      
       
        if (${Script.RunningTime} >= ${Math.Calc64[${ClassPulseTimer}+1500]})
        {
            ;; This has to be set WITHIN any 'if' block that uses the timer.
            ClassPulseTimer:Set[${Script.RunningTime}]
        }  
       
    }

    function Class_Shutdown()
    {
    }

    function Buff_Init()
    {
        ; Thorncoat
        PreAction[1]:Set[BuffThorns]
        PreSpellRange[1,1]:Set[40]

        ; Warden of the Forest
        PreAction[2]:Set[Self_Buff]
        PreSpellRange[2,1]:Set[25]

        ; Aspect of the Forest
        PreAction[3]:Set[BuffAspect]
        PreSpellRange[3,1]:Set[36]

        ; Armor of Seasons
        ; Favor of the Wild
        ; Essence of the Great Bear
        ; Nereid's Boon
        PreAction[4]:Set[Group_Buff]
        PreSpellRange[4,1]:Set[20]
        PreSpellRange[4,2]:Set[21]
        PreSpellRange[4,3]:Set[23]
        PreSpellRange[4,4]:Set[280]

        ; Spirit of the Wolf
        PreAction[5]:Set[SOW]
        PreSpellRange[5,1]:Set[31]

        ; Spirit of the Bat
        PreAction[6]:Set[BuffBat]
        PreSpellRange[6,1]:Set[35]

        ; Instinct
        PreAction[7]:Set[BuffInstinct]
        PreSpellRange[7,1]:Set[38]

        ; Regenerating Spores
        PreAction[8]:Set[BuffSpores]
        PreSpellRange[8,1]:Set[37]

        ; Rebirth
        PreAction[9]:Set[AA_Rebirth]
        PreSpellRange[9,1]:Set[380]

        ; Infusion
        PreAction[10]:Set[AA_Infusion]
        PreSpellRange[10,1]:Set[391]

        ; Nature Walk
        PreAction[11]:Set[AA_Nature_Walk]
        PreSpellRange[11,1]:Set[392]

        ; Shapeshift: Winter Wolf
        ; Shapeshift: Tiger
        ; Shapeshift: Treant
        PreAction[12]:Set[AA_Shapeshift]
        PreSpellRange[12,1]:Set[396]
        PreSpellRange[12,2]:Set[397]
        PreSpellRange[12,3]:Set[398]

        ; Casting Expertise
        ; Battle Prowess
        ; Sacred Follower
        PreAction[13]:Set[AA_Litany]
        PreSpellRange[13,1]:Set[507]
        PreSpellRange[13,2]:Set[508]
        PreSpellRange[13,3]:Set[509]

        ; Glacial Assault
        ; Nature's Aura
        PreAction[14]:Set[AA_WardenStance]
        PreSpellRange[14,1]:Set[505]
        PreSpellRange[14,2]:Set[506]
       
        ; Critical Debilitation
        PreAction[15]:Set[AA_BuffCritMit]
        PreSpellRange[15,1]:Set[510]
    }

    function Combat_Init()
    {
        ;Priority Casting
    }

    function PostCombat_Init()
    {
        PostAction[1]:Set[Resurrection]
    }

    function Buff_Routine(int xAction)
    {
        declare tempvar int local
        declare Counter int local
        declare BuffMember string local
        declare BuffTarget string local
        variable int temp

        if ${Groupwiped}
        {
            Call HandleGroupWiped
            Groupwiped:Set[False]
        }

        ; Pass out feathers on initial script startup
    if !${InitialBuffsDone}
    {
        if (${Me.GroupCount} > 1)
        {
            call _CastSpellRange 313 0 0 0 ${ActorID} 0 0 1 0 2 0
        }
           
        ; NEEDED CODE FOR SOW TIMER TO WORK
            ; NEEDS TO BE HERE BECAUSE WE ONLY WANT
            ; IT EXECUTING ONCE ON SCRIPT STARTUP
            SOWStartTime:Set[${Time.Timestamp}]
            SOWStartTime.Day:Dec[1]
            SOWStartTime:Update
           
            InitialBuffsDone:Set[TRUE]
    }

        if ${ShardMode}
            call Shard

        call CheckHeals
        call TinkerOutCombat

        switch ${PreAction[${xAction}]}
        {
            case BuffThorns
                if ${MainTank} || (${BuffThorns} && ${Actor[exactname,${MainTankPC}](exists)})
                    call CastSpellRange ${PreSpellRange[${xAction},1]} 0 0 0 ${Actor[${MainTankPC}].ID} 0 0 1 0 2 0
                else
                    Me.Maintained[${SpellType[${PreSpellRange[${xAction},1]}]}]:Cancel
                break

            case Self_Buff
                if !${Me.Maintained[${SpellType[${PreSpellRange[${xAction},1]}]}](exists)}
                    call CastSpellRange ${PreSpellRange[${xAction},1]} 0 0 0 ${Me.ID} 0 0 1 0 2 0
                break          

            case BuffAspect
            Counter:Set[1]
                tempvar:Set[1]

                ;loop through all our maintained buffs to first cancel any buffs that shouldnt be buffed
                do
                {
                    BuffMember:Set[]
                    ;check if the maintained buff is of the spell type we are buffing
                    if ${Me.Maintained[${Counter}].Name.Equal[${SpellType[${PreSpellRange[${xAction},1]}]}]}
                    {
                        ;iterate through the members to buff
                        if ${UIElement[lbBuffVigor@Class@EQ2Bot Tabs@EQ2 Bot].SelectedItems}>0
                        {
                            tempvar:Set[1]
                            do
                            {

                                BuffTarget:Set[${UIElement[lbBuffVigor@Class@EQ2Bot Tabs@EQ2 Bot].SelectedItem[${tempvar}].Text}]

                                if ${Me.Maintained[${Counter}].Target.ID}==${Actor[${BuffTarget.Token[2,:]},${BuffTarget.Token[1,:]}].ID}
                                {
                                    BuffMember:Set[OK]
                                    break
                                }
                            }
                            while ${tempvar:Inc}<=${UIElement[lbBuffVigor@Class@EQ2Bot Tabs@EQ2 Bot].SelectedItems}
                            ;we went through the buff collection and had no match for this maintaned target so cancel it
                            if !${BuffMember.Equal[OK]}
                            {
                                ;we went through the buff collection and had no match for this maintaned target so cancel it
                                Me.Maintained[${Counter}]:Cancel
                            }
                        }
                        else
                        {
                            ;our buff member collection is empty so this maintained target isnt in it
                            Me.Maintained[${Counter}]:Cancel
                        }
                    }
                }
                while ${Counter:Inc}<=${Me.CountMaintained}

                Counter:Set[1]
                ;iterate through the to be buffed Selected Items and buff them
                if ${UIElement[lbBuffVigor@Class@EQ2Bot Tabs@EQ2 Bot].SelectedItems}>0
                {
                    do
                    {
                        BuffTarget:Set[${UIElement[lbBuffVigor@Class@EQ2Bot Tabs@EQ2 Bot].SelectedItem[${Counter}].Text}]
                        call CastSpellRange ${PreSpellRange[${xAction},1]} 0 0 0 ${Actor[${BuffTarget.Token[2,:]},${BuffTarget.Token[1,:]}].ID} 0 0 1 0 2 0
                    }
                    while ${Counter:Inc}<=${UIElement[lbBuffVigor@Class@EQ2Bot Tabs@EQ2 Bot].SelectedItems}
                }
                break

            case Group_Buff
                if !${Me.Maintained[${SpellType[${PreSpellRange[${xAction},1]}]}](exists)}
                {
                    call CastSpellRange ${PreSpellRange[${xAction},1]} 0 0 0 ${Me.ID} 0 0 1 0 2 0
                }
                if !${Me.Maintained[${SpellType[${PreSpellRange[${xAction},2]}]}](exists)}
                {
                    call CastSpellRange ${PreSpellRange[${xAction},2]} 0 0 0 ${Me.ID} 0 0 1 0 2 0
                }
                if !${Me.Maintained[${SpellType[${PreSpellRange[${xAction},3]}]}](exists)}
                {
                    call CastSpellRange ${PreSpellRange[${xAction},3]} 0 0 0 ${Me.ID} 0 0 1 0 2 0
                }
                if !${Me.Maintained[${SpellType[${PreSpellRange[${xAction},4]}]}](exists)}
                {
                    call CastSpellRange ${PreSpellRange[${xAction},4]} 0 0 0 ${Me.ID} 0 0 1 0 2 0
                }
                break
               
            case SOW
               
                if ${UseSOW}
                {
                    ; Only executes if the result of the current_time - SOWStartTime is < 0 (which only happens on Script Start)
                    ; or current_time - SOWStartTime > 2700 (2700 seconds = 45 mins.)
                    if ${Math.Calc[${Time.Timestamp}-${SOWStartTime.Timestamp}]} < 0 || ${Math.Calc[${Time.Timestamp}-${SOWStartTime.Timestamp}]} > 2700
                    {
                        SOWStartTime:Set[${Time.Timestamp}]
                        call CastSpellRange ${PreSpellRange[${xAction},1]} 0 0 0 ${Me.ID} 0 0 1 0 2 0
                    }
                }
                break
               
            case BuffBat
                BuffTarget:Set[${UIElement[cbBuffBatGroupMember@Class@EQ2Bot Tabs@EQ2 Bot].SelectedItem.Text}]
                if ${Me.Maintained[${SpellType[${PreSpellRange[${xAction},1]}]}].Target.ID}!=${Actor[${BuffTarget.Token[2,:]},${BuffTarget.Token[1,:]}].ID}
                    Me.Maintained[${SpellType[${PreSpellRange[${xAction},1]}]}]:Cancel
                if ${Actor[${BuffTarget.Token[2,:]},${BuffTarget.Token[1,:]}](exists)}
                    call CastSpellRange ${PreSpellRange[${xAction},1]} 0 0 0 ${Actor[${BuffTarget.Token[2,:]},${BuffTarget.Token[1,:]}].ID} 0 0 1 0 2 0
                break

            case BuffInstinct
                BuffTarget:Set[${UIElement[cbBuffInstinctGroupMember@Class@EQ2Bot Tabs@EQ2 Bot].SelectedItem.Text}]
                if ${Me.Maintained[${SpellType[${PreSpellRange[${xAction},1]}]}].Target.ID}!=${Actor[${BuffTarget.Token[2,:]},${BuffTarget.Token[1,:]}].ID}
                    Me.Maintained[${SpellType[${PreSpellRange[${xAction},1]}]}]:Cancel
                if ${Actor[${BuffTarget.Token[2,:]},${BuffTarget.Token[1,:]}](exists)}
                    call CastSpellRange ${PreSpellRange[${xAction},1]} 0 0 0 ${Actor[${BuffTarget.Token[2,:]},${BuffTarget.Token[1,:]}].ID} 0 0 1 0 2 0
                break
            case BuffSpores
                BuffTarget:Set[${UIElement[cbBuffSporesGroupMember@Class@EQ2Bot Tabs@EQ2 Bot].SelectedItem.Text}]
                if ${Me.Maintained[${SpellType[${PreSpellRange[${xAction},1]}]}].Target.ID}!=${Actor[${BuffTarget.Token[2,:]},${BuffTarget.Token[1,:]}].ID}
                    Me.Maintained[${SpellType[${PreSpellRange[${xAction},1]}]}]:Cancel
                if ${Actor[${BuffTarget.Token[2,:]},${BuffTarget.Token[1,:]}](exists)}
                    call CastSpellRange ${PreSpellRange[${xAction},1]} 0 0 0 ${Actor[${BuffTarget.Token[2,:]},${BuffTarget.Token[1,:]}].ID} 0 0 1 0 2 0
                break
            case AA_Rebirth
            case AA_Nature_Walk
                if !${Me.Maintained[${SpellType[${PreSpellRange[${xAction},1]}]}](exists)}
                {
                    call CastSpellRange ${PreSpellRange[${xAction},1]} 0 0 0 ${Me.ID} 0 0 1 0 2 0
                }
                break

            case AA_Infusion
                if ${InfusionMode}
                    call CastSpellRange ${PreSpellRange[${xAction},1]} 0 0 0 ${Me.ID} 0 0 1 0 2 0
                else
                    Me.Maintained[${SpellType[${PreSpellRange[${xAction},1]}]}]:Cancel
                break

            case AA_WardenStance
                if ${PreviousWardenStance} == -1 || ${WardenStance} == 0
                {
                    Me.Maintained[${SpellType[${PreSpellRange[${xAction},1]}]}]:Cancel
                    Me.Maintained[${SpellType[${PreSpellRange[${xAction},2]}]}]:Cancel
                    PreviousWardenStance:Set[${WardenStance}]
                    break
                }
               
                if (${WardenStance} != 0 && (${PreviousWardenStance} != -1) && (${WardenStance} != ${PreviousWardenStance})
                {
                    if (${Me.Ability[${SpellType[${PreSpellRange[${xAction},${WardenStance}]}]}](exists)})
                    {
                        Me.Maintained[${SpellType[${PreSpellRange[${xAction},${PreviousWardenStance}]}]}]:Cancel
                        call CastSpellRange ${PreSpellRange[${xAction},${WardenStance}]} 0 0 0 ${Me.ID} 0 0 1 0 2 0
                        PreviousWardenStance:Set[${WardenStance}]  
                    }
                    break
                }
               
                if (${WardenStance} == ${PreviousWardenStance})
                {
                    if !${Me.Maintained[${SpellType[${PreSpellRange[${xAction},${WardenStance}]}]}](exists)}
                    {
                        call CastSpellRange ${PreSpellRange[${xAction},${WardenStance}]} 0 0 0 ${Me.ID} 0 0 1 0 2 0
                    }
                    break
                }
                break
               
            case AA_Litany
           
                if ${PreviousLitanyStance} == -1 || ${LitanyStance} == 0
                    {
                        ; User has selected NONE so turn off all Litany Spells
                        Me.Maintained[${SpellType[${PreSpellRange[${xAction},1]}]}]:Cancel
                        Me.Maintained[${SpellType[${PreSpellRange[${xAction},2]}]}]:Cancel
                        Me.Maintained[${SpellType[${PreSpellRange[${xAction},3]}]}]:Cancel
                        PreviousLitanyStance:Set[${LitanyStance}]
                        break
                    }
                   
                    if (${LitanyStance} != 0 && (${PreviousLitanyStance} != -1) && (${LitanyStance} != ${PreviousLitanyStance})
                    {
                        if (${Me.Ability[${SpellType[${PreSpellRange[${xAction},${LitanyStance}]}]}](exists)})
                        {
                            Me.Maintained[${SpellType[${PreSpellRange[${xAction},${PreviousLitanyStance}]}]}]:Cancel
                            call CastSpellRange ${PreSpellRange[${xAction},${LitanyStance}]} 0 0 0 ${Me.ID} 0 0 1 0 2 0
                            PreviousLitanyStance:Set[${LitanyStance}]  
                        }
                        break
                    }
                   
                    if (${LitanyStance} == ${PreviousLitanyStance})
                    {
                        if !${Me.Maintained[${SpellType[${PreSpellRange[${xAction},${LitanyStance}]}]}](exists)}
                        {
                            call CastSpellRange ${PreSpellRange[${xAction},${LitanyStance}]} 0 0 0 ${Me.ID} 0 0 1 0 2 0
                        }
                        break
                    }
                    break

            case AA_Shapeshift

                if ${PreviousShiftForm} == -1 || ${ShiftForm} == 0
                {
                    Me.Maintained[${SpellType[${PreSpellRange[${xAction},1]}]}]:Cancel
                    Me.Maintained[${SpellType[${PreSpellRange[${xAction},2]}]}]:Cancel
                    Me.Maintained[${SpellType[${PreSpellRange[${xAction},3]}]}]:Cancel
                    PreviousShiftForm:Set[${ShiftForm}]
                    break
                }
               
                if (${ShiftForm} != 0 && (${PreviousShiftForm} != -1) && (${ShiftForm} != ${PreviousShiftForm})
                {
                    if (${Me.Ability[${SpellType[${PreSpellRange[${xAction},${ShiftForm}]}]}](exists)})
                    {
                        Me.Maintained[${SpellType[${PreSpellRange[${xAction},${PreviousShiftForm}]}]}]:Cancel
                        PreviousShiftForm:Set[${ShiftForm}]
                        call CastSpellRange ${PreSpellRange[${xAction},${ShiftForm}]} 0 0 0 ${Me.ID} 0 0 1 0 2 0
                    }
                    break
                }
               
                if (${ShiftForm} == ${PreviousShiftForm})
                {
                    if !${Me.Maintained[${SpellType[${PreSpellRange[${xAction},${ShiftForm}]}]}](exists)}
                    {
                        call CastSpellRange ${PreSpellRange[${xAction},${ShiftForm}]} 0 0 0 ${Me.ID} 0 0 1 0 2 0
                    }
                    break
                }
                break

            case AA_BuffCritMit

                BuffTarget:Set[${UIElement[cbBuffCritMitGroupMember@Class@EQ2Bot Tabs@EQ2 Bot].SelectedItem.Text}]
                if ${Me.Maintained[${SpellType[${PreSpellRange[${xAction},1]}]}].Target.ID}!=${Actor[${BuffTarget.Token[2,:]},${BuffTarget.Token[1,:]}].ID}
                    Me.Maintained[${SpellType[${PreSpellRange[${xAction},1]}]}]:Cancel
                if ${Actor[${BuffTarget.Token[2,:]},${BuffTarget.Token[1,:]}](exists)}
                    call CastSpellRange ${PreSpellRange[${xAction},1]} 0 0 0 ${Actor[${BuffTarget.Token[2,:]},${BuffTarget.Token[1,:]}].ID} 0 0 1 0 2 0
                break


            Default
                Return Buff Complete
                break
        }
    }

    function Combat_Routine(int xAction)
    {
        declare counter int local 1
       
        declare spellsused int local
        declare spellthreshold int local

        spellsused:Set[0]
        spellthreshold:Set[2]
       
        if (!${RetainAutoFollowInCombat} && ${Me.ToActor.WhoFollowing(exists)})
        {
            EQ2Execute /stopfollow
            AutoFollowingMA:Set[FALSE]
            wait 3
        }
       
        if ${MeleeMode} && ${Target.Distance}>4
            {
                call CheckPosition 1 ${Target.IsEpic}
                if !${Me.AutoAttackOn}
                {
                    EQ2Execute /auto 1
                }
            }
       
        call DoTortShell
       
        if ${CureMode}
            call CheckCures
        call CombatRez
        call CheckGroupHealth 75   
       
        if ${KeepReactiveUp}
            call CheckHOTs 
           
        call TinkerInCombat
        call CheckHeals
                ;if ${ShardMode}
                ;   call Shard
                ;call RefreshPower
       
        ; If we have chosen to participate in HO's and SpellMode is the set a flag to participate
        if ${DoHOs} && ${SpellMode}
        {
            objHeroicOp:DoHO
        }

        ; If we have chosen to be an HO starter. Go ahead and start and HO event.
        if !${EQ2.HOWindowActive} && ${Me.InCombat} && ${StartHO}
        {
            call _CastSpellRange 305
        }

        if ${CureMode}
            call CheckCures
        call CombatRez
       
        if !${KeepReactiveUp} && ${Me.InCombat}
        {
            ;Sandstorm
            if ${spellsused}<=${spellthreshold} && ${Me.Ability[${SpellType[365]}].IsReady}
            {
                call _CastSpellRange 365 0 0 ${Me.ID} 0 0 1 0 1 0
                    spellsused:Inc
            }
               
            ;Undergrowth (Encounter Debuff)
            if ${spellsused}<=${spellthreshold} && ${Me.Ability[${SpellType[223]}].IsReady} && !${Me.Maintained[${SpellType[223]}](exists)} && (${Actor[${KillTarget}].Type.Equal[NamedNPC]} || ${Actor[${KillTarget}].IsEpic})
            {
                call _CastSpellRange 223 0 0 ${KillTarget}
                    spellsused:Inc
            }  

            if ${CureMode}
                call CheckCures
            call CombatRez
               
            ;Wrath of Nature
            if ${spellsused}<=${spellthreshold} && ${Me.Ability[${SpellType[504]}].IsReady} && ${SpellMode}
            {
                call _CastSpellRange 504 0 0 ${KillTarget} 0 0 1 0 1 0
                    wait 5
                    spellsused:Inc
            }
           
            ;Nature Blade
            if ${spellsused}<=${spellthreshold} && ${Me.Ability[${SpellType[381]}].IsReady} && ${MeleeMode}
            {
                call _CastSpellRange 381 0 0 0 ${KillTarget} 0 0 1 0 1 0
                    spellsused:Inc
            }
           
            if ${CureMode}
                call CheckCures
            call CombatRez
            if ${KeepReactiveUp}
                call CheckHOTs 
           
            ;Whirl of Permafrost
            if ${spellsused}<=${spellthreshold} && ${Me.Ability[${SpellType[514]}].IsReady} && ${AoEMode} && ${MeleeMode}
            {
                call _CastSpellRange 514 0 0 0 ${KillTarget} 0 0 1 0 1 0
                    spellsused:Inc
            }
           
            ;Frostbite Slice
            if ${spellsused}<=${spellthreshold} && ${Me.Ability[${SpellType[513]}].IsReady} && ${MeleeMode}
            {
                call _CastSpellRange 513 0 0 0 ${KillTarget} 0 0 1 0 1 0
                    spellsused:Inc
            }
           
            if ${CureMode}
                call CheckCures
            call CombatRez
           
            ;Dawkstrike
            if ${spellsused}<=${spellthreshold} && ${Me.Ability[${SpellType[515]}].IsReady} && ${MeleeMode}
            {
                call _CastSpellRange 515 0 0 0 ${KillTarget} 0 0 1 0 1 0
                    spellsused:Inc
            }
           
            ;Icefall Strike
            if ${spellsused}<=${spellthreshold} && ${Me.Ability[${SpellType[512]}].IsReady} && ${MeleeMode}
            {
                call _CastSpellRange 512 0 0 0 ${KillTarget} 0 0 1 0 1 0
                    spellsused:Inc
            }
           
            if ${CureMode}
                call CheckCures
            call CombatRez
            call CheckGroupHealth 75   
           
            ;Thunderspike
            if ${spellsused}<=${spellthreshold} && ${Me.Ability[${SpellType[383]}].IsReady} && ${MeleeMode}
            {
                call _CastSpellRange 383 0 0 0 ${KillTarget} 0 0 1 0 1 0
                    spellsused:Inc
            }
               
            ;Master's Smite
            if ${spellsused}<=${spellthreshold} && ${Me.Ability[${SpellType[511]}].IsReady} && ${SpellMode}
            {
                call _CastSpellRange 511 0 0 ${KillTarget} 0 0 0 0 1 0
                    spellsused:Inc
            }
               
            if ${CureMode}
                call CheckCures
            call CombatRez
            if ${KeepReactiveUp}
                call CheckHOTs         
               
            ;Nature's pack
            if ${spellsused}<=${spellthreshold} && ${Me.Ability[${SpellType[332]}].IsReady} && !${Me.Maintained[${SpellType[332]}](exists)} && ${SpellMode}
            {
                call _CastSpellRange 332 0 0 ${KillTarget} 0 0 0 0 1 0
                    spellsused:Inc
            }
               
            if ${CureMode}
                call CheckCures
            call CombatRez
            call CheckGroupHealth 75
        }
    }

    function Post_Combat_Routine(int xAction)
    {
        declare tempgrp int 1
        TellTank:Set[FALSE]

        ; turn off auto attack if we were casting while the last mob died
        if ${Me.AutoAttackOn}
        {
            EQ2Execute /toggleautoattack
        }

        switch ${PostAction[${xAction}]}
        {
            case Resurrection
                tempgrp:Set[1]
                do
                {
                    if ${Me.Group[${tempgrp}](exists)} && ${Me.Group[${tempgrp}].ToActor.IsDead}
                    {
                        call _CastSpellRange 301 303 1 0 ${Me.Group[${tempgrp}].ID} 1
                        call _CastSpellRange 300 303 0 0 ${Me.Group[${tempgrp}].ID} 1
                        wait 5
                    }
                }
                while ${tempgrp:Inc} <= ${Me.GroupCount}
                break
            default
                return PostCombatRoutineComplete
                break
        }
    }

    function RefreshPower()
    {

        if ${Me.InCombat} && ${Me.ToActor.Power}<65  && ${Me.ToActor.Health}>25
        {
            call UseItem "
    Helm of the Scaleborn"
        }

        if ${Me.InCombat} && ${Me.ToActor.Power}<45
        {
            call UseItem "
    Spiritise Censer"
        }

        if ${Me.InCombat} && ${Me.ToActor.Power}<15
        {
            call UseItem "
    Stein of the Everling Lord"
        }

    }

    function Have_Aggro(int aggroid)
    {

        if !${TellTank} && ${WarnTankWhenAggro}
        {
            eq2execute /tell ${MainTankPC}  ${Actor[${aggroid}].Name} On Me!
            TellTank:Set[TRUE]
        }

        call CastSpellRange 180 0 0 0 ${aggroid}
    }

    function CheckHeals()
    {
        declare tempgrp int local 1
        declare temphl int local 1
        declare temph2 int local 1
        declare grpheal int local 0
        declare lowest int local 0
        declare raidlowest int local 0
        declare PetToHeal int local 0
        declare MainTankID int local 0
        declare MainTankInGroup bool local 0
        declare MainTankExists bool local 1
       
        call DoTortShell

        if ${Me.Name.Equal[${MainTankPC}]}
            MainTankID:Set[${Me.ID}]
        else
            MainTankID:Set[${Actor[pc,ExactName,${MainTankPC}].ID}]

        if !${Actor[${MainTankID}](exists)}
        {
          echo "
    EQ2Bot-CheckHeals() -- MainTank does not exist! (MainTankID/MainTankPC: ${MainTankID}/${MainTankPC}"
          MainTankExists:Set[FALSE]
        }
        else
            MainTankExists:Set[TRUE]

        ; Check to see if Healer needs cured of the curse and cure it first.
        if ${Me.Cursed}  && ${Me.Ability[${SpellType[211]}].IsReady}
        {
    ;   && ${CureCurseSelfMode}
            call _CastSpellRange 211 0 0 0 ${Me.ID} 0 0 0 0 1 0
            eq2execute gsay Curing my curse
        }

        ;stun check
        if !${Me.ToActor.CanTurn} || ${Me.ToActor.IsRooted}
            call _CastSpellRange 501

        ;Res the MT if they are dead
        if (${MainTankExists})
        {
            if (!${Me.ToActor.InCombatMode} || ${CombatRez}) && ${Actor[${MainTankID}].IsDead}
                call CastSpellRange 300 0 1 1 ${MainTankID}
        }

        if ${KeepReactiveUp}
            call CheckHOTs
       
        ;healing grove + faerie
        if ${EpicMode} && ${Me.InCombat} && ${PetMode} && (${Actor[${MainTankPC}].Health}<75
        {  
            call _CastSpellRange 330 331 0 0 ${Me.ID} 0 0 0 0 1 0
        }


      if ${Me.GroupCount} > 1
      {
        do
        {
            if ${Me.Group[${temphl}].ToActor(exists)}
            {
                if ${Me.Group[${temphl}].ToActor.Health}<100 && !${Me.Group[${temphl}].ToActor.IsDead}
                {
                    if (${Me.Group[${temphl}].ToActor.Health}<${Me.Group[${lowest}].ToActor.Health} || ${lowest}==0) && ${Me.Group[${temphl}].ToActor.Distance}<=${Me.Ability[${SpellType[1]}].Range}
                        lowest:Set[${temphl}]
                }

                if ${Me.Group[${temphl}].ID}==${MainTankID}
                    MainTankInGroup:Set[1]

                if !${Me.Group[${temphl}].ToActor.IsDead} && ${Me.Group[${temphl}].ToActor.Health}<80
                    grpheal:Inc

                if ${Me.Group[${temphl}].ToActor.Pet.Health}<60 && ${Me.Group[${temphl}].ToActor.Pet.Health}>0
                    PetToHeal:Set[${Me.Group[${temphl}].ToActor.Pet.ID}

                if ${Me.ToActor.Pet.Health}<60
                    PetToHeal:Set[${Me.ToActor.Pet.ID}]
            }
        }
        while ${temphl:Inc} <= ${Me.GroupCount}
      }

      if ${Me.ToActor.Health}<80 && !${Me.ToActor.IsDead}
        grpheal:Inc

      if ${grpheal}>1
        call GroupHeal

      if (${MainTankExists})
      {
        if ${Actor[${MainTankID}].Health}<90
        {
            if ${Me.ID}==${MainTankID}
                call HealMe
            else
                call HealMT ${MainTankID} ${MainTankInGroup}
        }

        ;Check My health after MT
        if ${Me.ID}!=${MainTankID} && ${Me.ToActor.Health}<50
            call HealMe
      }
      else
      {
        if ${Me.ToActor.Health}<60
          call HealMe
      }

        ;now lets heal individual groupmembers if needed
        if ${lowest}
        {
            ;call UseCrystallizedSpirit 60

            if ${Me.Group[${lowest}].ToActor.Health}<70 && !${Me.Group[${lowest}].ToActor.IsDead} && ${Me.Group[${lowest}].ToActor(exists)} && ${Me.Group[${lowest}].ToActor.Distance}<=${Me.Ability[${SpellType[1]}].Range}
            {
                if ${Me.Ability[${SpellType[7]}].IsReady}
                    call _CastSpellRange 7 0 0 0 ${Me.Group[${lowest}].ToActor.ID}
                elseif ${Me.Ability[${SpellType[1]}].IsReady}
                    call _CastSpellRange 1 0 0 0 ${Me.Group[${lowest}].ToActor.ID}
                else
                    call _CastSpellRange 4 0 0 0 ${Me.Group[${lowest}].ToActor.ID}
            }
        }



        ;RAID HEALS - Only check if in raid, raid heal mode on, maintank is green, I'm above 50, and a direct heal is available.  Otherwise don't waste time.
        if ${RaidHealMode} && ${Me.InRaid} && ${Me.ToActor.Health}>50 && ((${MainTankExists} && ${Actor[${MainTankID}].Health}>70) || !${MainTankExists}) && (${Me.Ability[${SpellType[4]}].IsReady} || ${Me.Ability[${SpellType[1]}].IsReady})
        {
        ;echo Debug: Check Raid Heals - ${temph2}
            do
            {
                if ${Me.Raid[${temph2}](exists)} && ${Me.Raid[${temph2}].ToActor(exists)}
                {
                  if ${Me.Raid[${temph2}].Name.NotEqual[${Me.Name}]}
                    {
                    if ${Me.Raid[${temph2}].ToActor.Health} < 100 && !${Me.Raid[${temph2}].ToActor.IsDead} && ${Me.Raid[${temph2}].ToActor.Distance}<=${Me.Ability[${SpellType[1]}].Range}
                    {
                        if ${Me.Raid[${temph2}].ToActor.Health} < ${Me.Raid[${raidlowest}].ToActor.Health} || ${raidlowest}==0
                        {
                            ;echo Debug: Lowest - ${temph2}
                            raidlowest:Set[${temph2}]
                        }
                    }
                    }
                }
            }
            while ${temph2:Inc}<=24

            if (${Me.Raid[${raidlowest}].ToActor(exists)})
            {
                ;echo Debug: We need to heal ${raidlowest}
                if ${Me.InCombat} && ${Me.Raid[${raidlowest}].ToActor.Health} < 90 && !${Me.Raid[${raidlowest}].ToActor.IsDead} && ${Me.Raid[${raidlowest}].ToActor.Distance}<=${Me.Ability[${SpellType[1]}].Range}
                {
                    ;Debug:Echo["
    Raid Lowest: ${Me.Raid[${raidlowest}].Name} -> ${Me.Raid[${raidlowest}].ToActor.Health} health"]
                    if ${Me.Ability[${SpellType[4]}].IsReady}
                        call _CastSpellRange 4 0 0 0 ${Me.Raid[${raidlowest}].ID}
                    elseif ${Me.Ability[${SpellType[1]}].IsReady}
                        call _CastSpellRange 1 0 0 0 ${Me.Raid[${raidlowest}].ID}
                }
            }
        }

        ;PET HEALS
        if ${PetToHeal} && ${Actor[ExactName,${PetToHeal}](exists)} && ${Actor[ExactName,${PetToHeal}].InCombatMode} && !${EpicMode} && !${Me.InRaid}
            call _CastSpellRange 4 0 0 0 ${PetToHeal}

        ;Check Rezes
        if ${CombatRez} || !${Me.InCombat}
        {
            temphl:Set[1]
            do
            {
                if ${Me.Group[${temphl}].ToActor(exists)} && ${Me.Group[${temphl}].ToActor.IsDead} && ${Me.Group[${temphl}].ToActor.Distance}<=20
                {  
                    ;nature's touch 302, equinox 301 , reincarnation 300
                    if  !${Me.Ability[${SpellType[300]}].IsReady} && ${Me.Ability[${SpellType[302]}].IsReady}
                        call _CastSpellRange 302 303 1 0 ${Me.Group[${temphl}].ID} 1
                   
                    if !${Me.Ability[${SpellType[300]}].IsReady} && !${Me.Ability[${SpellType[302]}].IsReady} && ${Me.Ability[${SpellType[301]}].IsReady}
                        call _CastSpellRange 301 303 1 0 ${Me.Group[${temphl}].ID} 1

                    if ${Me.Ability[${SpellType[300]}].IsReady}
                        call _CastSpellRange 300 303 1 0 ${Me.Group[${temphl}].ID} 1
                }
            }
            while ${temphl:Inc} <= ${Me.GroupCount}
        }
    }

    function HealMe()
    {
        ; Check to see if Healer needs cured of the curse and cure it first.
        if ${Me.Cursed}  && ${Me.Ability[${SpellType[211]}].IsReady}
        {
        ;&& ${CureCurseSelfMode}
            call _CastSpellRange 211 0 0 0 ${Me.ID} 0 0 0 0 1 0
            eq2execute gsay Curing my curse
        }

        if ${Me.Inventory[Crystallized Spirit](exists)} && ${Me.ToActor.Health}<70 && ${Me.ToActor.InCombatMode}
            Me.Inventory[Crystallized Spirit]:Use

        if ${Me.ToActor.Health}<75
            call _CastSpellRange 331

        if ${Me.ToActor.Health}<25
        {
            if ${haveaggro}
                call EmergencyHeal ${Me.ID} 1
            else
            {
                if ${Me.Ability[${SpellType[4]}].IsReady}
                    call _CastSpellRange 4 0 0 0 ${Me.ID}
                else
                    call _CastSpellRange 1 0 0 0 ${Me.ID}
            }
        }

        if ${Me.ToActor.Health}<60
        {
            if ${haveaggro} && ${Me.ToActor.InCombatMode}
                call _CastSpellRange 7 0 0 0 ${Me.ID} 0 0 0 0 1 0
            else
                call _CastSpellRange 1 0 0 0 ${Me.ID} 0 0 0 0 1 0
        }

        if ${Me.ToActor.Health}<40
            call _CastSpellRange 4 0 0 0 ${Me.ID} 0 0 0 0 1 0
    }

    function HealMT(int MainTankID, int MTInMyGroup)
    {
        ; Check to see if Healer needs cured of the curse and cure it first.
        if ${Me.Cursed} && ${Me.Ability[${SpellType[211]}].IsReady}
        {
        ;&& ${CureCurseSelfMode}
            call _CastSpellRange 211 0 0 0 ${Me.ID} 0 0 0 0 1 0
            eq2execute gsay Curing my curse
        }

        ;MAINTANK EMERGENCY HEAL
        if ${Actor[${MainTankID}].Health}<30 && !${Actor[${MainTankID}].IsDead} && ${Actor[${MainTankID}](exists)}
        {
            ;Cyclone
            call _CastSpellRange 418 0 0 0 ${MainTankID} 0 0 1 0 1 0
            call EmergencyHeal ${MainTankID} ${MTInMyGroup}
        }
       
        ;faith of the fallen
        if ${Actor[${MainTankID}].Health}<20 && !${Actor[${MainTankID}].IsDead} && ${Actor[${MainTankID}](exists)} && ${EpicMode}
        {
            call _CastSpellRange 417 0 0 0 ${MainTankID} 0 0 0 0 1 0
        }

        if ${Actor[${MainTankID}].Health}<50 && !${Actor[${MainTankID}].IsDead} && ${Actor[${MainTankID}](exists)} && ${EpicMode}
        {
            call _CastSpellRange 4 0 0 0 ${MainTankID} 0 0 0 0 1 0
            call _CastSpellRange 416 0 0 0 ${MainTankID} 0 0 0 0 1 0
        }

        ;MAINTANK HEALS
        ; Use regens first, then Patch Heals
        if ${Actor[${MainTankID}].Health}<90 && ${Actor[${MainTankID}](exists)} && !${Actor[${MainTankID}].IsDead}
        {
            if ${Me.Ability[${SpellType[15]}].IsReady} && !${Me.Maintained[${SpellType[15]}](exists)} && ${MTInMyGroup} && ${EpicMode}
            {
                call _CastSpellRange 15 ${MainTankID} 0 0 0 0 1 0
            }
            elseif ${Me.Ability[${SpellType[7]}].IsReady} && !${Me.Maintained[${SpellType[7]}].Target.ID}==${MainTankID}
                call _CastSpellRange 7 0 0 0 ${MainTankID} 0 0 0 0 1 0

            ;we should check for other druid in raid here, but oh well.
            if ${Me.Ability[${SpellType[7]}].IsReady} && ${EpicMode} && !${Me.Maintained[${SpellType[7]}].Target.ID}==${MainTankID}
                call _CastSpellRange 7 0 0 0 ${MainTankID} 0 0 0 0 1 0
        }

        if ${Actor[${MainTankID}].Health}<60 && !${Actor[${MainTankID}].IsDead} && ${Actor[${MainTankID}](exists)}
        {
            call _CastSpellRange 1 0 0 0 ${MainTankID} 0 0 0 0 1 0
        }

        if ${Actor[${KillTarget}].Target.ID}==${MainTankID}
            return

        call IsFighter ${Actor[${KillTarget}].Target.ID}
       
        ;target kill target?
        if ${Actor[${MainTankID}].Health}>90 && ${return} && ${Actor[${KillTarget}].Target.ID}!=${MainTankID}
        {
            if ${Actor[${KillTarget}].Target.Health}<50
                call _CastSpellRange 4 0 0 0 ${Actor[${KillTarget}].Target.ID}

            if ${Actor[${KillTarget}].Target.Health}<70
                call _CastSpellRange 1 0 0 0 ${Actor[${KillTarget}].Target.ID}

            if ${Me.Ability[${SpellType[7]}].IsReady} && ${EpicMode} && !${Me.Maintained[${SpellType[7]}].Target.ID}==${Actor[${KillTarget}].Target.ID}
                call _CastSpellRange 7 0 0 0 ${Actor[${KillTarget}].Target.ID}
        }

    }

    function GroupHeal()
    {
        ; Check to see if Healer needs cured of the curse and cure it first.
        if ${Me.Cursed}  && ${Me.Ability[${SpellType[211]}].IsReady}
        {
        ;&& ${CureCurseSelfMode}
            call _CastSpellRange 211 0 0 0 ${Me.ID} 0 0 0 0 1 0
            eq2execute gsay Curing my curse
        }
        if ${Me.Ability[${SpellType[10]}].IsReady}
            call _CastSpellRange 10
        else
            call _CastSpellRange 15
       
        ;faerie
        call _CastSpellRange 331 0 0 0 ${Me.ID} 0 0 0 0 1 0
        ;healing grove
        call _CastSpellRange 330 0 0 0 ${Me.ID} 0 0 0 0 1 0
    }

    function EmergencyHeal(int healtarget, int MTInMyGroup)
    {
        ;Grp Death Prevention
        if ${Me.Ability[${SpellType[317]}].IsReady} && ${MTInMyGroup}
            call _CastSpellRange 317 0 0 0 ${healtarget} 0 0 0 0 1 0
        else
            ;Single Target Death Prevent
            call _CastSpellRange 329 0 0 0 ${healtarget} 0 0 0 0 1 0

        ;Emergency Heals
            ;Sylvan Embrace (Grp HoT)
        if ${Me.Ability[${SpellType[16]}].IsReady} && ${MTInMyGroup}
            call _CastSpellRange 16 0 0 0 ${healtarget} 0 0 0 0 1 0
        else
            ;Sylvan Touch (Single HoT)
            call _CastSpellRange 8 0 0 0 ${healtarget} 0 0 0 0 1 0
           
        ; Use Mythical if Available
        if ${UseMythical}
        {
            if (${Me.Equipment[Bite of The Wolf](exists)} && ${Me.Equipment[1].Tier.Equal[MYTHICAL]})
            {
                target ${healtarget}   
                Me.Equipment[Bite of the Wolf]:Use
            }
        }
    }



    function CureGroupMember(int gMember)
    {
        declare tmpcure int local 0

        if !${Me.Group[${gMember}].ToActor(exists)} || ${Me.Group[${gMember}].ToActor.IsDead}  || ${Me.Group[${gMember}].ToActor.Distance}>=${Me.Ability[${SpellType[210]}].Range}
            return

        while ${Me.Group[${gMember}].IsAfflicted} && ${CureMode} && ${tmpcure:Inc}<4 && ${Me.Group[${gMember}].ToActor(exists)} && !${Me.Group[${gMember}].ToActor.IsDead}
        {
            if ${Me.Group[${gMember}].Arcane}>0 || ${Me.Group[${gMember}].Noxious}>0 || ${Me.Group[${gMember}].Elemental}>0 || ${Me.Group[${gMember}].Trauma}>0
            {
                if ${Me.Ability[${SpellType[210]}].IsReady} && ${Me.Group[${gMember}].ID}==${MainTankID}
                {
                    call _CastSpellRange 210 0 0 0 ${Me.Group[${gMember}].ID} 0 0 0 0 1 0
                    wait 2
                }
            }
        }
    }

    function CureMe()
    {
        declare CureCnt int local 0
       
        call DoTortShell

        if !${Me.IsAfflicted}
            return

            ; Check to see if Healer needs cured of the curse and cure it first.
        if ${Me.Cursed}  && ${Me.Ability[${SpellType[211]}].IsReady}
        ;&& ${CureCurseSelfMode}
        {
            call _CastSpellRange 211 0 0 0 ${Me.ID} 0 0 0 0 1 0
            eq2execute gsay Curing my curse
        }

        while (${Me.Arcane}>0 || ${Me.Noxious}>0 || ${Me.Elemental}>0 || ${Me.Trauma}>0) && ${CureCnt:Inc}<5
        {
            if ${Me.Arcane}>0 || ${Me.Noxious}>0 || ${Me.Elemental}>0 || ${Me.Trauma}>0
            {
                call _CastSpellRange 210 0 0 0 ${Me.ID} 0 0 0 0 1 0
                wait 2
            }

            if ${Me.ToActor.Health}<30 && ${EpicMode}
            {
                call _CastSpellRange 7 0 0 0 ${Me.ID} 0 0 0 0 1 0
            }
        }
    }

    function CheckCures()
    {
        declare temphl int local 1
        declare temph2 int local 1
        declare grpcure int local 0
        declare Affcnt int local 0
        declare CureTarget string local
        declare elemental int local 0
       
        elemental:Set[0]
        call DoTortShell
               
        ;check if we are not in control, and use control cure if needed - cast Howling with the Pack
        if !${Me.ToActor.CanTurn} || ${Me.ToActor.IsRooted}
            call _CastSpellRange 525
           
        ; Check to see if Healer needs cured of the curse and cure it first.
        if ${Me.Cursed}  && ${Me.Ability[${SpellType[211]}].IsReady}
        ;&& ${CureCurseSelfMode}
        {
            call _CastSpellRange 211 0 0 0 ${Me.ID} 0 0 0 0 1 0
            eq2execute gsay Curing curse on me.
        }
        ; Check if curse on the person selected in the dropdown and cure them.
        ; if ${CureCurseOthersMode}
        ;{

        ;   CureTarget:Set[${CureCurseGroupMember}]

        ;   if  !${Me.Raid} > 0
        ;       {
        ;           if ${Me.Group[${CureTarget.Token[1,:]}].Cursed}
        ;           {
        ;               call CastSpellRange 211 0 0 0 ${Me.Group[${CureTarget.Token[1,:]}].ID} 0 0 0 0 1 0
        ;           }
        ;       }
        ;       else
        ;       {
        ;               if ${Me.Raid[${CureTarget.Token[1,:]}].Cursed}
        ;           {
        ;               call CastSpellRange 211 0 0 0 ${Me.Raid[${CureTarget.Token[1,:]}].ID} 0 0 0 0 1 0
        ;           }
        ;       }
        ;}
       

        ;loop group members, and check for curses
        do
        {
            ;make sure they in zone and in range
            if ${Me.Group[${temph2}].ToActor(exists)} && ${Me.Group[${temph2}].Cursed} && ${Me.Group[${temph2}].ToActor.Distance}<=${Me.Ability[${SpellType[211]}].Range} && ${Me.Ability[${SpellType[211]}].IsReady}
            {
                    call _CastSpellRange 211 0 0 0 ${Me.Group[${temph2}].ID} 0 0 0 0 1 0
                    eq2execute gsay Curse cure on ${Me.Group[${temph2}].ToActor}
                    wait 2
            }
        }
        while ${temph2:Inc} <= ${Me.GroupCount}

       

        ;check for group cures, if it is ready and we are in a large enough group
        if (${Me.Ability[${SpellType[220]}].IsReady} || ${Me.Ability[${SpellType[415]}].IsReady}) && ${Me.GroupCount}>1
        {
            ;check ourselves
            if ${Me.IsAfflicted}
            {
                ;add ticks for group cures based upon our afflicions
                if ${Me.Trauma}>0 || ${Me.Elemental}>0 || ${Me.Arcane}>0 || ${Me.Noxious}>0
                    grpcure:Inc
                        wait 2
            }

            ;loop group members, and check for group curable afflictions
            do
            {
                ;make sure they in zone and in range
                if ${Me.Group[${temphl}].ToActor(exists)} && ${Me.Group[${temphl}].IsAfflicted} && ${Me.Group[${temphl}].ToActor.Distance}<=${Me.Ability[${SpellType[220]}].Range}
                {
                    if ${Me.Group[${temphl}].Trauma}>0 || ${Me.Group[${temphl}].Elemental}>0 || ${Me.Group[${temphl}].Arcane}>0 || ${Me.Group[${temphl}].Noxious}>0
                        grpcure:Inc
                            wait 2
                }
            }
            while ${temphl:Inc} <= ${Me.GroupCount}

            if ${grpcure}>1
            {  
                ;checking for elementals
                if ${Me.Elemental}>0
                {
                    elemental:Set[1]
                }
               
                ;Shatter infections, then Tunare's Grace if rdy if not group cure
                if ${Me.Ability[${SpellType[399]}].IsReady}
                {
                    call _CastSpellRange 399 0 0 0 ${Me.ID} 0 0 0 0 1 0
                    eq2execute gsay "
    Group cure - shatter infections"
                }
                elseif ${Me.Ability[${SpellType[415]}].IsReady} && !${Me.Maintained[${SpellType[399]}](exists)}
                {
                    call _CastSpellRange 415 0 0 0 ${Me.ID} 0 0 0 0 1 0
                    eq2execute gsay "
    Group cure - Tunares Grace"
                }
                else           
                {
                    call _CastSpellRange 220 0 0 0 ${Me.ID} 0 0 0 0 1 0
                    eq2execute gsay Group cure
                }
               
                wait 2
                ;elemental ward if elemental
                if ${elemental}==1
                    call _CastSpellRange 363 0 0 0 ${Me.ID} 0 0 0 0 2 0    
            }
        }

        ;Cure Ourselves first
        call CureMe

        ;Cure Group Members - This will cure a single person unless epicmode is checkd on extras tab, in which case it will cure
        ;   all afflictions unless group health or mt health gets low
        while ${Affcnt:Inc}<7 && ${Me.ToActor.Health}>30 && (${Me.Arcane}<1 && ${Me.Noxious}<1 && ${Me.Elemental}<1 && ${Me.Trauma}<1)
        {
            call FindAfflicted
            if ${Return}>0
                call CureGroupMember ${Return}
            else
                break

            ;break if we need heals
            call CheckGroupHealth 30
            if !${Return}
                break

            ;Check MT health and heal him if needed
            if ${Actor[pc,ExactName,${MainTankPC}].Health}<50
            {
                if ${Actor[pc,ExactName,${MainTankPC}].ID}==${Me.ID}
                    call HealMe
                else
                    call HealMT ${MainTankID} ${MainTankInGroup}
            }

            ;epicmode is set in eq2botextras, we will cure only one person per call unless in epic mode.
            if !${EpicMode}
                break

        }

    }

    function FindAfflicted()
    {
        declare temphl int local 1
        declare tmpafflictions int local 0
        declare mostafflictions int local 0
        declare mostafflicted int local 0

        ;check for single target cures
        do
        {
            if ${Me.Group[${temphl}].IsAfflicted} && ${Me.Group[${temphl}].ToActor(exists)} && ${Me.Group[${temphl}].ToActor.Distance}<=${Me.Ability[${SpellType[210]}].Range}
            {
                if ${Me.Group[${temphl}].Arcane}>0
                    tmpafflictions:Set[${Math.Calc[${tmpafflictions}+${Me.Group[${temphl}].Arcane}]}]

                if ${Me.Group[${temphl}].Noxious}>0
                    tmpafflictions:Set[${Math.Calc[${tmpafflictions}+${Me.Group[${temphl}].Noxious}]}]

                if ${Me.Group[${temphl}].Elemental}>0
                    tmpafflictions:Set[${Math.Calc[${tmpafflictions}+${Me.Group[${temphl}].Elemental}]}]

                if ${Me.Group[${temphl}].Trauma}>0
                    tmpafflictions:Set[${Math.Calc[${tmpafflictions}+${Me.Group[${temphl}].Trauma}]}]

                if ${tmpafflictions}>${mostafflictions}
                {
                    mostafflictions:Set[${tmpafflictions}]
                    mostafflicted:Set[${temphl}]
                }
            }
        }
        while ${temphl:Inc} <= ${Me.GroupCount}

        if ${mostafflicted}>0
            return ${mostafflicted}
        else
            return 0
    }

    function CheckHOTs()
    {
        declare temphl int local 1 
        declare spellsused int local
        declare spellthreshold int local

        spellsused:Set[0]
        spellthreshold:Set[1]
                   
        if ${CureMode}
            call CheckCures
       
        ;Hierophantic Genesis (Heal + HoT + Power)
        if ${spellsused}<=${spellthreshold} && ${Me.Ability[${SpellType[9]}].IsReady} && !${Me.Maintained[${SpellType[9]}](exists)}
        {
            call _CastSpellRange 9 0 0 0 ${Actor[pc,exactname,${MainTankPC}].ID} 0 0 0 0 1 0
                spellsused:Inc
        }
        ;Photosynthesis (HoT)
        if ${spellsused}<=${spellthreshold} && ${Me.Ability[${SpellType[7]}].IsReady} && !${Me.Maintained[${SpellType[7]}](exists)}
        {
            call _CastSpellRange 7 0 0 0 ${Actor[pc,exactname,${MainTankPC}].ID} 0 0 0 0 1 0
            wait 5
                spellsused:Inc
        }
       
        ; Healstorm (Grp HoT)
        if ${spellsused}<=${spellthreshold} && ${Me.Ability[${SpellType[15]}].IsReady} && !${Me.Maintained[${SpellType[15]}](exists)}
        {
            call _CastSpellRange 15 0 0 0 ${Me.ID} 0 0 0 0 1 0
            wait 10
                spellsused:Inc
        }
       
        if ${CureMode}
            call CheckCures
           
        ;Sylvan Bloom (Heal + HoT + Ward)
        if ${spellsused}<=${spellthreshold} && ${Me.Ability[${SpellType[4]}].IsReady} && !${Me.Maintained[${SpellType[4]}](exists)}
        {
            call _CastSpellRange 4 0 0 0 ${Actor[pc,exactname,${MainTankPC}].ID} 0 0 0 0 1 0
                spellsused:Inc
        }
        ;Tranquality (Heal + Dispell-OT+HoT)
        if ${spellsused}<=${spellthreshold} && ${Me.Ability[${SpellType[214]}].IsReady} && !${Me.Maintained[${SpellType[214]}](exists)}
        {
            call _CastSpellRange 214 0 0 0 ${Actor[pc,exactname,${MainTankPC}].ID} 0 0 0 0 1 0
                spellsused:Inc
        }
       
        ;Winds of Healing (Grp heal)
        if ${spellsused}<=${spellthreshold} && ${Me.Ability[${SpellType[10]}].IsReady}
        {
            call _CastSpellRange 10 0 0 0 ${Me.ID} 0 0 0 0 1 0
            wait 5
                spellsused:Inc
        }
    }

    function HandleGroupWiped()
    {
        ;;; There was a full group wipe and now we are rebuffing

            ; Pass out feathers on initial script startup
        if !${InitialBuffsDone}
        {
            if (${Me.GroupCount} > 1)
            {
                call _CastSpellRange 313
                InitialBuffsDone:Set[TRUE]
            }
               
        }

        return OK
    }


    function Lost_Aggro()
    {

    }

    function MA_Lost_Aggro()
    {

    }

    function MA_Dead()
    {
        if ${Actor[${MainTankPC}].IsDead} && ${Actor[${MainTankPC}](exists)} && ${CombatRez} && ${Actor[${MainTankPC}].Distance}<30
            call _CastSpellRange 303 0 1 0 ${MainTankPC} 1
    }

    function Cancel_Root()
    {
    }

    function _CastSpellRange(int start, int finish, int xvar1, int xvar2, int TargetID, int notall, int refreshtimer, bool castwhilemoving, bool IgnoreMaintained, bool CastSpellNOW, bool IgnoreIsReady)
    {
        variable bool bReturn
        variable string sReturn
       
        ;; we should actually cast the spell we wanted to cast originally before doing anything else
        LastSpellCast:Set[${start}]
        call CastSpellRange ${start} ${finish} ${xvar1} ${xvar2} ${TargetID} ${notall} ${refreshtimer} ${castwhilemoving} ${IgnoreMaintained} ${CastSpellNOW} ${IgnoreIsReady}
        if ${bReturn}
            return ${sReturn}
        else
            bReturn:Set[${Return}]

        ;; Anything else we want to do should go here...

        return ${bReturn}
    }


    function DoTortShell()
    {
       
        if ${TSStatus} && ${Me.Ability[${SpellType[503]}].IsReady}
        {
            call _CastSpellRange 503 0 0 0 ${KillTarget} 0 0 1 0 1 0
            wait 15
            if ${Me.Maintained[${SpellType[388]}](exists)}
            {
                if ${TortShellAnnounceText.Length}
                    eq2execute /gsay ${TortShellAnnounceText}
                TSStatus:Set[0]
            }
            eq2execute gsay "
    Tortoise Shell Inc!"
            TSStatus:Set[0]
        }
    }



    function CombatRez()
    {
        declare temphl int local 1 
            ;Check Combat Rezes
            if ${CombatRez} && ${Me.InCombat}
            {
                temphl:Set[1]
                do
                {
                    if ${Me.Group[${temphl}].ToActor(exists)} && ${Me.Group[${temphl}].ToActor.IsDead} && ${Me.Group[${temphl}].ToActor.Distance}<=10
                    {  
                        ;Nature's Touch
                        if  !${Me.Ability[${SpellType[300]}].IsReady} && ${Me.Ability[${SpellType[302]}].IsReady}
                            call _CastSpellRange 302 0 1 0 ${Me.Group[${temphl}].ID} 1
                        ;Reincarnation 300
                        if ${Me.Ability[${SpellType[300]}].IsReady}
                            call _CastSpellRange 300 0 1 0 ${Me.Group[${temphl}].ID} 1
                    }
                }
                while ${temphl:Inc} <= ${Me.GroupCount}
            }
    }


    function PostDeathRoutine()
    {
        ;; This function is called after a character has either revived or been rezzed
       
            ; NEEDED CODE FOR SOW TIMER TO WORK
            ; NEEDS TO BE HERE BECAUSE WE ONLY WANT
            ; IT EXECUTING ONCE ON SCRIPT STARTUP
           
            SOWStartTime:Set[${Time.Timestamp}]
            SOWStartTime.Day:Dec[1]
            SOWStartTime:Update
           
        call TinkerOutCombat

        return
    }
  5. TheHaydens

    TheHaydens Member

    Messages:
    66
    FYI, you won't be able to just copy and paste that code and replace it with yours.. It will crash every time you attempt to bootup, you would need all my extra variables which are found in my eq2botcommander.iss and the eq2bot.iss file... If your wanting all those, they can be found on my profile page..

    I just don't want you to copy and paste, than have a bigger headache than you have now, Good luck!!

Share This Page