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 Summary
Modifier and TypeMethodDescriptionintgetCharges(ChargeRequirement requirement) Gets the current number of charges for the specified requirement.booleanhasCharges(ChargeRequirement requirement) Checks if the specified requirement has at least one charge remaining.booleanisUnlocked(UnlockRequirement requirement) Checks if the specified destination/feature is unlocked.voidregisterChargeRequirement(ChargeRequirement requirement) Registers a charge requirement to be tracked by the manager.voidregisterUnlockRequirement(UnlockRequirement requirement) Registers an unlock requirement to be tracked by the manager.voidsetCharges(ChargeRequirement requirement, int charges) Sets the current number of charges for the specified requirement.voidsetUnlocked(UnlockRequirement requirement, boolean unlocked) Sets the unlock state for the specified requirement.voidunregisterChargeRequirement(ChargeRequirement requirement) Unregisters a charge requirement from tracking.voidunregisterUnlockRequirement(UnlockRequirement requirement) Unregisters an unlock requirement from tracking.
-
Method Details
-
getCharges
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
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
Sets the current number of charges for the specified requirement.- Parameters:
requirement- the charge requirement to updatecharges- the new charge count
-
isUnlocked
Checks if the specified destination/feature is unlocked.- Parameters:
requirement- the unlock requirement to check- Returns:
- true if the destination is unlocked
-
setUnlocked
Sets the unlock state for the specified requirement.- Parameters:
requirement- the unlock requirement to updateunlocked- true if unlocked, false if locked
-
registerChargeRequirement
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
Registers an unlock requirement to be tracked by the manager.- Parameters:
requirement- the unlock requirement to register
-
unregisterChargeRequirement
Unregisters a charge requirement from tracking.- Parameters:
requirement- the charge requirement to unregister
-
unregisterUnlockRequirement
Unregisters an unlock requirement from tracking.- Parameters:
requirement- the unlock requirement to unregister
-