diff --git a/assets/154eb284-17_01_16_406889_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_6yGu616_png.rf.12ebc1f4e7e5208bcbf2c7f878f691aa.png b/assets/154eb284-17_01_16_406889_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_6yGu616_png.rf.12ebc1f4e7e5208bcbf2c7f878f691aa.png new file mode 100644 index 0000000..163159b Binary files /dev/null and b/assets/154eb284-17_01_16_406889_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_6yGu616_png.rf.12ebc1f4e7e5208bcbf2c7f878f691aa.png differ diff --git a/assets/9f04db98-16_20_58_825243_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_VuLpBVc_png.rf.a16ce4854c42840f44a6c0a04d44c83c.png b/assets/9f04db98-16_20_58_825243_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_VuLpBVc_png.rf.a16ce4854c42840f44a6c0a04d44c83c.png new file mode 100644 index 0000000..f131511 Binary files /dev/null and b/assets/9f04db98-16_20_58_825243_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_VuLpBVc_png.rf.a16ce4854c42840f44a6c0a04d44c83c.png differ diff --git a/assets/_annotations.coco.json b/assets/_annotations.coco.json index 08342d6..db405fe 100644 --- a/assets/_annotations.coco.json +++ b/assets/_annotations.coco.json @@ -1,11 +1,11 @@ { "info": { "year": "2024", - "version": "6", + "version": "7", "description": "Exported from roboflow.com", "contributor": "", "url": "https://public.roboflow.com/object-detection/undefined", - "date_created": "2024-07-01T17:34:12+00:00" + "date_created": "2024-07-02T01:50:17+00:00" }, "licenses": [ { @@ -255,18 +255,18 @@ { "id": 0, "license": 1, - "file_name": "9ed8b373-00_57_50_813872_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_3jLoRJh_png.rf.170fe2ae11c1d8058d8d3e4b2361357a.png", + "file_name": "4533b3e8-00_53_36_188376_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_4ls54Fe_png.rf.4d173023c1d2dba20d42efc2610a5694.png", "height": 2160, "width": 3840, - "date_captured": "2024-07-01T17:34:12+00:00" + "date_captured": "2024-07-02T01:50:17+00:00" }, { "id": 1, "license": 1, - "file_name": "4533b3e8-00_53_36_188376_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_4ls54Fe_png.rf.4d173023c1d2dba20d42efc2610a5694.png", + "file_name": "9ed8b373-00_57_50_813872_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_3jLoRJh_png.rf.170fe2ae11c1d8058d8d3e4b2361357a.png", "height": 2160, "width": 3840, - "date_captured": "2024-07-01T17:34:12+00:00" + "date_captured": "2024-07-02T01:50:17+00:00" }, { "id": 2, @@ -274,63 +274,63 @@ "file_name": "55617870-00_55_49_536245_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_NSeTZ2S_png.rf.5947b06a7caca9b89c2e06ec7ceab8fa.png", "height": 2160, "width": 3840, - "date_captured": "2024-07-01T17:34:12+00:00" + "date_captured": "2024-07-02T01:50:17+00:00" }, { "id": 3, "license": 1, - "file_name": "9f04db98-16_20_58_825243_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_VuLpBVc_png.rf.d5a9546240f15ceec20770b94a7606a2.png", + "file_name": "9f04db98-16_20_58_825243_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_VuLpBVc_png.rf.a16ce4854c42840f44a6c0a04d44c83c.png", "height": 2160, "width": 3840, - "date_captured": "2024-07-01T17:34:12+00:00" + "date_captured": "2024-07-02T01:50:17+00:00" }, { "id": 4, "license": 1, - "file_name": "cef1b3dd-00_55_22_640294_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_NtclVno_png.rf.0eb178e9974bb9135567f91780337d55.png", + "file_name": "01304a45-10_34_04_580378_WindowsGraphicsCaptureMethod_0x0_title_None_Client-Win_WnYCyUT_png.rf.7b5dfc4585195e1d846574b715468897.png", "height": 2160, "width": 3840, - "date_captured": "2024-07-01T17:34:12+00:00" + "date_captured": "2024-07-02T01:50:17+00:00" }, { "id": 5, "license": 1, - "file_name": "17_11_07_938917_WindowsGraphicsCaptureMethod_0x0_title_None_Client-Win64-Shipping-exe_3840x2160_396094_1_False_original_png.rf.b71534b615badeea04ffa8a299b9a473.png", + "file_name": "154eb284-17_01_16_406889_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_6yGu616_png.rf.12ebc1f4e7e5208bcbf2c7f878f691aa.png", "height": 2160, "width": 3840, - "date_captured": "2024-07-01T17:34:12+00:00" + "date_captured": "2024-07-02T01:50:17+00:00" }, { "id": 6, "license": 1, - "file_name": "9dd77a5d-16_57_31_014010_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_RVvCfQe_png.rf.e8397fbd133d485459bb8c30fc37353c.png", + "file_name": "3b991d47-10_18_37_465122_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_3Hw8AdB_png.rf.7b75bb60b5b041f3c6f36e735ca3bc19.png", "height": 2160, "width": 3840, - "date_captured": "2024-07-01T17:34:12+00:00" + "date_captured": "2024-07-02T01:50:17+00:00" }, { "id": 7, "license": 1, - "file_name": "0ab28c72-00_54_43_431654_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_usg73Cm_png.rf.124dc89f9b3816ecb0ce5a97c95475dc.png", + "file_name": "9beed513-16_15_23_246388_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_a4tQhDg_png.rf.4e79b52b95ad46f47bc470f069a65b29.png", "height": 2160, "width": 3840, - "date_captured": "2024-07-01T17:34:12+00:00" + "date_captured": "2024-07-02T01:50:17+00:00" }, { "id": 8, "license": 1, - "file_name": "1433eace-21_13_50_556378_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_z8GnYut_png.rf.0cdbc8a85686f46c7a404d24d4b425ec.png", + "file_name": "5841f84c-17_04_26_738022_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_TIDxIl1_png.rf.97a22c8e01f1fd88debc20c4c903b8b9.png", "height": 2160, "width": 3840, - "date_captured": "2024-07-01T17:34:12+00:00" + "date_captured": "2024-07-02T01:50:17+00:00" }, { "id": 9, "license": 1, - "file_name": "01304a45-10_34_04_580378_WindowsGraphicsCaptureMethod_0x0_title_None_Client-Win_WnYCyUT_png.rf.7b5dfc4585195e1d846574b715468897.png", + "file_name": "17_11_07_938917_WindowsGraphicsCaptureMethod_0x0_title_None_Client-Win64-Shipping-exe_3840x2160_396094_1_False_original_png.rf.b71534b615badeea04ffa8a299b9a473.png", "height": 2160, "width": 3840, - "date_captured": "2024-07-01T17:34:12+00:00" + "date_captured": "2024-07-02T01:50:17+00:00" }, { "id": 10, @@ -338,31 +338,31 @@ "file_name": "221458a6-13_25_04_962031_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_XYXLS23_png.rf.281b46703c1e3f6bd436750f6aa82cf2.png", "height": 2160, "width": 3840, - "date_captured": "2024-07-01T17:34:12+00:00" + "date_captured": "2024-07-02T01:50:17+00:00" }, { "id": 11, "license": 1, - "file_name": "e521850f-00_37_38_458841_Encore_liberation_0-274_original_png.rf.e7703de2285a6b2c70567e891804c760.png", + "file_name": "9dd77a5d-16_57_31_014010_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_RVvCfQe_png.rf.e8397fbd133d485459bb8c30fc37353c.png", "height": 2160, "width": 3840, - "date_captured": "2024-07-01T17:34:12+00:00" + "date_captured": "2024-07-02T01:50:17+00:00" }, { "id": 12, "license": 1, - "file_name": "9beed513-16_15_23_246388_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_a4tQhDg_png.rf.4e79b52b95ad46f47bc470f069a65b29.png", + "file_name": "0ab28c72-00_54_43_431654_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_usg73Cm_png.rf.124dc89f9b3816ecb0ce5a97c95475dc.png", "height": 2160, "width": 3840, - "date_captured": "2024-07-01T17:34:12+00:00" + "date_captured": "2024-07-02T01:50:17+00:00" }, { "id": 13, "license": 1, - "file_name": "64425cad-10_44_19_536997_WindowsGraphicsCaptureMethod_0x0_title_None_Client-Win_BLAxtp1_png.rf.d37538db2b2d15d6aad459dd08bb348d.png", + "file_name": "e521850f-00_37_38_458841_Encore_liberation_0-274_original_png.rf.e7703de2285a6b2c70567e891804c760.png", "height": 2160, "width": 3840, - "date_captured": "2024-07-01T17:34:12+00:00" + "date_captured": "2024-07-02T01:50:17+00:00" }, { "id": 14, @@ -370,51 +370,37 @@ "file_name": "934f0ca6-17_53_47_840123_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_aJQVINN_png.rf.a107256237035eec3be4125f726b8b73.png", "height": 2160, "width": 3840, - "date_captured": "2024-07-01T17:34:12+00:00" + "date_captured": "2024-07-02T01:50:17+00:00" }, { "id": 15, "license": 1, - "file_name": "154eb284-17_01_16_406889_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_6yGu616_png.rf.b7e209054f83709bed21a07dd8bfde12.png", + "file_name": "cef1b3dd-00_55_22_640294_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_NtclVno_png.rf.0eb178e9974bb9135567f91780337d55.png", "height": 2160, "width": 3840, - "date_captured": "2024-07-01T17:34:12+00:00" + "date_captured": "2024-07-02T01:50:17+00:00" }, { "id": 16, "license": 1, - "file_name": "3b991d47-10_18_37_465122_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_3Hw8AdB_png.rf.7b75bb60b5b041f3c6f36e735ca3bc19.png", + "file_name": "64425cad-10_44_19_536997_WindowsGraphicsCaptureMethod_0x0_title_None_Client-Win_BLAxtp1_png.rf.d37538db2b2d15d6aad459dd08bb348d.png", "height": 2160, "width": 3840, - "date_captured": "2024-07-01T17:34:12+00:00" + "date_captured": "2024-07-02T01:50:17+00:00" }, { "id": 17, "license": 1, - "file_name": "5841f84c-17_04_26_738022_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_TIDxIl1_png.rf.97a22c8e01f1fd88debc20c4c903b8b9.png", + "file_name": "1433eace-21_13_50_556378_WindowsGraphicsCaptureMethod_3840x2160_title_None_Clie_z8GnYut_png.rf.0cdbc8a85686f46c7a404d24d4b425ec.png", "height": 2160, "width": 3840, - "date_captured": "2024-07-01T17:34:12+00:00" + "date_captured": "2024-07-02T01:50:17+00:00" } ], "annotations": [ { "id": 0, "image_id": 0, - "category_id": 35, - "bbox": [ - 2937, - 1888, - 86, - 84 - ], - "area": 7224, - "segmentation": [], - "iscrowd": 0 - }, - { - "id": 1, - "image_id": 1, "category_id": 38, "bbox": [ 413, @@ -427,8 +413,8 @@ "iscrowd": 0 }, { - "id": 2, - "image_id": 1, + "id": 1, + "image_id": 0, "category_id": 37, "bbox": [ 75, @@ -440,6 +426,20 @@ "segmentation": [], "iscrowd": 0 }, + { + "id": 2, + "image_id": 1, + "category_id": 35, + "bbox": [ + 2937, + 1888, + 86, + 84 + ], + "area": 7224, + "segmentation": [], + "iscrowd": 0 + }, { "id": 3, "image_id": 2, @@ -531,198 +531,212 @@ "bbox": [ 3138, 1895, - 114.25, - 70.22 + 118.14, + 78 ], - "area": 8022.635, + "area": 9214.92, "segmentation": [], "iscrowd": 0 }, { "id": 10, "image_id": 4, - "category_id": 42, + "category_id": 44, "bbox": [ - 272, - 327, - 108, - 108 + 3579, + 1875, + 98, + 184 ], - "area": 11664, + "area": 18032, "segmentation": [], "iscrowd": 0 }, { "id": 11, "image_id": 5, - "category_id": 27, + "category_id": 8, "bbox": [ - 3543, - 733, - 81.36, - 64.55 + 3356, + 1901, + 111.66, + 67.61 ], - "area": 5251.788, + "area": 7549.333, "segmentation": [], "iscrowd": 0 }, { "id": 12, "image_id": 5, - "category_id": 23, + "category_id": 6, "bbox": [ - 3545, - 1008, - 73.64, - 51.82 + 3496, + 929, + 176, + 182 ], - "area": 3816.025, + "area": 32032, "segmentation": [], "iscrowd": 0 }, { "id": 13, "image_id": 5, - "category_id": 24, + "category_id": 4, "bbox": [ - 3545, - 481, - 73.64, - 43.18 + 3508, + 407, + 172, + 185 ], - "area": 3179.775, + "area": 31820, "segmentation": [], "iscrowd": 0 }, { "id": 14, - "image_id": 6, - "category_id": 43, + "image_id": 5, + "category_id": 5, "bbox": [ - 2513, - 1239, - 58, - 100 + 3515, + 665, + 169, + 188 ], - "area": 5800, + "area": 31772, "segmentation": [], "iscrowd": 0 }, { "id": 15, - "image_id": 7, - "category_id": 45, + "image_id": 5, + "category_id": 28, "bbox": [ - 2589, - 1897, - 242, - 210 + 3536, + 985, + 83, + 77 ], - "area": 50820, + "area": 6391, "segmentation": [], "iscrowd": 0 }, { "id": 16, - "image_id": 8, - "category_id": 46, + "image_id": 5, + "category_id": 34, "bbox": [ - 2502, - 1207, - 27, - 27 + 3401, + 1939, + 10, + 10 ], - "area": 729, + "area": 100, "segmentation": [], "iscrowd": 0 }, { "id": 17, - "image_id": 8, - "category_id": 36, + "image_id": 5, + "category_id": 9, "bbox": [ - 2937, - 101, - 74, - 45 + 3566, + 1896, + 116.83, + 71.99 ], - "area": 3330, + "area": 8410.592, "segmentation": [], "iscrowd": 0 }, { "id": 18, - "image_id": 9, - "category_id": 44, + "image_id": 5, + "category_id": 2, "bbox": [ - 3579, - 1875, - 98, - 184 + 3347, + 740, + 153, + 72 ], - "area": 18032, + "area": 11016, "segmentation": [], "iscrowd": 0 }, { "id": 19, - "image_id": 10, - "category_id": 26, + "image_id": 5, + "category_id": 33, "bbox": [ - 3554, - 734, - 76, - 60 + 3544, + 709, + 60, + 35.45 ], - "area": 4560, + "area": 2127, "segmentation": [], "iscrowd": 0 }, { "id": 20, - "image_id": 10, - "category_id": 29, + "image_id": 5, + "category_id": 3, "bbox": [ - 3534, - 1004, - 75, - 42 + 3348, + 994, + 153, + 72 ], - "area": 3150, + "area": 11016, "segmentation": [], "iscrowd": 0 }, { "id": 21, - "image_id": 10, - "category_id": 25, + "image_id": 5, + "category_id": 1, "bbox": [ - 3541, - 477, - 72, - 48 + 3346, + 480, + 153, + 72 ], - "area": 3456, + "area": 11016, "segmentation": [], "iscrowd": 0 }, { "id": 22, - "image_id": 11, - "category_id": 40, + "image_id": 6, + "category_id": 19, "bbox": [ - 1747, - 274, - 58, - 54 + 3649, + 739, + 28, + 23 ], - "area": 3132, + "area": 644, "segmentation": [], "iscrowd": 0 }, { "id": 23, - "image_id": 12, + "image_id": 6, + "category_id": 17, + "bbox": [ + 3650, + 474, + 27, + 25 + ], + "area": 675, + "segmentation": [], + "iscrowd": 0 + }, + { + "id": 24, + "image_id": 7, "category_id": 20, "bbox": [ 3473, @@ -735,8 +749,8 @@ "iscrowd": 0 }, { - "id": 24, - "image_id": 12, + "id": 25, + "image_id": 7, "category_id": 22, "bbox": [ 3474, @@ -749,8 +763,8 @@ "iscrowd": 0 }, { - "id": 25, - "image_id": 12, + "id": 26, + "image_id": 7, "category_id": 21, "bbox": [ 3649, @@ -763,282 +777,268 @@ "iscrowd": 0 }, { - "id": 26, - "image_id": 13, - "category_id": 41, + "id": 27, + "image_id": 8, + "category_id": 12, "bbox": [ - 2805, - 1225, - 165, - 267 - ], - "area": 44055, - "segmentation": [], - "iscrowd": 0 - }, - { - "id": 27, - "image_id": 13, - "category_id": 16, - "bbox": [ - 890, - 1243, - 75, - 211.67 + 2523, + 1221, + 101, + 82 ], - "area": 15875.25, + "area": 8282, "segmentation": [], "iscrowd": 0 }, { "id": 28, - "image_id": 14, - "category_id": 14, + "image_id": 8, + "category_id": 13, "bbox": [ - 3560, - 65, - 114, - 114 + 2525, + 1384, + 104, + 81 ], - "area": 12996, + "area": 8424, "segmentation": [], "iscrowd": 0 }, { "id": 29, - "image_id": 15, - "category_id": 8, + "image_id": 8, + "category_id": 11, "bbox": [ - 3356, - 1901, - 109.78, - 65.36 + 3381, + 107, + 58, + 46 ], - "area": 7175.221, + "area": 2668, "segmentation": [], "iscrowd": 0 }, { "id": 30, - "image_id": 15, - "category_id": 6, + "image_id": 8, + "category_id": 15, "bbox": [ - 3496, - 929, - 176, - 182 + 3565, + 111, + 63, + 38 ], - "area": 32032, + "area": 2394, "segmentation": [], "iscrowd": 0 }, { "id": 31, - "image_id": 15, - "category_id": 4, + "image_id": 9, + "category_id": 27, "bbox": [ - 3508, - 407, - 172, - 185 + 3543, + 733, + 81.36, + 64.55 ], - "area": 31820, + "area": 5251.788, "segmentation": [], "iscrowd": 0 }, { "id": 32, - "image_id": 15, - "category_id": 5, + "image_id": 9, + "category_id": 23, "bbox": [ - 3515, - 665, - 169, - 188 + 3545, + 1008, + 73.64, + 51.82 ], - "area": 31772, + "area": 3816.025, "segmentation": [], "iscrowd": 0 }, { "id": 33, - "image_id": 15, - "category_id": 28, + "image_id": 9, + "category_id": 24, "bbox": [ - 3536, - 985, - 83, - 77 + 3545, + 481, + 73.64, + 43.18 ], - "area": 6391, + "area": 3179.775, "segmentation": [], "iscrowd": 0 }, { "id": 34, - "image_id": 15, - "category_id": 34, + "image_id": 10, + "category_id": 26, "bbox": [ - 3401, - 1939, - 10, - 10 + 3554, + 734, + 76, + 60 ], - "area": 100, + "area": 4560, "segmentation": [], "iscrowd": 0 }, { "id": 35, - "image_id": 15, - "category_id": 9, + "image_id": 10, + "category_id": 29, "bbox": [ - 3566, - 1896, - 114.2, - 68.61 + 3534, + 1004, + 75, + 42 ], - "area": 7835.262, + "area": 3150, "segmentation": [], "iscrowd": 0 }, { "id": 36, - "image_id": 15, - "category_id": 2, + "image_id": 10, + "category_id": 25, "bbox": [ - 3347, - 740, - 153, - 72 + 3541, + 477, + 72, + 48 ], - "area": 11016, + "area": 3456, "segmentation": [], "iscrowd": 0 }, { "id": 37, - "image_id": 15, - "category_id": 33, + "image_id": 11, + "category_id": 43, "bbox": [ - 3544, - 709, - 60, - 35.45 + 2513, + 1239, + 58, + 100 ], - "area": 2127, + "area": 5800, "segmentation": [], "iscrowd": 0 }, { "id": 38, - "image_id": 15, - "category_id": 3, + "image_id": 12, + "category_id": 45, "bbox": [ - 3348, - 994, - 153, - 72 + 2589, + 1897, + 242, + 210 ], - "area": 11016, + "area": 50820, "segmentation": [], "iscrowd": 0 }, { "id": 39, - "image_id": 15, - "category_id": 1, + "image_id": 13, + "category_id": 40, "bbox": [ - 3346, - 480, - 153, - 72 + 1747, + 274, + 58, + 54 ], - "area": 11016, + "area": 3132, "segmentation": [], "iscrowd": 0 }, { "id": 40, - "image_id": 16, - "category_id": 19, + "image_id": 14, + "category_id": 14, "bbox": [ - 3649, - 739, - 28, - 23 + 3560, + 65, + 114, + 114 ], - "area": 644, + "area": 12996, "segmentation": [], "iscrowd": 0 }, { "id": 41, - "image_id": 16, - "category_id": 17, + "image_id": 15, + "category_id": 42, "bbox": [ - 3650, - 474, - 27, - 25 + 272, + 327, + 108, + 108 ], - "area": 675, + "area": 11664, "segmentation": [], "iscrowd": 0 }, { "id": 42, - "image_id": 17, - "category_id": 12, + "image_id": 16, + "category_id": 41, "bbox": [ - 2523, - 1221, - 101, - 82 + 2805, + 1225, + 165, + 267 ], - "area": 8282, + "area": 44055, "segmentation": [], "iscrowd": 0 }, { "id": 43, - "image_id": 17, - "category_id": 13, + "image_id": 16, + "category_id": 16, "bbox": [ - 2525, - 1384, - 104, - 81 + 890, + 1243, + 75, + 211.67 ], - "area": 8424, + "area": 15875.25, "segmentation": [], "iscrowd": 0 }, { "id": 44, "image_id": 17, - "category_id": 11, + "category_id": 46, "bbox": [ - 3381, - 107, - 58, - 46 + 2502, + 1207, + 27, + 27 ], - "area": 2668, + "area": 729, "segmentation": [], "iscrowd": 0 }, { "id": 45, "image_id": 17, - "category_id": 15, + "category_id": 36, "bbox": [ - 3565, - 111, - 63, - 38 + 2937, + 101, + 74, + 45 ], - "area": 2394, + "area": 3330, "segmentation": [], "iscrowd": 0 } diff --git a/src/char/BaseChar.py b/src/char/BaseChar.py index e608dca..0146f97 100644 --- a/src/char/BaseChar.py +++ b/src/char/BaseChar.py @@ -151,6 +151,10 @@ def click_resonance(self, post_sleep=0, has_animation=False, send_click=True): resonance_click_time = 0 animated = False while True: + if resonance_click_time != 0 and time.time() - resonance_click_time > 10: + self.logger.error(f'click_resonance too long, breaking {time.time() - resonance_click_time}') + self.task.screenshot('click_resonance too long, breaking') + break if has_animation: if not self.task.in_team()[0]: animated = True @@ -180,11 +184,6 @@ def click_resonance(self, post_sleep=0, has_animation=False, send_click=True): last_op = 'resonance' self.send_resonance_key() last_click = now - if time.time() - resonance_click_time > 10: - self.logger.error(f'click_resonance too long, breaking') - self.task.screenshot(self.task.get_box_by_name('box_resonance').crop(self.task.frame), - 'click_resonance too long, breaking') - break self.task.next_frame() if clicked: self.sleep(post_sleep) @@ -230,7 +229,7 @@ def click_echo(self, duration=0, sleep_time=0): clicked = True self.update_echo_cd() self.task.send_key(self.get_echo_key()) - last_click = now + last_click = now self.task.next_frame() self.logger.debug(f'click_echo end {clicked}') return clicked diff --git a/src/combat/CombatCheck.py b/src/combat/CombatCheck.py index ecb4d55..39fd4a8 100644 --- a/src/combat/CombatCheck.py +++ b/src/combat/CombatCheck.py @@ -3,7 +3,7 @@ import cv2 -from ok.color.Color import find_color_rectangles, white_color, keep_pixels_in_color_range +from ok.color.Color import find_color_rectangles, keep_pixels_in_color_range from ok.feature.Box import find_boxes_by_name from ok.logging.Logger import get_logger from src import text_white_color @@ -36,13 +36,14 @@ def check_count_down(self): if self.has_count_down: if count_down < 0.1: - self.screenshot(f'out of combat because of count_down disappeared {count_down:.2f}%') + # self.screenshot(f'out of combat because of count_down disappeared {count_down:.2f}%') logger.info(f'out of combat because of count_down disappeared {count_down:.2f}%') + self.has_count_down = False return False else: return True else: - self.has_count_down = count_down + self.has_count_down = count_down > 0.1 return self.has_count_down def check_boss(self): @@ -95,16 +96,16 @@ def in_combat(self): return True if not self.check_health_bar(): logger.debug('not in team or no health bar') - if self.last_out_of_combat_time == 0: - self.last_out_of_combat_time = now - logger.debug( - 'first time detected, not in team and no health bar, wait for 4 seconds to double check') - return True - elif now - self.last_out_of_combat_time > 4: - logger.debug('out of combat for 4 secs return False') - return self.reset_to_false() - else: - return True + # if self.last_out_of_combat_time == 0: + # self.last_out_of_combat_time = now + # logger.debug( + # 'first time detected, not in team and no health bar, wait for 4 seconds to double check') + return self.reset_to_false() + # elif now - self.last_out_of_combat_time > 4: + # logger.debug('out of combat for 4 secs return False') + # return self.reset_to_false() + # else: + # return True else: logger.debug( 'check in combat pass') @@ -113,12 +114,15 @@ def in_combat(self): else: return True else: - in_combat = self.in_team()[0] and self.check_health_bar() + in_combat = self.in_team()[0] and self.check_health_bar() and ( + self.boss_lv_edge is not None or self.has_count_down is not None) if in_combat: + logger.info( + f'enter combat boss_lv_edge:{self.boss_lv_edge is not None} has_count_down:{self.has_count_down is not None}') self._in_combat = True return True - def check_health_bar(self, find_boss=True): + def check_health_bar(self): if self._in_combat: min_height = self.height_of_screen(10 / 2160) max_height = min_height * 3 @@ -133,8 +137,18 @@ def check_health_bar(self, find_boss=True): if len(boxes) > 0: self.draw_boxes('enemy_health_bar_red', boxes, color='blue') return True - elif find_boss: - return self.find_boss_lv_text() + else: + boxes = find_color_rectangles(self.frame, boss_health_color, min_width * 3, min_height * 1.3, + box=self.box_of_screen(1269 / 3840, 58 / 2160, 2533 / 3840, 192 / 2160)) + if len(boxes) == 1: + self.boss_health_box = boxes[0] + self.boss_health_box.width = 10 + self.boss_health_box.x += 6 + self.boss_health = self.boss_health_box.crop_frame(self.frame) + self.draw_boxes('boss_health', boxes, color='blue') + return True + + return self.find_boss_lv_text() def find_boss_lv_text(self): texts = self.ocr(box=self.box_of_screen(1269 / 3840, 10 / 2160, 2533 / 3840, 140 / 2160), @@ -152,7 +166,7 @@ def find_boss_lv_text(self): def keep_boss_text_white(self): corpped = self.boss_lv_box.crop_frame(self.frame) - image, area = keep_pixels_in_color_range(corpped, white_color) + image, area = keep_pixels_in_color_range(corpped, boss_white_text_color) if area / image.shape[0] * image.shape[1] < 0.05: image, area = keep_pixels_in_color_range(corpped, boss_orange_text_color) if area / image.shape[0] * image.shape[1] < 0.05: @@ -176,6 +190,12 @@ def keep_boss_text_white(self): 'b': (18, 70) # Blue range } +boss_white_text_color = { + 'r': (200, 255), # Red range + 'g': (200, 255), # Green range + 'b': (200, 255) # Blue range +} + boss_orange_text_color = { 'r': (218, 218), # Red range 'g': (178, 178), # Green range diff --git a/src/task/BaseCombatTask.py b/src/task/BaseCombatTask.py index ee888a3..dd0bf40 100644 --- a/src/task/BaseCombatTask.py +++ b/src/task/BaseCombatTask.py @@ -1,6 +1,9 @@ +import math import random import time +import win32api + from ok.feature.FindFeature import FindFeature from ok.logging.Logger import get_logger from ok.ocr.OCR import OCR @@ -8,7 +11,7 @@ from ok.task.TaskExecutor import CannotFindException from ok.util.list import safe_get from src.char import BaseChar -from src.char.BaseChar import Priority, role_values +from src.char.BaseChar import Priority from src.char.CharFactory import get_char_by_pos from src.combat.CombatCheck import CombatCheck @@ -29,13 +32,9 @@ def __init__(self): 'Echo Key': 'q', 'Liberation Key': 'r', 'Resonance Key': 'e', - 'Character 1 Role': 'Default', - 'Character 2 Role': 'Default', - 'Character 3 Role': 'Default', }) - self.config_type["Character 1 Role"] = {'type': "drop_down", 'options': role_values} - self.config_type["Character 2 Role"] = {'type': "drop_down", 'options': role_values} - self.config_type["Character 3 Role"] = {'type': "drop_down", 'options': role_values} + + self.mouse_pos = None self.char_texts = ['char_1_text', 'char_2_text', 'char_3_text'] @@ -84,14 +83,14 @@ def switch_next_char(self, current_char, post_action=None, free_intro=False, tar self.send_key(switch_to.index + 1) last_click = now in_team, current_index, size = self.in_team() - if not in_team: + if not in_team and now - start > 10: if self.debug: - self.screenshot(f'not in team while switching chars_{current_char}_to_{switch_to}') + self.screenshot(f'not in team while switching chars_{current_char}_to_{switch_to} {now - start}') self.raise_not_in_combat('not in team while switching chars') if current_index != switch_to.index: has_intro = free_intro if free_intro else current_char.is_con_full() switch_to.has_intro = has_intro - if now - start > 3: + if now - start > 10: if self.debug: self.screenshot(f'switch_not_detected_{current_char}_to_{switch_to}') self.raise_not_in_combat('failed switch chars') @@ -113,8 +112,11 @@ def click(self, x=-1, y=-1, move_back=False, name=None, interval=-1): y = self.height_of_screen(random.uniform(0.4, 0.6)) return super().click(x, y, move_back, name, interval) - def wait_in_team(self, time_out=10): - self.wait_until(lambda: self.in_team()[0], time_out=time_out) + def wait_in_team_and_world(self, time_out=10): + self.wait_until(self.in_team_and_world, time_out=time_out, raise_if_not_found=True) + + def in_team_and_world(self): + return self.in_team()[0] and self.find_one(f'gray_book_button', threshold=0.7, use_gray_scale=True) def get_current_char(self): for char in self.chars: @@ -135,21 +137,41 @@ def check_combat(self): if not self.in_combat(): self.raise_not_in_combat('combat check not in combat') - def walk_until_f(self, time_out=0, raise_if_not_found=True): - if not self.find_one('pick_up_f', horizontal_variance=0.02, vertical_variance=0.2, threshold=0.8, + def walk_until_f(self, direction='w', time_out=0, raise_if_not_found=True): + if not self.find_one('pick_up_f', horizontal_variance=0.1, vertical_variance=0.1, threshold=0.8, use_gray_scale=True): - self.send_key_down('w') - f_found = self.wait_feature('pick_up_f', horizontal_variance=0.02, vertical_variance=0.02, + self.send_key_down(direction) + f_found = self.wait_feature('pick_up_f', horizontal_variance=0.1, vertical_variance=0.1, use_gray_scale=True, threshold=0.8, wait_until_before_delay=0, time_out=time_out, raise_if_not_found=False) - self.send_key_up('w') if not f_found: if raise_if_not_found: raise CannotFindException('cant find the f to enter') else: logger.warning(f"can't find the f to enter") - return - self.send_key('f') + self.send_key_up(direction) + return False + self.send_key('f') + self.sleep(0.2) + self.send_key('f') + self.send_key_up(direction) + if self.wait_click_feature('cancel_button', relative_x=1, raise_if_not_found=True, + use_gray_scale=True, time_out=2): + logger.warning(f"found a claim reward") + return False + # while self.in_team_and_world(): + # + # self.send_key('f') + # count += 1 + # if count > 20: + # self.send_key_up(direction) + # logger.error('failed to enter') + # if raise_if_not_found: + # raise CannotFindException('cant find the f to enter') + # else: + # return False + else: + self.send_key('f') self.sleep(0.5) return True @@ -225,6 +247,25 @@ def in_team(self): else: return False, -1, exist_count + 1 + def mouse_reset(self): + # logger.debug("mouse_reset") + current_position = win32api.GetCursorPos() + if self.mouse_pos: + distance = math.sqrt( + (current_position[0] - self.mouse_pos[0]) ** 2 + + (current_position[1] - self.mouse_pos[1]) ** 2 + ) + if distance > 400: + logger.debug(f'move mouse back {self.mouse_pos}') + win32api.SetCursorPos(self.mouse_pos) + self.mouse_pos = None + if self.enabled: + self.handler.post(self.mouse_reset, 1) + return + self.mouse_pos = current_position + if self.enabled: + return self.handler.post(self.mouse_reset, 0.005) + white_color = { 'r': (253, 255), # Red range diff --git a/src/task/FarmEchoTask.py b/src/task/FarmEchoTask.py index 4391682..8d29d15 100644 --- a/src/task/FarmEchoTask.py +++ b/src/task/FarmEchoTask.py @@ -10,13 +10,24 @@ class FarmEchoTask(BaseCombatTask): def __init__(self): super().__init__() + self.description = "Click Start at the Entrance(Dreamless, Jue)" + self.name = "Farm Echo in Dungeon" self.default_config.update({ + 'Level': 1, 'Repeat Farm Count': 100, - 'Teleport': True + 'Entrance Direction': 'Forward' }) + self.config_description = { + 'Level': '(1-6) Important, Choose which level to farm, lower levels might not produce a echo', + 'Entrance Direction': 'Choose Forward for Dreamless, Backward for Jue' + } + self.config_type["Entrance Direction"] = {'type': "drop_down", 'options': ['Forward', 'Backward']} self.crownless_pos = (0.9, 0.4) def run(self): + self.handler.post(self.mouse_reset, 0.01) + # self.find_echo_drop() + # return if not self.in_team()[0]: self.log_error('must be in game world and in teams', notify=True) return @@ -36,57 +47,102 @@ def run(self): # loop here count = 0 - i = -1 while count < self.config.get("Repeat Farm Count", 0): count += 1 self.wait_until(lambda: self.in_team()[0], time_out=40) - self.walk_until_f() - self.wait_ocr(0.75, 0.02, 0.85, 0.09, match=re.compile('240'), raise_if_not_found=True) - i = self.choose_level(0) - if i == -1: - self.log_error('Can not find a level to enter', notify=True) - return - # self.wait_click_feature('gray_crownless_battle', raise_if_not_found=True, use_gray_scale=True, - # box=self.box_of_screen(0.05, 0.12, 0.11, 0.22), threshold=0.7) - # self.click_relative(0.15, 0.17) - # self.sleep(1) - # + self.walk_until_f(time_out=10, + direction='w' if self.config.get('Entrance Direction') == 'Forward' else 's') + logger.info(f'enter success') + stam = self.wait_ocr(0.75, 0.02, 0.85, 0.09, match=re.compile('240'), raise_if_not_found=True) + logger.info(f'found stam {stam}') + self.sleep(1) + self.choose_level(self.config.get("Level")) + # if i == -1: + # self.log_error('Can not find a level to enter', notify=True) + # return self.wait_until(lambda: self.in_combat(), time_out=40, raise_if_not_found=True) self.load_chars() - while True: + while self.in_combat(): try: - logger.debug(f'autocombat loop {self.chars}') + logger.debug(f'farm echo loop {self.chars}') self.get_current_char().perform() - except NotInCombatException: - logger.info('out of combat break') + except NotInCombatException as e: + logger.info(f'farm echo loop out of combat break {e}') + if self.debug: + self.screenshot(f'out of combat break {e}') break - self.wait_in_team(time_out=20) - if self.walk_until_f(time_out=1.5, raise_if_not_found=False): # find and pick echo + logger.info(f'farm echo combat end') + self.wait_in_team_and_world(time_out=20) + logger.info(f'farm echo move forward walk_until_f to find echo') + if self.walk_until_f(time_out=4, raise_if_not_found=False): # find and pick echo + logger.debug(f'farm echo found echo move forward walk_until_f to find echo') self.info['Echo Count'] = self.info.get('Echo Count', 0) + 1 + else: + self.find_echo_drop() + self.sleep(0.5) self.send_key('esc') self.wait_click_feature('gray_confirm_exit_button', relative_x=-1, raise_if_not_found=True, use_gray_scale=True) - self.wait_in_team(time_out=40) + self.wait_in_team_and_world(time_out=40) + self.sleep(1) def choose_level(self, start): y = 0.17 x = 0.15 distance = 0.08 + # for i in range(4): + # if i < start: + # continue + logger.info(f'choose level {start}') + self.click_relative(x, y + (start - 1) * distance) + # self.sleep(1) + # self.click_relative(x, y + (start - 1) * distance) + self.wait_click_feature('gray_button_challenge', raise_if_not_found=True, use_gray_scale=True) + # self.sleep(1) + # confirm_button = self.find_one('gray_confirm_exit_button', use_gray_scale=True, threshold=0.7) + + self.wait_click_feature('gray_confirm_exit_button', relative_x=-1, raise_if_not_found=False, + use_gray_scale=True, time_out=2) + self.wait_click_feature('gray_start_battle', relative_x=-1, raise_if_not_found=True, + use_gray_scale=True) + + def find_echo_drop(self): + # self.click_relative(0.5, 0.5) + # self.sleep(1) + # self.middle_click_relative(0.5, 0.5) + step = 0.01 + box = self.box_of_screen(0.25, 0.20, 0.75, 0.53) + highest_percent = 0.0 + highest_index = 0 for i in range(4): - if i < start: - continue - self.click_relative(x, y + i * distance) + self.middle_click_relative(0.5, 0.5) + color_percent = self.calculate_color_percentage(echo_color, box) + if color_percent > highest_percent: + highest_percent = color_percent + highest_index = i + self.screenshot(f'find_echo_{highest_index}_{float(color_percent):.3f}_{float(highest_percent):.3}') self.sleep(1) - self.wait_click_feature('gray_button_challenge', raise_if_not_found=True, use_gray_scale=True) + self.next_frame() + logger.debug(f'searching for echo {i} {float(color_percent):.3f} {float(highest_percent):.3}') + # self.click_relative(0.25, 0.25) self.sleep(1) - cancel_button = self.find_one('cancel_button', use_gray_scale=True, threshold=0.7) - self.screenshot(f'cancel_{cancel_button}') - if not cancel_button: - self.wait_click_feature('gray_start_battle', relative_x=-1, raise_if_not_found=True, - use_gray_scale=True) - return i - else: - self.click(cancel_button) + self.send_key('a', down_time=0.05) + self.sleep(1) + + if highest_percent > 0.05: + for i in range(highest_index): + self.middle_click_relative(0.5, 0.5) self.sleep(1) - return -1 + self.send_key('a', down_time=0.05) + self.sleep(1) + self.screenshot(f'pick_echo_{highest_index}') + logger.info(f'found echo {highest_index} walk') + self.walk_until_f(raise_if_not_found=False, time_out=5) + + +echo_color = { + 'r': (200, 255), # Red range + 'g': (150, 220), # Green range + 'b': (130, 170) # Blue range +}