Advertisement
Rosienaikanaro

BlankGearswapTemplate

Jun 25th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 13.55 KB | None | 0 0
  1. --[[
  2.  
  3.     Blank Gearswap
  4.         Save as Character_Job.lua in the data folder and the gearswap will load automatically when the Character / Job match.
  5.    
  6.     Green text is commented out and will have no effect on the code command structure.
  7.    
  8.     --Template from Kanryu of Ragnarok - Update v2.3 - 12/27/2017
  9.  
  10. ]]
  11.  
  12. --!!INIT!!--
  13.  
  14.     --Functions and Misc Commands that are set to execute when you first put on the job. This includes swaps to the right macro pages and job specific addons.
  15.    
  16.     res = require('resources')
  17.    
  18.     --Enable All--
  19.     send_command('gs enable all')  
  20.         --Enables all gearslots after job change.
  21.    
  22.     --Set Macro Information and Lockstyle--
  23.     send_command('input /macro book XX; wait .1;input /macro set YY;')
  24.         --Set XX to the job's macro book, YY to the page, and ZZZ to your lockstyleset if desired.
  25.  
  26.     --Command Aliases--     Any custom commands for Windower should be put into this section.
  27.     send_command('alias cp gs c cp')    --CP Cape Lock
  28.     send_command('alias dt gs c dt')    --DT Trigger
  29.     send_command('alias hyb gs c hyb')  --Hybrid Trigger
  30.     send_command('alias style gs c style')  --Hybrid Trigger
  31.  
  32. --Main()--
  33. function get_sets()
  34.  
  35.     --Variable Triggers--
  36.     CPTrigger   =   0
  37.         --Sets CP Cape Lock setting to false on load. See Custom Command Engine located in self_command() for examples of variable usage.
  38.     DTTrigger   =   0
  39.         --Sets PDT gear trigger to false on load.
  40.     HybridTrigger = 0
  41.         --Sets Hybrid gear trigger to false on load.
  42.     --This section is for custom variables to be created and defined.--
  43.    
  44.     --Idle Sets--
  45.        
  46.         sets.Idle = {}
  47.         --All set categories must be defined by a blank set before subsets can be created.
  48.        
  49.         --Standard Idle Set--
  50.         sets.Idle.Standard = {
  51.             main    =   "",
  52.             sub     =   "",
  53.             ranged  =   "",
  54.             ammo    =   "",
  55.             head    =   "",
  56.             neck    =   "",
  57.             lear    =   "",
  58.             rear    =   "",
  59.             body    =   "",
  60.             hands   =   "",
  61.             lring   =   "",
  62.             rring   =   "",
  63.             waist   =   "",
  64.             legs    =   "",
  65.             feet    =   "",
  66.         }
  67.        
  68.         --DT Idle Set--
  69.         sets.Idle.DT = set_combine(sets.Idle.Standard, {
  70.             neck    =   "",
  71.             body    =   "",
  72.             lring   =   "",
  73.             rring   =   "",
  74.         })
  75.         --Combines DT with the standard idle set. Only add pieces that actually change.
  76.        
  77.     --TP Sets--
  78.    
  79.         --Typically weapons are not included in these sets. You should not be changing weapons in jobs that use TP gearsets.--
  80.    
  81.         sets.engaged = {}
  82.        
  83.         --Standard TP Set--
  84.         sets.engaged.Standard = {
  85.             ammo    =   "",
  86.             head    =   "",
  87.             neck    =   "",
  88.             lear    =   "",
  89.             rear    =   "",
  90.             body    =   "",
  91.             hands   =   "",
  92.             lring   =   "",
  93.             rring   =   "",
  94.             waist   =   "",
  95.             legs    =   "",
  96.             feet    =   "",
  97.         }
  98.        
  99.         --DT Hybrid Set--
  100.         sets.engaged.Hybrid = {
  101.             ammo    =   "",
  102.             head    =   "",
  103.             neck    =   "",
  104.             lear    =   "",
  105.             rear    =   "",
  106.             body    =   "",
  107.             hands   =   "",
  108.             lring   =   "",
  109.             rring   =   "",
  110.             waist   =   "",
  111.             legs    =   "",
  112.             feet    =   "",
  113.         }
  114.        
  115.         --FullDT TP Set--
  116.         sets.engaged.DT = {
  117.             ammo    =   "",
  118.             head    =   "",
  119.             neck    =   "",
  120.             lear    =   "",
  121.             rear    =   "",
  122.             body    =   "",
  123.             hands   =   "",
  124.             lring   =   "",
  125.             rring   =   "",
  126.             waist   =   "",
  127.             legs    =   "",
  128.             feet    =   "",
  129.         }
  130.        
  131.     --Weaponskill Sets--
  132.    
  133.         sets.WS = {}
  134.        
  135.         sets.WS.Moonshade   =   S{'Weaponskill_Name',}
  136.         --Add Moonshade Earring weaponskills to this list.
  137.        
  138.         --Default Generic WS Set--
  139.         sets.WS.Standard = {
  140.             ammo    =   "",
  141.             head    =   "",
  142.             neck    =   "",
  143.             lear    =   "",
  144.             rear    =   "",
  145.             body    =   "",
  146.             hands   =   "",
  147.             lring   =   "",
  148.             rring   =   "",
  149.             waist   =   "",
  150.             legs    =   "",
  151.             feet    =   "",
  152.         }
  153.        
  154.         --'WS Name' Set--
  155.         sets.WS['WS_Name'] = {
  156.             ammo    =   "",
  157.             head    =   "",
  158.             neck    =   "",
  159.             lear    =   "",
  160.             rear    =   "",
  161.             body    =   "",
  162.             hands   =   "",
  163.             lring   =   "",
  164.             rring   =   "",
  165.             waist   =   "",
  166.             legs    =   "",
  167.             feet    =   "",
  168.         }
  169.        
  170.     --Job Ability Sets--
  171.    
  172.         --[[Job Ability sets can be split into two categories, required when the JA is used or required when the JA is consumed.
  173.         Relic 2 hr duration pieces are an example of pieces equipped when the JA is used. These types of gear are used in JA precast.
  174.         Burst Affinity pieces are an example of pieces of that must be equipped when the JA is consumed.
  175.         The second type of gear are triggered depending on their effects, like when casting a BLU spell in our Burst Affinity example.]]--
  176.    
  177.         sets.JA = {}
  178.        
  179.         --'Job Ability' Set--
  180.        
  181.         sets.JA['JA_Name'] = {
  182.             body    =   "",
  183.         }
  184.        
  185.     --Spell Sets--
  186.    
  187.         --[[Spellcasting Sets are split into two pieces; precast and midcast.
  188.             Precast includes quick magic or fast cast gear.
  189.             Midcast is the gear that you want to ultimately use when you complete the spell.]]--
  190.        
  191.         --Precast Sets--
  192.        
  193.         sets.precast = {}
  194.        
  195.         --Default FC Set--
  196.         sets.precast.FC = {
  197.             ammo    =   "",
  198.             head    =   "",
  199.             neck    =   "",
  200.             lear    =   "",
  201.             rear    =   "",
  202.             body    =   "",
  203.             hands   =   "",
  204.             lring   =   "",
  205.             rring   =   "",
  206.             waist   =   "",
  207.             legs    =   "",
  208.             feet    =   "",
  209.         }
  210.        
  211.         --'Magic Type' or 'Spell' Set--
  212.         sets.precast['Spell or SpellType'] = {
  213.             ammo    =   "",
  214.             head    =   "",
  215.             neck    =   "",
  216.             lear    =   "",
  217.             rear    =   "",
  218.             body    =   "",
  219.             hands   =   "",
  220.             lring   =   "",
  221.             rring   =   "",
  222.             waist   =   "",
  223.             legs    =   "",
  224.             feet    =   "",
  225.         }
  226.        
  227.         --Midcast Sets--
  228.         sets.midcast = {}
  229.        
  230.         --Midcast sets are unique to the spell or type of magic being cast. A default set is not available.--
  231.        
  232.         sets.midcast['Spell or SpellType'] = {
  233.             ammo    =   "",
  234.             head    =   "",
  235.             neck    =   "",
  236.             lear    =   "",
  237.             rear    =   "",
  238.             body    =   "",
  239.             hands   =   "",
  240.             lring   =   "",
  241.             rring   =   "",
  242.             waist   =   "",
  243.             legs    =   "",
  244.             feet    =   "",
  245.         }
  246.    
  247. end
  248.  
  249. --Precast Core--
  250. function precast(spell, action)
  251.  
  252.     --[[This function determine what pre-cast function to use for a specific action.
  253.     This section can be fully populated in place of the sub-type precast section, however it does help
  254.     with organization and debugging if they are separated.]]--
  255.    
  256.     --Magic Precast Handler--
  257.     if spell.action_type == 'Magic' then
  258.         precast_magic(spell)
  259.     end
  260.    
  261.     --Job Ability Precast Handler--
  262.     if spell.type == 'JobAbility' then
  263.         precast_ja(spell)
  264.     end
  265.        
  266.     --Weapon Skill Precast Handler--
  267.     if spell.type == "WeaponSkill" then
  268.         precast_weaponskill(spell)     
  269.     end
  270.    
  271. end
  272.  
  273. --Midcast Core--
  274. function midcast(spell, action)
  275.  
  276.     --[[This function determine what midcast function to use for a specific action.
  277.     This section can be fully populated in place of the sub-type midcast section, however it does help
  278.     with organization and debugging if they are separated.]]--
  279.    
  280.     --Magic Precast Handler--
  281.     if spell.action_type == 'Magic' then
  282.         midcast_magic(spell)
  283.     end
  284.    
  285.     --Post Midcast--
  286.     postmidcast(spell)
  287.     --Executes post midcast function as the last resort in midcast. Helps overwride spell sets such as perpetuance gloves or obi.
  288.  
  289. end
  290.  
  291. --Post Midcast Core--
  292. function postmidcast(spell, action)
  293.  
  294.     --[[This function controls the equiping of Hachi Obi for Nukes.
  295.     This function can be replicated for other spells using different magic types if required (Dark, Healing, Blue, etc).]]--
  296.  
  297.     if spell.skill == 'Elemental Magic' and spell.element == world.day_element or spell.element == world.weather_element then
  298.         equip({waist="Hachirin-No-Obi"})
  299.     end
  300.  
  301. end
  302.  
  303. --Aftercast Core--
  304. function aftercast(spell, action)
  305.  
  306.     --[[Aftercast core determines what aftercast process should be run to return to idle gear after performing an action.
  307.     This section can be fully populated in place of the sub-type aftercast section, however it does help with
  308.     organization and debugging if they are separated.]]--
  309.    
  310.     --Aftercast Function Trigger--
  311.     if player.status == "Engaged" then
  312.         aftercast_engaged()
  313.     else
  314.         aftercast_idle()
  315.     end
  316.  
  317.     --Zone specific gear handling data call.
  318.     local info = windower.ffxi.get_info()
  319.     local zone = res.zones[info.zone].name
  320.    
  321.     --Replicate this section for each zone specific piece of gear.
  322.     if zone:match('San d\'Oria') and not zone:match('Dynamis') then
  323.         equip({body = "Kingdom Aketon"})
  324.     end
  325.     --Replicate this section for each zone specific piece of gear. Adoulin example.
  326.     if zone:match('Adoulin') then
  327.         equip({body = "Councilor's Garb"})
  328.     end
  329.    
  330. end
  331.  
  332. --Custom Command Engine--
  333. function self_command(command)
  334.  
  335.     --DT Trigger--
  336.     if command == 'dt' then    
  337.         if DTTrigger == 1 then
  338.             add_to_chat(170, 'DT Toggled - Max Damage')
  339.             DTTrigger = 0
  340.         else
  341.             add_to_chat(170, 'DT Toggled - Max DT')
  342.             DTTrigger = 1
  343.         end
  344.     end
  345.     --Enables DT mode so that TP and Idle sets swap to damage taken gear.--
  346.    
  347.     --Hybrid Trigger--
  348.     if command == 'hyb' then       
  349.         if HybridTrigger == 1 then
  350.             if DTTrigger == 1 then
  351.                 add_to_chat(170, 'Hybrid Toggled - Max Damage TP Restored (DT Override On)')
  352.                 HybridTrigger = 0
  353.             else
  354.                 add_to_chat(170, 'Hybrid Toggled - Max Damage TP Restored')
  355.                 HybridTrigger = 0
  356.             end
  357.         else
  358.             if DTTrigger == 1 then
  359.                 add_to_chat(170, 'Hybrid Toggled - Hybrid TP / DT Set Enabled (DT Override On)')
  360.                 HybridTrigger = 1
  361.             else
  362.                 add_to_chat(170, 'Hybrid Toggled - Hybrid TP / DT Set Enabled')
  363.                 HybridTrigger = 1
  364.             end
  365.         end
  366.     end
  367.     --Enables Hybrid mode so that TP and Idle sets swap to hybrid DD (PDT + DD mix) gear.--
  368.    
  369.     --CP Cape Lock--
  370.     if command == 'cp' then
  371.         if CPTrigger == 1 then
  372.             enable('back')
  373.             add_to_chat(170, 'CP Cape Released')
  374.             CPTrigger = 0
  375.         else
  376.             equip({back="Mecisto. Mantle"})
  377.             disable('back')
  378.             add_to_chat(170, 'CP Cape Locked')
  379.             CPTrigger = 1
  380.         end
  381.     end
  382.     --Locks Mechisto Manel on for CP parties. Replace mantle with Aptitude if you don't have Mechisto.
  383.    
  384.     --Lockstyle Command--
  385.     if command == 'style' then
  386.         style()
  387.     end
  388.     --Runs the lockstyle function.
  389.    
  390. end
  391.  
  392. --Subfunction for Magic Precast--
  393. function precast_magic(spell, action)
  394.  
  395.     --Enhancing Magic--
  396.     if spell.skill == "Enhancing Magic" then
  397.         equip(sets.precast['Enhancing Magic']) 
  398.     --Using Enhancing Magic as an example.
  399.    
  400.     --Enfeebling Magic--
  401.     elseif spell.skill == "Enfeebling Magic" then
  402.         equip(sets.precast['Enfeebling Magic'])
  403.     --Using Enfeebling Magic as an example.
  404.  
  405.     else
  406.         equip(sets.precast.FC)
  407.     end
  408.  
  409. end
  410.  
  411. --Subfunction for Job Ability Precast--
  412. function precast_ja(spell, action)
  413.  
  414.     if spell.skill == "JA Name" then
  415.         equip(sets.JA['JA_Name'])
  416.     end
  417.     --This trigger should be populated for each JA that has gear sets that are required on-use. Ex. 2-hr extension gear.
  418.    
  419. end
  420.  
  421. --Subfunction for Weaponskill Precast--
  422. function precast_weaponskill(spell, action)
  423.  
  424.     if spell.english == "WS_Name" then 
  425.         equip(sets.WS['WS_Name'])
  426.     --Example of a weaponskill trigger.
  427.    
  428.     elseif spell.english == "WS_Name2" then
  429.         equip(sets.WS['WS_Name2'])
  430.    
  431.     else
  432.         equip(sets.WS.Standard)
  433.     end
  434.        
  435.     if sets.WS.Moonshade:contains(spell.english) and player.tp < 2750 then
  436.         equip({lear = 'Moonshade Earring'})
  437.     end
  438.     --Equip Moonshade Earring if the weaponskill benefits from it and the player has less than 2750 TP.
  439.         --Additional rules will be required if +TP Bonus weapons are used.
  440.  
  441. end
  442.  
  443. --Subfunction for Midcast Magic--
  444. function midcast_magic(spell, action)
  445.  
  446.     --Enfeebling Magic--
  447.     if spell.skill == "Enfeebling Magic" then
  448.         equip(sets.midcast['Enfeebling Magic'])
  449.     --Using Enfeebling Magic as an example of a basic midcast.
  450.    
  451.     --Enhancing Magic--
  452.     elseif spell.skill == "Enhancing Magic" then
  453.         --Regen Trigger--
  454.         if string.find(spell.english,'Regen')then
  455.             equip(sets.midcast['Regen'])
  456.             --This regen section is an example of how to search for a specific spell-type rather than magic type.
  457.         else
  458.             equip(sets.midcast['Enhancing Magic'])
  459.         end
  460.        
  461.         --Perp Hands Overwrite--
  462.         if buffactive['Perpetuance'] then
  463.             equip(sets.JA['Perpetuance'])
  464.         end
  465.         --[[This Perpetuance section is an example of merging a JA set with it's matching cast situation.
  466.         In this case perpetuance gloves grant additional duration if the JA is active when the spell casts.
  467.         The gloves are required to be equipped when the enhancing spell is cast, not when the JA is activated.]]--
  468.    
  469.     end
  470.     --Using Enhancing Magic as an example of a more advanced midcast function.
  471.  
  472. end
  473.  
  474. --Aftercast Swap while Idle--
  475. function aftercast_idle()
  476.  
  477.     --DT Swap--
  478.     if DTTrigger == 1 then
  479.         equip(sets.Idle.DT)
  480.        
  481.     else
  482.         equip(sets.Idle.Standard)
  483.     end
  484.    
  485.     --Disability Swap--
  486.     if buffactive['terror'] or buffactive['petrification']
  487.         or buffactive['stun'] or buffactive['sleep'] then
  488.             equip(sets.Idle.DT)
  489.     end
  490.     --Automatically swaps on DT set if stunned, terrored, petrified, or slept.
  491.    
  492. end
  493.  
  494. --Aftercast Swap while Engaged--
  495. function aftercast_engaged()
  496.  
  497.     --Non-Standard TP Function--   
  498.     if DTTrigger == 1 then
  499.         equip(sets.engaged.DT)
  500.     elseif HybridTrigger == 1 then
  501.         equip(sets.engaged.Hybrid)
  502.     else
  503.         equip(sets.engaged.Standard)
  504.     end
  505.     --This decision ladder decides what TP set to return to. DT > HybridDT > TP
  506.    
  507.     --Disability Swap--
  508.     if buffactive['terror'] or buffactive['petrification']
  509.         or buffactive['stun'] or buffactive['sleep'] then
  510.             equip(sets.Idle.DT)
  511.     end
  512.     --Automatically swaps on DT set if stunned, terrored, petrified, or slept.
  513.    
  514. end
  515.  
  516. --Buff Gain Function--
  517. function buff_change(buff,gain)
  518.  
  519.     --Handicap Protection--
  520.     if buff == "terror" or buff == "petrification" or
  521.         buff == "stun" or buff == "sleep" then
  522.        
  523.         --DT Gear On--
  524.         if gain then  
  525.             equip(sets.Idle.DT)
  526.        
  527.         --Handicap Restore--
  528.         else
  529.             --Aftercast Function Trigger--
  530.             aftercast()
  531.         end
  532.     end    
  533.    
  534. end
  535.  
  536. --Status Change Core--
  537. function status_change(new, old)
  538.  
  539.     --Aftercast Function Trigger--
  540.     if player.status == "Engaged" then
  541.         aftercast_engaged()
  542.     else
  543.         aftercast_idle()
  544.     end
  545.  
  546. end
  547.  
  548. --Stylelock Function--
  549. function style()
  550.  
  551.     --Lockstyle Function--
  552.     send_command('input /lockstyleset XX;')
  553.         --This function is not loaded automatically because of the delay when changing job / sub.
  554.  
  555. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement