Esempio n. 1
0
        public void AddCleanupItem(Mobile from, Item item)
        {
            double checkbagpoint;

            if (item is BaseContainer)
            {
                Container c = (Container)item;

                List <Item> list = c.FindItemsByType <Item>();

                for (int i = list.Count - 1; i >= 0; --i)
                {
                    checkbagpoint = CleanUpBritanniaData.GetPoints(list[i]);

                    if (checkbagpoint > 0 && m_Cleanup.Find(x => x.serials == list[i].Serial) == null)
                    {
                        m_Cleanup.Add(new CleanupArray {
                            mobiles = from, items = list[i], points = checkbagpoint, serials = list[i].Serial
                        });
                    }
                }
            }
            else
            {
                checkbagpoint = CleanUpBritanniaData.GetPoints(item);

                if (checkbagpoint > 0 && m_Cleanup.Find(x => x.serials == item.Serial) == null)
                {
                    m_Cleanup.Add(new CleanupArray {
                        mobiles = from, items = item, points = checkbagpoint, serials = item.Serial
                    });
                }
            }
        }
Esempio n. 2
0
        public virtual bool AddCleanupItem(Mobile from, Item item)
        {
            if (!CleanUpBritanniaData.Enabled)
            {
                return(false);
            }

            double checkbagpoint;
            bool   added = false;

            if (item is BaseContainer container)
            {
                Container c = container;

                List <Item> list = c.FindItemsByType <Item>();

                for (int i = list.Count - 1; i >= 0; --i)
                {
                    checkbagpoint = CleanUpBritanniaData.GetPoints(list[i]);

                    if (checkbagpoint > 0 && m_Cleanup.Find(x => x.serials == list[i].Serial) == null)
                    {
                        m_Cleanup.Add(new CleanupArray {
                            mobiles = from, items = list[i], points = checkbagpoint, serials = list[i].Serial
                        });

                        if (!added)
                        {
                            added = true;
                        }
                    }
                }
            }
            else
            {
                checkbagpoint = CleanUpBritanniaData.GetPoints(item);

                if (checkbagpoint > 0 && m_Cleanup.Find(x => x.serials == item.Serial) == null)
                {
                    m_Cleanup.Add(new CleanupArray {
                        mobiles = from, items = item, points = checkbagpoint, serials = item.Serial
                    });
                    added = true;
                }
            }

            return(added);
        }