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.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 static bool TakeTypeFromPlayer(PlayerMobile player, Type type, int amount, bool informPlayer) { if (amount < 0) { return(false); } MasterStorage backpack = GetMasterStorage(player); if (backpack == null) { if (informPlayer) { player.SendMessage(1173, "Unable to find your Master Storage, please make sure it's in your backpack."); } return(false); } List <Item> items = backpack.TryExtractType(type, amount); if (items.Count == 0) { if (informPlayer) { player.SendMessage(1173, "You don't have enough " + type.Name + " in your Master Storage."); } return(false); } if (informPlayer) { player.SendMessage(1173, amount + " " + type.Name + " were removed from your Master Storage."); } return(true); }
public MasterStorageStorageGump(PlayerMobile player, MasterStorage backpack, int page, BaseStorage filter) : base(20, 20) { this.backpack = backpack; this.page = page; this.player = player; this.filter = filter; items = null; if (backpack != null) { if (page == -1) { page = backpack.StoragePage; } if (filter == null) { filter = backpack.StorageFilter; } } init(); if (player == null || backpack == null) { return; } drawFilters(); drawItems(); addPageControls(); }
public static bool GiveTypeToPlayer(PlayerMobile player, Type type, int amount, bool informPlayer) { int amountLeft = amount; if (amount < 0) { return(false); } MasterStorage backpack = GetMasterStorage(player); if (backpack == null) { if (informPlayer) { player.SendMessage(1173, "Unable to find your Master Storage, please make sure it's in your backpack."); } return(false); } if (!backpack.TryStoreItemType(type, amount)) { if (informPlayer) { player.SendMessage(1173, "Unable to add " + amount + " " + type.Name + " to your Master Storage."); } return(false); } if (informPlayer) { player.SendMessage(1173, "You added " + amount + " " + type.Name + " to your Master Storage."); } return(true); }
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 static bool ConsumeCurrency(PlayerMobile player, Type currencyType, UInt64 amount, bool informPlayer) { if (player == null) { return(false); } if (amount == 0) { if (informPlayer) { player.SendMessage("You don't need to consume anything."); } return(true); } MasterStorage backpack = GetMasterStorage(player); if (backpack == null) { if (informPlayer) { player.SendMessage("You don't have a Master Storage backpack on you."); } return(false); } return(backpack.ConsumeCurrency(player, currencyType, amount, informPlayer)); }
public static void SendGump(Mobile from, MasterStorage backpack) { CloseGump(from); if (from == null || backpack == null || backpack.Deleted || (!backpack.GoldLedger && !backpack.TokenLedger) || !backpack.IsOwner(from as PlayerMobile)) { return; } from.SendGump(new MasterStorageLedgerGump(backpack)); }
public static void SendGump(Mobile from, MasterStorage backpack, int page) { CloseGump(from); if (from == null || backpack == null || backpack.Deleted || !backpack.IsOwner(from as PlayerMobile)) { return; } from.SendGump(new MasterStorageSetupGump(backpack, page)); }
public static ulong GetPlayersStorageItemCount(PlayerMobile player, Type type) { MasterStorage backpack = GetMasterStorage(player); if (backpack != null) { return(backpack.GetStoredItemAmount(type)); } return(0); }
public static bool ConsumePlayersStorageItems(PlayerMobile player, Type[] types, int[] amounts) { MasterStorage backpack = GetMasterStorage(player); if (backpack != null) { return(backpack.TryConsume(types, amounts)); } return(false); }
public static bool DropItemInBagOrFeet(PlayerMobile player, MasterStorage backpack, List <Item> items) { foreach (Item item in items) { if (!DropItemInBagOrFeet(player, backpack, item)) { return(false); } } return(true); }
private static void addToMasterStoragesList(PlayerMobile player, MasterStorage bag) { if (bag == null) { return; } if (!MasterStorageUtils.PlayersMasterStorageList.ContainsKey(player.Serial)) { MasterStorageUtils.PlayersMasterStorageList.Add(player.Serial, bag); } }
public static void MoveItemsOnDeath(PlayerMobile player, Container corpse) { if (player == null || corpse == null) { return; } MasterStorage backpack = GetMasterStorage(player); if (backpack != null) { backpack.MoveItemsOnDeath(corpse); } }
public static void SendGump(Mobile from, MasterStorage backpack, int page, BaseStorage filter) { CloseGump(from); if (from == null) { return; } if (backpack == null || backpack.Deleted || !backpack.IsOwner(from as PlayerMobile)) { from.SendMessage(1173, "You don't have your Master Storage in your backpack."); return; } from.SendGump(new MasterStorageStorageGump(from as PlayerMobile, backpack, page, filter)); }
public static bool DropItemInBagOrFeet(PlayerMobile player, MasterStorage backpack, Item item) { if (player == null || item == null) { return(false); } if (backpack == null) { backpack = GetMasterStorage(player); } if (backpack != null && backpack.TryDropItem(player, item, false)) { return(true); } if (player.Backpack != null && player.Backpack.TryDropItem(player, item, false)) { return(true); } Map map = player.Map; if (map == null) { return(false); } List <Item> atFeet = new List <Item>(); foreach (Item obj in player.GetItemsInRange(0)) { atFeet.Add(obj); } for (int i = 0; i < atFeet.Count; ++i) { Item check = atFeet[i]; if (check.StackWith(player, item, false)) { break; } } item.MoveToWorld(player.Location, map); return(true); }
public MasterStorageAddTypeTarget(MasterStorage backpack, Mobile from, SELECTION selection, Type previousType) : base(18, false, TargetFlags.None) { this.backpack = backpack; this.previousType = previousType; this.selection = selection; if (selection == SELECTION.ITEM_SELECTION) { from.SendMessage("Please select an item to loot."); } else if (selection == SELECTION.TYPE_SELECTION && previousType == null) { from.SendMessage("Please select the first item in order to look for common loot type."); } else if (selection == SELECTION.TYPE_SELECTION && previousType != null) { from.SendMessage("Please select the second item in order to look for common loot type."); } }
public static void Loot_OnCommand(CommandEventArgs e) { PlayerMobile player = e.Mobile as PlayerMobile; if (player == null || !CanPlayerLoot(player)) { return; } MasterStorage backpack = GetMasterStorage(player); if (backpack == null) { player.SendMessage("You must have a Master Storage in your backpack!"); return; } if (backpack.IsOwner(player)) { backpack.Loot(player); } }
public MasterStorageSetupGump(MasterStorage backpack, int page) : base(20, 20) { this.backpack = backpack; this.page = page; int typesCount = backpack.LootableTypesCount; int lastPage = typesCount / ITEMS_PER_PAGE + (typesCount % ITEMS_PER_PAGE == 0 ? 0 : 1) - 1; if (this.page == -1 || this.page > lastPage) //last page { this.page = lastPage; } if (this.page < 0) { this.page = 0; } initialize(); addTop(typesCount); addAddSettingsSection(); addTypesPage(); addPageControls(); }
///WARNING!!! may return null!!! public static MasterStorage GetMasterStorage(PlayerMobile player) { if (player == null || player.Backpack == null) { return(null); } Serial serial = player.Serial; MasterStorage bag = null; if (MasterStorageUtils.PlayersMasterStorageList.ContainsKey(serial)) { bag = MasterStorageUtils.PlayersMasterStorageList[serial]; if (bag.IsChildOf(player.Backpack) && !bag.Deleted) { return(bag); } else { MasterStorageUtils.PlayersMasterStorageList.Remove(serial); } } bag = player.Backpack.FindItemByType(typeof(MasterStorage), false) as MasterStorage; if (bag != null && bag.Deleted) { bag = null; } if (bag != null && bag.IsOwner(player)) { MasterStorageUtils.PlayersMasterStorageList.Add(serial, bag); return(bag); } else { return(null); } }
public MasterStorageFillContextMenu(Mobile from, Item item) : base(6230, 3) //6230=refill from stock { player = from as PlayerMobile; backpack = item as MasterStorage; }
public MasterStorageSetupContextMenu(Mobile from, Item item) : base(127, 2) //97=Options { player = from as PlayerMobile; backpack = item as MasterStorage; }
public MasterStorageLedgerContextMenu(Mobile from, Item item) : base(123, 1) //123=Credits { player = from as PlayerMobile; backpack = item as MasterStorage; }
public MasterStorageStorageContextMenu(Mobile from, Item item) : base(155, 1) //155=My Inventory { player = from as PlayerMobile; backpack = item as MasterStorage; }
public static void SendGump(Mobile from, MasterStorage backpack, int page) { SendGump(from, backpack, page, null); }
public MasterStorageAddTypeTarget(MasterStorage backpack, Mobile from, SELECTION selection) : this(backpack, from, selection, null) { }
public MasterStorageAddCurrencyTarget(Mobile from, MasterStorage backpack) : base(18, false, TargetFlags.None) { this.backpack = backpack; }
public MasterStorageLedgerGump(MasterStorage backpack) : base(50, 50) { this.backpack = backpack; this.Closable = true; this.Disposable = true; this.Dragable = true; this.Resizable = false; this.AddPage(0); bool gold = backpack.GoldLedger; bool token = backpack.TokenLedger; int totalLines = 7 + (gold?2:0) + (token?2:0); int offset = 0; this.AddBackground(0, 0, 350, 75 + 25 * totalLines, 5170); this.AddLabel(120, 25, 69, "Account information"); if (gold) { this.AddLabel(25, 50, 69, "You have " + backpack.GoldAmount + " gold."); offset += 25; } if (token) { this.AddLabel(25, 50 + offset, 88, "You have " + backpack.TokensAmount + " tokens."); offset += 25; } this.AddLabel(25, 50 + offset, 32, "Add Currency:"); this.AddButton(180, 50 + offset, 2443, 2444, (int)BUTTONS.ADD, GumpButtonType.Reply, 0); this.AddLabel(190, 50 + offset, 0, "Add Pile"); this.AddButton(255, 50 + offset, 2443, 2444, (int)BUTTONS.FILL, GumpButtonType.Reply, 0); this.AddLabel(265, 50 + offset, 0, "Add All"); this.AddLabel(25, 98 + offset, 0, @"How much to withdraw?"); this.AddBackground(170, 85 + offset, 150, 50, 9270); this.AddTextEntry(180, 98 + offset, 130, 25, 39, (int)BUTTONS.AMOUNT, ""); if (gold) { this.AddButton(25, 145 + offset, 4027, 4028, (int)BUTTONS.GOLD, GumpButtonType.Reply, 0); this.AddLabel(65, 145 + offset, 69, "Gold Pile"); this.AddButton(195, 145 + offset, 4012, 4013, (int)BUTTONS.GOLD_CHECK, GumpButtonType.Reply, 0); this.AddLabel(235, 145 + offset, 69, "Gold Check"); offset += 25; } if (token) { this.AddButton(25, 145 + offset, 4027, 4028, (int)BUTTONS.TOKENS, GumpButtonType.Reply, 0); this.AddLabel(65, 145 + offset, 69, "Tokens Pile"); this.AddButton(195, 145 + offset, 4012, 4013, (int)BUTTONS.TOKENS_CHECK, GumpButtonType.Reply, 0); this.AddLabel(235, 145 + offset, 69, "Tokens Check"); offset += 25; } this.AddImage(25, 150 + offset, 7012); this.AddImage(250, 150 + offset, 7012); this.AddLabel(150, 160 + offset, 38, "Neverfade"); this.AddLabel(130, 185 + offset, 38, "Master Storage"); }
public MasterStorageStorageGump(PlayerMobile player, MasterStorage backpack) : this(player, backpack, -1, null) { }
public static void SendGump(Mobile from, MasterStorage backpack) { SendGump(from, backpack, -1); }