# Item Page dedicated to runescape items and misc functions related to them. - - - ## Quantity Constants ```pascal 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 {ref}`bank` interface. - - - ## ITEM_SHADOW ```pascal ITEM_SHADOW: TColor = $202030; ``` `TColor` of an item gray shadow. This shadow value will change between clients (check {ref}`ERSClient`) and depending on the client certain interfaces being open will also change it to {ref}`ITEM_SHADOW_GRAY`, e.g. the {ref}`Bank` with Legacy or RuneLite. Example: ```pascal WriteLn ITEM_SHADOW; //$202030 ``` - - - ## ITEM_SHADOW_GRAY ```pascal ITEM_SHADOW_GRAY: TColor = $333333; ``` `TColor` of an item gray shadow. This shadow value will change between clients (check {ref}`ERSClient`) and depending on the client certain interfaces being open will also change it, e.g. the {ref}`Bank` with Legacy or RuneLite. Example: ```pascal WriteLn ITEM_SHADOW; //$333333 ``` - - - ## ITEM_BORDER ```pascal ITEM_BORDER: TColor = $010000; ``` `TColor` of an item border. This value will change between clients (check {ref}`ERSClient`). Example: ```pascal WriteLn ITEM_BORDER; //$010000 ``` - - - ## ITEM_BORDER_WHITE ```pascal ITEM_BORDER_WHITE: TColor = $FFFFFF; ``` `TColor` of a selected item border. This value will change between clients (check {ref}`ERSClient`). Example: ```pascal WriteLn ITEM_BORDER_WHITE; //$FFFFFF ``` - - - ## ERSItemQuantity ```pascal ERSItemQuantity = enum(ONE, FIVE, TEN, CUSTOM, ALL); ``` General purpose item quantity enum. - - - ### ERSItemQuantity.Integer2Quantity ```pascal function ERSItemQuantity.Integer2Quantity(quantity: Integer): ERSItemQuantity; static; ``` Internal helper function to convert a integer quantity into a ERSItemQuantity. Example: ```pascal WriteLn ERSItemQuantity.Integer2Quantity(5); WriteLn ERSItemQuantity.Integer2Quantity(7); ``` - - - ### ERSItemQuantity.String2Quantity ```pascal function ERSItemQuantity.String2Quantity(str: String): ERSItemQuantity; static; ``` Internal helper function to convert a string quantity into a ERSItemQuantity. Example: ```pascal WriteLn ERSItemQuantity.String2Quantity('5'); WriteLn ERSItemQuantity.String2Quantity('7'); WriteLn ERSItemQuantity.String2Quantity('All'); ``` - - - ## ERSStack ```pascal ERSStack = enum(YELLOW, WHITE, GREEN); ``` Enum representing the types of item stacks available. - - - ## ERSStack.Color ```pascal property ERSStack.Color: TColor; ``` Returns a `TColor` of a {ref}`ERSStack`. - `ERSStack.YELLOW` should be stacks between `0` and `99.999`. - `ERSStack.WHITE` should be stacks between `100.000` and `9.999.999` and are shown with a `K` representing the 3 least significant digits, e.g. `9.999.999` would be seen as `9999K`. - `ERSStack.GREEN` should be stacks between `100.000` and `9.999.999` and are shown with an `M` representing the 6 least significant digits, e.g. `999.999.999` would be seen as `999M`. Example: ```pascal WriteLn ERSStack.YELLOW.Color; //$00FFFF WriteLn ERSStack.WHITE.Color; //$FFFFFF WriteLn ERSStack.GREEN.Color; //$80FF00 ``` - - - ## ERSStack.Multiplier ```pascal property ERSStack.Multiplier: Integer; ``` Returns the "multiplier" of a `ERSStack` which are: - `ERSStack.YELLOW`: 0 - `ERSStack.WHITE`: 1000 - `ERSStack.GREEN`: 1000000 Example: ```pascal WriteLn ERSStack.YELLOW.Multiplier; ``` - - - ## TRSItem The main type that represents, well, a runescape item. `TRSItem` is a type of `String` and therefore inherits all `String` methods. - - - ## TRSItemArray Array type of `TRSItem`. - - - ## TRSItem.InBounds ```pascal function TRSItem.InBounds(bounds: TBox; fadeTolerance: Single = 8.5): Boolean; static; ``` Checks if the specified `bounds` has an item in it. Example: ```pascal WriteLn TRSItem.InBounds(Inventory.Slots.Box(0)); ``` - - - ## TRSItem.HasAmount ```pascal function TRSItem.HasAmount(): Boolean; ``` Checks if the `TRSItem` has "doses" or "charges". Example: ```pascal item := 'Amulet of glory(6)'; WriteLn item.HasAmount(); //true ``` - - - ## TRSItem.Spread ```pascal function TRSItem.Spread(): TRSItemArray; ``` Checks if the `TRSItem` has `(a..b)` in it's name and will spread it into a `TRSItemArray`. Example: ```pascal 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)'] ``` - - - ## TRSItem.SimplifyName ```pascal function TRSItem.SimplifyName(): String; ``` Internal helper function to get a human like short item name, usually to search. Example: ```pascal item := 'Amulet of glory(6)'; WriteLn item.SimplifyName(); ``` - - - ## Item.StackBox ```pascal property TRSItem.StackBox(slot: TBox): TBox; static; ``` Returns the correct text box of an item's amount text based on the item box. - - - ## TRSItem.ReadStack ```pascal function TRSItem.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. - - - ## TRSBankItem Helper type to handle bank items better. This holds information about the item name, quantity and whether it's noted or not. - - - ## TRSBankItemArray Array type of `TRSBankItem`. - - - ## TRSBankItem.Construct ```pascal function TRSBankItem.Construct(item: TRSItem; quantity: Integer = QUANTITY_ALL_BUT_ONE): TRSBankItem; static; ``` Creates a TRSBankItem. Example: ```pascal var bankitem: TRSBankItem; begin bankitem := new TRSBankItem('abyssal whip', 1); end. ``` - - - ## TRSItem.ToBankItem ```pascal function TRSItem.ToBankItem(quantity: Integer = QUANTITY_ALL_BUT_ONE): TRSBankItem; ``` Returns a `TRSBankItem` based on the `TRSItem` in question with the specified `quantity`. Example: ```pascal item := 'Amulet of glory(6)'; WriteLn item.ToBankItem(); ``` - - - ## TRSBankItem.ToItem ```pascal function TRSBankItem.ToItem(): TRSItem; ``` The opposite of {ref}`TRSItem.ToBankItem`