Ejemplo n.º 1
0
        private void BuildObjectiveStatusConditional(JObject conditionalObject)
        {
            Main.LogDebug("[BuildObjectiveStatusConditional] Building 'ObjectiveStatusConditional' conditional");
            string guid   = conditionalObject["Guid"].ToString();
            string status = conditionalObject["Status"].ToString();
            ObjectiveStatusEvaluationType statusType  = (ObjectiveStatusEvaluationType)Enum.Parse(typeof(ObjectiveStatusEvaluationType), status);
            ObjectiveStatusConditional    conditional = ScriptableObject.CreateInstance <ObjectiveStatusConditional>();

            ObjectiveRef objectiveRef = new ObjectiveRef();

            objectiveRef.EncounterObjectGuid = guid;

            conditional.objective       = objectiveRef;
            conditional.objectiveStatus = statusType;

            conditionalList.Add(new EncounterConditionalBox(conditional));
        }
Ejemplo n.º 2
0
        private void BuildObjectStatusesConditional(JObject conditionalObject)
        {
            Main.LogDebug("[BuildObjectStatusesConditional] Building 'ObjectStatusesConditional' conditional");
            bool   notInContractObjectivesAreSuccesses = conditionalObject.ContainsKey("NotInContractObjectivesAreSuccesses") ? (bool)conditionalObject["NotInContractObjectivesAreSuccesses"] : true;
            JArray statusesArray = (JArray)conditionalObject["Statuses"];
            Dictionary <string, ObjectiveStatusEvaluationType> statuses = new Dictionary <string, ObjectiveStatusEvaluationType>();

            foreach (JObject status in statusesArray.Children <JObject>())
            {
                string childGuid   = status["Guid"].ToString();
                string childStatus = status["Status"].ToString();
                ObjectiveStatusEvaluationType childStatusType = (ObjectiveStatusEvaluationType)Enum.Parse(typeof(ObjectiveStatusEvaluationType), childStatus);
                statuses.Add(childGuid, childStatusType);
            }

            ObjectiveStatusesConditional conditional = ScriptableObject.CreateInstance <ObjectiveStatusesConditional>();

            conditional.NotInContractObjectivesAreSuccesses = notInContractObjectivesAreSuccesses;
            conditional.Statuses = statuses;

            conditionalList.Add(new EncounterConditionalBox(conditional));
        }
Ejemplo n.º 3
0
        private void EvaluateChild(string guid, string responseName)
        {
            ObjectiveGameLogic            objectiveGameLogic = this.combat.ItemRegistry.GetItemByGUID <ObjectiveGameLogic>(guid);
            ObjectiveStatusEvaluationType objectiveStatus    = Statuses[guid];

            if (objectiveGameLogic.IsAnInactiveContractControlledObjective())
            {
                Main.LogDebug($"[ObjectiveStatusesConditional] '{objectiveGameLogic.gameObject.name}' is an objective in an inactive contract controlled chunk. Auto-suceeeding objective for this check");
                completedStatus[guid] = true;
                return;
            }

            switch (objectiveStatus)
            {
            case ObjectiveStatusEvaluationType.InProgress: {
                string message2;
                if (objectiveGameLogic.IsInProgress)
                {
                    message2 = string.Format("Objective[{0}] is in progress.", objectiveGameLogic.DisplayName);
                    base.LogEvaluationPassed(message2, responseName);
                    completedStatus[guid] = true;
                    return;
                }
                message2 = string.Format("Objective[{0}] is NOT in progress.", objectiveGameLogic.DisplayName);
                base.LogEvaluationFailed(message2, responseName);
                return;
            }

            case ObjectiveStatusEvaluationType.Complete: {
                string message2;
                if (objectiveGameLogic.IsComplete)
                {
                    message2 = string.Format("Objective[{0}] is Complete.", objectiveGameLogic.DisplayName);
                    base.LogEvaluationPassed(message2, responseName);
                    completedStatus[guid] = true;
                    return;
                }
                message2 = string.Format("Objective[{0}] is NOT Complete.", objectiveGameLogic.DisplayName);
                base.LogEvaluationFailed(message2, responseName);
                return;
            }

            case ObjectiveStatusEvaluationType.Success: {
                string message2;
                if (objectiveGameLogic.CurrentObjectiveStatus == ObjectiveStatus.Succeeded)
                {
                    message2 = string.Format("Objective[{0}] is Succeeded.", objectiveGameLogic.DisplayName);
                    base.LogEvaluationPassed(message2, responseName);
                    completedStatus[guid] = true;
                    return;
                }
                message2 = string.Format("Objective[{0}] is NOT Succeeded.", objectiveGameLogic.DisplayName);
                base.LogEvaluationFailed(message2, responseName);
                return;
            }

            case ObjectiveStatusEvaluationType.Failed: {
                string message2;
                if (objectiveGameLogic.CurrentObjectiveStatus == ObjectiveStatus.Failed)
                {
                    message2 = string.Format("Objective[{0}] is Failed.", objectiveGameLogic.DisplayName);
                    base.LogEvaluationPassed(message2, responseName);
                    completedStatus[guid] = true;
                }
                message2 = string.Format("Objective[{0}] is NOT Failed.", objectiveGameLogic.DisplayName);
                base.LogEvaluationFailed(message2, responseName);
                return;
            }

            case ObjectiveStatusEvaluationType.NotInProgress: {
                string message2;
                if (!objectiveGameLogic.IsInProgress)
                {
                    message2 = string.Format("Objective[{0}] is NOT in progress.", objectiveGameLogic.DisplayName);
                    base.LogEvaluationPassed(message2, responseName);
                    completedStatus[guid] = true;
                    return;
                }
                message2 = string.Format("Objective[{0}] is in progress.", objectiveGameLogic.DisplayName);
                base.LogEvaluationFailed(message2, responseName);
                return;
            }

            default: {
                string message2 = string.Format("Objective[{0}] status is weird! [{1}]", objectiveGameLogic.DisplayName, objectiveStatus);
                base.LogEvaluationFailed(message2, responseName);
                return;
            }
            }
        }