mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-10 04:32:53 +08:00
Add questing debug; which is enabled by default
This commit is contained in:
parent
e350cd42f9
commit
581df066e7
@ -32,4 +32,5 @@ public final class GameConstants {
|
|||||||
Arrays.stream(DEFAULT_ABILITY_STRINGS).mapToInt(Utils::abilityHash).toArray();
|
Arrays.stream(DEFAULT_ABILITY_STRINGS).mapToInt(Utils::abilityHash).toArray();
|
||||||
public static final int DEFAULT_ABILITY_NAME = Utils.abilityHash("Default");
|
public static final int DEFAULT_ABILITY_NAME = Utils.abilityHash("Default");
|
||||||
public static String VERSION = "3.5.0";
|
public static String VERSION = "3.5.0";
|
||||||
|
public static final boolean DEBUG = true;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,8 @@ import emu.grasscutter.server.packet.send.PacketQuestProgressUpdateNotify;
|
|||||||
import emu.grasscutter.utils.ConversionUtils;
|
import emu.grasscutter.utils.ConversionUtils;
|
||||||
import emu.grasscutter.utils.Position;
|
import emu.grasscutter.utils.Position;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
import org.bson.types.ObjectId;
|
import org.bson.types.ObjectId;
|
||||||
@ -475,7 +477,7 @@ public class GameMainQuest {
|
|||||||
.getServer()
|
.getServer()
|
||||||
.getQuestSystem()
|
.getQuestSystem()
|
||||||
.triggerContent(subQuestWithCond, condition, paramStr, params);
|
.triggerContent(subQuestWithCond, condition, paramStr, params);
|
||||||
subQuestWithCond.getFinishProgressList()[i] = result ? 1 : 0;
|
subQuestWithCond.setFinishProgress(i, result ? 1 : 0);
|
||||||
if (result) {
|
if (result) {
|
||||||
getOwner().getSession().send(new PacketQuestProgressUpdateNotify(subQuestWithCond));
|
getOwner().getSession().send(new PacketQuestProgressUpdateNotify(subQuestWithCond));
|
||||||
}
|
}
|
||||||
@ -487,6 +489,12 @@ public class GameMainQuest {
|
|||||||
subQuestWithCond.getQuestData().getFinishCondComb(),
|
subQuestWithCond.getQuestData().getFinishCondComb(),
|
||||||
subQuestWithCond.getFinishProgressList());
|
subQuestWithCond.getFinishProgressList());
|
||||||
|
|
||||||
|
if (this.getQuestManager().getLoggedQuests().contains(subQuestWithCond.getSubQuestId())) {
|
||||||
|
Grasscutter.getLogger().debug("Quest {} will be {} as a result of content trigger {} ({}, {}).",
|
||||||
|
subQuestWithCond.getSubQuestId(), shouldFinish ? "finished" : "not finished", condType.name(), paramStr,
|
||||||
|
Arrays.stream(params).mapToObj(String::valueOf).collect(Collectors.joining(", ")));
|
||||||
|
}
|
||||||
|
|
||||||
if (shouldFinish) subQuestWithCond.finish();
|
if (shouldFinish) subQuestWithCond.finish();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -531,7 +539,7 @@ public class GameMainQuest {
|
|||||||
return proto.build();
|
return proto.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
// TimeVar handling TODO check if ingame or irl time
|
// TimeVar handling TODO check if in-game or irl time
|
||||||
public boolean initTimeVar(int index) {
|
public boolean initTimeVar(int index) {
|
||||||
if (index >= this.timeVar.length) {
|
if (index >= this.timeVar.length) {
|
||||||
Grasscutter.getLogger()
|
Grasscutter.getLogger()
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package emu.grasscutter.game.quest;
|
package emu.grasscutter.game.quest;
|
||||||
|
|
||||||
|
import dev.morphia.annotations.Transient;
|
||||||
import emu.grasscutter.Grasscutter;
|
import emu.grasscutter.Grasscutter;
|
||||||
import emu.grasscutter.data.GameData;
|
import emu.grasscutter.data.GameData;
|
||||||
import emu.grasscutter.data.binout.MainQuestData;
|
import emu.grasscutter.data.binout.MainQuestData;
|
||||||
@ -12,9 +13,7 @@ import emu.grasscutter.game.quest.enums.*;
|
|||||||
import emu.grasscutter.server.packet.send.PacketFinishedParentQuestUpdateNotify;
|
import emu.grasscutter.server.packet.send.PacketFinishedParentQuestUpdateNotify;
|
||||||
import emu.grasscutter.utils.Position;
|
import emu.grasscutter.utils.Position;
|
||||||
import io.netty.util.concurrent.FastThreadLocalThread;
|
import io.netty.util.concurrent.FastThreadLocalThread;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.*;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
|
||||||
import it.unimi.dsi.fastutil.ints.IntIntImmutablePair;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
|
|
||||||
@ -25,13 +24,15 @@ import java.util.concurrent.LinkedBlockingDeque;
|
|||||||
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static emu.grasscutter.GameConstants.DEBUG;
|
||||||
import static emu.grasscutter.config.Configuration.GAME_OPTIONS;
|
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;
|
||||||
|
|
||||||
private long lastHourCheck = 0;
|
private long lastHourCheck = 0;
|
||||||
private long lastDayCheck = 0;
|
private long lastDayCheck = 0;
|
||||||
@ -107,6 +108,24 @@ public class QuestManager extends BasePlayerManager {
|
|||||||
|
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.mainQuests = new Int2ObjectOpenHashMap<>();
|
this.mainQuests = new Int2ObjectOpenHashMap<>();
|
||||||
|
this.loggedQuests = new IntArrayList();
|
||||||
|
|
||||||
|
if (DEBUG) {
|
||||||
|
this.loggedQuests.addAll(List.of(
|
||||||
|
31101, // Quest which holds talks 30902 and 30904.
|
||||||
|
35001, // Quest which unlocks world border & starts act 2.
|
||||||
|
30901, // Quest which is completed upon finishing all 3 initial dungeons.
|
||||||
|
30903, // Quest which is finished when re-entering scene 3. (home world)
|
||||||
|
30904, // Quest which unlocks the Adventurers' Guild
|
||||||
|
|
||||||
|
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.
|
||||||
|
// This quest requires 31101 not be finished.
|
||||||
|
// This quest should be accepted when the account is created.
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO store user value set on enable
|
// TODO store user value set on enable
|
||||||
@ -378,10 +397,15 @@ public class QuestManager extends BasePlayerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
boolean shouldAccept = LogicType.calculate(questData.getAcceptCondComb(), accept);
|
boolean shouldAccept = LogicType.calculate(questData.getAcceptCondComb(), accept);
|
||||||
|
if (this.loggedQuests.contains(questData.getId())) {
|
||||||
|
Grasscutter.getLogger().debug("Quest {} will be {} as a result of event trigger {} ({}, {}).",
|
||||||
|
questData.getId(), shouldAccept ? "accepted" : "not accepted", condType.name(), paramStr,
|
||||||
|
Arrays.stream(params).mapToObj(String::valueOf).collect(Collectors.joining(", ")));
|
||||||
|
}
|
||||||
|
|
||||||
if (shouldAccept){
|
if (shouldAccept) {
|
||||||
GameQuest quest = owner.getQuestManager().addQuest(questData);
|
GameQuest quest = owner.getQuestManager().addQuest(questData);
|
||||||
Grasscutter.getLogger().debug("Added quest {} result {}", questData.getSubId(), quest !=null);
|
Grasscutter.getLogger().debug("Added quest {} result {}", questData.getSubId(), quest != null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user