@rpg-engine/long-bow 0.1.96 → 0.1.99
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/Equipment/EquipmentSet.d.ts +3 -3
- package/dist/components/Item/Inventory/ItemContainer.d.ts +3 -3
- package/dist/components/Item/Inventory/ItemContainerTypes.d.ts +3 -1
- package/dist/components/Item/Inventory/ItemSlot.d.ts +3 -4
- package/dist/components/Item/Inventory/itemContainerHelper.d.ts +2 -5
- package/dist/long-bow.cjs.development.js +116 -53
- 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 +117 -54
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Equipment/EquipmentSet.tsx +9 -5
- package/src/components/Item/Inventory/ItemContainer.tsx +9 -6
- package/src/components/Item/Inventory/ItemContainerTypes.ts +2 -0
- package/src/components/Item/Inventory/ItemSlot.tsx +25 -11
- package/src/components/Item/Inventory/itemContainerHelper.ts +109 -8
- package/src/stories/EquipmentSet.stories.tsx +5 -4
- package/src/stories/ItemContainer.stories.tsx +5 -4
package/dist/long-bow.esm.js
CHANGED
|
@@ -6,7 +6,7 @@ import Draggable from 'react-draggable';
|
|
|
6
6
|
import { v4 } from 'uuid';
|
|
7
7
|
import 'rpgui/rpgui.min.css';
|
|
8
8
|
import 'rpgui/rpgui.min.js';
|
|
9
|
-
import { GRID_WIDTH, GRID_HEIGHT, ItemType, ItemSocketEventsDisplayLabels,
|
|
9
|
+
import { GRID_WIDTH, GRID_HEIGHT, ItemContainerType, ItemType, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemSlotType, getSPForLevel } from '@rpg-engine/shared';
|
|
10
10
|
import { observer } from 'mobx-react-lite';
|
|
11
11
|
import _ from 'lodash-es';
|
|
12
12
|
|
|
@@ -453,13 +453,6 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
453
453
|
}));
|
|
454
454
|
};
|
|
455
455
|
|
|
456
|
-
var SlotContainerType;
|
|
457
|
-
|
|
458
|
-
(function (SlotContainerType) {
|
|
459
|
-
SlotContainerType["INVENTORY"] = "Inventory";
|
|
460
|
-
SlotContainerType["EQUIPMENT_SET"] = "EquipmentSet";
|
|
461
|
-
})(SlotContainerType || (SlotContainerType = {}));
|
|
462
|
-
|
|
463
456
|
var frames = {
|
|
464
457
|
"helmets/brass-helmet.png": {
|
|
465
458
|
frame: {
|
|
@@ -5806,13 +5799,14 @@ var Container$5 = /*#__PURE__*/styled.div.withConfig({
|
|
|
5806
5799
|
componentId: "sc-11d9r7x-0"
|
|
5807
5800
|
})(["z-index:2;position:absolute;top:1rem;left:4rem;font-size:0.5rem;color:white;background-color:black;border-radius:5px;padding:0.5rem;min-width:20px;width:100%;text-align:center;opacity:0.75;"]);
|
|
5808
5801
|
|
|
5809
|
-
var
|
|
5810
|
-
|
|
5811
|
-
(function (ContainerType) {
|
|
5812
|
-
ContainerType["INVENTORY"] = "Inventory";
|
|
5813
|
-
ContainerType["EQUIPMENT_SET"] = "EquipmentSet";
|
|
5814
|
-
})(ContainerType || (ContainerType = {})); // TODO: Refactor this file
|
|
5802
|
+
var SlotContainerType;
|
|
5815
5803
|
|
|
5804
|
+
(function (SlotContainerType) {
|
|
5805
|
+
SlotContainerType["INVENTORY"] = "Inventory";
|
|
5806
|
+
SlotContainerType["EQUIPMENT_SET"] = "EquipmentSet";
|
|
5807
|
+
SlotContainerType["LOOT"] = "Loot";
|
|
5808
|
+
SlotContainerType["MAP_CONTAINER"] = "Map-Container";
|
|
5809
|
+
})(SlotContainerType || (SlotContainerType = {}));
|
|
5816
5810
|
|
|
5817
5811
|
var generateContextList = function generateContextList(actionsByTypeList) {
|
|
5818
5812
|
var contextMenu = actionsByTypeList.map(function (action) {
|
|
@@ -5824,41 +5818,101 @@ var generateContextList = function generateContextList(actionsByTypeList) {
|
|
|
5824
5818
|
return contextMenu;
|
|
5825
5819
|
};
|
|
5826
5820
|
|
|
5827
|
-
var
|
|
5821
|
+
var handleNewContextMenu = function handleNewContextMenu(itemType, itemContainerType) {
|
|
5828
5822
|
var contextActionMenu = [];
|
|
5829
5823
|
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
contextActionMenu = generateContextList(
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5824
|
+
if (itemContainerType === ItemContainerType.Inventory) {
|
|
5825
|
+
switch (itemType) {
|
|
5826
|
+
case ItemType.Weapon:
|
|
5827
|
+
case ItemType.Armor:
|
|
5828
|
+
case ItemType.Accessory:
|
|
5829
|
+
case ItemType.Jewelry:
|
|
5830
|
+
case ItemType.Container:
|
|
5831
|
+
contextActionMenu = generateContextList(ActionsForInventory.Equipment);
|
|
5832
|
+
break;
|
|
5833
|
+
|
|
5834
|
+
case ItemType.Consumable:
|
|
5835
|
+
contextActionMenu = generateContextList(ActionsForInventory.Consumable);
|
|
5836
|
+
break;
|
|
5837
|
+
|
|
5838
|
+
case ItemType.CraftMaterial:
|
|
5839
|
+
contextActionMenu = generateContextList(ActionsForInventory.CraftMaterial);
|
|
5840
|
+
break;
|
|
5841
|
+
|
|
5842
|
+
case ItemType.Tool:
|
|
5843
|
+
contextActionMenu = generateContextList(ActionsForInventory.Tool);
|
|
5844
|
+
break;
|
|
5845
|
+
|
|
5846
|
+
case ItemType.Other:
|
|
5847
|
+
contextActionMenu = generateContextList(ActionsForInventory.Other);
|
|
5848
|
+
break;
|
|
5849
|
+
}
|
|
5850
|
+
}
|
|
5841
5851
|
|
|
5842
|
-
|
|
5852
|
+
if (itemContainerType === ItemContainerType.Equipment) {
|
|
5853
|
+
switch (itemType) {
|
|
5854
|
+
case ItemType.Weapon:
|
|
5855
|
+
case ItemType.Armor:
|
|
5856
|
+
case ItemType.Accessory:
|
|
5857
|
+
case ItemType.Jewelry:
|
|
5858
|
+
case ItemType.Container:
|
|
5859
|
+
contextActionMenu = generateContextList(ActionsForEquipmentSet.Equipment);
|
|
5860
|
+
break;
|
|
5861
|
+
}
|
|
5862
|
+
}
|
|
5863
|
+
|
|
5864
|
+
if (itemContainerType === ItemContainerType.Loot) {
|
|
5865
|
+
switch (itemType) {
|
|
5866
|
+
case ItemType.Weapon:
|
|
5867
|
+
case ItemType.Armor:
|
|
5868
|
+
case ItemType.Accessory:
|
|
5869
|
+
case ItemType.Jewelry:
|
|
5870
|
+
contextActionMenu = generateContextList(ActionsForLoot.Equipment);
|
|
5871
|
+
break;
|
|
5872
|
+
|
|
5873
|
+
case ItemType.Consumable:
|
|
5874
|
+
contextActionMenu = generateContextList(ActionsForLoot.Consumable);
|
|
5875
|
+
break;
|
|
5876
|
+
|
|
5877
|
+
case ItemType.CraftMaterial:
|
|
5878
|
+
contextActionMenu = generateContextList(ActionsForLoot.CraftMaterial);
|
|
5879
|
+
break;
|
|
5880
|
+
|
|
5881
|
+
case ItemType.Tool:
|
|
5882
|
+
contextActionMenu = generateContextList(ActionsForLoot.Tool);
|
|
5883
|
+
break;
|
|
5884
|
+
|
|
5885
|
+
case ItemType.Other:
|
|
5886
|
+
contextActionMenu = generateContextList(ActionsForLoot.Other);
|
|
5887
|
+
break;
|
|
5888
|
+
}
|
|
5889
|
+
}
|
|
5843
5890
|
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5891
|
+
if (itemContainerType === ItemContainerType.MapContainer) {
|
|
5892
|
+
switch (itemType) {
|
|
5893
|
+
case ItemType.Weapon:
|
|
5894
|
+
case ItemType.Armor:
|
|
5895
|
+
case ItemType.Accessory:
|
|
5896
|
+
case ItemType.Jewelry:
|
|
5897
|
+
contextActionMenu = generateContextList(ActionsForMapContainer.Equipment);
|
|
5898
|
+
break;
|
|
5847
5899
|
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5900
|
+
case ItemType.Consumable:
|
|
5901
|
+
contextActionMenu = generateContextList(ActionsForMapContainer.Consumable);
|
|
5902
|
+
break;
|
|
5851
5903
|
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5904
|
+
case ItemType.CraftMaterial:
|
|
5905
|
+
contextActionMenu = generateContextList(ActionsForMapContainer.CraftMaterial);
|
|
5906
|
+
break;
|
|
5907
|
+
|
|
5908
|
+
case ItemType.Tool:
|
|
5909
|
+
contextActionMenu = generateContextList(ActionsForMapContainer.Tool);
|
|
5910
|
+
break;
|
|
5858
5911
|
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5912
|
+
case ItemType.Other:
|
|
5913
|
+
contextActionMenu = generateContextList(ActionsForMapContainer.Other);
|
|
5914
|
+
break;
|
|
5915
|
+
}
|
|
5862
5916
|
}
|
|
5863
5917
|
|
|
5864
5918
|
return contextActionMenu;
|
|
@@ -5879,7 +5933,7 @@ var EquipmentSlotSpriteByType = {
|
|
|
5879
5933
|
var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
5880
5934
|
var slotIndex = _ref.slotIndex,
|
|
5881
5935
|
item = _ref.item,
|
|
5882
|
-
|
|
5936
|
+
containerType = _ref.itemContainerType,
|
|
5883
5937
|
slotSpriteMask = _ref.slotSpriteMask,
|
|
5884
5938
|
_onMouseOver = _ref.onMouseOver,
|
|
5885
5939
|
_onMouseOut = _ref.onMouseOut,
|
|
@@ -5900,7 +5954,7 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
|
5900
5954
|
|
|
5901
5955
|
useEffect(function () {
|
|
5902
5956
|
if (item) {
|
|
5903
|
-
setContextActions(
|
|
5957
|
+
setContextActions(handleNewContextMenu(item.type, containerType));
|
|
5904
5958
|
}
|
|
5905
5959
|
}, [item]);
|
|
5906
5960
|
|
|
@@ -5956,8 +6010,16 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
|
5956
6010
|
};
|
|
5957
6011
|
|
|
5958
6012
|
var onRenderSlot = function onRenderSlot(itemToRender) {
|
|
5959
|
-
|
|
5960
|
-
|
|
6013
|
+
switch (containerType) {
|
|
6014
|
+
case ItemContainerType.Equipment:
|
|
6015
|
+
return renderEquipment(itemToRender);
|
|
6016
|
+
|
|
6017
|
+
case ItemContainerType.Inventory:
|
|
6018
|
+
return renderItem(itemToRender);
|
|
6019
|
+
|
|
6020
|
+
default:
|
|
6021
|
+
return renderItem(itemToRender);
|
|
6022
|
+
}
|
|
5961
6023
|
};
|
|
5962
6024
|
|
|
5963
6025
|
return React.createElement(Container$6, {
|
|
@@ -5980,7 +6042,7 @@ var ItemSlot = /*#__PURE__*/observer(function (_ref) {
|
|
|
5980
6042
|
if (item) {
|
|
5981
6043
|
setIsContextMenuVisible(!isContextMenuVisible);
|
|
5982
6044
|
|
|
5983
|
-
_onClick(item,
|
|
6045
|
+
_onClick(item.type, containerType, item);
|
|
5984
6046
|
}
|
|
5985
6047
|
}
|
|
5986
6048
|
}, isContextMenuVisible && contextActions && React.createElement(RelativeListMenu, {
|
|
@@ -6042,13 +6104,13 @@ var EquipmentSet = function EquipmentSet(_ref) {
|
|
|
6042
6104
|
slotIndex: i,
|
|
6043
6105
|
item: item,
|
|
6044
6106
|
itemContainer: itemContainer,
|
|
6045
|
-
|
|
6107
|
+
itemContainerType: ItemContainerType.Equipment,
|
|
6046
6108
|
slotSpriteMask: slotMaksRange[i],
|
|
6047
6109
|
onMouseOver: function onMouseOver(event, slotIndex, item) {
|
|
6048
6110
|
if (_onMouseOver) _onMouseOver(event, slotIndex, item);
|
|
6049
6111
|
},
|
|
6050
|
-
onClick: function onClick(
|
|
6051
|
-
if (onItemClick) onItemClick(item,
|
|
6112
|
+
onClick: function onClick(itemType, ContainerType) {
|
|
6113
|
+
if (onItemClick) onItemClick(itemType, item, ContainerType);
|
|
6052
6114
|
},
|
|
6053
6115
|
onSelected: function onSelected(optionId) {
|
|
6054
6116
|
if (_onSelected) _onSelected(optionId);
|
|
@@ -6114,7 +6176,8 @@ var ItemContainer = function ItemContainer(_ref) {
|
|
|
6114
6176
|
onClose = _ref.onClose,
|
|
6115
6177
|
_onMouseOver = _ref.onMouseOver,
|
|
6116
6178
|
_onSelected = _ref.onSelected,
|
|
6117
|
-
onItemClick = _ref.onItemClick
|
|
6179
|
+
onItemClick = _ref.onItemClick,
|
|
6180
|
+
ContainerType = _ref.ContainerType;
|
|
6118
6181
|
|
|
6119
6182
|
var onRenderSlots = function onRenderSlots() {
|
|
6120
6183
|
var slots = [];
|
|
@@ -6126,12 +6189,12 @@ var ItemContainer = function ItemContainer(_ref) {
|
|
|
6126
6189
|
key: i,
|
|
6127
6190
|
slotIndex: i,
|
|
6128
6191
|
item: ((_itemContainer$slots = itemContainer.slots) == null ? void 0 : _itemContainer$slots[i]) || null,
|
|
6129
|
-
|
|
6192
|
+
itemContainerType: ContainerType,
|
|
6130
6193
|
onMouseOver: function onMouseOver(event, slotIndex, item) {
|
|
6131
6194
|
if (_onMouseOver) _onMouseOver(event, slotIndex, item);
|
|
6132
6195
|
},
|
|
6133
|
-
onClick: function onClick(
|
|
6134
|
-
if (onItemClick) onItemClick(item,
|
|
6196
|
+
onClick: function onClick(ItemType, ContainerType, item) {
|
|
6197
|
+
if (onItemClick) onItemClick(item, ItemType, ContainerType);
|
|
6135
6198
|
},
|
|
6136
6199
|
onSelected: function onSelected(optionId, item) {
|
|
6137
6200
|
if (_onSelected) _onSelected(optionId, item);
|