diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a8b4565..6beb9bf6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 1.0.3 (2020-06-18) + +- fixed a unhandled error if no event data is available + ## 1.0.2 (2020-06-16) - added misc module diff --git a/manifest.json b/manifest.json index 7b4caaac..4e303c88 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "meta": { "name": "PoE Overlay", "author": "Kyusung4698", - "version": "1.0.2", + "version": "1.0.3", "minimum-overwolf-version": "0.147.0", "description": "Search the market and send trade offers. Get current market values for your item. View insights for maps and items.", "dock_button_title": "PoE Overlay", @@ -38,11 +38,11 @@ "transparent": true, "show_in_taskbar": false, "size": { - "width": 1212, + "width": 1242, "height": 699 }, "min_size": { - "width": 1212, + "width": 1242, "height": 699 } }, @@ -180,8 +180,11 @@ "event_data": { "game_ids": [ 7212 - ] + ], + "wait_for_stable_framerate": 30 }, + "tracked": false, + "include_launchers": false, "start_minimized": false } ], diff --git a/package-lock.json b/package-lock.json index 6a7fa0d9..3158b92e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "poe-overlay-overwolf", - "version": "1.0.1", + "version": "1.0.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 06d2ff38..ceb9239c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "poe-overlay-overwolf", - "version": "1.0.2", + "version": "1.0.3", "scripts": { "watch": "ng build --watch", "watch:prod": "ng build --watch --prod", diff --git a/src/app/core/event/event-emitter.ts b/src/app/core/event/event-emitter.ts index fea01c5e..d2356505 100644 --- a/src/app/core/event/event-emitter.ts +++ b/src/app/core/event/event-emitter.ts @@ -21,7 +21,10 @@ export class EventEmitter { public next(event: TEvent): void { Object.getOwnPropertyNames(this.registry).forEach(key => { - this.registry[key](event); + const fn = this.registry[key]; + if (fn) { + fn(event); + } }); this.latest = event; } diff --git a/src/app/layout/window/background-window/background-window.component.ts b/src/app/layout/window/background-window/background-window.component.ts index 5dfbfb81..76d5f59f 100644 --- a/src/app/layout/window/background-window/background-window.component.ts +++ b/src/app/layout/window/background-window/background-window.component.ts @@ -74,7 +74,6 @@ export class BackgroundWindowComponent implements OnInit, OnDestroy { }); }); }); - this.hotkeys.start(); this.game.start(); }); } @@ -118,11 +117,6 @@ export class BackgroundWindowComponent implements OnInit, OnDestroy { this.shouldQuit = false; this.launcherWindow.close(); - const path = info.executionPath.split('/'); - path.pop(); - const log = `${path.join('/')}/logs/Client.txt`; - this.log.start(log); - forkJoin([ this.annotationWindow.open(info.width, info.height), this.notificationWindow.open(info.width, info.height) @@ -135,6 +129,13 @@ export class BackgroundWindowComponent implements OnInit, OnDestroy { module.onInfo(info, settings); } }); + + const path = info.executionPath.split('/'); + path.pop(); + const log = `${path.join('/')}/logs/Client.txt`; + this.log.start(log); + + this.hotkeys.start(); }); if (!result) { this.notification.show('event.start-error'); diff --git a/src/app/modules/commands/service/command.service.ts b/src/app/modules/commands/service/command.service.ts index 6d7e2837..ae8c329b 100644 --- a/src/app/modules/commands/service/command.service.ts +++ b/src/app/modules/commands/service/command.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { ChatService } from '@shared/module/poe/chat'; import { EventService } from '@shared/module/poe/event'; -import { Observable } from 'rxjs'; +import { Observable, of } from 'rxjs'; import { map, tap } from 'rxjs/operators'; @Injectable({ @@ -14,15 +14,18 @@ export class CommandService { private readonly event: EventService) { } public execute(command: string): Observable { - // TODO: Error handling - return this.event.getCharacter().pipe( - tap(character => { - if (character?.name.length) { - command = command.replace('@char', character.name); - } - this.chat.send(command); - }), - map(() => null) - ); + if (command.includes('@char')) { + return this.event.getCharacter().pipe( + map(character => { + if (character?.name?.length) { + command = command.replace('@char', character.name); + } + return this.chat.send(command); + }) + ); + } else { + this.chat.send(command); + return of(null); + } } } diff --git a/src/app/modules/trade/trade.module.ts b/src/app/modules/trade/trade.module.ts index 3c9a1c17..0345caf1 100644 --- a/src/app/modules/trade/trade.module.ts +++ b/src/app/modules/trade/trade.module.ts @@ -102,47 +102,49 @@ export class TradeModule implements FeatureModule { private registerAnnotation(): void { let lastId = ''; - this.annotation.message$.on(message => this.ngZone.run(() => { - const id = message?.id || ''; - if (id === lastId) { - return; - } - lastId = id; + this.annotation.message$.on(message => { + this.ngZone.run(() => { + const id = message?.id || ''; + if (id === lastId) { + return; + } + lastId = id; - switch (id) { - case 'trade.outgoing': - case 'trade.incoming': - this.event.getCharacter().pipe( - catchError(() => of(null)) - ).subscribe(character => { - const item: TradeItemMessage = { - direction: id === 'trade.outgoing' - ? TradeWhisperDirection.Outgoing - : TradeWhisperDirection.Incoming, - itemName: 'Apocalypse Horn Decimation Bow', - joined$: new BehaviorSubject(false), - league: 'Standard', - left: 4, - top: 6, - // tslint:disable:max-line-length - message: 'Hi, I would like to buy your Apocalypse Horn Decimation Bow for 2 chaos in Delirium (stash tab "Annotation"; position: left 4, top 6)', - // tslint:enable:max-line-length - name: character?.name || 'PoEOverlayUnknownCharacter', - stash: 'Annotation', - timeReceived: new Date(), - type: TradeParserType.TradeItem, - whispers$: new BehaviorSubject([]), - currencyType: 'chaos', - price: 2 - }; - this.trade.set(item); - }); - break; - case 'trade.settings': - this.highlightWindow.close().subscribe(); - this.trade.clear(); - break; - } - })); + switch (id) { + case 'trade.outgoing': + case 'trade.incoming': + this.event.getCharacter().pipe( + catchError(() => of(null)) + ).subscribe(character => { + const item: TradeItemMessage = { + direction: id === 'trade.outgoing' + ? TradeWhisperDirection.Outgoing + : TradeWhisperDirection.Incoming, + itemName: 'Apocalypse Horn Decimation Bow', + joined$: new BehaviorSubject(false), + league: 'Standard', + left: 4, + top: 6, + // tslint:disable:max-line-length + message: 'Hi, I would like to buy your Apocalypse Horn Decimation Bow for 2 chaos in Delirium (stash tab "Annotation"; position: left 4, top 6)', + // tslint:enable:max-line-length + name: character?.name || 'PoEOverlayUnknownCharacter', + stash: 'Annotation', + timeReceived: new Date(), + type: TradeParserType.TradeItem, + whispers$: new BehaviorSubject([]), + currencyType: 'chaos', + price: 2 + }; + this.trade.set(item); + }); + break; + case 'trade.settings': + this.highlightWindow.close().subscribe(); + this.trade.clear(); + break; + } + }); + }); } } 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 3a8d3515..b8196118 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 @@ -32,9 +32,11 @@ export class TradeHighlightWindowComponent implements OnInit, OnDestroy { public ngOnInit(): void { this.updateData(this.window.data$.get()); - this.subscription = this.window.data$.on(data => this.ngZone.run(() => { - this.updateData(data); - })); + this.subscription = this.window.data$.on(data => { + this.ngZone.run(() => { + this.updateData(data); + }); + }); } public ngOnDestroy(): void { diff --git a/src/app/modules/trade/window/trade-window/trade-window.component.ts b/src/app/modules/trade/window/trade-window/trade-window.component.ts index d9495fbd..14a1b97d 100644 --- a/src/app/modules/trade/window/trade-window/trade-window.component.ts +++ b/src/app/modules/trade/window/trade-window/trade-window.component.ts @@ -27,9 +27,11 @@ export class TradeWindowComponent implements OnInit, OnDestroy { public ngOnInit(): void { this.data$.next(this.window.data$.get()); - this.subscription = this.window.data$.on(data => this.ngZone.run(() => { - this.data$.next(data); - })); + this.subscription = this.window.data$.on(data => { + this.ngZone.run(() => { + this.data$.next(data); + }); + }); } public ngOnDestroy(): void { diff --git a/src/app/shared/module/poe/event/event.service.ts b/src/app/shared/module/poe/event/event.service.ts index 210e5ce2..217aac9b 100644 --- a/src/app/shared/module/poe/event/event.service.ts +++ b/src/app/shared/module/poe/event/event.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { OWGamesEvents } from '@app/odk'; import { Observable, of } from 'rxjs'; -import { catchError, map, tap } from 'rxjs/operators'; +import { catchError, map } from 'rxjs/operators'; interface EventInfo { match_info: {