@rpg-engine/long-bow 0.1.99 → 0.2.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/dist/components/Item/Inventory/itemContainerHelper.d.ts +1 -4
- package/dist/long-bow.cjs.development.js +23 -41
- 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 +23 -41
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Item/Inventory/ItemSlot.tsx +2 -2
- package/src/components/Item/Inventory/itemContainerHelper.ts +45 -99
- package/src/components/NPCDialog/QuestionDialog/QuestionDialog.tsx +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpg-engine/long-bow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@rollup/plugin-image": "^2.1.1",
|
|
86
|
-
"@rpg-engine/shared": "^0.4.
|
|
86
|
+
"@rpg-engine/shared": "^0.4.8",
|
|
87
87
|
"dayjs": "^1.11.2",
|
|
88
88
|
"fs-extra": "^10.1.0",
|
|
89
89
|
"lodash": "^4.17.21",
|
|
@@ -14,7 +14,7 @@ import atlasIMG from '../../../mocks/atlas/items/items.png';
|
|
|
14
14
|
import { RelativeListMenu } from '../../RelativeListMenu';
|
|
15
15
|
import { SpriteFromAtlas } from '../../shared/SpriteFromAtlas';
|
|
16
16
|
import { ItemTooltip } from '../Cards/ItemTooltip';
|
|
17
|
-
import {
|
|
17
|
+
import { generateContextMenu, IContextMenuItem } from './itemContainerHelper';
|
|
18
18
|
|
|
19
19
|
const EquipmentSlotSpriteByType: any = {
|
|
20
20
|
Neck: 'accessories/corruption-necklace.png',
|
|
@@ -72,7 +72,7 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
72
72
|
|
|
73
73
|
useEffect(() => {
|
|
74
74
|
if (item) {
|
|
75
|
-
setContextActions(
|
|
75
|
+
setContextActions(generateContextMenu(item.type, containerType));
|
|
76
76
|
}
|
|
77
77
|
}, [item]);
|
|
78
78
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ActionsByItemType,
|
|
3
2
|
ActionsForEquipmentSet,
|
|
4
3
|
ActionsForInventory,
|
|
5
4
|
ActionsForLoot,
|
|
@@ -8,15 +7,13 @@ import {
|
|
|
8
7
|
ItemSocketEventsDisplayLabels,
|
|
9
8
|
ItemType,
|
|
10
9
|
} from '@rpg-engine/shared';
|
|
11
|
-
import { SlotContainerType } from './ItemContainerTypes';
|
|
12
10
|
|
|
13
11
|
export interface IContextMenuItem {
|
|
14
12
|
id: string;
|
|
15
13
|
text: string;
|
|
16
14
|
}
|
|
17
15
|
|
|
18
|
-
|
|
19
|
-
const generateContextList = (actionsByTypeList: any) => {
|
|
16
|
+
const generateContextMenuListOptions = (actionsByTypeList: any) => {
|
|
20
17
|
const contextMenu: IContextMenuItem[] = actionsByTypeList.map(
|
|
21
18
|
(action: string) => {
|
|
22
19
|
return { id: action, text: ItemSocketEventsDisplayLabels[action] };
|
|
@@ -24,7 +21,8 @@ const generateContextList = (actionsByTypeList: any) => {
|
|
|
24
21
|
);
|
|
25
22
|
return contextMenu;
|
|
26
23
|
};
|
|
27
|
-
|
|
24
|
+
|
|
25
|
+
export const generateContextMenu = (
|
|
28
26
|
itemType: ItemType,
|
|
29
27
|
itemContainerType: ItemContainerType | null
|
|
30
28
|
) => {
|
|
@@ -37,36 +35,37 @@ export const handleNewContextMenu = (
|
|
|
37
35
|
case ItemType.Accessory:
|
|
38
36
|
case ItemType.Jewelry:
|
|
39
37
|
case ItemType.Container:
|
|
40
|
-
contextActionMenu =
|
|
38
|
+
contextActionMenu = generateContextMenuListOptions(
|
|
39
|
+
ActionsForInventory.Equipment
|
|
40
|
+
);
|
|
41
41
|
break;
|
|
42
42
|
case ItemType.Consumable:
|
|
43
|
-
contextActionMenu =
|
|
43
|
+
contextActionMenu = generateContextMenuListOptions(
|
|
44
|
+
ActionsForInventory.Consumable
|
|
45
|
+
);
|
|
44
46
|
break;
|
|
45
47
|
case ItemType.CraftMaterial:
|
|
46
|
-
contextActionMenu =
|
|
48
|
+
contextActionMenu = generateContextMenuListOptions(
|
|
47
49
|
ActionsForInventory.CraftMaterial
|
|
48
50
|
);
|
|
49
51
|
break;
|
|
50
52
|
case ItemType.Tool:
|
|
51
|
-
contextActionMenu =
|
|
53
|
+
contextActionMenu = generateContextMenuListOptions(
|
|
54
|
+
ActionsForInventory.Tool
|
|
55
|
+
);
|
|
52
56
|
break;
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
|
|
58
|
+
default:
|
|
59
|
+
contextActionMenu = generateContextMenuListOptions(
|
|
60
|
+
ActionsForInventory.Other
|
|
61
|
+
);
|
|
55
62
|
break;
|
|
56
63
|
}
|
|
57
64
|
}
|
|
58
65
|
if (itemContainerType === ItemContainerType.Equipment) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
case ItemType.Accessory:
|
|
63
|
-
case ItemType.Jewelry:
|
|
64
|
-
case ItemType.Container:
|
|
65
|
-
contextActionMenu = generateContextList(
|
|
66
|
-
ActionsForEquipmentSet.Equipment
|
|
67
|
-
);
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
66
|
+
contextActionMenu = generateContextMenuListOptions(
|
|
67
|
+
ActionsForEquipmentSet.Equipment
|
|
68
|
+
);
|
|
70
69
|
}
|
|
71
70
|
if (itemContainerType === ItemContainerType.Loot) {
|
|
72
71
|
switch (itemType) {
|
|
@@ -74,19 +73,27 @@ export const handleNewContextMenu = (
|
|
|
74
73
|
case ItemType.Armor:
|
|
75
74
|
case ItemType.Accessory:
|
|
76
75
|
case ItemType.Jewelry:
|
|
77
|
-
contextActionMenu =
|
|
76
|
+
contextActionMenu = generateContextMenuListOptions(
|
|
77
|
+
ActionsForLoot.Equipment
|
|
78
|
+
);
|
|
78
79
|
break;
|
|
79
80
|
case ItemType.Consumable:
|
|
80
|
-
contextActionMenu =
|
|
81
|
+
contextActionMenu = generateContextMenuListOptions(
|
|
82
|
+
ActionsForLoot.Consumable
|
|
83
|
+
);
|
|
81
84
|
break;
|
|
82
85
|
case ItemType.CraftMaterial:
|
|
83
|
-
contextActionMenu =
|
|
86
|
+
contextActionMenu = generateContextMenuListOptions(
|
|
87
|
+
ActionsForLoot.CraftMaterial
|
|
88
|
+
);
|
|
84
89
|
break;
|
|
85
90
|
case ItemType.Tool:
|
|
86
|
-
contextActionMenu =
|
|
91
|
+
contextActionMenu = generateContextMenuListOptions(ActionsForLoot.Tool);
|
|
87
92
|
break;
|
|
88
|
-
|
|
89
|
-
contextActionMenu =
|
|
93
|
+
default:
|
|
94
|
+
contextActionMenu = generateContextMenuListOptions(
|
|
95
|
+
ActionsForLoot.Other
|
|
96
|
+
);
|
|
90
97
|
break;
|
|
91
98
|
}
|
|
92
99
|
}
|
|
@@ -96,92 +103,31 @@ export const handleNewContextMenu = (
|
|
|
96
103
|
case ItemType.Armor:
|
|
97
104
|
case ItemType.Accessory:
|
|
98
105
|
case ItemType.Jewelry:
|
|
99
|
-
contextActionMenu =
|
|
106
|
+
contextActionMenu = generateContextMenuListOptions(
|
|
100
107
|
ActionsForMapContainer.Equipment
|
|
101
108
|
);
|
|
102
109
|
break;
|
|
103
110
|
case ItemType.Consumable:
|
|
104
|
-
contextActionMenu =
|
|
111
|
+
contextActionMenu = generateContextMenuListOptions(
|
|
105
112
|
ActionsForMapContainer.Consumable
|
|
106
113
|
);
|
|
107
114
|
break;
|
|
108
115
|
case ItemType.CraftMaterial:
|
|
109
|
-
contextActionMenu =
|
|
116
|
+
contextActionMenu = generateContextMenuListOptions(
|
|
110
117
|
ActionsForMapContainer.CraftMaterial
|
|
111
118
|
);
|
|
112
119
|
break;
|
|
113
120
|
case ItemType.Tool:
|
|
114
|
-
contextActionMenu =
|
|
121
|
+
contextActionMenu = generateContextMenuListOptions(
|
|
122
|
+
ActionsForMapContainer.Tool
|
|
123
|
+
);
|
|
115
124
|
break;
|
|
116
|
-
|
|
117
|
-
contextActionMenu =
|
|
125
|
+
default:
|
|
126
|
+
contextActionMenu = generateContextMenuListOptions(
|
|
127
|
+
ActionsForMapContainer.Other
|
|
128
|
+
);
|
|
118
129
|
break;
|
|
119
130
|
}
|
|
120
131
|
}
|
|
121
132
|
return contextActionMenu;
|
|
122
133
|
};
|
|
123
|
-
|
|
124
|
-
export const handleContextMenuList = (
|
|
125
|
-
itemType: ItemType,
|
|
126
|
-
slotContainerType: SlotContainerType | null
|
|
127
|
-
) => {
|
|
128
|
-
let contextActionMenu: IContextMenuItem[] = [];
|
|
129
|
-
|
|
130
|
-
switch (itemType) {
|
|
131
|
-
case ItemType.Weapon:
|
|
132
|
-
case ItemType.Armor:
|
|
133
|
-
case ItemType.Accessory:
|
|
134
|
-
case ItemType.Jewelry:
|
|
135
|
-
case ItemType.Tool:
|
|
136
|
-
if (slotContainerType === SlotContainerType.EQUIPMENT_SET) {
|
|
137
|
-
contextActionMenu = generateContextList(
|
|
138
|
-
ActionsByItemType.EquipmentSetItems
|
|
139
|
-
);
|
|
140
|
-
} else {
|
|
141
|
-
contextActionMenu = generateContextList(ActionsByItemType.Equipment);
|
|
142
|
-
}
|
|
143
|
-
break;
|
|
144
|
-
case ItemType.Consumable:
|
|
145
|
-
contextActionMenu = generateContextList(ActionsByItemType.Consumable);
|
|
146
|
-
break;
|
|
147
|
-
case ItemType.CraftMaterial:
|
|
148
|
-
contextActionMenu = generateContextList(ActionsByItemType.CraftMaterial);
|
|
149
|
-
break;
|
|
150
|
-
case ItemType.Other:
|
|
151
|
-
case ItemType.Information:
|
|
152
|
-
case ItemType.Quest:
|
|
153
|
-
case ItemType.Container:
|
|
154
|
-
contextActionMenu = generateContextList(ActionsByItemType.Other);
|
|
155
|
-
break;
|
|
156
|
-
default:
|
|
157
|
-
contextActionMenu = generateContextList(ActionsByItemType.Other);
|
|
158
|
-
break;
|
|
159
|
-
}
|
|
160
|
-
return contextActionMenu;
|
|
161
|
-
};
|
|
162
|
-
|
|
163
|
-
export const handleEquipmentContextMenuList = (itemType: ItemType) => {
|
|
164
|
-
let contextActionMenu: IContextMenuItem[] = [];
|
|
165
|
-
switch (itemType) {
|
|
166
|
-
case ItemType.Weapon:
|
|
167
|
-
case ItemType.Armor:
|
|
168
|
-
case ItemType.Accessory:
|
|
169
|
-
case ItemType.Jewelry:
|
|
170
|
-
case ItemType.Tool:
|
|
171
|
-
contextActionMenu = generateContextList(
|
|
172
|
-
ActionsByItemType.EquipmentSetItems
|
|
173
|
-
);
|
|
174
|
-
break;
|
|
175
|
-
case ItemType.Container:
|
|
176
|
-
contextActionMenu = generateContextList(
|
|
177
|
-
ActionsByItemType.EquipmentSetContainer
|
|
178
|
-
);
|
|
179
|
-
break;
|
|
180
|
-
default:
|
|
181
|
-
contextActionMenu = generateContextList(
|
|
182
|
-
ActionsByItemType.EquipmentSetItems
|
|
183
|
-
);
|
|
184
|
-
break;
|
|
185
|
-
}
|
|
186
|
-
return contextActionMenu;
|
|
187
|
-
};
|
|
@@ -70,8 +70,6 @@ export const QuestionDialog: React.FC<IProps> = ({
|
|
|
70
70
|
|
|
71
71
|
const nextAnswerID = currentQuestion.answerIds![nextAnswerIndex];
|
|
72
72
|
|
|
73
|
-
// console.log(nextAnswerIndex);
|
|
74
|
-
|
|
75
73
|
const nextAnswer = onGetAnswers(currentQuestion.answerIds!).find(
|
|
76
74
|
answer => answer?.id === nextAnswerID
|
|
77
75
|
);
|