1package com.osroyale.content.triviabot;
3import com.osroyale.Config;
4import com.osroyale.content.achievement.AchievementHandler;
5import com.osroyale.content.achievement.AchievementKey;
6import com.osroyale.game.world.World;
7import com.osroyale.game.world.entity.mob.player.Player;
8import com.osroyale.game.world.entity.mob.player.PlayerRight;
9import com.osroyale.net.packet.out.SendMessage;
10import com.osroyale.util.Utility;
12import java.util.Arrays;
13import java.util.Collections;
14import java.util.HashSet;
17import static com.osroyale.game.world.items.containers.bank.VaultCurrency.BLOOD_MONEY;
18import static com.osroyale.game.world.items.containers.bank.VaultCurrency.COINS;
62 private final static Set<TriviaBotData> DATA =
new HashSet<>();
72 private static final String COLOR =
"<col=354CE6>";
74 public static int answeredTotal = 0;
87 World.
sendMessage(COLOR +
"<icon=21> TriviaBot: </col>" + CURRENT.getQuestion(), player -> player.settings.triviaBot);
97 if (CURRENT ==
null) {
98 player.send(
new SendMessage(COLOR +
"<icon=21> TriviaBot: </col>There is no question currently assigned!"));
102 player.send(
new SendMessage(COLOR +
"<icon=21> TriviaBot: </col>You think you're funny, don't you? Guess what? You ain't."));
105 if (Arrays.stream(CURRENT.getAnswers()).anyMatch(a -> a.equalsIgnoreCase(
answer))) {
110 player.
speak(
"Golly gee! I just entered a wrong trivia answer!");
112 player.send(
new SendMessage(COLOR +
"<icon=21> TriviaBot: </col>Sorry, the answer you have entered is incorrect! Try again!"));
118 private static void answered(
Player player, String
answer) {
119 String color = player.right.getColor();
120 int reward =
Utility.random(50, 150);
122 player.bankVault.
add(COINS, reward);
124 player.answeredTrivias += 1;
127 player.bankVault.
add(BLOOD_MONEY, reward);
128 player.answeredTrivias += 1;
132 World.
sendMessage(COLOR +
"<icon=21> TriviaBot: <col=" + color +
">" + player.
getName() +
"</col> has answered the question correctly!");
static final String[] BAD_STRINGS
static void activate(Player player, AchievementKey achievement)
static void answer(Player player, String answer)
static void sendMessage(String... messages)
void speak(String forceChat)
boolean add(VaultCurrency currency, long amount)
static String formatDigits(final int amount)
static< T > T randomElement(Collection< T > collection)
static boolean isIronman(Player player)