public SeedInfoGump(PlayerMobile user, SeedBox box, SeedEntry entry, SeedBoxGump par) : base(user, parent: par) { Box = box; Entry = entry; user.CloseGump(this.GetType()); }
public bool TryAddSeed(Mobile from, Seed seed, int index = -1) { if (!from.Backpack.CheckHold(from, seed, true, true) || seed.Amount <= 0) { return(false); } else if (!from.InRange(this.GetWorldLocation(), 3) || from.Map != this.Map) { return(false); } else if (TotalCount + seed.Amount <= MaxSeeds) { SeedEntry entry = GetExisting(seed); int oldcount = UniqueCount; if (entry != null) { entry.Seed.Amount += seed.Amount; seed.Delete(); } else if (UniqueCount < MaxUnique) { entry = new SeedEntry(seed); DropItem(seed); seed.Movable = false; } else { from.SendLocalizedMessage(1151839); // There is not enough room in the box. } if (entry != null) { if (Entries.Contains(entry)) { if (index > -1 && index < Entries.Count - 1) { Entries.Remove(entry); AddEntry(entry, index); } } else { if (index > -1 && index < Entries.Count) { AddEntry(entry, index); } else { AddEntry(entry); } } from.SendLocalizedMessage(1151846); // You put the seed in the seedbox. if (from is PlayerMobile) { var gump = new SeedBoxGump((PlayerMobile)from, this); gump.CheckPage(entry); BaseGump.SendGump(gump); } InvalidateProperties(); return(true); } } else { from.SendLocalizedMessage(1151839); // There is not enough room in the box. } return(false); }
public bool TryAddSeed(Mobile from, Seed seed, int index = -1) { if (!CheckAccessible(from, this)) { PrivateOverheadMessage(MessageType.Regular, 946, 1010563, from.NetState); // This container is secure. return(false); } if (!from.Backpack.CheckHold(from, seed, true, true) || seed.Amount <= 0) { return(false); } if (!from.InRange(GetWorldLocation(), 3) || from.Map != Map) { return(false); } if (TotalCount + seed.Amount <= MaxSeeds) { SeedEntry entry = GetExisting(seed); if (entry != null) { entry.Seed.Amount += seed.Amount; seed.Delete(); } else if (UniqueCount < MaxUnique) { entry = new SeedEntry(seed); DropItem(seed); seed.Movable = false; } else { from.SendLocalizedMessage(1151839); // There is not enough room in the box. } if (entry != null) { InvalidateProperties(); if (Entries.Contains(entry)) { if (index > -1 && index < Entries.Count - 1) { Entries.Remove(entry); AddEntry(entry, index); } } else { if (index > -1 && index < Entries.Count) { AddEntry(entry, index); } else { AddEntry(entry); } } from.SendLocalizedMessage(1151846); // You put the seed in the seedbox. if (from is PlayerMobile mobile) { var gump = mobile.FindGump <SeedBoxGump>(); if (gump != null) { gump.CheckPage(entry); gump.Refresh(); } else { gump = new SeedBoxGump(mobile, this); gump.CheckPage(entry); BaseGump.SendGump(gump); } } return(true); } } else { from.SendLocalizedMessage(1151839); // There is not enough room in the box. } return(false); }