diff --git a/app/view/main_window.py b/app/view/main_window.py index a720a6bb..b76b44e4 100644 --- a/app/view/main_window.py +++ b/app/view/main_window.py @@ -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()