@rpg-engine/long-bow 0.5.10 → 0.5.12

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 } 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, UserAccountTypes } 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,7 +15578,6 @@ 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;
15582
15581
  var _useState = useState({
15583
15582
  isOpen: false,
15584
15583
  maxQuantity: 1,
@@ -15589,10 +15588,6 @@ var ItemContainer$1 = function ItemContainer(_ref) {
15589
15588
  var _useState2 = useState(-1),
15590
15589
  settingShortcutIndex = _useState2[0],
15591
15590
  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);
15596
15591
  var handleSetShortcut = function handleSetShortcut(item, index) {
15597
15592
  if (item.type === ItemType.Consumable || item.type === ItemType.Tool) {
15598
15593
  setItemShortcut == null ? void 0 : setItemShortcut(item.key, index);
@@ -15600,9 +15595,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
15600
15595
  };
15601
15596
  var onRenderSlots = function onRenderSlots() {
15602
15597
  var slots = [];
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++) {
15598
+ for (var i = 0; i < itemContainer.slotQty; i++) {
15606
15599
  var _itemContainer$slots;
15607
15600
  slots.push(React.createElement(ItemSlot, {
15608
15601
  isContextMenuDisabled: disableContextMenu,
@@ -15654,16 +15647,6 @@ var ItemContainer$1 = function ItemContainer(_ref) {
15654
15647
  }
15655
15648
  return slots;
15656
15649
  };
15657
- var goToNextPage = function goToNextPage() {
15658
- setCurrentPage(function (current) {
15659
- return Math.min(current + 1, totalPages);
15660
- });
15661
- };
15662
- var goToPreviousPage = function goToPreviousPage() {
15663
- setCurrentPage(function (current) {
15664
- return Math.max(current - 1, 1);
15665
- });
15666
- };
15667
15650
  return React.createElement(React.Fragment, null, React.createElement(SlotsContainer, {
15668
15651
  title: itemContainer.name || 'Container',
15669
15652
  onClose: onClose,
@@ -15680,23 +15663,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
15680
15663
  atlasJSON: atlasJSON
15681
15664
  }), React.createElement(ItemsContainer, {
15682
15665
  className: "item-container-body"
15683
- }, onRenderSlots()), totalPages > 1 && React.createElement(ArrowContainer$1, null, React.createElement(SelectArrow, {
15684
- className: 'arrow .arrow-up',
15685
- direction: "left",
15686
- onPointerDown: function onPointerDown() {
15687
- if (currentPage > 1) {
15688
- goToPreviousPage();
15689
- }
15690
- }
15691
- }), React.createElement(SelectArrow, {
15692
- className: 'arrow .arrow-down',
15693
- direction: "right",
15694
- onPointerDown: function onPointerDown() {
15695
- if (currentPage < totalPages) {
15696
- goToNextPage();
15697
- }
15698
- }
15699
- }))), quantitySelect.isOpen && React.createElement(ModalPortal, null, React.createElement(QuantitySelectorContainer, null, React.createElement(ItemQuantitySelector, {
15666
+ }, onRenderSlots())), quantitySelect.isOpen && React.createElement(ModalPortal, null, React.createElement(QuantitySelectorContainer, null, React.createElement(ItemQuantitySelector, {
15700
15667
  quantity: quantitySelect.maxQuantity,
15701
15668
  onConfirm: function onConfirm(quantity) {
15702
15669
  quantitySelect.callback(quantity);
@@ -15724,10 +15691,6 @@ var QuantitySelectorContainer = /*#__PURE__*/styled.div.withConfig({
15724
15691
  displayName: "ItemContainer__QuantitySelectorContainer",
15725
15692
  componentId: "sc-15y5p9l-1"
15726
15693
  })(["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);"]);
15727
- var ArrowContainer$1 = /*#__PURE__*/styled.div.withConfig({
15728
- displayName: "ItemContainer__ArrowContainer",
15729
- componentId: "sc-15y5p9l-2"
15730
- })(["margin-top:10px;margin-bottom:30px;span:first-child{margin-left:20px;}span:last-child{margin-right:20px;}"]);
15731
15694
 
15732
15695
  var LeaderboardTable = function LeaderboardTable(props) {
15733
15696
  var items = props.items,
@@ -17998,7 +17961,8 @@ var TradingItemRow = function TradingItemRow(_ref) {
17998
17961
  traderItem = _ref.traderItem,
17999
17962
  selectedQty = _ref.selectedQty,
18000
17963
  equipmentSet = _ref.equipmentSet,
18001
- scale = _ref.scale;
17964
+ scale = _ref.scale,
17965
+ isBuy = _ref.isBuy;
18002
17966
  var onLeftClick = function onLeftClick(qty) {
18003
17967
  if (qty === void 0) {
18004
17968
  qty = 1;
@@ -18012,6 +17976,31 @@ var TradingItemRow = function TradingItemRow(_ref) {
18012
17976
  }
18013
17977
  onQuantityChange(traderItem, Math.min((_traderItem$stackQty = traderItem.stackQty) != null ? _traderItem$stackQty : 999, selectedQty + qty));
18014
17978
  };
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
+ };
18015
18004
  return React.createElement(ItemWrapper, null, React.createElement(ItemIconContainer$1, null, React.createElement(SpriteContainer$2, null, React.createElement(ItemInfoWrapper, {
18016
18005
  atlasIMG: atlasIMG,
18017
18006
  atlasJSON: atlasJSON,
@@ -18031,7 +18020,7 @@ var TradingItemRow = function TradingItemRow(_ref) {
18031
18020
  })))), React.createElement(ItemNameContainer, null, React.createElement(NameValue, null, React.createElement("p", null, React.createElement(Ellipsis, {
18032
18021
  maxLines: 1,
18033
18022
  maxWidth: "250px"
18034
- }, capitalize(traderItem.name))), React.createElement("p", null, "$", traderItem.price))), React.createElement(QuantityContainer$1, null, React.createElement(SelectArrow, {
18023
+ }, capitalize(traderItem.name), renderAccountTypeIndicator())), React.createElement("p", null, "$", traderItem.price))), React.createElement(QuantityContainer$1, null, React.createElement(SelectArrow, {
18035
18024
  size: 32,
18036
18025
  className: "arrow-selector",
18037
18026
  direction: "left",
@@ -18053,45 +18042,53 @@ var TradingItemRow = function TradingItemRow(_ref) {
18053
18042
  onPointerDown: onRightClick.bind(null, outerQty)
18054
18043
  })));
18055
18044
  };
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
+ });
18056
18053
  var StyledArrow = /*#__PURE__*/styled(SelectArrow).withConfig({
18057
18054
  displayName: "TradingItemRow__StyledArrow",
18058
- componentId: "sc-mja0b5-0"
18055
+ componentId: "sc-mja0b5-1"
18059
18056
  })(["margin:40px;"]);
18060
18057
  var ItemWrapper = /*#__PURE__*/styled.div.withConfig({
18061
18058
  displayName: "TradingItemRow__ItemWrapper",
18062
- componentId: "sc-mja0b5-1"
18059
+ componentId: "sc-mja0b5-2"
18063
18060
  })(["width:100%;margin:auto;display:flex;justify-content:space-between;margin-bottom:1rem;&:hover{background-color:", ";}padding:0.5rem;"], uiColors.darkGray);
18064
18061
  var ItemNameContainer = /*#__PURE__*/styled.div.withConfig({
18065
18062
  displayName: "TradingItemRow__ItemNameContainer",
18066
- componentId: "sc-mja0b5-2"
18063
+ componentId: "sc-mja0b5-3"
18067
18064
  })(["flex:60%;"]);
18068
18065
  var ItemIconContainer$1 = /*#__PURE__*/styled.div.withConfig({
18069
18066
  displayName: "TradingItemRow__ItemIconContainer",
18070
- componentId: "sc-mja0b5-3"
18067
+ componentId: "sc-mja0b5-4"
18071
18068
  })(["display:flex;justify-content:flex-start;align-items:center;flex:0 0 58px;"]);
18072
18069
  var SpriteContainer$2 = /*#__PURE__*/styled.div.withConfig({
18073
18070
  displayName: "TradingItemRow__SpriteContainer",
18074
- componentId: "sc-mja0b5-4"
18071
+ componentId: "sc-mja0b5-5"
18075
18072
  })(["position:relative;top:-0.5rem;left:0.5rem;"]);
18076
18073
  var NameValue = /*#__PURE__*/styled.div.withConfig({
18077
18074
  displayName: "TradingItemRow__NameValue",
18078
- componentId: "sc-mja0b5-5"
18075
+ componentId: "sc-mja0b5-6"
18079
18076
  })(["p{font-size:0.75rem;margin:0;}"]);
18080
18077
  var Item$1 = /*#__PURE__*/styled.span.withConfig({
18081
18078
  displayName: "TradingItemRow__Item",
18082
- componentId: "sc-mja0b5-6"
18079
+ componentId: "sc-mja0b5-7"
18083
18080
  })(["color:white;text-align:center;z-index:1;width:100%;"]);
18084
18081
  var TextOverlay$2 = /*#__PURE__*/styled.div.withConfig({
18085
18082
  displayName: "TradingItemRow__TextOverlay",
18086
- componentId: "sc-mja0b5-7"
18083
+ componentId: "sc-mja0b5-8"
18087
18084
  })(["width:100%;position:relative;"]);
18088
18085
  var QuantityContainer$1 = /*#__PURE__*/styled.div.withConfig({
18089
18086
  displayName: "TradingItemRow__QuantityContainer",
18090
- componentId: "sc-mja0b5-8"
18087
+ componentId: "sc-mja0b5-9"
18091
18088
  })(["position:relative;display:flex;min-width:100px;width:40%;justify-content:center;align-items:center;flex:40%;"]);
18092
18089
  var QuantityDisplay = /*#__PURE__*/styled.div.withConfig({
18093
18090
  displayName: "TradingItemRow__QuantityDisplay",
18094
- componentId: "sc-mja0b5-9"
18091
+ componentId: "sc-mja0b5-10"
18095
18092
  })(["font-size:", ";"], uiFonts.size.small);
18096
18093
 
18097
18094
  var TradingMenu = function TradingMenu(_ref) {
@@ -18177,7 +18174,8 @@ var TradingMenu = function TradingMenu(_ref) {
18177
18174
  traderItem: tradeItem,
18178
18175
  selectedQty: (_qtyMap$get = qtyMap.get(tradeItem.key)) != null ? _qtyMap$get : 0,
18179
18176
  equipmentSet: equipmentSet,
18180
- scale: scale
18177
+ scale: scale,
18178
+ isBuy: isBuy()
18181
18179
  }));
18182
18180
  })), 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, {
18183
18181
  buttonType: ButtonTypes.RPGUIButton,