bool checkRooms(fileRulesNPC.Sleeping sleeping, int max)
    {
        int i     = 0;
        int count = 0;

        while (i < RulesNPC.savedRules.Count)
        {
            if (RulesNPC.savedRules[i].sleeping == sleeping)
            {
                count++;
            }
            i++;
        }

        if (count >= max)
        {
            return(false);
        }

        return(true);
    }
    int ddReturn(int selector)
    {
        if (selector == 0)
        {
            NPCData.Jobs job = NPCCharList.CharRetainers [idxCL].cityJobs;
            switch (job)
            {
            case NPCData.Jobs.CastleRest: return(0);

            case NPCData.Jobs.CastleDomestic: return(1);

            case NPCData.Jobs.CastleCook: return(2);

            case NPCData.Jobs.CastleHealer: return(3);

            case NPCData.Jobs.CastleHunter: return(4);

            case NPCData.Jobs.CastleEntertainer: return(5);

            case NPCData.Jobs.CastleArtisan: return(6);

            case NPCData.Jobs.CastleFarmhand: return(7);

            case NPCData.Jobs.CastleScribe: return(8);

            case NPCData.Jobs.CastleProstitute: return(9);

            case NPCData.Jobs.CastleAccountant: return(10);

            case NPCData.Jobs.CastleSlaveMaster: return(11);

            case NPCData.Jobs.CastleGuard: return(12);

            case NPCData.Jobs.CastleCaptain: return(13);

            case NPCData.Jobs.CastleCourtier: return(14);

            case NPCData.Jobs.CastleCounselor: return(15);

            default: return(0);
            }
        }
        else if (selector == 1)
        {
            fileRulesNPC.Wages wages = RulesNPC.savedRules[idxRN].wage;
            switch (wages)
            {
            case fileRulesNPC.Wages.None: return(0);

            case fileRulesNPC.Wages.Low: return(1);

            case fileRulesNPC.Wages.Average: return(2);

            case fileRulesNPC.Wages.Good: return(3);

            case fileRulesNPC.Wages.High: return(4);

            case fileRulesNPC.Wages.Exorbitant: return(5);

            default: return(0);
            }
        }
        else if (selector == 2)
        {
            fileRulesNPC.Sleeping sleeping = RulesNPC.savedRules[idxRN].sleeping;
            switch (sleeping)
            {
            case fileRulesNPC.Sleeping.Ground: return(0);

            case fileRulesNPC.Sleeping.Barracks: return(1);

            case fileRulesNPC.Sleeping.PrivateRoom: return(2);

            case fileRulesNPC.Sleeping.Boudoir: return(3);

            case fileRulesNPC.Sleeping.MCRoom: return(4);

            case fileRulesNPC.Sleeping.Dungeon: return(5);

            default: return(0);
            }
        }
        else
        {
            fileRulesNPC.Diet diet = RulesNPC.savedRules[idxRN].diet;
            switch (diet)
            {
            case fileRulesNPC.Diet.RancidFood: return(0);

            case fileRulesNPC.Diet.CheapFood: return(1);

            case fileRulesNPC.Diet.FreshFood: return(2);

            case fileRulesNPC.Diet.LeftOvers: return(3);

            case fileRulesNPC.Diet.BeastsCum: return(4);

            default: return(0);
            }
        }
    }
    static void updateSleep(fileRulesNPC.Sleeping sleeping, int idx)
    {
        if (NPCCharList.CharRetainers [idx].isSlave)
        {
            switch (sleeping)
            {
            case fileRulesNPC.Sleeping.Ground:
                if ((int)NPCCharList.CharRetainers [idx].bgUpbring >= 3)
                {
                    NPCCharList.CharRetainers [idx].attHappiness -= Random.Range(1, 2.5f);
                }
                NPCCharList.CharRetainers [idx].attHappiness -= Random.Range(1, 3);
                return;

            case fileRulesNPC.Sleeping.Barracks:
                if ((int)NPCCharList.CharRetainers [idx].bgUpbring >= 3)
                {
                    NPCCharList.CharRetainers [idx].attHappiness -= Random.Range(0.5f, 1.5f);
                }
                return;

            case fileRulesNPC.Sleeping.PrivateRoom:
                NPCCharList.CharRetainers [idx].attHappiness += 0.5f + Random.Range(0, 2);
                return;

            case fileRulesNPC.Sleeping.Boudoir:
                NPCCharList.CharRetainers [idx].attHappiness += 1f + Random.Range(0, 4);
                return;

            case fileRulesNPC.Sleeping.MCRoom:
                if (NPCCharList.CharRetainers [idx].charRelationship >= 70)
                {
                    NPCCharList.CharRetainers [idx].attHappiness += Random.Range(1, 5f);
                }
                else if (NPCCharList.CharRetainers [idx].charRelationship < 30)
                {
                    NPCCharList.CharRetainers [idx].attHappiness -= Random.Range(0, 2);
                }
                else
                {
                    NPCCharList.CharRetainers [idx].attHappiness += Random.Range(0, 3.5f);
                }
                return;

            case fileRulesNPC.Sleeping.Dungeon:
                if ((int)NPCCharList.CharRetainers [idx].bgUpbring >= 3)
                {
                    NPCCharList.CharRetainers [idx].attHappiness -= Random.Range(0.5f, 3f);
                }
                NPCCharList.CharRetainers [idx].attHappiness -= Random.Range(1, 5);

                return;
            }
        }
        else
        {
            switch (sleeping)
            {
            case fileRulesNPC.Sleeping.Ground:
                if ((int)NPCCharList.CharRetainers [idx].bgUpbring >= 3)
                {
                    NPCCharList.CharRetainers [idx].attHappiness -= Random.Range(0, 1.5f);
                }
                NPCCharList.CharRetainers [idx].attHappiness -= Random.Range(0, 3.5f);
                return;

            case fileRulesNPC.Sleeping.Barracks:
                if ((int)NPCCharList.CharRetainers [idx].bgUpbring >= 3)
                {
                    NPCCharList.CharRetainers [idx].attHappiness -= Random.Range(0f, 1f);
                }
                NPCCharList.CharRetainers [idx].attHappiness += Random.Range(0f, 1f);
                return;

            case fileRulesNPC.Sleeping.PrivateRoom:
                NPCCharList.CharRetainers [idx].attHappiness += 1f + Random.Range(0, 2);
                return;

            case fileRulesNPC.Sleeping.Boudoir:
                NPCCharList.CharRetainers [idx].attHappiness += 1.5f + Random.Range(0, 3);
                return;

            case fileRulesNPC.Sleeping.MCRoom:
                if (NPCCharList.CharRetainers [idx].charRelationship >= 70)
                {
                    NPCCharList.CharRetainers [idx].attHappiness += Random.Range(1, 5f);
                }
                else if (NPCCharList.CharRetainers [idx].charRelationship < 30)
                {
                    NPCCharList.CharRetainers [idx].attHappiness -= Random.Range(0, 2);
                }
                else
                {
                    NPCCharList.CharRetainers [idx].attHappiness += Random.Range(0, 3.5f);
                }
                return;

            case fileRulesNPC.Sleeping.Dungeon:
                if ((int)NPCCharList.CharRetainers [idx].bgUpbring >= 3)
                {
                    NPCCharList.CharRetainers [idx].attHappiness -= Random.Range(0.5f, 3f);
                }
                NPCCharList.CharRetainers [idx].attHappiness -= Random.Range(2, 7);

                return;
            }
        }
    }