Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- |------------------------------------------------------------------------|
- |- e3_Classes_Bard.inc v3.0 ( originally designed to work with e3.mac ) -|
- |- Written by Killians of PEQ -|
- |------------------------------------------------------------------------|
- |- Contains Bard specific functions related to, -|
- |- Setup and Ini entry information -|
- |- MainLoop, and AssistLoop hooks -|
- |- Over-all functionality / flow -|
- |------------------------------------------------------------------------|
- #event saveMelody "<#1#> Save Melody #2# #3#"
- SUB EVENT_saveMelody(line, ChatSender, melodyName, songsToSave)
- /if (${Debug}) /echo |- EVENT_saveMelody ==>
- | If no ChatSender is defined, make one.
- /if (!${Defined[ChatSender]}) /declare ChatSender string local ${Me.CleanName}
- | If I'm the ChatSender.
- /if (${ChatSender.Equal[${Me.CleanName}]}) {
- /declare i int local
- | Check if the melody already exists, and should not be overwritten.
- /if (${Ini[${Character_Ini},${melodyName} Melody].Length}) {
- /if (${Debug}) /echo |- EVENT_saveMelody -| Overwriting [${melodyName}] melody...
- /for i 1 to 5
- /if (${Ini[${Character_Ini},${melodyName} Melody,Song#${i}].Length}) /call WriteToIni "${Character_Ini},${melodyName} Melody,Song#${i}" *PLACEHOLDER 1
- /next i
- }
- /echo Saving [${melodyName}] melody...
- /varset i 1
- :check_nextSong
- | If the gem number is not recognized
- /if (!${Int[${songsToSave.Arg[${i}, ]}]} || ${Int[${songsToSave.Arg[${i}, ]}]} < 1 || ${Int[${songsToSave.Arg[${i}, ]}]} > 9) {
- /if (${songsToSave.Arg[${i}, ].NotEqual[-Overwrite]}) {
- /echo [${songsToSave.Arg[${i}, ]}] is not a valid gem number. Please use the following syntax when saving melodies, "Save Melody [NAME] [# # # # #] (-Overwrite)". Ex. /echo Save Melody Raid 1 2 3 4 5 -Overwrite
- }
- } else {
- /echo Song#${i}=${Me.Gem[${songsToSave.Arg[${i}, ]}]}/gem|${songsToSave.Arg[${i}, ]}
- /call WriteToIni "${Character_Ini},${melodyName} Melody,Song#${i}" "${Me.Gem[${songsToSave.Arg[${i}, ]}]}/gem|${songsToSave.Arg[${i}, ]}" ${If[${Ini[${Character_Ini},${melodyName} Melody,Song#${i}].Length},1,0]}
- }
- /varcalc i ${i} + 1
- /if (${songsToSave.Arg[${i}, ].Length}) /goto :check_nextSong
- }
- /if (${Debug}) /echo <== EVENT_saveMelody -|
- /return
- #EVENT startMelody "<#1#> Melody #2#"
- SUB EVENT_startMelody(line, ChatSender, melodyName)
- /if (${Debug}) /echo |- EVENT_startMelody ==>
- | -Verify the event
- /call verifyEvent "${ChatSender}" "${line}"
- /varset ChatSender ${Macro.Return.Arg[1,_]}
- | |-----------Valid User----------| |--------Included Bot-----------| |-----------In Zone-------------| |------------In Range------------|
- /if (${Bool[${Macro.Return.Arg[2,_]}]} && ${Bool[${Macro.Return.Arg[3,_]}]} && ${Bool[${Macro.Return.Arg[4,_]}]} && ${Bool[${Macro.Return.Arg[5,_]}]}) {
- /if (${melodyName.Find[ /]}) /varset melodyName ${melodyName.Arg[1, /]}
- /if (${Me.Class.ShortName.Equal[BRD]}) {
- | If I don't have the melodyName listed in my ini.
- /if (!${Ini[${Character_Ini},${melodyName} Melody,Song#1].Length}) {
- | If Stop, end, or pause were used, stop the melody.
- /if (${Select[${melodyName},Stop,End,Pause]}) {
- /varset playingMelody FALSE
- /varset songSet
- /docommand ${ChatToggle} Ending melody.
- /twist end
- } else {
- /docommand ${ChatToggle} [${melodyName}] is not a known melody.
- }
- } else {
- /declare songList string local
- /declare retryTimer timer local 100
- /declare spellName string local
- /declare i int local
- | For 1 to 5 (maximum melody size)
- /for i 1 to 10
- /if (${Ini[${Character_Ini},${melodyName} Melody,Song#${i}].Length} && ${Ini[${Character_Ini},${melodyName} Melody,Song#${i}].NotEqual[PLACEHOLDER]}) {
- /call validateCast "0|NULL" "${Ini[${Character_Ini},${melodyName} Melody,Song#${i}]}"
- /if (!${Macro.Return}) /next i
- /varset spellName ${Ini[${Character_Ini},${melodyName} Melody,Song#${i}].Arg[1,/]}
- | If the Song is 21-40 it should be setup in the MQTwist configuration and
- | is not in the Characters songbook. More checking could be done to
- | validate it but this works for now.
- /if ( ${Int[${spellName}]} > 20 && ${Int[${spellName}]} < 41 ) {
- /varset songList ${songList} ${spellName}
- | Check that the song is in my book
- } else /if (!${Me.Book[${spellName}]}) {
- /echo I don't have [${spellName}] in my spellbook, playing the melody without it.
- } else {
- | If the song is not memmed, use e3_Casting.inc functions to mem it.
- /if (!${Me.Gem[${spellName}]}) {
- /call argueString gem "${Ini[${Character_Ini},${melodyName} Melody,Song#${i}]}"
- /varset pendingCast ${spellName}
- /varset giveUpTimer 100
- /call memSpell "${Macro.Return}"
- }
- | Update songList with the corresponding gem#
- /varset songList ${songList} ${Me.Gem[${spellName}]}
- }
- }
- /next i
- }
- | If I have a songList, start singing the melody
- /if (${Bool[${songList}]}) {
- | Twist the newly built songList.
- /varset playingMelody TRUE
- /varset songSet ${songList}
- /varset currentMelody ${melodyName}
- /docommand ${ChatToggle} Playing [${melodyName}] melody...
- /twist ${songSet}
- }
- }
- }
- /if (${Debug}) /echo <== EVENT_startMelody -|
- /return
- #EVENT StopMelody "<#1#> End Melody#2#"
- Sub Event_StopMelody(line, ChatSender, eventParms)
- /if (${Debug}) /echo |- EVENT_startMelody ==>
- | -Verify the event
- /call verifyEvent "${ChatSender}" "${line}"
- /varset ChatSender ${Macro.Return.Arg[1,_]}
- | |-----------Valid User----------| |--------Included Bot-----------| |-----------In Zone-------------| |------------In Range------------|
- /if (${Bool[${Macro.Return.Arg[2,_]}]} && ${Bool[${Macro.Return.Arg[3,_]}]} && ${Bool[${Macro.Return.Arg[4,_]}]} && ${Bool[${Macro.Return.Arg[5,_]}]}) {
- /if (${melodyName.Find[ /]}) /varset melodyName ${melodyName.Arg[1, /]}
- /if (${Me.Class.ShortName.Equal[BRD]}) {
- /varset playingMelody FALSE
- /varset songSet
- /varset currentMelody
- /docommand ${ChatToggle} Ending melody.
- /twist end
- }
- }
- /if (${Debug}) /echo <== EVENT_startMelody -|
- /return
- SUB restart_Melody
- /if (${Debug}) /echo |- check_Melody ==>
- /echo Restarting Melody
- /if (!${Me.Casting.ID} && !${Waiting4Rez}) /twist ${songSet}
- /if (${Debug}) /echo <== check_Melody -|
- /RETURN
- Sub BRD_Setup
- /if (${Debug}) /echo |- BRD_Setup ==>
- /declare returnTwist bool outer 0
- /if (!${Defined[currentMelody]}) /declare currentMelody string outer
- /if (!${Defined[playingMelody]}) /declare playingMelody bool global
- /if (!${Defined[songSet]}) /declare songSet string global
- /if (${Bool[${Ini[${Character_Ini},Misc,Default Melody]}]}) /call IniToVar "${Character_Ini},Misc,Default Melody" DefaultMelody string outer
- /if (${DefaultMelody.Length}) {
- /startmelody ${DefaultMelody} /only|ME
- }
- /if (${Debug}) /echo <== BRD_Setup -|
- /return
- Sub BRD_Background_Events
- /doevents saveMelody
- /doevents startMelody
- | Check melody
- /if (!${Bool[${pendingCast}]} && ${playingMelody} && !${Twist.Twisting} && !${Bool[${Me.Casting}]}) /call restart_Melody
- /return
- SUB BRD_MacroSettings
- /if (${Debug}) /echo |- BRD_MacroSettings ==>
- | Adv Settings
- /call WriteToIni "${advSettings_Ini},BRD Functions,BRD Function#1" "check_Burns"
- /call WriteToIni "${advSettings_Ini},BRD Functions,BRD Function#2" "check_CombatBuffs"
- /call WriteToIni "${advSettings_Ini},BRD Functions,BRD Function#3" "check_Buffs"
- /call WriteToIni "${advSettings_Ini},BRD Functions,BRD Function#7" "check_Debuffs"
- /if (${Debug}) /echo <== BRD_MacroSettings -|
- /RETURN
- SUB BRD_CharacterSettings
- /if (${Debug}) /echo |- BRD_CharacterSettings ==>
- /call WriteToIni "${Character_Ini},Misc,Default Melody"
- /if (${Debug}) /echo <== BRD_CharacterSettings -|
- /RETURN
- Sub BRD_Aliases
- /if (${Debug}) /echo |- BRD_Aliases ==>
- /squelch /alias /SaveMelody /echo Save Melody
- /squelch /alias /PlayMelody /bc Melody
- /squelch /alias /StartMelody /bc Melody
- /squelch /alias /stopmelody /bc End Melody
- /squelch /alias /endmelody /bc End Melody
- /if (${Debug}) /echo <== BRD_Aliases -|
- /return
- |----------------------------------------------------|
- |- Bard: Cast debuffs on various assist targets -|
- |----------------------------------------------------|
- SUB cast_bardDebuffs(int spellTarget, string arrayName)
- /if (${Debug} || ${Debug_Assists} || ${Debug_Debuffs}) /echo |- cast_bardDebuffs - [${arrayName}] ==>
- /declare castName string local
- /declare spellName string local
- /declare spellInfo string local
- /declare spellTimer string local
- /declare newTimerSetting int local
- /declare i int local
- /declare overrideDuration int local 0
- /for i 1 to ${${arrayName}.Size}
- /varset overrideDuration 0
- /varset spellInfo ${${arrayName}[${i}]}
- /varset castName ${spellInfo.Arg[1,/]}
- /varset spellName ${If[${FindItemCount[=${castName}]},${FindItem[=${castName}].Spell},${castName}]}
- /varset spellTimer spellTimer_${spellTarget}_${arrayName}-${i}
- /varset newTimerSetting ${Math.Calc[${Spell[${spellName}].Duration} * 60].Int}
- /if (${${spellTimer}}) {
- /if (${Debug} || ${Debug_Assists} || ${Debug_Debuffs}) /echo |- cast_longTermSpells - [${arrayName}] -| Waiting to recast [${castName}].
- } else {
- /if (${Debug} || ${Debug_Assists} || ${Debug_Debuffs}) /echo Validating "${spellTarget}|NULL" "${spellInfo}"
- | If the Debuff Song is in a GEM, add it to the current twist; if its not already in there
- /if (!${Me.Book[${castName}]}) /goto :skipBardDeBuff
- /if (!${Me.Gem[${castName}]} && ${Me.XTarget} ) /goto :skipBardDeBuff
- /if (${songSet.Find[${Me.Gem[${castName}]}]}) /goto :skipBardDeBuff
- /varset songSet ${Me.Gem[${castName}]} ${songSet}
- /twist ${songSet}
- /echo Twisting: ${songSet}
- }
- /if (${ActionTaken} && ${${arrayName}[${i}].Find[/NoActionDelay]}) {
- /varset ActionTaken 0
- }
- :skipBardDeBuff
- /if (!${ActionTaken}) /next i
- /if (${Debug} || ${Debug_Assists} || ${Debug_Debuffs}) /echo <== cast_bardDebuffs - [${arrayName}] -|
- /RETURN
- Sub Bard_Cures_Setup
- /call #CreateVars string outer CheckMember CureTarget CureTargetType CureAction SelectedCureSpell CureWatch Cure_Ini
- /call #CreateVars bool outer AutoCureEnabled
- /call #CreateVars int outer CureCount WatchCount
- /varset Cure_Ini Macro Inis\Cure Data.ini
- /call #IniToArray "${Character_Ini},Cures,Cure#" CureArray
- /call #CreateVars string outer BardPoisonCureGem BardDiseaseCureGem BardCurseCureGem
- /varset BardPoisonCureGem ${Ini[Macro Inis\General Settings.ini,Casting,Default Spell Gem]}
- /varset BardDiseaseCureGem ${Ini[Macro Inis\General Settings.ini,Casting,Default Spell Gem]}
- /varset BardCurseCureGem ${Ini[Macro Inis\General Settings.ini,Casting,Default Spell Gem]}
- /if (${CureArray.Size} > 0) {
- /declare i int local
- /for i 1 to ${CureArray.Size}
- /if (${CureArray[${i}].Find[/gem|]}) {
- /call #argueString gem "${CureArray[${i}]}"
- /if (${CureArray[${i}].Find[Asceticism]}) {
- /varset BardPoisonCureGem ${Macro.Return}
- /varset BardDiseaseCureGem ${Macro.Return}
- } else /if (${CureArray[${i}].Find[Innocence]}) {
- /varset BardCurseCureGem ${Macro.Return}
- }
- }
- /next i
- }
- /varset CureWatch ${Ini[${Character_Ini},Cures,Watch,]}
- /if (${Select[${CureWatch},NULL]}) /varset CureWatch
- /if (${CureWatch.Length} && !${CureWatch.Right[1].Equal[,]}) /varset CureWatch ${CureWatch},
- /if (${CureWatch.Length} && ${CureWatch.Find[ ]}) /varset CureWatch ${CureWatch.Replace[ ,,]}
- /varset WatchCount ${CureWatch.Count[,]}
- /varset CureCount ${CureArray.Size}
- /call BardSetupAutoCure
- /call BardCheckAutoCureEnabled
- /RETURN
- Sub check_Bard_Cures
- /if (!${AutoCureEnabled}) /return
- /call BardAutoCure
- /return
- Sub BardSetupAutoCure
- | Done like this so it can be reloaded on the fly with /autocure reset
- /if (${Ini[${Character_Ini},Cures,Auto Cure].Length}) {
- /call #CreateVars bool outer AutoCure:CharSpecific
- /varset AutoCure:CharSpecific ${Ini[${Character_Ini},Cures,Auto Cure,0]}
- }
- /call #CreateVars bool outer AutoCure:Global
- /varset AutoCure:Global ${Ini[${genSettings_Ini},Cures,Auto Cure,0]}
- /return
- Sub BardCheckAutoCureEnabled
- /if (!${CureCount}) {
- /varset AutoCureEnabled 0
- /return
- }
- /if (${Defined[AutoCure:CharSpecific]}) {
- /varset AutoCureEnabled ${AutoCure:CharSpecific}
- } else {
- /varset AutoCureEnabled ${AutoCure:Global}
- }
- /return
- #Event BardSetAutoCure "<#1#> BardAutoCure #2#"
- Sub Event_BardSetAutoCure(line, chatSender, args)
- /if (!${Me.Class.ShortName.Equal[BRD]}) /return
- /call #verifyEvent "${chatSender}" "${line}"
- /if (!${Macro.Return}) /return
- /call #CreateVars string outer AutoCureReturn AutoCureInclusionParams
- /call #SplitInclusionArgs "${args}" AutoCureReturn AutoCureInclusionParams
- /if (${Select[${AutoCureReturn},yes,on,1,true]}) {
- /call #DeleteVars AutoCure:CharSpecific
- /varset AutoCure:Global 1
- } else /if (${Select[${AutoCureReturn},off,0,no,false]}) {
- /call #DeleteVars AutoCure:CharSpecific
- /varset AutoCure:Global 0
- } else /if (${Select[${AutoCureReturn},reset,default]}) {
- /call BardSetupAutoCure
- }
- /call BardCheckAutoCureEnabled
- /bc AutoCureEnabled: ${AutoCureEnabled}
- /return
- Sub BardAutoCure
- /varset CureTarget
- /varset CheckMember
- /declare BardGroupMemberCtr int local 0
- /declare CurrentTwist string local ${Twist.List}
- /for BardGroupMemberCtr 0 to ${Group}
- /varset CheckMember ${Group.Member[${BardGroupMemberCtr}].CleanName}
- /if ( ${NetBots[${CheckMember}].CurableCount} ) {
- /if ( ${NetBots[${CheckMember}].PoisonCount} ) {
- /call Bard_DoCure "Poison" "${NetBots[${CheckMember}].ID}" "${CheckMember}"
- } else /if (${NetBots[${CheckMember}].DiseaseCount}) {
- /call Bard_DoCure "Disease" "${NetBots[${CheckMember}].ID}" "${CheckMember}"
- } else /if (${NetBots[${CheckMember}].CurseCount}) {
- /call Bard_DoCure "Curse" "${NetBots[${CheckMember}].ID}" "${CheckMember}"
- }
- }
- /next BardGroupMemberCtr
- /if (${CurrentTwist.Length}) {
- /if (${Twist.List} != ${CurrentTwist}) {
- /twist ${CurrentTwist}
- }
- }
- /return
- Sub Bard_DoCure(string cureType, string myTargetID, string myTargetName)
- /declare castName string local
- /declare castGem int local 0
- /if (${cureType.Equal[Poison]}) {
- /varset castName "Aria of Asceticism"
- /varset castGem ${BardPoisonCureGem}
- } else /if (${cureType.Equal[Disease]}) {
- /varset castName "Aria of Asceticism"
- /varset castGem ${BardDiseaseCureGem}
- } else /if (${cureType.Equal[Curse]}) {
- /varset castName "Aria of Innocence"
- /varset castGem ${BardCurseCureGem}
- }
- /declare curing bool local FALSE
- |Turn current Twisting Off
- /twist off
- |Get the Target
- /call TrueTarget ${myTargetID}
- :BardNotYetCured
- |Check to see if the Cure Song is Memorized; find the Gem if it is.
- /if ( ${Bool[${Me.Gem[${castName}]}]} ) {
- /varset castGem ${Me.Gem[${castName}]}
- } else {
- /if ( ${Bool[${Me.Book[${castName}]}]} ) {
- |/varset castGem ${Ini[Macro Inis\General Settings.ini,Casting,Default Spell Gem]}
- /memorize ${castName}|${castGem}
- /delay 1s ${Me.Sitting}
- /delay 3s !${Me.Sitting}
- } else {
- /bc Missing: ${castName} Unable to Cure: ${myTargetName} Disabling AutoCure for this BARD.
- /varset AutoCureEnabled FALSE
- /return
- }
- }
- | If Target is too far away; return.
- /if ( ${Target.Distance} > ${Me.Gem[${castGem}].Range} ) /return
- | Start the Curing Song.
- /if (!${curing}) {
- /twist ${castGem}
- /varset curing TRUE
- }
- /if (${cureType.Equal[Poison]}) {
- /if ( ${NetBots[${myTargetName}].PoisonCount} ) /goto :BardNotYetCured
- } else /if (${cureType.Equal[Disease]}) {
- /if ( ${NetBots[${myTargetName}].DiseaseCount} ) /goto :BardNotYetCured
- } else /if (${cureType.Equal[Curse]}) {
- /if ( ${NetBots[${myTargetName}].CurseCount} ) /goto :BardNotYetCured
- }
- /return
- Sub Bard_Cures_Background_Events
- /return
- Sub Bard_Cures_CharacterSettings
- /if (${Me.Class.ShortName.Equal[BRD]}) {
- /call WriteToIni "${Character_Ini},Cures,Auto Cure" On
- /call WriteToIni "${Character_Ini},Cures,Cure#1" "Aria of Innocence/Gem|4"
- /call WriteToIni "${Character_Ini},Cures,Cure#2" "Aria of Asceticism/Gem|4"
- /call WriteToIni "${Character_Ini},Cures,Watch"
- }
- /return
- Sub Bard_Cures_MacroSettings
- /return
- Sub Bard_Cures_Aliases
- /alias /autocure /bc BardAutoCure
- /return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement