diff --git a/src/app/shared/module/poe/trade/chat/trade-chat-parser.service.ts b/src/app/shared/module/poe/trade/chat/trade-chat-parser.service.ts index dda2a114..fcf1705b 100644 --- a/src/app/shared/module/poe/trade/chat/trade-chat-parser.service.ts +++ b/src/app/shared/module/poe/trade/chat/trade-chat-parser.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { Asset, AssetService } from '@app/assets'; -import { TradeBulkMessage, TradeItemMessage, TradeMapMessage, TradeParserBase, TradeParserType, TradePlayerJoinedArea, TradeWhisperDirection } from './trade-chat'; +import { TradeBulkMessage, TradeItemMessage, TradeMapMessage, TradeParserBase, TradeParserType, TradePlayerJoinedArea, TradeWhisperDirection, TradeMessage } from './trade-chat'; interface TradeRegexs { JoinedArea: { @@ -38,6 +38,7 @@ export class TradeChatParserService { if (regexResult) { const direction = regexResult.groups.from ? TradeWhisperDirection.Incoming : TradeWhisperDirection.Outgoing; const player = regexResult.groups.player; + const message = regexResult.groups.message; regexResult = null; let regexArray = Object.values(this.regexs.TradeItemPrice); @@ -70,6 +71,10 @@ export class TradeChatParserService { if (regexResult) { return this.mapMapMessage(player, direction, regexResult); } + else + { + return this.mapWhisperMessage(player, direction, message); + } } } else { const playerJoinedArea = this.parseJoinedArea(line); @@ -81,6 +86,16 @@ export class TradeChatParserService { return { type: TradeParserType.Ignored }; } + private mapWhisperMessage(player: string, direction: TradeWhisperDirection, message: string): TradeMessage { + return { + type: TradeParserType.Whisper, + name: player, + direction, + timeReceived: new Date(), + message + }; + } + private mapMapMessage(player: string, direction: TradeWhisperDirection, result: RegExpExecArray): TradeMapMessage { const { groups } = result; return { diff --git a/src/assets/poe/data/trade-regex.json b/src/assets/poe/data/trade-regex.json index e2f97c01..2dd0a648 100644 --- a/src/assets/poe/data/trade-regex.json +++ b/src/assets/poe/data/trade-regex.json @@ -10,7 +10,7 @@ "Korean": ": (?.*?) 님이 지역에 들어왔습니다" }, "Whisper": { - "Universal": "@((?from|de|von|от кого|จาก)|(?to|à|an|para|кому|ถึง)) (<.*?> )*(?.*?):" + "Universal": "@((?from|de|von|от кого|จาก)|(?to|à|an|para|кому|ถึง)) (<.*?> )*(?.*?):(?.*)" }, "TradeItemPrice": { "English": "(((Hi, )?I would like to buy your)|wtb) (?.*) listed for (?\\d*([.|,]\\d*)?) (?.*) in (?.*) \\(stash( tab)? \"(?.*)\";( position:)? left (?\\d*), top (?\\d*)\\)(?.*)?",