public GItemCounter(ItemIDValidator v) : base(0, 0, 100, 20) { this.m_Validator = v; this.m_Image = new GItemArt(3, 3, v.List[0]); this.m_Label = new GLabel("", Engine.DefaultFont, Hues.Bright, 0, 0); this.m_Image.X -= this.m_Image.Image.xMin; this.m_Image.Y -= this.m_Image.Image.yMin; base.m_Children.Add(this.m_Image); base.m_Children.Add(this.m_Label); this.m_LastAmount = -2147483648; }
private static void LoginComplete(PacketReader pvSrc) { Music.Stop(); Engine.Unlock(); Engine.m_Loading = false; Engine.m_Ingame = true; Cursor.Hourglass = false; Gumps.Desktop.Children.Clear(); int gameWidth = Engine.GameWidth; int gameHeight = Engine.GameHeight; int num3 = gameWidth / 0x30; int num4 = gameHeight / 0x30; int num5 = (num3 * 0x30) - 4; int num6 = (num4 * 0x30) - 4; int num7 = (gameWidth - num5) / 2; int num8 = (gameHeight - num6) / 2; for (int i = 0; i < num3; i++) { Gumps.Desktop.Children.Add(new GSpellPlaceholder(num7 + (i * 0x30), -54)); Gumps.Desktop.Children.Add(new GSpellPlaceholder(num7 + (i * 0x30), (gameHeight + 6) + 4)); } for (int j = 0; j < num4; j++) { Gumps.Desktop.Children.Add(new GSpellPlaceholder(-54, num8 + (j * 0x30))); Gumps.Desktop.Children.Add(new GSpellPlaceholder((gameWidth + 6) + 4, num8 + (j * 0x30))); } Gumps.Desktop.Children.Add(new GSpellPlaceholder(-54, -54)); Gumps.Desktop.Children.Add(new GSpellPlaceholder((gameWidth + 6) + 4, -54)); Gumps.Desktop.Children.Add(new GSpellPlaceholder(-54, (gameHeight + 6) + 4)); Gumps.Desktop.Children.Add(new GSpellPlaceholder((gameWidth + 6) + 4, (gameHeight + 6) + 4)); Gumps.Desktop.Children.Add(new GDesktopBorder()); Gumps.Desktop.Children.Add(new GBandageTimer()); Gumps.Desktop.Children.Add(new GMapTracker()); Gumps.Desktop.Children.Add(new GQuestArrow()); Gumps.Desktop.Children.Add(new GPingDisplay()); Gumps.Desktop.Children.Add(new GParticleCounter()); Gumps.Desktop.Children.Add(new GTransparencyGump()); Reagent[] reagents = Spells.Reagents; int length = reagents.Length; if ((Engine.ServerFeatures != null) && !Engine.Features.AOS) { length = 8; } PotionType[] typeArray = new PotionType[] { PotionType.Yellow, PotionType.Orange, PotionType.Red, PotionType.Purple }; ItemIDValidator[] list = new ItemIDValidator[(length + 1) + typeArray.Length]; for (int k = 0; k < length; k++) { list[k] = new ItemIDValidator(new int[] { reagents[k].ItemID }); } for (int m = 0; m < typeArray.Length; m++) { list[length + m] = new ItemIDValidator(new int[] { 0xf06 + typeArray[m] }); } list[length + typeArray.Length] = new ItemIDValidator(new int[] { 0xe21, 0xee9 }); Gumps.Desktop.Children.Add(new GItemCounters(list)); CharData charData = World.CharData; Mobile player = World.Player; if ((player != null) && (player.Name.Length > 0)) { charData.Name = player.Name; } if ((Engine.m_ServerName != null) && (Engine.m_ServerName.Length > 0)) { charData.Shard = Engine.m_ServerName; } foreach (GumpLayout layout in charData.Layout) { switch (layout.Type) { case 0: { GSpellIcon toAdd = new GSpellIcon(layout.Extra - 1) { X = layout.X, Y = layout.Y }; Gumps.Desktop.Children.Add(toAdd); break; } case 1: if (!Engine.m_SkillsOpen) { Network.Send(new PQuerySkills()); Engine.m_SkillsOpen = true; Engine.m_SkillsGump = new GSkills(); Engine.m_SkillsGump.X = layout.X; Engine.m_SkillsGump.Y = layout.Y; Engine.m_SkillsGump.Width = layout.Width; Engine.m_SkillsGump.Height = layout.Height; Gumps.Desktop.Children.Add(Engine.m_SkillsGump); } break; case 2: { Mobile mobile2 = World.FindMobile(layout.Extra); if (mobile2 != null) { Network.Send(new POpenPaperdoll(mobile2.Serial)); mobile2.PaperdollX = layout.X; mobile2.PaperdollY = layout.Y; } break; } case 3: { Skill skill = Engine.Skills[layout.Extra]; if (skill != null) { GSkillIcon icon2 = new GSkillIcon(skill) { X = layout.X, Y = layout.Y }; Gumps.Desktop.Children.Add(icon2); } break; } } } charData.Save(); Engine.DrawNow(); Engine.StartPings(); Network.Send(new POpenPaperdoll()); World.Player.QueryStats(); }
public static void Transfer(Item stock, Item pouch, int amount, int itemID) { Mobile player = World.Player; if (player != null) { Item backpack = player.Backpack; if (backpack != null) { IItemValidator check = new ItemIDValidator(new int[] { itemID }); Item item = pouch.FindItem(check); int num = 0; if ((item != null) && (item.Parent != pouch)) { item = null; } bool flag = false; if (item != null) { flag = true; } Item item3 = stock.FindItem(check); foreach (Item item4 in backpack.FindItems(check)) { if (item4 != item) { if (item == null) { item = item4; if (item3 == null) { Engine.QueueAutoMove(item4, item4.Amount, -1, -1, 0, pouch.Serial); } else { Engine.QueueAutoMove(item4, item4.Amount, item3.ContainerX, item3.ContainerY, 0, pouch.Serial); } } else { Engine.QueueAutoMove(item4, item4.Amount, -1, -1, 0, item.Serial); num += (ushort) item4.Amount; } } } int num3 = num; if (item != null) { num3 += (ushort) item.Amount; } if (num3 > amount) { Engine.QueueAutoMove(item, num3 - amount, -1, -1, 0, stock.Serial); } else if (num3 < amount) { Item[] itemArray2 = stock.FindItems(check); int num4 = amount - num3; for (int i = 0; i < itemArray2.Length; i++) { Item item5 = itemArray2[i]; int num6 = num4; if (num6 > ((ushort) item5.Amount)) { num6 = (ushort) item5.Amount; } if (item == null) { item = item5; if (item3 == null) { Engine.QueueAutoMove(item5, num6, -1, -1, 0, pouch.Serial); } else { Engine.QueueAutoMove(item5, num6, item3.ContainerX, item3.ContainerY, 0, pouch.Serial); } } else { Engine.QueueAutoMove(item5, num6, -1, -1, 0, item.Serial); } num4 -= num6; } } if (((item != null) && flag) && (item3 != null)) { Engine.QueueAutoMove(item, amount, item3.ContainerX, item3.ContainerY, 0, pouch.Serial); } } } }