multiplier..

This commit is contained in:
Flummi 2024-05-02 19:49:05 +02:00
parent 2ad8838768
commit 6b5727fe60
Signed by: Flummi
GPG Key ID: AA2AEF822A6F4817
2 changed files with 25 additions and 32 deletions

View File

@ -38,29 +38,16 @@ public class OverlayRenderer {
NbtCompound extraAttributes = tags.getCompound("ExtraAttributes"); NbtCompound extraAttributes = tags.getCompound("ExtraAttributes");
if (extraAttributes == null) if (extraAttributes == null)
return; return;
if (extraAttributes.contains("champion_combat_xp")) { for (int i = 0; i < ExpTools.internalNames.length; i++) {
EnchantName = "Champion"; String internalName = ExpTools.internalNames[i];
ItemExp = extraAttributes.getDouble("champion_combat_xp"); if (extraAttributes.contains(internalName)) {
ExpInfo = ExpTools.getExpInformation(ExpTools.EnchantInfoChampion, ItemExp); EnchantName = ExpTools.displayNames[i];
ItemExp = extraAttributes.getDouble(internalName);
ExpInfo = ExpTools.getExpInformation(ExpTools.levelTable[i], ItemExp);
break;
}
} }
else if (extraAttributes.contains("farmed_cultivating")) {
EnchantName = "Cultivating";
ItemExp = extraAttributes.getDouble("farmed_cultivating");
ExpInfo = ExpTools.getExpInformation(ExpTools.EnchantInfoCultivation, ItemExp);
}
else if (extraAttributes.contains("expertise_kills")) {
EnchantName = "Expertise";
ItemExp = extraAttributes.getDouble("expertise_kills");
ExpInfo = ExpTools.getExpInformation(ExpTools.EnchantInfoExpertise, ItemExp);
}
else if (extraAttributes.contains("compact_blocks")) {
EnchantName = "Compact";
ItemExp = extraAttributes.getDouble("compact_blocks");
ExpInfo = ExpTools.getExpInformation(ExpTools.EnchantInfoCompact, ItemExp);
}
else
return;
// show hud // show hud
if(ItemExp > 0) { if(ItemExp > 0) {

View File

@ -1,12 +1,17 @@
package lul.flummi.championoverlay.utils; package lul.flummi.championoverlay.utils;
public class ExpTools { public class ExpTools {
public static double[] EnchantInfoChampion = { 0, 50000, 100000, 250000, 500000, 1000000, 1500000, 2000000, 2500000, 3000000 };
public static double[] EnchantInfoCultivation = { 0, 1000, 5000, 25000, 100000, 300000, 1500000, 5000000, 20000000, 100000000 };
public static double[] EnchantInfoExpertise = { 0, 50, 100, 250, 500, 1000, 2500, 5500, 10000, 15000 };
public static double[] EnchantInfoCompact = { 0, 100, 500, 1500, 5000, 15000, 50000, 150000, 500000, 1000000 };
public static String[] Levels = { "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X" }; public static String[] Levels = { "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X" };
public static String[] internalNames = { "champion_combat_xp", "farmed_cultivating", "expertise_kills", "compact_blocks" };
public static String[] displayNames = { "Champion", "Cultivating", "Expertise", "Compact" };
public static double[][] levelTable = {
{ 50000, 1, 2, 5, 10, 20, 30, 40, 50, 60 },
{ 1000, 1, 5, 25, 100, 3000, 15000, 50000, 20000, 100000 },
{ 50, 1, 2, 5, 10, 20, 50, 110, 200, 300 },
{ 100, 1, 5, 15, 50, 150, 500, 1500, 5000, 10000 }
};
public static class ExpObject { public static class ExpObject {
public final double ExpRequired; public final double ExpRequired;
public final double ExpPrevious; public final double ExpPrevious;
@ -20,20 +25,21 @@ public class ExpTools {
} }
public static ExpObject getExpInformation(double[] InfoTable, double itemExp) { public static ExpObject getExpInformation(double[] InfoTable, double itemExp) {
if (itemExp >= InfoTable[InfoTable.length - 1]) if (itemExp >= InfoTable[InfoTable.length - 1] * InfoTable[0])
return new ExpObject(-1, InfoTable[InfoTable.length - 1], Levels[Levels.length - 1]); return new ExpObject(-1, InfoTable[InfoTable.length - 1] * InfoTable[0], Levels[Levels.length - 1]);
double ExpRequired = 0; double ExpRequired = 0;
double ExpPrevious = 0; double ExpPrevious = 0;
String EnchantLevel = Levels[0]; String EnchantLevel = Levels[0];
for (int i = 0; i < InfoTable.length; i++) { for (int i = 1; i < InfoTable.length; i++) {
if (itemExp < InfoTable[i]) { double j = InfoTable[0] * InfoTable[i];
ExpRequired = InfoTable[i]; if (itemExp < j) {
ExpRequired = j;
EnchantLevel = Levels[i]; EnchantLevel = Levels[i];
break; break;
} }
else else
ExpPrevious = InfoTable[i]; ExpPrevious = j;
} }
return new ExpObject(ExpRequired, ExpPrevious, EnchantLevel); return new ExpObject(ExpRequired, ExpPrevious, EnchantLevel);
} }