Skip to content

Commit e6cfe18

Browse files
committed
fix(travel): remove step cooldown preservation
Thanks Mike, I am free from maintaining this
1 parent 57fd310 commit e6cfe18

File tree

5 files changed

+3
-120
lines changed

5 files changed

+3
-120
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ has to be done manually
8888
* attack NPC button
8989
* gather materials button
9090
* verification button
91-
* Preserve step cooldown on page refresh
9291
* Step task progression tracking assistance
9392

9493
## Installation

src/views/Travel/DataBridge.vue

+1-6
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,10 @@ import { onMounted } from "vue"
55
import { interceptRequest } from "@/utils"
66
77
const travelStore = useTravelStore()
8-
const { cooldownTimestamp, lastStepResponse } = storeToRefs(travelStore)
8+
const { lastStepResponse } = storeToRefs(travelStore)
99
1010
function handleBridge({ detail: data }: CustomEvent<TravelResponse>) {
1111
lastStepResponse.value = data
12-
13-
cooldownTimestamp.value = new Date(Date.now() + data.nextwait).toISOString()
14-
setTimeout(() => {
15-
cooldownTimestamp.value = null
16-
}, data.nextwait)
1712
}
1813
1914
onMounted(() => {

src/views/Travel/StepButton.vue

-81
This file was deleted.

src/views/Travel/Travel.vue

-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22
import { Controls } from "@/components"
33
44
import DataBridge from "./DataBridge.vue"
5-
import StepButton from "./StepButton.vue"
65
import Task from "./Task.vue"
76
import { AutoFocus } from "./AutoFocus"
87
</script>
98

109
<template>
1110
<Controls to="#complete-travel-container">
1211
<DataBridge />
13-
<StepButton />
1412
<AutoFocus />
1513
<Task />
1614
</Controls>

src/views/Travel/store.ts

+2-30
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,26 @@
11
import { defineStore } from "pinia"
2-
import { computed, onMounted, ref } from "vue"
2+
import { ref } from "vue"
33

44
export const useTravelStore = defineStore(
55
"travel",
66
() => {
77
const shouldAutoFocusStep = ref(false)
8-
const shouldPersistCooldown = ref(false)
98
const shouldAutoFocusEncounters = ref(false)
109
const shouldAutoFocusVerification = ref(false)
1110
const shouldHelpTrackStepsTaskProgress = ref(false)
1211

1312
const lastStepResponse = ref<null | TravelResponse>(null)
14-
const cooldownTimestamp = ref<null | string>(null)
15-
16-
const cooldownTimeLeft = computed(() => {
17-
if (!cooldownTimestamp.value) return 0
18-
return Math.max(new Date(cooldownTimestamp.value).valueOf() - Date.now(), 0)
19-
})
20-
21-
onMounted(() => {
22-
if (!cooldownTimestamp.value) return
23-
24-
setTimeout(() => {
25-
cooldownTimestamp.value = null
26-
}, cooldownTimeLeft.value)
27-
})
2813

2914
return {
3015
shouldAutoFocusStep,
31-
shouldPersistCooldown,
3216
shouldAutoFocusEncounters,
3317
shouldAutoFocusVerification,
3418
shouldHelpTrackStepsTaskProgress,
35-
cooldownTimestamp,
36-
cooldownTimeLeft,
3719
lastStepResponse,
3820
}
3921
},
4022
{
41-
persist: {
42-
serializer: {
43-
deserialize: (store) => {
44-
const parsed = JSON.parse(store)
45-
const date = new Date(parsed.cooldownTimestamp)
46-
if (date.valueOf() < Date.now()) parsed.cooldownTimestamp = null
47-
return parsed
48-
},
49-
serialize: JSON.stringify,
50-
},
51-
},
23+
persist: true,
5224
}
5325
)
5426

0 commit comments

Comments
 (0)