mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-25 12:52:57 +08:00
Invoke the 'not equal' events
This commit is contained in:
parent
b0605f6ac2
commit
8b84360724
@ -104,19 +104,7 @@ public class GameQuest {
|
|||||||
|
|
||||||
// Some subQuests and talks become active when some other subQuests are unfinished (even from
|
// Some subQuests and talks become active when some other subQuests are unfinished (even from
|
||||||
// different MainQuests)
|
// different MainQuests)
|
||||||
getOwner()
|
this.triggerStateEvents();
|
||||||
.getQuestManager()
|
|
||||||
.queueEvent(
|
|
||||||
QuestContent.QUEST_CONTENT_QUEST_STATE_EQUAL,
|
|
||||||
getSubQuestId(),
|
|
||||||
getState().getValue(),
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0);
|
|
||||||
getOwner()
|
|
||||||
.getQuestManager()
|
|
||||||
.queueEvent(
|
|
||||||
QuestCond.QUEST_COND_STATE_EQUAL, getSubQuestId(), getState().getValue(), 0, 0, 0);
|
|
||||||
|
|
||||||
getQuestData()
|
getQuestData()
|
||||||
.getBeginExec()
|
.getBeginExec()
|
||||||
@ -127,6 +115,24 @@ public class GameQuest {
|
|||||||
this.save();
|
this.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triggers events:
|
||||||
|
* 'QUEST_COND_STATE_EQUAL',
|
||||||
|
* 'QUEST_COND_STATE_NOT_EQUAL',
|
||||||
|
* 'QUEST_CONTENT_QUEST_STATE_EQUAL',
|
||||||
|
* 'QUEST_CONTENT_QUEST_STATE_NOT_EQUAL'
|
||||||
|
*/
|
||||||
|
public void triggerStateEvents() {
|
||||||
|
var questManager = this.getOwner().getQuestManager();
|
||||||
|
var questId = this.getSubQuestId();
|
||||||
|
var state = this.getState().getValue();
|
||||||
|
|
||||||
|
questManager.queueEvent(QuestCond.QUEST_COND_STATE_EQUAL, questId, state, 0, 0, 0);
|
||||||
|
questManager.queueEvent(QuestCond.QUEST_COND_STATE_NOT_EQUAL, questId, state, 0, 0, 0);
|
||||||
|
questManager.queueEvent(QuestContent.QUEST_CONTENT_QUEST_STATE_EQUAL, questId, state, 0, 0, 0);
|
||||||
|
questManager.queueEvent(QuestContent.QUEST_CONTENT_QUEST_STATE_NOT_EQUAL, questId, state, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
public String getTriggerNameById(int id) {
|
public String getTriggerNameById(int id) {
|
||||||
TriggerExcelConfigData trigger = GameData.getTriggerExcelConfigDataMap().get(id);
|
TriggerExcelConfigData trigger = GameData.getTriggerExcelConfigDataMap().get(id);
|
||||||
if (trigger != null) {
|
if (trigger != null) {
|
||||||
@ -214,10 +220,7 @@ public class GameQuest {
|
|||||||
this.getOwner()
|
this.getOwner()
|
||||||
.getQuestManager()
|
.getQuestManager()
|
||||||
.queueEvent(QuestContent.QUEST_CONTENT_FINISH_PLOT, this.subQuestId, 0);
|
.queueEvent(QuestContent.QUEST_CONTENT_FINISH_PLOT, this.subQuestId, 0);
|
||||||
this.getOwner()
|
this.triggerStateEvents();
|
||||||
.getQuestManager()
|
|
||||||
.queueEvent(
|
|
||||||
QuestCond.QUEST_COND_STATE_EQUAL, this.subQuestId, this.state.getValue(), 0, 0, 0);
|
|
||||||
this.getOwner()
|
this.getOwner()
|
||||||
.getScene()
|
.getScene()
|
||||||
.triggerDungeonEvent(DungeonPassConditionType.DUNGEON_COND_FINISH_QUEST, getSubQuestId());
|
.triggerDungeonEvent(DungeonPassConditionType.DUNGEON_COND_FINISH_QUEST, getSubQuestId());
|
||||||
@ -250,19 +253,7 @@ public class GameQuest {
|
|||||||
this.getOwner().sendPacket(new PacketQuestListUpdateNotify(this));
|
this.getOwner().sendPacket(new PacketQuestListUpdateNotify(this));
|
||||||
|
|
||||||
// Some subQuests have conditions that subQuests fail (even from different MainQuests)
|
// Some subQuests have conditions that subQuests fail (even from different MainQuests)
|
||||||
this.getOwner()
|
this.triggerStateEvents();
|
||||||
.getQuestManager()
|
|
||||||
.queueEvent(
|
|
||||||
QuestContent.QUEST_CONTENT_QUEST_STATE_EQUAL,
|
|
||||||
this.subQuestId,
|
|
||||||
this.state.getValue(),
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0);
|
|
||||||
this.getOwner()
|
|
||||||
.getQuestManager()
|
|
||||||
.queueEvent(
|
|
||||||
QuestCond.QUEST_COND_STATE_EQUAL, this.subQuestId, this.state.getValue(), 0, 0, 0);
|
|
||||||
|
|
||||||
this.getQuestData()
|
this.getQuestData()
|
||||||
.getFailExec()
|
.getFailExec()
|
||||||
|
@ -4,9 +4,7 @@ import static emu.grasscutter.game.quest.enums.QuestCond.QUEST_COND_STATE_EQUAL;
|
|||||||
|
|
||||||
import emu.grasscutter.data.excels.QuestData;
|
import emu.grasscutter.data.excels.QuestData;
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
import emu.grasscutter.game.quest.GameQuest;
|
|
||||||
import emu.grasscutter.game.quest.QuestValueCond;
|
import emu.grasscutter.game.quest.QuestValueCond;
|
||||||
import lombok.val;
|
|
||||||
|
|
||||||
@QuestValueCond(QUEST_COND_STATE_EQUAL)
|
@QuestValueCond(QUEST_COND_STATE_EQUAL)
|
||||||
public class ConditionStateEqual extends BaseCondition {
|
public class ConditionStateEqual extends BaseCondition {
|
||||||
@ -18,17 +16,10 @@ public class ConditionStateEqual extends BaseCondition {
|
|||||||
QuestData.QuestAcceptCondition condition,
|
QuestData.QuestAcceptCondition condition,
|
||||||
String paramStr,
|
String paramStr,
|
||||||
int... params) {
|
int... params) {
|
||||||
val questId = condition.getParam()[0];
|
var questId = condition.getParam()[0];
|
||||||
val questStateValue = condition.getParam()[1];
|
var questStateValue = condition.getParam()[1];
|
||||||
GameQuest checkQuest = owner.getQuestManager().getQuestById(questId);
|
var checkQuest = owner.getQuestManager().getQuestById(questId);
|
||||||
if (checkQuest == null) {
|
|
||||||
/*
|
return checkQuest != null && checkQuest.getState().getValue() == questStateValue;
|
||||||
Will spam the console
|
|
||||||
*/
|
|
||||||
// Grasscutter.getLogger().debug("Warning: quest {} hasn't been started yet!",
|
|
||||||
// condition.getParam()[0]);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return checkQuest.getState().getValue() == questStateValue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,7 @@ import static emu.grasscutter.game.quest.enums.QuestCond.QUEST_COND_STATE_NOT_EQ
|
|||||||
|
|
||||||
import emu.grasscutter.data.excels.QuestData;
|
import emu.grasscutter.data.excels.QuestData;
|
||||||
import emu.grasscutter.game.player.Player;
|
import emu.grasscutter.game.player.Player;
|
||||||
import emu.grasscutter.game.quest.GameQuest;
|
|
||||||
import emu.grasscutter.game.quest.QuestValueCond;
|
import emu.grasscutter.game.quest.QuestValueCond;
|
||||||
import lombok.val;
|
|
||||||
|
|
||||||
@QuestValueCond(QUEST_COND_STATE_NOT_EQUAL)
|
@QuestValueCond(QUEST_COND_STATE_NOT_EQUAL)
|
||||||
public class ConditionStateNotEqual extends BaseCondition {
|
public class ConditionStateNotEqual extends BaseCondition {
|
||||||
@ -18,18 +16,11 @@ public class ConditionStateNotEqual extends BaseCondition {
|
|||||||
QuestData.QuestAcceptCondition condition,
|
QuestData.QuestAcceptCondition condition,
|
||||||
String paramStr,
|
String paramStr,
|
||||||
int... params) {
|
int... params) {
|
||||||
val questId = condition.getParam()[0];
|
var questId = condition.getParam()[0];
|
||||||
val questStateValue = condition.getParam()[1];
|
var questStateValue = condition.getParam()[1];
|
||||||
GameQuest checkQuest = owner.getQuestManager().getQuestById(questId);
|
var checkQuest = owner.getQuestManager().getQuestById(questId);
|
||||||
if (checkQuest == null) {
|
|
||||||
/*
|
|
||||||
Will spam the console
|
|
||||||
*/
|
|
||||||
// Grasscutter.getLogger().debug("Warning: quest {} hasn't been started yet!",
|
|
||||||
// condition.getParam()[0]);
|
|
||||||
|
|
||||||
return false;
|
return checkQuest != null &&
|
||||||
}
|
checkQuest.getState().getValue() != questStateValue;
|
||||||
return checkQuest.getState().getValue() != questStateValue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,6 @@ public class ContentEnterMyWorld extends BaseContent {
|
|||||||
@Override
|
@Override
|
||||||
public boolean execute(
|
public boolean execute(
|
||||||
GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) {
|
GameQuest quest, QuestData.QuestContentCondition condition, String paramStr, int... params) {
|
||||||
System.out.printf("ContentEnterMyWorld, QuestData: %s; ExecParams: %s%n",
|
|
||||||
condition.getParam()[0], params[0]);
|
|
||||||
return quest.getOwner().getSceneId() == params[0];
|
return quest.getOwner().getSceneId() == params[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user