Server.Items.FillableEntry.Construct C# (CSharp) Méthode

Construct() public méthode

public Construct ( ) : Item
Résultat Item
		public virtual Item Construct()
		{
			Item item = Loot.Construct( m_Types );

			if( item is Key )
				( (Key)item ).ItemID = Utility.RandomList( (int)KeyType.Copper, (int)KeyType.Gold, (int)KeyType.Iron, (int)KeyType.Rusty );
			else if( item is Arrow || item is Bolt )
				item.Amount = Utility.RandomMinMax( 2, 6 );
			else if( item is Bandage || item is Lockpick )
				item.Amount = Utility.RandomMinMax( 1, 3 );

			return item;
		}
	}

Usage Example

Exemple #1
0
        public virtual Item Construct()
        {
            int index = Utility.Random(m_Weight);

            for (int i = 0; i < m_Entries.Length; ++i)
            {
                FillableEntry entry = m_Entries[i];

                if (index < entry.Weight)
                {
                    return(entry.Construct());
                }

                index -= entry.Weight;
            }

            return(null);
        }