Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

Commit

Permalink
Merge branch 'development' into regexfix
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanzhoudev authored Sep 15, 2023
2 parents a264148 + 0228ef2 commit 096089b
Show file tree
Hide file tree
Showing 12 changed files with 214 additions and 73 deletions.
33 changes: 17 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,51 @@
## [1.15.1-beta.2](https://github.com/Wynntils/Wynntils/compare/v1.15.1-beta.1...v1.15.1-beta.2) (2023-04-17)
## [1.15.1-beta.8](https://github.com/Wynntils/Wynntils/compare/v1.15.1-beta.7...v1.15.1-beta.8) (2023-09-15)


### Bug Fixes

* The mod can now load Artemis (1.19.3) lootruns ([#675](https://github.com/Wynntils/Wynntils/issues/675)) ([cc98eb1](https://github.com/Wynntils/Wynntils/commit/cc98eb12022bf752acdd359883a9254ae35d192c))
* Fixed chat crash bug ([#687](https://github.com/Wynntils/Wynntils/issues/687)) ([76ed2da](https://github.com/Wynntils/Wynntils/commit/76ed2dab265bd032a62a3188cac5936832dc1d11))

## [1.15.1-beta.1](https://github.com/Wynntils/Wynntils/compare/v1.15.1-beta.0...v1.15.1-beta.1) (2023-04-01)
## [1.15.1-beta.7](https://github.com/Wynntils/Wynntils/compare/v1.15.1-beta.6...v1.15.1-beta.7) (2023-09-13)


### New Features
### Bug Fixes

* Add Artemis export button for waypoint manager GUI ([#673](https://github.com/Wynntils/Wynntils/issues/673)) ([1ea89ce](https://github.com/Wynntils/Wynntils/commit/1ea89ce88cb334233387bc971c9218cd5c1d5ee1))
* Fix Guild Map Crashing ([#689](https://github.com/Wynntils/Wynntils/issues/689)) ([e5cc971](https://github.com/Wynntils/Wynntils/commit/e5cc9718dad93581000783c1a298862e6da91c99))


### Miscellaneous Chores

* **release:** v1.15.1-beta.1 [skip ci] ([bf060a2](https://github.com/Wynntils/Wynntils/commit/bf060a250ebddac1a4139d5ae312a96316bafe0a))
* **release:** v1.15.1-beta.7 [skip ci] ([f28c584](https://github.com/Wynntils/Wynntils/commit/f28c5843e805b5522fa0e449e4c9eb636cf799ba))

## [1.15.1-beta.0](https://github.com/Wynntils/Wynntils/compare/v1.15.0...v1.15.1-beta.0) (2023-04-01)
## [1.15.1-beta.6](https://github.com/Wynntils/Wynntils/compare/v1.15.1-beta.5...v1.15.1-beta.6) (2023-08-12)


### Bug Fixes

* Fix party finder crash on housing island ([#669](https://github.com/Wynntils/Wynntils/issues/669)) ([f97f5ad](https://github.com/Wynntils/Wynntils/commit/f97f5ad803fba62e3a38c31b74e027c0214ed41d))
* Fixed TAB_EFFECT_PATTERN regex ([#686](https://github.com/Wynntils/Wynntils/issues/686)) ([46408de](https://github.com/Wynntils/Wynntils/commit/46408de7d589c2dc5ef6dcabe54eb4bfe27d39bf))


### Miscellaneous Chores

* **release:** v1.15.1-beta.0 [skip ci] ([d60803c](https://github.com/Wynntils/Wynntils/commit/d60803cf7ac832394fc9c981217b2331ccf51821))
* **release:** v1.15.1-beta.6 [skip ci] ([71bf7fe](https://github.com/Wynntils/Wynntils/commit/71bf7fee9698345af1b61eb7f3b39c57b51fb497))

## [1.15.0](https://github.com/Wynntils/Wynntils/compare/v1.14.1-beta.14...v1.15.0) (2023-02-21)
## [1.15.1-beta.5](https://github.com/Wynntils/Wynntils/compare/v1.15.1-beta.4...v1.15.1-beta.5) (2023-07-24)


### Miscellaneous Chores
### New Features

* **release:** v1.15.0 [skip ci] ([1a93a1e](https://github.com/Wynntils/Wynntils/commit/1a93a1eb9decc0acf497c7f923a3032c00c5e65b))
* Export favorites via command ([#681](https://github.com/Wynntils/Wynntils/issues/681)) ([103a8b8](https://github.com/Wynntils/Wynntils/commit/103a8b8614f27e8381c01599ca9d35ad68451193))

## [1.14.1-beta.14](https://github.com/Wynntils/Wynntils/compare/v1.14.1-beta.13...v1.14.1-beta.14) (2023-02-20)

### Miscellaneous Chores

### New Features
* **release:** v1.15.1-beta.5 [skip ci] ([1677480](https://github.com/Wynntils/Wynntils/commit/1677480cf1d047e1e131f11a5b9f56a052a110d9))

* Remove support for stable update stream ([#667](https://github.com/Wynntils/Wynntils/issues/667)) ([c5b509d](https://github.com/Wynntils/Wynntils/commit/c5b509dd720560ff268bfb652a49a9fa8f27509e))
## [1.15.1-beta.4](https://github.com/Wynntils/Wynntils/compare/v1.15.1-beta.3...v1.15.1-beta.4) (2023-07-18)


### Miscellaneous Chores

* **release:** v1.14.1-beta.14 [skip ci] ([24703b1](https://github.com/Wynntils/Wynntils/commit/24703b14edd1cb010578522367cc590bcbf64d2c))
* **release:** v1.15.1-beta.4 [skip ci] ([b0e0d5b](https://github.com/Wynntils/Wynntils/commit/b0e0d5b34ce26d519a26c8cef32b3be8c645bd88))
* Remove broken quest book ([#679](https://github.com/Wynntils/Wynntils/issues/679)) ([b9d15f5](https://github.com/Wynntils/Wynntils/commit/b9d15f51efbecfead2afaf9cbac4569ecbf651bb))

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CG3 is the duration string (eg. "1:23")
https://regexr.com/729qc
*/
private static final Pattern TAB_EFFECT_PATTERN = Pattern.compile("(.+?§7 ?(?:\\d+(?:\\.\\d+)?%)?) ?([%\\-+\\/\\da-zA-Z\\s]+?) §[84a]\\((.+?)\\).*");
private static final Pattern TAB_EFFECT_PATTERN = Pattern.compile("(.+?§7 ?(?:\\d+(?:\\.\\d+)?%)?) ?(['%\\-+\\/\\da-zA-Z\\s]+?) §[84a]\\((.+?)\\).*");

/**
* Updates the ConsumableTimerOverlay with the effects from the tab list
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/com/wynntils/core/utils/StringUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class StringUtils {
private static final Pattern STX_PATTERN = Pattern.compile("(\\.?\\d+\\.?\\d*)\\s*(s|stx|stacks)");
private static final Pattern LE_PATTERN = Pattern.compile("(\\.?\\d+\\.?\\d*)\\s*(l|le)");
private static final Pattern EB_PATTERN = Pattern.compile("(\\.?\\d+\\.?\\d*)\\s*(b|eb)");
private static final Pattern K_PATTERN = Pattern.compile("(\\.?\\d+\\.?\\d*)\\s*(k|thousand)");
private static final Pattern M_PATTERN = Pattern.compile("(\\.?\\d+\\.?\\d*)\\s*(m|million)");
private static final Pattern E_PATTERN = Pattern.compile("(\\d+)($|\\s|\\s*e|\\s*em)(?![^\\d\\s-])");
private static final Pattern RAW_PRICE_PATTERN = Pattern.compile("\\d+");

Expand Down Expand Up @@ -423,6 +425,18 @@ public static String convertEmeraldPrice(String input) {
while (ebMatcher.find()) {
emeralds += (long) (Double.parseDouble(ebMatcher.group(1)) * 64);
}

// k
Matcher kMatcher = K_PATTERN.matcher(input);
while (kMatcher.find()) {
emeralds += (long) (Double.parseDouble(kMatcher.group(1)) * 1000);
}

// m
Matcher mMatcher = M_PATTERN.matcher(input);
while (mMatcher.find()) {
emeralds += (long) (Double.parseDouble(mMatcher.group(1)) * 1000000);
}

// standard numbers/emeralds
Matcher eMatcher = E_PATTERN.matcher(input);
Expand Down
19 changes: 12 additions & 7 deletions src/main/java/com/wynntils/modules/chat/overlays/ChatOverlay.java
Original file line number Diff line number Diff line change
Expand Up @@ -483,13 +483,18 @@ public void deleteChatLine(int id) {
});

int[] count = { 0 };
currentTab.getCurrentMessages().removeIf(chatline -> {
if (chatline.getChatLineID() == id) {
++count[0];
return true;
}
return false;
});
try {
currentTab.getCurrentMessages().removeIf(chatline -> {
if (chatline.getChatLineID() == id) {
++count[0];
return true;
}
return false;
});
} catch (Exception ex) {
ex.printStackTrace();
return;
}

if (scrollPos > 0 && getChatOpen() && count[0] > 0) {
isScrolled = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,26 @@
import com.wynntils.core.framework.rendering.colors.CommonColors;
import com.wynntils.core.framework.rendering.colors.CustomColor;
import com.wynntils.core.framework.rendering.textures.Textures;
import com.wynntils.core.utils.StringUtils;
import com.wynntils.core.utils.objects.Storage;
import com.wynntils.modules.map.configs.MapConfig;
import com.wynntils.modules.map.instances.GuildResourceContainer;
import com.wynntils.modules.map.instances.MapProfile;
import com.wynntils.modules.map.managers.GuildResourceManager;
import com.wynntils.modules.map.overlays.renderer.MapInfoUI;
import com.wynntils.webapi.WebManager;
import com.wynntils.webapi.profiles.TerritoryProfile;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.text.TextFormatting;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;

public class MapTerritory {

private static final CustomColor territoryNameColour = new CustomColor(CommonColors.WHITE);
private static final HashMap<String, CustomColor> backupGuildColors = new HashMap<>();

ScreenRenderer renderer = null;

Expand Down Expand Up @@ -64,7 +68,7 @@ public MapTerritory(TerritoryProfile territory) {
description.add(TextFormatting.GRAY + "✦ Treasury: " + resources.getTreasury());
description.add(TextFormatting.GRAY + "Territory Defences: " + resources.getDefences());
description.add("");

String treasuryColor = resources.getTreasury().substring(0, 2);
description.add(TextFormatting.GRAY + "Time held: " + treasuryColor + territory.getReadableRelativeTimeAcquired());

Expand Down Expand Up @@ -160,12 +164,26 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks, boolean terri
}

private CustomColor getTerritoryColor(boolean resourceColor) {
if (!resourceColor) {
return territory.getGuildColor() == null ? StringUtils.colorFromString(territory.getGuild()) :
StringUtils.colorFromHex(territory.getGuildColor());
} else {
return resources.getColor();
if (resourceColor) return resources.getColor();

if (WebManager.getGuildColors().containsKey(territory.getGuild())) {
return WebManager.getGuildColors().get(territory.getGuild());
}

// Guild not found in the list, check backup list and add a random color if not found
if (!backupGuildColors.containsKey(territory.getGuild())) {
Random random = new Random();
backupGuildColors.put(
territory.getGuild(),
CustomColor.fromHSV(
random.nextFloat(),
random.nextFloat(),
0.5f + random.nextFloat() * 0.5f,
1f
)
);
}
return backupGuildColors.get(territory.getGuild());
}

public void postDraw(int mouseX, int mouseY, float partialTicks, int width, int height) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
import com.wynntils.core.framework.instances.Module;
import com.wynntils.core.framework.interfaces.annotations.ModuleInfo;
import com.wynntils.modules.questbook.commands.CommandExportDiscoveries;
import com.wynntils.modules.questbook.commands.CommandExportFavorites;
import com.wynntils.modules.questbook.configs.QuestBookConfig;
import com.wynntils.modules.questbook.enums.Guides;
import com.wynntils.modules.questbook.enums.QuestBookPages;
import com.wynntils.modules.questbook.events.ClientEvents;
import com.wynntils.modules.questbook.managers.QuestManager;
import com.wynntils.modules.questbook.overlays.hud.TrackedQuestOverlay;
import net.minecraftforge.client.settings.KeyConflictContext;
import org.lwjgl.input.Keyboard;
Expand All @@ -31,6 +31,7 @@ public void onEnable() {
registerOverlay(new TrackedQuestOverlay(), Priority.HIGHEST);

registerCommand(new CommandExportDiscoveries());
registerCommand(new CommandExportFavorites());

registerKeyBinding("Open Quest Book", Keyboard.KEY_K, "Wynntils", KeyConflictContext.IN_GAME, true, () -> QuestBookPages.QUESTS.getPage().open(true));
registerKeyBinding("Open Discoveries", Keyboard.KEY_U, "Wynntils", KeyConflictContext.IN_GAME, true, () -> QuestBookPages.DISCOVERIES.getPage().open(true));
Expand All @@ -39,7 +40,7 @@ public void onEnable() {
registerKeyBinding("Open HUD configuration", Keyboard.KEY_NONE, "Wynntils", KeyConflictContext.IN_GAME, true, () -> QuestBookPages.HUDCONFIG.getPage().open(true));
registerKeyBinding("Open Menu", Keyboard.KEY_I, "Wynntils", KeyConflictContext.IN_GAME, true, () -> {
QuestBookPages.MAIN.getPage().open(true);
QuestManager.readQuestBook();
//QuestManager.readQuestBook();
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* * Copyright © Wynntils - 2022.
*/

package com.wynntils.modules.questbook.commands;

import com.wynntils.McIf;
import com.wynntils.core.utils.Utils;
import com.wynntils.modules.utilities.configs.UtilitiesConfig;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.event.ClickEvent;
import net.minecraftforge.client.IClientCommand;

import java.util.ArrayList;
import java.util.List;

public class CommandExportFavorites extends CommandBase implements IClientCommand {


@Override
public String getName() {
return "exportfavorites";
}

@Override
public boolean allowUsageWithoutPrefix(ICommandSender sender, String message) {
return false;
}

@Override
public String getUsage(ICommandSender sender) {
return "exportfavorites";
}

@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
ITextComponent command = new TextComponentString("/exportfavorites");
command.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/exportfavorites"));

List<String> combinedList = new ArrayList<>();
combinedList.addAll(UtilitiesConfig.INSTANCE.favoriteItems);
combinedList.addAll(UtilitiesConfig.INSTANCE.favoriteIngredients);
combinedList.addAll(UtilitiesConfig.INSTANCE.favoritePowders);
combinedList.addAll(UtilitiesConfig.INSTANCE.favoriteEmeraldPouches);

Utils.copyToClipboard("wynntilsFavorites," + String.join(",", combinedList));
McIf.player().sendMessage(new TextComponentString(TextFormatting.GREEN + "Copied favorites to clipboard! Open the guide list and click the + button on Artemis to import them."));
}

@Override
public int getRequiredPermissionLevel() {
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public void updateQuestBook(TickEvent.ClientTickEvent e) {

QuestBookPages.MAIN.getPage().open(true);

QuestManager.readQuestBook();
//QuestManager.readQuestBook();
}

private int tickCounter = 0;
Expand Down
Loading

0 comments on commit 096089b

Please sign in to comment.