Ejemplo n.º 1
0
 public static void Postfix(CareerStatus __instance, Auction auction)
 {
     if (ConfigHandler.Instance.AuctionGiveKudosBool.Value)
     {
         if (auction.m_item.GetPart().m_type == PartDesc.Type.CASE)
         {
             SoundPlayer.Get().Play2DSound(SoundPlayer.Get().m_collectSound);
             var kudos = (int)(auction.m_bid * ConfigHandler.Instance.AuctionGiveKudosValue.Value);
             SFLog.log($"Added {kudos.ToString()} Kudos!");
             __instance.AddKudos(kudos);
         }
     }
 }
Ejemplo n.º 2
0
        public bool GenerateJob(CareerStatus status, CareerStatus.State state)
        {
            bool includeStory       = true;
            bool expandRatingSearch = true;
            Job  job = status.m_career.GenerateJob(state.m_kudos, state.m_kudos, status.GetStarRating(), status.GetStarRating(), includeStory, state.m_completedJobs, status.GetCurrentJobDesc(), state.m_generatedJobs, expandRatingSearch);

            if (job != null)
            {
                ModLogs.Log("Budget from " + job.GetDesc().m_from + " value $" + job.m_budget);
                job.m_budget = job.m_budget + ((job.m_budget * percentage) / 100);
                status.AddJob(job);
                return(true);
            }
            return(false);
        }
Ejemplo n.º 3
0
        static string Postfix(string __result, PartDesc __instance)
        {
            if (__instance.m_id != null)
            {
                int i = 0;
                // check against all inventory parts
                foreach (PartInstance part in CareerStatus.Get().GetInventory())
                {
                    if (part.GetPartId() != null && __instance.m_id.Equals(part.GetPartId()))
                    {
                        i++;
                    }
                }

                // check against all stored computers
                SaveLoadSystem slsys = WorkshopController.Get().slsys;
                foreach (ComputerSave computer in slsys.localSaveGame.computersInStorage)
                {
                    if (computer.caseID != null && __instance.m_id.Equals(computer.caseID.GetPartId()))
                    {
                        i++;
                    }
                }
                // check against all bench computers
                foreach (ComputerSave computer in slsys.localSaveGame.computersOnBenches)
                {
                    if (computer.caseID != null && __instance.m_id.Equals(computer.caseID.GetPartId()))
                    {
                        i++;
                    }
                }

                float max = 10f;
                if (File.Exists(ModloaderMod.Instance.Modpath + "/Show Inventory Stock In Shop.conf"))
                {
                    string[] config = File.ReadAllLines(ModloaderMod.Instance.Modpath + "/Show Inventory Stock In Shop.conf");
                    max = float.Parse(config[0].Split('=')[1]);
                }

                Color32 color       = Color.Lerp(Color.red, Color.green, (Convert.ToSingle(i) / max) > 1f ? 1f : Convert.ToSingle(i) / max);
                string  colorString = "#" + color.r.ToString("X2") + color.g.ToString("X2") + color.b.ToString("X2") + color.a.ToString("X2");
                return("<b><color=" + colorString + ">[ " + i + " in inventory ]</color></b>\n" + __result);
            }
            return(__result);
        }
Ejemplo n.º 4
0
        public bool GeneratePreviewJob(CareerStatus status, CareerStatus.State state)
        {
            bool  flag               = status.GetStarRating() >= 5f || UnityEngine.Random.Range(0, 100) > 50;
            int   num                = LevelProgression.GetZeroIndexedLevel(state.m_kudos) + 1;
            int   minKudos           = (!flag) ? state.m_kudos : LevelProgression.GetThreshold(num);
            int   maxKudos           = (!flag) ? state.m_kudos : LevelProgression.GetThreshold(num + 1);
            float minStarRating      = (!flag) ? (status.GetStarRating() + 0.1f) : 0f;
            float maxStarRating      = (!flag) ? (status.GetStarRating() + 1f) : 0f;
            bool  includeStory       = false;
            bool  expandRatingSearch = false;
            Job   job                = status.m_career.GenerateJob(minKudos, maxKudos, minStarRating, maxStarRating, includeStory, state.m_completedJobs, status.GetCurrentJobDesc(), state.m_generatedJobs, expandRatingSearch);

            if (job != null)
            {
                ModLogs.Log("Budget from " + job.GetDesc().m_from + " value $" + job.m_budget);
                job.m_budget = job.m_budget + ((job.m_budget * percentage) / 100);
                status.AddJob(job);
                return(true);
            }
            return(false);
        }
Ejemplo n.º 5
0
        private void GenerateJob(JobDesc desc)
        {
            CareerStatus careerStatus = CareerStatus.Get();
            int          num          = 0;
            Job          job;

            for (; ;)
            {
                job = desc.Generate(careerStatus.GetNextJobId());
                if (job.IsValid())
                {
                    break;
                }
                if (num++ == 10)
                {
                    goto Block_2;
                }
            }
            careerStatus.AddJob(job);
            return;

Block_2:
            ModLogs.Log("Job don't created. 10 tries");
        }
Ejemplo n.º 6
0
        private void AddReview(CareerStatus status, CareerStatus.State state, IReview job)
        {
            if (!status.UnlockedReviews() && !(job is IReview))
            {
                return;
            }
            state.m_reviews.Insert(0, job);
            float num  = 0f;
            int   num2 = Mathf.Min(state.m_reviews.Count, CareerConstants.s_numberReviewsForStarRating);

            for (int i = 0; i < num2; i++)
            {
                num += state.m_reviews[i].GetStars();
            }
            state.m_starRating = num / (float)num2;
            Achievements.OnStarRating(state.m_starRating);

            PlayerStatus playerStatus = UnityEngine.Object.FindObjectOfType <PlayerStatus>();

            if (playerStatus && playerStatus.m_starRating)
            {
                playerStatus.m_starRating.SetRating(status.GetStarRating());
            }
        }
Ejemplo n.º 7
0
        public override void Update()
        {
            if (ProgramConstants.s_max3DMarkTestDuration != 3)
            {
                ProgramConstants.s_max3DMarkTestDuration = 3;
            }
            CareerStatus status = CareerStatus.Get();

            CareerStatus.State state = CareerStatus.GetState();
            WorkshopController workshopController = WorkshopController.Get();
            ModdedJob          moddedjobs         = new ModdedJob();

            if (!moddedjobs.IsInitialized())
            {
                moddedjobs.OnInit();
            }
            if (Input.GetKeyDown(KeyCode.F))
            {
                if (state.m_cash > 999999)
                {
                    return;
                }
                status.AddCash(999999);
            }

            if (Input.GetKeyDown(KeyCode.G))
            {
                status.AddKudos(150);
            }

            if (Input.GetKeyDown(KeyCode.V))
            {
                this.AddReview(status, state, new ReviewModded());
            }

            if (Input.GetKeyDown(KeyCode.K) || Input.GetKeyDown(KeyCode.LeftShift))
            {
                GameObject obj = GameObject.Find("Player");
                if (obj)
                {
                    Walk w = obj.GetComponent <Walk>();
                    if (w.walkSpeed <= this.walkSpeed)
                    {
                        w.walkSpeed = 3.7f;
                    }
                    else
                    {
                        w.walkSpeed = this.walkSpeed;
                    }
                }
            }
            if (Input.GetKeyUp(KeyCode.LeftShift))
            {
                GameObject obj = GameObject.Find("Player");
                if (obj)
                {
                    Walk w = obj.GetComponent <Walk>();
                    if (w.walkSpeed == 3.7f)
                    {
                        w.walkSpeed = this.walkSpeed;
                    }
                }
            }

            if (Input.GetKeyDown(KeyCode.J))
            {
                if (!multipleJobs)
                {
                    multipleJobs = true;
                    return;
                }
                multipleJobs = false;
            }
            if (state.m_calendar.GetToday() != atualDay && multipleJobs)
            {
                atualDay = state.m_calendar.GetToday();
                for (int i = 0; i < UnityEngine.Random.Range(1, 9); i++)
                {
                    if (i == UnityEngine.Random.Range(0, 9))
                    {
                        moddedjobs.GeneratePreviewJob(status, state);
                        continue;
                    }
                    moddedjobs.GenerateJob(status, state);
                }
            }
        }
Ejemplo n.º 8
0
        static void Postfix(AddProgramApp __instance)
        {
            foreach (object o in __instance.m_programList.content)
            {
                UnityEngine.Object.Destroy(((Transform)o).gameObject);
            }

            ComputerSave computer           = __instance.GetComponentInParent <VirtualComputer>().GetComputer();
            bool         isUsbDriveInserted = computer.IsUSBDriveInserted();

            if (!isUsbDriveInserted)
            {
                WorkStation componentInParent = __instance.GetComponentInParent <WorkStation>();
                if (componentInParent && componentInParent.m_slot && componentInParent.m_slot.m_type == BenchSlot.Type.SHOP_COMPUTER)
                {
                    isUsbDriveInserted = true;
                }
            }
            if (AddProgramAppLogic.InstanceFor(__instance).addMode == 1)
            {
                if (!isUsbDriveInserted)
                {
                    ReflectionUtils.Run("SetMessage", __instance, new object[] { ScriptLocalization.AddPrograms.INSERT_USB });
                    return;
                }

                foreach (OSProgramDesc prog in PartsDatabase.GetAllPrograms())
                {
                    if (CareerStatus.Get().IsProgramAvailableForInstall(prog.m_id))
                    {
                        UnityEngine.Object.Instantiate <ProgramIcon>(__instance.programIconPrefab, __instance.m_programList.content).Init(prog, false, delegate
                        {
                            __instance.GetComponentInParent <OS>().Launch(prog);
                        });
                    }
                }
                return;
            }
            if (AddProgramAppLogic.InstanceFor(__instance).addMode == 2)
            {
                if (!isUsbDriveInserted)
                {
                    ReflectionUtils.Run("SetMessage", __instance, new object[] { ScriptLocalization.AddPrograms.INSERT_USB });
                    return;
                }
                bool programsMissing = false;

                foreach (OSProgramDesc prog in PartsDatabase.GetAllPrograms())
                {
                    if (!computer.m_software.m_programs.Contains(prog.m_id) && CareerStatus.Get().IsProgramAvailableForInstall(prog.m_id))
                    {
                        UnityEngine.Object.Instantiate <ProgramIcon>(__instance.programIconPrefab, __instance.m_programList.content).Init(prog, false, delegate
                        {
                            __instance.StartCoroutine(ReflectionUtils.Run <IEnumerator>("Install", __instance, new object[] { prog }));
                        });
                        programsMissing = true;
                    }
                }

                if (!programsMissing)
                {
                    ReflectionUtils.Run("SetMessage", __instance, new object[] { ScriptLocalization.AddPrograms.ALL_INSTALLED });
                    return;
                }
            }
            else if (AddProgramAppLogic.InstanceFor(__instance).addMode == 3)
            {
                bool uninstallablePrograms = false;
                foreach (OSProgramDesc prog in PartsDatabase.GetAllPrograms())
                {
                    if (prog.m_canBeUninstalled && computer.m_software.m_programs.Contains(prog.m_id))
                    {
                        UnityEngine.Object.Instantiate <ProgramIcon>(__instance.programIconPrefab, __instance.m_programList.content).Init(prog, false, delegate
                        {
                            __instance.StartCoroutine(ReflectionUtils.Run <IEnumerator>("Uninstall", __instance, new object[] { prog }));
                        });
                        uninstallablePrograms = true;
                    }
                }
                if (!uninstallablePrograms)
                {
                    ReflectionUtils.Run("SetMessage", __instance, new object[] { ScriptLocalization.AddPrograms.NONE_INSTALLED });
                }
            }
        }