// Token: 0x06000595 RID: 1429 RVA: 0x0001727C File Offset: 0x0001547C
 private void GenerateWeightedSelection()
 {
     this.weightedSelection.Clear();
     foreach (ExplicitPickupDropTable.Entry entry in this.entries)
     {
         this.weightedSelection.AddChoice(PickupCatalog.FindPickupIndex(entry.pickupName), entry.pickupWeight);
     }
 }
示例#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
            });
        }
        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);
            }
        }
示例#7
0
        public void RollItem()
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.ChestBehavior::RollItem()' called on client");
                return;
            }
            ChestBehavior.< > c__DisplayClass14_0 CS$ < > 8__locals1 = new ChestBehavior.< > c__DisplayClass14_0();
            CS$ < > 8__locals1.< > 4__this = this;
            CS$ < > 8__locals1.selector    = new WeightedSelection <List <PickupIndex> >(8);
            List <PickupIndex> list = new List <PickupIndex>();

            list.Add(PickupCatalog.FindPickupIndex("LunarCoin.Coin0"));
            CS$ < > 8__locals1.< RollItem > g__Add | 1 (Run.instance.availableTier1DropList, this.tier1Chance);
            CS$ < > 8__locals1.< RollItem > g__Add | 1 (Run.instance.availableTier2DropList, this.tier2Chance);
            CS$ < > 8__locals1.< RollItem > g__Add | 1 (Run.instance.availableTier3DropList, this.tier3Chance);
            CS$ < > 8__locals1.< RollItem > g__Add | 1 (Run.instance.availableLunarDropList, this.lunarChance);
            CS$ < > 8__locals1.< RollItem > g__Add | 1 (list, this.lunarCoinChance);
            List <PickupIndex> dropList = CS$ < > 8__locals1.selector.Evaluate(Run.instance.treasureRng.nextNormalizedFloat);

            this.PickFromList(dropList);
        }
        // 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);
                 }
             }
         }
     }
 }
示例#10
0
 public GameObject GetHiddenPickupDisplayPrefab()
 {
     return(PickupCatalog.GetHiddenPickupDisplayPrefab());
 }
示例#11
0
 public PickupIndex(EquipmentIndex equipmentIndex)
 {
     this.value = PickupCatalog.FindPickupIndex(equipmentIndex).value;
 }
示例#12
0
 public PickupIndex(ItemIndex itemIndex)
 {
     this.value = PickupCatalog.FindPickupIndex(itemIndex).value;
 }
示例#13
0
 public static PickupIndex Find(string name)
 {
     return(PickupCatalog.FindPickupIndex(name));
 }
        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());
        }