function hasItem(itemToCheck) {
      let consumables;

      if (game.system.id === "dnd5e") {
        consumables = tokenInfo.itemList.filter((item) => ((item.type === "consumable") && (item.name.toLowerCase() === itemToCheck.toLowerCase()) && (item.data.quantity > 0)) ?? false);
      }
      if (game.system.id === "pf2e") {
        consumables = tokenInfo.itemList.filter((item) => (item.type === "consumable" && item.name.toLowerCase() === itemToCheck.toLowerCase() && item.data.quantity.value > 0) ?? false);
      }
      if (!consumables) return false;

      return consumables.length > 0 ? consumables : false;
    }
// This also returns true if the game system is not D&D 5e...
This also returns true if the game system is not D&D 5e
This also returns true if the game system is not D&D 5e
function hasItem(itemToCheck) {
      let consumables;
      if (game.system.id === "dnd5e") {
        consumables = tokenInfo.itemList.filter((item) => ((item.type === "consumable") && (item.name.toLowerCase() === itemToCheck.toLowerCase()) && (item.data.quantity > 0)) ?? false);
      }
      if (game.system.id === "pf2e") {
        consumables = tokenInfo.itemList.filter((item) => (item.type === "consumable" && item.name.toLowerCase() === itemToCheck.toLowerCase() && item.data.quantity.value > 0) ?? false);
      }
      if (!consumables) return false;
      return consumables.length > 0 ? consumables : false;
    }
function hasItem ( itemToCheck ) { let consumables ; if ( game . system . id === "dnd5e" ) { consumables = tokenInfo . itemList . filter ( ( item ) => ( ( item . type === "consumable" ) && ( item . name . toLowerCase ( ) === itemToCheck . toLowerCase ( ) ) && ( item . data . quantity > 0 ) ) ?? false ) ; } if ( game . system . id === "pf2e" ) { consumables = tokenInfo . itemList . filter ( ( item ) => ( item . type === "consumable" && item . name . toLowerCase ( ) === itemToCheck . toLowerCase ( ) && item . data . quantity . value > 0 ) ?? false ) ; } if ( ! consumables ) return false ; return consumables . length > 0 ? consumables : false ; }
This also returns true if the game system is not D&D 5e...
This also returns true if the game system is not D&D 5e ...