Questify: Fix a patch & add new settings. (#486)

* Patch fixes and additions, new disable feature.

* Fix.

* Add volume setting.

* Split disable discovery/DMs Quest tab settings.

* Make patch less broad.
This commit is contained in:
Etorix 2025-11-09 06:12:57 -08:00 • committed by GitHub
parent 9c3ab5d9dc
commit 40ad93115f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 129 additions and 18 deletions

View file

@ -164,6 +164,18 @@ function shouldHideDiscoveryTab(): boolean {
return disableQuestsDiscoveryTab || disableQuestsEverything;
}
function shouldHideDirectMessagesTab(): boolean {
const {
disableQuestsDirectMessagesTab,
disableQuestsEverything
} = settings.use([
"disableQuestsDirectMessagesTab",
"disableQuestsEverything"
]);
return disableQuestsDirectMessagesTab || disableQuestsEverything;
}
function shouldHideBadgeOnUserProfiles(): boolean {
const {
disableQuestsBadgeOnUserProfiles,
@ -207,6 +219,18 @@ function shouldHideFriendsListActiveNowPromotion(): boolean {
return disableFriendsListActiveNowPromotion || disableQuestsEverything;
}
function shouldHideMembersListActivelyPlayingIcon(): boolean {
const {
disableMembersListActivelyPlayingIcon,
disableQuestsEverything
} = settings.use([
"disableMembersListActivelyPlayingIcon",
"disableQuestsEverything"
]);
return disableMembersListActivelyPlayingIcon || disableQuestsEverything;
}
function shouldDisableQuestTileOptions(quest: Quest, shouldBeIgnored: boolean): boolean {
const isIgnored = questIsIgnored(quest.id);
@ -883,10 +907,12 @@ export default definePlugin({
shouldHideQuestPopup,
shouldHideDiscoveryTab,
shouldPreloadQuestAssets,
shouldHideDirectMessagesTab,
shouldPreventFetchingQuests,
shouldHideBadgeOnUserProfiles,
shouldHideGiftInventoryRelocationNotice,
shouldHideFriendsListActiveNowPromotion,
shouldHideMembersListActivelyPlayingIcon,
processQuestForAutoComplete,
getQuestAcceptedButtonProps,
getQuestAcceptedButtonText,
@ -911,15 +937,52 @@ export default definePlugin({
{
// Hides Quests tab in the Discovery page.
find: "GlobalDiscoverySidebar",
replacement: [
{
match: /(GLOBAL_DISCOVERY_TABS).map/,
replace: '$1.filter(tab=>!(tab==="quests"&&$self.shouldHideDiscoveryTab())).map'
}
]
},
{
// Hides Quests tab in the DMs tab list.
find: "QUEST_HOME_V2):",
replacement: [
{
match: /(?<="family-center"\):null,\i)/,
replace: "||$self.shouldHideDirectMessagesTab()"
}
]
},
{
// Hides the Quest icon from members list items when
// a user is playing a game tied to an active Quest.
find: "HANG_STATUS});",
group: true,
replacement: [
{
match: /(let \i=function\(\){)/,
replace: "$1const shouldHideDiscoveryTab=$self.shouldHideDiscoveryTab();"
match: /(?=if\(\(0,.{0,30}?isBlockedOrIgnored)/,
replace: "const shouldHideMembersListActivelyPlayingIcon=$self.shouldHideMembersListActivelyPlayingIcon();"
},
{
match: /(GLOBAL_DISCOVERY_TABS).map/,
replace: '$1.filter(tab=>!(tab==="quests"&&shouldHideDiscoveryTab)).map'
match: /(?<=}\),\i\(\),\i&&)/,
replace: "!shouldHideMembersListActivelyPlayingIcon&&"
}
]
},
{
// Same as above, probably? Not sure when
// each function is used, so patching both.
find: "iconOnly)},",
group: true,
replacement: [
{
match: /(?=if\(\i\)return null;let \i=function)/,
replace: "const shouldHideMembersListActivelyPlayingIcon=$self.shouldHideMembersListActivelyPlayingIcon();"
},
{
match: /(?<=}\),\i\(\),\i&&)/,
replace: "!shouldHideMembersListActivelyPlayingIcon&&"
}
]
},
@ -983,8 +1046,8 @@ export default definePlugin({
},
{
// QUESTS_FETCH_QUEST_TO_DELIVER_BEGIN
match: /"QUESTS_FETCH_QUEST_TO_DELIVER_BEGIN",placement:\i\}\);/,
replace: "$&if($self.shouldPreventFetchingQuests())return;"
match: /(?=var.{0,150}QUESTS_FETCH_QUEST_TO_DELIVER_BEGIN)/,
replace: "if($self.shouldPreventFetchingQuests())return;"
}
]
},

View file

@ -8,8 +8,8 @@ import { defaultAudioNames, playAudio } from "@api/AudioPlayer";
import { definePluginSettings } from "@api/Settings";
import { Divider, ErrorBoundary, Heading, Paragraph } from "@components/index";
import { Logger } from "@utils/Logger";
import { OptionType } from "@utils/types";
import { Button, ColorPicker, ContextMenuApi, Menu, Select, TextInput, useEffect, useRef, useState } from "@webpack/common";
import { makeRange, OptionType } from "@utils/types";
import { Button, ColorPicker, ContextMenuApi, Menu, Select, Slider, TextInput, useEffect, useRef, useState } from "@webpack/common";
import { JSX } from "react";
import { activeQuestIntervals, getQuestTileClasses, getQuestTileStyle } from "./index";
@ -72,7 +72,7 @@ export function fetchAndAlertQuests(source: string, logger: Logger): void {
if (shouldAlert && newOnlyFiltered.length > 0) {
logger.info(`[${getFormattedNow()}] New Quests detected. Playing alert sound.`);
playAudio(shouldAlert);
playAudio(shouldAlert, { volume: settings.store.fetchingQuestsAlertVolume });
} else {
logger.info(`[${getFormattedNow()}] New Quests detected.`);
}
@ -367,21 +367,25 @@ function validateDisableQuestSetting() {
disableQuestsEverything,
disableQuestsDiscoveryTab,
disableQuestsFetchingQuests,
disableQuestsDirectMessagesTab,
disableQuestsPopupAboveAccountPanel,
disableQuestsBadgeOnUserProfiles,
disableQuestsGiftInventoryRelocationNotice,
disableFriendsListActiveNowPromotion
disableFriendsListActiveNowPromotion,
disableMembersListActivelyPlayingIcon
} = settings.use([
"disableQuestsEverything",
"disableQuestsDiscoveryTab",
"disableQuestsFetchingQuests",
"disableQuestsDirectMessagesTab",
"disableQuestsPopupAboveAccountPanel",
"disableQuestsBadgeOnUserProfiles",
"disableQuestsGiftInventoryRelocationNotice",
"disableFriendsListActiveNowPromotion"
"disableFriendsListActiveNowPromotion",
"disableMembersListActivelyPlayingIcon"
]);
if (disableQuestsDiscoveryTab || disableQuestsFetchingQuests || disableQuestsPopupAboveAccountPanel || disableQuestsBadgeOnUserProfiles || disableQuestsGiftInventoryRelocationNotice || disableFriendsListActiveNowPromotion) {
if (disableQuestsDiscoveryTab || disableQuestsDirectMessagesTab || disableQuestsFetchingQuests || disableQuestsPopupAboveAccountPanel || disableQuestsBadgeOnUserProfiles || disableQuestsGiftInventoryRelocationNotice || disableFriendsListActiveNowPromotion || disableMembersListActivelyPlayingIcon) {
settings.store.disableQuestsEverything = false;
}
}
@ -668,10 +672,12 @@ function DisableQuestsSetting(): JSX.Element {
disableQuestsEverything,
disableQuestsDiscoveryTab,
disableQuestsFetchingQuests,
disableQuestsDirectMessagesTab,
disableQuestsPopupAboveAccountPanel,
disableQuestsBadgeOnUserProfiles,
disableQuestsGiftInventoryRelocationNotice,
disableFriendsListActiveNowPromotion,
disableMembersListActivelyPlayingIcon,
makeMobileQuestsDesktopCompatible,
completeVideoQuestsInBackground,
completeGameQuestsInBackground,
@ -680,10 +686,12 @@ function DisableQuestsSetting(): JSX.Element {
"disableQuestsEverything",
"disableQuestsDiscoveryTab",
"disableQuestsFetchingQuests",
"disableQuestsDirectMessagesTab",
"disableQuestsPopupAboveAccountPanel",
"disableQuestsBadgeOnUserProfiles",
"disableQuestsGiftInventoryRelocationNotice",
"disableFriendsListActiveNowPromotion",
"disableMembersListActivelyPlayingIcon",
"makeMobileQuestsDesktopCompatible",
"completeVideoQuestsInBackground",
"completeGameQuestsInBackground",
@ -693,11 +701,13 @@ function DisableQuestsSetting(): JSX.Element {
const options: DynamicDropdownSettingOption[] = [
{ label: "Disable Everything", value: "everything", selected: disableQuestsEverything, type: "disable" },
{ label: "Disable Fetching Quests", value: "fetching", selected: disableQuestsFetchingQuests, type: "disable" },
{ label: "Disable Discovery Quests Tab", value: "discovery", selected: disableQuestsDiscoveryTab, type: "disable" },
{ label: "Disable Quests Tab in DMs", value: "dms", selected: disableQuestsDirectMessagesTab, type: "disable" },
{ label: "Disable Badge on User Profiles", value: "badge", selected: disableQuestsBadgeOnUserProfiles, type: "disable" },
{ label: "Disable Popup Above User Panel", value: "popup", selected: disableQuestsPopupAboveAccountPanel, type: "disable" },
{ label: "Disable Discovery Tab Relocation Notice", value: "discovery", selected: disableQuestsDiscoveryTab, type: "disable" },
{ label: "Disable Gift Inventory Relocation Notice", value: "inventory", selected: disableQuestsGiftInventoryRelocationNotice, type: "disable" },
{ label: "Disable Friends List Active Now Promotion", value: "friends-list", selected: disableFriendsListActiveNowPromotion, type: "disable" },
{ label: "Disable Members List Actively Playing Icon", value: "members-list", selected: disableMembersListActivelyPlayingIcon, type: "disable" },
{ label: "Make Mobile Quests Desktop Compatible", value: "mobile-desktop-compatible", selected: makeMobileQuestsDesktopCompatible, type: "modification" },
{ label: "Complete Game Quests in Background", value: "game-quests-background", selected: completeGameQuestsInBackground, type: "modification" },
{ label: "Complete Video Quests in Background", value: "video-quests-background", selected: completeVideoQuestsInBackground, type: "modification" },
@ -724,10 +734,12 @@ function DisableQuestsSetting(): JSX.Element {
settings.store.disableQuestsEverything = enabledValues.includes("everything");
settings.store.disableQuestsDiscoveryTab = enabledValues.includes("discovery");
settings.store.disableQuestsFetchingQuests = enabledValues.includes("fetching");
settings.store.disableQuestsDirectMessagesTab = enabledValues.includes("dms");
settings.store.disableQuestsPopupAboveAccountPanel = enabledValues.includes("popup");
settings.store.disableQuestsBadgeOnUserProfiles = enabledValues.includes("badge");
settings.store.disableQuestsGiftInventoryRelocationNotice = enabledValues.includes("inventory");
settings.store.disableFriendsListActiveNowPromotion = enabledValues.includes("friends-list");
settings.store.disableMembersListActivelyPlayingIcon = enabledValues.includes("members-list");
settings.store.makeMobileQuestsDesktopCompatible = enabledValues.includes("mobile-desktop-compatible");
settings.store.completeGameQuestsInBackground = enabledValues.includes("game-quests-background");
settings.store.completeVideoQuestsInBackground = enabledValues.includes("video-quests-background");
@ -1553,7 +1565,7 @@ function FetchingQuestsSetting(): JSX.Element {
if (activePlayer.current) {
clearActivePlayer();
} else {
activePlayer.current = playAudio(currentAlertSelection.value as string, { onEnded: clearActivePlayer });
activePlayer.current = playAudio(currentAlertSelection.value as string, { onEnded: clearActivePlayer, volume: settings.store.fetchingQuestsAlertVolume });
setIsPlaying(true);
}
}
@ -1563,6 +1575,16 @@ function FetchingQuestsSetting(): JSX.Element {
{SoundIcon(24, 24)}
</div>
</div>
<div className={q("sub-inline-group")}>
<div className={q("inline-group-item", "volume-slider-container")}>
<Slider
markers={makeRange(0, 100, 10)}
initialValue={settings.store.fetchingQuestsAlertVolume}
onValueChange={val => { settings.store.fetchingQuestsAlertVolume = val; }}
className={q("volume-slider")}
/>
</div>
</div>
</div>
</section>
</div>
@ -1594,6 +1616,12 @@ export const settings = definePluginSettings({
default: false,
hidden: true
},
disableQuestsDirectMessagesTab: {
type: OptionType.BOOLEAN,
description: "Disable Quest tab in Direct Messages.",
default: false,
hidden: true
},
disableQuestsPopupAboveAccountPanel: {
type: OptionType.BOOLEAN,
description: "Disable the Quest popup above your account panel.",
@ -1618,6 +1646,12 @@ export const settings = definePluginSettings({
default: true,
hidden: true
},
disableMembersListActivelyPlayingIcon: {
type: OptionType.BOOLEAN,
description: "Disable the actively playing icon in members list items.",
default: true,
hidden: true
},
makeMobileQuestsDesktopCompatible: {
type: OptionType.BOOLEAN,
description: "Make mobile-only Quests compatible with desktop.",
@ -1756,6 +1790,12 @@ export const settings = definePluginSettings({
default: defaultFetchQuestsAlert, // Item from predefined list or a URL to CSP valid audio file.
hidden: true
},
fetchingQuestsAlertVolume: {
type: OptionType.NUMBER,
description: "The volume for the new Quest alert sound.",
default: 100, // 0 - 100
hidden: true
},
restyleQuests: {
type: OptionType.COMPONENT,
component: RestyleQuestsSetting,

View file

@ -46,10 +46,18 @@
font-size: 14px;
}
.questify-select {
border-radius: 3px !important; /* Necessary !important */
margin-top: 8px;
min-height: 45px;
.questify-select > div {
border-radius: 3px;
min-height: 43px;
border: 1px solid var(--border-normal);
}
.questify-volume-slider-container {
margin: 8px 0 0;
background-color: var(--input-background);
padding: 7px 12px 7px 7px;
border-radius: 3px;
border: 1px solid var(--border-normal);
}
.questify-inline-group-item .questify-select {