-
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
66 additions
and
30 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,36 @@ | ||
import {type User} from '@scripts/types/hg'; | ||
import {IntakeMessage} from '@scripts/types/mhct'; | ||
import {MistTier, MistTiers} from '@scripts/types/quests'; | ||
import {type IStager} from '../stages.types'; | ||
|
||
export class BurroughsRiftStager implements IStager { | ||
readonly environment: string = 'Burroughs Rift'; | ||
|
||
readonly tierToStage: Record<MistTier, string> = { | ||
'tier_0': 'Mist 0', | ||
'tier_1': 'Mist 1-5', | ||
'tier_2': 'Mist 6-18', | ||
'tier_3': 'Mist 19-20', | ||
}; | ||
|
||
/** | ||
* Report the misting state | ||
*/ | ||
addStage(message: IntakeMessage, userPre: User, userPost: User, journal: unknown): void { | ||
const quest = userPre.quests.QuestRiftBurroughs; | ||
|
||
if (!quest) { | ||
throw new Error('QuestRiftBurroughs is undefined'); | ||
} | ||
|
||
if (!this.isValidMistTier(quest.mist_tier)) { | ||
throw new Error('Skipping unknown Burroughs Rift mist state'); | ||
} | ||
|
||
message.stage = this.tierToStage[quest.mist_tier]; | ||
} | ||
|
||
private isValidMistTier(value: unknown): value is MistTier { | ||
return typeof value === 'string' && MistTiers.includes(value as MistTier); | ||
} | ||
} |
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,7 @@ | ||
export interface QuestRiftBurroughs { | ||
mist_tier: string // MistTier | ||
} | ||
|
||
export const MistTiers = ['tier_0', 'tier_1', 'tier_2', 'tier_3'] as const; | ||
|
||
export type MistTier = typeof MistTiers[number]; |
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