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

Filter Button on OneConfig + Autocomplete for items + GUI Improvements #442

Merged
merged 15 commits into from
Jul 26, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package me.partlysanestudios.partlysaneskies.config

import cc.polyfrost.oneconfig.config.Config
import cc.polyfrost.oneconfig.config.annotations.Button
import cc.polyfrost.oneconfig.config.annotations.Color
import cc.polyfrost.oneconfig.config.annotations.Dropdown
import cc.polyfrost.oneconfig.config.annotations.HUD
Expand All @@ -22,6 +23,8 @@ import cc.polyfrost.oneconfig.config.data.Mod
import cc.polyfrost.oneconfig.config.data.ModType
import me.partlysanestudios.partlysaneskies.features.debug.ExampleHud
import me.partlysanestudios.partlysaneskies.features.gui.hud.CooldownHud
import me.partlysanestudios.partlysaneskies.features.gui.hud.rngdropbanner.RareDropGUI
import me.partlysanestudios.partlysaneskies.utils.MinecraftUtils
import org.lwjgl.input.Keyboard

object OneConfigScreen : Config(
Expand Down Expand Up @@ -427,6 +430,18 @@ object OneConfigScreen : Config(
)
var blockLegendaryDrops = false

@Button(
name = "Filter Individual Items",
text = "Open Menu",
description = "Click to open a menu to blacklist individual items.",
category = "SkyBlock",
subcategory = "Rare Drop",
size = 2
)
val rareDropFilterButton = Runnable {
MinecraftUtils.displayGuiScreen(RareDropGUI())
}

// Location Banner
@Switch(
name = "Location Banner",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import me.partlysanestudios.partlysaneskies.data.api.RequestsManager.newRequest
import me.partlysanestudios.partlysaneskies.data.pssdata.PublicDataManager.getFile
import me.partlysanestudios.partlysaneskies.events.SubscribePSSEvent
import me.partlysanestudios.partlysaneskies.events.data.LoadPublicDataEvent
import me.partlysanestudios.partlysaneskies.utils.StringUtils.removeColorCodes
import java.io.IOException
import java.net.MalformedURLException

Expand Down Expand Up @@ -79,8 +80,8 @@ object SkyblockDataManager {
en.get("unstackable")?.asBoolean ?: false,
)

idToItemMap[en.get("itemId").asString] = skyblockItem
nameToIdMap[en.get("name").asString] = en.get("itemId").asString
idToItemMap[skyblockItem.id] = skyblockItem
nameToIdMap[skyblockItem.name.removeColorCodes()] = skyblockItem.id
}
},
inMainThread = false,
Expand All @@ -101,14 +102,10 @@ object SkyblockDataManager {
}
}

fun getId(name: String): String = nameToIdMap[name] ?: ""
fun getId(name: String): String = nameToIdMap[name.removeColorCodes()] ?: ""

fun getItem(id: String): SkyblockItem? = idToItemMap[id]

fun getItem(id: String): SkyblockItem? =
if (!idToItemMap.containsKey(id)) {
null
} else {
idToItemMap[id]
}

fun runUpdaterTick() {
if (checkLastUpdate()) {
Expand All @@ -124,6 +121,8 @@ object SkyblockDataManager {
}
}

fun getAllItems(): List<String> = idToItemMap.keys.toList()

// --------------------------- Skills ---------------------------
private var idToSkillMap = HashMap<String, SkyblockSkill>()

Expand Down
Loading
Loading