2021-10-16 17:25:28 +02:00

46 lines
1.2 KiB
Java

package io.reisub.dreambot.cwintertodt.tasks;
import io.reisub.dreambot.util.Constants;
import io.reisub.dreambot.util.Util;
import org.dreambot.api.methods.Calculations;
import org.dreambot.api.methods.interactive.GameObjects;
import org.dreambot.api.methods.interactive.Players;
import org.dreambot.api.script.TaskNode;
import org.dreambot.api.wrappers.interactive.GameObject;
import org.dreambot.api.wrappers.interactive.Player;
public class LightOrFix extends TaskNode {
private WintertodtTask parent;
public LightOrFix(WintertodtTask parent) {
this.parent = parent;
}
@Override
public boolean accept() {
GameObject brazier = GameObjects.closest(Constants.BRAZIER);
if (brazier == null) return false;
Player player = Players.localPlayer();
return (player.distance(brazier) < 2);
}
@Override
public int execute() {
GameObject brazier = GameObjects.closest(Constants.BRAZIER);
if (brazier.hasAction(Constants.LIGHT)) {
brazier.interactForceLeft(Constants.LIGHT);
} else {
brazier.interactForceLeft(Constants.FIX);
}
Util.sleepUntilMovingOrAnimating();
return Calculations.random(200, 300);
}
}