private void InitConfig()
        {
            List <float> configList = new List <float>();

            for (DifficultyIndex i = DifficultyIndex.Easy; i < DifficultyIndex.Count; i++)
            {
                var difficulty = DifficultyCatalog.GetDifficultyDef(i);
                name = Language.GetString(difficulty.nameToken, "EN_US");
                float        multiplier;
                const string catagorie = "DifficultyCoinMultipliers";
                if (i == DifficultyIndex.Easy)
                {
                    configfloat(catagorie, name, 0.5f, out multiplier);
                }
                else if (i == DifficultyIndex.Hard)
                {
                    configfloat(catagorie, name, 2f, out multiplier);
                }
                else
                {
                    configfloat(catagorie, name, 1f, out multiplier);
                }

                configList.Insert((int)i, multiplier);
            }
            difconfigs = configList.ToArray();
        }
Example #2
0
        public void Awake()
        {
            //acquire my assetbundle and give it to the resource api.
            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Diluvian.diluvian"))
            {
                var bundle   = AssetBundle.LoadFromStream(stream);
                var provider = new R2API.AssetBundleResourcesProvider(assetPrefix, bundle);
                R2API.ResourcesAPI.AddProvider(provider);
            }
            //Check ESO existence.
            if (BepInEx.Bootstrap.Chainloader.PluginInfos.ContainsKey("com.jarlyk.eso"))
            {
                ESOenabled = true;
                Logger.LogWarning("ESO detected: Delegating Elite modifications to them. Future support planned.");
            }
            //Index tierDef array.
            CombatDirectorTierDefs = (EliteDef[])typeof(RoR2.CombatDirector).GetFieldCached("eliteTiers").GetValue(null);
            //Init array because we now know the size.
            vanillaEliteMultipliers = new float[CombatDirectorTierDefs.Length];
            //Cache the BloodshrineBehaviour field.
            BloodShrineWaitingForRefresh   = typeof(RoR2.ShrineBloodBehavior).GetField("waitingForRefresh", BindingFlags.Instance | BindingFlags.NonPublic);
            BloodShrinePurchaseInteraction = typeof(RoR2.ShrineBloodBehavior).GetField("purchaseInteraction", BindingFlags.Instance | BindingFlags.NonPublic);

            //Acquire my index from R2API.
            DiluvianIndex = R2API.DifficultyAPI.AddDifficulty(DiluvianDef);

            //Create my description.
            R2API.AssetPlus.Languages.AddToken("DIFFICULTY_DILUVIAN_NAME", "Diluvian");
            string description = "For those found wanting. <style=cDeath>N'Kuhana</style> watches with interest.<style=cStack>\n";

            description = string.Join("\n",
                                      description,
                                      $">Difficulty Scaling: +{DiluvianDef.scalingValue * 50 - 100}%",
                                      $">Player Health Regeneration: {(int)(HealthRegenMultiplier * 100)}%",
                                      ">Player luck: Reduced in some places.",
                                      $">Monster Health Regeneration: +{MonsterRegen * 100}% of MaxHP per second (out of danger)",
                                      ">Oneshot Protection: Also applies to monsters",
                                      $">Oneshot Protection: Protects only {100 - 100 * NewOSPTreshold}%",
                                      $">Elites: {(1 - EliteModifier) * 100}% cheaper.",
                                      ">Shrine of Blood: Cost hidden and random."

                                      );
            description += "</style>";
            R2API.AssetPlus.Languages.AddToken("DIFFICULTY_DILUVIAN_DESCRIPTION", description);

            //This is where my hooks live. They themselves are events, not ONhooks
            RoR2.Run.onRunStartGlobal   += Run_onRunStartGlobal;
            RoR2.Run.onRunDestroyGlobal += Run_onRunDestroyGlobal;
        }
Example #3
0
        public void IncreaseDifficultyScaling()
        {
            pluginLogger.LogInfo("Created Faster Difficulty");

            Color DifficultyColor = new Color(0.94f, 0.51f, 0.15f);

            DifficultyDef FasterDef = new DifficultyDef(
                9f,             // 0 is Normal mode. 2.5f is 50% which is monsoon
                "Faster",
                ":Assets/FasterGames/DifficultyIcon.png",
                "Gotta go Faster!",
                DifficultyColor
                );
            DifficultyIndex DelugeIndex = R2API.DifficultyAPI.AddDifficulty(FasterDef);
        }
        // Token: 0x060018D5 RID: 6357 RVA: 0x0006ADF4 File Offset: 0x00068FF4
        public static RuleDef FromDifficulty()
        {
            RuleDef ruleDef = new RuleDef("Difficulty", "RULE_NAME_DIFFICULTY");

            for (DifficultyIndex difficultyIndex = DifficultyIndex.Easy; difficultyIndex < DifficultyIndex.Count; difficultyIndex++)
            {
                DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(difficultyIndex);
                RuleChoiceDef ruleChoiceDef = ruleDef.AddChoice(difficultyIndex.ToString(), null, false);
                ruleChoiceDef.spritePath       = difficultyDef.iconPath;
                ruleChoiceDef.tooltipNameToken = difficultyDef.nameToken;
                ruleChoiceDef.tooltipNameColor = difficultyDef.color;
                ruleChoiceDef.tooltipBodyToken = difficultyDef.descriptionToken;
                ruleChoiceDef.difficultyIndex  = difficultyIndex;
            }
            ruleDef.defaultChoiceIndex = 1;
            return(ruleDef);
        }
Example #5
0
        public void Awake()
        {
            //acquire my assetbundle and give it to the resource api.
            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Diluvian.Resources.diluvian"))
            {
                var bundle   = AssetBundle.LoadFromStream(stream);
                var provider = new R2API.AssetBundleResourcesProvider(assetPrefix, bundle);
                ResourcesAPI.AddProvider(provider);
            }
            //Check ESO existence.
            if (BepInEx.Bootstrap.Chainloader.PluginInfos.ContainsKey("com.jarlyk.eso"))
            {
                ESOenabled = true;
                Logger.LogWarning("Using ESO's elite cards!");
            }

            diluvianArtist = Config.Bind(new ConfigDefinition("Art", "Diluvian"), "avizvul", new ConfigDescription("The artist for the diluvian icon. Options: \"harb\",\"avizvul\",\"horus\"", new AcceptableValueList <string>(new string[] { "avizvul", "harb", "horus" })));
            syzygyArtist   = Config.Bind(new ConfigDefinition("Art", "OTHER"), "avizvul", new ConfigDescription("The artist for the other icon.Options: \"harb\",\"avizvul\"", new AcceptableValueList <string>(new string[] { "avizvul", "harb" })));

            UnlockablesAPI.AddUnlockable <DiluvianCompletedAchievement>(true);
            UnlockablesAPI.AddUnlockable <SZGAchievement>(true);
            LanguageAPI.Add("COMPLETE_MAINENDING_DILUVIAN_NAME", "Unobscured. Unblinking. Unrelenting.");
            LanguageAPI.Add("COMPLETE_MAINENDING_DILUVIAN_DESC", "Completed the game on Diluvian.");
            LanguageAPI.Add("COMPLETE_AAO_SYZYGY_NAME", "Crescendo");
            LanguageAPI.Add("COMPLETE_AAO_SYZYGY_DESC", "Obliterate on Syzygy difficulty with all artifacts enabled.");

            DiluvianDifficulty.def = new DiluvianDifficulty();
            Dindex = DifficultyAPI.AddDifficulty(DiluvianDifficulty.def.DifficultyDef);
            myDefs.Add(Dindex, DiluvianDifficulty.def);
            Syzygy.def = new Syzygy();
            EDindex    = DifficultyAPI.AddDifficulty(Syzygy.def.DifficultyDef, true);
            myDefs.Add(EDindex, Syzygy.def);

            On.RoR2.RuleDef.FromDifficulty            += RuleDef_FromDifficulty;
            On.RoR2.UI.RuleCategoryController.SetData += RuleCategoryController_SetData;


            //This is where my hooks live. They themselves are events, not ONhooks
            Run.onRunStartGlobal   += Run_onRunStartGlobal;
            Run.onRunDestroyGlobal += Run_onRunDestroyGlobal;
        }
Example #6
0
 private static DifficultyDef GetExtendedDifficultyDef(On.RoR2.DifficultyCatalog.orig_GetDifficultyDef orig, DifficultyIndex difficultyIndex)
 {
     if (difficultyAlreadyAdded)
     {
         return(difficultyDefinitions[(int)difficultyIndex]);
     }
     return(orig(difficultyIndex));
 }
Example #7
0
 public static extern DifficultyDef GetDifficultyDef(DifficultyIndex difficultyIndex);
 // Token: 0x06000ACC RID: 2764 RVA: 0x000355DC File Offset: 0x000337DC
 public static DifficultyDef GetDifficultyDef(DifficultyIndex difficultyIndex)
 {
     return(DifficultyCatalog.difficultyDefs[(int)difficultyIndex]);
 }
Example #9
0
        // Token: 0x060022D8 RID: 8920 RVA: 0x000975E4 File Offset: 0x000957E4
        public void SetDisplayData(GameEndReportPanelController.DisplayData newDisplayData)
        {
            if (this.displayData.Equals(newDisplayData))
            {
                return;
            }
            this.displayData = newDisplayData;
            if (this.resultLabel)
            {
                GameResultType gameResultType = GameResultType.Unknown;
                if (this.displayData.runReport != null)
                {
                    gameResultType = this.displayData.runReport.gameResultType;
                }
                string token;
                if (gameResultType != GameResultType.Lost)
                {
                    if (gameResultType != GameResultType.Won)
                    {
                        token = "GAME_RESULT_UNKNOWN";
                    }
                    else
                    {
                        token = "GAME_RESULT_WON";
                    }
                }
                else
                {
                    token = "GAME_RESULT_LOST";
                }
                this.resultLabel.text = Language.GetString(token);
            }
            DifficultyIndex difficultyIndex = DifficultyIndex.Invalid;

            if (this.displayData.runReport != null)
            {
                difficultyIndex = this.displayData.runReport.ruleBook.FindDifficulty();
            }
            DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(difficultyIndex);

            if (this.selectedDifficultyImage)
            {
                this.selectedDifficultyImage.sprite = ((difficultyDef != null) ? difficultyDef.GetIconSprite() : null);
            }
            if (this.selectedDifficultyLabel)
            {
                this.selectedDifficultyLabel.token = ((difficultyDef != null) ? difficultyDef.nameToken : null);
            }
            RunReport runReport = this.displayData.runReport;

            RunReport.PlayerInfo playerInfo = (runReport != null) ? runReport.GetPlayerInfoSafe(this.displayData.playerIndex) : null;
            this.SetPlayerInfo(playerInfo);
            RunReport runReport2 = this.displayData.runReport;
            int       num        = (runReport2 != null) ? runReport2.playerInfoCount : 0;

            this.playerNavigationController.gameObject.SetActive(num > 1);
            this.playerNavigationController.SetDisplayData(new CarouselNavigationController.DisplayData(num, this.displayData.playerIndex));
            ReadOnlyCollection <MPButton> elements = this.playerNavigationController.buttonAllocator.elements;

            for (int i = 0; i < elements.Count; i++)
            {
                MPButton             mpbutton                = elements[i];
                RunReport.PlayerInfo playerInfo2             = this.displayData.runReport.GetPlayerInfo(i);
                CharacterBody        bodyPrefabBodyComponent = BodyCatalog.GetBodyPrefabBodyComponent(playerInfo2.bodyIndex);
                Texture texture = bodyPrefabBodyComponent ? bodyPrefabBodyComponent.portraitIcon : null;
                mpbutton.GetComponentInChildren <RawImage>().texture = texture;
                mpbutton.GetComponent <TooltipProvider>().SetContent(TooltipProvider.GetPlayerNameTooltipContent(playerInfo2.name));
            }
            this.selectedPlayerEffectRoot.transform.SetParent(this.playerNavigationController.buttonAllocator.elements[this.displayData.playerIndex].transform);
            this.selectedPlayerEffectRoot.gameObject.SetActive(false);
            this.selectedPlayerEffectRoot.gameObject.SetActive(true);
            this.selectedPlayerEffectRoot.offsetMin  = Vector2.zero;
            this.selectedPlayerEffectRoot.offsetMax  = Vector2.zero;
            this.selectedPlayerEffectRoot.localScale = Vector3.one;
        }
Example #10
0
 // Token: 0x06000537 RID: 1335 RVA: 0x000151BC File Offset: 0x000133BC
 public static DifficultyDef GetDifficultyDef(DifficultyIndex difficultyIndex)
 {
     return(HGArrayUtilities.GetSafe <DifficultyDef>(DifficultyCatalog.difficultyDefs, (int)difficultyIndex));
 }