Skip to content

Commit

Permalink
Merge pull request #253 from Ninohana/main
Browse files Browse the repository at this point in the history
防止自动 ban 掉队友预选的英雄,修复无法选择其他英雄
  • Loading branch information
Zzaphkiel authored Feb 22, 2024
2 parents 652cc6f + e705aa8 commit 5e9b713
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions app/view/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,23 +990,40 @@ def __onChampSelectChanged(self, data):
if isAutoBan or isAutoSelect:
def selectOrBan():
localPlayerCellId = data["data"]["localPlayerCellId"]
team = data["data"]["myTeam"]
actions = data["data"]["actions"]
for actionGroup in actions:
for action in actionGroup:
if (action["actorCellId"] == localPlayerCellId
and not action["completed"]):
actionId = action["id"]
if action["type"] == "pick" and isAutoSelect:
championId = connector.manager.getChampionIdByName(
cfg.get(cfg.autoSelectChampion))
connector.selectChampion(actionId, championId)
break
elif action["type"] == "ban" and isAutoBan:
if isAutoSelect and action["type"] == "pick":
isPicked = False
for player in team:
if player["cellId"] == localPlayerCellId:
isPicked = bool(player["championId"]) or bool(player["championPickIntent"])
break

if not isPicked:
championId = connector.manager.getChampionIdByName(
cfg.get(cfg.autoSelectChampion))
connector.selectChampion(actionId, championId)

elif isAutoBan and action["type"] == "ban":
if action["isInProgress"]:
championId = connector.manager.getChampionIdByName(
cfg.get(cfg.autoBanChampion))

isFriendly = cfg.get(cfg.pretentBan)
if isFriendly:
for player in team:
if championId == player["championPickIntent"]:
championId = 0
break

connector.banChampion(actionId, championId)
break

break

threading.Thread(target=selectOrBan).start()

Expand Down

0 comments on commit 5e9b713

Please sign in to comment.