Genshin Impact Вики
Genshin Impact Вики
1642
страницы

Для документации этого модуля может быть создана страница Модуль:WeaponScaling/doc

--Tables
local h = {}
local p = {}

local value
function p.fGetScaledATK(frame)
    local baseATK = frame.args[1] or frame.args["АТК"]
    local level = frame.args[2] or frame.args["Уровень"]
    local state = frame.args[3] or frame.args["Состояние"]
    local dataLoad = require("Module:WeaponScaling/DataATK")
    local tableATK = mw.loadData("Module:WeaponScaling/DataATK")
    local selector = tableATK[baseATK]
    --check if the base Atk is found in data table, if not return error message
    if (tableATK[baseATK] ~= nil) then
       selector = tableATK[baseATK]
    else
        value = "Неверное значение АТК"
        return value
    end
    value = selector[level .. string.sub(state,1,1)]
    return value
end
function p.fGet2ndStat(frame)
    local base2ndStat = frame.args[1] or frame.args["Доп_хар"]
    local level = frame.args[2] or frame.args["Уровень"]
    level = tonumber(level)
    if not (type(level) == "number") then
        value = "argument #2 (level): expected number, got " .. type(level) .. " " .. level
        return value
    end
    local dataLoad = require("Module:WeaponScaling/Data2ndStat")
    local table2ndStat = mw.loadData("Module:WeaponScaling/Data2ndStat")
    local selector
    --check if the base secondary stat is found in data table, if not return error message
    if (table2ndStat[base2ndStat] ~= nil) then
       selector = table2ndStat[base2ndStat]
    else
        value = "Неверное значение Доп_хар"
        return value
    end
    if level == 20 then
        value = selector.Lv20
    elseif level == 40 then
        value = selector.Lv40
    elseif level == 50 then
        value = selector.Lv50
    elseif level == 60 then
        value = selector.Lv60
    elseif level == 70 then
        value = selector.Lv70
    elseif level == 80 then
        value = selector.Lv80
    elseif level == 90 then
        value = selector.Lv90
    else value = "Неверное значение Уровень"
    end
    return value
end
--If anything goes wrong just return a general error message, specfic error messages can be made later.
function p.getScaledATK(frame)
    if pcall(fGetScaledATK, frame) then
        print("Success")
    else
        value = "Unkown (Lookup Error)"
        return value
    end
end

return p