@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.
@@ -1,4 +1,4 @@
1
- import { ICraftableItem, IEquipmentSet, IItemContainer, ISkill } from '@rpg-engine/shared';
1
+ import { ICraftableItem, IEquipmentSet, ISkill } from '@rpg-engine/shared';
2
2
  import React from 'react';
3
3
  interface ICraftingRecipeProps {
4
4
  atlasJSON: any;
@@ -8,7 +8,6 @@ interface ICraftingRecipeProps {
8
8
  scale?: number;
9
9
  handleRecipeSelect: () => void;
10
10
  selectedCraftItemKey?: string;
11
- inventory?: IItemContainer | null;
12
11
  skills?: ISkill | null;
13
12
  }
14
13
  export declare const CraftingRecipe: React.FC<ICraftingRecipeProps>;
@@ -1,10 +1,9 @@
1
- import { ICraftableItem, IItemContainer, ISkill } from '@rpg-engine/shared';
1
+ import { ICraftableItem, ISkill } from '@rpg-engine/shared';
2
2
  import React from 'react';
3
3
  interface ICraftingTooltipProps {
4
4
  x: number;
5
5
  y: number;
6
6
  recipe: ICraftableItem;
7
- inventory?: IItemContainer | null;
8
7
  skills?: ISkill | null;
9
8
  atlasIMG: any;
10
9
  atlasJSON: any;
@@ -28852,29 +28852,6 @@ var ItemInfoWrapper = function ItemInfoWrapper(_ref) {
28852
28852
  }));
28853
28853
  };
28854
28854
 
28855
- var _countItemFromInventory = function countItemFromInventory(itemKey, inventory) {
28856
- var totalQty = 0;
28857
- if (!inventory) {
28858
- return totalQty;
28859
- }
28860
- Object.keys(inventory.slots).forEach(function (i) {
28861
- var index = parseInt(i);
28862
- var item = inventory.slots[index];
28863
- if (!item) {
28864
- return;
28865
- }
28866
- // Count matching items
28867
- if (item.key === itemKey) {
28868
- totalQty += item.stackQty || 1;
28869
- }
28870
- // Recursively check nested containers
28871
- if (item.isItemContainer && item.itemContainer && typeof item.itemContainer !== "string") {
28872
- totalQty += _countItemFromInventory(itemKey, item.itemContainer);
28873
- }
28874
- });
28875
- return totalQty;
28876
- };
28877
-
28878
28855
  var modifyString = function modifyString(str) {
28879
28856
  var parts = str.split('/');
28880
28857
  var fileName = parts[parts.length - 1];
@@ -28923,7 +28900,6 @@ var CraftingTooltip = function CraftingTooltip(_ref3) {
28923
28900
  var x = _ref3.x,
28924
28901
  y = _ref3.y,
28925
28902
  recipe = _ref3.recipe,
28926
- inventory = _ref3.inventory,
28927
28903
  skills = _ref3.skills,
28928
28904
  atlasIMG = _ref3.atlasIMG,
28929
28905
  atlasJSON = _ref3.atlasJSON;
@@ -28971,8 +28947,7 @@ var CraftingTooltip = function CraftingTooltip(_ref3) {
28971
28947
  }, React__default.createElement(TooltipTitle, null, "Skill Requirements"), React__default.createElement(MinCraftingRequirementsText, {
28972
28948
  levelIsOk: levelIsOk
28973
28949
  }, 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__default.createElement(TooltipTitle, null, "Ingredients"), recipe.ingredients.map(function (ingredient, index) {
28974
- var itemQtyInInventory = !inventory ? 0 : _countItemFromInventory(ingredient.key, inventory);
28975
- var isQuantityOk = ingredient.qty <= itemQtyInInventory;
28950
+ var isQuantityOk = ingredient.qty <= ingredient.qtyInInventory;
28976
28951
  return React__default.createElement(Recipe, {
28977
28952
  key: index
28978
28953
  }, React__default.createElement(SpriteFromAtlas, {
@@ -28982,7 +28957,7 @@ var CraftingTooltip = function CraftingTooltip(_ref3) {
28982
28957
  imgScale: 1.2
28983
28958
  }), React__default.createElement(Ingredient, {
28984
28959
  isQuantityOk: isQuantityOk
28985
- }, modifyString(ingredient.key), " x", ingredient.qty, " (", itemQtyInInventory, ")"));
28960
+ }, modifyString(ingredient.key), " x", ingredient.qty, " (", ingredient.qtyInInventory, ")"));
28986
28961
  }));
28987
28962
  };
28988
28963
 
@@ -29010,7 +28985,6 @@ var CraftingRecipe = function CraftingRecipe(_ref) {
29010
28985
  scale = _ref.scale,
29011
28986
  handleRecipeSelect = _ref.handleRecipeSelect,
29012
28987
  selectedCraftItemKey = _ref.selectedCraftItemKey,
29013
- inventory = _ref.inventory,
29014
28988
  skills = _ref.skills;
29015
28989
  var _useState = React.useState(false),
29016
28990
  showTooltip = _useState[0],
@@ -29073,7 +29047,6 @@ var CraftingRecipe = function CraftingRecipe(_ref) {
29073
29047
  x: tooltipPosition.x,
29074
29048
  y: tooltipPosition.y,
29075
29049
  recipe: recipe,
29076
- inventory: inventory,
29077
29050
  skills: skills,
29078
29051
  atlasIMG: atlasIMG,
29079
29052
  atlasJSON: atlasJSON
@@ -29115,6 +29088,29 @@ var useResponsiveSize = function useResponsiveSize(scale) {
29115
29088
  return size;
29116
29089
  };
29117
29090
 
29091
+ var _countItemFromInventory = function countItemFromInventory(itemKey, inventory) {
29092
+ var totalQty = 0;
29093
+ if (!inventory) {
29094
+ return totalQty;
29095
+ }
29096
+ Object.keys(inventory.slots).forEach(function (i) {
29097
+ var index = parseInt(i);
29098
+ var item = inventory.slots[index];
29099
+ if (!item) {
29100
+ return;
29101
+ }
29102
+ // Count matching items
29103
+ if (item.key === itemKey) {
29104
+ totalQty += item.stackQty || 1;
29105
+ }
29106
+ // Recursively check nested containers
29107
+ if (item.isItemContainer && item.itemContainer && typeof item.itemContainer !== "string") {
29108
+ totalQty += _countItemFromInventory(itemKey, item.itemContainer);
29109
+ }
29110
+ });
29111
+ return totalQty;
29112
+ };
29113
+
29118
29114
  function calculateMaxCraftable(recipe, inventory) {
29119
29115
  var _recipe$ingredients$r;
29120
29116
  if (!inventory || !(recipe != null && recipe.ingredients)) {
@@ -29271,7 +29267,6 @@ var CraftBook = function CraftBook(_ref) {
29271
29267
  scale: scale,
29272
29268
  handleRecipeSelect: setCraftItemKey.bind(null, item.key),
29273
29269
  selectedCraftItemKey: craftItemKey,
29274
- inventory: inventory,
29275
29270
  skills: skills
29276
29271
  }));
29277
29272
  })) : React__default.createElement(EmptyState, null, React__default.createElement(fa.FaBoxOpen, {