@rpg-engine/long-bow 0.2.46 → 0.2.48
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/shared/Ellipsis.d.ts +3 -2
- package/dist/long-bow.cjs.development.js +30 -23
- 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 +30 -23
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Item/Inventory/ItemSlot.tsx +35 -17
- package/src/components/PropertySelect/PropertySelect.tsx +7 -5
- package/src/components/TradingMenu/TradingItemRow.tsx +5 -3
- package/src/components/shared/Ellipsis.tsx +10 -9
- package/src/mocks/itemContainer.mocks.ts +46 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpg-engine/long-bow",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.48",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
},
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@rollup/plugin-image": "^2.1.1",
|
|
86
|
-
"@rpg-engine/shared": "^0.5.
|
|
86
|
+
"@rpg-engine/shared": "^0.5.74",
|
|
87
87
|
"dayjs": "^1.11.2",
|
|
88
88
|
"fs-extra": "^10.1.0",
|
|
89
89
|
"lodash": "^4.17.21",
|
|
@@ -11,7 +11,9 @@ import { observer } from 'mobx-react-lite';
|
|
|
11
11
|
import React, { useEffect, useState } from 'react';
|
|
12
12
|
import styled from 'styled-components';
|
|
13
13
|
import { v4 as uuidv4 } from 'uuid';
|
|
14
|
+
import { uiFonts } from '../../../constants/uiFonts';
|
|
14
15
|
import { RelativeListMenu } from '../../RelativeListMenu';
|
|
16
|
+
import { Ellipsis } from '../../shared/Ellipsis';
|
|
15
17
|
import { SpriteFromAtlas } from '../../shared/SpriteFromAtlas';
|
|
16
18
|
import { ItemTooltip } from '../Cards/ItemTooltip';
|
|
17
19
|
import { ErrorBoundary } from './ErrorBoundary';
|
|
@@ -81,21 +83,26 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
81
83
|
}
|
|
82
84
|
}, [item]);
|
|
83
85
|
|
|
84
|
-
const getLeftPositionValue = (quantity: number) => {
|
|
85
|
-
if (quantity > 0 && quantity < 10) return '2.5rem';
|
|
86
|
-
else if (quantity > 9 && quantity < 100) return '2.0rem';
|
|
87
|
-
else if (quantity > 99) return '1rem';
|
|
88
|
-
return '2.5rem';
|
|
89
|
-
};
|
|
90
|
-
|
|
91
86
|
const getStackInfo = (itemId: string, stackQty: number) => {
|
|
92
87
|
// if (itemToRender?.isStackable && itemToRender?.stackQty) {
|
|
88
|
+
|
|
89
|
+
const isFractionalStackQty = stackQty % 1 !== 0;
|
|
90
|
+
const isLargerThan999 = stackQty > 999;
|
|
91
|
+
|
|
93
92
|
if (stackQty > 1) {
|
|
94
93
|
return (
|
|
95
|
-
<
|
|
96
|
-
{
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
<ItemQtyContainer key={`qty-${itemId}`}>
|
|
95
|
+
<Ellipsis maxLines={1} maxWidth="48px">
|
|
96
|
+
<ItemQty
|
|
97
|
+
className={
|
|
98
|
+
isFractionalStackQty || isLargerThan999 ? 'small' : 'regular'
|
|
99
|
+
}
|
|
100
|
+
>
|
|
101
|
+
{' '}
|
|
102
|
+
{stackQty}{' '}
|
|
103
|
+
</ItemQty>
|
|
104
|
+
</Ellipsis>
|
|
105
|
+
</ItemQtyContainer>
|
|
99
106
|
);
|
|
100
107
|
}
|
|
101
108
|
return undefined;
|
|
@@ -233,11 +240,22 @@ const Container = styled.div`
|
|
|
233
240
|
position: relative;
|
|
234
241
|
`;
|
|
235
242
|
|
|
236
|
-
|
|
237
|
-
left: string;
|
|
238
|
-
}
|
|
239
|
-
const ItemQty = styled.span<IItemQtyProps>`
|
|
243
|
+
const ItemQtyContainer = styled.div`
|
|
240
244
|
position: relative;
|
|
241
|
-
|
|
242
|
-
|
|
245
|
+
width: 85%;
|
|
246
|
+
height: 16px;
|
|
247
|
+
top: 25px;
|
|
248
|
+
left: 2px;
|
|
249
|
+
|
|
250
|
+
display: flex;
|
|
251
|
+
justify-content: flex-end;
|
|
252
|
+
`;
|
|
253
|
+
|
|
254
|
+
const ItemQty = styled.span`
|
|
255
|
+
&.regular {
|
|
256
|
+
font-size: ${uiFonts.size.small};
|
|
257
|
+
}
|
|
258
|
+
&.small {
|
|
259
|
+
font-size: ${uiFonts.size.xsmall};
|
|
260
|
+
}
|
|
243
261
|
`;
|
|
@@ -51,11 +51,13 @@ export const PropertySelect: React.FC<IPropertySelectProps> = ({
|
|
|
51
51
|
return (
|
|
52
52
|
<Container>
|
|
53
53
|
<TextOverlay>
|
|
54
|
-
<
|
|
55
|
-
<
|
|
56
|
-
{
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
<p>
|
|
55
|
+
<Item>
|
|
56
|
+
<Ellipsis maxLines={1} maxWidth="60%" center>
|
|
57
|
+
{getCurrentSelectionName()}
|
|
58
|
+
</Ellipsis>
|
|
59
|
+
</Item>
|
|
60
|
+
</p>
|
|
59
61
|
</TextOverlay>
|
|
60
62
|
<div className="rpgui-progress-track"></div>
|
|
61
63
|
|
|
@@ -52,9 +52,11 @@ export const TradingItemRow: React.FC<ITradeComponentProps> = ({
|
|
|
52
52
|
</ItemIconContainer>
|
|
53
53
|
<ItemNameContainer>
|
|
54
54
|
<NameValue>
|
|
55
|
-
<
|
|
56
|
-
{
|
|
57
|
-
|
|
55
|
+
<p>
|
|
56
|
+
<Ellipsis maxLines={1} maxWidth="250px">
|
|
57
|
+
{capitalize(traderItem.name)}
|
|
58
|
+
</Ellipsis>
|
|
59
|
+
</p>
|
|
58
60
|
<p>${traderItem.price}</p>
|
|
59
61
|
</NameValue>
|
|
60
62
|
</ItemNameContainer>
|
|
@@ -4,8 +4,9 @@ import styled from 'styled-components';
|
|
|
4
4
|
interface IProps {
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
maxLines: 1 | 2 | 3;
|
|
7
|
-
maxWidth:
|
|
7
|
+
maxWidth: string;
|
|
8
8
|
fontSize?: string;
|
|
9
|
+
center?: boolean;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export const Ellipsis = ({
|
|
@@ -13,29 +14,29 @@ export const Ellipsis = ({
|
|
|
13
14
|
maxLines,
|
|
14
15
|
maxWidth,
|
|
15
16
|
fontSize,
|
|
17
|
+
center,
|
|
16
18
|
}: IProps) => {
|
|
17
19
|
return (
|
|
18
|
-
<Container maxWidth={maxWidth} fontSize={fontSize}>
|
|
19
|
-
<
|
|
20
|
+
<Container maxWidth={maxWidth} fontSize={fontSize} center={center}>
|
|
21
|
+
<div className={`ellipsis-${maxLines}-lines`}>{children}</div>
|
|
20
22
|
</Container>
|
|
21
23
|
);
|
|
22
24
|
};
|
|
23
25
|
|
|
24
26
|
interface IContainerProps {
|
|
25
|
-
maxWidth
|
|
27
|
+
maxWidth?: string;
|
|
26
28
|
fontSize?: string;
|
|
29
|
+
center?: boolean;
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
const Container = styled.div<IContainerProps>`
|
|
30
|
-
p {
|
|
31
|
-
font-size: ${props => props.fontSize || '1rem'};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
33
|
.ellipsis-1-lines {
|
|
35
34
|
white-space: nowrap;
|
|
36
35
|
text-overflow: ellipsis;
|
|
37
36
|
overflow: hidden;
|
|
38
|
-
max-width: ${props => props.maxWidth}
|
|
37
|
+
max-width: ${props => props.maxWidth};
|
|
38
|
+
|
|
39
|
+
${props => props.center && `margin: 0 auto;`}
|
|
39
40
|
}
|
|
40
41
|
.ellipsis-2-lines {
|
|
41
42
|
display: -webkit-box;
|
|
@@ -116,7 +116,7 @@ export const items: IItem[] = [
|
|
|
116
116
|
isEquipable: false,
|
|
117
117
|
isStackable: true,
|
|
118
118
|
maxStackSize: 99,
|
|
119
|
-
stackQty:
|
|
119
|
+
stackQty: 100,
|
|
120
120
|
isUsable: true,
|
|
121
121
|
isStorable: true,
|
|
122
122
|
isTwoHanded: false,
|
|
@@ -148,7 +148,7 @@ export const items: IItem[] = [
|
|
|
148
148
|
allowedEquipSlotType: [ItemSlotType.Inventory],
|
|
149
149
|
isEquipable: false,
|
|
150
150
|
isStackable: true,
|
|
151
|
-
maxStackSize:
|
|
151
|
+
maxStackSize: 100,
|
|
152
152
|
isTwoHanded: false,
|
|
153
153
|
|
|
154
154
|
isUsable: true,
|
|
@@ -181,7 +181,7 @@ export const items: IItem[] = [
|
|
|
181
181
|
allowedEquipSlotType: [ItemSlotType.Inventory],
|
|
182
182
|
isEquipable: false,
|
|
183
183
|
isStackable: true,
|
|
184
|
-
maxStackSize:
|
|
184
|
+
maxStackSize: 100,
|
|
185
185
|
stackQty: 32,
|
|
186
186
|
isUsable: false,
|
|
187
187
|
isStorable: true,
|
|
@@ -214,7 +214,7 @@ export const items: IItem[] = [
|
|
|
214
214
|
allowedEquipSlotType: [ItemSlotType.Inventory],
|
|
215
215
|
isEquipable: false,
|
|
216
216
|
isStackable: true,
|
|
217
|
-
maxStackSize:
|
|
217
|
+
maxStackSize: 100,
|
|
218
218
|
|
|
219
219
|
isUsable: false,
|
|
220
220
|
isStorable: true,
|
|
@@ -250,7 +250,7 @@ export const items: IItem[] = [
|
|
|
250
250
|
allowedEquipSlotType: [ItemSlotType.Accessory],
|
|
251
251
|
isEquipable: true,
|
|
252
252
|
isStackable: true,
|
|
253
|
-
maxStackSize:
|
|
253
|
+
maxStackSize: 100,
|
|
254
254
|
stackQty: 1,
|
|
255
255
|
isUsable: false,
|
|
256
256
|
isStorable: true,
|
|
@@ -284,7 +284,7 @@ export const items: IItem[] = [
|
|
|
284
284
|
allowedEquipSlotType: [ItemSlotType.Accessory],
|
|
285
285
|
isEquipable: true,
|
|
286
286
|
isStackable: true,
|
|
287
|
-
maxStackSize:
|
|
287
|
+
maxStackSize: 100,
|
|
288
288
|
stackQty: 2,
|
|
289
289
|
isUsable: false,
|
|
290
290
|
isStorable: true,
|
|
@@ -318,7 +318,7 @@ export const items: IItem[] = [
|
|
|
318
318
|
allowedEquipSlotType: [ItemSlotType.Accessory],
|
|
319
319
|
isEquipable: true,
|
|
320
320
|
isStackable: true,
|
|
321
|
-
maxStackSize:
|
|
321
|
+
maxStackSize: 100,
|
|
322
322
|
stackQty: 3,
|
|
323
323
|
isUsable: false,
|
|
324
324
|
isStorable: true,
|
|
@@ -352,7 +352,7 @@ export const items: IItem[] = [
|
|
|
352
352
|
allowedEquipSlotType: [ItemSlotType.Accessory],
|
|
353
353
|
isEquipable: true,
|
|
354
354
|
isStackable: true,
|
|
355
|
-
maxStackSize:
|
|
355
|
+
maxStackSize: 100,
|
|
356
356
|
stackQty: 4,
|
|
357
357
|
isUsable: false,
|
|
358
358
|
isStorable: true,
|
|
@@ -386,7 +386,7 @@ export const items: IItem[] = [
|
|
|
386
386
|
allowedEquipSlotType: [ItemSlotType.Accessory],
|
|
387
387
|
isEquipable: true,
|
|
388
388
|
isStackable: true,
|
|
389
|
-
maxStackSize:
|
|
389
|
+
maxStackSize: 100,
|
|
390
390
|
stackQty: 5,
|
|
391
391
|
isUsable: false,
|
|
392
392
|
isStorable: true,
|
|
@@ -420,8 +420,42 @@ export const items: IItem[] = [
|
|
|
420
420
|
allowedEquipSlotType: [],
|
|
421
421
|
isEquipable: true,
|
|
422
422
|
isStackable: true,
|
|
423
|
-
maxStackSize:
|
|
424
|
-
stackQty:
|
|
423
|
+
maxStackSize: 100,
|
|
424
|
+
stackQty: 9999,
|
|
425
|
+
isUsable: false,
|
|
426
|
+
isStorable: true,
|
|
427
|
+
isTwoHanded: false,
|
|
428
|
+
layer: 1,
|
|
429
|
+
isItemContainer: true,
|
|
430
|
+
isSolid: false,
|
|
431
|
+
key: 'gold-coin',
|
|
432
|
+
texturePath: 'others/gold-coin.png',
|
|
433
|
+
textureKey: 'gold-coin',
|
|
434
|
+
name: 'gold-coin',
|
|
435
|
+
generateContainerSlots: 10,
|
|
436
|
+
description: 'You see a coin.',
|
|
437
|
+
attack: 7,
|
|
438
|
+
defense: 3,
|
|
439
|
+
weight: 13,
|
|
440
|
+
tiledId: 67,
|
|
441
|
+
x: 320,
|
|
442
|
+
y: 144,
|
|
443
|
+
scene: 'MainScene',
|
|
444
|
+
fullDescription: 'You see a stone. It is used with slingshot',
|
|
445
|
+
createdAt: '2022-06-04T03:18:09.335Z',
|
|
446
|
+
updatedAt: '2022-06-04T18:16:49.056Z',
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
_id: '392acek4j7c8e80d2fs60404',
|
|
450
|
+
hasUseWith: false,
|
|
451
|
+
type: ItemType.Other,
|
|
452
|
+
subType: ItemSubType.Other,
|
|
453
|
+
textureAtlas: 'items',
|
|
454
|
+
allowedEquipSlotType: [],
|
|
455
|
+
isEquipable: true,
|
|
456
|
+
isStackable: true,
|
|
457
|
+
maxStackSize: 100,
|
|
458
|
+
stackQty: 3.75,
|
|
425
459
|
isUsable: false,
|
|
426
460
|
isStorable: true,
|
|
427
461
|
isTwoHanded: false,
|
|
@@ -466,7 +500,7 @@ export const itemContainerMock: IItemContainer = {
|
|
|
466
500
|
10: items[10],
|
|
467
501
|
11: items[11],
|
|
468
502
|
12: items[12],
|
|
469
|
-
|
|
503
|
+
13: items[13],
|
|
470
504
|
// 14: items[14],
|
|
471
505
|
//remaining slots are considered null by default
|
|
472
506
|
},
|