midash

Orangebear_SMN

Jan 4th, 2014
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 32.52 KB | None | 0 0
  1.     include('organizer-lib')
  2. -------------------------------------------------------------------------------------------------------------------
  3. -- Setup functions for this job.  Generally should not be modified.
  4. -------------------------------------------------------------------------------------------------------------------
  5.  
  6. -- Also, you'll need the Shortcuts addon to handle the auto-targetting of the custom pact commands.
  7.  
  8. --[[
  9.     Custom commands:
  10.    
  11.     gs c petweather
  12.         Automatically casts the storm appropriate for the current avatar, if possible.
  13.    
  14.     gs c siphon
  15.         Automatically run the process to: dismiss the current avatar; cast appropriate
  16.         weather; summon the appropriate spirit; Elemental Siphon; release the spirit;
  17.         and re-summon the avatar.
  18.        
  19.         Will not cast weather you do not have access to.
  20.         Will not re-summon the avatar if one was not out in the first place.
  21.         Will not release the spirit if it was out before the command was issued.
  22.        
  23.     gs c pact [PactType]
  24.         Attempts to use the indicated pact type for the current avatar.
  25.         PactType can be one of:
  26.             cure
  27.             curaga
  28.             buffOffense
  29.             buffDefense
  30.             buffSpecial
  31.             debuff1
  32.             debuff2
  33.             sleep
  34.             nuke2
  35.             nuke4
  36.             bp70
  37.             bp75 (merits and lvl 75-80 pacts)
  38.             astralflow
  39.  
  40. --]]
  41.  
  42.  
  43. -- Initialization function for this job file.
  44. function get_sets()
  45.     mote_include_version = 2
  46.  
  47.     -- Load and initialize the include file.
  48.     include('Mote-Include.lua')
  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', ['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', ['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, ['Earthen Armor'] = 60, ['Inferno Howl'] = 60, ['Heavenward Howl'] = 60,
  100.         ['Rolling Thunder'] = 120, ['Fleet Wind'] = 120,
  101.         ['Shining Ruby'] = 180, ['Frost Armor'] = 180, ['Lightning Armor'] = 180, ['Ecliptic Growl'] = 180,
  102.         ['Glittering Ruby'] = 180, ['Hastega'] = 180, ['Noctoshield'] = 180, ['Ecliptic Howl'] = 180,
  103.         ['Dream Shroud'] = 180,
  104.         ['Reraise II'] = 3600
  105.     }
  106.     -- Icons to use when creating the custom timer.
  107.     wards.icons = {
  108.         ['Earthen Armor']   = 'spells/00299.png', -- 00299 for Titan
  109.         ['Shining Ruby']    = 'spells/00043.png', -- 00043 for Protect
  110.         ['Dream Shroud']    = 'spells/00304.png', -- 00304 for Diabolos
  111.         ['Noctoshield']     = 'spells/00106.png', -- 00106 for Phalanx
  112.         ['Inferno Howl']    = 'spells/00298.png', -- 00298 for Ifrit
  113.         ['Hastega']         = 'spells/00358.png', -- 00358 for Hastega
  114.         ['Rolling Thunder'] = 'spells/00104.png', -- 00358 for Enthunder
  115.         ['Frost Armor']     = 'spells/00250.png', -- 00250 for Ice Spikes
  116.         ['Lightning Armor'] = 'spells/00251.png', -- 00251 for Shock Spikes
  117.         ['Reraise II']      = 'spells/00135.png', -- 00135 for Reraise
  118.         ['Fleet Wind']      = 'abilities/00074.png', --
  119.     }
  120.     -- Flags for code to get around the issue of slow skill updates.
  121.     wards.flag = false
  122.     wards.spell = ''
  123.    
  124. end
  125.  
  126. -------------------------------------------------------------------------------------------------------------------
  127. -- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
  128. -------------------------------------------------------------------------------------------------------------------
  129.  
  130. -- Setup vars that are user-dependent.  Can override this function in a sidecar file.
  131. function user_setup()
  132.     state.OffenseMode:options('None', 'Normal', 'Acc')
  133.     state.CastingMode:options('Normal', 'Resistant')
  134.     state.IdleMode:options('Normal', 'PDT')
  135.  
  136.     gear.perp_staff = {name=""}
  137.    
  138.     select_default_macro_book()
  139. end
  140.  
  141.  
  142. -- Define sets and vars used by this job file.
  143. function init_gear_sets()
  144.     --------------------------------------
  145.     -- Precast Sets
  146.     --------------------------------------
  147.     organizer_items = {
  148.   echos="Echo Drops",
  149.   remedy="Remedy",
  150.   orb="Macrocosmic Orb",
  151.   sushi="Squid Sushi",
  152.   Crepe="Pear Crepe",
  153.   sushi2="Sole Sushi"
  154. }
  155.     -- Precast sets to enhance JAs
  156.     sets.precast.JA['Astral Flow'] = {head="Glyphic Horn +1"}
  157.    
  158.     sets.precast.JA['Elemental Siphon'] = {main="Soulscourge",
  159.         head="Convoker's Horn +1",neck="Caller's Pendant",
  160.         body="Caller's Doublet +2",hands="Glyphic Bracers +1",ring1="Evoker's Ring",ring2="Fervor Ring",
  161.         legs="Marduk's Shalwar +1",feet="Caller's Pigaches +2"}
  162.  
  163.     sets.precast.JA['Mana Cede'] = {hands="Caller's Bracers +2"}
  164.  
  165.     -- Pact delay reduction gear
  166.     sets.precast.BloodPactWard = {ammo="Seraphicaller",head="Convoker's Horn +1",body="Convo. Doublet",hands="Glyphic Bracers +1",
  167.         back="Samanisi Cape"}
  168.  
  169.     sets.precast.BloodPactRage = sets.precast.BloodPactWard
  170.  
  171.     -- Fast cast sets for spells
  172.    
  173.     sets.precast.FC = {
  174.         head="Nahtirah Hat",ear2="Loquacious Earring",
  175.         body="Vanir Cotehardie",ring1="Prolix Ring",neck="Orunmila's Torque",
  176.         back="Swith Cape +1",waist="Witful Belt",legs="Artsieq Hose",feet="Chelona Boots"}
  177.  
  178.     sets.precast.FC['Enhancing Magic'] = set_combine(sets.precast.FC, {waist="Siegel Sash"})
  179.  
  180.        
  181.     -- Weaponskill sets
  182.     -- Default set for any weaponskill that isn't any more specifically defined
  183.     sets.precast.WS = {
  184.         head="Nahtirah Hat",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  185.         body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
  186.         back="Pahtli Cape",waist="Cascade Belt",legs="Hagondes Pants +1",feet="Hagondes Sabots"}
  187.  
  188.     -- Specific weaponskill sets.  Uses the base set if an appropriate WSMod version isn't found.
  189.     sets.precast.WS['Myrkr'] = {
  190.         head="Nahtirah Hat",ear1="Gifted Earring",ear2="Loquacious Earring",
  191.         body="Convoker's Doublet",hands="Caller's Bracers +2",ring1="Evoker's Ring",ring2="Sangoma Ring",
  192.         back="Pahtli Cape",waist="Fucho-no-Obi",legs="Assiduity Pants +1",feet="Chelona Boots"}
  193.  
  194.    
  195.     --------------------------------------
  196.     -- Midcast sets
  197.     --------------------------------------
  198.  
  199.     sets.midcast.FastRecast = {
  200.         head="Nahtirah Hat",ear2="Loquacious Earring",
  201.         body="Vanir Cotehardie",hands="Bokwus Gloves",ring1="Prolix Ring",
  202.         back="Swith Cape +1",waist="Witful Belt",legs="Hagondes Pants +1",feet="Hagondes Sabots"}
  203.  
  204.     sets.midcast.Cure = {main="Tamaxchi",sub="Genbu's Shield",
  205.         head="Nahtirah Hat",ear2="Loquacious Earring",
  206.         body="Heka's Kalasiris",hands="Bokwus Gloves",ring1="Prolix Ring",ring2="Sirona's Ring",
  207.         back="Swith Cape +1",waist="Witful Belt",legs="Hagondes Pants +1",feet="Hagondes Sabots"}
  208.  
  209.     sets.midcast.Stoneskin = {waist="Siegel Sash"}
  210.  
  211.     sets.midcast['Elemental Magic'] = {main="Lehbrailg +2",sub="Mephitis Grip",ammo="Ghastly Tathlum +1",
  212.         head="Buremte Hat",neck="Eddy Necklace",ear1="Crematio Earring",ear2="Friomisi Earring",
  213.         body="Hagondes Coat +1",hands="Yaoyotl Gloves",ring1="Sangoma Ring",ring2="Strendu Ring",
  214.         back="Toro Cape",waist="Sekhmet Corset",legs="Hagondes Pants +1",feet="Hagondes Sabots"}
  215.  
  216.     sets.midcast['Dark Magic'] = {main="Lehbrailg +2",sub="Mephitis Grip",
  217.         head="Nahtirah Hat",neck="Eddy Necklace",ear1="Lifestorm Earring",ear2="Psystorm Earring",
  218.         body="Hagondes Coat +1",hands="Yaoyotl Gloves",ring1="Excelsis Ring",ring2="Sangoma Ring",
  219.         waist="Fucho-no-Obi",legs="Artsieq Hose",feet="Artsieq Boots"}
  220.  
  221.  
  222.     -- Avatar pact sets.  All pacts are Ability type.
  223.    
  224.     sets.midcast.Pet.BloodPactWard = {main="Soulscourge",ammo="Seraphicaller",
  225.         head="Convoker's Horn +1",neck="Caller's Pendant",
  226.         body="Caller's Doublet +2",hands="Glyphic Bracers +1",ring1="Evoker's Ring",ring2="Fervor Ring",
  227.         waist="Diabolos's Rope",legs="Marduk's Shalwar +1"}
  228.  
  229.     sets.midcast.Pet.DebuffBloodPactWard = {main="Soulscourge",ammo="Seraphicaller",
  230.         head="Convoker's Horn +1",neck="Caller's Pendant",
  231.         body="Caller's Doublet +2",hands="Glyphic Bracers +1",ring1="Evoker's Ring",ring2="Fervor Ring",
  232.         waist="Diabolos's Rope",legs="Marduk's Shalwar +1"}
  233.        
  234.     sets.midcast.Pet.DebuffBloodPactWard.Acc = sets.midcast.Pet.DebuffBloodPactWard
  235.    
  236.     sets.midcast.Pet.PhysicalBloodPactRage = {main="Soulscourge",ammo="Seraphicaller",
  237.         head="Convoker's Horn +1",neck="Caller's Pendant",
  238.         body="Convoker's Doublet",hands="Glyphic Bracers +1",ring1="Evoker's Ring",ring2="Fervor Ring",
  239.         waist="Diabolos's Rope",legs="Convoker's Spats +1",feet="Convoker's Pigaches"}
  240.  
  241.     sets.midcast.Pet.PhysicalBloodPactRage.Acc = sets.midcast.Pet.PhysicalBloodPactRage
  242.  
  243.     sets.midcast.Pet.MagicalBloodPactRage = {main="Eminent Pole",ammo="Seraphicaller",
  244.         head="Glyphic Horn +1",neck="Caller's Pendant",
  245.         body="Convoker's Doublet",hands="Glyphic Bracers +1",ring1="Evoker's Ring",ring2="Fervor Ring",
  246.         back="Samanisi Cape",waist="Diabolos's Rope",legs="Caller's Spats +2",feet="Hagondes Sabots"}
  247.  
  248.     sets.midcast.Pet.MagicalBloodPactRage.Acc = sets.midcast.Pet.MagicalBloodPactRage
  249.  
  250.  
  251.     -- Spirits cast magic spells, which can be identified in standard ways.
  252.    
  253.     sets.midcast.Pet.WhiteMagic = {legs="Summoner's Spats"}
  254.    
  255.     sets.midcast.Pet['Elemental Magic'] = set_combine(sets.midcast.Pet.BloodPactRage, {legs="Summoner's Spats"})
  256.  
  257.     sets.midcast.Pet['Elemental Magic'].Resistant = {}
  258.    
  259.  
  260.     --------------------------------------
  261.     -- Idle/resting/defense/etc sets
  262.     --------------------------------------
  263.    
  264.     -- Resting sets
  265.     sets.resting = {main="Chatoyant Staff",ammo="Seraphicaller",
  266.         head="Convoker's Horn +1",neck="Bathy Choker",ear1="Gifted Earring",ear2="Loquacious Earring",
  267.         body="Hagondes Coat +1",hands="Serpentes Cuffs",ring1="Sheltered Ring",ring2="Paguroidea Ring",
  268.         back="Kumbira Cape",waist="Hierarch Belt",legs="Assiduity Pants +1",feet="Serpentes Sabots"}
  269.    
  270.     -- Idle sets
  271.     sets.idle = {main="Bolelabunga",sub="Genbu's Shield",ammo="Seraphicaller",
  272.         head="Convoker's Horn +1",neck="Bathy Choker",ear1="Gifted Earring",ear2="Loquacious Earring",
  273.         body="Hagondes Coat +1",hands="Serpentes Cuffs",ring1="Sheltered Ring",ring2="Sangoma Ring",
  274.         back="Kumbira Cape",waist="Fucho-no-Obi",legs="Assiduity Pants +1",feet="Serpentes Sabots"}
  275.  
  276.     sets.idle.PDT = {main="Terra's Staff",sub="Achaq Grip",ammo="Seraphicaller",
  277.         head="Convoker's Horn +1",neck="Loricate Torque +1",ear1="Gifted Earring",ear2="Loquacious Earring",
  278.         body="Hagondes Coat +1",hands="Yaoyotl Gloves",ring1="Dark Ring",ring2="Sangoma Ring",
  279.         back="Repulse Mantle",waist="Fucho-no-Obi",legs="Hagondes Pants +1",feet="Serpentes Sabots"}
  280.  
  281.     -- perp costs:
  282.     -- spirits: 7
  283.     -- carby: 11 (5 with mitts)
  284.     -- fenrir: 13
  285.     -- others: 15
  286.     -- avatar's favor: -4/tick
  287.    
  288.     -- Max useful -perp gear is 1 less than the perp cost (can't be reduced below 1)
  289.     -- Aim for -14 perp, and refresh in other slots.
  290.    
  291.     -- -perp gear:
  292.     -- Gridarvor: -5
  293.     -- Glyphic Horn +1: -4
  294.     -- Caller's Doublet +2/Glyphic Doublet: -4
  295.     -- Evoker's Ring: -1
  296.     -- Convoker's Pigaches: -4
  297.     -- total: -18
  298.    
  299.     -- Can make due without either the head or the body, and use +refresh items in those slots.
  300.    
  301.     sets.idle.Avatar = {main="Gridarvor",sub="Achaq Grip",ammo="Seraphicaller",
  302.         head="Convoker's Horn +1",neck="Caller's Pendant",ear1="Gifted Earring",ear2="Loquacious Earring",
  303.         body="Convoker's Doublet",hands="Serpentes Cuffs",ring1="Evoker's Ring",ring2="Sangoma Ring",
  304.         back="Repulse Mantle",waist="Fucho-no-Obi",legs="Ngen Seraweels",feet="Convoker's Pigaches"}
  305.  
  306.     sets.idle.Spirit = {main="Gridarvor",sub="Achaq Grip",ammo="Seraphicaller",
  307.         head="Convoker's Horn +1",neck="Caller's Pendant",ear1="Gifted Earring",ear2="Loquacious Earring",
  308.         body="Hagondes Coat +1",hands="Serpentes Cuffs",ring1="Evoker's Ring",ring2="Sangoma Ring",
  309.         back="Samanisi Cape",waist="Fucho-no-Obi",legs="Summoner's Spats",feet="Serpentes Sabots"}
  310.  
  311.     sets.idle.Town = {main="Bolelabunga",sub="Genbu's Shield",ammo="Seraphicaller",
  312.         head="Convoker's Horn +1",neck="Bathy Choker",ear1="Gifted Earring",ear2="Loquacious Earring",
  313.         body="Hagondes Coat +1",hands="Serpentes Cuffs",ring1="Sheltered Ring",ring2="Sangoma Ring",
  314.         back="Repulse Mantle",waist="Fucho-no-Obi",legs="Assiduity Pants +1",feet="Serpentes Sabots"}
  315.  
  316.     -- Favor uses Caller's Horn instead of Convoker's Horn +1 for refresh
  317.     sets.idle.Avatar.Favor = {head="Caller's Horn +2"}
  318.     sets.idle.Avatar.Melee = {hands="Regimen Mittens",back="Samanisi Cape",waist="Kuku Stone",legs="Convoker's Spats +1"}
  319.        
  320.     sets.perp = {}
  321.     -- Caller's Bracer's halve the perp cost after other costs are accounted for.
  322.     -- Using -10 (Gridavor, ring, Conv.feet), standard avatars would then cost 5, halved to 2.
  323.     -- We can then use Hagondes Coat +1 and end up with the same net MP cost, but significantly better defense.
  324.     -- Weather is the same, but we can also use the latent on the pendant to negate the last point lost.
  325.     sets.perp.Day = {body="Hagondes Coat +1",hands="Caller's Bracers +2"}
  326.     sets.perp.Weather = {neck="Caller's Pendant",body="Hagondes Coat +1",hands="Caller's Bracers +2"}
  327.     -- Carby: Mitts+Conv.feet = 1/tick perp.  Everything else should be +refresh
  328.     sets.perp.Carbuncle = {main="Bolelabunga",sub="Genbu's Shield",
  329.         head="Convoker's Horn +1",body="Hagondes Coat +1",hands="Carbuncle Mitts",legs="Assiduity Pants +1",feet="Convoker's Pigaches"}
  330.     -- Diabolos's Rope doesn't gain us anything at this time
  331.     --sets.perp.Diabolos = {waist="Diabolos's Rope"}
  332.     sets.perp.Alexander = sets.midcast.Pet.BloodPactWard
  333.  
  334.     sets.perp.staff_and_grip = {main=gear.perp_staff,sub="Achaq Grip"}
  335.    
  336.     -- Defense sets
  337.     sets.defense.PDT = {"Terra's Staff",
  338.         head="Hagondes Hat +1",neck="Bathy Choker",ear1="Gifted Earring",ear2="Loquacious Earring",
  339.         body="Hagondes Coat +1",hands="Yaoyotl Gloves",ring1="Dark Ring",ring2="Dark Ring",
  340.         back="Repulse Mantle",waist="Fucho-no-Obi",legs="Hagondes Pants +1",feet="Hagondes Sabots"}
  341.  
  342.     sets.defense.MDT = {
  343.         head="Hagondes Hat +1",neck="Loricate Torque +1",ear1="Gifted Earring",ear2="Loquacious Earring",
  344.         body="Anhur Robe",hands="Yaoyotl Gloves",ring1="Dark Ring",ring2="Shadow Ring",
  345.         back="Repulse Mantle",waist="Fucho-no-Obi",legs="Artsieq Hose",feet="Hagondes Sabots"}
  346.  
  347.     sets.Kiting = {feet="Serpentes Sabots"}
  348.    
  349.     sets.latent_refresh = {waist="Fucho-no-Obi"}
  350.    
  351.  
  352.     --------------------------------------
  353.     -- Engaged sets
  354.     --------------------------------------
  355.    
  356.     -- Normal melee group
  357.     sets.engaged = {ammo="Seraphicaller",
  358.         head="Nahtirah Hat",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  359.         body="Hagondes Coat +1",hands="Bokwus Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
  360.         back="Repulse Mantle",waist="Goading Belt",legs="Hagondes Pants +1",feet="Hagondes Sabots"}
  361. end
  362.  
  363. -------------------------------------------------------------------------------------------------------------------
  364. -- Job-specific hooks for standard casting events.
  365. -------------------------------------------------------------------------------------------------------------------
  366.  
  367. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  368. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  369. function job_precast(spell, action, spellMap, eventArgs)
  370.     if state.Buff['Astral Conduit'] and pet_midaction() then
  371.         eventArgs.handled = true
  372.     end
  373. end
  374.  
  375. function job_midcast(spell, action, spellMap, eventArgs)
  376.     if state.Buff['Astral Conduit'] and pet_midaction() then
  377.         eventArgs.handled = true
  378.     end
  379. end
  380.  
  381. -- Runs when pet completes an action.
  382. function job_pet_aftercast(spell, action, spellMap, eventArgs)
  383.     if not spell.interrupted and spell.type == 'BloodPactWard' and spellMap ~= 'DebuffBloodPactWard' then
  384.         wards.flag = true
  385.         wards.spell = spell.english
  386.         send_command('wait 4; gs c reset_ward_flag')
  387.     end
  388. end
  389.  
  390. -------------------------------------------------------------------------------------------------------------------
  391. -- Job-specific hooks for non-casting events.
  392. -------------------------------------------------------------------------------------------------------------------
  393.  
  394. -- Called when a player gains or loses a buff.
  395. -- buff == buff gained or lost
  396. -- gain == true if the buff was gained, false if it was lost.
  397. function job_buff_change(buff, gain)
  398.     if state.Buff[buff] ~= nil then
  399.         handle_equipping_gear(player.status)
  400.     elseif storms:contains(buff) then
  401.         handle_equipping_gear(player.status)
  402.     end
  403. end
  404.  
  405.  
  406. -- Called when the player's pet's status changes.
  407. -- This is also called after pet_change after a pet is released.  Check for pet validity.
  408. function job_pet_status_change(newStatus, oldStatus, eventArgs)
  409.     if pet.isvalid and not midaction() and not pet_midaction() and (newStatus == 'Engaged' or oldStatus == 'Engaged') then
  410.         handle_equipping_gear(player.status, newStatus)
  411.     end
  412. end
  413.  
  414.  
  415. -- Called when a player gains or loses a pet.
  416. -- pet == pet structure
  417. -- gain == true if the pet was gained, false if it was lost.
  418. function job_pet_change(petparam, gain)
  419.     classes.CustomIdleGroups:clear()
  420.     if gain then
  421.         if avatars:contains(pet.name) then
  422.             classes.CustomIdleGroups:append('Avatar')
  423.         elseif spirits:contains(pet.name) then
  424.             classes.CustomIdleGroups:append('Spirit')
  425.         end
  426.     else
  427.         select_default_macro_book('reset')
  428.     end
  429. end
  430.  
  431. -------------------------------------------------------------------------------------------------------------------
  432. -- User code that supplements standard library decisions.
  433. -------------------------------------------------------------------------------------------------------------------
  434.  
  435. -- Custom spell mapping.
  436. function job_get_spell_map(spell)
  437.     if spell.type == 'BloodPactRage' then
  438.         if magicalRagePacts:contains(spell.english) then
  439.             return 'MagicalBloodPactRage'
  440.         else
  441.             return 'PhysicalBloodPactRage'
  442.         end
  443.     elseif spell.type == 'BloodPactWard' and spell.target.type == 'MONSTER' then
  444.         return 'DebuffBloodPactWard'
  445.     end
  446. end
  447.  
  448. -- Modify the default idle set after it was constructed.
  449. function customize_idle_set(idleSet)
  450.     if pet.isvalid then
  451.         if pet.element == world.day_element then
  452.             idleSet = set_combine(idleSet, sets.perp.Day)
  453.         end
  454.         if pet.element == world.weather_element then
  455.             idleSet = set_combine(idleSet, sets.perp.Weather)
  456.         end
  457.         if sets.perp[pet.name] then
  458.             idleSet = set_combine(idleSet, sets.perp[pet.name])
  459.         end
  460.         gear.perp_staff.name = elements.perpetuance_staff_of[pet.element]
  461.         if gear.perp_staff.name and (player.inventory[gear.perp_staff.name] or player.wardrobe[gear.perp_staff.name]) then
  462.             idleSet = set_combine(idleSet, sets.perp.staff_and_grip)
  463.         end
  464.         if state.Buff["Avatar's Favor"] and avatars:contains(pet.name) then
  465.             idleSet = set_combine(idleSet, sets.idle.Avatar.Favor)
  466.         end
  467.         if pet.status == 'Engaged' then
  468.             idleSet = set_combine(idleSet, sets.idle.Avatar.Melee)
  469.         end
  470.     end
  471.    
  472.     if player.mpp < 51 then
  473.        idleSet = set_combine(idleSet, sets.latent_refresh)
  474.    end
  475.    
  476.    return idleSet
  477. end
  478.  
  479. -- Called by the 'update' self-command, for common needs.
  480. -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
  481. function job_update(cmdParams, eventArgs)
  482.    classes.CustomIdleGroups:clear()
  483.    if pet.isvalid then
  484.        if avatars:contains(pet.name) then
  485.            classes.CustomIdleGroups:append('Avatar')
  486.        elseif spirits:contains(pet.name) then
  487.            classes.CustomIdleGroups:append('Spirit')
  488.        end
  489.    end
  490. end
  491. -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  492. function display_current_job_state(eventArgs)
  493.  
  494. end
  495.  
  496.  
  497. -------------------------------------------------------------------------------------------------------------------
  498. -- User self-commands.
  499. -------------------------------------------------------------------------------------------------------------------
  500.  
  501. -- Called for custom player commands.
  502. function job_self_command(cmdParams, eventArgs)
  503.    if cmdParams[1]:lower() == 'petweather' then
  504.        handle_petweather()
  505.        eventArgs.handled = true
  506.    elseif cmdParams[1]:lower() == 'siphon' then
  507.        handle_siphoning()
  508.        eventArgs.handled = true
  509.    elseif cmdParams[1]:lower() == 'pact' then
  510.        handle_pacts(cmdParams)
  511.        eventArgs.handled = true
  512.    elseif cmdParams[1] == 'reset_ward_flag' then
  513.        wards.flag = false
  514.        wards.spell = ''
  515.        eventArgs.handled = true
  516.    end
  517. end
  518.  
  519.  
  520. -------------------------------------------------------------------------------------------------------------------
  521. -- Utility functions specific to this job.
  522. -------------------------------------------------------------------------------------------------------------------
  523.  
  524. -- Cast the appopriate storm for the currently summoned avatar, if possible.
  525. function handle_petweather()
  526.    if player.sub_job ~= 'SCH' then
  527.        add_to_chat(122, "You can not cast storm spells")
  528.        return
  529.    end
  530.        
  531.    if not pet.isvalid then
  532.        add_to_chat(122, "You do not have an active avatar.")
  533.        return
  534.    end
  535.    
  536.    local element = pet.element
  537.    if element == 'Thunder' then
  538.        element = 'Lightning'
  539.    end
  540.    
  541.    if S{'Light','Dark','Lightning'}:contains(element) then
  542.        add_to_chat(122, 'You do not have access to '..elements.storm_of[element]..'.')
  543.        return
  544.    end
  545.    
  546.    local storm = elements.storm_of[element]
  547.    
  548.    if storm then
  549.        send_command('@input /ma "'..elements.storm_of[element]..'" <me>')
  550.     else
  551.         add_to_chat(123, 'Error: Unknown element ('..tostring(element)..')')
  552.     end
  553. end
  554.  
  555.  
  556. -- Custom uber-handling of Elemental Siphon
  557. function handle_siphoning()
  558.     if areas.Cities:contains(world.area) then
  559.         add_to_chat(122, 'Cannot use Elemental Siphon in a city area.')
  560.         return
  561.     end
  562.  
  563.     local siphonElement
  564.     local stormElementToUse
  565.     local releasedAvatar
  566.     local dontRelease
  567.    
  568.     -- If we already have a spirit out, just use that.
  569.     if pet.isvalid and spirits:contains(pet.name) then
  570.         siphonElement = pet.element
  571.         dontRelease = true
  572.         -- If current weather doesn't match the spirit, but the spirit matches the day, try to cast the storm.
  573.         if player.sub_job == 'SCH' and pet.element == world.day_element and pet.element ~= world.weather_element then
  574.             if not S{'Light','Dark','Lightning'}:contains(pet.element) then
  575.                 stormElementToUse = pet.element
  576.             end
  577.         end
  578.     -- If we're subbing /sch, there are some conditions where we want to make sure specific weather is up.
  579.     -- If current (single) weather is opposed by the current day, we want to change the weather to match
  580.     -- the current day, if possible.
  581.     elseif player.sub_job == 'SCH' and world.weather_element ~= 'None' then
  582.         -- We can override single-intensity weather; leave double weather alone, since even if
  583.         -- it's partially countered by the day, it's not worth changing.
  584.         if get_weather_intensity() == 1 then
  585.             -- If current weather is weak to the current day, it cancels the benefits for
  586.             -- siphon.  Change it to the day's weather if possible (+0 to +20%), or any non-weak
  587.             -- weather if not.
  588.             -- If the current weather matches the current avatar's element (being used to reduce
  589.             -- perpetuation), don't change it; just accept the penalty on Siphon.
  590.             if world.weather_element == elements.weak_to[world.day_element] and
  591.                 (not pet.isvalid or world.weather_element ~= pet.element) then
  592.                 -- We can't cast lightning/dark/light weather, so use a neutral element
  593.                 if S{'Light','Dark','Lightning'}:contains(world.day_element) then
  594.                     stormElementToUse = 'Wind'
  595.                 else
  596.                     stormElementToUse = world.day_element
  597.                 end
  598.             end
  599.         end
  600.     end
  601.    
  602.     -- If we decided to use a storm, set that as the spirit element to cast.
  603.     if stormElementToUse then
  604.         siphonElement = stormElementToUse
  605.     elseif world.weather_element ~= 'None' and (get_weather_intensity() == 2 or world.weather_element ~= elements.weak_to[world.day_element]) then
  606.         siphonElement = world.weather_element
  607.     else
  608.         siphonElement = world.day_element
  609.     end
  610.    
  611.     local command = ''
  612.     local releaseWait = 0
  613.    
  614.     if pet.isvalid and avatars:contains(pet.name) then
  615.         command = command..'input /pet "Release" <me>;wait 1.1;'
  616.         releasedAvatar = pet.name
  617.         releaseWait = 10
  618.     end
  619.    
  620.     if stormElementToUse then
  621.         command = command..'input /ma "'..elements.storm_of[stormElementToUse]..'" <me>;wait 4;'
  622.         releaseWait = releaseWait - 4
  623.     end
  624.    
  625.     if not (pet.isvalid and spirits:contains(pet.name)) then
  626.         command = command..'input /ma "'..elements.spirit_of[siphonElement]..'" <me>;wait 4;'
  627.         releaseWait = releaseWait - 4
  628.     end
  629.    
  630.     command = command..'input /ja "Elemental Siphon" <me>;'
  631.     releaseWait = releaseWait - 1
  632.     releaseWait = releaseWait + 0.1
  633.    
  634.     if not dontRelease then
  635.         if releaseWait > 0 then
  636.             command = command..'wait '..tostring(releaseWait)..';'
  637.         else
  638.             command = command..'wait 1.1;'
  639.         end
  640.        
  641.         command = command..'input /pet "Release" <me>;'
  642.     end
  643.    
  644.     if releasedAvatar then
  645.         command = command..'wait 1.1;input /ma "'..releasedAvatar..'" <me>'
  646.     end
  647.    
  648.     send_command(command)
  649. end
  650.  
  651.  
  652. -- Handles executing blood pacts in a generic, avatar-agnostic way.
  653. -- cmdParams is the split of the self-command.
  654. -- gs c [pact] [pacttype]
  655. function handle_pacts(cmdParams)
  656.     if areas.Cities:contains(world.area) then
  657.         add_to_chat(122, 'You cannot use pacts in town.')
  658.         return
  659.     end
  660.  
  661.     if not pet.isvalid then
  662.         add_to_chat(122,'No avatar currently available. Returning to default macro set.')
  663.         select_default_macro_book('reset')
  664.         return
  665.     end
  666.  
  667.     if spirits:contains(pet.name) then
  668.         add_to_chat(122,'Cannot use pacts with spirits.')
  669.         return
  670.     end
  671.  
  672.     if not cmdParams[2] then
  673.         add_to_chat(123,'No pact type given.')
  674.         return
  675.     end
  676.    
  677.     local pact = cmdParams[2]:lower()
  678.    
  679.     if not pacts[pact] then
  680.         add_to_chat(123,'Unknown pact type: '..tostring(pact))
  681.         return
  682.     end
  683.    
  684.     if pacts[pact][pet.name] then
  685.         if pact == 'astralflow' and not buffactive['astral flow'] then
  686.             add_to_chat(122,'Cannot use Astral Flow pacts at this time.')
  687.             return
  688.         end
  689.        
  690.         -- Leave out target; let Shortcuts auto-determine it.
  691.         send_command('@input /pet "'..pacts[pact][pet.name]..'"')
  692.     else
  693.         add_to_chat(122,pet.name..' does not have a pact of type ['..pact..'].')
  694.     end
  695. end
  696.  
  697.  
  698. -- Event handler for updates to player skill, since we can't rely on skill being
  699. -- correct at pet_aftercast for the creation of custom timers.
  700. windower.raw_register_event('incoming chunk',
  701.     function (id)
  702.         if id == 0x62 then
  703.             if wards.flag then
  704.                 create_pact_timer(wards.spell)
  705.                 wards.flag = false
  706.                 wards.spell = ''
  707.             end
  708.         end
  709.     end)
  710.  
  711. -- Function to create custom timers using the Timers addon.  Calculates ward duration
  712. -- based on player skill and base pact duration (defined in job_setup).
  713. function create_pact_timer(spell_name)
  714.     -- Create custom timers for ward pacts.
  715.     if wards.durations[spell_name] then
  716.         local ward_duration = wards.durations[spell_name]
  717.         if ward_duration < 181 then
  718.            local skill = player.skills.summoning_magic
  719.            if skill > 300 then
  720.                 skill = skill - 300
  721.                 if skill > 200 then skill = 200 end
  722.                 ward_duration = ward_duration + skill
  723.             end
  724.         end
  725.        
  726.         local timer_cmd = 'timers c "'..spell_name..'" '..tostring(ward_duration)..' down'
  727.        
  728.         if wards.icons[spell_name] then
  729.             timer_cmd = timer_cmd..' '..wards.icons[spell_name]
  730.         end
  731.  
  732.         send_command(timer_cmd)
  733.     end
  734. end
  735.  
  736.  
  737. -- Select default macro book on initial load or subjob change.
  738. function select_default_macro_book(reset)
  739.     if reset == 'reset' then
  740.         -- lost pet, or tried to use pact when pet is gone
  741.     end
  742.    
  743.     -- Default macro set/book
  744.     set_macro_page(1, 4)
  745. end
Advertisement
Add Comment
Please, Sign In to add comment