a BASHventure game on IPFS

This commit is contained in:
fred 2023-11-07 11:36:15 +01:00
parent 89727c2ab1
commit 46aee42115
4 changed files with 47 additions and 30 deletions

View File

@ -8,31 +8,37 @@
# - @BenNunney
# Thanks and gratitude to all living creatures and the whole creation.
# - @Fred
# $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
# 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="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
ME="${0##*/}"
if hash uuidgen 2>/dev/null; then
homefolder=$(pwd)
newplayer=$(uuidgen)
mkdir -p $HOME/.zen/adventure/$newplayer
cp -r $MY_PATH/rooms $HOME/.zen/adventure/$newplayer/rooms
cp -r $MY_PATH/art $HOME/.zen/adventure/$newplayer/art
cp -r $MY_PATH/script $HOME/.zen/adventure/$newplayer/script
cp -r $MY_PATH/logic $HOME/.zen/adventure/$newplayer/logic
homefolder=$(pwd)
newplayer=$(uuidgen)
## Copy Player Game Files
mkdir -p $HOME/.zen/adventure/$newplayer
cp -r $MY_PATH/rooms $HOME/.zen/adventure/$newplayer/rooms
cp -r $MY_PATH/art $HOME/.zen/adventure/$newplayer/art
cp -r $MY_PATH/script $HOME/.zen/adventure/$newplayer/script
cp -r $MY_PATH/logic $HOME/.zen/adventure/$newplayer/logic
fi
echo "Loading..."
echo
sleep 4
if hash uuidgen 2>/dev/null; then
cd $HOME/.zen/adventure/$newplayer/rooms
cd $HOME/.zen/adventure/$newplayer/rooms
else
cd rooms
cd rooms
fi
./start.sh
if hash uuidgen 2>/dev/null; then

View File

@ -4,43 +4,54 @@
# Version: 0.1
# 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
# https://fr.sat24.com/image?type=visual5HDComplete&region=fr
MY_PATH="`dirname \"$0\"`" # relative
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
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
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
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
else
echo "NEED HTML TEMPLATING"
echo "Mise à jour archive points meteo : $ts"
echo $ts > ~/.zen/adventure/meteo.anim.eu/.ts
echo "Mise à jour archive meteo : ${MOATS}"
echo ${MOATS} > ~/.zen/adventure/meteo.anim.eu/.moats
PSEUDO=$(cat ~/.zen/adventure/players/.current/.pseudo 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
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_/$PSEUDO/g /tmp/index.html > ~/.zen/adventure/index.html
# TODO : COMPARE SIMILAR OR NOT
# ipfs get "/ipfs/$OLDID/meteo.anim.eu/meteo.png"
## 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
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 "LAST VIDEO INDEX http://127.0.0.1:8080/ipfs/$INDEXID"
IPFS=$(ipfs add -Rw ~/.zen/adventure/meteo.anim.eu/)
echo "METEO INDEX : http://127.0.0.1:8080/ipfs/$INDEXID"
IPFS=$(ipfs add -q ~/.zen/adventure/meteo.anim.eu/meteo.png | tail -n 1)
echo $IPFS > ~/.zen/adventure/meteo.anim.eu/.chain
fi

View File

@ -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
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 "Que voulez-vous faire? Les commandes sont : n, e, s, w, u et h."
@ -63,7 +63,7 @@ while true; do
w ) ./green.sh
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.
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..";;
esac
done

View File

@ -14,7 +14,7 @@
<!DOCTYPE html>
<html>
<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/layout.css" type="text/css" />
<link rel="icon" type="image/png" href="./styles/logo.png" />
@ -23,14 +23,14 @@
<header>
<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>
</header>
<main>
<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">