From 54d4837fd6605b3cf13f303eec9d7f520e906e70 Mon Sep 17 00:00:00 2001 From: fred Date: Tue, 16 Apr 2024 22:24:38 +0200 Subject: [PATCH] ${#ZENSTATIONS[@]} --- ASTROBOT/G1ForkUPlanetZERO.sh | 25 ++++++++++++++++++------- RUNTIME/PLAYER.refresh.sh | 16 +++++----------- tools/COINScheck.sh | 2 ++ 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/ASTROBOT/G1ForkUPlanetZERO.sh b/ASTROBOT/G1ForkUPlanetZERO.sh index 50deebef..8f785b5e 100755 --- a/ASTROBOT/G1ForkUPlanetZERO.sh +++ b/ASTROBOT/G1ForkUPlanetZERO.sh @@ -67,10 +67,14 @@ cat ~/.zen/tmp/${MOATS}/G1ForkUPlanetZERO.json \ | jq -rc .[] | head -n 1 > ~/.zen/tmp/${MOATS}/ONEuplanet.json JSONUPLANET="${HOME}/.zen/tmp/${MOATS}/ONEuplanet.json" -[[ ! -s ${JSONUPLANET} ]] && echo "NO tag[ForkUPlanetZERO] for $PLAYER" && exit 0 + +[[ ! -s ${JSONUPLANET} ]] \ + && echo "NO tag[ForkUPlanetZERO] for $PLAYER" && exit 0 UPNAME=$(cat ${JSONUPLANET} | jq -r ".title") # What name is given ? -[[ "${UPNAME}" == "null" || "${UPNAME}" == "" ]] && echo "NO FORK UPLANET NAME .title MISSING" && exit 1 +[[ "${UPNAME}" == "null" || "${UPNAME}" == "" ]] \ + && echo "NO FORK UPLANET NAME .title MISSING" && exit 1 + HASH=$(cat ${JSONUPLANET} | jq -r ".hash") ## What text hash it has ? SECRET=$(cat ${JSONUPLANET} | jq -r ".secret") ## What is secret ? @@ -144,7 +148,6 @@ echo "${ENCODING}" ################################################################# ## MAKE SAME ENCODING FOR FRIENDS friends=($(ls ~/.zen/game/players/${PLAYER}/FRIENDS | grep "@" 2>/dev/null)) -howmuch=0 for f in ${friends[@]}; do ## Extract FRIENDG1PUB from TW (Astroport Tiddler) @@ -155,6 +158,8 @@ do [[ ${ASTROPORT} != "/ipns/${IPFSNODEID}" ]] && echo "FOREIGN ASTROPORT=${ASTROPORT}" && foreign="YES" echo "$f : $FRIENDG1PUB" + ASTROPORTS=("${ASTROPORTS[@]}" "${ATROPORT}") + if [[ ${FRIENDG1PUB} && ${FRIENDG1PUB} != "null" ]]; then #~ CHECK IF ALREADY IN JSON @@ -179,22 +184,28 @@ do continue fi + ZENSTATIONS=($(echo "${ASTROPORTS[@]}" | tr ' ' '\n' | sort -u)) ## CHECK IF FRIEND HAVE THE SAME ${UPNAME} tiddler if [[ ${foreign} == "YES" ]]; then - howmuch=$(( howmuch + 1 )) ## SEARCH FOR ${UPNAME} tiddler IN FRIEND TW tiddlywiki --load ${ftw} --output ~/.zen/tmp/${MOATS} --render '.' "${f}_${UPNAME}.json" 'text/plain' '$:/core/templates/exporters/JsonFile' 'exportFilter' "${UPNAME}" - cat ~/.zen/tmp/${MOATS}/${f}_${UPNAME}.json | jq -r '[]."${PLAYER}"' + cat ~/.zen/tmp/${MOATS}/${f}_${UPNAME}.json | jq -r '[]."'${PLAYER}'"' - ## CONTROL KEY DECODING + ## CONTROL SWARMKEY DECODING (must be similar to our) + ## IPFSNODEID IS FORKING TO NEW UPLANET + if [[ ${#ZENSTATIONS[@]} -gt 5 ]]; then + echo "UPlanet.ZERO WARPING... Activating ${UPNAME}" + + fi fi done -echo "<<< MY FRIENDS ARE LOCATED IN $howmuch FOREIGN ASTROPORT >>>" + +echo "<<< MY FRIENDS ARE LOCATED IN ${#ZENSTATIONS[@]} FOREIGN ASTROPORT >>>" ## UPDATE JSONUPLANET cat ${JSONUPLANET} | jq '. | ."UPname" = "_UPNAME_"' > ~/.zen/tmp/${MOATS}/json.up \ diff --git a/RUNTIME/PLAYER.refresh.sh b/RUNTIME/PLAYER.refresh.sh index 6de90f2c..30e6a3dc 100755 --- a/RUNTIME/PLAYER.refresh.sh +++ b/RUNTIME/PLAYER.refresh.sh @@ -15,21 +15,15 @@ echo "## RUNNING PLAYER.refresh _..._ .' '. _ - / .-""-\ _/ \ + / .-°°-\ _/ \\ .-| /:. | | | | \ |:. /.-'-./ | .-'-;:__.' =/ .'= A=|STRO _.=' / _. | ; ;-.-'| \ | -/ | \ _\ _\ -\__/'._;. ==' ==\ - \ \ | - / / / - /-._/-._/ - MIZ \ `\ \ - `-._/._/ - " +/ | \ _\ _\\ +" PLAYERONE="$1" # [[ $isLAN ]] && PLAYERONE=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) @@ -229,7 +223,7 @@ for PLAYER in ${PLAYERONE[@]}; do ########### ASTROPORT is not IPFSNODEID => EJECT TW if [[ ${IPNSTAIL} != ${IPFSNODEID} || ${IPNSTAIL} == "_ASTROPORT_" ]]; then echo "> PLAYER MOVED TO ${IPNSTAIL} : UNPLUG " - ${MY_PATH}/PLAYER.unplug.sh "${HOME}/.zen/game/players/${PLAYER}/ipfs/moa/index.html" "${PLAYER}" "ONE" "AstroID MUST BE DELETED" + ${MY_PATH}/PLAYER.unplug.sh "${HOME}/.zen/game/players/${PLAYER}/ipfs/moa/index.html" "${PLAYER}" "ONE" "Now TW is plugged to ${ASTROPORT}" echo ">>>> CIAO ${PLAYER}" continue fi @@ -242,7 +236,7 @@ for PLAYER in ${PLAYERONE[@]}; do ############################################## +2 DAYS & AstroID = UNPLUG !! ## REMOVE TW OLDER THAN 2 DAYS WITH AstroID [[ -s ~/.zen/tmp/${MOATS}/AstroID.json && $days -gt 2 && "${CURRENT}" != "${PLAYER}" ]] \ - && ${MY_PATH}/PLAYER.unplug.sh "${HOME}/.zen/game/players/${PLAYER}/ipfs/moa/index.html" "${PLAYER}" "ALL" \ + && ${MY_PATH}/PLAYER.unplug.sh "${HOME}/.zen/game/players/${PLAYER}/ipfs/moa/index.html" "${PLAYER}" "ALL" "TW EJECTION. Found an AstroID in your TW." \ && echo "(#__#) AstroID +2 DAYS = SECURITY ERROR (#__#)" && continue ###################################### diff --git a/tools/COINScheck.sh b/tools/COINScheck.sh index ef30c6af..d5948528 100755 --- a/tools/COINScheck.sh +++ b/tools/COINScheck.sh @@ -62,6 +62,8 @@ echo "SOLDE : $CURCOINS G1" if [[ $CURCOINS == "" || $CURCOINS == "null" ]]; then ( CURCOINS=$(${MY_PATH}/timeout.sh -t 10 ${MY_PATH}/jaklis/jaklis.py balance -p ${G1PUB}) + [[ "$CURCOIN" == "" ]] && echo "JAKLIS ERROR" + [[ "$CURCOIN" == "null" ]] && echo "EMPTY WALLET" echo "$CURCOINS" > "$COINSFILE"