Exemplo n.º 1
0
 public override bool OnPickup(Item item, Player player)
 {
     if (pickup != null && BagPickup.NotStorage(item))
     {
         if (canStack)
         {
             for (int a = 0; a < pickup.contained.Count; a++)
             {
                 if (pickup.contained[a].type == item.type && pickup.contained[a].prefix == item.prefix && BagPickup.EndlessStack(pickup, item.type, a))
                 {
                     Main.PlaySound(SoundID.Grab);
                     pickup.contained[a].stack += item.stack;
                     ItemText.NewText(item, item.stack);
                     item.SetDefaults(ItemID.None);
                     canStack = false;
                     break;
                 }
             }
             BagPickup.SetList(new Item(), player.GetModPlayer <CastledPlayer>(), pickup);
             return(false);
         }
         if (!canStack && pickup.contained.Count < pickup.limit)
         {
             Main.PlaySound(SoundID.Grab);
             pickup.contained.Add(item.Clone());
             ItemText.NewText(item, item.stack);
             BagPickup.SetList(new Item(), player.GetModPlayer <CastledPlayer>(), pickup);
             return(false);
         }
     }
     return(base.OnPickup(item, player));
 }
Exemplo n.º 2
0
        public static PackageData Load(TagCompound tag)
        {
            int       limit   = tag.GetInt("SLimit");
            bool      pickup  = tag.GetBool("SPickup");
            BagPickup bagInit = new BagPickup(limit, pickup)
            {
                contained = tag.Get <List <Item> >("SStorage")
            };

            return(new PackageData(tag.Get <Vector2>("coord"), tag.GetInt("type"), bagInit));
        }
Exemplo n.º 3
0
 public override bool ItemSpace(Item item, Player player)
 {
     if (pickup != null && BagPickup.NotStorage(item))
     {
         for (int a = 0; a < pickup.contained.Count; a++)
         {
             if (pickup.contained[a].type == item.type && pickup.contained[a].prefix == item.prefix && BagPickup.EndlessStack(pickup, item.type, a))
             {
                 canStack = true;
                 break;
             }
         }
         if (!canStack)
         {
             return(pickup.contained.Count < pickup.limit);
         }
         else
         {
             return(true);
         }
     }
     return(base.ItemSpace(item, player));
 }
Exemplo n.º 4
0
 public PackageData(Vector2 coord, int type, BagPickup storage1)
 {
     coordinates = coord;
     itemType    = type;
     storage     = storage1;
 }