@adatechnology/game-items-goods 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Anderson Fernandes
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,54 @@
1
- # Temporary Holding Version
1
+ # @adatechnology/game-items-goods
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Catalog of real-world items for [`@adatechnology/game-items`](../game-items): **327 items** with their true size (metres) and weight (kg), plus everything the engine needs to use them
4
+ (17 categories, 24 places, 17 containers, 6 rarities, 7 storage kinds, 33 recipes, 9 use effects, the explicit pools of the house furniture, depletion and spawn numbers, ammo boxes,
5
+ melee reach and noise) and the texts in pt-BR (the team's own names) and en. It is data and a thin typed wrapper: no logic, no renderer, no game.
6
+
7
+ The data is **generated** by `tools/items-catalog` from the Vale Cinzento delivery (Itens page, the game, the 3D house viewer) and the household items of the SDK; do not edit
8
+ `src/data/*.json` by hand (except `src/data/locales/en.json`, the English translation, which is kept by hand). Run `pnpm --filter @adatechnology/items-catalog-tool catalog` after changing `decisions.json`.
9
+
10
+ ## Install
11
+
12
+ ```sh
13
+ pnpm add @adatechnology/game-items @adatechnology/game-items-goods
14
+ ```
15
+
16
+ A plain `<script src=".../dist/index.global.js">` exposes the `GameItemsGoods` global (the engine bundled in).
17
+
18
+ ## Usage
19
+
20
+ ```ts
21
+ import { createGoodsItems, goodsPack, GOODS_STRINGS, goodsText } from '@adatechnology/game-items-goods'
22
+ import { createItems, createFindsProvider } from '@adatechnology/game-items'
23
+
24
+ const items = createGoodsItems({ patch: { canned_beans: { weight: 0.5 } }, remove: ['dvd'] }) // goods first, then your packs and options
25
+ // the same, by hand: createItems({ packs: [goodsPack, myPack], ... })
26
+ items.get('hammer').size // [w, h, d] in metres
27
+ createFindsProvider(items).findsFor({ place: 'house', container: 'fridge', state: 'normal', rng, day: 0 })
28
+
29
+ goodsText('item.canned_beans', 'pt-BR') // 'Feijão em lata'
30
+ GOODS_STRINGS.en['place.pharmacy'] // 'Pharmacy'
31
+ ```
32
+
33
+ ## What is in it
34
+
35
+ | Export | Content |
36
+ |---|---|
37
+ | `goodsPack`, `createGoodsItems(options?)` | the `ItemPack` (items, categories, places, containers, use effects, recipes, pools) and `createItems` with it first |
38
+ | `GOODS_ITEMS`, `GOODS_CATEGORIES`, `GOODS_PLACES`, `GOODS_CONTAINERS`, `GOODS_RECIPES`, `GOODS_USE_EFFECTS` | the typed data |
39
+ | `GOODS_HOUSE_POOLS` | explicit pools by the 3D viewer's furniture key, plus the keys that share a pool |
40
+ | `GOODS_TABLES` | rarities, storage, depletion, spawn numbers and melee stats as read (the `DEFAULT_RULES` of the engine are proven equal to them by test) |
41
+ | `GOODS_ARSENAL_RECORDS` | ammo boxes, three firearms and two throwables of the game's `EXTRA`, for `itemsFromArsenal(arsenal, { records })` |
42
+ | `GOODS_PROVENANCE` | per item: the team id, the household id, the viewer pool types, the game ids, and where the id and the measure come from |
43
+ | `GOODS_STRINGS`, `goodsText(key, locale?)`, `pickGoodsLocale` | texts by key: `item.<id>`, `category.<id>`, `place.<id>`, `rarity.<id>`, `container.<id>`, `recipe.<id>` |
44
+
45
+ ## Where the items come from
46
+
47
+ 327 = 245 of the team (the other 12 team items are story items that belong to the game) + 54 household items with no team equivalent + 28 items the catalog needed (pool entries and recipe terms
48
+ the sources lacked). 38 household items were merged with their team equivalent and keep the household id. Measures are the household's where it had one, the model box times a real scale for the 24
49
+ modelled items, and a reference measure for the rest (`provenance.sizeSource`). Story items (diary, military map, evacuation order...) are not here: they live in the game's slice.
50
+
51
+ ## Tests
52
+
53
+ `pnpm --filter @adatechnology/game-items-goods test`: the pack validates in `createItems`, ids are unique and English, every reference (category, place, rarity, pool, recipe, effect) exists, provenance covers
54
+ every item, every key has a text in both languages. The tool's own tests prove the data against the team sources.
@@ -0,0 +1,120 @@
1
+ import { ItemsOptions, ItemsCatalog, ItemPack, ArsenalItemRecord, CategoryDef, ContainerDef, PoolEntry, ItemDef, PlaceDef, RecipeDef, UseEffectDef, FindsProviderOptions, FindsProvider } from '@adatechnology/game-items';
2
+
3
+ /** The pack for `createItems({ packs })`: items, the three categories the game adds, 24 places, 17 containers, house pools, use effects and recipes. */
4
+ declare const goodsPack: ItemPack;
5
+ /** `createItems` with the goods pack first; the packs and options of the game come after and win. */
6
+ declare const createGoodsItems: (options?: ItemsOptions) => ItemsCatalog;
7
+
8
+ /** Where an item of the catalog comes from: the team's item, the household one, the pool types of the 3D house viewer and the game ids. */
9
+ interface ItemProvenance {
10
+ /** The item exists only because `decisions.json` asked for it. */
11
+ created?: true;
12
+ ite?: string;
13
+ household?: string;
14
+ vc3?: readonly string[];
15
+ game?: readonly string[];
16
+ idSource: 'household' | 'merge' | 'decision';
17
+ sizeSource: 'household' | 'REF' | 'model' | 'derived';
18
+ }
19
+ interface RarityRow {
20
+ id: string;
21
+ weight: number;
22
+ isFixedOnly: boolean;
23
+ }
24
+ interface StorageRow {
25
+ id: string;
26
+ multiplier: number;
27
+ needsPower?: true;
28
+ limitDays?: number;
29
+ afterLimit?: number;
30
+ /** Line of the team's page the number was read from. */
31
+ line: number;
32
+ }
33
+ interface DepletionRow {
34
+ places: readonly string[];
35
+ perDay: number;
36
+ floor: number;
37
+ }
38
+ interface MeleeRow {
39
+ id: string;
40
+ reach: number;
41
+ noise: number;
42
+ }
43
+ interface HousePools {
44
+ /** Pools by the key of the 3D house viewer (`geladeira`, `pia`...), as `PoolEntry` of the catalog. */
45
+ pools: Readonly<Record<string, readonly PoolEntry[]>>;
46
+ /** Keys that share another key's pool. */
47
+ aliasOf: Readonly<Record<string, string>>;
48
+ }
49
+ declare const GOODS_ITEMS: readonly ItemDef[];
50
+ declare const GOODS_CATEGORIES: readonly CategoryDef[];
51
+ declare const GOODS_PLACES: readonly PlaceDef[];
52
+ declare const GOODS_CONTAINERS: readonly ContainerDef[];
53
+ declare const GOODS_RECIPES: readonly RecipeDef[];
54
+ declare const GOODS_USE_EFFECTS: readonly UseEffectDef[];
55
+ /** The explicit pools, cut to what `createItems` reads (the viewer's `type`, `name` and `viewerCategory` stay in `data/house-pools.json`). */
56
+ declare const GOODS_HOUSE_POOLS: HousePools;
57
+ /** The team's numbers and tables, as read. The rules in `DEFAULT_RULES` of `game-items` are proven equal to them by test. */
58
+ declare const GOODS_TABLES: {
59
+ readonly rarities: readonly RarityRow[];
60
+ readonly storage: readonly StorageRow[];
61
+ readonly depletion: readonly DepletionRow[];
62
+ readonly spawn: {
63
+ rarityWeights: {
64
+ common: number;
65
+ uncommon: number;
66
+ rare: number;
67
+ very_rare: number;
68
+ };
69
+ fixedOnly: string[];
70
+ condition: {
71
+ common: number[];
72
+ uncommon: number[];
73
+ rare: number[];
74
+ };
75
+ ageShareOfShelfLife: number[];
76
+ batteryCharge: number[];
77
+ jerrycanFill: number[];
78
+ floorItemsPerCell: number;
79
+ gameRarityWeights: {
80
+ c: number;
81
+ i: number;
82
+ r: number;
83
+ mr: number;
84
+ };
85
+ };
86
+ readonly melee: readonly MeleeRow[];
87
+ };
88
+ /** Ammo boxes, three firearms and two throwables as items (the game's `EXTRA` table), for `itemsFromArsenal(arsenal, { records })`. */
89
+ declare const GOODS_ARSENAL_RECORDS: readonly ArsenalItemRecord[];
90
+ declare const GOODS_PROVENANCE: Readonly<Record<string, ItemProvenance>>;
91
+
92
+ type GoodsLocale = 'en' | 'pt-BR';
93
+ /** Texts by key: `item.<id>`, `category.<id>`, `place.<id>`, `rarity.<id>`, `container.<id>`, `recipe.<id>`. The pt-BR names are the team's. */
94
+ type GoodsStrings = Readonly<Record<string, string>>;
95
+ declare const GOODS_STRINGS: Readonly<Record<GoodsLocale, GoodsStrings>>;
96
+ /** `pt`, `pt-BR` and `pt_br` give the Portuguese texts, anything else English. */
97
+ declare const pickGoodsLocale: (locale?: string) => GoodsLocale;
98
+ /** The text of `key`, or the key itself when it has none. */
99
+ declare const goodsText: (key: string, locale?: string) => string;
100
+
101
+ /**
102
+ * Which pool of the visor's `CONTEUDO` each furniture category of the floorplan packs draws from (the team's name on the right is the key of
103
+ * `GOODS_HOUSE_POOLS.pools`). The categories are the ones of the residential MIGRATION table (`geladeira` is `fridge`, `pia` is `kitchen_cabinet`, `aereo` is
104
+ * `overhead_cabinet`, `pia_b` is `washbasin`...). `sapateira` (shoe rack) has no category in the floorplan packs yet.
105
+ */
106
+ declare const FLOORPLAN_POOL_KEYS: Readonly<Record<string, string>>;
107
+ /** The place tags the floorplan templates use (`TemplateDef.place`) that the catalog names differently. */
108
+ declare const FLOORPLAN_PLACES: Readonly<Record<string, string>>;
109
+ /** The explicit pools describe dwellings (the visor draws them for houses); every other place uses the category roll of the container. */
110
+ declare const POOL_PLACES: readonly string[];
111
+ /** `poolAliases` for `createItems`: the furniture categories of the floorplan packs, as keys of the house pools. */
112
+ declare const FLOORPLAN_POOL_ALIASES: Readonly<Record<string, string>>;
113
+ /**
114
+ * The `FindsProvider` for `engine.registerFindsProvider` (`@adatechnology/game-floorplan`): the goods catalog (made with `createGoodsItems`) answers what a
115
+ * piece of furniture holds. The catalog must come from `createGoodsItems` (it carries the aliases of the floorplan categories). Fridges and freezers keep the
116
+ * spoiled food of the abandoned state under their floorplan ids too.
117
+ */
118
+ declare const createGoodsFindsProvider: (catalog: ItemsCatalog, options?: Omit<FindsProviderOptions, "unknownContainers">) => FindsProvider;
119
+
120
+ export { type DepletionRow, FLOORPLAN_PLACES, FLOORPLAN_POOL_ALIASES, FLOORPLAN_POOL_KEYS, GOODS_ARSENAL_RECORDS, GOODS_CATEGORIES, GOODS_CONTAINERS, GOODS_HOUSE_POOLS, GOODS_ITEMS, GOODS_PLACES, GOODS_PROVENANCE, GOODS_RECIPES, GOODS_STRINGS, GOODS_TABLES, GOODS_USE_EFFECTS, type GoodsLocale, type GoodsStrings, type HousePools, type ItemProvenance, type MeleeRow, POOL_PLACES, type RarityRow, type StorageRow, createGoodsFindsProvider, createGoodsItems, goodsPack, goodsText, pickGoodsLocale };