@rpg-engine/long-bow 0.5.10 → 0.5.12

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.10",
3
+ "version": "0.5.12",
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.74",
86
+ "@rpg-engine/shared": "^0.8.81",
87
87
  "dayjs": "^1.11.2",
88
88
  "font-awesome": "^4.7.0",
89
89
  "fs-extra": "^10.1.0",
@@ -13,7 +13,6 @@ import { ItemQuantitySelector } from './ItemQuantitySelector';
13
13
 
14
14
  import { IPosition } from '../../../types/eventTypes';
15
15
  import ModalPortal from '../../Abstractions/ModalPortal';
16
- import SelectArrow from '../../Arrow/SelectArrow';
17
16
  import { ShortcutsSetter } from '../../Shortcuts/ShortcutsSetter';
18
17
  import { ItemSlot } from './ItemSlot';
19
18
 
@@ -82,15 +81,12 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
82
81
  onPositionChangeEnd,
83
82
  onPositionChangeStart,
84
83
  }) => {
85
- const MAX_SLOTS_PER_PAGE = 20;
86
84
  const [quantitySelect, setQuantitySelect] = useState({
87
85
  isOpen: false,
88
86
  maxQuantity: 1,
89
- callback: (_quantity: number) => { },
87
+ callback: (_quantity: number) => {},
90
88
  });
91
89
  const [settingShortcutIndex, setSettingShortcutIndex] = useState(-1);
92
- const [currentPage, setCurrentPage] = useState(1);
93
- const totalPages = Math.ceil(itemContainer.slotQty / MAX_SLOTS_PER_PAGE);
94
90
 
95
91
  const handleSetShortcut = (item: IItem, index: number) => {
96
92
  if (item.type === ItemType.Consumable || item.type === ItemType.Tool) {
@@ -100,10 +96,8 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
100
96
 
101
97
  const onRenderSlots = () => {
102
98
  const slots = [];
103
- const start = (currentPage - 1) * MAX_SLOTS_PER_PAGE;
104
- const end = start + MAX_SLOTS_PER_PAGE;
105
99
 
106
- for (let i = start; i < end && i < itemContainer.slotQty; i++) {
100
+ for (let i = 0; i < itemContainer.slotQty; i++) {
107
101
  slots.push(
108
102
  <ItemSlot
109
103
  isContextMenuDisabled={disableContextMenu}
@@ -162,14 +156,6 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
162
156
  return slots;
163
157
  };
164
158
 
165
- const goToNextPage = () => {
166
- setCurrentPage(current => Math.min(current + 1, totalPages));
167
- };
168
-
169
- const goToPreviousPage = () => {
170
- setCurrentPage(current => Math.max(current - 1, 1));
171
- };
172
-
173
159
  return (
174
160
  <>
175
161
  <SlotsContainer
@@ -195,28 +181,6 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
195
181
  <ItemsContainer className="item-container-body">
196
182
  {onRenderSlots()}
197
183
  </ItemsContainer>
198
- {totalPages > 1 && (
199
- <ArrowContainer>
200
- <SelectArrow
201
- className='arrow .arrow-up'
202
- direction="left"
203
- onPointerDown={() => {
204
- if (currentPage > 1) {
205
- goToPreviousPage();
206
- }
207
- }}
208
- />
209
- <SelectArrow
210
- className='arrow .arrow-down'
211
- direction="right"
212
- onPointerDown={() => {
213
- if (currentPage < totalPages) {
214
- goToNextPage();
215
- }
216
- }}
217
- />
218
- </ArrowContainer>
219
- )}
220
184
  </SlotsContainer>
221
185
  {quantitySelect.isOpen && (
222
186
  <ModalPortal>
@@ -228,7 +192,7 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
228
192
  setQuantitySelect({
229
193
  isOpen: false,
230
194
  maxQuantity: 1,
231
- callback: () => { },
195
+ callback: () => {},
232
196
  });
233
197
  }}
234
198
  onClose={() => {
@@ -236,7 +200,7 @@ export const ItemContainer: React.FC<IItemContainerProps> = ({
236
200
  setQuantitySelect({
237
201
  isOpen: false,
238
202
  maxQuantity: 1,
239
- callback: () => { },
203
+ callback: () => {},
240
204
  });
241
205
  }}
242
206
  />
@@ -265,17 +229,3 @@ const QuantitySelectorContainer = styled.div`
265
229
  align-items: center;
266
230
  background-color: rgba(0, 0, 0, 0.5);
267
231
  `;
268
-
269
- const ArrowContainer = styled.div`
270
- margin-top: 10px;
271
- margin-bottom: 30px;
272
- /* Aplica a margem ao primeiro span (seta para a esquerda) */
273
- span:first-child {
274
- margin-left: 20px;
275
- }
276
-
277
- /* Aplica a margem ao último span (seta para a direita) */
278
- span:last-child {
279
- margin-right: 20px;
280
- }
281
- `;
@@ -2,6 +2,7 @@ import {
2
2
  getItemTextureKeyPath,
3
3
  IEquipmentSet,
4
4
  ITradeResponseItem,
5
+ UserAccountTypes,
5
6
  } from '@rpg-engine/shared';
6
7
  import capitalize from 'lodash/capitalize';
7
8
  import React from 'react';
@@ -23,6 +24,7 @@ export interface ITradeComponentProps {
23
24
  selectedQty: number;
24
25
  equipmentSet?: IEquipmentSet | null;
25
26
  scale?: number;
27
+ isBuy?: boolean;
26
28
  }
27
29
 
28
30
  const outerQty = 10;
@@ -35,6 +37,7 @@ export const TradingItemRow: React.FC<ITradeComponentProps> = ({
35
37
  selectedQty,
36
38
  equipmentSet,
37
39
  scale,
40
+ isBuy,
38
41
  }) => {
39
42
  const onLeftClick = (qty = 1) => {
40
43
  onQuantityChange(traderItem, Math.max(0, selectedQty - qty));
@@ -47,6 +50,40 @@ export const TradingItemRow: React.FC<ITradeComponentProps> = ({
47
50
  );
48
51
  };
49
52
 
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:
75
+ return (
76
+ <div>
77
+ <SmallCircle color="#002E99" /> Account
78
+ </div>
79
+ );
80
+ default:
81
+ return null;
82
+ }
83
+ }
84
+ return null;
85
+ };
86
+
50
87
  return (
51
88
  <ItemWrapper>
52
89
  <ItemIconContainer>
@@ -81,6 +118,7 @@ export const TradingItemRow: React.FC<ITradeComponentProps> = ({
81
118
  <p>
82
119
  <Ellipsis maxLines={1} maxWidth="250px">
83
120
  {capitalize(traderItem.name)}
121
+ {renderAccountTypeIndicator()}
84
122
  </Ellipsis>
85
123
  </p>
86
124
  <p>${traderItem.price}</p>
@@ -121,6 +159,16 @@ export const TradingItemRow: React.FC<ITradeComponentProps> = ({
121
159
  );
122
160
  };
123
161
 
162
+ // Styled component for the small circle
163
+ const SmallCircle = styled.span<{ color: string }>`
164
+ display: inline-block;
165
+ margin-left: 8px;
166
+ height: 10px;
167
+ width: 10px;
168
+ background-color: ${({ color }) => color};
169
+ border-radius: 50%;
170
+ `;
171
+
124
172
  const StyledArrow = styled(SelectArrow)`
125
173
  margin: 40px;
126
174
  `;
@@ -110,6 +110,7 @@ export const TradingMenu: React.FC<ITradingMenu> = ({
110
110
  selectedQty={qtyMap.get(tradeItem.key) ?? 0}
111
111
  equipmentSet={equipmentSet}
112
112
  scale={scale}
113
+ isBuy={isBuy()}
113
114
  />
114
115
  </ItemWrapper>
115
116
  ))}
@@ -577,7 +577,7 @@ export const itemContainerMock: IItemContainer = {
577
577
  _id: '629ba0b6fe3f43002f58f23b',
578
578
  name: 'Item Container',
579
579
  owner: '629ba0b6fe3f43002f58f23b',
580
- slotQty: 60,
580
+ slotQty: 20,
581
581
  slots: {
582
582
  0: items[0],
583
583
  1: items[1],
@@ -595,7 +595,6 @@ export const itemContainerMock: IItemContainer = {
595
595
  13: items[13],
596
596
  14: items[14],
597
597
  15: items[15],
598
- 21: items[15],
599
598
  //remaining slots are considered null by default
600
599
  },
601
600
  allowedItemTypes: [],