From 3d76538cef0cb150415ef5db734c80fb0dec7e85 Mon Sep 17 00:00:00 2001 From: nea Date: Fri, 2 Jun 2023 02:32:02 +0200 Subject: Display rank alongside name --- .../kotlin/moe/nea/firmament/gui/profileviewer/SkillPage.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/main/kotlin/moe/nea/firmament/gui/profileviewer/SkillPage.kt') diff --git a/src/main/kotlin/moe/nea/firmament/gui/profileviewer/SkillPage.kt b/src/main/kotlin/moe/nea/firmament/gui/profileviewer/SkillPage.kt index 8f0693f..d189b5b 100644 --- a/src/main/kotlin/moe/nea/firmament/gui/profileviewer/SkillPage.kt +++ b/src/main/kotlin/moe/nea/firmament/gui/profileviewer/SkillPage.kt @@ -10,6 +10,7 @@ import io.github.cottonmc.cotton.gui.widget.icon.ItemIcon import net.minecraft.item.ItemStack import net.minecraft.item.Items import net.minecraft.text.Text +import net.minecraft.util.Formatting import moe.nea.firmament.apis.Skill import moe.nea.firmament.gui.WBar import moe.nea.firmament.repo.RepoManager @@ -19,7 +20,16 @@ object SkillPage : ProfilePage { override fun getElements(profileViewer: ProfileViewer): WWidget { return WGridPanel().also { it.insets = Insets.ROOT_PANEL - it.add(WText(Text.literal(profileViewer.primaryName /* with rank? */)), 0, 0, 6, 1) + it.add( + WText( + Text.literal( + profileViewer.account.rankData?.let { + ("§${it.color}[${it.tag}${profileViewer.account.rankPlusDyeColor.modern}" + + "${it.plus ?: ""}§${it.color}] ${profileViewer.primaryName}") + } ?: "§${Formatting.GRAY}${profileViewer.primaryName}" + ) + ), 0, 0, 6, 1 + ) for ((i, skill) in Skill.values().withIndex()) { val leveling = RepoManager.neuRepo.constants.leveling val exp = skill.accessor.get(profileViewer.member) -- cgit