mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-24 06:50:36 +00:00
setfetterlevel command
This commit is contained in:
parent
9edb70d6cf
commit
34c0c6b01b
@ -0,0 +1,41 @@
|
|||||||
|
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.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -713,7 +713,7 @@ public class InventoryManager {
|
|||||||
|
|
||||||
public void upgradeAvatarFetterLevel(GenshinPlayer player, GenshinAvatar avatar, int expGain) {
|
public void upgradeAvatarFetterLevel(GenshinPlayer player, GenshinAvatar avatar, int expGain) {
|
||||||
// May work. Not test.
|
// 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 level = avatar.getFetterLevel();
|
||||||
int exp = avatar.getFetterExp();
|
int exp = avatar.getFetterExp();
|
||||||
int reqExp = GenshinData.getAvatarFetterLevelExpRequired(level);
|
int reqExp = GenshinData.getAvatarFetterLevelExpRequired(level);
|
||||||
|
Loading…
Reference in New Issue
Block a user