mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-10 21:12:57 +08:00
Merge remote-tracking branch 'origin/development' into tower
This commit is contained in:
commit
2e69a4d8f7
3
.gitignore
vendored
3
.gitignore
vendored
@ -69,3 +69,6 @@ language/
|
|||||||
languages/
|
languages/
|
||||||
gacha-mapping.js
|
gacha-mapping.js
|
||||||
data/gacha_mappings.js
|
data/gacha_mappings.js
|
||||||
|
|
||||||
|
# macOS
|
||||||
|
.DS_Store
|
||||||
|
@ -150,7 +150,7 @@ public final class CommandMap {
|
|||||||
int uid = Integer.parseInt(targetUidStr);
|
int uid = Integer.parseInt(targetUidStr);
|
||||||
targetPlayer = Grasscutter.getGameServer().getPlayerByUid(uid);
|
targetPlayer = Grasscutter.getGameServer().getPlayerByUid(uid);
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
CommandHandler.sendMessage(player, translate("commands.generic.execution.player_exist_offline_error"));
|
CommandHandler.sendMessage(player, translate("commands.execution.player_exist_offline_error"));
|
||||||
} else {
|
} else {
|
||||||
targetPlayerIds.put(playerId, uid);
|
targetPlayerIds.put(playerId, uid);
|
||||||
CommandHandler.sendMessage(player, translate("commands.execution.set_target", targetUidStr));
|
CommandHandler.sendMessage(player, translate("commands.execution.set_target", targetUidStr));
|
||||||
@ -178,7 +178,7 @@ public final class CommandMap {
|
|||||||
int uid = Integer.parseInt(arg);
|
int uid = Integer.parseInt(arg);
|
||||||
targetPlayer = Grasscutter.getGameServer().getPlayerByUid(uid);
|
targetPlayer = Grasscutter.getGameServer().getPlayerByUid(uid);
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
CommandHandler.sendMessage(player, translate("commands.generic.execution.player_exist_offline_error"));
|
CommandHandler.sendMessage(player, translate("commands.execution.player_exist_offline_error"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -194,7 +194,7 @@ public final class CommandMap {
|
|||||||
if (targetPlayerIds.containsKey(playerId)) {
|
if (targetPlayerIds.containsKey(playerId)) {
|
||||||
targetPlayer = Grasscutter.getGameServer().getPlayerByUid(targetPlayerIds.get(playerId)); // We check every time in case the target goes offline after being targeted
|
targetPlayer = Grasscutter.getGameServer().getPlayerByUid(targetPlayerIds.get(playerId)); // We check every time in case the target goes offline after being targeted
|
||||||
if (targetPlayer == null) {
|
if (targetPlayer == null) {
|
||||||
CommandHandler.sendMessage(player, translate("commands.generic.execution.player_exist_offline_error"));
|
CommandHandler.sendMessage(player, translate("commands.execution.player_exist_offline_error"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -8,7 +8,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "changescene", usage = "changescene <scene id>", aliases = {"scene"}, permission = "player.changescene", description = "commands.changescene.description")
|
@Command(label = "changescene", usage = "changescene <scene id>", aliases = {"scene"}, permission = "player.changescene", permissionTargeted = "player.changescene.others", description = "commands.changescene.description")
|
||||||
public final class ChangeSceneCommand implements CommandHandler {
|
public final class ChangeSceneCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -31,11 +31,12 @@ public final class ChangeSceneCommand implements CommandHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean result = targetPlayer.getWorld().transferPlayerToScene(targetPlayer, sceneId, targetPlayer.getPos());
|
boolean result = targetPlayer.getWorld().transferPlayerToScene(targetPlayer, sceneId, targetPlayer.getPos());
|
||||||
CommandHandler.sendMessage(sender, translate("commands.changescene.result", Integer.toString(sceneId)));
|
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
CommandHandler.sendMessage(sender, translate("commands.changescene.exists_error"));
|
CommandHandler.sendMessage(sender, translate("commands.changescene.exists_error"));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CommandHandler.sendMessage(sender, translate("commands.changescene.success", Integer.toString(sceneId)));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
CommandHandler.sendMessage(sender, translate("commands.execution.argument_error"));
|
CommandHandler.sendMessage(sender, translate("commands.execution.argument_error"));
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import static emu.grasscutter.utils.Language.translate;
|
|||||||
|
|
||||||
@Command(label = "clear", usage = "clear <all|wp|art|mat>", //Merged /clearartifacts and /clearweapons to /clear <args> [uid]
|
@Command(label = "clear", usage = "clear <all|wp|art|mat>", //Merged /clearartifacts and /clearweapons to /clear <args> [uid]
|
||||||
description = "commands.clear.description",
|
description = "commands.clear.description",
|
||||||
aliases = {"clear"}, permission = "player.clearinv")
|
aliases = {"clear"}, permission = "player.clearinv", permissionTargeted = "player.clearinv.others")
|
||||||
|
|
||||||
public final class ClearCommand implements CommandHandler {
|
public final class ClearCommand implements CommandHandler {
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "coop", usage = "coop [host UID]", permission = "server.coop", description = "commands.coop.description")
|
@Command(label = "coop", usage = "coop [host UID]", permission = "server.coop", permissionTargeted = "server.coop.others", description = "commands.coop.description")
|
||||||
public final class CoopCommand implements CommandHandler {
|
public final class CoopCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -13,7 +13,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "drop", usage = "drop <itemId|itemName> [amount]", aliases = {"d", "dropitem"}, permission = "server.drop", description = "commands.drop.description")
|
@Command(label = "drop", usage = "drop <itemId|itemName> [amount]", aliases = {"d", "dropitem"}, permission = "server.drop", permissionTargeted = "server.drop.others", description = "commands.drop.description")
|
||||||
public final class DropCommand implements CommandHandler {
|
public final class DropCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -8,7 +8,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "enterdungeon", usage = "enterdungeon <dungeon id>", aliases = {"dungeon"}, permission = "player.enterdungeon", description = "commands.enter_dungeon.description")
|
@Command(label = "enterdungeon", usage = "enterdungeon <dungeon id>", aliases = {"dungeon"}, permission = "player.enterdungeon", permissionTargeted = "player.enterdungeon.others", description = "commands.enter_dungeon.description")
|
||||||
public final class EnterDungeonCommand implements CommandHandler {
|
public final class EnterDungeonCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -15,7 +15,7 @@ import java.util.*;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "giveall", usage = "giveall [amount]", aliases = {"givea"}, permission = "player.giveall", threading = true, description = "commands.giveAll.description")
|
@Command(label = "giveall", usage = "giveall [amount]", aliases = {"givea"}, permission = "player.giveall", permissionTargeted = "player.giveall.others", threading = true, description = "commands.giveAll.description")
|
||||||
public final class GiveAllCommand implements CommandHandler {
|
public final class GiveAllCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -19,7 +19,7 @@ import static java.util.Map.entry;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "giveart", usage = "giveart <artifactId> <mainPropId> [<appendPropId>[,<times>]]... [level]", aliases = {"gart"}, permission = "player.giveart", description = "commands.giveArtifact.description")
|
@Command(label = "giveart", usage = "giveart <artifactId> <mainPropId> [<appendPropId>[,<times>]]... [level]", aliases = {"gart"}, permission = "player.giveart", permissionTargeted = "player.giveart.others", description = "commands.giveArtifact.description")
|
||||||
public final class GiveArtifactCommand implements CommandHandler {
|
public final class GiveArtifactCommand implements CommandHandler {
|
||||||
private static final Map<String, Map<EquipType, Integer>> mainPropMap = Map.ofEntries(
|
private static final Map<String, Map<EquipType, Integer>> mainPropMap = Map.ofEntries(
|
||||||
entry("hp", Map.ofEntries(entry(EquipType.EQUIP_BRACER, 14001))),
|
entry("hp", Map.ofEntries(entry(EquipType.EQUIP_BRACER, 14001))),
|
||||||
|
@ -12,7 +12,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "givechar", usage = "givechar <avatarId> [level]", aliases = {"givec"}, permission = "player.givechar", description = "commands.giveChar.description")
|
@Command(label = "givechar", usage = "givechar <avatarId> [level]", aliases = {"givec"}, permission = "player.givechar", permissionTargeted = "player.givechar.others", description = "commands.giveChar.description")
|
||||||
public final class GiveCharCommand implements CommandHandler {
|
public final class GiveCharCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -17,7 +17,7 @@ import java.util.regex.Pattern;
|
|||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "give", usage = "give <itemId|itemName> [amount] [level]", aliases = {
|
@Command(label = "give", usage = "give <itemId|itemName> [amount] [level]", aliases = {
|
||||||
"g", "item", "giveitem"}, permission = "player.give", description = "commands.give.description")
|
"g", "item", "giveitem"}, permission = "player.give", permissionTargeted = "player.give.others", description = "commands.give.description")
|
||||||
public final class GiveCommand implements CommandHandler {
|
public final class GiveCommand implements CommandHandler {
|
||||||
Pattern lvlRegex = Pattern.compile("l(?:vl?)?(\\d+)"); // Java is a joke of a proglang that doesn't have raw string literals
|
Pattern lvlRegex = Pattern.compile("l(?:vl?)?(\\d+)"); // Java is a joke of a proglang that doesn't have raw string literals
|
||||||
Pattern refineRegex = Pattern.compile("r(\\d+)");
|
Pattern refineRegex = Pattern.compile("r(\\d+)");
|
||||||
|
@ -8,7 +8,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "godmode", usage = "godmode [on|off|toggle]", permission = "player.godmode", description = "commands.godmode.description")
|
@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 {
|
public final class GodModeCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -11,7 +11,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "heal", usage = "heal|h", aliases = {"h"}, permission = "player.heal", description = "commands.heal.description")
|
@Command(label = "heal", usage = "heal|h", aliases = {"h"}, permission = "player.heal", permissionTargeted = "player.heal.others", description = "commands.heal.description")
|
||||||
public final class HealCommand implements CommandHandler {
|
public final class HealCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -12,7 +12,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "killall", usage = "killall [sceneId]", permission = "server.killall", description = "commands.kill.description")
|
@Command(label = "killall", usage = "killall [sceneId]", permission = "server.killall", permissionTargeted = "server.killall.others", description = "commands.kill.description")
|
||||||
public final class KillAllCommand implements CommandHandler {
|
public final class KillAllCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -13,7 +13,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "killcharacter", usage = "killcharacter", aliases = {"suicide", "kill"}, permission = "player.killcharacter", description = "commands.list.description")
|
@Command(label = "killcharacter", usage = "killcharacter", aliases = {"suicide", "kill"}, permission = "player.killcharacter", permissionTargeted = "player.killcharacter.others", description = "commands.list.description")
|
||||||
public final class KillCharacterCommand implements CommandHandler {
|
public final class KillCharacterCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -11,7 +11,7 @@ import java.util.List;
|
|||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "resetconst", usage = "resetconst [all]",
|
@Command(label = "resetconst", usage = "resetconst [all]",
|
||||||
aliases = {"resetconstellation"}, permission = "player.resetconstellation", description = "commands.resetConst.description")
|
aliases = {"resetconstellation"}, permission = "player.resetconstellation", permissionTargeted = "player.resetconstellation.others", description = "commands.resetConst.description")
|
||||||
public final class ResetConstCommand implements CommandHandler {
|
public final class ResetConstCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -9,7 +9,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "resetshop", usage = "resetshop", permission = "server.resetshop", description = "commands.status.description")
|
@Command(label = "resetshop", usage = "resetshop", permission = "server.resetshop", permissionTargeted = "server.resetshop.others", description = "commands.resetshop.description")
|
||||||
public final class ResetShopLimitCommand implements CommandHandler {
|
public final class ResetShopLimitCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -9,7 +9,7 @@ import java.util.List;
|
|||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "say", usage = "say <message>",
|
@Command(label = "say", usage = "say <message>",
|
||||||
aliases = {"sendservmsg", "sendservermessage", "sendmessage"}, permission = "server.sendmessage", description = "commands.sendMessage.description")
|
aliases = {"sendservmsg", "sendservermessage", "sendmessage"}, permission = "server.sendmessage", permissionTargeted = "server.sendmessage.others", description = "commands.sendMessage.description")
|
||||||
public final class SendMessageCommand implements CommandHandler {
|
public final class SendMessageCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -12,7 +12,7 @@ import emu.grasscutter.server.packet.send.PacketAvatarFetterDataNotify;
|
|||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "setfetterlevel", usage = "setfetterlevel <level>",
|
@Command(label = "setfetterlevel", usage = "setfetterlevel <level>",
|
||||||
aliases = {"setfetterlvl", "setfriendship"}, permission = "player.setfetterlevel", description = "commands.setFetterLevel.description")
|
aliases = {"setfetterlvl", "setfriendship"}, permission = "player.setfetterlevel", permissionTargeted = "player.setfetterlevel.others", description = "commands.setFetterLevel.description")
|
||||||
public final class SetFetterLevelCommand implements CommandHandler {
|
public final class SetFetterLevelCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -15,7 +15,7 @@ import emu.grasscutter.utils.Language;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "setstats", usage = "setstats|stats <stat> <value>", aliases = {"stats"}, permission = "player.setstats", description = "commands.setStats.description")
|
@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 {
|
public final class SetStatsCommand implements CommandHandler {
|
||||||
static class Stat {
|
static class Stat {
|
||||||
String name;
|
String name;
|
||||||
@ -175,7 +175,7 @@ public final class SetStatsCommand implements CommandHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
public void execute(Player sender, Player targetPlayer, List<String> args) {
|
||||||
String syntax = sender == null ? translate("commands.setStats.usage_console") : translate("commands.setStats.ingame");
|
String syntax = sender == null ? translate("commands.setStats.usage_console") : translate("commands.setStats.usage_ingame");
|
||||||
String usage = syntax + translate("commands.setStats.help_message");
|
String usage = syntax + translate("commands.setStats.help_message");
|
||||||
String statStr;
|
String statStr;
|
||||||
String valueStr;
|
String valueStr;
|
||||||
|
@ -10,7 +10,7 @@ import java.util.List;
|
|||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "setworldlevel", usage = "setworldlevel <level>",
|
@Command(label = "setworldlevel", usage = "setworldlevel <level>",
|
||||||
aliases = {"setworldlvl"}, permission = "player.setworldlevel", description = "commands.setWorldLevel.description")
|
aliases = {"setworldlvl"}, permission = "player.setworldlevel", permissionTargeted = "player.setworldlevel.others", description = "commands.setWorldLevel.description")
|
||||||
public final class SetWorldLevelCommand implements CommandHandler {
|
public final class SetWorldLevelCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -22,7 +22,7 @@ import java.util.Random;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "spawn", usage = "spawn <entityId> [amount] [level(monster only)]", permission = "server.spawn", description = "commands.spawn.description")
|
@Command(label = "spawn", usage = "spawn <entityId> [amount] [level(monster only)]", permission = "server.spawn", permissionTargeted = "server.spawn.others", description = "commands.spawn.description")
|
||||||
public final class SpawnCommand implements CommandHandler {
|
public final class SpawnCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -46,13 +46,13 @@ public final class SpawnCommand implements CommandHandler {
|
|||||||
try {
|
try {
|
||||||
amount = Integer.parseInt(args.get(1));
|
amount = Integer.parseInt(args.get(1));
|
||||||
} catch (NumberFormatException ignored) {
|
} catch (NumberFormatException ignored) {
|
||||||
CommandHandler.sendMessage(sender, translate("commands.generic.error.amount"));
|
CommandHandler.sendMessage(sender, translate("commands.generic.invalid.amount"));
|
||||||
} // Fallthrough
|
} // Fallthrough
|
||||||
case 1:
|
case 1:
|
||||||
try {
|
try {
|
||||||
id = Integer.parseInt(args.get(0));
|
id = Integer.parseInt(args.get(0));
|
||||||
} catch (NumberFormatException ignored) {
|
} catch (NumberFormatException ignored) {
|
||||||
CommandHandler.sendMessage(sender, translate("commands.generic.error.entityId"));
|
CommandHandler.sendMessage(sender, translate("commands.generic.invalid.entityId"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -64,7 +64,7 @@ public final class SpawnCommand implements CommandHandler {
|
|||||||
GadgetData gadgetData = GameData.getGadgetDataMap().get(id);
|
GadgetData gadgetData = GameData.getGadgetDataMap().get(id);
|
||||||
ItemData itemData = GameData.getItemDataMap().get(id);
|
ItemData itemData = GameData.getItemDataMap().get(id);
|
||||||
if (monsterData == null && gadgetData == null && itemData == null) {
|
if (monsterData == null && gadgetData == null && itemData == null) {
|
||||||
CommandHandler.sendMessage(sender, translate("commands.generic.error.entityId"));
|
CommandHandler.sendMessage(sender, translate("commands.generic.invalid.entityId"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Scene scene = targetPlayer.getScene();
|
Scene scene = targetPlayer.getScene();
|
||||||
|
@ -14,7 +14,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "talent", usage = "talent <talentID> <value>", permission = "player.settalent", description = "commands.talent.description")
|
@Command(label = "talent", usage = "talent <talentID> <value>", permission = "player.settalent", permissionTargeted = "player.settalent.others", description = "commands.talent.description")
|
||||||
public final class TalentCommand implements CommandHandler {
|
public final class TalentCommand implements CommandHandler {
|
||||||
private void setTalentLevel(Player sender, Player player, Avatar avatar, int talentId, int talentLevel) {
|
private void setTalentLevel(Player sender, Player player, Avatar avatar, int talentId, int talentLevel) {
|
||||||
int oldLevel = avatar.getSkillLevelMap().get(talentId);
|
int oldLevel = avatar.getSkillLevelMap().get(talentId);
|
||||||
@ -24,7 +24,7 @@ public final class TalentCommand implements CommandHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Upgrade skill
|
// Upgrade skill
|
||||||
avatar.getSkillLevelMap().put(talentLevel, talentLevel);
|
avatar.getSkillLevelMap().put(talentId, talentLevel);
|
||||||
avatar.save();
|
avatar.save();
|
||||||
|
|
||||||
// Packet
|
// Packet
|
||||||
|
@ -10,7 +10,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "tpall", usage = "tpall", permission = "player.tpall", description = "commands.teleportAll.description")
|
@Command(label = "tpall", usage = "tpall", permission = "player.tpall", permissionTargeted = "player.tpall.others", description = "commands.teleportAll.description")
|
||||||
public final class TeleportAllCommand implements CommandHandler {
|
public final class TeleportAllCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -10,7 +10,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "teleport", usage = "teleport <x> <y> <z> [scene id]", aliases = {"tp"}, permission = "player.teleport", description = "commands.teleport.description")
|
@Command(label = "teleport", usage = "teleport <x> <y> <z> [scene id]", aliases = {"tp"}, permission = "player.teleport", permissionTargeted = "player.teleport.others", description = "commands.teleport.description")
|
||||||
public final class TeleportCommand implements CommandHandler {
|
public final class TeleportCommand implements CommandHandler {
|
||||||
|
|
||||||
private float parseRelative(String input, Float current) { // TODO: Maybe this will be useful elsewhere later
|
private float parseRelative(String input, Float current) { // TODO: Maybe this will be useful elsewhere later
|
||||||
|
@ -10,7 +10,7 @@ import java.util.List;
|
|||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "unlocktower", usage = "unlocktower", aliases = {"ut"},
|
@Command(label = "unlocktower", usage = "unlocktower", aliases = {"ut"},
|
||||||
description = "Unlock all levels of tower", permission = "player.tower")
|
description = "commands.unlocktower.description", permission = "player.tower")
|
||||||
public class UnlockTowerCommand implements CommandHandler {
|
public class UnlockTowerCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -21,7 +21,7 @@ public class UnlockTowerCommand implements CommandHandler {
|
|||||||
unlockFloor(sender, sender.getServer().getTowerScheduleManager()
|
unlockFloor(sender, sender.getServer().getTowerScheduleManager()
|
||||||
.getScheduleFloors());
|
.getScheduleFloors());
|
||||||
|
|
||||||
CommandHandler.sendMessage(sender, translate("commands.tower.unlock_done"));
|
CommandHandler.sendMessage(sender, translate("commands.unlocktower.success"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unlockFloor(Player player, List<Integer> floors){
|
public void unlockFloor(Player player, List<Integer> floors){
|
||||||
|
@ -11,7 +11,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static emu.grasscutter.utils.Language.translate;
|
import static emu.grasscutter.utils.Language.translate;
|
||||||
|
|
||||||
@Command(label = "weather", usage = "weather <weatherId> [climateId]", aliases = {"w"}, permission = "player.weather", description = "commands.weather.description")
|
@Command(label = "weather", usage = "weather <weatherId> [climateId]", aliases = {"w"}, permission = "player.weather", permissionTargeted = "player.weather.others", description = "commands.weather.description")
|
||||||
public final class WeatherCommand implements CommandHandler {
|
public final class WeatherCommand implements CommandHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package emu.grasscutter.game;
|
package emu.grasscutter.game;
|
||||||
|
|
||||||
import dev.morphia.annotations.*;
|
import dev.morphia.annotations.*;
|
||||||
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.database.DatabaseHelper;
|
import emu.grasscutter.database.DatabaseHelper;
|
||||||
import emu.grasscutter.utils.Crypto;
|
import emu.grasscutter.utils.Crypto;
|
||||||
import emu.grasscutter.utils.Utils;
|
import emu.grasscutter.utils.Utils;
|
||||||
@ -107,11 +108,41 @@ public class Account {
|
|||||||
this.permissions.add(permission); return true;
|
this.permissions.add(permission); return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean permissionMatchesWildcard(String wildcard, String[] permissionParts) {
|
||||||
|
String[] wildcardParts = wildcard.split("\\.");
|
||||||
|
if (permissionParts.length < wildcardParts.length) { // A longer wildcard can never match a shorter permission
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (int i=0; i<wildcardParts.length; i++) {
|
||||||
|
switch (wildcardParts[i]) {
|
||||||
|
case "**": // Recursing match
|
||||||
|
return true;
|
||||||
|
case "*": // Match only one layer
|
||||||
|
if (i >= (permissionParts.length-1)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: // This layer isn't a wildcard, it needs to match exactly
|
||||||
|
if (!wildcardParts[i].equals(permissionParts[i])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// At this point the wildcard will have matched every layer, but if it is shorter then the permission then this is not a match at this point (no **).
|
||||||
|
return (wildcardParts.length == permissionParts.length);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean hasPermission(String permission) {
|
public boolean hasPermission(String permission) {
|
||||||
return this.permissions.contains(permission) ||
|
if (this.permissions.contains(permission) || this.permissions.contains("*")) {
|
||||||
this.permissions.contains("*") ||
|
return true;
|
||||||
(this.permissions.contains("player") || this.permissions.contains("player.*")) && permission.startsWith("player.") ||
|
}
|
||||||
(this.permissions.contains("server") || this.permissions.contains("server.*")) && permission.startsWith("server.");
|
String[] permissionParts = permission.split("\\.");
|
||||||
|
for (String p : this.permissions) {
|
||||||
|
if (permissionMatchesWildcard(p, permissionParts)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean removePermission(String permission) {
|
public boolean removePermission(String permission) {
|
||||||
|
@ -190,6 +190,7 @@ public class StaminaManager {
|
|||||||
|
|
||||||
// Returns new stamina and sends PlayerPropNotify
|
// Returns new stamina and sends PlayerPropNotify
|
||||||
public int setStamina(GameSession session, String reason, int newStamina) {
|
public int setStamina(GameSession session, String reason, int newStamina) {
|
||||||
|
if (Grasscutter.getConfig().OpenStamina) {
|
||||||
// set stamina
|
// set stamina
|
||||||
player.setProperty(PlayerProperty.PROP_CUR_PERSIST_STAMINA, newStamina);
|
player.setProperty(PlayerProperty.PROP_CUR_PERSIST_STAMINA, newStamina);
|
||||||
session.send(new PacketPlayerPropNotify(player, PlayerProperty.PROP_CUR_PERSIST_STAMINA));
|
session.send(new PacketPlayerPropNotify(player, PlayerProperty.PROP_CUR_PERSIST_STAMINA));
|
||||||
@ -199,6 +200,8 @@ public class StaminaManager {
|
|||||||
}
|
}
|
||||||
return newStamina;
|
return newStamina;
|
||||||
}
|
}
|
||||||
|
return player.getProperty(PlayerProperty.PROP_CUR_PERSIST_STAMINA);
|
||||||
|
}
|
||||||
|
|
||||||
// Kills avatar, removes entity and sends notification.
|
// Kills avatar, removes entity and sends notification.
|
||||||
// TODO: Probably move this to Avatar class? since other components may also need to kill avatar.
|
// TODO: Probably move this to Avatar class? since other components may also need to kill avatar.
|
||||||
@ -243,16 +246,17 @@ public class StaminaManager {
|
|||||||
cachedEntity = entity;
|
cachedEntity = entity;
|
||||||
MotionInfo motionInfo = moveInfo.getMotionInfo();
|
MotionInfo motionInfo = moveInfo.getMotionInfo();
|
||||||
MotionState motionState = motionInfo.getState();
|
MotionState motionState = motionInfo.getState();
|
||||||
boolean isReliable = moveInfo.getIsReliable();
|
int notifyEntityId = entity.getId();
|
||||||
Grasscutter.getLogger().trace("" + motionState + "\t" + (isReliable ? "reliable" : ""));
|
int currentAvatarEntityId = session.getPlayer().getTeamManager().getCurrentAvatarEntity().getId();
|
||||||
if (isReliable) {
|
if (notifyEntityId != currentAvatarEntityId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
currentState = motionState;
|
currentState = motionState;
|
||||||
Vector posVector = motionInfo.getPos();
|
Vector posVector = motionInfo.getPos();
|
||||||
Position newPos = new Position(posVector.getX(), posVector.getY(), posVector.getZ());
|
Position newPos = new Position(posVector.getX(), posVector.getY(), posVector.getZ());
|
||||||
if (newPos.getX() != 0 && newPos.getY() != 0 && newPos.getZ() != 0) {
|
if (newPos.getX() != 0 && newPos.getY() != 0 && newPos.getZ() != 0) {
|
||||||
currentCoordinates = newPos;
|
currentCoordinates = newPos;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
startSustainedStaminaHandler();
|
startSustainedStaminaHandler();
|
||||||
handleImmediateStamina(session, motionInfo, motionState, entity);
|
handleImmediateStamina(session, motionInfo, motionState, entity);
|
||||||
}
|
}
|
||||||
@ -287,7 +291,6 @@ public class StaminaManager {
|
|||||||
|
|
||||||
private class SustainedStaminaHandler extends TimerTask {
|
private class SustainedStaminaHandler extends TimerTask {
|
||||||
public void run() {
|
public void run() {
|
||||||
if (Grasscutter.getConfig().OpenStamina) {
|
|
||||||
boolean moving = isPlayerMoving();
|
boolean moving = isPlayerMoving();
|
||||||
int currentStamina = player.getProperty(PlayerProperty.PROP_CUR_PERSIST_STAMINA);
|
int currentStamina = player.getProperty(PlayerProperty.PROP_CUR_PERSIST_STAMINA);
|
||||||
int maxStamina = player.getProperty(PlayerProperty.PROP_MAX_STAMINA);
|
int maxStamina = player.getProperty(PlayerProperty.PROP_MAX_STAMINA);
|
||||||
@ -332,7 +335,6 @@ public class StaminaManager {
|
|||||||
updateStaminaRelative(cachedSession, consumption);
|
updateStaminaRelative(cachedSession, consumption);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
previousState = currentState;
|
previousState = currentState;
|
||||||
previousCoordinates = new Position(
|
previousCoordinates = new Position(
|
||||||
currentCoordinates.getX(),
|
currentCoordinates.getX(),
|
||||||
|
@ -79,6 +79,9 @@ public class ScriptMonsterTideService {
|
|||||||
// fix the 5-2
|
// fix the 5-2
|
||||||
sceneScriptManager.callEvent(EventType.EVENT_MONSTER_TIDE_DIE, new ScriptArgs(monsterKillCount.get()));
|
sceneScriptManager.callEvent(EventType.EVENT_MONSTER_TIDE_DIE, new ScriptArgs(monsterKillCount.get()));
|
||||||
}
|
}
|
||||||
|
// spawn the last turn of monsters
|
||||||
|
// fix the 5-2
|
||||||
|
this.sceneScriptManager.callEvent(EventType.EVENT_MONSTER_TIDE_DIE, new ScriptArgs(this.monsterKillCount.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unload(){
|
public void unload(){
|
||||||
|
@ -334,6 +334,13 @@
|
|||||||
},
|
},
|
||||||
"restart": {
|
"restart": {
|
||||||
"description": "Restarts the current session"
|
"description": "Restarts the current session"
|
||||||
|
},
|
||||||
|
"unlocktower": {
|
||||||
|
"success": "unlock done",
|
||||||
|
"description": "Unlock all levels of tower"
|
||||||
|
},
|
||||||
|
"resetshop": {
|
||||||
|
"description": "reset shop"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@
|
|||||||
"account_error": "Konto nie może zostać znalezione."
|
"account_error": "Konto nie może zostać znalezione."
|
||||||
},
|
},
|
||||||
"position": {
|
"position": {
|
||||||
"success": "Koordynaty: %.3f, %.3f, %.3f\nID sceny: %d"
|
"success": "Koordynaty: %s, %s, %s\nID sceny: %s"
|
||||||
},
|
},
|
||||||
"reload": {
|
"reload": {
|
||||||
"reload_start": "Ponowne ładowanie konfiguracji.",
|
"reload_start": "Ponowne ładowanie konfiguracji.",
|
||||||
@ -293,6 +293,13 @@
|
|||||||
"usage": "Użycie: ",
|
"usage": "Użycie: ",
|
||||||
"aliases": "Aliasy: ",
|
"aliases": "Aliasy: ",
|
||||||
"available_commands": "Dostępne komendy: "
|
"available_commands": "Dostępne komendy: "
|
||||||
|
},
|
||||||
|
"unlocktower": {
|
||||||
|
"success": "odblokować gotowe",
|
||||||
|
"description": "Odblokuj głęboką spiralę"
|
||||||
|
},
|
||||||
|
"resetshop": {
|
||||||
|
"description": "zresetuj sklep"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -201,7 +201,7 @@
|
|||||||
"description": "给予或移除指定玩家的权限。"
|
"description": "给予或移除指定玩家的权限。"
|
||||||
},
|
},
|
||||||
"position": {
|
"position": {
|
||||||
"success": "坐标:%.3f, %.3f, %.3f\n场景ID:%d",
|
"success": "坐标:%s, %s, %s\n场景ID:%s",
|
||||||
"description": "获取所在位置。"
|
"description": "获取所在位置。"
|
||||||
},
|
},
|
||||||
"reload": {
|
"reload": {
|
||||||
@ -249,7 +249,7 @@
|
|||||||
"setFetterLevel": {
|
"setFetterLevel": {
|
||||||
"usage": "用法:setfetterlevel <level>",
|
"usage": "用法:setfetterlevel <level>",
|
||||||
"range_error": "好感度等级必须在 0 到 10 之间。",
|
"range_error": "好感度等级必须在 0 到 10 之间。",
|
||||||
"fetter_set_level": "好感度已设置为 %s 级",
|
"success": "好感度已设置为 %s 级",
|
||||||
"level_error": "无效的好感度等级。",
|
"level_error": "无效的好感度等级。",
|
||||||
"description": "设置当前角色的好感度等级。"
|
"description": "设置当前角色的好感度等级。"
|
||||||
},
|
},
|
||||||
@ -330,6 +330,13 @@
|
|||||||
},
|
},
|
||||||
"restart": {
|
"restart": {
|
||||||
"description": "重新启动服务器。"
|
"description": "重新启动服务器。"
|
||||||
|
},
|
||||||
|
"unlocktower": {
|
||||||
|
"success": "解锁完成。",
|
||||||
|
"description": "解锁深境螺旋的所有层"
|
||||||
|
},
|
||||||
|
"resetshop": {
|
||||||
|
"description": "重置商店时间"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@
|
|||||||
"account_error": "The account cannot be found."
|
"account_error": "The account cannot be found."
|
||||||
},
|
},
|
||||||
"position": {
|
"position": {
|
||||||
"success": "坐標:%.3f, %.3f, %.3f\n場景ID:%d"
|
"success": "坐標:%s, %s, %s\n場景ID:%s"
|
||||||
},
|
},
|
||||||
"reload": {
|
"reload": {
|
||||||
"reload_start": "正在重新加載設定檔。",
|
"reload_start": "正在重新加載設定檔。",
|
||||||
@ -226,7 +226,7 @@
|
|||||||
"setFetterLevel": {
|
"setFetterLevel": {
|
||||||
"usage": "用法:setfetterlevel <level>",
|
"usage": "用法:setfetterlevel <level>",
|
||||||
"range_error": "好感度必須在 0 到 10 之間。",
|
"range_error": "好感度必須在 0 到 10 之間。",
|
||||||
"fetter_set_level": "好感等級已設定為 %s",
|
"success": "好感等級已設定為 %s",
|
||||||
"level_error": "無效的好感度。"
|
"level_error": "無效的好感度。"
|
||||||
},
|
},
|
||||||
"setStats": {
|
"setStats": {
|
||||||
@ -293,6 +293,13 @@
|
|||||||
"usage": "用法:",
|
"usage": "用法:",
|
||||||
"aliases": "別名:",
|
"aliases": "別名:",
|
||||||
"available_commands": "可用指令:"
|
"available_commands": "可用指令:"
|
||||||
|
},
|
||||||
|
"unlocktower": {
|
||||||
|
"success": "解鎖完成。",
|
||||||
|
"description": "解鎖所有級別的深境螺旋"
|
||||||
|
},
|
||||||
|
"resetshop": {
|
||||||
|
"description": "重置商店時間"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user