Esempio n. 1
0
        public static bool CreateCooking(
            CraftUI.CreateItem createItem,
            List <StuffItem> itemList,
            float pheromone,
            bool chef)
        {
            if (createItem == null)
            {
                return(false);
            }
            int              count            = 1;
            StuffItem        stuffItem        = new StuffItem(createItem.item);
            List <StuffItem> itemListInPantry = Singleton <Game> .Instance.Environment.ItemListInPantry;
            int              pantryCapacity   = Singleton <Resources> .Instance.DefinePack.ItemBoxCapacityDefines.PantryCapacity;

            if (!((IReadOnlyCollection <StuffItem>)itemListInPantry).CanAddItem(pantryCapacity, stuffItem, count))
            {
                return(false);
            }
            RecipeDataInfo info = createItem.info;

            foreach (RecipeDataInfo.NeedData need in info.NeedList)
            {
                StuffItem.RemoveStorages(new StuffItem(need.CategoryID, need.ID, need.Sum * count), (IReadOnlyCollection <List <StuffItem> >) new List <StuffItem>[2]
                {
                    itemList,
                    itemListInPantry
                });
            }
            float         num1          = 50f;
            StatusProfile statusProfile = Singleton <Resources> .Instance.StatusProfile;
            float         t             = Mathf.InverseLerp(statusProfile.FlavorCookSuccessBoostMinMax.min, statusProfile.FlavorCookSuccessBoostMinMax.max, pheromone);
            float         num2          = statusProfile.FlavorCookSuccessBoost.Lerp(t);
            float         num3          = 0.0f;

            if (chef)
            {
                num3 += (float)statusProfile.ChefCookSuccessBoost;
            }
            if ((double)Random.Range(0.0f, 100f) <= (double)(num1 + num2 + num3))
            {
                itemListInPantry.AddItem(stuffItem, info.CreateSum * count);
            }
            else
            {
                stuffItem.CategoryID = 7;
                stuffItem.ID         = 12;
                itemListInPantry.AddItem(stuffItem, info.CreateSum * count);
            }
            return(true);
        }
Esempio n. 2
0
        private void InitializeProfileFilters(ModuleProfileManagement module)
        {
            View.OrderAscending  = true;
            View.OrderProfilesBy = OrderProfilesBy.SurnameAndName;
            Int32            idDefaultProfileType  = 0;
            long             idDefaultAgency       = 0;
            long             idDefaultProvider     = 0;
            Int32            idDefaultOrganization = 0;
            StatusProfile    defaultStatus         = StatusProfile.Active;
            SearchProfilesBy defaultSearch         = SearchProfilesBy.Contains;

            List <Organization> organizations = Service.GetAvailableOrganizations(UserContext.CurrentUserID, (module.ViewProfiles || module.Administration) ? SearchCommunityFor.SystemManagement : SearchCommunityFor.CommunityManagement);

            if (organizations.Any() || module.Administration || module.ViewProfiles)
            {
                View.LoadAvailableOrganizations(organizations, idDefaultOrganization);
                View.LoadProfileTypes(Service.GetAvailableProfileTypes(View.SelectedIdOrganization), idDefaultProfileType);

                List <dtoBaseProvider> providers = Service.GetAuthenticationProviders(UserContext.Language.Id, true).Where(p => p.isEnabled).ToList();

                View.LoadAuthenticationProviders(providers, idDefaultProvider);

                View.LoadAvailableStatus(Service.GetAvailableStatus(View.SelectedIdOrganization, View.SelectedIdProfileType), defaultStatus);
                View.LoadSearchProfilesBy(GetSearchByItems(module), defaultSearch, UserSelectionType.SystemUsers);
                if (idDefaultProfileType == (int)UserTypeStandard.Employee)
                {
                    View.LoadAgencies(Service.GetAvailableAgencies(View.SelectedIdOrganization), idDefaultAgency, UserSelectionType.SystemUsers);
                }

                dtoFilters filter = View.GetCurrentProfileFilters;
                View.SearchProfileFilters = filter;
                View.InitializeWordSelector(Service.GetAvailableStartLetter(filter, View.UnavailableIdUsers));
                SetDefaultColumns(filter.IdProfileType, module.Administration || module.ViewProfiles, filter.Status);
                View.LoadProfiles(new List <dtoProfileItem <dtoBaseProfile> >());
            }
            else
            {
                View.NoPermission();
            }
        }
Esempio n. 3
0
        private List <ProfileColumn> SetDefaultColumns(Int32 IdProfileType, Boolean displayMail, StatusProfile status)
        {
            List <ProfileColumn> columns = new List <ProfileColumn>();

            columns.Add(ProfileColumn.name);
            if (displayMail)
            {
                columns.Add(ProfileColumn.mail);
            }
            if (IdProfileType <= 0)
            {
                columns.Add(ProfileColumn.type);
            }
            if (IdProfileType == (int)UserTypeStandard.Company)
            {
                columns.Add(ProfileColumn.companyName);
            }
            if (IdProfileType == (int)UserTypeStandard.Employee)
            {
                columns.Add(ProfileColumn.agency);
            }
            if (status == StatusProfile.AllStatus || status == StatusProfile.None)
            {
                columns.Add(ProfileColumn.status);
            }
            View.AvailableColumns = columns;
            return(columns);
        }
        private void InitializeFilters()
        {
            View.OrderAscending = true;
            View.OrderBy        = OrderProfilesBy.SurnameAndName;
            Boolean    loadFilters = View.PreloadedReloadFilters;
            dtoFilters filters     = null;

            if (loadFilters)
            {
                filters = View.GetSavedFilters;
            }

            Int32            idDefaultProfileType  = 0;
            long             idDefaultProvider     = 0;
            long             idDefaultAgency       = 0;
            Int32            idDefaultOrganization = 0;
            StatusProfile    defaultStatus         = StatusProfile.Active;
            SearchProfilesBy defaultSearch         = SearchProfilesBy.Contains;

            View.CurrentModuleView = View.PreLoadedView;
            View.CurrentModuleCode = View.PreLoadedModuleCode;
            int pageIndex = 0;

            if (loadFilters && filters != null)
            {
                idDefaultOrganization = filters.IdOrganization;
                idDefaultProfileType  = filters.IdProfileType;
                idDefaultProvider     = filters.idProvider;

                if (idDefaultProfileType == (int)UserTypeStandard.Employee)
                {
                    idDefaultAgency = filters.IdAgency;
                }
                defaultStatus = filters.Status;
                defaultSearch = filters.SearchBy;
                if (!String.IsNullOrEmpty(filters.StartWith) && !Service.DefaultChars().Contains(filters.StartWith))
                {
                    filters.StartWith = "#";
                }
                View.CurrentStartWith = filters.StartWith;
                View.CurrentValue     = filters.Value;
                View.OrderAscending   = filters.Ascending;
                View.OrderBy          = filters.OrderBy;
                pageIndex             = filters.PageIndex;
                View.CurrentPageSize  = filters.PageSize;
            }
            else
            {
                View.CurrentPageSize = View.PreLoadedPageSize;
            }

            List <Organization> organizations = Service.GetAvailableOrganizations(UserContext.CurrentUserID, (View.CurrentModuleIdCommunity < 1) ? SearchCommunityFor.SystemManagement : SearchCommunityFor.CommunityManagement);

            if (organizations != null && organizations.Any())
            {
                View.LoadAvailableOrganizations(organizations, idDefaultOrganization);
                View.LoadProfileTypes(Service.GetAvailableProfileTypes(View.SelectedIdOrganization), idDefaultProfileType);

                List <dtoBaseProvider> providers = Service.GetAuthenticationProviders(UserContext.Language.Id, true).Where(p => p.isEnabled).ToList();
                View.LoadAvailableStatus(Service.GetAvailableStatus(View.SelectedIdOrganization, View.SelectedIdProfileType), defaultStatus);
                View.LoadSearchProfilesBy(GetSearchByItems(), defaultSearch);
                if (idDefaultProfileType == (int)UserTypeStandard.Employee)
                {
                    View.LoadAgencies(Service.GetAvailableAgencies(View.SelectedIdOrganization), idDefaultAgency);
                }

                View.SearchFilters = View.GetCurrentFilters;
                if (loadFilters && filters != null)
                {
                    LoadProfiles(filters.PageIndex, filters.PageSize);
                }
                else if (filters == null)
                {
                    View.InitializeWordSelector(Service.GetAvailableStartLetter(View.GetCurrentFilters));
                }
            }
            else
            {
                View.NoPermissionToAdmin();
            }
        }
        public static void StatusProfile()
        {
            StatusProfile profile = Resources.Instance.StatusProfile;

            Batch <float>(
                profile,
                "StatusProfile",
                "_buffCook",
                "_buffBath",
                "_buffAnimal",
                "_buffSleep",
                "_buffGift",
                "_buffGimme",
                "_buffEat",
                "_buffPlay",
                "_buffH",
                "_cursedHBuff",
                "_buffLonely",
                "_buffLonelySuperSense",
                "_buffBreak",
                "_buffLocation",
                "_buffSearchTough",
                "_buffSearch",
                "_debuffMood",
                "_debuffMoodInBathDesire",
                "_buffImmoral",
                "_gWifeMotivationBuff",
                "_activeBuffMotivation",
                "_healthyPhysicalBorder",
                "_cursedPhysicalBuff",
                "_immoralBuff",
                "_cursedImmoralBuff",
                "_canClothChangeBorder",
                "_canDressBorder",
                "_defaultInstructionRate",
                "_instructionRateDebuff",
                "_defaultFollowRate",
                "_followRateBuff",
                "_girlsActionProb",
                "_lesbianRate",
                "_shallowSleepProb",
                "_callProbBaseRate",
                "_callProbPhaseRate",
                "_callLowerMoodProb",
                "_callUpperMoodProb",
                "_callSecondTimeProb",
                "_callOverTimeProb",
                "_callProbSuperSense",
                "_handSearchProbBuff",
                "_fishingSearchProbBuff",
                "_pickelSearchProbBuff",
                "_shovelSearchProbBuff",
                "_netSearchProbBuff",
                "_coldDefaultIncidence",
                "_coldLockDuration",
                "_heatStrokeDefaultIncidence",
                "_heatStrokeLockDuration",
                "_hurtDefaultIncidence",
                "_coldRateDebuffWeak",
                "_heatStrokeBuffGuts",
                "_wetRateInRain",
                "_wetRateInStorm",
                "_drySpeed",
                "_wetTemperatureRate",
                "_coldTemperatureValue",
                "_hotTemperatureValue",
                "_lesbianBorderDesire",
                "_shallowSleepHungerLowBorder",
                "_restoreRangeMinuteTime",
                "_potionImmoralAdd",
                "_diureticToiletAdd",
                "_pillSleepAdd"
                );

            Batch <int>(
                profile,
                "StatusProfile",
                "_lustImmoralBuff",
                "_firedBodyImmoralBuff",
                "_lesbianFriendlyRelationBorder",
                "_darknessReduceMaiden",
                "_reliabilityGWifeBuff",
                "_masturbationBorder",
                "_invitationBorder",
                "_revRapeBorder",
                "_lesbianBorder",
                "_holdingHandBorderReliability",
                "_approachBorderReliability",
                "_canGreetBorder",
                "_washFaceBorder",
                "_nightLightBorder",
                "_surpriseBorder",
                "_girlsActionBorder",
                "_talkRelationUpperBorder",
                "_lesbianSociabilityBuffBorder",
                "_chefCookSuccessBoost",
                "_coldBaseDuration",
                "_catCaptureProbBuff",
                "_starveWarinessValue",
                "_starveDarknessValue",
                "_lampEquipableBorder",
                "_soineReliabilityBorder"
                );
        }
Esempio n. 6
0
        public IEnumerable <CommandData> CreateCommandData(string head)
        {
            List <CommandData> list = new List <CommandData>();
            string             str1 = head + "DesireTable";

            foreach (KeyValuePair <int, float> keyValuePair in this.DesireTable)
            {
                KeyValuePair <int, float> item = keyValuePair;
                AgentData agentData            = this;
                int       key = item.Key;
                list.Add(new CommandData(CommandData.Command.FLOAT, str1 + string.Format("[{0}]", (object)key), (Func <object>)(() => (object)item.Value), (System.Action <object>)(o => closure_0.DesireTable[key] = Mathf.Clamp((float)o, 0.0f, 100f))));
            }
            string head1 = head + "SickState";

            this.SickState.AddList(list, head1);
            if (Object.op_Inequality((Object)this.param.actor, (Object)null) && Object.op_Inequality((Object)this.param.actor.ChaControl, (Object)null) && this.param.actor.ChaControl.fileGameInfo != null)
            {
                string str2 = head + "StatsTable";
                foreach (KeyValuePair <int, float> keyValuePair in this.StatsTable)
                {
                    KeyValuePair <int, float> item = keyValuePair;
                    int key = item.Key;
                    list.Add(new CommandData(CommandData.Command.FLOAT, str2 + string.Format("[{0}]", (object)key), (Func <object>)(() => item.Key == 7 ? (object)this.param.actor.ChaControl.fileGameInfo.morality : (object)item.Value), (System.Action <object>)(o =>
                    {
                        AgentActor actor = this.param.actor as AgentActor;
                        if (!Object.op_Inequality((Object)actor, (Object)null))
                        {
                            return;
                        }
                        float num1 = (float)o;
                        if (key == 3)
                        {
                            StatusProfile statusProfile = Singleton <Resources> .Instance.StatusProfile;
                            int flavor = actor.ChaControl.fileGameInfo.flavorState[6];
                            float num2 = AgentActor.FlavorVariation(statusProfile.DarknessPhysicalBuffMinMax, statusProfile.DarknessPhysicalBuff, flavor);
                            num1      += num2;
                        }
                        actor.SetStatus(key, num1);
                    })));
                }
                ChaFileGameInfo            fileGameInfo = this.param.actor.ChaControl.fileGameInfo;
                ChaFileGameInfo.MinMaxInfo tempBound    = fileGameInfo.tempBound;
                string str3 = head + "tempBound";
                list.Add(new CommandData(CommandData.Command.FLOAT, str3 + ".low", (Func <object>)(() => (object)tempBound.lower), (System.Action <object>)null));
                list.Add(new CommandData(CommandData.Command.FLOAT, str3 + ".high", (Func <object>)(() => (object)tempBound.upper), (System.Action <object>)null));
                ChaFileGameInfo.MinMaxInfo MoodBound = fileGameInfo.moodBound;
                string str4 = head + "MoodBound";
                list.Add(new CommandData(CommandData.Command.FLOAT, str4 + ".low", (Func <object>)(() => (object)MoodBound.lower), (System.Action <object>)null));
                list.Add(new CommandData(CommandData.Command.FLOAT, str4 + ".high", (Func <object>)(() => (object)MoodBound.upper), (System.Action <object>)null));
                Dictionary <int, int> flavorState = fileGameInfo.flavorState;
                string str5 = head + "FlavorSkillTable";
                foreach (KeyValuePair <int, int> keyValuePair in flavorState)
                {
                    KeyValuePair <int, int> item = keyValuePair;
                    list.Add(new CommandData(CommandData.Command.Int, str5 + string.Format("[{0}]", (object)item.Key), (Func <object>)(() => (object)item.Value), (System.Action <object>)(o => this.SetFlavorSkill(item.Key, (int)o))));
                }
                string key1 = string.Format("{0}{1}", (object)head, (object)"TalkMotivation");
                list.Add(new CommandData(CommandData.Command.FLOAT, key1, (Func <object>)(() => (object)this.TalkMotivation), (System.Action <object>)(o =>
                {
                    float num           = this.StatsTable[5];
                    this.TalkMotivation = Mathf.Clamp((float)o, 0.0f, num);
                })));
                string key2 = string.Format("{0}InstructProb", (object)head);
                list.Add(new CommandData(CommandData.Command.FLOAT, key2, (Func <object>)(() =>
                {
                    int num1 = fileGameInfo.flavorState[1];
                    StatusProfile statusProfile  = Singleton <Resources> .Instance.StatusProfile;
                    float defaultInstructionRate = statusProfile.DefaultInstructionRate;
                    Threshold instructionMinMax  = statusProfile.FlavorReliabilityInstructionMinMax;
                    float t    = Mathf.InverseLerp(instructionMinMax.min, instructionMinMax.max, (float)num1);
                    float num2 = defaultInstructionRate + statusProfile.FlavorReliabilityInstruction.Lerp(t);
                    if (fileGameInfo.normalSkill.ContainsValue(27))
                    {
                        num2 += statusProfile.InstructionRateDebuff;
                    }
                    return((object)num2);
                }), (System.Action <object>)null));
                string key3 = string.Format("{0}FollowProb", (object)head);
                list.Add(new CommandData(CommandData.Command.FLOAT, key3, (Func <object>)(() =>
                {
                    int num1 = fileGameInfo.flavorState[1];
                    StatusProfile statusProfile = Singleton <Resources> .Instance.StatusProfile;
                    float defaultFollowRate     = statusProfile.DefaultFollowRate;
                    float t    = Mathf.InverseLerp(statusProfile.FollowReliabilityMinMax.min, statusProfile.FollowReliabilityMinMax.max, (float)num1);
                    float num2 = defaultFollowRate + statusProfile.FollowRateReliabilityBuff.Lerp(t);
                    if (fileGameInfo.normalSkill.ContainsValue(8))
                    {
                        num2 += statusProfile.FollowRateBuff;
                    }
                    return((object)num2);
                }), (System.Action <object>)null));
                int    TotalFlavor = fileGameInfo.totalFlavor;
                string key4        = head + "TotalFlavor";
                list.Add(new CommandData(CommandData.Command.Int, key4, (Func <object>)(() => (object)TotalFlavor), (System.Action <object>)null));
                Dictionary <int, float> desireDefVal = fileGameInfo.desireDefVal;
                string str6 = head + "DesireDef";
                foreach (KeyValuePair <int, float> keyValuePair in desireDefVal)
                {
                    KeyValuePair <int, float> item = keyValuePair;
                    int desireKey = Desire.GetDesireKey((Desire.Type)item.Key);
                    list.Add(new CommandData(CommandData.Command.FLOAT, str6 + string.Format("[{0}]", (object)desireKey), (Func <object>)(() => (object)item.Value), (System.Action <object>)null));
                }
                int    Phase = fileGameInfo.phase;
                string key5  = head + "Phase";
                list.Add(new CommandData(CommandData.Command.Int, key5, (Func <object>)(() => (object)Phase), (System.Action <object>)null));
                Dictionary <int, int> NormalSkill = fileGameInfo.normalSkill;
                string str7 = head + "NormalSkill";
                foreach (KeyValuePair <int, int> keyValuePair in NormalSkill)
                {
                    KeyValuePair <int, int> item = keyValuePair;
                    list.Add(new CommandData(CommandData.Command.Int, str7 + string.Format("[{0}]", (object)item.Key), (Func <object>)(() => (object)item.Value), (System.Action <object>)(o => NormalSkill[item.Key] = (int)o)));
                }
                Dictionary <int, int> HSkill = fileGameInfo.hSkill;
                string str8 = head + "HSkill";
                foreach (KeyValuePair <int, int> keyValuePair in HSkill)
                {
                    KeyValuePair <int, int> item = keyValuePair;
                    list.Add(new CommandData(CommandData.Command.Int, str8 + string.Format("[{0}]", (object)item.Key), (Func <object>)(() => (object)item.Value), (System.Action <object>)(o => HSkill[item.Key] = (int)o)));
                }
                int    FavoritePlace = fileGameInfo.favoritePlace;
                string key6          = head + "FavoritePlace";
                list.Add(new CommandData(CommandData.Command.Int, key6, (Func <object>)(() => (object)FavoritePlace), (System.Action <object>)null));
            }
            return((IEnumerable <CommandData>)list);
        }