Skip to content

Commit

Permalink
esther changes & fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Herysia committed May 4, 2023
1 parent 6e498a5 commit 9e35637
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 18 deletions.
4 changes: 2 additions & 2 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.2.6",
"version": "1.2.7",
"description": "Damage meter for Lost Ark",
"productName": "LOA Details",
"author": "Herysia, Mathicha, Eren Kara <[email protected]>",
Expand Down
2 changes: 2 additions & 0 deletions src-electron/util/app-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export type Settings = {
resetAfterPhaseTransition: boolean;
displayEsther: boolean;
estherColor: string;
estherIncludeInTotal: boolean;
autoMinimize: boolean;
autoMinimizeTimer: number;
minimizeToTaskbar: boolean;
Expand Down Expand Up @@ -181,6 +182,7 @@ const defaultSettings: Settings = {
resetAfterPhaseTransition: true,
displayEsther: true,
estherColor: "#c2fc03",
estherIncludeInTotal: true,
autoMinimize: false,
autoMinimizeTimer: 60,
minimizeToTaskbar: false,
Expand Down
4 changes: 2 additions & 2 deletions src/components/DamageMeter/DamageMeterTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -881,14 +881,14 @@ function sortEntities() {
const totalDamageOverride = settingsStore.settings.damageMeter.functionality
.displayEsther
? res.reduce((sum, e) => sum + e.damageDealt, 0)
: 0;
: undefined;
const topDamageOverride = settingsStore.settings.damageMeter.functionality
.displayEsther
? res.reduce(
(prev, curr) => (prev > curr.damageDealt ? prev : curr.damageDealt),
0
)
: 0;
: undefined;
for (const entity of res) {
entity.damagePercentageTotal = getPercentage(
entity,
Expand Down
23 changes: 17 additions & 6 deletions src/components/LogView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,13 @@
</span>
<span style="margin-right: 12px">
Total DMG
{{ numberFormat(logData.damageStatistics.totalDamageDealt) }}
{{ numberFormat(totalDamageDealt) }}
</span>
<span style="margin-right: 12px">
Total DPS
{{
numberFormat(
(
logData.damageStatistics.totalDamageDealt /
(logData.duration / 1000)
).toFixed(0)
(totalDamageDealt / (logData.duration / 1000)).toFixed(0)
)
}}
</span>
Expand Down Expand Up @@ -126,7 +123,7 @@
</template>

<script setup>
import { ref } from "vue";
import { ref, computed } from "vue";
import {
numberFormat,
millisToMinutesAndSeconds,
Expand Down Expand Up @@ -154,6 +151,20 @@ const damageType = ref("dmg");
const isTakingScreenshot = ref(false);
const hideNamesOnScreenshot = ref(false);
const totalDamageDealt = computed(() => {
let totalDamageDealt = props.logData.damageStatistics.totalDamageDealt;
if (
settingsStore.settings.damageMeter.functionality.displayEsther &&
settingsStore.settings.damageMeter.functionality.estherIncludeInTotal
) {
props.logData.entities.forEach((e) => {
if (e.isEsther) totalDamageDealt += e.damageDealt;
});
}
return totalDamageDealt;
});
async function takeScreenshot(hideNames = true) {
hideNamesOnScreenshot.value = hideNames;
isTakingScreenshot.value = true;
Expand Down
19 changes: 19 additions & 0 deletions src/components/SettingsPage/DamageMeterPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,25 @@
</q-item-section>
</q-item>

<q-item
tag="label"
v-if="settingsStore.settings.damageMeter.functionality.displayEsther"
>
<q-item-section side top>
<q-checkbox
v-model="
settingsStore.settings.damageMeter.functionality
.estherIncludeInTotal
"
/>
</q-item-section>
<q-item-section>
<q-item-label>Inlude Esther in Total damage</q-item-label>
<q-item-label caption>
Include Esther damage in total damage (table header)
</q-item-label>
</q-item-section>
</q-item>
<q-item tag="label">
<q-item-section>
<q-item-label>
Expand Down
18 changes: 15 additions & 3 deletions src/layouts/DamageMeter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
style="margin-right: 12px"
>
Total DMG
{{ numberFormat(sessionState.damageStatistics.totalDamageDealt) }}
{{ numberFormat(totalDamageDealt) }}
</span>
<span
v-if="settingsStore.settings.damageMeter.header.dps.enabled"
Expand Down Expand Up @@ -396,6 +396,7 @@ const sessionState: ShallowRef<GameState | Record<string, never>> = shallowRef(
{}
);
let sessionDPS = 0;
let totalDamageDealt = 0;
const windowWidth: Ref<number> = ref(0);
onMounted(() => {
Expand Down Expand Up @@ -423,19 +424,30 @@ onMounted(() => {
window.messageApi.send("window-to-main", { message: "get-settings" });
window.messageApi.receive("pcap-on-state-change", (value: GameState) => {
if (value.damageStatistics?.totalDamageDealt && fightDuration.value > 0) {
totalDamageDealt = value.damageStatistics.totalDamageDealt;
if (
settingsStore.settings.damageMeter.functionality.displayEsther &&
settingsStore.settings.damageMeter.functionality.estherIncludeInTotal
) {
value.entities.forEach((e) => {
if (e.isEsther) totalDamageDealt += e.damageDealt;
});
}
if (totalDamageDealt && fightDuration.value > 0) {
sessionDPS = toFixedNumber(
value.damageStatistics.totalDamageDealt / (fightDuration.value / 1000),
totalDamageDealt / (fightDuration.value / 1000),
0
);
}
sessionState.value = value;
});
window.messageApi.receive("pcap-on-reset-state", (value) => {
fightPausedOn = 0;
fightPausedForMs = 0;
sessionDPS = 0;
totalDamageDealt = 0;
damageType.value = "dmg";
isFightPaused.value = false;
});
Expand Down
9 changes: 9 additions & 0 deletions src/pages/IndexPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@
</p>

<h5>Changelog</h5>
<h6 id="1-2-7">1.2.7</h6>
<ul>
<li>Fix previous commit that broke more than it fixed (yh i'm dumb)</li>
<li>
Esther is now counted in Total Damage and Total DPS (can be disabled
in settings->include esther in total damage (only show when display
esther is enabled))
</li>
</ul>
<h6 id="1-2-6">1.2.6</h6>
<ul>
<li>Add basic wiki that includes how to read data</li>
Expand Down
4 changes: 0 additions & 4 deletions src/pages/LogsPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,6 @@ async function changeLogViewerStoreState(newState) {
);
}
//apply all horizontal scroll
console.log(
horizontalScrollAreas.value.length,
horizontalScrollOffsets.length
);
if (
horizontalScrollAreas.value &&
horizontalScrollAreas.value.length === horizontalScrollOffsets.length
Expand Down
1 change: 1 addition & 0 deletions src/stores/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const useSettingsStore = defineStore("settings", {
resetAfterPhaseTransition: true,
displayEsther: true,
estherColor: "#c2fc03",
estherIncludeInTotal: true,
autoMinimize: false,
autoMinimizeTimer: 60,
minimizeToTaskbar: false,
Expand Down

0 comments on commit 9e35637

Please sign in to comment.