Пример #1
0
        protected virtual int GetProgress(ConquestState state, CastSpellConquestContainer args)
        {
            if (state.User == null)
            {
                return(0);
            }

            if (args == null || args.SpellID < 0 || args.Mobile is PlayerMobile && args.Mobile.Account != state.User.Account)
            {
                return(0);
            }

            if (CheckBook)
            {
                var book = args.Spellbook as Spellbook;

                if (book == null || !book.HasSpell(args.SpellID))
                {
                    book = Spellbook.Find(args.Mobile, args.SpellID);
                }

                if (book == null)
                {
                    return(0);
                }
            }

            if (CheckRegs)
            {
                SpellInfo info = SpellRegistry.GetSpellInfo(args.SpellID);

                if (info != null && !args.Mobile.HasItems(info.Reagents, info.Amounts))
                {
                    return(0);
                }
            }

            if (Spell.IsNotNull && SpellRegistry.GetRegistryNumber(Spell) != args.SpellID)
            {
                if (ChangeSpellReset)
                {
                    return(-state.Progress);
                }

                return(0);
            }

            return(1);
        }
Пример #2
0
        protected virtual int GetProgress(ConquestState state, CastSpellConquestContainer args)
		{
            if (state.User == null)
                return 0;

			if (args == null || args.SpellID < 0 || args.Mobile is PlayerMobile && args.Mobile.Account != state.User.Account)
			{
				return 0;
			}

			if (CheckBook)
			{
				var book = args.Spellbook as Spellbook;

				if (book == null || !book.HasSpell(args.SpellID))
				{
					book = Spellbook.Find(args.Mobile, args.SpellID);
				}

				if (book == null)
				{
					return 0;
				}
			}

			if (CheckRegs)
			{
				SpellInfo info = SpellRegistry.GetSpellInfo(args.SpellID);

				if (info != null && !args.Mobile.HasItems(info.Reagents, info.Amounts))
				{
					return 0;
				}
			}

			if (Spell.IsNotNull && SpellRegistry.GetRegistryNumber(Spell) != args.SpellID)
			{
				if (ChangeSpellReset)
				{
					return -state.Progress;
				}

				return 0;
			}

			return 1;
		}