mirror of
https://github.com/2006Scape-Scripts/ParaScript.git
synced 2026-07-02 16:49:02 +00:00
update exp every now and then.
This commit is contained in:
@@ -35,6 +35,7 @@ public class Main extends Script implements MessageListener, Paintable {
|
||||
|
||||
Variables.setBaseExp();
|
||||
|
||||
strategies.add(new UpdateExperience());
|
||||
strategies.add(new ScriptState());
|
||||
if(Variables.skill_to_train == Skill.WOODCUTTING) {
|
||||
strategies.add(new MakeArrowShafts());
|
||||
|
||||
@@ -13,6 +13,7 @@ public class Variables {
|
||||
public static int items_gained = 0;
|
||||
public static double base_experience = 0;
|
||||
public static double exp_gained = 0;
|
||||
public static int update_experience_tick = 0;
|
||||
|
||||
// Login Panel
|
||||
private static String username = "";
|
||||
|
||||
@@ -32,14 +32,17 @@ public class Fish implements Strategy {
|
||||
if (Variables.shouldDropItems()) {
|
||||
if (Inventory.getCount(441) >= 1) Inventory.getItem(441).interact(Items.Option.DROP);
|
||||
}
|
||||
|
||||
for (int item_id: items)
|
||||
if (Inventory.getItem(item_id + 1) != null)
|
||||
Menu.sendAction(431, item_id, Inventory.getItem(item_id + 1).getSlot(), 5064, 3);
|
||||
|
||||
fishingSpot.interact(Variables.fishing_type_selected);
|
||||
Time.sleep(1000);
|
||||
|
||||
// Wait for the Player to finish fishing (max 60 seconds)
|
||||
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 60000);
|
||||
} catch (Exception err){
|
||||
} catch (Exception ಠ_ಠ){
|
||||
System.out.println("Fishing error: ¯\\_(ツ)_/¯");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
package ParaScript.strategies;
|
||||
|
||||
import ParaScript.data.Variables;
|
||||
import org.parabot.environment.api.utils.Time;
|
||||
import org.parabot.environment.scripts.framework.Strategy;
|
||||
|
||||
public class UpdateExperience implements Strategy {
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
if (++Variables.update_experience_tick >= 1000) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
Variables.updateExpGained();
|
||||
Variables.update_experience_tick = 0;
|
||||
Time.sleep(500);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user