@rpg-engine/long-bow 0.1.68 → 0.1.71
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/dist/components/Abstractions/SlotsContainer.d.ts +11 -0
- package/dist/components/DraggableContainer.d.ts +3 -2
- package/dist/components/Equipment/EquipmentSet.d.ts +13 -0
- package/dist/components/Item/Inventory/ItemSlot.d.ts +10 -2
- package/dist/components/Item/Inventory/itemContainerHelper.d.ts +6 -2
- package/dist/components/Item/SpriteFromAtlas.d.ts +2 -0
- package/dist/components/Multitab/Tab.d.ts +9 -0
- package/dist/components/Multitab/TabBody.d.ts +7 -0
- package/dist/components/Multitab/TabsContainer.d.ts +17 -0
- package/dist/components/SimpleProgressBar.d.ts +3 -4
- package/dist/components/SkillProgressBar.d.ts +6 -4
- package/dist/components/SkillsContainer.d.ts +7 -0
- package/dist/components/store/UI.store.d.ts +34 -0
- package/dist/constants/uiColors.d.ts +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/long-bow.cjs.development.js +5258 -419
- package/dist/long-bow.cjs.development.js.map +1 -1
- package/dist/long-bow.cjs.production.min.js +1 -1
- package/dist/long-bow.cjs.production.min.js.map +1 -1
- package/dist/long-bow.esm.js +5260 -420
- package/dist/long-bow.esm.js.map +1 -1
- package/dist/mocks/equipmentSet.mocks.d.ts +3 -0
- package/dist/mocks/skills.mocks.d.ts +115 -0
- package/package.json +5 -3
- package/src/components/Abstractions/SlotsContainer.tsx +42 -0
- package/src/components/DraggableContainer.tsx +65 -38
- package/src/components/Equipment/EquipmentSet.tsx +179 -0
- package/src/components/I_Book.png +0 -0
- package/src/components/Item/Inventory/ItemContainer.tsx +70 -178
- package/src/components/Item/Inventory/ItemSlot.tsx +92 -24
- package/src/components/Item/Inventory/itemContainerHelper.ts +48 -11
- package/src/components/Item/SpriteFromAtlas.tsx +18 -1
- package/src/components/ListMenu.tsx +3 -3
- package/src/components/Multitab/Tab.tsx +57 -0
- package/src/components/Multitab/TabBody.tsx +13 -0
- package/src/components/Multitab/TabsContainer.tsx +97 -0
- package/src/components/SimpleProgressBar.tsx +14 -10
- package/src/components/SkillProgressBar.tsx +74 -20
- package/src/components/SkillsContainer.tsx +235 -0
- package/src/components/store/UI.store.ts +192 -0
- package/src/constants/uiColors.ts +7 -0
- package/src/index.tsx +1 -0
- package/src/mocks/atlas/items/items.json +4677 -189
- package/src/mocks/atlas/items/items.png +0 -0
- package/src/mocks/equipmentSet.mocks.ts +347 -0
- package/src/mocks/itemContainer.mocks.ts +33 -33
- package/src/mocks/skills.mocks.ts +116 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { DraggableContainer } from '../DraggableContainer';
|
|
4
|
+
import { RPGUIContainerTypes } from '../RPGUIContainer';
|
|
5
|
+
import { Tab } from './Tab';
|
|
6
|
+
|
|
7
|
+
interface ITab {
|
|
8
|
+
label: string;
|
|
9
|
+
id: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export enum MultitabType {
|
|
13
|
+
Brown = 'brown',
|
|
14
|
+
Gray = 'gray',
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ITabsContainer {
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
onCloseButton?: () => void;
|
|
20
|
+
tabs: ITab[];
|
|
21
|
+
type: MultitabType;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const TabsContainer: React.FC<ITabsContainer> = ({
|
|
25
|
+
children,
|
|
26
|
+
onCloseButton,
|
|
27
|
+
tabs,
|
|
28
|
+
type = MultitabType.Brown,
|
|
29
|
+
}) => {
|
|
30
|
+
const [selectedTab, setSelectedTab] = useState(tabs[0].id); //by default the first one
|
|
31
|
+
|
|
32
|
+
const onRenderTabs = () =>
|
|
33
|
+
tabs.map((tab, index) => (
|
|
34
|
+
<Tab
|
|
35
|
+
type={type}
|
|
36
|
+
active={selectedTab === tab.id}
|
|
37
|
+
label={tab.label}
|
|
38
|
+
key={`${tab.label}_${index}`}
|
|
39
|
+
onClick={() => setSelectedTab(tab.id)}
|
|
40
|
+
>
|
|
41
|
+
{tab.label}
|
|
42
|
+
</Tab>
|
|
43
|
+
));
|
|
44
|
+
|
|
45
|
+
const onGetContainerType = () => {
|
|
46
|
+
switch (type) {
|
|
47
|
+
case 'brown':
|
|
48
|
+
return RPGUIContainerTypes.FramedGold;
|
|
49
|
+
case 'gray':
|
|
50
|
+
return RPGUIContainerTypes.Framed;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<DraggableContainer
|
|
56
|
+
onCloseButton={onCloseButton}
|
|
57
|
+
type={onGetContainerType()}
|
|
58
|
+
>
|
|
59
|
+
{onRenderTabs()}
|
|
60
|
+
<BodyContainer selectedTab={selectedTab} className={type}>
|
|
61
|
+
{children}
|
|
62
|
+
</BodyContainer>
|
|
63
|
+
</DraggableContainer>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
interface IBodyContainer {
|
|
68
|
+
selectedTab: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const BodyContainer = styled.div<IBodyContainer>`
|
|
72
|
+
display: flex;
|
|
73
|
+
width: 100%;
|
|
74
|
+
height: 100%;
|
|
75
|
+
justify-content: space-between;
|
|
76
|
+
|
|
77
|
+
/* hide everything that is not data-tab-id selectedTab */
|
|
78
|
+
& > *:not([data-tab-id=${props => props.selectedTab}]) {
|
|
79
|
+
display: none;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
&.brown {
|
|
83
|
+
border: 0.25rem solid #996D55;
|
|
84
|
+
background-color: #BF886A;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
&.gray {
|
|
89
|
+
border: 0.25rem solid rgba(0, 0, 0, 0.25);
|
|
90
|
+
background-color: #4E4A4E;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
border-radius: 5px;
|
|
95
|
+
padding: 0.5rem;
|
|
96
|
+
|
|
97
|
+
`;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
export interface ISimpleProgressBarProps {
|
|
5
5
|
value: number;
|
|
6
|
-
height?: string;
|
|
7
6
|
bgColor?: string;
|
|
7
|
+
margin?: number;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export const SimpleProgressBar: React.FC<
|
|
10
|
+
export const SimpleProgressBar: React.FC<ISimpleProgressBarProps> = ({
|
|
11
11
|
value,
|
|
12
|
-
|
|
13
12
|
bgColor = 'red',
|
|
13
|
+
margin = 20,
|
|
14
14
|
}) => {
|
|
15
15
|
return (
|
|
16
|
-
<Container>
|
|
17
|
-
<ProgressBarContainer>
|
|
16
|
+
<Container className="simple-progress-bar">
|
|
17
|
+
<ProgressBarContainer margin={margin}>
|
|
18
18
|
<BackgroundBar>
|
|
19
19
|
<Progress value={value} bgColor={bgColor} />
|
|
20
20
|
</BackgroundBar>
|
|
@@ -34,16 +34,20 @@ const BackgroundBar = styled.span`
|
|
|
34
34
|
background-color: rgba(0, 0, 0, 0.075);
|
|
35
35
|
`;
|
|
36
36
|
|
|
37
|
-
interface
|
|
37
|
+
interface ISimpleProgressBarThemeProps {
|
|
38
38
|
value: number;
|
|
39
39
|
bgColor: string;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
const Progress = styled.span`
|
|
43
|
-
background-color: ${(props:
|
|
44
|
-
width: ${(props:
|
|
43
|
+
background-color: ${(props: ISimpleProgressBarThemeProps) => props.bgColor};
|
|
44
|
+
width: ${(props: ISimpleProgressBarThemeProps) => props.value}%;
|
|
45
45
|
`;
|
|
46
46
|
|
|
47
|
+
interface ISimpleProgressBarTheme2Props {
|
|
48
|
+
margin: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
47
51
|
const ProgressBarContainer = styled.div`
|
|
48
52
|
border-radius: 60px;
|
|
49
53
|
border: 1px solid #282424;
|
|
@@ -53,6 +57,6 @@ const ProgressBarContainer = styled.div`
|
|
|
53
57
|
display: block;
|
|
54
58
|
height: 100%;
|
|
55
59
|
}
|
|
56
|
-
|
|
57
60
|
height: 8px;
|
|
61
|
+
margin-left: ${(props: ISimpleProgressBarTheme2Props) => props.margin}px;
|
|
58
62
|
`;
|
|
@@ -1,42 +1,99 @@
|
|
|
1
|
+
import { getSPForLevel } from '@rpg-engine/shared';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import styled from 'styled-components';
|
|
3
|
-
import
|
|
4
|
+
import atlasJSON from '../mocks/atlas/items/items.json';
|
|
5
|
+
import atlasIMG from '../mocks/atlas/items/items.png';
|
|
6
|
+
import { SpriteFromAtlas } from './Item/SpriteFromAtlas';
|
|
4
7
|
import { SimpleProgressBar } from './SimpleProgressBar';
|
|
5
8
|
|
|
6
9
|
export interface ISkillProgressBarProps {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
height: string;
|
|
10
|
+
skillName: string;
|
|
10
11
|
bgColor: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
level: number;
|
|
13
|
+
skillPoints: number;
|
|
14
|
+
skillPointsToNextLevel?: number;
|
|
15
|
+
texturePath: string;
|
|
16
|
+
showSkillPoints?: boolean;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
export const SkillProgressBar: React.FC<ISkillProgressBarProps> = ({
|
|
17
|
-
value,
|
|
18
20
|
bgColor,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
skillName,
|
|
22
|
+
level,
|
|
23
|
+
skillPoints,
|
|
24
|
+
texturePath,
|
|
25
|
+
showSkillPoints = true,
|
|
22
26
|
}) => {
|
|
27
|
+
const spForNextLevel = getSPForLevel(level + 1);
|
|
28
|
+
|
|
29
|
+
const ratio = (skillPoints / spForNextLevel) * 100;
|
|
30
|
+
|
|
23
31
|
return (
|
|
24
32
|
<>
|
|
25
33
|
<ProgressTitle>
|
|
26
|
-
<TitleName>{
|
|
27
|
-
<ValueDisplay>{
|
|
34
|
+
<TitleName>{skillName}</TitleName>
|
|
35
|
+
<ValueDisplay>lv {level}</ValueDisplay>
|
|
28
36
|
</ProgressTitle>
|
|
29
37
|
<ProgressBody>
|
|
30
38
|
<ProgressIconContainer>
|
|
31
|
-
|
|
39
|
+
{atlasIMG && atlasJSON ? (
|
|
40
|
+
<SpriteContainer>
|
|
41
|
+
<SpriteFromAtlas
|
|
42
|
+
atlasIMG={atlasIMG}
|
|
43
|
+
atlasJSON={atlasJSON}
|
|
44
|
+
spriteKey={texturePath}
|
|
45
|
+
scale={1}
|
|
46
|
+
grayScale
|
|
47
|
+
opacity={0.5}
|
|
48
|
+
/>
|
|
49
|
+
</SpriteContainer>
|
|
50
|
+
) : (
|
|
51
|
+
<></>
|
|
52
|
+
)}
|
|
32
53
|
</ProgressIconContainer>
|
|
33
54
|
|
|
34
|
-
<
|
|
55
|
+
<ProgressBarContainer>
|
|
56
|
+
<SimpleProgressBar value={ratio} bgColor={bgColor} />
|
|
57
|
+
</ProgressBarContainer>
|
|
35
58
|
</ProgressBody>
|
|
59
|
+
{showSkillPoints && (
|
|
60
|
+
<SkillDisplayContainer>
|
|
61
|
+
<SkillPointsDisplay>
|
|
62
|
+
{skillPoints}/{spForNextLevel}
|
|
63
|
+
</SkillPointsDisplay>
|
|
64
|
+
</SkillDisplayContainer>
|
|
65
|
+
)}
|
|
36
66
|
</>
|
|
37
67
|
);
|
|
38
68
|
};
|
|
39
69
|
|
|
70
|
+
const ProgressBarContainer = styled.div`
|
|
71
|
+
position: relative;
|
|
72
|
+
top: 8px;
|
|
73
|
+
width: 100%;
|
|
74
|
+
height: auto;
|
|
75
|
+
`;
|
|
76
|
+
|
|
77
|
+
const SpriteContainer = styled.div`
|
|
78
|
+
position: relative;
|
|
79
|
+
top: -3px;
|
|
80
|
+
left: 0;
|
|
81
|
+
`;
|
|
82
|
+
|
|
83
|
+
const SkillDisplayContainer = styled.div`
|
|
84
|
+
margin: 5px auto;
|
|
85
|
+
|
|
86
|
+
p {
|
|
87
|
+
margin: 0;
|
|
88
|
+
}
|
|
89
|
+
`;
|
|
90
|
+
|
|
91
|
+
const SkillPointsDisplay = styled.p`
|
|
92
|
+
font-size: 0.6rem !important;
|
|
93
|
+
font-weight: bold;
|
|
94
|
+
text-align: center;
|
|
95
|
+
`;
|
|
96
|
+
|
|
40
97
|
const TitleName = styled.span`
|
|
41
98
|
margin-left: 5px;
|
|
42
99
|
`;
|
|
@@ -52,6 +109,7 @@ const ProgressIconContainer = styled.div`
|
|
|
52
109
|
const ProgressBody = styled.div`
|
|
53
110
|
display: flex;
|
|
54
111
|
flex-direction: row;
|
|
112
|
+
width: 100%;
|
|
55
113
|
`;
|
|
56
114
|
|
|
57
115
|
const ProgressTitle = styled.div`
|
|
@@ -62,9 +120,5 @@ const ProgressTitle = styled.div`
|
|
|
62
120
|
span {
|
|
63
121
|
font-size: 0.6rem;
|
|
64
122
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const Icon = styled.img`
|
|
68
|
-
margin-right: 10px;
|
|
69
|
-
height: 30px;
|
|
123
|
+
margin-top: 10px;
|
|
70
124
|
`;
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { ISkill } from '@rpg-engine/shared';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import { colors } from '../constants/uiColors';
|
|
5
|
+
import { DraggableContainer } from './DraggableContainer';
|
|
6
|
+
import { SkillProgressBar } from './SkillProgressBar';
|
|
7
|
+
|
|
8
|
+
export interface ISkillContainerProps {
|
|
9
|
+
skill: ISkill;
|
|
10
|
+
onCloseButton: () => void;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const SkillsContainer: React.FC<ISkillContainerProps> = ({
|
|
14
|
+
onCloseButton,
|
|
15
|
+
skill,
|
|
16
|
+
}) => {
|
|
17
|
+
return (
|
|
18
|
+
<SkillsDraggableContainer title="Skills" onCloseButton={onCloseButton}>
|
|
19
|
+
<SkillSplitDiv>
|
|
20
|
+
<p>Combat Skills</p>
|
|
21
|
+
<hr className="golden" />
|
|
22
|
+
</SkillSplitDiv>
|
|
23
|
+
<SkillProgressBar
|
|
24
|
+
skillName={'First'}
|
|
25
|
+
bgColor={colors.cardinal}
|
|
26
|
+
level={skill?.first?.level || 0}
|
|
27
|
+
skillPoints={skill?.first?.skillPoints || 0}
|
|
28
|
+
skillPointsToNextLevel={skill?.first?.skillPointsToNextLevel || 0}
|
|
29
|
+
texturePath={'gloves/leather-gloves.png'}
|
|
30
|
+
/>
|
|
31
|
+
<SkillProgressBar
|
|
32
|
+
skillName={'Club'}
|
|
33
|
+
bgColor={colors.cardinal}
|
|
34
|
+
level={skill?.club?.level || 0}
|
|
35
|
+
skillPoints={skill?.club?.skillPoints || 0}
|
|
36
|
+
skillPointsToNextLevel={skill?.club?.skillPointsToNextLevel || 0}
|
|
37
|
+
texturePath={'maces/club.png'}
|
|
38
|
+
/>
|
|
39
|
+
<SkillProgressBar
|
|
40
|
+
skillName={'Sword'}
|
|
41
|
+
bgColor={colors.cardinal}
|
|
42
|
+
level={skill?.sword?.level || 0}
|
|
43
|
+
skillPoints={skill?.sword?.skillPoints || 0}
|
|
44
|
+
skillPointsToNextLevel={skill?.sword?.skillPointsToNextLevel || 0}
|
|
45
|
+
texturePath={'swords/double-edged-sword.png'}
|
|
46
|
+
/>
|
|
47
|
+
<SkillProgressBar
|
|
48
|
+
skillName={'Axe'}
|
|
49
|
+
bgColor={colors.cardinal}
|
|
50
|
+
level={skill?.axe?.level || 0}
|
|
51
|
+
skillPoints={skill?.axe?.skillPoints || 0}
|
|
52
|
+
skillPointsToNextLevel={skill?.axe?.skillPointsToNextLevel || 0}
|
|
53
|
+
texturePath={'axes/double-axe.png'}
|
|
54
|
+
/>
|
|
55
|
+
<SkillProgressBar
|
|
56
|
+
skillName={'Distance'}
|
|
57
|
+
bgColor={colors.cardinal}
|
|
58
|
+
level={skill?.distance?.level || 0}
|
|
59
|
+
skillPoints={skill?.distance?.skillPoints || 0}
|
|
60
|
+
skillPointsToNextLevel={skill?.distance?.skillPointsToNextLevel || 0}
|
|
61
|
+
texturePath={'bows/horse-bow.png'}
|
|
62
|
+
/>
|
|
63
|
+
<SkillProgressBar
|
|
64
|
+
skillName={'Shielding'}
|
|
65
|
+
bgColor={colors.cardinal}
|
|
66
|
+
level={skill?.shielding?.level || 0}
|
|
67
|
+
skillPoints={skill?.shielding?.skillPoints || 0}
|
|
68
|
+
skillPointsToNextLevel={skill?.shielding?.skillPointsToNextLevel || 0}
|
|
69
|
+
texturePath={'shields/studded-shield.png'}
|
|
70
|
+
/>
|
|
71
|
+
<SkillSplitDiv>
|
|
72
|
+
<p>Crafting Skills</p>
|
|
73
|
+
<hr className="golden" />
|
|
74
|
+
</SkillSplitDiv>
|
|
75
|
+
<SkillProgressBar
|
|
76
|
+
skillName={'Fishing'}
|
|
77
|
+
bgColor={colors.blue}
|
|
78
|
+
level={skill?.fishing?.level || 0}
|
|
79
|
+
skillPoints={skill?.fishing?.skillPoints || 0}
|
|
80
|
+
skillPointsToNextLevel={skill?.fishing?.skillPointsToNextLevel || 0}
|
|
81
|
+
texturePath={'foods/fish.png'}
|
|
82
|
+
/>
|
|
83
|
+
<SkillProgressBar
|
|
84
|
+
skillName={'Mining'}
|
|
85
|
+
bgColor={colors.blue}
|
|
86
|
+
level={skill?.mining?.level || 0}
|
|
87
|
+
skillPoints={skill?.mining?.skillPoints || 0}
|
|
88
|
+
skillPointsToNextLevel={skill?.mining?.skillPointsToNextLevel || 0}
|
|
89
|
+
texturePath={'crafting-resources/iron-ingot.png'}
|
|
90
|
+
/>
|
|
91
|
+
<SkillProgressBar
|
|
92
|
+
skillName={'Lumberjacking'}
|
|
93
|
+
bgColor={colors.blue}
|
|
94
|
+
level={skill?.lumberjacking?.level || 0}
|
|
95
|
+
skillPoints={skill?.lumberjacking?.skillPoints || 0}
|
|
96
|
+
skillPointsToNextLevel={
|
|
97
|
+
skill?.lumberjacking?.skillPointsToNextLevel || 0
|
|
98
|
+
}
|
|
99
|
+
texturePath={'crafting-resources/greater-wood-log.png'}
|
|
100
|
+
/>
|
|
101
|
+
<SkillProgressBar
|
|
102
|
+
skillName={'Cooking'}
|
|
103
|
+
bgColor={colors.blue}
|
|
104
|
+
level={skill?.cooking?.level || 0}
|
|
105
|
+
skillPoints={skill?.cooking?.skillPoints || 0}
|
|
106
|
+
skillPointsToNextLevel={skill?.cooking?.skillPointsToNextLevel || 0}
|
|
107
|
+
texturePath={'foods/chickens-meat.png'}
|
|
108
|
+
/>
|
|
109
|
+
<SkillProgressBar
|
|
110
|
+
skillName={'Alchemy'}
|
|
111
|
+
bgColor={colors.blue}
|
|
112
|
+
level={skill?.alchemy?.level || 0}
|
|
113
|
+
skillPoints={skill?.alchemy?.skillPoints || 0}
|
|
114
|
+
skillPointsToNextLevel={skill?.alchemy?.skillPointsToNextLevel || 0}
|
|
115
|
+
texturePath={'potions/greater-mana-potion.png'}
|
|
116
|
+
/>
|
|
117
|
+
|
|
118
|
+
<SkillSplitDiv>
|
|
119
|
+
<p>Basic Attributes</p>
|
|
120
|
+
<hr className="golden" />
|
|
121
|
+
</SkillSplitDiv>
|
|
122
|
+
<SkillProgressBar
|
|
123
|
+
skillName={'Stamina'}
|
|
124
|
+
bgColor={colors.darkYellow}
|
|
125
|
+
level={skill?.stamina?.level || 0}
|
|
126
|
+
skillPoints={skill?.stamina?.skillPoints || 0}
|
|
127
|
+
skillPointsToNextLevel={skill?.stamina?.skillPointsToNextLevel || 0}
|
|
128
|
+
texturePath={'spell-icons/regenerate.png'}
|
|
129
|
+
/>
|
|
130
|
+
<SkillProgressBar
|
|
131
|
+
skillName={'Magic'}
|
|
132
|
+
bgColor={colors.purple}
|
|
133
|
+
level={skill?.magic?.level || 0}
|
|
134
|
+
skillPoints={skill?.magic?.skillPoints || 0}
|
|
135
|
+
skillPointsToNextLevel={skill?.magic?.skillPointsToNextLevel || 0}
|
|
136
|
+
texturePath={'spell-icons/fireball.png'}
|
|
137
|
+
/>
|
|
138
|
+
<SkillProgressBar
|
|
139
|
+
skillName={'Magic Resistance'}
|
|
140
|
+
bgColor={colors.navyBlue}
|
|
141
|
+
level={skill?.magicResistance?.level || 0}
|
|
142
|
+
skillPoints={skill?.magicResistance?.skillPoints || 0}
|
|
143
|
+
skillPointsToNextLevel={
|
|
144
|
+
skill?.magicResistance?.skillPointsToNextLevel || 0
|
|
145
|
+
}
|
|
146
|
+
texturePath={'spell-icons/freeze.png'}
|
|
147
|
+
/>
|
|
148
|
+
<SkillProgressBar
|
|
149
|
+
skillName={'Strength'}
|
|
150
|
+
bgColor={colors.cardinal}
|
|
151
|
+
level={skill?.strength?.level || 0}
|
|
152
|
+
skillPoints={skill?.strength?.skillPoints || 0}
|
|
153
|
+
skillPointsToNextLevel={skill?.strength?.skillPointsToNextLevel || 0}
|
|
154
|
+
texturePath={'spell-icons/enchanted-blow.png'}
|
|
155
|
+
/>
|
|
156
|
+
<SkillProgressBar
|
|
157
|
+
skillName={'Resistance'}
|
|
158
|
+
bgColor={colors.raisinBlack}
|
|
159
|
+
level={skill?.resistance?.level || 0}
|
|
160
|
+
skillPoints={skill?.resistance?.skillPoints || 0}
|
|
161
|
+
skillPointsToNextLevel={skill?.resistance?.skillPointsToNextLevel || 0}
|
|
162
|
+
texturePath={'spell-icons/magic-shield.png'}
|
|
163
|
+
/>
|
|
164
|
+
<SkillProgressBar
|
|
165
|
+
skillName={'Dexterity'}
|
|
166
|
+
bgColor={colors.blue}
|
|
167
|
+
level={skill?.dexterity?.level || 0}
|
|
168
|
+
skillPoints={skill?.dexterity?.skillPoints || 0}
|
|
169
|
+
skillPointsToNextLevel={skill?.dexterity?.skillPointsToNextLevel || 0}
|
|
170
|
+
texturePath={'spell-icons/haste.png'}
|
|
171
|
+
/>
|
|
172
|
+
|
|
173
|
+
{/* <SkillSplitDiv>
|
|
174
|
+
<p>Magic Skills</p>
|
|
175
|
+
<hr className="golden" />
|
|
176
|
+
</SkillSplitDiv>
|
|
177
|
+
<SkillProgressBar
|
|
178
|
+
skillName={'Ice'}
|
|
179
|
+
bgColor={'red'}
|
|
180
|
+
level={skill?.ice?.level || 0}
|
|
181
|
+
skillPoints={skill?.ice?.skillPoints || 0}
|
|
182
|
+
skillPointsToNextLevel={skill?.ice?.skillPointsToNextLevel || 0}
|
|
183
|
+
texturePath={'spell-icons/freeze.png'}
|
|
184
|
+
/>
|
|
185
|
+
<SkillProgressBar
|
|
186
|
+
skillName={'Earth'}
|
|
187
|
+
bgColor={'red'}
|
|
188
|
+
level={skill?.earth?.level || 0}
|
|
189
|
+
skillPoints={skill?.earth?.skillPoints || 0}
|
|
190
|
+
skillPointsToNextLevel={skill?.earth?.skillPointsToNextLevel || 0}
|
|
191
|
+
texturePath={'spell-icons/earth-barrier.png'}
|
|
192
|
+
/>
|
|
193
|
+
<SkillProgressBar
|
|
194
|
+
skillName={'Air'}
|
|
195
|
+
bgColor={'red'}
|
|
196
|
+
level={skill?.air?.level || 0}
|
|
197
|
+
skillPoints={skill?.air?.skillPoints || 0}
|
|
198
|
+
skillPointsToNextLevel={skill?.air?.skillPointsToNextLevel || 0}
|
|
199
|
+
texturePath={'spell-icons/poison-tornado.png'}
|
|
200
|
+
/>
|
|
201
|
+
<SkillProgressBar
|
|
202
|
+
skillName={'Water'}
|
|
203
|
+
bgColor={'red'}
|
|
204
|
+
level={skill?.water?.level || 0}
|
|
205
|
+
skillPoints={skill?.water?.skillPoints || 0}
|
|
206
|
+
skillPointsToNextLevel={skill?.water?.skillPointsToNextLevel || 0}
|
|
207
|
+
texturePath={'spell-icons/tsunami.png'}
|
|
208
|
+
/> */}
|
|
209
|
+
</SkillsDraggableContainer>
|
|
210
|
+
);
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const SkillsDraggableContainer = styled(DraggableContainer)`
|
|
214
|
+
border: 1px solid black;
|
|
215
|
+
width: 400px;
|
|
216
|
+
height: 800px;
|
|
217
|
+
overflow-y: scroll;
|
|
218
|
+
.DraggableContainer__TitleContainer-sc-184mpyl-2 {
|
|
219
|
+
width: auto;
|
|
220
|
+
height: auto;
|
|
221
|
+
}
|
|
222
|
+
`;
|
|
223
|
+
|
|
224
|
+
const SkillSplitDiv = styled.div`
|
|
225
|
+
width: 100%;
|
|
226
|
+
font-size: 11px;
|
|
227
|
+
margin-top: 10px;
|
|
228
|
+
hr {
|
|
229
|
+
margin: 0px;
|
|
230
|
+
padding: 0px;
|
|
231
|
+
}
|
|
232
|
+
p {
|
|
233
|
+
margin-bottom: 0px;
|
|
234
|
+
}
|
|
235
|
+
`;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import {
|
|
2
|
+
IItem,
|
|
3
|
+
IPayloadProps,
|
|
4
|
+
ItemSocketEvents,
|
|
5
|
+
ItemSocketEventsDisplayLabels,
|
|
6
|
+
ItemType,
|
|
7
|
+
} from '@rpg-engine/shared';
|
|
8
|
+
import { makeAutoObservable, toJS } from 'mobx';
|
|
9
|
+
import {
|
|
10
|
+
handleContextMenuList,
|
|
11
|
+
handleEquipmentContextMenuList,
|
|
12
|
+
IContextMenuItem,
|
|
13
|
+
} from '../Item/Inventory/itemContainerHelper';
|
|
14
|
+
import { SlotContainerType } from '../Item/Inventory/ItemSlot';
|
|
15
|
+
|
|
16
|
+
interface IContextMenu {
|
|
17
|
+
visible: boolean;
|
|
18
|
+
posX: number;
|
|
19
|
+
posY: number;
|
|
20
|
+
slotItem: IItem | null;
|
|
21
|
+
slotIndex?: number | null;
|
|
22
|
+
contextActions: IContextMenuItem[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface IHoverDetail {
|
|
26
|
+
visible: boolean;
|
|
27
|
+
posX: number;
|
|
28
|
+
posY: number;
|
|
29
|
+
item: IItem | null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface ISetContextMenu extends Omit<IContextMenu, 'contextActions'> {}
|
|
33
|
+
|
|
34
|
+
const initialState = {
|
|
35
|
+
visible: false,
|
|
36
|
+
posX: 0,
|
|
37
|
+
posY: 0,
|
|
38
|
+
contextActions: [],
|
|
39
|
+
slotItem: null,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const initialHoverState = {
|
|
43
|
+
visible: false,
|
|
44
|
+
posX: 0,
|
|
45
|
+
posY: 0,
|
|
46
|
+
item: null,
|
|
47
|
+
};
|
|
48
|
+
class UIStore {
|
|
49
|
+
public contextMenu: IContextMenu | null = initialState;
|
|
50
|
+
|
|
51
|
+
public onHoverDetail: IHoverDetail | null = initialHoverState;
|
|
52
|
+
|
|
53
|
+
constructor() {
|
|
54
|
+
makeAutoObservable(this);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public setContextMenu(contextMenu: ISetContextMenu, itemType: ItemType) {
|
|
58
|
+
const contextActions = handleContextMenuList(itemType);
|
|
59
|
+
|
|
60
|
+
this.contextMenu = {
|
|
61
|
+
...contextMenu,
|
|
62
|
+
contextActions,
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
console.log(toJS(this.contextMenu));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public setEquipContextMenu(
|
|
69
|
+
contextMenu: ISetContextMenu,
|
|
70
|
+
itemType: ItemType,
|
|
71
|
+
isItemContainer: boolean | undefined
|
|
72
|
+
) {
|
|
73
|
+
const contextActions = handleEquipmentContextMenuList(itemType);
|
|
74
|
+
if (isItemContainer)
|
|
75
|
+
contextActions.push({
|
|
76
|
+
id: ItemSocketEvents.ContainerOpen,
|
|
77
|
+
text: ItemSocketEventsDisplayLabels[ItemSocketEvents.ContainerOpen],
|
|
78
|
+
});
|
|
79
|
+
this.contextMenu = {
|
|
80
|
+
...contextMenu,
|
|
81
|
+
contextActions,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
console.log(toJS(this.contextMenu));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public clearContextMenu() {
|
|
88
|
+
this.contextMenu = initialState;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
public setItemHoverDetail(hoverDetail: IHoverDetail) {
|
|
92
|
+
if (hoverDetail?.item === null) this.clearItemHoverDetail();
|
|
93
|
+
|
|
94
|
+
this.onHoverDetail = {
|
|
95
|
+
...hoverDetail,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
public clearItemHoverDetail() {
|
|
100
|
+
this.onHoverDetail = initialHoverState;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
public handleOnItemClick = (
|
|
104
|
+
item: IItem,
|
|
105
|
+
posX: number,
|
|
106
|
+
posY: number,
|
|
107
|
+
slotContainerType: SlotContainerType | null
|
|
108
|
+
): void => {
|
|
109
|
+
if (
|
|
110
|
+
!item ||
|
|
111
|
+
JSON.stringify(this.contextMenu?.slotItem) === JSON.stringify(item)
|
|
112
|
+
) {
|
|
113
|
+
this.clearContextMenu();
|
|
114
|
+
this.clearItemHoverDetail();
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
switch (slotContainerType) {
|
|
118
|
+
case SlotContainerType.EQUIPMENT_SET:
|
|
119
|
+
this.setEquipContextMenu(
|
|
120
|
+
{
|
|
121
|
+
visible: true,
|
|
122
|
+
posX,
|
|
123
|
+
posY,
|
|
124
|
+
slotItem: item,
|
|
125
|
+
},
|
|
126
|
+
item.type,
|
|
127
|
+
item.isItemContainer
|
|
128
|
+
);
|
|
129
|
+
break;
|
|
130
|
+
case SlotContainerType.INVENTORY:
|
|
131
|
+
this.setContextMenu(
|
|
132
|
+
{
|
|
133
|
+
visible: true,
|
|
134
|
+
posX,
|
|
135
|
+
posY,
|
|
136
|
+
slotItem: item,
|
|
137
|
+
},
|
|
138
|
+
item.type
|
|
139
|
+
);
|
|
140
|
+
break;
|
|
141
|
+
default:
|
|
142
|
+
this.setContextMenu(
|
|
143
|
+
{
|
|
144
|
+
visible: true,
|
|
145
|
+
posX,
|
|
146
|
+
posY,
|
|
147
|
+
slotItem: item,
|
|
148
|
+
},
|
|
149
|
+
item.type
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
this.clearItemHoverDetail();
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
public handleOnMouseHover = (
|
|
157
|
+
event: any,
|
|
158
|
+
slotIndex: number,
|
|
159
|
+
item: IItem | null,
|
|
160
|
+
posX: number,
|
|
161
|
+
posY: number,
|
|
162
|
+
onMouseOver: any
|
|
163
|
+
): void => {
|
|
164
|
+
if (item) {
|
|
165
|
+
this.setItemHoverDetail({
|
|
166
|
+
visible: true,
|
|
167
|
+
posX,
|
|
168
|
+
posY,
|
|
169
|
+
item: item,
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
if (onMouseOver) {
|
|
173
|
+
onMouseOver(event, slotIndex, item);
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
public onSelected(
|
|
178
|
+
selectedActionId: ItemSocketEvents | string,
|
|
179
|
+
onActionSelected: any
|
|
180
|
+
) {
|
|
181
|
+
let payloadData: IPayloadProps = {
|
|
182
|
+
actionType: selectedActionId,
|
|
183
|
+
item: this.contextMenu?.slotItem!,
|
|
184
|
+
};
|
|
185
|
+
if (onActionSelected) {
|
|
186
|
+
onActionSelected(payloadData);
|
|
187
|
+
}
|
|
188
|
+
this.clearContextMenu!();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export const uiStore = new UIStore();
|