61 lines
2 KiB
CoffeeScript
61 lines
2 KiB
CoffeeScript
room = require("../../lib/room.coffee")
|
|
obj = require('../../lib/obj.coffee')
|
|
dialogue = require('../../lib/util/dialogue.coffee')
|
|
phrase = require('../../lib/util/phrase.coffee')
|
|
oneOf = require('../../lib/oneOf.coffee')
|
|
Salet = require('../../lib/salet.coffee')
|
|
|
|
salet = Salet({
|
|
game_id: "your-game-id-here"
|
|
game_version: "1.1"
|
|
})
|
|
$(document).ready(() ->
|
|
salet.beginGame()
|
|
)
|
|
|
|
###
|
|
Element helpers. There is no real need to build monsters like a().id("hello")
|
|
because you won't use them as is. It does not make sense in context, the
|
|
author has Markdown and all utilities to *forget* about the markup.
|
|
###
|
|
way_to = (content, ref) ->
|
|
return "<a href='#{ref}' class='way'>#{content}</a>"
|
|
textlink = (content, ref) ->
|
|
return "<a href='./_writer_#{ref}' class='once'>#{content}</a>"
|
|
actlink = (content, ref) ->
|
|
return "<a href='./#{ref}' class='once'>#{content}</a>"
|
|
textcycle = (content, ref) ->
|
|
return "<a href='./_replacer_#{ref}' class='cycle' id='#{ref}'>#{content}</a>"
|
|
|
|
# The first room of the game.
|
|
# For accessibility reasons the text is provided in HTML, not here.
|
|
room "start", salet,
|
|
enter: (salet) ->
|
|
salet.character.bought_lamp = false
|
|
dsc: """
|
|
""",
|
|
choices: "#start"
|
|
|
|
# This is a special inventory room.
|
|
# The inventory button is a regular link to this room.
|
|
# You may alter these as much as you like or scrap it along with the button.
|
|
room "inventory", salet,
|
|
canSave: false # saving the game here is forbidden. Aautosaving too.
|
|
enter: () ->
|
|
$("#inventory").hide()
|
|
exit: () ->
|
|
$("#inventory").show()
|
|
dsc: (salet) ->
|
|
if salet.character.inventory.length == 0
|
|
text = "You are carrying nothing."
|
|
else
|
|
text = "You are carrying:\n\n"
|
|
for thing in salet.character.inventory
|
|
text += "* #{salet.character.listinv(thing.name)}\n"
|
|
return text+"\n\n"+"""
|
|
<div class="center"><a href="./exit"><button class="btn btn-lg btn-outline-primary">Go back</button></a></div>
|
|
"""
|
|
actions:
|
|
exit: (salet) ->
|
|
return salet.goBack()
|