×
Create a new article
Write your page title here:
We currently have 1,396 articles on World Trigger Wiki. Type your article name above or create one of the articles listed here!



    World Trigger Wiki

    Module:Char Stat: Difference between revisions

    Content added Content deleted
    (Created page with "local Stat = {} Stat.__index = Stat function Stat:new(trion, attack, defense, mobility, skill, range, mechanical_operation, data_analysis, parallel_processing, tactics, command, special_tactics) local res = Stat setmetatable(res, Stat) res.trion = tonumber(trion) or 0 res.attack = tonumber(attack) or 0 res.defense = tonumber(defense) or 0 res.mobility = tonumber(mobility) or 0 res.skill = tonumber(skill) or 0 res.range = tonumber(rang...")
     
    No edit summary
     
    (29 intermediate revisions by 3 users not shown)
    Line 1:
    ---@type Util
    local util = require("Module:Util")
     
    ---@class Stat
    local Stat = {}
    Stat.__index = Stat
     
    function Stat:new(action_token, trion, attack, defense, mobility, skill, range, mechanical_operation, data_analysis,
    parallel_processing, tactics, command, special_tactics, position, listname, args)
    local res =---@class Stat
    setmetatable(local res, Stat)= {}
    setmetatable(res, self)
    Stat self.__index = Statself
    res.action_token = tonumber(action_token) or 0
    res.trion = tonumber(trion) or 0
    res.attack = tonumber(attack) or 0
    Line 18 ⟶ 24:
    res.command = tonumber(command) or 0
    res.special_tactics = tonumber(special_tactics) or 0
    res.position = position
    res.listname = tonumber(listname) or 0
    res.args = args or {db = "bbf"}
    return res
    end
     
    function Stat:.from_table(table)
    return Stat:.new(unpack(table[1], table[2]1, table[3], table[4], table[5], table[6], table[7],13))
    end
    table[8], table[9], table[10], table[11], table[12])
     
    function Stat:.from_data(path)
    ---@type CS_Stat
    local data = require("Module:Char Stat/data")
    local statsret = {}
    for _k, vt in ipairspairs(data) do
    ret[k] = Stat:new(t.action_token, t.trion, t.attack, t.defense, t.mobility, t.skill,
    t.range, t.mechanical_operation, t.data_analysis, t.parallel_processing, t.tactics, t.command,
    t.special_tactics, t.position, t.listname)
    end
    return statsret
    end
     
    function Stat.total(self)
    local ttotal = 0
    for _k, v in pairs(self) do
    if type(v) == "number" then
    tif self.position == t"Operator" and k ~= "trion" and k ~= +"listname" vthen
    i total = itotal + iv
    elseif self.position ~= "Operator" and k ~= "listname" then
    total = total + v
    end
    end
    end
    return ttotal
    end
     
    local utildata = requireStat.from_data("Module:Util")
     
    ---@param frame frame
    function Stat:from_frame.GetStat(frame)
    local args, _pargs = util.get_args_and_pargs(frame)
    return Stat:from_table(args)
    local name = args[1] or pargs[1] or ""
    name = name:gsub(" ", "_")
    local key = args[2] or pargs[2] or "total"
    ---@type Stat
    local ientry = 0data[name]
    local res = {}
    for _k, v in ipairspairs(dataentry) do
    if type(v) == "number" or type(v) == "string" then
    res[k] = v
    end
    end
    res.total = entry:total()
    return statsres[key]
    end
     
    ---@param pathframe stringframe
    function Stat:from_json.calcListName(pathself, frame)
    local statsp = {}tostring(self.listname)
    local dataargs = mwself.loadJsonData(path)args
    local iname = 0""
    if args.db then name = "bbf" .. p elseif args.c then name = "c" .. p end
    for _, v in ipairs(data) do
    args.name = name
    stats[i] = Stat:from_table(v)
    iargs.p = i + 1p
    return frame:expandTemplate{title = "ref", args = args}
    end
    return stats
    end
     
    ---@param frame frame
    function Stat:from_data(path)
    function Stat.calcChartName(self, frame)
    local stats = {}
    return "[[Border Briefing File]] Page " .. self.listname .. self:calcListName(frame)
    local data = mw.loadData(path)
    end
    local i = 0
     
    for _, v in ipairs(data) do
    ---@param frame frame
    stats[i] = Stat:from_table(v)
    function Stat.GetListName(frame)
    i = i + i
    local args, pargs = util.get_args_and_pargs(frame)
    end
    local name = args[1] or pargs[1] or ""
    return stats
    ---@type Stat
    local entry = data[name]
    return "[[" .. name .. "]]" .. entry:calcListName(frame)
    end
     
    ---@param frame frame
    function Stat.GetChartName(frame)
    local args, pargs = util.get_args_and_pargs(frame)
    local name = args[1] or pargs[1] or ""
    ---@type Stat
    local entry = data[name]
    return entry:calcChartName(frame)
    end
     

    Latest revision as of 20:11, May 21, 2024

    Documentation for this module may be created at Module:Char Stat/doc

    ---@type Util
    local util = require("Module:Util")
    
    ---@class Stat
    local Stat = {}
    
    function Stat:new(action_token, trion, attack, defense, mobility, skill, range, mechanical_operation, data_analysis,
        parallel_processing, tactics, command, special_tactics, position, listname, args)
        ---@class Stat
        local res = {}
        setmetatable(res, self)
        self.__index = self
        res.action_token = tonumber(action_token) or 0
        res.trion = tonumber(trion) or 0
        res.attack = tonumber(attack) or 0
        res.defense = tonumber(defense) or 0
        res.mobility = tonumber(mobility) or 0
        res.skill = tonumber(skill) or 0
        res.range = tonumber(range) or 0
        res.mechanical_operation = tonumber(mechanical_operation) or 0
        res.data_analysis = tonumber(data_analysis) or 0
        res.parallel_processing = tonumber(parallel_processing) or 0
        res.tactics = tonumber(tactics) or 0
        res.command = tonumber(command) or 0
        res.special_tactics = tonumber(special_tactics) or 0
        res.position = position
        res.listname = tonumber(listname) or 0
        res.args = args or {db = "bbf"}
        return res
    end
    
    function Stat.from_table(table)
        return Stat.new(unpack(table, 1, 13))
    end
    
    function Stat.from_data()
        ---@type CS_Stat
        local data = require("Module:Char Stat/data")
        local ret = {}
        for k, t in pairs(data) do
            ret[k] = Stat:new(t.action_token, t.trion, t.attack, t.defense, t.mobility, t.skill,
            t.range, t.mechanical_operation, t.data_analysis, t.parallel_processing, t.tactics, t.command,
            t.special_tactics, t.position, t.listname)
        end
        return ret
    end
    
    function Stat.total(self)
        local total = 0
        for k, v in pairs(self) do
            if type(v) == "number" then
                if self.position == "Operator" and k ~= "trion" and k ~= "listname" then
                    total = total + v
                elseif self.position ~= "Operator" and k ~= "listname" then
                    total = total + v
                end
            end
        end
        return total
    end
    
    local data = Stat.from_data()
    
    ---@param frame frame
    function Stat.GetStat(frame)
        local args, pargs = util.get_args_and_pargs(frame)
        local name = args[1] or pargs[1] or ""
        name = name:gsub(" ", "_")
        local key = args[2] or pargs[2] or "total"
        ---@type Stat
        local entry = data[name]
        local res = {}
        for k, v in pairs(entry) do
          if type(v) == "number" or type(v) == "string" then
            res[k] = v
          end
        end
        res.total = entry:total()
        return res[key]
    end
    
    ---@param frame frame
    function Stat.calcListName(self, frame)
        local p = tostring(self.listname)
        local args = self.args
        local name = ""
        if args.db then name = "bbf" .. p elseif args.c then name = "c" .. p end
        args.name = name
        args.p = p
        return frame:expandTemplate{title = "ref", args = args}
    end
    
    ---@param frame frame
    function Stat.calcChartName(self, frame)
        return "[[Border Briefing File]] Page " .. self.listname .. self:calcListName(frame)
    end
    
    ---@param frame frame
    function Stat.GetListName(frame)
        local args, pargs = util.get_args_and_pargs(frame)
        local name = args[1] or pargs[1] or ""
        ---@type Stat
        local entry = data[name]
        return "[[" .. name .. "]]" .. entry:calcListName(frame)
    end
    
    ---@param frame frame
    function Stat.GetChartName(frame)
        local args, pargs = util.get_args_and_pargs(frame)
        local name = args[1] or pargs[1] or ""
        ---@type Stat
        local entry = data[name]
        return entry:calcChartName(frame)
    end
    
    return Stat
    
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.

    Recent changes

  • Desk gun • 13 hours ago
  • Desk gun • 13 hours ago
  • Desk gun • 14 hours ago
  • Tragedys End Editor • 23 hours ago
  • Welcome to WorldTriggerWiki.com!

    We have completed moving the wiki here from FANDOM. This is the wiki that will be maintained and updated in the future (more information). Enjoy your stay!


    If you would like to get involved, or if you have questions or feedback, check out the Community Portal.

    Cookies help us deliver our services. By using our services, you agree to our use of cookies.