@rpg-engine/long-bow 0.5.12 → 0.5.14

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.5.12",
3
+ "version": "0.5.14",
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.8.81",
86
+ "@rpg-engine/shared": "^0.8.83",
87
87
  "dayjs": "^1.11.2",
88
88
  "font-awesome": "^4.7.0",
89
89
  "fs-extra": "^10.1.0",
@@ -23,6 +23,7 @@ export const mockSpells: ISpell[] = [
23
23
  targetHitAnimationKey: AnimationEffectKeys.Rooted,
24
24
  projectileAnimationKey: AnimationEffectKeys.Energy,
25
25
  usableEffect: () => {},
26
+ onlyPremiumAccountType: [],
26
27
  },
27
28
  {
28
29
  key: (SpellsBlueprint.ArrowCreationSpell + '2') as SpellsBlueprint,
@@ -41,6 +42,7 @@ export const mockSpells: ISpell[] = [
41
42
  targetHitAnimationKey: AnimationEffectKeys.Rooted,
42
43
  projectileAnimationKey: AnimationEffectKeys.Energy,
43
44
  usableEffect: () => {},
45
+ onlyPremiumAccountType: [],
44
46
  },
45
47
  {
46
48
  key: (SpellsBlueprint.ArrowCreationSpell + '3') as SpellsBlueprint,
@@ -59,6 +61,7 @@ export const mockSpells: ISpell[] = [
59
61
  targetHitAnimationKey: AnimationEffectKeys.Rooted,
60
62
  projectileAnimationKey: AnimationEffectKeys.Energy,
61
63
  usableEffect: () => {},
64
+ onlyPremiumAccountType: [],
62
65
  },
63
66
  {
64
67
  key: (SpellsBlueprint.ArrowCreationSpell + '4') as SpellsBlueprint,
@@ -77,6 +80,7 @@ export const mockSpells: ISpell[] = [
77
80
  targetHitAnimationKey: AnimationEffectKeys.Rooted,
78
81
  projectileAnimationKey: AnimationEffectKeys.Energy,
79
82
  usableEffect: () => {},
83
+ onlyPremiumAccountType: [],
80
84
  },
81
85
  {
82
86
  key: (SpellsBlueprint.ArrowCreationSpell + '5') as SpellsBlueprint,
@@ -95,5 +99,6 @@ export const mockSpells: ISpell[] = [
95
99
  targetHitAnimationKey: AnimationEffectKeys.Rooted,
96
100
  projectileAnimationKey: AnimationEffectKeys.Energy,
97
101
  usableEffect: () => {},
102
+ onlyPremiumAccountType: [],
98
103
  },
99
104
  ];
@@ -51,35 +51,41 @@ export const TradingItemRow: React.FC<ITradeComponentProps> = ({
51
51
  };
52
52
 
53
53
  const renderAccountTypeIndicator = () => {
54
- if (isBuy) {
55
- switch (traderItem?.accountType) {
56
- case UserAccountTypes.PremiumBronze:
57
- return (
58
- <div>
59
- <SmallCircle color="#CD7F32" /> Account
60
- </div>
61
- );
62
- case UserAccountTypes.PremiumSilver:
63
- return (
64
- <div>
65
- <SmallCircle color="#C0C0C0" /> Account
66
- </div>
67
- );
68
- case UserAccountTypes.PremiumGold:
69
- return (
70
- <div>
71
- <SmallCircle color="#FFD700" /> Account
72
- </div>
73
- );
74
- case UserAccountTypes.PremiumUltimate:
54
+ if (isBuy && traderItem.canBePurchasedOnlyByPremiumPlans) {
55
+ return traderItem.canBePurchasedOnlyByPremiumPlans.map(accountType => {
56
+ if (accountType !== UserAccountTypes.Free) {
57
+ let backgroundColor;
58
+ let textColor = 'black';
59
+
60
+ switch (accountType) {
61
+ case UserAccountTypes.PremiumBronze:
62
+ backgroundColor = '#CD7F32';
63
+ break;
64
+ case UserAccountTypes.PremiumSilver:
65
+ backgroundColor = '#C0C0C0';
66
+ break;
67
+ case UserAccountTypes.PremiumGold:
68
+ backgroundColor = '#FFD700';
69
+ break;
70
+ case UserAccountTypes.PremiumUltimate:
71
+ backgroundColor = '#002E99';
72
+ break;
73
+ default:
74
+ return null;
75
+ }
76
+
75
77
  return (
76
- <div>
77
- <SmallCircle color="#002E99" /> Account
78
- </div>
78
+ <PremiumLabel
79
+ backgroundColor={backgroundColor}
80
+ textColor={textColor}
81
+ key={accountType}
82
+ >
83
+ {capitalize(accountType) + ' PA'}
84
+ </PremiumLabel>
79
85
  );
80
- default:
81
- return null;
82
- }
86
+ }
87
+ return null;
88
+ });
83
89
  }
84
90
  return null;
85
91
  };
@@ -118,10 +124,10 @@ export const TradingItemRow: React.FC<ITradeComponentProps> = ({
118
124
  <p>
119
125
  <Ellipsis maxLines={1} maxWidth="250px">
120
126
  {capitalize(traderItem.name)}
121
- {renderAccountTypeIndicator()}
122
127
  </Ellipsis>
123
128
  </p>
124
129
  <p>${traderItem.price}</p>
130
+ <p>{renderAccountTypeIndicator()}</p>
125
131
  </NameValue>
126
132
  </ItemNameContainer>
127
133
  <QuantityContainer>
@@ -159,14 +165,18 @@ export const TradingItemRow: React.FC<ITradeComponentProps> = ({
159
165
  );
160
166
  };
161
167
 
162
- // Styled component for the small circle
163
- const SmallCircle = styled.span<{ color: string }>`
168
+ const PremiumLabel = styled.span<{
169
+ backgroundColor: string;
170
+ textColor: string;
171
+ }>`
172
+ background-color: ${({ backgroundColor }) => backgroundColor};
173
+ color: ${({ textColor }) => textColor};
174
+ font-weight: bold;
175
+ padding: 2px 5px;
176
+ border-radius: 5px;
177
+ margin-right: 5px;
178
+ margin-bottom: 5px;
164
179
  display: inline-block;
165
- margin-left: 8px;
166
- height: 10px;
167
- width: 10px;
168
- background-color: ${({ color }) => color};
169
- border-radius: 50%;
170
180
  `;
171
181
 
172
182
  const StyledArrow = styled(SelectArrow)`
@@ -5,6 +5,7 @@ import {
5
5
  ItemSlotType,
6
6
  ItemSubType,
7
7
  ItemType,
8
+ UserAccountTypes,
8
9
  } from '@rpg-engine/shared';
9
10
 
10
11
  export const items: IItem[] = [
@@ -42,16 +43,20 @@ export const items: IItem[] = [
42
43
  createdAt: '2022-06-04T03:18:09.335Z',
43
44
  updatedAt: '2022-06-04T18:16:49.056Z',
44
45
  rarity: ItemRarities.Legendary,
46
+ canBePurchasedOnlyByPremiumPlans: [
47
+ UserAccountTypes.PremiumGold,
48
+ UserAccountTypes.PremiumUltimate,
49
+ ],
45
50
  minRequirements: {
46
51
  level: 10,
47
52
  skill: {
48
53
  name: 'sword',
49
54
  level: 5,
50
- }
55
+ },
51
56
  },
52
- equippedBuffDescription: "Character speed +10%",
57
+ equippedBuffDescription: 'Character speed +10%',
53
58
  entityEffectChance: 50,
54
- entityEffects: ['freezing']
59
+ entityEffects: ['freezing'],
55
60
  },
56
61
  {
57
62
  _id: '629acef1c7c8e8002ff73564',
@@ -541,36 +546,36 @@ export const items: IItem[] = [
541
546
  rarity: ItemRarities.Common,
542
547
  },
543
548
  {
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",
549
+ type: ItemType.Consumable,
550
+ subType: ItemSubType.Food,
551
+ rarity: 'Common',
552
+ textureAtlas: 'items',
553
+ allowedEquipSlotType: [],
554
+ maxStackSize: 100,
555
+ isUsable: false,
556
+ isStorable: true,
557
+ isItemContainer: false,
558
+ isSolid: false,
559
+ requiredAmmoKeys: [],
560
+ isTwoHanded: false,
561
+ hasUseWith: false,
562
+ entityEffects: [],
563
+ entityEffectChance: 0,
564
+ _id: '64529049d45546003b2c6c6d',
565
+ key: 'apple',
566
+ texturePath: 'foods/apple.png',
562
567
  textureKey: 'apple',
563
568
  isEquipable: false,
564
569
  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
- }
570
+ name: 'Apple',
571
+ description: 'A red apple.',
572
+ weight: 0.05,
573
+ stackQty: 16,
574
+ attack: 0,
575
+ defense: 0,
576
+ fullDescription: '',
577
+ usableEffectDescription: 'Regenerates 10 HP and Mana 5 times',
578
+ },
574
579
  ];
575
580
 
576
581
  export const itemContainerMock: IItemContainer = {