perhaps patch difficulty

This commit is contained in:
Stachelbeere1248 2024-12-12 20:49:47 +01:00
parent a017d6988a
commit 022b9b7390
Signed by: Stachelbeere1248
SSH key fingerprint: SHA256:IozEKdw2dB8TZxkpPdMxcWSoWTIMwoLaCcZJ1AJnY2o
10 changed files with 88 additions and 49 deletions

View file

@ -12,21 +12,23 @@ Hello, I am currently working on this mod. More features will come. For now it h
## For Users
The timer automatically splits every round. The PB/Segment recorder automatically distinguishes maps and difficulties, but not player count.
### Config
- Language: The selected Hypixel language. Currently supports EN,FR,DE.
- Timer:
- Default Category: The record-category to be selected when starting the game.
- PB Announcements: Whether to show **\*\*\*NEW PERSONAL BEST\*\*\*** on PB in summaries.
- SST:
- `Language`: The selected Hypixel language. Currently supports EN,FR,DE.
- ###### Timer:
- `Default Category`: The record-category to be selected when starting the game.
- `PB Announcements`: Whether to show **\*\*\*NEW PERSONAL BEST\*\*\*** on PB in summaries.
- ###### SST:
- Enabled: Enables / disables this feature.
- Auditory: A List of tick offsets that a sound should be played. Default (-40, -20, 0) means 2s and 1s in advance, as well as on spawn.
- RL pre-timing: During RL mode, how much SST times sohuld be offsetted. Defaults to 1.4s earlier. Affects HUD as well as auditory.
- Truncate: Whether to show passed rounds in the HUD.
- SLA:
- Enabled: Whether the SLA HUD should automatically be shown when starting a game.
- Truncate: Whether inactive windows and rooms should be shown.
- Macro Message: The Message to be sent when pressing the Chat Macro Key. Do NOT use "§" as symbol.
- Player Visibility: Whether to enable PlayerVisibility by default.
- CPS Counter: A simple CPS Counter which shows the amount of clicks within the last 20 gameticks.
- ###### SLA:
- `Enabled`: Whether the SLA HUD should automatically be shown when starting a game.
- `Truncate`: Whether inactive windows and rooms should be shown.
- ###### Player Visibility:
- `Enabled`: Whether to enable PlayerVisibility by default.
- `Range`: The range within which players are hidden while enabled.
- `Macro Message`: The Message to be sent when pressing the Chat Macro Key. Do NOT use "§" as symbol.
- `CPS Counter`: A simple CPS Counter which shows the amount of clicks within the last 20 gameticks.
### Commands
- /category \<name> - Switches to the category called name. All recorded times are bound to its category. Tabcomplete suggests already existing categories, but you can insert a new (clean) one as well.
- Examples:
@ -37,6 +39,7 @@ The timer automatically splits every round. The PB/Segment recorder automaticall
- /sla off - Disables the SLA hud
- /sla map \<de|bb|aa|p> - forcefully set the map
- /sla quick \<mogi_a|ghxula|ghxula-garden>
- useless for most players:
- /sla rotate - rotates all windows around the axis (0,y,0)
- /sla mirror \<x|z> - mirrors all windows along the plane (0,y,z) or (x,y,0)
- /sla offset \<x> \<y> \<z> - set an offset, allowing you to use sla on map-recreations, such as housings
@ -50,4 +53,4 @@ The timer automatically splits every round. The PB/Segment recorder automaticall
- RL Mode: Toggles usage of the rocket launcher mode spawn-time offset.
- Player Visibility: Toggles whether to show players that are within a 4 block radius.
### Extra
- Managing split-categories: In your game directory is a folder called "zombies" which contains the folder "splits". You can simply rename or delete the folders inside "splits". You can also edit your splits, the data is stored as a list of ticks inside the MAP_DIFFICULTY.times files, a simple text editor (such as Notepad on Windows) should be able to edit it (UTF-16 encoded text). The other subfolder, runs, logs all the splits for every run you play.
- Managing split-categories: In your game directory (aka `.minecraft`) is a folder called `zombies` which contains the folder `splits`. You can simply rename or delete the folders inside `splits`, they represent your categories. You can also edit your splits, the data is stored as a list of ticks inside the `MAP_DIFFICULTY.times` files, a simple text editor (such as Notepad on Windows) should be able to edit it (UTF-16 encoded text). The other subfolder, runs, logs all the splits for every run you play.

View file

@ -3,4 +3,4 @@ org.gradle.jvmargs=-Xmx2g
baseGroup = com.github.stachelbeere1248.zombiesutils
mcVersion = 1.8.9
modid = zombiesutils
version = 1.3.6
version = 1.3.6-PRE_1

View file

@ -1,6 +1,5 @@
package com.github.stachelbeere1248.zombiesutils.config;
import com.github.stachelbeere1248.zombiesutils.ZombiesUtils;
import com.github.stachelbeere1248.zombiesutils.utils.LanguageSupport;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
@ -27,6 +26,7 @@ public class ZombiesUtilsConfig {
private Property cpsCounter;
private Property announcePB;
private Property playerVis;
private Property playerVisRange;
public ZombiesUtilsConfig(Configuration config) {
this.config = config;
@ -34,9 +34,7 @@ public class ZombiesUtilsConfig {
}
private void read() {
ZombiesUtils.getInstance().getLogger().debug("Loading config...");
config.load();
ZombiesUtils.getInstance().getLogger().debug("Config loaded.");
//SST
sstHud = config.get(
@ -99,6 +97,22 @@ public class ZombiesUtilsConfig {
"Whether to announce PBs."
);
//Player Visibility
playerVis = config.get(
"PlayerVis",
"default",
false,
"If players should always be visible"
);
playerVisRange = config.get(
"PlayerVis",
"range",
4,
"The range within which players are hidden",
0,
50
);
//ROOT
language = config.get(
@ -114,12 +128,6 @@ public class ZombiesUtilsConfig {
"T",
"The Text to be sent when pressing the chat-macro hotkey"
);
playerVis = config.get(
Configuration.CATEGORY_GENERAL,
"playervis",
false,
"If players should always be visible"
);
cpsCounter = config.get(
Configuration.CATEGORY_GENERAL,
"cps",
@ -150,6 +158,12 @@ public class ZombiesUtilsConfig {
new CustomConfigElement("PB announcements", announcePB)
);
}
private List<IConfigElement> getPlayerVisElements() {
return Arrays.asList(
new CustomConfigElement("Enabled", playerVis),
new CustomConfigElement("Range", playerVisRange)
);
}
List<IConfigElement> getRootElements() {
return Arrays.asList(
@ -157,8 +171,8 @@ public class ZombiesUtilsConfig {
new DummyConfigElement.DummyCategoryElement("Timer", "", getTimerElements()),
new DummyConfigElement.DummyCategoryElement("SST", "", getSpawntimeElements()),
new DummyConfigElement.DummyCategoryElement("SLA", "", getSlaElements()),
new DummyConfigElement.DummyCategoryElement("Player Visibility", "", getPlayerVisElements()),
new CustomConfigElement("Macro message", chatMacro),
new CustomConfigElement("Player visibility", playerVis),
new CustomConfigElement("CPS counter", cpsCounter)
);
@ -210,6 +224,9 @@ public class ZombiesUtilsConfig {
public boolean getPlayerVis() {
return playerVis.getBoolean();
}
public int getPlayerVisRange() {
return playerVis.getInt();
}
@SubscribeEvent
public void onConfigChange(ConfigChangedEvent.@NotNull OnConfigChangedEvent event) {

View file

@ -23,7 +23,6 @@ public class GameData {
}
public Round getRound(@NotNull GameMode gameMode, int round) {
final Round[] selected;
switch (gameMode) {
case DEAD_END:
return roundData[0][round-1];

View file

@ -17,18 +17,19 @@ public class ChatHandler {
@SubscribeEvent
public void difficultyChange(@NotNull final ClientChatReceivedEvent event) {
if (event.message.getUnformattedText().contains(":")) return;
final String message = STRIP_COLOR_PATTERN.matcher(event.message.getUnformattedText()).replaceAll("").trim();
if (LanguageSupport.containsHard(message)) {
ZombiesUtils.getInstance().getGameManager().setDifficulty(Difficulty.HARD);
} else if (LanguageSupport.containsRIP(message)) {
ZombiesUtils.getInstance().getGameManager().setDifficulty(Difficulty.RIP);
} else {
ZombiesUtils.getInstance().getGameManager().getGame().ifPresent(
game -> {
String message = STRIP_COLOR_PATTERN.matcher(event.message.getUnformattedText()).replaceAll("").trim();
if (message.contains(":")) return;
if (LanguageSupport.containsHard(message)) {
game.changeDifficulty(Difficulty.HARD);
} else if (LanguageSupport.containsRIP(message)) {
game.changeDifficulty(Difficulty.RIP);
} else if (LanguageSupport.isHelicopterIncoming(message)) {
game.helicopter();
}
if (LanguageSupport.isHelicopterIncoming(message)) game.helicopter();
}
);
}
}
}

View file

@ -24,7 +24,8 @@ public class RenderPlayerHandler {
}
private boolean inRange(@NotNull Vec3 playerOther) {
return playerOther.squareDistanceTo(Minecraft.getMinecraft().thePlayer.getPositionVector()) <= 16;
final int range = ZombiesUtils.getInstance().getConfig().getPlayerVisRange();
return playerOther.squareDistanceTo(Minecraft.getMinecraft().thePlayer.getPositionVector()) <= range * range;
}
public void togglePlayerVisibility() {
this.visible = !this.visible;

View file

@ -1,17 +1,20 @@
package com.github.stachelbeere1248.zombiesutils.timer;
import com.github.stachelbeere1248.zombiesutils.game.enums.Difficulty;
import com.github.stachelbeere1248.zombiesutils.game.enums.Map;
import com.github.stachelbeere1248.zombiesutils.utils.InvalidMapException;
import com.github.stachelbeere1248.zombiesutils.utils.ScoardboardException;
import com.github.stachelbeere1248.zombiesutils.utils.Scoreboard;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import java.util.Set;
public class GameManager {
private final HashMap<String, Game> GAMES;
private Optional<Difficulty> queuedDifficulty = Optional.empty();
private String queuedDifficultyServer = "INVALID";
public GameManager() {
GAMES = new HashMap<>();
@ -43,11 +46,25 @@ public class GameManager {
public void splitOrNew(int round) throws ScoardboardException, InvalidMapException {
final String serverNumber = Scoreboard.getServerNumber().orElseThrow(ScoardboardException::new);
if (GAMES.containsKey(serverNumber)) {
if (round == 0) GAMES.put(serverNumber, new Game(Map.getMap().orElseThrow(InvalidMapException::new), serverNumber));
if (round == 0) newGame(serverNumber);
else GAMES.get(serverNumber).pass(round);
} else {
GAMES.put(serverNumber, new Game(Map.getMap().orElseThrow(InvalidMapException::new), serverNumber, round + 1));
} else newGame(serverNumber);
}
private void newGame(@NotNull String serverNumber) throws InvalidMapException {
final Game game = new Game(Map.getMap().orElseThrow(InvalidMapException::new), serverNumber);
if (serverNumber.equals(queuedDifficultyServer)) {
this.queuedDifficulty.ifPresent(game::changeDifficulty);
}
this.queuedDifficulty = Optional.empty();
this.GAMES.put(serverNumber, game);
}
public void setDifficulty(@NotNull Difficulty difficulty) {
this.queuedDifficultyServer = Scoreboard.getServerNumber().orElse("INVALID");
if (this.GAMES.containsKey(this.queuedDifficultyServer)) {
this.GAMES.get(this.queuedDifficultyServer).changeDifficulty(difficulty);
} else this.queuedDifficulty = Optional.of(difficulty);
}
public Set<String> getGames() {

View file

@ -2,7 +2,7 @@
{
"modid": "${modid}",
"name": "Zombies Utils",
"description": "",
"description": "An all-in-one mod for Hypixel Zombies. Targets legit speed-runners.",
"version": "${version}",
"mcversion": "${mcversion}",
"url": "https://github.com/Stachelbeere1248/zombies-utils",
@ -11,7 +11,7 @@
"Stachelbeere1248"
],
"credits": "Seosean, thamid-23",
"logoFile": "",
"logoFile": "zombiesutils.png",
"screenshots": [],
"dependencies": []
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 273 B

View file

@ -1,10 +1,11 @@
{
"homepage": "https://github.com/Stachelbeere1248/zombies-utils/releases",
"promos": {
"1.8.9-latest" : "1.3.4",
"1.8.9-recommended" : "1.3.4"
"1.8.9-latest" : "1.3.6-PRE_1",
"1.8.9-recommended" : "1.3.5"
},
"1.8.9" : {
"1.3.5" : "SST Prefixes, added update checker url"
"1.3.5" : "SST Prefixes, added update checker url",
"1.3.6-PRE_1" : "SST Prefixes, added update checker url"
}
}