Exemplo n.º 1
0
        /// <param name="Autofill">If true, then when the player picks up an item that can be stored in this bag, it will automatically be stored if there is space for it.</param>
        public BoundedBag(BagType TypeInfo, ContainerSize Size, bool Autofill)
            : base(BagType.GetTranslatedName(TypeInfo), "", Size, TypeInfo.GetIconTexture(), TypeInfo.IconSourceRect, new Vector2(16, 16), 0.5f, 1f)
        {
            this.TypeInfo = TypeInfo;
            this.SizeInfo = TypeInfo.SizeSettings.FirstOrDefault(x => x.Size == Size);
            if (SizeInfo == null) // This should never happen but just in case...
            {
                SizeInfo = TypeInfo.SizeSettings.First();
            }
            this.Autofill = Autofill;

            _MaxStackSize = ItemBagsMod.UserConfig.GetStandardBagCapacity(Size, TypeInfo);

            DescriptionAlias = string.Format("{0}\n({1})",
                                             BagType.GetTranslatedDescription(TypeInfo),
                                             ItemBagsMod.Translate("CapacityDescription", new Dictionary <string, string>()
            {
                { "count", MaxStackSize.ToString() }
            }));

            if (SizeInfo.Size != Size)
            {
                this.AllowedObjects = new ReadOnlyCollection <AllowedObject>(new List <AllowedObject>());
            }
            else
            {
                this.AllowedObjects = new ReadOnlyCollection <AllowedObject>(SizeInfo.Items.Select(x => new AllowedObject(x)).ToList());
            }
            this.ExcludedAutofillItems = new Dictionary <string, HashSet <ObjectQuality> >();
        }
Exemplo n.º 2
0
 /// <param name="Autofill">If true, then when the player picks up an item that can be stored in this bag, it will automatically be stored if there is space for it.</param>
 public BoundedBag(BagType TypeInfo, ContainerSize Size, bool Autofill)
     : base(BagType.GetTranslatedName(TypeInfo), "", Size, TypeInfo.GetIconTexture(), TypeInfo.IconSourceRect, new Vector2(16, 16), 0.5f, 1f)
 {
     this.TypeInfo = TypeInfo;
     this.Autofill = Autofill;
     this.ExcludedAutofillItems = new Dictionary <string, HashSet <ObjectQuality> >();
     OnSizeChanged += BoundedBag_OnSizeChanged;
 }