Skip to content

Commit

Permalink
Merge pull request #135 from Mijago/Mijago/issue134-guardian-games-cl…
Browse files Browse the repository at this point in the history
…assitem

feat: add guardian games slot (only to class item)
  • Loading branch information
Mijago authored May 7, 2023
2 parents be5b1ed + 70261a1 commit 6fb58c2
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .env_example
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ D2AP_BUNGIE_CLIENT_ID=
D2AP_BUNGIE_CLIENT_SECRET=

D2AP_FEATURE_ENABLE_MODSLOT_LIMITATION=0
D2AP_FEATURE_ENABLE_ZERO_WASTE=0
D2AP_FEATURE_ENABLE_ZERO_WASTE=0
D2AP_FEATURE_ENABLE_GUARDIAN_GAMES_FEATURES=1
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "d2-armor-picker",
"version": "2.3.0",
"version": "2.3.2",
"scripts": {
"ng": "ng",
"config": "ts-node set-env.ts",
Expand Down
3 changes: 2 additions & 1 deletion set-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const writeFile = require("fs").writeFile

const production = process.env.PRODUCTION === "1"
const beta_branch = process.env.BETA === "1"
const version = "2.3.0"
const version = "2.3.2"

// Configure Angular `environment.ts` file path
const targetPath = production
Expand Down Expand Up @@ -43,6 +43,7 @@ const data = {
featureFlags: {
enableModslotLimitation: process.env.D2AP_FEATURE_ENABLE_MODSLOT_LIMITATION == "1",
enableZeroWaste: process.env.D2AP_FEATURE_ENABLE_ZERO_WASTE == "1",
enableGuardianGamesFeatures: process.env.D2AP_FEATURE_ENABLE_GUARDIAN_GAMES_FEATURES == "1",
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
</mat-button-toggle-group>
<mat-menu #dropdownArmorModslot="matMenu" class="modslot-select-scroll-menu">
<ng-container
*ngFor="let perk of [ArmorPerkOrSlot.None, ArmorPerkOrSlot.PerkQueensFavor, ArmorPerkOrSlot.SlotRootOfNightmares, ArmorPerkOrSlot.SlotKingsFall, ArmorPerkOrSlot.SlotVowOfTheDisciple,ArmorPerkOrSlot.SlotVaultOfGlass, ArmorPerkOrSlot.SlotDeepStoneCrypt, ArmorPerkOrSlot.SlotGardenOfSalvation, ArmorPerkOrSlot.SlotLastWish, ArmorPerkOrSlot.SlotNightmare, ArmorPerkOrSlot.SlotArtifice, ArmorPerkOrSlot.PerkIronBanner, ArmorPerkOrSlot.PerkUniformedOfficer, ArmorPerkOrSlot.PerkPlunderersTrappings, ArmorPerkOrSlot.SeraphSensorArray]">
*ngFor="let perk of availableArmorPerks">
<button mat-menu-item (click)="setArmorPerk(perk)" [class.selected-menu]="perk == armorPerk">
<app-armor-perk-icon [perk]="perk" class="menuArmorIcon"></app-armor-perk-icon>
<span class="menuArmorText">{{ArmorPerkOrSlotNames[perk]}}</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, EventEmitter, Input, OnDestroy, OnInit, Output} from '@angular/core';
import {AfterViewInit, Component, EventEmitter, Input, OnDestroy, OnInit, Output} from '@angular/core';
import {MAXIMUM_STAT_MOD_AMOUNT} from "../../../../../data/constants";
import {ArmorSlot} from "../../../../../data/enum/armor-slot";
import {ConfigurationService} from "../../../../../services/configuration.service";
Expand All @@ -18,7 +18,7 @@ import {environment} from "../../../../../../environments/environment";
templateUrl: './slot-limitation-selection.component.html',
styleUrls: ['./slot-limitation-selection.component.scss']
})
export class SlotLimitationSelectionComponent implements OnInit, OnDestroy {
export class SlotLimitationSelectionComponent implements OnInit, OnDestroy, AfterViewInit {
readonly featureDisabled = !environment.featureFlags.enableModslotLimitation;
readonly ArmorSlot = ArmorSlot;
readonly ArmorPerkOrSlotNames = ArmorPerkOrSlotNames;
Expand All @@ -41,6 +41,9 @@ export class SlotLimitationSelectionComponent implements OnInit, OnDestroy {

disabled: boolean = false;

readonly availableArmorPerks = [ArmorPerkOrSlot.None, ArmorPerkOrSlot.PerkQueensFavor, ArmorPerkOrSlot.SlotRootOfNightmares, ArmorPerkOrSlot.SlotKingsFall, ArmorPerkOrSlot.SlotVowOfTheDisciple,ArmorPerkOrSlot.SlotVaultOfGlass, ArmorPerkOrSlot.SlotDeepStoneCrypt, ArmorPerkOrSlot.SlotGardenOfSalvation, ArmorPerkOrSlot.SlotLastWish, ArmorPerkOrSlot.SlotNightmare, ArmorPerkOrSlot.SlotArtifice, ArmorPerkOrSlot.PerkIronBanner, ArmorPerkOrSlot.PerkUniformedOfficer, ArmorPerkOrSlot.PerkPlunderersTrappings, ArmorPerkOrSlot.SeraphSensorArray];


constructor(public config: ConfigurationService, public inventory: InventoryService, private db: DatabaseService) {
}

Expand Down Expand Up @@ -103,6 +106,12 @@ export class SlotLimitationSelectionComponent implements OnInit, OnDestroy {
})
}

ngAfterViewInit(): void {
if (environment.featureFlags.enableGuardianGamesFeatures && this.slot === ArmorSlot.ArmorSlotClass) {
this.availableArmorPerks.splice(1, 0, ArmorPerkOrSlot.GuardianGamesClassItem)
}
}

toggleArmorPerkLock() {
this.config.modifyConfiguration(c => {
c.armorPerks[this.slot].fixed = !c.armorPerks[this.slot].fixed;
Expand Down
11 changes: 11 additions & 0 deletions src/app/data/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ export interface ChangelogEntry {
}

export const CHANGELOG_DATA = [
{
version: "2.3.2",
date: "May 7, 2023",
entries: [
{
type: ChangelogEntryType.ADD,
text: "Feature: Added 'Guardian Games' class item type to the dropdown. ",
issues: []
}
]
},
{
version: "2.3.1",
date: "April 2, 2023",
Expand Down
5 changes: 5 additions & 0 deletions src/app/data/enum/armor-stat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,14 @@ export enum ArmorPerkOrSlot {
SeraphSensorArray,
SlotRootOfNightmares,
PerkQueensFavor,
// A special case just for guardian games class items.
GuardianGamesClassItem,
COUNT
}

export const ArmorPerkOrSlotNames: EnumDictionary<ArmorPerkOrSlot, string> = {
[ArmorPerkOrSlot.None]: "None",
[ArmorPerkOrSlot.GuardianGamesClassItem]: "Guardian Games",
[ArmorPerkOrSlot.SlotNightmare]: "Nightmare Hunt Modslot",
[ArmorPerkOrSlot.SlotArtifice]: "Artifice Modslot",
[ArmorPerkOrSlot.SlotLastWish]: "Last Wish Modslot",
Expand All @@ -121,6 +124,7 @@ export const ArmorPerkOrSlotNames: EnumDictionary<ArmorPerkOrSlot, string> = {
export const ArmorPerkOrSlotIcons: EnumDictionary<ArmorPerkOrSlot, string> = {
[ArmorPerkOrSlot.None]: "https://www.bungie.net/img/misc/missing_icon_d2.png",
//[ArmorPerkOrSlot.None]: "https://www.bungie.net/common/destiny2_content/icons/58afd7d17e7b58883b94fd5ba2e66b76.png",
[ArmorPerkOrSlot.GuardianGamesClassItem]: "https://www.bungie.net/common/destiny2_content/icons/DestinyEventCardDefinition_ce6c2cf855dce694bcc89803b6bc44b7.png",
[ArmorPerkOrSlot.SlotNightmare]: "https://www.bungie.net/common/destiny2_content/icons/94fe19fb98ae33e79921e3a8aa07800f.jpg",
[ArmorPerkOrSlot.SlotArtifice]: "https://bungie.net/common/destiny2_content/icons/74aeb2f3d7bc16a31a6924822f850184.png",
[ArmorPerkOrSlot.SlotLastWish]: "https://bungie.net/common/destiny2_content/icons/c70116144be386def9e675d76dacfe64.png",
Expand All @@ -140,6 +144,7 @@ export const ArmorPerkOrSlotIcons: EnumDictionary<ArmorPerkOrSlot, string> = {

export const ArmorPerkOrSlotDIMText: EnumDictionary<ArmorPerkOrSlot, string> = {
[ArmorPerkOrSlot.None]: "",
[ArmorPerkOrSlot.GuardianGamesClassItem]: "(hash:537041732 or hash:366019830 or hash:1013401891)",
[ArmorPerkOrSlot.SlotNightmare]: "modslot:nightmare",
[ArmorPerkOrSlot.SlotArtifice]: "perkname:\"artifice armor\"",
[ArmorPerkOrSlot.SlotLastWish]: "modslot:lastwish",
Expand Down
4 changes: 4 additions & 0 deletions src/app/services/bungie-api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,10 @@ export class BungieApiService {


private getArmorPerk(v: DestinyInventoryItemDefinition): ArmorPerkOrSlot {
// Guardian Games
if (environment.featureFlags.enableGuardianGamesFeatures && ( v.hash === 1013401891 || v.hash === 366019830 || v.hash == 537041732) )
return ArmorPerkOrSlot.GuardianGamesClassItem;

if ((v.sockets?.socketEntries.filter(d => d.reusablePlugSetHash == 1259) || []).length > 0)
return ArmorPerkOrSlot.SlotArtifice;

Expand Down

0 comments on commit 6fb58c2

Please sign in to comment.