a BASHventure game on IPFS
This commit is contained in:
parent
89727c2ab1
commit
46aee42115
|
@ -8,31 +8,37 @@
|
||||||
# - @BenNunney
|
# - @BenNunney
|
||||||
# Thanks and gratitude to all living creatures and the whole creation.
|
# Thanks and gratitude to all living creatures and the whole creation.
|
||||||
# - @Fred
|
# - @Fred
|
||||||
|
|
||||||
# $AGE×365,25×24×60×60×9,807÷299792458 = RELATIVE LIGHT GRAVITY SPEED
|
# $AGE×365,25×24×60×60×9,807÷299792458 = RELATIVE LIGHT GRAVITY SPEED
|
||||||
|
###################################################################
|
||||||
# Here we check to see if uuidgen is installed - if not it will default to single-user mode. To run this on a server
|
# Here we check to see if uuidgen is installed - if not it will default to single-user mode. To run this on a server
|
||||||
# and support multipe-users, check you have everthing set up correctly. Follow the instructions in the ReadMe file on GitHub.
|
# and support multipe-users, check you have everything set up correctly.
|
||||||
|
# Follow the instructions in the original ReadMe file : https://github.com/apetro/BashVenture/blob/master/README.md
|
||||||
|
###################################################################
|
||||||
|
# Guide avancé d'écriture des scripts Bash : https://abs.traduc.org/abs-fr/
|
||||||
|
###################################################################
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
ME="${0##*/}"
|
ME="${0##*/}"
|
||||||
|
|
||||||
if hash uuidgen 2>/dev/null; then
|
if hash uuidgen 2>/dev/null; then
|
||||||
homefolder=$(pwd)
|
homefolder=$(pwd)
|
||||||
newplayer=$(uuidgen)
|
newplayer=$(uuidgen)
|
||||||
mkdir -p $HOME/.zen/adventure/$newplayer
|
## Copy Player Game Files
|
||||||
cp -r $MY_PATH/rooms $HOME/.zen/adventure/$newplayer/rooms
|
mkdir -p $HOME/.zen/adventure/$newplayer
|
||||||
cp -r $MY_PATH/art $HOME/.zen/adventure/$newplayer/art
|
cp -r $MY_PATH/rooms $HOME/.zen/adventure/$newplayer/rooms
|
||||||
cp -r $MY_PATH/script $HOME/.zen/adventure/$newplayer/script
|
cp -r $MY_PATH/art $HOME/.zen/adventure/$newplayer/art
|
||||||
cp -r $MY_PATH/logic $HOME/.zen/adventure/$newplayer/logic
|
cp -r $MY_PATH/script $HOME/.zen/adventure/$newplayer/script
|
||||||
|
cp -r $MY_PATH/logic $HOME/.zen/adventure/$newplayer/logic
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Loading..."
|
echo "Loading..."
|
||||||
echo
|
echo
|
||||||
sleep 4
|
sleep 4
|
||||||
|
|
||||||
if hash uuidgen 2>/dev/null; then
|
if hash uuidgen 2>/dev/null; then
|
||||||
cd $HOME/.zen/adventure/$newplayer/rooms
|
cd $HOME/.zen/adventure/$newplayer/rooms
|
||||||
else
|
else
|
||||||
cd rooms
|
cd rooms
|
||||||
fi
|
fi
|
||||||
./start.sh
|
./start.sh
|
||||||
if hash uuidgen 2>/dev/null; then
|
if hash uuidgen 2>/dev/null; then
|
||||||
|
|
|
@ -4,43 +4,54 @@
|
||||||
# Version: 0.1
|
# Version: 0.1
|
||||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||||
################################################################################
|
################################################################################
|
||||||
ts=$(date -u +%s%N | cut -b1-13)
|
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||||
|
mkdir -p ~/.zen/tmp/${MOATS}
|
||||||
################################################################################
|
################################################################################
|
||||||
# Capture la photographie satellite de la France
|
# Capture la photographie satellite de la France
|
||||||
# https://fr.sat24.com/image?type=visual5HDComplete®ion=fr
|
# https://fr.sat24.com/image?type=visual5HDComplete®ion=fr
|
||||||
|
|
||||||
MY_PATH="`dirname \"$0\"`" # relative
|
MY_PATH="`dirname \"$0\"`" # relative
|
||||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||||
ME="${0##*/}"
|
ME="${0##*/}"
|
||||||
|
|
||||||
|
## TEST IPFS
|
||||||
|
[[ ! $(which ipfs) ]] && echo "Missing IPFS. Please install... https://ipfs.tech" && exit 1
|
||||||
|
|
||||||
|
## PREPARE FILE SYSTEM CACHE
|
||||||
mkdir -p ~/.zen/adventure/meteo.anim.eu
|
mkdir -p ~/.zen/adventure/meteo.anim.eu
|
||||||
rm -f ~/.zen/adventure/meteo.anim.eu/meteo.png
|
rm -f ~/.zen/adventure/meteo.anim.eu/meteo.png
|
||||||
|
|
||||||
|
## SCRAPING meteo.png
|
||||||
curl -m 20 --output ~/.zen/adventure/meteo.anim.eu/meteo.png https://s.w-x.co/staticmaps/wu/wu/satir1200_cur/europ/animate.png
|
curl -m 20 --output ~/.zen/adventure/meteo.anim.eu/meteo.png https://s.w-x.co/staticmaps/wu/wu/satir1200_cur/europ/animate.png
|
||||||
|
|
||||||
if [[ ! -f ~/.zen/adventure/meteo.anim.eu/meteo.png ]]; then
|
if [[ ! -f ~/.zen/adventure/meteo.anim.eu/meteo.png ]]; then
|
||||||
|
|
||||||
echo "Impossible de vous connecter au service meteo"
|
echo "Impossible de se connecter au service meteo"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
echo "NEED HTML TEMPLATING"
|
echo "Mise à jour archive meteo : ${MOATS}"
|
||||||
echo "Mise à jour archive points meteo : $ts"
|
echo ${MOATS} > ~/.zen/adventure/meteo.anim.eu/.moats
|
||||||
echo $ts > ~/.zen/adventure/meteo.anim.eu/.ts
|
|
||||||
|
|
||||||
PSEUDO=$(cat ~/.zen/adventure/players/.current/.pseudo 2>/dev/null)
|
|
||||||
OLDID=$(cat ~/.zen/adventure/.meteo.index 2>/dev/null)
|
OLDID=$(cat ~/.zen/adventure/.meteo.index 2>/dev/null)
|
||||||
sed s/_OLDID_/$OLDID/g ${MY_PATH}/../templates/meteo_chain.html > /tmp/index.html
|
# TODO : COMPARE SIMILAR OR NOT
|
||||||
sed -i s/_IPFSID_/$IPFSID/g /tmp/index.html
|
# ipfs get "/ipfs/$OLDID/meteo.anim.eu/meteo.png"
|
||||||
sed -i s/_DATE_/$(date -u "+%Y-%m-%d#%H:%M:%S")/g /tmp/index.html
|
|
||||||
sed s/_PSEUDO_/$PSEUDO/g /tmp/index.html > ~/.zen/adventure/index.html
|
## PREPARE NEW index.html
|
||||||
|
sed "s/_OLDID_/$OLDID/g" ${MY_PATH}/../templates/meteo_chain.html > /tmp/index.html
|
||||||
|
sed -i "s/_IPFSID_/$IPFSID/g" /tmp/index.html
|
||||||
|
sed -i "s/_DATE_/$(date -u "+%Y-%m-%d#%H:%M:%S")/g" /tmp/index.html
|
||||||
|
sed "s/_PSEUDO_/${USER}/g" /tmp/index.html > ~/.zen/adventure/index.html
|
||||||
|
|
||||||
# Copy style css
|
# Copy style css
|
||||||
cp -R ${MY_PATH}/../templates/styles ~/.zen/adventure/players/.current/public/
|
cp -r ${MY_PATH}/../templates/styles ~/.zen/adventure/
|
||||||
|
|
||||||
INDEXID=$(ipfs add -rHq ~/.zen/adventure/index.html | tail -n 1)
|
INDEXID=$(ipfs add -rHq ~/.zen/adventure/* | tail -n 1)
|
||||||
echo $INDEXID > ~/.zen/adventure/.meteo.index
|
echo $INDEXID > ~/.zen/adventure/.meteo.index
|
||||||
echo "LAST VIDEO INDEX http://127.0.0.1:8080/ipfs/$INDEXID"
|
echo "METEO INDEX : http://127.0.0.1:8080/ipfs/$INDEXID"
|
||||||
IPFS=$(ipfs add -Rw ~/.zen/adventure/meteo.anim.eu/)
|
|
||||||
|
IPFS=$(ipfs add -q ~/.zen/adventure/meteo.anim.eu/meteo.png | tail -n 1)
|
||||||
echo $IPFS > ~/.zen/adventure/meteo.anim.eu/.chain
|
echo $IPFS > ~/.zen/adventure/meteo.anim.eu/.chain
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -46,7 +46,7 @@ echo "Tout autour la forêt. Des feuillus. Quelques arbustres épineux."
|
||||||
echo "Sous vos pieds. Le sol est rouge parsemé de cailloux blancs."
|
echo "Sous vos pieds. Le sol est rouge parsemé de cailloux blancs."
|
||||||
echo
|
echo
|
||||||
echo "Vous pouvez vous diriger selon les points cardinaux."
|
echo "Vous pouvez vous diriger selon les points cardinaux."
|
||||||
echo "Au nord un chemin remonte, au sud un passage descend, à l'est, la bergerie, à l'ouest, une trace d'animaux"
|
echo "Au nord un chemin remonte, au sud un passage descend, à l'est, la bergerie, à l'ouest, des traces d'animaux"
|
||||||
echo
|
echo
|
||||||
echo "Que voulez-vous faire? Les commandes sont : n, e, s, w, u et h."
|
echo "Que voulez-vous faire? Les commandes sont : n, e, s, w, u et h."
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ while true; do
|
||||||
w ) ./green.sh
|
w ) ./green.sh
|
||||||
exit ;;
|
exit ;;
|
||||||
u ) echo "Vous ouvrez votre sac il contient une tente, des vêtements, un termos, une scie pliante et un couteau" ;; # Something to say? You can also just echo.
|
u ) echo "Vous ouvrez votre sac il contient une tente, des vêtements, un termos, une scie pliante et un couteau" ;; # Something to say? You can also just echo.
|
||||||
h ) echo "Comment avez-vous pu arriver ici.? Des souvenirs vous reviennent... https://oasis.astroport.com/a-quel-jeu-voulons-nous-jouer/" ;;
|
h ) echo "Comment avez-vous pu arriver ici.? Des souvenirs vous reviennent... https://web.archive.org/web/20211129105224/https://oasis.astroport.com/a-quel-jeu-voulons-nous-jouer/" ;;
|
||||||
* ) echo "Je suis désolé, je ne vous comprends pas. Les commandes sont : n, e, s, w, u et h..";;
|
* ) echo "Je suis désolé, je ne vous comprends pas. Les commandes sont : n, e, s, w, u et h..";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>_PSEUDO_ ENREGISTREMENT METEO - Astroport One</title>
|
<title> ENREGISTREMENT METEO - Astroport One</title>
|
||||||
<link rel="stylesheet" href="./styles/decoration.css" type="text/css" />
|
<link rel="stylesheet" href="./styles/decoration.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="./styles/layout.css" type="text/css" />
|
<link rel="stylesheet" href="./styles/layout.css" type="text/css" />
|
||||||
<link rel="icon" type="image/png" href="./styles/logo.png" />
|
<link rel="icon" type="image/png" href="./styles/logo.png" />
|
||||||
|
@ -23,14 +23,14 @@
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
<h6>
|
<h6>
|
||||||
<a href="https://qo-op.com">Astroport "<span>ONE</span>"</a> _PSEUDO_
|
<a href="https://qo-op.com">Astroport "<span>ONE</span>"</a>
|
||||||
</h6>
|
</h6>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
<img src="/ipfs/_IPFSID_/meteo.png" alt="ANIMATION METEO" class="shrinkToFit" width="397" height="289">
|
<img src="/ipfs/_IPFSID_/meteo.anim.eu/meteo.png" alt="ANIMATION METEO" class="shrinkToFit" width="397" height="289">
|
||||||
|
|
||||||
|
|
||||||
<h1 class="video-title">
|
<h1 class="video-title">
|
||||||
|
|
Loading…
Reference in New Issue