Esempio n. 1
0
        public bool CheckCompletedStatus()
        {
            if (Template.CompleteHandler != null && Template.CompleteHandler(this))
            {
                return(true);
            }
            for (int index = 0; index < Template.CollectableItems.Length; ++index)
            {
                if (CollectedItems[index] < Template.CollectableItems[index].Amount)
                {
                    return(false);
                }
            }

            if (Template.HasObjectOrSpellInteractions)
            {
                for (int index = 0; index < Template.ObjectOrSpellInteractions.Length; ++index)
                {
                    QuestInteractionTemplate spellInteraction = Template.ObjectOrSpellInteractions[index];
                    if (spellInteraction != null && spellInteraction.IsValid)
                    {
                        uint interaction = Interactions[index];
                        bool flag        = spellInteraction.ObjectType != ObjectTypeId.None || spellInteraction.Amount == 0;
                        if (!flag && interaction == 0U || flag && interaction <
                            Template.ObjectOrSpellInteractions[index].Amount)
                        {
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
Esempio n. 2
0
        public bool CheckCompletedStatus()
        {
            if (Template.CompleteHandler != null &&
                Template.CompleteHandler(this))
            {
                return(true);
            }

            for (var i = 0; i < Template.CollectableItems.Length; i++)
            {
                if (CollectedItems[i] < Template.CollectableItems[i].Amount)
                {
                    return(false);
                }
            }

            if (Template.HasObjectOrSpellInteractions)
            {
                for (var i = 0; i < Template.ObjectOrSpellInteractions.Length; i++)
                {
                    var templ = Template.ObjectOrSpellInteractions[i];
                    if (templ == null || !templ.IsValid)
                    {
                        continue;
                    }

                    var count     = Interactions[i];
                    var reqAmount = templ.ObjectType != ObjectTypeId.None || templ.Amount == 0;
                    if ((!reqAmount && count == 0) ||
                        (reqAmount && count < Template.ObjectOrSpellInteractions[i].Amount))
                    {
                        return(false);
                    }
                }
            }

            // TODO: Fix it
            //if ((Template.ObjTriggerIds[i] != 0) && CurrentCounts[i] == 1)
            //{
            //    return false;
            //}
            //if (!string.IsNullOrEmpty(Template.ObjTexts[i]) && CurrentCounts[i] != 1)
            //{
            //    return false;
            //}
            return(true);
        }