diff options
author | Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> | 2024-06-23 20:06:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-23 20:06:17 +0200 |
commit | 6eb085f4e2ba69e98934ffa9489c8679ba23d244 (patch) | |
tree | 6f3f4abe26118a5c14ed84ce48408b17665be79f /src/main/java/at/hannibal2/skyhanni/data/model | |
parent | 78f5f7b94bdc48c3395ef17f30022b8cd653a776 (diff) | |
download | skyhanni-6eb085f4e2ba69e98934ffa9489c8679ba23d244.tar.gz skyhanni-6eb085f4e2ba69e98934ffa9489c8679ba23d244.tar.bz2 skyhanni-6eb085f4e2ba69e98934ffa9489c8679ba23d244.zip |
Feature: Reforge helper (#1437)
Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com>
Co-authored-by: hannibal2 <24389977+hannibal002@users.noreply.github.com>
Co-authored-by: Cal <cwolfson58@gmail.com>
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data/model')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/data/model/SkyblockStat.kt | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/model/SkyblockStat.kt b/src/main/java/at/hannibal2/skyhanni/data/model/SkyblockStat.kt new file mode 100644 index 000000000..161ec76f5 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/data/model/SkyblockStat.kt @@ -0,0 +1,80 @@ +package at.hannibal2.skyhanni.data.model + +import at.hannibal2.skyhanni.utils.StringUtils.allLettersFirstUppercase +import net.minecraft.client.Minecraft +import java.util.EnumMap + +enum class SkyblockStat(val icon: String) { + DAMAGE("§c❁"), + HEALTH("§c❤"), + DEFENSE("§a❈"), + STRENGTH("§c❁"), + INTELLIGENCE("§b✎"), + CRIT_DAMAGE("§9☠"), + CRIT_CHANCE("§9☣"), + FEROCITY("§c⫽"), + BONUS_ATTACK_SPEED("§e⚔"), + ABILITY_DAMAGE("§c๑"), + HEALTH_REGEN("§c❣"), + VITALITY("§4♨"), + MENDING("§a☄"), + TRUE_DEFENCE("§7❂"), + SWING_RANGE("§eⓈ"), + SPEED("§f✦"), + SEA_CREATURE_CHANCE("§3α"), + MAGIC_FIND("§b✯"), + PET_LUCK("§d♣"), + FISHING_SPEED("§b☂"), + BONUS_PEST_CHANCE("§2ൠ"), + COMBAT_WISDOM("§3☯"), + MINING_WISDOM("§3☯"), + FARMING_WISDOM("§3☯"), + FORAGING_WISDOM("§3☯"), + FISHING_WISDOM("§3☯"), + ENCHANTING_WISDOM("§3☯"), + ALCHEMY_WISDOM("§3☯"), + CARPENTRY_WISDOM("§3☯"), + RUNECRAFTING_WISDOM("§3☯"), + SOCIAL_WISDOM("§3☯"), + TAMING_WISDOM("§3☯"), + MINING_SPEED("§6⸕"), + BREAKING_POWER("§2Ⓟ"), + PRISTINE("§5✧"), + FORAGING_FORTUNE("§☘"), + FARMING_FORTUNE("§6☘"), + MINING_FORTUNE("§6☘"), + FEAR("§a☠") + ; + + val capitalizedName = name.lowercase().allLettersFirstUppercase() + + val iconWithName = "$icon $capitalizedName" + + fun asString(value: Int) = (if (value > 0) "+" else "") + value.toString() + " " + this.icon + + companion object { + val fontSizeOfLargestIcon by lazy { + entries.maxOf { Minecraft.getMinecraft().fontRendererObj.getStringWidth(it.icon) } + 1 + } + } +} + +class SkyblockStatList : EnumMap<SkyblockStat, Double>(SkyblockStat::class.java), Map<SkyblockStat, Double> { + operator fun minus(other: SkyblockStatList): SkyblockStatList { + return SkyblockStatList().apply { + val keys = this.keys + other.keys + for (key in keys) { + this[key] = (this@SkyblockStatList[key] ?: 0.0) - (other[key] ?: 0.0) + } + } + } + + companion object { + fun mapOf(vararg list: Pair<SkyblockStat, Double>) = SkyblockStatList().apply { + for ((key, value) in list) { + this[key] = value + } + } + } +} + |