fix scpt
This commit is contained in:
parent
c3d75140d8
commit
d990a50541
@ -38,16 +38,16 @@ case $1 in
|
|||||||
at-profile
|
at-profile
|
||||||
;;
|
;;
|
||||||
download-character-icon)
|
download-character-icon)
|
||||||
source $d/ai/syui/game/character.zsh
|
source $d/src/ai/syui/game/character.zsh
|
||||||
download_character_icon
|
download_character_icon
|
||||||
;;
|
;;
|
||||||
create-game-character)
|
create-game-character)
|
||||||
source $d/ai/syui/game/character.zsh
|
source $d/src/ai/syui/game/character.zsh
|
||||||
create_game_character
|
create_game_character
|
||||||
;;
|
;;
|
||||||
ai-create-user)
|
ai-create-user)
|
||||||
source $d/ai/syui/game/character.zsh
|
source $d/src/ai/syui/game/character.zsh
|
||||||
ai_create_user
|
ai_create_user $2
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "${help[@]}"
|
echo "${help[@]}"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
echo $token
|
||||||
character=(
|
character=(
|
||||||
ai
|
ai
|
||||||
manny
|
manny
|
||||||
@ -190,59 +191,58 @@ json="{
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ai_create_user() {
|
function ai_create_user() {
|
||||||
|
|
||||||
col=ai.syui.game.user
|
col=ai.syui.game.user
|
||||||
rkey=ai
|
rkey=$1
|
||||||
did=$did_yui
|
did=$did_yui
|
||||||
handle=$handle_yui
|
handle=$handle_yui
|
||||||
|
pds=bsky.social
|
||||||
#rkey=syui
|
#rkey=syui
|
||||||
#img=https://cdn.bsky.app/img/feed_thumbnail/plain/did:plc:4hqjfn7m6n5hno3doamuhgef/bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy@jpeg
|
#img=https://cdn.bsky.app/img/feed_thumbnail/plain/did:plc:4hqjfn7m6n5hno3doamuhgef/bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy@jpeg
|
||||||
req=com.atproto.repo.putRecord
|
req=com.atproto.repo.putRecord
|
||||||
url=https://$host/xrpc/$req
|
url=https://$pds/xrpc/$req
|
||||||
|
|
||||||
for ((i=1; i<=${#character}; i++)); do
|
cname=dragon
|
||||||
|
cid=bafkreia3huw2gdenqatoobx3hcft74chced46bw4znfgepo5aenegobkri
|
||||||
|
|
||||||
cname=${character[$i]}
|
if [ "$rkey" = "ai" ];then
|
||||||
cid=${img[$i]}
|
cname=$rkey
|
||||||
imguri=https://cdn.bsky.app/img/feed_thumbnail/plain/$did_yui/${cid}@jpeg
|
cid=bafkreie34pjuc6coenzcdwrgrh4fbacq7bkhsz263g5vpbsqxwaz37kkwy
|
||||||
echo $imguri
|
gender=none
|
||||||
echo $i $character $cname
|
fi
|
||||||
season=1
|
if [ "$rkey" = "syui" ];then
|
||||||
group=test
|
cname=chinese
|
||||||
lv=1
|
cid=bafkreidlealfybajqzwv5eoz4jshnsijc2vnktlhpw4ph47krwj6aigqby
|
||||||
hp=100
|
gender=male
|
||||||
exp=0
|
fi
|
||||||
rank=0
|
imguri=https://cdn.bsky.app/img/feed_thumbnail/plain/$did_yui/${cid}@jpeg
|
||||||
mode=0
|
season=1
|
||||||
attack=0
|
group=test
|
||||||
attack_post=0
|
lv=1
|
||||||
critical=0
|
hp=1
|
||||||
critical_d=0
|
exp=0
|
||||||
|
rank=0
|
||||||
|
mode=0
|
||||||
|
attack=0
|
||||||
|
attack_post=0
|
||||||
|
critical=0
|
||||||
|
critical_d=0
|
||||||
|
|
||||||
case $cname in
|
case $cname in
|
||||||
ai)
|
ai)
|
||||||
group=origin
|
group=origin
|
||||||
season=0
|
season=0
|
||||||
mode=2
|
mode=2
|
||||||
;;
|
;;
|
||||||
manny|quinn)
|
manny|quinn)
|
||||||
group=test
|
group=test
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
group=fantasy
|
group=fantasy
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
json="\"$cname\": { \"group\": \"$group\", \"season\": $season, \"img\": \"$imguri\", \"lv\": $lv, \"exp\": $exp, \"hp\": $hp, \"rank\": $rank, \"mode\": $mode, \"attack\": $attack, \"attack_post\": $attack_post, \"critical\": $critical, \"critical_d\": $critical_d }"
|
||||||
|
|
||||||
jc="\"$cname\": { \"group\": \"$group\", \"season\": $season, \"img\": \"$imguri\", \"lv\": $lv, \"exp\": $exp, \"hp\": $hp, \"rank\": $rank, \"mode\": $mode, \"attack\": $attack, \"attack_post\": $attack_post, \"critical\": $critical, \"critical_d\": $critical_d }"
|
v1_json="
|
||||||
|
|
||||||
if [ $#character -ne $i ];then
|
|
||||||
jc=${jc},
|
|
||||||
fi
|
|
||||||
|
|
||||||
json=${json}${jc}
|
|
||||||
|
|
||||||
done
|
|
||||||
json="
|
|
||||||
{
|
{
|
||||||
\"repo\": \"$handle_yui\",
|
\"repo\": \"$handle_yui\",
|
||||||
\"did\": \"$did_yui\",
|
\"did\": \"$did_yui\",
|
||||||
@ -254,7 +254,7 @@ function ai_create_user() {
|
|||||||
\"login\": false,
|
\"login\": false,
|
||||||
\"handle\": \"$handle\",
|
\"handle\": \"$handle\",
|
||||||
\"aiten\": 10,
|
\"aiten\": 10,
|
||||||
\"gender\": \"famale\",
|
\"gender\": \"$gender\",
|
||||||
\"character\": {
|
\"character\": {
|
||||||
$json
|
$json
|
||||||
},
|
},
|
||||||
@ -263,13 +263,36 @@ function ai_create_user() {
|
|||||||
}
|
}
|
||||||
}"
|
}"
|
||||||
|
|
||||||
|
json="
|
||||||
|
{
|
||||||
|
\"repo\": \"$handle_yui\",
|
||||||
|
\"did\": \"$did_yui\",
|
||||||
|
\"collection\": \"$col\",
|
||||||
|
\"rkey\": \"$rkey\",
|
||||||
|
\"record\": {
|
||||||
|
\"version\": 2,
|
||||||
|
\"player\": {
|
||||||
|
\"did\": \"$did\",
|
||||||
|
\"handle\": \"$handle\",
|
||||||
|
\"pds\": \"$pds\",
|
||||||
|
\"limit\": false,
|
||||||
|
\"login\": false,
|
||||||
|
\"aiten\": 0,
|
||||||
|
\"gender\": \"$gender\"
|
||||||
|
},
|
||||||
|
\"character\": {
|
||||||
|
$json
|
||||||
|
},
|
||||||
|
\"createdAt\": \"${created}\",
|
||||||
|
\"updatedAt\": \"${created}\"
|
||||||
|
}
|
||||||
|
}"
|
||||||
|
|
||||||
if echo $json|jq . ;then
|
if echo $json|jq . ;then
|
||||||
echo $token_yui
|
|
||||||
echo y
|
echo y
|
||||||
read y
|
read y
|
||||||
if [ "y" = "$y" ];then
|
if [ "y" = "$y" ];then
|
||||||
curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token_yui" -d $json $url
|
curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d $json $url
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -294,9 +317,8 @@ if echo $json|jq . ;then
|
|||||||
echo y
|
echo y
|
||||||
read y
|
read y
|
||||||
if [ "y" = "$y" ];then
|
if [ "y" = "$y" ];then
|
||||||
curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token_yui" -d $json $url
|
curl -sL -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" -d $json $url
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user