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