Advertisement
Quixacotl

[LUA] FFXI MNK LUA

Oct 6th, 2014
641
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.15 KB | None | 0 0
  1. --[[
  2.     Written by Quixacotl updated 10/06/2014
  3.  
  4.     Instructions:
  5.         Paste this file into folder; Windower4 > addons > Gearswap > data (not into the export folder).
  6.  
  7.     Custom Commands:
  8.         There are 2 custom commands: 'cycle' and 'cycle ws'
  9.         In chatlog type: //gs c cycle or //gs c cycle ws
  10.         For macros use: /console gs c cycle or /console gs c cycle ws
  11.         Useage: 'cycle' cycles through 5 separate gearmodes: Town, Fodder, Full Accuracy, Physical Defense, and Magic Defense.
  12.             'cycle ws' cycles through 3 different WS modes: Normal, MidAccuracy and FullAccuracy.
  13.  
  14.     Shortcut Commands (jumps straight to any gearmode):
  15.         //gs c town
  16.         //gs c dd or fodder
  17.         //gs c acc
  18.         //gs c pdt
  19.         //gs c mdt
  20.  
  21.     Gearswap Commands:
  22.         //lua load gearswap
  23.         //lua unload gearswap
  24.         //gs reload - (useful when editing these scripts while in-game)
  25.         //gs showswaps - toggles showswaps on and off
  26.             showswaps displays gear changes in chatlog. Useful for debugging
  27. --]]
  28.  
  29.     --------------------------------------
  30.     -- Start defining the sets
  31.     --------------------------------------
  32.  
  33. function get_sets()
  34.     --------------------
  35.     -- Augmented Gear --
  36.     --------------------
  37.     QaaxoBody = {}
  38.     QaaxoBody.R15B = {name="Qaaxo Harness", augments={'Accuracy+15','STR+7','Phys. dmg. taken -3'}}
  39.     QaaxoFeet = {}
  40.     QaaxoFeet.R15A = {name="Qaaxo Leggings", augments={'Attack+15','Evasion+15','"Dbl.Atk."+2'}}
  41.     QaaxoFeet.R15B = {name="Qaaxo Leggings", augments={'Accuracy+15','STR+7','Phys. dmg. taken -3'}}
  42.  
  43.     --------------------------------------------
  44.     -- City areas for town gear and behavior. --
  45.     --------------------------------------------
  46.     areas = {}
  47.     areas.Cities = S{
  48.         "Eastern Adoulin", "Western Adoulin",
  49.         "Ru'Lude Gardens", "Upper Jeuno", "Lower Jeuno", "Port Jeuno",
  50.         "Port Windurst", "Windurst Waters", "Windurst Woods",
  51.         "Windurst Walls", "Heavens Tower",
  52.         "Port San d'Oria", "Northern San d'Oria", "Southern San d'Oria",
  53.         "Port Bastok", "Bastok Markets",
  54.         "Bastok Mines", "Metalworks",
  55.         "Aht Urhgan Whitegate", "Tavanazian Safehold",
  56.         "Nashmau", "Selbina",
  57.         "Mhaura", "Norg", "Kazham"}
  58.  
  59.     --------------------------------------------------------------------
  60.     -- Buff Active Layers - Gear that enhances Buffs for the duration --
  61.     --------------------------------------------------------------------
  62.     sets.buff = {}
  63.     sets.buff['Footwork'] = {feet="Tantra Gaiters +2"}
  64.     sets.buff['Impetus'] = {body="Tantra Cyclas +2"}
  65.  
  66.     sets.Enmity = {ring1="Odium Ring"}
  67.  
  68.  
  69.     -----------------------------
  70.     -- Precast Sets for spells --
  71.     -----------------------------
  72.     sets.precast = {}
  73.     sets.precast.Ninjutsu = {
  74.         neck="Magoraga Beads", ammo="Honed Tathlum",
  75.         ear2="Loquac. Earring", back="Mollusca Mantle",
  76.         ring1="Defending Ring", ring2="Beeline Ring"}
  77.  
  78.     ----------------------
  79.     -- Weaponskill Sets --
  80.     ----------------------
  81.     WS_Set_Names = {"Normal","MidAccuracy","FullAccuracy"}
  82.  
  83.     sets.WSMidAcc = {ammo="Honed Tathlum", back="Letalis Mantle", feet=QaaxoFeet.R15B}
  84.     sets.WSFullAcc = {ammo="Honed Tathlum", head="Sukeroku Hachi.", back="Letalis Mantle", feet=QaaxoFeet.R15B}
  85.  
  86.     sets.WS = {ammo="Ginsen",
  87.         head="Uk'uxkaj Cap", neck="Nefarious Collar +1",
  88.         ear1="Vulcan's Pearl", ear2="Vulcan's Pearl",
  89.         body="Anch. Cyclas +1", hands="Hes. Gloves +1",
  90.         ring1="Ifrit Ring +1", ring2="Ifrit Ring +1",
  91.         back="Rancorous Mantle", waist="Prosilio Belt +1",
  92.         legs="Ighwa Trousers", feet=QaaxoFeet.R15B}
  93.     sets.WS.Normal = sets.WS
  94.     sets.WS.MidAccuracy = set_combine(sets.WS, sets.WSMidAcc)
  95.     sets.WS.FullAccuracy = set_combine(sets.WS, sets.WSFullAcc)
  96.  
  97.     sets.WS["Final Heaven"] = {ammo="Tantra Tathlum",
  98.         head="Uk'uxkaj Cap", neck="Nefarious Collar +1",
  99.         ear1="Terra's Pearl", ear2="Terra's Pearl",
  100.         body="Anch. Cyclas +1", hands="Hes. Gloves +1",
  101.         ring1="Titan Ring", ring2="Titan Ring",
  102.         back="Iximulew Cape", waist="Prosilio Belt +1",
  103.         legs="Ighwa Trousers", feet=QaaxoFeet.R15B}
  104.     sets.WS["Final Heaven"].Normal = sets.WS["Final Heaven"]
  105.     sets.WS["Final Heaven"].MidAccuracy = set_combine(sets.WS["Final Heaven"], sets.WSMidAcc)
  106.     sets.WS["Final Heaven"].FullAccuracy = set_combine(sets.WS["Final Heaven"], sets.WSFullAcc)
  107.  
  108.     sets.WS["Victory Smite"] = {ammo="Ginsen",
  109.         head="Uk'uxkaj Cap", neck="Nefarious Collar +1",
  110.         ear1="Vulcan's Pearl", ear2="Vulcan's Pearl",
  111.         body="Anch. Cyclas +1", hands="Hes. Gloves +1",
  112.         ring1="Ifrit Ring +1", ring2="Ifrit Ring +1",
  113.         back="Rancorous Mantle", waist="Prosilio Belt +1",
  114.         legs="Ighwa Trousers", feet=QaaxoFeet.R15B}
  115.     sets.WS["Victory Smite"].Normal = sets.WS["Victory Smite"]
  116.     sets.WS["Victory Smite"].MidAccuracy = set_combine(sets.WS["Victory Smite"], sets.WSMidAcc)
  117.     sets.WS["Victory Smite"].FullAccuracy = set_combine(sets.WS["Victory Smite"], sets.WSFullAcc)
  118.  
  119.     sets.WS['Shijin Spiral'] = {
  120.         ammo="Jukukik Feather",
  121.         head="Whirlpool Mask", neck="Ej Necklace",
  122.         ear1="Jupiter's Pearl", ear2="Pixie Earring",
  123.         body=QaaxoBody.R15B, hands="Hes. Gloves +1",
  124.         ring1="Ramuh Ring +1", ring2="Ramuh Ring",
  125.         back="Vespid Mantle", waist="Artful Belt +1",
  126.         legs="Hes. Hose +1", feet=QaaxoFeet.R15B}
  127.     sets.WS['Shijin Spiral'].Normal = sets.WS['Shijin Spiral']
  128.     sets.WS['Shijin Spiral'].MidAccuracy = set_combine(sets.WS['Shijin Spiral'], sets.WSMidAcc)
  129.     sets.WS['Shijin Spiral'].FullAccuracy = set_combine(sets.WS['Shijin Spiral'], sets.WSFullAcc)
  130.  
  131.     sets.WS['Asuran Fists'] = {ammo="Ginsen",
  132.         head="Uk'uxkaj Cap", neck="Nefarious Collar +1",
  133.         ear1="Vulcan's Pearl", ear2="Vulcan's Pearl",
  134.         body="Anch. Cyclas +1", hands="Hes. Gloves +1",
  135.         ring1="Ifrit Ring +1", ring2="Ifrit Ring +1",
  136.         back="Rancorous Mantle", waist="Prosilio Belt +1",
  137.         legs="Ighwa Trousers", feet=QaaxoFeet.R15B}
  138.     sets.WS['Asuran Fists'].Normal = sets.WS['Asuran Fists']
  139.     sets.WS['Asuran Fists'].MidAccuracy = set_combine(sets.WS['Asuran Fists'], sets.WSMidAcc)
  140.     sets.WS['Asuran Fists'].FullAccuracy = set_combine(sets.WS['Asuran Fists'], sets.WSFullAcc)
  141.  
  142.     -----------------
  143.     -- Status Sets --
  144.     -----------------
  145.     sets.Resting = {ammo="Inlamvuyeso",
  146.         head="Oce. Headpiece +1", neck="Wiglen Gorget",
  147.         ear1="Dawn Earring", ear2="Brachyura Earring",
  148.         body="Hes. Cyclas +1", hands="Hes. Gloves +1",
  149.         ring1="Paguroidea Ring", ring2="Sheltered Ring",
  150.         back="Letalis Mantle", waist="Windbuffet Belt +1",
  151.         legs="Hes. Hose +1", feet="Hes. Gaiters +1"}
  152.  
  153.     ---------------
  154.     -- Idle Sets --
  155.     ---------------
  156.     Idle_Set_Names = {"Town","Fodder","Full Accuracy","Physical Defense","Magic Defense"}
  157.  
  158.     sets.Idle = {}
  159.     sets.Idle.Town = {
  160.         main="Spharai", ammo="Inlamvuyeso",
  161.         head="Oce. Headpiece +1", neck="Wiglen Gorget",
  162.         ear1="Dawn Earring", ear2="Brachyura Earring",
  163.         body="Hes. Cyclas +1", hands="Hes. Gloves +1",
  164.         ring1="Paguroidea Ring", ring2="Sheltered Ring",
  165.         back="Letalis Mantle", waist="Windbuffet Belt +1",
  166.         legs="Hes. Hose +1", feet="Hermes' Sandals"}
  167.  
  168.     sets.Idle.Fodder = {
  169.         ammo="Ginsen",
  170.         head="Whirlpool Mask", neck="Wiglen Gorget",
  171.         ear1="Dawn Earring", ear2="Brachyura Earring",
  172.         body=QaaxoBody.R15B, hands="Hes. Gloves +1",
  173.         ring1="Paguroidea Ring", ring2="Sheltered Ring",
  174.         back="Atheling Mantle", waist="Windbuffet Belt +1",
  175.         legs="Hes. Hose +1", feet="Hermes' Sandals"}
  176.  
  177.     sets.Idle['Full Accuracy'] = {
  178.         ammo="Ginsen",
  179.         head="Whirlpool Mask", neck="Wiglen Gorget",
  180.         ear1="Dawn Earring", ear2="Brachyura Earring",
  181.         body=QaaxoBody.R15B, hands="Hes. Gloves +1",
  182.         ring1="Paguroidea Ring", ring2="Sheltered Ring",
  183.         back="Letalis Mantle", waist="Anguinus Belt",
  184.         legs="Ighwa Trousers", feet=QaaxoFeet.R15B}
  185.  
  186.     sets.Idle['Physical Defense'] = {ammo="Brigantia Pebble",
  187.         head="Otronif Mask +1", neck="Veisa Collar",
  188.         ear1="Dawn Earring", ear2="Brachyura Earring",
  189.         body="Otro. Harness +1", hands="Otronif Gloves +1",
  190.         ring1="Defending Ring", ring2="Dark Ring",
  191.         back="Repulse Mantle", waist="Windbuffet Belt +1",
  192.         legs="Otronif Brais +1", feet="Otronif Boots +1"}
  193.  
  194.     sets.Idle['Magic Defense'] = {ammo="Sihirik",
  195.         head="Otronif Mask +1", neck="Asperity Necklace",
  196.         ear1="Merman's Earring", ear2="Merman's Earring",
  197.         body="Otro. Harness +1", hands="Otronif Gloves +1",
  198.         ring1="Defending Ring", ring2="Yacuruna Ring +1",
  199.         back="Engulfer Cape +1", waist="Windbuffet Belt +1",
  200.         legs="Otronif Brais +1", feet="Otronif Boots +1"}
  201.  
  202.     -------------
  203.     -- TP sets --
  204.     -------------
  205.  
  206.     TP_Set_Names = {"Town","Fodder","Full Accuracy","Physical Defense","Magic Defense"}
  207.  
  208.     sets.TP = {}
  209.     sets.TP.Town = set_combine(sets.Idle.Town,{
  210.         ammo="Inlamvuyeso",
  211.         head="Whirlpool Mask", neck="Asperity Necklace",
  212.         ear1="Bladeborn Earring", ear2="Steelflash Earring",
  213.         body="Thaumas Coat", hands="Hes. Gloves +1",
  214.         ring1="K'ayres Ring", ring2="Epona's Ring",
  215.         back="Letalis Mantle", waist="Windbuffet Belt +1",
  216.         legs="Hes. Hose +1", feet="Anch. Gaiters +1"})
  217.  
  218.     sets.TP.Fodder = set_combine(sets.Idle.Fodder,{
  219.         ammo="Ginsen",
  220.         head="Whirlpool Mask", neck="Asperity Necklace",
  221.         ear1="Bladeborn Earring", ear2="Steelflash Earring",
  222.         body=QaaxoBody.R15B, hands="Hes. Gloves +1",
  223.         ring1="Oneiros Ring", ring2="Epona's Ring",
  224.         back="Atheling Mantle", waist="Windbuffet Belt +1",
  225.         legs="Hes. Hose +1", feet=QaaxoFeet.R15A})
  226.  
  227.     sets.TP['Full Accuracy'] = set_combine(sets.Idle['Full Accuracy'],{
  228.         ammo="Ginsen",
  229.         head="Whirlpool Mask", neck="Ej Necklace",
  230.         ear1="Bladeborn Earring", ear2="Steelflash Earring",
  231.         body=QaaxoBody.R15B, hands="Hes. Gloves +1",
  232.         ring1="Ramuh Ring +1", ring2="Epona's Ring",
  233.         back="Letalis Mantle", waist="Anguinus Belt",
  234.         legs="Ighwa Trousers", feet=QaaxoFeet.R15B})
  235.  
  236.     sets.TP['Physical Defense'] = set_combine(sets.Idle['Physical Defense'],
  237.         {back="Mollusca Mantle"})
  238.  
  239.     sets.TP['Magic Defense'] = set_combine(sets.Idle['Magic Defense'], {})
  240.  
  241.  
  242.     ----------------------
  243.     -- Job Ability Sets --
  244.     ----------------------
  245.     sets.JA = {}
  246.  
  247.     sets.JA['Hundred Fists'] = {legs="Hes. Hose +1"}
  248.     sets.JA['Boost'] = {hands="Anch. Gloves +1"}
  249.     sets.JA['Dodge'] = {feet="Anch. Gaiters +1"}
  250.     sets.JA['Focus'] = {head="Anchor. Crown +1"}
  251.     sets.JA['Counterstance'] = {feet="Hes. Gaiters +1"}
  252.     sets.JA['Mantra'] = {feet="Hes. Gaiters +1"}
  253.     sets.JA['Formless Strikes'] = {body="Hes. Cyclas +1"}
  254.     sets.JA['Impetus'] = {body="Tantra Cyclas +2"}
  255.     sets.JA['Footwork'] = {feet="Tantra Gaiters +2"}
  256.  
  257.     sets.JA['Chi Blast'] = {
  258.         head="Hes. Crown +1", neck="Aife's Medal",
  259.         body="Otro. Harness +1", hands="Hes. Gloves +1",
  260.         back="Tuilha Cape", waist="Crudelis Belt",
  261.         legs="Hes. Hose +1", feet="Anch. Gaiters +1"}
  262.  
  263.     sets.JA['Chakra'] = set_combine(sets.JA['Chi Blast'],{
  264.         ammo="Brigantia Pebble",
  265.         head="Whirlpool Mask", neck="Tjukurrpa Medal",
  266.         ear1="Terra's Pearl", ear2="Terra's Pearl",
  267.         body="Anch. Cyclas +1", hands="Hes. Gloves +1",
  268.         ring1="Titan Ring", ring2="Titan Ring",
  269.         back="Earthcry Mantle", waist="Caudata Belt",
  270.         legs="Ighwa Trousers", feet="Hes. Gaiters +1"})
  271.  
  272.     sets.JA['Provoke'] = sets.Enmity
  273.     sets.JA['Warcry'] = sets.Enmity
  274.     sets.JA['Animated Flourish'] = sets.Enmity
  275.  
  276.     sets.Waltz = set_combine(sets.JA['Chi Blast'],{
  277.         ammo="Sonia's Plectrum",
  278.         head="Felistris Mask", neck="Dualism Collar",
  279.         body="Otro. Harness +1", hands="Hes. Gloves +1",
  280.         ring1="Spiral Ring", ring2="Angel's Ring",
  281.         back="Iximulew Cape", waist="Caudata Belt",
  282.         legs="Qaaxo Tights", feet="Otronif Boots +1"})
  283.  
  284.     sets.Step = {ammo="Honed Tathlum",
  285.         ear2="Choreia Earring", waist="Chaac Belt"}
  286.  
  287.     -----------------------------------
  288.     -- Variables and notes to myself --
  289.     -----------------------------------
  290.     Mode_Index = 1
  291.     WS_Index = 1
  292.  
  293.     select_macro_book_sets()
  294. end
  295.  
  296.     --------------------------------------
  297.     -- Rules
  298.     --------------------------------------
  299.  
  300. function precast(spell)
  301.     if sets.precast[spell.english] then
  302.         equip(sets.precast[spell.english])
  303.     elseif sets.JA[spell.english] then
  304.         equip(sets.JA[spell.english])
  305.     elseif spell.english:contains('Waltz') then
  306.         equip(sets.Waltz)
  307.     elseif spell.english:contains('Step') then
  308.         equip(sets.Step)
  309.     elseif spell.type=="WeaponSkill" then
  310.         if sets.WS[spell.english] then
  311.             equip(sets.WS[spell.english][WS_Set_Names[WS_Index]])
  312.         else
  313.             equip(sets.WS[WS_Set_Names[WS_Index]])
  314.         end
  315.     elseif spell.type=="Ninjutsu" then
  316.         equip(sets.precast.Ninjutsu)
  317.     end
  318. end
  319.  
  320. function midcast(spell)
  321.     if spell.english == 'Spectral Jig' or spell.english:startswith('Monomi') and spell.target.type == 'SELF' then
  322.         send_command('cancel 71')
  323.     end
  324. end
  325.  
  326. function aftercast(spell,action)
  327.     update_gear()
  328. end
  329.  
  330. function status_change(new,action)
  331.     update_gear()
  332. end
  333.  
  334. -- Called when a player gains or loses a buff.
  335. function buff_change(buff,gain)
  336.     if buff == "Footwork" then update_gear() end
  337.     if buff == "Impetus" then update_gear() end
  338. end
  339.  
  340. function self_command(command)
  341.     if command:lower() == 'cycle' then
  342.         Mode_Index = Mode_Index +1
  343.         if Mode_Index > #Idle_Set_Names then
  344.             Mode_Index = 1
  345.         end
  346.         add_to_chat(8,'----- Gear Mode changed to '..Idle_Set_Names[Mode_Index]..' -----')
  347.         update_gear()
  348.     elseif command:lower() == 'mdt' then
  349.         Mode_Index = 5
  350.         add_to_chat(8,'----- Gear Mode changed to '..Idle_Set_Names[Mode_Index]..' -----')
  351.         update_gear()
  352.     elseif command:lower() == 'pdt' then
  353.         Mode_Index = 4
  354.         add_to_chat(8,'----- Gear Mode changed to '..Idle_Set_Names[Mode_Index]..' -----')
  355.         update_gear()
  356.     elseif command:lower() == 'acc' then
  357.         Mode_Index = 3
  358.         add_to_chat(8,'----- Gear Mode changed to '..Idle_Set_Names[Mode_Index]..' -----')
  359.         update_gear()
  360.     elseif command:lower() == 'dd' then
  361.         Mode_Index = 2
  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() == 'town' then
  369.         Mode_Index = 1
  370.         add_to_chat(8,'----- Gear Mode changed to '..Idle_Set_Names[Mode_Index]..' -----')
  371.         update_gear()
  372.     elseif command:lower() == 'cycle ws' then
  373.         WS_Index = WS_Index +1
  374.         if WS_Index > #WS_Set_Names then
  375.             WS_Index = 1
  376.         end
  377.         add_to_chat(8,'----- Weaponskill Mode changed to '..WS_Set_Names[WS_Index]..' -----')
  378.     else
  379.         add_to_chat(8,'--- Command error. Commands are cycle, cycle ws, town, fodder, acc, pdt and mdt ---')
  380.     end
  381. end
  382.  
  383. function update_gear()
  384.     if player.status == 'Engaged' then
  385.         equip(sets.TP[TP_Set_Names[Mode_Index]])
  386.     elseif player.status == 'Idle' then
  387.         if areas.Cities:contains(world.area) then
  388.             add_to_chat(8,'----- You are at '..world.area..'. Town gear equipped! -----')
  389.             equip(sets.Idle.Town)
  390.         else
  391.             send_command('input /lockstyle on') -- auto /lockstyle - you can disable this if you prefer.
  392.             equip(sets.Idle[Idle_Set_Names[Mode_Index]])
  393.         end
  394.     else
  395.         equip(sets.Resting)
  396.     end
  397.  
  398.     if buffactive['Footwork'] then equip(sets.buff['Footwork']) end
  399.     if buffactive['Impetus'] then equip(sets.buff['Impetus']) end
  400. end
  401.  
  402. -- Select default macro book on initial load or subjob change.
  403. function select_macro_book_sets()
  404.     if player.sub_job == 'DNC' then
  405.         send_command('input /macro book 2;wait .1;input /macro set 2')
  406.     elseif player.sub_job == 'NIN' then
  407.         send_command('input /macro book 2;wait .1;input /macro set 3')
  408.     elseif player.sub_job == 'RUN' then
  409.         send_command('input /macro book 2;wait .1;input /macro set 4')
  410.     else
  411.         send_command('input /macro book 2;wait .1;input /macro set 1')
  412.     end
  413. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement