/// <summary> /// Add the Stage validations /// </summary> /// <param name="validationType">The type of validation to perform. /// Only the dialog should use the FromDialog type.</param> public void addValidations(ValidationType validationType) { Int32 stageId; if (!Int32.TryParse(getId(), out stageId) || stageId < 0 || stageId >= m_maxStages) { DataConfiguration.addValidation("The stage ID must be within 0 and " + (m_maxStages - 1).ToString()); } else if (stageId != 0 && getDescription().Length == 0) { DataConfiguration.addValidation("The stage description must be specified (Stage: " + getId() + ")"); } if (validationType.Equals(ValidationType.Complete)) { if (!hasCompletions()) { DataConfiguration.addValidation("Stage completions are mandatory (Stage: " + getId() + ")"); } else { int actionCount; int totalActionCount = 0; foreach (Completion completion in getCompletions()) { switch (completion.getCompletionType()) { case CompletionType.Fight_Mob: case CompletionType.Use_Skill_On_Mob_Type: case CompletionType.Use_Skill_On_Object: actionCount = completion.getCount(); if (actionCount == -1) { // If there is no count then it "counts" as one actionCount = 1; } totalActionCount += actionCount; break; } } if (totalActionCount >= 32) { DataConfiguration.addValidation("There cannot be more than 32 actions in a stage (Stage: " + getId() + ")"); } // Verify CompletionType interdependencies /*if (Completion.contains(getCompletions(), CompletionType.Take_Item_To_Location) * && !Completion.contains(getCompletions(), CompletionType.Nearest_Nav)) * { * DataConfiguration.addValidation("The type '" + CompletionType.Take_Item_To_Location.ToString() + "' requires the '" + CompletionType.Nearest_Nav.ToString() + "' type (Stage: " + getId() + ")."); + }*/ } } // ValidationType.Complete }
/// <summary> /// Add the Stage validations /// </summary> /// <param name="validationType">The type of validation to perform. /// Only the dialog should use the FromDialog type.</param> public void addValidations(ValidationType validationType) { Int32 stageId; if (!Int32.TryParse(getId(), out stageId) || stageId < 0 || stageId >= m_maxStages) { DataConfiguration.addValidation("The stage ID must be within 0 and " + (m_maxStages - 1).ToString()); } else if (stageId != 0 && getDescription().Length == 0) { DataConfiguration.addValidation("The stage description must be specified (Stage: " + getId() + ")"); } if (validationType.Equals(ValidationType.Complete)) { if (!hasCompletions()) { DataConfiguration.addValidation("Stage completions are mandatory (Stage: " + getId() + ")"); } else { int actionCount; int totalActionCount = 0; foreach (Completion completion in getCompletions()) { switch (completion.getCompletionType()) { case CompletionType.Fight_Mob: case CompletionType.Use_Skill_On_Mob_Type: case CompletionType.Use_Skill_On_Object: actionCount = completion.getCount(); if (actionCount == -1) { // If there is no count then it "counts" as one actionCount = 1; } totalActionCount += actionCount; break; } } if (totalActionCount >= 32) { DataConfiguration.addValidation("There cannot be more than 32 actions in a stage (Stage: " + getId() + ")"); } // Verify CompletionType interdependencies /*if (Completion.contains(getCompletions(), CompletionType.Take_Item_To_Location) && !Completion.contains(getCompletions(), CompletionType.Nearest_Nav)) { DataConfiguration.addValidation("The type '" + CompletionType.Take_Item_To_Location.ToString() + "' requires the '" + CompletionType.Nearest_Nav.ToString() + "' type (Stage: " + getId() + ")."); }*/ } } // ValidationType.Complete }
/// <summary> /// Gets the javascript validation function name. /// </summary> /// <returns></returns> protected override string GetValidationFunction() { return(ValidationType.Equals(IntervalValidationType.DAYS) ? "CheckDateTimeRange" : "CheckDateTimeHoursRange"); }