Backpacks description and categories (#1647)

* backpacks translation

* leather categories

* linter fix

* Linter please

* Описания

* priority in craft

* priorotize

* eng comment

* Update Content.Client/_CP14/Workbench/CP14WorkbenchWindow.xaml.cs
This commit is contained in:
Alexsey Bezyuk
2025-08-11 00:25:34 +10:00
committed by GitHub
parent 44beba9ca6
commit 25df067d3f
14 changed files with 163 additions and 24 deletions

View File

@@ -149,7 +149,24 @@ public sealed partial class CP14WorkbenchWindow : DefaultWindow
OptionCategories.Clear();
OptionCategories.AddItem(Loc.GetString("cp14-recipe-category-all"), AllCategoryId);
foreach (var entry in recipesState.Recipes.OrderByDescending(e => e.Craftable))
// First, we sort all the recipes by priority and category.
var sortedRecipes = recipesState.Recipes
.OrderByDescending(e => e.Craftable)
.ThenByDescending(e =>
{
if (!_prototype.TryIndex(e.ProtoId, out CP14WorkbenchRecipePrototype? recipe))
return 0;
return recipe.Priority;
})
.ThenBy(e =>
{
if (!_prototype.TryIndex(e.ProtoId, out CP14WorkbenchRecipePrototype? recipe) ||
!_prototype.TryIndex(recipe.Category, out CP14WorkbenchRecipeCategoryPrototype? category))
return string.Empty;
return category.ID;
});
foreach (var entry in sortedRecipes)
{
if (!_prototype.TryIndex(entry.ProtoId, out var indexedEntry))
continue;
@@ -169,6 +186,18 @@ public sealed partial class CP14WorkbenchWindow : DefaultWindow
entries.Add(entry);
}
// Sort categories by priority
var sortedCategories = _categories
.OrderByDescending(c =>
{
var categoryProto = _prototype.EnumeratePrototypes<CP14WorkbenchRecipeCategoryPrototype>()
.FirstOrDefault(p => p.Name == c.Key);
return categoryProto?.Priority ?? 0;
})
.ToList();
_categories = sortedCategories.ToDictionary(pair => pair.Key, pair => pair.Value);
var count = 0;
foreach (var category in _categories)
{

View File

@@ -15,4 +15,7 @@ public sealed class CP14WorkbenchRecipeCategoryPrototype : IPrototype
[DataField(required: true)]
public LocId Name;
[DataField]
public int Priority = 0; // In descending order. More means it will be first.
}

View File

@@ -53,4 +53,7 @@ public sealed class CP14WorkbenchRecipePrototype : IPrototype
[DataField]
public ProtoId<CP14WorkbenchRecipeCategoryPrototype>? Category;
[DataField]
public int Priority = 0; // In descending order. More means it will be first.
}

View File

@@ -7,4 +7,11 @@ cp14-recipe-category-weapon = Weapon
cp14-recipe-category-armor = Armor
cp14-recipe-category-carpet = Carpets
cp14-recipe-category-wallpaper = Wallpapers
cp14-recipe-category-clothing = Clothing
cp14-recipe-category-clothing = Clothing
cp14-recipe-category-backpack = Backpacks
cp14-recipe-category-backpack-satchel = Satchels
cp14-recipe-category-backpack-upgrade = Backpack Upgrade
cp14-recipe-category-backpack-satchel-upgrade = Satchel Upgrade
cp14-recipe-category-belt = Belts
cp14-recipe-category-leather = Leather Working

View File

@@ -724,34 +724,34 @@ ent-CP14ClothingBackBackpackT0 = мешок
.desc = Простой тканевый мешок с базовой вместимостью. Легкий, но не очень надежный.
ent-CP14ClothingBackBackpackT1 = рюкзак
.desc = Стандартный рюкзак с приличным объемом хранения. Идеально подходит для повседневного использования. Немного стесняет движения, но защищает спину от ударов!
.desc = Стандартный рюкзак с приличным объемом. Идеален для повседневного использования. Защищает спину от ударов!
ent-CP14ClothingBackBackpackT2 = расширенный рюкзак
.desc = Расширенный рюкзак увеличенной вместимости. Идеально подходит для длительных поездок. Стесняет движения, но защищает спину от ударов и сохраняет тепло!
ent-CP14ClothingBackBackpackT2 = вместительный рюкзак
.desc = Увеличенный рюкзак с большей вместимостью. Идеален для длительных походов. Незначительно сковывает при беге, но защищает спину от ударов и сохраняет тепло!
ent-CP14ClothingBackBackpackT3 = рюкзак путешественника
.desc = Большой, хорошо организованный рюкзак, предназначенный для длительных путешествий, с несколькими отделениями. Значительно стесняет движения, но защищает спину!
ent-CP14ClothingBackBackpackT3 = дорожный рюкзак
.desc = Большой, хорошо организованный рюкзак для длительных путешествий с несколькими отделениями. Сковывает при беге и защищает спину и шею от ударов!.
ent-CP14ClothingBackBackpackReinforced = усиленный рюкзак
.desc = Прочный рюкзак с усиленными швами и материалами для дополнительной защиты ваших вещей. Стесняет движения, но защищает спину от ударов и сохраняет тепло!
ent-CP14ClothingBackBackpackReinforced = укрепленный рюкзак
.desc = Прочный рюкзак с усиленной строчкой и материалами для дополнительной защиты ваших вещей. Сковывает при беге, но зато защищает спину и бока от ударов и сохраняет тепло!
ent-CP14ClothingBackBackpackCargo = грузовая сумка
.desc = Утилитарная грузовая сумка, предназначенная для тяжелых условий эксплуатации. Удобна для переноски и хранения рабочих вещей.
.desc = Утилитарная грузовая сумка для тяжелых условий эксплуатации. Удобна для переноски и хранения рабочих принадлежностей.
ent-CP14ClothingBackSatchelT0 = подсумок
.desc = Небольшой базовый подсумок для переноски предметов первой необходимости. Можно носить на поясе или через плечо.
ent-CP14ClothingBackSatchelT0 = сумка
.desc = Небольшая сумка для переноски необходимых вещей. Можно носить на поясе или через плечо.
ent-CP14ClothingBackSatchelT1 = деревенская сумка
.desc = Кожаная сумка ручной работы с деревенским шармом. Обеспечивает скромное хранение с традиционным стилем. Можно носить на поясе или через плечо. Мешает спринту.
.desc = Ручная кожаная сумка с деревенским шармом. Обеспечивает скромное хранилище в традиционном стиле. Можно носить на поясе или через плечо.
ent-CP14ClothingBackSatchelT2 = курьерская сумка
.desc = Профессиональная сумка, предназначенная для курьеров, с организованными отделениями для быстрого доступа. Мешает спринту.
.desc = Профессиональная сумка, разработанная для курьеров, с организованными отделениями для быстрого доступа.
ent-CP14ClothingBackSatchelT3 = вещмешок
.desc = Прочный вещмешок военного образца с большой вместимостью, предназначенный для длительного использования в полевых условиях. Мешает спринту.
.desc = Прочный вещмешок с большой вместимостью, предназначенный для длительного использования в полевых условиях. Незначительно стесняет движения, но зато может прикрыть спину.
ent-CP14ClothingBackSatchelReinforced = усиленный вещмешок
.desc = Прочный вещмешок с усиленными швами и влагостойкими материалами для тяжелых условий. Мешает спринту.
ent-CP14ClothingBackSatchelReinforced = укрепленная сумка
.desc = Прочная сумка с усиленными швами и водостойкими материалами для тяжелых условий.
ent-CP14ClothingBeltPouchPotions = подсумок для зелий
.desc = Мешочек для хранения зелий - здесь они точно не разобьются.

View File

@@ -7,4 +7,11 @@ cp14-recipe-category-weapon = Оружие
cp14-recipe-category-armor = Броня
cp14-recipe-category-carpet = Ковры
cp14-recipe-category-wallpaper = Обои
cp14-recipe-category-clothing = Одежда
cp14-recipe-category-clothing = Одежда
cp14-recipe-category-backpack = Рюкзаки
cp14-recipe-category-backpack-satchel = Сумки
cp14-recipe-category-backpack-upgrade = Расширение Рюкзака
cp14-recipe-category-backpack-satchel-upgrade = Расширение Сумки
cp14-recipe-category-belt = Пояса
cp14-recipe-category-leather = Кожанный изделия

View File

@@ -42,7 +42,7 @@
id: CP14ClothingBackBackpackT1
name: Backpack
suffix: backpack T1
description: A standard backpack with decent storage space. Perfect for everyday use. It restricts movement a little, but it protects your back from blows!
description: A standard backpack with decent storage space. Perfect for everyday use. It covers your back from blows!
components:
- type: Clothing
slots:
@@ -105,7 +105,7 @@
id: CP14ClothingBackBackpackT3
name: Traveler Backpack
suffix: backpack T3
description: A large, well-organized backpack designed for extensive traveling with multiple compartments. It greatly restricts movement, but it protects your back!
description: A large, well-organized backpack designed for extensive traveling with multiple compartments. It protects your back and neck from blows! But unfortunately, it is not comfortable to run with.
components:
- type: Sprite
sprite: _CP14/Clothing/Back/Backpacks/backpack_t3.rsi

View File

@@ -58,7 +58,7 @@
id: CP14ClothingBackSatchelT1
name: Rustic Satchel
suffix: backpack T1
description: A handcrafted leather satchel with rustic charm. Provides modest storage with traditional styling. Can be worn on the belt or over the shoulder. Interferes with sprinting.
description: A handcrafted leather satchel with rustic charm. Provides modest storage with traditional styling. Can be worn on the belt or over the shoulder.
components:
- type: Clothing
slots:
@@ -87,7 +87,7 @@
id: CP14ClothingBackSatchelT2
name: Courier Satchel
suffix: backpack T2
description: A professional-grade satchel designed for messengers, with organized compartments for quick access. Interferes with sprinting.
description: A professional-grade satchel designed for messengers, with organized compartments for quick access.
components:
- type: Clothing
slots:
@@ -121,7 +121,7 @@
id: CP14ClothingBackSatchelT3
name: Haversack
suffix: backpack T3
description: A sturdy military-style haversack with ample capacity, designed for extended field use. Interferes with sprinting.
description: A sturdy haversack with ample capacity, designed for extended field use. Interferes with sprinting.
components:
- type: Sprite
sprite: _CP14/Clothing/Back/Satchel/satchel_t3.rsi
@@ -161,7 +161,7 @@
id: CP14ClothingBackSatchelReinforced
name: Reinforced Satchel
suffix: backpack T2
description: A heavy-duty satchel with reinforced seams and weather-resistant materials for tough conditions. Interferes with sprinting.
description: A heavy-duty satchel with reinforced seams and weather-resistant materials for tough conditions.
components:
- type: Sprite
sprite: _CP14/Clothing/Back/Satchel/satchel_t2_reinforced.rsi

View File

@@ -2,6 +2,8 @@
- type: CP14Recipe
id: CP14ClothingBackBackpackT0
tag: CP14RecipeLeatherWorking
category: Backpacks
priority: 4
craftTime: 4
requirements:
- !type:StackResource
@@ -15,6 +17,8 @@
- type: CP14Recipe
id: CP14ClothingBackBackpackT1
tag: CP14RecipeLeatherWorking
category: Backpacks
priority: 3
craftTime: 4
requirements:
- !type:StackResource
@@ -29,6 +33,8 @@
- type: CP14Recipe
id: CP14ClothingBackBackpackT2
tag: CP14RecipeLeatherWorking
category: Backpacks
priority: 2
craftTime: 6
requirements:
- !type:StackResource
@@ -46,6 +52,8 @@
- type: CP14Recipe
id: CP14ClothingBackBackpackT3
tag: CP14RecipeLeatherWorking
category: Backpacks
priority: 1
craftTime: 10
requirements:
- !type:StackResource
@@ -68,6 +76,8 @@
- type: CP14Recipe
id: CP14ClothingBackBackpackT1_Upgrade
tag: CP14RecipeLeatherWorking
category: BackpackUpgrade
priority: 3
craftTime: 6
requirements:
- !type:ProtoIdResource
@@ -86,6 +96,8 @@
- type: CP14Recipe
id: CP14ClothingBackBackpackT2_Upgrade
tag: CP14RecipeLeatherWorking
category: BackpackUpgrade
priority: 2
craftTime: 8
requirements:
- !type:ProtoIdResource
@@ -104,6 +116,8 @@
- type: CP14Recipe
id: CP14ClothingBackBackpackT3_Upgrade
tag: CP14RecipeLeatherWorking
category: BackpackUpgrade
priority: 1
craftTime: 12
requirements:
- !type:ProtoIdResource

View File

@@ -2,6 +2,8 @@
# - type: CP14Recipe
# id: CP14ClothingBackExplorerBackpackT0
# tag: CP14RecipeLeatherWorking
# category: Explorers
# priority: 4
# craftTime: 4
# requirements:
# - !type:StackResource
@@ -12,6 +14,8 @@
# - type: CP14Recipe
# id: CP14ClothingBackExplorerBackpackT1
# tag: CP14RecipeLeatherWorking
# category: Explorers
# priority: 3
# craftTime: 4
# requirements:
# - !type:StackResource
@@ -25,6 +29,8 @@
# - type: CP14Recipe
# id: CP14ClothingBackExplorerBackpackT2
# tag: CP14RecipeLeatherWorking
# category: Explorers
# priority: 2
# craftTime: 6
# requirements:
# - !type:StackResource
@@ -41,6 +47,8 @@
# - type: CP14Recipe
# id: CP14ClothingBackExplorerBackpackT3
# tag: CP14RecipeLeatherWorking
# category: Explorers
# priority: 1
# craftTime: 10
# requirements:
# - !type:StackResource
@@ -62,6 +70,8 @@
# - type: CP14Recipe
# id: CP14ClothingBackExplorerBackpackT1_Upgrade
# tag: CP14RecipeLeatherWorking
# category: ExplorerUpgrade
# priority: 3
# craftTime: 6
# requirements:
# - !type:ProtoIdResource
@@ -80,6 +90,8 @@
# - type: CP14Recipe
# id: CP14ClothingBackExplorerBackpackT2_Upgrade
# tag: CP14RecipeLeatherWorking
# category: ExplorerUpgrade
# priority: 2
# craftTime: 8
# requirements:
# - !type:ProtoIdResource
@@ -98,6 +110,8 @@
# - type: CP14Recipe
# id: CP14ClothingBackExplorerBackpackT3_Upgrade
# tag: CP14RecipeLeatherWorking
# category: ExplorerUpgrade
# priority: 1
# craftTime: 12
# requirements:
# - !type:ProtoIdResource

View File

@@ -2,6 +2,8 @@
- type: CP14Recipe
id: CP14ClothingBackSatchelT0
tag: CP14RecipeLeatherWorking
category: Satchels
priority: 4
craftTime: 4
requirements:
- !type:StackResource
@@ -18,6 +20,8 @@
- type: CP14Recipe
id: CP14ClothingBackSatchelT1
tag: CP14RecipeLeatherWorking
category: Satchels
priority: 3
craftTime: 4
requirements:
- !type:StackResource
@@ -31,6 +35,8 @@
- type: CP14Recipe
id: CP14ClothingBackSatchelT2
tag: CP14RecipeLeatherWorking
category: Satchels
priority: 2
craftTime: 6
requirements:
- !type:StackResource
@@ -47,6 +53,8 @@
- type: CP14Recipe
id: CP14ClothingBackSatchelT3
tag: CP14RecipeLeatherWorking
category: Satchels
priority: 1
craftTime: 10
requirements:
- !type:StackResource
@@ -68,6 +76,8 @@
- type: CP14Recipe
id: CP14ClothingBackSatchelT1_Upgrade
tag: CP14RecipeLeatherWorking
category: SatchelUpgrade
priority: 3
craftTime: 6
requirements:
- !type:ProtoIdResource
@@ -86,6 +96,8 @@
- type: CP14Recipe
id: CP14ClothingBackSatchelT2_Upgrade
tag: CP14RecipeLeatherWorking
category: SatchelUpgrade
priority: 2
craftTime: 8
requirements:
- !type:ProtoIdResource
@@ -104,6 +116,8 @@
- type: CP14Recipe
id: CP14ClothingBackSatchelT3_Upgrade
tag: CP14RecipeLeatherWorking
category: SatchelUpgrade
priority: 1
craftTime: 12
requirements:
- !type:ProtoIdResource

View File

@@ -5,6 +5,7 @@
- type: CP14Recipe
id: CP14ClothingBeltQuiverRecipe
tag: CP14RecipeLeatherWorking
category: Belts
craftTime: 1
requirements:
- !type:StackResource
@@ -19,6 +20,7 @@
- type: CP14Recipe
id: CP14ClothingBeltPouchPotionsRecipe
tag: CP14RecipeLeatherWorking
category: Belts
craftTime: 1
requirements:
- !type:StackResource

View File

@@ -6,6 +6,7 @@
- type: CP14Recipe
id: CP14ScrapHideRecipe
tag: CP14RecipeLeatherWorking
category: LeatherWorking
craftTime: 2
requirements:
- !type:ProtoIdResource
@@ -20,6 +21,7 @@
- type: CP14Recipe
id: CP14ThinToRegularHideRecipe
tag: CP14RecipeLeatherWorking
category: LeatherWorking
craftTime: 2
requirements:
- !type:StackResource

View File

@@ -29,3 +29,47 @@
- type: CP14RecipeCategory
id: Clothing
name: cp14-recipe-category-clothing
# =====================================
# Leather Working
- type: CP14RecipeCategory
id: Backpacks
name: cp14-recipe-category-backpack
priority: 8
- type: CP14RecipeCategory
id: Satchels
name: cp14-recipe-category-backpack-satchel
priority: 7
# - type: CP14RecipeCategory # TODO need sprites =(
# id: Explorers
# name: cp14-recipe-category-backpack-explorer
# priority: 6
- type: CP14RecipeCategory
id: BackpackUpgrade
name: cp14-recipe-category-backpack-upgrade
priority: 5
- type: CP14RecipeCategory
id: SatchelUpgrade
name: cp14-recipe-category-backpack-satchel-upgrade
priority: 4
# - type: CP14RecipeCategory
# id: ExplorerUpgrade
# name: cp14-recipe-category-backpack-explorer-upgrade
# priority: 3
- type: CP14RecipeCategory
id: Belts
name: cp14-recipe-category-belt
priority: 2
- type: CP14RecipeCategory
id: LeatherWorking
name: cp14-recipe-category-leather
priority: 1
# =====================================