Items module

Varise function used to interact with items

class ItemFunctions

Function that can be used on items .. note:: - Used like an enum

Batch_Accept

int

Opens in batch the maximum amount , with rewards

Batch_Empty

int

Opens in batch the maximum amount , without rewards

Batch_Empty_Preferred

int

Batch open max, without rewards , if amount is 1 , will do Open_Empty instead

Open_Accept

int

Open 1 with rewards

Open_Empty

int

Open 1 without rewards

Batch_Accept_Preferred

int

Batch open max, with rewards , if amount is 1 , will do Open_Empty instead

click_on_function(pos, index)

Clicks on function when the position of item is known

Note

  • Internal function
  • The item should be already clicked once
Parameters:
  • pos (tuple) – (x,y) the position of the item
  • index (int) – the index of the function in the context menu
locate(img_file)

locates item in inventory

Note

  • Internal function
Parameters:img_file (str) – full path to the image
Returns:Position of the item (x,y), None if not found
Return type:Tuple
run_function(item_img, function, index_of_function)

Runs function on item

Note

  • Inventory should be open
  • Internal function, use run_function_on_item instead
Parameters:
  • item_img (str) – file name of item’s image
  • function (ItemFunctions) – function to execute
  • index_of_function (int) – index of function in the item’s context menu
  • When using batch_empty_prefered , leave it at -1 (-) –
run_function_on_item(item_img, function, index_of_function, section=0)

Uses function on item

Parameters:
  • item_img (str) – file name of item’s image
  • function (ItemFunctions) – function to execute
  • index_of_function (int) – index of function in the item’s context menu
  • When using batch_empty_prefered , leave it at -1 (-) –
  • section (InventorySections, optional) – Section of inventory the item is at
run_function_on_multiple_items(items)

Runs function per item , for multiple items

Parameters:items (dict) – Item dict , that represent the item , and the function to execute on that item.

Note

  • The proper form is:
{
“item_img”: Path to image, (Use Util.image_path_main or Util.image_path_module), “function”: Items.ItemFunctions, Function to execute, “index_of_function”: index of function in the context menu, “section”: Inventory.InventorySections, Section of the inventory the item is in

}