@rpg-engine/long-bow 0.8.33 → 0.8.34

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.
@@ -31884,6 +31884,12 @@ var InformationCenterNPCDetails = function InformationCenterNPCDetails(_ref) {
31884
31884
  var _useState2 = React.useState(1),
31885
31885
  currentLootPage = _useState2[0],
31886
31886
  setCurrentLootPage = _useState2[1];
31887
+ var _useState3 = React.useState(null),
31888
+ selectedItem = _useState3[0],
31889
+ setSelectedItem = _useState3[1];
31890
+ React.useEffect(function () {
31891
+ setCurrentLootPage(1);
31892
+ }, [lootSearchQuery]);
31887
31893
  var formatText = function formatText(text) {
31888
31894
  if (typeof text === 'number') {
31889
31895
  return text.toString();
@@ -31915,6 +31921,25 @@ var InformationCenterNPCDetails = function InformationCenterNPCDetails(_ref) {
31915
31921
  })) || [];
31916
31922
  var totalLootPages = Math.ceil(filteredLoots.length / ITEMS_PER_PAGE$1);
31917
31923
  var paginatedLoots = filteredLoots.slice((currentLootPage - 1) * ITEMS_PER_PAGE$1, currentLootPage * ITEMS_PER_PAGE$1);
31924
+ var handleItemClick = function handleItemClick(loot) {
31925
+ var item = {
31926
+ key: loot.itemBlueprintKey,
31927
+ name: formatItemName(loot.itemBlueprintKey),
31928
+ texturePath: loot.itemBlueprintKey,
31929
+ textureAtlas: 'items',
31930
+ type: shared.ItemType.Weapon,
31931
+ subType: shared.ItemSubType.Sword,
31932
+ tier: 1,
31933
+ rarity: shared.ItemRarities.Common,
31934
+ weight: 0,
31935
+ maxStackSize: loot.quantityRange ? loot.quantityRange[1] : 1,
31936
+ canSell: true,
31937
+ description: 'A basic item.',
31938
+ basePrice: 100,
31939
+ allowedEquipSlotType: []
31940
+ };
31941
+ setSelectedItem(item);
31942
+ };
31918
31943
  return React__default.createElement(BaseInformationDetails, {
31919
31944
  name: npc.name,
31920
31945
  spriteKey: npc.key,
@@ -31929,11 +31954,17 @@ var InformationCenterNPCDetails = function InformationCenterNPCDetails(_ref) {
31929
31954
  defaultOpen: !isMobile
31930
31955
  }, React__default.createElement(LootSearchContainer, null, React__default.createElement(StyledSearchBar$1, {
31931
31956
  value: lootSearchQuery,
31932
- onChange: setLootSearchQuery,
31957
+ onChange: function onChange(query) {
31958
+ setLootSearchQuery(query);
31959
+ setCurrentLootPage(1);
31960
+ },
31933
31961
  placeholder: "Search loot..."
31934
31962
  })), React__default.createElement(LootGrid, null, paginatedLoots.map(function (loot, index) {
31935
31963
  return React__default.createElement(LootItem, {
31936
- key: index
31964
+ key: loot.itemBlueprintKey + "-" + index,
31965
+ onClick: function onClick() {
31966
+ return handleItemClick(loot);
31967
+ }
31937
31968
  }, React__default.createElement(SpriteFromAtlas, {
31938
31969
  atlasJSON: itemsAtlasJSON,
31939
31970
  atlasIMG: itemsAtlasIMG,
@@ -31967,7 +31998,15 @@ var InformationCenterNPCDetails = function InformationCenterNPCDetails(_ref) {
31967
31998
  height: 24,
31968
31999
  imgScale: 1
31969
32000
  })), React__default.createElement(SpellContent, null, React__default.createElement(SpellName, null, formatText(spell.spellKey)), React__default.createElement(SpellDetails, null, "Power: ", React__default.createElement(SpellValue, null, formatText(spell.power)), React__default.createElement(Separator, null, "\u2022"), "Chance: ", React__default.createElement(SpellValue, null, spell.probability, "%"))));
31970
- }))));
32001
+ }))), selectedItem && React__default.createElement(Portal, null, React__default.createElement(InformationCenterItemDetails, {
32002
+ item: selectedItem,
32003
+ itemsAtlasJSON: itemsAtlasJSON,
32004
+ itemsAtlasIMG: itemsAtlasIMG,
32005
+ droppedBy: [npc],
32006
+ onBack: function onBack() {
32007
+ return setSelectedItem(null);
32008
+ }
32009
+ })));
31971
32010
  };
31972
32011
  var InfoSection$1 = /*#__PURE__*/styled__default.div.withConfig({
31973
32012
  displayName: "InformationCenterNPCDetails__InfoSection",
@@ -32052,27 +32091,27 @@ var LootGrid = /*#__PURE__*/styled__default.div.withConfig({
32052
32091
  var LootItem = /*#__PURE__*/styled__default.div.withConfig({
32053
32092
  displayName: "InformationCenterNPCDetails__LootItem",
32054
32093
  componentId: "sc-fdu3xl-20"
32055
- })(["display:flex;align-items:center;gap:4px;background:rgba(255,255,255,0.05);padding:4px;border-radius:4px;min-width:0;"]);
32094
+ })(["display:flex;align-items:center;gap:4px;background:rgba(255,255,255,0.05);padding:4px;border-radius:4px;min-width:0;cursor:pointer;user-select:none;transition:background-color 0.2s ease;&:hover{background:rgba(255,255,255,0.1);}"]);
32056
32095
  var LootDetails = /*#__PURE__*/styled__default.div.withConfig({
32057
32096
  displayName: "InformationCenterNPCDetails__LootDetails",
32058
32097
  componentId: "sc-fdu3xl-21"
32059
- })(["flex:1;display:flex;flex-direction:column;gap:4px;"]);
32098
+ })(["flex:1;display:flex;flex-direction:column;gap:4px;user-select:none;"]);
32060
32099
  var LootName = /*#__PURE__*/styled__default.div.withConfig({
32061
32100
  displayName: "InformationCenterNPCDetails__LootName",
32062
32101
  componentId: "sc-fdu3xl-22"
32063
- })(["color:", ";font-size:0.5rem;"], uiColors.white);
32102
+ })(["color:", ";font-size:0.5rem;user-select:none;"], uiColors.white);
32064
32103
  var LootInfo = /*#__PURE__*/styled__default.div.withConfig({
32065
32104
  displayName: "InformationCenterNPCDetails__LootInfo",
32066
32105
  componentId: "sc-fdu3xl-23"
32067
- })(["display:flex;align-items:center;gap:8px;"]);
32106
+ })(["display:flex;align-items:center;gap:8px;user-select:none;"]);
32068
32107
  var LootChance = /*#__PURE__*/styled__default.span.withConfig({
32069
32108
  displayName: "InformationCenterNPCDetails__LootChance",
32070
32109
  componentId: "sc-fdu3xl-24"
32071
- })(["color:", ";font-size:0.45rem;"], uiColors.yellow);
32110
+ })(["color:", ";font-size:0.45rem;user-select:none;"], uiColors.yellow);
32072
32111
  var LootQuantity = /*#__PURE__*/styled__default.span.withConfig({
32073
32112
  displayName: "InformationCenterNPCDetails__LootQuantity",
32074
32113
  componentId: "sc-fdu3xl-25"
32075
- })(["color:", ";font-size:0.45rem;"], uiColors.lightGray);
32114
+ })(["color:", ";font-size:0.45rem;user-select:none;"], uiColors.lightGray);
32076
32115
  var PaginationContainer$2 = /*#__PURE__*/styled__default.div.withConfig({
32077
32116
  displayName: "InformationCenterNPCDetails__PaginationContainer",
32078
32117
  componentId: "sc-fdu3xl-26"