@@ -17,16 +17,19 @@ public class MessageParser {
1717 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*?(.*))$" ;
1818 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*?(.*))$" ;
1919 private final static String poeCurrencyPattern = "^(.*\\ s)?(.+): (.+ to buy your (\\ d+(\\ .\\ d+)?)? (.+) for my (\\ d+(\\ .\\ d+)?)? (.+) in (.*?)\\ .\\ s*(.*))$" ;
20+ private final static String poeMapLiveRegex = "^(.*\\ s)?(.+): (I'd like to exchange my (T\\ d+:\\ s\\ ([\\ s\\ S,]+) for your (T\\ d+:\\ s\\ ([\\ S,\\ s]+) in\\ s+?(.+?)\\ .)" ;
2021 private Pattern poeAppItemPattern ;
2122 private Pattern poeTradeStashItemPattern ;
2223 private Pattern poeTradeItemPattern ;
2324 private Pattern poeTradeCurrencyPattern ;
25+ private Pattern poeMapLivePattern ;
2426
2527 public MessageParser () {
2628 this .poeAppItemPattern = Pattern .compile (poeAppPattern );
2729 this .poeTradeStashItemPattern = Pattern .compile (poeTradeStashTabPattern );
2830 this .poeTradeItemPattern = Pattern .compile (poeTradePattern );
2931 this .poeTradeCurrencyPattern = Pattern .compile (poeCurrencyPattern );
32+ this .poeMapLivePattern = Pattern .compile (poeMapLiveRegex );
3033 }
3134
3235 public NotificationDescriptor parse (String fullMessage ) {
@@ -112,6 +115,20 @@ public NotificationDescriptor parse(String fullMessage) {
112115 tradeNotification .setType (NotificationType .INC_ITEM_MESSAGE );
113116 return tradeNotification ;
114117 }
118+ Matcher poeTradeMapLiveMatcher = poeMapLivePattern .matcher (fullMessage );
119+ if (poeTradeMapLiveMatcher .find ()) {
120+ ItemTradeNotificationDescriptor tradeNotification = new ItemTradeNotificationDescriptor ();
121+ tradeNotification .setWhisperNickname (poeTradeMapLiveMatcher .group (2 ));
122+ tradeNotification .setSourceString (poeTradeMapLiveMatcher .group (3 ));
123+ tradeNotification .setItemName (poeTradeMapLiveMatcher .group (5 ));
124+ tradeNotification .setOffer (poeTradeMapLiveMatcher .group (4 ));
125+ tradeNotification .setLeague (poeTradeMapLiveMatcher .group (6 ));
126+ tradeNotification .setType (NotificationType .INC_ITEM_MESSAGE );
127+ tradeNotification .setCurCount (0d );
128+ tradeNotification .setCurrency ("" );
129+ tradeNotification .setType (NotificationType .INC_ITEM_MESSAGE );
130+ return tradeNotification ;
131+ }
115132 return null ;
116133 }
117134}
0 commit comments