@rpg-engine/long-bow 0.4.2 → 0.4.3
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 +20 -20
- package/README.md +181 -181
- package/dist/long-bow.cjs.development.js +1060 -1065
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +1066 -1071
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +100 -100
- package/src/components/Abstractions/ModalPortal.tsx +22 -22
- package/src/components/Abstractions/SlotsContainer.tsx +62 -62
- package/src/components/Arrow/SelectArrow.tsx +69 -69
- package/src/components/Arrow/img/arrow01-left-clicked.png +0 -0
- package/src/components/Arrow/img/arrow01-left.png +0 -0
- package/src/components/Arrow/img/arrow01-right-clicked.png +0 -0
- package/src/components/Arrow/img/arrow01-right.png +0 -0
- package/src/components/Arrow/img/arrow02-left-clicked.png +0 -0
- package/src/components/Arrow/img/arrow02-left.png +0 -0
- package/src/components/Arrow/img/arrow02-right-clicked.png +0 -0
- package/src/components/Arrow/img/arrow02-right.png +0 -0
- package/src/components/Button.tsx +40 -40
- package/src/components/Character/CharacterSelection.tsx +98 -98
- package/src/components/CharacterStatus/CharacterStatus.tsx +120 -120
- package/src/components/Chat/Chat.tsx +196 -196
- package/src/components/Chatdeprecated/ChatDeprecated.tsx +198 -198
- package/src/components/CheckButton.tsx +65 -65
- package/src/components/CircularController/CircularController.tsx +282 -282
- package/src/components/CraftBook/CraftBook.tsx +286 -286
- package/src/components/CraftBook/CraftingRecipe.tsx +161 -161
- package/src/components/CraftBook/MockItems.ts +101 -101
- package/src/components/DraggableContainer.tsx +181 -180
- package/src/components/DropdownSelectorContainer.tsx +42 -42
- package/src/components/Equipment/EquipmentSet.tsx +199 -199
- package/src/components/HistoryDialog.tsx +104 -104
- package/src/components/Input.tsx +15 -15
- package/src/components/InputRadio.tsx +41 -41
- package/src/components/Item/Cards/ItemInfo.tsx +298 -298
- package/src/components/Item/Cards/ItemInfoDisplay.tsx +135 -135
- package/src/components/Item/Cards/ItemInfoWrapper.tsx +62 -62
- package/src/components/Item/Cards/ItemTooltip.tsx +83 -83
- package/src/components/Item/Cards/MobileItemTooltip.tsx +149 -149
- package/src/components/Item/Inventory/ErrorBoundary.tsx +42 -42
- package/src/components/Item/Inventory/ItemContainer.tsx +231 -231
- package/src/components/Item/Inventory/ItemContainerTypes.ts +6 -6
- package/src/components/Item/Inventory/ItemQuantitySelector.tsx +138 -138
- package/src/components/Item/Inventory/ItemSlot.tsx +580 -580
- package/src/components/Item/Inventory/itemContainerHelper.ts +175 -175
- package/src/components/ListMenu.tsx +63 -63
- package/src/components/Marketplace/Marketplace.tsx +132 -132
- package/src/components/Marketplace/MarketplaceRows.tsx +171 -171
- package/src/components/Marketplace/__mocks__/index.tsx +65 -65
- package/src/components/Multitab/Tab.tsx +66 -66
- package/src/components/Multitab/TabBody.tsx +13 -13
- package/src/components/Multitab/TabsContainer.tsx +97 -97
- package/src/components/NPCDialog/NPCDialog.tsx +121 -121
- package/src/components/NPCDialog/NPCDialogText.tsx +113 -113
- package/src/components/NPCDialog/NPCMultiDialog.tsx +159 -159
- package/src/components/NPCDialog/QuestionDialog/QuestionDialog.tsx +237 -237
- package/src/components/ProgressBar.tsx +92 -95
- package/src/components/PropertySelect/PropertySelect.tsx +106 -106
- package/src/components/QuestInfo/QuestInfo.tsx +233 -233
- package/src/components/QuestList.tsx +135 -135
- package/src/components/RPGUIContainer.tsx +47 -47
- package/src/components/RPGUIForceRenderStart.tsx +45 -45
- package/src/components/RPGUIRoot.tsx +14 -14
- package/src/components/RadioButton.tsx +53 -53
- package/src/components/RadioInput/RadioButton.tsx +96 -96
- package/src/components/RadioInput/RadioInput.tsx +102 -102
- package/src/components/RadioInput/instruments.ts +15 -15
- package/src/components/RangeSlider.tsx +78 -78
- package/src/components/RelativeListMenu.tsx +90 -90
- package/src/components/ScrollList.tsx +79 -79
- package/src/components/Shortcuts/Shortcuts.tsx +193 -193
- package/src/components/Shortcuts/ShortcutsSetter.tsx +139 -139
- package/src/components/Shortcuts/SingleShortcut.ts +82 -82
- package/src/components/Shortcuts/useShortcutCooldown.ts +23 -23
- package/src/components/SimpleProgressBar.tsx +62 -62
- package/src/components/SkillProgressBar.tsx +133 -133
- package/src/components/SkillsContainer.tsx +217 -211
- package/src/components/Spellbook/Spell.tsx +236 -236
- package/src/components/Spellbook/Spellbook.tsx +161 -161
- package/src/components/Spellbook/cards/MobileSpellTooltip.tsx +137 -137
- package/src/components/Spellbook/cards/SpellInfo.tsx +134 -134
- package/src/components/Spellbook/cards/SpellInfoDisplay.tsx +31 -31
- package/src/components/Spellbook/cards/SpellInfoWrapper.tsx +48 -48
- package/src/components/Spellbook/cards/SpellTooltip.tsx +70 -70
- package/src/components/Spellbook/constants.ts +7 -7
- package/src/components/Spellbook/mockSpells.ts +84 -84
- package/src/components/StaticBook/StaticBook.tsx +103 -103
- package/src/components/TextArea.tsx +11 -11
- package/src/components/TimeWidget/DayNightPeriod/DayNightPeriod.tsx +35 -35
- package/src/components/TimeWidget/TimeWidget.tsx +65 -65
- package/src/components/TradingMenu/TradingItemRow.tsx +199 -199
- package/src/components/TradingMenu/TradingMenu.tsx +219 -219
- package/src/components/TradingMenu/items.mock.ts +48 -48
- package/src/components/Truncate.tsx +25 -25
- package/src/components/itemSelector/ItemSelector.tsx +136 -136
- package/src/components/shared/Column.tsx +16 -16
- package/src/components/shared/Ellipsis.tsx +68 -68
- package/src/components/shared/SpriteFromAtlas.tsx +104 -104
- package/src/components/typography/DynamicText.tsx +49 -49
- package/src/constants/uiColors.ts +20 -20
- package/src/constants/uiDevices.ts +3 -3
- package/src/constants/uiFonts.ts +12 -12
- package/src/hooks/useEventListener.ts +21 -21
- package/src/hooks/useOutsideAlerter.ts +25 -25
- package/src/index.tsx +42 -42
- package/src/libs/CastingTypeHelper.ts +7 -7
- package/src/libs/StringHelpers.ts +3 -3
- package/src/libs/itemCounter.ts +21 -21
- package/src/mocks/atlas/entities/entities.json +20215 -20215
- package/src/mocks/atlas/icons/icons.json +735 -735
- package/src/mocks/atlas/items/items.json +12086 -12086
- package/src/mocks/equipmentSet.mocks.ts +391 -391
- package/src/mocks/itemContainer.mocks.ts +605 -605
- package/src/mocks/skills.mocks.ts +128 -128
- package/src/stories/Arrow.stories.tsx +26 -26
- package/src/stories/Button.stories.tsx +36 -36
- package/src/stories/CharacterSelection.stories.tsx +44 -44
- package/src/stories/CharacterStatus.stories.tsx +29 -29
- package/src/stories/Chat.stories.tsx +187 -187
- package/src/stories/ChatDeprecated.stories.tsx +170 -170
- package/src/stories/CheckButton.stories.tsx +48 -48
- package/src/stories/CircullarController.stories.tsx +37 -37
- package/src/stories/CraftBook.stories.tsx +42 -42
- package/src/stories/DayNightPeriod.stories.tsx +27 -27
- package/src/stories/DraggableContainer.stories.tsx +28 -28
- package/src/stories/Dropdown.stories.tsx +46 -46
- package/src/stories/DropdownSelectorContainer.stories.tsx +41 -41
- package/src/stories/EquipmentSet.stories.tsx +65 -65
- package/src/stories/HistoryDialog.stories.tsx +61 -61
- package/src/stories/ItemContainer.stories.tsx +201 -201
- package/src/stories/ItemInfoDisplay.stories.tsx +33 -33
- package/src/stories/ItemQuantitySelector.stories.tsx +26 -26
- package/src/stories/ItemSelector.stories.tsx +77 -77
- package/src/stories/ItemTradingComponent.stories.tsx +35 -35
- package/src/stories/ListMenu.stories.tsx +56 -56
- package/src/stories/Marketplace.stories.tsx +42 -42
- package/src/stories/MarketplaceRows.stories.tsx +28 -28
- package/src/stories/Multitab.stories.tsx +51 -51
- package/src/stories/NPCDialog.stories.tsx +130 -130
- package/src/stories/NPCMultiDialog.stories.tsx +71 -71
- package/src/stories/ProgressBar.stories.tsx +23 -23
- package/src/stories/PropertySelect.stories.tsx +40 -40
- package/src/stories/QuestInfo.stories.tsx +107 -107
- package/src/stories/QuestList.stories.tsx +82 -82
- package/src/stories/RPGUIContainers.stories.tsx +42 -42
- package/src/stories/RadioButton.stories.tsx +49 -49
- package/src/stories/RadioInput.stories.tsx +34 -34
- package/src/stories/RangeSlider.stories.tsx +64 -64
- package/src/stories/ScrollList.stories.tsx +85 -85
- package/src/stories/Shortcuts.stories.tsx +39 -39
- package/src/stories/SimpleProgressBar.stories.tsx +22 -22
- package/src/stories/SkillProgressBar.stories.tsx +34 -34
- package/src/stories/SkillsContainer.stories.tsx +35 -35
- package/src/stories/SpellInfoDisplay.stories.tsx +27 -27
- package/src/stories/Spellbook.stories.tsx +104 -104
- package/src/stories/StaticBook.stories.tsx +32 -32
- package/src/stories/Text.stories.tsx +42 -42
- package/src/stories/TimeWidget.stories.tsx +27 -27
- package/src/stories/TradingMenu.stories.tsx +47 -47
- package/src/types/eventTypes.ts +4 -4
- package/src/types/index.d.ts +2 -2
|
@@ -1,161 +1,161 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ICraftableItem,
|
|
3
|
-
IEquipmentSet,
|
|
4
|
-
IItemContainer,
|
|
5
|
-
ISkill,
|
|
6
|
-
} from '@rpg-engine/shared';
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import styled from 'styled-components';
|
|
9
|
-
import { uiColors } from '../../constants/uiColors';
|
|
10
|
-
import { countItemFromInventory } from '../../libs/itemCounter';
|
|
11
|
-
import { ItemInfoWrapper } from '../Item/Cards/ItemInfoWrapper';
|
|
12
|
-
import { SpriteFromAtlas } from '../shared/SpriteFromAtlas';
|
|
13
|
-
|
|
14
|
-
interface ICraftingRecipeProps {
|
|
15
|
-
atlasJSON: any;
|
|
16
|
-
atlasIMG: any;
|
|
17
|
-
equipmentSet?: IEquipmentSet | null;
|
|
18
|
-
recipe: ICraftableItem;
|
|
19
|
-
scale?: number;
|
|
20
|
-
handleRecipeSelect: () => void;
|
|
21
|
-
selectedCraftItemKey?: string;
|
|
22
|
-
inventory?: IItemContainer | null;
|
|
23
|
-
skills?: ISkill | null;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const CraftingRecipe: React.FC<ICraftingRecipeProps> = ({
|
|
27
|
-
atlasIMG,
|
|
28
|
-
atlasJSON,
|
|
29
|
-
equipmentSet,
|
|
30
|
-
recipe,
|
|
31
|
-
scale,
|
|
32
|
-
handleRecipeSelect,
|
|
33
|
-
selectedCraftItemKey,
|
|
34
|
-
inventory,
|
|
35
|
-
skills,
|
|
36
|
-
}) => {
|
|
37
|
-
const modifyString = (str: string) => {
|
|
38
|
-
// Split the string by "/" and "."
|
|
39
|
-
let parts = str.split('/');
|
|
40
|
-
let fileName = parts[parts.length - 1];
|
|
41
|
-
parts = fileName.split('.');
|
|
42
|
-
let name = parts[0];
|
|
43
|
-
|
|
44
|
-
// Replace all occurrences of "-" with " "
|
|
45
|
-
name = name.replace(/-/g, ' ');
|
|
46
|
-
|
|
47
|
-
// Uppercase the first word
|
|
48
|
-
let words = name.split(' ');
|
|
49
|
-
let firstWord = words[0].slice(0, 1).toUpperCase() + words[0].slice(1);
|
|
50
|
-
let modifiedWords = [firstWord].concat(words.slice(1));
|
|
51
|
-
name = modifiedWords.join(' ');
|
|
52
|
-
|
|
53
|
-
return name;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const levelInSkill =
|
|
57
|
-
(skills?.[
|
|
58
|
-
(recipe?.minCraftingRequirements?.[0] ?? '') as keyof ISkill
|
|
59
|
-
] as any)?.level ?? 1;
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<RadioOptionsWrapper>
|
|
63
|
-
<SpriteAtlasWrapper>
|
|
64
|
-
<ItemInfoWrapper
|
|
65
|
-
item={recipe}
|
|
66
|
-
atlasIMG={atlasIMG}
|
|
67
|
-
atlasJSON={atlasJSON}
|
|
68
|
-
equipmentSet={equipmentSet}
|
|
69
|
-
scale={scale}
|
|
70
|
-
>
|
|
71
|
-
<SpriteFromAtlas
|
|
72
|
-
atlasIMG={atlasIMG}
|
|
73
|
-
atlasJSON={atlasJSON}
|
|
74
|
-
spriteKey={recipe.texturePath}
|
|
75
|
-
imgScale={3}
|
|
76
|
-
grayScale={!recipe.canCraft}
|
|
77
|
-
/>
|
|
78
|
-
</ItemInfoWrapper>
|
|
79
|
-
</SpriteAtlasWrapper>
|
|
80
|
-
<div>
|
|
81
|
-
<div onPointerUp={recipe.canCraft ? handleRecipeSelect : undefined}>
|
|
82
|
-
<input
|
|
83
|
-
className="rpgui-radio"
|
|
84
|
-
type="radio"
|
|
85
|
-
value={recipe.name}
|
|
86
|
-
name="test"
|
|
87
|
-
disabled={!recipe.canCraft}
|
|
88
|
-
checked={selectedCraftItemKey === recipe.key}
|
|
89
|
-
onChange={handleRecipeSelect}
|
|
90
|
-
/>
|
|
91
|
-
<label style={{ display: 'flex', alignItems: 'center' }}>
|
|
92
|
-
{modifyString(recipe.name)}
|
|
93
|
-
</label>
|
|
94
|
-
</div>
|
|
95
|
-
|
|
96
|
-
<MinCraftingRequirementsText levelIsOk={recipe?.levelIsOk ?? false}>
|
|
97
|
-
{modifyString(`${recipe?.minCraftingRequirements?.[0] ?? ''}`)} lvl{' '}
|
|
98
|
-
{recipe?.minCraftingRequirements?.[1] ?? 0} ({levelInSkill})
|
|
99
|
-
</MinCraftingRequirementsText>
|
|
100
|
-
|
|
101
|
-
{recipe.ingredients.map((ingredient, index) => {
|
|
102
|
-
const itemQtyInInventory = !inventory
|
|
103
|
-
? 0
|
|
104
|
-
: countItemFromInventory(ingredient.key, inventory);
|
|
105
|
-
|
|
106
|
-
return (
|
|
107
|
-
<Recipe key={index}>
|
|
108
|
-
<SpriteFromAtlas
|
|
109
|
-
atlasIMG={atlasIMG}
|
|
110
|
-
atlasJSON={atlasJSON}
|
|
111
|
-
spriteKey={ingredient.texturePath}
|
|
112
|
-
imgScale={1.2}
|
|
113
|
-
/>
|
|
114
|
-
<Ingredient isQuantityOk={ingredient.qty <= itemQtyInInventory}>
|
|
115
|
-
{modifyString(ingredient.key)} x{ingredient.qty} (
|
|
116
|
-
{itemQtyInInventory})
|
|
117
|
-
</Ingredient>
|
|
118
|
-
</Recipe>
|
|
119
|
-
);
|
|
120
|
-
})}
|
|
121
|
-
</div>
|
|
122
|
-
</RadioOptionsWrapper>
|
|
123
|
-
);
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const Ingredient = styled.p<{ isQuantityOk: boolean }>`
|
|
127
|
-
margin: 0;
|
|
128
|
-
margin-left: 14px;
|
|
129
|
-
color: ${({ isQuantityOk }) =>
|
|
130
|
-
isQuantityOk ? uiColors.lightGreen : uiColors.lightGray} !important;
|
|
131
|
-
`;
|
|
132
|
-
|
|
133
|
-
const Recipe = styled.div`
|
|
134
|
-
font-size: 0.6rem;
|
|
135
|
-
margin-bottom: 3px;
|
|
136
|
-
display: flex;
|
|
137
|
-
align-items: center;
|
|
138
|
-
margin-left: 4px;
|
|
139
|
-
|
|
140
|
-
.sprite-from-atlas-img {
|
|
141
|
-
top: 0px;
|
|
142
|
-
left: 0px;
|
|
143
|
-
}
|
|
144
|
-
`;
|
|
145
|
-
|
|
146
|
-
const SpriteAtlasWrapper = styled.div`
|
|
147
|
-
margin-right: 40px;
|
|
148
|
-
`;
|
|
149
|
-
|
|
150
|
-
const RadioOptionsWrapper = styled.div`
|
|
151
|
-
display: flex;
|
|
152
|
-
align-items: stretch;
|
|
153
|
-
margin-bottom: 40px;
|
|
154
|
-
`;
|
|
155
|
-
|
|
156
|
-
const MinCraftingRequirementsText = styled.p<{ levelIsOk: boolean }>`
|
|
157
|
-
font-size: 0.6rem !important;
|
|
158
|
-
margin: 0 5px 0 35px;
|
|
159
|
-
color: ${({ levelIsOk }) =>
|
|
160
|
-
levelIsOk ? uiColors.lightGreen : uiColors.lightGray} !important;
|
|
161
|
-
`;
|
|
1
|
+
import {
|
|
2
|
+
ICraftableItem,
|
|
3
|
+
IEquipmentSet,
|
|
4
|
+
IItemContainer,
|
|
5
|
+
ISkill,
|
|
6
|
+
} from '@rpg-engine/shared';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import styled from 'styled-components';
|
|
9
|
+
import { uiColors } from '../../constants/uiColors';
|
|
10
|
+
import { countItemFromInventory } from '../../libs/itemCounter';
|
|
11
|
+
import { ItemInfoWrapper } from '../Item/Cards/ItemInfoWrapper';
|
|
12
|
+
import { SpriteFromAtlas } from '../shared/SpriteFromAtlas';
|
|
13
|
+
|
|
14
|
+
interface ICraftingRecipeProps {
|
|
15
|
+
atlasJSON: any;
|
|
16
|
+
atlasIMG: any;
|
|
17
|
+
equipmentSet?: IEquipmentSet | null;
|
|
18
|
+
recipe: ICraftableItem;
|
|
19
|
+
scale?: number;
|
|
20
|
+
handleRecipeSelect: () => void;
|
|
21
|
+
selectedCraftItemKey?: string;
|
|
22
|
+
inventory?: IItemContainer | null;
|
|
23
|
+
skills?: ISkill | null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const CraftingRecipe: React.FC<ICraftingRecipeProps> = ({
|
|
27
|
+
atlasIMG,
|
|
28
|
+
atlasJSON,
|
|
29
|
+
equipmentSet,
|
|
30
|
+
recipe,
|
|
31
|
+
scale,
|
|
32
|
+
handleRecipeSelect,
|
|
33
|
+
selectedCraftItemKey,
|
|
34
|
+
inventory,
|
|
35
|
+
skills,
|
|
36
|
+
}) => {
|
|
37
|
+
const modifyString = (str: string) => {
|
|
38
|
+
// Split the string by "/" and "."
|
|
39
|
+
let parts = str.split('/');
|
|
40
|
+
let fileName = parts[parts.length - 1];
|
|
41
|
+
parts = fileName.split('.');
|
|
42
|
+
let name = parts[0];
|
|
43
|
+
|
|
44
|
+
// Replace all occurrences of "-" with " "
|
|
45
|
+
name = name.replace(/-/g, ' ');
|
|
46
|
+
|
|
47
|
+
// Uppercase the first word
|
|
48
|
+
let words = name.split(' ');
|
|
49
|
+
let firstWord = words[0].slice(0, 1).toUpperCase() + words[0].slice(1);
|
|
50
|
+
let modifiedWords = [firstWord].concat(words.slice(1));
|
|
51
|
+
name = modifiedWords.join(' ');
|
|
52
|
+
|
|
53
|
+
return name;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const levelInSkill =
|
|
57
|
+
(skills?.[
|
|
58
|
+
(recipe?.minCraftingRequirements?.[0] ?? '') as keyof ISkill
|
|
59
|
+
] as any)?.level ?? 1;
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<RadioOptionsWrapper>
|
|
63
|
+
<SpriteAtlasWrapper>
|
|
64
|
+
<ItemInfoWrapper
|
|
65
|
+
item={recipe}
|
|
66
|
+
atlasIMG={atlasIMG}
|
|
67
|
+
atlasJSON={atlasJSON}
|
|
68
|
+
equipmentSet={equipmentSet}
|
|
69
|
+
scale={scale}
|
|
70
|
+
>
|
|
71
|
+
<SpriteFromAtlas
|
|
72
|
+
atlasIMG={atlasIMG}
|
|
73
|
+
atlasJSON={atlasJSON}
|
|
74
|
+
spriteKey={recipe.texturePath}
|
|
75
|
+
imgScale={3}
|
|
76
|
+
grayScale={!recipe.canCraft}
|
|
77
|
+
/>
|
|
78
|
+
</ItemInfoWrapper>
|
|
79
|
+
</SpriteAtlasWrapper>
|
|
80
|
+
<div>
|
|
81
|
+
<div onPointerUp={recipe.canCraft ? handleRecipeSelect : undefined}>
|
|
82
|
+
<input
|
|
83
|
+
className="rpgui-radio"
|
|
84
|
+
type="radio"
|
|
85
|
+
value={recipe.name}
|
|
86
|
+
name="test"
|
|
87
|
+
disabled={!recipe.canCraft}
|
|
88
|
+
checked={selectedCraftItemKey === recipe.key}
|
|
89
|
+
onChange={handleRecipeSelect}
|
|
90
|
+
/>
|
|
91
|
+
<label style={{ display: 'flex', alignItems: 'center' }}>
|
|
92
|
+
{modifyString(recipe.name)}
|
|
93
|
+
</label>
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
<MinCraftingRequirementsText levelIsOk={recipe?.levelIsOk ?? false}>
|
|
97
|
+
{modifyString(`${recipe?.minCraftingRequirements?.[0] ?? ''}`)} lvl{' '}
|
|
98
|
+
{recipe?.minCraftingRequirements?.[1] ?? 0} ({levelInSkill})
|
|
99
|
+
</MinCraftingRequirementsText>
|
|
100
|
+
|
|
101
|
+
{recipe.ingredients.map((ingredient, index) => {
|
|
102
|
+
const itemQtyInInventory = !inventory
|
|
103
|
+
? 0
|
|
104
|
+
: countItemFromInventory(ingredient.key, inventory);
|
|
105
|
+
|
|
106
|
+
return (
|
|
107
|
+
<Recipe key={index}>
|
|
108
|
+
<SpriteFromAtlas
|
|
109
|
+
atlasIMG={atlasIMG}
|
|
110
|
+
atlasJSON={atlasJSON}
|
|
111
|
+
spriteKey={ingredient.texturePath}
|
|
112
|
+
imgScale={1.2}
|
|
113
|
+
/>
|
|
114
|
+
<Ingredient isQuantityOk={ingredient.qty <= itemQtyInInventory}>
|
|
115
|
+
{modifyString(ingredient.key)} x{ingredient.qty} (
|
|
116
|
+
{itemQtyInInventory})
|
|
117
|
+
</Ingredient>
|
|
118
|
+
</Recipe>
|
|
119
|
+
);
|
|
120
|
+
})}
|
|
121
|
+
</div>
|
|
122
|
+
</RadioOptionsWrapper>
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const Ingredient = styled.p<{ isQuantityOk: boolean }>`
|
|
127
|
+
margin: 0;
|
|
128
|
+
margin-left: 14px;
|
|
129
|
+
color: ${({ isQuantityOk }) =>
|
|
130
|
+
isQuantityOk ? uiColors.lightGreen : uiColors.lightGray} !important;
|
|
131
|
+
`;
|
|
132
|
+
|
|
133
|
+
const Recipe = styled.div`
|
|
134
|
+
font-size: 0.6rem;
|
|
135
|
+
margin-bottom: 3px;
|
|
136
|
+
display: flex;
|
|
137
|
+
align-items: center;
|
|
138
|
+
margin-left: 4px;
|
|
139
|
+
|
|
140
|
+
.sprite-from-atlas-img {
|
|
141
|
+
top: 0px;
|
|
142
|
+
left: 0px;
|
|
143
|
+
}
|
|
144
|
+
`;
|
|
145
|
+
|
|
146
|
+
const SpriteAtlasWrapper = styled.div`
|
|
147
|
+
margin-right: 40px;
|
|
148
|
+
`;
|
|
149
|
+
|
|
150
|
+
const RadioOptionsWrapper = styled.div`
|
|
151
|
+
display: flex;
|
|
152
|
+
align-items: stretch;
|
|
153
|
+
margin-bottom: 40px;
|
|
154
|
+
`;
|
|
155
|
+
|
|
156
|
+
const MinCraftingRequirementsText = styled.p<{ levelIsOk: boolean }>`
|
|
157
|
+
font-size: 0.6rem !important;
|
|
158
|
+
margin: 0 5px 0 35px;
|
|
159
|
+
color: ${({ levelIsOk }) =>
|
|
160
|
+
levelIsOk ? uiColors.lightGreen : uiColors.lightGray} !important;
|
|
161
|
+
`;
|
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
import { ICraftableItem } from '@rpg-engine/shared';
|
|
2
|
-
import { items } from '../../mocks/itemContainer.mocks';
|
|
3
|
-
|
|
4
|
-
export const craftableItems: ICraftableItem[] = [
|
|
5
|
-
{
|
|
6
|
-
...items[0],
|
|
7
|
-
canCraft: false,
|
|
8
|
-
ingredients: [
|
|
9
|
-
{
|
|
10
|
-
key: 'leather',
|
|
11
|
-
name: 'leather',
|
|
12
|
-
qty: 5,
|
|
13
|
-
texturePath: 'crafting-resources/leather.png',
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
key: 'leather1',
|
|
17
|
-
name: 'leather',
|
|
18
|
-
qty: 10,
|
|
19
|
-
texturePath: 'crafting-resources/leather.png',
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
key: 'leather2',
|
|
23
|
-
name: 'leather',
|
|
24
|
-
qty: 100,
|
|
25
|
-
texturePath: 'crafting-resources/leather.png',
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
minCraftingRequirements: ['blacksmithing', 4],
|
|
29
|
-
levelIsOk: true,
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
...items[1],
|
|
33
|
-
canCraft: true,
|
|
34
|
-
ingredients: [
|
|
35
|
-
{
|
|
36
|
-
key: 'leather',
|
|
37
|
-
name: 'leather',
|
|
38
|
-
qty: 10,
|
|
39
|
-
texturePath: 'crafting-resources/leather.png',
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
minCraftingRequirements: ['blacksmithing', 4],
|
|
43
|
-
levelIsOk: false,
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
...items[2],
|
|
47
|
-
canCraft: true,
|
|
48
|
-
ingredients: [
|
|
49
|
-
{
|
|
50
|
-
key: 'leather',
|
|
51
|
-
name: 'leather',
|
|
52
|
-
qty: 10,
|
|
53
|
-
texturePath: 'crafting-resources/leather.png',
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
minCraftingRequirements: ['blacksmithing', 4],
|
|
57
|
-
levelIsOk: false,
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
...items[3],
|
|
61
|
-
canCraft: true,
|
|
62
|
-
ingredients: [
|
|
63
|
-
{
|
|
64
|
-
key: 'leather',
|
|
65
|
-
name: 'leather',
|
|
66
|
-
qty: 10,
|
|
67
|
-
texturePath: 'crafting-resources/leather.png',
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
minCraftingRequirements: ['blacksmithing', 4],
|
|
71
|
-
levelIsOk: false,
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
...items[4],
|
|
75
|
-
canCraft: true,
|
|
76
|
-
ingredients: [
|
|
77
|
-
{
|
|
78
|
-
key: 'leather',
|
|
79
|
-
name: 'leather',
|
|
80
|
-
qty: 10,
|
|
81
|
-
texturePath: 'crafting-resources/leather.png',
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
minCraftingRequirements: ['blacksmithing', 1],
|
|
85
|
-
levelIsOk: true,
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
...items[5],
|
|
89
|
-
canCraft: true,
|
|
90
|
-
ingredients: [
|
|
91
|
-
{
|
|
92
|
-
key: 'leather',
|
|
93
|
-
name: 'leather',
|
|
94
|
-
qty: 10,
|
|
95
|
-
texturePath: 'crafting-resources/leather.png',
|
|
96
|
-
},
|
|
97
|
-
],
|
|
98
|
-
minCraftingRequirements: ['blacksmithing', 4],
|
|
99
|
-
levelIsOk: true,
|
|
100
|
-
},
|
|
101
|
-
];
|
|
1
|
+
import { ICraftableItem } from '@rpg-engine/shared';
|
|
2
|
+
import { items } from '../../mocks/itemContainer.mocks';
|
|
3
|
+
|
|
4
|
+
export const craftableItems: ICraftableItem[] = [
|
|
5
|
+
{
|
|
6
|
+
...items[0],
|
|
7
|
+
canCraft: false,
|
|
8
|
+
ingredients: [
|
|
9
|
+
{
|
|
10
|
+
key: 'leather',
|
|
11
|
+
name: 'leather',
|
|
12
|
+
qty: 5,
|
|
13
|
+
texturePath: 'crafting-resources/leather.png',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
key: 'leather1',
|
|
17
|
+
name: 'leather',
|
|
18
|
+
qty: 10,
|
|
19
|
+
texturePath: 'crafting-resources/leather.png',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
key: 'leather2',
|
|
23
|
+
name: 'leather',
|
|
24
|
+
qty: 100,
|
|
25
|
+
texturePath: 'crafting-resources/leather.png',
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
minCraftingRequirements: ['blacksmithing', 4],
|
|
29
|
+
levelIsOk: true,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
...items[1],
|
|
33
|
+
canCraft: true,
|
|
34
|
+
ingredients: [
|
|
35
|
+
{
|
|
36
|
+
key: 'leather',
|
|
37
|
+
name: 'leather',
|
|
38
|
+
qty: 10,
|
|
39
|
+
texturePath: 'crafting-resources/leather.png',
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
minCraftingRequirements: ['blacksmithing', 4],
|
|
43
|
+
levelIsOk: false,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
...items[2],
|
|
47
|
+
canCraft: true,
|
|
48
|
+
ingredients: [
|
|
49
|
+
{
|
|
50
|
+
key: 'leather',
|
|
51
|
+
name: 'leather',
|
|
52
|
+
qty: 10,
|
|
53
|
+
texturePath: 'crafting-resources/leather.png',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
minCraftingRequirements: ['blacksmithing', 4],
|
|
57
|
+
levelIsOk: false,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
...items[3],
|
|
61
|
+
canCraft: true,
|
|
62
|
+
ingredients: [
|
|
63
|
+
{
|
|
64
|
+
key: 'leather',
|
|
65
|
+
name: 'leather',
|
|
66
|
+
qty: 10,
|
|
67
|
+
texturePath: 'crafting-resources/leather.png',
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
minCraftingRequirements: ['blacksmithing', 4],
|
|
71
|
+
levelIsOk: false,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
...items[4],
|
|
75
|
+
canCraft: true,
|
|
76
|
+
ingredients: [
|
|
77
|
+
{
|
|
78
|
+
key: 'leather',
|
|
79
|
+
name: 'leather',
|
|
80
|
+
qty: 10,
|
|
81
|
+
texturePath: 'crafting-resources/leather.png',
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
minCraftingRequirements: ['blacksmithing', 1],
|
|
85
|
+
levelIsOk: true,
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
...items[5],
|
|
89
|
+
canCraft: true,
|
|
90
|
+
ingredients: [
|
|
91
|
+
{
|
|
92
|
+
key: 'leather',
|
|
93
|
+
name: 'leather',
|
|
94
|
+
qty: 10,
|
|
95
|
+
texturePath: 'crafting-resources/leather.png',
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
minCraftingRequirements: ['blacksmithing', 4],
|
|
99
|
+
levelIsOk: true,
|
|
100
|
+
},
|
|
101
|
+
];
|