Skip to content

Commit

Permalink
added Character Name setting as fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyusung4698 committed Jun 19, 2020
1 parent 5c244d8 commit 31e32ee
Show file tree
Hide file tree
Showing 20 changed files with 98 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 1.0.4 (2020-06-19)

- added 3.11 data
- added `Character Name` setting as fallback

## 1.0.3 (2020-06-18)

- fixed a unhandled error if no event data is available
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"meta": {
"name": "PoE Overlay",
"author": "Kyusung4698",
"version": "1.0.3",
"version": "1.0.4",
"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",
Expand Down
55 changes: 54 additions & 1 deletion overlay.babel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<babeledit_project be_version="2.7.0" version="1.2">
<babeledit_project version="1.2" be_version="2.7.0">
<!--

BabelEdit project file
Expand Down Expand Up @@ -12106,6 +12106,59 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>character-name</name>
<definition_loaded>false</definition_loaded>
<description></description>
<comment></comment>
<default_text></default_text>
<translations>
<translation>
<language>de-DE</language>
<approved>false</approved>
</translation>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-ES</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-FR</language>
<approved>false</approved>
</translation>
<translation>
<language>ko-KR</language>
<approved>false</approved>
</translation>
<translation>
<language>pl-PL</language>
<approved>false</approved>
</translation>
<translation>
<language>pt-BR</language>
<approved>false</approved>
</translation>
<translation>
<language>ru-RU</language>
<approved>false</approved>
</translation>
<translation>
<language>th-TH</language>
<approved>false</approved>
</translation>
<translation>
<language>zh-CHS</language>
<approved>false</approved>
</translation>
<translation>
<language>zh-CHT</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>dialog</name>
<definition_loaded>false</definition_loaded>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "poe-overlay-overwolf",
"version": "1.0.3",
"version": "1.0.4",
"scripts": {
"watch": "ng build --watch",
"watch:prod": "ng build --watch --prod",
Expand Down
1 change: 1 addition & 0 deletions src/app/core/feature/feature-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ export interface FeatureSettings {
leagueId?: string;
uiLanguage?: UiLanguage;
dialogOpacity?: number;
characterName?: string;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<app-card [title]="'settings.game-settings' | translate" appAnnotation="settings.game-settings">
<div class="row">
<div class="col-md-6">
<div class="col-md-3">
<mat-form-field>
<mat-label>{{'app.language' | translate}}</mat-label>
<mat-select [(value)]="settings.language" (valueChange)="onLanguageChange()">
Expand All @@ -10,7 +10,7 @@
</mat-select>
</mat-form-field>
</div>
<div class="col-md-6">
<div class="col-md-3">
<mat-form-field>
<mat-label>{{'settings.league' | translate}}</mat-label>
<mat-select [(value)]="settings.leagueId" (valueChange)="onChange()">
Expand All @@ -20,6 +20,12 @@
</mat-select>
</mat-form-field>
</div>
<div class="col-md-6">
<mat-form-field>
<mat-label>{{'settings.character-name' | translate}}</mat-label>
<input matInput [(ngModel)]="settings.characterName" (ngModelChange)="onChange()">
</mat-form-field>
</div>
</div>
</app-card>

Expand Down
2 changes: 1 addition & 1 deletion src/app/modules/commands/commands.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class CommandsModule implements FeatureModule<CommandsFeatureSettings> {
const index = +hotkey.replace('command', '');
const { text } = settings.commands[index - 1];
if (text?.length) {
this.command.execute(text).subscribe(() => { }, error => {
this.command.execute(text, settings).subscribe(() => { }, error => {
console.warn(`Could not execute command.`, error, text);
this.notification.show('commands.execute-error');
});
Expand Down
18 changes: 13 additions & 5 deletions src/app/modules/commands/service/command.service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Injectable } from '@angular/core';
import { ChatService } from '@shared/module/poe/chat';
import { EventService } from '@shared/module/poe/event';
import { Observable, of } from 'rxjs';
import { map, tap } from 'rxjs/operators';
import { Observable, of, throwError } from 'rxjs';
import { flatMap } from 'rxjs/operators';
import { CommandsFeatureSettings } from '../commands-feature-settings';

@Injectable({
providedIn: 'root'
Expand All @@ -13,14 +14,21 @@ export class CommandService {
private readonly chat: ChatService,
private readonly event: EventService) { }

public execute(command: string): Observable<void> {
public execute(command: string, settings: CommandsFeatureSettings): Observable<void> {
if (command.includes('@char')) {
return this.event.getCharacter().pipe(
map(character => {
flatMap(character => {
if (character?.name?.length) {
command = command.replace('@char', character.name);
} else {
if (settings.characterName?.length) {
command = command.replace('@char', settings.characterName);
} else {
return throwError('character name was not set.');
}
}
return this.chat.send(command);
this.chat.send(command);
return of(null);
})
);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ export class TradeMessageComponent implements OnInit {
if (character?.name?.length) {
return of(character.name);
}
if (this.settings.characterName?.length) {
return of(this.settings.characterName);
}
return throwError('character name was not set.');
})
).subscribe(name => this.chat.kick(name), error => {
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@
"auto-download": "Download update automatically",
"auto-launch": "Run on Boot",
"cancel": "Cancel",
"character-name": "Character Name Fallback ",
"dialog": "Dialog",
"dialog-opacity": "Dialog Opacity",
"dialog-spawn-position": {
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/french.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@
"auto-download": "Télécharger la mise à jour automatiquement",
"auto-launch": "Exécuter au démarrage",
"cancel": "Annuler",
"character-name": "Nom du personnage Fallback",
"dialog": "Dialogue",
"dialog-opacity": "Opacité de la boîte de dialogue",
"dialog-spawn-position": {
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/german.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@
"auto-download": "Update automatisch herunterladen",
"auto-launch": "Beim Booten ausführen",
"cancel": "Abbrechen",
"character-name": "Charaktername Fallback",
"dialog": "Dialog",
"dialog-opacity": "Dialogopazität",
"dialog-spawn-position": {
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/korean.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@
"auto-download": "업데이트 자동 다운로드",
"auto-launch": "부팅시 실행",
"cancel": "취소",
"character-name": "캐릭터 이름 대체",
"dialog": "대화",
"dialog-opacity": "대화 상자 불투명도",
"dialog-spawn-position": {
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/polish.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@
"auto-download": "Pobierz aktualizację automatycznie",
"auto-launch": "Uruchom wraz ze startem systemu",
"cancel": "Anuluj",
"character-name": "Nazwa postaci Fallback",
"dialog": "Okno dialogowe",
"dialog-opacity": "Okno dialogowe Krycie",
"dialog-spawn-position": {
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/portuguese.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@
"auto-download": "Baixar atualização automaticamente",
"auto-launch": "Executar na inicialização",
"cancel": "Cancelar",
"character-name": "Nome do personagem Fallback",
"dialog": "Diálogo",
"dialog-opacity": "Opacidade da caixa de diálogo",
"dialog-spawn-position": {
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/russian.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@
"auto-download": "Скачивать обновления автоматически",
"auto-launch": "Запустить на включении",
"cancel": "Отменить",
"character-name": "Имя персонажа",
"dialog": "Диалог",
"dialog-opacity": "Непрозрачность диалога",
"dialog-spawn-position": {
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/simplified-chinese.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@
"auto-download": "自动下载更新",
"auto-launch": "开机运行",
"cancel": "取消",
"character-name": "角色名称后备",
"dialog": "对话",
"dialog-opacity": "对话不透明度",
"dialog-spawn-position": {
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/spanish.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@
"auto-download": "Descargar actualización automáticamente",
"auto-launch": "Ejecutar en arranque",
"cancel": "Cancelar",
"character-name": "Nombre del personaje Fallback",
"dialog": "Diálogo",
"dialog-opacity": "Diálogo Opacidad",
"dialog-spawn-position": {
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/thai.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@
"auto-download": "ดาวน์โหลดอัปเดตโดยอัตโนมัติ",
"auto-launch": "ทำงานบน Boot",
"cancel": "ยกเลิก",
"character-name": "ชื่อตัวเลือกทางเลือก",
"dialog": "โต้ตอบ",
"dialog-opacity": "ความทึบของไดอะล็อก",
"dialog-spawn-position": {
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/traditional-chinese.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@
"auto-download": "自動下載更新",
"auto-launch": "開機後自動啟動",
"cancel": "取消",
"character-name": "角色名稱後備",
"dialog": "對話",
"dialog-opacity": "對話不透明度",
"dialog-spawn-position": {
Expand Down

0 comments on commit 31e32ee

Please sign in to comment.