Guest User

COR_GS

a guest
Jul 3rd, 2014
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 22.87 KB | None | 0 0
  1. function get_sets()
  2.     AccIndex = 1
  3.     AccArray = {"LowACC","MidACC","HighACC"} -- 3 Levels Of Accuracy Sets For Shooting/QD/TP/WS. Default ACC Set Is LowACC. The First TP Set Of Your Main Weapon Is LowACC. Add More ACC Sets If Needed Then Create Your New ACC Below --
  4.     IdleIndex = 1
  5.     IdleArray = {'Movement', 'Regen'} -- Default Idle Set Is Movement --
  6.     Armor = 'None'
  7.     define_roll_values()
  8.     AutoMode = 'OFF' -- Set Default Auto RA/WS ON or OFF Here --
  9.     Obi = 'ON' -- Turn Default Obi ON or OFF Here --
  10.     target_distance = 5 -- Set Default Distance Here --
  11.     select_default_macro_book() -- Change Default Macro Book At The End --
  12.  
  13.     ACC_Shots = S{"Light Shot","Dark Shot"}
  14.  
  15.     Cure_Spells = {"Cure","Cure II","Cure III","Cure IV"} -- Cure Degradation --
  16.     Curaga_Spells = {"Curaga","Curaga II"} -- Curaga Degradation --
  17.     sc_map = {SC1="CoursersRoll", SC2="DiaII", SC3="LightShot"} -- 3 Additional Binds. Can Change Whatever JA/WS/Spells You Like Here. Remember Not To Use Spaces. --
  18.  
  19.     -- Idle/Town Sets --
  20.     sets.Idle = {}
  21.     sets.Idle.Regen = {
  22.             head="Oce. Headpiece +1",
  23.             neck="Wiglen Gorget",
  24.             ear1="Black Earring",
  25.             ear2="Dawn Earring",
  26.             body="Kheper Jacket",
  27.             hands="Skadi's Bazubands",
  28.             ring1="Paguroidea Ring",
  29.             ring2="Sheltered Ring",
  30.             back="Repulse Mantle",
  31.             waist="Lycopodium Sash",
  32.             legs="Iuitl Tights",
  33.             feet="Skd. Jambeaux +1"}
  34.     sets.Idle.Movement = set_combine(sets.Idle.Regen,{
  35.             head="Uk'uxkaj Cap",
  36.             neck="Orunmila's Torque",
  37.             ring1="Luzaf's Ring",
  38.             ring2="Sangoma Ring",
  39.             back="Gunslinger's Cape"})
  40.  
  41.     -- QD Sets --
  42.     sets.QD = {
  43.             ammo="Animikii Bullet",
  44.             head="Blood Mask",
  45.             neck="Stoicheion Medal",
  46.             ear1="Hecate's Earring",
  47.             ear2="Friomisi Earring",
  48.             body="Mirke Wardecors",
  49.             hands="Nvrch. Gants +2",
  50.             ring1="Acumen Ring",
  51.             ring2="Stormsoul Ring",
  52.             back="Gunslinger's Cape",
  53.             waist="Aquiline Belt",
  54.             legs="Nahtirah Trousers",
  55.             feet="Nvrch. Bottes +2"}
  56.     sets.QD.MidACC = set_combine(sets.QD,{})
  57.     sets.QD.HighACC = set_combine(sets.QD.MidACC,{
  58.             neck="Faith Torque",
  59.             ear1="Lifestorm Earring",
  60.             ear2="Psystorm Earring",
  61.             hands="Sigyn's Bazubands",
  62.             ring2="Sangoma Ring",
  63.             legs="Thur. Tights +1",
  64.             feet="Lak. Bottes"})
  65.  
  66.     -- PDT/MDT Sets --
  67.     sets.PDT = {
  68.             head="Iuitl Headgear +1",
  69.             neck="Twilight Torque",
  70.             ear1="Black Earring",
  71.             ear2="Darkness Earring",
  72.             body="Iuitl Vest +1",
  73.             hands="Iuitl Wristbands +1",
  74.             ring1="Dark Ring",
  75.             ring2="Defending Ring",
  76.             back="Shadow Mantle",
  77.             waist="Flume Belt",
  78.             legs="Iuitl Tights +1",
  79.             feet="Iuitl Gaiters +1"}
  80.  
  81.     sets.MDT = set_combine(sets.PDT,{
  82.             ear1="Merman's Earring",
  83.             ear2="Sanare Earring",
  84.             ring1="Shadow Ring",
  85.             back="Engulfer Cape",
  86.             waist="Resolute Belt"})
  87.  
  88.     -- Roll Set --
  89.     sets.Rolls = set_combine(sets.PDT,{
  90.             head="Lanun Tricorne",
  91.             hands="Nvrch. Gants +2",
  92.             ring1="Luzaf's Ring",
  93.             ring2="Barataria Ring"})
  94.  
  95.     -- Preshot --
  96.     sets.Preshot = {
  97.             head="Aurore Beret",
  98.             hands="Comm. Gants +2",
  99.             back="Navarch's Mantle",
  100.             waist="Impulse Belt",
  101.             legs="Nahtirah Trousers",
  102.             feet="Wurrukatte Boots"}
  103.  
  104.     -- Shooting Base Set --
  105.     sets.Midshot = {}
  106.  
  107.     -- Death Penalty Sets --
  108.     sets.Midshot['Death Penalty'] = {}
  109.     sets.Midshot['Death Penalty'].MidACC = set_combine(sets.Midshot['Death Penalty'],{})
  110.     sets.Midshot['Death Penalty'].HighACC = set_combine(sets.Midshot['Death Penalty'].MidACC,{})
  111.  
  112.     -- Vanir Gun Sets --
  113.     sets.Midshot.Pulfanxa = {
  114.             ammo="Eminent Bullet",
  115.             head="Uk'uxkaj Cap",
  116.             neck="Ocachi Gorget",
  117.             ear1="Flame Pearl",
  118.             ear2="Volley Earring",
  119.             body="Lak. Frac",
  120.             hands="Sigyn's Bazubands",
  121.             ring1="Hajduk Ring +1",
  122.             ring2="Rajas Ring",
  123.             back="Terebellum Mantle",
  124.             waist="Elanid Belt",
  125.             legs="Nahtirah Trousers",
  126.             feet="Iuitl Gaiters"}
  127.     sets.Midshot.Pulfanxa.MidACC = set_combine(sets.Midshot.Pulfanxa,{
  128.             head="Lak. Hat +1",
  129.             neck="Iqabi Necklace",
  130.             ear1="Clearview Earring",
  131.             back="Gunslinger's Cape",
  132.             feet="Lak. bottes"})
  133.     sets.Midshot.Pulfanxa.HighACC = set_combine(sets.Midshot.Pulfanxa.MidACC,{
  134.             hands="Sigyn's Bazubands",
  135.             ring2="Hajduk Ring +1",
  136.             legs="Thur. Tights +1"})
  137.  
  138.     -- Armageddon Sets --
  139.     sets.Midshot.Armageddon = {}
  140.     sets.Midshot.Armageddon.MidACC = set_combine(sets.Midshot.Armageddon,{})
  141.     sets.Midshot.Armageddon.HighACC = set_combine(sets.Midshot.Armageddon.MidACC,{})
  142.  
  143.     -- Melee Sets --
  144.     sets.Melee = {
  145.                         head="Whirlpool Mask",
  146.                         neck="Asperity Necklace",
  147.                         ear1="Bladeborn Earring",
  148.                         ear2="Steelflash Earring",
  149.                         body="Thaumas Coat",
  150.                         hands="Iuitl Wristbands",
  151.                         ring1="Epona's Ring",
  152.                         ring2="Rajas Ring",
  153.                         back="Atheling Mantle",
  154.                         waist="Windbuffet Belt",
  155.                         legs="Iuitl Tights",
  156.                         feet="Manibozho Boots"}
  157.     sets.Melee.MidACC = set_combine(sets.Melee,{
  158.             neck="Iqabi Necklace",
  159.             hands="Buremte Gloves",
  160.             waist="Hurch'lan Sash",
  161.             legs="Manibozho brais",
  162.             feet="Qaaxo leggings"})
  163.     sets.Melee.HighACC = set_combine(sets.Melee.MidACC,{})
  164.  
  165.     -- WS Base Set --
  166.     sets.WS = {}
  167.  
  168.     -- Last Stand Sets --
  169.     sets.WS["Last Stand"] = {
  170.             ammo="Eminent Bullet",
  171.             head="Uk'uxkaj Cap",
  172.             neck="Light Gorget",
  173.             ear1="Wilhelm's Earring",
  174.             ear2="Altdorf's Earring",
  175.             body="Kheper Jacket",
  176.             hands="Sigyn's Bazubands",
  177.             ring1="Stormsoul Ring",
  178.             ring2="Stormsoul Ring",
  179.             back="Terebellum Mantle",
  180.             waist="Light Belt",
  181.             legs="Nahtirah Trousers",
  182.             feet="Lak. Bottes"}
  183.     sets.WS["Last Stand"].MidACC = set_combine(sets.WS["Last Stand"],{
  184.             head="Lak. Hat"})
  185.     sets.WS["Last Stand"].HighACC = set_combine(sets.WS["Last Stand"].MidACC,{
  186.             body="Lak. Frac",
  187.             hands="Buremte Gloves",
  188.             ring1="Hajduk Ring +1",
  189.             ring2="Hajduk Ring +1",
  190.             back="Gunslinger's Cape",
  191.             legs="Thur. Tights +1"})
  192.  
  193.     -- Wildfire Sets --
  194.     sets.WS.Wildfire = {}
  195.     sets.WS.Wildfire.MidACC = set_combine(sets.WS.Wildfire,{})
  196.     sets.WS.Wildfire.HighACC = set_combine(sets.WS.Wildfire.MidACC,{})
  197.  
  198.     -- Leaden Salute Sets --
  199.     sets.WS['Leaden Salute'] = {}
  200.     sets.WS['Leaden Salute'].MidACC = set_combine(sets.WS['Leaden Salute'],{})
  201.     sets.WS['Leaden Salute'].HighACC = set_combine(sets.WS['Leaden Salute'].MidACC,{})
  202.  
  203.     -- Elemental Obi --
  204.     sets.Obi = {}
  205.     sets.Obi.Thunder = {waist='Rairin Obi'}
  206.     sets.Obi.Water = {waist='Suirin Obi'}
  207.     sets.Obi.Fire = {waist='Karin Obi'}
  208.     sets.Obi.Ice = {waist='Hyorin Obi'}
  209.     sets.Obi.Wind = {waist='Furin Obi'}
  210.     sets.Obi.Earth = {waist='Dorin Obi'}
  211.     sets.Obi.Light = {waist='Korin Obi'}
  212.     sets.Obi.Dark = {waist='Anrin Obi'}
  213.  
  214.     -- JA Sets --
  215.     sets.JA = {}
  216.     sets.JA["Random Deal"] = {body="Commodore Frac +2"}
  217.     sets.JA.Fold = {hands="Commodore Gants +2"}
  218.     sets.JA["Snake Eye"] = {legs="Commodore Cullotes +2"}
  219.     sets.JA["Wild Card"] = {feet="Lanun Bottes"}
  220.  
  221.     -- Waltz Set --
  222.     sets.Waltz = {}
  223.  
  224.     sets.Precast = {}
  225.     --Fastcast Set --
  226.     sets.Precast.FastCast = {
  227.             ring1="Prolix Ring",
  228.             neck="Orunmila's Torque",
  229.             hands="Thaumas Gloves",
  230.             ear1="Loquac. Earring",
  231.             ring2="Veneficium Ring"
  232.     }
  233.  
  234.     sets.Midcast = {}
  235.     -- Magic Haste Set --
  236.     sets.Midcast.Haste = set_combine(sets.PDT,{})
  237. end
  238.  
  239. function pretarget(spell,action)
  240.     if spell.action_type == 'Magic' and buffactive.silence then -- Auto Use Echo Drops If You Are Silenced --
  241.         cancel_spell()
  242.         send_command('input /item "Echo Drops" <me>')
  243.     elseif spell.type == "CorsairRoll" and buffactive[spell.english] then -- Change Any Rolls To Double-Up When You Have A Roll Up --
  244.         cancel_spell()
  245.         send_command('doubleup')
  246.     elseif spell.english == "Seigan" and buffactive.Seigan then -- Change Seigan To Third Eye If Seigan Is On --
  247.         cancel_spell()
  248.         send_command('ThirdEye')
  249.     elseif spell.english == "Meditate" and player.tp > 290 then -- Cancel Meditate If TP Is Above 290 --
  250.         cancel_spell()
  251.         add_to_chat(123, spell.name .. ' Canceled: ' .. player.tp)
  252.     elseif spell.action_type == 'Ranged Attack' then -- Auto WS
  253.         if player.tp >= 100 and AutoMode == 'ON' and not buffactive.amnesia then
  254.             cancel_spell()
  255.             autoWS()
  256.         end
  257.     elseif spell.action_type == 'Ranged Attack' and spell.target.distance > 24.9 then
  258.         cancel_spell()
  259.         add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  260.         return
  261.     elseif spell.type == 'WeaponSkill' and player.status == 'Engaged' then
  262.         if spell.skill == 'Marksmanship' then
  263.             if spell.target.distance > 16+target_distance then
  264.                 cancel_spell()
  265.                 add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  266.                 return
  267.             end
  268.         else
  269.             if spell.target.distance > target_distance then
  270.                 cancel_spell()
  271.                 add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  272.                 return
  273.             end
  274.         end
  275.     end
  276. end
  277.  
  278. function precast(spell,action)
  279.     if spell.action_type == 'Ranged Attack' or spell.type == "WeaponSkill" then
  280.         if player.equipment == "Animikii Bullet" then -- Cancel Ranged Attack or WS If You Have Animikii Bullet Equipped --
  281.             cancel_spell()
  282.             add_to_chat(123, spell.name .. ' Canceled: [Animikii Bullet Equipped!]')
  283.             return
  284.         else
  285.             if spell.action_type == 'Ranged Attack' then
  286.                 equip(sets.Preshot)
  287.             elseif spell.type == "WeaponSkill" then
  288.                 if player.status ~= 'Engaged' then -- Cancel WS If You Are Not Engaged. Can Delete It If You Don't Need It --
  289.                     cancel_spell()
  290.                     add_to_chat(123,'Unable To Use WeaponSkill: [Disengaged]')
  291.                     return
  292.                 else
  293.                     equipSet = sets.WS
  294.                     if equipSet[spell.english] then
  295.                         equipSet = equipSet[spell.english]
  296.                     end
  297.                     if equipSet[AccArray[AccIndex]] then
  298.                         equipSet = equipSet[AccArray[AccIndex]]
  299.                     end
  300.                     if spell.english == "Last Stand" and (player.tp > 299 or buffactive.Sekkanoki) then -- Equip Altdorf's Earring and Wilhelm's Earring When You Have 300 TP or Sekkanoki For Last Stand --
  301.                         equipSet = set_combine(equipSet,{ear1="Altdorf's Earring",ear2="Wilhelm's Earring"})
  302.                     end
  303.                     equip(equipSet)
  304.                 end
  305.             end
  306.         end
  307.     elseif spell.type == "JobAbility" then
  308.         if sets.JA[spell.english] then
  309.             equip(sets.JA[spell.english])
  310.             if spell.english == "Snake Eye" then -- Auto Double-Up After You Use Snake Eye --
  311.                 send_command('@wait 1;input /ja Double-Up <me>')
  312.             end
  313.         end
  314.     elseif spell.type == "CorsairRoll" or spell.english == "Double-Up" then
  315.         equip(sets.Rolls)
  316.         if spell.english == "Tactician's Roll" then
  317.             equip({body="Nvrch. Frac +2"})
  318.         elseif spell.english == "Caster's Roll" then
  319.             equip({legs="Nvrch. Culottes +2"})
  320.         elseif spell.english == "Courser's Roll" then
  321.             equip({feet="Nvrch. Bottes +2"})
  322.         end
  323.     elseif spell.type == "CorsairShot" then
  324.         equipSet = sets.QD
  325.         if ACC_Shots:contains(spell.english) then
  326.             equipSet = sets.QD.HighACC
  327.         else
  328.             if equipSet[AccArray[AccIndex]] then
  329.                 equipSet = equipSet[AccArray[AccIndex]]
  330.             end
  331.             if not ACC_Shots:contains(spell.english) and (world.day_element == spell.element or world.weather_element == spell.element) and sets.Obi[spell.element] and Obi == 'ON' then -- Use Obi Toggle To Unlock Elemental Obi --
  332.                 equipSet = set_combine(equipSet,sets.Obi[spell.element])
  333.             end
  334.         end
  335.         equip(equipSet)
  336.     elseif spell.action_type == 'Magic' then
  337.         if string.find(spell.english,'Utsusemi') then
  338.             if buffactive['Copy Image (3)'] or buffactive['Copy Image (4)'] then
  339.                 cancel_spell()
  340.                 add_to_chat(123, spell.name .. ' Canceled: [3+ Images]')
  341.                 return
  342.             else
  343.                 equip(sets.Precast.FastCast)
  344.             end
  345.         else
  346.             equip(sets.Precast.FastCast)
  347.         end
  348.     elseif spell.type == "Waltz" then
  349.         refine_waltz(spell,action)
  350.         equip(sets.Waltz)
  351.     elseif spell.english == 'Spectral Jig' and buffactive.Sneak then
  352.         cast_delay(0.2)
  353.         send_command('cancel Sneak')
  354.     end
  355. end
  356.  
  357. function midcast(spell,action)
  358.     if spell.action_type == 'Ranged Attack' then
  359.         equipSet = sets.Midshot
  360.         if equipSet[player.equipment.range] then
  361.             equipSet = equipSet[player.equipment.range]
  362.         end
  363.         if equipSet[AccArray[AccIndex]] then
  364.             equipSet = equipSet[AccArray[AccIndex]]
  365.         end
  366.         equip(equipSet)
  367.     elseif spell.action_type == 'Magic' then
  368.         if spell.english == "Stoneskin" then
  369.             if buffactive.Stoneskin then
  370.                 send_command('@wait 2.8;cancel stoneskin')
  371.             end
  372.             equip(sets.Midcast.Stoneskin)
  373.         elseif spell.english == "Sneak" then
  374.             if spell.target.name == player.name and buffactive['Sneak'] then
  375.                 send_command('cancel sneak')
  376.             end
  377.             equip(sets.Midcast.Haste)
  378.         elseif string.find(spell.english,'Utsusemi') then
  379.             if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)']) then
  380.                 send_command('@wait 1.7;cancel Copy Image*')
  381.             end
  382.             equip(sets.Midcast.Haste)
  383.         elseif spell.english == 'Monomi: Ichi' then
  384.             if buffactive['Sneak'] then
  385.                 send_command('@wait 1.7;cancel sneak')
  386.             end
  387.             equip(sets.Midcast.Haste)
  388.         else
  389.             equip(sets.Midcast.Haste)
  390.         end
  391.     end
  392. end
  393.  
  394. function aftercast(spell,action)
  395.     if spell.action_type == 'Ranged Attack' and AutoMode == 'ON' then
  396.         autoRA()
  397.     elseif not spell.interrupted then
  398.         if spell.type == "WeaponSkill" then
  399.             send_command('wait 0.2;gs c TP')
  400.         elseif spell.type == 'CorsairRoll' then
  401.             display_roll_info(spell)
  402.         elseif spell.english == 'Light Shot' then -- Sleep Countdown --
  403.             send_command('wait 50;input /echo '..spell.name..' Effect: [WEARING OFF IN 10 SEC.];wait 10;input /echo '..spell.name..' Effect: [OFF]')
  404.         end
  405.     else
  406.         status_change(player.status)
  407.     end
  408. end
  409.  
  410. function status_change(new,old)
  411.     if Armor == 'PDT' then
  412.         equip(sets.PDT)
  413.     elseif Armor == 'MDT' then
  414.         equip(sets.MDT)
  415.     elseif new == 'Engaged' then
  416.         equipSet = sets.Melee
  417.         if equipSet[AccArray[AccIndex]] then
  418.             equipSet = equipSet[AccArray[AccIndex]]
  419.         end
  420.         equip(equipSet)
  421.     elseif new == 'Idle' then
  422.         equip(sets.Idle[IdleArray[IdleIndex]])
  423.     elseif new == 'Resting' then
  424.         equip(sets.Resting)
  425.     end
  426. end
  427.  
  428. function buff_change(buff,gain)
  429.     buff = string.lower(buff)
  430.     if buff == "aftermath: lv.3" then -- AM3 Timer/Countdown --
  431.         if gain then
  432.             send_command('timers create "Aftermath: Lv.3" 180 down;wait 120;input /echo Aftermath: Lv.3 [WEARING OFF IN 60 SEC.];wait 30;input /echo Aftermath: Lv.3 [WEARING OFF IN 30 SEC.];wait 20;input /echo Aftermath: Lv.3 [WEARING OFF IN 10 SEC.]')
  433.         else
  434.             send_command('timers delete "Aftermath: Lv.3"')
  435.             add_to_chat(123,'AM3: [OFF]')
  436.         end
  437.     elseif buff == 'weakness' then -- Weakness Timer --
  438.         if gain then
  439.             send_command('timers create "Weakness" 300 up')
  440.         else
  441.             send_command('timers delete "Weakness"')
  442.         end
  443.     end
  444.     if not midaction() then
  445.         status_change(player.status)
  446.     end
  447. end
  448.  
  449. -- In Game: //gs c (command), Macro: /console gs c (command), Bind: gs c (command) --
  450. function self_command(command)
  451.     if command == 'C1' then -- Accuracy Level Toggle --
  452.         AccIndex = (AccIndex % #AccArray) + 1
  453.         status_change(player.status)
  454.         add_to_chat(158,'Accuracy Level: ' .. AccArray[AccIndex])
  455.     elseif command == 'C5' then -- Auto Update Gear Toggle --
  456.         status_change(player.status)
  457.         add_to_chat(158,'Auto Update Gear')
  458.     elseif command == 'C3' then -- Obi Toggle --
  459.         if Obi == 'ON' then
  460.             Obi = 'OFF'
  461.             add_to_chat(123,'Obi: [OFF]')
  462.         else
  463.             Obi = 'ON'
  464.             add_to_chat(158,'Obi: [ON]')
  465.         end
  466.         status_change(player.status)
  467.     elseif command == 'C7' then -- PDT Toggle --
  468.         if Armor == 'PDT' then
  469.             Armor = 'None'
  470.             add_to_chat(123,'PDT Set: [Unlocked]')
  471.         else
  472.             Armor = 'PDT'
  473.             add_to_chat(158,'PDT Set: [Locked]')
  474.         end
  475.         status_change(player.status)
  476.     elseif command == 'C15' then -- MDT Toggle --
  477.         if Armor == 'MDT' then
  478.             Armor = 'None'
  479.             add_to_chat(123,'MDT Set: [Unlocked]')
  480.         else
  481.             Armor = 'MDT'
  482.             add_to_chat(158,'MDT Set: [Locked]')
  483.         end
  484.         status_change(player.status)
  485.     elseif command == 'C8' then -- Distance Toggle --
  486.         if player.target.distance then
  487.             target_distance = math.floor(player.target.distance*10)/10
  488.             add_to_chat(158,'Distance: '..target_distance)
  489.         else
  490.             add_to_chat(123,'No Target Selected')
  491.         end
  492.     elseif command == 'C6' then -- Idle Toggle --
  493.         IdleIndex = (IdleIndex % #IdleArray) + 1
  494.         status_change(player.status)
  495.         add_to_chat(158,'Idle Set: ' .. IdleArray[IdleIndex])
  496.     elseif command == 'C2' then -- Auto RA/WS Toggle. *Don't Rely On This. It Isn't As Fast As Shooting Manually. It Is Mainly For AFK or When You Dualbox* --
  497.         if AutoMode == 'ON' then
  498.             AutoMode = 'OFF'
  499.             add_to_chat(123,'Auto Mode: [OFF]')
  500.         else
  501.             AutoMode = 'ON'
  502.             add_to_chat(158,'Auto Mode: [ON]')
  503.         end
  504.     elseif command == 'TP' then
  505.         add_to_chat(158,'TP Return: ['..tostring(player.tp)..']')
  506.     elseif command:match('^SC%d$') then
  507.         send_command('//' .. sc_map[command])
  508.     end
  509. end
  510.  
  511. function autoRA()
  512.     send_command('@wait 2.7; input /ra <t>')
  513. end
  514.  
  515. function autoWS() -- Change Auto WS Here --
  516.     send_command('input /ws "Last Stand" <t>')
  517. end
  518.  
  519. function define_roll_values()
  520.     rolls = {
  521.         CorsairsRoll        = {lucky=5, unlucky=9, bonus="Experience Points"},
  522.         NinjaRoll       = {lucky=4, unlucky=8, bonus="Evasion"},
  523.         HuntersRoll     = {lucky=4, unlucky=8, bonus="Accuracy"},
  524.         ChaosRoll       = {lucky=4, unlucky=8, bonus="Attack"},
  525.         MagussRoll      = {lucky=2, unlucky=6, bonus="Magic Defense"},
  526.         HealersRoll     = {lucky=3, unlucky=7, bonus="Cure Potency Received"},
  527.         PuppetRoll      = {lucky=4, unlucky=8, bonus="Pet Magic Accuracy/Attack"},
  528.         ChoralRoll      = {lucky=2, unlucky=6, bonus="Spell Interruption Rate"},
  529.         MonksRoll       = {lucky=3, unlucky=7, bonus="Subtle Blow"},
  530.         BeastRoll       = {lucky=4, unlucky=8, bonus="Pet Attack"},
  531.         SamuraiRoll     = {lucky=2, unlucky=6, bonus="Store TP"},
  532.         EvokersRoll     = {lucky=5, unlucky=9, bonus="Refresh"},
  533.         RoguesRoll      = {lucky=5, unlucky=9, bonus="Critical Hit Rate"},
  534.         WarlocksRoll        = {lucky=4, unlucky=8, bonus="Magic Accuracy"},
  535.         FightersRoll        = {lucky=5, unlucky=9, bonus="Double Attack Rate"},
  536.         DrachenRoll     = {lucky=3, unlucky=7, bonus="Pet Accuracy"},
  537.         GallantsRoll        = {lucky=3, unlucky=7, bonus="Defense"},
  538.         WizardsRoll     = {lucky=5, unlucky=9, bonus="Magic Attack"},
  539.         DancersRoll     = {lucky=3, unlucky=7, bonus="Regen"},
  540.         ScholarsRoll        = {lucky=2, unlucky=6, bonus="Conserve MP"},
  541.         BoltersRoll     = {lucky=3, unlucky=9, bonus="Movement Speed"},
  542.         CastersRoll     = {lucky=2, unlucky=7, bonus="Fast Cast"},
  543.         CoursersRoll        = {lucky=3, unlucky=9, bonus="Snapshot"},
  544.         BlitzersRoll        = {lucky=4, unlucky=9, bonus="Attack Delay"},
  545.         TacticiansRoll      = {lucky=5, unlucky=8, bonus="Regain"},
  546.         AlliessRoll     = {lucky=3, unlucky=10, bonus="Skillchain Damage"},
  547.         MisersRoll      = {lucky=5, unlucky=7, bonus="Save TP"},
  548.         CompanionsRoll      = {lucky=2, unlucky=10, bonus="Pet Regain and Regen"},
  549.         AvengersRoll        = {lucky=4, unlucky=8, bonus="Counter Rate"}
  550.         }
  551. end
  552.  
  553. function display_roll_info(spell)
  554.     rollinfo = rolls[(string.gsub((string.gsub(spell.english, "%'+", "")), "%s+", ""))]
  555.     if rollinfo then
  556.         add_to_chat(158, spell.english..' = '..rollinfo.bonus..'. Lucky Roll is '..
  557.             tostring(rollinfo.lucky)..', Unlucky Roll is '..tostring(rollinfo.unlucky)..'.')
  558.     end
  559. end
  560.  
  561. function refine_waltz(spell,action)
  562.     if spell.type ~= 'Waltz' then
  563.         return
  564.     end
  565.  
  566.     if spell.name == "Healing Waltz" or spell.name == "Divine Waltz" or spell.name == "Divine Waltz II" then
  567.         return
  568.     end
  569.  
  570.     local newWaltz = spell.english
  571.            
  572.     local missingHP = 0
  573.     local targ
  574.  
  575.     if spell.target.type == "SELF" then
  576.         targ = alliance[1][1]
  577.         missingHP = player.max_hp - player.hp
  578.     elseif spell.target.isallymember then
  579.         targ = find_player_in_alliance(spell.target.name)
  580.         local est_max_hp = targ.hp / (targ.hpp/100)
  581.         missingHP = math.floor(est_max_hp - targ.hp)
  582.     end
  583.  
  584.     if targ then
  585.         if player.sub_job == 'DNC' then
  586.             if missingHP < 40 then
  587.                 add_to_chat(123,'Full HP!')
  588.                 cancel_spell()
  589.                 return
  590.             elseif missingHP < 150 then
  591.                 newWaltz = 'Curing Waltz'
  592.             elseif missingHP < 300 then
  593.                 newWaltz = 'Curing Waltz II'
  594.             else
  595.                 newWaltz = 'Curing Waltz III'
  596.             end
  597.         else
  598.             return
  599.         end
  600.     end
  601.  
  602.     local waltzTPCost = {['Curing Waltz'] = 20,['Curing Waltz II'] = 35,['Curing Waltz III'] = 50,['Curing Waltz IV'] = 65,['Curing Waltz V'] = 80}
  603.     local tpCost = waltzTPCost[newWaltz]
  604.     local downgrade
  605.  
  606.     if player.tp < tpCost and not buffactive.trance then       
  607.         if player.tp < 20 then
  608.             add_to_chat(123, 'Insufficient TP ['..tostring(player.tp)..']. Cancelling.')
  609.             cancel_spell()
  610.             return
  611.         elseif player.tp < 35 then
  612.             newWaltz = 'Curing Waltz'
  613.         elseif player.tp < 50 then
  614.             newWaltz = 'Curing Waltz II'
  615.         elseif player.tp < 65 then
  616.             newWaltz = 'Curing Waltz III'
  617.         elseif player.tp < 80 then
  618.             newWaltz = 'Curing Waltz IV'
  619.         end
  620.         downgrade = 'Insufficient TP ['..tostring(player.tp)..']. Downgrading to '..newWaltz..'.'
  621.     end
  622.  
  623.     if newWaltz ~= spell.english then
  624.         send_command('wait 0.03;input /ja "'..newWaltz..'" '..tostring(spell.target.raw))
  625.         if downgrade then
  626.             add_to_chat(158, downgrade)
  627.         end
  628.         cancel_spell()
  629.         return
  630.     end
  631.  
  632.     if missingHP > 0 then
  633.         add_to_chat(158,'Trying to cure '..tostring(missingHP)..' HP using '..newWaltz..'.')
  634.     end
  635. end
  636.  
  637. function find_player_in_alliance(name)
  638.     for i,v in ipairs(alliance) do
  639.         for k,p in ipairs(v) do
  640.             if p.name == name then
  641.                 return p
  642.             end
  643.         end
  644.     end
  645. end
  646.  
  647. function actualCost(originalCost)
  648.     if buffactive["Penury"] then
  649.         return originalCost*.5
  650.     elseif buffactive["Light Arts"] then
  651.         return originalCost*.9
  652.     else
  653.         return originalCost
  654.     end
  655. end
  656.  
  657. function degrade_spell(spell,degrade_array)
  658.     spell_index = table.find(degrade_array,spell.name)
  659.     if spell_index>1 then
  660.         new_spell = degrade_array[spell_index - 1]
  661.         change_spell(new_spell,spell.target.raw)
  662.         add_to_chat(8,spell.name..' Canceled: ['..player.mp..'/'..player.max_mp..'MP::'..player.mpp..'%] Casting '..new_spell..' instead.')
  663.     end
  664. end
  665.  
  666. function change_spell(spell_name,target)
  667.     cancel_spell()
  668.     send_command('//'..spell_name..' '..target)
  669. end
  670.  
  671. function sub_job_change(newSubjob, oldSubjob)
  672.     select_default_macro_book()
  673. end
  674.  
  675. function set_macro_page(set,book)
  676.     if not tonumber(set) then
  677.         add_to_chat(123,'Error setting macro page: Set is not a valid number ('..tostring(set)..').')
  678.         return
  679.     end
  680.     if set < 1 or set > 10 then
  681.         add_to_chat(123,'Error setting macro page: Macro set ('..tostring(set)..') must be between 1 and 10.')
  682.         return
  683.     end
  684.  
  685.     if book then
  686.         if not tonumber(book) then
  687.             add_to_chat(123,'Error setting macro page: book is not a valid number ('..tostring(book)..').')
  688.             return
  689.         end
  690.         if book < 1 or book > 20 then
  691.             add_to_chat(123,'Error setting macro page: Macro book ('..tostring(book)..') must be between 1 and 20.')
  692.             return
  693.         end
  694.         send_command('@input /macro book '..tostring(book)..';wait .1;input /macro set '..tostring(set))
  695.     else
  696.         send_command('@input /macro set '..tostring(set))
  697.     end
  698. end
  699.  
  700. function select_default_macro_book()
  701.     -- Default macro set/book
  702.     if player.sub_job == 'SAM' then
  703.         set_macro_page(1, 5)
  704.     elseif player.sub_job == 'WHM' then
  705.         set_macro_page(2, 5)
  706.     elseif player.sub_job == 'DNC' then
  707.         set_macro_page(3, 5)
  708.     elseif player.sub_job == 'NIN' then
  709.         set_macro_page(5, 5)
  710.     elseif player.sub_job == 'RDM' then
  711.         set_macro_page(8, 5)
  712.     elseif player.sub_job == 'WAR' then
  713.         set_macro_page(9, 5)
  714.     elseif player.sub_job == 'DRG' then
  715.         set_macro_page(10, 5)
  716.     else
  717.         set_macro_page(1, 5)
  718.     end
  719. end
Advertisement
Add Comment
Please, Sign In to add comment