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 ## For Users
The timer automatically splits every round. The PB/Segment recorder automatically distinguishes maps and difficulties, but not player count. The timer automatically splits every round. The PB/Segment recorder automatically distinguishes maps and difficulties, but not player count.
### Config ### Config
- Language: The selected Hypixel language. Currently supports EN,FR,DE. - `Language`: The selected Hypixel language. Currently supports EN,FR,DE.
- Timer: - ###### Timer:
- Default Category: The record-category to be selected when starting the game. - `Default Category`: The record-category to be selected when starting the game.
- PB Announcements: Whether to show **\*\*\*NEW PERSONAL BEST\*\*\*** on PB in summaries. - `PB Announcements`: Whether to show **\*\*\*NEW PERSONAL BEST\*\*\*** on PB in summaries.
- SST: - ###### SST:
- Enabled: Enables / disables this feature. - 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. - 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. - 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. - Truncate: Whether to show passed rounds in the HUD.
- SLA: - ###### SLA:
- Enabled: Whether the SLA HUD should automatically be shown when starting a game. - `Enabled`: Whether the SLA HUD should automatically be shown when starting a game.
- Truncate: Whether inactive windows and rooms should be shown. - `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:
- Player Visibility: Whether to enable PlayerVisibility by default. - `Enabled`: Whether to enable PlayerVisibility by default.
- CPS Counter: A simple CPS Counter which shows the amount of clicks within the last 20 gameticks. - `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 ### 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. - /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: - Examples:
@ -37,6 +39,7 @@ The timer automatically splits every round. The PB/Segment recorder automaticall
- /sla off - Disables the SLA hud - /sla off - Disables the SLA hud
- /sla map \<de|bb|aa|p> - forcefully set the map - /sla map \<de|bb|aa|p> - forcefully set the map
- /sla quick \<mogi_a|ghxula|ghxula-garden> - /sla quick \<mogi_a|ghxula|ghxula-garden>
- useless for most players:
- /sla rotate - rotates all windows around the axis (0,y,0) - /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 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 - /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. - 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. - Player Visibility: Toggles whether to show players that are within a 4 block radius.
### Extra ### 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 baseGroup = com.github.stachelbeere1248.zombiesutils
mcVersion = 1.8.9 mcVersion = 1.8.9
modid = zombiesutils modid = zombiesutils
version = 1.3.6 version = 1.3.6-PRE_1

View file

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

View file

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

View file

@ -17,18 +17,19 @@ public class ChatHandler {
@SubscribeEvent @SubscribeEvent
public void difficultyChange(@NotNull final ClientChatReceivedEvent event) { 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( ZombiesUtils.getInstance().getGameManager().getGame().ifPresent(
game -> { game -> {
String message = STRIP_COLOR_PATTERN.matcher(event.message.getUnformattedText()).replaceAll("").trim(); if (LanguageSupport.isHelicopterIncoming(message)) game.helicopter();
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();
}
} }
); );
} }
} }
}

View file

@ -24,7 +24,8 @@ public class RenderPlayerHandler {
} }
private boolean inRange(@NotNull Vec3 playerOther) { 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() { public void togglePlayerVisibility() {
this.visible = !this.visible; this.visible = !this.visible;

View file

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

View file

@ -2,7 +2,7 @@
{ {
"modid": "${modid}", "modid": "${modid}",
"name": "Zombies Utils", "name": "Zombies Utils",
"description": "", "description": "An all-in-one mod for Hypixel Zombies. Targets legit speed-runners.",
"version": "${version}", "version": "${version}",
"mcversion": "${mcversion}", "mcversion": "${mcversion}",
"url": "https://github.com/Stachelbeere1248/zombies-utils", "url": "https://github.com/Stachelbeere1248/zombies-utils",
@ -11,7 +11,7 @@
"Stachelbeere1248" "Stachelbeere1248"
], ],
"credits": "Seosean, thamid-23", "credits": "Seosean, thamid-23",
"logoFile": "", "logoFile": "zombiesutils.png",
"screenshots": [], "screenshots": [],
"dependencies": [] "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", "homepage": "https://github.com/Stachelbeere1248/zombies-utils/releases",
"promos": { "promos": {
"1.8.9-latest" : "1.3.4", "1.8.9-latest" : "1.3.6-PRE_1",
"1.8.9-recommended" : "1.3.4" "1.8.9-recommended" : "1.3.5"
}, },
"1.8.9" : { "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"
} }
} }