aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorCow <cow@volloeko.de>2020-07-22 17:47:32 +0200
committerCow <cow@volloeko.de>2020-07-22 17:47:32 +0200
commitd73b34dba09385b216890191853157c0e57aacd1 (patch)
treece568b7f1c56450824c8740e5a64521b58b8d402 /src/main
parent3e16f04965279ced357cc832d124eb46bf110b22 (diff)
downloadCowlection-d73b34dba09385b216890191853157c0e57aacd1.tar.gz
Cowlection-d73b34dba09385b216890191853157c0e57aacd1.tar.bz2
Cowlection-d73b34dba09385b216890191853157c0e57aacd1.zip
Added various improvements/fixes (mostly from #mod-suggestions)
- New alias for `/moo` command: `/m` - Fixed more special case dungeon item tooltips - Config option: Change position of item quality in tooltip of dungeon items - `/moo stalk`: Fix players appearing offline when apiSession is set to `false` - Added `/moo say [optional text]`: You can say `moo` again without triggering the command `/moo` - Tab-completable player names now include names from more sources - Some smaller improvements to Dungeon party finder
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/eu/olli/cowlection/command/MooCommand.java21
-rw-r--r--src/main/java/eu/olli/cowlection/config/MooConfig.java11
-rw-r--r--src/main/java/eu/olli/cowlection/listener/ChatListener.java12
-rw-r--r--src/main/java/eu/olli/cowlection/listener/DungeonsListener.java215
-rw-r--r--src/main/resources/assets/cowlection/lang/en_US.lang2
5 files changed, 164 insertions, 97 deletions
diff --git a/src/main/java/eu/olli/cowlection/command/MooCommand.java b/src/main/java/eu/olli/cowlection/command/MooCommand.java
index bd90564..0f469fb 100644
--- a/src/main/java/eu/olli/cowlection/command/MooCommand.java
+++ b/src/main/java/eu/olli/cowlection/command/MooCommand.java
@@ -29,10 +29,8 @@ import org.apache.commons.lang3.StringUtils;
import java.awt.*;
import java.io.IOException;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
import java.util.concurrent.TimeUnit;
public class MooCommand extends CommandBase {
@@ -45,11 +43,16 @@ public class MooCommand extends CommandBase {
@Override
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
if (args.length == 0) {
- sendCommandUsage(sender);
+ main.getChatHelper().sendMessage(EnumChatFormatting.GOLD, "Tried to say " + EnumChatFormatting.YELLOW + getCommandName() + EnumChatFormatting.GOLD + "? Use " + EnumChatFormatting.YELLOW + getCommandName() + " say [optional text]" + EnumChatFormatting.GOLD + " instead.\n"
+ + "Tried to use the command " + EnumChatFormatting.YELLOW + "/" + getCommandName() + EnumChatFormatting.GOLD + "? Use " + EnumChatFormatting.YELLOW + "/" + getCommandName() + " help" + EnumChatFormatting.GOLD + " for a list of available commands");
return;
}
// sub commands: friends & other players
- if (args[0].equalsIgnoreCase("stalk")) {
+ if (args[0].equalsIgnoreCase("say")) {
+ // work-around so you can still say 'moo' in chat without triggering the client-side command
+ String msg = CommandBase.buildString(args, 1);
+ Minecraft.getMinecraft().thePlayer.sendChatMessage(getCommandName() + (!msg.isEmpty() ? " " + msg : ""));
+ } else if (args[0].equalsIgnoreCase("stalk")) {
if (args.length != 2) {
throw new WrongUsageException("/" + getCommandName() + " stalk <playerName>");
} else if (!Utils.isValidMcName(args[1])) {
@@ -296,6 +299,9 @@ public class MooCommand extends CommandBase {
main.getChatHelper().sendMessage(EnumChatFormatting.YELLOW, slothStalking.getPlayerNameFormatted() + EnumChatFormatting.YELLOW + " was last online " + EnumChatFormatting.GOLD + lastOnline.first() + EnumChatFormatting.YELLOW + " ago"
+ (lastOnline.second() != null ? " (" + EnumChatFormatting.GOLD + lastOnline.second() + EnumChatFormatting.YELLOW + ")" : "") + ".");
+ } else if (slothStalking.getLastLogin() > slothStalking.getLastLogout()) {
+ // player is logged in but is hiding their session details from API (My Profile > API settings > Online Status)
+ main.getChatHelper().sendMessage(EnumChatFormatting.YELLOW, EnumChatFormatting.GOLD + slothStalking.getPlayerNameFormatted() + EnumChatFormatting.YELLOW + " is currently playing " + EnumChatFormatting.GOLD + slothStalking.getLastGame() + "\n" + EnumChatFormatting.DARK_GRAY + "(" + slothStalking.getPlayerName() + " hides their session details from the API so that only their current game mode is visible)");
} else {
Pair<String, String> lastOnline = Utils.getDurationAsWords(slothStalking.getLastLogout());
@@ -477,6 +483,11 @@ public class MooCommand extends CommandBase {
}
@Override
+ public List<String> getCommandAliases() {
+ return Collections.singletonList("m");
+ }
+
+ @Override
public String getCommandUsage(ICommandSender sender) {
return "/" + getCommandName() + " help";
}
diff --git a/src/main/java/eu/olli/cowlection/config/MooConfig.java b/src/main/java/eu/olli/cowlection/config/MooConfig.java
index 9604c22..5cd13c7 100644
--- a/src/main/java/eu/olli/cowlection/config/MooConfig.java
+++ b/src/main/java/eu/olli/cowlection/config/MooConfig.java
@@ -44,6 +44,7 @@ public class MooConfig {
// SkyBlock dungeon
public static int[] dungClassRange;
public static boolean dungFilterPartiesWithDupes;
+ public static String dungItemQualityPos;
// logs search config
public static String[] logsDirs;
private static String defaultStartDate;
@@ -136,7 +137,7 @@ public class MooConfig {
Property propNumeralSystem = addConfigEntry(cfg.get(Configuration.CATEGORY_CLIENT,
"numeralSystem", "Arabic numerals: 1, 4, 10", "Use Roman or Arabic numeral system?", new String[]{"Arabic numerals: 1, 4, 10", "Roman numerals: I, IV, X"}), true);
Property propTabCompletableNamesCommands = addConfigEntry(cfg.get(Configuration.CATEGORY_CLIENT,
- "tabCompletableNamesCommands", new String[]{"party", "p", "invite", "visit", "ah", "ignore", "msg", "tell", "w", "boop", "profile"}, "List of commands with a Tab-completable username argument."), true)
+ "tabCompletableNamesCommands", new String[]{"party", "p", "invite", "visit", "ah", "ignore", "msg", "tell", "w", "boop", "profile", "friend", "friends", "f"}, "List of commands with a Tab-completable username argument."), true)
.setValidationPattern(Pattern.compile("^[A-Za-z]+$"));
Property propMoo = addConfigEntry(cfg.get(Configuration.CATEGORY_CLIENT,
"moo", "", "The answer to life the universe and everything. Don't edit this entry manually!", Utils.VALID_UUID_PATTERN), false);
@@ -147,6 +148,8 @@ public class MooConfig {
.setMinValue(-1).setIsListLengthFixed(true);
Property propDungFilterPartiesWithDupes = addConfigEntry(cfg.get(Configuration.CATEGORY_CLIENT,
"dungFilterPartiesWithDupes", false, "Mark parties with duplicated classes?"), true);
+ Property propDungItemQualityPos = addConfigEntry(cfg.get(Configuration.CATEGORY_CLIENT,
+ "dungItemQualityPos", "top", "Position of item quality in tooltip", new String[]{"top", "bottom"}), true);
cfg.setCategoryPropertyOrder(Configuration.CATEGORY_CLIENT, propOrderGeneral);
@@ -179,6 +182,7 @@ public class MooConfig {
// SkyBlock dungeon
dungClassRange = propDungClassRange.getIntList();
dungFilterPartiesWithDupes = propDungFilterPartiesWithDupes.getBoolean();
+ dungItemQualityPos = propDungItemQualityPos.getString();
// logs search config
logsDirs = propLogsDirs.getStringList();
@@ -202,6 +206,7 @@ public class MooConfig {
// SkyBlock dungeon
propDungClassRange.set(dungClassRange);
propDungFilterPartiesWithDupes.set(dungFilterPartiesWithDupes);
+ propDungItemQualityPos.set(dungItemQualityPos);
// logs search config
propLogsDirs.set(logsDirs);
@@ -286,6 +291,10 @@ public class MooConfig {
return numeralSystem.startsWith("Roman");
}
+ public static boolean isDungItemQualityAtTop() {
+ return dungItemQualityPos.equals("top");
+ }
+
public class ConfigEventHandler {
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onEvent(ConfigChangedEvent.OnConfigChangedEvent e) {
diff --git a/src/main/java/eu/olli/cowlection/listener/ChatListener.java b/src/main/java/eu/olli/cowlection/listener/ChatListener.java
index 2532156..6fbc179 100644
--- a/src/main/java/eu/olli/cowlection/listener/ChatListener.java
+++ b/src/main/java/eu/olli/cowlection/listener/ChatListener.java
@@ -29,8 +29,10 @@ public class ChatListener {
* - §2Guild > §r§aNAME §r§eleft.§r
*/
private static final Pattern LOGIN_LOGOUT_NOTIFICATION = Pattern.compile("^(?<type>§aFriend|§2Guild) > §r(?<rank>§[0-9a-f])(?<playerName>[\\w]+)(?<joinLeaveSuffix> §r§e(?<joinedLeft>joined|left)\\.)§r$");
- private static final Pattern CHAT_MESSAGE_RECEIVED_PATTERN = Pattern.compile("^(?:Party|Guild) > (?:\\[.*?] )?(?<playerName>\\w+)(?: \\[.*?])?: ");
+ private static final Pattern CHAT_MESSAGE_RECEIVED_PATTERN = Pattern.compile("^(?:Party|Guild) > (?:\\[.*?] )?(\\w+)(?: \\[.*?])?: ");
private static final Pattern PRIVATE_MESSAGE_RECEIVED_PATTERN = Pattern.compile("^From (?:\\[.*?] )?(\\w+): ");
+ private static final Pattern PARTY_OR_GAME_INVITE_PATTERN = Pattern.compile("^[-]+\\s+(?:\\[.*?] )?(\\w+) has invited you ");
+ private static final Pattern DUNGEON_FINDER_JOINED_PATTERN = Pattern.compile("^Dungeon Finder > (\\w+) joined the dungeon group! \\(([A-Z][a-z]+) Level (\\d+)\\)$");
private final Cowlection main;
private String lastTypedChars = "";
private String lastPMSender;
@@ -147,11 +149,17 @@ public class ChatListener {
Matcher privateMessageMatcher = PRIVATE_MESSAGE_RECEIVED_PATTERN.matcher(message);
Matcher chatMessageMatcher = CHAT_MESSAGE_RECEIVED_PATTERN.matcher(message);
+ Matcher partyOrGameInviteMatcher = PARTY_OR_GAME_INVITE_PATTERN.matcher(message);
+ Matcher dungeonPartyFinderJoinedMatcher = DUNGEON_FINDER_JOINED_PATTERN.matcher(message);
if (privateMessageMatcher.find()) {
messageSender = privateMessageMatcher.group(1);
this.lastPMSender = messageSender;
} else if (chatMessageMatcher.find()) {
- messageSender = chatMessageMatcher.group("playerName");
+ messageSender = chatMessageMatcher.group(1);
+ } else if (partyOrGameInviteMatcher.find()) {
+ messageSender = partyOrGameInviteMatcher.group(1);
+ } else if (dungeonPartyFinderJoinedMatcher.find()) {
+ messageSender = dungeonPartyFinderJoinedMatcher.group(1);
}
if (messageSender != null) {
diff --git a/src/main/java/eu/olli/cowlection/listener/DungeonsListener.java b/src/main/java/eu/olli/cowlection/listener/DungeonsListener.java
index 67f7b83..cbc45c9 100644
--- a/src/main/java/eu/olli/cowlection/listener/DungeonsListener.java
+++ b/src/main/java/eu/olli/cowlection/listener/DungeonsListener.java
@@ -8,6 +8,7 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemSkull;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
@@ -15,6 +16,7 @@ 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.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.apache.commons.lang3.StringUtils;
import org.lwjgl.input.Keyboard;
@@ -64,7 +66,7 @@ public class DungeonsListener {
activeDungeonClass = "unknown";
}
- @SubscribeEvent
+ @SubscribeEvent(priority = EventPriority.HIGH)
public void onItemTooltip(ItemTooltipEvent e) {
if (e.itemStack == null || e.toolTip == null) {
return;
@@ -73,110 +75,135 @@ public class DungeonsListener {
// simplify dungeon armor stats
String originalItemName = e.itemStack.getDisplayName();
NBTTagCompound extraAttributes = e.itemStack.getSubCompound("ExtraAttributes", false);
- if (extraAttributes != null && extraAttributes.hasKey("modifier")) {
- String reforge = StringUtils.capitalize(extraAttributes.getString("modifier"));
- int modifierSuffix = Math.max(reforge.indexOf("_sword"), reforge.indexOf("_bow"));
- if (modifierSuffix != -1) {
- reforge = reforge.substring(0, modifierSuffix);
- }
- int reforgeInItemName = originalItemName.indexOf(reforge);
- if (reforgeInItemName == -1 && reforge.equals("Light") && extraAttributes.getString("id").startsWith("HEAVY_")) {
- // special case: heavy armor with light reforge
- reforgeInItemName = originalItemName.indexOf("Heavy");
- }
- if (reforgeInItemName > 0 && !originalItemName.contains(EnumChatFormatting.STRIKETHROUGH.toString())) {
- // we have a reforged item! strike through reforge in item name and remove any essence upgrades (✪)
- String grayedOutFormatting = "" + EnumChatFormatting.GRAY + EnumChatFormatting.STRIKETHROUGH;
+ if (extraAttributes != null) {
+ StringBuilder modifiedItemName = new StringBuilder(originalItemName);
+ String reforge = "";
+ String grayedOutFormatting = "" + EnumChatFormatting.GRAY + EnumChatFormatting.STRIKETHROUGH;
- int reforgeLength = reforge.length();
- String reforgePrefix = null;
- // special cases for reforge + item name
- if (reforge.equals("Heavy") && extraAttributes.getString("id").startsWith("HEAVY_")) {
- reforgePrefix = "Extremely ";
- } else if (reforge.equals("Light") && extraAttributes.getString("id").startsWith("HEAVY_")) {
- reforgePrefix = "Not So ";
- } else if (reforge.equals("Wise") && extraAttributes.getString("id").startsWith("WISE_")) {
- reforgePrefix = "Very ";
+ if (extraAttributes.hasKey("modifier")) {
+ // item has been reforged; re-format item name to exclude reforges
+ reforge = StringUtils.capitalize(extraAttributes.getString("modifier"));
+ int modifierSuffix = Math.max(reforge.indexOf("_sword"), reforge.indexOf("_bow"));
+ if (modifierSuffix != -1) {
+ reforge = reforge.substring(0, modifierSuffix);
}
- if (reforgePrefix != null) {
- reforgeInItemName -= reforgePrefix.length();
- reforgeLength = reforgePrefix.length() - 1;
+ int reforgeInItemName = originalItemName.indexOf(reforge);
+ if (reforgeInItemName == -1 && reforge.equals("Light") && extraAttributes.getString("id").startsWith("HEAVY_")) {
+ // special case: heavy armor with light reforge
+ reforgeInItemName = originalItemName.indexOf("Heavy");
}
- StringBuffer modifiedItemName = new StringBuffer(originalItemName)
- .insert(reforgeInItemName, grayedOutFormatting)
- .insert(reforgeInItemName + reforgeLength + grayedOutFormatting.length(), originalItemName.substring(0, reforgeInItemName));
- // remove essence upgrade indicators (✪)
- String essenceUpgradeIndicator = EnumChatFormatting.GOLD + "✪";
- int essenceModifier = modifiedItemName.indexOf(essenceUpgradeIndicator);
- while (essenceModifier > 0) {
- modifiedItemName.replace(essenceModifier, essenceModifier + essenceUpgradeIndicator.length(), grayedOutFormatting + "✪");
- essenceModifier = modifiedItemName.indexOf(essenceUpgradeIndicator);
+
+ if (reforgeInItemName > 0 && !originalItemName.contains(EnumChatFormatting.STRIKETHROUGH.toString())) {
+ // we have a reforged item! strike through reforge in item name and remove any essence upgrades (✪)
+
+ int reforgeLength = reforge.length();
+ String reforgePrefix = null;
+ // special cases for reforge + item name
+ if (reforge.equals("Heavy") && extraAttributes.getString("id").startsWith("HEAVY_")) {
+ reforgePrefix = "Extremely ";
+ } else if (reforge.equals("Light") && extraAttributes.getString("id").startsWith("HEAVY_")) {
+ reforgePrefix = "Not So ";
+ } else if ((reforge.equals("Wise") && extraAttributes.getString("id").startsWith("WISE_DRAGON_"))
+ || (reforge.equals("Strong") && extraAttributes.getString("id").startsWith("STRONG_DRAGON_"))) {
+ reforgePrefix = "Very ";
+ } else if (reforge.equals("Superior") && extraAttributes.getString("id").startsWith("SUPERIOR_DRAGON_")) {
+ reforgePrefix = "Highly ";
+ } else if (reforge.equals("Perfect") && extraAttributes.getString("id").startsWith("PERFECT_")) {
+ reforgePrefix = "Absolutely ";
+ }
+ if (reforgePrefix != null) {
+ reforgeInItemName -= reforgePrefix.length();
+ reforgeLength = reforgePrefix.length() - 1;
+ }
+
+ modifiedItemName.insert(reforgeInItemName, grayedOutFormatting)
+ .insert(reforgeInItemName + reforgeLength + grayedOutFormatting.length(), originalItemName.substring(0, reforgeInItemName));
}
- e.toolTip.set(0, modifiedItemName.toString()); // replace item name
+ }
+ // remove essence upgrade indicators (✪)
+ String essenceUpgradeIndicator = EnumChatFormatting.GOLD + "✪";
+ int essenceModifier = modifiedItemName.indexOf(essenceUpgradeIndicator);
+ while (essenceModifier > 0) {
+ modifiedItemName.replace(essenceModifier, essenceModifier + essenceUpgradeIndicator.length(), grayedOutFormatting + "✪");
+ essenceModifier = modifiedItemName.indexOf(essenceUpgradeIndicator);
+ }
+ e.toolTip.set(0, modifiedItemName.toString()); // replace item name
- // subtract stat boosts from reforge and update stats for dungeons
- ListIterator<String> tooltipIterator = e.toolTip.listIterator();
- while (tooltipIterator.hasNext()) {
- String line = tooltipIterator.next();
- Matcher lineMatcher = TOOLTIP_LINE_PATTERN.matcher(line);
- if (lineMatcher.matches()) {
- if (EnumChatFormatting.getTextWithoutFormattingCodes(lineMatcher.group("prefix")).equals("Gear Score: ")) {
- // 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");
- }
+ // subtract stat boosts from reforge and update stats for dungeons
+ ListIterator<String> tooltipIterator = e.toolTip.listIterator();
+
+ String itemQualityBottom = null;
+ while (tooltipIterator.hasNext()) {
+ String line = tooltipIterator.next();
+ Matcher lineMatcher = TOOLTIP_LINE_PATTERN.matcher(line);
+ if (lineMatcher.matches()) {
+ if (EnumChatFormatting.getTextWithoutFormattingCodes(lineMatcher.group("prefix")).equals("Gear Score: ")) {
+ // 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("―");
+ }
+ if (MooConfig.isDungItemQualityAtTop()) {
+ // replace 'Gear Score' line
tooltipIterator.set(customGearScore.toString());
- continue;
+ } else {
+ // delete 'Gear Score' line and add item quality to bottom
+ tooltipIterator.remove();
+ itemQualityBottom = customGearScore.toString();
}
- try {
- int statNonDungeon = Integer.parseInt(lineMatcher.group("statNonDungeon"));
-
- int statBase = statNonDungeon;
- if (reforge.equalsIgnoreCase(lineMatcher.group("reforge"))) {
- // tooltip line has reforge stats; subtract them from base stats
- statBase -= Integer.parseInt(lineMatcher.group("statReforge"));
- }
+ continue;
+ }
+ try {
+ int statNonDungeon = Integer.parseInt(lineMatcher.group("statNonDungeon"));
- if (statBase == 0) {
- // don't redraw 0 stats
- tooltipIterator.remove();
- continue;
- }
- 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"));
+ int statBase = statNonDungeon;
+ if (reforge.equalsIgnoreCase(lineMatcher.group("reforge"))) {
+ // tooltip line has reforge stats; subtract them from base stats
+ statBase -= Integer.parseInt(lineMatcher.group("statReforge"));
+ }
- double dungeonStatModifier = statDungeon / statNonDungeon; // modified through skill level or gear essence upgrades
- if (extraAttributes.hasKey("dungeon_item_level")) {
- // with essences upgraded item => calculate base (level based) dungeon modifier
- dungeonStatModifier -= extraAttributes.getInteger("dungeon_item_level") / 10d;
- }
+ if (statBase == 0) {
+ // don't redraw 0 stats
+ tooltipIterator.remove();
+ continue;
+ }
+ 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 statBaseDungeon = statBase * dungeonStatModifier;
- double statDungeonWithMaxEssenceUpgrades = statBase * (dungeonStatModifier + /*5x essence à +10% each => +50% stats */0.5d);
- newToolTipLine += String.format(" %s(₀ₓ✪ %+.1f%s) %s(₅ₓ✪ %+.1f%s)", lineMatcher.group("colorDungeon"), statBaseDungeon, lineMatcher.group("statDungeonUnit"),
- lineMatcher.group("colorDungeon"), statDungeonWithMaxEssenceUpgrades, lineMatcher.group("statDungeonUnit"));
+ double dungeonStatModifier = statDungeon / statNonDungeon; // modified through skill level or gear essence upgrades
+ if (extraAttributes.hasKey("dungeon_item_level")) {
+ // with essences upgraded item => calculate base (level based) dungeon modifier
+ dungeonStatModifier -= extraAttributes.getInteger("dungeon_item_level") / 10d;
}
- tooltipIterator.set(newToolTipLine);
- } catch (NumberFormatException ignored) {
+ double statBaseDungeon = statBase * dungeonStatModifier;
+ double statDungeonWithMaxEssenceUpgrades = statBase * (dungeonStatModifier + /*5x essence à +10% each => +50% stats */0.5d);
+ newToolTipLine += String.format(" %s(₀ₓ✪ %+.1f%s) %s(₅ₓ✪ %+.1f%s)", lineMatcher.group("colorDungeon"), statBaseDungeon, lineMatcher.group("statDungeonUnit"),
+ lineMatcher.group("colorDungeon"), statDungeonWithMaxEssenceUpgrades, lineMatcher.group("statDungeonUnit"));
}
+
+ tooltipIterator.set(newToolTipLine);
+ } catch (NumberFormatException ignored) {
}
}
}
+ if (itemQualityBottom != null) {
+ int index = Math.max(0, e.toolTip.size() - (e.showAdvancedItemTooltips ? /* item name & nbt info */ 2 : 0));
+ e.toolTip.add(index, itemQualityBottom);
+ }
}
}
}
@@ -246,14 +273,24 @@ public class DungeonsListener {
}
private void renderPartyStatus(ItemStack item, int x, int y) {
+ if (!(item.getItem() instanceof ItemSkull && item.getMetadata() == 3 && item.hasTagCompound())) {
+ // not a player skull, don't draw party status indicator
+ return;
+ }
String status = "⬛"; // ok
Color color = new Color(20, 200, 20, 255);
List<String> itemTooltip = item.getTooltip(Minecraft.getMinecraft().thePlayer, false);
+ if (itemTooltip.size() < 5) {
+ // not a valid dungeon party tooltip
+ return;
+ }
if (itemTooltip.get(itemTooltip.size() - 1).endsWith("Complete previous floor first!")) {
// cannot enter dungeon
status = "✗";
color = new Color(220, 20, 20, 255);
+ } else if (itemTooltip.get(itemTooltip.size() - 1).endsWith("You are in this party!")) {
+ status = EnumChatFormatting.OBFUSCATED + "#";
} else {
int dungClassMin = MooConfig.dungClassRange[0];
int dungClassMax = MooConfig.dungClassRange[1];
diff --git a/src/main/resources/assets/cowlection/lang/en_US.lang b/src/main/resources/assets/cowlection/lang/en_US.lang
index b84140f..80c002e 100644
--- a/src/main/resources/assets/cowlection/lang/en_US.lang
+++ b/src/main/resources/assets/cowlection/lang/en_US.lang
@@ -16,6 +16,8 @@ cowlection.config.dungClassRange=Dungeon Parties: Class level range
cowlection.config.dungClassRange.tooltip=Accepted level range for the dungeon party finder. Set to -1 to disable
cowlection.config.dungFilterPartiesWithDupes=Dungeon Parties: Mark duplicated classes?
cowlection.config.dungFilterPartiesWithDupes.tooltip=Mark parties with duplicated classes?
+cowlection.config.dungItemQualityPos=Dungeon tooltips: Item Quality positon
+cowlection.config.dungItemQualityPos.tooltip=Position of item quality in dungeon item tooltips
cowlection.config.logsDirs=Directories with Minecraft log files
cowlection.config.logsDirs.tooltip=List of directories containing Minecraft log files
cowlection.config.defaultStartDate=Start date for log file search