public override void HandleButtonResponse(NetState sender, int adjustedButton, ItemTileButtonInfo buttonInfo) { PlayerMobile m = sender.Mobile as PlayerMobile; Item item = ((ItemTileButtonInfo) buttonInfo).Item; if ((m != null) && item.IsChildOf(m.Backpack)) { item.OnDoubleClick(m); m.SendGump(new UseToolItemsGump(Buttons)); } }
//public Openbox(BaseContainer box, ArrayList itembutton) : base(" Box?wtf!", itembutton) { } //public Openbox(BaseContainer box) : this(box, itemlist(box)) { } //老的写法,不好不好 public static ArrayList itemlist(BaseContainer box) { c = box; if (c == null) { return(new ArrayList()); } ArrayList item = new ArrayList(c.Items); ArrayList list = new ArrayList(); for (int i = 0; i < item.Count; i++) { Item it = (Item)item[i]; if (it is Gold && ((Gold)it).Amount < 2001) { continue; } if (it is BaseReagent) { continue; } if (it is IGem) { continue; } if (it is SpellScroll) { continue; } if (it is BasePotion) { continue; } if (it is BaseClothing && ((BaseClothing)it).ItemPower < ItemPower.MajorArtifact) { continue; } if (it is BaseJewel && ((BaseJewel)it).ItemPower < ItemPower.MajorArtifact) { continue; } if (it is BaseArmor && ((BaseArmor)it).ItemPower < ItemPower.MajorArtifact) { continue; } if (it is BaseWeapon && ((BaseWeapon)it).ItemPower < ItemPower.MajorArtifact) { continue; } ItemTileButtonInfo xx = new ItemTileButtonInfo(it); list.Add(xx); } return(list); }
public BaseItemTileButtonsGump(TextDefinition header, ItemTileButtonInfo[] buttons) : base(10, 10) //Coords are 0, o on OSI, intentional difference { m_Buttons = buttons; AddPage(0); int x = XItems*250; int y = YItems*64; AddBackground(0, 0, x + 20, y + 84, 0x13BE); AddImageTiled(10, 10, x, 20, 0xA40); AddImageTiled(10, 40, x, y + 4, 0xA40); AddImageTiled(10, y + 54, x, 20, 0xA40); AddAlphaRegion(10, 10, x, y + 64); AddButton(10, y + 54, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0); //Cancel Button AddHtmlLocalized(45, y + 56, x - 50, 20, 1060051, 0x7FFF, false, false); // CANCEL TextDefinition.AddHtmlText(this, 14, 12, x, 20, header, false, false, 0x7FFF, 0xFFFFFF); AddPage(1); int itemsPerPage = XItems*YItems; for (int i = 0; i < buttons.Length; i++) { int position = i%itemsPerPage; int innerX = (position%XItems)*250 + 14; int innerY = (position/XItems)*64 + 44; int pageNum = i/itemsPerPage + 1; if (position == 0 && i != 0) { AddButton(x - 100, y + 54, 0xFA5, 0xFA7, 0, GumpButtonType.Page, pageNum); AddHtmlLocalized(x - 60, y + 56, 60, 20, 1043353, 0x7FFF, false, false); // Next AddPage(pageNum); AddButton(x - 200, y + 54, 0xFAE, 0xFB0, 0, GumpButtonType.Page, pageNum - 1); AddHtmlLocalized(x - 160, y + 56, 60, 20, 1011393, 0x7FFF, false, false); // Back } ImageTileButtonInfo b = buttons[i]; AddImageTiledButton(innerX, innerY, 0x918, 0x919, 100 + i, GumpButtonType.Reply, 0, b.ItemID, b.Hue, 15, 10, b.LocalizedTooltip); TextDefinition.AddHtmlText(this, innerX + 84, innerY, 250, 60, b.Label, false, false, 0x7FFF, 0xFFFFFF); } }
public static ArrayList FindToolItems(Mobile m) { Container backpack = m.Backpack; if (backpack == null) { return(new ArrayList()); } ArrayList tools = new ArrayList(backpack.FindItemsByType(typeof(BaseTool))); ArrayList potions = new ArrayList(backpack.FindItemsByType(typeof(BasePotion))); List <int> potIDs = new List <int>(); ArrayList bandages = new ArrayList(backpack.FindItemsByType(typeof(Bandage))); ArrayList books = new ArrayList(backpack.FindItemsByType(typeof(Spellbook))); ArrayList list2 = new ArrayList(); Item item; for (int i = 0; i < tools.Count; i++) { item = (Item)tools[i]; if (((BaseTool)item).UsesRemaining > 0) { list2.Add(new ItemTileButtonInfo(item)); } } for (int i = 0; i < potions.Count; i++) { item = (Item)potions[i]; if (!potIDs.Contains(item.ItemID)) { list2.Add(new ItemTileButtonInfo(item)); potIDs.Add(item.ItemID); } } for (int i = 0; i < bandages.Count; i++) { item = (Item)bandages[i]; list2.Add(new ItemTileButtonInfo(item)); } for (int i = 0; i < books.Count; i++) { item = (Item)books[i]; ItemTileButtonInfo itbi = new ItemTileButtonInfo(item); itbi.Label = new TextDefinition(string.Format("{0}: {1} Spells", item.Name, ((Spellbook)item).SpellCount)); list2.Add(itbi); } return(list2); }
public static ArrayList FindToolItems(Mobile m) { Container backpack = m.Backpack; if (backpack == null) { return new ArrayList(); } ArrayList tools = new ArrayList(backpack.FindItemsByType(typeof (BaseTool))); ArrayList potions = new ArrayList(backpack.FindItemsByType(typeof (BasePotion))); List<int> potIDs = new List<int>(); ArrayList bandages = new ArrayList(backpack.FindItemsByType(typeof (Bandage))); ArrayList books = new ArrayList(backpack.FindItemsByType(typeof (Spellbook))); ArrayList list2 = new ArrayList(); Item item; for (int i = 0; i < tools.Count; i++) { item = (Item) tools[i]; if (((BaseTool) item).UsesRemaining > 0) { list2.Add(new ItemTileButtonInfo(item)); } } for (int i = 0; i < potions.Count; i++) { item = (Item) potions[i]; if (!potIDs.Contains(item.ItemID)) { list2.Add(new ItemTileButtonInfo(item)); potIDs.Add(item.ItemID); } } for (int i = 0; i < bandages.Count; i++) { item = (Item) bandages[i]; list2.Add(new ItemTileButtonInfo(item)); } for (int i = 0; i < books.Count; i++) { item = (Item)books[i]; ItemTileButtonInfo itbi = new ItemTileButtonInfo(item); itbi.Label = new TextDefinition(string.Format("{0}: {1} Spells", item.Name,((Spellbook)item).SpellCount)); list2.Add(itbi); } return list2; }
public override void HandleButtonResponse(NetState sender, int adjustedButton, ItemTileButtonInfo buttonInfo) { PlayerMobile m = sender.Mobile as PlayerMobile; Item item = ((ItemTileButtonInfo)buttonInfo).Item; if ((m != null) && !item.Deleted && m.Alive) { if (item.Parent == c) { m.AddToBackpack(item); m.SendSound(item.GetDropSound()); } } if (Openbox.itemlist(c).Count > 0) { m.SendGump(new Openbox(c)); } //m.SendGump(new BaseItemTileButtonsGump("ss", itemlist(c))); }
public override void HandleButtonResponse(NetState sender, int adjustedButton, ItemTileButtonInfo buttonInfo) { PlayerMobile m = sender.Mobile as PlayerMobile; Item item = ((ItemTileButtonInfo)buttonInfo).Item; if ((m != null) && !item.Deleted && m.Alive) { if (item.Parent == c && c.CheckLoot(m, item) && c.InLOS(m.Location)) { //m.Backpack.DropItem(item); m.AddToBackpack(item); m.SendSound(66); //m.SendSound(item.GetDropSound()); } if (Opencorpp.itemlist(c).Count > 0) { m.SendGump(new Opencorpp(c)); if (!item.InRange(m, 2) || !item.InLOS(m.Location)) { //item.SendLocalizedMessageTo(m, 501853); m.SendLocalizedMessage(500446); // That is too far away. //m.SendSound(Utility.RandomList(44,555,556,765,737,735,736)); m.SendSound(736); } } } //c.ProcessOpeners(m); //m.SendGump(new BaseItemTileButtonsGump("ss", itemlist(c))); }
public ToTTurnInGump( Mobile collector, ItemTileButtonInfo[] buttons ) : base( 1071012, buttons ) // Click a minor artifact to give it to Ihara Soko. { m_Collector = collector; }
public override void HandleButtonResponse(NetState sender, int adjustedButton, ItemTileButtonInfo buttonInfo) { PlayerMobile m = sender.Mobile as PlayerMobile; Item item = ((ItemTileButtonInfo)buttonInfo).Item; if ((m != null) && item.IsChildOf(m.Backpack)) { item.OnDoubleClick(m); m.SendGump(new UseToolItemsGump(Buttons)); } }
public UseToolItemsGump(ItemTileButtonInfo[] buttons) : base("Which item would you like to use?", buttons) { }
public virtual void HandleButtonResponse(NetState sender, int adjustedButton, ItemTileButtonInfo buttonInfo) { }
public static ArrayList FindToolItems(Mobile m) { Container backpack = m.Backpack; if (backpack == null) { return(new ArrayList()); } //ArrayList all = new ArrayList(backpack.Items); ArrayList tools = new ArrayList(backpack.FindItemsByType(typeof(BaseTool))); ArrayList potions = new ArrayList(backpack.FindItemsByType(typeof(BasePotion))); List <int> potIDs = new List <int>(); ArrayList bandages = new ArrayList(backpack.FindItemsByType(typeof(Bandage))); ArrayList books = new ArrayList(backpack.FindItemsByType(typeof(Spellbook))); ArrayList rbook = new ArrayList(backpack.FindItemsByType(typeof(Runebook))); var ta = new ArrayList(backpack.FindItemsByType(typeof(TravelAtlas))); //ArrayList tm = new ArrayList(backpack.FindItemsByType(typeof(TMapBook))); var bc = new ArrayList(backpack.FindItemsByType(typeof(bankcard))); ArrayList list2 = new ArrayList(); Item item; for (int i = 0; i < bc.Count; i++) { item = (bankcard)bc[i]; ItemTileButtonInfo t = new ItemTileButtonInfo(item); //t.Label = new TextDefinition(string.Format("保险箱:\n{0}", item.Name)); list2.Add(t); } //for (int i = 0; i < tm.Count; i++) //{ // item = (TMapBook)tm[i]; // ItemTileButtonInfo t = new ItemTileButtonInfo(item); // t.Label = new TextDefinition(string.Format("藏宝图:{0}", item.Name)); // list2.Add(t); //} for (int i = 0; i < ta.Count; i++) { item = (TravelAtlas)ta[i]; ItemTileButtonInfo tam = new ItemTileButtonInfo(item); //tam.Label = new TextDefinition(string.Format("旅行指南:\n{0}", item.Name)); list2.Add(tam); } for (int i = 0; i < rbook.Count; i++) { item = (Runebook)rbook[i]; ItemTileButtonInfo rb = new ItemTileButtonInfo(item); //rb.Label = new TextDefinition(string.Format("符石书:\n{1}", item.Name, ((Runebook)item).Description)); list2.Add(rb); } for (int i = 0; i < tools.Count; i++) { item = (Item)tools[i]; if (((BaseTool)item).UsesRemaining > 0) { list2.Add(new ItemTileButtonInfo(item)); } } for (int i = 0; i < potions.Count; i++) { item = (Item)potions[i]; if (!potIDs.Contains(item.ItemID)) { list2.Add(new ItemTileButtonInfo(item)); potIDs.Add(item.ItemID); } } for (int i = 0; i < bandages.Count; i++) { item = (Item)bandages[i]; list2.Add(new ItemTileButtonInfo(item)); } for (int i = 0; i < books.Count; i++) { item = (Item)books[i]; ItemTileButtonInfo itbi = new ItemTileButtonInfo(item); //itbi.Label = new TextDefinition(string.Format("{0}: {1} Spells", item.GetType().Name, ((Spellbook)item).SpellCount)); list2.Add(itbi); } return(list2); }