@c3d.gg/mwi-types 1.8.0 → 1.8.2
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/README.md +18 -133
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @c3d.gg/mwi-types
|
|
2
2
|
|
|
3
|
-
TypeScript types for Milky Way Idle game data.
|
|
3
|
+
TypeScript types and constants for Milky Way Idle game data.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ pnpm add @c3d.gg/mwi-types
|
|
|
10
10
|
|
|
11
11
|
## Import Patterns
|
|
12
12
|
|
|
13
|
-
### Types Only (
|
|
13
|
+
### Types Only (~0KB runtime)
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
16
|
import type { Item, ItemHrid } from '@c3d.gg/mwi-types/items'
|
|
@@ -28,141 +28,26 @@ import { RECIPE_HRIDS, RECIPES_BY_OUTPUT } from '@c3d.gg/mwi-types/recipes'
|
|
|
28
28
|
import { ACTION_HRIDS, ACTIONS_BY_SKILL } from '@c3d.gg/mwi-types/actions'
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
### Raw JSON Data (custom processing)
|
|
32
|
-
|
|
33
|
-
```typescript
|
|
34
|
-
import itemsJson from '@c3d.gg/mwi-types/items/data'
|
|
35
|
-
import recipesJson from '@c3d.gg/mwi-types/recipes/data'
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
### Utils (lazy-loaded data + type guards)
|
|
39
|
-
|
|
40
|
-
```typescript
|
|
41
|
-
// Items
|
|
42
|
-
import { getItem, getAllItems, getItemsByCategory, isItemHrid, isEquipment, isTradable } from '@c3d.gg/mwi-types/items/utils'
|
|
43
|
-
|
|
44
|
-
// Recipes
|
|
45
|
-
import { getRecipe, getAllRecipes, getRecipesForOutput, buildRecipeTree, getTotalMaterials, isRecipeHrid } from '@c3d.gg/mwi-types/recipes/utils'
|
|
46
|
-
|
|
47
|
-
// Actions
|
|
48
|
-
import { getAction, getActionsBySkill, isProductionAction, isCombatAction, isActionHrid } from '@c3d.gg/mwi-types/actions/utils'
|
|
49
|
-
|
|
50
|
-
// Monsters
|
|
51
|
-
import { getMonster, getMonstersByCombatLevel, isMonsterHrid } from '@c3d.gg/mwi-types/monsters/utils'
|
|
52
|
-
|
|
53
|
-
// Skills
|
|
54
|
-
import { isSkillHrid } from '@c3d.gg/mwi-types/skills/utils'
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## Utils Reference
|
|
58
|
-
|
|
59
|
-
### items/utils
|
|
60
|
-
|
|
61
|
-
| Function | Description |
|
|
62
|
-
|----------|-------------|
|
|
63
|
-
| `getItem(hrid)` | Get item by HRID, returns undefined if not found |
|
|
64
|
-
| `requireItem(hrid)` | Get item or throw |
|
|
65
|
-
| `getAllItems()` | Get all items as array |
|
|
66
|
-
| `getItemsByCategory(categoryHrid)` | Filter items by category |
|
|
67
|
-
| `isEquipment(item)` | Check if item has equipment stats |
|
|
68
|
-
| `isTradable(item)` | Check if item can be traded |
|
|
69
|
-
| `isItemHrid(value)` | Type guard for ItemHrid |
|
|
70
|
-
|
|
71
|
-
### recipes/utils
|
|
72
|
-
|
|
73
|
-
| Function | Description |
|
|
74
|
-
|----------|-------------|
|
|
75
|
-
| `getRecipe(hrid)` | Get recipe by HRID |
|
|
76
|
-
| `requireRecipe(hrid)` | Get recipe or throw |
|
|
77
|
-
| `getAllRecipes()` | Get all recipes as array |
|
|
78
|
-
| `getRecipesForOutput(itemHrid)` | Find recipes that produce an item |
|
|
79
|
-
| `buildRecipeTree(itemHrid, qty)` | Build full dependency tree |
|
|
80
|
-
| `getTotalMaterials(node)` | Sum base materials from tree |
|
|
81
|
-
| `isRecipeHrid(value)` | Type guard for RecipeHrid |
|
|
82
|
-
|
|
83
|
-
### actions/utils
|
|
84
|
-
|
|
85
|
-
| Function | Description |
|
|
86
|
-
|----------|-------------|
|
|
87
|
-
| `getAction(hrid)` | Get action by HRID |
|
|
88
|
-
| `getActionsBySkill(skillHrid)` | Filter actions by skill requirement |
|
|
89
|
-
| `isProductionAction(action)` | Check if production action |
|
|
90
|
-
| `isCombatAction(action)` | Check if combat action |
|
|
91
|
-
| `isActionHrid(value)` | Type guard for ActionHrid |
|
|
92
|
-
|
|
93
|
-
### monsters/utils
|
|
94
|
-
|
|
95
|
-
| Function | Description |
|
|
96
|
-
|----------|-------------|
|
|
97
|
-
| `getMonster(hrid)` | Get monster by HRID |
|
|
98
|
-
| `getMonstersByCombatLevel(level)` | Filter by exact combat level |
|
|
99
|
-
| `isMonsterHrid(value)` | Type guard for MonsterHrid |
|
|
100
|
-
|
|
101
|
-
### skills/utils
|
|
102
|
-
|
|
103
|
-
| Function | Description |
|
|
104
|
-
|----------|-------------|
|
|
105
|
-
| `isSkillHrid(value)` | Type guard for SkillHrid |
|
|
106
|
-
|
|
107
|
-
## Usage Examples
|
|
108
|
-
|
|
109
|
-
### Type Guards
|
|
110
|
-
|
|
111
|
-
```typescript
|
|
112
|
-
import { isItemHrid } from '@c3d.gg/mwi-types/items/utils'
|
|
113
|
-
import { isRecipeHrid } from '@c3d.gg/mwi-types/recipes/utils'
|
|
114
|
-
|
|
115
|
-
function processHrid(value: string) {
|
|
116
|
-
if (isItemHrid(value)) {
|
|
117
|
-
// value is now typed as ItemHrid
|
|
118
|
-
}
|
|
119
|
-
if (isRecipeHrid(value)) {
|
|
120
|
-
// value is now typed as RecipeHrid
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### Recipe Tree
|
|
126
|
-
|
|
127
|
-
```typescript
|
|
128
|
-
import { buildRecipeTree, getTotalMaterials } from '@c3d.gg/mwi-types/recipes/utils'
|
|
129
|
-
import type { ItemHrid } from '@c3d.gg/mwi-types/items'
|
|
130
|
-
|
|
131
|
-
const tree = buildRecipeTree('/items/cheese' as ItemHrid, 10)
|
|
132
|
-
const materials = getTotalMaterials(tree)
|
|
133
|
-
// Map<ItemHrid, number> of base materials needed
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
### Item Lookup
|
|
137
|
-
|
|
138
|
-
```typescript
|
|
139
|
-
import { getItem, getItemsByCategory } from '@c3d.gg/mwi-types/items/utils'
|
|
140
|
-
import type { ItemHrid, ItemCategoryHrid } from '@c3d.gg/mwi-types/items'
|
|
141
|
-
|
|
142
|
-
const milk = getItem('/items/milk' as ItemHrid)
|
|
143
|
-
const foods = getItemsByCategory('/item_categories/food' as ItemCategoryHrid)
|
|
144
|
-
```
|
|
145
|
-
|
|
146
31
|
## Available Domains
|
|
147
32
|
|
|
148
|
-
| Domain | Types | Constants |
|
|
149
|
-
|
|
150
|
-
| `/items` | Item, ItemHrid, ItemCategory
|
|
151
|
-
| `/recipes` | Recipe, RecipeHrid
|
|
152
|
-
| `/actions` | Action, ActionHrid, ActionCategory | ACTION_HRIDS, ACTIONS_BY_SKILL |
|
|
153
|
-
| `/monsters` | Monster, MonsterHrid | MONSTER_HRIDS |
|
|
154
|
-
| `/skills` | Skill, SkillHrid | SKILL_HRIDS |
|
|
155
|
-
| `/abilities` | Ability, AbilityHrid | ABILITY_HRIDS |
|
|
156
|
-
| `/buffs` | Buff, BuffType | BUFF_TYPES_HRIDS |
|
|
157
|
-
| `/combat` | CombatStyle, DamageType | COMBAT_STYLE_HRIDS |
|
|
158
|
-
| `/house` | HouseRoom, HouseRoomHrid | HOUSE_ROOM_HRIDS |
|
|
159
|
-
| `/shop` | ShopItem, PurchaseBundle | SHOP_ITEMS_HRIDS |
|
|
160
|
-
| `/tasks` | RandomTaskType | RANDOM_TASK_TYPE_HRIDS |
|
|
161
|
-
| `/leaderboard` | LeaderboardCategory | LEADERBOARD_CATEGORY_HRIDS |
|
|
33
|
+
| Domain | Types | Constants |
|
|
34
|
+
|--------|-------|-----------|
|
|
35
|
+
| `/items` | Item, ItemHrid, ItemCategory | ITEM_HRIDS, ITEMS_BY_CATEGORY |
|
|
36
|
+
| `/recipes` | Recipe, RecipeHrid | RECIPE_HRIDS, RECIPES_BY_OUTPUT |
|
|
37
|
+
| `/actions` | Action, ActionHrid, ActionCategory | ACTION_HRIDS, ACTIONS_BY_SKILL |
|
|
38
|
+
| `/monsters` | Monster, MonsterHrid | MONSTER_HRIDS |
|
|
39
|
+
| `/skills` | Skill, SkillHrid | SKILL_HRIDS |
|
|
40
|
+
| `/abilities` | Ability, AbilityHrid | ABILITY_HRIDS |
|
|
41
|
+
| `/buffs` | Buff, BuffType | BUFF_TYPES_HRIDS |
|
|
42
|
+
| `/combat` | CombatStyle, DamageType | COMBAT_STYLE_HRIDS |
|
|
43
|
+
| `/house` | HouseRoom, HouseRoomHrid | HOUSE_ROOM_HRIDS |
|
|
44
|
+
| `/shop` | ShopItem, PurchaseBundle | SHOP_ITEMS_HRIDS |
|
|
45
|
+
| `/tasks` | RandomTaskType | RANDOM_TASK_TYPE_HRIDS |
|
|
46
|
+
| `/leaderboard` | LeaderboardCategory | LEADERBOARD_CATEGORY_HRIDS |
|
|
162
47
|
|
|
163
48
|
## Main Entry Point
|
|
164
49
|
|
|
165
|
-
|
|
50
|
+
Types and constants re-exported from root:
|
|
166
51
|
|
|
167
52
|
```typescript
|
|
168
53
|
import { ITEM_HRIDS, SKILL_HRIDS, type Item, type Skill } from '@c3d.gg/mwi-types'
|
|
@@ -170,7 +55,7 @@ import { ITEM_HRIDS, SKILL_HRIDS, type Item, type Skill } from '@c3d.gg/mwi-type
|
|
|
170
55
|
|
|
171
56
|
## Auto-Generated
|
|
172
57
|
|
|
173
|
-
|
|
58
|
+
Generated from Milky Way Idle game data. Do not edit `dist/` files.
|
|
174
59
|
|
|
175
60
|
## License
|
|
176
61
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@c3d.gg/mwi-types",
|
|
3
3
|
"displayName": "MWI Types",
|
|
4
4
|
"description": "TypeScript type definitions for Milky Way Idle game data",
|
|
5
|
-
"version": "1.8.
|
|
5
|
+
"version": "1.8.2",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"devDependencies": {
|
|
122
122
|
"@types/node": "^25.1.0",
|
|
123
123
|
"typescript": "^5.9.3",
|
|
124
|
-
"@mwm/config": "1.8.
|
|
124
|
+
"@mwm/config": "1.8.2"
|
|
125
125
|
},
|
|
126
126
|
"scripts": {
|
|
127
127
|
"build": "tsc -p tsconfig.build.json",
|