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
eb709046
Commit
eb709046
authored
Apr 22, 2022
by
Yazawazi
Committed by
GitHub
Apr 22, 2022
Browse files
setfetterlevel command
parent
159b10af
Changes
2
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/command/commands/SetFetterLevelCommand.java
0 → 100644
View file @
eb709046
package
emu.grasscutter.command.commands
;
import
java.util.List
;
import
emu.grasscutter.command.Command
;
import
emu.grasscutter.command.CommandHandler
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.game.entity.EntityAvatar
;
@Command
(
label
=
"setfetterlevel"
,
usage
=
"setfetterlevel <level>"
,
description
=
"Sets your fetter level for your current active character"
,
aliases
=
{
"setfetterlvl"
},
permission
=
"player.setfetterlevel"
)
public
final
class
SetFetterLevelCommand
implements
CommandHandler
{
@Override
public
void
execute
(
GenshinPlayer
sender
,
List
<
String
>
args
)
{
if
(
sender
==
null
)
{
CommandHandler
.
sendMessage
(
null
,
"Run this command in-game."
);
return
;
}
if
(
args
.
size
()
<
1
)
{
CommandHandler
.
sendMessage
(
sender
,
"Usage: setfetterlevel <level>"
);
return
;
}
try
{
int
fetterLevel
=
Integer
.
parseInt
(
args
.
get
(
0
));
if
(
fetterLevel
<
0
||
fetterLevel
>
10
)
{
CommandHandler
.
sendMessage
(
sender
,
"Fetter level must be between 0 and 10."
);
return
;
}
EntityAvatar
avatar
=
sender
.
getTeamManager
().
getCurrentAvatarEntity
();
avatar
.
getAvatar
().
setFetterLevel
(
fetterLevel
);
CommandHandler
.
sendMessage
(
sender
,
"Fetter level set to "
+
fetterLevel
);
}
catch
(
NumberFormatException
ignored
)
{
CommandHandler
.
sendMessage
(
null
,
"Invalid fetter level."
);
}
}
}
src/main/java/emu/grasscutter/game/managers/InventoryManager.java
View file @
eb709046
...
...
@@ -713,7 +713,7 @@ public class InventoryManager {
public
void
upgradeAvatarFetterLevel
(
GenshinPlayer
player
,
GenshinAvatar
avatar
,
int
expGain
)
{
// May work. Not test.
int
maxLevel
=
GenshinData
.
getAvatarFetterLevelDataMap
().
get
(
GenshinData
.
getAvatarFetterLevelDataMap
().
size
()
-
1
).
getLevel
();
int
maxLevel
=
10
;
// Keep it until I think of a more "elegant" way
int
level
=
avatar
.
getFetterLevel
();
int
exp
=
avatar
.
getFetterExp
();
int
reqExp
=
GenshinData
.
getAvatarFetterLevelExpRequired
(
level
);
...
...
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