Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Genyo Addon

definitely not a shoreline skid/port into meteor filled with Genyo magic.
credit to everyone.

International version: Genyo Addon

written for Meteor 1.21.4

### How to use

- Yes

## License

I have a Big Table in my living room.
I love kiwi.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ yarn_mappings=1.21.4+build.8
loader_version=0.16.14

# Mod Properties
mod_version=0.8.2
mod_version=0.8.3
maven_group=com.genyo
archives_base_name=genyo-addon

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.genyo.mixin.network;

import com.genyo.GenyoAddon;
import com.genyo.mixin.accessor.AccessorClientConnection;
import com.genyo.imixins.IClientPlayNetworkHandler;
import com.genyo.systems.modules.misc.Einstein;
Expand Down Expand Up @@ -75,6 +76,7 @@ private void onSendChatMessage(String message, CallbackInfo ci) {
}
}

@Unique
private boolean isChoice(String message) {
final List<String> choices = Arrays.asList("A", "B", "C", "D");

Expand Down
88 changes: 56 additions & 32 deletions src/main/java/com/genyo/systems/modules/misc/Einstein.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
import com.genyo.utils.math.timer.CacheTimer;
import com.genyo.utils.math.timer.Timer;
import meteordevelopment.meteorclient.events.world.TickEvent;
import meteordevelopment.meteorclient.settings.BoolSetting;
import meteordevelopment.meteorclient.settings.IntSetting;
import meteordevelopment.meteorclient.settings.Setting;
import meteordevelopment.meteorclient.settings.SettingGroup;
import meteordevelopment.meteorclient.settings.*;
import meteordevelopment.meteorclient.utils.player.ChatUtils;
import meteordevelopment.orbit.EventHandler;
import net.minecraft.resource.Resource;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
import org.apache.commons.lang3.builder.Diff;
import org.jetbrains.annotations.NotNull;
import org.yaml.snakeyaml.Yaml;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;

public class Einstein extends GenyoModule {

Expand All @@ -43,6 +43,13 @@ public Einstein() {
.build()
);

private final Setting<Mode> mode = sgGeneral.add(new EnumSetting.Builder<Mode>()
.name("Difficulty")
.description("You can be honest here (beta only includes easy questions)")
.defaultValue(Mode.Sigma)
.build()
);

private final Setting<Boolean> goodbye = sgGeneral.add(new BoolSetting.Builder()
.name("Say goodbye")
.description("If you enter an incorrect answer you say something before you can't.")
Expand All @@ -56,7 +63,7 @@ public Einstein() {
private final Random random = new Random();

// Cooldown
private int cooldown = interval.get() * 60000; // default: 300, testing: 5
private int cooldown = interval.get(); // default: 300, testing: 5
private final Timer timer = new CacheTimer();

// Game things
Expand All @@ -79,7 +86,7 @@ public void onDeactivate() {
public void onTick(TickEvent.Pre event) {
if (mc.world == null && mc.player == null) return;

if (timer.passed(cooldown) && !inGame) {
if (timer.passed(cooldown * 60000) && !inGame) {
startGame();
resetGame();
}
Expand All @@ -97,33 +104,49 @@ public void onTick(TickEvent.Pre event) {
private void startGame() {
inGame = true;

currentEntry = entries.get(random.nextInt(entries.size()));
if (mode.get() == Mode.Beta) {
List<Entry> easyEntries = entries.stream()
.filter(e -> e.difficulty.equals(Entry.Difficulty.Easy))
.toList();

GenyoAddon.LOG.info(easyEntries.toString());
currentEntry = easyEntries.get(random.nextInt(easyEntries.size()));
} else {
currentEntry = entries.get(random.nextInt(entries.size()));
}

if (currentEntry == null) return;

String question = currentEntry.question;
List<String> answers = currentEntry.answers;
String output = getOutput(question, answers);

GenyoChatUtils.sendMessage(output);
answerTimer.reset();
}

private static @NotNull String getOutput(String question, List<String> answers) {
String output = "";

output += Formatting.GRAY + "Answer or crash :D" + Formatting.RESET + "\n\n";

// I don't want to display the difficulty
output += "" + Formatting.GREEN + Formatting.BOLD + question + "\n";
output += Formatting.DARK_GRAY + "(A) " + Formatting.GRAY + answers.get(0) + " ";
output += Formatting.DARK_GRAY + "(B) " + Formatting.GRAY + answers.get(1) + " ";
output += Formatting.DARK_GRAY + "(C) " + Formatting.GRAY + answers.get(2) + " ";
output += Formatting.DARK_GRAY + "(D) " + Formatting.GRAY + answers.get(3) + "\n\n";

output += Formatting.RESET + "" + Formatting.GRAY + "Answer with the correct letter in chat!\nYou have 15 seconds.";

GenyoChatUtils.sendMessage(output);
answerTimer.reset();
return output;
}

public void endGame(boolean correct) {
if (correct) {
inGame = false;
String output = "";

output += Formatting.GREEN + " Correct :D";
output += Formatting.GREEN + "Correct :D";

GenyoChatUtils.sendMessage(output);
} else {
Expand Down Expand Up @@ -151,10 +174,12 @@ private void readEinstein() {

List<?> keys = yamlMap.keySet().stream().toList();
for (Object o : keys) {
// The things

// Initialize the things
String question;
List<String> answers;
String correctAnswer;
Entry.Difficulty difficulty;

// The decoding
HashMap value = (HashMap) yamlMap.get(o);
Expand All @@ -173,11 +198,15 @@ private void readEinstein() {
// correct answer
correctAnswer = value.get("correct").toString();

// difficulty
difficulty = Entry.Difficulty.valueOf(value.get("difficulty").toString());

// Entry
entries.add(new Entry(question, answers, correctAnswer));
Entry entry = new Entry(question, answers, correctAnswer, difficulty);
entries.add(entry);
}
} catch (Exception exception) {
GenyoAddon.LOG.info(exception.getMessage());
GenyoAddon.LOG.error(exception.getMessage());
sendError("Couldn't read file. Send logs to wuritz pls.");
}
}
Expand All @@ -186,9 +215,10 @@ private static class Entry {
private final String question;
private final ArrayList<String> answers;
private final Choices correctChoice;
private final String correctAnswer;
private final String correctAnswer; // remains here in case i wanna display the correct answer
private final Difficulty difficulty;

public Entry(String question, List<String> answers, String correctAnswer) {
public Entry(String question, List<String> answers, String correctAnswer, Difficulty difficulty) {
this.question = question;
this.answers = new ArrayList<>(answers);
this.correctAnswer = correctAnswer;
Expand All @@ -200,27 +230,17 @@ public Entry(String question, List<String> answers, String correctAnswer) {
case 3 -> Choices.D;
default -> null;
};
}

public String getQuestion() {
return question;
}

public List<String> getAnswers() {
return answers;
}

public Choices getCorrectChoice() {
return correctChoice;
}

public String getCorrectAnswer() {
return correctAnswer;
this.difficulty = difficulty;
}

private enum Choices {
A, B, C, D
}

private enum Difficulty {
Easy, Hard
}
}

public boolean isInGame() {
Expand All @@ -240,6 +260,10 @@ private void resetDefaults() {
}

private void changeCooldown(int newValue) {
cooldown = newValue * 60000;
cooldown = newValue;
}

private enum Mode {
Beta, Sigma
}
}
Loading
Loading