{
    "CreditShoppingShopping": {
        "desc": "信用购物",
        "recognition": "TemplateMatch",
        "roi": [
            813,
            44,
            293,
            82
        ],
        "template": "CreditShopping/CreditShoppingTabSelected.png",
        "threshold": 0.7,
        "post_wait_freezes": {
            "time": 200,
            "target": [
                52,
                98,
                1186,
                548
            ]
        },
        "next": [
            "CreditShoppingInit",
            "CreditShoppingScanItem"
        ]
    },
    "CreditShoppingInit": {
        "desc": "初始化信用购物参数（仅执行一次）",
        "max_hit": 1,
        "recognition": "DirectHit",
        "action": "Custom",
        "custom_action": "CreditShoppingParseParams",
        "next": [
            "CreditShoppingScanItem"
        ]
    },
    "CreditShoppingScanItem": {
        "recognition": "TemplateMatch",
        "roi": [
            813,
            44,
            293,
            82
        ],
        "template": "CreditShopping/CreditShoppingTabSelected.png",
        "threshold": 0.7,
        "next": [
            "AutoGetCredits",
            "CreditShoppingBuyPriority1",
            "CreditShoppingReserveCredit",
            "CreditShoppingBuyPriority2",
            "CreditShoppingBuyPriority3",
            "CreditShoppingRefreshCountReached",
            "CreditShoppingPrudentRefresh",
            "CreditShoppingBuyBlacklist",
            "RefreshGetCredits",
            "CreditShippingCanNotToBuy",
            "ADBSpecial",
            "RefreshItem",
            "CreditShoppingNothingToBuy"
        ]
    },
    "ADBSpecial": {
        "desc": "ADB特殊流程,向上滑动一段",
        "enabled": false,
        "action": {
            "type": "Swipe",
            "param": {
                "begin": [
                    640,
                    500
                ],
                "end": [
                    640,
                    300
                ],
                "duration": 500
            }
        },
        "next": [
            "AutoGetCredits",
            "CreditShoppingBuyPriority1",
            "CreditShoppingReserveCredit",
            "CreditShoppingBuyPriority2",
            "CreditShoppingBuyPriority3",
            "CreditShoppingRefreshCountReached",
            "CreditShoppingPrudentRefresh",
            "CreditShoppingBuyBlacklist",
            "RefreshGetCredits",
            "CreditShippingCanNotToBuy",
            "RefreshItem",
            "CreditShoppingNothingToBuy"
        ]
    },
    "CreditShippingCanNotToBuy": {
        "desc": "刷新流程中无法购买（选项：没有可购买物品时=执行刷新）",
        "enabled": false,
        "recognition": "Or",
        "any_of": [
            "AutoGetCredits",
            "CanNotFlash"
        ],
        "focus": {
            "Node.Action.Succeeded": "$task.CreditShopping.refresh_no_credit"
        }
    },
    "RefreshItem": {
        "desc": "刷新商品（选项：没有可购买物品时=执行刷新）",
        "enabled": false,
        "recognition": "And",
        "all_of": [
            "RefreshText"
        ],
        "action": "Click",
        "post_wait_freezes": {
            "time": 500,
            "timeout": 2000,
            "target": [
                66,
                97,
                1153,
                544
            ]
        },
        "next": [
            "CreditShoppingShopping",
            "[JumpBack]YellowConfirmButtonType1"
        ],
        "focus": {
            "Node.Action.Succeeded": "刷新商品"
        }
    },
    "CreditShoppingReserveCredit": {
        "desc": "信用点低于保留阈值（选项：保留信用点阈值）",
        "recognition": {
            "type": "Custom",
            "param": {
                "custom_recognition": "ExpressionRecognition",
                "custom_recognition_param": {
                    "expression": "{CreditShoppingReserveCreditOCRInternal}<300"
                }
            }
        },
        "focus": {
            "Node.Recognition.Succeeded": "$task.CreditShopping.reserve_credit_reached"
        }
    },
    "CreditShoppingReserveCreditOCRInternal": {
        "desc": "识别当前信用点",
        "recognition": "OCR",
        "roi": [
            1123,
            21,
            38,
            17
        ],
        "expected": "^\\d+$",
        "only_rec": true,
        "color_filter": "CreditShoppingReserveCreditOCRInternalColor"
    },
    "CreditShoppingReserveCreditOCRInternalColor": {
        "recognition": {
            "type": "ColorMatch",
            "param": {
                "roi": [
                    1083,
                    17,
                    114,
                    27
                ],
                "method": 6,
                "lower": [
                    198
                ],
                "upper": [
                    255
                ]
            }
        }
    },
    "AutoGetCredits": {
        "desc": "白名单物品买不起时自动去基建获取（选项：获取信用点）",
        "max_hit": 1,
        "recognition": "Or",
        "any_of": [
            "AutoGetCreditsBuyPriority1"
        ],
        "next": [
            "GoToNeedCredit"
        ]
    },
    "RefreshGetCredits": {
        "desc": "刷新信用点不足触发获取信用点，默认关闭，由任务选项开启",
        "enabled": false,
        "max_hit": 1,
        "recognition": {
            "type": "And",
            "param": {
                "all_of": [
                    "CanNotFlash"
                ]
            }
        },
        "next": [
            "GoToNeedCredit"
        ]
    },
    "GoToNeedCredit": {
        "max_hit": 1,
        "next": [
            "[JumpBack]NeedCredit",
            "CreditShoppingShopping",
            "CreditShoppingCheckShopPage",
            "[JumpBack]SceneEnterMenuShop"
        ],
        "focus": {
            "Node.Action.Succeeded": "$task.CreditShopping.auto_get_credits"
        }
    },
    "AutoGetCreditsBuy": {
        "recognition": "Or",
        "any_of": [
            "AutoGetCreditsBuyPriority1",
            "AutoGetCreditsBuyPriority2",
            "AutoGetCreditsBuyPriority3"
        ]
    },
    "AutoGetCreditsBuyPriority1": {
        "recognition": "And",
        "all_of": [
            "CreditIcon",
            "NotSoldOut",
            "CanNotAfford",
            "BuyFirstOCR_CanNotAfford",
            "IsDiscountPriority1_CanNotAfford"
        ],
        "box_index": 4
    },
    "AutoGetCreditsBuyPriority2": {
        "recognition": "And",
        "all_of": [
            "CreditIcon",
            "NotSoldOut",
            "CanNotAfford",
            "Priority2OCR_CanNotAfford",
            "IsDiscountPriority2_CanNotAfford"
        ],
        "box_index": 4
    },
    "AutoGetCreditsBuyPriority3": {
        "recognition": "And",
        "all_of": [
            "CreditIcon",
            "NotSoldOut",
            "CanNotAfford",
            "Priority3OCR_CanNotAfford",
            "IsDiscountPriority3_CanNotAfford"
        ],
        "box_index": 4
    },
    "CreditShoppingBuyPriority1": {
        "desc": "优先购买（选项：优先购买物品、折扣设置；不遵守保留信用点阈值）",
        "recognition": "And",
        "all_of": [
            "CreditIcon",
            "NotSoldOut",
            "CanAfford",
            "BuyFirstOCR",
            "IsDiscountPriority1"
        ],
        "box_index": 4,
        "pre_wait_freezes": 100,
        "action": "Click",
        "target_offset": [
            -30,
            70,
            0,
            0
        ],
        "next": [
            "CreditShoppingBuyItem"
        ]
    },
    "CreditShoppingBuyPriority2": {
        //"enabled": false,
        "desc": "普通购买1（选项：普通购买1物品、折扣设置；遵守保留信用点阈值）",
        "recognition": "And",
        "all_of": [
            "CreditIcon",
            "NotSoldOut",
            "CanAfford",
            "Priority2OCR",
            "IsDiscountPriority2"
        ],
        "box_index": 4,
        "pre_wait_freezes": 100,
        "action": "Click",
        "target_offset": [
            -30,
            70,
            0,
            0
        ],
        "next": [
            "CreditShoppingBuyItem"
        ]
    },
    "CreditShoppingBuyPriority3": {
        "desc": "普通购买2（选项：普通购买2物品、折扣设置；遵守保留信用点阈值）",
        "recognition": "And",
        "all_of": [
            "CreditIcon",
            "NotSoldOut",
            "CanAfford",
            "Priority3OCR",
            "IsDiscountPriority3"
        ],
        "box_index": 4,
        "pre_wait_freezes": 100,
        "action": "Click",
        "target_offset": [
            -30,
            70,
            0,
            0
        ],
        "next": [
            "CreditShoppingBuyItem"
        ]
    },
    "CreditShoppingBuyBlacklist": {
        "desc": "强制购买剩余可购物品（选项：信用点低于刷新阈值后操作=购买黑名单物品）",
        "recognition": "And",
        "all_of": [
            "CreditIcon",
            "NotSoldOut",
            "CanAfford"
        ],
        "box_index": 2,
        "pre_wait_freezes": 100,
        "action": "Click",
        "next": [
            "CreditShoppingBuyItem"
        ]
    },
    "CreditShoppingPrudentRefresh": {
        "desc": "稳健模式下改为直接购买（选项：稳健模式刷新、稳健刷新阈值）",
        "recognition": {
            "type": "And",
            "param": {
                "all_of": [
                    {
                        "recognition": {
                            "type": "Custom",
                            "param": {
                                "custom_recognition": "ExpressionRecognition",
                                "custom_recognition_param": {
                                    "expression": "{CreditShoppingReserveCreditOCRInternal}-{RefreshCost}<400"
                                }
                            }
                        }
                    },
                    {
                        "recognition": {
                            "type": "And",
                            "param": {
                                "all_of": [
                                    "CreditIcon",
                                    "NotSoldOut",
                                    "CanAfford"
                                ],
                                "box_index": 2
                            }
                        }
                    }
                ],
                "box_index": 1
            }
        },
        "pre_wait_freezes": 100,
        "action": {
            "type": "Click"
        },
        "next": [
            "CreditShoppingBuyItem"
        ],
        "focus": {
            "Node.Recognition.Succeeded": "$task.CreditShopping.prudent_refresh_triggered"
        }
    },
    "CreditShoppingRefreshCountReached": {
        "desc": "刷新次数已用尽时直接购买（选项：没有可购买物品时=执行刷新）",
        "recognition": {
            "type": "And",
            "param": {
                "all_of": [
                    {
                        "recognition": {
                            "type": "OCR",
                            "param": {
                                "roi": [
                                    885,
                                    535,
                                    395,
                                    185
                                ],
                                "expected": [
                                    "今日刷新次数已用尽"
                                ]
                            }
                        }
                    },
                    {
                        "recognition": {
                            "type": "And",
                            "param": {
                                "all_of": [
                                    "CreditIcon",
                                    "NotSoldOut",
                                    "CanAfford"
                                ],
                                "box_index": 2
                            }
                        }
                    }
                ],
                "box_index": 1
            }
        },
        "pre_wait_freezes": 100,
        "action": {
            "type": "Click"
        },
        "next": [
            "CreditShoppingBuyItem"
        ],
        "focus": {
            "Node.Recognition.Succeeded": "$task.CreditShopping.refresh_count_reached_triggered"
        }
    },
    "CreditShoppingNothingToBuy": {
        "desc": "没有合适的东西可以买了",
        "recognition": "DirectHit",
        "focus": {
            "Node.Recognition.Succeeded": "$task.CreditShopping.nothing_to_buy"
        }
    }
}
