Module:Demographics Database

demographics={} demographics.complex={} demographics.complex["Artaburro"]= { ["Half Elves"] = { ["Church of Titanius"] = 289000, ["Cult of Nature"] = 150000, ["Other"] = 1000 },  ["High Elves"] = { ["Church of Titanius"] = 9500, ["Cult of Nature"] = 400, ["Other"] = 100 },  ["Wood Elves"] = { ["Church of Titanius"] = 100, ["Cult of Nature"] = 7000, ["Other"] = 400 } } demographics.complex["Etrand"] = { ["Dark Elves"] = { ["Church of Titanius"] = 1850, ["Cult of Nature"] = 850, ["Dwarven"] = 0, ["Other"] = 23300}, ["Dwarves"] = { ["Church of Titanius"] = 1000, ["Cult of Nature"] = 0, ["Dwarven"] = 199000, ["Other"] = 0}, ["Gnomes"] = { ["Church of Titanius"] = 2000, ["Cult of Nature"] = 0, ["Dwarven"] = 68000, ["Other"] = 0}, ["Goblins"] = { ["Church of Titanius"] = 5000, ["Cult of Nature"] = 0, ["Dwarven"] = 0, ["Other"] = 30000}, ["Half Elves"] = { ["Church of Titanius"] = 40000, ["Cult of Nature"] = 24500, ["Dwarven"] = 0, ["Other"] = 1500}, ["Half Orcs"] = { ["Church of Titanius"] = 4000, ["Cult of Nature"] = 2000, ["Dwarven"] = 0, ["Other"] = 500}, ["Halflings"] = { ["Church of Titanius"] = 41000, ["Cult of Nature"] = 500, ["Dwarven"] = 5000, ["Other"] = 500}, ["High Elves"] = { ["Church of Titanius"] = 22000, ["Cult of Nature"] = 2000, ["Dwarven"] = 0, ["Other"] = 1000}, ["Humans"] = { ["Church of Titanius"] = 4318000, ["Cult of Nature"] = 180000, ["Dwarven"] = 0, ["Other"] = 2000}, ["Lizardmen"] = { ["Church of Titanius"] = 8000, ["Cult of Nature"] = 0, ["Dwarven"] = 0, ["Other"] = 142000 }, ["Orcs"] = { ["Church of Titanius"] = 2000, ["Cult of Nature"] = 0, ["Dwarven"] = 0, ["Other"] = 10000 }, ["Wood Elves"] = { ["Church of Titanius"] = 2000, ["Cult of Nature"] = 18500, ["Dwarven"] = 0, ["Other"] = 500} } demographics.complex["Dragoc"] = { ["Dark Elves"] = { ["Cult of Nature"] = 1500, ["Other"] = 1000 },   ["Gnomes"] = { ["Cult of Nature"] = 500, ["Other"] = 4000 },   ["Half Elves"] = { ["Cult of Nature"] = 83800, ["Other"] = 1200 },   ["Half Orcs"] = { ["Cult of Nature"] = 1900, ["Other"] = 100 },   ["High Elves"] = { ["Cult of Nature"] = 18000, ["Other"] = 1500 },   ["Humans"] = { ["Cult of Nature"] = 11000, ["Other"] = 1000 },   ["Wood Elves"] = { ["Cult of Nature"] = 1200000, ["Other"] = 120 } } demographics.complex["Froturn"]= { ["Dark Elves"] = { ["Church of Titanius"] = 750, ["Cult of Nature"] = 250, ["Other"] = 6500}, ["Dwarves"] = { ["Church of Titanius"] = 50, ["Cult of Nature"] = 50, ["Other"] = 3900}, ["Gnomes"] = { ["Church of Titanius"] = 800, ["Cult of Nature"] = 200, ["Other"] = 5000}, ["Half Elves"] = { ["Church of Titanius"] = 20000, ["Cult of Nature"] = 4000, ["Other"] = 1000}, ["Half Orcs"] = { ["Church of Titanius"] = 0, ["Cult of Nature"] = 0, ["Other"] = 100}, ["Halflings"] = { ["Church of Titanius"] = 218000, ["Cult of Nature"] = 0, ["Other"] = 2000}, ["High Elves"] = { ["Church of Titanius"] = 2185000, ["Cult of Nature"] = 15000, ["Other"] = 220}, ["Humans"] = { ["Church of Titanius"] = 19000, ["Cult of Nature"] = 700, ["Other"] = 300}, ["Orcs"] = { ["Church of Titanius"] = 300, ["Cult of Nature"] = 0, ["Other"] = 1000}, ["Wood Elves"] = { ["Church of Titanius"] = 1800, ["Cult of Nature"] = 14000, ["Other"] = 200} } demographics.complex["Etrancoast"] = { ["Humans"] = { ["Other"] = 500000 }, ["Dark Elves"] = { ["Other"] = 4500 }, ["Dwarves"] = { ["Other"] = 8500 }, ["Gnomes"] = { ["Other"] = 5500 }, ["Goblins"] = { ["Other"] = 4000 }, ["Halflings"] = { ["Other"] = 6000 }, ["High Elves"] = { ["Other"] = 4500 }, ["Lizardmen"] = { ["Other"] = 5000 }, ["Ogres"] = { ["Other"] = 0 }, ["Orcs"] = { ["Other"] = 1400 }, ["Wood Elves"] = { ["Other"] = 0 }, ["Half Elves"] = { ["Other"] = 14000 }, ["Half Orcs"] = { ["Other"] = 1000 }, ["Nereids"] = { ["Other"] = 0 } } demographics.complex["Keldorn"] = { ["Humans"] = { ["Other"] = 70000 }, ["Dark Elves"] = { ["Other"] = 10000 }, ["Dwarves"] = { ["Other"] = 5000 }, ["Gnomes"] = { ["Other"] = 18000 }, ["Goblins"] = { ["Other"] = 90000 }, ["Halflings"] = { ["Other"] = 4000 }, ["High Elves"] = { ["Other"] = 5000 }, ["Lizardmen"] = { ["Other"] = 20000 }, ["Ogres"] = { ["Other"] = 0 }, ["Orcs"] = { ["Other"] = 10000 }, ["Wood Elves"] = { ["Other"] = 1000 }, ["Half Elves"] = { ["Other"] = 17000 }, ["Half Orcs"] = { ["Other"] = 9000 }, ["Nereids"] = { ["Other"] = 0 } } demographics.complex["Neressa"] = { ["Humans"] = { ["Other"] = 64000 }, ["Dark Elves"] = { ["Other"] = 10 }, ["Dwarves"] = { ["Other"] = 12800 }, ["Gnomes"] = { ["Other"] = 1600 }, ["Goblins"] = { ["Other"] = 68800 }, ["Halflings"] = { ["Other"] = 0 }, ["High Elves"] = { ["Other"] = 382000 }, ["Lizardmen"] = { ["Other"] = 30 }, ["Ogres"] = { ["Other"] = 2 }, ["Orcs"] = { ["Other"] = 0 }, ["Wood Elves"] = { ["Other"] = 108000 }, ["Half Elves"] = { ["Other"] = 51200 }, ["Half Orcs"] = { ["Other"] = 0 }, ["Nereids"] = { ["Other"] = 0 } } demographics.complex["Gabyr"] = { ["Humans"] = { ["Other"] = 54800 }, ["Dark Elves"] = { ["Other"] = 2800 }, ["Dwarves"] = { ["Other"] = 0 }, ["Gnomes"] = { ["Other"] = 0 }, ["Goblins"] = { ["Other"] = 4800 }, ["Halflings"] = { ["Other"] = 200 }, ["High Elves"] = { ["Other"] = 80 }, ["Lizardmen"] = { ["Other"] = 420 }, ["Ogres"] = { ["Other"] = 0 }, ["Orcs"] = { ["Other"] = 1200 }, ["Wood Elves"] = { ["Other"] = 0 }, ["Half Elves"] = { ["Other"] = 3200 }, ["Half Orcs"] = { ["Other"] = 480 }, ["Nereids"] = { ["Other"] = 24800 } }

demographics.historical = {} demographics.historical["Etrand"] = { ["0"] = {1000000,"Founding of Etrand"}, ["34"] = {1300000,"Before the Orcish Invasion of Etrand"}, ["37"] = {1200000,"After the Orcish Invasion of Etrand"}, ["104"] = {1700000},	["251"] = {2600000,"Before the Demonic invasions of Artograch"}, ["263"] = {1900000,"Aftermath of Demonic invasions of Artograch"}, ["270"] = {2000000,"Etrandish annexation of Dwarven clans"}, ["273"] = {1600000,"Aftermath of the the Long Raid and the Hulran invasion of Etrand"}, ["718"] = {4080000,"On the eve of Etrandish Succession War of 718"}, ["800"] = {4905000},	["831"] = {5158500,"Present day"} }

function demographics.race_orig(country) local to_return = {} for key in pairs(demographics.complex[country]) do       to_return[key] = 0 for key2,value in pairs(demographics.complex[country][key]) do           to_return[key] = to_return[key] + value end end return to_return end

function demographics.race local to_return = {} for key in pairs(demographics.complex) do       to_return[key] = {} for key2 in pairs(demographics.complex[key]) do           to_return[key][key2] = 0 for key3,value in pairs(demographics.complex[key][key2]) do               if demographics.complex[key][key2][key3] ~= nil then to_return[key][key2] = to_return[key][key2] + value end end end end return to_return end

function demographics.religion_orig(country) local to_return = {} for key in pairs(demographics.complex[country]) do       for key2,value in pairs(demographics.complex[country][key]) do            if to_return[key2] == nil then to_return[key2] = 0 end to_return[key2] = to_return[key2] + value end for k in pairs(to_return[key]) do   		if to_return[key][k] == 0 then to_return[key][k] = nil end end end return to_return end

function demographics.religion local to_return = {} for key in pairs(demographics.complex) do       to_return[key] = {} for key2 in pairs(demographics.complex[key]) do           for key3,value in pairs(demographics.complex[key][key2]) do                if to_return[key][key3] == nil then to_return[key][key3] = 0 end to_return[key][key3] = to_return[key][key3] + demographics.complex[key][key2][key3] end end for k in pairs(to_return[key]) do   		if to_return[key][k] == 0 then to_return[key][k] = nil end end end return to_return end