Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Feature: Crystal Nucleus Tracker, Profit-Per, and Filter #2285

Open
wants to merge 34 commits into
base: beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f3ae2ba
WIP, profit per functional
DavidArthurCole Aug 1, 2024
2bcc322
Ignore both powders
DavidArthurCole Aug 1, 2024
f3a9090
Cleanup
DavidArthurCole Aug 1, 2024
65592d1
Progress on tracker, rework API
DavidArthurCole Aug 1, 2024
7a5690e
Sto progress
DavidArthurCole Aug 2, 2024
0e08e6d
Everything except chat filter done
DavidArthurCole Aug 2, 2024
81438a7
All features functional
DavidArthurCole Aug 2, 2024
88d134c
Update end pattern and formatting
DavidArthurCole Aug 2, 2024
16d68da
Add key and robot parts to tracker
DavidArthurCole Aug 2, 2024
a96ffa8
Formatting
DavidArthurCole Aug 2, 2024
a79e4d6
last formatting one
DavidArthurCole Aug 2, 2024
91c56c5
Merge branch 'hannibal002:beta' into NucleusTracker
DavidArthurCole Aug 2, 2024
eab8c9d
More formattin'
DavidArthurCole Aug 4, 2024
ed86bfc
Merge branch 'hannibal002:beta' into NucleusTracker
DavidArthurCole Aug 17, 2024
a1e33a3
Merge branch 'hannibal002:beta' into NucleusTracker
DavidArthurCole Aug 21, 2024
06ecb91
Merge branch 'hannibal002:beta' into NucleusTracker
DavidArthurCole Aug 26, 2024
4ed59d7
Merge branch 'hannibal002:beta' into NucleusTracker
DavidArthurCole Aug 26, 2024
7777d8b
Merge branch 'hannibal002:beta' into NucleusTracker
DavidArthurCole Aug 26, 2024
648de97
Merge branch 'beta' into NucleusTracker
DavidArthurCole Aug 26, 2024
5c9f09e
Merge branch 'hannibal002:beta' into NucleusTracker
DavidArthurCole Sep 9, 2024
286ca36
Update tracker to use Searchables, new syntaxes
DavidArthurCole Sep 9, 2024
7c1d3ad
Merge branch 'beta' into NucleusTracker
DavidArthurCole Sep 10, 2024
7535849
Merge branch 'beta' into NucleusTracker
CalMWolfs Sep 11, 2024
b54cac1
Merge branch 'beta' into NucleusTracker
DavidArthurCole Sep 13, 2024
800905d
I'm not even sure how that one happened
DavidArthurCole Sep 13, 2024
444b8df
Merge branch 'hannibal002:beta' into NucleusTracker
DavidArthurCole Sep 14, 2024
0489e23
Merge branch 'hannibal002:beta' into NucleusTracker
DavidArthurCole Sep 25, 2024
1e72010
Merge branch 'beta' into NucleusTracker
DavidArthurCole Sep 26, 2024
7bebac1
Merge branch 'beta' into NucleusTracker
DavidArthurCole Sep 30, 2024
41cd33a
merge
DavidArthurCole Sep 30, 2024
f472ed4
Address TODO
DavidArthurCole Sep 30, 2024
ec451df
Merge branch 'beta' into NucleusTracker
DavidArthurCole Oct 3, 2024
88bc64f
Merge branch 'beta' into NucleusTracker
DavidArthurCole Oct 13, 2024
fdfec98
Fixes & improvements
DavidArthurCole Oct 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactor
import at.hannibal2.skyhanni.features.inventory.experimentationtable.ExperimentsProfitTracker
import at.hannibal2.skyhanni.features.mining.KingTalismanHelper
import at.hannibal2.skyhanni.features.mining.MineshaftPityDisplay
import at.hannibal2.skyhanni.features.mining.fossilexcavator.ExcavatorProfitTracker
import at.hannibal2.skyhanni.features.mining.crystalhollows.CrystalNucleusTracker
import at.hannibal2.skyhanni.features.mining.glacitemineshaft.CorpseTracker
import at.hannibal2.skyhanni.features.mining.fossilexcavator.ExcavatorProfitTracker
import at.hannibal2.skyhanni.features.mining.powdertracker.PowderTracker
import at.hannibal2.skyhanni.features.minion.MinionFeatures
import at.hannibal2.skyhanni.features.misc.CarryTracker
Expand Down Expand Up @@ -396,6 +397,11 @@ object Commands {
category = CommandCategory.USERS_RESET
callback { ExcavatorProfitTracker.resetCommand() }
}
event.register("shresetcrystalnucleustracker") {
description = "Resets the Crystal Nucleus Tracker"
category = CommandCategory.USERS_RESET
callback { CrystalNucleusTracker.resetCommand() }
}

// non trackers
event.register("shresetghostcounter") {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package at.hannibal2.skyhanni.config.features.chat;

import at.hannibal2.skyhanni.config.FeatureToggle;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDraggableList;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class CrystalNucleusConfig {

@Expose
@ConfigOption(name = "Enabled", desc = "Hide or compact messages relating to Crystal Nucleus runs in the Crystal Hollows.")
@ConfigEditorBoolean
@FeatureToggle
public boolean enabled = false;

public enum CrystalNucleusMessageTypes {
RUN_COMPLETED("§5Run Completed Summary"),
CRYSTAL_COLLECTED("§aC§6r§dy§bs§et§aa§6l §7Collected"),
CRYSTAL_PLACED("§aC§6r§dy§bs§et§aa§6l §7Placed"),
NPC_DIVAN_KEEPERS("§e[NPC] §6Keepers §7(§2Mines of Divan§7)"),
NPC_PROF_ROBOT("§e[NPC] Professor Robot"),
NPC_KING_YOLKAR("§e[NPC] §6King Yolkar"),
NON_TOOL_SCAVENGE("§7Non-Tool §cMetal Detector §7loot")
;

private final String name;

CrystalNucleusMessageTypes(String name) {
this.name = name;
}

@Override
public String toString() {
return name;
}
}

@Expose
@ConfigOption(name = "Modified Messages", desc = "Messages that should be hidden or compacted.\n§cImportant information will still appear§7.")
@ConfigEditorDraggableList
public List<CrystalNucleusMessageTypes> modifiedMessages = new ArrayList<>(Arrays.asList(
CrystalNucleusMessageTypes.CRYSTAL_COLLECTED,
CrystalNucleusMessageTypes.CRYSTAL_PLACED,
CrystalNucleusMessageTypes.RUN_COMPLETED,
CrystalNucleusMessageTypes.NPC_DIVAN_KEEPERS,
CrystalNucleusMessageTypes.NPC_PROF_ROBOT,
CrystalNucleusMessageTypes.NPC_KING_YOLKAR,
CrystalNucleusMessageTypes.NON_TOOL_SCAVENGE
));
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ public class FilterTypesConfig {
@Expose
@ConfigOption(name = "Powder Mining", desc = "")
@Accordion
public PowderMiningFilterConfig powderMiningFilter = new PowderMiningFilterConfig();
public PowderMiningConfig powderMining = new PowderMiningConfig();

@Expose
@ConfigOption(name = "Crystal Nucleus", desc = "")
@Accordion
public CrystalNucleusConfig crystalNucleus = new CrystalNucleusConfig();

@Expose
@ConfigOption(name = "Hypixel Lobbies", desc = "Hide announcements in Hypixel lobbies " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
import java.util.Arrays;
import java.util.List;

import static at.hannibal2.skyhanni.config.features.chat.PowderMiningFilterConfig.SimplePowderMiningRewardTypes.ASCENSION_ROPE;
import static at.hannibal2.skyhanni.config.features.chat.PowderMiningFilterConfig.SimplePowderMiningRewardTypes.JUNGLE_HEART;
import static at.hannibal2.skyhanni.config.features.chat.PowderMiningFilterConfig.SimplePowderMiningRewardTypes.OIL_BARREL;
import static at.hannibal2.skyhanni.config.features.chat.PowderMiningFilterConfig.SimplePowderMiningRewardTypes.SLUDGE_JUICE;
import static at.hannibal2.skyhanni.config.features.chat.PowderMiningFilterConfig.SimplePowderMiningRewardTypes.TREASURITE;
import static at.hannibal2.skyhanni.config.features.chat.PowderMiningFilterConfig.SimplePowderMiningRewardTypes.WISHING_COMPASS;
import static at.hannibal2.skyhanni.config.features.chat.PowderMiningFilterConfig.SimplePowderMiningRewardTypes.YOGGIE;

public class PowderMiningFilterConfig {
import static at.hannibal2.skyhanni.config.features.chat.PowderMiningConfig.SimplePowderMiningRewardTypes.ASCENSION_ROPE;
import static at.hannibal2.skyhanni.config.features.chat.PowderMiningConfig.SimplePowderMiningRewardTypes.JUNGLE_HEART;
import static at.hannibal2.skyhanni.config.features.chat.PowderMiningConfig.SimplePowderMiningRewardTypes.OIL_BARREL;
import static at.hannibal2.skyhanni.config.features.chat.PowderMiningConfig.SimplePowderMiningRewardTypes.SLUDGE_JUICE;
import static at.hannibal2.skyhanni.config.features.chat.PowderMiningConfig.SimplePowderMiningRewardTypes.TREASURITE;
import static at.hannibal2.skyhanni.config.features.chat.PowderMiningConfig.SimplePowderMiningRewardTypes.WISHING_COMPASS;
import static at.hannibal2.skyhanni.config.features.chat.PowderMiningConfig.SimplePowderMiningRewardTypes.YOGGIE;

public class PowderMiningConfig {
@Expose
@ConfigOption(name = "Enabled", desc = "Hide messages while opening chests in the Crystal Hollows.")
@ConfigEditorBoolean
Expand All @@ -34,15 +34,15 @@ public class PowderMiningFilterConfig {
"\n§a0§7: §aShow all\n§c60000§7: §cHide all"
)
@ConfigEditorSlider(minValue = 0, maxValue = 60000, minStep = 500)
public int powderFilterThreshold = 1000;
public int powderThreshold = 1000;

@Expose
@ConfigOption(
name = "Essence", desc = "Hide §6Gold §7and §bDiamond §7Essence rewards under a certain amount." +
"\n§a0§7: §aShow all\n§c20§7: §cHide all"
)
@ConfigEditorSlider(minValue = 0, maxValue = 20, minStep = 1)
public int essenceFilterThreshold = 5;
public int essenceThreshold = 5;

public enum SimplePowderMiningRewardTypes {

Expand Down Expand Up @@ -86,9 +86,9 @@ public String toString() {
@Expose
@ConfigOption(name = "Goblin Egg", desc = "Hide Goblin Egg rewards that are below a certain rarity.")
@ConfigEditorDropdown
public GoblinEggFilterEntry goblinEggs = GoblinEggFilterEntry.YELLOW_UP;
public GoblinEggEntry goblinEggs = GoblinEggEntry.YELLOW_UP;

public enum GoblinEggFilterEntry {
public enum GoblinEggEntry {
SHOW_ALL("Show all"),
HIDE_ALL("Hide all"),
GREEN_UP("Show §aGreen §7and up"),
Expand All @@ -98,7 +98,7 @@ public enum GoblinEggFilterEntry {

private final String name;

GoblinEggFilterEntry(String name) {
GoblinEggEntry(String name) {
this.name = name;
}

Expand All @@ -111,7 +111,6 @@ public String toString() {
@Expose
@ConfigOption(name = "Gemstones", desc = "")
@Accordion
// TODO rename to "gemstoneFilter"
public PowderMiningGemstoneFilterConfig gemstoneFilterConfig = new PowderMiningGemstoneFilterConfig();
public PowderMiningGemstoneConfig gemstone = new PowderMiningGemstoneConfig();

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDropdown;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;

public class PowderMiningGemstoneFilterConfig {
public class PowderMiningGemstoneConfig {

@Expose
@ConfigOption(name = "Stronger Tool Messages", desc = "Hide 'You need a stronger tool..' messages.")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package at.hannibal2.skyhanni.config.features.mining;

import at.hannibal2.skyhanni.config.FeatureToggle;
import at.hannibal2.skyhanni.config.core.config.Position;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider;
import io.github.notenoughupdates.moulconfig.annotations.ConfigLink;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;

public class CrystalNucleusTrackerConfig {
@Expose
@ConfigOption(name = "Enabled", desc = "Enable the Crystal Nucleus Tracker overlay.")
@ConfigEditorBoolean
@FeatureToggle
public boolean enabled = false;

@Expose
@ConfigLink(owner = CrystalNucleusTrackerConfig.class, field = "enabled")
public Position position = new Position(20, 20, false, true);

@Expose
@ConfigOption(name = "Hide in Chocolate Factory", desc = "Hide tracker while the Chocolate Factory is open.")
@ConfigEditorBoolean
public boolean hideInCf = true;

@Expose
@ConfigOption(name = "Show Outside of Nucleus", desc = "Show the tracker anywhere in the Crystal Hollows.")
@ConfigEditorBoolean
public boolean showOutsideNucleus = false;

@Expose
@ConfigOption(name = "Profit Per", desc = "Show profit summary message for the completed nucleus run.")
@ConfigEditorBoolean
public boolean profitPer = true;

@Expose
@ConfigOption(name = "Profit Per Minimum", desc = "Only show items above this coin amount in the summary message hover.")
@ConfigEditorSlider(minValue = 0, maxValue = 1000000, minStep = 5000)
public int profitPerMinimum = 20000;
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public class MiningConfig {
@Accordion
public AreaWallsConfig crystalHollowsAreaWalls = new AreaWallsConfig();

@Expose
@ConfigOption(name = "Crystal Nucleus Tracker", desc = "")
@Accordion
public CrystalNucleusTrackerConfig crystalNucleusTracker = new CrystalNucleusTrackerConfig();

@Expose
@ConfigOption(name = "Cold Overlay", desc = "")
@Accordion
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import at.hannibal2.skyhanni.features.inventory.experimentationtable.ExperimentsProfitTracker;
import at.hannibal2.skyhanni.features.inventory.wardrobe.WardrobeAPI;
import at.hannibal2.skyhanni.features.mining.MineshaftPityDisplay;
import at.hannibal2.skyhanni.features.mining.crystalhollows.CrystalNucleusTracker;
import at.hannibal2.skyhanni.features.mining.fossilexcavator.ExcavatorProfitTracker;
import at.hannibal2.skyhanni.features.mining.glacitemineshaft.CorpseTracker;
import at.hannibal2.skyhanni.features.mining.powdertracker.PowderTracker;
Expand Down Expand Up @@ -617,6 +618,9 @@ public static class MineshaftStorage {
@Expose
public CorpseTracker.BucketData corpseProfitTracker = new CorpseTracker.BucketData();
}

@Expose
public CrystalNucleusTracker.Data crystalNucleusTracker = new CrystalNucleusTracker.Data();
}

@Expose
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package at.hannibal2.skyhanni.events.mining;
DavidArthurCole marked this conversation as resolved.
Show resolved Hide resolved

import at.hannibal2.skyhanni.api.event.SkyHanniEvent

class CrystalNucleusLootEvent(val loot: List<Pair<String, Int>>) : SkyHanniEvent()
20 changes: 19 additions & 1 deletion src/main/java/at/hannibal2/skyhanni/features/chat/ChatFilter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import at.hannibal2.skyhanni.utils.StringUtils
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraft.util.ChatComponentText
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import tv.twitch.chat.Chat
import java.util.regex.Pattern

@SkyHanniModule
Expand Down Expand Up @@ -513,7 +514,8 @@ object ChatFilter {
@SubscribeEvent
fun onChat(event: LorenzChatEvent) {
var blockReason = block(event.message)
if (blockReason == null && config.powderMiningFilter.enabled) blockReason = powderMiningBlock(event)
if (blockReason == null && config.powderMining.enabled) blockReason = powderMiningBlock(event)
if (blockReason == null && config.crystalNucleus.enabled) blockReason = crystalNucleusBlock(event)

event.blockedReason = blockReason ?: return
}
Expand Down Expand Up @@ -580,6 +582,20 @@ object ChatFilter {
return powderMiningMatchResult
}

/**
* Checks if the message is a blocked Crystal Nucleus Run message, as defined in CrystalNucleusChatFilter.
* Will conditionally modify/compact messages in some cases, or return a blocking code
* @param event The event to check
* @return Block reason if applicable
* @see block
*/
private fun crystalNucleusBlock(event: LorenzChatEvent): String? {
val (blockCode, newMessage) = CrystalNucleusChatFilter.block(event.message)?.getPair() ?: Pair(null, null)
newMessage?.let { event.chatComponent = ChatComponentText(it) }
blockCode?.let { return it }
return null
}

private var othersMsg: String? = null

/**
Expand Down Expand Up @@ -644,5 +660,7 @@ object ChatFilter {
}
}
}
event.move(61, "chat.filterType.powderMiningFilter", "chat.filterType.powderMining")
event.move(61, "chat.filterType.gemstoneFilterConfig", "chat.filterType.powderMining.gemstone")
}
}
Loading
Loading