Advertisement
Bokura

Bokura_WHM

Jan 22nd, 2014
2,540
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 19.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.     IdleIndex = 1
  6.     IdleArray = {"Movement","Refresh"} -- Default Idle Set Is Movement --
  7.     Armor = 'None'
  8.     canceled = false
  9.     DC = false
  10.     Lock_Main = 'OFF' -- Set Default Lock Main Weapon ON or OFF Here --
  11.     Enmity = 'OFF' -- Set Default Enmity Set ON or OFF Here --
  12.     Kiting = 'ON' -- Set Default Sublimation Kiting ON or OFF Here --
  13.     Elemental_Staff = 'ON' -- Set Default Precast Elemental Staff ON or OFF Here --
  14.     target_distance = 5 -- Set Default Distance Here --
  15.     select_default_macro_book() -- Change Default Macro Book At The End --
  16.  
  17.     Cure_Spells = {"Cure","Cure II","Cure III","Cure IV","Cure V","Cure VI"} -- Cure Degradation --
  18.     Curaga_Spells = {"Curaga","Curaga II","Curaga III","Curaga IV","Curaga V"} -- Curaga Degradation --
  19.     Na_Spells = S{"Paralyna","Cursna","Silena","Poisona","Blindna","Viruna","Stona","Erase"} -- For Yagrush --
  20.     sc_map = {SC1 = "LightArts", SC2 = "Celerity", SC3 = "Accession"} -- 3 Additional Binds. Can Change Whatever JA/WS/Spells You Like Here. Remember Not To Use Spaces. --
  21.  
  22.     sets.Idle = {}
  23.     -- Refresh Set --
  24.     sets.Idle.Refresh = {
  25.             main="Bolelabunga",
  26.             sub="Genbu's Shield",
  27.             head="Befouled Crown",
  28.             neck="Wiglen Gorget",
  29.             body="Ebers Briault +1",
  30.             hands="Serpentes Cuffs",
  31.             ring1="Sheltered Ring",
  32.             ring2="Paguroidea Ring",
  33.             back="Kumbira Cape",
  34.             legs="Assid. Pants +1",
  35.             feet="Serpentes Sabots"}
  36.  
  37.     -- Movement Set --
  38.     sets.Idle.Movement = set_combine(sets.Idle.Refresh,{
  39.             feet="Herald's Gaiters"})
  40.  
  41.     -- Resting Set --
  42.     sets.Resting = {}
  43.  
  44.     -- PDT Set --
  45.     sets.PDT = {}
  46.  
  47.     -- Sublimation Set --
  48.     sets.Sublimation = {}
  49.  
  50.     sets.Precast = {}
  51.     -- Fastcast Set (empty = To Fix Club/Staff Issue) --
  52.     sets.Precast.FastCast = {
  53.             sub=empty}
  54.  
  55.     -- Elemental Staves --
  56.     sets.Precast.Lightning = {main='Apamajas I'}
  57.     sets.Precast.Water = {main='Haoma I'}
  58.     sets.Precast.Fire = {main='Atar I'}
  59.     sets.Precast.Ice = {main='Vourukasha I'}
  60.     sets.Precast.Wind = {main='Vayuvata I'}
  61.     sets.Precast.Earth = {main='Vishrava I'}
  62.     sets.Precast.Light = {main='Arka I'}
  63.     sets.Precast.Dark = {main='Xsaeta I'}
  64.  
  65.     sets.Precast['Enhancing Magic'] = set_combine(sets.Precast.FastCast,{main="Yagrush",waist="Siegel Sash"})
  66.     sets.Precast['Healing Magic'] = set_combine(sets.Precast.FastCast,{main="Yagrush",legs="Ebers Pant. +1"})
  67.  
  68.     sets.Precast.Stoneskin = set_combine(sets.Precast.FastCast,{head="Umuthi Hat",waist="Siegel Sash"})
  69.  
  70.     -- Cure Precast Set --
  71.     sets.Precast.Cure = {
  72.             sub=empty}
  73.  
  74.     -- Midcast Base Set --
  75.     sets.Midcast = {}
  76.  
  77.     -- Haste Set --
  78.     sets.Midcast.Haste = set_combine(sets.Precast.FastCast,{})
  79.  
  80.     -- Cure Set --
  81.     sets.Midcast.Cure = {
  82.             body="Ebers Briault +1",
  83.             legs="Ebers Pant. +1"}
  84.  
  85.     -- Cure Enmity Set --
  86.     sets.Midcast.Cure.Enmity = set_combine(sets.Midcast.Cure,{})
  87.  
  88.     -- Curaga Set --
  89.     sets.Midcast.Curaga = {
  90.             legs="Ebers Pant. +1"}
  91.  
  92.     -- Curaga Enmity Set --
  93.     sets.Midcast.Curaga.Enmity = set_combine(sets.Midcast.Curaga,{})
  94.  
  95.     -- Enhancing Set --
  96.     sets.Midcast['Enhancing Magic'] = {}
  97.  
  98.     -- Barspells Set --
  99.     sets.Midcast.Bar = {}
  100.  
  101.     -- Regen Set --
  102.     sets.Midcast.Regen = set_combine(sets.Midcast.Haste,{
  103.             main="Bolelabunga",
  104.             body="Piety Briault +1",
  105.             hands="Ebers Mitts +1",
  106.             legs="Theo. Pant. +1"})
  107.  
  108.     -- Stoneskin Set --
  109.     sets.Midcast.Stoneskin = set_combine(sets.Midcast.Haste,{})
  110.  
  111.     -- Na Set --
  112.     sets.Midcast.Na = set_combine(sets.Midcast.Haste,{main="Yagrush",legs="Ebers Pant. +1"})
  113.  
  114.     -- Cursna Set --
  115.     sets.Midcast.Cursna = set_combine(sets.Midcast.Haste,{
  116.             main="Yagrush",
  117.             sub="Genbu's Shield",
  118.             ammo="Impatiens",
  119.             head="Nahtirah Hat",
  120.             neck="Malison Medallion",
  121.             ear2="Beatific Earring",
  122.             body="Ebers Briault +1",
  123.             hands="Theo. Mitts +1",
  124.             ring1="Haoma's Ring",
  125.             ring2="Haoma's Ring",
  126.             back="Mending Cape",
  127.             waist="Bishop's Sash",
  128.             legs="Theo. Pant. +1",
  129.             feet="Gende. Galosh. +1"})
  130.  
  131.     -- Divine Set --
  132.     sets.Midcast['Divine Magic'] = {}
  133.  
  134.     -- Banish Set --
  135.     sets.Midcast.Banish = set_combine(sets.Midcast['Divine Magic'],{
  136.             hands="Piety Mitts +1",
  137.             ring1="Fenian Ring"})
  138.  
  139.     -- Holy Set --
  140.     sets.Midcast.Holy = set_combine(sets.Midcast['Divine Magic'],{})
  141.    
  142.     -- Enfeebling Set --
  143.     sets.Midcast['Enfeebling Magic'] = {}
  144.  
  145.     -- Dark Magic Set --
  146.     sets.Midcast['Dark Magic'] = {}
  147.  
  148.     -- Impact Set --
  149.     sets.Midcast.Impact = {}
  150.  
  151.     -- JA Sets --
  152.     sets.JA = {}
  153.     sets.JA.Benediction = {body="Piety Briault +1"}
  154.     sets.JA.Martyr = {hands="Piety Mitts +1"}
  155.     sets.JA.Devotion = {head="Piety Cap +1"}
  156.  
  157.     -- Divine Caress Set --
  158.     sets['Divine Caress'] = {
  159.         main="Yagrush",
  160.         hands="Ebers Mitts +1",
  161.         back="Mending Cape"}
  162.  
  163.     -- Melee Set --
  164.     sets.Melee = set_combine(sets.Midcast.Haste,{})
  165.  
  166.     -- WS Base Set --
  167.     sets.WS = {}
  168.     sets.WS['Hexa Strike'] = {}
  169.     sets.WS['Mystic Boon'] = {}
  170.     sets.WS.Dagan = {}
  171. end
  172.  
  173. function pretarget(spell,action)
  174.     if midaction() then
  175.         canceled = true
  176.         return
  177.     elseif spell.action_type == 'Magic' and buffactive.silence then -- Auto Use Echo Drops If You Are Silenced --
  178.         cancel_spell()
  179.         send_command('input /item "Echo Drops" <me>')
  180.     elseif spell.type == "WeaponSkill" and spell.target.distance > target_distance and player.status == 'Engaged' then -- Cancel WS If You Are Out Of Range --
  181.         cancel_spell()
  182.         add_to_chat(123, spell.name..' Canceled: [Out of Range]')
  183.         return
  184.     elseif spell.english:ifind("Cure") and player.mp<actualCost(spell.mp_cost) then
  185.         degrade_spell(spell,Cure_Spells)
  186.     elseif spell.english:ifind("Curaga") and player.mp<actualCost(spell.mp_cost) then
  187.         degrade_spell(spell,Curaga_Spells)
  188.     elseif Na_Spells:contains(spell.english) then -- Auto Divine Caress --
  189.         if windower.ffxi.get_ability_recasts()[32] < 1 and (spell.target.type == 'PLAYER' or spell.target.name == player.name) and not buffactive.amnesia and not buffactive.charm and spell.english ~= "Erase" then
  190.             cancel_spell()
  191.             send_command('DivineCaress;wait 1.7;input /ma "'..spell.english..'" '..spell.target.name)
  192.         end
  193.     elseif buffactive['Light Arts'] or buffactive['Addendum: White'] then
  194.         if spell.english == 'Light Arts' and not buffactive['Addendum: White'] then
  195.             cancel_spell()
  196.             send_command('input /ja Addendum: White <me>')
  197.         elseif spell.english == "Manifestation" then
  198.             cancel_spell()
  199.             send_command('input /ja Accession <me>')
  200.         elseif spell.english == "Alacrity" then
  201.             cancel_spell()
  202.             send_command('input /ja Celerity <me>')
  203.         elseif spell.english == "Parsimony" then
  204.             cancel_spell()
  205.             send_command('input /ja Penury <me>')
  206.         end
  207.     elseif buffactive['Dark Arts'] or buffactive['Addendum: Black'] then
  208.         if spell.english == 'Dark Arts' and not buffactive['Addendum: Black'] then
  209.             cancel_spell()
  210.             send_command('input /ja Addendum: Black <me>')
  211.         elseif spell.english == "Accession" then
  212.             cancel_spell()
  213.             send_command('input /ja Manifestation <me>')
  214.         elseif spell.english == "Celerity" then
  215.             cancel_spell()
  216.             send_command('input /ja Alacrity <me>')
  217.         elseif spell.english == "Penury" then
  218.             cancel_spell()
  219.             send_command('input /ja Parsimony <me>')
  220.         end
  221.     end
  222. end
  223.  
  224. function precast(spell,action)
  225.     if canceled then
  226.         return
  227.     elseif spell.action_type == 'Magic' then
  228.         if buffactive.silence or spell.target.distance > 16+target_distance then -- Cancel Magic or Ninjutsu If You Are Silenced or Out of Range --
  229.             cancel_spell()
  230.             add_to_chat(123, spell.name..' Canceled: [Silenced or Out of Casting Range]')
  231.             return
  232.         else
  233.             if spell.english:startswith('Cur') and spell.english ~= "Cursna" then
  234.                 equip(sets.Precast.Cure)
  235.             elseif spell.english == "Stoneskin" then
  236.                 equip(sets.Precast[spell.english])
  237.             elseif spell.english == "Impact" then
  238.                 equip(set_combine(sets.Precast.FastCast,{body="Twilight Cloak"}))
  239.             elseif spell.english == 'Utsusemi: Ni' then
  240.                 if buffactive['Copy Image (3)'] then
  241.                     cancel_spell()
  242.                     add_to_chat(123, spell.name .. ' Canceled: [3 Images]')
  243.                     return
  244.                 else
  245.                     equip(sets.Precast.FastCast)
  246.                 end
  247.             elseif sets.Precast[spell.skill] then
  248.                 equip(sets.Precast[spell.skill])
  249.             else
  250.                 equip(sets.Precast.FastCast)
  251.             end
  252.         end
  253.     elseif spell.type == "JobAbility" then
  254.         if sets.JA[spell.english] then
  255.             equip(sets.JA[spell.english])
  256.         end
  257.     elseif spell.type == "WeaponSkill" then
  258.         if player.status ~= 'Engaged' then -- Cancel WS If You Are Not Engaged. Can Delete It If You Don't Need It --
  259.             cancel_spell()
  260.             add_to_chat(123,'Unable To Use WeaponSkill: [Disengaged]')
  261.             return
  262.         else
  263.             if sets.WS[spell.english] then
  264.                 equip(sets.WS[spell.english])
  265.             end
  266.         end
  267.     elseif spell.english == 'Spectral Jig' and buffactive.Sneak then
  268.         cast_delay(0.2)
  269.         send_command('cancel Sneak')
  270.     end
  271.     if sets.Precast[spell.element] and not Na_Spells:contains(spell.english) and Elemental_Staff == 'ON' then
  272.         equip(sets.Precast[spell.element])
  273.     end
  274. end
  275.  
  276. function midcast(spell,action)
  277.     equipSet = {}
  278.     if spell.action_type == 'Magic' then
  279.         equipSet = sets.Midcast
  280.         if Na_Spells:contains(spell.english) then
  281.             equipSet = equipSet.Na
  282.             if DC then
  283.                 equipSet = set_combine(equipSet,sets['Divine Caress'])
  284.             end
  285.         elseif spell.english:startswith('Cur') and spell.english ~= "Cursna" then
  286.             if spell.english:startswith('Cure') then
  287.                 if Enmity == 'ON' then
  288.                     equipSet = equipSet.Cure.Enmity
  289.                 else
  290.                     equipSet = equipSet.Cure
  291.                 end
  292.             elseif spell.english:startswith('Cura') then
  293.                 if Enmity == 'ON' then
  294.                     equipSet = equipSet.Curaga.Enmity
  295.                 else
  296.                     equipSet = equipSet.Curaga
  297.                 end
  298.             end
  299.             if world.day_element == spell.element or world.weather_element == spell.element then
  300.                 equipSet = set_combine(equipSet,{back="Twilight Cape",waist="Hachirin-no-Obi"})
  301.             end
  302.         elseif spell.english == "Protectra V" then -- Equip Aug'ed Piety Duckbills +1 When You Cast Protectra V --
  303.             equipSet = set_combine(equipSet,{feet="Piety Duckbills +1"})
  304.         elseif spell.english == "Shellra V" then -- Equip Aug'ed Piety Pantaln. +1 When You Cast Shellra V --
  305.             equipSet = set_combine(equipSet,{legs="Piety Pantaln. +1"})
  306.         elseif spell.english == "Stoneskin" then
  307.             if buffactive.Stoneskin then
  308.                 send_command('@wait 2.8;cancel stoneskin')
  309.             end
  310.             equipSet = equipSet.Stoneskin
  311.         elseif spell.english == "Sneak" then
  312.             if spell.target.name == player.name and buffactive['Sneak'] then
  313.                 send_command('cancel sneak')
  314.             end
  315.             equipSet = equipSet.Haste
  316.         elseif spell.english:startswith('Bar') then
  317.             equipSet = equipSet.Bar
  318.         elseif spell.english:startswith('Regen') then
  319.             equipSet = equipSet.Regen
  320.         elseif spell.english:startswith('Banish') then
  321.             equipSet = equipSet.Banish
  322.             if world.day_element == spell.element or world.weather_element == spell.element then
  323.                 equipSet = set_combine(equipSet,{back="Twilight Cape",waist="Hachirin-no-Obi"})
  324.             end
  325.         elseif spell.english:startswith('Holy') then
  326.             equipSet = equipSet.Holy
  327.             if world.day_element == spell.element or world.weather_element == spell.element then
  328.                 equipSet = set_combine(equipSet,{back="Twilight Cape",waist="Hachirin-no-Obi"})
  329.             end
  330.         elseif spell.english:startswith('Reraise') then
  331.             equipSet = equipSet.Haste
  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.             equipSet = equipSet.Haste
  337.         elseif spell.english == 'Monomi: Ichi' then
  338.             if buffactive['Sneak'] then
  339.                 send_command('@wait 1.7;cancel sneak')
  340.             end
  341.             equipSet = equipSet.Haste
  342.         else
  343.             if equipSet[spell.english] then
  344.                 equipSet = equipSet[spell.english]
  345.             end
  346.             if equipSet[spell.skill] then
  347.                 equipSet = equipSet[spell.skill]
  348.             end
  349.             if equipSet[spell.type] then
  350.                 equipSet = equipSet[spell.type]
  351.             end
  352.         end
  353.     elseif equipSet[spell.english] then
  354.         equipSet = equipSet[spell.english]
  355.     end
  356.     equip(equipSet)
  357. end
  358.  
  359. function aftercast(spell,action)
  360.     if canceled then
  361.         canceled = false
  362.         return
  363.     else
  364.         if not spell.interrupted then
  365.             if spell.type == "WeaponSkill" then
  366.                 send_command('wait 0.2;gs c TP')
  367.             elseif spell.english == "Repose" or spell.english == "Sleep II" then -- Repose & Sleep II Countdown --
  368.                 send_command('wait 60;input /echo Sleep Effect: [WEARING OFF IN 30 SEC.];wait 15;input /echo Sleep Effect: [WEARING OFF IN 15 SEC.];wait 10;input /echo Sleep Effect: [WEARING OFF IN 5 SEC.]')
  369.             elseif spell.english == "Sleep" or spell.english == "Sleepga" then -- Sleep & Sleepga Countdown --
  370.                 send_command('wait 30;input /echo Sleep Effect: [WEARING OFF IN 30 SEC.];wait 15;input /echo Sleep Effect: [WEARING OFF IN 15 SEC.];wait 10;input /echo Sleep Effect: [WEARING OFF IN 5 SEC.]')
  371.             elseif spell.english == "Banish III" then -- Banish III Countdown --
  372.                 send_command('wait 35;input /echo Banish Effect: [WEARING OFF IN 10 SEC.]')
  373.             end
  374.         end
  375.         status_change(player.status)
  376.     end
  377. end
  378.  
  379. function status_change(new,old)
  380.     check_equip_lock()
  381.     if Armor == 'PDT' then
  382.         equip(sets.PDT)
  383.     elseif buffactive["Sublimation: Activated"] then
  384.         equip(sets.Sublimation)
  385.         if Kiting == 'ON' then
  386.             equip({feet="Herald's Gaiters"})
  387.         end
  388.     elseif new == 'Engaged' then
  389.         equip(sets.Melee)
  390.     elseif new == 'Idle' then
  391.         equipSet = sets.Idle
  392.         if equipSet[IdleArray[IdleIndex]] then
  393.             equipSet = equipSet[IdleArray[IdleIndex]]
  394.         end
  395.         if buffactive['Reive Mark'] then -- Equip Arciela's Grace +1 During Reive --
  396.             equipSet = set_combine(equipSet,{neck="Arciela's Grace +1"})
  397.         end
  398.         if world.area:endswith('Adoulin') then
  399.             equipSet = set_combine(equipSet,{body="Councilor's Garb"})
  400.         end
  401.         equip(equipSet)
  402.     elseif new == 'Resting' then
  403.         equip(sets.Resting)
  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 == 'divine caress' then
  417.         DC = gain
  418.     elseif buff == 'weakness' then -- Weakness Timer --
  419.         if gain then
  420.             send_command('timers create "Weakness" 300 up')
  421.         else
  422.             send_command('timers delete "Weakness"')
  423.         end
  424.     end
  425.     if not midaction() then
  426.         status_change(player.status)
  427.     end
  428. end
  429.  
  430. -- In Game: //gs c (command), Macro: /console gs c (command), Bind: gs c (command) --
  431. function self_command(command)
  432.     if command == 'C1' then -- Enmity Toggle --
  433.         if Enmity == 'ON' then
  434.             Enmity = 'OFF'
  435.             add_to_chat(123,'Enmity Set: [OFF]')
  436.         else
  437.             Enmity = 'ON'
  438.             add_to_chat(158,'Enmity Set: [ON]')
  439.         end
  440.         status_change(player.status)
  441.     elseif command == 'C2' then -- Follow Toggle --
  442.         send_command('input /ta Bokura;input /lockon;wait .3;setkey numpad8 down;wait .3;setkey numpad7 down;wait .3;setkey numpad7 up;wait .3;setkey numpad8 up')
  443.     elseif command == 'C3' then -- Kiting Toggle --
  444.         if Kiting == 'ON' then
  445.             Kiting = 'OFF'
  446.             add_to_chat(123,'Kiting Set: [Unlocked]')
  447.         else
  448.             Kiting = 'ON'
  449.             add_to_chat(158,'Kiting Set: [Locked]')
  450.         end
  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 == 'C7' then
  456.         if Armor == 'PDT' then -- PDT Toggle --
  457.             Armor = 'None'
  458.             add_to_chat(123,'PDT Set: [Unlocked]')
  459.         else
  460.             Armor = 'PDT'
  461.             add_to_chat(158,'PDT Set: [Locked]')
  462.         end
  463.         status_change(player.status)
  464.     elseif command == 'C17' then -- Lock Main Weapon Toggle --
  465.         if Lock_Main == 'ON' then
  466.             Lock_Main = 'OFF'
  467.             add_to_chat(123,'Main Weapon: [Unlocked]')
  468.         else
  469.             Lock_Main = 'ON'
  470.             add_to_chat(158,'Main Weapon: [Locked]')
  471.         end
  472.         status_change(player.status)
  473.     elseif command == 'C8' then -- Distance Toggle --
  474.         if player.target.distance then
  475.             target_distance = math.floor(player.target.distance*10)/10
  476.             add_to_chat(158,'Distance: '..target_distance)
  477.         else
  478.             add_to_chat(123,'No Target Selected')
  479.         end
  480.     elseif command == 'C6' then -- Idle Toggle
  481.         IdleIndex = (IdleIndex % #IdleArray) + 1
  482.         add_to_chat(158,'Idle Set: '..IdleArray[IdleIndex])
  483.         status_change(player.status)
  484.     elseif command == 'TP' then
  485.         add_to_chat(158,'TP Return: '..tostring(player.tp))
  486.     elseif command:match('^SC%d$') then
  487.         send_command('//' .. sc_map[command])
  488.     end
  489. end
  490.  
  491. function check_equip_lock() -- Lock Equipment Here --
  492.     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
  493.         disable('ring1','ring2')
  494.     elseif player.equipment.back == "Mecisto. Mantle" or player.equipment.back == "Aptitude Mantle +1" or player.equipment.back == "Aptitude Mantle" then
  495.         disable('back')
  496.     elseif Lock_Main == 'ON' then
  497.         disable('main','sub')
  498.     else
  499.         enable('main','sub','ring1','ring2','back')
  500.     end
  501. end
  502.  
  503. function actualCost(originalCost)
  504.     if buffactive["Penury"] then
  505.         return originalCost*.5
  506.     elseif buffactive["Light Arts"] or buffactive["Addendum: White"] then
  507.         return originalCost*.9
  508.     elseif buffactive["Dark Arts"] or buffactive["Addendum: Black"] then
  509.         return originalCost*1.1
  510.     else
  511.         return originalCost
  512.     end
  513. end
  514.  
  515. function degrade_spell(spell,degrade_array)
  516.     spell_index = table.find(degrade_array,spell.name)
  517.     if spell_index > 1 then
  518.         new_spell = degrade_array[spell_index - 1]
  519.         change_spell(new_spell,spell.target.raw)
  520.         add_to_chat(8,spell.name..' Canceled: ['..player.mp..'/'..player.max_mp..'MP::'..player.mpp..'%] Casting '..new_spell..' instead.')
  521.     end
  522. end
  523.  
  524. function change_spell(spell_name,target)
  525.     cancel_spell()
  526.     send_command('//'..spell_name..' '..target)
  527. end
  528.  
  529. function sub_job_change(newSubjob, oldSubjob)
  530.     select_default_macro_book()
  531. end
  532.  
  533. function set_macro_page(set,book)
  534.     if not tonumber(set) then
  535.         add_to_chat(123,'Error setting macro page: Set is not a valid number ('..tostring(set)..').')
  536.         return
  537.     end
  538.     if set < 1 or set > 10 then
  539.         add_to_chat(123,'Error setting macro page: Macro set ('..tostring(set)..') must be between 1 and 10.')
  540.         return
  541.     end
  542.  
  543.     if book then
  544.         if not tonumber(book) then
  545.             add_to_chat(123,'Error setting macro page: book is not a valid number ('..tostring(book)..').')
  546.             return
  547.         end
  548.         if book < 1 or book > 20 then
  549.             add_to_chat(123,'Error setting macro page: Macro book ('..tostring(book)..') must be between 1 and 20.')
  550.             return
  551.         end
  552.         send_command('@input /macro book '..tostring(book)..';wait .1;input /macro set '..tostring(set))
  553.     else
  554.         send_command('@input /macro set '..tostring(set))
  555.     end
  556. end
  557.  
  558. function select_default_macro_book()
  559.     -- Default macro set/book
  560.     if player.sub_job == 'SCH' then
  561.         set_macro_page(3, 18)
  562.     elseif player.sub_job == 'BLM' then
  563.         set_macro_page(1, 18)
  564.     elseif player.sub_job == 'RDM' then
  565.         set_macro_page(2, 18)
  566.     elseif player.sub_job == 'DNC' then
  567.         set_macro_page(10, 18)
  568.     elseif player.sub_job == 'NIN' then
  569.         set_macro_page(5, 18)
  570.     else
  571.         set_macro_page(1, 18)
  572.     end
  573. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement