diff --git a/src/main/java/com/questhelper/bank/banktab/QuestHelperBankTagService.java b/src/main/java/com/questhelper/bank/banktab/QuestHelperBankTagService.java index d6d5fb47d0..917d330cff 100644 --- a/src/main/java/com/questhelper/bank/banktab/QuestHelperBankTagService.java +++ b/src/main/java/com/questhelper/bank/banktab/QuestHelperBankTagService.java @@ -49,6 +49,8 @@ public class QuestHelperBankTagService @Inject private QuestBank questBank; + private final String RECOMMENDED_TAB_NAME = "Recommended items"; + public ArrayList itemsToTag() { ArrayList sortedItems = getPluginBankTagItemsForSections(true); @@ -95,8 +97,8 @@ public ArrayList getPluginBankTagItemsForSections(boolean onlyGetM if (recommendedItems != null && !recommendedItems.isEmpty()) { - BankTabItems pluginItems = new BankTabItems("Recommended items"); - // Here we specify getItems so as to avoid a double 'Recommended' title + BankTabItems pluginItems = new BankTabItems(RECOMMENDED_TAB_NAME); + // Here we specify getItems to avoid a double 'Recommended' title recommendedItems.forEach(item -> getItemsFromRequirement(pluginItems.getItems(), item, item)); newList.add(pluginItems); } @@ -137,7 +139,31 @@ public ArrayList getPluginBankTagItemsForSections(boolean onlyGetM items.forEach(item -> getItemsFromRequirement(pluginItems.getItems(), item, item)); recommendedItemsForSection.forEach(item -> getItemsFromRequirement(pluginItems.getRecommendedItems(), item, item)); // We don't add the recommended items as they're already used - newList.add(pluginItems); + if (items.size() > 0) + { + newList.add(pluginItems); + } + } + + // If none of the sections have anything in it, create a generic require items section + if (newList.size() == 0 || (newList.size() == 1 && newList.get(0).getName().equals(RECOMMENDED_TAB_NAME))) + { + BankTabItems allRequiredItems = new BankTabItems("Required items"); + List allRequired = plugin.getSelectedQuest().getItemRequirements(); + List items; + if (allRequired != null && allRequired.size() > 0) + { + items = allRequired.stream() + .filter(Objects::nonNull) + .map(ItemRequirement.class::cast) + .filter(i -> (!onlyGetMissingItems + || !i.check(plugin.getClient(), false, questBank.getBankItems())) + && i.shouldDisplayText(plugin.getClient())) + .collect(Collectors.toList()); + + items.forEach(item -> getItemsFromRequirement(allRequiredItems.getItems(), item, item)); + } + newList.add(allRequiredItems); } return newList; diff --git a/src/main/java/com/questhelper/helpers/mischelpers/farmruns/CropState.java b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/CropState.java new file mode 100644 index 0000000000..35abbe2132 --- /dev/null +++ b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/CropState.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2018 Abex + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.questhelper.helpers.mischelpers.farmruns; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +@Getter +public enum CropState +{ + HARVESTABLE(), // Ready for checking + UNCHECKED(), + STUMP(), // Cut down + GROWING(), + DISEASED(), + DEAD(), + EMPTY(), + FILLING(); +} diff --git a/src/main/java/com/questhelper/helpers/mischelpers/farmruns/FarmingConfigChangeHandler.java b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/FarmingConfigChangeHandler.java new file mode 100644 index 0000000000..bb27f40773 --- /dev/null +++ b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/FarmingConfigChangeHandler.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2024, Kerpackie + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.questhelper.helpers.mischelpers.farmruns; + +import com.questhelper.QuestHelperConfig; +import com.questhelper.QuestHelperPlugin; +import net.runelite.client.config.ConfigManager; +import net.runelite.client.events.ConfigChanged; +import java.util.function.Consumer; + +public class FarmingConfigChangeHandler +{ + public static > void handleFarmingEnumConfigChange(ConfigChanged event, String configKey, + Class enumClass, Consumer updateAction, T defaultValue, ConfigManager configManager, QuestHelperPlugin questHelperPlugin) + { + if (event.getKey().equals(configKey)) + { + try + { + T selectedEnumValue = Enum.valueOf(enumClass, event.getNewValue()); + updateAction.accept(selectedEnumValue); + questHelperPlugin.refreshBank(); + } + catch (IllegalArgumentException e) + { + configManager.setConfiguration(QuestHelperConfig.QUEST_BACKGROUND_GROUP, configKey, defaultValue.name()); + } + } + } +} + diff --git a/src/main/java/com/questhelper/helpers/mischelpers/herbrun/FarmingHandler.java b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/FarmingHandler.java similarity index 92% rename from src/main/java/com/questhelper/helpers/mischelpers/herbrun/FarmingHandler.java rename to src/main/java/com/questhelper/helpers/mischelpers/farmruns/FarmingHandler.java index 3458f365bc..b0ceb4564f 100644 --- a/src/main/java/com/questhelper/helpers/mischelpers/herbrun/FarmingHandler.java +++ b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/FarmingHandler.java @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package com.questhelper.helpers.mischelpers.herbrun; +package com.questhelper.helpers.mischelpers.farmruns; import java.time.Instant; import javax.annotation.Nullable; @@ -30,7 +30,6 @@ import net.runelite.api.Varbits; import net.runelite.client.config.ConfigManager; import net.runelite.client.plugins.timetracking.TimeTrackingConfig; -import net.runelite.client.plugins.timetracking.farming.CropState; import net.runelite.client.plugins.timetracking.farming.Produce; public class FarmingHandler @@ -83,7 +82,12 @@ public CropState predictPatch(FarmingPatch patch, String profile) if (state == null) return null; if (state.getCropState() == CropState.EMPTY) return CropState.EMPTY; if (state.getProduce() == Produce.WEEDS) return CropState.EMPTY; - if (state.getCropState() == CropState.DEAD) return CropState.DEAD; + if (state.getCropState() == CropState.UNCHECKED) return CropState.UNCHECKED; + if (state.getCropState() == CropState.STUMP) return CropState.STUMP; + if (state.getCropState() == CropState.HARVESTABLE) + { + return CropState.HARVESTABLE; + } if (unixTime <= 0) { @@ -108,7 +112,10 @@ public CropState predictPatch(FarmingPatch patch, String profile) doneEstimate = getTickTime(tickrate, stages - 1 - stage, tickTime, profile); } - if (unixNow >= doneEstimate) return CropState.HARVESTABLE; + if (unixNow >= doneEstimate) + { + return CropState.UNCHECKED; + } return CropState.GROWING; } diff --git a/src/main/java/com/questhelper/helpers/mischelpers/herbrun/FarmingPatch.java b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/FarmingPatch.java similarity index 97% rename from src/main/java/com/questhelper/helpers/mischelpers/herbrun/FarmingPatch.java rename to src/main/java/com/questhelper/helpers/mischelpers/farmruns/FarmingPatch.java index 4721463625..ad02549c09 100644 --- a/src/main/java/com/questhelper/helpers/mischelpers/herbrun/FarmingPatch.java +++ b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/FarmingPatch.java @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package com.questhelper.helpers.mischelpers.herbrun; +package com.questhelper.helpers.mischelpers.farmruns; import lombok.AccessLevel; import lombok.Getter; @@ -58,7 +58,6 @@ class FarmingPatch this(name, varbit, implementation, farmer, -1); } - FarmingPatch(String name, @Varbit int varbit, PatchImplementation implementation, int farmer, int patchNumber) { this.name = name; diff --git a/src/main/java/com/questhelper/helpers/mischelpers/herbrun/FarmingRegion.java b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/FarmingRegion.java similarity index 97% rename from src/main/java/com/questhelper/helpers/mischelpers/herbrun/FarmingRegion.java rename to src/main/java/com/questhelper/helpers/mischelpers/farmruns/FarmingRegion.java index 6b74060c24..cc2549312c 100644 --- a/src/main/java/com/questhelper/helpers/mischelpers/herbrun/FarmingRegion.java +++ b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/FarmingRegion.java @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package com.questhelper.helpers.mischelpers.herbrun; +package com.questhelper.helpers.mischelpers.farmruns; import lombok.Getter; import net.runelite.api.coords.WorldPoint; diff --git a/src/main/java/com/questhelper/helpers/mischelpers/farmruns/FarmingUtils.java b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/FarmingUtils.java new file mode 100644 index 0000000000..6ec32a6dc4 --- /dev/null +++ b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/FarmingUtils.java @@ -0,0 +1,335 @@ +/* + * Copyright (c) 2024, Zoinkwiz + * Copyright (c) 2024, Kerpackie + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.questhelper.helpers.mischelpers.farmruns; + +import com.questhelper.QuestHelperConfig; +import com.questhelper.requirements.item.ItemRequirement; +import java.util.ArrayList; +import java.util.List; +import net.runelite.api.Client; +import net.runelite.api.ItemID; +import net.runelite.client.config.ConfigManager; +import net.runelite.client.game.ItemManager; +import net.runelite.client.util.Text; + +public class FarmingUtils +{ + + /** + * Creates an ItemRequirement representing a seed requirement for farming-related tasks. + * + * This method allows for customization based on configuration settings or uses default values if necessary. + * + * @param configManager The RuneLite ConfigManager instance used to access configuration settings. + * @param configGroupName The name of the configuration group where seed settings are stored. + * @param seedConfigName The name of the specific seed configuration setting. + * @param defaultValue The default seed enum value. + * @param defaultItemId The default item ID associated with the seed. + * @return An ItemRequirement object representing the seed requirement. + */ + + public static ItemRequirement createSeedRequirement(ConfigManager configManager, String configGroupName, + String seedConfigName, Enum defaultValue, int defaultItemId) + { + + ItemRequirement seedRequirement = new ItemRequirement(Text.titleCase(defaultValue), defaultItemId); + + String seedName = configManager.getRSProfileConfiguration(configGroupName, seedConfigName); + + if (seedName != null) + { + try + { + Enum seedEnum = Enum.valueOf(defaultValue.getDeclaringClass(), seedName); + seedRequirement.setId(getSeedItemIdFromEnum(seedEnum)); + if (seedEnum instanceof HardwoodTreeSapling || + seedEnum instanceof FruitTreeSapling || + seedEnum instanceof TreeSapling) + { + seedRequirement.setName(Text.titleCase(seedEnum) + " sapling"); + } + else + { + seedRequirement.setName(Text.titleCase(seedEnum) + " seed"); + } + + } + catch (IllegalArgumentException e) + { + configManager.setRSProfileConfiguration(configGroupName, seedConfigName, defaultValue.name()); + } + } + else + { + configManager.setConfiguration(configGroupName, seedConfigName, defaultValue.name()); + } + + return seedRequirement; + } + + public static int getSeedItemIdFromEnum(Enum enumValue) + { + if (enumValue instanceof TreeSapling) + { + return ((TreeSapling) enumValue).treeSaplingID; + } + else if (enumValue instanceof FruitTreeSapling) + { + return ((FruitTreeSapling) enumValue).fruitTreeSaplingId; + } + else if (enumValue instanceof HardwoodTreeSapling) + { + return ((HardwoodTreeSapling) enumValue).hardwoodTreeSaplingId; + } + else + { + throw new IllegalArgumentException("Unsupported enum type"); + } + } + + public static boolean getPatchState(Client client, int[] patchStates, int varbit) + { + for (int stateVarb : patchStates) + { + if (client.getVarbitValue(varbit) == stateVarb) + { + return true; + } + } + + return false; + } + + public static ConfigEnum getEnumFromConfig(ConfigManager configManager, ConfigEnum configEnum) + { + try + { + ConfigEnum fetchedEnum = configManager.getRSProfileConfiguration(QuestHelperConfig.QUEST_BACKGROUND_GROUP, configEnum.getConfigKey(), configEnum.getClass()); + if (fetchedEnum == null) + { + configManager.setRSProfileConfiguration(QuestHelperConfig.QUEST_BACKGROUND_GROUP, configEnum.getDefault().getConfigKey(), configEnum.getDefault()); + return configEnum.getDefault(); + } + return configManager.getRSProfileConfiguration(QuestHelperConfig.QUEST_BACKGROUND_GROUP, configEnum.getConfigKey(), configEnum.getClass()); + } + catch (Exception err) + { + configManager.setRSProfileConfiguration(QuestHelperConfig.QUEST_BACKGROUND_GROUP, configEnum.getDefault().getConfigKey(), configEnum.getDefault()); + return configEnum.getDefault(); + } + } + + public interface ConfigEnum + { + String getConfigKey(); + + ConfigEnum getDefault(); + } + + public interface PlantableItem extends ConfigEnum + { + int getPlantableItemId(); + + int getProtectionItemId(); + + int getProtectionItemQuantity(); + + default ItemRequirement getPlantableItemRequirement(ItemManager itemManager) + { + return new ItemRequirement(itemManager.getItemComposition(getPlantableItemId()).getName(), getPlantableItemId()); + } + + default ItemRequirement getProtectionItemRequirement(ItemManager itemManager) + { + return new ItemRequirement(itemManager.getItemComposition(getProtectionItemId()).getName(), getProtectionItemId(), getProtectionItemQuantity()); + } + } + + public enum TreeSapling implements PlantableItem + { + OAK(ItemID.OAK_SAPLING, ItemID.TOMATOES5, 1), WILLOW(ItemID.WILLOW_SAPLING, ItemID.APPLES5, 1), + MAPLE(ItemID.MAPLE_SAPLING, ItemID.ORANGES5, 1), YEW(ItemID.YEW_SAPLING, ItemID.CACTUS_SPINE, 10), + MAGIC(ItemID.MAGIC_SAPLING, ItemID.COCONUT, 25); + + final int treeSaplingID; + final int protectionItemId; + final int protectionItemQuantity; + + TreeSapling(int treeSaplingID, int protectionItemId, int protectionItemQuantity) + { + this.treeSaplingID = treeSaplingID; + this.protectionItemId = protectionItemId; + this.protectionItemQuantity = protectionItemQuantity; + } + + @Override + public String getConfigKey() + { + return "treeSaplings"; + } + + @Override + public int getPlantableItemId() + { + return treeSaplingID; + } + + @Override + public int getProtectionItemId() + { + return protectionItemId; + } + + @Override + public int getProtectionItemQuantity() + { + return protectionItemQuantity; + } + + @Override + public ConfigEnum getDefault() + { + return TreeSapling.OAK; + } + } + + public enum FruitTreeSapling implements PlantableItem + { + APPLE(ItemID.APPLE_SAPLING, ItemID.SWEETCORN, 9), BANANA(ItemID.BANANA_SAPLING, ItemID.APPLES5, 4), + ORANGE(ItemID.ORANGE_SAPLING, ItemID.STRAWBERRIES5, 3), CURRY(ItemID.CURRY_SAPLING, ItemID.BANANAS5, 5), + PINEAPPLE(ItemID.PINEAPPLE_SAPLING, ItemID.WATERMELON, 10), PAPAYA(ItemID.PAPAYA_SAPLING, ItemID.PINEAPPLE, 10), + PALM(ItemID.PALM_SAPLING, ItemID.PAPAYA_FRUIT, 15), DRAGONFRUIT(ItemID.DRAGONFRUIT_SAPLING, ItemID.COCONUT, 15); + + final int fruitTreeSaplingId; + final int protectionItemId; + final int protectionItemQuantity; + + FruitTreeSapling(int fruitTreeSaplingId, int protectionItemId, int protectionItemQuantity) + { + this.fruitTreeSaplingId = fruitTreeSaplingId; + this.protectionItemId = protectionItemId; + this.protectionItemQuantity = protectionItemQuantity; + } + + @Override + public String getConfigKey() + { + return "fruitTreeSaplings"; + } + + @Override + public int getPlantableItemId() + { + return fruitTreeSaplingId; + } + + @Override + public int getProtectionItemId() + { + return protectionItemId; + } + + @Override + public int getProtectionItemQuantity() + { + return protectionItemQuantity; + } + + @Override + public ConfigEnum getDefault() + { + return FruitTreeSapling.APPLE; + } + } + + public enum HardwoodTreeSapling implements PlantableItem + { + TEAK(ItemID.TEAK_SAPLING, ItemID.LIMPWURT_ROOT, 15), + MAHOGANY(ItemID.MAHOGANY_SAPLING, ItemID.YANILLIAN_HOPS, 25); + + final int hardwoodTreeSaplingId; + final int protectionItemId; + final int protectionItemQuantity; + + HardwoodTreeSapling(int hardwoodTreeSaplingId, int protectionItemId, int protectionItemQuantity) + { + this.hardwoodTreeSaplingId = hardwoodTreeSaplingId; + this.protectionItemId = protectionItemId; + this.protectionItemQuantity = protectionItemQuantity; + } + + @Override + public String getConfigKey() + { + return "hardwoodTreeSaplings"; + } + + @Override + public int getPlantableItemId() + { + return hardwoodTreeSaplingId; + } + + @Override + public int getProtectionItemId() + { + return protectionItemId; + } + + @Override + public int getProtectionItemQuantity() + { + return protectionItemQuantity; + } + + @Override + public ConfigEnum getDefault() + { + return HardwoodTreeSapling.TEAK; + } + } + + public enum GracefulOrFarming + { + NONE(), + GRACEFUL(), + FARMING(); + } + + public enum PayOrCut + { + PAY(), + DIG(); + } + + public enum PayOrCompost + { + PAY(), + COMPOST(), + NEITHER(); + } +} + diff --git a/src/main/java/com/questhelper/helpers/mischelpers/herbrun/FarmingWorld.java b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/FarmingWorld.java similarity index 98% rename from src/main/java/com/questhelper/helpers/mischelpers/herbrun/FarmingWorld.java rename to src/main/java/com/questhelper/helpers/mischelpers/farmruns/FarmingWorld.java index 33d7ccb546..fcbc95093c 100644 --- a/src/main/java/com/questhelper/helpers/mischelpers/herbrun/FarmingWorld.java +++ b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/FarmingWorld.java @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package com.questhelper.helpers.mischelpers.herbrun; +package com.questhelper.helpers.mischelpers.farmruns; import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; @@ -354,4 +354,11 @@ private void add(FarmingRegion r, int... extraRegions) .add(p); } } + + Collection getRegionsForLocation(WorldPoint location) + { + return this.regions.get(location.getRegionID()).stream() + .filter(region -> region.isInBounds(location)) + .collect(Collectors.toSet()); + } } diff --git a/src/main/java/com/questhelper/helpers/mischelpers/herbrun/HerbRun.java b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/HerbRun.java similarity index 99% rename from src/main/java/com/questhelper/helpers/mischelpers/herbrun/HerbRun.java rename to src/main/java/com/questhelper/helpers/mischelpers/farmruns/HerbRun.java index 39b432d2f1..c637127a54 100644 --- a/src/main/java/com/questhelper/helpers/mischelpers/herbrun/HerbRun.java +++ b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/HerbRun.java @@ -22,7 +22,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package com.questhelper.helpers.mischelpers.herbrun; +package com.questhelper.helpers.mischelpers.farmruns; import com.questhelper.questinfo.HelperConfig; import com.questhelper.collections.ItemCollections; @@ -58,7 +58,6 @@ import net.runelite.client.eventbus.Subscribe; import net.runelite.client.events.ConfigChanged; import net.runelite.client.plugins.timetracking.Tab; -import net.runelite.client.plugins.timetracking.farming.CropState; import net.runelite.client.util.Text; public class HerbRun extends ComplexStateQuestHelper @@ -469,7 +468,7 @@ public void onGameTick(GameTick event) } } seed.setQuantity(seedsNeeded); - compost.quantity(seedsNeeded); + compost.setQuantity(seedsNeeded); } @Override diff --git a/src/main/java/com/questhelper/helpers/mischelpers/herbrun/PatchImplementation.java b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/PatchImplementation.java similarity index 88% rename from src/main/java/com/questhelper/helpers/mischelpers/herbrun/PatchImplementation.java rename to src/main/java/com/questhelper/helpers/mischelpers/farmruns/PatchImplementation.java index 40db4a7aa0..e3325a92fc 100644 --- a/src/main/java/com/questhelper/helpers/mischelpers/herbrun/PatchImplementation.java +++ b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/PatchImplementation.java @@ -22,13 +22,12 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package com.questhelper.helpers.mischelpers.herbrun; +package com.questhelper.helpers.mischelpers.farmruns; import javax.annotation.Nullable; import lombok.Getter; import lombok.RequiredArgsConstructor; import net.runelite.client.plugins.timetracking.Tab; -import net.runelite.client.plugins.timetracking.farming.CropState; import net.runelite.client.plugins.timetracking.farming.Produce; @RequiredArgsConstructor @@ -43,7 +42,7 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 3) { // Belladonna patch[Rake,Inspect,Guide] 7560,7559,7558,7557 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3 - value); } if (value >= 4 && value <= 7) { @@ -68,7 +67,7 @@ PatchState forVarbitValue(int value) if (value >= 15 && value <= 255) { // Belladonna patch[Rake,Inspect,Guide] 7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560,7560 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } return null; } @@ -81,7 +80,7 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 3) { // Mushroom patch[Rake,Inspect,Guide] 8314,8313,8312,8311 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3 - value); } if (value >= 4 && value <= 9) { @@ -106,7 +105,7 @@ PatchState forVarbitValue(int value) if (value >= 26 && value <= 255) { // Mushroom patch[Rake,Inspect,Guide] 8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314,8314 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } return null; } @@ -119,7 +118,7 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 3) { // Hespori patch[Rake,Inspect,Guide] 33722,33723,33724,33725 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3 - value); } if (value >= 4 && value <= 6) { @@ -134,7 +133,7 @@ PatchState forVarbitValue(int value) if (value == 9) { // Hespori patch[Rake,Inspect,Guide] 33722 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } return null; } @@ -147,12 +146,12 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 3) { // Allotment[Rake,Inspect,Guide] 8576,8575,8574,8573 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3 - value); } if (value >= 4 && value <= 5) { // Allotment[Rake,Inspect,Guide] 8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 6 && value <= 9) { @@ -237,7 +236,7 @@ PatchState forVarbitValue(int value) if (value >= 74 && value <= 76) { // Allotment[Rake,Inspect,Guide] 8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 77 && value <= 80) { @@ -247,7 +246,7 @@ PatchState forVarbitValue(int value) if (value >= 81 && value <= 83) { // Allotment[Rake,Inspect,Guide] 8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 84 && value <= 87) { @@ -257,7 +256,7 @@ PatchState forVarbitValue(int value) if (value >= 88 && value <= 90) { // Allotment[Rake,Inspect,Guide] 8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 91 && value <= 94) { @@ -267,7 +266,7 @@ PatchState forVarbitValue(int value) if (value >= 95 && value <= 97) { // Allotment[Rake,Inspect,Guide] 8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 98 && value <= 103) { @@ -277,7 +276,7 @@ PatchState forVarbitValue(int value) if (value >= 104 && value <= 106) { // Allotment[Rake,Inspect,Guide] 8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 107 && value <= 112) { @@ -287,7 +286,7 @@ PatchState forVarbitValue(int value) if (value >= 113 && value <= 115) { // Allotment[Rake,Inspect,Guide] 8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 116 && value <= 123) { @@ -297,7 +296,7 @@ PatchState forVarbitValue(int value) if (value >= 124 && value <= 127) { // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 128 && value <= 134) { @@ -317,7 +316,7 @@ PatchState forVarbitValue(int value) if (value == 141) { // Allotment[Rake,Inspect,Guide] 8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 142 && value <= 144) { @@ -327,7 +326,7 @@ PatchState forVarbitValue(int value) if (value >= 145 && value <= 148) { // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 149 && value <= 151) { @@ -337,7 +336,7 @@ PatchState forVarbitValue(int value) if (value >= 152 && value <= 155) { // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 156 && value <= 158) { @@ -347,7 +346,7 @@ PatchState forVarbitValue(int value) if (value >= 159 && value <= 162) { // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 163 && value <= 167) { @@ -357,7 +356,7 @@ PatchState forVarbitValue(int value) if (value >= 168 && value <= 171) { // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 172 && value <= 176) { @@ -367,7 +366,7 @@ PatchState forVarbitValue(int value) if (value >= 177 && value <= 180) { // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 181 && value <= 187) { @@ -377,7 +376,7 @@ PatchState forVarbitValue(int value) if (value >= 188 && value <= 192) { // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 193 && value <= 195) { @@ -402,7 +401,7 @@ PatchState forVarbitValue(int value) if (value == 205) { // Allotment[Rake,Inspect,Guide] 8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 206 && value <= 208) { @@ -417,7 +416,7 @@ PatchState forVarbitValue(int value) if (value == 212) { // Allotment[Rake,Inspect,Guide] 8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 213 && value <= 215) { @@ -427,7 +426,7 @@ PatchState forVarbitValue(int value) if (value >= 216 && value <= 219) { // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 220 && value <= 222) { @@ -437,7 +436,7 @@ PatchState forVarbitValue(int value) if (value >= 223 && value <= 226) { // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 227 && value <= 231) { @@ -447,7 +446,7 @@ PatchState forVarbitValue(int value) if (value >= 232 && value <= 235) { // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 236 && value <= 240) { @@ -457,7 +456,7 @@ PatchState forVarbitValue(int value) if (value >= 241 && value <= 244) { // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 245 && value <= 251) { @@ -467,7 +466,7 @@ PatchState forVarbitValue(int value) if (value >= 252 && value <= 255) { // Allotment[Rake,Inspect,Guide] 8576,8576,8576,8576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } return null; } @@ -480,7 +479,7 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 3) { // Herb patch[Rake,Inspect,Guide] 8135,8134,8133,8132 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3 - value); } if (value >= 4 && value <= 7) { @@ -565,7 +564,7 @@ PatchState forVarbitValue(int value) if (value >= 60 && value <= 67) { // Herb patch[Rake,Inspect,Guide] 8135,8135,8135,8135,8135,8135,8135,8135 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 68 && value <= 71) { @@ -705,7 +704,7 @@ PatchState forVarbitValue(int value) if (value >= 173 && value <= 191) { // Herb patch[Rake,Inspect,Guide] 8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 192 && value <= 195) { @@ -730,12 +729,12 @@ PatchState forVarbitValue(int value) if (value >= 204 && value <= 219) { // Herb patch[Rake,Inspect,Guide] 8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 221 && value <= 255) { // Herb patch[Rake,Inspect,Guide] 8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135,8135 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } return null; } @@ -748,12 +747,12 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 3) { // Flower Patch[Rake,Inspect,Guide] 7843,7842,7841,7840 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3 - value); } if (value >= 4 && value <= 7) { // Flower Patch[Rake,Inspect,Guide] 7843,7843,7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 8 && value <= 11) { @@ -828,7 +827,7 @@ PatchState forVarbitValue(int value) if (value >= 42 && value <= 71) { // Flower Patch[Rake,Inspect,Guide] 7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 72 && value <= 75) { @@ -838,7 +837,7 @@ PatchState forVarbitValue(int value) if (value == 76) { // Flower Patch[Rake,Inspect,Guide] 7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 77 && value <= 80) { @@ -848,7 +847,7 @@ PatchState forVarbitValue(int value) if (value == 81) { // Flower Patch[Rake,Inspect,Guide] 7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 82 && value <= 85) { @@ -858,7 +857,7 @@ PatchState forVarbitValue(int value) if (value == 86) { // Flower Patch[Rake,Inspect,Guide] 7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 87 && value <= 90) { @@ -868,7 +867,7 @@ PatchState forVarbitValue(int value) if (value == 91) { // Flower Patch[Rake,Inspect,Guide] 7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 92 && value <= 95) { @@ -878,7 +877,7 @@ PatchState forVarbitValue(int value) if (value >= 96 && value <= 100) { // Flower Patch[Rake,Inspect,Guide] 7843,7843,7843,7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 101 && value <= 104) { @@ -888,7 +887,7 @@ PatchState forVarbitValue(int value) if (value >= 105 && value <= 136) { // Flower Patch[Rake,Inspect,Guide] 7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 137 && value <= 139) { @@ -898,7 +897,7 @@ PatchState forVarbitValue(int value) if (value >= 140 && value <= 141) { // Flower Patch[Rake,Inspect,Guide] 7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 142 && value <= 144) { @@ -908,7 +907,7 @@ PatchState forVarbitValue(int value) if (value >= 145 && value <= 146) { // Flower Patch[Rake,Inspect,Guide] 7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 147 && value <= 149) { @@ -918,7 +917,7 @@ PatchState forVarbitValue(int value) if (value >= 150 && value <= 151) { // Flower Patch[Rake,Inspect,Guide] 7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 152 && value <= 154) { @@ -928,7 +927,7 @@ PatchState forVarbitValue(int value) if (value >= 155 && value <= 156) { // Flower Patch[Rake,Inspect,Guide] 7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 157 && value <= 159) { @@ -938,7 +937,7 @@ PatchState forVarbitValue(int value) if (value >= 160 && value <= 165) { // Flower Patch[Rake,Inspect,Guide] 7843,7843,7843,7843,7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 166 && value <= 168) { @@ -948,7 +947,7 @@ PatchState forVarbitValue(int value) if (value >= 169 && value <= 200) { // Flower Patch[Rake,Inspect,Guide] 7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 201 && value <= 204) { @@ -958,7 +957,7 @@ PatchState forVarbitValue(int value) if (value == 205) { // Flower Patch[Rake,Inspect,Guide] 7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 206 && value <= 209) { @@ -968,7 +967,7 @@ PatchState forVarbitValue(int value) if (value == 210) { // Flower Patch[Rake,Inspect,Guide] 7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 211 && value <= 214) { @@ -978,7 +977,7 @@ PatchState forVarbitValue(int value) if (value == 215) { // Flower Patch[Rake,Inspect,Guide] 7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 216 && value <= 219) { @@ -988,7 +987,7 @@ PatchState forVarbitValue(int value) if (value == 220) { // Flower Patch[Rake,Inspect,Guide] 7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 221 && value <= 224) { @@ -998,7 +997,7 @@ PatchState forVarbitValue(int value) if (value >= 225 && value <= 229) { // Flower Patch[Rake,Inspect,Guide] 7843,7843,7843,7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 230 && value <= 233) { @@ -1008,7 +1007,7 @@ PatchState forVarbitValue(int value) if (value >= 234 && value <= 255) { // Flower Patch[Rake,Inspect,Guide] 7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843,7843 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } return null; } @@ -1021,12 +1020,12 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 3) { // Bush Patch[Rake,Inspect,Guide] 7576,7575,7574,7573 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3 - value); } if (value == 4) { // Bush Patch[Rake,Inspect,Guide] 7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 5 && value <= 9) { @@ -1081,7 +1080,7 @@ PatchState forVarbitValue(int value) if (value >= 64 && value <= 69) { // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 70 && value <= 74) { @@ -1091,7 +1090,7 @@ PatchState forVarbitValue(int value) if (value >= 75 && value <= 79) { // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 80 && value <= 85) { @@ -1101,7 +1100,7 @@ PatchState forVarbitValue(int value) if (value >= 86 && value <= 90) { // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 91 && value <= 97) { @@ -1111,7 +1110,7 @@ PatchState forVarbitValue(int value) if (value >= 98 && value <= 102) { // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 103 && value <= 110) { @@ -1121,7 +1120,7 @@ PatchState forVarbitValue(int value) if (value >= 111 && value <= 115) { // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 116 && value <= 123) { @@ -1131,7 +1130,7 @@ PatchState forVarbitValue(int value) if (value >= 124 && value <= 133) { // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576,7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 134 && value <= 138) { @@ -1141,7 +1140,7 @@ PatchState forVarbitValue(int value) if (value >= 139 && value <= 143) { // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 144 && value <= 149) { @@ -1151,7 +1150,7 @@ PatchState forVarbitValue(int value) if (value >= 150 && value <= 154) { // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 155 && value <= 161) { @@ -1161,7 +1160,7 @@ PatchState forVarbitValue(int value) if (value >= 162 && value <= 166) { // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 167 && value <= 174) { @@ -1171,7 +1170,7 @@ PatchState forVarbitValue(int value) if (value >= 175 && value <= 179) { // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 180 && value <= 187) { @@ -1181,7 +1180,7 @@ PatchState forVarbitValue(int value) if (value >= 188 && value <= 196) { // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 197 && value <= 204) { @@ -1211,37 +1210,37 @@ PatchState forVarbitValue(int value) if (value >= 226 && value <= 249) { // Bush Patch[Rake,Inspect,Guide] 7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576,7576 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value == 250) { // Redberry bush[Check-health,Inspect,Guide] 7702 - return new PatchState(Produce.REDBERRIES, CropState.GROWING, Produce.REDBERRIES.getStages() - 1); + return new PatchState(Produce.REDBERRIES, CropState.UNCHECKED, Produce.REDBERRIES.getStages() - 1); } if (value == 251) { // Cadavaberry bush[Check-health,Inspect,Guide] 7592 - return new PatchState(Produce.CADAVABERRIES, CropState.GROWING, Produce.CADAVABERRIES.getStages() - 1); + return new PatchState(Produce.CADAVABERRIES, CropState.UNCHECKED, Produce.CADAVABERRIES.getStages() - 1); } if (value == 252) { // Dwellberry bush[Check-health,Inspect,Guide] 7617 - return new PatchState(Produce.DWELLBERRIES, CropState.GROWING, Produce.DWELLBERRIES.getStages() - 1); + return new PatchState(Produce.DWELLBERRIES, CropState.UNCHECKED, Produce.DWELLBERRIES.getStages() - 1); } if (value == 253) { // Jangerberry bush[Check-health,Inspect,Guide] 7645 - return new PatchState(Produce.JANGERBERRIES, CropState.GROWING, Produce.JANGERBERRIES.getStages() - 1); + return new PatchState(Produce.JANGERBERRIES, CropState.UNCHECKED, Produce.JANGERBERRIES.getStages() - 1); } if (value == 254) { // Whiteberry bush[Check-health,Inspect,Guide] 7726 - return new PatchState(Produce.WHITEBERRIES, CropState.GROWING, Produce.WHITEBERRIES.getStages() - 1); + return new PatchState(Produce.WHITEBERRIES, CropState.UNCHECKED, Produce.WHITEBERRIES.getStages() - 1); } if (value == 255) { // Poison Ivy bush[Check-health,Inspect,Guide] 7675 - return new PatchState(Produce.POISON_IVY, CropState.GROWING, Produce.POISON_IVY.getStages() - 1); + return new PatchState(Produce.POISON_IVY, CropState.UNCHECKED, Produce.POISON_IVY.getStages() - 1); } return null; } @@ -1254,12 +1253,12 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 3) { // Fruit Tree Patch[Rake,Inspect,Guide] 8050,8049,8048,8047 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3 - value); } if (value >= 4 && value <= 7) { // Fruit Tree Patch[Rake,Inspect,Guide] 8050,8050,8050,8050 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 8 && value <= 13) { @@ -1284,12 +1283,12 @@ PatchState forVarbitValue(int value) if (value == 33) { // Apple tree stump[Clear,Inspect,Guide] 7961 - return new PatchState(Produce.APPLE, CropState.HARVESTABLE, 0); + return new PatchState(Produce.APPLE, CropState.STUMP, 0); } if (value == 34) { // Apple tree[Check-health,Inspect,Guide] 7948 - return new PatchState(Produce.APPLE, CropState.GROWING, Produce.APPLE.getStages() - 1); + return new PatchState(Produce.APPLE, CropState.UNCHECKED, Produce.APPLE.getStages() - 1); } if (value >= 35 && value <= 40) { @@ -1314,17 +1313,17 @@ PatchState forVarbitValue(int value) if (value == 60) { // Banana tree stump[Clear,Inspect,Guide] 8019 - return new PatchState(Produce.BANANA, CropState.HARVESTABLE, 0); + return new PatchState(Produce.BANANA, CropState.STUMP, 0); } if (value == 61) { // Banana tree[Check-health,Inspect,Guide] 7999 - return new PatchState(Produce.BANANA, CropState.GROWING, Produce.BANANA.getStages() - 1); + return new PatchState(Produce.BANANA, CropState.UNCHECKED, Produce.BANANA.getStages() - 1); } if (value >= 62 && value <= 71) { // Fruit Tree Patch[Rake,Inspect,Guide] 8050,8050,8050,8050,8050,8050,8050,8050,8050,8050 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 72 && value <= 77) { @@ -1354,12 +1353,12 @@ PatchState forVarbitValue(int value) if (value == 97) { // Orange tree stump[Clear,Inspect,Guide] 8077 - return new PatchState(Produce.ORANGE, CropState.HARVESTABLE, 0); + return new PatchState(Produce.ORANGE, CropState.STUMP, 0); } if (value == 98) { // Orange tree[Check-health,Inspect,Guide] 8064 - return new PatchState(Produce.ORANGE, CropState.GROWING, Produce.ORANGE.getStages() - 1); + return new PatchState(Produce.ORANGE, CropState.UNCHECKED, Produce.ORANGE.getStages() - 1); } if (value >= 99 && value <= 104) { @@ -1384,17 +1383,17 @@ PatchState forVarbitValue(int value) if (value == 124) { // Curry tree stump[Clear,Inspect,Guide] 8046 - return new PatchState(Produce.CURRY, CropState.HARVESTABLE, 0); + return new PatchState(Produce.CURRY, CropState.STUMP, 0); } if (value == 125) { // Curry tree[Check-health,Inspect,Guide] 8033 - return new PatchState(Produce.CURRY, CropState.GROWING, Produce.CURRY.getStages() - 1); + return new PatchState(Produce.CURRY, CropState.UNCHECKED, Produce.CURRY.getStages() - 1); } if (value >= 126 && value <= 135) { // Fruit Tree Patch[Rake,Inspect,Guide] 8050,8050,8050,8050,8050,8050,8050,8050,8050,8050 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 136 && value <= 141) { @@ -1419,12 +1418,12 @@ PatchState forVarbitValue(int value) if (value == 161) { // Pineapple plant stump[Clear,Inspect,Guide] 7992 - return new PatchState(Produce.PINEAPPLE, CropState.HARVESTABLE, 0); + return new PatchState(Produce.PINEAPPLE, CropState.STUMP, 0); } if (value == 162) { // Pineapple plant[Check-health,Inspect,Guide] 7979 - return new PatchState(Produce.PINEAPPLE, CropState.GROWING, Produce.PINEAPPLE.getStages() - 1); + return new PatchState(Produce.PINEAPPLE, CropState.UNCHECKED, Produce.PINEAPPLE.getStages() - 1); } if (value >= 163 && value <= 168) { @@ -1449,17 +1448,17 @@ PatchState forVarbitValue(int value) if (value == 188) { // Papaya tree stump[Clear,Inspect,Guide] 8131 - return new PatchState(Produce.PAPAYA, CropState.HARVESTABLE, 0); + return new PatchState(Produce.PAPAYA, CropState.STUMP, 0); } if (value == 189) { // Papaya tree[Check-health,Inspect,Guide] 8118 - return new PatchState(Produce.PAPAYA, CropState.GROWING, Produce.PAPAYA.getStages() - 1); + return new PatchState(Produce.PAPAYA, CropState.UNCHECKED, Produce.PAPAYA.getStages() - 1); } if (value >= 190 && value <= 199) { // Fruit Tree Patch[Rake,Inspect,Guide] 8050,8050,8050,8050,8050,8050,8050,8050,8050,8050 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 200 && value <= 205) { @@ -1484,12 +1483,12 @@ PatchState forVarbitValue(int value) if (value == 225) { // Palm tree stump[Clear,Inspect,Guide] 8104 - return new PatchState(Produce.PALM, CropState.HARVESTABLE, 0); + return new PatchState(Produce.PALM, CropState.STUMP, 0); } if (value == 226) { // Palm tree[Check-health,Inspect,Guide] 8091 - return new PatchState(Produce.PALM, CropState.GROWING, Produce.PALM.getStages() - 1); + return new PatchState(Produce.PALM, CropState.UNCHECKED, Produce.PALM.getStages() - 1); } if (value >= 227 && value <= 232) { @@ -1514,17 +1513,17 @@ PatchState forVarbitValue(int value) if (value == 252) { // Dragonfruit tree stump[Clear,Inspect,Guide] 34034 - return new PatchState(Produce.DRAGONFRUIT, CropState.HARVESTABLE, 0); + return new PatchState(Produce.DRAGONFRUIT, CropState.STUMP, 0); } if (value == 253) { // Dragonfruit tree[Check-health,Inspect,Guide] 34021 - return new PatchState(Produce.DRAGONFRUIT, CropState.GROWING, Produce.DRAGONFRUIT.getStages() - 1); + return new PatchState(Produce.DRAGONFRUIT, CropState.UNCHECKED, Produce.DRAGONFRUIT.getStages() - 1); } if (value >= 254 && value <= 255) { // Fruit Tree Patch[Rake,Inspect,Guide] 8050,8050 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } return null; } @@ -1537,7 +1536,7 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 3) { // Hops Patch[Rake,Inspect,Guide] 8210,8209,8208,8207 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3 - value); } if (value >= 4 && value <= 7) { @@ -1612,7 +1611,7 @@ PatchState forVarbitValue(int value) if (value >= 64 && value <= 67) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 68 && value <= 71) { @@ -1622,7 +1621,7 @@ PatchState forVarbitValue(int value) if (value >= 72 && value <= 74) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 75 && value <= 79) { @@ -1632,7 +1631,7 @@ PatchState forVarbitValue(int value) if (value >= 80 && value <= 82) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 83 && value <= 88) { @@ -1642,7 +1641,7 @@ PatchState forVarbitValue(int value) if (value >= 89 && value <= 91) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 92 && value <= 98) { @@ -1652,7 +1651,7 @@ PatchState forVarbitValue(int value) if (value >= 99 && value <= 101) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 102 && value <= 109) { @@ -1662,7 +1661,7 @@ PatchState forVarbitValue(int value) if (value >= 110 && value <= 112) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 113 && value <= 116) { @@ -1672,7 +1671,7 @@ PatchState forVarbitValue(int value) if (value >= 117 && value <= 119) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 120 && value <= 124) { @@ -1682,7 +1681,7 @@ PatchState forVarbitValue(int value) if (value >= 125 && value <= 132) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210,8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 133 && value <= 135) { @@ -1692,7 +1691,7 @@ PatchState forVarbitValue(int value) if (value >= 136 && value <= 139) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 140 && value <= 143) { @@ -1702,7 +1701,7 @@ PatchState forVarbitValue(int value) if (value >= 144 && value <= 147) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 148 && value <= 152) { @@ -1712,7 +1711,7 @@ PatchState forVarbitValue(int value) if (value >= 153 && value <= 156) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 157 && value <= 162) { @@ -1722,7 +1721,7 @@ PatchState forVarbitValue(int value) if (value >= 163 && value <= 166) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 167 && value <= 173) { @@ -1732,7 +1731,7 @@ PatchState forVarbitValue(int value) if (value >= 174 && value <= 177) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 178 && value <= 180) { @@ -1742,12 +1741,12 @@ PatchState forVarbitValue(int value) if (value == 181) { // Hops Patch[Rake,Inspect,Guide] 8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 183 && value <= 184) { // Hops Patch[Rake,Inspect,Guide] 8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 185 && value <= 188) { @@ -1757,7 +1756,7 @@ PatchState forVarbitValue(int value) if (value >= 189 && value <= 196) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210,8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 197 && value <= 199) { @@ -1767,7 +1766,7 @@ PatchState forVarbitValue(int value) if (value >= 200 && value <= 203) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 204 && value <= 207) { @@ -1777,7 +1776,7 @@ PatchState forVarbitValue(int value) if (value >= 208 && value <= 211) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 212 && value <= 216) { @@ -1787,7 +1786,7 @@ PatchState forVarbitValue(int value) if (value >= 217 && value <= 220) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 221 && value <= 226) { @@ -1797,7 +1796,7 @@ PatchState forVarbitValue(int value) if (value >= 227 && value <= 230) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 231 && value <= 237) { @@ -1807,7 +1806,7 @@ PatchState forVarbitValue(int value) if (value >= 238 && value <= 241) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 242 && value <= 244) { @@ -1817,7 +1816,7 @@ PatchState forVarbitValue(int value) if (value >= 245 && value <= 248) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 249 && value <= 252) { @@ -1827,7 +1826,7 @@ PatchState forVarbitValue(int value) if (value >= 253 && value <= 255) { // Hops Patch[Rake,Inspect,Guide] 8210,8210,8210 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } return null; } @@ -1840,12 +1839,12 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 3) { // Tree patch[Rake,Inspect,Guide] 8395,8394,8393,8392 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3 - value); } if (value >= 4 && value <= 7) { // Tree patch[Rake,Inspect,Guide] 8395,8395,8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 8 && value <= 11) { @@ -1855,7 +1854,7 @@ PatchState forVarbitValue(int value) if (value == 12) { // Oak[Check-health,Inspect,Guide] 8466 - return new PatchState(Produce.OAK, CropState.GROWING, Produce.OAK.getStages() - 1); + return new PatchState(Produce.OAK, CropState.UNCHECKED, Produce.OAK.getStages() - 1); } if (value == 13) { @@ -1865,7 +1864,7 @@ PatchState forVarbitValue(int value) if (value == 14) { // Oak tree stump[Clear,Inspect,Guide] 8468 - return new PatchState(Produce.OAK, CropState.HARVESTABLE, 0); + return new PatchState(Produce.OAK, CropState.STUMP, 0); } if (value >= 15 && value <= 20) { @@ -1875,7 +1874,7 @@ PatchState forVarbitValue(int value) if (value == 21) { // Willow Tree[Check-health,Inspect,Guide] 8487 - return new PatchState(Produce.WILLOW, CropState.GROWING, Produce.WILLOW.getStages() - 1); + return new PatchState(Produce.WILLOW, CropState.UNCHECKED, Produce.WILLOW.getStages() - 1); } if (value == 22) { @@ -1885,7 +1884,7 @@ PatchState forVarbitValue(int value) if (value == 23) { // Willow tree stump[Clear,Inspect,Guide] 8489 - return new PatchState(Produce.WILLOW, CropState.HARVESTABLE, 0); + return new PatchState(Produce.WILLOW, CropState.STUMP, 0); } if (value >= 24 && value <= 31) { @@ -1895,7 +1894,7 @@ PatchState forVarbitValue(int value) if (value == 32) { // Maple Tree[Check-health,Inspect,Guide] 8443 - return new PatchState(Produce.MAPLE, CropState.GROWING, Produce.MAPLE.getStages() - 1); + return new PatchState(Produce.MAPLE, CropState.UNCHECKED, Produce.MAPLE.getStages() - 1); } if (value == 33) { @@ -1905,7 +1904,7 @@ PatchState forVarbitValue(int value) if (value == 34) { // Tree stump[Clear,Inspect,Guide] 8445 - return new PatchState(Produce.MAPLE, CropState.HARVESTABLE, 0); + return new PatchState(Produce.MAPLE, CropState.STUMP, 0); } if (value >= 35 && value <= 44) { @@ -1915,7 +1914,7 @@ PatchState forVarbitValue(int value) if (value == 45) { // Yew tree[Check-health,Inspect,Guide] 8512 - return new PatchState(Produce.YEW, CropState.GROWING, Produce.YEW.getStages() - 1); + return new PatchState(Produce.YEW, CropState.UNCHECKED, Produce.YEW.getStages() - 1); } if (value == 46) { @@ -1925,7 +1924,7 @@ PatchState forVarbitValue(int value) if (value == 47) { // Yew tree stump[Clear,Inspect,Guide] 8514 - return new PatchState(Produce.YEW, CropState.HARVESTABLE, 0); + return new PatchState(Produce.YEW, CropState.STUMP, 0); } if (value >= 48 && value <= 59) { @@ -1935,7 +1934,7 @@ PatchState forVarbitValue(int value) if (value == 60) { // Magic Tree[Check-health,Inspect,Guide] 8408 - return new PatchState(Produce.MAGIC, CropState.GROWING, Produce.MAGIC.getStages() - 1); + return new PatchState(Produce.MAGIC, CropState.UNCHECKED, Produce.MAGIC.getStages() - 1); } if (value == 61) { @@ -1945,12 +1944,12 @@ PatchState forVarbitValue(int value) if (value == 62) { // Magic Tree Stump[Clear,Inspect,Guide] 8410 - return new PatchState(Produce.MAGIC, CropState.HARVESTABLE, 0); + return new PatchState(Produce.MAGIC, CropState.STUMP, 0); } if (value >= 63 && value <= 72) { // Tree patch[Rake,Inspect,Guide] 8395,8395,8395,8395,8395,8395,8395,8395,8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 73 && value <= 75) { @@ -1965,7 +1964,7 @@ PatchState forVarbitValue(int value) if (value >= 78 && value <= 79) { // Tree patch[Rake,Inspect,Guide] 8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 80 && value <= 84) { @@ -1980,7 +1979,7 @@ PatchState forVarbitValue(int value) if (value >= 87 && value <= 88) { // Tree patch[Rake,Inspect,Guide] 8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 89 && value <= 95) { @@ -1995,7 +1994,7 @@ PatchState forVarbitValue(int value) if (value >= 98 && value <= 99) { // Tree patch[Rake,Inspect,Guide] 8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 100 && value <= 108) { @@ -2010,7 +2009,7 @@ PatchState forVarbitValue(int value) if (value >= 111 && value <= 112) { // Tree patch[Rake,Inspect,Guide] 8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 113 && value <= 123) { @@ -2025,7 +2024,7 @@ PatchState forVarbitValue(int value) if (value >= 126 && value <= 136) { // Tree patch[Rake,Inspect,Guide] 8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 137 && value <= 139) { @@ -2040,7 +2039,7 @@ PatchState forVarbitValue(int value) if (value >= 142 && value <= 143) { // Tree patch[Rake,Inspect,Guide] 8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 144 && value <= 148) { @@ -2055,7 +2054,7 @@ PatchState forVarbitValue(int value) if (value >= 151 && value <= 152) { // Tree patch[Rake,Inspect,Guide] 8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 153 && value <= 159) { @@ -2070,7 +2069,7 @@ PatchState forVarbitValue(int value) if (value >= 162 && value <= 163) { // Tree patch[Rake,Inspect,Guide] 8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 164 && value <= 172) { @@ -2085,7 +2084,7 @@ PatchState forVarbitValue(int value) if (value >= 175 && value <= 176) { // Tree patch[Rake,Inspect,Guide] 8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 177 && value <= 187) { @@ -2100,7 +2099,7 @@ PatchState forVarbitValue(int value) if (value >= 190 && value <= 191) { // Tree patch[Rake,Inspect,Guide] 8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 192 && value <= 197) { @@ -2110,7 +2109,7 @@ PatchState forVarbitValue(int value) if (value >= 198 && value <= 255) { // Tree patch[Rake,Inspect,Guide] 8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395,8395 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } return null; } @@ -2123,12 +2122,12 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 3) { // Tree patch[Rake,Inspect,Guide] 30479,30478,30477,30476 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3 - value); } if (value >= 4 && value <= 7) { // Tree patch[Rake,Inspect,Guide] 30479,30479,30479,30479 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 8 && value <= 14) { @@ -2138,7 +2137,7 @@ PatchState forVarbitValue(int value) if (value == 15) { // Teak Tree[Check-health,Inspect,Guide] 30444 - return new PatchState(Produce.TEAK, CropState.GROWING, Produce.TEAK.getStages() - 1); + return new PatchState(Produce.TEAK, CropState.UNCHECKED, Produce.TEAK.getStages() - 1); } if (value == 16) { @@ -2148,7 +2147,7 @@ PatchState forVarbitValue(int value) if (value == 17) { // Tree stump[Clear,Inspect,Guide] 30446 - return new PatchState(Produce.TEAK, CropState.HARVESTABLE, 0); + return new PatchState(Produce.TEAK, CropState.STUMP, 0); } if (value >= 18 && value <= 23) { @@ -2168,7 +2167,7 @@ PatchState forVarbitValue(int value) if (value == 38) { // Mahogany tree[Check-health,Inspect,Guide] 30416 - return new PatchState(Produce.MAHOGANY, CropState.GROWING, Produce.MAHOGANY.getStages() - 1); + return new PatchState(Produce.MAHOGANY, CropState.UNCHECKED, Produce.MAHOGANY.getStages() - 1); } if (value == 39) { @@ -2178,7 +2177,7 @@ PatchState forVarbitValue(int value) if (value == 40) { // Mahogany tree stump[Clear,Inspect,Guide] 30418 - return new PatchState(Produce.MAHOGANY, CropState.HARVESTABLE, 0); + return new PatchState(Produce.MAHOGANY, CropState.STUMP, 0); } if (value >= 41 && value <= 47) { @@ -2193,7 +2192,7 @@ PatchState forVarbitValue(int value) if (value >= 55 && value <= 255) { // Tree patch[Rake,Inspect,Guide] 30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479,30479 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } return null; } @@ -2206,12 +2205,12 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 3) { // Redwood tree patch[Rake,Inspect,Guide] 34050,34049,34048,34047 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3 - value); } if (value >= 4 && value <= 7) { // Redwood tree patch[Rake,Inspect,Guide] 34050,34050,34050,34050 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 8 && value <= 17) { @@ -2236,7 +2235,7 @@ PatchState forVarbitValue(int value) if (value == 37) { // Redwood tree[Check-health,Inspect,Guide] 34297 - return new PatchState(Produce.REDWOOD, CropState.GROWING, Produce.REDWOOD.getStages() - 1); + return new PatchState(Produce.REDWOOD, CropState.UNCHECKED, Produce.REDWOOD.getStages() - 1); } if (value >= 41 && value <= 55) { @@ -2254,12 +2253,12 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 3) { // Spirit Tree Patch[Rake,Inspect,Guide] 8342,8341,8340,8339 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3 - value); } if (value >= 4 && value <= 7) { // Spirit Tree Patch[Rake,Inspect,Guide] 8342,8342,8342,8342 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 8 && value <= 19) { @@ -2284,12 +2283,12 @@ PatchState forVarbitValue(int value) if (value == 44) { // Spirit Tree[Check-health,Inspect,Guide] 8356 - return new PatchState(Produce.SPIRIT_TREE, CropState.GROWING, Produce.SPIRIT_TREE.getStages() - 1); + return new PatchState(Produce.SPIRIT_TREE, CropState.UNCHECKED, Produce.SPIRIT_TREE.getStages() - 1); } if (value >= 45 && value <= 63) { // Spirit Tree Patch[Rake,Inspect,Guide] 8342,8342,8342,8342,8342,8342,8342,8342,8342,8342,8342,8342,8342,8342,8342,8342,8342,8342,8342 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } return null; } @@ -2302,12 +2301,12 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 3) { // Anima patch[Rake,Inspect,Guide] 33983,33982,33981,33980 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3 - value); } if (value >= 4 && value <= 7) { // Anima patch[Rake,Inspect,Guide] 33983,33983,33983,33983 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 8 && value <= 16) { @@ -2336,7 +2335,7 @@ PatchState forVarbitValue(int value) if (value >= 35 && value <= 255) { // Anima patch[Rake,Inspect,Guide] 33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983,33983 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } return null; } @@ -2349,12 +2348,12 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 3) { // Cactus patch[Rake,Inspect,Guide] 7746,7745,7744,7743 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3 - value); } if (value >= 4 && value <= 7) { // Cactus patch[Rake,Inspect,Guide] 7746,7746,7746,7746 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 8 && value <= 14) { @@ -2379,7 +2378,7 @@ PatchState forVarbitValue(int value) if (value == 31) { // Cactus[Check-health,Inspect,Guide] 7758 - return new PatchState(Produce.CACTUS, CropState.GROWING, Produce.CACTUS.getStages() - 1); + return new PatchState(Produce.CACTUS, CropState.UNCHECKED, Produce.CACTUS.getStages() - 1); } if (value >= 32 && value <= 38) { @@ -2404,12 +2403,12 @@ PatchState forVarbitValue(int value) if (value == 58) { // Potato cactus[Check-health,Inspect,Guide] 33748 - return new PatchState(Produce.POTATO_CACTUS, CropState.GROWING, Produce.POTATO_CACTUS.getStages() - 1); + return new PatchState(Produce.POTATO_CACTUS, CropState.UNCHECKED, Produce.POTATO_CACTUS.getStages() - 1); } if (value >= 59 && value <= 255) { // Cactus patch[Rake,Inspect,Guide] 7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746,7746 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } return null; } @@ -2422,7 +2421,7 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 3) { // Seaweed patch[Rake,Inspect,Guide] 30486,30485,30484,30483 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3 - value); } if (value >= 4 && value <= 7) { @@ -2447,7 +2446,7 @@ PatchState forVarbitValue(int value) if (value >= 17 && value <= 255) { // Seaweed patch[Rake,Inspect,Guide] 30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486,30486 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } return null; } @@ -2460,7 +2459,7 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 3) { // Calquat patch[Rake,Inspect,Guide] 7775,7774,7773,7772 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3 - value); } if (value >= 4 && value <= 11) { @@ -2485,12 +2484,12 @@ PatchState forVarbitValue(int value) if (value == 34) { // Calquat Tree[Check-health,Inspect,Guide] 7791 - return new PatchState(Produce.CALQUAT, CropState.GROWING, Produce.CALQUAT.getStages() - 1); + return new PatchState(Produce.CALQUAT, CropState.UNCHECKED, Produce.CALQUAT.getStages() - 1); } if (value >= 35 && value <= 255) { // Calquat patch[Rake,Inspect,Guide] 7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775,7775 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } return null; } @@ -2503,12 +2502,12 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 3) { // Celastrus patch[Rake,Inspect,Guide] 33698,33697,33696,33695 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3 - value); } if (value >= 4 && value <= 7) { // Celastrus patch[Rake,Inspect,Guide] 33698,33698,33698,33698 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 8 && value <= 12) { @@ -2518,7 +2517,7 @@ PatchState forVarbitValue(int value) if (value == 13) { // Celastrus tree[Check-health,Inspect,Guide] 33704 - return new PatchState(Produce.CELASTRUS, CropState.GROWING, Produce.CELASTRUS.getStages() - 1); + return new PatchState(Produce.CELASTRUS, CropState.UNCHECKED, Produce.CELASTRUS.getStages() - 1); } if (value >= 14 && value <= 16) { @@ -2543,12 +2542,12 @@ PatchState forVarbitValue(int value) if (value == 28) { // Celastrus tree stump[Clear,Inspect,Guide] 33721 - return new PatchState(Produce.CELASTRUS, CropState.HARVESTABLE, 0); + return new PatchState(Produce.CELASTRUS, CropState.STUMP, 0); } if (value >= 29 && value <= 255) { // Celastrus patch[Rake,Inspect,Guide] 33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698,33698 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } return null; } @@ -2561,7 +2560,7 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 1) { // Empty, empty+fertilizer - return new PatchState(Produce.WEEDS, CropState.GROWING, 3); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3); } if (value >= 2 && value <= 9) { @@ -2586,7 +2585,7 @@ PatchState forVarbitValue(int value) if (value >= 0 && value <= 3) { // Crystal tree patch[Rake,Inspect,Guide] 34910,34909,34908,34907 - return new PatchState(Produce.WEEDS, CropState.GROWING, 3 - value); + return new PatchState(Produce.WEEDS, CropState.EMPTY, 3 - value); } if (value >= 8 && value <= 13) { @@ -2596,7 +2595,7 @@ PatchState forVarbitValue(int value) if (value == 14) { // Crystal tree[Check-health,Inspect,Guide] 34917 - return new PatchState(Produce.CRYSTAL_TREE, CropState.GROWING, Produce.CRYSTAL_TREE.getStages() - 1); + return new PatchState(Produce.CRYSTAL_TREE, CropState.UNCHECKED, Produce.CRYSTAL_TREE.getStages() - 1); } if (value == 15) { diff --git a/src/main/java/com/questhelper/helpers/mischelpers/herbrun/PatchPrediction.java b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/PatchPrediction.java similarity index 93% rename from src/main/java/com/questhelper/helpers/mischelpers/herbrun/PatchPrediction.java rename to src/main/java/com/questhelper/helpers/mischelpers/farmruns/PatchPrediction.java index e0fc91b8f2..383b18d0f3 100644 --- a/src/main/java/com/questhelper/helpers/mischelpers/herbrun/PatchPrediction.java +++ b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/PatchPrediction.java @@ -22,11 +22,10 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package com.questhelper.helpers.mischelpers.herbrun; +package com.questhelper.helpers.mischelpers.farmruns; import lombok.Value; -import net.runelite.client.plugins.timetracking.farming.CropState; import net.runelite.client.plugins.timetracking.farming.Produce; @Value diff --git a/src/main/java/com/questhelper/helpers/mischelpers/herbrun/PatchState.java b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/PatchState.java similarity index 94% rename from src/main/java/com/questhelper/helpers/mischelpers/herbrun/PatchState.java rename to src/main/java/com/questhelper/helpers/mischelpers/farmruns/PatchState.java index c88c534f09..ff35593291 100644 --- a/src/main/java/com/questhelper/helpers/mischelpers/herbrun/PatchState.java +++ b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/PatchState.java @@ -22,10 +22,9 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package com.questhelper.helpers.mischelpers.herbrun; +package com.questhelper.helpers.mischelpers.farmruns; import lombok.Value; -import net.runelite.client.plugins.timetracking.farming.CropState; import net.runelite.client.plugins.timetracking.farming.Produce; @Value class PatchState diff --git a/src/main/java/com/questhelper/helpers/mischelpers/farmruns/PatchStates.java b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/PatchStates.java new file mode 100644 index 0000000000..f9dded0113 --- /dev/null +++ b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/PatchStates.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2024, Zoinkwiz + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.questhelper.helpers.mischelpers.farmruns; + +import com.questhelper.requirements.ManualRequirement; +import com.questhelper.requirements.Requirement; +import lombok.Getter; +import net.runelite.api.Client; + +@Getter +public class PatchStates +{ + private final String regionName; + private final String patchName; + private final ManualRequirement isHarvestable = new ManualRequirement(); + private final ManualRequirement isEmpty = new ManualRequirement(); + private final ManualRequirement isUnchecked = new ManualRequirement(); + private final ManualRequirement isStump = new ManualRequirement(); + private final ManualRequirement isProtected = new ManualRequirement(); + private final ManualRequirement isGrowing = new ManualRequirement(); + private final Requirement requirement; + + public PatchStates(String regionName) + { + this.regionName = regionName; + this.patchName = null; + this.requirement = null; + } + + public PatchStates(String regionName, String patchName) + { + this.regionName = regionName; + this.patchName = patchName; + this.requirement = null; + } + + public PatchStates(String regionName, Requirement requirement) + { + this.regionName = regionName; + this.patchName = null; + this.requirement = requirement; + } + + public boolean canAccess(Client client) + { + if (requirement == null) return true; + return requirement.check(client); + } +} diff --git a/src/main/java/com/questhelper/helpers/mischelpers/farmruns/PaymentTracker.java b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/PaymentTracker.java new file mode 100644 index 0000000000..320da5dd44 --- /dev/null +++ b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/PaymentTracker.java @@ -0,0 +1,196 @@ +/* + * Copyright (c) 2022, Adam + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.questhelper.helpers.mischelpers.farmruns; + +import com.google.common.collect.ImmutableSet; +import java.util.Set; +import javax.inject.Inject; +import javax.inject.Singleton; +import lombok.AccessLevel; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import net.runelite.api.Client; +import net.runelite.api.MenuAction; +import net.runelite.api.ScriptID; +import net.runelite.api.events.GameTick; +import net.runelite.api.events.MenuOptionClicked; +import net.runelite.api.events.ScriptPreFired; +import net.runelite.api.widgets.ComponentID; +import net.runelite.api.widgets.Widget; +import net.runelite.api.widgets.WidgetModelType; +import net.runelite.client.config.ConfigManager; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.plugins.timetracking.TimeTrackingConfig; + +@Slf4j +@RequiredArgsConstructor( + access = AccessLevel.PRIVATE, + onConstructor = @__({@Inject}) +) +@Singleton +public class PaymentTracker +{ + private static final Set PAYMENT_TEXT = ImmutableSet.of( + "That'll do nicely, sir. Leave it with me - I'll make sure
that patch grows for you.", + "That'll do nicely, madam. Leave it with me - I'll make
sure that patch grows for you.", + "That'll do nicely, iknami. Leave it with me - I'll make
sure that patch grows for you.", + "I'm already looking after that patch for you." + ); + + private final Client client; + private final ConfigManager configManager; + private final FarmingWorld farmingWorld; + + private int lastSelectedOption; + + @Subscribe + public void onGameTick(GameTick gameTick) + { + Widget text = client.getWidget(ComponentID.DIALOG_NPC_TEXT); + if (text == null || !PAYMENT_TEXT.contains(text.getText())) + { + return; + } + + Widget name = client.getWidget(ComponentID.DIALOG_NPC_NAME); + Widget head = client.getWidget(ComponentID.DIALOG_NPC_HEAD_MODEL); + if (name == null || head == null || head.getModelType() != WidgetModelType.NPC_CHATHEAD) + { + return; + } + + final int npcId = head.getModelId(); + final FarmingPatch patch = findPatchForNpc(npcId); + if (patch == null) + { + return; + } + + if (getProtectedState(patch)) + { + return; + } + + log.debug("Detected patch payment for {} ({}) patch {}", name.getText(), npcId, patch); + setProtectedState(patch, true); + } + + @Subscribe + public void onMenuOptionClicked(MenuOptionClicked opt) + { + var action = opt.getMenuAction(); + // look for resume_pausebutton from click + if (action == MenuAction.WIDGET_CONTINUE) + { + var w = opt.getWidget(); + if (w != null && w.getId() == ComponentID.DIALOG_OPTION_OPTIONS && w.getIndex() > -1 && isPatchOption(w.getText())) + { + lastSelectedOption = w.getIndex() - 1; // subid 0 is "Select an Option" + log.debug("Selected option via click: {}", lastSelectedOption); + } + } + // look for selecting the Pay NPC option + else if ((action == MenuAction.NPC_THIRD_OPTION || action == MenuAction.NPC_FOURTH_OPTION) && opt.getMenuOption().startsWith("Pay")) + { + lastSelectedOption = action == MenuAction.NPC_THIRD_OPTION ? 0 : 1; + log.debug("Selected option via npc op: {}", lastSelectedOption); + } + } + + @Subscribe + public void onScriptPreFired(ScriptPreFired scriptPreFired) + { + // look for resume_pausebutton from keypress + if (scriptPreFired.getScriptId() == ScriptID.CHATBOX_KEYINPUT_MATCHED) + { + int[] intStack = client.getIntStack(); + + int componentId = intStack[0]; + int subId = intStack[1]; + + var w = client.getWidget(componentId).getChild(subId); + if (componentId == ComponentID.DIALOG_OPTION_OPTIONS && subId > -1 && isPatchOption(w.getText())) + { + lastSelectedOption = subId - 1; // subid 0 is "Select an Option" + log.debug("Selected option via keypress: {}", lastSelectedOption); + } + } + } + + private static boolean isPatchOption(String name) + { + if (name == null) + { + return false; + } + + return name.contains("Patch") || name.contains("allotment"); + } + + private static String configKey(FarmingPatch fp) + { + return fp.configKey() + "." + TimeTrackingConfig.PROTECTED; + } + + void setProtectedState(FarmingPatch fp, boolean state) + { + if (!state) + { + configManager.unsetRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, configKey(fp)); + } + else + { + configManager.setRSProfileConfiguration(TimeTrackingConfig.CONFIG_GROUP, configKey(fp), state); + } + } + + boolean getProtectedState(FarmingPatch fp) + { + return Boolean.TRUE.equals(configManager.getRSProfileConfiguration( + TimeTrackingConfig.CONFIG_GROUP, + configKey(fp), + Boolean.class)); + } + + private FarmingPatch findPatchForNpc(int npcId) + { + FarmingPatch p = null; + for (FarmingRegion region : farmingWorld.getRegionsForLocation(client.getLocalPlayer().getWorldLocation())) + { + for (FarmingPatch patch : region.getPatches()) + { + if (patch.getFarmer() == npcId) + { + // lastSelectedOption is only valid when interacting with multi-patch farmers. + if (patch.getPatchNumber() == -1 || patch.getPatchNumber() == lastSelectedOption) + { + p = patch; + } + } + } + } + return p; + } +} diff --git a/src/main/java/com/questhelper/helpers/mischelpers/farmruns/TreeRun.java b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/TreeRun.java new file mode 100644 index 0000000000..7d7c5c93ba --- /dev/null +++ b/src/main/java/com/questhelper/helpers/mischelpers/farmruns/TreeRun.java @@ -0,0 +1,1010 @@ +/* + * Copyright (c) 2024, Zoinkwiz + * Copyright (c) 2024, Kerpackie + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package com.questhelper.helpers.mischelpers.farmruns; + +import com.google.inject.Inject; +import com.questhelper.QuestHelperConfig; +import com.questhelper.collections.ItemCollections; +import com.questhelper.helpers.mischelpers.farmruns.FarmingUtils.FruitTreeSapling; +import com.questhelper.helpers.mischelpers.farmruns.FarmingUtils.GracefulOrFarming; +import com.questhelper.helpers.mischelpers.farmruns.FarmingUtils.HardwoodTreeSapling; +import com.questhelper.helpers.mischelpers.farmruns.FarmingUtils.TreeSapling; +import com.questhelper.helpers.mischelpers.farmruns.FarmingUtils.PayOrCut; +import com.questhelper.helpers.mischelpers.farmruns.FarmingUtils.PayOrCompost; +import com.questhelper.panel.PanelDetails; +import com.questhelper.questhelpers.ComplexStateQuestHelper; +import com.questhelper.questinfo.HelperConfig; +import com.questhelper.questinfo.QuestHelperQuest; +import com.questhelper.requirements.Requirement; +import com.questhelper.requirements.conditional.Conditions; +import com.questhelper.requirements.item.ItemRequirement; +import com.questhelper.requirements.item.ItemRequirements; +import com.questhelper.requirements.player.SkillRequirement; +import com.questhelper.requirements.quest.QuestRequirement; +import com.questhelper.requirements.runelite.RuneliteRequirement; +import static com.questhelper.requirements.util.LogicHelper.and; +import static com.questhelper.requirements.util.LogicHelper.nor; +import static com.questhelper.requirements.util.LogicHelper.or; +import com.questhelper.requirements.util.LogicType; +import com.questhelper.requirements.var.VarbitRequirement; +import com.questhelper.steps.ConditionalStep; +import com.questhelper.steps.DetailedQuestStep; +import com.questhelper.steps.NpcStep; +import com.questhelper.steps.ObjectStep; +import com.questhelper.steps.QuestStep; +import com.questhelper.steps.widget.LunarSpells; +import com.questhelper.steps.widget.NormalSpells; +import java.util.Set; +import net.runelite.api.ItemID; +import net.runelite.api.NpcID; +import net.runelite.api.NullObjectID; +import net.runelite.api.QuestState; +import net.runelite.api.Skill; +import net.runelite.api.Varbits; +import net.runelite.api.coords.WorldPoint; +import net.runelite.api.events.GameTick; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.events.ConfigChanged; +import net.runelite.client.game.ItemManager; +import net.runelite.client.plugins.timetracking.Tab; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/* +* +* TODO LIST: +* Add better direction for using spirit trees and such +* */ +public class TreeRun extends ComplexStateQuestHelper +{ + @Inject + private FarmingWorld farmingWorld; + + @Inject + private PaymentTracker paymentTracker; + + @Inject + ItemManager itemManager; + + private FarmingHandler farmingHandler; + + DetailedQuestStep waitForTree; + + // Trees + DetailedQuestStep farmingGuildTreePatchCheckHealth, lumbridgeTreePatchCheckHealth, faladorTreePatchCheckHealth, taverleyTreePatchCheckHealth, varrockTreePatchCheckHealth, + gnomeStrongholdTreePatchCheckHealth; + DetailedQuestStep farmingGuildTreePatchPlant, lumbridgeTreePatchPlant, faladorTreePatchPlant, taverleyTreePatchPlant, + varrockTreePatchPlant, gnomeStrongholdTreePatchPlant; + + DetailedQuestStep lumbridgeTreePatchClear, faladorTreePatchClear, taverleyTreePatchClear, varrockTreePatchClear, + gnomeStrongholdTreePatchClear, farmingGuildTreePatchClear; + DetailedQuestStep lumbridgeTreePatchDig, faladorTreePatchDig, taverleyTreePatchDig, varrockTreePatchDig, + gnomeStrongholdTreePatchDig, farmingGuildTreePatchDig; + + DetailedQuestStep farmingGuildTreePayForProtection, lumbridgeTreeProtect, faladorTreeProtect, taverleyTreeProtect, varrockTreeProtect, strongholdTreeProtect; + + // Fruit Trees + DetailedQuestStep farmingGuildFruitTreePatchCheckHealth, gnomeStrongholdFruitTreePatchCheckHealth, gnomeVillageFruitTreePatchCheckHealth, + brimhavenFruitTreePatchCheckHealth, lletyaFruitTreePatchCheckHealth, catherbyFruitTreePatchCheckHealth; + DetailedQuestStep farmingGuildFruitTreePatchPlant, gnomeStrongholdFruitTreePatchPlant, gnomeVillageFruitTreePatchPlant, + brimhavenFruitTreePatchPlant, lletyaFruitTreePatchPlant, catherbyFruitTreePatchPlant; + + DetailedQuestStep farmingGuildFruitTreePatchClear, gnomeStrongholdFruitTreePatchClear, gnomeVillageFruitTreePatchClear, + brimhavenFruitTreePatchClear, lletyaFruitTreePatchClear, catherbyFruitTreePatchClear; + DetailedQuestStep farmingGuildFruitTreePatchDig, gnomeStrongholdFruitTreePatchDig, gnomeVillageFruitTreePatchDig, + brimhavenFruitTreePatchDig, lletyaFruitTreePatchDig, catherbyFruitTreePatchDig; + + DetailedQuestStep guildFruitProtect, strongholdFruitProtect, villageFruitProtect, brimhavenFruitProtect, + lletyaFruitProtect, catherbyFruitProtect; + + // Hardwood Trees + DetailedQuestStep eastHardwoodTreePatchCheckHealth, westHardwoodTreePatchCheckHealth, middleHardwoodTreePatchCheckHealth, savannahCheckHealth; + DetailedQuestStep eastHardwoodTreePatchPlant, westHardwoodTreePatchPlant, middleHardwoodTreePatchPlant, savannahPlant; + DetailedQuestStep eastHardwoodTreePatchDig, westHardwoodTreePatchDig, middleHardwoodTreePatchDig, savannahDig; + + DetailedQuestStep eastHardwoodTreePatchClear, westHardwoodTreePatchClear, middleHardwoodTreePatchClear, savannahClear; + + DetailedQuestStep eastHardwoodProtect, westHardwoodProtect, middleHardwoodProtect, savannahProtect; + + // Farming Items + ItemRequirement coins, spade, rake, allTreeSaplings, treeSapling, allFruitSaplings, fruitTreeSapling, allHardwoodSaplings, hardwoodSapling, compost, axe, + protectionItemTree, allProtectionItemTree, protectionItemFruitTree, allProtectionItemFruitTree, protectionItemHardwood, allProtectionItemHardwood; + + // Teleport Items + // TODO: Add these... + ItemRequirement farmingGuildTeleport, crystalTeleport, catherbyTeleport, varrockTeleport, lumbridgeTeleport, faladorTeleport, fossilIslandTeleport; + + // Graceful Set + ItemRequirement gracefulHood, gracefulTop, gracefulLegs, gracefulGloves, gracefulBoots, gracefulCape, gracefulOutfit; + + // Farming Set + ItemRequirement farmingHat, farmingTop, farmingLegs, farmingBoots, farmersOutfit; + + // Access Requirements + Requirement accessToFarmingGuildTreePatch, accessToFarmingGuildFruitTreePatch, accessToLletya, accessToFossilIsland, accessToSavannah; + + Requirement payingForRemoval, payingForProtection, usingCompostorNothing; + + PatchStates faladorStates, lumbridgeStates, farmingGuildTreeStates, taverleyStates, varrockStates, gnomeStrongholdTreeStates; + + PatchStates gnomeStrongholdFruitStates, gnomeVillageStates, brimhavenStates, catherbyStates, lletyaStates, farmingGuildFruitStates; + + PatchStates eastHardwoodStates, middleHardwoodStates, westHardwoodStates, savannahStates; + + ConditionalStep farmingGuildStep, lumbridgeStep, varrockStep, faladorStep, taverleyStep, strongholdStep, villageStep, lletyaStep, + catherbyStep, brimhavenStep, fossilIslandStep, savannahStep; + + private final String PAY_OR_CUT = "payOrCutTree"; + private final String PAY_OR_COMPOST = "payOrCompostTree"; + private final String GRACEFUL_OR_FARMING = "gracefulOrFarming"; + + @Override + public QuestStep loadStep() + { + setupSteps(); + farmingHandler = new FarmingHandler(client, configManager); + + ConditionalStep steps = new ConditionalStep(this, waitForTree, spade, coins, rake, compost + , farmersOutfit, gracefulOutfit); + + // Farming Guild Tree -> Farming Guild Fruit Tree -> Lumbridge -> Falador -> Taverley + // Varrock -> Gnome Stronghold Fruit -> Gnome Stronghold Tree -> Gnome Village -> catherby + // -> Brimhaven -> lletya -> east hardwood -> middle hardwood -> west hardwood. + + farmingGuildStep = new ConditionalStep(this, farmingGuildTreePatchCheckHealth); + farmingGuildStep.addStep(farmingGuildTreeStates.getIsUnchecked(), farmingGuildTreePatchCheckHealth); + farmingGuildStep.addStep(farmingGuildTreeStates.getIsHarvestable(), farmingGuildTreePatchClear); + farmingGuildStep.addStep(farmingGuildTreeStates.getIsStump(), farmingGuildTreePatchDig); + farmingGuildStep.addStep(farmingGuildTreeStates.getIsEmpty(), farmingGuildTreePatchPlant); + farmingGuildStep.addStep(nor(farmingGuildTreeStates.getIsProtected(), usingCompostorNothing), farmingGuildTreePayForProtection); + + farmingGuildStep.addStep(and(accessToFarmingGuildFruitTreePatch, farmingGuildFruitStates.getIsUnchecked()), farmingGuildFruitTreePatchCheckHealth); + farmingGuildStep.addStep(and(accessToFarmingGuildFruitTreePatch, farmingGuildFruitStates.getIsHarvestable()), farmingGuildFruitTreePatchClear); + farmingGuildStep.addStep(and(accessToFarmingGuildFruitTreePatch, farmingGuildFruitStates.getIsStump()), farmingGuildTreePatchDig); + farmingGuildStep.addStep(and(accessToFarmingGuildFruitTreePatch, farmingGuildFruitStates.getIsEmpty()), farmingGuildTreePatchPlant); + farmingGuildStep.addStep(and(accessToFarmingGuildFruitTreePatch, nor(farmingGuildFruitStates.getIsProtected(), usingCompostorNothing)), guildFruitProtect); + + steps.addStep(and(accessToFarmingGuildTreePatch, nor(farmingGuildTreeStates.getIsGrowing(), + farmingGuildFruitStates.getIsGrowing())), farmingGuildStep); + + lumbridgeStep = new ConditionalStep(this, lumbridgeTreePatchCheckHealth); + lumbridgeStep.addStep(lumbridgeStates.getIsUnchecked(), lumbridgeTreePatchCheckHealth); + lumbridgeStep.addStep(lumbridgeStates.getIsEmpty(), lumbridgeTreePatchPlant); + lumbridgeStep.addStep(lumbridgeStates.getIsHarvestable(), lumbridgeTreePatchClear); + lumbridgeStep.addStep(lumbridgeStates.getIsStump(), lumbridgeTreePatchDig); + lumbridgeStep.addStep(nor(usingCompostorNothing, lumbridgeStates.getIsProtected()), lumbridgeTreeProtect); + + steps.addStep(nor(lumbridgeStates.getIsGrowing()), lumbridgeStep); + + faladorStep = new ConditionalStep(this, faladorTreePatchCheckHealth); + faladorStep.addStep(faladorStates.getIsUnchecked(), faladorTreePatchCheckHealth); + faladorStep.addStep(faladorStates.getIsEmpty(), faladorTreePatchPlant); + faladorStep.addStep(faladorStates.getIsHarvestable(), faladorTreePatchClear); + faladorStep.addStep(faladorStates.getIsStump(), faladorTreePatchDig); + faladorStep.addStep(nor(usingCompostorNothing, faladorStates.getIsProtected()), faladorTreeProtect); + + steps.addStep(nor(faladorStates.getIsGrowing()), faladorStep); + + taverleyStep = new ConditionalStep(this, taverleyTreePatchCheckHealth); + taverleyStep.addStep(taverleyStates.getIsUnchecked(), taverleyTreePatchCheckHealth); + taverleyStep.addStep(taverleyStates.getIsEmpty(), taverleyTreePatchPlant); + taverleyStep.addStep(taverleyStates.getIsHarvestable(), taverleyTreePatchClear); + taverleyStep.addStep(taverleyStates.getIsStump(), taverleyTreePatchDig); + taverleyStep.addStep(nor(usingCompostorNothing, taverleyStates.getIsProtected()), taverleyTreeProtect); + + steps.addStep(nor(taverleyStates.getIsGrowing()), taverleyStep); + + varrockStep = new ConditionalStep(this, varrockTreePatchCheckHealth); + varrockStep.addStep(varrockStates.getIsUnchecked(), varrockTreePatchCheckHealth); + varrockStep.addStep(varrockStates.getIsEmpty(), varrockTreePatchPlant); + varrockStep.addStep(varrockStates.getIsHarvestable(), varrockTreePatchClear); + varrockStep.addStep(varrockStates.getIsStump(), varrockTreePatchDig); + varrockStep.addStep(nor(usingCompostorNothing, varrockStates.getIsProtected()), varrockTreeProtect); + + steps.addStep(nor(varrockStates.getIsGrowing()), varrockStep); + + strongholdStep = new ConditionalStep(this, gnomeStrongholdFruitTreePatchCheckHealth); + strongholdStep.addStep(gnomeStrongholdFruitStates.getIsUnchecked(), gnomeStrongholdFruitTreePatchCheckHealth); + strongholdStep.addStep(gnomeStrongholdFruitStates.getIsEmpty(), gnomeStrongholdFruitTreePatchPlant); + strongholdStep.addStep(gnomeStrongholdFruitStates.getIsHarvestable(), gnomeStrongholdFruitTreePatchClear); + strongholdStep.addStep(gnomeStrongholdFruitStates.getIsStump(), gnomeStrongholdFruitTreePatchDig); + strongholdStep.addStep(nor(usingCompostorNothing, gnomeStrongholdFruitStates.getIsProtected()), strongholdFruitProtect); + + strongholdStep.addStep(gnomeStrongholdTreeStates.getIsUnchecked(), gnomeStrongholdTreePatchCheckHealth); + strongholdStep.addStep(gnomeStrongholdTreeStates.getIsEmpty(), gnomeStrongholdTreePatchPlant); + strongholdStep.addStep(gnomeStrongholdTreeStates.getIsHarvestable(), gnomeStrongholdTreePatchClear); + strongholdStep.addStep(gnomeStrongholdTreeStates.getIsStump(), gnomeStrongholdTreePatchDig); + strongholdStep.addStep(nor(usingCompostorNothing, gnomeStrongholdTreeStates.getIsProtected()), strongholdTreeProtect); + + steps.addStep(nor(gnomeStrongholdTreeStates.getIsGrowing(), + gnomeStrongholdFruitStates.getIsGrowing()), strongholdStep); + + villageStep = new ConditionalStep(this, gnomeVillageFruitTreePatchCheckHealth); + villageStep.addStep(gnomeVillageStates.getIsUnchecked(), gnomeVillageFruitTreePatchCheckHealth); + villageStep.addStep(gnomeVillageStates.getIsEmpty(), gnomeVillageFruitTreePatchPlant); + villageStep.addStep(gnomeVillageStates.getIsHarvestable(), gnomeVillageFruitTreePatchClear); + villageStep.addStep(gnomeVillageStates.getIsStump(), gnomeVillageFruitTreePatchDig); + villageStep.addStep(nor(usingCompostorNothing, gnomeVillageStates.getIsProtected()), villageFruitProtect); + + steps.addStep(nor(gnomeVillageStates.getIsGrowing()), villageStep); + + catherbyStep = new ConditionalStep(this, catherbyFruitTreePatchCheckHealth); + catherbyStep.addStep(catherbyStates.getIsUnchecked(), catherbyFruitTreePatchCheckHealth); + catherbyStep.addStep(catherbyStates.getIsEmpty(), catherbyFruitTreePatchPlant); + catherbyStep.addStep(catherbyStates.getIsHarvestable(), catherbyFruitTreePatchClear); + catherbyStep.addStep(catherbyStates.getIsStump(), catherbyFruitTreePatchDig); + catherbyStep.addStep(nor(usingCompostorNothing, catherbyStates.getIsProtected()), catherbyFruitProtect); + + steps.addStep(nor(catherbyStates.getIsGrowing()), catherbyStep); + + brimhavenStep = new ConditionalStep(this, brimhavenFruitTreePatchCheckHealth); + brimhavenStep.addStep(brimhavenStates.getIsUnchecked(), brimhavenFruitTreePatchCheckHealth); + brimhavenStep.addStep(brimhavenStates.getIsEmpty(), brimhavenFruitTreePatchPlant); + brimhavenStep.addStep(brimhavenStates.getIsHarvestable(), brimhavenFruitTreePatchClear); + brimhavenStep.addStep(brimhavenStates.getIsStump(), brimhavenFruitTreePatchDig); + brimhavenStep.addStep(nor(usingCompostorNothing, brimhavenStates.getIsProtected()), brimhavenFruitProtect); + + steps.addStep(nor(brimhavenStates.getIsGrowing()), brimhavenStep); + + lletyaStep = new ConditionalStep(this, lletyaFruitTreePatchCheckHealth); + lletyaStep.addStep(lletyaStates.getIsUnchecked(), lletyaFruitTreePatchCheckHealth); + lletyaStep.addStep(lletyaStates.getIsEmpty(), lletyaFruitTreePatchPlant); + lletyaStep.addStep(lletyaStates.getIsHarvestable(), lletyaFruitTreePatchClear); + lletyaStep.addStep(lletyaStates.getIsStump(), lletyaFruitTreePatchDig); + lletyaStep.addStep(nor(usingCompostorNothing, lletyaStates.getIsProtected()), lletyaFruitProtect); + + steps.addStep(and(accessToLletya, nor(lletyaStates.getIsGrowing())), lletyaStep); + + fossilIslandStep = new ConditionalStep(this, eastHardwoodTreePatchCheckHealth); + fossilIslandStep.addStep(eastHardwoodStates.getIsUnchecked(), eastHardwoodTreePatchCheckHealth); + fossilIslandStep.addStep(eastHardwoodStates.getIsEmpty(), eastHardwoodTreePatchPlant); + fossilIslandStep.addStep(eastHardwoodStates.getIsHarvestable(), eastHardwoodTreePatchClear); + fossilIslandStep.addStep(eastHardwoodStates.getIsStump(), eastHardwoodTreePatchDig); + fossilIslandStep.addStep(nor(usingCompostorNothing, eastHardwoodStates.getIsProtected()), eastHardwoodProtect); + + fossilIslandStep.addStep(middleHardwoodStates.getIsUnchecked(), middleHardwoodTreePatchCheckHealth); + fossilIslandStep.addStep(middleHardwoodStates.getIsEmpty(), middleHardwoodTreePatchPlant); + fossilIslandStep.addStep(middleHardwoodStates.getIsHarvestable(), middleHardwoodTreePatchClear); + fossilIslandStep.addStep(middleHardwoodStates.getIsStump(), middleHardwoodTreePatchDig); + fossilIslandStep.addStep(nor(usingCompostorNothing, middleHardwoodStates.getIsProtected()), middleHardwoodProtect); + + fossilIslandStep.addStep(westHardwoodStates.getIsUnchecked(), westHardwoodTreePatchCheckHealth); + fossilIslandStep.addStep(westHardwoodStates.getIsEmpty(), westHardwoodTreePatchPlant); + fossilIslandStep.addStep(westHardwoodStates.getIsHarvestable(), westHardwoodTreePatchClear); + fossilIslandStep.addStep(westHardwoodStates.getIsStump(), westHardwoodTreePatchDig); + fossilIslandStep.addStep(nor(usingCompostorNothing, westHardwoodStates.getIsProtected()), westHardwoodProtect); + + steps.addStep(and(accessToFossilIsland, + nor(eastHardwoodStates.getIsGrowing(), westHardwoodStates.getIsGrowing(), middleHardwoodStates.getIsGrowing())), + fossilIslandStep); + + savannahStep = new ConditionalStep(this, savannahCheckHealth); + savannahStep.addStep(savannahStates.getIsUnchecked(), savannahCheckHealth); + savannahStep.addStep(savannahStates.getIsEmpty(), savannahPlant); + savannahStep.addStep(savannahStates.getIsHarvestable(), savannahClear); + savannahStep.addStep(savannahStates.getIsStump(), savannahDig); + savannahStep.addStep(nor(usingCompostorNothing, savannahStates.getIsProtected()), savannahProtect); + + System.out.println(accessToSavannah.check(client)); + steps.addStep(and(accessToSavannah, nor(savannahStates.getIsGrowing())), savannahStep); + + return steps; + } + + private void setupConditions() + { + // Tree Patch Ready Requirements + + // Access Requirements + // ME1 partial completion required only, however much easier to access when finished. + accessToLletya = new QuestRequirement(QuestHelperQuest.MOURNINGS_END_PART_I, QuestState.FINISHED); + accessToFossilIsland = new QuestRequirement(QuestHelperQuest.BONE_VOYAGE, QuestState.FINISHED); + accessToFarmingGuildTreePatch = new Conditions( + new SkillRequirement(Skill.FARMING, 65) + ); + accessToFarmingGuildFruitTreePatch = new Conditions( + new SkillRequirement(Skill.FARMING, 85) + ); + accessToSavannah = new QuestRequirement(QuestHelperQuest.THE_RIBBITING_TALE_OF_A_LILY_PAD_LABOUR_DISPUTE, QuestState.FINISHED); + + // Trees + lumbridgeStates = new PatchStates("Lumbridge"); + faladorStates = new PatchStates("Falador"); + taverleyStates = new PatchStates("Taverley"); + varrockStates = new PatchStates("Varrock"); + gnomeStrongholdTreeStates = new PatchStates("Gnome Stronghold"); + farmingGuildTreeStates = new PatchStates("Farming Guild", accessToFarmingGuildFruitTreePatch); + + // Fruit trees + catherbyStates = new PatchStates("Catherby"); + brimhavenStates = new PatchStates("Brimhaven"); + gnomeVillageStates = new PatchStates("Tree Gnome Village"); + gnomeStrongholdFruitStates = new PatchStates("Gnome Stronghold"); + lletyaStates = new PatchStates("Lletya", accessToLletya); + farmingGuildFruitStates = new PatchStates("Farming Guild", accessToFarmingGuildFruitTreePatch); + + westHardwoodStates = new PatchStates("Fossil Island", "West"); + middleHardwoodStates = new PatchStates("Fossil Island", "Middle"); + eastHardwoodStates = new PatchStates("Fossil Island", "East"); + savannahStates = new PatchStates("Avium Savannah", accessToSavannah); + + payingForRemoval = new RuneliteRequirement(configManager, PAY_OR_CUT, PayOrCut.PAY.name()); + payingForProtection = new RuneliteRequirement(configManager, PAY_OR_COMPOST, PayOrCompost.PAY.name()); + usingCompostorNothing = or(new RuneliteRequirement(configManager, PAY_OR_COMPOST, PayOrCompost.COMPOST.name()), + new RuneliteRequirement(configManager, PAY_OR_COMPOST, PayOrCompost.NEITHER.name())); + } + + @Override + public void setupRequirements() + { + setupConditions(); + // Farming Item Requirements + spade = new ItemRequirement("Spade", ItemID.SPADE); + rake = new ItemRequirement("Rake", ItemID.RAKE) + .hideConditioned(new VarbitRequirement(Varbits.AUTOWEED, 2)); + coins = new ItemRequirement("Coins to quickly remove trees.", ItemID.COINS_995) + .showConditioned(payingForRemoval); + axe = new ItemRequirement("Any axe you can use", ItemCollections.AXES); + + TreeSapling treeSaplingEnum = (TreeSapling) FarmingUtils.getEnumFromConfig(configManager, TreeSapling.MAGIC); + treeSapling = treeSaplingEnum.getPlantableItemRequirement(itemManager); + treeSapling.setHighlightInInventory(true); + allTreeSaplings = treeSapling.copy(); + + protectionItemTree = treeSaplingEnum.getProtectionItemRequirement(itemManager).showConditioned(payingForProtection); + protectionItemTree.addAlternates(protectionItemTree.getId() + 1); + allProtectionItemTree = protectionItemTree.copy(); + + FruitTreeSapling fruitTreeSaplingEnum = (FruitTreeSapling) FarmingUtils.getEnumFromConfig(configManager, FruitTreeSapling.APPLE); + fruitTreeSapling = fruitTreeSaplingEnum.getPlantableItemRequirement(itemManager); + fruitTreeSapling.setHighlightInInventory(true); + allFruitSaplings = fruitTreeSapling.copy(); + + protectionItemFruitTree = fruitTreeSaplingEnum.getProtectionItemRequirement(itemManager).showConditioned(payingForProtection); + protectionItemFruitTree.addAlternates(protectionItemFruitTree.getId() + 1); + allProtectionItemFruitTree = protectionItemFruitTree.copy(); + + HardwoodTreeSapling hardwoodTreeSaplingEnum = (HardwoodTreeSapling) FarmingUtils.getEnumFromConfig(configManager, HardwoodTreeSapling.TEAK); + hardwoodSapling = hardwoodTreeSaplingEnum.getPlantableItemRequirement(itemManager); + hardwoodSapling.setHighlightInInventory(true); + allHardwoodSaplings = hardwoodSapling.copy(); + + protectionItemHardwood = hardwoodTreeSaplingEnum.getProtectionItemRequirement(itemManager).showConditioned(payingForProtection); + protectionItemHardwood.addAlternates(protectionItemHardwood.getId() + 1); + allProtectionItemHardwood = protectionItemHardwood.copy(); + + compost = new ItemRequirement("Compost", ItemCollections.COMPOST).showConditioned(usingCompostorNothing); + compost.setDisplayMatchedItemName(true); + + // Teleport Items + farmingGuildTeleport = new ItemRequirement("Farming Guild Teleport", ItemCollections.SKILLS_NECKLACES); + crystalTeleport = new ItemRequirement("Crystal teleport", ItemCollections.TELEPORT_CRYSTAL); + catherbyTeleport = new ItemRequirement("Catherby teleport", ItemID.CATHERBY_TELEPORT); + catherbyTeleport.addAlternates(ItemID.CAMELOT_TELEPORT); + varrockTeleport = new ItemRequirement("Varrock teleport", ItemID.VARROCK_TELEPORT); + lumbridgeTeleport = new ItemRequirement("Lumbridge teleport", ItemID.LUMBRIDGE_TELEPORT); + faladorTeleport = new ItemRequirement("Falador teleport", ItemCollections.RING_OF_WEALTHS); + faladorTeleport.addAlternates(ItemID.FALADOR_TELEPORT); + fossilIslandTeleport = new ItemRequirement("Teleport to Fossil Island", ItemCollections.DIGSITE_PENDANTS); + + + // Graceful and Farming Outfit + gracefulHood = new ItemRequirement( + "Graceful hood", ItemCollections.GRACEFUL_HOOD, 1 ,true).isNotConsumed(); + + gracefulTop = new ItemRequirement( + "Graceful top", ItemCollections.GRACEFUL_TOP, 1, true).isNotConsumed(); + + gracefulLegs = new ItemRequirement( + "Graceful legs", ItemCollections.GRACEFUL_LEGS, 1, true).isNotConsumed(); + + gracefulCape = new ItemRequirement( + "Graceful cape", ItemCollections.GRACEFUL_CAPE, 1, true).isNotConsumed(); + + gracefulGloves = new ItemRequirement( + "Graceful gloves", ItemCollections.GRACEFUL_GLOVES, 1, true).isNotConsumed(); + + gracefulBoots = new ItemRequirement( + "Graceful boots", ItemCollections.GRACEFUL_BOOTS, 1, true).isNotConsumed(); + gracefulBoots.addAlternates(ItemID.BOOTS_OF_LIGHTNESS); + + gracefulOutfit = new ItemRequirements( + "Graceful outfit (equipped)", + gracefulHood, gracefulTop, gracefulLegs, gracefulGloves, gracefulBoots, gracefulCape + ).isNotConsumed().showConditioned(new RuneliteRequirement(configManager, GRACEFUL_OR_FARMING, GracefulOrFarming.GRACEFUL.name())); + + + farmingHat = new ItemRequirement( + "Farmer's strawhat", ItemID.FARMERS_STRAWHAT, 1 ,true).isNotConsumed(); + farmingHat.addAlternates(ItemID.FARMERS_STRAWHAT_13647, ItemID.FARMERS_STRAWHAT_21253, ItemID.FARMERS_STRAWHAT_21254); + + farmingTop = new ItemRequirement( + "Farmer's top", ItemID.FARMERS_JACKET, 1, true).isNotConsumed(); + farmingTop.addAlternates(ItemID.FARMERS_SHIRT); + + farmingLegs = new ItemRequirement( + "Farmer's boro trousers", ItemID.FARMERS_BORO_TROUSERS, 1, true).isNotConsumed(); + farmingLegs.addAlternates(ItemID.FARMERS_BORO_TROUSERS_13641); + + farmingBoots = new ItemRequirement( + "Graceful cape", ItemID.FARMERS_BOOTS, 1, true).isNotConsumed(); + farmingBoots.addAlternates(ItemID.FARMERS_BOOTS_13645); + + farmersOutfit = new ItemRequirements( + "Farmer's outfit (equipped)", + farmingHat, farmingTop, farmingLegs, farmingBoots).isNotConsumed() + .showConditioned(new RuneliteRequirement(configManager, GRACEFUL_OR_FARMING, GracefulOrFarming.FARMING.name())); + } + + private void setupSteps() + { + waitForTree = new DetailedQuestStep(this, "Wait for your trees to grow! This may take a while..!"); + + // Tree Patch Clear Steps + + lumbridgeTreePatchClear = new NpcStep(this, NpcID.FAYETH, new WorldPoint(3193, 3231, 0), + "Speak to Fayeth to clear the patch."); + lumbridgeTreePatchClear.addDialogStep("Yes."); + + faladorTreePatchClear = new NpcStep(this, NpcID.HESKEL, new WorldPoint(3004, 3373, 0), + "Speak to Heskel to clear the patch."); + faladorTreePatchClear.addDialogStep("Yes."); + + taverleyTreePatchClear = new NpcStep(this, NpcID.ALAIN, new WorldPoint(2936, 3438, 0), + "Speak to Alain to clear the patch."); + taverleyTreePatchClear.addDialogStep("Yes."); + + varrockTreePatchClear = new NpcStep(this, NpcID.TREZNOR_11957, new WorldPoint(3229, 3459, 0), + "Speak to Treznor to clear the patch."); + varrockTreePatchClear.addDialogStep("Yes."); + + gnomeStrongholdTreePatchClear = new NpcStep(this, NpcID.PRISSY_SCILLA, new WorldPoint(2436, 3415, 0), + "Speak to Prissy Scilla to clear the patch."); + gnomeStrongholdTreePatchClear.addDialogStep("Yes."); + + farmingGuildTreePatchClear = new NpcStep(this, NpcID.ROSIE, new WorldPoint(1232, 3736, 0), + "Speak to Rosie to clear the patch."); + farmingGuildTreePatchClear.addDialogStep("Yes."); + + lumbridgeTreeProtect = new NpcStep(this, NpcID.FAYETH, new WorldPoint(3193, 3231, 0), + "Speak to Fayeth to protect the patch."); + lumbridgeTreeProtect.addDialogStep("Yes."); + + faladorTreeProtect = new NpcStep(this, NpcID.HESKEL, new WorldPoint(3004, 3373, 0), + "Speak to Heskel to protect the patch."); + faladorTreeProtect.addDialogStep("Yes."); + + taverleyTreeProtect = new NpcStep(this, NpcID.ALAIN, new WorldPoint(2936, 3438, 0), + "Speak to Alain to protect the patch."); + taverleyTreeProtect.addDialogStep("Yes."); + + varrockTreeProtect = new NpcStep(this, NpcID.TREZNOR_11957, new WorldPoint(3229, 3459, 0), + "Speak to Treznor to protect the patch."); + varrockTreeProtect.addDialogStep("Yes."); + + strongholdTreeProtect = new NpcStep(this, NpcID.PRISSY_SCILLA, new WorldPoint(2436, 3415, 0), + "Speak to Prissy Scilla to protect the patch."); + strongholdTreeProtect.addDialogStep("Yes."); + + farmingGuildTreePayForProtection = new NpcStep(this, NpcID.ROSIE, new WorldPoint(1232, 3736, 0), + "Speak to Rosie to protect the patch."); + farmingGuildTreePayForProtection.addDialogStep("Yes."); + + // Tree Patch Steps + lumbridgeTreePatchCheckHealth = new ObjectStep(this, NullObjectID.NULL_8391, new WorldPoint(3193, 3231, 0), + "Check the health of the tree planted in Lumbridge."); + lumbridgeTreePatchCheckHealth.addTeleport(lumbridgeTeleport); + lumbridgeTreePatchCheckHealth.addSpellHighlight(NormalSpells.LUMBRIDGE_TELEPORT); + lumbridgeTreePatchCheckHealth.addSpellHighlight(NormalSpells.LUMBRIDGE_HOME_TELEPORT); + faladorTreePatchCheckHealth = new ObjectStep(this, NullObjectID.NULL_8389, new WorldPoint(3004, 3373, 0), + "Check the health of the tree planted in Falador."); + faladorTreePatchCheckHealth.addTeleport(faladorTeleport); + faladorTreePatchCheckHealth.addSpellHighlight(NormalSpells.FALADOR_TELEPORT); + taverleyTreePatchCheckHealth = new ObjectStep(this, NullObjectID.NULL_8388, new WorldPoint(2936, 3438, 0), + "Check the health of the tree planted in Taverley."); + varrockTreePatchCheckHealth = new ObjectStep(this, NullObjectID.NULL_8390, new WorldPoint(3229, 3459, 0), + "Check the health of the tree planted in Varrock."); + varrockTreePatchCheckHealth.addTeleport(varrockTeleport); + varrockTreePatchCheckHealth.addSpellHighlight(NormalSpells.VARROCK_TELEPORT); + gnomeStrongholdTreePatchCheckHealth = new ObjectStep(this, NullObjectID.NULL_19147, new WorldPoint(2436, 3415, 0), + "Check the health of the tree planted in the Tree Gnome Stronghold."); + farmingGuildTreePatchCheckHealth = new ObjectStep(this, NullObjectID.NULL_33732, new WorldPoint(1232, 3736, 0), + "Check the health of the tree planted in the Farming Guild."); + farmingGuildTreePatchCheckHealth.conditionToHideInSidebar(new Conditions(LogicType.NOR, accessToFarmingGuildTreePatch)); + farmingGuildTreePatchCheckHealth.addTeleport(farmingGuildTeleport); + + // Tree Plant Steps + lumbridgeTreePatchPlant = new ObjectStep(this, NullObjectID.NULL_8391, new WorldPoint(3193, 3231, 0), + "Plant your sapling in the Lumbridge patch.", treeSapling); + lumbridgeTreePatchPlant.addIcon(treeSapling.getId()); + lumbridgeTreePatchCheckHealth.addSubSteps(lumbridgeTreePatchPlant); + + faladorTreePatchPlant = new ObjectStep(this, NullObjectID.NULL_8389, new WorldPoint(3004, 3373, 0), + "Plant your sapling in the Falador patch.", treeSapling); + faladorTreePatchPlant.addIcon(treeSapling.getId()); + faladorTreePatchCheckHealth.addSubSteps(faladorTreePatchPlant); + + taverleyTreePatchPlant = new ObjectStep(this, NullObjectID.NULL_8388, new WorldPoint(2936, 3438, 0), + "Plant your sapling in the Taverley patch.", treeSapling); + taverleyTreePatchPlant.addIcon(treeSapling.getId()); + taverleyTreePatchCheckHealth.addSubSteps(taverleyTreePatchPlant); + + varrockTreePatchPlant = new ObjectStep(this, NullObjectID.NULL_8390, new WorldPoint(3229, 3459, 0), + "Plant your sapling in the Varrock patch.", treeSapling); + varrockTreePatchPlant.addIcon(treeSapling.getId()); + varrockTreePatchCheckHealth.addSubSteps(varrockTreePatchPlant); + + gnomeStrongholdTreePatchPlant = new ObjectStep(this, NullObjectID.NULL_19147, new WorldPoint(2436, 3415, 0), + "Plant your sapling in the Gnome Stronghold patch.", treeSapling); + gnomeStrongholdTreePatchPlant.addIcon(treeSapling.getId()); + gnomeStrongholdTreePatchCheckHealth.addSubSteps(gnomeStrongholdTreePatchPlant); + + farmingGuildTreePatchPlant = new ObjectStep(this, NullObjectID.NULL_33732, new WorldPoint(1232, 3736, 0), + "Plant your sapling in the Farming Guild tree patch.", treeSapling); + farmingGuildTreePatchPlant.conditionToHideInSidebar(new Conditions(LogicType.NOR, accessToFarmingGuildTreePatch)); + farmingGuildTreePatchPlant.addIcon(treeSapling.getId()); + farmingGuildTreePatchCheckHealth.addSubSteps(farmingGuildTreePatchPlant); + + // Dig + lumbridgeTreePatchDig = new ObjectStep(this, NullObjectID.NULL_8391, new WorldPoint(3193, 3231, 0), + "Dig up the tree stump in Lumbridge."); + faladorTreePatchDig = new ObjectStep(this, NullObjectID.NULL_8389, new WorldPoint(3004, 3373, 0), + "Dig up the tree stump in Falador."); + taverleyTreePatchDig = new ObjectStep(this, NullObjectID.NULL_8388, new WorldPoint(2936, 3438, 0), + "Dig up the tree stump in Taverley."); + varrockTreePatchDig = new ObjectStep(this, NullObjectID.NULL_8390, new WorldPoint(3229, 3459, 0), + "Dig up the tree stump in Varrock."); + gnomeStrongholdTreePatchDig = new ObjectStep(this, NullObjectID.NULL_19147, new WorldPoint(2436, 3415, 0), + "Dig up the tree stump in the Tree Gnome Stronghold."); + farmingGuildTreePatchDig = new ObjectStep(this, NullObjectID.NULL_33732, new WorldPoint(1232, 3736, 0), + "Dig up the tree stump in the Farming Guild tree patch."); + + faladorTreePatchClear.addSubSteps(faladorTreePatchDig, faladorTreeProtect); + taverleyTreePatchClear.addSubSteps(taverleyTreePatchDig, taverleyTreeProtect); + varrockTreePatchClear.addSubSteps(varrockTreePatchDig, varrockTreeProtect); + gnomeStrongholdTreePatchClear.addSubSteps(gnomeStrongholdTreePatchDig, strongholdTreeProtect); + lumbridgeTreePatchClear.addSubSteps(lumbridgeTreePatchDig, lumbridgeTreeProtect); + farmingGuildTreePatchClear.addSubSteps(farmingGuildTreePatchDig, farmingGuildTreePatchDig); + + // Fruit Tree Steps + gnomeStrongholdFruitTreePatchCheckHealth = new ObjectStep(this, NullObjectID.NULL_7962, new WorldPoint(2476, 3446, 0), + "Check the health of the fruit tree planted in the Tree Gnome Stronghold."); + gnomeStrongholdFruitTreePatchCheckHealth.addWidgetHighlightWithTextRequirement(187, 3, "Gnome Stronghold", true); + gnomeVillageFruitTreePatchCheckHealth = new ObjectStep(this, NullObjectID.NULL_7963, new WorldPoint(2490, 3180, 0), + "Check the health of the fruit tree planted outside the Tree Gnome Village. Follow Elkoy to get out quickly."); + gnomeVillageFruitTreePatchCheckHealth.addWidgetHighlightWithTextRequirement(187, 3, "Tree Gnome Village", true); + brimhavenFruitTreePatchCheckHealth = new ObjectStep(this, NullObjectID.NULL_7964, new WorldPoint(2765, 3213, 0), + "Check the health of the fruit tree planted in Brimhaven."); + brimhavenFruitTreePatchCheckHealth.addWidgetHighlightWithTextRequirement(187, 3, "Brimhaven", true); + catherbyFruitTreePatchCheckHealth = new ObjectStep(this, NullObjectID.NULL_7965, new WorldPoint(2860, 3433, 0), + "Check the health of the fruit tree planted in Catherby."); + catherbyFruitTreePatchCheckHealth.addTeleport(catherbyTeleport); + catherbyFruitTreePatchCheckHealth.addSpellHighlight(NormalSpells.CAMELOT_TELEPORT); + catherbyFruitTreePatchCheckHealth.addSpellHighlight(LunarSpells.CATHERBY_TELEPORT); + + lletyaFruitTreePatchCheckHealth = new ObjectStep(this, NullObjectID.NULL_26579, new WorldPoint(2347, 3162, 0), + "Check the health of the fruit tree planted in Lletya."); + lletyaFruitTreePatchCheckHealth.conditionToHideInSidebar(new Conditions(LogicType.NOR, accessToLletya)); + lletyaFruitTreePatchCheckHealth.addTeleport(crystalTeleport); + + farmingGuildFruitTreePatchCheckHealth = new ObjectStep(this, NullObjectID.NULL_34007, new WorldPoint(1242, 3758, 0), + "Check the health of the fruit tree planted in the Farming Guild."); + farmingGuildFruitTreePatchCheckHealth.conditionToHideInSidebar(new Conditions(LogicType.NOR, accessToFarmingGuildFruitTreePatch)); + farmingGuildFruitTreePatchCheckHealth.addTeleport(farmingGuildTeleport); + farmingGuildFruitTreePatchCheckHealth.addWidgetHighlightWithTextRequirement(187, 3, "Farming Guild", true); + + // Fruit Tree Plant Steps + gnomeStrongholdFruitTreePatchPlant = new ObjectStep(this, NullObjectID.NULL_7962, new WorldPoint(2476, 3446, 0), + "Plant your sapling in the Tree Gnome Stronghold patch.", fruitTreeSapling); + gnomeStrongholdFruitTreePatchPlant.addIcon(fruitTreeSapling.getId()); + gnomeStrongholdTreePatchCheckHealth.addSubSteps(gnomeStrongholdTreePatchPlant); + + gnomeVillageFruitTreePatchPlant = new ObjectStep(this, NullObjectID.NULL_7963, new WorldPoint(2490, 3180, 0), + "Plant your sapling in the Tree Gnome Village patch. Follow Elkoy to get out quickly.", fruitTreeSapling); + gnomeVillageFruitTreePatchPlant.addIcon(fruitTreeSapling.getId()); + gnomeVillageFruitTreePatchCheckHealth.addSubSteps(gnomeVillageFruitTreePatchPlant); + + brimhavenFruitTreePatchPlant = new ObjectStep(this, NullObjectID.NULL_7964, new WorldPoint(2765, 3213, 0), + "Plant your sapling in the Brimhaven patch.", fruitTreeSapling); + brimhavenFruitTreePatchPlant.addIcon(fruitTreeSapling.getId()); + brimhavenFruitTreePatchCheckHealth.addSubSteps(brimhavenFruitTreePatchPlant); + + // Plant + catherbyFruitTreePatchPlant = new ObjectStep(this, NullObjectID.NULL_7965, new WorldPoint(2860, 3433, 0), + "Plant your sapling in the Catherby patch.", fruitTreeSapling); + catherbyFruitTreePatchPlant.addIcon(fruitTreeSapling.getId()); + catherbyFruitTreePatchCheckHealth.addSubSteps(catherbyFruitTreePatchPlant); + + lletyaFruitTreePatchPlant = new ObjectStep(this, NullObjectID.NULL_26579, new WorldPoint(2347, 3162, 0), + "Plant your sapling in the Lletya patch.", fruitTreeSapling); + lletyaFruitTreePatchPlant.conditionToHideInSidebar(new Conditions(LogicType.NOR, accessToLletya)); + lletyaFruitTreePatchPlant.addIcon(fruitTreeSapling.getId()); + lletyaFruitTreePatchCheckHealth.addSubSteps(lletyaFruitTreePatchPlant); + + farmingGuildFruitTreePatchPlant = new ObjectStep(this, NullObjectID.NULL_34007, new WorldPoint(1242, 3758, 0), + "Plant your sapling in the Farming Guild patch.", fruitTreeSapling); + farmingGuildFruitTreePatchPlant.conditionToHideInSidebar(new Conditions(LogicType.NOR, accessToFarmingGuildFruitTreePatch)); + farmingGuildFruitTreePatchPlant.addIcon(fruitTreeSapling.getId()); + farmingGuildFruitTreePatchCheckHealth.addSubSteps(farmingGuildFruitTreePatchPlant); + + // Clear + gnomeStrongholdFruitTreePatchClear = new NpcStep(this, NpcID.BOLONGO, new WorldPoint(2476, 3446, 0), + "Pay Bolongo 200 coins to clear the fruit tree, or pick all the fruit and cut it down."); + gnomeStrongholdFruitTreePatchClear.addDialogStep("Yes."); + gnomeVillageFruitTreePatchClear = new NpcStep(this, NpcID.GILETH, new WorldPoint(2490, 3180, 0), + "Pay Gileth 200 coins to clear the fruit tree, or pick all the fruit and cut it down."); + gnomeVillageFruitTreePatchClear.addDialogStep("Yes."); + brimhavenFruitTreePatchClear = new NpcStep(this, NpcID.GARTH, new WorldPoint(2765, 3213, 0), + "Pay Garth 200 coins to clear the fruit tree, or pick all the fruit and cut it down."); + brimhavenFruitTreePatchClear.addDialogStep("Yes."); + catherbyFruitTreePatchClear = new NpcStep(this, NpcID.ELLENA, new WorldPoint(2860, 3433, 0), + "Pay Ellena 200 coins to clear the fruit tree, or pick all the fruit and cut it down."); + catherbyFruitTreePatchClear.addDialogStep("Yes."); + lletyaFruitTreePatchClear = new NpcStep(this, NpcID.LILIWEN, new WorldPoint(2347, 3162, 0), + "Pay Liliwen 200 coins to clear the fruit tree, or pick all the fruit and cut it down."); + lletyaFruitTreePatchClear.addDialogStep("Yes."); + farmingGuildFruitTreePatchClear = new NpcStep(this, NpcID.NIKKIE, new WorldPoint(1243, 3760, 0), + "Pay Nikkie 200 coins to clear the fruit tree, or pick all the fruit and cut it down."); + farmingGuildFruitTreePatchClear.addDialogStep("Yes."); + + strongholdFruitProtect = new NpcStep(this, NpcID.BOLONGO, new WorldPoint(2476, 3446, 0), + "Pay Bolongo to protect the patch."); + strongholdFruitProtect.addDialogStep("Yes."); + villageFruitProtect = new NpcStep(this, NpcID.GILETH, new WorldPoint(2490, 3180, 0), + "Pay Gileth to protect the patch."); + villageFruitProtect.addDialogStep("Yes."); + brimhavenFruitProtect = new NpcStep(this, NpcID.GARTH, new WorldPoint(2765, 3213, 0), + "Pay Garth to protect the patch."); + brimhavenFruitProtect.addDialogStep("Yes."); + catherbyFruitProtect = new NpcStep(this, NpcID.ELLENA, new WorldPoint(2860, 3433, 0), + "Pay Ellena to protect the patch."); + catherbyFruitProtect.addDialogStep("Yes."); + lletyaFruitProtect = new NpcStep(this, NpcID.LILIWEN, new WorldPoint(2347, 3162, 0), + "Pay Liliwen to protect the patch."); + lletyaFruitProtect.addDialogStep("Yes."); + guildFruitProtect = new NpcStep(this, NpcID.NIKKIE, new WorldPoint(1243, 3760, 0), + "Pay Nikkie to protect the patch."); + guildFruitProtect.addDialogStep("Yes."); + + // Dig Fruit Tree Steps + gnomeStrongholdFruitTreePatchDig = new ObjectStep(this, NullObjectID.NULL_7962, new WorldPoint(2476, 3446, 0), + "Dig up the fruit tree's stump in the Tree Gnome Stronghold."); + gnomeVillageFruitTreePatchDig = new ObjectStep(this, NullObjectID.NULL_7963, new WorldPoint(2490, 3180, 0), + "Dig up the fruit tree's stump outside the Tree Gnome Village."); + brimhavenFruitTreePatchDig = new ObjectStep(this, NullObjectID.NULL_7964, new WorldPoint(2765, 3213, 0), + "Dig up the fruit tree's stump in Brimhaven."); + catherbyFruitTreePatchDig = new ObjectStep(this, NullObjectID.NULL_7965, new WorldPoint(2860, 3433, 0), + "Check the health of the fruit tree planted in Catherby"); + lletyaFruitTreePatchDig = new ObjectStep(this, NullObjectID.NULL_26579, new WorldPoint(2347, 3162, 0), + "Dig up the fruit tree's stump in Lletya."); + farmingGuildFruitTreePatchDig = new ObjectStep(this, NullObjectID.NULL_34007, new WorldPoint(1242, 3758, 0), + "Dig up the fruit tree's stump in the Farming Guild."); + + gnomeStrongholdFruitTreePatchClear.addSubSteps(gnomeStrongholdFruitTreePatchDig, strongholdFruitProtect); + gnomeVillageFruitTreePatchClear.addSubSteps(gnomeVillageFruitTreePatchDig, villageFruitProtect); + brimhavenFruitTreePatchClear.addSubSteps(brimhavenFruitTreePatchDig, brimhavenFruitProtect); + catherbyFruitTreePatchClear.addSubSteps(catherbyFruitTreePatchDig, catherbyFruitProtect); + lletyaFruitTreePatchClear.addSubSteps(lletyaFruitTreePatchDig, lletyaFruitProtect); + farmingGuildFruitTreePatchClear.addSubSteps(farmingGuildFruitTreePatchDig, guildFruitProtect); + + // Hardwood Tree Steps + westHardwoodTreePatchCheckHealth = new ObjectStep(this, NullObjectID.NULL_30481, new WorldPoint(3702, 3837, 0), + "Check the health of the western hardwood tree on Fossil Island."); + middleHardwoodTreePatchCheckHealth = new ObjectStep(this, NullObjectID.NULL_30480, new WorldPoint(3708, 3833, 0), + "Check the health of the centre hardwood tree on Fossil Island."); + eastHardwoodTreePatchCheckHealth = new ObjectStep(this, NullObjectID.NULL_30482, new WorldPoint(3715, 3835, 0), + "Check the health of the eastern hardwood tree on Fossil Island."); + savannahCheckHealth = new ObjectStep(this, NullObjectID.NULL_50692, new WorldPoint(1687, 2972, 0), + "Check the health of the hardwood tree in the Avium Savannah."); + + // Hardwood Tree Plant Steps + westHardwoodTreePatchPlant = new ObjectStep(this, NullObjectID.NULL_30481, new WorldPoint(3702, 3837, 0), + "Plant your sapling on the western hardwood tree patch on Fossil Island.", hardwoodSapling); + westHardwoodTreePatchPlant.addIcon(hardwoodSapling.getId()); + westHardwoodTreePatchCheckHealth.addSubSteps(westHardwoodTreePatchPlant); + + middleHardwoodTreePatchPlant = new ObjectStep(this, NullObjectID.NULL_30480, new WorldPoint(3708, 3833, 0), + "Plant your sapling on the centre hardwood tree patch on Fossil Island.", hardwoodSapling); + middleHardwoodTreePatchPlant.addIcon(hardwoodSapling.getId()); + middleHardwoodTreePatchCheckHealth.addSubSteps(middleHardwoodTreePatchPlant); + + eastHardwoodTreePatchPlant = new ObjectStep(this, NullObjectID.NULL_30482, new WorldPoint(3715, 3835, 0), + "Plant your sapling on the eastern hardwood tree patch on Fossil Island.", hardwoodSapling); + eastHardwoodTreePatchPlant.addIcon(hardwoodSapling.getId()); + eastHardwoodTreePatchCheckHealth.addSubSteps(eastHardwoodTreePatchPlant); + + savannahPlant = new ObjectStep(this, NullObjectID.NULL_50692, new WorldPoint(1687, 2972, 0), + "Plant your sapling into the hardwood tree in the hardwood tree patch in the Avium Savannah.", hardwoodSapling); + + westHardwoodTreePatchClear = new NpcStep(this, NpcID.SQUIRREL_7756, new WorldPoint(3702, 3837, 0), + "Pay the brown squirrel to remove the west tree."); + middleHardwoodTreePatchClear = new NpcStep(this, NpcID.SQUIRREL_7755, new WorldPoint(3702, 3837, 0), + "Pay the black squirrel to remove the middle tree."); + eastHardwoodTreePatchClear = new NpcStep(this, NpcID.SQUIRREL_7754, new WorldPoint(3702, 3837, 0), + "Pay the grey squirrel to remove the east tree."); + + savannahClear = new NpcStep(this, NpcID.MARCELLUS_12936, new WorldPoint(1687, 2972, 0), + "Pay Marcellus to clear the tree."); + + westHardwoodTreePatchDig = new ObjectStep(this, NullObjectID.NULL_30481, new WorldPoint(3702, 3837, 0), + "Dig up the western hardwood tree's stump on Fossil Island."); + middleHardwoodTreePatchDig = new ObjectStep(this, NullObjectID.NULL_30480, new WorldPoint(3708, 3833, 0), + "Dig up the centre hardwood tree's stump on Fossil Island."); + eastHardwoodTreePatchDig = new ObjectStep(this, NullObjectID.NULL_30482, new WorldPoint(3715, 3835, 0), + "Dig up the eastern hardwood tree's stump on Fossil Island."); + savannahDig = new ObjectStep(this, NullObjectID.NULL_50692, new WorldPoint(1687, 2972, 0), + "Dig up the Savannah hardwood tree's stump."); + + westHardwoodProtect = new NpcStep(this, NpcID.SQUIRREL_7756, new WorldPoint(3702, 3837, 0), + "Pay the brown squirrel to protect the west tree."); + middleHardwoodProtect = new NpcStep(this, NpcID.SQUIRREL_7755, new WorldPoint(3702, 3837, 0), + "Pay the black squirrel to protect the middle tree."); + eastHardwoodProtect = new NpcStep(this, NpcID.SQUIRREL_7754, new WorldPoint(3702, 3837, 0), + "Pay the grey squirrel to protect the east tree."); + savannahProtect = new NpcStep(this, NpcID.MARCELLUS_12936, new WorldPoint(1687, 2972, 0), + "Pay Marcellus to protect the hardwood tree."); + + westHardwoodTreePatchClear.addSubSteps(westHardwoodTreePatchDig, westHardwoodProtect); + middleHardwoodTreePatchClear.addSubSteps(middleHardwoodTreePatchDig, middleHardwoodProtect); + eastHardwoodTreePatchClear.addSubSteps(eastHardwoodTreePatchDig, eastHardwoodProtect); + savannahClear.addSubSteps(savannahDig, savannahProtect); + } + + @Subscribe + public void onGameTick(GameTick event) + { + coins.setQuantity(0); + allProtectionItemTree.setQuantity(protectionItemTree.getQuantity()); + allProtectionItemFruitTree.setQuantity(protectionItemFruitTree.getQuantity()); + allProtectionItemHardwood.setQuantity(protectionItemHardwood.getQuantity()); + handleTreePatches(PatchImplementation.TREE, + List.of(farmingGuildTreeStates, varrockStates, faladorStates, taverleyStates, lumbridgeStates, gnomeStrongholdTreeStates), + farmingWorld.getTabs().get(Tab.TREE), allTreeSaplings, allProtectionItemTree); + handleTreePatches(PatchImplementation.FRUIT_TREE, + List.of(farmingGuildFruitStates, brimhavenStates, catherbyStates, gnomeStrongholdFruitStates, gnomeVillageStates, lletyaStates), + farmingWorld.getTabs().get(Tab.FRUIT_TREE), allFruitSaplings, allProtectionItemFruitTree); + handleTreePatches(PatchImplementation.HARDWOOD_TREE, List.of(westHardwoodStates, middleHardwoodStates, eastHardwoodStates, savannahStates), + farmingWorld.getTabs().get(Tab.TREE), allHardwoodSaplings, allProtectionItemHardwood); + } + + public void handleTreePatches(PatchImplementation implementation, List regions, Set patches, ItemRequirement allSaplings, ItemRequirement allPayment) + { + int numberOfSaplings = 0; + for (FarmingPatch patch : patches) + { + if (patch.getImplementation() != implementation) + { + continue; + } + + CropState state = farmingHandler.predictPatch(patch); + boolean isPlantable = state == CropState.EMPTY || state == CropState.DEAD; + boolean isUnchecked = state == CropState.UNCHECKED; // 'Check health' + boolean isHarvestable = state == CropState.HARVESTABLE; // 'Chop' + boolean isStump = state == CropState.STUMP; // 'Clear' + boolean isProtected = paymentTracker.getProtectedState(patch); + boolean isGrowing = state == CropState.GROWING; + + if (state != CropState.GROWING) + { + numberOfSaplings++; + } + + PatchStates region = regions.stream() + .filter(r -> r.getRegionName().equals(patch.getRegion().getName())) + .filter(r -> r.getPatchName() == null || r.getPatchName().equals(patch.getName())) + .findFirst() + .orElse(null); + + if (region != null) + { + region.getIsHarvestable().setShouldPass(isHarvestable); + region.getIsEmpty().setShouldPass(isPlantable); + region.getIsUnchecked().setShouldPass(isUnchecked); + region.getIsStump().setShouldPass(isStump); + region.getIsProtected().setShouldPass(isProtected); + region.getIsGrowing().setShouldPass(isGrowing); + if (!region.canAccess(client)) + { + numberOfSaplings--; + } + } + } + allSaplings.setQuantity(numberOfSaplings); + coins.setQuantity(coins.getQuantity() + (200 * numberOfSaplings)); + allPayment.setQuantity(allPayment.getQuantity() * numberOfSaplings); + } + + @Subscribe + public void onConfigChanged(ConfigChanged event) + { + if (!event.getGroup().equals(QuestHelperConfig.QUEST_BACKGROUND_GROUP)) + { + return; + } + questHelperPlugin.getClientThread().invokeLater(() -> + { + FarmingConfigChangeHandler.handleFarmingEnumConfigChange(event, TREE_SAPLING, TreeSapling.class, + this::updateTreeSapling, TreeSapling.OAK, configManager, questHelperPlugin); + FarmingConfigChangeHandler.handleFarmingEnumConfigChange(event, FRUIT_TREE_SAPLING, FruitTreeSapling.class, + this::updateFruitTreeSapling, FruitTreeSapling.APPLE, configManager, questHelperPlugin); + FarmingConfigChangeHandler.handleFarmingEnumConfigChange(event, HARDWOOD_TREE_SAPLING, HardwoodTreeSapling.class, + this::updateHardwoodTreeSapling, HardwoodTreeSapling.TEAK, configManager, questHelperPlugin); + + if (event.getKey().equals(GRACEFUL_OR_FARMING) || event.getKey().equals(PAY_OR_CUT) || event.getKey().equals(PAY_OR_COMPOST)) + { + questHelperPlugin.refreshBank(); + } + }); + } + private final String TREE_SAPLING = "treeSaplings"; + private final String FRUIT_TREE_SAPLING = "fruitTreeSaplings"; + private final String HARDWOOD_TREE_SAPLING = "hardwoodTreeSaplings"; + + @Override + public List getConfigs() + { + HelperConfig treesConfig = new HelperConfig("Trees", TREE_SAPLING, TreeSapling.values()); + HelperConfig fruitTreesConfig = new HelperConfig("Fruit Trees", FRUIT_TREE_SAPLING, FruitTreeSapling.values()); + HelperConfig hardwoodTreesConfig = new HelperConfig("Hardwood Trees", HARDWOOD_TREE_SAPLING, HardwoodTreeSapling.values()); + HelperConfig outfitConfig = new HelperConfig("Outfit", GRACEFUL_OR_FARMING, GracefulOrFarming.values()); + HelperConfig payOrCutConfig = new HelperConfig("Pay or cut tree removal", PAY_OR_CUT, PayOrCut.values()); + HelperConfig payOrCompostConfig = new HelperConfig("Pay farmer or compost", PAY_OR_COMPOST, PayOrCompost.values()); + return Arrays.asList(treesConfig, fruitTreesConfig, hardwoodTreesConfig, outfitConfig, payOrCutConfig, payOrCompostConfig); + } + + @Override + public List getItemRequirements() + { + return Arrays.asList(spade, rake, compost, coins, allTreeSaplings, allFruitSaplings, allHardwoodSaplings, allProtectionItemTree, allProtectionItemFruitTree, allProtectionItemHardwood); + } + + @Override + public List getItemRecommended() + { + return Arrays.asList(gracefulOutfit, farmersOutfit, farmingGuildTeleport, lumbridgeTeleport, faladorTeleport, varrockTeleport, catherbyTeleport, crystalTeleport, fossilIslandTeleport); + } + + @Override + public List getPanels() + { + List allSteps = new ArrayList<>(); + PanelDetails farmingGuildPanel = new PanelDetails("Farming Guild", Arrays.asList(farmingGuildTreePatchCheckHealth, farmingGuildTreePatchClear, farmingGuildFruitTreePatchCheckHealth, farmingGuildFruitTreePatchClear)); + farmingGuildPanel.setLockingStep(farmingGuildStep); + allSteps.add(farmingGuildPanel); + + PanelDetails lumbridgePanel = new PanelDetails("Lumbridge", Arrays.asList(lumbridgeTreePatchCheckHealth, lumbridgeTreePatchClear)); + lumbridgePanel.setLockingStep(lumbridgeStep); + allSteps.add(lumbridgePanel); + + PanelDetails faladorPanel = new PanelDetails("Falador", Arrays.asList(faladorTreePatchCheckHealth, faladorTreePatchClear)); + faladorPanel.setLockingStep(faladorStep); + allSteps.add(faladorPanel); + PanelDetails taverleyPanel = new PanelDetails("Taverley", Arrays.asList(taverleyTreePatchCheckHealth, taverleyTreePatchClear)); + taverleyPanel.setLockingStep(taverleyStep); + allSteps.add(taverleyPanel); + + PanelDetails varrockPanel = new PanelDetails("Varrock", Arrays.asList(varrockTreePatchCheckHealth, varrockTreePatchClear)); + varrockPanel.setLockingStep(varrockStep); + allSteps.add(varrockPanel); + + PanelDetails gnomeStrongholdPanel = new PanelDetails("Gnome Stronghold", Arrays.asList(gnomeStrongholdFruitTreePatchCheckHealth, gnomeVillageFruitTreePatchClear, + gnomeStrongholdTreePatchCheckHealth, gnomeStrongholdTreePatchClear)); + gnomeStrongholdPanel.setLockingStep(strongholdStep); + allSteps.add(gnomeStrongholdPanel); + + PanelDetails villagePanel = new PanelDetails("Tree Gnome Village", Arrays.asList(gnomeVillageFruitTreePatchCheckHealth, gnomeVillageFruitTreePatchClear)); + villagePanel.setLockingStep(villageStep); + allSteps.add(villagePanel); + + PanelDetails catherbyPanel = new PanelDetails("Catherby", Arrays.asList(catherbyFruitTreePatchCheckHealth, catherbyFruitTreePatchClear)); + catherbyPanel.setLockingStep(catherbyStep); + allSteps.add(catherbyPanel); + + PanelDetails brimhavenPanel = new PanelDetails("Brimhaven", Arrays.asList(brimhavenFruitTreePatchCheckHealth, brimhavenFruitTreePatchClear)); + brimhavenPanel.setLockingStep(brimhavenStep); + allSteps.add(brimhavenPanel); + + PanelDetails lletyaPanel = new PanelDetails("Llyeta", Arrays.asList(lletyaFruitTreePatchCheckHealth, lletyaFruitTreePatchClear)); + lletyaPanel.setLockingStep(lletyaStep); + allSteps.add(lletyaPanel); + + PanelDetails fossilIslandPanel = new PanelDetails("Fossil Island", Arrays.asList(eastHardwoodTreePatchCheckHealth, eastHardwoodTreePatchClear, + middleHardwoodTreePatchCheckHealth, middleHardwoodTreePatchClear, + westHardwoodTreePatchCheckHealth, westHardwoodTreePatchClear)); + fossilIslandPanel.setLockingStep(fossilIslandStep); + allSteps.add(fossilIslandPanel); + + PanelDetails savannahPanel = new PanelDetails("Avium Savannah", Arrays.asList(savannahCheckHealth, savannahClear, savannahPlant)); + savannahPanel.setLockingStep(savannahStep); + allSteps.add(savannahPanel); + return allSteps; + } + + private void updateTreeSapling(TreeSapling selectedTreeSapling) + { + treeSapling.setId(selectedTreeSapling.treeSaplingID); + treeSapling.setName(itemManager.getItemComposition(selectedTreeSapling.getPlantableItemId()).getName()); + + allTreeSaplings.setId(selectedTreeSapling.treeSaplingID); + allTreeSaplings.setName(itemManager.getItemComposition(selectedTreeSapling.getPlantableItemId()).getName()); + updateTreePaymentItem(selectedTreeSapling); + } + + private void updateFruitTreeSapling(FruitTreeSapling selectedFruitTreeSapling) + { + fruitTreeSapling.setId(selectedFruitTreeSapling.fruitTreeSaplingId); + fruitTreeSapling.setName(itemManager.getItemComposition(selectedFruitTreeSapling.getPlantableItemId()).getName()); + + allFruitSaplings.setId(selectedFruitTreeSapling.fruitTreeSaplingId); + allFruitSaplings.setName(itemManager.getItemComposition(selectedFruitTreeSapling.getPlantableItemId()).getName()); + updateFruitTreePaymentItem(selectedFruitTreeSapling); + } + + private void updateHardwoodTreeSapling(HardwoodTreeSapling selectedHardwoodTreeSapling) + { + hardwoodSapling.setId(selectedHardwoodTreeSapling.hardwoodTreeSaplingId); + hardwoodSapling.setName(itemManager.getItemComposition(selectedHardwoodTreeSapling.getPlantableItemId()).getName()); + + allHardwoodSaplings.setId(selectedHardwoodTreeSapling.hardwoodTreeSaplingId); + allHardwoodSaplings.setName(itemManager.getItemComposition(selectedHardwoodTreeSapling.getPlantableItemId()).getName()); + updateHardwoodTreePaymentItem(selectedHardwoodTreeSapling); + } + + private void updateTreePaymentItem(TreeSapling treeSapling) + { + protectionItemTree.setId(treeSapling.protectionItemId); + protectionItemTree.setName(itemManager.getItemComposition(treeSapling.protectionItemId).getName()); + protectionItemTree.setQuantity(treeSapling.protectionItemQuantity); + + allProtectionItemTree.setId(treeSapling.protectionItemId); + allProtectionItemTree.setName(itemManager.getItemComposition(treeSapling.protectionItemId).getName()); + allProtectionItemTree.setQuantity(treeSapling.protectionItemQuantity); + } + + private void updateFruitTreePaymentItem(FruitTreeSapling treeSapling) + { + protectionItemFruitTree.setId(treeSapling.protectionItemId); + protectionItemFruitTree.setName(itemManager.getItemComposition(treeSapling.protectionItemId).getName()); + protectionItemFruitTree.setQuantity(treeSapling.protectionItemQuantity); + + allProtectionItemFruitTree.setId(treeSapling.protectionItemId); + allProtectionItemFruitTree.setName(itemManager.getItemComposition(treeSapling.protectionItemId).getName()); + allProtectionItemFruitTree.setQuantity(treeSapling.protectionItemQuantity); + } + + private void updateHardwoodTreePaymentItem(HardwoodTreeSapling treeSapling) + { + protectionItemHardwood.setId(treeSapling.protectionItemId); + protectionItemHardwood.setName(itemManager.getItemComposition(treeSapling.protectionItemId).getName()); + protectionItemHardwood.setQuantity(treeSapling.protectionItemQuantity); + + allProtectionItemHardwood.setId(treeSapling.protectionItemId); + allProtectionItemHardwood.setName(itemManager.getItemComposition(treeSapling.protectionItemId).getName()); + allProtectionItemHardwood.setQuantity(treeSapling.protectionItemQuantity); + } +} diff --git a/src/main/java/com/questhelper/questinfo/QuestHelperQuest.java b/src/main/java/com/questhelper/questinfo/QuestHelperQuest.java index d3e15e1e11..6ca0f5f7d7 100644 --- a/src/main/java/com/questhelper/questinfo/QuestHelperQuest.java +++ b/src/main/java/com/questhelper/questinfo/QuestHelperQuest.java @@ -77,8 +77,9 @@ import com.questhelper.helpers.miniquests.hisfaithfulservants.BarrowsHelper; import com.questhelper.helpers.miniquests.hisfaithfulservants.HisFaithfulServants; import com.questhelper.helpers.mischelpers.allneededitems.AllNeededItems; -import com.questhelper.helpers.mischelpers.herbrun.HerbRun; import com.questhelper.helpers.mischelpers.strongholdofsecurity.StrongholdOfSecurity; +import com.questhelper.helpers.mischelpers.farmruns.HerbRun; +import com.questhelper.helpers.mischelpers.farmruns.TreeRun; import com.questhelper.helpers.quests.akingdomdivided.AKingdomDivided; import com.questhelper.helpers.miniquests.alfredgrimhandsbarcrawl.AlfredGrimhandsBarcrawl; import com.questhelper.helpers.quests.anightatthetheatre.ANightAtTheTheatre; @@ -635,6 +636,7 @@ public enum QuestHelperQuest DAG_ROUTE(new DagRouteHelper(), "Dagannoth Kings Route", QuestVarbits.QUEST_THE_FREMENNIK_ISLES, -1, QuestDetails.Type.GENERIC, QuestDetails.Difficulty.GENERIC), HERB_RUN(new HerbRun(), "Herb run", QuestVarbits.CUTSCENE, -1, QuestDetails.Type.GENERIC, QuestDetails.Difficulty.GENERIC), + TREE_RUN(new TreeRun(), "Tree run", QuestVarbits.CUTSCENE, -1, QuestDetails.Type.GENERIC, QuestDetails.Difficulty.GENERIC), BARROWS_HELPER(new BarrowsHelper(), "Barrows helper", QuestVarbits.CUTSCENE, -1, QuestDetails.Type.GENERIC, QuestDetails.Difficulty.GENERIC), STRONGHOLD_OF_SECURITY(new StrongholdOfSecurity(), "Stronghold of Security", QuestVarbits.STRONGHOLD_OF_SECURITY, 1, QuestDetails.Type.GENERIC, QuestDetails.Difficulty.GENERIC), diff --git a/src/main/java/com/questhelper/steps/QuestStep.java b/src/main/java/com/questhelper/steps/QuestStep.java index a6c50160c4..acb670ba06 100644 --- a/src/main/java/com/questhelper/steps/QuestStep.java +++ b/src/main/java/com/questhelper/steps/QuestStep.java @@ -392,6 +392,11 @@ public void addWidgetHighlightWithItemIdRequirement(int groupID, int childID, in widgetsToHighlight.add(new WidgetHighlight(groupID, childID, itemID, checkChildren)); } + public void addWidgetHighlightWithTextRequirement(int groupID, int childID, String requiredText, boolean checkChildren) + { + widgetsToHighlight.add(new WidgetHighlight(groupID, childID, requiredText, checkChildren)); + } + public void makeOverlayHint(PanelComponent panelComponent, QuestHelperPlugin plugin, @NonNull List additionalText, @NonNull List additionalRequirements) { addTitleToPanel(panelComponent); diff --git a/src/main/java/com/questhelper/steps/widget/WidgetHighlight.java b/src/main/java/com/questhelper/steps/widget/WidgetHighlight.java index b3832378ce..cb432f4471 100644 --- a/src/main/java/com/questhelper/steps/widget/WidgetHighlight.java +++ b/src/main/java/com/questhelper/steps/widget/WidgetHighlight.java @@ -43,6 +43,9 @@ public class WidgetHighlight extends AbstractWidgetHighlight @Getter protected Integer itemIdRequirement; + @Getter + protected String requiredText; + protected final boolean checkChildren; public WidgetHighlight(int groupId, int childId) @@ -70,6 +73,15 @@ public WidgetHighlight(int groupId, int childId, int itemIdRequirement, boolean this.checkChildren = checkChildren; } + public WidgetHighlight(int groupId, int childId, String requiredText, boolean checkChildren) + { + this.groupId = groupId; + this.childId = childId; + this.childChildId = -1; + this.requiredText = requiredText; + this.checkChildren = checkChildren; + } + @Override public void highlightChoices(Graphics2D graphics, Client client, QuestHelperPlugin questHelper) { @@ -111,7 +123,10 @@ private void highlightChoices(Widget parentWidget, Graphics2D graphics, QuestHel @Override protected void highlightWidget(Graphics2D graphics, QuestHelperPlugin questHelper, Widget widgetToHighlight) { - if (widgetToHighlight == null || (itemIdRequirement != null && widgetToHighlight.getItemId() != itemIdRequirement)) return; + if (widgetToHighlight == null || + (itemIdRequirement != null && widgetToHighlight.getItemId() != itemIdRequirement) || + (requiredText != null && (widgetToHighlight.getText() == null || !widgetToHighlight.getText().contains(requiredText))) + ) return; super.highlightWidget(graphics, questHelper, widgetToHighlight); } diff --git a/src/main/java/com/questhelper/tools/QuestHelperWorldMapPoint.java b/src/main/java/com/questhelper/tools/QuestHelperWorldMapPoint.java index 71f0613315..65702b296a 100644 --- a/src/main/java/com/questhelper/tools/QuestHelperWorldMapPoint.java +++ b/src/main/java/com/questhelper/tools/QuestHelperWorldMapPoint.java @@ -80,7 +80,6 @@ public QuestHelperWorldMapPoint(final WorldPoint worldPoint, BufferedImage image public void onWorldMapAreaChanged(WorldMapAreaChanged worldMapAreaChanged) { - System.out.println(worldMapArea); if (worldMapArea != null && worldMapArea != WorldMapArea.ANY && worldMapArea != worldMapAreaChanged.getWorldMapArea()) diff --git a/src/test/java/com/questhelper/MockedTest.java b/src/test/java/com/questhelper/MockedTest.java index 2ec36ee684..36a98c0d12 100644 --- a/src/test/java/com/questhelper/MockedTest.java +++ b/src/test/java/com/questhelper/MockedTest.java @@ -31,6 +31,7 @@ import com.questhelper.runeliteobjects.extendedruneliteobjects.RuneliteObjectManager; import com.questhelper.statemanagement.PlayerStateManager; import net.runelite.api.Client; +import net.runelite.api.ItemComposition; import net.runelite.client.callback.ClientThread; import net.runelite.client.callback.Hooks; import net.runelite.client.chat.ChatMessageManager; @@ -40,9 +41,10 @@ import net.runelite.client.ui.ClientToolbar; import net.runelite.client.ui.overlay.OverlayManager; import org.junit.jupiter.api.BeforeEach; -import org.mockito.Mockito; +import static org.mockito.ArgumentMatchers.anyInt; import javax.inject.Named; import java.util.concurrent.ScheduledExecutorService; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -52,49 +54,49 @@ public abstract class MockedTest extends MockedTestBase { @Bind - protected Client client = Mockito.mock(Client.class); + protected Client client = mock(Client.class); @Bind - protected ConfigManager configManager = Mockito.mock(ConfigManager.class); + protected ConfigManager configManager = mock(ConfigManager.class); @Bind - protected ChatMessageManager chatMessageManager = Mockito.mock(ChatMessageManager.class); + protected ChatMessageManager chatMessageManager = mock(ChatMessageManager.class); @Bind - protected ItemManager itemManager = Mockito.mock(ItemManager.class); + protected ItemManager itemManager = mock(ItemManager.class); @Bind - protected OverlayManager overlayManager = Mockito.mock(OverlayManager.class); + protected OverlayManager overlayManager = mock(OverlayManager.class); @Bind - protected QuestHelperConfig questHelperConfig = Mockito.mock(QuestHelperConfig.class); + protected QuestHelperConfig questHelperConfig = mock(QuestHelperConfig.class); @Bind - protected QuestOverlayManager questOverlayManager = Mockito.mock(QuestOverlayManager.class); + protected QuestOverlayManager questOverlayManager = mock(QuestOverlayManager.class); @Bind - protected RuneliteObjectManager runeliteObjectManager = Mockito.mock(RuneliteObjectManager.class); + protected RuneliteObjectManager runeliteObjectManager = mock(RuneliteObjectManager.class); @Bind - protected Hooks hooks = Mockito.mock(Hooks.class); + protected Hooks hooks = mock(Hooks.class); @Bind - protected PlayerStateManager playerStateManager = Mockito.mock(PlayerStateManager.class); + protected PlayerStateManager playerStateManager = mock(PlayerStateManager.class); @Bind - protected QuestHelperPlugin questHelperPlugin = Mockito.mock(QuestHelperPlugin.class); + protected QuestHelperPlugin questHelperPlugin = mock(QuestHelperPlugin.class); @Bind - protected ClientToolbar clientToolbar = Mockito.mock(ClientToolbar.class); + protected ClientToolbar clientToolbar = mock(ClientToolbar.class); @Bind - protected ClientThread clientThread = Mockito.mock(ClientThread.class); + protected ClientThread clientThread = mock(ClientThread.class); @Bind - protected EventBus eventBus = Mockito.mock(EventBus.class); + protected EventBus eventBus = mock(EventBus.class); @Bind - protected ScheduledExecutorService scheduledExecutorService = Mockito.mock(ScheduledExecutorService.class); + protected ScheduledExecutorService scheduledExecutorService = mock(ScheduledExecutorService.class); @Bind @Named("developerMode") @@ -109,6 +111,10 @@ protected void setUp() when(questHelperPlugin.getPlayerStateManager()).thenReturn(playerStateManager); when(playerStateManager.getAccountType()).thenReturn(AccountType.NORMAL); + ItemComposition item = mock(ItemComposition.class); + when(item.getName()).thenReturn("TestName"); + when(itemManager.getItemComposition(anyInt())).thenReturn(item); + // init client mocks // when(client.getWorldType()).thenReturn(EnumSet.noneOf(WorldType.class)); }