aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin')
-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
}
}