Skip to content

Commit

Permalink
feat: Add /protectitem hint in config
Browse files Browse the repository at this point in the history
  • Loading branch information
My-Name-Is-Jeff committed Jan 8, 2024
1 parent 1fc62a2 commit 5121366
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,39 +59,42 @@ object OrderedWaypointCommand : BaseCommand("skytilsorderedwaypoint") {
it.island.mode == SBInfo.mode || (isUnknownIsland && it.island == SkyblockIsland.Unknown)
}.sortedWith(categoryComparator)
}
val subcommand = args.getOrNull(0)
if (subcommand == null || subcommand == "selectmenu") {
val startIndex = args.getOrNull(1)?.toIntOrNull() ?: 0
val toIndex = startIndex + 10.coerceAtMost(categoryCache.size)
val list = categoryCache.subList(startIndex, toIndex)
UMessage("${Skytils.prefix} §bSelect a Waypoint Category!").apply {
chatLineId = lineId
list.withIndex().forEach { (i, c) ->
addTextComponent(UTextComponent("\n§a${c.name}§7 (${c.waypoints.size})").setClick(MCClickEventAction.RUN_COMMAND, "/${commandName} select ${i + startIndex}"))
}
if (startIndex >= 10) {
addTextComponent(UTextComponent("\n§7[§aPrevious§7]").setClick(MCClickEventAction.RUN_COMMAND, "/${commandName} selectmenu ${startIndex - 10}"))
}
if (toIndex < categoryCache.size) {
addTextComponent(UTextComponent("\n§7[§aNext§7]").setClick(MCClickEventAction.RUN_COMMAND, "/${commandName} selectmenu $toIndex"))
}
}.chat()
} else if (subcommand == "select") {
val category = categoryCache.getOrNull(args.getOrNull(1)?.toIntOrNull() ?: 0)
?: throw WrongUsageException("Invalid category!")
UMessage("${Skytils.successPrefix} §aSelected category §b${category.name}§a!\n" +
"§b§lNote: this is a BETA feature!\n" +
"§bReport bugs on Discord!\n" +
"§bUpdates to waypoints will not be reflected."
).apply {
chatLineId = lineId
}.chat()
trackedSet = category.waypoints.sortedBy { it.name }.toMutableList()
trackedIsland = category.island
} else if (subcommand == "stop") {
trackedSet = null
trackedIsland = null
UChat.chat("${Skytils.successPrefix} §aStopped tracking waypoints!")
when (args.getOrNull(0)) {
null, "selectmenu" -> {
val startIndex = args.getOrNull(1)?.toIntOrNull() ?: 0
val toIndex = startIndex + 10.coerceAtMost(categoryCache.size)
val list = categoryCache.subList(startIndex, toIndex)
UMessage("${Skytils.prefix} §bSelect a Waypoint Category!").apply {
chatLineId = lineId
list.withIndex().forEach { (i, c) ->
addTextComponent(UTextComponent("\n§a${c.name}§7 (${c.waypoints.size})").setClick(MCClickEventAction.RUN_COMMAND, "/${commandName} select ${i + startIndex}"))
}
if (startIndex >= 10) {
addTextComponent(UTextComponent("\n§7[§aPrevious§7]").setClick(MCClickEventAction.RUN_COMMAND, "/${commandName} selectmenu ${startIndex - 10}"))
}
if (toIndex < categoryCache.size) {
addTextComponent(UTextComponent("\n§7[§aNext§7]").setClick(MCClickEventAction.RUN_COMMAND, "/${commandName} selectmenu $toIndex"))
}
}.chat()
}
"select" -> {
val category = categoryCache.getOrNull(args.getOrNull(1)?.toIntOrNull() ?: 0)
?: throw WrongUsageException("Invalid category!")
UMessage("${Skytils.successPrefix} §aSelected category §b${category.name}§a!\n" +
"§b§lNote: this is a BETA feature!\n" +
"§bReport bugs on Discord!\n" +
"§bUpdates to waypoints will not be reflected."
).apply {
chatLineId = lineId
}.chat()
trackedSet = category.waypoints.sortedBy { it.name }.toMutableList()
trackedIsland = category.island
}
"stop" -> {
trackedSet = null
trackedIsland = null
UChat.chat("${Skytils.successPrefix} §aStopped tracking waypoints!")
}
}
}

Expand Down
25 changes: 22 additions & 3 deletions src/main/kotlin/gg/skytils/skytilsmod/core/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package gg.skytils.skytilsmod.core

import gg.essential.api.EssentialAPI
import gg.essential.elementa.utils.withAlpha
import gg.essential.universal.UChat
import gg.essential.universal.UDesktop
import gg.essential.vigilance.Vigilant
import gg.essential.vigilance.data.Category
Expand All @@ -32,6 +33,7 @@ import gg.skytils.skytilsmod.features.impl.trackers.Tracker
import gg.skytils.skytilsmod.gui.PotionNotificationsGui
import gg.skytils.skytilsmod.gui.SpiritLeapNamesGui
import gg.skytils.skytilsmod.mixins.transformers.accessors.AccessorCommandHandler
import gg.skytils.skytilsmod.utils.ModChecker
import gg.skytils.skytilsmod.utils.Utils
import net.minecraft.util.ResourceLocation
import net.minecraftforge.client.ClientCommandHandler
Expand Down Expand Up @@ -238,10 +240,15 @@ object Config : Vigilant(
searchTags = ["predev", "pre-dev", "arrow", "tic tac toe", "solver"]
)
fun openDungeonSweat() {
EssentialAPI.getNotifications().push("azoopuzzoo", "hmmmmm... nice pb + ratio + sub 3 + FAST S+ + no bers + no healer + no tank + 4m 1a + no hype = kick", 3f) {
onClose = {
UDesktop.browse(URI.create("https://l.skytils.gg/dungeonsweatsonly"))
if (ModChecker.canShowNotifications) {
EssentialAPI.getNotifications().push("azoopuzzoo", "hmmmmm... nice pb + ratio + sub 3 + FAST S+ + no bers + no healer + no tank + 4m 1a + no hype = kick", 3f) {
onClose = {
UDesktop.browse(URI.create("https://l.skytils.gg/dungeonsweatsonly"))
}
}
} else {
UChat.chat("${Skytils.prefix} §bazoopuzzoo")
UDesktop.browse(URI.create("https://l.skytils.gg/dungeonsweatsonly"))
}
}

Expand Down Expand Up @@ -2063,6 +2070,18 @@ object Config : Vigilant(
)
var pressEnterToConfirmSignQuestion = false

@Property(
type = PropertyType.BUTTON, name = "Protect Items",
description = "Prevents you from dropping, salvaging, or selling items that you have selected.",
category = "Miscellaneous", subcategory = "Quality of Life",
searchTags = ["Lock", "Slot"]
)
fun protectItems() {
if (ModChecker.canShowNotifications) {
EssentialAPI.getNotifications().push("Protect Items Help", "Hold the item you'd like to protect, and then run /protectitem.", 5f)
} else UChat.chat("${Skytils.prefix} §bHold the item you'd like to protect, and then run /protectitem.")
}

@Property(
type = PropertyType.TEXT, name = "Protect Items Above Value",
description = "Prevents you from dropping, salvaging, or selling items worth more than this value. Based on Lowest BIN price.",
Expand Down
6 changes: 6 additions & 0 deletions src/main/kotlin/gg/skytils/skytilsmod/utils/ModChecker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

package gg.skytils.skytilsmod.utils

import gg.essential.api.EssentialAPI
import gg.essential.api.config.EssentialConfig
import gg.skytils.skytilsmod.Skytils
import kotlinx.coroutines.launch
import net.minecraft.client.ClientBrandRetriever
Expand All @@ -42,6 +44,10 @@ object ModChecker {
ForgeVersion.getStatus().ordinal > 3
}

val canShowNotifications by lazy {
!EssentialAPI.getConfig().disableAllNotifications && !EssentialAPI.getOnboardingData().hasDeniedEssentialTOS()
}

fun checkModdedForge() {
if (!isModded) return
showMessage()
Expand Down

0 comments on commit 5121366

Please sign in to comment.