@rpg-engine/long-bow 0.8.120 → 0.8.121
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/CraftBook/CraftingRecipe.d.ts +1 -2
- package/dist/components/CraftBook/CraftingTooltip.d.ts +1 -2
- package/dist/long-bow.cjs.development.js +25 -30
- 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 +25 -30
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/CraftBook/CraftBook.tsx +0 -1
- package/src/components/CraftBook/CraftingRecipe.tsx +0 -4
- package/src/components/CraftBook/CraftingTooltip.tsx +3 -9
- package/src/components/CraftBook/MockItems.ts +8 -0
package/dist/long-bow.esm.js
CHANGED
|
@@ -28845,29 +28845,6 @@ var ItemInfoWrapper = function ItemInfoWrapper(_ref) {
|
|
|
28845
28845
|
}));
|
|
28846
28846
|
};
|
|
28847
28847
|
|
|
28848
|
-
var _countItemFromInventory = function countItemFromInventory(itemKey, inventory) {
|
|
28849
|
-
var totalQty = 0;
|
|
28850
|
-
if (!inventory) {
|
|
28851
|
-
return totalQty;
|
|
28852
|
-
}
|
|
28853
|
-
Object.keys(inventory.slots).forEach(function (i) {
|
|
28854
|
-
var index = parseInt(i);
|
|
28855
|
-
var item = inventory.slots[index];
|
|
28856
|
-
if (!item) {
|
|
28857
|
-
return;
|
|
28858
|
-
}
|
|
28859
|
-
// Count matching items
|
|
28860
|
-
if (item.key === itemKey) {
|
|
28861
|
-
totalQty += item.stackQty || 1;
|
|
28862
|
-
}
|
|
28863
|
-
// Recursively check nested containers
|
|
28864
|
-
if (item.isItemContainer && item.itemContainer && typeof item.itemContainer !== "string") {
|
|
28865
|
-
totalQty += _countItemFromInventory(itemKey, item.itemContainer);
|
|
28866
|
-
}
|
|
28867
|
-
});
|
|
28868
|
-
return totalQty;
|
|
28869
|
-
};
|
|
28870
|
-
|
|
28871
28848
|
var modifyString = function modifyString(str) {
|
|
28872
28849
|
var parts = str.split('/');
|
|
28873
28850
|
var fileName = parts[parts.length - 1];
|
|
@@ -28916,7 +28893,6 @@ var CraftingTooltip = function CraftingTooltip(_ref3) {
|
|
|
28916
28893
|
var x = _ref3.x,
|
|
28917
28894
|
y = _ref3.y,
|
|
28918
28895
|
recipe = _ref3.recipe,
|
|
28919
|
-
inventory = _ref3.inventory,
|
|
28920
28896
|
skills = _ref3.skills,
|
|
28921
28897
|
atlasIMG = _ref3.atlasIMG,
|
|
28922
28898
|
atlasJSON = _ref3.atlasJSON;
|
|
@@ -28964,8 +28940,7 @@ var CraftingTooltip = function CraftingTooltip(_ref3) {
|
|
|
28964
28940
|
}, React.createElement(TooltipTitle, null, "Skill Requirements"), React.createElement(MinCraftingRequirementsText, {
|
|
28965
28941
|
levelIsOk: levelIsOk
|
|
28966
28942
|
}, modifyString("" + ((_recipe$minCraftingRe3 = recipe == null ? void 0 : (_recipe$minCraftingRe4 = recipe.minCraftingRequirements) == null ? void 0 : _recipe$minCraftingRe4[0]) != null ? _recipe$minCraftingRe3 : '')), " lvl", ' ', (_recipe$minCraftingRe5 = recipe == null ? void 0 : (_recipe$minCraftingRe6 = recipe.minCraftingRequirements) == null ? void 0 : _recipe$minCraftingRe6[1]) != null ? _recipe$minCraftingRe5 : 0, " (", levelInSkill, ")"), React.createElement(TooltipTitle, null, "Ingredients"), recipe.ingredients.map(function (ingredient, index) {
|
|
28967
|
-
var
|
|
28968
|
-
var isQuantityOk = ingredient.qty <= itemQtyInInventory;
|
|
28943
|
+
var isQuantityOk = ingredient.qty <= ingredient.qtyInInventory;
|
|
28969
28944
|
return React.createElement(Recipe, {
|
|
28970
28945
|
key: index
|
|
28971
28946
|
}, React.createElement(SpriteFromAtlas, {
|
|
@@ -28975,7 +28950,7 @@ var CraftingTooltip = function CraftingTooltip(_ref3) {
|
|
|
28975
28950
|
imgScale: 1.2
|
|
28976
28951
|
}), React.createElement(Ingredient, {
|
|
28977
28952
|
isQuantityOk: isQuantityOk
|
|
28978
|
-
}, modifyString(ingredient.key), " x", ingredient.qty, " (",
|
|
28953
|
+
}, modifyString(ingredient.key), " x", ingredient.qty, " (", ingredient.qtyInInventory, ")"));
|
|
28979
28954
|
}));
|
|
28980
28955
|
};
|
|
28981
28956
|
|
|
@@ -29003,7 +28978,6 @@ var CraftingRecipe = function CraftingRecipe(_ref) {
|
|
|
29003
28978
|
scale = _ref.scale,
|
|
29004
28979
|
handleRecipeSelect = _ref.handleRecipeSelect,
|
|
29005
28980
|
selectedCraftItemKey = _ref.selectedCraftItemKey,
|
|
29006
|
-
inventory = _ref.inventory,
|
|
29007
28981
|
skills = _ref.skills;
|
|
29008
28982
|
var _useState = useState(false),
|
|
29009
28983
|
showTooltip = _useState[0],
|
|
@@ -29066,7 +29040,6 @@ var CraftingRecipe = function CraftingRecipe(_ref) {
|
|
|
29066
29040
|
x: tooltipPosition.x,
|
|
29067
29041
|
y: tooltipPosition.y,
|
|
29068
29042
|
recipe: recipe,
|
|
29069
|
-
inventory: inventory,
|
|
29070
29043
|
skills: skills,
|
|
29071
29044
|
atlasIMG: atlasIMG,
|
|
29072
29045
|
atlasJSON: atlasJSON
|
|
@@ -29108,6 +29081,29 @@ var useResponsiveSize = function useResponsiveSize(scale) {
|
|
|
29108
29081
|
return size;
|
|
29109
29082
|
};
|
|
29110
29083
|
|
|
29084
|
+
var _countItemFromInventory = function countItemFromInventory(itemKey, inventory) {
|
|
29085
|
+
var totalQty = 0;
|
|
29086
|
+
if (!inventory) {
|
|
29087
|
+
return totalQty;
|
|
29088
|
+
}
|
|
29089
|
+
Object.keys(inventory.slots).forEach(function (i) {
|
|
29090
|
+
var index = parseInt(i);
|
|
29091
|
+
var item = inventory.slots[index];
|
|
29092
|
+
if (!item) {
|
|
29093
|
+
return;
|
|
29094
|
+
}
|
|
29095
|
+
// Count matching items
|
|
29096
|
+
if (item.key === itemKey) {
|
|
29097
|
+
totalQty += item.stackQty || 1;
|
|
29098
|
+
}
|
|
29099
|
+
// Recursively check nested containers
|
|
29100
|
+
if (item.isItemContainer && item.itemContainer && typeof item.itemContainer !== "string") {
|
|
29101
|
+
totalQty += _countItemFromInventory(itemKey, item.itemContainer);
|
|
29102
|
+
}
|
|
29103
|
+
});
|
|
29104
|
+
return totalQty;
|
|
29105
|
+
};
|
|
29106
|
+
|
|
29111
29107
|
function calculateMaxCraftable(recipe, inventory) {
|
|
29112
29108
|
var _recipe$ingredients$r;
|
|
29113
29109
|
if (!inventory || !(recipe != null && recipe.ingredients)) {
|
|
@@ -29264,7 +29260,6 @@ var CraftBook = function CraftBook(_ref) {
|
|
|
29264
29260
|
scale: scale,
|
|
29265
29261
|
handleRecipeSelect: setCraftItemKey.bind(null, item.key),
|
|
29266
29262
|
selectedCraftItemKey: craftItemKey,
|
|
29267
|
-
inventory: inventory,
|
|
29268
29263
|
skills: skills
|
|
29269
29264
|
}));
|
|
29270
29265
|
})) : React.createElement(EmptyState, null, React.createElement(FaBoxOpen, {
|