Advertisement
Guest User

Untitled

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