From 3a19692bba565f99cf065e3f5a5b01643b9d3a18 Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Sat, 6 Apr 2024 04:46:55 +0800 Subject: [PATCH 01/11] Update for set11 encounter add one round Not tested yet --- game.py | 81 ++++++++++++++++++++++++++++++++++++++++------- game_assets.py | 13 ++++---- game_functions.py | 35 ++++++++++++++++---- screen_coords.py | 11 +++++++ 4 files changed, 117 insertions(+), 23 deletions(-) diff --git a/game.py b/game.py index 2aa07d6..511d2b2 100644 --- a/game.py +++ b/game.py @@ -22,7 +22,7 @@ class Game: def __init__(self, message_queue: multiprocessing.Queue) -> None: self.message_queue = message_queue self.arena = Arena(self.message_queue) - self.round: str = "0-0" + self.round: list[str, int] = ["0-0", 0] self.time: None = None self.forfeit_time: int = settings.FORFEIT_TIME + random.randint(50, 150) self.found_window = False @@ -60,7 +60,7 @@ def callback(self, hwnd, extra) -> None: # pylint: disable=unused-argument def loading_screen(self) -> None: """Loop that runs while the game is in the loading screen""" game_functions.default_pos() - while game_functions.get_round() != "1-1": + while game_functions.get_round()[0] != "1-1": if self.check_failed_to_connect_window(): return sleep(1) @@ -115,21 +115,80 @@ def game_loop(self) -> None: game_functions.forfeit() return - if self.round != ran_round: - if self.round in game_assets.PVP_ROUND: + if self.round[0] != ran_round: + if self.round[0] in game_assets.PVP_ROUND: game_functions.default_pos() self.pvp_round() - ran_round: str = self.round - elif self.round in game_assets.PVE_ROUND: + ran_round: str = self.round[0] + elif self.round[0] in game_assets.PVE_ROUND: game_functions.default_pos() self.pve_round() - ran_round: str = self.round - elif self.round in game_assets.CAROUSEL_ROUND: + ran_round: str = self.round[0] + elif self.round[0] in game_assets.CAROUSEL_ROUND: self.carousel_round() - ran_round: str = self.round - elif self.round in game_assets.SECOND_ROUND: + ran_round: str = self.round[0] + elif self.round[0] in game_assets.SECOND_ROUND: self.second_round() - ran_round: str = self.round + ran_round: str = self.round[0] + elif self.round[0] in game_assets.ENCOUNTER_ROUNDS: + print(f"\n[Encounter Round] {self.round}") + print(" Do nothing") + self.message_queue.put("CLEAR") + self.arena.check_health() + ran_round: str = self.round[0] + if self.round[1] == 1 and self.round[0].split("-")[1] == "1": + game_assets.CAROUSEL_ROUND = { + carousel_round + for carousel_round in game_assets.CAROUSEL_ROUND + if not carousel_round.startswith(self.round[0].split("-")) + } + game_assets.PVE_ROUND = { + pve_round + for pve_round in game_assets.PVE_ROUND + if not pve_round.startswith(self.round[0].split("-")) + } + game_assets.PVP_ROUND = { + pvp_round + for pvp_round in game_assets.PVP_ROUND + if not pvp_round.startswith(self.round[0].split("-")) + } + game_assets.ANVIL_ROUNDS = { + anvil_round + for anvil_round in game_assets.ANVIL_ROUNDS + if not anvil_round.startswith(self.round[0].split("-")) + } + game_assets.ITEM_PLACEMENT_ROUNDS = { + item_placement_round + for item_placement_round in game_assets.ITEM_PLACEMENT_ROUNDS + if not item_placement_round.startswith(self.round[0].split("-")) + } + for index, round_msg in enumerate( + game_functions.check_encounter_round() + ): + if index == 0: + continue + if round_msg == "carousel": + game_assets.CAROUSEL_ROUND.add( + self.round[0].split("-") + "-" + str(index + 1) + ) + game_assets.ANVIL_ROUNDS.add( + self.round[0].split("-") + "-" + str(index + 2) + ) + game_assets.ITEM_PLACEMENT_ROUNDS.add( + self.round[0].split("-") + "-" + str(index + 2) + ) + elif round_msg == "pve": + game_assets.PVE_ROUND.add( + self.round[0].split("-") + "-" + str(index + 1) + ) + elif round_msg == "pvp": + game_assets.PVP_ROUND.add( + self.round[0].split("-") + "-" + str(index + 1) + ) + elif round_msg == "encounter": + game_assets.ENCOUNTER_ROUNDS.add( + self.round[0].split("-") + "-" + str(index + 1) + ) sleep(0.5) def second_round(self) -> None: diff --git a/game_assets.py b/game_assets.py index a02cc9c..73bcc73 100644 --- a/game_assets.py +++ b/game_assets.py @@ -104,12 +104,12 @@ 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", - "3-1", "3-2", "3-3", "3-4", "3-5", "3-6", "3-7", - "4-1", "4-2", "4-3", "4-4", "4-5", "4-6", "4-7", - "5-1", "5-2", "5-3", "5-4", "5-5", "5-6", "5-7", - "6-1", "6-2", "6-3", "6-4", "6-5", "6-6", "6-7", - "7-1", "7-2", "7-3", "7-4", "7-5", "7-6", "7-7"} + "2-1", "2-2", "2-3", "2-4", "2-5", "2-6", "2-7", "2-8", + "3-1", "3-2", "3-3", "3-4", "3-5", "3-6", "3-7", "3-8", + "4-1", "4-2", "4-3", "4-4", "4-5", "4-6", "4-7", "4-8", + "5-1", "5-2", "5-3", "5-4", "5-5", "5-6", "5-7", "5-8", + "6-1", "6-2", "6-3", "6-4", "6-5", "6-6", "6-7", "6-8", + "7-1", "7-2", "7-3", "7-4", "7-5", "7-6", "7-7", "7-8"} SECOND_ROUND: set[str] = {"1-2"} @@ -132,6 +132,7 @@ ITEM_PLACEMENT_ROUNDS: set[str] = {"2-2", "3-2", "4-2", "5-2", "6-2", "7-2", "2-5", "3-5", "4-5", "5-5", "6-5", "7-5"} +ENCOUNTER_ROUNDS: set[str] = {"0-0"} FINAL_COMP_ROUND = "4-5" diff --git a/game_functions.py b/game_functions.py index d82448e..bffc80a 100644 --- a/game_functions.py +++ b/game_functions.py @@ -10,22 +10,45 @@ import mk_functions -def get_round() -> str: +def get_round() -> list[str, int]: """Gets the current game round""" screen_capture = ImageGrab.grab(bbox=screen_coords.ROUND_POS.get_coords()) round_three = screen_capture.crop(screen_coords.ROUND_POS_THREE.get_coords()) game_round: str = ocr.get_text_from_image(image=round_three, whitelist=ocr.ROUND_WHITELIST) if game_round in game_assets.ROUNDS: - return game_round + return [game_round, 3] round_two = screen_capture.crop(screen_coords.ROUND_POS_TWO.get_coords()) game_round: str = ocr.get_text_from_image(image=round_two, whitelist=ocr.ROUND_WHITELIST) if game_round in game_assets.ROUNDS: - return game_round + return [game_round, 2] + round_one = screen_capture.crop(screen_coords.ROUND_POS_ONE.get_coords()) game_round: str = ocr.get_text_from_image(image=round_one, whitelist=ocr.ROUND_WHITELIST) - return game_round - + return [game_round, 1] + + +def check_encounter_round() -> list[str]: + """Get the game round list by checking round text for encounter add rounds""" + round_list: list = [] + for positions in screen_coords.ROUND_ENCOUNTER_ICON_POS: + mk_functions.move_mouse(positions[0].get_coords()) + round_message: str = ocr.get_text( + screenxy=positions[1].get_coords(), + scale=3, + psm=7, + whitelist=ocr.ALPHABET_WHITELIST, + ) + if any(keyword in round_message for keyword in ["Carousel"]): + round_list.append("carousel") + elif any(keyword in round_message for keyword in ["Get pulled into an Encounter"]): + round_list.append("encounter") + elif any(keyword in round_message for keyword in ["Krugs", "Murk Wolves", "Raptors"]): + round_list.append("pve") + else: + round_list.append("pvp") + mk_functions.move_mouse(screen_coords.DEFAULT_LOC.get_coords()) + return round_list def pickup_items() -> None: # Refacor this function to make it more clear whats happening """Picks up items from the board after PVP round""" @@ -43,7 +66,7 @@ def pickup_items() -> None: # Refacor this function to make it more clear whats def get_champ_carousel(tft_round: str) -> None: """Gets a champion from the carousel""" - while tft_round == get_round(): + while tft_round == get_round()[0]: mk_functions.right_click(screen_coords.CAROUSEL_LOC.get_coords()) sleep(0.7) sleep(3) diff --git a/screen_coords.py b/screen_coords.py index 9444625..32ed776 100644 --- a/screen_coords.py +++ b/screen_coords.py @@ -40,6 +40,17 @@ ROUND_POS_THREE: Vec4 = Vec4(GameWindow(71, 0, 110, 24), use_screen_offset=False) +ROUND_ENCOUNTER_ICON_POS: list[list[Vec2, Vec4]] = [ + [Vec2(833, 20), Vec4(GameWindow(926, 49, 1191, 75))], + [Vec2(869, 20), Vec4(GameWindow(962, 49, 1227, 75))], + [Vec2(905, 20), Vec4(GameWindow(998, 49, 1263, 75))], + [Vec2(941, 20), Vec4(GameWindow(1034, 49, 1299, 75))], + [Vec2(977, 20), Vec4(GameWindow(1070, 49, 1335, 75))], + [Vec2(1013, 20), Vec4(GameWindow(1106, 49, 1371, 75))], + [Vec2(1049, 20), Vec4(GameWindow(1142, 49, 1407, 75))], + [Vec2(1085, 20), Vec4(GameWindow(1178, 49, 1443, 75))], +] + SHOP_POS: Vec4 = Vec4(GameWindow(481, 1039, 1476, 1070)) CHAMP_NAME_POS: list[Vec4] = [ From 4f0a640c42079a0163c3ac0a4a588c9a44b5eda4 Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Sat, 6 Apr 2024 04:50:20 +0800 Subject: [PATCH 02/11] Update for set11 encounter add one round Not tested yet --- game.py | 108 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 56 insertions(+), 52 deletions(-) diff --git a/game.py b/game.py index 511d2b2..ee68ed1 100644 --- a/game.py +++ b/game.py @@ -137,60 +137,64 @@ def game_loop(self) -> None: self.arena.check_health() ran_round: str = self.round[0] if self.round[1] == 1 and self.round[0].split("-")[1] == "1": - game_assets.CAROUSEL_ROUND = { - carousel_round - for carousel_round in game_assets.CAROUSEL_ROUND - if not carousel_round.startswith(self.round[0].split("-")) - } - game_assets.PVE_ROUND = { - pve_round - for pve_round in game_assets.PVE_ROUND - if not pve_round.startswith(self.round[0].split("-")) - } - game_assets.PVP_ROUND = { - pvp_round - for pvp_round in game_assets.PVP_ROUND - if not pvp_round.startswith(self.round[0].split("-")) - } - game_assets.ANVIL_ROUNDS = { - anvil_round - for anvil_round in game_assets.ANVIL_ROUNDS - if not anvil_round.startswith(self.round[0].split("-")) - } - game_assets.ITEM_PLACEMENT_ROUNDS = { - item_placement_round - for item_placement_round in game_assets.ITEM_PLACEMENT_ROUNDS - if not item_placement_round.startswith(self.round[0].split("-")) - } - for index, round_msg in enumerate( - game_functions.check_encounter_round() - ): - if index == 0: - continue - if round_msg == "carousel": - game_assets.CAROUSEL_ROUND.add( - self.round[0].split("-") + "-" + str(index + 1) - ) - game_assets.ANVIL_ROUNDS.add( - self.round[0].split("-") + "-" + str(index + 2) - ) - game_assets.ITEM_PLACEMENT_ROUNDS.add( - self.round[0].split("-") + "-" + str(index + 2) - ) - elif round_msg == "pve": - game_assets.PVE_ROUND.add( - self.round[0].split("-") + "-" + str(index + 1) - ) - elif round_msg == "pvp": - game_assets.PVP_ROUND.add( - self.round[0].split("-") + "-" + str(index + 1) - ) - elif round_msg == "encounter": - game_assets.ENCOUNTER_ROUNDS.add( - self.round[0].split("-") + "-" + str(index + 1) - ) + self.encounter_round_setup() sleep(0.5) + def encounter_round_setup(self) -> None: + """Remove rounds from game_assets and add it back by checking round message""" + game_assets.CAROUSEL_ROUND = { + carousel_round + for carousel_round in game_assets.CAROUSEL_ROUND + if not carousel_round.startswith(self.round[0].split("-")) + } + game_assets.PVE_ROUND = { + pve_round + for pve_round in game_assets.PVE_ROUND + if not pve_round.startswith(self.round[0].split("-")) + } + game_assets.PVP_ROUND = { + pvp_round + for pvp_round in game_assets.PVP_ROUND + if not pvp_round.startswith(self.round[0].split("-")) + } + game_assets.ANVIL_ROUNDS = { + anvil_round + for anvil_round in game_assets.ANVIL_ROUNDS + if not anvil_round.startswith(self.round[0].split("-")) + } + game_assets.ITEM_PLACEMENT_ROUNDS = { + item_placement_round + for item_placement_round in game_assets.ITEM_PLACEMENT_ROUNDS + if not item_placement_round.startswith(self.round[0].split("-")) + } + for index, round_msg in enumerate( + game_functions.check_encounter_round() + ): + if index == 0: + continue + if round_msg == "carousel": + game_assets.CAROUSEL_ROUND.add( + self.round[0].split("-") + "-" + str(index + 1) + ) + game_assets.ANVIL_ROUNDS.add( + self.round[0].split("-") + "-" + str(index + 2) + ) + game_assets.ITEM_PLACEMENT_ROUNDS.add( + self.round[0].split("-") + "-" + str(index + 2) + ) + elif round_msg == "pve": + game_assets.PVE_ROUND.add( + self.round[0].split("-") + "-" + str(index + 1) + ) + elif round_msg == "pvp": + game_assets.PVP_ROUND.add( + self.round[0].split("-") + "-" + str(index + 1) + ) + elif round_msg == "encounter": + game_assets.ENCOUNTER_ROUNDS.add( + self.round[0].split("-") + "-" + str(index + 1) + ) + def second_round(self) -> None: """Move unknown champion to board after first carousel""" print(f"\n[Second Round] {self.round}") From 254654d651e8b2b0a054e203bfc7bac417d5a665 Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Sat, 6 Apr 2024 04:59:24 +0800 Subject: [PATCH 03/11] Update for set11 encounter add one round Not tested yet --- game.py | 5 ++--- game_assets.py | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/game.py b/game.py index ee68ed1..a8b362b 100644 --- a/game.py +++ b/game.py @@ -84,6 +84,7 @@ def check_failed_to_connect_window(self) -> bool: print(" Reconnect button not found.") return False + # pylint: disable=too-many-branches def game_loop(self) -> None: """Loop that runs while the game is active, handles calling the correct tasks for round and exiting game""" ran_round: str = None @@ -167,9 +168,7 @@ def encounter_round_setup(self) -> None: for item_placement_round in game_assets.ITEM_PLACEMENT_ROUNDS if not item_placement_round.startswith(self.round[0].split("-")) } - for index, round_msg in enumerate( - game_functions.check_encounter_round() - ): + for index, round_msg in enumerate(game_functions.check_encounter_round()): if index == 0: continue if round_msg == "carousel": diff --git a/game_assets.py b/game_assets.py index 73bcc73..f0521f8 100644 --- a/game_assets.py +++ b/game_assets.py @@ -132,6 +132,7 @@ ITEM_PLACEMENT_ROUNDS: set[str] = {"2-2", "3-2", "4-2", "5-2", "6-2", "7-2", "2-5", "3-5", "4-5", "5-5", "6-5", "7-5"} + ENCOUNTER_ROUNDS: set[str] = {"0-0"} FINAL_COMP_ROUND = "4-5" From 666e3c515b6380add5b1b80cb63b2bdff940b72a Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Sat, 6 Apr 2024 05:03:59 +0800 Subject: [PATCH 04/11] Update for set11 encounter add one round Not tested yet --- game_functions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game_functions.py b/game_functions.py index bffc80a..1e97359 100644 --- a/game_functions.py +++ b/game_functions.py @@ -37,7 +37,7 @@ def check_encounter_round() -> list[str]: screenxy=positions[1].get_coords(), scale=3, psm=7, - whitelist=ocr.ALPHABET_WHITELIST, + whitelist=(ocr.ALPHABET_WHITELIST + " "), ) if any(keyword in round_message for keyword in ["Carousel"]): round_list.append("carousel") From 2ddb4b3e0ad0bff223fb7ff44b955e443e8ed3f1 Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Sat, 6 Apr 2024 05:07:36 +0800 Subject: [PATCH 05/11] Update for set11 encounter add one round Not tested yet --- game.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/game.py b/game.py index a8b362b..413787c 100644 --- a/game.py +++ b/game.py @@ -193,6 +193,10 @@ def encounter_round_setup(self) -> None: game_assets.ENCOUNTER_ROUNDS.add( self.round[0].split("-") + "-" + str(index + 1) ) + if index+1 == 2: + game_assets.AUGMENT_ROUNDS.add( + self.round[0].split("-") + "-" + str(index + 1) + ) def second_round(self) -> None: """Move unknown champion to board after first carousel""" From a987f3974d633787c28c6bdfa000e68e0e88428e Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Sat, 6 Apr 2024 11:23:09 +0800 Subject: [PATCH 06/11] Update for set11 encounter add one round Not tested yet --- game.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/game.py b/game.py index 413787c..67ccfa9 100644 --- a/game.py +++ b/game.py @@ -132,7 +132,7 @@ def game_loop(self) -> None: self.second_round() ran_round: str = self.round[0] elif self.round[0] in game_assets.ENCOUNTER_ROUNDS: - print(f"\n[Encounter Round] {self.round}") + print(f"\n[Encounter Round] {self.round[0]}") print(" Do nothing") self.message_queue.put("CLEAR") self.arena.check_health() @@ -200,7 +200,7 @@ def encounter_round_setup(self) -> None: def second_round(self) -> None: """Move unknown champion to board after first carousel""" - print(f"\n[Second Round] {self.round}") + print(f"\n[Second Round] {self.round[0]}") self.message_queue.put("CLEAR") while True: result = arena_functions.bench_occupied_check() @@ -213,26 +213,26 @@ def second_round(self) -> None: def carousel_round(self) -> None: """Handles tasks for carousel rounds""" - print(f"\n[Carousel Round] {self.round}") + print(f"\n[Carousel Round] {self.round[0]}") self.message_queue.put("CLEAR") - if self.round == "3-4": + if self.round[0] == "3-4": self.arena.final_comp = True self.arena.check_health() print(" Getting a champ from the carousel") - game_functions.get_champ_carousel(self.round) + game_functions.get_champ_carousel(self.round[0]) def pve_round(self) -> None: """Handles tasks for PVE rounds""" - print(f"\n[PvE Round] {self.round}") + print(f"\n[PvE Round] {self.round[0]}") self.message_queue.put("CLEAR") sleep(0.5) - if self.round in game_assets.AUGMENT_ROUNDS: + if self.round[0] in game_assets.AUGMENT_ROUNDS: sleep(1) self.arena.augment_roll = True self.arena.pick_augment() # Can't purchase champions for a short period after choosing augment sleep(2.5) - if self.round == "1-3": + if self.round[0] == "1-3": sleep(1.5) self.arena.fix_unknown() self.arena.anvil_free[1:] = [True] * 8 @@ -252,32 +252,32 @@ def pve_round(self) -> None: def pvp_round(self) -> None: """Handles tasks for PVP rounds""" - print(f"\n[PvP Round] {self.round}") + print(f"\n[PvP Round] {self.round[0]}") self.message_queue.put("CLEAR") sleep(0.5) - if self.round in game_assets.AUGMENT_ROUNDS: + if self.round[0] in game_assets.AUGMENT_ROUNDS: sleep(1) self.arena.augment_roll = True self.arena.pick_augment() sleep(2.5) - if self.round in ("2-1", "2-5"): + if self.round[0] in ("2-1", "2-5"): self.arena.buy_xp_round() - if self.round in game_assets.PICKUP_ROUNDS: + if self.round[0] in game_assets.PICKUP_ROUNDS: print(" Picking up items") game_functions.pickup_items() self.arena.fix_bench_state() self.arena.bench_cleanup() - if self.round in game_assets.ANVIL_ROUNDS: + if self.round[0] in game_assets.ANVIL_ROUNDS: self.arena.clear_anvil() - self.arena.spend_gold(speedy=self.round in game_assets.PICKUP_ROUNDS) + self.arena.spend_gold(speedy=self.round[0] in game_assets.PICKUP_ROUNDS) self.arena.move_champions() self.arena.replace_unknown() if self.arena.final_comp: self.arena.final_comp_check() self.arena.bench_cleanup() - if self.round in game_assets.ITEM_PLACEMENT_ROUNDS: + if self.round[0] in game_assets.ITEM_PLACEMENT_ROUNDS: sleep(1) self.arena.place_items() self.end_round_tasks() From bb629255cff98749036624f94fe574a99b8dc737 Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Sat, 6 Apr 2024 13:23:47 +0800 Subject: [PATCH 07/11] Update for set11 encounter add one round --- game.py | 10 +++++----- game_functions.py | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/game.py b/game.py index 67ccfa9..77d3b65 100644 --- a/game.py +++ b/game.py @@ -146,27 +146,27 @@ def encounter_round_setup(self) -> None: game_assets.CAROUSEL_ROUND = { carousel_round for carousel_round in game_assets.CAROUSEL_ROUND - if not carousel_round.startswith(self.round[0].split("-")) + if not carousel_round.startswith(self.round[0].split("-")[0]) } game_assets.PVE_ROUND = { pve_round for pve_round in game_assets.PVE_ROUND - if not pve_round.startswith(self.round[0].split("-")) + if not pve_round.startswith(self.round[0].split("-")[0]) } game_assets.PVP_ROUND = { pvp_round for pvp_round in game_assets.PVP_ROUND - if not pvp_round.startswith(self.round[0].split("-")) + if not pvp_round.startswith(self.round[0].split("-")[0]) } game_assets.ANVIL_ROUNDS = { anvil_round for anvil_round in game_assets.ANVIL_ROUNDS - if not anvil_round.startswith(self.round[0].split("-")) + if not anvil_round.startswith(self.round[0].split("-")[0]) } game_assets.ITEM_PLACEMENT_ROUNDS = { item_placement_round for item_placement_round in game_assets.ITEM_PLACEMENT_ROUNDS - if not item_placement_round.startswith(self.round[0].split("-")) + if not item_placement_round.startswith(self.round[0].split("-")[0]) } for index, round_msg in enumerate(game_functions.check_encounter_round()): if index == 0: diff --git a/game_functions.py b/game_functions.py index 1e97359..f32ed40 100644 --- a/game_functions.py +++ b/game_functions.py @@ -25,7 +25,9 @@ def get_round() -> list[str, int]: round_one = screen_capture.crop(screen_coords.ROUND_POS_ONE.get_coords()) game_round: str = ocr.get_text_from_image(image=round_one, whitelist=ocr.ROUND_WHITELIST) - return [game_round, 1] + if game_round in game_assets.ROUNDS: + return [game_round, 1] + return ["999-999",0] def check_encounter_round() -> list[str]: From b61cf709cf92cb77c8bf5e727c299c4827949fb5 Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Sat, 6 Apr 2024 18:51:35 +0800 Subject: [PATCH 08/11] Update for set11 encounter add one round --- game.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/game.py b/game.py index 77d3b65..0632149 100644 --- a/game.py +++ b/game.py @@ -5,6 +5,7 @@ from time import sleep, perf_counter import random import multiprocessing +import importlib from win32con import BM_CLICK import win32gui import settings @@ -20,6 +21,7 @@ class Game: """Game class that handles game logic such as round tasks""" def __init__(self, message_queue: multiprocessing.Queue) -> None: + importlib.reload(game_assets) self.message_queue = message_queue self.arena = Arena(self.message_queue) self.round: list[str, int] = ["0-0", 0] @@ -138,6 +140,7 @@ def game_loop(self) -> None: self.arena.check_health() ran_round: str = self.round[0] if self.round[1] == 1 and self.round[0].split("-")[1] == "1": + print("[Ecnounter round setup]") self.encounter_round_setup() sleep(0.5) @@ -169,33 +172,34 @@ def encounter_round_setup(self) -> None: if not item_placement_round.startswith(self.round[0].split("-")[0]) } for index, round_msg in enumerate(game_functions.check_encounter_round()): + print(f"[Ecnounter round setup] Round list: {round_msg}") if index == 0: continue if round_msg == "carousel": game_assets.CAROUSEL_ROUND.add( - self.round[0].split("-") + "-" + str(index + 1) + self.round[0].split("-")[0] + "-" + str(index + 1) ) game_assets.ANVIL_ROUNDS.add( - self.round[0].split("-") + "-" + str(index + 2) + self.round[0].split("-")[0] + "-" + str(index + 2) ) game_assets.ITEM_PLACEMENT_ROUNDS.add( - self.round[0].split("-") + "-" + str(index + 2) + self.round[0].split("-")[0] + "-" + str(index + 2) ) elif round_msg == "pve": game_assets.PVE_ROUND.add( - self.round[0].split("-") + "-" + str(index + 1) + self.round[0].split("-")[0] + "-" + str(index + 1) ) elif round_msg == "pvp": game_assets.PVP_ROUND.add( - self.round[0].split("-") + "-" + str(index + 1) + self.round[0].split("-")[0] + "-" + str(index + 1) ) elif round_msg == "encounter": game_assets.ENCOUNTER_ROUNDS.add( - self.round[0].split("-") + "-" + str(index + 1) + self.round[0].split("-")[0] + "-" + str(index + 1) ) if index+1 == 2: game_assets.AUGMENT_ROUNDS.add( - self.round[0].split("-") + "-" + str(index + 1) + self.round[0].split("-")[0] + "-" + str(index + 1) ) def second_round(self) -> None: From 5b1fe2cd6a213aa4434c88b045c2fb68af2431d3 Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Sat, 6 Apr 2024 23:09:22 +0800 Subject: [PATCH 09/11] Update for set11 encounter add one round --- game.py | 10 +++++----- screen_coords.py | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/game.py b/game.py index 0632149..fd0936c 100644 --- a/game.py +++ b/game.py @@ -116,7 +116,7 @@ def game_loop(self) -> None: and perf_counter() - self.start_time > self.forfeit_time ): game_functions.forfeit() - return + continue if self.round[0] != ran_round: if self.round[0] in game_assets.PVP_ROUND: @@ -140,7 +140,7 @@ def game_loop(self) -> None: self.arena.check_health() ran_round: str = self.round[0] if self.round[1] == 1 and self.round[0].split("-")[1] == "1": - print("[Ecnounter round setup]") + print("\n[Ecnounter round setup]") self.encounter_round_setup() sleep(0.5) @@ -172,7 +172,7 @@ def encounter_round_setup(self) -> None: if not item_placement_round.startswith(self.round[0].split("-")[0]) } for index, round_msg in enumerate(game_functions.check_encounter_round()): - print(f"[Ecnounter round setup] Round list: {round_msg}") + print(f" Round {self.round[0].split('-')[0]}-{str(index + 1)}: {round_msg} ROUND") if index == 0: continue if round_msg == "carousel": @@ -197,9 +197,9 @@ def encounter_round_setup(self) -> None: game_assets.ENCOUNTER_ROUNDS.add( self.round[0].split("-")[0] + "-" + str(index + 1) ) - if index+1 == 2: + if index+1 == 2 and int(self.round[0].split("-")[0]) <= 4: game_assets.AUGMENT_ROUNDS.add( - self.round[0].split("-")[0] + "-" + str(index + 1) + self.round[0].split("-")[0] + "-" + str(index + 2) ) def second_round(self) -> None: diff --git a/screen_coords.py b/screen_coords.py index 32ed776..0c97870 100644 --- a/screen_coords.py +++ b/screen_coords.py @@ -41,14 +41,14 @@ ROUND_POS_THREE: Vec4 = Vec4(GameWindow(71, 0, 110, 24), use_screen_offset=False) ROUND_ENCOUNTER_ICON_POS: list[list[Vec2, Vec4]] = [ - [Vec2(833, 20), Vec4(GameWindow(926, 49, 1191, 75))], - [Vec2(869, 20), Vec4(GameWindow(962, 49, 1227, 75))], - [Vec2(905, 20), Vec4(GameWindow(998, 49, 1263, 75))], - [Vec2(941, 20), Vec4(GameWindow(1034, 49, 1299, 75))], - [Vec2(977, 20), Vec4(GameWindow(1070, 49, 1335, 75))], - [Vec2(1013, 20), Vec4(GameWindow(1106, 49, 1371, 75))], - [Vec2(1049, 20), Vec4(GameWindow(1142, 49, 1407, 75))], - [Vec2(1085, 20), Vec4(GameWindow(1178, 49, 1443, 75))], + [Vec2(833, 20), Vec4(GameWindow(890, 49, 1155, 75))], + [Vec2(869, 20), Vec4(GameWindow(926, 49, 1191, 75))], + [Vec2(905, 20), Vec4(GameWindow(962, 49, 1227, 75))], + [Vec2(941, 20), Vec4(GameWindow(998, 49, 1263, 75))], + [Vec2(977, 20), Vec4(GameWindow(1034, 49, 1299, 75))], + [Vec2(1013, 20), Vec4(GameWindow(1070, 49, 1335, 75))], + [Vec2(1049, 20), Vec4(GameWindow(1106, 49, 1371, 75))], + [Vec2(1085, 20), Vec4(GameWindow(1142, 49, 1407, 75))], ] SHOP_POS: Vec4 = Vec4(GameWindow(481, 1039, 1476, 1070)) From 31370dd5caca9a6923b022f7a7ce86cef2d5520a Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Sat, 6 Apr 2024 23:10:30 +0800 Subject: [PATCH 10/11] Update for set11 encounter add one round --- game.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game.py b/game.py index fd0936c..1da3430 100644 --- a/game.py +++ b/game.py @@ -140,7 +140,7 @@ def game_loop(self) -> None: self.arena.check_health() ran_round: str = self.round[0] if self.round[1] == 1 and self.round[0].split("-")[1] == "1": - print("\n[Ecnounter round setup]") + print("\n[Encounter round setup]") self.encounter_round_setup() sleep(0.5) From c7d9dbf642456b5db0da500d26d9fb48141131fa Mon Sep 17 00:00:00 2001 From: Enterly <36875936+anthony5301@users.noreply.github.com> Date: Sun, 7 Apr 2024 00:52:06 +0800 Subject: [PATCH 11/11] Update for set11 encounter add one round --- game.py | 2 +- game_functions.py | 2 +- screen_coords.py | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/game.py b/game.py index 1da3430..f324737 100644 --- a/game.py +++ b/game.py @@ -172,7 +172,7 @@ def encounter_round_setup(self) -> None: if not item_placement_round.startswith(self.round[0].split("-")[0]) } for index, round_msg in enumerate(game_functions.check_encounter_round()): - print(f" Round {self.round[0].split('-')[0]}-{str(index + 1)}: {round_msg} ROUND") + print(f" Round {self.round[0].split('-')[0]}-{str(index + 1)}: {round_msg.upper()} ROUND") if index == 0: continue if round_msg == "carousel": diff --git a/game_functions.py b/game_functions.py index f32ed40..0e4082b 100644 --- a/game_functions.py +++ b/game_functions.py @@ -45,7 +45,7 @@ def check_encounter_round() -> list[str]: round_list.append("carousel") elif any(keyword in round_message for keyword in ["Get pulled into an Encounter"]): round_list.append("encounter") - elif any(keyword in round_message for keyword in ["Krugs", "Murk Wolves", "Raptors"]): + elif any(keyword in round_message for keyword in ["Krugs", "Murk Wolves", "Raptors", "Elder Dragon"]): round_list.append("pve") else: round_list.append("pvp") diff --git a/screen_coords.py b/screen_coords.py index 0c97870..cab85f4 100644 --- a/screen_coords.py +++ b/screen_coords.py @@ -41,14 +41,14 @@ ROUND_POS_THREE: Vec4 = Vec4(GameWindow(71, 0, 110, 24), use_screen_offset=False) ROUND_ENCOUNTER_ICON_POS: list[list[Vec2, Vec4]] = [ - [Vec2(833, 20), Vec4(GameWindow(890, 49, 1155, 75))], - [Vec2(869, 20), Vec4(GameWindow(926, 49, 1191, 75))], - [Vec2(905, 20), Vec4(GameWindow(962, 49, 1227, 75))], - [Vec2(941, 20), Vec4(GameWindow(998, 49, 1263, 75))], - [Vec2(977, 20), Vec4(GameWindow(1034, 49, 1299, 75))], - [Vec2(1013, 20), Vec4(GameWindow(1070, 49, 1335, 75))], - [Vec2(1049, 20), Vec4(GameWindow(1106, 49, 1371, 75))], - [Vec2(1085, 20), Vec4(GameWindow(1142, 49, 1407, 75))], + [Vec2(833, 20), Vec4(GameWindow(890, 49, 1218, 75))], + [Vec2(869, 20), Vec4(GameWindow(926, 49, 1254, 75))], + [Vec2(905, 20), Vec4(GameWindow(962, 49, 1290, 75))], + [Vec2(941, 20), Vec4(GameWindow(998, 49, 1326, 75))], + [Vec2(977, 20), Vec4(GameWindow(1034, 49, 1362, 75))], + [Vec2(1013, 20), Vec4(GameWindow(1070, 49, 1398, 75))], + [Vec2(1049, 20), Vec4(GameWindow(1106, 49, 1434, 75))], + [Vec2(1085, 20), Vec4(GameWindow(1142, 49, 1470, 75))], ] SHOP_POS: Vec4 = Vec4(GameWindow(481, 1039, 1476, 1070))