//this is the actual withdrawal action. it withdraws the item from the listentry and puts it in the backpack of the specified person public virtual void WithdrawItem(Mobile from, int index) { if (index < 0 || index >= ItemListEntries.Count) { from.SendMessage("Invalid withrawal selection"); return; } Item item = WithdrawItem(index); if (item != null) { from.AddToBackpack(item); //resend the store gump after it's all done if (!ItemStoreGump.RefreshGump(from)) { //send a new store gump if there's no existing one up from.SendGump(new ItemStoreGump(from, Store)); } //resend the item list entry gump after it's all done if (!ListEntryGump.RefreshGump(from)) { //send a new list entry gump if there's no existing one up from.SendGump(new ListEntryGump(from, this)); } } }
//this performs the actual addition checks public void AddItem(Mobile from, object targeted) { if (!CanUse(from) || !(targeted is Item)) { return; } if (!Add((Item)targeted)) { return; } //resend the targeting cursor and refresh the gump if (from != null) { AddItem(from); //resend the store gump after it's all done if (!ItemStoreGump.RefreshGump(from)) { //send a new store gump if there's no existing one up from.SendGump(new ItemStoreGump(from, Store)); } //resend the item list entry gump after it's all done if (!ListEntryGump.RefreshGump(from)) { //send a new list entry gump if there's no existing one up from.SendGump(new ListEntryGump(from, this)); } } }
//this performs an automatic sweep of all items in the user's backpack, and fills the the list entry with the items if it is possible public void FillFromBackpack(Mobile from) { if (from == null || from.Backpack == null) { return; } //generate a list of all items in the backpack List <Item> packitems = ItemStore.RecurseFindItemsInPack(from.Backpack); //go through backpack list, and try to add the items foreach (Item item in packitems) { AddItem(null, item); } //resend the store gump after it's all done if (!ItemStoreGump.RefreshGump(from)) { //send a new store gump if there's no existing one up from.SendGump(new ItemStoreGump(from, Store)); } //resend the item list entry gump after it's all done if (!ListEntryGump.RefreshGump(from)) { //send a new list entry gump if there's no existing one up from.SendGump(new ListEntryGump(from, this)); } }
public void FillFromBackpack(Mobile from, bool resendgump) { if (from == null || from.Backpack == null) { return; } FillFromContainer(from.Backpack); //resend the gump after it's all done. Note that if the gump is already up, it will refresh if (!ItemStoreGump.RefreshGump(from) && resendgump) { //send a new gump if there's no existing one up and resendgump was set true from.SendGump(new ItemStoreGump(from, this)); } //refresh the item list entry gump if one is up ListEntryGump.RefreshGump(from); }