Example #1
0
 private bool <GenerateNewPickupServer> g__PassesFilter | 17_0 (PickupIndex pickupIndex)
 {
     if (this.bannedItemTag == ItemTag.Any)
     {
         return(true);
     }
     PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex);
     return(pickupDef.itemIndex == ItemIndex.None || !ItemCatalog.GetItemDef(pickupDef.itemIndex).ContainsTag(this.bannedItemTag));
 }
        private void AddItemType(ItemTier itemTier)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.ArenaMissionController::AddItemType(RoR2.ItemTier)' called on client");
                return;
            }
            List <PickupIndex> list;

            switch (itemTier)
            {
            case ItemTier.Tier1:
                list = this.availableTier1DropList;
                break;

            case ItemTier.Tier2:
                list = this.availableTier2DropList;
                break;

            case ItemTier.Tier3:
                list = this.availableTier3DropList;
                break;

            default:
                return;
            }
            if (list.Count == 0)
            {
                Debug.LogErrorFormat("No items remaining in arena for tier {0}. Aborting.", new object[]
                {
                    itemTier
                });
                return;
            }
            PickupIndex pickupIndex = this.rng.NextElementUniform <PickupIndex>(list);

            list.Remove(pickupIndex);
            this.syncActivePickups.Add(pickupIndex.value);
            for (int i = 0; i < this.pickupDisplays.Length; i++)
            {
                PickupDisplay pickupDisplay = this.pickupDisplays[i];
                if (!pickupDisplay.enabled)
                {
                    pickupDisplay.enabled = true;
                    pickupDisplay.SetPickupIndex(pickupIndex, false);
                    break;
                }
            }
            PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex);

            Chat.SendBroadcastChat(new Chat.PlayerPickupChatMessage
            {
                baseToken   = "ARENA_ADD_ITEM",
                pickupToken = pickupDef.nameToken,
                pickupColor = pickupDef.baseColor
            });
        }
        private static void CCPickupPrintAll(ConCommandArgs args)
        {
            StringBuilder stringBuilder = new StringBuilder();

            for (int i = 0; i < PickupCatalog.pickupCount; i++)
            {
                PickupDef pickupDef = PickupCatalog.GetPickupDef(new PickupIndex(i));
                stringBuilder.Append("[").Append(i).Append("]={internalName=").Append(pickupDef.internalName).Append("}").AppendLine();
            }
            Debug.Log(stringBuilder.ToString());
        }
        private void AttemptGrant(CharacterBody body)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.GenericPickupController::AttemptGrant(RoR2.CharacterBody)' called on client");
                return;
            }
            PickupDef pickupDef = PickupCatalog.GetPickupDef(this.pickupIndex);

            if (pickupDef.itemIndex != ItemIndex.None)
            {
                using (IEnumerator <TeamComponent> enumerator = TeamComponent.GetTeamMembers(TeamIndex.Player).GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        TeamComponent teamComponent = enumerator.Current;
                        body = teamComponent.GetComponent <CharacterBody>();
                        if (teamComponent && teamComponent.teamIndex == TeamIndex.Player)
                        {
                            Inventory inventory = body.inventory;
                            if (inventory)
                            {
                                this.consumed = true;
                                this.GrantItem(body, inventory);
                            }
                        }
                    }
                    return;
                }
            }
            TeamComponent teamComponent2 = body.GetComponent <TeamComponent>();

            if (teamComponent2 && teamComponent2.teamIndex == TeamIndex.Player)
            {
                Inventory inventory2 = body.inventory;
                if (inventory2)
                {
                    this.consumed = true;
                    if (pickupDef.equipmentIndex != EquipmentIndex.None)
                    {
                        this.GrantEquipment(body, inventory2);
                    }
                    if (pickupDef.artifactIndex != ArtifactIndex.None)
                    {
                        this.GrantArtifact(body, pickupDef.artifactIndex);
                    }
                    if (pickupDef.coinValue != 0U)
                    {
                        this.GrantLunarCoin(body, pickupDef.coinValue);
                    }
                }
            }
        }
        public void ModifySpawnedMasters(GameObject targetGameObject)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.ArenaMissionController::ModifySpawnedMasters(UnityEngine.GameObject)' called on client");
                return;
            }
            ArenaMissionController.< > c__DisplayClass62_0 CS$ < > 8__locals1 = new ArenaMissionController.< > c__DisplayClass62_0();
            CharacterMaster component = targetGameObject.GetComponent <CharacterMaster>();

            CS$ < > 8__locals1.ai = component.GetComponent <BaseAI>();
            if (CS$ < > 8__locals1.ai)
            {
                CS$ < > 8__locals1.ai.onBodyDiscovered += CS$ < > 8__locals1.< ModifySpawnedMasters > g__OnBodyDiscovered | 0;
            }
            CharacterBody body = component.GetBody();

            if (body)
            {
                foreach (EntityStateMachine entityStateMachine in body.GetComponents <EntityStateMachine>())
                {
                    entityStateMachine.initialStateType = entityStateMachine.mainStateType;
                }
            }
            for (int j = 0; j < this.syncActivePickups.Count; j++)
            {
                int       count     = 0;
                ItemIndex itemIndex = PickupCatalog.GetPickupDef(new PickupIndex(this.syncActivePickups[j])).itemIndex;
                switch (ItemCatalog.GetItemDef(itemIndex).tier)
                {
                case ItemTier.Tier1:
                    count = this.stackCountPerTier1;
                    break;

                case ItemTier.Tier2:
                    count = this.stackCountPerTier2;
                    break;

                case ItemTier.Tier3:
                    count = this.stackCountPerTier3;
                    break;
                }
                component.inventory.GiveItem(itemIndex, count);
            }
        }
        // Token: 0x060005FA RID: 1530 RVA: 0x00018A68 File Offset: 0x00016C68
        private static bool IsPickupAllowedForMonsters(PickupIndex pickupIndex)
        {
            PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex);

            if (pickupDef == null)
            {
                return(false);
            }
            ItemDef itemDef = ItemCatalog.GetItemDef(pickupDef.itemIndex);

            if (itemDef == null)
            {
                return(false);
            }
            for (int i = 0; i < ArenaMissionController.forbiddenTags.Length; i++)
            {
                if (itemDef.ContainsTag(ArenaMissionController.forbiddenTags[i]))
                {
                    return(false);
                }
            }
            return(true);
        }
 private void AttemptGrant(CharacterBody body)
 {
     if (!NetworkServer.active)
     {
         Debug.LogWarning("[Server] function 'System.Void RoR2.GenericPickupController::AttemptGrant(RoR2.CharacterBody)' called on client");
         return;
     }
     foreach (TeamComponent component in TeamComponent.GetTeamMembers(TeamIndex.Player))
     {
         body = component.GetComponent <CharacterBody>();
         if (component && component.teamIndex == TeamIndex.Player)
         {
             Inventory inventory = body.inventory;
             if (inventory)
             {
                 this.consumed = true;
                 PickupDef pickupDef = PickupCatalog.GetPickupDef(this.pickupIndex);
                 if (pickupDef.itemIndex != ItemIndex.None)
                 {
                     this.GrantItem(body, inventory);
                 }
                 if (pickupDef.equipmentIndex != EquipmentIndex.None)
                 {
                     this.GrantEquipment(body, inventory);
                 }
                 if (pickupDef.artifactIndex != ArtifactIndex.None)
                 {
                     this.GrantArtifact(body, pickupDef.artifactIndex);
                 }
                 if (pickupDef.coinValue != 0U)
                 {
                     this.GrantLunarCoin(body, pickupDef.coinValue);
                 }
             }
         }
     }
 }