Merge remote-tracking branch 'origin/unstable' into unstable

# Conflicts:
#	src/main/java/emu/grasscutter/game/ability/actions/ActionAvatarSkillStart.java
#	src/main/java/emu/grasscutter/game/entity/EntityAvatar.java
This commit is contained in:
KingRainbow44 2023-05-31 22:41:00 -04:00
commit 7458d4369e
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
11 changed files with 55 additions and 58 deletions

View File

@ -1,5 +1,8 @@
package emu.grasscutter.data;
import static emu.grasscutter.utils.FileUtils.*;
import static emu.grasscutter.utils.lang.Language.translate;
import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import emu.grasscutter.Grasscutter;
@ -19,10 +22,6 @@ import emu.grasscutter.scripts.*;
import emu.grasscutter.utils.*;
import it.unimi.dsi.fastutil.Pair;
import it.unimi.dsi.fastutil.ints.*;
import lombok.*;
import org.reflections.Reflections;
import javax.script.*;
import java.io.*;
import java.nio.file.*;
import java.util.*;
@ -30,9 +29,9 @@ import java.util.Map.Entry;
import java.util.concurrent.*;
import java.util.regex.Pattern;
import java.util.stream.*;
import static emu.grasscutter.utils.FileUtils.*;
import static emu.grasscutter.utils.lang.Language.translate;
import javax.script.*;
import lombok.*;
import org.reflections.Reflections;
public final class ResourceLoader {

View File

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

View File

@ -7,9 +7,8 @@ import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.proto.AbilityStringOuterClass.AbilityString;
import emu.grasscutter.utils.Utils;
import it.unimi.dsi.fastutil.objects.*;
import lombok.Getter;
import java.util.*;
import lombok.Getter;
public class Ability {
@Getter private AbilityData data;
@ -56,7 +55,7 @@ public class Ability {
@Override
public String toString() {
return "Ability Name: %s; Entity Owner: %s; Player Owner: %s".formatted(
data.abilityName, owner, playerOwner);
return "Ability Name: %s; Entity Owner: %s; Player Owner: %s"
.formatted(data.abilityName, owner, playerOwner);
}
}

View File

@ -17,11 +17,10 @@ import emu.grasscutter.net.proto.AbilityScalarTypeOuterClass.AbilityScalarType;
import emu.grasscutter.net.proto.AbilityScalarValueEntryOuterClass.AbilityScalarValueEntry;
import emu.grasscutter.net.proto.ModifierActionOuterClass.ModifierAction;
import io.netty.util.concurrent.FastThreadLocalThread;
import lombok.Getter;
import org.reflections.Reflections;
import java.util.HashMap;
import java.util.concurrent.*;
import lombok.Getter;
import org.reflections.Reflections;
public final class AbilityManager extends BasePlayerManager {
@ -491,8 +490,9 @@ public final class AbilityManager extends BasePlayerManager {
if (!Float.isNaN(entry.getFloatValue()))
entity.getGlobalAbilityValues().put(key, entry.getFloatValue());
}
case AbilityScalarType.ABILITY_SCALAR_TYPE_UINT_VALUE ->
entity.getGlobalAbilityValues().put(key, (float) entry.getUintValue());
case AbilityScalarType.ABILITY_SCALAR_TYPE_UINT_VALUE -> entity
.getGlobalAbilityValues()
.put(key, (float) entry.getUintValue());
default -> {
return;
}

View File

@ -8,11 +8,10 @@ import emu.grasscutter.game.player.*;
import emu.grasscutter.game.props.*;
import emu.grasscutter.net.proto.ActivityInfoOuterClass;
import emu.grasscutter.server.packet.send.PacketActivityScheduleInfoNotify;
import lombok.Getter;
import org.reflections.Reflections;
import java.util.*;
import java.util.concurrent.*;
import lombok.Getter;
import org.reflections.Reflections;
@Getter
public class ActivityManager extends BasePlayerManager {

View File

@ -14,9 +14,8 @@ import emu.grasscutter.scripts.data.controller.EntityController;
import emu.grasscutter.server.event.entity.*;
import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify;
import it.unimi.dsi.fastutil.ints.*;
import lombok.*;
import java.util.*;
import lombok.*;
public abstract class GameEntity {
@Getter private final Scene scene;
@ -256,9 +255,7 @@ public abstract class GameEntity {
}
}
/**
* Invoked when a global ability value is updated.
*/
/** Invoked when a global ability value is updated. */
public void onAbilityValueUpdate() {
// Does nothing.
}

View File

@ -1,5 +1,8 @@
package emu.grasscutter.game.player;
import static emu.grasscutter.config.Configuration.GAME_OPTIONS;
import static emu.grasscutter.scripts.constants.EventType.EVENT_UNLOCK_TRANS_POINT;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.binout.ScenePointEntry;
import emu.grasscutter.data.excels.OpenStateData;
@ -9,13 +12,9 @@ import emu.grasscutter.game.quest.enums.*;
import emu.grasscutter.net.proto.RetcodeOuterClass.Retcode;
import emu.grasscutter.scripts.data.ScriptArgs;
import emu.grasscutter.server.packet.send.*;
import java.util.Set;
import java.util.stream.Collectors;
import static emu.grasscutter.config.Configuration.GAME_OPTIONS;
import static emu.grasscutter.scripts.constants.EventType.EVENT_UNLOCK_TRANS_POINT;
// @Entity
public final class PlayerProgressManager extends BasePlayerDataManager {
/******************************************************************************************************************
@ -30,12 +29,16 @@ public final class PlayerProgressManager extends BasePlayerDataManager {
48 // blacklist OPEN_STATE_LIMIT_REGION_GLOBAL to make Meledy happy. =D Remove this as
// soon as quest unlocks are fully implemented.
);
public static final Set<Integer> IGNORED_OPEN_STATES = Set.of(
1404, // OPEN_STATE_MENGDE_INFUSEDCRYSTAL, causes quest 'Mine Craft' to be given to the player at the start of the game.
// This should be removed when city reputation is implemented.
57 // OPEN_STATE_PERSONAL_LINE, causes the prompt for showing character hangout quests to be permanently shown.
// This should be removed when character story quests are implemented.
);
public static final Set<Integer> IGNORED_OPEN_STATES =
Set.of(
1404, // OPEN_STATE_MENGDE_INFUSEDCRYSTAL, causes quest 'Mine Craft' to be given to the
// player at the start of the game.
// This should be removed when city reputation is implemented.
57 // OPEN_STATE_PERSONAL_LINE, causes the prompt for showing character hangout quests to
// be permanently shown.
// This should be removed when character story quests are implemented.
);
// Set of open states that are set per default for all accounts. Can be overwritten by an entry in
// `map`.
public static final Set<Integer> DEFAULT_OPEN_STATES =
@ -58,10 +61,10 @@ public final class PlayerProgressManager extends BasePlayerDataManager {
// working chat.
|| s.getId() == 1)
.map(OpenStateData::getId)
.filter(s -> !BLACKLIST_OPEN_STATES.contains(s)) // Filter out states in the blacklist.
.filter(
s ->
!BLACKLIST_OPEN_STATES.contains(s)) // Filter out states in the blacklist.
.filter(s -> !IGNORED_OPEN_STATES.contains(s)) // Filter out states in the default ignore list.
!IGNORED_OPEN_STATES.contains(s)) // Filter out states in the default ignore list.
.collect(Collectors.toSet());
public PlayerProgressManager(Player player) {

View File

@ -16,11 +16,10 @@ import emu.grasscutter.net.proto.ChildQuestOuterClass.ChildQuest;
import emu.grasscutter.net.proto.ParentQuestOuterClass.ParentQuest;
import emu.grasscutter.server.packet.send.*;
import emu.grasscutter.utils.ConversionUtils;
import lombok.*;
import org.bson.types.ObjectId;
import java.util.*;
import java.util.stream.Collectors;
import lombok.*;
import org.bson.types.ObjectId;
@Entity(value = "quests", useDiscriminator = false)
public class GameMainQuest {
@ -495,7 +494,8 @@ public class GameMainQuest {
subQuestWithCond.getFinishProgressList());
var questManager = this.getQuestManager();
if (questManager != null && questManager.getLoggedQuests().contains(subQuestWithCond.getSubQuestId())) {
if (questManager != null
&& questManager.getLoggedQuests().contains(subQuestWithCond.getSubQuestId())) {
Grasscutter.getLogger()
.debug(
">>> Quest {} will be {} as a result of content trigger {} ({}, {}).",

View File

@ -15,10 +15,9 @@ import emu.grasscutter.scripts.data.SceneGroup;
import emu.grasscutter.server.packet.send.*;
import emu.grasscutter.utils.Utils;
import it.unimi.dsi.fastutil.ints.IntIntImmutablePair;
import lombok.*;
import javax.script.Bindings;
import java.util.*;
import javax.script.Bindings;
import lombok.*;
@Entity
public class GameQuest {
@ -326,8 +325,6 @@ public class GameQuest {
@Override
public String toString() {
return "Main Quest: %s; Sub Quest: %s; State: %s"
.formatted(this.getMainQuestId(),
this.getSubQuestId(),
this.getState());
.formatted(this.getMainQuestId(), this.getSubQuestId(), this.getState());
}
}

View File

@ -15,7 +15,6 @@ public final class PluginConfig {
*/
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
public boolean validate() {
return name != null && description != null &&
mainClass != null && api != null;
return name != null && description != null && mainClass != null && api != null;
}
}

View File

@ -1,18 +1,17 @@
package emu.grasscutter.plugin;
import static emu.grasscutter.utils.lang.Language.translate;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.server.event.*;
import emu.grasscutter.utils.*;
import lombok.*;
import javax.annotation.Nullable;
import java.io.*;
import java.lang.reflect.Method;
import java.net.*;
import java.util.*;
import java.util.jar.*;
import static emu.grasscutter.utils.lang.Language.translate;
import javax.annotation.Nullable;
import lombok.*;
/** Manages the server's plugins and the event system. */
public final class PluginManager {
@ -80,11 +79,17 @@ public final class PluginManager {
PluginConfig pluginConfig = JsonUtils.loadToClass(fileReader, PluginConfig.class);
// Check the plugin's API version.
if (pluginConfig.api == null) {
Grasscutter.getLogger().warn(translate("plugin.invalid_api.not_present", plugin.getName()));
Grasscutter.getLogger()
.warn(translate("plugin.invalid_api.not_present", plugin.getName()));
return;
} else if (pluginConfig.api != API_VERSION) {
Grasscutter.getLogger().warn(translate("plugin.invalid_api.lower",
plugin.getName(), pluginConfig.api, API_VERSION));
Grasscutter.getLogger()
.warn(
translate(
"plugin.invalid_api.lower",
plugin.getName(),
pluginConfig.api,
API_VERSION));
return;
}