Item¶
Page dedicated to game items and misc functions related to them.
Quantity Constants¶
QUANTITY_ALL = 0;
QUANTITY_ALL_BUT_ONE = -1;
In WaspLib you have this 2 constants to use in interfaces that allows you to specify “all” quantities of items, e.g. the Bank interface.
ITEM_SHADOW¶
ITEM_SHADOW: TColor = $202030;
TColor of an item gray shadow. This shadow value will change between clients
(check EClient) and depending on the client certain interfaces being
open will also change it to ITEM_SHADOW_GRAY, e.g. the Bank
with Legacy or RuneLite.
Example:
WriteLn ITEM_SHADOW; //$202030
ITEM_SHADOW_GRAY¶
ITEM_SHADOW_GRAY: TColor = $333333;
TColor of an item gray shadow. This shadow value will change between clients
(check EClient) and depending on the client certain interfaces being
open will also change it, e.g. the Bank with Legacy or RuneLite.
Example:
WriteLn ITEM_SHADOW; //$333333
ITEM_BORDER¶
ITEM_BORDER: TColor = $010000;
TColor of an item border. This value will change between clients
(check EClient).
Example:
WriteLn ITEM_BORDER; //$010000
ITEM_BORDER_WHITE¶
ITEM_BORDER_WHITE: TColor = $FFFFFF;
TColor of a selected item border. This value will change between clients
(check EClient).
Example:
WriteLn ITEM_BORDER_WHITE; //$FFFFFF
EItemQuantity¶
EItemQuantity = enum(ONE, FIVE, TEN, CUSTOM, ALL);
General purpose item quantity enum.
EItemQuantity.Integer2Quantity¶
function EItemQuantity.Integer2Quantity(quantity: Integer): EItemQuantity; static;
Internal helper function to convert a integer quantity into a EItemQuantity.
Example:
WriteLn EItemQuantity.Integer2Quantity(5);
WriteLn EItemQuantity.Integer2Quantity(7);
EItemQuantity.String2Quantity¶
function EItemQuantity.String2Quantity(str: String): EItemQuantity; static;
Internal helper function to convert a string quantity into a EItemQuantity.
Example:
WriteLn EItemQuantity.String2Quantity('5');
WriteLn EItemQuantity.String2Quantity('7');
WriteLn EItemQuantity.String2Quantity('All');
EStack¶
EStack = enum(YELLOW, WHITE, GREEN);
Enum representing the types of item stacks available.
EStack.Color¶
property EStack.Color: TColor;
Returns a TColor of a EStack.
EStack.YELLOWshould be stacks between0and99.999.EStack.WHITEshould be stacks between100.000and9.999.999and are shown with aKrepresenting the 3 least significant digits, e.g.9.999.999would be seen as9999K.EStack.GREENshould be stacks between100.000and9.999.999and are shown with anMrepresenting the 6 least significant digits, e.g.999.999.999would be seen as999M.
Example:
WriteLn EStack.YELLOW.Color; //$00FFFF
WriteLn EStack.WHITE.Color; //$FFFFFF
WriteLn EStack.GREEN.Color; //$80FF00
EStack.Multiplier¶
property EStack.Multiplier: Integer;
Returns the “multiplier” of a EStack which are:
EStack.YELLOW: 0EStack.WHITE: 1000EStack.GREEN: 1000000
Example:
WriteLn EStack.YELLOW.Multiplier;
TItem¶
The main type that represents, well, a game item.
TItem is a type of String and therefore inherits all String methods.
TItemArray¶
Array type of TItem.
TItem.InBounds¶
function TItem.InBounds(bounds: TBox; fadeTolerance: Single = 8.5): Boolean; static;
Checks if the specified bounds has an item in it.
Example:
WriteLn TItem.InBounds(Inventory.Slots.Box(0));
TItem.HasAmount¶
function TItem.HasAmount(): Boolean;
Checks if the TItem has “doses” or “charges”.
Example:
item := 'Amulet of glory(6)';
WriteLn item.HasAmount(); //true
TItem.Spread¶
function TItem.Spread(): TItemArray;
Checks if the TItem has (a..b) in it’s name and will spread it into a
TItemArray.
Example:
item := 'prayer potion(1..4)';
WriteLn item.Spread(); ['prayer potion(1)', 'prayer potion(2)', 'prayer potion(3)'. 'prayer potion(4)']
item := 'prayer potion(2..1)';
WriteLn item.Spread(); ['prayer potion(2)', 'prayer potion(1)']
TItem.SimplifyName¶
function TItem.SimplifyName(): String;
Internal helper function to get a human like short item name, usually to search.
Example:
item := 'Amulet of glory(6)';
WriteLn item.SimplifyName();
Item.StackBox¶
property TItem.StackBox(slot: TBox): TBox; static;
Returns the correct text box of an item’s amount text based on the item box.
TItem.ReadStack¶
function TItem.ReadStack(slot: TBox): Integer; static;
For use with items in interfaces like bankscreen, inventory, shops and so on to get the number of stacked items.
TBankItem¶
Helper type to handle bank items better. This holds information about the item name, quantity and whether it’s noted or not.
TBankItemArray¶
Array type of TBankItem.
TBankItem.Construct¶
function TBankItem.Construct(item: TItem; quantity: Integer = QUANTITY_ALL_BUT_ONE): TBankItem; static;
Creates a TBankItem.
Example:
var
bankitem: TBankItem;
begin
bankitem := new TBankItem('abyssal whip', 1);
end.
TItem.ToBankItem¶
function TItem.ToBankItem(quantity: Integer = QUANTITY_ALL_BUT_ONE): TBankItem;
Returns a TBankItem based on the TItem in question with the specified
quantity.
Example:
item := 'Amulet of glory(6)';
WriteLn item.ToBankItem();
TBankItem.ToItem¶
function TBankItem.ToItem(): TItem;
The opposite of TItem.ToBankItem