Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
159b10af
Commit
159b10af
authored
Apr 22, 2022
by
Yazawazi
Committed by
GitHub
Apr 22, 2022
Browse files
AvatarFetterLevel
parent
12c6020b
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/data/GenshinData.java
View file @
159b10af
...
...
@@ -31,6 +31,7 @@ public class GenshinData {
private
static
final
Int2ObjectMap
<
AvatarSkillDepotData
>
avatarSkillDepotDataMap
=
new
Int2ObjectOpenHashMap
<>();
private
static
final
Int2ObjectMap
<
AvatarSkillData
>
avatarSkillDataMap
=
new
Int2ObjectOpenHashMap
<>();
private
static
final
Int2ObjectMap
<
AvatarCurveData
>
avatarCurveDataMap
=
new
Int2ObjectLinkedOpenHashMap
<>();
private
static
final
Int2ObjectMap
<
AvatarFetterLevelData
>
avatarFetterLevelDataMap
=
new
Int2ObjectOpenHashMap
<>();
private
static
final
Int2ObjectMap
<
AvatarPromoteData
>
avatarPromoteDataMap
=
new
Int2ObjectOpenHashMap
<>();
private
static
final
Int2ObjectMap
<
AvatarTalentData
>
avatarTalentDataMap
=
new
Int2ObjectOpenHashMap
<>();
private
static
final
Int2ObjectMap
<
ProudSkillData
>
proudSkillDataMap
=
new
Int2ObjectOpenHashMap
<>();
...
...
@@ -114,6 +115,10 @@ public class GenshinData {
return
playerLevelDataMap
;
}
public
static
Int2ObjectMap
<
AvatarFetterLevelData
>
getAvatarFetterLevelDataMap
()
{
return
avatarFetterLevelDataMap
;
}
public
static
Int2ObjectMap
<
AvatarLevelData
>
getAvatarLevelDataMap
()
{
return
avatarLevelDataMap
;
}
...
...
@@ -175,6 +180,11 @@ public class GenshinData {
AvatarLevelData
levelData
=
avatarLevelDataMap
.
get
(
level
);
return
levelData
!=
null
?
levelData
.
getExp
()
:
0
;
}
public
static
int
getAvatarFetterLevelExpRequired
(
int
level
)
{
AvatarFetterLevelData
levelData
=
avatarFetterLevelDataMap
.
get
(
level
);
return
levelData
!=
null
?
levelData
.
getExp
()
:
0
;
}
public
static
Int2ObjectMap
<
ProudSkillData
>
getProudSkillDataMap
()
{
return
proudSkillDataMap
;
...
...
src/main/java/emu/grasscutter/data/def/AvatarFetterLevelData.java
0 → 100644
View file @
159b10af
package
emu.grasscutter.data.def
;
import
emu.grasscutter.data.GenshinResource
;
import
emu.grasscutter.data.ResourceType
;
@ResourceType
(
name
=
"AvatarFettersLevelExcelConfigData.json"
)
public
class
AvatarFetterLevelData
extends
GenshinResource
{
private
int
FetterLevel
;
private
int
NeedExp
;
@Override
public
int
getId
()
{
return
this
.
FetterLevel
;
}
public
int
getLevel
()
{
return
FetterLevel
;
}
public
int
getExp
()
{
return
NeedExp
;
}
}
src/main/java/emu/grasscutter/game/avatar/GenshinAvatar.java
View file @
159b10af
...
...
@@ -89,6 +89,9 @@ public class GenshinAvatar {
private
int
flyCloak
;
private
int
costume
;
private
int
bornTime
;
private
int
fetterLevel
=
1
;
private
int
fetterExp
;
public
GenshinAvatar
()
{
// Morhpia only!
...
...
@@ -281,6 +284,22 @@ public class GenshinAvatar {
return
fetters
;
}
public
int
getFetterLevel
()
{
return
fetterLevel
;
}
public
void
setFetterLevel
(
int
fetterLevel
)
{
this
.
fetterLevel
=
fetterLevel
;
}
public
int
getFetterExp
()
{
return
fetterExp
;
}
public
void
setFetterExp
(
int
fetterExp
)
{
this
.
fetterExp
=
fetterExp
;
}
public
float
getCurrentHp
()
{
return
currentHp
;
}
...
...
@@ -702,8 +721,8 @@ public class GenshinAvatar {
public
AvatarInfo
toProto
()
{
AvatarFetterInfo
.
Builder
avatarFetter
=
AvatarFetterInfo
.
newBuilder
()
.
setExpLevel
(
10
)
.
setExpNumber
(
6325
);
// Highest Level
.
setExpLevel
(
this
.
getFetterLevel
()
)
.
setExpNumber
(
this
.
getFetterExp
());
if
(
this
.
getFetterList
()
!=
null
)
{
for
(
int
i
=
0
;
i
<
this
.
getFetterList
().
size
();
i
++)
{
...
...
src/main/java/emu/grasscutter/game/managers/InventoryManager.java
View file @
159b10af
...
...
@@ -711,6 +711,31 @@ public class InventoryManager {
player
.
sendPacket
(
new
PacketAvatarUpgradeRsp
(
avatar
,
oldLevel
,
oldPropMap
));
}
public
void
upgradeAvatarFetterLevel
(
GenshinPlayer
player
,
GenshinAvatar
avatar
,
int
expGain
)
{
// May work. Not test.
int
maxLevel
=
GenshinData
.
getAvatarFetterLevelDataMap
().
get
(
GenshinData
.
getAvatarFetterLevelDataMap
().
size
()
-
1
).
getLevel
();
int
level
=
avatar
.
getFetterLevel
();
int
exp
=
avatar
.
getFetterExp
();
int
reqExp
=
GenshinData
.
getAvatarFetterLevelExpRequired
(
level
);
while
(
expGain
>
0
&&
reqExp
>
0
&&
level
<
maxLevel
)
{
int
toGain
=
Math
.
min
(
expGain
,
reqExp
-
exp
);
exp
+=
toGain
;
expGain
-=
toGain
;
if
(
exp
>=
reqExp
)
{
exp
=
0
;
level
+=
1
;
reqExp
=
GenshinData
.
getAvatarFetterLevelExpRequired
(
level
);
}
}
avatar
.
setFetterLevel
(
level
);
avatar
.
setFetterExp
(
exp
);
avatar
.
save
();
player
.
sendPacket
(
new
PacketAvatarPropNotify
(
avatar
));
}
public
void
upgradeAvatarSkill
(
GenshinPlayer
player
,
long
guid
,
int
skillId
)
{
// Sanity checks
GenshinAvatar
avatar
=
player
.
getAvatars
().
getAvatarByGuid
(
guid
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment