Example #1
0
        public void Empty()
        {
            List <Item> items = Items;

            if (items.Count > 0)
            {
                for (int i = items.Count - 1; i >= 0; --i)
                {
                    if (i >= items.Count)
                    {
                        continue;
                    }

                    ConfirmCleanupItem(items[i]);

                    #region SA
                    if (Core.SA)
                    {
                        if (Core.SA && .01 > Utility.RandomDouble())
                        {
                            TrashBarrel.DropToCavernOfDiscarded(items[i]);
                        }
                        else
                        {
                            items[i].Delete();
                        }
                    }
                    #endregion
                }

                if (m_Cleanup.Any(x => x.mobiles != null))
                {
                    foreach (var m in m_Cleanup.Select(x => x.mobiles).Distinct())
                    {
                        if (m_Cleanup.Find(x => x.mobiles == m && x.confirm) != null)
                        {
                            double point = m_Cleanup.Where(x => x.mobiles == m && x.confirm).Sum(x => x.points);
                            m.SendLocalizedMessage(1151280, $"{point.ToString()}\t{m_Cleanup.Count(r => r.mobiles == m)}"); // You have received approximately ~1_VALUE~points for turning in ~2_COUNT~items for Clean Up Britannia.
                            PointsSystem.CleanUpBritannia.AwardPoints(m, point);
                        }
                    }
                    m_Cleanup.Clear();
                }
            }
        }
Example #2
0
        public void Empty()
        {
            List <Item> items = Items;

            if (items.Count > 0)
            {
                for (int i = items.Count - 1; i >= 0; --i)
                {
                    if (i >= items.Count)
                    {
                        continue;
                    }

                    ConfirmCleanupItem(items[i]);

                    if (.01 > Utility.RandomDouble())
                    {
                        TrashBarrel.DropToCavernOfDiscarded(items[i]);
                    }
                    else
                    {
                        items[i].Delete();
                    }
                }

                for (var i = 0; i < m_Cleanup.Count; i++)
                {
                    var x1 = m_Cleanup[i];

                    if (x1.mobiles != null)
                    {
                        HashSet <Mobile> set = new HashSet <Mobile>();

                        for (var index1 = 0; index1 < m_Cleanup.Count; index1++)
                        {
                            var    x2 = m_Cleanup[index1];
                            Mobile m  = x2.mobiles;

                            if (set.Add(m) && (m_Cleanup.Find(x => x.mobiles == m && x.confirm) != null))
                            {
                                double point = 0;

                                for (var index = 0; index < m_Cleanup.Count; index++)
                                {
                                    var x = m_Cleanup[index];

                                    if (x.mobiles == m && x.confirm)
                                    {
                                        point += x.points;
                                    }
                                }

                                int count = 0;

                                for (var index = 0; index < m_Cleanup.Count; index++)
                                {
                                    var r = m_Cleanup[index];

                                    if (r.mobiles == m)
                                    {
                                        count++;
                                    }
                                }

                                m.SendLocalizedMessage(1151280,
                                                       $"{point.ToString()}\t{count}"); // You have received approximately ~1_VALUE~points for turning in ~2_COUNT~items for Clean Up Britannia.

                                PointsSystem.CleanUpBritannia.AwardPoints(m, point);
                            }
                        }

                        m_Cleanup.Clear();
                        break;
                    }
                }
            }
        }