Class ChargeManager
java.lang.Object
net.storm.sdk.movement.pathfinder.ChargeManager
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intgetCharges(ChargeRequirement requirement) Retrieves the current number of charges for a charge requirement.static booleanhasCharges(ChargeRequirement requirement) Checks whether a charge requirement has any charges remaining.static booleanisUnlocked(UnlockRequirement requirement) Checks whether an unlock requirement has been unlocked.static voidregisterChargeRequirement(ChargeRequirement requirement) Registers a custom charge requirement with the charge manager.static voidregisterUnlockRequirement(UnlockRequirement requirement) Registers a custom unlock requirement with the charge manager.static voidsetCharges(ChargeRequirement requirement, int charges) Sets the current number of charges for a charge requirement.static voidsetUnlocked(UnlockRequirement requirement, boolean unlocked) Sets the unlock state for an unlock requirement.static voidunregisterChargeRequirement(ChargeRequirement requirement) Removes a charge requirement from the charge manager.static voidunregisterUnlockRequirement(UnlockRequirement requirement) Removes an unlock requirement from the charge manager.
-
Constructor Details
-
ChargeManager
public ChargeManager()
-
-
Method Details
-
getCharges
Retrieves the current number of charges for a charge requirement.- Parameters:
requirement- the charge requirement to query- Returns:
- the number of remaining charges
-
hasCharges
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
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 updatecharges- the new charge count
-
isUnlocked
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
Sets the unlock state for an unlock requirement.- Parameters:
requirement- the unlock requirement to updateunlocked- true to mark as unlocked, false to mark as locked
-
registerChargeRequirement
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
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
Removes a charge requirement from the charge manager.- Parameters:
requirement- the charge requirement to unregister
-
unregisterUnlockRequirement
Removes an unlock requirement from the charge manager.- Parameters:
requirement- the unlock requirement to unregister
-