aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorCow <cow@volloeko.de>2022-10-03 17:23:45 +0200
committerCow <cow@volloeko.de>2022-10-03 22:14:06 +0200
commit8184833d01e3db0d2e386bc449e965f0f05b2a1b (patch)
tree76a9b0547a484a5cc0745f8bcfaeb6d1fbc174e2 /src/main/java
parent5ff6bdf6c27b7d27dbb501b52b5a8f7eb7f87cbd (diff)
downloadCowlection-8184833d01e3db0d2e386bc449e965f0f05b2a1b.tar.gz
Cowlection-8184833d01e3db0d2e386bc449e965f0f05b2a1b.tar.bz2
Cowlection-8184833d01e3db0d2e386bc449e965f0f05b2a1b.zip
Added newly released content
- new minions (from Crimson Island) - new slayers (enderman + blaze) - new areas (Crimson Island + Wool Wars) - new game modes (Bingo + Stranded) - new skill avg calculation - added chest and hopper counters to `/moo analyzeIsland`
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/cowtipper/cowlection/command/MooCommand.java25
-rw-r--r--src/main/java/de/cowtipper/cowlection/data/DataHelper.java50
-rw-r--r--src/main/java/de/cowtipper/cowlection/data/HySkyBlockStats.java18
-rw-r--r--src/main/java/de/cowtipper/cowlection/data/HyStalkingData.java2
-rw-r--r--src/main/java/de/cowtipper/cowlection/data/XpTables.java233
-rw-r--r--src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java13
6 files changed, 237 insertions, 104 deletions
diff --git a/src/main/java/de/cowtipper/cowlection/command/MooCommand.java b/src/main/java/de/cowtipper/cowlection/command/MooCommand.java
index 8d6b3e7..908f90b 100644
--- a/src/main/java/de/cowtipper/cowlection/command/MooCommand.java
+++ b/src/main/java/de/cowtipper/cowlection/command/MooCommand.java
@@ -36,10 +36,7 @@ import net.minecraft.item.ItemMap;
import net.minecraft.item.ItemSkull;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.*;
-import net.minecraft.tileentity.TileEntity;
-import net.minecraft.tileentity.TileEntityBanner;
-import net.minecraft.tileentity.TileEntitySign;
-import net.minecraft.tileentity.TileEntitySkull;
+import net.minecraft.tileentity.*;
import net.minecraft.util.*;
import net.minecraft.world.storage.MapData;
import net.minecraftforge.common.util.Constants;
@@ -402,7 +399,7 @@ public class MooCommand extends CommandBase {
highestSkill = skill;
highestLevel = level;
}
- if (!skill.equals("Carpentry") && !skill.equals("Runecrafting")) {
+ if (!skill.equals("Runecrafting") && !skill.equals("Social")) {
skillLevelsSum += level;
}
}
@@ -435,7 +432,7 @@ public class MooCommand extends CommandBase {
}
double skillAverage = XpTables.Skill.getSkillAverage(skillLevelsSum);
sbStats.appendFreshSibling(new MooChatComponent.KeyValueChatComponent("Skill average", String.format("%.1f", skillAverage))
- .setHover(new MooChatComponent("Average skill level over all non-cosmetic skills\n(all except Carpentry and Runecrafting)").gray()));
+ .setHover(new MooChatComponent("Average skill level over all non-cosmetic skills\n(all except Runecrafting and Social)").gray()));
} else {
sbStats.appendFreshSibling(new MooChatComponent.KeyValueChatComponent("Highest Skill", "API access disabled"));
}
@@ -729,7 +726,7 @@ public class MooCommand extends CommandBase {
}
StringBuilder analysisResults = new StringBuilder("Found ").append(EnumChatFormatting.GOLD).append(detectedMinionCount).append(EnumChatFormatting.YELLOW).append(" minions");
if (minionsWithSkinCount > 0) {
- analysisResults.append(" + ").append(EnumChatFormatting.GOLD).append(minionsWithSkinCount).append(EnumChatFormatting.YELLOW).append(" unknown minions with skins");
+ analysisResults.append(" + ").append(EnumChatFormatting.GOLD).append(minionsWithSkinCount).append(EnumChatFormatting.YELLOW).append(" unknown minions");
}
analysisResults.append(" on this island");
detectedMinions.entrySet().stream()
@@ -755,6 +752,20 @@ public class MooCommand extends CommandBase {
analysisResults.append("\n ").append(EnumChatFormatting.GOLD).append(minionWithSkin.getValue()).append(minionWithSkin.getValue() > 1 ? "✕ " : "⨉ ")
.append(EnumChatFormatting.RED).append("Unknown minion ").append(EnumChatFormatting.YELLOW).append("(new or with minion skin) ").append(tierColor).append(minionTier);
});
+ // Tile entities (chests/hoppers)
+ int chestCount = 0;
+ int hopperCount = 0;
+ for (TileEntity tileEntity : sender.getEntityWorld().loadedTileEntityList) {
+ if (tileEntity instanceof TileEntityChest) {
+ ++chestCount;
+ } else if (tileEntity instanceof TileEntityHopper) {
+ ++hopperCount;
+ }
+ }
+ analysisResults.append("\n").append(EnumChatFormatting.YELLOW).append("Found ")
+ .append(EnumChatFormatting.GOLD).append(chestCount).append(EnumChatFormatting.YELLOW).append(" chests and ")
+ .append(EnumChatFormatting.GOLD).append(hopperCount).append(EnumChatFormatting.YELLOW).append(" hoppers nearby.");
+
main.getChatHelper().sendMessage(EnumChatFormatting.YELLOW, analysisResults.toString());
}
diff --git a/src/main/java/de/cowtipper/cowlection/data/DataHelper.java b/src/main/java/de/cowtipper/cowlection/data/DataHelper.java
index 1be3f6f..8520493 100644
--- a/src/main/java/de/cowtipper/cowlection/data/DataHelper.java
+++ b/src/main/java/de/cowtipper/cowlection/data/DataHelper.java
@@ -81,7 +81,8 @@ public final class DataHelper {
SKYBLOCK("SkyBlock"),
PIT("Pit"),
REPLAY("Replay"),
- SMP("SMP");
+ SMP("SMP"),
+ WOOL_GAMES("Wool Wars");
private final String cleanName;
@@ -181,7 +182,7 @@ public final class DataHelper {
public static Map<String, String> getMinions() {
// key = skin id, value = minion type and tier
Map<String, String> minions = new HashMap<>();
- // TODO currently Fishing VI + VII and Revenant I + XII use the same skull texture (server-side) - thus can't be distinguished
+ // TODO currently Fishing VI + VII and Revenant I + XII and Flower XI + XII + Magma Cube XI + XII use the same skull texture (server-side) - thus can't be distinguished
minions.put("2f93289a82bd2a06cbbe61b733cfdc1f1bd93c4340f7a90abd9bdda774109071", "Cobblestone I");
minions.put("3fd87486dc94cb8cd04a3d7d06f191f027f38dad7b4ed34c6681fb4d08834c06", "Cobblestone II");
minions.put("cc088ed6bb8763af4eb7d006e00fda7dc11d7681e97c983b7011c3e872f6aab9", "Cobblestone III");
@@ -219,6 +220,7 @@ public final class DataHelper {
minions.put("b30d071e8c97a9c065b307d8a845ef8be6f6db85b71a2299f1bea0be062873e7", "Glowstone IX");
minions.put("8eeb870670e9408a78b386db6c2106e93f7c8cf03344b2cb3128ae0a4ea19674", "Glowstone X");
minions.put("8bc66c5eb7a197d959fcc5d45a7aff938e07ddcd42e3f3993bde00f56fe58dd1", "Glowstone XI");
+ minions.put("91701aa68a2d141fe0a85ba4825b67462de4d2cbccd8b52ef018d39e37296ee2", "Glowstone XII");
minions.put("7458507ed31cf9a38986ac8795173c609637f03da653f30483a721d3fbe602d", "Gravel I");
minions.put("fb48c89157ae36038bbd9c88054ef8797f5b6f38631c1b57e58dcb8d701fa61d", "Gravel II");
@@ -244,6 +246,32 @@ public final class DataHelper {
minions.put("fdceae5bc34dee02b31a68b0015d0ca808844e491cf926c6763d52b26191993f", "Sand X");
minions.put("c0e9118bcebf481394132a5111fcbcd9981b9a99504923b04794912660e22cea", "Sand XI");
+ minions.put("9d24991435e4e7fb1a9ad23db75c80aec300d003ec0c5963e0ed658634027889", "Red Sand I");
+ minions.put("d61dbdb2056dc998126d6c289d9a6023602be5dad5083f10e3c58d10fae3339f", "Red Sand II");
+ minions.put("cb8b223ba4a85a598f58d825c3b58ef1a2e1c0995880e291002730aa9cbd3e10", "Red Sand III");
+ minions.put("f3cfa0a6d31d0de2badf94a6934188159289e7ac8b75b1df4e82d3dcf35993c7", "Red Sand IV");
+ minions.put("26af8bef4d12cc45cc5ff927dbe7d72ca025bbf3f7ae71c3d6c4aaf062bb3cd9", "Red Sand V");
+ minions.put("24a9cb73ca09e5838feccae3cd2fa719327d743f1891305b6c0a8538c4fe9c41", "Red Sand VI");
+ minions.put("56cafdedeb9b7b708b99c675be6d3e32dd48a628c9aa0222458fa0d71e187813", "Red Sand VII");
+ minions.put("5537801c120720625746608e2fceaf04af16aead34296f7c9f790c56872abbda", "Red Sand VIII");
+ minions.put("15f9be6eaea4c6c43329ab512b17f5bfbcc453e11b5351ddb572df35f597dd9a", "Red Sand IX");
+ minions.put("dbf7060ca6f41076ffbb869b7c05b386f296820ef7aecd0f908f120b8317a077", "Red Sand X");
+ minions.put("859fb3c281dffba855fcf58b837749fb6142d785d6d8875d86ffb1920f103d20", "Red Sand XI");
+ minions.put("99fd71cefb5ad4ec2a239f04e6fef0d8838f3100fa775006b8d7bed4c20b7cc7", "Red Sand XII");
+
+ minions.put("fc8ebad72b77df3990e07bc869a99a8f8962d3c19c76e39d99553cae4131cc8", "Mycelium I");
+ minions.put("7a41cf5a575f98d2686d35471d164afd76e907387362435af5175dcf8af9fbb0", "Mycelium II");
+ minions.put("5e857bddca9f14d66ae4c3a909447d5978f443db97e32efb6fde29b4a41d4d40", "Mycelium III");
+ minions.put("583d7d5e52342091add5b0ae4992c65d599ad56f9d979f73b10d68f09d20ddbc", "Mycelium IV");
+ minions.put("4b8778057129a9d56632f07800854d5982b9132bd193a6f1517c288dd85d9ff3", "Mycelium V");
+ minions.put("341e6f7533482d8c4b46ca5b9747819ab61f34d7d1442e638b65cd706e225bd9", "Mycelium VI");
+ minions.put("2472a4d11bc93f2246250116b46900def5c4731182b374f4444c49b33928e2e", "Mycelium VII");
+ minions.put("3160fc6b6ca8a735a62c4918596f1f6a10f81933f5e83586ad46158aaeca8fe", "Mycelium VIII");
+ minions.put("e0124bfa3865dd94e09a8637db591c2caa1ab51fa06946f04b261e9a6c63ff68", "Mycelium IX");
+ minions.put("5dd19195d650240187b5874a0080a7734c28e31bb7e1aedd347ae9c634640e54", "Mycelium X");
+ minions.put("f379623e4f66deca3f5365986c39a6183c851cb20efb5d6121ef4206c9e8d11c", "Mycelium XI");
+ minions.put("d2290d9564a5a5702260128fe8f56532cdee1f15ef99f18b1528e2ec17719946", "Mycelium XII");
+
minions.put("af9b312c8f53da289060e6452855072e07971458abbf338ddec351e16c171ff8", "Clay I");
minions.put("7411bd08421fccfea5077320a5cd2e4eecd285c86fc9d2687abb795ef119097f", "Clay II");
minions.put("fd4ffcb5df4ef82fc07bc7585474c97fc0f2bf59022ffd6c2606b4675f8aaa42", "Clay III");
@@ -382,6 +410,7 @@ public final class DataHelper {
minions.put("2974bc0b9771a4af994ea571638adf1e98cd896acf95cc27b890915669bcedfd", "Quartz IX");
minions.put("3ae41345d675f4ed4dc5145662303123cb828b6e1a3e72d8278174488562dfa9", "Quartz X");
minions.put("7aeec9ef192e733bfcb723afd489cbf4735e7cfdd2ec45cae924009a8f093708", "Quartz XI");
+ minions.put("cb2903b51e16da7d778b7d0352c3ff08a21245bc476b73cdb82417ba4ff8a139", "Quartz XII");
minions.put("7994be3dcfbb4ed0a5a7495b7335af1a3ced0b5888b5007286a790767c3b57e6", "End Stone I");
minions.put("eb0f8a2752e733e8d9152b1cf0a385961fa1ba77daed8d2e4e02348691610529", "End Stone II");
@@ -562,6 +591,7 @@ public final class DataHelper {
minions.put("4beed0b166465261f07399fe97304b9913f522e0d42e78d86849ec72be3d7fa9", "Flower IX");
minions.put("d719f6041aaaf6c7b55042a550d51e17af727f6b8e41af09a1aded49c9ff9e31", "Flower X");
minions.put("1142fe535855dd6b06f4f0817dbc8bf98da31265ae918b854cd11fcacd6fab4c", "Flower XI");
+ minions.put("1142fe535855dd6b06f4f0817dbc8bf98da31265ae918b854cd11fcacd6fab4c", "Flower XII");
minions.put("53ea0fd89524db3d7a3544904933830b4fc8899ef60c113d948bb3c4fe7aabb1", "Fishing I");
minions.put("8798c0d7b65bfa5f56b084c1f51767a4276ad9f2c60bcb284dc6eccb7281e2ab", "Fishing II");
@@ -599,6 +629,7 @@ public final class DataHelper {
minions.put("e7eb574b6ab8b394c6b4a112ae18d5a672ffa414ec4dff3d65c9950523c19e0a", "Revenant IX");
minions.put("d0197c8a4eaca2e5cc1b287ac84c62ef8c9f63068218105292dd89c3f7e64596", "Revenant X");
minions.put("9cf6f95308bedb182b434aa73058aa8d69818b48900396cebc127c1bf7df6790", "Revenant XI");
+ minions.put("a3dce8555923558d8d74c2a2b261b2b2d630559db54ef97ed3f9c30e9a20aba", "Revenant XII");
minions.put("3a851ed2ce5c2c0523af772d206d9555e2e1383ec87946e6ff4c51186e29ef7f", "Voidling I");
minions.put("bc494af6b45980cb2b035007c25e1b4e169371c410fe5d2708daa4f695668fd2", "Voidling II");
@@ -612,6 +643,18 @@ public final class DataHelper {
minions.put("7d63d05501d38fac8b0969deb78b68a58fe03c3e0d78cdb84ef1a9a7513ee326", "Voidling X");
minions.put("7334fc47a50b46ac9df7bf2ed712309ff0b029981368b22db0d539c88f83144f", "Voidling XI");
+ minions.put("665c54366f88fb3280b1c3fc500ce2b799c8dd327ab6d41c9bc959488f5cfd92", "Inferno I");
+ minions.put("22104034909623d6094a5060e05af6da5cbf752a18580911368fa36d69492af3", "Inferno II");
+ minions.put("2c01ba652a23b19dbb1d59ebab0b308eb72861d5bcd7d42630316c3e6542e01a", "Inferno III");
+ minions.put("83abec14acbc4938952fb5986cb14583484ccb7de62d1b9c2b41196a9876c3ce", "Inferno IV");
+ minions.put("2a6e8184c3299b293af75774918c48722afaf3309da5290e0f258048f2aadf66", "Inferno V");
+ minions.put("1b6665f5be583328d1021f0ae6f973c7d9e728b1ac465c40c87a779af06587bf", "Inferno VI");
+ minions.put("6bda967f41e0ea42289abfb661c7c71b28045d488a0f10e13d78b653c25f8f0d", "Inferno VII");
+ minions.put("513f8ed44fb2f82ade92bb56a606be3b595cd716b1bbf0950f0866cc6393d25b", "Inferno VIII");
+ minions.put("86d467092efb156707c254f168ff03b0b763a74fe9f8ac15616ea4c97adfaf69", "Inferno IX");
+ minions.put("65c70f90a11c2d47feed7d1317b1c1b7fe93706a192a983af9a81a5170dbe71b", "Inferno X");
+ minions.put("ec7cc5d8dea1eac6aa307b9ad32b79da0af7d16bad0fd8e34cc5735739db9753", "Inferno XI");
+
minions.put("2fe009c5cfa44c05c88e5df070ae2533bd682a728e0b33bfc93fd92a6e5f3f64", "Skeleton I");
minions.put("3ab6f9c3c911879181dbf2468783348abc671346d5e8c34d118b2b7ece7c47c2", "Skeleton II");
minions.put("ccd9559dc31e4700aaf001e0e2f0bd3517f238af25decd8395f4621404ca4568", "Skeleton III");
@@ -683,6 +726,7 @@ public final class DataHelper {
minions.put("a2a246dbcc45be4a936a19b44fcb61725c0fe2372a0ce0676fb08fd54d4d899b", "Blaze IX");
minions.put("ea357aeaf75a8cfed2b3c1c8f3ccf54f907ae2b64fa871cf201baeef53528e19", "Blaze X");
minions.put("e791eb26b39f162f552d539a4d22c4bee8aa9c571d9acf82a012593bb945c360", "Blaze XI");
+ minions.put("c64b157a9dffd66a8fe832f8564c2c7822279cdda344dfbef23f84c65ef625d1", "Blaze XII");
minions.put("18c9a7a24da7e3182e4f62fa62762e21e1680962197c7424144ae1d2c42174f7", "Magma Cube I");
minions.put("212ff47f5c8b38e96e940b9957958e37d610918df9b664b0c11bd6246799f4af", "Magma Cube II");
@@ -695,6 +739,7 @@ public final class DataHelper {
minions.put("76101f4bb000518bbedc4b1147a920a99f141b8a679f2984fb94741a33eed69f", "Magma Cube IX");
minions.put("e9e67c3860cc1d36cb4930e0ae0488c64abc4e910b4224dc9160d273c3af0bba", "Magma Cube X");
minions.put("6ab2af6b08c3acedd2328e152ef7177f6bbb617dc985dfbfecdc982e04939b04", "Magma Cube XI");
+ minions.put("6ab2af6b08c3acedd2328e152ef7177f6bbb617dc985dfbfecdc982e04939b04", "Magma Cube XII");
minions.put("e460d20ba1e9cd1d4cfd6d5fb0179ff41597ac6d2461bd7ccdb58b20291ec46e", "Enderman I");
minions.put("e38b1bacbce1c6fa1928a89d443868a40a98da7b4507801993b1ab9bb9115458", "Enderman II");
@@ -719,6 +764,7 @@ public final class DataHelper {
minions.put("af4d8d82f4d86569c70d265f5cf62e46ee8dc0a5a6d97ef1901c793d0b127545", "Ghast IX");
minions.put("4013d128e7116812388b789ec641d31d48bf10aa862f7d63d2b4fc0a03d147a2", "Ghast X");
minions.put("5840896c78884ebb35103b31ffd7276c941ea862b8b6b0e0810a66b4ed66cbc2", "Ghast XI");
+ minions.put("e34cefdd0239b6d37fd74318e283181c4819f05c56352e6216c2d047c74f7007", "Ghast XII");
minions.put("c95eced85db62c922724efca804ea0060c4a87fcdedf2fd5c4f9ac1130a6eb26", "Slime I");
minions.put("4a3ea6b0c297c5156249353ff7fcf57b1175e1b90b56a815aa039009ff0ea04f", "Slime II");
diff --git a/src/main/java/de/cowtipper/cowlection/data/HySkyBlockStats.java b/src/main/java/de/cowtipper/cowlection/data/HySkyBlockStats.java
index fb38fe7..23bcfc5 100644
--- a/src/main/java/de/cowtipper/cowlection/data/HySkyBlockStats.java
+++ b/src/main/java/de/cowtipper/cowlection/data/HySkyBlockStats.java
@@ -83,8 +83,16 @@ public class HySkyBlockStats {
public String getGameModeIcon() {
if (StringUtils.isNullOrEmpty(game_mode)) {
return "";
- } else if ("ironman".equals(game_mode)) {
- return EnumChatFormatting.GRAY + "♲";
+ }
+ switch (game_mode) {
+ case "bingo":
+ return EnumChatFormatting.DARK_PURPLE + "Ⓑ";
+ case "ironman":
+ return EnumChatFormatting.GRAY + "♲";
+ case "island": // stranded
+ return EnumChatFormatting.GREEN + "☀";
+ default:
+ return EnumChatFormatting.ITALIC + Utils.fancyCase(game_mode);
}
}
@@ -143,6 +151,7 @@ public class HySkyBlockStats {
private double experience_skill_alchemy = -1;
private double experience_skill_carpentry = -1;
private double experience_skill_runecrafting = -1;
+ private double experience_skill_social2 = -1;
private double experience_skill_taming = -1;
private Map<String, SlayerBossDetails> slayer_bosses;
private List<Pet> pets;
@@ -196,6 +205,9 @@ public class HySkyBlockStats {
if (experience_skill_runecrafting >= 0) {
skills.put(XpTables.Skill.RUNECRAFTING, XpTables.Skill.RUNECRAFTING.getLevel(experience_skill_runecrafting));
}
+ if (experience_skill_social2 >= 0) {
+ skills.put(XpTables.Skill.SOCIAL, XpTables.Skill.SOCIAL.getLevel(experience_skill_social2));
+ }
if (experience_skill_taming >= 0) {
skills.put(XpTables.Skill.TAMING, XpTables.Skill.TAMING.getLevel(experience_skill_taming));
}
@@ -263,7 +275,7 @@ public class HySkyBlockStats {
String itemName = nbtDisplay.getString("Name");
armorList.add(0, itemName);
} else {
- armorList.add(0, "" + EnumChatFormatting.GRAY + EnumChatFormatting.ITALIC + "(empty)");
+ armorList.add(0, "" + EnumChatFormatting.GRAY + EnumChatFormatting.ITALIC + "(empty slot)");
}
}
}
diff --git a/src/main/java/de/cowtipper/cowlection/data/HyStalkingData.java b/src/main/java/de/cowtipper/cowlection/data/HyStalkingData.java
index fb9f704..d6d7fb2 100644
--- a/src/main/java/de/cowtipper/cowlection/data/HyStalkingData.java
+++ b/src/main/java/de/cowtipper/cowlection/data/HyStalkingData.java
@@ -94,7 +94,7 @@ public class HyStalkingData {
case "combat_1":
return "Spider's Den";
case "combat_2":
- return "Blazing Fortress";
+ return "Crimson Isle";
case "combat_3":
return "The End";
case "dungeon":
diff --git a/src/main/java/de/cowtipper/cowlection/data/XpTables.java b/src/main/java/de/cowtipper/cowlection/data/XpTables.java
index 7123387..ea89c78 100644
--- a/src/main/java/de/cowtipper/cowlection/data/XpTables.java
+++ b/src/main/java/de/cowtipper/cowlection/data/XpTables.java
@@ -4,10 +4,44 @@ import java.util.*;
public class XpTables {
public enum Skill {
- FARMING, MINING, COMBAT, FORAGING, FISHING, ENCHANTING, ALCHEMY, CARPENTRY, RUNECRAFTING(true), TAMING;
- private final boolean alternativeXpFormula;
+ FARMING, MINING, COMBAT, FORAGING, FISHING, ENCHANTING, ALCHEMY, CARPENTRY, RUNECRAFTING(SkillXpTable.RC), SOCIAL(SkillXpTable.SOCIAL), TAMING;
+ private final SkillXpTable skillXpTable;
+
+ Skill() {
+ this(SkillXpTable.DEFAULT);
+ }
+
+ Skill(SkillXpTable skillXpTable) {
+ this.skillXpTable = skillXpTable;
+ }
+
+ public int getLevel(double exp) {
+ return getLevel(exp, skillXpTable == SkillXpTable.DEFAULT ? 50 : 25);
+ }
+
+ public int getLevel(double exp, int maxLevel) {
+ return Math.min(skillXpTable.getLevel(exp), maxLevel);
+ }
+
+ public static double getSkillAverage(int skillLevelsSum) {
+ return skillLevelsSum / (getSkillCount() * 1d);
+ }
+
+ /**
+ * Amount of skills without cosmetic skills (Runecrafting, Social)
+ *
+ * @return amount of existing skills
+ */
+ private static int getSkillCount() {
+ return values().length - 2;
+ }
+ }
+
+ private enum SkillXpTable {
+ DEFAULT, RC, SOCIAL;
private static final TreeMap<Integer, Integer> XP_TO_LEVEL = new TreeMap<>();
- private static final TreeMap<Integer, Integer> XP_TO_LEVEL_ALTERNATIVE = new TreeMap<>();
+ private static final TreeMap<Integer, Integer> XP_TO_LEVEL_RC = new TreeMap<>();
+ private static final TreeMap<Integer, Integer> XP_TO_LEVEL_SOCIAL = new TreeMap<>();
static {
// exp data taken from https://api.hypixel.net/resources/skyblock/skills
@@ -73,122 +107,145 @@ public class XpTables {
XP_TO_LEVEL.put(104672425, 59);
XP_TO_LEVEL.put(111672425, 60);
- XP_TO_LEVEL_ALTERNATIVE.put(0, 0);
- XP_TO_LEVEL_ALTERNATIVE.put(50, 1);
- XP_TO_LEVEL_ALTERNATIVE.put(150, 2);
- XP_TO_LEVEL_ALTERNATIVE.put(275, 3);
- XP_TO_LEVEL_ALTERNATIVE.put(435, 4);
- XP_TO_LEVEL_ALTERNATIVE.put(635, 5);
- XP_TO_LEVEL_ALTERNATIVE.put(885, 6);
- XP_TO_LEVEL_ALTERNATIVE.put(1200, 7);
- XP_TO_LEVEL_ALTERNATIVE.put(1600, 8);
- XP_TO_LEVEL_ALTERNATIVE.put(2100, 9);
- XP_TO_LEVEL_ALTERNATIVE.put(2725, 10);
- XP_TO_LEVEL_ALTERNATIVE.put(3510, 11);
- XP_TO_LEVEL_ALTERNATIVE.put(4510, 12);
- XP_TO_LEVEL_ALTERNATIVE.put(5760, 13);
- XP_TO_LEVEL_ALTERNATIVE.put(7325, 14);
- XP_TO_LEVEL_ALTERNATIVE.put(9325, 15);
- XP_TO_LEVEL_ALTERNATIVE.put(11825, 16);
- XP_TO_LEVEL_ALTERNATIVE.put(14950, 17);
- XP_TO_LEVEL_ALTERNATIVE.put(18950, 18);
- XP_TO_LEVEL_ALTERNATIVE.put(23950, 19);
- XP_TO_LEVEL_ALTERNATIVE.put(30200, 20);
- XP_TO_LEVEL_ALTERNATIVE.put(38050, 21);
- XP_TO_LEVEL_ALTERNATIVE.put(47850, 22);
- XP_TO_LEVEL_ALTERNATIVE.put(60100, 23);
- XP_TO_LEVEL_ALTERNATIVE.put(75400, 24);
- XP_TO_LEVEL_ALTERNATIVE.put(94450, 25);
- }
-
- Skill() {
- this(false);
- }
+ XP_TO_LEVEL_RC.put(0, 0);
+ XP_TO_LEVEL_RC.put(50, 1);
+ XP_TO_LEVEL_RC.put(150, 2);
+ XP_TO_LEVEL_RC.put(275, 3);
+ XP_TO_LEVEL_RC.put(435, 4);
+ XP_TO_LEVEL_RC.put(635, 5);
+ XP_TO_LEVEL_RC.put(885, 6);
+ XP_TO_LEVEL_RC.put(1200, 7);
+ XP_TO_LEVEL_RC.put(1600, 8);
+ XP_TO_LEVEL_RC.put(2100, 9);
+ XP_TO_LEVEL_RC.put(2725, 10);
+ XP_TO_LEVEL_RC.put(3510, 11);
+ XP_TO_LEVEL_RC.put(4510, 12);
+ XP_TO_LEVEL_RC.put(5760, 13);
+ XP_TO_LEVEL_RC.put(7325, 14);
+ XP_TO_LEVEL_RC.put(9325, 15);
+ XP_TO_LEVEL_RC.put(11825, 16);
+ XP_TO_LEVEL_RC.put(14950, 17);
+ XP_TO_LEVEL_RC.put(18950, 18);
+ XP_TO_LEVEL_RC.put(23950, 19);
+ XP_TO_LEVEL_RC.put(30200, 20);
+ XP_TO_LEVEL_RC.put(38050, 21);
+ XP_TO_LEVEL_RC.put(47850, 22);
+ XP_TO_LEVEL_RC.put(60100, 23);
+ XP_TO_LEVEL_RC.put(75400, 24);
+ XP_TO_LEVEL_RC.put(94450, 25);
- Skill(boolean alternativeXpFormula) {
- this.alternativeXpFormula = alternativeXpFormula;
+ XP_TO_LEVEL_SOCIAL.put(0, 0);
+ XP_TO_LEVEL_SOCIAL.put(50, 1);
+ XP_TO_LEVEL_SOCIAL.put(150, 2);
+ XP_TO_LEVEL_SOCIAL.put(300, 3);
+ XP_TO_LEVEL_SOCIAL.put(550, 4);
+ XP_TO_LEVEL_SOCIAL.put(1050, 5);
+ XP_TO_LEVEL_SOCIAL.put(1800, 6);
+ XP_TO_LEVEL_SOCIAL.put(2800, 7);
+ XP_TO_LEVEL_SOCIAL.put(4050, 8);
+ XP_TO_LEVEL_SOCIAL.put(5550, 9);
+ XP_TO_LEVEL_SOCIAL.put(7550, 10);
+ XP_TO_LEVEL_SOCIAL.put(10050, 11);
+ XP_TO_LEVEL_SOCIAL.put(13050, 12);
+ XP_TO_LEVEL_SOCIAL.put(16800, 13);
+ XP_TO_LEVEL_SOCIAL.put(21300, 14);
+ XP_TO_LEVEL_SOCIAL.put(27300, 15);
+ XP_TO_LEVEL_SOCIAL.put(35300, 16);
+ XP_TO_LEVEL_SOCIAL.put(45300, 17);
+ XP_TO_LEVEL_SOCIAL.put(57800, 18);
+ XP_TO_LEVEL_SOCIAL.put(72800, 19);
+ XP_TO_LEVEL_SOCIAL.put(92800, 20);
+ XP_TO_LEVEL_SOCIAL.put(117800, 21);
+ XP_TO_LEVEL_SOCIAL.put(147800, 22);
+ XP_TO_LEVEL_SOCIAL.put(182800, 23);
+ XP_TO_LEVEL_SOCIAL.put(222800, 24);
+ XP_TO_LEVEL_SOCIAL.put(272800, 25);
}
public int getLevel(double exp) {
- if (alternativeXpFormula) {
- return getLevel(exp, 25);
- } else {
- return getLevel(exp, 50);
+ TreeMap<Integer, Integer> currentXpTable = XP_TO_LEVEL;
+ if (this == RC) {
+ currentXpTable = XP_TO_LEVEL_RC;
+ } else if (this == SOCIAL) {
+ currentXpTable = XP_TO_LEVEL_SOCIAL;
}
+
+ return currentXpTable.floorEntry((int) exp).getValue();
}
+ }
- public int getLevel(double exp, int maxLevel) {
- if (alternativeXpFormula) {
- return Math.min(XP_TO_LEVEL_ALTERNATIVE.floorEntry((int) exp).getValue(), maxLevel);
- } else {
- return Math.min(XP_TO_LEVEL.floorEntry((int) exp).getValue(), maxLevel);
- }
+ public enum Slayer {
+ ZOMBIE(SlayerXpTable.ZOMBIE), SPIDER(SlayerXpTable.SPIDER), WOLF, ENDERMAN, BLAZE;
+ private final SlayerXpTable slayerXpTable;
+
+ Slayer() {
+ this(SlayerXpTable.DEFAULT);
}
- public static double getSkillAverage(int skillLevelsSum) {
- return skillLevelsSum / (getSkillCount() * 1d);
+ Slayer(SlayerXpTable slayerXpTable) {
+ this.slayerXpTable = slayerXpTable;
}
- /**
- * Amount of skills without cosmetic skills (Carpentry, Runecrafting)
- *
- * @return amount of existing skills
- */
- private static int getSkillCount() {
- return values().length - 2;
+ public int getLevel(double exp) {
+ return this.slayerXpTable.getLevel(exp);
}
}
- public enum Slayer {
- ZOMBIE, SPIDER, WOLF(true), ENDERMAN(true);
- private final boolean alternativeXpFormula;
+ private enum SlayerXpTable {
+ DEFAULT, ZOMBIE, SPIDER;
+
/**
- * Valid for Zombie + Spider
+ * Valid for Wolf + Enderman + Blaze
*/
private static final TreeMap<Integer, Integer> XP_TO_LEVEL = new TreeMap<>();
- /**
- * Valid for Wolf
- */
- private static final TreeMap<Integer, Integer> XP_TO_LEVEL_ALTERNATIVE = new TreeMap<>();
+ private static final TreeMap<Integer, Integer> XP_TO_LEVEL_ZOMBIE = new TreeMap<>();
+ private static final TreeMap<Integer, Integer> XP_TO_LEVEL_SPIDER = new TreeMap<>();
static {
+ // exp data taken from https://wiki.hypixel.net/Slayer
XP_TO_LEVEL.put(0, 0);
- XP_TO_LEVEL.put(5, 1);
- XP_TO_LEVEL.put(15, 2);
- XP_TO_LEVEL.put(200, 3);
- XP_TO_LEVEL.put(1000, 4);
+ XP_TO_LEVEL.put(10, 1);
+ XP_TO_LEVEL.put(30, 2);
+ XP_TO_LEVEL.put(250, 3);
+ XP_TO_LEVEL.put(1500, 4);
XP_TO_LEVEL.put(5000, 5);
XP_TO_LEVEL.put(20000, 6);
XP_TO_LEVEL.put(100000, 7);
XP_TO_LEVEL.put(400000, 8);
XP_TO_LEVEL.put(1000000, 9);
- XP_TO_LEVEL_ALTERNATIVE.put(0, 0);
- XP_TO_LEVEL_ALTERNATIVE.put(5, 1);
- XP_TO_LEVEL_ALTERNATIVE.put(15, 2);
- XP_TO_LEVEL_ALTERNATIVE.put(200, 3);
- XP_TO_LEVEL_ALTERNATIVE.put(1500, 4);
- XP_TO_LEVEL_ALTERNATIVE.put(5000, 5);
- XP_TO_LEVEL_ALTERNATIVE.put(20000, 6);
- XP_TO_LEVEL_ALTERNATIVE.put(100000, 7);
- XP_TO_LEVEL_ALTERNATIVE.put(400000, 8);
- XP_TO_LEVEL_ALTERNATIVE.put(1000000, 9);
- }
+ XP_TO_LEVEL_ZOMBIE.put(0, 0);
+ XP_TO_LEVEL_ZOMBIE.put(5, 1);
+ XP_TO_LEVEL_ZOMBIE.put(15, 2);
+ XP_TO_LEVEL_ZOMBIE.put(200, 3);
+ XP_TO_LEVEL_ZOMBIE.put(1000, 4);
+ XP_TO_LEVEL_ZOMBIE.put(5000, 5);
+ XP_TO_LEVEL_ZOMBIE.put(20000, 6);
+ XP_TO_LEVEL_ZOMBIE.put(100000, 7);
+ XP_TO_LEVEL_ZOMBIE.put(400000, 8);
+ XP_TO_LEVEL_ZOMBIE.put(1000000, 9);
- Slayer() {
- this(false);
- }
-
- Slayer(boolean alternativeXpFormula) {
- this.alternativeXpFormula = alternativeXpFormula;
+ XP_TO_LEVEL_SPIDER.put(0, 0);
+ XP_TO_LEVEL_SPIDER.put(5, 1);
+ XP_TO_LEVEL_SPIDER.put(25, 2);
+ XP_TO_LEVEL_SPIDER.put(200, 3);
+ XP_TO_LEVEL_SPIDER.put(1000, 4);
+ XP_TO_LEVEL_SPIDER.put(5000, 5);
+ XP_TO_LEVEL_SPIDER.put(20000, 6);
+ XP_TO_LEVEL_SPIDER.put(100000, 7);
+ XP_TO_LEVEL_SPIDER.put(400000, 8);
+ XP_TO_LEVEL_SPIDER.put(1000000, 9);
}
public int getLevel(double exp) {
- if (alternativeXpFormula) {
- return XP_TO_LEVEL_ALTERNATIVE.floorEntry((int) exp).getValue();
- } else {
- return XP_TO_LEVEL.floorEntry((int) exp).getValue();
+ TreeMap<Integer, Integer> currentXpTable = XP_TO_LEVEL;
+ if (this == ZOMBIE) {
+ currentXpTable = XP_TO_LEVEL_ZOMBIE;
+ } else if (this == SPIDER) {
+ currentXpTable = XP_TO_LEVEL_SPIDER;
}
+
+ return currentXpTable.floorEntry((int) exp).getValue();
}
}
diff --git a/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java b/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java
index 4f38872..8f152a2 100644
--- a/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java
+++ b/src/main/java/de/cowtipper/cowlection/listener/skyblock/SkyBlockListener.java
@@ -74,7 +74,7 @@ public class SkyBlockListener {
// example: " §a42§7x §fLeather §7for §6436.8 coins"
private static final Pattern BAZAAR_SELL_ALL_PATTERN = Pattern.compile("^(?:§[0-9a-fl-or])* (?:§[0-9a-fl-or])+([0-9,]+)(?:§[0-9a-fl-or])+x (?:§[0-9a-fl-or])+.+ (?:§[0-9a-fl-or])+for (?:§[0-9a-fl-or])+([0-9,.]+) coins$");
private static final Pattern BAZAAR_TARGET_AMOUNT_PATTERN = Pattern.compile("^O(?:ff|rd)er amount: ([\\d,]+)x$");
- private static final Pattern BAZAAR_FILLED_PATTERN = Pattern.compile("^Filled: ([\\d,.k]+)/(?:[\\d,.k]+) \\(?([\\d.]+)%[)!]$");
+ private static final Pattern BAZAAR_FILLED_PATTERN = Pattern.compile("^Filled: ([\\d,.k]+)/[\\d,.k]+ \\(?([\\d.]+)%[)!]$");
List<BestiaryEntry> bestiaryOverview = null;
private final NumberFormat numberFormatter;
private final Cowlection main;
@@ -306,9 +306,16 @@ public class SkyBlockListener {
if (!MooConfig.isTooltipToggleKeyBindingPressed()) {
break;
}
- case ALWAYS:
- e.toolTip.add(index, "Item age: " + EnumChatFormatting.DARK_GRAY + ((MooConfig.tooltipItemAgeShortened) ? Utils.getDurationAsWord(dateTime.toEpochSecond() * 1000) : Utils.getDurationAsWords(dateTime.toEpochSecond() * 1000).first()));
+ case ALWAYS: {
+ long itemCreationTimestamp = dateTime.toEpochSecond() * 1000;
+ long itemAgeInMs = System.currentTimeMillis() - itemCreationTimestamp;
+
+ String itemAge = itemAgeInMs >= 60_000
+ ? (MooConfig.tooltipItemAgeShortened ? Utils.getDurationAsWord(itemCreationTimestamp) : Utils.getDurationAsWords(itemCreationTimestamp).first())
+ : "<1 minute";
+ e.toolTip.add(index, "Item age: " + EnumChatFormatting.DARK_GRAY + itemAge);
break;
+ }
default:
// do nothing
break;