Skip to content

Commit

Permalink
Merge branch 'refs/heads/beta' into base-stats
Browse files Browse the repository at this point in the history
  • Loading branch information
hannibal002 committed Jan 11, 2025
2 parents 16474f2 + 20d661b commit 8ca5c90
Show file tree
Hide file tree
Showing 37 changed files with 465 additions and 400 deletions.
7 changes: 5 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,18 @@ format like "- #821" to illustrate the dependency.
- Mods that have reached their end of life. (Rip SBA, Dulkir and Soopy).
- The mod has, according to Hypixel rules, illegal features ("cheat mod/client").
- If you can improve the existing feature in a meaningful way.
- All new classes should be written in Kotlin, with one exception:
- All new classes should be written in Kotlin, with a few exceptions:
- Config files in `at.hannibal2.skyhanni.config.features`
- Mixin classes in `at.hannibal2.skyhanni.mixins.transformers`
- New features should be made in Kotlin objects unless there is a specific reason for it not to.
- If the feature needs to use forge events or a repo pattern, annotate it with `@SkyHanniModule`
- This will automatically register it to the forge event bus and load the repo patterns
- Avoid using deprecated functions.
- These functions are marked for removal in future versions.
- If you're unsure why a function is deprecated or how to replace it, please ask for guidance.
- JSON data objects are made in kotlin and put into the directory `at.hannibal2.skyhanni.data.jsonobjects`
- Future JSON data objects should be made in kotlin and placed in the directory `at.hannibal2.skyhanni.data.jsonobjects`
- Config files should be made in **Kotlin**.
- There may be legacy config files left as Java files, however they will all be ported eventually.
- Please use the existing event system, or expand on it. Do not use Forge events.
- (We inject the calls with Mixin)
- Please use existing utils methods.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import at.hannibal2.skyhanni.config.ConfigManager
import at.hannibal2.skyhanni.config.commands.CommandCategory
import at.hannibal2.skyhanni.config.commands.CommandRegistrationEvent
import at.hannibal2.skyhanni.data.jsonobjects.repo.neu.NeuPetsJson
import at.hannibal2.skyhanni.events.HypixelJoinEvent
import at.hannibal2.skyhanni.events.NeuRepositoryReloadEvent
import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule
import at.hannibal2.skyhanni.test.command.ErrorManager
Expand Down Expand Up @@ -363,6 +364,19 @@ object EnoughUpdatesManager {
}
}

private fun itemCountInRepoFolder(): Int {
val itemsFolder = File(repoLocation, "items")
return itemsFolder.listFiles()?.size ?: 0
}

@HandleEvent
fun onHypixelJoin(event: HypixelJoinEvent) {
if (itemMap.isEmpty() && itemCountInRepoFolder() > 0) {
reloadRepo()
println("No loaded items in NEU repo, attempting to reload the repo.")
}
}

@HandleEvent
fun onNeuRepoReload(event: NeuRepositoryReloadEvent) {
neuPetsJson = event.readConstant<NeuPetsJson>("pets")
Expand All @@ -385,5 +399,23 @@ object EnoughUpdatesManager {
callback { downloadRepo() }
}
}

event.register("shneurepostatus") {
description = "Get the status of the NEU repo"
category = CommandCategory.DEVELOPER_TEST
callback {
val loadedItems = itemMap.size
val directorySize = itemCountInRepoFolder()

ChatUtils.chat("NEU Repo Status:")
when {
directorySize == 0 -> ChatUtils.chat("§cNo items directory found!", prefix = false)
loadedItems == 0 -> ChatUtils.chat("§cNo items loaded!", prefix = false)
loadedItems < directorySize -> ChatUtils.chat("§eLoaded $loadedItems/$directorySize items", prefix = false)
loadedItems > directorySize -> ChatUtils.chat("§eLoaded Items: $loadedItems (more than directory size)", prefix = false)
else -> ChatUtils.chat("§aLoaded all $loadedItems items!", prefix = false)
}
}
}
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package at.hannibal2.skyhanni.config.features.slayer

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.ConfigEditorSlider
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption

class ItemsOnGroundConfig {
@Expose
@ConfigOption(
name = "Enabled",
desc = "Show the name and price of items laying on the ground. §cOnly in slayer areas!"
)
@ConfigEditorBoolean
@FeatureToggle
var enabled: Boolean = true

@Expose
@ConfigOption(name = "Minimum Price", desc = "Items below this price will be ignored.")
@ConfigEditorSlider(minValue = 1f, maxValue = 1000000f, minStep = 1f)
var minimumPrice: Int = 50000
}
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
package at.hannibal2.skyhanni.config.features.slayer;
package at.hannibal2.skyhanni.config.features.slayer

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.ConfigLink;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;

public class RngMeterDisplayConfig {
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.ConfigLink
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption

class RngMeterDisplayConfig {
@Expose
@ConfigOption(name = "Enabled", desc = "Display amount of bosses needed until next RNG meter drop.")
@ConfigEditorBoolean
@FeatureToggle
public boolean enabled = true;
var enabled: Boolean = true

@Expose
@ConfigOption(name = "Warn Empty", desc = "Warn when no item is set in the RNG Meter.")
@ConfigEditorBoolean
public boolean warnEmpty = false;
var warnEmpty: Boolean = false

@Expose
@ConfigOption(name = "Hide Chat", desc = "Hide the RNG meter message from chat if current item is selected.")
@ConfigEditorBoolean
public boolean hideChat = true;
var hideChat: Boolean = true

@Expose
@ConfigLink(owner = RngMeterDisplayConfig.class, field = "enabled")
public Position pos = new Position(410, 110, false, true);

@ConfigLink(owner = RngMeterDisplayConfig::class, field = "enabled")
var pos: Position = Position(410, 110, false, true)
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package at.hannibal2.skyhanni.config.features.slayer

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.ConfigEditorSlider
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption

class SlayerBossWarningConfig {
@Expose
@ConfigOption(name = "Enabled", desc = "Send a title when your boss is about to spawn.")
@ConfigEditorBoolean
@FeatureToggle
var enabled: Boolean = false

@Expose
@ConfigOption(name = "Percent", desc = "The percentage at which the title and sound should be sent.")
@ConfigEditorSlider(minStep = 1f, minValue = 50f, maxValue = 90f)
var percent: Int = 80

@Expose
@ConfigOption(
name = "Repeat",
desc = "Resend the title and sound on every kill after reaching the configured percent value."
)
@ConfigEditorBoolean
var repeat: Boolean = false
}
Original file line number Diff line number Diff line change
@@ -1,85 +1,94 @@
package at.hannibal2.skyhanni.config.features.slayer;
package at.hannibal2.skyhanni.config.features.slayer

import at.hannibal2.skyhanni.config.FeatureToggle;
import at.hannibal2.skyhanni.config.features.slayer.blaze.BlazeConfig;
import at.hannibal2.skyhanni.config.features.slayer.endermen.EndermanConfig;
import at.hannibal2.skyhanni.config.features.slayer.vampire.VampireConfig;
import com.google.gson.annotations.Expose;
import io.github.notenoughupdates.moulconfig.annotations.Accordion;
import io.github.notenoughupdates.moulconfig.annotations.Category;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;

public class SlayerConfig {
import at.hannibal2.skyhanni.config.FeatureToggle
import at.hannibal2.skyhanni.config.features.slayer.blaze.BlazeConfig
import at.hannibal2.skyhanni.config.features.slayer.endermen.EndermanConfig
import at.hannibal2.skyhanni.config.features.slayer.vampire.VampireConfig
import com.google.gson.annotations.Expose
import io.github.notenoughupdates.moulconfig.annotations.Accordion
import io.github.notenoughupdates.moulconfig.annotations.Category
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption

class SlayerConfig {
// TODO rename to "enderman"
@Expose
@Category(name = "Enderman", desc = "Enderman Slayer Feature")
@Accordion
// TODO rename to "enderman"
public EndermanConfig endermen = new EndermanConfig();
var endermen: EndermanConfig = EndermanConfig()

// TODO rename to "blaze"
@Expose
@Category(name = "Blaze", desc = "Blaze Slayer Features")
// TODO rename to "blaze"
public BlazeConfig blazes = new BlazeConfig();
var blazes: BlazeConfig = BlazeConfig()

@Expose
@Category(name = "Vampire", desc = "Vampire Slayer Features")
public VampireConfig vampire = new VampireConfig();
var vampire: VampireConfig = VampireConfig()

@Expose
@ConfigOption(name = "Item Profit Tracker", desc = "")
@Accordion
public ItemProfitTrackerConfig itemProfitTracker = new ItemProfitTrackerConfig();
var itemProfitTracker: SlayerProfitTrackerConfig = SlayerProfitTrackerConfig()

@Expose
@ConfigOption(name = "Items on Ground", desc = "")
@Accordion
public ItemsOnGroundConfig itemsOnGround = new ItemsOnGroundConfig();
var itemsOnGround: ItemsOnGroundConfig = ItemsOnGroundConfig()

@Expose
@ConfigOption(name = "RNG Meter Display", desc = "")
@Accordion
public RngMeterDisplayConfig rngMeterDisplay = new RngMeterDisplayConfig();
var rngMeterDisplay: RngMeterDisplayConfig = RngMeterDisplayConfig()

@Expose
@ConfigOption(name = "Boss Spawn Warning", desc = "")
@Accordion
public SlayerBossWarningConfig slayerBossWarning = new SlayerBossWarningConfig();
var slayerBossWarning: SlayerBossWarningConfig = SlayerBossWarningConfig()

@Expose
@ConfigOption(name = "Miniboss Highlight", desc = "Highlight Slayer Mini-Boss in blue color.")
@ConfigEditorBoolean
@FeatureToggle
public boolean slayerMinibossHighlight = false;
var slayerMinibossHighlight: Boolean = false

@Expose
@ConfigOption(name = "Line to Miniboss", desc = "Add a line to every Slayer Mini-Boss around you.")
@ConfigEditorBoolean
@FeatureToggle
public boolean slayerMinibossLine = false;
var slayerMinibossLine: Boolean = false

@Expose
@ConfigOption(name = "Line to Miniboss Width", desc = "The width of the line pointing to every Slayer Mini-Boss around you.")
@ConfigEditorSlider(minStep = 1, minValue = 1, maxValue = 10)
public int slayerMinibossLineWidth = 3;
@ConfigOption(
name = "Line to Miniboss Width",
desc = "The width of the line pointing to every Slayer Mini-Boss around you."
)
@ConfigEditorSlider(minStep = 1f, minValue = 1f, maxValue = 10f)
var slayerMinibossLineWidth: Int = 3

@Expose
@ConfigOption(name = "Hide Mob Names", desc = "Hide the name of the mobs you need to kill in order for the Slayer boss to spawn. Exclude mobs that are damaged, corrupted, runic or semi rare.")
@ConfigOption(
name = "Hide Mob Names",
desc = "Hide the name of the mobs you need to kill in order for the Slayer boss to spawn. " +
"Exclude mobs that are damaged, corrupted, runic or semi rare."
)
@ConfigEditorBoolean
@FeatureToggle
public boolean hideMobNames = false;
var hideMobNames: Boolean = false

@Expose
@ConfigOption(name = "Quest Warning", desc = "Warn when wrong Slayer quest is selected, or killing mobs for the wrong Slayer.")
@ConfigOption(
name = "Quest Warning",
desc = "Warn when wrong Slayer quest is selected, or killing mobs for the wrong Slayer."
)
@ConfigEditorBoolean
@FeatureToggle
public boolean questWarning = true;
var questWarning: Boolean = true

@Expose
@ConfigOption(name = "Quest Warning Title", desc = "Send a title when warning.")
@ConfigEditorBoolean
@FeatureToggle
public boolean questWarningTitle = true;
var questWarningTitle: Boolean = true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package at.hannibal2.skyhanni.config.features.slayer

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.ConfigLink
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption

class SlayerProfitTrackerConfig {
@Expose
@ConfigOption(
name = "Enabled",
desc = "Count all items you pick up while doing slayer, " +
"keeping track of how much you pay for starting slayers and calculating the overall profit."
)
@ConfigEditorBoolean
@FeatureToggle
var enabled: Boolean = true

@Expose
@ConfigLink(owner = SlayerProfitTrackerConfig::class, field = "enabled")
var pos: Position = Position(20, 20, false, true)
}
Loading

0 comments on commit 8ca5c90

Please sign in to comment.