Example #1
0
        public static bool UseSkill(Mobile from, int skillID)
        {
            if (!from.CheckAlive())
            {
                return(false);
            }
            else if (!from.Region.OnSkillUse(from, skillID))
            {
                return(false);
            }
            else if (!from.AllowSkillUse((SkillName)skillID))
            {
                return(false);
            }
            else if (from.Combatant != null)
            {
                from.SendAsciiMessage("You are preoccupied with thoughts of battle.");
                return(false);
            }

            if (skillID >= 0 && skillID < SkillInfo.Table.Length)
            {
                SkillInfo info = SkillInfo.Table[skillID];

                if (info.Callback != null)
                {
                    if (from.NextSkillTime <= DateTime.Now && from.Spell == null)
                    {
                        from.DisruptiveAction();

                        from.NextSkillTime = DateTime.Now + info.Callback(from);

                        return(true);
                    }
                    else
                    {
                        from.SendSkillMessage();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500014);                       // That skill cannot be used directly.
                }
            }

            return(false);
        }
Example #2
0
        public static bool UseSkill(Mobile from, int skillID)
        {
            if (!from.CheckAlive())
            {
                return(false);
            }

            else if (!from.Region.OnSkillUse(from, skillID))
            {
                return(false);
            }

            else if (!from.AllowSkillUse((SkillName)skillID))
            {
                return(false);
            }

            if (skillID >= 0 && skillID < SkillInfo.Table.Length)
            {
                SkillInfo info = SkillInfo.Table[skillID];

                if (info.Callback != null)
                {
                    if (Core.TickCount - from.NextSkillTime >= 0 && from.Spell == null)
                    {
                        from.DisruptiveAction();

                        from.NextSkillTime = Core.TickCount + (int)(info.Callback(from)).TotalMilliseconds;

                        return(true);
                    }

                    else
                    {
                        from.SendSkillMessage();
                    }
                }

                else
                {
                    from.SendLocalizedMessage(500014);                       // That skill cannot be used directly.
                }
            }

            return(false);
        }
Example #3
0
        public static bool UseSkill(Mobile from, int skillId)
        {
            if (!from.CheckAlive())
            {
                return(false);
            }
            else if (!from.Region.OnSkillUse(from, (SkillName)skillId))
            {
                return(false);
            }
            else if (!from.AllowSkillUse((SkillName)skillId))
            {
                return(false);
            }

            if (skillId >= 0 && skillId < SkillInfo.Table.Length)
            {
                SkillInfo info = SkillInfo.Table[skillId];

                if (info.Callback != null)
                {
                    if (from.NextSkillTime <= DateTime.UtcNow && from.Spell == null)
                    {
                        from.DisruptiveAction();

                        from.NextSkillTime = DateTime.UtcNow + info.Callback(from);

                        return(true);
                    }
                    else
                    {
                        from.SendSkillMessage();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500014);                       // That skill cannot be used directly.
                }
            }

            return(false);
        }
Example #4
0
        public static bool UseSkill(Mobile from, int skillID)
        {
            if (!from.CheckAlive())
            {
                return(false);
            }
            else if (!from.Region.OnSkillUse(from, skillID))
            {
                return(false);
            }
            else if (!from.AllowSkillUse((SkillName)skillID))
            {
                return(false);
            }

            if (skillID >= 0 && skillID < SkillInfo.Table.Length)
            {
                SkillInfo info = SkillInfo.Table[skillID];

                if (info.Callback != null)
                {
                    if (from.NextSkillTime <= DateTime.Now /*&& from.Spell == null*/)
                    {
                        from.DisruptiveAction();

                        from.NextSkillTime = DateTime.Now + info.Callback(from);

                        return(true);
                    }
                    else
                    {
                        from.SendSkillMessage();
                    }
                }
                else
                {
                    from.SendAsciiMessage("That skill cannot be used directly.");                       // That skill cannot be used directly.
                }
            }

            return(false);
        }
Example #5
0
        public static bool UseSkill(Mobile from, int skillID)
        {
            SkillInfo info1;

            if (!from.CheckAlive())
            {
                return(false);
            }
            if (!from.Region.OnSkillUse(from, skillID))
            {
                return(false);
            }
            if (!from.AllowSkillUse(((SkillName)skillID)))
            {
                return(false);
            }
            if ((skillID >= 0) && (skillID < SkillInfo.Table.Length))
            {
                info1 = SkillInfo.Table[skillID];
                if (info1.Callback != null)
                {
                    if ((from.NextSkillTime <= DateTime.Now) && (from.Spell == null))
                    {
                        from.DisruptiveAction();
                        from.NextSkillTime = (DateTime.Now + info1.Callback.Invoke(from));
                        return(true);
                    }
                    from.SendSkillMessage();
                }
                else
                {
                    from.SendLocalizedMessage(500014);
                }
            }
            return(false);
        }
Example #6
0
        public static bool UseSkill( Mobile from, int skillID )
        {
            if ( !from.CheckAlive() )
                return false;
            else if ( !from.Region.OnSkillUse( from, skillID ) )
                return false;
            else if ( !from.AllowSkillUse( (SkillName)skillID ) )
                return false;

            if ( skillID >= 0 && skillID < SkillInfo.Table.Length )
            {
                SkillInfo info = SkillInfo.Table[skillID];

                if ( info.Callback != null )
                {
                    if ( from.NextSkillTime <= DateTime.Now && from.Spell == null )
                    {
                        from.DisruptiveAction();

                        from.NextSkillTime = DateTime.Now + info.Callback( from );

                        return true;
                    }
                    else
                    {
                        from.SendSkillMessage();
                    }
                }
                else
                {
                    from.SendLocalizedMessage( 500014 ); // That skill cannot be used directly.
                }
            }

            return false;
        }
Example #7
0
		public static bool UseSkill(Mobile from, int skillID)
		{
			if (!from.CheckAlive())
			{
				return false;
			}
			else if (!from.Region.OnSkillUse(from, skillID))
			{
				return false;
			}
			else if (!from.AllowSkillUse((SkillName)skillID))
			{
				return false;
			}

			if (skillID >= 0 && skillID < SkillInfo.Table.Length)
			{
				SkillInfo info = SkillInfo.Table[skillID];

				if (info.Callback != null)
				{
					if (Core.TickCount - from.NextSkillTime >= 0 && from.Spell == null)
					{
						from.DisruptiveAction();

						from.NextSkillTime = Core.TickCount + (int)(info.Callback(from)).TotalMilliseconds;

						return true;
					}
					else
					{
						from.SendSkillMessage();
					}
				}
				else
				{
					from.SendLocalizedMessage(500014); // That skill cannot be used directly.
				}
			}

			return false;
		}