Skip to content

Commit

Permalink
Attempt to fix crash (+bleed)
Browse files Browse the repository at this point in the history
Co-Authored-By: Mathi <[email protected]>
  • Loading branch information
Herysia and Mathicha committed Dec 23, 2022
1 parent ffde526 commit 42fbeea
Show file tree
Hide file tree
Showing 7 changed files with 340 additions and 22 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "loa-details",
"version": "1.0.3",
"version": "1.0.4",
"description": "Damage meter for Lost Ark",
"productName": "LOA Details",
"author": "Herysia, Mathicha, Eren Kara <[email protected]>",
Expand Down
167 changes: 167 additions & 0 deletions src-electron/util/app-settings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
import Store from "electron-store";
import log from "electron-log";
import { cloneDeep, merge } from "lodash";

const store = new Store();

export function getSettings() {
let appSettings = cloneDeep(defaultSettings);

try {
let settingsStr = store.get("settings");

if (typeof settingsStr === "object")
appSettings = merge(appSettings, cloneDeep(settingsStr));
else if (typeof settingsStr === "string")
merge(appSettings, JSON.parse(settingsStr));

log.info("Found and applied settings.");
} catch (e) {
log.info("Setting retrieval failed: " + e);
}

return appSettings;
}

export function saveSettings(settings) {
if (typeof settings === "object")
store.set("settings", JSON.stringify(settings));
else store.set("settings", settings);

log.info(`Saved settings: ${settings}`);
}

// TODO: find a better way to handle this
const defaultSettings = {
appVersion: "",
general: {
startMainHidden: false,
startMainMinimized: false,
closeToSystemTray: true,
saveScreenshots: true,
server: "steam",
customLogPath: null,
},
shortcuts: {
minimizeDamageMeter: {
value: "CommandOrControl+Down",
defaultValue: "CommandOrControl+Down",
},
resetSession: {
value: "CommandOrControl+Up",
defaultValue: "CommandOrControl+Up",
},
pauseDamageMeter: {
value: "CommandOrControl+Right",
defaultValue: "CommandOrControl+Right",
},
},
uploads: {
uploadLogs: false,
uploadKey: "",
api: {
value: process.env.UPLOADS_API_URL,
defaultValue: process.env.UPLOADS_API_URL,
},
endpoint: {
value: process.env.UPLOADS_ENDPOINT,
defaultValue: process.env.UPLOADS_ENDPOINT,
},
site: {
value: process.env.UPLOADS_LOGIN_URL,
defaultValue: process.env.UPLOADS_LOGIN_URL,
},
openOnUpload: false,
uploadUnlisted: true,
includeRegion: false,
},
damageMeter: {
functionality: {
dontResetOnZoneChange: false,
removeOverkillDamage: true,
pauseOnPhaseTransition: true,
resetAfterPhaseTransition: true,
autoMinimize: false,
autoMinimizeTimer: 60,
minimizeToTaskbar: false,
nameDisplay: "name+class",
nameDisplayV2: "name+gear+class",
},
design: {
compactDesign: false,
pinUserToTop: false,
opacity: 0.9,
},
header: {
damage: {
name: "Damage",
enabled: true,
},
dps: {
name: "DPS",
enabled: true,
},
tank: {
name: "Tanked",
enabled: false,
},
},
tabs: {
damage: {
name: "Damage/Tanked",
enabled: true,
},
deathTime: {
name: "Death Time",
enabled: false,
},
damagePercent: {
name: "D% (Damage Percent)",
enabled: true,
},
dps: {
name: "DPS/TPS",
enabled: true,
},
critRate: {
name: "Crit Rate",
enabled: true,
},
faRate: {
name: "Front Attack Rate",
enabled: true,
},
baRate: {
name: "Back Attack Rate",
enabled: true,
},
counterCount: {
name: "Counter Count",
enabled: true,
},
maxDmg: {
name: "Skill View / Max Damage",
enabled: true,
},
avgDmg: {
name: "Skill View / Average Damage",
enabled: true,
},
totalHits: {
name: "Skill View / Total Hits",
enabled: true,
},
hpm: {
name: "Skill View / Hits per Minute",
enabled: true,
},
},
classes: {},
},
logs: {
minimumSessionDurationInMinutes: 1,
minimumEncounterDurationInMinutes: 0.5,
minimumDurationInMinutes: 0.0,
splitOnPhaseTransition: true,
},
};
2 changes: 0 additions & 2 deletions src-electron/util/app-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export type Settings = {
startMainHidden: boolean;
startMainMinimized: boolean;
closeToSystemTray: boolean;
useWinpcap: boolean;
saveScreenshots: boolean;
server: "steam" | "kr" | "ru";
customLogPath: string | null;
Expand Down Expand Up @@ -121,7 +120,6 @@ const defaultSettings: Settings = {
startMainHidden: false,
startMainMinimized: false,
closeToSystemTray: true,
useWinpcap: false,
saveScreenshots: true,
server: "steam",
customLogPath: null,
Expand Down
14 changes: 0 additions & 14 deletions src/components/SettingsPage/GeneralPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,6 @@
</q-item-section>
</q-item>

<q-item tag="label">
<q-item-section side top>
<q-checkbox v-model="settingsStore.settings.general.useWinpcap" />
</q-item-section>

<q-item-section>
<q-item-label>Use Winpcap</q-item-label>
<q-item-label caption>
Might fix packets not arriving. Program needs to be restarted after
enabling.
</q-item-label>
</q-item-section>
</q-item>

<q-item tag="label">
<q-item-section side top>
<q-checkbox v-model="settingsStore.settings.general.saveScreenshots" />
Expand Down
Loading

0 comments on commit 42fbeea

Please sign in to comment.