Class ChargeManager

java.lang.Object
net.storm.sdk.movement.pathfinder.ChargeManager

public class ChargeManager extends Object
Manages charge tracking and unlock state for teleport items and transportation methods.

This class provides functionality to track charges on items like teleport jewelry, slayer rings, and other rechargeable teleportation methods. It also tracks unlock states for content that must be unlocked before use (e.g., quest completions, achievement diary rewards).

The charge manager is used by the pathfinding system to determine whether teleportation methods are available based on remaining charges and unlock states.

Key features include:

  • Charge tracking: Monitor remaining charges on teleport items
  • Unlock tracking: Track whether content has been unlocked
  • Registration: Register custom charge and unlock requirements

Example Usage:


 // Check if a teleport item has charges
 ChargeRequirement ringOfDueling = ChargeRequirement.RING_OF_DUELING;
 if (ChargeManager.hasCharges(ringOfDueling)) {
     int charges = ChargeManager.getCharges(ringOfDueling);
     System.out.println("Ring has " + charges + " charges remaining");
 }

 // Set charges after checking inventory
 ChargeManager.setCharges(ringOfDueling, 8);

 // Check if a teleport is unlocked
 UnlockRequirement ardougneTele = UnlockRequirement.ARDOUGNE_CLOAK;
 if (ChargeManager.isUnlocked(ardougneTele)) {
     // Can use the Ardougne cloak teleport
 }

 // Register a custom charge requirement
 ChargeRequirement customReq = new ChargeRequirement("custom_teleport", 10);
 ChargeManager.registerChargeRequirement(customReq);
 
See Also:
  • Constructor Details

    • ChargeManager

      public ChargeManager()
  • Method Details

    • getCharges

      public static int getCharges(ChargeRequirement requirement)
      Retrieves the current number of charges for a charge requirement.
      Parameters:
      requirement - the charge requirement to query
      Returns:
      the number of remaining charges
    • hasCharges

      public static boolean hasCharges(ChargeRequirement requirement)
      Checks whether a charge requirement has any charges remaining.
      Parameters:
      requirement - the charge requirement to check
      Returns:
      true if at least one charge remains, false otherwise
    • setCharges

      public static void setCharges(ChargeRequirement requirement, int charges)
      Sets the current number of charges for a charge requirement.

      Use this to update charge counts when items are used or recharged.

      Parameters:
      requirement - the charge requirement to update
      charges - the new charge count
    • isUnlocked

      public static boolean isUnlocked(UnlockRequirement requirement)
      Checks whether an unlock requirement has been unlocked.
      Parameters:
      requirement - the unlock requirement to check
      Returns:
      true if the content is unlocked, false otherwise
    • setUnlocked

      public static void setUnlocked(UnlockRequirement requirement, boolean unlocked)
      Sets the unlock state for an unlock requirement.
      Parameters:
      requirement - the unlock requirement to update
      unlocked - true to mark as unlocked, false to mark as locked
    • registerChargeRequirement

      public static void registerChargeRequirement(ChargeRequirement requirement)
      Registers a custom charge requirement with the charge manager.

      Use this to add tracking for custom teleport items or other rechargeable content not covered by built-in requirements.

      Parameters:
      requirement - the charge requirement to register
    • registerUnlockRequirement

      public static void registerUnlockRequirement(UnlockRequirement requirement)
      Registers a custom unlock requirement with the charge manager.

      Use this to add tracking for custom unlockable content.

      Parameters:
      requirement - the unlock requirement to register
    • unregisterChargeRequirement

      public static void unregisterChargeRequirement(ChargeRequirement requirement)
      Removes a charge requirement from the charge manager.
      Parameters:
      requirement - the charge requirement to unregister
    • unregisterUnlockRequirement

      public static void unregisterUnlockRequirement(UnlockRequirement requirement)
      Removes an unlock requirement from the charge manager.
      Parameters:
      requirement - the unlock requirement to unregister