Data

This page is about fetching game data with WaspLib. WaspLib has several tools to get information about items, npcs, weapons, …


TItemData

Record responsible for providing item information in WaspLib.


TItemPriceData

Record responsible for holding item price data.


ItemData.GetDefinition

function TItemData.GetDefinition(id: Integer): TItemDefinition;

This is mostly for internal use but you may use it for whatever you wish.

This returns the TItemDefinition of an item, read straight from the game cache.

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

  • …

Example:

id := ItemFinder.Database.Get('abyssal whip', 'item', 'id');
def := ItemData.GetDefinition(StrToInt(id));
WriteLn def.Name, ' costs ', def.Cost;

ItemData.GetTradeableID

function TItemData.GetTradeableID(item: TItem): 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.GetPriceData

function TItemData.GetPriceData(item: TItem): TItemPriceData;

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

Example:

var
  priceData: TItemPriceData;
begin
  priceData := ItemData.GetPriceData('Abyssal whip');
  WriteLn('High: ' + ToStr(priceData.high) + ' Low: ' + ToStr(priceData.low));
end;

ItemData.GetPrice

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

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

Example:

WriteLn ItemData.GetPrice('Abyssal whip');

ItemData.GetLowAlch()

function TItemData.GetLowAlch(item: TItem): 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: TItem): 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, loading gear.json out of the item database TItemLoader.WriteDatabase builds from the game cache.


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): TItemArray;
function TGearData.GetItems(key: String): TItemArray; overload;

Method to fetch items under a key in gear.json.


GearData variable

Global TGearData variable.