Ejemplo n.º 1
0
        public ContainerItem(Item item, bool isKR) : base(0x25, 20)
        {
            if (isKR)
            {
                EnsureCapacity(21);
            }

            Write(item.Serial);

            Write(item.ItemID);
            Write((byte)0);
            Write(item.Amount);
            Write((ushort)item.Position.X);
            Write((ushort)item.Position.Y);

            if (isKR)
            {
                Write(item.GridNum);
            }

            object cont = item.Container;

            if (cont is UOEntity)
            {
                Write((uint)((UOEntity)item.Container).Serial);
            }
            else if (cont is uint)
            {
                Write((uint)cont);
            }
            else if (cont is Serial)
            {
                Write((Serial)item.Container);
            }
            else
            {
                Write((uint)0x7FFFFFFF);
            }

            if (SearchExemptionAgent.Contains(item))
            {
                Write((ushort)Config.GetInt("ExemptColor"));
            }
            else
            {
                Write(item.Hue);
            }
        }
Ejemplo n.º 2
0
        public bool UpdateContainer()
        {
            if (!(m_Parent is Serial) || Deleted)
            {
                return(true);
            }

            object o       = null;
            Serial contSer = (Serial)m_Parent;

            if (contSer.IsItem)
            {
                o = World.FindItem(contSer);
            }
            else if (contSer.IsMobile)
            {
                o = World.FindMobile(contSer);
            }

            if (o == null)
            {
                return(false);
            }

            m_Parent = o;

            if (m_Parent is Item)
            {
                ((Item)m_Parent).AddItem(this);
            }
            else if (m_Parent is Mobile)
            {
                ((Mobile)m_Parent).AddItem(this);
            }

            if (World.Player != null && (IsChildOf(World.Player.Backpack) || IsChildOf(World.Player.Quiver)))
            {
                bool exempt = SearchExemptionAgent.IsExempt(this);
                if (!exempt)
                {
                    Counter.Count(this);
                }

                if (m_IsNew)
                {
                    if (m_AutoStack)
                    {
                        AutoStackResource();
                    }

                    if (IsContainer && !exempt && (!IsPouch || !Config.GetBool("NoSearchPouches")) &&
                        Config.GetBool("AutoSearch"))
                    {
                        PacketHandlers.IgnoreGumps.Add(this);
                        PlayerData.DoubleClick(this);

                        for (int c = 0; c < Contains.Count; c++)
                        {
                            Item icheck = (Item)Contains[c];
                            if (icheck.IsContainer && !SearchExemptionAgent.IsExempt(icheck) &&
                                (!icheck.IsPouch || !Config.GetBool("NoSearchPouches")))
                            {
                                PacketHandlers.IgnoreGumps.Add(icheck);
                                PlayerData.DoubleClick(icheck);
                            }
                        }
                    }
                }
            }

            m_AutoStack = m_IsNew = false;

            return(true);
        }