diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
23 files changed, 117 insertions, 117 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt index 959a303e8..656ac7b9d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt @@ -61,7 +61,7 @@ import kotlin.math.roundToLong object GhostCounter { val config get() = SkyHanniMod.feature.combat.ghostCounter - val hidden get() = ProfileStorageData.profileSpecific?.ghostCounter + val storage get() = ProfileStorageData.profileSpecific?.ghostCounter private var display = emptyList<List<Any>>() var ghostCounterV3File = File("." + File.separator + "config" + File.separator + "ChatTriggers" + File.separator + "modules" + File.separator + "GhostCounterV3" + File.separator + ".persistantData.json") @@ -127,7 +127,7 @@ object GhostCounter { } val avgMagicFind = when (Option.TOTALDROPS.get()) { 0.0 -> "0" - else -> "${((((hidden?.totalMF!! / Option.TOTALDROPS.get()) + Math.ulp(1.0)) * 100) / 100).roundToPrecision(2)}" + else -> "${((((storage?.totalMF!! / Option.TOTALDROPS.get()) + Math.ulp(1.0)) * 100) / 100).roundToPrecision(2)}" } val xpHourFormatting = textFormatting.xpHourFormatting @@ -151,9 +151,9 @@ object GhostCounter { } val bestiaryFormatting = textFormatting.bestiaryFormatting - val currentKill = hidden?.bestiaryCurrentKill?.toInt() ?: 0 - val killNeeded = hidden?.bestiaryKillNeeded?.toInt() ?: 0 - val nextLevel = hidden?.bestiaryNextLevel?.toInt() ?: -1 + val currentKill = storage?.bestiaryCurrentKill?.toInt() ?: 0 + val killNeeded = storage?.bestiaryKillNeeded?.toInt() ?: 0 + val nextLevel = storage?.bestiaryNextLevel?.toInt() ?: -1 val bestiary = if (config.showMax) { when (nextLevel) { 26 -> bestiaryFormatting.maxed.replace("%currentKill%", currentKill.addSeparators()) @@ -283,7 +283,7 @@ object GhostCounter { Option.KILLCOMBO.add(num) Option.SKILLXPGAINED.add(gained * num.roundToLong()) Option.SKILLXPGAINED.add(gained * num.roundToLong(), true) - hidden?.bestiaryCurrentKill = hidden?.bestiaryCurrentKill?.plus(num) ?: num + storage?.bestiaryCurrentKill = storage?.bestiaryCurrentKill?.plus(num) ?: num } lastXp = res } @@ -385,7 +385,7 @@ object GhostCounter { Option.SORROWCOUNT, Option.VOLTACOUNT, Option.PLASMACOUNT, Option.GHOSTLYBOOTS -> { opt.add(1.0) opt.add(1.0, true) - hidden?.totalMF = hidden?.totalMF?.plus(group("mf").substring(4).toDouble()) + storage?.totalMF = storage?.totalMF?.plus(group("mf").substring(4).toDouble()) ?: group("mf").substring(4).toDouble() Option.TOTALDROPS.add(1.0) if (opt == Option.SORROWCOUNT) @@ -424,16 +424,16 @@ object GhostCounter { val currentLevel = group("nextLevel").toInt() when (val nextLevel = if (currentLevel >= 25) 26 else currentLevel + 1) { 26 -> { - hidden?.bestiaryNextLevel = 26.0 - hidden?.bestiaryCurrentKill = 250_000.0 - hidden?.bestiaryKillNeeded = 0.0 + storage?.bestiaryNextLevel = 26.0 + storage?.bestiaryCurrentKill = 250_000.0 + storage?.bestiaryKillNeeded = 0.0 } else -> { val killNeeded: Int = bestiaryData[nextLevel] ?: -1 - hidden?.bestiaryNextLevel = nextLevel.toDouble() - hidden?.bestiaryCurrentKill = 0.0 - hidden?.bestiaryKillNeeded = killNeeded.toDouble() + storage?.bestiaryNextLevel = nextLevel.toDouble() + storage?.bestiaryCurrentKill = 0.0 + storage?.bestiaryKillNeeded = killNeeded.toDouble() } } update() @@ -459,7 +459,7 @@ object GhostCounter { val bestiaryNextLevel = if ("§\\wGhost".toRegex().matches(ghostStack.displayName)) 1 else ghostStack.displayName.substring(8) .romanToDecimal() + 1 - hidden?.bestiaryNextLevel = bestiaryNextLevel.toDouble() + storage?.bestiaryNextLevel = bestiaryNextLevel.toDouble() var kills = 0.0 for (line in ghostStack.getLore()) { val l = line.removeColor().trim() @@ -467,8 +467,8 @@ object GhostCounter { kills = "Kills: (.*)".toRegex().find(l)?.groupValues?.get(1)?.formatNumber()?.toDouble() ?: 0.0 } ghostXPPattern.matchMatcher(line.removeColor().trim()) { - hidden?.bestiaryCurrentKill = if (kills > 0) kills else group("current").formatNumber().toDouble() - hidden?.bestiaryKillNeeded = group("total").formatNumber().toDouble() + storage?.bestiaryCurrentKill = if (kills > 0) kills else group("current").formatNumber().toDouble() + storage?.bestiaryKillNeeded = group("total").formatNumber().toDouble() } } update() @@ -476,10 +476,10 @@ object GhostCounter { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - if (hidden?.configUpdateVersion == 0) { + if (storage?.configUpdateVersion == 0) { config.textFormatting.bestiaryFormatting.base = " &6Bestiary %display%: &b%value%" chat("§e[SkyHanni] Your GhostCounter config has been automatically adjusted.") - hidden?.configUpdateVersion = CONFIG_VALUE_VERSION + storage?.configUpdateVersion = CONFIG_VALUE_VERSION } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostData.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostData.kt index 70832980c..69094b991 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostData.kt @@ -63,28 +63,28 @@ object GhostData { if (s) session[this] = session[this]?.plus(i) ?: i else - GhostCounter.hidden?.data?.set(this, GhostCounter.hidden?.data?.get(this)?.plus(i) ?: i) + GhostCounter.storage?.data?.set(this, GhostCounter.storage?.data?.get(this)?.plus(i) ?: i) } fun set(i: Double, s: Boolean = false) { if (s) session[this] = i else - GhostCounter.hidden?.data?.set(this, i) + GhostCounter.storage?.data?.set(this, i) } fun getInt(s: Boolean = false): Int { return if (s) session[this]?.roundToInt() ?: 0 else - GhostCounter.hidden?.data?.get(this)?.roundToInt() ?: 0 + GhostCounter.storage?.data?.get(this)?.roundToInt() ?: 0 } fun get(s: Boolean = false): Double { return if (s) session[this] ?: 0.0 else - GhostCounter.hidden?.data?.get(this) ?: 0.0 + GhostCounter.storage?.data?.get(this) ?: 0.0 } } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt index 6dffc62fc..b5b833423 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt @@ -17,7 +17,7 @@ object GhostUtil { opt.set(0.0) opt.set(0.0, true) } - GhostCounter.hidden?.totalMF = 0.0 + GhostCounter.storage?.totalMF = 0.0 GhostCounter.update() } @@ -79,7 +79,7 @@ object GhostUtil { GhostData.Option.VOLTACOUNT.add(json["VoltaCount"].asDouble) GhostData.Option.GHOSTLYBOOTS.add(json["GhostlyBootsCount"].asDouble) GhostData.Option.KILLS.add(json["ghostsKilled"].asDouble) - GhostCounter.hidden?.totalMF = GhostCounter.hidden?.totalMF?.plus(json["TotalMF"].asDouble) + GhostCounter.storage?.totalMF = GhostCounter.storage?.totalMF?.plus(json["TotalMF"].asDouble) ?: json["TotalMF"].asDouble GhostData.Option.TOTALDROPS.add(json["TotalDrops"].asDouble) c.ctDataImported = true @@ -120,7 +120,7 @@ object GhostUtil { ) fun String.formatBestiary(currentKill: Int, killNeeded: Int): String { - val bestiaryNextLevel = GhostCounter.hidden?.bestiaryNextLevel + val bestiaryNextLevel = GhostCounter.storage?.bestiaryNextLevel val currentLevel = bestiaryNextLevel?.let { if (it.toInt() < 0) "25" else "${it.toInt() - 1}" } ?: "§cNo Bestiary Level Data!" val nextLevel = bestiaryNextLevel?.let { if (GhostCounter.config.showMax) "25" else "${it.toInt()}" } @@ -141,4 +141,4 @@ object GhostUtil { private fun percent(number: Double) = 100.0.coerceAtMost(((number / 250_000) * 100).roundToPrecision(4)).toString() -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt index 6cdf64ca6..952786e32 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/FarmingFortuneDisplay.kt @@ -142,7 +142,7 @@ class FarmingFortuneDisplay { companion object { private val config get() = SkyHanniMod.feature.garden.farmingFortunes - private val latestFF: MutableMap<CropType, Double>? get() = GardenAPI.config?.latestTrueFarmingFortune + private val latestFF: MutableMap<CropType, Double>? get() = GardenAPI.storage?.latestTrueFarmingFortune private val currentCrop get() = GardenAPI.getCurrentlyFarmedCrop() @@ -275,12 +275,12 @@ class FarmingFortuneDisplay { var otherFortune = 0.0 if (currentCrop == CropType.CARROT) { - GardenAPI.config?.fortune?.let { + GardenAPI.storage?.fortune?.let { if (it.carrotFortune) otherFortune = 12.0 } } if (currentCrop == CropType.PUMPKIN) { - GardenAPI.config?.fortune?.let { + GardenAPI.storage?.fortune?.let { if (it.pumpkinFortune) otherFortune = 12.0 } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt index 49eae1427..22f897a4c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -49,12 +49,12 @@ object GardenAPI { var mushroomCowPet = false private var inBarn = false val onBarnPlot get() = inBarn && inGarden() - val config get() = ProfileStorageData.profileSpecific?.garden + val storage get() = ProfileStorageData.profileSpecific?.garden var gardenExp: Long? - get() = config?.experience + get() = storage?.experience set(value) { value?.let { - config?.experience = it + storage?.experience = it } } @@ -164,7 +164,7 @@ object GardenAPI { SkyMartCopperPrice.inInventory || FarmingContestAPI.inInventory || VisitorAPI.inInventory || FFGuideGUI.isInGui() fun clearCropSpeed() { - config?.cropsPerSecond?.clear() + storage?.cropsPerSecond?.clear() GardenBestCropTime.reset() updateGardenTool() LorenzUtils.chat("§e[SkyHanni] Manually reset all crop speed data!") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterAPI.kt index 3a22e5d39..299e02f40 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterAPI.kt @@ -9,7 +9,7 @@ import kotlin.time.Duration.Companion.minutes object ComposterAPI { var tabListData = mapOf<ComposterDisplay.DataType, String>() - val composterUpgrades: MutableMap<ComposterUpgrade, Int>? get() = GardenAPI.config?.composterUpgrades + val composterUpgrades: MutableMap<ComposterUpgrade, Int>? get() = GardenAPI.storage?.composterUpgrades fun ComposterUpgrade.getLevel(addOne: ComposterUpgrade?) = (composterUpgrades?.get(this) ?: 0) + if (addOne == this) 1 else 0 @@ -41,4 +41,4 @@ object ComposterAPI { val costFactor = 1.0 - costReduction.toDouble() / 100 return 2_000.0 * costFactor } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt index 5139d8a95..439b51b0c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterDisplay.kt @@ -20,7 +20,7 @@ import kotlin.time.DurationUnit class ComposterDisplay { private val config get() = SkyHanniMod.feature.garden.composters - private val hidden get() = GardenAPI.config + private val storage get() = GardenAPI.storage private var display = emptyList<List<Any>>() private var composterEmptyTime: Duration? = null @@ -100,7 +100,7 @@ class ComposterDisplay { private fun addComposterEmptyTime(emptyTime: Duration?): List<Any> { return if (emptyTime != null) { val millis = emptyTime.toDouble(DurationUnit.MILLISECONDS).toLong() - GardenAPI.config?.composterEmptyTime = System.currentTimeMillis() + millis + GardenAPI.storage?.composterEmptyTime = System.currentTimeMillis() + millis val format = TimeUtils.formatDuration(millis, maxUnits = 2) listOf(NEUItems.getItemStack("BUCKET"), "§b$format") } else { @@ -139,24 +139,24 @@ class ComposterDisplay { private fun sendNotify() { if (!config.notifyLow.enabled) return - val hidden = hidden ?: return + val storage = storage ?: return - if (ComposterAPI.getOrganicMatter() <= config.notifyLow.organicMatter && System.currentTimeMillis() >= hidden.informedAboutLowMatter) { + if (ComposterAPI.getOrganicMatter() <= config.notifyLow.organicMatter && System.currentTimeMillis() >= storage.informedAboutLowMatter) { if (config.notifyLow.title) { LorenzUtils.sendTitle("§cYour Organic Matter is low", 4.seconds) } LorenzUtils.chat("§e[SkyHanni] §cYour Organic Matter is low!") - hidden.informedAboutLowMatter = System.currentTimeMillis() + 60_000 * 5 + storage.informedAboutLowMatter = System.currentTimeMillis() + 60_000 * 5 } if (ComposterAPI.getFuel() <= config.notifyLow.fuel && - System.currentTimeMillis() >= hidden.informedAboutLowFuel + System.currentTimeMillis() >= storage.informedAboutLowFuel ) { if (config.notifyLow.title) { LorenzUtils.sendTitle("§cYour Fuel is low", 4.seconds) } LorenzUtils.chat("§e[SkyHanni] §cYour Fuel is low!") - hidden.informedAboutLowFuel = System.currentTimeMillis() + 60_000 * 5 + storage.informedAboutLowFuel = System.currentTimeMillis() + 60_000 * 5 } } @@ -172,7 +172,7 @@ class ComposterDisplay { } private fun checkWarningsAndOutsideGarden() { - val storage = GardenAPI.config ?: return + val storage = GardenAPI.storage ?: return val format = if (storage.composterEmptyTime != 0L) { val duration = storage.composterEmptyTime - System.currentTimeMillis() @@ -195,7 +195,7 @@ class ComposterDisplay { private fun warn(warningMessage: String) { if (!config.warnAlmostClose) return - val storage = GardenAPI.config ?: return + val storage = GardenAPI.storage ?: return if (LorenzUtils.inDungeons) return if (LorenzUtils.inKuudraFight) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt index 72845cc63..557fec6d0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt @@ -74,15 +74,15 @@ object ComposterOverlay { private var testOffset = 0 var currentOrganicMatterItem: String? - get() = GardenAPI.config?.composterCurrentOrganicMatterItem + get() = GardenAPI.storage?.composterCurrentOrganicMatterItem private set(value) { - GardenAPI.config?.composterCurrentOrganicMatterItem = value + GardenAPI.storage?.composterCurrentOrganicMatterItem = value } var currentFuelItem: String? - get() = GardenAPI.config?.composterCurrentFuelItem + get() = GardenAPI.storage?.composterCurrentFuelItem private set(value) { - GardenAPI.config?.composterCurrentFuelItem = value + GardenAPI.storage?.composterCurrentFuelItem = value } fun onCommand(args: Array<String>) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt index ff65011c6..0cc07f7e7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt @@ -54,7 +54,7 @@ object CropMoneyDisplay { private var loaded = false private var ready = false private val cropNames = mutableMapOf<NEUInternalName, CropType>() - private val toolHasBountiful get() = GardenAPI.config?.toolWithBountiful + private val toolHasBountiful get() = GardenAPI.storage?.toolWithBountiful @SubscribeEvent fun onPreProfileSwitch(event: PreProfileSwitchEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropCounter.kt index 040ab1710..d72540720 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/DicerRngDropCounter.kt @@ -117,7 +117,7 @@ class DicerRngDropCounter { class ItemDrop(val crop: CropType, val rarity: DropRarity, val pattern: Regex) private fun saveConfig() { - val map = GardenAPI.config?.dicerRngDrops ?: return + val map = GardenAPI.storage?.dicerRngDrops ?: return map.clear() for (drop in drops) { val crop = drop.key @@ -129,7 +129,7 @@ class DicerRngDropCounter { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - val map = GardenAPI.config?.dicerRngDrops ?: return + val map = GardenAPI.storage?.dicerRngDrops ?: return for ((internalName, amount) in map) { val split = internalName.split(".") val crop = CropType.getByName(split[0]) @@ -147,4 +147,4 @@ class DicerRngDropCounter { event.move(3, "garden.dicerCounterHideChat", "garden.dicerCounters.hideChat") event.move(3, "garden.dicerCounterPos", "garden.dicerCounters.pos") } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt index 8092ff476..2617ad329 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingArmorDrops.kt @@ -23,7 +23,7 @@ import kotlin.time.Duration.Companion.seconds class FarmingArmorDrops { private var display = emptyList<String>() - private val storage get() = GardenAPI.config + private val storage get() = GardenAPI.storage private var hasArmor = false private val armorPattern = "(FERMENTO|CROPIE|SQUASH|MELON)_(LEGGINGS|CHESTPLATE|BOOTS|HELMET)".toPattern() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt index a9a2066bd..0f10ed883 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenCropSpeed.kt @@ -22,8 +22,8 @@ import kotlin.concurrent.fixedRateTimer object GardenCropSpeed { private val config get() = SkyHanniMod.feature.garden - private val cropsPerSecond: MutableMap<CropType, Int>? get() = GardenAPI.config?.cropsPerSecond - private val latestBlocksPerSecond: MutableMap<CropType, Double>? get() = GardenAPI.config?.latestBlocksPerSecond + private val cropsPerSecond: MutableMap<CropType, Int>? get() = GardenAPI.storage?.cropsPerSecond + private val latestBlocksPerSecond: MutableMap<CropType, Double>? get() = GardenAPI.storage?.latestBlocksPerSecond var lastBrokenCrop: CropType? = null var lastBrokenTime = 0L diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenStartLocation.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenStartLocation.kt index 6ad3ce910..9452dc82f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenStartLocation.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/GardenStartLocation.kt @@ -26,7 +26,7 @@ object GardenStartLocation { return } - val startLocations = GardenAPI.config?.cropStartLocations + val startLocations = GardenAPI.storage?.cropStartLocations if (startLocations == null) { LorenzUtils.chat("§c[SkyHanni] The config is not yet loaded, retry in a second.") return @@ -45,7 +45,7 @@ object GardenStartLocation { @SubscribeEvent fun onBlockClick(event: CropClickEvent) { if (!isEnabled()) return - val startLocations = GardenAPI.config?.cropStartLocations ?: return + val startLocations = GardenAPI.storage?.cropStartLocations ?: return val crop = GardenAPI.getCurrentlyFarmedCrop() ?: return if (crop != GardenCropSpeed.lastBrokenCrop) return @@ -58,7 +58,7 @@ object GardenStartLocation { @SubscribeEvent fun onRenderWorld(event: LorenzRenderWorldEvent) { if (!isEnabled()) return - val startLocations = GardenAPI.config?.cropStartLocations ?: return + val startLocations = GardenAPI.storage?.cropStartLocations ?: return val crop = GardenAPI.cropInHand ?: return val location = startLocations[crop]?.add(-0.5, 0.5, -0.5) ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt index 38f17dbf3..c4f311941 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/CaptureFarmingGear.kt @@ -23,8 +23,8 @@ import kotlin.math.round import kotlin.time.Duration.Companion.days class CaptureFarmingGear { - private val farmingItems get() = GardenAPI.config?.fortune?.farmingItems - private val outdatedItems get() = GardenAPI.config?.fortune?.outdatedItems + private val farmingItems get() = GardenAPI.storage?.fortune?.farmingItems + private val outdatedItems get() = GardenAPI.storage?.fortune?.outdatedItems // TODO USE SH-REPO private val farmingLevelUpPattern = "SKILL LEVEL UP Farming .*➜(?<level>.*)".toPattern() @@ -43,7 +43,7 @@ class CaptureFarmingGear { "FERMENTO", "SQUASH", "CROPIE", "MELON", "FARM", "RANCHERS", "FARMER", "RABBIT" ) - private val farmingItems get() = GardenAPI.config?.fortune?.farmingItems + private val farmingItems get() = GardenAPI.storage?.fortune?.farmingItems fun captureFarmingGear() { val farmingItems = farmingItems ?: return @@ -74,19 +74,19 @@ class CaptureFarmingGear { } for (line in TabListData.getTabList()) { strengthPattern.matchMatcher(line) { - GardenAPI.config?.fortune?.farmingStrength = group("strength").toInt() + GardenAPI.storage?.fortune?.farmingStrength = group("strength").toInt() } } } fun reverseCarrotFortune() { - val storage = GardenAPI.config?.fortune ?: return + val storage = GardenAPI.storage?.fortune ?: return storage.carrotFortune = !storage.carrotFortune LorenzUtils.chat("§2Toggled exportable carrot fortune to: ${storage.carrotFortune}") } fun reversePumpkinFortune() { - val storage = GardenAPI.config?.fortune ?: return + val storage = GardenAPI.storage?.fortune ?: return storage.pumpkinFortune = !storage.pumpkinFortune LorenzUtils.chat("§2Toggled expired pumpkin fortune to: ${storage.pumpkinFortune}") } @@ -100,7 +100,7 @@ class CaptureFarmingGear { @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!LorenzUtils.inSkyBlock) return - val hidden = GardenAPI.config?.fortune ?: return + val storage = GardenAPI.storage?.fortune ?: return val farmingItems = farmingItems ?: return val outdatedItems = outdatedItems ?: return if (event.inventoryName == "Your Equipment and Stats") { @@ -117,7 +117,7 @@ class CaptureFarmingGear { val enchantments = slot.getEnchantments() ?: emptyMap() val greenThumbLvl = (enchantments["green_thumb"] ?: continue) val visitors = FarmingFortuneDisplay.greenThumbFortune / (greenThumbLvl * 0.05) - GardenAPI.config?.uniqueVisitors = round(visitors).toInt() + GardenAPI.storage?.uniqueVisitors = round(visitors).toInt() } } } @@ -170,7 +170,7 @@ class CaptureFarmingGear { if (event.inventoryName.contains("Your Skills")) { for ((_, item) in event.inventoryItems) { if (item.displayName.contains("Farming ")) { - hidden.farmingLevel = item.displayName.split(" ").last().romanToDecimalIfNeeded() + storage.farmingLevel = item.displayName.split(" ").last().romanToDecimalIfNeeded() } } } @@ -194,7 +194,7 @@ class CaptureFarmingGear { plotsUnlocked -= 1 } } - hidden.plotsUnlocked = plotsUnlocked + storage.plotsUnlocked = plotsUnlocked } if (event.inventoryName.contains("Anita")) { var level = -1 @@ -209,9 +209,9 @@ class CaptureFarmingGear { } } if (level == -1) { - hidden.anitaUpgrade = 15 + storage.anitaUpgrade = 15 } else { - hidden.anitaUpgrade = level + storage.anitaUpgrade = level } } } @@ -219,17 +219,17 @@ class CaptureFarmingGear { @SubscribeEvent fun onChat(event: LorenzChatEvent) { if (!LorenzUtils.inSkyBlock) return - val hidden = GardenAPI.config?.fortune ?: return + val storage = GardenAPI.storage?.fortune ?: return val outdatedItems = outdatedItems ?: return val msg = event.message.removeColor().trim() fortuneUpgradePattern.matchMatcher(msg) { ProfileStorageData.playerSpecific?.gardenCommunityUpgrade = group("level").romanToDecimal() } farmingLevelUpPattern.matchMatcher(msg) { - hidden.farmingLevel = group("level").romanToDecimalIfNeeded() + storage.farmingLevel = group("level").romanToDecimalIfNeeded() } anitaBuffPattern.matchMatcher(msg) { - hidden.anitaUpgrade = group("level").toInt() / 4 + storage.anitaUpgrade = group("level").toInt() / 4 } lotusUpgradePattern.matchMatcher(msg) { val piece = group("piece").uppercase() @@ -248,13 +248,13 @@ class CaptureFarmingGear { } } cakePattern.matchMatcher(msg) { - hidden.cakeExpiring = System.currentTimeMillis() + 2.days.inWholeMilliseconds + storage.cakeExpiring = System.currentTimeMillis() + 2.days.inWholeMilliseconds } if (msg == "CARROTS EXPORTATION COMPLETE!") { - hidden.carrotFortune = true + storage.carrotFortune = true } if (msg == "PUMPKINS EXPORTATION COMPLETE!") { - hidden.pumpkinFortune = true + storage.pumpkinFortune = true } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt index b7e103be1..932fbbacd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFGuideGUI.kt @@ -46,7 +46,7 @@ open class FFGuideGUI : GuiScreen() { fun isInGui() = Minecraft.getMinecraft().currentScreen is FFGuideGUI fun FarmingItems.getItem(): ItemStack { - val fortune = GardenAPI.config?.fortune ?: return getFallbackItem(this) + val fortune = GardenAPI.storage?.fortune ?: return getFallbackItem(this) val farmingItems = fortune.farmingItems farmingItems[this]?.let { return it } @@ -467,4 +467,4 @@ open class FFGuideGUI : GuiScreen() { abstract class FFGuidePage { abstract fun drawPage(mouseX: Int, mouseY: Int, partialTicks: Float) } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt index 24d125d56..255d94b24 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FFStats.kt @@ -15,7 +15,7 @@ import net.minecraft.item.ItemStack import kotlin.math.floor object FFStats { - private val toolHasBountiful get() = GardenAPI.config?.toolWithBountiful + private val toolHasBountiful get() = GardenAPI.storage?.toolWithBountiful private val mathCrops = listOf(CropType.WHEAT, CropType.CARROT, CropType.POTATO, CropType.SUGAR_CANE, CropType.NETHER_WART) @@ -51,7 +51,7 @@ object FFStats { val cropPage = mutableMapOf<FortuneStats, Pair<Double, Double>>() fun loadFFData() { - cakeExpireTime = GardenAPI.config?.fortune?.cakeExpiring ?: -1L + cakeExpireTime = GardenAPI.storage?.fortune?.cakeExpiring ?: -1L getEquipmentFFData(FarmingItems.NECKLACE.getItem(), necklaceFF) getEquipmentFFData(FarmingItems.CLOAK.getItem(), cloakFF) @@ -151,12 +151,12 @@ object FFStats { else -> {} } if (crop == CropType.CARROT) { - val storage = GardenAPI.config?.fortune ?: return + val storage = GardenAPI.storage?.fortune ?: return val carrotFortune = if (storage.carrotFortune) 12.0 else 0.0 cropPage[FortuneStats.EXPORTED_CARROT] = Pair(carrotFortune, 12.0) } if (crop == CropType.PUMPKIN) { - val storage = GardenAPI.config?.fortune ?: return + val storage = GardenAPI.storage?.fortune ?: return val pumpkinFortune = if (storage.pumpkinFortune) 12.0 else 0.0 cropPage[FortuneStats.EXPIRED_PUMPKIN] = Pair(pumpkinFortune, 12.0) } @@ -199,13 +199,13 @@ object FFStats { } private fun getGenericFF(out: MutableMap<FFTypes, Double>) { - val savedStats = GardenAPI.config?.fortune ?: return + val storage = GardenAPI.storage?.fortune ?: return out[FFTypes.TOTAL] = 0.0 out[FFTypes.BASE_FF] = 100.0 - out[FFTypes.FARMING_LVL] = savedStats.farmingLevel.toDouble() * 4 + out[FFTypes.FARMING_LVL] = storage.farmingLevel.toDouble() * 4 out[FFTypes.COMMUNITY_SHOP] = (ProfileStorageData.playerSpecific?.gardenCommunityUpgrade ?: -1).toDouble() * 4 - out[FFTypes.PLOTS] = savedStats.plotsUnlocked.toDouble() * 3 - out[FFTypes.ANITA] = savedStats.anitaUpgrade.toDouble() * 4 + out[FFTypes.PLOTS] = storage.plotsUnlocked.toDouble() * 3 + out[FFTypes.ANITA] = storage.anitaUpgrade.toDouble() * 4 if (cakeExpireTime - System.currentTimeMillis() > 0 || cakeExpireTime == -1L) { out[FFTypes.CAKE] = 5.0 } else { @@ -245,7 +245,7 @@ object FFStats { private fun getPetFF(pet: ItemStack): Double { val petLevel = pet.getPetLevel() - val strength = (GardenAPI.config?.fortune?.farmingStrength) + val strength = (GardenAPI.storage?.fortune?.farmingStrength) if (strength != null) { val rawInternalName = pet.getInternalName() return when { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt index 7e79235ff..1f6f80f5a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/FortuneUpgrades.kt @@ -31,22 +31,22 @@ object FortuneUpgrades { val cropSpecificUpgrades = mutableListOf<FortuneUpgrade>() fun generateGenericUpgrades() { - val hidden = GardenAPI.config?.fortune ?: return + val storage = GardenAPI.storage?.fortune ?: return genericUpgrades.clear() - if (hidden.plotsUnlocked != -1 && hidden.plotsUnlocked != 24) { + if (storage.plotsUnlocked != -1 && storage.plotsUnlocked != 24) { genericUpgrades.add( FortuneUpgrade( - "§7Unlock your ${(hidden.plotsUnlocked + 1).addSuffix()} §7plot", - null, "COMPOST", compostNeeded[hidden.plotsUnlocked], 3.0 + "§7Unlock your ${(storage.plotsUnlocked + 1).addSuffix()} §7plot", + null, "COMPOST", compostNeeded[storage.plotsUnlocked], 3.0 ) ) } - if (hidden.anitaUpgrade != -1 && hidden.anitaUpgrade != 15) { + if (storage.anitaUpgrade != -1 && storage.anitaUpgrade != 15) { genericUpgrades.add( FortuneUpgrade( - "§7Upgrade Anita bonus to level ${hidden.anitaUpgrade + 1}", - null, "JACOBS_TICKET", anitaTicketsNeeded[hidden.anitaUpgrade], 4.0 + "§7Upgrade Anita bonus to level ${storage.anitaUpgrade + 1}", + null, "JACOBS_TICKET", anitaTicketsNeeded[storage.anitaUpgrade], 4.0 ) ) } @@ -91,7 +91,7 @@ object FortuneUpgrades { } private fun getEquipmentUpgrades() { - val visitors = GardenAPI.config?.uniqueVisitors?.toDouble() ?: 0.0 + val visitors = GardenAPI.storage?.uniqueVisitors?.toDouble() ?: 0.0 for (piece in equipment) { val item = piece.getItem() //todo tell them to buy the missing item @@ -296,4 +296,4 @@ object FortuneUpgrades { // no support for people with 5% discount private val anitaTicketsNeeded = listOf(0, 50, 50, 100, 100, 150, 150, 200, 200, 250, 300, 350, 400, 450, 1000) -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt index 904ec9bb4..2af928a30 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt @@ -31,7 +31,7 @@ class AnitaExtraFarmingFortune { if (!stack.displayName.contains("Extra Farming Fortune")) return - val anitaUpgrade = GardenAPI.config?.fortune?.anitaUpgrade ?: return + val anitaUpgrade = GardenAPI.storage?.fortune?.anitaUpgrade ?: return var contributionFactor = 1.0 val baseAmount = levelPrice[anitaUpgrade + 1]?.jacob_tickets ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenPlotIcon.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenPlotIcon.kt index 11318553c..eb4f31176 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenPlotIcon.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenPlotIcon.kt @@ -22,7 +22,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent object GardenPlotIcon { private val config get() = SkyHanniMod.feature.garden.plotIcon - private val plotList get() = GardenAPI.config?.plotIcon?.plotList + private val plotList get() = GardenAPI.storage?.plotIcon?.plotList private var inInventory = false private var copyStack: ItemStack? = null private var editMode = 0 // 0 = off, 1 = on, 2 = reset @@ -152,4 +152,4 @@ object GardenPlotIcon { } } } -}
\ No newline at end of file +} diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt index 1f1b10143..2213f9482 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt @@ -73,7 +73,7 @@ object GardenVisitorDropStatistics { if (!ProfileStorageData.loaded) return if (lastAccept - System.currentTimeMillis() <= 0 && lastAccept - System.currentTimeMillis() > -1000) { val message = event.message.removeColor().trim() - val storage = GardenAPI.config?.visitorDrops ?: return + val storage = GardenAPI.storage?.visitorDrops ?: return copperPattern.matchMatcher(message) { val amount = group("amount").formatNumber().toInt() @@ -116,7 +116,7 @@ object GardenVisitorDropStatistics { private fun setRarities(rarity: String) { acceptedVisitors += 1 val currentRarity = VisitorRarity.valueOf(rarity) - val visitorRarities = GardenAPI.config?.visitorDrops?.visitorRarities ?: return + val visitorRarities = GardenAPI.storage?.visitorDrops?.visitorRarities ?: return val temp = visitorRarities[currentRarity.ordinal] + 1 visitorRarities[currentRarity.ordinal] = temp saveAndUpdate() @@ -194,7 +194,7 @@ object GardenVisitorDropStatistics { fun saveAndUpdate() { if (!GardenAPI.inGarden()) return - val storage = GardenAPI.config?.visitorDrops ?: return + val storage = GardenAPI.storage?.visitorDrops ?: return storage.acceptedVisitors = acceptedVisitors storage.deniedVisitors = deniedVisitors totalVisitors = acceptedVisitors + deniedVisitors @@ -205,7 +205,7 @@ object GardenVisitorDropStatistics { @SubscribeEvent fun onConfigLoad(event: ConfigLoadEvent) { - val storage = GardenAPI.config?.visitorDrops ?: return + val storage = GardenAPI.storage?.visitorDrops ?: return if (storage.visitorRarities.size == 0) { storage.visitorRarities.add(0) storage.visitorRarities.add(0) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt index d397d6a86..54dfb6d62 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorTimer.kt @@ -33,10 +33,10 @@ class GardenVisitorTimer { //TODO nea? // private val visitorInterval by dynamic(GardenAPI::config, Storage.ProfileSpecific.GardenStorage::visitorInterval) private var visitorInterval: Long? - get() = GardenAPI.config?.visitorInterval + get() = GardenAPI.storage?.visitorInterval set(value) { value?.let { - GardenAPI.config?.visitorInterval = it + GardenAPI.storage?.visitorInterval = it } } @@ -99,7 +99,7 @@ class GardenVisitorTimer { if (lastVisitors != -1 && visitorsAmount - lastVisitors == 1) { if (!queueFull) { visitorInterval = ((millis - 1) / 60_000L + 1) * 60_000L - GardenAPI.config?.visitorInterval = visitorInterval + GardenAPI.storage?.visitorInterval = visitorInterval } else { updateSixthVisitorArrivalTime() } @@ -112,7 +112,7 @@ class GardenVisitorTimer { sixthVisitorReady = false } millis = sixthVisitorArrivalTime - System.currentTimeMillis() - GardenAPI.config?.nextSixthVisitorArrival = + GardenAPI.storage?.nextSixthVisitorArrival = System.currentTimeMillis() + millis + (5 - visitorsAmount) * visitorInterval if (isSixthVisitorEnabled() && millis < 0) { visitorsAmount++ @@ -156,7 +156,7 @@ class GardenVisitorTimer { @SubscribeEvent fun onWorldChange(event: LorenzWorldChangeEvent) { lastVisitors = -1 - GardenAPI.config?.nextSixthVisitorArrival?.let { + GardenAPI.storage?.nextSixthVisitorArrival?.let { sixthVisitorArrivalTime = it } sixthVisitorReady = false diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt index e4b962281..4dfebc099 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CurrentPetDisplay.kt @@ -48,7 +48,7 @@ class CurrentPetDisplay { @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { - val config = ProfileStorageData.profileSpecific ?: return + val storage = ProfileStorageData.profileSpecific ?: return if (!inventoryNamePattern.matcher(event.inventoryName).matches()) return val lore = event.inventoryItems[4]?.getLore() ?: return @@ -56,7 +56,7 @@ class CurrentPetDisplay { for (line in lore) { selectedPetPattern.matchMatcher(line) { val newPet = group("pet") - config.currentPet = if (newPet != "§cNone") newPet else "" + storage.currentPet = if (newPet != "§cNone") newPet else "" } } } @@ -67,9 +67,9 @@ class CurrentPetDisplay { if (RiftAPI.inRift()) return if (!SkyHanniMod.feature.misc.pets.display) return - val config = ProfileStorageData.profileSpecific ?: return + val storage = ProfileStorageData.profileSpecific ?: return - SkyHanniMod.feature.misc.petDisplayPos.renderString(config.currentPet, posLabel = "Current Pet") + SkyHanniMod.feature.misc.petDisplayPos.renderString(storage.currentPet, posLabel = "Current Pet") } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/KloonHacking.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/KloonHacking.kt index 3aaafc42a..aa598c10b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/KloonHacking.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/area/westvillage/KloonHacking.kt @@ -115,9 +115,9 @@ class KloonHacking { if (!RiftAPI.inRift()) return if (!config.waypoints) return if (!wearingHelmet) return - val hidden = ProfileStorageData.profileSpecific?.rift ?: return + val storage = ProfileStorageData.profileSpecific?.rift ?: return for (terminal in KloonTerminal.entries) { - if (terminal !in hidden.completedKloonTerminals) { + if (terminal !in storage.completedKloonTerminals) { event.drawWaypointFilled(terminal.location, LorenzColor.DARK_RED.toColor(), true, true) } } @@ -128,11 +128,11 @@ class KloonHacking { if (!RiftAPI.inRift()) return if (!wearingHelmet) return pattern.matchMatcher(event.message.removeColor()) { - val hidden = ProfileStorageData.profileSpecific?.rift ?: return + val storage = ProfileStorageData.profileSpecific?.rift ?: return val colour = group("colour") val completedTerminal = KloonTerminal.entries.firstOrNull { it.name == colour } ?: return if (completedTerminal != nearestTerminal) return - hidden.completedKloonTerminals.add(completedTerminal) + storage.completedKloonTerminals.add(completedTerminal) } } |