@rpg-engine/long-bow 0.8.72 → 0.8.73

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.
@@ -0,0 +1,51 @@
1
+ import { useMemo, useState } from 'react';
2
+ import { IProductBlueprint, ItemType } from '@rpg-engine/shared';
3
+ import { IOptionsProps } from '../components/Dropdown';
4
+
5
+ export const useStoreFiltering = (items: IProductBlueprint[]) => {
6
+ const [searchQuery, setSearchQuery] = useState('');
7
+ const [selectedCategory, setSelectedCategory] = useState<ItemType | 'all'>(
8
+ 'all'
9
+ );
10
+
11
+ const categoryOptions: IOptionsProps[] = useMemo(() => {
12
+ const uniqueCategories = Array.from(
13
+ new Set(items.map(item => item.itemType))
14
+ );
15
+ const allCategories = ['all', ...uniqueCategories] as (ItemType | 'all')[];
16
+ return allCategories.map((category, index) => ({
17
+ id: index,
18
+ value: category,
19
+ option: category === 'all' ? 'All' : category,
20
+ }));
21
+ }, [items]);
22
+
23
+ const filteredItems = useMemo(() => {
24
+ return items
25
+ .filter(item => {
26
+ const matchesSearch = item.name
27
+ .toLowerCase()
28
+ .includes(searchQuery.toLowerCase());
29
+ const matchesCategory =
30
+ selectedCategory === 'all' || item.itemType === selectedCategory;
31
+ return matchesSearch && matchesCategory;
32
+ })
33
+ .sort((a, b) => {
34
+ const aHighlighted = a.store?.isHighlighted || false;
35
+ const bHighlighted = b.store?.isHighlighted || false;
36
+
37
+ if (aHighlighted && !bHighlighted) return -1;
38
+ if (!aHighlighted && bHighlighted) return 1;
39
+ return 0;
40
+ });
41
+ }, [items, searchQuery, selectedCategory]);
42
+
43
+ return {
44
+ searchQuery,
45
+ setSearchQuery,
46
+ selectedCategory,
47
+ setSelectedCategory,
48
+ categoryOptions,
49
+ filteredItems,
50
+ };
51
+ };
@@ -1,8 +1,8 @@
1
- import { DailyTaskBlueprintMapVisitRegular, DailyTaskChallengeKillMobsBlueprint, DailyTaskRegularCraftFoodBlueprint, DailyTaskRegularCraftPotionsBlueprint, DailyTaskRegularKillMobsBlueprint, ICharacterDailyTask, RewardType, TaskDifficulty, TaskStatus, TaskType } from "@rpg-engine/shared";
1
+ import { ICharacterDailyTask, RewardType, TaskDifficulty, TaskStatus, TaskType } from "@rpg-engine/shared";
2
2
 
3
3
  export const mockTasks: ICharacterDailyTask[] = [
4
4
  {
5
- key: DailyTaskRegularKillMobsBlueprint.HuntRats,
5
+ key: 'hunt-rats',
6
6
  name: 'Kill Rats',
7
7
  description: 'Eliminate 5 rats in the forest',
8
8
  type: TaskType.KillMobs,
@@ -43,7 +43,7 @@ export const mockTasks: ICharacterDailyTask[] = [
43
43
  tier: 0
44
44
  },
45
45
  {
46
- key: DailyTaskRegularCraftFoodBlueprint.CraftCheese,
46
+ key: 'craft-cheese',
47
47
  name: 'Gather Resources',
48
48
  description: 'Collect 10 pieces of wood',
49
49
  type: TaskType.CollectItems,
@@ -84,7 +84,7 @@ export const mockTasks: ICharacterDailyTask[] = [
84
84
  tier: 0
85
85
  },
86
86
  {
87
- key: DailyTaskChallengeKillMobsBlueprint.HuntEloraTheQueen,
87
+ key: 'hunt-elora-the-queen',
88
88
  name: 'Slay the Dragon',
89
89
  description: 'Defeat the Queen Dragon',
90
90
  type: TaskType.KillMobs,
@@ -125,7 +125,7 @@ export const mockTasks: ICharacterDailyTask[] = [
125
125
  tier: 0
126
126
  },
127
127
  {
128
- key: DailyTaskBlueprintMapVisitRegular.ExploreVillage,
128
+ key: 'explore-village',
129
129
  name: "Village Ilya Explorer",
130
130
  description: "Visit the key locations in the ilya village",
131
131
  difficulty: TaskDifficulty.Regular,
@@ -167,7 +167,7 @@ export const mockTasks: ICharacterDailyTask[] = [
167
167
  tier: 0
168
168
  },
169
169
  {
170
- key: DailyTaskRegularCraftPotionsBlueprint.CraftLifePotion,
170
+ key: 'craft-life-potion',
171
171
  name: 'Craft Potions',
172
172
  description: 'Craft 5 health potions for the local alchemist',
173
173
  type: TaskType.CraftItems,
@@ -1,4 +1,4 @@
1
- import { IItemPack, IPurchase, IProductBlueprint, ItemRarities, ItemSubType, ItemType, MetadataType, UserAccountTypes, PaymentCurrency, PurchaseType } from '@rpg-engine/shared';
1
+ import { IItemPack, IProductBlueprint, IPurchase, ItemRarities, ItemSubType, ItemType, MetadataType, PaymentCurrency, PurchaseType, UserAccountTypes } from '@rpg-engine/shared';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
3
  import React from 'react';
4
4
  import { RPGUIRoot } from '../../../components/RPGUI/RPGUIRoot';
@@ -39,7 +39,7 @@ const storeItems: IProductBlueprint[] = mockItems.map((item, index) => ({
39
39
  textureAtlas: 'items',
40
40
  textureKey: item.texturePath,
41
41
  type: PurchaseType.Item,
42
- onPurchase: async () => {},
42
+ onPurchase: async () => { },
43
43
  itemType: item.type,
44
44
  itemSubType: item.subType,
45
45
  rarity: item.rarity,
@@ -48,6 +48,7 @@ const storeItems: IProductBlueprint[] = mockItems.map((item, index) => ({
48
48
  maxStackSize: item.maxStackSize || 1,
49
49
  isUsable: true,
50
50
  requiredAccountType: item.rarity === 'Legendary' ? [UserAccountTypes.PremiumGold] : [],
51
+
51
52
  }));
52
53
 
53
54
  // Sample character skins
@@ -69,6 +70,28 @@ const availableCharacters = [
69
70
  },
70
71
  ];
71
72
 
73
+ // Create character name change item
74
+ const characterNameChangeItem: IProductBlueprint = {
75
+ key: 'character-name-change',
76
+ name: 'Character Name Change',
77
+ description: 'Change your character\'s name to something new',
78
+ price: 9.99,
79
+ currency: PaymentCurrency.USD,
80
+ texturePath: 'items/character_customization.png',
81
+ textureAtlas: 'items',
82
+ textureKey: 'items/character_customization.png',
83
+ type: PurchaseType.Item,
84
+ onPurchase: async () => { },
85
+ itemType: ItemType.Other,
86
+ itemSubType: ItemSubType.Other,
87
+ rarity: ItemRarities.Common,
88
+ weight: 0,
89
+ isStackable: false,
90
+ maxStackSize: 1,
91
+ isUsable: true,
92
+ inputPlaceholder: 'Enter new character name',
93
+ };
94
+
72
95
  // Create character skin items
73
96
  const characterSkinItems: IProductBlueprint[] = [
74
97
  {
@@ -81,7 +104,7 @@ const characterSkinItems: IProductBlueprint[] = [
81
104
  textureAtlas: 'items',
82
105
  textureKey: 'items/character_customization.png',
83
106
  type: PurchaseType.Item,
84
- onPurchase: async () => {},
107
+ onPurchase: async () => { },
85
108
  itemType: ItemType.Other,
86
109
  itemSubType: ItemSubType.Other,
87
110
  rarity: ItemRarities.Rare,
@@ -95,6 +118,9 @@ const characterSkinItems: IProductBlueprint[] = [
95
118
  atlasJSON: entitiesAtlasJSON,
96
119
  atlasIMG: entitiesAtlasIMG,
97
120
  },
121
+ store: {
122
+ isHighlighted: true, // Highlight the first character skin item
123
+ },
98
124
  },
99
125
  {
100
126
  key: 'skin-premium-character-pack',
@@ -106,7 +132,7 @@ const characterSkinItems: IProductBlueprint[] = [
106
132
  textureAtlas: 'items',
107
133
  textureKey: 'items/premium_character_pack.png',
108
134
  type: PurchaseType.Item,
109
- onPurchase: async () => {},
135
+ onPurchase: async () => { },
110
136
  itemType: ItemType.Other,
111
137
  itemSubType: ItemSubType.Other,
112
138
  rarity: ItemRarities.Epic,
@@ -127,6 +153,7 @@ const characterSkinItems: IProductBlueprint[] = [
127
153
  // Create duplicated items once with unique keys
128
154
  const duplicatedItems: IProductBlueprint[] = [
129
155
  ...storeItems,
156
+ characterNameChangeItem,
130
157
  ...characterSkinItems,
131
158
  ...storeItems.map((item, index) => ({
132
159
  ...item,
@@ -160,20 +187,20 @@ const mockPacks: IItemPack[] = [
160
187
  image: customSkinImage,
161
188
  },
162
189
 
163
- {
190
+ {
164
191
  key: 'ultimate-pack',
165
192
  title: '👑 Ultimate Premium Pack',
166
193
  description: 'The most exclusive collection of items, effects, and perks. Includes everything from previous tiers plus legendary items!',
167
194
  priceUSD: 99.99,
168
195
  image: customSkinImage,
169
196
  },
170
- {
197
+ {
171
198
  key: 'gold-pack',
172
199
  title: '🥇 Gold Premium Pack',
173
200
  description: 'The ultimate premium experience with rare items, unique effects, and exclusive content. For true champions!',
174
201
  priceUSD: 49.99,
175
202
  image: customSkinImage,
176
- },
203
+ },
177
204
  {
178
205
  key: 'silver-pack',
179
206
  title: '🥈 Silver Premium Pack',
@@ -209,7 +236,7 @@ export const Default: Story = {
209
236
  hidePremiumTab={true}
210
237
  tabOrder={['items', 'packs']}
211
238
  defaultActiveTab="items"
212
- textInputItemKeys={['original-greater-life-potion-2', 'original-angelic-sword-1']}
239
+ textInputItemKeys={['original-greater-life-potion-2', 'original-angelic-sword-1', 'character-name-change']}
213
240
  />
214
241
  ),
215
242
  };