Sithel

SMN GearSwap (Mote) 1-02-15

May 25th, 2014
582
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 36.41 KB | None | 0 0
  1. -------------------------------------------------------------------------------------------------------------------
  2. -- Setup functions for this job.  Generally should not be modified.
  3. -------------------------------------------------------------------------------------------------------------------
  4.  
  5. -- Also, you'll need the Shortcuts addon to handle the auto-targetting of the custom pact commands.
  6.  
  7. --[[
  8.     Custom commands:
  9.    
  10.     gs c petweather
  11.         Automatically casts the storm appropriate for the current avatar, if possible.
  12.    
  13.     gs c siphon
  14.         Automatically run the process to: dismiss the current avatar; cast appropriate
  15.         weather; summon the appropriate spirit; Elemental Siphon; release the spirit;
  16.         and re-summon the avatar.
  17.        
  18.         Will not cast weather you do not have access to.
  19.         Will not re-summon the avatar if one was not out in the first place.
  20.         Will not release the spirit if it was out before the command was issued.
  21.        
  22.     gs c pact [PactType]
  23.         Attempts to use the indicated pact type for the current avatar.
  24.         PactType can be one of:
  25.             cure
  26.             curaga
  27.             buffOffense
  28.             buffDefense
  29.             buffSpecial
  30.             debuff1
  31.             debuff2
  32.             sleep
  33.             nuke2
  34.             nuke4
  35.             bp70
  36.             bp75 (merits and lvl 75-80 pacts)
  37.             astralflow
  38.  
  39. --]]
  40.  
  41.  
  42. -- Initialization function for this job file.
  43. function get_sets()
  44.     mote_include_version = 2
  45.  
  46.     -- Load and initialize the include file.
  47.     include('Mote-Include.lua')
  48.     IdlePetMelee_Index = 1 --Avatar Test
  49. end
  50.  
  51. -- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
  52. function job_setup()
  53.     state.Buff["Avatar's Favor"] = buffactive["Avatar's Favor"] or false
  54.     state.Buff["Astral Conduit"] = buffactive["Astral Conduit"] or false
  55.  
  56.     spirits = S{"LightSpirit", "DarkSpirit", "FireSpirit", "EarthSpirit", "WaterSpirit", "AirSpirit", "IceSpirit", "ThunderSpirit"}
  57.     avatars = S{"Carbuncle", "Fenrir", "Diabolos", "Ifrit", "Titan", "Leviathan", "Garuda", "Shiva", "Ramuh", "Odin", "Alexander", "Cait Sith"}
  58.  
  59.     magicalRagePacts = S{
  60.         'Inferno','Earthen Fury','Tidal Wave','Aerial Blast','Diamond Dust','Judgment Bolt','Searing Light','Howling Moon','Ruinous Omen',
  61.         'Fire II','Stone II','Water II','Aero II','Blizzard II','Thunder II',
  62.         'Fire IV','Stone IV','Water IV','Aero IV','Blizzard IV','Thunder IV',
  63.         'Thunderspark','Burning Strike','Meteorite','Nether Blast','Flaming Crush',
  64.         'Meteor Strike','Heavenly Strike','Wind Blade','Geocrush','Grand Fall','Thunderstorm',
  65.         'Holy Mist','Lunar Bay','Night Terror','Level ? Holy'}
  66.  
  67.  
  68.     pacts = {}
  69.     pacts.cure = {['Carbuncle']='Healing Ruby'}
  70.     pacts.curaga = {['Carbuncle']='Healing Ruby II', ['Garuda']='Whispering Wind', ['Leviathan']='Spring Water'}
  71.     pacts.buffoffense = {['Carbuncle']='Glittering Ruby', ['Ifrit']='Crimson Howl', ['Garuda']='Hastega II', ['Shiva']='Crystal Blessing', ['Ramuh']='Rolling Thunder',
  72.         ['Fenrir']='Ecliptic Growl'}
  73.     pacts.buffdefense = {['Carbuncle']='Shining Ruby', ['Shiva']='Frost Armor', ['Garuda']='Aerial Armor', ['Titan']='Earthen Ward',
  74.         ['Ramuh']='Lightning Armor', ['Fenrir']='Ecliptic Howl', ['Diabolos']='Noctoshield', ['Cait Sith']='Reraise II'}
  75.     pacts.buffspecial = {['Ifrit']='Inferno Howl', ['Garuda']='Fleet Wind', ['Titan']='Earthen Armor', ['Leviathan']='Soothing Current', ['Diabolos']='Dream Shroud',
  76.         ['Carbuncle']='Soothing Ruby', ['Fenrir']='Heavenward Howl', ['Cait Sith']='Raise II'}
  77.     pacts.debuff1 = {['Shiva']='Diamond Storm', ['Ramuh']='Shock Squall', ['Leviathan']='Tidal Roar', ['Fenrir']='Lunar Cry',
  78.         ['Diabolos']='Pavor Nocturnus', ['Cait Sith']='Eerie Eye'}
  79.     pacts.debuff2 = {['Shiva']='Sleepga', ['Leviathan']='Slowga', ['Fenrir']='Lunar Roar', ['Diabolos']='Somnolence'}
  80.     pacts.sleep = {['Shiva']='Sleepga', ['Diabolos']='Nightmare', ['Cait Sith']='Mewing Lullaby'}
  81.     pacts.nuke2 = {['Ifrit']='Fire II', ['Shiva']='Blizzard II', ['Garuda']='Aero II', ['Titan']='Stone II',
  82.         ['Ramuh']='Thunder II', ['Leviathan']='Water II'}
  83.     pacts.nuke4 = {['Ifrit']='Fire IV', ['Shiva']='Blizzard IV', ['Garuda']='Aero IV', ['Titan']='Stone IV',
  84.         ['Ramuh']='Thunder IV', ['Leviathan']='Water IV'}
  85.     pacts.bp70 = {['Ifrit']='Flaming Crush', ['Shiva']='Rush', ['Garuda']='Predator Claws', ['Titan']='Mountain Buster',
  86.         ['Ramuh']='Chaotic Strike', ['Leviathan']='Spinning Dive', ['Carbuncle']='Meteorite', ['Fenrir']='Eclipse Bite',
  87.         ['Diabolos']='Nether Blast',['Cait Sith']='Regal Scratch'}
  88.     pacts.bp75 = {['Ifrit']='Meteor Strike', ['Shiva']='Heavenly Strike', ['Garuda']='Wind Blade', ['Titan']='Geocrush',
  89.         ['Ramuh']='Thunderstorm', ['Leviathan']='Grand Fall', ['Carbuncle']='Holy Mist', ['Fenrir']='Lunar Bay',
  90.         ['Diabolos']='Night Terror', ['Cait Sith']='Level ? Holy'}
  91.     pacts.astralflow = {['Ifrit']='Inferno', ['Shiva']='Diamond Dust', ['Garuda']='Aerial Blast', ['Titan']='Earthen Fury',
  92.         ['Ramuh']='Judgment Bolt', ['Leviathan']='Tidal Wave', ['Carbuncle']='Searing Light', ['Fenrir']='Howling Moon',
  93.         ['Diabolos']='Ruinous Omen', ['Cait Sith']="Altana's Favor"}
  94.  
  95.     -- Wards table for creating custom timers  
  96.     wards = {}
  97.     -- Base duration for ward pacts.
  98.     wards.durations = {
  99.         ['Crimson Howl'] = 60,
  100.         ['Earthen Armor'] = 60,
  101.         ['Inferno Howl'] = 60,
  102.         ['Heavenward Howl'] = 60,
  103.         ['Rolling Thunder'] = 120,
  104.         ['Fleet Wind'] = 120,
  105.         ['Shining Ruby'] = 180,
  106.         ['Frost Armor'] = 180,
  107.         ['Lightning Armor'] = 180,
  108.         ['Ecliptic Growl'] = 180,
  109.         ['Glittering Ruby'] = 180,
  110.         ['Hastega'] = 180,
  111.         ['Hastega II'] = 180,
  112.         ['Noctoshield'] = 180,
  113.         ['Ecliptic Howl'] = 180,
  114.         ['Dream Shroud'] = 180,
  115.         ['Crystal Blessing'] = 180,
  116.         ['Soothing Current'] = 180,
  117.         ['Reraise II'] = 3600
  118.     }
  119.     -- Icons to use when creating the custom timer.
  120.     wards.icons = {
  121.         ['Earthen Armor']   = 'spells/00299.png', -- 00299 for Titan
  122.         ['Shining Ruby']    = 'spells/00043.png', -- 00043 for Protect
  123.         ['Dream Shroud']    = 'spells/00304.png', -- 00304 for Diabolos
  124.         ['Noctoshield']     = 'spells/00106.png', -- 00106 for Phalanx
  125.         ['Inferno Howl']    = 'spells/00298.png', -- 00298 for Ifrit
  126.         ['Hastega']         = 'spells/00358.png', -- 00358 for Hastega
  127.         ['Hastega II']      = 'spells/00358.png', -- 00358 for Hastega II
  128.         ['Rolling Thunder'] = 'spells/00104.png', -- 00358 for Enthunder
  129.         ['Frost Armor']     = 'spells/00250.png', -- 00250 for Ice Spikes
  130.         ['Lightning Armor'] = 'spells/00251.png', -- 00251 for Shock Spikes
  131.         ['Crystal Blessing'] = 'spells/00483.png', -- 00251 for Crystal Blessing
  132.         ['Soothing Current'] = 'spells/00482.png', -- 00251 for Soothing Current
  133.         ['Reraise II']      = 'spells/00135.png', -- 00135 for Reraise
  134.         ['Fleet Wind']      = 'abilities/00074.png', --
  135.     }
  136.     -- Flags for code to get around the issue of slow skill updates.
  137.     wards.flag = false
  138.     wards.spell = ''
  139.    
  140. end
  141.  
  142. -------------------------------------------------------------------------------------------------------------------
  143. -- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
  144. -------------------------------------------------------------------------------------------------------------------
  145.  
  146. -- Setup vars that are user-dependent.  Can override this function in a sidecar file.
  147. function user_setup()
  148.     state.OffenseMode:options('None', 'Normal', 'Acc', 'PetAcc')
  149.     state.CastingMode:options('Normal', 'Resistant')
  150.     state.IdleMode:options('Normal', 'PDT', 'Town')
  151.     --state.IdleAvatarMode:options('Normal', 'Acc')
  152.     gear.perp_staff = {name="Nirvana"}
  153.    
  154.     select_default_macro_book()
  155.     send_command('bind f12 gs c update user')
  156. end
  157.  
  158. -- Called when this job file is unloaded (eg: job change)
  159. function user_unload()
  160.     --[[send_command('unbind ^`')
  161.     send_command('unbind !-')--]]
  162.     send_command('unbind F7')
  163.     send_command('unbind F9')
  164.     send_command('unbind F10')
  165.     send_command('unbind F11')
  166.     send_command('unbind F12')
  167. end
  168.  
  169.  
  170. -- Define sets and vars used by this job file.
  171. function init_gear_sets()
  172.     --------------------------------------
  173.     -- Precast Sets
  174.     --------------------------------------
  175.    
  176.     -- Precast sets to enhance JAs
  177.     sets.precast.JA['Astral Flow'] = {head="Glyphic Horn"}
  178.    
  179.     sets.precast.JA['Elemental Siphon'] = {
  180.         --main="Kirin's Pole",
  181.         --sub="Vox Grip",
  182.         ammo="Seraphicaller",
  183.         head="Con. Horn +1",
  184.         neck="Caller's Pendant",
  185.         ear2="Andoaa earring",
  186.         body="Caller's Doublet +2",
  187.         hands="Glyphic Bracers +1",
  188.         ring1="Evoker's Ring",
  189.         ring2="Globidonta Ring",
  190.         back="Conveyance Cape",
  191.         waist="Cimmerian Sash",
  192.         legs="Ngen seraweels",
  193.         feet="Caller's Pigaches +2"}
  194.  
  195.     -- Pact delay reduction gear
  196.     sets.precast.BloodPactWard = {
  197.         ammo="Seraphicaller",
  198.         head="Con. Horn +1",
  199.         body="Glyphic Doublet +1",
  200.         hands="Glyphic Bracers +1",
  201.         back="Conveyance Cape",
  202.         legs="Smn. Spats +2",
  203.         feet="Glyph. Pigaches +1"}
  204.  
  205.     sets.precast.BloodPactRage = sets.precast.BloodPactWard
  206.  
  207.     -- Fast cast sets for spells
  208.    
  209.     sets.precast.FC = {
  210.         head="Nahtirah Hat",
  211.         ear2="Loquacious Earring",
  212.         body="Marduk's Jubbah +1",
  213.         ring1="Prolix Ring",
  214.         back="Swith Cape",
  215.         waist="Witful Belt",
  216.         legs="Artsieq Hose",
  217.         feet="Regal pumps +1"}
  218.  
  219.     sets.precast.FC['Enhancing Magic'] = set_combine(sets.precast.FC, {waist="Siegel Sash"})
  220.  
  221.        
  222.     -- Weaponskill sets
  223.     -- Default set for any weaponskill that isn't any more specifically defined
  224.     sets.precast.WS = {}
  225.  
  226.     -- Specific weaponskill sets.  Uses the base set if an appropriate WSMod version isn't found.
  227.     sets.precast.WS['Myrkr'] = {}
  228.    
  229.     --Reive Neck
  230.     sets.ReiveNeck = {neck="Adoulin's Refuge +1"}
  231.  
  232.    
  233.     --------------------------------------
  234.     -- Midcast sets
  235.     --------------------------------------
  236.  
  237.     sets.midcast.FastRecast = {
  238.         head="Nahtirah Hat",
  239.         ear2="Loquacious Earring",
  240.         body="Marduk's Jubbah +1",
  241.         hands="Hagondes Cuffs",
  242.         ring1="Prolix Ring",
  243.         back="Swith Cape",
  244.         waist="Witful Belt",
  245.         legs="Artsieq Hose",
  246.         feet="Regal pumps +1"}
  247.  
  248.     sets.midcast.Cure = {
  249.         --main="Tamaxchi",
  250.         --sub="Genbu's Shield",
  251.         head="Nahtirah Hat",
  252.         ear2="Loquacious Earring",
  253.         body="Heka's Kalasiris",
  254.         hands="Bokwus Gloves",
  255.         ring1="Prolix Ring",
  256.         ring2="Sirona's Ring",
  257.         back="Swith Cape",
  258.         waist="Witful Belt",
  259.         legs="Nares Trews",
  260.         feet="Hagondes Sabots"}
  261.  
  262.     sets.midcast.Stoneskin = {waist="Siegel Sash"}
  263.  
  264.     sets.midcast['Elemental Magic'] = {}
  265.  
  266.     sets.midcast['Dark Magic'] = {--[[main="Lehbrailg +2",sub="Wizzan Grip",
  267.         head="Nahtirah Hat",neck="Aesir Torque",ear1="Lifestorm Earring",ear2="Psystorm Earring",
  268.         body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Excelsis Ring",ring2="Sangoma Ring",
  269.         waist="Fuchi-no-Obi",legs="Bokwus Slops",feet="Bokwus Boots"--]]}
  270.  
  271.  
  272.     -- Avatar pact sets.  All pacts are Ability type.
  273.    
  274.     sets.midcast.Pet.BloodPactWard = {
  275.         --main="Kirin's Pole",
  276.         --sub="Vox Grip",
  277.         ammo="Seraphicaller",
  278.         head="Con. Horn +1",
  279.         neck="Caller's Pendant",
  280.         ear1="Gifted Earring",
  281.         ear2="Andoaa earring",
  282.         body="Caller's Doublet +2",
  283.         hands="Glyphic Bracers +1",
  284.         ring1="Evoker's Ring",
  285.         ring2="Globidonta Ring",
  286.         back="Conveyance Cape",
  287.         waist="Cimmerian Sash",
  288.         legs="Ngen seraweels",
  289.         feet="Marduk's Crackows +1"}
  290.  
  291.     sets.midcast.Pet.DebuffBloodPactWard = {
  292.         --main="Kirin's Pole",
  293.         --sub="Vox Grip",
  294.         ammo="Seraphicaller",
  295.         head="Con. Horn +1",
  296.         neck="Caller's Pendant",
  297.         ear1="Gifted Earring",
  298.         ear2="Andoaa earring",
  299.         body="Caller's Doublet +2",
  300.         hands="Glyphic Bracers +1",
  301.         ring1="Evoker's Ring",
  302.         ring2="Globidonta Ring",
  303.         back="Conveyance Cape",
  304.         waist="Cimmerian Sash",
  305.         legs="Ngen seraweels",
  306.         feet="Marduk's Crackows +1"}
  307.        
  308.     sets.midcast.Pet.DebuffBloodPactWard.Acc = sets.midcast.Pet.DebuffBloodPactWard
  309.    
  310.     sets.midcast.Pet.PhysicalBloodPactRage = {     
  311.         --sub="Vox Grip",
  312.         ammo="Seraphicaller",
  313.         head="Con. Horn +1",
  314.         neck="Caller's Pendant",
  315.         body="Con. Doublet +1",
  316.         ear1="Gifted Earring",
  317.         ear2="Andoaa earring",
  318.         hands="Glyphic Bracers +1",
  319.         ring1="Evoker's Ring",
  320.         ring2="Globidonta Ring",
  321.         back="Samanisi Cape",
  322.         waist="Mujin Obi",
  323.         legs="Ngen seraweels",
  324.         feet="Con. Pigaches +1"}
  325.  
  326.     sets.midcast.Pet.PhysicalBloodPactRage.Acc = sets.midcast.Pet.PhysicalBloodPactRage
  327.  
  328.     sets.midcast.Pet.MagicalBloodPactRage = {      
  329.         --sub="Vox Grip",
  330.         ammo="Seraphicaller",
  331.         head="Glyphic Horn +1",
  332.         neck="Eidolon Pendant",
  333.         body="Con. Doublet +1",
  334.         ear1="Gifted Earring",
  335.         ear2="Andoaa earring",
  336.         hands="Hagondes Cuffs",
  337.         ring1="Evoker's Ring",
  338.         ring2="Fervor Ring",
  339.         back="Argocham. Mantle",
  340.         waist="Caller's Sash",
  341.         legs="Ngen seraweels",
  342.         feet="Hagondes Sabots"}
  343.        
  344.     sets.midcast.Pet['Flaming Crush'] = {      
  345.         --sub="Vox Grip",
  346.         ammo="Seraphicaller",
  347.         head="Glyphic Horn +1",
  348.         neck="Eidolon Pendant",
  349.         body="Con. Doublet +1",    
  350.         ear1="Gifted Earring",
  351.         ear2="Andoaa earring",
  352.         hands="Hagondes Cuffs",
  353.         ring1="Evoker's Ring",
  354.         ring2="Fervor Ring",
  355.         back="Argocham. Mantle",
  356.         waist="Mujin Obi",
  357.         legs="Hagondes Pants",
  358.         feet="Hagondes Sabots"}
  359.  
  360.     sets.midcast.Pet.MagicalBloodPactRage.Acc = sets.midcast.Pet.MagicalBloodPactRage
  361.  
  362.  
  363.     -- Spirits cast magic spells, which can be identified in standard ways.
  364.    
  365.     sets.midcast.Pet.WhiteMagic = {legs="Smn. Spats +2"}
  366.    
  367.     sets.midcast.Pet['Elemental Magic'] = set_combine(sets.midcast.Pet.BloodPactRage, {legs="Smn. Spats +2"})
  368.  
  369.     sets.midcast.Pet['Elemental Magic'].Resistant = {}
  370.    
  371.  
  372.     --------------------------------------
  373.     -- Idle/resting/defense/etc sets
  374.     --------------------------------------
  375.    
  376.     -- Resting sets
  377.     sets.resting = {
  378.         ammo="Seraphicaller",
  379.         head="Convoker's Horn",
  380.         neck="Wiglen Gorget",
  381.         ear1="Gifted Earring",
  382.         ear2="Loquacious Earring",
  383.         body="Hagondes Coat",
  384.         hands="Serpentes Cuffs",
  385.         ring1="Sheltered Ring",
  386.         ring2="Paguroidea Ring",
  387.         back="Pahtli Cape",
  388.         waist="Austerity Belt",
  389.         legs="Assid. Pants +1",
  390.         feet="Chelona Boots +1"}
  391.    
  392.     -- Idle sets
  393.     sets.idle = {
  394.         main="Nirvana",
  395.         sub="Oneiros Grip",
  396.         ammo="Seraphicaller",
  397.         head="Con. Horn +1",
  398.         neck="Wiglen Gorget",
  399.         ear1="Gifted Earring",
  400.         ear2="Andoaa earring",
  401.         body="Hagondes Coat",
  402.         hands="Serpentes Cuffs",
  403.         ring1="Sheltered Ring",
  404.         ring2="Sangoma Ring",
  405.         back="Conveyance cape",
  406.         waist="Fucho-no-Obi",
  407.         legs="Assid. Pants +1",
  408.         feet="Serpentes Sabots"}
  409.  
  410.     sets.idle.PDT = {
  411.         main="Nirvana",
  412.         sub="Oneiros Grip",
  413.         ammo="Seraphicaller",
  414.         head="Con. Horn +1",
  415.         neck="Wiglen Gorget",
  416.         ear1="Gifted Earring",
  417.         ear2="Andoaa earring",
  418.         body="Hagondes Coat",
  419.         hands="Serpentes Cuffs",
  420.         ring1="Sheltered Ring",
  421.         ring2="Sangoma Ring",
  422.         back="Conveyance cape",
  423.         waist="Fucho-no-Obi",
  424.         legs="Assid. Pants +1",
  425.         feet="Serpentes Sabots"}
  426.  
  427.     -- perp costs:
  428.     -- spirits: 7
  429.     -- carby: 11 (5 with mitts)
  430.     -- fenrir: 13
  431.     -- others: 15
  432.     -- avatar's favor: -4/tick
  433.    
  434.     -- Max useful -perp gear is 1 less than the perp cost (can't be reduced below 1)
  435.     -- Aim for -14 perp, and refresh in other slots.
  436.    
  437.     -- -perp gear:
  438.     -- Gridarvor: -5
  439.     -- Glyphic Horn: -4
  440.     -- Caller's Doublet +2/Glyphic Doublet: -4
  441.     -- Evoker's Ring: -1
  442.     -- Convoker's Pigaches: -4
  443.     -- total: -18
  444.    
  445.     -- Can make due without either the head or the body, and use +refresh items in those slots.
  446.    
  447.     sets.idle.Avatar = {
  448.         main="Nirvana",
  449.         sub="Oneiros Grip",
  450.         ammo="Seraphicaller",
  451.         head="Con. Horn +1",
  452.         neck="Caller's Pendant",
  453.         ear1="Gifted Earring",
  454.         ear2="Andoaa earring",
  455.         body="Hagondes Coat",
  456.         hands="Serpentes Cuffs",
  457.         ring1="Evoker's Ring",
  458.         ring2="Sangoma Ring",
  459.         back="Conveyance cape",
  460.         waist="Fucho-no-Obi",
  461.         legs="Assid. Pants +1",
  462.         feet="Con. Pigaches +1"}
  463.  
  464.     sets.idle.PDT.Avatar = {main="Gridarvor",sub="Achaq Grip",ammo="Seraphicaller",
  465.         head="Convoker's Horn",neck="Caller's Pendant",ear1="Gifted Earring",ear2="Loquacious Earring",
  466.         body="Hagondes Coat",hands="Regimen Mittens",ring1="Evoker's Ring",ring2="Defending Ring",
  467.         back="Conveyance Cape",waist="Fucho-no-Obi",legs="Hagondes Pants",feet="Convoker's Pigaches"}
  468.  
  469.     sets.idle.Spirit = {
  470.         main="Nirvana",
  471.         sub="Oneiros Grip",
  472.         ammo="Seraphicaller",
  473.         head="Con. Horn +1",
  474.         neck="Caller's Pendant",
  475.         ear1="Gifted Earring",
  476.         ear2="Andoaa earring",
  477.         body="Hagondes Coat",
  478.         hands="Serpentes Cuffs",
  479.         ring1="Evoker's Ring",
  480.         ring2="Fervor Ring",
  481.         back="Conveyance cape",
  482.         waist="Cimmerian Sash",
  483.         legs="Summoner's Spats +2",
  484.         feet="Serpentes Sabots"}
  485.  
  486.     sets.idle.Town = {
  487.         main="Nirvana",
  488.         sub="Oneiros Grip",
  489.         ammo="Seraphicaller",
  490.         head="Con. Horn +1",
  491.         neck="Caller's Pendant",
  492.         ear1="Gifted Earring",
  493.         ear2="Andoaa earring",     
  494.         body="Con. Doublet +1",
  495.         hands="Glyphic Bracers +1",
  496.         ring1="Evoker's Ring",
  497.         ring2="Sangoma Ring",
  498.         back="Conveyance cape",
  499.         waist="Fucho-no-Obi",
  500.         legs="Con. Spats +1",
  501.         feet="Con. Pigaches +1"}
  502.  
  503.     -- Favor uses Caller's Horn instead of Convoker's Horn for refresh
  504.     sets.idle.Avatar.Favor = {head="Caller's Horn +2"}
  505.    
  506.     IdlePetMelee_Set_Names = {'Perpetuation','PetAcc'}
  507.     sets.IdlePetMelee = {}
  508.     sets.IdlePetMelee.Perpetuation = {
  509.         main="Nirvana",
  510.         sub="Oneiros Grip",
  511.         ammo="Seraphicaller",
  512.         head="Con. Horn +1",
  513.         neck="Caller's Pendant",
  514.         ear1="Gifted Earring",
  515.         ear2="Andoaa earring",
  516.         body="Hagondes Coat",
  517.         hands="Serpentes Cuffs",
  518.         ring1="Evoker's Ring",
  519.         ring2="Sangoma Ring",
  520.         back="Conveyance cape",
  521.         waist="Fucho-no-Obi",
  522.         legs="Assid. Pants +1",
  523.         feet="Con. Pigaches +1"}
  524.     sets.IdlePetMelee.PetAcc = set_combine(sets.IdlePetMelee.Perpetuation,{
  525.         body="Glyphic doublet +1",
  526.         hands="Glyphic Bracers +1",
  527.         waist="Mujin Obi",
  528.         back="Samanisi cape",
  529.         legs="Con. Spats +1",
  530.         feet="Con. Pigaches +1"})  
  531.  
  532. --set_combine(pdt.on,{
  533.    
  534.     sets.perp = {}
  535.     -- Caller's Bracer's halve the perp cost after other costs are accounted for.
  536.     -- Using -10 (Gridavor, ring, Conv.feet), standard avatars would then cost 5, halved to 2.
  537.     -- We can then use Hagondes Coat and end up with the same net MP cost, but significantly better defense.
  538.     -- Weather is the same, but we can also use the latent on the pendant to negate the last point lost.
  539.     sets.perp.Day = {hands="Caller's Bracers +2"}
  540.     sets.perp.Weather = {neck="Caller's Pendant",hands="Caller's Bracers +2"}
  541.     -- Carby: Mitts+Conv.feet = 1/tick perp.  Everything else should be +refresh
  542.     sets.perp.Carbuncle = {hands="Carbuncle Mitts"}
  543.     -- Diabolos's Rope doesn't gain us anything at this time
  544.     --sets.perp.Diabolos = {waist="Diabolos's Rope"}
  545.     sets.perp.Alexander = sets.midcast.Pet.BloodPactWard
  546.  
  547.     sets.perp.staff_and_grip = {main=gear.perp_staff,sub="Achaq Grip"}
  548.    
  549.     -- Defense sets
  550.     sets.defense.PDT = {       
  551.         head="Hagondes Hat",
  552.         neck="Wiglen Gorget",
  553.         ear1="Gifted Earring",
  554.         ear2="Loquacious Earring",
  555.         body="Hagondes Coat",
  556.         hands="Yaoyotl Gloves",
  557.         ring1="Dark Ring",
  558.         ring2="Dark Ring",
  559.         back="Umbra Cape",
  560.         waist="Fucho-no-Obi",
  561.         legs="Hagondes Pants",
  562.         feet="Hagondes Sabots"}
  563.  
  564.     sets.defense.MDT = {
  565.         head="Hagondes Hat",
  566.         neck="Twilight Torque",
  567.         ear1="Gifted Earring",
  568.         ear2="Loquacious Earring",
  569.         body="Vanir Cotehardie",
  570.         hands="Yaoyotl Gloves",
  571.         ring1="Dark Ring",
  572.         ring2="Shadow Ring",
  573.         back="Umbra Cape",
  574.         waist="Fucho-no-Obi",
  575.         legs="Bokwus Slops",
  576.         feet="Hagondes Sabots"}
  577.  
  578.     sets.Kiting = {}
  579.    
  580.     sets.latent_refresh = {waist="Fucho-no-obi"}
  581.    
  582.  
  583.     --------------------------------------
  584.     -- Engaged sets
  585.     --------------------------------------
  586.    
  587.     -- Normal melee group
  588.     sets.engaged = {
  589.         main="Nirvana",
  590.         sub="Oneiros Grip",
  591.         ammo="Seraphicaller",
  592.         head="Con. Horn +1",
  593.         neck="Caller's Pendant",
  594.         ear1="Gifted Earring",
  595.         ear2="Andoaa earring",
  596.         body="Hagondes Coat",
  597.         hands="Serpentes Cuffs",
  598.         ring1="Evoker's Ring",
  599.         ring2="Sangoma Ring",
  600.         back="Conveyance cape",
  601.         waist="Fucho-no-Obi",
  602.         legs="Assid. Pants +1",
  603.         feet="Con. Pigaches +1"}
  604.    
  605.     sets.engaged.Acc = {
  606.         main="Nirvana",
  607.         sub="Oneiros Grip",
  608.         ammo="Seraphicaller",
  609.         head="Con. Horn +1",
  610.         neck="Caller's Pendant",
  611.         ear1="Gifted Earring",
  612.         ear2="Andoaa earring",
  613.         body="Hagondes Coat",
  614.         hands="Glyphic Bracers +1",
  615.         ring1="Evoker's Ring",
  616.         ring2="Sangoma Ring",
  617.         back="Samanisi cape",
  618.         waist="Mujin Obi",
  619.         legs="Con. Spats +1",
  620.         feet="Con. Pigaches +1"}
  621.    
  622.     sets.engaged.PetAcc = {
  623.         main="Nirvana",
  624.         sub="Oneiros Grip",
  625.         ammo="Seraphicaller",
  626.         head="Con. Horn +1",
  627.         neck="Caller's Pendant",
  628.         ear1="Gifted Earring",
  629.         ear2="Andoaa earring",
  630.         body="Hagondes Coat",
  631.         hands="Glyphic Bracers +1",
  632.         ring1="Evoker's Ring",
  633.         ring2="Sangoma Ring",
  634.         back="Samanisi cape",
  635.         waist="Mujin Obi",
  636.         legs="Con. Spats +1",
  637.         feet="Con. Pigaches +1"}
  638. end
  639.  
  640. -------------------------------------------------------------------------------------------------------------------
  641. -- Job-specific hooks for standard casting events.
  642. -------------------------------------------------------------------------------------------------------------------
  643.  
  644. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  645. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  646. function job_precast(spell, action, spellMap, eventArgs)
  647.     if state.Buff['Astral Conduit'] and pet_midaction() then
  648.         eventArgs.handled = true
  649.     end
  650. end
  651.  
  652. function job_midcast(spell, action, spellMap, eventArgs)
  653.     if state.Buff['Astral Conduit'] and pet_midaction() then
  654.         eventArgs.handled = true
  655.     end
  656. end
  657.  
  658. -- Runs when pet completes an action.
  659. function job_pet_aftercast(spell, action, spellMap, eventArgs)
  660.     if not spell.interrupted and spell.type == 'BloodPactWard' and spellMap ~= 'DebuffBloodPactWard' then
  661.         wards.flag = true
  662.         wards.spell = spell.english
  663.         send_command('wait 4; gs c reset_ward_flag')
  664.     end
  665. end
  666.  
  667. -------------------------------------------------------------------------------------------------------------------
  668. -- Job-specific hooks for non-casting events.
  669. -------------------------------------------------------------------------------------------------------------------
  670.  
  671. -- Called when a player gains or loses a buff.
  672. -- buff == buff gained or lost
  673. -- gain == true if the buff was gained, false if it was lost.
  674. function job_buff_change(buff, gain)
  675.     if state.Buff[buff] ~= nil then
  676.         handle_equipping_gear(player.status)
  677.     elseif storms:contains(buff) then
  678.         handle_equipping_gear(player.status)
  679.     end
  680.     if buff == "Aftermath: Lv.3" then --Aftermath: lv.3
  681.         if gain then
  682.             send_command('timers create "Aftermath: Lv.3" 180 down;wait 120;input /echo Aftermath: Lv.3 [WEARING OFF IN 60 SEC.];wait 30;input /echo Aftermath: Lv.3 [WEARING OFF IN 30 SEC.];wait 20;input /echo Aftermath: Lv.3 [WEARING OFF IN 10 SEC.]')
  683.         else
  684.             send_command('timers delete "Aftermath: Lv.3"')
  685.             add_to_chat(158,'Aftermath: lv.3: [OFF]')
  686.         end
  687.     end
  688.     if buff == 'Reive Mark' then
  689.         if gain then
  690.             equip(sets.ReiveNeck)
  691.             add_to_chat(39,'Entering a Reive... [Equipping Reive Neck]')
  692.             disable('neck')
  693.         else
  694.             send_command('gs c update')
  695.             add_to_chat(200,'Left a Reive... [Removing Reive Neck]')
  696.             enable('neck')
  697.         end
  698.     end
  699. end
  700.  
  701.  
  702. -- Called when the player's pet's status changes.
  703. -- This is also called after pet_change after a pet is released.  Check for pet validity.
  704. function job_pet_status_change(newStatus, oldStatus, eventArgs)
  705.     if pet.isvalid and not midaction() and not pet_midaction() and (newStatus == 'Engaged' or oldStatus == 'Engaged') then
  706.         handle_equipping_gear(player.status, newStatus)
  707.     end
  708. end
  709.  
  710.  
  711. -- Called when a player gains or loses a pet.
  712. -- pet == pet structure
  713. -- gain == true if the pet was gained, false if it was lost.
  714. function job_pet_change(petparam, gain)
  715.     classes.CustomIdleGroups:clear()
  716.     if gain then
  717.         if avatars:contains(pet.name) then
  718.             classes.CustomIdleGroups:append('Avatar')
  719.         elseif spirits:contains(pet.name) then
  720.             classes.CustomIdleGroups:append('Spirit')
  721.         end
  722.     else
  723.         select_default_macro_book('reset')
  724.     end
  725. end
  726.  
  727. -------------------------------------------------------------------------------------------------------------------
  728. -- User code that supplements standard library decisions.
  729. -------------------------------------------------------------------------------------------------------------------
  730.  
  731. -- Custom spell mapping.
  732. function job_get_spell_map(spell)
  733.     if spell.type == 'BloodPactRage' then
  734.         if magicalRagePacts:contains(spell.english) then
  735.             return 'MagicalBloodPactRage'
  736.         else
  737.             return 'PhysicalBloodPactRage'
  738.         end
  739.     elseif spell.type == 'BloodPactWard' and spell.target.type == 'MONSTER' then
  740.         return 'DebuffBloodPactWard'
  741.     end
  742. end
  743.  
  744. -- Modify the default idle set after it was constructed.
  745. function customize_idle_set(idleSet)
  746.     if pet.isvalid then
  747.         if pet.element == world.day_element then
  748.             idleSet = set_combine(idleSet, sets.perp.Day)
  749.         end
  750.         if pet.element == world.weather_element then
  751.             idleSet = set_combine(idleSet, sets.perp.Weather)
  752.         end
  753.         if sets.perp[pet.name] then
  754.             idleSet = set_combine(idleSet, sets.perp[pet.name])
  755.         end
  756.         gear.perp_staff.name = elements.perpetuance_staff_of[pet.element]
  757.         if gear.perp_staff.name and (player.inventory[gear.perp_staff.name] or player.wardrobe[gear.perp_staff.name]) then
  758.             idleSet = set_combine(idleSet, sets.perp.staff_and_grip)
  759.         end
  760.         if state.Buff["Avatar's Favor"] and avatars:contains(pet.name) then
  761.             idleSet = set_combine(idleSet, sets.idle.Avatar.Favor)
  762.         end
  763.         if pet.status == 'Engaged' then
  764.             --idleSet = set_combine(idleSet, sets.idle.Avatar.Melee)
  765.             idleSet = set_combine(idleSet, sets.IdlePetMelee[IdlePetMelee_Set_Names[IdlePetMelee_Index]])
  766.             --equip(sets.IdlePetMelee[IdlePetMelee_Set_Names[IdlePetMelee_Index]]) -- Avatar Test
  767.         end
  768.     end
  769.    
  770.     if player.mpp < 51 then
  771.         idleSet = set_combine(idleSet, sets.latent_refresh)
  772.     end
  773.    
  774.     return idleSet
  775. end
  776.  
  777. -- Called by the 'update' self-command, for common needs.
  778. -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
  779. function job_update(cmdParams, eventArgs)
  780.     classes.CustomIdleGroups:clear()
  781.     if pet.isvalid then
  782.         if avatars:contains(pet.name) then
  783.             classes.CustomIdleGroups:append('Avatar')
  784.         elseif spirits:contains(pet.name) then
  785.             classes.CustomIdleGroups:append('Spirit')
  786.         end
  787.     end
  788. end
  789.  
  790. -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  791. function display_current_job_state(eventArgs)
  792.  
  793. end
  794.  
  795.  
  796. -------------------------------------------------------------------------------------------------------------------
  797. -- User self-commands.
  798. -------------------------------------------------------------------------------------------------------------------
  799.  
  800. -- Called for custom player commands.
  801. function job_self_command(cmdParams, eventArgs)
  802.     if cmdParams[1]:lower() == 'petweather' then
  803.         handle_petweather()
  804.         eventArgs.handled = true
  805.     elseif cmdParams[1]:lower() == 'siphon' then
  806.         handle_siphoning()
  807.         eventArgs.handled = true
  808.     elseif cmdParams[1]:lower() == 'pact' then
  809.         handle_pacts(cmdParams)
  810.         eventArgs.handled = true
  811.     elseif cmdParams[1] == 'reset_ward_flag' then
  812.         wards.flag = false
  813.         wards.spell = ''
  814.         eventArgs.handled = true
  815.     elseif cmdParams[1]:lower() == 'petmelee' then -- Avatar Test
  816.         IdlePetMelee_Index = IdlePetMelee_Index +1
  817.         if IdlePetMelee_Index > #IdlePetMelee_Set_Names then IdlePetMelee_Index = 1 end
  818.         add_to_chat(207,'Idle Pet Melee Mode: '..IdlePetMelee_Set_Names[IdlePetMelee_Index]..'')
  819.         status_change(player.status)           
  820.     end
  821. end
  822.  
  823.  
  824. -------------------------------------------------------------------------------------------------------------------
  825. -- Utility functions specific to this job.
  826. -------------------------------------------------------------------------------------------------------------------
  827.  
  828. -- Cast the appopriate storm for the currently summoned avatar, if possible.
  829. function handle_petweather()
  830.     if player.sub_job ~= 'SCH' then
  831.         add_to_chat(122, "You can not cast storm spells")
  832.         return
  833.     end
  834.        
  835.     if not pet.isvalid then
  836.         add_to_chat(122, "You do not have an active avatar.")
  837.         return
  838.     end
  839.    
  840.     local element = pet.element
  841.     if element == 'Thunder' then
  842.         element = 'Lightning'
  843.     end
  844.    
  845.     if S{'Light','Dark','Lightning'}:contains(element) then
  846.         add_to_chat(122, 'You do not have access to '..elements.storm_of[element]..'.')
  847.         return
  848.     end
  849.    
  850.     local storm = elements.storm_of[element]
  851.    
  852.     if storm then
  853.         send_command('@input /ma "'..elements.storm_of[element]..'" <me>')
  854.     else
  855.         add_to_chat(123, 'Error: Unknown element ('..tostring(element)..')')
  856.     end
  857. end
  858.  
  859.  
  860. -- Custom uber-handling of Elemental Siphon
  861. function handle_siphoning()
  862.     if areas.Cities:contains(world.area) then
  863.         add_to_chat(122, 'Cannot use Elemental Siphon in a city area.')
  864.         return
  865.     end
  866.  
  867.     local siphonElement
  868.     local stormElementToUse
  869.     local releasedAvatar
  870.     local dontRelease
  871.    
  872.     -- If we already have a spirit out, just use that.
  873.     if pet.isvalid and spirits:contains(pet.name) then
  874.         siphonElement = pet.element
  875.         dontRelease = true
  876.         -- If current weather doesn't match the spirit, but the spirit matches the day, try to cast the storm.
  877.         if player.sub_job == 'SCH' and pet.element == world.day_element and pet.element ~= world.weather_element then
  878.             if not S{'Light','Dark','Lightning'}:contains(pet.element) then
  879.                 stormElementToUse = pet.element
  880.             end
  881.         end
  882.     -- If we're subbing /sch, there are some conditions where we want to make sure specific weather is up.
  883.     -- If current (single) weather is opposed by the current day, we want to change the weather to match
  884.     -- the current day, if possible.
  885.     elseif player.sub_job == 'SCH' and world.weather_element ~= 'None' then
  886.         -- We can override single-intensity weather; leave double weather alone, since even if
  887.         -- it's partially countered by the day, it's not worth changing.
  888.         if get_weather_intensity() == 1 then
  889.             -- If current weather is weak to the current day, it cancels the benefits for
  890.             -- siphon.  Change it to the day's weather if possible (+0 to +20%), or any non-weak
  891.             -- weather if not.
  892.             -- If the current weather matches the current avatar's element (being used to reduce
  893.             -- perpetuation), don't change it; just accept the penalty on Siphon.
  894.             if world.weather_element == elements.weak_to[world.day_element] and
  895.                 (not pet.isvalid or world.weather_element ~= pet.element) then
  896.                 -- We can't cast lightning/dark/light weather, so use a neutral element
  897.                 if S{'Light','Dark','Lightning'}:contains(world.day_element) then
  898.                     stormElementToUse = 'Wind'
  899.                 else
  900.                     stormElementToUse = world.day_element
  901.                 end
  902.             end
  903.         end
  904.     end
  905.    
  906.     -- If we decided to use a storm, set that as the spirit element to cast.
  907.     if stormElementToUse then
  908.         siphonElement = stormElementToUse
  909.     elseif world.weather_element ~= 'None' and (get_weather_intensity() == 2 or world.weather_element ~= elements.weak_to[world.day_element]) then
  910.         siphonElement = world.weather_element
  911.     else
  912.         siphonElement = world.day_element
  913.     end
  914.    
  915.     local command = ''
  916.     local releaseWait = 0
  917.    
  918.     if pet.isvalid and avatars:contains(pet.name) then
  919.         command = command..'input /pet "Release" <me>;wait 1.1;'
  920.         releasedAvatar = pet.name
  921.         releaseWait = 10
  922.     end
  923.    
  924.     if stormElementToUse then
  925.         command = command..'input /ma "'..elements.storm_of[stormElementToUse]..'" <me>;wait 4;'
  926.         releaseWait = releaseWait - 4
  927.     end
  928.    
  929.     if not (pet.isvalid and spirits:contains(pet.name)) then
  930.         command = command..'input /ma "'..elements.spirit_of[siphonElement]..'" <me>;wait 4;'
  931.         releaseWait = releaseWait - 4
  932.     end
  933.    
  934.     command = command..'input /ja "Elemental Siphon" <me>;'
  935.     releaseWait = releaseWait - 1
  936.     releaseWait = releaseWait + 0.1
  937.    
  938.     if not dontRelease then
  939.         if releaseWait > 0 then
  940.             command = command..'wait '..tostring(releaseWait)..';'
  941.         else
  942.             command = command..'wait 1.1;'
  943.         end
  944.        
  945.         command = command..'input /pet "Release" <me>;'
  946.     end
  947.    
  948.     if releasedAvatar then
  949.         command = command..'wait 1.1;input /ma "'..releasedAvatar..'" <me>'
  950.     end
  951.    
  952.     send_command(command)
  953. end
  954.  
  955.  
  956. -- Handles executing blood pacts in a generic, avatar-agnostic way.
  957. -- cmdParams is the split of the self-command.
  958. -- gs c [pact] [pacttype]
  959. function handle_pacts(cmdParams)
  960.     if areas.Cities:contains(world.area) then
  961.         add_to_chat(122, 'You cannot use pacts in town.')
  962.         return
  963.     end
  964.  
  965.     if not pet.isvalid then
  966.         add_to_chat(122,'No avatar currently available. Returning to default macro set.')
  967.         select_default_macro_book('reset')
  968.         return
  969.     end
  970.  
  971.     if spirits:contains(pet.name) then
  972.         add_to_chat(122,'Cannot use pacts with spirits.')
  973.         return
  974.     end
  975.  
  976.     if not cmdParams[2] then
  977.         add_to_chat(123,'No pact type given.')
  978.         return
  979.     end
  980.    
  981.     local pact = cmdParams[2]:lower()
  982.    
  983.     if not pacts[pact] then
  984.         add_to_chat(123,'Unknown pact type: '..tostring(pact))
  985.         return
  986.     end
  987.    
  988.     if pacts[pact][pet.name] then
  989.         if pact == 'astralflow' and not buffactive['astral flow'] then
  990.             add_to_chat(122,'Cannot use Astral Flow pacts at this time.')
  991.             return
  992.         end
  993.        
  994.         -- Leave out target; let Shortcuts auto-determine it.
  995.         send_command('@input /pet "'..pacts[pact][pet.name]..'"')
  996.     else
  997.         add_to_chat(122,pet.name..' does not have a pact of type ['..pact..'].')
  998.     end
  999. end
  1000.  
  1001.  
  1002. -- Event handler for updates to player skill, since we can't rely on skill being
  1003. -- correct at pet_aftercast for the creation of custom timers.
  1004. windower.raw_register_event('incoming chunk',
  1005.     function (id)
  1006.         if id == 0x62 then
  1007.             if wards.flag then
  1008.                 create_pact_timer(wards.spell)
  1009.                 wards.flag = false
  1010.                 wards.spell = ''
  1011.             end
  1012.         end
  1013.     end)
  1014.  
  1015. -- Function to create custom timers using the Timers addon.  Calculates ward duration
  1016. -- based on player skill and base pact duration (defined in job_setup).
  1017. function create_pact_timer(spell_name)
  1018.     -- Create custom timers for ward pacts.
  1019.     if wards.durations[spell_name] then
  1020.         local ward_duration = wards.durations[spell_name]
  1021.         if ward_duration < 181 then
  1022.             local skill = player.skills.summoning_magic
  1023.             if skill > 300 then
  1024.                 skill = skill - 300
  1025.                 if skill > 200 then skill = 200 end
  1026.                 ward_duration = ward_duration + skill
  1027.             end
  1028.         end
  1029.        
  1030.         local timer_cmd = 'timers c "'..spell_name..'" '..tostring(ward_duration)..' down'
  1031.        
  1032.         if wards.icons[spell_name] then
  1033.             timer_cmd = timer_cmd..' '..wards.icons[spell_name]
  1034.         end
  1035.  
  1036.         send_command(timer_cmd)
  1037.     end
  1038. end
  1039.  
  1040.  
  1041. -- Select default macro book on initial load or subjob change.
  1042. function select_default_macro_book(reset)
  1043.     if reset == 'reset' then
  1044.         -- lost pet, or tried to use pact when pet is gone
  1045.     end
  1046.    
  1047.     -- Default macro set/book
  1048.     set_macro_page(1, 20)
  1049. end
Advertisement
Add Comment
Please, Sign In to add comment