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 string updateWages(fileRulesNPC.Wages wage, int idx)
    {
        if (NPCCharList.CharRetainers [idx].isSlave)
        {
            //slave
            switch (wage)
            {
            case fileRulesNPC.Wages.None:
                NPCCharList.CharRetainers [idx].attHappiness -= Random.Range(0, 2);
                return("");

            case fileRulesNPC.Wages.Low:
                if (GameControl.charGold < 1)
                {
                    NPCCharList.CharRetainers [idx].attHappiness -= Random.Range(0, 2);
                    return("\n\nYou didn't had enough money to pay " + NPCCharList.CharRetainers [idx].charName + "'s wage!");
                }
                GameControl.charGold -= 1;
                NPCCharList.CharRetainers [idx].attHappiness += Random.Range(0, 1.5f);
                NPCCharList.CharRetainers [idx].charLoyalty  += Random.Range(0, 0.5f);
                return("");

            case fileRulesNPC.Wages.Average:
                if (GameControl.charGold < 3)
                {
                    NPCCharList.CharRetainers [idx].attHappiness -= Random.Range(0, 2);
                    return("\n\nYou didn't had enough money to pay " + NPCCharList.CharRetainers [idx].charName + "'s wage!");
                }
                if (NPCCharList.CharRetainers [idx].attObedience < 50)
                {
                    NPCCharList.CharRetainers [idx].attSpoiled   += Random.Range(0, 2);
                    NPCCharList.CharRetainers [idx].attObedience += Random.Range(0, 1);
                }
                GameControl.charGold -= 3;
                NPCCharList.CharRetainers [idx].attHappiness += Random.Range(1, 3);
                NPCCharList.CharRetainers [idx].charLoyalty  += Random.Range(0, 1);
                return("");

            case fileRulesNPC.Wages.Good:
                if (GameControl.charGold < 5)
                {
                    NPCCharList.CharRetainers [idx].attHappiness -= Random.Range(0, 2);
                    return("\n\nYou didn't had enough money to pay " + NPCCharList.CharRetainers [idx].charName + "'s wage!");
                }
                if (NPCCharList.CharRetainers [idx].attObedience < 50)
                {
                    NPCCharList.CharRetainers [idx].attSpoiled   += Random.Range(0, 4);
                    NPCCharList.CharRetainers [idx].attObedience += Random.Range(0, 1.5f);
                }
                GameControl.charGold -= 5;
                NPCCharList.CharRetainers [idx].attHappiness += Random.Range(1.5f, 4);
                NPCCharList.CharRetainers [idx].charLoyalty  += Random.Range(0, 1.5f);
                return("");

            case fileRulesNPC.Wages.High:
                if (GameControl.charGold < 10)
                {
                    NPCCharList.CharRetainers [idx].attHappiness -= Random.Range(0, 2);
                    return("\n\nYou didn't had enough money to pay " + NPCCharList.CharRetainers [idx].charName + "'s wage!");
                }
                if (NPCCharList.CharRetainers [idx].attObedience < 50)
                {
                    NPCCharList.CharRetainers [idx].attSpoiled   += Random.Range(0, 6);
                    NPCCharList.CharRetainers [idx].attObedience += Random.Range(0, 2f);
                }
                GameControl.charGold -= 10;
                NPCCharList.CharRetainers [idx].attHappiness += Random.Range(2, 5);
                NPCCharList.CharRetainers [idx].charLoyalty  += Random.Range(0, 2);
                return("");

            case fileRulesNPC.Wages.Exorbitant:
                if (GameControl.charGold < 20)
                {
                    NPCCharList.CharRetainers [idx].attHappiness -= Random.Range(0, 2);
                    return("\n\nYou didn't had enough money to pay " + NPCCharList.CharRetainers [idx].charName + "'s wage!");
                }
                if (NPCCharList.CharRetainers [idx].attObedience < 50)
                {
                    NPCCharList.CharRetainers [idx].attSpoiled   += Random.Range(0, 8);
                    NPCCharList.CharRetainers [idx].attObedience += Random.Range(0, 2.5f);
                }
                GameControl.charGold -= 20;
                NPCCharList.CharRetainers [idx].attHappiness += Random.Range(3, 7);
                NPCCharList.CharRetainers [idx].charLoyalty  += Random.Range(1, 3);
                return("");
            }
        }
        else
        {
            //free
            switch (wage)
            {
            case fileRulesNPC.Wages.None:
                NPCCharList.CharRetainers [idx].attHappiness -= 1 + Random.Range(0, 2);
                NPCCharList.CharRetainers [idx].charLoyalty  -= Random.Range(0, 1.5f);
                return("");

            case fileRulesNPC.Wages.Low:
                if (GameControl.charGold < 1)
                {
                    NPCCharList.CharRetainers [idx].attHappiness -= 1 + Random.Range(0, 2);
                    NPCCharList.CharRetainers [idx].charLoyalty  -= Random.Range(0, 1.5f);
                    return("\n\nYou didn't had enough money to pay " + NPCCharList.CharRetainers [idx].charName + "'s wage!");
                }
                GameControl.charGold -= 1;
                NPCCharList.CharRetainers [idx].attHappiness += Random.Range(0, 1f);
                NPCCharList.CharRetainers [idx].charLoyalty  += Random.Range(0, 1f);
                return("");

            case fileRulesNPC.Wages.Average:
                if (GameControl.charGold < 3)
                {
                    NPCCharList.CharRetainers [idx].attHappiness -= 1 + Random.Range(0, 2);
                    NPCCharList.CharRetainers [idx].charLoyalty  -= Random.Range(0, 1.5f);
                    return("\n\nYou didn't had enough money to pay " + NPCCharList.CharRetainers [idx].charName + "'s wage!");
                }
                GameControl.charGold -= 3;
                NPCCharList.CharRetainers [idx].attHappiness += Random.Range(1, 3);
                return("");

            case fileRulesNPC.Wages.Good:
                if (GameControl.charGold < 5)
                {
                    NPCCharList.CharRetainers [idx].attHappiness -= 1 + Random.Range(0, 2);
                    NPCCharList.CharRetainers [idx].charLoyalty  -= Random.Range(0, 1.5f);
                    return("\n\nYou didn't had enough money to pay " + NPCCharList.CharRetainers [idx].charName + "'s wage!");
                }
                GameControl.charGold -= 5;
                NPCCharList.CharRetainers [idx].attHappiness += Random.Range(2, 4);
                NPCCharList.CharRetainers [idx].charLoyalty  += Random.Range(0, 2f);
                return("");

            case fileRulesNPC.Wages.High:
                if (GameControl.charGold < 10)
                {
                    NPCCharList.CharRetainers [idx].attHappiness -= 1 + Random.Range(0, 2);
                    NPCCharList.CharRetainers [idx].charLoyalty  -= Random.Range(0, 1.5f);
                    return("\n\nYou didn't had enough money to pay " + NPCCharList.CharRetainers [idx].charName + "'s wage!");
                }
                GameControl.charGold -= 10;
                NPCCharList.CharRetainers [idx].attHappiness += Random.Range(3, 5);
                NPCCharList.CharRetainers [idx].charLoyalty  += Random.Range(0.5f, 1.5f);
                return("");

            case fileRulesNPC.Wages.Exorbitant:
                if (GameControl.charGold < 20)
                {
                    NPCCharList.CharRetainers [idx].attHappiness -= 1 + Random.Range(0, 2);
                    NPCCharList.CharRetainers [idx].charLoyalty  -= Random.Range(0, 1.5f);
                    return("\n\nYou didn't had enough money to pay " + NPCCharList.CharRetainers [idx].charName + "'s wage!");
                }
                GameControl.charGold -= 20;
                NPCCharList.CharRetainers [idx].attHappiness += Random.Range(3, 7);
                NPCCharList.CharRetainers [idx].charLoyalty  += Random.Range(0.5f, 2f);
                return("");
            }
        }
        return("bug in CastleLivingConditionsUpdate.updateWage");
    }