示例#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);
        }
        //adding directly to the item list entry
        public override bool Add(Item item)
        {
            //check configuration-specific conditions for adding the item
            if (!CheckExtras.Add(item))
            {
                return(false);
            }


            if (!Match(item, false))
            {
                return(false);
            }

            //try to create the item list entry

            try
            {
                ItemListEntry entry = (ItemListEntry)Activator.CreateInstance(_ItemListEntryType, new object[] { item });

                //check to make sure everything is ok with the item being added.  This checks things like if a treasure map has
                //already been completed, for example.
                if (entry.AllGood(item))
                {
                    ItemListEntries.Add(entry);

                    item.Delete();

                    return(true);
                }
            }
            catch
            {
            }


            return(false);
        }