Falkirk

Falkirk SMN lua

Sep 24th, 2017 (edited)
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 47.77 KB | None | 0 0
  1. ---------------------------------------
  2. -- Last Revised: October 12th, 2017 --
  3. ---------------------------------------
  4. --
  5. ---------------------------------------------
  6. -- Gearswap Commands Specific to this File --
  7. ---------------------------------------------
  8. -- Universal Blood Pact Commands -
  9. -- //gs c Bloodpact one
  10. -- //gs c Bloodpact two
  11. -- //gs c Bloodpact three
  12. -- //gs c Bloodpact four
  13. --
  14. -- alt+F8 cycles through designated Avatars
  15. -- ctrl+F8 cycles backwards through designated Avatars
  16. -- ctrl+F9 cycles through Pet stances for Subtle Blow and Store TP modes
  17. -- alt+= switches between Pet-Only (Staff Swaps) and Master (no Staff Swap) modes
  18. -- ctrl+` can swap in the usage of Chaac Belt for Treasure Hunter on common subjob abilities.
  19. -- ctrl+F11 cycles between Magical Defense Modes
  20. -- ctrl+= activates a LagMode which swaps in most pet gear during precast.
  21. --
  22. -------------------------------
  23. -- General Gearswap Commands --
  24. -------------------------------
  25. -- F9 cycles Accuracy modes
  26. -- ctrl+F9 cycles Hybrid modes
  27. -- F10 equips Physical Defense
  28. -- alt+F10 toggles Kiting on or off
  29. -- ctrl+F10 cycles Physical Defense modes
  30. -- F11 equips Magical Defense
  31. -- alt+F12 turns off Defense modes
  32. -- ctrl+F12 cycles Idle modes
  33. --
  34. -- Keep in mind that any time you Change Jobs/Subjobs, your Avatar etc reset to default options.
  35. -- F12 will list your current options.
  36. --
  37. -------------------------------------------------------------------------------------------------------------------
  38. -- Initialization function that defines sets and variables to be used.
  39. -------------------------------------------------------------------------------------------------------------------
  40.  
  41. -- IMPORTANT: Make sure to also get the Mote-Include.lua file (and its supplementary files) to go with this.
  42.  
  43. -- Initialization function for this job file.
  44. function get_sets()
  45.     mote_include_version = 2
  46.  
  47.     -- Load and initialize the include file.
  48.     include('Mote-Include.lua')
  49. end
  50.  
  51. function job_setup()
  52.     -- Display and Random Lockstyle Generator options
  53.     DisplayModeInfo = 'true'
  54.     RandomLockstyleGenerator = 'true'
  55.  
  56.     PetName = 'None';PetJob = 'None';PetInfo = 'None';BloodPactOne = 'None';BloodPactTwo = 'None';BloodPactThree = 'None';BloodPactFour = 'None'
  57.     pet_info_update()
  58.  
  59.     -- Display Mode Info as on-screen Text
  60.     TextBoxX = 1075
  61.     TextBoxY = 47
  62.     TextSize = 10
  63.  
  64.     -- List of Equipment Sets created for Random Lockstyle Generator
  65.     -- (If you want to have the same Lockstyle every time, reduce the list to a single Equipset #)
  66.     random_lockstyle_list = {17}
  67.  
  68.     state.Buff['Aftermath: Lv.3'] = buffactive['Aftermath: Lv.3'] or false
  69.     state.Buff["Avatar's Favor"] = buffactive["Avatar's Favor"] or false
  70.     state.Buff["Astral Conduit"] = buffactive["Astral Conduit"] or false
  71.  
  72.     if DisplayModeInfo == 'true' then
  73.         DisplayTrue = 1
  74.     end
  75.  
  76.     get_combat_form()
  77.     get_melee_groups()
  78. end
  79.  
  80. function user_setup()
  81.     state.OffenseMode:options('Normal', 'MedAcc', 'HighAcc', 'MaxAcc')
  82.     state.WeaponskillMode:options('Normal', 'WSMedAcc', 'WSHighAcc')
  83.     state.HybridMode:options('Normal')
  84.     state.CastingMode:options('Normal')
  85.     state.IdleMode:options('Normal')
  86.     state.RestingMode:options('Normal')
  87.     state.PhysicalDefenseMode:options('PetDT', 'PDT')
  88.     state.MagicalDefenseMode:options('MDTShell', 'MEva')
  89.  
  90.     -- Set up Avatar cycling and keybind Alt+F8/Ctrl+F8
  91.     state.AvatarMode = M{['description']='Avatar Mode', 'Garuda', 'Ramuh', 'Siren', 'Cait Sith', 'Shiva', 'Carbuncle', 'Diabolos',
  92.         'Fenrir', 'Ifrit', 'Titan', 'Leviathan'}
  93.     send_command('bind !f8 gs c cycle AvatarMode')
  94.     send_command('bind ^f8 gs c cycleback AvatarMode')
  95.  
  96.     -- Set up Axe Swapping Modes and keybind alt+=
  97.     state.StaffMode = M{['description']='Staff Mode', 'PetOnly', 'NoSwaps'}
  98.     send_command('bind != gs c cycle StaffMode')
  99.  
  100.     -- Keybind Ctrl+F11 to cycle Magical Defense Modes
  101.     send_command('bind ^f11 gs c cycle MagicalDefenseMode')
  102.  
  103.     -- Set up Treasure Modes and keybind Ctrl+`
  104.     state.TreasureMode = M{['description']='Treasure Mode', 'Tag', 'Normal'}
  105.     send_command('bind ^` gs c cycle TreasureMode')
  106.  
  107.     -- Set up Lag Modes and keybind Ctrl+=
  108.     state.LagMode = M{['description']='Lag Mode', 'Lag', 'Normal'}
  109.     send_command('bind ^= gs c cycle LagMode')
  110.  
  111.     -- 'Out of Range' distance; Melee WSs will auto-cancel
  112.     target_distance = 8
  113.  
  114.     spirits = S{"LightSpirit", "DarkSpirit", "FireSpirit", "EarthSpirit", "WaterSpirit", "AirSpirit", "IceSpirit", "ThunderSpirit"}
  115.     avatars = S{"Carbuncle", "Fenrir", "Diabolos", "Ifrit", "Titan", "Leviathan", "Garuda", "Shiva", "Ramuh", "Odin", "Alexander", "Cait Sith", "Siren"}
  116.  
  117. -- Categorized list of Blood Pacts
  118. blood_pact_list = S{'Searing Light','Poison Nails','Meteorite','Holy Mist','Healing Ruby','Shining Ruby',
  119.     'Glittering Ruby','Healing Ruby II','Soothing Ruby','Pacifying Ruby','Inferno','Punch','Fire II',
  120.     'Burning Strike','Double Punch','Fire IV','Flaming Crush','Meteor Strike','Conflag Strike','Crimson Howl',
  121.     'Inferno Howl','Diamond Dust','Axe Kick','Blizzard II','Double Slap','Blizzard IV','Rush','Heavenly Strike',
  122.     'Frost Armor','Sleepga','Diamond Storm','Crystal Blessing','Aerial Blast','Claw','Aero II','Aero IV',
  123.     'Predator Claws','Wind Blade','Aerial Armor','Whispering Wind','Hastega','Fleet Wind','Hastega II',
  124.     'Earthen Fury','Rock Throw','Stone II','Rock Buster','Megalith Throw','Stone IV','Mountain Buster',
  125.     'Geocrush','Crag Throw','Earthen Ward','Earthen Armor','Judgment Bolt','Shock Strike','Thunder II',
  126.     'Thunderspark','Thunder IV','Chaotic Strike','Thunderstorm','Volt Strike','Rolling Thunder',
  127.     'Lightning Armor','Shock Squall','Tidal Wave','Barracuda Dive','Water II','Tail Whip','Water IV',
  128.     'Spinning Dive','Grand Fall','Slowga','Spring Water','Tidal Roar','Soothing Current','Regal Scratch',
  129.     'Level ? Holy','Regal Gash','Raise II','Mewing Lullaby','Reraise II','Eerie Eye','Howling Moon',
  130.     'Moonlit Charge','Crescent Fang','Eclipse Bite','Lunar Bay','Impact','Lunar Cry','Lunar Roar',
  131.     'Ecliptic Growl','Ecliptic Howl','Heavenward Howl','Ruinous Omen','Camisado','Nether Blast','Night Terror',
  132.     'Blindside','Somnolence','Nightmare','Ultimate Terror','Noctoshield','Dream Shroud','Pavor Nocturnus',
  133.     'Welt','Roundhouse','Sonic Buffet','Tornado II','Hysteric Assault','Katabatic Blades','Lunatic Voice',
  134.     'Chinook','Bitter Elegy',"Wind's Blessing"}
  135.  
  136. pet_buff_moves = S{'Shining Ruby','Healing Ruby','Healing Ruby II','Soothing Ruby','Crimson Howl','Inferno Howl',
  137.     'Frost Armor','Crystal Blessing','Aerial Armor','Whispering Wind','Hastega','Fleet Wind','Hastega II',
  138.     'Earthen Ward','Earthen Armor','Rolling Thunder','Lightning Armor','Spring Water','Soothing Current',
  139.     'Ecliptic Growl','Ecliptic Howl','Heavenward Howl','Noctoshield','Dream Shroud','Raise II','Reraise II',
  140.     'Katabatic Blades','Chinook',"Wind's Blessing"}
  141.  
  142. physical_blood_pacts = S{'Poison Nails','Axe Kick','Double Slap','Claw','Rock Throw','Rock Buster',
  143.     'Megalith Throw','Mountain Buster','Crag Throw','Shock Strike','Barracuda Dive','Tail Whip',
  144.     'Spinning Dive','Punch','Regal Scratch','Regal Gash','Moonlit Charge','Crescent Fang','Camisado',
  145.     'Chaotic Strike','Double Punch','Eclipse Bite','Predator Claws','Rush','Volt Strike',
  146.     'Welt','Roundhouse','Hysteric Assault'}
  147.  
  148. magic_atk_blood_pacts = S{'Inferno','Earthen Fury','Tidal Wave','Aerial Blast','Diamond Dust','Judgment Bolt',
  149.     'Searing Light','Howling Moon','Ruinous Omen',
  150.     'Fire II','Stone II','Water II','Aero II','Blizzard II','Thunder II',
  151.     'Fire IV','Stone IV','Water IV','Aero IV','Blizzard IV','Thunder IV',
  152.     'Thunderspark','Burning Strike','Meteorite','Nether Blast',
  153.     'Meteor Strike','Conflag Strike','Heavenly Strike','Wind Blade','Geocrush','Grand Fall','Thunderstorm',
  154.     'Sonic Buffet','Tornado II',
  155.     'Holy Mist','Lunar Bay','Night Terror','Level ? Holy','Impact','Zantetsuken'}
  156.  
  157. hybrid_blood_pacts = S{'Flaming Crush'}
  158.  
  159. magic_acc_blood_pacts = S{'Sleepga','Diamond Storm','Shock Squall','Slowga','Tidal Roar','Mewing Lullaby',
  160.     'Eerie Eye','Lunar Cry','Lunar Roar','Somnolence','Nightmare','Ultimate Terror','Pavor Nocturnus',
  161.     'Lunatic Voice','Bitter Elegy',}
  162.  
  163. multi_hit_blood_pacts = S{'Chaotic Strike','Double Punch','Eclipse Bite','Predator Claws','Rush','Volt Strike',
  164.     'Hysteric Assault'}
  165.  
  166. tp_based_blood_pacts = S{'Impact','Heavenly Strike','Wind Blade','Geocrush','Thunderstorm','Meteor Strike','Grand Fall',
  167.     'Healing Ruby II','Whispering Wind','Healing Ruby','Spring Water'}
  168.  
  169. -- List of abilities to reference for applying Treasure Hunter gear.
  170. abilities_to_check = S{'Quickstep','Box Step','Stutter Step','Desperate Flourish',
  171.     'Violent Flourish','Animated Flourish','Provoke','Dia','Dia II','Flash','Bio',
  172.     'Bio II','Sleep','Sleep II','Drain','Aspir','Dispel','Stun','Steal','Mug'}
  173.  
  174. enmity_plus_moves = S{'Provoke','Berserk','Warcry','Aggressor','Holy Circle','Sentinel','Last Resort',
  175.     'Souleater','Vallation','Swordplay'}
  176.  
  177. -- Random Lockstyle generator.
  178.     if RandomLockstyleGenerator == 'true' then
  179.         local randomLockstyle = random_lockstyle_list[math.random(1, #random_lockstyle_list)]
  180.         send_command('@wait 5;input /lockstyleset '.. randomLockstyle)
  181.     end
  182.  
  183.     display_mode_info()
  184. end
  185.  
  186. function file_unload()
  187.     if binds_on_unload then
  188.         binds_on_unload()
  189.     end
  190.  
  191.     -- Unbinds the Reward, Correlation, AvatarMode, StaffMode and Treasure hotkeys.
  192.     send_command('unbind !=')
  193.     send_command('unbind ^=')
  194.     send_command('unbind @=')
  195.     send_command('unbind !f8')
  196.     send_command('unbind ^f8')
  197.     send_command('unbind @f8')
  198.     send_command('unbind ^f11')
  199.  
  200.     -- Removes any Text Info Boxes
  201.     send_command('text AvatarText delete')
  202.     send_command('text StaffModeText delete')
  203.     send_command('text AccuracyText delete')
  204. end
  205.  
  206. -- SMN gearsets
  207. function init_gear_sets()
  208.  
  209.     -------------------------------------------------
  210.     -- AUGMENTED GEAR AND GENERAL GEAR DEFINITIONS --
  211.     -------------------------------------------------
  212.  
  213.     Pet_Idle_Staff = "Nirvana"
  214.     Pet_PDT_Staff = "Tuahjebat"
  215.     Pet_TP_Staff = "Gridarvor"
  216.  
  217.     BP_Atk_Staff = "Gridarvor"
  218.     BP_MAB_Staff = {name="Grioavolr", augments={'Blood Pact Dmg.+8','Pet: Mag. Acc.+13','Pet: "Mag.Atk.Bns."+24','DMG:+12',}}
  219.     BP_MAcc_Staff = {name="Grioavolr", augments={'Blood Pact Dmg.+8','Pet: Mag. Acc.+13','Pet: "Mag.Atk.Bns."+24','DMG:+12',}}
  220.  
  221.     Pet_PDT_hands = "Artsieq Cuffs"
  222.     Pet_PDT_legs = "Enticer's Pants"
  223.     Pet_PDT_back = {name="Campestres's Cape", augments={'MP+60','Eva.+20 /Mag. Eva.+20','Pet: "Regen"+10',}}
  224.  
  225.     Pet_Regen_back = {name="Campestres's Cape", augments={'MP+60','Eva.+20 /Mag. Eva.+20','Pet: "Regen"+10',}}
  226.  
  227.     BP_Atk_head = "Apogee Crown +1"
  228.     BP_Atk_body = "Convoker's Doublet +3"
  229.     BP_Atk_hands = {name="Merlinic Dastanas", augments={'Pet: Accuracy+18 Pet: Rng. Acc.+18','Blood Pact Dmg.+10','Pet: STR+6','Pet: "Mag.Atk.Bns."+4',}}
  230.     BP_Atk_legs = "Apogee Slacks +1"
  231.     BP_Atk_feet = "Apogee Pumps +1"
  232.     BP_Atk_back = {name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Attack+10 Pet: Rng.Atk.+10','Pet: Haste+10',}}
  233.  
  234.     BP_Acc_head = "Apogee Crown +1"
  235.     BP_Acc_body = "Convoker's Doublet +3"
  236.     BP_Acc_hands = {name="Merlinic Dastanas", augments={'Pet: Accuracy+18 Pet: Rng. Acc.+18','Blood Pact Dmg.+10','Pet: STR+6','Pet: "Mag.Atk.Bns."+4',}}
  237.     BP_Acc_legs = "Apogee Slacks +1"
  238.     BP_Acc_feet = "Apogee Pumps +1"
  239.     BP_Acc_back = {name="Campestres's Cape", augments={'Pet: Acc.+20 Pet: R.Acc.+20 Pet: Atk.+20 Pet: R.Atk.+20','Eva.+20 /Mag. Eva.+20','Pet: Attack+10 Pet: Rng.Atk.+10','Pet: Haste+10',}}
  240.  
  241.     BP_MAB_head = "Apogee Crown"
  242.     BP_MAB_body = "Beckoner's Doublet +1"
  243.     BP_MAB_hands = {name="Merlinic Dastanas", augments={'Pet: Accuracy+18 Pet: Rng. Acc.+18','Blood Pact Dmg.+10','Pet: STR+6','Pet: "Mag.Atk.Bns."+4',}}
  244.     BP_MAB_legs = "Apogee Slacks +1"
  245.     BP_MAB_feet = "Apogee Pumps"
  246.     BP_MAB_back = {name="Campestres's Cape", augments={'Pet: M.Acc.+20 Pet: M.Dmg.+20','Mag. Acc+20 /Mag. Dmg.+20','"Fast Cast"+10',}}
  247.  
  248.     BP_MAcc_head = "Tali'ah Turban +2"
  249.     BP_MAcc_body = "Tali'ah Manteel +2"
  250.     BP_MAcc_hands = "Tali'ah Gages +2"
  251.     BP_MAcc_legs = "Tali'ah Seraweels +2"
  252.     BP_MAcc_feet = "Tali'ah Crackows +2"
  253.     BP_MAcc_back = {name="Campestres's Cape", augments={'Pet: M.Acc.+20 Pet: M.Dmg.+20','Mag. Acc+20 /Mag. Dmg.+20','"Fast Cast"+10',}}
  254.  
  255.     BP_DA_staff = "Gridarvor"
  256.     BP_DA_head = "Emicho Coronet +1"
  257.     BP_DA_body = {name="Valorous Mail", augments={'Pet: Accuracy+18 Pet: Rng. Acc.+18','Pet: "Dbl. Atk."+5','Pet: STR+6','Pet: Attack+14 Pet: Rng.Atk.+14',}}
  258.     BP_DA_hands = "Emicho Gauntlets +1"
  259.     BP_DA_legs = "Emicho Hose +1"
  260.     BP_DA_feet = {name="Taeon Boots", augments={'Pet: Attack+23 Pet: Rng.Atk.+23','Pet: "Dbl. Atk."+5','Pet: Haste+5',}}
  261.  
  262.     FC_staff = {name="Grioavolr", augments={'"Fast Cast"+5','VIT+2','Mag. Acc.+30',}}
  263.     FC_head = "Merlinic Hood"
  264.     FC_hands = {name="Merlinic Dastanas", augments={'"Mag.Atk.Bns."+12','"Fast Cast"+5',}}
  265.     FC_legs = "Psycloth Lappas"
  266.     FC_feet = "Merlinic Crackows"
  267.     FC_back = {name="Campestres's Cape", augments={'Pet: M.Acc.+20 Pet: M.Dmg.+20','Mag. Acc+20 /Mag. Dmg.+20','"Fast Cast"+10',}}
  268.  
  269.     MAcc_head = "Tali'ah Turban +2"
  270.     MAcc_body = "Tali'ah Manteel +2"
  271.     MAcc_hands = "Tali'ah Gages +2"
  272.     MAcc_legs = "Tali'ah Seraweels +2"
  273.     MAcc_feet = "Tali'ah Crackows +2"
  274.     MAcc_back = {name="Campestres's Cape", augments={'Pet: M.Acc.+20 Pet: M.Dmg.+20','Mag. Acc+20 /Mag. Dmg.+20','"Fast Cast"+10',}}
  275.  
  276.     Cure_Potency_staff = "Serenity"
  277.     Cure_Potency_body = "Heka's Kalasiris"
  278.     Cure_Potency_back = {name="Artio's Mantle", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','MND+10','Weapon skill damage +10%',}}
  279.  
  280.     Cloud_back = {name="Artio's Mantle", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','MND+10','Weapon skill damage +10%',}}
  281.  
  282.     sets.Enmity = {ammo="Paeapua",
  283.         neck="Unmoving Collar +1",ear1="Trux Earring",ear2="Cryptic Earring",
  284.         ring1="Provocare Ring",ring2="Eihwaz Ring"}
  285.  
  286.     ---------------------
  287.     -- JA PRECAST SETS --
  288.     ---------------------
  289.  
  290.     sets.precast.JA['Astral Flow'] = {head="Glyphic Horn +1"}
  291.     sets.precast.JA['Mana Cede'] = {hands="Beckoner's Bracers +1"}
  292.  
  293.     sets.precast.JA['Elemental Siphon'] = {ammo="Esper Stone +1",
  294.         head="Telchine Cap",neck="Incanter's Torque",ear1="Summoning Earring",ear2="Andoaa earring",
  295.         body="Beckoner's Doublet +1",hands="Lamassu Mitts +1",ring1="Zodiac Ring",ring2="Evoker's Ring",
  296.         back="Conveyance Cape",waist="Kobo Obi",legs="Beckoner's Spats",feet="Beckoner's Pigaches +1"}
  297.  
  298.     --------------------------
  299.     -- BLOOD PACT GEAR SETS --
  300.     --------------------------
  301.  
  302.     sets.precast.BloodPact = {ammo="Sancus Sachet +1",
  303.         head="Beckoner's Horn +1",neck="Incanter's Torque",ear2="Moonshade Earring",
  304.         body="Convoker's Doublet +3",hands="Lamassu Mitts +1"}
  305.  
  306.     sets.midcast.Pet.TPBonus = {legs="Enticer's Pants"}
  307.  
  308.     sets.midcast.Pet.WS = {ammo="Sancus Sachet +1",
  309.         head="Apogee Crown +1",neck="Shulmanu Collar",ear1="Lugalbanda Earring",ear2="Esper Earring",
  310.         body="Convoker's Doublet +3",hands=BP_Atk_hands,ring1="Varar Ring +1",ring2="Varar Ring +1",
  311.         back=BP_Atk_back,waist="Regal Belt",legs="Apogee Slacks +1",feet="Apogee Pumps +1"}
  312.  
  313.     sets.midcast.Pet.MedAcc = set_combine(sets.midcast.Pet.WS, {
  314.         ear2="Enmerkar Earring",
  315.         waist="Incarnation Sash"})
  316.  
  317.     sets.midcast.Pet.HighAcc = set_combine(sets.midcast.Pet.WS, {
  318.         waist="Klouskap Sash +1"})
  319.  
  320.     sets.midcast.Pet.MaxAcc = set_combine(sets.midcast.Pet.WS, {
  321.         })
  322.  
  323.     sets.midcast.Pet.MABBloodPact = set_combine(sets.midcast.Pet.WS, {
  324.         head=BP_MAB_head,neck="Adad Amulet",ear1="Lugalbanda Earring",ear2="Esper Earring",
  325.         body="Convoker's Doublet +3",hands=BP_MAB_hands,ring1="Varar Ring +1",ring2="Varar Ring +1",
  326.         back=BP_MAB_back,waist="Regal Belt",legs="Enticer's Pants",feet=BP_MAB_feet})
  327.  
  328.     sets.midcast.Pet.MABBloodPact.MedAcc = set_combine(sets.midcast.Pet.MABBloodPact, {
  329.         ear2="Enmerkar Earring"})
  330.  
  331.     sets.midcast.Pet.MABBloodPact.HighAcc = set_combine(sets.midcast.Pet.MABBloodPact, {
  332.         })
  333.  
  334.     sets.midcast.Pet.MABBloodPact.MaxAcc = set_combine(sets.midcast.Pet.MABBloodPact, {
  335.         })
  336.  
  337.     sets.midcast.Pet.MagicAccPact = set_combine(sets.midcast.Pet.WS, {
  338.         head=BP_MAcc_head,neck="Adad Amulet",ear1="Lugalbanda Earring",ear2="Enmerkar Earring",
  339.         body=BP_MAcc_body,hands=BP_MAcc_hands,
  340.         back=BP_MAB_back,waist="Incarnation Sash",legs=BP_MAcc_legs,feet=BP_MAcc_feet})
  341.  
  342.     sets.midcast.Pet.MultiStrike = set_combine(sets.midcast.Pet.WS, {
  343.         waist="Incarnation Sash"})
  344.  
  345.     sets.midcast.Pet.HybridBloodPact = {
  346.         head=BP_MAB_head,neck="Adad Amulet",ear1="Lugalbanda Earring",ear2="Esper Earring",
  347.         body="Convoker's Doublet +3",hands=BP_MAB_hands,ring1="Varar Ring +1",ring2="Varar Ring +1",
  348.         back=BP_Atk_back,waist="Regal Belt",legs="Apogee Slacks +1",feet=BP_MAB_feet}
  349.  
  350.     sets.midcast.Pet.Buff = {ammo="Sancus Sachet +1",
  351.         head="Beckoner's Horn +1",neck="Incanter's Torque",ear1="Summoning earring",ear2="Andoaa earring",
  352.         body="Beckoner's Doublet +1",hands="Lamassu Mitts +1",ring1="Globidonta Ring",ring2="Evoker's ring",
  353.         back="Conveyance Cape",waist="Kobo Obi",legs="Beckoner's Spats +1",feet="Beckoner's Pigaches +1"}
  354.  
  355.     ---------------
  356.     -- IDLE SETS --
  357.     ---------------
  358.  
  359.     sets.idle = {main="Nirvana",sub="Elan Strap +1",ammo="Sancus Sachet +1",
  360.         head="Beckoner's Horn +1",neck="Bathy Choker +1",ear1="Infused Earring",ear2="Dawn Earring",
  361.         body="Shomonjijoe +1",hands="Asteria Mitts +1",ring1="Paguroidea Ring",ring2="Sheltered Ring",
  362.         back=Pet_Regen_back,waist="Fucho-no-obi",legs="Assiduity pants +1",feet="Crier's Gaiters"}
  363.  
  364.     sets.idle.Pet = {main="Nirvana",sub="Elan Strap +1",ammo="Sancus Sachet +1",
  365.         head="Beckoner's Horn +1",neck="Caller's Pendant",ear1="Handler's Earring +1",ear2="Evans Earring",
  366.         body="Shomonjijoe +1",hands="Asteria Mitts +1",ring1="Defending Ring",ring2="Evoker's ring",
  367.         back=Pet_Regen_back,waist="Fucho-no-Obi",legs="Assiduity pants +1",feet="Crier's Gaiters"}
  368.  
  369.     sets.idle.Pet.Engaged = sets.idle.Pet
  370.  
  371.     sets.idle.Pet.CaitSith = {hands="Lamassu Mitts +1"}
  372.  
  373.     sets.resting = {}
  374.  
  375.     ------------------
  376.     -- DEFENSE SETS --
  377.     ------------------
  378.  
  379.     -- Pet PDT and MDT sets:
  380.     sets.defense.PetDT = {
  381.         ear1="Handler's Earring +1",ear2="Enmerkar Earring",
  382.         hands=Pet_PDT_hands,
  383.         ring1="Thurandaut Ring +1",ring2="Defending Ring",
  384.         back=Pet_PDT_back,
  385.         waist="Isa Belt",
  386.         legs=Pet_PDT_legs}
  387.  
  388.     -- Master PDT and MDT sets:
  389.     sets.defense.PDT = {}
  390.  
  391.     sets.defense.MDTShell = {ammo="Vanir Battery",
  392.         head="Inyanga Tiara +2",neck="Loricate Torque +1",ear1="Etiolation Earring",ear2="Eabani Earring",
  393.         body="Inyanga Jubbah +2",hands="Inyanga Dastanas +2",ring1="Shadow Ring",ring2="Inyanga Ring",
  394.         back="Solemnity Cape",waist="Lieutenant's Sash",legs="Inyanga Shalwar +2",feet="Inyanga Crackows +2"}
  395.  
  396.     sets.defense.MEva = set_combine(sets.defense.MDT, {ammo="Staunch Tathlum",
  397.         head=MEva_head,
  398.         neck="Warder's Charm +1",ear1="Hearty Earring",ear2="Eabani Earring",
  399.         body=MEva_body,
  400.         hands=MEva_hands,
  401.         ring1="Vengeful Ring",ring2="Purity Ring",
  402.         back=MEva_back,
  403.         waist="Engraved Belt",
  404.         legs=MEva_legs,
  405.         feet=MEva_feet})
  406.  
  407.     sets.Kiting = {feet="Crier's Gaiters"}
  408.  
  409.     --------------------
  410.     -- FAST CAST SETS --
  411.     --------------------
  412.  
  413.     sets.precast.FC = {
  414.         ammo="Sapience Orb",
  415.         head=FC_head,
  416.         neck="Orunmila's Torque",ear1="Loquacious Earring",ear2="Enchanter Earring +1",
  417.         body="Zendik Robe",
  418.         hands=FC_hands,
  419.         ring1="Kishar Ring",ring2="Rahab Ring",
  420.         back=FC_back,
  421.         waist="Moblin Cest",
  422.         legs=FC_legs,
  423.         feet=FC_feet}
  424.  
  425.     sets.precast.FC.Stoneskin = set_combine(sets.precast.FC, {
  426.         head="Umuthi Hat",hands="Carapacho Cuffs",waist="Siegel Sash",legs="Doyen Pants"})
  427.  
  428.     ------------------
  429.     -- MIDCAST SETS --
  430.     ------------------
  431.  
  432.     sets.midcast.FastRecast = sets.precast.FC
  433.  
  434.     sets.midcast.Cure = {
  435.         ammo="Quartz Tathlum +1",
  436.         neck="Phalaina Locket",ear2="Mendicant's Earring",
  437.         body=Cure_Potency_body,
  438.         ring1="Lebeche Ring",ring2="Asklepian Ring",
  439.         back=Cure_Potency_back,
  440.         waist="Gishdubar Sash"}
  441.  
  442.     sets.midcast['Enhancing Magic'] = set_combine(sets.midcast.FastRecast, {head="Telchine Cap"})
  443.  
  444.     sets.midcast.Refresh = {head="Telchine Cap",
  445.         back="Grapevine Cape",waist="Gishdubar Sash",feet="Inspirited Boots"}
  446.  
  447.     sets.midcast.Stoneskin = {ammo="Quartz Tathlum +1",
  448.         neck="Nodens Gorget",ear1="Earthcry Earring",ear2="Lifestorm Earring",
  449.         ring1="Leviathan Ring +1",ring2="Leviathan Ring +1",
  450.         waist="Siegel Sash",legs="Haven Hose"}
  451.  
  452.     sets.midcast.Cursna = set_combine(sets.midcast.FastRecast, {neck="Malison Medallion",
  453.         ring1="Eshmun's Ring",ring2="Haoma's Ring",waist="Gishdubar Sash"})
  454.  
  455.     sets.midcast.Protect = {ring2="Sheltered Ring"}
  456.     sets.midcast.Protectra = sets.midcast.Protect
  457.  
  458.     sets.midcast.Shell = {ring2="Sheltered Ring"}
  459.     sets.midcast.Shellra = sets.midcast.Shell
  460.  
  461.     sets.midcast['Enfeebling Magic'] = {ammo="Pemphredo Tathlum",
  462.         head=MAcc_head,neck="Sanctity Necklace",ear1="Hermetic Earring",ear2="Dignitary's Earring",
  463.         body=MAcc_body,hands=MAcc_hands,ring1="Rahab Ring",ring2="Sangoma Ring",
  464.         back=MAcc_back,waist="Eschan Stone",legs=MAcc_legs,feet=MAcc_feet}
  465.  
  466.     sets.midcast['Elemental Magic'] = {ammo="Pemphredo Tathlum",
  467.         head=MAB_head,neck="Baetyl Pendant",ear1="Hecate's Earring",ear2="Friomisi Earring",
  468.         body=MAB_body,hands=MAB_hands,ring1="Acumen Ring",ring2="Fenrir Ring +1",
  469.         back=MAcc_back,waist="Eschan Stone",legs=MAB_legs,feet=MAB_feet}
  470.  
  471.     sets.midcast.Flash = sets.Enmity
  472.  
  473.     ------------------
  474.     -- ENGAGED SETS --
  475.     ------------------
  476.  
  477.     sets.engaged = {ammo="Vanir Battery",
  478.         head="Beckoner's Horn +1",neck="Shulmanu Collar",ear1="Trux Earring",ear2="Brutal Earring",
  479.         body="Tali'ah Manteel +2",hands="Asteria Mitts +1",ring1="Petrov Ring",ring2="Hetairoi Ring",
  480.         back="Solemnity Cape",waist="Windbuffet Belt +1",legs="Assiduity Pants +1",feet="Apogee Pumps +1"}
  481.  
  482.     --------------------
  483.     -- MASTER WS SETS --
  484.     --------------------
  485.  
  486.     sets.precast.WS = {ammo="Pemphredo Tathlum",
  487.         head="Hagondes Hat +1",neck="Baetyl Pendant",ear1="Hecate's Earring",ear2="Friomisi Earring",
  488.         body="Hagondes Coat +1",hands=MAcc_hands,ring1="Fenrir Ring +1",ring2="Acumen Ring",
  489.         back="Argochampsa Mantle",waist="Eschan Stone",legs="Hagondes Pants +1",feet="Navon Crackows"}
  490.  
  491.     sets.precast.WS['Garland of Bliss'] = {ammo="Pemphredo Tathlum",
  492.         head="Tali'ah Turban +2",neck="Sanctity Necklace",ear1="Dignitary's Earring",ear2="Moonshade Earring",
  493.         body="Tali'ah Manteel +2",hands="Tali'ah Gages +2",ring1="Fenrir Ring +1",ring2="Sangoma Ring",
  494.         back=MAcc_back,waist="Eschan Stone",legs="Tali'ah Seraweels +2",feet="Tali'ah Crackows +2"}
  495.  
  496.     sets.precast.WS['Myrkr'] = {ammo="Vanir Battery",
  497.         head="Beckoner's Horn +1",neck="Sanctity Necklace",ear1="Etiolation Earring",ear2="Moonshade Earring",
  498.         body="Convoker's Doublet +3",hands="Beckoner's Bracers +1",ring1="Fenrir Ring +1",ring2="Sangoma Ring",
  499.         back="Conveyance Cape",waist="Fucho-no-obi",legs="Beckoner's Spats +1",feet="Beckoner's Pigaches +1"}
  500.  
  501.     sets.midcast.ExtraMAB = {ear1="Hecate's Earring"}
  502.  
  503.     ----------------
  504.     -- OTHER SETS --
  505.     ----------------
  506.  
  507.     --Precast Gear Sets for DNC subjob abilities:
  508.     sets.precast.Waltz = {ammo="Sonia's Plectrum",
  509.         head="Totemic Helm +3",neck="Unmoving Collar +1",ear1="Handler's Earring +1",ear2="Enchanter Earring +1",
  510.         body="Totemic Jackcoat +3",hands="Totemic Gloves +3",ring1="Asklepian Ring",ring2="Valseur's Ring",
  511.         back=Waltz_back,waist="Chaac Belt",legs="Desultor Tassets",feet="Totemic Gaiters +3"}
  512.     sets.precast.Step = {waist="Chaac Belt"}
  513.     sets.precast.Flourish1 = {}
  514.     sets.precast.Flourish1['Violent Flourish'] = {ammo="Pemphredo Tathlum",
  515.         head=MAcc_head,neck="Sanctity Necklace",ear1="Hermetic Earring",ear2="Dignitary's Earring",
  516.         body=MAcc_body,hands=MAcc_hands,ring1="Rahab Ring",ring2="Sangoma Ring",
  517.         back=MAcc_back,waist="Eschan Stone",legs=MAcc_legs,feet=MAcc_feet}
  518.  
  519.     sets.precast.JA.Provoke = {ammo="Paeapua",
  520.         neck="Unmoving Collar +1",ear1="Trux Earring",ear2="Cryptic Earring",
  521.         ring1="Provocare Ring",ring2="Eihwaz Ring"}
  522.  
  523.     --Misc Gear Sets
  524.     sets.SacrificeTorque = {neck="Sacrifice Torque"}
  525.     sets.precast.LuzafRing = {ring1="Luzaf's Ring"}
  526.     sets.THGear = {hands=TH_hands,legs=TH_legs,waist="Chaac Belt"}
  527. end
  528.  
  529. -------------------------------------------------------------------------------------------------------------------
  530. -- Job-specific hooks that are called to process player actions at specific points in time.
  531. -------------------------------------------------------------------------------------------------------------------
  532.  
  533. function job_precast(spell, action, spellMap, eventArgs)
  534. -- Define class for Blood Pacts.
  535.     if blood_pact_list:contains(spell.name) then
  536.         classes.CustomClass = "WS"
  537.  
  538.         if state.LagMode.value == 'Lag' then
  539.             if physical_blood_pacts:contains(spell.name) then
  540.                 if state.OffenseMode.value == 'MaxAcc' then
  541.                     equip(sets.midcast.Pet.MaxAcc, sets.precast.BloodPact)
  542.                 elseif state.OffenseMode.value == 'HighAcc' then
  543.                     equip(sets.midcast.Pet.HighAcc, sets.precast.BloodPact)
  544.                 elseif state.OffenseMode.value == 'MedAcc' then
  545.                     equip(sets.midcast.Pet.MedAcc, sets.precast.BloodPact)
  546.                 else
  547.                     if multi_hit_blood_pacts:contains(spell.name) then
  548.                         equip(set_combine(sets.midcast.Pet.MultiStrike, sets.precast.BloodPact))
  549.                     else
  550.                         equip(set_combine(sets.midcast.Pet.WS, sets.precast.BloodPact))
  551.                     end
  552.                 end
  553.             end
  554.  
  555.             if magic_atk_blood_pacts:contains(spell.name) then
  556.                 equip(sets.midcast.Pet.MABBloodPact, sets.precast.BloodPact)
  557.             end
  558.  
  559.             if hybrid_blood_pacts:contains(spell.name) then
  560.                 equip(sets.midcast.Pet.HybridBloodPact, sets.precast.BloodPact)
  561.             end
  562.  
  563.             if magic_acc_blood_pacts:contains(spell.name) then
  564.                 equip(sets.midcast.Pet.MagicAccPact, sets.precast.BloodPact)
  565.             end
  566.  
  567.             if pet_buff_moves:contains(spell.name) then
  568.                 equip(sets.midcast.Pet.Buff, sets.precast.BloodPact)
  569.             end
  570.  
  571.             if (physical_blood_pacts:contains(spell.name) or magic_atk_blood_pacts:contains(spell.name)) and state.OffenseMode.value ~= 'MaxAcc' then
  572.                 if tp_based_blood_pacts:contains(spell.name) and pet_tp < 2000 then
  573.                     equip(sets.midcast.Pet.TPBonus)
  574.                 end
  575.             end
  576.         eventArgs.handled = true
  577.         else
  578.             if state.StaffMode.value == 'PetOnly' and not buffactive['Astral Conduit'] then
  579.                 equip(sets.precast.BloodPact)
  580.             end
  581.         end
  582.     end
  583.  
  584.     if enmity_plus_moves:contains(spell.english) then
  585.         equip(sets.Enmity)
  586.     end
  587.  
  588.     if player.equipment.main == 'Nirvana' then
  589.         custom_aftermath_timers_precast(spell)
  590.     end
  591.  
  592.     if spell.type == "WeaponSkill" and spell.target.distance > target_distance then
  593.         cancel_spell()
  594.         add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  595.         handle_equipping_gear(player.status)
  596.         return
  597.     end
  598.  
  599.     if spell.type == 'CorsairRoll' or spell.english == "Double-Up" then
  600.         equip(sets.precast.LuzafRing)
  601.     end
  602. end
  603.  
  604. function customize_melee_set(meleeSet)
  605.     if state.StaffMode.value == 'PetOnly' and player.status == "Engaged" then
  606.         if state.DefenseMode.value == "Physical" and state.PhysicalDefenseMode.value == "PetDT" then
  607.             meleeSet = set_combine(meleeSet, sets.defense.PetDT)
  608.         elseif state.DefenseMode.value == "None" then
  609.             meleeSet = set_combine(meleeSet, sets.idle.Pet)
  610.         end
  611.     end
  612.     return meleeSet
  613. end
  614.  
  615. function job_post_precast(spell, action, spellMap, eventArgs)
  616.     if spell.english == "Garland of Bliss" then
  617.         if player.tp > 2750 then
  618.             equip(sets.midcast.ExtraMAB)
  619.         end
  620.     end
  621.  
  622. -- Equip Chaac Belt for TH+1 on common Subjob Abilities or Spells.
  623.     if abilities_to_check:contains(spell.english) and state.TreasureMode.value == 'Tag' then
  624.         equip(sets.THGear)
  625.     end
  626. end
  627.  
  628. function job_midcast(spell, action, spellMap, eventArgs)
  629.     if state.StaffMode.value == 'PetOnly' then
  630.         if spell.english == "Cure" or spell.english == "Cure II" or spell.english == "Cure III" or spell.english == "Cure IV" then
  631.             equip(sets.CurePetOnly)
  632.         end
  633.         if spell.english == "Curaga" or spell.english == "Curaga II" or spell.english == "Curaga III" then
  634.             equip(sets.CurePetOnly)
  635.         end
  636.     end
  637. end
  638.  
  639. -- Return true if we handled the aftercast work.  Otherwise it will fall back
  640. -- to the general aftercast() code in Mote-Include.
  641. function job_aftercast(spell, action, spellMap, eventArgs)
  642.     if blood_pact_list:contains(spell.name) and not spell.interrupted then
  643.         if physical_blood_pacts:contains(spell.name) then
  644.             if state.OffenseMode.value == 'MaxAcc' then
  645.                 equip(sets.midcast.Pet.MaxAcc)
  646.             elseif state.OffenseMode.value == 'HighAcc' then
  647.                 equip(sets.midcast.Pet.HighAcc)
  648.             elseif state.OffenseMode.value == 'MedAcc' then
  649.                 equip(sets.midcast.Pet.MedAcc)
  650.             else
  651.                 if multi_hit_blood_pacts:contains(spell.name) then
  652.                     equip(sets.midcast.Pet.MultiStrike)
  653.                 else
  654.                     equip(sets.midcast.Pet.WS)
  655.                 end
  656.             end
  657.         end
  658.  
  659.         if magic_atk_blood_pacts:contains(spell.name) then
  660.             equip(sets.midcast.Pet.MABBloodPact)
  661.         end
  662.  
  663.         if hybrid_blood_pacts:contains(spell.name) then
  664.             equip(sets.midcast.Pet.HybridBloodPact)
  665.         end
  666.  
  667.         if magic_acc_blood_pacts:contains(spell.name) then
  668.             equip(sets.midcast.Pet.MagicAccPact)
  669.         end
  670.  
  671.         if pet_buff_moves:contains(spell.name) then
  672.             equip(sets.midcast.Pet.Buff)
  673.         end
  674.  
  675.         -- If Pet TP, before bonuses, is less than a certain value then equip Enticer's pants for certain pacts.
  676.         if (physical_blood_pacts:contains(spell.name) or magic_atk_blood_pacts:contains(spell.name)) and state.OffenseMode.value ~= 'MaxAcc' then
  677.             if tp_based_blood_pacts:contains(spell.name) then
  678.                 if pet_tp < 1300 then
  679.                     equip(sets.midcast.Pet.TPBonus)
  680.                 end
  681.             end
  682.         end
  683.     eventArgs.handled = true
  684.     end
  685.  
  686.     if spell.english == 'Assault' then
  687.         if not spell.interrupted then
  688.             pet_info_update()
  689.         end
  690.     end
  691.  
  692.     if spell.english == "Release" and not spell.interrupted then
  693.         PetName = 'None';PetJob = 'None';PetInfo = 'None';BloodPactOne = 'None';BloodPactTwo = 'None';BloodPactThree = 'None';BloodPactFour = 'None'
  694.     end
  695.  
  696.     if player.equipment.main == 'Nirvana' then
  697.         custom_aftermath_timers_aftercast(spell)
  698.     end
  699. end
  700.  
  701. function job_pet_midcast(spell, action, spellMap, eventArgs)
  702.     eventArgs.handled = true
  703. end
  704.  
  705. function job_pet_aftercast(spell, action, spellMap, eventArgs)
  706.     --if buffactive
  707. end
  708.  
  709. -------------------------------------------------------------------------------------------------------------------
  710. -- Customization hook for idle sets.
  711. -------------------------------------------------------------------------------------------------------------------
  712.  
  713. function customize_idle_set(idleSet)
  714.     --if pet.isvalid and pet.status ~= "Engaged" and state.DefenseMode.value ~= "Physical" then
  715.     --    idleSet = set_combine(idleSet, sets.idle.Pet)
  716.     --    return idleSet
  717.     --elseif pet.isvalid and pet.status == "Engaged" and state.DefenseMode.value ~= "Physical" then
  718.     --    idleSet = set_combine(idleSet, sets.idle.Pet.Engaged)
  719.     --    return idleSet
  720.     --else
  721.         return idleSet
  722.     --end
  723. end
  724.  
  725. -------------------------------------------------------------------------------------------------------------------
  726. -- Hooks for Treasure and Pet Mode handling.
  727. -------------------------------------------------------------------------------------------------------------------
  728.  
  729. function job_state_change(stateField, newValue, oldValue)
  730.     if stateField == 'Treasure Mode' then
  731.         state.TreasureMode:set(newValue)
  732.     elseif stateField == 'Pet Mode' then
  733.         state.CombatWeapon:set(newValue)
  734.     end
  735. end
  736.  
  737. function get_custom_wsmode(spell, spellMap, default_wsmode)
  738.  
  739. end
  740.  
  741. -------------------------------------------------------------------------------------------------------------------
  742. -- User code that supplements self-commands.
  743. -------------------------------------------------------------------------------------------------------------------
  744.  
  745. -- Called any time we attempt to handle automatic gear equips (ie: engaged or idle gear).
  746. function job_handle_equipping_gear(playerStatus, eventArgs)
  747.     -- Equipping a Capacity Points Mantle locks it until it is manually unequipped.
  748.     if player.equipment.back == 'Mecisto. Mantle' or player.equipment.back == 'Aptitude Mantle' or player.equipment.back == 'Aptitude Mantle +1' then
  749.         disable('back')
  750.     else
  751.         enable('back')
  752.     end
  753. end
  754.  
  755. -- Called by the 'update' self-command, for common needs.
  756. -- Set eventArgs.handled to true if we don't want automatic equipping of gear.
  757. function job_update(cmdParams, eventArgs)
  758.     get_combat_form()
  759.     get_melee_groups()
  760.     pet_info_update()
  761.     update_display_mode_info()
  762. end
  763.  
  764. -- Updates gear based on pet status changes.
  765. function job_pet_status_change(newStatus, oldStatus, eventArgs)
  766.     if newStatus == 'Idle' or newStatus == 'Engaged' then
  767.         if state.DefenseMode.value ~= "Physical" and state.DefenseMode.value ~= "Magical" then
  768.             handle_equipping_gear(player.status)
  769.         end
  770.     end
  771.  
  772.     if pet.hpp == 0 then
  773.         PetName = 'None';PetJob = 'None';PetInfo = 'None';BloodPactOne = 'None';BloodPactTwo = 'None';BloodPactThree = 'None';BloodPactFour = 'None'
  774.     end
  775.  
  776.     customize_melee_set(meleeSet)
  777.     pet_info_update()
  778. end
  779.  
  780. function job_buff_change(status, gain, gain_or_loss)
  781.     --Equip Sacrifice Torque if we're asleep and have an active avatar.
  782.     if (status == "sleep" and gain_or_loss) and pet.hpp ~= 0 then
  783.         if gain then
  784.             equip(sets.SacrificeTorque)
  785.         else
  786.             handle_equipping_gear(player.status)
  787.         end
  788.     end
  789.     if (status == "Astral Conduit" and gain_or_loss) and pet.hpp ~= 0 then
  790.         if gain then
  791.             if pet.name == "Ifrit" then
  792.                 equip(sets.midcast.Pet.HybridBloodPact)
  793.             elseif pet.name == "Ramuh" then
  794.                 equip(sets.midcast.Pet.MultiStrike)
  795.             end
  796.             windower.send_command('gs disable all')
  797.         else
  798.             windower.send_command('gs enable all')
  799.             handle_equipping_gear(player.status)
  800.         end
  801.     end
  802. end
  803.  
  804. -------------------------------------------------------------------------------------------------------------------
  805. -- Self Commands and Pet TP Evaluation Functions - Credit to Verda
  806. -------------------------------------------------------------------------------------------------------------------
  807.  
  808. pet_tp=0
  809. function job_self_command(cmdParams, eventArgs)
  810.     if cmdParams[1]:lower() == 'bloodpact' then
  811.         pet_info_update()
  812.         blood_pact(cmdParams)
  813.         eventArgs.handled = true
  814.     end
  815.     if cmdParams[1] == 'summonavatar' then
  816.         if state.AvatarMode.value == 'Cait Sith' then
  817.             send_command('input /ma "Cait Sith" <me>')
  818.         else
  819.             send_command('input /ma '..state.AvatarMode.value..' <me>')
  820.         end
  821.     end
  822.     if cmdParams[1]:lower() == 'siphon' then
  823.         handle_siphoning()
  824.         eventArgs.handled = true
  825.     end
  826.     if cmdParams[1] == 'pet_tp' then
  827.         pet_tp = tonumber(cmdParams[2])
  828.     end
  829. end
  830.  
  831. function blood_pact(cmdParams)
  832.     local pact = cmdParams[2]:lower()
  833.     local BloodPact = ''
  834.     if pact == 'one' then
  835.         BloodPact = BloodPactOne
  836.     elseif pact == 'two' then
  837.         BloodPact = BloodPactTwo
  838.     elseif pact == 'three' then
  839.         BloodPact = BloodPactThree
  840.     else
  841.         BloodPact = BloodPactFour
  842.     end
  843.     if pet_buff_moves:contains(BloodPact) then
  844.         send_command('input /pet "'.. BloodPact ..'" <me>')
  845.     else
  846.         send_command('input /pet "'.. BloodPact ..'" <t>')
  847.     end
  848. end
  849.  
  850. pet_tp = 0
  851. --Fix missing Pet.TP field by getting the packets from the fields lib
  852. packets = require('packets')
  853. function update_pet_tp(id,data)
  854.     if id == 0x068 then
  855.         pet_tp = 0
  856.         local update = packets.parse('incoming', data)
  857.         pet_tp = update["Pet TP"]
  858.         windower.send_command('lua c gearswap c pet_tp '..pet_tp)
  859.     end
  860. end
  861. id = windower.raw_register_event('incoming chunk', update_pet_tp)
  862.  
  863. -------------------------------------------------------------------------------------------------------------------
  864. -- Current Job State Display
  865. -------------------------------------------------------------------------------------------------------------------
  866.  
  867. -- Set eventArgs.handled to true if we don't want the automatic display to be run.
  868. function display_current_job_state(eventArgs)
  869.     local msg = 'Melee'
  870.    
  871.     if state.CombatForm.has_value then
  872.         msg = msg .. ' (' .. state.CombatForm.value .. ')'
  873.     end
  874.    
  875.     msg = msg .. ': '
  876.    
  877.     msg = msg .. state.OffenseMode.value
  878.     if state.HybridMode.value ~= 'Normal' then
  879.         msg = msg .. '/' .. state.HybridMode.value
  880.     end
  881.     msg = msg .. ', WS: ' .. state.WeaponskillMode.value
  882.    
  883.     if state.DefenseMode.value ~= 'None' then
  884.         msg = msg .. ', ' .. 'Defense: ' .. state.DefenseMode.value .. ' (' .. state[state.DefenseMode.value .. 'DefenseMode'].value .. ')'
  885.     end
  886.    
  887.     if state.Kiting.value then
  888.         msg = msg .. ', Kiting'
  889.     end
  890.  
  891.     if state.AvatarMode.value ~= 'None' then
  892.         add_to_chat(8,'-- Avatar: '.. PetName ..' -- (Info: '.. PetInfo ..', '.. PetJob ..')')
  893.     end
  894.  
  895.     add_to_chat(28,'Blood Pacts: 1.'.. BloodPactOne ..'   2.'.. BloodPactTwo ..'   3.'.. BloodPactThree ..'   4.'.. BloodPactFour ..'')
  896.     add_to_chat(122, msg)
  897.  
  898.     eventArgs.handled = true
  899. end
  900.  
  901. -------------------------------------------------------------------------------------------------------------------
  902. -- Utility functions specific to this job.
  903. -------------------------------------------------------------------------------------------------------------------
  904.  
  905. -- Custom uber-handling of Elemental Siphon
  906. function handle_siphoning()
  907.     if areas.Cities:contains(world.area) then
  908.         add_to_chat(122, 'Cannot use Elemental Siphon in a city area.')
  909.         return
  910.     end
  911.  
  912.     local siphonElement
  913.     local stormElementToUse
  914.     local releasedAvatar
  915.     local dontRelease
  916.    
  917.     -- If we already have a spirit out, just use that.
  918.     if pet.isvalid and spirits:contains(pet.name) then
  919.         siphonElement = pet.element
  920.         dontRelease = true
  921.         -- If current weather doesn't match the spirit, but the spirit matches the day, try to cast the storm.
  922.         if player.sub_job == 'SCH' and pet.element == world.day_element and pet.element ~= world.weather_element then
  923. --            if not S{'Light','Dark','Lightning'}:contains(pet.element) then
  924. --                stormElementToUse = pet.element
  925. --            end
  926.         stormElementToUse = pet.element
  927.         end
  928.     -- If we're subbing /sch, there are some conditions where we want to make sure specific weather is up.
  929.     -- If current (single) weather is opposed by the current day, we want to change the weather to match
  930.     -- the current day, if possible.
  931.     elseif player.sub_job == 'SCH' and world.weather_element ~= 'None' then
  932.         -- We can override single-intensity weather; leave double weather alone, since even if
  933.         -- it's partially countered by the day, it's not worth changing.
  934.         if get_weather_intensity() == 1 then
  935.             -- If current weather is weak to the current day, it cancels the benefits for
  936.             -- siphon.  Change it to the day's weather if possible (+0 to +20%), or any non-weak
  937.             -- weather if not.
  938.             -- If the current weather matches the current avatar's element (being used to reduce
  939.             -- perpetuation), don't change it; just accept the penalty on Siphon.
  940.             if world.weather_element == elements.weak_to[world.day_element] and
  941.                 (not pet.isvalid or world.weather_element ~= pet.element) then
  942.                 -- We can't cast lightning/dark/light weather, so use a neutral element
  943. --                if S{'Light','Dark','Lightning'}:contains(world.day_element) then
  944. --                    stormElementToUse = 'Wind'
  945. --                else
  946. --                    stormElementToUse = world.day_element
  947. --                end
  948.         stormElementToUse = world.day_element
  949.             end
  950.         end
  951.     end
  952.    
  953.     -- If we decided to use a storm, set that as the spirit element to cast.
  954.     if stormElementToUse then
  955.         siphonElement = stormElementToUse
  956.     elseif world.weather_element ~= 'None' and (get_weather_intensity() == 2 or world.weather_element ~= elements.weak_to[world.day_element]) then
  957.         siphonElement = world.weather_element
  958.     else
  959.         siphonElement = world.day_element
  960.     end
  961.    
  962.     local command = ''
  963.     local releaseWait = 0
  964.     local elementused = ''
  965.    
  966.     if pet.isvalid and avatars:contains(pet.name) then
  967.         command = command..'input /pet "Release" <me>;wait 1.1;'
  968.         releasedAvatar = pet.name
  969.         releaseWait = 10
  970.     end
  971.    
  972.     if stormElementToUse then
  973.         command = command..'input /ma "'..elements.storm_of[stormElementToUse]..'" <me>;wait 5;'
  974.         releaseWait = releaseWait - 4
  975.     elementused = stormElementToUse
  976.     end
  977.    
  978.     if not (pet.isvalid and spirits:contains(pet.name)) then
  979.         command = command..'input /ma "'..elements.spirit_of[siphonElement]..'" <me>;wait 5;'
  980.         releaseWait = releaseWait - 4
  981.     elementused = siphonElement
  982.     end
  983.    
  984.     command = command..'input /ja "Elemental Siphon" <me>;'
  985.     releaseWait = releaseWait - 1
  986.     releaseWait = releaseWait + 0.1
  987.    
  988.     if not dontRelease then
  989.         if releaseWait > 0 then
  990.             command = command..'wait '..tostring(releaseWait)..';'
  991.         else
  992.             command = command..'wait 1.1;'
  993.         end
  994.        
  995.         command = command..'input /pet "Release" <me>;'
  996.     end
  997.    
  998.     if releasedAvatar then
  999.         if state.AvatarMode.value == 'Cait Sith' then
  1000.             command = command..'wait 1.1;input /ma "Cait Sith" <me>'
  1001.         else
  1002.             command = command..'wait 1.1;input /ma "'..state.AvatarMode.value..'" <me>'
  1003.         end
  1004.     end
  1005.    
  1006.     send_command(command)
  1007. end
  1008.  
  1009. function pet_info_update()
  1010.     if pet.isvalid then
  1011.         PetName = pet.name
  1012.  
  1013.         if pet.name == 'Carbuncle' then
  1014.             PetInfo = "Light-based";PetJob = 'WHM';BloodPactOne = 'Poison Nails';BloodPactTwo = 'Holy Mist';BloodPactThree = 'Shining Ruby';BloodPactFour = 'Healing Ruby II'
  1015.         elseif pet.name == 'Ifrit' then
  1016.             PetInfo = "Fire-based";PetJob = 'BLM';BloodPactOne = 'Flaming Crush';BloodPactTwo = 'Conflag Strike';BloodPactThree = 'Crimson Howl';BloodPactFour = 'Inferno Howl'
  1017.         elseif pet.name == 'Shiva' then
  1018.             PetInfo = "Ice-based";PetJob = 'BLM';BloodPactOne = 'Rush';BloodPactTwo = 'Heavenly Strike';BloodPactThree = 'Crystal Blessing';BloodPactFour = 'Sleepga'
  1019.         elseif pet.name == 'Garuda' then
  1020.             PetInfo = "Wind-based";PetJob = 'BLM';BloodPactOne = 'Predator Claws';BloodPactTwo = 'Wind Blade';BloodPactThree = 'Hastega II';BloodPactFour = 'Aerial Armor'
  1021.         elseif pet.name == 'Titan' then
  1022.             PetInfo = "Earth-based";PetJob = 'BLM';BloodPactOne = 'Crag Throw';BloodPactTwo = 'Geocrush';BloodPactThree = 'Earthen Armor';BloodPactFour = 'Earthen Ward'
  1023.         elseif pet.name == 'Ramuh' then
  1024.             PetInfo = "Thunder-based";PetJob = 'BLM';BloodPactOne = 'Volt Strike';BloodPactTwo = 'Thunderstorm';BloodPactThree = 'Lightning Armor';BloodPactFour = 'Shock Squall'
  1025.         elseif pet.name == 'Leviathan' then
  1026.             PetInfo = "Water-based";PetJob = 'BLM';BloodPactOne = 'Spinning Dive';BloodPactTwo = 'Grand Fall';BloodPactThree = 'Soothing Current';BloodPactFour = 'Spring Water'
  1027.         elseif pet.name == 'Cait Sith' then
  1028.             PetInfo = "Light-based";PetJob = 'WHM';BloodPactOne = 'Regal Gash';BloodPactTwo = 'Level ? Holy';BloodPactThree = 'Mewing Lullaby';BloodPactFour = 'Mewing Lullaby'
  1029.         elseif pet.name == 'Fenrir' then
  1030.             PetInfo = "Dark-based";PetJob = 'DRK';BloodPactOne = 'Eclipse Bite';BloodPactTwo = 'Impact';BloodPactThree = 'Ecliptic Growl';BloodPactFour = 'Ecliptic Howl'
  1031.         elseif pet.name == 'Diabolos' then
  1032.             PetInfo = "Dark-based";PetJob = 'BLM';BloodPactOne = 'Nether Blast';BloodPactTwo = 'Camisado';BloodPactThree = 'Dream Shroud';BloodPactFour = 'Noctoshield'
  1033.         elseif pet.name == 'Siren' then
  1034.             PetInfo = "Wind-based";PetJob = 'BLM';BloodPactOne = 'Hysteric Assault';BloodPactTwo = 'Tornado II';BloodPactThree = "Wind's Blessing";BloodPactFour = 'Bitter Elegy'
  1035.         end
  1036.     else
  1037.         PetName = 'None';PetJob = 'None';PetInfo = 'None';BloodPactOne = 'None';BloodPactTwo = 'None';BloodPactThree = 'None';BloodPactFour = 'None'
  1038.     end
  1039. end
  1040.  
  1041. function display_mode_info()
  1042.     if DisplayModeInfo == 'true' and DisplayTrue == 1 then
  1043.         local x = TextBoxX
  1044.         local y = TextBoxY
  1045.         send_command('text AccuracyText create Acc. Mode: '..state.OffenseMode.value..'')
  1046.         send_command('text AccuracyText pos '..x..' '..y..'')
  1047.         send_command('text AccuracyText size '..TextSize..'')
  1048.         y = y + (TextSize + 6)
  1049.         send_command('text StaffModeText create Staff Mode: '..state.StaffMode.value..'')
  1050.         send_command('text StaffModeText pos '..x..' '..y..'')
  1051.         send_command('text StaffModeText size '..TextSize..'')
  1052.         y = y + (TextSize + 6)
  1053.         send_command('text AvatarText create Avatar Mode: '..state.AvatarMode.value..'')
  1054.         send_command('text AvatarText pos '..x..' '..y..'')
  1055.         send_command('text AvatarText size '..TextSize..'')
  1056.         DisplayTrue = DisplayTrue - 1
  1057.     end
  1058. end
  1059.  
  1060. function update_display_mode_info()
  1061.     if DisplayModeInfo == 'true' then
  1062.         send_command('text AccuracyText text Acc. Mode: '..state.OffenseMode.value..'')
  1063.         send_command('text StaffModeText text Staff Mode: '..state.StaffMode.value..'')
  1064.         send_command('text AvatarText text Avatar Mode: '..state.AvatarMode.value..'')
  1065.     end
  1066. end
  1067.  
  1068. function get_melee_groups()
  1069.     classes.CustomMeleeGroups:clear()
  1070.  
  1071.     if buffactive['Aftermath: Lv.3'] then
  1072.         classes.CustomMeleeGroups:append('Aftermath')
  1073.     end
  1074. end
  1075.  
  1076. function get_combat_form()
  1077.     if player.sub_job == 'NIN' or player.sub_job == 'DNC' then
  1078.         state.CombatForm:set('DW')
  1079.     else
  1080.         state.CombatForm:reset()
  1081.     end
  1082. end
Add Comment
Please, Sign In to add comment