//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 (!StashEntryGump.RefreshGump(from)) { //send a new list entry gump if there's no existing one up from.SendGump(new StashEntryGump(from, this)); } }
//this is the actual withdrawal action. it withdraws the item from the stashentry and puts it in the backpack of the mobile public virtual void WithdrawItem(Mobile from, int index) { if (index < 0 || index >= StashListEntries.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 (!StashEntryGump.RefreshGump(from)) { //send a new list entry gump if there's no existing one up from.SendGump(new StashEntryGump(from, this)); } } }
//this performs the actual addition checks after the user has targeted the desired object public void AddItem(Mobile from, object targeted) { if (!CanUse(from) || !(targeted is Item)) { return; } //try to add this item 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 (!StashEntryGump.RefreshGump(from)) { //send a new list entry gump if there's no existing one up from.SendGump(new StashEntryGump(from, this)); } } }