コード例 #1
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
コード例 #2
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);
        }
コード例 #3
0
 //this performs a cloning of the stash list entries within the specified stash entry
 public void CloneStashListEntries(StashEntry sourceentry)
 {
     foreach (StashListEntry entry in sourceentry.StashListEntries)
     {
         StashListEntry cloneentry = entry.Clone();
         cloneentry.StashEntry = this;               //need to explicitly pass the reference to this new list into clone
         StashListEntries.Add(cloneentry);
     }
 }
コード例 #4
0
        //this performs the withdrawal of the item from the specified index
        public Item WithdrawItem(int index)
        {
            try
            {
                Item withdrawitem = StashListEntries[index].WithdrawItem();

                //remove this from the list
                StashListEntries.RemoveAt(index);

                return(withdrawitem);
            }
            catch
            {
            }

            return(null);
        }
コード例 #5
0
 public virtual void WithdrawItem(Mobile from, StashListEntry entry)
 {
     WithdrawItem(from, StashListEntries.IndexOf(entry));
 }
コード例 #6
0
 public void Sort()
 {
     StashListEntries.Sort();
 }