diff --git a/js/003-data/playerData.js b/js/003-data/playerData.js index b0848899a3e7b43388d4d809d4ea4b82a4f6155c..98471099d11b10454d02aae000188906abc90152 100644 --- a/js/003-data/playerData.js +++ b/js/003-data/playerData.js @@ -1,12 +1,47 @@ App.Data.player = { // Value is stored in player object as the index of this array: If V.PC.refreshmentType === 0, we should display "Smoked". - refreshmentType: [ - `Smoked`, - `Drank`, - `Eaten`, - `Snorted`, - `Injected`, - `Popped`, - `Dissolved orally`, - ] + refreshmentType: new Map([ + [0, + { + name: `Smoked`, + suggestions: new Set(["cigar"]) + } + ], + [1, + { + name: `Drank`, + suggestions: new Set(["whiskey", "rum", "wine"]) + } + ], + [2, + { + name: `Eaten`, + suggestions: new Set(["steak"]) + } + ], + [3, + { + name: `Snorted`, + suggestions: new Set(["stimulants"]) + } + ], + [4, + { + name: `Injected`, + suggestions: new Set(["stimulants"]) + } + ], + [5, + { + name: `Popped`, + suggestions: new Set(["amphetamines"]) + } + ], + [6, + { + name: `Dissolved orally`, + suggestions: new Set(["stimulants"]) + } + ], + ]) }; diff --git a/src/events/intro/pcAppearance.js b/src/events/intro/pcAppearance.js index cdb3adb7d810951397fb2a80b9532b8096b6e006..5d40d545c247f1347d408e71af4c3d91594d00f8 100644 --- a/src/events/intro/pcAppearance.js +++ b/src/events/intro/pcAppearance.js @@ -41,16 +41,10 @@ App.UI.Player.appearance = function(options) { }; App.UI.Player.refreshmentChoice = function(options) { - options.addOption("Your preferred refreshment is", "refreshment", V.PC).showTextBox() - .addValue("Cigars", "cigar", () => { V.PC.refreshmentType = 0; }) - .addValue("Whiskey", "whiskey", () => { V.PC.refreshmentType = 1; }) - .addValue("Rum", "rum", () => { V.PC.refreshmentType = 1; }) - .addValue("Wine", "wine", () => { V.PC.refreshmentType = 1; }) - .addValue("Adderall", "adderall", () => { V.PC.refreshmentType = 5; }); - - const option = options.addOption("Which you", "refreshmentType", V.PC) - .addValueList(Array.from(App.Data.player.refreshmentType, (v, i) => [v, i])); - + let option = options.addOption("Your preferred refreshment is", "refreshmentType", V.PC); + for (const [key, value] of App.Data.player.refreshmentType) { + option.addValue(value.name, key, () => { V.PC.refreshment = value.suggestions.values().next().value; } ); + } let comment = `Flavor only; no mechanical effect. If entering a custom refreshment, please assign proper usage.`; if (V.PC.refreshmentType === 0) { comment += ` "Smoked" must fit into the following sentence: "I smoked a ${V.PC.refreshment}" to fit events properly.`; @@ -60,6 +54,11 @@ App.UI.Player.refreshmentChoice = function(options) { comment += ` "Orally Dissolved" must fit into the following sentence: "I placed a tab of ${V.PC.refreshment} under my tongue" to fit events properly.`; } option.addComment(comment); + + option = options.addOption("Specifically", "refreshment", V.PC).showTextBox().pulldown(); + for (const refreshment of App.Data.player.refreshmentType.get(V.PC.refreshmentType).suggestions) { + option.addValue(capFirstChar(refreshment), refreshment); + } }; App.UI.Player.names = function(options) {