예제 #1
0
        //method to add an item to the stash
        public override bool Add(Item item)
        {
            //check configuration-specific conditions for adding the item
            if (!CheckExtras.Add(item))
            {
                return(false);
            }

            //if this item is not compatable with this entry, then abort
            if (!Match(item, false))
            {
                return(false);
            }

            //try to create the stash list entry

            try
            {
                //when a stash list entry is created successfully, the item is parked in the internal map
                StashListEntry entry = new StashListEntry(item);
                entry.StashEntry = this;

                //check to make sure everything is ok with the item being added.
                if (entry.AllGood(item))
                {
                    StashListEntries.Add(entry);

                    return(true);
                }
            }
            catch
            {
            }

            return(false);
        }
예제 #2
0
        protected string GetText(StashListEntry entry, string[] propertynames, string[] altpropertynames)
        {
            if (entry.Item == null)
            {
                return("NULL!!");
            }

            //special case: best name
            if (propertynames[0] == "best name")
            {
                return(entry.Name);
            }

            //if it's a regular property, find its value through reflection
            string name = GetPropertyName(entry.Item, propertynames);

            //if there is an alternate property, then get that add in that info too
            if (altpropertynames != null)
            {
                name += ":" + GetPropertyName(entry.Item, altpropertynames);
            }

            return(name);
        }
예제 #3
0
 public virtual void WithdrawItem(Mobile from, StashListEntry entry)
 {
     WithdrawItem(from, StashListEntries.IndexOf(entry));
 }
예제 #4
0
 //these are used to get the text label for a particular column of a particular entry
 public string GetText(StashListEntry entry, int column)
 {
     return(GetText(entry, SortData[column].PropertyNames, SortData[column].AltPropertyNames));
 }
		//clone constructor
		public StashListEntry( StashListEntry entry )
		{
			//pass over the reference to the item
			_Item = entry.Item;
			_Hue = entry.Hue;
			StashEntry = entry.StashEntry;
			
		}
예제 #6
0
		public override void Deserialize( GenericReader reader )
		{
			//handle base StoreEntry deserialization first
			base.Deserialize( reader );
			
			int version = reader.ReadInt();
			
			switch( version )
			{
				case 0:
				default:
				{
					int count = reader.ReadInt();
					
					for( int i = 0; i < count; i++ )
					{
						StashListEntry entry = new StashListEntry( reader );
						
						if( entry.Item != null )
						{
						
							StashListEntries.Add( entry );
							entry.StashEntry = this;
						}
					}
					break;
				}
			}
			
			
		}//deserialize		
예제 #7
0
		public virtual void WithdrawItem( Mobile from, StashListEntry entry )
		{
			
			WithdrawItem( from, StashListEntries.IndexOf( entry )  );
		}
예제 #8
0
		//method to add an item to the stash
		public override bool Add( Item item )
		{
			//check configuration-specific conditions for adding the item
			if( !CheckExtras.Add( item ) )
			{
				return false;
			}
			
			//if this item is not compatable with this entry, then abort
			if( !Match( item, false ) )
			{
				return false;
			}
			
			//try to create the stash list entry
			
			try
			{
				//when a stash list entry is created successfully, the item is parked in the internal map
				StashListEntry entry = new StashListEntry( item );
				entry.StashEntry = this;
				
				//check to make sure everything is ok with the item being added.
				if( entry.AllGood( item ) )
				{
					StashListEntries.Add( entry );
					
					return true;
				}
				
			}
			catch
			{
			}
			
			return false;
		}
예제 #9
0
		protected string GetText( StashListEntry entry, string[] propertynames, string[] altpropertynames )
		{
			if( entry.Item == null )
			{
				return "NULL!!";
			}
			
			//special case: best name 
			if( propertynames[0] == "best name" )
			{
				return entry.Name;
			}
			
			
			
			//if it's a regular property, find its value through reflection
			string name = GetPropertyName( entry.Item, propertynames );
			
			//if there is an alternate property, then get that add in that info too
			if( altpropertynames != null )
			{
				name += ":" + GetPropertyName( entry.Item, altpropertynames );
			}
			
			return name;
			
			
		}
예제 #10
0
		//these are used to get the text label for a particular column of a particular entry
		public string GetText( StashListEntry entry, int column )
		{
			return GetText( entry, SortData[column].PropertyNames, SortData[column].AltPropertyNames );
		}