// Token: 0x06001803 RID: 6147 RVA: 0x00068728 File Offset: 0x00066928
 public static void SetEntries(PickupDef[] pickupDefs)
 {
     Array.Resize <PickupDef>(ref PickupCatalog.entries, pickupDefs.Length);
     PickupCatalog.pickupCount = pickupDefs.Length;
     Array.Copy(pickupDefs, PickupCatalog.entries, PickupCatalog.entries.Length);
     Array.Resize <PickupIndex>(ref PickupCatalog.itemIndexToPickupIndex, ItemCatalog.itemCount);
     Array.Resize <PickupIndex>(ref PickupCatalog.equipmentIndexToPickupIndex, EquipmentCatalog.equipmentCount);
     PickupCatalog.nameToPickupIndex.Clear();
     for (int i = 0; i < PickupCatalog.entries.Length; i++)
     {
         PickupDef   pickupDef   = PickupCatalog.entries[i];
         PickupIndex pickupIndex = new PickupIndex(i);
         pickupDef.pickupIndex = pickupIndex;
         if (pickupDef.itemIndex != ItemIndex.None)
         {
             PickupCatalog.itemIndexToPickupIndex[(int)pickupDef.itemIndex] = pickupIndex;
         }
         if (pickupDef.equipmentIndex != EquipmentIndex.None)
         {
             PickupCatalog.equipmentIndexToPickupIndex[(int)pickupDef.equipmentIndex] = pickupIndex;
         }
     }
     for (int j = 0; j < PickupCatalog.entries.Length; j++)
     {
         PickupDef pickupDef2 = PickupCatalog.entries[j];
         PickupCatalog.nameToPickupIndex[pickupDef2.internalName] = pickupDef2.pickupIndex;
     }
 }
Esempio n. 2
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
            });
        }
Esempio n. 4
0
        public Color GetPickupColor()
        {
            PickupDef pickupDef = this.pickupDef;

            if (pickupDef == null)
            {
                return(Color.black);
            }
            return(pickupDef.baseColor);
        }
Esempio n. 5
0
        public GameObject GetPickupDropletDisplayPrefab()
        {
            PickupDef pickupDef = this.pickupDef;

            if (pickupDef == null)
            {
                return(null);
            }
            return(pickupDef.dropletDisplayPrefab);
        }
        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);
                    }
                }
            }
        }
        // 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);
                 }
             }
         }
     }
 }
Esempio n. 10
0
        // Token: 0x06001835 RID: 6197 RVA: 0x00068EFA File Offset: 0x000670FA
        public override string ToString()
        {
            PickupDef pickupDef = this.pickupDef;

            return(((pickupDef != null) ? pickupDef.internalName : null) ?? string.Format("BadPickupIndex{0}", this.value));
        }
Esempio n. 11
0
        public string GetInteractContextToken()
        {
            PickupDef pickupDef = this.pickupDef;

            return(((pickupDef != null) ? pickupDef.interactContextToken : null) ?? "");
        }
Esempio n. 12
0
        public bool IsBoss()
        {
            PickupDef pickupDef = this.pickupDef;

            return(pickupDef != null && pickupDef.isBoss);
        }
Esempio n. 13
0
        public bool IsLunar()
        {
            PickupDef pickupDef = this.pickupDef;

            return(pickupDef != null && pickupDef.isLunar);
        }
Esempio n. 14
0
        public string GetUnlockableName()
        {
            PickupDef pickupDef = this.pickupDef;

            return(((pickupDef != null) ? pickupDef.unlockableName : null) ?? "");
        }
Esempio n. 15
0
        public string GetPickupNameToken()
        {
            PickupDef pickupDef = this.pickupDef;

            return(((pickupDef != null) ? pickupDef.nameToken : null) ?? "???");
        }
        private static void Init()
        {
            List <PickupDef> list = new List <PickupDef>();

            for (int i = 0; i < ItemCatalog.itemCount; i++)
            {
                ItemIndex itemIndex  = (ItemIndex)i;
                ItemDef   itemDef    = ItemCatalog.GetItemDef(itemIndex);
                PickupDef pickupDef  = new PickupDef();
                PickupDef pickupDef2 = pickupDef;
                string    str        = "ItemIndex.";
                ItemIndex itemIndex2 = (ItemIndex)i;
                pickupDef2.internalName        = str + itemIndex2.ToString();
                pickupDef.itemIndex            = itemIndex;
                pickupDef.displayPrefab        = itemDef.pickupModelPrefab;
                pickupDef.dropletDisplayPrefab = PickupCatalog.< Init > g__GetPickupDropletDisplayPrefabForTier | 11_0 (itemDef.tier);
                pickupDef.nameToken            = itemDef.nameToken;
                pickupDef.baseColor            = ColorCatalog.GetColor(itemDef.colorIndex);
                pickupDef.darkColor            = ColorCatalog.GetColor(itemDef.darkColorIndex);
                pickupDef.unlockableName       = itemDef.unlockableName;
                pickupDef.interactContextToken = "ITEM_PICKUP_CONTEXT";
                pickupDef.isLunar     = (itemDef.tier == ItemTier.Lunar);
                pickupDef.isBoss      = (itemDef.tier == ItemTier.Boss);
                pickupDef.iconTexture = itemDef.pickupIconTexture;
                list.Add(pickupDef);
            }
            GameObject dropletDisplayPrefab = Resources.Load <GameObject>("Prefabs/ItemPickups/EquipmentOrb");

            for (int j = 0; j < EquipmentCatalog.equipmentCount; j++)
            {
                EquipmentIndex equipmentIndex  = (EquipmentIndex)j;
                EquipmentDef   equipmentDef    = EquipmentCatalog.GetEquipmentDef(equipmentIndex);
                PickupDef      pickupDef3      = new PickupDef();
                PickupDef      pickupDef4      = pickupDef3;
                string         str2            = "EquipmentIndex.";
                EquipmentIndex equipmentIndex2 = (EquipmentIndex)j;
                pickupDef4.internalName         = str2 + equipmentIndex2.ToString();
                pickupDef3.equipmentIndex       = equipmentIndex;
                pickupDef3.displayPrefab        = equipmentDef.pickupModelPrefab;
                pickupDef3.dropletDisplayPrefab = dropletDisplayPrefab;
                pickupDef3.nameToken            = equipmentDef.nameToken;
                pickupDef3.baseColor            = ColorCatalog.GetColor(equipmentDef.colorIndex);
                pickupDef3.darkColor            = pickupDef3.baseColor;
                pickupDef3.unlockableName       = equipmentDef.unlockableName;
                pickupDef3.interactContextToken = "EQUIPMENT_PICKUP_CONTEXT";
                pickupDef3.isLunar     = equipmentDef.isLunar;
                pickupDef3.isBoss      = equipmentDef.isBoss;
                pickupDef3.iconTexture = equipmentDef.pickupIconTexture;
                list.Add(pickupDef3);
            }
            PickupDef pickupDef5 = new PickupDef();

            pickupDef5.internalName         = "LunarCoin.Coin0";
            pickupDef5.coinValue            = 1U;
            pickupDef5.nameToken            = "PICKUP_LUNAR_COIN";
            pickupDef5.displayPrefab        = Resources.Load <GameObject>("Prefabs/PickupModels/PickupLunarCoin");
            pickupDef5.dropletDisplayPrefab = Resources.Load <GameObject>("Prefabs/ItemPickups/LunarOrb");
            pickupDef5.baseColor            = ColorCatalog.GetColor(ColorCatalog.ColorIndex.LunarItem);
            pickupDef5.darkColor            = pickupDef5.baseColor;
            pickupDef5.interactContextToken = "LUNAR_COIN_PICKUP_CONTEXT";
            list.Add(pickupDef5);
            Action <List <PickupDef> > action = PickupCatalog.modifyPickups;

            if (action != null)
            {
                action(list);
            }
            PickupCatalog.SetEntries(list.ToArray());
        }