From abe05a9b5d7897aec427a6c38048190d8f8d15f7 Mon Sep 17 00:00:00 2001 From: alt3ri <95161279+alt3ri@users.noreply.github.com> Date: Fri, 22 Apr 2022 02:28:52 +0700 Subject: [PATCH] Added /revive command Now it's more convenient to revive character without food :> --- .../grasscutter/command/commands/Revive.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/main/java/emu/grasscutter/command/commands/Revive.java diff --git a/src/main/java/emu/grasscutter/command/commands/Revive.java b/src/main/java/emu/grasscutter/command/commands/Revive.java new file mode 100644 index 000000000..3f830f3e2 --- /dev/null +++ b/src/main/java/emu/grasscutter/command/commands/Revive.java @@ -0,0 +1,33 @@ +package emu.grasscutter.command.commands; + +import emu.grasscutter.command.Command; +import emu.grasscutter.command.CommandHandler; +import emu.grasscutter.game.GenshinPlayer; +import emu.grasscutter.game.TeamManager; +//import emu.grasscutter.game.avatar.GenshinAvatar; +//import emu.grasscutter.game.TeamInfo; +import emu.grasscutter.game.entity.EntityAvatar; +import emu.grasscutter.game.props.FightProperty; +import emu.grasscutter.server.packet.send.PacketAvatarFightPropUpdateNotify; +import emu.grasscutter.server.packet.send.PacketAvatarLifeStateChangeNotify; + +import java.util.List; + +@Command(label = "revive", aliases = {"rev"}, + usage = "revive|rev", description = "Revive character(s) that died)") +public class Revive implements CommandHandler { + //private Object teamId; + + @Override + public void execute(GenshinPlayer player, List args) { + for (EntityAvatar entity2 : TeamManager.getActiveTeam()) { + entity2.setFightProperty( + FightProperty.FIGHT_PROP_CUR_HP, + entity2.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP) * .4f + ); + player.sendPacket(new PacketAvatarFightPropUpdateNotify(entity2.getAvatar(), FightProperty.FIGHT_PROP_CUR_HP)); + player.sendPacket(new PacketAvatarLifeStateChangeNotify(entity2.getAvatar())); + } + player.dropMessage("Character revived."); + } +}