Arnan

THF Lua June 2017

Jun 23rd, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 18.06 KB | None | 0 0
  1. -- ** Amadis Thief Gearswap Lua File *** --
  2.  
  3. function get_sets()
  4.     AccIndex = 1
  5.     AccArray = {"LowACC","MidACC","HighACC"} -- 3 Levels Of Accuracy Sets For TP/WS/Hybrid. 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 --
  6.     IdleIndex = 1
  7.     IdleArray = {"Movement","Regen"} -- Default Idle Set Is Movement --
  8.     SA = false
  9.     TA = false
  10.     TH = 'OFF' -- Set Default Full TH ON or OFF Here --
  11.     Rancor = 'OFF' -- Set Default Rancor ON or OFF Here --
  12.     target_distance = 6 -- Set Default Distance Here --
  13.     send_command('input /macro book 14;wait .1;input /macro set 1') -- Change Default Macro Book Here --
  14.  
  15.     -- Herculean Augments --
  16.     HerculeanHelm={}
  17.     HerculeanHelm.MAB={ name="Herculean Helm", augments={'Mag. Acc.+6 "Mag.Atk.Bns."+6','Magic burst mdg.+5%','INT+8','Mag. Acc.+15','"Mag.Atk.Bns."+15',}}
  18.     HerculeanVest={}   
  19.     HerculeanVest.WSD={ name="Herculean Vest", augments={'Accuracy+27','Weapon skill damage +4%','Attack+1',}}
  20.     HerculeanGloves={}
  21.     HerculeanGloves.DT={ name="Herculean Gloves", augments={'Damage taken-3%','DEX+8','Accuracy+11','Attack+10',}}
  22.     HerculeanBoots={}
  23.     HerculeanBoots.TA={ name="Herculean Boots", augments={'Accuracy+27','"Triple Atk."+4','DEX+7','Attack+13',}}
  24.     HerculeanBoots.DT={ name="Herculean Boots", augments={'Accuracy+12','Phys. dmg. taken -5%','Attack+5',}}
  25.  
  26.    
  27.    
  28.     -- Toutatis's Cape Augments --
  29.     STPCape={ name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','"Store TP"+10',}}
  30.     WSDCape={ name="Toutatis's Cape", augments={'DEX+20','Accuracy+20 Attack+20','Weapon skill damage +10%',}}
  31.    
  32.    
  33.     -- Idle/Town Sets --
  34.     sets.Idle = {}
  35.     sets.Idle.Regen = {}
  36.     sets.Idle.Movement = set_combine(sets.Idle.Regen,{
  37.             ammo="Yetshila",
  38.             head="Adhemar Bonnet +1",
  39.             neck="Combatant's Torque",
  40.             ear1="Cessance Earring",
  41.             ear2="Sherida Earring",
  42.             body="Adhemar Jacket +1",
  43.             hands="Adhemar Wrist. +1",
  44.             ring1="Hetairoi Ring",
  45.             ring2="Epona's Ring",
  46.             back=STPCape,
  47.             waist="Windbuffet Belt +1",
  48.             legs="Samnuha Tights",
  49.             feet="Jute Boots +1"})
  50.  
  51.     -- Normal TP Sets --
  52.     sets.TP = {
  53.             ammo="Yetshila",
  54.             head="Adhemar Bonnet +1",
  55.             neck="Combatant's Torque",
  56.             ear1="Suppanomimi",
  57.             ear2="Eabani Earring",
  58.             body="Adhemar Jacket +1",
  59.             hands="Adhemar Wrist. +1",
  60.             ring1="Hetairoi Ring",
  61.             ring2="Epona's Ring",
  62.             back=STPCape,
  63.             waist="Shetal Stone",
  64.             legs="Samnuha Tights",
  65.             feet=HerculeanBoots.TA}
  66.     sets.TP.MidACC = set_combine(sets.TP,{                     
  67.             ammo="Yamarang",            
  68.             ring1="Ramuh Ring +1"})
  69.     sets.TP.HighACC = set_combine(sets.TP.MidACC,{
  70.             head="Dampening Tam",
  71.             waist="Olseni Belt"})
  72.  
  73.     -- Capped Magic Haste --
  74.     sets.TP.MidHaste = {
  75.             ammo="Yetshila",
  76.             head="Adhemar Bonnet +1",
  77.             neck="Combatant's Torque",
  78.             ear1="Suppanomimi",
  79.             ear2="Sherida Earring",
  80.             body="Adhemar Jacket +1",
  81.             hands="Adhemar Wrist. +1",
  82.             ring1="Hetairoi Ring",
  83.             ring2="Epona's Ring",
  84.             back=STPCape,
  85.             waist="Windbuffet Belt +1",
  86.             legs="Samnuha Tights",
  87.             feet=HerculeanBoots.TA}
  88.     sets.TP.MidACC.MidHaste = set_combine(sets.TP.MidHaste,{                       
  89.             ammo="Yamarang",            
  90.             ring1="Ramuh Ring +1"})
  91.     sets.TP.HighACC.MidHaste = set_combine(sets.TP.MidACC.MidHaste,{
  92.             head="Dampening Tam",
  93.             waist="Olseni Belt"})
  94.  
  95.     -- Capped Magic Haste + Samba --
  96.     sets.TP.HighHaste = {
  97.             ammo="Yetshila",
  98.             head="Adhemar Bonnet +1",
  99.             neck="Combatant's Torque",
  100.             ear1="Cessance Earring",
  101.             ear2="Sherida Earring",
  102.             body="Adhemar Jacket +1",
  103.             hands="Adhemar Wrist. +1",
  104.             ring1="Hetairoi Ring",
  105.             ring2="Epona's Ring",
  106.             back=STPCape,
  107.             waist="Windbuffet Belt +1",
  108.             legs="Samnuha Tights",
  109.             feet=HerculeanBoots.TA}
  110.     sets.TP.MidACC.HighHaste = set_combine(sets.TP.HighHaste,{                     
  111.             ammo="Yamarang",            
  112.             ring1="Ramuh Ring +1"})
  113.     sets.TP.HighACC.HighHaste = set_combine(sets.TP.MidACC.HighHaste,{
  114.             head="Dampening Tam",
  115.             waist="Olseni Belt"})
  116.            
  117.     -- Full TH TP Set --
  118.     sets.TP.TH = {feet="Skulk. Poulaines +1"}
  119.  
  120.     -- TP Rancor --
  121.     sets.TP.Rancor = {}
  122.  
  123.     -- PDT Set --
  124.     sets.PDT = {
  125.             ammo="Staunch Tathlum",
  126.             head="Meghanada Visor +1",
  127.             neck="Loricate Torque +1",
  128.             ear1="Genmei Earring",
  129.             ear2="Odnowa Earring +1",
  130.             body="Meg. Cuirie +1",
  131.             hands="Meg. Gloves +1",
  132.             ring1="Defending Ring",
  133.             ring2="Moonbeam Ring",
  134.             back="Moonbeam Cape",
  135.             waist="Flume Belt +1",
  136.             legs="Meg. Chausses +1",
  137.             feet="Meg. Jam. +1"}
  138.  
  139.     -- MDT Set --
  140.     sets.MDT = set_combine(sets.PDT,{})
  141.            
  142.     -- Kiting Set --
  143.     sets.Kiting =  set_combine(sets.PDT,{feet="Jute Boots +1"})
  144.  
  145.     -- Hybrid/Evasion Sets --
  146.     sets.TP.Hybrid = set_combine(sets.PDT,{})
  147.     sets.TP.Hybrid.MidACC = set_combine(sets.TP.Hybrid,{})
  148.     sets.TP.Hybrid.HighACC = set_combine(sets.TP.Hybrid.MidACC,{})
  149.  
  150.     sets.Evasion = set_combine(sets.PDT,{})
  151.  
  152.     -- WS Base Set --
  153.     sets.WS = {}
  154.  
  155.     -- WS Sets --
  156.     sets.WS.Evisceration = {
  157.             ammo="Yetshila",
  158.             head="Adhemar Bonnet +1",
  159.             neck="Fotia Gorget",
  160.             ear1="Moonshade Earring",
  161.             ear2="Sherida Earring",
  162.             body="Adhemar Jacket +1",
  163.             hands="Adhemar Wrist. +1",
  164.             ring1="Begrudging Ring",
  165.             ring2="Epona's Ring",
  166.             back=WSDCape,
  167.             waist="Fotia Belt",
  168.             legs="Samnuha Tights",
  169.             feet="Adhe. Gamashes +1"}
  170.     sets.WS.Evisceration.SA = set_combine(sets.WS.Evisceration,{})
  171.     sets.WS.Evisceration.TA = set_combine(sets.WS.Evisceration,{})
  172.  
  173.     sets.WS["Rudra's Storm"] = {
  174.             ammo="Jukukik Feather",
  175.             head="Lilitu Headpiece",
  176.             neck="Caro Necklace",
  177.             ear1="Moonshade Earring",
  178.             ear2="Ishvara Earring",
  179.             body="Adhemar Jacket +1",
  180.             hands="Meg. Gloves +1",
  181.             ring1="Regal Ring",
  182.             ring2="Ilabrat Ring",
  183.             back=WSDCape,
  184.             waist="Chiner's Belt +1",
  185.             legs="Lustr. Subligar +1",
  186.             feet="Lustra. Leggings +1"}
  187.     sets.WS["Rudra's Storm"].SA = set_combine(sets.WS["Rudra's Storm"],{
  188.             ammo="Yetshila",
  189.             head="Adhemar Bonnet +1",
  190.             body="Meg. Cuirie +1"})
  191.     sets.WS["Rudra's Storm"].TA = set_combine(sets.WS["Rudra's Storm"],{
  192.             ammo="Yetshila",
  193.             head="Adhemar Bonnet +1",
  194.             body="Meg. Cuirie +1"})
  195.  
  196.     sets.WS["Aeolian Edge"] = {}
  197.  
  198.     sets.WS["Mandalic Stab"] =  set_combine(sets.WS["Rudra's Storm"],{})
  199.     sets.WS["Mandalic Stab"].SA = set_combine(sets.WS["Rudra's Storm"].SA,{})
  200.     sets.WS["Mandalic Stab"].TA = set_combine(sets.WS["Rudra's Storm"].TA,{})
  201.  
  202.     -- JA Sets --
  203.     sets.JA = {}
  204.     TH_Gear = {feet="Skulk. Poulaines +1"}
  205.     sets.JA.Conspirator = {body="Raider's Vest +2"}
  206.     sets.JA.Accomplice = {head="Skulker's Bonnet +1"}
  207.     sets.JA.Collaborator = {head="Skulker's Bonnet +1"}
  208.     sets.JA["Perfect Dodge"] = {hands="Plun. Armlets +1"}
  209.     sets.JA.Steal = {hands="Pill. Armlets +1",legs="Pill. Culottes +1",feet="Pill. Poulaines +1"}
  210.     sets.JA.Flee = {feet="Pill. Poulaines +1"}
  211.     sets.JA.Despoil = {legs="Raid. Culottes +2",feet="Skulk. Poulaines +1"}
  212.     sets.JA.Mug = {head="Plun. Bonnet"}
  213.     sets.JA.Hide = {body="Pillager's Vest +1"}
  214.     sets.JA.Provoke = TH_Gear
  215.     sets.JA["Sneak Attack"] = {
  216.             ammo="Yetshila",
  217.             head="Adhemar Bonnet +1",
  218.             body="Meg. Cuirie +1",
  219.             hands="Pill. Armlets +1",
  220.             back="Canny Cape"}
  221.     sets.JA["Trick Attack"] = set_combine(sets.JA["Sneak Attack"],{
  222.             ammo="Yetshila",
  223.             head="Adhemar Bonnet +1",
  224.             body="Meg. Cuirie +1",
  225.             hands="Pill. Armlets +1",
  226.             back="Canny Cape"})
  227.  
  228.     -- Step Set --
  229.     sets.Step = set_combine({},TH_Gear)
  230.  
  231.     -- Flourish Set --
  232.     sets.Flourish = set_combine({},TH_Gear)
  233.  
  234.     -- Waltz Set --
  235.     sets.Waltz = {}
  236.  
  237.     -- Precast Sets --
  238.     sets.Precast = {}
  239.    
  240.     -- Fastcast Set --
  241.     sets.Precast.FastCast = {}
  242.    
  243.     -- Utsusemi Precast Set --
  244.     sets.Precast.Utsusemi = set_combine(sets.Precast.FastCast,{})
  245.  
  246.     -- Midcast Base Set --
  247.     sets.Midcast = {}
  248.    
  249.     -- Magic Haste Set --
  250.     sets.Midcast.Haste = set_combine(sets.PDT,{})
  251. end
  252.  
  253. function pretarget(spell,action)
  254.     if (spell.type:endswith('Magic') or spell.type == "Ninjutsu") and buffactive.silence then -- Auto Use Echo Drops If You Are Silenced --
  255.         cancel_spell()
  256.         send_command('input /item "Echo Drops" <me>')
  257.     elseif spell.english == "Berserk" and buffactive.Berserk then -- Change Berserk To Aggressor If Berserk Is On --
  258.         cancel_spell()
  259.         send_command('Aggressor')
  260.     elseif (spell.english == 'Ranged' and spell.target.distance > 24.9) or (spell.type == "WeaponSkill" and spell.target.distance > target_distance and player.status == 'Engaged') then -- Cancel Ranged Attack or WS If You Are Out Of Range --
  261.         cancel_spell()
  262.         add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  263.         return
  264.     end
  265. end
  266.  
  267. function precast(spell,action)
  268.     if spell.type == "WeaponSkill" then
  269.         if player.status ~= 'Engaged' then -- Cancel WS If You Are Not Engaged. Can Delete It If You Don't Need It --
  270.             cancel_spell()
  271.             add_to_chat(123,'Unable To Use WeaponSkill: [Disengaged]')
  272.             return
  273.         else
  274.             equipSet = sets.WS
  275.             if equipSet[spell.english] then
  276.                 equipSet = equipSet[spell.english]
  277.             end
  278.             if SA and equipSet["SA"] then
  279.                 equipSet = equipSet["SA"]
  280.             end
  281.             if TA and equipSet["TA"] then
  282.                 equipSet = equipSet["TA"]
  283.             end
  284.             if spell.english == "Evisceration" and player.tp > 2999 then -- Equip Mache Earring When You Have 3000 TP --
  285.                 equipSet = set_combine(equipSet,{ear1="Mache Earring"})
  286.             end
  287.             if spell.english == "Rudra's Storm" and player.tp > 2999 then -- Equip Mache Earring When You Have 3000 TP --
  288.                 equipSet = set_combine(equipSet,{ear1="Mache Earring"})
  289.             end
  290.             equip(equipSet)
  291.         end
  292.     elseif spell.type=="JobAbility" then
  293.         if sets.JA[spell.english] then
  294.             equip(sets.JA[spell.english])
  295.         end
  296.         if spell.english=="Sneak Attack" then
  297.             SA = true
  298.         end
  299.         if spell.english=="Trick Attack" then
  300.             TA = true
  301.         end
  302.     elseif spell.type:endswith('Magic') or spell.type == "Ninjutsu" then
  303.         if string.find(spell.english,'Utsusemi') then
  304.             if buffactive['Copy Image (3)'] or buffactive['Copy Image (4)'] then
  305.                 cancel_spell()
  306.                 add_to_chat(123, spell.name .. ' Canceled: [3+ Images]')
  307.                 return
  308.             else
  309.                 equip(sets.Precast.Utsusemi)
  310.             end
  311.         else
  312.             equip(sets.Precast.FastCast)
  313.         end
  314.     elseif spell.type == 'Step' then
  315.         equip(sets.Step)
  316.     elseif string.find(spell.type,'Flourish') then
  317.         equip(sets.Flourish)
  318.     elseif spell.type == "Waltz" then
  319.         refine_waltz(spell,action)
  320.         equip(sets.Waltz)
  321.     elseif spell.english == 'Spectral Jig' and buffactive.Sneak then
  322.         cast_delay(0.2)
  323.         send_command('cancel Sneak')
  324.     end
  325. end
  326.  
  327. function midcast(spell,action)
  328.     if spell.english == 'Ranged' then
  329.         equip(TH_Gear)
  330.     elseif spell.type:endswith('Magic') or spell.type == "Ninjutsu" then
  331.         if string.find(spell.english,'Utsusemi') then
  332.             if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)']) then
  333.                 send_command('@wait 1.7;cancel Copy Image*')
  334.             end
  335.             equip(sets.Midcast.Haste)
  336.         elseif spell.english == 'Monomi: Ichi' then
  337.             if buffactive['Sneak'] then
  338.                 send_command('@wait 1.7;cancel sneak')
  339.             end
  340.             equip(sets.Midcast.Haste)
  341.         else
  342.             equip(sets.Midcast.Haste)
  343.         end
  344.     end
  345. end
  346.  
  347. function aftercast(spell,action)
  348.     if spell.type == "WeaponSkill" and not spell.interrupted then
  349.         send_command('wait 0.2;gs c TP')
  350.     end
  351.     status_change(player.status)
  352. end
  353.  
  354. function status_change(new,old)
  355.     if player.equipment.range ~= 'empty' then
  356.         disable('range','ammo')
  357.     else
  358.         enable('range','ammo')
  359.     end
  360.     if Armor == 'PDT' then
  361.         equip(sets.PDT)
  362.     elseif Armor == 'MDT' then
  363.         equip(sets.MDT)
  364.     elseif Armor == 'Kiting' then
  365.         equip(sets.Kiting)
  366.     elseif Armor == 'EVA' then
  367.         equip(sets.Evasion)
  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.March and buffactive['Haste Samba'] and (buffactive.Embrava or buffactive.Haste) or (buffactive.Haste == 2) and buffactive['Haste Samba'] and equipSet["HighHaste"] then
  377.             equipSet = equipSet["HighHaste"]
  378.         end
  379.         if buffactive.March and (buffactive.Embrava or buffactive.Haste) or (buffactive.Haste == 2) and equipSet["MidHaste"] then
  380.             equipSet = equipSet["MidHaste"]
  381.         end
  382.         if SA then
  383.             equipSet = set_combine(equipSet,sets.JA["Sneak Attack"])
  384.         end
  385.         if TA then
  386.             equipSet = set_combine(equipSet,sets.JA["Trick Attack"])
  387.         end
  388.         if Rancor == 'ON' then -- Use Rancor Toggle For Rancor Collar --
  389.             equipSet = set_combine(equipSet,sets.TP.Rancor)
  390.         end
  391.         if TH == 'ON' then -- Use TH Toggle To Lock Full TH Set --
  392.             equipSet = set_combine(equipSet,sets.TP.TH)
  393.         end
  394.         equip(equipSet)
  395.     else
  396.         equip(sets.Idle[IdleArray[IdleIndex]])
  397.     end
  398. end
  399.  
  400. function buff_change(buff,gain)
  401.     buff = string.lower(buff)
  402.     if buff == "sneak attack" then
  403.         SA = gain
  404.     elseif buff == "trick attack" then
  405.         TA = gain
  406.     elseif buff == 'weakness' then -- Weakness Timer --
  407.         if gain then
  408.             send_command('timers create "Weakness" 300 up')
  409.         else
  410.             send_command('timers delete "Weakness"')
  411.         end
  412.     end
  413.     if not midaction() then
  414.         status_change(player.status)
  415.     end
  416. end
  417.  
  418. -- In Game: //gs c (command), Macro: /console gs c (command), Bind: gs c (command) --
  419. function self_command(command)
  420.     if command == 'C1' then -- Accuracy Level Toggle --
  421.         AccIndex = (AccIndex % #AccArray) + 1
  422.         status_change(player.status)
  423.         add_to_chat(158,'Accuracy Level: ' .. AccArray[AccIndex])
  424.     elseif command == 'C5' then -- Auto Update Gear Toggle --
  425.         status_change(player.status)
  426.         add_to_chat(158,'Auto Update Gear')
  427.     elseif command == 'C2' then -- Hybrid Toggle --
  428.         if Armor == 'Hybrid' then
  429.             Armor = 'None'
  430.             add_to_chat(123,'Hybrid Set: [Unlocked]')
  431.         else
  432.             Armor = 'Hybrid'
  433.             add_to_chat(158,'Hybrid Set: '..AccArray[AccIndex])
  434.         end
  435.         status_change(player.status)
  436.     elseif command == 'C9' then -- Full TH Set Toggle --
  437.         if TH == 'ON' then
  438.             TH = 'OFF'
  439.             add_to_chat(123,'Full TH Set: [Unlocked]')
  440.         else
  441.             TH = 'ON'
  442.             add_to_chat(158,'Full TH Set: [Locked]')
  443.         end
  444.         status_change(player.status)
  445.     elseif command == 'C7' then -- PDT Toggle --
  446.         if Armor == 'PDT' then
  447.             Armor = 'None'
  448.             add_to_chat(123,'PDT Set: [Unlocked]')
  449.         else
  450.             Armor = 'PDT'
  451.             add_to_chat(158,'PDT Set: [Locked]')
  452.         end
  453.         status_change(player.status)
  454.     elseif command == 'C15' then -- MDT Toggle --
  455.         if Armor == 'MDT' then
  456.             Armor = 'None'
  457.             add_to_chat(123,'MDT Set: [Unlocked]')
  458.         else
  459.             Armor = 'MDT'
  460.             add_to_chat(158,'MDT Set: [Locked]')
  461.         end
  462.         status_change(player.status)
  463.     elseif command == 'C12' then -- Kiting Toggle --
  464.         if Armor == 'Kiting' then
  465.             Armor = 'None'
  466.             add_to_chat(123,'Kiting Set: [Unlocked]')
  467.         else
  468.             Armor = 'Kiting'
  469.             add_to_chat(158,'Kiting Set: [Locked]')
  470.         end
  471.             status_change(player.status)
  472.     elseif command == 'C3' then -- Evasion Toggle --
  473.         if Armor == 'EVA' then
  474.             Armor = 'None'
  475.             add_to_chat(123,'Evasion Set: [Unlocked]')
  476.         else
  477.             Armor = 'EVA'
  478.             add_to_chat(158,'Evasion Set: [Locked]')
  479.         end
  480.         status_change(player.status)
  481.     elseif command == 'C16' then -- Rancor Toggle --
  482.         if Rancor == 'ON' then
  483.             Rancor = 'OFF'
  484.             add_to_chat(123,'Rancor: [OFF]')
  485.         else
  486.             Rancor = 'ON'
  487.             add_to_chat(158,'Rancor: [ON]')
  488.         end
  489.         status_change(player.status)
  490.     elseif command == 'C8' then -- Distance Toggle --
  491.         if player.target.distance then
  492.             target_distance = math.floor(player.target.distance*10)/10
  493.             add_to_chat(158,'Distance: '..target_distance)
  494.         else
  495.             add_to_chat(123,'No Target Selected')
  496.         end
  497.     elseif command == 'C6' then -- Idle Toggle --
  498.         IdleIndex = (IdleIndex % #IdleArray) + 1
  499.         status_change(player.status)
  500.         add_to_chat(158,'Idle Set: ' .. IdleArray[IdleIndex])
  501.     elseif command == 'TP' then
  502.         add_to_chat(155,'TP Return: ['..tostring(player.tp)..']')
  503.     elseif command:match('^SC%d$') then
  504.         send_command('//' .. sc_map[command])
  505.     end
  506. end
  507.  
  508. function refine_waltz(spell,action)
  509.     if spell.type ~= 'Waltz' then
  510.         return
  511.     end
  512.  
  513.     if spell.name == "Healing Waltz" or spell.name == "Divine Waltz" or spell.name == "Divine Waltz II" then
  514.         return
  515.     end
  516.  
  517.     local newWaltz = spell.english
  518.     local waltzID
  519.  
  520.     local missingHP
  521.  
  522.     if spell.target.type == "SELF" then
  523.         missingHP = player.max_hp - player.hp
  524.     elseif spell.target.isallymember then
  525.         local target = find_player_in_alliance(spell.target.name)
  526.         local est_max_hp = target.hp / (target.hpp/100)
  527.         missingHP = math.floor(est_max_hp - target.hp)
  528.     end
  529.  
  530.     if missingHP ~= nil then
  531.         if player.sub_job == 'DNC' then
  532.             if missingHP < 40 and spell.target.name == player.name then
  533.                 add_to_chat(123,'Full HP!')
  534.                 cancel_spell()
  535.                 return
  536.             elseif missingHP < 150 then
  537.                 newWaltz = 'Curing Waltz'
  538.                 waltzID = 190
  539.             elseif missingHP < 300 then
  540.                 newWaltz = 'Curing Waltz II'
  541.                 waltzID = 191
  542.             else
  543.                 newWaltz = 'Curing Waltz III'
  544.                 waltzID = 192
  545.             end
  546.         else
  547.             return
  548.         end
  549.     end
  550.  
  551.     local waltzTPCost = {['Curing Waltz'] = 20, ['Curing Waltz II'] = 35, ['Curing Waltz III'] = 50, ['Curing Waltz IV'] = 65, ['Curing Waltz V'] = 80}
  552.     local tpCost = waltzTPCost[newWaltz]
  553.  
  554.     local downgrade
  555.  
  556.     if player.tp < tpCost and not buffactive.trance then
  557.  
  558.         if player.tp < 20 then
  559.             add_to_chat(123, 'Insufficient TP ['..tostring(player.tp)..']. Cancelling.')
  560.             cancel_spell()
  561.             return
  562.         elseif player.tp < 35 then
  563.             newWaltz = 'Curing Waltz'
  564.         elseif player.tp < 50 then
  565.             newWaltz = 'Curing Waltz II'
  566.         elseif player.tp < 65 then
  567.             newWaltz = 'Curing Waltz III'
  568.         elseif player.tp < 80 then
  569.             newWaltz = 'Curing Waltz IV'
  570.         end
  571.  
  572.         downgrade = 'Insufficient TP ['..tostring(player.tp)..']. Downgrading to '..newWaltz..'.'
  573.     end
  574.  
  575.     if newWaltz ~= spell.english then
  576.         send_command('@input /ja "'..newWaltz..'" '..tostring(spell.target.raw))
  577.         if downgrade then
  578.             add_to_chat(158, downgrade)
  579.         end
  580.         cancel_spell()
  581.         return
  582.     end
  583.  
  584.     if missingHP > 0 then
  585.         add_to_chat(158,'Trying to cure '..tostring(missingHP)..' HP using '..newWaltz..'.')
  586.     end
  587. end
  588.  
  589. function find_player_in_alliance(name)
  590.     for i,v in ipairs(alliance) do
  591.         for k,p in ipairs(v) do
  592.             if p.name == name then
  593.                 return p
  594.             end
  595.         end
  596.     end
  597. end
Add Comment
Please, Sign In to add comment