@rpg-engine/long-bow 0.6.0 → 0.6.2
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/Item/Inventory/ItemGem.d.ts +8 -0
- package/dist/long-bow.cjs.development.js +67 -6
- 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 +67 -6
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Item/Inventory/ItemGem.tsx +80 -0
- package/src/components/Item/Inventory/ItemSlotRenderer.tsx +15 -1
- package/src/mocks/itemContainer.mocks.ts +58 -0
package/dist/long-bow.esm.js
CHANGED
|
@@ -13659,6 +13659,62 @@ var rarityColor = function rarityColor(item) {
|
|
|
13659
13659
|
}
|
|
13660
13660
|
};
|
|
13661
13661
|
|
|
13662
|
+
var gemColors = {
|
|
13663
|
+
'emerald-gem': '#50C878',
|
|
13664
|
+
'topaz-radiance': '#FFC87C',
|
|
13665
|
+
'sapphire-gem': '#0F52BA',
|
|
13666
|
+
'ruby-gem': '#E0115F',
|
|
13667
|
+
'misty-quartz-gem': '#D9D9F3',
|
|
13668
|
+
'coral-reef-gem': '#FF7F50',
|
|
13669
|
+
'jasper-gem': '#D73B3E',
|
|
13670
|
+
'earthstone-gem': '#8B4513',
|
|
13671
|
+
'obsidian-gem': '#0B0C0E',
|
|
13672
|
+
'amethyst-gem': '#9966CC'
|
|
13673
|
+
};
|
|
13674
|
+
var defaultColor = '#FFFFFF'; // Default color (white)
|
|
13675
|
+
var onRenderGems = function onRenderGems(item) {
|
|
13676
|
+
var _item$attachedGems;
|
|
13677
|
+
var gemQty = ((_item$attachedGems = item.attachedGems) == null ? void 0 : _item$attachedGems.length) || 0;
|
|
13678
|
+
if (gemQty > 0) {
|
|
13679
|
+
return React.createElement(ItemSlotQty, {
|
|
13680
|
+
item: item
|
|
13681
|
+
});
|
|
13682
|
+
}
|
|
13683
|
+
return undefined;
|
|
13684
|
+
};
|
|
13685
|
+
var ItemSlotQty = function ItemSlotQty(_ref) {
|
|
13686
|
+
var _item$attachedGems2;
|
|
13687
|
+
var item = _ref.item;
|
|
13688
|
+
console.log(item.attachedGems);
|
|
13689
|
+
var itemId = item._id;
|
|
13690
|
+
return React.createElement(ItemQtyContainer, {
|
|
13691
|
+
key: "qty-" + itemId,
|
|
13692
|
+
className: "item-slot-qty"
|
|
13693
|
+
}, (_item$attachedGems2 = item.attachedGems) == null ? void 0 : _item$attachedGems2.map(function (gem, index) {
|
|
13694
|
+
return React.createElement(Gem, {
|
|
13695
|
+
key: itemId + "-gem-" + index,
|
|
13696
|
+
color: gemColors[gem.key] || defaultColor
|
|
13697
|
+
});
|
|
13698
|
+
}));
|
|
13699
|
+
};
|
|
13700
|
+
var ItemQtyContainer = /*#__PURE__*/styled.div.withConfig({
|
|
13701
|
+
displayName: "ItemGem__ItemQtyContainer",
|
|
13702
|
+
componentId: "sc-1ekseaq-0"
|
|
13703
|
+
})(["position:relative;width:85%;height:16px;top:26px;left:-2px;pointer-events:none;transform:scale(0.8);display:flex;align-items:center;justify-content:center;opacity:0.8;"]);
|
|
13704
|
+
var Gem = /*#__PURE__*/styled.div.withConfig({
|
|
13705
|
+
displayName: "ItemGem__Gem",
|
|
13706
|
+
componentId: "sc-1ekseaq-1"
|
|
13707
|
+
})(["width:8px;height:8px;background-color:", ";border:1px solid black;transform:rotate(45deg);margin:0 2px;box-shadow:0 0 5px ", ";transition:transform 0.2s,box-shadow 0.2s;&:hover{transform:rotate(45deg) scale(1.2);box-shadow:0 0 10px ", ";}"], function (_ref2) {
|
|
13708
|
+
var color = _ref2.color;
|
|
13709
|
+
return color;
|
|
13710
|
+
}, function (_ref3) {
|
|
13711
|
+
var color = _ref3.color;
|
|
13712
|
+
return color;
|
|
13713
|
+
}, function (_ref4) {
|
|
13714
|
+
var color = _ref4.color;
|
|
13715
|
+
return color;
|
|
13716
|
+
});
|
|
13717
|
+
|
|
13662
13718
|
var onRenderStackInfo = function onRenderStackInfo(itemId, stackQty) {
|
|
13663
13719
|
var isFractionalStackQty = stackQty % 1 !== 0;
|
|
13664
13720
|
var isLargerThan999 = stackQty > 999;
|
|
@@ -13666,7 +13722,7 @@ var onRenderStackInfo = function onRenderStackInfo(itemId, stackQty) {
|
|
|
13666
13722
|
if (isLargerThan999) qtyClassName = 'small';
|
|
13667
13723
|
if (isFractionalStackQty) qtyClassName = 'xsmall';
|
|
13668
13724
|
if (stackQty > 1) {
|
|
13669
|
-
return React.createElement(ItemSlotQty, {
|
|
13725
|
+
return React.createElement(ItemSlotQty$1, {
|
|
13670
13726
|
itemId: itemId,
|
|
13671
13727
|
stackQty: stackQty,
|
|
13672
13728
|
qtyClassName: qtyClassName
|
|
@@ -13674,11 +13730,11 @@ var onRenderStackInfo = function onRenderStackInfo(itemId, stackQty) {
|
|
|
13674
13730
|
}
|
|
13675
13731
|
return undefined;
|
|
13676
13732
|
};
|
|
13677
|
-
var ItemSlotQty = function ItemSlotQty(_ref) {
|
|
13733
|
+
var ItemSlotQty$1 = function ItemSlotQty(_ref) {
|
|
13678
13734
|
var itemId = _ref.itemId,
|
|
13679
13735
|
stackQty = _ref.stackQty,
|
|
13680
13736
|
qtyClassName = _ref.qtyClassName;
|
|
13681
|
-
return React.createElement(ItemQtyContainer, {
|
|
13737
|
+
return React.createElement(ItemQtyContainer$1, {
|
|
13682
13738
|
key: "qty-" + itemId,
|
|
13683
13739
|
className: "item-slot-qty"
|
|
13684
13740
|
}, React.createElement(Ellipsis, {
|
|
@@ -13688,7 +13744,7 @@ var ItemSlotQty = function ItemSlotQty(_ref) {
|
|
|
13688
13744
|
className: qtyClassName
|
|
13689
13745
|
}, Math.round(stackQty * 100) / 100, ' ')));
|
|
13690
13746
|
};
|
|
13691
|
-
var ItemQtyContainer = /*#__PURE__*/styled.div.withConfig({
|
|
13747
|
+
var ItemQtyContainer$1 = /*#__PURE__*/styled.div.withConfig({
|
|
13692
13748
|
displayName: "ItemSlotQty__ItemQtyContainer",
|
|
13693
13749
|
componentId: "sc-keb1s5-0"
|
|
13694
13750
|
})(["position:relative;width:85%;height:16px;top:25px;left:2px;pointer-events:none;display:flex;justify-content:flex-end;"]);
|
|
@@ -13703,8 +13759,13 @@ var ItemSlotRenderer = function ItemSlotRenderer(_ref) {
|
|
|
13703
13759
|
atlasIMG = _ref.atlasIMG,
|
|
13704
13760
|
slotSpriteMask = _ref.slotSpriteMask,
|
|
13705
13761
|
item = _ref.item;
|
|
13762
|
+
var renderStackInfo = function renderStackInfo(item) {
|
|
13763
|
+
return item.stackQty && item.stackQty > 1 && onRenderStackInfo(item._id, item.stackQty);
|
|
13764
|
+
};
|
|
13765
|
+
var renderGems = function renderGems(item) {
|
|
13766
|
+
return item.attachedGems && onRenderGems(item);
|
|
13767
|
+
};
|
|
13706
13768
|
var renderItem = function renderItem(item) {
|
|
13707
|
-
var _item$stackQty;
|
|
13708
13769
|
if (!(item != null && item.texturePath)) {
|
|
13709
13770
|
return null;
|
|
13710
13771
|
}
|
|
@@ -13721,7 +13782,7 @@ var ItemSlotRenderer = function ItemSlotRenderer(_ref) {
|
|
|
13721
13782
|
}, atlasJSON),
|
|
13722
13783
|
imgScale: 3,
|
|
13723
13784
|
imgClassname: "sprite-from-atlas-img--item"
|
|
13724
|
-
}),
|
|
13785
|
+
}), renderStackInfo(item), renderGems(item));
|
|
13725
13786
|
};
|
|
13726
13787
|
var renderEquipment = function renderEquipment(itemToRender) {
|
|
13727
13788
|
var _itemToRender$allowed;
|