Advertisement
Bokura

Bokura_BST

Mar 11th, 2014
1,351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 23.10 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.     JugIndex = 1
  8.     JugArray = {"Meaty Broth","Windy Greens","Muddy Broth","Blackwater Broth","Tant. Broth","Bubbly Broth","Livid Broth","Trans. Broth"} -- Default Jug Is Meaty Broth. Add/Delete Jugs Here --
  9.     PetFoodIndex = 1
  10.     PetFoodArray = {"Pet Food Theta","Pet Food Eta","Pet Food Zeta"} -- Default Pet Food Is Theta --
  11.     IdleIndex = 1
  12.     IdleArray = {"Movement","Regen"} -- Default Idle Set Is Movement --
  13.     PetIndex = 1
  14.     PetArray = {"Haste","PDT","ACC"} -- Default Pet TP Set Is Haste --
  15.     WeaponIndex = 1
  16.     WeaponArray = {"Melee","PDT","Sic"} -- Default Weapon Type Is Melee. Don't Input Main/Sub In TP Sets. Melee = Damage Type Axes | PDT = Pet PDT/DT Type Axes | Sic = Sic/Ready Type Axes --
  17.     Armor = 'None'
  18.     Twilight = 'None'
  19.     Pet = 'OFF' -- Set Default Pet Set ON or OFF Here --
  20.     target_distance = 5 -- Set Default Distance Here --
  21.     select_default_macro_book() -- Change Default Macro Book At The End --
  22.  
  23.     -- Gavialis Helm --
  24.     elements = {}
  25.     elements.equip = {head="Gavialis Helm"}
  26.     elements.Ruinator = S{"Ice","Water","Wind"}
  27.     elements.Rampage = S{"Earth"}
  28.  
  29.     -- Ready Moves: Magic Type --
  30.     Magical_Ready_Moves = S{
  31.             'Acid Mist','Aqua Breath','Blaster','Bubble Shower','Chaotic Eye','Charged Whisker','Corrosive Ooze',
  32.             'Cursed Sphere','Dark Spore','Drainkiss','Dream Flower','Dust Cloud','Filamented Hold','Fireball',
  33.             'Foul Waters','Geist Wall','Gloeosuccus','Hi-Freq Field','Infrasonics','Intimidate','Jettatura',
  34.             'Molting Plumage','Nectarous Deluge','Nepenthic Plunge','Noisome Powder','Numbing Noise','Numbshroom',
  35.             'Palsy Pollen','Pestilent Plume','Plague Breath','Purulent Ooze','Queasyshroom','Roar','Sandblast','Sandpit',
  36.             'Scream','Shakeshroom','Sheep Song','Silence Gas','Snow Cloud','Soporific','Spider Web','Spoil','Spore',
  37.             'Stink Bomb','Toxic Spit','TP Drainkiss','Venom','Venom Spray'}
  38.  
  39.     Cure_Spells = {"Cure","Cure II","Cure III","Cure IV"} -- Cure Degradation --
  40.     Curaga_Spells = {"Curaga","Curaga II"} -- Curaga Degradation --
  41.     sc_map = {SC1="Ruinator", SC2="Berserk", SC3="Aggressor"} -- 3 Additional Binds. Can Change Whatever JA/WS/Spells You Like Here. Remember Not To Use Spaces. --
  42.  
  43.     sets.Idle = {}
  44.     -- Regen Set --
  45.     sets.Idle.Regen = {}
  46.  
  47.     -- Damage Type Axe & Shield --
  48.     sets.Idle.Regen.Melee = set_combine(sets.Idle.Regen,{
  49.             main="Hunahpu",
  50.             sub="Beatific Shield +1"})
  51.     -- Damage Type Axes: NIN Sub --
  52.     sets.Idle.Regen.Melee.NIN = set_combine(sets.Idle.Regen,{
  53.             main="Hunahpu",
  54.             sub="Hatxiik"})
  55.     -- Damage Type Axes: DNC Sub --
  56.     sets.Idle.Regen.Melee.DNC = set_combine(sets.Idle.Regen,{
  57.             main="Hunahpu",
  58.             sub="Hatxiik"})
  59.  
  60.     -- Pet PDT/DT Type Axe & Shield --
  61.     sets.Idle.Regen.PDT = set_combine(sets.Idle.Regen,{
  62.             main="Izizoeksi",
  63.             sub="Beatific Shield +1"})
  64.     -- Pet PDT/DT Type Axes: NIN Sub --
  65.     sets.Idle.Regen.PDT.NIN = set_combine(sets.Idle.Regen,{
  66.             main="Izizoeksi",
  67.             sub="Astolfo"})
  68.     -- Pet PDT/DT Type Axes: DNC Sub --
  69.     sets.Idle.Regen.PDT.DNC = set_combine(sets.Idle.Regen,{
  70.             main="Izizoeksi",
  71.             sub="Astolfo"})
  72.  
  73.     -- Sic/Ready Type Axe & Shield --
  74.     sets.Idle.Regen.Sic = set_combine(sets.Idle.Regen,{
  75.             main="Charmer's Merlin",
  76.             sub="Beatific Shield +1"})
  77.     -- Sic/Ready Type Axes: NIN Sub --
  78.     sets.Idle.Regen.Sic.NIN = set_combine(sets.Idle.Regen,{
  79.             main="Aymur",
  80.             sub="Charmer's Merlin"})
  81.     -- Sic/Ready Type Axes: DNC Sub --
  82.     sets.Idle.Regen.Sic.DNC = set_combine(sets.Idle.Regen,{
  83.             main="Aymur",
  84.             sub="Charmer's Merlin"})
  85.  
  86.     -- Movement Set --
  87.     sets.Idle.Movement = set_combine(sets.Idle.Regen,{
  88.             feet="Skd. Jambeaux +1"})
  89.  
  90.     -- Damage Type Axe & Shield --
  91.     sets.Idle.Movement.Melee = set_combine(sets.Idle.Movement,{
  92.             main="Hunahpu",
  93.             sub="Beatific Shield +1"})
  94.     -- Damage Type Axes: NIN Sub --
  95.     sets.Idle.Movement.Melee.NIN = set_combine(sets.Idle.Movement,{
  96.             main="Hunahpu",
  97.             sub="Hatxiik"})
  98.     -- Damage Type Axes: DNC Sub --
  99.     sets.Idle.Movement.Melee.DNC = set_combine(sets.Idle.Movement,{
  100.             main="Hunahpu",
  101.             sub="Hatxiik"})
  102.  
  103.     -- Pet PDT/DT Type Axe & Shield --
  104.     sets.Idle.Movement.PDT = set_combine(sets.Idle.Movement,{
  105.             main="Izizoeksi",
  106.             sub="Beatific Shield +1"})
  107.     -- Pet PDT/DT Type Axes: NIN Sub --
  108.     sets.Idle.Movement.PDT.NIN = set_combine(sets.Idle.Movement,{
  109.             main="Izizoeksi",
  110.             sub="Astolfo"})
  111.     -- Pet PDT/DT Type Axes: DNC Sub --
  112.     sets.Idle.Movement.PDT.DNC = set_combine(sets.Idle.Movement,{
  113.             main="Izizoeksi",
  114.             sub="Astolfo"})
  115.  
  116.     -- Sic/Ready Type Axe & Shield --
  117.     sets.Idle.Movement.Sic = set_combine(sets.Idle.Movement,{
  118.             main="Charmer's Merlin",
  119.             sub="Beatific Shield +1"})
  120.     -- Sic/Ready Type Axes: NIN Sub --
  121.     sets.Idle.Movement.Sic.NIN = set_combine(sets.Idle.Movement,{
  122.             main="Aymur",
  123.             sub="Charmer's Merlin"})
  124.     -- Sic/Ready Type Axes: DNC Sub --
  125.     sets.Idle.Movement.Sic.DNC = set_combine(sets.Idle.Movement,{
  126.             main="Aymur",
  127.             sub="Charmer's Merlin"})
  128.  
  129.     sets.Twilight = {head="Twilight Helm",body="Twilight Mail"}
  130.  
  131.     -- TP Base Set --
  132.     sets.TP = {}
  133.  
  134.     --Normal TP Sets --
  135.     sets.TP = {}
  136.     sets.TP.MidACC = set_combine(sets.TP,{})
  137.     sets.TP.HighACC = set_combine(sets.TP.MidACC,{})
  138.  
  139.     -- High Haste Sets --
  140.     -- March x2 + Haste --
  141.     -- Embrava + (March or Haste) --
  142.     -- Geo Haste + (March or Haste or Embrava) --
  143.     sets.TP.HighHaste = set_combine(sets.TP,{})
  144.     sets.TP.MidACC.HighHaste = set_combine(sets.TP.HighHaste,{})
  145.     sets.TP.HighACC.HighHaste = set_combine(sets.TP.MidACC.HighHaste,{})
  146.  
  147.     sets.TP.Pet = {}
  148.     -- Pet Haste Gear --
  149.     sets.TP.Pet.Haste = {}
  150.  
  151.     -- Pet PDT Gear --
  152.     sets.TP.Pet.PDT = set_combine(sets.TP.Pet.Haste,{})
  153.  
  154.     -- Pet ACC Gear --
  155.     sets.TP.Pet.ACC = set_combine(sets.TP.Pet.Haste,{})
  156.  
  157.     -- PDT/MDT/Kiting Sets --
  158.     sets.PDT = {}
  159.  
  160.     sets.MDT = set_combine(sets.PDT,{})
  161.  
  162.     sets.Kiting = set_combine(sets.PDT,{feet="Skd. Jambeaux +1"})
  163.  
  164.     -- Hybrid Sets --
  165.     sets.TP.Hybrid = set_combine(sets.PDT,{})
  166.     sets.TP.Hybrid.MidACC = set_combine(sets.TP.Hybrid,{})
  167.     sets.TP.Hybrid.HighACC = set_combine(sets.TP.Hybrid.MidACC,{})
  168.  
  169.     -- WS Base Set --
  170.     sets.WS = {}
  171.  
  172.     -- WS Sets --
  173.     sets.WS.Ruinator = {}
  174.     sets.WS.Ruinator.MidACC = set_combine(sets.WS.Ruinator,{})
  175.     sets.WS.Ruinator.HighACC = set_combine(sets.WS.Ruinator.MidACC,{})
  176.            
  177.     sets.WS.Onslaught = {}
  178.  
  179.     sets.WS.Cloudsplitter = {}
  180.  
  181.     sets.WS["Primal Rend"] = {}
  182.  
  183.     sets.WS.Rampage = {}
  184.  
  185.     -- JA Sets --
  186.     sets.JA = {}
  187.     TH_Gear = {waist="Chaac Belt"}
  188.     sets.JA.Reward = {body="An. Jackcoat +1",legs="Ankusa Trousers +1",feet="Ankusa Gaiters +1"}
  189.     sets.JA.Charm = {}
  190.     sets.JA.Tame = {head="Totemic Helm +1"}
  191.     sets.JA.Familiar = {legs="Ankusa Trousers +1"}
  192.     sets.JA["Call Beast"] = {body="Mirke Wardecors",hands="Ankusa Gloves +1",feet="Armada Sollerets"}
  193.     sets.JA["Bestial Loyalty"] = sets.JA["Call Beast"]
  194.     sets.JA["Feral Howl"] = {body="An. Jackcoat +1",waist="Chaac Belt"}
  195.     sets.JA["Killer Instinct"] = {head="Ankusa Helm +1"}
  196.     sets.JA.Provoke = TH_Gear
  197.     sets.JA.Steal = TH_Gear
  198.     sets.JA.Mug = TH_Gear
  199.  
  200.     sets.Pet = {}
  201.     sets.Pet.Sic = {legs="Desultor Tassets"}
  202.     sets.Pet.Ready = {legs="Desultor Tassets"}
  203.     sets.Pet.Spur = {feet="Nukumi Ocreae +1"}
  204.  
  205.     -- Physical Type Ready Moves: Add Pet Attack & Accuracy Gear Here --
  206.     sets.Physical_Ready_Moves = {hands="Nukumi Manoplas +1"}
  207.  
  208.     -- Magic Type Ready Moves: Add Pet Magic Attack & Magic Accuracy Gear Here --
  209.     sets.Magical_Ready_Moves = {}
  210.  
  211.     -- Step Set --
  212.     sets.Step = set_combine({},TH_Gear)
  213.  
  214.     -- Flourish Set --
  215.     sets.Flourish = set_combine({},TH_Gear)
  216.  
  217.     -- Waltz Set --
  218.     sets.Waltz = {}
  219.  
  220.     sets.Precast = {}
  221.     -- Fastcast Set --
  222.     sets.Precast.FastCast = {}
  223.  
  224.     sets.Midcast = {}
  225.     -- Magic Haste Set --
  226.     sets.Midcast.Haste = set_combine(sets.PDT,{})
  227.  
  228.     -- Cure Set --
  229.     sets.Midcast.Cure = {
  230.             neck="Phalaina Locket",
  231.             hands="Macabre Gaunt. +1",
  232.             ring1="Asklepian Ring",
  233.             ring2="Kunaji Ring",
  234.             belt="Chuq'aba Belt"}
  235. end
  236.  
  237. function pretarget(spell,action)
  238.     if midaction() or pet_midaction() then
  239.         cancel_spell()
  240.         return
  241.     elseif spell.action_type == 'Magic' and buffactive.silence then -- Auto Use Echo Drops If You Are Silenced --
  242.         cancel_spell()
  243.         send_command('input /item "Echo Drops" <me>')
  244.     elseif spell.english == "Berserk" and buffactive.Berserk then -- Change Berserk To Aggressor If Berserk Is On --
  245.         cancel_spell()
  246.         send_command('Aggressor')
  247.     elseif spell.type == 'WeaponSkill' and player.status == 'Engaged' then
  248.         if spell.english ~= 'Bora Axe' and spell.name ~= 'Mistral Axe' and spell.target.distance > target_distance then -- Cancel WS If You Are Out Of Range --
  249.             cancel_spell()
  250.             add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  251.             return
  252.         end
  253.     elseif spell.english:ifind("Cure") and player.mp<actualCost(spell.mp_cost) then
  254.         degrade_spell(spell,Cure_Spells)
  255.     elseif spell.english:ifind("Curaga") and player.mp<actualCost(spell.mp_cost) then
  256.         degrade_spell(spell,Curaga_Spells)
  257.     end
  258. end
  259.  
  260. function precast(spell,action)
  261.     if midaction() or pet_midaction() then
  262.         cancel_spell()
  263.         return
  264.     elseif spell.type == "WeaponSkill" then
  265.         if player.status ~= 'Engaged' then -- Cancel WS If You Are Not Engaged. Can Delete It If You Don't Need It --
  266.             cancel_spell()
  267.             add_to_chat(123,'Unable To Use WeaponSkill: [Disengaged]')
  268.             return
  269.         else
  270.             equipSet = sets.WS
  271.             if equipSet[spell.english] then
  272.                 equipSet = equipSet[spell.english]
  273.             end
  274.             if equipSet[AccArray[AccIndex]] then
  275.                 equipSet = equipSet[AccArray[AccIndex]]
  276.             end
  277.             if elements[spell.name] and elements[spell.name]:contains(world.day_element) then
  278.                 equipSet = set_combine(equipSet,elements.equip)
  279.             end
  280.             if buffactive['Killer Instinct'] then
  281.                 equipSet = set_combine(equipSet,{body="Nukumi Gausape +1"})
  282.             end
  283.             if buffactive['Reive Mark'] then -- Equip Ygnas's Resolve +1 During Reive --
  284.                 equipSet = set_combine(equipSet,{neck="Ygnas's Resolve +1"})
  285.             end
  286.             if spell.english == "Ruinator" or spell.english == "Rampage" then
  287.                 if world.time <= (7*60) or world.time >= (17*60) then -- Equip Lugra Earring +1 From Dusk To Dawn --
  288.                     equipSet = set_combine(equipSet,{ear1="Lugra Earring +1"})
  289.                 end
  290.             end
  291.             equip(equipSet)
  292.         end
  293.     elseif spell.type == "JobAbility" then
  294.         if sets.JA[spell.english] then
  295.             equip(sets.JA[spell.english])
  296.         end
  297.     elseif spell.action_type == 'Magic' then
  298.         if spell.english == 'Utsusemi: Ni' then
  299.             if buffactive['Copy Image (3)'] then
  300.                 cancel_spell()
  301.                 add_to_chat(123, spell.name .. ' Canceled: [3 Images]')
  302.                 return
  303.             else
  304.                 equip(sets.Precast.FastCast)
  305.             end
  306.         else
  307.             equip(sets.Precast.FastCast)
  308.         end
  309.     elseif spell.type == "Waltz" then
  310.         refine_waltz(spell,action)
  311.         equip(sets.Waltz)
  312.     elseif spell.english == 'Spectral Jig' and buffactive.Sneak then
  313.         cast_delay(0.2)
  314.         send_command('cancel Sneak')
  315.     elseif spell.type == "PetCommand" then
  316.         equip(sets.Pet[spell.english])
  317.     end
  318.     if Pet == 'ON' then -- Use Pet Toggle For Pet TP Set --
  319.         equip(sets.TP.Pet[PetArray[PetIndex]])
  320.     end
  321.     if Twilight == 'Twilight' then
  322.         equip(sets.Twilight)
  323.     end
  324. end
  325.  
  326. function midcast(spell,action)
  327.     if pet_midaction() then
  328.         return
  329.     elseif spell.action_type == 'Magic' then
  330.         if spell.english:startswith('Cur') and spell.english ~= "Cursna" then
  331.             equip(sets.Midcast.Cure)
  332.         elseif spell.english:startswith('Utsusemi') then
  333.             if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)'] or buffactive['Copy Image (3)']) then
  334.                 send_command('@wait 1.7;cancel Copy Image*')
  335.             end
  336.             equip(sets.Midcast.Haste)
  337.         elseif spell.english == 'Monomi: Ichi' then -- Cancel Sneak --
  338.             if buffactive['Sneak'] then
  339.                 send_command('@wait 1.7;cancel sneak')
  340.             end
  341.             equip(sets.Midcast.Haste)
  342.         elseif spell.english == 'Flash' or spell.english == 'Drain' or spell.english == 'Aspir' or spell.english == 'Dispel' or spell.english:startswith('Dia') or spell.english:startswith('Bio') or spell.english:startswith('Sleep') then
  343.             equip(set_combine(sets.Midcast.Haste,{waist="Chaac Belt"}))
  344.         else
  345.             equip(sets.Midcast.Haste)
  346.         end
  347.     end
  348. end
  349.  
  350. function aftercast(spell,action)
  351.     if pet_midaction() then
  352.         return
  353.     elseif spell.type == "WeaponSkill" and not spell.interrupted then
  354.         send_command('wait 0.2;gs c TP')
  355.     elseif not spell.type == "PetCommand" then
  356.         status_change(player.status)
  357.     end
  358. end
  359.  
  360. function status_change(new,old)
  361.     check_equip_lock()
  362.     if Armor == 'PDT' then
  363.         equip(sets.PDT)
  364.     elseif Armor == 'MDT' then
  365.         equip(sets.MDT)
  366.     elseif Armor == 'Kiting' then
  367.         equip(sets.Kiting)
  368.     elseif new == 'Engaged' then
  369.         equipSet = sets.TP
  370.         if Armor == 'Hybrid' and equipSet["Hybrid"] then
  371.             equipSet = equipSet["Hybrid"]
  372.         end
  373.         if equipSet[AccArray[AccIndex]] then
  374.             equipSet = equipSet[AccArray[AccIndex]]
  375.         end
  376.         if (buffactive.Embrava and (buffactive.March or buffactive.Haste)) or (buffactive.March == 2 and buffactive.Haste) or (buffactive[580] and (buffactive.March or buffactive.Haste or buffactive.Embrava)) and equipSet["HighHaste"] then
  377.             equipSet = equipSet["HighHaste"]
  378.         end
  379.         equip(equipSet)
  380.     else
  381.         equipSet = sets.Idle
  382.         if equipSet[IdleArray[IdleIndex]] then
  383.             equipSet = equipSet[IdleArray[IdleIndex]]
  384.         end
  385.         if equipSet[WeaponArray[WeaponIndex]] then
  386.             equipSet = equipSet[WeaponArray[WeaponIndex]]
  387.         end
  388.         if equipSet[player.sub_job] then
  389.             equipSet = equipSet[player.sub_job]
  390.         end
  391.         if buffactive['Reive Mark'] then -- Equip Ygnas's Resolve +1 During Reive --
  392.             equipSet = set_combine(equipSet,{neck="Ygnas's Resolve +1"})
  393.         end
  394.         if world.area:endswith('Adoulin') then
  395.             equipSet = set_combine(equipSet,{body="Councilor's Garb"})
  396.         end
  397.         equip(equipSet)
  398.     end
  399.     if Pet == 'ON' then -- Use Pet Toggle For Pet TP Set --
  400.         equip(sets.TP.Pet[PetArray[PetIndex]])
  401.     end
  402.     if Twilight == 'Twilight' then
  403.         equip(sets.Twilight)
  404.     end
  405. end
  406.  
  407. function buff_change(buff,gain)
  408.     buff = string.lower(buff)
  409.     if buff == "aftermath: lv.3" then -- AM3 Timer/Countdown --
  410.         if gain then
  411.             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.]')
  412.         else
  413.             send_command('timers delete "Aftermath: Lv.3"')
  414.             add_to_chat(123,'AM3: [OFF]')
  415.         end
  416.     elseif buff == 'weakness' then -- Weakness Timer --
  417.         if gain then
  418.             send_command('timers create "Weakness" 300 up')
  419.         else
  420.             send_command('timers delete "Weakness"')
  421.         end
  422.     end
  423.     if not midaction() and not pet_midaction() then
  424.         status_change(player.status)
  425.     end
  426. end
  427.  
  428. function pet_midcast(spell,action)
  429.     if spell.target.type == 'MONSTER' then
  430.         if Magical_Ready_Moves:contains(spell.english) then
  431.             equip(sets.Magical_Ready_Moves)
  432.         else
  433.             equip(sets.Physical_Ready_Moves)
  434.         end
  435.     end
  436. end
  437.  
  438. function pet_aftercast(spell,action)
  439.     status_change(player.status)
  440. end
  441.  
  442. function pet_change(pet,gain)
  443.     status_change(player.status)
  444. end
  445.  
  446. -- In Game: //gs c (command), Macro: /console gs c (command), Bind: gs c (command) --
  447. function self_command(command)
  448.     if command == 'C1' then -- Accuracy Level Toggle --
  449.         AccIndex = (AccIndex % #AccArray) + 1
  450.         add_to_chat(158,'Accuracy Level: ' .. AccArray[AccIndex])
  451.         status_change(player.status)
  452.     elseif command == 'C5' then -- Auto Update Gear Toggle --
  453.         status_change(player.status)
  454.         add_to_chat(158,'Auto Update Gear')
  455.     elseif command == 'C17' then -- Weapon Type Toggle --
  456.         WeaponIndex = (WeaponIndex % #WeaponArray) + 1
  457.         add_to_chat(158,'Weapon Type: '..WeaponArray[WeaponIndex])
  458.         status_change(player.status)
  459.     elseif command == 'C16' then -- Pet TP Set Toggle --
  460.         PetIndex = (PetIndex % #PetArray) + 1
  461.         add_to_chat(158,'Pet TP Set: ' .. PetArray[PetIndex])
  462.         status_change(player.status)
  463.     elseif command == 'C10' then -- Jug Toggle --
  464.         JugIndex = (JugIndex % #JugArray) + 1
  465.         add_to_chat(158,'Jug: ' .. JugArray[JugIndex])
  466.         sets.JA['Call Beast'].ammo = JugArray[JugIndex]
  467.         status_change(player.status)
  468.     elseif command == 'C11' then -- Pet Food Toggle --
  469.         PetFoodIndex = (PetFoodIndex % #PetFoodArray) + 1
  470.         add_to_chat(158,'Pet Food: ' .. PetFoodArray[PetFoodIndex])
  471.         sets.JA.Reward.ammo = PetFoodArray[PetFoodIndex]
  472.         status_change(player.status)
  473.     elseif command == 'C2' then -- Hybrid Toggle --
  474.         if Armor == 'Hybrid' then
  475.             Armor = 'None'
  476.             add_to_chat(123,'Hybrid Set: [Unlocked]')
  477.         else
  478.             Armor = 'Hybrid'
  479.             add_to_chat(158,'Hybrid Set: '..AccArray[AccIndex])
  480.         end
  481.         status_change(player.status)
  482.     elseif command == 'C7' then -- PDT Toggle --
  483.         if Armor == 'PDT' then
  484.             Armor = 'None'
  485.             add_to_chat(123,'PDT Set: [Unlocked]')
  486.         else
  487.             Armor = 'PDT'
  488.             add_to_chat(158,'PDT Set: [Locked]')
  489.         end
  490.         status_change(player.status)
  491.     elseif command == 'C15' then -- MDT Toggle --
  492.         if Armor == 'MDT' then
  493.             Armor = 'None'
  494.             add_to_chat(123,'MDT Set: [Unlocked]')
  495.         else
  496.             Armor = 'MDT'
  497.             add_to_chat(158,'MDT Set: [Locked]')
  498.         end
  499.         status_change(player.status)
  500.     elseif command == 'C12' then -- Kiting Toggle --
  501.         if Armor == 'Kiting' then
  502.             Armor = 'None'
  503.             add_to_chat(123,'Kiting Set: [Unlocked]')
  504.         else
  505.             Armor = 'Kiting'
  506.             add_to_chat(158,'Kiting Set: [Locked]')
  507.         end
  508.         status_change(player.status)
  509.     elseif command == 'C9' then -- Pet Toggle --
  510.         if Pet == 'ON' then
  511.             Pet = 'OFF'
  512.             add_to_chat(123,'Pet Set: [Unlocked]')
  513.         else
  514.             Pet = 'ON'
  515.             add_to_chat(158,'Pet Set: [Locked]')
  516.         end
  517.         status_change(player.status)
  518.     elseif command == 'C3' then -- Twilight Toggle --
  519.         if Twilight == 'Twilight' then
  520.             Twilight = 'None'
  521.             add_to_chat(123,'Twilight Set: [Unlocked]')
  522.         else
  523.             Twilight = 'Twilight'
  524.             add_to_chat(158,'Twilight Set: [locked]')
  525.         end
  526.         status_change(player.status)
  527.     elseif command == 'C8' then -- Distance Toggle --
  528.         if player.target.distance then
  529.             target_distance = math.floor(player.target.distance*10)/10
  530.             add_to_chat(158,'Distance: '..target_distance)
  531.         else
  532.             add_to_chat(123,'No Target Selected')
  533.         end
  534.     elseif command == 'C6' then -- Idle Toggle --
  535.         IdleIndex = (IdleIndex % #IdleArray) + 1
  536.         add_to_chat(158,'Idle Set: ' .. IdleArray[IdleIndex])
  537.         status_change(player.status)
  538.     elseif command == 'TP' then
  539.         add_to_chat(158,'TP Return: ['..tostring(player.tp)..']')
  540.     elseif command:match('^SC%d$') then
  541.         send_command('//' .. sc_map[command])
  542.     end
  543. end
  544.  
  545. function check_equip_lock() -- Lock Equipment Here --
  546.     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
  547.         disable('ring1','ring2')
  548.     elseif player.equipment.back == "Mecisto. Mantle" or player.equipment.back == "Aptitude Mantle +1" or player.equipment.back == "Aptitude Mantle" then
  549.         disable('back')
  550.     else
  551.         enable('ring1','ring2','back')
  552.     end
  553. end
  554.  
  555. function actualCost(originalCost)
  556.     if buffactive["Penury"] then
  557.         return originalCost*.5
  558.     elseif buffactive["Light Arts"] or buffactive["Addendum: White"] then
  559.         return originalCost*.9
  560.     elseif buffactive["Dark Arts"] or buffactive["Addendum: Black"] then
  561.         return originalCost*1.1
  562.     else
  563.         return originalCost
  564.     end
  565. end
  566.  
  567. function degrade_spell(spell,degrade_array)
  568.     spell_index = table.find(degrade_array,spell.name)
  569.     if spell_index > 1 then
  570.         new_spell = degrade_array[spell_index - 1]
  571.         change_spell(new_spell,spell.target.raw)
  572.         add_to_chat(8,spell.name..' Canceled: ['..player.mp..'/'..player.max_mp..'MP::'..player.mpp..'%] Casting '..new_spell..' instead.')
  573.     end
  574. end
  575.  
  576. function change_spell(spell_name,target)
  577.     cancel_spell()
  578.     send_command('//'..spell_name..' '..target)
  579. end
  580.  
  581. function refine_waltz(spell,action)
  582.     if spell.type ~= 'Waltz' then
  583.         return
  584.     end
  585.  
  586.     if spell.name == "Healing Waltz" or spell.name == "Divine Waltz" or spell.name == "Divine Waltz II" then
  587.         return
  588.     end
  589.  
  590.     local newWaltz = spell.english
  591.     local waltzID
  592.  
  593.     local missingHP
  594.  
  595.     if spell.target.type == "SELF" then
  596.         missingHP = player.max_hp - player.hp
  597.     elseif spell.target.isallymember then
  598.         local target = find_player_in_alliance(spell.target.name)
  599.         local est_max_hp = target.hp / (target.hpp/100)
  600.         missingHP = math.floor(est_max_hp - target.hp)
  601.     end
  602.  
  603.     if missingHP ~= nil then
  604.         if player.sub_job == 'DNC' then
  605.             if missingHP < 40 and spell.target.name == player.name then
  606.                 add_to_chat(123,'Full HP!')
  607.                 cancel_spell()
  608.                 return
  609.             elseif missingHP < 150 then
  610.                 newWaltz = 'Curing Waltz'
  611.                 waltzID = 190
  612.             elseif missingHP < 300 then
  613.                 newWaltz = 'Curing Waltz II'
  614.                 waltzID = 191
  615.             else
  616.                 newWaltz = 'Curing Waltz III'
  617.                 waltzID = 192
  618.             end
  619.         else
  620.             return
  621.         end
  622.     end
  623.  
  624.     local waltzTPCost = {['Curing Waltz'] = 20, ['Curing Waltz II'] = 35, ['Curing Waltz III'] = 50, ['Curing Waltz IV'] = 65, ['Curing Waltz V'] = 80}
  625.     local tpCost = waltzTPCost[newWaltz]
  626.  
  627.     local downgrade
  628.  
  629.     if player.tp < tpCost and not buffactive.trance then
  630.  
  631.         if player.tp < 20 then
  632.             add_to_chat(123, 'Insufficient TP ['..tostring(player.tp)..']. Cancelling.')
  633.             cancel_spell()
  634.             return
  635.         elseif player.tp < 35 then
  636.             newWaltz = 'Curing Waltz'
  637.         elseif player.tp < 50 then
  638.             newWaltz = 'Curing Waltz II'
  639.         elseif player.tp < 65 then
  640.             newWaltz = 'Curing Waltz III'
  641.         elseif player.tp < 80 then
  642.             newWaltz = 'Curing Waltz IV'
  643.         end
  644.  
  645.         downgrade = 'Insufficient TP ['..tostring(player.tp)..']. Downgrading to '..newWaltz..'.'
  646.     end
  647.  
  648.     if newWaltz ~= spell.english then
  649.         send_command('@input /ja "'..newWaltz..'" '..tostring(spell.target.raw))
  650.         if downgrade then
  651.             add_to_chat(158, downgrade)
  652.         end
  653.         cancel_spell()
  654.         return
  655.     end
  656.  
  657.     if missingHP > 0 then
  658.         add_to_chat(158,'Trying to cure '..tostring(missingHP)..' HP using '..newWaltz..'.')
  659.     end
  660. end
  661.  
  662. function find_player_in_alliance(name)
  663.     for i,v in ipairs(alliance) do
  664.         for k,p in ipairs(v) do
  665.             if p.name == name then
  666.                 return p
  667.             end
  668.         end
  669.     end
  670. end
  671.  
  672. function sub_job_change(newSubjob, oldSubjob)
  673.     select_default_macro_book()
  674. end
  675.  
  676. function set_macro_page(set,book)
  677.     if not tonumber(set) then
  678.         add_to_chat(123,'Error setting macro page: Set is not a valid number ('..tostring(set)..').')
  679.         return
  680.     end
  681.     if set < 1 or set > 10 then
  682.         add_to_chat(123,'Error setting macro page: Macro set ('..tostring(set)..') must be between 1 and 10.')
  683.         return
  684.     end
  685.  
  686.     if book then
  687.         if not tonumber(book) then
  688.             add_to_chat(123,'Error setting macro page: book is not a valid number ('..tostring(book)..').')
  689.             return
  690.         end
  691.         if book < 1 or book > 20 then
  692.             add_to_chat(123,'Error setting macro page: Macro book ('..tostring(book)..') must be between 1 and 20.')
  693.             return
  694.         end
  695.         send_command('@input /macro book '..tostring(book)..';wait .1;input /macro set '..tostring(set))
  696.     else
  697.         send_command('@input /macro set '..tostring(set))
  698.     end
  699. end
  700.  
  701. function select_default_macro_book()
  702.     -- Default macro set/book
  703.     if player.sub_job == 'WAR' then
  704.         set_macro_page(1, 3)
  705.     elseif player.sub_job == 'WHM' then
  706.         set_macro_page(2, 3)
  707.     elseif player.sub_job == 'DNC' then
  708.         set_macro_page(3, 3)
  709.     elseif player.sub_job == 'NIN' then
  710.         set_macro_page(5, 3)
  711.     else
  712.         set_macro_page(1, 3)
  713.     end
  714. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement