feat: 调整高价值福袋预约参数,增加提前参与时间和提高最低奖品价值
This commit is contained in:
1 parent
6b9b02bd58
commit
8838b62e61
9 files changed
+35
-76
No files matched your search
@@ -587,7 +587,7 @@ python run_cli.py \
|
||||
|--------|------|--------|------|
|
||||
| `high_value_fudai_enabled` | boolean | `true` | 是否启用高价值福袋预约功能 |
|
||||
| `high_value_fudai_threshold_yuan` | float | `500.0` | 高价值福袋的阈值(元),价值≥该值则预约 |
|
||||
| `high_value_fudai_join_ahead_seconds` | integer | `120` | 提前参与秒数,开奖前 N 秒返回直播间参与 |
|
||||
| `high_value_fudai_join_ahead_seconds` | integer | `300` | 提前参与秒数,开奖前 N 秒返回直播间参与 |
|
||||
| `high_value_fudai_max_swipe_back` | integer | `35` | 最多回退直播间次数,防止回退过远导致异常 |
|
||||
| `high_value_fudai_max_reservations` | integer | `3` | 最多同时记录的预约数量,超过后丢弃最晚开奖的 |
|
||||
| `high_value_fudai_after_action` | string | `"continue"` | 完成预约后的动作:`"stay"`=停留,`"continue"`=继续抢福袋 |
|
||||
|
||||
+15
-11
@@ -1913,9 +1913,11 @@ class underlying_operations:
|
||||
debug_image = full_screenshot if full_screenshot is not None else img1
|
||||
|
||||
# 准备额外信息
|
||||
# 保留小数点(包括全角/中文标点归一化为英文点)以便调试时看到如 24.9 这样的值
|
||||
digits_result = ""
|
||||
if text:
|
||||
digits_result = "".join(ch for ch in str(text) if ch.isdigit())
|
||||
t_norm = str(text).replace("。", ".").replace(",", ".").replace(".", ".")
|
||||
digits_result = "".join(ch for ch in t_norm if ch.isdigit() or ch == ".")
|
||||
|
||||
extra_info_dict = {
|
||||
"mode": change_color,
|
||||
@@ -1973,27 +1975,29 @@ class underlying_operations:
|
||||
|
||||
# 只提取数字字符,并进行智能过滤
|
||||
if text:
|
||||
# 提取所有数字字符
|
||||
digits = "".join(ch for ch in str(text) if ch.isdigit())
|
||||
# 同时准备两种数字抽取结果:
|
||||
# 1) digits_only: 仅数字(用于倒计时/位置等只需整数的场景)
|
||||
# 2) digits: 允许小数点(用于金额/带小数的数值),并规范化常见全角标点
|
||||
text_norm = str(text).replace("。", ".").replace(",", ".").replace(".", ".")
|
||||
digits_only = "".join(ch for ch in text_norm if ch.isdigit())
|
||||
digits = "".join(ch for ch in text_norm if ch.isdigit() or ch == ".")
|
||||
|
||||
# 智能过滤:如果识别到的数字太多(可能是识别到了文件名或坐标),
|
||||
# 尝试提取合理的数字段
|
||||
if len(digits) > 10:
|
||||
if len(digits_only) > 10:
|
||||
# 对于价值:通常不超过6位数字(999999元以内)
|
||||
# 对于倒计时:通常是1-2位数字
|
||||
# 尝试提取最后几个数字(通常是实际值)
|
||||
# 或者提取最短的连续数字段
|
||||
|
||||
# 提取所有连续的数字段
|
||||
digit_segments = re.findall(r"\d+", str(text))
|
||||
# 提取所有连续的数字段(允许小数点的段落匹配)
|
||||
digit_segments = re.findall(r"\d+(?:\.\d+)?", text_norm)
|
||||
if digit_segments:
|
||||
# 对于价值,选择最大的合理数字段(不超过6位)
|
||||
# 对于价值,选择最大的合理数字段(不超过6位数字,不计小数点)
|
||||
# 对于倒计时,选择1-2位的数字段
|
||||
# 这里先返回所有数字,让调用方处理
|
||||
# 但优先选择较短的段(1-6位)
|
||||
reasonable_segments = [
|
||||
s for s in digit_segments if 1 <= len(s) <= 6
|
||||
]
|
||||
# 但优先选择较短的段(1-6位),忽略小数点长度影响
|
||||
reasonable_segments = [s for s in digit_segments if 1 <= len(s.replace('.', '')) <= 6]
|
||||
if reasonable_segments:
|
||||
# 如果有多段,优先选择较短的(倒计时)或较长的(价值)
|
||||
# 这里返回最长的合理段(通常是价值)
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
"lucky_draw_red_ratio_threshold": 0.8,
|
||||
"high_value_fudai_enabled": true,
|
||||
"high_value_fudai_threshold_yuan": 500.0,
|
||||
"high_value_fudai_join_ahead_seconds": 120,
|
||||
"high_value_fudai_join_ahead_seconds": 300,
|
||||
"high_value_fudai_max_swipe_back": 50,
|
||||
"high_value_fudai_max_reservations": 9999,
|
||||
"high_value_fudai_after_action": "continue",
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@
|
||||
"needswitch": true,
|
||||
"infinite_loop_enabled": true,
|
||||
"wait_minutes": 5,
|
||||
"min_prize_value_yuan": 200.0,
|
||||
"min_prize_value_yuan": 250.0,
|
||||
"min_participants": 0,
|
||||
"max_participants": 0,
|
||||
"skip_if_countdown_gt_seconds": 180,
|
||||
@@ -16,8 +16,8 @@
|
||||
"high_value_fudai_max_swipe_back": 50,
|
||||
"high_value_fudai_max_reservations": 9999,
|
||||
"high_value_fudai_after_action": "continue",
|
||||
"high_value_room_revisit_enabled": true,
|
||||
"high_value_room_revisit_only_current_run": true,
|
||||
"high_value_room_revisit_enabled": false,
|
||||
"high_value_room_revisit_only_current_run": false,
|
||||
"reservation_back_verify_enabled": true,
|
||||
"reservation_back_swipe_delay": 0.1,
|
||||
"reservation_preempt_min_value": 0.0,
|
||||
@@ -124,7 +124,7 @@
|
||||
"fudai_template_match_enabled": false,
|
||||
"fudai_template_match_threshold": 0.7,
|
||||
"lucky_draw_red_ratio_threshold": 0.8,
|
||||
"y_pianyi": 0,
|
||||
"y_pianyi": -8,
|
||||
"skip_if_countdown_lt_seconds": 5,
|
||||
"no_attend_timeout_minutes": 30.0,
|
||||
"logging": {
|
||||
|
||||
@@ -1,51 +1,8 @@
|
||||
{
|
||||
"updated_ts": 1767493398.0220582,
|
||||
"reason": "record_reservation",
|
||||
"room_pos": 3,
|
||||
"current_room_title": "带娃的小",
|
||||
"current_room_title_raw": "带娃的小.",
|
||||
"reservations": [
|
||||
{
|
||||
"prize_value_yuan": 699.0,
|
||||
"content": "",
|
||||
"future_ts": 1767493819.527862,
|
||||
"future_str": "2026-01-04 10:30:19",
|
||||
"pos_seen": 3,
|
||||
"room_title": "带娃的小",
|
||||
"room_title_raw": "带娃的小.",
|
||||
"created_ts": 1767493297.59925,
|
||||
"task_count": 2,
|
||||
"time_text": "08:47",
|
||||
"participants": 0,
|
||||
"copies": 0
|
||||
},
|
||||
{
|
||||
"prize_value_yuan": 1999.0,
|
||||
"content": "",
|
||||
"future_ts": 1767494002.620423,
|
||||
"future_str": "2026-01-04 10:33:22",
|
||||
"pos_seen": 0,
|
||||
"room_title": "作小帮粼",
|
||||
"room_title_raw": "作小帮粼。。",
|
||||
"created_ts": 1767493186.2436588,
|
||||
"task_count": 2,
|
||||
"time_text": "13:42",
|
||||
"participants": 0,
|
||||
"copies": 0
|
||||
},
|
||||
{
|
||||
"prize_value_yuan": 1999.0,
|
||||
"content": "",
|
||||
"future_ts": 1767494003.40085,
|
||||
"future_str": "2026-01-04 10:33:23",
|
||||
"pos_seen": 0,
|
||||
"room_title": "作川帮数",
|
||||
"room_title_raw": "作川帮数。。",
|
||||
"created_ts": 1767493120.9476802,
|
||||
"task_count": 2,
|
||||
"time_text": "14:48",
|
||||
"participants": 0,
|
||||
"copies": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
"updated_ts": 1767497510.8090184,
|
||||
"reason": "startup_clear",
|
||||
"room_pos": 0,
|
||||
"current_room_title": "",
|
||||
"current_room_title_raw": "",
|
||||
"reservations": []
|
||||
}
|
||||
@@ -89,6 +89,8 @@ def yanghao_idle(analyser, total_seconds: int) -> None:
|
||||
_human_delay(1.0, 2.2)
|
||||
need_settle_after_swipe = False
|
||||
_step_shot(f"before_detect_{roi_label}")
|
||||
# 确保在所有分支中都定义了 roi_path,避免后续使用时未赋值错误
|
||||
roi_path = ""
|
||||
# 如果坐标未配置且提供了模板文件,则使用屏幕右侧的默认坐标作为 ROI
|
||||
tpl = str(template_path or "").strip()
|
||||
tpl_exists = False
|
||||
@@ -114,8 +116,6 @@ def yanghao_idle(analyser, total_seconds: int) -> None:
|
||||
except Exception:
|
||||
tpl_exists = False
|
||||
|
||||
# 确保 roi_path 在所有分支中都有定义,避免可能的未赋值使用
|
||||
roi_path = ""
|
||||
print(
|
||||
f"[养号][DEBUG] _detect_icon action={action} template_path='{template_path}' tpl_exists={tpl_exists}"
|
||||
)
|
||||
|
||||
+3
-3
@@ -384,7 +384,7 @@ def main():
|
||||
value=float(cfg.get("high_value_fudai_threshold_yuan", 1000) or 1000)
|
||||
)
|
||||
high_value_fudai_join_ahead_seconds_var = tk.IntVar(
|
||||
value=int(cfg.get("high_value_fudai_join_ahead_seconds", 120) or 120)
|
||||
value=int(cfg.get("high_value_fudai_join_ahead_seconds", 300) or 300)
|
||||
)
|
||||
high_value_fudai_max_swipe_back_var = tk.IntVar(
|
||||
value=int(cfg.get("high_value_fudai_max_swipe_back", 60) or 60)
|
||||
@@ -1577,7 +1577,7 @@ def main():
|
||||
float(cfg.get("high_value_fudai_threshold_yuan", 1000) or 1000)
|
||||
)
|
||||
high_value_fudai_join_ahead_seconds_var.set(
|
||||
int(cfg.get("high_value_fudai_join_ahead_seconds", 120) or 120)
|
||||
int(cfg.get("high_value_fudai_join_ahead_seconds", 300) or 300)
|
||||
)
|
||||
high_value_fudai_max_swipe_back_var.set(
|
||||
int(cfg.get("high_value_fudai_max_swipe_back", 60) or 60)
|
||||
@@ -1805,7 +1805,7 @@ def main():
|
||||
high_value_fudai_threshold_yuan_var.get() or 1000
|
||||
)
|
||||
cfg2["high_value_fudai_join_ahead_seconds"] = int(
|
||||
high_value_fudai_join_ahead_seconds_var.get() or 120
|
||||
high_value_fudai_join_ahead_seconds_var.get() or 300
|
||||
)
|
||||
cfg2["high_value_fudai_max_swipe_back"] = int(
|
||||
high_value_fudai_max_swipe_back_var.get() or 60
|
||||
|
||||
@@ -32,7 +32,7 @@ def check_conflicts(cfg: dict) -> list:
|
||||
# 1. 检查倒计时参数冲突
|
||||
skip_gt = int(cfg.get("skip_if_countdown_gt_seconds", 900) or 900)
|
||||
skip_lt = int(cfg.get("skip_if_countdown_lt_seconds", 5) or 5)
|
||||
join_ahead = int(cfg.get("high_value_fudai_join_ahead_seconds", 120) or 120)
|
||||
join_ahead = int(cfg.get("high_value_fudai_join_ahead_seconds", 300) or 300)
|
||||
|
||||
if skip_lt >= skip_gt:
|
||||
conflicts.append({
|
||||
|
||||
+1
-3
@@ -36,13 +36,12 @@ const DEFAULTS = {
|
||||
// 高价值福袋预约
|
||||
high_value_fudai_enabled: false,
|
||||
high_value_fudai_threshold_yuan: 1000,
|
||||
high_value_fudai_join_ahead_seconds: 120,
|
||||
high_value_fudai_join_ahead_seconds: 300,
|
||||
high_value_fudai_max_swipe_back: 60,
|
||||
high_value_fudai_max_reservations: 5,
|
||||
high_value_fudai_after_action: "continue",
|
||||
high_value_room_revisit_enabled: true,
|
||||
high_value_room_revisit_only_current_run: false,
|
||||
high_value_room_revisit_interval_seconds: 3600,
|
||||
reservation_back_verify_enabled: true,
|
||||
// 找福袋图标相关
|
||||
fudai_find_max_attempts: 5,
|
||||
@@ -567,7 +566,6 @@ async function startRun() {
|
||||
fansclub_fail_action: cfgPart.fansclub_fail_action,
|
||||
high_value_room_revisit_enabled: cfgPart.high_value_room_revisit_enabled,
|
||||
high_value_room_revisit_only_current_run: cfgPart.high_value_room_revisit_only_current_run,
|
||||
high_value_room_revisit_interval_seconds: cfgPart.high_value_room_revisit_interval_seconds,
|
||||
reservation_back_verify_enabled: cfgPart.reservation_back_verify_enabled,
|
||||
reservation_back_swipe_delay: cfgPart.reservation_back_swipe_delay,
|
||||
fudai_find_max_attempts: cfgPart.fudai_find_max_attempts,
|
||||
|
||||
Reference in new issue
Block a user