Advertisement
Shirai_the_Cat

Shirai's Summoner

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