Integrate HasteInfo - shastaxc/silver-libs GitHub Wiki
Integrates the HasteInfo addon. You must already have HasteInfo installed. See this link for details about what it does and how to install it https://github.com/shastaxc/HasteInfo
Implementation
See the Installation page for details on first steps if you have not yet installed SilverLibs into your job lua. To implement this specific feature:
If Using Mote Libs
If the specified functions already exist, just put the silibs part inside of it in the appropriate spot. Please add the following:
function job_setup()
silibs.enable_haste_info()
end
Also, you must update your combat form in the job_handle_equipping_gear function:
function job_handle_equipping_gear(playerStatus, eventArgs)
silibs.update_combat_form()
end
The silibs.update_combat_form() is provided for you, but you can use your own function if you'd like. See the "Customizing the Combat Forms" section of this page for details.
If Using Selindrile Libs
If the specified functions already exist, just put the silibs part inside of it in the appropriate spot. Please add the following in your char_job_gear.lua file:
function user_job_setup()
silibs.enable_haste_info()
end
Also, you must update your combat form in the job_handle_equipping_gear function (for all jobs except THF):
function job_handle_equipping_gear(playerStatus, eventArgs)
silibs.update_combat_form()
end
For THF only:
function job_handle_equipping_gear(playerStatus, eventArgs)
silibs.update_combat_form()
have_buff('Sneak Attack', eventArgs)
have_buff('Trick Attack', eventArgs)
end
The silibs.update_combat_form() is provided for you, but you can use your own function if you'd like. See the "Customizing the Combat Forms" section of this page for details.
Defining Engaged Sets
The provided silibs.update_combat_form() function from SilverLibs sets your state.CombatForm variable to one of several possible options depending on how much dual wield is needed. The amount of DW you need is pulled from the silibs.dw_needed variable. (Note: Never modify the silibs.dw_needed variable or the HasteInfo integration may not work at all; use silibs.get_dual_wield_needed() if you need to use the value for anything to avoid accidentally modifying it.)
The default DW ranges and the corresponding tier names / set names are optimized for /NIN, defined as follows:
| DW Needed | Tier Name | Description |
|---|---|---|
| -1 | --------- | You do not have access to any Dual Wield traits. |
| 0 | --------- | You have access to DW but are already attack speed capped. |
| 1 - 11 | LowDW | You should use a set with near 11 DW in it. |
| 11 - 18 | MidDW | You should use a set with near 18 DW in it. |
| 19 - 31 | HighDW | You should use a set with near 31 DW in it. |
| 32 - 42 | SuperDW | You should use a set with near 42 DW in it. |
| 42+ | MaxDW | You should use a set with 50-60 DW in it. |
Using this default behavior, your engaged sets would have the following names:
sets.engaged = {} -- This set should have 0 DW in it.
sets.engaged.LowDW = {}
sets.engaged.MidDW = {}
sets.engaged.HighDW = {}
sets.engaged.SuperDW = {}
sets.engaged.MaxDW = {}
Customizing the Combat Forms
You have the option to use your own CombatForm updating function if you wish. To do so, just change the function you call within job_handle_equipping_gear from silibs.update_combat_form() to update_combat_form() and define that function somewhere in your lua.
Some reasons you might want to use your own function include: if you are currently using the state.CombatForm field for something other than dual wield, if you'd like to customize the names of the combat forms, or to change the dual wield breakpoints for each tier.
If you don't want to deal with multiple DW sets
Here's an example of a custom update_combat_form function for someone who only wants to deal with a single DW set instead of one for multiple tiers:
function update_combat_form()
if silibs.get_dual_wield_needed() <= 0 or not silibs.is_dual_wielding() then
state.CombatForm:reset()
else
state.CombatForm:set('DW')
end
end
With your custom function defined, your engaged sets would then have the following names:
sets.engaged = {} -- This set should have 0 DW in it.
sets.engaged.DW = {} -- This set should have DW in it.
If you want to change your DW breakpoints
Here's an example of a custom update_combat_form function for someone who wants the DW tiers defined at different breakpoints than default:
function update_combat_form()
if silibs.get_dual_wield_needed() <= 0 or not silibs.is_dual_wielding() then
state.CombatForm:reset()
else
if silibs.get_dual_wield_needed() > 0 and silibs.get_dual_wield_needed() <= 6 then
state.CombatForm:set('LowDW')
elseif silibs.get_dual_wield_needed() > 6 and silibs.get_dual_wield_needed() <= 13 then
state.CombatForm:set('MidDW')
elseif silibs.get_dual_wield_needed() > 13 and silibs.get_dual_wield_needed() <= 26 then
state.CombatForm:set('HighDW')
elseif silibs.get_dual_wield_needed() > 26 and silibs.get_dual_wield_needed() <= 37 then
state.CombatForm:set('SuperDW')
elseif silibs.get_dual_wield_needed() > 37 then
state.CombatForm:set('MaxDW')
end
end
end
Get Current Dual Wield Value
At any time, you can get your current dual wield amount from this function silibs.get_dual_wield_needed()
You must have already followed the "Implementation" steps above to enable this feature.
Determine if you are currently wearing dual-wielding weapons
It's obviously easy for you to tell if you have two weapons equipped, but sometimes it can be difficult for GearSwap to know programmatically. SilverLibs provides this utility function for a quick and easy check to see if you have dual wield weapons currently equipped or not: silibs.is_dual_wielding()
Also, sometimes you wanna tell if you have the trait that allows you to dual wield even if you are not currently wielding two weapons. In that case, you can check that in silibs.can_dual_wield()