@@ -136,6 +138,11 @@ export default {
name: 'Animal products',
type: ItemTypes.AnimalProducts,
items: this.$store.getters.getAnimalProductsInInventory
+ },
+ {
+ name: 'Prepared meals',
+ type: ItemTypes.PreparedMeals,
+ items: this.$store.getters.getPreparedMealsInInventory
}
]
},
@@ -162,9 +169,12 @@ export default {
showItemInfo(item) {
this.selectedItem = item;
openModal('itemInfoModal');
- console.log(item);
},
trashItems() {
+ if (this.trashQuantity <= 0) {
+ return false;
+ }
+
this.$store.commit('removeItemFromInventory', {item: this.selectedItem, quantity: this.trashQuantity});
iziToast.success({
title: 'Threw away '+this.trashQuantity+' of '+this.selectedItem.name
diff --git a/src/data/ItemTypes.js b/src/data/ItemTypes.js
index 1625d0b..731e8d2 100644
--- a/src/data/ItemTypes.js
+++ b/src/data/ItemTypes.js
@@ -1,11 +1,13 @@
export const ItemTypes = {
Seeds: 'SEEDS',
FieldProducts: 'FIELD_PRODUCTS',
- AnimalProducts: 'ANIMAL_PRODUCTS'
+ AnimalProducts: 'ANIMAL_PRODUCTS',
+ PreparedMeals: 'PREPARED_MEALS'
}
export const ItemTypeFrameClasses = {
SEEDS: 'pixel-border-green ',
FIELD_PRODUCTS: 'pixel-border-red ',
- ANIMAL_PRODUCTS: 'pixel-border-blue '
+ ANIMAL_PRODUCTS: 'pixel-border-blue ',
+ PREPARED_MEALS: 'pixel-border-magenta '
}
\ No newline at end of file
diff --git a/src/data/Items.js b/src/data/Items.js
index 05f5a2d..c37801d 100644
--- a/src/data/Items.js
+++ b/src/data/Items.js
@@ -1,7 +1,7 @@
import {Seasons} from "@/services/SeasonService";
import {ItemTypes} from "@/data/ItemTypes";
import {CropAssets, FoodAssets} from "@/data/Paths";
-import {Seeds, FieldProducts, AnimalProducts} from "@/data/ItemsIDs";
+import {Seeds, FieldProducts, AnimalProducts, PreparedMeals} from "@/data/ItemsIDs";
export default [
{
@@ -66,7 +66,7 @@ export default [
id: Seeds.TurnipSeeds,
name: 'Turnip seeds',
type: ItemTypes.Seeds,
- description: '',
+ description: 'Plant them to get turnips, obviously.',
assetsFolder: CropAssets + 'turnip/',
icon: CropAssets + 'turnip/1.png',
economy: {
@@ -559,7 +559,7 @@ export default [
id: AnimalProducts.Egg,
name: 'Egg',
type: ItemTypes.AnimalProducts,
- description: '',
+ description: 'Which came first?',
assetsFolder: FoodAssets + 'egg_whole_brown.png',
icon: FoodAssets + 'egg_whole_brown.png',
economy: {
@@ -567,5 +567,61 @@ export default [
sell: 50,
}
},
+ {
+ id: PreparedMeals.Sushi,
+ name: 'Sushi',
+ type: ItemTypes.PreparedMeals,
+ description: 'Fishy business.',
+ assetsFolder: FoodAssets + 'sushi_roll.png',
+ icon: FoodAssets + 'sushi_roll.png',
+ economy: {
+ buy: 300,
+ sell: 150,
+ },
+ cooking: {
+ time: 5,
+ ingredients: [
+
+ ]
+ }
+ },
+ {
+ id: PreparedMeals.Nigiri,
+ name: 'Nigiri',
+ type: ItemTypes.PreparedMeals,
+ description: '',
+ assetsFolder: FoodAssets + 'sushi_nigiri.png',
+ icon: FoodAssets + 'sushi_nigiri.png',
+ economy: {
+ buy: 300,
+ sell: 150,
+ },
+ cooking: {
+ time: 5,
+ ingredients: [
+ {id: FieldProducts.Rice, amount: 2},
+ {id: FieldProducts.Rice, amount: 1},
+ ]
+ }
+ },
+ {
+ id: AnimalProducts.RawFish,
+ name: 'Raw fish',
+ type: ItemTypes.AnimalProducts,
+ description: '',
+ assetsFolder: FoodAssets + 'sushi_nigiri.png',
+ icon: FoodAssets + 'sushi_nigiri.png',
+ economy: {
+ buy: 300,
+ sell: 150,
+ },
+ cooking: {
+ time: 5,
+ ingredients: [
+ {id: FieldProducts.Rice, amount: 2},
+ {id: FieldProducts.Rice, amount: 1},
+ ]
+ }
+ },
]
diff --git a/src/data/ItemsIDs.js b/src/data/ItemsIDs.js
index d1b07f3..71c4802 100644
--- a/src/data/ItemsIDs.js
+++ b/src/data/ItemsIDs.js
@@ -46,5 +46,12 @@ export const FieldProducts = {
// ANIMAL PRODUCTS
export const AnimalProducts = {
- Egg: 39 // 💙
+ Egg: 39, // 💙
+ RawFish: 42
+}
+
+// PREPARED MEALS
+export const PreparedMeals = {
+ Sushi: 40,
+ Nigiri: 41
}
diff --git a/src/store/index.js b/src/store/index.js
index 06c6b1c..8382d4d 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -77,6 +77,16 @@ export default createStore({
}).map((inventoryItem) => {
let item = ItemService.getItemByID(inventoryItem.id);
+ item.quantity = inventoryItem.quantity;
+ return item;
+ }) ?? [];
+ },
+ getPreparedMealsInInventory(state) {
+ return state.inventory.filter((inventoryItem) => {
+ return inventoryItem.type === ItemTypes.PreparedMeals && inventoryItem.quantity > 0;
+ }).map((inventoryItem) => {
+ let item = ItemService.getItemByID(inventoryItem.id);
+
item.quantity = inventoryItem.quantity;
return item;
}) ?? [];