Format code [skip actions]

This commit is contained in:
github-actions 2024-06-09 13:49:49 +00:00
parent d4ce7aac08
commit 8c53f2b679
189 changed files with 1138 additions and 1185 deletions

View File

@ -230,7 +230,11 @@ public final class CommandMap {
if (SERVER.logCommands) {
if (player != null) {
Grasscutter.getLogger()
.info("Command used by [{} (Player UID: {})]: {}", player.getAccount().getUsername(), player.getUid(), rawMessage);
.info(
"Command used by [{} (Player UID: {})]: {}",
player.getAccount().getUsername(),
player.getUid(),
rawMessage);
} else {
Grasscutter.getLogger().info("Command used by server console: {}", rawMessage);
}
@ -344,10 +348,13 @@ public final class CommandMap {
this.registerCommand(cmdData.label(), (CommandHandler) object);
else
Grasscutter.getLogger()
.error("Class {} is not a CommandHandler!", annotated.getName());
.error("Class {} is not a CommandHandler!", annotated.getName());
} catch (Exception exception) {
Grasscutter.getLogger()
.error("Failed to register command handler for {}", annotated.getSimpleName(), exception);
.error(
"Failed to register command handler for {}",
annotated.getSimpleName(),
exception);
}
});
}

View File

@ -136,18 +136,19 @@ public final class AchievementCommand implements CommandHandler {
parseInt(args.remove(0))
.ifPresentOrElse(
integer -> parseInt(args.remove(0))
.ifPresentOrElse(
progress -> {
var ret = achievements.progress(integer, progress);
switch (ret.getRet()) {
case SUCCESS -> sendSuccessMessage(
sender, "progress", targetPlayer.getNickname(), integer, progress);
case ACHIEVEMENT_NOT_FOUND -> CommandHandler.sendTranslatedMessage(
sender, ret.getRet().getKey());
}
},
() -> this.sendUsageMessage(sender)),
integer ->
parseInt(args.remove(0))
.ifPresentOrElse(
progress -> {
var ret = achievements.progress(integer, progress);
switch (ret.getRet()) {
case SUCCESS -> sendSuccessMessage(
sender, "progress", targetPlayer.getNickname(), integer, progress);
case ACHIEVEMENT_NOT_FOUND -> CommandHandler.sendTranslatedMessage(
sender, ret.getRet().getKey());
}
},
() -> this.sendUsageMessage(sender)),
() -> this.sendUsageMessage(sender));
}
}

View File

@ -1,5 +1,8 @@
package emu.grasscutter.command.commands;
import static emu.grasscutter.GameConstants.*;
import static emu.grasscutter.command.CommandHelpers.*;
import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.data.GameData;
@ -14,30 +17,50 @@ import emu.grasscutter.game.inventory.ItemType;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.props.ActionReason;
import emu.grasscutter.game.props.FightProperty;
import lombok.Setter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.regex.Pattern;
import lombok.Setter;
import static emu.grasscutter.GameConstants.*;
import static emu.grasscutter.command.CommandHelpers.*;
@Command(label = "give", aliases = {"g", "item", "giveitem"}, usage = {"(<itemId>|<avatarId>|all|weapons|mats|avatars) [lv<level>] [r<refinement>] [x<amount>] [c<constellation>] [sl<skilllevel>]", "<artifactId> [lv<level>] [x<amount>] [<mainPropId>] [<appendPropId>[,<times>]]..."}, permission = "player.give", permissionTargeted = "player.give.others", threading = true)
@Command(
label = "give",
aliases = {"g", "item", "giveitem"},
usage = {
"(<itemId>|<avatarId>|all|weapons|mats|avatars) [lv<level>] [r<refinement>] [x<amount>] [c<constellation>] [sl<skilllevel>]",
"<artifactId> [lv<level>] [x<amount>] [<mainPropId>] [<appendPropId>[,<times>]]..."
},
permission = "player.give",
permissionTargeted = "player.give.others",
threading = true)
public final class GiveCommand implements CommandHandler {
private static final Map<Pattern, BiConsumer<GiveItemParameters, Integer>> intCommandHandlers = Map.ofEntries(Map.entry(lvlRegex, GiveItemParameters::setLvl), Map.entry(refineRegex, GiveItemParameters::setRefinement), Map.entry(amountRegex, GiveItemParameters::setAmount), Map.entry(constellationRegex, GiveItemParameters::setConstellation), Map.entry(skillLevelRegex, GiveItemParameters::setSkillLevel));
private static final Map<Pattern, BiConsumer<GiveItemParameters, Integer>> intCommandHandlers =
Map.ofEntries(
Map.entry(lvlRegex, GiveItemParameters::setLvl),
Map.entry(refineRegex, GiveItemParameters::setRefinement),
Map.entry(amountRegex, GiveItemParameters::setAmount),
Map.entry(constellationRegex, GiveItemParameters::setConstellation),
Map.entry(skillLevelRegex, GiveItemParameters::setSkillLevel));
private static Avatar makeAvatar(GiveItemParameters param) {
return makeAvatar(param.avatarData, param.lvl, Avatar.getMinPromoteLevel(param.lvl), param.constellation, param.skillLevel);
return makeAvatar(
param.avatarData,
param.lvl,
Avatar.getMinPromoteLevel(param.lvl),
param.constellation,
param.skillLevel);
}
private static Avatar makeAvatar(AvatarData avatarData, int level, int promoteLevel, int constellation, int skillLevel) {
private static Avatar makeAvatar(
AvatarData avatarData, int level, int promoteLevel, int constellation, int skillLevel) {
Avatar avatar = new Avatar(avatarData);
avatar.setLevel(level);
avatar.setPromoteLevel(promoteLevel);
avatar.getSkillDepot().getSkillsAndEnergySkill().forEach(id -> avatar.setSkillLevel(id, skillLevel));
avatar
.getSkillDepot()
.getSkillsAndEnergySkill()
.forEach(id -> avatar.setSkillLevel(id, skillLevel));
avatar.forceConstellationLevel(constellation);
avatar.recalcStats(true);
avatar.save();
@ -47,13 +70,16 @@ public final class GiveCommand implements CommandHandler {
private static void giveAllAvatars(Player player, GiveItemParameters param) {
int promoteLevel = Avatar.getMinPromoteLevel(param.lvl);
if (param.constellation < 0 || param.constellation > 6)
param.constellation = 6; // constellation's default is -1 so if no parameters set for constellations it'll
param.constellation =
6; // constellation's default is -1 so if no parameters set for constellations it'll
// automatically be 6
for (AvatarData avatarData : GameData.getAvatarDataMap().values()) {
int id = avatarData.getId();
if (id < 10000002 || id >= 11000000) continue; // Exclude test avatars
// Don't try to add each avatar to the current team
player.addAvatar(makeAvatar(avatarData, param.lvl, promoteLevel, param.constellation, param.skillLevel), false);
player.addAvatar(
makeAvatar(avatarData, param.lvl, promoteLevel, param.constellation, param.skillLevel),
false);
}
}
@ -93,7 +119,7 @@ public final class GiveCommand implements CommandHandler {
item.setTotalExp(totalExp);
int numAffixes = param.data.getAppendPropNum() + (param.lvl - 1) / 4;
if (param.mainPropId > 0) // Keep random mainProp if we didn't specify one
item.setMainPropId(param.mainPropId);
item.setMainPropId(param.mainPropId);
if (param.appendPropIdList != null) {
item.getAppendPropIdList().clear();
item.getAppendPropIdList().addAll(param.appendPropIdList);
@ -105,14 +131,17 @@ public final class GiveCommand implements CommandHandler {
return items;
}
private static int getArtifactMainProp(ItemData itemData, FightProperty prop) throws IllegalArgumentException {
private static int getArtifactMainProp(ItemData itemData, FightProperty prop)
throws IllegalArgumentException {
if (prop != FightProperty.FIGHT_PROP_NONE)
for (ReliquaryMainPropData data : GameDepot.getRelicMainPropList(itemData.getMainPropDepotId()))
for (ReliquaryMainPropData data :
GameDepot.getRelicMainPropList(itemData.getMainPropDepotId()))
if (data.getWeight() > 0 && data.getFightProp() == prop) return data.getId();
throw new IllegalArgumentException();
}
private static List<Integer> getArtifactAffixes(ItemData itemData, FightProperty prop) throws IllegalArgumentException {
private static List<Integer> getArtifactAffixes(ItemData itemData, FightProperty prop)
throws IllegalArgumentException {
if (prop == FightProperty.FIGHT_PROP_NONE) {
throw new IllegalArgumentException();
}
@ -125,7 +154,8 @@ public final class GiveCommand implements CommandHandler {
return affixes;
}
private static int getAppendPropId(String substatText, ItemData itemData) throws IllegalArgumentException {
private static int getAppendPropId(String substatText, ItemData itemData)
throws IllegalArgumentException {
// If the given substat text is an integer, we just use that as the append prop ID.
try {
return Integer.parseInt(substatText);
@ -142,7 +172,8 @@ public final class GiveCommand implements CommandHandler {
substatTier = Integer.parseInt(substatArgs[1]);
}
List<Integer> substats = getArtifactAffixes(itemData, FightProperty.getPropByShortName(substatType));
List<Integer> substats =
getArtifactAffixes(itemData, FightProperty.getPropByShortName(substatType));
if (substats.isEmpty()) {
throw new IllegalArgumentException();
@ -154,7 +185,8 @@ public final class GiveCommand implements CommandHandler {
}
}
private static void parseRelicArgs(GiveItemParameters param, List<String> args) throws IllegalArgumentException {
private static void parseRelicArgs(GiveItemParameters param, List<String> args)
throws IllegalArgumentException {
// Get the main stat from the arguments.
// If the given argument is an integer, we use that.
// If not, we check if the argument string is in the main prop map.
@ -164,7 +196,8 @@ public final class GiveCommand implements CommandHandler {
param.mainPropId = Integer.parseInt(mainPropIdString);
} catch (NumberFormatException ignored) {
// This can in turn throw an exception which we don't want to catch here.
param.mainPropId = getArtifactMainProp(param.data, FightProperty.getPropByShortName(mainPropIdString));
param.mainPropId =
getArtifactMainProp(param.data, FightProperty.getPropByShortName(mainPropIdString));
}
// Get substats.
@ -245,7 +278,8 @@ public final class GiveCommand implements CommandHandler {
giveAllWeapons(player, param);
}
private GiveItemParameters parseArgs(Player sender, List<String> args) throws IllegalArgumentException {
private GiveItemParameters parseArgs(Player sender, List<String> args)
throws IllegalArgumentException {
GiveItemParameters param = new GiveItemParameters();
// Extract any tagged arguments (e.g. "lv90", "x100", "r5")
@ -287,7 +321,9 @@ public final class GiveCommand implements CommandHandler {
param.avatarData = GameData.getAvatarDataMap().get(param.id - 1000 + 10_000_000);
isRelic = ((param.data != null) && (param.data.getItemType() == ItemType.ITEM_RELIQUARY));
if (!isRelic && !args.isEmpty() && (param.amount == 1)) { // A concession for the people that truly hate [x<amount>].
if (!isRelic
&& !args.isEmpty()
&& (param.amount == 1)) { // A concession for the people that truly hate [x<amount>].
try {
param.amount = Integer.parseInt(args.remove(0));
} catch (NumberFormatException e) {
@ -365,7 +401,8 @@ public final class GiveCommand implements CommandHandler {
if (param.avatarData != null) {
Avatar avatar = makeAvatar(param);
targetPlayer.addAvatar(avatar);
CommandHandler.sendTranslatedMessage(sender, "commands.give.given_avatar", param.id, param.lvl, targetPlayer.getUid());
CommandHandler.sendTranslatedMessage(
sender, "commands.give.given_avatar", param.id, param.lvl, targetPlayer.getUid());
return;
}
// If it's not an avatar, it needs to be a valid item
@ -376,37 +413,54 @@ public final class GiveCommand implements CommandHandler {
switch (param.data.getItemType()) {
case ITEM_WEAPON:
targetPlayer.getInventory().addItems(makeUnstackableItems(param), ActionReason.SubfieldDrop);
CommandHandler.sendTranslatedMessage(sender, "commands.give.given_with_level_and_refinement", param.id, param.lvl, param.refinement, param.amount, targetPlayer.getUid());
targetPlayer
.getInventory()
.addItems(makeUnstackableItems(param), ActionReason.SubfieldDrop);
CommandHandler.sendTranslatedMessage(
sender,
"commands.give.given_with_level_and_refinement",
param.id,
param.lvl,
param.refinement,
param.amount,
targetPlayer.getUid());
return;
case ITEM_RELIQUARY:
targetPlayer.getInventory().addItems(makeArtifacts(param), ActionReason.SubfieldDrop);
CommandHandler.sendTranslatedMessage(sender, "commands.give.given_level", param.id, param.lvl, param.amount, targetPlayer.getUid());
CommandHandler.sendTranslatedMessage(
sender,
"commands.give.given_level",
param.id,
param.lvl,
param.amount,
targetPlayer.getUid());
return;
default:
targetPlayer.getInventory().addItem(new GameItem(param.data, param.amount), ActionReason.SubfieldDrop);
CommandHandler.sendTranslatedMessage(sender, "commands.give.given", param.amount, param.id, targetPlayer.getUid());
targetPlayer
.getInventory()
.addItem(new GameItem(param.data, param.amount), ActionReason.SubfieldDrop);
CommandHandler.sendTranslatedMessage(
sender, "commands.give.given", param.amount, param.id, targetPlayer.getUid());
}
} catch (IllegalArgumentException ignored) {
}
}
private enum GiveAllType {
NONE, ALL, WEAPONS, MATS, AVATARS
NONE,
ALL,
WEAPONS,
MATS,
AVATARS
}
private static class GiveItemParameters {
public int id;
@Setter
public int lvl = 0;
@Setter
public int amount = 1;
@Setter
public int refinement = 1;
@Setter
public int constellation = -1;
@Setter
public int skillLevel = 1;
@Setter public int lvl = 0;
@Setter public int amount = 1;
@Setter public int refinement = 1;
@Setter public int constellation = -1;
@Setter public int skillLevel = 1;
public int mainPropId = -1;
public List<Integer> appendPropIdList;
public ItemData data;

View File

@ -24,8 +24,7 @@ public final class SendMailCommand implements CommandHandler {
// the command system (again). For now this will do
// Key = User that is constructing the mail.
private static final HashMap<Integer, MailBuilder> mailBeingConstructed =
new HashMap<>();
private static final HashMap<Integer, MailBuilder> mailBeingConstructed = new HashMap<>();
// Yes this is awful and I hate it.
@Override

View File

@ -95,7 +95,8 @@ public final class SetSceneTagCommand implements CommandHandler {
// Only remove for big world as some other scenes only have defaults
.filter(sceneTag -> sceneTag.getSceneId() == 3)
.forEach(
sceneTag -> targetPlayer.getSceneTags().get(sceneTag.getSceneId()).remove(sceneTag.getId()));
sceneTag ->
targetPlayer.getSceneTags().get(sceneTag.getSceneId()).remove(sceneTag.getId()));
this.setSceneTags(targetPlayer);
}

View File

@ -4,8 +4,6 @@ import emu.grasscutter.Grasscutter;
import emu.grasscutter.utils.FileUtils;
import emu.grasscutter.utils.JsonUtils;
import emu.grasscutter.utils.TsvUtils;
import lombok.val;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
@ -14,6 +12,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import lombok.val;
public class DataLoader {
@ -36,7 +35,7 @@ public class DataLoader {
*
* @param resourcePath The path to the data file to be loaded.
* @return InputStreamReader of the data file.
* @throws IOException If the file is not found.
* @throws IOException If the file is not found.
* @throws FileNotFoundException If the file is not found.
* @see #load(String, boolean)
*/
@ -50,19 +49,22 @@ public class DataLoader {
* Load a data file by its name.
*
* @param resourcePath The path to the data file to be loaded.
* @param useFallback If the file does not exist in the /data directory, should it use the default
* file in the jar?
* @param useFallback If the file does not exist in the /data directory, should it use the default
* file in the jar?
* @return InputStream of the data file.
* @throws FileNotFoundException If the file is not found.
*/
public static InputStream load(String resourcePath, boolean useFallback) throws FileNotFoundException {
Path path = useFallback ? FileUtils.getDataPath(resourcePath) : FileUtils.getDataUserPath(resourcePath);
public static InputStream load(String resourcePath, boolean useFallback)
throws FileNotFoundException {
Path path =
useFallback ? FileUtils.getDataPath(resourcePath) : FileUtils.getDataUserPath(resourcePath);
if (Files.exists(path)) {
// Data is in the resource directory
try {
return Files.newInputStream(path);
} catch (IOException e) {
throw new FileNotFoundException(e.getMessage()); // This is evil but so is changing the function signature at this point
throw new FileNotFoundException(
e.getMessage()); // This is evil but so is changing the function signature at this point
}
}
return null;
@ -80,13 +82,15 @@ public class DataLoader {
}
}
public static <T1, T2> Map<T1, T2> loadMap(String resourcePath, Class<T1> keyType, Class<T2> valueType) throws IOException {
public static <T1, T2> Map<T1, T2> loadMap(
String resourcePath, Class<T1> keyType, Class<T2> valueType) throws IOException {
try (InputStreamReader reader = loadReader(resourcePath)) {
return JsonUtils.loadToMap(reader, keyType, valueType);
}
}
public static <T> List<T> loadTableToList(String resourcePath, Class<T> classType) throws IOException {
public static <T> List<T> loadTableToList(String resourcePath, Class<T> classType)
throws IOException {
val path = FileUtils.getDataPathTsjJsonTsv(resourcePath);
Grasscutter.getLogger().trace("Loading data table from: {}", path);
return switch (FileUtils.getFileExtension(path)) {

View File

@ -630,15 +630,21 @@ public final class GameData {
// Non-nullable value getters
public static int getAvatarLevelExpRequired(int level) {
return Optional.ofNullable(avatarLevelDataMap.get(level)).map(AvatarLevelData::getExp).orElse(0);
return Optional.ofNullable(avatarLevelDataMap.get(level))
.map(AvatarLevelData::getExp)
.orElse(0);
}
public static int getAvatarFetterLevelExpRequired(int level) {
return Optional.ofNullable(avatarFetterLevelDataMap.get(level)).map(AvatarFetterLevelData::getExp).orElse(0);
return Optional.ofNullable(avatarFetterLevelDataMap.get(level))
.map(AvatarFetterLevelData::getExp)
.orElse(0);
}
public static int getRelicExpRequired(int rankLevel, int level) {
return Optional.ofNullable(getRelicLevelData(rankLevel, level)).map(ReliquaryLevelData::getExp).orElse(0);
return Optional.ofNullable(getRelicLevelData(rankLevel, level))
.map(ReliquaryLevelData::getExp)
.orElse(0);
}
// Generic getter
@ -655,7 +661,7 @@ public final class GameData {
field.setAccessible(false);
} catch (Exception e) {
Grasscutter.getLogger()
.error("Error fetching resource map for {}", resourceDefinition.getSimpleName(), e);
.error("Error fetching resource map for {}", resourceDefinition.getSimpleName(), e);
}
return map;

View File

@ -140,27 +140,28 @@ public final class ResourceLoader {
getResourceDefClassesPrioritySets()
.forEach(
classes -> classes.stream()
.parallel()
.unordered()
.forEach(
c -> {
val type = c.getAnnotation(ResourceType.class);
if (type == null) return;
classes ->
classes.stream()
.parallel()
.unordered()
.forEach(
c -> {
val type = c.getAnnotation(ResourceType.class);
if (type == null) return;
val map = GameData.getMapByResourceDef(c);
if (map == null) return;
val map = GameData.getMapByResourceDef(c);
if (map == null) return;
try {
loadFromResource(c, type, map, doReload);
} catch (Exception e) {
errors.add(Pair.of(Arrays.toString(type.name()), e));
}
}));
try {
loadFromResource(c, type, map, doReload);
} catch (Exception e) {
errors.add(Pair.of(Arrays.toString(type.name()), e));
}
}));
errors.forEach(
pair ->
Grasscutter.getLogger()
.error("Error loading resource file: {}", pair.left(), pair.right()));
Grasscutter.getLogger()
.error("Error loading resource file: {}", pair.left(), pair.right()));
long endTime = System.nanoTime();
long ns = (endTime - startTime); // divide by 1000000 to get milliseconds.
Grasscutter.getLogger().debug("Loading resources took {}ns == {}ms", ns, ns / 1000000);
@ -168,7 +169,7 @@ public final class ResourceLoader {
@SuppressWarnings("rawtypes")
private static void loadFromResource(
Class<?> c, ResourceType type, Int2ObjectMap map, boolean doReload) throws Exception {
Class<?> c, ResourceType type, Int2ObjectMap map, boolean doReload) throws Exception {
val simpleName = c.getSimpleName();
if (doReload || !loadedResources.contains(simpleName)) {
for (String name : type.name()) {
@ -281,7 +282,7 @@ public final class ResourceLoader {
}
});
Grasscutter.getLogger()
.debug("Loaded {} SceneRouteDatas.", GameData.getSceneNpcBornData().size());
.debug("Loaded {} SceneRouteDatas.", GameData.getSceneNpcBornData().size());
} catch (IOException e) {
Grasscutter.getLogger().error("Failed to load SceneRouteData folder.");
}
@ -402,7 +403,7 @@ public final class ResourceLoader {
.forEach(data -> loadAbilityData(data.Default));
} catch (IOException e) {
Grasscutter.getLogger()
.error("Error loading ability modifiers from path {}: ", path.toString(), e);
.error("Error loading ability modifiers from path {}: ", path.toString(), e);
}
}
@ -464,7 +465,7 @@ public final class ResourceLoader {
path, String.class, new TypeToken<List<TalentData>>() {}.getType()));
} catch (IOException e) {
Grasscutter.getLogger()
.error("Error loading ability modifiers from path {}: ", path.toString(), e);
.error("Error loading ability modifiers from path {}: ", path.toString(), e);
}
}
@ -531,7 +532,7 @@ public final class ResourceLoader {
});
} catch (IOException e) {
Grasscutter.getLogger()
.error("Error loading open config: no files found in {}", folderName);
.error("Error loading open config: no files found in {}", folderName);
return;
}
}
@ -587,7 +588,7 @@ public final class ResourceLoader {
}
Grasscutter.getLogger()
.debug("Loaded {} MainQuestDatas.", GameData.getMainQuestDataMap().size());
.debug("Loaded {} MainQuestDatas.", GameData.getMainQuestDataMap().size());
}
public static void loadScriptSceneData() {
@ -605,7 +606,7 @@ public final class ResourceLoader {
}
});
Grasscutter.getLogger()
.debug("Loaded {} ScriptSceneDatas.", GameData.getScriptSceneDataMap().size());
.debug("Loaded {} ScriptSceneDatas.", GameData.getScriptSceneDataMap().size());
} catch (IOException e) {
Grasscutter.getLogger().debug("ScriptSceneData folder missing or empty.");
}
@ -629,7 +630,9 @@ public final class ResourceLoader {
}
});
Grasscutter.getLogger()
.debug("Loaded {} HomeworldDefaultSaveDatas.", GameData.getHomeworldDefaultSaveData().size());
.debug(
"Loaded {} HomeworldDefaultSaveDatas.",
GameData.getHomeworldDefaultSaveData().size());
} catch (IOException e) {
Grasscutter.getLogger().error("Failed to load HomeworldDefaultSave folder.");
}
@ -654,7 +657,7 @@ public final class ResourceLoader {
}
});
Grasscutter.getLogger()
.debug("Loaded {} SceneNpcBornDatas.", GameData.getSceneNpcBornData().size());
.debug("Loaded {} SceneNpcBornDatas.", GameData.getSceneNpcBornData().size());
} catch (IOException e) {
Grasscutter.getLogger().error("Failed to load SceneNpcBorn folder.");
}

View File

@ -13,5 +13,4 @@ public class AbilityEmbryoEntry {
this.name = avatarName;
this.abilities = array;
}
}

View File

@ -3,14 +3,12 @@ package emu.grasscutter.data.binout;
import com.google.gson.*;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import java.io.Serial;
import java.io.Serializable;
import java.util.*;
public class AbilityMixinData implements Serializable {
@Serial
private static final long serialVersionUID = -2001232313615923575L;
@Serial private static final long serialVersionUID = -2001232313615923575L;
public enum Type {
AttachToGadgetStateMixin,

View File

@ -3,14 +3,12 @@ package emu.grasscutter.data.binout;
import com.google.gson.annotations.SerializedName;
import emu.grasscutter.data.common.DynamicFloat;
import emu.grasscutter.game.props.ElementType;
import java.io.Serial;
import java.io.Serializable;
import lombok.ToString;
public class AbilityModifier implements Serializable {
@Serial
private static final long serialVersionUID = -2001232313615923575L;
@Serial private static final long serialVersionUID = -2001232313615923575L;
public State state;

View File

@ -1,18 +1,14 @@
package emu.grasscutter.data.binout;
import emu.grasscutter.data.binout.AbilityModifier.AbilityModifierAction;
import lombok.Getter;
import java.util.*;
import lombok.Getter;
public class AbilityModifierEntry {
public final List<AbilityModifierAction> onModifierAdded;
@Getter
public final List<AbilityModifierAction> onThinkInterval;
@Getter
public final List<AbilityModifierAction> onRemoved;
@Getter
private final String name; // Custom value
@Getter public final List<AbilityModifierAction> onThinkInterval;
@Getter public final List<AbilityModifierAction> onRemoved;
@Getter private final String name; // Custom value
public AbilityModifierEntry(String name) {
this.name = name;
@ -24,5 +20,4 @@ public class AbilityModifierEntry {
public List<AbilityModifierAction> getOnAdded() {
return onModifierAdded;
}
}

View File

@ -8,25 +8,17 @@ import lombok.Data;
import lombok.Getter;
public class MainQuestData {
@Getter
private int id;
@Getter private int id;
private int ICLLDPJFIMA;
@Getter
private int series;
@Getter
private QuestType type;
@Getter private int series;
@Getter private QuestType type;
@Getter
private long titleTextMapHash;
@Getter
private int[] suggestTrackMainQuestList;
@Getter
private int[] rewardIdList;
@Getter private long titleTextMapHash;
@Getter private int[] suggestTrackMainQuestList;
@Getter private int[] rewardIdList;
@Getter
private SubQuestData[] subQuests;
@Getter
private List<TalkData> talks;
@Getter private SubQuestData[] subQuests;
@Getter private List<TalkData> talks;
private long[] preloadLuaList;
public void onLoad() {

View File

@ -1,9 +1,8 @@
package emu.grasscutter.data.binout;
import emu.grasscutter.data.ResourceLoader.OpenConfigData;
import lombok.Getter;
import java.util.*;
import lombok.Getter;
@Getter
public class OpenConfigEntry {
@ -46,6 +45,5 @@ public class OpenConfigEntry {
this.skillId = skillId;
this.delta = delta;
}
}
}

View File

@ -7,5 +7,4 @@ public class CurveInfo {
private String type;
private String arith;
private float value;
}

View File

@ -5,8 +5,7 @@ import lombok.Getter;
public class ItemUseData {
private ItemUseOp useOp;
@Getter
private String[] useParam;
@Getter private String[] useParam;
public ItemUseOp getUseOp() {
if (useOp == null) {
@ -14,5 +13,4 @@ public class ItemUseData {
}
return useOp;
}
}

View File

@ -1,8 +1,7 @@
package emu.grasscutter.data.common;
import lombok.Getter;
import java.util.List;
import lombok.Getter;
@Getter
public class OpenCondData {

View File

@ -6,5 +6,4 @@ import lombok.Getter;
public class PropGrowCurve {
private String type;
private String growCurve;
}

View File

@ -2,35 +2,24 @@ package emu.grasscutter.data.excels;
import emu.grasscutter.data.*;
import emu.grasscutter.data.common.ItemParamData;
import lombok.Getter;
import java.util.List;
import java.util.stream.Collectors;
import lombok.Getter;
@ResourceType(name = "CombineExcelConfigData.json")
public class CombineData extends GameResource {
@Getter
private int combineId;
@Getter
private int playerLevel;
@Getter private int combineId;
@Getter private int playerLevel;
private boolean isDefaultShow;
@Getter
private int combineType;
@Getter
private int subCombineType;
@Getter
private int resultItemId;
@Getter
private int resultItemCount;
@Getter
private int scoinCost;
@Getter
private List<ItemParamData> randomItems;
@Getter
private List<ItemParamData> materialItems;
@Getter
private String recipeType;
@Getter private int combineType;
@Getter private int subCombineType;
@Getter private int resultItemId;
@Getter private int resultItemCount;
@Getter private int scoinCost;
@Getter private List<ItemParamData> randomItems;
@Getter private List<ItemParamData> materialItems;
@Getter private String recipeType;
@Override
public int getId() {
@ -50,5 +39,4 @@ public class CombineData extends GameResource {
public boolean isDefaultShow() {
return isDefaultShow;
}
}

View File

@ -2,18 +2,15 @@ package emu.grasscutter.data.excels;
import emu.grasscutter.data.*;
import emu.grasscutter.data.common.ItemParamData;
import lombok.Getter;
import java.util.List;
import lombok.Getter;
@ResourceType(
name = "EnvAnimalGatherExcelConfigData.json",
loadPriority = ResourceType.LoadPriority.LOW)
public class EnvAnimalGatherConfigData extends GameResource {
@Getter
private int animalId;
@Getter
private String entityType;
@Getter private int animalId;
@Getter private String entityType;
private List<ItemParamData> gatherItemId;
private String excludeWeathers;
private int aliveTime;

View File

@ -2,25 +2,19 @@ package emu.grasscutter.data.excels;
import emu.grasscutter.data.*;
import emu.grasscutter.data.common.FightPropData;
import lombok.Getter;
import java.util.ArrayList;
import lombok.Getter;
@ResourceType(name = "EquipAffixExcelConfigData.json")
public class EquipAffixData extends GameResource {
private int affixId;
private int id;
@Getter
private int level;
@Getter
private long nameTextMapHash;
@Getter
private String openConfig;
@Getter
private FightPropData[] addProps;
@Getter
private float[] paramList;
@Getter private int level;
@Getter private long nameTextMapHash;
@Getter private String openConfig;
@Getter private FightPropData[] addProps;
@Getter private float[] paramList;
@Override
public int getId() {

View File

@ -7,8 +7,7 @@ import lombok.Getter;
@ResourceType(name = "FetterCharacterCardExcelConfigData.json", loadPriority = LoadPriority.HIGHEST)
public class FetterCharacterCardData extends GameResource {
private int avatarId;
@Getter
private int rewardId;
@Getter private int rewardId;
@Override
public int getId() {

View File

@ -3,9 +3,8 @@ package emu.grasscutter.data.excels;
import emu.grasscutter.data.*;
import emu.grasscutter.data.ResourceType.LoadPriority;
import emu.grasscutter.data.common.OpenCondData;
import lombok.Getter;
import java.util.List;
import lombok.Getter;
@ResourceType(
name = {
@ -17,8 +16,7 @@ import java.util.List;
},
loadPriority = LoadPriority.HIGHEST)
public class FetterData extends GameResource {
@Getter
private int avatarId;
@Getter private int avatarId;
private int fetterId;
private List<OpenCondData> openCond;

View File

@ -7,12 +7,9 @@ import lombok.Getter;
public class GatherData extends GameResource {
private int pointType;
private int id;
@Getter
private int gadgetId;
@Getter
private int itemId;
@Getter
private int cd; // Probably hours
@Getter private int gadgetId;
@Getter private int itemId;
@Getter private int cd; // Probably hours
private boolean isForbidGuest;
private boolean initDisableInteract;

View File

@ -25,7 +25,8 @@ public class ProudSkillData extends GameResource {
@Getter private long nameTextMapHash;
@Transient private Iterable<ItemParamData> totalCostItems;
@Transient @Getter private final Object2FloatMap<String> paramListMap = new Object2FloatOpenHashMap<>();
@Transient @Getter
private final Object2FloatMap<String> paramListMap = new Object2FloatOpenHashMap<>();
@Override
public int getId() {

View File

@ -2,15 +2,13 @@ package emu.grasscutter.data.excels;
import emu.grasscutter.data.*;
import emu.grasscutter.data.common.ItemParamData;
import lombok.Getter;
import java.util.List;
import lombok.Getter;
@ResourceType(name = "RewardExcelConfigData.json")
public class RewardData extends GameResource {
public int rewardId;
@Getter
public List<ItemParamData> rewardItemList;
@Getter public List<ItemParamData> rewardItemList;
@Override
public int getId() {

View File

@ -4,38 +4,26 @@ import com.google.gson.annotations.SerializedName;
import emu.grasscutter.data.*;
import emu.grasscutter.data.common.ItemParamData;
import emu.grasscutter.game.shop.ShopInfo;
import lombok.Getter;
import java.util.List;
import lombok.Getter;
@ResourceType(name = "ShopGoodsExcelConfigData.json")
public class ShopGoodsData extends GameResource {
@Getter
private int goodsId;
@Getter
private int shopType;
@Getter
private int itemId;
@Getter private int goodsId;
@Getter private int shopType;
@Getter private int itemId;
@Getter
private int itemCount;
@Getter private int itemCount;
@Getter
private int costScoin;
@Getter
private int costHcoin;
@Getter
private int costMcoin;
@Getter private int costScoin;
@Getter private int costHcoin;
@Getter private int costMcoin;
@Getter
private List<ItemParamData> costItems;
@Getter
private int minPlayerLevel;
@Getter
private int maxPlayerLevel;
@Getter private List<ItemParamData> costItems;
@Getter private int minPlayerLevel;
@Getter private int maxPlayerLevel;
@Getter
private int buyLimit;
@Getter private int buyLimit;
@Getter
@SerializedName(
@ -46,8 +34,7 @@ public class ShopGoodsData extends GameResource {
private String refreshType;
private transient ShopInfo.ShopRefreshType refreshTypeEnum;
@Getter
private int refreshParam;
@Getter private int refreshParam;
@Override
public void onLoad() {
@ -71,5 +58,4 @@ public class ShopGoodsData extends GameResource {
public ShopInfo.ShopRefreshType getRefreshType() {
return refreshTypeEnum;
}
}

View File

@ -9,12 +9,9 @@ public class AvatarCostumeData extends GameResource {
@SerializedName(value = "skinId", alternate = "costumeId")
private int skinId;
@Getter
private int itemId;
@Getter
private int characterId;
@Getter
private int quality;
@Getter private int itemId;
@Getter private int characterId;
@Getter private int quality;
@Override
public int getId() {

View File

@ -2,15 +2,13 @@ package emu.grasscutter.data.excels.avatar;
import emu.grasscutter.data.*;
import emu.grasscutter.data.common.CurveInfo;
import lombok.Getter;
import java.util.*;
import java.util.stream.Stream;
import lombok.Getter;
@ResourceType(name = "AvatarCurveExcelConfigData.json")
public class AvatarCurveData extends GameResource {
@Getter
private int level;
@Getter private int level;
private CurveInfo[] curveInfos;
private Map<String, Float> curveInfoMap;

View File

@ -6,8 +6,7 @@ import lombok.Getter;
@ResourceType(name = "AvatarFlycloakExcelConfigData.json")
public class AvatarFlycloakData extends GameResource {
private int flycloakId;
@Getter
private long nameTextMapHash;
@Getter private long nameTextMapHash;
@Override
public int getId() {

View File

@ -13,5 +13,4 @@ public class AvatarLevelData extends GameResource {
public int getId() {
return this.level;
}
}

View File

@ -2,26 +2,19 @@ package emu.grasscutter.data.excels.avatar;
import emu.grasscutter.data.*;
import emu.grasscutter.data.common.*;
import lombok.Getter;
import java.util.ArrayList;
import lombok.Getter;
@ResourceType(name = "AvatarPromoteExcelConfigData.json")
public class AvatarPromoteData extends GameResource {
@Getter
private int avatarPromoteId;
@Getter
private int promoteLevel;
@Getter private int avatarPromoteId;
@Getter private int promoteLevel;
private int scoinCost;
@Getter
private ItemParamData[] costItems;
@Getter
private int unlockMaxLevel;
@Getter
private FightPropData[] addProps;
@Getter
private int requiredPlayerLevel;
@Getter private ItemParamData[] costItems;
@Getter private int unlockMaxLevel;
@Getter private FightPropData[] addProps;
@Getter private int requiredPlayerLevel;
@Override
public int getId() {

View File

@ -3,28 +3,20 @@ package emu.grasscutter.data.excels.avatar;
import emu.grasscutter.data.*;
import emu.grasscutter.data.ResourceType.LoadPriority;
import emu.grasscutter.data.common.FightPropData;
import lombok.Getter;
import java.util.ArrayList;
import lombok.Getter;
@ResourceType(name = "AvatarTalentExcelConfigData.json", loadPriority = LoadPriority.HIGHEST)
public class AvatarTalentData extends GameResource {
private int talentId;
private int prevTalent;
@Getter
private long nameTextMapHash;
@Getter
private String icon;
@Getter
private int mainCostItemId;
@Getter
private int mainCostItemCount;
@Getter
private String openConfig;
@Getter
private FightPropData[] addProps;
@Getter
private float[] paramList;
@Getter private long nameTextMapHash;
@Getter private String icon;
@Getter private int mainCostItemId;
@Getter private int mainCostItemCount;
@Getter private String openConfig;
@Getter private FightPropData[] addProps;
@Getter private float[] paramList;
@Override
public int getId() {

View File

@ -5,14 +5,10 @@ import lombok.Getter;
@ResourceType(name = {"QuestCodexExcelConfigData.json"})
public class CodexQuestData extends GameResource {
@Getter
private int Id;
@Getter
private int parentQuestId;
@Getter
private int chapterId;
@Getter
private int sortOrder;
@Getter private int Id;
@Getter private int parentQuestId;
@Getter private int chapterId;
@Getter private int sortOrder;
private boolean isDisuse;
public boolean getIsDisuse() {

View File

@ -5,13 +5,10 @@ import lombok.Getter;
@ResourceType(name = {"WeaponCodexExcelConfigData.json"})
public class CodexWeaponData extends GameResource {
@Getter
private int Id;
@Getter
private int weaponId;
@Getter private int Id;
@Getter private int weaponId;
private int gadgetId;
@Getter
private int sortOrder;
@Getter private int sortOrder;
public int getGadgetId() {
return weaponId;

View File

@ -9,8 +9,7 @@ import lombok.Getter;
@Getter
@ResourceType(name = "DungeonChallengeConfigData.json")
public class DungeonChallengeConfigData extends GameResource {
@Getter
private int id;
@Getter private int id;
private ChallengeType challengeType;
private boolean noSuccessHint;
private boolean noFailHint;
@ -43,7 +42,7 @@ public class DungeonChallengeConfigData extends GameResource {
alternate = {"NJBJIKAIENN"})
private AllowAnimationType animationOnSubFail;
public enum InterruptButtonType {
public enum InterruptButtonType {
INTERRUPT_BUTTON_TYPE_NONE,
INTERRUPT_BUTTON_TYPE_HOST,
INTERRUPT_BUTTON_TYPE_ALL

View File

@ -7,8 +7,7 @@ import lombok.Getter;
@ResourceType(name = "ReliquarySetExcelConfigData.json")
public class ReliquarySetData extends GameResource {
private int setId;
@Getter
private int[] setNeedNum;
@Getter private int[] setNeedNum;
@Getter
@SerializedName(

View File

@ -1,9 +1,8 @@
package emu.grasscutter.data.excels.tower;
import emu.grasscutter.data.*;
import lombok.Getter;
import java.util.List;
import lombok.Getter;
@Getter
@ResourceType(name = "TowerScheduleExcelConfigData.json")
@ -28,6 +27,5 @@ public class TowerScheduleData extends GameResource {
@Getter
public static class ScheduleDetail {
private List<Integer> floorList;
}
}

View File

@ -13,5 +13,4 @@ public class WeaponLevelData extends GameResource {
public int getId() {
return this.level;
}
}

View File

@ -2,9 +2,8 @@ package emu.grasscutter.data.excels.weapon;
import emu.grasscutter.data.*;
import emu.grasscutter.data.common.*;
import lombok.Getter;
import java.util.ArrayList;
import lombok.Getter;
@Getter
@ResourceType(name = "WeaponPromoteExcelConfigData.json")

View File

@ -6,8 +6,7 @@ import lombok.Getter;
@ResourceType(name = "WorldLevelExcelConfigData.json")
public class WorldLevelData extends GameResource {
private int level;
@Getter
private int monsterLevel;
@Getter private int monsterLevel;
@Override
public int getId() {

View File

@ -5,9 +5,8 @@ import com.github.davidmoten.rtreemulti.geometry.Geometry;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.game.world.*;
import emu.grasscutter.scripts.SceneIndexManager;
import lombok.Getter;
import java.util.*;
import lombok.Getter;
public class Grid {
public transient RTree<Map.Entry<GridPosition, Set<Integer>>, Geometry> gridOptimized = null;
@ -18,8 +17,7 @@ public class Grid {
*
* @return The correctly loaded grid map.
*/
@Getter
public Map<GridPosition, Set<Integer>> grid = new LinkedHashMap<>();
@Getter public Map<GridPosition, Set<Integer>> grid = new LinkedHashMap<>();
/** Creates an optimized cache of the grid. */
private void optimize() {

View File

@ -550,7 +550,7 @@ public final class DatabaseHelper {
.first();
} catch (IllegalArgumentException e) {
Grasscutter.getLogger()
.debug("Error occurred while getting uid {}'s achievement data", uid, e);
.debug("Error occurred while getting uid {}'s achievement data", uid, e);
DatabaseManager.getGameDatabase().getCollection("achievements").deleteMany(eq("uid", uid));
return null;
}

View File

@ -14,8 +14,7 @@ import emu.grasscutter.game.Account;
import lombok.Getter;
public final class DatabaseManager {
@Getter
private static Datastore gameDatastore;
@Getter private static Datastore gameDatastore;
private static Datastore dispatchDatastore;
public static Datastore getAccountDatastore() {

View File

@ -7,16 +7,13 @@ import emu.grasscutter.database.DatabaseHelper;
import emu.grasscutter.utils.*;
import java.util.*;
import java.util.stream.Stream;
import lombok.Getter;
import lombok.Setter;
import org.bson.Document;
@Entity(value = "accounts", useDiscriminator = false)
public class Account {
@Setter
@Getter
@Id private String id;
@Setter @Getter @Id private String id;
@Setter
@Getter
@ -24,38 +21,21 @@ public class Account {
@Collation(locale = "simple", caseLevel = true)
private String username;
@Setter
@Getter
private String password; // Unused for now
@Setter @Getter private String password; // Unused for now
private int reservedPlayerId;
@Setter
private String email;
@Setter private String email;
@Setter
@Getter
private String token;
@Getter
private String sessionKey; // Session token for dispatch server
/**
* -- GETTER --
* The collection of a player's permissions.
*/
@Getter
private final List<String> permissions;
@Setter
@Getter
private Locale locale;
@Setter @Getter private String token;
@Getter private String sessionKey; // Session token for dispatch server
/** -- GETTER -- The collection of a player's permissions. */
@Getter private final List<String> permissions;
@Setter
@Getter
private String banReason;
@Setter
@Getter
private int banEndTime;
@Setter
@Getter
private int banStartTime;
@Setter @Getter private Locale locale;
@Setter @Getter private String banReason;
@Setter @Getter private int banEndTime;
@Setter @Getter private int banStartTime;
private boolean isBanned;
@Deprecated

View File

@ -22,7 +22,8 @@ public class Ability {
@Getter private final Object2FloatMap<String> abilitySpecials = new Object2FloatOpenHashMap<>();
@Getter
private static final Map<String, Object2FloatMap<String>> abilitySpecialsModified = new HashMap<>();
private static final Map<String, Object2FloatMap<String>> abilitySpecialsModified =
new HashMap<>();
@Getter private final int hash;
@Getter private final Set<Integer> avatarSkillStartIds;

View File

@ -83,12 +83,13 @@ public final class AbilityManager extends BasePlayerManager {
boolean skillInvincibility = modifier.state == AbilityModifier.State.Invincible;
if (modifier.onAdded != null) {
skillInvincibility |=
!Arrays.stream(modifier.onAdded)
.filter(
action ->
action.type == AbilityModifierAction.Type.AttachAbilityStateResistance
&& action.resistanceListID == 11002)
.toList().isEmpty();
!Arrays.stream(modifier.onAdded)
.filter(
action ->
action.type == AbilityModifierAction.Type.AttachAbilityStateResistance
&& action.resistanceListID == 11002)
.toList()
.isEmpty();
}
if (this.burstCasterId == entityId
@ -177,7 +178,12 @@ public final class AbilityManager extends BasePlayerManager {
public void onAbilityInvoke(AbilityInvokeEntry invoke) throws Exception {
Grasscutter.getLogger()
.trace("Ability invoke: {} {} ({}): {}", invoke, invoke.getArgumentType(), invoke.getArgumentTypeValue(), this.player.getScene().getEntityById(invoke.getEntityId()));
.trace(
"Ability invoke: {} {} ({}): {}",
invoke,
invoke.getArgumentType(),
invoke.getArgumentTypeValue(),
this.player.getScene().getEntityById(invoke.getEntityId()));
var entity = this.player.getScene().getEntityById(invoke.getEntityId());
if (entity != null) {
Grasscutter.getLogger()
@ -204,7 +210,8 @@ public final class AbilityManager extends BasePlayerManager {
if (invoke.getHead().getTargetId() != 0) {
Grasscutter.getLogger()
.trace("Target: {}", this.player.getScene().getEntityById(invoke.getHead().getTargetId()));
.trace(
"Target: {}", this.player.getScene().getEntityById(invoke.getHead().getTargetId()));
}
if (invoke.getHead().getLocalId() != 0) {
this.handleServerInvoke(invoke);

View File

@ -61,9 +61,10 @@ public class Achievements {
GameData.getAchievementDataMap().values().stream()
.filter(AchievementData::isUsed)
.forEach(
a -> map.put(
a.getId(),
new Achievement(Status.STATUS_UNFINISHED, a.getId(), a.getProgress(), 0, 0)));
a ->
map.put(
a.getId(),
new Achievement(Status.STATUS_UNFINISHED, a.getId(), a.getProgress(), 0, 0)));
return map;
}
@ -175,12 +176,13 @@ public class Achievements {
return this.getAchievementList()
.computeIfAbsent(
achievementId,
id -> new Achievement(
Status.STATUS_UNFINISHED,
id,
GameData.getAchievementDataMap().get(id.intValue()).getProgress(),
0,
0));
id ->
new Achievement(
Status.STATUS_UNFINISHED,
id,
GameData.getAchievementDataMap().get(id.intValue()).getProgress(),
0,
0));
}
public boolean isInvalid(int achievementId) {
@ -231,7 +233,7 @@ public class Achievements {
});
var a = this.getAchievement(i);
if(a == null) {
if (a == null) {
Grasscutter.getLogger().warn("null returned while getting achievement!");
return;
}

View File

@ -25,7 +25,8 @@ public class AllActivityConditionBuilder {
private Map<ActivityConditions, ActivityConditionBaseHandler> initActivityConditions() {
Reflections reflector = Grasscutter.reflector;
return reflector.getTypesAnnotatedWith(ActivityCondition.class).stream()
.map(this::newInstance).filter(Objects::nonNull)
.map(this::newInstance)
.filter(Objects::nonNull)
.map(h -> new AbstractMap.SimpleEntry<>(extractActionType(h), h))
.collect(
Collectors.toMap(AbstractMap.SimpleEntry::getKey, AbstractMap.SimpleEntry::getValue));

View File

@ -1,5 +1,7 @@
package emu.grasscutter.game.avatar;
import static emu.grasscutter.config.Configuration.GAME_OPTIONS;
import dev.morphia.annotations.*;
import emu.grasscutter.GameConstants;
import emu.grasscutter.data.GameData;
@ -44,130 +46,72 @@ import emu.grasscutter.net.proto.TrialAvatarInfoOuterClass.TrialAvatarInfo;
import emu.grasscutter.server.packet.send.*;
import emu.grasscutter.utils.helpers.ProtoHelper;
import it.unimi.dsi.fastutil.ints.*;
import java.util.*;
import java.util.stream.Stream;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.val;
import org.bson.types.ObjectId;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.*;
import java.util.stream.Stream;
import static emu.grasscutter.config.Configuration.GAME_OPTIONS;
@Entity(value = "avatars", useDiscriminator = false)
public class Avatar {
@Transient
@Getter
private final Int2ObjectMap<GameItem> equips;
@Transient
@Getter
private final Int2FloatOpenHashMap fightProperties;
@Transient
@Getter
private final Int2FloatOpenHashMap fightPropOverrides;
@Id
private ObjectId id;
@Indexed
@Getter
private int ownerId; // Id of player that this avatar belongs to
@Transient
private Player owner;
@Transient
@Getter
private AvatarData avatarData;
@Nullable
@Transient
@Getter
private AvatarSkillDepotData skillDepot;
@Transient
@Getter
private long guid; // Player unique id
@Getter
private int avatarId; // Id of avatar
@Getter
@Setter
private int level = 1;
@Getter
@Setter
private int exp;
@Getter
@Setter
private int promoteLevel;
@Getter
@Setter
private int satiation; // Fullness
@Getter
@Setter
private int satiationPenalty; // When eating too much
@Getter
@Setter
private float currentHp;
@Transient @Getter private final Int2ObjectMap<GameItem> equips;
@Transient @Getter private final Int2FloatOpenHashMap fightProperties;
@Transient @Getter private final Int2FloatOpenHashMap fightPropOverrides;
@Id private ObjectId id;
@Indexed @Getter private int ownerId; // Id of player that this avatar belongs to
@Transient private Player owner;
@Transient @Getter private AvatarData avatarData;
@Nullable @Transient @Getter private AvatarSkillDepotData skillDepot;
@Transient @Getter private long guid; // Player unique id
@Getter private int avatarId; // Id of avatar
@Getter @Setter private int level = 1;
@Getter @Setter private int exp;
@Getter @Setter private int promoteLevel;
@Getter @Setter private int satiation; // Fullness
@Getter @Setter private int satiationPenalty; // When eating too much
@Getter @Setter private float currentHp;
private float currentEnergy;
@Transient
@Getter
private Set<String> extraAbilityEmbryos;
@Transient @Getter private Set<String> extraAbilityEmbryos;
private List<Integer> fetters;
private final Map<Integer, Integer> skillLevelMap = new Int2IntArrayMap(7); // Talent levels
@Transient
@Getter
@Transient @Getter
private final Map<Integer, Integer> skillExtraChargeMap = new Int2IntArrayMap(2); // Charges
@Transient
private final Map<Integer, Integer> proudSkillBonusMap = new Int2IntArrayMap(2); // Talent bonus levels (from const)
private final Map<Integer, Integer> proudSkillBonusMap =
new Int2IntArrayMap(2); // Talent bonus levels (from const)
@Getter
private int skillDepotId;
@Getter private int skillDepotId;
private Set<Integer> talentIdList; // Constellation id list
@Getter
private Set<Integer> proudSkillList; // Character passives
@Getter private Set<Integer> proudSkillList; // Character passives
@Getter
@Setter
private int flyCloak;
@Getter
@Setter
private int costume;
@Getter
private int bornTime;
@Getter @Setter private int flyCloak;
@Getter @Setter private int costume;
@Getter private int bornTime;
@Getter
@Setter
private int fetterLevel = 1;
@Getter
@Setter
private int fetterExp;
@Getter @Setter private int fetterLevel = 1;
@Getter @Setter private int fetterExp;
@Getter
@Setter
private int nameCardRewardId;
@Getter
@Setter
private int nameCardId;
@Getter @Setter private int nameCardRewardId;
@Getter @Setter private int nameCardId;
// trial avatar property
@Getter
@Setter
private int trialAvatarId = 0;
@Getter @Setter private int trialAvatarId = 0;
// cannot store to db if grant reason is not integer
@Getter
@Setter
@Getter @Setter
private int grantReason = TrialAvatarGrantRecord.GrantReason.GRANT_REASON_INVALID.getNumber();
@Getter
@Setter
private int fromParentQuestId = 0;
@Getter @Setter private int fromParentQuestId = 0;
// so far no outer class or prop value has information of this, but from packet:
// 1 = normal, 2 = trial avatar
@Transient
@Getter
@Setter
private int avatarType = Type.NORMAL.getNumber();
@Transient @Getter @Setter private int avatarType = Type.NORMAL.getNumber();
@Deprecated // Do not use. Morhpia only!
public Avatar() {
@ -197,13 +141,18 @@ public class Avatar {
this.proudSkillList = new HashSet<>();
// Combat properties
Stream.of(FightProperty.values()).map(FightProperty::getId).filter(id -> (id > 0) && (id < 3000)).forEach(id -> this.setFightProperty(id, 0f));
Stream.of(FightProperty.values())
.map(FightProperty::getId)
.filter(id -> (id > 0) && (id < 3000))
.forEach(id -> this.setFightProperty(id, 0f));
this.setSkillDepotData(switch (this.getAvatarId()) {
case GameConstants.MAIN_CHARACTER_MALE -> GameData.getAvatarSkillDepotDataMap().get(501);
case GameConstants.MAIN_CHARACTER_FEMALE -> GameData.getAvatarSkillDepotDataMap().get(701);
default -> data.getSkillDepot();
});
this.setSkillDepotData(
switch (this.getAvatarId()) {
case GameConstants.MAIN_CHARACTER_MALE -> GameData.getAvatarSkillDepotDataMap().get(501);
case GameConstants.MAIN_CHARACTER_FEMALE -> GameData.getAvatarSkillDepotDataMap()
.get(701);
default -> data.getSkillDepot();
});
// Set stats
this.recalcStats();
@ -235,7 +184,8 @@ public class Avatar {
* @return True if the avatar is a main character.
*/
public boolean isMainCharacter() {
return List.of(GameConstants.MAIN_CHARACTER_MALE, GameConstants.MAIN_CHARACTER_FEMALE).contains(this.getAvatarId());
return List.of(GameConstants.MAIN_CHARACTER_MALE, GameConstants.MAIN_CHARACTER_FEMALE)
.contains(this.getAvatarId());
}
public Player getPlayer() {
@ -297,8 +247,7 @@ public class Avatar {
/**
* @return The avatar's equipped weapon.
*/
@Nullable
public GameItem getWeapon() {
@Nullable public GameItem getWeapon() {
return this.getEquipBySlot(EquipType.EQUIP_WEAPON);
}
@ -328,17 +277,24 @@ public class Avatar {
* Changes this avatar's skill depot.
*
* @param skillDepot The new skill depot.
* @param notify Whether to notify the player of the change.
* @param notify Whether to notify the player of the change.
*/
public void setSkillDepotData(AvatarSkillDepotData skillDepot, boolean notify) {
// Set id and depot
this.skillDepotId = skillDepot.getId();
this.skillDepot = skillDepot;
// Add any missing skills
this.skillDepot.getSkillsAndEnergySkill().forEach(skillId -> this.skillLevelMap.putIfAbsent(skillId, 1));
this.skillDepot
.getSkillsAndEnergySkill()
.forEach(skillId -> this.skillLevelMap.putIfAbsent(skillId, 1));
// Add proud skills
this.proudSkillList.clear();
skillDepot.getInherentProudSkillOpens().stream().filter(openData -> openData.getProudSkillGroupId() > 0).filter(openData -> openData.getNeedAvatarPromoteLevel() <= this.getPromoteLevel()).mapToInt(openData -> (openData.getProudSkillGroupId() * 100) + 1).filter(proudSkillId -> GameData.getProudSkillDataMap().containsKey(proudSkillId)).forEach(proudSkillId -> this.proudSkillList.add(proudSkillId));
skillDepot.getInherentProudSkillOpens().stream()
.filter(openData -> openData.getProudSkillGroupId() > 0)
.filter(openData -> openData.getNeedAvatarPromoteLevel() <= this.getPromoteLevel())
.mapToInt(openData -> (openData.getProudSkillGroupId() * 100) + 1)
.filter(proudSkillId -> GameData.getProudSkillDataMap().containsKey(proudSkillId))
.forEach(proudSkillId -> this.proudSkillList.add(proudSkillId));
this.recalcStats();
if (notify) {
@ -362,7 +318,7 @@ public class Avatar {
* in its 'candSkillDepot's.
*
* @param elementTypeToChange The new element to change to.
* @param notify Whether to notify the player of the change.
* @param notify Whether to notify the player of the change.
* @return True if the element was changed, false otherwise.
*/
public boolean changeElement(@Nonnull ElementType elementTypeToChange, boolean notify) {
@ -410,7 +366,8 @@ public class Avatar {
ElementType element = depot.getElementType();
var maxEnergy = depot.getEnergySkillData().getCostElemVal();
this.setFightProperty(element.getMaxEnergyProp(), maxEnergy);
this.setFightProperty(element.getCurEnergyProp(), GAME_OPTIONS.energyUsage ? currentEnergy : maxEnergy);
this.setFightProperty(
element.getCurEnergyProp(), GAME_OPTIONS.energyUsage ? currentEnergy : maxEnergy);
}
}
@ -438,10 +395,14 @@ public class Avatar {
return getFightProperties().getOrDefault(prop.getId(), 0f);
}
public Map<Integer, Integer> getSkillLevelMap() { // Returns a copy of the skill levels for the current skillDepot.
public Map<Integer, Integer>
getSkillLevelMap() { // Returns a copy of the skill levels for the current skillDepot.
var map = new Int2IntOpenHashMap();
if (this.skillDepot == null) return map;
this.skillDepot.getSkillsAndEnergySkill().forEach(skillId -> map.put(skillId, this.skillLevelMap.putIfAbsent(skillId, 1).intValue()));
this.skillDepot
.getSkillsAndEnergySkill()
.forEach(
skillId -> map.put(skillId, this.skillLevelMap.putIfAbsent(skillId, 1).intValue()));
return map;
}
@ -450,18 +411,21 @@ public class Avatar {
public Map<Integer, Integer> getProudSkillBonusMap() {
var map = new Int2IntArrayMap();
if (this.skillDepot == null) return map;
this.skillDepot.getSkillsAndEnergySkill().forEach(skillId -> {
val skillData = GameData.getAvatarSkillDataMap().get(skillId);
if (skillData == null) return;
int proudSkillGroupId = skillData.getProudSkillGroupId();
int bonus = this.proudSkillBonusMap.getOrDefault(proudSkillGroupId, 0);
int maxLevel = GameData.getProudSkillGroupMaxLevel(proudSkillGroupId);
int curLevel = this.skillLevelMap.getOrDefault(skillId, 0);
if (maxLevel > 0) {
bonus = Math.min(bonus, maxLevel - curLevel);
}
map.put(proudSkillGroupId, bonus);
});
this.skillDepot
.getSkillsAndEnergySkill()
.forEach(
skillId -> {
val skillData = GameData.getAvatarSkillDataMap().get(skillId);
if (skillData == null) return;
int proudSkillGroupId = skillData.getProudSkillGroupId();
int bonus = this.proudSkillBonusMap.getOrDefault(proudSkillGroupId, 0);
int maxLevel = GameData.getProudSkillGroupMaxLevel(proudSkillGroupId);
int curLevel = this.skillLevelMap.getOrDefault(skillId, 0);
if (maxLevel > 0) {
bonus = Math.min(bonus, maxLevel - curLevel);
}
map.put(proudSkillGroupId, bonus);
});
return map;
}
@ -495,7 +459,9 @@ public class Avatar {
if (otherAvatar != null) {
// Unequip other avatar's item
if (otherAvatar.unequipItem(item.getItemData().getEquipType())) {
getPlayer().sendPacket(new PacketAvatarEquipChangeNotify(otherAvatar, item.getItemData().getEquipType()));
getPlayer()
.sendPacket(
new PacketAvatarEquipChangeNotify(otherAvatar, item.getItemData().getEquipType()));
}
// Swap with other avatar
if (getEquips().containsKey(itemEquipType.getValue())) {
@ -513,9 +479,14 @@ public class Avatar {
this.getEquips().put(itemEquipType.getValue(), item);
if (itemEquipType == EquipType.EQUIP_WEAPON && getPlayer().getWorld() != null) {
if (!(item.getWeaponEntity() != null && item.getWeaponEntity().getScene() == getPlayer().getScene())) {
item.setWeaponEntity(new EntityWeapon(this.getPlayer().getScene(), item.getItemData().getGadgetId()));
this.getPlayer().getScene().getWeaponEntities().put(item.getWeaponEntity().getId(), item.getWeaponEntity());
if (!(item.getWeaponEntity() != null
&& item.getWeaponEntity().getScene() == getPlayer().getScene())) {
item.setWeaponEntity(
new EntityWeapon(this.getPlayer().getScene(), item.getItemData().getGadgetId()));
this.getPlayer()
.getScene()
.getWeaponEntities()
.put(item.getWeaponEntity().getId(), item.getWeaponEntity());
}
// item.setWeaponEntityId(this.getPlayer().getWorld().getNextEntityId(EntityIdType.WEAPON));
}
@ -553,7 +524,8 @@ public class Avatar {
public void recalcStats(boolean forceSendAbilityChange) {
// Setup
var data = this.getAvatarData();
var promoteData = GameData.getAvatarPromoteData(data.getAvatarPromoteId(), this.getPromoteLevel());
var promoteData =
GameData.getAvatarPromoteData(data.getAvatarPromoteId(), this.getPromoteLevel());
var setMap = new Int2IntOpenHashMap();
// Extra ability embryos
@ -566,18 +538,27 @@ public class Avatar {
this.setNameCardId(data.getNameCardId());
// Get hp percent, set to 100% if none
float hpPercent = this.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP) <= 0 ? 1f : this.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP) / this.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP);
float hpPercent =
this.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP) <= 0
? 1f
: this.getFightProperty(FightProperty.FIGHT_PROP_CUR_HP)
/ this.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP);
// Store current energy value for later
float currentEnergy = (this.getSkillDepot() != null) ? this.getFightProperty(this.getSkillDepot().getElementType().getCurEnergyProp()) : 0f;
float currentEnergy =
(this.getSkillDepot() != null)
? this.getFightProperty(this.getSkillDepot().getElementType().getCurEnergyProp())
: 0f;
// Clear properties
this.getFightProperties().clear();
// Base stats
this.setFightProperty(FightProperty.FIGHT_PROP_BASE_HP, data.getBaseHp(this.getLevel()));
this.setFightProperty(FightProperty.FIGHT_PROP_BASE_ATTACK, data.getBaseAttack(this.getLevel()));
this.setFightProperty(FightProperty.FIGHT_PROP_BASE_DEFENSE, data.getBaseDefense(this.getLevel()));
this.setFightProperty(
FightProperty.FIGHT_PROP_BASE_ATTACK, data.getBaseAttack(this.getLevel()));
this.setFightProperty(
FightProperty.FIGHT_PROP_BASE_DEFENSE, data.getBaseDefense(this.getLevel()));
this.setFightProperty(FightProperty.FIGHT_PROP_CRITICAL, data.getBaseCritical());
this.setFightProperty(FightProperty.FIGHT_PROP_CRITICAL_HURT, data.getBaseCriticalHurt());
this.setFightProperty(FightProperty.FIGHT_PROP_CHARGE_EFFICIENCY, 1f);
@ -599,11 +580,14 @@ public class Avatar {
continue;
}
// Artifact main stat
ReliquaryMainPropData mainPropData = GameData.getReliquaryMainPropDataMap().get(equip.getMainPropId());
ReliquaryMainPropData mainPropData =
GameData.getReliquaryMainPropDataMap().get(equip.getMainPropId());
if (mainPropData != null) {
ReliquaryLevelData levelData = GameData.getRelicLevelData(equip.getItemData().getRankLevel(), equip.getLevel());
ReliquaryLevelData levelData =
GameData.getRelicLevelData(equip.getItemData().getRankLevel(), equip.getLevel());
if (levelData != null) {
this.addFightProperty(mainPropData.getFightProp(), levelData.getPropValue(mainPropData.getFightProp()));
this.addFightProperty(
mainPropData.getFightProp(), levelData.getPropValue(mainPropData.getFightProp()));
}
}
// Artifact sub stats
@ -620,31 +604,32 @@ public class Avatar {
}
// Set stuff
setMap.forEach((setId, amount) -> {
ReliquarySetData setData = GameData.getReliquarySetDataMap().get((int) setId);
if (setData == null) return;
setMap.forEach(
(setId, amount) -> {
ReliquarySetData setData = GameData.getReliquarySetDataMap().get((int) setId);
if (setData == null) return;
// Calculate how many items are from the set
// Add affix data from set bonus
val setNeedNum = setData.getSetNeedNum();
for (int setIndex = 0; setIndex < setNeedNum.length; setIndex++) {
if (amount < setNeedNum[setIndex]) break;
// Calculate how many items are from the set
// Add affix data from set bonus
val setNeedNum = setData.getSetNeedNum();
for (int setIndex = 0; setIndex < setNeedNum.length; setIndex++) {
if (amount < setNeedNum[setIndex]) break;
int affixId = (setData.getEquipAffixId() * 10) + setIndex;
EquipAffixData affix = GameData.getEquipAffixDataMap().get(affixId);
if (affix == null) {
continue;
}
int affixId = (setData.getEquipAffixId() * 10) + setIndex;
EquipAffixData affix = GameData.getEquipAffixDataMap().get(affixId);
if (affix == null) {
continue;
}
// Add properties from this affix to our avatar
for (FightPropData prop : affix.getAddProps()) {
this.addFightProperty(prop.getProp(), prop.getValue());
}
// Add properties from this affix to our avatar
for (FightPropData prop : affix.getAddProps()) {
this.addFightProperty(prop.getProp(), prop.getValue());
}
// Add any skill strings from this affix
this.addToExtraAbilityEmbryos(affix.getOpenConfig(), true);
}
});
// Add any skill strings from this affix
this.addToExtraAbilityEmbryos(affix.getOpenConfig(), true);
}
});
// Weapon
GameItem weapon = this.getWeapon();
@ -653,11 +638,15 @@ public class Avatar {
WeaponCurveData curveData = GameData.getWeaponCurveDataMap().get(weapon.getLevel());
if (curveData != null) {
for (WeaponProperty weaponProperty : weapon.getItemData().getWeaponProperties()) {
this.addFightProperty(weaponProperty.getPropType(), weaponProperty.getInitValue() * curveData.getMultByProp(weaponProperty.getType()));
this.addFightProperty(
weaponProperty.getPropType(),
weaponProperty.getInitValue() * curveData.getMultByProp(weaponProperty.getType()));
}
}
// Weapon promotion stats
WeaponPromoteData wepPromoteData = GameData.getWeaponPromoteData(weapon.getItemData().getWeaponPromoteId(), weapon.getPromoteLevel());
WeaponPromoteData wepPromoteData =
GameData.getWeaponPromoteData(
weapon.getItemData().getWeaponPromoteId(), weapon.getPromoteLevel());
if (wepPromoteData != null) {
for (FightPropData prop : wepPromoteData.getAddProps()) {
if (prop.getValue() == 0f || prop.getProp() == null) {
@ -692,7 +681,8 @@ public class Avatar {
}
// Add proud skills and unlock them if needed
AvatarSkillDepotData skillDepot = GameData.getAvatarSkillDepotDataMap().get(this.getSkillDepotId());
AvatarSkillDepotData skillDepot =
GameData.getAvatarSkillDepotDataMap().get(this.getSkillDepotId());
this.getProudSkillList().clear();
if (skillDepot != null) {
for (InherentProudSkillOpens openData : skillDepot.getInherentProudSkillOpens()) {
@ -725,17 +715,31 @@ public class Avatar {
}
// Constellations
this.getTalentIdList().intStream().mapToObj(GameData.getAvatarTalentDataMap()::get).filter(Objects::nonNull).map(AvatarTalentData::getOpenConfig).filter(Objects::nonNull).forEach(this::addToExtraAbilityEmbryos);
this.getTalentIdList()
.intStream()
.mapToObj(GameData.getAvatarTalentDataMap()::get)
.filter(Objects::nonNull)
.map(AvatarTalentData::getOpenConfig)
.filter(Objects::nonNull)
.forEach(this::addToExtraAbilityEmbryos);
// Add any skill strings from this constellation
// Set % stats
FightProperty.forEachCompoundProperty(c -> this.setFightProperty(c.getResult(), this.getFightProperty(c.getFlat()) + (this.getFightProperty(c.getBase()) * (1f + this.getFightProperty(c.getPercent())))));
FightProperty.forEachCompoundProperty(
c ->
this.setFightProperty(
c.getResult(),
this.getFightProperty(c.getFlat())
+ (this.getFightProperty(c.getBase())
* (1f + this.getFightProperty(c.getPercent())))));
// Reapply all overrides
this.fightProperties.putAll(this.fightPropOverrides);
// Set current hp
this.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, this.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP) * hpPercent);
this.setFightProperty(
FightProperty.FIGHT_PROP_CUR_HP,
this.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP) * hpPercent);
// Packet
if (getPlayer() != null && getPlayer().hasSentLoginPackets()) {
@ -743,7 +747,9 @@ public class Avatar {
getPlayer().sendPacket(new PacketAvatarFightPropNotify(this));
// Update client abilities
EntityAvatar entity = this.getAsEntity();
if (entity != null && (!this.getExtraAbilityEmbryos().equals(prevExtraAbilityEmbryos) || forceSendAbilityChange)) {
if (entity != null
&& (!this.getExtraAbilityEmbryos().equals(prevExtraAbilityEmbryos)
|| forceSendAbilityChange)) {
getPlayer().sendPacket(new PacketAbilityChangeNotify(entity));
}
}
@ -781,12 +787,22 @@ public class Avatar {
// Check if new constellation adds +3 to a skill level
if (this.calcConstellationExtraLevels(entry) && notifyClient) {
// Packet
this.getPlayer().sendPacket(new PacketProudSkillExtraLevelNotify(this, entry.getExtraTalentIndex()));
this.getPlayer()
.sendPacket(new PacketProudSkillExtraLevelNotify(this, entry.getExtraTalentIndex()));
}
// Check if new constellation adds skill charges
if (this.calcConstellationExtraCharges(entry) && notifyClient) {
// Packet
Stream.of(entry.getSkillPointModifiers()).mapToInt(SkillPointModifier::getSkillId).forEach(skillId -> this.getPlayer().sendPacket(new PacketAvatarSkillMaxChargeCountNotify(this, skillId, this.getSkillExtraChargeMap().getOrDefault(skillId, 0))));
Stream.of(entry.getSkillPointModifiers())
.mapToInt(SkillPointModifier::getSkillId)
.forEach(
skillId ->
this.getPlayer()
.sendPacket(
new PacketAvatarSkillMaxChargeCountNotify(
this,
skillId,
this.getSkillExtraChargeMap().getOrDefault(skillId, 0))));
}
}
@ -800,7 +816,16 @@ public class Avatar {
return;
}
this.getTalentIdList().intStream().mapToObj(GameData.getAvatarTalentDataMap()::get).filter(Objects::nonNull).map(AvatarTalentData::getOpenConfig).filter(Objects::nonNull).filter(openConfig -> !openConfig.isEmpty()).map(GameData.getOpenConfigEntries()::get).filter(Objects::nonNull).forEach(e -> this.calcConstellation(e, false));
this.getTalentIdList()
.intStream()
.mapToObj(GameData.getAvatarTalentDataMap()::get)
.filter(Objects::nonNull)
.map(AvatarTalentData::getOpenConfig)
.filter(Objects::nonNull)
.filter(openConfig -> !openConfig.isEmpty())
.map(GameData.getOpenConfigEntries()::get)
.filter(Objects::nonNull)
.forEach(e -> this.calcConstellation(e, false));
}
private boolean calcConstellationExtraCharges(OpenConfigEntry entry) {
@ -820,14 +845,18 @@ public class Avatar {
}
private boolean calcConstellationExtraLevels(OpenConfigEntry entry) {
if(this.skillDepot == null) return false;
int skillId = switch (entry.getExtraTalentIndex()) {
case 9 -> this.skillDepot.getEnergySkill(); // Ult skill
case 2 -> (this.skillDepot.getSkills().size() >= 2) ? this.skillDepot.getSkills().get(1) : 0; // E skill
case 1 ->
(!this.skillDepot.getSkills().isEmpty()) ? this.skillDepot.getSkills().get(0) : 0; // Normal Attack (Liney)
default -> 0;
};
if (this.skillDepot == null) return false;
int skillId =
switch (entry.getExtraTalentIndex()) {
case 9 -> this.skillDepot.getEnergySkill(); // Ult skill
case 2 -> (this.skillDepot.getSkills().size() >= 2)
? this.skillDepot.getSkills().get(1)
: 0; // E skill
case 1 -> (!this.skillDepot.getSkills().isEmpty())
? this.skillDepot.getSkills().get(0)
: 0; // Normal Attack (Liney)
default -> 0;
};
// Sanity check
if (skillId == 0) {
return false;
@ -846,7 +875,8 @@ public class Avatar {
}
private int addProudSkillLevelBonus(int proudSkillGroupId, int bonus) {
return this.proudSkillBonusMap.compute(proudSkillGroupId, (k, v) -> (v == null) ? bonus : v + bonus);
return this.proudSkillBonusMap.compute(
proudSkillGroupId, (k, v) -> (v == null) ? bonus : v + bonus);
}
public boolean upgradeSkill(int skillId) {
@ -877,7 +907,9 @@ public class Avatar {
if (level < 0 || level > 15) return false;
var validLevels = GameData.getAvatarSkillLevels(skillId);
if (validLevels != null && !validLevels.contains(level)) return false;
int oldLevel = this.skillLevelMap.getOrDefault(skillId, 0); // just taking the return value of put would have null concerns
int oldLevel =
this.skillLevelMap.getOrDefault(
skillId, 0); // just taking the return value of put would have null concerns
this.skillLevelMap.put(skillId, level);
this.save();
@ -912,7 +944,9 @@ public class Avatar {
var player = this.getPlayer();
// Pay constellation item if possible
if (!skipPayment && (player != null) && !player.getInventory().payItem(talentData.getMainCostItemId(), 1)) {
if (!skipPayment
&& (player != null)
&& !player.getInventory().payItem(talentData.getMainCostItemId(), 1)) {
return false;
}
@ -943,7 +977,8 @@ public class Avatar {
this.save();
return;
}
this.talentIdList.removeAll(this.getTalentIdList()); // Only remove constellations from active depot
this.talentIdList.removeAll(
this.getTalentIdList()); // Only remove constellations from active depot
for (int i = 0; i < level; i++) this.unlockConstellation(true);
this.recalcStats();
this.save();
@ -952,7 +987,12 @@ public class Avatar {
public boolean sendSkillExtraChargeMap() {
val map = this.getSkillExtraChargeMap();
if (map.isEmpty()) return false;
this.getPlayer().sendPacket(new PacketAvatarSkillInfoNotify(this.guid, new Int2IntArrayMap(map))); // TODO: Remove this allocation when updating interfaces to FastUtils
this.getPlayer()
.sendPacket(
new PacketAvatarSkillInfoNotify(
this.guid,
new Int2IntArrayMap(
map))); // TODO: Remove this allocation when updating interfaces to FastUtils
// later
return true;
}
@ -984,7 +1024,12 @@ public class Avatar {
}
if (this.fetters != null) {
this.fetters.forEach(fetterId -> avatarFetter.addFetterList(FetterData.newBuilder().setFetterId(fetterId).setFetterState(FetterState.FINISH.getValue())));
this.fetters.forEach(
fetterId ->
avatarFetter.addFetterList(
FetterData.newBuilder()
.setFetterId(fetterId)
.setFetterState(FetterState.FINISH.getValue())));
}
int cardId = this.getNameCardId();
@ -993,40 +1038,100 @@ public class Avatar {
avatarFetter.addRewardedFetterLevelList(10);
}
AvatarInfo.Builder avatarInfo = AvatarInfo.newBuilder().setAvatarId(this.getAvatarId()).setGuid(this.getGuid()).setLifeState(1).addAllTalentIdList(this.getTalentIdList()).putAllFightPropMap(this.getFightProperties()).setSkillDepotId(this.getSkillDepotId()).setCoreProudSkillLevel(this.getCoreProudSkillLevel()).putAllSkillLevelMap(this.getSkillLevelMap()).addAllInherentProudSkillList(this.getProudSkillList()).putAllProudSkillExtraLevelMap(this.getProudSkillBonusMap()).setAvatarType(this.getAvatarType()).setBornTime(this.getBornTime()).setFetterInfo(avatarFetter).setWearingFlycloakId(this.getFlyCloak()).setCostumeId(this.getCostume());
AvatarInfo.Builder avatarInfo =
AvatarInfo.newBuilder()
.setAvatarId(this.getAvatarId())
.setGuid(this.getGuid())
.setLifeState(1)
.addAllTalentIdList(this.getTalentIdList())
.putAllFightPropMap(this.getFightProperties())
.setSkillDepotId(this.getSkillDepotId())
.setCoreProudSkillLevel(this.getCoreProudSkillLevel())
.putAllSkillLevelMap(this.getSkillLevelMap())
.addAllInherentProudSkillList(this.getProudSkillList())
.putAllProudSkillExtraLevelMap(this.getProudSkillBonusMap())
.setAvatarType(this.getAvatarType())
.setBornTime(this.getBornTime())
.setFetterInfo(avatarFetter)
.setWearingFlycloakId(this.getFlyCloak())
.setCostumeId(this.getCostume());
this.getSkillExtraChargeMap().forEach((skillId, count) -> avatarInfo.putSkillMap(skillId, AvatarSkillInfo.newBuilder().setMaxChargeCount(count).build()));
this.getSkillExtraChargeMap()
.forEach(
(skillId, count) ->
avatarInfo.putSkillMap(
skillId, AvatarSkillInfo.newBuilder().setMaxChargeCount(count).build()));
this.getEquips().forEach((k, item) -> avatarInfo.addEquipGuidList(item.getGuid()));
avatarInfo.putPropMap(PlayerProperty.PROP_LEVEL.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_LEVEL, this.getLevel()));
avatarInfo.putPropMap(PlayerProperty.PROP_EXP.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_EXP, this.getExp()));
avatarInfo.putPropMap(PlayerProperty.PROP_BREAK_LEVEL.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_BREAK_LEVEL, this.getPromoteLevel()));
avatarInfo.putPropMap(PlayerProperty.PROP_SATIATION_VAL.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_SATIATION_VAL, this.getSatiation()));
avatarInfo.putPropMap(PlayerProperty.PROP_SATIATION_PENALTY_TIME.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_SATIATION_PENALTY_TIME, this.getSatiationPenalty()));
avatarInfo.putPropMap(
PlayerProperty.PROP_LEVEL.getId(),
ProtoHelper.newPropValue(PlayerProperty.PROP_LEVEL, this.getLevel()));
avatarInfo.putPropMap(
PlayerProperty.PROP_EXP.getId(),
ProtoHelper.newPropValue(PlayerProperty.PROP_EXP, this.getExp()));
avatarInfo.putPropMap(
PlayerProperty.PROP_BREAK_LEVEL.getId(),
ProtoHelper.newPropValue(PlayerProperty.PROP_BREAK_LEVEL, this.getPromoteLevel()));
avatarInfo.putPropMap(
PlayerProperty.PROP_SATIATION_VAL.getId(),
ProtoHelper.newPropValue(PlayerProperty.PROP_SATIATION_VAL, this.getSatiation()));
avatarInfo.putPropMap(
PlayerProperty.PROP_SATIATION_PENALTY_TIME.getId(),
ProtoHelper.newPropValue(
PlayerProperty.PROP_SATIATION_PENALTY_TIME, this.getSatiationPenalty()));
return avatarInfo.build();
}
// used only in character showcase
public ShowAvatarInfo toShowAvatarInfoProto() {
AvatarFetterInfo.Builder avatarFetter = AvatarFetterInfo.newBuilder().setExpLevel(this.getFetterLevel());
AvatarFetterInfo.Builder avatarFetter =
AvatarFetterInfo.newBuilder().setExpLevel(this.getFetterLevel());
ShowAvatarInfo.Builder showAvatarInfo = ShowAvatarInfoOuterClass.ShowAvatarInfo.newBuilder().setAvatarId(avatarId).addAllTalentIdList(this.getTalentIdList()).putAllFightPropMap(this.getFightProperties()).setSkillDepotId(this.getSkillDepotId()).setCoreProudSkillLevel(this.getCoreProudSkillLevel()).addAllInherentProudSkillList(this.getProudSkillList()).putAllSkillLevelMap(this.getSkillLevelMap()).putAllProudSkillExtraLevelMap(this.getProudSkillBonusMap()).setFetterInfo(avatarFetter).setCostumeId(this.getCostume());
ShowAvatarInfo.Builder showAvatarInfo =
ShowAvatarInfoOuterClass.ShowAvatarInfo.newBuilder()
.setAvatarId(avatarId)
.addAllTalentIdList(this.getTalentIdList())
.putAllFightPropMap(this.getFightProperties())
.setSkillDepotId(this.getSkillDepotId())
.setCoreProudSkillLevel(this.getCoreProudSkillLevel())
.addAllInherentProudSkillList(this.getProudSkillList())
.putAllSkillLevelMap(this.getSkillLevelMap())
.putAllProudSkillExtraLevelMap(this.getProudSkillBonusMap())
.setFetterInfo(avatarFetter)
.setCostumeId(this.getCostume());
showAvatarInfo.putPropMap(PlayerProperty.PROP_LEVEL.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_LEVEL, this.getLevel()));
showAvatarInfo.putPropMap(PlayerProperty.PROP_EXP.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_EXP, this.getExp()));
showAvatarInfo.putPropMap(PlayerProperty.PROP_BREAK_LEVEL.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_BREAK_LEVEL, this.getPromoteLevel()));
showAvatarInfo.putPropMap(PlayerProperty.PROP_SATIATION_VAL.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_SATIATION_VAL, this.getSatiation()));
showAvatarInfo.putPropMap(PlayerProperty.PROP_SATIATION_PENALTY_TIME.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_SATIATION_PENALTY_TIME, this.getSatiationPenalty()));
showAvatarInfo.putPropMap(
PlayerProperty.PROP_LEVEL.getId(),
ProtoHelper.newPropValue(PlayerProperty.PROP_LEVEL, this.getLevel()));
showAvatarInfo.putPropMap(
PlayerProperty.PROP_EXP.getId(),
ProtoHelper.newPropValue(PlayerProperty.PROP_EXP, this.getExp()));
showAvatarInfo.putPropMap(
PlayerProperty.PROP_BREAK_LEVEL.getId(),
ProtoHelper.newPropValue(PlayerProperty.PROP_BREAK_LEVEL, this.getPromoteLevel()));
showAvatarInfo.putPropMap(
PlayerProperty.PROP_SATIATION_VAL.getId(),
ProtoHelper.newPropValue(PlayerProperty.PROP_SATIATION_VAL, this.getSatiation()));
showAvatarInfo.putPropMap(
PlayerProperty.PROP_SATIATION_PENALTY_TIME.getId(),
ProtoHelper.newPropValue(
PlayerProperty.PROP_SATIATION_PENALTY_TIME, this.getSatiationPenalty()));
int maxStamina = this.getPlayer().getProperty(PlayerProperty.PROP_MAX_STAMINA);
showAvatarInfo.putPropMap(PlayerProperty.PROP_MAX_STAMINA.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_MAX_STAMINA, maxStamina));
showAvatarInfo.putPropMap(
PlayerProperty.PROP_MAX_STAMINA.getId(),
ProtoHelper.newPropValue(PlayerProperty.PROP_MAX_STAMINA, maxStamina));
for (GameItem item : this.getEquips().values()) {
if (item.getItemType() == ItemType.ITEM_RELIQUARY) {
showAvatarInfo.addEquipList(ShowEquip.newBuilder().setItemId(item.getItemId()).setReliquary(item.toReliquaryProto()));
showAvatarInfo.addEquipList(
ShowEquip.newBuilder()
.setItemId(item.getItemId())
.setReliquary(item.toReliquaryProto()));
} else if (item.getItemType() == ItemType.ITEM_WEAPON) {
showAvatarInfo.addEquipList(ShowEquip.newBuilder().setItemId(item.getItemId()).setWeapon(item.toWeaponProto()));
showAvatarInfo.addEquipList(
ShowEquip.newBuilder().setItemId(item.getItemId()).setWeapon(item.toWeaponProto()));
}
}
@ -1036,12 +1141,13 @@ public class Avatar {
/**
* Converts this avatar into a trial avatar.
*
* @param level The avatar's level.
* @param avatarId The ID of the avatar.
* @param level The avatar's level.
* @param avatarId The ID of the avatar.
* @param grantReason The reason for granting the avatar.
* @param questId The ID of the quest that granted the avatar.
* @param questId The ID of the quest that granted the avatar.
*/
public void setTrialAvatarInfo(int level, int avatarId, TrialAvatarGrantRecord.GrantReason grantReason, int questId) {
public void setTrialAvatarInfo(
int level, int avatarId, TrialAvatarGrantRecord.GrantReason grantReason, int questId) {
this.setLevel(level);
this.setPromoteLevel(getMinPromoteLevel(level));
this.setTrialAvatarId(avatarId);
@ -1058,7 +1164,10 @@ public class Avatar {
* @return The avatar's template.
*/
private int getTrialTemplate() {
return this.getLevel() <= 9 ? 1 : (int) (Math.floor(this.getLevel() / 10f) * 10); // round trial level to fit template levels
return this.getLevel() <= 9
? 1
: (int)
(Math.floor(this.getLevel() / 10f) * 10); // round trial level to fit template levels
}
/**
@ -1080,11 +1189,11 @@ public class Avatar {
return trialData.getCoreProudSkillLevel(); // enhanced version of weapon
}
/**
* Applies the correct skill level for the trial avatar.
*/
/** Applies the correct skill level for the trial avatar. */
public void applyTrialSkillLevels() {
this.getSkillLevelMap().keySet().forEach(skill -> this.setSkillLevel(skill, this.getTrialSkillLevel()));
this.getSkillLevelMap()
.keySet()
.forEach(skill -> this.setSkillLevel(skill, this.getTrialSkillLevel()));
}
/**
@ -1096,7 +1205,9 @@ public class Avatar {
if (GameData.getTrialAvatarDataMap().get(this.getTrialAvatarId()) == null)
return this.getAvatarData().getInitialWeapon();
return GameData.getItemDataMap().get(this.getAvatarData().getInitialWeapon() + 100) == null ? getAvatarData().getInitialWeapon() : getAvatarData().getInitialWeapon() + 100; // enhanced version of weapon
return GameData.getItemDataMap().get(this.getAvatarData().getInitialWeapon() + 100) == null
? getAvatarData().getInitialWeapon()
: getAvatarData().getInitialWeapon() + 100; // enhanced version of weapon
}
// Use custom data.
@ -1104,7 +1215,9 @@ public class Avatar {
if (trialData == null) return 0;
var trialCustomParams = trialData.getTrialAvatarParamList();
return trialCustomParams.size() < 2 ? getAvatarData().getInitialWeapon() : Integer.parseInt(trialCustomParams.get(1).split(";")[0]);
return trialCustomParams.size() < 2
? getAvatarData().getInitialWeapon()
: Integer.parseInt(trialCustomParams.get(1).split(";")[0]);
}
/**
@ -1115,7 +1228,8 @@ public class Avatar {
if (GameData.getTrialAvatarCustomData().isEmpty()) {
int trialAvatarTemplateLevel = getTrialTemplate();
TrialAvatarTemplateData templateData = GameData.getTrialAvatarTemplateDataMap().get(trialAvatarTemplateLevel);
TrialAvatarTemplateData templateData =
GameData.getTrialAvatarTemplateDataMap().get(trialAvatarTemplateLevel);
return templateData == null ? List.of() : templateData.getTrialReliquaryList();
}
@ -1123,13 +1237,14 @@ public class Avatar {
var trialData = GameData.getTrialAvatarCustomData().get(this.getTrialAvatarId());
if (trialData == null) return List.of();
var trialCustomParams = GameData.getTrialAvatarCustomData().get(getTrialAvatarId()).getTrialAvatarParamList();
return trialCustomParams.size() < 3 ? List.of() : Stream.of(trialCustomParams.get(2).split(";")).map(Integer::parseInt).toList();
var trialCustomParams =
GameData.getTrialAvatarCustomData().get(getTrialAvatarId()).getTrialAvatarParamList();
return trialCustomParams.size() < 3
? List.of()
: Stream.of(trialCustomParams.get(2).split(";")).map(Integer::parseInt).toList();
}
/**
* Applies the correct items for the trial avatar.
*/
/** Applies the correct items for the trial avatar. */
public void applyTrialItems() {
// Use an enhanced version of the weapon if available.
var weapon = new GameItem(this.getTrialWeaponId());
@ -1139,44 +1254,55 @@ public class Avatar {
this.getEquips().put(weapon.getEquipSlot(), weapon);
// Add artifacts for the trial avatar.
this.getTrialReliquary().forEach(id -> {
var reliquaryData = GameData.getTrialReliquaryDataMap().get((int) id);
if (reliquaryData == null) return;
this.getTrialReliquary()
.forEach(
id -> {
var reliquaryData = GameData.getTrialReliquaryDataMap().get((int) id);
if (reliquaryData == null) return;
var relic = new GameItem(reliquaryData.getReliquaryId());
relic.setLevel(reliquaryData.getLevel());
relic.setMainPropId(reliquaryData.getMainPropId());
relic.getAppendPropIdList().addAll(reliquaryData.getAppendPropList());
this.getEquips().put(relic.getEquipSlot(), relic);
});
var relic = new GameItem(reliquaryData.getReliquaryId());
relic.setLevel(reliquaryData.getLevel());
relic.setMainPropId(reliquaryData.getMainPropId());
relic.getAppendPropIdList().addAll(reliquaryData.getAppendPropList());
this.getEquips().put(relic.getEquipSlot(), relic);
});
// Add costume if avatar has a costume.
if (GAME_OPTIONS.trialCostumes) {
GameData.getAvatarCostumeDataItemIdMap().values().forEach(costumeData -> {
if (costumeData.getCharacterId() != this.getAvatarId()) return;
this.setCostume(costumeData.getId());
});
GameData.getAvatarCostumeDataItemIdMap()
.values()
.forEach(
costumeData -> {
if (costumeData.getCharacterId() != this.getAvatarId()) return;
this.setCostume(costumeData.getId());
});
}
}
/**
* Equips the items applied from {@link Avatar#applyTrialItems()}.
*/
/** Equips the items applied from {@link Avatar#applyTrialItems()}. */
public void equipTrialItems() {
var player = this.getPlayer();
this.getEquips().values().forEach(item -> {
item.setEquipCharacter(this.getAvatarId());
item.setOwner(player);
if (item.getItemData().getEquipType() == EquipType.EQUIP_WEAPON) {
if (!(item.getWeaponEntity() != null && item.getWeaponEntity().getScene() == player.getScene())) {
item.setWeaponEntity(new EntityWeapon(player.getScene(), item.getItemData().getGadgetId()));
player.getScene().getWeaponEntities().put(item.getWeaponEntity().getId(), item.getWeaponEntity());
}
this.getEquips()
.values()
.forEach(
item -> {
item.setEquipCharacter(this.getAvatarId());
item.setOwner(player);
if (item.getItemData().getEquipType() == EquipType.EQUIP_WEAPON) {
if (!(item.getWeaponEntity() != null
&& item.getWeaponEntity().getScene() == player.getScene())) {
item.setWeaponEntity(
new EntityWeapon(player.getScene(), item.getItemData().getGadgetId()));
player
.getScene()
.getWeaponEntities()
.put(item.getWeaponEntity().getId(), item.getWeaponEntity());
}
player.sendPacket(new PacketAvatarEquipChangeNotify(this, item));
}
});
player.sendPacket(new PacketAvatarEquipChangeNotify(this, item));
}
});
}
/**
@ -1185,20 +1311,26 @@ public class Avatar {
* @return The trial info protocol buffer.
*/
public TrialAvatarInfo toTrialInfo() {
var trialAvatar = TrialAvatarInfo.newBuilder().setTrialAvatarId(this.getTrialAvatarId()).setGrantRecord(TrialAvatarGrantRecord.newBuilder().setGrantReason(this.getGrantReason()).setFromParentQuestId(this.getFromParentQuestId()));
var trialAvatar =
TrialAvatarInfo.newBuilder()
.setTrialAvatarId(this.getTrialAvatarId())
.setGrantRecord(
TrialAvatarGrantRecord.newBuilder()
.setGrantReason(this.getGrantReason())
.setFromParentQuestId(this.getFromParentQuestId()));
// Check if the avatar is a trial avatar.
if (this.getTrialAvatarId() > 0) {
// Add the artifacts and weapons for the avatar.
trialAvatar.addAllTrialEquipList(this.getEquips().values().stream().map(GameItem::toProto).toList());
trialAvatar.addAllTrialEquipList(
this.getEquips().values().stream().map(GameItem::toProto).toList());
}
return trialAvatar.build();
}
@PostLoad
private void onLoad() {
}
private void onLoad() {}
@PrePersist
private void prePersist() {
@ -1208,7 +1340,8 @@ public class Avatar {
@AllArgsConstructor
@Getter
enum Type {
NORMAL(1), TRIAL(2);
NORMAL(1),
TRIAL(2);
final int number;
}

View File

@ -15,14 +15,12 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import lombok.Getter;
import java.util.Iterator;
import java.util.List;
import lombok.Getter;
public class AvatarStorage extends BasePlayerManager implements Iterable<Avatar> {
@Getter
private final Int2ObjectMap<Avatar> avatars;
@Getter private final Int2ObjectMap<Avatar> avatars;
private final Long2ObjectMap<Avatar> avatarsGuid;
public AvatarStorage(Player player) {

View File

@ -9,13 +9,9 @@ import lombok.Setter;
@Entity
public class BattlePassMission {
@Getter
private int id;
@Setter
@Getter
private int progress;
@Setter
private BattlePassMissionStatus status;
@Getter private int id;
@Setter @Getter private int progress;
@Setter private BattlePassMissionStatus status;
@Transient private BattlePassMissionData data;

View File

@ -8,12 +8,9 @@ import lombok.Getter;
@Entity
public class BattlePassReward {
@Getter
private int level;
@Getter
private int rewardId;
@Getter
private boolean paid;
@Getter private int level;
@Getter private int rewardId;
@Getter private boolean paid;
@Transient private BattlePassMissionData data;

View File

@ -10,10 +10,9 @@ import emu.grasscutter.server.event.player.PlayerChatEvent;
import emu.grasscutter.server.game.GameServer;
import emu.grasscutter.server.packet.send.*;
import emu.grasscutter.utils.Utils;
import lombok.Getter;
import java.util.*;
import java.util.regex.Pattern;
import lombok.Getter;
public class ChatSystem implements ChatSystemHandler {
static final String PREFIXES = "[/!]";
@ -24,8 +23,7 @@ public class ChatSystem implements ChatSystemHandler {
// user id -> chat partner id -> [messages]
private final Map<Integer, Map<Integer, List<ChatInfo>>> history = new HashMap<>();
@Getter
private final GameServer server;
@Getter private final GameServer server;
public ChatSystem(GameServer server) {
this.server = server;

View File

@ -27,8 +27,7 @@ public class CombineManger extends BaseGameSystem {
// Read the data we need for strongbox.
try {
DataLoader.loadList("ReliquaryDecompose.json", ReliquaryDecomposeEntry.class)
.forEach(
entry -> reliquaryDecomposeData.put(entry.getConfigId(), entry.getItems()));
.forEach(entry -> reliquaryDecomposeData.put(entry.getConfigId(), entry.getItems()));
Grasscutter.getLogger()
.debug("Loaded {} reliquary decompose entries.", reliquaryDecomposeData.size());
} catch (Exception ex) {

View File

@ -1,11 +1,10 @@
package emu.grasscutter.game.combine;
import emu.grasscutter.data.common.ItemParamData;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Setter
@Getter
public class CombineResult {
@ -13,5 +12,4 @@ public class CombineResult {
private List<ItemParamData> result;
private List<ItemParamData> extra;
private List<ItemParamData> back;
}

View File

@ -1,14 +1,12 @@
package emu.grasscutter.game.combine;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Setter
@Getter
public class ReliquaryDecomposeEntry {
private int configId;
private List<Integer> items;
}

View File

@ -8,13 +8,11 @@ import lombok.Setter;
public class DropData {
private int minWeight;
private int maxWeight;
@Setter
private int itemId;
@Setter private int itemId;
private int minCount;
private int maxCount;
private boolean share = false;
@Setter
private boolean give = false;
@Setter private boolean give = false;
public void setIsShare(boolean share) {
this.share = share;

View File

@ -1,13 +1,11 @@
package emu.grasscutter.game.drop;
import lombok.Getter;
import java.util.List;
import lombok.Getter;
@Getter
@SuppressWarnings("deprecation")
public class DropInfo {
private int monsterId;
private List<DropData> dropDataList;
}

View File

@ -11,9 +11,8 @@ import emu.grasscutter.game.world.*;
import emu.grasscutter.server.game.*;
import emu.grasscutter.utils.Utils;
import it.unimi.dsi.fastutil.ints.*;
import lombok.Getter;
import java.util.List;
import lombok.Getter;
@Getter
@SuppressWarnings("deprecation")

View File

@ -1,14 +1,12 @@
package emu.grasscutter.game.dungeons;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Setter
@Getter
public class DungeonDrop {
private int dungeonId;
private List<DungeonDropEntry> drops;
}

View File

@ -1,10 +1,9 @@
package emu.grasscutter.game.dungeons;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
@Setter
@Getter
public class DungeonDropEntry {
@ -13,5 +12,4 @@ public class DungeonDropEntry {
private List<Integer> probabilities;
private List<Integer> itemProbabilities;
private boolean mpDouble;
}

View File

@ -29,7 +29,8 @@ public class KillMonsterTimeChallengeFactoryHandler implements ChallengeFactoryH
Scene scene,
SceneGroup group) {
val realGroup = scene.getScriptManager().getGroupById(groupId);
val challengeTriggers = new ArrayList<>(List.of(new KillMonsterCountTrigger(), new InTimeTrigger()));
val challengeTriggers =
new ArrayList<>(List.of(new KillMonsterCountTrigger(), new InTimeTrigger()));
val challengeData = GameData.getDungeonChallengeConfigDataMap().get(challengeId);
val challengeType = challengeData.getChallengeType();

View File

@ -82,7 +82,7 @@ public class EntityRegion extends GameEntity {
@Override
public SceneEntityInfoOuterClass.SceneEntityInfo toProto() {
/* The Region Entity would not be sent to client. */
/* The Region Entity would not be sent to client. */
return null;
}

View File

@ -19,8 +19,7 @@ import emu.grasscutter.utils.Utils;
import lombok.Getter;
public final class GadgetGatherObject extends GadgetContent {
@Getter
private int itemId;
@Getter private int itemId;
private boolean isForbidGuest;
public GadgetGatherObject(EntityGadget gadget) {

View File

@ -15,19 +15,12 @@ import org.bson.types.ObjectId;
public class Friendship {
@Id private ObjectId id;
@Setter
@Getter
@Transient private Player owner;
@Setter @Getter @Transient private Player owner;
@Getter
@Indexed private int ownerId;
@Getter
@Indexed private int friendId;
@Setter
private boolean isFriend;
@Setter
@Getter
private int askerId;
@Getter @Indexed private int ownerId;
@Getter @Indexed private int friendId;
@Setter private boolean isFriend;
@Setter @Getter private int askerId;
private PlayerProfile profile;

View File

@ -96,7 +96,10 @@ public class GachaBanner {
private void warnDeprecated(String name, String replacement) {
Grasscutter.getLogger()
.error("Deprecated field found in Banners config: {} was replaced back in early May 2022, use {} instead. You MUST remove this field from your config.", name, replacement);
.error(
"Deprecated field found in Banners config: {} was replaced back in early May 2022, use {} instead. You MUST remove this field from your config.",
name,
replacement);
this.deprecated = true;
}

View File

@ -2,7 +2,6 @@ package emu.grasscutter.game.gacha;
import dev.morphia.annotations.*;
import java.util.Date;
import lombok.Getter;
import lombok.Setter;
import org.bson.types.ObjectId;

View File

@ -26,15 +26,13 @@ import it.unimi.dsi.fastutil.ints.*;
import java.nio.file.*;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
import lombok.Getter;
import org.greenrobot.eventbus.Subscribe;
public class GachaSystem extends BaseGameSystem {
private static final int starglitterId = 221;
private static final int stardustId = 222;
@Getter
private final Int2ObjectMap<GachaBanner> gachaBanners;
@Getter private final Int2ObjectMap<GachaBanner> gachaBanners;
private WatchService watchService;
public GachaSystem(GameServer server) {

View File

@ -281,10 +281,11 @@ public class GameHome {
return this.finishedTalkIdMap.entrySet().stream()
.map(
e -> HomeAvatarTalkFinishInfo.newBuilder()
.setAvatarId(e.getKey())
.addAllFinishTalkIdList(e.getValue())
.build())
e ->
HomeAvatarTalkFinishInfo.newBuilder()
.setAvatarId(e.getKey())
.addAllFinishTalkIdList(e.getValue())
.build())
.toList();
}
@ -393,9 +394,7 @@ public class GameHome {
.get(player.getCurrentRealmId() + 2000)
.getBlockItems()
.forEach(
(i, e) -> e.getDeployNPCList()
.forEach(
id -> invitedAvatars.add(id.getAvatarId())));
(i, e) -> e.getDeployNPCList().forEach(id -> invitedAvatars.add(id.getAvatarId())));
// Check as realm 5 inside is not in defaults and will be null
if (Objects.nonNull(mainHouseMap.get(player.getCurrentRealmId() + 2000))) {
@ -404,9 +403,7 @@ public class GameHome {
.get(player.getCurrentRealmId() + 2000)
.getBlockItems()
.forEach(
(i, e) -> e.getDeployNPCList()
.forEach(
id -> invitedAvatars.add(id.getAvatarId())));
(i, e) -> e.getDeployNPCList().forEach(id -> invitedAvatars.add(id.getAvatarId())));
}
// Add exp to all avatars

View File

@ -93,24 +93,25 @@ public class HomeModuleManager {
.map(HomeBlockItem::getDeployNPCList)
.flatMap(Collection::stream)
.forEach(
avatar -> suites.forEach(
suite -> {
var data =
SuiteEventType.HOME_AVATAR_REWARD_EVENT.getEventDataFrom(
avatar.getAvatarId(), suite.getSuiteId());
if (data == null || this.home.isRewardEventFinished(data.getId())) {
return;
}
avatar ->
suites.forEach(
suite -> {
var data =
SuiteEventType.HOME_AVATAR_REWARD_EVENT.getEventDataFrom(
avatar.getAvatarId(), suite.getSuiteId());
if (data == null || this.home.isRewardEventFinished(data.getId())) {
return;
}
this.rewardEvents.add(
new HomeAvatarRewardEvent(
homeOwner,
data.getId(),
data.getRewardID(),
data.getAvatarID(),
data.getSuiteId(),
suite.getGuid()));
}));
this.rewardEvents.add(
new HomeAvatarRewardEvent(
homeOwner,
data.getId(),
data.getRewardID(),
data.getAvatarID(),
data.getSuiteId(),
suite.getGuid()));
}));
if (this.summonEvents != null) {
var suiteIdList = this.rewardEvents.stream().map(HomeAvatarRewardEvent::getSuiteId).toList();

View File

@ -103,11 +103,12 @@ public class HomeSceneItem {
homeAnimalItem ->
GameData.getHomeWorldAnimalDataMap().containsKey(homeAnimalItem.getFurnitureId()))
.map(
homeAnimalItem -> new EntityHomeAnimal(
scene,
GameData.getHomeWorldAnimalDataMap().get(homeAnimalItem.getFurnitureId()),
homeAnimalItem.getSpawnPos(),
homeAnimalItem.getSpawnRot()))
homeAnimalItem ->
new EntityHomeAnimal(
scene,
GameData.getHomeWorldAnimalDataMap().get(homeAnimalItem.getFurnitureId()),
homeAnimalItem.getSpawnPos(),
homeAnimalItem.getSpawnRot()))
.toList();
}

View File

@ -28,8 +28,7 @@ import org.bson.types.ObjectId;
@Entity(value = "items", useDiscriminator = false)
public class GameItem {
@Id private ObjectId id;
@Getter
@Indexed private int ownerId;
@Getter @Indexed private int ownerId;
@Getter @Setter private int itemId;
@Getter @Setter private int count;

View File

@ -21,14 +21,12 @@ import it.unimi.dsi.fastutil.ints.*;
import it.unimi.dsi.fastutil.longs.*;
import java.util.*;
import javax.annotation.Nullable;
import lombok.Getter;
import lombok.val;
public class Inventory extends BasePlayerManager implements Iterable<GameItem> {
private final Long2ObjectMap<GameItem> store;
@Getter
private final Int2ObjectMap<InventoryTab> inventoryTypes;
@Getter private final Int2ObjectMap<InventoryTab> inventoryTypes;
public Inventory(Player player) {
super(player);
@ -321,7 +319,9 @@ public class Inventory extends BasePlayerManager implements Iterable<GameItem> {
case MATERIAL_COSTUME:
case MATERIAL_NAMECARD:
Grasscutter.getLogger()
.warn("Attempted to add a {} to inventory, but item definition lacks isUseOnGain. This indicates a Resources error.", item.getItemData().getMaterialType().name());
.warn(
"Attempted to add a {} to inventory, but item definition lacks isUseOnGain. This indicates a Resources error.",
item.getItemData().getMaterialType().name());
return null;
default:
if (tab == null) {
@ -429,22 +429,24 @@ public class Inventory extends BasePlayerManager implements Iterable<GameItem> {
private int getVirtualItemCount(int itemId) {
return switch (itemId) {
case 201 -> // Primogem
this.player.getPrimogems();
this.player.getPrimogems();
case 202 -> // Mora
this.player.getMora();
this.player.getMora();
case 203 -> // Genesis Crystals
this.player.getCrystals();
this.player.getCrystals();
case 106 -> // Resin
this.player.getProperty(PlayerProperty.PROP_PLAYER_RESIN);
this.player.getProperty(PlayerProperty.PROP_PLAYER_RESIN);
case 107 -> // Legendary Key
this.player.getProperty(PlayerProperty.PROP_PLAYER_LEGENDARY_KEY);
this.player.getProperty(PlayerProperty.PROP_PLAYER_LEGENDARY_KEY);
case 204 -> // Home Coin
this.player.getHomeCoin();
this.player.getHomeCoin();
default -> {
GameItem item =
getInventoryTab(ItemType.ITEM_MATERIAL)
.getItemById(
itemId); // What if we ever want to operate on weapons/relics/furniture? :Syield (item == null) ? 0 : item.getCount(); // What if we ever want to operate on weapons/relics/furniture? :S
getInventoryTab(ItemType.ITEM_MATERIAL)
.getItemById(
itemId); // What if we ever want to operate on weapons/relics/furniture? :Syield
// (item == null) ? 0 : item.getCount(); // What if we ever want to
// operate on weapons/relics/furniture? :S
}
};
}

View File

@ -13,5 +13,4 @@ public class ItemDef {
this.itemId = itemId;
this.count = count;
}
}

View File

@ -11,18 +11,14 @@ import emu.grasscutter.net.proto.MailCollectStateOuterClass.MailCollectState;
import emu.grasscutter.net.proto.MailTextContentOuterClass.MailTextContent;
import java.time.Instant;
import java.util.*;
import lombok.Getter;
import lombok.Setter;
import org.bson.types.ObjectId;
@Entity(value = "mail", useDiscriminator = false)
public final class Mail {
@Getter
@Id private ObjectId id;
@Setter
@Getter
@Indexed private int ownerUid;
@Getter @Id private ObjectId id;
@Setter @Getter @Indexed private int ownerUid;
public final MailContent mailContent;
public final List<MailItem> itemList;
public final long sendTime;
@ -36,7 +32,7 @@ public final class Mail {
public Mail() {
this(
new MailContent(),
new ArrayList<>(),
new ArrayList<>(),
(int) Instant.now().getEpochSecond()
+ 604800); // TODO: add expire time to send mail command
}

View File

@ -5,9 +5,8 @@ import emu.grasscutter.database.DatabaseHelper;
import emu.grasscutter.game.player.*;
import emu.grasscutter.server.event.player.PlayerReceiveMailEvent;
import emu.grasscutter.server.packet.send.*;
import lombok.Getter;
import java.util.*;
import lombok.Getter;
@Getter
public class MailHandler extends BasePlayerManager {
@ -34,7 +33,10 @@ public class MailHandler extends BasePlayerManager {
this.mail.add(message);
Grasscutter.getLogger()
.debug("Mail sent to user [{}:{}]!", this.getPlayer().getUid(), this.getPlayer().getNickname());
.debug(
"Mail sent to user [{}:{}]!",
this.getPlayer().getUid(),
this.getPlayer().getNickname());
if (this.getPlayer().isOnline()) {
this.getPlayer().sendPacket(new PacketMailChangeNotify(this.getPlayer(), message));
@ -57,7 +59,7 @@ public class MailHandler extends BasePlayerManager {
}
public void deleteMail(List<Integer> mailList) {
List<Integer> sortedMailList = new ArrayList<>(mailList);
List<Integer> sortedMailList = new ArrayList<>(mailList);
sortedMailList.sort(Collections.reverseOrder());
List<Integer> deleted = new ArrayList<>();

View File

@ -180,7 +180,10 @@ public class SotSManager extends BasePlayerManager {
public void run() {
refillSpringVolume();
logger.trace("isAutoRecoveryEnabled: {}\tautoRecoverPercentage: {}", getIsAutoRecoveryEnabled(), getAutoRecoveryPercentage());
logger.trace(
"isAutoRecoveryEnabled: {}\tautoRecoverPercentage: {}",
getIsAutoRecoveryEnabled(),
getAutoRecoveryPercentage());
if (getIsAutoRecoveryEnabled()) {
List<EntityAvatar> activeTeam = player.getTeamManager().getActiveTeam();

View File

@ -8,17 +8,14 @@ import emu.grasscutter.game.props.FightProperty;
import emu.grasscutter.game.world.*;
import emu.grasscutter.scripts.data.*;
import emu.grasscutter.utils.Utils;
import lombok.Getter;
import java.util.*;
import lombok.Getter;
public final class BlossomActivity {
private final SceneGroup tempSceneGroup;
@Getter
private final WorldChallenge challenge;
@Getter
private final EntityGadget gadget;
@Getter private final WorldChallenge challenge;
@Getter private final EntityGadget gadget;
private EntityGadget chest;
private int step;
private final int goal;

View File

@ -203,7 +203,7 @@ public class BlossomManager {
RewardPreviewData blossomRewards = getRewardList(type, worldLevel);
if (blossomRewards == null) {
Grasscutter.getLogger()
.error("Blossom could not support world level : {}", worldLevel);
.error("Blossom could not support world level : {}", worldLevel);
return null;
}
var rewards = blossomRewards.getPreviewItems();

View File

@ -18,7 +18,6 @@ import emu.grasscutter.server.packet.send.PacketCompoundDataNotify;
import emu.grasscutter.server.packet.send.PacketGetCompoundDataRsp;
import emu.grasscutter.server.packet.send.PacketPlayerCompoundMaterialRsp;
import emu.grasscutter.utils.Utils;
import java.util.*;
public class CookingCompoundManager extends BasePlayerManager {
@ -34,24 +33,33 @@ public class CookingCompoundManager extends BasePlayerManager {
public static void initialize() {
defaultUnlockedCompounds = new HashSet<>();
compoundGroups = new HashMap<>();
GameData.getCompoundDataMap().forEach((id, compound) -> {
if (compound.isDefaultUnlocked()) {
defaultUnlockedCompounds.add(id);
}
compoundGroups.computeIfAbsent(compound.getGroupId(), gid -> new HashSet<>()).add(id);
});
GameData.getCompoundDataMap()
.forEach(
(id, compound) -> {
if (compound.isDefaultUnlocked()) {
defaultUnlockedCompounds.add(id);
}
compoundGroups.computeIfAbsent(compound.getGroupId(), gid -> new HashSet<>()).add(id);
});
// TODO:Because we haven't implemented fishing feature,unlock all compounds related to
// fish.Besides,it should be bound to player rather than manager.
unlocked = new HashSet<>(defaultUnlockedCompounds);
if (compoundGroups.containsKey(3)) // Avoid NPE from Resources error
unlocked.addAll(compoundGroups.get(3));
unlocked.addAll(compoundGroups.get(3));
}
private synchronized List<CompoundQueueData> getCompoundQueueData() {
List<CompoundQueueData> compoundQueueData = new ArrayList<>(player.getActiveCookCompounds().size());
List<CompoundQueueData> compoundQueueData =
new ArrayList<>(player.getActiveCookCompounds().size());
int currentTime = Utils.getCurrentSeconds();
for (var item : player.getActiveCookCompounds().values()) {
var data = CompoundQueueData.newBuilder().setCompoundId(item.getCompoundId()).setOutputCount(item.getOutputCount(currentTime)).setOutputTime(item.getOutputTime(currentTime)).setWaitCount(item.getWaitCount(currentTime)).build();
var data =
CompoundQueueData.newBuilder()
.setCompoundId(item.getCompoundId())
.setOutputCount(item.getOutputCount(currentTime))
.setOutputTime(item.getOutputTime(currentTime))
.setWaitCount(item.getWaitCount(currentTime))
.build();
compoundQueueData.add(data);
}
return compoundQueueData;
@ -73,14 +81,16 @@ public class CookingCompoundManager extends BasePlayerManager {
return;
}
// check whether the queue is full
if (activeCompounds.containsKey(id) && activeCompounds.get(id).getTotalCount() + count > compound.getQueueSize()) {
if (activeCompounds.containsKey(id)
&& activeCompounds.get(id).getTotalCount() + count > compound.getQueueSize()) {
player.sendPacket(new PacketPlayerCompoundMaterialRsp(Retcode.RET_COMPOUND_QUEUE_FULL_VALUE));
return;
}
// try to consume raw materials
if (!player.getInventory().payItems(compound.getInputVec(), count)) {
// TODO:I'm not sure whether retcode is correct.
player.sendPacket(new PacketPlayerCompoundMaterialRsp(Retcode.RET_ITEM_COUNT_NOT_ENOUGH_VALUE));
player.sendPacket(
new PacketPlayerCompoundMaterialRsp(Retcode.RET_ITEM_COUNT_NOT_ENOUGH_VALUE));
return;
}
ActiveCookCompoundData c;
@ -92,7 +102,13 @@ public class CookingCompoundManager extends BasePlayerManager {
c = new ActiveCookCompoundData(id, compound.getCostTime(), count, currentTime);
activeCompounds.put(id, c);
}
var data = CompoundQueueData.newBuilder().setCompoundId(id).setOutputCount(c.getOutputCount(currentTime)).setOutputTime(c.getOutputTime(currentTime)).setWaitCount(c.getWaitCount(currentTime)).build();
var data =
CompoundQueueData.newBuilder()
.setCompoundId(id)
.setOutputCount(c.getOutputCount(currentTime))
.setOutputTime(c.getOutputTime(currentTime))
.setWaitCount(c.getWaitCount(currentTime))
.build();
player.sendPacket(new PacketPlayerCompoundMaterialRsp(data));
}
@ -124,9 +140,20 @@ public class CookingCompoundManager extends BasePlayerManager {
// give player the rewards
if (success) {
player.getInventory().addItems(allRewards.values(), ActionReason.Compound);
player.sendPacket(new PackageTakeCompoundOutputRsp(allRewards.values().stream().map(i -> ItemParam.newBuilder().setItemId(i.getItemId()).setCount(i.getCount()).build()).toList(), Retcode.RET_SUCC_VALUE));
player.sendPacket(
new PackageTakeCompoundOutputRsp(
allRewards.values().stream()
.map(
i ->
ItemParam.newBuilder()
.setItemId(i.getItemId())
.setCount(i.getCount())
.build())
.toList(),
Retcode.RET_SUCC_VALUE));
} else {
player.sendPacket(new PackageTakeCompoundOutputRsp(null, Retcode.RET_COMPOUND_NOT_FINISH_VALUE));
player.sendPacket(
new PackageTakeCompoundOutputRsp(null, Retcode.RET_COMPOUND_NOT_FINISH_VALUE));
}
}

View File

@ -3,12 +3,9 @@ package emu.grasscutter.game.managers.deforestation;
import lombok.Getter;
public class HitTreeRecord {
/**
* -- GETTER --
* get unique id
*/
@Getter
private final int unique;
/** -- GETTER -- get unique id */
@Getter private final int unique;
private short count; // hit this tree times
private long time; // last available hitting time

View File

@ -1,12 +1,10 @@
package emu.grasscutter.game.managers.energy;
import lombok.Getter;
import java.util.List;
import lombok.Getter;
@Getter
public class EnergyDropEntry {
private int dropId;
private List<EnergyDropInfo> dropList;
}

View File

@ -6,5 +6,4 @@ import lombok.Getter;
public class EnergyDropInfo {
private int ballId;
private int count;
}

View File

@ -45,8 +45,7 @@ public class EnergyManager extends BasePlayerManager {
// Read the data we need for monster energy drops.
try {
DataLoader.loadList("EnergyDrop.json", EnergyDropEntry.class)
.forEach(
entry -> energyDropData.put(entry.getDropId(), entry.getDropList()));
.forEach(entry -> energyDropData.put(entry.getDropId(), entry.getDropList()));
Grasscutter.getLogger().debug("Energy drop data successfully loaded.");
} catch (Exception ex) {

View File

@ -1,12 +1,10 @@
package emu.grasscutter.game.managers.energy;
import lombok.Getter;
import java.util.List;
import lombok.Getter;
@Getter
public class SkillParticleGenerationEntry {
private int avatarId;
private List<SkillParticleGenerationInfo> amountList;
}

View File

@ -6,5 +6,4 @@ import lombok.Getter;
public class SkillParticleGenerationInfo {
private int value;
private int chance;
}

View File

@ -6,27 +6,15 @@ import lombok.Setter;
@Entity
public class ActiveForgeData {
@Setter
@Getter
private int forgeId;
@Setter
@Getter
private int avatarId;
@Setter
@Getter
private int count;
@Setter @Getter private int forgeId;
@Setter @Getter private int avatarId;
@Setter @Getter private int count;
@Setter
@Getter
private int startTime;
@Setter
@Getter
private int forgeTime;
@Setter @Getter private int startTime;
@Setter @Getter private int forgeTime;
private int lastUnfinishedCount;
@Setter
@Getter
private boolean changed;
@Setter @Getter private boolean changed;
public int getFinishedCount(int currentTime) {
int timeDelta = currentTime - this.startTime;

View File

@ -33,5 +33,4 @@ public class MapMark {
this.mapMarkFromType = mapMarkPoint.getFromType();
this.questId = mapMarkPoint.getQuestId();
}
}

View File

@ -63,15 +63,15 @@ public class PlayerCodex {
MATERIAL_WIDGET,
MATERIAL_EXCHANGE,
MATERIAL_AVATAR_MATERIAL,
MATERIAL_NOTICE_ADD_HP -> Optional.ofNullable(GameData.getCodexMaterialDataIdMap().get(itemId))
.ifPresent(
codexData -> {
if (this.getUnlockedMaterial().add(itemId)) {
this.player.save();
this.player.sendPacket(
new PacketCodexDataUpdateNotify(4, codexData.getId()));
}
});
MATERIAL_NOTICE_ADD_HP -> Optional.ofNullable(
GameData.getCodexMaterialDataIdMap().get(itemId))
.ifPresent(
codexData -> {
if (this.getUnlockedMaterial().add(itemId)) {
this.player.save();
this.player.sendPacket(new PacketCodexDataUpdateNotify(4, codexData.getId()));
}
});
default -> {}
}
}

View File

@ -1,9 +1,8 @@
package emu.grasscutter.game.player;
import dev.morphia.annotations.Entity;
import lombok.Getter;
import java.util.*;
import lombok.Getter;
@Entity(useDiscriminator = false)
public class PlayerCollectionRecords {
@ -58,6 +57,5 @@ public class PlayerCollectionRecords {
this.configId = configId;
this.expiredTime = expiredTime;
}
}
}

View File

@ -5,16 +5,14 @@ import static emu.grasscutter.config.Configuration.GAME_OPTIONS;
import dev.morphia.annotations.Entity;
import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.net.proto.AvatarTeamOuterClass.AvatarTeam;
import java.util.*;
import lombok.Getter;
import lombok.Setter;
import java.util.*;
@Getter
@Entity
public final class TeamInfo {
@Setter
private String name;
@Setter private String name;
private final List<Integer> avatars;
public TeamInfo() {

View File

@ -1,10 +1,9 @@
package emu.grasscutter.game.props;
import it.unimi.dsi.fastutil.ints.*;
import lombok.Getter;
import java.util.*;
import java.util.stream.Stream;
import lombok.Getter;
@Getter
public enum ActionReason {
@ -208,5 +207,4 @@ public enum ActionReason {
public static ActionReason getTypeByName(String name) {
return stringMap.getOrDefault(name, None);
}
}

View File

@ -14,5 +14,4 @@ public enum BattlePassMissionRefreshType {
BattlePassMissionRefreshType(int value) {
this.value = value;
}
}

View File

@ -17,5 +17,4 @@ public enum BattlePassMissionStatus {
this.value = value;
this.missionStatus = missionStatus; // In case proto enum values change later
}
}

View File

@ -2,10 +2,9 @@ package emu.grasscutter.game.props;
import emu.grasscutter.scripts.constants.IntValueEnum;
import it.unimi.dsi.fastutil.ints.*;
import lombok.Getter;
import java.util.*;
import java.util.stream.Stream;
import lombok.Getter;
@Getter
public enum CampTargetType implements IntValueEnum {

View File

@ -1,10 +1,9 @@
package emu.grasscutter.game.props;
import it.unimi.dsi.fastutil.ints.*;
import lombok.Getter;
import java.util.*;
import java.util.stream.Stream;
import lombok.Getter;
@Getter
public enum ClimateType {

View File

@ -1,10 +1,9 @@
package emu.grasscutter.game.props;
import it.unimi.dsi.fastutil.ints.*;
import lombok.Getter;
import java.util.*;
import java.util.stream.Stream;
import lombok.Getter;
@Getter
public enum EnterReason {
@ -66,5 +65,4 @@ public enum EnterReason {
public static EnterReason getTypeByName(String name) {
return stringMap.getOrDefault(name, None);
}
}

View File

@ -1,8 +1,7 @@
package emu.grasscutter.game.props;
import lombok.Getter;
import java.util.*;
import lombok.Getter;
@Getter
public enum EntityIdType {
@ -37,5 +36,4 @@ public enum EntityIdType {
public static EntityType toEntityType(int entityId) {
return map.getOrDefault(entityId, EntityType.None);
}
}

View File

@ -2,10 +2,9 @@ package emu.grasscutter.game.props;
import emu.grasscutter.scripts.constants.IntValueEnum;
import it.unimi.dsi.fastutil.ints.*;
import lombok.Getter;
import java.util.*;
import java.util.stream.Stream;
import lombok.Getter;
@Getter
public enum EntityType implements IntValueEnum {
@ -104,5 +103,4 @@ public enum EntityType implements IntValueEnum {
public static EntityType getTypeByName(String name) {
return stringMap.getOrDefault(name, None);
}
}

Some files were not shown because too many files have changed in this diff Show More