@rpg-engine/long-bow 0.8.120 → 0.8.122

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.
@@ -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 itemQtyInInventory = !inventory ? 0 : _countItemFromInventory(ingredient.key, inventory);
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, " (", itemQtyInInventory, ")"));
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, {
@@ -31775,7 +31770,7 @@ var UI_BREAKPOINT_MOBILE = '950px';
31775
31770
  var UI_BREAKPOINT_SMALL_LAPTOP = '1400px';
31776
31771
 
31777
31772
  var InternalTabs = function InternalTabs(_ref) {
31778
- var _tabs$find;
31773
+ var _tabs$, _tabs$find;
31779
31774
  var tabs = _ref.tabs,
31780
31775
  _ref$activeColor = _ref.activeColor,
31781
31776
  activeColor = _ref$activeColor === void 0 ? '#fef08a' : _ref$activeColor,
@@ -31789,7 +31784,14 @@ var InternalTabs = function InternalTabs(_ref) {
31789
31784
  hoverColor = _ref$hoverColor === void 0 ? '#fef3c7' : _ref$hoverColor,
31790
31785
  onTabChange = _ref.onTabChange,
31791
31786
  externalActiveTab = _ref.activeTab;
31792
- var activeTabId = externalActiveTab != null ? externalActiveTab : tabs[0].id;
31787
+ var _useState = useState((_tabs$ = tabs[0]) == null ? void 0 : _tabs$.id),
31788
+ internalActiveTab = _useState[0],
31789
+ setInternalActiveTab = _useState[1];
31790
+ var activeTabId = externalActiveTab != null ? externalActiveTab : internalActiveTab;
31791
+ var handleTabClick = function handleTabClick(tabId) {
31792
+ setInternalActiveTab(tabId);
31793
+ onTabChange == null ? void 0 : onTabChange(tabId);
31794
+ };
31793
31795
  return React.createElement(TableWrapper, null, React.createElement(TabHeader, {
31794
31796
  borderColor: borderColor
31795
31797
  }, tabs.map(function (tab) {
@@ -31802,7 +31804,7 @@ var InternalTabs = function InternalTabs(_ref) {
31802
31804
  borderColor: borderColor,
31803
31805
  hoverColor: hoverColor,
31804
31806
  onClick: function onClick() {
31805
- return onTabChange == null ? void 0 : onTabChange(tab.id);
31807
+ return handleTabClick(tab.id);
31806
31808
  }
31807
31809
  }, tab.title);
31808
31810
  })), React.createElement(ContentWrapper, null, (_tabs$find = tabs.find(function (tab) {