Item¶
The Item
library contains methods relating to item game objects.
ItemLib Class¶
Inherits from Library
.
Methods¶
CanUse¶
Returns whether char meets the requirements to use an item.
@param char Character
@param item Item
CountItemsInInventory¶
Count the items in an entity's inventory that match a predicate function.
Predicate is passed Item
and should return true for items to be counted.
@param entity Entity
@param predicate fun(item: EsvItem)
Get¶
@param identifier GUID|NetId|EntityHandle
@param isFlashHandle boolean?
GetContainedItems¶
Returns the items contained within a container item, optionally filtered by predicate.
@param container Item
@param predicate (fun(item:Item):boolean)?
The predicate should return `true` for items to be included. If `nil`, all items will be included.
GetCurrentDye¶
function ItemLib.GetCurrentDye(item)
-> string,Dye The dye ID and data table.-- dye ID and data table.
Returns the ID and data for the most recently-applied dye deltamod on the item.
@param item Item
GetDisplayName¶
Returns the display name of the item.
Considers overrides and identification status.
Does not append item amount.
@param item Item
GetEquipmentSubtype¶
Returns the subtype of item (ex. "Knife" or "Platemail").
Returns ItemSlot for items with no subtypes.
@param item Item
GetEquippedItem¶
@param char Character
@param slot ItemSlot
GetEquippedSlot¶
Returns the slot that an item is equipped in, or nil if it is not.
@param item Item
@param char Character?
Defaults to item's owner.
GetHandedness¶
Returns the handedness of a weapon item.
@param item Item
GetIcon¶
Returns the icon of the item.
Fetching the icon is technically different per context; the server only cares about root template icon (except for the gold template). This function uses the client logic (which also checks icon override and icon from stats).
@param item Item
GetIdentifyRequirement¶
Gets the amount of Loremaster necessary to identify an item.
Ignores whether the item is already identified.
@param item Item
GetItemSlot¶
Alias for Item.Stats.ItemSlot
@param item Item
GetItemsInInventory¶
Returns a list of the items in the entity's inventory that match an optional predicate function.
Predicate is passed the EclItem/EsvItem and should return true for items to be included.
@param entity Entity
@param predicate fun(item: Item)
GetItemsInPartyInventory¶
Returns all items in the party inventory of char matching the predicate, or all if no predicate is passed.
@param char Character
@param predicate (fun(item:Item):boolean)?
@param recursive boolean?
Defaults to `false`.
GetLevel¶
Returns the level of an item.
@param item Item
GetNamedBoosts¶
Returns a list of the named boosts on the item.
@param item Item
GetOwner¶
Returns the current owner of the item.
This refers to the character that has legal ownership of the item; player characters will trigger crimes by attempting most interactions with owned items.
This character might be a player.
The owner will be nil
if the character who owned the item died, except for player-owned items.
@param item Item
GetPartyTemplateCount¶
Count the amount of template instances (prefix + guid) in the client party's inventory.
@param template string
GetRarityIcon¶
Returns the icon frame for a rarity, if any.
@param rarity ItemLib_Rarity|EclItem
GetRarityName¶
Returns the name of a rarity.
@param rarity Item|ItemLib_Rarity
GetRune¶
Gets the stats object of the rune inserted at rune index index
on item.
@param item Item
@param index integer
**0-based.**
GetRuneSlots¶
Returns the amount of rune slots an item has.
@param item Item
GetRuneSlotsIcon¶
Returns the icon displaying the state of item's rune slots.
@param item Item
GetRunes¶
Returns a list of runes on the item.
@param item Item
GetUseAPCost¶
Returns the base AP cost of using an item, independent of the character.
@param item Item
GetUseActions¶
Returns the use actions of an item, optionally filtered by type.
@param item Item|ItemTemplate
@param actionType ActionDataType
HasFlag¶
Returns whether the item has a flag.
@param item Item
@param flag EclItemFlags|EsvItemFlags|EclItemFlags2|EsvItemFlags2
HasRunes¶
Returns true if item has any runes slotted.
@param item Item
HasUseAction¶
Returns whether the item has a OnUsePeaceAction of the passed type.
@param item Item
@param useActionID ActionDataType
HasUseActions¶
Returns whether an item has any use actions.
@param item Item
IsArtifact¶
Returns true if the item is an Artifact by checking the AMER_UNI tag.
@param item Item
IsContainer¶
Returns whether an item is a container.
@param item Item
IsDagger¶
Returns whether item is a dagger (satisfying a DaggerWeapon requirement)
@param item Item
IsDyeable¶
Returns true for dyeable items (equipment, except rings/amulet/belt).
@param item Item
IsEquipment¶
Returns true if the item is an armor piece or a weapon.
@param item Item
IsEquipped¶
Returns true if item is equipped by char. Assumes the item cannot be equipped into an unintended slot. Rings and weapons are checked for both slots.
@param char Character
@param item Item
IsIdentified¶
Returns whether an item is identified.
@param item Item
IsLegal¶
Returns whether interacting with an item is legal.
@param item Item
IsMarkedAsWares¶
Returns whether an item is marked as wares.
@param item Item
IsMeleeWeapon¶
Returns whether item is a melee weapon (satisfying a MeleeWeapon requirement)
Returns true for None-type weaponry.
@param item Item
IsRangedWeapon¶
Returns whether item is a ranged weapon; bow or crossbow only!
@param item Item
IsRune¶
Returns whether the item is a rune.
@param item Item
IsShield¶
Returns whether item is a shield (satisfying a ShieldWeapon requirement)
@param item Item
IsSkillbook¶
Returns whether item is a skillbook.
@param item Item
IsUnique¶
Returns whether an item is of Unique rarity.
Returns true
for Artifact items.
@param item Item
IsWeapon¶
Returns true if the item is a weapon (shields don't count!)
@param item Item
SetIconOverride¶
Sets a custom icon for an item.
Not persistent!
@param item Item
@param icon string