Interface IChargeManager


public interface IChargeManager
Interface for managing charges and unlock states of teleport items.

IChargeManager tracks the number of remaining charges on items like the Ring of Dueling, Games Necklace, Chronicle, etc. It also tracks unlock states for items that require unlocking destinations (like the Digsite Pendant's Fossil Island and Lithkren destinations).

Charge Tracking

Many teleport items have limited charges that decrease with each use. The charge manager monitors chat messages and animations to track current charges without requiring inventory lookups.

Unlock Tracking

Some teleport destinations must be manually unlocked before use. The unlock manager tracks these states persistently.

Usage Example


 IChargeManager chargeManager = Static.getChargeManager();

 // Check if a teleport item has charges
 if (chargeManager.hasCharges(ChargeRequirements.CHRONICLE)) {
     // Use the chronicle teleport
 }

 // Check if a destination is unlocked
 if (chargeManager.isUnlocked(UnlockRequirements.DIGSITE_PENDANT_FOSSIL_ISLAND)) {
     // Can teleport to Fossil Island
 }
 
See Also:
  • Method Details

    • getCharges

      int getCharges(ChargeRequirement requirement)
      Gets the current number of charges for the specified requirement.
      Parameters:
      requirement - the charge requirement to check
      Returns:
      the current number of charges, or -1 if unknown
    • hasCharges

      boolean hasCharges(ChargeRequirement requirement)
      Checks if the specified requirement has at least one charge remaining.
      Parameters:
      requirement - the charge requirement to check
      Returns:
      true if at least one charge is available
    • setCharges

      void setCharges(ChargeRequirement requirement, int charges)
      Sets the current number of charges for the specified requirement.
      Parameters:
      requirement - the charge requirement to update
      charges - the new charge count
    • isUnlocked

      boolean isUnlocked(UnlockRequirement requirement)
      Checks if the specified destination/feature is unlocked.
      Parameters:
      requirement - the unlock requirement to check
      Returns:
      true if the destination is unlocked
    • setUnlocked

      void setUnlocked(UnlockRequirement requirement, boolean unlocked)
      Sets the unlock state for the specified requirement.
      Parameters:
      requirement - the unlock requirement to update
      unlocked - true if unlocked, false if locked
    • registerChargeRequirement

      void registerChargeRequirement(ChargeRequirement requirement)
      Registers a charge requirement to be tracked by the manager. The manager will monitor chat messages and other triggers to update charges.
      Parameters:
      requirement - the charge requirement to register
    • registerUnlockRequirement

      void registerUnlockRequirement(UnlockRequirement requirement)
      Registers an unlock requirement to be tracked by the manager.
      Parameters:
      requirement - the unlock requirement to register
    • unregisterChargeRequirement

      void unregisterChargeRequirement(ChargeRequirement requirement)
      Unregisters a charge requirement from tracking.
      Parameters:
      requirement - the charge requirement to unregister
    • unregisterUnlockRequirement

      void unregisterUnlockRequirement(UnlockRequirement requirement)
      Unregisters an unlock requirement from tracking.
      Parameters:
      requirement - the unlock requirement to unregister