@rpg-engine/long-bow 0.1.91 → 0.1.94

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.1.91",
3
+ "version": "0.1.94",
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.3.67",
86
+ "@rpg-engine/shared": "^0.3.86",
87
87
  "dayjs": "^1.11.2",
88
88
  "fs-extra": "^10.1.0",
89
89
  "lodash": "^4.17.21",
@@ -13,7 +13,7 @@ export interface IItemContainerProps {
13
13
  slotContainerType: SlotContainerType | null
14
14
  ) => void;
15
15
  onMouseOver?: (e: any, slotIndex: number, item: IItem | null) => void;
16
- onSelected?: (optionId: string) => void;
16
+ onSelected?: (optionId: string, item: IItem) => void;
17
17
  }
18
18
 
19
19
  export const ItemContainer: React.FC<IItemContainerProps> = ({
@@ -39,8 +39,8 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
39
39
  onClick={(item, slotContainerType) => {
40
40
  if (onItemClick) onItemClick(item, slotContainerType);
41
41
  }}
42
- onSelected={(optionId: string) => {
43
- if (onSelected) onSelected(optionId);
42
+ onSelected={(optionId: string, item: IItem) => {
43
+ if (onSelected) onSelected(optionId, item);
44
44
  }}
45
45
  />
46
46
  );
@@ -8,10 +8,7 @@ import atlasIMG from '../../../mocks/atlas/items/items.png';
8
8
  import { RelativeListMenu } from '../../RelativeListMenu';
9
9
  import { SpriteFromAtlas } from '../../shared/SpriteFromAtlas';
10
10
  import { ItemTooltip } from '../Cards/ItemTooltip';
11
- import {
12
- handleEquipmentContextMenuList,
13
- IContextMenuItem,
14
- } from './itemContainerHelper';
11
+ import { handleContextMenuList, IContextMenuItem } from './itemContainerHelper';
15
12
  import { SlotContainerType } from './ItemContainerTypes';
16
13
 
17
14
  const EquipmentSlotSpriteByType: any = {
@@ -33,7 +30,7 @@ interface IProps {
33
30
  itemContainer?: IItemContainer | null;
34
31
  slotContainerType: SlotContainerType | null;
35
32
  slotSpriteMask?: ItemSlotType | null;
36
- onSelected: (payload: any) => void;
33
+ onSelected: (selectedOption: string, item: IItem) => void;
37
34
  onMouseOver: (
38
35
  event: any,
39
36
  slotIndex: number,
@@ -66,7 +63,7 @@ export const ItemSlot: React.FC<IProps> = observer(
66
63
 
67
64
  useEffect(() => {
68
65
  if (item) {
69
- setContextActions(handleEquipmentContextMenuList(item.type));
66
+ setContextActions(handleContextMenuList(item.type));
70
67
  }
71
68
  }, [item]);
72
69
 
@@ -163,7 +160,9 @@ export const ItemSlot: React.FC<IProps> = observer(
163
160
  options={contextActions}
164
161
  onSelected={(optionId: string) => {
165
162
  setIsContextMenuVisible(false);
166
- onSelected(optionId);
163
+ if (item) {
164
+ onSelected(optionId, item);
165
+ }
167
166
  }}
168
167
  onOutsideClick={() => {
169
168
  setIsContextMenuVisible(false);
@@ -63,17 +63,17 @@ export const handleEquipmentContextMenuList = (itemType: ItemType) => {
63
63
  case ItemType.Jewelry:
64
64
  case ItemType.Tool:
65
65
  contextActionMenu = generateContextList(
66
- ActionsByItemType.EquipmenSetItems
66
+ ActionsByItemType.EquipmentSetItems
67
67
  );
68
68
  break;
69
69
  case ItemType.Container:
70
70
  contextActionMenu = generateContextList(
71
- ActionsByItemType.EquipmenSetContainer
71
+ ActionsByItemType.EquipmentSetContainer
72
72
  );
73
73
  break;
74
74
  default:
75
75
  contextActionMenu = generateContextList(
76
- ActionsByItemType.EquipmenSetItems
76
+ ActionsByItemType.EquipmentSetItems
77
77
  );
78
78
  break;
79
79
  }
@@ -24,8 +24,8 @@ const onMouseOver = (_event: any, slotIndex: number, item: IItem | null) => {
24
24
  console.log(`${item.name} at ${slotIndex}`);
25
25
  };
26
26
 
27
- const onSelected = (payload: any) => {
28
- console.log('dispatch', payload);
27
+ const onSelected = (payload: string, item: IItem) => {
28
+ console.log('onSelected', payload, item);
29
29
  };
30
30
 
31
31
  const onItemClick = (