Ejemplo n.º 1
0
        public static bool CheckSoulForge(Mobile from, int range, bool message)
        {
            PlayerMobile m = from as PlayerMobile;

            ImbuingContext context = Imbuing.GetContext(m);
            context.Imbue_SFBonus = 0;
            Map map = from.Map;

            if (map == null)
                return false;

            bool isQueenForge = false;
            bool isForge = false;
            bool isMiniForge = false;

            IPooledEnumerable eable = map.GetItemsInRange(from.Location, range);

            foreach (Item item in eable)
            {
                if (!isQueenForge)
                    isQueenForge = (item.ItemID >= 0x4263 && item.ItemID <= 0x4272); // Queens SoulForge (+5% bonus & easier unravels)

                if (!isForge)
                    isForge = (item.ItemID >= 0x4277 && item.ItemID <= 0x4286); // Standard SoulForge

                if (!isMiniForge)
                    isMiniForge = (item.ItemID >= 17607 && item.ItemID <= 17610); // Gargoyle Mini SoulForge
            }

            eable.Free();
            Rectangle2D rec = new Rectangle2D(792, 3472, 9, 9);

            if (isForge && from.Region != null && from.Region.IsPartOf("Royal City") && rec.Contains(from.Location))
                context.Imbue_SFBonus = 5;

            if (from is PlayerMobile && isQueenForge)
            {
                int level = ((PlayerMobile)from).Level;

                if (level < PlayerMobile.Noble)
                {
                    if (message)
                        from.SendMessage("You must be of Noble loyalty to the Queen in order to use this forge.");
                    return false;
                }
                else
                    context.Imbue_SFBonus = 10;
            }

            if (!isQueenForge && !isForge && !isMiniForge)
            {
                if (message)
                    from.SendLocalizedMessage(1079787); // You must be near a soulforge to imbue an item.
                return false;
            }

            return true;
        }
Ejemplo n.º 2
0
 public static IEnumerable <BaseMulti> SelectMultis(Sector s, Rectangle2D bounds)
 {
     return(s.Multis.Where(o => o?.Deleted == false && bounds.Contains(o.Location)));
 }
Ejemplo n.º 3
0
        public static IEnumerable <TEntity> FindEntities <TEntity>(this Rectangle2D r, Map m) where TEntity : IEntity
        {
            if (m == null || m == Map.Internal)
            {
                yield break;
            }

            var o = m.GetObjectsInBounds(r);

            foreach (var e in o.OfType <TEntity>().Where(e => e != null && e.Map == m && r.Contains(e)))
            {
                yield return(e);
            }

            o.Free();
        }
Ejemplo n.º 4
0
        public static bool IsValidLocation(Point3D p)
        {
            /*foreach (Rectangle2D rec in m_MagGrowBounds)
            {
                if (rec.Contains(p))
                    return true;
            }*/
            foreach (Rectangle2D rec in m_NoGrowZones)
            {
                if (rec.Contains(p))
                    return false;
            }

            foreach (Rectangle2D rec in MaginciaLottoSystem.MagHousingZones)
            {
                Rectangle2D newRec = new Rectangle2D(rec.X - 2, rec.Y - 2, rec.Width + 4, rec.Height + 7);

                if (newRec.Contains(p))
                    return false;
            }

            return true;
        }
Ejemplo n.º 5
0
 public static IEnumerable <T> SelectItems <T>(Sector s, Rectangle2D bounds) where T : Item
 {
     return(s.Items.OfType <T>()
            .Where(o => o.Deleted == false && o.Parent == null && bounds.Contains(o.Location)));
 }
Ejemplo n.º 6
0
 public static IEnumerable <T> SelectMobiles <T>(Sector s, Rectangle2D bounds) where T : Mobile
 {
     return(s.Mobiles.OfType <T>().Where(o => !o.Deleted && bounds.Contains(o.Location)));
 }
Ejemplo n.º 7
0
 public static IEnumerable <NetState> SelectClients(Sector s, Rectangle2D bounds)
 {
     return(s.Clients.Where(o => o?.Mobile?.Deleted == false && bounds.Contains(o.Mobile.Location)));
 }