Advertisement
Guest User

WHMchan.lua

a guest
Nov 24th, 2014
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.56 KB | None | 0 0
  1. -- load bem utils!
  2. include('bem-utils.lua')
  3.  
  4.  
  5. --adding spell groupings for groupiness sake
  6. naSpells = S{"Paralyna","Silena","Viruna","Stona","Blindna","Poisona"}
  7. resSpells = S{"Barstonra","Barwatera","Baraera","Barfira","Barblizzara","Barthundra","Barstone","Barwater","Baraero","Barfire","Barblizzard","Barthunder"}
  8. fastspells = S{"Haste","Refresh","Teleport-Mea","Teleport-Holla","Teleport-Dem","Teleport-Vazhl",
  9. "Teleport-Yhoat","Teleport-Altep","Recall-Pashh","Warp","Warp II","Recall-Jugner","Recall-Meriph","Sneak","Invisible"}
  10.  
  11. -- define gear sets
  12. function get_sets()
  13. -- core sets: used as base sets to be combined together in more specific conditions
  14. sets.idle = {
  15. ammo="Impatiens",
  16. head="Gendewitha Caubeen",
  17. neck="Twilight Torque",
  18. ear1="Lifestorm Earring",
  19. ear2="Moonshade Earring",
  20. body="Gendewitha Bliaut",
  21. hands="Serpentes Cuffs",
  22. ring1="Jelly Ring",--ahmagad NEED DARK RINGS JEBUS
  23. ring2="Mediator's Ring",
  24. back="Cheviot Cape",
  25. legs="Theophany Pantaloons",
  26. feet="Serpentes Sabots"
  27. }
  28.  
  29. sets.resting = set_combine(sets.idle,{
  30. main="Chatoyant Staff",
  31. ear1="Antivenom Earring",
  32. ear2="Relaxing Earring",
  33. waist="Hierarch Belt",
  34. back="Vita Cape"})
  35.  
  36. sets.dt = {
  37. ammo="Demonry Stone",
  38. neck="Twilight Torque",
  39. ring1="Dark Ring",
  40. ring2="Dark Ring",
  41. hands="Theophany Mitts +1",
  42. feet="Piety Duckbills +1"
  43. }
  44.  
  45. sets.haste = {
  46. head="Xux Hat",--replace with Nahtirah (also 10%FC)
  47. waist="Swift Belt",
  48. body="Artsieq Jubbah"--will get soon
  49. }
  50.  
  51. -- combine dt and haste with fastcast for less ouch and decent recasts
  52. --FC caps at 80%? bg wiki confuses me. current set has 21% and 3 instacast items.
  53. sets.fastcast = set_combine(sets.dt,sets.haste,{
  54. ammo="Impatiens",--insta
  55. ear1="Loquacious Earring",--FC 2%
  56. hands="Gendewitha Gages",--FC 7, CCT 2%
  57. back="Ogapepo Cape",--insta
  58. legs="Orvail Pants",--FC 5%
  59. waist="Witful Belt",--FC 3% and insta
  60. feet="Chelona Boots",--FC 4%
  61. ring1="Prolix Ring",--do not have, 2%
  62. neck="Orinmula's Torque"--do not have, meebles saur boss, 5%
  63. })
  64.  
  65. --fastcast specific to cures, cure cast down stacks w/fastcast additively
  66. --/sch 10%, merits 20% sch: 94 lol, rdm 84.
  67. sets.curefast = set_combine(sets.fastcast,{
  68. back="Pahtli Cape",--CCT 8%
  69. body="Nefer Kalasiris",--CCT 10%
  70. feet="Cure Clogs", --CCT 15% (sell these once i get prolix and nahtirah)
  71. head="Theophany Cap +1",--CCT 5%
  72. legs="Orison Pantaloons +2"})--12%
  73.  
  74. sets.healingfast = set_combine(sets.fastcast,{
  75. legs="Orison Pantaloons +2"})
  76.  
  77. sets.travel = set_combine(sets.idle,{
  78. legs="Tatsumaki sitagoromo"})
  79.  
  80. --for spells where potency isnt important
  81. sets.conserve = set_combine(sets.fastcast,{
  82. ear1="Magnetic Earring",
  83. ear2="Gifted Earring",
  84. ammo="Clarus Stone",
  85. back="Vita Cape",--do not have
  86. head="Artsieq Hat",--do not have
  87. main="Seveneyes"--do not have
  88. })
  89.  
  90. -- cure potency gear (50%, 61 heal, enm -31, cMP 8)
  91. sets.cure_potency = {
  92. main="Tamaxchi", --cure pot 22
  93. sub="Genbu's Shield", --not augmented
  94. ammo="Clarus Stone",
  95. head="Gendewitha Caubeen",-- cure pot 18, enm -8
  96. neck="Colossus's Torque",--7 heal
  97. body="Orison Bliaud +2",--20 heal
  98. hands="Theophany Mitts +1",--17 heal, enm -5
  99. ring1="Ephedra Ring",--7 heal
  100. ring2="Sirona's Ring",--10 heal
  101. ear1="Magnetic Earring",
  102. ear2="Novia Earring",--enm -7
  103. back="Mending Cape", --enm -6
  104. legs="Orison Pantaloons +2",
  105. waist="Pythia Sash", --do not have
  106. feet="Piety Duckbills +1" --cure pot 10, enm -5
  107. }
  108.  
  109. --healing skill meh on curaga and no bliaud bonus, focusing on -enmity (-44 with set combine)
  110. sets.curaga = set_combine(sets.cure_potency,{
  111. body="Gendewitha bliaut",
  112. neck="Lasaia Pendant",--enm -8
  113. ring1="Mediator's Ring"})--enm -5
  114.  
  115. sets.erasenas = set_combine(sets.fastcast,{
  116. head="Orison Cap +2",
  117. legs="Orison Pantaloons +2"})
  118.  
  119. sets.doom = set_combine(sets.cure_potency,{
  120. legs="Theophany Pantaloons",
  121. feet="Gendewitha Galoshes", --by the way, galoshes is almost as awesome a word as pantaloons
  122. head="Orison Cap +2"})
  123.  
  124. -- enhancing magic skill
  125. sets.enhancing = {
  126. head="Orison Cap +2",
  127. neck="Colossus's Torque",
  128. grip="Fulcio Grip",
  129. back="Merciful Cape",
  130. waist="Olympus Sash",
  131. legs="Piety Pantaloons",
  132. feet="Orison Duckbills +2",
  133. head="Nabu's Tiara",
  134. main="Beneficus"
  135. }
  136.  
  137. -- regen, not like i cast it on whm because the duration makes me weep but hey
  138. sets.regen = set_combine(sets.enhancing,{
  139. hands="Orison Mitts +2",
  140. legs="Theophany Pantaloons",
  141. body="Cleric's Bliault"})
  142.  
  143. sets.protshell = set_combine(sets.conserve,{
  144. feet="Piety Duckbills +1",
  145. legs="Piety Pantaloons"
  146. })
  147.  
  148. sets.bar = set_combine(sets.enhancing,{
  149. body="Orison Bliaud +2",
  150. hands="Orison Mitts +2"})
  151.  
  152. -- stoneskin potency gear
  153. sets.ss_potency = {
  154. neck="Stone Gorget",
  155. ear2="Earthcry Earring",
  156. legs="Haven Hose"
  157. }
  158.  
  159. -- generic enfeebling/m.acc gear 276 macc, 29 enf
  160. sets.enfeeb = {
  161. main="Lehbrailg +2",--macc 228
  162. ear1="Lifestorm Earring",--macc 12 mnd 4
  163. ear2="Psystorm Earring",
  164. head="Buremte Hat",--macc 15 mnd 24
  165. neck="Weike Torque",--macc 2 enf 7
  166. body="Gendewitha Bliaut",--artsieq base is 10, 30 upgraded
  167. hands="Piety Mitts",--enfeeb 20
  168. ring1="Mediator's Ring", --macc 4
  169. ring2="Balrahn's Ring",--macc 4
  170. waist="Ovate Rope",--don't have yet
  171. legs="Orvail Pants", --artsieq hose
  172. feet="Piety Duckbills +1",--enf 17 mnd 19
  173. back="Ogapepo Cape",--macc 10
  174. grip="Mephitis Grip",--macc 5 enf 5
  175. ammo="Kalboron Stone"--macc 4, dont have
  176. }
  177.  
  178. -- generic mab gear
  179. sets.mab = {
  180. main="Lehbrailg +2",
  181. sub="Zuuxowu Grip",
  182. ammo="Dosis Tathlum",
  183. head="Buremte Hat",
  184. neck="Stoicheion Medal",
  185. ear1="Hecate's Earring",
  186. ear2="Friomisi Earring",
  187. hands="Otomi Gloves",
  188. ring1="Icesoul Ring",
  189. ring2="Icesoul Ring",
  190. back="Toro Cape",
  191. waist="Aswang Sash",
  192. }
  193.  
  194. --divine gear, should prob look into mnd and not set combine
  195. sets.divine = set_combine(sets.mab,{
  196. hands="Piety Mitts",
  197. legs="Theophany Pantaloons"
  198. })
  199.  
  200. --should update at some point for aspir/drain
  201. sets.dark = {}
  202.  
  203. -- sets only used for precast
  204. sets.precast = {}
  205.  
  206. -- weapon skills
  207. --i'll work on this eventually. but probably getting rid of realmrazr.
  208. --ahhh the days of randomly meritting crap because otherwise they were wasted
  209. sets.precast['Realmrazr'] = {
  210. head="Buremte Hat",
  211. neck="Soil Gorget",
  212. ear1="Brutal Earring",
  213. ear2="Ethereal Earring",
  214. body="Hagondes Coat",
  215. hands="Otomi Gloves",
  216. ring1="Icesoul Ring",
  217. ring2="Icesoul Ring",
  218. back="Romanus Cape",
  219. waist="Cognition Belt",
  220. legs="Hagondes Pants",
  221. feet="Hagondes Sabots"
  222. }
  223.  
  224. sets.Obi = {}
  225. sets.Obi.Fire = {waist='Karin Obi',back='Twilight Cape',lring='Zodiac Ring'}
  226. sets.Obi.Earth = {waist='Dorin Obi',back='Twilight Cape',lring='Zodiac Ring'}
  227. sets.Obi.Water = {waist='Suirin Obi',back='Twilight Cape',lring='Zodiac Ring'}
  228. sets.Obi.Wind = {waist='Furin Obi',back='Twilight Cape',lring='Zodiac Ring'}
  229. sets.Obi.Ice = {waist='Hyorin Obi',back='Twilight Cape',lring='Zodiac Ring'}
  230. sets.Obi.Thunder = {waist='Rairin Obi',back='Twilight Cape',lring='Zodiac Ring'}
  231. sets.Obi.Light = {waist='Korin Obi',back='Twilight Cape',lring='Zodiac Ring'}
  232. sets.Obi.Dark = {waist='Anrin Obi',back='Twilight Cape',lring='Zodiac Ring'}
  233.  
  234. sets.precast.enhancing = set_combine(sets.fastcast,{waist="Siegel Sash"})
  235. sets.precast.utsu = set_combine(sets.fastcast,{neck="Magoraga Beads"})
  236. sets.precast['Stoneskin'] = set_combine(sets.precast.enhancing,{hands="Carapacho Cuffs",waist="Siegel Sash"})
  237.  
  238.  
  239. -- sets only used for midcast
  240. -- use fastcast base for all magic sets in case precast phase is somehow missed
  241. sets.midcast = {}
  242. sets.midcast.Stoneskin = sets.ss_potency
  243. sets.midcast.cure = set_combine(sets.curefast,sets.cure_potency)
  244. sets.midcast.Curaga = set_combine(sets.curefast,sets.curaga)
  245. sets.midcast.enhancing = set_combine(sets.fastcast,sets.enhancing)
  246. sets.midcast.nuke = set_combine(sets.fastcast,sets.mab)
  247. sets.midcast.enfeeb = set_combine(sets.fastcast,sets.enfeeb)
  248. sets.midcast.doom = set_combine(sets.healingfast,sets.doom)
  249. sets.midcast.divine = set_combine(sets.fastcast,sets.divine)
  250. sets.midcast.erasenas = set_combine(sets.healingfast,sets.erasenas)
  251.  
  252. -- tp sets
  253. sets.tp = {}
  254. sets.tp.dd = set_combine(sets.haste, {
  255. ammo="Jukukik Feather",
  256. body="Gendewitha Bliaut",
  257. ring1="Rajas Ring",
  258. legs="Theophany Pantaloons",
  259. back="Atheling Mantle"
  260. })
  261.  
  262. sets.tp.dt = set_combine(sets.tp.dd,sets.dt)
  263.  
  264. sets.aftercast = {}
  265. sets.aftercast.tp = sets.tp.dd
  266. sets.aftercast.idle = sets.idle
  267.  
  268. send_command('input /macro book 4;wait .1;input /macro set 1')
  269. end
  270.  
  271. function precast(spell,abil)
  272. --anti macro button spam rule. invalidates up to three additional button presses
  273. --i don't get some of it but the echo tells me it's working so yay?
  274. if midaction() then
  275. midaction_counter = midaction_counter + 1
  276. send_command('@Input /echo HAAAY STOP SPAMMING ME')
  277. if midaction_counter > 3 then
  278. midaction(false)
  279. midaction_counter = 0
  280. else
  281. return
  282. end
  283. else
  284. midaction_counter = 0
  285. end
  286. if sets.precast[spell.english] then
  287. equip(sets.precast[spell.english])
  288. elseif spell.action_type=="Magic" then
  289. if spell.skill == "Enhancing Magic" then
  290. equip(sets.precast.enhancing)
  291. if spell.english == "Erase" then
  292. equip(sets.fastcast)
  293. end
  294. elseif spell.skill== "Healing Magic" then
  295. if string.find(spell.english,'Cure') then
  296. equip(sets.curefast)
  297. cure_check(spell)
  298. elseif string.find(spell.english,'Cura') then
  299. equip(sets.curefast)
  300. elseif (naSpells:contains(spell.english) or spell.english == "Cursna") then
  301. equip(sets.healingfast)
  302. else
  303. equip(sets.fastcast)
  304. end
  305. elseif spell.skill== "Enfeebling Magic" then
  306. --distance warning
  307. bemsays.am_i_safe(spell)
  308. equip(sets.fastcast)
  309. else
  310. equip(sets.fastcast)
  311. end
  312. elseif spell.type=="WeaponSkill" then
  313. equip(sets.precast.ws)
  314. end
  315.  
  316. end
  317.  
  318. function midcast(spell)
  319. -- cancel buffs first in case of instacast
  320. if spell.english == 'Stoneskin' then
  321. send_command('cancel 37')
  322. elseif spell.target.type == 'SELF' and spell.english == 'Sneak' then
  323. send_command('cancel 71')
  324. end
  325. if spell.type == 'JobAbility' or spell.type == 'WeaponSkill' then
  326. --midcast doesn't exist for JA or WS so cancel the processing of this function
  327. return
  328. end
  329. -- look for action/spell specific sets
  330. if sets.midcast[spell.english] then
  331. equip(sets.midcast[spell.english])
  332. elseif string.find(spell.english,'na') then
  333. if spell.english == 'Cursna' then
  334. equip(sets.midcast.doom)
  335. else
  336. equip(sets.midcast.erasenas)
  337. end
  338. if buffactive['Divine Caress'] then
  339. equip({hands="Orison Mitts +2",back="Mending Cape"})
  340. end
  341. --cure rules
  342. elseif spell.skill == "Healing Magic" then
  343. if string.find(spell.english,'Cure') then
  344. equip(sets.midcast.cure)
  345. elseif string.find(spell.english,'Cura') then
  346. equip(sets.midcast.Curaga)
  347. else
  348. equip(sets.conserve)
  349. end
  350. --below used more on sch. but if curing on lightsday, yay supercure
  351. --need to apply only to cures, need to move under cure rules
  352. if (spell.element == world.weather_element or spell.element == world.day_element) then
  353. equip(sets.Obi[spell.element])
  354. end
  355. elseif spell.skill == "Enhancing Magic" then
  356. --defined resSpells table at top of this code
  357. if resSpells:contains(spell.english) then
  358. equip(sets.bar)
  359. elseif (string.find(spell.english,'Prot') or string.find(spell.english,'Shell')) then
  360. equip(sets.protshell)
  361. --defined fast spells at top
  362. elseif fastspells:contains(spell.english) then
  363. equip(sets.conserve)
  364. elseif spell.english == 'Erase' then
  365. equip(sets.midcast.erasenas)
  366. elseif string.find(spell.english,'Regen') then
  367. equip(sets.regen)
  368. else
  369. equip(sets.midcast.enhancing)
  370. end
  371. elseif spell.skill == "Enfeebling Magic" then
  372. equip(sets.midcast.enfeeb)
  373. elseif spell.skill== "Elemental Magic" then
  374. equip(sets.midcast.nuke)
  375. elseif spell.skill== "Divine Magic" then
  376. equip(sets.midcast.divine)
  377. end
  378. end
  379.  
  380. function aftercast(spell)
  381. if player.status =='Engaged' then
  382. equip(sets.aftercast.tp)
  383. else
  384. equip(sets.aftercast.idle)
  385. end
  386. end
  387.  
  388.  
  389. --lock my weapon when fighting so it doesnt change when i cure people and such, so i dont lose tp
  390. --unfortunately it equips the last weapon i SHOULD have cast in as soon as i disengage, which is weird.
  391. function status_change(new,old)
  392. if player.status == 'Idle' then
  393. enable('main')
  394. enable('sub')
  395. equip(sets.aftercast.idle)
  396. elseif player.status == 'Engaged' then
  397. disable('main')
  398. disable('sub')
  399. equip(sets.aftercast.tp)
  400. elseif player.status == 'Resting' then
  401. equip(sets.resting)
  402. end
  403.  
  404. end
  405.  
  406. --using this to remind myself to freaking recharge sub/cast refresh
  407. --and for auto echo drops functionality
  408. function buff_change(buff,gain_or_loss)
  409. if player.sub_job == "SCH" then
  410. if (buff=="Sublimation: Complete" or buff=="Sublimation: Activated") and not gain_or_loss then
  411. windower.send_command('wait 30;input /echo ****BEM USE YOUR SUBLIMATION JANKS YO****')
  412. end
  413. elseif player.sub_job == "RDM" then
  414. if buff=="Refresh" and not gain_or_loss then
  415. windower.send_command('wait 10;input /echo ***BEM REFRESH YOSELF FFS***')
  416. end
  417. end
  418. if buff == "silence" and gain_or_loss then
  419. bemsays.echodrops()
  420. end
  421. end
  422. --stealing mote's refinewaltz code for cure purposes, should move to bemutils
  423. function cure_check(spell)
  424. newcure = spell.english
  425. downgrade = ""
  426. --if buffactive['Light Arts'] and buffactive.Penury then (will work on this later)
  427. --standard functionality below works.
  428. if player.mp < 46 then
  429. newcure = 'Cure II'
  430. elseif player.mp < 88 then
  431. newcure = 'Cure III'
  432. elseif player.mp < 135 then
  433. newcure = 'Cure IV'
  434. end
  435. downgrade = 'Short on MP. Downgrading to '..newcure..'.'
  436. if newcure ~= spell.english then
  437. cancel_spell()
  438. send_command('@input /ma "'..newcure..'" '..tostring(spell.target.raw))
  439. add_to_chat(122, downgrade)
  440. end
  441. end
  442.  
  443. --equip different idle sets depending on what im doing. max refresh is standard idle.
  444. --can put these in ingame macros as /console gs c dton i just have travel one macroed since
  445. --it gets most use. if not macroed just type //gs c dton or whatever set you want listed here
  446. function self_command(command)
  447. if command == 'dton' then
  448. sets.aftercast.idle = sets.dt
  449. equip(sets.aftercast.idle)
  450. elseif command == 'dtoff' then
  451. sets.aftercast.idle = sets.idle
  452. equip(sets.aftercast.idle)
  453. elseif command == 'run' then
  454. sets.aftercast.idle = sets.travel
  455. equip(sets.aftercast.idle)
  456. end
  457. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement