Example #1
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);
            };
        }
Example #2
0
        public static GameObject FindBodyPrefab([NotNull] string bodyName)
        {
            int num = BodyCatalog.FindBodyIndex(bodyName);

            if (num != -1)
            {
                return(BodyCatalog.GetBodyPrefab(num));
            }
            return(null);
        }
Example #3
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);
        }
Example #4
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);
             }
         }
     }
 }
Example #5
0
 public static GameObject FindBodyPrefab(GameObject characterBodyObject)
 {
     return(BodyCatalog.GetBodyPrefab(BodyCatalog.FindBodyIndex(characterBodyObject)));
 }