Skip to content
This repository was archived by the owner on Nov 28, 2025. It is now read-only.

Commit 5439dab

Browse files
committed
add random stat generation
- lower the request limit due to new API rate limits
1 parent 3bc62ae commit 5439dab

File tree

9 files changed

+45
-15
lines changed

9 files changed

+45
-15
lines changed

1.16.5/src/main/java/io/github/axolotlclient/modules/hypixel/bedwars/BedwarsPlayer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public void tick(int currentTick) {
9595
try {
9696
stats = BedwarsPlayerStats.fromAPI(profile.getProfile().getId().toString().replace("-", ""));
9797
} catch (Exception e) {
98-
stats = BedwarsPlayerStats.generateFake();
98+
stats = BedwarsPlayerStats.generateFake(profile.getProfile().getName());
9999
}
100100
}
101101
if (alive || tickAlive < 0) {

1.16_combat-6/src/main/java/io/github/axolotlclient/modules/hypixel/bedwars/BedwarsPlayer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public void tick(int currentTick) {
9595
try {
9696
stats = BedwarsPlayerStats.fromAPI(profile.getProfile().getId().toString().replace("-", ""));
9797
} catch (Exception e) {
98-
stats = BedwarsPlayerStats.generateFake();
98+
stats = BedwarsPlayerStats.generateFake(profile.getProfile().getName());
9999
}
100100
}
101101
if (alive || tickAlive < 0) {

1.19.2/src/main/java/io/github/axolotlclient/modules/hypixel/bedwars/BedwarsPlayer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public void tick(int currentTick) {
9595
try {
9696
stats = BedwarsPlayerStats.fromAPI(profile.getProfile().getId().toString().replace("-", ""));
9797
} catch (Exception e) {
98-
stats = BedwarsPlayerStats.generateFake();
98+
stats = BedwarsPlayerStats.generateFake(profile.getProfile().getName());
9999
}
100100
}
101101
if (alive || tickAlive < 0) {

1.19.3/src/main/java/io/github/axolotlclient/modules/hypixel/bedwars/BedwarsPlayer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public void tick(int currentTick) {
9595
try {
9696
stats = BedwarsPlayerStats.fromAPI(profile.getProfile().getId().toString().replace("-", ""));
9797
} catch (Exception e) {
98-
stats = BedwarsPlayerStats.generateFake();
98+
stats = BedwarsPlayerStats.generateFake(profile.getProfile().getName());
9999
}
100100
}
101101
if (alive || tickAlive < 0) {

1.19.4/src/main/java/io/github/axolotlclient/modules/hypixel/bedwars/BedwarsPlayer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public void tick(int currentTick) {
9595
try {
9696
stats = BedwarsPlayerStats.fromAPI(profile.getProfile().getId().toString().replace("-", ""));
9797
} catch (Exception e) {
98-
stats = BedwarsPlayerStats.generateFake();
98+
stats = BedwarsPlayerStats.generateFake(profile.getProfile().getName());
9999
}
100100
}
101101
if (alive || tickAlive < 0) {

1.20/src/main/java/io/github/axolotlclient/modules/hypixel/bedwars/BedwarsPlayer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public void tick(int currentTick) {
9595
try {
9696
stats = BedwarsPlayerStats.fromAPI(profile.getProfile().getId().toString().replace("-", ""));
9797
} catch (Exception e) {
98-
stats = BedwarsPlayerStats.generateFake();
98+
stats = BedwarsPlayerStats.generateFake(profile.getProfile().getName());
9999
}
100100
}
101101
if (alive || tickAlive < 0) {

1.8.9/src/main/java/io/github/axolotlclient/modules/hypixel/bedwars/BedwarsPlayer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public void tick(int currentTick) {
9595
try {
9696
stats = BedwarsPlayerStats.fromAPI(profile.getProfile().getId().toString().replace("-", ""));
9797
} catch (Exception e) {
98-
stats = BedwarsPlayerStats.generateFake();
98+
stats = BedwarsPlayerStats.generateFake(profile.getProfile().getName());
9999
}
100100
}
101101
if (alive || tickAlive < 0) {

common/src/main/java/io/github/axolotlclient/modules/hypixel/HypixelAbstractionLayer.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import java.util.HashMap;
2626
import java.util.Objects;
27+
import java.util.Random;
2728
import java.util.UUID;
2829
import java.util.concurrent.CompletableFuture;
2930
import java.util.concurrent.ExecutionException;
@@ -81,15 +82,20 @@ public static int getPlayerLevel(String uuid, String mode) {
8182
if (Objects.equals(mode, LevelHeadMode.NETWORK.toString())) {
8283
return (int) player.getNetworkLevel();
8384
} else if (Objects.equals(mode, LevelHeadMode.BEDWARS.toString())) {
84-
return player.getIntProperty("achievements.bedwars_level", 0);
85+
int level = player.getIntProperty("achievements.bedwars_level", -1);
86+
if(level != -1){
87+
return level;
88+
}
8589
} else if (Objects.equals(mode, LevelHeadMode.SKYWARS.toString())) {
8690
int exp = player
87-
.getIntProperty("stats.SkyWars.skywars_experience", 0);
88-
return Math.round(ExpCalculator.getLevelForExp(exp));
91+
.getIntProperty("stats.SkyWars.skywars_experience", -1);
92+
if(exp != -1) {
93+
return Math.round(ExpCalculator.getLevelForExp(exp));
94+
}
8995
}
9096
}
9197
}
92-
return 0;
98+
return (int) (new Random().nextGaussian()+150*30);
9399
}
94100

95101
private static PlayerReply.Player getPlayer(String uuid) {
@@ -125,7 +131,7 @@ public static void loadApiKey() {
125131
private static boolean loadPlayerDataIfAbsent(String uuid) {
126132
if (cachedPlayerData.get(uuid) == null) {
127133
// set at 115 to have a buffer in case of disparity between threads
128-
if (hypixelApiCalls.get() <= 115) {
134+
if (hypixelApiCalls.get() <= 55) {
129135
cachedPlayerData.put(uuid, api.getPlayerByUuid(uuid));
130136
hypixelApiCalls.incrementAndGet();
131137
ThreadExecuter.scheduleTask(hypixelApiCalls::decrementAndGet, 1, TimeUnit.MINUTES);

common/src/main/java/io/github/axolotlclient/modules/hypixel/bedwars/BedwarsPlayerStats.java

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
package io.github.axolotlclient.modules.hypixel.bedwars;
2424

25+
import java.nio.charset.StandardCharsets;
26+
import java.util.Random;
27+
2528
import com.google.gson.JsonElement;
2629
import com.google.gson.JsonObject;
2730
import io.github.axolotlclient.modules.hypixel.HypixelAbstractionLayer;
@@ -66,9 +69,30 @@ public class BedwarsPlayerStats {
6669
private final int stars;
6770

6871

69-
public static BedwarsPlayerStats generateFake() {
70-
return new BedwarsPlayerStats(0, 0, 0, 0, 0, 0,
71-
0, 0, 0, 0, 0, 0, 0, 1);
72+
public static BedwarsPlayerStats generateFake(String name) {
73+
long seed = 0;
74+
for(int i = 0; i<name.length(); i++){
75+
seed = (seed << 2) + name.getBytes(StandardCharsets.UTF_8)[i];
76+
}
77+
Random random = new Random(seed);
78+
int star = (int) getGaussian(random, 150, 30);
79+
double fkdr = Math.min(getGaussian(random, 1.3F, 0.5F), 0.6F);
80+
double bblr = (fkdr * 8) / getGaussian(random, 10, 2);
81+
int wins = (int) (star * (fkdr * 4) * random.nextFloat(0.95F, 1.05F));
82+
int losses = (int) (wins * (2/fkdr) * random.nextFloat(0.95F, 1.05F));
83+
int beds = (int) (bblr * losses);
84+
int finalDeaths = (int) (losses * random.nextFloat(1F, 1.03F));
85+
int deaths = (int) (finalDeaths * random.nextFloat(8, 20));
86+
int finalKills = (int) (deaths * fkdr);
87+
int kills = (int) (finalKills * random.nextFloat(1, 2));
88+
89+
return new BedwarsPlayerStats(finalKills, finalDeaths, beds, deaths, kills,
90+
0, 0, 0, 0, 0,
91+
losses, wins, 0, star);
92+
}
93+
94+
private static double getGaussian(Random random, float mean, float deviation){
95+
return random.nextGaussian()+mean*deviation;
7296
}
7397

7498
@Nullable

0 commit comments

Comments
 (0)