Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added setting to show hidden items #611

Merged
merged 5 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
4 changes: 1 addition & 3 deletions dataimporter/titles.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,13 @@
396, # %s the Elite Shaman https://www.wowhead.com/title=646
397, # %s the Elite Warlock https://www.wowhead.com/title=647
398, # %s the Elite Warrior https://www.wowhead.com/title=648
481, # %s the Elite Evoker https://www.wowhead.com/title=742
399, # %s the T-Shirt Enthusiast https://www.wowhead.com/title=649
406, # Sparking %s https://www.wowhead.com/title=658
408, # Pilgrim %s the Mallet Bearer https://www.wowhead.com/title=660
413, # %s, As Themselves https://www.wowhead.com/title=666
436, # %s the Avowed https://www.wowhead.com/title=690
453, # The [PH] TBD Title https://www.wowhead.com/title=713
464, # Hero of Fate https://www.wowhead.com/title=15685
465, # The Shrouded https://www.wowhead.com/title=15689
466, # The Shrouded Hero https://www.wowhead.com/title=15756
467, # Honorary Dryad https://www.wowhead.com/title=728
469 # The Worldbreaker https://www.wowhead.com/title=13931
]
Expand Down
6 changes: 5 additions & 1 deletion src/api/_collectables.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { getShowHiddenSetting } from "../util/utils"

function getHigherQualityBattlePet(currentPet, newPet) {
function getPetsQuality(type) {
switch (type) {
Expand All @@ -23,6 +25,8 @@ export async function parseCollectablesObject(categories, profile, collected_dat
var totalCollected = 0;
var totalPossible = 0;

var showHiddenItems = getShowHiddenSetting();

// Build up lookup for items that character has
collected_data[collectedProperty].forEach((item) => {
if (isBattlePets) {
Expand Down Expand Up @@ -137,7 +141,7 @@ export async function parseCollectablesObject(categories, profile, collected_dat
// 3) You meet the class restriction
// 4) You meet the race restriction
var hasthis = itm.collected;
var showthis = (hasthis || !item.notObtainable);
var showthis = (hasthis || !item.notObtainable || (showHiddenItems == "shown" && !item.notReleased));

if (item.side && item.side !== profile.factionMapped) {
showthis = false;
Expand Down
5 changes: 4 additions & 1 deletion src/api/titles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { getData } from '$api/_blizzard'
import { getProfile } from '$api/profile'
import { getJsonDb } from '$api/_db'
import Cache from '$api/_cache'
import { getShowHiddenSetting } from '../util/utils'

let _cache;
export async function getTitles(region, realm, character) {
Expand Down Expand Up @@ -43,6 +44,8 @@ function parseTitlesObject(db, profile, earned) {
var totalCollected = 0;
var totalPossible = 0;

var showHiddenItems = getShowHiddenSetting();

// Build up lookup for titles that character has
earned.forEach((title) => {
collected[title.id] = title;
Expand Down Expand Up @@ -71,7 +74,7 @@ function parseTitlesObject(db, profile, earned) {
}

var hasthis = item.collected;
var showthis = (hasthis || !item.notObtainable);
var showthis = (hasthis || !item.notObtainable || (showHiddenItems == "shown" && !item.notReleased));

if (item.side && item.side !== profile.factionMapped) {
showthis = false;
Expand Down
12 changes: 12 additions & 0 deletions src/pages/Settings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@
localStorage.setItem("itemSkin", $preferences.itemSkin);
};

const toggleHidden = (e) => {
e.preventDefault();
$preferences.showHidden = $preferences.showHidden == "hidden" ? "shown" : "hidden";

localStorage.setItem('showHidden', $preferences.showHidden);
kevinclement marked this conversation as resolved.
Show resolved Hide resolved
}

function setLocale(e, wowhead_url) {
e.preventDefault();

Expand Down Expand Up @@ -93,6 +100,11 @@
</a>
</div>

<div>
<a href="#/" on:click={toggleHidden}
>{$preferences.showHidden === "hidden" ? "Show Unobtainable Collectibles" : "Hide Unobtainable Collectibles"}
</div>

<div>
Locale
<select
Expand Down
1 change: 1 addition & 0 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
})

$preferences.itemSkin = localStorage.getItem('itemSkin') ?? 'new';
$preferences.showHidden = localStorage.getItem('showHidden') ?? "hidden";
})

function getCharInfoFromURL() {
Expand Down
4 changes: 4 additions & 0 deletions src/util/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ export function getDarkMode(window, cb) {
}
}

export function getShowHiddenSetting() {
return(localStorage.getItem("showHidden"));
}

export function getWowheadUrl() {
if (typeof window !== 'undefined') {
if(localStorage.getItem('wowhead_url'))
Expand Down
Loading