@@ -342,19 +342,19 @@ def get_inv_item_stack_amount(self, item_id: Union[int, List[int]]) -> int:
342342 return int (result ["quantity" ])
343343 return 0
344344
345- def get_is_item_equipped (self , item_id : int ) -> bool :
345+ def get_is_item_equipped (self , item_id : Union [ int , List [ int ]] ) -> bool :
346346 """
347- Checks if the player has given item equipped, and its quantity .
347+ Checks if the player has given item(s) equipped. Given a list of IDs, returns True on first ID found .
348348 Args:
349- item_id: The ID of the item to check for.
349+ item_id: the id of the item to check for (a single ID, or list of IDs) .
350350 Returns:
351- True if the item is equipped, False if not.
351+ True if an item is equipped, False if not.
352352 """
353353 data = self .__do_get (endpoint = self .equip_endpoint )
354- return next (
355- ( True for equip_slot in data if equip_slot [ "id" ] == item_id ),
356- False ,
357- )
354+ equipped_ids = [ item [ "id" ] for item in data ]
355+ if isinstance ( item_id , int ):
356+ return item_id in equipped_ids
357+ return any ( item in item_id for item in equipped_ids )
358358
359359 def get_equipped_item_quantity (self , item_id : int ) -> int :
360360 """
@@ -384,9 +384,6 @@ def convert_player_position_to_pixels(self):
384384
385385 api = MorgHTTPSocket ()
386386
387- id_logs = 1511
388- id_bones = 526
389-
390387 # Note: Making API calls in succession too quickly can result in issues
391388 while True :
392389 # Player Data
@@ -431,6 +428,7 @@ def convert_player_position_to_pixels(self):
431428 # Equipment Data
432429 if False :
433430 print (f"Is bronze axe equipped?: { api .get_is_item_equipped (ids .BRONZE_AXE )} " )
431+ print (f"Are there any ring of duelings equipped? { api .get_is_item_equipped (ids .rods )} " )
434432 print (f"How many bronze arrows equipped?: { api .get_equipped_item_quantity (ids .BRONZE_ARROW )} " )
435433
436434 # Chatbox Data
0 commit comments