mirror of
https://github.com/Equicord/Equicord.git
synced 2025-04-01 13:11:57 -04:00
Add Some QuestCompleter Stuff
Co-Authored-By: Eazvy <57739965+eazvy@users.noreply.github.com>
This commit is contained in:
parent
3ca1a13289
commit
b8d481bfa6
1 changed files with 28 additions and 4 deletions
|
@ -23,14 +23,16 @@ import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { getTheme, Theme } from "@utils/discord";
|
import { getTheme, Theme } from "@utils/discord";
|
||||||
import { classes } from "@utils/misc";
|
import { classes } from "@utils/misc";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
import { findByProps, findExportedComponentLazy } from "@webpack";
|
import { findByProps, findExportedComponentLazy } from "@webpack";
|
||||||
import { Button, FluxDispatcher, Forms, RestAPI, Tooltip, UserStore } from "@webpack/common";
|
import { Button, FluxDispatcher, Forms, NavigationRouter, RestAPI, Tooltip, UserStore } from "@webpack/common";
|
||||||
const HeaderBarIcon = findExportedComponentLazy("Icon", "Divider");
|
const HeaderBarIcon = findExportedComponentLazy("Icon", "Divider");
|
||||||
const isApp = navigator.userAgent.includes("Electron/");
|
const isApp = navigator.userAgent.includes("Electron/");
|
||||||
|
|
||||||
import "./style.css";
|
import "./style.css";
|
||||||
|
|
||||||
|
import { definePluginSettings } from "@api/Settings";
|
||||||
|
|
||||||
function ToolBarQuestsIcon() {
|
function ToolBarQuestsIcon() {
|
||||||
return (
|
return (
|
||||||
<svg
|
<svg
|
||||||
|
@ -73,7 +75,10 @@ async function openCompleteQuestUI() {
|
||||||
if (!quest) {
|
if (!quest) {
|
||||||
showNotification({
|
showNotification({
|
||||||
title: "Quest Completer",
|
title: "Quest Completer",
|
||||||
body: "No Quests To Complete",
|
body: "No Quests To Complete. Click to navigate to the quests tab",
|
||||||
|
onClick() {
|
||||||
|
NavigationRouter.transitionTo("/discovery/quests");
|
||||||
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const pid = Math.floor(Math.random() * 30000) + 1000;
|
const pid = Math.floor(Math.random() * 30000) + 1000;
|
||||||
|
@ -227,6 +232,15 @@ async function openCompleteQuestUI() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const settings = definePluginSettings({
|
||||||
|
clickableQuestDiscovery: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Makes the quest button in discovery clickable",
|
||||||
|
restartNeeded: true,
|
||||||
|
default: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "QuestCompleter",
|
name: "QuestCompleter",
|
||||||
description: "A plugin to complete quests without having the game installed.",
|
description: "A plugin to complete quests without having the game installed.",
|
||||||
|
@ -236,6 +250,7 @@ export default definePlugin({
|
||||||
Game Quests do not work on Equibop/Web Platforms. Only Video Quests do.
|
Game Quests do not work on Equibop/Web Platforms. Only Video Quests do.
|
||||||
</Forms.FormText>
|
</Forms.FormText>
|
||||||
</>,
|
</>,
|
||||||
|
settings,
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: "\"invite-button\"",
|
find: "\"invite-button\"",
|
||||||
|
@ -247,9 +262,17 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: "toolbar:function",
|
find: "toolbar:function",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(function \i\(\i\){)(.{1,200}toolbar.{1,300}mobileToolbar)/,
|
match: /(function \i\(\i\){)(.{1,500}toolbar.{1,500}mobileToolbar)/,
|
||||||
replace: "$1$self.toolbarAction(arguments[0]);$2"
|
replace: "$1$self.toolbarAction(arguments[0]);$2"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
find: "M7.5 21.7a8.95 8.95 0 0 1 9 0 1 1 0 0 0 1-1.73c",
|
||||||
|
replacement: {
|
||||||
|
match: /(?<=className:\i\}\))/,
|
||||||
|
replace: ",onClick:$self.openCompleteQuestUI()"
|
||||||
|
},
|
||||||
|
predicate: () => settings.store.clickableQuestDiscovery
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
renderQuestButton() {
|
renderQuestButton() {
|
||||||
|
@ -268,6 +291,7 @@ export default definePlugin({
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
openCompleteQuestUI,
|
||||||
toolbarAction(e) {
|
toolbarAction(e) {
|
||||||
if (Array.isArray(e.toolbar))
|
if (Array.isArray(e.toolbar))
|
||||||
return e.toolbar.push(
|
return e.toolbar.push(
|
||||||
|
|
Loading…
Add table
Reference in a new issue