Skip to content

Commit

Permalink
Merge pull request #1011 from AzureAaron/some-other-fixes
Browse files Browse the repository at this point in the history
Some Other fixes
  • Loading branch information
AzureAaron authored Sep 28, 2024
2 parents 9bccc63 + ab7dcd8 commit 3b344cd
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 17 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ occlusionculling_version = 0.0.8-SNAPSHOT
## neu repoparser (https://repo.nea.moe/#/releases/moe/nea/neurepoparser/)
repoparser_version = 1.6.0
## Networth Calculator (https://github.com/AzureAaron/networth-calculator)
networth_calculator_version = 1.0.4
networth_calculator_version = 1.0.5
## Legacy Item DFU (https://github.com/AzureAaron/legacy-item-dfu)
legacy_item_dfu_version = 1.0.1+1.21.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ private static void onMessage(Text text, boolean overlay) {
if (Utils.isOnSkyblock() && overlay && SkyblockerConfigManager.get().chat.skyblockXpMessages) {
String message = text.getString();
Matcher matcher = SKYBLOCK_XP_PATTERN.matcher(message);
int hash = message.hashCode();

if (matcher.find() && !RECENT_MESSAGES.contains(hash)) {
CLIENT.player.sendMessage(Constants.PREFIX.get().append(matcher.group()));
RECENT_MESSAGES.add(hash);
Scheduler.INSTANCE.schedule(() -> RECENT_MESSAGES.remove(hash), 20 * 10);
if (matcher.find()) {
String xpMessage = matcher.group();
int hash = xpMessage.hashCode();

if (!RECENT_MESSAGES.contains(hash)) {
CLIENT.player.sendMessage(Constants.PREFIX.get().append(xpMessage));
RECENT_MESSAGES.add(hash);
Scheduler.INSTANCE.schedule(() -> RECENT_MESSAGES.remove(hash), 20 * 10);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import de.hysky.skyblocker.config.SkyblockerConfigManager;
import de.hysky.skyblocker.skyblock.waypoint.FairySouls;
import de.hysky.skyblocker.utils.SkyblockTime;
import de.hysky.skyblocker.utils.Utils;
import de.hysky.skyblocker.utils.chat.ChatFilterResult;
import de.hysky.skyblocker.utils.chat.ChatPatternListener;
Expand All @@ -24,6 +25,8 @@ public class Trivia extends ChatPatternListener {
private List<String> solutions = Collections.emptyList();

public Trivia() {
//FIXME I think its worth replacing this with something less fragile and is capable of handing multiple lines
//perhaps manual incremental reading based off the start of a question
super("^ +(?:([A-Za-z,' ]*\\?)| ([ⓐⓑⓒ]) ([a-zA-Z0-9 ]+))$");
}

Expand All @@ -50,9 +53,7 @@ private void updateSolutions(String question) {
try {
String trimmedQuestion = question.trim();
if (trimmedQuestion.equals("What SkyBlock year is it?")) {
long currentTime = System.currentTimeMillis() / 1000L;
long diff = currentTime - 1560276000;
int year = (int) (diff / 446400 + 1);
int year = SkyblockTime.skyblockYear.get();
solutions = Collections.singletonList("Year " + year);
} else {
String[] questionAnswers = answers.get(trimmedQuestion);
Expand All @@ -79,7 +80,9 @@ private void updateSolutions(String question) {
answers.put("What is the status of Maxor, Storm, Goldor, and Necron?", new String[]{"The Wither Lords"});
answers.put("Which brother is on the Spider's Den?", new String[]{"Rick"});
answers.put("What is the name of Rick's brother?", new String[]{"Pat"});
answers.put("What is the name of the Painter in the Hub?", new String[]{"Marco"});
//Full Question: "What is the name of the vendor in the Hub who sells stained glass?"
//The solver cannot handle multiple lines right now and just sees "glass?" as the question
answers.put("glass?", new String[]{"Wool Weaver"});
answers.put("What is the name of the person that upgrades pets?", new String[]{"Kat"});
answers.put("What is the name of the lady of the Nether?", new String[]{"Elle"});
answers.put("Which villager in the Village gives you a Rogue Sword?", new String[]{"Jamie"});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package de.hysky.skyblocker.skyblock.item.tooltip.adders;

import de.hysky.skyblocker.config.configs.GeneralConfig;
import de.hysky.skyblocker.config.configs.GeneralConfig.Average;
import de.hysky.skyblocker.skyblock.item.tooltip.ItemTooltip;
import de.hysky.skyblocker.skyblock.item.tooltip.SimpleTooltipAdder;
import de.hysky.skyblocker.skyblock.item.tooltip.info.TooltipInfoType;
Expand All @@ -21,19 +21,19 @@ public AvgBinTooltip(int priority) {
public void addToTooltip(@Nullable Slot focusedSlot, ItemStack stack, List<Text> lines) {
String skyblockApiId = stack.getSkyblockApiId();
String neuName = stack.getNeuName();
Average type = ItemTooltip.config.avg;

if (TooltipInfoType.ONE_DAY_AVERAGE.getData() == null || TooltipInfoType.THREE_DAY_AVERAGE.getData() == null) {
if ((TooltipInfoType.ONE_DAY_AVERAGE.getData() == null && type != Average.THREE_DAY) || (TooltipInfoType.THREE_DAY_AVERAGE.getData() == null && type != Average.ONE_DAY)) {
ItemTooltip.nullWarning();
} else {
/*
We are skipping check average prices for potions, runes
and enchanted books because there is no data for their in API.
*/
if (!neuName.isEmpty() && TooltipInfoType.LOWEST_BINS.hasOrNullWarning(skyblockApiId)) {
GeneralConfig.Average type = ItemTooltip.config.avg;

// "No data" line because of API not keeping old data, it causes NullPointerException
if (type == GeneralConfig.Average.ONE_DAY || type == GeneralConfig.Average.BOTH) {
if (type == Average.ONE_DAY || type == Average.BOTH) {
lines.add(
Text.literal(String.format("%-19s", "1 Day Avg. Price:"))
.formatted(Formatting.GOLD)
Expand All @@ -43,7 +43,7 @@ public void addToTooltip(@Nullable Slot focusedSlot, ItemStack stack, List<Text>
)
);
}
if (type == GeneralConfig.Average.THREE_DAY || type == GeneralConfig.Average.BOTH) {
if (type == Average.THREE_DAY || type == Average.BOTH) {
lines.add(
Text.literal(String.format("%-19s", "3 Day Avg. Price:"))
.formatted(Formatting.GOLD)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package de.hysky.skyblocker.skyblock.item.tooltip.info;

import java.util.List;
import java.util.concurrent.CompletableFuture;

import org.jetbrains.annotations.Nullable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"pack": {
"pack_format": 22,
"pack_format": 34,
"supported_formats": {
"min_inclusive": 34,
"max_inclusive": 2147483647
},
"description": "Recolored textures found in dungeons"
}
}

0 comments on commit 3b344cd

Please sign in to comment.