Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
woin2ee committed Feb 11, 2025
2 parents 353281a + 1c3841a commit e5c0d37
Show file tree
Hide file tree
Showing 53 changed files with 1,075 additions and 1,047 deletions.
Binary file added assets/images/items/barnacles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/batilisk_wing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/braised_eggplant.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/cactus_flesh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/cactus_flower.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/cave_banana.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/charred_nostrils.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/cooked_wobster.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/crops_seeds.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/dark_petals.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/dead_wobster.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/deerclops_eyeball.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/dried_kelp_fronds.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/eel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/electric_milk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/extra_smelly_durian.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/fish.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/fish_morsel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/fish_steak.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/foliage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/glow_berry.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/grilled_watermelon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/hot_pumpkin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/juicy_berries.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/lesser_glow_berry.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/items/lichen.png
Binary file added assets/images/items/light_bulb.png
Binary file added assets/images/items/lune_tree_blossom.png
Binary file added assets/images/items/mandrake.png
Binary file added assets/images/items/milky_whites.png
Binary file added assets/images/items/monster_meat.png
Binary file added assets/images/items/moon_moth_wings.png
Binary file added assets/images/items/petals.png
Binary file added assets/images/items/phlegm.png
Binary file added assets/images/items/popcorn.png
Binary file added assets/images/items/popperfish_land.png
Binary file added assets/images/items/prepared_dragon_fruit.png
Binary file added assets/images/items/raw_fish.png
Binary file added assets/images/items/royal_jelly.png
Binary file added assets/images/items/sliced_pomegranate.png
Binary file added assets/images/items/small_jerky.png
Binary file added assets/images/items/succulent.png
Binary file added assets/images/items/winter_koalefant_trunk.png
4 changes: 2 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ Future<void> _clearPrefsIfNeeds() async {

// 버전 명시
const currentVersion = _PrefsVersion(
description: 'Add id(UUID) to `FarmPlantCardModel`',
number: 7,
description: 'Update model of items',
number: 8,
);

clearAndSet() async {
Expand Down
15 changes: 7 additions & 8 deletions lib/models/v1/item/dst_object.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,6 @@ class TurkeyDinner extends RecipeObject implements FoodObject {
MeetRequirement(FoodValues({FoodValue(FoodValueCategory.vegetable, 0.5)})),
MeetRequirement(FoodValues({FoodValue(FoodValueCategory.fruit, 0.5)})),
}),
// TODO: When using Barnacle don't add Vegetable.
}),
);

Expand Down Expand Up @@ -2701,7 +2700,7 @@ class Barnacles implements FoodObject, IngredientObject {
const Barnacles();

@override
String get code => throw UnimplementedError();
String get code => 'barnacle';

@override
String get assetName => 'barnacles';
Expand All @@ -2725,7 +2724,7 @@ class BatiliskWing implements FoodObject, IngredientObject {
const BatiliskWing();

@override
String get code => throw UnimplementedError();
String get code => 'batwing';

@override
String get assetName => 'batilisk_wing';
Expand Down Expand Up @@ -2990,7 +2989,7 @@ class JuicyBerries implements CookableFood, IngredientObject {
const JuicyBerries();

@override
String get code => throw UnimplementedError();
String get code => 'berries_juicy';

@override
String get assetName => 'juicy_berries';
Expand Down Expand Up @@ -3042,7 +3041,7 @@ class WinterKoalefantTrunk implements CookableFood, IngredientObject {
const WinterKoalefantTrunk();

@override
String get code => throw UnimplementedError();
String get code => 'trunk_summer';

@override
String get assetName => 'winter_koalefant_trunk';
Expand All @@ -3051,7 +3050,7 @@ class WinterKoalefantTrunk implements CookableFood, IngredientObject {
String get compositeAssetName => 'koalefant_trunks';

@override
FoodValues? get foodValues => null;
FoodValues? get foodValues => const FoodValues({FoodValue(FoodValueCategory.meat, 1.0)});

@override
String get name => 'Winter Koalefant Trunk';
Expand Down Expand Up @@ -3096,7 +3095,7 @@ class Mandrake implements FoodObject, IngredientObject {
const Mandrake();

@override
String get code => throw UnimplementedError();
String get code => 'mandrake';

@override
String get assetName => 'mandrake';
Expand Down Expand Up @@ -3142,7 +3141,7 @@ class MonsterMeat implements FoodObject, IngredientObject {
const MonsterMeat();

@override
String get code => throw UnimplementedError();
String get code => 'monstermeat';

@override
String get assetName => 'monster_meat';
Expand Down
33 changes: 18 additions & 15 deletions lib/models/v2/item/categories.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@ class Food with _$Food, Item, Edible {
required String assetName,
required FoodType type,
}) = _Food;
}

@freezed
class CookableFood with _$CookableFood, Item, Edible, Cookable {
const factory CookableFood({
@With<Cookable>()
const factory Food.cookable({
required String code,
required String assetName,
required FoodType type,
required String cookedAssetName,
required String? compositeAssetName,
}) = _CookableFood;
}) = CookableFood;
}

@freezed
Expand All @@ -36,16 +34,14 @@ class Ingredient with _$Ingredient, Item, UsingInCrockPot {
required String assetName,
required FoodValues? foodValues,
}) = _Ingredient;
}

@freezed
class EdibleIngredient with _$EdibleIngredient, Item, Edible, UsingInCrockPot {
const factory EdibleIngredient({
@With<Edible>()
const factory Ingredient.edible({
required String code,
required String assetName,
required FoodType type,
required FoodValues? foodValues,
}) = _EdibleIngredient;
}) = EdibleIngredient;
}

@freezed
Expand All @@ -57,7 +53,6 @@ class Plant with _$Plant, Item, Plantable {
required Nutrient nutrient,
}) = _Plant;

@With<Item>()
@With<Edible>()
@With<UsingInCrockPot>()
const factory Plant.crop({
Expand All @@ -70,24 +65,33 @@ class Plant with _$Plant, Item, Plantable {
required Seed seed,
}) = Crop;

@With<Item>()
const factory Plant.weed({
required String code,
required String assetName,
required Nutrient nutrient,
required Set<Season> seasons,
}) = Weed;

@With<Item>()
@With<Edible>()
@With<UsingInCrockPot>()
const factory Plant.forgetMeLots({
required String code,
required String assetName,
required Nutrient nutrient,
required Set<Season> seasons,
required FoodType type,
required FoodValues? foodValues,
}) = ForgetMeLots;

@With<Edible>()
const factory Plant.edibleWeed({
required String code,
required String assetName,
required Nutrient nutrient,
required Set<Season> seasons,
required FoodType type,
}) = EdibleWeed;

factory Plant.fromJson(Map<String, dynamic> json) => _$PlantFromJson(json);
}

Expand All @@ -108,7 +112,7 @@ class Seed with _$Seed, Item, Edible, Cookable {
}

@freezed
class Recipe with _$Recipe, Item, CookableInCrockPot {
class Recipe with _$Recipe, Item, CookableWithCrockPot {
const factory Recipe({
required String code,
required String assetName,
Expand All @@ -121,7 +125,6 @@ class Recipe with _$Recipe, Item, CookableInCrockPot {
required StatusValue cookTimeValue,
}) = _Recipe;

@With<Item>()
@With<Edible>()
const factory Recipe.edible({
required String code,
Expand Down
24 changes: 19 additions & 5 deletions lib/models/v2/item/category_mixins.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import 'package:dst_helper/models/v2/item/food_value.dart';
import 'package:dst_helper/models/v2/item/nutrient.dart';
import 'package:dst_helper/models/v2/item/requirement.dart';

/// It defines the common properties of items.
///
/// The classes that adopt this mixin have `code` identifying the item and `assetName` that it is the same name as the image file.
mixin Item {
String get code;
String get assetName;
Expand All @@ -16,25 +19,36 @@ enum FoodType {
goodies,
}

mixin Edible on Item {
mixin Edible implements Item {
FoodType get type;
}

mixin Cookable on Item {
/// It indicates that the item can be cooked.
///
/// All cooked items have the own cooked name.
/// If the item doesn't have the own cooked name, should not adopt this mixin.
///
/// Some cookable items may have a composite asset that is a combination of the item and the cooked item.
mixin Cookable implements Item {
String get cookedAssetName;
String? get compositeAssetName;
}

mixin Plantable on Item {
/// It indicates plants that grow in the farmplant.
mixin Plantable implements Item {
Set<Season> get seasons;
Nutrient get nutrient;
}

mixin UsingInCrockPot on Item {
/// It indicates that the item can cook in the crock pot.
///
/// The item has the own food values to determine which recipe to be.
mixin UsingInCrockPot implements Item {
FoodValues? get foodValues;
}

mixin CookableInCrockPot on Item {
/// It indicates that the item can be cooked in the crock pot.
mixin CookableWithCrockPot implements Item {
int get priority;
Requirements get requirements;
}
8 changes: 4 additions & 4 deletions lib/models/v2/item/food_value.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@ class FoodValue with _$FoodValue {
@freezed
class FoodValues with _$FoodValues, Iterable {
const factory FoodValues(
Set<FoodValue> rawValues,
List<FoodValue> rawValues,
) = _FoodValues;
const FoodValues._();

factory FoodValues.fromJson(Map<String, Object?> json) => _$FoodValuesFromJson(json);

Set<FoodValue> get values {
for (var category in FoodValueCategory.values) {
var countPerCategory = rawValues.where((foodValue) => foodValue.category == category).length;
for (final category in FoodValueCategory.values) {
final countPerCategory = rawValues.where((foodValue) => foodValue.category == category).length;
if (countPerCategory > 1) assert(false);
}
return rawValues;
return rawValues.toSet();
}

@override
Expand Down
1 change: 1 addition & 0 deletions lib/models/v2/item/item.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export 'categories.dart';
export 'categories_extension.dart';
export 'category_mixins.dart';
export 'food_value.dart';
export 'items.dart';
Expand Down
Loading

0 comments on commit e5c0d37

Please sign in to comment.