Skip to content

Commit

Permalink
1.0.3.4 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Exslims committed Dec 26, 2018
1 parent 829d6b1 commit fd544e5
Show file tree
Hide file tree
Showing 22 changed files with 157 additions and 19 deletions.
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.0.3.3.0";
public static final String APP_VERSION = "1.0.3.4.0";
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 @@ -73,7 +73,7 @@ public void parse() {
.collect(Collectors.toList());

List<String> resultMessages = filteredMessages.stream().filter(message -> {
if (message.contains("2017") || message.contains("2018")) { //todo
if (message.contains("2017") || message.contains("2018") || message.contains("2019")) { //todo
Date date = new Date(StringUtils.substring(message, 0, 20));
return date.after(lastMessageDate);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected MessageMatcher match() {
private abstract class LocalizationMatcher {
public boolean isSuitableFor(String message) {
return message.contains("Hi, I would like") ||
message.contains("Hi, I'd like") ||
message.contains("Hi, I'd like") || message.contains("I'd like") ||
(message.contains("wtb") && message.contains("(stash"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected MessageMatcher match() {
private abstract class LocalizationMatcher {
public boolean isSuitableFor(String message) {
return message.contains("Hi, I would like") ||
message.contains("Hi, I'd like") ||
message.contains("Hi, I'd like") || message.contains("I'd like") ||
(message.contains("wtb") && message.contains("(stash"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
import com.mercury.platform.shared.entity.message.ItemTradeNotificationDescriptor;
import com.mercury.platform.shared.entity.message.NotificationDescriptor;
import com.mercury.platform.shared.entity.message.NotificationType;
import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

public class MessageParser {
private final static String poeTradeStashTabPattern = "^(.*\\s)?(.+): (.+ to buy your\\s+?(.+?)(\\s+?listed for\\s+?([\\d\\.]+?)\\s+?(.+))?\\s+?in\\s+?(.+?)\\s+?\\(stash tab \"(.*)\"; position: left (\\d+), top (\\d+)\\)\\s*?(.*))$";
private final static String poeTradePattern = "^(.*\\s)?(.+): (.+ to buy your\\s+?(.+?)(\\s+?listed for\\s+?([\\d\\.]+?)\\s+?(.+))?\\s+?in\\s+?(.*?))$";
private final static String poeAppPattern = "^(.*\\s)?(.+): (\\s*?wtb\\s+?(.+?)(\\s+?listed for\\s+?([\\d\\.]+?)\\s+?(.+))?\\s+?in\\s+?(.+?)\\s+?\\(stash\\s+?\"(.*?)\";\\s+?left\\s+?(\\d+?),\\s+?top\\s+(\\d+?)\\)\\s*?(.*))$";
private final static String poeAppBulkCurrenciesPattern = "^(.*\\s)?(.+): (\\s*?wtb\\s+?(.+?)(\\s+?listed for\\s+?([\\d\\.]+?)\\s+?(.+))?\\s+?in\\s+?(.+?)\\s+?\\(stash\\s+?\"(.*?)\";\\s+?left\\s+?(\\d+?),\\s+?top\\s+(\\d+?)\\)\\s*?(.*))$";
private final static String poeCurrencyPattern = "^(.*\\s)?(.+): (.+ to buy your (\\d+(\\.\\d+)?)? (.+) for my (\\d+(\\.\\d+)?)? (.+) in (.*?)\\.\\s*(.*))$";
private Pattern poeAppItemPattern;
private Pattern poeTradeStashItemPattern;
Expand Down Expand Up @@ -73,10 +77,17 @@ public NotificationDescriptor parse(String fullMessage) {
Matcher poeTradeCurrencyMatcher = poeTradeCurrencyPattern.matcher(fullMessage);
if (poeTradeCurrencyMatcher.find()) {
CurrencyTradeNotificationDescriptor tradeNotification = new CurrencyTradeNotificationDescriptor();

if (poeTradeCurrencyMatcher.group(6).contains("&") || poeTradeCurrencyMatcher.group(6).contains(",")) { //todo this shit for bulk map
String bulkItems = poeTradeCurrencyMatcher.group(4) + " " + poeTradeCurrencyMatcher.group(6);
tradeNotification.setItems(Arrays.stream(StringUtils.split(bulkItems, ",&")).map(String::trim).collect(Collectors.toList()));
} else {
tradeNotification.setCurrForSaleCount(Double.parseDouble(poeTradeCurrencyMatcher.group(4)));
tradeNotification.setCurrForSaleTitle(poeTradeCurrencyMatcher.group(6));
}

tradeNotification.setWhisperNickname(poeTradeCurrencyMatcher.group(2));
tradeNotification.setSourceString(poeTradeCurrencyMatcher.group(3));
tradeNotification.setCurrForSaleCount(Double.parseDouble(poeTradeCurrencyMatcher.group(4)));
tradeNotification.setCurrForSaleTitle(poeTradeCurrencyMatcher.group(6));
tradeNotification.setCurCount(Double.parseDouble(poeTradeCurrencyMatcher.group(7)));
tradeNotification.setCurrency(poeTradeCurrencyMatcher.group(9));
tradeNotification.setLeague(poeTradeCurrencyMatcher.group(10));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
import lombok.Data;
import lombok.EqualsAndHashCode;

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

@EqualsAndHashCode(callSuper = true)
@Data
public class CurrencyTradeNotificationDescriptor extends TradeNotificationDescriptor {
private Double currForSaleCount;
private String currForSaleTitle;
private List<String> items = new ArrayList<>();
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
import com.mercury.platform.ui.misc.TooltipConstants;

import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.text.DecimalFormat;


public class CurrencyTradeIncNotificationPanel extends TradeIncNotificationPanel<CurrencyTradeNotificationDescriptor> {
private JPanel labelsPanel;

@Override
protected JPanel getMessagePanel() {
this.labelsPanel = this.componentsFactory.getJPanel(new BorderLayout(), AppThemeColor.FRAME);
Expand All @@ -41,10 +43,35 @@ protected JPanel getMessagePanel() {

private JPanel getFromPanel() {
JPanel fromPanel = this.componentsFactory.getJPanel(new BorderLayout(4, 0), AppThemeColor.FRAME);
JPanel currencyPanel = this.getCurrencyPanel(this.data.getCurrForSaleCount(), this.data.getCurrForSaleTitle());
currencyPanel.setBackground(AppThemeColor.FRAME);
fromPanel.add(currencyPanel, BorderLayout.LINE_START);
fromPanel.add(getCurrencyRatePanel(), BorderLayout.CENTER);

JLabel currencyLabel = this.componentsFactory.getIconLabel("currency/" + this.data.getCurrForSaleTitle() + ".png", 26);

if (this.data.getItems().size() > 0) {
JPanel itemsPanel = new JPanel();
itemsPanel.setBackground(AppThemeColor.FRAME);
itemsPanel.setLayout(new BoxLayout(itemsPanel, BoxLayout.Y_AXIS));
itemsPanel.setBorder(new EmptyBorder(0, 0, 2, 0));

this.data.getItems().forEach((item) -> {
itemsPanel.add(this.componentsFactory.getTextLabel(item));
});
fromPanel.add(itemsPanel, BorderLayout.LINE_START);

if (this.data.getItems().size() > 1) {
this.setAdditionalHeightDelta((this.data.getItems().size() - 1) * 15);
}
} else if (currencyLabel.getIcon() == null) {
JPanel itemsPanel = new JPanel();
itemsPanel.setBackground(AppThemeColor.FRAME);
itemsPanel.setLayout(new BoxLayout(itemsPanel, BoxLayout.Y_AXIS));
itemsPanel.add(this.componentsFactory.getTextLabel(this.data.getCurrForSaleCount().intValue() + " " + this.data.getCurrForSaleTitle()));
fromPanel.add(itemsPanel, BorderLayout.LINE_START);
} else {
JPanel currencyPanel = this.getCurrencyPanel(this.data.getCurrForSaleCount(), this.data.getCurrForSaleTitle());
currencyPanel.setBackground(AppThemeColor.FRAME);
fromPanel.add(currencyPanel, BorderLayout.LINE_START);
fromPanel.add(getCurrencyRatePanel(), BorderLayout.CENTER);
}
return fromPanel;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.mercury.platform.ui.misc.AppThemeColor;

import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.text.DecimalFormat;

Expand Down Expand Up @@ -37,10 +38,34 @@ protected JPanel getMessagePanel() {

private JPanel getFromPanel() {
JPanel fromPanel = this.componentsFactory.getJPanel(new BorderLayout(4, 0), AppThemeColor.FRAME);
JPanel currencyPanel = this.getCurrencyPanel(this.data.getCurrForSaleCount(), this.data.getCurrForSaleTitle());
currencyPanel.setBackground(AppThemeColor.FRAME);
fromPanel.add(currencyPanel, BorderLayout.LINE_START);
fromPanel.add(getCurrencyRatePanel(), BorderLayout.CENTER);
JLabel currencyLabel = this.componentsFactory.getIconLabel("currency/" + this.data.getCurrForSaleTitle() + ".png", 26);

if (this.data.getItems().size() > 0) {
JPanel itemsPanel = new JPanel();
itemsPanel.setBackground(AppThemeColor.FRAME);
itemsPanel.setLayout(new BoxLayout(itemsPanel, BoxLayout.Y_AXIS));
itemsPanel.setBorder(new EmptyBorder(0, 0, 2, 0));

this.data.getItems().forEach((item) -> {
itemsPanel.add(this.componentsFactory.getTextLabel(item));
});
fromPanel.add(itemsPanel, BorderLayout.LINE_START);

if (this.data.getItems().size() > 1) {
this.setAdditionalHeightDelta((this.data.getItems().size() - 1) * 15);
}
} else if (currencyLabel.getIcon() == null) {
JPanel itemsPanel = new JPanel();
itemsPanel.setBackground(AppThemeColor.FRAME);
itemsPanel.setLayout(new BoxLayout(itemsPanel, BoxLayout.Y_AXIS));
itemsPanel.add(this.componentsFactory.getTextLabel(this.data.getCurrForSaleCount().intValue() + " " + this.data.getCurrForSaleTitle()));
fromPanel.add(itemsPanel, BorderLayout.LINE_START);
} else {
JPanel currencyPanel = this.getCurrencyPanel(this.data.getCurrForSaleCount(), this.data.getCurrForSaleTitle());
currencyPanel.setBackground(AppThemeColor.FRAME);
fromPanel.add(currencyPanel, BorderLayout.LINE_START);
fromPanel.add(getCurrencyRatePanel(), BorderLayout.CENTER);
}
return fromPanel;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ public abstract class NotificationPanel<T, C> extends JPanel implements AsSubscr
private float paintAlphaValue = 1f;
private Subscription settingsPostSubscription;

@Setter
@Getter
private int additionalHeightDelta = 0;

@Override
public void onViewInit() {
this.setLayout(new BorderLayout());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ private void addNotification(NotificationPanel notificationPanel) {
this.container.add(this.componentsFactory.wrapToSlide(notificationPanel, AppThemeColor.TRANSPARENT, 1, 1, 1, 1));
}
int delta = -notificationPanel.getParent().getPreferredSize().height;


if (this.notificationPanels.size() > this.config.get().getLimitCount()) {
if (!this.expanded) {
notificationPanel.getParent().setVisible(false);
Expand All @@ -197,8 +199,15 @@ private void addNotification(NotificationPanel notificationPanel) {
}
if (this.flowDirections.equals(FlowDirections.UPWARDS) &&
this.notificationPanels.size() > 1) {
this.pack();
this.changeBufferSize(delta);
}

if (this.flowDirections.equals(FlowDirections.UPWARDS) &&
(notificationPanel.getAdditionalHeightDelta() > 0) && this.notificationPanels.size() == 1) {
this.pack();
this.changeBufferSize(-notificationPanel.getAdditionalHeightDelta());
}
this.pack();
this.repaint();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ public String getDescriptorData(NotificationDescriptor notificationDescriptor) {
}
case INC_CURRENCY_MESSAGE: {
CurrencyTradeNotificationDescriptor descriptor = (CurrencyTradeNotificationDescriptor) notificationDescriptor;
return descriptor.getCurrForSaleTitle();
if (descriptor.getCurrForSaleTitle() != null) {
return descriptor.getCurrForSaleTitle();
}
}
}
return UUID.randomUUID().toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@

import javax.swing.*;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class HelpIGFrame extends AbstractOverlaidFrame {
private int MARGIN = 400;
private int x;
private int y;
public HelpIGFrame() {
super();
}
Expand Down Expand Up @@ -40,7 +44,35 @@ public void onViewInit() {

JLabel img = new JLabel(icon);
this.add(img);

img.addMouseListener(new DraggedFrameMouseListener());
img.addMouseMotionListener(new DraggedFrameMotionListener());
img.setCursor(new Cursor(Cursor.MOVE_CURSOR));
this.pack();
this.setLocation(dim.width/2-this.getSize().width/2, 0);
}

public class DraggedFrameMotionListener extends MouseAdapter {
@Override
public void mouseDragged(MouseEvent e) {
e.translatePoint(HelpIGFrame.this.getLocation().x - x, HelpIGFrame.this.getLocation().y - y);
HelpIGFrame.this.setLocation(new Point(e.getX(), e.getY()));
}
}

public class DraggedFrameMouseListener extends MouseAdapter {
@Override
public void mousePressed(MouseEvent e) {
x = e.getX();
y = e.getY();
}

@Override
public void mouseReleased(MouseEvent e) {
Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
if (getLocationOnScreen().y + getSize().height > dimension.height) {
setLocation(getLocationOnScreen().x, dimension.height - getSize().height);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private JPanel getBottomPanel() {
donateDescriptor.setSize(new Dimension(100, 20));
donateDescriptor.setType(AdrComponentType.PROGRESS_BAR);
donateDescriptor.setCustomTextEnable(true);
donateDescriptor.setCustomText("31$");
donateDescriptor.setCustomText("0$");
donateDescriptor.setFontSize(21);
donateDescriptor.setLowValueTextColor(AppThemeColor.TEXT_DEFAULT);
donateDescriptor.setMediumValueTextColor(AppThemeColor.TEXT_DEFAULT);
Expand All @@ -93,7 +93,7 @@ private JPanel getBottomPanel() {
donateDescriptor.setBackgroundColor(AppThemeColor.FRAME);
donateDescriptor.setForegroundColor(AppThemeColor.BUTTON);
MercuryTracker tracker = new MercuryTracker(donateDescriptor);
tracker.setValue(32 * 1000);
tracker.setValue(1000);
tracker.setPreferredSize(donateDescriptor.getSize());
root.add(this.componentsFactory.getTextLabel("Monthly donations:", FontStyle.BOLD, 16), BorderLayout.LINE_START);
root.add(this.componentsFactory.wrapToSlide(tracker, AppThemeColor.ADR_FOOTER_BG, 2, 2, 2, 1), BorderLayout.CENTER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ private JPanel getTestCasesPanel() {
testPanel.add(chatScannerLabel, titleColumn);
titleColumn.gridy++;

JButton mapBulkButton = componentsFactory.getBorderedButton("Click");
mapBulkButton.addActionListener(action -> {
MercuryStoreCore.newNotificationSubject.onNext(this.testEngine.getRandomMapBulkMessage());
});
testPanel.add(mapBulkButton, buttonColumn);
buttonColumn.gridy++;
JLabel mapBulkLabel = componentsFactory.getTextLabel("Random bulk map message");
testPanel.add(mapBulkLabel, titleColumn);
titleColumn.gridy++;

JButton accessibilityStatusButton = componentsFactory.getBorderedButton("Click");
accessibilityStatusButton.addActionListener(action -> {
NotificationDescriptor randomItemIncMessage = this.testEngine.getRandomItemIncMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class TestEngine {
private Random random = new Random();
private String poeTradeTemplate = "%s: Hi, I would like to buy your %s listed for %d %s in %s (stash tab \"%d\"; position: left %d, top %d) %s";
private String currencyTemplate = "%s: Hi, I'd like to buy your %d %s for my %d %s in %s. %s";
private String currencyMapBulkTemplate = "%s: Hi, I'd like to buy your %s for my %d %s in %s. %s";

public TestEngine() {
this.messageBuilder.setChunkStrings(Arrays.asList("Hi", "buy", "listed", "like"));
Expand Down Expand Up @@ -259,4 +260,17 @@ private List<PlainMessageDescriptor> getChatHistory() {
return list;
}

public NotificationDescriptor getRandomMapBulkMessage() {
NotificationDescriptor notificationDescriptor = parser.parse(String.format(currencyMapBulkTemplate,
nickNames.get(random.nextInt(nickNames.size())),
"1 Ivory Temple Map (T12), 1 Lava Lake Map (T15), 1 Zana's Precinct Map (T6) & 1 Burial Chambers Map (T11)",
random.nextInt(1500) + 1,
currency.get(random.nextInt(currency.size())),
leagues.get(random.nextInt(leagues.size())),
offer.get(random.nextInt(offer.size()))
));
notificationDescriptor.setRelatedMessages(this.getChatHistory());
return notificationDescriptor;
}

}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions app-ui/src/main/resources/notes/patch/patch-notes.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"version": "1.0.3.3.0",
"version": "1.0.3.4.0",
"notes":[
{
"title": "Update",
"text": "Hi, sorry for the long absence.\n\n- Fix critical bug when sometimes MT hangs on boot.\n- Fixed a bug when notification panel doesn't show up after altabing.\n- Now notification panel works with german POE client.\n- Support tab updated.\n\nDon't forget to support the app, we really appreciate it! Thanks!",
"text": "- New feature: Syndicate rewards matrix overlay (see in taskbar) + hotkey (settings -> taskbar). Thanks @Etuldan for contributing.\n- Added support for buying bulk maps from one seller in poeapp.com\n- Fix notification panel layout when buying/selling maps from poe trade/poeapp\n- Added some new icons for currencies.\n\nHappy holidays! Don't forget to support the app. Thanks!",
"image" : "",
"layout" : "VERTICAL"
}
Expand Down

0 comments on commit fd544e5

Please sign in to comment.