@rpg-engine/long-bow 0.2.27 → 0.2.29
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/dist/components/SkillProgressBar.d.ts +2 -0
- package/dist/components/SkillsContainer.d.ts +2 -0
- package/dist/components/TradingMenu/TrandingMenu.d.ts +12 -0
- package/dist/components/TradingMenu/itemComponent.d.ts +9 -0
- package/dist/components/TradingMenu/items.mock.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +408 -414
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +407 -418
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/stories/ItemTradingComponent.stories.d.ts +5 -0
- package/dist/stories/TrandingMenu.stories.d.ts +5 -0
- package/package.json +2 -2
- package/src/components/Character/CharacterSelection.tsx +1 -1
- package/src/components/Item/Inventory/ItemSlot.tsx +6 -4
- package/src/components/NPCDialog/.DS_Store +0 -0
- package/src/components/ScrollList.tsx +2 -1
- package/src/components/SkillProgressBar.tsx +4 -2
- package/src/components/SkillsContainer.tsx +8 -37
- package/src/components/TradingMenu/TrandingMenu.tsx +190 -0
- package/src/components/TradingMenu/itemComponent.tsx +158 -0
- package/src/components/TradingMenu/items.mock.ts +87 -0
- package/src/index.tsx +1 -0
- package/src/mocks/.DS_Store +0 -0
- package/src/mocks/equipmentSet.mocks.ts +3 -5
- package/src/mocks/itemContainer.mocks.ts +20 -32
- package/src/stories/ItemTradingComponent.stories.tsx +39 -0
- package/src/stories/SkillProgressBar.stories.tsx +4 -0
- package/src/stories/SkillsContainer.stories.tsx +4 -0
- package/src/stories/TrandingMenu.stories.tsx +38 -0
- package/dist/libs/ItemSlotHelper.d.ts +0 -2
- package/src/libs/ItemSlotHelper.ts +0 -25
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
IItemContainer,
|
|
4
4
|
ItemSlotType,
|
|
5
5
|
ItemSubType,
|
|
6
|
-
ItemType
|
|
6
|
+
ItemType,
|
|
7
7
|
} from '@rpg-engine/shared';
|
|
8
8
|
|
|
9
9
|
export const items: IItem[] = [
|
|
@@ -240,7 +240,7 @@ export const items: IItem[] = [
|
|
|
240
240
|
'You see a bag. It has made using leather and it has 10 total slots.',
|
|
241
241
|
createdAt: '2022-06-04T03:18:09.335Z',
|
|
242
242
|
updatedAt: '2022-06-04T18:16:49.056Z',
|
|
243
|
-
},
|
|
243
|
+
},
|
|
244
244
|
{
|
|
245
245
|
_id: '392acek4j7c8e80d2ff60404',
|
|
246
246
|
hasUseWith: false,
|
|
@@ -263,8 +263,7 @@ export const items: IItem[] = [
|
|
|
263
263
|
textureKey: 'stone',
|
|
264
264
|
name: 'stone',
|
|
265
265
|
generateContainerSlots: 10,
|
|
266
|
-
description:
|
|
267
|
-
'You see a stone. It is used with slingshot.',
|
|
266
|
+
description: 'You see a stone. It is used with slingshot.',
|
|
268
267
|
attack: 7,
|
|
269
268
|
defense: 3,
|
|
270
269
|
weight: 13,
|
|
@@ -272,11 +271,10 @@ export const items: IItem[] = [
|
|
|
272
271
|
x: 320,
|
|
273
272
|
y: 144,
|
|
274
273
|
scene: 'MainScene',
|
|
275
|
-
fullDescription:
|
|
276
|
-
'You see a stone. It is used with slingshot',
|
|
274
|
+
fullDescription: 'You see a stone. It is used with slingshot',
|
|
277
275
|
createdAt: '2022-06-04T03:18:09.335Z',
|
|
278
276
|
updatedAt: '2022-06-04T18:16:49.056Z',
|
|
279
|
-
},
|
|
277
|
+
},
|
|
280
278
|
{
|
|
281
279
|
_id: '392acek4j7c8e80d2fs60404',
|
|
282
280
|
hasUseWith: false,
|
|
@@ -299,8 +297,7 @@ export const items: IItem[] = [
|
|
|
299
297
|
textureKey: 'stone',
|
|
300
298
|
name: 'stone',
|
|
301
299
|
generateContainerSlots: 10,
|
|
302
|
-
description:
|
|
303
|
-
'You see a stone. It is used with slingshot.',
|
|
300
|
+
description: 'You see a stone. It is used with slingshot.',
|
|
304
301
|
attack: 7,
|
|
305
302
|
defense: 3,
|
|
306
303
|
weight: 13,
|
|
@@ -308,11 +305,10 @@ export const items: IItem[] = [
|
|
|
308
305
|
x: 320,
|
|
309
306
|
y: 144,
|
|
310
307
|
scene: 'MainScene',
|
|
311
|
-
fullDescription:
|
|
312
|
-
'You see a stone. It is used with slingshot',
|
|
308
|
+
fullDescription: 'You see a stone. It is used with slingshot',
|
|
313
309
|
createdAt: '2022-06-04T03:18:09.335Z',
|
|
314
310
|
updatedAt: '2022-06-04T18:16:49.056Z',
|
|
315
|
-
},
|
|
311
|
+
},
|
|
316
312
|
{
|
|
317
313
|
_id: '392acek4j7c8e80d2fs60404',
|
|
318
314
|
hasUseWith: false,
|
|
@@ -335,8 +331,7 @@ export const items: IItem[] = [
|
|
|
335
331
|
textureKey: 'stone',
|
|
336
332
|
name: 'stone',
|
|
337
333
|
generateContainerSlots: 10,
|
|
338
|
-
description:
|
|
339
|
-
'You see a stone. It is used with slingshot.',
|
|
334
|
+
description: 'You see a stone. It is used with slingshot.',
|
|
340
335
|
attack: 7,
|
|
341
336
|
defense: 3,
|
|
342
337
|
weight: 13,
|
|
@@ -344,11 +339,10 @@ export const items: IItem[] = [
|
|
|
344
339
|
x: 320,
|
|
345
340
|
y: 144,
|
|
346
341
|
scene: 'MainScene',
|
|
347
|
-
fullDescription:
|
|
348
|
-
'You see a stone. It is used with slingshot',
|
|
342
|
+
fullDescription: 'You see a stone. It is used with slingshot',
|
|
349
343
|
createdAt: '2022-06-04T03:18:09.335Z',
|
|
350
344
|
updatedAt: '2022-06-04T18:16:49.056Z',
|
|
351
|
-
},
|
|
345
|
+
},
|
|
352
346
|
{
|
|
353
347
|
_id: '392acek4j7c8e80d2fs60404',
|
|
354
348
|
hasUseWith: false,
|
|
@@ -371,8 +365,7 @@ export const items: IItem[] = [
|
|
|
371
365
|
textureKey: 'stone',
|
|
372
366
|
name: 'stone',
|
|
373
367
|
generateContainerSlots: 10,
|
|
374
|
-
description:
|
|
375
|
-
'You see a stone. It is used with slingshot.',
|
|
368
|
+
description: 'You see a stone. It is used with slingshot.',
|
|
376
369
|
attack: 7,
|
|
377
370
|
defense: 3,
|
|
378
371
|
weight: 13,
|
|
@@ -380,11 +373,10 @@ export const items: IItem[] = [
|
|
|
380
373
|
x: 320,
|
|
381
374
|
y: 144,
|
|
382
375
|
scene: 'MainScene',
|
|
383
|
-
fullDescription:
|
|
384
|
-
'You see a stone. It is used with slingshot',
|
|
376
|
+
fullDescription: 'You see a stone. It is used with slingshot',
|
|
385
377
|
createdAt: '2022-06-04T03:18:09.335Z',
|
|
386
378
|
updatedAt: '2022-06-04T18:16:49.056Z',
|
|
387
|
-
},
|
|
379
|
+
},
|
|
388
380
|
{
|
|
389
381
|
_id: '392acek4j7c8e80d2fs60404',
|
|
390
382
|
hasUseWith: false,
|
|
@@ -407,8 +399,7 @@ export const items: IItem[] = [
|
|
|
407
399
|
textureKey: 'stone',
|
|
408
400
|
name: 'stone',
|
|
409
401
|
generateContainerSlots: 10,
|
|
410
|
-
description:
|
|
411
|
-
'You see a stone. It is used with slingshot.',
|
|
402
|
+
description: 'You see a stone. It is used with slingshot.',
|
|
412
403
|
attack: 7,
|
|
413
404
|
defense: 3,
|
|
414
405
|
weight: 13,
|
|
@@ -416,11 +407,10 @@ export const items: IItem[] = [
|
|
|
416
407
|
x: 320,
|
|
417
408
|
y: 144,
|
|
418
409
|
scene: 'MainScene',
|
|
419
|
-
fullDescription:
|
|
420
|
-
'You see a stone. It is used with slingshot',
|
|
410
|
+
fullDescription: 'You see a stone. It is used with slingshot',
|
|
421
411
|
createdAt: '2022-06-04T03:18:09.335Z',
|
|
422
412
|
updatedAt: '2022-06-04T18:16:49.056Z',
|
|
423
|
-
},
|
|
413
|
+
},
|
|
424
414
|
{
|
|
425
415
|
_id: '392acek4j7c8e80d2fs60404',
|
|
426
416
|
hasUseWith: false,
|
|
@@ -443,8 +433,7 @@ export const items: IItem[] = [
|
|
|
443
433
|
textureKey: 'gold-coin',
|
|
444
434
|
name: 'gold-coin',
|
|
445
435
|
generateContainerSlots: 10,
|
|
446
|
-
description:
|
|
447
|
-
'You see a coin.',
|
|
436
|
+
description: 'You see a coin.',
|
|
448
437
|
attack: 7,
|
|
449
438
|
defense: 3,
|
|
450
439
|
weight: 13,
|
|
@@ -452,11 +441,10 @@ export const items: IItem[] = [
|
|
|
452
441
|
x: 320,
|
|
453
442
|
y: 144,
|
|
454
443
|
scene: 'MainScene',
|
|
455
|
-
fullDescription:
|
|
456
|
-
'You see a stone. It is used with slingshot',
|
|
444
|
+
fullDescription: 'You see a stone. It is used with slingshot',
|
|
457
445
|
createdAt: '2022-06-04T03:18:09.335Z',
|
|
458
446
|
updatedAt: '2022-06-04T18:16:49.056Z',
|
|
459
|
-
}
|
|
447
|
+
},
|
|
460
448
|
];
|
|
461
449
|
|
|
462
450
|
export const itemContainerMock: IItemContainer = {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Meta, Story } from '@storybook/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { RPGUIRoot } from '../components/RPGUIRoot';
|
|
4
|
+
import {
|
|
5
|
+
ItemTradingComponent,
|
|
6
|
+
ITradeComponentProps,
|
|
7
|
+
} from '../components/TradingMenu/itemComponent';
|
|
8
|
+
import atlasJSON from '../mocks/atlas/items/items.json';
|
|
9
|
+
import atlasIMG from '../mocks/atlas/items/items.png';
|
|
10
|
+
import { itemMock } from '../components/TradingMenu/items.mock';
|
|
11
|
+
import { ITransactionItem } from '@rpg-engine/shared';
|
|
12
|
+
|
|
13
|
+
const updateChartTotals = (itemInfo: ITransactionItem) => {
|
|
14
|
+
console.log(itemInfo);
|
|
15
|
+
// will be needed read all itens from chart list ignoring the current item (itemInfo) and recalculate the totals
|
|
16
|
+
// with the amount updated set the total to a state to be shown to the player.
|
|
17
|
+
// OBS: This list with Id, quantity and amount will be the one to send to API,
|
|
18
|
+
// because the API need to know wichi Items and the quantity of it to make a purchese and set the itens to the player.
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const meta: Meta = {
|
|
22
|
+
title: 'Trading Item',
|
|
23
|
+
component: ItemTradingComponent,
|
|
24
|
+
};
|
|
25
|
+
export default meta;
|
|
26
|
+
|
|
27
|
+
const Template: Story<ITradeComponentProps> = args => (
|
|
28
|
+
<RPGUIRoot>
|
|
29
|
+
<ItemTradingComponent {...args} traderItem={itemMock[0]} />
|
|
30
|
+
</RPGUIRoot>
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export const Default = Template.bind({});
|
|
34
|
+
|
|
35
|
+
Default.args = {
|
|
36
|
+
atlasIMG: atlasIMG,
|
|
37
|
+
atlasJSON: atlasJSON,
|
|
38
|
+
updateChartTotals,
|
|
39
|
+
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Meta, Story } from '@storybook/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { RPGUIRoot } from '../../src/components/RPGUIRoot';
|
|
4
|
+
import atlasJSON from '../mocks/atlas/items/items.json';
|
|
5
|
+
import atlasIMG from '../mocks/atlas/items/items.png';
|
|
4
6
|
import {
|
|
5
7
|
ISkillProgressBarProps,
|
|
6
8
|
SkillProgressBar,
|
|
@@ -27,4 +29,6 @@ Default.args = {
|
|
|
27
29
|
skillPoints: 10,
|
|
28
30
|
skillPointsToNextLevel: 100,
|
|
29
31
|
texturePath: 'swords/broad-sword.png',
|
|
32
|
+
atlasIMG: atlasIMG,
|
|
33
|
+
atlasJSON: atlasJSON,
|
|
30
34
|
};
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
SkillsContainer,
|
|
7
7
|
} from '../../src/components/SkillsContainer';
|
|
8
8
|
import { skillMock } from '../../src/mocks/skills.mocks';
|
|
9
|
+
import atlasJSON from '../mocks/atlas/items/items.json';
|
|
10
|
+
import atlasIMG from '../mocks/atlas/items/items.png';
|
|
9
11
|
|
|
10
12
|
const meta: Meta = {
|
|
11
13
|
title: 'Skills Container',
|
|
@@ -20,6 +22,8 @@ const Template: Story<ISkillContainerProps> = args => (
|
|
|
20
22
|
{...args}
|
|
21
23
|
skill={skillMock}
|
|
22
24
|
onCloseButton={() => console.log('close skill container')}
|
|
25
|
+
atlasIMG={atlasIMG}
|
|
26
|
+
atlasJSON={atlasJSON}
|
|
23
27
|
/>
|
|
24
28
|
</RPGUIRoot>
|
|
25
29
|
);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Meta, Story } from '@storybook/react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { RPGUIRoot } from '../components/RPGUIRoot';
|
|
4
|
+
import {
|
|
5
|
+
TrandingMenu,
|
|
6
|
+
ITrandingMenu,
|
|
7
|
+
} from '../components/TradingMenu/TrandingMenu';
|
|
8
|
+
import atlasJSON from '../mocks/atlas/items/items.json';
|
|
9
|
+
import atlasIMG from '../mocks/atlas/items/items.png';
|
|
10
|
+
import { itemMock } from '../components/TradingMenu/items.mock';
|
|
11
|
+
|
|
12
|
+
const meta: Meta = {
|
|
13
|
+
title: 'Trading Menu',
|
|
14
|
+
component: TrandingMenu,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
|
|
19
|
+
const Template: Story<ITrandingMenu> = args => (
|
|
20
|
+
<RPGUIRoot>
|
|
21
|
+
<TrandingMenu {...args} />
|
|
22
|
+
</RPGUIRoot>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export const Default = Template.bind({});
|
|
26
|
+
|
|
27
|
+
const onClose = () => {
|
|
28
|
+
console.log('close');
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
Default.args = {
|
|
32
|
+
traderItems: itemMock,
|
|
33
|
+
onClose: onClose,
|
|
34
|
+
type: 'buy',
|
|
35
|
+
atlasJSON: atlasJSON,
|
|
36
|
+
atlasIMG: atlasIMG,
|
|
37
|
+
characterAvailableGold: 1000,
|
|
38
|
+
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { IItem } from "@rpg-engine/shared";
|
|
2
|
-
|
|
3
|
-
export const getItemTextureKeyPath = (itemToRender: IItem, atlasJSON: any) => {
|
|
4
|
-
|
|
5
|
-
const stackQty = itemToRender?.stackQty ?? 0;
|
|
6
|
-
const itemTexturePath = itemToRender.texturePath;
|
|
7
|
-
|
|
8
|
-
if (itemToRender && stackQty >= 1) {
|
|
9
|
-
const idx = stackQty >= 5 ? '5' : stackQty;
|
|
10
|
-
|
|
11
|
-
const textureBreakPath = itemTexturePath.split('.');
|
|
12
|
-
const txtPrefix: string = textureBreakPath[0];
|
|
13
|
-
const txtExtension: string = textureBreakPath[1];
|
|
14
|
-
console.log(`${txtPrefix}-qty-${idx}.${txtExtension}`);
|
|
15
|
-
const newTexturePath = `${txtPrefix}-qty-${idx}.${txtExtension}`;
|
|
16
|
-
const spriteData = atlasJSON.frames[newTexturePath];
|
|
17
|
-
|
|
18
|
-
if (spriteData !== undefined) {
|
|
19
|
-
return newTexturePath;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return itemTexturePath;
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
|