提交 8414bc3a 编辑于 作者: windylh's avatar windylh
浏览文件

fix:well & add:miner

上级 1a629347
......@@ -11,4 +11,3 @@ expiringdict>=1.2.0
aiocqhttp>=0.6.8
quart>=0.6.15
jinja2~=2.10
numpy~=1.17.2
......@@ -5,7 +5,6 @@ import time
from dataclasses import dataclass
from typing import Dict, List, Optional, Tuple
from urllib.parse import urljoin
import numpy as np
import aiohttp
import requests
......@@ -215,20 +214,35 @@ class Consult:
result = search['data']['result']
return list(map(self._parse_pcrdfans_team, result))
def miner(self, cmd: str):
this_season = np.zeros(15001)
all_season = np.zeros(15001)
def get_this_season(rank):
"""
this_season[1:11] = 50
this_season[11:101] = 10
this_season[101:201] = 5
this_season[201:501] = 3
this_season[501:1001] = 2
this_season[1001:2001] = 2
this_season[501:2001] = 2
this_season[2001:4000] = 1
this_season[4000:8000:100] = 50
this_season[8100:15001:100] = 15
"""
if rank <= 11:
return 50 *(rank-1)
elif rank <= 101:
return 10*(rank-11) + 50*10
elif rank <= 201:
return 5*(rank-101) + 10*90 + 50*10
elif rank <= 501:
return 3*(rank-201) + 5*100 +10*90 + 50*10
elif rank <= 2001:
return 2*(rank-501) + 3*300 + 5*100 +10*90 + 50*10
elif rank <= 4000:
return 1*(rank-2001) + 2*1500 + 3*300 + 5*100 +10*90 + 50*10
elif rank <= 8000:
return (rank-4000)//100*50 + 1*1999 + 2*1500 + 3*300 + 5*100 +10*90 + 50*10
else:
return (rank-8001)//100*15 + 40*50 + 1*1999 + 2*1500 + 3*300 + 5*100 +10*90 + 50*10
def get_all_season(self, rank):
"""
all_season[1:11] = 500
all_season[11:101] = 50
all_season[101:201] = 30
......@@ -238,13 +252,30 @@ class Consult:
all_season[2001:4001] = 2
all_season[4001:7999] = 1
all_season[8100:15001:100] = 30
"""
if rank <= 11:
return 500 *(rank-1)
elif rank <= 101:
return 50*(rank-11) + 500*10
elif rank <= 201:
return 30*(rank-101) + 50*90 + 500*10
elif rank <= 501:
return 10*(rank-201) + 30*100 +50*90 + 500*10
elif rank <= 1001:
return 5* (rank-501) + 10*300 + 30*100 +50*90 + 500*10
elif rank <= 2001:
return 3*(rank-1001) + 5*500 + 10*300 + 30*100 +50*90 + 500*10
elif rank <= 4001:
return 2*(rank-2001) + 3*1000 + 5*500 + 10*300 + 30*100 +50*90 + 500*10
elif rank <= 7999:
return (rank-4001) + 2*2000 + 3*1000 + 5*500 + 10*300 + 30*100 +50*90 + 500*10
else:
return (rank-8001)//100*30 + 3998 + 2*2000 + 3*1000 + 5*500 + 10*300 + 30*100 +50*90 + 500*10
def miner(self, cmd: str):
cmd = cmd.lstrip()
if cmd.isdigit() and 15001 >= int(cmd) >= 1:
rank = int(cmd)
rank = np.clip(rank, 1, 15001)
s_all = int(all_season[1:rank].sum())
s_this = int(this_season[1:rank].sum())
reply = "当前排名为:{}\n最高排名奖励还剩 {} 钻\n历届最高排名还剩 {} 钻".format(rank, s_this, s_all)
reply = "当前排名为:{}\n最高排名奖励还剩 {} 钻\n历届最高排名还剩 {} 钻".format(rank, get_this_season(rank), get_all_season(rank))
return reply
else:
reply = "请输入1~15001之间的整数"
......
Supports Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册