Clean-up (while attempting to fix)

This commit is contained in:
KingRainbow44 2023-05-02 22:45:27 -04:00
parent 760ea456ec
commit 1634a5c696
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
3 changed files with 25 additions and 16 deletions

View File

@ -64,27 +64,30 @@ public class GameQuest {
}
public void start() {
clearProgress(false);
this.clearProgress(false);
this.acceptTime = Utils.getCurrentSeconds();
this.startTime = this.acceptTime;
this.startGameDay = getOwner().getWorld().getTotalGameTimeDays();
this.state = QuestState.QUEST_STATE_UNFINISHED;
val triggerCond =
questData.getFinishCond().stream()
.filter(p -> p.getType() == QuestContent.QUEST_CONTENT_TRIGGER_FIRE)
.toList();
if (triggerCond.size() > 0) {
for (val cond : triggerCond) {
TriggerExcelConfigData newTrigger =
GameData.getTriggerExcelConfigDataMap().get(cond.getParam()[0]);
var newTrigger = GameData.getTriggerExcelConfigDataMap()
.get(cond.getParam()[0]);
if (newTrigger != null) {
if (this.triggerData == null) {
this.triggerData = new HashMap<>();
}
triggerData.put(newTrigger.getTriggerName(), newTrigger);
triggers.put(newTrigger.getTriggerName(), false);
SceneGroup group = SceneGroup.of(newTrigger.getGroupId()).load(newTrigger.getSceneId());
getOwner()
var group = SceneGroup.of(newTrigger.getGroupId())
.load(newTrigger.getSceneId());
this.getOwner()
.getWorld()
.getSceneById(newTrigger.getSceneId())
.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)) {
getOwner()
this.getOwner()
.sendPacket(
new PacketChapterStateNotify(
ChapterData.getBeginQuestChapterMap().get(subQuestId).getId(),
@ -106,10 +109,11 @@ public class GameQuest {
// different MainQuests)
this.triggerStateEvents();
getQuestData()
this.getQuestData()
.getBeginExec()
.forEach(e -> getOwner().getServer().getQuestSystem().triggerExec(this, e, e.getParam()));
getOwner().getQuestManager().checkQuestAlreadyFullfilled(this);
.forEach(e -> getOwner().getServer().getQuestSystem()
.triggerExec(this, e, e.getParam()));
this.getOwner().getQuestManager().checkQuestAlreadyFullfilled(this);
Grasscutter.getLogger().debug("Quest {} is started", subQuestId);
this.save();

View File

@ -33,7 +33,7 @@ import static emu.grasscutter.config.Configuration.GAME_OPTIONS;
public class QuestManager extends BasePlayerManager {
@Getter private final Player player;
@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 lastDayCheck = 0;
@ -109,7 +109,7 @@ public class QuestManager extends BasePlayerManager {
this.player = player;
this.mainQuests = new Int2ObjectOpenHashMap<>();
this.loggedQuests = new IntArrayList();
this.loggedQuests = new ArrayList<>();
if (DEBUG) {
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.
// 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 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) {
eventExecutor.submit(() -> triggerEvent(condType, paramStr, params));
}
public void queueEvent(QuestCond condType, String paramStr, int... params) {
eventExecutor.submit(() -> triggerEvent(condType, paramStr, params));
}

View File

@ -9,7 +9,7 @@ import emu.grasscutter.game.quest.enums.QuestExec;
import emu.grasscutter.game.quest.handlers.QuestExecHandler;
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)
public class ExecChangeAvatarElemet extends QuestExecHandler {
@Override
@ -25,8 +25,8 @@ public class ExecChangeAvatarElemet extends QuestExecHandler {
}
Grasscutter.getLogger()
.info(
"Changing avatar element to {} for quest {}",
.debug(
"Changing avatar element to {} for quest {}.",
targetElement.name(),
quest.getSubQuestId());
return mainAvatar.changeElement(targetElement);