新增查看卡池,新增角色,删除角色,设置up四条命令

This commit is contained in:
2920233418@qq.com 2020-08-19 14:39:38 +08:00
parent 3696e6cad4
commit 1c9d137412
3 changed files with 100 additions and 17 deletions

4
.gitignore vendored
View file

@ -3,4 +3,6 @@ __pycache__
.vscode .vscode
config.py config.py
.idea .idea
test.py test.py
push.cmd
data

View file

@ -1,8 +1,8 @@
3* 2.5% 3* 2.5%
镜华 真步 初音 伊绪 璃乃 亚里莎 杏奈 咲恋 伊莉亚 妮侬 莫妮卡 静流 姬塔 秋乃 真琴 望 纯 镜华 真步 初音 伊绪 璃乃 亚里莎 杏奈 咲恋 伊莉亚 妮侬 莫妮卡 静流 姬塔 秋乃 真琴 望 纯 佩可莉姆(夏日)
2* 18% 2* 18%
雪 千歌 美里 栞 铃奈 茜里 深月 铃 美冬 真阳 忍 美美 惠理子 珠希 绫音 纺希 香织 空花 宫子 雪 千歌 美里 栞 铃奈 茜里 深月 铃 美冬 真阳 忍 美美 惠理子 珠希 绫音 纺希 香织 空花 宫子
1* 79.5% 1* 79.5%
优衣 碧 美咲 凯露 铃莓 依里 可可萝 由加莉 怜 胡桃 未奏希 日和莉 佩可莉姆 莉玛 优衣 碧 美咲 凯露 铃莓 依里 可可萝 由加莉 怜 胡桃 未奏希 日和莉 佩可莉姆 莉玛
up 0.7% up 0.7%
佩可莉姆(夏日) 佩可莉姆(夏日)

View file

@ -2,7 +2,7 @@ import json
from zzcore import StdAns from zzcore import StdAns
from random import randint, choice from random import randint, choice
AllowCMD = ['登记','申请出刀','报刀','挂树','查树','进度','查刀','新的一天','血量','boss','初始化','求助','迁移','踢人','单抽','十连'] AllowCMD = ['登记','申请出刀','报刀','挂树','查树','进度','查刀','新的一天','血量','boss','初始化','求助','迁移','踢人','单抽','十连','查看卡池','查看池子','新增角色','删除角色','设置up']
status = { status = {
'all_player':{ 'all_player':{
@ -276,22 +276,24 @@ class Ans(StdAns):
on_tree_players = on_tree_players + nowdata['all_player'][str(p)]['id'] + '\n' on_tree_players = on_tree_players + nowdata['all_player'][str(p)]['id'] + '\n'
return '救命[CQ:at,qq=3178302597][CQ:at,qq=3430357110]\n' + on_tree_players + '都在🌳上' return '救命[CQ:at,qq=3178302597][CQ:at,qq=3430357110]\n' + on_tree_players + '都在🌳上'
path = './data/pcr/char'
try:
with open(path, 'r+', encoding='utf-8') as f:
characters = f.readlines()
except:
return '好像角色名单没有加载呢。。。'
star3 = characters[1].replace('\n','').split(' ')
star3 = [each for each in star3 if each]
star2 = characters[3].replace('\n', '').split(' ')
star2 = [each for each in star2 if each]
star1 = characters[5].replace('\n', '').split(' ')
star1 = [each for each in star1 if each]
up = characters[7].replace('\n', '').split(' ')
up = [each for each in up if each]
if cmd == '单抽' or cmd == '十连': if cmd == '单抽' or cmd == '十连':
times = 1 if cmd == '单抽' else 9 times = 1 if cmd == '单抽' else 9
try:
with open('./data/pcr/char', 'r+', encoding='utf-8') as f:
characters = f.readlines()
except:
return '好像角色名单没有加载呢。。。'
star3 = characters[1].replace('\n','').split(' ')
star3 = [each for each in star3 if each]
star2 = characters[3].replace('\n', '').split(' ')
star2 = [each for each in star2 if each]
star1 = characters[5].replace('\n', '').split(' ')
star1 = [each for each in star1 if each]
up = characters[7].replace('\n', '').split(' ')
up = [each for each in up if each]
resultStar = [] resultStar = []
resultName = [] resultName = []
for each in range(times): for each in range(times):
@ -343,6 +345,85 @@ class Ans(StdAns):
if stones == 19:return '非酋在上,请受我一拜[CQ:face,id=0][CQ:face,id=118]' if stones == 19:return '非酋在上,请受我一拜[CQ:face,id=0][CQ:face,id=118]'
elif stones > 157:return '欧皇![CQ:face,id=23]啊我酸了' elif stones > 157:return '欧皇![CQ:face,id=23]啊我酸了'
if cmd == '查看卡池' or cmd == '查看池子':
return '3★\n' + ''.join(star3) + '\n2★\n' + ''.join(star2) + '\n1★\n' + ''.join(
star1) + '\n★UP★\n' + ''.join(up)
if cmd == '新增角色':
if self.uid == 2920233418 or self.uid == 1318000868:
if len(self.parms) != 4:
return '请使用句式:/pcr 新增角色 3 镜华'
try:
star = int(self.parms[2])
except:
return '请使用句式:/pcr 新增角色 3 镜华'
name = self.parms[3]
if star == 3:
star3.append(name)
elif star == 2:
star2.append(name)
elif star == 1:
star1.append(name)
else:
return '请输入正确的星级'
char = '3* 2.5%\n{}\n2* 18%\n{}\n1* 79.5%\n{}\nup 0.7%\n{}'.format(' '.join(star3), ' '.join(star2),
' '.join(star1), ' '.join(up))
try:
with open(path, 'w+', encoding='utf-8') as f:
f.write(char)
except:
return '好像角色名单没有加载呢。。。'
return '添加新角色{}{} 成功[CQ:face,id=144][CQ:face,id=144]'.format(star, name)
else:
return '抱歉,您没有使用这条命令的权柄'
if cmd == '删除角色':
if self.uid == 2920233418 or self.uid == 1318000868:
if len(self.parms) != 4:
return '请使用句式:/pcr 删除角色 3 镜华'
try:
star = int(self.parms[2])
except:
return '请使用句式:/pcr 删除角色 3 镜华'
name = self.parms[3]
try:
if star == 3:
star3.remove(name)
elif star == 2:
star2.remove(name)
elif star == 1:
star1.remove(name)
else:
return '请输入正确的星级'
except:
return '没有找到对应的角色'
char = '3* 2.5%\n{}\n2* 18%\n{}\n1* 79.5%\n{}\nup 0.7%\n{}'.format(' '.join(star3), ' '.join(star2),
' '.join(star1), ' '.join(up))
try:
with open(path, 'w+', encoding='utf-8') as f:
f.write(char)
except:
return '好像角色名单没有加载呢。。。'
return '删除角色{}{} 成功'.format(star, name)
else:
return '抱歉,您没有使用这条命令的权柄'
if cmd == '设置up':
if self.uid == 2920233418 or self.uid == 1318000868:
if len(self.parms) != 3:
return '请使用句式:/pcr 设置up 镜华(多位角色请用中文逗号隔开)'
name = self.parms[2]
up = [each for each in name.split('') if each]
char = '3* 2.5%\n{}\n2* 18%\n{}\n1* 79.5%\n{}\nup 0.7%\n{}'.format(' '.join(star3), ' '.join(star2),
' '.join(star1), ' '.join(up))
try:
with open(path, 'w+', encoding='utf-8') as f:
f.write(char)
except:
return '好像角色名单没有加载呢。。。'
return '已成功将{}设为★UP★角色'.format(name)
else:
return '抱歉,您没有使用这条命令的权柄'
def bossname(num): def bossname(num):