@rpg-engine/long-bow 0.4.87 → 0.4.89

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.4.87",
3
+ "version": "0.4.89",
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.42",
86
+ "@rpg-engine/shared": "^0.8.35",
87
87
  "dayjs": "^1.11.2",
88
88
  "font-awesome": "^4.7.0",
89
89
  "fs-extra": "^10.1.0",
package/src/.DS_Store ADDED
Binary file
Binary file
@@ -1,15 +1,21 @@
1
+ import { ICharacterPartyShared } from '@rpg-engine/shared';
1
2
  import React from 'react';
2
3
  import styled from 'styled-components';
3
4
  import { uiColors } from '../../../constants/uiColors';
4
5
  import { DraggableContainer } from '../../DraggableContainer';
5
6
  import { RPGUIContainerTypes } from '../../RPGUIContainer';
6
- import { IPartyManagerRowProps, PartyManagerRow } from './PartyManagerRows';
7
+ import { PartyManagerRow } from './PartyManagerRows';
7
8
 
8
9
  export interface IPartyManagerProps {
9
- partyRows: IPartyManagerRowProps[];
10
+ partyRows: ICharacterPartyShared | null;
11
+ isLeader: boolean;
12
+ onClose?: () => void;
10
13
  }
11
14
 
12
- export const PartyManager: React.FC<IPartyManagerProps> = ({ partyRows }) => {
15
+ export const PartyManager: React.FC<IPartyManagerProps> = ({
16
+ partyRows,
17
+ isLeader,
18
+ }) => {
13
19
  return (
14
20
  <DraggableContainer
15
21
  type={RPGUIContainerTypes.Framed}
@@ -27,15 +33,34 @@ export const PartyManager: React.FC<IPartyManagerProps> = ({ partyRows }) => {
27
33
  </div>
28
34
  </Wrapper>
29
35
  <RowsWrapper className="partyRows">
30
- {partyRows.map(partyRows => (
31
- <PartyManagerRow
32
- key={partyRows.id}
33
- charName={partyRows.charName}
34
- charClass={partyRows.charClass}
35
- charLevel={partyRows.charLevel}
36
- id={partyRows.id}
37
- />
38
- ))}
36
+ {partyRows ? (
37
+ <>
38
+ <PartyManagerRow
39
+ key={partyRows.leader._id}
40
+ id={partyRows.leader._id}
41
+ charName={partyRows.leader.name}
42
+ charClass={partyRows.leader.class}
43
+ isLeader={isLeader}
44
+ isLeaderRow={true}
45
+ />
46
+ {partyRows.members.map(partyRows => (
47
+ <PartyManagerRow
48
+ key={partyRows._id}
49
+ charName={partyRows.name}
50
+ charClass={partyRows.class}
51
+ id={partyRows._id}
52
+ isLeader={isLeader}
53
+ />
54
+ ))}
55
+ </>
56
+ ) : (
57
+ <>
58
+ <NotinParty>
59
+ You are not in party. <br />
60
+ Please create a new party
61
+ </NotinParty>
62
+ </>
63
+ )}
39
64
  </RowsWrapper>
40
65
  </DraggableContainer>
41
66
  );
@@ -55,3 +80,8 @@ const Title = styled.h1`
55
80
  font-size: 0.6rem;
56
81
  color: ${uiColors.yellow} !important;
57
82
  `;
83
+
84
+ const NotinParty = styled.h1`
85
+ font-size: 0.6rem;
86
+ margin: auto;
87
+ `;
@@ -7,23 +7,28 @@ export interface IPartyManagerRowProps {
7
7
  id: string;
8
8
  charName: string;
9
9
  charClass: string;
10
- charLevel: number;
10
+ isLeader: boolean;
11
+ isLeaderRow?: boolean;
11
12
  }
12
13
 
13
14
  export const PartyManagerRow: React.FC<IPartyManagerRowProps> = ({
14
15
  charName,
15
16
  charClass,
16
- charLevel,
17
+ isLeader,
18
+ isLeaderRow,
17
19
  }) => {
18
20
  return (
19
21
  <PartyWrapper>
20
22
  <TextContainer>{charName}</TextContainer>
21
23
  <TextContainer>{charClass}</TextContainer>
22
- <TextContainer>{charLevel}</TextContainer>
23
24
  <div className="cancel-button">
24
- <Button buttonType={ButtonTypes.RPGUIButton}>Remove</Button>
25
+ <Button buttonType={ButtonTypes.RPGUIButton} disabled={!isLeader}>
26
+ {isLeaderRow ? 'Leader' : 'Remove'}
27
+ </Button>
25
28
  </div>
26
- <Button buttonType={ButtonTypes.RPGUIButton}>New Leader</Button>
29
+ <Button buttonType={ButtonTypes.RPGUIButton} disabled={!isLeader}>
30
+ New Leader
31
+ </Button>
27
32
  </PartyWrapper>
28
33
  );
29
34
  };
@@ -1,3 +1,4 @@
1
+ import { CharacterClass, ICharacterPartyShared } from '@rpg-engine/shared';
1
2
  import { v4 as uuidv4 } from 'uuid';
2
3
  import { IPartyRowProps } from '../PartyDashboard/PartyRows';
3
4
  import { IPlayersRowProps } from '../PartyInvite';
@@ -78,6 +79,23 @@ export const mockedPartyRows: IPartyRowProps[] = [
78
79
  },
79
80
  ];
80
81
 
82
+ export const mockedPlayersRows2: ICharacterPartyShared = {
83
+ id: uuidv4(),
84
+ leader: {
85
+ _id: uuidv4(),
86
+ class: CharacterClass.Druid,
87
+ name: 'leader',
88
+ },
89
+ members: [
90
+ { _id: uuidv4(), class: CharacterClass.Druid, name: 'blblb' },
91
+ { _id: uuidv4(), class: CharacterClass.Druid, name: 'blblb' },
92
+ { _id: uuidv4(), class: CharacterClass.Druid, name: 'blblb' },
93
+ { _id: uuidv4(), class: CharacterClass.Druid, name: 'blblb' },
94
+ ],
95
+ maxSize: 5,
96
+ size: 4,
97
+ };
98
+
81
99
  export const mockedPlayersRows: IPlayersRowProps[] = [
82
100
  {
83
101
  id: uuidv4(),
@@ -121,30 +139,30 @@ export const mockedPartyManager: IPartyManagerRowProps[] = [
121
139
  id: uuidv4(),
122
140
  charName: 'CharNome',
123
141
  charClass: 'CharClass',
124
- charLevel: 1,
142
+ isLeader: false,
125
143
  },
126
144
  {
127
145
  id: uuidv4(),
128
146
  charName: 'CharNome',
129
147
  charClass: 'CharClass',
130
- charLevel: 1,
148
+ isLeader: false,
131
149
  },
132
150
  {
133
151
  id: uuidv4(),
134
152
  charName: 'CharNome',
135
153
  charClass: 'CharClass',
136
- charLevel: 1,
154
+ isLeader: false,
137
155
  },
138
156
  {
139
157
  id: uuidv4(),
140
158
  charName: 'CharNome',
141
159
  charClass: 'CharClass',
142
- charLevel: 1,
160
+ isLeader: false,
143
161
  },
144
162
  {
145
163
  id: uuidv4(),
146
164
  charName: 'CharNome',
147
165
  charClass: 'CharClass',
148
- charLevel: 1,
166
+ isLeader: false,
149
167
  },
150
168
  ];
@@ -37,14 +37,11 @@ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
37
37
  skillPointsToNextLevel = getSPForLevel(level + 1);
38
38
  }
39
39
 
40
- const skillsBuffsCalc = (level: number, buffAndDebuff: number): string => {
41
- const result = level * (buffAndDebuff / 100);
42
-
43
- if (result > 0) {
44
- return `+${result.toFixed(2)}`;
45
- } else {
46
- return `${result.toFixed(2)}`;
40
+ const skillsBuffsCalc = () => {
41
+ if (buffAndDebuff) {
42
+ return 1 + buffAndDebuff / 100;
47
43
  }
44
+ return;
48
45
  };
49
46
 
50
47
  return (
@@ -57,7 +54,7 @@ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
57
54
  <TitleNameContainer>
58
55
  <TitleNameBuff>{skillName}</TitleNameBuff>
59
56
  <TitleNameBuff>
60
- lv {level} ({skillsBuffsCalc(level, buffAndDebuff)})
57
+ lv {level} ({skillsBuffsCalc()})
61
58
  </TitleNameBuff>
62
59
  </TitleNameContainer>
63
60
  <TitleNameBuffContainer>
@@ -69,7 +66,7 @@ export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
69
66
  <TitleNameContainer>
70
67
  <TitleNameDebuff>{skillName}</TitleNameDebuff>
71
68
  <TitleNameDebuff>
72
- lv {level} ({skillsBuffsCalc(level, buffAndDebuff)})
69
+ lv {level} ({skillsBuffsCalc()})
73
70
  </TitleNameDebuff>
74
71
  </TitleNameContainer>
75
72
  <div>
Binary file
Binary file
@@ -1,10 +1,10 @@
1
1
  import { Meta, Story } from '@storybook/react';
2
2
  import React from 'react';
3
+ import { mockedPlayersRows2 } from '../components/PartySystem';
3
4
  import {
4
5
  IPartyManagerProps,
5
6
  PartyManager,
6
7
  } from '../components/PartySystem/PartyManager/PartyManager';
7
- import { mockedPartyManager } from '../components/PartySystem/mockedConstantes/mockedValues';
8
8
  import { RPGUIRoot } from '../components/RPGUIRoot';
9
9
 
10
10
  const meta: Meta = {
@@ -23,5 +23,5 @@ const Template: Story<IPartyManagerProps> = args => (
23
23
  export const Default = Template.bind({});
24
24
 
25
25
  Default.args = {
26
- partyRows: mockedPartyManager,
26
+ partyRows: mockedPlayersRows2,
27
27
  };