ExtractOrRefineSmithingItem

From ESOUI Wiki

Jump to: navigation, search

This action attempts to extract or refine the item in the specified bag slot.

If the item is a raw material, then it will be refined. If it is an armor, weapon, or jewelry item, then it will be deconstructed if possible. Only one item can be deconstructed at a time, so if you wish to deconstruct multiple items automatically, you must listen for crafting events and process them in a queue.

Arguments

bagId
A number representing the bag to check; it must be one of the built-in Bag values.
slotIndex
The numeric index of the slot in that bag which should be checked. For most bags, this is a number ranging from 1 to the size of the bag.

Example

-- GIVEN:
-- number bagIndex
-- number slotIndex
--
-- We could just blindly call the function, but if we don't know 
-- anything about the item we're working with, then we don't know 
-- what'll happen if we call the function. Will we deconstruct an 
-- item? Refine a material? Or will nothing happen at all?
--
local _, itemType = GetItemCraftingInfo(bagIndex, slotIndex)
if itemType == ITEMTYPE_GLYPH_WEAPON
or itemType == ITEMTYPE_GLYPH_ARMOR
or itemType == ITEMTYPE_GLYPH_JEWELRY
then
   --
   -- This type of item can be deconstructed... but what about this 
   -- specific item?
   --
   local link = GetItemLink(bagIndex, slotIndex)
   if IsItemLinkForcedNotDeconstructable(link) and not IsItemLinkContainer(link) then
      --
      -- This is the check that the game uses to tell whether something 
      -- is "forced non-deconstructable." Generally this seems to apply 
      -- to jewelry items that existed before the Summerset update.
      --
   else
      --
      -- The item is of a type that can be deconstructed, and it's not 
      -- "forced non-deconstructable," so let's break it apart!
      --
      ExtractOrRefineSmithingItem(bagIndex, slotIndex)
   end
end

External links

Personal tools
Namespaces
Variants
Actions
Menu
Wiki
Toolbox