コード例 #1
0
        public int CompareTo(object obj)
        {
            if (!(obj is ItemListEntry))
            {
                return(0);   //cannot sort
            }

            ItemListEntry entry = (ItemListEntry)obj;

            //if the sort index is invalid
            if (Columns.Count <= SortIndex || SortIndex == -1)
            {
                return(0);
            }

            //TODO: special case:  sort by hue if SortIndex = -1

            //null text can't be sorted
            if (Columns[SortIndex].Text == null || entry.Columns[SortIndex].Text == null)
            {
                return(0);
            }

            return(Columns[SortIndex].Text.CompareTo(entry.Columns[SortIndex].Text) * SortOrder);
        }
コード例 #2
0
        public override void Deserialize(GenericReader reader)
        {
            //handle base StoreEntry deserialization first
            base.Deserialize(reader);
            int version = reader.ReadInt();

            switch (version)
            {
            case 0:
            default:
            {
                _ItemListEntryType = ScriptCompiler.FindTypeByName(reader.ReadString());

                int count = reader.ReadInt();

                for (int i = 0; i < count; i++)
                {
                    string typestring = reader.ReadString();

                    Type type = ScriptCompiler.FindTypeByName(typestring);

                    ItemListEntry entry = (ItemListEntry)Activator.CreateInstance(type, new object[] { reader });

                    ItemListEntries.Add(entry);
                }
                break;
            }
            }
        } //deserialize
コード例 #3
0
 //clone constructor
 public ItemListEntry(ItemListEntry entry)
 {
     _Type     = entry.Type;
     _Name     = entry.Name;
     _Hue      = entry.Hue;
     _LootType = entry.LootType;
     _Insured  = entry.Insured;
 }
コード例 #4
0
        //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);
        }
コード例 #5
0
 public virtual void WithdrawItem(Mobile from, ItemListEntry entry)
 {
     WithdrawItem(from, ItemListEntries.IndexOf(entry));
 }
コード例 #6
0
		//clone constructor
		public ItemListEntry( ItemListEntry entry )
		{
			_Type = entry.Type;
			_Name = entry.Name;
			_Hue = entry.Hue;
			_LootType = entry.LootType;
			_Insured = entry.Insured;
			
		}
コード例 #7
0
		public virtual void WithdrawItem( Mobile from, ItemListEntry entry )
		{
			WithdrawItem( from, ItemListEntries.IndexOf( entry ) );
		}