diff options
author | Cow <cow@volloeko.de> | 2021-06-29 15:02:57 +0200 |
---|---|---|
committer | Cow <cow@volloeko.de> | 2021-06-29 15:02:57 +0200 |
commit | b2e1c53efabf3fc1d46f36feb674b615425d0b54 (patch) | |
tree | 45c2306f0c7cc841d65688684ccf4544e8e3dd38 | |
parent | eb0d8a25027a874ad2341cb77883fa5cc06cfd88 (diff) | |
download | Cowlection-b2e1c53efabf3fc1d46f36feb674b615425d0b54.tar.gz Cowlection-b2e1c53efabf3fc1d46f36feb674b615425d0b54.tar.bz2 Cowlection-b2e1c53efabf3fc1d46f36feb674b615425d0b54.zip |
Added support for 'new' SkyBlock content
- Added Enderman slayer and Voidling minions
- Added support for HPB and master stars
7 files changed, 56 insertions, 20 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index f3a0cde..161e373 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - (Dungeons) player lookups: - added ironman icon ♲ - added average secrets per completion +- Added data for Enderman slayer and Voidling minions + +### Fixed +- 'Show Dungeon item base stats' feature now works with HPB'd items and master stars +- Fixed Mythic pets level in player lookup ## [1.8.9-0.13.0] - 25.04.2021 ### Added diff --git a/src/main/java/de/cowtipper/cowlection/command/MooCommand.java b/src/main/java/de/cowtipper/cowlection/command/MooCommand.java index 6e5cc0e..ceff45d 100644 --- a/src/main/java/de/cowtipper/cowlection/command/MooCommand.java +++ b/src/main/java/de/cowtipper/cowlection/command/MooCommand.java @@ -14,6 +14,7 @@ import de.cowtipper.cowlection.config.gui.MooConfigGui; import de.cowtipper.cowlection.data.*; import de.cowtipper.cowlection.data.HySkyBlockStats.Profile.Pet; import de.cowtipper.cowlection.handler.DungeonCache; +import de.cowtipper.cowlection.listener.skyblock.DungeonsListener; import de.cowtipper.cowlection.listener.skyblock.DungeonsPartyListener; import de.cowtipper.cowlection.search.GuiSearch; import de.cowtipper.cowlection.util.*; diff --git a/src/main/java/de/cowtipper/cowlection/data/DataHelper.java b/src/main/java/de/cowtipper/cowlection/data/DataHelper.java index cb81c0a..ee2abe3 100644 --- a/src/main/java/de/cowtipper/cowlection/data/DataHelper.java +++ b/src/main/java/de/cowtipper/cowlection/data/DataHelper.java @@ -34,7 +34,7 @@ public final class DataHelper { public static SkyBlockRarity getPetRarityByColorCode(String colorCode) { if (MYTHIC.rarityColor.toString().equals(colorCode)) { - // special case: Mystic Bat + // special case: Mystic pets return LEGENDARY; } for (SkyBlockRarity petRarity : getPetRarities()) { @@ -79,7 +79,9 @@ public final class DataHelper { BUILD_BATTLE("Build Battle"), DUELS("Duels"), SKYBLOCK("SkyBlock"), - PIT("Pit"); + PIT("Pit"), + REPLAY("Replay"), + SMP("SMP"); private final String cleanName; @@ -569,6 +571,18 @@ public final class DataHelper { minions.put("d0197c8a4eaca2e5cc1b287ac84c62ef8c9f63068218105292dd89c3f7e64596", "Revenant X"); minions.put("9cf6f95308bedb182b434aa73058aa8d69818b48900396cebc127c1bf7df6790", "Revenant XI"); + minions.put("3a851ed2ce5c2c0523af772d206d9555e2e1383ec87946e6ff4c51186e29ef7f", "Voidling I"); + minions.put("bc494af6b45980cb2b035007c25e1b4e169371c410fe5d2708daa4f695668fd2", "Voidling II"); + minions.put("4092f0e0e390f1d2382c908b0a8a90f988458ba8cfa13773f81faa6fc0c906f2", "Voidling III"); + minions.put("be983af1e4fd62b3ad436b00782a3faebb2e392827097eb96c652e2e5521e438", "Voidling IV"); + minions.put("527465fd028df45d67de911870cabbde33ee4c4f3ba2057c15465e94b495e22f", "Voidling V"); + minions.put("5936fa9d8f9319ff6b20e2d25520ba97e2bbe858d579a34392631515d49cd7eb", "Voidling VI"); + minions.put("6ed0ad0130e99a36cf7d78cae759965476f98025b1833cde5542f7dc42829400", "Voidling VII"); + minions.put("56140d9598bef25911b283649278ac1213697609be939676b8d944e9d63577bc", "Voidling VIII"); + minions.put("76a551138ea5378f71f3e6440a00dab112e60ff8b9784cd2010b3ac36123d5a6", "Voidling IX"); + minions.put("7d63d05501d38fac8b0969deb78b68a58fe03c3e0d78cdb84ef1a9a7513ee326", "Voidling X"); + minions.put("7334fc47a50b46ac9df7bf2ed712309ff0b029981368b22db0d539c88f83144f", "Voidling XI"); + minions.put("2fe009c5cfa44c05c88e5df070ae2533bd682a728e0b33bfc93fd92a6e5f3f64", "Skeleton I"); minions.put("3ab6f9c3c911879181dbf2468783348abc671346d5e8c34d118b2b7ece7c47c2", "Skeleton II"); minions.put("ccd9559dc31e4700aaf001e0e2f0bd3517f238af25decd8395f4621404ca4568", "Skeleton III"); diff --git a/src/main/java/de/cowtipper/cowlection/data/HySkyBlockStats.java b/src/main/java/de/cowtipper/cowlection/data/HySkyBlockStats.java index 8a3e067..2fa802b 100644 --- a/src/main/java/de/cowtipper/cowlection/data/HySkyBlockStats.java +++ b/src/main/java/de/cowtipper/cowlection/data/HySkyBlockStats.java @@ -209,7 +209,7 @@ public class HySkyBlockStats { Map<XpTables.Slayer, Integer> slayerLevels = new EnumMap<>(XpTables.Slayer.class); for (XpTables.Slayer slayerBoss : XpTables.Slayer.values()) { SlayerBossDetails bossDetails = slayer_bosses.get(slayerBoss.name().toLowerCase()); - int slayerLevel = slayerBoss.getLevel(bossDetails.xp); + int slayerLevel = bossDetails != null ? slayerBoss.getLevel(bossDetails.xp) : 0; slayerLevels.put(slayerBoss, slayerLevel); } return slayerLevels; diff --git a/src/main/java/de/cowtipper/cowlection/data/XpTables.java b/src/main/java/de/cowtipper/cowlection/data/XpTables.java index efa576a..74abad5 100644 --- a/src/main/java/de/cowtipper/cowlection/data/XpTables.java +++ b/src/main/java/de/cowtipper/cowlection/data/XpTables.java @@ -140,7 +140,7 @@ public class XpTables { } public enum Slayer { - ZOMBIE, SPIDER, WOLF(true); + ZOMBIE, SPIDER, WOLF(true), ENDERMAN(true); private final boolean alternativeXpFormula; /** * Valid for Zombie + Spider @@ -260,7 +260,12 @@ public class XpTables { } public static int getLevel(String rarity, double exp) { - TreeSet<Integer> xpToLevels = PET_XP.get(DataHelper.SkyBlockRarity.valueOf(rarity)); + DataHelper.SkyBlockRarity petRarity = DataHelper.SkyBlockRarity.valueOf(rarity); + if (petRarity == DataHelper.SkyBlockRarity.MYTHIC) { + // special case: Mystic pets + petRarity = DataHelper.SkyBlockRarity.LEGENDARY; + } + TreeSet<Integer> xpToLevels = PET_XP.get(petRarity); if (xpToLevels != null) { return xpToLevels.headSet((int) exp, true).size(); } else { diff --git a/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsListener.java b/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsListener.java index 1ca65fa..9ae5d7e 100644 --- a/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsListener.java +++ b/src/main/java/de/cowtipper/cowlection/listener/skyblock/DungeonsListener.java @@ -31,8 +31,7 @@ import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.common.util.Constants; import net.minecraftforge.event.entity.player.ItemTooltipEvent; -import net.minecraftforge.fml.common.eventhandler.EventPriority; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.eventhandler.*; import net.minecraftforge.fml.common.gameevent.TickEvent; import net.minecraftforge.fml.relauncher.Side; import org.lwjgl.input.Mouse; @@ -67,6 +66,7 @@ public class DungeonsListener { * <li>§7Health: §a+107 HP §8(+133.75 HP)</li> * <li>§7Defense: §a+130 §8(Heavy +65) §8(+162.5)</li> * <li>§7Speed: §a-1 §8(Heavy -1)</li> + * <li>§7Health: §a+432 HP §e(+60 HP) §9(Ancient +7 HP) §8(+1,032.48 HP)</li> * </ul> * <pre> * | Groups | Example matches | @@ -74,14 +74,16 @@ public class DungeonsListener { * | Group `prefix` | §7Crit Damage: §c | * | Group `statNonDungeon` | +23 | * | Group `statNonDungeonUnit` | % | + * | Group `statHpb` | +60 | * | Group `colorReforge` | §8 | * | Group `reforge` | Heavy | * | Group `statReforge` | -3 | - * | Group `statReforgeUnit` | % | * | Group `colorDungeon` | §8 | + * | Group `statDungeon` | +42 | + * | Group `statDungeonUnit` | % | * </pre> */ - private final Pattern TOOLTIP_LINE_PATTERN = Pattern.compile("^(?<prefix>(?:" + FORMATTING_CODE + ")+[A-Za-z ]+: " + FORMATTING_CODE + ")(?<statNonDungeon>[+-]?[0-9]+)(?<statNonDungeonUnit>%| HP|)(?: (?<colorReforge>" + FORMATTING_CODE + ")\\((?<reforge>[A-Za-z]+) (?<statReforge>[+-]?[0-9]+)(?<statReforgeUnit>%| HP|)\\))?(?: (?<colorDungeon>" + FORMATTING_CODE + ")\\((?<statDungeon>[+-]?[.0-9]+)(?<statDungeonUnit>%| HP|)\\))?$"); + private final Pattern TOOLTIP_LINE_PATTERN = Pattern.compile("^(?<prefix>(?:" + FORMATTING_CODE + ")+[A-Za-z ]+: " + FORMATTING_CODE + ")(?<statNonDungeon>[+-]?[0-9]+)(?<statNonDungeonUnit>%| HP|)(?: §e\\(\\+(?<statHpb>[0-9]+)(?: HP)?\\))?(?: (?<colorReforge>" + FORMATTING_CODE + ")\\((?<reforge>[A-Za-z]+) (?<statReforge>[+-]?[0-9]+)(?:%| HP|)\\))?(?: (?<colorDungeon>" + FORMATTING_CODE + ")\\((?<statDungeon>[+-]?[.,0-9]+)(?<statDungeonUnit>%| HP|)\\))?$"); /** * Player deaths in dungeon: * <ul> @@ -190,6 +192,11 @@ public class DungeonsListener { statBase -= Integer.parseInt(lineMatcher.group("statReforge")); } + if (lineMatcher.group("statHpb") != null) { + // tooltip line has Hot Potato Book stats; subtract them from base stats + statBase -= Integer.parseInt(lineMatcher.group("statHpb")); + } + if (statBase == 0) { // don't redraw 0 stats tooltipIterator.remove(); @@ -198,7 +205,7 @@ public class DungeonsListener { String newToolTipLine = String.format("%s%+d%s", lineMatcher.group("prefix"), statBase, lineMatcher.group("statNonDungeonUnit")); if (lineMatcher.group("statDungeon") != null) { // tooltip line has dungeon stats; update them! - double statDungeon = Double.parseDouble(lineMatcher.group("statDungeon")); + double statDungeon = Double.parseDouble(lineMatcher.group("statDungeon").replace(",", "")); double dungeonStatModifier = statDungeon / statNonDungeon; // modified through skill level or gear essence upgrades if (extraAttributes.hasKey("dungeon_item_level")) { diff --git a/src/main/java/de/cowtipper/cowlection/util/Utils.java b/src/main/java/de/cowtipper/cowlection/util/Utils.java index f15b095..4b5c73c 100644 --- a/src/main/java/de/cowtipper/cowlection/util/Utils.java +++ b/src/main/java/de/cowtipper/cowlection/util/Utils.java @@ -347,18 +347,22 @@ public final class Utils { } } } - // remove essence upgrade indicators (✪) - String essenceUpgradeIndicator = EnumChatFormatting.GOLD + "✪"; - int essenceModifier = modifiedItemName.indexOf(essenceUpgradeIndicator); - while (essenceModifier > 0) { - if (strikethrough) { - modifiedItemName.replace(essenceModifier, essenceModifier + essenceUpgradeIndicator.length(), grayedOutFormatting + "✪"); + // remove or 'hide' essence upgrade indicators (✪) + replaceInStringBuilder(modifiedItemName, EnumChatFormatting.GOLD + "✪", grayedOutFormatting + "✪", strikethrough); + replaceInStringBuilder(modifiedItemName, EnumChatFormatting.RED + "✪", "" + EnumChatFormatting.DARK_GRAY + EnumChatFormatting.STRIKETHROUGH + "✪", strikethrough); + + return Pair.of(modifiedItemName.toString().trim(), reforge); + } + + private static void replaceInStringBuilder(StringBuilder sb, String search, String replacement, boolean replace) { + int hit = sb.indexOf(search); + while (hit > 0) { + if (replace) { + sb.replace(hit, hit + search.length(), replacement); } else { - modifiedItemName.delete(essenceModifier, essenceModifier + essenceUpgradeIndicator.length()); + sb.delete(hit, hit + search.length()); } - essenceModifier = modifiedItemName.indexOf(essenceUpgradeIndicator); + hit = sb.indexOf(search); } - - return Pair.of(modifiedItemName.toString().trim(), reforge); } } |