WIP(shops): fixes and Hall of Heroes update

This commit is contained in:
Sabe Jones
2024-05-16 18:49:56 -05:00
parent 4c13f3193e
commit 6e5b13668a
11 changed files with 33 additions and 58 deletions

View File

@@ -88,7 +88,8 @@ export function castItemVal (itemPath, itemVal) {
if (itemPath.indexOf('items.mounts') === 0) {
// Mounts are true when you own them and null when you have used Keys to the Kennel
// to release them.
// They are never false but allow 'false' to be null in case of user error.
// Empty string or undefined means "unset" i.e. never owned.
if (['', 'undefined'].includes(itemVal)) return undefined;
if (itemVal === 'null' || itemVal === 'false') return null;
if (itemVal) return true; // any truthy value
return null; // any false value
@@ -96,8 +97,8 @@ export function castItemVal (itemPath, itemVal) {
if (itemPath.indexOf('items.gear.owned') === 0) {
// Gear is true when you own it and false if you previously owned it but lost it (e.g., Death)
// It is never null but allow 'null' to be false in case of user error.
if (itemVal === 'false' || itemVal === 'null') return false;
// Null, empty string, or undefined are taken to mean "unset" i.e. never owned.
if (['null', '', 'undefined'].includes(itemVal)) return undefined;
return Boolean(itemVal);
}