Skip to content

Commit 598fa8d

Browse files
committed
Add quality quality modules comparison table
1 parent e6ca11a commit 598fa8d

File tree

7 files changed

+153
-4
lines changed

7 files changed

+153
-4
lines changed

src/app/cheat-sheets/game-base/modules-and-beacons/modules-and-beacons.component.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
<br />
5656

5757
<h4>
58-
Tips for Speed modules <app-factorio-icon [icon]="dataService.getFactorioIcon(FactorioIcons.Icons_SpeedModule3)"></app-factorio-icon>
58+
<app-factorio-icon [icon]="dataService.getFactorioIcon(FactorioIcons.Icons_SpeedModule3)"></app-factorio-icon>
59+
Tips for Speed modules
5960
</h4>
6061

6162
<ul>
@@ -70,8 +71,8 @@ <h4>
7071
</ul>
7172

7273
<h4>
73-
Tips for Productivity modules
7474
<app-factorio-icon [icon]="dataService.getFactorioIcon(FactorioIcons.Icons_ProductivityModule3)"></app-factorio-icon>
75+
Tips for Productivity modules
7576
</h4>
7677

7778
<ul>
@@ -80,8 +81,8 @@ <h4>
8081
</ul>
8182

8283
<h4>
83-
Tips for Efficiency modules
8484
<app-factorio-icon [icon]="dataService.getFactorioIcon(FactorioIcons.Icons_EfficiencyModule3)"></app-factorio-icon>
85+
Tips for Efficiency modules
8586
</h4>
8687

8788
<ul>
@@ -90,8 +91,8 @@ <h4>
9091
</ul>
9192

9293
<h4>
93-
Tips for Quality modules
9494
<app-factorio-icon [icon]="dataService.getFactorioIcon(FactorioIcons.Icons_QualityModule3)" [spaceAge]="true"></app-factorio-icon>
95+
Tips for Quality modules
9596
</h4>
9697

9798
<p>Speed modules <em>lower</em> the quality of the output, so:</p>
@@ -120,6 +121,7 @@ <h4>Diminishing returns</h4>
120121
>.
121122
</p>
122123

124+
<hr />
123125
<h4>Calculator</h4>
124126

125127
<p>This calculator shows how many machines you need to get your wanted output.</p>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { QualityQualityTable } from './quality-table-entry/quality-table-entry.model.js';
2+
3+
export const QUALITY_QUALITY_TABLE: QualityQualityTable = [
4+
{
5+
Normal: 1,
6+
Uncommon: 1.3,
7+
Rare: 1.6,
8+
Epic: 1.9,
9+
Legendary: 2.5,
10+
},
11+
{
12+
Normal: 2,
13+
Uncommon: 2.6,
14+
Rare: 3.2,
15+
Epic: 3.8,
16+
Legendary: 5,
17+
},
18+
{
19+
Normal: 2.5,
20+
Uncommon: 3.2,
21+
Rare: 4,
22+
Epic: 4.7,
23+
Legendary: 6.2,
24+
},
25+
];
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// import { faker } from '@faker-js/faker';
2+
3+
import { QualityTableEntry } from './quality-table-entry.model';
4+
5+
// ===== Simple Mock ====== //
6+
export const MOCK_QualityTableEntry: QualityTableEntry = {
7+
Normal: 1,
8+
Uncommon: 1.3,
9+
Rare: 1.6,
10+
Epic: 1.9,
11+
Legendary: 2.5,
12+
};
13+
14+
export const MOCK_QualityTableEntry_Array: QualityTableEntry[] = [
15+
MOCK_QualityTableEntry,
16+
];
17+
18+
// ===== Advanced Mock with https://v9.fakerjs.dev/api/ ====== //
19+
// export function createMock_QualityTableEntry(): QualityTableEntry {
20+
// return {
21+
// id: faker.string.uuid(),
22+
// };
23+
// }
24+
25+
// export function createMock_QualityTableEntry_Array(count: number): QualityTableEntry[] {
26+
// return faker.helpers.multiple(createMock_QualityTableEntry, { count });
27+
// }
28+
29+
// export const MOCK_QualityTableEntry: QualityTableEntry = createMock_QualityTableEntry();
30+
// export const MOCK_QualityTableEntry_Array: QualityTableEntry[] = createMock_QualityTableEntry_Array(5);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Quality } from '../quality.enum';
2+
3+
export type QualityTableEntry = Record<Quality, number>;
4+
5+
export type QualityQualityTable = [
6+
QualityTableEntry,
7+
QualityTableEntry,
8+
QualityTableEntry
9+
];
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { FactorioIcons } from 'app/shared/factorio-icons.enum';
2+
3+
export enum Quality {
4+
Normal = 'Normal',
5+
Uncommon = 'Uncommon',
6+
Rare = 'Rare',
7+
Epic = 'Epic',
8+
Legendary = 'Legendary',
9+
}
10+
11+
export const QUALITY_OPTIONS: Quality[] = Object.values(Quality);
12+
13+
export function isQuality(value: string): value is Quality {
14+
return QUALITY_OPTIONS.includes(value as Quality);
15+
}
16+
17+
export const QUALITY_DISPLAY: Record<Quality, FactorioIcons> = {
18+
[Quality.Normal]: FactorioIcons.Icons_QualityNormal,
19+
[Quality.Uncommon]: FactorioIcons.Icons_QualityUncommon,
20+
[Quality.Rare]: FactorioIcons.Icons_QualityRare,
21+
[Quality.Epic]: FactorioIcons.Icons_QualityEpic,
22+
[Quality.Legendary]: FactorioIcons.Icons_QualityLegendary,
23+
};
24+
25+
// export interface QualityInfo {
26+
// id: Quality;
27+
// display: string;
28+
// }
29+
30+
// export const QUALITY_INFO: Record<Quality, QualityInfo> = {
31+
// [Quality.OptionId1]: {
32+
// id: Quality.OptionId1,
33+
// display: 'Option Id 1',
34+
// },
35+
// } as const;
36+
37+
// export const QUALITY_INFO_OPTIONS: QualityInfo[] =
38+
// QUALITY_OPTIONS.map(
39+
// (o: Quality): QualityInfo => QUALITY_INFO[o],
40+
// );

src/app/cheat-sheets/game-base/space-age/space-age.component.html

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,43 @@ <h4 class="card-title" id="quality">Quality</h4>
5454
<a href="https://www.factorio.com/blog/post/fff-376" target="_blank" rel="noopener noreferrer">FFF-376</a>
5555
</li>
5656
</ul>
57+
58+
<table class="table table-hover fixed-width">
59+
<caption>
60+
Quality Quality Modules Comparison
61+
</caption>
62+
<thead>
63+
<tr>
64+
<th></th>
65+
<th>
66+
<app-factorio-icon
67+
[icon]="dataService.getFactorioIcon(FactorioIcons.Icons_QualityModule)"
68+
[spaceAge]="true"
69+
></app-factorio-icon>
70+
</th>
71+
<th>
72+
<app-factorio-icon
73+
[icon]="dataService.getFactorioIcon(FactorioIcons.Icons_QualityModule2)"
74+
[spaceAge]="true"
75+
></app-factorio-icon>
76+
</th>
77+
<th>
78+
<app-factorio-icon
79+
[icon]="dataService.getFactorioIcon(FactorioIcons.Icons_QualityModule3)"
80+
[spaceAge]="true"
81+
></app-factorio-icon>
82+
</th>
83+
</tr>
84+
</thead>
85+
<tbody>
86+
<tr *ngFor="let quality of QUALITY_OPTIONS">
87+
<td>
88+
<app-factorio-icon [icon]="dataService.getFactorioIcon(QUALITY_DISPLAY[quality])" [spaceAge]="true"></app-factorio-icon>
89+
</td>
90+
<td *ngFor="let item of QUALITY_QUALITY_TABLE">{{ item[quality] }}%</td>
91+
</tr>
92+
</tbody>
93+
</table>
5794
</div>
5895

5996
<hr />

src/app/cheat-sheets/game-base/space-age/space-age.component.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import { APP_INFO, AppInfo } from 'app/shared/app-settings';
66
import { CheatSheetTemplateComponent } from 'app/shared/cheat-sheet-template/cheat-sheet-template.component';
77
import { FactorioIcons } from 'app/shared/factorio-icons.enum';
88

9+
import { QUALITY_DISPLAY, QUALITY_OPTIONS } from './quality.enum';
10+
import { QUALITY_QUALITY_TABLE } from './quality-quality-table.data';
911
import { SPACE_AGE_DATA } from './space-age.data';
1012
import { SpaceAgeData } from './space-age.model';
1113

@@ -32,5 +34,9 @@ export class SpaceAgeComponent {
3234
protected readonly APP_INFO: AppInfo = APP_INFO;
3335
protected readonly SPACE_AGE_DATA: SpaceAgeData = SPACE_AGE_DATA;
3436

37+
protected readonly QUALITY_OPTIONS = QUALITY_OPTIONS;
38+
protected readonly QUALITY_DISPLAY = QUALITY_DISPLAY;
39+
protected readonly QUALITY_QUALITY_TABLE = QUALITY_QUALITY_TABLE;
40+
3541
constructor(protected dataService: DataService) {}
3642
}

0 commit comments

Comments
 (0)