# -*- coding:utf-8 -*-
import daiwan
import time
class Actor(object):
def __init__(self, name, area):
self.ranks = []
self.name = name
self.area_id = areas[area]
tmp = daiwan.getUserArea(self.name)
for x in tmp['data']:
if x['area_id'] == self.area_id:
# 1 钻石 6 大师 0 王者
if x['tier'] in (1, 6, 0):
self.qquin = x['qquin']
else:
print('\n 测试版本只允许分析钻石以上段位!')
input()
exit()
return
print('\n 玩家 ID 不存在!')
input()
exit()
areas = {}
judgements = ['挂机局', '浪输局', '甩锅局']
def init():
daiwan.init('API 账号', 'API 密码')
daiwan.getToken()
tmp = daiwan.getArea()
for x in tmp:
areas[x['name']] = int(x['id'])
def isActor(name, area):
jd = 0
person = Actor(name, area)
print('\n 分析中 0%', end='\r')
p = 1
while True:
tmp = daiwan.getCombatList(person.qquin, person.area_id, p)
for x in tmp:
if x['game_type'] == '4' and x['game_mode'] == '4':
person.ranks.append(x)
if len(person.ranks) >= 10:
break
else:
p += 1
players = {}
b = 0
i = 0
all = len(person.ranks)
for combat in person.ranks:
i += 1
tmp = daiwan.getGameDetail(person.qquin, person.area_id, combat['game_id'])
time.sleep(0.5)
for player in tmp['data'][0]['battle']['gamer_records']:
if combat['result'] == '胜利' and player['winclass'] == 'active' and player['qquin'] != person.qquin:
if player['name'] not in players:
players[player['name']] = 1
else:
players[player['name']] += 1
elif combat['result'] == '失败' and player['winclass'] == 'active':
if player['name'] not in players:
players[player['name']] = 1
else:
players[player['name']] += 1
if combat['result'] == '失败' and combat['judgement'] in judgements:
b += 1
percent = (i / all) * 100
print('分析中 %d%%' % percent, end='\r')
a = max(players.values())
rate = (a * 0.02 + b * 0.01) * 100
print('%s 是演员的可能性为 %d%%' % (person.name, rate))
init()
print(
'''
=======================================================
LOL 演员识别器
本程序采用作者自创的非科学算法,纯属娱乐!
=======================================================
'''
)
name = input('请输入玩家 ID :')
area = input('请输入玩家所在大区:')
isActor(name, area)
input()
识别算法是自己瞎编的。。。新手,感觉自己的代码有点乱。。
1
yanchao7511461 2016-05-25 12:20:34 +08:00
识别模型很关键
|
2
lunaticus7 2016-05-25 12:39:34 +08:00
少侠是学 java 出身吧^_^
|
3
cjyang1128 2016-05-25 12:40:47 +08:00
哪过第三方 API
|
4
hard2reg OP @cjyang1128 百度 “带玩游戏平台”。不能多说了,有推广嫌疑。。。
|
5
hard2reg OP @lunaticus7 何以见得
|
6
gkiwi 2016-05-25 14:27:55 +08:00
青铜的怎么办!
|
8
changwei 2016-05-25 18:43:31 +08:00
腾讯 TGP 啊,某玩游戏盒子啊不知道他们是什么算法检测的
|
9
cjyang1128 2016-05-25 22:20:47 +08:00
@hard2reg thx
|
10
alittletrain 2016-05-26 08:35:41 +08:00
@hard2reg 请教哪个平台的 api ?
|
11
hard2reg OP @alittletrain 见 4L ,我已经说了。
|