@rpg-engine/long-bow 0.7.82 → 0.7.84
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/TradingMenu/PremiumLabel.d.ts +7 -0
- package/dist/components/TradingMenu/useTradingGold.d.ts +16 -0
- package/dist/long-bow.cjs.development.js +189 -149
- 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 +189 -149
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Marketplace/MarketplaceRows.tsx +16 -0
- package/src/components/TradingMenu/PremiumLabel.tsx +62 -0
- package/src/components/TradingMenu/TradingItemRow.tsx +36 -88
- package/src/components/TradingMenu/TradingMenu.tsx +77 -136
- package/src/components/TradingMenu/useTradingGold.ts +64 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ITradeRequestItem, ITradeResponseItem, TradeTransactionType } from '@rpg-engine/shared';
|
|
2
|
+
interface ITradingGoldHook {
|
|
3
|
+
characterAvailableGold: number;
|
|
4
|
+
type: TradeTransactionType;
|
|
5
|
+
traderItems: ITradeResponseItem[];
|
|
6
|
+
}
|
|
7
|
+
export declare const useTradingGold: ({ characterAvailableGold, type, traderItems, }: ITradingGoldHook) => {
|
|
8
|
+
sum: number;
|
|
9
|
+
qtyMap: Map<string, number>;
|
|
10
|
+
isBuy: () => boolean;
|
|
11
|
+
hasGoldForSale: () => boolean;
|
|
12
|
+
getFinalGold: () => number;
|
|
13
|
+
getTradeItems: () => ITradeRequestItem[];
|
|
14
|
+
updateQuantity: (item: ITradeResponseItem, selectedQty: number) => void;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -31139,13 +31139,16 @@ var MarketplaceRows = function MarketplaceRows(_ref) {
|
|
|
31139
31139
|
onMarketPlaceItemBuy = _ref.onMarketPlaceItemBuy,
|
|
31140
31140
|
onMarketPlaceItemRemove = _ref.onMarketPlaceItemRemove,
|
|
31141
31141
|
disabled = _ref.disabled;
|
|
31142
|
+
var renderGems = function renderGems(item) {
|
|
31143
|
+
return item.attachedGems && onRenderGems(item);
|
|
31144
|
+
};
|
|
31142
31145
|
return React__default.createElement(MarketplaceWrapper, null, React__default.createElement(ItemIconContainer, null, React__default.createElement(SpriteContainer$1, null, React__default.createElement(ItemInfoWrapper, {
|
|
31143
31146
|
item: item,
|
|
31144
31147
|
atlasIMG: atlasIMG,
|
|
31145
31148
|
atlasJSON: atlasJSON,
|
|
31146
31149
|
equipmentSet: equipmentSet,
|
|
31147
31150
|
scale: scale
|
|
31148
|
-
}, React__default.createElement(RarityContainer, {
|
|
31151
|
+
}, React__default.createElement(GemContainer, null, renderGems(item)), React__default.createElement(RarityContainer, {
|
|
31149
31152
|
item: item
|
|
31150
31153
|
}, React__default.createElement(SpriteFromAtlas, {
|
|
31151
31154
|
atlasIMG: atlasIMG,
|
|
@@ -31156,7 +31159,8 @@ var MarketplaceRows = function MarketplaceRows(_ref) {
|
|
|
31156
31159
|
texturePath: item.texturePath,
|
|
31157
31160
|
isStackable: item.isStackable
|
|
31158
31161
|
}, atlasJSON),
|
|
31159
|
-
imgScale: 2
|
|
31162
|
+
imgScale: 2,
|
|
31163
|
+
imgClassname: "sprite-from-atlas-img--item"
|
|
31160
31164
|
})), React__default.createElement(QuantityContainer, null, item.stackQty && item.stackQty > 1 && "x" + Math.round(item.stackQty * 10) / 10))), React__default.createElement(PriceValue, null, React__default.createElement("p", null, React__default.createElement(Ellipsis, {
|
|
31161
31165
|
maxLines: 1,
|
|
31162
31166
|
maxWidth: "200px",
|
|
@@ -31188,33 +31192,37 @@ var QuantityContainer = /*#__PURE__*/styled__default.p.withConfig({
|
|
|
31188
31192
|
displayName: "MarketplaceRows__QuantityContainer",
|
|
31189
31193
|
componentId: "sc-wmpr1o-1"
|
|
31190
31194
|
})(["position:absolute;display:block;top:15px;left:25px;font-size:", " !important;"], uiFonts.size.xsmall);
|
|
31195
|
+
var GemContainer = /*#__PURE__*/styled__default.p.withConfig({
|
|
31196
|
+
displayName: "MarketplaceRows__GemContainer",
|
|
31197
|
+
componentId: "sc-wmpr1o-2"
|
|
31198
|
+
})(["position:absolute;display:block;top:-5px;left:-10px;font-size:", " !important;"], uiFonts.size.xsmall);
|
|
31191
31199
|
var Flex$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
31192
31200
|
displayName: "MarketplaceRows__Flex",
|
|
31193
|
-
componentId: "sc-wmpr1o-
|
|
31201
|
+
componentId: "sc-wmpr1o-3"
|
|
31194
31202
|
})(["display:flex;gap:24px;"]);
|
|
31195
31203
|
var ItemIconContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
31196
31204
|
displayName: "MarketplaceRows__ItemIconContainer",
|
|
31197
|
-
componentId: "sc-wmpr1o-
|
|
31205
|
+
componentId: "sc-wmpr1o-4"
|
|
31198
31206
|
})(["display:flex;justify-content:flex-start;align-items:center;"]);
|
|
31199
31207
|
var GoldContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
31200
31208
|
displayName: "MarketplaceRows__GoldContainer",
|
|
31201
|
-
componentId: "sc-wmpr1o-
|
|
31209
|
+
componentId: "sc-wmpr1o-5"
|
|
31202
31210
|
})(["position:relative;top:-0.5rem;left:0.5rem;"]);
|
|
31203
31211
|
var SpriteContainer$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
31204
31212
|
displayName: "MarketplaceRows__SpriteContainer",
|
|
31205
|
-
componentId: "sc-wmpr1o-
|
|
31213
|
+
componentId: "sc-wmpr1o-6"
|
|
31206
31214
|
})(["position:relative;left:0.5rem;"]);
|
|
31207
31215
|
var PriceValue = /*#__PURE__*/styled__default.div.withConfig({
|
|
31208
31216
|
displayName: "MarketplaceRows__PriceValue",
|
|
31209
|
-
componentId: "sc-wmpr1o-
|
|
31217
|
+
componentId: "sc-wmpr1o-7"
|
|
31210
31218
|
})(["margin-left:40px;"]);
|
|
31211
31219
|
var ButtonContainer$2 = /*#__PURE__*/styled__default.div.withConfig({
|
|
31212
31220
|
displayName: "MarketplaceRows__ButtonContainer",
|
|
31213
|
-
componentId: "sc-wmpr1o-
|
|
31221
|
+
componentId: "sc-wmpr1o-8"
|
|
31214
31222
|
})(["margin:auto;"]);
|
|
31215
31223
|
var RarityContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
31216
31224
|
displayName: "MarketplaceRows__RarityContainer",
|
|
31217
|
-
componentId: "sc-wmpr1o-
|
|
31225
|
+
componentId: "sc-wmpr1o-9"
|
|
31218
31226
|
})(["border-color:", ";box-shadow:", " inset,", ";width:32px;height:32px;"], function (_ref2) {
|
|
31219
31227
|
var item = _ref2.item;
|
|
31220
31228
|
return rarityColor(item);
|
|
@@ -33583,6 +33591,52 @@ var DayNightContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
33583
33591
|
componentId: "sc-1ja236h-3"
|
|
33584
33592
|
})(["margin-top:-0.3rem;margin-left:-0.3rem;"]);
|
|
33585
33593
|
|
|
33594
|
+
var PremiumLabel = function PremiumLabel(_ref) {
|
|
33595
|
+
var accountType = _ref.accountType;
|
|
33596
|
+
if (accountType === shared.UserAccountTypes.Free) return null;
|
|
33597
|
+
var getBackgroundColor = function getBackgroundColor() {
|
|
33598
|
+
switch (accountType) {
|
|
33599
|
+
case shared.UserAccountTypes.PremiumBronze:
|
|
33600
|
+
return '#CD7F32';
|
|
33601
|
+
case shared.UserAccountTypes.PremiumSilver:
|
|
33602
|
+
return '#C0C0C0';
|
|
33603
|
+
case shared.UserAccountTypes.PremiumGold:
|
|
33604
|
+
return '#FFD700';
|
|
33605
|
+
case shared.UserAccountTypes.PremiumUltimate:
|
|
33606
|
+
return '#002E99';
|
|
33607
|
+
default:
|
|
33608
|
+
return 'transparent';
|
|
33609
|
+
}
|
|
33610
|
+
};
|
|
33611
|
+
var getShortLabel = function getShortLabel() {
|
|
33612
|
+
switch (accountType) {
|
|
33613
|
+
case shared.UserAccountTypes.PremiumBronze:
|
|
33614
|
+
return 'Bronze PA';
|
|
33615
|
+
case shared.UserAccountTypes.PremiumSilver:
|
|
33616
|
+
return 'Silver PA';
|
|
33617
|
+
case shared.UserAccountTypes.PremiumGold:
|
|
33618
|
+
return 'Gold PA';
|
|
33619
|
+
case shared.UserAccountTypes.PremiumUltimate:
|
|
33620
|
+
return 'Ultimate PA';
|
|
33621
|
+
default:
|
|
33622
|
+
return '';
|
|
33623
|
+
}
|
|
33624
|
+
};
|
|
33625
|
+
return React__default.createElement(StyledLabel, {
|
|
33626
|
+
backgroundColor: getBackgroundColor()
|
|
33627
|
+
}, getShortLabel());
|
|
33628
|
+
};
|
|
33629
|
+
var StyledLabel = /*#__PURE__*/styled__default.span.withConfig({
|
|
33630
|
+
displayName: "PremiumLabel__StyledLabel",
|
|
33631
|
+
componentId: "sc-5bsloi-0"
|
|
33632
|
+
})(["background-color:", ";color:", ";font-weight:bold;padding:0 0.4rem;border-radius:3px;margin-right:3px;margin-bottom:2px;display:inline-block;font-size:0.5rem !important;"], function (_ref2) {
|
|
33633
|
+
var backgroundColor = _ref2.backgroundColor;
|
|
33634
|
+
return backgroundColor;
|
|
33635
|
+
}, function (_ref3) {
|
|
33636
|
+
var backgroundColor = _ref3.backgroundColor;
|
|
33637
|
+
return backgroundColor === '#002E99' ? 'white' : 'black';
|
|
33638
|
+
});
|
|
33639
|
+
|
|
33586
33640
|
var outerQty = 10;
|
|
33587
33641
|
var TradingItemRow = function TradingItemRow(_ref) {
|
|
33588
33642
|
var atlasIMG = _ref.atlasIMG,
|
|
@@ -33629,32 +33683,10 @@ var TradingItemRow = function TradingItemRow(_ref) {
|
|
|
33629
33683
|
var renderAccountTypeIndicator = function renderAccountTypeIndicator() {
|
|
33630
33684
|
if (isBuy && traderItem.canBePurchasedOnlyByPremiumPlans) {
|
|
33631
33685
|
return traderItem.canBePurchasedOnlyByPremiumPlans.map(function (accountType) {
|
|
33632
|
-
|
|
33633
|
-
|
|
33634
|
-
|
|
33635
|
-
|
|
33636
|
-
case shared.UserAccountTypes.PremiumBronze:
|
|
33637
|
-
backgroundColor = '#CD7F32';
|
|
33638
|
-
break;
|
|
33639
|
-
case shared.UserAccountTypes.PremiumSilver:
|
|
33640
|
-
backgroundColor = '#C0C0C0';
|
|
33641
|
-
break;
|
|
33642
|
-
case shared.UserAccountTypes.PremiumGold:
|
|
33643
|
-
backgroundColor = '#FFD700';
|
|
33644
|
-
break;
|
|
33645
|
-
case shared.UserAccountTypes.PremiumUltimate:
|
|
33646
|
-
backgroundColor = '#002E99';
|
|
33647
|
-
break;
|
|
33648
|
-
default:
|
|
33649
|
-
return null;
|
|
33650
|
-
}
|
|
33651
|
-
return React__default.createElement(PremiumLabel, {
|
|
33652
|
-
backgroundColor: backgroundColor,
|
|
33653
|
-
textColor: textColor,
|
|
33654
|
-
key: accountType
|
|
33655
|
-
}, capitalize(accountType) + ' PA');
|
|
33656
|
-
}
|
|
33657
|
-
return null;
|
|
33686
|
+
return React__default.createElement(PremiumLabel, {
|
|
33687
|
+
key: accountType,
|
|
33688
|
+
accountType: accountType
|
|
33689
|
+
});
|
|
33658
33690
|
});
|
|
33659
33691
|
}
|
|
33660
33692
|
return null;
|
|
@@ -33674,220 +33706,228 @@ var TradingItemRow = function TradingItemRow(_ref) {
|
|
|
33674
33706
|
texturePath: traderItem.texturePath,
|
|
33675
33707
|
isStackable: traderItem.isStackable
|
|
33676
33708
|
}, atlasJSON),
|
|
33677
|
-
imgScale: 2
|
|
33709
|
+
imgScale: 2
|
|
33678
33710
|
})))), React__default.createElement(ItemNameContainer, null, React__default.createElement(NameValue, null, React__default.createElement("p", null, React__default.createElement(Ellipsis, {
|
|
33679
33711
|
maxLines: 1,
|
|
33680
|
-
maxWidth: "
|
|
33712
|
+
maxWidth: "180px"
|
|
33681
33713
|
}, capitalize(traderItem.name))), React__default.createElement("p", null, "$", traderItem.price), React__default.createElement("p", null, renderAccountTypeIndicator()))), React__default.createElement(QuantityContainer$1, null, React__default.createElement(SelectArrow, {
|
|
33682
|
-
size:
|
|
33714
|
+
size: 24,
|
|
33683
33715
|
className: "arrow-selector",
|
|
33684
33716
|
direction: "left",
|
|
33685
|
-
onPointerDown:
|
|
33686
|
-
|
|
33717
|
+
onPointerDown: function onPointerDown() {
|
|
33718
|
+
return onLeftClick(outerQty);
|
|
33719
|
+
},
|
|
33720
|
+
scale: 0.7
|
|
33687
33721
|
}), React__default.createElement(StyledArrow, {
|
|
33688
|
-
size:
|
|
33722
|
+
size: 24,
|
|
33689
33723
|
className: "arrow-selector",
|
|
33690
33724
|
direction: "left",
|
|
33691
|
-
onPointerDown:
|
|
33725
|
+
onPointerDown: function onPointerDown() {
|
|
33726
|
+
return onLeftClick();
|
|
33727
|
+
}
|
|
33692
33728
|
}), React__default.createElement(QuantityInput, {
|
|
33693
33729
|
type: "text",
|
|
33694
33730
|
value: inputQty,
|
|
33695
33731
|
onChange: handleQuantityChange,
|
|
33696
33732
|
onBlur: handleBlur
|
|
33697
33733
|
}), React__default.createElement(StyledArrow, {
|
|
33698
|
-
size:
|
|
33734
|
+
size: 24,
|
|
33699
33735
|
className: "arrow-selector",
|
|
33700
33736
|
direction: "right",
|
|
33701
|
-
onPointerDown:
|
|
33737
|
+
onPointerDown: function onPointerDown() {
|
|
33738
|
+
return onRightClick();
|
|
33739
|
+
}
|
|
33702
33740
|
}), React__default.createElement(SelectArrow, {
|
|
33703
|
-
size:
|
|
33741
|
+
size: 24,
|
|
33704
33742
|
className: "arrow-selector",
|
|
33705
33743
|
direction: "right",
|
|
33706
|
-
onPointerDown:
|
|
33707
|
-
|
|
33744
|
+
onPointerDown: function onPointerDown() {
|
|
33745
|
+
return onRightClick(outerQty);
|
|
33746
|
+
},
|
|
33747
|
+
scale: 0.7
|
|
33708
33748
|
})));
|
|
33709
33749
|
};
|
|
33710
|
-
var PremiumLabel = /*#__PURE__*/styled__default.span.withConfig({
|
|
33711
|
-
displayName: "TradingItemRow__PremiumLabel",
|
|
33712
|
-
componentId: "sc-mja0b5-0"
|
|
33713
|
-
})(["background-color:", ";color:", ";font-weight:bold;padding:2px 5px;border-radius:5px;margin-right:5px;margin-bottom:5px;display:inline-block;"], function (_ref2) {
|
|
33714
|
-
var backgroundColor = _ref2.backgroundColor;
|
|
33715
|
-
return backgroundColor;
|
|
33716
|
-
}, function (_ref3) {
|
|
33717
|
-
var textColor = _ref3.textColor;
|
|
33718
|
-
return textColor;
|
|
33719
|
-
});
|
|
33720
33750
|
var StyledArrow = /*#__PURE__*/styled__default(SelectArrow).withConfig({
|
|
33721
33751
|
displayName: "TradingItemRow__StyledArrow",
|
|
33722
|
-
componentId: "sc-mja0b5-
|
|
33723
|
-
})(["margin:
|
|
33752
|
+
componentId: "sc-mja0b5-0"
|
|
33753
|
+
})(["margin:0 1.5rem;"]);
|
|
33724
33754
|
var ItemWrapper = /*#__PURE__*/styled__default.div.withConfig({
|
|
33725
33755
|
displayName: "TradingItemRow__ItemWrapper",
|
|
33726
|
-
componentId: "sc-mja0b5-
|
|
33727
|
-
})(["width:100%;
|
|
33756
|
+
componentId: "sc-mja0b5-1"
|
|
33757
|
+
})(["width:100%;display:flex;justify-content:space-between;margin-bottom:0.5rem;padding:0.25rem;&:hover{background-color:", ";}"], uiColors.darkGray);
|
|
33728
33758
|
var ItemNameContainer = /*#__PURE__*/styled__default.div.withConfig({
|
|
33729
33759
|
displayName: "TradingItemRow__ItemNameContainer",
|
|
33730
|
-
componentId: "sc-mja0b5-
|
|
33731
|
-
})(["flex:60%;"]);
|
|
33760
|
+
componentId: "sc-mja0b5-2"
|
|
33761
|
+
})(["flex:60%;display:flex;align-items:center;"]);
|
|
33732
33762
|
var ItemIconContainer$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
33733
33763
|
displayName: "TradingItemRow__ItemIconContainer",
|
|
33734
|
-
componentId: "sc-mja0b5-
|
|
33735
|
-
})(["display:flex;justify-content:flex-start;align-items:center;flex:0 0
|
|
33764
|
+
componentId: "sc-mja0b5-3"
|
|
33765
|
+
})(["display:flex;justify-content:flex-start;align-items:center;flex:0 0 40px;"]);
|
|
33736
33766
|
var SpriteContainer$3 = /*#__PURE__*/styled__default.div.withConfig({
|
|
33737
33767
|
displayName: "TradingItemRow__SpriteContainer",
|
|
33738
|
-
componentId: "sc-mja0b5-
|
|
33739
|
-
})(["position:relative;top:-0.5rem;left:0
|
|
33768
|
+
componentId: "sc-mja0b5-4"
|
|
33769
|
+
})(["position:relative;top:-0.5rem;left:0;"]);
|
|
33740
33770
|
var NameValue = /*#__PURE__*/styled__default.div.withConfig({
|
|
33741
33771
|
displayName: "TradingItemRow__NameValue",
|
|
33742
|
-
componentId: "sc-mja0b5-
|
|
33743
|
-
})(["p{font-size:0.
|
|
33772
|
+
componentId: "sc-mja0b5-5"
|
|
33773
|
+
})(["p{font-size:0.6rem;margin:0;line-height:1.2;}"]);
|
|
33744
33774
|
var QuantityContainer$1 = /*#__PURE__*/styled__default.div.withConfig({
|
|
33745
33775
|
displayName: "TradingItemRow__QuantityContainer",
|
|
33746
|
-
componentId: "sc-mja0b5-
|
|
33747
|
-
})(["
|
|
33776
|
+
componentId: "sc-mja0b5-6"
|
|
33777
|
+
})(["display:flex;min-width:90px;width:40%;justify-content:flex-end;align-items:center;flex:30%;gap:2px;position:relative;"]);
|
|
33748
33778
|
var QuantityInput = /*#__PURE__*/styled__default.input.withConfig({
|
|
33749
33779
|
displayName: "TradingItemRow__QuantityInput",
|
|
33750
|
-
componentId: "sc-mja0b5-
|
|
33751
|
-
})(["width:
|
|
33780
|
+
componentId: "sc-mja0b5-7"
|
|
33781
|
+
})(["width:30px;text-align:center;background-color:", ";color:white;border:none;padding:1px;font-size:", ";position:relative;right:4px;"], uiColors.darkGray, uiFonts.size.small);
|
|
33752
33782
|
|
|
33753
|
-
var
|
|
33754
|
-
var
|
|
33755
|
-
onClose = _ref.onClose,
|
|
33783
|
+
var useTradingGold = function useTradingGold(_ref) {
|
|
33784
|
+
var characterAvailableGold = _ref.characterAvailableGold,
|
|
33756
33785
|
type = _ref.type,
|
|
33757
|
-
|
|
33758
|
-
atlasIMG = _ref.atlasIMG,
|
|
33759
|
-
characterAvailableGold = _ref.characterAvailableGold,
|
|
33760
|
-
onConfirm = _ref.onConfirm,
|
|
33761
|
-
equipmentSet = _ref.equipmentSet,
|
|
33762
|
-
scale = _ref.scale;
|
|
33786
|
+
traderItems = _ref.traderItems;
|
|
33763
33787
|
var _useState = React.useState(0),
|
|
33764
33788
|
sum = _useState[0],
|
|
33765
33789
|
setSum = _useState[1];
|
|
33766
33790
|
var _useState2 = React.useState(new Map()),
|
|
33767
33791
|
qtyMap = _useState2[0],
|
|
33768
33792
|
setQtyMap = _useState2[1];
|
|
33769
|
-
var onQuantityChange = function onQuantityChange(item, selectedQty) {
|
|
33770
|
-
setQtyMap(new Map(qtyMap.set(item.key, selectedQty)));
|
|
33771
|
-
var newSum = 0;
|
|
33772
|
-
traderItems.forEach(function (item) {
|
|
33773
|
-
var qty = qtyMap.get(item.key);
|
|
33774
|
-
if (qty) newSum += qty * item.price;
|
|
33775
|
-
setSum(newSum);
|
|
33776
|
-
});
|
|
33777
|
-
};
|
|
33778
33793
|
var isBuy = function isBuy() {
|
|
33779
|
-
return type
|
|
33794
|
+
return type === 'buy';
|
|
33780
33795
|
};
|
|
33781
33796
|
var hasGoldForSale = function hasGoldForSale() {
|
|
33782
|
-
|
|
33783
|
-
return !(sum > characterAvailableGold);
|
|
33784
|
-
}
|
|
33785
|
-
return true;
|
|
33797
|
+
return isBuy() ? !(sum > characterAvailableGold) : true;
|
|
33786
33798
|
};
|
|
33787
33799
|
var getFinalGold = function getFinalGold() {
|
|
33788
|
-
|
|
33789
|
-
return characterAvailableGold - sum;
|
|
33790
|
-
} else {
|
|
33791
|
-
return characterAvailableGold + sum;
|
|
33792
|
-
}
|
|
33800
|
+
return isBuy() ? characterAvailableGold - sum : characterAvailableGold + sum;
|
|
33793
33801
|
};
|
|
33794
|
-
var
|
|
33795
|
-
return word[0].toUpperCase() + word.substring(1);
|
|
33796
|
-
};
|
|
33797
|
-
var onConfirmClick = function onConfirmClick() {
|
|
33802
|
+
var getTradeItems = function getTradeItems() {
|
|
33798
33803
|
var items = [];
|
|
33799
33804
|
traderItems.forEach(function (item) {
|
|
33800
33805
|
var qty = qtyMap.get(item.key);
|
|
33801
33806
|
if (qty) {
|
|
33802
|
-
items.push(
|
|
33807
|
+
items.push(_extends({}, item, {
|
|
33803
33808
|
qty: qty
|
|
33804
33809
|
}));
|
|
33805
33810
|
}
|
|
33806
33811
|
});
|
|
33807
|
-
|
|
33812
|
+
return items;
|
|
33813
|
+
};
|
|
33814
|
+
var updateQuantity = function updateQuantity(item, selectedQty) {
|
|
33815
|
+
setQtyMap(new Map(qtyMap.set(item.key, selectedQty)));
|
|
33816
|
+
var newSum = 0;
|
|
33817
|
+
qtyMap.forEach(function (qty, key) {
|
|
33818
|
+
var item = traderItems.find(function (i) {
|
|
33819
|
+
return i.key === key;
|
|
33820
|
+
});
|
|
33821
|
+
if (item) newSum += qty * item.price;
|
|
33822
|
+
});
|
|
33823
|
+
setSum(newSum);
|
|
33808
33824
|
};
|
|
33825
|
+
return {
|
|
33826
|
+
sum: sum,
|
|
33827
|
+
qtyMap: qtyMap,
|
|
33828
|
+
isBuy: isBuy,
|
|
33829
|
+
hasGoldForSale: hasGoldForSale,
|
|
33830
|
+
getFinalGold: getFinalGold,
|
|
33831
|
+
getTradeItems: getTradeItems,
|
|
33832
|
+
updateQuantity: updateQuantity
|
|
33833
|
+
};
|
|
33834
|
+
};
|
|
33835
|
+
|
|
33836
|
+
var TradingMenu = function TradingMenu(_ref) {
|
|
33837
|
+
var traderItems = _ref.traderItems,
|
|
33838
|
+
onClose = _ref.onClose,
|
|
33839
|
+
type = _ref.type,
|
|
33840
|
+
atlasJSON = _ref.atlasJSON,
|
|
33841
|
+
atlasIMG = _ref.atlasIMG,
|
|
33842
|
+
characterAvailableGold = _ref.characterAvailableGold,
|
|
33843
|
+
onConfirm = _ref.onConfirm,
|
|
33844
|
+
equipmentSet = _ref.equipmentSet,
|
|
33845
|
+
scale = _ref.scale;
|
|
33846
|
+
var _useTradingGold = useTradingGold({
|
|
33847
|
+
characterAvailableGold: characterAvailableGold,
|
|
33848
|
+
type: type,
|
|
33849
|
+
traderItems: traderItems
|
|
33850
|
+
}),
|
|
33851
|
+
sum = _useTradingGold.sum,
|
|
33852
|
+
qtyMap = _useTradingGold.qtyMap,
|
|
33853
|
+
isBuy = _useTradingGold.isBuy,
|
|
33854
|
+
hasGoldForSale = _useTradingGold.hasGoldForSale,
|
|
33855
|
+
getFinalGold = _useTradingGold.getFinalGold,
|
|
33856
|
+
getTradeItems = _useTradingGold.getTradeItems,
|
|
33857
|
+
updateQuantity = _useTradingGold.updateQuantity;
|
|
33809
33858
|
return React__default.createElement(DraggableContainer, {
|
|
33810
33859
|
type: exports.RPGUIContainerTypes.Framed,
|
|
33811
|
-
onCloseButton:
|
|
33812
|
-
|
|
33813
|
-
},
|
|
33814
|
-
width: "600px",
|
|
33860
|
+
onCloseButton: onClose,
|
|
33861
|
+
width: "500px",
|
|
33815
33862
|
cancelDrag: "#TraderContainer",
|
|
33816
33863
|
scale: scale
|
|
33817
|
-
}, React__default.createElement(React__default.
|
|
33818
|
-
style: {
|
|
33819
|
-
width: '100%'
|
|
33820
|
-
}
|
|
33821
|
-
}, React__default.createElement(Title$b, null, Capitalize(type), " Menu"), React__default.createElement("hr", {
|
|
33864
|
+
}, React__default.createElement(Container$y, null, React__default.createElement(Title$b, null, type.charAt(0).toUpperCase() + type.slice(1), " Menu"), React__default.createElement("hr", {
|
|
33822
33865
|
className: "golden"
|
|
33823
|
-
})
|
|
33866
|
+
}), React__default.createElement(ScrollWrapper, {
|
|
33824
33867
|
id: "TraderContainer"
|
|
33825
33868
|
}, traderItems.map(function (tradeItem, index) {
|
|
33826
33869
|
var _qtyMap$get;
|
|
33827
|
-
return React__default.createElement(
|
|
33828
|
-
key: tradeItem.key + "_" + index
|
|
33829
|
-
}, React__default.createElement(TradingItemRow, {
|
|
33870
|
+
return React__default.createElement(TradingItemRow, {
|
|
33871
|
+
key: tradeItem.key + "_" + index,
|
|
33830
33872
|
atlasIMG: atlasIMG,
|
|
33831
33873
|
atlasJSON: atlasJSON,
|
|
33832
|
-
onQuantityChange:
|
|
33874
|
+
onQuantityChange: updateQuantity,
|
|
33833
33875
|
traderItem: tradeItem,
|
|
33834
33876
|
selectedQty: (_qtyMap$get = qtyMap.get(tradeItem.key)) != null ? _qtyMap$get : 0,
|
|
33835
33877
|
equipmentSet: equipmentSet,
|
|
33836
33878
|
scale: scale,
|
|
33837
33879
|
isBuy: isBuy()
|
|
33838
|
-
})
|
|
33839
|
-
})), React__default.createElement(
|
|
33880
|
+
});
|
|
33881
|
+
})), React__default.createElement(InfoSection, null, React__default.createElement(GoldInfo, null, React__default.createElement("p", null, "Available Gold:"), React__default.createElement("p", null, "$", characterAvailableGold.toFixed(2))), React__default.createElement(GoldInfo, null, React__default.createElement("p", null, "Total:"), React__default.createElement("p", null, "$", sum)), !hasGoldForSale() ? React__default.createElement(AlertText, null, "Sorry, not enough money.") : React__default.createElement(GoldInfo, null, React__default.createElement("p", null, "Final Gold:"), React__default.createElement("p", null, "$", getFinalGold().toFixed(2)))), React__default.createElement(ButtonWrapper$3, null, React__default.createElement(Button, {
|
|
33840
33882
|
buttonType: exports.ButtonTypes.RPGUIButton,
|
|
33841
33883
|
disabled: !hasGoldForSale(),
|
|
33842
33884
|
onPointerDown: function onPointerDown() {
|
|
33843
|
-
return
|
|
33885
|
+
return onConfirm(getTradeItems());
|
|
33844
33886
|
}
|
|
33845
33887
|
}, "Confirm"), React__default.createElement(Button, {
|
|
33846
33888
|
buttonType: exports.ButtonTypes.RPGUIButton,
|
|
33847
|
-
onPointerDown:
|
|
33848
|
-
return onClose();
|
|
33849
|
-
}
|
|
33889
|
+
onPointerDown: onClose
|
|
33850
33890
|
}, "Cancel"))));
|
|
33851
33891
|
};
|
|
33892
|
+
var Container$y = /*#__PURE__*/styled__default.div.withConfig({
|
|
33893
|
+
displayName: "TradingMenu__Container",
|
|
33894
|
+
componentId: "sc-1wjsz1l-0"
|
|
33895
|
+
})(["width:100%;"]);
|
|
33852
33896
|
var Title$b = /*#__PURE__*/styled__default.h1.withConfig({
|
|
33853
33897
|
displayName: "TradingMenu__Title",
|
|
33854
|
-
componentId: "sc-1wjsz1l-0"
|
|
33855
|
-
})(["z-index:22;font-size:0.6rem;color:yellow !important;"]);
|
|
33856
|
-
var TradingComponentScrollWrapper = /*#__PURE__*/styled__default.div.withConfig({
|
|
33857
|
-
displayName: "TradingMenu__TradingComponentScrollWrapper",
|
|
33858
33898
|
componentId: "sc-1wjsz1l-1"
|
|
33859
|
-
})(["
|
|
33860
|
-
var
|
|
33861
|
-
displayName: "
|
|
33899
|
+
})(["font-size:0.7rem !important;color:yellow !important;text-align:center;"]);
|
|
33900
|
+
var ScrollWrapper = /*#__PURE__*/styled__default.div.withConfig({
|
|
33901
|
+
displayName: "TradingMenu__ScrollWrapper",
|
|
33862
33902
|
componentId: "sc-1wjsz1l-2"
|
|
33863
|
-
})(["
|
|
33864
|
-
var
|
|
33865
|
-
displayName: "
|
|
33903
|
+
})(["overflow-y:scroll;height:250px;width:100%;margin-top:0.3rem;overflow-x:hidden;padding:0 0.3rem;"]);
|
|
33904
|
+
var InfoSection = /*#__PURE__*/styled__default.div.withConfig({
|
|
33905
|
+
displayName: "TradingMenu__InfoSection",
|
|
33866
33906
|
componentId: "sc-1wjsz1l-3"
|
|
33867
|
-
})(["margin-top:
|
|
33868
|
-
var
|
|
33869
|
-
displayName: "
|
|
33907
|
+
})(["margin-top:0.3rem;padding:0 0.5rem;"]);
|
|
33908
|
+
var GoldInfo = /*#__PURE__*/styled__default.div.withConfig({
|
|
33909
|
+
displayName: "TradingMenu__GoldInfo",
|
|
33870
33910
|
componentId: "sc-1wjsz1l-4"
|
|
33871
|
-
})(["
|
|
33872
|
-
var
|
|
33873
|
-
displayName: "
|
|
33911
|
+
})(["display:flex;justify-content:space-between;height:16px;width:100%;margin:0.5rem 0;p{color:yellow !important;margin:0;font-size:0.6rem;}"]);
|
|
33912
|
+
var AlertText = /*#__PURE__*/styled__default.p.withConfig({
|
|
33913
|
+
displayName: "TradingMenu__AlertText",
|
|
33874
33914
|
componentId: "sc-1wjsz1l-5"
|
|
33875
|
-
})(["
|
|
33915
|
+
})(["color:red !important;text-align:center;margin:0.3rem 0;font-size:0.5rem;"]);
|
|
33876
33916
|
var ButtonWrapper$3 = /*#__PURE__*/styled__default.div.withConfig({
|
|
33877
33917
|
displayName: "TradingMenu__ButtonWrapper",
|
|
33878
33918
|
componentId: "sc-1wjsz1l-6"
|
|
33879
|
-
})(["display:flex;justify-content:space-around;
|
|
33919
|
+
})(["display:flex;justify-content:space-around;width:100%;margin-top:0.5rem;"]);
|
|
33880
33920
|
|
|
33881
33921
|
/* eslint-disable react/require-default-props */
|
|
33882
33922
|
var Truncate = function Truncate(_ref) {
|
|
33883
33923
|
var _ref$maxLines = _ref.maxLines,
|
|
33884
33924
|
maxLines = _ref$maxLines === void 0 ? 1 : _ref$maxLines,
|
|
33885
33925
|
children = _ref.children;
|
|
33886
|
-
return React__default.createElement(Container$
|
|
33926
|
+
return React__default.createElement(Container$z, {
|
|
33887
33927
|
maxLines: maxLines
|
|
33888
33928
|
}, children);
|
|
33889
33929
|
};
|
|
33890
|
-
var Container$
|
|
33930
|
+
var Container$z = /*#__PURE__*/styled__default.div.withConfig({
|
|
33891
33931
|
displayName: "Truncate__Container",
|
|
33892
33932
|
componentId: "sc-6x00qb-0"
|
|
33893
33933
|
})(["display:-webkit-box;max-width:100%;max-height:100%;-webkit-line-clamp:", ";-webkit-box-orient:vertical;overflow:hidden;"], function (props) {
|
|
@@ -33995,7 +34035,7 @@ var TutorialStepper = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
33995
34035
|
};
|
|
33996
34036
|
});
|
|
33997
34037
|
}, [lessons, imageStyle]);
|
|
33998
|
-
return React__default.createElement(Container$
|
|
34038
|
+
return React__default.createElement(Container$A, null, React__default.createElement(Stepper, {
|
|
33999
34039
|
steps: generateLessons,
|
|
34000
34040
|
finalCTAButton: {
|
|
34001
34041
|
label: 'Close',
|
|
@@ -34012,7 +34052,7 @@ var LessonBody = /*#__PURE__*/styled__default.div.withConfig({
|
|
|
34012
34052
|
displayName: "TutorialStepper__LessonBody",
|
|
34013
34053
|
componentId: "sc-7tgzv2-1"
|
|
34014
34054
|
})([""]);
|
|
34015
|
-
var Container$
|
|
34055
|
+
var Container$A = /*#__PURE__*/styled__default.div.withConfig({
|
|
34016
34056
|
displayName: "TutorialStepper__Container",
|
|
34017
34057
|
componentId: "sc-7tgzv2-2"
|
|
34018
34058
|
})(["width:80%;max-width:600px;@media (max-width:600px){width:95%;}"]);
|