From 3e500a84dd0ea2cae4fcdcaaf5255a25234812e6 Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Thu, 23 Nov 2023 15:16:26 +0800 Subject: [PATCH 1/9] Update max level to 10 --- arena.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arena.py b/arena.py index 03140e7..06bf816 100644 --- a/arena.py +++ b/arena.py @@ -349,7 +349,7 @@ def spend_gold(self, speedy=False) -> None: min_gold = 100 if speedy else (24 if self.spam_roll else 56) while first_run or arena_functions.get_gold() >= min_gold: if not first_run: - if arena_functions.get_level() != 9: + if arena_functions.get_level() != 10: mk_functions.buy_xp() print(" Purchasing XP") mk_functions.reroll() From ed9b889179c3c915423cc68cc162f41857776fbf Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Fri, 24 Nov 2023 02:31:46 +0800 Subject: [PATCH 2/9] Avoid ValueError when indexing --- game.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/game.py b/game.py index fca8ffb..049c03d 100644 --- a/game.py +++ b/game.py @@ -116,7 +116,11 @@ def second_round(self) -> None: """Move unknown champion to board after first carousel""" print(f"\n[Second Round] {self.round}") self.message_queue.put("CLEAR") - self.arena.bench[arena_functions.bench_occupied_check().index(True)] = "?" + while True: + result = arena_functions.bench_occupied_check() + if any(result): + break + self.arena.bench[result.index(True)] = "?" self.arena.move_unknown() self.end_round_tasks() From 46c37c7bae8661e471ba910f6cdc8a0ddc08b7c4 Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Fri, 24 Nov 2023 03:06:57 +0800 Subject: [PATCH 3/9] Ability to specify what trait(s) of headliner should purchase --- arena.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arena.py b/arena.py index 06bf816..7ebffe1 100644 --- a/arena.py +++ b/arena.py @@ -367,7 +367,9 @@ def spend_gold(self, speedy=False) -> None: self.buy_champion(champion, 1) elif ( champion[0] == 4 - and arena_functions.check_headliner() + and ( + arena_functions.check_headliner() & comps.get_headliner_tag(champion[1]) != 0 + ) and not self.have_headliner and comps.COMP[champion[1]]["final_comp"] and arena_functions.get_gold() From 7d809c875231c6e12476048367a7f8a91fc93e3b Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Fri, 24 Nov 2023 03:07:18 +0800 Subject: [PATCH 4/9] Ability to specify what trait(s) of headliner should purchase --- comps.py | 51 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 14 deletions(-) diff --git a/comps.py b/comps.py index 499be36..bae0f1c 100644 --- a/comps.py +++ b/comps.py @@ -2,69 +2,83 @@ Team composition used by the bot Comps come from https://tftactics.gg/tierlist/team-comps Items are in camel case and a-Z +The "headliner" tag represents a trait from bottom to top. +Set to True if you want it in your board. +Only final comp champion will be headliner and need to set 'headliner' tag to True. +More info in README """ COMP = { "MissFortune": { "board_position": 6, - "items": ["Deathblade","LastWhisper","GuinsoosRageblade"], + "items": ["Deathblade", "LastWhisper", "GuinsoosRageblade"], "level": 2, - "final_comp": True + "final_comp": True, + "headliner": [False, True, False] }, "Neeko": { "board_position": 24, - "items": ["WarmogsArmor","BrambleVest","DragonsClaw"], + "items": ["WarmogsArmor", "BrambleVest", "DragonsClaw"], "level": 3, - "final_comp": True + "final_comp": True, + "headliner": [False, False, False] }, "Lucian": { "board_position": 3, "items": ["StatikkShiv"], "level": 2, - "final_comp": True + "final_comp": True, + "headliner": [False, True, False] }, "Kennen": { "board_position": 17, "items": ["Evenshroud"], "level": 2, - "final_comp": True + "final_comp": True, + "headliner": [False, False, False] }, "Ekko": { "board_position": 5, "items": [], "level": 2, - "final_comp": True + "final_comp": True, + "headliner": [False, False, False] }, "Bard": { "board_position": 0, "items": [], "level": 2, - "final_comp": True + "final_comp": True, + "headliner": [False, True, False] }, "KaiSa": { "board_position": 1, "items": [], "level": 2, - "final_comp": True + "final_comp": True, + "headliner": [False, False, False] }, "Lillia": { "board_position": 16, "items": [], "level": 2, - "final_comp": True + "final_comp": True, + "headliner": [False, False, False] }, "KSante": { "board_position": 25, "items": [], "level": 2, - "final_comp": False + "final_comp": False, + "headliner": [False, False, False] }, "Corki": { "board_position": 7, "items": [], "level": 2, - "final_comp": False - } + "final_comp": False, + "headliner": [False, False, False] + }, } # No logic for certain augments meaning the bot won't know what to do if they are included in here @@ -72,7 +86,7 @@ AUGMENTS: list[str] = [ "That's Jazz Baby!", "You Have My Bow", - "Blistering Strikes" + "Blistering Strikes", "Buried Treasures", "Switching Gears", "Caretaker's Favor", @@ -140,3 +154,12 @@ def get_unknown_slots() -> list: for _, champion_data in COMP.items(): container.append(champion_data["board_position"]) return [n for n in range(27) if n not in container] + + +def get_headliner_tag(name: str) -> int: + """Return what trait of specify champion can become headliner""" + return ( + int(COMP[name]["headliner"][0]) + + int(COMP[name]["headliner"][1]) * 2 + + int(COMP[name]["headliner"][2]) * 4 + ) From b6d2ea999c4891ec6e4322b3cbb1ce7d52c3c056 Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Fri, 24 Nov 2023 03:17:10 +0800 Subject: [PATCH 5/9] Update docstring --- comps.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/comps.py b/comps.py index bae0f1c..7cca768 100644 --- a/comps.py +++ b/comps.py @@ -4,7 +4,7 @@ Items are in camel case and a-Z The "headliner" tag represents a trait from bottom to top. Set to True if you want it in your board. -Only final comp champion will be headliner and need to set 'headliner' tag to True. +Only final comp champion will become headliner and need to set the corresponding 'headliner' tag to True. More info in README """ @@ -78,7 +78,7 @@ "level": 2, "final_comp": False, "headliner": [False, False, False] - }, + } } # No logic for certain augments meaning the bot won't know what to do if they are included in here From 1cb8098582d50bbfa0ca4a8deda3429cc352cb9a Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Fri, 24 Nov 2023 04:38:17 +0800 Subject: [PATCH 6/9] Add files via upload --- arena_functions.py | 7 ++++--- screen_coords.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arena_functions.py b/arena_functions.py index 592ca72..8d9bb73 100644 --- a/arena_functions.py +++ b/arena_functions.py @@ -149,7 +149,8 @@ def get_items() -> list: def check_headliner() -> bool: """Check if the last Champion in the store is a headliner""" - for positions in screen_coords.HEADLINER_POS: + result: int = 0 + for index, positions in enumerate(screen_coords.HEADLINER_POS): headliner: str = ocr.get_text( screenxy=positions.get_coords(), scale=3, @@ -157,5 +158,5 @@ def check_headliner() -> bool: whitelist=ocr.ROUND_WHITELIST.replace("-", ""), ) if headliner == "2": - return True - return False + result += 2**index + return result diff --git a/screen_coords.py b/screen_coords.py index a830af7..7eb7aa2 100644 --- a/screen_coords.py +++ b/screen_coords.py @@ -69,9 +69,9 @@ VICTORY_POS: Vec4 = Vec4(GameWindow(906, 560, 1030, 587)) HEADLINER_POS: list[Vec4] = [ - Vec4(GameWindow(1280, 964, 1289, 976)), + Vec4(GameWindow(1280, 1018, 1289, 1030)), Vec4(GameWindow(1280, 990, 1289, 1002)), - Vec4(GameWindow(1280, 1018, 1289, 1030)) + Vec4(GameWindow(1280, 964, 1289, 976)) ] BUY_LOC: list[Vec2] = [ From 93bb01147732e9f9acf56afb35cd61f75fdc6d00 Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Fri, 24 Nov 2023 04:41:46 +0800 Subject: [PATCH 7/9] Update Docstring --- comps.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/comps.py b/comps.py index 7cca768..356992e 100644 --- a/comps.py +++ b/comps.py @@ -5,7 +5,8 @@ The "headliner" tag represents a trait from bottom to top. Set to True if you want it in your board. Only final comp champion will become headliner and need to set the corresponding 'headliner' tag to True. -More info in README +e.g. Only want "Sentinel" Ekko, set it to "headliner": [True, False, False] +e.g.2 want either "Sentinel" or "True Damage" Ekko, set it to "headliner": [True, False, True] """ COMP = { From c807ca4710af6087026e1bb650b33da281aa6d87 Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Sat, 25 Nov 2023 20:43:05 +0800 Subject: [PATCH 8/9] Update champions trait --- game_assets.py | 120 +++++++++++++++++++++++++------------------------ 1 file changed, 61 insertions(+), 59 deletions(-) diff --git a/game_assets.py b/game_assets.py index 3f16a07..89ed627 100644 --- a/game_assets.py +++ b/game_assets.py @@ -36,65 +36,67 @@ ITEMS: set[str] = BASIC_ITEM.union(COMBINED_ITEMS).union(SUPPORT_ITEM).union(NON_CRAFTABLE_ITEMS).union(ORNN_ITEMS) CHAMPIONS: dict[str, dict[str, int]] = { - "Ahri": {"Gold": 4, "Board Size": 1}, - "Akali": {"Gold": 4, "Board Size": 1}, - "Amumu": {"Gold": 3, "Board Size": 1}, - "Annie": {"Gold": 1, "Board Size": 1}, - "Aphelios": {"Gold": 2, "Board Size": 1}, - "Bard": {"Gold": 2, "Board Size": 1}, - "Blitzcrank": {"Gold": 4, "Board Size": 1}, - "Caitlyn": {"Gold": 4, "Board Size": 1}, - "Corki": {"Gold": 1, "Board Size": 1}, - "Ekko": {"Gold": 3, "Board Size": 1}, - "Evelynn": {"Gold": 1, "Board Size": 1}, - "Ezreal": {"Gold": 4, "Board Size": 1}, - "Garen": {"Gold": 2, "Board Size": 1}, - "Gnar": {"Gold": 2, "Board Size": 1}, - "Gragas": {"Gold": 2, "Board Size": 1}, - "Illaoi": {"Gold": 5, "Board Size": 1}, - "Jax": {"Gold": 2, "Board Size": 1}, - "Jhin": {"Gold": 5, "Board Size": 1}, - "Jinx": {"Gold": 1, "Board Size": 1}, - "KaiSa": {"Gold": 2, "Board Size": 1}, - "Karthus": {"Gold": 4, "Board Size": 1}, - "Katarina": {"Gold": 2, "Board Size": 1}, - "Kayle": {"Gold": 2, "Board Size": 1}, - "Kayn": {"Gold": 5, "Board Size": 1}, - "Kennen": {"Gold": 1, "Board Size": 1}, - "KSante": {"Gold": 1, "Board Size": 1}, - "Lillia": {"Gold": 1, "Board Size": 1}, - "Lucian": {"Gold": 5, "Board Size": 1}, - "Lulu": {"Gold": 3, "Board Size": 1}, - "Lux": {"Gold": 3, "Board Size": 1}, - "MissFortune": {"Gold": 3, "Board Size": 1}, - "Mordekaiser": {"Gold": 3, "Board Size": 1}, - "Nami": {"Gold": 1, "Board Size": 1}, - "Neeko": {"Gold": 3, "Board Size": 1}, - "Olaf": {"Gold": 1, "Board Size": 1}, - "Pantheon": {"Gold": 2, "Board Size": 1}, - "Poppy": {"Gold": 4, "Board Size": 1}, - "Qiyana": {"Gold": 5, "Board Size": 1}, - "Riven": {"Gold": 3, "Board Size": 1}, - "Samira": {"Gold": 3, "Board Size": 1}, - "Senna": {"Gold": 2, "Board Size": 1}, - "Seraphine": {"Gold": 2, "Board Size": 1}, - "Sett": {"Gold": 3, "Board Size": 1}, - "Sona": {"Gold": 5, "Board Size": 1}, - "TahmKench": {"Gold": 1, "Board Size": 1}, - "Taric": {"Gold": 1, "Board Size": 1}, - "Thresh": {"Gold": 4, "Board Size": 1}, - "TwistedFate": {"Gold": 4, "Board Size": 1}, - "Twitch": {"Gold": 2, "Board Size": 1}, - "Urgot": {"Gold": 3, "Board Size": 1}, - "Vex": {"Gold": 3, "Board Size": 1}, - "Vi": {"Gold": 1, "Board Size": 1}, - "Viego": {"Gold": 4, "Board Size": 1}, - "Yasuo": {"Gold": 1, "Board Size": 1}, - "Yone": {"Gold": 3, "Board Size": 1}, - "Yorick": {"Gold": 5, "Board Size": 1}, - "Zac": {"Gold": 4, "Board Size": 1}, - "Zed": {"Gold": 4, "Board Size": 1}, - "Ziggs": {"Gold": 5, "Board Size": 1}} + "Ahri":{"Gold":4,"BoardSize":1,"Trait1":"Spellweaver","Trait2":"KDA","Trait3":""}, + "Akali":{"Gold":4,"BoardSize":1,"Trait1":"Executioner","Trait2":"Breakout","Trait3":"TrueDamage"}, + "Amumu":{"Gold":3,"BoardSize":1,"Trait1":"Guardian","Trait2":"Emo","Trait3":""}, + "Annie":{"Gold":1,"BoardSize":1,"Trait1":"Spellweaver","Trait2":"Emo","Trait3":""}, + "Aphelios":{"Gold":2,"BoardSize":1,"Trait1":"Rapidfire","Trait2":"HEARTSTEEL","Trait3":""}, + "Bard":{"Gold":2,"BoardSize":1,"Trait1":"Dazzler","Trait2":"Jazz","Trait3":""}, + "Blitzcrank":{"Gold":4,"BoardSize":1,"Trait1":"Sentinel","Trait2":"Disco","Trait3":""}, + "Caitlyn":{"Gold":4,"BoardSize":1,"Trait1":"Rapidfire","Trait2":"8bit","Trait3":""}, + "Corki":{"Gold":1,"BoardSize":1,"Trait1":"BigShot","Trait2":"8bit","Trait3":""}, + "Ekko":{"Gold":3,"BoardSize":1,"Trait1":"Sentinel","Trait2":"Spellweaver","Trait3":"TrueDamage"}, + "Evelynn":{"Gold":1,"BoardSize":1,"Trait1":"CrowdDiver","Trait2":"K/DA","Trait3":""}, + "Ezreal":{"Gold":4,"BoardSize":1,"Trait1":"BigShot","Trait2":"HEARTSTEEL","Trait3":""}, + "Garen":{"Gold":2,"BoardSize":1,"Trait1":"Sentinel","Trait2":"8bit","Trait3":""}, + "Gnar":{"Gold":2,"BoardSize":1,"Trait1":"Mosher","Trait2":"Superfan","Trait3":"Pentakill"}, + "Gragas":{"Gold":2,"BoardSize":1,"Trait1":"Bruiser","Trait2":"Spellweaver","Trait3":"Disco"}, + "Illaoi":{"Gold":5,"BoardSize":1,"Trait1":"Bruiser","Trait2":"ILLBEATS","Trait3":""}, + "Jax":{"Gold":2,"BoardSize":1,"Trait1":"Mosher","Trait2":"EDM","Trait3":""}, + "Jhin":{"Gold":5,"BoardSize":1,"Trait1":"BigShot","Trait2":"Maestro","Trait3":""}, + "Jinx":{"Gold":1,"BoardSize":1,"Trait1":"Rapidfire","Trait2":"Punk","Trait3":""}, + "Kai'Sa":{"Gold":2,"BoardSize":1,"Trait1":"BigShot","Trait2":"K/DA","Trait3":""}, + "Karthus":{"Gold":4,"BoardSize":1,"Trait1":"Executioner","Trait2":"Pentakill","Trait3":""}, + "Katarina":{"Gold":2,"BoardSize":1,"Trait1":"CrowdDiver","Trait2":"Country","Trait3":""}, + "Kayle":{"Gold":2,"BoardSize":1,"Trait1":"Edgelord","Trait2":"Pentakill","Trait3":""}, + "Kayn":{"Gold":5,"BoardSize":1,"Trait1":"Edgelord","Trait2":"Wildcard","Trait3":"HEARTSTEEL"}, + "Kennen":{"Gold":1,"BoardSize":1,"Trait1":"Guardian","Trait2":"Superfan","Trait3":"TrueDamage"}, + "K'Sante":{"Gold":1,"BoardSize":1,"Trait1":"Sentinel","Trait2":"HEARTSTEEL","Trait3":""}, + "Lillia":{"Gold":1,"BoardSize":1,"Trait1":"Sentinel","Trait2":"Superfan","Trait3":"K/DA"}, + "Lucian":{"Gold":5,"BoardSize":1,"Trait1":"Rapidfire","Trait2":"Jazz","Trait3":""}, + "Lulu":{"Gold":3,"BoardSize":1,"Trait1":"Spellweaver","Trait2":"Hyperpop","Trait3":""}, + "Lux":{"Gold":3,"BoardSize":1,"Trait1":"Dazzler","Trait2":"EDM","Trait3":""}, + "MissFortune":{"Gold":3,"BoardSize":1,"Trait1":"BigShot","Trait2":"Jazz","Trait3":""}, + "Mordekaiser":{"Gold":3,"BoardSize":1,"Trait1":"Sentinel","Trait2":"Pentakill","Trait3":""}, + "Nami":{"Gold":1,"BoardSize":1,"Trait1":"Dazzler","Trait2":"Disco","Trait3":""}, + "Neeko":{"Gold":3,"BoardSize":1,"Trait1":"Guardian","Trait2":"Superfan","Trait3":"K/DA"}, + "Olaf":{"Gold":1,"BoardSize":1,"Trait1":"Bruiser","Trait2":"Pentakill","Trait3":""}, + "Pantheon":{"Gold":2,"BoardSize":1,"Trait1":"Guardian","Trait2":"Punk","Trait3":""}, + "Poppy":{"Gold":4,"BoardSize":1,"Trait1":"Mosher","Trait2":"Emo","Trait3":""}, + "Qiyana":{"Gold":5,"BoardSize":1,"Trait1":"CrowdDiver","Trait2":"TrueDamage","Trait3":""}, + "Riven":{"Gold":3,"BoardSize":1,"Trait1":"Edgelord","Trait2":"8bit","Trait3":""}, + "Samira":{"Gold":3,"BoardSize":1,"Trait1":"Executioner","Trait2":"Country","Trait3":""}, + "Senna":{"Gold":2,"BoardSize":1,"Trait1":"Rapidfire","Trait2":"TrueDamage","Trait3":""}, + "Seraphine":{"Gold":2,"BoardSize":1,"Trait1":"Spellweaver","Trait2":"K/DA","Trait3":""}, + "Sett":{"Gold":3,"BoardSize":1,"Trait1":"Mosher","Trait2":"Bruiser","Trait3":"HEARTSTEEL"}, + "Sona":{"Gold":5,"BoardSize":1,"Trait1":"Spellweaver","Trait2":"Mixmaster","Trait3":""}, + "TahmKench":{"Gold":1,"BoardSize":1,"Trait1":"Bruiser","Trait2":"Country","Trait3":""}, + "Taric":{"Gold":1,"BoardSize":1,"Trait1":"Guardian","Trait2":"Disco","Trait3":""}, + "Thresh":{"Gold":4,"BoardSize":1,"Trait1":"Guardian","Trait2":"Country","Trait3":""}, + "TwistedFate":{"Gold":4,"BoardSize":1,"Trait1":"Dazzler","Trait2":"Disco","Trait3":""}, + "Twitch":{"Gold":2,"BoardSize":1,"Trait1":"Executioner","Trait2":"Punk","Trait3":""}, + "Urgot":{"Gold":3,"BoardSize":1,"Trait1":"Mosher","Trait2":"Country","Trait3":""}, + "Vex":{"Gold":3,"BoardSize":1,"Trait1":"Executioner","Trait2":"Emo","Trait3":""}, + "Vi":{"Gold":1,"BoardSize":1,"Trait1":"Mosher","Trait2":"Punk","Trait3":""}, + "Viego":{"Gold":4,"BoardSize":1,"Trait1":"Edgelord","Trait2":"Pentakill","Trait3":""}, + "Yasuo":{"Gold":1,"BoardSize":1,"Trait1":"Edgelord","Trait2":"TrueDamage","Trait3":""}, + "Yone":{"Gold":3,"BoardSize":1,"Trait1":"CrowdDiver","Trait2":"Edgelord","Trait3":"HEARTSTEEL"}, + "Yorick":{"Gold":5,"BoardSize":1,"Trait1":"Guardian","Trait2":"Mosher","Trait3":"Pentakill"}, + "Zac":{"Gold":4,"BoardSize":1,"Trait1":"Bruiser","Trait2":"EDM","Trait3":""}, + "Zed":{"Gold":4,"BoardSize":1,"Trait1":"CrowdDiver","Trait2":"EDM","Trait3":""}, + "Ziggs":{"Gold":5,"BoardSize":1,"Trait1":"Dazzler","Trait2":"Hyperpop","Trait3":""} +} + ROUNDS: set[str] = {"1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "2-4", "2-5", "2-6", "2-7", From 2a4e52fae879820468ef69b144febf8aab180b8d Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Sun, 26 Nov 2023 00:02:45 +0800 Subject: [PATCH 9/9] Update docstring --- comps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/comps.py b/comps.py index 356992e..8bfb307 100644 --- a/comps.py +++ b/comps.py @@ -3,7 +3,7 @@ Comps come from https://tftactics.gg/tierlist/team-comps Items are in camel case and a-Z The "headliner" tag represents a trait from bottom to top. -Set to True if you want it in your board. +Set to True if you want it in your team. Only final comp champion will become headliner and need to set the corresponding 'headliner' tag to True. e.g. Only want "Sentinel" Ekko, set it to "headliner": [True, False, False] e.g.2 want either "Sentinel" or "True Damage" Ekko, set it to "headliner": [True, False, True]