------------------------------------------------     
-- German localization for DailyAlchemy
------------------------------------------------

ZO_CreateStringId("DA_CRAFTING_QUEST",      "Alchemistenschrieb")       -- [de.lang.csv] "52420949","0","5415","xxxxxxxx"
ZO_CreateStringId("DA_CRAFTING_MASTER",     "Ein meisterhaftes Gebräu") -- [de.lang.csv] "52420949","0","5980","xxxxxxxx"
ZO_CreateStringId("DA_CRAFTING_WITCH",      "Hexenfestschrieb")         -- [de.lang.csv] "52420949","0","6427","xxxxxxxx"

ZO_CreateStringId("DA_BULK_HEADER",         "Massenerstellung")
ZO_CreateStringId("DA_BULK_FLG",            "Créer de nombreux médicaments et poisons")
ZO_CreateStringId("DA_BULK_FLG_TOOLTIP",    "Es wird verwendet, wenn Sie eine große Anzahl angeforderter Elemente erstellen möchten.")
ZO_CreateStringId("DA_BULK_COUNT",          "Zu erstellende Menge")
ZO_CreateStringId("DA_BULK_COUNT_TOOLTIP",  "In der Tat wird es mehr als diese Menge erstellt werden.(Hängt von Alchemie-Fähigkeiten ab)")

ZO_CreateStringId("DA_CRAFT_WRIT",          "Craft Versiegelter Meisterschrieb")
ZO_CreateStringId("DA_CRAFT_WRIT_MSG",      "Beim Zugriff auf die Alchemietisch, <<1>>")
ZO_CreateStringId("DA_CANCEL_WRIT",         "Versiegelter Meisterschrieb abbrechen")
ZO_CreateStringId("DA_CANCEL_WRIT_MSG",     "Stornierte Versiegelter Meisterschrieb")

ZO_CreateStringId("DA_PRIORITY_HEADER",     "Priorität des Reagenzien")
ZO_CreateStringId("DA_PRIORITY_BY",         "Priorität des zu verwendenden Reagenzes")
ZO_CreateStringId("DA_PRIORITY_BY_STOCK",   "Viel Vorrat")
ZO_CreateStringId("DA_PRIORITY_BY_MM",      "Niedrigpreis-Reagenz bei [MasterMerchant]")
ZO_CreateStringId("DA_PRIORITY_BY_TTC",     "Niedrigpreis-Reagenz bei [TamrielTradeCentre]")
ZO_CreateStringId("DA_PRIORITY_BY_ATT",     "Niedrigpreis-Reagenz bei [ArkadiusTradeTools]")
ZO_CreateStringId("DA_PRIORITY_BY_MANUAL",  "Manuell einstellen")
ZO_CreateStringId("DA_SHOW_PRICE_MANUAL",   "Preis anzeigen[<<1>>]")
ZO_CreateStringId("DA_PRIORITY_CHANGED",    "Die Add-on-Einstellung [<<1>>] wurde geändert, weil <<2>> deaktiviert ist")

ZO_CreateStringId("DA_OTHER_HEADER",        "Andere")
ZO_CreateStringId("DA_ACQUIRE_ITEM",        "Gegenstände von der Bank abholen")
ZO_CreateStringId("DA_DELAY",               "Verzögerungszeit(Sekunden)")
ZO_CreateStringId("DA_DELAY_TOOLTIP",       "Verzögerungszeit zum Abrufen des Elements\nWenn Sie den Gegenstand nicht gut herausnehmen können, erhöhen Sie ihn.")
ZO_CreateStringId("DA_AUTO_EXIT",           "Automatischer Austritt aus dem Crafting-Fenster")
ZO_CreateStringId("DA_AUTO_EXIT_TOOLTIP",   "Automatischer Austritt aus dem Crafting-Fenster, wenn alles abgeschlossen ist.")
ZO_CreateStringId("DA_ITEM_LOCK",           "Verwenden Sie keine gesperrten Elemente")
ZO_CreateStringId("DA_LOG",                 "Protokoll anzeigen")
ZO_CreateStringId("DA_DEBUG_LOG",           "Debug-Protokoll anzeigen")

ZO_CreateStringId("DA_NOTHING_ITEM",        "Keine Gegenstände im Rucksack (<<1>>)")
ZO_CreateStringId("DA_SHORT_OF",            "... Mangel an Materialien(<<1>>)")
ZO_CreateStringId("DA_MISMATCH_ITEM",       "... [Fehler]Name des Artikels (<<1>>)")

ZO_CreateStringId("DA_HEALTH",              "Leben wiederherstellen")    -- Restore Health        [de.lang.csv] "156152165","0","1","xxxxxxxx"
ZO_CreateStringId("DA_RVG_HEALTH",          "Lebensverwüstung")          -- Ravage Health         [de.lang.csv] "156152165","0","2","xxxxxxxx"
ZO_CreateStringId("DA_MAGICKA",             "Magicka wiederherstellen")  -- Restore Magicka       [de.lang.csv] "156152165","0","3","xxxxxxxx"
ZO_CreateStringId("DA_RVG_MAGICKA",         "Magickaverwüstung")         -- Ravage Magicka        [de.lang.csv] "156152165","0","4","xxxxxxxx"
ZO_CreateStringId("DA_STAMINA",             "Ausdauer wiederherstellen") -- Restore Stamina       [de.lang.csv] "156152165","0","5","xxxxxxxx"
ZO_CreateStringId("DA_RVG_STAMINA",         "Ausdauerverwüstung")        -- Ravage Stamina        [de.lang.csv] "156152165","0","6","xxxxxxxx"
ZO_CreateStringId("DA_SPELL_RESIST",        "Erhöht Magieresistenz")     -- Increase Spell Resist [de.lang.csv] "156152165","0","7","xxxxxxxx"
ZO_CreateStringId("DA_BREACH",              "Bruch")                     -- Breach                [de.lang.csv] "156152165","0","8","xxxxxxxx"
ZO_CreateStringId("DA_ARMOR",               "Erhöht Rüstung")            -- Increase Armor        [de.lang.csv] "156152165","0","9","xxxxxxxx"
ZO_CreateStringId("DA_FRACTURE",            "Fraktur")                   -- Fracture              [de.lang.csv] "156152165","0","10","xxxxxxxx"
ZO_CreateStringId("DA_SPELL_POWER",         "Erhöht Magiekraft")         -- Increase Spell Power  [de.lang.csv] "156152165","0","11","xxxxxxxx"
ZO_CreateStringId("DA_COWARDICE",           "Feigheit")                  -- Cowardice             [de.lang.csv] "156152165","0","12","xxxxxxxx"
ZO_CreateStringId("DA_WEAPON_POWER",        "Erhöht Waffenkraft")        -- Increase Weapon Power [de.lang.csv] "156152165","0","13","xxxxxxxx"
ZO_CreateStringId("DA_MAIM",                "Verkrüppeln")               -- Maim                  [de.lang.csv] "156152165","0","14","xxxxxxxx"
ZO_CreateStringId("DA_SPELL_CRIT",          "Kritische Magietreffer")    -- Spell Critical        [de.lang.csv] "156152165","0","15","xxxxxxxx"
ZO_CreateStringId("DA_UNCERTAINTY",         "Ungewissheit")              -- Uncertainty           [de.lang.csv] "156152165","0","16","xxxxxxxx"
ZO_CreateStringId("DA_WEAPON_CRIT",         "Kritische Waffentreffer")   -- Weapon Critical       [de.lang.csv] "156152165","0","17","xxxxxxxx"
ZO_CreateStringId("DA_ENERVATE",            "Schwäche")                  -- Enervation            [de.lang.csv] "156152165","0","18","xxxxxxxx"
ZO_CreateStringId("DA_UNSTOP",              "Sicherer Stand")            -- Unstoppable           [de.lang.csv] "156152165","0","19","xxxxxxxx"
ZO_CreateStringId("DA_ENTRAPMENT",          "Einfangen")                 -- Entrapment            [de.lang.csv] "156152165","0","20","xxxxxxxx"
ZO_CreateStringId("DA_DETECTION",           "Detektion")                 -- Detection             [de.lang.csv] "156152165","0","21","xxxxxxxx"
ZO_CreateStringId("DA_INVISIBLE",           "Unsichtbarkeit")            -- Invisible             [de.lang.csv] "156152165","0","22","xxxxxxxx"
ZO_CreateStringId("DA_SPEED",               "Tempo")                     -- Speed                 [de.lang.csv] "156152165","0","23","xxxxxxxx"
ZO_CreateStringId("DA_HINDRANCE",           "Einschränken")              -- Hindrance             [de.lang.csv] "156152165","0","24","xxxxxxxx"
ZO_CreateStringId("DA_PROTECTION",          "Schutz")                    -- Protection            [de.lang.csv] "156152165","0","25","xxxxxxxx"
ZO_CreateStringId("DA_VULNERABILITY",       "Verwundbarkeit")            -- Vulnerability         [de.lang.csv] "156152165","0","26","xxxxxxxx"
ZO_CreateStringId("DA_LGR_HEALTH",          "Beständige Heilung")        -- Lingering Health      [de.lang.csv] "156152165","0","27","xxxxxxxx"
ZO_CreateStringId("DA_GR_RVG_HEALTH",       "Langsame Lebensverwüstung") -- Gradual Ravage Health [de.lang.csv] "156152165","0","28","xxxxxxxx"
ZO_CreateStringId("DA_VITALITY",            "Vitalität")                 -- Vitality              [de.lang.csv] "156152165","0","29","xxxxxxxx"
ZO_CreateStringId("DA_DEFILE",              "Schänden")                  -- Defile                [de.lang.csv] "156152165","0","30","xxxxxxxx"
ZO_CreateStringId("DA_HEROISM",             "Heldentum")                 -- Heroism               [de.lang.csv] "156152165","0","31","xxxxxxxx"
ZO_CreateStringId("DA_TIMIDITY",            "Scheu")                     -- Timidity              [de.lang.csv] "156152165","0","32","xxxxxxxx"




function DailyAlchemy:AcquireConditions()
    local list = {
        "Beschafft%s.*%[(.*)%]",
        "Beschafft%s(.*)",
        "Besorgt%s%a*%s.*%[(.*)%]",
        "Besorgt%s%a*%s(.*)",
    }
    return list
end

function DailyAlchemy:ConvertedItemNames(itemName)

    local function Convert(inItemName)
        local inList = {
            {"(\^%a%a)$",   ""},
            {"(\^%a)$",     ""},
            {"(\^%a%a)\|",  ""},
            {"(\^%a)\|",    ""},
            {"ä",           "a"},
            {"ö",           "o"},
            {"ü",           "u"},
            {"(\-)",        "(\-)"},
            {" ",           " "},   -- NO-BREAK SPACE(U+00A0) to SPACE (U+0020)
            {" IX$",        " Ⅸ"},
            {" VIII$",      " Ⅷ"},
            {" VII$",       " Ⅶ"},
            {" VI$",        " Ⅵ"},
            {" IV$",        " Ⅳ"},
            {" V$",         " Ⅴ"},
            {" III$",       " Ⅲ"},
            {" II$",        " Ⅱ"},
            {" I$",         " Ⅰ"},
        }
        for _, value in ipairs(inList) do
            inItemName = string.gsub(inItemName, value[1], value[2])
        end
        return inItemName
    end


    local function Convert2(inItemName)
        local inList = {
            {"Elixier (de%w) (.*)",    "Elixiere %1 %2"},
            {"Essenz (de%w) (.*)",     "Essenzen %1 %2"},
            {"Losung (de%w) (.*)",     "Losungen %1 %2"},
            {"Panazee (de%w) (.*)",    "Panazeen %1 %2"},
            {"Schluck (de%w) (.*)",    "Schlucke %1 %2"},
            {"Trank (de%w) (.*)",      "Tranke %1 %2"},
        }
        for _, value in ipairs(inList) do
            if string.match(inItemName, value[1]) then
                return string.gsub(inItemName, value[1], value[2])
            end
        end
        return inItemName
    end


    if string.match(itemName, "(\|)") then
        local itemName1 = itemName:gsub("(\|)[%a%s%p]*", "")
        local itemName2 = itemName:gsub("[%a%s%p]*(\|)", "")
        local list = {}

        local convertedItemName1 = Convert2(itemName1)
        if convertedItemName1 == itemName1 then
            list[#list + 1] = itemName1
        else
            list[#list + 1] = convertedItemName1
            list[#list + 1] = itemName1
        end

        local convertedItemName2 = Convert2(itemName2)
        if convertedItemName2 == itemName2 then
            list[#list + 1] = itemName2
        else
            list[#list + 1] = convertedItemName2
            list[#list + 1] = itemName2
        end

        return list
    else
        itemName = Convert(itemName)
        local convertedItemName = Convert2(itemName)
        if convertedItemName == itemName then
            return {itemName}
        else
            return {itemName, convertedItemName}
        end
    end
end

function DailyAlchemy:ConvertedJournalCondition(journalCondition)
    local list = {
        {"ä",       "a"},
        {"ö",       "o"},
        {"ü",       "u"},
        {" ",       " "}, -- NO-BREAK SPACE(U+00A0) to SPACE (U+0020)
        {" IX ",    " Ⅸ "},
        {" VIII ",  " Ⅷ "},
        {" VII ",   " Ⅶ "},
        {" VI ",    " Ⅵ "},
        {" IV ",    " Ⅳ "},
        {" V ",     " Ⅴ "},
        {" III ",   " Ⅲ "},
        {" II ",    " Ⅱ "},
        {" I",      " Ⅰ "},
    }
    for _, value in ipairs(list) do
        journalCondition = string.gsub(journalCondition, value[1], value[2])
    end
    journalCondition = string.lower(journalCondition)


    local list2 = {
        -- Master Writ
        {".*stellt ein (.*) mit.*her.*%c• (.*)%c• (.*)%c• (.*)%c.*",    "Stellt |c88AAFF[%1]|r|cFFFFFF...%2, %3, %4|r"},
        {".*stellt ein (.*) mit.*her.*%c(.*)%c(.*)%c(.*)",              "Stellt |c88AAFF[%1]|r|cFFFFFF...%2, %3, %4|r"},
        {".*stellt (.*) mit.*her.*%c• (.*)%c• (.*)%c• (.*)%c• .*",      "Stellt |c88AAFF[%1]|r|cFFFFFF...%2, %3, %4|r"},
        {".*stellt (.*) mit.*her.*%c(.*)%c(.*)%c(.*)",                  "Stellt |c88AAFF[%1]|r|cFFFFFF...%2, %3, %4|r"},

        -- Dayly
        {".*stellt etwas (.*) her[:：].*",                              "Stellt |c88AAFF[%1]|r"},
        {".*stellt (.*) her [:：].*",                                   "Stellt |c88AAFF[%1]|r"},
        {".*stellt (.*) her[:：].*",                                    "Stellt |c88AAFF[%1]|r"},
        {".*beschafft eine (.*)[:：].*",                                "Beschafft |c88AAFF[%1]|r"}, 
        {".*beschafft (.*)[:：].*",                                     "Beschafft |c88AAFF[%1]|r"}, 
        {".*besorgt etwas (.*)[:：].*",                                 "Beschafft |c88AAFF[%1]|r"}, 
        {".*besorgt eine (.*)[:：].*",                                  "Beschafft |c88AAFF[%1]|r"}, 
        {".*besorgt ein (.*)[:：].*",                                   "Beschafft |c88AAFF[%1]|r"}, 
        {".*besorgt (.*)[:：].*",                                       "Beschafft |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 = {
        "Stellt",
    }
    return list
end

function DailyAlchemy:isPoison(conditionText)
    return string.match(conditionText, "[Gg]ift de")
end

function DailyAlchemy:isAlchemy(journalCondition)
    return string.match(journalCondition, "Stellt .* mit bestimmten Eigenschaften her")
end

