mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-12 13:24:36 +01:00
Update some commands
This commit is contained in:
@@ -35,22 +35,25 @@ public class CommandArgs {
|
||||
|
||||
try {
|
||||
if (arg.length() >= 2 && !Character.isDigit(arg.charAt(0)) && Character.isDigit(arg.charAt(arg.length() - 1))) {
|
||||
if (arg.startsWith("@")) {
|
||||
if (arg.startsWith("@")) { // Target UID
|
||||
this.targetUid = Utils.parseSafeInt(arg.substring(1));
|
||||
it.remove();
|
||||
} else if (arg.startsWith("x")) {
|
||||
} else if (arg.startsWith("x")) { // Amount
|
||||
this.amount = Utils.parseSafeInt(arg.substring(1));
|
||||
it.remove();
|
||||
} else if (arg.startsWith("lv")) {
|
||||
} else if (arg.startsWith("lv")) { // Level
|
||||
this.level = Utils.parseSafeInt(arg.substring(2));
|
||||
it.remove();
|
||||
} else if (arg.startsWith("r")) {
|
||||
} else if (arg.startsWith("r")) { // Rank
|
||||
this.rank = Utils.parseSafeInt(arg.substring(1));
|
||||
it.remove();
|
||||
} else if (arg.startsWith("p")) {
|
||||
} else if (arg.startsWith("e")) { // Eidolons
|
||||
this.rank = Utils.parseSafeInt(arg.substring(1));
|
||||
it.remove();
|
||||
} else if (arg.startsWith("p")) { // Promotion
|
||||
this.promotion = Utils.parseSafeInt(arg.substring(1));
|
||||
it.remove();
|
||||
} else if (arg.startsWith("s")) {
|
||||
} else if (arg.startsWith("s")) { // Stage or Superimposition
|
||||
this.stage = Utils.parseSafeInt(arg.substring(1));
|
||||
it.remove();
|
||||
}
|
||||
@@ -157,6 +160,9 @@ public class CommandArgs {
|
||||
if (this.getRank() >= 0) {
|
||||
item.setRank(Math.min(this.getRank(), item.getExcel().getEquipmentExcel().getMaxRank()));
|
||||
hasChanged = true;
|
||||
} else if (this.getStage() >= 0) {
|
||||
item.setRank(Math.min(this.getStage(), item.getExcel().getEquipmentExcel().getMaxRank()));
|
||||
hasChanged = true;
|
||||
}
|
||||
} else if (item.getExcel().isRelic()) {
|
||||
// Try to set level
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.util.List;
|
||||
|
||||
import emu.lunarcore.command.Command;
|
||||
import emu.lunarcore.command.CommandArgs;
|
||||
import java.util.stream.Collectors;
|
||||
import emu.lunarcore.command.CommandHandler;
|
||||
import emu.lunarcore.data.GameData;
|
||||
import emu.lunarcore.data.excel.ItemExcel;
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
package emu.lunarcore.command.commands;
|
||||
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.command.Command;
|
||||
import emu.lunarcore.command.CommandArgs;
|
||||
import emu.lunarcore.command.CommandHandler;
|
||||
import emu.lunarcore.server.packet.send.PacketSyncLineupNotify;
|
||||
import emu.lunarcore.game.player.lineup.LineupManager;
|
||||
import emu.lunarcore.game.player.lineup.PlayerLineup;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
|
||||
@@ -14,21 +11,20 @@ public class HealCommand implements CommandHandler {
|
||||
|
||||
@Override
|
||||
public void execute(Player sender, CommandArgs args) {
|
||||
// Check target
|
||||
if (args.getTarget() == null) {
|
||||
this.sendMessage(sender, "Error: Targeted player not found or offline");
|
||||
return;
|
||||
}
|
||||
|
||||
LineupManager lineupManager = sender.getLineupManager();
|
||||
PlayerLineup lineup = lineupManager.getLineupByIndex(lineupManager.getCurrentIndex());
|
||||
|
||||
PlayerLineup lineup = args.getTarget().getCurrentLineup();
|
||||
lineup.forEachAvatar(avatar -> {
|
||||
avatar.setCurrentHp(lineup, 10000);
|
||||
avatar.save();
|
||||
});
|
||||
lineup.refreshLineup();
|
||||
|
||||
lineup.save();
|
||||
|
||||
sender.getScene().syncLineup();
|
||||
sender.sendPacket(new PacketSyncLineupNotify(lineup));
|
||||
|
||||
this.sendMessage(sender, "Healed all avatars.");
|
||||
this.sendMessage(sender, "Healed all avatars for " + args.getTarget().getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
package emu.lunarcore.command.commands;
|
||||
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.GameConstants;
|
||||
import emu.lunarcore.command.Command;
|
||||
import emu.lunarcore.command.CommandArgs;
|
||||
import emu.lunarcore.command.CommandHandler;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
import emu.lunarcore.game.player.lineup.PlayerLineup;
|
||||
|
||||
@Command(label = "refill", aliases = {"rf"}, permission = "player.refill", desc = "/refill - refill your skill points in open world.")
|
||||
public class RefillMPCommand implements CommandHandler {
|
||||
|
||||
@Override
|
||||
public void execute(Player sender, CommandArgs args) {
|
||||
PlayerLineup lineup = sender.getCurrentLineup();
|
||||
lineup.addMp(GameConstants.MAX_MP);
|
||||
this.sendMessage(sender, "Successfully refilled skill points.");
|
||||
// Check target
|
||||
if (args.getTarget() == null) {
|
||||
this.sendMessage(sender, "Error: Targeted player not found or offline");
|
||||
return;
|
||||
}
|
||||
|
||||
sender.getCurrentLineup().addMp(GameConstants.MAX_MP);
|
||||
this.sendMessage(sender, "Successfully refilled skill points for " + args.getTarget().getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
package emu.lunarcore.command.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import emu.lunarcore.command.Command;
|
||||
import emu.lunarcore.game.avatar.GameAvatar;
|
||||
import emu.lunarcore.game.player.lineup.PlayerLineup;
|
||||
import emu.lunarcore.command.CommandArgs;
|
||||
import emu.lunarcore.command.CommandHandler;
|
||||
@@ -15,18 +11,20 @@ public class RefillSPCommand implements CommandHandler {
|
||||
|
||||
@Override
|
||||
public void execute(Player sender, CommandArgs args) {
|
||||
// Check target
|
||||
if (args.getTarget() == null) {
|
||||
this.sendMessage(sender, "Error: Targeted player not found or offline");
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerLineup lineup = sender.getCurrentLineup();
|
||||
for (int i = 0; i < lineup.getAvatars().size(); i++) {
|
||||
GameAvatar avatar = sender.getAvatarById(lineup.getAvatars().get(i));
|
||||
if (avatar == null) continue;
|
||||
PlayerLineup lineup = args.getTarget().getCurrentLineup();
|
||||
lineup.forEachAvatar(avatar -> {
|
||||
avatar.setCurrentSp(lineup, 10000);
|
||||
avatar.save();
|
||||
}
|
||||
lineup.save();
|
||||
|
||||
});
|
||||
lineup.refreshLineup();
|
||||
this.sendMessage(sender, "Refilled SP");
|
||||
|
||||
this.sendMessage(sender, "Refilled SP for " + args.getTarget().getName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,22 +1,26 @@
|
||||
package emu.lunarcore.command.commands;
|
||||
|
||||
import emu.lunarcore.util.Utils;
|
||||
import emu.lunarcore.LunarCore;
|
||||
import emu.lunarcore.GameConstants;
|
||||
import emu.lunarcore.command.Command;
|
||||
import emu.lunarcore.command.CommandArgs;
|
||||
import emu.lunarcore.command.CommandHandler;
|
||||
import emu.lunarcore.game.player.Player;
|
||||
|
||||
@Command(label = "setlevel", aliases = {"level"}, permission = "player.setlevel", desc = "/setlevel - Set your Equilibrium level.")
|
||||
@Command(label = "setlevel", aliases = {"level"}, permission = "player.setlevel", desc = "/setlevel [level] - Sets the targeted player's trailblazer level.")
|
||||
public class SetLevelCommand implements CommandHandler {
|
||||
|
||||
@Override
|
||||
public void execute(Player sender, CommandArgs args) {
|
||||
// Check target
|
||||
if (args.getTarget() == null) {
|
||||
this.sendMessage(sender, "Error: Targeted player not found or offline");
|
||||
return;
|
||||
}
|
||||
|
||||
int targetLevel = Utils.parseSafeInt(args.get(0));
|
||||
sender.setLevel(targetLevel);
|
||||
args.getTarget().setLevel(targetLevel);
|
||||
|
||||
this.sendMessage(sender, "Set level to "+args.get(0));
|
||||
this.sendMessage(sender, "Set level to " + targetLevel);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public class Player {
|
||||
@Setter private PlayerGender gender;
|
||||
|
||||
private int level;
|
||||
private int exp;
|
||||
private int exp; // Total exp
|
||||
private int worldLevel;
|
||||
private int scoin; // Credits
|
||||
private int hcoin; // Jade
|
||||
@@ -190,11 +190,8 @@ public class Player {
|
||||
}
|
||||
|
||||
public void setLevel(int newLevel) {
|
||||
if (newLevel >= 71) {
|
||||
newLevel = 70;
|
||||
}
|
||||
this.level = (newLevel);
|
||||
this.exp = 0;
|
||||
this.level = Math.max(Math.min(newLevel, GameConstants.MAX_TRAILBLAZER_LEVEL), 1);
|
||||
this.exp = GameData.getPlayerExpRequired(this.level);
|
||||
this.sendPacket(new PacketPlayerSyncScNotify(this));
|
||||
this.save();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user