midash

Orangebear_BRD

Jan 4th, 2014
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 26.24 KB | None | 0 0
  1.     include('organizer-lib')
  2. -------------------------------------------------------------------------------------------------------------------
  3. -- Setup functions for this job.  Generally should not be modified.
  4. -------------------------------------------------------------------------------------------------------------------
  5.  
  6. --[[
  7.     Custom commands:
  8.    
  9.     ExtraSongsMode may take one of three values: None, Dummy, FullLength
  10.    
  11.     You can set these via the standard 'set' and 'cycle' self-commands.  EG:
  12.     gs c cycle ExtraSongsMode
  13.     gs c set ExtraSongsMode Dummy
  14.    
  15.     The Dummy state will equip the bonus song instrument and ensure non-duration gear is equipped.
  16.     The FullLength state will simply equip the bonus song instrument on top of standard gear.
  17.    
  18.    
  19.     Simple macro to cast a dummy Daurdabla song:
  20.     /console gs c set ExtraSongsMode Dummy
  21.     /ma "Shining Fantasia" <me>
  22.    
  23.     To use a Terpander rather than Daurdabla, set the info.ExtraSongInstrument variable to
  24.     'Terpander', and info.ExtraSongs to 1.
  25. --]]
  26.  
  27. -- Initialization function for this job file.
  28. function get_sets()
  29.     mote_include_version = 2
  30.    
  31.     -- Load and initialize the include file.
  32.     include('Mote-Include.lua')
  33. end
  34.  
  35.  
  36. -- Setup vars that are user-independent.  state.Buff vars initialized here will automatically be tracked.
  37. function job_setup()
  38.     state.ExtraSongsMode = M{['description']='Extra Songs', 'None', 'Dummy', 'FullLength'}
  39.  
  40.     state.Buff['Pianissimo'] = buffactive['pianissimo'] or false
  41.  
  42.     -- For tracking current recast timers via the Timers plugin.
  43.     custom_timers = {}
  44. end
  45.  
  46. -------------------------------------------------------------------------------------------------------------------
  47. -- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
  48. -------------------------------------------------------------------------------------------------------------------
  49.  
  50. -- Setup vars that are user-dependent.  Can override this function in a sidecar file.
  51. function user_setup()
  52.     state.OffenseMode:options('None', 'Normal')
  53.     state.CastingMode:options('Normal', 'Resistant')
  54.     state.IdleMode:options('Normal', 'PDT')
  55.    
  56.     state.MagicBurst = M(false, 'Magic Burst')
  57.     state.ArtifactBody = M(false, 'Use AF Body')
  58.     lowTierNukes = S{'Stone', 'Water', 'Aero', 'Fire', 'Blizzard', 'Thunder',
  59.         'Stone II', 'Water II', 'Aero II', 'Fire II', 'Blizzard II', 'Thunder II',
  60.         'Stone III', 'Water III', 'Aero III', 'Fire III', 'Blizzard III', 'Thunder III',
  61.         'Stonega', 'Waterga', 'Aeroga', 'Firaga', 'Blizzaga', 'Thundaga',
  62.         'Stonega II', 'Waterga II', 'Aeroga II', 'Firaga II', 'Blizzaga II', 'Thundaga II'}
  63.    
  64.         gear.default.obi_waist = "Hachirin-no-obi"
  65.     gear.default.obi_back = "Toro Cape"
  66.     gear.default.obi_ring = "Shiva Ring +1"
  67.     elements.obi_of = {['Light']='Hachirin-no-obi', ['Dark']='Hachirin-no-obi', ['Fire']='Hachirin-no-obi',
  68.                     ['Ice']='Hachirin-no-obi', ['Wind']='Hachirin-no-obi',['Earth']='Hachirin-no-obi',
  69.                     ['Lightning']='Hachirin-no-obi', ['Water']='Hachirin-no-obi'}
  70.    
  71.    
  72.     brd_daggers = S{'Izhiikoh','Atoyac'}
  73.     pick_tp_weapon()
  74.    
  75.     -- Adjust this if using the Terpander (new +song instrument)
  76.     info.ExtraSongInstrument = 'Daurdabla'
  77.     -- How many extra songs we can keep from Daurdabla/Terpander
  78.     info.ExtraSongs = 1
  79.    
  80.     -- Set this to false if you don't want to use custom timers.
  81.     state.UseCustomTimers = M(true, 'Use Custom Timers')
  82.    
  83.     -- Additional local binds
  84.     send_command('bind ^` gs c cycle ExtraSongsMode')
  85.     send_command('bind !` input /ma "Chocobo Mazurka" <me>')
  86.     send_command('bind ^` gs c toggle ArtifactBody') -- Control ` turns AF body on and off
  87.     send_command('bind !` gs c toggle MagicBurst') -- Alt ` turns magic burst set on and off
  88.  
  89.     select_default_macro_book()
  90. end
  91.  
  92.  
  93. -- Called when this job file is unloaded (eg: job change)
  94. function user_unload()
  95.     send_command('unbind ^`')
  96.     send_command('unbind !`')
  97. end
  98.  
  99.  
  100. -- Define sets and vars used by this job file.
  101. function init_gear_sets()
  102.     --------------------------------------
  103.     -- Start defining the sets
  104.     --------------------------------------
  105.    
  106.     organizer_items = {
  107.   echos="Echo Drops",
  108.   remedy="Remedy",
  109.   orb="Macrocosmic Orb",
  110.   sushi="Squid Sushi",
  111.   Crepe="Pear Crepe",
  112.   sushi2="Sole Sushi"
  113. }
  114.    
  115.     -- Precast Sets
  116.  
  117.     -- Fast cast sets for spells
  118.     sets.precast.FC = {head="Nahtirah Hat",ear2="Loquac. Earring",
  119.         hands="Gendewitha Gages +1",ring1="Prolix Ring",
  120.         back="Swith Cape +1",waist="Witful Belt",legs="Artsieq Hose",feet="Chelona Boots"}
  121.  
  122.     sets.precast.FC.Cure = set_combine(sets.precast.FC, {body="Heka's Kalasiris"})
  123.  
  124.     sets.precast.FC.Stoneskin = set_combine(sets.precast.FC, {head="Umuthi Hat"})
  125.  
  126.     sets.precast.FC['Enhancing Magic'] = set_combine(sets.precast.FC, {waist="Siegel Sash"})
  127.  
  128.     sets.precast.FC.BardSong = {main="Felibre's Dague",range="Gjallarhorn",
  129.         head="Aoidos' Calot +2",neck="Aoidos' Matinee",ear1="Aoidos' Earring",ear2="Loquac. Earring",
  130.         body="Sha'ir Manteel",hands="Gendewitha Gages +1",ring1="Prolix Ring",
  131.         back="Swith Cape +1",waist="Witful Belt",legs="Gendewitha Spats +1",feet="Bihu Slippers"}
  132.  
  133.     sets.precast.FC.Daurdabla = set_combine(sets.precast.FC.BardSong, {range=info.ExtraSongInstrument})
  134.  
  135.     sets.precast.FC['Elemental Magic'] = set_combine(sets.precast.FC, {neck="Stoicheion Medal"})
  136.  
  137.  
  138.    
  139.     -- Precast sets to enhance JAs
  140.    
  141.     sets.precast.JA.Nightingale = {feet="Bihu Slippers"}
  142.     sets.precast.JA.Troubadour = {body="Bihu Justaucorps +1"}
  143.     sets.precast.JA['Soul Voice'] = {legs="Bihu Cannions"}
  144.  
  145.     -- Waltz set (chr and vit)
  146.     sets.precast.Waltz = {range="Gjallarhorn",
  147.         head="Nahtirah Hat",
  148.         body="Gende. Bilaut +1",hands="Buremte Gloves",
  149.         back="Kumbira Cape",legs="Gendewitha Spats +1",feet="Gendewitha Galoshes +1"}
  150.    
  151.        
  152.     -- Weaponskill sets
  153.     -- Default set for any weaponskill that isn't any more specifically defined
  154.     sets.precast.WS = {range="Gjallarhorn",
  155.         head="Nahtirah Hat",neck="Fotia Gorget",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  156.         body="Bihu Justaucorps +1",hands="Buremte Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
  157.         back="Atheling Mantle",waist="Caudata Belt",legs="Brioso Cannions +1",feet="Gendewitha Galoshes +1"}
  158.    
  159.     -- Specific weaponskill sets.  Uses the base set if an appropriate WSMod version isn't found.
  160.     sets.precast.WS['Evisceration'] = set_combine(sets.precast.WS)
  161.  
  162.     sets.precast.WS['Exenterator'] = set_combine(sets.precast.WS)
  163.  
  164.     sets.precast.WS['Mordant Rime'] = set_combine(sets.precast.WS)
  165.    
  166.    
  167.     -- Midcast Sets
  168.  
  169.     -- General set for recast times.
  170.     sets.midcast.FastRecast = {range="Angel Lyre",
  171.         head="Nahtirah Hat",ear2="Loquacious Earring",
  172.         body="Vanir Cotehardie",hands="Gendewitha Gages +1",ring1="Prolix Ring",
  173.         back="Swith Cape +1",waist="Goading Belt",legs="Gendewitha Spats +1",feet="Gendewitha Galoshes +1"}
  174.  
  175.     sets.midcast['Elemental Magic'] = {main="Lehbrailg +2",sub="Niobid Strap",ammo="Ghastly Tathlum +1",
  176.         head="Welkin Crown",neck="Sanctity Necklace",ear1="Friomisi Earring",ear2="Barkarole Earring",
  177.         body="Vanir Cotehardie",hands="Leyline Gloves",ring1="Shiva Ring",ring2="Shiva Ring +1",
  178.         back="Seshaw Cape",waist="Yamabuki-no-Obi",legs="Gyve Trousers",feet="Umbani Boots"}
  179.        
  180.        
  181.     -- Gear to enhance certain classes of songs.  No instruments added here since Gjallarhorn is being used.
  182.     sets.midcast.Ballad = {legs="Aoidos' Rhing. +2"}
  183.     sets.midcast.Lullaby = {hands=""}
  184.     sets.midcast.Madrigal = {head="Aoidos' Calot +2"}
  185.     sets.midcast.March = {hands="Aoidos' Manchettes +2"}
  186.     sets.midcast.Minuet = {body="Aoidos' Hongreline +2"}
  187.     sets.midcast.Minne = {}
  188.     sets.midcast.Paeon = {head=""}
  189.     sets.midcast.Carol = {head="Aoidos' Calot +2",
  190.         body="Aoidos' Hongreline +2",hands="Aoidos' Manchettes +2",
  191.         legs="Aoidos' Rhing. +2",feet="Aoidos' Cothrn. +2"}
  192.     sets.midcast["Sentinel's Scherzo"] = {feet="Aoidos' Cothrn. +2"}
  193.     sets.midcast['Magic Finale'] = {legs="Aoidos' Rhing. +2"}
  194.  
  195.     sets.midcast.Mazurka = {range=info.ExtraSongInstrument}
  196.    
  197.  
  198.     -- For song buffs (duration and AF3 set bonus)
  199.     sets.midcast.SongEffect = {main="Legato Dagger",range="Gjallarhorn",
  200.         head="Aoidos' Calot +2",neck="Aoidos' Matinee",ear2="Loquacious Earring",
  201.         body="Aoidos' Hongreline +2",hands="Aoidos' Manchettes +2",ring1="Prolix Ring",
  202.         legs="Marduk's Shalwar +1",feet="Brioso Slippers +1"}
  203.  
  204.     -- For song defbuffs (duration primary, accuracy secondary)
  205.     sets.midcast.SongDebuff = {main="Lehbrailg +2",sub="Mephitis Grip",range="Gjallarhorn",
  206.         head="Bihu Roundlet +1",neck="Aoidos' Matinee",ear1="Psystorm Earring",ear2="Lifestorm Earring",
  207.         body="Aoidos' Hongreline +2",hands="Aoidos' Manchettes +2",ring1="Prolix Ring",ring2="Sangoma Ring",
  208.         back="Kumbira Cape",waist="Goading Belt",legs="Marduk's Shalwar +1",feet="Brioso Slippers +1"}
  209.  
  210.     -- For song defbuffs (accuracy primary, duration secondary)
  211.     sets.midcast.ResistantSongDebuff = {main="Lehbrailg +2",sub="Mephitis Grip",range="Gjallarhorn",
  212.         head="Bihu Roundlet +1",neck="Piper's Torque",ear1="Psystorm Earring",ear2="Lifestorm Earring",
  213.         body="Brioso Justaucorps +1",hands="Aoidos' Manchettes +2",ring1="Prolix Ring",ring2="Sangoma Ring",
  214.         back="Kumbira Cape",waist="Demonry Sash",legs="Brioso Cannions +1",feet="Artsieq Boots"}
  215.  
  216.     -- Song-specific recast reduction
  217.     sets.midcast.SongRecast = {ear2="Loquacious Earring",
  218.         ring1="Prolix Ring",
  219.         back="Swith Cape +1",legs="Aoidos' Rhing. +2"}
  220.  
  221.     --sets.midcast.Daurdabla = set_combine(sets.midcast.FastRecast, sets.midcast.SongRecast, {range=info.ExtraSongInstrument})
  222.  
  223.     -- Cast spell with normal gear, except using Daurdabla instead
  224.     sets.midcast.Daurdabla = {range=info.ExtraSongInstrument}
  225.  
  226.     -- Dummy song with Daurdabla; minimize duration to make it easy to overwrite.
  227.     sets.midcast.DaurdablaDummy = {main="Izhiikoh",range=info.ExtraSongInstrument,
  228.         head="Nahtirah Hat",neck="Piper's Torque",ear1="Psystorm Earring",ear2="Lifestorm Earring",
  229.         body="Brioso Justaucorps +1",hands="Aoidos' Manchettes +2",ring1="Prolix Ring",ring2="Sangoma Ring",
  230.         back="Swith Cape +1",waist="Goading Belt",legs="Gendewitha Spats +1",feet="Artsieq Boots"}
  231.  
  232.     -- Other general spells and classes.
  233.     sets.midcast.Cure = {main="Chatoyant Staff",sub='Oneiros Grip',
  234.         head="Gende. Caubeen +1",
  235.         body="Gende. Bilaut +1",hands="Bokwus Gloves",ring1="Ephedra Ring",ring2="Sirona's Ring",
  236.         legs="Gendewitha Spats +1",feet="Gendewitha Galoshes +1"}
  237.        
  238.     sets.midcast.Curaga = sets.midcast.Cure
  239.        
  240.     sets.midcast.Stoneskin = {
  241.         head="Nahtirah Hat",
  242.         body="Gende. Bilaut +1",hands="Gendewitha Gages +1",
  243.         legs="Gendewitha Spats +1",feet="Gendewitha Galoshes +1"}
  244.        
  245.     sets.midcast.Cursna = {
  246.         ring1="Ephedra Ring"}
  247.  
  248.    
  249.     -- Sets to return to when not performing an action.
  250.    
  251.     -- Resting sets
  252.     sets.resting = {main="Chatoyant Staff",
  253.         body="Gende. Bilaut +1",hands="Serpentes Cuffs",
  254.         legs="Assid. Pants +1",feet="Serpentes Sabots"}
  255.    
  256.    
  257.     -- Idle sets (default idle set not needed since the other three are defined, but leaving for testing purposes)
  258.     sets.idle = {main="Terra's Staff", sub="Oneiros Grip",range="Oneiros Harp",
  259.         head=empty,neck="Bathy Choker",ear1="Bloodgem Earring",ear2="Loquacious Earring",
  260.         body="Respite Cloak",hands="Serpentes Cuffs",ring1="Paguroidea Ring",ring2="Sangoma Ring",
  261.         back="Kumbira Cape",waist="Flume Belt",legs="Assid. Pants +1",feet="Serpentes Sabots"}
  262.  
  263.     sets.idle.PDT = {main="Terra's Staff", sub="Oneiros Grip",range="Oneiros Harp",
  264.         head="Gende. Caubeen +1",neck="Bathy Choker",ear1="Bloodgem Earring",ear2="Loquacious Earring",
  265.         body="Gende. Bilaut +1",hands="Gendewitha Gages +1",ring1="Dark Ring",ring2="Sangoma Ring",
  266.         back="Kumbira Cape",waist="Flume Belt",legs="Gendewitha Spats +1",feet="Serpentes Sabots"}
  267.  
  268.     sets.idle.Town = {main="Lehbrailg +2", sub="Oneiros Grip",range="Gjallarhorn",
  269.         head="Bihu Roundlet +1",neck="Piper's Torque",ear1="Aoidos' Earring",ear2="Loquacious Earring",
  270.         body="Bihu Justaucorps +1",hands="Gendewitha Gages +1",ring1="Paguroidea Ring",ring2="Sangoma Ring",
  271.         back="Kumbira Cape",waist="Flume Belt",legs="Mdk. Shalwar +1",feet="Aoidos' Cothurnes +2"}
  272.    
  273.     sets.idle.Weak = {main="Terra's Staff",sub="Oneiros Grip",range="Oneiros Harp",
  274.         head="Gende. Caubeen +1",neck="Loricate Torque +1",ear1="Bloodgem Earring",
  275.         body="Gende. Bilaut +1",hands="Gendewitha Gages +1",ring1="Dark Ring",ring2="Sangoma Ring",
  276.         back="Kumbira Cape",waist="Flume Belt",legs="Gendewitha Spats +1",feet="Serpentes Sabots"}
  277.    
  278.    
  279.     -- Defense sets
  280.  
  281.     sets.defense.PDT = {main="Terra's Staff",sub="Oneiros Grip",
  282.         head="Gende. Caubeen +1",neck="Loricate Torque +1",
  283.         body="Gende. Bilaut +1",hands="Gendewitha Gages +1",ring1="Dark Ring",ring2="Dark Ring",
  284.         back="Kumbira Cape",waist="Flume Belt",legs="Gendewitha Spats +1",feet="Gendewitha Galoshes +1"}
  285.  
  286.     sets.defense.MDT = {main="Terra's Staff",sub="Oneiros Grip",
  287.         head="Nahtirah Hat",neck="Loricate Torque +1",
  288.         body="Gende. Bilaut +1",hands="Gendewitha Gages +1",ring1="Dark Ring",ring2="Shadow Ring",
  289.         back="Repulse Mantle",waist="Flume Belt",legs="Bihu Cannions",feet="Gendewitha Galoshes +1"}
  290.  
  291.     sets.Kiting = {feet="Aoidos' Cothurnes +2"}
  292.  
  293.     sets.latent_refresh = {waist="Fucho-no-obi"}
  294.  
  295.         sets.magic_burst = {
  296.         neck="Mizukage-no-Kubikazari",
  297.         ring1="Locus Ring",ring2="Mujin Band",
  298.         back="Seshaw Cape"}
  299.    
  300.    
  301.     -- Engaged sets
  302.  
  303.     -- Variations for TP weapon and (optional) offense/defense modes.  Code will fall back on previous
  304.     -- sets if more refined versions aren't defined.
  305.     -- If you create a set with both offense and defense modes, the offense mode should be first.
  306.     -- EG: sets.engaged.Dagger.Accuracy.Evasion
  307.    
  308.     -- Basic set for if no TP weapon is defined.
  309.     sets.engaged = {range="Angel Lyre",
  310.         head="Nahtirah Hat",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  311.         body="Bihu Justaucorps +1",hands="Buremte Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
  312.         back="Atheling Mantle",waist="Goading Belt",legs="Brioso Cannions +1",feet="Battlecast Gaiters"}
  313.  
  314.     -- Sets with weapons defined.
  315.     sets.engaged.Dagger = {range="Angel Lyre",
  316.         head="Nahtirah Hat",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  317.         body="Bihu Justaucorps +1",hands="Buremte Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
  318.         back="Atheling Mantle",waist="Goading Belt",legs="Brioso Cannions +1",feet="Gendewitha Galoshes +1"}
  319.  
  320.     -- Set if dual-wielding
  321.     sets.engaged.DW = {range="Angel Lyre",
  322.         head="Nahtirah Hat",neck="Asperity Necklace",ear1="Dudgeon Earring",ear2="Heartseeker Earring",
  323.         body="Bihu Justaucorps +1",hands="Buremte Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
  324.         back="Atheling Mantle",waist="Goading Belt",legs="Brioso Cannions +1",feet="Gendewitha Galoshes +1"}
  325. end
  326.  
  327.  
  328. -------------------------------------------------------------------------------------------------------------------
  329. -- Job-specific hooks for standard casting events.
  330. -------------------------------------------------------------------------------------------------------------------
  331.  
  332. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  333. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  334. function job_precast(spell, action, spellMap, eventArgs)
  335.     if spell.type == 'BardSong' then
  336.         -- Auto-Pianissimo
  337.         if ((spell.target.type == 'PLAYER' and not spell.target.charmed) or (spell.target.type == 'NPC' and spell.target.in_party)) and
  338.             not state.Buff['Pianissimo'] then
  339.            
  340.             local spell_recasts = windower.ffxi.get_spell_recasts()
  341.             if spell_recasts[spell.recast_id] < 2 then
  342.                send_command('@input /ja "Pianissimo" <me>; wait 1.5; input /ma "'..spell.name..'" '..spell.target.name)
  343.                 eventArgs.cancel = true
  344.                 return
  345.             end
  346.         end
  347.     end
  348. end
  349.  
  350. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  351. function job_midcast(spell, action, spellMap, eventArgs)
  352.     if spell.action_type == 'Magic' then
  353.         if spell.type == 'BardSong' then
  354.             -- layer general gear on first, then let default handler add song-specific gear.
  355.             local generalClass = get_song_class(spell)
  356.             if generalClass and sets.midcast[generalClass] then
  357.                 equip(sets.midcast[generalClass])
  358.             end
  359.         end
  360.     end
  361. end
  362.  
  363. function job_post_midcast(spell, action, spellMap, eventArgs)
  364.     if spell.type == 'BardSong' then
  365.         if state.ExtraSongsMode.value == 'FullLength' then
  366.             equip(sets.midcast.Daurdabla)
  367.         end
  368.  
  369.         state.ExtraSongsMode:reset()
  370.     end
  371. end
  372.  
  373. -- Set eventArgs.handled to true if we don't want automatic gear equipping to be done.
  374. function job_aftercast(spell, action, spellMap, eventArgs)
  375.     if spell.type == 'BardSong' and not spell.interrupted then
  376.         if spell.target and spell.target.type == 'SELF' then
  377.             adjust_timers(spell, spellMap)
  378.         end
  379.     end
  380. end
  381.  
  382. -------------------------------------------------------------------------------------------------------------------
  383. -- Job-specific hooks for non-casting events.
  384. -------------------------------------------------------------------------------------------------------------------
  385.  
  386. -- Handle notifications of general user state change.
  387. function job_state_change(stateField, newValue, oldValue)
  388.     if stateField == 'Offense Mode' then
  389.         if newValue == 'Normal' then
  390.             disable('main','sub','ammo')
  391.         else
  392.             enable('main','sub','ammo')
  393.         end
  394.     end
  395. end
  396.  
  397. -------------------------------------------------------------------------------------------------------------------
  398. -- User code that supplements standard library decisions.
  399. -------------------------------------------------------------------------------------------------------------------
  400.  
  401. -- Called by the 'update' self-command.
  402. function job_update(cmdParams, eventArgs)
  403.     pick_tp_weapon()
  404. end
  405.  
  406. -- Custom spell mapping.
  407. function job_get_spell_map(spell, default_spell_map)
  408.     if spell.skill == 'Elemental Magic' and default_spell_map ~= 'ElementalEnfeeble' then
  409.         if lowTierNukes:contains(spell.english) then
  410.             return 'LowTierNuke'
  411.         else
  412.             return 'HighTierNuke'
  413.         end
  414.     end
  415. end
  416.  
  417. -- Modify the default idle set after it was constructed.
  418. function customize_idle_set(idleSet)
  419.     if player.mpp < 51 then
  420.        idleSet = set_combine(idleSet, sets.latent_refresh)
  421.    end
  422.    
  423.    return idleSet
  424. end
  425.  
  426.  
  427. -- Function to display the current relevant user state when doing an update.
  428. function display_current_job_state(eventArgs)
  429.    display_current_caster_state()
  430.    eventArgs.handled = true
  431. end
  432.  
  433. -------------------------------------------------------------------------------------------------------------------
  434. -- Utility functions specific to this job.
  435. -------------------------------------------------------------------------------------------------------------------
  436.  
  437. -- Determine the custom class to use for the given song.
  438. function get_song_class(spell)
  439.    -- Can't use spell.targets:contains() because this is being pulled from resources
  440.    if set.contains(spell.targets, 'Enemy') then
  441.        if state.CastingMode == 'Resistant' then
  442.            return 'ResistantSongDebuff'
  443.        else
  444.            return 'SongDebuff'
  445.        end
  446.    elseif state.ExtraSongsMode.value == 'Dummy' then
  447.        return 'DaurdablaDummy'
  448.    else
  449.        return 'SongEffect'
  450.    end
  451. end
  452. -- Function to create custom buff-remaining timers with the Timers plugin,
  453. -- keeping only the actual valid songs rather than spamming the default
  454. -- buff remaining timers.
  455. function adjust_timers(spell, spellMap)
  456.    if state.UseCustomTimers.value == false then
  457.        return
  458.    end
  459.    
  460.    local current_time = os.time()
  461.    
  462.    -- custom_timers contains a table of song names, with the os time when they
  463.    -- will expire.
  464.    
  465.    -- Eliminate songs that have already expired from our local list.
  466.    local temp_timer_list = {}
  467.    for song_name,expires in pairs(custom_timers) do
  468.        if expires < current_time then
  469.            temp_timer_list[song_name] = true
  470.        end
  471.    end
  472.    for song_name,expires in pairs(temp_timer_list) do
  473.        custom_timers[song_name] = nil
  474.    end
  475.    
  476.    local dur = calculate_duration(spell.name, spellMap)
  477.    if custom_timers[spell.name] then
  478.        -- Songs always overwrite themselves now, unless the new song has
  479.        -- less duration than the old one (ie: old one was NT version, new
  480.        -- one has less duration than what's remaining).
  481.        
  482.        -- If new song will outlast the one in our list, replace it.
  483.        if custom_timers[spell.name] < (current_time + dur) then
  484.            send_command('timers delete "'..spell.name..'"')
  485.            custom_timers[spell.name] = current_time + dur
  486.            send_command('timers create "'..spell.name..'" '..dur..' down')
  487.        end
  488.    else
  489.        -- Figure out how many songs we can maintain.
  490.        local maxsongs = 2
  491.        if player.equipment.range == info.ExtraSongInstrument then
  492.            maxsongs = maxsongs + info.ExtraSongs
  493.        end
  494.        if buffactive['Clarion Call'] then
  495.            maxsongs = maxsongs + 1
  496.        end
  497.        -- If we have more songs active than is currently apparent, we can still overwrite
  498.        -- them while they're active, even if not using appropriate gear bonuses (ie: Daur).
  499.        if maxsongs < table.length(custom_timers) then
  500.            maxsongs = table.length(custom_timers)
  501.        end
  502.        
  503.        -- Create or update new song timers.
  504.        if table.length(custom_timers) < maxsongs then
  505.            custom_timers[spell.name] = current_time + dur
  506.            send_command('timers create "'..spell.name..'" '..dur..' down')
  507.        else
  508.            local rep,repsong
  509.            for song_name,expires in pairs(custom_timers) do
  510.                if current_time + dur > expires then
  511.                     if not rep or rep > expires then
  512.                         rep = expires
  513.                         repsong = song_name
  514.                     end
  515.                 end
  516.             end
  517.             if repsong then
  518.                 custom_timers[repsong] = nil
  519.                 send_command('timers delete "'..repsong..'"')
  520.                 custom_timers[spell.name] = current_time + dur
  521.                 send_command('timers create "'..spell.name..'" '..dur..' down')
  522.             end
  523.         end
  524.     end
  525. end
  526.  
  527. -- Function to calculate the duration of a song based on the equipment used to cast it.
  528. -- Called from adjust_timers(), which is only called on aftercast().
  529. function calculate_duration(spellName, spellMap)
  530.     local mult = 1
  531.     if player.equipment.range == 'Daurdabla' then mult = mult + 0.25 end -- change to 0.25 with 90 Daur
  532.     if player.equipment.range == "Gjallarhorn" then mult = mult + 0.4 end -- change to 0.3 with 95 Gjall
  533.    
  534.     if player.equipment.main == "Carnwenhan" then mult = mult + 0.1 end -- 0.1 for 75, 0.4 for 95, 0.5 for 99/119
  535.     if player.equipment.main == "Legato Dagger" then mult = mult + 0.05 end
  536.     if player.equipment.sub == "Legato Dagger" then mult = mult + 0.05 end
  537.     if player.equipment.neck == "Aoidos' Matinee" then mult = mult + 0.1 end
  538.     if player.equipment.body == "Aoidos' Hngrln. +2" then mult = mult + 0.1 end
  539.     if player.equipment.legs == "Mdk. Shalwar +1" then mult = mult + 0.1 end
  540.     if player.equipment.feet == "Brioso Slippers" then mult = mult + 0.1 end
  541.     if player.equipment.feet == "Brioso Slippers +1" then mult = mult + 0.11 end
  542.    
  543.     if spellMap == 'Paeon' and player.equipment.head == "Brioso Roundlet" then mult = mult + 0.1 end
  544.     if spellMap == 'Paeon' and player.equipment.head == "Brioso Roundlet +1" then mult = mult + 0.1 end
  545.     if spellMap == 'Madrigal' and player.equipment.head == "Aoidos' Calot +2" then mult = mult + 0.1 end
  546.     if spellMap == 'Minuet' and player.equipment.body == "Aoidos' Hngrln. +2" then mult = mult + 0.1 end
  547.     if spellMap == 'March' and player.equipment.hands == 'Ad. Mnchtte. +2' then mult = mult + 0.1 end
  548.     if spellMap == 'Ballad' and player.equipment.legs == "Aoidos' Rhing. +2" then mult = mult + 0.1 end
  549.     if spellName == "Sentinel's Scherzo" and player.equipment.feet == "Aoidos' Cothrn. +2" then mult = mult + 0.1 end
  550.    
  551.     if buffactive.Troubadour then
  552.         mult = mult*2
  553.     end
  554.     if spellName == "Sentinel's Scherzo" then
  555.         if buffactive['Soul Voice'] then
  556.             mult = mult*2
  557.         elseif buffactive['Marcato'] then
  558.             mult = mult*1.5
  559.         end
  560.     end
  561.    
  562.     local totalDuration = math.floor(mult*120)
  563.  
  564.     return totalDuration
  565. end
  566.  
  567.  
  568. -- Examine equipment to determine what our current TP weapon is.
  569. function pick_tp_weapon()
  570.     if brd_daggers:contains(player.equipment.main) then
  571.         state.CombatWeapon:set('Dagger')
  572.        
  573.         if S{'NIN','DNC'}:contains(player.sub_job) and brd_daggers:contains(player.equipment.sub) then
  574.             state.CombatForm:set('DW')
  575.         else
  576.             state.CombatForm:reset()
  577.         end
  578.     else
  579.         state.CombatWeapon:reset()
  580.         state.CombatForm:reset()
  581.     end
  582. end
  583.  
  584. -- Function to reset timers.
  585. function reset_timers()
  586.     for i,v in pairs(custom_timers) do
  587.         send_command('timers delete "'..i..'"')
  588.     end
  589.     custom_timers = {}
  590. end
  591.  
  592.  
  593. -- Select default macro book on initial load or subjob change.
  594. function select_default_macro_book()
  595.     set_macro_page(1, 13)
  596. end
  597.  
  598.  
  599. windower.raw_register_event('zone change',reset_timers)
  600. windower.raw_register_event('logout',reset_timers)
Advertisement
Add Comment
Please, Sign In to add comment