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

EItemDataKey = enum(ID..PARAMS);

Enum representing item definition keys.


ItemData.GetDefinition

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:

id := ItemFinder.Database.Get('abyssal whip', 'item', 'id');
json := ItemData.GetDefinition(id);
parser := json.ToParser();
WriteLn parser.ToString();
parser.Free();

ItemData.GetTradeableID

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 ItemData.GetDefinition) for the tradeable key.

The first tradeable id found is returned.

Example:

WriteLn ItemData.GetTradeableID('Rune scimitar'); //rune scimitar has 2 ids and one is not tradeable.

ItemData.GetPrice

function TItemData.GetPrice(item: TRSItem): Integer;

Method used to return the average price of the specified item.

Example:

WriteLn ItemData.GetPrice('Abyssal whip');

ItemData.GetLowAlch()

function TItemData.GetLowAlch(item: TRSItem): Integer;

Method used to get the the low alchemy value of an item.

Example:

WriteLn ItemData.GetLowAlch('Magic longbow');

ItemData.GetHighAlch()

function TItemData.GetHighAlch(item: TRSItem): Integer;

Method used to get the the high alchemy value of an item.

Example:

WriteLn ItemData.GetHighAlch('Magic longbow');

ItemData variable

Global TItemData variable.


TGearData

Type responsible for retrieving gear data. “Gear” refers to as any equippable item in the game.


GearData.Setup

procedure TGearData.Setup();

Internal method to setup TGearData.


GearData.GetArray

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

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 TGearData variable.