public ContainerGump(uint serial, ushort gumpid, bool playsound) : base(serial, 0)
        {
            Item item = World.Items.Get(serial);

            if (item == null)
            {
                Dispose();

                return;
            }

            Graphic = gumpid;

            // New Backpack gumps. Client Version 7.0.53.1
            if (item == World.Player.FindItemByLayer(Layer.Backpack) && Client.Version >= ClassicUO.Data.ClientVersion.CV_705301 && ProfileManager.CurrentProfile != null)
            {
                GumpsLoader loader = GumpsLoader.Instance;

                switch (ProfileManager.CurrentProfile.BackpackStyle)
                {
                case 1:
                    if (loader.GetTexture(0x775E) != null)
                    {
                        Graphic = 0x775E;     // Suede Backpack
                    }

                    break;

                case 2:
                    if (loader.GetTexture(0x7760) != null)
                    {
                        Graphic = 0x7760;     // Polar Bear Backpack
                    }

                    break;

                case 3:
                    if (loader.GetTexture(0x7762) != null)
                    {
                        Graphic = 0x7762;     // Ghoul Skin Backpack
                    }

                    break;

                default:
                    if (loader.GetTexture(0x003C) != null)
                    {
                        Graphic = 0x003C;     // Default Backpack
                    }

                    break;
                }
            }

            BuildGump();

            if (Graphic == 0x0009)
            {
                if (World.Player.ManualOpenedCorpses.Contains(LocalSerial))
                {
                    World.Player.ManualOpenedCorpses.Remove(LocalSerial);
                }
                else if (World.Player.AutoOpenedCorpses.Contains(LocalSerial) && ProfileManager.CurrentProfile != null && ProfileManager.CurrentProfile.SkipEmptyCorpse)
                {
                    IsVisible    = false;
                    _hideIfEmpty = true;
                }
            }

            if (_data.OpenSound != 0 && playsound)
            {
                Client.Game.Scene.Audio.PlaySound(_data.OpenSound);
            }
        }
Example #2
0
        private void UpdateUI()
        {
            if (IsDisposed)
            {
                return;
            }

            Mobile mobile = World.Mobiles.Get(LocalSerial);

            if (mobile == null || mobile.IsDestroyed)
            {
                Dispose();

                return;
            }

            Clear();

            // Add the base gump - the semi-naked paper doll.
            ushort body;
            ushort hue = mobile.Hue;

            if (mobile.Graphic == 0x0191 || mobile.Graphic == 0x0193)
            {
                body = 0x000D;
            }
            else if (mobile.Graphic == 0x025D)
            {
                body = 0x000E;
            }
            else if (mobile.Graphic == 0x025E)
            {
                body = 0x000F;
            }
            else if (mobile.Graphic == 0x029A || mobile.Graphic == 0x02B6)
            {
                body = 0x029A;
            }
            else if (mobile.Graphic == 0x029B || mobile.Graphic == 0x02B7)
            {
                body = 0x0299;
            }
            else if (mobile.Graphic == 0x04E5)
            {
                body = 0xC835;
            }
            else if (mobile.Graphic == 0x03DB)
            {
                body = 0x000C;
                hue  = 0x03EA;
            }
            else if (mobile.IsFemale)
            {
                body = 0x000D;
            }
            else
            {
                body = 0x000C;
            }

            // body
            Add
            (
                new GumpPic(0, 0, body, hue)
            {
                IsPartialHue = true
            }
            );


            if (mobile.Graphic == 0x03DB)
            {
                Add
                (
                    new GumpPic(0, 0, 0xC72B, mobile.Hue)
                {
                    AcceptMouseInput = true,
                    IsPartialHue     = true
                }
                );
            }

            // equipment
            Item equipItem = mobile.FindItemByLayer(Layer.Cloak);
            Item arms      = mobile.FindItemByLayer(Layer.Arms);

            bool switch_arms_with_torso = false;

            if (arms != null)
            {
                switch_arms_with_torso = arms.Graphic == 0x1410 || arms.Graphic == 0x1417;
            }
            else if (HasFakeItem && ItemHold.Enabled && !ItemHold.IsFixedPosition && (byte)Layer.Arms == ItemHold.ItemData.Layer)
            {
                switch_arms_with_torso = ItemHold.Graphic == 0x1410 || ItemHold.Graphic == 0x1417;
            }

            Layer[] layers;

            if (equipItem != null)
            {
                layers = equipItem.ItemData.IsContainer ? _layerOrder_quiver_fix : _layerOrder;
            }
            else if (HasFakeItem && ItemHold.Enabled && !ItemHold.IsFixedPosition && (byte)Layer.Cloak == ItemHold.ItemData.Layer)
            {
                layers = ItemHold.ItemData.IsContainer ? _layerOrder_quiver_fix : _layerOrder;
            }
            else
            {
                layers = _layerOrder;
            }


            for (int i = 0; i < layers.Length; i++)
            {
                Layer layer = layers[i];

                if (switch_arms_with_torso)
                {
                    if (layer == Layer.Arms)
                    {
                        layer = Layer.Torso;
                    }
                    else if (layer == Layer.Torso)
                    {
                        layer = Layer.Arms;
                    }
                }

                equipItem = mobile.FindItemByLayer(layer);

                if (equipItem != null)
                {
                    if (Mobile.IsCovered(mobile, layer))
                    {
                        continue;
                    }

                    ushort id = GetAnimID(mobile.Graphic, equipItem.ItemData.AnimID, mobile.IsFemale);

                    Add
                    (
                        new GumpPicEquipment
                        (
                            equipItem.Serial,
                            0,
                            0,
                            id,
                            (ushort)(equipItem.Hue & 0x3FFF),
                            layer
                        )
                    {
                        AcceptMouseInput = true,
                        IsPartialHue     = equipItem.ItemData.IsPartialHue,
                        CanLift          = World.InGame && !World.Player.IsDead && layer != Layer.Beard && layer != Layer.Hair && (_paperDollGump.CanLift || LocalSerial == World.Player)
                    }
                    );
                }
                else if (HasFakeItem && ItemHold.Enabled && !ItemHold.IsFixedPosition && (byte)layer == ItemHold.ItemData.Layer && ItemHold.ItemData.AnimID != 0)
                {
                    ushort id = GetAnimID(mobile.Graphic, ItemHold.ItemData.AnimID, mobile.IsFemale);

                    Add
                    (
                        new GumpPicEquipment
                        (
                            0,
                            0,
                            0,
                            id,
                            (ushort)(ItemHold.Hue & 0x3FFF),
                            ItemHold.Layer
                        )
                    {
                        AcceptMouseInput = true,
                        IsPartialHue     = ItemHold.IsPartialHue,
                        Alpha            = 0.5f
                    }
                    );
                }
            }


            equipItem = mobile.FindItemByLayer(Layer.Backpack);

            if (equipItem != null && equipItem.ItemData.AnimID != 0)
            {
                ushort backpackGraphic = (ushort)(equipItem.ItemData.AnimID + Constants.MALE_GUMP_OFFSET);

                // If player, apply backpack skin
                if (mobile.Serial == World.Player.Serial)
                {
                    GumpsLoader loader = GumpsLoader.Instance;

                    switch (ProfileManager.CurrentProfile.BackpackStyle)
                    {
                    case 1:
                        if (loader.GetGumpTexture(0x777B, out _) != null)
                        {
                            backpackGraphic = 0x777B;     // Suede Backpack
                        }

                        break;

                    case 2:
                        if (loader.GetGumpTexture(0x777C, out _) != null)
                        {
                            backpackGraphic = 0x777C;     // Polar Bear Backpack
                        }

                        break;

                    case 3:
                        if (loader.GetGumpTexture(0x777D, out _) != null)
                        {
                            backpackGraphic = 0x777D;     // Ghoul Skin Backpack
                        }

                        break;

                    default:
                        if (loader.GetGumpTexture(0xC4F6, out _) != null)
                        {
                            backpackGraphic = 0xC4F6;     // Default Backpack
                        }

                        break;
                    }
                }

                int bx = 0;

                if (World.ClientFeatures.PaperdollBooks)
                {
                    bx = 6;
                }

                Add
                (
                    new GumpPicEquipment
                    (
                        equipItem.Serial,
                        -bx,
                        0,
                        backpackGraphic,
                        (ushort)(equipItem.Hue & 0x3FFF),
                        Layer.Backpack
                    )
                {
                    AcceptMouseInput = true
                }
                );
            }
        }