Boposhopo

SMN Lua

Jul 14th, 2025
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 48.63 KB | Gaming | 0 0
  1. -------------------------------------------------------------------------------------------------------------------
  2. -- Setup functions for this job.  Generally should not be modified.
  3. -------------------------------------------------------------------------------------------------------------------
  4.  
  5. -- Initialization function for this job file.
  6. function get_sets()
  7.     mote_include_version = 2
  8.  
  9.     -- Load and initialize the include file.
  10.     include('Mote-Include.lua')
  11. end
  12.  
  13. -- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
  14. function job_setup()
  15.     state.Buff["Avatar's Favor"] = buffactive["Avatar's Favor"] or false
  16.     state.Buff["Astral Conduit"] = buffactive["Astral Conduit"] or false
  17.  
  18.     spirits = S{"LightSpirit", "DarkSpirit", "FireSpirit", "EarthSpirit", "WaterSpirit", "AirSpirit", "IceSpirit", "ThunderSpirit"}
  19.     avatars = S{"Carbuncle", "Fenrir", "Diabolos", "Ifrit", "Titan", "Leviathan", "Garuda", "Shiva", "Ramuh", "Odin", "Alexander", "Cait Sith"}
  20.  
  21.     magicalRagePacts = S{
  22.         'Inferno','Earthen Fury','Tidal Wave','Aerial Blast','Diamond Dust','Judgment Bolt','Searing Light','Howling Moon','Ruinous Omen',
  23.         'Fire II','Stone II','Water II','Aero II','Blizzard II','Thunder II',
  24.         'Fire IV','Stone IV','Water IV','Aero IV','Blizzard IV','Thunder IV',
  25.         'Thunderspark','Meteorite','Nether Blast',
  26.         'Meteor Strike','Heavenly Strike','Wind Blade','Geocrush','Grand Fall','Thunderstorm',
  27.         'Holy Mist','Lunar Bay','Night Terror','Level ? Holy','Conflag Strike'}
  28.    
  29.     enticersRagePacts = S{'Double Punch','Rock Buster','Mountain Buster','Tail Whip','Claw','Predator Claws','Axe Kick','Shock Strike','Chaotic Strike','Volt Strike','Blindside','Crescent Fang','Eclipse Bite'}
  30.    
  31.     pacts = {}
  32.     pacts.cure = {['Carbuncle']='Healing Ruby'}
  33.     pacts.curaga = {['Carbuncle']='Healing Ruby II', ['Garuda']='Whispering Wind', ['Leviathan']='Spring Water'}
  34.     pacts.buffoffense = {['Carbuncle']='Glittering Ruby', ['Ifrit']='Crimson Howl', ['Garuda']='Hastega II', ['Shiva']='Crystal Blessing', ['Ramuh']='Rolling Thunder',
  35.         ['Fenrir']='Ecliptic Growl', ['Siren']='Katabatic Blades'}
  36.     pacts.buffdefense = {['Carbuncle']='Shining Ruby', ['Shiva']='Frost Armor', ['Garuda']='Aerial Armor', ['Titan']='Earthen Ward',
  37.         ['Ramuh']='Lightning Armor', ['Fenrir']='Ecliptic Howl', ['Diabolos']='Noctoshield', ['Cait Sith']='Reraise II', ['Siren']="Wind's Blessing"}
  38.     pacts.buffspecial = {['Ifrit']='Inferno Howl', ['Garuda']='Fleet Wind', ['Titan']='Earthen Armor', ['Leviathan']='Soothing Current', ['Diabolos']='Dream Shroud',
  39.         ['Carbuncle']='Soothing Ruby', ['Fenrir']='Heavenward Howl', ['Cait Sith']='Raise II', ['Siren']='Chinook'}
  40.     pacts.debuff1 = {['Shiva']='Diamond Storm', ['Ramuh']='Shock Squall', ['Leviathan']='Tidal Roar', ['Fenrir']='Lunar Cry',
  41.         ['Diabolos']='Pavor Nocturnus', ['Cait Sith']='Eerie Eye', ['Siren']='Lunatic Voice'}
  42.     pacts.debuff2 = {['Shiva']='Sleepga', ['Leviathan']='Slowga', ['Fenrir']='Lunar Roar', ['Diabolos']='Somnolence', ['Siren']='Bitter Elegy'}
  43.     pacts.sleep = {['Shiva']='Sleepga', ['Diabolos']='Nightmare', ['Cait Sith']='Mewing Lullaby'}
  44.     pacts.nuke2 = {['Ifrit']='Fire II', ['Shiva']='Blizzard II', ['Garuda']='Aero II', ['Titan']='Stone II',
  45.         ['Ramuh']='Thunder II', ['Leviathan']='Water II'}
  46.     pacts.nuke4 = {['Ifrit']='Fire IV', ['Shiva']='Blizzard IV', ['Garuda']='Aero IV', ['Titan']='Stone IV',
  47.         ['Ramuh']='Thunder IV', ['Leviathan']='Water IV', ['Siren']='Tornado II'}
  48.     pacts.bp70 = {['Ifrit']='Flaming Crush', ['Shiva']='Rush', ['Garuda']='Predator Claws', ['Titan']='Mountain Buster',
  49.         ['Ramuh']='Chaotic Strike', ['Leviathan']='Spinning Dive', ['Carbuncle']='Meteorite', ['Fenrir']='Eclipse Bite',
  50.         ['Diabolos']='Nether Blast',['Cait Sith']='Regal Scratch', ['Siren']='Hysteric Assault'}
  51.     pacts.bp75 = {['Ifrit']='Meteor Strike', ['Shiva']='Heavenly Strike', ['Garuda']='Wind Blade', ['Titan']='Geocrush',
  52.         ['Ramuh']='Thunderstorm', ['Leviathan']='Grand Fall', ['Carbuncle']='Holy Mist', ['Fenrir']='Lunar Bay',
  53.         ['Diabolos']='Night Terror', ['Cait Sith']='Level ? Holy', ['Siren']='Sonic Buffet'}
  54.     pacts.astralflow = {['Ifrit']='Inferno', ['Shiva']='Diamond Dust', ['Garuda']='Aerial Blast', ['Titan']='Earthen Fury',
  55.         ['Ramuh']='Judgment Bolt', ['Leviathan']='Tidal Wave', ['Carbuncle']='Searing Light', ['Fenrir']='Howling Moon',
  56.         ['Diabolos']='Ruinous Omen', ['Cait Sith']="Altana's Favor", ['Siren']='Clarsach Call'}
  57.    
  58.     HybridRagePacts = S{
  59.         'Burning Strike','Flaming Crush'}
  60.  
  61.     FlowPacts = S{
  62.         'Perfect Defense'}
  63.  
  64.     -- Wards table for creating custom timers  
  65.         wards = {}
  66.     -- Base duration for ward pacts.
  67.         wards.durations = {
  68.         ['Crimson Howl'] = 60, ['Earthen Armor'] = 60, ['Inferno Howl'] = 60, ['Heavenward Howl'] = 60,
  69.         ['Rolling Thunder'] = 120, ['Fleet Wind'] = 120,
  70.         ['Shining Ruby'] = 180, ['Frost Armor'] = 180, ['Lightning Armor'] = 180, ['Ecliptic Growl'] = 180,
  71.         ['Glittering Ruby'] = 180, ['Hastega'] = 180, ['Hastega II'] = 180, ['Noctoshield'] = 180, ['Ecliptic Howl'] = 180,
  72.         ['Dream Shroud'] = 180, ['Crystal Blessing'] = 180, ['Soothing Current'] = 180, ['Reraise II'] = 3600
  73.     }
  74.    
  75.     wards.icons = {
  76.         ['Earthen Armor']   = 'spells/00299.png', -- 00299 for Titan
  77.         ['Shining Ruby']    = 'spells/00043.png', -- 00043 for Protect
  78.         ['Dream Shroud']    = 'spells/00304.png', -- 00304 for Diabolos
  79.         ['Noctoshield']     = 'spells/00106.png', -- 00106 for Phalanx
  80.         ['Inferno Howl']    = 'spells/00298.png', -- 00298 for Ifrit
  81.         ['Hastega']         = 'spells/00357.png', -- 00357 for Hastega
  82.         ['Hastega II']      = 'spells/00358.png', -- 00358 for Hastega II      
  83.         ['Rolling Thunder'] = 'spells/00104.png', -- 00358 for Enthunder
  84.         ['Frost Armor']     = 'spells/00250.png', -- 00250 for Ice Spikes
  85.         ['Lightning Armor'] = 'spells/00251.png', -- 00251 for Shock Spikes
  86.         ['Fleet Wind']      = 'spells/00301.png', -- 00301 for Garuda
  87.         ['Crystal Blessing']= 'spells/00020.png', -- 00020 for TP bonus
  88.         ['Soothing Current']= 'spells/00183.png', -- 00183 for Healing Bonus
  89.     }
  90.    
  91.     -- Special rules showing the remaining time of Perfect Defense.
  92.     -- Duration is calculated as follows: [30s + Floor(Summoning Magic Skill/20)s], adjust the time below to reflect your own skill.
  93.     -- Base duration at level 99 with capped skill (417) is 51 seconds, max obtainable time is 60 seconds at 600 skill. (Currently unreachable in game.)
  94.     durations = {}
  95.         durations['Perfect Defense'] = 58
  96.  
  97.     timer_icons = {}
  98.     timer_icons['Perfect Defense'] = 'spells/00306.png' -- 00306 for Perfect Defense
  99.  
  100.     -- Flags for code to get around the issue of slow skill updates.
  101.     wards.flag = false
  102.     wards.spell = ''
  103.    
  104. end
  105.  
  106. -------------------------------------------------------------------------------------------------------------------
  107. -- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
  108. -------------------------------------------------------------------------------------------------------------------
  109.  
  110. -- Setup vars that are user-dependent.  Can override this function in a sidecar file.
  111. function user_setup()
  112.     state.OffenseMode:options('Normal', 'Acc')
  113.     state.CastingMode:options('Normal', 'Resistant')
  114.     state.IdleMode:options('Normal', 'PDT')
  115.  
  116.     gear.perp_staff = {name="Nirvana"}
  117.    
  118.     select_default_macro_book()
  119.    
  120.     send_command('wait 6;input /lockstyleset 4')
  121. end
  122.  
  123.  
  124. -- Define sets and vars used by this job file.
  125. function init_gear_sets()
  126.     --------------------------------------
  127.     -- Precast Sets
  128.     --------------------------------------
  129.    
  130.     -- Precast sets to enhance JAs
  131.     sets.precast.JA['Astral Flow'] = {head="Glyphic Horn +1"}
  132.    
  133.     sets.precast.JA['Elemental Siphon'] = {        
  134.         main="Chatoyant Staff",
  135.         sub="Elan strap +1",
  136.         ammo="Sancus Sachet +1",
  137.         head="Con. Horn +1",
  138.         neck="Caller's Pendant",
  139.         body="Beckoner's Doublet +2",
  140.         hands="Lamassu Mitts +1",
  141.         right_ear="Andoaa Earring",
  142.         lring="Evoker's Ring",
  143.         rring="Globidonta Ring",
  144.         back={ name="Conveyance Cape", augments={'Summoning magic skill +2','Pet: Enmity+11','Blood Pact Dmg.+2','Blood Pact ab. del. II -3',}},
  145.         waist="Lucidity Sash",
  146.         legs="Beckoner's Spats +2",
  147.         feet="Beck. Pigaches +2"}
  148.  
  149.     sets.precast.JA['Mana Cede'] = {hands="Beck. Bracers +1"}
  150.  
  151.     -- Pact delay reduction gear
  152.     sets.precast.BloodPactWard = {
  153.         ammo="Sancus Sachet +1",
  154.         head="Beckoner's Horn +3",
  155.         body="Con. Doublet +3",
  156.         hands="Lamassu Mitts +1",
  157.         legs="Beck. Spats +2",
  158.         feet="Baayami Sabots +1",
  159.         neck="Caller's Pendant",
  160.         waist="Lucidity Sash",
  161.         left_ear="Andoaa Earring",
  162.         right_ear="Evans Earring",
  163.         right_ring="Globidonta Ring",
  164.         left_ring="Evoker's Ring",
  165.         back={ name="Conveyance Cape", augments={'Summoning magic skill +2','Pet: Enmity+11','Blood Pact Dmg.+2','Blood Pact ab. del. II -3',}},}
  166.  
  167.     sets.precast.BloodPactRage = set_combine(sets.precast.BloodPactWard, {})
  168.  
  169.     -- Fast cast sets for spells
  170.    
  171.     sets.precast.FC = {
  172.         ammo="Sancus Sachet +1",
  173.         head="Bunzi's Hat",
  174.         body="Inyanga Jubbah +2",
  175.         hands={ name="Telchine Gloves", augments={'"Fast Cast"+5','Enh. Mag. eff. dur. +10',}},
  176.         legs="Volte Brais",
  177.         feet={ name="Telchine Pigaches", augments={'"Fast Cast"+4','Enh. Mag. eff. dur. +10',}},
  178.         neck="Loricate Torque +1",
  179.         waist="Embla Sash",
  180.         left_ear="Loquac. Earring",
  181.         right_ear="Malignance Earring",
  182.         left_ring="Kishar Ring",
  183.         right_ring={ name="Gelatinous Ring +1", augments={'Path: A',}},
  184.         back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Pet: Attack+10 Pet: Rng.Atk.+10','"Fast Cast"+10',}},}
  185.  
  186.     sets.precast.FC['Enhancing Magic'] = set_combine(sets.precast.FC, {waist="Siegel Sash"})
  187.    
  188.     sets.precast.Cure = set_combine(sets.precast.FC,{body="Heka's Kalasiris",back="Pahtli cape",legs="Nabu's shalwar"})
  189.  
  190.        
  191.     -- Weaponskill sets
  192.     -- Default set for any weaponskill that isn't any more specifically defined
  193.     sets.precast.WS = {ammo="Sancus Sachet +1",
  194.         head="Nyame Helm",
  195.         body="Nyame Mail",
  196.         hands="Bunzi's Gloves",
  197.         legs="Nyame Flanchard",
  198.         feet="Nyame Sollerets",
  199.         neck="Fotia Gorget",
  200.         waist="Eschan Stone",
  201.         left_ear="Friomisi Earring",
  202.         right_ear="Malignance Earring",
  203.         left_ring="Metamor. Ring +1",
  204.         right_ring="Freke Ring",
  205.         back={ name="Campestres's Cape", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%','Phys. dmg. taken-10%',}},}
  206.  
  207.  
  208.     -- Specific weaponskill sets.  Uses the base set if an appropriate WSMod version isn't found.
  209.     sets.precast.WS['Myrkr'] = {}
  210.        
  211.     sets.precast.WS['Shell Crusher'] = {ammo={ name="Hesperiidae", augments={'Path: A',}},
  212.         head="Beckoner's Horn +3",
  213.         body="Beck. Doublet +3",
  214.         hands={ name="Nyame Gauntlets", augments={'Path: B',}},
  215.         legs="Beck. Spats +3",
  216.         feet="Beck. Pigaches +3",
  217.         neck="Fotia Gorget",
  218.         waist="Fotia Belt",
  219.         left_ear="Crep. Earring",
  220.         right_ear="Telos Earring",
  221.         left_ring="Rufescent Ring",
  222.         right_ring="Chirich Ring +1",
  223.         back={ name="Campestres's Cape", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%','Phys. dmg. taken-10%',}},}
  224.  
  225.     sets.precast.WS['Garland of Bliss'] = {ammo="Sancus Sachet +1",
  226.         head="Nyame Helm",
  227.         body="Nyame Mail",
  228.         hands="Nyame Gauntlets",
  229.         legs="Nyame Flanchard",
  230.         feet="Nyame Sollerets",
  231.         neck="Fotia Gorget",
  232.         waist="Fotia Belt",
  233.         left_ear="Friomisi Earring",
  234.         right_ear="Malignance Earring",
  235.         left_ring="Metamor. Ring +1",
  236.         right_ring="Freke Ring",
  237.         back={ name="Campestres's Cape", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%','Phys. dmg. taken-10%',}},}
  238.        
  239.     sets.precast.WS['Black Halo'] = {ammo="Oshasha's Treatise",
  240.         head={ name="Nyame Helm", augments={'Path: B',}},
  241.         body={ name="Nyame Mail", augments={'Path: B',}},
  242.         hands="Nyame Gauntlets",
  243.         legs={ name="Nyame Flanchard", augments={'Path: B',}},
  244.         feet={ name="Nyame Sollerets", augments={'Path: B',}},
  245.         neck="Rep. Plat. Medal",
  246.         waist="Cornelia's Belt",
  247.         left_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
  248.         right_ear="Ishvara Earring",
  249.         left_ring={ name="Metamor. Ring +1", augments={'Path: A',}},
  250.         right_ring="Rufescent Ring",
  251.         back={ name="Campestres's Cape", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%','Phys. dmg. taken-10%',}},}
  252.        
  253.     sets.precast.WS['Oshala'] = {ammo="Oshasha's Treatise",
  254.         head={ name="Nyame Helm", augments={'Path: B',}},
  255.         body={ name="Nyame Mail", augments={'Path: B',}},
  256.         hands="Nyame Gauntlets",
  257.         legs={ name="Nyame Flanchard", augments={'Path: B',}},
  258.         feet={ name="Nyame Sollerets", augments={'Path: B',}},
  259.         neck="Fotia Gorget",
  260.         waist="Fotia Belt",
  261.         left_ear="Ishvara Earring",
  262.         right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
  263.         left_ring={ name="Metamor. Ring +1", augments={'Path: A',}},
  264.         right_ring="Epaminondas's Ring",
  265.         back={ name="Campestres's Cape", augments={'STR+20','Accuracy+20 Attack+20','STR+10','Weapon skill damage +10%','Phys. dmg. taken-10%',}},}
  266.     --------------------------------------
  267.     -- Midcast sets
  268.     --------------------------------------
  269.  
  270.     sets.midcast.FastRecast = {
  271.         ammo="Sancus Sachet +1",
  272.         head="Bunzi's Hat",
  273.         body="Baayami Robe +1",
  274.         hands={ name="Telchine Gloves", augments={'"Fast Cast"+5','Enh. Mag. eff. dur. +10',}},
  275.         legs="Volte Brais",
  276.         feet={ name="Telchine Pigaches", augments={'"Fast Cast"+4','Enh. Mag. eff. dur. +10',}},
  277.         neck="Loricate Torque +1",
  278.         waist="Embla Sash",
  279.         left_ear="Loquac. Earring",
  280.         right_ear="Malignance Earring",
  281.         left_ring="Kishar Ring",
  282.         right_ring={ name="Gelatinous Ring +1", augments={'Path: A',}},
  283.         back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Pet: Attack+10 Pet: Rng.Atk.+10','"Fast Cast"+10',}},}
  284.  
  285.     sets.midcast.Cure = {ammo="Sancus Sachet +1",
  286.         head={ name="Vanya Hood", augments={'Healing magic skill +20','"Cure" spellcasting time -7%','Magic dmg. taken -3',}},
  287.         body="Bunzi's Robe",
  288.         hands={ name="Telchine Gloves", augments={'"Fast Cast"+5','Enh. Mag. eff. dur. +10',}},
  289.         legs={ name="Telchine Braconi", augments={'"Cure" potency +8%','Enh. Mag. eff. dur. +9',}},
  290.         feet={ name="Vanya Clogs", augments={'Healing magic skill +20','"Cure" spellcasting time -7%','Magic dmg. taken -3',}},
  291.         neck="Nodens Gorget",
  292.         waist="Luminary Sash",
  293.         left_ear="Malignance Earring",
  294.         right_ear="Mendi. Earring",
  295.         left_ring="Stikini Ring",
  296.         right_ring="Stikini Ring",
  297.         back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Pet: Attack+10 Pet: Rng.Atk.+10','"Fast Cast"+10',}},}
  298.  
  299.     sets.midcast.Stoneskin = {head="Umuthi hat", ear1="Andoaa earring", waist="Siegel Sash"}
  300.  
  301.     sets.midcast['Elemental Magic'] = {}
  302.  
  303.     sets.midcast['Dark Magic'] = {}
  304.  
  305.     -- Avatar pact sets.  All pacts are Ability type.
  306.     -- Perfect Defense
  307.     sets.midcast.Pet.Alexander = {ammo="Sancus Sachet +1",
  308.         head="Beckoner's Horn +3",
  309.         body="Baayami Robe +1",
  310.         hands="Baayami Cuffs +1",
  311.         legs="Beck. Spats +3",
  312.         feet="Baaya. Sabots +1",
  313.         neck="Caller's Pendant",
  314.         waist="Kobo Obi",
  315.         left_ear="C. Palug Earring",
  316.         right_ear="Andoaa Earring",
  317.         left_ring="Stikini Ring",
  318.         right_ring="Stikini Ring",
  319.         back={ name="Conveyance Cape", augments={'Summoning magic skill +2','Pet: Enmity+11','Blood Pact Dmg.+2','Blood Pact ab. del. II -3',}},}
  320.    
  321.     sets.midcast.Pet.BloodPactWard = {
  322.         ammo="Epitaph",
  323.         head="Beckoner's Horn +3",
  324.         body="Baayami Robe +1",
  325.         hands="Baayami Cuffs +1",
  326.         legs="Beck. Spats +3",
  327.         feet="Baayami Sabots +1",
  328.         neck="Caller's Pendant",
  329.         waist="Lucidity Sash",
  330.         left_ear="Andoaa Earring",
  331.         right_ear="C. Palug Earring",
  332.         left_ring="Evoker's Ring",
  333.         right_ring="Globidonta Ring",
  334.         back={ name="Conveyance Cape", augments={'Summoning magic skill +2','Pet: Enmity+11','Blood Pact Dmg.+2','Blood Pact ab. del. II -3',}},}      
  335.  
  336.     sets.midcast.Pet.DebuffBloodPactWard = {
  337.         ammo="Epitaph",
  338.         head="Beckoner's Horn +3",
  339.         body="Baayami Robe +1",
  340.         hands="Baayami Cuffs +1",
  341.         legs="Beck. Spats +3",
  342.         feet="Baayami Sabots +1",
  343.         neck="Caller's Pendant",
  344.         waist="Lucidity Sash",
  345.         left_ear="Andoaa Earring",
  346.         right_ear="C. Palug Earring",
  347.         left_ring="Evoker's Ring",
  348.         right_ring="Globidonta Ring",
  349.         back={ name="Campestres's Cape", augments={'Pet: M.Acc.+20 Pet: M.Dmg.+20','Pet: Magic Damage+8','Pet: "Regen"+10',}},}
  350.        
  351.     sets.midcast.Pet.DebuffBloodPactWard.Acc = set_combine(sets.midcast.Pet.DebuffBloodPactWard, {})
  352.    
  353.     sets.midcast.Pet.PhysicalBloodPactRage = {
  354.         ammo="Epitaph",
  355.         head={ name="Apogee Crown +1", augments={'MP+80','Pet: Attack+35','Blood Pact Dmg.+8',}},
  356.         body="Con. Doublet +3",
  357.         hands={ name="Merlinic Dastanas", augments={'Pet: Attack+17 Pet: Rng.Atk.+17','Blood Pact Dmg.+9','Pet: MND+3','Pet: Mag. Acc.+4','Pet: "Mag.Atk.Bns."+6',}},
  358.         legs={ name="Apogee Slacks +1", augments={'Pet: STR+20','Blood Pact Dmg.+14','Pet: "Dbl. Atk."+4',}},
  359.         feet={ name="Apogee Pumps +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
  360.         neck={ name="Smn. Collar +1", augments={'Path: A',}},
  361.         waist="Incarnation Sash",
  362.         left_ear="Kyrene's Earring",
  363.         right_ear="Lugalbanda Earring",
  364.         left_ring="Varar Ring +1",
  365.         right_ring="C. Palug Ring",
  366.         back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Pet: Attack+10 Pet: Rng.Atk.+10','"Fast Cast"+10',}},}
  367.        
  368.     sets.midcast.Pet.EnticersBloodPactRage = set_combine(sets.midcast.Pet.PhysicalBloodPactRage, {legs="Enticer's pants"})
  369.  
  370.     sets.midcast.Pet.PhysicalBloodPactRage.Acc = set_combine(sets.midcast.Pet.PhysicalBloodPactRage, {})
  371.  
  372.     sets.midcast.Pet.MagicalBloodPactRage = {
  373.         ammo="Epitaph",
  374.         head="C. Palug Crown",
  375.         body="Apogee Dalmatica +1",
  376.         hands={ name="Merlinic Dastanas", augments={'Pet: Mag. Acc.+24 Pet: "Mag.Atk.Bns."+24','Blood Pact Dmg.+8','Pet: MND+3','Pet: Mag. Acc.+9','Pet: "Mag.Atk.Bns."+11',}},
  377.         legs={ name="Enticer's Pants", augments={'MP+40','Pet: Mag. Acc.+9','Pet: Damage taken -2%',}},
  378.         feet={ name="Apogee Pumps +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
  379.         neck={ name="Smn. Collar +1", augments={'Path: A',}},
  380.         waist="Regal Belt",
  381.         left_ear="Gelos Earring",
  382.         right_ear="Lugalbanda Earring",
  383.         left_ring="Varar Ring +1",
  384.         right_ring="Varar Ring +1",
  385.         back={ name="Campestres's Cape", augments={'Pet: M.Acc.+20 Pet: M.Dmg.+20','Pet: Magic Damage+8','Pet: "Regen"+10',}},}
  386.  
  387.     sets.midcast.Pet.MagicalBloodPactRage.Acc = set_combine(sets.midcast.Pet.MagicalBloodPactRage, {})
  388.  
  389.     sets.midcast.Pet.HybridBloodPactRage = {
  390.         ammo={ name="Epitaph", augments={'Path: A',}},
  391.         head="C. Palug Crown",
  392.         body={ name="Apo. Dalmatica +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
  393.         hands={ name="Merlinic Dastanas", augments={'Pet: Mag. Acc.+24 Pet: "Mag.Atk.Bns."+24','Blood Pact Dmg.+8','Pet: MND+3','Pet: Mag. Acc.+9','Pet: "Mag.Atk.Bns."+11',}},
  394.         legs={ name="Apogee Slacks +1", augments={'Pet: STR+20','Blood Pact Dmg.+14','Pet: "Dbl. Atk."+4',}},
  395.         feet={ name="Apogee Pumps +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
  396.         neck={ name="Smn. Collar +1", augments={'Path: A',}},
  397.         waist="Regal Belt",
  398.         left_ear="Gelos Earring",
  399.         right_ear="Lugalbanda Earring",
  400.         left_ring="Varar Ring +1",
  401.         right_ring="C. Palug Ring",
  402.         back={ name="Campestres's Cape", augments={'Pet: M.Acc.+20 Pet: M.Dmg.+20','Pet: Magic Damage+8','Pet: "Regen"+10',}},}
  403.        
  404.     sets.midcast.Pet.CuragaBloodPactWard = {ammo={ name="Epitaph", augments={'Path: A',}},
  405.         head={ name="Apogee Crown +1", augments={'MP+80','Pet: Attack+35','Blood Pact Dmg.+8',}},
  406.         body="Shomonjijoe +1",
  407.         hands={ name="Apogee Mitts", augments={'MP+60','Pet: Attack+30','Blood Pact Dmg.+7',}},
  408.         legs={ name="Enticer's Pants", augments={'MP+40','Pet: Mag. Acc.+9','Pet: Damage taken -2%',}},
  409.         feet={ name="Apogee Pumps +1", augments={'MP+80','Pet: "Mag.Atk.Bns."+35','Blood Pact Dmg.+8',}},
  410.         neck={ name="Smn. Collar +1", augments={'Path: A',}},
  411.         waist="Regal Belt",
  412.         back={ name="Campestres's Cape", augments={'Pet: M.Acc.+20 Pet: M.Dmg.+20','Pet: Magic Damage+8','Pet: "Regen"+10',}},}
  413.        
  414.     sets.midcast.Pet.CureBloodPactWard = set_combine(sets.midcast.Pet.CuragaBloodPactWard, {})
  415.        
  416.     sets.midcast.Pet["Wind's Blessing"] = {ammo={ name="Epitaph", augments={'Path: A',}},
  417.         head="Beckoner's Horn +3",
  418.         body="Shomonjijoe +1",
  419.         hands={ name="Lamassu Mitts +1", augments={'Path: A',}},
  420.         legs="Assiduity Pants +1",
  421.         feet="Baayami Sabots +1",
  422.         neck="Caller's Pendant",
  423.         waist="Lucidity Sash",
  424.         left_ear="C. Palug Earring",
  425.         right_ear="Andoaa Earring",
  426.         left_ring="Evoker's Ring",
  427.         right_ring="Globidonta Ring",
  428.         back={ name="Campestres's Cape", augments={'Pet: M.Acc.+20 Pet: M.Dmg.+20','Pet: Magic Damage+8','Pet: "Regen"+10',}},}
  429.  
  430.     -- Spirits cast magic spells, which can be identified in standard ways.
  431.    
  432.     sets.midcast.Pet.WhiteMagic = {ring1="Sheltered ring",legs="Glyphic Spats +1"}
  433.    
  434.     sets.midcast.Pet['Elemental Magic'] = set_combine(sets.midcast.Pet.MagicalBloodPactRage, {body="Shomonjijoe +1",legs="Glyphic Spats +1"})
  435.  
  436.     sets.midcast.Pet['Elemental Magic'].Resistant = {}
  437.    
  438.  
  439.     --------------------------------------
  440.     -- Idle/resting/defense/etc sets
  441.     --------------------------------------
  442.    
  443.     -- Resting sets
  444.     sets.resting = {
  445.         ammo="Sancus Sachet +1",
  446.         head="Beckoner's Horn +3",
  447.         body="Shomonjijoe +1",
  448.         hands={ name="Nyame Gauntlets", augments={'Path: B',}},
  449.         legs={ name="Nyame Flanchard", augments={'Path: B',}},
  450.         feet="Baayami Sabots +1",
  451.         neck={ name="Unmoving Collar +1", augments={'Path: A',}},
  452.         waist="Carrier's Sash",
  453.         left_ear="Etiolation Earring",
  454.         right_ear="Infused Earring",
  455.         left_ring="Defending Ring",
  456.         right_ring={ name="Gelatinous Ring +1", augments={'Path: A',}},
  457.         back={ name="Campestres's Cape", augments={'Pet: M.Acc.+20 Pet: M.Dmg.+20','Pet: Magic Damage+8','Pet: "Regen"+10',}},}
  458.    
  459.     -- Idle sets
  460.     sets.idle = {
  461.         ammo="Sancus Sachet +1",
  462.         head="Beckoner's Horn +3",
  463.         body="Beck. Doublet +3",
  464.         hands="Asteria Mitts +1",
  465.         legs={ name="Assid. Pants +1", augments={'Path: A',}},
  466.         feet="Beck. Pigaches +3",
  467.         neck={ name="Smn. Collar +1", augments={'Path: A',}},
  468.         waist="Carrier's Sash",
  469.         left_ear="C. Palug Earring",
  470.         right_ear={ name="Beck. Earring +2", augments={'System: 1 ID: 1676 Val: 0','Pet: Accuracy+16 Pet: Rng. Acc.+16','Pet: Mag. Acc.+16','Damage taken-6%','Pet: "Store TP"+6',}},
  471.         left_ring="Defending Ring",
  472.         right_ring="Shneddick Ring",
  473.         back={ name="Campestres's Cape", augments={'Pet: M.Acc.+20 Pet: M.Dmg.+20','Pet: Magic Damage+8','Pet: "Regen"+10',}},}
  474.  
  475.     sets.idle.Town = {
  476.         ammo="Sancus Sachet +1",
  477.         head="Beckoner's Horn +3",
  478.         body="Beck. Doublet +3",
  479.         hands="Asteria Mitts +1",
  480.         legs={ name="Assid. Pants +1", augments={'Path: A',}},
  481.         feet="Beck. Pigaches +3",
  482.         neck={ name="Smn. Collar +1", augments={'Path: A',}},
  483.         waist="Carrier's Sash",
  484.         left_ear="C. Palug Earring",
  485.         right_ear={ name="Beck. Earring +2", augments={'System: 1 ID: 1676 Val: 0','Pet: Accuracy+16 Pet: Rng. Acc.+16','Pet: Mag. Acc.+16','Damage taken-6%','Pet: "Store TP"+6',}},
  486.         left_ring="Defending Ring",
  487.         right_ring="Shneddick Ring",
  488.         back={ name="Campestres's Cape", augments={'Pet: M.Acc.+20 Pet: M.Dmg.+20','Pet: Magic Damage+8','Pet: "Regen"+10',}},}
  489.        
  490.     sets.idle.PDT = {ammo="Sancus Sachet +1",
  491.         head="Beckoner's Horn +3",
  492.         body="Beck. Doublet +3",
  493.         hands={ name="Nyame Gauntlets", augments={'Path: B',}},
  494.         legs={ name="Nyame Flanchard", augments={'Path: B',}},
  495.         feet="Baaya. Sabots +1",
  496.         neck="Loricate Torque +1",
  497.         waist="Carrier's Sash",
  498.         left_ear="Etiolation Earring",
  499.         right_ear="Infused Earring",
  500.         left_ring="Defending Ring",
  501.         right_ring="Shneddick Ring",
  502.         back={ name="Campestres's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Store TP"+10','Phys. dmg. taken-10%',}},}
  503.  
  504.     -- perp costs:
  505.     -- spirits: 7
  506.     -- carby/Cait Sith: 11
  507.     -- fenrir: 13
  508.     -- others: 15
  509.    
  510.     sets.idle.Avatar = {
  511.         ammo="Sancus Sachet +1",
  512.         head="Beckoner's Horn +3",
  513.         body="Beck. Doublet +3",
  514.         hands="Asteria Mitts +1",
  515.         legs={ name="Assid. Pants +1", augments={'Path: A',}},
  516.         feet="Beck. Pigaches +3",
  517.         neck={ name="Smn. Collar +1", augments={'Path: A',}},
  518.         waist="Carrier's Sash",
  519.         left_ear="C. Palug Earring",
  520.         right_ear={ name="Beck. Earring +2", augments={'System: 1 ID: 1676 Val: 0','Pet: Accuracy+16 Pet: Rng. Acc.+16','Pet: Mag. Acc.+16','Damage taken-6%','Pet: "Store TP"+6',}},
  521.         left_ring="Defending Ring",
  522.         right_ring="Shneddick Ring",
  523.         back={ name="Campestres's Cape", augments={'Pet: M.Acc.+20 Pet: M.Dmg.+20','Pet: Magic Damage+8','Pet: "Regen"+10',}},}
  524.  
  525.     sets.idle.PDT.Avatar = {ammo="Sancus Sachet +1",
  526.         head="Beckoner's Horn +3",
  527.         body="Beck. Doublet +3",
  528.         hands={ name="Nyame Gauntlets", augments={'Path: B',}},
  529.         legs={ name="Nyame Flanchard", augments={'Path: B',}},
  530.         feet="Baaya. Sabots +1",
  531.         neck="Loricate Torque +1",
  532.         waist="Carrier's Sash",
  533.         left_ear="Etiolation Earring",
  534.         right_ear="Infused Earring",
  535.         left_ring="Defending Ring",
  536.         right_ring="Shneddick Ring",
  537.         back={ name="Campestres's Cape", augments={'Pet: M.Acc.+20 Pet: M.Dmg.+20','Pet: Magic Damage+8','Pet: "Regen"+10',}},}
  538.  
  539.     sets.idle.Spirit = {ammo="Sancus Sachet +1",
  540.         head="Beckoner's Horn +3",
  541.         body="Beck. Doublet +3",
  542.         hands={ name="Nyame Gauntlets", augments={'Path: B',}},
  543.         legs={ name="Nyame Flanchard", augments={'Path: B',}},
  544.         feet="Baaya. Sabots +1",
  545.         neck="Loricate Torque +1",
  546.         waist="Carrier's Sash",
  547.         left_ear="Etiolation Earring",
  548.         right_ear="Infused Earring",
  549.         left_ring="Defending Ring",
  550.         right_ring="Shneddick Ring",
  551.         back={ name="Campestres's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Store TP"+10','Phys. dmg. taken-10%',}},}
  552.  
  553.     -- Favor uses Caller's Horn instead of Con. Horn +1 for refresh
  554.     sets.idle.Avatar.Favor = {head="Beckoner's Horn +3",}
  555.  
  556.  
  557.     sets.idle.Avatar.Melee = {ammo="Sancus Sachet +1",
  558.         head="Beckoner's Horn +3",
  559.         body="Beck. Doublet +2",
  560.         hands={ name="Nyame Gauntlets", augments={'Path: B',}},
  561.         legs={ name="Nyame Flanchard", augments={'Path: B',}},
  562.         feet="Baaya. Sabots +1",
  563.         neck={ name="Smn. Collar +1", augments={'Path: A',}},
  564.         waist="Carrier's Sash",
  565.         left_ear="Lugalbanda Earring",
  566.         right_ear={ name="Beck. Earring", augments={'System: 1 ID: 1676 Val: 0','Pet: Accuracy+6 Pet: Rng. Acc.+6','Pet: Mag. Acc.+6',}},
  567.         left_ring="C. Palug Ring",
  568.         right_ring="Varar Ring +1",
  569.         back={ name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Pet: Attack+10 Pet: Rng.Atk.+10','"Fast Cast"+10',}},}
  570.        
  571.     sets.perp = {}
  572.     -- Caller's Bracer's halve the perp cost after other costs are accounted for.
  573.     -- Using -10 (Gridavor, ring, Conv.feet), standard avatars would then cost 5, halved to 2.
  574.     -- We can then use Hagondes Coat +1 and end up with the same net MP cost, but significantly better defense.
  575.     -- Weather is the same, but we can also use the latent on the pendant to negate the last point lost.
  576.     --sets.perp.Day = {main="Bolelabunga",sub="Genbu's shield",hands="Call. Bracers +2",ring2="Evoker's ring"}
  577.     --sets.perp.Weather = {main="Bolelabunga",sub="Genbu's shield",hands="Call. Bracers +2"}
  578.     -- Carbuncle and Cait Sith have a lower perpetuation cost than other avatars, so items can be adjusted for Regen/Refresh and movement speed gear.
  579.     sets.perp.Carbuncle = {hands="Asteria Mitts +1"}
  580.     -- Diabolos's Rope doesn't gain us anything at this time
  581.     --sets.perp.Diabolos = {waist="Diabolos's Rope"}
  582.    
  583.     sets.perp.staff_and_grip = {}
  584.    
  585.     -- Defense sets
  586.     sets.defense.PDT = {neck="Twilight torque", body="Hagondes coat +1", hands="Hagondes cuffs", ring1="Dark ring", back="Kumbira cape", legs="Hagondes pants", feet="Hagondes sabots"}
  587.  
  588.     sets.defense.MDT = {}
  589.  
  590.     sets.Kiting = {right_ring="Shneddick Ring"}
  591.    
  592.     sets.latent_refresh = {waist="Fucho-no-obi"}
  593.    
  594.  
  595.     --------------------------------------
  596.     -- Engaged sets
  597.     --------------------------------------
  598.    
  599.     -- Normal melee group
  600.     sets.engaged = {ammo="Sancus Sachet +1",
  601.         head="Bunzi's Hat",
  602.         body="Tali'ah Manteel +2",
  603.         hands="Bunzi's Gloves",
  604.         legs="Nyame Flanchard",
  605.         feet="Beckoner's Pigaches +3",
  606.         neck="Shulmanu Collar",
  607.         waist="Klouskap Sash",
  608.         left_ear="Crepuscular Earring",
  609.         right_ear="Telos Earring",
  610.         left_ring="Chirich Ring +1",
  611.         right_ring="Chirich Ring +1",
  612.         back={ name="Campestres's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Accuracy+10','"Store TP"+10','Phys. dmg. taken-10%',}},}
  613. end
  614.  
  615. -------------------------------------------------------------------------------------------------------------------
  616. -- Job-specific hooks for standard casting events.
  617. -------------------------------------------------------------------------------------------------------------------
  618.  
  619. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  620. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  621. function job_precast(spell, action, spellMap, eventArgs)
  622.     if state.Buff['Astral Conduit'] and pet_midaction() then
  623.         eventArgs.handled = true
  624.     end
  625. end
  626.    
  627.  
  628. function job_midcast(spell, action, spellMap, eventArgs)
  629.     if state.Buff['Astral Conduit'] and pet_midaction() then
  630.         eventArgs.handled = true
  631.     end
  632. end
  633.  
  634. -- Runs when pet completes an action.
  635. function job_pet_aftercast(spell, action, spellMap, eventArgs)
  636.     if not spell.interrupted and spell.type == 'BloodPactWard' and spellMap ~= 'DebuffBloodPactWard' then
  637.         wards.flag = true
  638.         wards.spell = spell.english
  639.         send_command('wait 4; gs c reset_ward_flag')
  640.     end
  641.  
  642.         if (spell.english=="Ecliptic Howl") then
  643.                 if (world.moon_pct>89) then
  644.                         add_to_chat(104,"[Ecliptic Howl] Accuracy 25 - Evasion 1")
  645.                 elseif (world.moon_pct>74) then
  646.                         add_to_chat(104,"[Ecliptic Howl] Accuracy 21 - Evasion 5")
  647.                 elseif (world.moon_pct>59) then
  648.                         add_to_chat(104,"[Ecliptic Howl] Accuracy 17 - Evasion 9")
  649.                 elseif (world.moon_pct>39) then
  650.                         add_to_chat(104,"[Ecliptic Howl] Accuracy 13 - Evasion 13")
  651.                 elseif (world.moon_pct>24) then
  652.                         add_to_chat(104,"[Ecliptic Howl] Accuracy 9 - Evasion 17")
  653.                 elseif (world.moon_pct>9) then
  654.                         add_to_chat(104,"[Ecliptic Howl] Accuracy 5 - Evasion 21")
  655.                 else
  656.                         add_to_chat(104,"[Ecliptic Howl] Accuracy 1 - Evasion 25")
  657.                 end
  658.         elseif (spell.english=="Ecliptic Growl") then
  659.                 if (world.moon_pct>89) then
  660.                         add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 7 - INT/MND/CHR/AGI 1")
  661.                 elseif (world.moon_pct>74) then
  662.                         add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 6 - INT/MND/CHR/AGI 2")
  663.                 elseif (world.moon_pct>59) then
  664.                         add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 5 - INT/MND/CHR/AGI 3")
  665.                 elseif (world.moon_pct>39) then
  666.                         add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 4 - INT/MND/CHR/AGI 4")
  667.                 elseif (world.moon_pct>24) then
  668.                         add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 3 - INT/MND/CHR/AGI 5")
  669.                 elseif (world.moon_pct>9) then
  670.                         add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 2 - INT/MND/CHR/AGI 6")
  671.                 else
  672.                         add_to_chat(104,"[Ecliptic Growl] STR/DEX/VIT 1 - INT/MND/CHR/AGI 7")
  673.                 end
  674.         elseif (spell.english=="Lunar Cry") then
  675.                 if (world.moon_pct>89) then
  676.                         add_to_chat(104,"[Lunar Cry] Enemy Acc Down 31 - Enemy Eva Down 1")
  677.                 elseif (world.moon_pct>74) then
  678.                         add_to_chat(104,"[Lunar Cry] Enemy Acc Down 26 - Enemy Eva Down 6")
  679.                 elseif (world.moon_pct>59) then
  680.                         add_to_chat(104,"[Lunar Cry] Enemy Acc Down 21 - Enemy Eva Down 11")
  681.                 elseif (world.moon_pct>39) then
  682.                         add_to_chat(104,"[Lunar Cry] Enemy Acc Down 16 - Enemy Eva Down 16")
  683.                 elseif (world.moon_pct>24) then
  684.                         add_to_chat(104,"[Lunar Cry] Enemy Acc Down 11 - Enemy Eva Down 21")
  685.                 elseif (world.moon_pct>9) then
  686.                         add_to_chat(104,"[Lunar Cry] Enemy Acc Down 6 - Enemy Eva Down 26")
  687.                 else
  688.                         add_to_chat(104,"[Lunar Cry] Enemy Acc Down 1 - Enemy Eva Down 31")
  689.                 end
  690.         elseif (spell.english=="Dream Shroud") then
  691.                 if (world.time >= 0 and world.time < 1*60) then
  692.                         add_to_chat(104,"[Dream Shroud] MAB 13 - MDB 1")
  693.                 elseif (world.time >= 1*60 and world.time < 2*60) or (world.time >= 23*60 and world.time <= 23*60+59) then
  694.                         add_to_chat(104,"[Dream Shroud] MAB 12 - MDB 2")
  695.                 elseif (world.time >= 2*60 and world.time < 3*60) or (world.time >= 22*60 and world.time < 23*60) then
  696.                         add_to_chat(104,"[Dream Shroud] MAB 11 - MDB 3")
  697.                 elseif (world.time >= 3*60 and world.time < 4*60) or (world.time >= 21*60 and world.time < 22*60) then
  698.                         add_to_chat(104,"[Dream Shroud] MAB 10 - MDB 4")
  699.                 elseif (world.time >= 4*60 and world.time < 5*60) or (world.time >= 20*60 and world.time < 21*60) then
  700.                         add_to_chat(104,"[Dream Shroud] MAB 9 - MDB 5")
  701.                 elseif (world.time >= 5*60 and world.time < 6*60) or (world.time >= 19*60 and world.time < 20*60) then
  702.                         add_to_chat(104,"[Dream Shroud] MAB 8 - MDB 6")
  703.                 elseif (world.time >= 6*60 and world.time < 7*60) or (world.time >= 18*60 and world.time < 19*60) then
  704.                         add_to_chat(104,"[Dream Shroud] MAB 7 - MDB 7")
  705.                 elseif (world.time >= 7*60 and world.time < 8*60) or (world.time >= 17*60 and world.time < 18*60) then
  706.                         add_to_chat(104,"[Dream Shroud] MAB 6 - MDB 8")
  707.                 elseif (world.time >= 8*60 and world.time < 9*60) or (world.time >= 16*60 and world.time < 17*60) then
  708.                         add_to_chat(104,"[Dream Shroud] MAB 5 - MDB 9")
  709.                 elseif (world.time >= 9*60 and world.time < 10*60) or (world.time >= 15*60 and world.time < 16*60) then
  710.                         add_to_chat(104,"[Dream Shroud] MAB 4 - MDB 10")
  711.                 elseif (world.time >= 10*60 and world.time < 11*60) or (world.time >= 14*60 and world.time < 15*60) then
  712.                         add_to_chat(104,"[Dream Shroud] MAB 3 - MDB 11")
  713.                 elseif (world.time >= 11*60 and world.time < 12*60) or (world.time >= 13*60 and world.time < 14*60) then
  714.                         add_to_chat(104,"[Dream Shroud] MAB 2 - MDB 12")
  715.                 else
  716.                         add_to_chat(104,"[Dream Shroud] MAB 1 - MDB 13")
  717.         end
  718.     end
  719.  
  720.     if not spell.interrupted then
  721.         -- Create custom timers for Perfect Defense.
  722.         if durations[spell.english] then
  723.             local timer_cmd = 'timers c "'..spell.english..'" '..tostring(durations[spell.english])..' down'
  724.  
  725.             if timer_icons[spell.english] then
  726.                 timer_cmd = timer_cmd..' '..timer_icons[spell.english]
  727.             end
  728.  
  729.             send_command(timer_cmd)
  730.         end
  731.     end
  732. end
  733.  
  734. -------------------------------------------------------------------------------------------------------------------
  735. -- Job-specific hooks for non-casting events.
  736. -------------------------------------------------------------------------------------------------------------------
  737.  
  738. -- Called when a player gains or loses a buff.
  739. -- buff == buff gained or lost
  740. -- gain == true if the buff was gained, false if it was lost.
  741. function job_buff_change(buff, gain)
  742.     if state.Buff[buff] ~= nil then
  743.         handle_equipping_gear(player.status)
  744.     elseif storms:contains(buff) then
  745.         handle_equipping_gear(player.status)
  746.     end
  747. end
  748.  
  749.  
  750. -- Called when the player's pet's status changes.
  751. -- This is also called after pet_change after a pet is released.  Check for pet validity.
  752. function job_pet_status_change(newStatus, oldStatus, eventArgs)
  753.     if pet.isvalid and not midaction() and not pet_midaction() and (newStatus == 'Engaged' or oldStatus == 'Engaged') then
  754.         handle_equipping_gear(player.status, newStatus)
  755.     end
  756. end
  757.  
  758.  
  759. -- Called when a player gains or loses a pet.
  760. -- pet == pet structure
  761. -- gain == true if the pet was gained, false if it was lost.
  762. function job_pet_change(petparam, gain)
  763.     classes.CustomIdleGroups:clear()
  764.     if gain then
  765.         if avatars:contains(pet.name) then
  766.             classes.CustomIdleGroups:append('Avatar')
  767.         elseif spirits:contains(pet.name) then
  768.             classes.CustomIdleGroups:append('Spirit')
  769.         end
  770.     end
  771. end
  772.  
  773. -------------------------------------------------------------------------------------------------------------------
  774. -- User code that supplements standard library decisions.
  775. -------------------------------------------------------------------------------------------------------------------
  776.  
  777. -- Custom spell mapping.
  778. function job_get_spell_map(spell)
  779.     if spell.type == 'BloodPactRage' then
  780.         if magicalRagePacts:contains(spell.english) then
  781.             return 'MagicalBloodPactRage'
  782.         elseif HybridRagePacts:contains(spell.english) then
  783.             return 'HybridBloodPactRage'   
  784.         elseif FlowPacts:contains(spell.english) then  
  785.             return 'Alexander'         
  786.         else       
  787.             return 'PhysicalBloodPactRage'
  788.         end
  789.     elseif spell.type == 'BloodPactWard' and spell.target.type == 'MONSTER' then
  790.         return 'DebuffBloodPactWard'
  791.     end
  792. end
  793.  
  794. -- Modify the default idle set after it was constructed.
  795. function customize_idle_set(idleSet)
  796.     if pet.isvalid then
  797.         if pet.element == world.day_element then
  798.             idleSet = set_combine(idleSet, sets.perp.Day)
  799.         end
  800.         if pet.element == world.weather_element then
  801.             idleSet = set_combine(idleSet, sets.perp.Weather)
  802.         end
  803.         if sets.perp[pet.name] then
  804.             idleSet = set_combine(idleSet, sets.perp[pet.name])
  805.         end
  806.         gear.perp_staff.name = elements.perpetuance_staff_of[pet.element]
  807.         if gear.perp_staff.name and (player.inventory[gear.perp_staff.name] or player.wardrobe[gear.perp_staff.name]) then
  808.             idleSet = set_combine(idleSet, sets.perp.staff_and_grip)
  809.         end
  810.         if state.Buff["Avatar's Favor"] and avatars:contains(pet.name) then
  811.             idleSet = set_combine(idleSet, sets.idle.Avatar.Favor)
  812.         end
  813.         if pet.status == 'Engaged' then
  814.             idleSet = set_combine(idleSet, sets.idle.Avatar.Melee)
  815.         end
  816.         if pet.name == 'Cait Sith' then
  817.             idleSet = sets.perp.Carbuncle
  818.         end
  819.         if pet.name == 'Cait Sith' and pet.status == 'Engaged' then
  820.             idleSet = set_combine(idleSet, sets.idle.Avatar.Melee)
  821.         end
  822.         if pet.name == 'Cait Sith' and state.Buff["Avatar's Favor"] then
  823.             idleSet = set_combine(idleSet, sets.idle.Avatar.Favor)
  824.         end    
  825.         if pet.name == 'Alexander' then
  826.             idleSet = set_combine(idleSet, sets.midcast.Pet.Alexander)
  827.         end    
  828.     end
  829.    
  830.     if player.mpp < 51 then
  831.         idleSet = set_combine(idleSet, sets.latent_refresh)
  832.     end
  833.    
  834.     return idleSet
  835. end
  836.  
  837. -- Called by the 'update' self-command, for common needs.
  838. -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
  839. function job_update(cmdParams, eventArgs)
  840.     classes.CustomIdleGroups:clear()
  841.     if pet.isvalid then
  842.         if avatars:contains(pet.name) then
  843.             classes.CustomIdleGroups:append('Avatar')
  844.         elseif spirits:contains(pet.name) then
  845.             classes.CustomIdleGroups:append('Spirit')
  846.         end
  847.     end
  848. end
  849.  
  850. -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  851. function display_current_job_state(eventArgs)
  852.  
  853. end
  854.  
  855.  
  856. -------------------------------------------------------------------------------------------------------------------
  857. -- User self-commands.
  858. -------------------------------------------------------------------------------------------------------------------
  859.  
  860. -- Called for custom player commands.
  861. function job_self_command(cmdParams, eventArgs)
  862.     if cmdParams[1]:lower() == 'siphon' then
  863.         handle_siphoning()
  864.         eventArgs.handled = true
  865.     end
  866. end
  867.  
  868.  
  869. -------------------------------------------------------------------------------------------------------------------
  870. -- Utility functions specific to this job.
  871. -------------------------------------------------------------------------------------------------------------------
  872.  
  873. -- Cast the appopriate storm for the currently summoned avatar, if possible.
  874. function handle_petweather()
  875.     if player.sub_job ~= 'SCH' then
  876.         add_to_chat(122, "You can not cast storm spells")
  877.         return
  878.     end
  879.        
  880.     if not pet.isvalid then
  881.         add_to_chat(122, "You do not have an active avatar.")
  882.         return
  883.     end
  884.    
  885.     local element = pet.element
  886.     if element == 'Thunder' then
  887.         element = 'Lightning'
  888.     end
  889.    
  890.     if S{'Light','Dark','Lightning'}:contains(element) then
  891.         add_to_chat(122, 'You do not have access to '..elements.storm_of[element]..'.')
  892.         return
  893.     end
  894.    
  895.     local storm = elements.storm_of[element]
  896.    
  897.     if storm then
  898.         send_command('@input /ma "'..elements.storm_of[element]..'" <me>')
  899.     else
  900.         add_to_chat(123, 'Error: Unknown element ('..tostring(element)..')')
  901.     end
  902. end
  903.  
  904.  
  905. -- Custom uber-handling of Elemental Siphon
  906. function handle_siphoning()
  907.     if areas.Cities:contains(world.area) then
  908.         add_to_chat(122, 'Cannot use Elemental Siphon in a city area.')
  909.         return
  910.     end
  911.  
  912.     local siphonElement
  913.     local stormElementToUse
  914.     local releasedAvatar
  915.     local dontRelease
  916.    
  917.     -- If we already have a spirit out, just use that.
  918.     if pet.isvalid and spirits:contains(pet.name) then
  919.         siphonElement = pet.element
  920.         dontRelease = true
  921.         -- If current weather doesn't match the spirit, but the spirit matches the day, try to cast the storm.
  922.         if player.sub_job == 'SCH' and pet.element == world.day_element and pet.element ~= world.weather_element then
  923.             if not S{'Light','Dark','Lightning'}:contains(pet.element) then
  924.                 stormElementToUse = pet.element
  925.             end
  926.         end
  927.     -- If we're subbing /sch, there are some conditions where we want to make sure specific weather is up.
  928.     -- If current (single) weather is opposed by the current day, we want to change the weather to match
  929.     -- the current day, if possible.
  930.     elseif player.sub_job == 'SCH' and world.weather_element ~= 'None' then
  931.         -- We can override single-intensity weather; leave double weather alone, since even if
  932.         -- it's partially countered by the day, it's not worth changing.
  933.         if get_weather_intensity() == 1 then
  934.             -- If current weather is weak to the current day, it cancels the benefits for
  935.             -- siphon.  Change it to the day's weather if possible (+0 to +20%), or any non-weak
  936.             -- weather if not.
  937.             -- If the current weather matches the current avatar's element (being used to reduce
  938.             -- perpetuation), don't change it; just accept the penalty on Siphon.
  939.             if world.weather_element == elements.weak_to[world.day_element] and
  940.                 (not pet.isvalid or world.weather_element ~= pet.element) then
  941.                 -- We can't cast lightning/dark/light weather, so use a neutral element
  942.                 if S{'Light','Dark','Lightning'}:contains(world.day_element) then
  943.                     stormElementToUse = 'Wind'
  944.                 else
  945.                     stormElementToUse = world.day_element
  946.                 end
  947.             end
  948.         end
  949.     end
  950.    
  951.     -- If we decided to use a storm, set that as the spirit element to cast.
  952.     if stormElementToUse then
  953.         siphonElement = stormElementToUse
  954.     elseif world.weather_element ~= 'None' and (get_weather_intensity() == 2 or world.weather_element ~= elements.weak_to[world.day_element]) then
  955.         siphonElement = world.weather_element
  956.     else
  957.         siphonElement = world.day_element
  958.     end
  959.    
  960.     local command = ''
  961.     local releaseWait = 0
  962.    
  963.     if pet.isvalid and avatars:contains(pet.name) then
  964.         command = command..'input /pet "Release" <me>;wait 1.1;'
  965.         releasedAvatar = pet.name
  966.         releaseWait = 10
  967.     end
  968.    
  969.     if stormElementToUse then
  970.         command = command..'input /ma "'..elements.storm_of[stormElementToUse]..'" <me>;wait 4;'
  971.         releaseWait = releaseWait - 4
  972.     end
  973.    
  974.     if not (pet.isvalid and spirits:contains(pet.name)) then
  975.         command = command..'input /ma "'..elements.spirit_of[siphonElement]..'" <me>;wait 4;'
  976.         releaseWait = releaseWait - 4
  977.     end
  978.    
  979.     command = command..'input /ja "Elemental Siphon" <me>;'
  980.     releaseWait = releaseWait - 1
  981.     releaseWait = releaseWait + 0.1
  982.    
  983.     if not dontRelease then
  984.         if releaseWait > 0 then
  985.             command = command..'wait '..tostring(releaseWait)..';'
  986.         else
  987.             command = command..'wait 1.1;'
  988.         end
  989.        
  990.         command = command..'input /pet "Release" <me>;'
  991.     end
  992.    
  993.     if releasedAvatar then
  994.         command = command..'wait 1.1;input /ma "'..releasedAvatar..'" <me>'
  995.     end
  996.    
  997.     send_command(command)
  998. end
  999.  
  1000.  
  1001. -- Handles executing blood pacts in a generic, avatar-agnostic way.
  1002. -- cmdParams is the split of the self-command.
  1003. -- gs c [pact] [pacttype]
  1004. function handle_pacts(cmdParams)
  1005.     if areas.Cities:contains(world.area) then
  1006.         add_to_chat(122, 'You cannot use pacts in town.')
  1007.         return
  1008.     end
  1009.  
  1010.     if not pet.isvalid then
  1011.         add_to_chat(122,'No avatar currently available. Returning to default macro set.')
  1012.         select_default_macro_book('reset')
  1013.         return
  1014.     end
  1015.  
  1016.     if spirits:contains(pet.name) then
  1017.         add_to_chat(122,'Cannot use pacts with spirits.')
  1018.         return
  1019.     end
  1020.  
  1021.     if not cmdParams[2] then
  1022.         add_to_chat(123,'No pact type given.')
  1023.         return
  1024.     end
  1025.    
  1026.     local pact = cmdParams[2]:lower()
  1027.    
  1028.     if not pacts[pact] then
  1029.         add_to_chat(123,'Unknown pact type: '..tostring(pact))
  1030.         return
  1031.     end
  1032.    
  1033.     if pacts[pact][pet.name] then
  1034.         if pact == 'astralflow' and not buffactive['astral flow'] then
  1035.             add_to_chat(122,'Cannot use Astral Flow pacts at this time.')
  1036.             return
  1037.         end
  1038.        
  1039.         -- Leave out target; let Shortcuts auto-determine it.
  1040.         send_command('@input /pet "'..pacts[pact][pet.name]..'"')
  1041.     else
  1042.         add_to_chat(122,pet.name..' does not have a pact of type ['..pact..'].')
  1043.     end
  1044. end
  1045.  
  1046.  
  1047. -- Event handler for updates to player skill, since we can't rely on skill being
  1048. -- correct at pet_aftercast for the creation of custom timers.
  1049. windower.raw_register_event('incoming chunk',
  1050.     function (id)
  1051.         if id == 0x62 then
  1052.             if wards.flag then
  1053.                 create_pact_timer(wards.spell)
  1054.                 wards.flag = false
  1055.                 wards.spell = ''
  1056.             end
  1057.         end
  1058.     end)
  1059.  
  1060. -- Function to create custom timers using the Timers addon.  Calculates ward duration
  1061. -- based on player skill and base pact duration (defined in job_setup).
  1062. function create_pact_timer(spell_name)
  1063.     -- Create custom timers for ward pacts.
  1064.     if wards.durations[spell_name] then
  1065.         local ward_duration = wards.durations[spell_name]
  1066.         if ward_duration < 181 then
  1067.             local skill = player.skills.summoning_magic
  1068.             if skill > 300 then
  1069.                 skill = skill - 300
  1070.                 if skill > 200 then skill = 200 end
  1071.                 ward_duration = ward_duration + skill
  1072.             end
  1073.     if wards[spell_name] then
  1074.         local ward_duration = wards[spell_name]
  1075.         end
  1076.     end
  1077.        
  1078.         local timer_cmd = 'timers c "'..spell_name..'" '..tostring(ward_duration)..' down'
  1079.        
  1080.         if wards.icons[spell_name] then
  1081.             timer_cmd = timer_cmd..' '..wards.icons[spell_name]
  1082.         end
  1083.  
  1084.         send_command(timer_cmd)
  1085.     end
  1086. end
  1087.  
  1088.  
  1089. -- Select default macro book on initial load or subjob change.
  1090. function select_default_macro_book(reset)
  1091.    
  1092.     -- Default macro set/book
  1093.     set_macro_page(1, 1)
  1094. end
Advertisement
Add Comment
Please, Sign In to add comment