Advertisement
Quixacotl

[LUA] FFXI RUN LUA version 2

Jan 31st, 2015
740
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.23 KB | None | 0 0
  1. --[[
  2.  
  3.     Written 01/15/2015 by Quixacotl. Credit to Motenten for some elements used here.
  4.  
  5.     You have several options to choose from for switching Modes: Hotkeys, Cycle and Shortcuts.
  6.  
  7.     HotKeys:
  8.         F9 - Cycles through 5 different mode groups: Town, DD, Accuracy, Physical Defense, and Magic Defense.
  9.         F10 - Turns on PDT mode.
  10.         F11 - Turns on MDT mode.
  11.         F12 - Toggles Repulse Mantle on/off.
  12.         Delete = Hitting the delete button Resets everything back to default.
  13.  
  14.     Custom Commands:
  15.         //gs c cycle in chatlog or /console gs c cycle for macros.
  16.         Useage: Cycles through 5 different mode groups:
  17.         Town, DD, DD Accuracy, Physical Defense, and Magic Defense.
  18.  
  19.     Shortcut Commands (allows you to jump straight to any mode):
  20.         //gs c town
  21.         //gs c dd
  22.         //gs c acc
  23.         //gs c pdt
  24.         //gs c mdt
  25.  
  26.     Gearswap Commands you should know:
  27.         //lua load gearswap
  28.         //lua unload gearswap
  29.         //gs reload - (useful when editing these scripts while in-game)
  30.  
  31. --]]
  32.  
  33.     send_command('bind f9 gs c cycle')
  34.     send_command('bind f10 gs c pdt')
  35.     send_command('bind f11 gs c mdt')
  36.     send_command('bind f12 gs c repulse')
  37.     send_command('bind delete gs reload')
  38.  
  39. -- Called when this job file is unloaded (eg: job change)
  40. function user_unload()
  41.     send_command('unbind f9')
  42.     send_command('unbind f10')
  43.     send_command('unbind f11')
  44.     send_command('unbind f12')
  45.     send_command('unbind delete')
  46. end
  47.  
  48. function get_sets()
  49.     ----------------------------------------------------------------
  50.     -- Gear that needs to be equipped for the duration of a buff. --
  51.     ----------------------------------------------------------------
  52.     sets.buff = {}
  53.     sets.buff['Swordplay'] = {hands="Futhark Mitons +1"}
  54.  
  55.     --------------------------------------------
  56.     -- City areas for town gear and behavior. --
  57.     --------------------------------------------
  58.     areas = {}
  59.     areas.Cities = S{
  60.         "Eastern Adoulin", "Western Adoulin",
  61.         "Ru'Lude Gardens", "Upper Jeuno", "Lower Jeuno", "Port Jeuno",
  62.         "Port Windurst", "Windurst Waters", "Windurst Woods",
  63.         "Windurst Walls", "Heavens Tower",
  64.         "Port San d'Oria", "Northern San d'Oria", "Southern San d'Oria",
  65.         "Port Bastok", "Bastok Markets",
  66.         "Bastok Mines", "Metalworks",
  67.         "Aht Urhgan Whitegate", "Tavanazian Safehold",
  68.         "Nashmau", "Selbina",
  69.         "Mhaura", "Norg", "Kazham"}
  70.  
  71.     ----------------------
  72.     -- Weaponskill sets --
  73.     ----------------------
  74.     sets.WS ={ammo="Potestas Bomblet",
  75.         head="Highwing Helm", neck="Asperity Necklace",
  76.         ear1="Brutal Earring", ear2="Moonshade Earring",
  77.         body="Dread Jupon", hands="Nomkah. Mittens +1",
  78.         ring1="Ifrit Ring +1", ring2="Epona's Ring",
  79.         back="Buquwik Cape", waist="Caudata Belt",
  80.         legs="Quiahuiz Trousers", feet="Qaaxo Leggings"}
  81.  
  82.     sets.WS['Dimidiation'] = set_combine(sets.WS,{
  83.         ammo="Potestas Bomblet",
  84.         head="Highwing Helm", neck="Light Gorget",
  85.         ear1="Brutal Earring", ear2="Moonshade Earring",
  86.         body="Dread Jupon", hands="Nomkah. Mittens +1",
  87.         ring1="Ramuh Ring +1", ring2="Epona's Ring",
  88.         back="Vespid Mantle", waist="Windbuffet Belt +1",
  89.         legs="Quiahuiz Trousers", feet="Qaaxo Leggings"})
  90.  
  91.     sets.WS['Resolution'] = set_combine(sets.WS,{
  92.         ammo="Potestas Bomblet",
  93.         head="Highwing Helm", neck="Thunder Gorget",
  94.         ear1="Brutal Earring", ear2="Moonshade Earring",
  95.         body="Dread Jupon", hands="Nomkah. Mittens +1",
  96.         ring1="Ifrit Ring +1", ring2="Epona's Ring",
  97.         back="Buquwik Cape", waist="Thunder Belt",
  98.         legs="Quiahuiz Trousers", feet="Qaaxo Leggings"})
  99.  
  100.     sets.WS['Requiescat'] = set_combine(sets.WS,{
  101.         neck="Soil Gorget"})
  102.  
  103.     sets.WS['Vorpal Blade'] = set_combine(sets.WS, {
  104.         neck="Soil Gorget"})
  105.  
  106.     sets.Enmity = {neck="Invidia Torque",
  107.         ear1="Pluto's Pearl", ear2="Friomisi Earring",
  108.         hands="Futhark Mitons +1",
  109.         ring1="Odium Ring", ring2="Vexer Ring +1",
  110.         back="Fravashi Mantle"}
  111.  
  112.     ------------------
  113.     -- Precast Sets --
  114.     ------------------
  115.     sets.precast = {}
  116.     sets.precast.FastCast = {ammo="Impatiens",
  117.         head="Rune. Bandeau +1", neck="Twilight Torque",
  118.         ear1="Loquac. Earring",
  119.         body="Dread Jupon", hands="Thaumas Gloves",
  120.         ring1="Defending Ring", ring1="Prolix Ring",
  121.         back="Mollusca Mantle", waist="Goading Belt",
  122.         legs="Orvail Pants +1", feet="Chelona Boots"}
  123.  
  124.     sets.precast.Waltz = {}
  125.     sets.precast.Step = {ear1="Choreia Earring"}
  126.  
  127.  
  128.     ------------------
  129.     -- Midcast Sets --
  130.     ------------------
  131.     sets.midcast = {}
  132.     sets.midcast.FastRecast = {ammo="Impatiens",
  133.         head="Rune. Bandeau +1", neck="Twilight Torque",
  134.         ear1="Loquac. Earring",
  135.         body="Vanir Cotehardie", hands="Thaumas Gloves",
  136.         ring1="Defending Ring", ring1="Prolix Ring",
  137.         back="Mollusca Mantle", waist="Goading Belt",
  138.         legs="Orvail Pants +1", feet="Chelona Boots"}
  139.  
  140.     sets.midcast['Enhancing Magic'] = set_combine(sets.midcast.FastRecast, {
  141.         head="Rune. Bandeau +1", neck="Twilight Torque",
  142.         body="Futhark Coat +1", hands="Runeist Mitons +1",
  143.         back="Mollusca Mantle", waist="Siegel Sash",
  144.         legs="Futhark Trousers +1"})
  145.  
  146.     sets.midcast['Divine Magic'] = set_combine(sets.midcast.FastRecast, {
  147.         legs="Rune. Trousers +1"})
  148.  
  149.     sets.midcast.Regen = set_combine(sets.midcast['Enhancing Magic'], {
  150.         head="Rune. Bandeau +1", neck="Twilight Torque",
  151.         body="Futhark Coat +1", hands="Runeist Mitons +1",
  152.         back="Mollusca Mantle", legs="Futhark Trousers +1"})
  153.  
  154.     sets.midcast.Phalanx = set_combine(sets.midcast['Enhancing Magic'], {
  155.         head="Rune. Bandeau +1", neck="Twilight Torque",
  156.         body="Futhark Coat +1", hands="Runeist Mitons +1",
  157.         back="Mollusca Mantle", legs="Futhark Trousers +1"})
  158.  
  159.     --------------------
  160.     -- AfterCast Sets --
  161.     --------------------
  162.  
  163.     -----------------
  164.     -- Status Sets --
  165.     -----------------
  166.     sets.Resting = {neck="Wiglen Gorget",
  167.         ear1="Ethereal Earring", ear2="Phawaylla Earring",
  168.         ring1="Sheltered Ring", ring2="Paguroidea Ring",
  169.         body="Runeist Coat +1", feet="Chelona Boots"}
  170.  
  171.     ---------------
  172.     -- Idle Sets --
  173.     ---------------
  174.  
  175.     Idle_Set_Names = {"Town","DD","DD Accuracy","Physical Defense","Magic Defense"}
  176.  
  177.     sets.Idle = {ammo="Vanir Battery",
  178.         head=empty, neck="Wiglen Gorget",
  179.         ear1="Bladeborn Earring", ear2="Steelflash Earring",
  180.         body="Respite Cloak", hands="Futhark Mitons +1",
  181.         ring1="Sheltered Ring", ring2="Paguroidea Ring",
  182.         back="Evasionist's Cape", waist="Windbuffet Belt +1",
  183.         legs="Crimson Cuisses", feet="Futhark Boots +1"}
  184.  
  185.     sets.Idle.Town = {main="Epeolatry",
  186.         sub="Bloodrain Strap", ammo="Vanir Battery",
  187.         head=empty, neck="Wiglen Gorget",
  188.         ear1="Bladeborn Earring", ear2="Steelflash Earring",
  189.         body="Respite Cloak", hands="Futhark Mitons +1",
  190.         ring1="Sheltered Ring", ring2="Paguroidea Ring",
  191.         back="Evasionist's Cape", waist="Windbuffet Belt +1",
  192.         legs="Crimson Cuisses", feet="Futhark Boots +1"}
  193.  
  194.     sets.Idle.DD = {ammo="Vanir Battery",
  195.         head=empty, neck="Wiglen Gorget",
  196.         ear1="Bladeborn Earring", ear2="Steelflash Earring",
  197.         body="Respite Cloak", hands="Buremte Gloves",
  198.         ring1="Sheltered Ring", ring2="Paguroidea Ring",
  199.         back="Atheling Mantle", waist="Windbuffet Belt +1",
  200.         legs="Crimson Cuisses", feet="Futhark Boots +1"}
  201.  
  202.     sets.Idle['DD Accuracy'] = {ammo="Vanir Battery",
  203.         head=empty, neck="Wiglen Gorget",
  204.         ear1="Bladeborn Earring", ear2="Steelflash Earring",
  205.         body="Respite Cloak", hands="Buremte Gloves",
  206.         ring1="Sheltered Ring", ring2="Paguroidea Ring",
  207.         back="Atheling Mantle", waist="Hurch'lan Sash",
  208.         legs="Crimson Cuisses", feet="Futhark Boots +1"}
  209.  
  210.     sets.Idle['Physical Defense'] = {
  211.         ammo="Vanir Battery", head="Fu. Bandeau +1",
  212.         ear1="Ethereal Earring", ear2="Hibern. Earring",
  213.         neck="Twilight Torque",
  214.         body="Futhark Coat +1", hands="Umuthi Gloves",
  215.         ring1="Defending Ring", ring2="Vocane Ring",
  216.         back="Shadow Mantle", waist="Flume Belt +1",
  217.         legs="Rune. Trousers +1", feet="Futhark Boots +1"}
  218.  
  219.     -- ShellV, Defending Ring and Mollusca is enough to cap MDT for Rune Fencer. --
  220.  
  221.     sets.Idle['Magic Defense'] = {
  222.         ammo="Vanir Battery", head="Fu. Bandeau +1",
  223.         ear1="Ethereal Earring", ear2="Hearty Earring",
  224.         neck="Twilight Torque",
  225.         body="Futhark Coat +1", hands="Umuthi Gloves",
  226.         ring1="Defending Ring", ring2="Vocane Ring",
  227.         back="Engulfer Cape +1", waist="Hurch'lan Sash",
  228.         legs="Rune. Trousers +1", feet="Futhark Boots +1"}
  229.  
  230.     ------------------
  231.     -- Engaged Sets --
  232.     ------------------
  233.  
  234.     TP_Set_Names = {"Town","DD","DD Accuracy","Physical Defense","Magic Defense"}
  235.  
  236.     sets.TP = {}
  237.     sets.TP.Town = set_combine(sets.Idle.Town, {
  238.         head="Whirlpool Mask", neck="Asperity Necklace",
  239.         ear1="Bladeborn Earring", ear2="Steelflash Earring",
  240.         body="Qaaxo Harness",
  241.         ring1="Rajas Ring", ring2="Epona's Ring",
  242.         back="Evasionist's Cape", waist="Windbuffet Belt +1",
  243.         legs="Qaaxo Tights"})
  244.  
  245.     sets.TP.DD = set_combine(sets.Idle.DD, {
  246.         head="Whirlpool Mask", neck="Asperity Necklace",
  247.         ear1="Bladeborn Earring", ear2="Steelflash Earring",
  248.         body="Qaaxo Harness",
  249.         ring1="Rajas Ring", ring2="Epona's Ring",
  250.         back="Atheling Mantle", waist="Windbuffet Belt +1",
  251.         legs="Qaaxo Tights"})
  252.  
  253.     sets.TP['DD Accuracy'] = set_combine(sets.Idle['DD Accuracy'], {
  254.         head="Whirlpool Mask", neck="Asperity Necklace",
  255.         ear1="Bladeborn Earring", ear2="Steelflash Earring",
  256.         body="Qaaxo Harness",
  257.         ring1="Rajas Ring", ring2="K'ayres Ring",
  258.         back="Atheling Mantle", waist="Hurch'lan Sash",
  259.         legs="Qaaxo Tights"})
  260.  
  261.     sets.TP['Physical Defense'] = set_combine(sets.Idle['Physical Defense'], {
  262.         ammo="Vanir Battery",
  263.         head="Fu. Bandeau +1", neck="Twilight Torque",
  264.         ear1="Ethereal Earring", ear2="Hibern. Earring",
  265.         body="Futhark Coat +1", hands="Umuthi Gloves",
  266.         ring1="Defending Ring", ring2="Vocane Ring",
  267.         back="Shadow Mantle", waist="Flume Belt +1",
  268.         legs="Rune. Trousers +1", feet="Futhark Boots +1"})
  269.  
  270.     sets.TP['Magic Defense'] = set_combine(sets.Idle['Magic Defense'], {
  271.         ammo="Vanir Battery",
  272.         head="Fu. Bandeau +1", neck="Twilight Torque",
  273.         ear1="Ethereal Earring", ear2="Hearty Earring",
  274.         body="Futhark Coat +1", hands="Umuthi Gloves",
  275.         ring1="Defending Ring", ring2="Vocane Ring",
  276.         -- back="Engulfer Cape +1",
  277.         back="Mollusca Mantle",
  278.         waist="Hurch'lan Sash",
  279.         legs="Rune. Trousers +1", feet="Futhark Boots +1"})
  280.  
  281.  
  282.     -------------
  283.     -- JA Sets --
  284.     -------------
  285.     sets.JA = {}
  286.     sets.JA['Lunge'] = set_combine(sets.Enmity,{ammo="Dosis Tathlum",
  287.         head="Highwing Helm", neck="Eddy Necklace",
  288.         ear1="Crematio Earring", ear2="Friomisi earring",
  289.         body="Iuitl Vest +1", hands="Spolia Cuffs",
  290.         back="Evasionist's cape",
  291.         legs="Shned. Tights +1", feet="Qaaxo Leggings"})
  292.  
  293.     sets.JA['Swipe'] = sets.JA['Lunge']
  294.  
  295.     sets.JA['Pflug'] = set_combine(sets.Enmity, {
  296.         hands="Runeist Mitons +1", feet="Runeist Bottes +1"})
  297.     sets.JA['Elemental Sforzo'] = {body="Futhark Coat +1"}
  298.     sets.JA['Battuta'] = set_combine(sets.Enmity, {head="Fu. Bandeau +1"})
  299.     sets.JA['Vallation'] = set_combine(sets.Enmity, {
  300.         body="Runeist Coat +1",legs="Futhark Trousers +1"})
  301.     sets.JA['Valiance'] = set_combine(sets.Enmity, {
  302.         body="Runeist Coat +1",legs="Futhark Trousers +1"})
  303.     sets.JA['Gambit'] = set_combine(sets.Enmity, {hands="Runeist Mitons +1"})
  304.  
  305.     sets.JA['Swordplay'] = set_combine(sets.Enmity,
  306.         {hands="Futhark Mitons +1"})
  307.  
  308.     sets.JA['Rayke'] = set_combine(sets.Enmity, {feet="Runeist Bottes +1"})
  309.     sets.JA['Liement'] = set_combine(sets.Enmity, {body="Futhark Coat +1"})
  310.     sets.JA['Embolden'] = sets.Enmity
  311.     sets.JA['One For All'] = sets.Enmity
  312.  
  313.     sets.JA['Provoke'] = sets.Enmity
  314.     sets.JA['Warcry'] = sets.Enmity
  315.     sets.JA['Animated Flourish'] = sets.Enmity
  316.  
  317.     -- Flourish --
  318.     sets.Flourish = {}
  319.  
  320.     sets.Repulse = {back="Repulse Mantle"}
  321.  
  322.     -----------------------------------
  323.     -- Variables and notes to myself --
  324.     -----------------------------------
  325.     -- Rune elements --
  326.     elements = {}
  327.     elements.runes = {['Fire']='Ignis', ['Ice']='Gelus', ['Wind']='Flabra',
  328.         ['Earth']='Tellus', ['Lightning']='Sulpor', ['Water']='Unda',
  329.         ['Light']='Lux', ['Dark']='Tenebrae'}
  330.  
  331.     -- Element Obi definitions for Lunge and Swipe --
  332.     elements.obi = {}
  333.     elements.obi['Fire'] = {waist="Karin Obi"}
  334.     elements.obi['Ice'] = {waist="Hyorin Obi"}
  335.     elements.obi['Wind'] = {waist="Furin Obi"}
  336.     elements.obi['Earth'] = {waist="Dorin Obi"}
  337.     elements.obi['Lightning'] = {waist="Rairin Obi"}
  338.     elements.obi['Water'] = {waist="Suirin Obi"}
  339.     elements.obi['Light'] = {waist="Korin Obi"}
  340.     elements.obi['Dark'] = {waist="Anrin Obi"}
  341.  
  342.     Mode_Index = 1
  343.     Repulse = 'false'
  344.  
  345.     send_command('input /macro book 3;wait .1;input /macro set 2')
  346. end
  347.  
  348. function precast(spell,action)
  349.     if spell.action_type == 'Magic' then
  350.         equip(sets.precast.FastCast)
  351.     elseif sets.WS[spell.name] then
  352.         equip(sets.WS[spell.name])
  353.     elseif spell.type=="JobAbility" then
  354.         if sets.JA[spell.name] then
  355.             equip(sets.JA[spell.name])
  356.         end
  357.         if spell.name == 'Lunge' or spell.name == 'Swipe' then
  358.             update_obi()
  359.         end
  360.     elseif spell.type=="WeaponSkill" then
  361.         equip(sets.WS)
  362.     elseif spell.name:contains('Waltz') then
  363.         equip(sets.precast.Waltz)
  364.     elseif spell.name:contains('Step') then
  365.         equip(sets.precast.Step)
  366.     end
  367. end
  368.  
  369. function midcast(spell,action)
  370.     if sets.midcast[spell.name] and not spell.interrupted then
  371.         equip(sets.midcast[spell.name])
  372.     elseif spell.name:startswith('Regen') and not spell.interrupted then
  373.         equip(sets.midcast.Regen)
  374.     elseif spell.name:startswith('Phalanx') and not spell.interrupted then
  375.         equip(sets.midcast.Phalanx)
  376.     elseif spell.name == 'Flash' then
  377.         equip(sets.Enmity)
  378.     elseif spell.name == 'Sneak' or spell.name == 'Spectral Jig' or spell.name:startswith('Monomi') and spell.target.type == 'SELF' then
  379.         send_command('cancel 71')
  380.     elseif sets.midcast[spell.skill] then
  381.         equip(sets.midcast[spell.skill])
  382.     end
  383. end
  384.  
  385. function aftercast(spell,action)
  386.     update_gear()
  387. end
  388.  
  389. function status_change(new,action)
  390.     update_gear()
  391. end
  392.  
  393. -- Called when a player gains or loses a buff. --
  394. function buff_change(buff,gain)
  395.     if buff == "Swordplay" then update_gear() end
  396. end
  397.  
  398. function self_command(command)
  399.     if command:lower() == 'cycle' then
  400.         Mode_Index = Mode_Index +1
  401.         if Mode_Index > #Idle_Set_Names then
  402.             Mode_Index = 1
  403.         end
  404.         add_to_chat(8,'----- Gear Mode changed to '..Idle_Set_Names[Mode_Index]..' -----')
  405.         update_gear()
  406.     elseif command:lower() == 'mdt' then
  407.         Mode_Index = 5
  408.         add_to_chat(8,'----- Gear Mode changed to '..Idle_Set_Names[Mode_Index]..' -----')
  409.         update_gear()
  410.     elseif command:lower() == 'pdt' then
  411.         Mode_Index = 4
  412.         add_to_chat(8,'----- Gear Mode changed to '..Idle_Set_Names[Mode_Index]..' -----')
  413.         update_gear()
  414.     elseif command:lower() == 'acc' then
  415.         Mode_Index = 3
  416.         add_to_chat(8,'----- Gear Mode changed to '..Idle_Set_Names[Mode_Index]..' -----')
  417.         update_gear()
  418.     elseif command:lower() == 'dd' then
  419.         Mode_Index = 2
  420.         add_to_chat(8,'----- Gear Mode changed to '..Idle_Set_Names[Mode_Index]..' -----')
  421.         update_gear()
  422.     elseif command:lower() == 'town' then
  423.         Mode_Index = 1
  424.         add_to_chat(8,'----- Gear Mode changed to '..Idle_Set_Names[Mode_Index]..' -----')
  425.         update_gear()
  426.     elseif command:lower() == 'repulse' then
  427.         if Repulse == 'false' then
  428.             Repulse = 'true'
  429.             add_to_chat(8,'----- Changed to Repulse Mantle -----')
  430.         elseif Repulse == 'true' then
  431.             Repulse = 'false'
  432.         end
  433.         update_gear()
  434.     end
  435. end
  436.  
  437. function update_gear()
  438.     if player.status == 'Engaged' then
  439.         equip(sets.TP[TP_Set_Names[Mode_Index]])
  440.     elseif player.status == 'Idle' then
  441.         if areas.Cities:contains(world.area) then
  442.             add_to_chat(8,'----- You are at '..world.area..'. Town gear equipped! -----')
  443.             add_to_chat(8,'----- Hotkeys: F9 cycle, F10 PDT, F11 MDT, F12 Repulse, Delete Reset. -----')
  444.             equip(sets.Idle.Town)
  445.         else
  446.             send_command('input /lockstyle on')
  447.             equip(sets.Idle[Idle_Set_Names[Mode_Index]])
  448.         end
  449.     else
  450.         equip(sets.Resting)
  451.     end
  452.  
  453.     if buffactive['Swordplay'] then equip(sets.buff['Swordplay']) end
  454.     if Repulse == 'true' then equip(sets.Repulse) end
  455. end
  456.  
  457. function update_obi()
  458.     if buffactive['Ignis'] then
  459.         equip(elements.obi['Fire'])
  460.     elseif buffactive['Gelus'] then
  461.         equip(elements.obi['Ice'])
  462.     elseif buffactive['Flabra'] then
  463.         equip(elements.obi['Wind'])
  464.     elseif buffactive['Tellus'] then
  465.         equip(elements.obi['Earth'])
  466.     elseif buffactive['Sulpor'] then
  467.         equip(elements.obi['Lightning'])
  468.     elseif buffactive['Lux'] then
  469.         equip(elements.obi['Light'])
  470.     elseif buffactive['Tenebrae'] then
  471.         equip(elements.obi['Dark'])
  472.     end
  473. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement