Items

The Items class provides a wide range of functions to search and interact with Items.

Table of Contents

Methods

ApplyFilter

Syntax: Items.ApplyFilter(filter)

Filter the global list of Items according to the options specified by the filter ( see: Items.Filter ).

Parameters:
  • filter (Items.Filter): A filter object.
Returns: List[Item]

BackpackCount

Syntax: Items.BackpackCount(itemid, color)

Count items in Player Backpack.

Parameters:
  • itemid (Int32): ItemID to search.
  • color (Int32): Color to search. (default -1: any color)
Returns: Int32

ChangeDyeingTubColor

Syntax: Items.ChangeDyeingTubColor(dyes, dyeingTub, color)

Use the Dyes on a Dyeing Tub and select the color via color picker, using dedicated packets. Need to specify the dyes, the dye tube and the color to use.

Parameters:
  • dyes (Item): Dyes as Item object.
  • dyeingTub (Item): Dyeing Tub as Item object.
  • color (Int32): Color to choose.
Returns: Void

Close

Syntax: Items.Close(serial)

Close opened container window. On OSI, to close opened corpse window, you need to close the corpse's root container Currently corpse's root container can be found by using item filter.

Parameters:
  • serial (Int32): Serial or Item to hide.
Returns: Void

ContainerCount

Syntax: Items.ContainerCount(container, itemid, color, recursive)

Count items inside a container, summing also the amount in stacks.

Parameters:
  • container (Item): Serial or Item to search into.
  • itemid (Int32): ItemID of the item to search.
  • color (Int32): Color to match. (default: -1, any color)
  • recursive (Boolean): Search also in already open subcontainers.
Returns: Int32

ContextExist

Syntax: Items.ContextExist(serial, name)

Check if Context Menu entry exists for an Item.

Parameters:
  • serial (Int32): Serial or Item to check.
  • name (String): Name of the Context Manu entry
Returns: Int32

DropFromHand

Syntax: Items.DropFromHand(item, container)

Drop into a bag an Item currently held in-hand. ( see: Items.Lift )

Parameters:
  • item (Item): Item object to drop.
  • container (Item): Target container.
Returns: Void

DropItemGroundSelf

Syntax: Items.DropItemGroundSelf(item, amount, direction)

Drop an Item on the ground, at the current Player position. NOTE: On some server is not allowed to drop Items on tiles occupied by Mobiles and the Player. This function seldom works because the servers don't allow drop where you're standing

Parameters:
  • item (Item): Item object to drop.
  • amount (Int32): Amount to move. (default: 0, the whole stack)
  • direction (Int32)
Returns: Void

FindAllByID

Syntax: Items.FindAllByID(itemids, color, container, range, considerIgnoreList)

Find a List of Items matching specific list of ItemID, Color and Container. Optionally can search in all subcontainers or to a maximum depth in subcontainers. Can use -1 on color for no chose color, can use -1 on container for search in all item in memory. The depth defaults to only the top but can search for # of sub containers.

Parameters:
  • itemids (PythonList)
  • color (Int32): Color filter. (-1: any, 0: natural )
  • container (Int32): Serial of the container to search. (-1: any Item)
  • range (Int32)
  • considerIgnoreList (Boolean): True: Ignore Items are excluded - False: any Item.
Returns: PythonList, List[Item]

FindByID

Syntax: Items.FindByID(itemid, color, container, recursive, considerIgnoreList)

Find a single Item matching specific ItemID, Color and Container. Optionally can search in all subcontainers or to a maximum depth in subcontainers. Can use -1 on color for no chose color, can use -1 on container for search in all item in memory. The depth defaults to only the top but can search for # of sub containers.

Parameters:
  • itemid (Int32): ItemID filter.
  • color (Int32): Color filter. (-1: any, 0: natural )
  • container (Int32): Serial of the container to search. (-1: any Item)
  • recursive (Boolean): Search subcontainers. True: all subcontainers False: only main 1,2,n: Maximum subcontainer depth
  • considerIgnoreList (Boolean): True: Ignore Items are excluded - False: any Item.
Returns: Item

FindByName

Syntax: Items.FindByName(itemName, color, container, range, considerIgnoreList)

Find a single Item matching specific Name, Color and Container. Optionally can search in all subcontainers or to a maximum depth in subcontainers. Can use -1 on color for no chose color, can use -1 on container for search in all item in memory. The depth defaults to only the top but can search for # of sub containers.

Parameters:
  • itemName (String): Item Name filter.
  • color (Int32): Color filter. (-1: any, 0: natural )
  • container (Int32): Serial of the container to search. (-1: any Item)
  • range (Int32): Search subcontainers. 1,2,n: Maximum subcontainer depth
  • considerIgnoreList (Boolean): True: Ignore Items are excluded - False: any Item.
Returns: Item

FindBySerial

Syntax: Items.FindBySerial(serial)

Search for a specific Item by using it Serial

Parameters:
  • serial (Int32): Serial of the Item.
Returns: Item

GetImage

Syntax: Items.GetImage(itemID, hue)

Get the Image on an Item by specifing the ItemID. Optinally is possible to apply a color.

Parameters:
  • itemID (Int32): ItemID to use.
  • hue (Int32): Optional: Color to apply. (Default 0, natural)
Returns: Bitmap

GetPropStringByIndex

Syntax: Items.GetPropStringByIndex(serial, index)

Get a Property line, by index. if not found returns and empty string.

Parameters:
  • serial (Int32): Serial or Item to read.
  • index (Int32): Number of the Property line.
Returns: String

GetPropStringList

Syntax: Items.GetPropStringList(serial)

Get string list of all Properties of an item, if item no props list is empty.

Parameters:
  • serial (Int32): Serial or Item to read.
Returns: List[String]

GetPropValue

Syntax: Items.GetPropValue(serial, name)

Read the value of a Property.

Parameters:
  • serial (Int32): Serial or Item to read.
  • name (String): Name of the Propery.
Returns: Single

GetPropValueString

Syntax: Items.GetPropValueString(serial, name)

Get a Property line, by name. if not found returns and empty string.

Parameters:
  • serial (Int32): Serial or Item to read.
  • name (String): Number of the Property line.
Returns: String

GetProperties

Syntax: Items.GetProperties(itemserial, delay)

Request to get immediately the Properties of an Item, and wait for a specified amount of time. This only returns properties and does not attempt to update the object. Used in this way, properties for object not yet seen can be retrieved

Parameters:
  • itemserial (Int32): Serial or Item read.
  • delay (Int32): Maximum waiting time, in milliseconds.
Returns: List[Property]

GetWeaponAbility

Syntax: Items.GetWeaponAbility(itemId)

NOTE: This is from an internal razor table and can be changed based on your server! Returns a pair of string values (Primary Ability, Secondary Ability) for the supplied item ID. "Invalid", "Invalid" for items not in the internal table

Parameters:
  • itemId (Int32)
Returns: ValueTuple[String, String]

Hide

Syntax: Items.Hide(serial)

Hied an Item, affects only the player.

Parameters:
  • serial (Int32): Serial or Item to hide.
Returns: Void

IgnoreTypes

Syntax: Items.IgnoreTypes(itemIdList)

Used to ignore specific types. Be careful as you won't see things you ignore, and could result in a mobile being able to kill you without you seeing it

Parameters:
  • itemIdList (PythonList)
Returns: Void

Lift

Syntax: Items.Lift(item, amount)

Lift an Item and hold it in-hand. ( see: Items.DropFromHand )

Parameters:
  • item (Item): Item object to Lift.
  • amount (Int32): Amount to lift. (-1: the whole stack, >0: specific amount)
Returns: Void

Message

Syntax: Items.Message(item, hue, message)

Display an in-game message on top of an Item, visibile only for the Player.

Parameters:
  • item (Item): Serial or Item to display text on.
  • hue (Int32): Color of the message.
  • message (String): Message as
Returns: Void

Move

Syntax: Items.Move(source, destination, amount, x, y)

Move an Item to a destination, which can be an Item or a Mobile.

Parameters:
  • source (Int32): Serial or Item of the Item to move.
  • destination (Int32): Serial, Mobile or Item as destination.
  • amount (Int32): Amount to move (-1: the whole stack)
  • x (Int32): Optional: X coordinate inside the container.
  • y (Int32): Optional: Y coordinate inside the container.
Returns: Void, Boolean

MoveAndWait

Syntax: Items.MoveAndWait(source, destination, amount, timeoutMs)

Move an item and wait for the server to confirm the move via ContainerContentUpdate (0x25). This is useful when moving multiple items in sequence to avoid "you must wait" errors. Watches for "wait" messages in journal to detect rate limiting and retries automatically.

Parameters:
  • source (Int32): Serial of the item to move.
  • destination (Int32): Serial of the destination container.
  • amount (Int32): Amount of items to move (0: the whole stack).
  • timeoutMs (Int32): Maximum time to wait for confirmation in milliseconds.
Returns: Boolean

MoveOnGround

Syntax: Items.MoveOnGround(source, amount, x, y, z)

Move an Item on the ground to a specific location.

Parameters:
  • source (Int32): Serial or Item to move.
  • amount (Int32): Amount of Items to move (0: the whole stack )
  • x (Int32): X world coordinates.
  • y (Int32): Y world coordinates.
  • z (Int32): Z world coordinates.
Returns: Boolean

OpenAt

Syntax: Items.OpenAt(serial, x, y)
Parameters:
  • serial (Int32)
  • x (Int32)
  • y (Int32)
Returns: Void

OpenContainerAt

Syntax: Items.OpenContainerAt(bag, x, y)

Open a container at a specific location on the screen

Parameters:
  • bag (Item): Container as Item object.
  • x (Int32): x location to open at
  • y (Int32): y location to open at
Returns: Void

Select

Syntax: Items.Select(items, selector)
Parameters:
  • items (List[Item])
  • selector (String)
Returns: Item

SetColor

Syntax: Items.SetColor(serial, color)

Change/override the Color of an Item, the change affects only Player client. The change is not persistent. If the color is -1 or unspecified, the color of the item is restored.

Parameters:
  • serial (Int32): Serial of the Item.
  • color (Int32): Color as number. (default: -1, reset original color)
Returns: Void

SingleClick

Syntax: Items.SingleClick(item)

Send a single click network event to the server.

Parameters:
  • item (Item): Serial or Item to click
Returns: Void

UseItem

Syntax: Items.UseItem(itemSerial, targetSerial, wait)

Use an Item, optionally is possible to specify a Item or Mobile target. NOTE: The optional target may not work on some free shards. Use Target.Execute instead.

Parameters:
  • itemSerial (Int32): Serial or Item to use.
  • targetSerial (Int32): Optional: Serial of the Item or Mobile target.
  • wait (Boolean): Optional: Wait for confirmation by the server. (default: True)
Returns: Void

UseItemByID

Syntax: Items.UseItemByID(itemid, color)

Use any item of a specific type, matching Item.ItemID. Optionally also of a specific color, matching Item.Hue.

Parameters:
  • itemid (Int32): ItemID to be used.
  • color (Int32): Color to be used. (default: -1, any)
Returns: Boolean

WaitForContents

Syntax: Items.WaitForContents(bag, delay)

Open a container an wait for the Items to load, for a maximum amount of time.

Parameters:
  • bag (Item): Container as Item object.
  • delay (Int32): Maximum wait, in milliseconds.
Returns: Boolean

WaitForProps

Syntax: Items.WaitForProps(itemserial, delay)

If not updated, request to the Properties of an Item, and wait for a maximum amount of time.

Parameters:
  • itemserial (Int32): Serial or Item read.
  • delay (Int32): Maximum waiting time, in milliseconds.
Returns: Void