Advertisement
Guest User

Whm lua

a guest
Jan 16th, 2019
2,349
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.71 KB | None | 0 0
  1. TP_Set_Names = {"None", "Delay Cap" ,"Acc"}
  2. TP_Index = 1
  3.  
  4. Idle_Set_Names = {'MDT','PDT'}
  5. Idle_Index = 1
  6.  
  7. Kiting = false
  8.  
  9. send_command('bind f9 gs c cycle TP set')
  10. send_command('bind f10 gs c equip pdt')
  11. send_command('bind f11 gs c equip mdt')
  12. send_command('bind f12 gs c refresh set')
  13. send_command('bind ^k gs c toggle kiting')
  14.  
  15. function file_unload()
  16.     send_command('unbind f9')
  17.     send_command('unbind f10')
  18.     send_command('unbind f11')
  19.     send_command('unbind f12')
  20.     send_command('unbind ^k')
  21. end
  22.  
  23. function help()
  24.     add_to_chat(122, 'Keyboard Bindings:')
  25.     add_to_chat(122, 'F9: Cycle TP set')
  26.     add_to_chat(122, 'F10: Turn on idle pdt')
  27.     add_to_chat(122, 'F11: Turn on idle mdt')
  28.     add_to_chat(122, 'F12: Refresh gear and turn on job abilities')
  29.     add_to_chat(122, 'Ctrl + k: Toggle kiting')
  30. end
  31.  
  32. help()
  33.  
  34. function get_sets()
  35.  
  36.     sets = {}
  37.    
  38.      -- Buff sets: Gear that needs to be worn to actively enhance a current player buff.
  39.      sets.divine_caress = {hands="Ebers mitts"}
  40.      sets.afflatus_solace = {body="Ebers Bliaud +1"}
  41.  
  42.     --- Sets for Enhanced Job Abilities ---
  43.    
  44.     sets.ja = {}
  45.    
  46.     sets.ja['Afflatus Solace'] = sets.afflatus_solace
  47.     sets.ja['Benediction'] = {body="Piety Briault +3"}
  48.     sets.ja['Devotion'] = {body="Piety Cap +1"}
  49.    
  50.     --- Fast Cast Sets ---
  51.     sets.fc = {
  52.         main="Gada",
  53.         sub="Chanter's shield",
  54.         ammo="Incantor Stone",
  55.         head="Vanya hood",
  56.         neck="Cleric's torque",
  57.         ear2="Loquacious Earring",
  58.         body="Inyanga jubbah +2",
  59.         hands="Kaykaus cuffs",
  60.         ring1="Prolix Ring",
  61.         back="Alaunus's cape",
  62.         legs="Lengo pants",
  63.         feet="Kaykaus boots"
  64.     }
  65.    
  66.     sets.fc.heal = set_combine(sets.fc, {legs="ebers pantaloons +1"})
  67.    
  68.     sets.fc.cure = set_combine(sets.fc, {
  69.         main="Queller rod",
  70.         neck="Aceso's choker +1",
  71.         sub="Sors shield",
  72.         ammo="Incantor stone",
  73.         ear1="Nourishing earring +1",
  74.         head="Piety cap +1",
  75.         feet="Hygieia Clogs +1"
  76.     })
  77.    
  78.     sets.fc.stoneskin = set_combine(sets.fc, {
  79.         head="Umuthi hat"
  80.     })
  81.    
  82.     sets.ws = {
  83.         head="Aya. Zucchetto +2",
  84.         body="Ayanmo Corazza +2",
  85.         hands="Aya. Manopolas +2",
  86.         legs="Aya. Cosciales +2",
  87.         feet="Aya. Gambieras +2",
  88.         neck="Fotia Gorget",
  89.         waist="Fotia Belt",
  90.         left_ear="Cessance Earring",
  91.         right_ear="Brutal Earring",
  92.         left_ring="Rajas Ring",
  93.         right_ring="Chirich Ring",
  94.         back="Moonbeam Cape",
  95.     }
  96.    
  97.     sets.ws["Hexa Strike"] = {
  98.         ammo="Staunch Tathlum",
  99.         head="Aya. Zucchetto +2",
  100.         body="Ayanmo Corazza +2",
  101.         hands="Aya. Manopolas +2",
  102.         legs="Aya. Cosciales +2",
  103.         feet="Aya. Gambieras +2",
  104.         neck="Fotia Gorget",
  105.         waist="Fotia Belt",
  106.         left_ear="Cessance Earring",
  107.         right_ear="Brutal Earring",
  108.         left_ring="Rajas Ring",
  109.         right_ring="Chirich Ring",
  110.         back="Moonbeam Cape",
  111.     }
  112.      
  113.    
  114.     sets.tp = {}
  115.    
  116.     sets.tp['Delay Cap'] = {
  117.         ammo="Staunch Tathlum",
  118.         head="Aya. Zucchetto +2",
  119.         body="Ayanmo Corazza +2",
  120.         hands="Aya. Manopolas +2",
  121.         legs="Aya. Cosciales +2",
  122.         feet="Aya. Gambieras +2",
  123.         neck="Sanctity Necklace",
  124.         waist="Grunfeld Rope",
  125.         left_ear="Cessance Earring",
  126.         right_ear="Telos Earring",
  127.         left_ring="Petrov Ring",
  128.         right_ring="Hetairoi Ring",
  129.         back="Moonbeam Cape",
  130.     }
  131.  
  132.     sets.tp['Acc'] = {
  133.         ammo="Staunch Tathlum",
  134.         head="Aya. Zucchetto +2",
  135.         body="Ayanmo Corazza +2",
  136.         hands="Aya. Manopolas +2",
  137.         legs="Aya. Cosciales +2",
  138.         feet="Aya. Gambieras +2",
  139.         neck="Sanctity Necklace",
  140.         waist="Eschan stone",
  141.         left_ear="Cessance Earring",
  142.         right_ear="Brutal Earring",
  143.         left_ring="Rajas Ring",
  144.         right_ring="Chirich Ring",
  145.         back="Moonbeam Cape",
  146.     }
  147.    
  148.    
  149.     sets.idle = {}
  150.    
  151.     sets.idle['PDT'] = {
  152.         main="Mafic cudgel",
  153.         sub="Genbu's Shield",
  154.         ammo="Staunch tathlum",
  155.         head="Ayanmo zucchetto +2",
  156.         neck="Loricate Torque +1",
  157.         ear1="Etiolation earring",
  158.         ear2="Hearty earring",
  159.         body="Ayanmo corazza +2",
  160.         hands="Ayanmo manopolas +2",
  161.         ring1="Defending Ring",
  162.         ring2="Ayanmo ring",
  163.         back={ name="Alaunus's Cape", augments={'MND+20','Eva.+20 /Mag. Eva.+20','Mag. Evasion+10','Enmity-10','Occ. inc. resist. to stat. ailments+10'}},
  164.         waist="Slipor sash",
  165.         legs="Ayanmo cosciales +2",
  166.         feet="Ayanmo gambieras +2"
  167.     }
  168.                
  169.     sets.idle['MDT'] = {
  170.         main="Mafic cudgel",
  171.         sub="Genbu's Shield",
  172.         ammo="Staunch tathlum",
  173.         head="Inyanga tiara +2",
  174.         neck="Loricate Torque +1",
  175.         ear1="Etiolation earring",
  176.         ear2="Hearty earring",
  177.         body="Inyanga jubbah +2",
  178.         hands="Shrieker's cuffs",
  179.         ring1="Defending Ring",
  180.         ring2="Inyanga ring",
  181.         back={ name="Alaunus's Cape", augments={'MND+20','Eva.+20 /Mag. Eva.+20','Mag. Evasion+10','Enmity-10','Occ. inc. resist. to stat. ailments+10'}},
  182.         waist="Slipor sash",
  183.         legs="Inyanga Shalwar +2",
  184.         feet="Inyanga crackows +2"
  185.     }
  186.  
  187.     sets.midcast = {}
  188.  
  189.     sets.midcast.status_removal = {
  190.         main="Yagrush",
  191.         head="Vanya hood",
  192.         neck="Cleric's torque",
  193.         body="Ebers bliaud +1",
  194.         back={ name="Alaunus's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Acc.+10','Enmity-10','Spell interruption rate down-10%'}},
  195.         waist="Austerity belt +1",
  196.         legs="ebers pantaloons +1"
  197.     }
  198.  
  199.     sets.midcast.cursna = set_combine( sets.midcast.status_removal, {
  200.         neck="Debilis Medallion",
  201.         hands="Fanatic gloves",
  202.         ring1="Haoma's ring",
  203.         ring2="Haoma's ring",
  204.         legs="Theophany pantaloons +3",
  205.         feet="Gendewitha Galoshes"
  206.     })
  207.    
  208.     sets.midcast.cure = {
  209.         main="Queller rod",
  210.         sub="Genbu's Shield",
  211.         ammo="Incantor Stone",
  212.         head="Ebers cap +1",
  213.         neck="Cleric's torque",
  214.         ear1="Nourishing earring +1",
  215.         ear2="Glorious earring",
  216.         body="Theophany briault +3",
  217.         hands="Kaykaus cuffs",
  218.         ring1="Prolix Ring",
  219.         ring2="Sirona's Ring",
  220.         back={ name="Alaunus's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Acc.+10','Enmity-10','Spell interruption rate down-10%'}},
  221.         waist="Austerity belt +1",
  222.         legs="ebers pantaloons +1",
  223.         feet="Kaykaus boots"
  224.     }
  225.  
  226.     sets.midcast.enhancing = {
  227.         main="Beneficus",
  228.         sub="Ammurapi shield",
  229.         head="Umuthi Hat",
  230.         ring1="Stikini ring",
  231.         ring2="Stikini ring",
  232.         back={ name="Alaunus's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Acc.+10','Enmity-10','Spell interruption rate down-10%'}},
  233.         waist="Austerity belt +1",
  234.         legs="Piety Pantaloons +1",
  235.         feet="Theophany duckbills +3"
  236.     }
  237.  
  238.     sets.midcast.bar_element = set_combine( sets.midcast.enhancing, {
  239.         main="Beneficus",
  240.         head="Ebers cap +1",
  241.         body="Ebers Bliaud +1",
  242.         hands="Ebers mitts",
  243.         legs="Piety Pantaloons +1",
  244.         feet="Ebers duckbills +1"
  245.     })
  246.    
  247.     sets.midcast['Auspice'] = set_combine( sets.midcast.enhancing, {
  248.         feet="Ebers duckbills +1"
  249.     })
  250.  
  251.     sets.midcast.protect = set_combine(sets.midcast.enhancing, {
  252.         ring1="Sheltered Ring",
  253.         feet="Piety duckbills +1"
  254.     })
  255.  
  256.     sets.midcast.shell = set_combine(sets.midcast.enhancing, {
  257.         ring1="Sheltered Ring",
  258.         legs="Piety Pantaloons +1"
  259.     })
  260.  
  261.     sets.midcast.regen = set_combine(sets.midcast.enhancing, {
  262.         main="Bolelabunga",
  263.         head="Inyanga tiara +2",
  264.         body="Piety Briault +3",
  265.         hands="Ebers mitts",
  266.         legs="Theophany pantaloons +3",
  267.     })
  268.  
  269.     sets.midcast.enfeebling = {
  270.         main="Gada",
  271.         ammo="Hydrocera",
  272.         head="Befouled crown",
  273.         neck="Erra pendant",
  274.         ear1="Gwati earring",
  275.         ear2="Hermetic earring",
  276.         body="Theophany briault +3",
  277.         hands="Inyanga dastanas +2",
  278.         ring1="Stikini ring",
  279.         ring2="Kishar ring",
  280.         back={ name="Alaunus's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Acc.+10','Enmity-10','Spell interruption rate down-10%'}},
  281.         waist="Luminary sash",
  282.         legs="Theophany pantaloons +3",
  283.         feet="Theophany duckbills +3"
  284.     }
  285.  
  286.     sets.midcast.divine = {
  287.         main="Gada",
  288.         ammo="Hydrocera",
  289.         neck="Erra pendant",
  290.         ear1="Gwati earring",
  291.         ear2="Hermetic earring",
  292.         body="Theophany briault +3",
  293.         hands="Inyanga dastanas +2",
  294.         ring1="Stikini ring",
  295.         ring2="Stikini ring",
  296.         back={ name="Alaunus's Cape", augments={'MND+20','Mag. Acc+20 /Mag. Dmg.+20','Mag. Acc.+10','Enmity-10','Spell interruption rate down-10%'}},
  297.         waist="Luminary sash",
  298.         legs="Theophany pantaloons +3",
  299.         feet="Medium's Sabots"
  300.     }
  301.  
  302.     sets.kiting = {
  303.         ring2='Shneddick ring'
  304.     }
  305.  
  306. end
  307.  
  308. function precast(spell)
  309.     -- print_set(spell)
  310.    
  311.     if (sets.ja[spell.english]) then
  312.         equip(sets.ja[spell.english])
  313.     elseif spell.skill == 'Healing Magic' then
  314.         if spell.name:contains("Cure") or spell.name:contains("Curaga") or spell.name:contains("Cura") then
  315.             equip(sets.fc.cure)
  316.         else
  317.             equip(sets.fc.heal)
  318.         end
  319.     elseif spell.name == "Stoneskin" then
  320.         equip(sets.fc.stoneskin)
  321.     elseif spell.action_type == "Magic" then
  322.         equip(sets.fc)
  323.     elseif spell.type == "WeaponSkill" then
  324.         if sets.ws[spell.name] then
  325.             equip(sets.ws[spell.name])
  326.         else
  327.             equip(sets.ws)
  328.         end
  329.     end
  330. end
  331.  
  332. function midcast(spell)
  333.     -- print_set(spell)
  334.     local set_to_equip = sets.idle[Idle_Set_Names[Idle_Index]]
  335.     if spell.skill == 'Healing Magic' or spell.name == "Erase" then
  336.         if spell.name:contains("Cure") then
  337.             if buffactive['Afflatus Solace'] then
  338.                 local solace_cure_set = set_combine(sets.afflatus_solace, sets.midcast.cure)
  339.                 set_to_equip = set_combine(set_to_equip, solace_cure_set)
  340.             else
  341.                 set_to_equip = set_combine(set_to_equip, sets.midcast.cure)
  342.             end
  343.         elseif spell.name:contains("Curaga") or spell.name:contains("Cura") then
  344.             set_to_equip = set_combine(set_to_equip, sets.midcast.cure)
  345.         elseif spell.name == "Cursna" then
  346.             if buffactive['Divine Caress'] then
  347.                 local cursna_divine_caress_set = set_combine(sets.divine_caress, sets.midcast.cursna)
  348.                 set_to_equip = set_combine(set_to_equip, cursna_divine_caress_set)
  349.             else
  350.                 set_to_equip = set_combine(set_to_equip, sets.midcast.cursna)
  351.             end            
  352.         else
  353.             if buffactive['Divine Caress'] then
  354.                 local status_removal_dc = set_combine(sets.divine_caress, sets.midcast.status_removal)
  355.                 set_to_equip = set_combine(set_to_equip, status_removal_dc)
  356.             else
  357.                 set_to_equip = set_combine(set_to_equip, sets.midcast.status_removal)
  358.             end
  359.         end    
  360.     --Enfeebling Magic 
  361.     elseif spell.skill == 'Enfeebling Magic' then
  362.         set_to_equip = set_combine(set_to_equip, sets.midcast.enfeebling)      
  363.     --Enhancing Magic      
  364.     elseif spell.skill == 'Enhancing Magic' then
  365.         if spell.name == 'Stoneskin' then
  366.             set_to_equip = set_combine(set_to_equip, sets.midcast.stoneskin)
  367.         elseif spell.english:contains('Regen') then
  368.             set_to_equip = set_combine(set_to_equip, sets.midcast.regen)
  369.         elseif spell.english:contains('Bar') then
  370.             if buffactive['Afflatus Solace'] then
  371.                 local bar_as = set_combine(sets.afflatus_solace, sets.midcast.bar_element)
  372.                 set_to_equip = set_combine(set_to_equip, bar_as)
  373.             else
  374.                 set_to_equip = set_combine(set_to_equip, sets.midcast.bar_element)
  375.             end
  376.         elseif spell.english:contains('Protect') then
  377.             set_to_equip = set_combine(set_to_equip, sets.midcast.protect)
  378.         elseif spell.english:contains('Shell') then
  379.             set_to_equip = set_combine(set_to_equip, sets.midcast.shell)
  380.         elseif sets.midcast[spell.english] then
  381.             set_to_equip = set_combine(set_to_equip, sets.midcast[spell.english])
  382.         else
  383.             set_to_equip = set_combine(set_to_equip, sets.midcast.enhancing)
  384.         end
  385.     elseif spell.skill == "Divine Magic" then
  386.         set_to_equip = set_combine(set_to_equip, sets.midcast.divine)
  387.     end
  388.     -- print_set(set_to_equip)
  389.     equip(set_to_equip)
  390. end
  391.  
  392. function equip_set(status)
  393.     local set_to_equip = nil
  394.     if status=='Engaged' then
  395.         local tp_set_mode = TP_Set_Names[TP_Index]
  396.         if tp_set_mode == 'None' then
  397.             set_to_equip= sets.idle[Idle_Set_Names[Idle_Index]]
  398.         else
  399.             set_to_equip = sets.tp[TP_Set_Names[TP_Index]]
  400.         end
  401.     else
  402.         set_to_equip = sets.idle[Idle_Set_Names[Idle_Index]]
  403.     end
  404.  
  405.     if Kiting then
  406.         set_to_equip = set_combine(set_to_equip, sets.kiting)
  407.     end
  408.  
  409.     equip(set_to_equip)
  410. end
  411.  
  412. function aftercast(spell)
  413.     equip_set(player.status)
  414. end
  415.  
  416. function status_change(new,old)
  417.     equip_set(new)
  418. end
  419.  
  420. function self_command(command)
  421.     if command == 'cycle TP set' then
  422.         TP_Index = TP_Index % #TP_Set_Names + 1
  423.         send_command('@input /echo ----- TP Set changed to '..TP_Set_Names[TP_Index]..' -----')
  424.         equip_set(player.status)
  425.     elseif command == 'equip pdt' then
  426.         Idle_Index = 2
  427.         send_command('@input /echo ----- Idle Set changed to '..Idle_Set_Names[Idle_Index]..' -----')
  428.         equip_set(player.status)
  429.     elseif command == 'equip mdt' then
  430.         Idle_Index = 1
  431.         send_command('@input /echo ----- Idle Set changed to '..Idle_Set_Names[Idle_Index]..' -----')
  432.         equip_set(player.status)
  433.     elseif command == 'toggle kiting' then
  434.         Kiting = not Kiting
  435.         if Kiting then
  436.             send_command('@input /echo ----- Kiting Set On -----')
  437.         else
  438.             send_command('@input /echo ----- Kiting Set Off -----')
  439.         end
  440.         equip_set(player.status)
  441.     elseif command == 'refresh set' then
  442.         local needsArts =
  443.             player.sub_job:lower() == 'sch' and
  444.             not buffactive['Light Arts'] and
  445.             not buffactive['Addendum: White'] and
  446.             not buffactive['Dark Arts'] and
  447.             not buffactive['Addendum: Black']
  448.            
  449.         if not buffactive['Afflatus Solace'] and not buffactive['Afflatus Misery'] then
  450.             if needsArts then
  451.                 send_command('@input /ja "Afflatus Solace" <me>;wait 1.2;input /ja "Light Arts" <me>')
  452.             else
  453.                 send_command('@input /ja "Afflatus Solace" <me>')
  454.             end
  455.         end
  456.  
  457.         local kitingStatus = (Kiting and "On" or "Off")
  458.         send_command('@input /echo Idle Set: '..Idle_Set_Names[Idle_Index]..' || TP Set: '..TP_Set_Names[TP_Index]..' || Kite: '..kitingStatus )
  459.         equip_set(player.status)
  460.     end
  461. end
  462.  
  463. --I don't like this stuff in my gear swap. Uncomment if you do.
  464. -- function buff_change(buff,gain_or_loss)
  465. --     if gain_or_loss and buff == 'Silence' then
  466. --      send_command('@input /item "Echo Drops" <me>')
  467. --  elseif gain_or_loss and buff == 'Paralyze' then
  468. --      send_command('@input /item "Remedy" <me>')
  469. --     end
  470. -- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement