Skip to content

Commit

Permalink
feat: Added ability to disable tracking of season rank
Browse files Browse the repository at this point in the history
  • Loading branch information
itssimple committed Oct 7, 2021
1 parent a67717d commit e0eb2f6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/scripts/mainWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ eventEmitter.addEventListener("refresh-window", function (window) {
});

function setLastPlayedCharacter(lastPlayed) {
return;
let lastPlayedClass = document.querySelector("#lastPlayedClass");
let lastPlayedTotalTime = document.querySelector("#lastPlayedTotalTime");

Expand Down Expand Up @@ -80,6 +81,12 @@ async function loadSettings() {
"d2-visible-items"
);

document.getElementById("trackSeasonRank").checked = JSON.parse(
((await db.getItem("d2-track-seasonrank")) ?? "true").toString()
)
? "checked"
: "";

document.getElementById("trackMilestones").checked = JSON.parse(
((await db.getItem("d2-track-milestones")) ?? "true").toString()
)
Expand Down Expand Up @@ -198,6 +205,16 @@ function bindExitButtonEvent(window) {
);
});

document
.getElementById("trackSeasonRank")
.addEventListener("change", async function (event) {
let checked = event.target.checked;

await db.setItem("d2-track-seasonrank", checked);

eventEmitter.emit("tracked-items-changed");
});

document
.getElementById("trackMilestones")
.addEventListener("change", async function (event) {
Expand Down
4 changes: 4 additions & 0 deletions src/scripts/overlayWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ async function updateGoalList(goals) {
case "characterRecord":
addGoal = window.trackingItems.records;
break;
case "seasonrank":
addGoal = window.trackingItems.seasonRank;
break;
}

if (addGoal) {
Expand Down Expand Up @@ -142,6 +145,7 @@ async function loadSettings() {
bounties: JSON.parse((await db.getItem("d2-track-bounties")) ?? true),
quests: JSON.parse((await db.getItem("d2-track-quests")) ?? true),
records: JSON.parse((await db.getItem("d2-track-records")) ?? true),
seasonRank: JSON.parse((await db.getItem("d2-track-seasonrank")) ?? true),
};
}

Expand Down

0 comments on commit e0eb2f6

Please sign in to comment.