Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- NOTE: I do not play run, so this will not be maintained for 'active' use.
- -- It is added to the repository to allow people to have a baseline to build from,
- -- and make sure it is up-to-date with the library API.
- -------------------------------------------------------------------------------------------------------------------
- -- Setup functions for this job. Generally should not be modified.
- -------------------------------------------------------------------------------------------------------------------
- -- Initialization function for this job file.
- function get_sets()
- mote_include_version = 2
- -- Load and initialize the include file.
- include('Mote-Include.lua')
- end
- include('organizer-lib')
- -- Setup vars that are user-independent.
- function job_setup()
- -- Table of entries
- rune_timers = T{}
- -- entry = rune, index, expires
- if player.main_job_level >= 65 then
- max_runes = 2
- elseif player.main_job_level >= 35 then
- max_runes = 2
- elseif player.main_job_level >= 5 then
- max_runes = 1
- else
- max_runes = 0
- end
- end
- -------------------------------------------------------------------------------------------------------------------
- -- User setup functions for this job. Recommend that these be overridden in a sidecar file.
- -------------------------------------------------------------------------------------------------------------------
- function user_setup()
- state.OffenseMode:options('Normal', 'Acc', 'Hybrid', 'PDT', 'MDT', 'BDT')
- state.WeaponskillMode:options('Normal', 'Acc')
- state.PhysicalDefenseMode:options('PDT', 'MDT', 'BDT')
- state.IdleMode:options('Regen', 'Refresh', 'DT')
- state.CastingMode:options('Normal','Interupt')
- select_default_macro_book()
- info.RuneEnchantment = S{"Tellus", "Unda", "Flabra", "Ignis", "Gelus", "Sulpor", "Lux", "Tenebrae"}
- info.Shields = S{"Ochain", "Aegis"}
- gear.tp_ValorHead = {name="Valorous Mask", augments={'Accuracy+25 Attack+25','"Dbl.Atk."+4','MND+6','Accuracy+13',}}
- gear.tp_ValorBody = {name="Valorous Mail", augments={'Accuracy+24 Attack+24','AGI+8','Accuracy+11',}}
- gear.tp_ValorHands = {name="Valorous Mitts", augments={'Accuracy+23 Attack+23','AGI+7','Accuracy+14','Attack+15',}}
- gear.tp_ValorLegs = {name="Valor. Hose", augments={'Accuracy+15 Attack+15','Crit.hit rate+2','DEX+10','Accuracy+12',}}
- gear.tp_ValorFeet = {name="Valorous Greaves", augments={'Accuracy+29','"Store TP"+6','VIT+1','Attack+14',}}
- gear.ws_ValorHead = {name="Valorous Mask", augments={'Accuracy+26','Weapon skill damage +4%','Attack+1',}}
- gear.ws_ValorBody = {}
- gear.ws_ValorHands = {name="Valorous Mitts", augments={'Accuracy+29','Weapon skill damage +4%','STR+6','Attack+8',}}
- gear.ws_ValorLegs = {name="Valor. Hose", augments={'Accuracy+23 Attack+23','Weapon Skill Acc.+15','VIT+7','Accuracy+14','Attack+12',}}
- gear.ws_ValorFeet = {name="Valorous Greaves", augments={'Accuracy+29','"Store TP"+6','VIT+1','Attack+14',}}
- gear.dt_ValorLegs = {name="Valor. Hose", augments={'Accuracy+14','Phys. dmg. taken -2%','DEX+8',}}
- send_command('bind ^` gs equip sets.engaged.Ochain')
- send_command('bind !` gs equip sets.engaged.Aegis')
- end
- function user_unload()
- send_command('unbind ^`')
- send_command('unbind !`')
- end
- function init_gear_sets()
- sets.enmity = {ammo="Amar Cluster",
- head="Loess Barbuta +1", neck="Warder's Charm +1", ear1="Trux Earring", ear2="Cryptic Earring",
- body="Odyss. Chestplate", hands="Yorium Gauntlets", ring1="Pernicious ring", ring2="Supershear Ring",
- back="Reiki Cloak", waist="Goading Belt", legs="Cab. Breeches +1", feet="Eschite Greaves"}
- --------------------------------------
- -- Precast sets
- --------------------------------------
- -- Precast sets to enhance JAs
- sets.precast.JA = sets.enmity
- sets.precast.JA['Invincible'] = set_combine(sets.enmity, {legs="Cab. Breeches +1",})
- sets.precast.JA['Shield Bash'] = set_combine(sets.enmity, {hands="Cab. Gauntlets +1", ear1="Knightly Earring", ring1="Fenian Ring",})
- sets.precast.JA['Holy Circle'] = set_combine(sets.enmity, {feet="Rev. Leggings +1",})
- sets.precast.JA['Sentinel'] = set_combine(sets.enmity, {feet="Cab. Leggings +1"})
- sets.precast.JA['Cover'] = set_combine(sets.enmity, {head="Rev. Coronet +1", body="Cab. Surcoat +1"})
- sets.precast.JA['Rampart'] = set_combine(sets.enmity, {
- head="Cab. Coronet +1", ear1="Genmei Earring",
- body="Jumalik Mail", hands="Umuthi Gloves", ring1="Petrov Ring", ring2="Supershear Ring",
- back="Weard Mantle", legs="Osmium Cuisses", feet="Rev. Leggings +1"})
- sets.precast.JA['Fealty'] = set_combine(sets.enmity, {body="Cab. Surcoat +1"})
- sets.precast.JA['Chivalry'] = set_combine(sets.enmity, {
- head="Rev. Coronet +1", ear1="Genmei Earring",
- body="Emet Harness +1", hands="Cab. Gauntlets +1",
- legs="Mes'yohi Slacks", feet="Amm Greaves"})
- sets.precast.JA['Divine Emblem'] = set_combine(sets.enmity, {feet="Chev. Sabatons +1",})
- sets.precast.JA['Sepulcher'] = set_combine(sets.enmity, {})
- sets.precast.JA['Palisade'] = set_combine(sets.enmity, {})
- sets.precast.JA['Intervene'] = sets.precast.JA['Shield Bash']
- -- Fast cast sets for spells
- sets.precast.FC = {ammo="Impatiens",
- head="Chev. Armet +1", neck="Orunmila's Torque", ear1="Loquacious Earring", ear2="Enchntr. Earring +1",
- body="Rev. Surcoat +1", hands="Leyline Gloves", ring1="Weather. Ring", ring2="Prolix Ring",
- legs="Homam Cosciales", feet="Odyssean Greaves"}
- sets.precast.FC['Enhancing Magic'] = set_combine(sets.precast.FC, {waist="Siegel Sash",})
- sets.precast.FC['Utsusemi: Ichi'] = set_combine(sets.precast.FC, {})
- sets.precast.FC['Utsusemi: Ni'] = set_combine(sets.precast.FC['Utsusemi: Ichi'], {})
- -- Weaponskill sets
- sets.precast.WS = {ammo="Floestone",
- head=gear.ws_ValorHead, neck="Fotia Gorget", ear1="Brutal Earring", ear2="Moonshade Earring",
- body="Acro Surcoat", hands=gear.ws_ValorHands, ring1="Ifrit Ring +1", ring2="Ifrit Ring +1",
- back="Buquwik Cape", waist="Fotia Belt", legs=gear.ws_ValorLegs, feet="Acro Leggings"}
- sets.precast.WS.Acc = set_combine(sets.precast.WS.Normal,
- {ammo="Amar Cluster",
- ear1="Zwazo Earring +1",
- ring1="Rufescent Ring",
- back="Grounded Mantle +1",})
- sets.precast.WS['Resolution'] = {ammo="Floestone",
- head=gear.ws_ValorHead, neck="Fotia Gorget", ear1="Zwazo Earring +1", ear2="Moonshade Earring",
- body="Acro Surcoat", hands=gear.ws_ValorHands, ring1="Ifrit Ring +1", ring2="Ifrit Ring +1",
- back="Buquwik Cape", waist="Fotia Belt", legs=gear.ws_ValorLegs, feet="Acro Leggings"}
- sets.precast.WS['Resolution'].Acc = set_combine(sets.precast.WS['Resolution'].Normal,
- {ammo="Amar Cluster",
- ring1="Rufescent Ring",
- back="Grounded Mantle +1",})
- sets.precast.WS['Ground Strike'] = {ammo="Floestone",
- head=gear.ws_ValorHead, neck="Fotia Gorget", ear1="Ishvara Earring", ear2="Moonshade Earring",
- body="Acro Surcoat", hands=gear.ws_ValorHands, ring1="Ifrit Ring +1", ring2="Ifrit Ring +1",
- back="Buquwik Cape", waist="Fotia Belt", legs=gear.ws_ValorLegs, feet="Acro Leggings"}
- sets.precast.WS['Ground Strike'].Acc = set_combine(sets.precast.WS['Ground Strike'].Normal,
- {ammo="Amar Cluster",
- ear1="Zwazo Earring +1",
- ring1="Rufescent Ring",
- back="Grounded Mantle +1",})
- sets.precast.WS['Torcleaver'] = {ammo="Floestone",
- head=gear.ws_ValorHead, neck="Fotia Gorget", ear1="Ishvara Earring", ear2="Moonshade Earring",
- body="Acro Surcoat", hands=gear.ws_ValorHands, ring1="Ifrit Ring +1", ring2="Ifrit Ring +1",
- back="Buquwik Cape", waist="Fotia Belt", legs=gear.ws_ValorLegs, feet="Acro Leggings"}
- sets.precast.WS['Torcleaver'].Acc = set_combine(sets.precast.WS['Torcleaver'].Normal,
- {ammo="Amar Cluster",
- ear1="Zwazo Earring +1",
- ring1="Rufescent Ring",
- back="Grounded Mantle +1",})
- sets.precast.WS['Savage Blade'] = {ammo="Floestone",
- head=gear.ws_ValorHead, neck="Fotia Gorget", ear1="Ishvara Earring", ear2="Moonshade Earring",
- body="Acro Surcoat", hands=gear.ws_ValorHands, ring1="Ifrit Ring +1", ring2="Ifrit Ring +1",
- back="Buquwik Cape", waist="Fotia Belt", legs=gear.ws_ValorLegs, feet="Acro Leggings"}
- sets.precast.WS['Savage Blade'].Acc = set_combine(sets.precast.WS['Savage Blade'].Normal,
- {ammo="Amar Cluster",
- ear1="Zwazo Earring +1",
- ring1="Rufescent Ring",
- back="Grounded Mantle +1",})
- sets.precast.WS['Chant du Cygne'] = {ammo="Jukukik Feather",
- head=gear.ws_ValorHead, neck="Fotia Gorget", ear1="Brutal Earring", ear2="Moonshade Earring",
- body="Acro Surcoat", hands=gear.ws_ValorHands, ring1="Ramuh Ring +1", ring2="Begrudging Ring",
- back="Ground. Mantle +1", waist="Fotia Belt", legs=gear.ws_ValorLegs, feet="Acro Leggings"}
- sets.precast.WS['Chant du Cygne'].Acc = set_combine(sets.precast.WS['Chant du Cygne'].Normal,
- {ear1="Zwazo Earring +1",})
- sets.precast.WS['Atonement'] = {ammo="Amar Cluster",
- head="Yorium Barbuta", neck="Fotia Gorget", ear1="Ishvara Earring", ear2="Moonshade Earring",
- body="Phorcys Korazin", hands=gear.ws_ValorHands, ring1="Pernicious Ring", ring2="Supershear Ring",
- back="Weard Mantle", waist="Fotia Belt", legs="Acro Breeches", feet="Acro Leggings"}
- sets.precast.WS['Atonement'].Acc = set_combine(sets.precast.WS['Atonement'].Normal, {})
- sets.precast.WS['Herculean Slash'] = sets.precast.WS['Atonement']
- sets.precast.WS['Herculean Slash'].Acc = sets.precast.WS['Atonement']
- sets.precast.WS['Sanguine Blade'] = set_combine(sets.precast.WS['Atonement'], {ring1="Archon Ring"})
- sets.precast.WS['Sanguine Blade'].Acc = set_combine(sets.precast.WS['Sanguine Blade'].Normal, {})
- --------------------------------------
- -- Midcast sets
- --------------------------------------
- sets.midcast.FastRecast = {}
- sets.midcast['Enhancing Magic'] = {neck="Colossus's torque", ear1="Andoaa Earring",
- back="Merciful Cape", waist="Olympus Sash", legs="Rev. Breeches +1"}
- sets.midcast['Divine Magic'] = {head="Jumalik Helm", neck="Nesanica torque", ear1="Beatific Earring",
- body="Rev. Surcoat +1", hands="Eschite Gauntlets", ring1="Globidonta Ring",
- back="Altruistic Cape", waist="Asklepian Belt",}
- sets.midcast['Phalanx'] = set_combine(sets.midcast['Enhancing Magic'], {back="Weard Mantle",ring1="Pernicious ring", ring2="Supershear Ring",})
- sets.midcast['Stoneskin'] = {waist="Siegel Sash"}
- sets.midcast.Cure = set_combine(sets.enmity, {neck="Colossus's Torque", ear1="Nourish. Earring",
- body="Jumalik Mail", hands="Buremte Gloves", ring1="Pernicious ring", ring2="Supershear Ring",
- back="Fierabras's Mantle", waist="Asklepian Belt", feet="Odyssean Greaves",})
- sets.midcast['Flash'] = {ammo="Amar Cluster",
- head="Cizin Helm +1", neck="Warder's Charm +1", ear1="Trux Earring", ear2="Cryptic Earring",
- body="Odyss. Chestplate", hands="Yorium Gauntlets", ring1="Pernicious ring", ring2="Supershear Ring",
- back="Reiki Cloak", waist="Goading Belt", legs="Rev. Breeches +1", feet="Chev. Sabatons +1"}
- sets.midcast['Blue Magic'] = {ammo="Amar Cluster",
- head="Cizin Helm +1", neck="Warder's Charm +1", ear1="Trux Earring", ear2="Cryptic Earring",
- body="Odyss. Chestplate", hands="Yorium Gauntlets", ring1="Pernicious ring", ring2="Supershear Ring",
- back="Reiki Cloak", waist="Goading Belt", legs="Rev. Breeches +1", feet="Chev. Sabatons +1"}
- sets.midcast['Reprisal'] = {ammo="Vanir Battery",
- head="Chev. Armet +1", neck="Sanctity Necklace", ear1="Cryptic Earring", ear2="Enchntr. Earring +1",
- body="Odyss. Chestplate", hands="Cab. Gauntlets +1", ring1="K'ayres Ring", ring2="Supershear Ring",
- back="Reiki Cloak", waist="Asklepian Belt", legs="Eschite Cuisses", feet="Amm Greaves",}
- sets.midcast['Crusade'] = sets.midcast['Flash']
- sets.midcast['Flash'].Interupt = set_combine(sets.midcast['Flash'],
- {ammo="Impatiens",
- head="Eschite Helm", ear2="Knightly Earring",
- hands="Eschite Gauntlets",
- waist="Rumination Sash", legs="Founder's Hose", feet="Odyssean Greaves",})
- sets.midcast['Enhancing Magic'].Interupt = set_combine(sets.midcast['Enhancing Magic'],
- {ammo="Impatiens",
- head="Eschite Helm", ear2="Knightly Earring",
- hands="Eschite Gauntlets",
- waist="Rumination Sash", legs="Founder's Hose", feet="Odyssean Greaves",})
- sets.midcast['Divine Magic'].Interupt = set_combine(sets.midcast['Divine Magic'],
- {ammo="Impatiens",
- head="Eschite Helm", ear2="Knightly Earring",
- hands="Eschite Gauntlets",
- waist="Rumination Sash", legs="Founder's Hose", feet="Odyssean Greaves",})
- sets.midcast['Phalanx'].Interupt = set_combine(sets.midcast['Enhancing Magic'],
- {ammo="Impatiens",
- head="Eschite Helm", ear2="Knightly Earring",
- hands="Eschite Gauntlets",
- waist="Rumination Sash", legs="Founder's Hose", feet="Odyssean Greaves",})
- sets.midcast['Crusade'].Interupt = set_combine(sets.midcast['Crusade'],
- {ammo="Impatiens",
- head="Eschite Helm", ear2="Knightly Earring",
- hands="Eschite Gauntlets",
- waist="Rumination Sash", legs="Founder's Hose", feet="Odyssean Greaves",})
- sets.midcast['Reprisal'].Interupt = set_combine(sets.midcast['Reprisal'],
- {ammo="Impatiens",
- head="Eschite Helm", ear2="Knightly Earring",
- hands="Eschite Gauntlets",
- waist="Rumination Sash", legs="Founder's Hose", feet="Odyssean Greaves",})
- sets.midcast['Blue Magic'].Interupt = set_combine(sets.midcast['Blue Magic'],
- {ammo="Impatiens",
- head="Eschite Helm", ear2="Knightly Earring",
- hands="Eschite Gauntlets",
- waist="Rumination Sash", legs="Founder's Hose", feet="Odyssean Greaves",})
- sets.midcast.Cure.Interupt = set_combine(sets.midcast.Cure,
- {ammo="Impatiens",
- head="Eschite Helm", ear2="Knightly Earring",
- hands="Eschite Gauntlets",
- waist="Rumination Sash", legs="Founder's Hose", feet="Odyssean Greaves",})
- --------------------------------------
- -- Idle/resting/defense/etc sets
- --------------------------------------
- sets.idle = {ammo="Vanir Battery",
- head="Baghere Salade", neck="Sanctity Necklace", ear1="Genmei earring", ear2="Etiolation earring",
- body="Ares' Cuirass +1", hands="Founder's Gauntlets", ring1="Sheltered Ring", ring2="Paguroidea ring",
- back="Reiki Cloak", waist="Fucho-no-Obi", legs="Blood Cuisses", feet="Amm Greaves"}
- sets.idle.Refresh = set_combine(sets.idle, {neck="Coatl Gorget +1", waist="Fucho-no-obi"})
- sets.idle.DT = {ammo="Hasty Pinion +1",
- head="Loess Barbuta +1", neck="Twilight Torque", ear1="Genmei Earring", ear2="Telos Earring",
- body="Rev. Surcoat +1", hands="Odyssean Gauntlets", ring1="Defending Ring", ring2={ name="Dark Ring", augments={'Enemy crit. hit rate -2','Magic dmg. taken -3%','Phys. dmg. taken -6%',}},
- back="Shadow Mantle", waist="Flume Belt", legs="Rev. Breeches +1", feet="Amm Greaves"}
- sets.defense.PDT = {ammo="Hasty Pinion +1",
- head="Loess Barbuta +1", neck="Twilight Torque", ear1="Genmei Earring", ear2="Telos Earring",
- body="Rev. Surcoat +1", hands="Odyssean Gauntlets", ring1="Defending Ring", ring2={ name="Dark Ring", augments={'Enemy crit. hit rate -2','Magic dmg. taken -3%','Phys. dmg. taken -6%',}},
- back="Shadow Mantle", waist="Flume Belt", legs="Rev. Breeches +1", feet="Amm Greaves"}
- sets.defense.MDT = {ammo="Vanir Battery",
- head="Founder's Corona", neck="Warder's Charm +1", ear1="Sanare Earring", ear2="Etiolation Earring",
- body="Rev. Surcoat +1", hands="Umuthi Gloves", ring1="Defending Ring", ring2="Shadow Ring",
- back="Reiki Cloak", waist="Asklepian Belt", legs="Mes'yohi Slacks", feet="Odyssean Greaves",}
- sets.defense.BDT = {ammo="Vanir Battery",
- head="Loess Barbuta +1", neck="Twilight Torque", ear1="Zwazo Earring +1", ear2="Cryptic Earring",
- body="Rev. Surcoat +1", hands="Umuthi Gloves", ring1="Defending Ring", ring2="K'ayres Ring",
- back="Mollusca Mantle", waist="Asklepian Belt", legs="Scuff. Cosciales", feet="Amm Greaves",}
- sets.Kiting = {feet="Blood Cuisses"}
- --------------------------------------
- -- Engaged sets
- --------------------------------------
- sets.engaged = {ammo="Hasty Pinion +1",
- head=gear.tp_ValorHead, neck="Agitator's Collar", ear1="Digni. Earring", ear2="Telos Earring",
- body=gear.tp_ValorBody, hands="Odyssean Gauntlets", ring1="Supershear Ring", ring2="Patricius Ring",
- back="Grounded Mantle +1", waist="Kentarch Belt +1", legs="Eschite Cuisses", feet=gear.tp_ValorFeet}
- sets.engaged.Acc = {ammo="Hasty Pinion +1",
- head=gear.tp_ValorHead, neck="Combatant's Torque", ear1="Digni. Earring", ear2="Telos Earring",
- body=gear.tp_ValorBody, hands="Odyssean Gauntlets", ring1="Ramuh Ring +1", ring2="Ramuh Ring +1",
- back="Grounded Mantle +1", waist="Olseni Belt", legs="Odyssean Cuisses", feet=gear.tp_ValorFeet}
- sets.engaged.Hybrid = {ammo="Hasty Pinion +1",
- head="Ighwa Cap", neck="Agitator's Collar", ear1="Digni. Earring", ear2="Telos Earring",
- body="Rev. Surcoat +1", hands="Odyssean Gauntlets", ring1="Defending Ring", ring2="Patricius Ring",
- back="Weard Mantle", waist="Kentarch Belt +1", legs="Eschite Cuisses", feet="Amm Greaves"}
- sets.engaged.PDT = {ammo="Hasty Pinion +1",
- head="Loess Barbuta +1", neck="Twilight Torque", ear1="Genmei Earring", ear2="Telos Earring",
- body="Rev. Surcoat +1", hands="Odyssean Gauntlets", ring1="Defending Ring", ring2={ name="Dark Ring", augments={'Enemy crit. hit rate -2','Magic dmg. taken -3%','Phys. dmg. taken -6%',}},
- back="Shadow Mantle", waist="Flume Belt", legs="Rev. Breeches +1", feet="Amm Greaves"}
- sets.engaged.MDT = {ammo="Vanir Battery",
- head="Founder's Corona", neck="Warder's Charm +1", ear1="Sanare Earring", ear2="Etiolation Earring",
- body="Rev. Surcoat +1", hands="Umuthi Gloves", ring1="Defending Ring", ring2="Shadow Ring",
- back="Reiki Cloak", waist="Asklepian Belt", legs="Mes'yohi Slacks", feet="Amm Greaves",}
- sets.engaged.BDT = {ammo="Vanir Battery",
- head="Loess Barbuta +1", neck="Twilight Torque", ear1="Zwazo Earring +1", ear2="Cryptic Earring",
- body="Rev. Surcoat +1", hands="Leyline Gloves", ring1="Defending Ring", ring2="K'ayres Ring",
- back="Mollusca Mantle", waist="Asklepian Belt", legs="Scuff. Cosciales", feet="Amm Greaves",}
- sets.engaged.repulse = {}
- sets.engaged.Nixxer = {main="Nixxer"}
- sets.engaged.Reikiko = {main="Reikiko"}
- sets.engaged.Aegis = set_combine(meleeSet, {sub="Aegis"})
- sets.engaged.Ochain = set_combine(meleeSet, {sub="Ochain"})
- end
- ------------------------------------------------------------------
- -- Action events
- ------------------------------------------------------------------
- -- Run after the default midcast() is done.
- -- eventArgs is the same one used in job_midcast, in case information needs to be persisted.
- function job_post_midcast(spell, action, spellMap, eventArgs)
- if spell.english == 'Lunge' or spell.english == 'Swipe' then
- local obi = get_obi(get_rune_obi_element())
- if obi then
- equip({waist=obi})
- end
- end
- end
- function job_aftercast(spell)
- if not spell.interrupted then
- if spell.type == 'Rune' then
- update_timers(spell)
- elseif spell.name == "Lunge" or spell.name == "Gambit" or spell.name == 'Rayke' then
- reset_timers()
- elseif spell.name == "Swipe" then
- send_command(trim(1))
- end
- end
- end
- -------------------------------------------------------------------------------------------------------------------
- -- Customization hooks for idle and melee sets, after they've been automatically constructed.
- -------------------------------------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------------------
- -- General hooks for other events.
- -------------------------------------------------------------------------------------------------------------------
- function job_precast(spell)
- if info.RuneEnchantment:contains(spell.english) then
- equip(sets.enmity)
- end
- end
- -------------------------------------------------------------------------------------------------------------------
- -- User code that supplements self-commands.
- -------------------------------------------------------------------------------------------------------------------
- -------------------------------------------------------------------------------------------------------------------
- -- Utility functions specific to this job.
- -------------------------------------------------------------------------------------------------------------------
- -- Select default macro book on initial load or subjob change.
- function select_default_macro_book()
- -- Default macro set/book
- if player.sub_job == 'WAR' then
- set_macro_page(1, 6)
- elseif player.sub_job == 'NIN' then
- set_macro_page(2, 6)
- elseif player.sub_job == 'SAM' then
- set_macro_page(3, 6)
- elseif player.sub_job == 'BLU' then
- set_macro_page(4, 6)
- else
- set_macro_page(1, 6)
- end
- end
- function get_rune_obi_element()
- weather_rune = buffactive[elements.rune_of[world.weather_element] or '']
- day_rune = buffactive[elements.rune_of[world.day_element] or '']
- local found_rune_element
- if weather_rune and day_rune then
- if weather_rune > day_rune then
- found_rune_element = world.weather_element
- else
- found_rune_element = world.day_element
- end
- elseif weather_rune then
- found_rune_element = world.weather_element
- elseif day_rune then
- found_rune_element = world.day_element
- end
- return found_rune_element
- end
- function get_obi(element)
- if element and elements.obi_of[element] then
- return (player.inventory[elements.obi_of[element]] or player.wardrobe[elements.obi_of[element]]) and elements.obi_of[element]
- end
- end
- ------------------------------------------------------------------
- -- Timer manipulation
- ------------------------------------------------------------------
- -- Add a new run to the custom timers, and update index values for existing timers.
- function update_timers(spell)
- local expires_time = os.time() + 300
- local entry_index = rune_count(spell.name) + 1
- local entry = {rune=spell.name, index=entry_index, expires=expires_time}
- rune_timers:append(entry)
- local cmd_queue = create_timer(entry).. ';wait 0.05;'
- cmd_queue = cmd_queue .. trim()
- -- add_to_chat(123,'cmd_queue='..cmd_queue)
- send_command(cmd_queue)
- end
- -- Get the command string to create a custom timer for the provided entry.
- function create_timer(entry)
- local timer_name = '"Rune: ' .. entry.rune .. '-' .. tostring(entry.index) .. '"'
- local duration = entry.expires - os.time()
- return 'timers c ' .. timer_name .. ' ' .. tostring(duration) .. ' down'
- end
- -- Get the command string to delete a custom timer for the provided entry.
- function delete_timer(entry)
- local timer_name = '"Rune: ' .. entry.rune .. '-' .. tostring(entry.index) .. '"'
- return 'timers d ' .. timer_name .. ''
- end
- -- Reset all timers
- function reset_timers()
- local cmd_queue = ''
- for index,entry in pairs(rune_timers) do
- cmd_queue = cmd_queue .. delete_timer(entry) .. ';wait 0.05;'
- end
- rune_timers:clear()
- send_command(cmd_queue)
- end
- -- Get a count of the number of runes of a given type
- function rune_count(rune)
- local count = 0
- local current_time = os.time()
- for _,entry in pairs(rune_timers) do
- if entry.rune == rune and entry.expires > current_time then
- count = count + 1
- end
- end
- return count
- end
- -- Remove the oldest rune(s) from the table, until we're below the max_runes limit.
- -- If given a value n, remove n runes from the table.
- function trim(n)
- local cmd_queue = ''
- local to_remove = n or (rune_timers:length() - max_runes)
- while to_remove > 0 and rune_timers:length() > 0 do
- local oldest
- for index,entry in pairs(rune_timers) do
- if oldest == nil or entry.expires < rune_timers[oldest].expires then
- oldest = index
- end
- end
- cmd_queue = cmd_queue .. prune(rune_timers[oldest].rune)
- to_remove = to_remove - 1
- end
- return cmd_queue
- end
- -- Drop the index of all runes of a given type.
- -- If the index drops to 0, it is removed from the table.
- function prune(rune)
- local cmd_queue = ''
- for index,entry in pairs(rune_timers) do
- if entry.rune == rune then
- cmd_queue = cmd_queue .. delete_timer(entry) .. ';wait 0.05;'
- entry.index = entry.index - 1
- end
- end
- for index,entry in pairs(rune_timers) do
- if entry.rune == rune then
- if entry.index == 0 then
- rune_timers[index] = nil
- else
- cmd_queue = cmd_queue .. create_timer(entry) .. ';wait 0.05;'
- end
- end
- end
- return cmd_queue
- end
- ------------------------------------------------------------------
- -- Reset events
- ------------------------------------------------------------------
- windower.raw_register_event('zone change',reset_timers)
- windower.raw_register_event('logout',reset_timers)
- windower.raw_register_event('status change',function(new, old)
- if gearswap.res.statuses[new].english == 'Dead' then
- reset_timers()
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement