mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-10 18:42:53 +08:00
Prevent game main quest from potentially firing twice
This commit is contained in:
parent
400a670856
commit
bb2255b9a0
@ -144,7 +144,7 @@ public class GameMainQuest {
|
|||||||
public void finish() {
|
public void finish() {
|
||||||
// Avoid recursion from child finish() in GameQuest
|
// Avoid recursion from child finish() in GameQuest
|
||||||
// when auto finishing all child quests with QUEST_STATE_UNFINISHED (below)
|
// when auto finishing all child quests with QUEST_STATE_UNFINISHED (below)
|
||||||
if (this.isFinished) {
|
if (this.isFinished || this.state == ParentQuestState.PARENT_QUEST_STATE_FINISHED) {
|
||||||
Grasscutter.getLogger().debug("Skip main quest finishing because it's already finished");
|
Grasscutter.getLogger().debug("Skip main quest finishing because it's already finished");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -153,17 +153,17 @@ public class GameMainQuest {
|
|||||||
this.state = ParentQuestState.PARENT_QUEST_STATE_FINISHED;
|
this.state = ParentQuestState.PARENT_QUEST_STATE_FINISHED;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
We also need to check for unfinished childQuests in this MainQuest
|
* We also need to check for unfinished childQuests in this MainQuest
|
||||||
force them to complete and send a packet about this to the user,
|
* force them to complete and send a packet about this to the user,
|
||||||
because at some points there are special "invisible" child quests that control
|
* because at some points there are special "invisible" child quests that control
|
||||||
some situations.
|
* some situations.
|
||||||
|
*
|
||||||
For example, subQuest 35312 is responsible for the event of leaving the territory
|
* For example, subQuest 35312 is responsible for the event of leaving the territory
|
||||||
of the island with a statue and automatically returns the character back,
|
* of the island with a statue and automatically returns the character back,
|
||||||
quest 35311 completes the main quest line 353 and starts 35501 from
|
* quest 35311 completes the main quest line 353 and starts 35501 from
|
||||||
new MainQuest 355 but if 35312 is not completed after the completion
|
* new MainQuest 355 but if 35312 is not completed after the completion
|
||||||
of the main quest 353 - the character will not be able to leave place
|
* of the main quest 353 - the character will not be able to leave place
|
||||||
(return again and again)
|
* (return again and again)
|
||||||
*/
|
*/
|
||||||
this.getChildQuests().values().stream()
|
this.getChildQuests().values().stream()
|
||||||
.filter(p -> p.state != QuestState.QUEST_STATE_FINISHED)
|
.filter(p -> p.state != QuestState.QUEST_STATE_FINISHED)
|
||||||
@ -179,12 +179,11 @@ public class GameMainQuest {
|
|||||||
if (mainQuestData.getRewardIdList() != null) {
|
if (mainQuestData.getRewardIdList() != null) {
|
||||||
for (int rewardId : mainQuestData.getRewardIdList()) {
|
for (int rewardId : mainQuestData.getRewardIdList()) {
|
||||||
RewardData rewardData = GameData.getRewardDataMap().get(rewardId);
|
RewardData rewardData = GameData.getRewardDataMap().get(rewardId);
|
||||||
|
|
||||||
if (rewardData == null) {
|
if (rewardData == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
getOwner()
|
this.getOwner()
|
||||||
.getInventory()
|
.getInventory()
|
||||||
.addItemParamDatas(rewardData.getRewardItemList(), ActionReason.QuestReward);
|
.addItemParamDatas(rewardData.getRewardItemList(), ActionReason.QuestReward);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user