diff --git a/src/main/java/emu/grasscutter/data/GameData.java b/src/main/java/emu/grasscutter/data/GameData.java index 118760d6d..1107375d8 100644 --- a/src/main/java/emu/grasscutter/data/GameData.java +++ b/src/main/java/emu/grasscutter/data/GameData.java @@ -12,6 +12,7 @@ import emu.grasscutter.data.excels.avatar.*; import emu.grasscutter.data.excels.codex.*; import emu.grasscutter.data.excels.dungeon.*; import emu.grasscutter.data.excels.monster.*; +import emu.grasscutter.data.excels.quest.*; import emu.grasscutter.data.excels.reliquary.*; import emu.grasscutter.data.excels.tower.*; import emu.grasscutter.data.excels.trial.*; @@ -296,7 +297,12 @@ public final class GameData { new Int2ObjectOpenHashMap<>(); @Getter - private static final Int2ObjectMap questDataMap = new Int2ObjectOpenHashMap<>(); + private static final Int2ObjectMap questDataMap = + new Int2ObjectOpenHashMap<>(); + + @Getter + private static final Int2ObjectMap questGlobalVarDataMap = + new Int2ObjectOpenHashMap<>(); @Getter private static final Int2ObjectMap reliquaryAffixDataMap = @@ -318,7 +324,12 @@ public final class GameData { new Int2ObjectOpenHashMap<>(); @Getter - private static final Int2ObjectMap sceneDataMap = new Int2ObjectLinkedOpenHashMap<>(); + private static final Int2ObjectMap sceneDataMap = + new Int2ObjectLinkedOpenHashMap<>(); + + @Getter + private static final Int2ObjectMap talkConfigDataMap = + new Int2ObjectOpenHashMap<>(); @Getter private static final Int2ObjectMap towerFloorDataMap = diff --git a/src/main/java/emu/grasscutter/data/excels/TalkConfigData.java b/src/main/java/emu/grasscutter/data/excels/TalkConfigData.java new file mode 100644 index 000000000..c44a63b80 --- /dev/null +++ b/src/main/java/emu/grasscutter/data/excels/TalkConfigData.java @@ -0,0 +1,29 @@ +package emu.grasscutter.data.excels; + +import emu.grasscutter.data.GameResource; +import emu.grasscutter.data.ResourceType; +import emu.grasscutter.game.talk.TalkExec; +import lombok.*; +import com.google.gson.annotations.SerializedName; + +import java.util.List; + +@ResourceType(name = "TalkExcelConfigData.json") +@EqualsAndHashCode(callSuper=false) +@Data +public final class TalkConfigData extends GameResource { + @SerializedName(value="id", alternate={"_id"}) + private int id; + @SerializedName(value="finishExec", alternate={"_finishExec"}) + private List finishExec; + @SerializedName(value="questId", alternate={"_questId"}) + private int questId; + + @Data + public static class TalkExecParam { + @SerializedName(value="type", alternate={"_type"}) + private TalkExec type; + @SerializedName(value="param", alternate={"_param"}) + private String[] param; + } +} diff --git a/src/main/java/emu/grasscutter/data/excels/QuestData.java b/src/main/java/emu/grasscutter/data/excels/quest/QuestData.java similarity index 99% rename from src/main/java/emu/grasscutter/data/excels/QuestData.java rename to src/main/java/emu/grasscutter/data/excels/quest/QuestData.java index 2789b295e..3f2bf53ef 100644 --- a/src/main/java/emu/grasscutter/data/excels/QuestData.java +++ b/src/main/java/emu/grasscutter/data/excels/quest/QuestData.java @@ -1,4 +1,4 @@ -package emu.grasscutter.data.excels; +package emu.grasscutter.data.excels.quest; import com.google.gson.annotations.SerializedName; import emu.grasscutter.Grasscutter; diff --git a/src/main/java/emu/grasscutter/data/excels/quest/QuestGlobalVarData.java b/src/main/java/emu/grasscutter/data/excels/quest/QuestGlobalVarData.java new file mode 100644 index 000000000..3dfc4cc50 --- /dev/null +++ b/src/main/java/emu/grasscutter/data/excels/quest/QuestGlobalVarData.java @@ -0,0 +1,15 @@ +package emu.grasscutter.data.excels.quest; + +import emu.grasscutter.data.GameResource; +import emu.grasscutter.data.ResourceType; +import lombok.*; +import lombok.experimental.FieldDefaults; + +@ResourceType(name = "QuestGlobalVarConfigData.json") +@EqualsAndHashCode(callSuper=false) +@Data +@FieldDefaults(level = AccessLevel.PRIVATE) +public final class QuestGlobalVarData extends GameResource { + int id; + int defaultValue; +} diff --git a/src/main/java/emu/grasscutter/game/player/Player.java b/src/main/java/emu/grasscutter/game/player/Player.java index fb1e79759..e89252ebc 100644 --- a/src/main/java/emu/grasscutter/game/player/Player.java +++ b/src/main/java/emu/grasscutter/game/player/Player.java @@ -45,6 +45,7 @@ import emu.grasscutter.game.quest.QuestManager; import emu.grasscutter.game.quest.enums.QuestCond; import emu.grasscutter.game.quest.enums.QuestContent; import emu.grasscutter.game.shop.ShopLimit; +import emu.grasscutter.game.talk.TalkManager; import emu.grasscutter.game.tower.TowerData; import emu.grasscutter.game.tower.TowerManager; import emu.grasscutter.game.world.Scene; @@ -168,6 +169,7 @@ public class Player { @Getter private transient PlayerBuffManager buffManager; @Getter private transient PlayerProgressManager progressManager; @Getter private transient SatiationManager satiationManager; + @Getter private transient TalkManager talkManager; @Getter @Setter private transient Position lastCheckedPosition = null; @@ -285,6 +287,7 @@ public class Player { this.cookingManager = new CookingManager(this); this.cookingCompoundManager = new CookingCompoundManager(this); this.satiationManager = new SatiationManager(this); + this.talkManager = new TalkManager(this); } // On player creation @@ -1344,6 +1347,7 @@ public class Player { session.send(new PacketFinishedParentQuestNotify(this)); session.send(new PacketBattlePassAllDataNotify(this)); session.send(new PacketQuestListNotify(this)); + session.send(new PacketQuestGlobalVarNotify(this)); session.send(new PacketCodexDataFullNotify(this)); session.send(new PacketAllWidgetDataNotify(this)); diff --git a/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java b/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java index 3c2f67798..46fad03f5 100644 --- a/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java +++ b/src/main/java/emu/grasscutter/game/quest/GameMainQuest.java @@ -10,7 +10,7 @@ import emu.grasscutter.data.binout.MainQuestData; import emu.grasscutter.data.binout.MainQuestData.SubQuestData; import emu.grasscutter.data.binout.MainQuestData.TalkData; import emu.grasscutter.data.binout.ScriptSceneData; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.data.excels.RewardData; import emu.grasscutter.database.DatabaseHelper; import emu.grasscutter.game.player.Player; @@ -21,6 +21,7 @@ import emu.grasscutter.net.proto.ParentQuestOuterClass.ParentQuest; import emu.grasscutter.server.packet.send.PacketCodexDataUpdateNotify; import emu.grasscutter.server.packet.send.PacketFinishedParentQuestUpdateNotify; import emu.grasscutter.server.packet.send.PacketQuestProgressUpdateNotify; +import emu.grasscutter.server.packet.send.PacketQuestUpdateQuestVarNotify; import emu.grasscutter.utils.ConversionUtils; import emu.grasscutter.utils.Position; import java.util.*; @@ -40,8 +41,6 @@ public class GameMainQuest { @Getter private int parentQuestId; @Getter private int[] questVars; @Getter private long[] timeVar; - // QuestUpdateQuestVarReq is sent in two stages... - private List questVarsUpdate; @Getter private ParentQuestState state; @Getter private boolean isFinished; @Getter List questGroupSuites; @@ -68,13 +67,6 @@ public class GameMainQuest { addAllChildQuests(); } - public List getQuestVarsUpdate() { - if (questVarsUpdate == null) { - questVarsUpdate = new ArrayList<>(); - } - return questVarsUpdate; - } - private void addAllChildQuests() { List subQuestIds = Arrays.stream(GameData.getMainQuestDataMap().get(this.parentQuestId).getSubQuests()) @@ -114,6 +106,8 @@ public class GameMainQuest { this.questVars[i] = value; Grasscutter.getLogger() .debug("questVar {} value changed from {} to {}", i, previousValue, value); + + this.triggerQuestVarAction(i, this.questVars[i]); } public void incQuestVar(int i, int inc) { @@ -122,6 +116,8 @@ public class GameMainQuest { Grasscutter.getLogger() .debug( "questVar {} value incremented from {} to {}", i, previousValue, previousValue + inc); + + this.triggerQuestVarAction(i, this.questVars[i]); } public void decQuestVar(int i, int dec) { @@ -130,6 +126,20 @@ public class GameMainQuest { Grasscutter.getLogger() .debug( "questVar {} value decremented from {} to {}", i, previousValue, previousValue - dec); + + this.triggerQuestVarAction(i, this.questVars[i]); + } + + public void triggerQuestVarAction(int index, int value) { + var questManager = this.getQuestManager(); + questManager.queueEvent(QuestCond.QUEST_COND_QUEST_VAR_EQUAL, index, value); + questManager.queueEvent(QuestCond.QUEST_COND_QUEST_VAR_GREATER, index, value); + questManager.queueEvent(QuestCond.QUEST_COND_QUEST_VAR_LESS, index, value); + questManager.queueEvent(QuestContent.QUEST_CONTENT_QUEST_VAR_EQUAL, index, value); + questManager.queueEvent(QuestContent.QUEST_CONTENT_QUEST_VAR_GREATER, index, value); + questManager.queueEvent(QuestContent.QUEST_CONTENT_QUEST_VAR_LESS, index, value); + + this.getOwner().sendPacket(new PacketQuestUpdateQuestVarNotify(this.getParentQuestId(), this.questVars)); } public GameQuest getChildQuestById(int id) { diff --git a/src/main/java/emu/grasscutter/game/quest/GameQuest.java b/src/main/java/emu/grasscutter/game/quest/GameQuest.java index 962072d3f..1d5ae6ebc 100644 --- a/src/main/java/emu/grasscutter/game/quest/GameQuest.java +++ b/src/main/java/emu/grasscutter/game/quest/GameQuest.java @@ -5,7 +5,7 @@ import dev.morphia.annotations.Transient; import emu.grasscutter.Grasscutter; import emu.grasscutter.data.GameData; import emu.grasscutter.data.excels.ChapterData; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.data.excels.TriggerExcelConfigData; import emu.grasscutter.game.dungeons.enums.DungeonPassConditionType; import emu.grasscutter.game.player.Player; diff --git a/src/main/java/emu/grasscutter/game/quest/QuestManager.java b/src/main/java/emu/grasscutter/game/quest/QuestManager.java index 4a044d881..8d8322ad7 100644 --- a/src/main/java/emu/grasscutter/game/quest/QuestManager.java +++ b/src/main/java/emu/grasscutter/game/quest/QuestManager.java @@ -5,12 +5,13 @@ import emu.grasscutter.Grasscutter; import emu.grasscutter.data.GameData; import emu.grasscutter.data.binout.MainQuestData; import emu.grasscutter.data.binout.ScenePointEntry; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.database.DatabaseHelper; import emu.grasscutter.game.player.BasePlayerManager; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.enums.*; import emu.grasscutter.server.packet.send.PacketFinishedParentQuestUpdateNotify; +import emu.grasscutter.server.packet.send.PacketQuestGlobalVarNotify; import emu.grasscutter.utils.Position; import io.netty.util.concurrent.FastThreadLocalThread; import it.unimi.dsi.fastutil.ints.*; @@ -226,29 +227,60 @@ public class QuestManager extends BasePlayerManager { this.triggerEvent(QuestCond.QUEST_COND_PLAYER_LEVEL_EQUAL_GREATER, null, 1); } - /* - Looking through mainQuests 72201-72208 and 72174, we can infer that a questGlobalVar's default value is 0 - */ - public Integer getQuestGlobalVarValue(Integer variable) { - return getPlayer().getQuestGlobalVariables().getOrDefault(variable,0); + /** + * Returns the default value of a global variable. + * + * @param variable The variable ID. + * @return The default value. + */ + public int getGlobalVarDefault(int variable) { + var questGlobalVarData = GameData.getQuestGlobalVarDataMap().get(variable); + return questGlobalVarData != null ? questGlobalVarData.getDefaultValue() : 0; } - public void setQuestGlobalVarValue(Integer variable, Integer value) { - Integer previousValue = getPlayer().getQuestGlobalVariables().put(variable,value); - Grasscutter.getLogger().debug("Changed questGlobalVar {} value from {} to {}", variable, previousValue==null ? 0: previousValue, value); + /* + * Looking through mainQuests 72201-72208 and 72174, we can infer that a questGlobalVar's default value is 0 + */ + public Integer getQuestGlobalVarValue(Integer variable) { + return getPlayer().getQuestGlobalVariables() + .computeIfAbsent(variable, k -> this.getGlobalVarDefault(variable)); } - public void incQuestGlobalVarValue(Integer variable, Integer inc) { - // - Integer previousValue = getPlayer().getQuestGlobalVariables().getOrDefault(variable,0); - getPlayer().getQuestGlobalVariables().put(variable,previousValue + inc); - Grasscutter.getLogger().debug("Incremented questGlobalVar {} value from {} to {}", variable, previousValue, previousValue + inc); + + public void setQuestGlobalVarValue(int variable, int setVal) { + var prevVal = this.getPlayer().getQuestGlobalVariables().put(variable, setVal); + if (prevVal == null){ + prevVal = this.getGlobalVarDefault(variable); + } + var newVal = this.getQuestGlobalVarValue(variable); + + Grasscutter.getLogger().debug("Changed questGlobalVar {} value from {} to {}", variable, prevVal, newVal); + this.triggerQuestGlobalVarAction(variable, setVal); } - //In MainQuest 998, dec is passed as a positive integer - public void decQuestGlobalVarValue(Integer variable, Integer dec) { - // - Integer previousValue = getPlayer().getQuestGlobalVariables().getOrDefault(variable,0); - getPlayer().getQuestGlobalVariables().put(variable,previousValue - dec); - Grasscutter.getLogger().debug("Decremented questGlobalVar {} value from {} to {}", variable, previousValue, previousValue - dec); + + public void incQuestGlobalVarValue(int variable, int inc) { + var prevVal = getQuestGlobalVarValue(variable); + var newVal = getPlayer().getQuestGlobalVariables() + .compute(variable, (k, v) -> prevVal + inc); + + Grasscutter.getLogger().debug("Incremented questGlobalVar {} value from {} to {}", variable, prevVal, newVal); + this.triggerQuestGlobalVarAction(variable, newVal); + } + + // In MainQuest 998, dec is passed as a positive integer + public void decQuestGlobalVarValue(int variable, int dec) { + var prevVal = getQuestGlobalVarValue(variable); + this.getPlayer().getQuestGlobalVariables().put(variable, prevVal - dec); + var newVal = getQuestGlobalVarValue(variable); + + Grasscutter.getLogger().debug("Decremented questGlobalVar {} value from {} to {}", variable, prevVal, newVal); + this.triggerQuestGlobalVarAction(variable, newVal); + } + + public void triggerQuestGlobalVarAction(int variable, int value) { + this.queueEvent(QuestCond.QUEST_COND_QUEST_GLOBAL_VAR_EQUAL, variable, value); + this.queueEvent(QuestCond.QUEST_COND_QUEST_GLOBAL_VAR_GREATER, variable, value); + this.queueEvent(QuestCond.QUEST_COND_QUEST_GLOBAL_VAR_LESS, variable, value); + this.getPlayer().sendPacket(new PacketQuestGlobalVarNotify(getPlayer())); } public GameMainQuest getMainQuestById(int mainQuestId) { @@ -261,13 +293,12 @@ public class QuestManager extends BasePlayerManager { } public GameQuest getQuestById(int questId) { - QuestData questConfig = GameData.getQuestDataMap().get(questId); + var questConfig = GameData.getQuestDataMap().get(questId); if (questConfig == null) { return null; } - GameMainQuest mainQuest = getMainQuests().get(questConfig.getMainId()); - + var mainQuest = getMainQuests().get(questConfig.getMainId()); if (mainQuest == null) { return null; } @@ -276,23 +307,23 @@ public class QuestManager extends BasePlayerManager { } public void forEachQuest(Consumer callback) { - for (GameMainQuest mainQuest : getMainQuests().values()) { - for (GameQuest quest : mainQuest.getChildQuests().values()) { + for (var mainQuest : getMainQuests().values()) { + for (var quest : mainQuest.getChildQuests().values()) { callback.accept(quest); } } } public void forEachMainQuest(Consumer callback) { - for (GameMainQuest mainQuest : getMainQuests().values()) { + for (var mainQuest : getMainQuests().values()) { callback.accept(mainQuest); } } // TODO public void forEachActiveQuest(Consumer callback) { - for (GameMainQuest mainQuest : getMainQuests().values()) { - for (GameQuest quest : mainQuest.getChildQuests().values()) { + for (var mainQuest : getMainQuests().values()) { + for (var quest : mainQuest.getChildQuests().values()) { if (quest.getState() != QuestState.QUEST_STATE_FINISHED) { callback.accept(quest); } @@ -301,28 +332,25 @@ public class QuestManager extends BasePlayerManager { } public GameMainQuest addMainQuest(QuestData questConfig) { - GameMainQuest mainQuest = new GameMainQuest(getPlayer(), questConfig.getMainId()); - getMainQuests().put(mainQuest.getParentQuestId(), mainQuest); - - getPlayer().sendPacket(new PacketFinishedParentQuestUpdateNotify(mainQuest)); + var mainQuest = new GameMainQuest(getPlayer(), questConfig.getMainId()); + this.getMainQuests().put(mainQuest.getParentQuestId(), mainQuest); + this.getPlayer().sendPacket(new PacketFinishedParentQuestUpdateNotify(mainQuest)); return mainQuest; } public GameQuest addQuest(int questId) { - QuestData questConfig = GameData.getQuestDataMap().get(questId); - + var questConfig = GameData.getQuestDataMap().get(questId); if (questConfig == null) { return null; } - return addQuest(questConfig); + return this.addQuest(questConfig); } public GameQuest addQuest(@Nonnull QuestData questConfig) { - // Main quest - GameMainQuest mainQuest = this.getMainQuestById(questConfig.getMainId()); + var mainQuest = this.getMainQuestById(questConfig.getMainId()); // Create main quest if it doesnt exist if (mainQuest == null) { @@ -330,11 +358,11 @@ public class QuestManager extends BasePlayerManager { } // Sub quest - GameQuest quest = mainQuest.getChildQuestById(questConfig.getSubId()); - + var quest = mainQuest.getChildQuestById(questConfig.getSubId()); // Forcefully start quest.start(); - checkQuestAlreadyFullfilled(quest); + // Check conditions. + this.checkQuestAlreadyFullfilled(quest); return quest; } @@ -442,7 +470,7 @@ public class QuestManager extends BasePlayerManager { /** * TODO maybe trigger them delayed to allow basic communication finish first * TODO move content checks to use static informations where possible to allow direct already fulfilled checking - * @param quest + * @param quest The ID of the quest. */ public void checkQuestAlreadyFullfilled(GameQuest quest){ Grasscutter.getGameServer().getScheduler().scheduleDelayedTask(() -> { diff --git a/src/main/java/emu/grasscutter/game/quest/QuestSystem.java b/src/main/java/emu/grasscutter/game/quest/QuestSystem.java index 28ca3ea82..1d609fd15 100644 --- a/src/main/java/emu/grasscutter/game/quest/QuestSystem.java +++ b/src/main/java/emu/grasscutter/game/quest/QuestSystem.java @@ -1,10 +1,10 @@ package emu.grasscutter.game.quest; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.excels.QuestData; -import emu.grasscutter.data.excels.QuestData.QuestAcceptCondition; -import emu.grasscutter.data.excels.QuestData.QuestContentCondition; -import emu.grasscutter.data.excels.QuestData.QuestExecParam; +import emu.grasscutter.data.excels.quest.QuestData; +import emu.grasscutter.data.excels.quest.QuestData.QuestAcceptCondition; +import emu.grasscutter.data.excels.quest.QuestData.QuestContentCondition; +import emu.grasscutter.data.excels.quest.QuestData.QuestExecParam; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.conditions.BaseCondition; import emu.grasscutter.game.quest.content.BaseContent; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/BaseCondition.java b/src/main/java/emu/grasscutter/game/quest/conditions/BaseCondition.java index de6fc11d3..e53c4cc0e 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/BaseCondition.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/BaseCondition.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.conditions; import static emu.grasscutter.game.quest.enums.QuestCond.QUEST_COND_UNKNOWN; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/BaseConditionQuestVar.java b/src/main/java/emu/grasscutter/game/quest/conditions/BaseConditionQuestVar.java index 501ff51bd..8dce53ccd 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/BaseConditionQuestVar.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/BaseConditionQuestVar.java @@ -1,7 +1,7 @@ package emu.grasscutter.game.quest.conditions; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import lombok.val; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionActivityCond.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionActivityCond.java index 62ac4c0e9..8a62b4fc4 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionActivityCond.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionActivityCond.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.conditions; import static emu.grasscutter.game.quest.enums.QuestCond.QUEST_COND_ACTIVITY_COND; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; import lombok.val; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionActivityEnd.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionActivityEnd.java index 21cb4edb8..4aa25ec02 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionActivityEnd.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionActivityEnd.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.conditions; import static emu.grasscutter.game.quest.enums.QuestCond.QUEST_COND_ACTIVITY_END; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; import lombok.val; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionActivityOpen.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionActivityOpen.java index 816ec6ff2..9ebe7993f 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionActivityOpen.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionActivityOpen.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.conditions; import static emu.grasscutter.game.quest.enums.QuestCond.QUEST_COND_ACTIVITY_OPEN; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; import lombok.val; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionCompleteTalk.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionCompleteTalk.java index d6c7bd20a..1a4f5df6f 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionCompleteTalk.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionCompleteTalk.java @@ -4,7 +4,7 @@ import static emu.grasscutter.game.quest.enums.QuestCond.QUEST_COND_COMPLETE_TAL import emu.grasscutter.Grasscutter; import emu.grasscutter.data.GameData; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; import lombok.val; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionHistoryGotAnyItem.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionHistoryGotAnyItem.java index 29ea7f9bf..78cc2bcd2 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionHistoryGotAnyItem.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionHistoryGotAnyItem.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.conditions; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; import emu.grasscutter.game.quest.enums.QuestCond; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionIsDaytime.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionIsDaytime.java index bc7370e47..d2352f2dc 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionIsDaytime.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionIsDaytime.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.conditions; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; import emu.grasscutter.game.quest.enums.QuestCond; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionItemNumLessThan.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionItemNumLessThan.java index 6b2eb3aae..57eb1e8a6 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionItemNumLessThan.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionItemNumLessThan.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.conditions; import static emu.grasscutter.game.quest.enums.QuestCond.QUEST_COND_ITEM_NUM_LESS_THAN; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; import lombok.val; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionLuaNotify.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionLuaNotify.java index 082faaf02..ffea10f7a 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionLuaNotify.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionLuaNotify.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.conditions; import static emu.grasscutter.game.quest.enums.QuestCond.QUEST_COND_LUA_NOTIFY; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; import lombok.val; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionNone.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionNone.java index efcd055b4..b303d6d02 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionNone.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionNone.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.conditions; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; import emu.grasscutter.game.quest.enums.QuestCond; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionOpenStateEqual.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionOpenStateEqual.java index b875cd78e..50c0930ab 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionOpenStateEqual.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionOpenStateEqual.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.conditions; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; import emu.grasscutter.game.quest.enums.QuestCond; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionPackHaveItem.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionPackHaveItem.java index fdfd27a8f..3719577b8 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionPackHaveItem.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionPackHaveItem.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.conditions; import static emu.grasscutter.game.quest.enums.QuestCond.QUEST_COND_PACK_HAVE_ITEM; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; import lombok.val; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionPersonalLineUnlock.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionPersonalLineUnlock.java index edd00bd2d..187a6a52e 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionPersonalLineUnlock.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionPersonalLineUnlock.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.conditions; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; import emu.grasscutter.game.quest.enums.QuestCond; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionPlayerLevelEqualGreater.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionPlayerLevelEqualGreater.java index 597034da6..a909f13fe 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionPlayerLevelEqualGreater.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionPlayerLevelEqualGreater.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.conditions; import static emu.grasscutter.game.quest.enums.QuestCond.QUEST_COND_PLAYER_LEVEL_EQUAL_GREATER; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; import lombok.val; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionQuestGlobalVarEqual.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionQuestGlobalVarEqual.java index e81d46d22..d9808a6a6 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionQuestGlobalVarEqual.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionQuestGlobalVarEqual.java @@ -3,7 +3,7 @@ package emu.grasscutter.game.quest.conditions; import static emu.grasscutter.game.quest.enums.QuestCond.QUEST_COND_QUEST_GLOBAL_VAR_EQUAL; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; import lombok.val; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionQuestGlobalVarGreater.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionQuestGlobalVarGreater.java index 759d84058..9f846c00a 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionQuestGlobalVarGreater.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionQuestGlobalVarGreater.java @@ -3,7 +3,7 @@ package emu.grasscutter.game.quest.conditions; import static emu.grasscutter.game.quest.enums.QuestCond.QUEST_COND_QUEST_GLOBAL_VAR_GREATER; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; import lombok.val; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionQuestGlobalVarLess.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionQuestGlobalVarLess.java index 433ca89d9..f711ad31d 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionQuestGlobalVarLess.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionQuestGlobalVarLess.java @@ -3,7 +3,7 @@ package emu.grasscutter.game.quest.conditions; import static emu.grasscutter.game.quest.enums.QuestCond.QUEST_COND_QUEST_GLOBAL_VAR_LESS; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; import lombok.val; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionStateEqual.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionStateEqual.java index d37b890d7..76298df0c 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionStateEqual.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionStateEqual.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.conditions; import static emu.grasscutter.game.quest.enums.QuestCond.QUEST_COND_STATE_EQUAL; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionStateNotEqual.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionStateNotEqual.java index e9a53cdc0..487c016a3 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionStateNotEqual.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionStateNotEqual.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.conditions; import static emu.grasscutter.game.quest.enums.QuestCond.QUEST_COND_STATE_NOT_EQUAL; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionTimeVarGreaterOrEqual.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionTimeVarGreaterOrEqual.java index ab3f5182f..7410e2694 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionTimeVarGreaterOrEqual.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionTimeVarGreaterOrEqual.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.conditions; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; import emu.grasscutter.game.quest.enums.QuestCond; diff --git a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionTimeVarPassDay.java b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionTimeVarPassDay.java index bee921e79..120e3e263 100644 --- a/src/main/java/emu/grasscutter/game/quest/conditions/ConditionTimeVarPassDay.java +++ b/src/main/java/emu/grasscutter/game/quest/conditions/ConditionTimeVarPassDay.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.conditions; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.player.Player; import emu.grasscutter.game.quest.QuestValueCond; import emu.grasscutter.game.quest.enums.QuestCond; diff --git a/src/main/java/emu/grasscutter/game/quest/content/BaseContent.java b/src/main/java/emu/grasscutter/game/quest/content/BaseContent.java index 4b6acd7e4..4f244c395 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/BaseContent.java +++ b/src/main/java/emu/grasscutter/game/quest/content/BaseContent.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.content; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; import emu.grasscutter.game.quest.enums.QuestContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentAddQuestProgress.java b/src/main/java/emu/grasscutter/game/quest/content/ContentAddQuestProgress.java index 2d63a7a58..2eb2a17ad 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentAddQuestProgress.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentAddQuestProgress.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_ADD_QUEST_PROGRESS; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; import lombok.val; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentAnyManualTransport.java b/src/main/java/emu/grasscutter/game/quest/content/ContentAnyManualTransport.java index ded99b9f6..595f6d37b 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentAnyManualTransport.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentAnyManualTransport.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_ANY_MANUAL_TRANSPORT; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentClearGroupMonster.java b/src/main/java/emu/grasscutter/game/quest/content/ContentClearGroupMonster.java index e66f5973e..db753ccfb 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentClearGroupMonster.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentClearGroupMonster.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_CLEAR_GROUP_MONSTER; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; import lombok.val; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentCompleteAnyTalk.java b/src/main/java/emu/grasscutter/game/quest/content/ContentCompleteAnyTalk.java index 5d92d1309..5926f7b8d 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentCompleteAnyTalk.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentCompleteAnyTalk.java @@ -2,11 +2,11 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_COMPLETE_ANY_TALK; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.GameData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; -import java.util.Arrays; -import lombok.val; +import java.util.stream.Stream; @QuestValueContent(QUEST_CONTENT_COMPLETE_ANY_TALK) public class ContentCompleteAnyTalk extends BaseContent { @@ -14,20 +14,9 @@ public class ContentCompleteAnyTalk extends BaseContent { @Override public boolean execute( GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) { - val talkId = params[0]; - val conditionTalk = - Arrays.stream(condition.getParamStr().split(",")).mapToInt(Integer::parseInt).toArray(); - return Arrays.stream(conditionTalk).anyMatch(tids -> tids == talkId) - || Arrays.stream(conditionTalk) - .anyMatch( - tids -> { - val checkMainQuest = - quest.getOwner().getQuestManager().getMainQuestByTalkId(tids); - if (checkMainQuest == null) { - return false; - } - val talkData = checkMainQuest.getTalks().get(talkId); - return talkData != null; - }); + return Stream.of(condition.getParamStr().split(",")) + .mapToInt(Integer::parseInt) + .anyMatch(talkId -> GameData.getTalkConfigDataMap() + .get(params[0]) != null && talkId == params[0]); } } diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentCompleteTalk.java b/src/main/java/emu/grasscutter/game/quest/content/ContentCompleteTalk.java index f65584905..c5e76d5b4 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentCompleteTalk.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentCompleteTalk.java @@ -2,7 +2,8 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_COMPLETE_TALK; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.GameData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; import lombok.val; @@ -13,13 +14,7 @@ public class ContentCompleteTalk extends BaseContent { @Override public boolean execute( GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) { - val talkId = condition.getParam()[0]; - val checkMainQuest = quest.getOwner().getQuestManager().getMainQuestByTalkId(talkId); - if (checkMainQuest == null) { - return false; - } - - val talkData = checkMainQuest.getTalks().get(talkId); - return talkData != null; + return condition.getParam()[0] == params[0] && + GameData.getTalkConfigDataMap().get(condition.getParam()[0]) != null; } } diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentDestroyGadget.java b/src/main/java/emu/grasscutter/game/quest/content/ContentDestroyGadget.java index c4822ede9..c558d0ec2 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentDestroyGadget.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentDestroyGadget.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_DESTROY_GADGET; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentEnterDungeon.java b/src/main/java/emu/grasscutter/game/quest/content/ContentEnterDungeon.java index 52722c5df..1b6454b7e 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentEnterDungeon.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentEnterDungeon.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_ENTER_DUNGEON; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentEnterMyWorld.java b/src/main/java/emu/grasscutter/game/quest/content/ContentEnterMyWorld.java index 37eabf366..0377aeed8 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentEnterMyWorld.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentEnterMyWorld.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_ENTER_MY_WORLD; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentEnterMyWorldScene.java b/src/main/java/emu/grasscutter/game/quest/content/ContentEnterMyWorldScene.java index 943cd64e6..5d4139010 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentEnterMyWorldScene.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentEnterMyWorldScene.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_ENTER_MY_WORLD_SCENE; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentEnterRoom.java b/src/main/java/emu/grasscutter/game/quest/content/ContentEnterRoom.java index 9d25510f9..b020ea7a2 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentEnterRoom.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentEnterRoom.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_ENTER_ROOM; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentEnterVehicle.java b/src/main/java/emu/grasscutter/game/quest/content/ContentEnterVehicle.java index 4afdd92ec..10e03e303 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentEnterVehicle.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentEnterVehicle.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_ENTER_VEHICLE; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentFailDungeon.java b/src/main/java/emu/grasscutter/game/quest/content/ContentFailDungeon.java index b456d8e01..6c4be504c 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentFailDungeon.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentFailDungeon.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_FAIL_DUNGEON; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentFinishDungeon.java b/src/main/java/emu/grasscutter/game/quest/content/ContentFinishDungeon.java index d6021e787..698b256c6 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentFinishDungeon.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentFinishDungeon.java @@ -2,12 +2,10 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_FINISH_DUNGEON; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; -import java.util.stream.Collectors; - @QuestValueContent(QUEST_CONTENT_FINISH_DUNGEON) public class ContentFinishDungeon extends BaseContent { // params[0] dungeon ID, params[1] unknown diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentFinishPlot.java b/src/main/java/emu/grasscutter/game/quest/content/ContentFinishPlot.java index 56786d8b0..83e7621e3 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentFinishPlot.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentFinishPlot.java @@ -3,7 +3,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_FINISH_PLOT; import emu.grasscutter.data.binout.MainQuestData; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentGameTimeTick.java b/src/main/java/emu/grasscutter/game/quest/content/ContentGameTimeTick.java index 7d5d33667..1686813f9 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentGameTimeTick.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentGameTimeTick.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_GAME_TIME_TICK; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; import lombok.val; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentInteractGadget.java b/src/main/java/emu/grasscutter/game/quest/content/ContentInteractGadget.java index 2d657a8f3..4e98cd888 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentInteractGadget.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentInteractGadget.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_INTERACT_GADGET; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentItemLessThan.java b/src/main/java/emu/grasscutter/game/quest/content/ContentItemLessThan.java index 818bb662a..0bf79f4e8 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentItemLessThan.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentItemLessThan.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_ITEM_LESS_THAN; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentKillMonster.java b/src/main/java/emu/grasscutter/game/quest/content/ContentKillMonster.java index 9f44c5b46..db8e2d3ae 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentKillMonster.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentKillMonster.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_KILL_MONSTER; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentLeaveScene.java b/src/main/java/emu/grasscutter/game/quest/content/ContentLeaveScene.java index 5e709b38a..24f2ec921 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentLeaveScene.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentLeaveScene.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_LEAVE_SCENE; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentLuaNotify.java b/src/main/java/emu/grasscutter/game/quest/content/ContentLuaNotify.java index 36013969c..d1db6e3a5 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentLuaNotify.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentLuaNotify.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_LUA_NOTIFY; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentMonsterDie.java b/src/main/java/emu/grasscutter/game/quest/content/ContentMonsterDie.java index cac3400cc..6e7f73722 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentMonsterDie.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentMonsterDie.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_MONSTER_DIE; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentNotFinishPlot.java b/src/main/java/emu/grasscutter/game/quest/content/ContentNotFinishPlot.java index e748a6ddd..3b610ea35 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentNotFinishPlot.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentNotFinishPlot.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_NOT_FINISH_PLOT; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; import lombok.val; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentObtainItem.java b/src/main/java/emu/grasscutter/game/quest/content/ContentObtainItem.java index dda93c2fc..ecf5bf858 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentObtainItem.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentObtainItem.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_OBTAIN_ITEM; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentPlayerLevelUp.java b/src/main/java/emu/grasscutter/game/quest/content/ContentPlayerLevelUp.java index b206e8559..02c08eb3a 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentPlayerLevelUp.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentPlayerLevelUp.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_PLAYER_LEVEL_UP; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestStateEqual.java b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestStateEqual.java index 063d5b832..32708ed69 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestStateEqual.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestStateEqual.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_QUEST_STATE_EQUAL; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestStateNotEqual.java b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestStateNotEqual.java index 095601ef5..475c3414b 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestStateNotEqual.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestStateNotEqual.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_QUEST_STATE_NOT_EQUAL; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarEqual.java b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarEqual.java index e208d9778..6c86f080c 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarEqual.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarEqual.java @@ -3,7 +3,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_QUEST_VAR_EQUAL; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarGreater.java b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarGreater.java index cbcb95ccf..b604fc625 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarGreater.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarGreater.java @@ -3,7 +3,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_QUEST_VAR_GREATER; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarLess.java b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarLess.java index e60b50b90..e839a42dd 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarLess.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentQuestVarLess.java @@ -3,7 +3,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_QUEST_VAR_LESS; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentSkill.java b/src/main/java/emu/grasscutter/game/quest/content/ContentSkill.java index e84a11663..8401e37a4 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentSkill.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentSkill.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_SKILL; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentTimeVarMoreOrEqual.java b/src/main/java/emu/grasscutter/game/quest/content/ContentTimeVarMoreOrEqual.java index 159ea84f5..7e4cd0220 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentTimeVarMoreOrEqual.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentTimeVarMoreOrEqual.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.content; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; import emu.grasscutter.game.quest.enums.QuestContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentTimeVarPassDay.java b/src/main/java/emu/grasscutter/game/quest/content/ContentTimeVarPassDay.java index 2c6ca8dff..06076d20a 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentTimeVarPassDay.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentTimeVarPassDay.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.content; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; import emu.grasscutter.game.quest.enums.QuestContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentTriggerFire.java b/src/main/java/emu/grasscutter/game/quest/content/ContentTriggerFire.java index 84b39a4e2..a2a836f05 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentTriggerFire.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentTriggerFire.java @@ -3,7 +3,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_TRIGGER_FIRE; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentUnlockArea.java b/src/main/java/emu/grasscutter/game/quest/content/ContentUnlockArea.java index e4e9fccbf..106ee246c 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentUnlockArea.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentUnlockArea.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_UNLOCK_AREA; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentUnlockTransPoint.java b/src/main/java/emu/grasscutter/game/quest/content/ContentUnlockTransPoint.java index 053bd73d6..e498d223d 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentUnlockTransPoint.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentUnlockTransPoint.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_UNLOCK_TRANS_POINT; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentUseItem.java b/src/main/java/emu/grasscutter/game/quest/content/ContentUseItem.java index 2af72a57f..a2b72fc43 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentUseItem.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentUseItem.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_USE_ITEM; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/content/ContentWorktopSelect.java b/src/main/java/emu/grasscutter/game/quest/content/ContentWorktopSelect.java index 30ad78a90..ab2db3941 100644 --- a/src/main/java/emu/grasscutter/game/quest/content/ContentWorktopSelect.java +++ b/src/main/java/emu/grasscutter/game/quest/content/ContentWorktopSelect.java @@ -2,7 +2,7 @@ package emu.grasscutter.game.quest.content; import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_WORKTOP_SELECT; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueContent; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecAddCurAvatarEnergy.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecAddCurAvatarEnergy.java index 95ca4a79c..22455302d 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecAddCurAvatarEnergy.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecAddCurAvatarEnergy.java @@ -1,7 +1,7 @@ package emu.grasscutter.game.quest.exec; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecAddQuestProgress.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecAddQuestProgress.java index 76d3b45cd..393d081d9 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecAddQuestProgress.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecAddQuestProgress.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.exec; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecChangeAvatarElemet.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecChangeAvatarElemet.java index d6b15beb8..6e76bced3 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecChangeAvatarElemet.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecChangeAvatarElemet.java @@ -1,7 +1,7 @@ package emu.grasscutter.game.quest.exec; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.props.ElementType; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecClearTimeVar.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecClearTimeVar.java index e84c61bf5..281230763 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecClearTimeVar.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecClearTimeVar.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.exec; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecDecQuestGlobalVar.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecDecQuestGlobalVar.java index 3c542b1e3..0827e91cb 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecDecQuestGlobalVar.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecDecQuestGlobalVar.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.exec; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecDecQuestVar.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecDecQuestVar.java index 666302d8a..20406f0eb 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecDecQuestVar.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecDecQuestVar.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.exec; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecDelPackItem.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecDelPackItem.java index cd2286d1f..19960fd2e 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecDelPackItem.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecDelPackItem.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.exec; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecDelPackItemBatch.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecDelPackItemBatch.java index 93f74c284..03e39725b 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecDelPackItemBatch.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecDelPackItemBatch.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.exec; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecGrantTrialAvatar.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecGrantTrialAvatar.java index f904609cf..0c59668d0 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecGrantTrialAvatar.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecGrantTrialAvatar.java @@ -1,7 +1,7 @@ package emu.grasscutter.game.quest.exec; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecIncQuestGlobalVar.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecIncQuestGlobalVar.java index c48eb5975..2d750f3d8 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecIncQuestGlobalVar.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecIncQuestGlobalVar.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.exec; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecIncQuestVar.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecIncQuestVar.java index 0f90d79a4..151b25d26 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecIncQuestVar.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecIncQuestVar.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.exec; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecInitTimeVar.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecInitTimeVar.java index 476ea4326..0a51d8221 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecInitTimeVar.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecInitTimeVar.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.exec; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecNotifyGroupLua.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecNotifyGroupLua.java index 1cdae83b6..bfae95b8c 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecNotifyGroupLua.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecNotifyGroupLua.java @@ -1,7 +1,7 @@ package emu.grasscutter.game.quest.exec; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecRefreshGroupMonster.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecRefreshGroupMonster.java index 92333b7a5..491a18b2c 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecRefreshGroupMonster.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecRefreshGroupMonster.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.exec; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecRefreshGroupSuite.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecRefreshGroupSuite.java index 69b20b45b..4b68a27b1 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecRefreshGroupSuite.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecRefreshGroupSuite.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.exec; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecRegisterDynamicGroup.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecRegisterDynamicGroup.java index 45deb21a5..2be843a3c 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecRegisterDynamicGroup.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecRegisterDynamicGroup.java @@ -1,7 +1,7 @@ package emu.grasscutter.game.quest.exec; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestGroupSuite; import emu.grasscutter.game.quest.QuestValueExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecRemoveTrialAvatar.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecRemoveTrialAvatar.java index 38f25ed6a..3df507251 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecRemoveTrialAvatar.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecRemoveTrialAvatar.java @@ -1,7 +1,7 @@ package emu.grasscutter.game.quest.exec; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecRollbackParentQuest.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecRollbackParentQuest.java index 11878ee72..986ada683 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecRollbackParentQuest.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecRollbackParentQuest.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.exec; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecRollbackQuest.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecRollbackQuest.java index 478453282..961ef6708 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecRollbackQuest.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecRollbackQuest.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.exec; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecSetFlyable.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecSetFlyable.java index 2dc436f7e..a745af8c4 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecSetFlyable.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecSetFlyable.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.exec; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.props.PlayerProperty; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecSetOpenState.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecSetOpenState.java index 314ee310c..283d595eb 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecSetOpenState.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecSetOpenState.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.exec; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecSetQuestGlobalVar.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecSetQuestGlobalVar.java index e4ae003ff..8446e0702 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecSetQuestGlobalVar.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecSetQuestGlobalVar.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.exec; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecSetQuestVar.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecSetQuestVar.java index 844d5ccda..4f22690c0 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecSetQuestVar.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecSetQuestVar.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.exec; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecUnlockArea.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecUnlockArea.java index ebfc038df..ccb3d7c4e 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecUnlockArea.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecUnlockArea.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.exec; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecUnlockPoint.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecUnlockPoint.java index da435d986..e88a3cb5a 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecUnlockPoint.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecUnlockPoint.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.exec; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecUnregisterDynamicGroup.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecUnregisterDynamicGroup.java index 19224b466..7bd5561f8 100644 --- a/src/main/java/emu/grasscutter/game/quest/exec/ExecUnregisterDynamicGroup.java +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecUnregisterDynamicGroup.java @@ -1,7 +1,7 @@ package emu.grasscutter.game.quest.exec; import emu.grasscutter.Grasscutter; -import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.data.excels.quest.QuestData; import emu.grasscutter.game.quest.GameQuest; import emu.grasscutter.game.quest.QuestValueExec; import emu.grasscutter.game.quest.enums.QuestExec; diff --git a/src/main/java/emu/grasscutter/game/quest/handlers/QuestBaseHandler.java b/src/main/java/emu/grasscutter/game/quest/handlers/QuestBaseHandler.java index 0f9fb00c7..102e0e37e 100644 --- a/src/main/java/emu/grasscutter/game/quest/handlers/QuestBaseHandler.java +++ b/src/main/java/emu/grasscutter/game/quest/handlers/QuestBaseHandler.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.quest.handlers; -import emu.grasscutter.data.excels.QuestData.QuestCondition; +import emu.grasscutter.data.excels.quest.QuestData.QuestCondition; import emu.grasscutter.game.quest.GameQuest; public abstract class QuestBaseHandler> { diff --git a/src/main/java/emu/grasscutter/game/quest/handlers/QuestExecHandler.java b/src/main/java/emu/grasscutter/game/quest/handlers/QuestExecHandler.java index dc927532e..075fe7c92 100644 --- a/src/main/java/emu/grasscutter/game/quest/handlers/QuestExecHandler.java +++ b/src/main/java/emu/grasscutter/game/quest/handlers/QuestExecHandler.java @@ -1,10 +1,10 @@ -package emu.grasscutter.game.quest.handlers; - -import emu.grasscutter.data.excels.QuestData; -import emu.grasscutter.game.quest.GameQuest; - -public abstract class QuestExecHandler { - - public abstract boolean execute( - GameQuest quest, QuestData.QuestExecParam condition, String... paramStr); -} +package emu.grasscutter.game.quest.handlers; + +import emu.grasscutter.data.excels.quest.QuestData; +import emu.grasscutter.game.quest.GameQuest; + +public abstract class QuestExecHandler { + + public abstract boolean execute( + GameQuest quest, QuestData.QuestExecParam condition, String... paramStr); +} diff --git a/src/main/java/emu/grasscutter/game/talk/TalkExec.java b/src/main/java/emu/grasscutter/game/talk/TalkExec.java new file mode 100644 index 000000000..d73c5dc1c --- /dev/null +++ b/src/main/java/emu/grasscutter/game/talk/TalkExec.java @@ -0,0 +1,63 @@ +package emu.grasscutter.game.talk; + +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.util.HashMap; +import java.util.Map; +import java.util.stream.Stream; + +@AllArgsConstructor +public enum TalkExec { + TALK_EXEC_NONE(0), + TALK_EXEC_SET_GADGET_STATE(1), + TALK_EXEC_SET_GAME_TIME(2), + TALK_EXEC_NOTIFY_GROUP_LUA(3), + TALK_EXEC_SET_DAILY_TASK_VAR(4), + TALK_EXEC_INC_DAILY_TASK_VAR(5), + TALK_EXEC_DEC_DAILY_TASK_VAR(6), + TALK_EXEC_SET_QUEST_VAR(7), + TALK_EXEC_INC_QUEST_VAR(8), + TALK_EXEC_DEC_QUEST_VAR(9), + TALK_EXEC_SET_QUEST_GLOBAL_VAR(10), + TALK_EXEC_INC_QUEST_GLOBAL_VAR(11), + TALK_EXEC_DEC_QUEST_GLOBAL_VAR(12), + TALK_EXEC_TRANS_SCENE_DUMMY_POINT(13), + TALK_EXEC_SAVE_TALK_ID(14); + + private static final Int2ObjectMap execMap = new Int2ObjectOpenHashMap<>(); + private static final Map execStringMap = new HashMap<>(); + + static { + Stream.of(TalkExec.values()) + .filter(e -> e.name().startsWith("TALK_EXEC_")) + .forEach(entry -> { + execMap.put(entry.getValue(), entry); + execStringMap.put(entry.name(), entry); + }); + } + + /** + * Gets the talk execution condition by its value. + * + * @param value The integer value of the condition. + * @return The corresponding enum value. + */ + public static TalkExec getExecByValue(int value) { + return execMap.getOrDefault(value, TALK_EXEC_NONE); + } + + /** + * Gets the talk execution by its name. + * + * @param name The string name of the condition. + * @return The corresponding enum value. + */ + public static TalkExec getExecByName(String name) { + return execStringMap.getOrDefault(name, TALK_EXEC_NONE); + } + + @Getter private final int value; +} diff --git a/src/main/java/emu/grasscutter/game/talk/TalkExecHandler.java b/src/main/java/emu/grasscutter/game/talk/TalkExecHandler.java new file mode 100644 index 000000000..ab1fcb895 --- /dev/null +++ b/src/main/java/emu/grasscutter/game/talk/TalkExecHandler.java @@ -0,0 +1,14 @@ +package emu.grasscutter.game.talk; + +import emu.grasscutter.data.excels.TalkConfigData; +import emu.grasscutter.data.excels.TalkConfigData.TalkExecParam; +import emu.grasscutter.game.player.Player; + +public abstract class TalkExecHandler { + /** + * @param player The player who is talking. + * @param talkData The data associated with the talk. + * @param execParam The execution parameter for the talk. + */ + public abstract void execute(Player player, TalkConfigData talkData, TalkExecParam execParam); +} diff --git a/src/main/java/emu/grasscutter/game/talk/TalkManager.java b/src/main/java/emu/grasscutter/game/talk/TalkManager.java new file mode 100644 index 000000000..16a0a2c28 --- /dev/null +++ b/src/main/java/emu/grasscutter/game/talk/TalkManager.java @@ -0,0 +1,52 @@ +package emu.grasscutter.game.talk; + +import emu.grasscutter.data.GameData; +import emu.grasscutter.data.binout.MainQuestData.TalkData; +import emu.grasscutter.game.player.BasePlayerManager; +import emu.grasscutter.game.player.Player; + +import lombok.NonNull; + +import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_COMPLETE_ANY_TALK; +import static emu.grasscutter.game.quest.enums.QuestContent.QUEST_CONTENT_COMPLETE_TALK; +import static emu.grasscutter.game.quest.enums.QuestCond.QUEST_COND_COMPLETE_TALK; + +public final class TalkManager extends BasePlayerManager { + public TalkManager(@NonNull Player player) { + super(player); + } + + /** + * Invoked when a talk is triggered. + * + * @param talkId The ID of the talk. + */ + public void triggerTalkAction(int talkId) { + var talkData = GameData.getTalkConfigDataMap().get(talkId); + if (talkData == null || talkData.getFinishExec().isEmpty()) return; + + var player = this.getPlayer(); + // Execute the talk action on associated handlers. + talkData.getFinishExec().forEach(e -> this.getPlayer().getServer() + .getTalkSystem().triggerExec(getPlayer(), talkData, e)); + + // Invoke the talking events for quests. + var questManager = player.getQuestManager(); + questManager.queueEvent(QUEST_CONTENT_COMPLETE_ANY_TALK, talkId); + questManager.queueEvent(QUEST_CONTENT_COMPLETE_TALK, talkId); + questManager.queueEvent(QUEST_COND_COMPLETE_TALK, talkId); + + // Save the talk value to the quest's data. + this.saveTalkToQuest(talkId, talkData.getQuestId()); + } + + public void saveTalkToQuest(int talkId, int mainQuestId) { + // TODO, problem with this is that some talks for activity also have + // quest id, which isn't present in QuestExcels + var mainQuest = this.getPlayer().getQuestManager() + .getMainQuestById(mainQuestId); + if (mainQuest == null) return; + + mainQuest.getTalks().put(talkId, new TalkData(talkId, "")); + } +} diff --git a/src/main/java/emu/grasscutter/game/talk/TalkSystem.java b/src/main/java/emu/grasscutter/game/talk/TalkSystem.java new file mode 100644 index 000000000..3d8ed685f --- /dev/null +++ b/src/main/java/emu/grasscutter/game/talk/TalkSystem.java @@ -0,0 +1,81 @@ +package emu.grasscutter.game.talk; + +import emu.grasscutter.Grasscutter; +import emu.grasscutter.data.excels.TalkConfigData; +import emu.grasscutter.data.excels.TalkConfigData.TalkExecParam; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.server.game.BaseGameSystem; +import emu.grasscutter.server.game.GameServer; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import org.reflections.Reflections; + +public final class TalkSystem extends BaseGameSystem { + private final Int2ObjectMap execHandlers + = new Int2ObjectOpenHashMap<>(); + + public TalkSystem(GameServer server) { + super(server); + + this.registerHandlers(this.execHandlers, + "emu.grasscutter.game.talk.exec", + TalkExecHandler.class); + } + + /** + * Registers all handlers with the required conditions. + * + * @param map The map to save handlers to. + * @param packageName The full package domain. + * @param clazz The class which handlers should derive from. + */ + public void registerHandlers(Int2ObjectMap map, String packageName, Class clazz) { + var reflections = new Reflections(packageName); + var handlerClasses = reflections.getSubTypesOf(clazz); + + for (var obj : handlerClasses) { + this.registerTalkHandler(map, obj); + } + } + + /** + * Registers the talk handler of the specified class. + * + * @param map The map to save the handler to. + * @param handlerClass The class of the handler. + */ + public void registerTalkHandler(Int2ObjectMap map, Class handlerClass) { + try { + var value = 0; if (handlerClass.isAnnotationPresent(TalkValueExec.class)) { + TalkValueExec opcode = handlerClass.getAnnotation(TalkValueExec.class); + value = opcode.value().getValue(); + } else { + return; + } + + if (value <= 0) return; + map.put(value, handlerClass.getDeclaredConstructor().newInstance()); + } catch (Exception exception) { + Grasscutter.getLogger().debug("Unable to register talk handler.", exception); + } + } + + /** + * Notifies the associated handler of a talk being triggered. + * + * @param player The player which triggered the talk. + * @param talkData The data associated with the talk. + * @param execParam The talk parameter. + */ + public void triggerExec(Player player, TalkConfigData talkData, TalkExecParam execParam) { + var handler = this.execHandlers.get(execParam.getType().getValue()); + if (handler == null) { + Grasscutter.getLogger().debug("Could not execute talk handlers for {} ({}).", + talkData.getId(), execParam.getType().getValue()); + return; + } + + // Execute the handler. + handler.execute(player, talkData, execParam); + } +} diff --git a/src/main/java/emu/grasscutter/game/talk/TalkValueExec.java b/src/main/java/emu/grasscutter/game/talk/TalkValueExec.java new file mode 100644 index 000000000..227ff9841 --- /dev/null +++ b/src/main/java/emu/grasscutter/game/talk/TalkValueExec.java @@ -0,0 +1,9 @@ +package emu.grasscutter.game.talk; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +public @interface TalkValueExec { + TalkExec value(); +} diff --git a/src/main/java/emu/grasscutter/server/game/GameServer.java b/src/main/java/emu/grasscutter/server/game/GameServer.java index 7870aeee7..266a3d515 100644 --- a/src/main/java/emu/grasscutter/server/game/GameServer.java +++ b/src/main/java/emu/grasscutter/server/game/GameServer.java @@ -26,6 +26,7 @@ import emu.grasscutter.game.shop.ShopSystem; import emu.grasscutter.game.systems.AnnouncementSystem; import emu.grasscutter.game.systems.InventorySystem; import emu.grasscutter.game.systems.MultiplayerSystem; +import emu.grasscutter.game.talk.TalkSystem; import emu.grasscutter.game.tower.TowerSystem; import emu.grasscutter.game.world.World; import emu.grasscutter.game.world.WorldDataSystem; @@ -69,6 +70,7 @@ public final class GameServer extends KcpServer { private final TowerSystem towerSystem; private final AnnouncementSystem announcementSystem; private final QuestSystem questSystem; + private final TalkSystem talkSystem; // Extra private final ServerTaskScheduler scheduler; @@ -123,6 +125,7 @@ public final class GameServer extends KcpServer { this.battlePassSystem = new BattlePassSystem(this); this.announcementSystem = new AnnouncementSystem(this); this.questSystem = new QuestSystem(this); + this.talkSystem = new TalkSystem(this); // Chata manager this.chatManager = new ChatSystem(this); diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerNpcTalkReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerNpcTalkReq.java index c5c02289f..0a62d9b4b 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerNpcTalkReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerNpcTalkReq.java @@ -16,40 +16,9 @@ import emu.grasscutter.server.packet.send.PacketNpcTalkRsp; public class HandlerNpcTalkReq extends PacketHandler { @Override public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { - NpcTalkReq req = NpcTalkReq.parseFrom(payload); - - // Check if mainQuest exists - // remove last 2 digits to get a mainQuestId - int talkId = req.getTalkId(); - int mainQuestId = GameData.getQuestTalkMap().getOrDefault(talkId, talkId / 100); - MainQuestData mainQuestData = GameData.getMainQuestDataMap().get(mainQuestId); - - if (mainQuestData != null) { - // This talk is associated with a quest. Handle it. - // If the quest has no talk data defined on it, create one. - TalkData talkForQuest = new TalkData(talkId, ""); - if (mainQuestData.getTalks() != null) { - var talks = mainQuestData.getTalks().stream().filter(p -> p.getId() == talkId).toList(); - - if (talks.size() > 0) { - talkForQuest = talks.get(0); - } - } - - // Add to the list of done talks for this quest. - var questManager = session.getPlayer().getQuestManager(); - var mainQuest = questManager.getMainQuestByTalkId(talkId); - if (mainQuest != null) { - mainQuest.getTalks().put(talkId, talkForQuest); - } - - // Fire quest triggers. - questManager.queueEvent(QuestContent.QUEST_CONTENT_COMPLETE_ANY_TALK, talkId, 0, 0); - questManager.queueEvent(QuestContent.QUEST_CONTENT_COMPLETE_TALK, talkId, 0); - questManager.queueEvent(QuestContent.QUEST_CONTENT_FINISH_PLOT, talkId, 0); - questManager.queueEvent(QuestCond.QUEST_COND_COMPLETE_TALK, talkId, 0); - } + var req = NpcTalkReq.parseFrom(payload); + session.getPlayer().getTalkManager().triggerTalkAction(req.getTalkId()); session.send(new PacketNpcTalkRsp(req.getNpcEntityId(), req.getTalkId(), req.getEntityId())); } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerQuestUpdateQuestVarReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerQuestUpdateQuestVarReq.java index d37649032..866a71db9 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerQuestUpdateQuestVarReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerQuestUpdateQuestVarReq.java @@ -35,27 +35,20 @@ public class HandlerQuestUpdateQuestVarReq extends PacketHandler { req.getParentQuestId()); return; } - List questVars = req.getQuestVarOpListList(); - var questVarUpdate = mainQuest.getQuestVarsUpdate(); - if (questVarUpdate.size() == 0) { - for (var questVar : questVars) { - questVarUpdate.add(questVar.getValue()); - } - } else { - for (QuestVarOp questVar : questVars) { - if (questVar.getIsAdd()) { - if (questVar.getValue() >= 0) { - mainQuest.incQuestVar(questVar.getIndex(), questVar.getValue()); - } else { - mainQuest.decQuestVar(questVar.getIndex(), questVar.getValue()); - } + + for (var questVar : req.getQuestVarOpListList()) { + var value = questVar.getValue(); + if (questVar.getIsAdd()) { + if (value >= 0) { + mainQuest.incQuestVar(questVar.getIndex(), value); } else { - mainQuest.setQuestVar(questVar.getIndex(), questVarUpdate.get(0)); + mainQuest.decQuestVar(questVar.getIndex(), value); } - // remove the first element from the update list - questVarUpdate.remove(0); + } else { + mainQuest.setQuestVar(questVar.getIndex(), value); } } + session.send(new PacketQuestUpdateQuestVarRsp(req)); } } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketQuestGlobalVarNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketQuestGlobalVarNotify.java new file mode 100644 index 000000000..79584707e --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketQuestGlobalVarNotify.java @@ -0,0 +1,23 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.game.player.Player; +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.QuestGlobalVarNotifyOuterClass.QuestGlobalVarNotify; +import emu.grasscutter.net.proto.QuestGlobalVarOuterClass.QuestGlobalVar; + + +public final class PacketQuestGlobalVarNotify extends BasePacket { + public PacketQuestGlobalVarNotify(Player player) { + super(PacketOpcodes.QuestGlobalVarNotify); + + this.setData(QuestGlobalVarNotify.newBuilder() + .addAllVarList(player.getQuestGlobalVariables().entrySet().stream() + .map(entry -> QuestGlobalVar.newBuilder() + .setKey(entry.getKey()) + .setValue(entry.getValue()) + .build()) + .toList()) + .build()); + } +} diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketQuestUpdateQuestVarNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketQuestUpdateQuestVarNotify.java new file mode 100644 index 000000000..0d8c6b353 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketQuestUpdateQuestVarNotify.java @@ -0,0 +1,19 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.QuestUpdateQuestVarNotifyOuterClass.QuestUpdateQuestVarNotify; + +import java.util.stream.IntStream; + +public class PacketQuestUpdateQuestVarNotify extends BasePacket { + public PacketQuestUpdateQuestVarNotify(int mainQuestId, int... questVars) { + super(PacketOpcodes.QuestUpdateQuestVarNotify); + + this.setData(QuestUpdateQuestVarNotify.newBuilder() + .setParentQuestId(mainQuestId) + .addAllQuestVar(IntStream.of(questVars) + .boxed().toList()) + .build()); + } +}