check .chain
This commit is contained in:
parent
0618ff5299
commit
7f84919194
|
@ -70,7 +70,7 @@ for g1wish in $(ls ~/.zen/game/players/$PLAYER/voeux/); do
|
||||||
##################################################################"
|
##################################################################"
|
||||||
OLDIG1BAR=$(cat ~/.zen/game/world/$g1wish/.ig1barre)
|
OLDIG1BAR=$(cat ~/.zen/game/world/$g1wish/.ig1barre)
|
||||||
|
|
||||||
BAL=$($MY_PATH/../tools/jaklis/jaklis.py -p $g1wish balance)
|
BAL=$($MY_PATH/../tools/jaklis/jaklis.py balance -p $g1wish )
|
||||||
echo "MONTANT (G1) $BAL"
|
echo "MONTANT (G1) $BAL"
|
||||||
##################################################################"
|
##################################################################"
|
||||||
IG1BAR=$(ipfs add -Hq ~/.zen/game/world/$g1wish/g1barre.png | tail -n 1)
|
IG1BAR=$(ipfs add -Hq ~/.zen/game/world/$g1wish/g1barre.png | tail -n 1)
|
||||||
|
@ -81,63 +81,61 @@ for g1wish in $(ls ~/.zen/game/players/$PLAYER/voeux/); do
|
||||||
sed -i "s~${OLDIG1BAR}~${IG1BAR}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
sed -i "s~${OLDIG1BAR}~${IG1BAR}~g" ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||||
echo $IG1BAR > ~/.zen/game/world/$g1wish/.ig1barre
|
echo $IG1BAR > ~/.zen/game/world/$g1wish/.ig1barre
|
||||||
echo "Update new g1barre: /ipfs/$IG1BAR"
|
echo "Update new g1barre: /ipfs/$IG1BAR"
|
||||||
|
|
||||||
|
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
||||||
|
echo "Avancement blockchain TW $PLAYER : $MOATS"
|
||||||
|
cp ~/.zen/game/players/$PLAYER/ipfs/moa/.chain ~/.zen/game/players/$PLAYER/ipfs/moa/.chain.$MOATS
|
||||||
|
|
||||||
|
TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)
|
||||||
|
echo "ipfs name publish --key=$PLAYER /ipfs/$TW"
|
||||||
|
ipfs name publish --key=$PLAYER /ipfs/$TW
|
||||||
|
|
||||||
|
# MAJ CACHE TW $PLAYER
|
||||||
|
echo $TW > ~/.zen/game/players/$PLAYER/ipfs/moa/.chain
|
||||||
|
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats
|
||||||
|
echo
|
||||||
|
##################################################################"
|
||||||
|
##################################################################"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### NO OLDIG1BAR, MEANS FIRST RUN
|
### NO OLDIG1BAR, MEANS FIRST RUN
|
||||||
if [[ $OLDIG1BAR == "" ]]; then # CREATE Tiddler
|
if [[ $OLDIG1BAR == "" ]]; then # CREATE Tiddler
|
||||||
|
|
||||||
TEXT="<a target='_blank' href='"/ipns/${wishns}"'><img src='"/ipfs/${IG1BAR}"'></a><br><br><a target='_blank' href='"/ipns/${wishns}"'>"${wishname}"</a>"
|
TEXT="<a target='_blank' href='"/ipns/${wishns}"'><img src='"/ipfs/${IG1BAR}"'></a><br><br><a target='_blank' href='"/ipns/${wishns}"'>"${wishname}"</a>"
|
||||||
|
|
||||||
# NEW G1BAR TIDDLER
|
# NEW G1BAR TIDDLER
|
||||||
echo "## Creation json tiddler : G1${wishname} /ipfs/${IG1BAR}"
|
echo "## Creation json tiddler : G1${wishname} /ipfs/${IG1BAR}"
|
||||||
echo '[
|
echo '[
|
||||||
{
|
{
|
||||||
"title": "'G1${wishname}'",
|
"title": "'G1${wishname}'",
|
||||||
"type": "'text/vnd.tiddlywiki'",
|
"type": "'text/vnd.tiddlywiki'",
|
||||||
"ipns": "'/ipns/$wishns'",
|
"ipns": "'/ipns/$wishns'",
|
||||||
"ipfs": "'/ipfs/$IG1BAR'",
|
"ipfs": "'/ipfs/$IG1BAR'",
|
||||||
"player": "'/ipfs/$PLAYER'",
|
"player": "'/ipfs/$PLAYER'",
|
||||||
"text": "'$TEXT'",
|
"text": "'$TEXT'",
|
||||||
"tags": "'g1voeu g1${wishname} $PLAYER'"
|
"tags": "'g1voeu g1${wishname} $PLAYER'"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
' > ~/.zen/tmp/g1${wishname}.bank.json
|
' > ~/.zen/tmp/g1${wishname}.bank.json
|
||||||
|
|
||||||
rm -f ~/.zen/tmp/newindex.html
|
rm -f ~/.zen/tmp/newindex.html
|
||||||
|
|
||||||
echo "Nouveau G1${wishname} : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
|
echo "Nouveau G1${wishname} : http://127.0.0.1:8080/ipns/$ASTRONAUTENS"
|
||||||
tiddlywiki --verbose --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html \
|
tiddlywiki --verbose --load ~/.zen/game/players/$PLAYER/ipfs/moa/index.html \
|
||||||
--import ~/.zen/tmp/g1${wishname}.bank.json "application/json" \
|
--import ~/.zen/tmp/g1${wishname}.bank.json "application/json" \
|
||||||
--output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain"
|
--output ~/.zen/tmp --render "$:/core/save/all" "newindex.html" "text/plain"
|
||||||
|
|
||||||
|
echo "PLAYER TW Update..."
|
||||||
|
if [[ -s ~/.zen/tmp/newindex.html ]]; then
|
||||||
|
echo "Mise à jour ~/.zen/game/players/$PLAYER/ipfs/moa/index.html"
|
||||||
|
cp -f ~/.zen/tmp/newindex.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $IG1BAR > ~/.zen/game/world/$g1wish/.ig1barre
|
||||||
|
|
||||||
echo "PLAYER TW Update..."
|
|
||||||
if [[ -s ~/.zen/tmp/newindex.html ]]; then
|
|
||||||
echo "Mise à jour ~/.zen/game/players/$PLAYER/ipfs/moa/index.html"
|
|
||||||
cp -f ~/.zen/tmp/newindex.html ~/.zen/game/players/$PLAYER/ipfs/moa/index.html
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $IG1BAR > ~/.zen/game/world/$g1wish/.ig1barre
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MOATS=$(date -u +"%Y%m%d%H%M%S%4N")
|
|
||||||
echo "Avancement blockchain TW $PLAYER : $MOATS"
|
|
||||||
cp ~/.zen/game/players/$PLAYER/ipfs/moa/.chain ~/.zen/game/players/$PLAYER/ipfs/moa/.chain.$MOATS
|
|
||||||
|
|
||||||
TW=$(ipfs add -Hq ~/.zen/game/players/$PLAYER/ipfs/moa/index.html | tail -n 1)
|
|
||||||
echo "ipfs name publish --key=$PLAYER /ipfs/$TW"
|
|
||||||
ipfs name publish --key=$PLAYER /ipfs/$TW
|
|
||||||
|
|
||||||
# MAJ CACHE TW $PLAYER
|
|
||||||
echo $TW > ~/.zen/game/players/$PLAYER/ipfs/moa/.chain
|
|
||||||
echo $MOATS > ~/.zen/game/players/$PLAYER/ipfs/moa/.moats
|
|
||||||
echo
|
|
||||||
##################################################################"
|
|
||||||
##################################################################"
|
|
||||||
|
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue