diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-02-24 18:07:19 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-02-24 18:07:19 +0100 |
commit | f9d25d9808ff860df682722bb7452cd2111c4c96 (patch) | |
tree | bd2b080b2e26848996b15e880134f48b848c1baf /src/main/java | |
parent | 079d63780bad6334e402300b51f4fb32319fec2c (diff) | |
download | skyhanni-f9d25d9808ff860df682722bb7452cd2111c4c96.tar.gz skyhanni-f9d25d9808ff860df682722bb7452cd2111c4c96.tar.bz2 skyhanni-f9d25d9808ff860df682722bb7452cd2111c4c96.zip |
better skill support for /shdebug
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt index 22b72f3b0..a1e74a17e 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt @@ -193,30 +193,54 @@ object SkillAPI { } @SubscribeEvent - fun onDebugDataCollect(event: DebugDataCollectEvent) { - event.title("Skills") + fun onDebugDataCollectCurrent(event: DebugDataCollectEvent) { + event.title("Current Skill") val storage = storage if (storage == null) { event.addIrrelevant("SkillMap is empty") return } + event.addData { - for ((skillName, skillInfo) in storage) { - add("- Name: $skillName") - add("- Level: ${skillInfo.level}") - add("- CurrentXp: ${skillInfo.currentXp}") - add("- CurrentXpMax: ${skillInfo.currentXpMax}") - add("- TotalXp: ${skillInfo.totalXp}") - add("- OverflowLevel: ${skillInfo.overflowLevel}") - add("- OverflowCurrentXp: ${skillInfo.overflowCurrentXp}") - add("- OverflowCurrentXpMax: ${skillInfo.overflowCurrentXpMax}") - add("- OverflowTotalXp: ${skillInfo.overflowTotalXp}") - add("- CustomGoalLevel: ${skillInfo.customGoalLevel}\n") + val skillType = activeSkill + if (skillType == null) { + event.addIrrelevant("activeSkill is null") + } + storage[skillType]?.let { skillInfo -> + addDebug(skillType, skillInfo) } + } + } + + @SubscribeEvent + fun onDebugDataCollectAll(event: DebugDataCollectEvent) { + event.title("All Skills") + val storage = storage + if (storage == null) { + event.addIrrelevant("SkillMap is empty") + return + } + event.addIrrelevant { + for ((skillType, skillInfo) in storage) { + addDebug(skillType, skillInfo) + } } } + private fun MutableList<String>.addDebug(skillType: SkillType?, skillInfo: SkillInfo) { + add("Name: $skillType") + add("- Level: ${skillInfo.level}") + add("- CurrentXp: ${skillInfo.currentXp}") + add("- CurrentXpMax: ${skillInfo.currentXpMax}") + add("- TotalXp: ${skillInfo.totalXp}") + add("- OverflowLevel: ${skillInfo.overflowLevel}") + add("- OverflowCurrentXp: ${skillInfo.overflowCurrentXp}") + add("- OverflowCurrentXpMax: ${skillInfo.overflowCurrentXpMax}") + add("- OverflowTotalXp: ${skillInfo.overflowTotalXp}") + add("- CustomGoalLevel: ${skillInfo.customGoalLevel}\n") + } + private fun runTimer(skillName: String, info: SkillXPInfo) { fixedRateTimer(name = "skyhanni-skillprogress-timer-$skillName", initialDelay = 1_000L, period = 1_000L) { if (info.shouldStartTimer) cancel() |