Merge pull request #59 from alt3ri/patch-5

Edited a bit
This commit is contained in:
Melledy 2022-04-20 13:58:03 -07:00 committed by GitHub
commit 50b5edde6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,7 @@ import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify;
import java.util.List;
@Command(label = "setstats", usage = "setstats <hp|def|atk|em|er|crate|cdmg> <value>",
@Command(label = "setstats", usage = "setstats|stats <stat> <value>",
aliases = {"stats"})
public class SetStats implements CommandHandler {
@ -23,7 +23,8 @@ public class SetStats implements CommandHandler {
String stat = args.get(0);
switch (stat) {
default:
CommandHandler.sendMessage(sender, "Usage: setstats|stats <hp|def|atk|em|er|crate|cdmg> <value>");
CommandHandler.sendMessage(sender, "Usage: /setstats|stats <hp | def | atk | em | er | crate | cdmg> <value> for basic stats");
CommandHandler.sendMessage(sender, "Usage: /stats <epyro | ecryo | ehydro | egeo | edend | eelec | ephys> <amount> for elemental bonus");
return;
case "hp":
try {
@ -115,6 +116,119 @@ public class SetStats implements CommandHandler {
return;
}
break;
case "epyro":
try {
float epyro = Integer.parseInt(args.get(1));
EntityAvatar entity = sender.getTeamManager().getCurrentAvatarEntity();
float pyro = epyro / 10000;
entity.setFightProperty(FightProperty.FIGHT_PROP_FIRE_ADD_HURT, pyro);
entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_FIRE_ADD_HURT));
float igpyro = pyro * 100;
CommandHandler.sendMessage(sender, "Pyro DMG Bonus set to " + igpyro + "%");
} catch (NumberFormatException ignored) {
CommandHandler.sendMessage(sender, "Invalid Pyro DMG Bonus value.");
return;
}
break;
case "ecryo":
try {
float ecryo = Integer.parseInt(args.get(1));
EntityAvatar entity = sender.getTeamManager().getCurrentAvatarEntity();
float cryo = ecryo / 10000;
entity.setFightProperty(FightProperty.FIGHT_PROP_ICE_ADD_HURT, cryo);
entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_ICE_ADD_HURT));
float igcyro = cryo * 100;
CommandHandler.sendMessage(sender, "Cyro DMG Bonus set to " + igcyro + "%");
} catch (NumberFormatException ignored) {
CommandHandler.sendMessage(sender, "Invalid Cryo DMG Bonus value.");
return;
}
break;
case "ehydro":
try {
float ehydro = Integer.parseInt(args.get(1));
EntityAvatar entity = sender.getTeamManager().getCurrentAvatarEntity();
float hydro = ehydro / 10000;
entity.setFightProperty(FightProperty.FIGHT_PROP_WATER_ADD_HURT, hydro);
entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_WATER_ADD_HURT));
float ighydro = hydro * 100;
CommandHandler.sendMessage(sender, "Hydro DMG Bonus set to " + ighydro + "%");
} catch (NumberFormatException ignored) {
CommandHandler.sendMessage(sender, "Invalid Hydro DMG Bonus value.");
return;
}
break;
case "eanemo":
try {
float eanemo = Integer.parseInt(args.get(1));
EntityAvatar entity = sender.getTeamManager().getCurrentAvatarEntity();
float anemo = eanemo / 10000;
entity.setFightProperty(FightProperty.FIGHT_PROP_WIND_ADD_HURT, anemo);
entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_WIND_ADD_HURT));
float iganemo = anemo * 100;
CommandHandler.sendMessage(sender, "Anemo DMG Bonus set to " + iganemo + "%");
} catch (NumberFormatException ignored) {
CommandHandler.sendMessage(sender, "Invalid Anemo DMG Bonus value.");
return;
}
break;
case "egeo":
try {
float egeo = Integer.parseInt(args.get(1));
EntityAvatar entity = sender.getTeamManager().getCurrentAvatarEntity();
float geo = egeo / 10000;
entity.setFightProperty(FightProperty.FIGHT_PROP_ROCK_ADD_HURT, geo);
entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_ROCK_ADD_HURT));
float iggeo = geo * 100;
CommandHandler.sendMessage(sender, "Geo DMG Bonus set to " + iggeo + "%");
} catch (NumberFormatException ignored) {
CommandHandler.sendMessage(sender, "Invalid Geo DMG Bonus value.");
return;
}
break;
case "ethunder":
case "eelec":
try {
float eelec = Integer.parseInt(args.get(1));
EntityAvatar entity = sender.getTeamManager().getCurrentAvatarEntity();
float elec = eelec / 10000;
entity.setFightProperty(FightProperty.FIGHT_PROP_CRITICAL_HURT, elec);
entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CRITICAL_HURT));
float igelec = elec * 100;
CommandHandler.sendMessage(sender, "Electro DMG Bonus set to " + igelec + "%");
} catch (NumberFormatException ignored) {
CommandHandler.sendMessage(sender, "Invalid Electro DMG Bonus value.");
return;
}
break;
case "ephys":
try {
float ephys = Integer.parseInt(args.get(1));
EntityAvatar entity = sender.getTeamManager().getCurrentAvatarEntity();
float phys = ephys / 10000;
entity.setFightProperty(FightProperty.FIGHT_PROP_PHYSICAL_ADD_HURT, phys);
entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_PHYSICAL_ADD_HURT));
float igphys = phys * 100;
CommandHandler.sendMessage(sender, "Physical DMG Bonus set to " + igphys + "%");
} catch (NumberFormatException ignored) {
CommandHandler.sendMessage(sender, "Invalid Physical DMG Bonus value.");
return;
}
break;
case "edend":
try {
float edend = Integer.parseInt(args.get(1));
EntityAvatar entity = sender.getTeamManager().getCurrentAvatarEntity();
float dend = edend / 10000;
entity.setFightProperty(FightProperty.FIGHT_PROP_GRASS_ADD_HURT, dend);
entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_GRASS_ADD_HURT));
float igdend = dend * 100;
CommandHandler.sendMessage(sender, "Dendro DMG Bonus set to " + igdend + "%");
} catch (NumberFormatException ignored) {
CommandHandler.sendMessage(sender, "Invalid Dendro DMG Bonus value.");
return;
}
break;
}
}
}