@rpg-engine/long-bow 0.2.36 → 0.2.38

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.2.36",
3
+ "version": "0.2.38",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -2,7 +2,6 @@ import { ITradeResponseItem } from '@rpg-engine/shared';
2
2
  import capitalize from 'lodash/capitalize';
3
3
  import React, { useState } from 'react';
4
4
  import styled from 'styled-components';
5
- import { v4 as uuidv4 } from 'uuid';
6
5
  import { colors } from '../../constants/uiColors';
7
6
  import SelectArrow from '../Arrow/SelectArrow';
8
7
  import { Ellipsis } from '../shared/Ellipsis';
@@ -28,7 +27,6 @@ export const TradingItemRow: React.FC<ITradeComponentProps> = ({
28
27
  setItemQuantity(newQuantity);
29
28
  updateChartTotals({
30
29
  key: traderItem.key,
31
- itemId: traderItem.itemId ? traderItem.itemId : uuidv4(),
32
30
  qty: newQuantity,
33
31
  price: traderItem.price,
34
32
  texturePath: traderItem.texturePath,
@@ -42,7 +40,6 @@ export const TradingItemRow: React.FC<ITradeComponentProps> = ({
42
40
  setItemQuantity(newQuantity);
43
41
  updateChartTotals({
44
42
  key: traderItem.key,
45
- itemId: traderItem.itemId ? traderItem.itemId : uuidv4(),
46
43
  qty: newQuantity,
47
44
  price: traderItem.price,
48
45
  texturePath: traderItem.texturePath,
@@ -8,6 +8,7 @@ import { TradingItemRow } from './TradingItemRow';
8
8
  export interface ITrandingMenu {
9
9
  traderItems: ITradeResponseItem[];
10
10
  onClose: () => void;
11
+ onConfirm: () => void;
11
12
  type: TradeTransactionType;
12
13
  atlasJSON: any;
13
14
  atlasIMG: any;
@@ -23,12 +24,13 @@ export const TradingMenu: React.FC<ITrandingMenu> = ({
23
24
  atlasIMG,
24
25
  characterAvailableGold,
25
26
  onChangeTraderItems,
27
+ onConfirm,
26
28
  }) => {
27
29
  const [sum, setSum] = useState(0);
28
30
  let newSumArray = 0;
29
31
  const updateChartTotals = (item: ITradeResponseItem) => {
30
32
  const itemIndex = traderItems.findIndex(
31
- itemArray => itemArray.itemId === item.itemId
33
+ itemArray => itemArray.key === item.key
32
34
  );
33
35
  traderItems[itemIndex] = item;
34
36
 
@@ -96,10 +98,16 @@ export const TradingMenu: React.FC<ITrandingMenu> = ({
96
98
  <Button
97
99
  buttonType={ButtonTypes.RPGUIButton}
98
100
  disabled={sum > characterAvailableGold}
101
+ onClick={() => onConfirm()}
99
102
  >
100
103
  Confirm
101
104
  </Button>
102
- <Button buttonType={ButtonTypes.RPGUIButton}>Cancel</Button>
105
+ <Button
106
+ buttonType={ButtonTypes.RPGUIButton}
107
+ onClick={() => onClose()}
108
+ >
109
+ Cancel
110
+ </Button>
103
111
  </ButtonWrapper>
104
112
  </>
105
113
  </DraggableContainer>
@@ -1,84 +1,36 @@
1
1
  import { ITradeResponseItem } from '@rpg-engine/shared';
2
+
3
+ export enum SwordsBlueprint {
4
+ ShortSword = "short-sword",
5
+ BasiliskSword = "basilisk-sword",
6
+ DragonsSword = "dragon's-sword",
7
+ DoubleEdgedSword = "double-edged-sword",
8
+ BroadSword = "broad-sword",
9
+ ElvenSword = "elven-sword",
10
+ FireSword = "fire-sword",
11
+ Katana = "katana",
12
+ KnightsSword = "knights-sword",
13
+ IceSword = "ice-sword",
14
+ }
15
+
2
16
  export const itemMock: ITradeResponseItem[] = [
3
17
  {
4
18
  texturePath: 'swords/broad-sword.png',
5
19
  name: 'Silver Short Sword Premium',
6
20
  price: 100,
7
- key: 'Short sword',
21
+ key: SwordsBlueprint.IceSword,
8
22
  },
9
23
  {
10
24
  texturePath: "swords/corruption-sword.png",
11
25
  name: 'Short sword Best',
12
26
  price: 100,
13
- key: 'Short sword',
27
+ key: SwordsBlueprint.DragonsSword,
14
28
  },
15
29
  {
16
30
  texturePath: 'swords/broad-sword.png',
17
31
  name: 'Short sword Trade',
18
32
  price: 100,
19
- key: 'Short sword',
20
- },
21
- {
22
- texturePath: 'swords/broad-sword.png',
23
- name: 'Short sword',
24
- price: 100,
25
- key: 'Short sword',
26
- },
27
- {
28
- texturePath: 'swords/broad-sword.png',
29
- itemId: 'itemId01',
30
- name: 'Short sword',
31
- price: 100,
32
- key: 'Short sword',
33
+ key: SwordsBlueprint.FireSword,
33
34
  },
34
- {
35
- texturePath: 'swords/broad-sword.png',
36
- itemId: 'itemId02',
37
- name: 'Short sword',
38
- price: 100,
39
- key: 'Short sword',
40
- },
41
- {
42
- texturePath: 'swords/broad-sword.png',
43
- itemId: 'itemId03',
44
- name: 'Short sword',
45
- price: 100,
46
- key: 'Short sword',
47
- },
48
- {
49
- texturePath: 'swords/broad-sword.png',
50
- itemId: 'itemId01',
51
- name: 'Short sword',
52
- price: 100,
53
- key: 'Short sword',
54
- },
55
- {
56
- texturePath: 'swords/broad-sword.png',
57
- itemId: 'itemId02',
58
- name: 'Short sword',
59
- price: 100,
60
- key: 'Short sword',
61
- },
62
- {
63
- texturePath: 'swords/broad-sword.png',
64
- itemId: 'itemId03',
65
- name: 'Short sword',
66
- price: 100,
67
- key: 'Short sword',
68
- },
69
- {
70
- texturePath: 'swords/broad-sword.png',
71
- itemId: 'itemId01',
72
- name: 'Short sword',
73
- price: 100,
74
- key: 'Short sword',
75
- },
76
- {
77
- texturePath: 'swords/broad-sword.png',
78
- itemId: 'itemId02',
79
- name: 'Short sword',
80
- price: 100,
81
- key: 'Short sword',
82
- },
83
-
35
+
84
36
  ];