Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: 防止自动ban掉队友预选的英雄 #253

Merged
merged 4 commits into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading