@rpg-engine/long-bow 0.5.13 → 0.5.14

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,11 +15595,8 @@ 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
- console.log(itemContainer);
15608
15600
  slots.push(React.createElement(ItemSlot, {
15609
15601
  isContextMenuDisabled: disableContextMenu,
15610
15602
  key: i,
@@ -15655,16 +15647,6 @@ var ItemContainer$1 = function ItemContainer(_ref) {
15655
15647
  }
15656
15648
  return slots;
15657
15649
  };
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
- };
15668
15650
  return React.createElement(React.Fragment, null, React.createElement(SlotsContainer, {
15669
15651
  title: itemContainer.name || 'Container',
15670
15652
  onClose: onClose,
@@ -15681,23 +15663,7 @@ var ItemContainer$1 = function ItemContainer(_ref) {
15681
15663
  atlasJSON: atlasJSON
15682
15664
  }), React.createElement(ItemsContainer, {
15683
15665
  className: "item-container-body"
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, {
15666
+ }, onRenderSlots())), quantitySelect.isOpen && React.createElement(ModalPortal, null, React.createElement(QuantitySelectorContainer, null, React.createElement(ItemQuantitySelector, {
15701
15667
  quantity: quantitySelect.maxQuantity,
15702
15668
  onConfirm: function onConfirm(quantity) {
15703
15669
  quantitySelect.callback(quantity);
@@ -15725,10 +15691,6 @@ var QuantitySelectorContainer = /*#__PURE__*/styled.div.withConfig({
15725
15691
  displayName: "ItemContainer__QuantitySelectorContainer",
15726
15692
  componentId: "sc-15y5p9l-1"
15727
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);"]);
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;}"]);
15732
15694
 
15733
15695
  var LeaderboardTable = function LeaderboardTable(props) {
15734
15696
  var items = props.items,
@@ -17999,7 +17961,8 @@ var TradingItemRow = function TradingItemRow(_ref) {
17999
17961
  traderItem = _ref.traderItem,
18000
17962
  selectedQty = _ref.selectedQty,
18001
17963
  equipmentSet = _ref.equipmentSet,
18002
- scale = _ref.scale;
17964
+ scale = _ref.scale,
17965
+ isBuy = _ref.isBuy;
18003
17966
  var onLeftClick = function onLeftClick(qty) {
18004
17967
  if (qty === void 0) {
18005
17968
  qty = 1;
@@ -18013,6 +17976,39 @@ var TradingItemRow = function TradingItemRow(_ref) {
18013
17976
  }
18014
17977
  onQuantityChange(traderItem, Math.min((_traderItem$stackQty = traderItem.stackQty) != null ? _traderItem$stackQty : 999, selectedQty + qty));
18015
17978
  };
17979
+ var renderAccountTypeIndicator = function renderAccountTypeIndicator() {
17980
+ if (isBuy && traderItem.canBePurchasedOnlyByPremiumPlans) {
17981
+ return traderItem.canBePurchasedOnlyByPremiumPlans.map(function (accountType) {
17982
+ if (accountType !== UserAccountTypes.Free) {
17983
+ var backgroundColor;
17984
+ var textColor = 'black';
17985
+ switch (accountType) {
17986
+ case UserAccountTypes.PremiumBronze:
17987
+ backgroundColor = '#CD7F32';
17988
+ break;
17989
+ case UserAccountTypes.PremiumSilver:
17990
+ backgroundColor = '#C0C0C0';
17991
+ break;
17992
+ case UserAccountTypes.PremiumGold:
17993
+ backgroundColor = '#FFD700';
17994
+ break;
17995
+ case UserAccountTypes.PremiumUltimate:
17996
+ backgroundColor = '#002E99';
17997
+ break;
17998
+ default:
17999
+ return null;
18000
+ }
18001
+ return React.createElement(PremiumLabel, {
18002
+ backgroundColor: backgroundColor,
18003
+ textColor: textColor,
18004
+ key: accountType
18005
+ }, capitalize(accountType) + ' PA');
18006
+ }
18007
+ return null;
18008
+ });
18009
+ }
18010
+ return null;
18011
+ };
18016
18012
  return React.createElement(ItemWrapper, null, React.createElement(ItemIconContainer$1, null, React.createElement(SpriteContainer$2, null, React.createElement(ItemInfoWrapper, {
18017
18013
  atlasIMG: atlasIMG,
18018
18014
  atlasJSON: atlasJSON,
@@ -18032,7 +18028,7 @@ var TradingItemRow = function TradingItemRow(_ref) {
18032
18028
  })))), React.createElement(ItemNameContainer, null, React.createElement(NameValue, null, React.createElement("p", null, React.createElement(Ellipsis, {
18033
18029
  maxLines: 1,
18034
18030
  maxWidth: "250px"
18035
- }, capitalize(traderItem.name))), React.createElement("p", null, "$", traderItem.price))), React.createElement(QuantityContainer$1, null, React.createElement(SelectArrow, {
18031
+ }, capitalize(traderItem.name))), React.createElement("p", null, "$", traderItem.price), React.createElement("p", null, renderAccountTypeIndicator()))), React.createElement(QuantityContainer$1, null, React.createElement(SelectArrow, {
18036
18032
  size: 32,
18037
18033
  className: "arrow-selector",
18038
18034
  direction: "left",
@@ -18054,45 +18050,55 @@ var TradingItemRow = function TradingItemRow(_ref) {
18054
18050
  onPointerDown: onRightClick.bind(null, outerQty)
18055
18051
  })));
18056
18052
  };
18053
+ var PremiumLabel = /*#__PURE__*/styled.span.withConfig({
18054
+ displayName: "TradingItemRow__PremiumLabel",
18055
+ componentId: "sc-mja0b5-0"
18056
+ })(["background-color:", ";color:", ";font-weight:bold;padding:2px 5px;border-radius:5px;margin-right:5px;margin-bottom:5px;display:inline-block;"], function (_ref2) {
18057
+ var backgroundColor = _ref2.backgroundColor;
18058
+ return backgroundColor;
18059
+ }, function (_ref3) {
18060
+ var textColor = _ref3.textColor;
18061
+ return textColor;
18062
+ });
18057
18063
  var StyledArrow = /*#__PURE__*/styled(SelectArrow).withConfig({
18058
18064
  displayName: "TradingItemRow__StyledArrow",
18059
- componentId: "sc-mja0b5-0"
18065
+ componentId: "sc-mja0b5-1"
18060
18066
  })(["margin:40px;"]);
18061
18067
  var ItemWrapper = /*#__PURE__*/styled.div.withConfig({
18062
18068
  displayName: "TradingItemRow__ItemWrapper",
18063
- componentId: "sc-mja0b5-1"
18069
+ componentId: "sc-mja0b5-2"
18064
18070
  })(["width:100%;margin:auto;display:flex;justify-content:space-between;margin-bottom:1rem;&:hover{background-color:", ";}padding:0.5rem;"], uiColors.darkGray);
18065
18071
  var ItemNameContainer = /*#__PURE__*/styled.div.withConfig({
18066
18072
  displayName: "TradingItemRow__ItemNameContainer",
18067
- componentId: "sc-mja0b5-2"
18073
+ componentId: "sc-mja0b5-3"
18068
18074
  })(["flex:60%;"]);
18069
18075
  var ItemIconContainer$1 = /*#__PURE__*/styled.div.withConfig({
18070
18076
  displayName: "TradingItemRow__ItemIconContainer",
18071
- componentId: "sc-mja0b5-3"
18077
+ componentId: "sc-mja0b5-4"
18072
18078
  })(["display:flex;justify-content:flex-start;align-items:center;flex:0 0 58px;"]);
18073
18079
  var SpriteContainer$2 = /*#__PURE__*/styled.div.withConfig({
18074
18080
  displayName: "TradingItemRow__SpriteContainer",
18075
- componentId: "sc-mja0b5-4"
18081
+ componentId: "sc-mja0b5-5"
18076
18082
  })(["position:relative;top:-0.5rem;left:0.5rem;"]);
18077
18083
  var NameValue = /*#__PURE__*/styled.div.withConfig({
18078
18084
  displayName: "TradingItemRow__NameValue",
18079
- componentId: "sc-mja0b5-5"
18085
+ componentId: "sc-mja0b5-6"
18080
18086
  })(["p{font-size:0.75rem;margin:0;}"]);
18081
18087
  var Item$1 = /*#__PURE__*/styled.span.withConfig({
18082
18088
  displayName: "TradingItemRow__Item",
18083
- componentId: "sc-mja0b5-6"
18089
+ componentId: "sc-mja0b5-7"
18084
18090
  })(["color:white;text-align:center;z-index:1;width:100%;"]);
18085
18091
  var TextOverlay$2 = /*#__PURE__*/styled.div.withConfig({
18086
18092
  displayName: "TradingItemRow__TextOverlay",
18087
- componentId: "sc-mja0b5-7"
18093
+ componentId: "sc-mja0b5-8"
18088
18094
  })(["width:100%;position:relative;"]);
18089
18095
  var QuantityContainer$1 = /*#__PURE__*/styled.div.withConfig({
18090
18096
  displayName: "TradingItemRow__QuantityContainer",
18091
- componentId: "sc-mja0b5-8"
18097
+ componentId: "sc-mja0b5-9"
18092
18098
  })(["position:relative;display:flex;min-width:100px;width:40%;justify-content:center;align-items:center;flex:40%;"]);
18093
18099
  var QuantityDisplay = /*#__PURE__*/styled.div.withConfig({
18094
18100
  displayName: "TradingItemRow__QuantityDisplay",
18095
- componentId: "sc-mja0b5-9"
18101
+ componentId: "sc-mja0b5-10"
18096
18102
  })(["font-size:", ";"], uiFonts.size.small);
18097
18103
 
18098
18104
  var TradingMenu = function TradingMenu(_ref) {
@@ -18178,7 +18184,8 @@ var TradingMenu = function TradingMenu(_ref) {
18178
18184
  traderItem: tradeItem,
18179
18185
  selectedQty: (_qtyMap$get = qtyMap.get(tradeItem.key)) != null ? _qtyMap$get : 0,
18180
18186
  equipmentSet: equipmentSet,
18181
- scale: scale
18187
+ scale: scale,
18188
+ isBuy: isBuy()
18182
18189
  }));
18183
18190
  })), 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, {
18184
18191
  buttonType: ButtonTypes.RPGUIButton,