2015-12-29 08:56:27 +02:00
|
|
|
# copyright (c) Alexander Yakovlev 2015.
|
|
|
|
# This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License.
|
|
|
|
# To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0
|
|
|
|
|
2016-01-20 18:48:30 +02:00
|
|
|
markdown = require('../../lib/markdown.coffee')
|
|
|
|
room = require("../../lib/room.coffee")
|
|
|
|
obj = require('../../lib/obj.coffee')
|
|
|
|
dialogue = require('../../lib/dialogue.coffee')
|
|
|
|
oneOf = require('../../lib/oneOf.coffee')
|
|
|
|
require('../../lib/interface.coffee')
|
|
|
|
undum = require('../../lib/undum.js')
|
2015-12-29 08:56:27 +02:00
|
|
|
|
2016-01-20 18:48:30 +02:00
|
|
|
undum.game.id = "6a9909a4-586a-4089-bd18-26da684d1c8d"
|
|
|
|
undum.game.version = "2.0"
|
2015-12-29 08:56:27 +02:00
|
|
|
|
2016-01-20 18:48:30 +02:00
|
|
|
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>"# usage: writemd( system, "Text to write")
|
2015-12-29 08:56:27 +02:00
|
|
|
|
|
|
|
writemd = (system, text) ->
|
2016-01-20 18:48:30 +02:00
|
|
|
text = markdown(text)
|
2016-01-04 04:02:34 +02:00
|
|
|
system.write(text)
|
|
|
|
|
2016-01-20 18:48:30 +02:00
|
|
|
money = (character, amount) ->
|
|
|
|
character.sandbox.money = character.sandbox.money + amount
|
2015-12-29 08:56:27 +02:00
|
|
|
|
2015-12-30 08:08:10 +02:00
|
|
|
code_can_input = (character) ->
|
2016-01-01 16:05:30 +02:00
|
|
|
return character.sandbox.code.length < 8
|
2015-12-30 08:08:10 +02:00
|
|
|
|
2016-01-03 07:11:38 +02:00
|
|
|
code_print = (character) ->
|
|
|
|
mask = 8 - character.sandbox.code.length
|
|
|
|
retval = character.sandbox.code
|
|
|
|
if mask > 0
|
|
|
|
for i in [1..mask]
|
|
|
|
retval += "_"
|
|
|
|
return retval
|
|
|
|
|
2015-12-30 08:08:10 +02:00
|
|
|
code_input = (character, digit) ->
|
|
|
|
if code_can_input(character)
|
|
|
|
character.sandbox.code = character.sandbox.code + digit
|
|
|
|
|
|
|
|
code_reset = (character) ->
|
|
|
|
character.sandbox.code = ""
|
|
|
|
|
|
|
|
code_check = (character, system) ->
|
2016-01-01 16:05:30 +02:00
|
|
|
if character.sandbox.code.length >= 8
|
|
|
|
# There is an Undum.. let's call it a feature
|
|
|
|
# that prevents the player from entering "3112".
|
|
|
|
# You see, you can't select the situation 1 when you are
|
|
|
|
# already in this situation, so you can't input 1 twice.
|
2016-01-02 10:17:36 +02:00
|
|
|
if character.sandbox.code == "01012017"
|
2015-12-30 08:08:10 +02:00
|
|
|
character.sandbox.box_opened = 1
|
2016-01-01 15:21:27 +02:00
|
|
|
if character.sandbox.knows_the_code == 0
|
|
|
|
writemd(system, """
|
|
|
|
Is he an extraordinary puzzle cracker or was it a sheer luck, but Ronald manages to *guess* the code.
|
|
|
|
""")
|
|
|
|
else
|
|
|
|
writemd(system, """
|
|
|
|
New Year 2017.
|
|
|
|
L. Y. must be Leonard Yakovlev, a famous painter.
|
|
|
|
Some tabloids tried to connect him with Ana but it seemed like a weak link.
|
|
|
|
|
|
|
|
By that logic, his sketch is worth more than all the cash here.
|
|
|
|
Ronald thinks about it, but decides to "let the woman have her memories".
|
|
|
|
""")
|
2015-12-30 08:08:10 +02:00
|
|
|
writemd(system, """
|
|
|
|
Something clicks and box opens.
|
|
|
|
|
|
|
|
The phone is slick, black and light in Ronald's hand.
|
|
|
|
It springs to life, humming with purpose.
|
|
|
|
The screen plays an animation: "LOADING..."
|
|
|
|
|
|
|
|
Ronald has no other business here.
|
|
|
|
It's time to go.
|
|
|
|
""")
|
2016-01-01 16:31:00 +02:00
|
|
|
system.doLink("bedroom")
|
2016-01-01 15:21:27 +02:00
|
|
|
else
|
|
|
|
writemd(system, "Something clicks and the display resets, but the box stays locked.")
|
|
|
|
if character.sandbox.code == "000000"
|
|
|
|
writemd(system, "Of course, Ronald didn't hope it would be that easy.")
|
2016-01-02 10:17:36 +02:00
|
|
|
|
2015-12-30 08:08:10 +02:00
|
|
|
character.sandbox.code = ""
|
|
|
|
|
2016-01-20 18:48:30 +02:00
|
|
|
room "start",
|
|
|
|
dsc: """
|
2015-12-29 08:56:27 +02:00
|
|
|
Peter opened his door to find an empty silent corridor.
|
|
|
|
He went to the neighbor's door and met a closed door.
|
|
|
|
Ronald was working inside, quietly walking around the apartment.
|
2016-01-20 18:48:30 +02:00
|
|
|
He began the inspection from #{way_to('the living room.', 'living-room')}
|
2015-12-29 08:56:27 +02:00
|
|
|
"""
|
|
|
|
|
|
|
|
is_visited = (situation) ->
|
|
|
|
situations = undum.game.situations[situation]
|
|
|
|
if situations
|
|
|
|
return Boolean situations.visited
|
|
|
|
return 0
|
2016-01-04 04:02:34 +02:00
|
|
|
|
|
|
|
# N-th level examine function
|
|
|
|
level = (text, mark) ->
|
|
|
|
$("#content .#{mark}").fadeOut()
|
2016-01-20 18:48:30 +02:00
|
|
|
return markdown(text, mark)
|
2016-01-04 04:02:34 +02:00
|
|
|
|
|
|
|
lvl1 = (text) ->
|
|
|
|
$("#content .lvl2").fadeOut()
|
|
|
|
$("#content .lvl3").fadeOut()
|
|
|
|
$("#content .lvl4").fadeOut()
|
|
|
|
level(text, "lvl1")
|
|
|
|
|
|
|
|
lvl2 = (text) ->
|
|
|
|
$("#content .lvl3").fadeOut()
|
|
|
|
$("#content .lvl4").fadeOut()
|
|
|
|
level(text, "lvl2")
|
|
|
|
|
|
|
|
lvl3 = (text) ->
|
|
|
|
$("#content .lvl4").fadeOut()
|
|
|
|
level(text, "lvl3")
|
|
|
|
|
|
|
|
lvl4 = (text) ->
|
|
|
|
level(text, "lvl4")
|