Remove BPLevel, GodMode, NoStamina, SetWorldLevel, UnlimitEnergy, UnlockTower commands

This commit is contained in:
AnimeGitB 2022-06-25 02:04:29 +09:30 committed by Melledy
parent fc9acf42c2
commit 9425f672e0
20 changed files with 334 additions and 390 deletions

View File

@ -1,35 +0,0 @@
package emu.grasscutter.command.commands;
import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.game.player.Player;
import java.util.List;
import static emu.grasscutter.utils.Language.translate;
@Command(label = "godmode", usage = "godmode [on|off|toggle]", permission = "player.godmode", permissionTargeted = "player.godmode.others", description = "commands.godmode.description")
public final class GodModeCommand implements CommandHandler {
@Override
public void execute(Player sender, Player targetPlayer, List<String> args) {
boolean enabled = !targetPlayer.inGodmode();
if (args.size() == 1) {
switch (args.get(0).toLowerCase()) {
case "on":
enabled = true;
break;
case "off":
enabled = false;
break;
case "toggle":
break; // Already toggled
default:
break;
}
}
targetPlayer.setGodmode(enabled);
CommandHandler.sendMessage(sender, translate(sender, "commands.godmode.success", (enabled ? translate(sender, "commands.status.enabled") : translate(sender, "commands.status.disabled")), targetPlayer.getNickname()));
}
}

View File

@ -1,34 +0,0 @@
package emu.grasscutter.command.commands;
import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.game.player.Player;
import java.util.List;
import static emu.grasscutter.utils.Language.translate;
@Command(label = "nostamina", usage = "nostamina [on|off|toggle]", aliases = {"ns"}, permission = "player.nostamina", permissionTargeted = "player.nostamina.others", description = "commands.nostamina.description")
public final class NoStaminaCommand implements CommandHandler {
@Override
public void execute(Player sender, Player targetPlayer, List<String> args) {
boolean stamina = !targetPlayer.getStamina();
if (args.size() == 1) {
switch (args.get(0).toLowerCase()) {
case "on":
stamina = true;
break;
case "off":
stamina = false;
break;
default:
// toggled
break;
}
}
targetPlayer.setStamina(stamina); //Set
CommandHandler.sendMessage(sender, translate(sender, "commands.nostamina.success", (stamina ? translate(sender, "commands.status.enabled") : translate(sender, "commands.status.disabled")), targetPlayer.getNickname()));
}
}

View File

@ -1,22 +0,0 @@
package emu.grasscutter.command.commands;
import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.game.player.Player;
import java.util.List;
@Command(label = "setbp", usage = "", aliases = "bp",permission = "player.setbp", description = "")
public final class SetBPLevelCommand implements CommandHandler {
@Override
public void execute(Player sender, Player targetPlayer, List<String> args) {
if (args.size() < 1) {
CommandHandler.sendMessage(sender , "Need a arg");
return;
}
int level = Integer.parseInt(args.get(0));
sender.getBattlePassManager().addPoints(level);
}
}

View File

@ -0,0 +1,205 @@
package emu.grasscutter.command.commands;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.props.PlayerProperty;
import emu.grasscutter.game.tower.TowerLevelRecord;
@Command(label = "setprop", usage = "setprop|prop <prop> <value>", aliases = {"prop"}, permission = "player.setprop", permissionTargeted = "player.setprop.others", description = "commands.setProp.description")
public final class SetPropCommand implements CommandHandler {
static enum PseudoProp {
NONE,
WORLD_LEVEL,
TOWER_LEVEL,
BP_LEVEL,
GOD_MODE,
NO_STAMINA,
UNLIMITED_ENERGY
}
static class Prop {
String name;
PlayerProperty prop;
PseudoProp pseudoProp;
public Prop(PlayerProperty prop) {
this(prop.toString(), prop, PseudoProp.NONE);
}
public Prop(String name) {
this(name, PlayerProperty.PROP_NONE, PseudoProp.NONE);
}
public Prop(String name, PseudoProp pseudoProp) {
this(name, PlayerProperty.PROP_NONE, pseudoProp);
}
public Prop(String name, PlayerProperty prop) {
this(name, prop, PseudoProp.NONE);
}
public Prop(String name, PlayerProperty prop, PseudoProp pseudoProp) {
this.name = name;
this.prop = prop;
this.pseudoProp = pseudoProp;
}
}
Map<String, Prop> props;
public SetPropCommand() {
this.props = new HashMap<>();
// Full PlayerProperty enum that won't be advertised but can be used by devs
for (PlayerProperty prop : PlayerProperty.values()) {
String name = prop.toString().substring(5); // PROP_EXP -> EXP
String key = name.toLowerCase(); // EXP -> exp
this.props.put(key, new Prop(name, prop));
}
// Add special props
Prop worldlevel = new Prop("World Level", PlayerProperty.PROP_PLAYER_WORLD_LEVEL, PseudoProp.WORLD_LEVEL);
this.props.put("worldlevel", worldlevel);
this.props.put("wl", worldlevel);
Prop abyss = new Prop("Tower Level", PseudoProp.TOWER_LEVEL);
this.props.put("abyss", abyss);
this.props.put("abyssfloor", abyss);
this.props.put("ut", abyss);
this.props.put("tower", abyss);
this.props.put("towerlevel", abyss);
this.props.put("unlocktower", abyss);
Prop bplevel = new Prop("BP Level", PseudoProp.BP_LEVEL);
this.props.put("bplevel", bplevel);
this.props.put("bp", bplevel);
this.props.put("battlepass", bplevel);
Prop godmode = new Prop("godmode", PseudoProp.GOD_MODE);
this.props.put("godmode", godmode);
this.props.put("god", godmode);
Prop nostamina = new Prop("nostamina", PseudoProp.NO_STAMINA);
this.props.put("nostamina", nostamina);
this.props.put("nostam", nostamina);
this.props.put("ns", nostamina);
Prop unlimitedenergy = new Prop("unlimitedenergy", PseudoProp.UNLIMITED_ENERGY);
this.props.put("unlimitedenergy", unlimitedenergy);
this.props.put("ue", unlimitedenergy);
}
@Override
public void execute(Player sender, Player targetPlayer, List<String> args) {
if (args.size() != 2) {
CommandHandler.sendTranslatedMessage(sender, "commands.setProp.usage");
return;
}
String propStr = args.get(0).toLowerCase();
String valueStr = args.get(1).toLowerCase();
int value;
if (!props.containsKey(propStr)) {
CommandHandler.sendTranslatedMessage(sender, "commands.setProp.usage");
return;
}
try {
value = switch(valueStr.toLowerCase()) {
case "on", "true" -> 1;
case "off", "false" -> 0;
case "toggle" -> -1;
default -> Integer.parseInt(valueStr);
};
} catch (NumberFormatException ignored) {
CommandHandler.sendTranslatedMessage(sender, "commands.execution.argument_error");
return;
}
boolean success = false;
Prop prop = props.get(propStr);
success = switch (prop.pseudoProp) {
case WORLD_LEVEL -> targetPlayer.setWorldLevel(value);
case BP_LEVEL -> targetPlayer.getBattlePassManager().setLevel(value);
case TOWER_LEVEL -> this.setTowerLevel(sender, targetPlayer, value);
case GOD_MODE, NO_STAMINA, UNLIMITED_ENERGY -> this.setBool(sender, targetPlayer, prop.pseudoProp, value);
default -> targetPlayer.setProperty(prop.prop, value);
};
if (success) {
if (targetPlayer == sender) {
CommandHandler.sendTranslatedMessage(sender, "commands.generic.set_to", prop.name, valueStr);
} else {
String uidStr = targetPlayer.getAccount().getId();
CommandHandler.sendTranslatedMessage(sender, "commands.generic.set_for_to", prop.name, uidStr, valueStr);
}
} else {
if (prop.prop != PlayerProperty.PROP_NONE) { // PseudoProps need to do their own error messages
String min = Integer.toString(targetPlayer.getPropertyMin(prop.prop));
String max = Integer.toString(targetPlayer.getPropertyMax(prop.prop));
CommandHandler.sendTranslatedMessage(sender, "commands.generic.invalid.value_between", prop.name, min, max);
}
}
}
private boolean setTowerLevel(Player sender, Player targetPlayer, int topFloor) {
List<Integer> floorIds = targetPlayer.getServer().getTowerScheduleManager().getAllFloors();
if (topFloor < 0 || topFloor > floorIds.size()) {
String min = Integer.toString(0);
String max = Integer.toString(floorIds.size());
CommandHandler.sendTranslatedMessage(sender, "commands.generic.invalid.value_between", "Tower Level", min, max);
return false;
}
Map<Integer, TowerLevelRecord> recordMap = targetPlayer.getTowerManager().getRecordMap();
// Add records for each unlocked floor
for (int floor : floorIds.subList(0, topFloor)) {
if (!recordMap.containsKey(floor)) {
recordMap.put(floor, new TowerLevelRecord(floor));
}
}
// Remove records for each floor past our target
for (int floor : floorIds.subList(topFloor, floorIds.size())) {
if (recordMap.containsKey(floor)) {
recordMap.remove(floor);
}
}
// Six stars required on Floor 8 to unlock Floor 9+
if (topFloor > 8) {
recordMap.get(floorIds.get(7)).setLevelStars(0, 6); // levelIds seem to start at 1 for Floor 1 Chamber 1, so this doesn't get shown at all
}
return true;
}
private boolean setBool(Player sender, Player targetPlayer, PseudoProp pseudoProp, int value) {
boolean enabled = switch (pseudoProp) {
case GOD_MODE -> targetPlayer.inGodmode();
case NO_STAMINA -> targetPlayer.getUnlimitedStamina();
case UNLIMITED_ENERGY -> !targetPlayer.getEnergyManager().getEnergyUsage();
default -> false;
};
enabled = switch (value) {
case -1 -> !enabled;
case 0 -> false;
default -> true;
};
switch (pseudoProp) {
case GOD_MODE:
targetPlayer.setGodmode(enabled);
break;
case NO_STAMINA:
targetPlayer.setUnlimitedStamina(enabled);
break;
case UNLIMITED_ENERGY:
targetPlayer.getEnergyManager().setEnergyUsage(!enabled);
break;
default:
return false;
}
return true;
}
}

View File

@ -10,7 +10,6 @@ import emu.grasscutter.game.entity.EntityAvatar;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.props.FightProperty;
import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify;
import static emu.grasscutter.utils.Language.translate;
@Command(label = "setstats", usage = "setstats|stats <stat> <value>", aliases = {"stats"}, permission = "player.setstats", permissionTargeted = "player.setstats.others", description = "commands.setStats.description")
public final class SetStatsCommand implements CommandHandler {
@ -65,8 +64,6 @@ public final class SetStatsCommand implements CommandHandler {
@Override
public void execute(Player sender, Player targetPlayer, List<String> args) {
String syntax = sender == null ? translate(sender, "commands.setStats.usage_console") : translate(sender, "commands.setStats.usage_ingame");
String usage = syntax + translate(sender, "commands.setStats.help_message");
String statStr;
String valueStr;
@ -74,7 +71,7 @@ public final class SetStatsCommand implements CommandHandler {
statStr = args.get(0).toLowerCase();
valueStr = args.get(1);
} else {
CommandHandler.sendMessage(sender, usage);
CommandHandler.sendTranslatedMessage(sender, "commands.setStats.usage");
return;
}
@ -88,7 +85,7 @@ public final class SetStatsCommand implements CommandHandler {
value = Float.parseFloat(valueStr);
}
} catch (NumberFormatException ignored) {
CommandHandler.sendMessage(sender, translate(sender, "commands.setStats.value_error"));
CommandHandler.sendTranslatedMessage(sender, "commands.generic.invalid.statValue");
return;
}
@ -102,13 +99,13 @@ public final class SetStatsCommand implements CommandHandler {
valueStr = String.format("%.0f", value);
}
if (targetPlayer == sender) {
CommandHandler.sendMessage(sender, translate(sender, "commands.setStats.set_self", stat.name, valueStr));
CommandHandler.sendTranslatedMessage(sender, "commands.generic.set_to", stat.name, valueStr);
} else {
String uidStr = targetPlayer.getAccount().getId();
CommandHandler.sendMessage(sender, translate(sender, "commands.setStats.set_for_uid", stat.name, uidStr, valueStr));
CommandHandler.sendTranslatedMessage(sender, "commands.generic.set_for_to", stat.name, uidStr, valueStr);
}
} else {
CommandHandler.sendMessage(sender, usage);
CommandHandler.sendTranslatedMessage(sender, "commands.setStats.usage");
}
return;
}

View File

@ -1,39 +0,0 @@
package emu.grasscutter.command.commands;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.game.player.Player;
import java.util.List;
import static emu.grasscutter.utils.Language.translate;
@Command(label = "setworldlevel", usage = "setworldlevel <level>",
aliases = {"setworldlvl"}, permission = "player.setworldlevel", permissionTargeted = "player.setworldlevel.others", description = "commands.setWorldLevel.description")
public final class SetWorldLevelCommand implements CommandHandler {
@Override
public void execute(Player sender, Player targetPlayer, List<String> args) {
if (args.size() < 1) {
CommandHandler.sendMessage(sender, translate(sender, "commands.setWorldLevel.usage"));
return;
}
try {
int level = Integer.parseInt(args.get(0));
if (level > 8 || level < 0) {
CommandHandler.sendMessage(sender, translate(sender, "commands.setWorldLevel.value_error"));
return;
}
// Set in both world and player props
targetPlayer.getWorld().setWorldLevel(level);
targetPlayer.setWorldLevel(level);
CommandHandler.sendMessage(sender, translate(sender, "commands.setWorldLevel.success", Integer.toString(level)));
} catch (NumberFormatException ignored) {
CommandHandler.sendMessage(null, translate(sender, "commands.setWorldLevel.invalid_world_level"));
}
}
}

View File

@ -1,55 +0,0 @@
package emu.grasscutter.command.commands;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.entity.EntityAvatar;
import emu.grasscutter.game.managers.energy.EnergyManager;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.player.TeamManager;
import emu.grasscutter.game.props.ElementType;
import emu.grasscutter.net.proto.PropChangeReasonOuterClass;
import emu.grasscutter.utils.Position;
import java.util.List;
import static emu.grasscutter.Configuration.GAME_OPTIONS;
import static emu.grasscutter.utils.Language.translate;
@Command(label = "unlimitenergy", usage = "unlimitenergy [on|off|toggle]", aliases = {"ule"}, permission = "player.unlimitenergy", permissionTargeted = "player.unlimitenergy.others", description = "commands.unlimitenergy.description")
public final class UnlimitEnergyCommand implements CommandHandler {
@Override
public void execute(Player sender, Player targetPlayer, List<String> args) {
if(!GAME_OPTIONS.energyUsage){
CommandHandler.sendMessage(sender, translate(sender, "commands.unlimitenergy.config_error"));
return;
}
Boolean status = targetPlayer.getEnergyManager().getEnergyUsage();
if (args.size() == 1) {
switch (args.get(0).toLowerCase()) {
case "on":
status = true;
break;
case "off":
status = false;
break;
default:
status = !status;
break;
}
}
EnergyManager energyManager=targetPlayer.getEnergyManager();
energyManager.setEnergyUsage(!status);
// if unlimitEnergy is enable , make currentActiveTeam's Avatar full-energy
if (status) {
for (EntityAvatar entityAvatar : targetPlayer.getTeamManager().getActiveTeam()) {
entityAvatar.addEnergy(1000,
PropChangeReasonOuterClass.PropChangeReason.PROP_CHANGE_REASON_GM,true);
}
}
CommandHandler.sendMessage(sender, translate(sender, "commands.unlimitenergy.success", (status ? translate(sender, "commands.status.enabled") : translate(sender, "commands.status.disabled")), targetPlayer.getNickname()));
}
}

View File

@ -1,32 +0,0 @@
package emu.grasscutter.command.commands;
import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.tower.TowerLevelRecord;
import java.util.List;
import static emu.grasscutter.utils.Language.translate;
@Command(label = "unlocktower", usage = "unlocktower", aliases = {"ut"}, permission = "player.unlocktower", permissionTargeted = "player.unlocktower.others",
description = "commands.unlocktower.description")
public class UnlockTowerCommand implements CommandHandler {
@Override
public void execute(Player sender, Player targetPlayer, List<String> args) {
unlockFloor(targetPlayer, targetPlayer.getServer().getTowerScheduleManager()
.getCurrentTowerScheduleData().getEntranceFloorId());
unlockFloor(targetPlayer, targetPlayer.getServer().getTowerScheduleManager()
.getScheduleFloors());
CommandHandler.sendMessage(sender, translate(sender, "commands.unlocktower.success"));
}
public void unlockFloor(Player player, List<Integer> floors){
floors.stream()
.filter(id -> !player.getTowerManager().getRecordMap().containsKey(id))
.forEach(id -> player.getTowerManager().getRecordMap().put(id, new TowerLevelRecord(id)));
}
}

View File

@ -31,19 +31,20 @@ import emu.grasscutter.net.proto.BattlePassScheduleOuterClass.BattlePassSchedule
import emu.grasscutter.server.packet.send.PacketBattlePassCurScheduleUpdateNotify;
import emu.grasscutter.server.packet.send.PacketBattlePassMissionUpdateNotify;
import emu.grasscutter.server.packet.send.PacketTakeBattlePassRewardRsp;
import lombok.Getter;
@Entity(value = "battlepass", useDiscriminator = false)
public class BattlePassManager {
@Id private ObjectId id;
@Transient private Player player;
@Id @Getter private ObjectId id;
@Transient @Getter private Player player;
@Indexed private int ownerUid;
private int point;
private int cyclePoints; // Weekly maximum cap
private int level;
@Getter private int point;
@Getter private int cyclePoints; // Weekly maximum cap
@Getter private int level;
private boolean viewed;
private boolean paid;
@Getter private boolean viewed;
@Getter private boolean paid;
private Map<Integer, BattlePassMission> missions;
private Map<Integer, BattlePassReward> takenRewards;
@ -55,52 +56,34 @@ public class BattlePassManager {
this.setPlayer(player);
}
public ObjectId getId() {
return id;
}
public Player getPlayer() {
return this.player;
}
public void setPlayer(Player player) {
this.player = player;
this.ownerUid = player.getUid();
}
public int getPoint() {
return this.point;
}
public int getCyclePoints() {
return cyclePoints;
}
public int getLevel() {
return this.level;
}
public boolean isViewed() {
return viewed;
}
public void updateViewed() {
this.viewed = true;
}
public boolean isPaid() {
return paid;
public boolean setLevel(int level) {
if (level >= 0 && level <= GameConstants.BATTLE_PASS_MAX_LEVEL) {
this.level = level;
this.point = 0;
this.player.sendPacket(new PacketBattlePassCurScheduleUpdateNotify(this.player));
return true;
}
return false;
}
public void addPoints(int point){
this.addPointsDirectly(point, false);
public void addPoints(int points){
this.addPointsDirectly(points, false);
player.getSession().send(new PacketBattlePassCurScheduleUpdateNotify(player.getSession().getPlayer()));
this.player.sendPacket(new PacketBattlePassCurScheduleUpdateNotify(player));
this.save();
}
public void addPointsDirectly(int point, boolean isWeekly) {
int amount = point;
public void addPointsDirectly(int points, boolean isWeekly) {
int amount = points;
if (isWeekly) {
amount = Math.min(amount, GameConstants.BATTLE_PASS_POINT_PER_WEEK - this.cyclePoints);
@ -114,7 +97,7 @@ public class BattlePassManager {
this.cyclePoints += amount;
if (this.point >= GameConstants.BATTLE_PASS_POINT_PER_LEVEL && this.getLevel() < GameConstants.BATTLE_PASS_MAX_LEVEL) {
int levelups = (int) Math.floor((float) this.point / GameConstants.BATTLE_PASS_POINT_PER_LEVEL);
int levelups = Math.floorDiv(this.point, GameConstants.BATTLE_PASS_POINT_PER_LEVEL);
// Make sure player cant go above max BP level
levelups = Math.min(levelups, GameConstants.BATTLE_PASS_MAX_LEVEL - levelups);

View File

@ -446,5 +446,10 @@ public class EnergyManager {
public void setEnergyUsage(Boolean energyUsage) {
this.energyUsage = energyUsage;
if (!energyUsage) { // Refill team energy if usage is disabled
for (EntityAvatar entityAvatar : player.getTeamManager().getActiveTeam()) {
entityAvatar.addEnergy(1000, PropChangeReason.PROP_CHANGE_REASON_GM,true);
}
}
}
}

View File

@ -283,7 +283,7 @@ public class StaminaManager {
// Returns new stamina and sends PlayerPropNotify or VehicleStaminaNotify
public int setStamina(GameSession session, String reason, int newStamina, boolean isCharacterStamina) {
// Target Player
if (!GAME_OPTIONS.staminaUsage || session.getPlayer().getStamina()) {
if (!GAME_OPTIONS.staminaUsage || session.getPlayer().getUnlimitedStamina()) {
newStamina = getMaxCharacterStamina();
}

View File

@ -437,12 +437,13 @@ public class Player {
return this.getProperty(PlayerProperty.PROP_PLAYER_LEVEL);
}
public void setLevel(int level) {
this.setProperty(PlayerProperty.PROP_PLAYER_LEVEL, level);
this.sendPacket(new PacketPlayerPropNotify(this, PlayerProperty.PROP_PLAYER_LEVEL));
this.updateWorldLevel();
this.updateProfile();
public boolean setLevel(int level) {
if (this.setProperty(PlayerProperty.PROP_PLAYER_LEVEL, level)) {
this.updateWorldLevel();
this.updateProfile();
return true;
}
return false;
}
public int getExp() {
@ -452,59 +453,59 @@ public class Player {
public int getWorldLevel() {
return this.getProperty(PlayerProperty.PROP_PLAYER_WORLD_LEVEL);
}
public void setWorldLevel(int level) {
this.getWorld().setWorldLevel(level);
this.setProperty(PlayerProperty.PROP_PLAYER_WORLD_LEVEL, level);
this.sendPacket(new PacketPlayerPropNotify(this, PlayerProperty.PROP_PLAYER_WORLD_LEVEL));
this.updateProfile();
public boolean setWorldLevel(int level) {
if (this.setProperty(PlayerProperty.PROP_PLAYER_WORLD_LEVEL, level)) {
if (this.world.getHost() == this) // Don't update World's WL if we are in someone else's world
this.world.setWorldLevel(level);
this.updateProfile();
return true;
}
return false;
}
public int getForgePoints() {
return this.getProperty(PlayerProperty.PROP_PLAYER_FORGE_POINT);
}
public void setForgePoints(int value) {
public boolean setForgePoints(int value) {
if (value == this.getForgePoints()) {
return;
return true;
}
this.setProperty(PlayerProperty.PROP_PLAYER_FORGE_POINT, value);
this.sendPacket(new PacketPlayerPropNotify(this, PlayerProperty.PROP_PLAYER_FORGE_POINT));
return this.setProperty(PlayerProperty.PROP_PLAYER_FORGE_POINT, value);
}
public int getPrimogems() {
return this.getProperty(PlayerProperty.PROP_PLAYER_HCOIN);
}
public void setPrimogems(int primogem) {
this.setProperty(PlayerProperty.PROP_PLAYER_HCOIN, primogem);
public boolean setPrimogems(int primogem) {
return this.setProperty(PlayerProperty.PROP_PLAYER_HCOIN, primogem);
}
public int getMora() {
return this.getProperty(PlayerProperty.PROP_PLAYER_SCOIN);
}
public void setMora(int mora) {
this.setProperty(PlayerProperty.PROP_PLAYER_SCOIN, mora);
public boolean setMora(int mora) {
return this.setProperty(PlayerProperty.PROP_PLAYER_SCOIN, mora);
}
public int getCrystals() {
return this.getProperty(PlayerProperty.PROP_PLAYER_MCOIN);
}
public void setCrystals(int crystals) {
this.setProperty(PlayerProperty.PROP_PLAYER_MCOIN, crystals);
public boolean setCrystals(int crystals) {
return this.setProperty(PlayerProperty.PROP_PLAYER_MCOIN, crystals);
}
public int getHomeCoin() {
return this.getProperty(PlayerProperty.PROP_PLAYER_HOME_COIN);
}
public void setHomeCoin(int coin) {
this.setProperty(PlayerProperty.PROP_PLAYER_HOME_COIN, coin);
public boolean setHomeCoin(int coin) {
return this.setProperty(PlayerProperty.PROP_PLAYER_HOME_COIN, coin);
}
private int getExpRequired(int level) {
PlayerLevelData levelData = GameData.getPlayerLevelDataMap().get(level);
@ -581,7 +582,7 @@ public class Player {
}
public TowerData getTowerData() {
if(towerData==null){
if (towerData == null) {
// because of mistake, null may be saved as storage at some machine, this if can be removed in future
towerData = new TowerData();
}
@ -953,12 +954,10 @@ public class Player {
}
this.save();
}
public boolean getStamina() {
// Get Stamina
public boolean getUnlimitedStamina() {
return stamina;
}
public void setStamina(boolean stamina) {
// Set Stamina
public void setUnlimitedStamina(boolean stamina) {
this.stamina = stamina;
}
public boolean inGodmode() {

View File

@ -6,6 +6,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
public enum PlayerProperty {
PROP_NONE (0),
PROP_EXP (1001, 0),
PROP_BREAK_LEVEL (1002),
PROP_SATIATION_VAL (1003),

View File

@ -9,6 +9,7 @@ import emu.grasscutter.server.game.GameServer;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
import static emu.grasscutter.Configuration.*;
@ -49,6 +50,12 @@ public class TowerScheduleManager {
return data;
}
public List<Integer> getAllFloors() {
List<Integer> floors = new ArrayList<>(this.getCurrentTowerScheduleData().getEntranceFloorId());
floors.addAll(this.getScheduleFloors());
return floors;
}
public List<Integer> getScheduleFloors() {
return getCurrentTowerScheduleData().getSchedules().get(0).getFloorList();
}

View File

@ -66,6 +66,8 @@
"command_exist_error": "No command found.",
"no_usage_specified": "No usage specified",
"no_description_specified": "No description specified",
"set_to": "%s set to %s.",
"set_for_to": "%s for %s set to %s.",
"invalid": {
"amount": "Invalid amount.",
"artifactId": "Invalid artifact ID.",
@ -75,6 +77,8 @@
"itemId": "Invalid item ID.",
"itemLevel": "Invalid itemLevel.",
"itemRefinement": "Invalid itemRefinement.",
"statValue": "Invalid stat value.",
"value_between": "Invalid value: %s must be between %s and %s.",
"playerId": "Invalid player ID.",
"uid": "Invalid UID.",
"id": "Invalid ID."
@ -143,10 +147,6 @@
"giveall_success": "Successfully gave all items.",
"description": "Gives an item to you or the specified player. Can also give all weapons, avatars and/or materials, and can construct custom artifacts."
},
"godmode": {
"success": "Godmode is now %s for %s.",
"description": "Prevents you from taking damage. Defaults to toggle."
},
"heal": {
"success": "All characters have been healed.",
"description": "Heal all characters in your current team."
@ -243,9 +243,9 @@
"description": "Sends mail to the specified user. The usage of this command changes based on its composition state"
},
"sendMessage": {
"usage": "Usage: sendmessage <player> <message>",
"usage": "Usage: sendmessage <message>",
"success": "Message sent.",
"description": "Sends a message to a player as the server"
"description": "Sends a message to a player as the server. If used with no target, sends to all players on the server."
},
"setFetterLevel": {
"usage": "Usage: setfetterlevel <level>",
@ -254,24 +254,13 @@
"level_error": "Invalid fetter level.",
"description": "Sets your fetter level for your current active character"
},
"setStats": {
"usage_console": "Usage: setstats|stats @<UID> <stat> <value>",
"usage_ingame": "Usage: setstats|stats [@UID] <stat> <value>",
"help_message": "\n\tValues for <stat>: hp | maxhp | def | atk | em | er | crate | cdmg | cdr | heal | heali | shield | defi\n\t(cont.) Elemental DMG Bonus: epyro | ecryo | ehydro | egeo | edendro | eelectro | ephys\n\t(cont.) Elemental RES: respyro | rescryo | reshydro | resgeo | resdendro | reselectro | resphys\n",
"value_error": "Invalid stat value.",
"uid_error": "Invalid UID.",
"player_error": "Player not found or offline.",
"set_self": "%s set to %s.",
"set_for_uid": "%s for %s set to %s.",
"set_max_hp": "MAX HP set to %s.",
"description": "Sets fight property for your current active character"
"setProp": {
"usage": "Usage: setprop|prop <prop> <value>\n\tValues for <prop>: godmode | nostamina | unlimitedenergy | abyssfloor | worldlevel | bplevel\n\t(cont.) see PlayerProperty enum for other possible values, of form PROP_MAX_SPRING_VOLUME -> max_spring_volume",
"description": "Sets accountwide properties. Things like godmode can be enabled this way, as well as changing things like unlocked abyss floor and battle pass progress."
},
"setWorldLevel": {
"usage": "Usage: setworldlevel <level>",
"value_error": "World level must be between 0-8.",
"success": "World level set to %s.",
"invalid_world_level": "Invalid world level.",
"description": "Sets your world level (Relog to see proper effects)"
"setStats": {
"usage": "Usage: setstats|stats <stat> <value>\n\tValues for <stat>: hp | maxhp | def | atk | em | er | crate | cdmg | cdr | heal | heali | shield | defi\n\t(cont.) Elemental DMG Bonus: epyro | ecryo | ehydro | egeo | edendro | eelectro | ephys\n\t(cont.) Elemental RES: respyro | rescryo | reshydro | resgeo | resdendro | reselectro | resphys\n",
"description": "Sets fight property for your current active character"
},
"spawn": {
"usage": "Usage: spawn <entityID> [amount] [level(monster only)] [<x> <y> <z>(monster only, optional)]",
@ -332,15 +321,6 @@
"success": "Teleported %s to %s, %s, %s in scene %s.",
"description": "Change the player's position"
},
"unlimitenergy": {
"success": "UnlimitEnergy is now %s for %s.",
"config_error": "Command is disabled, because energyUsage is false in config.json.",
"description": "Use the element does not waste energy"
},
"unlocktower": {
"success": "Abyss Corridor's Floors are all unlocked now.",
"description": "Unlock all levels of tower"
},
"weather": {
"usage": "Usage: weather [weatherId] [climateType]\nWeather IDs can be found in WeatherExcelConfigData.json.\nClimate types: sunny, cloudy, rain, thunderstorm, snow, mist",
"success": "Set weather ID to %s with climate type %s.",

View File

@ -66,6 +66,8 @@
"command_exist_error": "Aucune commande trouvée.",
"no_usage_specified": "Pas de description de l'utilisation spécifiée.",
"no_description_specified": "Pas de description spécifiée",
"set_to": "%s a été défini a %s.",
"set_for_to": "%s de %s a été défini a %s.",
"invalid": {
"amount": "Montant invalide.",
"artifactId": "ID de l'artéfact invalide.",
@ -75,6 +77,8 @@
"itemId": "ID de l'objet invalide.",
"itemLevel": "Niveau de l'objet invalide.",
"itemRefinement": "Raffinement de l'objet invalide.",
"statValue": "Valeur de <stat> invalide.",
"value_between": "Invalid value: %s must be between %s and %s.",
"playerId": "ID du joueur invalide.",
"uid": "UID invalide.",
"id": "ID invalide."
@ -271,16 +275,12 @@
"level_error": "Niveau d'affinité invalide.",
"description": "Défini le niveau d'affinité de votre personnage actif"
},
"setProp": {
"usage": "Usage: setprop|prop <prop> <value>\n\tValues for <prop>: godmode | nostamina | unlimitedenergy | abyssfloor | worldlevel | bplevel\n\t(cont.) see PlayerProperty enum for other possible values, of form PROP_MAX_SPRING_VOLUME -> max_spring_volume",
"description": "Sets accountwide properties. Things like godmode can be enabled this way, as well as changing things like unlocked abyss floor and battle pass progress."
},
"setStats": {
"usage_console": "Usage: setstats|stats @<UID> <stat> <valeur>",
"usage_ingame": "Usage: setstats|stats [@UID] <stat> <valeur>",
"help_message": "\n\tValeurs pour <stat>: hp | maxhp | def | atk | em | er | crate | cdmg | cdr | heal | heali | shield | defi\n\t(cont.) Bonus de dégât élémentaire: epyro | ecryo | ehydro | egeo | edendro | eelectro | ephys\n\t(cont.) Résistance élémentaire: respyro | rescryo | reshydro | resgeo | resdendro | reselectro | resphys\n",
"value_error": "Valeur de <stat> invalide.",
"uid_error": "UID invalide.",
"player_error": "Joueur introuvable ou hors ligne.",
"set_self": "%s a été défini a %s.",
"set_for_uid": "%s de %s a été défini a %s.",
"set_max_hp": "MAX HP a été défini a %s.",
"usage": "Usage: setstats|stats <stat> <valeur>\n\tValeurs pour <stat>: hp | maxhp | def | atk | em | er | crate | cdmg | cdr | heal | heali | shield | defi\n\t(cont.) Bonus de dégât élémentaire: epyro | ecryo | ehydro | egeo | edendro | eelectro | ephys\n\t(cont.) Résistance élémentaire: respyro | rescryo | reshydro | resgeo | resdendro | reselectro | resphys\n",
"description": "Définit les propriétés de combat de votre personnage actif"
},
"setWorldLevel": {

View File

@ -60,6 +60,8 @@
"console_execute_error": "Tą komende można wywołać tylko z konsoli.",
"player_execute_error": "Wywołaj tą komendę w grze.",
"command_exist_error": "Nie znaleziono komendy.",
"set_to": "%s ustawiono na %s.",
"set_for_to": "%s dla %s ustawiono na %s.",
"invalid": {
"amount": "Błędna ilość.",
"artifactId": "Błędne ID artefaktu.",
@ -69,6 +71,7 @@
"id przedmiotu": "Błędne id przedmiotu.",
"itemLevel": "Błędny poziom przedmiotu.",
"itemRefinement": "Błędne ulepszenie.",
"value_between": "Invalid value: %s must be between %s and %s.",
"playerId": "Błędne playerId.",
"uid": "Błędne UID.",
"id": "Błędne ID."
@ -221,16 +224,13 @@
"success": "Poziom przyjaźni ustawiono na: %s",
"level_error": "Błędny poziom przyjaźni."
},
"setProp": {
"usage": "Usage: setprop|prop <prop> <value>\n\tValues for <prop>: godmode | nostamina | unlimitedenergy | abyssfloor | worldlevel | bplevel\n\t(cont.) see PlayerProperty enum for other possible values, of form PROP_MAX_SPRING_VOLUME -> max_spring_volume",
"description": "Sets accountwide properties. Things like godmode can be enabled this way, as well as changing things like unlocked abyss floor and battle pass progress."
},
"setStats": {
"usage_console": "Użycie: setstats|stats @<UID> <statystyka> <wartość>",
"usage_ingame": "Użycie: setstats|stats [@UID] <statystyka> <wartość>",
"help_message": "\n\tWartości dla Statystyka: hp | maxhp | def | atk | em | er | crate | cdmg | cdr | heal | heali | shield | defi\n\t(cont.) Bonus DMG żywiołu: epyro | ecryo | ehydro | egeo | edendro | eelectro | ephys\n\t(cont.) RES na żywioł: respyro | rescryo | reshydro | resgeo | resdendro | reselectro | resphys\n",
"value_error": "Błędna wartość statystyki.",
"uid_error": "Błędne UID.",
"player_error": "Gracza nie znaleziono lub jest offline.",
"set_self": "%s ustawiono na %s.",
"set_for_uid": "%s dla %s ustawiono na %s.",
"set_max_hp": "Maksymalne HP ustawione na %s."
"usage": "Użycie: setstats|stats <statystyka> <wartość>\n\tWartości dla Statystyka: hp | maxhp | def | atk | em | er | crate | cdmg | cdr | heal | heali | shield | defi\n\t(cont.) Bonus DMG żywiołu: epyro | ecryo | ehydro | egeo | edendro | eelectro | ephys\n\t(cont.) RES na żywioł: respyro | rescryo | reshydro | resgeo | resdendro | reselectro | resphys\n",
"description": "Sets fight property for your current active character"
},
"setWorldLevel": {
"usage": "Użycie: setworldlevel <poziom>",

View File

@ -66,6 +66,8 @@
"command_exist_error": "Команда не найдена.",
"no_usage_specified": "Применение команды не указано",
"no_description_specified": "Описание отсутствует",
"set_to": "Характеристика %s стала равной %s.",
"set_for_to": "Характеристика %s игрока %s стала равной %s.",
"invalid": {
"amount": "Некорректное количество.",
"artifactId": "Некорректный ID артефакта.",
@ -75,6 +77,8 @@
"itemId": "Некорректный ID предмета.",
"itemLevel": "Некорректный уровень предмета (itemLevel).",
"itemRefinement": "Некорректный уровень пробуждения предмета (itemRefinement).",
"statValue": "Некорректное значение характеристики.",
"value_between": "Invalid value: %s must be between %s and %s.",
"playerId": "Некорректный ID игрока.",
"uid": "Некорректный UID.",
"id": "Некорректный ID."
@ -298,16 +302,12 @@
"level_error": "Некорректный уровень дружбы.",
"description": "Устанавливает уровень дружбы для активного персонажа"
},
"setProp": {
"usage": "Usage: setprop|prop <prop> <value>\n\tValues for <prop>: godmode | nostamina | unlimitedenergy | abyssfloor | worldlevel | bplevel\n\t(cont.) see PlayerProperty enum for other possible values, of form PROP_MAX_SPRING_VOLUME -> max_spring_volume",
"description": "Sets accountwide properties. Things like godmode can be enabled this way, as well as changing things like unlocked abyss floor and battle pass progress."
},
"setStats": {
"usage_console": "Применение: setstats|stats @<UID> <хар-ка> <значение>",
"usage_ingame": "Применение: setstats|stats [@UID] <хар-ка> <значение>",
"help_message": "\n\tВозможные значения для <хар-ка>: hp | maxhp | def | atk | em | er | crate | cdmg | cdr | heal | heali | shield | defi\n\t(прод.) Бонус элементального урона: epyro | ecryo | ehydro | egeo | edendro | eelectro | ephys\n\t(cont.) Элементальное сопротивление: respyro | rescryo | reshydro | resgeo | resdendro | reselectro | resphys\n",
"value_error": "Некорректное значение характеристики.",
"uid_error": "Некорректный UID.",
"player_error": "Игрок не найден или находится не в сети.",
"set_self": "Характеристика %s стала равной %s.",
"set_for_uid": "Характеристика %s игрока %s стала равной %s.",
"set_max_hp": "Максимальное значение здоровья стало равно %s.",
"usage": "Применение: setstats|stats <хар-ка> <значение>\n\tВозможные значения для <хар-ка>: hp | maxhp | def | atk | em | er | crate | cdmg | cdr | heal | heali | shield | defi\n\t(прод.) Бонус элементального урона: epyro | ecryo | ehydro | egeo | edendro | eelectro | ephys\n\t(cont.) Элементальное сопротивление: respyro | rescryo | reshydro | resgeo | resdendro | reselectro | resphys\n",
"description": "Задаёт боевые характеристики для активного персонажа"
},
"setWorldLevel": {

View File

@ -66,6 +66,8 @@
"command_exist_error": "未找到命令。",
"no_usage_specified": "未指定用法",
"no_description_specified": "未指定说明",
"set_to": "%s 已设为 %s。",
"set_for_to": "%s [来自 %s] 已设为 %s。",
"invalid": {
"amount": "无效的数量。",
"artifactId": "无效的圣遗物ID。",
@ -75,6 +77,8 @@
"itemId": "无效的物品ID。",
"itemLevel": "无效的物品等级。",
"itemRefinement": "无效的物品精炼等级。",
"statValue": "无效的属性值。",
"value_between": "Invalid value: %s must be between %s and %s.",
"playerId": "无效的玩家ID。",
"uid": "无效的UID。",
"id": "无效的ID。"
@ -270,24 +274,13 @@
"level_error": "无效的好感度等级。",
"description": "设置当前角色的好感度等级"
},
"setStats": {
"usage_console": "用法setstats|stats @<UID> <属性> <数值>",
"usage_ingame": "用法setstats|stats [@UID] <属性> <数值>",
"help_message": "\n可更改的属性列表hp(生命值)|maxhp(最大生命值)|def(防御力)|atk(攻击力)|em(元素精通)|er(元素充能效率)|crate(暴击率)|cdmg(暴击伤害)|cdr(冷却缩减)|heal(治疗加成)|heali(受治疗加成)|shield(护盾强效)|defi(无视防御)\n元素增伤epyro(火)|ecryo(冰)|ehydro(水)|egeo(岩)|edendro(草)|eelectro(雷)|ephys(物理)\n元素抗性respyro(火)|rescryo(冰)|reshydro(水)|resgeo(岩)|resdendro(草)|reselectro(雷)|resphys(物理)\n",
"value_error": "无效的属性值。",
"uid_error": "无效的UID。",
"player_error": "玩家不存在或已离线。",
"set_self": "%s 已设为 %s。",
"set_for_uid": "%s [来自 %s] 已设为 %s。",
"set_max_hp": "最大生命值已设为 %s。",
"description": "设置当前角色的属性"
"setProp": {
"usage": "Usage: setprop|prop <prop> <value>\n\tValues for <prop>: godmode | nostamina | unlimitedenergy | abyssfloor | worldlevel | bplevel\n\t(cont.) see PlayerProperty enum for other possible values, of form PROP_MAX_SPRING_VOLUME -> max_spring_volume",
"description": "Sets accountwide properties. Things like godmode can be enabled this way, as well as changing things like unlocked abyss floor and battle pass progress."
},
"setWorldLevel": {
"usage": "用法setworldlevel <等级>",
"value_error": "世界等级必须在 0-8 之间。",
"success": "世界等级已设为 %s。",
"invalid_world_level": "无效的世界等级。",
"description": "设置世界等级,执行命令后需重新登录以生效"
"setStats": {
"usage": "用法setstats|stats <属性> <数值>\n可更改的属性列表hp(生命值)|maxhp(最大生命值)|def(防御力)|atk(攻击力)|em(元素精通)|er(元素充能效率)|crate(暴击率)|cdmg(暴击伤害)|cdr(冷却缩减)|heal(治疗加成)|heali(受治疗加成)|shield(护盾强效)|defi(无视防御)\n元素增伤epyro(火)|ecryo(冰)|ehydro(水)|egeo(岩)|edendro(草)|eelectro(雷)|ephys(物理)\n元素抗性respyro(火)|rescryo(冰)|reshydro(水)|resgeo(岩)|resdendro(草)|reselectro(雷)|resphys(物理)\n",
"description": "设置当前角色的属性"
},
"spawn": {
"usage": "用法spawn <实体ID> [数量] [等级(仅怪物)] [<x> <y> <z>(仅怪物, 可选)]",
@ -348,15 +341,6 @@
"success": "传送 %s 到坐标 %s, %s, %s场景为 %s。",
"description": "改变指定玩家的位置"
},
"unlimitenergy": {
"success": "UnlimitEnergy 已设为 %s。[用户:%s]",
"config_error": "命令不可用。因为 config.json 中 energyUsage 为 false。",
"description": "使用元素爆发而不消耗能量"
},
"unlocktower": {
"success": "现已解锁深境回廊(1-8层)。",
"description": "解锁深境螺旋"
},
"weather": {
"usage": "用法weather [天气ID] [气候类型]\n天气ID可以在 WeatherExcelConfigData.json 中找到。\n气候类型sunny(晴天), cloudy(多云), rain(雨), thunderstorm(雷雨), snow(雪), mist(雾)",
"success": "已设置天气ID 为 %s气候类型为 %s。",

View File

@ -65,6 +65,8 @@
"player_execute_error": "請在遊戲裡使用這條指令。",
"command_exist_error": "找不到指令。",
"no_description_specified": "没有指定說明。",
"set_to": "%s 已經設為 %s。",
"set_for_to": "%s 的使用者 %s 更改為 %s。",
"invalid": {
"amount": "無效的數量。",
"artifactId": "無效的聖遺物ID。",
@ -74,6 +76,8 @@
"itemId": "無效的物品ID。",
"itemLevel": "無效的物品等級。",
"itemRefinement": "無效的物品精煉度。",
"statValue": "無效的數據值。",
"value_between": "Invalid value: %s must be between %s and %s.",
"playerId": "無效的玩家ID。",
"uid": "無效的UID。",
"id": "無效的ID。"
@ -274,16 +278,12 @@
"level_error": "無效的好感度。",
"description": "設定當前角色的好感度等級。"
},
"setProp": {
"usage": "Usage: setprop|prop <prop> <value>\n\tValues for <prop>: godmode | nostamina | unlimitedenergy | abyssfloor | worldlevel | bplevel\n\t(cont.) see PlayerProperty enum for other possible values, of form PROP_MAX_SPRING_VOLUME -> max_spring_volume",
"description": "Sets accountwide properties. Things like godmode can be enabled this way, as well as changing things like unlocked abyss floor and battle pass progress."
},
"setStats": {
"usage_console": "用法setstats|stats @<UID> <stat> <value>",
"usage_ingame": "用法setstats|stats [@UID] <stat> <value>",
"help_message": "\n\t可使用的數據類型hp (生命值)| maxhp (最大生命值) | def(防禦力) | atk (攻擊力)| em (元素精通) | er (元素充能效率) | crate(暴擊率) | cdmg (暴擊傷害)| cdr (冷卻縮減) | heal(治療加成)| heali (受治療加成)| shield (護盾強效)| defi (無視防禦)\n\t(cont.) 元素增傷類epyro (火傷) | ecryo (冰傷) | ehydro (水傷) | egeo (岩傷) | edendro (草傷) | eelectro (雷傷) | ephys (物傷)(cont.) 元素減傷類respyro (火抗) | rescryo (冰抗) | reshydro (水抗) | resgeo (岩抗) | resdendro (草抗) | reselectro (雷抗) | resphys (物抗)\n",
"value_error": "無效的數據值。",
"uid_error": "無效的UID。",
"player_error": "玩家不存在或已離線。",
"set_self": "%s 已經設為 %s。",
"set_for_uid": "%s 的使用者 %s 更改為 %s。",
"set_max_hp": "最大生命值更改為 %s。",
"usage": "用法setstats|stats <stat> <value>\n\t可使用的數據類型hp (生命值)| maxhp (最大生命值) | def(防禦力) | atk (攻擊力)| em (元素精通) | er (元素充能效率) | crate(暴擊率) | cdmg (暴擊傷害)| cdr (冷卻縮減) | heal(治療加成)| heali (受治療加成)| shield (護盾強效)| defi (無視防禦)\n\t(cont.) 元素增傷類epyro (火傷) | ecryo (冰傷) | ehydro (水傷) | egeo (岩傷) | edendro (草傷) | eelectro (雷傷) | ephys (物傷)(cont.) 元素減傷類respyro (火抗) | rescryo (冰抗) | reshydro (水抗) | resgeo (岩抗) | resdendro (草抗) | reselectro (雷抗) | resphys (物抗)\n",
"description": "設定當前角色的數據類型。"
},
"setWorldLevel": {