API:GetBonusIsSalvagable
From RoR Wiki
UI Lua API · Crafting functions
Version: WAR 1.4.8
Returns whether a magic bonus of an item can be extracted by salvaging, based on the item's level.
salvagable = GetBonusIsSalvagable(itemLevel, bonusReference)
Arguments
- itemLevel
number– Level of the item. The stock UI passes the item'slevelfield.- bonusReference
number– The bonus (stat) number, thereferencefield of an entry in the item'sbonustable.
Returns
- salvagable
number– 1 if the bonus can be salvaged, 0 if not. This is a number, not a boolean: compare it with 1 or 0.
Details
- For the bonus references 76, 77, 78, 80, 81, 82, 89 and 94 the item level must be at least 20. Every other reference returns 1.
- The client does not check the player's salvaging skill or the item's salvage flags.
- If there is no player object or the Lua state is not available, nothing is returned.
- The function needs at least two arguments and only reads the last two.
Errors
None besides the generic Invalid Parameters message when an argument is not a number.
Example
From default/ea_craftingwindow/source/salvagingwindow.lua:
for index, bonus in ipairs(itemData.bonus)
do
if( bonus.type == GameData.BonusTypes.SETBONUS_MAGIC and GetBonusIsSalvagable(itemData.level, bonus.reference) == 1)
then
