Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
@PluginDescriptor(
name = PluginDescriptor.See1Duck + "Antiban",
description = "Antiban for microbot",
version = "1.0.1",
tags = {"main", "microbot", "antiban parent"},
alwaysOn = true,
hidden = true
Expand Down Expand Up @@ -163,7 +164,7 @@ public static void performActionBreak() {

@Override
protected void startUp() throws AWTException {
Rs2Antiban.setActivityIntensity(ActivityIntensity.EXTREME);
Rs2Antiban.setActivityIntensity(Rs2Antiban.DEFAULT_ACTIVITY_INTENSITY);
final MasterPanel panel = injector.getInstance(MasterPanel.class);
final BufferedImage icon = ImageUtil.loadImageResource(getClass(), "antiban.png");
navButton = NavigationButton.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
@Getter
@Setter
public class Rs2Antiban {
static final ActivityIntensity DEFAULT_ACTIVITY_INTENSITY = ActivityIntensity.LOW;
public static final ImmutableSet<Integer> MINING_ANIMATION_IDS = ImmutableSet.of(
MINING_BRONZE_PICKAXE, MINING_MOTHERLODE_BRONZE, MINING_CRASHEDSTAR_BRONZE,
MINING_IRON_PICKAXE, MINING_MOTHERLODE_IRON, MINING_CRASHEDSTAR_IRON,
Expand Down Expand Up @@ -129,7 +130,7 @@ public class Rs2Antiban {
@Getter
private static Activity activity;
@Getter
private static ActivityIntensity activityIntensity;
private static ActivityIntensity activityIntensity = DEFAULT_ACTIVITY_INTENSITY;
@Getter
@Setter
private static Category category;
Expand Down Expand Up @@ -559,7 +560,7 @@ public static void resetAntibanSettings(boolean forceReset) {
Rs2AntibanSettings.reset();
Rs2Antiban.playStyle = null;
Rs2Antiban.activity = null;
Rs2Antiban.activityIntensity = ActivityIntensity.EXTREME;
Rs2Antiban.activityIntensity = DEFAULT_ACTIVITY_INTENSITY;
Rs2Antiban.category = null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class MousePanel extends JPanel

// 1) Add new components for Activity Intensity
private final JLabel mouseSpeedLabel = new JLabel();
private final JSlider mouseSpeedSlider = new JSlider(0, 4, 2); // default to index=2 (MODERATE)
private final JSlider mouseSpeedSlider = new JSlider(0, 4, 1); // default to index=1 (LOW)

public MousePanel()
{
Expand Down Expand Up @@ -154,7 +154,7 @@ private int getIndexFromActivityIntensity(ActivityIntensity intensity)
case MODERATE: return 2;
case HIGH: return 3;
case EXTREME: return 4;
default: return 2;
default: return 1;
}
}

Expand All @@ -168,7 +168,7 @@ private ActivityIntensity getActivityIntensityFromIndex(int index)
case 2: return ActivityIntensity.MODERATE;
case 3: return ActivityIntensity.HIGH;
case 4: return ActivityIntensity.EXTREME;
default: return ActivityIntensity.MODERATE;
default: return ActivityIntensity.LOW;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package net.runelite.client.plugins.microbot.util.antiban;

import net.runelite.client.plugins.microbot.util.antiban.enums.ActivityIntensity;
import org.junit.After;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class Rs2AntibanDefaultsTest
{
@After
public void restoreDefaults()
{
Rs2Antiban.resetAntibanSettings(true);
}

@Test
public void resetRestoresLowMouseSpeed()
{
Rs2Antiban.setActivityIntensity(ActivityIntensity.HIGH);

Rs2Antiban.resetAntibanSettings(true);

assertEquals(ActivityIntensity.LOW, Rs2Antiban.getActivityIntensity());
}
}
Loading