dotg

a bitreich fosdem adventure
git clone git://parazyd.org/dotg.git
Log | Files | Refs

commit acc6bfaf49a7e80036fa0e21bfbfafc158d3bbc5
parent cebcef36adb5f3cdec8a03e7b7464cb9561e5ce0
Author: parazyd <parazyd@dyne.org>
Date:   Sat, 24 Feb 2018 16:24:40 +0100

Initial Act II structure.

Diffstat:
Aact-ii/config | 20++++++++++++++++++++
Aact-ii/functions | 126+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aact-ii/indexreal.dcgi | 27+++++++++++++++++++++++++++
Mact-ii/maps | 13++++++++++++-
Aact-ii/reset.dcgi | 12++++++++++++
5 files changed, 197 insertions(+), 1 deletion(-)

diff --git a/act-ii/config b/act-ii/config @@ -0,0 +1,20 @@ +#!/bin/sh + +export path="/dotg/act-ii" + +export savegame="/home/parazyd/dotg/act-ii/$REMOTE_ADDR" +export cables="$savegame/cables" +export musicsystem="$savegame/musicsystem" +export homebase="$savegame/homebase" +export windows10="$savegame/windows10" +export dancefloor="$savegame/dancefloor" +export cheeserat="$savegame/cheeserat" +export hipsters="$savegame/hipsters" +export stairs="$savegame/stairs" +export elevator="$savegame/elevator" +export bar="$savegame/bar" +export toilet="$savegame/toilet" +export vendingmachine="$savegame/vendingmachine" +export inventory="$savegame/inventory" + +[ -d "$savegame" ] && return diff --git a/act-ii/functions b/act-ii/functions @@ -0,0 +1,126 @@ +#!/bin/sh + +navigation() { + locations=" + DJ + Homebase + Dance_Floor + Hipsters + Hipster_Couch + Vending_Machine + Stairs + Elevator + Bar + Toilet + " + current="$(cat $savegame/room)" + + echo + for i in $locations; do + if ! [ "$current" = "$i" ]; then + echo "[1|Go to $i|$path/$i.dcgi|server|port]" + fi + done +} + +_msg() { + echo + echo "$*" | fmt --width=109 | sed 's/\t//g' | sed 's/^t/tt/' +} + +dropitem() { + item="$1" + [ -f "$inventory/$item" ] || return 1 + oldcount="$(cat $inventory/$item)" + newcount="$(( $oldcount - 1))" + if [ "$newcount" -lt 1 ]; then + rm -f "$inventory/$item" + else + printf "$newcount" > "$inventory/$item" + fi +} + +list_items_to() { + what="$1" + where="$2" + cd "$where" + for i in $(ls -1); do + echo "[1|$i|$path/$what.dcgi?$where/$i|server|port]" + done + cd - >/dev/null + + cat <<EOM + +(note: select any item to $what it) + +EOM +} + +take_item() { + fullpath="$1" + itemname="$(basename $fullpath)" + mv "$fullpath" "$inventory/$itemname" +} + +find_usecase() { + item="$1" + room="$2" + + line="$(grep "^$item" usecases.csv)" + [ -z "$line" ] && { + _msg "No use for $item here." + return + } + + uses="$(echo $line | tr ',' '\n' | tail -n+2)" + if [ "$uses" = "anywhere" ]; then + echo "use-generic" + return + fi + + for i in $uses; do + if [ "$i" = "anywhere" ]; then + echo "use-generic" + return + elif [ "$i" = "$room" ]; then + echo "use-specific,$i" + return + fi + done + + _msg "No use for $item here." +} + +use_generic() { + case "$1" in + Euros) + dropitem "$item" + _msg "You throw a 1 Euro coint at a hipster." + ;; + + Cigarettes) + dropitem "$item" + _msg "You smoke a cigarette." + ;; + + Beers) + dropitem "$item" + _msg "You drink a beer." + ;; + + Cheese) + _msg "You eat a piece of cheese." + ;; + esac +} + +use_specific() { + call="$1" + item="$2" + + case "$call" in + *) + _msg "Not implemented" + ;; + esac +} diff --git a/act-ii/indexreal.dcgi b/act-ii/indexreal.dcgi @@ -0,0 +1,27 @@ +#!/bin/sh + +. config +. functions + +cat <<EOM + + ▛▀▖ ▞▀▖▗▀▖ ▀▛▘▌ ▞▀▖ ▛▀▖ ▌ + ▌ ▌▝▀▖▌ ▌ ▌ ▌▐ ▌ ▛▀▖▞▀▖ ▌▄▖▙▀▖▙▄▘▝▀▖▙▀▖▝▀▖▀▜▘▌ ▌▞▀▌ + ▌ ▌▞▀▌▚▄▌ ▌ ▌▜▀ ▌ ▌ ▌▛▀ ▌ ▌▌ ▌ ▞▀▌▌ ▞▀▌▗▘ ▚▄▌▌ ▌ + ▀▀ ▝▀▘▗▄▘ ▝▀ ▐ ▘ ▘ ▘▝▀▘ ▝▀ ▘ ▘ ▝▀▘▘ ▝▀▘▀▀▘▗▄▘▝▀▘ + +A Bitreich FOSDEM adventure... 03 Feb 2018 A.D. + + + ⣎⣱ ⢀⣀ ⣰⡀ ⡇ ⡇ + ⠇⠸ ⠣⠤ ⠘⠤ ⠇ ⠇ + -- "Hackers" +EOM + +if [ -f "$savegame/room" ]; then + _msg "[1|Continue adventure!|$path/$(cat ${savegame}/room).dcgi|server|port]" +else + _msg "[1|Start adventure!|$path/start.dcgi|server|port]" +fi + +echo "[1|Go back :(|/dotg/index.gph|server|port]" diff --git a/act-ii/maps b/act-ii/maps @@ -6,10 +6,21 @@ cat <<EOM EOM +# C – Cables +# DJ – Music System +# WE – We +# W10 – Windows 10 Guy +# C+R – Cheese + Rat +# H – Hipsters +# DF – Dancefloor +# S – Stairs +# E – Elevator +# T – Toilet + map_start() { cat <<EOM +-----+ - | (E) | + | (E) | +----------------------+--------------------------------------+----+_____+-+ |xxxxxxxxxxxxxxxxxxxxxx| +--------+ |xxxxxxxxxxxxxxxxxxxxxx| | | TTTTTTTTTTTTT | | | | (BAR) | | diff --git a/act-ii/reset.dcgi b/act-ii/reset.dcgi @@ -0,0 +1,12 @@ +#!/bin/sh + +. config + +rm -rf "$savegame" + +cat <<EOM + +Game state reset. + +[1|Go back|/dotg/act-ii/indexreal.dcgi|server|port] +EOM