aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/io
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-04-12 08:00:46 +0200
committerGitHub <noreply@github.com>2024-04-12 08:00:46 +0200
commit3cd5ec334fb6cbbdf4e44f471c9895cca8db1000 (patch)
treeccd1d53894102afbe86e3f9781fa1f6a5b015ea3 /src/main/kotlin/io
parent810d9c3bdbfc2323bf9ddc76f944e39aa8b86fbf (diff)
downloadNotEnoughUpdates-3cd5ec334fb6cbbdf4e44f471c9895cca8db1000.tar.gz
NotEnoughUpdates-3cd5ec334fb6cbbdf4e44f471c9895cca8db1000.tar.bz2
NotEnoughUpdates-3cd5ec334fb6cbbdf4e44f471c9895cca8db1000.zip
Fix skill experience detection (#1085)
Diffstat (limited to 'src/main/kotlin/io')
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/tablisttutorial/TablistAPI.kt15
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/util/TabSkillInfoParser.kt12
2 files changed, 19 insertions, 8 deletions
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/tablisttutorial/TablistAPI.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/tablisttutorial/TablistAPI.kt
index 7ff2f3a3..277ed6e3 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/tablisttutorial/TablistAPI.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/tablisttutorial/TablistAPI.kt
@@ -122,7 +122,18 @@ object TablistAPI {
enum class WidgetNames(val regex: Regex?) {
COMMISSIONS(null),
- SKILLS(null),
+ /*
+ '§e§lSkills:'
+ ' Farming 50: §r§a43.3%'
+ ' Mining 60: §r§c§lMAX'
+ ' Combat 46: §r§a21.7%'
+ ' Foraging 23: §r§a43.5%'
+ * */
+ SKILLS(Regex("Skills:( .*)?")),
+ /*
+ * '§e§lSkills: §r§aCombat 46: §r§321.7%'
+ * */
+ DUNGEON_SKILLS(Regex("Skills: (.*)")),
TRAPPER(null),
FORGE(Regex("Forges:( \\(\\d/\\d\\))?")),
POWDER(Regex.fromLiteral("Powders:")),
@@ -130,7 +141,7 @@ object TablistAPI {
;
override fun toString(): String {
- return this.name.lowercase().split(" ").joinToString(" ") { str ->
+ return this.name.lowercase().split("_").joinToString(" ") { str ->
str.replaceFirstChar {
if (it.isLowerCase()) {
it.titlecase(
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/TabSkillInfoParser.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/TabSkillInfoParser.kt
index 0c3e1901..2f3e256a 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/util/TabSkillInfoParser.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/util/TabSkillInfoParser.kt
@@ -90,14 +90,14 @@ object TabSkillInfoParser {
val nextLevelProgress = nextLevelDiff * progress / 100
val totalXp = levelXp + nextLevelProgress
- val existingLevel = XPInformation.getInstance().getSkillInfo(name) ?: XPInformation.SkillInfo()
+ val existingLevel = XPInformation.getInstance().getSkillInfo(name, false) ?: XPInformation.SkillInfo()
// Only update if the numbers are substantially different
if (!isWithinPercentageRange(totalXp, existingLevel.totalXp.toDouble(), 1.0)) {
existingLevel.level = level
- existingLevel.totalXp = totalXp.toFloat()
- existingLevel.currentXp = nextLevelProgress.toFloat()
- existingLevel.currentXpMax = nextLevelDiff.toFloat()
+ existingLevel.totalXp = totalXp
+ existingLevel.currentXp = nextLevelProgress
+ existingLevel.currentXpMax = nextLevelDiff
XPInformation.getInstance().skillInfoMap[name] = existingLevel
}
@@ -107,13 +107,13 @@ object TabSkillInfoParser {
val name = maxLevelMatcher.group("type")!!.lowercase()
val level = maxLevelMatcher.group("level")!!.toInt()
- val existingLevel = XPInformation.getInstance().getSkillInfo(name) ?: XPInformation.SkillInfo()
+ val existingLevel = XPInformation.getInstance().getSkillInfo(name, false) ?: XPInformation.SkillInfo()
if (existingLevel.level != level) {
existingLevel.level = level
val levelingArray = levelArray(name)
val totalXp = calculateLevelXp(levelingArray, level - 1)
- existingLevel.totalXp = totalXp.toFloat()
+ existingLevel.totalXp = totalXp
XPInformation.getInstance().skillInfoMap[name] = existingLevel
}
}