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

            if (num != -1)
            {
                return(BodyCatalog.GetBodyPrefab(num));
            }
            return(null);
        }
コード例 #5
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);
        }
コード例 #6
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;
         }
     };
 }
コード例 #7
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);
             }
         }
     }
 }
コード例 #8
0
 // Token: 0x060003E5 RID: 997 RVA: 0x0000F657 File Offset: 0x0000D857
 public static int FindBodyIndex(GameObject bodyObject)
 {
     return(BodyCatalog.FindBodyIndex(bodyObject ? bodyObject.GetComponent <CharacterBody>() : null));
 }
コード例 #9
0
 public static GameObject FindBodyPrefab(GameObject characterBodyObject)
 {
     return(BodyCatalog.GetBodyPrefab(BodyCatalog.FindBodyIndex(characterBodyObject)));
 }