Advertisement
Guest User

Untitled

a guest
May 25th, 2015
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.33 KB | None | 0 0
  1. |------------------------------------------------------------------------|
  2. |- e3_Classes_Bard.inc v3.0 ( originally designed to work with e3.mac ) -|
  3. |- Written by Killians of PEQ -|
  4. |------------------------------------------------------------------------|
  5. |- Contains Bard specific functions related to, -|
  6. |- Setup and Ini entry information -|
  7. |- MainLoop, and AssistLoop hooks -|
  8. |- Over-all functionality / flow -|
  9. |------------------------------------------------------------------------|
  10.  
  11. #event saveMelody "<#1#> Save Melody #2# #3#"
  12. SUB EVENT_saveMelody(line, ChatSender, melodyName, songsToSave)
  13. /if (${Debug}) /echo |- EVENT_saveMelody ==>
  14.  
  15. | If no ChatSender is defined, make one.
  16. /if (!${Defined[ChatSender]}) /declare ChatSender string local ${Me.CleanName}
  17.  
  18. | If I'm the ChatSender.
  19. /if (${ChatSender.Equal[${Me.CleanName}]}) {
  20.  
  21. /declare i int local
  22.  
  23. | Check if the melody already exists, and should not be overwritten.
  24. /if (${Ini[${Character_Ini},${melodyName} Melody].Length}) {
  25. /if (${Debug}) /echo |- EVENT_saveMelody -| Overwriting [${melodyName}] melody...
  26. /for i 1 to 5
  27. /if (${Ini[${Character_Ini},${melodyName} Melody,Song#${i}].Length}) /call WriteToIni "${Character_Ini},${melodyName} Melody,Song#${i}" *PLACEHOLDER 1
  28. /next i
  29. }
  30.  
  31. /echo Saving [${melodyName}] melody...
  32.  
  33. /varset i 1
  34.  
  35. :check_nextSong
  36.  
  37. | If the gem number is not recognized
  38. /if (!${Int[${songsToSave.Arg[${i}, ]}]} || ${Int[${songsToSave.Arg[${i}, ]}]} < 1 || ${Int[${songsToSave.Arg[${i}, ]}]} > 9) {
  39. /if (${songsToSave.Arg[${i}, ].NotEqual[-Overwrite]}) {
  40. /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
  41. }
  42. } else {
  43. /echo Song#${i}=${Me.Gem[${songsToSave.Arg[${i}, ]}]}/gem|${songsToSave.Arg[${i}, ]}
  44. /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]}
  45. }
  46. /varcalc i ${i} + 1
  47. /if (${songsToSave.Arg[${i}, ].Length}) /goto :check_nextSong
  48. }
  49.  
  50. /if (${Debug}) /echo <== EVENT_saveMelody -|
  51. /return
  52.  
  53. #EVENT startMelody "<#1#> Melody #2#"
  54. SUB EVENT_startMelody(line, ChatSender, melodyName)
  55. /if (${Debug}) /echo |- EVENT_startMelody ==>
  56.  
  57. | -Verify the event
  58. /call verifyEvent "${ChatSender}" "${line}"
  59. /varset ChatSender ${Macro.Return.Arg[1,_]}
  60. | |-----------Valid User----------| |--------Included Bot-----------| |-----------In Zone-------------| |------------In Range------------|
  61. /if (${Bool[${Macro.Return.Arg[2,_]}]} && ${Bool[${Macro.Return.Arg[3,_]}]} && ${Bool[${Macro.Return.Arg[4,_]}]} && ${Bool[${Macro.Return.Arg[5,_]}]}) {
  62.  
  63. /if (${melodyName.Find[ /]}) /varset melodyName ${melodyName.Arg[1, /]}
  64.  
  65. /if (${Me.Class.ShortName.Equal[BRD]}) {
  66. | If I don't have the melodyName listed in my ini.
  67. /if (!${Ini[${Character_Ini},${melodyName} Melody,Song#1].Length}) {
  68. | If Stop, end, or pause were used, stop the melody.
  69. /if (${Select[${melodyName},Stop,End,Pause]}) {
  70. /varset playingMelody FALSE
  71. /varset songSet
  72.  
  73. /docommand ${ChatToggle} Ending melody.
  74. /twist end
  75. } else {
  76. /docommand ${ChatToggle} [${melodyName}] is not a known melody.
  77. }
  78. } else {
  79. /declare songList string local
  80. /declare retryTimer timer local 100
  81. /declare spellName string local
  82. /declare i int local
  83.  
  84. | For 1 to 5 (maximum melody size)
  85. /for i 1 to 10
  86.  
  87. /if (${Ini[${Character_Ini},${melodyName} Melody,Song#${i}].Length} && ${Ini[${Character_Ini},${melodyName} Melody,Song#${i}].NotEqual[PLACEHOLDER]}) {
  88.  
  89. /call validateCast "0|NULL" "${Ini[${Character_Ini},${melodyName} Melody,Song#${i}]}"
  90. /if (!${Macro.Return}) /next i
  91.  
  92. /varset spellName ${Ini[${Character_Ini},${melodyName} Melody,Song#${i}].Arg[1,/]}
  93. | If the Song is 21-40 it should be setup in the MQTwist configuration and
  94. | is not in the Characters songbook. More checking could be done to
  95. | validate it but this works for now.
  96. /if ( ${Int[${spellName}]} > 20 && ${Int[${spellName}]} < 41 ) {
  97. /varset songList ${songList} ${spellName}
  98.  
  99. | Check that the song is in my book
  100. } else /if (!${Me.Book[${spellName}]}) {
  101. /echo I don't have [${spellName}] in my spellbook, playing the melody without it.
  102. } else {
  103. | If the song is not memmed, use e3_Casting.inc functions to mem it.
  104. /if (!${Me.Gem[${spellName}]}) {
  105. /call argueString gem "${Ini[${Character_Ini},${melodyName} Melody,Song#${i}]}"
  106. /varset pendingCast ${spellName}
  107. /varset giveUpTimer 100
  108. /call memSpell "${Macro.Return}"
  109. }
  110. | Update songList with the corresponding gem#
  111. /varset songList ${songList} ${Me.Gem[${spellName}]}
  112. }
  113. }
  114. /next i
  115. }
  116. | If I have a songList, start singing the melody
  117. /if (${Bool[${songList}]}) {
  118. | Twist the newly built songList.
  119. /varset playingMelody TRUE
  120. /varset songSet ${songList}
  121. /varset currentMelody ${melodyName}
  122. /docommand ${ChatToggle} Playing [${melodyName}] melody...
  123. /twist ${songSet}
  124. }
  125. }
  126. }
  127. /if (${Debug}) /echo <== EVENT_startMelody -|
  128. /return
  129.  
  130. #EVENT StopMelody "<#1#> End Melody#2#"
  131. Sub Event_StopMelody(line, ChatSender, eventParms)
  132. /if (${Debug}) /echo |- EVENT_startMelody ==>
  133.  
  134. | -Verify the event
  135. /call verifyEvent "${ChatSender}" "${line}"
  136. /varset ChatSender ${Macro.Return.Arg[1,_]}
  137. | |-----------Valid User----------| |--------Included Bot-----------| |-----------In Zone-------------| |------------In Range------------|
  138. /if (${Bool[${Macro.Return.Arg[2,_]}]} && ${Bool[${Macro.Return.Arg[3,_]}]} && ${Bool[${Macro.Return.Arg[4,_]}]} && ${Bool[${Macro.Return.Arg[5,_]}]}) {
  139.  
  140. /if (${melodyName.Find[ /]}) /varset melodyName ${melodyName.Arg[1, /]}
  141.  
  142. /if (${Me.Class.ShortName.Equal[BRD]}) {
  143. /varset playingMelody FALSE
  144. /varset songSet
  145. /varset currentMelody
  146. /docommand ${ChatToggle} Ending melody.
  147. /twist end
  148. }
  149. }
  150. /if (${Debug}) /echo <== EVENT_startMelody -|
  151. /return
  152.  
  153.  
  154. SUB restart_Melody
  155. /if (${Debug}) /echo |- check_Melody ==>
  156. /echo Restarting Melody
  157. /if (!${Me.Casting.ID} && !${Waiting4Rez}) /twist ${songSet}
  158.  
  159. /if (${Debug}) /echo <== check_Melody -|
  160. /RETURN
  161.  
  162.  
  163.  
  164. Sub BRD_Setup
  165. /if (${Debug}) /echo |- BRD_Setup ==>
  166.  
  167. /declare returnTwist bool outer 0
  168.  
  169. /if (!${Defined[currentMelody]}) /declare currentMelody string outer
  170. /if (!${Defined[playingMelody]}) /declare playingMelody bool global
  171. /if (!${Defined[songSet]}) /declare songSet string global
  172.  
  173. /if (${Bool[${Ini[${Character_Ini},Misc,Default Melody]}]}) /call IniToVar "${Character_Ini},Misc,Default Melody" DefaultMelody string outer
  174.  
  175. /if (${DefaultMelody.Length}) {
  176. /startmelody ${DefaultMelody} /only|ME
  177. }
  178. /if (${Debug}) /echo <== BRD_Setup -|
  179. /return
  180.  
  181.  
  182.  
  183. Sub BRD_Background_Events
  184.  
  185. /doevents saveMelody
  186. /doevents startMelody
  187.  
  188. | Check melody
  189. /if (!${Bool[${pendingCast}]} && ${playingMelody} && !${Twist.Twisting} && !${Bool[${Me.Casting}]}) /call restart_Melody
  190.  
  191. /return
  192.  
  193.  
  194.  
  195. SUB BRD_MacroSettings
  196. /if (${Debug}) /echo |- BRD_MacroSettings ==>
  197.  
  198. | Adv Settings
  199. /call WriteToIni "${advSettings_Ini},BRD Functions,BRD Function#1" "check_Burns"
  200. /call WriteToIni "${advSettings_Ini},BRD Functions,BRD Function#2" "check_CombatBuffs"
  201. /call WriteToIni "${advSettings_Ini},BRD Functions,BRD Function#3" "check_Buffs"
  202. /call WriteToIni "${advSettings_Ini},BRD Functions,BRD Function#7" "check_Debuffs"
  203.  
  204. /if (${Debug}) /echo <== BRD_MacroSettings -|
  205. /RETURN
  206.  
  207.  
  208.  
  209. SUB BRD_CharacterSettings
  210. /if (${Debug}) /echo |- BRD_CharacterSettings ==>
  211. /call WriteToIni "${Character_Ini},Misc,Default Melody"
  212.  
  213. /if (${Debug}) /echo <== BRD_CharacterSettings -|
  214. /RETURN
  215.  
  216.  
  217.  
  218. Sub BRD_Aliases
  219. /if (${Debug}) /echo |- BRD_Aliases ==>
  220.  
  221. /squelch /alias /SaveMelody /echo Save Melody
  222. /squelch /alias /PlayMelody /bc Melody
  223. /squelch /alias /StartMelody /bc Melody
  224. /squelch /alias /stopmelody /bc End Melody
  225. /squelch /alias /endmelody /bc End Melody
  226.  
  227. /if (${Debug}) /echo <== BRD_Aliases -|
  228. /return
  229.  
  230. |----------------------------------------------------|
  231. |- Bard: Cast debuffs on various assist targets -|
  232. |----------------------------------------------------|
  233. SUB cast_bardDebuffs(int spellTarget, string arrayName)
  234. /if (${Debug} || ${Debug_Assists} || ${Debug_Debuffs}) /echo |- cast_bardDebuffs - [${arrayName}] ==>
  235.  
  236. /declare castName string local
  237. /declare spellName string local
  238. /declare spellInfo string local
  239.  
  240. /declare spellTimer string local
  241. /declare newTimerSetting int local
  242.  
  243. /declare i int local
  244.  
  245. /declare overrideDuration int local 0
  246.  
  247. /for i 1 to ${${arrayName}.Size}
  248. /varset overrideDuration 0
  249. /varset spellInfo ${${arrayName}[${i}]}
  250. /varset castName ${spellInfo.Arg[1,/]}
  251. /varset spellName ${If[${FindItemCount[=${castName}]},${FindItem[=${castName}].Spell},${castName}]}
  252. /varset spellTimer spellTimer_${spellTarget}_${arrayName}-${i}
  253. /varset newTimerSetting ${Math.Calc[${Spell[${spellName}].Duration} * 60].Int}
  254.  
  255. /if (${${spellTimer}}) {
  256. /if (${Debug} || ${Debug_Assists} || ${Debug_Debuffs}) /echo |- cast_longTermSpells - [${arrayName}] -| Waiting to recast [${castName}].
  257. } else {
  258.  
  259. /if (${Debug} || ${Debug_Assists} || ${Debug_Debuffs}) /echo Validating "${spellTarget}|NULL" "${spellInfo}"
  260.  
  261. | If the Debuff Song is in a GEM, add it to the current twist; if its not already in there
  262. /if (!${Me.Book[${castName}]}) /goto :skipBardDeBuff
  263. /if (!${Me.Gem[${castName}]} && ${Me.XTarget} ) /goto :skipBardDeBuff
  264. /if (${songSet.Find[${Me.Gem[${castName}]}]}) /goto :skipBardDeBuff
  265.  
  266. /varset songSet ${Me.Gem[${castName}]} ${songSet}
  267. /twist ${songSet}
  268. /echo Twisting: ${songSet}
  269. }
  270. /if (${ActionTaken} && ${${arrayName}[${i}].Find[/NoActionDelay]}) {
  271. /varset ActionTaken 0
  272. }
  273. :skipBardDeBuff
  274. /if (!${ActionTaken}) /next i
  275.  
  276.  
  277. /if (${Debug} || ${Debug_Assists} || ${Debug_Debuffs}) /echo <== cast_bardDebuffs - [${arrayName}] -|
  278. /RETURN
  279.  
  280.  
  281. Sub Bard_Cures_Setup
  282.  
  283. /call #CreateVars string outer CheckMember CureTarget CureTargetType CureAction SelectedCureSpell CureWatch Cure_Ini
  284. /call #CreateVars bool outer AutoCureEnabled
  285. /call #CreateVars int outer CureCount WatchCount
  286.  
  287. /varset Cure_Ini Macro Inis\Cure Data.ini
  288.  
  289. /call #IniToArray "${Character_Ini},Cures,Cure#" CureArray
  290.  
  291. /call #CreateVars string outer BardPoisonCureGem BardDiseaseCureGem BardCurseCureGem
  292. /varset BardPoisonCureGem ${Ini[Macro Inis\General Settings.ini,Casting,Default Spell Gem]}
  293. /varset BardDiseaseCureGem ${Ini[Macro Inis\General Settings.ini,Casting,Default Spell Gem]}
  294. /varset BardCurseCureGem ${Ini[Macro Inis\General Settings.ini,Casting,Default Spell Gem]}
  295.  
  296. /if (${CureArray.Size} > 0) {
  297. /declare i int local
  298. /for i 1 to ${CureArray.Size}
  299. /if (${CureArray[${i}].Find[/gem|]}) {
  300. /call #argueString gem "${CureArray[${i}]}"
  301. /if (${CureArray[${i}].Find[Asceticism]}) {
  302. /varset BardPoisonCureGem ${Macro.Return}
  303. /varset BardDiseaseCureGem ${Macro.Return}
  304. } else /if (${CureArray[${i}].Find[Innocence]}) {
  305. /varset BardCurseCureGem ${Macro.Return}
  306. }
  307. }
  308. /next i
  309. }
  310.  
  311. /varset CureWatch ${Ini[${Character_Ini},Cures,Watch,]}
  312. /if (${Select[${CureWatch},NULL]}) /varset CureWatch
  313. /if (${CureWatch.Length} && !${CureWatch.Right[1].Equal[,]}) /varset CureWatch ${CureWatch},
  314. /if (${CureWatch.Length} && ${CureWatch.Find[ ]}) /varset CureWatch ${CureWatch.Replace[ ,,]}
  315. /varset WatchCount ${CureWatch.Count[,]}
  316.  
  317. /varset CureCount ${CureArray.Size}
  318.  
  319. /call BardSetupAutoCure
  320. /call BardCheckAutoCureEnabled
  321.  
  322. /RETURN
  323.  
  324. Sub check_Bard_Cures
  325.  
  326. /if (!${AutoCureEnabled}) /return
  327. /call BardAutoCure
  328.  
  329. /return
  330.  
  331. Sub BardSetupAutoCure
  332. | Done like this so it can be reloaded on the fly with /autocure reset
  333. /if (${Ini[${Character_Ini},Cures,Auto Cure].Length}) {
  334. /call #CreateVars bool outer AutoCure:CharSpecific
  335. /varset AutoCure:CharSpecific ${Ini[${Character_Ini},Cures,Auto Cure,0]}
  336. }
  337. /call #CreateVars bool outer AutoCure:Global
  338. /varset AutoCure:Global ${Ini[${genSettings_Ini},Cures,Auto Cure,0]}
  339. /return
  340.  
  341. Sub BardCheckAutoCureEnabled
  342. /if (!${CureCount}) {
  343. /varset AutoCureEnabled 0
  344. /return
  345. }
  346. /if (${Defined[AutoCure:CharSpecific]}) {
  347. /varset AutoCureEnabled ${AutoCure:CharSpecific}
  348. } else {
  349. /varset AutoCureEnabled ${AutoCure:Global}
  350. }
  351. /return
  352.  
  353. #Event BardSetAutoCure "<#1#> BardAutoCure #2#"
  354. Sub Event_BardSetAutoCure(line, chatSender, args)
  355.  
  356. /if (!${Me.Class.ShortName.Equal[BRD]}) /return
  357.  
  358. /call #verifyEvent "${chatSender}" "${line}"
  359. /if (!${Macro.Return}) /return
  360.  
  361. /call #CreateVars string outer AutoCureReturn AutoCureInclusionParams
  362. /call #SplitInclusionArgs "${args}" AutoCureReturn AutoCureInclusionParams
  363.  
  364. /if (${Select[${AutoCureReturn},yes,on,1,true]}) {
  365. /call #DeleteVars AutoCure:CharSpecific
  366. /varset AutoCure:Global 1
  367. } else /if (${Select[${AutoCureReturn},off,0,no,false]}) {
  368. /call #DeleteVars AutoCure:CharSpecific
  369. /varset AutoCure:Global 0
  370. } else /if (${Select[${AutoCureReturn},reset,default]}) {
  371. /call BardSetupAutoCure
  372. }
  373. /call BardCheckAutoCureEnabled
  374. /bc AutoCureEnabled: ${AutoCureEnabled}
  375. /return
  376.  
  377. Sub BardAutoCure
  378.  
  379. /varset CureTarget
  380. /varset CheckMember
  381.  
  382. /declare BardGroupMemberCtr int local 0
  383. /declare CurrentTwist string local ${Twist.List}
  384.  
  385. /for BardGroupMemberCtr 0 to ${Group}
  386. /varset CheckMember ${Group.Member[${BardGroupMemberCtr}].CleanName}
  387.  
  388. /if ( ${NetBots[${CheckMember}].CurableCount} ) {
  389. /if ( ${NetBots[${CheckMember}].PoisonCount} ) {
  390. /call Bard_DoCure "Poison" "${NetBots[${CheckMember}].ID}" "${CheckMember}"
  391. } else /if (${NetBots[${CheckMember}].DiseaseCount}) {
  392. /call Bard_DoCure "Disease" "${NetBots[${CheckMember}].ID}" "${CheckMember}"
  393. } else /if (${NetBots[${CheckMember}].CurseCount}) {
  394. /call Bard_DoCure "Curse" "${NetBots[${CheckMember}].ID}" "${CheckMember}"
  395. }
  396. }
  397.  
  398. /next BardGroupMemberCtr
  399.  
  400. /if (${CurrentTwist.Length}) {
  401. /if (${Twist.List} != ${CurrentTwist}) {
  402. /twist ${CurrentTwist}
  403. }
  404. }
  405. /return
  406.  
  407. Sub Bard_DoCure(string cureType, string myTargetID, string myTargetName)
  408.  
  409. /declare castName string local
  410. /declare castGem int local 0
  411.  
  412. /if (${cureType.Equal[Poison]}) {
  413. /varset castName "Aria of Asceticism"
  414. /varset castGem ${BardPoisonCureGem}
  415. } else /if (${cureType.Equal[Disease]}) {
  416. /varset castName "Aria of Asceticism"
  417. /varset castGem ${BardDiseaseCureGem}
  418. } else /if (${cureType.Equal[Curse]}) {
  419. /varset castName "Aria of Innocence"
  420. /varset castGem ${BardCurseCureGem}
  421. }
  422.  
  423.  
  424. /declare curing bool local FALSE
  425.  
  426. |Turn current Twisting Off
  427. /twist off
  428.  
  429. |Get the Target
  430. /call TrueTarget ${myTargetID}
  431.  
  432. :BardNotYetCured
  433.  
  434. |Check to see if the Cure Song is Memorized; find the Gem if it is.
  435. /if ( ${Bool[${Me.Gem[${castName}]}]} ) {
  436. /varset castGem ${Me.Gem[${castName}]}
  437. } else {
  438. /if ( ${Bool[${Me.Book[${castName}]}]} ) {
  439. |/varset castGem ${Ini[Macro Inis\General Settings.ini,Casting,Default Spell Gem]}
  440.  
  441. /memorize ${castName}|${castGem}
  442. /delay 1s ${Me.Sitting}
  443. /delay 3s !${Me.Sitting}
  444. } else {
  445. /bc Missing: ${castName} Unable to Cure: ${myTargetName} Disabling AutoCure for this BARD.
  446. /varset AutoCureEnabled FALSE
  447. /return
  448. }
  449. }
  450.  
  451. | If Target is too far away; return.
  452. /if ( ${Target.Distance} > ${Me.Gem[${castGem}].Range} ) /return
  453.  
  454. | Start the Curing Song.
  455. /if (!${curing}) {
  456. /twist ${castGem}
  457. /varset curing TRUE
  458. }
  459.  
  460. /if (${cureType.Equal[Poison]}) {
  461. /if ( ${NetBots[${myTargetName}].PoisonCount} ) /goto :BardNotYetCured
  462. } else /if (${cureType.Equal[Disease]}) {
  463. /if ( ${NetBots[${myTargetName}].DiseaseCount} ) /goto :BardNotYetCured
  464. } else /if (${cureType.Equal[Curse]}) {
  465. /if ( ${NetBots[${myTargetName}].CurseCount} ) /goto :BardNotYetCured
  466. }
  467.  
  468. /return
  469.  
  470.  
  471. Sub Bard_Cures_Background_Events
  472. /return
  473.  
  474. Sub Bard_Cures_CharacterSettings
  475.  
  476. /if (${Me.Class.ShortName.Equal[BRD]}) {
  477. /call WriteToIni "${Character_Ini},Cures,Auto Cure" On
  478. /call WriteToIni "${Character_Ini},Cures,Cure#1" "Aria of Innocence/Gem|4"
  479. /call WriteToIni "${Character_Ini},Cures,Cure#2" "Aria of Asceticism/Gem|4"
  480. /call WriteToIni "${Character_Ini},Cures,Watch"
  481. }
  482.  
  483. /return
  484.  
  485. Sub Bard_Cures_MacroSettings
  486. /return
  487.  
  488. Sub Bard_Cures_Aliases
  489. /alias /autocure /bc BardAutoCure
  490. /return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement