public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else { MasterStorage backpack = MasterStorageUtils.GetMasterStorage(from as PlayerMobile); if (backpack == null || backpack.Deleted) { from.SendMessage(1173, "You must have your Master Storage in your backpack!"); } else if (backpack.HasStorage(Storage)) { from.SendMessage(1173, "You can store these items already."); } else if (this.Deleted) { from.SendMessage(1173, "You can't use this deed anymore."); } else { backpack.AddStorage(storage); this.Delete(); from.SendMessage(1173, "You can store {0} items now.", Storage.Name); } } }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else { MasterStorage backpack = MasterStorageUtils.GetMasterStorage(from as PlayerMobile); if (backpack == null) { from.SendMessage("You must have your Master Storage in your backpack!"); } else if (backpack.TokenLedger) { from.SendMessage("You already have token ledger enabled on your Master Storage backpack."); } else if (!this.Deleted && !backpack.Deleted) { backpack.TokenLedger = true; this.Delete(); from.SendMessage("You enabled the token ledger on your Master Storage backpack."); } } }
public override void OnDoubleClick(Mobile from) { if (!IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } else { MasterStorage backpack = MasterStorageUtils.GetMasterStorage(from as PlayerMobile); if (backpack == null) { from.SendMessage("You must have your Master Storage in your backpack!"); } else if (backpack.KeepItemsOnDeath) { from.SendMessage("You already keep your items when you die."); } else if (!this.Deleted && !backpack.Deleted) { backpack.KeepItemsOnDeath = true; this.Delete(); from.SendMessage("From now on you'll keep your items when you'll die."); } } }
public override void OnResponse(NetState sender, RelayInfo info) { if (player == null) { return; } if (info.ButtonID == (int)BUTTONS_ENUM.OK) { CloseGump(player); } else if (info.ButtonID == (int)BUTTONS_ENUM.WEBSITE) { player.LaunchBrowser("http://daat99.home.dyndns.org/index.html"); } else if (info.ButtonID == (int)BUTTONS_ENUM.RESET_FILTER) { SendGump(player, backpack, page, NoFilter); } else if (info.ButtonID == (int)BUTTONS_ENUM.PREVIOUS_PAGE) { SendGump(player, backpack, page - 1, filter); } else if (info.ButtonID == (int)BUTTONS_ENUM.NEXT_PAGE) { SendGump(player, backpack, page + 1, filter); } //extracting items else if (info.ButtonID >= (int)BUTTONS_ENUM.WITHDRAW_ITEM_START && info.ButtonID < (int)BUTTONS_ENUM.WITHDRAW_ITEM_START + items.Length) { //calculate extract amount TextRelay trText = info.GetTextEntry((int)BUTTONS_ENUM.AMOUNT_TEXT); int amount = 0; if (trText != null) { try { amount = Convert.ToInt32(trText.Text, 10); } catch { player.SendMessage(1173, "Unable to parse the extract amount into a number."); } } int itemIndex = info.ButtonID - (int)BUTTONS_ENUM.WITHDRAW_ITEM_START; if (amount < 0) { player.SendMessage(1173, "You must enter a positive number to extract."); } else if (itemIndex < 0 || itemIndex > items.Length) { player.SendMessage(1173, "Unrecognized item."); } else { StoredItemGumpObject storedItem = items[itemIndex]; ulong available = storedItem.Amount; if (available <= 0) { player.SendMessage(1173, "You don't have that items."); return; } if (available < (ulong)amount) { amount = (int)available; player.SendMessage(1173, "You don't have enough of that item, extracting only " + amount + " instead."); } List <Item> extractedItems = backpack.TryExtractType(storedItem.ItemType, amount); if (extractedItems == null || extractedItems.Count <= 0) { player.SendMessage(1173, "Unable to extract the items."); } else { foreach (Item item in extractedItems) { MasterStorageUtils.DropItemInBagOrFeet(player, backpack, item); } player.SendMessage(1173, "You successfully extracted " + amount + " items."); SendGump(player, backpack, page, filter); } } } //changing filter else if (info.ButtonID >= (int)BUTTONS_ENUM.FILTER_START && info.ButtonID < (int)BUTTONS_ENUM.WITHDRAW_ITEM_START) { int filterIndex = info.ButtonID - (int)BUTTONS_ENUM.FILTER_START; if (filterIndex < 0 || filterIndex > backpack.StorageList.Count) { player.SendMessage(1173, "Unrecognized filter."); } else { SendGump(player, backpack, page, backpack.StorageList[filterIndex]); } } else if (info.ButtonID == (int)BUTTONS_ENUM.REFILL) { backpack.RefillStorage(player); SendGump(player, backpack, page, filter); } }