Beispiel #1
0
        public static void RemoveSoft()
        {
            SDateTime   time = new SDateTime(1, 70);
            CompanyType type = new CompanyType();
            Dictionary <string, string[]> dict = new Dictionary <string, string[]>();
            SimulatedCompany simComp           = new SimulatedCompany("Trainer Company", time, type, dict, 0f);

            simComp.CanMakeTransaction(1000000000f);

            SoftwareProduct[] Products = GameSettings.Instance.simulation.GetAllProducts().Where(product =>
                                                                                                 product.DevCompany == GameSettings.Instance.MyCompany &&
                                                                                                 product.Inventor != GameSettings.Instance.MyCompany.Name).ToArray();

            if (Products.Length == 0)
            {
                return;
            }

            for (int i = 0; i < Products.Length; i++)
            {
                SoftwareProduct Product = Products[i];

                Product.Userbase       = 0;
                Product.PhysicalCopies = 0;
                Product.Marketing      = 0;
                Product.Trade(simComp);
            }

            WindowManager.SpawnDialog("Products that you didn't invent are removed.", false, DialogWindow.DialogType.Information);
        }
Beispiel #2
0
        public static void ForceBankruptAction(string input)
        {
            SimulatedCompany Company =
                GameSettings.Instance.simulation.Companies.FirstOrDefault(company => company.Value.Name == input).Value;

            if (Company == null)
            {
                return;
            }

            Company.Bankrupt = !Company.Bankrupt;
        }
Beispiel #3
0
        public static void TakeoverCompanyAction(string input)
        {
            SimulatedCompany Company = GameSettings.Instance.simulation.Companies
                                       .FirstOrDefault(company => company.Value.Name == input).Value;

            if (Company == null)
            {
                return;
            }

            Company.BuyOut(GameSettings.Instance.MyCompany, true);
            HUD.Instance.AddPopupMessage("Trainer: Company " + Company.Name + " has been takovered by you!", "Cogs", PopupManager.PopUpAction.None, 0, 0, 0, 0);
        }
Beispiel #4
0
        public static void SubDCompanyAction(string input)
        {
            SimulatedCompany Company =
                Settings.simulation.Companies.FirstOrDefault(company => company.Value.Name == input).Value;

            if (Company == null)
            {
                return;
            }

            Company.MakeSubsidiary(Settings.MyCompany);
            HUD.Instance.AddPopupMessage("Trainer: Company " + Company.Name + " is now your subsidiary!", "Cogs", PopupManager.PopUpAction.None, 0, 0, 0, 0);
        }
Beispiel #5
0
        public static void ForceBankruptAction(string input)
        {
            SimulatedCompany Company =
                Settings.simulation.Companies.FirstOrDefault(company => company.Value.Name == input).Value;

            DevConsole.Console.Log("input => " + input + " Company: " + Company);

            if (Company == null)
            {
                return;
            }

            Company.Bankrupt = !Company.Bankrupt;
        }
Beispiel #6
0
        public static void TakeoverCompanyAction(string input)
        {
            SimulatedCompany simulatedCompany = Settings.simulation.Companies
                                                .FirstOrDefault(company => company.Value.Name == input).Value;

            if (simulatedCompany == null)
            {
                HUD.Instance.AddPopupMessage("Trainer: Company " + input + " not found!", "Cogs", PopupManager.PopUpAction.None, 0, 0, 0, 0);
                return;
            }

            Settings.MyCompany.BuyOut(new Company[1]
            {
                simulatedCompany.OwnerCompany
            }, true);

            HUD.Instance.AddPopupMessage("Trainer: Company " + simulatedCompany.Name + " has been takovered by you!", "Cogs", PopupManager.PopUpAction.None, 0, 0, 0, 0);
        }
Beispiel #7
0
        private void Update()
        {
            if (!isActiveAndEnabled || !Helpers.IsGameLoaded)
            {
                return;
            }

            if (Input.GetKey(KeyCode.F1))
            {
                Main.OpenSettingsWindow();
            }

            if (Input.GetKey(KeyCode.F2))
            {
                Main.CloseSettingsWindow();
            }

            if (!_specializationsLoaded && HUD.Instance.mainReputataionBars.company != null)
            {
                LoadSpecializations();
                _specializationsLoaded = true;
                ShowDiscordInvite(displayAsPopup: true);
            }

            if (_defaultEnvironmentISPCostFactor.IsZero())
            {
                _defaultEnvironmentISPCostFactor = Settings.Environment.ISPCostFactor;
            }

            foreach (Furniture furniture in Settings.sRoomManager.AllFurniture)
            {
                if (Helpers.GetProperty(TrainerSettings, "NoiseReduction"))
                {
                    furniture.ActorNoise       = 0f;
                    furniture.EnvironmentNoise = 0f;
                    furniture.FinalNoise       = 0f;
                    furniture.Noisiness        = 0;
                }

                if (Helpers.GetProperty(TrainerSettings, "NoWaterElectricity"))
                {
                    furniture.Water   = 0;
                    furniture.Wattage = 0;
                }

                if (Helpers.GetProperty(TrainerSettings, "DisableFires"))
                {
                    if (furniture.HasUpg && furniture.upg.FireStarter > 0.0f)
                    {
                        furniture.upg.FireStarter = 0.0f;
                    }
                    if (furniture.Parent.IsOnFire)
                    {
                        if (furniture.Parent.Temperature > 40f)
                        {
                            furniture.Parent.Temperature = 21f;
                        }
                        furniture.Parent.StopFire();
                    }
                }

                if (Helpers.GetProperty(TrainerSettings, "IncreaseBookshelfSkill") && furniture.Type == "Bookshelf")
                {
                    furniture.AuraValues[1] = 0.75f;
                }

                //TODO: else 0.25
                if (Helpers.GetProperty(TrainerSettings, "NoMaintenance"))
                {
                    switch (furniture.Type)
                    {
                    case "Chair":
                        if (furniture.Comfort < 1.2f)
                        {
                            furniture.Comfort = 1.5f;
                        }
                        goto case "Ventilation";

                    case "CCTV":
                    case "Computer":
                    case "Lamp":
                    case "Server":
                    case "Product Printer":
                    case "Radiator":
                    case "Sink":
                    case "Toilet":
                    case "Ventilation":
                        break;

                    default:
                        break;
                    }

                    if (furniture.HasUpg && (furniture.upg.Quality < 0.8f || furniture.upg.Broken))
                    {
                        furniture.upg.RepairMe();
                    }
                }
            }

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

                if (Helpers.GetProperty(TrainerSettings, "CleanRooms"))
                {
                    room.ClearDirt();
                }

                if (Helpers.GetProperty(TrainerSettings, "TemperatureLock"))
                {
                    room.Temperature = 21f;
                }

                if (Helpers.GetProperty(TrainerSettings, "FullEnvironment"))
                {
                    room.FurnEnvironment = 8;
                }

                if (Helpers.GetProperty(TrainerSettings, "FullRoomBrightness"))
                {
                    room.IndirectLighting = 16;
                }

                if (Helpers.GetProperty(TrainerSettings, "NoSickness"))
                {
                    room.GermCount = 0f;
                }
            }

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

                if (Helpers.GetProperty(TrainerSettings, "NoSickness"))
                {
                    actor.GermAdd   = 0f;
                    actor.GermCount = 0f;
                    TimeOfDay.Instance.Sick.Clear();
                }

                if (Helpers.GetProperty(TrainerSettings, "LockAge"))
                {
                    employee.AgeMonth = (int)employee.Age * 12;
                    actor.UpdateAgeLook();
                }

                if (Helpers.GetProperty(TrainerSettings, "NoStress"))
                {
                    employee.Stress = 1;
                }

                actor.Effectiveness = (employee.RoleString.Contains("Lead") ? Helpers.GetProperty(Stores, "LeadEfficiencyStore") : Helpers.GetProperty(Stores, "EfficiencyStore")).MakeFloat();

                if (Helpers.GetProperty(TrainerSettings, "FullSatisfaction"))
                {
                    employee.JobSatisfaction = 2f;
                    employee.ActiveComplaint = false;
                    foreach (var thought in employee.Thoughts.Values.ToList())
                    {
                        if (thought.Mood.Negative || thought.Mood.Sue || !string.IsNullOrEmpty(thought.Mood.QuitReason))
                        {
                            employee.Thoughts.Remove(thought.Thought);
                        }
                    }

                    employee.SetMood("LoveWork", actor, 1f);
                }

                if (Helpers.GetProperty(TrainerSettings, "NoNeeds"))
                {
                    employee.Bladder       = 1f;
                    employee.Hunger        = 1f;
                    employee.Energy        = 1f;
                    employee.Social        = 1f;
                    employee.Posture       = 1f;
                    employee.Diligence     = 1f;
                    employee.HadProperFood = true;
                }

                if (Helpers.GetProperty(TrainerSettings, "FreeEmployees"))
                {
                    employee.Salary   = 0f;
                    employee.AskedFor = 0f;
                    employee.Demanded = 0f;
                    employee.ChangeSalary(0f, 0f, actor, false);
                }

                if (Helpers.GetProperty(TrainerSettings, "NoiseReduction"))
                {
                    actor.Noisiness = 0;
                }

                if (Helpers.GetProperty(TrainerSettings, "NoVacation"))
                {
                    actor.VacationMonth = SDateTime.NextMonth(24);
                }

                actor.WalkSpeed = Helpers.GetProperty(TrainerSettings, "IncreaseWalkSpeed") ? 4f : 2f;
            }

            if (Helpers.GetProperty(TrainerSettings, "AutoDistributionDeals"))
            {
                //TimeOfDay.OnDayPassed
                //TimeOfDay.OnMonthPassed
                //bool canHandleLoad = true;
                if (Settings.Distribution != null && Settings.Distribution.Open)
                {
                    //var serverGroup = Settings.GetServerGroup(Settings.Distribution.ServerName);
                    //canHandleLoad = serverGroup.Available >= 0.2f;

                    Settings.Distribution.TimeToCancel = -10f;

                    foreach (var company in Settings.simulation.GetAllCompanies())
                    {
                        if (!company.IsPlayerOwned())
                        {
                            SimulatedCompany simulatedCompany = company as SimulatedCompany;
                            if (simulatedCompany != null)
                            {
                                simulatedCompany.DistributionDealCooldown = 0;
                            }

                            company.HasDistributionDeal = true;
                            //MarketSimulation.DistributionStandardCut = company.HasDistributionDeal ? 1f : 0.3f;
                        }
                    }
                }
            }

            if (Helpers.GetProperty(TrainerSettings, "MoreHostingDeals"))
            {
                int inGameHour = TimeOfDay.Instance.Hour;

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

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

            if (Helpers.GetProperty(TrainerSettings, "DisableBurglars"))
            {
                foreach (var burglar in Settings.sActorManager.Others["Burglars"])
                {
                    burglar.Dismiss();
                    burglar.Despawned = true;
                    Settings.sActorManager.RemoveFromAwaiting(burglar);
                }
            }

            if (Helpers.GetProperty(TrainerSettings, "AutoEndDesign"))
            {
                var designDocuments = Settings.MyCompany.WorkItems
                                      .OfType <DesignDocument>()
                                      .Where(d => d.HasFinished)
                                      .ToList();

                designDocuments.ForEach(designDocument =>
                {
                    designDocument.PromoteAction();
                });
            }

            if (Helpers.GetProperty(TrainerSettings, "AutoEndResearch"))
            {
                var researchWorks = Settings.MyCompany.WorkItems
                                    .OfType <ResearchWork>()
                                    .Where(rw => rw.Finished)
                                    .ToList();

                researchWorks.ForEach(researchWork =>
                {
                    GameSettings.Instance.MyCompany.AddResearch(researchWork.Spec, researchWork.Year);
                    TechLevel tech = GameSettings.Instance.simulation.AddTechLevel(researchWork.Spec, researchWork.Year);
                    if (tech != null)
                    {
                        LegalWork legalWork = new LegalWork(tech);
                        GameSettings.Instance.MyCompany.WorkItems.Add(legalWork);
                        GameSettings.Instance.ApplyDefaultTeams(legalWork, ((int)legalWork.Type).ToString() + "Team");
                    }
                    researchWork.Kill(false);
                });
            }

            if (Helpers.GetProperty(TrainerSettings, "AutoEndPatent"))
            {
                var legalWorks = Settings.MyCompany.WorkItems
                                 .OfType <LegalWork>()
                                 .Where(lw => lw.CurrentStage() == "Finished" &&
                                        lw.Type == LegalWork.WorkType.Patent)
                                 .ToList();

                legalWorks.ForEach(legalWork =>
                {
                    legalWork.PatentNow();
                });
            }

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

            if (Helpers.GetProperty(TrainerSettings, "IncreasePrintSpeed"))
            {
                Settings.ProductPrinters.ForEach(p => p.PrintSpeed = 2f);
            }

            if (Helpers.GetProperty(TrainerSettings, "NoEducationCost"))
            {
                EducationWindow.EdCost = new[]
                {
                    0f, 0f, 0f
                };
            }

            if (Helpers.GetProperty(TrainerSettings, "FreeStaff"))
            {
                Settings.StaffSalaryDue = 0f;
            }

            if (Helpers.GetProperty(TrainerSettings, "NoServerCost"))
            {
                Settings.ServerCost = 0f;
            }

            if (Helpers.GetProperty(TrainerSettings, "NoWaterElectricity"))
            {
                Settings.ElectricityBill = 0f;
                Settings.SolarPanelBill  = 0f;
            }

            GameSettings.MaxFloor = 100;             //10 default
            AI.MaxBoxes           = Helpers.GetProperty(TrainerSettings, "IncreaseCourierCapacity") ? 108 : 54;
            AI.MaxBoxCarry        = Helpers.GetProperty(TrainerSettings, "IncreaseCourierCapacity") ? 18 : 9;
            AI.BoxPrice           = Helpers.GetProperty(TrainerSettings, "ReduceBoxPrice") ? 62.5f : 125;
            Settings.Environment.ISPCostFactor = Helpers.GetProperty(TrainerSettings, "ReduceISPCost") ? _defaultEnvironmentISPCostFactor / 2f : _defaultEnvironmentISPCostFactor;
            Settings.ExpansionCost             = Helpers.GetProperty(TrainerSettings, "ReduceExpansionCost") ? 175f : 350f;
        }