Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------------------------------------------------------------------------------------------------
- -- Setup functions for this job. Generally should not be modified.
- -------------------------------------------------------------------------------------------------------------------
- --[[
- Custom commands:
- gs c cycle treasuremode (set on ctrl-= by default): Cycles through the available treasure hunter modes.
- Treasure hunter modes:
- None - Will never equip TH gear
- Tag - Will equip TH gear sufficient for initial contact with a mob (either melee, ranged hit, or Aeolian Edge AOE)
- SATA - Will equip TH gear sufficient for initial contact with a mob, and when using SATA
- Fulltime - Will keep TH gear equipped fulltime
- --]]
- -- Initialization function for this job file.
- function get_sets()
- mote_include_version = 2
- -- Load and initialize the include file.
- include('Mote-Include.lua')
- end
- -- Setup vars that are user-independent. state.Buff vars initialized here will automatically be tracked.
- function job_setup()
- state.Buff['Sneak Attack'] = buffactive['sneak attack'] or false
- state.Buff['Trick Attack'] = buffactive['trick attack'] or false
- state.Buff['Feint'] = buffactive['feint'] or false
- include('Mote-TreasureHunter')
- -- For th_action_check():
- -- JA IDs for actions that always have TH: Provoke, Animated Flourish
- info.default_ja_ids = S{35, 204}
- -- Unblinkable JA IDs for actions that always have TH: Quick/Box/Stutter Step, Desperate/Violent Flourish
- info.default_u_ja_ids = S{201, 202, 203, 205, 207}
- end
- -------------------------------------------------------------------------------------------------------------------
- -- User setup functions for this job. Recommend that these be overridden in a sidecar file.
- -------------------------------------------------------------------------------------------------------------------
- -- Setup vars that are user-dependent. Can override this function in a sidecar file.
- function user_setup()
- state.OffenseMode:options('Normal', 'Party', 'Acc', 'Evasion')
- --state.HybridMode:options('Normal', 'Evasion', 'PDT')
- --state.RangedMode:options('Normal', 'Acc')
- state.WeaponskillMode:options('Normal', 'Party', 'Acc')
- state.PhysicalDefenseMode:options('PDT', 'Evasion')
- state.MagicalDefenseMode:options('MDT')
- -- Additional local binds
- send_command('bind ^` input /ja "Flee" <me>')
- send_command('bind ^= gs c cycle treasuremode')
- send_command('bind !- gs c cycle targetmode')
- send_command('bind !q input /ja "Animated flourish" <t>;input /ja "Provoke" <t>;input /ma "Utsusemi: Ichi" <me>')
- send_command('bind !w input /ja "Violent flourish" <t>;input /ja "Defender" <me>;input /ma "Utsusemi: Ni" <me>')
- send_command('bind !e input /ja "Quickstep" <t>')
- send_command('bind !r input /ja "Reverse Flourish" <me>')
- send_command('bind !a input /ja "Spectral Jig" <me>;input /ja "Berserk" <me>;input /ma "Monomi: Ichi" <me>')
- send_command('bind !s input /ja "Haste samba" <me>;input /ja "Warcry" <me>;input /ma "Tonko: Ni" <me>')
- send_command('bind !d input /ja "Box step" <t>;input /ja "Aggressor" <me>')
- send_command('bind !z input /ja "Curing waltz III" <stpc>')
- send_command('bind !x input /ja "Healing waltz" <stpc>')
- select_default_macro_book()
- end
- -- Called when this job file is unloaded (eg: job change)
- function user_unload()
- send_command('unbind ^`')
- send_command('unbind !-')
- end
- -- Define sets and vars used by this job file.
- function init_gear_sets()
- include('THF_gear.lua')
- end
- -------------------------------------------------------------------------------------------------------------------
- -- Job-specific hooks for standard casting events.
- -------------------------------------------------------------------------------------------------------------------
- -- Run after the general precast() is done.
- function job_post_precast(spell, action, spellMap, eventArgs)
- if spell.english == 'Aeolian Edge' and state.TreasureMode.value ~= 'None' then
- equip(sets.TreasureHunter)
- elseif spell.english=='Sneak Attack' or spell.english=='Trick Attack' or spell.type == 'WeaponSkill' then
- if state.TreasureMode.value == 'SATA' or state.TreasureMode.value == 'Fulltime' then
- equip(sets.TreasureHunter)
- end
- end
- if spell.english == 'Utsusemi: Ichi' and (buffactive['Copy Image'] or buffactive['Copy Image (2)']) then
- send_command('@wait 3; cancel 66; cancel 444')
- end
- if spell.english == 'Spectral Jig' then
- send_command('cancel 71;')
- end
- end
- -- Run after the general midcast() set is constructed.
- function job_post_midcast(spell, action, spellMap, eventArgs)
- if state.TreasureMode.value ~= 'None' and spell.action_type == 'Ranged Attack' then
- equip(sets.TreasureHunter)
- end
- end
- -- Set eventArgs.handled to true if we don't want any automatic gear equipping to be done.
- function job_aftercast(spell, action, spellMap, eventArgs)
- -- Weaponskills wipe SATA/Feint. Turn those state vars off before default gearing is attempted.
- if spell.type == 'WeaponSkill' and not spell.interrupted then
- state.Buff['Sneak Attack'] = false
- state.Buff['Trick Attack'] = false
- state.Buff['Feint'] = false
- end
- end
- -- Called after the default aftercast handling is complete.
- function job_post_aftercast(spell, action, spellMap, eventArgs)
- -- If Feint is active, put that gear set on on top of regular gear.
- -- This includes overlaying SATA gear.
- check_buff('Feint', eventArgs)
- end
- -------------------------------------------------------------------------------------------------------------------
- -- Job-specific hooks for non-casting events.
- -------------------------------------------------------------------------------------------------------------------
- -- Called when a player gains or loses a buff.
- -- buff == buff gained or lost
- -- gain == true if the buff was gained, false if it was lost.
- function job_buff_change(buff, gain)
- if state.Buff[buff] ~= nil then
- if not midaction() then
- handle_equipping_gear(player.status)
- end
- end
- end
- -------------------------------------------------------------------------------------------------------------------
- -- User code that supplements standard library decisions.
- -------------------------------------------------------------------------------------------------------------------
- function get_custom_wsmode(spell, spellMap, defaut_wsmode)
- local wsmode
- if state.Buff['Sneak Attack'] then
- wsmode = 'SA'
- end
- if state.Buff['Trick Attack'] then
- wsmode = (wsmode or '') .. 'TA'
- end
- return wsmode
- end
- -- Called any time we attempt to handle automatic gear equips (ie: engaged or idle gear).
- function job_handle_equipping_gear(playerStatus, eventArgs)
- -- Check that ranged slot is locked, if necessary
- check_range_lock()
- -- Check for SATA when equipping gear. If either is active, equip
- -- that gear specifically, and block equipping default gear.
- check_buff('Sneak Attack', eventArgs)
- check_buff('Trick Attack', eventArgs)
- end
- function customize_idle_set(idleSet)
- if player.hpp < 80 then
- idleSet = set_combine(idleSet, sets.ExtraRegen)
- end
- return idleSet
- end
- function customize_melee_set(meleeSet)
- if state.TreasureMode.value == 'Fulltime' then
- meleeSet = set_combine(meleeSet, sets.TreasureHunter)
- end
- if state.DefenseMode.value ~= "None" and buffactive['Reive Mark'] then
- meleeSet = set_combine(meleeSet, {neck="Adoulin's Refuge +1"})
- end
- return meleeSet
- end
- -- Called by the 'update' self-command.
- function job_update(cmdParams, eventArgs)
- th_update(cmdParams, eventArgs)
- end
- -- Function to display the current relevant user state when doing an update.
- -- Return true if display was handled, and you don't want the default info shown.
- function display_current_job_state(eventArgs)
- local msg = 'Melee'
- if state.CombatForm.has_value then
- msg = msg .. ' (' .. state.CombatForm.value .. ')'
- end
- msg = msg .. ': '
- msg = msg .. state.OffenseMode.value
- if state.HybridMode.value ~= 'Normal' then
- msg = msg .. '/' .. state.HybridMode.value
- end
- msg = msg .. ', WS: ' .. state.WeaponskillMode.value
- if state.DefenseMode.value ~= 'None' then
- msg = msg .. ', ' .. 'Defense: ' .. state.DefenseMode.value .. ' (' .. state[state.DefenseMode.value .. 'DefenseMode'].value .. ')'
- end
- if state.Kiting.value == true then
- msg = msg .. ', Kiting'
- end
- if state.PCTargetMode.value ~= 'default' then
- msg = msg .. ', Target PC: '..state.PCTargetMode.value
- end
- if state.SelectNPCTargets.value == true then
- msg = msg .. ', Target NPCs'
- end
- msg = msg .. ', TH: ' .. state.TreasureMode.value
- add_to_chat(122, msg)
- eventArgs.handled = true
- end
- -------------------------------------------------------------------------------------------------------------------
- -- Utility functions specific to this job.
- -------------------------------------------------------------------------------------------------------------------
- -- State buff checks that will equip buff gear and mark the event as handled.
- function check_buff(buff_name, eventArgs)
- if state.Buff[buff_name] then
- equip(sets.buff[buff_name] or {})
- if state.TreasureMode.value == 'SATA' or state.TreasureMode.value == 'Fulltime' then
- equip(sets.TreasureHunter)
- end
- eventArgs.handled = true
- end
- end
- -- Check for various actions that we've specified in user code as being used with TH gear.
- -- This will only ever be called if TreasureMode is not 'None'.
- -- Category and Param are as specified in the action event packet.
- function th_action_check(category, param)
- if category == 2 or -- any ranged attack
- --category == 4 or -- any magic action
- (category == 3 and param == 30) or -- Aeolian Edge
- (category == 6 and info.default_ja_ids:contains(param)) or -- Provoke, Animated Flourish
- (category == 14 and info.default_u_ja_ids:contains(param)) -- Quick/Box/Stutter Step, Desperate/Violent Flourish
- then return true
- end
- end
- -- Function to lock the ranged slot if we have a ranged weapon equipped.
- function check_range_lock()
- if player.equipment.range ~= 'empty' then
- disable('range', 'ammo')
- else
- enable('range', 'ammo')
- end
- end
- -- Select default macro book on initial load or subjob change.
- function select_default_macro_book()
- -- Default macro set/book
- if player.sub_job == 'DNC' then
- set_macro_page(1, 1)
- elseif player.sub_job == 'WAR' then
- set_macro_page(1, 1)
- elseif player.sub_job == 'NIN' then
- set_macro_page(1, 1)
- else
- set_macro_page(1, 1)
- end
- end
Add Comment
Please, Sign In to add comment