diff --git a/src-electron/util/app-settings.ts b/src-electron/util/app-settings.ts index f114732d..bec723a7 100644 --- a/src-electron/util/app-settings.ts +++ b/src-electron/util/app-settings.ts @@ -95,6 +95,8 @@ export type Settings = { openOnUpload: boolean; uploadUnlisted: boolean; includeRegion: boolean; + uploadDiscord: boolean; + discordWebhook: string; }; damageMeter: { functionality: { @@ -187,6 +189,8 @@ const defaultSettings: Settings = { openOnUpload: false, uploadUnlisted: true, includeRegion: false, + uploadDiscord: false, + discordWebhook: "", }, damageMeter: { functionality: { diff --git a/src/assets/images/classes/101.png b/src/assets/images/classes/101.png new file mode 100644 index 00000000..6dc403e0 Binary files /dev/null and b/src/assets/images/classes/101.png differ diff --git a/src/assets/images/classes/102.png b/src/assets/images/classes/102.png new file mode 100644 index 00000000..3e4b0462 Binary files /dev/null and b/src/assets/images/classes/102.png differ diff --git a/src/assets/images/classes/103.png b/src/assets/images/classes/103.png new file mode 100644 index 00000000..4c60d8ed Binary files /dev/null and b/src/assets/images/classes/103.png differ diff --git a/src/assets/images/classes/104.png b/src/assets/images/classes/104.png new file mode 100644 index 00000000..55609db3 Binary files /dev/null and b/src/assets/images/classes/104.png differ diff --git a/src/assets/images/classes/105.png b/src/assets/images/classes/105.png new file mode 100644 index 00000000..fe80861b Binary files /dev/null and b/src/assets/images/classes/105.png differ diff --git a/src/assets/images/classes/111.png b/src/assets/images/classes/111.png new file mode 100644 index 00000000..4c3d7be5 Binary files /dev/null and b/src/assets/images/classes/111.png differ diff --git a/src/assets/images/classes/111.svg b/src/assets/images/classes/111.svg new file mode 100644 index 00000000..40b173d8 --- /dev/null +++ b/src/assets/images/classes/111.svg @@ -0,0 +1,60 @@ + \ No newline at end of file diff --git a/src/assets/images/classes/112.png b/src/assets/images/classes/112.png new file mode 100644 index 00000000..f526a2c6 Binary files /dev/null and b/src/assets/images/classes/112.png differ diff --git a/src/assets/images/classes/201.png b/src/assets/images/classes/201.png new file mode 100644 index 00000000..885583bc Binary files /dev/null and b/src/assets/images/classes/201.png differ diff --git a/src/assets/images/classes/202.png b/src/assets/images/classes/202.png new file mode 100644 index 00000000..294cbe77 Binary files /dev/null and b/src/assets/images/classes/202.png differ diff --git a/src/assets/images/classes/203.png b/src/assets/images/classes/203.png new file mode 100644 index 00000000..4045662c Binary files /dev/null and b/src/assets/images/classes/203.png differ diff --git a/src/assets/images/classes/204.png b/src/assets/images/classes/204.png new file mode 100644 index 00000000..d9d95e6a Binary files /dev/null and b/src/assets/images/classes/204.png differ diff --git a/src/assets/images/classes/205.png b/src/assets/images/classes/205.png new file mode 100644 index 00000000..25f9adcf Binary files /dev/null and b/src/assets/images/classes/205.png differ diff --git a/src/assets/images/classes/301.png b/src/assets/images/classes/301.png new file mode 100644 index 00000000..09ca1204 Binary files /dev/null and b/src/assets/images/classes/301.png differ diff --git a/src/assets/images/classes/302.png b/src/assets/images/classes/302.png new file mode 100644 index 00000000..baf3be8e Binary files /dev/null and b/src/assets/images/classes/302.png differ diff --git a/src/assets/images/classes/303.png b/src/assets/images/classes/303.png new file mode 100644 index 00000000..a26c5e04 Binary files /dev/null and b/src/assets/images/classes/303.png differ diff --git a/src/assets/images/classes/304.png b/src/assets/images/classes/304.png new file mode 100644 index 00000000..d53bb041 Binary files /dev/null and b/src/assets/images/classes/304.png differ diff --git a/src/assets/images/classes/305.png b/src/assets/images/classes/305.png new file mode 100644 index 00000000..d0f278a5 Binary files /dev/null and b/src/assets/images/classes/305.png differ diff --git a/src/assets/images/classes/311.png b/src/assets/images/classes/311.png new file mode 100644 index 00000000..c8ce0c59 Binary files /dev/null and b/src/assets/images/classes/311.png differ diff --git a/src/assets/images/classes/312.png b/src/assets/images/classes/312.png new file mode 100644 index 00000000..2ae8d94b Binary files /dev/null and b/src/assets/images/classes/312.png differ diff --git a/src/assets/images/classes/401.png b/src/assets/images/classes/401.png new file mode 100644 index 00000000..20149191 Binary files /dev/null and b/src/assets/images/classes/401.png differ diff --git a/src/assets/images/classes/402.png b/src/assets/images/classes/402.png new file mode 100644 index 00000000..003d4824 Binary files /dev/null and b/src/assets/images/classes/402.png differ diff --git a/src/assets/images/classes/403.png b/src/assets/images/classes/403.png new file mode 100644 index 00000000..751cb64e Binary files /dev/null and b/src/assets/images/classes/403.png differ diff --git a/src/assets/images/classes/404.png b/src/assets/images/classes/404.png new file mode 100644 index 00000000..78614b51 Binary files /dev/null and b/src/assets/images/classes/404.png differ diff --git a/src/assets/images/classes/501.png b/src/assets/images/classes/501.png new file mode 100644 index 00000000..f4e636c0 Binary files /dev/null and b/src/assets/images/classes/501.png differ diff --git a/src/assets/images/classes/502.png b/src/assets/images/classes/502.png new file mode 100644 index 00000000..cf8881b5 Binary files /dev/null and b/src/assets/images/classes/502.png differ diff --git a/src/assets/images/classes/503.png b/src/assets/images/classes/503.png new file mode 100644 index 00000000..f3e7659b Binary files /dev/null and b/src/assets/images/classes/503.png differ diff --git a/src/assets/images/classes/504.png b/src/assets/images/classes/504.png new file mode 100644 index 00000000..d50c46dc Binary files /dev/null and b/src/assets/images/classes/504.png differ diff --git a/src/assets/images/classes/505.png b/src/assets/images/classes/505.png new file mode 100644 index 00000000..d857828f Binary files /dev/null and b/src/assets/images/classes/505.png differ diff --git a/src/assets/images/classes/511.png b/src/assets/images/classes/511.png new file mode 100644 index 00000000..40703124 Binary files /dev/null and b/src/assets/images/classes/511.png differ diff --git a/src/assets/images/classes/512.png b/src/assets/images/classes/512.png new file mode 100644 index 00000000..49472d3c Binary files /dev/null and b/src/assets/images/classes/512.png differ diff --git a/src/assets/images/classes/601.png b/src/assets/images/classes/601.png new file mode 100644 index 00000000..251296de Binary files /dev/null and b/src/assets/images/classes/601.png differ diff --git a/src/assets/images/classes/602.png b/src/assets/images/classes/602.png new file mode 100644 index 00000000..438458ce Binary files /dev/null and b/src/assets/images/classes/602.png differ diff --git a/src/assets/images/classes/603.png b/src/assets/images/classes/603.png new file mode 100644 index 00000000..bbe3fc0a Binary files /dev/null and b/src/assets/images/classes/603.png differ diff --git a/src/assets/images/classes/604.png b/src/assets/images/classes/604.png new file mode 100644 index 00000000..7546a3ae Binary files /dev/null and b/src/assets/images/classes/604.png differ diff --git a/src/components/SettingsPage/UploadPage.vue b/src/components/SettingsPage/UploadPage.vue index 9ce708b9..2f287c5d 100644 --- a/src/components/SettingsPage/UploadPage.vue +++ b/src/components/SettingsPage/UploadPage.vue @@ -107,6 +107,49 @@ + + + + + + + + Upload Screenshot to Discord + + + Automatically upload a screenshot of the meter to a Discord webhook + after each encounter. + + + + + + + Discord Webhook + + A Discord webhook URL to upload screenshots to.
+ Go to a Discord Channel's settings, then "Integrations", then + "Webhooks", then "New Webhook". +
+
+ + + + +
+ @@ -195,6 +238,7 @@ const settingsStore = useSettingsStore(); const isPwd = ref(true); const uploadKey = ref(""); +const discordWebhook = ref(""); const showAdvanced = ref(false); window.messageApi.receive("settings-changed", (value) => { @@ -206,8 +250,14 @@ watch(uploadKey, (newVal, oldVal) => { settingsStore.settings.uploads.uploadKey = newVal; }); +watch(discordWebhook, (newVal, oldVal) => { + if (newVal.length == 0) settingsStore.settings.uploads.uploadDiscord = false; + settingsStore.settings.uploads.discordWebhook = newVal; +}); + onMounted(() => { uploadKey.value = settingsStore.settings.uploads.uploadKey; + discordWebhook.value = settingsStore.settings.uploads.discordWebhook; }); /** * @param {'api' | 'site' | 'endpoint'} type diff --git a/src/layouts/DamageMeter.vue b/src/layouts/DamageMeter.vue index f7f5567a..e2879948 100644 --- a/src/layouts/DamageMeter.vue +++ b/src/layouts/DamageMeter.vue @@ -127,6 +127,19 @@
+ + + Toggle Discord screenshot upload + + { + if (!blob) return; + + let msg = sessionState.value.currentBoss?.name || "No Boss"; + msg += "\n"; + msg += "Uploaded by "; + msg += sessionState.value.localPlayer || "Unknown"; + + void axios.postForm( + settingsStore.settings.uploads.discordWebhook, + { + "payload_json": JSON.stringify({ + content: msg, + attachments: [{ + id: 0, + filename: "screenshot.png", + content_type: "image/png", + }] + }), + "files[0]": blob, + } + ); + + }, + "image/png", + 1 + ); + + damageType.value = oldDamageType; + + isTakingScreenshot.value = false; + Notify.create({ + message: "
Screenshot sent to Discord.
", + color: "primary", + html: true, + actions: [ + { + label: "Dismiss", + color: "white", + handler: () => { + /* ... */ + }, + }, + ], + }); + + return "Screenshot sent to Discord." +} + function requestSessionRestart() { window.messageApi.send("window-to-main", { message: "reset-session" }); } @@ -526,6 +608,18 @@ onMounted(() => { }); } } + + if ( + !isMinimized.value && + settingsStore.settings.uploads.uploadDiscord && + sessionState.value.currentBoss && // Only upload bosses + sessionState.value.lastCombatPacket !== lastScreenshotPacket && // No repeat uploads + sessionState.value.lastCombatPacket - + sessionState.value.currentBoss.lastUpdate < 3000 // Avoids uploading trash mobs + ) { + lastScreenshotPacket = sessionState.value.lastCombatPacket; + void uploadDiscordScreenshot() + } } } else { Notify.create({ diff --git a/src/stores/settings.ts b/src/stores/settings.ts index cfbd9158..7c1ca697 100644 --- a/src/stores/settings.ts +++ b/src/stores/settings.ts @@ -52,6 +52,8 @@ export const useSettingsStore = defineStore("settings", { openOnUpload: false, uploadUnlisted: true, includeRegion: false, + uploadDiscord: false, + discordWebhook: "", }, damageMeter: { functionality: {