mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-07 21:53:04 -04:00
Soggy Fixes
Co-Authored-By: sliwka <116428267+s-liwka@users.noreply.github.com>
This commit is contained in:
parent
c7298da33b
commit
55ef4b2ffe
1 changed files with 32 additions and 16 deletions
|
@ -14,11 +14,12 @@ import { React } from "@webpack/common";
|
||||||
|
|
||||||
const HeaderBarIcon = findComponentByCodeLazy(".HEADER_BAR_BADGE_TOP:", '.iconBadge,"top"');
|
const HeaderBarIcon = findComponentByCodeLazy(".HEADER_BAR_BADGE_TOP:", '.iconBadge,"top"');
|
||||||
|
|
||||||
|
let song, boopSound;
|
||||||
|
|
||||||
function SoggyModal(props: ModalProps) {
|
function SoggyModal(props: ModalProps) {
|
||||||
if (settings.store.enableSong) {
|
if (settings.store.songVolume !== 0) {
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
const song = document.createElement("audio");
|
song.volume = settings.store.songVolume;
|
||||||
song.src = settings.store.songLink;
|
|
||||||
song.play();
|
song.play();
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
@ -29,19 +30,18 @@ function SoggyModal(props: ModalProps) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const boop = (e: React.MouseEvent<HTMLImageElement>) => {
|
const boop = (e: React.MouseEvent<HTMLImageElement>) => {
|
||||||
const img = e.currentTarget;
|
|
||||||
const { offsetX, offsetY } = e.nativeEvent;
|
const { offsetX, offsetY } = e.nativeEvent;
|
||||||
|
|
||||||
const region = { x: 155, y: 220, width: 70, height: 70 };
|
const region = { x: 155, y: 220, width: 70, height: 70 };
|
||||||
|
|
||||||
if (
|
if (
|
||||||
settings.store.enableBoop &&
|
settings.store.boopVolume !== 0 &&
|
||||||
offsetX >= region.x &&
|
offsetX >= region.x &&
|
||||||
offsetX <= region.x + region.width &&
|
offsetX <= region.x + region.width &&
|
||||||
offsetY >= region.y &&
|
offsetY >= region.y &&
|
||||||
offsetY <= region.y + region.height
|
offsetY <= region.y + region.height
|
||||||
) {
|
) {
|
||||||
const boopSound = new Audio(settings.store.boopLink);
|
boopSound.volume = settings.store.boopVolume;
|
||||||
boopSound.play();
|
boopSound.play();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -84,15 +84,20 @@ function SoggyButton() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const settings = definePluginSettings({
|
const settings = definePluginSettings({
|
||||||
enableSong: {
|
songVolume: {
|
||||||
description: "Enable the song that plays after clicking the button",
|
description: "Volume of the song. 0 to disable",
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.SLIDER,
|
||||||
default: true,
|
default: 0.25,
|
||||||
|
markers: [0, 0.25, 0.5, 0.75, 1],
|
||||||
|
stickToMarkers: false,
|
||||||
|
|
||||||
},
|
},
|
||||||
enableBoop: {
|
boopVolume: {
|
||||||
description: "Let's you boop soggy's nose",
|
description: "Volume of the boop sound",
|
||||||
type: OptionType.BOOLEAN,
|
type: OptionType.SLIDER,
|
||||||
default: true,
|
default: 0.2,
|
||||||
|
markers: [0, 0.25, 0.5, 0.75, 1],
|
||||||
|
stickToMarkers: false,
|
||||||
},
|
},
|
||||||
tooltipText: {
|
tooltipText: {
|
||||||
description: "The text shown when hovering over the button",
|
description: "The text shown when hovering over the button",
|
||||||
|
@ -107,12 +112,18 @@ const settings = definePluginSettings({
|
||||||
songLink: {
|
songLink: {
|
||||||
description: "URL for the song to play",
|
description: "URL for the song to play",
|
||||||
type: OptionType.STRING,
|
type: OptionType.STRING,
|
||||||
default: "https://incompetech.com/music/royalty-free/mp3-royaltyfree/Sneaky%20Snitch.mp3",
|
default: "https://github.com/Equicord/Equibored/raw/main/sounds/soggy/song.mp3?raw=true",
|
||||||
|
onChange: (value: string) => {
|
||||||
|
song = new Audio(value);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
boopLink: {
|
boopLink: {
|
||||||
description: "URL for the boop sound",
|
description: "URL for the boop sound",
|
||||||
type: OptionType.STRING,
|
type: OptionType.STRING,
|
||||||
default: "https://github.com/Capeling/soggy-mod/raw/refs/heads/main/resources/honk.wav",
|
default: "https://github.com/Equicord/Equibored/raw/main/sounds/soggy/honk.wav?raw=true",
|
||||||
|
onChange: (value: string) => {
|
||||||
|
boopSound = new Audio(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -131,6 +142,11 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
start: () => {
|
||||||
|
song = new Audio(settings.store.songLink);
|
||||||
|
boopSound = new Audio(settings.store.boopLink);
|
||||||
|
},
|
||||||
|
|
||||||
// taken from message logger lol
|
// taken from message logger lol
|
||||||
addIconToToolBar(e: { toolbar: React.ReactNode[] | React.ReactNode; }) {
|
addIconToToolBar(e: { toolbar: React.ReactNode[] | React.ReactNode; }) {
|
||||||
if (Array.isArray(e.toolbar))
|
if (Array.isArray(e.toolbar))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue