Esempio n. 1
0
        public void AddShrineStack(Interactor activator)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.ShrineChanceBehavior::AddShrineStack(RoR2.Interactor)' called on client");
                return;
            }
            PickupIndex none   = PickupIndex.none;
            PickupIndex value  = Run.instance.availableTier1DropList[this.rng.RangeInt(0, Run.instance.availableTier1DropList.Count - 1)];
            PickupIndex value2 = Run.instance.availableTier2DropList[this.rng.RangeInt(0, Run.instance.availableTier2DropList.Count - 1)];
            PickupIndex value3 = Run.instance.availableTier3DropList[this.rng.RangeInt(0, Run.instance.availableTier3DropList.Count - 1)];
            PickupIndex value4 = Run.instance.availableEquipmentDropList[this.rng.RangeInt(0, Run.instance.availableEquipmentDropList.Count - 1)];
            WeightedSelection <PickupIndex> weightedSelection = new WeightedSelection <PickupIndex>(8);

            weightedSelection.AddChoice(none, this.failureWeight);
            weightedSelection.AddChoice(value, this.tier1Weight);
            weightedSelection.AddChoice(value2, this.tier2Weight);
            weightedSelection.AddChoice(value3, this.tier3Weight);
            weightedSelection.AddChoice(value4, this.equipmentWeight);
            PickupIndex pickupIndex = weightedSelection.Evaluate(this.rng.nextNormalizedFloat);
            bool        flag        = pickupIndex == PickupIndex.none;

            if (flag)
            {
                Chat.SendBroadcastChat(new Chat.SubjectFormatChatMessage
                {
                    subjectCharacterBodyGameObject = activator.gameObject,
                    baseToken = "SHRINE_CHANCE_FAIL_MESSAGE"
                });
            }
            else
            {
                this.successfulPurchaseCount++;
                PickupDropletController.CreatePickupDroplet(pickupIndex, this.dropletOrigin.position, this.dropletOrigin.forward * 20f);
                Chat.SendBroadcastChat(new Chat.SubjectFormatChatMessage
                {
                    subjectCharacterBodyGameObject = activator.gameObject,
                    baseToken = "SHRINE_CHANCE_SUCCESS_MESSAGE"
                });
            }
            Action <bool, Interactor> action = ShrineChanceBehavior.onShrineChancePurchaseGlobal;

            if (action != null)
            {
                action(flag, activator);
            }
            this.waitingForRefresh = true;
            this.refreshTimer      = 2f;
            EffectManager.instance.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/ShrineUseEffect"), new EffectData
            {
                origin   = base.transform.position,
                rotation = Quaternion.identity,
                scale    = 1f,
                color    = this.shrineColor
            }, true);
            if (this.successfulPurchaseCount >= this.maxPurchaseCount)
            {
                this.symbolTransform.gameObject.SetActive(false);
            }
        }
Esempio n. 2
0
        private void GrantEquipment(CharacterBody body, Inventory inventory)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.GenericPickupController::GrantEquipment(RoR2.CharacterBody,RoR2.Inventory)' called on client");
                return;
            }
            this.waitStartTime = Run.FixedTimeStamp.now;
            EquipmentIndex currentEquipmentIndex = inventory.currentEquipmentIndex;
            EquipmentIndex equipmentIndex        = this.pickupIndex.equipmentIndex;

            inventory.SetEquipmentIndex(equipmentIndex);
            this.NetworkpickupIndex = new PickupIndex(currentEquipmentIndex);
            this.consumed           = false;
            GenericPickupController.SendPickupMessage(inventory.GetComponent <CharacterMaster>(), new PickupIndex(equipmentIndex));
            if (this.pickupIndex == PickupIndex.none)
            {
                UnityEngine.Object.Destroy(base.gameObject);
                return;
            }
            if (this.selfDestructIfPickupIndexIsNotIdeal && this.pickupIndex != PickupIndex.Find(this.idealPickupIndex.pickupName))
            {
                PickupDropletController.CreatePickupDroplet(this.pickupIndex, base.transform.position, new Vector3(UnityEngine.Random.Range(-4f, 4f), 20f, UnityEngine.Random.Range(-4f, 4f)));
                UnityEngine.Object.Destroy(base.gameObject);
            }
        }
        // Token: 0x06000694 RID: 1684 RVA: 0x0001AD98 File Offset: 0x00018F98
        private void DropRewards()
        {
            int participatingPlayerCount = Run.instance.participatingPlayerCount;

            if (participatingPlayerCount != 0 && this.dropPosition)
            {
                List <PickupIndex> list = Run.instance.availableTier2DropList;
                if (this.forceTier3Reward)
                {
                    list = Run.instance.availableTier3DropList;
                }
                ItemIndex itemIndex = this.rng.NextElementUniform <PickupIndex>(list).itemIndex;
                int       num       = 1 + this.bonusRewardCount;
                if (this.scaleRewardsByPlayerCount)
                {
                    num *= participatingPlayerCount;
                }
                float      angle    = 360f / (float)num;
                Vector3    vector   = Quaternion.AngleAxis((float)UnityEngine.Random.Range(0, 360), Vector3.up) * (Vector3.up * 40f + Vector3.forward * 5f);
                Quaternion rotation = Quaternion.AngleAxis(angle, Vector3.up);
                int        i        = 0;
                while (i < num)
                {
                    PickupIndex pickupIndex = new PickupIndex(itemIndex);
                    if (this.bossDrops.Count > 0 && this.rng.nextNormalizedFloat <= this.bossDropChance)
                    {
                        pickupIndex = this.rng.NextElementUniform <PickupIndex>(this.bossDrops);
                    }
                    PickupDropletController.CreatePickupDroplet(pickupIndex, this.dropPosition.position, vector);
                    i++;
                    vector = rotation * vector;
                }
            }
        }
Esempio n. 4
0
        public void ItemDrop()
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.ChestBehavior::ItemDrop()' called on client");
                return;
            }

            if (dropPickup == PickupIndex.none)
            {
                return;
            }

            var localTransform = transform;

            PickupDropletController.CreatePickupDroplet(dropPickup, localTransform.position + Vector3.up * 1.5f,
                                                        Vector3.up * 20f + localTransform.forward * 2f);

            // Lucky!
            if (Util.CheckRoll(5f))
            {
                PickupDropletController.CreatePickupDroplet(dropPickup, localTransform.position + Vector3.up * 1.5f,
                                                            Vector3.up * 22f + localTransform.forward * 4f);
            }

            dropPickup = PickupIndex.none;
        }
 // Token: 0x06001187 RID: 4487 RVA: 0x0004CB14 File Offset: 0x0004AD14
 private void EjectPickupServer(PickupIndex pickupIndex)
 {
     if (pickupIndex == PickupIndex.none)
     {
         return;
     }
     PickupDropletController.CreatePickupDroplet(pickupIndex, this.ejectionTransform.position, this.ejectionTransform.rotation * this.localEjectionVelocity);
 }
Esempio n. 6
0
 public void DropPickup()
 {
     if (!NetworkServer.active)
     {
         Debug.LogWarning("[Server] function 'System.Void RoR2.ShopTerminalBehavior::DropPickup()' called on client");
         return;
     }
     this.SetHasBeenPurchased(true);
     PickupDropletController.CreatePickupDroplet(this.pickupIndex, (this.dropTransform ? this.dropTransform : base.transform).position, base.transform.TransformVector(this.dropVelocity));
 }
Esempio n. 7
0
        // Token: 0x06001190 RID: 4496 RVA: 0x00057190 File Offset: 0x00055390
        public void DropItems()
        {
            CharacterBody body = this.characterMaster.GetBody();

            if (body)
            {
                SerializablePickupIndex[] array = this.pickupsToDrop;
                for (int i = 0; i < array.Length; i++)
                {
                    PickupDropletController.CreatePickupDroplet(PickupIndex.Find(array[i].pickupName), body.coreTransform.position, new Vector3(UnityEngine.Random.Range(-4f, 4f), 20f, UnityEngine.Random.Range(-4f, 4f)));
                }
            }
        }
Esempio n. 8
0
 public void ItemDrop()
 {
     if (!NetworkServer.active)
     {
         Debug.LogWarning("[Server] function 'System.Void RoR2.ChestBehavior::ItemDrop()' called on client");
         return;
     }
     if (this.dropPickup == PickupIndex.none)
     {
         return;
     }
     PickupDropletController.CreatePickupDroplet(this.dropPickup, base.transform.position + Vector3.up * 1.5f, Vector3.up * 20f + base.transform.forward * 2f);
     this.dropPickup = PickupIndex.none;
 }
 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;
             }
         }
     };
 }
Esempio n. 10
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;
                     }
                 }
             }
         }
     };
 }
Esempio n. 11
0
        private void OnCharacterDeathCallback(DamageReport damageReport)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.BossGroup::OnCharacterDeathCallback(RoR2.DamageReport)' called on client");
                return;
            }
            DamageInfo    damageInfo = damageReport.damageInfo;
            GameObject    gameObject = damageReport.victim.gameObject;
            CharacterBody component  = gameObject.GetComponent <CharacterBody>();

            if (!component)
            {
                return;
            }
            CharacterMaster master = component.master;

            if (!master)
            {
                return;
            }
            DeathRewards component2 = gameObject.GetComponent <DeathRewards>();

            if (component2)
            {
                PickupIndex pickupIndex = (PickupIndex)component2.bossPickup;
                if (pickupIndex != PickupIndex.none && ItemDropManager.IncludeSpecialBossDrops)
                {
                    this.bossDrops.Add(pickupIndex);
                }
            }
            GameObject victimMasterGameObject = master.gameObject;
            int        num = this.membersList.FindIndex((CharacterMaster x) => x.gameObject == victimMasterGameObject);

            if (num >= 0)
            {
                this.RemoveMemberAt(num);
                if (!this.defeated && this.membersList.Count == 0)
                {
                    Run.instance.OnServerBossKilled(true);
                    if (component)
                    {
                        int participatingPlayerCount = Run.instance.participatingPlayerCount;
                        if (participatingPlayerCount != 0 && this.dropPosition)
                        {
                            //ItemIndex itemIndex = ItemDropManager.BossDropList[this.rng.RangeInt(0, ItemDropManager.BossDropList.Count)];
                            ItemIndex  itemIndex = ItemDropManager.GetSelection(ItemDropLocation.Boss, rng.nextNormalizedFloat).itemIndex;
                            int        num2      = participatingPlayerCount * (1 + (TeleporterInteraction.instance ? TeleporterInteraction.instance.shrineBonusStacks : 0));
                            float      angle     = 360f / (float)num2;
                            Vector3    vector    = Quaternion.AngleAxis((float)UnityEngine.Random.Range(0, 360), Vector3.up) * (Vector3.up * 40f + Vector3.forward * 5f);
                            Quaternion rotation  = Quaternion.AngleAxis(angle, Vector3.up);
                            int        i         = 0;
                            while (i < num2)
                            {
                                PickupIndex pickupIndex2 = new PickupIndex(itemIndex);
                                if (this.bossDrops.Count > 0 && this.rng.nextNormalizedFloat <= this.bossDropChance)
                                {
                                    pickupIndex2 = this.bossDrops[this.rng.RangeInt(0, this.bossDrops.Count)];
                                }
                                PickupDropletController.CreatePickupDroplet(pickupIndex2, this.dropPosition.position, vector);
                                i++;
                                vector = rotation * vector;
                            }
                        }
                    }
                    this.defeated = true;
                    Action <BossGroup> action = onBossGroupDefeatedServer;
                    if (action == null)
                    {
                        return;
                    }
                    action(this);
                    return;
                }
                else
                {
                    Run.instance.OnServerBossKilled(false);
                }
            }
        }
        public void EndRound()
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.ArenaMissionController::EndRound()' called on client");
                return;
            }
            int clearedRounds = this.clearedRounds;

            this.clearedRounds = clearedRounds + 1;
            if (this.currentRound < this.totalRoundsMax)
            {
                this.ReadyNextNullWard();
            }
            else
            {
                Action action = ArenaMissionController.onBeatArena;
                if (action != null)
                {
                    action();
                }
                this.mainStateMachine.SetNextState(new ArenaMissionController.MissionCompleted());
                Chat.SendBroadcastChat(new Chat.SimpleChatMessage
                {
                    baseToken = "ARENA_END"
                });
            }
            for (int i = 0; i < this.combatDirectors.Length; i++)
            {
                CombatDirector combatDirector = this.combatDirectors[i];
                combatDirector.enabled       = false;
                combatDirector.monsterCredit = 0f;
            }
            ReadOnlyCollection <TeamComponent> teamMembers = TeamComponent.GetTeamMembers(TeamIndex.Monster);

            for (int j = teamMembers.Count - 1; j >= 0; j--)
            {
                teamMembers[j].body.healthComponent.Suicide(base.gameObject, base.gameObject, DamageType.VoidDeath);
            }
            int participatingPlayerCount = Run.instance.participatingPlayerCount;

            if (participatingPlayerCount != 0 && this.rewardSpawnPosition)
            {
                List <PickupIndex> list = Run.instance.availableTier1DropList;
                if (this.currentRound > 4)
                {
                    list = Run.instance.availableTier2DropList;
                }
                if (this.currentRound == this.totalRoundsMax)
                {
                    list = Run.instance.availableTier3DropList;
                }
                ItemIndex  itemIndex = this.rng.NextElementUniform <PickupIndex>(list).itemIndex;
                int        num       = participatingPlayerCount;
                float      angle     = 360f / (float)num;
                Vector3    vector    = Quaternion.AngleAxis((float)UnityEngine.Random.Range(0, 360), Vector3.up) * (Vector3.up * 40f + Vector3.forward * 5f);
                Quaternion rotation  = Quaternion.AngleAxis(angle, Vector3.up);
                int        k         = 0;
                while (k < num)
                {
                    PickupDropletController.CreatePickupDroplet(new PickupIndex(itemIndex), this.rewardSpawnPosition.transform.position, vector);
                    k++;
                    vector = rotation * vector;
                }
            }
        }