Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzaphkiel committed Jun 10, 2024
2 parents 6abb22a + c6a1160 commit f864eaf
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class Config(QConfig):
YEAR = 2023
AUTHOR = "Zzaphkiel"
VERSION = "0.12.2"
BETA = "0.13.0-beta2"
BETA = "0.13.0-beta3"
FEEDBACK_URL = "https://github.com/Zzaphkiel/Seraphine/issues?q=is%3Aissue"
GITHUB_URL = "https://github.com/Zzaphkiel/Seraphine"
LOCAL_PATH = f"{os.getenv('APPDATA')}\\Seraphine"
Expand Down
44 changes: 34 additions & 10 deletions app/lol/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,6 @@ async def parseAllyGameInfo(session, currentSummonerId, useSGP=False):
tasks = [getSummonerGamesInfoViaSGP(item, isRank, currentSummonerId, token)
for item in session['myTeam']]
summoners = await asyncio.gather(*tasks)

except:
tasks = [parseSummonerGameInfo(item, isRank, currentSummonerId)
for item in session['myTeam']]
Expand Down Expand Up @@ -1006,7 +1005,7 @@ async def parseSummonerGameInfo(item, isRank, currentSummonerId):
recentlyChampionId)

return {
"name": summoner.get("name") or summoner.get("internalName"),
"name": summoner.get("gameName") or summoner.get("internalName"),
'tagLine': summoner.get("tagLine"),
"icon": icon,
'championId': championId,
Expand Down Expand Up @@ -1044,7 +1043,10 @@ async def getSummonerGamesInfoViaSGP(item, isRank, currentSummonerId, token):

championId = item.get('championId') or 0
icon = await connector.getChampionIcon(championId)
summoner = await connector.getSummonerByPuuidViaSGP(token, puuid)
# SGP 接口返回的 summoner name 不是最新的,导致右侧点击召唤师名后搜不到
# 重新使用 LCU API
# summoner = await connector.getSummonerByPuuidViaSGP(token, puuid)
summoner = await connector.getSummonerByPuuid(puuid)

try:
origRankInfo = await connector.getRankedStatsByPuuid(puuid)
Expand Down Expand Up @@ -1074,7 +1076,7 @@ async def getSummonerGamesInfoViaSGP(item, isRank, currentSummonerId, token):
except:
gamesInfo = []
else:
tagLine = getTagLineFromGame(origGamesInfo['games'][0], puuid)
# tagLine = getTagLineFromGame(origGamesInfo['games'][0], puuid)

tasks = [parseGamesDataFromSGP(game, puuid)
for game in origGamesInfo["games"][:11]]
Expand Down Expand Up @@ -1105,17 +1107,17 @@ async def getSummonerGamesInfoViaSGP(item, isRank, currentSummonerId, token):
recentlyChampionId)

return {
"name": summoner.get("name") or summoner.get("internalName"),
'tagLine': tagLine,
"name": summoner.get("gameName"),
'tagLine': summoner.get('tagLine'),
"icon": icon,
'championId': championId,
"level": summoner["level"],
"level": summoner["summonerLevel"],
"rankInfo": rankInfo,
"gamesInfo": gamesInfo,
"xpSinceLastLevel": summoner["expPoints"],
"xpUntilNextLevel": summoner["expToNextLevel"],
"xpSinceLastLevel": summoner["xpSinceLastLevel"],
"xpUntilNextLevel": summoner["xpUntilNextLevel"],
"puuid": puuid,
"summonerId": summoner['id'],
"summonerId": summoner['summonerId'],
"kda": [kill, deaths, assists],
"cellId": item.get("cellId"),
"selectedPosition": item.get("selectedPosition"),
Expand All @@ -1125,6 +1127,28 @@ async def getSummonerGamesInfoViaSGP(item, isRank, currentSummonerId, token):
"recentlyChampionName": recentlyChampionName
}

# 适用于 SGP API 返回值
# return {
# "name": summoner.get("gameName"),
# 'tagLine': tagLine,
# "icon": icon,
# 'championId': championId,
# "level": summoner["level"],
# "rankInfo": rankInfo,
# "gamesInfo": gamesInfo,
# "xpSinceLastLevel": summoner["expPoints"],
# "xpUntilNextLevel": summoner["expToNextLevel"],
# "puuid": puuid,
# "summonerId": summoner['id'],
# "kda": [kill, deaths, assists],
# "cellId": item.get("cellId"),
# "selectedPosition": item.get("selectedPosition"),
# "fateFlag": fateFlag,
# "isPublic": summoner["privacy"] == "PUBLIC",
# # 最近游戏的英雄 (用于上一局与与同一召唤师游玩之后显示)
# "recentlyChampionName": recentlyChampionName
# }


def getTeammatesFromSGPGame(game, puuid):
json = game['json']
Expand Down

0 comments on commit f864eaf

Please sign in to comment.