aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt
index 00f57b519..20dde4bcf 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/DungeonFinderFeatures.kt
@@ -21,6 +21,7 @@ import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+// TODO Remove all removeColor calls in this class. Deal with the color code in regex.
class DungeonFinderFeatures {
private val config get() = SkyHanniMod.feature.dungeon.partyFinder
@@ -145,6 +146,7 @@ class DungeonFinderFeatures {
val name = stack.displayName.removeColor()
map[slot] = if (anyFloorPattern.matches(name)) {
"A"
+
} else if (entranceFloorPattern.matches(name)) {
"E"
} else if (floorPattern.matches(name)) {
@@ -166,13 +168,8 @@ class DungeonFinderFeatures {
val floorNum = floorNumberPattern.matchMatcher(floor) {
group("floorNum").romanToDecimalIfNecessary()
}
- map[slot] = if (entranceFloorPattern.matches(floor)) {
- "E"
- } else if (masterModeFloorPattern.matches(dungeon)) {
- "M$floorNum"
- } else {
- "F$floorNum"
- }
+
+ map[slot] = getFloorName(floor, dungeon, floorNum)
}
}
@@ -194,17 +191,20 @@ class DungeonFinderFeatures {
val floorNum = floorNumberPattern.matchMatcher(name) {
group("floorNum").romanToDecimalIfNecessary()
} ?: continue
- map[slot] = if (entranceFloorPattern.matches(name)) {
- "E"
- } else if (masterModeFloorPattern.matches(name)) {
- "M$floorNum"
- } else {
- "F$floorNum"
- }
+ map[slot] = getFloorName(name, name, floorNum)
}
}
+ private fun getFloorName(floor: String, dungeon: String, floorNum: Int?): String =
+ if (entranceFloorPattern.matches(floor)) {
+ "E"
+ } else if (masterModeFloorPattern.matches(dungeon)) {
+ "M$floorNum"
+ } else {
+ "F$floorNum"
+ }
+
private fun highlightingHandler(event: InventoryOpenEvent): Map<Int, LorenzColor> {
val map = mutableMapOf<Int, LorenzColor>()
if (!partyFinderTitlePattern.matches(event.inventoryName)) return map