Skip to content

Commit

Permalink
Release 1.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Morph21 committed Dec 21, 2024
1 parent ae9771a commit ba3147c
Show file tree
Hide file tree
Showing 15 changed files with 64 additions and 38 deletions.
34 changes: 9 additions & 25 deletions app-core/src/main/java/com/mercury/platform/core/ChatHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,13 @@
import com.mercury.platform.shared.config.descriptor.TaskBarDescriptor;
import com.mercury.platform.shared.entity.message.MercuryError;
import com.mercury.platform.shared.store.MercuryStoreCore;
import com.sun.jna.Native;
import com.sun.jna.Pointer;
import com.sun.jna.platform.DesktopWindow;
import com.sun.jna.platform.WindowUtils;
import com.sun.jna.platform.win32.User32;
import com.sun.jna.platform.win32.WinDef;
import com.sun.jna.platform.win32.WinUser;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.SystemUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import javax.swing.*;
import java.awt.*;
import java.awt.datatransfer.Clipboard;
Expand All @@ -26,6 +21,7 @@
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.event.KeyEvent;
import java.io.IOException;
import java.time.Instant;


public class ChatHelper implements AsSubscriber {
Expand Down Expand Up @@ -217,28 +213,16 @@ private void findInStashTab(String toBeFound) {
final int SWP_SHOWWINDOW = 0x0040;

private void gameToFront() {
if (SystemUtils.IS_OS_WINDOWS) {
for (DesktopWindow window : MainWindowHWNDFetch.INSTANCE.getMainWindowList()) {
char[] className = new char[512];
User32.INSTANCE.GetClassName(window.getHWND(), className, 512);

User32.INSTANCE.ShowWindow(window.getHWND(), 5);

boolean isAtFront = User32.INSTANCE.SetForegroundWindow(window.getHWND());
int counter = 0;
while (!isAtFront && counter < 10) {
isAtFront = User32.INSTANCE.SetForegroundWindow(window.getHWND());
try {
Thread.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
counter++;
}
if (Configuration.get().applicationConfiguration().get().isDisableGameToFront()) {
return;
}

User32.INSTANCE.SetFocus(window.getHWND());

}
if (SystemUtils.IS_OS_WINDOWS) {
WinDef.HWND hwnd = MainWindowHWNDFetch.INSTANCE.findWindow();
User32.INSTANCE.ShowWindow(hwnd, 5);
User32.INSTANCE.SetForegroundWindow(hwnd);
User32.INSTANCE.SetFocus(hwnd);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.mercury.platform.core;

public class MercuryConstants {
public static final String APP_VERSION = "1.4.0";
public static final String APP_VERSION = "1.4.1";
public static final String SERVER_HOST = "exslims.ddns.net";
public static final int PORT = 5555;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.sun.jna.platform.DesktopWindow;
import com.sun.jna.platform.WindowUtils;
import com.sun.jna.platform.win32.User32;
import com.sun.jna.platform.win32.WinDef;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down Expand Up @@ -39,8 +40,14 @@ public List<DesktopWindow> getMainWindowList() {
return windowList;
}

public WinDef.HWND findWindow() {
WinDef.HWND hwnd = User32.INSTANCE.FindWindow("POEWindowClass", null);
return hwnd;
}

public boolean isPoe(DesktopWindow desktopWindow) {
// if (this.isPoe2()) {

// return desktopWindow.getTitle().contains("PathOfExile");
// } else {
char[] className = new char[512];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ public class ApplicationDescriptor implements Serializable {
private boolean hideTaskbarUntilHover;
private boolean poe2;
private Languages languages = Languages.en;
private boolean disableGameToFront;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class PoeTradeItemParserChina extends BaseRegexParser {

// Tested for message 神圣怨恨初火: 你好,我想購買 Ghoul Hide, Advanced Marabout Garb 標價 1 exalted 在 Standard (倉庫頁 "asdac"; 位置: 左 5, 上 10)
// coming from https://www.pathofexile.com/trade2/search/poe2/Standard 12.12.2024
private static final String poeTradePattern = "^(.+): 你好,我想購買 (.+) 標價 (\\d+ exalted) 在 (.+) \\(倉庫頁 \"(.+)\"; 位置: 左 (\\d+), 上 (\\d+)\\)$";
private static final String poeTradePattern = "^(.+): 你好,我想購買 (.+) 標價 (\\d+ exalted) 在 (.+) \\(倉庫頁 \"(.*)\"; 位置: 左 (\\d+), 上 (\\d+)\\)$";

public PoeTradeItemParserChina() {
super(poeTradePattern);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class PoeTradeItemParserFrench extends BaseRegexParser {

// Tested for message Sillmar: Bonjour, je souhaiterais t'acheter Call of the Brotherhood, Topaz Ring pour 15 exalted dans la ligue Standard (onglet de réserve "A vendre" ; 6e en partant de la gauche, 1e en partant du haut)
// coming from https://www.pathofexile.com/trade2/search/poe2/Standard 18.12.2024
private static final String poeTradePattern = "^(.+): Bonjour, je souhaiterais t'acheter (.+) pour (.+) dans la ligue (.+) \\(onglet de réserve \"(.+)\" ; (\\d+)e en partant de la gauche, (\\d+)e en partant du haut\\)$";
private static final String poeTradePattern = "^(.+): Bonjour, je souhaiterais t'acheter (.+) pour (.+) dans la ligue (.+) \\(onglet de réserve \"(.*)\" ; (\\d+)e en partant de la gauche, (\\d+)e en partant du haut\\)$";

public PoeTradeItemParserFrench() {
super(poeTradePattern);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class PoeTradeItemParserJapanese extends BaseRegexParser {

// Tested for message ナーフ神ジョナサン: こんにちは、Standard リーグで 3 exalted で売っている、あなたの Havoc Band, Emerald Ring を購入したいです (スタッシュタブ "~b/o 3 exalted"; 位置: 左から 6, 上から 7)
// coming from https://www.pathofexile.com/trade2/search/poe2/Standard 12.12.2024
private static final String poeTradePattern = "^(.+): こんにちは、(.+) リーグで (.+) (.+) で売っている、あなたの (.+) を購入したいです \\(スタッシュタブ \"(.+)\"; 位置: 左から (\\d+), 上から (\\d+)\\)$";
private static final String poeTradePattern = "^(.+): こんにちは、(.+) リーグで (.+) (.+) で売っている、あなたの (.+) を購入したいです \\(スタッシュタブ \"(.*)\"; 位置: 左から (\\d+), 上から (\\d+)\\)$";

public PoeTradeItemParserJapanese() {
super(poeTradePattern);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ public enum TranslationKey {
choose_language("Choose language"),
language_change_requires_application_restart("Language change requires application restart."),
hide_notifications("Hide notifications until next incoming or manually shown"),
show_notifications("Show notifications")
show_notifications("Show notifications"),
disable_game_to_front("Disable game to front"),
disable_game_to_front_tt("Don't check this checkbox until you know what you are doing.<br/>It will disable force putting game to front<br/>which can sometimes make buttons on notification to invite/kick etc not working")
;

private String defaultValue;
Expand Down
4 changes: 3 additions & 1 deletion app-shared/src/main/resources/lang/en.lang
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,6 @@ polish = polish
choose_language = Choose language
language_change_requires_application_restart = Language change requires application restart.
hide_notifications = Hide notifications until next incoming or manually shown
show_notifications = Show notifications
show_notifications = Show notifications
disable_game_to_front = Disable game to front
disable_game_to_front_tt = Don't check this checkbox until you know what you are doing.<br/>It will disable force putting game to front<br/>which can sometimes make buttons on notification to invite/kick etc not working
6 changes: 5 additions & 1 deletion app-shared/src/main/resources/lang/pl.lang
Original file line number Diff line number Diff line change
Expand Up @@ -471,4 +471,8 @@ language_change_requires_application_restart = Zmiana języka wymaga restartu ap
// Hide notifications until next incoming or manually shown
hide_notifications = Ukryj powiadomienia do następnej wiadomości
// Show notifications
show_notifications = Pokaż powiadomienia
show_notifications = Pokaż powiadomienia
// Disable game to front
disable_game_to_front = Wyłącz przenoszenie gry na wierzch
// Don't check this checkbox until you know what you are doing. <br/> It will disable force putting game to front which can sometimes make buttons on notification to invite/kick etc not working
disable_game_to_front_tt = Nie zaznaczaj tego pola, dopóki nie wiesz, co robisz.<br/>Spowoduje to wyłączenie wymuszania przeniesienia gry na wierzch,<br/>co czasami może spowodować, że przyciski na powiadomieniu do zapraszania/wyrzucania itp. mogą przestać działać
6 changes: 5 additions & 1 deletion app-shared/src/main/resources/lang/ru.lang
Original file line number Diff line number Diff line change
Expand Up @@ -471,4 +471,8 @@ language_change_requires_application_restart = Изменение языка т
// Hide notifications until next incoming or manually shown
hide_notifications = Скрыть уведомления до следующего сообщения
// Show notifications
show_notifications = Показать уведомления
show_notifications = Показать уведомления
// Disable game to front
disable_game_to_front = Отключить вывод игры на передний план
// Don't check this checkbox until you know what you are doing. <br/> It will disable force putting game to front which can sometimes make buttons on notification to invite/kick etc not working
disable_game_to_front_tt = Не отмечайте этот флажок, пока не узнаете, что делаете.<br/>Это отключит принудительное перемещение игры на передний план, что иногда может привести к тому,<br/>что кнопки на оповещении для приглашения/выгоняют и т.д. могут не работать
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public void onViewInit() {
this.applicationSnapshot.setHideTaskbarUntilHover(hideTaskbarUntilHover.isSelected());
});

JCheckBox disableGameToFront = this.componentsFactory.getCheckBox(this.applicationSnapshot.isDisableGameToFront(), TranslationKey.disable_game_to_front_tt.value());
disableGameToFront.addActionListener(action -> {
this.applicationSnapshot.setDisableGameToFront(disableGameToFront.isSelected());
});

// JCheckBox poe2Support = this.componentsFactory.getCheckBox(this.applicationSnapshot.isPoe2(), TranslationKey.poe2_support_tt.value());
// poe2Support.addActionListener(action -> {
// this.applicationSnapshot.setPoe2(poe2Support.isSelected());
Expand Down Expand Up @@ -165,6 +170,8 @@ public void keyTyped(KeyEvent e) {
root.add(hideTaskbarUntilHover);
// root.add(this.componentsFactory.getTextLabel(TranslationKey.poe_2_support.value(), FontStyle.REGULAR, 16));
// root.add(poe2Support);
root.add(this.componentsFactory.getTextLabel(TranslationKey.disable_game_to_front.value(), FontStyle.REGULAR, 16));
root.add(disableGameToFront);
root.add(this.componentsFactory.getTextLabel(TranslationKey.component_fade_out_time.value(": "), FontStyle.REGULAR, 16));
root.add(fadeTimeSlider);
root.add(this.componentsFactory.getTextLabel(TranslationKey.min_opacity.value(": "), FontStyle.REGULAR, 16));
Expand Down
16 changes: 16 additions & 0 deletions app-ui/src/main/resources/notes/patch/patch-notes-new.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
[
{
"version": "1.4.1",
"minorChanges": [
{
"changed": "Added checkbox to disable bringing game to top on action always (feature for advanced users - keep in mind that it can sometimes result in message/invite/kick not being sent or invite)"
}
],
"fix": [
{
"changed": "Reduced delay between pressing button on notification (kick/leave/trade etc) and actual action firing to invite, message someone"
},
{
"changed": "Fixed parsing messages with empty stash tab names"
}
]
},
{
"version": "1.4.0",
"fix": [
Expand Down
1 change: 0 additions & 1 deletion app/src/main/java/com/mercury/platform/AppMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.apache.commons.lang3.SystemUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.util.JsonUtils;

import javax.swing.*;
import java.io.File;
Expand Down
8 changes: 4 additions & 4 deletions release_files/release_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
<opt>-Dfile.encoding=UTF-8</opt>
</jre>
<versionInfo>
<fileVersion>1.4.0.0</fileVersion>
<txtFileVersion>1.4.0</txtFileVersion>
<fileVersion>1.4.1.0</fileVersion>
<txtFileVersion>1.4.1</txtFileVersion>
<fileDescription>MercuryTrade</fileDescription>
<copyright>Morph21</copyright>
<productVersion>1.4.0.0</productVersion>
<txtProductVersion>1.4.0</txtProductVersion>
<productVersion>1.4.1.0</productVersion>
<txtProductVersion>1.4.1</txtProductVersion>
<productName>MercuryTrade</productName>
<companyName>Morph</companyName>
<internalName>MercuryTrade</internalName>
Expand Down

0 comments on commit ba3147c

Please sign in to comment.