# ConsumeHandler Manages consumable items like food and potions. It handles loading, inventory scanning, and consumption logic with cooldowns and effects. - - - ## type ERSConsumable ```pascal type ERSConsumable = ( FOOD, PRAYER, ENERGY, POISON, ANTI_FIRE, STRENGTH_BOOST, ATTACK_BOOST, DEFENCE_BOOST, RANGING_BOOST, MAGIC_BOOST ); ``` Defines the categories of consumables available. - - - ## type TRSConsumableItem ```pascal TRSConsumableItem = record Name: String; Category: ERSConsumable; CooldownMs: Int64; DurationMs: Int64; IsComboFood: Boolean; Points: Int64; end; ``` Represents a single consumable item with its properties. - - - ## type TRSConsumables ```pascal TRSConsumables = record Name: String; Consumables: TRSConsumableItemArray; IsSetup: Boolean; MinInvPoints: Int64; ActiveConsumables: TRSConsumableItemArray; Timers: array of TCountDown; CooldownTimers: array [ERSConsumable] of TCountDown; end; ``` Manages all aspects of item consumption. - - - ## TRSConsumables.Setup ```pascal procedure TRSConsumables.Setup(); ``` Initializes the consume handler by loading data from `consumables.json`. Must be called before other operations. - - - ## TRSConsumables.Find ```pascal function TRSConsumables.Find(consumableType: ERSConsumable): TRSConsumableItemArray; ``` Scans inventory for all consumables of a specific category. - - - ## TRSConsumables.FindAll ```pascal function TRSConsumables.FindAll(): TRSConsumableItemArray; ``` Scans inventory for all available consumables of any category. - - - ## TRSConsumables.Count ```pascal function TRSConsumables.Count(consumableType: ERSConsumable): Int32; ``` Counts the number of items of a specific consumable category in inventory. - - - ## TRSConsumables.Has ```pascal function TRSConsumables.Has(consumableType: ERSConsumable): Boolean; ``` Checks if the inventory has at least one item of a specific category. - - - ## TRSConsumables.GetBest ```pascal function TRSConsumables.GetBest(consumableType: ERSConsumable): TRSConsumableItem; ``` Finds the best consumable of a category from inventory based on `Points`. - - - ## TRSConsumables.CanConsume ```pascal function TRSConsumables.CanConsume(consumableType: ERSConsumable): Boolean; ``` Checks if a consumable can be used, considering active effects. - - - ## TRSConsumables.HasEnoughPoints ```pascal function TRSConsumables.HasEnoughPoints(consumableType: ERSConsumable): Boolean; ``` Checks if total points of a consumable type meet the `MinInvPoints` threshold. - - - ## TRSConsumables.Consume ```pascal function TRSConsumables.Consume(consumableType: ERSConsumable; fastMouse: TMouse = Mouse; useFast: Boolean = False): Boolean; ``` Consumes the best item of a specified category from inventory.