Advertisement
Bokura

Bokura_PUP

Mar 11th, 2014
1,231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.66 KB | None | 0 0
  1. -- *** Credit goes to Flippant for helping me with Gearswap *** --
  2. -- ** I Use Some of Motenten's Functions ** --
  3.  
  4. function get_sets()
  5.     AccIndex = 1
  6.     AccArray = {"LowACC","MidACC","HighACC"} -- 3 Levels Of Accuracy Sets For TP/WS/Hybrid. Default ACC Set Is LowACC. Add More ACC Sets If Needed Then Create Your New ACC Below --
  7.     IdleIndex = 1
  8.     IdleArray = {"Movement","Regen","Pet"} -- Default Idle Set Is Movement --
  9.     PetIndex = 1
  10.     PetArray = {"Melee","Ranged","Tank","Magic"} -- Default Pet TP Set Is Melee --
  11.     Armor = 'None'
  12.     Pet = 'OFF' -- Set Default Pet Set ON or OFF Here --
  13.     target_distance = 5 -- Set Default Distance Here --
  14.     select_default_macro_book() -- Change Default Macro Book At The End --
  15.  
  16.     -- Pet WS --
  17.     Pet_WS = S{
  18.             "Arcuballista","Armor Piercer","Armor Shatterer","Bone Crusher","Cannibal Blade","Chimera Ripper",
  19.             "Daze","Knockout","Magic Mortar","Slapstick","String Clipper","String Shredder"}
  20.  
  21.     sc_map = {SC1="StringingPummel", SC2="Berserk", SC3="Aggressor"} -- 3 Additional Binds. Can Change Whatever JA/WS/Spells You Like Here. Remember Not To Use Spaces. --
  22.  
  23.     sets.Idle = {}
  24.     -- Idle/Town Sets --
  25.     sets.Idle.Regen = {}
  26.     sets.Idle.Movement = set_combine(sets.Idle.Regen,{
  27.             feet="Hermes' Sandals +1"})
  28.     sets.Idle.Pet = set_combine(sets.Idle.Regen,{})
  29.  
  30.     sets.Resting = {}
  31.  
  32.     -- TP Base Set --
  33.     sets.TP = {}
  34.  
  35.     -- TP Sets --
  36.     sets.TP = {}
  37.     sets.TP.MidACC = set_combine(sets.TP,{})
  38.     sets.TP.HighACC = set_combine(sets.TP.MidACC,{})
  39.  
  40.     sets.TP.Pet = {}
  41.     -- Pet Melee --
  42.     sets.TP.Pet.Melee = {
  43.             head="Foire Taj +1",
  44.             body="Pitre Tobe +1",
  45.             hands="Pitre Dastanas +1",
  46.             legs="Foire Churidars +1",
  47.             feet="Foire Bab. +1"}
  48.  
  49.     -- Pet Ranged Attack Type --
  50.     sets.TP.Pet.Ranged = {body="Pitre Tobe +1"}
  51.  
  52.     -- Pet Tank Type --
  53.     sets.TP.Pet.Tank = {
  54.             head="Foire Taj +1",
  55.             body="Foire Tobe +1",
  56.             hands="Pitre Dastanas +1",
  57.             legs="Foire Churidars +1",
  58.             feet="Foire Bab. +1"}
  59.  
  60.     -- Pet Magic Type --
  61.     sets.TP.Pet.Magic = {
  62.             head="Pitre Taj +1",
  63.             body="Pitre Tobe +1",
  64.             hands="Pitre Dastanas +1",
  65.             legs="Pitre Churidars +1",
  66.             feet="Pitre Babouches +1"}
  67.  
  68.     -- PDT/MDT/Kiting Sets --
  69.     sets.PDT = {}
  70.  
  71.     sets.MDT = set_combine(sets.PDT,{})
  72.  
  73.     sets.Kiting = set_combine(sets.PDT,{feet="Hermes' Sandals +1"})
  74.  
  75.     -- Hybrid Sets --
  76.     sets.TP.Hybrid = set_combine(sets.PDT,{})
  77.     sets.TP.Hybrid.MidACC = set_combine(sets.TP.Hybrid,{})
  78.     sets.TP.Hybrid.HighACC = set_combine(sets.TP.Hybrid.MidACC,{})
  79.  
  80.     -- WS Base Set --
  81.     sets.WS = {}
  82.  
  83.     -- WS Sets --
  84.     sets.WS["Victory Smite"] = {}
  85.     sets.WS["Victory Smite"].MidACC = set_combine(sets.WS["Victory Smite"],{})
  86.     sets.WS["Victory Smite"].HighACC = set_combine(sets.WS["Victory Smite"].MidACC,{})
  87.  
  88.     sets.WS["Shijin Spiral"] = {}
  89.     sets.WS["Shijin Spiral"].MidACC = set_combine(sets.WS["Shijin Spiral"],{})
  90.     sets.WS["Shijin Spiral"].HighACC = set_combine(sets.WS["Shijin Spiral"].MidACC,{})
  91.  
  92.     sets.WS["Stringing Pummel"] = {}
  93.     sets.WS["Stringing Pummel"].MidACC = set_combine(sets.WS["Stringing Pummel"],{})
  94.     sets.WS["Stringing Pummel"].HighACC = set_combine(sets.WS["Stringing Pummel"].MidACC,{})
  95.  
  96.     -- JA Sets --
  97.     sets.JA = {}
  98.     sets.JA["Tactical Switch"] = {feet="Karagoz Scarpe +1"}
  99.     sets.JA.Repair = {feet="Foire Bab. +1"}
  100.     sets.JA.Ventriloquy = {legs="Pitre Churidars +1"}
  101.     sets.JA["Role Reversal"] = {feet="Pitre Babouches +1"}
  102.  
  103.     -- Reduces Overload Rate Set --
  104.     sets.Maneuver = {
  105.             neck="Buffoon's Collar +1",
  106.             body="Kara. Farsetto +1",
  107.             hands="Foire Dastanas +1",
  108.             back="Dispersal Mantle"}
  109.  
  110.     -- Waltz Set --
  111.     sets.Waltz = {}
  112.  
  113.     sets.Precast = {}
  114.     -- Fastcast Set --
  115.     sets.Precast.FastCast = {}
  116.  
  117.     sets.Midcast = {}
  118.     -- Magic Haste Set --
  119.     sets.Midcast.Haste = set_combine(sets.PDT,{})
  120.  
  121.     -- Pet WS Set --
  122.     sets.Midcast.Pet_WS = {
  123.             head="Karagoz Capello +1",
  124.             hands="Karagoz Guanti +1",
  125.             legs="Kara. Pantaloni +1"}
  126.  
  127.     -- Pet Elemental Magic --
  128.     sets.Midcast.Pet_Elemental_Magic {}
  129.  
  130.     -- Pet Cure --
  131.     sets.Midcast.Pet_Cure {legs="Foire Churidars +1"}
  132. end
  133.  
  134. function pretarget(spell,action)
  135.     if midaction() or pet_midaction() then
  136.         cancel_spell()
  137.         return
  138.     elseif spell.action_type == 'Magic' and buffactive.silence then -- Auto Use Echo Drops If You Are Silenced --
  139.         cancel_spell()
  140.         send_command('input /item "Echo Drops" <me>')
  141.     elseif spell.english == "Berserk" and buffactive.Berserk then -- Change Berserk To Aggressor If Berserk Is On --
  142.         cancel_spell()
  143.         send_command('Aggressor')
  144.     elseif spell.type == "WeaponSkill" and spell.target.distance > target_distance and player.status == 'Engaged' then -- Cancel WS If You Are Out Of Range --
  145.         cancel_spell()
  146.         add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  147.         return
  148.     end
  149. end
  150.  
  151. function precast(spell,action)
  152.     if midaction() or pet_midaction() then
  153.         cancel_spell()
  154.         return
  155.     elseif spell.type == "WeaponSkill" then
  156.         if player.status ~= 'Engaged' then -- Cancel WS If You Are Not Engaged. Can Delete It If You Don't Need It --
  157.             cancel_spell()
  158.             add_to_chat(123,'Unable To Use WeaponSkill: [Disengaged]')
  159.             return
  160.         else
  161.             equipSet = sets.WS
  162.             if equipSet[spell.english] then
  163.                 equipSet = equipSet[spell.english]
  164.             end
  165.             if equipSet[AccArray[AccIndex]] then
  166.                 equipSet = equipSet[AccArray[AccIndex]]
  167.             end
  168.             if buffactive['Reive Mark'] then -- Equip Ygnas's Resolve +1 During Reive --
  169.                 equipSet = set_combine(equipSet,{neck="Ygnas's Resolve +1"})
  170.             end
  171.             if (spell.english == "Victory Smite" or spell.english == "Stringing Pummel") and player.tp > 2990 then -- Equip Vulcan's Pearl When You Have 3000 TP --
  172.                 equipSet = set_combine(equipSet,{ear1="Vulcan's Pearl"})
  173.             end
  174.             equip(equipSet)
  175.         end
  176.     elseif spell.type == "JobAbility" then
  177.         if sets.JA[spell.english] then
  178.             equip(sets.JA[spell.english])
  179.         end
  180.     elseif spell.action_type == 'Magic' then
  181.         if spell.english == 'Utsusemi: Ni' then
  182.             if buffactive['Copy Image (3)'] then
  183.                 cancel_spell()
  184.                 add_to_chat(123, spell.name .. ' Canceled: [3 Images]')
  185.                 return
  186.             else
  187.                 equip(sets.Precast.FastCast)
  188.             end
  189.         else
  190.             equip(sets.Precast.FastCast)
  191.         end
  192.     elseif spell.type == "Waltz" then
  193.         refine_waltz(spell,action)
  194.         equip(sets.Waltz)
  195.     elseif spell.english == 'Spectral Jig' and buffactive.Sneak then
  196.         cast_delay(0.2)
  197.         send_command('cancel Sneak')
  198.     elseif spell.type == "PetCommand" then
  199.         if spell.english:endswith('Maneuver') then
  200.             equip(sets.Maneuver)
  201.         end
  202.     end
  203.     if Pet == 'ON' then -- Use Pet Toggle For Pet Sets --
  204.         equip(sets.TP.Pet[PetArray[PetIndex]])
  205.     end
  206. end
  207.  
  208. function midcast(spell,action)
  209.     if pet_midaction() then
  210.         return
  211.     elseif spell.action_type == 'Magic' then
  212.         if spell.english:startswith('Utsusemi') then
  213.             if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)'] or buffactive['Copy Image (3)']) then -- Cancel Copy Image 1 & 2 For Utsusemi: Ichi --
  214.                 send_command('@wait 1.7;cancel Copy Image*')
  215.             end
  216.             equip(sets.Midcast.Haste)
  217.         elseif spell.english == 'Monomi: Ichi' then -- Cancel Sneak --
  218.             if buffactive['Sneak'] then
  219.                 send_command('@wait 1.7;cancel sneak')
  220.             end
  221.             equip(sets.Midcast.Haste)
  222.         else
  223.             equip(sets.Midcast.Haste)
  224.         end
  225.     end
  226. end
  227.  
  228. function aftercast(spell,action)
  229.     if pet_midaction() then
  230.         return
  231.     elseif spell.type == "WeaponSkill" and not spell.interrupted then
  232.         send_command('wait 0.2;gs c TP')
  233.     elseif not spell.type == "PetCommand" then
  234.         status_change(player.status)
  235.     end
  236. end
  237.  
  238. function status_change(new,old)
  239.     check_equip_lock()
  240.     if Armor == 'PDT' then
  241.         equip(sets.PDT)
  242.     elseif Armor == 'MDT' then
  243.         equip(sets.MDT)
  244.     elseif Armor == 'Kiting' then
  245.         equip(sets.Kiting)
  246.     elseif new == 'Engaged' then
  247.         equipSet = sets.TP
  248.         if Armor == 'Hybrid' and equipSet["Hybrid"] then
  249.             equipSet = equipSet["Hybrid"]
  250.         end
  251.         if equipSet[AccArray[AccIndex]] then
  252.             equipSet = equipSet[AccArray[AccIndex]]
  253.         end
  254.         equip(equipSet)
  255.     elseif new == 'Idle' then
  256.         equipSet = sets.Idle
  257.         if equipSet[IdleArray[IdleIndex]] then
  258.             equipSet = equipSet[IdleArray[IdleIndex]]
  259.         end
  260.         if buffactive['Reive Mark'] then -- Equip Ygnas's Resolve +1 During Reive --
  261.             equipSet = set_combine(equipSet,{neck="Ygnas's Resolve +1"})
  262.         end
  263.         if world.area:endswith('Adoulin') then
  264.             equipSet = set_combine(equipSet,{body="Councilor's Garb"})
  265.         end
  266.         equip(equipSet)
  267.     elseif new == 'Resting' then
  268.         equip(sets.Resting)
  269.     end
  270.     if Pet == 'ON' then -- Use Pet Toggle For Pet Sets --
  271.         equip(sets.TP.Pet[PetArray[PetIndex]])
  272.     end
  273. end
  274.  
  275. function buff_change(buff,gain)
  276.     buff = string.lower(buff)
  277.     if buff == "aftermath: lv.3" then -- AM3 Timer/Countdown --
  278.         if gain then
  279.             send_command('timers create "Aftermath: Lv.3" 180 down;wait 150;input /echo Aftermath: Lv.3 [WEARING OFF IN 30 SEC.];wait 15;input /echo Aftermath: Lv.3 [WEARING OFF IN 15 SEC.];wait 5;input /echo Aftermath: Lv.3 [WEARING OFF IN 10 SEC.]')
  280.         else
  281.             send_command('timers delete "Aftermath: Lv.3"')
  282.             add_to_chat(123,'AM3: [OFF]')
  283.         end
  284.     elseif buff == 'weakness' then -- Weakness Timer --
  285.         if gain then
  286.             send_command('timers create "Weakness" 300 up')
  287.         else
  288.             send_command('timers delete "Weakness"')
  289.         end
  290.     end
  291.     if not midaction() and not pet_midaction() then
  292.         status_change(player.status)
  293.     end
  294. end
  295.  
  296. function pet_midcast(spell,action)
  297.     if spell.skill == 'Elemental Magic' then
  298.         equip(sets.Midcast.Pet_Elemental_Magic)
  299.     elseif spell.english:startswith('Cure') then
  300.         equip(sets.Midcast.Pet_Cure)
  301.     elseif Pet_WS:contains(spell.english) then
  302.         equip(sets.Midcast.Pet_WS)
  303.     end
  304. end
  305.  
  306. function pet_aftercast(spell,action)
  307.     status_change(player.status)
  308. end
  309.  
  310. function pet_change(pet,gain)
  311.     status_change(player.status)
  312. end
  313.  
  314. -- In Game: //gs c (command), Macro: /console gs c (command), Bind: gs c (command) --
  315. function self_command(command)
  316.     if command == 'C1' then -- Accuracy Level Toggle --
  317.         AccIndex = (AccIndex % #AccArray) + 1
  318.         add_to_chat(158,'Accuracy Level: ' .. AccArray[AccIndex])
  319.         status_change(player.status)
  320.     elseif command == 'C5' then -- Auto Update Gear Toggle --
  321.         status_change(player.status)
  322.         add_to_chat(158,'Auto Update Gear')
  323.     elseif command == 'C3' then -- Pet Set Toggle --
  324.         PetIndex = (PetIndex % #PetArray) + 1
  325.         add_to_chat(158,'Pet Set: ' .. PetArray[PetIndex])
  326.         status_change(player.status)
  327.     elseif command == 'C2' then -- Hybrid Toggle --
  328.         if Armor == 'Hybrid' then
  329.             Armor = 'None'
  330.             add_to_chat(123,'Hybrid Set: [Unlocked]')
  331.         else
  332.             Armor = 'Hybrid'
  333.             add_to_chat(158,'Hybrid Set: '..AccArray[AccIndex])
  334.         end
  335.         status_change(player.status)
  336.     elseif command == 'C7' then -- PDT Toggle --
  337.         if Armor == 'PDT' then
  338.             Armor = 'None'
  339.             add_to_chat(123,'PDT Set: [Unlocked]')
  340.         else
  341.             Armor = 'PDT'
  342.             add_to_chat(158,'PDT Set: [Locked]')
  343.         end
  344.         status_change(player.status)
  345.     elseif command == 'C15' then -- MDT Toggle --
  346.         if Armor == 'MDT' then
  347.             Armor = 'None'
  348.             add_to_chat(123,'MDT Set: [Unlocked]')
  349.         else
  350.             Armor = 'MDT'
  351.             add_to_chat(158,'MDT Set: [Locked]')
  352.         end
  353.         status_change(player.status)
  354.     elseif command == 'C9' then -- Pet Toggle --
  355.         if Pet == 'ON' then
  356.             Pet = 'OFF'
  357.             add_to_chat(123,'Pet Set: [Unlocked]')
  358.         else
  359.             Pet = 'ON'
  360.             add_to_chat(158,'Pet Set: [Locked]')
  361.         end
  362.         status_change(player.status)
  363.     elseif command == 'C8' then -- Distance Toggle --
  364.         if player.target.distance then
  365.             target_distance = math.floor(player.target.distance*10)/10
  366.             add_to_chat(158,'Distance: '..target_distance)
  367.         else
  368.             add_to_chat(123,'No Target Selected')
  369.         end
  370.     elseif command == 'C6' then -- Idle Toggle --
  371.         IdleIndex = (IdleIndex % #IdleArray) + 1
  372.         add_to_chat(158,'Idle Set: ' .. IdleArray[IdleIndex])
  373.         status_change(player.status)
  374.     elseif command == 'TP' then
  375.         add_to_chat(158,'TP Return: ['..tostring(player.tp)..']')
  376.     elseif command:match('^SC%d$') then
  377.         send_command('//' .. sc_map[command])
  378.     end
  379. end
  380.  
  381. function check_equip_lock() -- Lock Equipment Here --
  382.     if player.equipment.left_ring == "Warp Ring" or player.equipment.left_ring == "Capacity Ring" or player.equipment.right_ring == "Warp Ring" or player.equipment.right_ring == "Capacity Ring" then
  383.         disable('ring1','ring2')
  384.     elseif player.equipment.back == "Mecisto. Mantle" or player.equipment.back == "Aptitude Mantle +1" or player.equipment.back == "Aptitude Mantle" then
  385.         disable('back')
  386.     else
  387.         enable('ring1','ring2','back')
  388.     end
  389. end
  390.  
  391. function refine_waltz(spell,action)
  392.     if spell.type ~= 'Waltz' then
  393.         return
  394.     end
  395.  
  396.     if spell.name == "Healing Waltz" or spell.name == "Divine Waltz" or spell.name == "Divine Waltz II" then
  397.         return
  398.     end
  399.  
  400.     local newWaltz = spell.english
  401.     local waltzID
  402.  
  403.     local missingHP
  404.  
  405.     if spell.target.type == "SELF" then
  406.         missingHP = player.max_hp - player.hp
  407.     elseif spell.target.isallymember then
  408.         local target = find_player_in_alliance(spell.target.name)
  409.         local est_max_hp = target.hp / (target.hpp/100)
  410.         missingHP = math.floor(est_max_hp - target.hp)
  411.     end
  412.  
  413.     if missingHP ~= nil then
  414.         if player.sub_job == 'DNC' then
  415.             if missingHP < 40 and spell.target.name == player.name then
  416.                 add_to_chat(123,'Full HP!')
  417.                 cancel_spell()
  418.                 return
  419.             elseif missingHP < 150 then
  420.                 newWaltz = 'Curing Waltz'
  421.                 waltzID = 190
  422.             elseif missingHP < 300 then
  423.                 newWaltz = 'Curing Waltz II'
  424.                 waltzID = 191
  425.             else
  426.                 newWaltz = 'Curing Waltz III'
  427.                 waltzID = 192
  428.             end
  429.         else
  430.             return
  431.         end
  432.     end
  433.  
  434.     local waltzTPCost = {['Curing Waltz'] = 20, ['Curing Waltz II'] = 35, ['Curing Waltz III'] = 50, ['Curing Waltz IV'] = 65, ['Curing Waltz V'] = 80}
  435.     local tpCost = waltzTPCost[newWaltz]
  436.  
  437.     local downgrade
  438.  
  439.     if player.tp < tpCost and not buffactive.trance then
  440.  
  441.         if player.tp < 20 then
  442.             add_to_chat(123, 'Insufficient TP ['..tostring(player.tp)..']. Cancelling.')
  443.             cancel_spell()
  444.             return
  445.         elseif player.tp < 35 then
  446.             newWaltz = 'Curing Waltz'
  447.         elseif player.tp < 50 then
  448.             newWaltz = 'Curing Waltz II'
  449.         elseif player.tp < 65 then
  450.             newWaltz = 'Curing Waltz III'
  451.         elseif player.tp < 80 then
  452.             newWaltz = 'Curing Waltz IV'
  453.         end
  454.  
  455.         downgrade = 'Insufficient TP ['..tostring(player.tp)..']. Downgrading to '..newWaltz..'.'
  456.     end
  457.  
  458.     if newWaltz ~= spell.english then
  459.         send_command('@input /ja "'..newWaltz..'" '..tostring(spell.target.raw))
  460.         if downgrade then
  461.             add_to_chat(158, downgrade)
  462.         end
  463.         cancel_spell()
  464.         return
  465.     end
  466.  
  467.     if missingHP > 0 then
  468.         add_to_chat(158,'Trying to cure '..tostring(missingHP)..' HP using '..newWaltz..'.')
  469.     end
  470. end
  471.  
  472. function find_player_in_alliance(name)
  473.     for i,v in ipairs(alliance) do
  474.         for k,p in ipairs(v) do
  475.             if p.name == name then
  476.                 return p
  477.             end
  478.         end
  479.     end
  480. end
  481.  
  482. function sub_job_change(newSubjob, oldSubjob)
  483.     select_default_macro_book()
  484. end
  485.  
  486. function set_macro_page(set,book)
  487.     if not tonumber(set) then
  488.         add_to_chat(123,'Error setting macro page: Set is not a valid number ('..tostring(set)..').')
  489.         return
  490.     end
  491.     if set < 1 or set > 10 then
  492.         add_to_chat(123,'Error setting macro page: Macro set ('..tostring(set)..') must be between 1 and 10.')
  493.         return
  494.     end
  495.  
  496.     if book then
  497.         if not tonumber(book) then
  498.             add_to_chat(123,'Error setting macro page: book is not a valid number ('..tostring(book)..').')
  499.             return
  500.         end
  501.         if book < 1 or book > 20 then
  502.             add_to_chat(123,'Error setting macro page: Macro book ('..tostring(book)..') must be between 1 and 20.')
  503.             return
  504.         end
  505.         send_command('@input /macro book '..tostring(book)..';wait .1;input /macro set '..tostring(set))
  506.     else
  507.         send_command('@input /macro set '..tostring(set))
  508.     end
  509. end
  510.  
  511. function select_default_macro_book()
  512.     -- Default macro set/book
  513.     if player.sub_job == 'WAR' then
  514.         set_macro_page(1, 19)
  515.     elseif player.sub_job == 'DNC' then
  516.         set_macro_page(3, 19)
  517.     elseif player.sub_job == 'NIN' then
  518.         set_macro_page(2, 19)
  519.     else
  520.         set_macro_page(1, 19)
  521.     end
  522. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement