@rpg-engine/long-bow 0.2.92 → 0.2.94
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/long-bow.cjs.development.js +12 -8
- 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 +12 -8
- package/dist/long-bow.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Character/CharacterSelection.tsx +11 -6
- package/src/components/Item/Inventory/ItemSlot.tsx +12 -17
- package/src/mocks/itemContainer.mocks.ts +37 -3
package/package.json
CHANGED
|
@@ -24,12 +24,15 @@ export const CharacterSelection: React.FC<ICharacterSelectionProps> = ({
|
|
|
24
24
|
availableCharacters,
|
|
25
25
|
onChange,
|
|
26
26
|
}) => {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
const randomSort = () => 0.5 - Math.random();
|
|
28
|
+
const propertySelectValues = availableCharacters
|
|
29
|
+
.sort(randomSort)
|
|
30
|
+
.map(item => {
|
|
31
|
+
return {
|
|
32
|
+
id: item.textureKey,
|
|
33
|
+
name: item.name,
|
|
34
|
+
};
|
|
35
|
+
});
|
|
33
36
|
|
|
34
37
|
const [selectedValue, setSelectedValue] = useState<IPropertiesProps>();
|
|
35
38
|
const [selectedSpriteKey, setSelectedSpriteKey] = useState('');
|
|
@@ -38,6 +41,8 @@ export const CharacterSelection: React.FC<ICharacterSelectionProps> = ({
|
|
|
38
41
|
const textureKey = selectedValue ? selectedValue.id : '';
|
|
39
42
|
const spriteKey = textureKey ? textureKey + '/down/standing/0.png' : '';
|
|
40
43
|
|
|
44
|
+
console.log(selectedValue);
|
|
45
|
+
|
|
41
46
|
if (spriteKey === selectedSpriteKey) {
|
|
42
47
|
return;
|
|
43
48
|
}
|
|
@@ -122,23 +122,18 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
122
122
|
}, [dropPosition]);
|
|
123
123
|
|
|
124
124
|
const getStackInfo = (itemId: string, stackQty: number) => {
|
|
125
|
-
// if (itemToRender?.isStackable && itemToRender?.stackQty) {
|
|
126
|
-
|
|
127
125
|
const isFractionalStackQty = stackQty % 1 !== 0;
|
|
128
126
|
const isLargerThan999 = stackQty > 999;
|
|
129
127
|
|
|
128
|
+
let qtyClassName = 'regular';
|
|
129
|
+
if (isLargerThan999) qtyClassName = 'small';
|
|
130
|
+
if (isFractionalStackQty) qtyClassName = 'xsmall';
|
|
131
|
+
|
|
130
132
|
if (stackQty > 1) {
|
|
131
133
|
return (
|
|
132
134
|
<ItemQtyContainer key={`qty-${itemId}`}>
|
|
133
135
|
<Ellipsis maxLines={1} maxWidth="48px">
|
|
134
|
-
<ItemQty
|
|
135
|
-
className={
|
|
136
|
-
isFractionalStackQty || isLargerThan999 ? 'small' : 'regular'
|
|
137
|
-
}
|
|
138
|
-
>
|
|
139
|
-
{' '}
|
|
140
|
-
{stackQty}{' '}
|
|
141
|
-
</ItemQty>
|
|
136
|
+
<ItemQty className={qtyClassName}> {stackQty} </ItemQty>
|
|
142
137
|
</Ellipsis>
|
|
143
138
|
</ItemQtyContainer>
|
|
144
139
|
);
|
|
@@ -284,13 +279,10 @@ export const ItemSlot: React.FC<IProps> = observer(
|
|
|
284
279
|
//@ts-ignore
|
|
285
280
|
const classes: string[] = Array.from(e.target?.classList);
|
|
286
281
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
return elm.includes('rpgui-content');
|
|
293
|
-
});
|
|
282
|
+
const isOutsideDrop =
|
|
283
|
+
classes.some(elm => {
|
|
284
|
+
return elm.includes('rpgui-content');
|
|
285
|
+
}) || classes.length === 0;
|
|
294
286
|
|
|
295
287
|
if (isOutsideDrop) {
|
|
296
288
|
setDropPosition({
|
|
@@ -426,4 +418,7 @@ const ItemQty = styled.span`
|
|
|
426
418
|
&.small {
|
|
427
419
|
font-size: ${uiFonts.size.xsmall};
|
|
428
420
|
}
|
|
421
|
+
&.xsmall {
|
|
422
|
+
font-size: ${uiFonts.size.xxsmall};
|
|
423
|
+
}
|
|
429
424
|
`;
|
|
@@ -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[] = [
|
|
@@ -455,7 +455,7 @@ export const items: IItem[] = [
|
|
|
455
455
|
isEquipable: true,
|
|
456
456
|
isStackable: true,
|
|
457
457
|
maxStackSize: 100,
|
|
458
|
-
stackQty:
|
|
458
|
+
stackQty: 203.23,
|
|
459
459
|
isUsable: false,
|
|
460
460
|
isStorable: true,
|
|
461
461
|
isTwoHanded: false,
|
|
@@ -479,6 +479,40 @@ export const items: IItem[] = [
|
|
|
479
479
|
createdAt: '2022-06-04T03:18:09.335Z',
|
|
480
480
|
updatedAt: '2022-06-04T18:16:49.056Z',
|
|
481
481
|
},
|
|
482
|
+
{
|
|
483
|
+
_id: '392acek4j7casd0d2fs60404',
|
|
484
|
+
hasUseWith: false,
|
|
485
|
+
type: ItemType.Other,
|
|
486
|
+
subType: ItemSubType.Other,
|
|
487
|
+
textureAtlas: 'items',
|
|
488
|
+
allowedEquipSlotType: [],
|
|
489
|
+
isEquipable: true,
|
|
490
|
+
isStackable: true,
|
|
491
|
+
maxStackSize: 100,
|
|
492
|
+
stackQty: 345,
|
|
493
|
+
isUsable: false,
|
|
494
|
+
isStorable: true,
|
|
495
|
+
isTwoHanded: false,
|
|
496
|
+
layer: 1,
|
|
497
|
+
isItemContainer: true,
|
|
498
|
+
isSolid: false,
|
|
499
|
+
key: 'gold-coin',
|
|
500
|
+
texturePath: 'others/gold-coin.png',
|
|
501
|
+
textureKey: 'gold-coin',
|
|
502
|
+
name: 'gold-coin',
|
|
503
|
+
generateContainerSlots: 10,
|
|
504
|
+
description: 'You see a coin.',
|
|
505
|
+
attack: 7,
|
|
506
|
+
defense: 3,
|
|
507
|
+
weight: 13,
|
|
508
|
+
tiledId: 67,
|
|
509
|
+
x: 320,
|
|
510
|
+
y: 144,
|
|
511
|
+
scene: 'MainScene',
|
|
512
|
+
fullDescription: 'You see a stone. It is used with slingshot',
|
|
513
|
+
createdAt: '2022-06-04T03:18:09.335Z',
|
|
514
|
+
updatedAt: '2022-06-04T18:16:49.056Z',
|
|
515
|
+
}
|
|
482
516
|
];
|
|
483
517
|
|
|
484
518
|
export const itemContainerMock: IItemContainer = {
|
|
@@ -501,7 +535,7 @@ export const itemContainerMock: IItemContainer = {
|
|
|
501
535
|
11: items[11],
|
|
502
536
|
12: items[12],
|
|
503
537
|
13: items[13],
|
|
504
|
-
|
|
538
|
+
14: items[14],
|
|
505
539
|
//remaining slots are considered null by default
|
|
506
540
|
},
|
|
507
541
|
allowedItemTypes: [],
|