// 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);
            }
 // Token: 0x060015E5 RID: 5605 RVA: 0x00068E64 File Offset: 0x00067064
 private void FixedUpdate()
 {
     if (NetworkServer.active)
     {
         if (!string.IsNullOrEmpty(this.nextStage) && this.stageAdvanceTime <= Run.instance.fixedTime)
         {
             string nextSceneName = this.nextStage;
             this.nextStage = null;
             Run.instance.AdvanceStage(nextSceneName);
         }
         if (this.spawnedAnyPlayer && float.IsInfinity(this.stageAdvanceTime) && !Run.instance.isGameOverServer)
         {
             ReadOnlyCollection <PlayerCharacterMasterController> instances = PlayerCharacterMasterController.instances;
             bool flag = false;
             for (int i = 0; i < instances.Count; i++)
             {
                 PlayerCharacterMasterController playerCharacterMasterController = instances[i];
                 if (playerCharacterMasterController.isConnected && playerCharacterMasterController.preventGameOver)
                 {
                     flag = true;
                     break;
                 }
             }
             if (!flag)
             {
                 Run.instance.BeginGameOver(GameResultType.Lost);
             }
         }
     }
 }
Beispiel #3
0
 // Token: 0x06001C47 RID: 7239 RVA: 0x00084580 File Offset: 0x00082780
 public static string GetBestBodyNameColored(GameObject bodyObject)
 {
     if (bodyObject)
     {
         CharacterBody component = bodyObject.GetComponent <CharacterBody>();
         if (component)
         {
             CharacterMaster master = component.master;
             if (master)
             {
                 PlayerCharacterMasterController component2 = master.GetComponent <PlayerCharacterMasterController>();
                 if (component2)
                 {
                     GameObject networkUserObject = component2.networkUserObject;
                     if (networkUserObject)
                     {
                         NetworkUser component3 = networkUserObject.GetComponent <NetworkUser>();
                         if (component3)
                         {
                             return(Util.GenerateColoredString(component3.userName, component3.userColor));
                         }
                     }
                 }
             }
         }
         IDisplayNameProvider component4 = bodyObject.GetComponent <IDisplayNameProvider>();
         if (component4 != null)
         {
             return(component4.GetDisplayName());
         }
     }
     return("???");
 }
 // Token: 0x06000FFD RID: 4093 RVA: 0x000462B1 File Offset: 0x000444B1
 private void OnDisable()
 {
     PlayerCharacterMasterController._instances.Remove(this);
     if (PlayerCharacterMasterController.onPlayerRemoved != null)
     {
         PlayerCharacterMasterController.onPlayerRemoved(this);
     }
 }
 // Token: 0x06000FFC RID: 4092 RVA: 0x00046292 File Offset: 0x00044492
 private void OnEnable()
 {
     PlayerCharacterMasterController._instances.Add(this);
     if (PlayerCharacterMasterController.onPlayerAdded != null)
     {
         PlayerCharacterMasterController.onPlayerAdded(this);
     }
 }
Beispiel #6
0
        // Token: 0x06000CF7 RID: 3319 RVA: 0x00040230 File Offset: 0x0003E430
        public void OnBodyStart(CharacterBody body)
        {
            this.preventGameOver = true;
            this.killerBodyIndex = -1;
            TeamComponent component = body.GetComponent <TeamComponent>();

            if (component)
            {
                component.teamIndex = this.teamIndex;
            }
            body.RecalculateStats();
            if (NetworkServer.active)
            {
                BaseAI[] components = base.GetComponents <BaseAI>();
                for (int i = 0; i < components.Length; i++)
                {
                    components[i].OnBodyStart(body);
                }
            }
            bool flag = false;
            PlayerCharacterMasterController component2 = base.GetComponent <PlayerCharacterMasterController>();

            if (component2)
            {
                if (component2.networkUserObject)
                {
                    flag = component2.networkUserObject.GetComponent <NetworkIdentity>().isLocalPlayer;
                }
                component2.OnBodyStart();
            }
            if (flag)
            {
                GlobalEventManager.instance.OnLocalPlayerBodySpawn(body);
            }
            if (this.inventory.GetItemCount(ItemIndex.Ghost) > 0)
            {
                Util.PlaySound("Play_item_proc_ghostOnKill", body.gameObject);
            }
            if (NetworkServer.active)
            {
                HealthComponent component3 = body.GetComponent <HealthComponent>();
                if (component3)
                {
                    component3.Networkhealth = component3.fullHealth;
                }
                this.UpdateBodyGodMode();
                this.StartLifeStopwatch();
                GlobalEventManager.instance.OnCharacterBodySpawn(body);
            }
            Action <CharacterBody> action = this.onBodyStart;

            if (action == null)
            {
                return;
            }
            action(body);
        }
Beispiel #7
0
 // Token: 0x06001517 RID: 5399 RVA: 0x0005A198 File Offset: 0x00058398
 public virtual void SetFromMaster(CharacterMaster master)
 {
     if (master)
     {
         PlayerCharacterMasterController component = master.GetComponent <PlayerCharacterMasterController>();
         if (component)
         {
             NetworkUser networkUser = component.networkUser;
             this.SetFromSteamId(networkUser.id.value);
             return;
         }
     }
     this.userSteamId = 0UL;
     this.sourceType  = SocialUserIcon.SourceType.None;
     this.Refresh();
 }
Beispiel #8
0
        // Token: 0x06001775 RID: 6005 RVA: 0x00066124 File Offset: 0x00064324
        public void RebuildControlChain()
        {
            PlayerCharacterMasterController cachedMasterController = this.cachedMasterController;

            this.cachedMasterController = null;
            this.cachedMasterObject     = null;
            CharacterBody cachedBody = this.cachedBody;

            this.cachedBody       = null;
            this.cachedBodyObject = null;
            if (this.currentNetworkUser)
            {
                this.cachedMasterObject = this.currentNetworkUser.masterObject;
                if (this.cachedMasterObject)
                {
                    this.cachedMasterController = this.cachedMasterObject.GetComponent <PlayerCharacterMasterController>();
                }
                if (this.cachedMasterController)
                {
                    this.cachedBody = this.cachedMasterController.master.GetBody();
                    if (this.cachedBody)
                    {
                        this.cachedBodyObject = this.cachedBody.gameObject;
                    }
                }
            }
            if (cachedBody != this.cachedBody)
            {
                Action action = this.onBodyChanged;
                if (action != null)
                {
                    action();
                }
            }
            if (cachedMasterController != this.cachedMasterController)
            {
                Action action2 = this.onMasterChanged;
                if (action2 == null)
                {
                    return;
                }
                action2();
            }
        }
 private static void Init()
 {
     GlobalEventManager.onCharacterDeathGlobal += delegate(DamageReport damageReport)
     {
         CharacterMaster characterMaster = damageReport.attackerMaster;
         if (characterMaster)
         {
             if (characterMaster.minionOwnership.ownerMaster)
             {
                 characterMaster = characterMaster.minionOwnership.ownerMaster;
             }
             PlayerCharacterMasterController component = characterMaster.GetComponent <PlayerCharacterMasterController>();
             if (component && Util.CheckRoll(1f * component.lunarCoinChanceMultiplier, 0f, null))
             {
                 PickupDropletController.CreatePickupDroplet(PickupIndex.Find("LunarCoin.Coin0"), damageReport.victim.transform.position, Vector3.up * 10f);
                 component.lunarCoinChanceMultiplier *= 0.5f;
             }
         }
     };
 }
Beispiel #10
0
 // Token: 0x06001C48 RID: 7240 RVA: 0x00084610 File Offset: 0x00082810
 public static string GetBestMasterName(CharacterMaster characterMaster)
 {
     if (characterMaster)
     {
         PlayerCharacterMasterController component = characterMaster.GetComponent <PlayerCharacterMasterController>();
         if (component)
         {
             GameObject networkUserObject = component.networkUserObject;
             if (networkUserObject)
             {
                 NetworkUser component2 = networkUserObject.GetComponent <NetworkUser>();
                 if (component2)
                 {
                     return(component2.userName);
                 }
             }
         }
         return(characterMaster.name);
     }
     return("Null Master");
 }
Beispiel #11
0
        // Token: 0x06000CF8 RID: 3320 RVA: 0x00040348 File Offset: 0x0003E548
        public void OnBodyDeath()
        {
            if (NetworkServer.active)
            {
                this.deathFootPosition = this.GetBody().footPosition;
                BaseAI[] components = base.GetComponents <BaseAI>();
                for (int i = 0; i < components.Length; i++)
                {
                    components[i].OnBodyDeath();
                }
                PlayerCharacterMasterController component = base.GetComponent <PlayerCharacterMasterController>();
                if (component)
                {
                    component.OnBodyDeath();
                }
                if (this.inventory.GetItemCount(ItemIndex.ExtraLife) > 0)
                {
                    this.inventory.RemoveItem(ItemIndex.ExtraLife, 1);
                    base.Invoke("RespawnExtraLife", 2f);
                    base.Invoke("PlayExtraLifeSFX", 1f);
                }
                else
                {
                    if (this.destroyOnBodyDeath)
                    {
                        UnityEngine.Object.Destroy(base.gameObject);
                    }
                    this.preventGameOver = false;
                    this.preventRespawnUntilNextStageServer = true;
                }
                this.ResetLifeStopwatch();
            }
            UnityEvent unityEvent = this.onBodyDeath;

            if (unityEvent == null)
            {
                return;
            }
            unityEvent.Invoke();
        }
            // Token: 0x060019D0 RID: 6608 RVA: 0x0007B4FC File Offset: 0x000796FC
            public void ResolveLocalInformation()
            {
                this.name = Util.GetBestMasterName(this.master);
                PlayerCharacterMasterController playerCharacterMasterController = null;

                if (this.master)
                {
                    playerCharacterMasterController = this.master.GetComponent <PlayerCharacterMasterController>();
                }
                this.networkUser = null;
                if (playerCharacterMasterController)
                {
                    this.networkUser = playerCharacterMasterController.networkUser;
                }
                this.localPlayerIndex    = -1;
                this.userProfileFileName = string.Empty;
                if (this.networkUser && this.networkUser.localUser != null)
                {
                    this.localPlayerIndex    = this.networkUser.localUser.id;
                    this.userProfileFileName = this.networkUser.localUser.userProfile.fileName;
                }
            }
Beispiel #13
0
 // Token: 0x06001C4A RID: 7242 RVA: 0x0008467C File Offset: 0x0008287C
 public static NetworkUser LookUpBodyNetworkUser(CharacterBody characterBody)
 {
     if (characterBody)
     {
         CharacterMaster master = characterBody.master;
         if (master)
         {
             PlayerCharacterMasterController component = master.GetComponent <PlayerCharacterMasterController>();
             if (component)
             {
                 GameObject networkUserObject = component.networkUserObject;
                 if (networkUserObject)
                 {
                     NetworkUser component2 = networkUserObject.GetComponent <NetworkUser>();
                     if (component2)
                     {
                         return(component2);
                     }
                 }
             }
         }
     }
     return(null);
 }
Beispiel #14
0
 private static void Init()
 {
     GlobalEventManager.onCharacterDeathGlobal += delegate(DamageReport damageReport)
     {
         GameObject attacker = damageReport.damageInfo.attacker;
         if (attacker)
         {
             CharacterBody component = attacker.GetComponent <CharacterBody>();
             if (component)
             {
                 GameObject masterObject = component.masterObject;
                 if (masterObject)
                 {
                     PlayerCharacterMasterController component2 = masterObject.GetComponent <PlayerCharacterMasterController>();
                     if (component2 && Util.CheckRoll(1f * component2.lunarCoinChanceMultiplier, 0f, null))
                     {
                         PickupDropletController.CreatePickupDroplet(PickupIndex.lunarCoin1, damageReport.victim.transform.position, Vector3.up * 10f);
                         component2.lunarCoinChanceMultiplier *= 0.5f;
                     }
                 }
             }
         }
     };
 }
        private bool PerformEquipmentAction(EquipmentIndex equipmentIndex)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Boolean RoR2.EquipmentSlot::PerformEquipmentAction(RoR2.EquipmentIndex)' called on client");
                return(false);
            }
            switch (equipmentIndex)
            {
            case EquipmentIndex.CommandMissile:
                this.remainingMissiles += 12;
                return(true);

            case EquipmentIndex.Saw:
            {
                Vector3 position = base.transform.position;
                Ray     aimRay   = this.GetAimRay();
                bool    crit     = Util.CheckRoll(this.characterBody.crit, this.characterBody.master);
                ProjectileManager.instance.FireProjectile(Resources.Load <GameObject>("Prefabs/Projectiles/Sawmerang"), aimRay.origin, Util.QuaternionSafeLookRotation(aimRay.direction), base.gameObject, this.characterBody.damage, 0f, crit, DamageColorIndex.Default, null, -1f);
                return(true);
            }

            case EquipmentIndex.Fruit:
                if (this.healthComponent)
                {
                    Util.PlaySound("Play_item_use_fruit", base.gameObject);
                    EffectData effectData = new EffectData();
                    effectData.origin = base.transform.position;
                    effectData.SetNetworkedObjectReference(base.gameObject);
                    EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/FruitHealEffect"), effectData, true);
                    this.healthComponent.HealFraction(0.5f, default(ProcChainMask));
                    return(true);
                }
                return(true);

            case EquipmentIndex.Meteor:
            {
                MeteorStormController component = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/MeteorStorm"), this.characterBody.corePosition, Quaternion.identity).GetComponent <MeteorStormController>();
                component.owner       = base.gameObject;
                component.ownerDamage = this.characterBody.damage;
                component.isCrit      = Util.CheckRoll(this.characterBody.crit, this.characterBody.master);
                NetworkServer.Spawn(component.gameObject);
                return(true);
            }

            case EquipmentIndex.SoulJar:
                return(true);

            case EquipmentIndex.Blackhole:
            {
                Vector3 position2 = base.transform.position;
                Ray     aimRay2   = this.GetAimRay();
                ProjectileManager.instance.FireProjectile(Resources.Load <GameObject>("Prefabs/Projectiles/GravSphere"), position2, Util.QuaternionSafeLookRotation(aimRay2.direction), base.gameObject, 0f, 0f, false, DamageColorIndex.Default, null, -1f);
                return(true);
            }

            case EquipmentIndex.GhostGun:
            {
                GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/GhostGun"), base.transform.position, Quaternion.identity);
                gameObject.GetComponent <GhostGunController>().owner = base.gameObject;
                NetworkServer.Spawn(gameObject);
                return(true);
            }

            case EquipmentIndex.CritOnUse:
                this.characterBody.AddTimedBuff(BuffIndex.FullCrit, 8f);
                return(true);

            case EquipmentIndex.DroneBackup:
            {
                Util.PlaySound("Play_item_use_radio", base.gameObject);
                int   sliceCount = 4;
                float num        = 25f;
                if (NetworkServer.active)
                {
                    float y = Quaternion.LookRotation(this.GetAimRay().direction).eulerAngles.y;
                    float d = 3f;
                    foreach (float num2 in new DegreeSlices(sliceCount, 0.5f))
                    {
                        Quaternion      rotation        = Quaternion.Euler(0f, y + num2, 0f);
                        Quaternion      rotation2       = Quaternion.Euler(0f, y + num2 + 180f, 0f);
                        Vector3         position3       = base.transform.position + rotation * (Vector3.forward * d);
                        CharacterMaster characterMaster = this.SummonMaster(Resources.Load <GameObject>("Prefabs/CharacterMasters/DroneBackupMaster"), position3, rotation2);
                        if (characterMaster)
                        {
                            characterMaster.gameObject.AddComponent <MasterSuicideOnTimer>().lifeTimer = num + UnityEngine.Random.Range(0f, 3f);
                        }
                    }
                }
                this.subcooldownTimer = 0.5f;
                return(true);
            }

            case EquipmentIndex.OrbitalLaser:
            {
                Vector3    position4 = base.transform.position;
                RaycastHit raycastHit;
                if (Physics.Raycast(this.GetAimRay(), out raycastHit, 900f, LayerIndex.world.mask | LayerIndex.defaultLayer.mask))
                {
                    position4 = raycastHit.point;
                }
                GameObject gameObject2 = (GameObject)UnityEngine.Object.Instantiate(Resources.Load("Prefabs/NetworkedObjects/OrbitalLaser"), position4, Quaternion.identity);
                gameObject2.GetComponent <OrbitalLaserController>().ownerBody = this.characterBody;
                NetworkServer.Spawn(gameObject2);
                return(true);
            }

            case EquipmentIndex.BFG:
                this.bfgChargeTimer   = 2f;
                this.subcooldownTimer = 2.2f;
                return(true);

            case EquipmentIndex.Enigma:
            {
                EquipmentIndex equipmentIndex2 = EquipmentCatalog.enigmaEquipmentList[UnityEngine.Random.Range(0, EquipmentCatalog.enigmaEquipmentList.Count - 1)];
                this.PerformEquipmentAction(equipmentIndex2);
                return(true);
            }

            case EquipmentIndex.Jetpack:
            {
                JetpackController jetpackController = JetpackController.FindJetpackController(base.gameObject);
                if (!jetpackController)
                {
                    GameObject gameObject3 = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/JetpackController"));
                    jetpackController = gameObject3.GetComponent <JetpackController>();
                    jetpackController.NetworktargetObject = base.gameObject;
                    NetworkServer.Spawn(gameObject3);
                    return(true);
                }
                jetpackController.ResetTimer();
                return(true);
            }

            case EquipmentIndex.Lightning:
            {
                this.UpdateTargets();
                HurtBox hurtBox = this.currentTargetHurtBox;
                if (hurtBox)
                {
                    this.subcooldownTimer = 0.2f;
                    OrbManager.instance.AddOrb(new LightningStrikeOrb
                        {
                            attacker         = base.gameObject,
                            damageColorIndex = DamageColorIndex.Item,
                            damageValue      = this.characterBody.damage * 30f,
                            isCrit           = Util.CheckRoll(this.characterBody.crit, this.characterBody.master),
                            procChainMask    = default(ProcChainMask),
                            procCoefficient  = 1f,
                            target           = hurtBox
                        });
                    this.InvalidateCurrentTarget();
                    return(true);
                }
                return(false);
            }

            case EquipmentIndex.PassiveHealing:
                if (this.passiveHealingFollower)
                {
                    this.UpdateTargets();
                    this.passiveHealingFollower.AssignNewTarget(this.currentTargetBodyObject);
                    this.InvalidateCurrentTarget();
                    return(true);
                }
                return(true);

            case EquipmentIndex.BurnNearby:
                if (this.characterBody)
                {
                    this.characterBody.AddHelfireDuration(8f);
                    return(true);
                }
                return(true);

            case EquipmentIndex.SoulCorruptor:
            {
                this.UpdateTargets();
                HurtBox hurtBox2 = this.currentTargetHurtBox;
                if (!hurtBox2)
                {
                    return(false);
                }
                if (!hurtBox2.healthComponent || hurtBox2.healthComponent.combinedHealthFraction > 0.25f)
                {
                    return(false);
                }
                Util.TryToCreateGhost(hurtBox2.healthComponent.body, this.characterBody, 30);
                hurtBox2.healthComponent.Suicide(base.gameObject, null, DamageType.Generic);
                this.InvalidateCurrentTarget();
                return(true);
            }

            case EquipmentIndex.Scanner:
                NetworkServer.Spawn(UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/ChestScanner"), this.characterBody.corePosition, Quaternion.identity));
                return(true);

            case EquipmentIndex.CrippleWard:
                NetworkServer.Spawn(UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/CrippleWard"), this.characterBody.corePosition, Quaternion.identity));
                this.inventory.SetEquipmentIndex(EquipmentIndex.None);
                return(true);

            case EquipmentIndex.Gateway:
                return(this.FireGateway());

            case EquipmentIndex.Tonic:
                this.characterBody.AddTimedBuff(BuffIndex.TonicBuff, EquipmentSlot.tonicBuffDuration);
                if (!Util.CheckRoll(80f, this.characterBody.master))
                {
                    this.characterBody.pendingTonicAfflictionCount++;
                    return(true);
                }
                return(true);

            case EquipmentIndex.QuestVolatileBattery:
                return(false);

            case EquipmentIndex.Cleanse:
            {
                Vector3    corePosition = this.characterBody.corePosition;
                EffectData effectData2  = new EffectData
                {
                    origin = corePosition
                };
                effectData2.SetHurtBoxReference(this.characterBody.mainHurtBox);
                EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/CleanseEffect"), effectData2, true);
                BuffIndex buffIndex = BuffIndex.Slow50;
                BuffIndex buffCount = (BuffIndex)BuffCatalog.buffCount;
                while (buffIndex < buffCount)
                {
                    if (BuffCatalog.GetBuffDef(buffIndex).isDebuff)
                    {
                        this.characterBody.ClearTimedBuffs(buffIndex);
                    }
                    buffIndex++;
                }
                DotController.RemoveAllDots(base.gameObject);
                SetStateOnHurt component2 = base.GetComponent <SetStateOnHurt>();
                if (component2)
                {
                    component2.Cleanse();
                }
                float     num3      = 6f;
                float     num4      = num3 * num3;
                TeamIndex teamIndex = this.teamComponent.teamIndex;
                List <ProjectileController> instancesList = InstanceTracker.GetInstancesList <ProjectileController>();
                List <ProjectileController> list          = new List <ProjectileController>();
                int i     = 0;
                int count = instancesList.Count;
                while (i < count)
                {
                    ProjectileController projectileController = instancesList[i];
                    if (projectileController.teamFilter.teamIndex != teamIndex && (projectileController.transform.position - corePosition).sqrMagnitude < num4)
                    {
                        list.Add(projectileController);
                    }
                    i++;
                }
                int j      = 0;
                int count2 = list.Count;
                while (j < count2)
                {
                    ProjectileController projectileController2 = list[j];
                    if (projectileController2)
                    {
                        UnityEngine.Object.Destroy(projectileController2.gameObject);
                    }
                    j++;
                }
                return(true);
            }

            case EquipmentIndex.FireBallDash:
            {
                Ray        aimRay3     = this.GetAimRay();
                GameObject gameObject4 = UnityEngine.Object.Instantiate <GameObject>(Resources.Load <GameObject>("Prefabs/NetworkedObjects/FireballVehicle"), aimRay3.origin, Quaternion.LookRotation(aimRay3.direction));
                gameObject4.GetComponent <VehicleSeat>().AssignPassenger(base.gameObject);
                CharacterBody characterBody = this.characterBody;
                NetworkUser   networkUser;
                if (characterBody == null)
                {
                    networkUser = null;
                }
                else
                {
                    CharacterMaster master = characterBody.master;
                    if (master == null)
                    {
                        networkUser = null;
                    }
                    else
                    {
                        PlayerCharacterMasterController playerCharacterMasterController = master.playerCharacterMasterController;
                        networkUser = ((playerCharacterMasterController != null) ? playerCharacterMasterController.networkUser : null);
                    }
                }
                NetworkUser networkUser2 = networkUser;
                if (networkUser2)
                {
                    NetworkServer.SpawnWithClientAuthority(gameObject4, networkUser2.gameObject);
                }
                else
                {
                    NetworkServer.Spawn(gameObject4);
                }
                this.subcooldownTimer = 2f;
                return(true);
            }

            case EquipmentIndex.GainArmor:
                this.characterBody.AddTimedBuff(BuffIndex.ElephantArmorBoost, 5f);
                return(true);
            }
            return(false);
        }
Beispiel #16
0
            // Token: 0x06001B1D RID: 6941 RVA: 0x0007F2CC File Offset: 0x0007D4CC
            private void OnMasterChanged()
            {
                PlayerCharacterMasterController cachedMasterController = this.trackedUser.cachedMasterController;

                this.SetCurrentMaster(cachedMasterController ? cachedMasterController.master : null);
            }
Beispiel #17
0
        private static void HandlePickupMessage(NetworkMessage netMsg)
        {
            Debug.Log("GenericPickupController.HandlePickupMessage: Received pickup message.");
            ReadOnlyCollection <NotificationQueue> readOnlyInstancesList = NotificationQueue.readOnlyInstancesList;

            GenericPickupController.PickupMessage pickupMessage = GenericPickupController.pickupMessageInstance;
            netMsg.ReadMessage <GenericPickupController.PickupMessage>(pickupMessage);
            GameObject  masterGameObject = pickupMessage.masterGameObject;
            PickupIndex pickupIndex      = pickupMessage.pickupIndex;
            uint        pickupQuantity   = pickupMessage.pickupQuantity;

            pickupMessage.Reset();
            if (!masterGameObject)
            {
                Debug.Log("GenericPickupController.HandlePickupMessage: failed! masterObject is not valid.");
                return;
            }
            CharacterMaster component = masterGameObject.GetComponent <CharacterMaster>();

            if (!component)
            {
                Debug.Log("GenericPickupController.HandlePickupMessage: failed! master component is not valid.");
                return;
            }
            PlayerCharacterMasterController component2 = component.GetComponent <PlayerCharacterMasterController>();

            if (component2)
            {
                NetworkUser networkUser = component2.networkUser;
                if (networkUser)
                {
                    LocalUser localUser = networkUser.localUser;
                    if (localUser != null)
                    {
                        localUser.userProfile.DiscoverPickup(pickupIndex);
                    }
                }
            }
            for (int i = 0; i < readOnlyInstancesList.Count; i++)
            {
                readOnlyInstancesList[i].OnPickup(component, pickupIndex);
            }
            CharacterBody body = component.GetBody();

            if (!body)
            {
                Debug.Log("GenericPickupController.HandlePickupMessage: failed! characterBody is not valid.");
            }
            ItemDef itemDef = ItemCatalog.GetItemDef(pickupIndex.itemIndex);

            if (itemDef != null && itemDef.hidden)
            {
                Debug.LogFormat("GenericPickupController.HandlePickupMessage: skipped item {0}, marked hidden.", new object[]
                {
                    itemDef.nameToken
                });
                return;
            }
            Chat.AddPickupMessage(body, pickupIndex.GetPickupNameToken(), pickupIndex.GetPickupColor(), pickupQuantity);
            if (body)
            {
                Util.PlaySound("Play_UI_item_pickup", body.gameObject);
            }
        }
Beispiel #18
0
 public void Body_Start(On.RoR2.PlayerCharacterMasterController.orig_OnBodyStart o, RoR2.PlayerCharacterMasterController s)
 {
     o(s);
     //GetPlayerStats(s);
 }
Beispiel #19
0
        // Token: 0x0600162E RID: 5678 RVA: 0x0006A288 File Offset: 0x00068488
        private void SetupIndicator()
        {
            if (this.indicator)
            {
                return;
            }
            CharacterBody component = base.GetComponent <CharacterBody>();

            if (component)
            {
                TeamComponent component2 = component.GetComponent <TeamComponent>();
                if (component2)
                {
                    CharacterMaster master     = component.master;
                    bool            flag       = master && master.isBoss;
                    GameObject      gameObject = null;
                    if (master && component2.teamIndex == TeamIndex.Player)
                    {
                        bool flag2 = false;
                        PlayerCharacterMasterController component3 = master.GetComponent <PlayerCharacterMasterController>();
                        if (component3)
                        {
                            flag2 = true;
                            GameObject networkUserObject = component3.networkUserObject;
                            if (networkUserObject)
                            {
                                NetworkIdentity component4 = networkUserObject.GetComponent <NetworkIdentity>();
                                if (component4)
                                {
                                    bool isLocalPlayer = component4.isLocalPlayer;
                                }
                            }
                        }
                        Vector3 position = component.transform.position;
                        component.GetComponent <Collider>();
                        if (flag2)
                        {
                            gameObject = Resources.Load <GameObject>("Prefabs/PositionIndicators/PlayerPositionIndicator");
                        }
                        else
                        {
                            gameObject = Resources.Load <GameObject>("Prefabs/PositionIndicators/NPCPositionIndicator");
                        }
                        this.indicator = UnityEngine.Object.Instantiate <GameObject>(gameObject, position, Quaternion.identity, component.transform);
                    }
                    else if (flag)
                    {
                        gameObject = Resources.Load <GameObject>("Prefabs/PositionIndicators/BossPositionIndicator");
                    }
                    if (this.indicator)
                    {
                        UnityEngine.Object.Destroy(this.indicator);
                        this.indicator = null;
                    }
                    if (gameObject)
                    {
                        this.indicator = UnityEngine.Object.Instantiate <GameObject>(gameObject, base.transform);
                        this.indicator.GetComponent <PositionIndicator>().targetTransform = component.coreTransform;
                        Nameplate component5 = this.indicator.GetComponent <Nameplate>();
                        if (component5)
                        {
                            component5.SetBody(component);
                        }
                    }
                }
            }
        }