fix quest content and condition triggers (#2283)

* Add param3 to EVENT_GADGET_STATE_CHANGE

* Slight cleanup for DungeonManager

* Fix ContentTriggerFire

* Rework and fix talk content and conditions.

* redo item content and conditions, swap out getItemByGuid with getItemById, and make count handling consistent.

* Don't need to check if checkItem is null

* add this. to DungeonManager.java

* add this to Inventory.java

* Update src/main/java/emu/grasscutter/game/quest/QuestManager.java

Co-authored-by: Magix <27646710+KingRainbow44@users.noreply.github.com>

* add spaces to ContentCompleteAnyTalk.java

* Update src/main/java/emu/grasscutter/game/quest/content/ContentCompleteAnyTalk.java

Co-authored-by: Magix <27646710+KingRainbow44@users.noreply.github.com>

---------

Co-authored-by: Magix <27646710+KingRainbow44@users.noreply.github.com>
This commit is contained in:
Nazrin
2023-08-07 15:03:13 -07:00
committed by GitHub
parent 8200607a15
commit b9a493d424
19 changed files with 119 additions and 67 deletions

View File

@@ -286,14 +286,18 @@ public final class DungeonManager {
}
public void finishDungeon() {
// Mark the dungeon has completed for the players.
var dungeonId = this.getDungeonData().getId();
this.getScene()
.getPlayers()
.forEach(player -> player.getPlayerProgress().markDungeonAsComplete(dungeonId));
this.notifyEndDungeon(true);
this.endDungeon(BaseDungeonResult.DungeonEndReason.COMPLETED);
}
notifyEndDungeon(true);
endDungeon(BaseDungeonResult.DungeonEndReason.COMPLETED);
public void quitDungeon() {
this.notifyEndDungeon(false);
this.endDungeon(BaseDungeonResult.DungeonEndReason.QUIT);
}
public void failDungeon() {
this.notifyEndDungeon(false);
this.endDungeon(BaseDungeonResult.DungeonEndReason.FAILED);
}
public void notifyEndDungeon(boolean successfully) {
@@ -301,8 +305,11 @@ public final class DungeonManager {
.getPlayers()
.forEach(
p -> {
// Trigger the fail event if needed.
if (!successfully) {
// Trigger the fail and success event.
if (successfully) {
var dungeonId = this.getDungeonData().getId();
p.getPlayerProgress().markDungeonAsComplete(dungeonId);
} else {
p.getQuestManager()
.queueEvent(QuestContent.QUEST_CONTENT_FAIL_DUNGEON, dungeonData.getId());
}
@@ -317,16 +324,6 @@ public final class DungeonManager {
.callEvent(new ScriptArgs(0, EventType.EVENT_DUNGEON_SETTLE, successfully ? 1 : 0));
}
public void quitDungeon() {
notifyEndDungeon(false);
endDungeon(BaseDungeonResult.DungeonEndReason.QUIT);
}
public void failDungeon() {
notifyEndDungeon(false);
endDungeon(BaseDungeonResult.DungeonEndReason.FAILED);
}
public void endDungeon(BaseDungeonResult.DungeonEndReason endReason) {
if (scene.getDungeonSettleListeners() != null) {
scene.getDungeonSettleListeners().forEach(o -> o.onDungeonSettle(this, endReason));