feat: Make use of bazaar stocks for better bazaar prices
This commit is contained in:
@@ -9,7 +9,7 @@ enum class BazaarPriceStrategy {
|
||||
NPC_SELL;
|
||||
|
||||
fun getSellPrice(skyblockId: SkyblockId): Double {
|
||||
val bazaarEntry = HypixelStaticData.bazaarData[skyblockId] ?: return 0.0
|
||||
val bazaarEntry = HypixelStaticData.bazaarData[skyblockId.asBazaarStock] ?: return 0.0
|
||||
return when (this) {
|
||||
BUY_ORDER -> bazaarEntry.quickStatus.sellPrice
|
||||
SELL_ORDER -> bazaarEntry.quickStatus.buyPrice
|
||||
|
||||
@@ -29,6 +29,7 @@ import net.minecraft.util.Identifier
|
||||
import moe.nea.firmament.repo.ExpLadders
|
||||
import moe.nea.firmament.repo.ExpensiveItemCacheApi
|
||||
import moe.nea.firmament.repo.ItemCache.asItemStack
|
||||
import moe.nea.firmament.repo.RepoManager
|
||||
import moe.nea.firmament.repo.set
|
||||
import moe.nea.firmament.util.collections.WeakCache
|
||||
import moe.nea.firmament.util.json.DashlessUUIDSerializer
|
||||
@@ -69,11 +70,10 @@ value class SkyblockId(val neuItem: String) : Comparable<SkyblockId> {
|
||||
@JvmInline
|
||||
@Serializable
|
||||
value class BazaarStock(val bazaarId: String) {
|
||||
fun toRepoId(): SkyblockId {
|
||||
bazaarEnchantmentRegex.matchEntire(bazaarId)?.let {
|
||||
return SkyblockId("${it.groupValues[1]};${it.groupValues[2]}")
|
||||
companion object {
|
||||
fun fromSkyBlockId(skyblockId: SkyblockId): BazaarStock {
|
||||
return BazaarStock(RepoManager.neuRepo.constants.bazaarStocks.getBazaarStockOrDefault(skyblockId.neuItem))
|
||||
}
|
||||
return SkyblockId(bazaarId.replace(":", "-"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +92,7 @@ value class SkyblockId(val neuItem: String) : Comparable<SkyblockId> {
|
||||
|
||||
val NEUItem.skyblockId get() = SkyblockId(skyblockItemId)
|
||||
val NEUIngredient.skyblockId get() = SkyblockId(itemId)
|
||||
val SkyblockId.asBazaarStock get() = SkyblockId.BazaarStock.fromSkyBlockId(this)
|
||||
|
||||
@ExpensiveItemCacheApi
|
||||
fun NEUItem.guessRecipeId(): String? {
|
||||
|
||||
Reference in New Issue
Block a user