import { ItemHelper } from "https://deno.land/x/sptaki@1.2.0/helpers/ItemHelper.d.ts";
Constructors
Properties
Methods
Chose a randomly weighted cartridge that fits
Choose a random bullet type from the list of possible a magazine has
Get a quality value based on a repairable items (weapon/armor) current state between current and max durability
Add cartridges to the ammo box with correct max stack sizes
Add child slot items to an item, chooses random child item if multiple choices exist
Add a single stack of cartridges to the ammo box
Add a blank upd object to passed in item if it does not exist already
Adopts orphaned items by resetting them as root "hideout" items. Helpful in situations where a parent has been deleted from a group of items and there are children still referencing the missing parent. This method will remove the reference from the children to the parent and set item properties to root values.
Does the provided item have the chance to require soft armor inserts Only applies to helmets/vest/armors. Not all head gear needs them
Does the provided item tpl need soft/removable inserts to function
Does the pased in tpl have ability to hold removable plate items
Create a basic cartrige object
WARNING, SLOW. Recursively loop down through an items hierarchy to see if any of the ids match the supplied list, return true if any do
Add child items to a magazine of a specific cartridge
Add child items (cartridges) to a magazine
A variant of findAndReturnChildren where the output is list of item objects instead of their ids.
Find children of the item in a given assort (weapons parts for example, need recursive loop function)
Recursive function that looks at every item from parameter and gets their childrens Ids + includes parent item in results
Find Barter items from array of items
Update items upd.StackObjectsCount to be 1 if its upd is missing or StackObjectsCount is undefined
Populate a Map object of items for quick lookup using their ID.
Helper method to generate a Upd based on a template
Retrieves the main parent item for a given attachment item.
This method traverses up the hierarchy of items starting from a given itemId
, until it finds the main parent
item that is not an attached attachment itself. In other words, if you pass it an item id of a suppressor, it
will traverse up the muzzle brake, barrel, upper receiver, and return the gun that the suppressor is ultimately
attached to, even if that gun is located within multiple containers.
It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates some of the performance concerns, as it allows for quick lookups of items by ID.
Gets the identifier for a child using slotId, locationX and locationY.
Get a compatible tpl from the array provided where it is not found in the provided incompatible mod tpls parameter
Get the dynamic (flea) price in roubles for an item by tpl
Retrieves the equipment parent item for a given item.
This method traverses up the hierarchy of items starting from a given itemId
, until it finds the equipment
parent item. In other words, if you pass it an item id of a suppressor, it will traverse up the muzzle brake,
barrel, upper receiver, gun, nested backpack, and finally return the backpack Item that is equipped.
It's important to note that traversal is expensive, so this method requires that you pass it a Map of the items to traverse, where the keys are the item IDs and the values are the corresponding Item objects. This alleviates some of the performance concerns, as it allows for quick lookups of items by ID.
Gets item data from items.json
Returns the items total price based on the handbook or as a fallback from the prices.json if the item is not found in the handbook. If the price can't be found at all return 0
Returns the item price based on the handbook or as a fallback from the prices.json if the item is not found in the handbook. If the price can't be found at all return 0
Get the name of an item from the locale file using the item tpl
Returns the item price based on the handbook or as a fallback from the prices.json if the item is not found in the handbook. If the price can't be found at all return 0
get normalized value (0-1) based on item condition
Calcualte the average quality of an item and its children
Get cloned copy of all item data from items.json
Get the inventory size of an item
Get the size of a stack, return 1 if no stack object count property found
Get a random cartridge from an items Filter property
Get a list of slot names that hold removable plates
Get all soft insert slot ids
Get the static (handbook) price in roubles for an item by tpl
Check if the passed in item has buy count restrictions
Determines if an item is an attachment that is currently attached to it's parent item.
is the passed in template id a dog tag
Can the passed in item be stacked
Check if the tpl / template Id provided is a descendent of the baseclass
Check if item has any of the supplied base classes
Check if item is quest item
Checks to see if the item is actually moddable in-raid. Checks include the items existence in the database, the parent items existence in the database, the existence (and value) of the items RaidModdable property, and that the parents slot-required property exists, matches that of the item, and it's value.
Note: this function does not preform any checks to see if the item and parent are actually related.
Is the provided item._props.Slots._name property a plate slot
This method will compare two items and see if the are equivalent. This method will NOT compare IDs on the items
This method will compare two items (with all its children) and see if the are equivalent. This method will NOT compare IDs on the items
Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash
Check if item is stored inside of a container
Does the provided item tpl require soft inserts to become a valid armor item
Update a root items _id property value to be unique
Generate new unique ids for child items while preserving hierarchy
Regenerate all GUIDs with new IDs, for the exception of special item types (e.g. quest, sorting table, etc.) This function will not mutate the original items array, but will return a new array with new GUIDs.
Mark the passed in array of items as found in raid. Modifies passed in items
Split item stack if it exceeds its items StackMaxSize property into child items of passed in parent
Turn items like money into separate stacks that adhere to max stack size