@rpg-engine/long-bow 0.3.87 → 0.3.89

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.
@@ -25,6 +25,7 @@ interface IProps {
25
25
  isContextMenuDisabled?: boolean;
26
26
  isSelectingShortcut?: boolean;
27
27
  equipmentSet?: IEquipmentSet | null;
28
+ setItemShortcut?: (item: IItem, shortcutIndex: number) => void;
28
29
  isDepotSystem?: boolean;
29
30
  }
30
31
  export declare const ItemSlot: React.FC<IProps>;
@@ -33116,7 +33116,8 @@ var CircularController = function CircularController(_ref) {
33116
33116
  spriteKey: shared.getItemTextureKeyPath({
33117
33117
  key: _payload.texturePath,
33118
33118
  texturePath: _payload.texturePath,
33119
- stackQty: _payload.stackQty || 1
33119
+ stackQty: _payload.stackQty || 1,
33120
+ isStackable: _payload.isStackable
33120
33121
  }, atlasJSON),
33121
33122
  width: 32,
33122
33123
  height: 32,
@@ -33658,6 +33659,7 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33658
33659
  dragScale = _ref.dragScale,
33659
33660
  isSelectingShortcut = _ref.isSelectingShortcut,
33660
33661
  equipmentSet = _ref.equipmentSet,
33662
+ setItemShortcut = _ref.setItemShortcut,
33661
33663
  isDepotSystem = _ref.isDepotSystem;
33662
33664
  var _useState = React.useState(false),
33663
33665
  isTooltipVisible = _useState[0],
@@ -33843,6 +33845,13 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33843
33845
  defaultClassName: item ? 'draggable' : 'empty-slot',
33844
33846
  scale: dragScale,
33845
33847
  onStop: function onStop(e, data) {
33848
+ var target = e.target;
33849
+ if (target != null && target.id.includes('shortcutSetter') && setItemShortcut && item) {
33850
+ var index = parseInt(target.id.split('_')[1]);
33851
+ if (!isNaN(index)) {
33852
+ setItemShortcut(item, index);
33853
+ }
33854
+ }
33846
33855
  if (wasDragged && item && !isSelectingShortcut) {
33847
33856
  var _e$target;
33848
33857
  //@ts-ignore
@@ -33857,9 +33866,9 @@ var ItemSlot = /*#__PURE__*/mobxReactLite.observer(function (_ref) {
33857
33866
  });
33858
33867
  }
33859
33868
  setWasDragged(false);
33860
- var target = dragContainer.current;
33861
- if (!target || !wasDragged) return;
33862
- var style = window.getComputedStyle(target);
33869
+ var _target = dragContainer.current;
33870
+ if (!_target || !wasDragged) return;
33871
+ var style = window.getComputedStyle(_target);
33863
33872
  var matrix = new DOMMatrixReadOnly(style.transform);
33864
33873
  var x = matrix.m41;
33865
33874
  var y = matrix.m42;
@@ -35358,7 +35367,8 @@ var ShortcutsSetter = function ShortcutsSetter(_ref) {
35358
35367
  spriteKey: shared.getItemTextureKeyPath({
35359
35368
  key: _payload.texturePath,
35360
35369
  texturePath: _payload.texturePath,
35361
- stackQty: _payload.stackQty || 1
35370
+ stackQty: _payload.stackQty || 1,
35371
+ isStackable: _payload.isStackable
35362
35372
  }, atlasJSON),
35363
35373
  width: 32,
35364
35374
  height: 32,
@@ -35381,11 +35391,13 @@ var ShortcutsSetter = function ShortcutsSetter(_ref) {
35381
35391
  return React__default.createElement(Shortcut, {
35382
35392
  key: i,
35383
35393
  onPointerDown: function onPointerDown() {
35394
+ if (settingShortcutIndex !== -1) setSettingShortcutIndex(-1);
35384
35395
  removeShortcut(i);
35385
- if (!shortcuts[i] || shortcuts[i].type === shared.ShortcutType.None) setSettingShortcutIndex(i);
35396
+ if (settingShortcutIndex === -1 && (!shortcuts[i] || shortcuts[i].type === shared.ShortcutType.None)) setSettingShortcutIndex(i);
35386
35397
  },
35387
35398
  disabled: settingShortcutIndex !== -1 && settingShortcutIndex !== i,
35388
- isBeingSet: settingShortcutIndex === i
35399
+ isBeingSet: settingShortcutIndex === i,
35400
+ id: "shortcutSetter_" + i
35389
35401
  }, getContent(i));
35390
35402
  })));
35391
35403
  };
@@ -35441,6 +35453,11 @@ var ItemContainer$1 = function ItemContainer(_ref) {
35441
35453
  var _useState2 = React.useState(-1),
35442
35454
  settingShortcutIndex = _useState2[0],
35443
35455
  setSettingShortcutIndex = _useState2[1];
35456
+ var handleSetShortcut = function handleSetShortcut(item, index) {
35457
+ if (item.type === shared.ItemType.Consumable || item.type === shared.ItemType.Tool) {
35458
+ setItemShortcut == null ? void 0 : setItemShortcut(item.key, index);
35459
+ }
35460
+ };
35444
35461
  var onRenderSlots = function onRenderSlots() {
35445
35462
  var slots = [];
35446
35463
  for (var i = 0; i < itemContainer.slotQty; i++) {
@@ -35457,9 +35474,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
35457
35474
  onPointerDown: function onPointerDown(itemType, containerType, item) {
35458
35475
  if (settingShortcutIndex !== -1) {
35459
35476
  setSettingShortcutIndex(-1);
35460
- if (itemType === shared.ItemType.Consumable || itemType === shared.ItemType.Tool) {
35461
- setItemShortcut == null ? void 0 : setItemShortcut(item.key, settingShortcutIndex);
35462
- }
35477
+ handleSetShortcut(item, settingShortcutIndex);
35463
35478
  } else if (onItemClick) onItemClick(item, itemType, containerType);
35464
35479
  },
35465
35480
  onSelected: function onSelected(optionId, item) {
@@ -35491,6 +35506,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
35491
35506
  atlasJSON: atlasJSON,
35492
35507
  isSelectingShortcut: settingShortcutIndex !== -1,
35493
35508
  equipmentSet: equipmentSet,
35509
+ setItemShortcut: type === shared.ItemContainerType.Inventory ? handleSetShortcut : undefined,
35494
35510
  isDepotSystem: isDepotSystem
35495
35511
  }));
35496
35512
  }
@@ -35989,7 +36005,8 @@ var Shortcuts = function Shortcuts(_ref) {
35989
36005
  spriteKey: shared.getItemTextureKeyPath({
35990
36006
  key: _payload.texturePath,
35991
36007
  texturePath: _payload.texturePath,
35992
- stackQty: _payload.stackQty || 1
36008
+ stackQty: _payload.stackQty || 1,
36009
+ isStackable: _payload.isStackable
35993
36010
  }, atlasJSON),
35994
36011
  width: 32,
35995
36012
  height: 32
@@ -36504,7 +36521,8 @@ var TradingItemRow = function TradingItemRow(_ref) {
36504
36521
  spriteKey: shared.getItemTextureKeyPath({
36505
36522
  key: traderItem.key,
36506
36523
  stackQty: traderItem.stackQty || 1,
36507
- texturePath: traderItem.texturePath
36524
+ texturePath: traderItem.texturePath,
36525
+ isStackable: traderItem.isStackable
36508
36526
  }, atlasJSON),
36509
36527
  imgScale: 2.5
36510
36528
  })))), React__default.createElement(ItemNameContainer, null, React__default.createElement(NameValue, null, React__default.createElement("p", null, React__default.createElement(Ellipsis, {