Advertisement
Guest User

WHM

a guest
Mar 20th, 2014
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 17.03 KB | None | 0 0
  1. -------------------------------------------------------------------------------------------------------------------
  2. -- Initialization function that defines sets and variables to be used.
  3. -------------------------------------------------------------------------------------------------------------------
  4.  
  5. -- IMPORTANT: Make sure to also get the Mote-Include.lua file (and its supplementary files) to go with this.
  6.  
  7. -- Initialization function for this job file.
  8. function get_sets()
  9.     -- Load and initialize the include file.
  10.     include('Mote-Include.lua')
  11. end
  12.  
  13. -- Called when this job file is unloaded (eg: job change)
  14. function file_unload()
  15.     if binds_on_unload then
  16.         binds_on_unload()
  17.     end
  18. end
  19.  
  20.  
  21. -- Define sets and vars used by this job file.
  22. function init_gear_sets()
  23.     -- Default macro set/book
  24.     set_macro_page(1, 6)
  25.    
  26.     -- Options: Override default values
  27.     options.OffenseModes = {'None', 'Normal'}
  28.     options.DefenseModes = {'Normal'}
  29.     options.WeaponskillModes = {'Normal'}
  30.     options.CastingModes = {'Normal', 'Resistant', 'Dire'}
  31.     options.IdleModes = {'Normal', 'PDT'}
  32.     options.RestingModes = {'Normal'}
  33.     options.PhysicalDefenseModes = {'PDT'}
  34.     options.MagicalDefenseModes = {'MDT'}
  35.    
  36.     state.Defense.PhysicalMode = 'PDT'
  37.     state.OffenseMode = 'None'
  38.    
  39.     state.Buff['Afflatus Solace'] = buffactive['afflatus solace'] or false
  40.  
  41.     --------------------------------------
  42.     -- Start defining the sets
  43.     --------------------------------------
  44.  
  45.     -- Precast Sets
  46.  
  47.     -- Fast cast sets for spells
  48.     sets.precast.FC = {main=gear.FastcastStaff,ammo="Incantor Stone",
  49.         head="Nahtirah Hat",neck="Orison Locket",ear2="Loquacious Earring",
  50.         body="Anhur Robe",hands="Gendewitha Gages",ring1="Prolix Ring",
  51.         back="Swith Cape",waist="Witful Belt",legs="Orvail Pants +1",feet="Chelona Boots"}
  52.        
  53.     sets.precast.FC.EnhancingMagic = set_combine(sets.precast.FC, {waist="Siegel Sash"})
  54.  
  55.     sets.precast.FC.HealingMagic = set_combine(sets.precast.FC, {legs="Orison Pantaloons +2"})
  56.  
  57.     sets.precast.FC.StatusRemoval = sets.precast.FC.HealingMagic
  58.  
  59.     sets.precast.FC.Cure = set_combine(sets.precast.FC.HealingMagic, {main="Tamaxchi",sub="Genbu's Shield",ammo="Impatiens"})
  60.  
  61.     sets.precast.FC.Curaga = sets.precast.FC.Cure
  62.    
  63.     -- Precast sets to enhance JAs
  64.     sets.precast.JA.Benediction = {body="Piety Briault"}
  65.  
  66.     -- Waltz set (chr and vit)
  67.     sets.precast.Waltz = {
  68.         head="Nahtirah Hat",ear1="Roundel Earring",
  69.         body="Vanir Cotehardie",hands="Yaoyotl Gloves",
  70.         back="Refraction Cape",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
  71.    
  72.    
  73.     -- Weaponskill sets
  74.  
  75.     -- Default set for any weaponskill that isn't any more specifically defined
  76.     gear.default.weaponskill_neck = "Asperity Necklace"
  77.     gear.default.weaponskill_waist = ""
  78.     sets.precast.WS = {
  79.         head="Nahtirah Hat",neck=gear.ElementalGorget,ear1="Bladeborn Earring",ear2="Steelflash Earring",
  80.         body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Rajas Ring",ring2="K'ayres Ring",
  81.         back="Refraction Cape",waist=gear.ElementalBelt,legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
  82.    
  83.     sets.precast.WS['Flash Nova'] = {
  84.         head="Nahtirah Hat",neck="Stoicheion Medal",ear1="Friomisi Earring",ear2="Hecate's Earring",
  85.         body="Vanir Cotehardie",hands="Yaoyotl Gloves",ring1="Rajas Ring",ring2="Strendu Ring",
  86.         back="Toro Cape",waist="Thunder Belt",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
  87.    
  88.  
  89.     -- Midcast Sets
  90.    
  91.     sets.midcast.FastRecast = {
  92.         head="Nahtirah Hat",ear2="Loquacious Earring",
  93.         body="Anhur Robe",hands="Gendewitha Gages",ring1="Prolix Ring",
  94.         back="Swith Cape",waist="Goading Belt",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
  95.    
  96.     -- Cure sets
  97.     gear.default.obi_waist = "Goading Belt"
  98.     gear.default.obi_back = "Swith Cape"
  99.  
  100.     sets.midcast.CureSolace = {main="Tamaxchi",sub="Genbu's Shield",ammo="Mana Ampulla",
  101.         head="Gendewitha Caubeen",neck="Colossus's Torque",ear1="Orison Earring",ear2="Beatific Earring",
  102.         body="Orison Bliaud +2",hands="Theophany Mitts +1",ring1="Haoma's Ring",ring2="Sirona's Ring",
  103.         back="Pahtli Cape",waist="Pythia Sash +1",legs="Orison Pantaloons +2",feet="Piety Duckbills +1"}
  104.  
  105.     sets.midcast.Cure = {main="Tamaxchi",sub="Genbu's Shield",ammo="Incantor Stone",
  106.         head="Theophany Cap +1",neck="Colossus's Torque",ear1="Orison Earring",ear2="Loquacious Earring",
  107.         body="Heka's Kalasiris",hands="Bokwus Gloves",ring1="Prolix Ring",ring2="Sirona's Ring",
  108.         back="Pahtli Cape",waist="Pythia Sash +1",legs="Orison Pantaloons +2",feet="Piety Duckbills +1"}
  109.  
  110.     sets.midcast.Curaga = {main="Tamaxchi",sub="Genbu's Shield",ammo="Incantor Stone",
  111.         head="Theophany Cap +1",neck="Orison Locket",ear1="Orison Earring",ear2="Loquacious Earring",
  112.         body="Heka's Kalasiris",hands="Theophany Mitts +1",ring1="Prolix Ring",ring2="Sirona's Ring",
  113.         back="Pahtli Cape",waist="Pythia Sash +1",legs="Orison Pantaloons +2",feet="Piety Duckbills +1"}
  114.  
  115.     sets.midcast.CureMelee = {ammo="Incantor Stone",
  116.         head="Theophany Cap +1",neck="Orison Locket",ear1="Lifestorm Earring",ear2="Loquacious Earring",
  117.         body="Heka's Kalasiris",hands="Theophany Mitts +1",ring1="Prolix Ring",ring2="Sirona's Ring",
  118.         back=gear.ElementalCape,waist=gear.ElementalBelt,legs="Orison Pantaloons +2",feet="Piety Duckbills +1"}
  119.  
  120.     sets.midcast.Cursna = {main="Beneficus",
  121.         head="Orison Cap +2",neck="Malison Medallion",
  122.         hands="Ayao's Gages",ring1="Haoma's Ring",ring2="Haoma's Ring",
  123.         legs="Theophany Pantaloons +1",feet="Gendewitha Galoshes"}
  124.  
  125.     sets.midcast.StatusRemoval = {
  126.         head="Orison Cap +2",legs="Orison Pantaloons +2"}
  127.  
  128.  
  129.     sets.midcast.EnhancingMagic = {main="Beneficus",sub="Genbu's Shield",
  130.         body="Anhur Robe",hands="Dynasty Mitts",neck="Colossus's Torque",
  131.         waist="Olympus Sash",legs="Piety Pantaloons",feet="Orison Duckbills +2"}
  132.  
  133.     sets.midcast.Stoneskin = {
  134.         head="Nahtirah Hat",neck="Orison Locket",ear2="Loquacious Earring",
  135.         body="Anhur Robe",hands="Gendewitha Gages",
  136.         back="Swith Cape",waist="Siegel Sash",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
  137.  
  138.     sets.midcast.Auspice = {feet="Orison Duckbills +2"}
  139.  
  140.     sets.midcast.BarElement = {main="Beneficus",sub="Genbu's Shield",
  141.         head="Orison Cap +2",neck="Colossus's Torque",
  142.         body="Orison Bliaud +2",hands="Orison Mitts +2",
  143.         waist="Olympus Sash",legs="Piety Pantaloons",feet="Orison Duckbills +2"}
  144.  
  145.     sets.midcast.Regen = {
  146.         body="Piety Briault",hands="Orison Mitts +2",
  147.         legs="Theophany Pantaloons +1"}
  148.  
  149.     sets.midcast.Protectra = {ring1="Sheltered Ring",feet="Piety Duckbills +1"}
  150.  
  151.     sets.midcast.Shellra = {ring1="Sheltered Ring",legs="Piety Pantaloons"}
  152.    
  153.    
  154.     sets.midcast.Haste = {hands="Dynasty Mitts"}
  155.  
  156.  
  157.     sets.midcast.DivineMagic = {main="Venabulum",sub="Mephitis Grip",
  158.         head="Nahtirah Hat",neck="Eddy Necklace",ear1="Psystorm Earring",ear2="Lifestorm Earring",
  159.         body="Gendewitha Bliaut",hands="Lurid Mitts",ring2="Sangoma Ring",
  160.         back=gear.ElementalCape,waist=gear.ElementalBelt,legs="Theophany Pantaloons +1",feet="Orison Duckbills +2"}
  161.  
  162.     sets.midcast.DarkMagic = {main="Venabulum", sub="Mephitis Grip",
  163.         head="Nahtirah Hat",neck="Eddy Necklace",ear1="Psystorm Earring",ear2="Lifestorm Earring",
  164.         body="Gendewitha Bliaut",hands="Lurid Mitts",ring1="Strendu Ring",ring2="Sangoma Ring",
  165.         back="Refraction Cape",waist="Demonry Sash",legs="Bokwus Slops",feet="Bokwus Boots"}
  166.  
  167.     --sets.midcast.Stun = set_combine(sets.midcast.DarkMagic, {main=gear.RecastStaff})
  168.  
  169.     -- Custom spell classes
  170.     sets.midcast.MndEnfeebles = {main="Venabulum", sub="Mephitis Grip",
  171.         head="Nahtirah Hat",neck="Eddy Necklace",ear1="Psystorm Earring",ear2="Lifestorm Earring",
  172.         body="Gendewitha Bliaut",hands="Lurid Mitts",ring1="Strendu Ring",ring2="Sangoma Ring",
  173.         back="Refraction Cape",waist="Demonry Sash",legs="Orvail Pants +1",feet="Theophany Duckbills +1"}
  174.  
  175.     sets.midcast.IntEnfeebles = {main="Venabulum", sub="Mephitis Grip",
  176.         head="Nahtirah Hat",neck="Eddy Necklace",ear1="Psystorm Earring",ear2="Lifestorm Earring",
  177.         body="Gendewitha Blaut",hands="Lurid Mitts",ring1="Strendu Ring",ring2="Sangoma Ring",
  178.         back="Refraction Cape",waist="Demonry Sash",legs="Orvail Pants +1",feet="Theophany Duckbills +1"}
  179.  
  180.    
  181.     -- Sets to return to when not performing an action.
  182.    
  183.     -- Resting sets
  184.     sets.resting = {main=gear.Staff.HMP,
  185.         head="Nefer Khat",
  186.         body="Heka's Kalasiris",hands="Serpentes Cuffs",
  187.         waist="Austerity Belt",legs="Nares Trews",feet="Chelona Boots",ammo="Mana Ampulla"}
  188.    
  189.  
  190.     -- Idle sets (default idle set not needed since the other three are defined, but leaving for testing purposes)
  191.     sets.idle = {main="Terra's Staff", sub="Oneiros Grip",ammo="Incantor Stone",
  192.         head="Nefer Khat",neck="Twilight Torque",ear1="Gifted Earring",ear2="Loquacious Earring",
  193.         body="Heka's Kalasiris",hands="Serpentes Cuffs",ring1="Paguroidea Ring",ring2="Defending Ring",
  194.         back="Umbra Cape",waist="Fucho-no-Obi",legs="Nares Trews",feet="Serpentes Sabots"}
  195.  
  196.     sets.idle.PDT = {main="Terra's Staff", sub="Oneiros Grip",ammo="Incantor Stone",
  197.         head="Gendewitha Caubeen",neck="Twilight Torque",ear1="Gifted Earring",ear2="Loquacious Earring",
  198.         body="Gendewitha Bliaut",hands="Gendewitha Gages",ring1="Dark Ring",ring2="Defending Ring",
  199.         back="Umbra Cape",waist="Slipor Sash",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
  200.  
  201.     sets.idle.Town = {main="Venabulum", sub="Oneiros Grip",ammo="Impatiens",
  202.         head="Theophany Cap +1",neck="Eddy Necklace",ear1="Gifted Earring",ear2="Loquacious Earring",
  203.         body="Piety Briault",hands="Dynasty Mitts",ring1="Patricius Ring",ring2="Defending Ring",
  204.         back="Umbra Cape",waist="Fucho-no-Obi",legs="Piety Pantaloons",feet="Piety Duckbills +1"}
  205.    
  206.     sets.idle.Weak = {main="Terra's Staff",sub="Oneiros Grip",ammo="Incantor Stone",
  207.         head="Nahtirah Hat",neck="Twilight Torque",ear1="Gifted Earring",ear2="Loquacious Earring",
  208.         body="Gendewitha Bliaut",hands="Lurid Mitts",ring1="Dark Ring",ring2="Defending Ring",
  209.         back="Umbra Cape",waist="Fucho-no-Obi",legs="Nares Trews",feet="Theophany Duckbills +1"}
  210.    
  211.    
  212.    
  213.     -- Defense sets
  214.  
  215.     sets.defense.PDT = {main="Terra's Staff",sub="Oneiros Grip",
  216.         head="Gendewitha Caubeen",neck="Twilight Torque",
  217.         body="Gendewitha Bliaut",hands="Gendewitha Gages",ring1="Dark Ring",ring2="Defending Ring",
  218.         back="Umbra Cape",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
  219.  
  220.     sets.defense.MDT = {main="Terra's Staff",sub="Oneiros Grip",
  221.         head="Theophany Cap +1",neck="Twilight Torque",
  222.         body="Gendewitha Bliaut",hands="Dynasty Mitts",ring1="Dark Ring",ring2="Defending Ring",
  223.         waist="Slipor Sash",legs="Theophany Pantaloons +1",feet="Theophany Duckbills +1",ear1="Sanare Earring",
  224.         ear2="Mujin Stud"}
  225.  
  226.     sets.Kiting = {feet="Herald's Gaiters"}
  227.  
  228.     -- Engaged sets
  229.  
  230.     -- Variations for TP weapon and (optional) offense/defense modes.  Code will fall back on previous
  231.     -- sets if more refined versions aren't defined.
  232.     -- If you create a set with both offense and defense modes, the offense mode should be first.
  233.     -- EG: sets.engaged.Dagger.Accuracy.Evasion
  234.    
  235.     -- Basic set for if no TP weapon is defined.
  236.     sets.engaged = {
  237.         head="Theophany Cap +1",neck="Asperity Necklace",ear1="Bladeborn Earring",ear2="Steelflash Earring",
  238.         body="Vanir Cotehardie",hands="Dynasty Mitts",ring1="Rajas Ring",ring2="K'ayres Ring",
  239.         back="Umbra Cape",waist="Goading Belt",legs="Gendewitha Spats",feet="Gendewitha Galoshes"}
  240.  
  241.  
  242.     -- Buff sets: Gear that needs to be worn to actively enhance a current player buff.
  243.     sets.buff['Divine Caress'] = {hands="Orison Mitts +2"}
  244. end
  245.  
  246. -------------------------------------------------------------------------------------------------------------------
  247. -- Job-specific hooks that are called to process player actions at specific points in time.
  248. -------------------------------------------------------------------------------------------------------------------
  249.  
  250. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  251. -- Set eventArgs.useMidcastGear to true if we want midcast gear equipped on precast.
  252. function job_precast(spell, action, spellMap, eventArgs)
  253.     classes.CustomClass = get_spell_class(spell, action, spellMap)
  254.  
  255.     if spell.english == "Paralyna" and buffactive.Paralyzed then
  256.         -- no gear swaps if we're paralyzed, to avoid blinking while trying to remove it.
  257.         eventArgs.handled = true
  258.     end
  259.    
  260.     if spell.skill == 'HealingMagic' then
  261.         gear.default.obi_back = "Refraction Cape"
  262.     else
  263.         gear.default.obi_back = "Toro Cape"
  264.     end
  265. end
  266.  
  267.  
  268. -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
  269. function job_midcast(spell, action, spellMap, eventArgs)
  270.     if spell.action_type == 'Magic' then
  271.         -- Default base equipment layer of fast recast.
  272.         equip(sets.midcast.FastRecast)
  273.     end
  274. end
  275.  
  276.  
  277. function job_post_midcast(spell, action, spellMap, eventArgs)
  278.     -- Apply Divine Caress boosting items as highest priority over other gear, if applicable.
  279.     if spellMap == 'StatusRemoval' and buffactive['Divine Caress'] then
  280.         equip(sets.buff['Divine Caress'])
  281.     end
  282. end
  283.  
  284.  
  285. -- Return true if we handled the aftercast work.  Otherwise it will fall back
  286. -- to the general aftercast() code in Mote-Include.
  287. function job_aftercast(spell, action, spellMap, eventArgs)
  288.     if not spell.interrupted then
  289.         if state.Buff[spell.name] ~= nil then
  290.             state.Buff[spell.name] = true
  291.         elseif spell.name == "Afflatus Misery" then
  292.             state.Buff['Afflatus Solace'] = false
  293.         end
  294.     end
  295. end
  296.  
  297.  
  298. -------------------------------------------------------------------------------------------------------------------
  299. -- Customization hooks for idle and melee sets, after they've been automatically constructed.
  300. -------------------------------------------------------------------------------------------------------------------
  301.  
  302. function customize_idle_set(idleSet)
  303.     if player.mpp < 90 and state.IdleMode == "Normal" and state.Defense.Active == false then
  304.         idleSet = set_combine(idleSet, sets.Owleyes)
  305.     end
  306.    
  307.     return idleSet
  308. end
  309.  
  310.  
  311. -------------------------------------------------------------------------------------------------------------------
  312. -- General hooks for other events.
  313. -------------------------------------------------------------------------------------------------------------------
  314.  
  315. -- Called when a player gains or loses a buff.
  316. -- buff == buff gained or lost
  317. -- gain == true if the buff was gained, false if it was lost.
  318. function job_buff_change(buff, gain)
  319.     if state.Buff[buff] ~= nil then
  320.         state.Buff[buff] = gain
  321.     end
  322. end
  323.  
  324.  
  325. -------------------------------------------------------------------------------------------------------------------
  326. -- User code that supplements self-commands.
  327. -------------------------------------------------------------------------------------------------------------------
  328.  
  329. -- Called by the 'update' self-command.
  330. function job_update(cmdParams, eventArgs)
  331.     if cmdParams[1] == 'user' and not areas.Cities:contains(world.area) then
  332.         local needsArts =
  333.             player.sub_job:lower() == 'sch' and
  334.             not buffactive['Light Arts'] and
  335.             not buffactive['Addendum: White'] and
  336.             not buffactive['Dark Arts'] and
  337.             not buffactive['Addendum: Black']
  338.            
  339.         if not buffactive['Afflatus Solace'] and not buffactive['Afflatus Misery'] then
  340.             if needsArts then
  341.                 windower.send_command('input /ja "Afflatus Solace" <me>;wait 1.2;input /ja "Light Arts" <me>')
  342.             else
  343.                 windower.send_command('input /ja "Afflatus Solace" <me>')
  344.             end
  345.         end
  346.     end
  347. end
  348.  
  349.  
  350. -- Handle notifications of general user state change.
  351. function job_state_change(stateField, newValue)
  352.     if stateField == 'OffenseMode' then
  353.         if newValue == 'Normal' then
  354.             disable('main','sub')
  355.         else
  356.             enable('main','sub')
  357.         end
  358.     elseif stateField == 'Reset' then
  359.         if state.OffenseMode == 'None' then
  360.             enable('main','sub')
  361.         end
  362.     end
  363. end
  364.  
  365.  
  366. -- Function to display the current relevant user state when doing an update.
  367. -- Return true if display was handled, and you don't want the default info shown.
  368. function display_current_job_state(eventArgs)
  369.     local defenseString = ''
  370.     if state.Defense.Active then
  371.         local defMode = state.Defense.PhysicalMode
  372.         if state.Defense.Type == 'Magical' then
  373.             defMode = state.Defense.MagicalMode
  374.         end
  375.  
  376.         defenseString = 'Defense: '..state.Defense.Type..' '..defMode..', '
  377.     end
  378.  
  379.     add_to_chat(122,'Casting ['..state.CastingMode..'], Idle ['..state.IdleMode..'], '..defenseString..
  380.         'Kiting: '..on_off_names[state.Kiting])
  381.  
  382.     eventArgs.handled = true
  383. end
  384.  
  385. -------------------------------------------------------------------------------------------------------------------
  386. -- Utility functions specific to this job.
  387. -------------------------------------------------------------------------------------------------------------------
  388.  
  389. function get_spell_class(spell, action, spellMap)
  390.     local spellclass
  391.    
  392.     if spell.action_type == 'Magic' then
  393.         if spell.skill == "EnfeeblingMagic" then
  394.             if spell.type == "WhiteMagic" then
  395.                 spellclass = "MndEnfeebles"
  396.             else
  397.                 spellclass = "IntEnfeebles"
  398.             end
  399.         else
  400.             if spellMap == 'Cure' and state.Buff['Afflatus Solace'] then
  401.                 spellclass = "CureSolace"
  402.             elseif (spellMap == 'Cure' or spellMap == "Curaga") and player.status == 'Engaged' and player.equipment.main ~= 'Tamaxchi' then
  403.                 spellclass = "CureMelee"
  404.             end
  405.         end
  406.     end
  407.    
  408.     return spellclass
  409. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement