Skip to content

fix(reference-viewer): add markForCheck, improve Chancee quantity visibility per group#3669

Merged
Helias merged 1 commit into
masterfrom
fix-reference-loot
Jan 17, 2026
Merged

fix(reference-viewer): add markForCheck, improve Chancee quantity visibility per group#3669
Helias merged 1 commit into
masterfrom
fix-reference-loot

Conversation

@Helias

@Helias Helias commented Jan 17, 2026

Copy link
Copy Markdown
Member

closes #3618

@Helias Helias merged commit 1a2b124 into master Jan 17, 2026
13 checks passed
@Helias Helias deleted the fix-reference-loot branch January 17, 2026 18:26
expect(component['referenceLootRows']![0].Chance).toBe('45.00' as unknown as number); // 90 / 2
expect(component['referenceLootRows']![1].Chance).toBe('50.00' as unknown as number); // 100 / 2
// Group 2
expect(component['referenceLootRows']![2].Chance).toBe('25.00' as unknown as number); // 75 / 3

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using the divded value, use the value

so instead of
expect(component['referenceLootRows']![0].Chance).toBe('45.00' as unknown as number); // 90 / 2

use
expect(component['referenceLootRows']![0].Chance).toBe(90); and same for others [1, 2, 3, 4]


const component = host.child();
expect(component['referenceLootRows']![0].Chance).toBe(100); // GroupId 0, unchanged
expect(component['referenceLootRows']![1].Chance).toBe('40.00' as unknown as number); // 80 / 2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here also

expect(component['referenceLootRows']![1].Chance).toBe(80);

fixture.detectChanges();

const component = host.child();
// 100 / 3 = 33.33

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While here for the nitpick since we are fixing this after 33.33 "(only whenchance is 0)"

this.referenceLootRows = result.map((row) => {
let Chance = row.Chance;

if (row.GroupId !== 0) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

row.GroupId !== 0 && row.Chance === 0

if the chance is 0 it fallsbacks to 100 divided by groupcount


if (row.GroupId !== 0) {
const groupCount = result.filter((r) => r.GroupId === row.GroupId).length;
Chance = (row.Chance === 0 ? 100 / groupCount : row.Chance / groupCount).toFixed(2) as unknown as number;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chance = (100 / groupCount).toFixed(2) as unknown as number;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Enchantment] - Make *_loot_template GroupID when grouped and chance at 0 to show in bracket the percetange)

2 participants