Class BreakConditions
- java.lang.Object
-
- com.kraken.api.core.script.breakhandler.BreakConditions
-
public class BreakConditions extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description BreakConditions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BreakConditionatSpecificTime(int hourOfDay, int minute)Breaks at a specific time of day.static BreakConditioncustomCondition(java.util.function.Supplier<java.lang.Boolean> shouldBreakCheck, java.lang.String reason)A custom break condition which can include any logicstatic BreakConditiononExperienceGained(net.runelite.api.Client client, net.runelite.api.Skill skill, int expThreshold)Breaks when experience gained exceeds a threshold.static BreakConditiononLevelReached(net.runelite.api.Client client, net.runelite.api.Skill skill, int targetLevel)Breaks when a specific skill reaches a target level.static BreakConditiononMaterialDepleted(Context ctx, int itemId)Breaks when items in the bank run out (e.g., materials).static BreakConditionrunOnce(BreakCondition condition)Wraps a condition to ensure it only triggers once per session.
-
-
-
Method Detail
-
onLevelReached
public static BreakCondition onLevelReached(net.runelite.api.Client client, net.runelite.api.Skill skill, int targetLevel)
Breaks when a specific skill reaches a target level.- Parameters:
client- RuneLite Clientskill- The Skill to track levels fortargetLevel- The target level for when the break should occur when reached.- Returns:
- BreakCondition
-
onExperienceGained
public static BreakCondition onExperienceGained(net.runelite.api.Client client, net.runelite.api.Skill skill, int expThreshold)
Breaks when experience gained exceeds a threshold.- Parameters:
client- RuneLite clientskill- The target skill for exp trackingexpThreshold- The amount of exp needed to trigger the break- Returns:
- BreakCondition
-
customCondition
public static BreakCondition customCondition(java.util.function.Supplier<java.lang.Boolean> shouldBreakCheck, java.lang.String reason)
A custom break condition which can include any logic- Parameters:
shouldBreakCheck- Supplier which returns a boolean. When true a break will occur.reason- The plain text reason for the break- Returns:
- BreakCondition
-
runOnce
public static BreakCondition runOnce(BreakCondition condition)
Wraps a condition to ensure it only triggers once per session. Useful for conditions like Level Reached or Material Depleted to prevent break loops.- Parameters:
condition- The condition to wrap- Returns:
- A new BreakCondition that only returns true once.
-
onMaterialDepleted
public static BreakCondition onMaterialDepleted(Context ctx, int itemId)
Breaks when items in the bank run out (e.g., materials).- Parameters:
ctx- The API game contextitemId- The item id to track. When this item is no longer present in the bank or your inventory, a break will be taken.- Returns:
- BreakCondition
-
atSpecificTime
public static BreakCondition atSpecificTime(int hourOfDay, int minute)
Breaks at a specific time of day.- Parameters:
hourOfDay- The hour 0-24 of the day when a break should initiateminute- The minute of the hour 0-60 when a break should initiate- Returns:
- BreakCondition
-
-