-- [[ mirror formspec :

function selfcare.form.Hygiene(name)
    local plyr = minetest.get_player_by_name(name)

    local s_unedited = selfcare.get(plyr, "smell") or "clean" -- the 'or' prevents crashing
    local s = (s_unedited == "bad") and "bad!" or s_unedited
    local h = selfcare.get(plyr, "hair") or "clean"
    local c = selfcare.get(plyr, "condish") or "soft"
    local t = selfcare.get(plyr, "teeth") or "white"
    local to = selfcare.get(plyr, "tongue") or "pink"
    local b = selfcare.get(plyr, "breath") or "minty"
    local p = tn(selfcare.get(plyr, "pimples")) or 0
    local fs = selfcare.get(plyr, "faceskin") or "clean" -- cleanliness
    local _fs = selfcare.get(plyr, "_faceskin") or "soft" -- dryness
    local pf = selfcare.get(plyr, "perfume") or "not"
    local _t = selfcare.get(plyr, "_teeth") or "nothing"
    local bdr = selfcare.get(plyr, "b_dryness") or "smooth"
    local bdi = selfcare.get(plyr, "b_dirtiness") or "clean"
    local bi = selfcare.get(plyr, "b_itchiness") or "not"

    local p_spelling = (p == 1) and " pimple" or " pimples"

    local form = "size[4.8,3.8]" ..
	"background[4.5,2;0,0;default_aspen_wood.png^[opacity:50;true]" ..
        "label[0,-0.1;You smell "..s.."]" ..
        "label[0,0.3;Your hair's "..h.." and "..c.."]" ..
        "label[0,0.7;Your teeth are "..t..", breath is "..b..",]" ..
        "label[0,1.1;tongue is "..to..", and there's ".._t.."]" ..
        "label[0,1.5;in-between your teeth.]" ..
        "label[0,1.9;You have "..p..p_spelling.."]" ..
        "label[0,2.3;Your face is "..fs.." and ".._fs.."]" ..
        "label[0,2.7;You "..pf.." wearing perfume]" ..
        "label[0,3.1;Your skin is "..bdr..", "..bdi..",]" ..
        "label[0,3.5;and "..bi.." itchy]" ..
        "button_exit[4.4,-0.2;0.6,0.2;exit;x]"

    minetest.show_formspec(name, "self_care:hygiene", form)
    return form
end




-- [[ figuring out what to show on mirror

local function get_overall_health(plyr)
    local to = selfcare.get(plyr, "tongue") or "pink"
    local b = selfcare.get(plyr, "breath") or "minty"
    local p = tn(selfcare.get(plyr, "pimples")) or 0
    local _t = selfcare.get(plyr, "_teeth") or "nothing"
    local bdr = selfcare.get(plyr, "b_dryness") or "smooth"
    local bdi = selfcare.get(plyr, "b_dirtiness") or "clean"
    local bi = selfcare.get(plyr, "b_itchiness") or "not"
    local __bs, __p, __m = 0, 0, 0

-- why do i do this to myself...

	if bdr == "smooth" or bdr == "soft" then __bs = __bs + 12 end
	if bdr == "normal" then __bs = __bs + 9 end
	if bdr == "slightly dry" or bdr == "slightly flaky" then __bs = __bs + 6 end
	if bdr == "flaky" then __bs = __bs + 3 end
	if bdi == "clean" or bdi == "neutral" then __bs = __bs + 10 end
	if bdi == "slightly unclean" or bdi == "slightly dirty" then __bs = __bs + 6 end
	if bdi == "dirty" or bdi == "grimy" then __bs = __bs + 3 end
	if bi == "" then __bs = __bs + 12 end
	if bi == "a bit" then __bs = __bs + 10 end
	if bi == "very" then __bs = __bs + 6 end
	if bi == "irritatingly" then __bs = __bs + 2 end

	if p > 4 then __p = __p + 5 end
	if p > 2 then __p = __p + 13 end
	if p > 0 then __p = __p + 23 end
	if p == 0 then __p = __p + 34 end

	if to == "pink" then __m = __m + 14 end
	if to == "peach" then __m = __m + 10 end
	if to == "yellow" then __m = __m + 5 end
	if _t == "nothing" then __m = __m + 15 end
	if _t == "some dirt" or _t == "build-up" then __m = __m + 11 end
	if _t == "plaque" then __m = __m + 6 end
	if _t == "a plaque colony" then __m = __m + 2 end -- yikes!
	if b == "minty" then __m = __m + 12 end
	if b == "neutral" then __m = __m + 9 end
	if b == "slightly bad" then __m = __m + 7 end
	if b == "bad" then __m = __m + 4 end

	local body = ts_state(__bs, "body")
	local pimples = ts_state(__p, "pimples")
	local mouth = ts_state(__m, "mouth")


	return {pimples = pimples, bskin = body, mouth = mouth}
end


l ITEMS = {
{"white_loofah", "Loofah", "loofah", 320, 200},
{"floral_bodysoap", color("#ffe0dd", "Floral").." Bodysoap", "bodysoap", 0, nil},
{"almond_bodysoap", color("#b58b80", "Almond").." Bodysoap", "bodysoap", 0, nil},
{"banana_bodysoap", color("#ffd26c", "Banana").." Bodysoap", "bodysoap", 0, nil},
{"watermelon_bodysoap", color("#e08079", "Watermelon").." Bodysoap", "bodysoap", 0, nil},
{"coco_bodyscrub", color("#af9092", "Coconut").." Body Scrub", "bodyscrub", 40, 11, "#af9092"},
{"tropical_bodyscrub", color("#ffb08a", "Tropical").." Body Scrub", "bodyscrub", 45, 11, "#ffb08a"},
{"sugar_bodyscrub", color("#c9a284", "Pure Sugar").." Body Scrub", "bodyscrub", 50, 13, "#c9a284"},
{"strawberry_bodyscrub", color("#ffb5af", "Strawberry").." Body Scrub", "bodyscrub", 40, 11, "#ffb5af"},
{"banana_bodyscrub", color("#fed792", "Banana").." Body Scrub", "bodyscrub", 40, 11, "#fed792"},
{"vanilla_bodyscrub", color("#fdf1ce", "Vanilla").." Body Scrub", "bodyscrub", 45, 12, "#7f5f46"},
{"almond_bodylotion", color("#b17b66", "Almond").." Bodymilk\nall skin types", "lotion", 20, 14}, -- had to change name from bodymilk to bodylotion bc tph_eating tried to eat it lmao
{"strawberry_bodylotion", color("#ffb5af", "Strawberry").." Bodymilk\nall skin types", "lotion", 20, 14},
{"argan_bodyoil", color("#DB957D", "Argan").." Body Oil\n -\nfor "..color("#FFB8F7", "dry")..", "..color("#FFB8D2", "itchy").." skin", "lotionx2", 8, 23, "body"},
{"toothbrush", "Toothbrush", "toothbrush", 15, 115},
{"whitening_strips", "4 Teeth-whitening Strips", "teeth_whitening", 0, 3},
{"tongue_scraper", "Tongue Scraper", "tonguescraper", 3, 0},
{"wooden_toothbrush", color("#ffd7b6", "Wooden").." Toothbrush", "toothbrush", 15, 110},
{"floss", color("#8ed1ff", "Dental").. " Floss", "floss", 0, 130},
{"coco_toothpaste", color("#89675a", "Coconut").." Toothpaste\n whitening\n strengthening\n "..color("#FFCECF", "sensitive"), "toothpaste", 0, nil},
{"mint_toothpaste", color("#9fd1b3", "Mint").." Toothpaste\n refreshing\n"..color("#FFCECF", "anti-plaque").."\nstrengthening", "toothpaste", 0, nil},
{"rosewater_condish", "Conditioner\n"..color("#ffbcc6", "rosewater extracts"), "condish", 14, 17},
{"shea_condish", color("#fce09c", "Shea Butter").." Conditioner\n"..color("#fccf9c", "for thick, coarse hair"), "condish", 24, 19},
{"curl_gel", color("#ffdfc9", "Silicone-Free").." Gel\nno parabens!\n"..color("#f7b6c5", "curl-friendly"), "gel", 10, 13}, 
{"rosemary_shampoo", color("#ff95af", "Rosemary").." Shampoo\n hair growth", "shampoo", 120, 17, "#ffcbd3"}, 
{"coffee_shampoo", color("#94746f", "Coffee").." Shampoo", "shampoo", 148, 19, "#D1A391"}, 
{"curl_shampoo", color("#ff6f8f", "Sulfate-Free").." Shampoo\nno parabens\n"..color("#f7b6c5", "curl-friendly"), "shampoo", 120, 17, "#f794ab"}, 
{"straightener", color("#ffd0d1", "Hair Straightener"), "straightener", 120, 210}, 
{"egg_hairmask", color("#ffb359", "Egg").." Hairmask", "hairmask", 30, 2, "#ffb359"},
{"banana_hairmask", color("#ffd26c", "Banana").." Hairmask", "hairmask", 40, 4, "#FFD26C"},
{"deep_hairmask", color("#A9B388", "Deep Repair").." Hairmask\n"..color("#F9F2EA", "can repair fried hair"), "deephairmask", 60, 2, "#F9F2EA"},
{"oat_facesoap", "Face Soap\n"..color("#dfbda1", "Oat Extracts"), "facesoap", 120, 15, "#fff4ed"},
{"vitaminc_facesoap", "Face Soap\n"..color("#ffb786", "Vitamin C"), "facesoap", 145, 17, "#FFE5D2"},
{"heartleaf_moisturiser", color("#ffdcf3", "Heartleaf").." Face Cream", "moisturizer", 20, 19},
{"pimplepatch", "5 "..color("#ffdad8", "Pimple").." Patches", "pimpatch", 0, 4},
{"vanilla_perfume", color("#fce2ca", "Vanilla").." Perfume\naromas:\n"..color("#755046", "  cocoa\n")..color("#D7B798", "  vanilla\n")..color("#925e53", "  sandalwood"), "perfume", 8, 100, "#fce2ca"},
{"mistletoe_perfume", color("#7DAF65", "Mistle")..color("#B65454", "Toe").." Perfume\naromas:\n"..color("#C39C87", "  gingerbread!").." and\n"..color("#67AB68", "  pine needles"), "perfume", 8, 80, "#FFDFDF"},
{"goddess_bubblebomb", color("#EDD5B4", "[Goddess]").." Bubble Bomb", "bubblebomb", 620, 5, "#FEF1DD"},
{"lily_bubblebomb", color("#FFC8CD", "[Water Lily]").." Bubble bomb", "bubblebomb", 555, 5, "#AED7A1"},
{"heatprotectant", color("#ffb786", "Heat Protectant for Hair"), "heatprotectant", 15, 17},
}