mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-01-09 14:57:33 +01:00
Augmentation Order (for both purchasing & viewing owned) is now saved as a persistent setting
This commit is contained in:
parent
5ad4dabe6c
commit
f30602ce5d
@ -9,6 +9,9 @@ import {prestigeAugmentation} from "./Prestige";
|
|||||||
import {saveObject} from "./SaveObject";
|
import {saveObject} from "./SaveObject";
|
||||||
import {Script, RunningScript} from "./Script";
|
import {Script, RunningScript} from "./Script";
|
||||||
import {Server} from "./Server";
|
import {Server} from "./Server";
|
||||||
|
import {OwnedAugmentationsOrderSetting} from "./SettingEnums";
|
||||||
|
import {Settings} from "./Settings";
|
||||||
|
|
||||||
import {SourceFiles} from "./SourceFile";
|
import {SourceFiles} from "./SourceFile";
|
||||||
import {dialogBoxCreate} from "../utils/DialogBox";
|
import {dialogBoxCreate} from "../utils/DialogBox";
|
||||||
import {createAccordionElement} from "../utils/uiHelpers/createAccordionElement";
|
import {createAccordionElement} from "../utils/uiHelpers/createAccordionElement";
|
||||||
@ -2570,7 +2573,7 @@ function displayAugmentationsContent() {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
//Sort Buttons
|
//Sort Buttons
|
||||||
Engine.Display.augmentationsContent.appendChild(createElement("a", {
|
const sortInOrderButton = createElement("a", {
|
||||||
class:"a-link-button", fontSize:"14px", innerText:"Sort in Order",
|
class:"a-link-button", fontSize:"14px", innerText:"Sort in Order",
|
||||||
tooltip:"Sorts the Augmentations alphabetically and Source Files in numerical order (1, 2, 3,...)",
|
tooltip:"Sorts the Augmentations alphabetically and Source Files in numerical order (1, 2, 3,...)",
|
||||||
clickListener:()=>{
|
clickListener:()=>{
|
||||||
@ -2587,22 +2590,31 @@ function displayAugmentationsContent() {
|
|||||||
});
|
});
|
||||||
displaySourceFiles(augmentationsList, sourceFiles);
|
displaySourceFiles(augmentationsList, sourceFiles);
|
||||||
displayAugmentations(augmentationsList, augs);
|
displayAugmentations(augmentationsList, augs);
|
||||||
}
|
|
||||||
}));
|
|
||||||
|
|
||||||
Engine.Display.augmentationsContent.appendChild(createElement("a", {
|
Settings.OwnedAugmentationsOrder = OwnedAugmentationsOrderSetting.Alphabetically;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Engine.Display.augmentationsContent.appendChild(sortInOrderButton);
|
||||||
|
|
||||||
|
const sortByAcquirementTimeButton = createElement("a", {
|
||||||
class:"a-link-button", fontSize:"14px", innerText:"Sort by Acquirement Time",
|
class:"a-link-button", fontSize:"14px", innerText:"Sort by Acquirement Time",
|
||||||
tooltip:"Sorts the Augmentations and Source Files based on when you acquired them (same as default)",
|
tooltip:"Sorts the Augmentations and Source Files based on when you acquired them (same as default)",
|
||||||
clickListener:()=>{
|
clickListener:()=>{
|
||||||
removeChildrenFromElement(augmentationsList);
|
removeChildrenFromElement(augmentationsList);
|
||||||
displaySourceFiles(augmentationsList, Player.sourceFiles);
|
displaySourceFiles(augmentationsList, Player.sourceFiles);
|
||||||
displayAugmentations(augmentationsList, Player.augmentations);
|
displayAugmentations(augmentationsList, Player.augmentations);
|
||||||
|
|
||||||
|
Settings.OwnedAugmentationsOrder = OwnedAugmentationsOrderSetting.AcquirementTime;
|
||||||
}
|
}
|
||||||
}));
|
});
|
||||||
|
Engine.Display.augmentationsContent.appendChild(sortByAcquirementTimeButton);
|
||||||
|
|
||||||
//Source Files - Temporary...Will probably put in a separate pane Later
|
//Source Files - Temporary...Will probably put in a separate pane Later
|
||||||
displaySourceFiles(augmentationsList, Player.sourceFiles);
|
if (Settings.OwnedAugmentationsOrder === OwnedAugmentationsOrderSetting.Alphabetically) {
|
||||||
displayAugmentations(augmentationsList, Player.augmentations);
|
sortInOrderButton.click();
|
||||||
|
} else {
|
||||||
|
sortByAcquirementTimeButton.click();
|
||||||
|
}
|
||||||
Engine.Display.augmentationsContent.appendChild(augmentationsList);
|
Engine.Display.augmentationsContent.appendChild(augmentationsList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,6 +523,7 @@ let CONSTANTS = {
|
|||||||
* b1t_flum3.exe now takes significantly less time to create
|
* b1t_flum3.exe now takes significantly less time to create
|
||||||
* Crimes commited through Singularity function no longer give half money/exp
|
* Crimes commited through Singularity function no longer give half money/exp
|
||||||
* Improved number formatting for Player 'work' actions (including crimes, etc.). These numbers should also adhere to locale settings now (by Kline-)
|
* Improved number formatting for Player 'work' actions (including crimes, etc.). These numbers should also adhere to locale settings now (by Kline-)
|
||||||
|
* The order that Augmentations are listed in (when purchasing from Faction and viewing your Augmentations) is now saved and persists when choosing different orders
|
||||||
* Bug Fix: Calling print() in NetscriptJS no longer brings up the print dialog
|
* Bug Fix: Calling print() in NetscriptJS no longer brings up the print dialog
|
||||||
* Bug Fix: Fixed a bug that sometimes caused a blank black screen when destroying/resetting/switching BitNodes
|
* Bug Fix: Fixed a bug that sometimes caused a blank black screen when destroying/resetting/switching BitNodes
|
||||||
* Bug Fix: Netscript calls that throw errors will now no longer cause the 'concurrent calls' error if they are caught in the script. i.e. try/catch should now work properly in scripts
|
* Bug Fix: Netscript calls that throw errors will now no longer cause the 'concurrent calls' error if they are caught in the script. i.e. try/catch should now work properly in scripts
|
||||||
|
@ -7,6 +7,7 @@ import {FactionInfos} from "./FactionInfo";
|
|||||||
import {Locations} from "./Location";
|
import {Locations} from "./Location";
|
||||||
import {HackingMission, setInMission} from "./Missions";
|
import {HackingMission, setInMission} from "./Missions";
|
||||||
import {Player} from "./Player";
|
import {Player} from "./Player";
|
||||||
|
import {PurchaseAugmentationsOrderSetting} from "./SettingEnums";
|
||||||
import {Settings} from "./Settings";
|
import {Settings} from "./Settings";
|
||||||
|
|
||||||
import {Page, routing} from "./ui/navigationTracking";
|
import {Page, routing} from "./ui/navigationTracking";
|
||||||
@ -446,7 +447,6 @@ function displayFactionContent(factionName) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var sortOption = null;
|
|
||||||
function displayFactionAugmentations(factionName) {
|
function displayFactionAugmentations(factionName) {
|
||||||
var faction = Factions[factionName];
|
var faction = Factions[factionName];
|
||||||
if (faction == null) {
|
if (faction == null) {
|
||||||
@ -481,10 +481,10 @@ function displayFactionAugmentations(factionName) {
|
|||||||
var augmentationsList = createElement("ul");
|
var augmentationsList = createElement("ul");
|
||||||
|
|
||||||
//Sort buttons
|
//Sort buttons
|
||||||
var sortByCostBtn = createElement("a", {
|
const sortByCostBtn = createElement("a", {
|
||||||
innerText:"Sort by Cost", class:"a-link-button",
|
innerText:"Sort by Cost", class:"a-link-button",
|
||||||
clickListener:()=>{
|
clickListener:()=>{
|
||||||
sortOption = "cost";
|
Settings.PurchaseAugmentationsOrder = PurchaseAugmentationsOrderSetting.Cost;
|
||||||
var augs = faction.augmentations.slice();
|
var augs = faction.augmentations.slice();
|
||||||
augs.sort((augName1, augName2)=>{
|
augs.sort((augName1, augName2)=>{
|
||||||
var aug1 = Augmentations[augName1], aug2 = Augmentations[augName2];
|
var aug1 = Augmentations[augName1], aug2 = Augmentations[augName2];
|
||||||
@ -497,10 +497,10 @@ function displayFactionAugmentations(factionName) {
|
|||||||
createFactionAugmentationDisplayElements(augmentationsList, augs, faction);
|
createFactionAugmentationDisplayElements(augmentationsList, augs, faction);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var sortByRepBtn = createElement("a", {
|
const sortByRepBtn = createElement("a", {
|
||||||
innerText:"Sort by Reputation", class:"a-link-button",
|
innerText:"Sort by Reputation", class:"a-link-button",
|
||||||
clickListener:()=>{
|
clickListener:()=>{
|
||||||
sortOption = "reputation";
|
Settings.PurchaseAugmentationsOrder = PurchaseAugmentationsOrderSetting.Reputation;
|
||||||
var augs = faction.augmentations.slice();
|
var augs = faction.augmentations.slice();
|
||||||
augs.sort((augName1, augName2)=>{
|
augs.sort((augName1, augName2)=>{
|
||||||
var aug1 = Augmentations[augName1], aug2 = Augmentations[augName2];
|
var aug1 = Augmentations[augName1], aug2 = Augmentations[augName2];
|
||||||
@ -513,10 +513,10 @@ function displayFactionAugmentations(factionName) {
|
|||||||
createFactionAugmentationDisplayElements(augmentationsList, augs, faction);
|
createFactionAugmentationDisplayElements(augmentationsList, augs, faction);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var defaultSortBtn = createElement("a", {
|
const defaultSortBtn = createElement("a", {
|
||||||
innerText:"Sort by Default Order", class:"a-link-button",
|
innerText:"Sort by Default Order", class:"a-link-button",
|
||||||
clickListener:()=>{
|
clickListener:()=>{
|
||||||
sortOption = "default";
|
Settings.PurchaseAugmentationsOrder = PurchaseAugmentationsOrderSetting.Default;
|
||||||
removeChildrenFromElement(augmentationsList);
|
removeChildrenFromElement(augmentationsList);
|
||||||
createFactionAugmentationDisplayElements(augmentationsList, faction.augmentations, faction);
|
createFactionAugmentationDisplayElements(augmentationsList, faction.augmentations, faction);
|
||||||
}
|
}
|
||||||
@ -524,11 +524,11 @@ function displayFactionAugmentations(factionName) {
|
|||||||
elements.push(sortByCostBtn);
|
elements.push(sortByCostBtn);
|
||||||
elements.push(sortByRepBtn);
|
elements.push(sortByRepBtn);
|
||||||
elements.push(defaultSortBtn);
|
elements.push(defaultSortBtn);
|
||||||
switch(sortOption) {
|
switch(Settings.PurchaseAugmentationsOrder) {
|
||||||
case "cost":
|
case PurchaseAugmentationsOrderSetting.Cost:
|
||||||
sortByCostBtn.click();
|
sortByCostBtn.click();
|
||||||
break;
|
break;
|
||||||
case "reputation":
|
case PurchaseAugmentationsOrderSetting.Reputation:
|
||||||
sortByRepBtn.click();
|
sortByRepBtn.click();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
16
src/SettingEnums.ts
Normal file
16
src/SettingEnums.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/**
|
||||||
|
* Enum Of allowed values for the 'OwnedAugmentationsOrder' setting
|
||||||
|
*/
|
||||||
|
export enum OwnedAugmentationsOrderSetting {
|
||||||
|
Alphabetically,
|
||||||
|
AcquirementTime,
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enum Of allowed values for the 'OwnedAugmentationsOrder' setting
|
||||||
|
*/
|
||||||
|
export enum PurchaseAugmentationsOrderSetting {
|
||||||
|
Cost,
|
||||||
|
Default,
|
||||||
|
Reputation,
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
import { ISelfInitializer, ISelfLoading } from "./types";
|
import { ISelfInitializer, ISelfLoading } from "./types";
|
||||||
|
import { OwnedAugmentationsOrderSetting, PurchaseAugmentationsOrderSetting } from "./SettingEnums";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the default settings the player could customize.
|
* Represents the default settings the player could customize.
|
||||||
@ -75,6 +76,16 @@ interface ISettings extends IDefaultSettings {
|
|||||||
* TODO: This should really be an enum of allowed values.
|
* TODO: This should really be an enum of allowed values.
|
||||||
*/
|
*/
|
||||||
EditorTheme: string;
|
EditorTheme: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* What order the player's owned Augmentations/Source Files should be displayed in
|
||||||
|
*/
|
||||||
|
OwnedAugmentationsOrder: OwnedAugmentationsOrderSetting;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* What order the Augmentations should be displayed in when purchasing from a Faction
|
||||||
|
*/
|
||||||
|
PurchaseAugmentationsOrder: PurchaseAugmentationsOrderSetting;
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultSettings: IDefaultSettings = {
|
const defaultSettings: IDefaultSettings = {
|
||||||
@ -104,6 +115,8 @@ export const Settings: ISettings & ISelfInitializer & ISelfLoading = {
|
|||||||
Locale: "en",
|
Locale: "en",
|
||||||
MaxLogCapacity: defaultSettings.MaxLogCapacity,
|
MaxLogCapacity: defaultSettings.MaxLogCapacity,
|
||||||
MaxPortCapacity: defaultSettings.MaxPortCapacity,
|
MaxPortCapacity: defaultSettings.MaxPortCapacity,
|
||||||
|
OwnedAugmentationsOrder: OwnedAugmentationsOrderSetting.AcquirementTime,
|
||||||
|
PurchaseAugmentationsOrder: PurchaseAugmentationsOrderSetting.Default,
|
||||||
SuppressBuyAugmentationConfirmation: defaultSettings.SuppressBuyAugmentationConfirmation,
|
SuppressBuyAugmentationConfirmation: defaultSettings.SuppressBuyAugmentationConfirmation,
|
||||||
SuppressFactionInvites: defaultSettings.SuppressFactionInvites,
|
SuppressFactionInvites: defaultSettings.SuppressFactionInvites,
|
||||||
SuppressHospitalizationPopup: defaultSettings.SuppressHospitalizationPopup,
|
SuppressHospitalizationPopup: defaultSettings.SuppressHospitalizationPopup,
|
||||||
|
Loading…
Reference in New Issue
Block a user