-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
76 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import {type User} from '@scripts/types/hg'; | ||
import {IntakeMessage} from '@scripts/types/mhct'; | ||
import {QuesoGeyserState, QuesoGeyserStates} from '@scripts/types/quests/quesoGeyser'; | ||
import {type IStager} from '../stages.types'; | ||
|
||
export class QuesoGeyserStager implements IStager { | ||
readonly environment: string = 'Queso Geyser'; | ||
|
||
/** | ||
* Report the state of corks and eruptions | ||
*/ | ||
addStage(message: IntakeMessage, userPre: User, userPost: User, journal: unknown): void { | ||
const quest = userPre.quests.QuestQuesoGeyser; | ||
|
||
if (!quest) { | ||
throw new Error('QuestQuesoGeyser is undefined'); | ||
} | ||
|
||
if (!this.isValidState(quest.state)) { | ||
throw new Error('Skipping hunt due to unknown Queso Geyser state'); | ||
} | ||
|
||
const state = quest.state; | ||
if (state === "collecting" || state === "claim") { | ||
message.stage = "Cork Collecting"; | ||
} else if (state === "corked") { | ||
message.stage = "Pressure Building"; | ||
} else if (state === "eruption") { | ||
// Tiny/Small/Medium/Large/Epic Eruption | ||
message.stage = quest.state_name; | ||
} | ||
} | ||
|
||
private isValidState(value: unknown): value is QuesoGeyserState { | ||
return typeof value === 'string' && QuesoGeyserStates.includes(value as QuesoGeyserState); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export interface QuestQuesoGeyser { | ||
state: string // QuesoGeyserState | ||
state_name: string; | ||
} | ||
|
||
export const QuesoGeyserStates = [ 'collecting', 'corked', 'eruption', 'claim' ] as const; | ||
|
||
export type QuesoGeyserState = typeof QuesoGeyserStates[number]; |
33 changes: 27 additions & 6 deletions
33
tests/scripts/modules/stages/environments/quesoGeyser.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters