Exemple #1
0
        public override void Deserialize(WriteDictionary data, GameReader.LoadMode mode)
        {
            var keys = PropertyHelper.Settings.Keys.ToList();

            foreach (var key in keys)
            {
                PropertyHelper.SetProperty(key, data.Get(key, PropertyHelper.GetProperty(key)));
            }
        }
Exemple #2
0
        public override WriteDictionary Serialize(GameReader.LoadMode mode)
        {
            var data = new WriteDictionary();

            foreach (var Pair in PropertyHelper.Settings)
            {
                data[Pair.Key] = PropertyHelper.GetProperty(Pair.Key);
            }

            return(data);
        }
Exemple #3
0
        private void Start()
        {
            PropertyHelper.rnd = new Random(); // Random is time based, this makes it more random

            if (!PropertyHelper.GetProperty("ModActive") || !isActiveAndEnabled)
            {
                return;
            }

            SceneManager.sceneLoaded += OnLevelFinishedLoading;
            StartCoroutine(CustomUpdate());
        }
Exemple #4
0
        private static void Init()
        {
            Window = WindowManager.SpawnWindow();
            Window.InitialTitle   = Window.TitleText.text = Window.NonLocTitle = title;
            Window.MinSize.x      = 670;
            Window.MinSize.y      = 580;
            Window.name           = "TrainerSettings";
            Window.MainPanel.name = "TrainerSettingsPanel";

            if (Window.name == "TrainerSettings")
            {
                Window.GetComponentsInChildren <Button>()
                .SingleOrDefault(x => x.name == "CloseButton")
                .onClick.AddListener(() => shown = false);
            }

            List <GameObject> Buttons = new List <GameObject>();
            List <GameObject> col1    = new List <GameObject>();
            List <GameObject> col2    = new List <GameObject>();
            List <GameObject> col3    = new List <GameObject>();


            Utils.AddInputBox("Product Name Here", new Rect(1, 96, 150, 32),
                              boxText => PropertyHelper.Product_PriceName = boxText);


            Utils.AddButton("Add Money", new Rect(1, 0, 150, 32), TrainerBehaviour.IncreaseMoney);

            Utils.AddButton("Add Reputation", new Rect(161, 0, 150, 32), TrainerBehaviour.AddRep);

            Utils.AddButton("Set Product Price", new Rect(161, 96, 150, 32), TrainerBehaviour.SetProductPrice);

            Utils.AddButton("Set Product Stock", new Rect(322, 96, 150, 32), TrainerBehaviour.SetProductStock);

            Utils.AddButton("Set Active Users", new Rect(483, 96, 150, 32), TrainerBehaviour.AddActiveUsers);

            Utils.AddButton("Max Followers", new Rect(1, 32, 150, 32), TrainerBehaviour.MaxFollowers);

            Utils.AddButton("Fix Bugs", new Rect(161, 32, 150, 32), TrainerBehaviour.FixBugs);

            Utils.AddButton("Max Code", new Rect(322, 32, 150, 32), TrainerBehaviour.MaxCode);

            Utils.AddButton("Max Art", new Rect(483, 32, 150, 32), TrainerBehaviour.MaxArt);

            Utils.AddButton("Takeover Company", new Rect(1, 160, 150, 32), TrainerBehaviour.TakeoverCompany);

            Utils.AddButton("Subsidiary Company", new Rect(161, 160, 150, 32), TrainerBehaviour.SubDCompany);

            Utils.AddButton("Bankrupt", new Rect(322, 160, 150, 32), TrainerBehaviour.ForceBankrupt);

            Utils.AddButton("AI Bankrupt All", TrainerBehaviour.AIBankrupt, ref Buttons);

            Utils.AddButton("Days per month", TrainerBehaviour.MonthDays, ref Buttons);

            Utils.AddButton("Clear all loans", TrainerBehaviour.ClearLoans, ref Buttons);

            Utils.AddButton("HR Leaders", TrainerBehaviour.HREmployees, ref Buttons);

            Utils.AddButton("Max Skill of employees", TrainerBehaviour.EmployeesToMax, ref Buttons);

            Utils.AddButton("Remove Products", TrainerBehaviour.RemoveSoft, ref Buttons);

            Utils.AddButton("Reset age of employees", TrainerBehaviour.ResetAgeOfEmployees, ref Buttons);

            Utils.AddButton("Sell products stock", TrainerBehaviour.SellProductStock, ref Buttons);

            Utils.AddButton("Unlock all furniture", TrainerBehaviour.UnlockFurniture, ref Buttons);

            Utils.AddButton("Unlock all space", TrainerBehaviour.UnlockAllSpace, ref Buttons);

            //Utils.AddButton("Test", TrainerBehaviour.Test, ref Buttons);


            Utils.AddToggle("Disable Needs", PropertyHelper.GetProperty("NoNeeds"),
                            a => PropertyHelper.SetProperty("NoNeeds", !PropertyHelper.GetProperty("NoNeeds")), ref col1);

            Utils.AddToggle("Disable Stress", PropertyHelper.GetProperty("NoStress"),
                            a => PropertyHelper.SetProperty("NoStress", !PropertyHelper.GetProperty("NoStress")), ref col1);

            Utils.AddToggle("Free Employees", PropertyHelper.GetProperty("FreeEmployees"),
                            a => PropertyHelper.SetProperty("FreeEmployees", !PropertyHelper.GetProperty("FreeEmployees")), ref col1);

            Utils.AddToggle("Free Staff", PropertyHelper.GetProperty("FreeStaff"),
                            a => PropertyHelper.SetProperty("FreeStaff", !PropertyHelper.GetProperty("FreeStaff")), ref col1);

            Utils.AddToggle("Full Efficiency", PropertyHelper.GetProperty("FullEfficiency"),
                            a => PropertyHelper.SetProperty("FullEfficiency", !PropertyHelper.GetProperty("FullEfficiency")), ref col1);

            Utils.AddToggle("Full Satisfaction", PropertyHelper.GetProperty("FullSatisfaction"),
                            a => PropertyHelper.SetProperty("FullSatisfaction", !PropertyHelper.GetProperty("FullSatisfaction")), ref col1);

            Utils.AddToggle("Lock Age of Employees", PropertyHelper.GetProperty("LockAge"),
                            a => PropertyHelper.SetProperty("LockAge", !PropertyHelper.GetProperty("LockAge")), ref col1);

            Utils.AddToggle("No Vacation", PropertyHelper.GetProperty("NoVacation"),
                            a => PropertyHelper.SetProperty("NoVacation", !PropertyHelper.GetProperty("NoVacation")), ref col1);

            Utils.AddToggle("No Sickness", PropertyHelper.GetProperty("NoSickness"),
                            a => PropertyHelper.SetProperty("NoSickness", !PropertyHelper.GetProperty("NoSickness")), ref col1);

            Utils.AddToggle("Ultra Efficiency (Tick Full Eff first)", PropertyHelper.GetProperty("UltraEfficiency"),
                            a => PropertyHelper.SetProperty("UltraEfficiency", !PropertyHelper.GetProperty("UltraEfficiency")), ref col1);

            Utils.AddToggle("Full Environment", PropertyHelper.GetProperty("FullEnvironment"),
                            a => PropertyHelper.SetProperty("FullEnvironment", !PropertyHelper.GetProperty("FullEnvironment")), ref col2);

            Utils.AddToggle("Full Sun Light", PropertyHelper.GetProperty("FullRoomBrightness"),
                            a => PropertyHelper.SetProperty("FullRoomBrightness", !PropertyHelper.GetProperty("FullRoomBrightness")), ref col2);

            Utils.AddToggle("Lock Temperature To 21", PropertyHelper.GetProperty("TemperatureLock"),
                            a => PropertyHelper.SetProperty("TemperatureLock", !PropertyHelper.GetProperty("TemperatureLock")), ref col2);

            Utils.AddToggle("No Maintenance", PropertyHelper.GetProperty("NoMaintenance"),
                            a => PropertyHelper.SetProperty("NoMaintenance", !PropertyHelper.GetProperty("NoMaintenance")), ref col2);

            Utils.AddToggle("Noise Reduction", PropertyHelper.GetProperty("NoiseReduction"),
                            a => PropertyHelper.SetProperty("NoiseReduction", !PropertyHelper.GetProperty("NoiseReduction")), ref col2);

            Utils.AddToggle("Rooms Never Dirty", PropertyHelper.GetProperty("CleanRooms"),
                            a => PropertyHelper.SetProperty("CleanRooms", !PropertyHelper.GetProperty("CleanRooms")), ref col2);

            Utils.AddToggle("Auto Distribution Deals", PropertyHelper.GetProperty("AutoDistributionDeals"),
                            a => PropertyHelper.SetProperty("AutoDistributionDeals", !PropertyHelper.GetProperty("AutoDistributionDeals")), ref col3);

            Utils.AddToggle("Free Print", PropertyHelper.GetProperty("FreePrint"),
                            a => PropertyHelper.SetProperty("FreePrint", !PropertyHelper.GetProperty("FreePrint")), ref col3);

            Utils.AddToggle("Free Water & Electricity", PropertyHelper.GetProperty("NoWaterElectricity"),
                            a => PropertyHelper.SetProperty("NoWaterElectricity", !PropertyHelper.GetProperty("NoWaterElectricity")), ref col3);

            Utils.AddToggle("Increase Bookshelf Skill", PropertyHelper.GetProperty("IncreaseBookshelfSkill"),
                            a => PropertyHelper.SetProperty("IncreaseBookshelfSkill", !PropertyHelper.GetProperty("IncreaseBookshelfSkill")), ref col3);

            Utils.AddToggle("Increase Courier Capacity", PropertyHelper.GetProperty("IncreaseCourierCapacity"),
                            a => PropertyHelper.SetProperty("IncreaseCourierCapacity", !PropertyHelper.GetProperty("IncreaseCourierCapacity")), ref col3);

            Utils.AddToggle("Increase Print Speed", PropertyHelper.GetProperty("IncreasePrintSpeed"),
                            a => PropertyHelper.SetProperty("IncreasePrintSpeed", !PropertyHelper.GetProperty("IncreasePrintSpeed")), ref col3);

            Utils.AddToggle("More Hosting Deals", PropertyHelper.GetProperty("MoreHostingDeals"),
                            a => PropertyHelper.SetProperty("MoreHostingDeals", !PropertyHelper.GetProperty("MoreHostingDeals")), ref col3);

            Utils.AddToggle("Reduce Internet Cost", PropertyHelper.GetProperty("ReduceISPCost"),
                            a => PropertyHelper.SetProperty("ReduceISPCost", !PropertyHelper.GetProperty("ReduceISPCost")), ref col3);

            Utils.AddToggle("Disable Skill Decay", PropertyHelper.GetProperty("DisableSkillDecay"),
                            a => PropertyHelper.SetProperty("DisableSkillDecay", !PropertyHelper.GetProperty("DisableSkillDecay")), ref col3);

            Utils.DoLoops(Buttons.ToArray(), col1.ToArray(), col2.ToArray(), col3.ToArray());
        }
Exemple #5
0
        private System.Collections.IEnumerator CustomUpdate()
        {
            while (true)
            {
                yield return(new WaitForSeconds(1f));

                if (!PropertyHelper.GetProperty("ModActive") || !isActiveAndEnabled || !PropertyHelper.DoStuff)
                {
                    yield break;
                }

                if (Input.GetKey(KeyCode.F1) && !Main.IsShowed)
                {
                    Main.SpawnWindow();
                }

                if (Input.GetKey(KeyCode.F2) && Main.IsShowed)
                {
                    Main.SpawnWindow();
                }

                if (PropertyHelper.GetProperty("FreeStaff"))
                {
                    settings.StaffSalaryDue = 0f;
                }

                foreach (Furniture item in settings.sRoomManager.AllFurniture)
                {
                    if (PropertyHelper.GetProperty("NoiseReduction"))
                    {
                        item.ActorNoise       = 0f;
                        item.EnvironmentNoise = 0f;
                        item.FinalNoise       = 0f;
                        item.Noisiness        = 0;
                    }

                    if (PropertyHelper.GetProperty("NoWaterElectricity"))
                    {
                        item.Water   = 0;
                        item.Wattage = 0;
                    }
                }

                for (int i = 0; i < settings.sRoomManager.Rooms.Count; i++)
                {
                    Room room = settings.sRoomManager.Rooms[i];

                    if (PropertyHelper.GetProperty("CleanRooms"))
                    {
                        room.ClearDirt();
                    }

                    if (PropertyHelper.GetProperty("TemperatureLock"))
                    {
                        room.Temperature = 21.4f;
                    }

                    if (PropertyHelper.GetProperty("FullEnvironment"))
                    {
                        room.FurnEnvironment = 4;
                    }

                    if (PropertyHelper.GetProperty("FullRoomBrightness"))
                    {
                        room.IndirectLighting = 8;
                    }
                }

                for (int i = 0; i < settings.sActorManager.Actors.Count; i++)
                {
                    Actor    act      = settings.sActorManager.Actors[i];
                    Employee employee = settings.sActorManager.Actors[i].employee;

                    if (PropertyHelper.GetProperty("DisableSkillDecay"))
                    {
                        for (int index = 0; index < 5; index++)
                        {
                            if (employee.IsRole((Employee.EmployeeRole)index))
                            {
                                employee.ChangeSkillDirect((Employee.EmployeeRole)index, 1f);
                                foreach (var specialization in settings.Specializations)
                                {
                                    employee.AddToSpecialization(Employee.EmployeeRole.Designer, specialization, 1f, 0, true);
                                    employee.AddToSpecialization(Employee.EmployeeRole.Artist, specialization, 1f, 0, true);
                                    employee.AddToSpecialization(Employee.EmployeeRole.Programmer, specialization, 1f, 0, true);
                                }
                            }
                        }
                    }

                    if (PropertyHelper.GetProperty("LockAge"))
                    {
                        act.employee.AgeMonth = (int)act.employee.Age * 12; //20*12
                        act.UpdateAgeLook();
                    }

                    if (PropertyHelper.GetProperty("NoStress"))
                    {
                        act.employee.Stress = 1;
                    }

                    if (PropertyHelper.GetProperty("FullEfficiency"))
                    {
                        if (act.employee.RoleString.Contains("Lead"))
                        {
                            act.Effectiveness = PropertyHelper.GetProperty("UltraEfficiency") ? 20 : 4;
                        }
                        else
                        {
                            act.Effectiveness = PropertyHelper.GetProperty("UltraEfficiency") ? 10 : 2;
                        }
                    }

                    if (PropertyHelper.GetProperty("FullSatisfaction"))
                    {
                        //act.ChangeSatisfaction(10, 10, Employee.Thought.LoveWork, Employee.Thought.LikeTeamWork, 0);
                        employee.JobSatisfaction     = 2f;
                        act.employee.JobSatisfaction = 2f;
                    }

                    if (PropertyHelper.GetProperty("NoNeeds"))
                    {
                        act.employee.Bladder = 1;
                        act.employee.Hunger  = 1;
                        act.employee.Energy  = 1;
                        act.employee.Social  = 1;
                    }

                    if (PropertyHelper.GetProperty("FreeEmployees"))
                    {
                        act.employee.Salary = 0;
                        act.NegotiateSalary = false;
                        act.IgnoreOffSalary = true;
                    }

                    if (PropertyHelper.GetProperty("NoiseReduction"))
                    {
                        act.Noisiness = 0;
                    }

                    if (PropertyHelper.GetProperty("NoVacation"))
                    {
                        act.VacationMonth = SDateTime.NextMonth(24);
                    }
                }

                LoanWindow.factor     = 250000;
                GameSettings.MaxFloor = 75; //10 default
                //settings.scenario.MaxFloor = 75;
                CourierAI.MaxBoxes = PropertyHelper.GetProperty("IncreaseCourierCapacity") ? 108 : 54;
                Server.ISPCost     = PropertyHelper.GetProperty("ReduceISPCost") ? 25f : 50f;

                if (PropertyHelper.GetProperty("AutoDistributionDeals"))
                {
                    foreach (var x in settings.simulation.Companies)
                    {
                        float m = x.Value.GetMoneyWithInsurance(true);

                        if (m < 10000000f)
                        {
                            x.Value.DistributionDeal = 0.05f;
                        }
                        else if (m > 10000000f && m < 100000000f)
                        {
                            x.Value.DistributionDeal = 0.10f;
                        }
                        else if (m > 100000000f && m < 250000000f)
                        {
                            x.Value.DistributionDeal = 0.15f;
                        }
                        else if (m > 250000000f && m < 500000000f)
                        {
                            x.Value.DistributionDeal = 0.20f;
                        }
                        else if (m > 500000000f && m < 1000000000f)
                        {
                            x.Value.DistributionDeal = 0.25f;
                        }
                        else if (m > 1000000000f)
                        {
                            x.Value.DistributionDeal = 0.30f;
                        }
                    }
                }

                if (PropertyHelper.GetProperty("MoreHostingDeals"))
                {
                    int inGameHour = TimeOfDay.Instance.Hour;

                    if ((inGameHour == 9 || inGameHour == 15) && PropertyHelper.DealIsPushed == false)
                    {
                        PushDeal();
                    }
                    else if (inGameHour != 9 && inGameHour != 15 && PropertyHelper.DealIsPushed)
                    {
                        PropertyHelper.DealIsPushed = false;
                    }

                    if (PropertyHelper.RewardIsGained == false && inGameHour == 12)
                    {
                        PushReward();
                    }
                    else if (inGameHour != 12 && PropertyHelper.RewardIsGained)
                    {
                        PropertyHelper.RewardIsGained = false;
                    }
                }

                if (PropertyHelper.GetProperty("IncreasePrintSpeed"))
                {
                    for (int i = 0; i < settings.ProductPrinters.Count; i++)
                    {
                        settings.ProductPrinters[i].PrintSpeed = 2f;
                    }
                }

                //add printspeed and printprice when it's disabled (else) TODO
                if (PropertyHelper.GetProperty("FreePrint"))
                {
                    settings.ProductPrinters.ForEach(p => p.PrintPrice = 0f);
                }

                if (PropertyHelper.GetProperty("IncreaseBookshelfSkill"))
                {
                    foreach (var bookshelf in settings.sRoomManager.AllFurniture)
                    {
                        if (bookshelf.Type != "Bookshelf")
                        {
                            continue;
                        }

                        foreach (var x in bookshelf.AuraValues)
                        {
                            bookshelf.AuraValues[1] = 0.75f;
                        }
                    }
                }

                //else 0.25 TODO
                if (PropertyHelper.GetProperty("NoMaintenance"))
                {
                    foreach (Furniture furniture in settings.sRoomManager.AllFurniture)
                    {
                        switch (furniture.Type)
                        {
                        case "Server":
                        case "Computer":
                        case "Product Printer":
                        case "Ventilation":
                        case "Radiator":
                        case "Lamp":
                        case "Toilet":
                            furniture.upg.Quality = 1f;
                            break;
                        }
                    }
                }

                if (PropertyHelper.GetProperty("NoSickness"))
                {
                    settings.sActorManager.Actors.ForEach(actor => actor.SickDays = 0);
                    //settings.Insurance.SickRatio = 0f;
                }
            }
        }