Пример #1
0
        private static void RegisterBandit()
        {
            var characterObject = Object.Instantiate(BodyCatalog.FindBodyPrefab("BanditBody"));

            Object.DontDestroyOnLoad(characterObject);
            characterObject.SetActive(false);
            var skillLocator = characterObject.GetComponent <SkillLocator>();

            skillLocator.primary.skillNameToken        = "Blast";
            skillLocator.primary.skillDescriptionToken =
                "Fire a powerful slug for <style=cIsDamage>150% damage</style>.";

            skillLocator.secondary.skillNameToken        = "Lights Out";
            skillLocator.secondary.skillDescriptionToken =
                "Take aim for a headshot, dealing <style=cIsDamage>600% damage</style>. If the ability <style=cIsDamage>kills an enemy</style>, the Bandit's <style=cIsUtility>Cooldowns are all reset to 0</style>.";

            skillLocator.utility.skillNameToken        = "Smokebomb";
            skillLocator.utility.skillDescriptionToken =
                "Turn invisible for <style=cIsDamage>3 seconds</style>, gaining <style=cIsUtility>increased movement speed</style>.";

            skillLocator.special.skillNameToken        = "Thermite Toss";
            skillLocator.special.skillDescriptionToken =
                "Fire off a burning Thermite grenade, dealing <style=cIsDamage>damage over time</style>.";

            SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Bandit, new SurvivorDef
            {
                bodyPrefab       = characterObject,
                displayPrefab    = Resources.Load <GameObject>("Prefabs/Characters/BanditDisplay"),
                descriptionToken = "BANDIT_DESCRIPTION",
                primaryColor     = new Color(0.8039216f, 0.482352942f, 0.843137264f)
            });
        }
Пример #2
0
        // Token: 0x06001786 RID: 6022 RVA: 0x0006F750 File Offset: 0x0006D950
        protected void ClientSubmitLeaderboardScore(RunReport runReport)
        {
            if (runReport.gameResultType != GameResultType.Won)
            {
                return;
            }
            bool flag = false;

            using (IEnumerator <NetworkUser> enumerator = NetworkUser.readOnlyLocalPlayersList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    if (enumerator.Current.isParticipating)
                    {
                        flag = true;
                        break;
                    }
                }
            }
            if (!flag)
            {
                return;
            }
            int num = PlayerCharacterMasterController.instances.Count;

            if (num <= 0)
            {
                return;
            }
            if (num >= 3)
            {
                if (num > 4)
                {
                    return;
                }
                num = 4;
            }
            string name = WeeklyRun.GetLeaderboardName(num, this.serverSeedCycle);

            int[]      subScores  = new int[64];
            GameObject bodyPrefab = BodyCatalog.GetBodyPrefab(NetworkUser.readOnlyLocalPlayersList[0].bodyIndexPreference);

            if (!bodyPrefab)
            {
                return;
            }
            SurvivorDef survivorDef = SurvivorCatalog.FindSurvivorDefFromBody(bodyPrefab);

            if (survivorDef == null)
            {
                return;
            }
            subScores[1] = (int)survivorDef.survivorIndex;
            Leaderboard leaderboard = Client.Instance.GetLeaderboard(name, Client.LeaderboardSortMethod.Ascending, Client.LeaderboardDisplayType.TimeMilliSeconds);

            leaderboard.OnBoardInformation = delegate()
            {
                leaderboard.AddScore(true, (int)Math.Ceiling((double)runReport.snapshotTime.t * 1000.0), subScores);
            };
        }
Пример #3
0
 // Token: 0x06001235 RID: 4661 RVA: 0x00059938 File Offset: 0x00057B38
 private void Start()
 {
     if (base.isLocalPlayer)
     {
         LocalUser localUser = LocalUserManager.FindLocalUser((int)base.playerControllerId);
         if (localUser != null)
         {
             localUser.LinkNetworkUser(this);
         }
         if (SceneManager.GetActiveScene().name == "lobby")
         {
             this.CallCmdSetBodyPreference(BodyCatalog.FindBodyIndex("CommandoBody"));
         }
     }
     if (Run.instance)
     {
         Run.instance.OnUserAdded(this);
     }
     if (NetworkClient.active)
     {
         this.SyncLunarCoinsToServer();
         this.SendServerUnlockables();
     }
     NetworkUser.NetworkUserGenericDelegate onPostNetworkUserStart = NetworkUser.OnPostNetworkUserStart;
     if (onPostNetworkUserStart == null)
     {
         return;
     }
     onPostNetworkUserStart(this);
 }
            // Token: 0x060019D1 RID: 6609 RVA: 0x0007B5B0 File Offset: 0x000797B0
            public static RunReport.PlayerInfo Generate(PlayerCharacterMasterController playerCharacterMasterController)
            {
                CharacterMaster      characterMaster = playerCharacterMasterController.master;
                Inventory            inventory       = characterMaster.inventory;
                PlayerStatsComponent component       = playerCharacterMasterController.GetComponent <PlayerStatsComponent>();

                RunReport.PlayerInfo playerInfo = new RunReport.PlayerInfo();
                playerInfo.networkUser     = playerCharacterMasterController.networkUser;
                playerInfo.master          = characterMaster;
                playerInfo.bodyIndex       = BodyCatalog.FindBodyIndex(characterMaster.bodyPrefab);
                playerInfo.killerBodyIndex = characterMaster.GetKillerBodyIndex();
                StatSheet.Copy(component.currentStats, playerInfo.statSheet);
                playerInfo.itemAcquisitionOrder = inventory.itemAcquisitionOrder.ToArray();
                for (ItemIndex itemIndex = ItemIndex.Syringe; itemIndex < ItemIndex.Count; itemIndex++)
                {
                    playerInfo.itemStacks[(int)itemIndex] = inventory.GetItemCount(itemIndex);
                }
                playerInfo.equipment = new EquipmentIndex[inventory.GetEquipmentSlotCount()];
                uint num = 0u;

                while ((ulong)num < (ulong)((long)playerInfo.equipment.Length))
                {
                    playerInfo.equipment[(int)num] = inventory.GetEquipment(num).equipmentIndex;
                    num += 1u;
                }
                return(playerInfo);
            }
Пример #5
0
            // Token: 0x0600192C RID: 6444 RVA: 0x0006CC28 File Offset: 0x0006AE28
            public LoadoutBuilder(SerializableLoadout serializedLoadout)
            {
                SerializableLoadout.BodyLoadout[] bodyLoadouts              = serializedLoadout.bodyLoadouts;
                List <SerializableLoadout.LoadoutBuilder.SkillSetter> list  = new List <SerializableLoadout.LoadoutBuilder.SkillSetter>(8);
                List <SerializableLoadout.LoadoutBuilder.SkinSetter>  list2 = new List <SerializableLoadout.LoadoutBuilder.SkinSetter>(bodyLoadouts.Length);

                for (int i = 0; i < bodyLoadouts.Length; i++)
                {
                    ref SerializableLoadout.BodyLoadout ptr = ref bodyLoadouts[i];
                    CharacterBody body = ptr.body;
                    if (body)
                    {
                        int            bodyIndex            = body.bodyIndex;
                        GenericSkill[] bodyPrefabSkillSlots = BodyCatalog.GetBodyPrefabSkillSlots(bodyIndex);
                        SerializableLoadout.BodyLoadout.SkillChoice[] skillChoices = ptr.skillChoices;
                        int j = 0;
                        while (j < skillChoices.Length)
                        {
                            ref SerializableLoadout.BodyLoadout.SkillChoice ptr2 = ref skillChoices[j];
                            int num  = SerializableLoadout.LoadoutBuilder.FindSkillSlotIndex(bodyPrefabSkillSlots, ptr2.skillFamily);
                            int num2 = SerializableLoadout.LoadoutBuilder.FindSkillVariantIndex(ptr2.skillFamily, ptr2.variant);
                            if (num != -1 && num2 != -1)
                            {
                                list.Add(new SerializableLoadout.LoadoutBuilder.SkillSetter(bodyIndex, num, (uint)num2));
                            }
                            i++;
                        }
                        int num3 = Array.IndexOf <SkinDef>(BodyCatalog.GetBodySkins(bodyIndex), ptr.skinChoice);
                        if (num3 != -1)
                        {
                            list2.Add(new SerializableLoadout.LoadoutBuilder.SkinSetter(bodyIndex, (uint)num3));
                        }
                    }
Пример #6
0
 // Token: 0x06000A0F RID: 2575 RVA: 0x000321FB File Offset: 0x000303FB
 public static int FindBodyIndex(GameObject bodyObject)
 {
     if (!bodyObject)
     {
         return(-1);
     }
     return(BodyCatalog.FindBodyIndex(bodyObject.name));
 }
Пример #7
0
        public static GameObject FindBodyPrefab([NotNull] string bodyName)
        {
            int num = BodyCatalog.FindBodyIndex(bodyName);

            if (num != -1)
            {
                return(BodyCatalog.GetBodyPrefab(num));
            }
            return(null);
        }
Пример #8
0
        // Token: 0x06001C20 RID: 7200 RVA: 0x00083300 File Offset: 0x00081500
        public static CharacterBody TryToCreateGhost(CharacterBody targetBody, CharacterBody ownerBody, int duration)
        {
            if (!targetBody || !NetworkServer.active)
            {
                return(null);
            }
            if (TeamComponent.GetTeamMembers(ownerBody.teamComponent.teamIndex).Count >= 40)
            {
                return(null);
            }
            int num = BodyCatalog.FindBodyIndex(targetBody.gameObject);

            if (num < 0)
            {
                return(null);
            }
            GameObject bodyPrefab = BodyCatalog.GetBodyPrefab(num);

            if (!bodyPrefab)
            {
                return(null);
            }
            CharacterMaster characterMaster = MasterCatalog.allAiMasters.FirstOrDefault((CharacterMaster master) => master.bodyPrefab == bodyPrefab);

            if (!characterMaster)
            {
                return(null);
            }
            GameObject      gameObject = UnityEngine.Object.Instantiate <GameObject>(characterMaster.gameObject);
            CharacterMaster component  = gameObject.GetComponent <CharacterMaster>();

            component.teamIndex = ownerBody.teamComponent.teamIndex;
            component.GetComponent <BaseAI>().leader.gameObject = ownerBody.gameObject;
            Inventory inventory = targetBody.inventory;

            if (inventory)
            {
                component.inventory.CopyItemsFrom(inventory);
                component.inventory.CopyEquipmentFrom(inventory);
            }
            component.inventory.GiveItem(ItemIndex.Ghost, 1);
            component.inventory.GiveItem(ItemIndex.HealthDecay, duration);
            component.inventory.GiveItem(ItemIndex.BoostDamage, 30);
            NetworkServer.Spawn(gameObject);
            CharacterBody characterBody = component.Respawn(targetBody.footPosition, targetBody.transform.rotation);

            if (characterBody)
            {
                foreach (EntityStateMachine entityStateMachine in characterBody.GetComponents <EntityStateMachine>())
                {
                    entityStateMachine.initialStateType = entityStateMachine.mainStateType;
                }
            }
            return(characterBody);
        }
        // Token: 0x06001723 RID: 5923 RVA: 0x00064A78 File Offset: 0x00062C78
        private static void GenerateViewables()
        {
            StringBuilder stringBuilder = new StringBuilder();

            ViewablesCatalog.Node node   = new ViewablesCatalog.Node("Loadout", true, null);
            ViewablesCatalog.Node parent = new ViewablesCatalog.Node("Bodies", true, node);
            for (int i = 0; i < BodyCatalog.bodyCount; i++)
            {
                if (SurvivorCatalog.GetSurvivorIndexFromBodyIndex(i) != SurvivorIndex.None)
                {
                    string                bodyName             = BodyCatalog.GetBodyName(i);
                    GenericSkill[]        bodyPrefabSkillSlots = BodyCatalog.GetBodyPrefabSkillSlots(i);
                    ViewablesCatalog.Node parent2 = new ViewablesCatalog.Node(bodyName, true, parent);
                    for (int j = 0; j < bodyPrefabSkillSlots.Length; j++)
                    {
                        SkillFamily skillFamily = bodyPrefabSkillSlots[j].skillFamily;
                        if (skillFamily.variants.Length > 1)
                        {
                            string skillFamilyName = SkillCatalog.GetSkillFamilyName(skillFamily.catalogIndex);
                            uint   num             = 0U;
                            while ((ulong)num < (ulong)((long)skillFamily.variants.Length))
                            {
                                ref SkillFamily.Variant ptr = ref skillFamily.variants[(int)num];
                                string unlockableName       = ptr.unlockableName;
                                if (!string.IsNullOrEmpty(unlockableName))
                                {
                                    string skillName = SkillCatalog.GetSkillName(ptr.skillDef.skillIndex);
                                    stringBuilder.Append(skillFamilyName).Append(".").Append(skillName);
                                    string name = stringBuilder.ToString();
                                    stringBuilder.Clear();
                                    ViewablesCatalog.Node variantNode = new ViewablesCatalog.Node(name, false, parent2);
                                    ptr.viewableNode = variantNode;
                                    variantNode.shouldShowUnviewed = ((UserProfile userProfile) => !userProfile.HasViewedViewable(variantNode.fullName) && userProfile.HasUnlockable(unlockableName));
                                }
                                num += 1U;
                            }
                        }
                    }
                    SkinDef[] bodySkins = BodyCatalog.GetBodySkins(i);
                    if (bodySkins.Length > 1)
                    {
                        ViewablesCatalog.Node parent3 = new ViewablesCatalog.Node("Skins", true, parent2);
                        for (int k = 0; k < bodySkins.Length; k++)
                        {
                            string unlockableName = bodySkins[k].unlockableName;
                            if (!string.IsNullOrEmpty(unlockableName))
                            {
                                ViewablesCatalog.Node skinNode = new ViewablesCatalog.Node(bodySkins[k].name, false, parent3);
                                skinNode.shouldShowUnviewed = ((UserProfile userProfile) => !userProfile.HasViewedViewable(skinNode.fullName) && userProfile.HasUnlockable(unlockableName));
                            }
                        }
                    }
                }
            }
 // Token: 0x06000400 RID: 1024 RVA: 0x0000FE40 File Offset: 0x0000E040
 public static int GetBodyIndex(this ConCommandArgs args, int index)
 {
     if (index < args.userArgs.Count)
     {
         int num = BodyCatalog.FindBodyIndexCaseInsensitive(args[index]);
         if (num != -1)
         {
             return(num);
         }
     }
     throw new ConCommandException(string.Format("Argument {0} is not a valid body name.", index));
 }
Пример #11
0
        private static void Init()
        {
            IEnumerable <GameObject>    first  = Resources.LoadAll <GameObject>("Prefabs/CharacterBodies/");
            List <GameObject>           list   = new List <GameObject>();
            Action <List <GameObject> > action = BodyCatalog.getAdditionalEntries;

            if (action != null)
            {
                action(list);
            }
            BodyCatalog.SetBodyPrefabs(first.Concat(list.OrderBy((GameObject v) => v.name, StringComparer.Ordinal)).ToArray <GameObject>());
            BodyCatalog.availability.MakeAvailable();
        }
Пример #12
0
 public void CmdRespawn(string bodyName)
 {
     if (this.preventRespawnUntilNextStageServer)
     {
         return;
     }
     if (!string.IsNullOrEmpty(bodyName))
     {
         this.bodyPrefab = BodyCatalog.FindBodyPrefab(bodyName);
     }
     if (Stage.instance)
     {
         Stage.instance.RespawnCharacter(this);
     }
 }
Пример #13
0
 private static void Init()
 {
     GlobalEventManager.onCharacterDeathGlobal += delegate(DamageReport damageReport)
     {
         CharacterMaster victimMaster = damageReport.victimMaster;
         if (victimMaster)
         {
             victimMaster.killerBodyIndex = BodyCatalog.FindBodyIndex(damageReport.damageInfo.attacker);
         }
     };
     Stage.onServerStageBegin += delegate(Stage stage)
     {
         foreach (CharacterMaster characterMaster in CharacterMaster.instancesList)
         {
             characterMaster.preventRespawnUntilNextStageServer = false;
         }
     };
 }
Пример #14
0
        private static void RegisterMage()
        {
            var bodyPrefab   = BodyCatalog.FindBodyPrefab("MageBody");
            var skillLocator = bodyPrefab.GetComponent <SkillLocator>();

            var passiveSkill = skillLocator.passiveSkill;

            passiveSkill.skillNameToken        = "Arcane Affinity";
            passiveSkill.skillDescriptionToken = "Absorb energy from all current items. Gaining <style=cIsUtility>1-3% bonus damage</style> per item, depending on its tier.";
            passiveSkill.enabled      = true;
            passiveSkill.icon         = passiveSkill.icon;
            skillLocator.passiveSkill = passiveSkill;

            SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Mage, new SurvivorDef
            {
                bodyPrefab       = bodyPrefab,
                displayPrefab    = Resources.Load <GameObject>("Prefabs/CharacterDisplays/MageDisplay"),
                descriptionToken = "MAGE_DESCRIPTION",
                primaryColor     = new Color(0.968627453f, 0.75686276f, 0.992156863f),
                unlockableName   = "Characters.Mage"
            });
        }
Пример #15
0
 // Token: 0x0600124E RID: 4686 RVA: 0x00059CF0 File Offset: 0x00057EF0
 private void UpdateMasterPreferences()
 {
     if (this.masterObject)
     {
         CharacterMaster master = this.master;
         if (master)
         {
             if (this.bodyIndexPreference == -1)
             {
                 this.NetworkbodyIndexPreference = BodyCatalog.FindBodyIndex(master.bodyPrefab);
                 if (this.bodyIndexPreference == -1)
                 {
                     this.NetworkbodyIndexPreference = BodyCatalog.FindBodyIndex("CommandoBody");
                     return;
                 }
             }
             else
             {
                 master.bodyPrefab = BodyCatalog.GetBodyPrefab(this.bodyIndexPreference);
             }
         }
     }
 }
Пример #16
0
        private static void Init()
        {
            SurvivorCatalog.survivorDefs = new SurvivorDef[10];
            SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Commando, new SurvivorDef
            {
                bodyPrefab       = BodyCatalog.FindBodyPrefab("CommandoBody"),
                displayPrefab    = Resources.Load <GameObject>("Prefabs/CharacterDisplays/CommandoDisplay"),
                descriptionToken = "COMMANDO_DESCRIPTION",
                primaryColor     = new Color(0.92941177f, 0.5882353f, 0.07058824f)
            });
            SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Huntress, new SurvivorDef
            {
                bodyPrefab       = BodyCatalog.FindBodyPrefab("HuntressBody"),
                displayPrefab    = Resources.Load <GameObject>("Prefabs/CharacterDisplays/HuntressDisplay"),
                primaryColor     = new Color(0.8352941f, 0.23529412f, 0.23529412f),
                descriptionToken = "HUNTRESS_DESCRIPTION",
                unlockableName   = "Characters.Huntress"
            });
            SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Toolbot, new SurvivorDef
            {
                bodyPrefab       = BodyCatalog.FindBodyPrefab("ToolbotBody"),
                displayPrefab    = Resources.Load <GameObject>("Prefabs/CharacterDisplays/ToolbotDisplay"),
                descriptionToken = "TOOLBOT_DESCRIPTION",
                primaryColor     = new Color(0.827451f, 0.76862746f, 0.3137255f),
                unlockableName   = "Characters.Toolbot"
            });
            SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Engi, new SurvivorDef
            {
                bodyPrefab       = BodyCatalog.FindBodyPrefab("EngiBody"),
                displayPrefab    = Resources.Load <GameObject>("Prefabs/CharacterDisplays/EngiDisplay"),
                descriptionToken = "ENGI_DESCRIPTION",
                primaryColor     = new Color(0.37254903f, 0.8862745f, 0.5254902f),
                unlockableName   = "Characters.Engineer"
            });
            SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Mage, new SurvivorDef
            {
                bodyPrefab       = BodyCatalog.FindBodyPrefab("MageBody"),
                displayPrefab    = Resources.Load <GameObject>("Prefabs/CharacterDisplays/MageDisplay"),
                descriptionToken = "MAGE_DESCRIPTION",
                primaryColor     = new Color(0.96862745f, 0.75686276f, 0.99215686f),
                unlockableName   = "Characters.Mage"
            });
            SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Merc, new SurvivorDef
            {
                bodyPrefab       = BodyCatalog.FindBodyPrefab("MercBody"),
                displayPrefab    = Resources.Load <GameObject>("Prefabs/CharacterDisplays/MercDisplay"),
                descriptionToken = "MERC_DESCRIPTION",
                primaryColor     = new Color(0.42352942f, 0.81960785f, 0.91764706f),
                unlockableName   = "Characters.Mercenary"
            });
            SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Treebot, new SurvivorDef
            {
                bodyPrefab       = BodyCatalog.FindBodyPrefab("TreebotBody"),
                displayPrefab    = Resources.Load <GameObject>("Prefabs/CharacterDisplays/TreebotDisplay"),
                descriptionToken = "TREEBOT_DESCRIPTION",
                primaryColor     = new Color(0.5254902f, 0.61960787f, 0.32941177f),
                unlockableName   = "Characters.Treebot"
            });
            SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Loader, new SurvivorDef
            {
                bodyPrefab       = BodyCatalog.FindBodyPrefab("LoaderBody"),
                displayPrefab    = Resources.Load <GameObject>("Prefabs/CharacterDisplays/LoaderDisplay"),
                descriptionToken = "LOADER_DESCRIPTION",
                primaryColor     = new Color(0.40392157f, 0.4392157f, 0.87058824f),
                unlockableName   = "Characters.Loader"
            });
            SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Croco, new SurvivorDef
            {
                bodyPrefab       = BodyCatalog.FindBodyPrefab("CrocoBody"),
                displayPrefab    = Resources.Load <GameObject>("Prefabs/CharacterDisplays/CrocoDisplay"),
                descriptionToken = "CROCO_DESCRIPTION",
                primaryColor     = new Color(0.7882353f, 0.9490196f, 0.3019608f),
                unlockableName   = "Characters.Croco"
            });
            for (SurvivorIndex survivorIndex = SurvivorIndex.Commando; survivorIndex < SurvivorIndex.Count; survivorIndex++)
            {
                if (SurvivorCatalog.survivorDefs[(int)survivorIndex] == null)
                {
                    Debug.LogWarningFormat("Unregistered survivor {0}!", new object[]
                    {
                        Enum.GetName(typeof(SurvivorIndex), survivorIndex)
                    });
                }
            }
            List <SurvivorDef>           list   = new List <SurvivorDef>();
            Action <List <SurvivorDef> > action = SurvivorCatalog.getAdditionalSurvivorDefs;

            if (action != null)
            {
                action(list);
            }
            Array.Resize <SurvivorDef>(ref SurvivorCatalog.survivorDefs, SurvivorCatalog.survivorDefs.Length + list.Count);
            for (int i = 0; i < list.Count; i++)
            {
                SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Count + i, list[i]);
            }
            SurvivorCatalog.survivorIndexToBodyIndex = new int[SurvivorCatalog.survivorCount];
            SurvivorCatalog.bodyIndexToSurvivorIndex = new SurvivorIndex[BodyCatalog.bodyCount];
            HGArrayUtilities.SetAll <int>(SurvivorCatalog.survivorIndexToBodyIndex, -1);
            HGArrayUtilities.SetAll <SurvivorIndex>(SurvivorCatalog.bodyIndexToSurvivorIndex, SurvivorIndex.None);
            for (int j = 0; j < SurvivorCatalog.survivorDefs.Length; j++)
            {
                SurvivorDef survivorDef = SurvivorCatalog.survivorDefs[j];
                int         num         = (survivorDef != null) ? survivorDef.bodyPrefab.GetComponent <CharacterBody>().bodyIndex : -1;
                SurvivorCatalog.survivorIndexToBodyIndex[j] = num;
                if (num != -1)
                {
                    SurvivorCatalog.bodyIndexToSurvivorIndex[num] = (SurvivorIndex)j;
                }
            }
            SurvivorCatalog._allSurvivorDefs = (from v in SurvivorCatalog.survivorDefs
                                                where v != null
                                                select v).ToArray <SurvivorDef>();
            ViewablesCatalog.Node node = new ViewablesCatalog.Node("Survivors", true, null);
            using (IEnumerator <SurvivorDef> enumerator = SurvivorCatalog.allSurvivorDefs.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    SurvivorCatalog.< > c__DisplayClass22_0 CS$ < > 8__locals1 = new SurvivorCatalog.< > c__DisplayClass22_0();
                    CS$ < > 8__locals1.survivorDef = enumerator.Current;
                    ViewablesCatalog.Node survivorEntryNode = new ViewablesCatalog.Node(CS$ < > 8__locals1.survivorDef.survivorIndex.ToString(), false, node);
                    survivorEntryNode.shouldShowUnviewed = ((UserProfile userProfile) => !userProfile.HasViewedViewable(survivorEntryNode.fullName) && userProfile.HasSurvivorUnlocked(CS$ < > 8__locals1.survivorDef.survivorIndex) && !string.IsNullOrEmpty(CS$ < > 8__locals1.survivorDef.unlockableName));
                }
            }
            ViewablesCatalog.AddNodeToRoot(node);
        }
Пример #17
0
        private static void Init()
        {
            SurvivorCatalog.idealSurvivorOrder = ModLoader.BuildIdealOrder(SurvivorCatalog.idealSurvivorOrder);
            if (ModLoader.SurvivorCount > SurvivorCatalog.survivorMaxCount)
            {
                SurvivorCatalog.survivorMaxCount = ModLoader.SurvivorCount;
            }
            SurvivorCatalog.survivorDefs = new SurvivorDef[ModLoader.SurvivorCount];
            Debug.LogFormat("[Debug] Defined Survivor Array with {0} survivor slots and max survivor count of {1}",
                            new object[]
                            { SurvivorCatalog.survivorDefs.Length, SurvivorCatalog.survivorMaxCount });
            SurvivorCatalog.RegisterSurvivor((SurvivorIndex)0, 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)
            });
            SurvivorCatalog.RegisterSurvivor((SurvivorIndex)1, 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"
            });
            SurvivorCatalog.RegisterSurvivor((SurvivorIndex)2, 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"
            });
            SurvivorCatalog.RegisterSurvivor((SurvivorIndex)3, 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"
            });
            SurvivorCatalog.RegisterSurvivor((SurvivorIndex)4, 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"
            });
            SurvivorCatalog.RegisterSurvivor((SurvivorIndex)5, 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"
            });

            ModLoader.AddSurvivors(ref SurvivorCatalog.survivorDefs);
            for (int survivorIndex = 0; survivorIndex < SurvivorCatalog.survivorDefs.Length; survivorIndex++)
            {
                Debug.LogFormat("[Debug] Survivor index {0}: {1}", new object[]
                {
                    survivorIndex,
                    SurvivorCatalog.survivorDefs.ElementAt(survivorIndex).bodyPrefab
                });
                if (SurvivorCatalog.survivorDefs[survivorIndex] == null)
                {
                    Debug.LogWarningFormat("Unregistered survivor {0}!", new object[]
                    {
                        survivorIndex
                    });
                }
            }
            SurvivorCatalog._allSurvivorDefs = (from v in SurvivorCatalog.survivorDefs
                                                where v != null
                                                select v).ToArray <SurvivorDef>();
            ViewablesCatalog.Node node = new ViewablesCatalog.Node("Survivors", true, null);
            using (IEnumerator <SurvivorDef> enumerator = SurvivorCatalog.allSurvivorDefs.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    SurvivorDef survivor = new SurvivorDef();
                    survivor = enumerator.Current;
                    Debug.LogFormat("[DEBUG] Creating node for {0}.", new object[] { survivor.displayNameToken });
                    ViewablesCatalog.Node survivorEntryNode = new ViewablesCatalog.Node(survivor.displayNameToken, false, node);
                    survivorEntryNode.shouldShowUnviewed = ((UserProfile userProfile) => !userProfile.HasViewedViewable(survivorEntryNode.fullName) && userProfile.HasSurvivorUnlocked(survivor.survivorIndex) && !string.IsNullOrEmpty(survivor.unlockableName));
                    Debug.LogFormat("[DEBUG] Created node {0}", new object[] { survivorEntryNode.name });
                }
            }
            ViewablesCatalog.AddNodeToRoot(node);
        }
Пример #18
0
 private static void CCBodyReloadAll(ConCommandArgs args)
 {
     BodyCatalog.SetBodyPrefabs(Resources.LoadAll <GameObject>("Prefabs/CharacterBodies/"));
 }
Пример #19
0
 // Token: 0x060003E5 RID: 997 RVA: 0x0000F657 File Offset: 0x0000D857
 public static int FindBodyIndex(GameObject bodyObject)
 {
     return(BodyCatalog.FindBodyIndex(bodyObject ? bodyObject.GetComponent <CharacterBody>() : null));
 }
Пример #20
0
 private static void CCBodyGeneratePortraits(ConCommandArgs args)
 {
     RoR2Application.instance.StartCoroutine(BodyCatalog.GeneratePortraits(args.TryGetArgBool(0) ?? false));
 }
Пример #21
0
 private static void CCBodyGeneratePortraits(ConCommandArgs args)
 {
     RoR2Application.instance.StartCoroutine(BodyCatalog.GeneratePortraits());
 }
Пример #22
0
 public static GameObject FindBodyPrefab(GameObject characterBodyObject)
 {
     return(BodyCatalog.GetBodyPrefab(BodyCatalog.FindBodyIndex(characterBodyObject)));
 }
Пример #23
0
 private static void Init()
 {
     SurvivorCatalog.survivorDefs = new SurvivorDef[BaseFramework.SurvivorCount];
     SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Commando, 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)
     });
     SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Huntress, 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"
     });
     SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Toolbot, 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"
     });
     SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Engineer, 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"
     });
     SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Mage, 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"
     });
     SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Merc, 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"
     });
     BaseFramework.addSurvivors();
     for (SurvivorIndex survivorIndex = 0; survivorIndex < (SurvivorIndex)SurvivorCatalog.survivorDefs.Count(); survivorIndex++)
     {
         if (SurvivorCatalog.survivorDefs[(int)survivorIndex] == null)
         {
             Debug.LogWarningFormat("Unregistered survivor {0}!", new object[]
             {
                 Enum.GetName(typeof(SurvivorIndex), survivorIndex)
             });
         }
     }
     SurvivorCatalog._allSurvivorDefs = (from v in SurvivorCatalog.survivorDefs
                                         where v != null
                                         select v).ToArray <SurvivorDef>();
     ViewablesCatalog.Node node = new ViewablesCatalog.Node("Survivors", true, null);
     using (IEnumerator <SurvivorDef> enumerator = SurvivorCatalog.allSurvivorDefs.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             SurvivorDef survivor = new SurvivorDef();
             survivor = enumerator.Current;
             ViewablesCatalog.Node survivorEntryNode = new ViewablesCatalog.Node(survivor.survivorIndex.ToString(), false, node);
             survivorEntryNode.shouldShowUnviewed = ((UserProfile userProfile) => !userProfile.HasViewedViewable(survivorEntryNode.fullName) && userProfile.HasSurvivorUnlocked(survivor.survivorIndex) && !string.IsNullOrEmpty(survivor.unlockableName));
         }
     }
     ViewablesCatalog.AddNodeToRoot(node);
 }
Пример #24
0
        private static void Init()
        {
            SurvivorCatalog.idealSurvivorOrder = new[]
            {
                SurvivorIndex.Commando,
                SurvivorIndex.Toolbot,
                SurvivorIndex.Huntress,
                SurvivorIndex.Engineer,
                SurvivorIndex.Mage,
                SurvivorIndex.Merc,
                SurvivorIndex.Bandit
            };

            SurvivorCatalog.survivorMaxCount = SurvivorCatalog.idealSurvivorOrder.Length;

            SurvivorCatalog.survivorDefs = new SurvivorDef[SurvivorCatalog.survivorMaxCount];

            Debug.LogFormat("[Debug] Defined Survivor Array with {0} survivor slots and max survivor count of {1}",
                            SurvivorCatalog.survivorDefs.Length, SurvivorCatalog.survivorMaxCount);

            SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Commando, 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)
            });

            SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Huntress, 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"
            });

            SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Toolbot, 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"
            });

            SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Engineer, 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"
            });

            RegisterMage();

            SurvivorCatalog.RegisterSurvivor(SurvivorIndex.Merc, 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"
            });

            RegisterBandit();

            for (var survivorIndex = 0; survivorIndex < SurvivorCatalog.survivorDefs.Length; survivorIndex++)
            {
                Debug.LogFormat("[Debug] Survivor index {0}: {1}", survivorIndex,
                                SurvivorCatalog.survivorDefs.ElementAt(survivorIndex).bodyPrefab);
                if (SurvivorCatalog.survivorDefs[survivorIndex] == null)
                {
                    Debug.LogWarningFormat("Unregistered survivor {0}!", survivorIndex);
                }
            }

            SurvivorCatalog._allSurvivorDefs = (from v in SurvivorCatalog.survivorDefs
                                                where v != null
                                                select v).ToArray();

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

            using (var enumerator = SurvivorCatalog.allSurvivorDefs.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    var survivor = enumerator.Current;

                    if (survivor == null)
                    {
                        continue;
                    }

                    Debug.LogFormat("[DEBUG] Creating node for {0}.", survivor.displayNameToken);

                    var survivorEntryNode =
                        new ViewablesCatalog.Node(survivor.displayNameToken, false, node);

                    survivorEntryNode.shouldShowUnviewed = userProfile =>
                                                           !userProfile.HasViewedViewable(survivorEntryNode.fullName) &&
                                                           userProfile.HasSurvivorUnlocked(survivor.survivorIndex) &&
                                                           !string.IsNullOrEmpty(survivor.unlockableName);

                    Debug.LogFormat("[DEBUG] Created node {0}", survivorEntryNode.name);
                }
            }

            ViewablesCatalog.AddNodeToRoot(node);
        }