mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-29 12:02:45 +00:00
Switch to using quest excels
This commit is contained in:
parent
9b26426e8a
commit
631a53030c
@ -12,7 +12,7 @@ import emu.grasscutter.data.custom.AbilityEmbryoEntry;
|
|||||||
import emu.grasscutter.data.custom.AbilityModifier;
|
import emu.grasscutter.data.custom.AbilityModifier;
|
||||||
import emu.grasscutter.data.custom.AbilityModifierEntry;
|
import emu.grasscutter.data.custom.AbilityModifierEntry;
|
||||||
import emu.grasscutter.data.custom.OpenConfigEntry;
|
import emu.grasscutter.data.custom.OpenConfigEntry;
|
||||||
import emu.grasscutter.data.custom.QuestConfig;
|
import emu.grasscutter.data.custom.MainQuestData;
|
||||||
import emu.grasscutter.data.custom.ScenePointEntry;
|
import emu.grasscutter.data.custom.ScenePointEntry;
|
||||||
import emu.grasscutter.data.def.*;
|
import emu.grasscutter.data.def.*;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectLinkedOpenHashMap;
|
||||||
@ -28,7 +28,7 @@ public class GameData {
|
|||||||
private static final Map<String, AbilityModifierEntry> abilityModifiers = new HashMap<>();
|
private static final Map<String, AbilityModifierEntry> abilityModifiers = new HashMap<>();
|
||||||
private static final Map<String, OpenConfigEntry> openConfigEntries = new HashMap<>();
|
private static final Map<String, OpenConfigEntry> openConfigEntries = new HashMap<>();
|
||||||
private static final Map<String, ScenePointEntry> scenePointEntries = new HashMap<>();
|
private static final Map<String, ScenePointEntry> scenePointEntries = new HashMap<>();
|
||||||
private static final Int2ObjectMap<QuestConfig> questConfigs = new Int2ObjectOpenHashMap<>();
|
private static final Int2ObjectMap<MainQuestData> mainQuestData = new Int2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
// ExcelConfigs
|
// ExcelConfigs
|
||||||
private static final Int2ObjectMap<PlayerLevelData> playerLevelDataMap = new Int2ObjectOpenHashMap<>();
|
private static final Int2ObjectMap<PlayerLevelData> playerLevelDataMap = new Int2ObjectOpenHashMap<>();
|
||||||
@ -70,6 +70,7 @@ public class GameData {
|
|||||||
private static final Int2ObjectMap<WorldLevelData> worldLevelDataMap = new Int2ObjectOpenHashMap<>();
|
private static final Int2ObjectMap<WorldLevelData> worldLevelDataMap = new Int2ObjectOpenHashMap<>();
|
||||||
private static final Int2ObjectMap<DailyDungeonData> dailyDungeonDataMap = new Int2ObjectOpenHashMap<>();
|
private static final Int2ObjectMap<DailyDungeonData> dailyDungeonDataMap = new Int2ObjectOpenHashMap<>();
|
||||||
private static final Int2ObjectMap<DungeonData> dungeonDataMap = new Int2ObjectOpenHashMap<>();
|
private static final Int2ObjectMap<DungeonData> dungeonDataMap = new Int2ObjectOpenHashMap<>();
|
||||||
|
private static final Int2ObjectMap<QuestData> questDataMap = new Int2ObjectOpenHashMap<>();
|
||||||
private static final Int2ObjectMap<ShopGoodsData> shopGoodsDataMap = new Int2ObjectOpenHashMap<>();
|
private static final Int2ObjectMap<ShopGoodsData> shopGoodsDataMap = new Int2ObjectOpenHashMap<>();
|
||||||
private static final Int2ObjectMap<CombineData> combineDataMap = new Int2ObjectOpenHashMap<>();
|
private static final Int2ObjectMap<CombineData> combineDataMap = new Int2ObjectOpenHashMap<>();
|
||||||
private static final Int2ObjectMap<RewardPreviewData> rewardPreviewDataMap = new Int2ObjectOpenHashMap<>();
|
private static final Int2ObjectMap<RewardPreviewData> rewardPreviewDataMap = new Int2ObjectOpenHashMap<>();
|
||||||
@ -124,8 +125,8 @@ public class GameData {
|
|||||||
return getScenePointEntries().get(sceneId + "_" + pointId);
|
return getScenePointEntries().get(sceneId + "_" + pointId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Int2ObjectMap<QuestConfig> getQuestConfigs() {
|
public static Int2ObjectMap<MainQuestData> getMainQuestDataMap() {
|
||||||
return questConfigs;
|
return mainQuestData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Int2ObjectMap<AvatarData> getAvatarDataMap() {
|
public static Int2ObjectMap<AvatarData> getAvatarDataMap() {
|
||||||
@ -337,4 +338,8 @@ public class GameData {
|
|||||||
public static Int2ObjectMap<TowerScheduleData> getTowerScheduleDataMap(){
|
public static Int2ObjectMap<TowerScheduleData> getTowerScheduleDataMap(){
|
||||||
return towerScheduleDataMap;
|
return towerScheduleDataMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Int2ObjectMap<QuestData> getQuestDataMap() {
|
||||||
|
return questDataMap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,7 @@ import emu.grasscutter.data.custom.AbilityModifier.AbilityModifierAction;
|
|||||||
import emu.grasscutter.data.custom.AbilityModifier.AbilityModifierActionType;
|
import emu.grasscutter.data.custom.AbilityModifier.AbilityModifierActionType;
|
||||||
import emu.grasscutter.data.custom.AbilityModifierEntry;
|
import emu.grasscutter.data.custom.AbilityModifierEntry;
|
||||||
import emu.grasscutter.data.custom.OpenConfigEntry;
|
import emu.grasscutter.data.custom.OpenConfigEntry;
|
||||||
import emu.grasscutter.data.custom.QuestConfig;
|
import emu.grasscutter.data.custom.MainQuestData;
|
||||||
import emu.grasscutter.data.custom.QuestConfigData;
|
|
||||||
import emu.grasscutter.data.custom.QuestConfigData.SubQuestConfigData;
|
|
||||||
import emu.grasscutter.data.custom.ScenePointEntry;
|
import emu.grasscutter.data.custom.ScenePointEntry;
|
||||||
import emu.grasscutter.game.world.SpawnDataEntry.*;
|
import emu.grasscutter.game.world.SpawnDataEntry.*;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
@ -407,24 +405,19 @@ public class ResourceLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (File file : folder.listFiles()) {
|
for (File file : folder.listFiles()) {
|
||||||
QuestConfigData mainQuest = null;
|
MainQuestData mainQuest = null;
|
||||||
|
|
||||||
try (FileReader fileReader = new FileReader(file)) {
|
try (FileReader fileReader = new FileReader(file)) {
|
||||||
mainQuest = Grasscutter.getGsonFactory().fromJson(fileReader, QuestConfigData.class);
|
mainQuest = Grasscutter.getGsonFactory().fromJson(fileReader, MainQuestData.class);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mainQuest.getSubQuests() != null) {
|
GameData.getMainQuestDataMap().put(mainQuest.getId(), mainQuest);
|
||||||
for (SubQuestConfigData subQuest : mainQuest.getSubQuests()) {
|
|
||||||
QuestConfig quest = new QuestConfig(mainQuest, subQuest);
|
|
||||||
GameData.getQuestConfigs().put(quest.getId(), quest);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Grasscutter.getLogger().info("Loaded " + GameData.getQuestConfigs().size() + " Quest Configs");
|
Grasscutter.getLogger().info("Loaded " + GameData.getMainQuestDataMap().size() + " MainQuestDatas.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// BinOutput configs
|
// BinOutput configs
|
||||||
|
53
src/main/java/emu/grasscutter/data/custom/MainQuestData.java
Normal file
53
src/main/java/emu/grasscutter/data/custom/MainQuestData.java
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
package emu.grasscutter.data.custom;
|
||||||
|
|
||||||
|
import emu.grasscutter.game.quest.enums.LogicType;
|
||||||
|
import emu.grasscutter.game.quest.enums.QuestTrigger;
|
||||||
|
import emu.grasscutter.game.quest.enums.QuestType;
|
||||||
|
|
||||||
|
public class MainQuestData {
|
||||||
|
private int id;
|
||||||
|
private int series;
|
||||||
|
private QuestType type;
|
||||||
|
|
||||||
|
private long titleTextMapHash;
|
||||||
|
private int[] suggestTrackMainQuestList;
|
||||||
|
private int[] rewardIdList;
|
||||||
|
|
||||||
|
private SubQuestData[] subQuests;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSeries() {
|
||||||
|
return series;
|
||||||
|
}
|
||||||
|
|
||||||
|
public QuestType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTitleTextMapHash() {
|
||||||
|
return titleTextMapHash;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getSuggestTrackMainQuestList() {
|
||||||
|
return suggestTrackMainQuestList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getRewardIdList() {
|
||||||
|
return rewardIdList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SubQuestData[] getSubQuests() {
|
||||||
|
return subQuests;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SubQuestData {
|
||||||
|
private int subId;
|
||||||
|
|
||||||
|
public int getSubId() {
|
||||||
|
return subId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,25 +0,0 @@
|
|||||||
package emu.grasscutter.data.custom;
|
|
||||||
|
|
||||||
import emu.grasscutter.data.custom.QuestConfigData.SubQuestConfigData;
|
|
||||||
|
|
||||||
public class QuestConfig {
|
|
||||||
private final QuestConfigData mainQuest;
|
|
||||||
private final SubQuestConfigData subQuest;
|
|
||||||
|
|
||||||
public QuestConfig(QuestConfigData mainQuest, SubQuestConfigData subQuest) {
|
|
||||||
this.mainQuest = mainQuest;
|
|
||||||
this.subQuest = subQuest;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return subQuest.getSubId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public QuestConfigData getMainQuest() {
|
|
||||||
return mainQuest;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SubQuestConfigData getSubQuest() {
|
|
||||||
return subQuest;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,104 +0,0 @@
|
|||||||
package emu.grasscutter.data.custom;
|
|
||||||
|
|
||||||
import emu.grasscutter.game.quest.enums.LogicType;
|
|
||||||
import emu.grasscutter.game.quest.enums.QuestTriggerType;
|
|
||||||
import emu.grasscutter.game.quest.enums.QuestType;
|
|
||||||
|
|
||||||
public class QuestConfigData {
|
|
||||||
private int id;
|
|
||||||
private int series;
|
|
||||||
private QuestType type;
|
|
||||||
|
|
||||||
private long titleTextMapHash;
|
|
||||||
private int[] suggestTrackMainQuestList;
|
|
||||||
private int[] rewardIdList;
|
|
||||||
|
|
||||||
private SubQuestConfigData[] subQuests;
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSeries() {
|
|
||||||
return series;
|
|
||||||
}
|
|
||||||
|
|
||||||
public QuestType getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getTitleTextMapHash() {
|
|
||||||
return titleTextMapHash;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[] getSuggestTrackMainQuestList() {
|
|
||||||
return suggestTrackMainQuestList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[] getRewardIdList() {
|
|
||||||
return rewardIdList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SubQuestConfigData[] getSubQuests() {
|
|
||||||
return subQuests;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class SubQuestConfigData {
|
|
||||||
private int subId;
|
|
||||||
private int mainId;
|
|
||||||
|
|
||||||
private LogicType acceptCondComb;
|
|
||||||
private QuestCondition[] acceptCond;
|
|
||||||
|
|
||||||
private LogicType finishCondComb;
|
|
||||||
private QuestCondition[] finishCond;
|
|
||||||
|
|
||||||
private LogicType failCondComb;
|
|
||||||
private QuestCondition[] failCond;
|
|
||||||
|
|
||||||
public int getSubId() {
|
|
||||||
return subId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMainId() {
|
|
||||||
return mainId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LogicType getAcceptCondComb() {
|
|
||||||
return acceptCondComb;
|
|
||||||
}
|
|
||||||
|
|
||||||
public QuestCondition[] getAcceptCond() {
|
|
||||||
return acceptCond;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LogicType getFinishCondComb() {
|
|
||||||
return finishCondComb;
|
|
||||||
}
|
|
||||||
|
|
||||||
public QuestCondition[] getFinishCond() {
|
|
||||||
return finishCond;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LogicType getFailCondComb() {
|
|
||||||
return failCondComb;
|
|
||||||
}
|
|
||||||
|
|
||||||
public QuestCondition[] getFailCond() {
|
|
||||||
return failCond;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class QuestCondition {
|
|
||||||
private QuestTriggerType type;
|
|
||||||
private int[] param;
|
|
||||||
|
|
||||||
public QuestTriggerType getType() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int[] getParam() {
|
|
||||||
return param;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
115
src/main/java/emu/grasscutter/data/def/QuestData.java
Normal file
115
src/main/java/emu/grasscutter/data/def/QuestData.java
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
package emu.grasscutter.data.def;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import emu.grasscutter.data.GameResource;
|
||||||
|
import emu.grasscutter.data.ResourceType;
|
||||||
|
import emu.grasscutter.game.quest.enums.LogicType;
|
||||||
|
import emu.grasscutter.game.quest.enums.QuestTrigger;
|
||||||
|
|
||||||
|
@ResourceType(name = "QuestExcelConfigData.json")
|
||||||
|
public class QuestData extends GameResource {
|
||||||
|
private int SubId;
|
||||||
|
private int MainId;
|
||||||
|
private int Order;
|
||||||
|
private long DescTextMapHash;
|
||||||
|
|
||||||
|
private LogicType AcceptCondComb;
|
||||||
|
private QuestCondition[] acceptConditons;
|
||||||
|
private LogicType FinishCondComb;
|
||||||
|
private QuestCondition[] finishConditons;
|
||||||
|
private LogicType FailCondComb;
|
||||||
|
private QuestCondition[] failConditons;
|
||||||
|
|
||||||
|
private List<QuestParam> AcceptCond;
|
||||||
|
private List<QuestParam> FinishCond;
|
||||||
|
private List<QuestParam> FailCond;
|
||||||
|
private List<QuestExecParam> BeginExec;
|
||||||
|
private List<QuestExecParam> FinishExec;
|
||||||
|
private List<QuestExecParam> FailExec;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return SubId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMainId() {
|
||||||
|
return MainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOrder() {
|
||||||
|
return Order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getDescTextMapHash() {
|
||||||
|
return DescTextMapHash;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LogicType getAcceptCondComb() {
|
||||||
|
return AcceptCondComb;
|
||||||
|
}
|
||||||
|
|
||||||
|
public QuestCondition[] getAcceptCond() {
|
||||||
|
return acceptConditons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LogicType getFinishCondComb() {
|
||||||
|
return FinishCondComb;
|
||||||
|
}
|
||||||
|
|
||||||
|
public QuestCondition[] getFinishCond() {
|
||||||
|
return finishConditons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LogicType getFailCondComb() {
|
||||||
|
return FailCondComb;
|
||||||
|
}
|
||||||
|
|
||||||
|
public QuestCondition[] getFailCond() {
|
||||||
|
return failConditons;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onLoad() {
|
||||||
|
this.acceptConditons = AcceptCond.stream().filter(p -> p.Type != null).map(QuestCondition::new).toArray(QuestCondition[]::new);
|
||||||
|
AcceptCond = null;
|
||||||
|
this.finishConditons = FinishCond.stream().filter(p -> p.Type != null).map(QuestCondition::new).toArray(QuestCondition[]::new);
|
||||||
|
FinishCond = null;
|
||||||
|
this.failConditons = FailCond.stream().filter(p -> p.Type != null).map(QuestCondition::new).toArray(QuestCondition[]::new);
|
||||||
|
FailCond = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class QuestParam {
|
||||||
|
QuestTrigger Type;
|
||||||
|
int[] Param;
|
||||||
|
String count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class QuestExecParam {
|
||||||
|
QuestTrigger Type;
|
||||||
|
String[] Param;
|
||||||
|
String count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class QuestCondition {
|
||||||
|
private QuestTrigger type;
|
||||||
|
private int[] param;
|
||||||
|
private String count;
|
||||||
|
|
||||||
|
public QuestCondition(QuestParam param) {
|
||||||
|
this.type = param.Type;
|
||||||
|
this.param = param.Param;
|
||||||
|
}
|
||||||
|
|
||||||
|
public QuestTrigger getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getParam() {
|
||||||
|
return param;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCount() {
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -10,7 +10,6 @@ import dev.morphia.annotations.Id;
|
|||||||
import dev.morphia.annotations.Indexed;
|
import dev.morphia.annotations.Indexed;
|
||||||
import dev.morphia.annotations.Transient;
|
import dev.morphia.annotations.Transient;
|
||||||
import emu.grasscutter.data.GameData;
|
import emu.grasscutter.data.GameData;
|
||||||
import emu.grasscutter.data.custom.QuestConfig;
|
|
||||||
import emu.grasscutter.database.DatabaseHelper;
|
import emu.grasscutter.database.DatabaseHelper;
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
import emu.grasscutter.game.quest.enums.ParentQuestState;
|
import emu.grasscutter.game.quest.enums.ParentQuestState;
|
||||||
|
@ -2,9 +2,11 @@ package emu.grasscutter.game.quest;
|
|||||||
|
|
||||||
import dev.morphia.annotations.Entity;
|
import dev.morphia.annotations.Entity;
|
||||||
import dev.morphia.annotations.Transient;
|
import dev.morphia.annotations.Transient;
|
||||||
import emu.grasscutter.data.custom.QuestConfig;
|
import emu.grasscutter.data.GameData;
|
||||||
import emu.grasscutter.data.custom.QuestConfigData.QuestCondition;
|
import emu.grasscutter.data.custom.MainQuestData;
|
||||||
import emu.grasscutter.data.custom.QuestConfigData.SubQuestConfigData;
|
import emu.grasscutter.data.custom.MainQuestData.SubQuestData;
|
||||||
|
import emu.grasscutter.data.def.QuestData;
|
||||||
|
import emu.grasscutter.data.def.QuestData.QuestCondition;
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
import emu.grasscutter.game.quest.enums.LogicType;
|
import emu.grasscutter.game.quest.enums.LogicType;
|
||||||
import emu.grasscutter.game.quest.enums.QuestState;
|
import emu.grasscutter.game.quest.enums.QuestState;
|
||||||
@ -16,7 +18,7 @@ import emu.grasscutter.utils.Utils;
|
|||||||
@Entity
|
@Entity
|
||||||
public class GameQuest {
|
public class GameQuest {
|
||||||
@Transient private GameMainQuest mainQuest;
|
@Transient private GameMainQuest mainQuest;
|
||||||
@Transient private QuestConfig config;
|
@Transient private QuestData questData;
|
||||||
|
|
||||||
private int questId;
|
private int questId;
|
||||||
private int mainQuestId;
|
private int mainQuestId;
|
||||||
@ -32,21 +34,21 @@ public class GameQuest {
|
|||||||
@Deprecated // Morphia only. Do not use.
|
@Deprecated // Morphia only. Do not use.
|
||||||
public GameQuest() {}
|
public GameQuest() {}
|
||||||
|
|
||||||
public GameQuest(GameMainQuest mainQuest, QuestConfig config) {
|
public GameQuest(GameMainQuest mainQuest, QuestData questData) {
|
||||||
this.mainQuest = mainQuest;
|
this.mainQuest = mainQuest;
|
||||||
this.questId = config.getId();
|
this.questId = questData.getId();
|
||||||
this.mainQuestId = config.getMainQuest().getId();
|
this.mainQuestId = questData.getMainId();
|
||||||
this.config = config;
|
this.questData = questData;
|
||||||
this.acceptTime = Utils.getCurrentSeconds();
|
this.acceptTime = Utils.getCurrentSeconds();
|
||||||
this.startTime = this.acceptTime;
|
this.startTime = this.acceptTime;
|
||||||
this.state = QuestState.QUEST_STATE_UNFINISHED;
|
this.state = QuestState.QUEST_STATE_UNFINISHED;
|
||||||
|
|
||||||
if (config.getSubQuest().getFinishCond() != null) {
|
if (questData.getFinishCond()!= null) {
|
||||||
this.finishProgressList = new int[config.getSubQuest().getFinishCond().length];
|
this.finishProgressList = new int[questData.getFinishCond().length];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.getSubQuest().getFailCond() != null) {
|
if (questData.getFailCond() != null) {
|
||||||
this.failProgressList = new int[config.getSubQuest().getFailCond().length];
|
this.failProgressList = new int[questData.getFailCond().length];
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mainQuest.getChildQuests().put(this.questId, this);
|
this.mainQuest.getChildQuests().put(this.questId, this);
|
||||||
@ -72,13 +74,13 @@ public class GameQuest {
|
|||||||
return mainQuestId;
|
return mainQuestId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public QuestConfig getConfig() {
|
public QuestData getData() {
|
||||||
return config;
|
return questData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConfig(QuestConfig config) {
|
public void setConfig(QuestData config) {
|
||||||
if (this.getQuestId() != config.getId()) return;
|
if (this.getQuestId() != config.getId()) return;
|
||||||
this.config = config;
|
this.questData = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public QuestState getState() {
|
public QuestState getState() {
|
||||||
@ -148,16 +150,23 @@ public class GameQuest {
|
|||||||
|
|
||||||
public boolean tryAcceptQuestLine() {
|
public boolean tryAcceptQuestLine() {
|
||||||
try {
|
try {
|
||||||
for (SubQuestConfigData questData : getConfig().getMainQuest().getSubQuests()) {
|
MainQuestData questConfig = GameData.getMainQuestDataMap().get(this.getMainQuestId());
|
||||||
GameQuest quest = getMainQuest().getChildQuestById(questData.getSubId());
|
for (SubQuestData subQuest : questConfig.getSubQuests()) {
|
||||||
|
GameQuest quest = getMainQuest().getChildQuestById(subQuest.getSubId());
|
||||||
|
|
||||||
if (quest == null) {
|
if (quest == null) {
|
||||||
|
QuestData questData = GameData.getQuestDataMap().get(subQuest.getSubId());
|
||||||
|
|
||||||
|
if (questData == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
int[] accept = new int[questData.getAcceptCond().length];
|
int[] accept = new int[questData.getAcceptCond().length];
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
for (int i = 0; i < questData.getAcceptCond().length; i++) {
|
for (int i = 0; i < questData.getAcceptCond().length; i++) {
|
||||||
QuestCondition condition = questData.getAcceptCond()[i];
|
QuestCondition condition = questData.getAcceptCond()[i];
|
||||||
boolean result = getOwner().getServer().getQuestHandler().triggerCondition(this, condition);
|
boolean result = getOwner().getServer().getQuestHandler().triggerCondition(this, condition, condition.getParam());
|
||||||
|
|
||||||
accept[i] = result ? 1 : 0;
|
accept[i] = result ? 1 : 0;
|
||||||
}
|
}
|
||||||
@ -165,7 +174,7 @@ public class GameQuest {
|
|||||||
boolean shouldAccept = LogicType.calculate(questData.getAcceptCondComb(), accept);
|
boolean shouldAccept = LogicType.calculate(questData.getAcceptCondComb(), accept);
|
||||||
|
|
||||||
if (shouldAccept) {
|
if (shouldAccept) {
|
||||||
this.getOwner().getQuestManager().addQuest(questData.getSubId());
|
this.getOwner().getQuestManager().addQuest(questData.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,12 +9,11 @@ import java.util.function.Consumer;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import emu.grasscutter.data.GameData;
|
import emu.grasscutter.data.GameData;
|
||||||
import emu.grasscutter.data.custom.QuestConfig;
|
import emu.grasscutter.data.def.QuestData;
|
||||||
import emu.grasscutter.data.custom.QuestConfigData.QuestCondition;
|
import emu.grasscutter.data.def.QuestData.QuestCondition;
|
||||||
import emu.grasscutter.data.custom.QuestConfigData.SubQuestConfigData;
|
|
||||||
import emu.grasscutter.database.DatabaseHelper;
|
import emu.grasscutter.database.DatabaseHelper;
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
import emu.grasscutter.game.quest.enums.QuestTriggerType;
|
import emu.grasscutter.game.quest.enums.QuestTrigger;
|
||||||
import emu.grasscutter.game.quest.enums.LogicType;
|
import emu.grasscutter.game.quest.enums.LogicType;
|
||||||
import emu.grasscutter.game.quest.enums.QuestState;
|
import emu.grasscutter.game.quest.enums.QuestState;
|
||||||
import emu.grasscutter.server.packet.send.PacketFinishedParentQuestUpdateNotify;
|
import emu.grasscutter.server.packet.send.PacketFinishedParentQuestUpdateNotify;
|
||||||
@ -46,12 +45,12 @@ public class QuestManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public GameQuest getQuestById(int questId) {
|
public GameQuest getQuestById(int questId) {
|
||||||
QuestConfig questConfig = GameData.getQuestConfigs().get(questId);
|
QuestData questConfig = GameData.getQuestDataMap().get(questId);
|
||||||
if (questConfig == null) {
|
if (questConfig == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameMainQuest mainQuest = getQuests().get(questConfig.getMainQuest().getId());
|
GameMainQuest mainQuest = getQuests().get(questConfig.getMainId());
|
||||||
|
|
||||||
if (mainQuest == null) {
|
if (mainQuest == null) {
|
||||||
return null;
|
return null;
|
||||||
@ -79,8 +78,8 @@ public class QuestManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameMainQuest addMainQuest(QuestConfig questConfig) {
|
public GameMainQuest addMainQuest(QuestData questConfig) {
|
||||||
GameMainQuest mainQuest = new GameMainQuest(getPlayer(), questConfig.getMainQuest().getId());
|
GameMainQuest mainQuest = new GameMainQuest(getPlayer(), questConfig.getMainId());
|
||||||
getQuests().put(mainQuest.getParentQuestId(), mainQuest);
|
getQuests().put(mainQuest.getParentQuestId(), mainQuest);
|
||||||
|
|
||||||
getPlayer().sendPacket(new PacketFinishedParentQuestUpdateNotify(mainQuest));
|
getPlayer().sendPacket(new PacketFinishedParentQuestUpdateNotify(mainQuest));
|
||||||
@ -89,13 +88,13 @@ public class QuestManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public GameQuest addQuest(int questId) {
|
public GameQuest addQuest(int questId) {
|
||||||
QuestConfig questConfig = GameData.getQuestConfigs().get(questId);
|
QuestData questConfig = GameData.getQuestDataMap().get(questId);
|
||||||
if (questConfig == null) {
|
if (questConfig == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main quest
|
// Main quest
|
||||||
GameMainQuest mainQuest = this.getMainQuestById(questConfig.getMainQuest().getId());
|
GameMainQuest mainQuest = this.getMainQuestById(questConfig.getMainId());
|
||||||
|
|
||||||
// Create main quest if it doesnt exist
|
// Create main quest if it doesnt exist
|
||||||
if (mainQuest == null) {
|
if (mainQuest == null) {
|
||||||
@ -122,11 +121,11 @@ public class QuestManager {
|
|||||||
return quest;
|
return quest;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void triggerEvent(QuestTriggerType condType, int... params) {
|
public void triggerEvent(QuestTrigger condType, int... params) {
|
||||||
Set<GameQuest> changedQuests = new HashSet<>();
|
Set<GameQuest> changedQuests = new HashSet<>();
|
||||||
|
|
||||||
this.forEachActiveQuest(quest -> {
|
this.forEachActiveQuest(quest -> {
|
||||||
SubQuestConfigData data = quest.getConfig().getSubQuest();
|
QuestData data = quest.getData();
|
||||||
|
|
||||||
for (int i = 0; i < data.getFinishCond().length; i++) {
|
for (int i = 0; i < data.getFinishCond().length; i++) {
|
||||||
if (quest.getFinishProgressList()[i] == 1) {
|
if (quest.getFinishProgressList()[i] == 1) {
|
||||||
@ -150,7 +149,7 @@ public class QuestManager {
|
|||||||
});
|
});
|
||||||
|
|
||||||
for (GameQuest quest : changedQuests) {
|
for (GameQuest quest : changedQuests) {
|
||||||
LogicType logicType = quest.getConfig().getSubQuest().getFailCondComb();
|
LogicType logicType = quest.getData().getFailCondComb();
|
||||||
int[] progress = quest.getFinishProgressList();
|
int[] progress = quest.getFinishProgressList();
|
||||||
|
|
||||||
// Handle logical comb
|
// Handle logical comb
|
||||||
@ -174,7 +173,7 @@ public class QuestManager {
|
|||||||
|
|
||||||
for (GameQuest quest : mainQuest.getChildQuests().values()) {
|
for (GameQuest quest : mainQuest.getChildQuests().values()) {
|
||||||
quest.setMainQuest(mainQuest);
|
quest.setMainQuest(mainQuest);
|
||||||
quest.setConfig(GameData.getQuestConfigs().get(quest.getQuestId()));
|
quest.setConfig(GameData.getQuestDataMap().get(quest.getQuestId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.getQuests().put(mainQuest.getParentQuestId(), mainQuest);
|
this.getQuests().put(mainQuest.getParentQuestId(), mainQuest);
|
||||||
|
@ -3,9 +3,9 @@ package emu.grasscutter.game.quest;
|
|||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
|
||||||
import emu.grasscutter.game.quest.enums.QuestTriggerType;
|
import emu.grasscutter.game.quest.enums.QuestTrigger;
|
||||||
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
public @interface QuestValue {
|
public @interface QuestValue {
|
||||||
QuestTriggerType value();
|
QuestTrigger value();
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,9 @@ import java.util.Set;
|
|||||||
|
|
||||||
import org.reflections.Reflections;
|
import org.reflections.Reflections;
|
||||||
|
|
||||||
import emu.grasscutter.data.custom.QuestConfigData.QuestCondition;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.game.quest.enums.QuestTriggerType;
|
import emu.grasscutter.data.def.QuestData.QuestCondition;
|
||||||
import emu.grasscutter.game.quest.handlers.QuestBaseHandler;
|
import emu.grasscutter.game.quest.handlers.QuestBaseHandler;
|
||||||
import emu.grasscutter.net.packet.Opcodes;
|
|
||||||
import emu.grasscutter.server.game.GameServer;
|
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
|
|
||||||
@ -62,7 +60,7 @@ public class ServerQuestHandler {
|
|||||||
public boolean triggerCondition(GameQuest quest, QuestCondition condition, int... params) {
|
public boolean triggerCondition(GameQuest quest, QuestCondition condition, int... params) {
|
||||||
QuestBaseHandler handler = condHandlers.get(condition.getType().getValue());
|
QuestBaseHandler handler = condHandlers.get(condition.getType().getValue());
|
||||||
|
|
||||||
if (handler == null || quest.getConfig() == null) {
|
if (handler == null || quest.getData() == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +70,7 @@ public class ServerQuestHandler {
|
|||||||
public boolean triggerContent(GameQuest quest, QuestCondition condition, int... params) {
|
public boolean triggerContent(GameQuest quest, QuestCondition condition, int... params) {
|
||||||
QuestBaseHandler handler = contHandlers.get(condition.getType().getValue());
|
QuestBaseHandler handler = contHandlers.get(condition.getType().getValue());
|
||||||
|
|
||||||
if (handler == null || quest.getConfig() == null) {
|
if (handler == null || quest.getData() == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,7 +80,7 @@ public class ServerQuestHandler {
|
|||||||
public boolean triggerExec(GameQuest quest, QuestCondition condition, int... params) {
|
public boolean triggerExec(GameQuest quest, QuestCondition condition, int... params) {
|
||||||
QuestBaseHandler handler = execHandlers.get(condition.getType().getValue());
|
QuestBaseHandler handler = execHandlers.get(condition.getType().getValue());
|
||||||
|
|
||||||
if (handler == null || quest.getConfig() == null) {
|
if (handler == null || quest.getData() == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package emu.grasscutter.game.quest.conditions;
|
package emu.grasscutter.game.quest.conditions;
|
||||||
|
|
||||||
import emu.grasscutter.data.custom.QuestConfigData.QuestCondition;
|
import emu.grasscutter.data.def.QuestData.QuestCondition;
|
||||||
import emu.grasscutter.game.quest.QuestValue;
|
import emu.grasscutter.game.quest.QuestValue;
|
||||||
import emu.grasscutter.game.quest.GameQuest;
|
import emu.grasscutter.game.quest.GameQuest;
|
||||||
import emu.grasscutter.game.quest.enums.QuestTriggerType;
|
import emu.grasscutter.game.quest.enums.QuestTrigger;
|
||||||
import emu.grasscutter.game.quest.handlers.QuestBaseHandler;
|
import emu.grasscutter.game.quest.handlers.QuestBaseHandler;
|
||||||
|
|
||||||
@QuestValue(QuestTriggerType.QUEST_CONTENT_NONE)
|
@QuestValue(QuestTrigger.QUEST_CONTENT_NONE)
|
||||||
public class BaseCondition extends QuestBaseHandler {
|
public class BaseCondition extends QuestBaseHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
package emu.grasscutter.game.quest.conditions;
|
package emu.grasscutter.game.quest.conditions;
|
||||||
|
|
||||||
import emu.grasscutter.data.custom.QuestConfigData.QuestCondition;
|
import emu.grasscutter.data.def.QuestData.QuestCondition;
|
||||||
import emu.grasscutter.game.quest.QuestValue;
|
import emu.grasscutter.game.quest.QuestValue;
|
||||||
import emu.grasscutter.game.quest.GameQuest;
|
import emu.grasscutter.game.quest.GameQuest;
|
||||||
import emu.grasscutter.game.quest.enums.QuestTriggerType;
|
import emu.grasscutter.game.quest.enums.QuestTrigger;
|
||||||
import emu.grasscutter.game.quest.handlers.QuestBaseHandler;
|
import emu.grasscutter.game.quest.handlers.QuestBaseHandler;
|
||||||
|
|
||||||
@QuestValue(QuestTriggerType.QUEST_COND_PLAYER_LEVEL_EQUAL_GREATER)
|
@QuestValue(QuestTrigger.QUEST_COND_PLAYER_LEVEL_EQUAL_GREATER)
|
||||||
public class ConditionPlayerLevelEqualGreater extends QuestBaseHandler {
|
public class ConditionPlayerLevelEqualGreater extends QuestBaseHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(GameQuest quest, QuestCondition condition, int... params) {
|
public boolean execute(GameQuest quest, QuestCondition condition, int... params) {
|
||||||
return quest.getOwner().getLevel() >= condition.getParam()[0];
|
return quest.getOwner().getLevel() >= params[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
package emu.grasscutter.game.quest.conditions;
|
package emu.grasscutter.game.quest.conditions;
|
||||||
|
|
||||||
import emu.grasscutter.data.custom.QuestConfigData.QuestCondition;
|
import emu.grasscutter.data.def.QuestData.QuestCondition;
|
||||||
import emu.grasscutter.game.quest.QuestValue;
|
import emu.grasscutter.game.quest.QuestValue;
|
||||||
import emu.grasscutter.game.quest.GameQuest;
|
import emu.grasscutter.game.quest.GameQuest;
|
||||||
import emu.grasscutter.game.quest.enums.QuestTriggerType;
|
import emu.grasscutter.game.quest.enums.QuestTrigger;
|
||||||
import emu.grasscutter.game.quest.handlers.QuestBaseHandler;
|
import emu.grasscutter.game.quest.handlers.QuestBaseHandler;
|
||||||
|
|
||||||
@QuestValue(QuestTriggerType.QUEST_COND_STATE_EQUAL)
|
@QuestValue(QuestTrigger.QUEST_COND_STATE_EQUAL)
|
||||||
public class ConditionStateEqual extends QuestBaseHandler {
|
public class ConditionStateEqual extends QuestBaseHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(GameQuest quest, QuestCondition condition, int... params) {
|
public boolean execute(GameQuest quest, QuestCondition condition, int... params) {
|
||||||
GameQuest checkQuest = quest.getOwner().getQuestManager().getQuestById(condition.getParam()[0]);
|
GameQuest checkQuest = quest.getOwner().getQuestManager().getQuestById(params[0]);
|
||||||
|
|
||||||
if (checkQuest != null) {
|
if (checkQuest != null) {
|
||||||
return checkQuest.getState().getValue() == condition.getParam()[1];
|
return checkQuest.getState().getValue() == params[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package emu.grasscutter.game.quest.content;
|
package emu.grasscutter.game.quest.content;
|
||||||
|
|
||||||
import emu.grasscutter.data.custom.QuestConfigData.QuestCondition;
|
import emu.grasscutter.data.def.QuestData.QuestCondition;
|
||||||
import emu.grasscutter.game.quest.QuestValue;
|
import emu.grasscutter.game.quest.QuestValue;
|
||||||
import emu.grasscutter.game.quest.GameQuest;
|
import emu.grasscutter.game.quest.GameQuest;
|
||||||
import emu.grasscutter.game.quest.enums.QuestTriggerType;
|
import emu.grasscutter.game.quest.enums.QuestTrigger;
|
||||||
import emu.grasscutter.game.quest.handlers.QuestBaseHandler;
|
import emu.grasscutter.game.quest.handlers.QuestBaseHandler;
|
||||||
|
|
||||||
@QuestValue(QuestTriggerType.QUEST_CONTENT_NONE)
|
@QuestValue(QuestTrigger.QUEST_CONTENT_NONE)
|
||||||
public class BaseContent extends QuestBaseHandler {
|
public class BaseContent extends QuestBaseHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package emu.grasscutter.game.quest.content;
|
package emu.grasscutter.game.quest.content;
|
||||||
|
|
||||||
import emu.grasscutter.data.custom.QuestConfigData.QuestCondition;
|
import emu.grasscutter.data.def.QuestData.QuestCondition;
|
||||||
import emu.grasscutter.game.quest.QuestValue;
|
import emu.grasscutter.game.quest.QuestValue;
|
||||||
import emu.grasscutter.game.quest.GameQuest;
|
import emu.grasscutter.game.quest.GameQuest;
|
||||||
import emu.grasscutter.game.quest.enums.QuestTriggerType;
|
import emu.grasscutter.game.quest.enums.QuestTrigger;
|
||||||
import emu.grasscutter.game.quest.handlers.QuestBaseHandler;
|
import emu.grasscutter.game.quest.handlers.QuestBaseHandler;
|
||||||
|
|
||||||
@QuestValue(QuestTriggerType.QUEST_CONTENT_COMPLETE_TALK)
|
@QuestValue(QuestTrigger.QUEST_CONTENT_COMPLETE_TALK)
|
||||||
public class ContentCompleteTalk extends QuestBaseHandler {
|
public class ContentCompleteTalk extends QuestBaseHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package emu.grasscutter.game.quest.enums;
|
package emu.grasscutter.game.quest.enums;
|
||||||
|
|
||||||
public enum QuestTriggerType {
|
public enum QuestTrigger {
|
||||||
QUEST_COND_NONE (0),
|
QUEST_COND_NONE (0),
|
||||||
QUEST_COND_STATE_EQUAL (1),
|
QUEST_COND_STATE_EQUAL (1),
|
||||||
QUEST_COND_STATE_NOT_EQUAL (2),
|
QUEST_COND_STATE_NOT_EQUAL (2),
|
||||||
@ -225,7 +225,7 @@ public enum QuestTriggerType {
|
|||||||
|
|
||||||
private final int value;
|
private final int value;
|
||||||
|
|
||||||
QuestTriggerType(int id) {
|
QuestTrigger(int id) {
|
||||||
this.value = id;
|
this.value = id;
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
package emu.grasscutter.game.quest.handlers;
|
package emu.grasscutter.game.quest.handlers;
|
||||||
|
|
||||||
import emu.grasscutter.data.custom.QuestConfigData.QuestCondition;
|
import emu.grasscutter.data.def.QuestData.QuestCondition;
|
||||||
import emu.grasscutter.game.quest.GameQuest;
|
import emu.grasscutter.game.quest.GameQuest;
|
||||||
|
|
||||||
public abstract class QuestBaseHandler {
|
public abstract class QuestBaseHandler {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package emu.grasscutter.server.packet.recv;
|
package emu.grasscutter.server.packet.recv;
|
||||||
|
|
||||||
import emu.grasscutter.game.inventory.GameItem;
|
import emu.grasscutter.game.inventory.GameItem;
|
||||||
import emu.grasscutter.game.quest.enums.QuestTriggerType;
|
import emu.grasscutter.game.quest.enums.QuestTrigger;
|
||||||
import emu.grasscutter.net.packet.Opcodes;
|
import emu.grasscutter.net.packet.Opcodes;
|
||||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||||
import emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq;
|
import emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq;
|
||||||
@ -16,7 +16,7 @@ public class HandlerNpcTalkReq extends PacketHandler {
|
|||||||
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
||||||
NpcTalkReq req = NpcTalkReq.parseFrom(payload);
|
NpcTalkReq req = NpcTalkReq.parseFrom(payload);
|
||||||
|
|
||||||
session.getPlayer().getQuestManager().triggerEvent(QuestTriggerType.QUEST_CONTENT_COMPLETE_TALK, req.getTalkId());
|
session.getPlayer().getQuestManager().triggerEvent(QuestTrigger.QUEST_CONTENT_COMPLETE_TALK, req.getTalkId());
|
||||||
|
|
||||||
session.send(new PacketNpcTalkRsp(req.getNpcEntityId(), req.getTalkId(), req.getEntityId()));
|
session.send(new PacketNpcTalkRsp(req.getNpcEntityId(), req.getTalkId(), req.getEntityId()));
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
package emu.grasscutter.server.packet.send;
|
package emu.grasscutter.server.packet.send;
|
||||||
|
|
||||||
import emu.grasscutter.data.GameData;
|
|
||||||
import emu.grasscutter.data.custom.QuestConfig;
|
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
import emu.grasscutter.game.quest.GameMainQuest;
|
|
||||||
import emu.grasscutter.game.quest.GameQuest;
|
import emu.grasscutter.game.quest.GameQuest;
|
||||||
import emu.grasscutter.net.packet.BasePacket;
|
import emu.grasscutter.net.packet.BasePacket;
|
||||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||||
|
@ -19,10 +19,11 @@ import emu.grasscutter.command.Command;
|
|||||||
import emu.grasscutter.command.CommandMap;
|
import emu.grasscutter.command.CommandMap;
|
||||||
import emu.grasscutter.data.GameData;
|
import emu.grasscutter.data.GameData;
|
||||||
import emu.grasscutter.data.ResourceLoader;
|
import emu.grasscutter.data.ResourceLoader;
|
||||||
import emu.grasscutter.data.custom.QuestConfig;
|
import emu.grasscutter.data.custom.MainQuestData;
|
||||||
import emu.grasscutter.data.def.AvatarData;
|
import emu.grasscutter.data.def.AvatarData;
|
||||||
import emu.grasscutter.data.def.ItemData;
|
import emu.grasscutter.data.def.ItemData;
|
||||||
import emu.grasscutter.data.def.MonsterData;
|
import emu.grasscutter.data.def.MonsterData;
|
||||||
|
import emu.grasscutter.data.def.QuestData;
|
||||||
import emu.grasscutter.data.def.SceneData;
|
import emu.grasscutter.data.def.SceneData;
|
||||||
import emu.grasscutter.utils.Utils;
|
import emu.grasscutter.utils.Utils;
|
||||||
|
|
||||||
@ -149,13 +150,16 @@ final class ToolsWithLanguageOption {
|
|||||||
writer.println(data.getId() + " : " + data.getScriptData());
|
writer.println(data.getId() + " : " + data.getScriptData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
writer.println();
|
||||||
|
|
||||||
writer.println("// Quests");
|
writer.println("// Quests");
|
||||||
list = new ArrayList<>(GameData.getQuestConfigs().keySet());
|
list = new ArrayList<>(GameData.getQuestDataMap().keySet());
|
||||||
Collections.sort(list);
|
Collections.sort(list);
|
||||||
|
|
||||||
for (Integer id : list) {
|
for (Integer id : list) {
|
||||||
QuestConfig data = GameData.getQuestConfigs().get(id);
|
QuestData data = GameData.getQuestDataMap().get(id);
|
||||||
writer.println(data.getId() + " : " + map.get(data.getMainQuest().getTitleTextMapHash()));
|
MainQuestData mainQuest = GameData.getMainQuestDataMap().get(data.getMainId());
|
||||||
|
writer.println(data.getId() + " : " + map.get(mainQuest.getTitleTextMapHash()) + " - " + map.get(data.getDescTextMapHash()));
|
||||||
}
|
}
|
||||||
|
|
||||||
writer.println();
|
writer.println();
|
||||||
|
Loading…
Reference in New Issue
Block a user