@rpg-engine/long-bow 0.3.46 → 0.3.48

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.
@@ -0,0 +1,5 @@
1
+ import { Meta } from '@storybook/react';
2
+ import { ICharacterStatusProps } from '../components/CharacterStatus/CharacterStatus';
3
+ declare const meta: Meta;
4
+ export default meta;
5
+ export declare const Default: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, ICharacterStatusProps>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rpg-engine/long-bow",
3
- "version": "0.3.46",
3
+ "version": "0.3.48",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -83,11 +83,10 @@
83
83
  },
84
84
  "dependencies": {
85
85
  "@rollup/plugin-image": "^2.1.1",
86
- "@rpg-engine/shared": "^0.6.80",
86
+ "@rpg-engine/shared": "^0.6.82",
87
87
  "dayjs": "^1.11.2",
88
88
  "font-awesome": "^4.7.0",
89
89
  "fs-extra": "^10.1.0",
90
- "is-mobile": "^3.1.1",
91
90
  "lodash": "^4.17.21",
92
91
  "lodash-es": "^4.17.21",
93
92
  "mobx": "^6.6.0",
@@ -0,0 +1,120 @@
1
+ import React, { useState } from 'react';
2
+ import styled from 'styled-components';
3
+ import { uiColors } from '../../constants/uiColors';
4
+ import { ProgressBar } from '../ProgressBar';
5
+ import Character from './Character.png';
6
+
7
+ export interface ICharacterStatusProps {
8
+ healthValue: number;
9
+ healthMaxValue: number;
10
+ manaValue: number;
11
+ manaMaxValue: number;
12
+ charName: string;
13
+ }
14
+
15
+ export const CharacterStatus: React.FC<ICharacterStatusProps> = ({
16
+ healthValue,
17
+ healthMaxValue,
18
+ manaValue,
19
+ manaMaxValue,
20
+ charName,
21
+ }) => {
22
+ const [buff] = useState<Boolean>(false);
23
+ return (
24
+ <StatusContainer>
25
+ <ImgContainer
26
+ style={{
27
+ background: `url(${Character})`,
28
+ backgroundPositionX: 'center',
29
+ }}
30
+ />
31
+ <StatusFlexContainer>
32
+ <div>
33
+ <CharNameContainer>{charName}</CharNameContainer>
34
+ <ProgressContainer>
35
+ <StyledProgressBar
36
+ max={healthMaxValue}
37
+ value={healthValue}
38
+ color={'red'}
39
+ minWidth={200}
40
+ />
41
+ <StyledProgressBar
42
+ max={manaMaxValue}
43
+ value={manaValue}
44
+ color={'blue'}
45
+ minWidth={200}
46
+ />
47
+ </ProgressContainer>
48
+ </div>
49
+ {buff && (
50
+ <BuffCircleContainer>
51
+ <BuffCircle />
52
+ <BuffCircle />
53
+ <BuffCircle />
54
+ <BuffCircle />
55
+ <BuffCircle />
56
+ <BuffCircle />
57
+ <BuffCircle />
58
+ <BuffCircle />
59
+ <BuffCircle />
60
+ <BuffCircle />
61
+ </BuffCircleContainer>
62
+ )}
63
+ </StatusFlexContainer>
64
+ </StatusContainer>
65
+ );
66
+ };
67
+
68
+ const CharNameContainer = styled.div`
69
+ color: black;
70
+ margin: auto;
71
+ display: flex;
72
+ justify-content: space-around;
73
+ background-color: rgba(117, 113, 97, 0.3);
74
+ align-items: center;
75
+ height: 30px;
76
+ border-radius: 10px;
77
+ `;
78
+
79
+ const StatusContainer = styled.div`
80
+ display: flex;
81
+ scale: 0.7;
82
+ `;
83
+
84
+ const ProgressContainer = styled.div`
85
+ display: flex;
86
+ flex-direction: row;
87
+ `;
88
+
89
+ const StyledProgressBar = styled(ProgressBar)`
90
+ .rpgui-progress-left-edge,
91
+ .rpgui-progress-right-edge {
92
+ width: 20px;
93
+ }
94
+ `;
95
+
96
+ const ImgContainer = styled.div`
97
+ width: 4.3rem;
98
+ height: 4.3rem;
99
+ border: 2px solid ${uiColors.darkGray};
100
+ border-radius: 50%;
101
+ border-radius: 50%;
102
+ margin-right: 8px;
103
+ `;
104
+
105
+ const BuffCircle = styled.div`
106
+ width: 2rem;
107
+ height: 2rem;
108
+ background-color: ${uiColors.lightGray};
109
+ border: 2px solid ${uiColors.darkGray};
110
+ border-radius: 50%;
111
+ `;
112
+
113
+ const StatusFlexContainer = styled.div``;
114
+
115
+ const BuffCircleContainer = styled.div`
116
+ display: flex;
117
+ div {
118
+ margin: 2px;
119
+ }
120
+ `;
@@ -115,6 +115,7 @@ export const Chat: React.FC<IChatProps> = ({
115
115
  onFocus={onFocus}
116
116
  onBlur={onBlur}
117
117
  onTouchStart={onFocus}
118
+ autoFocus
118
119
  />
119
120
  </Column>
120
121
  <Column justifyContent="flex-end">
@@ -111,28 +111,33 @@ export const CraftBook: React.FC<IItemCraftSelectorProps> = ({
111
111
  />
112
112
  </SpriteAtlasWrapper>
113
113
  <div>
114
- <input
115
- className="rpgui-radio"
116
- type="radio"
117
- value={option.name}
118
- name="test"
119
- disabled={!option.canCraft}
120
- checked={craftItem === option.key}
121
- onChange={() => handleClick(option.key)}
122
- />
123
- <label
124
- onClick={() => {
125
- handleClick(option.key);
126
- }}
127
- onTouchStart={() => {
128
- setIsShown({ show: true, index: index });
129
- }}
130
- style={{ display: 'flex', alignItems: 'center' }}
131
- onMouseEnter={() => setIsShown({ show: true, index: index })}
132
- onMouseLeave={() => setIsShown({ show: false, index: index })}
114
+ <div
115
+ onClick={() => handleClick(option.key)}
116
+ onTouchStart={() => handleClick(option.key)}
133
117
  >
134
- {modifyString(option.name)}
135
- </label>
118
+ <input
119
+ className="rpgui-radio"
120
+ type="radio"
121
+ value={option.name}
122
+ name="test"
123
+ disabled={!option.canCraft}
124
+ checked={craftItem === option.key}
125
+ onChange={() => handleClick(option.key)}
126
+ />
127
+ <label
128
+ onClick={() => {
129
+ handleClick(option.key);
130
+ }}
131
+ onTouchStart={() => {
132
+ setIsShown({ show: true, index: index });
133
+ }}
134
+ style={{ display: 'flex', alignItems: 'center' }}
135
+ onMouseEnter={() => setIsShown({ show: true, index: index })}
136
+ onMouseLeave={() => setIsShown({ show: false, index: index })}
137
+ >
138
+ {modifyString(option.name)}
139
+ </label>
140
+ </div>
136
141
 
137
142
  {isShown &&
138
143
  isShown.index === index &&
@@ -245,6 +245,7 @@ export const ItemSlot: React.FC<IProps> = observer(
245
245
  const resetItem = () => {
246
246
  setTooltipVisible(false);
247
247
  setWasDragged(false);
248
+ setIsFocused(false);
248
249
  };
249
250
 
250
251
  const onSuccesfulDrag = (quantity?: number) => {
@@ -253,7 +254,6 @@ export const ItemSlot: React.FC<IProps> = observer(
253
254
  if (quantity === -1) setDragPosition({ x: 0, y: 0 });
254
255
  else if (item) {
255
256
  onDragEnd(quantity);
256
- resetItem();
257
257
  }
258
258
  };
259
259
 
@@ -324,7 +324,6 @@ export const ItemSlot: React.FC<IProps> = observer(
324
324
  else onSuccesfulDrag(item.stackQty);
325
325
  } else {
326
326
  resetItem();
327
- setIsFocused(false);
328
327
  setDragPosition({ x: 0, y: 0 });
329
328
  }
330
329
  }, 100);
@@ -1,5 +1,4 @@
1
1
  import { ISkill, ISkillDetails } from '@rpg-engine/shared';
2
- import _ from 'lodash';
3
2
  import React from 'react';
4
3
  import styled from 'styled-components';
5
4
  import { uiColors } from '../constants/uiColors';
@@ -49,6 +48,31 @@ const skillProps = {
49
48
  },
50
49
  };
51
50
 
51
+ interface SkillMap {
52
+ [key: string]: string;
53
+ }
54
+
55
+ const skillNameMap: SkillMap = {
56
+ stamina: 'Stamina',
57
+ magic: 'Magic',
58
+ magicResistance: 'Magic Resistance',
59
+ strength: 'Strength',
60
+ resistance: 'Resistance',
61
+ dexterity: 'Dexterity',
62
+ first: 'Fist',
63
+ club: 'Club',
64
+ sword: 'Sword',
65
+ axe: 'Axe',
66
+ distance: 'Distance',
67
+ shielding: 'Shieldeing',
68
+ dagger: 'Dagger',
69
+ fishing: 'Fishing',
70
+ mining: 'Mining',
71
+ lumberjacking: 'Lumberjacking',
72
+ cooking: 'Cooking',
73
+ alchemy: 'Alchemy',
74
+ }
75
+
52
76
  export const SkillsContainer: React.FC<ISkillContainerProps> = ({
53
77
  onCloseButton,
54
78
  skill,
@@ -71,7 +95,7 @@ export const SkillsContainer: React.FC<ISkillContainerProps> = ({
71
95
  output.push(
72
96
  <SkillProgressBar
73
97
  key={key}
74
- skillName={_.capitalize(key)}
98
+ skillName={skillNameMap[key]}
75
99
  bgColor={skillCategoryColor}
76
100
  level={skillDetails.level || 0}
77
101
  skillPoints={Math.round(skillDetails.skillPoints) || 0}
@@ -19,6 +19,7 @@ export const itemMock: ITradeResponseItem[] = [
19
19
  name: 'Silver Short Sword Premium',
20
20
  price: 100,
21
21
  key: SwordsBlueprint.IceSword,
22
+ qty: 12
22
23
  },
23
24
  {
24
25
  texturePath: "swords/corruption-sword.png",
@@ -1,5 +1,3 @@
1
- import isMobile from 'is-mobile';
1
+ import { isMobileOrTablet } from '@rpg-engine/shared';
2
2
 
3
- export const IS_MOBILE_OR_TABLET = isMobile({
4
- tablet: true,
5
- });
3
+ export const IS_MOBILE_OR_TABLET = isMobileOrTablet();
@@ -0,0 +1,29 @@
1
+ import { Meta, Story } from '@storybook/react';
2
+ import React from 'react';
3
+ import {
4
+ CharacterStatus,
5
+ ICharacterStatusProps,
6
+ } from '../components/CharacterStatus/CharacterStatus';
7
+ import { RPGUIRoot } from '../components/RPGUIRoot';
8
+
9
+ const meta: Meta = {
10
+ title: 'Character Status',
11
+ component: CharacterStatus,
12
+ };
13
+
14
+ export default meta;
15
+
16
+ const Template: Story<ICharacterStatusProps> = args => (
17
+ <RPGUIRoot>
18
+ <CharacterStatus {...args} />
19
+ </RPGUIRoot>
20
+ );
21
+
22
+ export const Default = Template.bind({});
23
+ Default.args = {
24
+ healthValue: 30,
25
+ healthMaxValue: 100,
26
+ manaValue: 30,
27
+ manaMaxValue: 100,
28
+ charName: 'Char Name',
29
+ };