@rpg-engine/long-bow 0.8.163 → 0.8.166

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.8.163",
3
+ "version": "0.8.166",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -42,29 +42,31 @@ const mockYourBuyOrders: IMarketplaceBuyOrderItem[] = [
42
42
  { _id: 'bo-3', owner: 'player-1', itemBlueprintKey: 'items/leather-armor', maxPrice: 300, escrowedGold: 0, fee: 15, status: MarketplaceBuyOrderStatus.Expired, createdAt: daysAgo(35), updatedAt: daysAgo(7) },
43
43
  ];
44
44
 
45
- const mockOpenBuyOrders: IMarketplaceBuyOrderItem[] = [
46
- // Abyssal Tide Staff — single request
47
- { _id: 'obo-1', owner: 'player-2', itemBlueprintKey: 'items/abyssal-tide-staff', itemRarity: 'Epic', maxPrice: 1500, escrowedGold: 1500, fee: 75, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(1), updatedAt: daysAgo(1) },
48
- // Wooden Shield — single request
49
- { _id: 'obo-2', owner: 'player-3', itemBlueprintKey: 'items/wooden-shield', maxPrice: 200, escrowedGold: 200, fee: 10, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(5), updatedAt: daysAgo(5) },
50
- // Fire Wand — 2 requests (grouped)
51
- { _id: 'obo-3a', owner: 'player-4', itemBlueprintKey: 'items/fire-wand', itemRarity: 'Rare', maxPrice: 800, escrowedGold: 800, fee: 40, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(2), updatedAt: daysAgo(2) },
52
- { _id: 'obo-3b', owner: 'player-10', itemBlueprintKey: 'items/fire-wand', maxPrice: 550, escrowedGold: 550, fee: 27, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(4), updatedAt: daysAgo(4) },
53
- // Broad Sword — 3 requests (grouped)
54
- { _id: 'obo-4a', owner: 'player-5', itemBlueprintKey: 'items/broad-sword', maxPrice: 350, escrowedGold: 350, fee: 17, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(3), updatedAt: daysAgo(3) },
55
- { _id: 'obo-4b', owner: 'player-11', itemBlueprintKey: 'items/broad-sword', itemRarity: 'Rare', maxPrice: 480, escrowedGold: 480, fee: 24, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(1), updatedAt: daysAgo(1) },
56
- { _id: 'obo-4c', owner: 'player-12', itemBlueprintKey: 'items/broad-sword', maxPrice: 270, escrowedGold: 270, fee: 13, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(6), updatedAt: daysAgo(6) },
57
- // Barbarian Helmet — single request
58
- { _id: 'obo-5', owner: 'player-6', itemBlueprintKey: 'items/barbarian-helmet', itemRarity: 'Uncommon', maxPrice: 600, escrowedGold: 600, fee: 30, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(1), updatedAt: daysAgo(1) },
59
- // Leather Armor — 2 requests (grouped)
60
- { _id: 'obo-6a', owner: 'player-7', itemBlueprintKey: 'items/leather-armor', maxPrice: 420, escrowedGold: 420, fee: 21, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(4), updatedAt: daysAgo(4) },
61
- { _id: 'obo-6b', owner: 'player-13', itemBlueprintKey: 'items/leather-armor', itemRarity: 'Uncommon', maxPrice: 380, escrowedGold: 380, fee: 19, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(2), updatedAt: daysAgo(2) },
62
- // Angelic Sword — 2 requests (grouped)
63
- { _id: 'obo-7a', owner: 'player-8', itemBlueprintKey: 'items/angelic-sword', itemRarity: 'Legendary', maxPrice: 5000, escrowedGold: 5000, fee: 250, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(6), updatedAt: daysAgo(6) },
64
- { _id: 'obo-7b', owner: 'player-14', itemBlueprintKey: 'items/angelic-sword', itemRarity: 'Epic', maxPrice: 3500, escrowedGold: 3500, fee: 175, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(3), updatedAt: daysAgo(3) },
65
- // Greater Life Potion — single request
66
- { _id: 'obo-8', owner: 'player-9', itemBlueprintKey: 'items/greater-life-potion', maxPrice: 90, stackQty: 10, escrowedGold: 900, fee: 45, status: MarketplaceBuyOrderStatus.Active, createdAt: daysAgo(2), updatedAt: daysAgo(2) },
45
+ const ITEM_KEYS = [
46
+ 'items/broad-sword', 'items/angelic-sword', 'items/leather-armor',
47
+ 'items/abyssal-tide-staff', 'items/wooden-shield', 'items/fire-wand',
48
+ 'items/barbarian-helmet', 'items/greater-life-potion', 'items/iron-axe',
49
+ 'items/shadow-cloak', 'items/mystic-staff', 'items/steel-boots',
50
+ 'items/dragon-scale', 'items/emerald-ring', 'items/frost-bow',
51
+ 'items/phoenix-feather', 'items/void-dagger', 'items/crystal-wand',
52
+ 'items/titan-gauntlets', 'items/silver-arrow',
67
53
  ];
54
+ const RARITIES = ['Common', 'Uncommon', 'Rare', 'Epic', 'Legendary'] as const;
55
+
56
+ const allMockOpenBuyOrders: IMarketplaceBuyOrderItem[] = Array.from({ length: 100 }, (_, i) => ({
57
+ _id: `obo-${i + 1}`,
58
+ owner: `player-${(i % 20) + 2}`,
59
+ itemBlueprintKey: ITEM_KEYS[i % ITEM_KEYS.length],
60
+ itemRarity: RARITIES[i % RARITIES.length] as any,
61
+ maxPrice: Math.round((100 + i * 47) / 10) * 10,
62
+ escrowedGold: Math.round((100 + i * 47) / 10) * 10,
63
+ fee: Math.round((100 + i * 47) / 10) * 10 * 0.05,
64
+ status: MarketplaceBuyOrderStatus.Active,
65
+ createdAt: daysAgo(i % 30),
66
+ updatedAt: daysAgo(i % 30),
67
+ }));
68
+
69
+ const OPEN_BUY_ORDERS_PER_PAGE = 5;
68
70
 
69
71
  const mockTransactions: IMarketplaceTransaction[] = [
70
72
  { owner: 'player-1', type: MarketplaceTransactionType.Purchase, goldAmount: 450, itemKey: 'items/broad-sword', itemName: 'Broad Sword', counterpartName: 'MerchantKing', metadata: { currency: 'gold' }, createdAt: daysAgo(1), updatedAt: daysAgo(1) },
@@ -80,6 +82,7 @@ const mockTransactions: IMarketplaceTransaction[] = [
80
82
 
81
83
  const Template: Story = () => {
82
84
  const [page, setPage] = React.useState(1);
85
+ const [openBuyOrdersPage, setOpenBuyOrdersPage] = React.useState(1);
83
86
  const [selectedBlueprint, setSelectedBlueprint] = React.useState<IMarketplaceBlueprintSummary | undefined>();
84
87
  const [quantity, setQuantity] = React.useState(1);
85
88
  const [maxPrice, setMaxPrice] = React.useState(0);
@@ -89,6 +92,11 @@ const Template: Story = () => {
89
92
  const [historyType, setHistoryType] = React.useState('All');
90
93
  const [yourBuyOrders, setYourBuyOrders] = React.useState<IMarketplaceBuyOrderItem[]>(mockYourBuyOrders);
91
94
 
95
+ const pagedOpenBuyOrders = allMockOpenBuyOrders.slice(
96
+ (openBuyOrdersPage - 1) * OPEN_BUY_ORDERS_PER_PAGE,
97
+ openBuyOrdersPage * OPEN_BUY_ORDERS_PER_PAGE,
98
+ );
99
+
92
100
  const handleBlueprintSearch = (request: any) => {
93
101
  console.log('blueprint search:', request);
94
102
  setBlueprintLoading(true);
@@ -181,10 +189,10 @@ const Template: Story = () => {
181
189
  yourBuyOrdersPage={1}
182
190
  onYourBuyOrdersPageChange={p => console.log('your orders page:', p)}
183
191
  onCancelBuyOrder={id => setYourBuyOrders(prev => prev.filter(o => o._id !== id))}
184
- openBuyOrders={mockOpenBuyOrders}
185
- openBuyOrdersTotal={mockOpenBuyOrders.length}
186
- openBuyOrdersPage={1}
187
- onOpenBuyOrdersPageChange={(p: number) => console.log('open orders page:', p)}
192
+ openBuyOrders={pagedOpenBuyOrders}
193
+ openBuyOrdersTotal={allMockOpenBuyOrders.length}
194
+ openBuyOrdersPage={openBuyOrdersPage}
195
+ onOpenBuyOrdersPageChange={setOpenBuyOrdersPage}
188
196
  // Blueprint Search props
189
197
  onBlueprintSearch={handleBlueprintSearch}
190
198
  onBlueprintSelect={setSelectedBlueprint}