Boposhopo

RUN Lua

Jul 14th, 2025
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 20.83 KB | Gaming | 0 0
  1. -------------------------------------------------------------------------------------------------------------------
  2. -- Setup functions for this job.  Generally should not be modified.
  3. -------------------------------------------------------------------------------------------------------------------
  4.  
  5. -- Initialization function for this job file.
  6. function get_sets()
  7.     mote_include_version = 2
  8.  
  9.     -- Load and initialize the include file.
  10.     include('Mote-Include.lua')
  11. end
  12.  
  13.  
  14. -- Setup vars that are user-independent.
  15. function job_setup()
  16.  
  17. -- /BLU Spell Maps
  18.     blue_magic_maps = {}
  19.  
  20.     blue_magic_maps.Enmity = S{'Blank Gaze', 'Geist Wall', 'Jettatura', 'Soporific',
  21.         'Poison Breath', 'Blitzstrahl', 'Sheep Song', 'Chaotic Eye'}
  22.     blue_magic_maps.Cure = S{'Wild Carrot'}
  23.     blue_magic_maps.Buffs = S{'Cocoon', 'Refueling'}
  24.     -- Table of entries
  25.     rune_timers = T{}
  26.     -- entry = rune, index, expires
  27.    
  28.     if player.main_job_level >= 65 then
  29.         max_runes = 3
  30.     elseif player.main_job_level >= 35 then
  31.         max_runes = 2
  32.     elseif player.main_job_level >= 5 then
  33.         max_runes = 1
  34.     else
  35.         max_runes = 0
  36.     end
  37.    
  38.     send_command('wait 6;input /lockstyleset 21')
  39. end
  40.  
  41. -------------------------------------------------------------------------------------------------------------------
  42. -- User setup functions for this job.  Recommend that these be overridden in a sidecar file.
  43. -------------------------------------------------------------------------------------------------------------------
  44.  
  45. function user_setup()
  46.     state.OffenseMode:options('Normal', 'DD', 'Parry')
  47.     state.WeaponskillMode:options('Normal', 'ATK')
  48.     state.CastingMode:options('Normal', 'SIRD')
  49.     state.IdleMode:options('Normal', 'TANK', 'HP')
  50.  
  51.     select_default_macro_book(6)
  52. end
  53.  
  54.  
  55. function init_gear_sets()
  56.     sets.enmity = {ammo="Sapience Orb",
  57.         head="Halitus Helm",
  58.         body="Emet Harness +1",
  59.         hands="Kurys Gloves",
  60.         legs="Eri. Leg Guards +3",
  61.         feet="erilaz greaves +3",
  62.         neck="Moonlight Necklace",
  63.         waist="Plat. Mog. Belt",
  64.         left_ear="Cryptic Earring",
  65.         right_ear="Trux Earring",
  66.         left_ring="Eihwaz Ring",
  67.         right_ring="Begrudging Ring",
  68.         back={ name="Ogma's Cape", augments={'HP+60','Eva.+20 /Mag. Eva.+20','Enmity+10','Spell interruption rate down-10%',}},}
  69.  
  70.     --------------------------------------
  71.     -- Precast sets
  72.     --------------------------------------
  73.  
  74.     -- Precast sets to enhance JAs
  75.     sets.precast.JA['Vallation'] = {body="Runeist Coat +1", back="Ogma's Cape"}
  76.     sets.precast.JA['Valiance'] = sets.precast.JA['Vallation']
  77.     sets.precast.JA['Pflug'] = {feet="Runeist Bottes +2"}
  78.     sets.precast.JA['Battuta'] = {head="Futhark Bandeau +3"}
  79.     sets.precast.JA['Liement'] = {body="Futhark Coat +1"}
  80.     sets.precast.JA['Lunge'] = {ammo={ name="Ghastly Tathlum +1", augments={'Path: A',}},
  81.         head="Agwu's Cap",
  82.         body={ name="Agwu's Robe", augments={'Path: A',}},
  83.         hands={ name="Agwu's Gages", augments={'Path: A',}},
  84.         legs={ name="Agwu's Slops", augments={'Path: A',}},
  85.         feet={ name="Agwu's Pigaches", augments={'Path: A',}},
  86.         neck="Sibyl Scarf",
  87.         waist="Skrymir Cord",
  88.         left_ear="Friomisi Earring",
  89.         right_ear="Odnowa Earring +1",
  90.         left_ring={ name="Metamor. Ring +1", augments={'Path: A',}},
  91.         right_ring="Mujin Band",
  92.         back={ name="Ogma's Cape", augments={'HP+60','Eva.+20 /Mag. Eva.+20','Enmity+10','Spell interruption rate down-10%',}},}
  93.     sets.precast.JA['Swipe'] = set_combine(sets.precast.JA['Lunge'], {})
  94.     sets.precast.JA['Gambit'] = {hands="Runeist Mitons +3"}
  95.     sets.precast.JA['Rayke'] = {feet="Futhark Boots +1"}
  96.     sets.precast.JA['Elemental Sforzo'] = {body="Futhark Coat +1"}
  97.     sets.precast.JA['Swordplay'] = {hands="Futhark Mitons +1"}
  98.     sets.precast.JA['Embolden'] = {back="Evasionist's Cape"}
  99.     sets.precast.JA['Vivacious Pulse'] = {head="Erilaz Galea +3"}
  100.     sets.precast.JA['One For All'] = {}
  101.     sets.precast.JA['Provoke'] = set_combine(sets.enmity, {})
  102.  
  103.  
  104.     -- Fast cast sets for spells
  105.     sets.precast.FC = {ammo="Sapience Orb", --2
  106.         head="Rune. Bandeau +2", --12
  107.         body="Erilaz Surcoat +3", --10
  108.         hands={ name="Leyline Gloves", augments={'Accuracy+12','Mag. Acc.+14','"Mag.Atk.Bns."+15','"Fast Cast"+2',}}, --7
  109.         legs={ name="Agwu's Slops", augments={'Path: A',}}, --7
  110.         feet={ name="Carmine Greaves +1", augments={'HP+80','MP+80','Phys. dmg. taken -4',}}, --8
  111.         neck={ name="Unmoving Collar +1", augments={'Path: A',}},
  112.         waist="Tempus Fugit",
  113.         left_ear="Etiolation Earring", --1
  114.         right_ear="Loquac. Earring", --2
  115.         left_ring="Kishar Ring", --4
  116.         right_ring="Naji's Loop", --1
  117.         back={ name="Ogma's Cape", augments={'HP+60','Eva.+20 /Mag. Eva.+20','HP+10','"Fast Cast"+10',}},} --10
  118.    
  119.     sets.precast.FC['Enhancing Magic'] = set_combine(sets.precast.FC, {})
  120.     sets.precast.FC['Utsusemi: Ichi'] = set_combine(sets.precast.FC, {})
  121.     sets.precast.FC['Utsusemi: Ni'] = set_combine(sets.precast.FC['Utsusemi: Ichi'], {})
  122.  
  123.  
  124.     -- Weaponskill sets
  125.     sets.precast.WS = {ammo="Knobkierrie",
  126.         head={ name="Nyame Helm", augments={'Path: B',}},
  127.         body={ name="Nyame Mail", augments={'Path: B',}},
  128.         hands="Nyame Gauntlets",
  129.         legs={ name="Nyame Flanchard", augments={'Path: B',}},
  130.         feet={ name="Nyame Sollerets", augments={'Path: B',}},
  131.         neck="Rep. Plat. Medal",
  132.         waist="Grunfeld Rope",
  133.         left_ear="Ishvara Earring",
  134.         right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
  135.         left_ring="Niqmaddu Ring",
  136.         right_ring="Regal Ring",
  137.         back={ name="Ogma's Cape", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','Weapon skill damage +10%','Phys. dmg. taken-10%',}},}
  138.    
  139.     sets.precast.WS['Resolution'] = {ammo="Seething Bomblet +1",
  140.         head={ name="Nyame Helm", augments={'Path: B',}},
  141.         body={ name="Nyame Mail", augments={'Path: B',}},
  142.         hands={ name="Adhemar Wrist. +1", augments={'STR+12','DEX+12','Attack+20',}},
  143.         legs={ name="Nyame Flanchard", augments={'Path: B',}},
  144.         feet={ name="Nyame Sollerets", augments={'Path: B',}},
  145.         neck="Fotia Gorget",
  146.         waist="Sailfi Belt +1",
  147.         left_ear="Sherida Earring",
  148.         right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
  149.         left_ring="Niqmaddu Ring",
  150.         right_ring="Regal Ring",
  151.         back={ name="Ogma's Cape", augments={'STR+20','Accuracy+20 Attack+20','"Dbl.Atk."+10',}},
  152. }
  153.     sets.precast.WS['Dimidiation'] = {ammo="Knobkierrie",
  154.         head={ name="Nyame Helm", augments={'Path: B',}},
  155.         body={ name="Nyame Mail", augments={'Path: B',}},
  156.         hands="Nyame Gauntlets",
  157.         legs={ name="Nyame Flanchard", augments={'Path: B',}},
  158.         feet={ name="Nyame Sollerets", augments={'Path: B',}},
  159.         neck="Rep. Plat. Medal",
  160.         waist="Grunfeld Rope",
  161.         left_ear="Ishvara Earring",
  162.         right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
  163.         left_ring="Niqmaddu Ring",
  164.         right_ring="Regal Ring",
  165.         back={ name="Ogma's Cape", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','Weapon skill damage +10%','Phys. dmg. taken-10%',}},}
  166.        
  167.     sets.precast.WS['Savage Blade'] = {ammo="Knobkierrie",
  168.         head={ name="Nyame Helm", augments={'Path: B',}},
  169.         body={ name="Nyame Mail", augments={'Path: B',}},
  170.         hands="Nyame Gauntlets",
  171.         legs={ name="Nyame Flanchard", augments={'Path: B',}},
  172.         feet={ name="Nyame Sollerets", augments={'Path: B',}},
  173.         neck="Rep. Plat. Medal",
  174.         waist="Sailfi Belt +1",
  175.         left_ear="Ishvara Earring",
  176.         right_ear={ name="Moonshade Earring", augments={'Attack+4','TP Bonus +250',}},
  177.         left_ring="Niqmaddu Ring",
  178.         right_ring="Regal Ring",
  179.         back={ name="Ogma's Cape", augments={'DEX+20','Accuracy+20 Attack+20','DEX+10','Weapon skill damage +10%','Phys. dmg. taken-10%',}},}
  180.  
  181.  
  182.  
  183.  
  184.     --------------------------------------
  185.     -- Midcast sets
  186.     --------------------------------------
  187.    
  188.     sets.midcast.FastRecast =  {}
  189.     sets.midcast['Enhancing Magic'] = {head="Erilaz Galea +3",
  190.         hands="runeist mitons +3",
  191.         legs={ name="Carmine Cuisses +1", augments={'Accuracy+20','Attack+12','"Dual Wield"+6',}},
  192.         neck="Unmoving Collar +1",
  193.         waist="Olympus Sash",
  194.         left_ear="Andoaa Earring",
  195.         left_ring="Stikini Ring",
  196.         right_ring="Stikini Ring",
  197.         back="Moonbeam Cape",}
  198.     sets.midcast['Refresh'] = set_combine(sets.midcast['Enhancing Magic'], {})
  199.     sets.midcast['Phalanx'] = set_combine(sets.midcast['Enhancing Magic'], {ammo="Staunch Tathlum",
  200.         head={ name="Fu. Bandeau +3", augments={'Enhances "Battuta" effect',}},
  201.         body={ name="Taeon Tabard", augments={'Spell interruption rate down -9%','Phalanx +3',}},
  202.         hands={ name="Taeon Gloves", augments={'Spell interruption rate down -10%','Phalanx +3',}},
  203.         legs={ name="Carmine Cuisses +1", augments={'Accuracy+20','Attack+12','"Dual Wield"+6',}},
  204.         feet={ name="Taeon Boots", augments={'Spell interruption rate down -10%','Phalanx +3',}},
  205.         neck="Moonlight Necklace",
  206.         waist="Audumbla Sash",
  207.         back={ name="Ogma's Cape", augments={'HP+60','Eva.+20 /Mag. Eva.+20','Enmity+10','Spell interruption rate down-10%',}},})
  208.     sets.midcast['Regen'] = {head="Rune. Bandeau +2",
  209.         hands="Regal Gauntlets",
  210.         legs={ name="Futhark Trousers +1", augments={'Enhances "Inspire" effect',}},
  211.         right_ear="Erilaz Earring",
  212.         neck="Sacro Gorget",
  213.         back="Moonbeam Cape",}
  214.     sets.midcast['Stoneskin'] = set_combine(sets.midcast['Enhancing Magic'], {hands="Stone Mufflers"})
  215.     sets.midcast['Flash'] = set_combine(sets.enmity, {})
  216.     sets.midcast['Foil'] = set_combine(sets.enmity, {})
  217.     sets.midcast['Stun'] = set_combine(sets.enmity, {})
  218.     sets.midcast['Temper'] = {head="Erilaz Galea +3",
  219.         hands="runeist mitons +3",
  220.         legs={ name="Carmine Cuisses +1", augments={'Accuracy+20','Attack+12','"Dual Wield"+6',}},
  221.         neck="Unmoving Collar +1",
  222.         waist="Olympus Sash",
  223.         left_ear="Andoaa Earring",
  224.         left_ring="Stikini Ring",
  225.         right_ring="Stikini Ring",
  226.         back="Moonbeam Cape",}
  227.     sets.midcast.Cure = {}
  228.    
  229.     sets.midcast['Blue Magic'] = {ammo="Staunch Tathlum",
  230.         head="Erilaz Galea +3",
  231.         hands="Regal Gauntlets",
  232.         legs={ name="Carmine Cuisses +1", augments={'Accuracy+20','Attack+12','"Dual Wield"+6',}},
  233.         neck="Moonlight Necklace",
  234.         waist="Audumbla Sash",
  235.         left_ear="Tuisto Earring",
  236.         right_ear="Odnowa Earring +1",
  237.         right_ring="Evanescence Ring",
  238.         back={ name="Ogma's Cape", augments={'HP+60','Eva.+20 /Mag. Eva.+20','Enmity+10','Spell interruption rate down-10%',}},}
  239.     sets.midcast['Blue Magic'].Enmity = set_combine(sets.enmity, {})
  240.     sets.midcast['Blue Magic'].Enmity.SIRD = {ammo="Staunch Tathlum",
  241.         head="Erilaz Galea +3",
  242.         body="Emet Harness +1",
  243.         hands="Regal Gauntlets",
  244.         legs={ name="Carmine Cuisses +1", augments={'Accuracy+20','Attack+12','"Dual Wield"+6',}},
  245.         feet="erilaz greaves +3",
  246.         neck="Moonlight Necklace",
  247.         waist="Audumbla Sash",
  248.         left_ear="Tuisto Earring",
  249.         right_ear="Odnowa Earring +1",
  250.         left_ring="Eihwaz Ring",
  251.         right_ring="Evanescence Ring",
  252.         back={ name="Ogma's Cape", augments={'HP+60','Eva.+20 /Mag. Eva.+20','Enmity+10','Spell interruption rate down-10%',}},}
  253.     sets.midcast['Blue Magic'].Cure = set_combine(sets.midcast.Cure, {})
  254.     sets.midcast['Blue Magic'].Buff = sets.midcast['Enhancing Magic']
  255.  
  256.     --------------------------------------
  257.     -- Idle/resting/defense/etc sets
  258.     --------------------------------------
  259.  
  260.     sets.idle = {ammo="Homiliary",
  261.         head={ name="Nyame Helm", augments={'Path: B',}},
  262.         body="Runeist Coat +1",
  263.         hands="Regal Gauntlets",
  264.         legs={ name="Carmine Cuisses +1", augments={'Accuracy+20','Attack+12','"Dual Wield"+6',}},
  265.         feet="Erilaz Greaves +3",
  266.         neck="Warder's Charm +1",
  267.         waist="Carrier's Sash",
  268.         left_ear="Tuisto Earring",
  269.         right_ear="Infused Earring",
  270.         left_ring="Defending Ring",
  271.         right_ring="Chirich Ring +1",
  272.         back={ name="Ogma's Cape", augments={'HP+60','Accuracy+20 Attack+20','HP+20','"Store TP"+10','Phys. dmg. taken-10%',}},}
  273.        
  274.     sets.idle.TANK = {ammo="Staunch Tathlum",
  275.         head="Erilaz Galea +3",
  276.         body="Erilaz Surcoat +3",
  277.         hands="Nyame Gauntlets",
  278.         legs="Eri. Leg Guards +3",
  279.         feet="Erilaz Greaves +3",
  280.         neck={ name="Futhark Torque +2", augments={'Path: A',}},
  281.         waist="Carrier's Sash",
  282.         left_ear="Tuisto Earring",
  283.         right_ear="Odnowa Earring +1",
  284.         left_ring="Defending Ring",
  285.         right_ring={ name="Gelatinous Ring +1", augments={'Path: A',}},
  286.         back={ name="Ogma's Cape", augments={'HP+60','Accuracy+20 Attack+20','HP+20','"Store TP"+10','Phys. dmg. taken-10%',}},}
  287.        
  288.     sets.idle.HP = {ammo="Staunch Tathlum",
  289.         head={ name="Nyame Helm", augments={'Path: B',}},
  290.         body="Erilaz Surcoat +3",
  291.         hhands="Nyame Gauntlets",
  292.         legs={ name="Nyame Flanchard", augments={'Path: B',}},
  293.         feet={ name="Nyame Sollerets", augments={'Path: B',}},
  294.         neck={ name="Futhark Torque +2", augments={'Path: A',}},
  295.         waist="Carrier's Sash",
  296.         left_ear="Tuisto Earring",
  297.         right_ear="Odnowa Earring +1",
  298.         left_ring="Moonlight Ring",
  299.         right_ring={ name="Gelatinous Ring +1", augments={'Path: A',}},
  300.         back="Moonbeam Cape",}
  301.            
  302.  
  303.     --------------------------------------
  304.     -- Engaged sets
  305.     --------------------------------------
  306.  
  307.     sets.engaged = {ammo={ name="Coiste Bodhar", augments={'Path: A',}},
  308.         head="Erilaz Galea +3",
  309.         body="Erilaz Surcoat +3",
  310.         hands="Turms Mittens +1",
  311.         legs="Eri. Leg Guards +3",
  312.         feet="Erilaz Greaves +3",
  313.         neck={ name="Futhark Torque +2", augments={'Path: A',}},
  314.         waist="Audumbla Sash",
  315.         left_ear="Tuisto Earring",
  316.         right_ear="Odnowa Earring +1",
  317.         left_ring="Moonlight Ring",
  318.         right_ring="Moonlight Ring",
  319.         back={ name="Ogma's Cape", augments={'HP+60','Accuracy+20 Attack+20','HP+20','"Store TP"+10','Phys. dmg. taken-10%',}},}
  320.        
  321.     sets.engaged.DD = {ammo={ name="Coiste Bodhar", augments={'Path: A',}},
  322.         head={ name="Adhemar Bonnet +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
  323.         body={ name="Adhemar Jacket +1", augments={'DEX+12','AGI+12','Accuracy+20',}},
  324.         hands={ name="Adhemar Wrist. +1", augments={'STR+12','DEX+12','Attack+20',}},
  325.         legs={ name="Samnuha Tights", augments={'STR+8','DEX+9','"Dbl.Atk."+3','"Triple Atk."+2',}},
  326.         feet="Volte Spats",
  327.         neck="Anu Torque",
  328.         waist={ name="Sailfi Belt +1", augments={'Path: A',}},
  329.         left_ear="Sherida Earring",
  330.         right_ear="Telos Earring",
  331.         left_ring="Moonlight Ring",
  332.         right_ring="Moonlight Ring",
  333.         back={ name="Ogma's Cape", augments={'STR+20','Accuracy+20 Attack+20','"Dbl.Atk."+10',}},}
  334.    
  335.     sets.engaged.Parry = set_combine(sets.engaged, {feet="Turms Leggings +1"})
  336.  
  337. end
  338.  
  339. ------------------------------------------------------------------
  340. -- Action events
  341. ------------------------------------------------------------------
  342.  
  343. -- Run after the default midcast() is done.
  344. -- eventArgs is the same one used in job_midcast, in case information needs to be persisted.
  345. function job_post_midcast(spell, action, spellMap, eventArgs)
  346.     if spell.english == 'Lunge' or spell.english == 'Swipe' then
  347.         local obi = get_obi(get_rune_obi_element())
  348.         if obi then
  349.             equip({waist=obi})
  350.         end
  351.     end
  352. end
  353.  
  354.  
  355. function job_aftercast(spell)
  356.     if not spell.interrupted then
  357.         if spell.type == 'Rune' then
  358.             update_timers(spell)
  359.         elseif spell.name == "Lunge" or spell.name == "Gambit" or spell.name == 'Rayke' then
  360.             reset_timers()
  361.         end
  362.     end
  363. end
  364.  
  365.  
  366. -------------------------------------------------------------------------------------------------------------------
  367. -- Customization hooks for idle and melee sets, after they've been automatically constructed.
  368. -------------------------------------------------------------------------------------------------------------------
  369.  
  370. -------------------------------------------------------------------------------------------------------------------
  371. -- General hooks for other events.
  372. -------------------------------------------------------------------------------------------------------------------
  373.  
  374. -------------------------------------------------------------------------------------------------------------------
  375. -- User code that supplements self-commands.
  376. -------------------------------------------------------------------------------------------------------------------
  377.  
  378. -------------------------------------------------------------------------------------------------------------------
  379. -- Utility functions specific to this job.
  380. -------------------------------------------------------------------------------------------------------------------
  381.  
  382. -- Select default macro book on initial load or subjob change.
  383. function select_default_macro_book()
  384.     -- Default macro set/book
  385.     if player.sub_job == 'WAR' then
  386.         set_macro_page(1, 6)
  387.     elseif player.sub_job == 'BLU' then
  388.         set_macro_page(4, 6)
  389.     elseif player.sub_job == 'SAM' then
  390.         set_macro_page(2, 6)
  391.     else
  392.         set_macro_page(3, 6)
  393.     end
  394. end
  395.  
  396. function get_rune_obi_element()
  397.     weather_rune = buffactive[elements.rune_of[world.weather_element] or '']
  398.     day_rune = buffactive[elements.rune_of[world.day_element] or '']
  399.    
  400.     local found_rune_element
  401.    
  402.     if weather_rune and day_rune then
  403.         if weather_rune > day_rune then
  404.             found_rune_element = world.weather_element
  405.         else
  406.             found_rune_element = world.day_element
  407.         end
  408.     elseif weather_rune then
  409.         found_rune_element = world.weather_element
  410.     elseif day_rune then
  411.         found_rune_element = world.day_element
  412.     end
  413.    
  414.     return found_rune_element
  415. end
  416.  
  417. function get_obi(element)
  418.     if element and elements.obi_of[element] then
  419.         return (player.inventory[elements.obi_of[element]] or player.wardrobe[elements.obi_of[element]]) and elements.obi_of[element]
  420.     end
  421. end
  422.  
  423.  
  424. ------------------------------------------------------------------
  425. -- Timer manipulation
  426. ------------------------------------------------------------------
  427.  
  428. -- Add a new run to the custom timers, and update index values for existing timers.
  429. function update_timers(spell)
  430.     local expires_time = os.time() + 300
  431.     local entry_index = rune_count(spell.name) + 1
  432.  
  433.     local entry = {rune=spell.name, index=entry_index, expires=expires_time}
  434.  
  435.     rune_timers:append(entry)
  436.    
  437. end
  438.  
  439. -- Get the command string to create a custom timer for the provided entry.
  440. function create_timer(entry)
  441.     local timer_name = '"Rune: ' .. entry.rune .. '-' .. tostring(entry.index) .. '"'
  442.     local duration = entry.expires - os.time()
  443.     return 'timers c ' .. timer_name .. ' ' .. tostring(duration) .. ' down'
  444. end
  445.  
  446. -- Get the command string to delete a custom timer for the provided entry.
  447. function delete_timer(entry)
  448.     local timer_name = '"Rune: ' .. entry.rune .. '-' .. tostring(entry.index) .. '"'
  449.     return 'timers d ' .. timer_name .. ''
  450. end
  451.  
  452. -- Reset all timers
  453. function reset_timers()
  454.     local cmd_queue = ''
  455.     for index,entry in pairs(rune_timers) do
  456.         cmd_queue = cmd_queue .. delete_timer(entry) .. ';wait 0.05;'
  457.     end
  458.     rune_timers:clear()
  459.     send_command(cmd_queue)
  460. end
  461.  
  462. -- Get a count of the number of runes of a given type
  463. function rune_count(rune)
  464.     local count = 0
  465.     local current_time = os.time()
  466.     for _,entry in pairs(rune_timers) do
  467.         if entry.rune == rune and entry.expires > current_time then
  468.             count = count + 1
  469.         end
  470.     end
  471.     return count
  472. end
  473.  
  474. -- Remove the oldest rune(s) from the table, until we're below the max_runes limit.
  475. -- If given a value n, remove n runes from the table.
  476. --function trim(n)
  477.    -- local cmd_queue = ''
  478.  
  479.   --  local to_remove = n or (rune_timers:length() - max_runes)
  480.  
  481.    -- while to_remove > 0 and rune_timers:length() > 0 do
  482.         --local oldest
  483.         --for index,entry in pairs(rune_timers) do
  484.            -- if oldest == nil or entry.expires < rune_timers[oldest].expires then
  485.              --   oldest = index
  486.             --end
  487.        -- end
  488.        
  489.        -- cmd_queue = cmd_queue .. prune(rune_timers[oldest].rune)
  490.         --to_remove = to_remove - 1
  491.   --  end
  492.    
  493.    -- return cmd_queue
  494. --end
  495.  
  496. -- Drop the index of all runes of a given type.
  497. -- If the index drops to 0, it is removed from the table.
  498. --function prune(rune)
  499.     --local cmd_queue = ''
  500.    
  501.     --for index,entry in pairs(rune_timers) do
  502.        -- if entry.rune == rune then
  503.            -- cmd_queue = cmd_queue .. delete_timer(entry) .. ';wait 0.05;'
  504.            -- entry.index = entry.index - 1
  505.        -- end
  506.    -- end
  507.  
  508.    -- for index,entry in pairs(rune_timers) do
  509.      --   if entry.rune == rune then
  510.           --  if entry.index == 0 then
  511.          --       rune_timers[index] = nil
  512.          --   else
  513.          --       cmd_queue = cmd_queue .. create_timer(entry) .. ';wait 0.05;'
  514.         --    end
  515.       --  end
  516.     --end
  517.    
  518.   --  return cmd_queue
  519. --end
  520.  
  521.  
  522. ------------------------------------------------------------------
  523. -- Reset events
  524. ------------------------------------------------------------------
  525.  
  526. windower.raw_register_event('zone change',reset_timers)
  527. windower.raw_register_event('logout',reset_timers)
  528. windower.raw_register_event('status change',function(new, old)
  529.     if gearswap.res.statuses[new].english == 'Dead' then
  530.         reset_timers()
  531.     end
  532. end)
Advertisement
Add Comment
Please, Sign In to add comment