Пример #1
0
        public virtual bool AddRune(Mobile m, RecallRune rune, RuneCodexCategory cat, bool message)
        {
            if (m == null || m.Deleted || rune == null || rune.Deleted || !rune.IsAccessibleTo(m))
            {
                return(false);
            }

            PlayerMobile pm = m as PlayerMobile;

            if (cat == null)
            {
                cat = pm != null && Users.ContainsKey(pm)
                                                  ? (Users[pm].Category ?? Categories[Users[pm].CategoryPoint.X, Users[pm].CategoryPoint.Y])
                                                  : Categories[0, 0];
            }

            Point2D loc = pm != null && Users.ContainsKey(pm) ? Users[pm].EntryPoint : Point2D.Zero;

            if (!rune.Marked || rune.Target == Point3D.Zero || rune.TargetMap == Map.Internal)
            {
                if (message)
                {
                    m.SendMessage("That rune is blank.");
                }

                return(false);
            }

            if (cat != null)
            {
                if (cat.Entries.Count >= cat.Entries.Capacity)
                {
                    if (message)
                    {
                        m.SendMessage("The rune codex category \"{0}\" can't hold more runes.", cat.Description);
                    }

                    return(false);
                }

                if (cat.SetRune(m, rune, loc, message))
                {
                    InvalidateProperties();
                    return(true);
                }
            }

            return(false);
        }
Пример #2
0
        public virtual bool AddRune(Mobile m, RecallRune rune, RuneCodexCategory cat, bool message)
        {
            if (m == null || m.Deleted || rune == null || rune.Deleted || !rune.IsAccessibleTo(m))
            {
                return(false);
            }

            var pm = m as PlayerMobile;

            var loc = Point2D.Zero;

            if (cat == null)
            {
                if (pm != null)
                {
                    var ui = Users.FirstOrDefault(uic => uic.User == pm);

                    if (ui != null)
                    {
                        cat = ui.Category ?? Categories[ui.CategoryPoint.X, ui.CategoryPoint.Y];
                        loc = ui.EntryPoint;
                    }
                    else
                    {
                        cat = Categories[0, 0];
                    }
                }
                else
                {
                    cat = Categories[0, 0];
                }
            }

            if (!rune.Marked || rune.Target == Point3D.Zero || rune.TargetMap == Map.Internal)
            {
                if (message)
                {
                    m.SendMessage("That rune is blank.");
                }

                return(false);
            }

            if (cat != null)
            {
                if (cat.Entries.Count >= cat.Entries.Capacity)
                {
                    if (message)
                    {
                        m.SendMessage("The rune codex category \"{0}\" can't hold more runes.", cat.Description);
                    }

                    return(false);
                }

                if (cat.SetRune(m, rune, loc, message))
                {
                    InvalidateProperties();
                    return(true);
                }
            }

            return(false);
        }
Пример #3
0
		public virtual bool AddRune(Mobile m, RecallRune rune, RuneCodexCategory cat, bool message)
		{
			if (m == null || m.Deleted || rune == null || rune.Deleted || !rune.IsAccessibleTo(m))
			{
				return false;
			}

			PlayerMobile pm = m as PlayerMobile;

			if (cat == null)
			{
				cat = pm != null && Users.ContainsKey(pm)
						  ? (Users[pm].Category ?? Categories[Users[pm].CategoryPoint.X, Users[pm].CategoryPoint.Y])
						  : Categories[0, 0];
			}

			Point2D loc = pm != null && Users.ContainsKey(pm) ? Users[pm].EntryPoint : Point2D.Zero;

			if (!rune.Marked || rune.Target == Point3D.Zero || rune.TargetMap == Map.Internal)
			{
				if (message)
				{
					m.SendMessage("That rune is blank.");
				}

				return false;
			}

			if (cat != null)
			{
				if (cat.Entries.Count >= cat.Entries.Capacity)
				{
					if (message)
					{
						m.SendMessage("The rune codex category \"{0}\" can't hold more runes.", cat.Description);
					}

					return false;
				}

				if (cat.SetRune(m, rune, loc, message))
				{
					InvalidateProperties();
					return true;
				}
			}

			return false;
		}