Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pest Farmer #274

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ baseGroup=com.jelly.farmhelperv2
mcVersion=1.8.9
modid=farmhelperv2
modName=FarmHelper
version=2.8.14
version=2.9.0
shouldRelease=true
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import cc.polyfrost.oneconfig.utils.commands.annotations.SubCommand;
import com.jelly.farmhelperv2.FarmHelper;
import com.jelly.farmhelperv2.config.FarmHelperConfig;
import com.jelly.farmhelperv2.feature.impl.AutoWardrobe;
import com.jelly.farmhelperv2.handler.GameStateHandler;
import com.jelly.farmhelperv2.pathfinder.FlyPathFinderExecutor;
import com.jelly.farmhelperv2.util.LogUtils;
Expand Down Expand Up @@ -68,9 +69,4 @@ public void update() {
PlayerUtils.closeScreen();
FarmHelperConfig.checkForUpdate();
}

@SubCommand
public void test(){
LogUtils.sendSuccess("SprayonatorState: " + GameStateHandler.getInstance().getSprayonatorState());
}
}
}
150 changes: 130 additions & 20 deletions src/main/java/com/jelly/farmhelperv2/config/FarmHelperConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
// THIS IS RAT - CatalizCS
@SuppressWarnings({"unused", "DefaultAnnotationParam"})
public class FarmHelperConfig extends Config {

private transient static final Minecraft mc = Minecraft.getMinecraft();
private transient static final String GENERAL = "General";
private transient static final String MISCELLANEOUS = "Miscellaneous";
Expand All @@ -51,6 +52,7 @@ public class FarmHelperConfig extends Config {
private transient static final String JACOBS_CONTEST = "Jacob's Contest";
private transient static final String VISITORS_MACRO = "Visitors Macro";
private transient static final String PESTS_DESTROYER = "Pests Destroyer";
private transient static final String PEST_FARMER = "Pest Farmer";
private transient static final String AUTO_PEST_EXCHANGE = "Auto Pest Exchange";
private transient static final String AUTO_GOD_POT = "Auto God Pot";
private transient static final String AUTO_SELL = "Auto Sell";
Expand Down Expand Up @@ -802,26 +804,26 @@ public class FarmHelperConfig extends Config {
)
public static boolean openInventoryOnSchedulerBreaks = true;
@Switch(
name = "Disconnect during break", category = SCHEDULER, subcategory = "Scheduler",
description = "Logs out of game and logs back in after break ends"
name = "Disconnect during break", category = SCHEDULER, subcategory = "Scheduler",
description = "Logs out of game and logs back in after break ends"
)
public static boolean schedulerDisconnectDuringBreak = false;
@Switch(
name = "Wait Until Rewarp Point for break", category = SCHEDULER, subcategory = "Scheduler",
description = "Waits until player is standing on rewarp point to take break"
name = "Wait Until Rewarp Point for break", category = SCHEDULER, subcategory = "Scheduler",
description = "Waits until player is standing on rewarp point to take break"
)
public static boolean schedulerWaitUntilRewarp = false;
@Switch(
name = "Reset Scheduler on Macro Disabled", category = SCHEDULER, subcategory = "Scheduler",
description = "Resets Scheduler When macro is disabled"
name = "Reset Scheduler on Macro Disabled", category = SCHEDULER, subcategory = "Scheduler",
description = "Resets Scheduler When macro is disabled"
)
public static boolean schedulerResetOnDisable = true;
@Button(
name = "Reset Scheduler", category = SCHEDULER, subcategory = "Scheduler",
text = "Reset Scheduler", description = "Resets Scheduler (Only works when macro is of)"
name = "Reset Scheduler", category = SCHEDULER, subcategory = "Scheduler",
text = "Reset Scheduler", description = "Resets Scheduler (Only works when macro is of)"
)
public Runnable schedulerReset = () -> {
if(!MacroHandler.getInstance().isMacroToggled()){
if (!MacroHandler.getInstance().isMacroToggled()) {
boolean old = FarmHelperConfig.schedulerResetOnDisable;
FarmHelperConfig.schedulerResetOnDisable = true;
Scheduler.getInstance().stop();
Expand Down Expand Up @@ -1196,6 +1198,11 @@ public class FarmHelperConfig extends Config {
)
public static int pestAdditionalGUIDelay = 0;

@Switch(
name = "Force Enable Pest Destroyer at X Pests", category = PESTS_DESTROYER, subcategory = "Pests Destroyer"
)
public static boolean pestForceEnable = false;

@Switch(
name = "Sprint while flying", category = PESTS_DESTROYER, subcategory = "Pests Destroyer",
description = "Sprints while flying"
Expand Down Expand Up @@ -1290,11 +1297,35 @@ public static void triggerManuallyPestsDestroyer() {
size = 2
)
public static OneKeyBind enablePestsDestroyerKeyBind = new OneKeyBind(Keyboard.KEY_NONE);
//</editor-fold>

//<editor-fold desc="Armor Swapper">
@Switch(
name = "Swap Armor Before Killing", category = PESTS_DESTROYER, subcategory = "Armor Swapper"
)
public static boolean pestSwapArmorBefore = false;

@Slider(
name = "Wardrobe Slot To Kill With", category = PESTS_DESTROYER, subcategory = "Armor Swapper",
description = "Wardrobe slot to use before turning on pest destroyer",
min = 1, max = 18
)
public static int pestArmorSlot0 = 1;

@Switch(
name = "Swap Armor After Killing", category = PESTS_DESTROYER, subcategory = "Armor Swapper"
)
public static boolean pestSwapArmorAfter = false;

@Slider(
name = "Wardrobe Slot To Farm With", category = PESTS_DESTROYER, subcategory = "Armor Swapper",
description = "Wardrobe slot to equip after turning off pest destroyer",
min = 1, max = 18
)
public static int pestArmorSlot1 = 1;
//</editor-fold>

//<editor-fold desc="Drawings">

@Switch(
name = "Pests ESP", category = PESTS_DESTROYER, subcategory = "Drawings",
description = "Draws a box around pests"
Expand Down Expand Up @@ -1350,6 +1381,81 @@ public static void triggerManuallyPestsDestroyer() {
//</editor-fold>
//</editor-fold>

//<editor-fold desc="PEST FARMER">
@Header(
text = "Read the comments below this page before using pest farmer.",
category = PEST_FARMER, size = 2
)
public static boolean ignored1;

@Switch(
name = "Enable Pest Farming", category = PEST_FARMER,
description = "Enables Pest Farming"
)
public static boolean pestFarming = false;

@Switch(
name = "Hold Daedalus Axe", category = PEST_FARMER,
description = "Farms with daedalus axe while waiting for pests to spawn"
)
public static boolean pestFarmingHoldDaedalus = false;

@Slider(
name = "Farming Armor Slot", category = PEST_FARMER,
min = 1, max = 18
)
public static int pestFarmingSet0Slot = 1;

@Slider(
name = "Pest Chance Armor Slot", category = PEST_FARMER,
min = 1, max = 18
)
public static int pestFarmingSet1Slot = 1;

@Slider(
name = "Pest Spawn Timer (In seconds)", category = PEST_FARMER,
description = "The time it should wait after pests spawn to swap slots (should be your pest spawn time - 5/10 seconds)",
min = 30, max = 300
)
public static int pestFarmingWaitTime = 255;

@Info(
text = "It's supposed to swap armor before pest spawns, swap back after pest spawns and kill with Pest Destryoer/the other one.",
type = InfoType.INFO, category = PEST_FARMER, size = 2
)
public static boolean ignored0;
@Info(
text = "Use this Auto-Pet Rule:",
type = InfoType.INFO, category = PEST_FARMER, size = 2
)
public static boolean ignored2;
@Info(
text = " 1. On Gain Crop Collection -> Farming Pet, Except if slug is Equipped",
type = InfoType.INFO, category = PEST_FARMER, size = 2
)
public static boolean ignored3;
@Info(
text = " 2. On Equip Farming Armor -> Farming Pet",
type = InfoType.INFO, category = PEST_FARMER, size = 2
)
public static boolean ignored4;
@Info(
text = " 3. On Equip Pest Chance Armor -> Slug Pet",
type = InfoType.INFO, category = PEST_FARMER, size = 2
)
public static boolean ignored5;
@Info(
text = " 4. On Enter Combat -> Hedgehog Pet",
type = InfoType.INFO, category = PEST_FARMER, size = 2
)
public static boolean ignored6;
@Info(
text = "Use Armor Swapper in Pest Destroyer. Swap to Farming Armor On Start Just in case Pest Farmer doesn't do that itself.",
type = InfoType.INFO, category = PEST_FARMER, size = 2
)
public static boolean ignored7;

//</editor-fold>
//<editor-fold desc="DISCORD INTEGRATION">
//<editor-fold desc="Webhook Discord">
@Switch(
Expand Down Expand Up @@ -1973,7 +2079,7 @@ public static void triggerManuallyAutoPestExchange() {
name = "Reset stats between disabling", category = HUD, subcategory = "Profit Calculator"
)
public static boolean resetStatsBetweenDisabling = false;
// @Button(
// @Button(
// name = "Reset Profit Calculator", category = HUD, subcategory = "Profit Calculator",
// text = "Reset Now", size = 2
// )
Expand Down Expand Up @@ -2008,7 +2114,6 @@ public static void triggerManuallyAutoPestExchange() {
)
public static boolean debugMode = false;


//</editor-fold>

//<editor-fold desc="Debug Hud">
Expand Down Expand Up @@ -2089,7 +2194,6 @@ public static void triggerManuallyAutoPestExchange() {
)
public static boolean showDebugLogsAboutPDOTT = false;


//</editor-fold>

@Number(name = "Config Version", category = EXPERIMENTAL, subcategory = "Experimental", min = 0, max = 1337)
Expand Down Expand Up @@ -2182,8 +2286,8 @@ public FarmHelperConfig() {
this.addDependency("sprintWhileFlying", "enablePestsDestroyer");
this.addDependency("pausePestsDestroyerDuringJacobsContest", "enablePestsDestroyer");


this.hideIf("infoCookieBuffRequired", () -> GameStateHandler.getInstance().inGarden() || GameStateHandler.getInstance().getCookieBuffState() == BuffState.NOT_ACTIVE);
this.hideIf("infoCookieBuffRequired",
() -> GameStateHandler.getInstance().inGarden() || GameStateHandler.getInstance().getCookieBuffState() == BuffState.NOT_ACTIVE);

this.addDependency("sendLogs", "enableWebHook");
this.addDependency("sendStatusUpdates", "enableWebHook");
Expand All @@ -2194,9 +2298,9 @@ public FarmHelperConfig() {
this.addDependency("discordRemoteControlAddress", "enableRemoteControl");
this.addDependency("remoteControlPort", "enableRemoteControl");


this.hideIf("infoRemoteControl", () -> Loader.isModLoaded("farmhelperjdadependency"));
this.hideIf("info2RemoteControl", () -> !Loader.isModLoaded("farmhelperjdadependency") || (Loader.isModLoaded("farmhelperjdadependency") && FarmHelper.isJDAVersionCorrect));
this.hideIf("info2RemoteControl", () -> !Loader.isModLoaded("farmhelperjdadependency") || (Loader.isModLoaded("farmhelperjdadependency")
&& FarmHelper.isJDAVersionCorrect));
this.hideIf("failsafeSoundTimes", () -> true);

this.addDependency("debugMode", "Streamer Mode", () -> !streamerMode);
Expand Down Expand Up @@ -2256,6 +2360,9 @@ public FarmHelperConfig() {
this.addDependency("rotationTimeDuringJacob", "customRotationDelaysDuringJacob");
this.addDependency("rotationTimeRandomnessDuringJacob", "customRotationDelaysDuringJacob");

this.addDependency("pestArmorSlot0", "pestSwapArmorBefore");
this.addDependency("pestArmorSlot1", "pestSwapArmorAfter");

this.addDependency("leaveTime", "leaveTimer");

this.hideIf("shownWelcomeGUI", () -> true);
Expand Down Expand Up @@ -2338,8 +2445,9 @@ public static void removeAllRewarps() {

public static void saveRewarpConfig() {
try {
if (!configRewarpFile.exists())
if (!configRewarpFile.exists()) {
Files.createFile(configRewarpFile.toPath());
}

Files.write(configRewarpFile.toPath(), FarmHelper.gson.toJson(rewarpList).getBytes(StandardCharsets.UTF_8));
} catch (IOException e) {
Expand All @@ -2352,8 +2460,9 @@ public static MacroEnum getMacro() {
}

public static long getRandomTimeBetweenChangingRows() {
if (customRowChangeDelaysDuringJacob && GameStateHandler.getInstance().inJacobContest())
if (customRowChangeDelaysDuringJacob && GameStateHandler.getInstance().inJacobContest()) {
return (long) (timeBetweenChangingRowsDuringJacob + (float) Math.random() * randomTimeBetweenChangingRowsDuringJacob);
}
return (long) (timeBetweenChangingRows + (float) Math.random() * randomTimeBetweenChangingRows);
}

Expand All @@ -2362,8 +2471,9 @@ public static long getMaxTimeBetweenChangingRows() {
}

public static long getRandomRotationTime() {
if (customRotationDelaysDuringJacob && GameStateHandler.getInstance().inJacobContest())
if (customRotationDelaysDuringJacob && GameStateHandler.getInstance().inJacobContest()) {
return (long) (rotationTimeDuringJacob + (float) Math.random() * rotationTimeRandomnessDuringJacob);
}
return (long) (rotationTime + (float) Math.random() * rotationTimeRandomness);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ public List<IFeature> fillFeatures() {
Scheduler.getInstance(),
UngrabMouse.getInstance(),
VisitorsMacro.getInstance(),
PiPMode.getInstance()
PiPMode.getInstance(),
AutoWardrobe.instance,
PestFarmer.instance// sue me
);
features.addAll(featuresList);
return features;
Expand Down
Loading