Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
<tr>
<td class="exotic-name" colspan="3">{{ ArmorStatNames[stat] }} at Tier {{ tier }}</td>
</tr>
<tr>
<td colspan="3" *ngIf="getIsAddedByExotic()"
>Not achievable by all selected exotics with the current settings</td
>
<td colspan="3" *ngIf="tier > maximumAvailableTier"
>Not achievable with the current settings</td
>
</tr>
<tr>
<th style="min-width: 50px">Stat</th>
<th style="min-width: 50px">Tier {{ tier }}</th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export class StatCooldownTooltipComponent implements OnInit {
public ArmorStatNames = ArmorStatNames;

@Input() tier: number = 0;
@Input() minimumMaximumExoticAvailableTier: number = 0;
@Input() maximumAvailableTier: number = 0;
@Input() differenceTier: number = 0; // the tier we use to show a difference for
@Input() stat: ArmorStat = ArmorStat.Mobility;

Expand Down Expand Up @@ -104,4 +106,10 @@ export class StatCooldownTooltipComponent implements OnInit {
getPercentageDifference(v1: number, v2: number) {
return (v1 - v2) / Math.max(1, v2);
}

getIsAddedByExotic() {
return (
this.tier > this.minimumMaximumExoticAvailableTier && this.tier <= this.maximumAvailableTier
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ export class StatCooldownTooltipDirective implements OnInit, OnDestroy {
* This can be used to show the tooltip conditionally
*/
@Input() showToolTip: boolean = true;

@Input() minimumMaximumExoticAvailableTier: number = 0;
@Input() maximumAvailableTier: number = 0;
@Input() tooltipTier: number = 0;
@Input() tooltipStat: ArmorStat = ArmorStat.Mobility;
@Input() tooltipDifferenceTier: number = 0; // the tier we use to show a difference for
Expand Down Expand Up @@ -102,6 +103,10 @@ export class StatCooldownTooltipDirective implements OnInit, OnDestroy {
tooltipRef.instance.tier = this.tooltipTier;
tooltipRef.instance.differenceTier = this.tooltipDifferenceTier;
tooltipRef.instance.stat = this.tooltipStat;
tooltipRef.instance.maximumAvailableTier = this.maximumAvailableTier;
tooltipRef.instance.minimumMaximumExoticAvailableTier =
this.minimumMaximumExoticAvailableTier;
tooltipRef.instance.stat = this.tooltipStat;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -681,13 +681,13 @@
</td>
</tr>
<ng-container *ngVar="element?.exotic as exotic">
<tr *ngIf="exotic[0]">
<tr *ngIf="exotic">
<td>Exotic:</td>
<td colspan="10">{{ exotic[0].name }}</td>
<td colspan="10">{{ exotic.name }}</td>
<td colspan="1">
<div class="item-icon-container">
<img class="item-icon" src="https://bungie.net/{{ exotic[0].icon }}" />
<img class="item-icon-overlay" src="https://bungie.net/{{ exotic[0].watermark }}" />
<img class="item-icon" src="https://bungie.net/{{ exotic.icon }}" />
<img class="item-icon-overlay" src="https://bungie.net/{{ exotic.watermark }}" />
</div>
</td>
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { MatSnackBar } from "@angular/material/snack-bar";
import { BungieApiService } from "../../../../services/bungie-api.service";
import { ModOrAbility } from "../../../../data/enum/modOrAbility";
import { DestinyEnergyType, DestinyClass } from "bungie-api-ts/destiny2";
import { ModifierType } from "../../../../data/enum/modifierType";
import { ModifierNames, ModifierType } from "../../../../data/enum/modifierType";
import { BuildConfiguration } from "../../../../data/buildConfiguration";
import { takeUntil } from "rxjs/operators";
import { Subject } from "rxjs";
Expand All @@ -64,7 +64,7 @@ export class ExpandedResultContentComponent implements OnInit, OnDestroy {
public ArmorStatIconUrls = ArmorStatIconUrls;
public ArmorStat = ArmorStat;
public StatModifier = StatModifier;
public config_characterClass = DestinyClass.Titan;
public config_characterClass = DestinyClass.Unknown;
public config_assumeLegendariesMasterworked = false;
public config_assumeExoticsMasterworked = false;
public config_assumeClassItemMasterworked = false;
Expand Down Expand Up @@ -110,7 +110,7 @@ export class ExpandedResultContentComponent implements OnInit, OnDestroy {

ngOnInit(): void {
this.config.configuration.pipe(takeUntil(this.ngUnsubscribe)).subscribe((c) => {
this.config_characterClass = c.characterClass as unknown as DestinyClass;
this.config_characterClass = c.characterClass;
this.config_assumeLegendariesMasterworked = c.assumeLegendariesMasterworked;
this.config_assumeExoticsMasterworked = c.assumeExoticsMasterworked;
this.config_assumeClassItemMasterworked = c.assumeClassItemMasterworked;
Expand Down Expand Up @@ -307,16 +307,15 @@ export class ExpandedResultContentComponent implements OnInit, OnDestroy {
if (c.selectedExotics.length == 1) {
data.exoticArmorHash = c.selectedExotics[0];
} else {
var exos = this.element?.exotic;
if (exos && exos.length == 1) {
var exoticHash = exos[0].hash;
if (!!exoticHash) data.exoticArmorHash = parseInt(exoticHash, 10);
}
var exoticHash = this.element?.exotic?.hash;
if (!!exoticHash) data.exoticArmorHash = exoticHash;
}

const loadout: Loadout = {
id: "d2ap", // this doesn't matter and will be replaced
name: "D2ArmorPicker Loadout",
name: `${ModifierNames[c.selectedModElement]} ${
this.element?.exotic?.name
} D2ArmorPicker Loadout `,
classType: c.characterClass as number,
parameters: data,
equipped: (this.element?.items || []).map(([i]) => ({
Expand Down
51 changes: 38 additions & 13 deletions src/app/components/authenticated-v2/results/results.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
matTooltip="Note: To speed up the whole process, only {{
this.parsedResults | number
}} results are listed in this table.
If you need more entries, disable the limitation in the advanced settings."
If you need more entries, disable the limitation in the advanced settings."
>report_problem
</mat-icon>
<mat-icon
Expand All @@ -59,7 +59,7 @@
matTooltip="Note: To prevent Out-Of-Memory crashes, only {{
this.parsedResults | number
}} results are listed in this table.
You should narrow down your settings a bit."
You should narrow down your settings a bit."
>report_problem
</mat-icon>
</mat-form-field>
Expand Down Expand Up @@ -217,7 +217,7 @@
matSortDirection="asc"
multiTemplateDataRows>
<!--- Note that these columns can be defined in any order.
The actual rendered columns are set as a property on the row definition" -->
The actual rendered columns are set as a property on the row definition" -->
<!-- Name Column -->
<ng-container matColumnDef="mobility">
<th
Expand Down Expand Up @@ -343,21 +343,46 @@
</td>
</ng-container>

<!-- Hash Column -->
<!--<ng-container matColumnDef="nonExoticsSetHash">
<th
*matHeaderCellDef
mat-header-cell
mat-sort-header="Hash"
matTooltip="Non-exotic build id"
>Hash
</th>
<td *matCellDef="let element" mat-cell> {{ element.nonExoticsSetHash }} </td>
</ng-container>
-->

<!-- Hash Count Column -->
<ng-container matColumnDef="nonExoticsSetCount">
<th
*matHeaderCellDef
mat-header-cell
mat-sort-header="HashCount"
matTooltip="Number of builds generated that use the same non-exotic armor, when 2 different armor slot exotics are generated, shows number of builds generated with at least 2 shared pieces.">
# Easy Swap builds
</th>
<td *matCellDef="let element" mat-cell> {{ element.nonExoticsSetCount }} </td>
</ng-container>
<!-- Name Column -->
<ng-container matColumnDef="exotic">
<th *matHeaderCellDef mat-header-cell> Exotic</th>
<td *matCellDef="let element" mat-cell>
<ng-container *ngFor="let exo of element.exotic">
<!-- TODO name , icon-->
<img
#tooltip="matTooltip"
class="itemIcon"
matTooltip="{{ exo.name }}"
src="https://bungie.net/{{ exo.icon }}" />
<img class="itemIconWatermark" src="https://bungie.net/{{ exo.watermark }}" />
</ng-container>
<img
*ngIf="element.exotic.length === 0"
*ngIf="element.exotic !== undefined"
#tooltip="matTooltip"
class="itemIcon"
matTooltip="{{ element.exotic.name }}"
src="https://bungie.net/{{ element.exotic.icon }}" />
<img
*ngIf="element.exotic !== undefined"
class="itemIconWatermark"
src="https://bungie.net/{{ element.exotic.watermark }}" />
<img
*ngIf="element.exotic === undefined"
class="itemIcon"
src="https://www.bungie.net/common/destiny2_content/icons/b4d05ef69d0c3227a7d4f7f35bbc2848.png" />
</td>
Expand Down
29 changes: 20 additions & 9 deletions src/app/components/authenticated-v2/results/results.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@ import { InventoryArmorSource } from "src/app/data/types/IInventoryArmor";
export interface ResultDefinition {
exotic:
| undefined
| [
{
icon: string;
name: string;
hash: string;
}
];
| {
icon: string;
watermark: string;
name: string;
hash: number;
};
artifice: number[];
classItem: {
perk: ArmorPerkOrSlot;
Expand All @@ -53,12 +52,15 @@ export interface ResultDefinition {
statsNoMods: number[];
items: ResultItem[][];
tiers: number;
maxTiers: number;
waste: number;
modCost: number;
modCount: number;
loaded: boolean;
usesCollectionRoll?: boolean;
usesVendorRoll?: boolean;
nonExoticsSetHash: bigint;
nonExoticsSetCount: number;
}

export enum ResultItemMoveState {
Expand Down Expand Up @@ -193,6 +195,7 @@ export class ResultsComponent implements OnInit, OnDestroy {
"mods",
];
if (c.showWastedStatsColumn) columns.push("waste");
if (c.includeLegendaryShareColumn) columns.push("nonExoticsSetCount");
if (c.includeVendorRolls || c.includeCollectionRolls) columns.push("source");
columns.push("dropdown");
this.shownColumns = columns;
Expand Down Expand Up @@ -229,7 +232,7 @@ export class ResultsComponent implements OnInit, OnDestroy {
case "Tiers":
return data.tiers;
case "Max Tiers":
return 10 * (data.tiers + (5 - data.modCount));
return data.maxTiers;
case "Waste":
return data.waste;
case "Mods":
Expand All @@ -238,6 +241,8 @@ export class ResultsComponent implements OnInit, OnDestroy {
//+ 40 * data.artifice.length
data.modCost
);
case "HashCount":
return data.nonExoticsSetCount;
}
return 0;
};
Expand Down Expand Up @@ -281,7 +286,13 @@ export class ResultsComponent implements OnInit, OnDestroy {
// download the file
let a = document.createElement("a");
a.download = "builds.json";
const url = window.URL.createObjectURL(new Blob([JSON.stringify(jsonData, null, 2)]));
const url = window.URL.createObjectURL(
new Blob([
JSON.stringify(jsonData, (key, value) =>
typeof value === "bigint" ? value.toString() : value
),
])
);
const link = document.createElement("a");
link.href = url;
link.setAttribute("download", "d2ap_results.json");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,15 @@ export class AdvancedSettingsComponent implements OnInit, OnDestroy {
impactsResultCount: false,
help: "Shows an additional column in the table that shows how many stats are wasted in a build.",
},
{
name: "Show the count of builds generated sharing non-exotic armor pieces.",
cp: (v: boolean) =>
this.config.modifyConfiguration((c) => (c.includeLegendaryShareColumn = v)),
value: c.includeLegendaryShareColumn,
disabled: false,
impactsResultCount: false,
help: "Shows an additional column in the table with the count of how many builds generated use the same non-exotic armor pieces, or when 2 exotic slots are selected, the builds that share the other two slots",
},
],
"Wasted Stats": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@ export class DesiredClassSelectionComponent implements OnInit, OnDestroy {
itemCounts: (null | number)[] = [null, null, null];
selectedClass = -1;
public storedMaterials: {
"3853748946": number;
"4257549985": number;
"4257549984": number;
"3159615086": number;
"3467984096": number;
[Key: string]: number;
} | null = null;

constructor(
Expand Down Expand Up @@ -86,11 +82,7 @@ export class DesiredClassSelectionComponent implements OnInit, OnDestroy {

private async loadStoredMaterials() {
var k: {
"3853748946": number;
"4257549985": number;
"4257549984": number;
"3159615086": number;
"3467984096": number;
[Key: string]: number;
} = JSON.parse(localStorage.getItem("stored-materials") || "{}");
if (!("3853748946" in k)) k["3853748946"] = 0;
if (!("4257549984" in k)) k["4257549984"] = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { ClassExoticInfo, InventoryService } from "../../../../services/inventor
import { ConfigurationService } from "../../../../services/configuration.service";
import { animate, query, stagger, style, transition, trigger } from "@angular/animations";
import { ArmorSlot } from "../../../../data/enum/armor-slot";
import { FORCE_USE_NO_EXOTIC } from "../../../../data/constants";
import { FORCE_USE_ANY_EXOTIC, FORCE_USE_NO_EXOTIC } from "../../../../data/constants";
import { debounceTime, takeUntil } from "rxjs/operators";
import { Subject } from "rxjs";
import { DestinyClass } from "bungie-api-ts/destiny2";
Expand All @@ -47,7 +47,7 @@ export class DesiredExoticSelectionComponent implements OnInit, OnDestroy {
includeVendorRolls = false;
ignoreSunsetArmor = false;
allowBlueArmorPieces = false;
currentClass: DestinyClass = DestinyClass.Titan;
currentClass: DestinyClass = DestinyClass.Unknown;
exotics: ClassExoticInfo[][] = [];

constructor(public inventory: InventoryService, public config: ConfigurationService) {}
Expand Down Expand Up @@ -89,6 +89,7 @@ export class DesiredExoticSelectionComponent implements OnInit, OnDestroy {
}

this.exotics = [
[],
uniq(armors.filter((a) => a.item.slot == ArmorSlot.ArmorSlotHelmet)),
uniq(armors.filter((a) => a.item.slot == ArmorSlot.ArmorSlotGauntlet)),
uniq(armors.filter((a) => a.item.slot == ArmorSlot.ArmorSlotChest)),
Expand Down Expand Up @@ -125,11 +126,23 @@ export class DesiredExoticSelectionComponent implements OnInit, OnDestroy {
if (index > -1) {
// Always delete an item if it is already in the list
this.selectedExotics.splice(index, 1);
} else if (hash == FORCE_USE_NO_EXOTIC) {
} else if (
hash == FORCE_USE_NO_EXOTIC ||
(this.selectedExotics.indexOf(FORCE_USE_NO_EXOTIC) != -1 &&
($event.shiftKey || $event.ctrlKey))
) {
this.selectedExotics = [FORCE_USE_NO_EXOTIC];
} else if (this.selectedExotics.length == 0 || !$event.shiftKey) {
// if length is 0 or shift is NOT pressed, add the exotic
} else if (
hash == FORCE_USE_ANY_EXOTIC ||
(this.selectedExotics.indexOf(FORCE_USE_ANY_EXOTIC) != -1 &&
($event.shiftKey || $event.ctrlKey))
) {
this.selectedExotics = [FORCE_USE_ANY_EXOTIC];
} else if (this.selectedExotics.length == 0 || !($event.shiftKey || $event.ctrlKey)) {
// if length is 0 or shift or control is NOT pressed, replace the selected exotic
this.selectedExotics = [hash];
} else {
this.selectedExotics.push(hash);
}
this.config.modifyConfiguration((c) => {
c.selectedExotics = this.selectedExotics;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class SlotLimitationSelectionComponent implements OnInit, OnDestroy, Afte
possible: EventEmitter<boolean> = new EventEmitter<boolean>();

isPossible: boolean = true;
configSelectedClass: DestinyClass = DestinyClass.Titan;
configSelectedClass: DestinyClass = DestinyClass.Unknown;
configAssumeLegendaryIsArtifice: boolean = false;
configAssumeClassItemIsArtifice: boolean = false;
armorPerk: ArmorPerkOrSlot = ArmorPerkOrSlot.None;
Expand Down
Loading