示例#1
0
        private static bool CheckAllRequirements(Sim s, Opportunity op, OpportunityNames lastOpName, ref string msg)
        {
            Opportunity.OpportunitySharedData sharedData = op.SharedData;
            WorldName mTargetWorldRequired = sharedData.mTargetWorldRequired;
            WorldName currentWorld         = GameUtils.GetCurrentWorld();

            if (mTargetWorldRequired == WorldName.SunsetValley)
            {
                mTargetWorldRequired = s.SimDescription.HomeWorld;
            }
            if ((mTargetWorldRequired == currentWorld) || (mTargetWorldRequired == WorldName.Undefined))
            {
                foreach (Opportunity.OpportunitySharedData.RequirementInfo info in sharedData.mRequirementList)
                {
                    if (info.mType == RequirementType.OpportunityComplete)
                    {
                        OpportunityNames mGuid = (OpportunityNames)info.mGuid;
                        if (lastOpName == mGuid)
                        {
                            continue;
                        }
                    }
                    if (!op.CheckRequirement(info, s, sharedData))
                    {
                        msg += Common.NewLine + " Failure: " + info.mType;

                        return(false);
                    }
                }
            }
            OpportunityNames mCompletionTriggerOpportunity = sharedData.mCompletionTriggerOpportunity;

            if (mCompletionTriggerOpportunity != OpportunityNames.Undefined)
            {
                Opportunity staticOpportunity = OpportunityManager.GetStaticOpportunity(mCompletionTriggerOpportunity);
                if ((staticOpportunity != null) && !op.CheckAllRequirements(s, staticOpportunity, sharedData.mGuid))
                {
                    msg += Common.NewLine + " Failure: B";
                    return(false);
                }
            }
            return(true);
        }
示例#2
0
        private static bool CheckAllRequirements(Sim s, Opportunity op, OpportunityNames lastOpName, ref string msg)
        {
            Opportunity.OpportunitySharedData sharedData = op.SharedData;
            WorldName mTargetWorldRequired = sharedData.mTargetWorldRequired;
            WorldName currentWorld = GameUtils.GetCurrentWorld();

            if (mTargetWorldRequired == WorldName.SunsetValley)
            {
                mTargetWorldRequired = s.SimDescription.HomeWorld;
            }
            if ((mTargetWorldRequired == currentWorld) || (mTargetWorldRequired == WorldName.Undefined))
            {
                foreach (Opportunity.OpportunitySharedData.RequirementInfo info in sharedData.mRequirementList)
                {
                    if (info.mType == RequirementType.OpportunityComplete)
                    {
                        OpportunityNames mGuid = (OpportunityNames)info.mGuid;
                        if (lastOpName == mGuid)
                        {
                            continue;
                        }
                    }
                    if (!op.CheckRequirement(info, s, sharedData))
                    {
                        msg += Common.NewLine + " Failure: " + info.mType;

                        return false;
                    }
                }
            }
            OpportunityNames mCompletionTriggerOpportunity = sharedData.mCompletionTriggerOpportunity;
            if (mCompletionTriggerOpportunity != OpportunityNames.Undefined)
            {
                Opportunity staticOpportunity = OpportunityManager.GetStaticOpportunity(mCompletionTriggerOpportunity);
                if ((staticOpportunity != null) && !op.CheckAllRequirements(s, staticOpportunity, sharedData.mGuid))
                {
                    msg += Common.NewLine + " Failure: B";
                    return false;
                }
            }
            return true;
        }