${#ZENSTATIONS[@]}

This commit is contained in:
fred 2024-04-16 22:24:38 +02:00
parent 974d506af5
commit 54d4837fd6
3 changed files with 25 additions and 18 deletions

View File

@ -67,10 +67,14 @@ cat ~/.zen/tmp/${MOATS}/G1ForkUPlanetZERO.json \
| jq -rc .[] | head -n 1 > ~/.zen/tmp/${MOATS}/ONEuplanet.json | jq -rc .[] | head -n 1 > ~/.zen/tmp/${MOATS}/ONEuplanet.json
JSONUPLANET="${HOME}/.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=$(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 ? HASH=$(cat ${JSONUPLANET} | jq -r ".hash") ## What text hash it has ?
SECRET=$(cat ${JSONUPLANET} | jq -r ".secret") ## What is secret ? SECRET=$(cat ${JSONUPLANET} | jq -r ".secret") ## What is secret ?
@ -144,7 +148,6 @@ echo "${ENCODING}"
################################################################# #################################################################
## MAKE SAME ENCODING FOR FRIENDS ## MAKE SAME ENCODING FOR FRIENDS
friends=($(ls ~/.zen/game/players/${PLAYER}/FRIENDS | grep "@" 2>/dev/null)) friends=($(ls ~/.zen/game/players/${PLAYER}/FRIENDS | grep "@" 2>/dev/null))
howmuch=0
for f in ${friends[@]}; for f in ${friends[@]};
do do
## Extract FRIENDG1PUB from TW (Astroport Tiddler) ## Extract FRIENDG1PUB from TW (Astroport Tiddler)
@ -155,6 +158,8 @@ do
[[ ${ASTROPORT} != "/ipns/${IPFSNODEID}" ]] && echo "FOREIGN ASTROPORT=${ASTROPORT}" && foreign="YES" [[ ${ASTROPORT} != "/ipns/${IPFSNODEID}" ]] && echo "FOREIGN ASTROPORT=${ASTROPORT}" && foreign="YES"
echo "$f : $FRIENDG1PUB" echo "$f : $FRIENDG1PUB"
ASTROPORTS=("${ASTROPORTS[@]}" "${ATROPORT}")
if [[ ${FRIENDG1PUB} && ${FRIENDG1PUB} != "null" ]]; then if [[ ${FRIENDG1PUB} && ${FRIENDG1PUB} != "null" ]]; then
#~ CHECK IF ALREADY IN JSON #~ CHECK IF ALREADY IN JSON
@ -179,22 +184,28 @@ do
continue continue
fi fi
ZENSTATIONS=($(echo "${ASTROPORTS[@]}" | tr ' ' '\n' | sort -u))
## CHECK IF FRIEND HAVE THE SAME ${UPNAME} tiddler ## CHECK IF FRIEND HAVE THE SAME ${UPNAME} tiddler
if [[ ${foreign} == "YES" ]]; then if [[ ${foreign} == "YES" ]]; then
howmuch=$(( howmuch + 1 ))
## SEARCH FOR ${UPNAME} tiddler IN FRIEND TW ## 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}" 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 fi
done done
echo "<<< MY FRIENDS ARE LOCATED IN $howmuch FOREIGN ASTROPORT >>>"
echo "<<< MY FRIENDS ARE LOCATED IN ${#ZENSTATIONS[@]} FOREIGN ASTROPORT >>>"
## UPDATE JSONUPLANET ## UPDATE JSONUPLANET
cat ${JSONUPLANET} | jq '. | ."UPname" = "_UPNAME_"' > ~/.zen/tmp/${MOATS}/json.up \ cat ${JSONUPLANET} | jq '. | ."UPname" = "_UPNAME_"' > ~/.zen/tmp/${MOATS}/json.up \

View File

@ -15,21 +15,15 @@ echo "## RUNNING PLAYER.refresh
_..._ _..._
.' '. _ .' '. _
/ .-""-\ _/ \ / .-°°-\ _/ \\
.-| /:. | | | .-| /:. | | |
| \ |:. /.-'-./ | \ |:. /.-'-./
| .-'-;:__.' =/ | .-'-;:__.' =/
.'= A=|STRO _.=' .'= A=|STRO _.='
/ _. | ; / _. | ;
;-.-'| \ | ;-.-'| \ |
/ | \ _\ _\ / | \ _\ _\\
\__/'._;. ==' ==\ "
\ \ |
/ / /
/-._/-._/
MIZ \ `\ \
`-._/._/
"
PLAYERONE="$1" PLAYERONE="$1"
# [[ $isLAN ]] && PLAYERONE=$(cat ~/.zen/game/players/.current/.player 2>/dev/null) # [[ $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 ########### ASTROPORT is not IPFSNODEID => EJECT TW
if [[ ${IPNSTAIL} != ${IPFSNODEID} || ${IPNSTAIL} == "_ASTROPORT_" ]]; then if [[ ${IPNSTAIL} != ${IPFSNODEID} || ${IPNSTAIL} == "_ASTROPORT_" ]]; then
echo "> PLAYER MOVED TO ${IPNSTAIL} : UNPLUG " 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}" echo ">>>> CIAO ${PLAYER}"
continue continue
fi fi
@ -242,7 +236,7 @@ for PLAYER in ${PLAYERONE[@]}; do
############################################## +2 DAYS & AstroID = UNPLUG !! ############################################## +2 DAYS & AstroID = UNPLUG !!
## REMOVE TW OLDER THAN 2 DAYS WITH AstroID ## REMOVE TW OLDER THAN 2 DAYS WITH AstroID
[[ -s ~/.zen/tmp/${MOATS}/AstroID.json && $days -gt 2 && "${CURRENT}" != "${PLAYER}" ]] \ [[ -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 && echo "(#__#) AstroID +2 DAYS = SECURITY ERROR (#__#)" && continue
###################################### ######################################

View File

@ -62,6 +62,8 @@ echo "SOLDE : $CURCOINS G1"
if [[ $CURCOINS == "" || $CURCOINS == "null" ]]; then if [[ $CURCOINS == "" || $CURCOINS == "null" ]]; then
( (
CURCOINS=$(${MY_PATH}/timeout.sh -t 10 ${MY_PATH}/jaklis/jaklis.py balance -p ${G1PUB}) 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" echo "$CURCOINS" > "$COINSFILE"