# Data This page is about fetching OSRS data with WaspLib. WaspLib has several tools to get information about items, npcs, weapons, ... - - - ## TItemData Record responsible for providing item information in WaspLib. - - - ## EItemDataKey ```pascal EItemDataKey = enum(ID..PARAMS); ``` Enum representing item definition keys. - - - ## ItemData.GetDefinition ```pascal function TItemData.GetDefinition(itemID: String): TJSONItem; ``` This is mostly for internal use but you may use it for whatever you wish. This returns a `TJSONItem` of the item definition. Item definitions are items information stored in the game cache, things like: - Item ID - Item name - Item is tradeable - Item is stackable - Item is members - ... WaspLib includes a zip file with item definitions for all non "null" items as .json files in `WaspLib\osrs\data\items.zip`. Example: ```pascal id := ItemFinder.Database.Get('abyssal whip', 'item', 'id'); json := ItemData.GetDefinition(id); parser := json.ToParser(); WriteLn parser.ToString(); parser.Free(); ``` - - - ## ItemData.GetTradeableID ```pascal function TItemData.GetTradeableID(item: TRSItem): String; ``` Mostly for internal use but you may use it as you see fit. Some items in the game have versions of themselves that are not tradeable and can't be used to fetch item prices, such as degraded items, ornamented items, etc. This function checks every id associated with the specified `item` and checks the item definition of each one (check {ref}`ItemData.GetDefinition`) for the tradeable key. The first tradeable id found is returned. Example: ```pascal WriteLn ItemData.GetTradeableID('Rune scimitar'); //rune scimitar has 2 ids and one is not tradeable. ``` - - - ## ItemData.GetPrice ```pascal function TItemData.GetPrice(item: TRSItem): Integer; ``` Method used to return the average price of the specified `item`. Example: ```pascal WriteLn ItemData.GetPrice('Abyssal whip'); ``` - - - ## ItemData.GetLowAlch() ```pascal function TItemData.GetLowAlch(item: TRSItem): Integer; ``` Method used to get the the low alchemy value of an item. Example: ```pascal WriteLn ItemData.GetLowAlch('Magic longbow'); ``` - - - ## ItemData.GetHighAlch() ```pascal function TItemData.GetHighAlch(item: TRSItem): Integer; ``` Method used to get the the high alchemy value of an item. Example: ```pascal WriteLn ItemData.GetHighAlch('Magic longbow'); ``` - - - ## ItemData variable Global {ref}`TItemData` variable. - - - ## TGearData Type responsible for retrieving gear data. "Gear" refers to as any equippable item in the game. - - - ## GearData.Setup ```pascal procedure TGearData.Setup(); ``` Internal method to setup TGearData. - - - ## GearData.GetArray ```pascal function TGearData.GetArray(index: Integer): TJSONItem; function TGearData.GetArray(key: String): TJSONItem; overload; ``` Method to fetch json arrays from gear.json. ```{note} Using this requires knowledge of the structure of gear.json ``` - - - ## GearData.GetItems ```pascal function TGearData.GetItems(key: Integer): TRSItemArray; function TGearData.GetItems(key: String): TRSItemArray; overload; ``` Method to fetch items under a key in gear.json. - - - ## GearData variable Global {ref}`TGearData` variable.