Exemple #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);
        }
Exemple #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);
        }
Exemple #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);
        }
Exemple #4
0
        public static bool UseSkill(IMobile 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((int)InGameMessages.ThatskillCannotBeUsedDirectly);
                }
            }

            return(false);
        }
Exemple #5
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);
        }