Module:Girls

-- The following pages are related: https://fapceo.wikia.com/wiki/Module:Girls https://fapceo.wikia.com/wiki/Module:Girls/data local p = {} local girls = mw.loadData('Module:Girls/data')

function compareLess(x, y)   return x[1] < y[1] end function compareMore(x, y)   return x[1] > y[1] end function tableSort(table1,table2,more) for i,v in ipairs(table1) do       table1[i] = {table1[i], table2[i]} end if more == 'less' then table.sort(table1, compareLess) else table.sort(table1, compareMore) end for i, v in ipairs(table1) do       table1[i] = v[1] table2[i] = v[2] end return table2 end

function check(stat) if stat == nil then return " Please insert data to Module:Girls/data." elseif stat == "" then return " Please insert data to Module:Girls/data." end return stat end

function link_the_stat(stat,typ,only) if stat == nil then stat = "Add data here" elseif only == true then if typ == "f" then if string.match(stat, "small") then stat = 'data-sort-value="1" |small' end if string.match(stat, "medium") then stat = 'data-sort-value="2" |medium' end if string.match(stat, "large") then stat = 'data-sort-value="3" |large' end elseif typ == "b" then if string.match(stat, "small") then stat = 'data-sort-value="1" |small' end if string.match(stat, "medium") then stat = 'data-sort-value="2" |medium' end if string.match(stat, "large") then stat = 'data-sort-value="3" |large' end elseif typ == "h" then if string.match(stat, "small") then stat = 'data-sort-value="1" |small' end if string.match(stat, "medium") then stat = 'data-sort-value="2" |medium' end if string.match(stat, "large") then stat = 'data-sort-value="3" |large' end end else if typ == "f" then stat = stat:gsub("small", "small") stat = stat:gsub("medium", "medium") stat = stat:gsub("large", "large") elseif typ == "b" then stat = stat:gsub("small", "small") stat = stat:gsub("medium", "medium") stat = stat:gsub("large", "large") elseif typ == "h" then stat = stat:gsub("small", "small") stat = stat:gsub("medium", "medium") stat = stat:gsub("large", "large") end end return stat end

function p.infobox(frame) local name = mw.title.getCurrentTitle.text local char_data=girls[name] if char_data == nil then return " Please insert data to Module:Girls/data." end local data = {} local infobox = { image = name..'_icon.jpg', feet = check(link_the_stat(char_data.feet,"f")), breast = check(link_the_stat(char_data.breast,"b")), height = check(link_the_stat(char_data.height,"h")), occupation = check(char_data.occupation), likes = check(char_data.likes), dislikes = check(char_data.dislikes) }   table.insert(data, frame:expandTemplate { title = 'Girl info', args = infobox }) table.insert(data, ""..check(char_data.desc)) table.insert(data, frame:expandTemplate { title = 'Clear'}) return table.concat(data, '\n') end

function outfit_naming(outfit, name) if string.match(outfit, "other") then return outfit:gsub("?!other", "") elseif string.match(outfit, name) then return outfit else return name.." "..outfit end end

function p.outfits(frame) local name = mw.title.getCurrentTitle.text local char_data=girls[name] if char_data == nil then return " Please insert data to Module:Girls/data." end local data = { '{| class="wikitable sortable" style="float: left; text-align: center;"', '|+Outfits', '|-',       '! class="unsortable" | Picture', '! Outfit', '! data-sort-type="number"| Cost', '|-'       }    for i,j in pairs(char_data.outfit) do        table.insert(data, '| ")        table.insert(data, '| '..outfit_naming(i,name))        if j == "Starting Outfit" then cost = ' data-sort-value="0" |'..j else cost = j end        table.insert(data, '| '..cost)        table.insert(data, '|-')    end    table.insert(data, '|}')    for i,j in pairs(data) do mw.log(j) end    return table.concat(data, '\n') end

function p.table(frame) local data = { '==Girls List==', '{| class="wikitable mw-datatable sortable" style="text-align: center;"', '|-',       '! Name', '! Picture', '! data-sort-type="number" | Feet', '! data-sort-type="number" | Breast Size', '! data-sort-type="number" | Height', '! data-sort-type="number" | Available ', '|-'   }    for a, s in pairs(girls) do        table.insert(data, '| '..a..'') table.insert(data, '| ') table.insert(data, '|'..check(link_the_stat(s.feet,"f",true))) table.insert(data, '|'..check(link_the_stat(s.breast,"b",true))) table.insert(data, '|'..check(link_the_stat(s.height,"h",true))) if type(check(s.unlock)) == "number" then u=s.unlock elseif check(s.unlock)==" Please insert data to Module:Girls/data." then u=s.unlock else u=..s.unlock.. end table.insert(data, '|'..u)       table.insert(data, '|-') end table.insert(data, '|}') for i, d in pairs(data) do mw.log(d) end return table.concat(data, "\n") end

return p