Skip to content

Commit

Permalink
added whois to scanner panel
Browse files Browse the repository at this point in the history
  • Loading branch information
Exslims committed Jan 22, 2018
1 parent 3ff01c0 commit a618c8a
Show file tree
Hide file tree
Showing 10 changed files with 189 additions and 2 deletions.
124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public PlainMessageInterceptor() {
this.clients.add(new ArabicOutLocalizationMatcher());
this.clients.add(new BZIncLocalizationMatcher());
this.clients.add(new BZOutLocalizationMatcher());
this.clients.add(new FrenchIncLocalizationMatcher());
this.clients.add(new FrenchOutLocalizationMatcher());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public TradeIncMessagesInterceptor() {
this.clients.add(new RuIncLocalizationMatcher());
this.clients.add(new ArabicInLocalizationMatcher());
this.clients.add(new BZIncLocalizationMatcher());
this.clients.add(new FrenchIncLocalizationMatcher());
}

@Override
Expand Down Expand Up @@ -113,4 +114,16 @@ public String trimString(String src) {
return StringUtils.substringAfter(src, "@De");
}
}

private class FrenchIncLocalizationMatcher extends LocalizationMatcher {
@Override
public boolean isSuitableFor(String message) {
return message.contains("@De") && super.isSuitableFor(message);
}

@Override
public String trimString(String src) {
return StringUtils.substringAfter(src, "@De");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public TradeOutMessagesInterceptor() {
this.clients.add(new RuOutLocalizationMatcher());
this.clients.add(new ArabicOutLocalizationMatcher());
this.clients.add(new BZOutLocalizationMatcher());
this.clients.add(new FrenchOutLocalizationMatcher());
}

@Override
Expand Down Expand Up @@ -159,4 +160,27 @@ public NotificationDescriptor getDescriptor(String message) {
return descriptor;
}
}

private class FrenchOutLocalizationMatcher extends LocalizationMatcher {
@Override
public boolean isSuitableFor(String message) {
return message.contains("@À") && super.isSuitableFor(message);
}

@Override
public String trimString(String src) {
return StringUtils.substringAfter(src, "@À");
}

@Override
public NotificationDescriptor getDescriptor(String message) {
NotificationDescriptor descriptor = messageParser.parse(this.trimString(message));
if (descriptor instanceof ItemTradeNotificationDescriptor) {
descriptor.setType(NotificationType.OUT_ITEM_MESSAGE);
} else {
descriptor.setType(NotificationType.OUT_CURRENCY_MESSAGE);
}
return descriptor;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ public void validate() {
this.selectedProfile.getHotkeysSettingsDescriptor()
.getOutNHotKeysList().add(new HotKeyPair(HotKeyType.N_WHO_IS, new HotKeyDescriptor()));
}

if (this.selectedProfile.getHotkeysSettingsDescriptor()
.getScannerNHotKeysList().stream()
.filter(it -> it.getType().equals(HotKeyType.N_WHO_IS))
.findAny().orElse(null) == null) {
this.selectedProfile.getHotkeysSettingsDescriptor()
.getScannerNHotKeysList().add(new HotKeyPair(HotKeyType.N_WHO_IS, new HotKeyDescriptor()));
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ private JPanel getHeader() {
});
JButton openChatButton = componentsFactory.getIconButton("app/openChat.png", 15, AppThemeColor.MSG_HEADER, TooltipConstants.OPEN_CHAT);
openChatButton.addActionListener(e -> this.controller.performOpenChat());
JButton whoIsButton = componentsFactory.getIconButton("app/who-is.png", 15, AppThemeColor.MSG_HEADER, TooltipConstants.WHO_IS);
whoIsButton.addActionListener(e -> controller.performWhoIs());
JButton hideButton = componentsFactory.getIconButton("app/close.png", 15, AppThemeColor.MSG_HEADER, TooltipConstants.HIDE_PANEL);
hideButton.addActionListener(action -> {
this.controller.performHide();
Expand All @@ -85,6 +87,7 @@ private JPanel getHeader() {
interactionPanel.add(visiteHideout);
interactionPanel.add(tradeButton);
interactionPanel.add(leaveButton);
interactionPanel.add(whoIsButton);
interactionPanel.add(openChatButton);
interactionPanel.add(hideButton);

Expand All @@ -93,6 +96,7 @@ private JPanel getHeader() {
this.interactButtonMap.put(HotKeyType.N_VISITE_HIDEOUT, visiteHideout);
this.interactButtonMap.put(HotKeyType.N_TRADE_PLAYER, tradeButton);
this.interactButtonMap.put(HotKeyType.N_LEAVE, leaveButton);
this.interactButtonMap.put(HotKeyType.N_WHO_IS, whoIsButton);
this.interactButtonMap.put(HotKeyType.N_OPEN_CHAT, openChatButton);
this.interactButtonMap.put(HotKeyType.N_CLOSE_NOTIFICATION, hideButton);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ public void performLeave(String nickName) {
MercuryStoreCore.chatCommandSubject.onNext("/kick " + nickName);
}

@Override
public void performWhoIs() {
MercuryStoreCore.chatCommandSubject.onNext("/whois " + notificationDescriptor.getNickName());
}

@Override
public void performOfferTrade() {
MercuryStoreCore.chatCommandSubject.onNext("/tradewith " + notificationDescriptor.getNickName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ public interface ScannerPanelController extends NotificationController {
void performInvite();

void performLeave(String nickName);

void performWhoIs();
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,9 @@ public void performInvite() {
public void performLeave(String nickName) {

}

@Override
public void performWhoIs() {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ private JPanel getOperationsButtons() {
JButton openTests = this.getOperationButton("Open tests", "app/open-tests.png");
openTests.addActionListener(action -> {
FramesManager.INSTANCE.hideFrame(SettingsFrame.class);
// FramesManager.INSTANCE.showFrame(TestCasesFrame.class);
FramesManager.INSTANCE.preShowFrame(TestCasesFrame.class);
FramesManager.INSTANCE.showFrame(TestCasesFrame.class);
// FramesManager.INSTANCE.preShowFrame(TestCasesFrame.class);
});
root.add(this.componentsFactory.wrapToSlide(openTutorial));
root.add(this.componentsFactory.wrapToSlide(checkUpdates));
Expand Down

0 comments on commit a618c8a

Please sign in to comment.