1 local http, env, storage
2 local C = minetest.get_color_escape_sequence
9 function furrybot.get_waifu_name()
10 local r = math.floor(1
21 jp = jp .. furrybot.hiragana.list[math.random(#furrybot.hiragana.list)]
27 local combo = furrybot.hiragana.map[utf8.sub(jp, i, i + 1)]
33 en = en .. furrybot.hiragana.map[utf8.sub(jp, i, i)]
37 return jp .. " (" .. furrybot.uppercase(en) .. ")"
40 function furrybot.random_distribution(tbl)
44 for i, v in ipairs(tbl) do
49 local r = math.random(accum)
51 for i, v in ipairs(tbl) do
58 function furrybot.get_waifu_species()
59 return furrybot.random_distribution({
68 {"Apache Helicopter", 1},
69 {"C++ Programmer", 1},
73 function furrybot.get_waifu_gender()
74 return furrybot.random_distribution({
81 function furrybot.get_waifu_hair()
82 return furrybot.random_distribution({
83 {{"Brown", "#DDAE92"}, 25},
84 {{"Black", "#433F3A"}, 25},
85 {{"Blonde", "#ECC87E"}, 20},
86 {{"Red", "#E2887F"}, 10},
90 function furrybot.get_waifu_eyes()
91 return furrybot.random_distribution({
92 {{"Brown", "#463230"}, 15},
93 {{"Blue", "#97C6FE"}, 10},
94 {{"Green", "#36CC4E"}, 5},
98 function furrybot.get_waifu_age()
99 local agetab = furrybot.random_distribution({
100 {{200, 600}, 25}, -- deamon
101 {{1000, 2000}, 5}, -- next level deamon
102 {{12, 16}, 50}, -- teen loli
103 {{18, 19}, 5}, -- legal loli
104 {{5, 9}, 5}, -- true loli
108 return agetab and math.random(agetab[1], agetab[2])
111 function furrybot.get_waifu(id)
112 id = id or math.random(0, 32767)
118 name = furrybot.get_waifu_name(),
119 species = furrybot.get_waifu_species(),
120 gender = furrybot.get_waifu_gender(),
121 hair = furrybot.get_waifu_hair(),
122 eyes = furrybot.get_waifu_eyes(),
123 age = furrybot.get_waifu_age(),
126 math.randomseed(os.time() + os.clock() + math.random())
131 furrybot.commands.waifu = {
132 func = function(name, id)
133 local waifu = furrybot.get_waifu(tonumber(id or ""))
134 furrybot.send(waifu.name
135 .. furrybot.colors.system .. (waifu.species and " | Species: " .. furrybot.colors.random .. waifu.species or "")
136 .. furrybot.colors.system .. " | Age: " .. furrybot.colors.random .. (waifu.age or "Unknown")
137 .. furrybot.colors.system .. " | Gender: " .. furrybot.colors.random .. waifu.gender
138 .. furrybot.colors.system .. " | " .. C(waifu.hair[2]) .. waifu.hair[1] .. furrybot.colors.system .. " Hair"
139 .. furrybot.colors.system .. " | " .. C(waifu.eyes[2]) .. waifu.eyes[1] .. furrybot.colors.system .. " Eyes"
140 .. furrybot.colors.system .. " | " .. "#" .. waifu.id .. ""
141 , furrybot.colors.random)
145 return function(_http, _env, _storage)
146 http, env, storage = _http, _env, _storage
148 local function read_file(path)
149 local f = env.io.open("clientmods/furrybot/" .. path, "r")
150 local data = f:read("*a")
156 furrybot.hiragana.map = minetest.deserialize(read_file("hiragana"))
157 furrybot.hiragana.list = {}
159 local src = read_file("Japanese-Lipsum.txt")
162 local c = utf8.sub(src, i, i)
164 if furrybot.hiragana.map[c] then
165 table.insert(furrybot.hiragana.list, c)