From 49475a92ddf1a23d482634da2f8fab7cac49515f Mon Sep 17 00:00:00 2001 From: alt3ri <95161279+alt3ri@users.noreply.github.com> Date: Thu, 21 Apr 2022 03:43:57 +0700 Subject: [PATCH 1/2] Adding Elemental DMG Bonus Added Elemental DMG Bonus command. > /stats --- .../command/commands/SetStats.java | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/src/main/java/emu/grasscutter/command/commands/SetStats.java b/src/main/java/emu/grasscutter/command/commands/SetStats.java index f8cac4bf4..ddc8b3aab 100644 --- a/src/main/java/emu/grasscutter/command/commands/SetStats.java +++ b/src/main/java/emu/grasscutter/command/commands/SetStats.java @@ -115,6 +115,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; } } } From 8d4d4a32032763e5c3f036882f0f5b934f8958d5 Mon Sep 17 00:00:00 2001 From: alt3ri <95161279+alt3ri@users.noreply.github.com> Date: Thu, 21 Apr 2022 03:47:17 +0700 Subject: [PATCH 2/2] Added Elemental Bonus Usage: /stats for elemental bonus --- src/main/java/emu/grasscutter/command/commands/SetStats.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/emu/grasscutter/command/commands/SetStats.java b/src/main/java/emu/grasscutter/command/commands/SetStats.java index ddc8b3aab..4ddd60fc0 100644 --- a/src/main/java/emu/grasscutter/command/commands/SetStats.java +++ b/src/main/java/emu/grasscutter/command/commands/SetStats.java @@ -9,7 +9,7 @@ import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify; import java.util.List; -@Command(label = "setstats", usage = "setstats ", +@Command(label = "setstats", usage = "setstats|stats ", 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 "); + CommandHandler.sendMessage(sender, "Usage: /setstats|stats for basic stats"); + CommandHandler.sendMessage(sender, "Usage: /stats for elemental bonus"); return; case "hp": try {