Advertisement
Guest User

Shirai's Summoner

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