diff options
-rw-r--r-- | CHANGELOG.md | 4 | ||||
-rw-r--r-- | src/main/java/eu/olli/cowlection/listener/DungeonsListener.java | 22 |
2 files changed, 20 insertions, 6 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index ee80a5c..99ac77c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,13 +5,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [1.8.9-0.8.0] - unreleased ### Added -- Dungeon update! +- Dungeon update (part 1) - Added Dungeon item stats tooltip cleaner - goal: normalize stats to make comparing dungeon items much easier - hold <kbd>shift</kbd> while viewing the tooltip of a dungeon item: this will normalize stats (remove stats from reforging and essences ✪), recalculate the item stats inside dungeons, and display the item stats inside dungeons if it had been enhanced 5x with essences (✪) - Added Dungeon Party Finder improvements - indicate parties that (don't) meet certain criteria: "no duped roles", "class levels have to be lvl >X" - - adjustable via `/moo config` + - adjustable via `/moo config` ### Changed - Replaced `/moo nameChangeCheck` with `/moo nameChangeCheck <playerName>` diff --git a/src/main/java/eu/olli/cowlection/listener/DungeonsListener.java b/src/main/java/eu/olli/cowlection/listener/DungeonsListener.java index 127f2bf..a45d451 100644 --- a/src/main/java/eu/olli/cowlection/listener/DungeonsListener.java +++ b/src/main/java/eu/olli/cowlection/listener/DungeonsListener.java @@ -13,6 +13,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.MathHelper; import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.common.util.Constants; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import org.apache.commons.lang3.StringUtils; @@ -101,10 +102,23 @@ public class DungeonsListener { Matcher lineMatcher = TOOLTIP_LINE_PATTERN.matcher(line); if (lineMatcher.matches()) { if (EnumChatFormatting.getTextWithoutFormattingCodes(lineMatcher.group("prefix")).equals("Gear Score: ")) { - // gear score: gray + strike through because gear score doesn't really mean anything - String newToolTipLine = String.format("%s%s%s%s %s(%s%s%s)", lineMatcher.group("prefix"), grayedOutFormatting, lineMatcher.group("statNonDungeon"), EnumChatFormatting.RESET, // space - EnumChatFormatting.GRAY, grayedOutFormatting, lineMatcher.group("statDungeon"), EnumChatFormatting.GRAY); - tooltipIterator.set(newToolTipLine); + // replace meaningless gear score with item quality (gear score includes reforges etc) + StringBuilder customGearScore = new StringBuilder(EnumChatFormatting.GRAY.toString()).append("Item Quality: "); + boolean hasCustomGearScore = false; + if (extraAttributes.hasKey("baseStatBoostPercentage")) { + int itemQuality = extraAttributes.getInteger("baseStatBoostPercentage") * 2; // value between 0 and 50 => *2 == in % + customGearScore.append(EnumChatFormatting.LIGHT_PURPLE).append(itemQuality).append("%"); + hasCustomGearScore = true; + } + if (extraAttributes.hasKey("item_tier", Constants.NBT.TAG_INT)) { + int obtainedFromFloor = extraAttributes.getInteger("item_tier"); + customGearScore.append(EnumChatFormatting.GRAY).append(" (Floor ").append(EnumChatFormatting.LIGHT_PURPLE).append(obtainedFromFloor).append(EnumChatFormatting.GRAY).append(")"); + hasCustomGearScore = true; + } + if (!hasCustomGearScore) { + customGearScore.append(EnumChatFormatting.ITALIC).append("unknown"); + } + tooltipIterator.set(customGearScore.toString()); continue; } try { |