Skip to content

Commit

Permalink
allow for split names without Shrine/Lightroot
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt-Hurd committed Sep 14, 2023
1 parent 9aeb1b5 commit 3b3c8e6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/store/progressSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
import { RootState } from ".";
import liveSplitService from "../services/LiveSplitWebSocket";

interface ProgressState {
export interface ProgressState {
branchIndex: number;
pointIndex: number;
}
Expand All @@ -25,7 +25,14 @@ export const incrementProgress = createAsyncThunk("progress/increment", async (_
((thing.type === "Shrine" && point.action === "COMPLETE") || thing.type === "Lightroot")
) {
const currentSplitName = await liveSplit.getCurrentSplitName();
if (currentSplitName.endsWith(thing.name)) {

const shrineName = thing.name.replace(" Shrine", "").replace(" Lightroot", "");

const sanitizedCurrentSplitName = currentSplitName.startsWith("-")
? currentSplitName.substring(1)
: currentSplitName;

if (sanitizedCurrentSplitName === shrineName) {
liveSplit.split();
}
}
Expand Down

0 comments on commit 3b3c8e6

Please sign in to comment.