From b087e1fb4f18231a1e663afc7718df4a75d21066 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 3 Oct 2024 15:31:53 +0000 Subject: [PATCH] Format code [skip actions] --- .../data/binout/AbilityModifier.java | 7 +++---- .../data/binout/config/ConfigGlobalCombat.java | 1 + .../data/binout/routes/RoutePoint.java | 1 + .../excels/BlossomRefreshExcelConfigData.java | 1 + .../data/excels/CoopChapterData.java | 1 + .../emu/grasscutter/game/ability/Ability.java | 4 +++- .../actions/ActionExecuteGadgetLua.java | 4 +--- .../ability/actions/ActionServerLuaCall.java | 12 +++++------- .../game/activity/PlayerActivityData.java | 1 + .../emu/grasscutter/game/avatar/Avatar.java | 1 + .../grasscutter/game/gacha/GachaBanner.java | 1 + .../grasscutter/game/gacha/GachaSystem.java | 7 ++----- .../grasscutter/game/quest/GameMainQuest.java | 1 + .../game/tower/TowerLevelRecord.java | 1 + .../scripts/SceneScriptManager.java | 2 ++ .../emu/grasscutter/scripts/ScriptLoader.java | 2 ++ .../scripts/constants/EventType.java | 1 + .../grasscutter/scripts/data/SceneGadget.java | 1 + .../grasscutter/scripts/data/SceneObject.java | 1 + .../data/controller/EntityController.java | 6 +++--- .../server/dispatch/DispatchClient.java | 4 ++-- .../packet/recv/HandlerAvatarUpgradeReq.java | 7 ++++--- .../send/PacketPlayerEnterSceneNotify.java | 18 ++++++++++++------ .../packet/send/PacketPlayerLoginRsp.java | 3 ++- 24 files changed, 53 insertions(+), 35 deletions(-) diff --git a/src/main/java/emu/grasscutter/data/binout/AbilityModifier.java b/src/main/java/emu/grasscutter/data/binout/AbilityModifier.java index ff5c26eff..88c07dc0e 100644 --- a/src/main/java/emu/grasscutter/data/binout/AbilityModifier.java +++ b/src/main/java/emu/grasscutter/data/binout/AbilityModifier.java @@ -346,10 +346,9 @@ public class AbilityModifier implements Serializable { public String overrideMapKey; public int paramNum; - public DynamicFloat - param1 = DynamicFloat.ZERO, - param2 = DynamicFloat.ZERO, - param3 = DynamicFloat.ZERO; + public DynamicFloat param1 = DynamicFloat.ZERO, + param2 = DynamicFloat.ZERO, + param3 = DynamicFloat.ZERO; public String funcName; public LuaCallType luaCallType; diff --git a/src/main/java/emu/grasscutter/data/binout/config/ConfigGlobalCombat.java b/src/main/java/emu/grasscutter/data/binout/config/ConfigGlobalCombat.java index 2b736061a..052c80909 100644 --- a/src/main/java/emu/grasscutter/data/binout/config/ConfigGlobalCombat.java +++ b/src/main/java/emu/grasscutter/data/binout/config/ConfigGlobalCombat.java @@ -6,6 +6,7 @@ import lombok.Data; @Data public class ConfigGlobalCombat { private DefaultAbilities defaultAbilities; + // TODO: Add more indices @Data diff --git a/src/main/java/emu/grasscutter/data/binout/routes/RoutePoint.java b/src/main/java/emu/grasscutter/data/binout/routes/RoutePoint.java index 6414c8554..d5783bb39 100644 --- a/src/main/java/emu/grasscutter/data/binout/routes/RoutePoint.java +++ b/src/main/java/emu/grasscutter/data/binout/routes/RoutePoint.java @@ -13,6 +13,7 @@ public class RoutePoint { private float waitTime; // optional private float targetVelocity; // optional private boolean hasReachEvent; // optional + // rotRoundReachDir //optional Pos with optional values // rotRoundLeaveDir //optional Pos with optional values diff --git a/src/main/java/emu/grasscutter/data/excels/BlossomRefreshExcelConfigData.java b/src/main/java/emu/grasscutter/data/excels/BlossomRefreshExcelConfigData.java index 437751e28..31d5ae94b 100644 --- a/src/main/java/emu/grasscutter/data/excels/BlossomRefreshExcelConfigData.java +++ b/src/main/java/emu/grasscutter/data/excels/BlossomRefreshExcelConfigData.java @@ -9,6 +9,7 @@ import lombok.Getter; public class BlossomRefreshExcelConfigData extends GameResource { @Getter(onMethod_ = @Override) private int id; + // Map details private long nameTextMapHash; private long descTextMapHash; diff --git a/src/main/java/emu/grasscutter/data/excels/CoopChapterData.java b/src/main/java/emu/grasscutter/data/excels/CoopChapterData.java index 89f27901f..5ba2271a2 100644 --- a/src/main/java/emu/grasscutter/data/excels/CoopChapterData.java +++ b/src/main/java/emu/grasscutter/data/excels/CoopChapterData.java @@ -21,6 +21,7 @@ public class CoopChapterData extends GameResource { // int avatarSortId; // String chapterIcon; List unlockCond; + // int [] unlockCondTips; // int openMaterialId; // int openMaterialNum; diff --git a/src/main/java/emu/grasscutter/game/ability/Ability.java b/src/main/java/emu/grasscutter/game/ability/Ability.java index a903e5563..233882d48 100644 --- a/src/main/java/emu/grasscutter/game/ability/Ability.java +++ b/src/main/java/emu/grasscutter/game/ability/Ability.java @@ -65,7 +65,9 @@ public class Ability { data.modifiers.values().stream() .map( m -> - m.onAdded == null ? Collections.emptyList() : Arrays.asList(m.onAdded)) + m.onAdded == null + ? Collections.emptyList() + : Arrays.asList(m.onAdded)) .flatMap(List::stream) .filter(action -> action.type == AbilityModifierAction.Type.AvatarSkillStart) .map(action -> action.skillID) diff --git a/src/main/java/emu/grasscutter/game/ability/actions/ActionExecuteGadgetLua.java b/src/main/java/emu/grasscutter/game/ability/actions/ActionExecuteGadgetLua.java index cb9855222..9f489ed62 100644 --- a/src/main/java/emu/grasscutter/game/ability/actions/ActionExecuteGadgetLua.java +++ b/src/main/java/emu/grasscutter/game/ability/actions/ActionExecuteGadgetLua.java @@ -19,9 +19,7 @@ public class ActionExecuteGadgetLua extends AbilityActionHandler { var param2 = action.param2.getInt(ability); var param3 = action.param3.getInt(ability); - owner - .getEntityController() - .onClientExecuteRequest(owner, param1, param2, param3); + owner.getEntityController().onClientExecuteRequest(owner, param1, param2, param3); return true; } diff --git a/src/main/java/emu/grasscutter/game/ability/actions/ActionServerLuaCall.java b/src/main/java/emu/grasscutter/game/ability/actions/ActionServerLuaCall.java index e0ce5c7f5..2882af02e 100644 --- a/src/main/java/emu/grasscutter/game/ability/actions/ActionServerLuaCall.java +++ b/src/main/java/emu/grasscutter/game/ability/actions/ActionServerLuaCall.java @@ -70,9 +70,7 @@ public final class ActionServerLuaCall extends AbilityActionHandler { * @return Whether the function was called successfully. */ private static boolean callFunction( - Bindings bindings, String functionName, - Ability ability, AbilityModifierAction action - ) { + Bindings bindings, String functionName, Ability ability, AbilityModifierAction action) { try { // Resolve the function from the script. var function = bindings.get(functionName); @@ -86,10 +84,10 @@ public final class ActionServerLuaCall extends AbilityActionHandler { // Invoke the function with the parameters. switch (action.paramNum) { - case 1 -> luaFunction.invoke(new LuaValue[] { lParam1 }); - case 2 -> luaFunction.invoke(new LuaValue[] { lParam1, lParam2 }); - case 3 -> luaFunction.invoke(new LuaValue[] { lParam1, lParam2, lParam3 }); - default -> luaFunction.invoke(new LuaValue[] { ScriptLoader.getScriptLibLua() }); + case 1 -> luaFunction.invoke(new LuaValue[] {lParam1}); + case 2 -> luaFunction.invoke(new LuaValue[] {lParam1, lParam2}); + case 3 -> luaFunction.invoke(new LuaValue[] {lParam1, lParam2, lParam3}); + default -> luaFunction.invoke(new LuaValue[] {ScriptLoader.getScriptLibLua()}); } return true; diff --git a/src/main/java/emu/grasscutter/game/activity/PlayerActivityData.java b/src/main/java/emu/grasscutter/game/activity/PlayerActivityData.java index 61ecf9d7c..98f0d0271 100644 --- a/src/main/java/emu/grasscutter/game/activity/PlayerActivityData.java +++ b/src/main/java/emu/grasscutter/game/activity/PlayerActivityData.java @@ -24,6 +24,7 @@ public class PlayerActivityData { int uid; int activityId; Map watcherInfoMap; + /** the detail data of each type of activity (Json format) */ String detail; diff --git a/src/main/java/emu/grasscutter/game/avatar/Avatar.java b/src/main/java/emu/grasscutter/game/avatar/Avatar.java index be5774ed0..d7ed08400 100644 --- a/src/main/java/emu/grasscutter/game/avatar/Avatar.java +++ b/src/main/java/emu/grasscutter/game/avatar/Avatar.java @@ -86,6 +86,7 @@ public class Avatar { // trial avatar property @Getter @Setter private int trialAvatarId = 0; + // cannot store to db if grant reason is not integer @Getter @Setter private int grantReason = TrialAvatarGrantRecord.GrantReason.GRANT_REASON_INVALID.getNumber(); diff --git a/src/main/java/emu/grasscutter/game/gacha/GachaBanner.java b/src/main/java/emu/grasscutter/game/gacha/GachaBanner.java index b1bdaeef2..5aee6122c 100644 --- a/src/main/java/emu/grasscutter/game/gacha/GachaBanner.java +++ b/src/main/java/emu/grasscutter/game/gacha/GachaBanner.java @@ -49,6 +49,7 @@ public class GachaBanner { @Getter private int[] rateUpItems5 = {}; // This now handles default values for the fields below @Getter private BannerType bannerType = BannerType.STANDARD; + // These don't change between banner types (apart from Standard having three extra 4star avatars) @Getter private int[] fallbackItems3 = { diff --git a/src/main/java/emu/grasscutter/game/gacha/GachaSystem.java b/src/main/java/emu/grasscutter/game/gacha/GachaSystem.java index 249ab5a26..fbb8fc36c 100644 --- a/src/main/java/emu/grasscutter/game/gacha/GachaSystem.java +++ b/src/main/java/emu/grasscutter/game/gacha/GachaSystem.java @@ -25,15 +25,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 gachaBanners; + @Getter private final Int2ObjectMap gachaBanners; private WatchService watchService; public GachaSystem(GameServer server) { @@ -422,8 +420,7 @@ public class GachaSystem extends BaseGameSystem { if (this.watchService == null) { try { this.watchService = FileSystems.getDefault().newWatchService(); - FileUtils.getDataUserPath("") - .register(watchService, StandardWatchEventKinds.ENTRY_MODIFY); + FileUtils.getDataUserPath("").register(watchService, StandardWatchEventKinds.ENTRY_MODIFY); } catch (Exception e) { Grasscutter.getLogger() .error( diff --git a/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java b/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java index b258b8310..1ebf05fb2 100644 --- a/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java +++ b/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java @@ -195,6 +195,7 @@ public class GameMainQuest { // .forEach(getQuestManager()::startMainQuest); // } } + // TODO public void fail() {} diff --git a/src/main/java/emu/grasscutter/game/tower/TowerLevelRecord.java b/src/main/java/emu/grasscutter/game/tower/TowerLevelRecord.java index 245ec327d..6fe0663bd 100644 --- a/src/main/java/emu/grasscutter/game/tower/TowerLevelRecord.java +++ b/src/main/java/emu/grasscutter/game/tower/TowerLevelRecord.java @@ -7,6 +7,7 @@ import java.util.*; public class TowerLevelRecord { /** floorId in config */ private int floorId; + /** LevelId - Stars */ private Map passedLevelMap; diff --git a/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java b/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java index 3bbcf1180..b00e3fde3 100644 --- a/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java +++ b/src/main/java/emu/grasscutter/scripts/SceneScriptManager.java @@ -56,6 +56,7 @@ public class SceneScriptManager { private final Map cachedSceneGroupsInstances; private ScriptMonsterTideService scriptMonsterTideService; private ScriptMonsterSpawnService scriptMonsterSpawnService; + /** blockid - loaded groupSet */ private final Map> loadedGroupSetPerBlock; @@ -846,6 +847,7 @@ public class SceneScriptManager { .warn("failed to create entity with group {} and config {}", group.id, configId); } } + // Events public Future callEvent(int groupId, int eventType) { return callEvent(new ScriptArgs(groupId, eventType)); diff --git a/src/main/java/emu/grasscutter/scripts/ScriptLoader.java b/src/main/java/emu/grasscutter/scripts/ScriptLoader.java index de5e14b5c..4c69f0720 100644 --- a/src/main/java/emu/grasscutter/scripts/ScriptLoader.java +++ b/src/main/java/emu/grasscutter/scripts/ScriptLoader.java @@ -28,11 +28,13 @@ public class ScriptLoader { @Getter private static Serializer serializer; @Getter private static ScriptLib scriptLib; @Getter private static LuaValue scriptLibLua; + /** suggest GC to remove it if the memory is less */ private static Map> scriptSources = new ConcurrentHashMap<>(); private static Map> scriptsCache = new ConcurrentHashMap<>(); + /** sceneId - SceneMeta */ private static Map> sceneMetaCache = new ConcurrentHashMap<>(); diff --git a/src/main/java/emu/grasscutter/scripts/constants/EventType.java b/src/main/java/emu/grasscutter/scripts/constants/EventType.java index 8d9048927..43bbcba81 100644 --- a/src/main/java/emu/grasscutter/scripts/constants/EventType.java +++ b/src/main/java/emu/grasscutter/scripts/constants/EventType.java @@ -2,6 +2,7 @@ package emu.grasscutter.scripts.constants; public class EventType { public static final int EVENT_NONE = 0; + /** param1: monster.configId */ public static final int EVENT_ANY_MONSTER_DIE = 1; diff --git a/src/main/java/emu/grasscutter/scripts/data/SceneGadget.java b/src/main/java/emu/grasscutter/scripts/data/SceneGadget.java index 8c8821ca7..4fbf2a829 100644 --- a/src/main/java/emu/grasscutter/scripts/data/SceneGadget.java +++ b/src/main/java/emu/grasscutter/scripts/data/SceneGadget.java @@ -18,6 +18,7 @@ public class SceneGadget extends SceneObject { public int owner; public SceneBossChest boss_chest; public int interact_id; + /** * Note: this field indicates whether the gadget should disappear permanently. For example, if * isOneOff=true, like most chests, it will disappear permanently after interacted. If diff --git a/src/main/java/emu/grasscutter/scripts/data/SceneObject.java b/src/main/java/emu/grasscutter/scripts/data/SceneObject.java index d15b16192..05ccd6560 100644 --- a/src/main/java/emu/grasscutter/scripts/data/SceneObject.java +++ b/src/main/java/emu/grasscutter/scripts/data/SceneObject.java @@ -13,6 +13,7 @@ public abstract class SceneObject { public Position pos; public Position rot; + /** not set by lua */ public transient SceneGroup group; } diff --git a/src/main/java/emu/grasscutter/scripts/data/controller/EntityController.java b/src/main/java/emu/grasscutter/scripts/data/controller/EntityController.java index 7c9220bc4..b4a6d95f1 100644 --- a/src/main/java/emu/grasscutter/scripts/data/controller/EntityController.java +++ b/src/main/java/emu/grasscutter/scripts/data/controller/EntityController.java @@ -61,7 +61,8 @@ public class EntityController { } /** - * Invoked from {@link emu.grasscutter.game.ability.actions.ActionServerLuaCall} to call an entity controller function. + * Invoked from {@link emu.grasscutter.game.ability.actions.ActionServerLuaCall} to call an entity + * controller function. * * @param entity The entity which called the function. * @param funcName The name of the function to call. @@ -70,8 +71,7 @@ public class EntityController { * @return The return value of the function. */ public LuaValue callControllerScriptFunc( - GameEntity entity, String funcName, - Ability ability, AbilityModifierAction action) { + GameEntity entity, String funcName, Ability ability, AbilityModifierAction action) { var lParam1 = LuaValue.valueOf(action.param1.getInt(ability)); var lParam2 = LuaValue.valueOf(action.param2.getInt(ability)); var lParam3 = LuaValue.valueOf(action.param3.getInt(ability)); diff --git a/src/main/java/emu/grasscutter/server/dispatch/DispatchClient.java b/src/main/java/emu/grasscutter/server/dispatch/DispatchClient.java index bd556cef4..bcad40742 100644 --- a/src/main/java/emu/grasscutter/server/dispatch/DispatchClient.java +++ b/src/main/java/emu/grasscutter/server/dispatch/DispatchClient.java @@ -22,8 +22,8 @@ import org.java_websocket.handshake.ServerHandshake; import org.slf4j.Logger; /** - * This is a simple implementation of a server-to-server IPC client. - * It is implemented over WebSockets, and supports all Grasscutter versions past 1.6.0 + * This is a simple implementation of a server-to-server IPC client. It is implemented over + * WebSockets, and supports all Grasscutter versions past 1.6.0 */ @Getter public final class DispatchClient extends WebSocketClient implements IDispatcher { diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarUpgradeReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarUpgradeReq.java index cee78244b..2ee8a8e7b 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarUpgradeReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerAvatarUpgradeReq.java @@ -16,9 +16,10 @@ public class HandlerAvatarUpgradeReq extends PacketHandler { // These are bundled into a list of items. for (var item : req.getItemParamListList()) { session - .getServer() - .getInventorySystem() - .upgradeAvatar(session.getPlayer(), req.getAvatarGuid(), item.getItemId(), item.getCount()); + .getServer() + .getInventorySystem() + .upgradeAvatar( + session.getPlayer(), req.getAvatarGuid(), item.getItemId(), item.getCount()); } } } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java index 314c2d152..b418639d2 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerEnterSceneNotify.java @@ -28,8 +28,10 @@ public class PacketPlayerEnterSceneNotify extends BasePacket { .setTargetUid(player.getUid()) .setEnterSceneToken(player.getEnterSceneToken()) .setWorldLevel(player.getWorldLevel()) - // .setEnterReason(EnterReason.Login.getValue()) // Removed in 5.0; we don't know what it is - // .setIsFirstLoginEnterScene(player.isFirstLoginEnterScene()) // Removed in 5.0; we don't know what it is + // .setEnterReason(EnterReason.Login.getValue()) // Removed in 5.0; we don't know what + // it is + // .setIsFirstLoginEnterScene(player.isFirstLoginEnterScene()) // Removed in 5.0; we + // don't know what it is // .setWorldType(1) // Removed in 5.0; we don't know what it is .setSceneTransaction( "3-" @@ -80,7 +82,8 @@ public class PacketPlayerEnterSceneNotify extends BasePacket { var proto = PlayerEnterSceneNotify.newBuilder() // .setPrevSceneId(player.getSceneId()) // Removed in 5.0; we don't know what it is - // .setPrevPos(player.getPosition().toProto()) // Removed in 5.0; we don't know what it is + // .setPrevPos(player.getPosition().toProto()) // Removed in 5.0; we don't know what it + // is .setSceneId(teleportProperties.getSceneId()) .setPos(teleportProperties.getTeleportTo().toProto()) .setSceneBeginTime(System.currentTimeMillis()) @@ -88,7 +91,8 @@ public class PacketPlayerEnterSceneNotify extends BasePacket { .setTargetUid(target.getUid()) .setEnterSceneToken(player.getEnterSceneToken()) .setWorldLevel(target.getWorld().getWorldLevel()) - // .setEnterReason(teleportProperties.getEnterReason().getValue()) // Removed in 5.0; we don't know what it is + // .setEnterReason(teleportProperties.getEnterReason().getValue()) // Removed in 5.0; we + // don't know what it is // .setWorldType(1) // Removed in 5.0; we don't know what it is .setSceneTransaction( teleportProperties.getSceneId() @@ -118,14 +122,16 @@ public class PacketPlayerEnterSceneNotify extends BasePacket { var proto = PlayerEnterSceneNotify.newBuilder() // .setPrevSceneId(player.getSceneId()) // Removed in 5.0; we don't know what it is - // .setPrevPos(player.getPosition().toProto()) // Removed in 5.0; we don't know what it is + // .setPrevPos(player.getPosition().toProto()) // Removed in 5.0; we don't know what it + // is .setSceneId(teleportProperties.getSceneId()) .setPos(teleportProperties.getTeleportTo().toProto()) .setSceneBeginTime(System.currentTimeMillis()) .setType(other ? EnterType.ENTER_TYPE_OTHER_HOME : EnterType.ENTER_TYPE_SELF_HOME) .setTargetUid(targetUid) .setEnterSceneToken(player.getEnterSceneToken()) - // .setEnterReason(teleportProperties.getEnterReason().getValue()) // Removed in 5.0; we don't know what it is + // .setEnterReason(teleportProperties.getEnterReason().getValue()) // Removed in 5.0; we + // don't know what it is // .setWorldType(64) // Removed in 5.0; we don't know what it is .setSceneTransaction( teleportProperties.getSceneId() diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerLoginRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerLoginRsp.java index 9f3c94721..90fa44b67 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerLoginRsp.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlayerLoginRsp.java @@ -58,7 +58,8 @@ public class PacketPlayerLoginRsp extends BasePacket { .setClientDataVersion(info.getClientDataVersion()) .setClientSilenceDataVersion(info.getClientSilenceDataVersion()) // .setClientMd5(info.getClientDataMd5()) // Removed in 5.0; we don't know what it is - // .setClientSilenceMd5(info.getClientSilenceDataMd5()) // Removed in 5.0; we don't know what it is + // .setClientSilenceMd5(info.getClientSilenceDataMd5()) // Removed in 5.0; we don't know + // what it is .setResVersionConfig(info.getResVersionConfig()) .setClientVersionSuffix(info.getClientVersionSuffix()) .setClientSilenceVersionSuffix(info.getClientSilenceVersionSuffix())