From f9d25d9808ff860df682722bb7452cd2111c4c96 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 24 Feb 2024 18:07:19 +0100 Subject: better skill support for /shdebug --- .../java/at/hannibal2/skyhanni/api/SkillAPI.kt | 50 ++++++++++++++++------ 1 file changed, 37 insertions(+), 13 deletions(-) (limited to 'src/main/java/at') 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.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() -- cgit