Jelajahi Sumber

大富翁修复荣誉商店不购买蓝票的问题

lhye 2 bulan lalu
induk
melakukan
43ada9d15c
2 mengubah file dengan 5 tambahan dan 12 penghapusan
  1. 2 3
      tasks/RichMan/mall/honor.py
  2. 3 9
      tasks/RichMan/mall/special.py

+ 2 - 3
tasks/RichMan/mall/honor.py

@@ -70,9 +70,8 @@ class Honor(Special):
         if not self.mall_check_money(4, 1500):
             logger.warning('No enough money')
             return
-        # 使用动态位置点击购买
-        self.appear_then_click(self.I_HONOR_BLUE)
-        time.sleep(1)
+        # 购买: 点商品打开购买弹窗, 点加号拉满数量后确认购买
+        self.buy_more(self.I_HONOR_BLUE)
 
     def _honor_black_daruma_scrap(self, enable: bool=False):
         logger.hr('Buy black daruma scrap', 3)

+ 3 - 9
tasks/RichMan/mall/special.py

@@ -163,15 +163,9 @@ class Special(Buy, MallNavbar):
                   .replace(':', ':').replace('火', '次')
                   .replace('教', '数').replace('刺', '剩')
                   .replace('头', '买'))
-        try:
-            if ':' in result:
-                result = re.findall(r'(?:剩余)?购买次数:(\d+)', result)[0]
-                result = int(result)
-            else:
-                result = re.findall(r'本周剩余数量(\d+)', result)[0]
-                result = int(result)
-        except:
-            result = 0
+        # 冒号可能被漏识别, 如"剩余购买次数2", 所以冒号设为可选
+        matched = re.search(r'(?:剩余)?(?:购买次数|本周剩余数量):?(\d+)', result)
+        result = int(matched.group(1)) if matched else 0
         logger.info(f'Remain [{result}]')
         return result