Example #1
0
        public static void ReconstructSurvivors()
        {
            SurvivorCatalog.survivorMaxCount = Mathf.Max(SurvivorDefinitions.Count, 10);

            for (int i = 0; i < SurvivorDefinitions.Count; i++)
            {
                SurvivorDefinitions[i].survivorIndex = (SurvivorIndex)i;
            }

            SurvivorCatalog.idealSurvivorOrder = SurvivorDefinitions.Select(x => x.survivorIndex).ToArray();

            survivorDefs.SetValue(null, SurvivorDefinitions.ToArray());
            allSurvivorDefs.SetValue(null, SurvivorDefinitions.ToArray());

            ViewablesCatalog.Node node = new ViewablesCatalog.Node("/Survivors/", true, null);

            var existingNode = ViewablesCatalog.FindNode("/Survivors/");

            //this essentially deletes an existing node if it exists
            existingNode?.SetParent(new ViewablesCatalog.Node("dummy", true, null));

            for (var i = 0; i < SurvivorDefinitions.Count; i++)
            {
                var survivor = SurvivorDefinitions[i];

                ViewablesCatalog.Node survivorEntryNode = new ViewablesCatalog.Node(survivor.displayNameToken, false, node);
                survivorEntryNode.shouldShowUnviewed = userProfile => !userProfile.HasViewedViewable(survivorEntryNode.fullName) && userProfile.HasSurvivorUnlocked(survivor.survivorIndex) && !string.IsNullOrEmpty(survivor.unlockableName);
            }

            ViewablesCatalog.AddNodeToRoot(node);
        }
Example #2
0
        //Using start because you should never use Awake() unless you specifically need to.
        public void Start()
        {
            configWrappingPaper = Config.Wrap <bool>("Settings", "Use default crosshair", "Use the default dot crosshair?", false);

            //Get the gameobject for huntress
            GameObject huntress = BodyCatalog.FindBodyPrefab("HuntressBody");

            if (!huntress)
            {
                Debug.Log("Huntress prefab not found, breaking");
                return;
            }

            if (!configWrappingPaper.Value)
            {
                huntress.GetComponent <CharacterBody>().crosshairPrefab = Resources.Load <GameObject>("prefabs/crosshair/tiltedbracketcrosshair");
            }

            SkillFamily huntressPrimaryFamily = LoadoutUtilities.GetSkillFamily(huntress, SkillSlot.Primary);

            Sprite huntressPrimarySprite = Resources.Load <Sprite>("NotActuallyAPath");

            ViewablesCatalog.Node huntressPrimaryNode = LoadoutUtilities.CreateViewableNode("ReinHuntressPrimary");

            LoadoutUtilities.NewSkillInfo huntressPrimary = new LoadoutUtilities.NewSkillInfo
            {
                activationState            = new SerializableEntityStateType(typeof(ReinHuntressSkills.Skills.Primary.HuntressPrimary)),
                activationStateMachineName = "Weapon",
                icon                         = huntressPrimarySprite,
                viewableNode                 = huntressPrimaryNode,
                unlockableName               = "",
                skillName                    = "RandomName1",
                skillNameToken               = "RandomName1",
                skillDescriptionToken        = "This skill does stuff",
                interruptPriority            = InterruptPriority.Any,
                baseRechargeInterval         = 0f,
                baseMaxStock                 = 1,
                rechargeStock                = 1,
                isBullets                    = false,
                shootDelay                   = 0.3f,
                beginSkillCooldownOnSkillEnd = false,
                requiredStock                = 1,
                stockToConsume               = 1,
                canceledFromSprinting        = false,
                noSprint                     = false,
                isCombatSkill                = true,
                mustKeyPress                 = false,
                fullRestockOnAssign          = true
            };

            LoadoutUtilities.AddSkillToVariants(huntressPrimaryFamily, huntressPrimary);
        }
        // Token: 0x0600244A RID: 9290 RVA: 0x000AA504 File Offset: 0x000A8704
        private bool Check()
        {
            if (LocalUserManager.readOnlyLocalUsersList.Count == 0)
            {
                return(false);
            }
            UserProfile userProfile = LocalUserManager.readOnlyLocalUsersList[0].userProfile;

            ViewablesCatalog.Node node = ViewablesCatalog.FindNode(this.viewableName ?? "");
            if (node == null)
            {
                Debug.LogErrorFormat("Viewable {0} is not defined.", new object[]
                {
                    this.viewableName
                });
                return(false);
            }
            return(node.shouldShowUnviewed(userProfile));
        }
Example #4
0
        private void AddPlasmoidLaunchers()
        {
            SkillAPI.AddSkill(typeof(ChargePlasmoids));
            SkillFamily skillFamily = LoadoutHelper.GetSkillFamily(EngiBody, SkillSlot.Primary);

            ViewablesCatalog.Node viewableNode = new ViewablesCatalog.Node("UnoEngiPrimary", false);
            Sprite icon = Resources.Load <Sprite>("UnoTODOActualIcon");

            NewSkillInfo nsi = new NewSkillInfo
            {
                activationState            = new SerializableEntityStateType(typeof(ChargePlasmoids)),
                activationStateMachineName = "Weapon",
                icon                         = icon,
                viewableNode                 = viewableNode,
                unlockableName               = string.Empty,
                skillName                    = "Plasmoid Launchers",
                skillNameToken               = "UNO_ENGIPLUS_PLASMOIDS_NAME",
                skillDescriptionToken        = "UNO_ENGIPLUS_PLASMOIDS_DESC",
                interruptPriority            = InterruptPriority.Skill,
                baseRechargeInterval         = 0f,
                baseMaxStock                 = 1,
                rechargeStock                = 1,
                isBullets                    = false,
                shootDelay                   = 0f,
                beginSkillCooldownOnSkillEnd = false,
                requiredStock                = 1,
                stockToConsume               = 1,
                canceledFromSprinting        = false,
                noSprint                     = false,
                isCombatSkill                = true,
                mustKeyPress                 = true,
                fullRestockOnAssign          = true
            };

            LoadoutHelper.AddSkillVariant(skillFamily, nsi);
        }
Example #5
0
        public static void Init()
        {
            SurvivorDefinitions = new ObservableCollection <SurvivorDef>(new List <SurvivorDef>
            {
                new SurvivorDef
                {
                    bodyPrefab       = BodyCatalog.FindBodyPrefab("CommandoBody"),
                    displayPrefab    = Resources.Load <GameObject>("Prefabs/CharacterDisplays/CommandoDisplay"),
                    descriptionToken = "COMMANDO_DESCRIPTION",
                    primaryColor     = new Color(0.929411769f, 0.5882353f, 0.07058824f),
                    survivorIndex    = SurvivorIndex.Commando
                },
                new SurvivorDef
                {
                    bodyPrefab       = BodyCatalog.FindBodyPrefab("EngiBody"),
                    displayPrefab    = Resources.Load <GameObject>("Prefabs/CharacterDisplays/EngiDisplay"),
                    descriptionToken = "ENGI_DESCRIPTION",
                    primaryColor     = new Color(0.372549027f, 0.8862745f, 0.5254902f),
                    unlockableName   = "Characters.Engineer",
                    survivorIndex    = SurvivorIndex.Engineer
                },
                new SurvivorDef
                {
                    bodyPrefab       = BodyCatalog.FindBodyPrefab("HuntressBody"),
                    displayPrefab    = Resources.Load <GameObject>("Prefabs/CharacterDisplays/HuntressDisplay"),
                    primaryColor     = new Color(0.8352941f, 0.235294119f, 0.235294119f),
                    descriptionToken = "HUNTRESS_DESCRIPTION",
                    unlockableName   = "Characters.Huntress",
                    survivorIndex    = SurvivorIndex.Huntress
                },
                new SurvivorDef
                {
                    bodyPrefab       = BodyCatalog.FindBodyPrefab("MageBody"),
                    displayPrefab    = Resources.Load <GameObject>("Prefabs/CharacterDisplays/MageDisplay"),
                    descriptionToken = "MAGE_DESCRIPTION",
                    primaryColor     = new Color(0.968627453f, 0.75686276f, 0.992156863f),
                    unlockableName   = "Characters.Mage",
                    survivorIndex    = SurvivorIndex.Mage
                },
                new SurvivorDef
                {
                    bodyPrefab       = BodyCatalog.FindBodyPrefab("MercBody"),
                    displayPrefab    = Resources.Load <GameObject>("Prefabs/CharacterDisplays/MercDisplay"),
                    descriptionToken = "MERC_DESCRIPTION",
                    primaryColor     = new Color(0.423529416f, 0.819607854f, 0.917647064f),
                    unlockableName   = "Characters.Mercenary",
                    survivorIndex    = SurvivorIndex.Merc
                },
                new SurvivorDef
                {
                    bodyPrefab       = BodyCatalog.FindBodyPrefab("ToolbotBody"),
                    displayPrefab    = Resources.Load <GameObject>("Prefabs/CharacterDisplays/ToolbotDisplay"),
                    descriptionToken = "TOOLBOT_DESCRIPTION",
                    primaryColor     = new Color(0.827451f, 0.768627465f, 0.3137255f),
                    unlockableName   = "Characters.Toolbot",
                    survivorIndex    = SurvivorIndex.Toolbot
                }
            });

            SurvivorDefinitions.CollectionChanged += (sender, args) => { ReconstructSurvivors(); };

            SurvivorCatalogReady?.Invoke(null, null);

            HasBeenInit = true;

            SurvivorAPI.survivorDefs.SetValue(null, SurvivorDefinitions.ToArray());
            SurvivorAPI.allSurvivorDefs.SetValue(null, SurvivorDefinitions.ToArray());
            SurvivorCatalog.idealSurvivorOrder = Enumerable.Range(0, SurvivorDefinitions.Count).Cast <SurvivorIndex>().ToArray();

            ViewablesCatalog.Node node = new ViewablesCatalog.Node("Survivors", true, null);

            for (int i = 0; i < SurvivorDefinitions.Count; i++)
            {
                SurvivorDefinitions[i].survivorIndex = (SurvivorIndex)i;
            }

            foreach (var survivor in SurvivorDefinitions)
            {
                ViewablesCatalog.Node survivorEntryNode = new ViewablesCatalog.Node(survivor.survivorIndex.ToString(), false, node);
                survivorEntryNode.shouldShowUnviewed = userProfile => !userProfile.HasViewedViewable(survivorEntryNode.fullName) && userProfile.HasSurvivorUnlocked(survivor.survivorIndex) && !string.IsNullOrEmpty(survivor.unlockableName);
            }

            ViewablesCatalog.AddNodeToRoot(node);
        }
Example #6
0
        internal void LoadoutPanelController_Row_AddButton(On.RoR2.UI.LoadoutPanelController.Row.orig_AddButton orig, object self, LoadoutPanelController owner, Sprite icon, string titleToken, string bodyToken, Color tooltipColor, UnityEngine.Events.UnityAction callback, string unlockableName, ViewablesCatalog.Node viewableNode, bool isWIP = false)
        {
            orig(self, owner, icon, titleToken, bodyToken, tooltipColor, callback, unlockableName, viewableNode, isWIP);

            LoadoutPanelController.Row selfRow = (LoadoutPanelController.Row)self;
            UserProfile userProfile            = selfRow.userProfile;

            if (mod.config.AdvancedIconsSkillShowProcCoefficient.Value || mod.config.AdvancedIconsSkillShowBaseCooldown.Value)
            {
                if (userProfile != null && userProfile.HasUnlockable(unlockableName))
                {
                    BetterUI.sharedStringBuilder.Clear();
                    BetterUI.sharedStringBuilder.Append(Language.GetString(bodyToken));
                    if (mod.config.AdvancedIconsSkillShowBaseCooldown.Value)
                    {
                        BetterUI.print(titleToken);
                        var skillDef = RoR2.Skills.SkillCatalog.GetSkillDef(Utils.TheREALFindSkillIndexByName(titleToken));
                        if (skillDef)
                        {
                            BetterUI.sharedStringBuilder.Append("\n\nCooldown: <style=cIsDamage>");
                            BetterUI.sharedStringBuilder.Append(skillDef.baseRechargeInterval);
                            BetterUI.sharedStringBuilder.Append("</style> second");
                            if (skillDef.baseRechargeInterval != 1)
                            {
                                BetterUI.sharedStringBuilder.Append("s");
                            }
                        }
                    }

                    if (mod.config.AdvancedIconsSkillShowProcCoefficient.Value)
                    {
                        List <ProcCoefficientCatalog.ProcCoefficientInfo> procCoefficientInfos = ProcCoefficientCatalog.GetProcCoefficientInfo(titleToken);

                        if (procCoefficientInfos != null)
                        {
                            foreach (var info in procCoefficientInfos)
                            {
                                BetterUI.sharedStringBuilder.Append("\n\n<size=110%>");
                                BetterUI.sharedStringBuilder.Append(info.name);
                                BetterUI.sharedStringBuilder.Append(":</size>");
                                if (mod.config.AdvancedIconsSkillShowProcCoefficient.Value)
                                {
                                    BetterUI.sharedStringBuilder.Append("\n <style=cIsUtility>Proc Coefficient: ");
                                    BetterUI.sharedStringBuilder.Append(info.procCoefficient);
                                    BetterUI.sharedStringBuilder.Append("</style>");
                                }
                            }
                        }
                    }
                    TooltipProvider tooltipProvider = selfRow.buttons[selfRow.buttons.Count - 1].GetComponent <TooltipProvider>();
                    if (tooltipProvider != null)
                    {
                        tooltipProvider.overrideBodyText = BetterUI.sharedStringBuilder.ToString();
                    }
                }
            }
        }
Example #7
0
 public static ViewablesCatalog.Node CreateViewableNode(string name)
 {
     ViewablesCatalog.Node node = new ViewablesCatalog.Node(name, false);
     return(node);
 }