@rpg-engine/long-bow 0.3.95 → 0.3.96

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.3.95",
3
+ "version": "0.3.96",
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.7.51",
86
+ "@rpg-engine/shared": "^0.7.82",
87
87
  "dayjs": "^1.11.2",
88
88
  "font-awesome": "^4.7.0",
89
89
  "fs-extra": "^10.1.0",
@@ -99,6 +99,16 @@ export const ItemInfo: React.FC<IItemInfoProps> = ({
99
99
  return statistics;
100
100
  };
101
101
 
102
+ const renderEntityEffects = () => {
103
+ if (!item.entityEffects || !item.entityEffectChance) return null;
104
+
105
+ return item.entityEffects.map((effect, index) => (
106
+ <Statistic key={index} $isSpecial>
107
+ {effect[0].toUpperCase() + effect.slice(1)} ({item.entityEffectChance}%)
108
+ </Statistic>
109
+ ));
110
+ };
111
+
102
112
  const renderAvaibleSlots = () => {
103
113
  if (!item.allowedEquipSlotType) return null;
104
114
 
@@ -130,8 +140,26 @@ export const ItemInfo: React.FC<IItemInfoProps> = ({
130
140
  <AllowedSlots>{renderAvaibleSlots()}</AllowedSlots>
131
141
  </Header>
132
142
 
143
+ {item.minRequirements && (
144
+ <LevelRequirement>
145
+ <div>Level: {item.minRequirements.level}</div>
146
+ <div>
147
+ {item.minRequirements.skill.name[0].toUpperCase() +
148
+ item.minRequirements.skill.name.slice(1)}
149
+ : {item.minRequirements.skill.level}
150
+ </div>
151
+ </LevelRequirement>
152
+ )}
153
+
133
154
  {renderStatistics()}
134
- {item.isTwoHanded && <Statistic>Two handed</Statistic>}
155
+ {renderEntityEffects()}
156
+ {item.usableEffectDescription && (
157
+ <Statistic $isSpecial>{item.usableEffectDescription}</Statistic>
158
+ )}
159
+ {item.equippedBuffDescription && (
160
+ <Statistic $isSpecial>{item.equippedBuffDescription}</Statistic>
161
+ )}
162
+ {item.isTwoHanded && <Statistic $isSpecial>Two handed</Statistic>}
135
163
 
136
164
  <Description>{item.description}</Description>
137
165
 
@@ -159,9 +187,9 @@ const Container = styled.div<{ item: IItem }>`
159
187
  font-size: ${uiFonts.size.small};
160
188
  border: 3px solid ${({ item }) => rarityColor(item) ?? uiColors.lightGray};
161
189
  height: max-content;
162
- width: 15rem;
190
+ width: 18rem;
163
191
 
164
- @media (max-width: 580px) {
192
+ @media (max-width: 640px) {
165
193
  width: 80vw;
166
194
  }
167
195
  `;
@@ -189,9 +217,17 @@ const Type = styled.div`
189
217
  color: ${uiColors.lightGray};
190
218
  `;
191
219
 
192
- const Statistic = styled.div`
220
+ const LevelRequirement = styled.div`
221
+ font-size: ${uiFonts.size.small};
222
+ margin-top: 0.2rem;
223
+ margin-bottom: 1rem;
224
+ color: ${uiColors.orange};
225
+ `;
226
+
227
+ const Statistic = styled.div<{ $isSpecial?: boolean }>`
193
228
  margin-bottom: 0.4rem;
194
- width: max-content;
229
+ width: 100%;
230
+ color: ${({ $isSpecial }) => ($isSpecial ? uiColors.darkYellow : 'inherit')};
195
231
 
196
232
  .label {
197
233
  display: inline-block;
@@ -66,7 +66,13 @@ export const ItemInfoDisplay: React.FC<IItemInfoDisplayProps> = ({
66
66
  itemSubTypeCamelCase
67
67
  );
68
68
 
69
- const itemFromEquipment = equipmentSet[slotType] as IItem;
69
+ const itemSubTypeFromEquipment = Object.values(equipmentSet).find(
70
+ item => camelCase(item?.subType ?? '') === itemSubTypeCamelCase
71
+ );
72
+
73
+ const itemFromEquipment = itemSubTypeFromEquipment
74
+ ? itemSubTypeFromEquipment
75
+ : (equipmentSet[slotType] as IItem);
70
76
 
71
77
  if (
72
78
  itemFromEquipment &&
@@ -109,8 +115,9 @@ const Flex = styled.div<{ $isMobile?: boolean }>`
109
115
  display: flex;
110
116
  gap: 0.5rem;
111
117
  flex-direction: ${({ $isMobile }) => ($isMobile ? 'row-reverse' : 'row')};
118
+ align-items: center;
112
119
 
113
- @media (max-width: 580px) {
120
+ @media (max-width: 640px) {
114
121
  flex-direction: column-reverse;
115
122
  align-items: center;
116
123
  }
@@ -113,7 +113,7 @@ const Container = styled.div<{ scale: number }>`
113
113
  animation: fadeOut 0.1s forwards;
114
114
  }
115
115
 
116
- @media (max-width: 580px) {
116
+ @media (max-width: 640px) {
117
117
  flex-direction: column;
118
118
  }
119
119
  `;
@@ -124,7 +124,7 @@ const OptionsContainer = styled.div`
124
124
  gap: 0.5rem;
125
125
  flex-wrap: wrap;
126
126
 
127
- @media (max-width: 580px) {
127
+ @media (max-width: 640px) {
128
128
  flex-direction: row;
129
129
  justify-content: center;
130
130
  }
@@ -143,7 +143,7 @@ const Option = styled.button`
143
143
  background-color: #555;
144
144
  }
145
145
 
146
- @media (max-width: 580px) {
146
+ @media (max-width: 640px) {
147
147
  padding: 1rem 0.5rem;
148
148
  }
149
149
  `;
@@ -15,6 +15,6 @@ export const uiColors = {
15
15
  blue: '#597DCE',
16
16
  darkBlue: '#30346D',
17
17
  brown: '#854C30',
18
- lightGreen: '#88ed1c',
18
+ lightGreen: '#66cd1c',
19
19
  brownGreen: '#346524',
20
20
  };
@@ -383,7 +383,7 @@ export const equipmentSetMock: IEquipmentSet = {
383
383
  legs: undefined,
384
384
  boot: items.boot,
385
385
  leftHand: items.leftHand,
386
- rightHand: undefined,
386
+ rightHand: items.rightHand,
387
387
  neck: undefined,
388
388
  ring: undefined,
389
389
  accessory: items.accessory,
@@ -42,6 +42,16 @@ export const items: IItem[] = [
42
42
  createdAt: '2022-06-04T03:18:09.335Z',
43
43
  updatedAt: '2022-06-04T18:16:49.056Z',
44
44
  rarity: ItemRarities.Legendary,
45
+ minRequirements: {
46
+ level: 10,
47
+ skill: {
48
+ name: 'sword',
49
+ level: 5,
50
+ }
51
+ },
52
+ equippedBuffDescription: "Character speed +10%",
53
+ entityEffectChance: 50,
54
+ entityEffects: ['freezing']
45
55
  },
46
56
  {
47
57
  _id: '629acef1c7c8e8002ff73564',
@@ -530,6 +540,37 @@ export const items: IItem[] = [
530
540
  updatedAt: '2022-06-04T18:16:49.056Z',
531
541
  rarity: ItemRarities.Common,
532
542
  },
543
+ {
544
+ "type": ItemType.Consumable,
545
+ "subType": ItemSubType.Food,
546
+ "rarity": "Common",
547
+ "textureAtlas": "items",
548
+ "allowedEquipSlotType": [],
549
+ "maxStackSize": 100,
550
+ "isUsable": false,
551
+ "isStorable": true,
552
+ "isItemContainer": false,
553
+ "isSolid": false,
554
+ "requiredAmmoKeys": [],
555
+ "isTwoHanded": false,
556
+ "hasUseWith": false,
557
+ "entityEffects": [],
558
+ "entityEffectChance": 0,
559
+ "_id": "64529049d45546003b2c6c6d",
560
+ "key": "apple",
561
+ "texturePath": "foods/apple.png",
562
+ textureKey: 'apple',
563
+ isEquipable: false,
564
+ isStackable: true,
565
+ "name": "Apple",
566
+ "description": "A red apple.",
567
+ "weight": 0.05,
568
+ "stackQty": 16,
569
+ "attack": 0,
570
+ "defense": 0,
571
+ fullDescription: "",
572
+ usableEffectDescription: "Regenerates 10 HP and Mana 5 times"
573
+ }
533
574
  ];
534
575
 
535
576
  export const itemContainerMock: IItemContainer = {
@@ -553,6 +594,7 @@ export const itemContainerMock: IItemContainer = {
553
594
  12: items[12],
554
595
  13: items[13],
555
596
  14: items[14],
597
+ 15: items[15],
556
598
  //remaining slots are considered null by default
557
599
  },
558
600
  allowedItemTypes: [],