Merge pull request Grasscutter-Quests#53

'Updated with how talks are handle' by `mjolsic`
This commit is contained in:
KingRainbow44 2023-05-02 20:16:55 -04:00
parent 6c654ce0c3
commit fdd6820a8f
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
107 changed files with 538 additions and 233 deletions

View File

@ -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<QuestData> questDataMap = new Int2ObjectOpenHashMap<>();
private static final Int2ObjectMap<QuestData> questDataMap =
new Int2ObjectOpenHashMap<>();
@Getter
private static final Int2ObjectMap<QuestGlobalVarData> questGlobalVarDataMap =
new Int2ObjectOpenHashMap<>();
@Getter
private static final Int2ObjectMap<ReliquaryAffixData> reliquaryAffixDataMap =
@ -318,7 +324,12 @@ public final class GameData {
new Int2ObjectOpenHashMap<>();
@Getter
private static final Int2ObjectMap<SceneData> sceneDataMap = new Int2ObjectLinkedOpenHashMap<>();
private static final Int2ObjectMap<SceneData> sceneDataMap =
new Int2ObjectLinkedOpenHashMap<>();
@Getter
private static final Int2ObjectMap<TalkConfigData> talkConfigDataMap =
new Int2ObjectOpenHashMap<>();
@Getter
private static final Int2ObjectMap<TowerFloorData> towerFloorDataMap =

View File

@ -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<TalkExecParam> 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;
}
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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));

View File

@ -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<Integer> questVarsUpdate;
@Getter private ParentQuestState state;
@Getter private boolean isFinished;
@Getter List<QuestGroupSuite> questGroupSuites;
@ -68,13 +67,6 @@ public class GameMainQuest {
addAllChildQuests();
}
public List<Integer> getQuestVarsUpdate() {
if (questVarsUpdate == null) {
questVarsUpdate = new ArrayList<>();
}
return questVarsUpdate;
}
private void addAllChildQuests() {
List<Integer> 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) {

View File

@ -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;

View File

@ -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<GameQuest> 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<GameMainQuest> callback) {
for (GameMainQuest mainQuest : getMainQuests().values()) {
for (var mainQuest : getMainQuests().values()) {
callback.accept(mainQuest);
}
}
// TODO
public void forEachActiveQuest(Consumer<GameQuest> 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(() -> {

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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]);
}
}

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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<T extends QuestCondition<?>> {

View File

@ -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);
}

View File

@ -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<TalkExec> execMap = new Int2ObjectOpenHashMap<>();
private static final Map<String, TalkExec> 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;
}

View File

@ -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);
}

View File

@ -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, ""));
}
}

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