mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-16 17:05:20 +01:00
Remove questing (or questingEnabled) from the config, replace with questOptions or questing
This commit is contained in:
@@ -26,9 +26,11 @@ public class ConfigContainer {
|
||||
* Version 5 - 'questing' has been changed from a boolean
|
||||
* to a container of options ('questOptions').
|
||||
* This field will be removed in future versions.
|
||||
* Version 6 - 'questing' has been fully replaced with 'questOptions'.
|
||||
* The field for 'legacyResources' has been removed.
|
||||
*/
|
||||
private static int version() {
|
||||
return 5;
|
||||
return 6;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -245,11 +247,8 @@ public class ConfigContainer {
|
||||
public boolean staminaUsage = true;
|
||||
public boolean energyUsage = true;
|
||||
public boolean fishhookTeleport = true;
|
||||
@SerializedName("questOptions")
|
||||
@SerializedName(value = "questing", alternate = "questOptions")
|
||||
public Questing questing = new Questing();
|
||||
@Deprecated(forRemoval = true)
|
||||
@SerializedName("questing")
|
||||
public boolean questingEnabled = true;
|
||||
public ResinOptions resinOptions = new ResinOptions();
|
||||
public Rates rates = new Rates();
|
||||
|
||||
@@ -281,8 +280,6 @@ public class ConfigContainer {
|
||||
public static class Questing {
|
||||
/* Should questing behavior be used? */
|
||||
public boolean enabled = true;
|
||||
/* Are older resources being used? */
|
||||
public boolean legacyResources = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,26 +43,6 @@ public class QuestManager extends BasePlayerManager {
|
||||
eventExecutor = new ThreadPoolExecutor(4, 4,
|
||||
60, TimeUnit.SECONDS, new LinkedBlockingDeque<>(1000),
|
||||
FastThreadLocalThread::new, new ThreadPoolExecutor.AbortPolicy());
|
||||
|
||||
var options = GAME_OPTIONS.questing;
|
||||
if (options.enabled) {
|
||||
if (options.legacyResources) {
|
||||
Grasscutter.getLogger().debug("You have 'legacyResources' enabled.");
|
||||
Grasscutter.getLogger().debug("This assumes you are using older (3.2) QuestExcelConfigData and MainQuestExcelConfigData.");
|
||||
Grasscutter.getLogger().debug("The game will *break* if you are not using these older excels.");
|
||||
Grasscutter.getLogger().debug("Questing should feel more natural in this mode.");
|
||||
} else {
|
||||
Grasscutter.getLogger().debug("You have 'legacyResources' disabled.");
|
||||
Grasscutter.getLogger().debug("This should be enabled if you are using 3.3 or newer resources.");
|
||||
Grasscutter.getLogger().debug("The game can potentially encounter issues in this mode.");
|
||||
}
|
||||
}
|
||||
|
||||
//noinspection removal
|
||||
if (GAME_OPTIONS.questingEnabled) {
|
||||
Grasscutter.getLogger().warn("Please upgrade your configuration. 'questing' is being deprecated in favor of 'questOptions'.");
|
||||
Grasscutter.getLogger().info("To remove this message until removal, use 'questingEnabled' instead of 'questOptions.enabled'.");
|
||||
}
|
||||
}
|
||||
/*
|
||||
On SetPlayerBornDataReq, the server sends FinishedParentQuestNotify, with this exact
|
||||
@@ -128,7 +108,9 @@ public class QuestManager extends BasePlayerManager {
|
||||
|
||||
// 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.
|
||||
30800, // Quest which is responsible for unlocking Sparks Amongst the Pages.
|
||||
|
||||
47001, 47002, 47003, 47004
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -146,11 +128,7 @@ public class QuestManager extends BasePlayerManager {
|
||||
// 3. ServerCondMeetQuestListUpdateNotify
|
||||
|
||||
if (this.isQuestingEnabled()) {
|
||||
if (GAME_OPTIONS.questing.legacyResources) {
|
||||
this.enableQuests(); // This assumes 3.2 resources, where all conditions are known.
|
||||
} else {
|
||||
this.addQuest(35104); // This assumes resources greater than 3.2, where quests might have unknown conditions.
|
||||
}
|
||||
this.enableQuests();
|
||||
}
|
||||
|
||||
// this.getPlayer().sendPacket(new PacketFinishedParentQuestUpdateNotify(newQuests));
|
||||
@@ -447,6 +425,14 @@ public class QuestManager extends BasePlayerManager {
|
||||
}
|
||||
|
||||
if (shouldAccept) {
|
||||
Grasscutter.getLogger().debug("Quest {} was accepted because {} {} met.",
|
||||
questData.getId(),
|
||||
questData.getAcceptCond().stream()
|
||||
.map(p -> p.getType().name())
|
||||
.collect(Collectors.joining(", ")),
|
||||
questData.getAcceptCond()
|
||||
.size() > 1 ? "were" : "was");
|
||||
|
||||
GameQuest quest = owner.getQuestManager().addQuest(questData);
|
||||
Grasscutter.getLogger().debug("Added quest {} result {}", questData.getSubId(), quest != null);
|
||||
}
|
||||
|
||||
@@ -45,11 +45,11 @@ public class QuestSystem extends BaseGameSystem {
|
||||
var handlerClasses = reflections.getSubTypesOf(clazz);
|
||||
|
||||
for (var obj : handlerClasses) {
|
||||
this.registerPacketHandler(map, obj);
|
||||
this.registerHandler(map, obj);
|
||||
}
|
||||
}
|
||||
|
||||
public <T> void registerPacketHandler(Int2ObjectMap<T> map, Class<? extends T> handlerClass) {
|
||||
public <T> void registerHandler(Int2ObjectMap<T> map, Class<? extends T> handlerClass) {
|
||||
try {
|
||||
int value = 0;
|
||||
if (handlerClass.isAnnotationPresent(QuestValueExec.class)) {
|
||||
|
||||
Reference in New Issue
Block a user