Module:Girls

-- The following pages are related: https://booty-farm.fandom.com/wiki/Module:Girls https://booty-farm.fandom.com/wiki/Module:Girls/data https://booty-farm.fandom.com/wiki/Module:Girls/qa

local girl = mw.loadData('Module:Girls/data') local qa = mw.loadData('Module:Girls/qa') local p = {}

function check(num,maxi) if num == nil then if maxi == 4 then return '/' end return 'Add data here' else return num end end

function unlocked(unlock) local event = mw.loadData('Module:Events/data') local events = require('Module:Events') event_data=events.eventSorted(event) if unlock == nil then return " data-sort-value= 99999| ?" elseif event[unlock] ~= nil then for n, e in pairs(event_data) do           if e == unlock then return " data-sort-value="..(1000+n).."|"..unlock.."" end end else return unlock end end

function p.table(frame) local data = { '==Girls List==', '{| class="wikitable mw-datatable sortable" style="text-align: center;"', '|-',       '! Name', '! Picture', '! data-sort-type="number" | Available', '|-'   }    for a, s in pairs(girl) do        z = nil table.insert(data, '| '..a..'') table.insert(data, '| ') table.insert(data, '|'..unlocked(s.unlock)) table.insert(data, '|-') end table.insert(data, '|}') for i, d in pairs(data) do mw.log(d) end return table.concat(data, "\n") end

function p.infobox(frame) local name = mw.title.getCurrentTitle.text local girl_data=girl[name] if girl_data == nil then return " Please insert data to Module:Girls/data." end local count = 0 local data = {} for i, j in pairs(girl_data.facts) do       if j ~= nil then count = count+1 end end if count == 0 then table.insert(data, " Please insert data to Module:Girls/data.") end local infobox = { image = name..'.png', a=check(girl_data.facts.a), h=check(girl_data.facts.h), H=check(girl_data.facts.H), w=check(girl_data.facts.w), f=check(girl_data.facts.f), c=check(girl_data.facts.c), p=check(girl_data.facts.p), F=check(girl_data.facts.F), t=check(girl_data.facts.t), m=check(girl_data.facts.m), A=check(girl_data.facts.A), T=check(girl_data.facts.T), }   table.insert(data, frame:expandTemplate { title = 'Girls info', args = infobox }) return table.concat(data, '\n') end

function p.questions(frame) local name = mw.title.getCurrentTitle.text if girl[name].question ~= false then local sec = 0 local data = { '==Q&A==', '{| class="wikitable mw-datatable sortable" style="text-align: center;"', '|-',           '! Question', '! Answer', '|-'       }        for a, s in pairs(qa) do             c=0 if s[name]~=nil then sec = sec + 1 table.insert(data, '| '..s.q)               for b, d in pairs(s) do                    if string.match(b,name) then c = c+1 if c == 1 then table.insert(data, '| '..d)                        else table.insert(data, " or ") table.insert(data, d)               end end end table.insert(data, '|-') end end table.insert(data, "|colspan=2|Add questions here") table.insert(data, '|}') for i, d in pairs(data) do mw.log(d) end --if sec == 0 then return " Please insert data to Module:Girls/qa." end return table.concat(data, "\n") else return table.concat({'==Q&A==',"This girl doesn't have questions."}, "\n") end end

function null(a) if a=="nil" then return "Add here" else return a end end

function p.affinity(frame) local name = mw.title.getCurrentTitle.text local tables = { ' ',       '{| class="wikitable mw-datatable sortable" style="text-align: center;"', '|-',       '! LvL', '! XP', '|-'   }    local data = { '==Affinity Table==' }   table.insert(data, table.concat(tables, "\n")) local char_data = girl[name].affinity for a, b in pairs(char_data) do       if (a-1)%5==0 and (a-1)~= 0 then table.insert(data, "|} ") table.insert(data, table.concat(tables, "\n")) end table.insert(data, '|'..a)       table.insert(data, '|'..null(b)) table.insert(data, '|-') end table.insert(data, "|} ") for i, j in pairs(data) do mw.log(j) end return table.concat(data, "\n") end

return p