@rpg-engine/long-bow 0.5.12 → 0.5.13

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.
@@ -1,6 +1,6 @@
1
1
  import React, { Component, useState, useEffect, useRef, useMemo, Fragment } from 'react';
2
2
  import styled from 'styled-components';
3
- import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemContainerType, ItemType, DepotSocketEvents, ItemSocketEvents, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemRarities, ItemSubType, ItemSlotType, isMobileOrTablet, CharacterClass, getSPForLevel, getXPForLevel, PeriodOfDay, UserAccountTypes } from '@rpg-engine/shared';
3
+ import { GRID_WIDTH, GRID_HEIGHT, ShortcutType, getItemTextureKeyPath, ItemContainerType, ItemType, DepotSocketEvents, ItemSocketEvents, ItemSocketEventsDisplayLabels, ActionsForInventory, ActionsForEquipmentSet, ActionsForLoot, ActionsForMapContainer, ItemRarities, ItemSubType, ItemSlotType, isMobileOrTablet, CharacterClass, getSPForLevel, getXPForLevel, PeriodOfDay } from '@rpg-engine/shared';
4
4
  import dayjs from 'dayjs';
5
5
  import { ErrorBoundary as ErrorBoundary$1 } from 'react-error-boundary';
6
6
  import { RxPaperPlane } from 'react-icons/rx';
@@ -15578,6 +15578,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
15578
15578
  isDepotSystem = _ref.isDepotSystem,
15579
15579
  onPositionChangeEnd = _ref.onPositionChangeEnd,
15580
15580
  onPositionChangeStart = _ref.onPositionChangeStart;
15581
+ var MAX_SLOTS_PER_PAGE = 20;
15581
15582
  var _useState = useState({
15582
15583
  isOpen: false,
15583
15584
  maxQuantity: 1,
@@ -15588,6 +15589,10 @@ var ItemContainer$1 = function ItemContainer(_ref) {
15588
15589
  var _useState2 = useState(-1),
15589
15590
  settingShortcutIndex = _useState2[0],
15590
15591
  setSettingShortcutIndex = _useState2[1];
15592
+ var _useState3 = useState(1),
15593
+ currentPage = _useState3[0],
15594
+ setCurrentPage = _useState3[1];
15595
+ var totalPages = Math.ceil(itemContainer.slotQty / MAX_SLOTS_PER_PAGE);
15591
15596
  var handleSetShortcut = function handleSetShortcut(item, index) {
15592
15597
  if (item.type === ItemType.Consumable || item.type === ItemType.Tool) {
15593
15598
  setItemShortcut == null ? void 0 : setItemShortcut(item.key, index);
@@ -15595,8 +15600,11 @@ var ItemContainer$1 = function ItemContainer(_ref) {
15595
15600
  };
15596
15601
  var onRenderSlots = function onRenderSlots() {
15597
15602
  var slots = [];
15598
- for (var i = 0; i < itemContainer.slotQty; i++) {
15603
+ var start = (currentPage - 1) * MAX_SLOTS_PER_PAGE;
15604
+ var end = start + MAX_SLOTS_PER_PAGE;
15605
+ for (var i = start; i < end && i < itemContainer.slotQty; i++) {
15599
15606
  var _itemContainer$slots;
15607
+ console.log(itemContainer);
15600
15608
  slots.push(React.createElement(ItemSlot, {
15601
15609
  isContextMenuDisabled: disableContextMenu,
15602
15610
  key: i,
@@ -15647,6 +15655,16 @@ var ItemContainer$1 = function ItemContainer(_ref) {
15647
15655
  }
15648
15656
  return slots;
15649
15657
  };
15658
+ var goToNextPage = function goToNextPage() {
15659
+ setCurrentPage(function (current) {
15660
+ return Math.min(current + 1, totalPages);
15661
+ });
15662
+ };
15663
+ var goToPreviousPage = function goToPreviousPage() {
15664
+ setCurrentPage(function (current) {
15665
+ return Math.max(current - 1, 1);
15666
+ });
15667
+ };
15650
15668
  return React.createElement(React.Fragment, null, React.createElement(SlotsContainer, {
15651
15669
  title: itemContainer.name || 'Container',
15652
15670
  onClose: onClose,
@@ -15663,7 +15681,23 @@ var ItemContainer$1 = function ItemContainer(_ref) {
15663
15681
  atlasJSON: atlasJSON
15664
15682
  }), React.createElement(ItemsContainer, {
15665
15683
  className: "item-container-body"
15666
- }, onRenderSlots())), quantitySelect.isOpen && React.createElement(ModalPortal, null, React.createElement(QuantitySelectorContainer, null, React.createElement(ItemQuantitySelector, {
15684
+ }, onRenderSlots()), totalPages > 1 && React.createElement(ArrowContainer$1, null, currentPage > 1 && React.createElement(SelectArrow, {
15685
+ className: 'arrow .arrow-up',
15686
+ direction: "left",
15687
+ onPointerDown: function onPointerDown() {
15688
+ if (currentPage > 1) {
15689
+ goToPreviousPage();
15690
+ }
15691
+ }
15692
+ }), currentPage < totalPages && React.createElement(SelectArrow, {
15693
+ className: 'arrow .arrow-down',
15694
+ direction: "right",
15695
+ onPointerDown: function onPointerDown() {
15696
+ if (currentPage < totalPages) {
15697
+ goToNextPage();
15698
+ }
15699
+ }
15700
+ }))), quantitySelect.isOpen && React.createElement(ModalPortal, null, React.createElement(QuantitySelectorContainer, null, React.createElement(ItemQuantitySelector, {
15667
15701
  quantity: quantitySelect.maxQuantity,
15668
15702
  onConfirm: function onConfirm(quantity) {
15669
15703
  quantitySelect.callback(quantity);
@@ -15691,6 +15725,10 @@ var QuantitySelectorContainer = /*#__PURE__*/styled.div.withConfig({
15691
15725
  displayName: "ItemContainer__QuantitySelectorContainer",
15692
15726
  componentId: "sc-15y5p9l-1"
15693
15727
  })(["position:absolute;top:0;left:0;width:100vw;height:100vh;z-index:100;display:flex;justify-content:center;align-items:center;background-color:rgba(0,0,0,0.5);"]);
15728
+ var ArrowContainer$1 = /*#__PURE__*/styled.div.withConfig({
15729
+ displayName: "ItemContainer__ArrowContainer",
15730
+ componentId: "sc-15y5p9l-2"
15731
+ })(["margin-top:10px;margin-bottom:30px;span:first-child{margin-left:20px;}span:last-child{margin-right:20px;}"]);
15694
15732
 
15695
15733
  var LeaderboardTable = function LeaderboardTable(props) {
15696
15734
  var items = props.items,
@@ -17961,8 +17999,7 @@ var TradingItemRow = function TradingItemRow(_ref) {
17961
17999
  traderItem = _ref.traderItem,
17962
18000
  selectedQty = _ref.selectedQty,
17963
18001
  equipmentSet = _ref.equipmentSet,
17964
- scale = _ref.scale,
17965
- isBuy = _ref.isBuy;
18002
+ scale = _ref.scale;
17966
18003
  var onLeftClick = function onLeftClick(qty) {
17967
18004
  if (qty === void 0) {
17968
18005
  qty = 1;
@@ -17976,31 +18013,6 @@ var TradingItemRow = function TradingItemRow(_ref) {
17976
18013
  }
17977
18014
  onQuantityChange(traderItem, Math.min((_traderItem$stackQty = traderItem.stackQty) != null ? _traderItem$stackQty : 999, selectedQty + qty));
17978
18015
  };
17979
- var renderAccountTypeIndicator = function renderAccountTypeIndicator() {
17980
- if (isBuy) {
17981
- switch (traderItem == null ? void 0 : traderItem.accountType) {
17982
- case UserAccountTypes.PremiumBronze:
17983
- return React.createElement("div", null, React.createElement(SmallCircle, {
17984
- color: "#CD7F32"
17985
- }), " Account");
17986
- case UserAccountTypes.PremiumSilver:
17987
- return React.createElement("div", null, React.createElement(SmallCircle, {
17988
- color: "#C0C0C0"
17989
- }), " Account");
17990
- case UserAccountTypes.PremiumGold:
17991
- return React.createElement("div", null, React.createElement(SmallCircle, {
17992
- color: "#FFD700"
17993
- }), " Account");
17994
- case UserAccountTypes.PremiumUltimate:
17995
- return React.createElement("div", null, React.createElement(SmallCircle, {
17996
- color: "#002E99"
17997
- }), " Account");
17998
- default:
17999
- return null;
18000
- }
18001
- }
18002
- return null;
18003
- };
18004
18016
  return React.createElement(ItemWrapper, null, React.createElement(ItemIconContainer$1, null, React.createElement(SpriteContainer$2, null, React.createElement(ItemInfoWrapper, {
18005
18017
  atlasIMG: atlasIMG,
18006
18018
  atlasJSON: atlasJSON,
@@ -18020,7 +18032,7 @@ var TradingItemRow = function TradingItemRow(_ref) {
18020
18032
  })))), React.createElement(ItemNameContainer, null, React.createElement(NameValue, null, React.createElement("p", null, React.createElement(Ellipsis, {
18021
18033
  maxLines: 1,
18022
18034
  maxWidth: "250px"
18023
- }, capitalize(traderItem.name), renderAccountTypeIndicator())), React.createElement("p", null, "$", traderItem.price))), React.createElement(QuantityContainer$1, null, React.createElement(SelectArrow, {
18035
+ }, capitalize(traderItem.name))), React.createElement("p", null, "$", traderItem.price))), React.createElement(QuantityContainer$1, null, React.createElement(SelectArrow, {
18024
18036
  size: 32,
18025
18037
  className: "arrow-selector",
18026
18038
  direction: "left",
@@ -18042,53 +18054,45 @@ var TradingItemRow = function TradingItemRow(_ref) {
18042
18054
  onPointerDown: onRightClick.bind(null, outerQty)
18043
18055
  })));
18044
18056
  };
18045
- // Styled component for the small circle
18046
- var SmallCircle = /*#__PURE__*/styled.span.withConfig({
18047
- displayName: "TradingItemRow__SmallCircle",
18048
- componentId: "sc-mja0b5-0"
18049
- })(["display:inline-block;margin-left:8px;height:10px;width:10px;background-color:", ";border-radius:50%;"], function (_ref2) {
18050
- var color = _ref2.color;
18051
- return color;
18052
- });
18053
18057
  var StyledArrow = /*#__PURE__*/styled(SelectArrow).withConfig({
18054
18058
  displayName: "TradingItemRow__StyledArrow",
18055
- componentId: "sc-mja0b5-1"
18059
+ componentId: "sc-mja0b5-0"
18056
18060
  })(["margin:40px;"]);
18057
18061
  var ItemWrapper = /*#__PURE__*/styled.div.withConfig({
18058
18062
  displayName: "TradingItemRow__ItemWrapper",
18059
- componentId: "sc-mja0b5-2"
18063
+ componentId: "sc-mja0b5-1"
18060
18064
  })(["width:100%;margin:auto;display:flex;justify-content:space-between;margin-bottom:1rem;&:hover{background-color:", ";}padding:0.5rem;"], uiColors.darkGray);
18061
18065
  var ItemNameContainer = /*#__PURE__*/styled.div.withConfig({
18062
18066
  displayName: "TradingItemRow__ItemNameContainer",
18063
- componentId: "sc-mja0b5-3"
18067
+ componentId: "sc-mja0b5-2"
18064
18068
  })(["flex:60%;"]);
18065
18069
  var ItemIconContainer$1 = /*#__PURE__*/styled.div.withConfig({
18066
18070
  displayName: "TradingItemRow__ItemIconContainer",
18067
- componentId: "sc-mja0b5-4"
18071
+ componentId: "sc-mja0b5-3"
18068
18072
  })(["display:flex;justify-content:flex-start;align-items:center;flex:0 0 58px;"]);
18069
18073
  var SpriteContainer$2 = /*#__PURE__*/styled.div.withConfig({
18070
18074
  displayName: "TradingItemRow__SpriteContainer",
18071
- componentId: "sc-mja0b5-5"
18075
+ componentId: "sc-mja0b5-4"
18072
18076
  })(["position:relative;top:-0.5rem;left:0.5rem;"]);
18073
18077
  var NameValue = /*#__PURE__*/styled.div.withConfig({
18074
18078
  displayName: "TradingItemRow__NameValue",
18075
- componentId: "sc-mja0b5-6"
18079
+ componentId: "sc-mja0b5-5"
18076
18080
  })(["p{font-size:0.75rem;margin:0;}"]);
18077
18081
  var Item$1 = /*#__PURE__*/styled.span.withConfig({
18078
18082
  displayName: "TradingItemRow__Item",
18079
- componentId: "sc-mja0b5-7"
18083
+ componentId: "sc-mja0b5-6"
18080
18084
  })(["color:white;text-align:center;z-index:1;width:100%;"]);
18081
18085
  var TextOverlay$2 = /*#__PURE__*/styled.div.withConfig({
18082
18086
  displayName: "TradingItemRow__TextOverlay",
18083
- componentId: "sc-mja0b5-8"
18087
+ componentId: "sc-mja0b5-7"
18084
18088
  })(["width:100%;position:relative;"]);
18085
18089
  var QuantityContainer$1 = /*#__PURE__*/styled.div.withConfig({
18086
18090
  displayName: "TradingItemRow__QuantityContainer",
18087
- componentId: "sc-mja0b5-9"
18091
+ componentId: "sc-mja0b5-8"
18088
18092
  })(["position:relative;display:flex;min-width:100px;width:40%;justify-content:center;align-items:center;flex:40%;"]);
18089
18093
  var QuantityDisplay = /*#__PURE__*/styled.div.withConfig({
18090
18094
  displayName: "TradingItemRow__QuantityDisplay",
18091
- componentId: "sc-mja0b5-10"
18095
+ componentId: "sc-mja0b5-9"
18092
18096
  })(["font-size:", ";"], uiFonts.size.small);
18093
18097
 
18094
18098
  var TradingMenu = function TradingMenu(_ref) {
@@ -18174,8 +18178,7 @@ var TradingMenu = function TradingMenu(_ref) {
18174
18178
  traderItem: tradeItem,
18175
18179
  selectedQty: (_qtyMap$get = qtyMap.get(tradeItem.key)) != null ? _qtyMap$get : 0,
18176
18180
  equipmentSet: equipmentSet,
18177
- scale: scale,
18178
- isBuy: isBuy()
18181
+ scale: scale
18179
18182
  }));
18180
18183
  })), React.createElement(GoldWrapper, null, React.createElement("p", null, "Available Gold:"), React.createElement("p", null, "$", characterAvailableGold)), React.createElement(TotalWrapper, null, React.createElement("p", null, "Total:"), React.createElement("p", null, "$", sum)), !hasGoldForSale() ? React.createElement(AlertWrapper, null, React.createElement("p", null, " Sorry, not enough money.")) : React.createElement(GoldWrapper, null, React.createElement("p", null, "Final Gold:"), React.createElement("p", null, "$", getFinalGold())), React.createElement(ButtonWrapper$2, null, React.createElement(Button, {
18181
18184
  buttonType: ButtonTypes.RPGUIButton,