Guest User

RDM.lua

a guest
Oct 22nd, 2017
1,215
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Modified from 'https://github.com/Kinematics/GearSwap-Jobs/blob/master/RDM.lua'
  2. -- Defines gearsets and job keybinds for RDM.
  3. -- TODO tanking setup
  4. -- TODO meva idle set
  5. -- TODO make a new moderate m.acc set for enfeebling
  6.  
  7. texts = require('texts')
  8.  
  9. -------------------------------------------------------------------------------------------------------------------
  10. -- Setup functions for this job.  Generally should not be modified.
  11. -------------------------------------------------------------------------------------------------------------------
  12.  
  13. -- Initialization function for this job file.
  14. function get_sets()
  15.     mote_include_version = 2
  16.  
  17.     -- Load and initialize the include file.
  18.     include('Mote-Include.lua')
  19. end
  20.  
  21. -- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
  22. function job_setup()
  23.     enable('main','sub','range','ammo','head','neck','ear1','ear2','body','hands','ring1','ring2','back','waist','legs','feet')
  24.     state.Buff.Saboteur = buffactive.Saboteur or false
  25.     state.Buff.Stymie = buffactive.Stymie or false
  26.     state.Buff['Elemental Seal'] = buffactive['Elemental Seal'] or false
  27.     state.Buff.Doom = buffactive.Doom or false
  28. end
  29.  
  30. -------------------------------------------------------------------------------------------------------------------
  31. -- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
  32. -------------------------------------------------------------------------------------------------------------------
  33.  
  34. -- Setup vars that are user-dependent.  Can override this function in a sidecar file.
  35. function user_setup()
  36.     state.OffenseMode:options('None', 'Normal', 'Acc')                  -- Cycle with F9, will swap weapon
  37.     state.HybridMode:options('Normal', 'PDef')                          -- Cycle with ^F9
  38.     state.CastingMode:options('Normal', 'Resistant')                    -- Cycle with F10
  39.     state.IdleMode:options('Normal', 'PDT')                             -- Cycle with F11
  40.     state.CombatWeapon = M{['description']='Combat Weapon'}             -- Cycle with @F9, set with !F1, !F2
  41.     if S{'DNC','NIN'}:contains(player.sub_job) then
  42.         state.CombatWeapon:options('Sequence','SeqEnr','OdEnr','Vamps','None')
  43.     else
  44.         state.CombatWeapon:options('Sequence','Enrich','Degen','Odium','Vamp1','None')
  45.     end
  46.  
  47.     state.Seidr = M(false, 'Seidr Nukes')                               -- Toggle with !@z
  48.     state.MagicBurst = M(false, 'Magic Burst')                          -- Toggle with !z
  49.     init_state_text()
  50.  
  51.     -- Mote-libs handle obis, gorgets, and other elemental things.
  52.     -- These are default fallbacks if situationally appropriate gear is not available.
  53.     gear.default.weaponskill_neck = "Combatant's Torque"    -- used in sets.precast.WS and friends
  54.     gear.default.weaponskill_waist = "Windbuffet Belt +1"   -- used in sets.precast.WS and friends
  55.     gear.default.obi_waist = "Refoccilation Stone"          -- used in nuke sets (cures overriden in job_post_midcast)
  56.     gear.default.obi_ring = "Resonance Ring"                -- used in nuke sets
  57.  
  58.     -- Augmented items get variables for convenience and specificity
  59.     gear.darkring1 = {name="Dark Ring", augments={'Magic dmg. taken -3%','Phys. dmg. taken -6%'}}
  60.     gear.darkring2 = {name="Dark Ring", augments={'Magic dmg. taken -4%','Breath dmg. taken -3%','Phys. dmg. taken -3%'}}
  61.     gear.vamp1 = {name="Vampirism", augments={'STR+8','INT+9','"Occult Acumen"+8','DMG:+14'}}
  62.     gear.vamp2 = {name="Vampirism", augments={'STR+8','INT+9','"Occult Acumen"+8','DMG:+14'}}
  63.     gear.MerHatMB = {name="Merlinic Hood", augments={'"Mag.Atk.Bns."+27','Magic burst dmg.+10%','Mag. Acc.+15'}}
  64.     gear.MerHatFC = {name="Merlinic Hood", augments={'Mag. Acc.+19 "Mag.Atk.Bns."+19','"Fast Cast"+6','MND+3'}}
  65.     gear.MerBodMA = {name="Merlinic Jubbah",
  66.         augments={'Mag. Acc.+25 "Mag.Atk.Bns."+25','"Drain" and "Aspir" potency +2','AGI+2','"Mag.Atk.Bns."+5'}}
  67.     gear.MerFeetMB = {name="Merlinic Crackows", augments={'"Mag.Atk.Bns."+28','Magic burst dmg.+7%','DEX+10'}}
  68.     gear.MerFeetFC = {name="Merlinic Crackows", augments={'Mag. Acc.+5','"Fast Cast"+5','"Mag.Atk.Bns."+6'}}
  69.     gear.GrioMB  = {name="Grioavolr", augments={'Magic burst dmg.+8%','INT+2','Mag. Acc.+10','"Mag.Atk.Bns."+16','Magic Damage +7'}}
  70.     gear.GrioEnf = {name="Grioavolr", augments={'Enfb.mag. skill +10','Mag. Acc.+21','"Mag.Atk.Bns."+23','Magic Damage +7'}}
  71.     gear.EnfCape = {name="Sucellos's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Acc.+10','"Mag.Atk.Bns."+10'}}
  72.     gear.TPCape  = {name="Sucellos's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Store TP"+10'}}
  73.     gear.WSCape  = {name="Sucellos's Cape", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%'}}
  74.  
  75.     -- Binds overriding Mote defaults
  76.     send_command('unbind ^F10')
  77.     send_command('unbind ^F11')
  78.     send_command('bind !F1  gs c reset CombatWeapon')
  79.     send_command('bind !F2  gs c set CombatWeapon Vamps')
  80.     send_command('bind F9   gs c cycle OffenseMode')
  81.     send_command('bind !F9  gs c reset OffenseMode')
  82.     send_command('bind @F9  gs c cycle CombatWeapon')
  83.     send_command('bind !@F9 gs c cycleback CombatWeapon')
  84.     send_command('bind F10  gs c cycle CastingMode')
  85.     send_command('bind !F10 gs c reset CastingMode')
  86.     send_command('bind F11  gs c cycle IdleMode')
  87.     send_command('bind !F11 gs c reset IdleMode')
  88.     send_command('bind !space gs c set DefenseMode Physical')
  89.     send_command('bind @space gs c set DefenseMode Magical')
  90.     send_command('bind !@space gs c reset DefenseMode')
  91.     -- JA binds
  92.     send_command('bind ^` input /ja Stymie <me>')
  93.     send_command('bind !` input /ja Spontaneity')
  94.     send_command('bind @` input /ja Saboteur <me>')
  95.     send_command('bind ^@tab input /ja Composure <me>')
  96.     send_command('bind !^` input /ja Chainspell <me>')
  97.     -- Macrobar shadowing binds
  98.     send_command('bind ^1 input /ma "Dia III"')
  99.     send_command('bind ^@1 input /ma Inundation')
  100.     send_command('bind ^2 input /ma "Slow II"')
  101.     send_command('bind ^@2 input /ma "Gravity II" <stnpc>')
  102.     send_command('bind ^3 input /ma "Paralyze II"')
  103.     send_command('bind ^@3 input /ma Bind <stnpc>')
  104.     send_command('bind ^4 input /ma Addle II')
  105.     send_command('bind ^@4 input /ma Silence')
  106.     send_command('bind ^5 input /ma "Sleep II" <stnpc>')
  107.     send_command('bind ^@5 input /ma Sleep <stnpc>')    -- becomes sleepga <t> /blm
  108.     send_command('bind ^6 input /ma Break <stnpc>')
  109.     send_command('bind ^@6 input /ma Gravity <stnpc>')
  110.     send_command('bind ^7 input /ma Blind')
  111.     send_command('bind !1 input /ma "Cure III" <stpc>')
  112.     send_command('bind !2 input /ma "Cure IV" <stpc>')
  113.     send_command('bind !3 input /ma "Distract III"')
  114.     send_command('bind !@3 input /ma "Distract II"')
  115.     send_command('bind !4 input /ma "Frazzle III"')
  116.     send_command('bind !@4 input /ma "Frazzle II"')
  117.     send_command('bind !5 input /ma "Haste II" <stpc>')
  118.     send_command('bind !6 input /ma "Refresh III" <stpc>')
  119.     send_command('bind !7 input /ma "Flurry II" <stpc>')
  120.     send_command('bind !8 input /ma "Fire IV"')
  121.     send_command('bind !9 input /ma "Blizzard IV"')
  122.     send_command('bind !0 input /ma "Thunder IV"')
  123.     send_command('bind @8 input /ma "Fire III"')
  124.     send_command('bind @9 input /ma "Blizzard III"')
  125.     send_command('bind @0 input /ma "Thunder III"')
  126.     send_command('bind !@8 input /ma "Fire V"')
  127.     send_command('bind !@9 input /ma "Blizzard V"')
  128.     send_command('bind !@0 input /ma "Thunder V"')
  129.  
  130.     send_command('bind !^1 input /ws "Sanguine Blade"')
  131.     send_command('bind !^2 input /ws "Chant du Cygne"')
  132.     send_command('bind !^3 input /ws "Savage Blade"')
  133.     send_command('bind !^4 input /ws "Vorpal Blade"')
  134.     send_command('bind !^5 input /ws Requiescat')
  135.     send_command('bind !^6 input /ws "Death Blossom"')
  136.  
  137.     -- Subjob binds
  138.     if     player.sub_job == 'WHM' then
  139.         send_command('bind @tab input /ja "Divine Seal" <me>')
  140.         send_command('bind !@1 input /ma "Curaga" <stpc>')
  141.         send_command('bind !@2 input /ma "Curaga II" <stpc>')
  142.         -- Status cure binds (never want to fumble these)
  143.         send_command('bind @1 input /ma Poisona')
  144.         send_command('bind @2 input /ma Paralyna')
  145.         send_command('bind @3 input /ma Blindna')
  146.         send_command('bind @4 input /ma Silena')
  147.         send_command('bind @5 input /ma Stona')
  148.         send_command('bind @6 input /ma Viruna')
  149.         send_command('bind @7 input /ma Cursna')
  150.         send_command('bind @F1 input /ma Erase')
  151.     elseif player.sub_job == 'SCH' then
  152.         send_command('bind @tab gs c penuparsi')
  153.         send_command('bind @q gs c celeralac')
  154.         send_command('bind ^@q gs c accemani')
  155.         send_command('bind ^- input /ja "Light Arts" <me>') -- use twice for addendum
  156.         send_command('bind ^= input /ja "Dark Arts" <me>')
  157.         send_command('bind !- input /ma Drain')
  158.         send_command('bind @- input /ma Drain')
  159.         send_command('bind != input /ma Aspir')
  160.         send_command('bind @= input /ma Aspir')
  161.         send_command('bind ^!4 input /ma Klimaform <me>')
  162.         send_command('bind ^!5 input /ma Sandstorm')
  163.         send_command('bind ^!6 input /ma Rainstorm')
  164.         send_command('bind ^!7 input /ma Windstorm')
  165.         send_command('bind ^!8 input /ma Firestorm')
  166.         send_command('bind ^!9 input /ma Hailstorm')
  167.         send_command('bind ^!0 input /ma Thunderstorm')
  168.         send_command('bind ^!- input /ma Aurorastorm')
  169.         send_command('bind ^!= input /ma Voidstorm')
  170.         -- Status cure binds (never want to fumble these)
  171.         send_command('bind @1 input /ma Poisona')
  172.         send_command('bind @2 input /ma Paralyna')
  173.         send_command('bind @3 input /ma Blindna')
  174.         send_command('bind @4 input /ma Silena')
  175.         send_command('bind @5 input /ma Stona')
  176.         send_command('bind @6 input /ma Viruna')
  177.         send_command('bind @7 input /ma Cursna')
  178.         send_command('bind @F1 input /ma Erase')
  179.     elseif player.sub_job == 'BLM' then
  180.         send_command('bind !d input /ma Stun')
  181.         send_command('bind ^@` input /ja "Elemental Seal" <me>')
  182.         send_command('bind ^@5 input /ma Sleepga')
  183.         send_command('bind !- input /ma Drain')
  184.         send_command('bind @- input /ma Drain')
  185.         send_command('bind != input /ma Aspir')
  186.         send_command('bind @= input /ma Aspir')
  187.     elseif player.sub_job == 'DNC' then
  188.         send_command('bind @F1 input /ja "Healing Waltz" <stpc>')
  189.         send_command('bind @F2 input /ja "Divine Waltz" <me>')
  190.         send_command('bind !v input /ja "Spectral Jig" <me>')
  191.         send_command('bind !d input /ja "Animated Flourish"')
  192.         send_command('bind !f input /ja "Haste Samba" <me>')
  193.         send_command('bind !@f input /ja "Reverse Flourish" <me>')
  194.         send_command('bind !e input /ja Quickstep')
  195.         send_command('bind !@e input /ja "Box Step"')
  196.     elseif player.sub_job == 'NIN' then
  197.         send_command('bind !e input /ma "Utsusemi: Ni" <me>')
  198.         send_command('bind !@e input /ma "Utsusemi: Ichi" <me>')
  199.     elseif player.sub_job == 'SMN' then
  200.         send_command('bind !v input //mewinglullaby')
  201.         send_command('bind !b input //caitsith')
  202.         send_command('bind !@b input //release')
  203.         send_command('bind !n input //retreat')
  204.     end
  205.     -- Spell binds
  206.     send_command('bind ^tab input /ma Dispel')
  207.     send_command('bind !c input /ma Bind')
  208.     -- Other binds
  209.     send_command('bind !@z gs c toggle Seidr')
  210.     send_command('bind !z gs c MagicBurst')
  211.  
  212.     select_default_macro_book()
  213. end
  214.  
  215. -- Called when this job file is unloaded (eg: job change)
  216. -- Unset job keybinds here.
  217. function user_unload()
  218.     send_command('unbind !space')
  219.     send_command('unbind @space')
  220.     send_command('unbind !@space')
  221.     send_command('unbind ^tab')
  222.     send_command('unbind ^`')
  223.     send_command('unbind !`')
  224.     send_command('unbind @`')
  225.     send_command('unbind ^@tab')
  226.     send_command('unbind !^`')
  227.     send_command('unbind ^1')
  228.     send_command('unbind ^2')
  229.     send_command('unbind ^3')
  230.     send_command('unbind ^4')
  231.     send_command('unbind ^5')
  232.     send_command('unbind ^6')
  233.     send_command('unbind ^7')
  234.     send_command('unbind ^@1')
  235.     send_command('unbind ^@2')
  236.     send_command('unbind ^@3')
  237.     send_command('unbind ^@4')
  238.     send_command('unbind ^@5')
  239.     send_command('unbind ^@6')
  240.     send_command('unbind !1')
  241.     send_command('unbind !2')
  242.     send_command('unbind !3')
  243.     send_command('unbind !4')
  244.     send_command('unbind !5')
  245.     send_command('unbind !6')
  246.     send_command('unbind !7')
  247.     send_command('unbind !8')
  248.     send_command('unbind !9')
  249.     send_command('unbind !0')
  250.     send_command('unbind @8')
  251.     send_command('unbind @9')
  252.     send_command('unbind @0')
  253.     send_command('unbind !@8')
  254.     send_command('unbind !@9')
  255.     send_command('unbind !@0')
  256.     send_command('unbind @tab')
  257.     send_command('unbind @1')
  258.     send_command('unbind @2')
  259.     send_command('unbind @3')
  260.     send_command('unbind @4')
  261.     send_command('unbind @5')
  262.     send_command('unbind @6')
  263.     send_command('unbind @7')
  264.     send_command('unbind @F1')
  265.     send_command('unbind @q')
  266.     send_command('unbind ^@q')
  267.     send_command('unbind ^-')
  268.     send_command('unbind ^=')
  269.     send_command('unbind !-')
  270.     send_command('unbind @-')
  271.     send_command('unbind !=')
  272.     send_command('unbind @=')
  273.     send_command('unbind ^!1')
  274.     send_command('unbind ^!2')
  275.     send_command('unbind ^!3')
  276.     send_command('unbind ^!4')
  277.     send_command('unbind ^!5')
  278.     send_command('unbind ^!6')
  279.     send_command('unbind ^!7')
  280.     send_command('unbind ^!8')
  281.     send_command('unbind ^!9')
  282.     send_command('unbind ^!0')
  283.     send_command('unbind ^!-')
  284.     send_command('unbind ^!=')
  285.     send_command('unbind ^@`')
  286.     send_command('unbind @F2')
  287.     send_command('unbind !v')
  288.     send_command('unbind !d')
  289.     send_command('unbind !f')
  290.     send_command('unbind !@f')
  291.     send_command('unbind !e')
  292.     send_command('unbind !@e')
  293.     send_command('unbind !@z')
  294.     send_command('unbind !z')
  295.     send_command('unbind !c')
  296.  
  297.     destroy_state_text()
  298. end
  299.  
  300. -- Define sets and vars used by this job file.
  301. function init_gear_sets()
  302.  
  303.     sets.weapons = {}
  304.     sets.weapons.None   = {}
  305.     sets.weapons.Sequence = {main="Sequence",sub="Genmei Shield"}
  306.     sets.weapons.Enrich   = {main="Enriching Sword",sub="Genmei Shield"}
  307.     sets.weapons.Degen    = {main="Demersal Degen +1",sub="Genmei Shield"}
  308.     sets.weapons.Odium    = {main="Odium",sub="Genmei Shield"}
  309.     sets.weapons.Vamp1    = {main=gear.vamp1,sub="Genmei Shield"}
  310.     sets.weapons.SeqEnr   = {main="Sequence",sub="Enriching Sword"}
  311.     sets.weapons.OdEnr    = {main="Odium",sub="Enriching Sword"}
  312.     sets.weapons.Vamps    = {main=gear.vamp1,sub=gear.vamp2}
  313.  
  314.     -- Precast Sets
  315.  
  316.     sets.precast.JA.Chainspell = {body="Vitivation Tabard +1"}
  317.  
  318.     sets.precast.Step = {ammo="Amar Cluster",
  319.         head="Ayanmo Zucchetto +2",neck="Combatant's Torque",ear1="Telos Earring",ear2="Dignitary's Earring",
  320.         body="Ayanmo Corazza +1",hands="Ayanmo Manopolas +1",ring1="Chirich Ring",ring2="Cacoethic Ring +1",
  321.         back=gear.TPCape,waist="Grunfeld Rope",legs="Ayanmo Cosciales +1",feet="Ayanmo Gambieras +2"}
  322.  
  323.     sets.precast.FC = {
  324.         head="Atrophy Chapeau +3",neck="Orunmila's Torque",ear1="Loquacious Earring",ear2="Etiolation Earring",
  325.         body="Vitivation Tabard +1",hands="Leyline Gloves",ring2="Kishar Ring",
  326.         waist="Channeler's Stone",legs="Psycloth Lappas",feet=gear.MerFeetFC}
  327.     sets.precast.FC['Enhancing Magic'] = set_combine(sets.precast.FC, {waist="Siegel Sash"})
  328.     sets.impact = {head=empty,body="Twilight Cloak"}
  329.     sets.precast.FC.Impact = set_combine(sets.precast.FC, sets.impact)
  330.  
  331.     sets.precast.WS = {ammo="Ginsen",
  332.         head="Jhakri Coronal +2",neck=gear.ElementalGorget,ear1="Moonshade Earring",ear2="Sherida Earring",
  333.         body="Ayanmo Corazza +1",hands="Jhakri Cuffs +2",ring1="Rufescent Ring",ring2="Hetairoi Ring",
  334.         back=gear.WSCape,waist=gear.ElementalBelt,legs="Jhakri Slops +2",feet="Jhakri Pigaches +2"}
  335.     sets.precast.WS.Acc = set_combine(sets.precast.WS, {ring2="Cacoethic Ring +1",back=gear.TPCape})
  336.     sets.precast.WS['Savage Blade'] = set_combine(sets.precast.WS, {body="Jhakri Robe +2",ring2="Mujin Band"})
  337.     -- sequence: acc~1157, att~1173, wsd+17, scb+12, da+5, ta+27~28, str+199, mnd+141 (buffed)
  338.     sets.precast.WS['Savage Blade'].Acc = set_combine(sets.precast.WS['Savage Blade'], {ring2="Cacoethic Ring +1"})
  339.     sets.precast.WS['Chant du Cygne'] = set_combine(sets.precast.WS, {back=gear.TPCape,feet="Ayanmo Gambieras +2"})
  340.     sets.precast.WS['Chant du Cygne'].Acc = set_combine(sets.precast.WS['Chant du Cygne'], {ear1="Telos Earring",ring2="Cacoethic Ring +1"})
  341.     sets.precast.WS['Vorpal Blade'] = set_combine(sets.precast.WS['Chant du Cygne'], {ear1="Telos Earring",back=gear.WSCape})
  342.     sets.precast.WS['Vorpal Blade'].Acc = set_combine(sets.precast.WS['Chant du Cygne'].Acc, {})
  343.     sets.precast.WS['Aeolian Edge'] = {ammo="Pemphredo Tathlum",
  344.         head="Jhakri Coronal +2",neck="Sanctity Necklace",ear1="Friomisi Earring",ear2="Moonshade Earring",
  345.         body=gear.MerBodMA,hands="Chironic Gloves",ring1="Acumen Ring",ring2="Sangoma Ring",
  346.         back=gear.EnfCape,waist=gear.ElementalBelt,legs="Jhakri Slops +2",feet="Chironic Slippers"}
  347.     sets.precast.WS['Energy Drain'] = set_combine(sets.precast.WS['Aeolian Edge'], {waist="Refoccilation Stone"})
  348.     sets.precast.WS['Sanguine Blade'] = set_combine(sets.precast.WS['Aeolian Edge'], {
  349.         head="Pixie Hairpin +1",ear2="Hecate's Earring",ring2="Archon Ring",waist="Refoccilation Stone"})
  350.  
  351.     -- Midcast Sets
  352.  
  353.     sets.midcast.FastRecast = {
  354.         head="Nahtirah Hat",neck="Loricate Torque +1",ear1="Loquacious Earring",ear2="Etiolation Earring",
  355.         body="Vitivation Tabard +1",hands="Chironic Gloves",ring1=gear.darkring1,ring2=gear.darkring2,
  356.         back="Perimede Cape",waist="Goading Belt",legs="Chironic Hose",feet=gear.MerFeetFC}
  357.  
  358.     sets.midcast.Cure = {main="Serenity",sub="Achaq Grip",ammo="Staunch Tathlum",
  359.         head="Chironic Hat",neck="Nodens Gorget",ear1="Mendicant's Earring",ear2="Novia Earring",
  360.         body="Vrikodara Jupon",hands="Kaykaus Cuffs",ring1="Sangoma Ring",ring2="Persis Ring",
  361.         back="Solemnity Cape",waist=gear.ElementalObi,legs="Chironic Hose",feet="Chironic Slippers"}
  362.     sets.midcast.Curaga = sets.midcast.Cure
  363.     sets.midcast.Cure.Melee = set_combine(sets.midcast.Cure, {feet="Medium's Sabots"})
  364.     sets.midcast.Curaga.Melee = sets.midcast.Cure.Melee
  365.     sets.midcast.Cursna = {neck="Malison Medallion",
  366.         body="Vitivation Tabard +1",ring1="Haoma's Ring",ring2="Haoma's Ring",feet="Vanya Clogs"}
  367.     -- healing skill 459, cursna +45 (est. 37% success)
  368.  
  369.     sets.midcast.EnhancingDuration = {head="Telchine Cap",body="Telchine Chasuble",hands="Atrophy Gloves +1",
  370.         back=gear.EnfCape,legs="Telchine Braconi",feet="Lethargy Houseaux +1"}
  371.     sets.midcast['Enhancing Magic'] = {main="Serenity",sub="Achaq Grip",ammo="Homiliary",
  372.         head="Befouled Crown",neck="Incanter's Torque",ear1="Andoaa Earring",ear2="Etiolation Earring",
  373.         body="Vitivation Tabard +1",hands="Chironic Gloves",ring1="Stikini Ring",
  374.         back="Perimede Cape",legs="Portent Pants",feet="Lethargy Houseaux +1"}
  375.     -- temper2 ta+27~28
  376.     sets.midcast.Aquaveil = set_combine(sets.midcast.EnhancingDuration, {head="Amalric Coif"})
  377.     sets.midcast.Regen = set_combine(sets.midcast.EnhancingDuration, {main="Bolelabunga",sub="Genmei Shield",body="Telchine Chasuble"})
  378.     sets.midcast.Refresh = set_combine(sets.midcast.EnhancingDuration, {
  379.         head="Amalric Coif",body="Atrophy Tabard +3",legs="Lethargy Fuseau +1"})
  380.     sets.midcast.Stoneskin = set_combine(sets.midcast.EnhancingDuration, {neck="Nodens Gorget",waist="Siegel Sash"})
  381.     sets.midcast.FixedPotencyEnhancing = sets.midcast.EnhancingDuration
  382.     sets.midcast.Klimaform = sets.midcast.FixedPotencyEnhancing
  383.     sets.buff.ComposureOther = {head="Lethargy Chappel +1",body="Lethargy Sayon +1",legs="Lethargy Fuseau +1",feet="Lethargy Houseaux +1"}
  384.  
  385.     sets.midcast['Enfeebling Magic'] = {main=gear.GrioEnf,sub="Enki Strap",ammo="Regal Gem",
  386.         head="Atrophy Chapeau +3",neck="Erra Pendant",ear1="Regal Earring",ear2="Dignitary's Earring",
  387.         body="Atrophy Tabard +3",hands="Kaykaus Cuffs",ring1="Stikini Ring",ring2="Kishar Ring",
  388.         back=gear.EnfCape,waist="Luminary Sash",legs="Chironic Hose",feet="Skaoi Boots"}
  389.     sets.midcast.MndEnfeebles = set_combine(sets.midcast['Enfeebling Magic'], {body="Lethargy Sayon +1",feet="Uk'uxkaj Boots"})
  390.     sets.midcast.IntEnfeebles = sets.midcast.MndEnfeebles
  391.     sets.midcast.SkillEnfeebles = set_combine(sets.midcast.MndEnfeebles, {sub="Mephitis Grip",
  392.         head="Vitivation Chapeau +1",neck="Incanter's Torque",hands="Lethargy Gantherots +1",
  393.         waist="Rumination Sash",feet="Medium's Sabots"})
  394.     -- enf.skill=582, m.acc+493 (sum:1075), mnd+227, effect+34 ==> -150~163 evasion
  395.     sets.midcast.MndEnfeebles.Resistant = sets.midcast['Enfeebling Magic']
  396.     sets.midcast.IntEnfeebles.Resistant = sets.midcast['Enfeebling Magic']
  397.     sets.midcast.SkillEnfeebles.Resistant = sets.midcast['Enfeebling Magic']
  398.     -- enf.skill=557, m.acc+635 (sum:1192), mnd+252, effect+20 ==> -125~137 evasion
  399.     sets.buff.Saboteur = {hands="Lethargy Gantherots +1"}
  400.  
  401.     sets.midcast['Elemental Magic'] = {main=gear.GrioEnf,sub="Niobid Strap",ammo="Pemphredo Tathlum",
  402.         head=gear.MerHatMB,neck="Sanctity Necklace",ear1="Regal Earring",ear2="Friomisi Earring",
  403.         body=gear.MerBodMA,hands="Chironic Gloves",ring1="Acumen Ring",ring2=gear.ElementalRing,
  404.         back=gear.EnfCape,waist=gear.ElementalObi,legs="Merlinic Shalwar",feet="Chironic Slippers"}
  405.     sets.midcast['Elemental Magic'].Seidr = set_combine(sets.midcast['Elemental Magic'], {body="Seidr Cotehardie"})
  406.     sets.midcast['Elemental Magic'].Resistant = set_combine(sets.midcast['Elemental Magic'], {sub="Enki Strap",
  407.         head="Atrophy Chapeau +3",ear2="Dignitary's Earring",
  408.         ring1="Stikini Ring",ring2="Resonance Ring",feet="Jhakri Pigaches +2"})
  409.     sets.midcast.Impact = set_combine(sets.midcast['Elemental Magic'].Resistant, sets.impact)
  410.     sets.magicburst = {main=gear.GrioMB,head=gear.MerHatMB,neck="Mizukage-no-Kubikazari",ear2="Static Earring",
  411.         hands="Amalric Gages",ring1="Locus Ring",ring2="Mujin Band",feet="Jhakri Pigaches +2"}
  412.     sets.magicburst.Resistant = set_combine(sets.magicburst, {head="Atrophy Chapeau +3"})
  413.     -- mb +40%, mb2 +10%
  414.  
  415.     sets.midcast['Dark Magic'] = {main="Serenity",sub="Enki Strap",ammo="Regal Gem",
  416.         head="Atrophy Chapeau +3",neck="Erra Pendant",ear1="Regal Earring",ear2="Dignitary's Earring",
  417.         body="Atrophy Tabard +3",hands="Jhakri Cuffs +2",ring1="Evanescence Ring",ring2="Stikini Ring",
  418.         back=gear.EnfCape,waist=gear.ElementalObi,legs="Chironic Hose",feet="Jhakri Pigaches +2"}
  419.     sets.midcast.Drain = set_combine(sets.midcast['Dark Magic'], {main="Rubicundity",sub="Culminus",
  420.         head="Pixie Hairpin +1",ring2="Archon Ring",waist="Fucho-no-Obi",feet=gear.MerFeetFC})
  421.     sets.midcast.Aspir = sets.midcast.Drain
  422.     sets.midcast.Aspir.Resistant = set_combine(sets.midcast.Aspir, {head="Atrophy Chapeau +3",feet="Jhakri Pigaches +2"})
  423.     sets.midcast.Stun = set_combine(sets.midcast['Dark Magic'], {waist="Goading Belt"})
  424.  
  425.     sets.midcast.Utsusemi = {main="Mafic Cudgel",sub="Genmei Shield",ammo="Staunch Tathlum",
  426.         head="Ayanmo Zucchetto +2",neck="Loricate Torque +1",ear1="Thureous Earring",ear2="Etiolation Earring",
  427.         body="Ayanmo Corazza +1",hands="Ayanmo Manopolas +1",ring1=gear.darkring1,ring2=gear.darkring2,
  428.         back="Moonbeam Cape",waist="Flume Belt +1",legs="Ayanmo Cosciales +1",feet="Ayanmo Gambieras +2"}
  429.  
  430.     -- Sets to return to when not performing an action.
  431.  
  432.     sets.idle = {main="Bolelabunga",sub="Genmei Shield",ammo="Homiliary",
  433.         head="Vitivation Chapeau +1",neck="Loricate Torque +1",ear1="Merman's Earring",ear2="Etiolation Earring",
  434.         body="Jhakri Robe +2",hands="Ayanmo Manopolas +1",ring1="Shneddick Ring",ring2=gear.darkring2,
  435.         back="Umbra Cape",waist="Flume Belt +1",legs="Lengo Pants",feet="Ayanmo Gambieras +2"}
  436.     -- refresh+9~10, pdt-34~40, def~1002, mdt-20, mdef+23, meva+341
  437.     sets.idle.PDT = {main="Mafic Cudgel",sub="Genmei Shield",ammo="Homiliary",
  438.         head="Vitivation Chapeau +1",neck="Loricate Torque +1",ear1="Thureous Earring",ear2="Etiolation Earring",
  439.         body="Atrophy Tabard +3",hands="Ayanmo Manopolas +1",ring1=gear.darkring1,ring2=gear.darkring2,
  440.         back="Moonbeam Cape",waist="Flume Belt +1",legs="Ayanmo Cosciales +1",feet="Ayanmo Gambieras +2"}
  441.     sets.idle.PDT = set_combine(sets.idle, {main="Mafic Cudgel",
  442.         ear1="Thureous Earring",ring1=gear.darkring1,back="Moonbeam Cape"})
  443.     -- refresh+8~9, pdt-49, def~1101, mdt-26, mdef+23, meva+341
  444.     sets.idle.MEVA = set_combine(sets.idle.PDT, {ammo="Staunch Tathlum"})
  445.     sets.latent_refresh = {waist="Fucho-no-obi"}
  446.     sets.buff.Doom = {waist="Gishdubar Sash"}
  447.  
  448.     -- Defense sets
  449.     sets.defense.PDT = sets.idle.PDT
  450.     sets.defense.MDT = sets.idle.MEVA
  451.     sets.Kiting = {ring1="Shneddick Ring"}
  452.  
  453.     -- Engaged sets
  454.     sets.engaged = set_combine({ammo="Ginsen",
  455.         head="Ayanmo Zucchetto +2",neck="Combatant's Torque",ear1="Telos Earring",ear2="Sherida Earring",
  456.         body="Ayanmo Corazza +1",hands="Ayanmo Manopolas +1",ring1="Chirich Ring",ring2="Hetairoi Ring",
  457.         back=gear.TPCape,waist="Windbuffet Belt +1",legs="Ayanmo Cosciales +1",feet="Ayanmo Gambieras +2"},
  458.         sets.weapons[state.CombatWeapon.value])
  459.     -- sequence: acc~1205, haste+26, stp+48, da+12, ta+31~32, qa+2, pdt-27, mdt-17 (buffed)
  460.     sets.engaged.Acc = set_combine(sets.engaged, {ammo="Amar Cluster",ear2="Dignitary's Earring",ring2="Cacoethic Ring +1"})
  461.     -- sequence: acc~1227, haste+26, stp+43, da+7, ta+29~30, qa+2, pdt-27, mdt-17 (buffed)
  462.     sets.engaged.PDef = set_combine(sets.engaged, {ammo="Staunch Tathlum",sub="Genmei Shield",
  463.         neck="Loricate Torque +1",ring1=gear.darkring1,ring2="Patricius Ring",back="Umbra Cape"})
  464.  
  465.     -- Resting set
  466.     sets.resting = set_combine(sets.idle, {main="Boonwell Staff",sub="Niobid Strap",
  467.         neck="Eidolon Pendant",ring1=gear.darkring1,back="Felicitas Cape",waist="Shinjutsu-no-obi +1"})
  468.  
  469.     -- Sets that depend upon idle sets
  470.     sets.midcast['Dia II'] = set_combine(sets.idle, {head="White Rarab Cap +1",ring2="Kishar Ring",waist="Chaac Belt"})
  471.     sets.midcast['Dia III'] = set_combine(sets.idle, {head="Vitivation Chapeau +1",ring2="Kishar Ring",waist="Chaac Belt"})
  472.     sets.midcast['Bio II'] = sets.midcast['Dia II']
  473.     sets.midcast.Blink = set_combine(sets.idle.PDT, {ammo="Staunch Tathlum",hands="Chironic Gloves",legs="Lengo Pants"})
  474. end
  475.  
  476. -------------------------------------------------------------------------------------------------------------------
  477. -- Job-specific hooks for standard casting events.
  478. -------------------------------------------------------------------------------------------------------------------
  479.  
  480. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  481. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  482. function job_precast(spell, action, spellMap, eventArgs)
  483.     if spell.english == "Composure" and buffactive.Composure then
  484.         send_command('cancel composure')
  485.         eventArgs.cancel = true
  486.     elseif spell.english == "Light Arts" and buffactive['Light Arts'] then
  487.         send_command('input /ja "Addendum: White" <me>')
  488.         eventArgs.cancel = true
  489.     elseif S{'BarElement','BarStatus','Protect','Shell'}:contains(spellMap)
  490.     or S{'Poison II','Flash','Stun'}:contains(spell.english) then
  491.         -- some spells cast too quickly for precast/midcast swaps to work reliably
  492.         eventArgs.useMidcastGear = true
  493.     end
  494. end
  495.  
  496. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  497. function job_midcast(spell, action, spellMap, eventArgs)
  498.     -- Let these spells skip midcast sets by replacing it with the default idle set.
  499.     -- This should make the character only blink once (for precast) rather than twice.
  500.     if S{'Warp','Warp II','Escape'}:contains(spell.english)
  501.     or npcs.Trust:contains(spell.english)
  502.     or spellMap == 'Teleport' then
  503.         if sets.idle[state.IdleMode.value] then
  504.             equip(sets.idle[state.IdleMode.value])
  505.         else
  506.             equip(sets.idle)
  507.         end
  508.         eventArgs.handled = true
  509.     end
  510. end
  511.  
  512. -- Run after the default midcast() is done.
  513. -- eventArgs is the same one used in job_midcast, in case information needs to be persisted.
  514. function job_post_midcast(spell, action, spellMap, eventArgs)
  515.     if spell.skill == 'Enfeebling Magic' then
  516.         if state.Buff.Saboteur and S{'MndEnfeebles','IntEnfeebles','SkillEnfeebles'}:contains(spellMap) then
  517.             equip(sets.buff.Saboteur)
  518.         end
  519.     elseif spell.skill == 'Enhancing Magic' then
  520.         if buffactive.Composure and S{'PLAYER','NPC'}:contains(spell.target.type) then
  521.             if spellMap ~= 'Refresh' then
  522.                 equip(sets.buff.ComposureOther)
  523.             end
  524.         end
  525.     elseif S{'Cure','Curaga'}:contains(spellMap) then
  526.         if state.OffenseMode.value ~= 'None' then
  527.             equip(sets.midcast[spellMap].Melee)
  528.         end
  529.         if gear.ElementalObi.name == gear.default.obi_waist then
  530.             equip({waist="Channeler's Stone"})
  531.         end
  532.     end
  533.     if spell.target.type == 'SELF' then
  534.         if S{'Cure','Curaga','Refresh'}:contains(spellMap) or spell.english == 'Cursna' then
  535.             equip({waist="Gishdubar Sash"})
  536.         end
  537.     end
  538.     if spell.skill == 'Elemental Magic' then
  539.         if state.MagicBurst.value and spell.english ~= 'Impact' then
  540.             if state.CastingMode.value == 'Resistant' then
  541.                 equip(sets.magicburst.Resistant)
  542.             else
  543.                 equip(sets.magicburst)
  544.             end
  545.         end
  546.         if state.Seidr.value and state.CastingMode.value ~= 'Resistant' then
  547.             equip({body="Seidr Cotehardie"})
  548.         end
  549.     elseif spell.skill == 'Enfeebling Magic' and (state.Buff.Stymie or state.Buff['Elemental Seal']) then
  550.         if state.CastingMode.value == 'Resistant'
  551.         and S{'Frazzle III','Distract III','Slow II','Addle II','Paralyze II'}:contains(spell.english) then
  552.             equip(sets.midcast[spellMap])
  553.         end
  554.     end
  555. end
  556.  
  557. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  558. function job_aftercast(spell, action, spellMap, eventArgs)
  559.     if spell.interrupted then
  560.         send_command('wait 0.5;gs c update')
  561.         if buffactive.Amnesia and S{'JobAbility','WeaponSkill'}:contains(spell.type) then
  562.             add_to_chat(123, 'Amnesia prevents using '..spell.english)
  563.         elseif buffactive.Silence and S{'WhiteMagic','BlackMagic','Ninjutsu'}:contains(spell.type) then
  564.             add_to_chat(123, 'Silence prevents using '..spell.english)
  565.         elseif has_any_buff_of(S{'Petrification','Sleep','Stun','Terror'}) then
  566.             add_to_chat(123, 'Status prevents using '..spell.english)
  567.         end
  568.     elseif S{'Break','Sleep','Sleep II','Sleepga'}:contains(spell.english) then
  569.         local dur = 0
  570.         if spell.english == 'Break' then
  571.             dur = dur + 30
  572.         elseif spell.english == 'Sleep' or spell.english == 'Sleepga' then
  573.             dur = dur + 60
  574.         elseif spell.english == 'Sleep II' then
  575.             dur = dur + 90
  576.         end
  577.         if state.Buff.Saboteur then
  578.             dur = math.floor(dur * 1.25) -- 1.25 for (bc)nms, 2.00 for normal monsters
  579.         end
  580.         if state.Buff.Stymie then
  581.             dur = dur + 20
  582.         end
  583.         dur = dur + 20
  584.         dur = math.floor(dur * 1.10) -- kishar ring
  585.         send_command('@timers c "'..spell.english..' ['..spell.target.name..']" '..tostring(dur)..' down')
  586.     end
  587. end
  588.  
  589. -------------------------------------------------------------------------------------------------------------------
  590. -- Job-specific hooks for non-casting events.
  591. -------------------------------------------------------------------------------------------------------------------
  592.  
  593. -- Called when the player's status changes.
  594. function job_status_change(newStatus, oldStatus, eventArgs)
  595.     -- Don't swap to an hMP set until just before the first tick
  596.     if newStatus == 'Resting' then
  597.         equip(sets.idle)
  598.         send_command('wait 18;gs c update')
  599.         eventArgs.handled = true
  600.     end
  601. end
  602.  
  603. -- Called when a player gains or loses a buff.
  604. -- buff == buff gained or lost
  605. -- gain == true if the buff was gained, false if it was lost.
  606. function job_buff_change(buff, gain)
  607.     if buff == 'Sleep' and gain then
  608.         add_to_chat(123, 'cancelling stoneskin')
  609.         send_command('cancel Stoneskin')
  610.     elseif S{'Stun','Terror','Petrification','Doom'}:contains(buff) then
  611.         if gain then
  612.             equip(sets.idle.PDT)
  613.         else
  614.             handle_equipping_gear(player.status)
  615.         end
  616.     end
  617. end
  618.  
  619. -- Handle notifications of general user state change.
  620. function job_state_change(stateField, newValue, oldValue)
  621.     if stateField == 'Offense Mode' then
  622.         enable('main','sub')
  623.         handle_equipping_gear(player.status)
  624.         if newValue ~= 'None' then
  625.             equip(sets.weapons[state.CombatWeapon.value])
  626.             disable('main','sub')
  627.         end
  628.     elseif stateField == 'Combat Weapon' then
  629.         enable('main','sub')
  630.         if state.OffenseMode.value ~= 'None' then
  631.             equip(sets.weapons[state.CombatWeapon.value])
  632.             if state.CombatWeapon.value ~= 'None' then
  633.                 disable('main','sub')
  634.             end
  635.         end
  636.     end
  637. end
  638.  
  639. -------------------------------------------------------------------------------------------------------------------
  640. -- User code that supplements standard library decisions.
  641. -------------------------------------------------------------------------------------------------------------------
  642.  
  643. -- Custom spell mapping.
  644. function job_get_spell_map(spell, default_spell_map)
  645.     if spell.skill == 'Enfeebling Magic' then
  646.         -- Spells with variable potencies, divided into dINT and dMND spells.
  647.         -- These spells also benefit from RDM gear and WKR shoes.
  648.         if S{'Slow','Slow II','Paralyze','Paralyze II','Addle','Addle II',
  649.              'Distract','Distract II','Frazzle','Frazzle II'}:contains(spell.english) then
  650.             return "MndEnfeebles"
  651.         elseif S{'Blind','Blind II','Gravity','Gravity II'}:contains(spell.english) then
  652.             return "IntEnfeebles"
  653.         elseif S{'Poison II','Distract III','Frazzle III'}:contains(spell.english) then
  654.             return "SkillEnfeebles"
  655.         end
  656.     elseif spell.skill == 'Enhancing Magic' then
  657.         if  not S{'Erase','Phalanx','Stoneskin','Aquaveil','Temper','Temper II'}:contains(spell.english)
  658.         and not S{'Regen','Refresh','BarElement','BarStatus','EnSpell','StatBoost','Teleport'}:contains(default_spell_map) then
  659.             return "FixedPotencyEnhancing"
  660.         end
  661.     end
  662. end
  663.  
  664. -- Modify the default idle set after it was constructed.
  665. function customize_idle_set(idleSet)
  666.     if S{'Eastern Adoulin','Western Adoulin'}:contains(world.area) then
  667.         idleSet = set_combine(idleSet, {body="Councilor's Garb"})
  668.     end
  669.     if player.mpp > 80 then
  670.         idleSet = set_combine(idleSet, {ammo="Staunch Tathlum"})
  671.     end
  672.     if player.mpp < 51 then
  673.         idleSet = set_combine(idleSet, sets.latent_refresh)
  674.     end
  675.     if buffactive['Reive Mark'] then
  676.         idleSet = set_combine(idleSet, {neck="Arciela's Grace +1"})
  677.     end
  678.     if player.equipment.back == "Mecisto. Mantle" then
  679.         idleSet = set_combine(idleSet, {ring2="Capacity Ring"})
  680.     end
  681.     if state.Buff.Doom then
  682.         idleSet = set_combine(idleSet, sets.buff.Doom)
  683.     end
  684.     return idleSet
  685. end
  686.  
  687. -- Modify the default melee set after it was constructed.
  688. function customize_melee_set(meleeSet)
  689.     if buffactive['Reive Mark'] then
  690.         meleeSet = set_combine(meleeSet, {neck="Arciela's Grace +1"})
  691.     end
  692.     if state.CombatWeapon.value == 'None' then
  693.         meleeSet = sets.idle[state.IdleMode.value]
  694.         if player.mpp < 51 then
  695.             meleeSet = set_combine(meleeSet, sets.latent_refresh)
  696.         end
  697.     end
  698.     if state.Buff.Doom then
  699.         meleeSet = set_combine(meleeSet, sets.buff.Doom)
  700.     end
  701.     return meleeSet
  702. end
  703.  
  704. -- Function to display the current relevant user state when doing an update.
  705. function display_current_job_state(eventArgs)
  706.     local msg = ''
  707.     eventArgs.handled = true
  708.  
  709.     if state.OffenseMode.value ~= 'None' and state.CombatWeapon.value ~= 'None' then
  710.         msg = 'TP ['
  711.         msg = msg .. state.CombatWeapon.value
  712.         if state.OffenseMode.value ~= 'Normal' then
  713.             msg = msg .. '-' .. state.OffenseMode.value
  714.         end
  715.         if state.HybridMode.value ~= 'Normal' then
  716.             msg = msg .. '/' .. state.HybridMode.value
  717.         end
  718.         msg = msg .. '], '
  719.     end
  720.  
  721.     msg = msg .. 'Casting ['..state.CastingMode.value..']'
  722.     msg = msg .. ', Idle ['..state.IdleMode.value..']'
  723.     if player.sub_job == 'SCH' then
  724.         if buffactive['Light Arts'] or buffactive['Addendum: White'] then
  725.             msg = msg .. ', Light Arts'
  726.         elseif buffactive['Dark Arts'] or buffactive['Addendum: Black'] then
  727.             msg = msg .. ', Dark Arts'
  728.         else
  729.             msg = msg .. ', *No Grimoire*'
  730.         end
  731.     end
  732.     if state.Seidr.value then
  733.         msg = msg .. ', Seidr'
  734.     end
  735.     if state.MagicBurst.value then
  736.         msg = msg .. ', MB+'
  737.     end
  738.  
  739.     if state.DefenseMode.value ~= 'None' then
  740.         msg = msg .. ', ' .. 'Defense: ' .. state.DefenseMode.value .. ' (' .. state[state.DefenseMode.value .. 'DefenseMode'].value .. ')'
  741.     end
  742.     if state.Kiting.value == true then
  743.         msg = msg .. ', Kiting'
  744.     end
  745.     if state.PCTargetMode.value ~= 'default' then
  746.         msg = msg .. ', Target PC: '..state.PCTargetMode.value
  747.     end
  748.     if state.SelectNPCTargets.value == true then
  749.         msg = msg .. ', Target NPCs'
  750.     end
  751.  
  752.     add_to_chat(122, msg)
  753. end
  754.  
  755. -------------------------------------------------------------------------------------------------------------------
  756. -- User code that supplements self-commands.
  757. -------------------------------------------------------------------------------------------------------------------
  758.  
  759. -- Called for custom player commands.
  760. function job_self_command(cmdParams, eventArgs)
  761.     if player.sub_job == 'SCH' then
  762.         if cmdParams[1] == 'penuparsi' then
  763.             if buffactive['Light Arts'] or buffactive['Addendum: White'] then
  764.                 send_command('input /ja Penury <me>')
  765.             elseif buffactive['Dark Arts'] or buffactive['Addendum: Black'] then
  766.                 send_command('input /ja Parsimony <me>')
  767.             end
  768.             eventArgs.handled = true
  769.         elseif cmdParams[1] == 'celeralac' then
  770.             if buffactive['Light Arts'] or buffactive['Addendum: White'] then
  771.                 send_command('input /ja Celerity <me>')
  772.             elseif buffactive['Dark Arts'] or buffactive['Addendum: Black'] then
  773.                 send_command('input /ja Alacrity <me>')
  774.             end
  775.             eventArgs.handled = true
  776.         elseif cmdParams[1] == 'accemani' then
  777.             if buffactive['Light Arts'] or buffactive['Addendum: White'] then
  778.                 send_command('input /ja Accession <me>')
  779.             elseif buffactive['Dark Arts'] or buffactive['Addendum: Black'] then
  780.                 send_command('input /ja Manifestation <me>')
  781.             end
  782.             eventArgs.handled = true
  783.         end
  784.     end
  785.     if cmdParams[1] == 'MagicBurst' then
  786.         -- custom self-command used for enabling mid-cast
  787.         state.MagicBurst:toggle()
  788.         if state.MagicBurst.value then
  789.             if state.CastingMode.value == 'Resistant' then
  790.                 equip(sets.magicburst.Resistant)
  791.             else
  792.                 equip(sets.magicburst)
  793.             end
  794.             add_to_chat(122,'MagicBurst is now on.')
  795.         else
  796.             add_to_chat(122,'MagicBurst is now off.')
  797.         end
  798.     end
  799. end
  800.  
  801. -- Handle auto-targetting based on local setup.
  802. function job_auto_change_target(spell, action, spellMap, eventArgs)
  803.     if spell.target.raw == ('<stpc>') then
  804.         if S{'SELF','PLAYER'}:contains(player.target.type)
  805.         or 'NPC' == player.target.type then
  806.             if S{'Cure','Curaga','Regen'}:contains(spellMap)
  807.             or spell.targets.Party and spell.skill == 'Enhancing Magic' then
  808.                 -- Change some spells to use <t> instead of <stpc> when already targetting a player.
  809.                 -- <stpc> macros are convenient while engaged, but add delay in backline situations.
  810.                 change_target('<t>')
  811.                 eventArgs.handled = true
  812.             end
  813.         end
  814.     elseif spell.target.raw == ('<t>') and spell.targets.Enemy then
  815.         if not player.target.name
  816.         or S{'SELF','PLAYER'}:contains(player.target.type)
  817.         or 'NPC' == player.target.type then
  818.             if spell.skill ~= 'Healing Magic' then
  819.                 -- Change some enfeebles to fall back to <bt> when watching a player.
  820.                 change_target('<bt>')
  821.                 eventArgs.handled = true
  822.             end
  823.         end
  824.     end
  825. end
  826.  
  827. -------------------------------------------------------------------------------------------------------------------
  828. -- Utility functions specific to this job.
  829. -------------------------------------------------------------------------------------------------------------------
  830.  
  831. -- Select default macro book on initial load or subjob change.
  832. function select_default_macro_book()
  833.     set_macro_page(1,2)
  834.     send_command('bind ^l input /lockstyleset 2')
  835. end
  836.  
  837. function init_state_text()
  838.     local mb_text_settings = {flags={draggable=false}}
  839.     local hyb_text_settings = {pos={x=130,y=716},flags={draggable=false},bg={alpha=150},text={font='Courier New',size=10}}
  840.     local def_text_settings = {pos={x=172,y=716},flags={draggable=false},bg={alpha=150},text={font='Courier New',size=10}}
  841.     state.mb_text = texts.new('MBurst', mb_text_settings)
  842.     state.hyb_text = texts.new('/${hybrid}', hyb_text_settings)
  843.     state.def_text = texts.new('(${defense})', def_text_settings)
  844.  
  845.     state.texts_event_id = windower.register_event('prerender', function()
  846.         state.mb_text:visible(state.MagicBurst.value)
  847.         state.hyb_text:visible((state.HybridMode.value ~= 'Normal'))
  848.         state.def_text:visible((state.DefenseMode.value ~= 'None'))
  849.  
  850.         state.hyb_text:update({['hybrid']=state.HybridMode.value})
  851.  
  852.         local defMode = '---'
  853.         if state.DefenseMode.value ~= 'None' then
  854.             defMode = state[state.DefenseMode.value ..'DefenseMode'].current
  855.         end
  856.         state.def_text:update({['defense']=defMode})
  857.     end)
  858. end
  859.  
  860. function destroy_state_text()
  861.     windower.unregister_event(state.texts_event_id)
  862.     state.mb_text:visible(false)
  863.     state.hyb_text:visible(false)
  864.     state.def_text:visible(false)
  865.     texts.destroy(state.mb_text)
  866.     texts.destroy(state.hyb_text)
  867.     texts.destroy(state.def_text)
  868. end
RAW Paste Data