diff --git a/CHANGELOG.md b/CHANGELOG.md index b27a9adc90..5faff0b923 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,11 +17,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Admin designated build areas - Indicator text to collectable terrain sprites - You can now autorequest exact change by ctrl-clicking in a trade, and can quick-add individual items with shift-click. -<<<<<<< HEAD - Buy and sell prices in tooltips when trading with a merchant now have colors. -======= - Attacks now emit sound effects from the target on hit. ->>>>>>> e2f8d1d27 (Changelog) +- Crafting menu tabs + ### Changed @@ -31,16 +30,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Separated character randomization buttons into appearance and name. - Reworked mindflayer to have unique attacks - Glowing remains are now `Armor` instead of `Ingredients`. -- Generated a net world map +- Generated a new world map - Overhauled clouds for more verticality and performance - New tooltip for items with stats comparison - Improved bow feedback, added arrow particles -<<<<<<< HEAD - Retiered most sceptres and staves - Loot tables can now recursively reference loot tables -======= - "max_sfx_channels" default now set to 30 ->>>>>>> e2f8d1d27 (Changelog) ### Removed diff --git a/Cargo.lock b/Cargo.lock index 57b6c0fe7a..aea01c2083 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4802,6 +4802,24 @@ dependencies = [ "syn 1.0.67", ] +[[package]] +name = "strum" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7318c509b5ba57f18533982607f24070a55d353e90d4cae30c467cdb2ad5ac5c" + +[[package]] +name = "strum_macros" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee8bc6b87a5112aeeab1f4a9f7ab634fe6cbefc4850006df31267f4cfb9e3149" +dependencies = [ + "heck", + "proc-macro2 1.0.24", + "quote 1.0.9", + "syn 1.0.67", +] + [[package]] name = "sum_type" version = "0.2.0" @@ -5645,6 +5663,8 @@ dependencies = [ "serde", "specs", "specs-idvs", + "strum", + "strum_macros", "tokio", "tracing", "treeculler", diff --git a/assets/common/items/armor/misc/back/backpack.ron b/assets/common/items/armor/misc/back/backpack.ron index 9a67d6c42b..f5fdd69b7a 100644 --- a/assets/common/items/armor/misc/back/backpack.ron +++ b/assets/common/items/armor/misc/back/backpack.ron @@ -9,6 +9,6 @@ ItemDef( ), )), quality: High, - tags: [], + tags: [Bag], slots: 18, ) diff --git a/assets/common/items/armor/misc/bag/heavy_seabag.ron b/assets/common/items/armor/misc/bag/heavy_seabag.ron index 030483a6c9..df86faff5e 100644 --- a/assets/common/items/armor/misc/bag/heavy_seabag.ron +++ b/assets/common/items/armor/misc/bag/heavy_seabag.ron @@ -11,6 +11,6 @@ ItemDef( ) ), quality: Moderate, - tags: [], + tags: [Bag], slots: 14, ) diff --git a/assets/common/items/armor/misc/bag/knitted_red_pouch.ron b/assets/common/items/armor/misc/bag/knitted_red_pouch.ron index 42488de9a9..633ec19a9d 100644 --- a/assets/common/items/armor/misc/bag/knitted_red_pouch.ron +++ b/assets/common/items/armor/misc/bag/knitted_red_pouch.ron @@ -11,6 +11,6 @@ ItemDef( ) ), quality: Moderate, - tags: [], + tags: [Bag], slots: 9, ) diff --git a/assets/common/items/armor/misc/bag/liana_kit.ron b/assets/common/items/armor/misc/bag/liana_kit.ron index 8ccd518c51..642e60b75b 100644 --- a/assets/common/items/armor/misc/bag/liana_kit.ron +++ b/assets/common/items/armor/misc/bag/liana_kit.ron @@ -11,6 +11,6 @@ ItemDef( ) ), quality: Moderate, - tags: [], + tags: [Bag], slots: 12, ) diff --git a/assets/common/items/armor/misc/bag/mindflayer_spellbag.ron b/assets/common/items/armor/misc/bag/mindflayer_spellbag.ron index b976909fcc..ec0f3c0ba0 100644 --- a/assets/common/items/armor/misc/bag/mindflayer_spellbag.ron +++ b/assets/common/items/armor/misc/bag/mindflayer_spellbag.ron @@ -11,6 +11,6 @@ ItemDef( ) ), quality: Epic, - tags: [], + tags: [Bag], slots: 27, ) diff --git a/assets/common/items/armor/misc/bag/reliable_backpack.ron b/assets/common/items/armor/misc/bag/reliable_backpack.ron index 46ee50f283..c5275ae386 100644 --- a/assets/common/items/armor/misc/bag/reliable_backpack.ron +++ b/assets/common/items/armor/misc/bag/reliable_backpack.ron @@ -11,6 +11,6 @@ ItemDef( ) ), quality: High, - tags: [], + tags: [Bag], slots: 16, ) diff --git a/assets/common/items/armor/misc/bag/soulkeeper_cursed.ron b/assets/common/items/armor/misc/bag/soulkeeper_cursed.ron index 239dee216d..2e8d7cd43b 100644 --- a/assets/common/items/armor/misc/bag/soulkeeper_cursed.ron +++ b/assets/common/items/armor/misc/bag/soulkeeper_cursed.ron @@ -11,6 +11,6 @@ ItemDef( ) ), quality: Legendary, - tags: [], + tags: [Bag], slots: 36, ) diff --git a/assets/common/items/armor/misc/bag/soulkeeper_pure.ron b/assets/common/items/armor/misc/bag/soulkeeper_pure.ron index b518e56f4b..911e9ab18c 100644 --- a/assets/common/items/armor/misc/bag/soulkeeper_pure.ron +++ b/assets/common/items/armor/misc/bag/soulkeeper_pure.ron @@ -11,6 +11,6 @@ ItemDef( ) ), quality: Legendary, - tags: [], + tags: [Bag], slots: 36, ) diff --git a/assets/common/items/armor/misc/bag/sturdy_red_backpack.ron b/assets/common/items/armor/misc/bag/sturdy_red_backpack.ron index ac95243400..323d495093 100644 --- a/assets/common/items/armor/misc/bag/sturdy_red_backpack.ron +++ b/assets/common/items/armor/misc/bag/sturdy_red_backpack.ron @@ -11,6 +11,6 @@ ItemDef( ) ), quality: High, - tags: [], + tags: [Bag], slots: 18, ) diff --git a/assets/common/items/armor/misc/bag/tiny_leather_pouch.ron b/assets/common/items/armor/misc/bag/tiny_leather_pouch.ron index 4190c763d2..3b2c2e935e 100644 --- a/assets/common/items/armor/misc/bag/tiny_leather_pouch.ron +++ b/assets/common/items/armor/misc/bag/tiny_leather_pouch.ron @@ -11,6 +11,6 @@ ItemDef( ) ), quality: Common, - tags: [], + tags: [Bag], slots: 6, ) diff --git a/assets/common/items/armor/misc/bag/tiny_red_pouch.ron b/assets/common/items/armor/misc/bag/tiny_red_pouch.ron index 03adf1f18e..fd4c808ec6 100644 --- a/assets/common/items/armor/misc/bag/tiny_red_pouch.ron +++ b/assets/common/items/armor/misc/bag/tiny_red_pouch.ron @@ -11,6 +11,6 @@ ItemDef( ) ), quality: Common, - tags: [], + tags: [Bag], slots: 3, ) diff --git a/assets/common/items/armor/misc/bag/troll_hide_pack.ron b/assets/common/items/armor/misc/bag/troll_hide_pack.ron index 34d688eb75..a708aa157b 100644 --- a/assets/common/items/armor/misc/bag/troll_hide_pack.ron +++ b/assets/common/items/armor/misc/bag/troll_hide_pack.ron @@ -11,6 +11,6 @@ ItemDef( ) ), quality: High, - tags: [], + tags: [Bag], slots: 18, ) diff --git a/assets/common/items/armor/misc/bag/woven_red_bag.ron b/assets/common/items/armor/misc/bag/woven_red_bag.ron index a94a0df64e..a41101896e 100644 --- a/assets/common/items/armor/misc/bag/woven_red_bag.ron +++ b/assets/common/items/armor/misc/bag/woven_red_bag.ron @@ -11,6 +11,6 @@ ItemDef( ) ), quality: Moderate, - tags: [], + tags: [Bag], slots: 15, ) diff --git a/assets/common/items/boss_drops/exp_flask.ron b/assets/common/items/boss_drops/exp_flask.ron index 259600bc98..faa1b1abd5 100644 --- a/assets/common/items/boss_drops/exp_flask.ron +++ b/assets/common/items/boss_drops/exp_flask.ron @@ -5,5 +5,5 @@ ItemDef( kind: "PotionExp", ), quality: High, - tags: [], + tags: [Potion], ) diff --git a/assets/common/items/boss_drops/lantern.ron b/assets/common/items/boss_drops/lantern.ron index cc0b9691ec..eeb23cf6cc 100644 --- a/assets/common/items/boss_drops/lantern.ron +++ b/assets/common/items/boss_drops/lantern.ron @@ -10,5 +10,5 @@ ItemDef( ), ), quality: High, - tags: [], + tags: [Utility], ) diff --git a/assets/common/items/boss_drops/potions.ron b/assets/common/items/boss_drops/potions.ron index 2f786e3580..2fbd66e4eb 100644 --- a/assets/common/items/boss_drops/potions.ron +++ b/assets/common/items/boss_drops/potions.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: High, - tags: [], + tags: [Potion], ) diff --git a/assets/common/items/boss_drops/xp_potion.ron b/assets/common/items/boss_drops/xp_potion.ron index f71e011e60..1dc1d87e04 100644 --- a/assets/common/items/boss_drops/xp_potion.ron +++ b/assets/common/items/boss_drops/xp_potion.ron @@ -5,5 +5,5 @@ ItemDef( kind: "Potion", ), quality: High, - tags: [], + tags: [Potion], ) diff --git a/assets/common/items/consumable/potion_big.ron b/assets/common/items/consumable/potion_big.ron index c0cac92a9b..cb0eeb87f5 100644 --- a/assets/common/items/consumable/potion_big.ron +++ b/assets/common/items/consumable/potion_big.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Potion], ) diff --git a/assets/common/items/consumable/potion_med.ron b/assets/common/items/consumable/potion_med.ron index df55a3ecdb..fb3ebc8227 100644 --- a/assets/common/items/consumable/potion_med.ron +++ b/assets/common/items/consumable/potion_med.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Potion], ) diff --git a/assets/common/items/consumable/potion_minor.ron b/assets/common/items/consumable/potion_minor.ron index 8f79da87b0..219c2e595c 100644 --- a/assets/common/items/consumable/potion_minor.ron +++ b/assets/common/items/consumable/potion_minor.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Potion], ) diff --git a/assets/common/items/crafting_ing/cloth_scraps.ron b/assets/common/items/crafting_ing/cloth_scraps.ron index ad3c6f6a4e..06e32164c6 100644 --- a/assets/common/items/crafting_ing/cloth_scraps.ron +++ b/assets/common/items/crafting_ing/cloth_scraps.ron @@ -5,5 +5,5 @@ ItemDef( kind: "ClothScraps", ), quality: Common, - tags: [], + tags: [BaseMaterial], ) diff --git a/assets/common/items/crafting_ing/cloth_scraps_red.ron b/assets/common/items/crafting_ing/cloth_scraps_red.ron index 1db0028301..dbb1373f50 100644 --- a/assets/common/items/crafting_ing/cloth_scraps_red.ron +++ b/assets/common/items/crafting_ing/cloth_scraps_red.ron @@ -5,5 +5,5 @@ ItemDef( kind: "ClothScrapsRed", ), quality: Common, - tags: [], + tags: [BaseMaterial], ) diff --git a/assets/common/items/crafting_ing/leather_scraps.ron b/assets/common/items/crafting_ing/leather_scraps.ron index 59bda8bcdc..187a77935a 100644 --- a/assets/common/items/crafting_ing/leather_scraps.ron +++ b/assets/common/items/crafting_ing/leather_scraps.ron @@ -5,5 +5,5 @@ ItemDef( kind: "LeatherScraps", ), quality: Common, - tags: [], + tags: [BaseMaterial], ) diff --git a/assets/common/items/crafting_ing/leather_troll.ron b/assets/common/items/crafting_ing/leather_troll.ron index 792db7868e..20856e2109 100644 --- a/assets/common/items/crafting_ing/leather_troll.ron +++ b/assets/common/items/crafting_ing/leather_troll.ron @@ -5,5 +5,5 @@ ItemDef( kind: "TrollLeather", ), quality: High, - tags: [], + tags: [BaseMaterial], ) diff --git a/assets/common/items/crafting_tools/craftsman_hammer.ron b/assets/common/items/crafting_tools/craftsman_hammer.ron index af1b77a203..f8d7f84ae3 100644 --- a/assets/common/items/crafting_tools/craftsman_hammer.ron +++ b/assets/common/items/crafting_tools/craftsman_hammer.ron @@ -5,5 +5,5 @@ ItemDef( kind: "CraftsmanHammer", ), quality: Moderate, - tags: [], + tags: [CraftingTool], ) diff --git a/assets/common/items/crafting_tools/mortar_pestle.ron b/assets/common/items/crafting_tools/mortar_pestle.ron index d91a3b71fe..561eabd0b4 100644 --- a/assets/common/items/crafting_tools/mortar_pestle.ron +++ b/assets/common/items/crafting_tools/mortar_pestle.ron @@ -5,5 +5,5 @@ ItemDef( kind: "MortarPestle", ), quality: Moderate, - tags: [], + tags: [CraftingTool], ) diff --git a/assets/common/items/crafting_tools/sewing_set.ron b/assets/common/items/crafting_tools/sewing_set.ron index d8f5ac2a84..956ce7e669 100644 --- a/assets/common/items/crafting_tools/sewing_set.ron +++ b/assets/common/items/crafting_tools/sewing_set.ron @@ -5,5 +5,5 @@ ItemDef( kind: "SewingSet", ), quality: Moderate, - tags: [], + tags: [CraftingTool], ) diff --git a/assets/common/items/food/apple.ron b/assets/common/items/food/apple.ron index 7325a17485..aa6a35341e 100644 --- a/assets/common/items/food/apple.ron +++ b/assets/common/items/food/apple.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/food/apple_mushroom_curry.ron b/assets/common/items/food/apple_mushroom_curry.ron index 15b823c50a..372b0f5450 100644 --- a/assets/common/items/food/apple_mushroom_curry.ron +++ b/assets/common/items/food/apple_mushroom_curry.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Moderate, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/food/apple_stick.ron b/assets/common/items/food/apple_stick.ron index 0526517431..010f151623 100644 --- a/assets/common/items/food/apple_stick.ron +++ b/assets/common/items/food/apple_stick.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/food/carrot.ron b/assets/common/items/food/carrot.ron index 26afc60568..4e7c888245 100644 --- a/assets/common/items/food/carrot.ron +++ b/assets/common/items/food/carrot.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/food/cheese.ron b/assets/common/items/food/cheese.ron index c245fb296b..3a11c642a0 100644 --- a/assets/common/items/food/cheese.ron +++ b/assets/common/items/food/cheese.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/food/coconut.ron b/assets/common/items/food/coconut.ron index 795a77f014..94732f2cab 100644 --- a/assets/common/items/food/coconut.ron +++ b/assets/common/items/food/coconut.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/food/coltsfoot.ron b/assets/common/items/food/coltsfoot.ron index 3b0f743995..958e4b702e 100644 --- a/assets/common/items/food/coltsfoot.ron +++ b/assets/common/items/food/coltsfoot.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/food/dandelion.ron b/assets/common/items/food/dandelion.ron index f2d2cbcfde..44c46fc993 100644 --- a/assets/common/items/food/dandelion.ron +++ b/assets/common/items/food/dandelion.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/food/fish.ron b/assets/common/items/food/fish.ron index 72bcdb76fa..77041dbb32 100644 --- a/assets/common/items/food/fish.ron +++ b/assets/common/items/food/fish.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/food/garlic.ron b/assets/common/items/food/garlic.ron index 4bd454fe92..16db0b22e5 100644 --- a/assets/common/items/food/garlic.ron +++ b/assets/common/items/food/garlic.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/food/lettuce.ron b/assets/common/items/food/lettuce.ron index 532cfa6cd4..3afb3fc253 100644 --- a/assets/common/items/food/lettuce.ron +++ b/assets/common/items/food/lettuce.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/food/meat.ron b/assets/common/items/food/meat.ron index 711aa62d0e..6f94633577 100644 --- a/assets/common/items/food/meat.ron +++ b/assets/common/items/food/meat.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/food/mushroom.ron b/assets/common/items/food/mushroom.ron index 39714d2aad..e3ce58f273 100644 --- a/assets/common/items/food/mushroom.ron +++ b/assets/common/items/food/mushroom.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/food/mushroom_stick.ron b/assets/common/items/food/mushroom_stick.ron index c399532d38..e756cdf58b 100644 --- a/assets/common/items/food/mushroom_stick.ron +++ b/assets/common/items/food/mushroom_stick.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/food/onion.ron b/assets/common/items/food/onion.ron index 80e7cd6e3d..9733cf05f2 100644 --- a/assets/common/items/food/onion.ron +++ b/assets/common/items/food/onion.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/food/plainsalad.ron b/assets/common/items/food/plainsalad.ron index f7afca3202..d928b978d6 100644 --- a/assets/common/items/food/plainsalad.ron +++ b/assets/common/items/food/plainsalad.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/food/sage.ron b/assets/common/items/food/sage.ron index 7e6f1f56da..360ddb90ac 100644 --- a/assets/common/items/food/sage.ron +++ b/assets/common/items/food/sage.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/food/sunflower_icetea.ron b/assets/common/items/food/sunflower_icetea.ron index bb65f252b0..5497914d26 100644 --- a/assets/common/items/food/sunflower_icetea.ron +++ b/assets/common/items/food/sunflower_icetea.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Moderate, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/food/tomato.ron b/assets/common/items/food/tomato.ron index a4e39753a8..a174bf652d 100644 --- a/assets/common/items/food/tomato.ron +++ b/assets/common/items/food/tomato.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/food/tomatosalad.ron b/assets/common/items/food/tomatosalad.ron index cf8c166d77..6c6f4d35f3 100644 --- a/assets/common/items/food/tomatosalad.ron +++ b/assets/common/items/food/tomatosalad.ron @@ -18,5 +18,5 @@ ItemDef( ] ), quality: Common, - tags: [], + tags: [Food], ) diff --git a/assets/common/items/lantern/black_0.ron b/assets/common/items/lantern/black_0.ron index f54179a990..bc71f40c61 100644 --- a/assets/common/items/lantern/black_0.ron +++ b/assets/common/items/lantern/black_0.ron @@ -10,5 +10,5 @@ ItemDef( ), ), quality: Common, - tags: [], + tags: [Utility], ) diff --git a/assets/common/items/lantern/blue_0.ron b/assets/common/items/lantern/blue_0.ron index f839bb4bd1..7de0286462 100644 --- a/assets/common/items/lantern/blue_0.ron +++ b/assets/common/items/lantern/blue_0.ron @@ -10,5 +10,5 @@ ItemDef( ), ), quality: Common, - tags: [], + tags: [Utility], ) diff --git a/assets/common/items/lantern/geode_purp.ron b/assets/common/items/lantern/geode_purp.ron index cd46922c13..8278353341 100644 --- a/assets/common/items/lantern/geode_purp.ron +++ b/assets/common/items/lantern/geode_purp.ron @@ -10,5 +10,5 @@ ItemDef( ), ), quality: High, - tags: [], + tags: [Utility], ) diff --git a/assets/common/items/lantern/green_0.ron b/assets/common/items/lantern/green_0.ron index 9c1556a5d5..665b336bfe 100644 --- a/assets/common/items/lantern/green_0.ron +++ b/assets/common/items/lantern/green_0.ron @@ -10,5 +10,5 @@ ItemDef( ), ), quality: Common, - tags: [], + tags: [Utility], ) diff --git a/assets/common/items/lantern/red_0.ron b/assets/common/items/lantern/red_0.ron index 53a8517dc7..4ca189dd3e 100644 --- a/assets/common/items/lantern/red_0.ron +++ b/assets/common/items/lantern/red_0.ron @@ -10,5 +10,5 @@ ItemDef( ), ), quality: Common, - tags: [], + tags: [Utility], ) diff --git a/assets/common/items/tag_examples/placeholder.ron b/assets/common/items/tag_examples/placeholder.ron new file mode 100644 index 0000000000..ec0d943878 --- /dev/null +++ b/assets/common/items/tag_examples/placeholder.ron @@ -0,0 +1,10 @@ +ItemDef( + name: "Placeholder", + description: "This is a placeholder because we intend to autogenerate these from the tags later", + kind: Ingredient( + kind: "Placeholder", + ), + quality: Common, + tags: [], +) + diff --git a/assets/common/items/tool/pick.ron b/assets/common/items/tool/pick.ron index 6eabdf874d..e853548c8e 100644 --- a/assets/common/items/tool/pick.ron +++ b/assets/common/items/tool/pick.ron @@ -14,5 +14,5 @@ ItemDef( )), )), quality: Low, - tags: [], + tags: [CraftingTool], ) diff --git a/assets/common/items/utility/bomb.ron b/assets/common/items/utility/bomb.ron index 033e51a644..2ae210512d 100644 --- a/assets/common/items/utility/bomb.ron +++ b/assets/common/items/utility/bomb.ron @@ -5,5 +5,5 @@ ItemDef( kind: Bomb, ), quality: Common, - tags: [], + tags: [Utility], ) diff --git a/assets/common/items/utility/bomb_pile.ron b/assets/common/items/utility/bomb_pile.ron index c906a93ba9..4c4dd1a4f3 100644 --- a/assets/common/items/utility/bomb_pile.ron +++ b/assets/common/items/utility/bomb_pile.ron @@ -6,5 +6,5 @@ ItemDef( amount: 10, ), quality: Common, - tags: [], + tags: [Utility], ) diff --git a/assets/common/items/utility/collar.ron b/assets/common/items/utility/collar.ron index 100b504efe..a431765063 100644 --- a/assets/common/items/utility/collar.ron +++ b/assets/common/items/utility/collar.ron @@ -6,5 +6,5 @@ ItemDef( ), amount: 1, quality: Moderate, - tags: [], + tags: [Utility], ) diff --git a/assets/common/items/utility/firework_blue.ron b/assets/common/items/utility/firework_blue.ron index e4be4e79bd..36153323a2 100644 --- a/assets/common/items/utility/firework_blue.ron +++ b/assets/common/items/utility/firework_blue.ron @@ -5,5 +5,5 @@ ItemDef( kind: Firework(Blue), ), quality: Moderate, - tags: [], + tags: [Utility], ) diff --git a/assets/common/items/utility/firework_green.ron b/assets/common/items/utility/firework_green.ron index 1e28a1fc6c..a30592e845 100644 --- a/assets/common/items/utility/firework_green.ron +++ b/assets/common/items/utility/firework_green.ron @@ -5,5 +5,5 @@ ItemDef( kind: Firework(Green), ), quality: Moderate, - tags: [], + tags: [Utility], ) diff --git a/assets/common/items/utility/firework_purple.ron b/assets/common/items/utility/firework_purple.ron index 2d94a2b174..662739b961 100644 --- a/assets/common/items/utility/firework_purple.ron +++ b/assets/common/items/utility/firework_purple.ron @@ -5,5 +5,5 @@ ItemDef( kind: Firework(Purple), ), quality: Moderate, - tags: [], + tags: [Utility], ) diff --git a/assets/common/items/utility/firework_red.ron b/assets/common/items/utility/firework_red.ron index 647a0ad26a..a86b71f0fc 100644 --- a/assets/common/items/utility/firework_red.ron +++ b/assets/common/items/utility/firework_red.ron @@ -5,5 +5,5 @@ ItemDef( kind: Firework(Red), ), quality: Moderate, - tags: [], + tags: [Utility], ) diff --git a/assets/common/items/utility/firework_white.ron b/assets/common/items/utility/firework_white.ron index 32ce33db71..9b53c6a35f 100644 --- a/assets/common/items/utility/firework_white.ron +++ b/assets/common/items/utility/firework_white.ron @@ -5,5 +5,5 @@ ItemDef( kind: Firework(White), ), quality: Moderate, - tags: [], + tags: [Utility], ) diff --git a/assets/common/items/utility/firework_yellow.ron b/assets/common/items/utility/firework_yellow.ron index 4b855cfb04..96e43dcb0b 100644 --- a/assets/common/items/utility/firework_yellow.ron +++ b/assets/common/items/utility/firework_yellow.ron @@ -5,5 +5,5 @@ ItemDef( kind: Firework(Yellow), ), quality: Moderate, - tags: [], + tags: [Utility], ) diff --git a/assets/common/items/utility/training_dummy.ron b/assets/common/items/utility/training_dummy.ron index 33898f4952..a3522b268e 100644 --- a/assets/common/items/utility/training_dummy.ron +++ b/assets/common/items/utility/training_dummy.ron @@ -5,5 +5,5 @@ ItemDef( kind: TrainingDummy, ), quality: Moderate, - tags: [], + tags: [Utility], ) diff --git a/assets/voxygen/element/icons/armors.png b/assets/voxygen/element/icons/armors.png new file mode 100644 index 0000000000..faacd3f302 --- /dev/null +++ b/assets/voxygen/element/icons/armors.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e0363c8e2d540c4169fd3e2f622f12f6addcef9485cb3747441aca7788f7e4a +size 254 diff --git a/assets/voxygen/element/icons/crafting_tools.png b/assets/voxygen/element/icons/crafting_tools.png new file mode 100644 index 0000000000..ece89a908d --- /dev/null +++ b/assets/voxygen/element/icons/crafting_tools.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ff4ef54c7fb8e79f9d5cef40d1b74d8f333b53d6b073ede39aa0b33fa58201ed +size 390 diff --git a/assets/voxygen/element/icons/dismantle.png b/assets/voxygen/element/icons/dismantle.png new file mode 100644 index 0000000000..4869d0ee48 --- /dev/null +++ b/assets/voxygen/element/icons/dismantle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:768065d08c2407af717020917955ce280f92c00a78c61a45fce4e7e710c2109b +size 250 diff --git a/assets/voxygen/element/icons/endurance.png b/assets/voxygen/element/icons/endurance.png deleted file mode 100644 index ede3667e9b..0000000000 --- a/assets/voxygen/element/icons/endurance.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6376aa744efcbb3acf5cb5e81ec271522185239c030a4071f6c67f3b15903f33 -size 550 diff --git a/assets/voxygen/element/icons/fitness.png b/assets/voxygen/element/icons/fitness.png deleted file mode 100644 index 6e68775f5d..0000000000 --- a/assets/voxygen/element/icons/fitness.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f40b0799bff94dfd23f2b172e672d480a86a86363ad5ce4c969c97762f63d760 -size 697 diff --git a/assets/voxygen/element/icons/foods.png b/assets/voxygen/element/icons/foods.png new file mode 100644 index 0000000000..184e892784 --- /dev/null +++ b/assets/voxygen/element/icons/foods.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:46adc9c7aa0408f1a4d1b7bc63c1ee8b968e0727f4a5832951a5b4d3f1cd337a +size 519 diff --git a/assets/voxygen/element/icons/gliders.png b/assets/voxygen/element/icons/gliders.png new file mode 100644 index 0000000000..8c57b18d8e --- /dev/null +++ b/assets/voxygen/element/icons/gliders.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c9e8640dba0273c250a8594635633e33da26fbef52d86534e2c1495ef2fb6ae5 +size 502 diff --git a/assets/voxygen/element/icons/potions.png b/assets/voxygen/element/icons/potions.png new file mode 100644 index 0000000000..3cb9b0c06c --- /dev/null +++ b/assets/voxygen/element/icons/potions.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e7a3ee008f0be6fc2206412449b6bc30507ec8457acab281164823761cd93ce +size 366 diff --git a/assets/voxygen/element/icons/utilities.png b/assets/voxygen/element/icons/utilities.png new file mode 100644 index 0000000000..37c7790903 --- /dev/null +++ b/assets/voxygen/element/icons/utilities.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:34b1f9c9ca38b564fbeae2f13b39809d175c4a1377a4c51ce94530f4ddab6688 +size 510 diff --git a/assets/voxygen/element/icons/weapons.png b/assets/voxygen/element/icons/weapons.png new file mode 100644 index 0000000000..d3c19a4077 --- /dev/null +++ b/assets/voxygen/element/icons/weapons.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a02c3ec7bacb3455d78a0c7b4dce31f8fadbfc92d1f2cd5d55dbd644878830c7 +size 313 diff --git a/assets/voxygen/element/icons/willpower.png b/assets/voxygen/element/icons/willpower.png deleted file mode 100644 index 7bf2a8328c..0000000000 --- a/assets/voxygen/element/icons/willpower.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:cada9e202c460f1b23eb267114fbbe0ea06daefd91010feff6fcb8dc28723b6f -size 784 diff --git a/assets/voxygen/element/misc_bg/pixel.png b/assets/voxygen/element/misc_bg/pixel.png new file mode 100644 index 0000000000..6c5aa68218 --- /dev/null +++ b/assets/voxygen/element/misc_bg/pixel.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:93c4b21f41c300af84497c511ebc7a4bbf0abed8eb3cc30fd8910239ba63f852 +size 91 diff --git a/assets/voxygen/item_image_manifest.ron b/assets/voxygen/item_image_manifest.ron index 9aca0976d2..8101403edf 100644 --- a/assets/voxygen/item_image_manifest.ron +++ b/assets/voxygen/item_image_manifest.ron @@ -4,6 +4,10 @@ ({ // Weapons // Diary Example Images + Tool("example_utility"): VoxTrans( + "voxel.weapon.projectile.fireworks_green-0", + (0.0, 0.5, 0.0), (-50.0, 40.0, 20.0), 0.8, + ), Tool("example_sword"): VoxTrans( "voxel.weapon.sword.greatsword_2h_dullahan", (0.0, 0.0, 0.0), (90.0, 80.0, 0.0), 1.0, diff --git a/common/src/comp/inventory/item/mod.rs b/common/src/comp/inventory/item/mod.rs index 9b9fea40f2..99cec6222b 100644 --- a/common/src/comp/inventory/item/mod.rs +++ b/common/src/comp/inventory/item/mod.rs @@ -96,6 +96,12 @@ pub enum ItemTag { ModularComponent(ModularComponentTag), MetalIngot, Cultist, + Potion, + Food, + BaseMaterial, // Cloth-scraps, Leather... + CraftingTool, // Pickaxe, Craftsman-Hammer, Sewing-Set + Utility, + Bag, } impl TagExampleInfo for ItemTag { @@ -106,9 +112,16 @@ impl TagExampleInfo for ItemTag { ItemTag::ModularComponent(kind) => kind.name(), ItemTag::MetalIngot => "metal ingot", ItemTag::Cultist => "cultist", + ItemTag::Potion => "potion", + ItemTag::Food => "food", + ItemTag::BaseMaterial => "basemat", + ItemTag::CraftingTool => "tool", + ItemTag::Utility => "utility", + ItemTag::Bag => "bag", } } + // TODO: Autogenerate these? fn exemplar_identifier(&self) -> &'static str { match self { ItemTag::ClothItem => "common.items.tag_examples.cloth_item", @@ -116,6 +129,12 @@ impl TagExampleInfo for ItemTag { ItemTag::ModularComponent(tag) => tag.exemplar_identifier(), ItemTag::MetalIngot => "common.items.tag_examples.metal_ingot", ItemTag::Cultist => "common.items.tag_examples.cultist", + ItemTag::Potion => "common.items.tag_examples.placeholder", + ItemTag::Food => "common.items.tag_examples.placeholder", + ItemTag::BaseMaterial => "common.items.tag_examples.placeholder", + ItemTag::CraftingTool => "common.items.tag_examples.placeholder", + ItemTag::Utility => "common.items.tag_examples.placeholder", + ItemTag::Bag => "common.items.tag_examples.placeholder", } } } diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index b2a35af129..6c3000a0b1 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -71,6 +71,8 @@ deunicode = "1.0" directories-next = "2.0" dot_vox = "4.0" enum-iterator = "0.6" +strum = "0.20" +strum_macros = "0.20" glsl-include = "0.3.1" guillotiere = "0.6" hashbrown = {version = "0.9", features = ["rayon", "serde", "nightly"]} diff --git a/voxygen/src/hud/crafting.rs b/voxygen/src/hud/crafting.rs index 28089484ec..ada943a60c 100644 --- a/voxygen/src/hud/crafting.rs +++ b/voxygen/src/hud/crafting.rs @@ -1,17 +1,22 @@ use super::{ img_ids::{Imgs, ImgsRot}, item_imgs::{animate_by_pulse, ItemImgs}, - TEXT_COLOR, TEXT_DULL_RED_COLOR, TEXT_GRAY_COLOR, UI_HIGHLIGHT_0, UI_MAIN, + Show, TEXT_COLOR, TEXT_DULL_RED_COLOR, TEXT_GRAY_COLOR, UI_HIGHLIGHT_0, UI_MAIN, }; use crate::{ i18n::Localization, - ui::{fonts::Fonts, ImageFrame, ItemTooltip, ItemTooltipManager, ItemTooltipable}, + ui::{ + fonts::Fonts, ImageFrame, ItemTooltip, ItemTooltipManager, ItemTooltipable, Tooltip, + TooltipManager, Tooltipable, + }, }; use client::{self, Client}; use common::{ assets::AssetExt, comp::{ - item::{ItemDef, ItemDesc, MaterialStatManifest, Quality, TagExampleInfo}, + item::{ + ItemDef, ItemDesc, ItemKind, ItemTag, MaterialStatManifest, Quality, TagExampleInfo, + }, Inventory, }, recipe::RecipeInput, @@ -23,6 +28,9 @@ use conrod_core::{ }; use std::sync::Arc; +use strum::IntoEnumIterator; +use strum_macros::EnumIter; + widget_ids! { pub struct Ids { window, @@ -48,11 +56,15 @@ widget_ids! { output_img_frame, output_img, output_amount, + category_bgs[], + category_tabs[], + category_imgs[], } } pub enum Event { CraftRecipe(String), + ChangeCraftingTab(SelectedCraftingTab), Close, } @@ -70,6 +82,8 @@ pub struct Crafting<'a> { msm: &'a MaterialStatManifest, #[conrod(common_builder)] common: widget::CommonBuilder, + tooltip_manager: &'a mut TooltipManager, + show: &'a mut Show, } #[allow(clippy::too_many_arguments)] impl<'a> Crafting<'a> { @@ -84,6 +98,8 @@ impl<'a> Crafting<'a> { item_imgs: &'a ItemImgs, inventory: &'a Inventory, msm: &'a MaterialStatManifest, + tooltip_manager: &'a mut TooltipManager, + show: &'a mut Show, ) -> Self { Self { client, @@ -93,14 +109,29 @@ impl<'a> Crafting<'a> { pulse, rot_imgs, item_tooltip_manager, + tooltip_manager, item_imgs, inventory, msm, + show, common: widget::CommonBuilder::default(), } } } +#[derive(Debug, EnumIter, PartialEq)] +pub enum SelectedCraftingTab { + Armor, + Weapon, + Food, + Dismantle, + Potion, + Bag, + Tool, + Utility, + Glider, +} + pub struct State { ids: Ids, selected_recipe: Option, @@ -132,7 +163,6 @@ impl<'a> Widget for Crafting<'a> { ) }); } - let ids = &state.ids; let mut events = Vec::new(); @@ -162,17 +192,35 @@ impl<'a> Widget for Crafting<'a> { .desc_font_size(self.fonts.cyri.scale(12)) .font_id(self.fonts.cyri.conrod_id) .desc_text_color(TEXT_COLOR); + // Tab tooltips + let tabs_tooltip = Tooltip::new({ + // Edge images [t, b, r, l] + // Corner images [tr, tl, br, bl] + let edge = &self.rot_imgs.tt_side; + let corner = &self.rot_imgs.tt_corner; + ImageFrame::new( + [edge.cw180, edge.none, edge.cw270, edge.cw90], + [corner.none, corner.cw270, corner.cw90, corner.cw180], + Color::Rgba(0.08, 0.07, 0.04, 1.0), + 5.0, + ) + }) + .title_font_size(self.fonts.cyri.scale(15)) + .parent(ui.window) + .desc_font_size(self.fonts.cyri.scale(12)) + .font_id(self.fonts.cyri.conrod_id) + .desc_text_color(TEXT_COLOR); Image::new(self.imgs.crafting_window) .bottom_right_with_margins_on(ui.window, 308.0, 450.0) .color(Some(UI_MAIN)) .w_h(422.0, 460.0) - .set(ids.window, ui); + .set(state.ids.window, ui); Image::new(self.imgs.crafting_frame) - .middle_of(ids.window) + .middle_of(state.ids.window) .color(Some(UI_HIGHLIGHT_0)) .w_h(422.0, 460.0) - .set(ids.window_frame, ui); + .set(state.ids.window_frame, ui); Image::new(self.imgs.crafting_icon_bordered) .w_h(38.0, 38.0) .top_left_with_margins_on(state.ids.window_frame, 4.0, 4.0) @@ -182,8 +230,8 @@ impl<'a> Widget for Crafting<'a> { .w_h(24.0, 25.0) .hover_image(self.imgs.close_button_hover) .press_image(self.imgs.close_button_press) - .top_right_with_margins_on(ids.window, 0.0, 0.0) - .set(ids.close, ui) + .top_right_with_margins_on(state.ids.window, 0.0, 0.0) + .set(state.ids.close, ui) .was_clicked() { events.push(Event::Close); @@ -191,21 +239,119 @@ impl<'a> Widget for Crafting<'a> { // Title Text::new(&self.localized_strings.get("hud.crafting")) - .mid_top_with_margin_on(ids.window_frame, 9.0) + .mid_top_with_margin_on(state.ids.window_frame, 9.0) .font_id(self.fonts.cyri.conrod_id) .font_size(self.fonts.cyri.scale(20)) .color(TEXT_COLOR) - .set(ids.title_main, ui); + .set(state.ids.title_main, ui); // Alignment Rectangle::fill_with([136.0, 378.0], color::TRANSPARENT) - .top_left_with_margins_on(ids.window_frame, 74.0, 5.0) + .top_left_with_margins_on(state.ids.window_frame, 74.0, 5.0) .scroll_kids_vertically() - .set(ids.align_rec, ui); + .set(state.ids.align_rec, ui); Rectangle::fill_with([274.0, 340.0], color::TRANSPARENT) - .top_right_with_margins_on(ids.window, 74.0, 5.0) + .top_right_with_margins_on(state.ids.window, 74.0, 5.0) .scroll_kids_vertically() - .set(ids.align_ing, ui); + .set(state.ids.align_ing, ui); + // Category Tabs + if state.ids.category_bgs.len() < SelectedCraftingTab::iter().enumerate().len() { + state.update(|s| { + s.ids.category_bgs.resize( + SelectedCraftingTab::iter().enumerate().len(), + &mut ui.widget_id_generator(), + ) + }) + }; + if state.ids.category_tabs.len() < SelectedCraftingTab::iter().enumerate().len() { + state.update(|s| { + s.ids.category_tabs.resize( + SelectedCraftingTab::iter().enumerate().len(), + &mut ui.widget_id_generator(), + ) + }) + }; + if state.ids.category_imgs.len() < SelectedCraftingTab::iter().enumerate().len() { + state.update(|s| { + s.ids.category_imgs.resize( + SelectedCraftingTab::iter().enumerate().len(), + &mut ui.widget_id_generator(), + ) + }) + }; + let sel_crafting_tab = &self.show.crafting_tab; + for i in SelectedCraftingTab::iter().enumerate() { + // TODO: i18n! + let tab_name = match i.1 { + SelectedCraftingTab::Armor => "Armor", + SelectedCraftingTab::Dismantle => "Dismantle", + SelectedCraftingTab::Food => "Food", + SelectedCraftingTab::Glider => "Gliders", + SelectedCraftingTab::Potion => "Potions", + SelectedCraftingTab::Tool => "Tools", + SelectedCraftingTab::Utility => "Utility", + SelectedCraftingTab::Weapon => "Weapons", + SelectedCraftingTab::Bag => "Weapons", + }; + let tab_img = match i.1 { + SelectedCraftingTab::Armor => self.imgs.icon_armor, + SelectedCraftingTab::Dismantle => self.imgs.icon_dismantle, + SelectedCraftingTab::Food => self.imgs.icon_food, + SelectedCraftingTab::Glider => self.imgs.icon_glider, + SelectedCraftingTab::Potion => self.imgs.icon_potion, + SelectedCraftingTab::Tool => self.imgs.icon_tools, + SelectedCraftingTab::Utility => self.imgs.icon_utility, + SelectedCraftingTab::Weapon => self.imgs.icon_weapon, + SelectedCraftingTab::Bag => self.imgs.icon_bag, + }; + // Button Background + let mut bg = Image::new(self.imgs.pixel) + .w_h(40.0, 30.0) + .color(Some(UI_MAIN)); + if i.0 == 0 { + bg = bg.top_left_with_margins_on(state.ids.window_frame, 50.0, -40.0) + } else { + bg = bg.down_from(state.ids.category_bgs[i.0 - 1], 0.0) + }; + bg.set(state.ids.category_bgs[i.0], ui); + // Category Button + if Button::image(if i.1 == *sel_crafting_tab { + self.imgs.wpn_icon_border_pressed + } else { + self.imgs.wpn_icon_border + }) + .wh_of(state.ids.category_bgs[i.0]) + .middle_of(state.ids.category_bgs[i.0]) + .hover_image(if i.1 == *sel_crafting_tab { + self.imgs.wpn_icon_border_pressed + } else { + self.imgs.wpn_icon_border_mo + }) + .press_image(if i.1 == *sel_crafting_tab { + self.imgs.wpn_icon_border_pressed + } else { + self.imgs.wpn_icon_border_press + }) + .with_tooltip( + self.tooltip_manager, + tab_name, + "", + &tabs_tooltip, + TEXT_COLOR, + ) + .set(state.ids.category_tabs[i.0], ui) + .was_clicked() + { + events.push(Event::ChangeCraftingTab(i.1)) + }; + // Tab images + Image::new(tab_img) + .middle_of(state.ids.category_tabs[i.0]) + .w_h(20.0, 20.0) + .graphics_for(state.ids.category_tabs[i.0]) + .set(state.ids.category_imgs[i.0], ui); + } + let client = &self.client; // First available recipes, then unavailable ones, each alphabetically // In the triples, "name" is the recipe book key, and "recipe.output.0.name()" @@ -270,9 +416,9 @@ impl<'a> Widget for Crafting<'a> { .label_font_size(self.fonts.cyri.scale(12)) .label_font_id(self.fonts.cyri.conrod_id) .image_color(can_perform.then_some(TEXT_COLOR).unwrap_or(TEXT_GRAY_COLOR)) - .mid_bottom_with_margin_on(ids.align_ing, -31.0) - .parent(ids.window_frame) - .set(ids.btn_craft, ui) + .mid_bottom_with_margin_on(state.ids.align_ing, -31.0) + .parent(state.ids.window_frame) + .set(state.ids.btn_craft, ui) .was_clicked() { events.push(Event::CraftRecipe(recipe.clone())); @@ -299,8 +445,8 @@ impl<'a> Widget for Crafting<'a> { Image::new(quality_col_img) .w_h(60.0, 60.0) .top_right_with_margins_on(state.ids.align_ing, 15.0, 10.0) - .parent(ids.align_ing) - .set(ids.output_img_frame, ui); + .parent(state.ids.align_ing) + .set(state.ids.output_img_frame, ui); if let Some(recipe) = state .selected_recipe @@ -335,7 +481,36 @@ impl<'a> Widget for Crafting<'a> { } // Recipe list - for (i, (name, recipe, quantity)) in ordered_recipes.into_iter().enumerate() { + for (i, (name, recipe, quantity)) in ordered_recipes + .into_iter() + .filter(|(_name, recipe, _quantity)| match &self.show.crafting_tab { + SelectedCraftingTab::Food => recipe.output.0.tags().contains(&ItemTag::Food), + SelectedCraftingTab::Armor => match recipe.output.0.kind() { + ItemKind::Armor(_) => !recipe.output.0.tags().contains(&ItemTag::Bag), + _ => false, + }, + SelectedCraftingTab::Glider => { + matches!(recipe.output.0.kind(), ItemKind::Glider(_)) + }, + SelectedCraftingTab::Potion => recipe.output.0.tags().contains(&ItemTag::Potion), + SelectedCraftingTab::Bag => recipe.output.0.tags().contains(&ItemTag::Bag), + SelectedCraftingTab::Tool => { + recipe.output.0.tags().contains(&ItemTag::CraftingTool) + }, + SelectedCraftingTab::Utility => recipe.output.0.tags().contains(&ItemTag::Utility), + SelectedCraftingTab::Weapon => match recipe.output.0.kind() { + ItemKind::Tool(_) => !recipe.output.0.tags().contains(&ItemTag::CraftingTool), + _ => false, + }, + SelectedCraftingTab::Dismantle => match recipe.output.0.kind() { + ItemKind::Ingredient { .. } => { + !recipe.output.0.tags().contains(&ItemTag::CraftingTool) + }, + _ => false, + }, + }) + .enumerate() + { let button = Button::image( if state .selected_recipe @@ -550,26 +725,24 @@ impl<'a> Widget for Crafting<'a> { } } } - - let ids = &state.ids; // Scrollbars - Scrollbar::y_axis(ids.align_rec) + Scrollbar::y_axis(state.ids.align_rec) .thickness(5.0) .rgba(0.33, 0.33, 0.33, 1.0) - .set(ids.scrollbar_rec, ui); - Scrollbar::y_axis(ids.align_ing) + .set(state.ids.scrollbar_rec, ui); + Scrollbar::y_axis(state.ids.align_ing) .thickness(5.0) .rgba(0.33, 0.33, 0.33, 1.0) - .set(ids.scrollbar_ing, ui); + .set(state.ids.scrollbar_ing, ui); // Title Recipes and Ingredients Text::new(&self.localized_strings.get("hud.crafting.recipes")) - .mid_top_with_margin_on(ids.align_rec, -22.0) + .mid_top_with_margin_on(state.ids.align_rec, -22.0) .font_id(self.fonts.cyri.conrod_id) .font_size(self.fonts.cyri.scale(14)) .color(TEXT_COLOR) - .parent(ids.window) - .set(ids.title_rec, ui); + .parent(state.ids.window) + .set(state.ids.title_rec, ui); events } diff --git a/voxygen/src/hud/img_ids.rs b/voxygen/src/hud/img_ids.rs index 9a5ce71637..baa5f0895b 100644 --- a/voxygen/src/hud/img_ids.rs +++ b/voxygen/src/hud/img_ids.rs @@ -67,6 +67,7 @@ image_ids! { diary_frame: "voxygen.element.misc_bg.diary_frame", diary_exp_bg: "voxygen.element.misc_bg.diary_exp_bg", diary_exp_frame: "voxygen.element.misc_bg.diary_exp_frame", + pixel: "voxygen.element.misc_bg.pixel", // Skill Trees slot_skills: "voxygen.element.buttons.slot_skilltree", @@ -104,6 +105,15 @@ image_ids! { crafting_icon: "voxygen.element.buttons.anvil", crafting_icon_hover: "voxygen.element.buttons.anvil_hover", crafting_icon_press: "voxygen.element.buttons.anvil_press", + icon_armor: "voxygen.element.icons.armors", + icon_tools: "voxygen.element.icons.crafting_tools", + icon_dismantle: "voxygen.element.icons.dismantle", + icon_food: "voxygen.element.icons.foods", + icon_glider: "voxygen.element.icons.gliders", + icon_potion: "voxygen.element.icons.potions", + icon_utility: "voxygen.element.icons.utilities", + icon_weapon: "voxygen.element.icons.weapons", + icon_bag: "voxygen.element.icons.item_bag_leather_large", // Group Window member_frame: "voxygen.element.frames.group_member_frame", diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 413ee7b185..61f79ba9f5 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -31,7 +31,7 @@ use buffs::BuffsBar; use buttons::Buttons; use chat::Chat; use chrono::NaiveTime; -use crafting::Crafting; +use crafting::{Crafting, SelectedCraftingTab}; use diary::{Diary, SelectedSkillTree}; use esc_menu::EscMenu; use group::Group; @@ -544,6 +544,7 @@ pub struct Show { ingame: bool, settings_tab: SettingsTab, skilltreetab: SelectedSkillTree, + crafting_tab: SelectedCraftingTab, social_tab: SocialTab, want_grab: bool, stats: bool, @@ -726,6 +727,10 @@ impl Show { self.skilltreetab = tree_sel; self.social = false; } + + fn selected_crafting_tab(&mut self, sel_cat: SelectedCraftingTab) { + self.crafting_tab = sel_cat; + } } pub struct PromptDialogSettings { @@ -865,6 +870,7 @@ impl Hud { group_menu: false, settings_tab: SettingsTab::Interface, skilltreetab: SelectedSkillTree::General, + crafting_tab: SelectedCraftingTab::Armor, social_tab: SocialTab::Online, want_grab: true, ingame: true, @@ -2431,6 +2437,8 @@ impl Hud { &self.item_imgs, &inventory, &msm, + tooltip_manager, + &mut self.show, ) .set(self.ids.crafting_window, ui_widgets) { @@ -2449,6 +2457,9 @@ impl Hud { self.force_ungrab = true }; }, + crafting::Event::ChangeCraftingTab(sel_cat) => { + self.show.selected_crafting_tab(sel_cat); + }, } } }