private void BuildGump() { CanMove = true; CanBeSaved = true; LocalSerial = _item.Serial; WantUpdateSize = false; _isCorspeContainer = Graphic == 0x0009; _item.Items.Added += ItemsOnAdded; _item.Items.Removed += ItemsOnRemoved; _data = ContainerManager.Get(Graphic); Graphic g = _data.Graphic; GumpPicContainer container; Add(container = new GumpPicContainer(0, 0, g, 0, _item)); if (_isCorspeContainer) { Add(_eyeGumpPic = new GumpPic(45, 30, 0x0045, 0)); } Width = container.Width; Height = container.Height; ContainerGump gg = Engine.UI.Gumps.OfType <ContainerGump>().FirstOrDefault(s => s.LocalSerial == LocalSerial); if (gg == null) { if (Engine.UI.GetGumpCachePosition(LocalSerial, out Point location) && _item.Serial == World.Player.Equipment[(int)Layer.Backpack]) { Location = location; } else { if (Engine.Profile.Current.OverrideContainerLocation) { switch (Engine.Profile.Current.OverrideContainerLocationSetting) { case 0: SetPositionNearGameObject(g); break; case 1: SetPositionTopRight(); break; case 2: SetPositionByLastDragged(); break; } if ((X + Width) > Engine.WindowWidth) { X -= Width; } if ((Y + Height) > Engine.WindowHeight) { Y -= Height; } } else { ContainerManager.CalculateContainerPosition(g); X = ContainerManager.X; Y = ContainerManager.Y; } } } else { X = gg.X; Y = gg.Y; } if (_data.OpenSound != 0) { Engine.SceneManager.CurrentScene.Audio.PlaySound(_data.OpenSound); } }
private void BuildGump() { CanMove = true; CanBeSaved = true; WantUpdateSize = false; _isCorspeContainer = Graphic == 0x0009; Item item = World.Items.Get(LocalSerial); if (item == null) { Dispose(); return; } item.Items.Added -= ItemsOnAdded; item.Items.Removed -= ItemsOnRemoved; item.Items.Added += ItemsOnAdded; item.Items.Removed += ItemsOnRemoved; float scale = Engine.UI.ContainerScale; _data = ContainerManager.Get(Graphic); if (_data.MinimizerArea != Rectangle.Empty && _data.IconizedGraphic != 0) { _iconizerArea = new HitBox((int)(_data.MinimizerArea.X * scale), (int)(_data.MinimizerArea.Y * scale), (int)(_data.MinimizerArea.Width * scale), (int)(_data.MinimizerArea.Height * scale)); _iconized = new GumpPic(0, 0, _data.IconizedGraphic, 0); } Graphic g = _data.Graphic; GumpPicContainer container; Add(container = new GumpPicContainer(0, 0, g, 0, item)); if (_isCorspeContainer) { _eyeGumpPic?.Dispose(); Add(_eyeGumpPic = new GumpPic((int)(45 * scale), (int)(30 * scale), 0x0045, 0)); _eyeGumpPic.Width = (int)(_eyeGumpPic.Width * scale); _eyeGumpPic.Height = (int)(_eyeGumpPic.Height * scale); } Width = container.Width = (int)(container.Width * scale); Height = container.Height = (int)(container.Height * scale); ContainerGump gg = Engine.UI.Gumps.OfType <ContainerGump>().FirstOrDefault(s => s.LocalSerial == LocalSerial); if (gg == null) { if (Engine.UI.GetGumpCachePosition(LocalSerial, out Point location) && item.Serial == World.Player.Equipment[(int)Layer.Backpack]) { Location = location; } else { if (Engine.Profile.Current.OverrideContainerLocation) { switch (Engine.Profile.Current.OverrideContainerLocationSetting) { case 0: SetPositionNearGameObject(g, item); break; case 1: SetPositionTopRight(); break; case 2: SetPositionByLastDragged(); break; } if ((X + Width) > Engine.WindowWidth) { X -= Width; } if ((Y + Height) > Engine.WindowHeight) { Y -= Height; } } else { ContainerManager.CalculateContainerPosition(g); X = ContainerManager.X; Y = ContainerManager.Y; } } } else { X = gg.X; Y = gg.Y; } if (_data.OpenSound != 0) { Engine.SceneManager.CurrentScene.Audio.PlaySound(_data.OpenSound); } }
private void BuildGump() { CanMove = true; CanBeSaved = true; LocalSerial = _item.Serial; WantUpdateSize = false; _isCorspeContainer = Graphic == 0x0009; _item.Items.Added += ItemsOnAdded; _item.Items.Removed += ItemsOnRemoved; _data = ContainerManager.Get(Graphic); Graphic g = _data.Graphic; GumpPicContainer container; Add(container = new GumpPicContainer(0, 0, g, 0, _item)); if (_isCorspeContainer) { Add(_eyeGumpPic = new GumpPic(45, 30, 0x0045, 0)); } Width = container.Width; Height = container.Height; ContainerGump gg = Engine.UI.Gumps.OfType <ContainerGump>().FirstOrDefault(s => s.LocalSerial == LocalSerial); if (gg == null) { if (Engine.UI.GetGumpCachePosition(LocalSerial, out Point location) && _item.Serial == World.Player.Equipment[(int)Layer.Backpack]) { Location = location; } else { if (Engine.Profile.Current.OpenContainersNearRealPosition) { if (World.Player.Equipment[(int)Layer.Bank] != null && _item.Serial == World.Player.Equipment[(int)Layer.Bank]) { // open bank near player X = World.Player.RealScreenPosition.X + Engine.Profile.Current.GameWindowPosition.X + 40; Y = World.Player.RealScreenPosition.Y + Engine.Profile.Current.GameWindowPosition.Y - (Height >> 1); } else if (_item.OnGround) { // item is in world X = _item.RealScreenPosition.X + Engine.Profile.Current.GameWindowPosition.X + 40; Y = _item.RealScreenPosition.Y + Engine.Profile.Current.GameWindowPosition.Y - (Height >> 1); } else { // in a container, open near the container ContainerGump parentContainer = Engine.UI.Gumps.OfType <ContainerGump>().FirstOrDefault(s => s.LocalSerial == _item.Container); if (parentContainer != null) { X = parentContainer.X + (Width >> 1); Y = parentContainer.Y; } else { // I don't think we ever get here? ContainerManager.CalculateContainerPosition(g); X = ContainerManager.X; Y = ContainerManager.Y; } } if ((X + Width) > Engine.WindowWidth) { X -= Width; } if ((Y + Height) > Engine.WindowHeight) { Y -= Height; } } else { ContainerManager.CalculateContainerPosition(g); X = ContainerManager.X; Y = ContainerManager.Y; } } } else { X = gg.X; Y = gg.Y; } if (_data.OpenSound != 0) { Engine.SceneManager.CurrentScene.Audio.PlaySound(_data.OpenSound); } }