Treasure Hunter - shastaxc/silver-libs GitHub Wiki

This feature handles equipping TH gear when appropriate based on what Treasure Mode the user has set.

This feature specifically covers many of the flaws in the way Mote and Selindrile's libraries handle Treasure Hunter.

Implementation

Ensure you have the silibs post_precast and post_midcast hooks in your job lua. See the Installation page for more details.

Must have a set named sets.TreasureHunter. This does not need to be a complete set, as it will be overlaid on top of your normal sets for whatever action you use against an enemy (only if you have TH mode turned on).

You must also have a set named sets.TreasureHunter.RA. This one will be used when you make a ranged attack. This can be set to the same as your sets.TreasureHunter set if you wish. But if your normal set uses a range/ammo TH item (like Perfect Lucky Egg) then you will be unable to perform your attack. This RA set is the solution to that problem.

Set up a keybind for turning TH mode on and off. This can be done with a command such as:

  send_command('bind ^` gs c cycle treasuremode')

Keybind commands are usually defined in the job_setup function in Mote Lib, or in the user_job_setup function in Selindrile's Lib.

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_th()
end

Make sure the Mote-TreasureHunter library is NOT imported anywhere in your luas. If you see Mote-TreasureHunter anywhere, remove it.

Optionally, you can remove any references of th_action_check, info.default_ja_ids, and info.default_u_ja_ids from your job file since they will do nothing now.

Create a keybind to change TreasureMode, usually by putting it in your job_setup function:

send_command('bind ^` gs c cycle treasuremode')

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_th()
end

Optionally, you can remove any references of th_action_check, info.th_ma_ids, info.th_ws_ids, info.th_ja_ids, and info.th_u_ja_ids from your job file since they will do nothing now.

In the THF.lua, there are some lines of code you should remove which brute-force TH gear to be used even when it's not necessary. For example, it will cause Aeolian Edge and Ranged Attacks to always use TH gear even in Tag mode. This is sub-optimal and SilverLibs will use the TH gear with those weaponskills in a smarter, more efficient manner. Typically, modifying the JOB.lua files in Selindrile's library is not recommended, but there is no other way to disable this behavior. Below is a list of the code you should remove, along with a snippet of the code for reference:

  • Lines 290-292:
if state.TreasureMode.value == 'SATA' or state.TreasureMode.value == 'Fulltime' then
    equip(sets.TreasureHunter)
end
  • Lines 148-150:
if state.TreasureMode.value ~= 'None' and spell.action_type == 'Ranged Attack' then
    equip(sets.TreasureHunter)
end
  • Lines 139-143:
if 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
  • Lines 112-115:
if (spell.english == 'Aeolian Edge' or spell.english == 'Cyclone') and state.TreasureMode.value ~= 'None' then
  equip(sets.TreasureHunter)
  return
end

Create a keybind to change TreasureMode, usually by putting it in your user_job_setup function:

send_command('bind ^` gs c cycle treasuremode')

Configuration Options

Setting a default/starting TH mode. Valid TreasureModes are: None, Tag, SATA, and Fulltime. If you want to start in a specific TreasureMode besides the default (Tag for THF, None for everyone else), you can set this using the starting_mode config parameter in the enabling function. It is case-sensitive.

silibs.enable_th({starting_mode='Fulltime'})

Defining extra AoE tag actions. TH can be applied when performing AoE actions in Tag mode if any mobs within range of the AoE are not yet tagged. Treats all AoE actions as radial/circular; linear and conal actions may therefore cause TH gear to be equipped even if it only hits tagged mobs. Radial AoEs are recommended for tagging. There is a default list of actions defined for this behavior, but you can add or overwrite entries in this list by setting the aoe_actions config parameter in the enabling function. Action names are case-sensitive. Be sure to include the name, aoe_range in yalms (not the range that allows you to cast it, but the range of the AoE effect itself), and a true/false value for aoe_center_self to indicate if the effect is centered on yourself or an enemy. The following table lists all AoE actions that will attempt to apply TH if a non-tagged enemy is in range of it:

Blue Magic Black Magic Weaponskills White Magic
Venom Shell Firaga Aeolian Edge Diaga
Mysterious Light Blizzaga Cyclone Banishga
Stinking Gas Aeroga Shockwave
Blood Saber Stonega Earth Crusher
Cursed Sphere Thundaga Cataclysm
Sound Blast Waterga
Sheep Song Poisonga
Soporific Fira
Geist Wall Blizzara
Blastbomb Aera
Battle Dance Stonera
Grand Slam Thundara
Bomb Toss Watera

Disable AoE Tagging. AoE TH tagging can be disabled while leaving normal single target TH functionality in place. This will allow you to be in Tag mode, but when you use an AoE like Aeolian Edge, it will not use your TH gear. This means that even though you might hit other enemies with your AoE, the first time you perform a single target or directed attack at them, your TH will still equip. You can set this by adding disable_aoe_tag=true to the configuration parameters.

Example configuration:

silibs.enable_th({
  starting_mode='Fulltime',
  aoe_actions={
    {name="Aeolian Edge",aoe_range=10,aoe_center_self=false},
    {name="Diaga",aoe_range=10,aoe_center_self=false},
    {name="Geist Wall",aoe_range=4.97,center_self=true}
  },
  disable_aoe_tag=true
})

How is this different from Mote-TreasureHunter or Sel-TreasureHunter?

There are a few things which the Mote/Sel TH libraries do not do correctly, and some things that it probably should do but doesn't. Here are some differences in capability:

Capability SilverLibs Mote Selindrile
Tag while out of combat Works! Only if you write the logic yourself, otherwise will prevent actual tagging from working at all. Uses TH gear for some actions like Ranged Attacks, but not others and those others will prevent actual tagging from working afterward.
Tag enemy while engaged with another enemy Works! Nope. Only certain actions like Ranged Attack or Aeolian Edge.
Efficient AoE TH Works! Doesn't even try. Forces all Aeolian Edge and Cyclone to use TH (inefficient) but other AoE abilities are not guaranteed to work properly.
All offensive actions mark enemy as tagged Works! Requires custom definitions of each individual action you want to count as a "TH Tag" action. Requires you to create custom sets in your job lua to force TH to apply properly. Requires custom definitions of each individual action you want to count as a "TH Tag" action. Requires you to create custom sets in your job lua to force TH to apply properly.

Known limitations/bugs

  • Misses will mark target as tagged.
  • In Dynamis (D), AoE will sometimes trigger TH set even after already having tagged all enemies. It is possibly detecting some dead enemies as still alive.