Magia Record English Wiki
No edit summary
No edit summary
(43 intermediate revisions by 3 users not shown)
Line 1: Line 1:
  +
 
local p = {}
 
local p = {}
 
 
Line 5: Line 6:
 
-- Only Girls and memoria with the relevant effect are included
 
-- Only Girls and memoria with the relevant effect are included
 
 
  +
--[[
  +
----------------
  +
----- NOTE -----
  +
-- If the code raises a node limit exceeded error, reduce the amount of frame:expandTemplate calls, girls_effect should be the simple and natural target
  +
About:
  +
The preprocessor node count measures the complexity of the page (not the volume of data). As the parser is expanding a page, it creates a data structure known as a tree that corresponds to the HTML structure of the page. Each node of the tree that is visited during expansion is counted towards the preprocessor node count. If this count is exceeded, the parser will abort parsing with the error "Node-count limit exceeded" visible in the generated HTML.
  +
  +
The count starts with 1 for plain text. A pair of nowiki tags counts for 3, a header for 2, etc. A link does not contribute to the count. For the expansion of #switch every checked condition adds 2 to the count. In the case of multiple expansions of the same template the content of a template without arguments counts only once, but that of a template with arguments (even if constant) counts multiple times. In contrast to this, the result of an expansion can be used multiple times while counting only once if it is assigned to a template parameter, and that template has multiple uses of this parameter.
  +
  +
Pages exceeding this limit are automatically categorized into Category:Pages where node count is exceeded.
  +
---------------
  +
--]]
 
 
 
function p.main(frame)
 
function p.main(frame)
Line 12: Line 25:
 
return p.render(frame, character_list_page, memoria_list_page, effect)
 
return p.render(frame, character_list_page, memoria_list_page, effect)
 
end
 
end
 
   
 
function girls_effect(frame, girl, effect, lvl)
 
function girls_effect(frame, girl, effect, lvl)
local skill = ""
+
local nskill = ""
 
local connect_effects = nil
 
local connect_effects = nil
  +
local passive_ex_effects = nil
  +
local skill_se_effects = {}
 
local magia_effects = nil
 
local magia_effects = nil
  +
local counter = 0
skills = frame:expandTemplate{ title = 'Template:'.. girl .. ' Abilities', args = {'Get', "Connect effect 1", "Connect effect 2", "Connect effect 3", "Connect effect 4", "Connect effect 5", "Connect effect 6"}}
 
  +
 
local skills = frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', "Connect effect 1", "Connect effect 2", "Connect effect 3", "Connect effect 4", "Connect effect 5", "Connect effect 6"}}
  +
  +
-- skills will look like HP Restore¤MP Restore to Nanami Yachiyo¤ ... ¤Attack Up
  +
-- (skills .. ¤) concatenates a ¤ character to the end of the string
  +
-- gmatch splits up the string, passing all series of non-¤ as a space-stripped string
  +
for skill in (skills .. "¤"):gmatch("%s*([^¤]*)%s*¤") do
  +
counter = counter + 1
  +
if skill ~= "" then --Not all 6 connect effects are filled out. Must check for empty string.
  +
formated_skill = "Chance to " .. skill .. " on Attack to"
 
formated_skill = formated_skill:match(".*Chance to (.-) on Attack.*to.*")
  +
formated_skill = (formated_skill .. " ("):match("(.-) %(.*") --Include connects to unique targets, all on edges, chance skills, and region specific (region given in parantheses)
  +
if formated_skill:lower() == effect then
 
connect_effects = frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', "Connect " .. counter .. " / " .. lvl}}
 
if connect_effects == "" or connect_effects == "{{{ Connect " .. counter .. " / " .. lvl .."\n }}}" then
 
connect_effects = frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', "Connect " .. counter .. " effect / " .. lvl}} .. " / [" .. frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', "Connect " .. counter .. " chance / " .. lvl}} .. "]"
  +
end
  +
end
  +
end
  +
end
  +
  +
skill1, effect1, skill2, effect2 = frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', 'EX effect 1', 'EX 1 max', 'EX effect 2', 'EX 2 max'}}:match("^(.*)¤(.*)¤(.*)¤(.*)$")
  +
  +
if skill1:lower() == effect then
  +
passive_ex_effects = effect1
  +
elseif skill2:lower() == effect then
  +
passive_ex_effects = effect2
  +
end
  +
  +
skills = frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', 'Passive 1 effect', 'Passive 2 effect', 'Passive 3 effect', 'Passive 4 effect', 'Passive 5 effect', 'Passive 6 effect', 'Passive 7 effect', 'Passive 8 effect', 'Passive 9 effect', 'Passive 10 effect', 'Passive 11 effect', 'Passive 12 effect', 'Passive 13 effect', 'Active 1 effect'}}
  +
 
for skill in (skills .. "¤"):gmatch("%s*([^¤]*)%s*¤") do
 
for skill in (skills .. "¤"):gmatch("%s*([^¤]*)%s*¤") do
 
if skill ~= "" then
 
if skill ~= "" then
formated_skill = "Chance to " .. skill .. " on Attack" .. " to"
+
for subskill in (skill .. "&"):gmatch("%s*(.-)&%s*") do
  +
target_duration = nil
skill = formated_skill:match(".*Chance to (.-)%s- on Attack.*to.*") --Include connects to unique targets, all on edges, and chance skills
 
if skill:lower() == effect then
+
if subskill:find("%(") then
  +
target_duration = subskill:match(".*(%(.-%))")
connect_effects = frame:expandTemplate{ title = 'Template:'.. girl .. ' Abilities', args = {'Get', "Connect " .. nr .. " / " .. lvl}}
 
  +
else
if connect_effects == "" or connect_effects == "{{{ Connect " .. nr .. " / " .. lvl .."\n }}}" then
 
  +
target_duration = skill:match(".*(%(.-%))")
connect_effects = frame:expandTemplate{ title = 'Template:'.. girl .. ' Abilities', args = {'Get', "Connect " .. nr .. " effect / " .. lvl}} .. " / [" .. frame:expandTemplate{ title = 'Template:'.. girl .. ' Abilities', args = {'Get', "Connect " .. nr .. " chance / " .. lvl}} .. "]"
 
  +
end
  +
subskill = (subskill.. "("):match("(.-)%(.*") -- Remove target and duration
  +
if subskill:find("%[") then
  +
skill0, value = subskill:match("(.-)%s*%[(.-)]")
  +
else
  +
skill0, value = subskill, "100%"
  +
end
  +
formated_skill = "Chance to " .. skill0 .. " on Attack" .. " to"
  +
skill0 = (formated_skill):match(".*Chance to (.-)%s- on Attack.*to.*") --Include connects to unique targets, all on edges, and chance skills
  +
if skill0:lower() == effect then
  +
local unique = true
  +
for k,v in pairs(skill_se_effects) do
  +
if v == value then unique = false end
  +
end
  +
if unique then
  +
if target_duration then
  +
table.insert(skill_se_effects, value .. " " .. target_duration)
  +
else
  +
table.insert(skill_se_effects, value)
  +
end
  +
end
 
end
 
end
 
end
 
end
Line 32: Line 98:
 
end
 
end
 
 
  +
counter = 0
 
  +
skills = frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', "Magia effect 1", "Magia effect 2", "Magia effect 3", "Magia effect 4", "Magia effect 5", "Magia effect 6"}}
return connect_effects, skills
 
  +
for skill in (skills .. "¤"):gmatch("%s*([^¤]*)%s*¤") do
  +
counter = counter + 1
  +
if skill ~= "" then
  +
formated_skill = "Chance to " .. skill .. " on Attack to"
  +
formated_skill = formated_skill:match(".*Chance to (.-) on Attack.*to.*")
  +
formated_skill = (formated_skill .. " ("):match("(.-) %(.*") --Include connects to unique targets, all on edges, chance skills, and region specific (region given in parantheses) ls, and region specific (region given in parantheses)
  +
if formated_skill:lower() == effect then
  +
magia_effects = frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', "Magia " .. counter .. " / " .. lvl}}
  +
if magia_effects == "" or magia_effects == "{{{ Magia " .. counter .. " / " .. lvl .."\n }}}" then
  +
magia_effects = frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', "Magia " .. counter .. " effect / " .. lvl}} .. " / [" .. frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', "Magia " .. counter .. " chance / " .. lvl}} .. "]"
  +
end
  +
end
  +
end
  +
end
  +
  +
return connect_effects, passive_ex_effects, skill_se_effects, magia_effects
 
end
 
end
  +
 
 
 
function p.render(frame, character_list_page, memoria_list_page, effect)
 
function p.render(frame, character_list_page, memoria_list_page, effect)
Line 40: Line 123:
 
local memos = frame:expandTemplate{ title = memoria_list_page }
 
local memos = frame:expandTemplate{ title = memoria_list_page }
 
local connects = {}
 
local connects = {}
  +
local passives_ex = {}
  +
local skills_se = {}
 
local magias = {}
 
local magias = {}
 
local memorias = {}
 
local memorias = {}
  +
roman_translation_dict = {
  +
["XV"] = "15",
  +
["XIV"] = "14",
  +
["XIII"] = "13",
  +
["XII"] = "12",
  +
["XI"] = "11",
  +
["X"] = "10",
  +
["IX"] = "09",
  +
["VIII"] = "08",
  +
["VII"] = "07",
  +
["VI"] = "06",
  +
["V"] = "05",
  +
["IV"] = "04",
  +
["III"] = "03",
  +
["II"] = "02",
  +
["I"] = "01"
  +
}
 
 
 
for girl in (girls .. ";"):gmatch("%s*([^;]*)%s*;") do
 
for girl in (girls .. ";"):gmatch("%s*([^;]*)%s*;") do
min_lvl, max_lvl = frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', 'base_rarity', 'max_rarity'}}:match("^(.*)¤(.*)$")
+
min_lvl, max_lvl, event = frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', 'base_rarity', 'max_rarity', "event_limit"}}:match("^(.*)¤(.*)¤(.*)$")
  +
if event:gsub("%s+", "") ~= "" then
  +
style = "background: #E9F2FF;"
  +
else
  +
style = ""
  +
end
 
if min_lvl == nil then
 
if min_lvl == nil then
table.insert(connects, girl .. "¬Unknown. Could not get abilities")
+
table.insert(connects, girl .. "¬Unknown. Could not get abilities¬¬")
table.insert(magias, girl .. "¬Unknown. Could not get abilities")
+
table.insert(passives_ex, girl .. "¬Unknown. Could not get abilities¬¬")
  +
table.insert(skills_se, girl .. "¬Unknown. Could not get abilities¬¬")
  +
table.insert(magias, girl .. "¬Unknown. Could not get abilities¬¬")
 
else
 
else
 
effects_nr = max_lvl - min_lvl + 1
 
effects_nr = max_lvl - min_lvl + 1
  +
result, connect_effects, magia_effects = pcall(girls_effect, frame, girl, effect, effects_nr)
 
  +
 
 
result, connect_effects, ex_effects, se_effects, magia_effects = pcall(girls_effect, frame, girl, effect, effects_nr)
  +
 
if result then -- If pcall returns not error
 
if result then -- If pcall returns not error
 
if connect_effects then
 
if connect_effects then
table.insert(connects, girl .. "¬" .. connect_effects)
+
table.insert(connects, girl .. "¬" .. connect_effects .. "¬" .. connect_effects:gsub("%S+", roman_translation_dict) .. "¬" .. style)
  +
end
  +
if ex_effects then
  +
table.insert(passives_ex, girl .. "¬" .. ex_effects .. "¬" .. ex_effects:gsub("%S+", roman_translation_dict) .. "¬" .. style)
  +
end
  +
for index = 1, #se_effects do
  +
table.insert(skills_se, girl .. "¬" .. se_effects[index] .. "¬" .. se_effects[index]:gsub("%S+", roman_translation_dict) .. "¬" .. style)
 
end
 
end
 
if magia_effects then
 
if magia_effects then
table.insert(magias, girl .. "¬" .. magia_effects)
+
table.insert(magias, girl .. "¬" .. magia_effects .. "¬" .. magia_effects:gsub("%S+", roman_translation_dict) .. "¬" .. style)
 
end
 
end
 
else
 
else
table.insert(connects, girl .. "¬Unknown. Could not get abilities" .. tostring(result))
+
table.insert(connects, girl .. "¬Unknown. Could not get abilities / " .. tostring(result) .. "¬¬")
table.insert(magias, girl .. "¬Unknown. Could not get abilities" .. tostring(result))
+
table.insert(passives_ex, girl .. "¬Unknown. Could not get abilities / " .. tostring(result) .. "¬¬")
  +
table.insert(skills_se, girl .. "¬Unknown. Could not get abilities / " .. tostring(result) .. "¬¬")
  +
table.insert(magias, girl .. "¬Unknown. Could not get abilities / " .. tostring(result) .. "¬¬")
 
end
 
end
 
end
 
end
 
end
 
end
   
  +
for memo in (memos .. ";"):gmatch("%s*([^;]*)%s*;") do
  +
skills, event, owner, id = frame:expandTemplate{ title = 'Template:'.. memo, args = {'Get', 'effect2', "Event", "Owner", "ID"}}:match("^(.*)¤(.*)¤(.*)¤(.*)$")
  +
if skills == nil then
  +
table.insert(memorias, memo .. "¬No Data.png¬Unknown. Could not get abilities¬¬")
  +
else
  +
for subskill in (skills .. "&"):gmatch("%s*(.-)&%s*") do
  +
target_duration = nil
  +
if subskill:find("%(") then
  +
target_duration = subskill:match(".*(%(.-%))")
  +
else
  +
target_duration = skills:match(".*(%(.-%))")
  +
end
  +
subskill = (subskill.. "("):match("(.-)%(.*") -- Remove target and duration
  +
if subskill:find("%[") then
  +
skill, value = subskill:match("(.-)%s*%[(.-)]")
  +
else
  +
skill, value = subskill, "100%"
  +
end
  +
formated_skill = "Chance to " .. skill .. " on Attack" .. " to"
  +
skill = (formated_skill):match(".*Chance to (.-)%s- on Attack.*to.*") --Include connects to unique targets, all on edges, and chance skills
  +
if skill:lower() == effect then
  +
if event:gsub("%s+", "") ~= "" then
  +
style = "background: #E9F2FF;"
  +
elseif owner:gsub("%s+", "") ~= "" then
  +
style = "background: #E9FFF2;"
  +
else
  +
style = ""
  +
end
   
  +
if target_duration then
  +
table.insert(memorias, memo.. "¬" .. "Memoria_" .. string.format("%03d", id) .. "_s.png" .. "¬" .. value .. " " .. target_duration .. "¬" .. value:gsub("%S+", roman_translation_dict) .. "¬" .. style)
  +
else
  +
table.insert(memorias, memo.. "¬" .. "Memoria_" .. string.format("%03d", id) .. "_s.png" .. "¬" .. value .. "¬" .. value:gsub("%S+", roman_translation_dict) .. "¬" .. style)
  +
end
  +
end
  +
end
  +
end
  +
end
   
 
table.sort(connects)
 
table.sort(connects)
  +
table.sort(passives_ex)
  +
table.sort(skills_se)
 
table.sort(magias)
 
table.sort(magias)
  +
table.sort(memorias)
 
 
 
output = ""
 
output = ""
Line 76: Line 235:
 
for id= 2, #connects do
 
for id= 2, #connects do
 
output = output .. ";" .. connects[id]
 
output = output .. ";" .. connects[id]
  +
end
  +
end
  +
output = output .. "¤"
  +
if passives_ex[1] then
  +
output = output .. passives_ex[1]
  +
for id= 2, #passives_ex do
  +
output = output .. ";" .. passives_ex[id]
  +
end
  +
end
  +
output = output .. "¤"
  +
if skills_se[1] then
  +
output = output .. skills_se[1]
  +
for id= 2, #skills_se do
  +
output = output .. ";" .. skills_se[id]
 
end
 
end
 
end
 
end
Line 86: Line 259:
 
end
 
end
 
output = output .. "¤"
 
output = output .. "¤"
  +
if memorias[1] then
 
return output
+
output = output .. memorias[1]
  +
for id= 2, #memorias do
  +
output = output .. ";" .. memorias[id]
  +
end
  +
end
  +
  +
if output == "¤¤¤¤" then
  +
return result
  +
else
  +
return output
  +
end
 
 
 
end
 
end

Revision as of 00:57, 28 March 2020

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

local p = {}
 
-- Returns a string as Girl_A_name,Girl_A_effect;Girl_B_name,Girl_B_effect; (...)¤Memoria_A_name,Memoria_A_Effect;(...)
-- The girls and memorias are listed in lexicographical order
-- Only Girls and memoria with the relevant effect are included
 
--[[
 ----------------
 ----- NOTE -----
 -- If the code raises a node limit exceeded error, reduce the amount of frame:expandTemplate calls, girls_effect should be the simple and natural target
About:
 The preprocessor node count measures the complexity of the page (not the volume of data). As the parser is expanding a page, it creates a data structure known as a tree that corresponds to the HTML structure of the page. Each node of the tree that is visited during expansion is counted towards the preprocessor node count. If this count is exceeded, the parser will abort parsing with the error "Node-count limit exceeded" visible in the generated HTML.

The count starts with 1 for plain text. A pair of nowiki tags counts for 3, a header for 2, etc. A link does not contribute to the count. For the expansion of #switch every checked condition adds 2 to the count. In the case of multiple expansions of the same template the content of a template without arguments counts only once, but that of a template with arguments (even if constant) counts multiple times. In contrast to this, the result of an expansion can be used multiple times while counting only once if it is assigned to a template parameter, and that template has multiple uses of this parameter.

Pages exceeding this limit are automatically categorized into Category:Pages where node count is exceeded.
 ---------------
 --]]
 
function p.main(frame)
    local character_list_page = frame.args['CharacterListSource']
    local memoria_list_page = frame.args['MemoriaListSource']
    local effect = frame.args['effect']:lower()
    return p.render(frame, character_list_page, memoria_list_page, effect)
end

function girls_effect(frame, girl, effect, lvl)
    local nskill = ""
    local connect_effects = nil
    local passive_ex_effects = nil
    local skill_se_effects = {}
    local magia_effects = nil
    local counter = 0
    
    local skills = frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', "Connect effect 1",  "Connect effect 2", "Connect effect 3", "Connect effect 4", "Connect effect 5", "Connect effect 6"}}
    
    -- skills will look like HP Restore¤MP Restore to Nanami Yachiyo¤ ... ¤Attack Up
    -- (skills .. ¤) concatenates a ¤ character to the end of the string
    -- gmatch splits up the string, passing all series of non-¤ as a space-stripped string
    for skill in (skills .. "¤"):gmatch("%s*([^¤]*)%s*¤") do
        counter = counter + 1
        if skill ~= "" then --Not all 6 connect effects are filled out. Must check for empty string.
            formated_skill = "Chance to " .. skill .. " on Attack to"
            formated_skill = formated_skill:match(".*Chance to (.-) on Attack.*to.*") 
            formated_skill = (formated_skill .. " ("):match("(.-) %(.*")   --Include connects to unique targets, all on edges, chance skills, and region specific (region given in parantheses) 
            if formated_skill:lower() == effect then
                connect_effects = frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', "Connect " .. counter .. " / " .. lvl}}
                if connect_effects == "" or connect_effects == "{{{ Connect " .. counter .. " / " .. lvl .."\n }}}" then
                    connect_effects = frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', "Connect " .. counter .. " effect / " .. lvl}} .. " / [" .. frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', "Connect " .. counter .. " chance / " .. lvl}} .. "]"
                end
            end
        end
    end
    
    skill1, effect1, skill2, effect2 = frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', 'EX effect 1', 'EX 1 max', 'EX effect 2', 'EX 2 max'}}:match("^(.*)¤(.*)¤(.*)¤(.*)$")
    
    if skill1:lower() == effect then
        passive_ex_effects = effect1
    elseif skill2:lower() == effect then
        passive_ex_effects = effect2
    end
    
    skills = frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get',  'Passive 1 effect', 'Passive 2 effect', 'Passive 3 effect', 'Passive 4 effect', 'Passive 5 effect', 'Passive 6 effect', 'Passive 7 effect', 'Passive 8 effect', 'Passive 9 effect', 'Passive 10 effect', 'Passive 11 effect', 'Passive 12 effect', 'Passive 13 effect', 'Active 1 effect'}}
    
    for skill in (skills .. "¤"):gmatch("%s*([^¤]*)%s*¤") do
        if skill ~= "" then
            for subskill in (skill .. "&"):gmatch("%s*(.-)&%s*") do
                target_duration = nil
                if subskill:find("%(") then
                    target_duration = subskill:match(".*(%(.-%))")
                else
                    target_duration = skill:match(".*(%(.-%))")
                end
                subskill = (subskill.. "("):match("(.-)%(.*")  -- Remove target and duration
                if subskill:find("%[") then
                    skill0, value = subskill:match("(.-)%s*%[(.-)]")
                else 
                    skill0, value = subskill, "100%"
                end
                formated_skill = "Chance to " .. skill0 .. " on Attack" .. " to"
                skill0 = (formated_skill):match(".*Chance to (.-)%s- on Attack.*to.*")  --Include connects to unique targets, all on edges, and chance skills
                if skill0:lower() == effect then
                    local unique = true
                    for k,v in pairs(skill_se_effects) do
                        if v == value then unique = false end
                    end
                    if unique then
                        if target_duration then
                            table.insert(skill_se_effects, value .. " " .. target_duration)     
                        else
                            table.insert(skill_se_effects, value)
                        end
                    end
                end
            end
        end
    end
    
    counter = 0
    skills = frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', "Magia effect 1",  "Magia effect 2", "Magia effect 3", "Magia effect 4", "Magia effect 5", "Magia effect 6"}}
    for skill in (skills .. "¤"):gmatch("%s*([^¤]*)%s*¤") do
        counter = counter + 1
        if skill ~= "" then
            formated_skill = "Chance to " .. skill .. " on Attack to"
            formated_skill = formated_skill:match(".*Chance to (.-) on Attack.*to.*") 
            formated_skill = (formated_skill .. " ("):match("(.-) %(.*")   --Include connects to unique targets, all on edges, chance skills, and region specific (region given in parantheses) ls, and region specific (region given in parantheses) 
            if formated_skill:lower() == effect then
                magia_effects = frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', "Magia " .. counter .. " / " .. lvl}}
                if magia_effects == "" or magia_effects == "{{{ Magia " .. counter .. " / " .. lvl .."\n }}}" then
                        magia_effects =  frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', "Magia " .. counter .. " effect / " .. lvl}} .. " / [" .. frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', "Magia " .. counter .. " chance / " .. lvl}} .. "]"
                end
            end
        end
    end
    
    return connect_effects, passive_ex_effects, skill_se_effects, magia_effects
end

 
function p.render(frame, character_list_page, memoria_list_page, effect)
    local girls = frame:expandTemplate{ title = character_list_page }
    local memos = frame:expandTemplate{ title = memoria_list_page }
    local connects = {}
    local passives_ex = {}
    local skills_se = {}
    local magias = {}
    local memorias = {}
    roman_translation_dict = {
    ["XV"] = "15", 
    ["XIV"] = "14", 
    ["XIII"] = "13", 
    ["XII"] = "12", 
    ["XI"] = "11", 
    ["X"] = "10", 
    ["IX"] = "09", 
    ["VIII"] = "08", 
    ["VII"] = "07", 
    ["VI"] = "06", 
    ["V"] = "05", 
    ["IV"] = "04", 
    ["III"] = "03", 
    ["II"] = "02", 
    ["I"] = "01"
    }
        
    for girl in (girls .. ";"):gmatch("%s*([^;]*)%s*;") do
        min_lvl, max_lvl, event = frame:expandTemplate{ title = 'Template:'.. girl, args = {'Get', 'base_rarity', 'max_rarity', "event_limit"}}:match("^(.*)¤(.*)¤(.*)$")
        if event:gsub("%s+", "") ~= "" then
            style = "background: #E9F2FF;"
        else
            style = ""
        end
        if min_lvl == nil then
            table.insert(connects, girl .. "¬Unknown. Could not get abilities¬¬")
            table.insert(passives_ex, girl .. "¬Unknown. Could not get abilities¬¬")
            table.insert(skills_se, girl .. "¬Unknown. Could not get abilities¬¬")
            table.insert(magias, girl .. "¬Unknown. Could not get abilities¬¬")
        else
            effects_nr = max_lvl - min_lvl + 1
    
            
            result, connect_effects, ex_effects, se_effects, magia_effects = pcall(girls_effect, frame, girl, effect, effects_nr)
            
            if result then  -- If pcall returns not error
                if connect_effects then
                    table.insert(connects, girl .. "¬" .. connect_effects .. "¬" .. connect_effects:gsub("%S+", roman_translation_dict) .. "¬" .. style)
                end
                if ex_effects then
                    table.insert(passives_ex, girl .. "¬" .. ex_effects .. "¬" .. ex_effects:gsub("%S+", roman_translation_dict) .. "¬" .. style) 
                end
                for index = 1, #se_effects do
                    table.insert(skills_se, girl .. "¬" .. se_effects[index] .. "¬" .. se_effects[index]:gsub("%S+", roman_translation_dict) .. "¬" .. style)
                end
                if magia_effects then
                    table.insert(magias, girl .. "¬" .. magia_effects .. "¬" .. magia_effects:gsub("%S+", roman_translation_dict) .. "¬" .. style) 
                end
            else
                table.insert(connects, girl .. "¬Unknown. Could not get abilities / " .. tostring(result) .. "¬¬")
                table.insert(passives_ex, girl .. "¬Unknown. Could not get abilities / " .. tostring(result) .. "¬¬")
                table.insert(skills_se, girl .. "¬Unknown. Could not get abilities / " .. tostring(result) .. "¬¬")
                table.insert(magias, girl .. "¬Unknown. Could not get abilities / " .. tostring(result) .. "¬¬")
            end
        end
    end

    for memo in (memos .. ";"):gmatch("%s*([^;]*)%s*;") do
        skills, event, owner, id = frame:expandTemplate{ title = 'Template:'.. memo, args = {'Get', 'effect2', "Event", "Owner", "ID"}}:match("^(.*)¤(.*)¤(.*)¤(.*)$")
        if skills == nil then
            table.insert(memorias, memo .. "¬No Data.png¬Unknown. Could not get abilities¬¬")
        else
            for subskill in (skills .. "&"):gmatch("%s*(.-)&%s*") do
                target_duration = nil
                if subskill:find("%(") then
                    target_duration = subskill:match(".*(%(.-%))")
                else
                    target_duration = skills:match(".*(%(.-%))")
                end
                subskill = (subskill.. "("):match("(.-)%(.*")  -- Remove target and duration
                if subskill:find("%[") then
                    skill, value = subskill:match("(.-)%s*%[(.-)]")
                else 
                    skill, value = subskill, "100%"
                end
                formated_skill = "Chance to " .. skill .. " on Attack" .. " to"
                skill = (formated_skill):match(".*Chance to (.-)%s- on Attack.*to.*")  --Include connects to unique targets, all on edges, and chance skills
                if skill:lower() == effect then
                    if event:gsub("%s+", "") ~= "" then
                        style = "background: #E9F2FF;"
                    elseif owner:gsub("%s+", "") ~= "" then
                        style = "background: #E9FFF2;"
                    else 
                        style = ""
                    end

                    if target_duration then
                        table.insert(memorias, memo.. "¬" .. "Memoria_" .. string.format("%03d", id) .. "_s.png" .. "¬" .. value .. " " .. target_duration .. "¬" .. value:gsub("%S+", roman_translation_dict) .. "¬" .. style)
                    else
                        table.insert(memorias, memo.. "¬" .. "Memoria_" .. string.format("%03d", id) .. "_s.png" .. "¬" .. value .. "¬" .. value:gsub("%S+", roman_translation_dict) .. "¬" .. style)
                    end
                end
            end
        end
    end

    table.sort(connects)
    table.sort(passives_ex)
    table.sort(skills_se)
    table.sort(magias)
    table.sort(memorias)
    
    output = ""
    if connects[1] then
        output = connects[1]
        for id= 2, #connects do
            output = output .. ";" .. connects[id]
        end
    end
    output = output .. "¤"
    if passives_ex[1] then
        output = output .. passives_ex[1]
        for id= 2, #passives_ex do
            output = output .. ";" .. passives_ex[id]
        end
    end
    output = output .. "¤"
    if skills_se[1] then
        output = output .. skills_se[1]
        for id= 2, #skills_se do
            output = output .. ";" .. skills_se[id]
        end
    end
    output = output .. "¤"
    if magias[1] then
        output = output .. magias[1]
        for id= 2, #magias do
            output = output .. ";" .. magias[id]
        end
    end
    output = output .. "¤"
    if memorias[1] then
        output = output .. memorias[1]
        for id= 2, #memorias do
            output = output .. ";" .. memorias[id]
        end
    end
    
    if output == "¤¤¤¤" then
        return result
    else
        return output
    end
 
end
 
return p