mirror of
https://github.com/Equicord/Equicord.git
synced 2025-04-01 13:11:57 -04:00
Add files via upload
This commit is contained in:
parent
0afd3b2eb5
commit
63ad4da197
2 changed files with 65 additions and 24 deletions
|
@ -16,8 +16,8 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import "./styles.css";
|
||||||
import "@equicordplugins/_misc/styles.css";
|
import "@equicordplugins/_misc/styles.css";
|
||||||
|
|
||||||
import { showNotification } from "@api/Notifications";
|
import { showNotification } from "@api/Notifications";
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
|
@ -25,27 +25,30 @@ import { getTheme, Theme } from "@utils/discord";
|
||||||
import { classes } from "@utils/misc";
|
import { classes } from "@utils/misc";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
import { findByProps, findExportedComponentLazy } from "@webpack";
|
import { findByProps, findExportedComponentLazy } from "@webpack";
|
||||||
import { Button, FluxDispatcher, Forms, RestAPI, Tooltip, UserStore } from "@webpack/common";
|
import { addServerListElement, removeServerListElement, ServerListRenderPosition } from "@api/ServerList";
|
||||||
|
import { Button, FluxDispatcher, NavigationRouter, Forms, 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/");
|
||||||
|
|
||||||
function ToolBarQuestsIcon() {
|
function ToolBarQuestsIcon() {
|
||||||
return (
|
return (
|
||||||
<svg
|
<svg
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
width="24"
|
width="25"
|
||||||
height="24"
|
height="25"
|
||||||
className={classes("vc-quest-completer-icon")}
|
fill="none"
|
||||||
viewBox="0 0 15 15"
|
className="vc-quest-completer-icon"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
fill="currentColor"
|
fill="#4682B4"
|
||||||
d="M 11.54 11.92 L 13.32 12.9 L 12.46 14.48 L 10.52 13.04 A 6.252 6.252 0 0 1 9.322 13.823 A 7.504 7.504 0 0 1 8.78 14.07 Q 7.78 14.48 6.5 14.48 A 6.964 6.964 0 0 1 4.93 14.31 A 5.746 5.746 0 0 1 3.77 13.91 Q 2.56 13.34 1.72 12.35 A 6.826 6.826 0 0 1 0.526 10.285 A 7.857 7.857 0 0 1 0.44 10.04 Q 0 8.72 0 7.22 A 9.35 9.35 0 0 1 0.22 5.153 A 7.663 7.663 0 0 1 0.78 3.53 Q 1.56 1.9 3.01 0.95 A 5.732 5.732 0 0 1 5.225 0.102 A 7.655 7.655 0 0 1 6.5 0 A 7.084 7.084 0 0 1 8.07 0.168 A 5.816 5.816 0 0 1 9.23 0.56 Q 10.44 1.12 11.28 2.12 A 7.2 7.2 0 0 1 12.569 4.418 A 9.549 9.549 0 0 1 12.57 4.42 A 8.288 8.288 0 0 1 13.004 6.665 A 9.643 9.643 0 0 1 13.02 7.22 A 9.325 9.325 0 0 1 12.936 8.507 Q 12.841 9.186 12.64 9.766 A 5.548 5.548 0 0 1 12.58 9.93 Q 12.14 11.08 11.54 11.92 Z M 9.1 12.14 L 7.58 11.18 L 8.38 9.72 L 10.18 11.02 Q 10.66 10.24 10.87 9.31 A 8.288 8.288 0 0 0 11.034 8.257 A 11.143 11.143 0 0 0 11.08 7.22 Q 11.08 6.14 10.77 5.14 A 5.929 5.929 0 0 0 10.013 3.551 A 5.561 5.561 0 0 0 9.87 3.35 Q 9.28 2.56 8.43 2.1 A 3.833 3.833 0 0 0 6.97 1.663 A 4.738 4.738 0 0 0 6.5 1.64 A 4.737 4.737 0 0 0 5.262 1.795 A 3.768 3.768 0 0 0 4.04 2.37 A 4.51 4.51 0 0 0 2.661 3.979 A 5.506 5.506 0 0 0 2.48 4.36 A 6.618 6.618 0 0 0 2.01 6.114 A 8.493 8.493 0 0 0 1.94 7.22 Q 1.94 8.3 2.24 9.31 Q 2.54 10.32 3.12 11.12 Q 3.7 11.92 4.54 12.38 Q 5.38 12.84 6.46 12.84 A 5.835 5.835 0 0 0 7.289 12.784 A 4.587 4.587 0 0 0 7.95 12.64 Q 8.609 12.443 9.084 12.15 A 3.467 3.467 0 0 0 9.1 12.14 Z"
|
d="M7.5 21.7a8.95 8.95 0 0 1 9 0 1 1 0 0 0 1-1.73c-.6-.35-1.24-.64-1.9-.87.54-.3 1.05-.65 1.52-1.07a3.98 3.98 0 0 0 5.49-1.8.77.77 0 0 0-.24-.95 3.98 3.98 0 0 0-2.02-.76A4 4 0 0 0 23 10.47a.76.76 0 0 0-.71-.71 4.06 4.06 0 0 0-1.6.22 3.99 3.99 0 0 0 .54-5.35.77.77 0 0 0-.95-.24c-.75.36-1.37.95-1.77 1.67V6a4 4 0 0 0-4.9-3.9.77.77 0 0 0-.6.72 4 4 0 0 0 3.7 4.17c.89 1.3 1.3 2.95 1.3 4.51 0 3.66-2.75 6.5-6 6.5s-6-2.84-6-6.5c0-1.56.41-3.21 1.3-4.51A4 4 0 0 0 11 2.82a.77.77 0 0 0-.6-.72 4.01 4.01 0 0 0-4.9 3.96A4.02 4.02 0 0 0 3.73 4.4a.77.77 0 0 0-.95.24 3.98 3.98 0 0 0 .55 5.35 4 4 0 0 0-1.6-.22.76.76 0 0 0-.72.71l-.01.28a4 4 0 0 0 2.65 3.77c-.75.06-1.45.33-2.02.76-.3.22-.4.62-.24.95a4 4 0 0 0 5.49 1.8c.47.42.98.78 1.53 1.07-.67.23-1.3.52-1.91.87a1 1 0 1 0 1 1.73Z"
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function ToolBarHeader() {
|
function ToolBarHeader() {
|
||||||
return (
|
return (
|
||||||
<ErrorBoundary noop={true}>
|
<ErrorBoundary noop={true}>
|
||||||
|
@ -66,11 +69,13 @@ async function openCompleteQuestUI() {
|
||||||
const RunningGameStore = findByProps("getRunningGames");
|
const RunningGameStore = findByProps("getRunningGames");
|
||||||
const QuestsStore = findByProps("getQuest");
|
const QuestsStore = findByProps("getQuest");
|
||||||
const quest = [...QuestsStore.quests.values()].find(x => x.id !== "1248385850622869556" && x.userStatus?.enrolledAt && !x.userStatus?.completedAt && new Date(x.config.expiresAt).getTime() > Date.now());
|
const quest = [...QuestsStore.quests.values()].find(x => x.id !== "1248385850622869556" && x.userStatus?.enrolledAt && !x.userStatus?.completedAt && new Date(x.config.expiresAt).getTime() > Date.now());
|
||||||
|
|
||||||
if (!quest) {
|
if (!quest) {
|
||||||
showNotification({
|
showNotification({
|
||||||
title: "Quest Completer",
|
title: "Quest Completer",
|
||||||
body: "No Quests To Complete",
|
body: "No Quests To Complete",
|
||||||
|
onClick() {
|
||||||
|
NavigationRouter.transitionTo("/discovery/quests");
|
||||||
|
},
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const pid = Math.floor(Math.random() * 30000) + 1000;
|
const pid = Math.floor(Math.random() * 30000) + 1000;
|
||||||
|
@ -233,6 +238,12 @@ 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>
|
||||||
</>,
|
</>,
|
||||||
|
start() {
|
||||||
|
addServerListElement(ServerListRenderPosition.Above, this.renderQuestButton);
|
||||||
|
},
|
||||||
|
stop() {
|
||||||
|
removeServerListElement(ServerListRenderPosition.Above, this.renderQuestButton);
|
||||||
|
},
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: "\"invite-button\"",
|
find: "\"invite-button\"",
|
||||||
|
@ -244,25 +255,30 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: "toolbar:function",
|
find: "toolbar:function",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(function \i\(\i\){)(.{1,200}toolbar.{1,300}mobileToolbar)/,
|
match: /(function\s+\w+\s*\([\w\s,]*\)\s*\{)([\s\S]{1,500}toolbar[\s\S]{1,500}mobileToolbar)/,
|
||||||
replace: "$1$self.toolbarAction(arguments[0]);$2"
|
replace: "$1$self.toolbarAction(arguments[0]);$2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
renderQuestButton() {
|
renderQuestButton() {
|
||||||
return (
|
return (
|
||||||
<Tooltip text="Complete Quest">
|
<ErrorBoundary noop>
|
||||||
{tooltipProps => (
|
<div id="vc-questbutton-container">
|
||||||
<Button style={{ backgroundColor: "transparent" }}
|
<Tooltip text="Complete Quest" position="right">
|
||||||
{...tooltipProps}
|
{({ onMouseEnter, onMouseLeave }) => (
|
||||||
size={"25"}
|
<div
|
||||||
className={"vc-quest-completer-icon"}
|
id="vc-questbutton"
|
||||||
onClick={openCompleteQuestUI}
|
onMouseEnter={onMouseEnter}
|
||||||
>
|
onMouseLeave={onMouseLeave}
|
||||||
<ToolBarQuestsIcon />
|
onClick={openCompleteQuestUI}
|
||||||
</Button>
|
style={{ backgroundColor: 'transparent' }}
|
||||||
)}
|
>
|
||||||
</Tooltip>
|
<ToolBarQuestsIcon />
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</Tooltip>
|
||||||
|
</div>
|
||||||
|
</ErrorBoundary>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
toolbarAction(e) {
|
toolbarAction(e) {
|
||||||
|
|
25
src/equicordplugins/questCompleter/styles.css
Normal file
25
src/equicordplugins/questCompleter/styles.css
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#vc-questbutton-container {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#vc-questbutton {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background-color: var(--background-primary);
|
||||||
|
height: 48px;
|
||||||
|
width: 48px;
|
||||||
|
border-radius: 100%;
|
||||||
|
transition: border-radius 0.15s ease-out, background-color 0.15s ease-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
#vc-questbutton:hover {
|
||||||
|
border-radius: 34%;
|
||||||
|
background-color: var(--blue-360);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue