Exemple #1
0
        private static void CCGiveMoney(ConCommandArgs args)
        {
            if (args.Count == 0)
            {
                return;
            }

            if (!TextSerialization.TryParseInvariant(args[0], out uint result))
            {
                return;
            }

            if (args.Count < 2 || args[1].ToLower() != "all")
            {
                CharacterMaster master = args.sender.master;
                if (args.Count >= 2)
                {
                    NetworkUser player = GetNetUserFromString(args[1]);
                    if (player != null)
                    {
                        master = player.master;
                    }
                }
                master.GiveMoney(result);
            }
            else
            {
                TeamManager.instance.GiveTeamMoney(args.sender.master.teamIndex, result);
            }
            Log.Message("$$$");
        }
Exemple #2
0
    public static IEnumerator Setup() {
        ready = false;
        var hudConVar = RoR2.Console.instance.FindConVar("hud_scale");

        if (Config.UI.useHUDScale)
        {
            if (hudConVar != null && TextSerialization.TryParseInvariant(hudConVar.GetString(), out float num))
            {
                hudScale = num / 100f;
            }
        }
        else {
            hudScale = Config.UI.overrideHUDScale;
        }

        while (!ready) {
            yield return new WaitForSeconds(0.1f);
            if (LocalUserManager.GetFirstLocalUser() != null && LocalUserManager.GetFirstLocalUser()?.cameraRigController?.hud != null) {
                screenSize = LocalUserManager.GetFirstLocalUser()?.cameraRigController?.hud.GetComponent<RectTransform>().sizeDelta ?? new Vector2(0,0);
                if (!(screenSize.x <= 1 || screenSize.y <= 1)) {
                    ready = true;
                };
            }
        }
    }
Exemple #3
0
 private static void CCGiveRandomItems(ConCommandArgs args)
 {
     if (args.Count == 0)
     {
         return;
     }
     if (args.senderMasterObject)
     {
         Inventory component = args.senderMasterObject.GetComponent <Inventory>();
         if (component)
         {
             try
             {
                 int num;
                 TextSerialization.TryParseInvariant(args[0], out num);
                 if (num > 0)
                 {
                     WeightedSelection <List <PickupIndex> > weightedSelection = new WeightedSelection <List <PickupIndex> >(8);
                     weightedSelection.AddChoice(Run.instance.availableTier1DropList, 80f);
                     weightedSelection.AddChoice(Run.instance.availableTier2DropList, 19f);
                     weightedSelection.AddChoice(Run.instance.availableTier3DropList, 1f);
                     for (int i = 0; i < num; i++)
                     {
                         List <PickupIndex> list = weightedSelection.Evaluate(UnityEngine.Random.value);
                         component.GiveItem(list[UnityEngine.Random.Range(0, list.Count)].itemIndex, 1);
                     }
                 }
             }
             catch (ArgumentException)
             {
             }
         }
     }
 }
Exemple #4
0
 private static void CCGiveMoney(ConCommandArgs args)
 {
     if (args.Count == 0)
     {
         return;
     }
     if (args.senderMasterObject)
     {
         CharacterMaster component = args.senderMasterObject.GetComponent <CharacterMaster>();
         if (component)
         {
             try
             {
                 int num = 1;
                 if (args.Count > 0)
                 {
                     TextSerialization.TryParseInvariant(args[0], out num);
                 }
                 component.money += (uint)num;
             }
             catch (ArgumentException)
             {
             }
         }
     }
 }
        private static void CCSplitscreenModNoKeyboard(ConCommandArgs args)
        {
            int num = 2;
            int value;

            if (args.Count >= 1 && TextSerialization.TryParseInvariant(args[0], out value))
            {
                num = Mathf.Clamp(value, 1, 4);
            }
            if (!NetworkClient.active)
            {
                UserProfile mainProfile = LocalUserManager.GetFirstLocalUser().userProfile;
                LocalUserManager.ClearUsers();
                LocalUserManager.LocalUserInitializationInfo[] array = new LocalUserManager.LocalUserInitializationInfo[num];
                array[0].player  = ReInput.players.GetPlayer(2);
                array[0].profile = mainProfile;
                if (array[0].profile == null)
                {
                    array[0].profile = UserProfile.CreateGuestProfile();
                    print("SplitscreenMod: Profile could not be loaded. Using guest profile.");
                }
                for (int i = 1; i < num; i++)
                {
                    array[i] = new LocalUserManager.LocalUserInitializationInfo
                    {
                        player  = ReInput.players.GetPlayer(2 + i),
                        profile = UserProfile.CreateGuestProfile()
                    };
                }
                LocalUserManager.SetLocalUsers(array);
            }
        }
Exemple #6
0
        private static void CCUseSeed(ConCommandArgs args)
        {
            if (args.Count == 0)
            {
                string s = "Current Seed is ";
                if (PreGameController.instance)
                {
                    s += PreGameController.instance.runSeed;
                }
                else
                {
                    s += (seed == 0) ? "random" : seed.ToString();
                }
                Log.Message(s);
                return;
            }
            args.CheckArgumentCount(1);
            if (!TextSerialization.TryParseInvariant(args[0], out ulong result))
            {
                throw new ConCommandException("Specified seed is not a parsable uint64.");
            }

            if (PreGameController.instance)
            {
                PreGameController.instance.runSeed = (result == 0) ? RoR2Application.rng.nextUlong  : result;
            }
            seed = result;
            Log.Message($"Seed set to {((seed == 0) ? "vanilla generation" : seed.ToString())}.");
        }
Exemple #7
0
        private static void CCTimeScale(ConCommandArgs args)
        {
            if (args.Count == 0)
            {
                Log.Message(Time.timeScale);
                return;
            }

            if (TextSerialization.TryParseInvariant(args[0], out float scale))
            {
                Time.timeScale = scale;
                Log.Message("Time scale set to " + scale);
            }
            else
            {
                Log.Message("Incorrect arguments. Try: time_scale 0.5");
            }

            NetworkWriter networkWriter = new NetworkWriter();

            networkWriter.StartMessage(101);
            networkWriter.Write((double)Time.timeScale);

            networkWriter.FinishMessage();
            NetworkServer.SendWriterToReady(null, networkWriter, QosChannelIndex.time.intVal);
        }
Exemple #8
0
            // Token: 0x0600193D RID: 6461 RVA: 0x0006CF7C File Offset: 0x0006B17C
            public override void SetString(string newValue)
            {
                string[] array = newValue.Split(new char[]
                {
                    'x'
                });
                int width;

                if (array.Length < 1 || !TextSerialization.TryParseInvariant(array[0], out width))
                {
                    throw new ConCommandException("Invalid resolution format. No width integer. Example: \"1920x1080x60\".");
                }
                int height;

                if (array.Length < 2 || !TextSerialization.TryParseInvariant(array[1], out height))
                {
                    throw new ConCommandException("Invalid resolution format. No height integer. Example: \"1920x1080x60\".");
                }
                int preferredRefreshRate;

                if (array.Length < 3 || !TextSerialization.TryParseInvariant(array[2], out preferredRefreshRate))
                {
                    throw new ConCommandException("Invalid resolution format. No refresh rate integer. Example: \"1920x1080x60\".");
                }
                Screen.SetResolution(width, height, Screen.fullScreenMode, preferredRefreshRate);
            }
Exemple #9
0
            // Methods
            private void Awake()
            {
                questUI = Instantiate(Core.assetBundle.LoadAsset <GameObject>("Assets/QuestUI.prefab"));

                var hudConVar = RoR2.Console.instance.FindConVar("hud_scale");

                if (Questing.Config.useGameHudScale)
                {
                    if (hudConVar != null && TextSerialization.TryParseInvariant(hudConVar.GetString(), out float num))
                    {
                        hudScale = num / 100f;
                    }
                }
                else
                {
                    hudScale = 1f;
                }

                iconBorder           = questUI.transform.Find("iconBorder");
                backgroundBorder     = questUI.transform.Find("backgroundBorder");
                infoBackground       = questUI.transform.Find("background");
                objectiveIconHolder  = iconBorder.Find("icon");
                titleField           = infoBackground.Find("title");
                descriptionField     = infoBackground.Find("description");
                rewardField          = infoBackground.Find("reward");
                equipIconBorder      = infoBackground.Find("equipIconBorder");
                equipIconHolder      = equipIconBorder.Find("equipIcon");
                progressBackground   = infoBackground.Find("progressBackground");
                progressBarPrimary   = progressBackground.Find("progressBarPrimary");
                progressBarSecondary = progressBackground.Find("progressBarSecondary");
                progressField        = progressBackground.Find("progress");

                primaryBarTransform   = progressBarPrimary.GetComponent <RectTransform>();
                secondaryBarTransform = progressBarSecondary.GetComponent <RectTransform>();
            }
            private void RecalcBarRect()
            {
                this.width  = Screen.width;
                this.height = Screen.height;
                TextSerialization.TryParseInvariant(this.scaleVar.GetString(), out this.scale);

                Single barWidth  = this.width * this.barWidthFrac * this.scale / 100;
                Single barHeight = this.height * this.barHeightFrac * this.scale / 100;

                Single spaceSize = barHeight * this.spaceFrac / 10;
                Single barSize   = spaceSize * this.boxHeightFrac;

                this.boxesSpacing = spaceSize;
                this.boxesH       = barSize;
                this.boxesW       = barWidth;

                this.boxesStartH = this.width * this.barPosHFrac;

                Single barV = this.height * this.barPosVFrac;

                this.boxesStartV = barV - (barHeight / 4f);

                this.texW = Mathf.CeilToInt(this.boxesW / 2f);
                this.texH = Mathf.CeilToInt(this.boxesH / 2f);

                for (Int32 i = 0; i < 10; i++)
                {
                    this.boxes[i] = new Rect(this.boxesStartH, this.boxesStartV + (i * (spaceSize)), this.boxesW, this.boxesH);
                }

                this.CreateTextures();
            }
Exemple #11
0
 private static void CCGiveItem(ConCommandArgs args)
 {
     if (args.Count == 0)
     {
         return;
     }
     if (args.senderMasterObject)
     {
         Inventory component = args.senderMasterObject.GetComponent <Inventory>();
         if (component)
         {
             try
             {
                 int count = 1;
                 if (args.Count > 1)
                 {
                     TextSerialization.TryParseInvariant(args[1], out count);
                 }
                 component.GiveItem((ItemIndex)Enum.Parse(typeof(ItemIndex), args[0]), count);
             }
             catch (ArgumentException)
             {
             }
         }
     }
 }
Exemple #12
0
            // Token: 0x0600194A RID: 6474 RVA: 0x0006D19C File Offset: 0x0006B39C
            public override void SetString(string newValue)
            {
                int num;

                if (TextSerialization.TryParseInvariant(newValue, out num))
                {
                    QualitySettings.softParticles = (num != 0);
                }
            }
Exemple #13
0
            // Token: 0x06001935 RID: 6453 RVA: 0x0006CE68 File Offset: 0x0006B068
            public override void SetString(string newValue)
            {
                int vSyncCount;

                if (TextSerialization.TryParseInvariant(newValue, out vSyncCount))
                {
                    QualitySettings.vSyncCount = vSyncCount;
                }
            }
Exemple #14
0
            // Token: 0x06001942 RID: 6466 RVA: 0x0006D0D0 File Offset: 0x0006B2D0
            public override void SetString(string newValue)
            {
                int targetFrameRate;

                if (TextSerialization.TryParseInvariant(newValue, out targetFrameRate))
                {
                    Application.targetFrameRate = targetFrameRate;
                }
            }
Exemple #15
0
        // Token: 0x06002538 RID: 9528 RVA: 0x000AEC90 File Offset: 0x000ACE90
        public override void SetString(string newValue)
        {
            int num;

            if (TextSerialization.TryParseInvariant(newValue, out num))
            {
                this.value = (num != 0);
            }
        }
Exemple #16
0
            // Token: 0x0600195A RID: 6490 RVA: 0x0006D2DC File Offset: 0x0006B4DC
            public override void SetString(string newValue)
            {
                int masterTextureLimit;

                if (TextSerialization.TryParseInvariant(newValue, out masterTextureLimit))
                {
                    QualitySettings.masterTextureLimit = masterTextureLimit;
                }
            }
Exemple #17
0
            // Token: 0x0600196A RID: 6506 RVA: 0x0006D470 File Offset: 0x0006B670
            public override void SetString(string newValue)
            {
                float shadowDistance;

                if (TextSerialization.TryParseInvariant(newValue, out shadowDistance))
                {
                    QualitySettings.shadowDistance = shadowDistance;
                }
            }
            public void FixedUpdate()
            {
                Single temp = 0f;

                if (Screen.width != this.width || Screen.height != this.height || (TextSerialization.TryParseInvariant(this.scaleVar.GetString(), out temp) && temp != this.scale))
                {
                    this.RecalcBarRect();
                }
            }
            // Token: 0x06000B48 RID: 2888 RVA: 0x00037DC0 File Offset: 0x00035FC0
            public override void SetString(string newValue)
            {
                float value;

                if (AkSoundEngine.IsInitialized() && TextSerialization.TryParseInvariant(newValue, out value))
                {
                    AkSoundEngine.SetRTPCValue(this.rtpcName, Mathf.Clamp(value, 0f, 100f));
                }
            }
            // Token: 0x06000B4B RID: 2891 RVA: 0x00037E48 File Offset: 0x00036048
            public override void SetString(string newValue)
            {
                int num;

                if (TextSerialization.TryParseInvariant(newValue, out num))
                {
                    AkSoundEngineController.s_MuteOnFocusLost = (num != 0);
                }
            }
        // Token: 0x0600253D RID: 9533 RVA: 0x000AECD8 File Offset: 0x000ACED8
        public override void SetString(string newValue)
        {
            int value;

            if (TextSerialization.TryParseInvariant(newValue, out value))
            {
                this.value = value;
            }
        }
Exemple #22
0
            // Token: 0x06001952 RID: 6482 RVA: 0x0006D254 File Offset: 0x0006B454
            public override void SetString(string newValue)
            {
                float lodBias;

                if (TextSerialization.TryParseInvariant(newValue, out lodBias))
                {
                    QualitySettings.lodBias = lodBias;
                }
            }
Exemple #23
0
            // Token: 0x06001956 RID: 6486 RVA: 0x0006D298 File Offset: 0x0006B498
            public override void SetString(string newValue)
            {
                int maximumLODLevel;

                if (TextSerialization.TryParseInvariant(newValue, out maximumLODLevel))
                {
                    QualitySettings.maximumLODLevel = maximumLODLevel;
                }
            }
Exemple #24
0
            // Token: 0x0600197E RID: 6526 RVA: 0x0006D778 File Offset: 0x0006B978
            public override void SetString(string newValue)
            {
                float w;

                if (TextSerialization.TryParseInvariant(newValue, out w) && SettingsConVars.PpGammaConVar.colorGradingSettings)
                {
                    SettingsConVars.PpGammaConVar.colorGradingSettings.gamma.value.w = w;
                }
            }
Exemple #25
0
            // Token: 0x06001966 RID: 6502 RVA: 0x0006D42C File Offset: 0x0006B62C
            public override void SetString(string newValue)
            {
                int shadowCascades;

                if (TextSerialization.TryParseInvariant(newValue, out shadowCascades))
                {
                    QualitySettings.shadowCascades = shadowCascades;
                }
            }
Exemple #26
0
            // Token: 0x060009D7 RID: 2519 RVA: 0x0002AF00 File Offset: 0x00029100
            public override void SetString(string newValue)
            {
                int maxCorpses;

                if (TextSerialization.TryParseInvariant(newValue, out maxCorpses))
                {
                    Corpse.maxCorpses = maxCorpses;
                }
            }
Exemple #27
0
            // Token: 0x0600197A RID: 6522 RVA: 0x0006D6DC File Offset: 0x0006B8DC
            public override void SetString(string newValue)
            {
                int num;

                if (TextSerialization.TryParseInvariant(newValue, out num) && SettingsConVars.PpAOConVar.settings)
                {
                    SettingsConVars.PpAOConVar.settings.active = (num == 0);
                }
            }
Exemple #28
0
            // Token: 0x06001158 RID: 4440 RVA: 0x0004C36C File Offset: 0x0004A56C
            public override void SetString(string newValue)
            {
                float timeScale;

                if (TextSerialization.TryParseInvariant(newValue, out timeScale))
                {
                    Time.timeScale = timeScale;
                }
            }
Exemple #29
0
        public override void SetString(string newValue)
        {
            float num;

            if (TextSerialization.TryParseInvariant(newValue, out num) && !float.IsNaN(num) && !float.IsInfinity(num))
            {
                this.value = num;
            }
        }
Exemple #30
0
            // Token: 0x0600115B RID: 4443 RVA: 0x0004C398 File Offset: 0x0004A598
            public override void SetString(string newValue)
            {
                float fixedDeltaTime;

                if (TextSerialization.TryParseInvariant(newValue, out fixedDeltaTime))
                {
                    Time.fixedDeltaTime = fixedDeltaTime;
                }
            }