Skip to content

Commit

Permalink
Feature + Improvement: Hoppity Event Card Live Display (#2749)
Browse files Browse the repository at this point in the history
Co-authored-by: CalMWolfs <[email protected]>
Co-authored-by: hannibal2 <[email protected]>
  • Loading branch information
3 people authored Nov 11, 2024
1 parent b2547ca commit db1e2fc
Show file tree
Hide file tree
Showing 17 changed files with 648 additions and 138 deletions.
4 changes: 3 additions & 1 deletion .idea/dictionaries/default_user.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import at.hannibal2.skyhanni.features.event.diana.MythologicalCreatureTracker
import at.hannibal2.skyhanni.features.event.hoppity.HoppityCollectionStats
import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggLocations
import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggLocator
import at.hannibal2.skyhanni.features.event.hoppity.HoppityEventSummary
import at.hannibal2.skyhanni.features.event.jerry.frozentreasure.FrozenTreasureTracker
import at.hannibal2.skyhanni.features.fishing.tracker.FishingProfitTracker
import at.hannibal2.skyhanni.features.fishing.tracker.SeaCreatureTracker
Expand Down Expand Up @@ -290,11 +289,6 @@ object Commands {
category = CommandCategory.USERS_ACTIVE
callback { PestFinder.teleportNearestInfestedPlot() }
}
event.register("shhoppitystats") {
description = "Look up stats for a Hoppity's Event (by SkyBlock year).\nRun standalone for a list of years that have stats."
category = CommandCategory.USERS_ACTIVE
callback { HoppityEventSummary.sendStatsMessage(it) }
}
event.register("shcolors") {
description = "Prints a list of all Minecraft color & formatting codes in chat."
category = CommandCategory.USERS_ACTIVE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class HoppityEggsConfig {
public HoppityCallWarningConfig hoppityCallWarning = new HoppityCallWarningConfig();

@Expose
@ConfigOption(name = "Event Summary", desc = "")
@ConfigOption(name = "Hoppity Hunt Stats Summary", desc = "")
@Accordion
public HoppityEventSummaryConfig eventSummary = new HoppityEventSummaryConfig();

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package at.hannibal2.skyhanni.config.features.event.hoppity;

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

public class HoppityEventSummaryCFReminderConfig {

@Expose
@ConfigOption(
name = "Enabled",
desc = "Periodically get reminded to switch to a new server to update your Chocolate Factory leaderboard position statistic."
)
@ConfigEditorBoolean
@FeatureToggle
public boolean enabled = false;

@Expose
@ConfigOption(
name = "Note",
desc = "§cNote§7: Reminders will only appear if you have added Leaderboard Change to your stat list."
)
@ConfigEditorInfoText
public boolean statListNote = false;

@Expose
@ConfigOption(name = "Reminder Interval", desc = "How often to remind you to switch servers, in minutes.")
@ConfigEditorSlider(minValue = 1, minStep = 1, maxValue = 120)
public int reminderInterval = 30;

@Expose
@ConfigOption(
name = "Show for Last X Hours",
desc = "Only show the reminder for the last X hours of the event.\n0: Off\n30: Entire event"
)
@ConfigEditorSlider(minValue = 0, minStep = 1, maxValue = 30)
public int showForLastXHours = 2;

}
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package at.hannibal2.skyhanni.config.features.event.hoppity;

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.Accordion;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDraggableList;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorInfoText;
import io.github.notenoughupdates.moulconfig.annotations.ConfigLink;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
import io.github.notenoughupdates.moulconfig.observer.Property;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -14,49 +18,61 @@
public class HoppityEventSummaryConfig {

@Expose
@ConfigOption(name = "Enabled", desc = "Show a summary of your Hoppity Hunt stats when the event is over.")
@ConfigOption(name = "Enabled", desc = "Show a summary of your Hoppity's Hunt stats when the event is over.")
@ConfigEditorBoolean
@FeatureToggle
public boolean enabled = true;

@Expose
@ConfigOption(
name = "Viewing Stats",
desc = "View current and past event stats at any time using §b/shhoppitystats§7."
)
@ConfigEditorInfoText
public String commandInfo;
@Accordion
@ConfigOption(name = "Live Display", desc = "")
public HoppityEventSummaryLiveDisplayConfig liveDisplay = new HoppityEventSummaryLiveDisplayConfig();

@Expose
@Accordion
@ConfigOption(name = "Update CF Reminders", desc = "")
public HoppityEventSummaryCFReminderConfig cfReminder = new HoppityEventSummaryCFReminderConfig();

@Expose
@ConfigLink(owner = HoppityEventSummaryConfig.class, field = "liveDisplay")
public Position liveDisplayPosition = new Position(0, 0);

@Expose
@ConfigOption(
name = "Stats List",
desc = "Drag text to change what displays in the summary card."
)
@ConfigEditorDraggableList
public List<HoppityStat> statDisplayList = new ArrayList<>(Arrays.asList(
public Property<List<HoppityStat>> statDisplayList = Property.of(new ArrayList<>(Arrays.asList(
HoppityStat.MEAL_EGGS_FOUND,
HoppityStat.HOPPITY_RABBITS_BOUGHT,
HoppityStat.SIDE_DISH_EGGS,
HoppityStat.MILESTONE_RABBITS,
HoppityStat.EMPTY_1,
HoppityStat.NEW_RABBITS,
HoppityStat.EMPTY_2,
HoppityStat.DUPLICATE_RABBITS
));
HoppityStat.DUPLICATE_RABBITS,
HoppityStat.EMPTY_3,
HoppityStat.TIME_IN_CF,
HoppityStat.RABBIT_THE_FISH_FINDS,
HoppityStat.LEADERBOARD_CHANGE
)));

public enum HoppityStat {
MEAL_EGGS_FOUND("§7You found §b45§7/§a47 §6Chocolate Meal Eggs§7."),
HOPPITY_RABBITS_BOUGHT("§7You bought §b7 §fRabbits §7from §aHoppity§7."),
SIDE_DISH_EGGS("§7You found §b4 §6§lSide Dish §r§6Eggs §7in the §6Chocolate Factory§7."),
SIDE_DISH_EGGS("§7You found §b4 §6§lSide Dish Eggs §r§7in the §6Chocolate Factory§7."),
MILESTONE_RABBITS("§7You claimed §b2 §6§lMilestone Rabbits§7."),
EMPTY_1(""),
NEW_RABBITS("§7Unique Rabbits: §b7\n §f1 §7- §a1 §7- §91 §7- §51 §7- §61 §7- §d1 §7- §b1"),
EMPTY_2(""),
DUPLICATE_RABBITS("§7Duplicate Rabbits: §c10\n §f4 §7- §a3 §7- §92 §7- §51 §7- §60 §7- §d0 §7- §b0\n §6+250,000,000 Chocolate"),
EMPTY_3(""),
STRAY_RABBITS("§7Stray Rabbits: §f20\n §f10 §7- §a6 §7- §93 §7- §51 §7- §60 §7- §d0 §7- §b0\n §6+8,000,000 Chocolate\n §c* §c§oRequires Stray Tracker being enabled to work."),
STRAY_RABBITS("§7Stray Rabbits: §f20\n §f10 §7- §a6 §7- §93 §7- §51 §7- §60 §7- §d0 §7- §b0\n §6+8,000,000 Chocolate\n §4* §c§oRequires Stray Tracker being enabled to work§4§o."),
EMPTY_4(""),
TIME_IN_CF("§7You spent §b4h 36m §7in the §6Chocolate Factory§7."),
RABBIT_THE_FISH_FINDS("§7You found §cRabbit the Fish §7in Meal Eggs §b2 §7times."),
LEADERBOARD_CHANGE("§7Leaderboard: §b#107 §c-> §b#99\n §7(§a+8 Spots§7) Top §a0.003% §c-> §7Top §a0.002%\n§4* §c§oSyncs on first §4§o/cf §c§orun per server swap§4§o.")
;

private final String display;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package at.hannibal2.skyhanni.config.features.event.hoppity;

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.ConfigEditorInfoText;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorKeybind;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
import org.lwjgl.input.Keyboard;

public class HoppityEventSummaryLiveDisplayConfig {

@Expose
@ConfigOption(name = "Show Display", desc = "Show the hoppity card in a GUI element.")
@ConfigEditorBoolean
@FeatureToggle
public boolean enabled = false;

@Expose
@ConfigOption(name = "Note", desc = "§cNote§7: This card will mirror the stat list that is defined in the Hoppity Event Summary config.")
@ConfigEditorInfoText
public boolean mirrorConfigNote = false;

@Expose
@ConfigOption(name = "Only During Event", desc = "Only show the display while Hoppity's Hunt is active.")
@ConfigEditorBoolean
public boolean onlyDuringEvent = true;

@Expose
@ConfigOption(name = "Card Toggle Keybind", desc = "Toggle the GUI element with this keybind.")
@ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE)
public int toggleKeybind = Keyboard.KEY_NONE;

@Expose
@ConfigOption(name = "Show Holding Egglocator", desc = "Always show the card when holding an Egglocator.")
@ConfigEditorBoolean
public boolean showHoldingEgglocator = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,17 @@
import at.hannibal2.skyhanni.utils.LorenzVec;
import at.hannibal2.skyhanni.utils.NEUInternalName;
import at.hannibal2.skyhanni.utils.SimpleTimeMark;
import at.hannibal2.skyhanni.utils.StaticDurations;
import com.google.gson.annotations.Expose;
import kotlin.time.Duration;
import net.minecraft.item.ItemStack;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;

public class ProfileSpecificStorage {
Expand All @@ -65,6 +68,10 @@ private static SimpleTimeMark SimpleTimeMarkFarPast() {
return GenericWrapper.getSimpleTimeMark(SimpleTimeMark.farPast()).getIt();
}

private static Duration DurationZero() {
return GenericWrapper.getDuration(StaticDurations.getZero()).getIt();
}

@Expose
public String currentPet = "";

Expand Down Expand Up @@ -743,6 +750,12 @@ public static class WardrobeStorage {
@Expose
public Map<Integer, HoppityEventStats> hoppityEventStats = new HashMap<>();

@Expose
public Boolean hoppityStatLiveDisplayToggled = false;

@Expose
public Integer hoppityStatLiveDisplayYear = -1;

public static class HoppityEventStats {
@Expose
public Map<HoppityEggType, Integer> mealsFound = new HashMap<>();
Expand All @@ -759,6 +772,11 @@ public static class RabbitData {

@Expose
public int strays = 0;

@Override
public int hashCode() {
return Objects.hash(uniques, dupes, strays);
}
}

@Expose
Expand All @@ -768,9 +786,54 @@ public static class RabbitData {
public long strayChocolateGained = 0;

@Expose
public long millisInCf = 0;
public Duration millisInCf = DurationZero();

@Expose
public int rabbitTheFishFinds = 0;

public static class LeaderboardPosition {
@Expose
public int position;

@Expose
public double percentile;

public LeaderboardPosition(int position, double percentile) {
this.position = position;
this.percentile = percentile;
}

@Override
public int hashCode() {
return Objects.hash(position, percentile);
}
}

@Expose
public LeaderboardPosition initialLeaderboardPosition = new LeaderboardPosition(-1, -1.0);

@Expose
public LeaderboardPosition finalLeaderboardPosition = new LeaderboardPosition(-1, -1.0);

@Expose
public SimpleTimeMark lastLbUpdate = SimpleTimeMarkFarPast();

@Expose
public boolean summarized = false;

@Override
public int hashCode() {
return Objects.hash(
mealsFound,
rabbitsFound,
dupeChocolateGained,
strayChocolateGained,
millisInCf,
rabbitTheFishFinds,
initialLeaderboardPosition,
finalLeaderboardPosition,
summarized
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.RegexUtils.matches
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getMinecraftId
import at.hannibal2.skyhanni.utils.SkyBlockTime
import at.hannibal2.skyhanni.utils.SkyblockSeason
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraftforge.fml.common.eventhandler.EventPriority
Expand Down Expand Up @@ -64,6 +65,12 @@ object HoppityAPI {

fun getLastRabbit(): String = this.lastNameCache
fun isHoppityEvent() = (SkyblockSeason.currentSeason == SkyblockSeason.SPRING || SkyHanniMod.feature.dev.debug.alwaysHoppitys)
fun millisToEventEnd(): Long =
if (isHoppityEvent()) {
val now = SkyBlockTime.now()
val eventEnd = SkyBlockTime.fromSbYearAndMonth(now.year, 3)
eventEnd.toMillis() - now.toMillis()
} else 0
fun rarityByRabbit(rabbit: String): LorenzRarity? = hoppityRarities.firstOrNull {
it.chatColorCode == rabbit.substring(0, 2)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import at.hannibal2.skyhanni.utils.LocationUtils.distanceToPlayer
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.toInternalName
import at.hannibal2.skyhanni.utils.NumberUtil.formatInt
import at.hannibal2.skyhanni.utils.NumberUtil.roundTo
import at.hannibal2.skyhanni.utils.RecalculatingValue
Expand All @@ -40,7 +40,7 @@ import kotlin.time.Duration.Companion.seconds
object HoppityEggLocator {
private val config get() = HoppityEggsManager.config

private val locatorItem = "EGGLOCATOR".asInternalName()
val locatorItem = "EGGLOCATOR".toInternalName()

private var lastParticlePosition: LorenzVec? = null
private var lastParticlePositionForever: LorenzVec? = null
Expand Down
Loading

0 comments on commit db1e2fc

Please sign in to comment.