aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyeyoung <cyougn06@naver.com>2022-01-12 22:17:02 +0900
committersyeyoung <cyougn06@naver.com>2022-01-12 22:17:02 +0900
commit945eb217de8e304168a0a35b8c5e1011f1f7799a (patch)
treed78c3f511dc6cdec94814cd1c90572f087dbcc95
parent4cc2746d8c26dc9cf2b9cccdc7aaa51ceaa8c07c (diff)
downloadSkyblock-Dungeons-Guide-945eb217de8e304168a0a35b8c5e1011f1f7799a.tar.gz
Skyblock-Dungeons-Guide-945eb217de8e304168a0a35b8c5e1011f1f7799a.tar.bz2
Skyblock-Dungeons-Guide-945eb217de8e304168a0a35b8c5e1011f1f7799a.zip
- Fix Timescore approximation with data
-rwxr-xr-xsrc/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java16
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/utils/TimeScoreUtil.java87
-rw-r--r--src/main/resources/timescore/10.csv144
-rw-r--r--src/main/resources/timescore/12.csv96
-rw-r--r--src/main/resources/timescore/8.csv88
6 files changed, 426 insertions, 7 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java b/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java
index e8f3ada5..f120f94f 100755
--- a/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/DungeonsGuide.java
@@ -36,6 +36,7 @@ import kr.syeyoung.dungeonsguide.stomp.CloseListener;
import kr.syeyoung.dungeonsguide.stomp.StompClient;
import kr.syeyoung.dungeonsguide.stomp.StompInterface;
import kr.syeyoung.dungeonsguide.utils.AhUtils;
+import kr.syeyoung.dungeonsguide.utils.TimeScoreUtil;
import kr.syeyoung.dungeonsguide.wsresource.StaticResourceCache;
import lombok.Getter;
import net.minecraft.client.Minecraft;
@@ -157,6 +158,7 @@ public class DungeonsGuide implements DGInterface, CloseListener {
if (FeatureRegistry.DISCORD_DONOTUSE.isEnabled())
System.setProperty("dg.safe", "true");
MinecraftForge.EVENT_BUS.register(RichPresenceManager.INSTANCE);
+ TimeScoreUtil.init();
ProgressManager.pop(progressbar);
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java
index 533e3dfe..f10d7262 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/dungeon/FeatureDungeonScore.java
@@ -35,6 +35,7 @@ import kr.syeyoung.dungeonsguide.stomp.StompMessageHandler;
import kr.syeyoung.dungeonsguide.stomp.StompPayload;
import kr.syeyoung.dungeonsguide.stomp.StompSubscription;
import kr.syeyoung.dungeonsguide.utils.TextUtils;
+import kr.syeyoung.dungeonsguide.utils.TimeScoreUtil;
import kr.syeyoung.dungeonsguide.wsresource.StaticResource;
import kr.syeyoung.dungeonsguide.wsresource.StaticResourceCache;
import lombok.AllArgsConstructor;
@@ -274,13 +275,14 @@ public class FeatureDungeonScore extends TextHUDFeature {
int time = 0;
{
int maxTime = context.getMaxSpeed();
- int timeSec = FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed() / 1000 - maxTime + 480;
-
- if (timeSec <= 480) time = 100;
- else if (timeSec <= 580) time = (int) Math.ceil(148 - 0.1 * timeSec);
- else if (timeSec <= 980) time = (int) Math.ceil(119 - 0.05 * timeSec);
- else if (timeSec < 3060) time = (int) Math.ceil(3102 - (1/30.0) * timeSec);
- time = MathHelper.clamp_int(time, 0, 100); // just in case.
+// int timeSec = FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed() / 1000 - maxTime + 480;
+//
+// if (timeSec <= 480) time = 100;
+// else if (timeSec <= 580) time = (int) Math.ceil(148 - 0.1 * timeSec);
+// else if (timeSec <= 980) time = (int) Math.ceil(119 - 0.05 * timeSec);
+// else if (timeSec < 3060) time = (int) Math.ceil(3102 - (1/30.0) * timeSec);
+// time = MathHelper.clamp_int(time, 0, 100); // just in case.
+ time = TimeScoreUtil.estimate(FeatureRegistry.DUNGEON_SBTIME.getTimeElapsed(), maxTime);
}
int bonus = 0;
int tombs;
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/TimeScoreUtil.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/TimeScoreUtil.java
new file mode 100644
index 00000000..f43a1f17
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/TimeScoreUtil.java
@@ -0,0 +1,87 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2021 cyoung06
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.utils;
+
+import kr.syeyoung.dungeonsguide.Main;
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.ResourceLocation;
+import org.apache.commons.io.IOUtils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+public class TimeScoreUtil {
+ private static final TreeMap<Integer, Integer> min8 = new TreeMap<Integer, Integer>();
+ private static final TreeMap<Integer, Integer> min10 = new TreeMap<Integer, Integer>();
+ private static final TreeMap<Integer, Integer> min12 = new TreeMap<Integer, Integer>();
+ public static void init() {
+ try {
+ load("8.csv", min8);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ try {
+ load("10.csv", min10);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ try {
+ load("12.csv", min12);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ private static void load(String name, TreeMap<Integer, Integer> minutes) throws IOException {
+ minutes.clear();
+ List<String> lines = IOUtils.readLines(Main.class.getResourceAsStream("/timescore/"+name));
+ for (String line:lines) {
+ String[] split = line.split(",");
+ minutes.put(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
+ }
+ }
+
+ public static int estimate(int mills, int drop) {
+ if (drop == 600) return estimate(mills, min10);
+ if (drop == 480) return estimate(mills, min8);
+ if (drop == 720) return estimate(mills, min12);
+ return -1;
+ }
+
+ private static int estimate(int mills, TreeMap<Integer, Integer> lookup_table){
+ Map.Entry<Integer, Integer> high = lookup_table.ceilingEntry(mills);
+ Map.Entry<Integer, Integer> low = lookup_table.floorEntry(mills);
+
+
+ if (low == null && high == null) return 0;
+ if (low == null) return high.getValue();
+ if (high == null) return low.getValue();
+
+ int distHigh = high.getKey() - mills;
+ int distLow = mills - low.getKey();
+
+ if (distHigh > distLow) return high.getValue();
+ else return low.getValue();
+ }
+}
diff --git a/src/main/resources/timescore/10.csv b/src/main/resources/timescore/10.csv
new file mode 100644
index 00000000..6d576cd8
--- /dev/null
+++ b/src/main/resources/timescore/10.csv
@@ -0,0 +1,144 @@
+0,100
+611000,100
+612000,99
+623000,99
+624000,98
+635000,98
+636000,97
+647000,97
+648000,96
+659000,96
+660000,95
+671000,95
+672000,94
+683000,94
+684000,93
+695000,93
+696000,92
+707000,92
+708000,91
+719000,91
+720000,90
+743000,90
+744000,89
+767000,89
+768000,88
+791000,88
+792000,87
+815000,87
+816000,86
+839000,86
+840000,85
+863000,85
+864000,84
+887000,84
+888000,83
+911000,83
+912000,82
+935000,82
+936000,81
+959000,81
+960000,80
+989000,80
+990000,79
+1019000,79
+1020000,78
+1049000,78
+1050000,77
+1079000,77
+1080000,76
+1109000,76
+1110000,75
+1139000,75
+1140000,74
+1169000,74
+1170000,73
+1199000,73
+1200000,72
+1229000,72
+1230000,71
+1259000,71
+1261000,70
+1293000,70
+1296000,69
+1331000,69
+1332000,68
+1367000,68
+1368000,67
+1401000,67
+1404000,66
+1439000,66
+1440000,65
+1474000,65
+1477000,64
+1511000,64
+1512000,63
+1547000,63
+1549000,62
+1582000,62
+1585000,61
+1618000,61
+1620000,60
+1660000,60
+1663000,59
+1704000,59
+1706000,58
+1744000,58
+1753000,57
+1788000,57
+1791000,56
+1829000,56
+1833000,55
+1870000,55
+1874000,54
+1903000,54
+1915000,53
+1955000,53
+1963000,52
+1982000,52
+2003000,51
+2037000,51
+2044000,50
+2066000,50
+2105000,49
+2121000,49
+2138000,48
+2152000,48
+2172000,47
+2199000,47
+2219000,46
+2239000,46
+2260000,45
+2277000,45
+2312000,44
+2333000,44
+2367000,43
+2373000,43
+2408000,42
+2408000,42
+2485000,40
+2495000,40
+2519000,39
+2521000,39
+2565000,38
+2565000,38
+2599000,37
+2599000,37
+2707000,35
+2707000,35
+2763000,33
+2763000,33
+2800000,32
+2830000,32
+2932000,29
+2958000,29
+3022000,27
+3022000,27
+3128000,25
+3129000,25
+3225000,22
+3256000,22
+3373000,19
+3373000,19
+3435000,17
+3435000,17
diff --git a/src/main/resources/timescore/12.csv b/src/main/resources/timescore/12.csv
new file mode 100644
index 00000000..242d3ba6
--- /dev/null
+++ b/src/main/resources/timescore/12.csv
@@ -0,0 +1,96 @@
+134000,100
+734000,100
+735000,99
+748000,99
+749000,98
+763000,98
+764000,97
+777000,97
+778000,96
+791000,96
+792000,95
+806000,95
+807000,94
+820000,94
+821000,93
+835000,93
+836000,92
+849000,92
+850000,91
+863000,91
+864000,90
+892000,90
+893000,89
+921000,89
+922000,88
+950000,88
+951000,87
+979000,87
+981000,86
+1007000,86
+1008000,85
+1036000,85
+1037000,84
+1065000,84
+1066000,83
+1094000,83
+1095000,82
+1121000,82
+1124000,81
+1151000,81
+1152000,80
+1187000,80
+1188000,79
+1223000,79
+1224000,78
+1256000,78
+1263000,77
+1292000,77
+1296000,76
+1330000,76
+1333000,75
+1364000,75
+1373000,74
+1391000,74
+1412000,73
+1438000,73
+1440000,72
+1475000,72
+1494000,71
+1507000,71
+1524000,70
+1546000,70
+1561000,69
+1595000,69
+1610000,68
+1638000,68
+1654000,67
+1654000,67
+1685000,66
+1726000,66
+1755000,65
+1770000,65
+1794000,64
+1806000,64
+1830000,63
+1845000,63
+1900000,62
+1900000,62
+1919000,61
+1919000,61
+1954000,60
+1954000,60
+2033000,59
+2042000,59
+2051000,58
+2051000,58
+2164000,56
+2168000,56
+2240000,55
+2240000,55
+2382000,52
+2382000,52
+2466000,50
+2466000,50
+2554000,48
+2554000,48
diff --git a/src/main/resources/timescore/8.csv b/src/main/resources/timescore/8.csv
new file mode 100644
index 00000000..2634befd
--- /dev/null
+++ b/src/main/resources/timescore/8.csv
@@ -0,0 +1,88 @@
+139000,100
+489000,100
+490000,99
+499000,99
+500000,98
+508000,98
+509000,97
+518000,97
+519000,96
+527000,96
+528000,95
+537000,95
+539000,94
+546000,94
+548000,93
+556000,93
+559000,92
+566000,92
+567000,91
+575000,91
+576000,90
+594000,90
+596000,89
+612000,89
+616000,88
+633000,88
+636000,87
+651000,87
+653000,86
+670000,86
+673000,85
+691000,85
+692000,84
+708000,84
+712000,83
+729000,83
+730000,82
+742000,82
+750000,81
+764000,81
+769000,80
+788000,80
+794000,79
+815000,79
+819000,78
+836000,78
+844000,77
+861000,77
+866000,76
+886000,76
+888000,75
+901000,75
+914000,74
+928000,74
+936000,73
+957000,73
+967000,72
+983000,72
+1000000,71
+1000000,71
+1008000,70
+1021000,70
+1082000,68
+1084000,68
+1109000,67
+1121000,67
+1161000,65
+1161000,65
+1185000,64
+1194000,64
+1219000,63
+1229000,63
+1251000,62
+1251000,62
+1282000,61
+1282000,61
+1308000,60
+1308000,60
+1336000,59
+1336000,59
+1382000,58
+1387000,58
+1425000,57
+1425000,57
+1441000,56
+1445000,56
+1488000,55
+1488000,55