------------------------------------------------
-- Japanese localization for DailyAlchemy
------------------------------------------------

ZO_CreateStringId("DA_CRAFTING_QUEST",      "炼金术士.*委托")   -- [zh.lang.csv] "52420949","0","5415","xxxxxxxx"
ZO_CreateStringId("DA_CRAFTING_MASTER",     "完美无缺的调和物") -- [zh.lang.csv] "52420949","0","5980","xxxxxxxx"
ZO_CreateStringId("DA_CRAFTING_WITCH",      "女巫集会委托")     -- [zh.lang.csv] "52420949","0","6427","xxxxxxxx"

ZO_CreateStringId("DA_BULK_HEADER",         "批量创建")
ZO_CreateStringId("DA_BULK_FLG",            "创建一批请购单")
ZO_CreateStringId("DA_BULK_FLG_TOOLTIP",    "例如，当你想创建大量要求的项目时，就会用到这个方法。")
ZO_CreateStringId("DA_BULK_COUNT",          "创建数量")
ZO_CreateStringId("DA_BULK_COUNT_TOOLTIP",  "在实践中，创造出来的东西比这个数量多。 (取决于炼金术技能）。")

ZO_CreateStringId("DA_CRAFT_WRIT",          "创建一个委托")
ZO_CreateStringId("DA_CRAFT_WRIT_MSG",      "在访问炼金术表时 <<1>>")
ZO_CreateStringId("DA_CANCEL_WRIT",         "取消创建一个请求")
ZO_CreateStringId("DA_CANCEL_WRIT_MSG",     "取消了该委员会的设立")

ZO_CreateStringId("DA_PRIORITY_HEADER",     "样品的优先权")
ZO_CreateStringId("DA_PRIORITY_BY",         "要使用的样品的优先权")
ZO_CreateStringId("DA_PRIORITY_BY_STOCK",   "库存过多")
ZO_CreateStringId("DA_PRIORITY_BY_MM",      "低价[MasterMerchant]")
ZO_CreateStringId("DA_PRIORITY_BY_TTC",     "低价[TamrielTradeCentre]")
ZO_CreateStringId("DA_PRIORITY_BY_ATT",     "低价[ArkadiusTradeTools]")
ZO_CreateStringId("DA_PRIORITY_BY_MANUAL",  "手动配置")
ZO_CreateStringId("DA_SHOW_PRICE_MANUAL",   "显示价格[<<1>>]")
ZO_CreateStringId("DA_PRIORITY_CHANGED",    "由于<<2>>已被关闭，附加元件设置[<<1>>]已发生变化。")

ZO_CreateStringId("DA_OTHER_HEADER",        "其他")
ZO_CreateStringId("DA_ACQUIRE_ITEM",        "从银行中取出物品")
ZO_CreateStringId("DA_DELAY",               "延迟时间")
ZO_CreateStringId("DA_DELAY_TOOLTIP",       "检索项目时的延迟时间\n如果项目不能成功检索，请增加这个时间。")
ZO_CreateStringId("DA_AUTO_EXIT",           "自动退出生产菜单")
ZO_CreateStringId("DA_AUTO_EXIT_TOOLTIP",   "自动创建完成后，从生产菜单中退出。")
ZO_CreateStringId("DA_ITEM_LOCK",           "被锁的物品将不会被使用")
ZO_CreateStringId("DA_LOG",                 "查看日志")
ZO_CreateStringId("DA_DEBUG_LOG",           "查看调试日志")

ZO_CreateStringId("DA_NOTHING_ITEM",        "背包里没有物品 (<<1>>)")
ZO_CreateStringId("DA_SHORT_OF",            "... 材料不充分(<<1>>)")
ZO_CreateStringId("DA_MISMATCH_ITEM",       "... [Error]名称不匹配 (<<1>>)")

ZO_CreateStringId("DA_HEALTH",              "回复生命")     -- Restore Health        [zh.lang.csv] "156152165","0","1","xxxxxxxx"
ZO_CreateStringId("DA_RVG_HEALTH",          "损害生命")     -- Ravage Health         [zh.lang.csv] "156152165","0","2","xxxxxxxx"
ZO_CreateStringId("DA_MAGICKA",             "回复魔力")     -- Restore Magicka       [zh.lang.csv] "156152165","0","3","xxxxxxxx"
ZO_CreateStringId("DA_RVG_MAGICKA",         "损害魔力")     -- Ravage Magicka        [zh.lang.csv] "156152165","0","4","xxxxxxxx"
ZO_CreateStringId("DA_STAMINA",             "回复耐力")     -- Restore Stamina       [zh.lang.csv] "156152165","0","5","xxxxxxxx"
ZO_CreateStringId("DA_RVG_STAMINA",         "损害耐力")     -- Ravage Stamina        [zh.lang.csv] "156152165","0","6","xxxxxxxx"
ZO_CreateStringId("DA_SPELL_RESIST",        "提高法术抗性") -- Increase Spell Resist [zh.lang.csv] "156152165","0","7","xxxxxxxx"
ZO_CreateStringId("DA_BREACH",              "破甲")         -- Breach                [zh.lang.csv] "156152165","0","8","xxxxxxxx"
ZO_CreateStringId("DA_ARMOR",               "提高盔甲")     -- Increase Armor        [zh.lang.csv] "156152165","0","9","xxxxxxxx"
ZO_CreateStringId("DA_FRACTURE",            "断裂")         -- Fracture              [zh.lang.csv] "156152165","0","10","xxxxxxxx"
ZO_CreateStringId("DA_SPELL_POWER",         "提高法术威力") -- Increase Spell Power  [zh.lang.csv] "156152165","0","11","xxxxxxxx"
ZO_CreateStringId("DA_COWARDICE",           "怯懦")         -- Cowardice             [zh.lang.csv] "156152165","0","12","xxxxxxxx"
ZO_CreateStringId("DA_WEAPON_POWER",        "提高武器威力") -- Increase Weapon Power [zh.lang.csv] "156152165","0","13","xxxxxxxx"
ZO_CreateStringId("DA_MAIM",                "致残")         -- Maim                  [zh.lang.csv] "156152165","0","14","xxxxxxxx"
ZO_CreateStringId("DA_SPELL_CRIT",          "法术暴击")     -- Spell Critical        [zh.lang.csv] "156152165","0","15","xxxxxxxx"
ZO_CreateStringId("DA_UNCERTAINTY",         "混乱")         -- Uncertainty           [zh.lang.csv] "156152165","0","16","xxxxxxxx"
ZO_CreateStringId("DA_WEAPON_CRIT",         "武器暴击")     -- Weapon Critical       [zh.lang.csv] "156152165","0","17","xxxxxxxx"
ZO_CreateStringId("DA_ENERVATE",            "虚弱")         -- Enervation            [zh.lang.csv] "156152165","0","18","xxxxxxxx"
ZO_CreateStringId("DA_UNSTOP",              "势不可挡")     -- Unstoppable           [zh.lang.csv] "156152165","0","19","xxxxxxxx"
ZO_CreateStringId("DA_ENTRAPMENT",          "诱捕")         -- Entrapment            [zh.lang.csv] "156152165","0","20","xxxxxxxx"
ZO_CreateStringId("DA_DETECTION",           "侦测")         -- Detection             [zh.lang.csv] "156152165","0","21","xxxxxxxx"
ZO_CreateStringId("DA_INVISIBLE",           "隐形")         -- Invisible             [zh.lang.csv] "156152165","0","22","xxxxxxxx"
ZO_CreateStringId("DA_SPEED",               "速度")         -- Speed                 [zh.lang.csv] "156152165","0","23","xxxxxxxx"
ZO_CreateStringId("DA_HINDRANCE",           "阻碍")         -- Hindrance             [zh.lang.csv] "156152165","0","24","xxxxxxxx"
ZO_CreateStringId("DA_PROTECTION",          "保护")         -- Protection            [zh.lang.csv] "156152165","0","25","xxxxxxxx"
ZO_CreateStringId("DA_VULNERABILITY",       "脆弱")         -- Vulnerability         [zh.lang.csv] "156152165","0","26","xxxxxxxx"
ZO_CreateStringId("DA_LGR_HEALTH",          "绵长生命")     -- Lingering Health      [zh.lang.csv] "156152165","0","27","xxxxxxxx"
ZO_CreateStringId("DA_GR_RVG_HEALTH",       "渐进生命损害") -- Gradual Ravage Health [zh.lang.csv] "156152165","0","28","xxxxxxxx"
ZO_CreateStringId("DA_VITALITY",            "活力")         -- Vitality              [zh.lang.csv] "156152165","0","29","xxxxxxxx"
ZO_CreateStringId("DA_DEFILE",              "亵渎")         -- Defile                [zh.lang.csv] "156152165","0","30","xxxxxxxx"
ZO_CreateStringId("DA_HEROISM",             "英勇")         -- Heroism               [zh.lang.csv] "156152165","0","31","xxxxxxxx"
ZO_CreateStringId("DA_TIMIDITY",            "胆怯")         -- Timidity              [zh.lang.csv] "156152165","0","32","xxxxxxxx"




function DailyAlchemy:AcquireConditions()
    local list = {
        "获得.*%[(.*)%]",
        "获得(.*)",
        "获取(.*)",
    }
    return list
end




function DailyAlchemy:ConvertedItemNames(itemName)
    local list = {
        {"(\-)",    "(\-)"},
        {" ",       " "},   -- code(0xA0) > space(0x20): HTML non-breaking space ?("0xC2 0xA0")
        {"(\^).*",  ""},
        {"IX$",     "Ⅸ"},
        {"VIII$",   "Ⅷ"},
        {"VII$",    "Ⅶ"},
        {"VI$",     "Ⅵ"},
        {"IV$",     "Ⅳ"},
        {"V$",      "Ⅴ"},
        {"III$",    "Ⅲ"},
        {"II$",     "Ⅱ"},
        {"I$",      "Ⅰ"},
    }
    for _, value in ipairs(list) do
        itemName = string.gsub(itemName, value[1], value[2])
    end


    local list2 = {
        -- Master Writ
        {"提高盔甲",        "提高护甲"},            -- Increase Armor        [zh.lang.csv] "156152165","0","9","xxxxxxxx"
        {"胆怯毒药Ⅸ",      "怯懦毒药Ⅸ"},          -- 制作一个胆怯毒药IX，具有以下属性：怯懦，提高法术抗性，回复生命"

        -- Dayly
        {"纯净水",          "本源水"},              -- "7949764","0","44973","xxxxxxxx","获得本源水。
        {"净水",            "净化水"},              -- "7949764","0","44982","xxxxxxxx","获得净化水。"
        {"云雾",            "云雾溶剂"},            -- "7949764","0","44983","xxxxxxxx","获得云雾溶剂。"

        {"一点损害耐力",    "初级耐力损耗药水"},    -- "7949764","0","44969","xxxxxxxx","制作初级耐力损耗药水。"
        {"一点生命",        "一瓶生命药水",         -- "7949764","0","45142","xxxxxxxx","制作一瓶生命药水"
                            "初级生命药水"},        -- "7949764","0","44915","xxxxxxxx","制作初级生命药水"
        {"一点魔力",        "初级魔力药水"},        -- "7949764","0","44933","xxxxxxxx","制作初级魔力药水"
        {"一点耐力",        "初级耐力药水"},        -- "7949764","0","44951","xxxxxxxx","制作初级耐力药水"

        {"灵药损害魔力",    "灵药魔力损耗药水"},    -- "7949764","0","44978","xxxxxxxx","制作灵药魔力损耗药水。"
        {"灵药生命",        "灵药生命药水"},        -- "7949764","0","44923","xxxxxxxx","制作灵药生命药水"
        {"灵药魔力",        "灵药魔力药水"},        -- "7949764","0","44942","xxxxxxxx","制作灵药魔力药水"
        {"灵药耐力",        "灵药耐力药水"},        -- "7949764","0","44960","xxxxxxxx","制作灵药耐力药水"

        {"微量损害魔力",    "微量魔力损耗药水"},    -- "7949764","0","44972","xxxxxxxx","制作微量魔力损耗药水。"
        {"微量生命",        "微量生命药水"},        -- "7949764","0","44918","xxxxxxxx","制作微量生命药水"
        {"微量魔力",        "微量魔力药水"},        -- "7949764","0","44936","xxxxxxxx","制作微量魔力药水"
        {"微量耐力",        "微量耐力药水"},        -- "7949764","0","44954","xxxxxxxx","制作微量耐力药水"

        {"损害生命药水",    "生命损耗药水"},        -- "7949764","0","44974","xxxxxxxx","制作生命损耗药水。"
        {"损害魔力溶剂"},                           -- Need data.(Not Delete!)
        {"损害耐力溶剂"},                           -- Need data.(Not Delete!)
        {"生命药水",        "生命药水"},            -- "7949764","0","44926","xxxxxxxx","制作生命药水"
        {"魔力药水",        "魔力药水"},            -- "7949764","0","44938","xxxxxxxx","制作魔力药水"
        {"耐力药水",        "耐力药水"},            -- "7949764","0","44956","xxxxxxxx","制作耐力药水"

        {"损害耐力溶剂",    "强效耐力损耗药水"},    -- "7949764","0","44976","xxxxxxxx","制作强效耐力损耗药水。"
        {"生命溶剂",        "强效生命药水"},        -- "7949764","0","44921","xxxxxxxx","制作强效生命药水"
        {"魔力溶剂",        "强效魔力药水"},        -- "7949764","0","44940","xxxxxxxx","制作强效魔力药水"
        {"耐力溶剂",        "强效耐力药水"},        -- "7949764","0","44958","xxxxxxxx","制作强效耐力药水"

        {"灵药损害魔力",    "灵药魔力损耗药水"},    -- "7949764","0","44978","xxxxxxxx","制作灵药魔力损耗药水。"
        {"灵药魔力",        "灵药魔力药水"},        -- "7949764","0","44942","xxxxxxxx","制作灵药魔力药水"
        {"灵药耐力",        "灵药耐力药水"},        -- "7949764","0","44960","xxxxxxxx","制作灵药耐力药水"

        {"蒸馏物缓慢生命损害"},                     -- Need data.(Not Delete!)
        {"蒸馏物绵长生命"},                         -- Need data.(Not Delete!)
        {"蒸馏物损害生命"},                         -- Need data.(Not Delete!)
        {"蒸馏物损害魔力"},                         -- Need data.(Not Delete!)
        {"蒸馏物损害耐力"},                         -- Need data.(Not Delete!)
        {"蒸馏物生命"},                             -- Need data.(Not Delete!)
        {"蒸馏物魔力"},                             -- Need data.(Not Delete!)
        {"蒸馏物耐力"},                             -- Need data.(Not Delete!)

        {"损害生命",        "万能生命损耗药水"},    -- "7949764","0","44981","xxxxxxxx","制作万能生命损耗药水。"
        {"损害魔力"},                               -- Need data.(Not Delete!)
        {"损害耐力"},                               -- Need data.(Not Delete!)
        {"生命",            "万能生命药水"},        -- "7949764","0","44927","xxxxxxxx","制作万能生命药水"
        {"魔力",            "万能魔力药水"},        -- "7949764","0","44945","xxxxxxxx","制作万能魔力药水"
        {"耐力",            "万能耐力药水"},        -- "7949764","0","44963","xxxxxxxx","制作万能耐力药水"

      --{"",                "生命吸取毒药"},        -- "7949764","0","56972","xxxxxxxx","体力吸収の毒9を生産する"            "7949764","0","56972","xxxxxxxx","制作生命吸取毒药IX"
        {"体力流失毒药Ⅸ",  "生命流失毒药Ⅸ"},      -- "7949764","0","56981","xxxxxxxx","制作生命流失毒药IX"
        {"法力流失毒药Ⅸ",  "魔力流失毒药Ⅸ"},      -- "7949764","0","56978","xxxxxxxx","制作魔力流失毒药IX"
        {"耐力流失毒药Ⅸ",  "耐力流失毒药Ⅸ"},      -- "7949764","0","56975","xxxxxxxx","制作耐力流失毒药IX"

        {"损害生命精华",    "精华生命损耗药水",     -- "7949764","0","47337","xxxxxxxx","制作精华生命损耗药水。"
                            "损耗生命精华药水"},    -- "7949764","0","56962","xxxxxxxx","制作损耗生命精华药水"
        {"精华生命",        "精华生命药水",         -- "7949764","0","47328","xxxxxxxx","制作精华生命药水"
                            "生命精华药水"},        -- "7949764","0","56969","xxxxxxxx","制作生命精华药水"
      --{"",                "魔力精华药水",         -- "7949764","0","56966","xxxxxxxx","マジカのエキスを生産する"           "7949764","0","56966","xxxxxxxx","制作魔力精华药水"
      --                    "精华魔力药水"},        -- "7949764","0","47332","xxxxxxxx","マジカのエキスを生産する"           "7949764","0","47332","xxxxxxxx","制作精华魔力药水"
      --{"",                "精华耐力药水",         -- "7949764","0","47334","xxxxxxxx","スタミナのエキスを生産する"         "7949764","0","47334","xxxxxxxx","制作精华耐力药水"
      --                    "耐力精华药水"},        -- "7949764","0","56963","xxxxxxxx","スタミナのエキスを生産する"         "7949764","0","56963","xxxxxxxx","制作耐力精华药水"
    }
    table.sort(list2, function(valueA, valueB)
        return string.len(valueA[1]) > string.len(valueB[1])
    end)

    for _, value in ipairs(list2) do
        if string.match(itemName, value[1]) then
            if value[3] then
                return {itemName, value[2], value[3]}
            elseif value[2] then
                return {itemName, value[2]}
            else
                return {itemName}
            end
        end
    end
    return {itemName}
end




function DailyAlchemy:ConvertedJournalCondition(journalCondition)
    local list = {
        {" ",  " "},   -- code(0xA0) > space(0x20): HTML non-breaking space ?("0xC2 0xA0")
        {"%-", " "},
        {"IX：",   "Ⅸ:"},
        {"IX:",    "Ⅸ:"},
        {"IX，",   "Ⅸ:"},
        {"VIII：", "Ⅷ:"},
        {"VIII，", "Ⅷ:"},
        {"VII：",  "Ⅶ:"},
        {"VII，",  "Ⅶ:"},
        {"VI：",   "Ⅵ:"},
        {"VI，",   "Ⅵ:"},
        {"IV：",   "Ⅳ:"},
        {"IV，",   "Ⅳ:"},
        {"V：",    "Ⅴ:"},
        {"V，",    "Ⅴ:"},
        {"III：",  "Ⅲ:"},
        {"III，",  "Ⅲ:"},
        {"II：",   "Ⅱ:"},
        {"II，",   "Ⅱ:"},
        {"I：",    "Ⅰ:"},
        {"I，",    "Ⅰ:"},
    }
    for _, value in ipairs(list) do
        journalCondition = string.gsub(journalCondition, value[1], value[2])
    end


    local list2 = {
        -- Master Writ
        {".*制作一个(胆怯毒药Ⅸ):具有以下属性：(怯懦，提高法术抗性，回复生命)",         "制作 |c88AAFF[怯懦毒药Ⅸ]|r|cFFFFFF...%2|r"},          -- Bug?
        {".*制作一个(胆怯毒药Ⅸ).*具有以下属性.*(怯懦).*(提高法术抗性).*(回复生命).*",  "制作 |c88AAFF[怯懦毒药Ⅸ]|r|cFFFFFF...%2, %3, %4|r"},  -- Bug?
        {".*制作一个(.*):具有以下属性.*%c• (.*)%c• (.*)%c• (.*)%c.*",            "制作 |c88AAFF[%1]|r|cFFFFFF...%2, %3, %4|r"},
        {".*制作一个(.*)，具有以下属性.*%c• (.*)%c• (.*)%c• (.*)%c.*",           "制作 |c88AAFF[%1]|r|cFFFFFF...%2, %3, %4|r"},
        {".*制作一个(.*):.*具有以下属性：(.*)",                                  "制作 |c88AAFF[%1]|r|cFFFFFF...%2|r"},
        {".*制作一个(.*)，.*具有以下属性：(.*)",                                 "制作 |c88AAFF[%1]|r|cFFFFFF...%2|r"},

        -- Dayly
        {".*制作(.*)。：.*",        "制作 |c88AAFF[%1]|r"},
        {".*制作(.*)。:.*",         "制作 |c88AAFF[%1]|r"},
        {".*制作(.*)：.*",          "制作 |c88AAFF[%1]|r"},
        {".*制作(.*):.*",           "制作 |c88AAFF[%1]|r"},
        {".*制作(.*)",              "制作 |c88AAFF[%1]|r"},
        {".*制作(魔力药水)：.*",    "制作 |c88AAFF[%1]|r"},

        {".*获得(.*)。：.*",        "获得 |c88AAFF[%1]|r"},
        {".*获得(.*)：.*",          "获得 |c88AAFF[%1]|r"},
        {".*获得(.*):.*",           "获得 |c88AAFF[%1]|r"},
        {".*获取(.*)：.*",          "获得 |c88AAFF[%1]|r"},
        {".*获取(.*):.*",           "获得 |c88AAFF[%1]|r"},
    }
    for _, value in ipairs(list2) do
        if string.match(journalCondition, value[1]) then
            return string.gsub(journalCondition, value[1], value[2])
        end
    end
    return journalCondition
end

function DailyAlchemy:CraftingConditions()
    local list = {
        "制作",
    }
    return list
end

function DailyAlchemy:isPoison(conditionText)
    return string.match(conditionText, "毒药")
end

function DailyAlchemy:isAlchemy(journalCondition)
    local list = {
        "制作一个.*，具有以下属性：.*进度", -- SI_MASTER_WRIT_QUEST_ALCHEMY_FORMAT_STRING
        "铁匠商人会出售这份图纸.*",         -- [zh.lang.csv] "7949764","0","61966","xxxxxxxx"
        "制衣匠商人会出售这个图样.*",       -- [zh.lang.csv] "7949764","0","61968","xxxxxxxx"
        "地毯商人会出售这个蓝图.*",         -- [zh.lang.csv] "7949764","0","61970","xxxxxxxx"
        "木匠会出售这个图纸.*",             -- [zh.lang.csv] "7949764","0","68075","xxxxxxxx"
    }
    return self:Contains(journalCondition, list)
end

