From 15f81d0a69e8472dca1cfdd4365eb02db3514255 Mon Sep 17 00:00:00 2001 From: Nicklas Ronge Date: Sun, 14 Jun 2020 17:45:58 +0200 Subject: [PATCH] - added stash highlight for trades --- CHANGELOG.md | 4 +- overlay.babel | 53 ++++++++ src/app/core/helper/index.ts | 1 + src/app/core/helper/roman.ts | 34 +++++ .../settings-window.component.ts | 2 +- .../trade-message-bulk.component.html | 12 +- .../trade-message-bulk.component.ts | 32 +++-- .../trade-message-item.component.html | 14 +- .../trade-message-map.component.html | 4 +- .../trade-message-map.component.ts | 21 +-- .../trade-message.component.html | 12 +- .../trade-message.component.scss | 50 +++++-- .../trade-message/trade-message.component.ts | 67 ++++++--- .../service/trade-highlight-window.service.ts | 11 +- .../trade/service/trade-window.service.ts | 127 ------------------ .../modules/trade/service/trade.service.ts | 4 +- src/app/modules/trade/trade.module.ts | 2 +- .../trade-highlight-window.component.html | 19 ++- .../trade-highlight-window.component.scss | 30 ++++- .../trade-highlight-window.component.ts | 6 + .../component/header/header.component.html | 5 +- .../shared/module/poe/chat/chat.service.ts | 37 ++--- .../background/background.component.html | 2 +- .../background/background.component.scss | 6 + .../common/background/background.component.ts | 7 +- .../trade/chat/trade-chat-parser.service.ts | 19 +-- .../module/poe/trade/chat/trade-chat.ts | 6 +- src/assets/i18n/english.json | 1 + src/assets/i18n/french.json | 1 + src/assets/i18n/german.json | 1 + src/assets/i18n/korean.json | 1 + src/assets/i18n/polish.json | 1 + src/assets/i18n/portuguese.json | 1 + src/assets/i18n/russian.json | 1 + src/assets/i18n/simplified-chinese.json | 1 + src/assets/i18n/spanish.json | 1 + src/assets/i18n/thai.json | 1 + src/assets/i18n/traditional-chinese.json | 1 + 38 files changed, 353 insertions(+), 245 deletions(-) create mode 100644 src/app/core/helper/index.ts create mode 100644 src/app/core/helper/roman.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 90003f4e..a24898cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,10 +5,10 @@ - added misc module - stash highlight on `alt+f` - added trade module - - support for poe.app, poemap.live, poetrade, official trade + - support for poe.app, poemap.live, poe.trade, official trade - view incoming/ outgoing trades - invite/ trade player - - highlight item in stash + - highlight items in stash - fixed a first time launching error occuring if the GGG API could not be reached ## 1.0.0 (2020-06-10) diff --git a/overlay.babel b/overlay.babel index 260e2abf..f7272722 100644 --- a/overlay.babel +++ b/overlay.babel @@ -13956,6 +13956,59 @@ + + no-price + false + + + + + + de-DE + false + + + en-US + false + + + es-ES + false + + + fr-FR + false + + + ko-KR + false + + + pl-PL + false + + + pt-BR + false + + + ru-RU + false + + + th-TH + false + + + zh-CHS + false + + + zh-CHT + false + + + not-found false diff --git a/src/app/core/helper/index.ts b/src/app/core/helper/index.ts new file mode 100644 index 00000000..75b11dcc --- /dev/null +++ b/src/app/core/helper/index.ts @@ -0,0 +1 @@ +export * from './roman'; diff --git a/src/app/core/helper/roman.ts b/src/app/core/helper/roman.ts new file mode 100644 index 00000000..4942160f --- /dev/null +++ b/src/app/core/helper/roman.ts @@ -0,0 +1,34 @@ +/* https://github.com/joshleaves/roman-numerals/ */ +export class Roman { + public static toArabic(input: string): number { + const roman = input.toUpperCase().match(/^(M{0,3})(CM|DC{0,3}|CD|C{0,3})(XC|LX{0,3}|XL|X{0,3})(IX|VI{0,3}|IV|I{0,3})$/); + if (!roman) { + throw new Error('toArabic expects a valid roman number'); + } + + let arabic = 0; + arabic += roman[1].length * 1000; + if (roman[2] === 'CM') { + arabic += 900; + } else if (roman[2] === 'CD') { + arabic += 400; + } else { + arabic += roman[2].length * 100 + (roman[2][0] === 'D' ? 400 : 0); + } + if (roman[3] === 'XC') { + arabic += 90; + } else if (roman[3] === 'XL') { + arabic += 40; + } else { + arabic += roman[3].length * 10 + (roman[3][0] === 'L' ? 40 : 0); + } + if (roman[4] === 'IX') { + arabic += 9; + } else if (roman[4] === 'IV') { + arabic += 4; + } else { + arabic += roman[4].length * 1 + (roman[4][0] === 'V' ? 4 : 0); + } + return arabic; + } +} diff --git a/src/app/layout/window/settings-window/settings-window.component.ts b/src/app/layout/window/settings-window/settings-window.component.ts index dce2d714..3b0e0cca 100644 --- a/src/app/layout/window/settings-window/settings-window.component.ts +++ b/src/app/layout/window/settings-window/settings-window.component.ts @@ -37,7 +37,7 @@ export class SettingsWindowComponent implements OnInit, AfterViewInit, OnDestroy this.settings$ = this.settings.get(); this.features = this.modules.map(x => x.getConfig()); this.queueSubscription = this.settingsQueue.pipe( - throttleTime(500), + throttleTime(500, undefined, { trailing: true, leading: false }), flatMap(settings => this.settings.put(settings)) ).subscribe(); this.dataSubscription = this.window.data$.on(({ activeFeature }) => { diff --git a/src/app/modules/trade/component/trade-message-bulk/trade-message-bulk.component.html b/src/app/modules/trade/component/trade-message-bulk/trade-message-bulk.component.html index a9aa0002..3e8977d9 100644 --- a/src/app/modules/trade/component/trade-message-bulk/trade-message-bulk.component.html +++ b/src/app/modules/trade/component/trade-message-bulk/trade-message-bulk.component.html @@ -1,24 +1,24 @@
- +
- +  ≈  - +
- +
- +  ≈  - +
diff --git a/src/app/modules/trade/component/trade-message-bulk/trade-message-bulk.component.ts b/src/app/modules/trade/component/trade-message-bulk/trade-message-bulk.component.ts index b3e7c78f..b20547ce 100644 --- a/src/app/modules/trade/component/trade-message-bulk/trade-message-bulk.component.ts +++ b/src/app/modules/trade/component/trade-message-bulk/trade-message-bulk.component.ts @@ -8,22 +8,30 @@ import { TradeBulkMessage, TradeWhisperDirection } from '@shared/module/poe/trad changeDetection: ChangeDetectionStrategy.OnPush }) export class TradeMessageBulkComponent { - private _message: TradeBulkMessage; + @Input() + public type1: string; - public get message(): TradeBulkMessage { - return this._message; - } + @Input() + public type2: string; + + @Input() + public count1: number; + + @Input() + public count2: number; @Input() public set message(message: TradeBulkMessage) { - this._message = JSON.parse(JSON.stringify(message)); - if (this._message.direction === TradeWhisperDirection.Outgoing) { - const count = this._message.count1; - this._message.count1 = this._message.count2; - this._message.count2 = count; - const type = this._message.type1; - this._message.type1 = this._message.type2; - this._message.type2 = type; + if (message.direction === TradeWhisperDirection.Outgoing) { + this.count1 = message.count2; + this.count2 = message.count1; + this.type1 = message.type2; + this.type2 = message.type1; + } else { + this.count1 = message.count1; + this.count2 = message.count2; + this.type1 = message.type1; + this.type2 = message.type2; } } } diff --git a/src/app/modules/trade/component/trade-message-item/trade-message-item.component.html b/src/app/modules/trade/component/trade-message-item/trade-message-item.component.html index 5f5175c4..b6210745 100644 --- a/src/app/modules/trade/component/trade-message-item/trade-message-item.component.html +++ b/src/app/modules/trade/component/trade-message-item/trade-message-item.component.html @@ -1,8 +1,14 @@
-
{{message.itemName | truncateText: 20}}
+
{{message.itemName | truncateText: 18}}
-
- - +
+ + + + + + {{'trade.no-price' | translate}} +
\ No newline at end of file diff --git a/src/app/modules/trade/component/trade-message-map/trade-message-map.component.html b/src/app/modules/trade/component/trade-message-map/trade-message-map.component.html index ee2861be..f461a033 100644 --- a/src/app/modules/trade/component/trade-message-map/trade-message-map.component.html +++ b/src/app/modules/trade/component/trade-message-map/trade-message-map.component.html @@ -1,5 +1,5 @@
- + - +
\ No newline at end of file diff --git a/src/app/modules/trade/component/trade-message-map/trade-message-map.component.ts b/src/app/modules/trade/component/trade-message-map/trade-message-map.component.ts index 3266df31..bd3ba47b 100644 --- a/src/app/modules/trade/component/trade-message-map/trade-message-map.component.ts +++ b/src/app/modules/trade/component/trade-message-map/trade-message-map.component.ts @@ -1,5 +1,5 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; -import { TradeMapMessage, TradeWhisperDirection } from '@shared/module/poe/trade/chat'; +import { TradeMapList, TradeMapMessage, TradeWhisperDirection } from '@shared/module/poe/trade/chat'; @Component({ selector: 'app-trade-message-map', @@ -8,19 +8,20 @@ import { TradeMapMessage, TradeWhisperDirection } from '@shared/module/poe/trade changeDetection: ChangeDetectionStrategy.OnPush }) export class TradeMessageMapComponent { - private _message: TradeMapMessage; + @Input() + public maps1: TradeMapList; - public get message(): TradeMapMessage { - return this._message; - } + @Input() + public maps2: TradeMapList; @Input() public set message(message: TradeMapMessage) { - this._message = JSON.parse(JSON.stringify(message)); - if (this._message.direction === TradeWhisperDirection.Outgoing) { - const maps = this._message.maps1; - this._message.maps1 = this._message.maps2; - this._message.maps2 = maps; + if (message.direction === TradeWhisperDirection.Outgoing) { + this.maps1 = message.maps1; + this.maps2 = message.maps2; + } else { + this.maps1 = message.maps2; + this.maps2 = message.maps1; } } } diff --git a/src/app/modules/trade/component/trade-message/trade-message.component.html b/src/app/modules/trade/component/trade-message/trade-message.component.html index d1853c1d..055289a0 100644 --- a/src/app/modules/trade/component/trade-message/trade-message.component.html +++ b/src/app/modules/trade/component/trade-message/trade-message.component.html @@ -1,6 +1,9 @@ -
+
+
+ pan_tool +
@@ -8,7 +11,7 @@
Could not match message type: {{message.type}}
-
+
@@ -18,7 +21,8 @@ - { + this.toggle$.next([ + 'Hideout', + 'Refúgio', + 'убежище', + 'Hideout', + 'Versteck', + 'Repaire', + 'Guarida', + '은신처에', + ].some(x => context.zone.includes(x))); + }); } else { + this.toggle$.next(true); this.visible[TradeMessageAction.Resend] = true; this.visible[TradeMessageAction.Finished] = true; - // this.visible[TradeMessageAction.ItemHighlight] = type === TradeParserType.TradeMap; + this.visible[TradeMessageAction.ItemHighlight] = this.message.type === TradeParserType.TradeMap; } } @@ -55,6 +75,11 @@ export class TradeMessageComponent implements OnInit { this.close(); } + public onWait(event: MouseEvent): void { + event.stopPropagation(); + this.onActionExecute(TradeMessageAction.Wait); + } + public onActionExecute(action: TradeMessageAction): void { this.activated[action] = true; @@ -115,21 +140,33 @@ export class TradeMessageComponent implements OnInit { case TradeParserType.TradeItem: { const message = this.message as TradeItemMessage; - this.highlight.toggle({ + this.highlight.restore({ left: message.left, top: message.top, stash: message.stash, - items: [message.itemName] + items: [{ name: message.itemName }] }).subscribe(); } break; + case TradeParserType.TradeBulk: + { + const message = this.message as TradeBulkMessage; + this.highlight.restore({ items: [{ name: message.type1 }] }).subscribe(); + } + break; case TradeParserType.TradeMap: { const message = this.message as TradeMapMessage; - this.highlight.toggle({ - items: message.direction === TradeWhisperDirection.Incoming - ? message.maps1.maps - : message.maps2.maps + const maps = message.direction === TradeWhisperDirection.Incoming + ? message.maps2 + : message.maps1; + this.highlight.restore({ + items: maps.maps.map(x => { + return { + name: `${maps.tier}: ${x}`, + value: `${x} tier:${Roman.toArabic(maps.tier)}` + }; + }) }).subscribe(); } break; @@ -163,8 +200,8 @@ export class TradeMessageComponent implements OnInit { } } - private createMessageContext(): Observable { - const context = { + private createMessageContext(): Observable { + const context: MessageContext = { zone: 'unknown', itemname: 'unknown', price: 'unknown' @@ -190,8 +227,8 @@ export class TradeMessageComponent implements OnInit { case TradeParserType.TradeMap: { const message = this.message as TradeMapMessage; - context.itemname = message.maps1.maps.join(', '); - context.price = message.maps2.maps.join(', '); + context.itemname = `${message.maps2.tier}: (${message.maps2.maps.join(', ')})`; + context.price = `${message.maps1.tier}: (${message.maps1.maps.join(', ')})`; } break; } diff --git a/src/app/modules/trade/service/trade-highlight-window.service.ts b/src/app/modules/trade/service/trade-highlight-window.service.ts index 0d8a7e90..95f15a06 100644 --- a/src/app/modules/trade/service/trade-highlight-window.service.ts +++ b/src/app/modules/trade/service/trade-highlight-window.service.ts @@ -9,11 +9,16 @@ import { flatMap } from 'rxjs/operators'; const WINDOW_DATA_KEY = 'TRADE_HIGHLIGHT_WINDOW_DATA'; +export interface TradeHighlightItem { + name: string; + value?: string; +} + export interface TradeHighlightWindowData { top?: number; left?: number; stash?: string; - items: string[]; + items: TradeHighlightItem[]; gridTop?: number; gridSize?: number; } @@ -34,7 +39,7 @@ export class TradeHighlightWindowService { return this.storage.get(WINDOW_DATA_KEY, () => new EventEmitter()); } - public toggle(data: TradeHighlightWindowData): Observable { + public restore(data: TradeHighlightWindowData): Observable { return OWGames.getRunningGameInfo().pipe( flatMap(({ height }) => { const width = this.poeWindow.calculateWidth(height); @@ -53,7 +58,7 @@ export class TradeHighlightWindowService { } this.data$.next(data); - return this.window.toggle().pipe( + return this.window.restore().pipe( flatMap(() => this.window.changeSize(width, height).pipe( flatMap(() => this.window.changePosition(0, 0)) )) diff --git a/src/app/modules/trade/service/trade-window.service.ts b/src/app/modules/trade/service/trade-window.service.ts index 38d15364..d9c08272 100644 --- a/src/app/modules/trade/service/trade-window.service.ts +++ b/src/app/modules/trade/service/trade-window.service.ts @@ -9,133 +9,6 @@ import { TradeFeatureSettings } from '../trade-feature-settings'; const WINDOW_DATA_KEY = 'TRADE_WINDOW_DATA'; -// messages: [ -// { -// type: TradeParserType.TradeItem, -// direction: TradeWhisperDirection.Incoming, -// timeReceived: new Date(), -// name: 'Hyve747', -// message: 'Hi, I would like to buy your Rusted Sulphite Scarab listed for 2.5 chaos in Delirium (stash tab "C"; position: left 47, top 1) Offer 2c', -// league: 'Delirium', -// whispers: [{ -// message: 'Offer 2c', -// timeReceived: new Date() -// }], -// itemName: 'Rusted Sulphite Scarab', -// left: 22, -// top: 1, -// stash: 'C', -// currencyType: 'chaos', -// price: 2.5 -// } as TradeItemMessage, -// { -// type: TradeParserType.TradeItem, -// direction: TradeWhisperDirection.Outgoing, -// timeReceived: new Date(), -// name: 'Hyve747', -// message: 'Hi, I would like to buy your Rusted Sulphite Scarab listed for 2.5 chaos in Delirium (stash tab "C"; position: left 47, top 1) Offer 2c', -// league: 'Delirium', -// whispers: [{ -// message: 'Offer 2c', -// timeReceived: new Date() -// }], -// itemName: 'Rusted Sulphite Scarab', -// left: 22, -// top: 1, -// stash: 'C', -// currencyType: 'chaos', -// price: 2.5, -// } as TradeItemMessage, -// { -// type: TradeParserType.TradeBulk, -// direction: TradeWhisperDirection.Incoming, -// timeReceived: new Date(), -// name: 'Hyve747', -// message: 'Hi, I\'d like to buy your 1 Rusted Sulphite Scarab for my 2.5 Chaos Orb in Delirium. TEST', -// league: 'Delirium', -// whispers: [{ -// message: 'Offer 2c', -// timeReceived: new Date() -// }], -// count1: 1, -// type1: 'Rusted Sulphite Scarab', -// count2: 2.5, -// type2: 'Chaos Orb', -// } as TradeBulkMessage, -// { -// type: TradeParserType.TradeBulk, -// direction: TradeWhisperDirection.Outgoing, -// timeReceived: new Date(), -// name: 'Hyve747', -// message: 'Hi, I\'d like to buy your 1 Rusted Sulphite Scarab for my 2.5 Chaos Orb in Delirium. TEST', -// league: 'Delirium', -// whispers: [{ -// message: 'Offer 2c', -// timeReceived: new Date() -// }], -// count1: 1, -// type1: 'Rusted Sulphite Scarab', -// count2: 2.5, -// type2: 'Chaos Orb', -// } as TradeBulkMessage, -// { -// type: TradeParserType.TradeMap, -// direction: TradeWhisperDirection.Incoming, -// timeReceived: new Date(), -// name: 'Hyve747', -// message: 'I\'d like to exchange my XIV: (Sulphur Vents Map) for your XIV: (Iceberg Map, Glacier Map, Volcano Map, Wharf Map, Laboratory Map, Museum Map, Wasteland Map) in Delirium.', -// league: 'Delirium', -// whispers: [{ -// message: 'Offer 2c', -// timeReceived: new Date() -// }], -// maps1: { -// tier: 'XIV', -// maps: ['Sulphur Vents Map'] -// } as TradeMapList, -// maps2: { -// tier: 'XIV', -// maps: [ -// 'Iceberg Map', -// 'Glacier Map', -// 'Volcano Map', -// 'Wharf Map', -// 'Laboratory Map', -// 'Museum Map', -// 'Wasteland Map' -// ] -// } as TradeMapList, -// } as TradeMapMessage, -// { -// type: TradeParserType.TradeMap, -// direction: TradeWhisperDirection.Outgoing, -// timeReceived: new Date(), -// name: 'Hyve747', -// message: 'I\'d like to exchange my XIV: (Sulphur Vents Map) for your XIV: (Iceberg Map, Glacier Map, Volcano Map, Wharf Map, Laboratory Map, Museum Map, Wasteland Map) in Delirium.', -// league: 'Delirium', -// whispers: [{ -// message: 'Offer 2c', -// timeReceived: new Date() -// }], -// maps1: { -// tier: 'XIV', -// maps: ['Sulphur Vents Map'] -// } as TradeMapList, -// maps2: { -// tier: 'XIV', -// maps: [ -// 'Iceberg Map', -// 'Glacier Map', -// 'Volcano Map', -// 'Wharf Map', -// 'Laboratory Map', -// 'Museum Map', -// 'Wasteland Map' -// ] -// } as TradeMapList, -// } as TradeMapMessage -// ], - export interface TradeWindowData { // only modified by the background window messages: TradeExchangeMessage[]; diff --git a/src/app/modules/trade/service/trade.service.ts b/src/app/modules/trade/service/trade.service.ts index b0bee289..e39500a3 100644 --- a/src/app/modules/trade/service/trade.service.ts +++ b/src/app/modules/trade/service/trade.service.ts @@ -65,7 +65,7 @@ export class TradeService { let shouldUpdate = false; for (const message of messages) { if (message.name === whisper.name) { - message.whispers.push(whisper); + message.whispers$.next([...message.whispers$.value, whisper]); shouldUpdate = true; } } @@ -76,7 +76,7 @@ export class TradeService { let shouldUpdate = false; for (const message of messages) { if (message.name === name) { - message.joined = true; + message.joined$.next(true); shouldUpdate = true; } } diff --git a/src/app/modules/trade/trade.module.ts b/src/app/modules/trade/trade.module.ts index defefaf5..88371091 100644 --- a/src/app/modules/trade/trade.module.ts +++ b/src/app/modules/trade/trade.module.ts @@ -43,7 +43,7 @@ export class TradeModule implements FeatureModule { tradeEnabled: true, tradeMessageWait: 'Currently in @zone. Do you want to wait until finished?', tradeMessageStillInterested: 'Do you still want @itemname for @price?', - tradeMessageItemGone: 'Sorry, @itemname already sold. Good luck on your search.', + tradeMessageItemGone: 'Sorry, @itemname already gone. Good luck on your search.', tradeMessageThanks: 'Thank you for the trade. Have a nice day and good luck.', tradeStashFactor: {}, tradeWindowPinned: false diff --git a/src/app/modules/trade/window/trade-highlight-window/trade-highlight-window.component.html b/src/app/modules/trade/window/trade-highlight-window/trade-highlight-window.component.html index c7af5ead..b152f50e 100644 --- a/src/app/modules/trade/window/trade-highlight-window/trade-highlight-window.component.html +++ b/src/app/modules/trade/window/trade-highlight-window/trade-highlight-window.component.html @@ -1,6 +1,8 @@ - + + + PoE Overlay - Trade Highlight - Stash: {{data.stash || '-'}} + {{factor === 0.5 ? 'grid_on' : 'border_all'}} @@ -10,11 +12,18 @@
-
+
+ +
+
+
{{item.name}}
+
+
+
\ No newline at end of file diff --git a/src/app/modules/trade/window/trade-highlight-window/trade-highlight-window.component.scss b/src/app/modules/trade/window/trade-highlight-window/trade-highlight-window.component.scss index 37b0d30a..9a1ecf30 100644 --- a/src/app/modules/trade/window/trade-highlight-window/trade-highlight-window.component.scss +++ b/src/app/modules/trade/window/trade-highlight-window/trade-highlight-window.component.scss @@ -8,15 +8,39 @@ font-size: 14.3px; font-family: FontinSmallCaps; } - + ::-webkit-scrollbar, ::-webkit-scrollbar-thumb { display: none; } } -app-background { +.background { + position: absolute; display: inline; + max-width: 60vw; +} + +.stash { + color: rgb(50, 205, 50); +} + +.name, +.item { + display: inline-flex; +} + +.item { + flex-direction: row; + line-height: 15px; + background: $black-transparent; + align-items: center; + margin: 1px; + + .name { + padding: $gutter $gutter; + cursor: pointer; + } } .grid { @@ -33,6 +57,6 @@ app-background { .highlight { position: absolute; - border: 2px solid rgba(255, 255, 255, 0.6); + border: 2px solid rgb(50, 205, 50); } } diff --git a/src/app/modules/trade/window/trade-highlight-window/trade-highlight-window.component.ts b/src/app/modules/trade/window/trade-highlight-window/trade-highlight-window.component.ts index 65e1f672..3a8d3515 100644 --- a/src/app/modules/trade/window/trade-highlight-window/trade-highlight-window.component.ts +++ b/src/app/modules/trade/window/trade-highlight-window/trade-highlight-window.component.ts @@ -3,6 +3,7 @@ import { EventSubscription } from '@app/event'; import { FeatureSettingsService } from '@app/feature/feature-settings.service'; import { TradeHighlightWindowData, TradeHighlightWindowService } from '@modules/trade/service'; import { TradeFeatureSettings } from '@modules/trade/trade-feature-settings'; +import { StashService } from '@shared/module/poe/stash'; import { BehaviorSubject } from 'rxjs'; enum TradeStashFactor { @@ -26,6 +27,7 @@ export class TradeHighlightWindowComponent implements OnInit, OnDestroy { constructor( private readonly window: TradeHighlightWindowService, private readonly settings: FeatureSettingsService, + private readonly stash: StashService, private readonly ngZone: NgZone) { } public ngOnInit(): void { @@ -39,6 +41,10 @@ export class TradeHighlightWindowComponent implements OnInit, OnDestroy { this.subscription?.unsubscribe(); } + public onSearch(item: string): void { + this.stash.highlight(item); + } + public onFactorChange(stash?: string): void { this.factor = this.factor === TradeStashFactor.Quad ? TradeStashFactor.Normal : TradeStashFactor.Quad; diff --git a/src/app/shared/module/odk/component/header/header.component.html b/src/app/shared/module/odk/component/header/header.component.html index c28bf79d..f35245c1 100644 --- a/src/app/shared/module/odk/component/header/header.component.html +++ b/src/app/shared/module/odk/component/header/header.component.html @@ -3,7 +3,10 @@
-
{{name}}
+
+ {{name}} + +
close diff --git a/src/app/shared/module/poe/chat/chat.service.ts b/src/app/shared/module/poe/chat/chat.service.ts index ec424e6f..a170f6e7 100644 --- a/src/app/shared/module/poe/chat/chat.service.ts +++ b/src/app/shared/module/poe/chat/chat.service.ts @@ -1,8 +1,7 @@ import { Injectable } from '@angular/core'; import { OWUtils } from '@app/odk/ow-utils'; -import { environment } from '@env/environment'; -import { Observable, of, Subject } from 'rxjs'; -import { concatMap, delay, distinctUntilChanged, filter, flatMap, map, mergeMap, scan, tap, windowTime } from 'rxjs/operators'; +import { of, Subject } from 'rxjs'; +import { concatMap, delay, distinctUntilChanged, flatMap, mergeMap, tap, windowTime } from 'rxjs/operators'; interface ChatEvent { message: string; @@ -30,7 +29,7 @@ export class ChatService { } public trade(name: string): void { - const message = this.generateMessage('/trade', name); + const message = this.generateMessage('/tradewith', name); this.queue$.next({ message, send: true }); } @@ -54,25 +53,17 @@ export class ChatService { mergeMap(event => OWUtils.getFromClipboard().pipe( tap(() => OWUtils.placeOnClipboard(event.message)), delay(10), - flatMap(text => { - const result = of(text); - if (environment.production) { - return result.pipe( - tap(() => OWUtils.sendKeyStroke('Enter')), - delay(10), - tap(() => OWUtils.sendKeyStroke('Ctrl+V')), - delay(10), - tap(() => { - if (event.send) { - OWUtils.sendKeyStroke('Enter'); - } - }), - ); - } else { - console.log('chat', event); - return result; - } - }), + flatMap(text => of(text).pipe( + tap(() => OWUtils.sendKeyStroke('Enter')), + delay(10), + tap(() => OWUtils.sendKeyStroke('Ctrl+V')), + delay(10), + tap(() => { + if (event.send) { + OWUtils.sendKeyStroke('Enter'); + } + }), + )), delay(200), tap(text => OWUtils.placeOnClipboard(text)), delay(10), diff --git a/src/app/shared/module/poe/common/background/background.component.html b/src/app/shared/module/poe/common/background/background.component.html index e6fbb3fa..9cd51365 100644 --- a/src/app/shared/module/poe/common/background/background.component.html +++ b/src/app/shared/module/poe/common/background/background.component.html @@ -1,4 +1,4 @@ -
+
diff --git a/src/app/shared/module/poe/common/background/background.component.scss b/src/app/shared/module/poe/common/background/background.component.scss index 509e8f80..8d6e5c23 100644 --- a/src/app/shared/module/poe/common/background/background.component.scss +++ b/src/app/shared/module/poe/common/background/background.component.scss @@ -11,6 +11,12 @@ background: url(../../../../../../assets/poe/interface/background.jpg); padding: 14px; + &.inline { + display: inline-block; + width: auto; + height: auto; + } + > .bottom, > .top, > .left, diff --git a/src/app/shared/module/poe/common/background/background.component.ts b/src/app/shared/module/poe/common/background/background.component.ts index a5c3fcd5..fad8f0ac 100644 --- a/src/app/shared/module/poe/common/background/background.component.ts +++ b/src/app/shared/module/poe/common/background/background.component.ts @@ -1,4 +1,4 @@ -import { ChangeDetectionStrategy, Component } from '@angular/core'; +import { ChangeDetectionStrategy, Component, Input } from '@angular/core'; @Component({ selector: 'app-background', @@ -6,4 +6,7 @@ import { ChangeDetectionStrategy, Component } from '@angular/core'; styleUrls: ['./background.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush }) -export class BackgroundComponent { } +export class BackgroundComponent { + @Input() + public inline = false; +} 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 d56e39aa..3eddbdc5 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,7 @@ import { Injectable } from '@angular/core'; import { Asset, AssetService } from '@app/assets'; import { TradeBulkMessage, TradeItemMessage, TradeMapMessage, TradeParserBase, TradeParserType, TradePlayerJoinedArea, TradeWhisperDirection, TradeMessage } from './trade-chat'; +import { BehaviorSubject } from 'rxjs'; interface TradeRegexs { JoinedArea: { @@ -101,16 +102,16 @@ export class TradeChatParserService { name: player, direction, timeReceived: new Date(), - whispers: groups.message ? [ + whispers$: new BehaviorSubject(groups.message ? [ { direction, timeReceived: new Date(), message: groups.message.trim() } - ] : [], + ] : []), message: result[0], league: groups.league, - joined: false, + joined$: new BehaviorSubject(false), maps1: { tier: groups.tier1, maps: groups.maps1.split(',').map(x => x.trim()) @@ -129,16 +130,16 @@ export class TradeChatParserService { name: player, direction, timeReceived: new Date(), - whispers: groups.message ? [ + whispers$: new BehaviorSubject(groups.message ? [ { direction, timeReceived: new Date(), message: groups.message.trim() } - ] : [], + ] : []), message: result[0], league: groups.league, - joined: false, + joined$: new BehaviorSubject(false), itemName: groups.name, stash: groups.stash, left: +groups.left, @@ -155,16 +156,16 @@ export class TradeChatParserService { name: player, direction, timeReceived: new Date(), - whispers: groups.message ? [ + whispers$: new BehaviorSubject(groups.message ? [ { direction, timeReceived: new Date(), message: groups.message.trim() } - ] : [], + ] : []), message: result[0], league: groups.league, - joined: false, + joined$: new BehaviorSubject(false), count1: +groups.count, type1: groups.name, count2: +groups.price, diff --git a/src/app/shared/module/poe/trade/chat/trade-chat.ts b/src/app/shared/module/poe/trade/chat/trade-chat.ts index 92e62f62..8c7ce6b2 100644 --- a/src/app/shared/module/poe/trade/chat/trade-chat.ts +++ b/src/app/shared/module/poe/trade/chat/trade-chat.ts @@ -1,3 +1,5 @@ +import { BehaviorSubject } from 'rxjs'; + export enum TradeParserType { Ignored = 'ignored', TradeItem = 'item', @@ -31,9 +33,9 @@ export interface TradeMessage extends TradeParserBase, TradeWhisper { } export interface TradeExchangeMessage extends TradeMessage { - whispers: TradeWhisper[]; + whispers$: BehaviorSubject; league: string; - joined: boolean; + joined$: BehaviorSubject; } export interface TradeItemMessage extends TradeExchangeMessage { diff --git a/src/assets/i18n/english.json b/src/assets/i18n/english.json index 2e5892ba..b38fab54 100644 --- a/src/assets/i18n/english.json +++ b/src/assets/i18n/english.json @@ -404,6 +404,7 @@ "wait": "Wait message" }, "name": "Trade", + "no-price": "No price", "not-found": "No data found.", "search": "Search", "searching": "Searching...", diff --git a/src/assets/i18n/french.json b/src/assets/i18n/french.json index 8c38213c..59c91063 100644 --- a/src/assets/i18n/french.json +++ b/src/assets/i18n/french.json @@ -404,6 +404,7 @@ "wait": "Message d'attente" }, "name": "commerce", + "no-price": "Pas de prix", "not-found": "Aucune donnée disponible.", "search": "Chercher", "searching": "Recherche...", diff --git a/src/assets/i18n/german.json b/src/assets/i18n/german.json index 003478ab..94354021 100644 --- a/src/assets/i18n/german.json +++ b/src/assets/i18n/german.json @@ -404,6 +404,7 @@ "wait": "Warte Nachricht" }, "name": "Handel", + "no-price": "Kein Preis", "not-found": "Keine Daten gefunden.", "search": "Suche", "searching": "Suchen...", diff --git a/src/assets/i18n/korean.json b/src/assets/i18n/korean.json index b48750f2..354487e6 100644 --- a/src/assets/i18n/korean.json +++ b/src/assets/i18n/korean.json @@ -404,6 +404,7 @@ "wait": "대기 메시지" }, "name": "무역", + "no-price": "가격 없음", "not-found": "데이터가 없습니다.", "search": "수색", "searching": "수색...", diff --git a/src/assets/i18n/polish.json b/src/assets/i18n/polish.json index 82eac6ff..96498fbf 100644 --- a/src/assets/i18n/polish.json +++ b/src/assets/i18n/polish.json @@ -404,6 +404,7 @@ "wait": "Wiadomość oczekująca" }, "name": "Handel", + "no-price": "Bez ceny", "not-found": "Nie znaleziono danych.", "search": "Szukaj", "searching": "Szukam...", diff --git a/src/assets/i18n/portuguese.json b/src/assets/i18n/portuguese.json index a75e391a..ca4b69b8 100644 --- a/src/assets/i18n/portuguese.json +++ b/src/assets/i18n/portuguese.json @@ -404,6 +404,7 @@ "wait": "Mensagem de espera" }, "name": "Comércio", + "no-price": "Gratuito", "not-found": "Nenhum dado encontrado.", "search": "Procurar", "searching": "Procurando...", diff --git a/src/assets/i18n/russian.json b/src/assets/i18n/russian.json index d6cc3eb4..e91c040d 100644 --- a/src/assets/i18n/russian.json +++ b/src/assets/i18n/russian.json @@ -404,6 +404,7 @@ "wait": "Ждать сообщения" }, "name": "Сделка", + "no-price": "Нет цены", "not-found": "Данные не найдены.", "search": "Поиск", "searching": "Поиск...", diff --git a/src/assets/i18n/simplified-chinese.json b/src/assets/i18n/simplified-chinese.json index 5c9aca11..50192e7c 100644 --- a/src/assets/i18n/simplified-chinese.json +++ b/src/assets/i18n/simplified-chinese.json @@ -404,6 +404,7 @@ "wait": "等待讯息" }, "name": "贸易", + "no-price": "没有价格", "not-found": "没有找到数据。", "search": "搜索", "searching": "搜索...", diff --git a/src/assets/i18n/spanish.json b/src/assets/i18n/spanish.json index 4885c5c5..f518cb8f 100644 --- a/src/assets/i18n/spanish.json +++ b/src/assets/i18n/spanish.json @@ -404,6 +404,7 @@ "wait": "Mensaje de espera" }, "name": "Comercio", + "no-price": "Sin precio", "not-found": "Datos no encontrados.", "search": "Buscar", "searching": "Buscando...", diff --git a/src/assets/i18n/thai.json b/src/assets/i18n/thai.json index 201e0e8c..02567dde 100644 --- a/src/assets/i18n/thai.json +++ b/src/assets/i18n/thai.json @@ -404,6 +404,7 @@ "wait": "รอข้อความ" }, "name": "ค่า", + "no-price": "ไม่มีราคา", "not-found": "ไม่พบข้อมูล.", "search": "ค้นหา", "searching": "ค้นหา ...", diff --git a/src/assets/i18n/traditional-chinese.json b/src/assets/i18n/traditional-chinese.json index 5b830236..8b380630 100644 --- a/src/assets/i18n/traditional-chinese.json +++ b/src/assets/i18n/traditional-chinese.json @@ -404,6 +404,7 @@ "wait": "等待訊息" }, "name": "貿易", + "no-price": "沒有價格", "not-found": "沒有找到數據。", "search": "搜尋", "searching": "搜尋...",