Ejemplo n.º 1
0
 /// <summary>
 ///     Custom item created as an "empty" primitive.<br />
 ///     At least the name and the Icon of the <see cref="global::ItemDrop"/> must be edited after creation.
 /// </summary>
 /// <param name="name">Name of the new prefab. Must be unique.</param>
 /// <param name="addZNetView">If true a ZNetView component will be added to the prefab for network sync.</param>
 public CustomItem(string name, bool addZNetView)
 {
     ItemPrefab = PrefabManager.Instance.CreateEmptyPrefab(name, addZNetView);
     ItemDrop   = ItemPrefab.AddComponent <ItemDrop>();
     ItemDrop.m_itemData.m_shared        = new ItemDrop.ItemData.SharedData();
     ItemDrop.m_itemData.m_shared.m_name = name;
 }
Ejemplo n.º 2
0
        private void SpawnAlwaysContainedItems()
        {
            if (SpawnWithId.Length > 0)
            {
                string[] splitIds = SpawnWithId.Split(',');
                foreach (string id in splitIds)
                {
                    ItemPrefab prefab = ItemPrefab.Prefabs.Find(m => m.Identifier == id);
                    if (prefab != null && Inventory != null && Inventory.CanBePut(prefab))
                    {
                        bool isEditor = false;
#if CLIENT
                        isEditor = Screen.Selected == GameMain.SubEditorScreen;
#endif
                        if (!isEditor && (Entity.Spawner == null || Entity.Spawner.Removed) && GameMain.NetworkMember == null)
                        {
                            var spawnedItem = new Item(prefab, Vector2.Zero, null);
                            Inventory.TryPutItem(spawnedItem, null, spawnedItem.AllowedSlots, createNetworkEvent: false);
                            alwaysContainedItemsSpawned = true;
                        }
                        else
                        {
                            IsActive = true;
                            Entity.Spawner?.AddToSpawnQueue(prefab, Inventory, spawnIfInventoryFull: false, onSpawned: (Item item) => { alwaysContainedItemsSpawned = true; });
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public override void OnMapLoaded()
        {
            if (itemIds != null)
            {
                for (ushort i = 0; i < itemIds.Length; i++)
                {
                    if (!(Entity.FindEntityByID(itemIds[i]) is Item item))
                    {
                        continue;
                    }
                    if (i >= Inventory.Capacity)
                    {
                        continue;
                    }
                    Inventory.TryPutItem(item, i, false, false, null, false);
                }
                itemIds = null;
            }

            if (SpawnWithId.Length > 0)
            {
                ItemPrefab prefab = ItemPrefab.Prefabs.Find(m => m.Identifier == SpawnWithId);
                if (prefab != null)
                {
                    if (Inventory != null && Inventory.Items.Any(it => it == null))
                    {
                        Entity.Spawner?.AddToSpawnQueue(prefab, Inventory);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Checks if a custom item is valid (i.e. has a prefab, an <see cref="ItemDrop"/> and an icon, if it should be craftable).
        /// </summary>
        /// <returns>true if all criteria is met</returns>
        public bool IsValid()
        {
            bool valid = true;

            if (!ItemPrefab)
            {
                Logger.LogError($"CustomItem {this} has no prefab");
                valid = false;
            }
            if (!ItemPrefab.IsValid())
            {
                valid = false;
            }
            if (ItemDrop == null)
            {
                Logger.LogError($"CustomItem {this} has no ItemDrop component");
                valid = false;
            }
            if (Recipe != null && ItemDrop?.m_itemData.m_shared.m_icons.Length == 0)
            {
                Logger.LogError($"CustomItem {this} has no icon");
                valid = false;
            }

            return(valid);
        }
        protected override void ApplyEffect()
        {
            if (string.IsNullOrEmpty(itemIdentifier))
            {
                DebugConsole.ThrowError("Cannot put item in inventory - itemIdentifier not defined.");
                return;
            }

            ItemPrefab itemPrefab = ItemPrefab.Find(null, itemIdentifier);

            if (itemPrefab == null)
            {
                DebugConsole.ThrowError("Cannot put item in inventory - item prefab " + itemIdentifier + " not found.");
                return;
            }
            for (int i = 0; i < amount; i++)
            {
                if (GameMain.GameSession?.RoundEnding ?? true)
                {
                    Item item = new Item(itemPrefab, Character.WorldPosition, Character.Submarine);
                    Character.Inventory.TryPutItem(item, Character, new List <InvSlotType>()
                    {
                        InvSlotType.Any
                    });
                }
                else
                {
                    Entity.Spawner.AddToSpawnQueue(itemPrefab, Character.Inventory);
                }
            }
        }
Ejemplo n.º 6
0
        public bool ReadExtraCargo(NetBuffer msg)
        {
            bool   changed = false;
            UInt32 count   = msg.ReadUInt32();

            if (ExtraCargo == null || count != ExtraCargo.Count)
            {
                changed = true;
            }
            Dictionary <ItemPrefab, int> extraCargo = new Dictionary <ItemPrefab, int>();

            for (int i = 0; i < count; i++)
            {
                string     prefabName = msg.ReadString();
                byte       amount     = msg.ReadByte();
                ItemPrefab ip         = MapEntityPrefab.List.Find(p => p is ItemPrefab && p.Name.Equals(prefabName, StringComparison.InvariantCulture)) as ItemPrefab;
                if (ip != null && amount > 0)
                {
                    if (changed || !ExtraCargo.ContainsKey(ip) || ExtraCargo[ip] != amount)
                    {
                        changed = true;
                    }
                    extraCargo.Add(ip, amount);
                }
            }
            if (changed)
            {
                ExtraCargo = extraCargo;
            }
            return(changed);
        }
Ejemplo n.º 7
0
        protected override bool MatchesConditionSpecific(AbilityObject abilityObject)
        {
            ItemPrefab itemPrefab = null;

            if ((abilityObject as IAbilityItemPrefab)?.ItemPrefab is ItemPrefab abilityItemPrefab)
            {
                itemPrefab = abilityItemPrefab;
            }
            else if ((abilityObject as IAbilityItem)?.Item is Item abilityItem)
            {
                itemPrefab = abilityItem.Prefab;
            }

            if (itemPrefab != null)
            {
                if (identifiers.Any())
                {
                    if (!identifiers.Any(t => itemPrefab.Identifier == t))
                    {
                        return(false);
                    }
                }

                return(!tags.Any() || tags.Any(t => itemPrefab.Tags.Any(p => t == p)));
            }
            else
            {
                LogAbilityConditionError(abilityObject, typeof(IAbilityItemPrefab));
                return(false);
            }
        }
Ejemplo n.º 8
0
    public void CreateOBJ(ItemPrefab item, UnderGrid gridTo, int Plan)
    {
        GameObject TempOBJ = Instantiate(item.PrefabItem) as GameObject;

        if (item.nameItem == "Start Level")
        {
            if (SpawnPosition != null)
            {
                for (int j = 0; j < 4; j++)
                {
                    for (int i = 0; i < 3; i++)
                    {
                        if (SpawnPosition.SousGrid[j].Plans[i] != null)
                        {
                            if (SpawnPosition.SousGrid[j].Plans[i].name == "0$1")
                            {
                                Destroy(SpawnPosition.SousGrid[j].Plans[i]);
                            }
                        }
                    }
                }
                SpawnPosition = null;
            }
            SpawnPosition = gridTo.MasterGrid;
        }

        gridTo.AddOBJ(item, TempOBJ, MapHolder, Plan);
    }
Ejemplo n.º 9
0
 public RequiredItem(ItemPrefab itemPrefab, int amount, float minCondition, bool useCondition)
 {
     ItemPrefab   = itemPrefab;
     Amount       = amount;
     MinCondition = minCondition;
     UseCondition = useCondition;
 }
Ejemplo n.º 10
0
 void SetInformations(int i)
 {
     CurrentItem                      = GridMapper.Categories[CurrentCategory].ItemListCat[i];
     PanelInfoName.text               = CurrentItem.nameItem;
     PanelCategoryName.text           = GridMapper.Categories[CurrentCategory].NameCate;
     PanelTypeName.text               = CurrentItem.PosType.ToString();
     MouseHolder.CurrentObjectToPlace = CurrentItem;
 }
Ejemplo n.º 11
0
 /// <summary>
 ///     Custom item created as a copy of a vanilla Valheim prefab.
 /// </summary>
 /// <param name="name">The new name of the prefab after cloning.</param>
 /// <param name="basePrefabName">The name of the base prefab the custom item is cloned from.</param>
 public CustomItem(string name, string basePrefabName)
 {
     ItemPrefab = PrefabManager.Instance.CreateClonedPrefab(name, basePrefabName);
     if (ItemPrefab)
     {
         ItemDrop = ItemPrefab.GetComponent <ItemDrop>();
     }
 }
Ejemplo n.º 12
0
 public bool CanBeContained(ItemPrefab itemPrefab, int index)
 {
     if (index < 0 || index >= capacity)
     {
         return(false);
     }
     return(slotRestrictions[index].MatchesItem(itemPrefab));
 }
Ejemplo n.º 13
0
 public bool CanBeContained(ItemPrefab itemPrefab)
 {
     if (ContainableItems.Count == 0)
     {
         return(true);
     }
     return(ContainableItems.Find(c => c.MatchesItem(itemPrefab)) != null);
 }
Ejemplo n.º 14
0
 void Awake()
 {
     foreach (ItemTextureObject ito in itemTextureObjects)
     {
         itemTextures[ito.name] = ito;
     }
     itemPrefab = this;
 }
Ejemplo n.º 15
0
    public Slot FindItemByPrefab( ItemPrefab prefab )
    {
        foreach (Slot slot in slots)
            if (slot.item && slot.item.prefab == prefab)
                return slot;

        return null;
    }
Ejemplo n.º 16
0
        public FabricableItem(XElement element)
        {
            string name = ToolBox.GetAttributeString(element, "name", "");

            TargetItem = ItemPrefab.list.Find(ip => ip.Name.ToLowerInvariant() == name.ToLowerInvariant()) as ItemPrefab;
            if (TargetItem == null)
            {
                DebugConsole.ThrowError("Error in fabricable item " + name + "! Item \"" + element.Name + "\" not found.");
                return;
            }

            RequiredSkills = new List <Skill>();

            RequiredTime = ToolBox.GetAttributeFloat(element, "requiredtime", 1.0f);

            RequiredItems = new List <Tuple <ItemPrefab, int> >();

            string[] requiredItemNames = ToolBox.GetAttributeString(element, "requireditems", "").Split(',');
            foreach (string requiredItemName in requiredItemNames)
            {
                if (string.IsNullOrWhiteSpace(requiredItemName))
                {
                    continue;
                }

                ItemPrefab requiredItem = ItemPrefab.list.Find(ip => ip.Name.ToLowerInvariant() == requiredItemName.Trim().ToLowerInvariant()) as ItemPrefab;
                if (requiredItem == null)
                {
                    DebugConsole.ThrowError("Error in fabricable item " + name + "! Required item \"" + requiredItemName + "\" not found.");

                    continue;
                }

                var existing = RequiredItems.Find(r => r.Item1 == requiredItem);

                if (existing == null)
                {
                    RequiredItems.Add(new Tuple <ItemPrefab, int>(requiredItem, 1));
                }
                else
                {
                    RequiredItems.Remove(existing);
                    RequiredItems.Add(new Tuple <ItemPrefab, int>(requiredItem, existing.Item2 + 1));
                }
            }

            foreach (XElement subElement in element.Elements())
            {
                switch (subElement.Name.ToString().ToLowerInvariant())
                {
                case "requiredskill":
                    RequiredSkills.Add(new Skill(
                                           ToolBox.GetAttributeString(subElement, "name", ""),
                                           ToolBox.GetAttributeInt(subElement, "level", 0)));
                    break;
                }
            }
        }
Ejemplo n.º 17
0
    public Slot FindItemByType(ItemPrefab.Type type)
    {
        foreach (Slot slot in slots) {
            if (slot.item && slot.item.prefab.type == type)
                return slot;
        }

        return null;
    }
Ejemplo n.º 18
0
        /// <summary>
        /// Spawns a primary at random.
        /// </summary>
        public static void SpawnPrimary()
        {
            var max = GetMaxPrimaries();

            // Do not spawn a primary if we're at or above max.
            var totalActive = Budget.Sum(b => b.Active);

            if (totalActive >= max)
            {
                return;
            }

            // Filter out lancer if we shouldn't spawn it.
            var spawnLancer    = SpawnLancer();
            var filteredBudget = Budget.Where(b => b.Type != WeaponType.LANCER || spawnLancer);

            // Get the total budget and the total remaining.
            var totalBudget    = filteredBudget.Sum(b => b.Budget);
            var totalRemaining = filteredBudget.Sum(b => b.Remaining);

            // Pick a random number from 0 to totalRemaining.
            var random = UnityEngine.Random.Range(0f, totalRemaining);

            // Loop through the budget and pick out one random weapon from the budget.
            var           current = 0f;
            PrimaryBudget spawn   = null;

            foreach (var weapon in filteredBudget)
            {
                current += weapon.Remaining;
                if (random <= current)
                {
                    spawn = weapon;
                    break;
                }
            }

            // If we didn't find anything to spawn, bail!  Can happen if all of the level's primaries are disallowed on the server.
            if (spawn == null)
            {
                return;
            }

            // Spawn the weapon.
            ItemPrefab item = ChallengeManager.WeaponTypeToPrefab(spawn.Type);

            // NetworkMatch.SpawnItem(item, false);
            AccessTools.Method(typeof(NetworkMatch), "SpawnItem").Invoke(null, new object[] { item, false });

            // Increment the active count and decrement remaining budget accordingly.
            spawn.Active++;
            spawn.Remaining = Mathf.Max(0f, spawn.Remaining - max / totalBudget);

            // Reset weapon spawn timer.
            SpawnWeaponTimer = UnityEngine.Random.Range(30f / max, 60f / max);
        }
Ejemplo n.º 19
0
        public static bool Prefix(ref int[] ___m_spawn_weapon_count)
        {
            // Setup the primary budget.
            MPPrimaries.Budget.Clear();
            foreach (var weapon in RobotManager.m_multiplayer_spawnable_weapons)
            {
                var weaponType = (WeaponType)weapon.type;
                if (NetworkMatch.IsWeaponAllowed(weaponType))
                {
                    MPPrimaries.Budget.Add(new PrimaryBudget
                    {
                        Type      = weaponType,
                        Budget    = weapon.percent,
                        Remaining = weapon.percent,
                        Active    = 0
                    });
                }

                Debug.Log($"MPPrimaries - Added {weaponType}, budget {weapon.percent}");
            }

            // Spawn in initial primaries.
            var primaries = MPPrimaries.GetMaxPrimaries();

            for (int i = 0; i < primaries; i++)
            {
                MPPrimaries.SpawnPrimary();
            }

            // This is the rest of the PowerupLevelStart code, currently unmodified.
            var num = RobotManager.m_multi_missile_count;

            for (int n = 0; n < num; n++)
            {
                MissileType missileType = NetworkMatch.RandomAllowedMissileSpawn();
                if (missileType != MissileType.NUM)
                {
                    ItemPrefab item2 = ChallengeManager.MissileTypeToPrefab(missileType);
                    // NetworkMatch.SpawnItem(item2, false);
                    AccessTools.Method(typeof(NetworkMatch), "SpawnItem").Invoke(null, new object[] { item2, false });
                }
            }
            NetworkMatch.SetSpawnMissileTimer();
            NetworkMatch.SetSpawnSuperTimer();
            NetworkMatch.SetSpawnBasicTimer();

            // Get rid of weapon counts so they aren't triggered by the original function.
            for (var i = 0; i < 8; i++)
            {
                ___m_spawn_weapon_count[i] = 0;
            }

            // Short circuit the original code.
            return(false);
        }
Ejemplo n.º 20
0
 private void SpawnAlwaysContainedItems()
 {
     if (SpawnWithId.Length > 0)
     {
         ItemPrefab prefab = ItemPrefab.Prefabs.Find(m => m.Identifier == SpawnWithId);
         if (prefab != null && Inventory != null && Inventory.Items.Any(it => it == null))
         {
             Entity.Spawner?.AddToSpawnQueue(prefab, Inventory, spawnIfInventoryFull: false);
         }
     }
 }
Ejemplo n.º 21
0
        /// <summary>
        ///     Custom item created as a copy of a vanilla Valheim prefab with a <see cref="global::Recipe"/> made from a <see cref="ItemConfig"/>.
        /// </summary>
        /// <param name="name">The new name of the prefab after cloning.</param>
        /// <param name="basePrefabName">The name of the base prefab the custom item is cloned from.</param>
        /// <param name="itemConfig">The recipe config for this custom item.</param>
        public CustomItem(string name, string basePrefabName, ItemConfig itemConfig)
        {
            ItemPrefab = PrefabManager.Instance.CreateClonedPrefab(name, basePrefabName);
            if (ItemPrefab)
            {
                ItemDrop = ItemPrefab.GetComponent <ItemDrop>();

                itemConfig.Item = name;
                Recipe          = new CustomRecipe(itemConfig.GetRecipe(), true, true);
            }
        }
Ejemplo n.º 22
0
 public EquippableItem(EquippableItemData data, Transform equipTransform)
 {
     EquipTransform = equipTransform;
     ItemId         = data.ItemId;
     Icon           = data.Icon;
     Name           = data.Name;
     Description    = data.Description;
     ItemPrefab     = Object.Instantiate(data.ItemPrefab, EquipTransform);
     ItemPrefab.SetActive(false);
     EquipmentType = data.EquipmentType;
 }
Ejemplo n.º 23
0
        /// <summary>
        ///     Custom item created as an "empty" primitive with a <see cref="global::Recipe"/> made from a <see cref="ItemConfig"/>.<br />
        ///     At least the name and the Icon of the <see cref="global::ItemDrop"/> must be edited after creation.
        /// </summary>
        /// <param name="name">Name of the new prefab. Must be unique.</param>
        /// <param name="addZNetView">If true a ZNetView component will be added to the prefab for network sync.</param>
        /// <param name="itemConfig">The recipe config for this custom item.</param>
        public CustomItem(string name, bool addZNetView, ItemConfig itemConfig)
        {
            ItemPrefab = PrefabManager.Instance.CreateEmptyPrefab(name, addZNetView);
            if (ItemPrefab)
            {
                ItemDrop = ItemPrefab.AddComponent <ItemDrop>();

                itemConfig.Item = name;
                Recipe          = new CustomRecipe(itemConfig.GetRecipe(), true, true);
            }
        }
Ejemplo n.º 24
0
    private void DropItem(string toDrop, byte[] item, Vector3 pos)
    {
        if (PhotonNetwork.IsMasterClient)
        {
            ItemPrefab insItem = PhotonNetwork.InstantiateSceneObject(toDrop, pos, Quaternion.identity).GetComponent <ItemPrefab>();
            insItem.Drop(item);

            //int id = insItem.GetComponent<PhotonView>().ViewID;
            //photonView.RPC("RI", RpcTarget.AllBuffered, item, id);
        }
    }
Ejemplo n.º 25
0
    public static void Init()
    {
        pickablePrefab = Resources.Load <GameObject>("Prefab/GameObject/Interactable/DropableItemPrefab").GetComponent <ItemPrefab>();
        backGround     = GameObject.FindWithTag("BackGround");
        //middleGround = GameObject.FindWithTag("MiddleGround");
        recipes = InitRecipes();

        foreach (Recipe recipe in recipes)
        {
            Debug.Log(recipe.potion.itemName + " : " + recipe.Items[0].itemName + " " + recipe.Items[1].itemName + " " + recipe.Items[2].itemName);
        }
    }
Ejemplo n.º 26
0
        public ProducedItem(XElement element)
        {
            SerializableProperty.DeserializeProperties(this, element);

            string itemIdentifier = element.GetAttributeString("identifier", string.Empty);

            if (!string.IsNullOrWhiteSpace(itemIdentifier))
            {
                Prefab = ItemPrefab.Find(null, itemIdentifier);
            }

            LoadSubElements(element);
        }
Ejemplo n.º 27
0
        /// <summary>
        ///     Custom item created as an "empty" primitive with a <see cref="global::Recipe"/> made from a <see cref="ItemConfig"/>.
        /// </summary>
        /// <param name="name">Name of the new prefab. Must be unique.</param>
        /// <param name="addZNetView">If true a ZNetView component will be added to the prefab for network sync.</param>
        /// <param name="itemConfig">The item config for this custom item.</param>
        public CustomItem(string name, bool addZNetView, ItemConfig itemConfig)
        {
            ItemPrefab = PrefabManager.Instance.CreateEmptyPrefab(name, addZNetView);
            ItemDrop   = ItemPrefab.AddComponent <ItemDrop>();
            ItemDrop.m_itemData.m_shared = new ItemDrop.ItemData.SharedData();
            itemConfig.Apply(ItemPrefab);
            FixConfig = true;
            var recipe = itemConfig.GetRecipe();

            if (recipe != null)
            {
                Recipe = new CustomRecipe(recipe, true, true);
            }
        }
Ejemplo n.º 28
0
        protected Item FindOrGiveItem(Character character, string identifier)
        {
            var item = character.Inventory.FindItemByIdentifier(identifier);

            if (item != null && !item.Removed)
            {
                return(item);
            }

            ItemPrefab itemPrefab = MapEntityPrefab.Find(name: null, identifier: identifier) as ItemPrefab;

            item = new Item(itemPrefab, Vector2.Zero, submarine: null);
            character.Inventory.TryPutItem(item, character, item.AllowedSlots);
            return(item);
        }
Ejemplo n.º 29
0
 public static string TryCreateName(ItemPrefab prefab, XElement element)
 {
     foreach (XElement subElement in element.Elements())
     {
         if (subElement.Name.ToString().Equals(nameof(GeneticMaterial), StringComparison.OrdinalIgnoreCase))
         {
             string nameId = subElement.GetAttributeString("nameidentifier", "");
             if (!string.IsNullOrEmpty(nameId))
             {
                 return(prefab.Name.Replace("[type]", TextManager.Get(nameId, returnNull: true) ?? nameId));
             }
         }
     }
     return(prefab.Name);
 }
Ejemplo n.º 30
0
 public override void OnItemLoaded()
 {
     base.OnItemLoaded();
     if (SpawnWithId.Length > 0)
     {
         ItemPrefab prefab = ItemPrefab.Prefabs.Find(m => m.Identifier == SpawnWithId);
         if (prefab != null)
         {
             if (Inventory != null && Inventory.Items.Any(it => it == null))
             {
                 Entity.Spawner?.AddToSpawnQueue(prefab, Inventory);
             }
         }
     }
 }
Ejemplo n.º 31
0
    /// <summary>
    /// Creates an item form the inputs
    /// </summary>
    /// <param name="name"></param>
    /// <param name="level"></param>
    /// <param name="value"></param>
    /// <param name="rarity"></param>
    /// <param name="itemPrefabName"></param>
    /// <returns>returns the item</returns>
    public static Item CreateItem(string name, int level, int value, ItemRarity rarity, string itemPrefabName)
    {
        ItemPrefab itemPrefab = Resources.Load <ItemPrefab>("Items/" + itemPrefabName);
        Item       item       = new Item
        {
            name           = name,
            level          = level,
            value          = value,
            rarity         = rarity,
            model          = itemPrefab.model,
            sprite         = itemPrefab.sprite,
            itemPrefabName = itemPrefabName,
        };

        return(item);
    }
Ejemplo n.º 32
0
    public static ItemPrefab InstantiatePickable(Vector3 position, Pickable item, SpawnerAbstract spawn)
    {
        if (pickablePrefab == null)
        {
            pickablePrefab = Resources.Load <ItemPrefab>("Prefab/GameObject/Interactable/DropableItemPrefab");
        }

        ItemPrefab newGm = GameObject.Instantiate <ItemPrefab>(pickablePrefab);

        newGm.Init(new Vector3(position.x, position.y, 5), item, spawn);
        newGm.transform.SetParent(backGround.transform, true);
        BoxCollider2D box = newGm.gameObject.AddComponent <BoxCollider2D>();

        box.isTrigger = true;
        return(newGm);
    }
Ejemplo n.º 33
0
 public static Color RarityColor(ItemPrefab.Rarity rarity)
 {
     return game.itemRarityColors[(int)rarity];
 }
Ejemplo n.º 34
0
    void DeletePrefab()
    {
        item = new ItemPrefab(editingDisplay);

        if (item.Load())
            item.Delete();
    }
Ejemplo n.º 35
0
 void CreatePrefab()
 {
     // Configure the correponding prefab
     item = new ItemPrefab(editingDisplay);
     item.Save(editingDisplay);
 }
Ejemplo n.º 36
0
 public static Material RarityMaterial(ItemPrefab.Rarity rarity)
 {
     return game.itemRarityMaterials[(int)rarity];
 }