Advertisement
Quixacotl

[LUA] FFXI RUN LUA

Aug 24th, 2014
2,404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 14.12 KB | None | 0 0
  1. --[[
  2.     Written 08/26/2014 by Quixacotl.
  3.  
  4.     Custom Commands:
  5.         //gs c cycle in chatlog or /console gs c cycle for macros.
  6.         Useage: cycles through 5 different mode groups:
  7.         Normal, Fodder, DD Accuracy, Physical Defense, and Magic Defense.
  8.  
  9.     Shortcut Commands (jump straight to any mode):
  10.         //gs c normal
  11.         //gs c fodder
  12.         //gs c acc
  13.         //gs c pdt
  14.         //gs c mdt
  15. --]]
  16.  
  17. function get_sets()
  18.     ----------------------------------------------------------------
  19.     -- Gear that needs to be equipped for the duration of a buff. --
  20.     ----------------------------------------------------------------
  21.     sets.buff = {}
  22.     sets.buff['Swordplay'] = {hands="Futhark Mitons +1"}
  23.  
  24.     --------------------------------------------
  25.     -- City areas for town gear and behavior. --
  26.     --------------------------------------------
  27.     areas = {}
  28.     areas.Cities = S{
  29.         "Eastern Adoulin", "Western Adoulin",
  30.         "Ru'Lude Gardens", "Upper Jeuno", "Lower Jeuno", "Port Jeuno",
  31.         "Port Windurst", "Windurst Waters", "Windurst Woods",
  32.         "Windurst Walls", "Heavens Tower",
  33.         "Port San d'Oria", "Northern San d'Oria", "Southern San d'Oria",
  34.         "Port Bastok", "Bastok Markets",
  35.         "Bastok Mines", "Metalworks",
  36.         "Aht Urhgan Whitegate", "Tavanazian Safehold",
  37.         "Nashmau", "Selbina",
  38.         "Mhaura", "Norg", "Kazham"}
  39.  
  40.     ----------------------
  41.     -- Weaponskill sets --
  42.     ----------------------
  43.     sets.WS ={ammo="Ginsen",
  44.         head="Whirlpool Mask", neck="Asperity Necklace",
  45.         ear1="Brutal Earring", ear2="Moonshade Earring",
  46.         body="Dread Jupon", hands="Futhark Mitons +1",
  47.         ring1="Rajas Ring", ring2="Epona's Ring",
  48.         back="Atheling Mantle", waist="Windbuffet Belt +1",
  49.         legs="Quiahuiz Trousers", feet="Manibozho Boots"}
  50.  
  51.     sets.WS['Dimidiation'] = set_combine(sets.WS,{
  52.         neck="Light Gorget",
  53.         ring1="Rajas Ring", ring2="Ramuh Ring",
  54.         feet="Futhark Boots +1"})
  55.  
  56.     sets.WS['Resolution'] = set_combine(sets.WS,{neck="Soil Gorget"})
  57.  
  58.     sets.WS['Requiescat'] = set_combine(sets.WS,{neck="Soil Gorget",
  59.         ring1="Aquasoul Ring", ring2="Epona's Ring"})
  60.  
  61.     sets.WS['Vorpal Blade'] = set_combine(sets.WS, {neck="Soil Gorget"})
  62.  
  63.     sets.Enmity = {neck="Invidia Torque",
  64.         ear1="Pluto's Pearl", ear2="Friomisi Earring",
  65.         hands="Futhark Mitons +1", back="Fravashi Mantle",
  66.         ring1="Odium Ring", ring2="Vexer Ring +1"}
  67.  
  68.     ------------------
  69.     -- Precast Sets --
  70.     ------------------
  71.     sets.precast = {}
  72.     sets.precast.FastCast = {ammo="Impatiens",
  73.         head="Rune. Bandeau +1", neck="Twilight Torque",
  74.         ear1="Loquac. Earring",
  75.         body="Vanir Cotehardie", hands="Thaumas Gloves",
  76.         ring1="Defending Ring", ring1="Prolix Ring",
  77.         back="Mollusca Mantle", waist="Goading Belt",
  78.         legs="Orvail Pants +1", feet="Chelona Boots"}
  79.  
  80.     sets.precast.Waltz = {}
  81.     sets.precast.Step = {ear1="Choreia Earring"}
  82.  
  83.  
  84.     ------------------
  85.     -- Midcast Sets --
  86.     ------------------
  87.     sets.midcast = {}
  88.     sets.midcast.Flash = sets.Enmity
  89.     sets.midcast.FastRecast = {ammo="Impatiens",
  90.         head="Rune. Bandeau +1", neck="Twilight Torque",
  91.         ear1="Loquac. Earring",
  92.         body="Vanir Cotehardie", hands="Thaumas Gloves",
  93.         ring1="Defending Ring", ring1="Prolix Ring",
  94.         back="Mollusca Mantle", waist="Goading Belt",
  95.         legs="Orvail Pants +1", feet="Chelona Boots"}
  96.  
  97.     sets.midcast['Enhancing Magic'] = set_combine(sets.midcast.FastRecast, {
  98.         head="Rune. Bandeau +1", neck="Twilight Torque",
  99.         body="Futhark Coat +1", hands="Runeist Mitons +1",
  100.         back="Mollusca Mantle", waist="Olympus Sash",
  101.         legs="Futhark Trousers +1"})
  102.  
  103.     sets.midcast['Divine Magic'] = set_combine(sets.midcast.FastRecast, {
  104.         legs="Rune. Trousers +1"})
  105.  
  106.     sets.midcast.Regen = set_combine(sets.midcast['Enhancing Magic'], {
  107.         head="Rune. Bandeau +1", neck="Twilight Torque",
  108.         body="Futhark Coat +1", hands="Runeist Mitons +1",
  109.         back="Mollusca Mantle", legs="Futhark Trousers +1"})
  110.  
  111.     sets.midcast.Phalanx = set_combine(sets.midcast['Enhancing Magic'], {
  112.         head="Rune. Bandeau +1", neck="Twilight Torque",
  113.         body="Futhark Coat +1", hands="Runeist Mitons +1",
  114.         back="Mollusca Mantle", legs="Futhark Trousers +1"})
  115.  
  116.     --------------------
  117.     -- AfterCast Sets --
  118.     --------------------
  119.  
  120.     -----------------
  121.     -- Status Sets --
  122.     -----------------
  123.     sets.Resting = {neck="Wiglen Gorget",
  124.         ear1="Ethereal Earring", ear2="Phawaylla Earring",
  125.         ring1="Sheltered Ring", ring2="Paguroidea Ring",
  126.         body="Runeist Coat +1", feet="Chelona Boots"}
  127.  
  128.     ---------------
  129.     -- Idle Sets --
  130.     ---------------
  131.  
  132.     Idle_Set_Names = {"Normal","Fodder","DD Accuracy","Physical Defense","Magic Defense"}
  133.  
  134.     sets.idle = {}
  135.     sets.idle.Town = {main="Aettir",
  136.         sub="Tzacab Grip", ammo="Vanir Battery",
  137.         head="Oce. Headpiece +1", neck="Wiglen Gorget",
  138.         ear1="Ethereal Earring", ear2="Dawn Earring",
  139.         body="Runeist Coat +1", hands="Futhark Mitons +1",
  140.         ring1="Sheltered Ring", ring2="Paguroidea Ring",
  141.         back="Shadow Mantle", waist="Flume Belt",
  142.         legs="Rune. Trousers +1", feet="Hermes' Sandals"}
  143.  
  144.     sets.idle.Normal = {ammo="Vanir Battery",
  145.         head="Oce. Headpiece +1", neck="Wiglen Gorget",
  146.         ear1="Ethereal Earring", ear2="Dawn Earring",
  147.         body="Runeist Coat +1", hands="Futhark Mitons +1",
  148.         ring1="Sheltered Ring", ring2="Paguroidea Ring",
  149.         back="Shadow Mantle", waist="Flume Belt",
  150.         legs="Rune. Trousers +1", feet="Hermes' Sandals"}
  151.  
  152.     sets.idle.Fodder = {ammo="Vanir Battery",
  153.         head="Oce. Headpiece +1", neck="Wiglen Gorget",
  154.         ear1="Ethereal Earring", ear2="Dawn Earring",
  155.         body="Thaumas Coat", hands="Qaaxo Mitaines",
  156.         ring1="Sheltered Ring", ring2="Paguroidea Ring",
  157.         back="Shadow Mantle", waist="Flume Belt",
  158.         legs="Quiahuiz Trousers", feet="Hermes' Sandals"}
  159.  
  160.     sets.idle['DD Accuracy'] = {ammo="Honed Tathlum",
  161.         head="Whirlpool Mask", neck="Wiglen Gorget",
  162.         ear1="Ethereal Earring", ear2="Dawn Earring",
  163.         body="Thaumas Coat", hands="Buremte Gloves",
  164.         ring1="Sheltered Ring", ring2="Paguroidea Ring",
  165.         back="Atheling Mantle", waist="Dynamic Belt +1",
  166.         legs="Quiahuiz Trousers", feet="Hermes' Sandals"}
  167.  
  168.     sets.idle['Physical Defense'] = {
  169.         sub="Kupayopl", ammo="Vanir Battery",
  170.         head="Fu. Bandeau +1", neck="Twilight Torque",
  171.         ear1="Ethereal Earring", ear2="Dawn Earring",
  172.         body="Futhark Coat +1", hands="Umuthi Gloves",
  173.         ring1="Defending Ring", ring2="Epona's Ring",
  174.         back="Shadow Mantle", waist="Flume Belt",
  175.         legs="Rune. Trousers +1", feet="Futhark Boots +1"}
  176.  
  177.     -- ShellV, Defending Ring and Mollusca is enough to cap MDT for Rune Fencer. --
  178.  
  179.     sets.idle['Magic Defense'] = {
  180.         ammo="Vanir Battery", head="Fu. Bandeau +1",
  181.         ear1="Ethereal Earring", ear2="Dawn Earring",
  182.         neck="Twilight Torque",
  183.         body="Futhark Coat +1", hands="Umuthi Gloves",
  184.         ring1="Defending Ring", ring2="Vexer Ring +1",
  185.         back="Shadow Mantle", waist="Flume Belt",
  186.         legs="Rune. Trousers +1", feet="Futhark Boots +1"}
  187.  
  188.     ------------------
  189.     -- Engaged Sets --
  190.     ------------------
  191.  
  192.     TP_Set_Names = {"Normal","Fodder","DD Accuracy","Physical Defense","Magic Defense"}
  193.  
  194.     sets.engaged = {}
  195.  
  196.     sets.engaged.Normal = set_combine(sets.idle.Normal, {
  197.         neck="Asperity Necklace",
  198.         ear1="Bladeborn Earring", ear2="Steelflash Earring",
  199.         ring1="Rajas Ring", ring2="Epona's Ring",
  200.         back="Atheling Mantle", waist="Windbuffet Belt +1"})
  201.  
  202.     sets.engaged.Fodder = set_combine(sets.idle.Fodder, {
  203.         ammo="Vanir Battery",
  204.         head="Felistris Mask", neck="Asperity Necklace",
  205.         ear1="Bladeborn Earring", ear2="Steelflash Earring",
  206.         body="Runeist Coat +1", hands="Qaaxo Mitaines",
  207.         ring1="Rajas Ring", ring2="Epona's Ring",
  208.         back="Atheling Mantle", waist="Windbuffet Belt +1",
  209.         legs="Quiahuiz Trousers", feet="Qaaxo Leggings"})
  210.  
  211.     sets.engaged['DD Accuracy'] = set_combine(sets.idle['DD Accuracy'], {
  212.         neck="Asperity Necklace",
  213.         ear1="Bladeborn Earring", ear2="Steelflash Earring",
  214.         ring1="Rajas Ring", ring2="Epona's Ring",
  215.         back="Atheling Mantle", waist="Dynamic Belt +1"})
  216.  
  217.     sets.engaged['Physical Defense'] = set_combine(sets.idle['Physical Defense'], {
  218.         ear1="Bladeborn Earring", ear2="Steelflash Earring",
  219.         ring1="Defending Ring", ring2="Epona's Ring",
  220.         back="Mollusca Mantle", waist="Flume Belt",
  221.         legs="Rune. Trousers +1", feet="Futhark Boots +1"})
  222.  
  223.     sets.engaged['Magic Defense'] = set_combine(sets.idle['Magic Defense'], {
  224.         ammo="Vanir Battery",
  225.         head="Fu. Bandeau +1", neck="Twilight Torque",
  226.         ear1="Bladeborn Earring", ear2="Steelflash Earring",
  227.         body="Futhark Coat +1", hands="Umuthi Gloves",
  228.         ring1="Defending Ring", ring2="Vexer Ring +1",
  229.         back="Mollusca Mantle", waist="Flume Belt",
  230.         legs="Rune. Trousers +1", feet="Futhark Boots +1"})
  231.  
  232.  
  233.     -------------
  234.     -- JA Sets --
  235.     -------------
  236.     sets.JA = {}
  237.     sets.JA['Lunge'] = set_combine(sets.Enmity,{ammo="Dosis Tathlum",
  238.         head="Chelona Hat", neck="Eddy Necklace",
  239.         ear1="Hecate's earring", ear2="Friomisi earring",
  240.         body="Vanir Cotehardie", hands="Spolia Cuffs",
  241.         back="Evasionist's cape",
  242.         legs="Shned. Tights +1", feet="Manabyss Pigaches"})
  243.  
  244.     sets.JA['Swipe'] = sets.JA['Lunge']
  245.  
  246.     sets.JA['Pflug'] = set_combine(sets.Enmity, {
  247.         hands="Runeist Mitons +1", feet="Runeist Bottes +1"})
  248.     sets.JA['Elemental Sforzo'] = {body="Futhark Coat +1"}
  249.     sets.JA['Battuta'] = set_combine(sets.Enmity, {head="Fu. Bandeau +1"})
  250.     sets.JA['Vallation'] = set_combine(sets.Enmity, {
  251.         body="Runeist Coat +1",legs="Futhark Trousers +1"})
  252.     sets.JA['Valiance'] = set_combine(sets.Enmity, {
  253.         body="Runeist Coat +1",legs="Futhark Trousers +1"})
  254.     sets.JA['Gambit'] = set_combine(sets.Enmity, {hands="Runeist Mitons +1"})
  255.  
  256.     sets.JA['Swordplay'] = set_combine(sets.Enmity,
  257.         {hands="Futhark Mitons +1"})
  258.  
  259.     sets.JA['Rayke'] = set_combine(sets.Enmity, {feet="Runeist Bottes +1"})
  260.     sets.JA['Liement'] = set_combine(sets.Enmity, {body="Futhark Coat +1"})
  261.     sets.JA['Embolden'] = sets.Enmity
  262.     sets.JA['One For All'] = sets.Enmity
  263.  
  264.     sets.JA['Provoke'] = sets.Enmity
  265.     sets.JA['Warcry'] = sets.Enmity
  266.     sets.JA['Animated Flourish'] = sets.Enmity
  267.  
  268.     -- Flourish --
  269.     sets.Flourish = {}
  270.  
  271.     -----------------------------------
  272.     -- Variables and notes to myself --
  273.     -----------------------------------
  274.     -- Rune elements --
  275.     elements = {}
  276.     elements.runes = {['Fire']='Ignis', ['Ice']='Gelus', ['Wind']='Flabra',
  277.         ['Earth']='Tellus', ['Lightning']='Sulpor', ['Water']='Unda',
  278.         ['Light']='Lux', ['Dark']='Tenebrae'}
  279.  
  280.     -- Element Obi definitions for Lunge and Swipe --
  281.     sets.obi = {}
  282.     sets.obi['Fire'] = {waist="Karin Obi"}
  283.     sets.obi['Ice'] = {waist="Hyorin Obi"}
  284.     sets.obi['Wind'] = {waist="Furin Obi"}
  285.     sets.obi['Earth'] = {waist="Dorin Obi"}
  286.     sets.obi['Lightning'] = {waist="Rairin Obi"}
  287.     sets.obi['Water'] = {waist="Suirin Obi"}
  288.     sets.obi['Light'] = {waist="Korin Obi"}
  289.     sets.obi['Dark'] = {waist="Anrin Obi"}
  290.  
  291.     Mode_Index = 1
  292.  
  293.     send_command('input /macro book 3;wait .1;input /macro set 2')
  294. end
  295.  
  296. function precast(spell,action)
  297.     if spell.action_type == 'Magic' then
  298.         equip(sets.precast.FastCast)
  299.     elseif sets.WS[spell.name] then
  300.         equip(sets.WS[spell.name])
  301.     elseif spell.type=="JobAbility" then
  302.         if sets.JA[spell.name] then
  303.             equip(sets.JA[spell.name])
  304.         end
  305.         if spell.name == 'Lunge' or spell.name == 'Swipe' then
  306.             update_obi()
  307.         end
  308.     elseif spell.type=="WeaponSkill" then
  309.         equip(sets.WS)
  310.     elseif spell.name:contains('Waltz') then
  311.         equip(sets.precast.Waltz)
  312.     elseif spell.name:contains('Step') then
  313.         equip(sets.precast.Step)
  314.     end
  315. end
  316.  
  317. function midcast(spell,action)
  318.     if spell.name == 'Sneak' or spell.name == 'Spectral Jig' or spell.name:startswith('Monomi') and spell.target.type == 'SELF' then
  319.         send_command('cancel 71')
  320.     elseif sets.midcast[spell.name] then
  321.         equip(sets.midcast[spell.name])
  322.     elseif spell.name:startswith('Regen') then
  323.         equip(sets.midcast.Regen)
  324.     elseif spell.name:startswith('Phalanx') then
  325.         equip(sets.midcast.Phalanx)
  326.     elseif sets.midcast[spell.skill] then
  327.         equip(sets.midcast[spell.skill])
  328.     end
  329. end
  330.  
  331. function aftercast(spell,action)
  332.     update_gear()
  333. end
  334.  
  335. function status_change(new,action)
  336.     update_gear()
  337. end
  338.  
  339. -- Called when a player gains or loses a buff. --
  340. function buff_change(buff,gain)
  341.     if buff == "Swordplay" then update_gear() end
  342. end
  343.  
  344. function self_command(command)
  345.     if command:lower() == 'cycle' then
  346.         Mode_Index = Mode_Index +1
  347.         if Mode_Index > #Idle_Set_Names then
  348.             Mode_Index = 1
  349.         end
  350.         add_to_chat(8,'----- Gear Mode changed to '..Idle_Set_Names[Mode_Index]..' -----')
  351.         update_gear()
  352.     elseif command:lower() == 'mdt' then
  353.         Mode_Index = 5
  354.         add_to_chat(8,'----- Gear Mode changed to '..Idle_Set_Names[Mode_Index]..' -----')
  355.         update_gear()
  356.     elseif command:lower() == 'pdt' then
  357.         Mode_Index = 4
  358.         add_to_chat(8,'----- Gear Mode changed to '..Idle_Set_Names[Mode_Index]..' -----')
  359.         update_gear()
  360.     elseif command:lower() == 'acc' then
  361.         Mode_Index = 3
  362.         add_to_chat(8,'----- Gear Mode changed to '..Idle_Set_Names[Mode_Index]..' -----')
  363.         update_gear()
  364.     elseif command:lower() == 'fodder' then
  365.         Mode_Index = 2
  366.         add_to_chat(8,'----- Gear Mode changed to '..Idle_Set_Names[Mode_Index]..' -----')
  367.         update_gear()
  368.     elseif command:lower() == 'dd' then
  369.         Mode_Index = 2
  370.         add_to_chat(8,'----- Gear Mode changed to '..Idle_Set_Names[Mode_Index]..' -----')
  371.         update_gear()
  372.     elseif command:lower() == 'normal' then
  373.         Mode_Index = 1
  374.         add_to_chat(8,'----- Gear Mode changed to '..Idle_Set_Names[Mode_Index]..' -----')
  375.         update_gear()
  376.     end
  377. end
  378.  
  379. function update_gear()
  380.     if player.status == 'Engaged' then
  381.         equip(sets.engaged[TP_Set_Names[Mode_Index]])
  382.     elseif player.status == 'Idle' then
  383.         if areas.Cities:contains(world.area) then
  384.             add_to_chat(8,'----- You are at '..world.area..'. Default Town gear equipped. -----')
  385.             equip(sets.idle.Town)
  386.         else
  387.             -- Auto lockstyle. You can comment this out if you prefer.
  388.             send_command('input /lockstyle on')
  389.  
  390.             equip(sets.idle[Idle_Set_Names[Mode_Index]])
  391.         end
  392.     else
  393.         equip(sets.Resting)
  394.     end
  395.  
  396.     if buffactive['Swordplay'] then equip(sets.buff['Swordplay']) end
  397. end
  398.  
  399. function update_obi()
  400.     if buffactive['Ignis'] then
  401.         equip(sets.obi['Fire'])
  402.     elseif buffactive['Gelus'] then
  403.         equip(sets.obi['Ice'])
  404.     elseif buffactive['Flabra'] then
  405.         equip(sets.obi['Wind'])
  406.     elseif buffactive['Tellus'] then
  407.         equip(sets.obi['Earth'])
  408.     elseif buffactive['Sulpor'] then
  409.         equip(sets.obi['Lightning'])
  410.     elseif buffactive['Lux'] then
  411.         equip(sets.obi['Light'])
  412.     elseif buffactive['Tenebrae'] then
  413.         equip(sets.obi['Dark'])
  414.     end
  415. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement