mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-10 17:33:02 +08:00
Clean-up (while attempting to fix)
This commit is contained in:
parent
760ea456ec
commit
1634a5c696
@ -64,27 +64,30 @@ public class GameQuest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
clearProgress(false);
|
this.clearProgress(false);
|
||||||
this.acceptTime = Utils.getCurrentSeconds();
|
this.acceptTime = Utils.getCurrentSeconds();
|
||||||
this.startTime = this.acceptTime;
|
this.startTime = this.acceptTime;
|
||||||
this.startGameDay = getOwner().getWorld().getTotalGameTimeDays();
|
this.startGameDay = getOwner().getWorld().getTotalGameTimeDays();
|
||||||
this.state = QuestState.QUEST_STATE_UNFINISHED;
|
this.state = QuestState.QUEST_STATE_UNFINISHED;
|
||||||
|
|
||||||
val triggerCond =
|
val triggerCond =
|
||||||
questData.getFinishCond().stream()
|
questData.getFinishCond().stream()
|
||||||
.filter(p -> p.getType() == QuestContent.QUEST_CONTENT_TRIGGER_FIRE)
|
.filter(p -> p.getType() == QuestContent.QUEST_CONTENT_TRIGGER_FIRE)
|
||||||
.toList();
|
.toList();
|
||||||
if (triggerCond.size() > 0) {
|
if (triggerCond.size() > 0) {
|
||||||
for (val cond : triggerCond) {
|
for (val cond : triggerCond) {
|
||||||
TriggerExcelConfigData newTrigger =
|
var newTrigger = GameData.getTriggerExcelConfigDataMap()
|
||||||
GameData.getTriggerExcelConfigDataMap().get(cond.getParam()[0]);
|
.get(cond.getParam()[0]);
|
||||||
if (newTrigger != null) {
|
if (newTrigger != null) {
|
||||||
if (this.triggerData == null) {
|
if (this.triggerData == null) {
|
||||||
this.triggerData = new HashMap<>();
|
this.triggerData = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
triggerData.put(newTrigger.getTriggerName(), newTrigger);
|
triggerData.put(newTrigger.getTriggerName(), newTrigger);
|
||||||
triggers.put(newTrigger.getTriggerName(), false);
|
triggers.put(newTrigger.getTriggerName(), false);
|
||||||
SceneGroup group = SceneGroup.of(newTrigger.getGroupId()).load(newTrigger.getSceneId());
|
var group = SceneGroup.of(newTrigger.getGroupId())
|
||||||
getOwner()
|
.load(newTrigger.getSceneId());
|
||||||
|
this.getOwner()
|
||||||
.getWorld()
|
.getWorld()
|
||||||
.getSceneById(newTrigger.getSceneId())
|
.getSceneById(newTrigger.getSceneId())
|
||||||
.loadTriggerFromGroup(group, newTrigger.getTriggerName());
|
.loadTriggerFromGroup(group, newTrigger.getTriggerName());
|
||||||
@ -92,10 +95,10 @@ public class GameQuest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getOwner().sendPacket(new PacketQuestListUpdateNotify(this));
|
this.getOwner().sendPacket(new PacketQuestListUpdateNotify(this));
|
||||||
|
|
||||||
if (ChapterData.getBeginQuestChapterMap().containsKey(subQuestId)) {
|
if (ChapterData.getBeginQuestChapterMap().containsKey(subQuestId)) {
|
||||||
getOwner()
|
this.getOwner()
|
||||||
.sendPacket(
|
.sendPacket(
|
||||||
new PacketChapterStateNotify(
|
new PacketChapterStateNotify(
|
||||||
ChapterData.getBeginQuestChapterMap().get(subQuestId).getId(),
|
ChapterData.getBeginQuestChapterMap().get(subQuestId).getId(),
|
||||||
@ -106,10 +109,11 @@ public class GameQuest {
|
|||||||
// different MainQuests)
|
// different MainQuests)
|
||||||
this.triggerStateEvents();
|
this.triggerStateEvents();
|
||||||
|
|
||||||
getQuestData()
|
this.getQuestData()
|
||||||
.getBeginExec()
|
.getBeginExec()
|
||||||
.forEach(e -> getOwner().getServer().getQuestSystem().triggerExec(this, e, e.getParam()));
|
.forEach(e -> getOwner().getServer().getQuestSystem()
|
||||||
getOwner().getQuestManager().checkQuestAlreadyFullfilled(this);
|
.triggerExec(this, e, e.getParam()));
|
||||||
|
this.getOwner().getQuestManager().checkQuestAlreadyFullfilled(this);
|
||||||
|
|
||||||
Grasscutter.getLogger().debug("Quest {} is started", subQuestId);
|
Grasscutter.getLogger().debug("Quest {} is started", subQuestId);
|
||||||
this.save();
|
this.save();
|
||||||
|
@ -33,7 +33,7 @@ import static emu.grasscutter.config.Configuration.GAME_OPTIONS;
|
|||||||
public class QuestManager extends BasePlayerManager {
|
public class QuestManager extends BasePlayerManager {
|
||||||
@Getter private final Player player;
|
@Getter private final Player player;
|
||||||
@Getter private final Int2ObjectMap<GameMainQuest> mainQuests;
|
@Getter private final Int2ObjectMap<GameMainQuest> mainQuests;
|
||||||
@Transient @Getter private final IntList loggedQuests;
|
@Transient @Getter private final List<Integer> loggedQuests;
|
||||||
|
|
||||||
private long lastHourCheck = 0;
|
private long lastHourCheck = 0;
|
||||||
private long lastDayCheck = 0;
|
private long lastDayCheck = 0;
|
||||||
@ -109,7 +109,7 @@ public class QuestManager extends BasePlayerManager {
|
|||||||
|
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.mainQuests = new Int2ObjectOpenHashMap<>();
|
this.mainQuests = new Int2ObjectOpenHashMap<>();
|
||||||
this.loggedQuests = new IntArrayList();
|
this.loggedQuests = new ArrayList<>();
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
this.loggedQuests.addAll(List.of(
|
this.loggedQuests.addAll(List.of(
|
||||||
@ -122,9 +122,13 @@ public class QuestManager extends BasePlayerManager {
|
|||||||
46904, // Quest which is required to be started, but not completed for 31101's talks to begin.
|
46904, // Quest which is required to be started, but not completed for 31101's talks to begin.
|
||||||
// This quest is related to obtaining your first Anemoculus.
|
// This quest is related to obtaining your first Anemoculus.
|
||||||
|
|
||||||
35104 // Quest which is required to be finished for 46904 to begin.
|
35104, // Quest which is required to be finished for 46904 to begin.
|
||||||
// This quest requires 31101 not be finished.
|
// This quest requires 31101 not be finished.
|
||||||
// This quest should be accepted when the account is created.
|
// This quest should be accepted when the account is created.
|
||||||
|
|
||||||
|
// These quests currently have bugged triggers.
|
||||||
|
30700, // Quest which is responsible for unlocking Crash Course.
|
||||||
|
30800 // Quest which is responsible for unlocking Sparks Amongst the Pages.
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -396,6 +400,7 @@ public class QuestManager extends BasePlayerManager {
|
|||||||
public void queueEvent(QuestContent condType, String paramStr, int... params) {
|
public void queueEvent(QuestContent condType, String paramStr, int... params) {
|
||||||
eventExecutor.submit(() -> triggerEvent(condType, paramStr, params));
|
eventExecutor.submit(() -> triggerEvent(condType, paramStr, params));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void queueEvent(QuestCond condType, String paramStr, int... params) {
|
public void queueEvent(QuestCond condType, String paramStr, int... params) {
|
||||||
eventExecutor.submit(() -> triggerEvent(condType, paramStr, params));
|
eventExecutor.submit(() -> triggerEvent(condType, paramStr, params));
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import emu.grasscutter.game.quest.enums.QuestExec;
|
|||||||
import emu.grasscutter.game.quest.handlers.QuestExecHandler;
|
import emu.grasscutter.game.quest.handlers.QuestExecHandler;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
|
|
||||||
/** Changes the main avatar's element. First parameter is the elementType id */
|
/** Changes the main avatar's element. First parameter is the elementType ID. */
|
||||||
@QuestValueExec(QuestExec.QUEST_EXEC_CHANGE_AVATAR_ELEMET)
|
@QuestValueExec(QuestExec.QUEST_EXEC_CHANGE_AVATAR_ELEMET)
|
||||||
public class ExecChangeAvatarElemet extends QuestExecHandler {
|
public class ExecChangeAvatarElemet extends QuestExecHandler {
|
||||||
@Override
|
@Override
|
||||||
@ -25,8 +25,8 @@ public class ExecChangeAvatarElemet extends QuestExecHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Grasscutter.getLogger()
|
Grasscutter.getLogger()
|
||||||
.info(
|
.debug(
|
||||||
"Changing avatar element to {} for quest {}",
|
"Changing avatar element to {} for quest {}.",
|
||||||
targetElement.name(),
|
targetElement.name(),
|
||||||
quest.getSubQuestId());
|
quest.getSubQuestId());
|
||||||
return mainAvatar.changeElement(targetElement);
|
return mainAvatar.changeElement(targetElement);
|
||||||
|
Loading…
Reference in New Issue
Block a user