Пример #1
0
        /// <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
        }
Пример #2
0
        public void addValidations()
        {
            if (m_value == null || m_value.Length == 0)
            {
                DataConfiguration.addValidation("The reward value is mandatory");
            }
            else
            {
                Int32 intValue;
                switch (getRewardType())
                {
                case RewardType.Credits:
                case RewardType.Explore_XP:
                case RewardType.Combat_XP:
                case RewardType.Trade_XP:
                    if (!Int32.TryParse(getValue(), out intValue) ||
                        intValue < 0 || intValue > 500000)
                    {
                        DataConfiguration.addValidation("The reward quantity '" + getValue() + "' must be between 1 and 500,000");
                    }
                    break;

                case RewardType.Faction:
                    if (!Int32.TryParse(getValue(), out intValue) ||
                        intValue < 0 || intValue > 500000)
                    {
                        DataConfiguration.addValidation("The reward quantity '" + getValue() + "' must be between 1 and 500,000");
                    }
                    DataConfiguration.addValidation(DataConfiguration.DataType.faction, getFlag());
                    break;

                case RewardType.Item_ID:
                    DataConfiguration.addValidation(DataConfiguration.DataType.item, getValue());
                    break;

                case RewardType.Hull_Upgrade:
                    if (!Int32.TryParse(getValue(), out intValue) ||
                        intValue < 0 || intValue > 6)
                    {
                        DataConfiguration.addValidation("The quantity '" + getValue() + "' must be between 1 and 6");
                    }
                    break;

                case RewardType.Advance_Mission:
                    DataConfiguration.addValidation(DataConfiguration.DataType.mission, getValue());
                    break;

                case RewardType.Run_Script:
                    break;
                }
            }
        }
Пример #3
0
        //TB to Rackle - is this the best way to do this?
        public Boolean CheckBadCompletionDuplicates(Completion completion)
        {
            switch (completion.getCompletionType())
            {
            case CompletionType.Nearest_Nav:
                //there can be only one ... Nearest Nav
                if (completion.contains(m_completions, CompletionType.Nearest_Nav))
                {
                    //already contains a Nearest_Nav, don't allow another
                    DataConfiguration.addValidation("You can only have one Nearest_Nav per stage completion.");
                    return(false);
                }
                break;

            default:
                break;
            }
            return(true);
        }
Пример #4
0
        public void addValidations()
        {
            if (getId().Length == 0)
            {
                DataConfiguration.addValidation("The mission Id is required.");
            }
            else if (getKey().Length == 0)
            {
                DataConfiguration.addValidation("The search key is mandatory.");
            }
            else if (getName().Length == 0)
            {
                DataConfiguration.addValidation("The mission name is mandatory.");
            }
            else if (getSummary().Length == 0)
            {
                DataConfiguration.addValidation("The mission summary is mandatory.");
            }
            else if (m_overallLevel != -1
                        && (m_overallLevel < 1 || m_overallLevel > 150))
            {
                DataConfiguration.addValidation("The overall level must be between 1 and 150");
            }
            else if (!hasConditions())
            {
                DataConfiguration.addValidation("Conditions are mandatory");
            }
            else if (!hasStages())
            {
                DataConfiguration.addValidation("Stages are mandatory");
            }
            else
            {
                // The basic validations have been performed

                // Validate the search key based on the type of search
                switch (getType())
                {
                    case CommonTools.MissionType.Npc:
                        DataConfiguration.addValidation(DataConfiguration.DataType.npc, getKey());
                        break;
                    case CommonTools.MissionType.Sector:
                        DataConfiguration.addValidation(DataConfiguration.DataType.sector, getKey());
                        break;
                }

                // Verify that the stages are numbered 0, 1, 2, 3, etc
                List<Stage> stageList = getStages();
                Int32 stageId;
                Stage stage;
                for (int stageIndex = 0; stageIndex < stageList.Count; stageIndex++)
                {
                    stage = stageList[stageIndex];
                    stageId = Int32.Parse(stage.getId());
                    if (stageId != stageIndex)
                    {
                        DataConfiguration.addValidation("Stage ID '" + stageIndex + "' is missing or out of sequence (Stage: " + stage.getId() + ")");
                        break;
                    }
                    stage.addValidations(Stage.ValidationType.Complete);
                }
            }
        }
Пример #5
0
        public void addValidations()
        {
            Int32 value;

            switch (m_conditionType)
            {
            case CommonTools.ConditionType.Overall_Level:
                if (!Int32.TryParse(getValue(), out value) ||
                    value < 1 || value > 150)
                {
                    DataConfiguration.addValidation("The " + m_conditionType + " should be within 1 and 150.");
                }
                break;

            case CommonTools.ConditionType.Combat_Level:
            case CommonTools.ConditionType.Explore_Level:
            case CommonTools.ConditionType.Trade_Level:
                if (!Int32.TryParse(getValue(), out value) ||
                    value < 1 || value > 50)
                {
                    DataConfiguration.addValidation("The " + m_conditionType + " should be within 1 and 50.");
                }
                break;

            case CommonTools.ConditionType.Hull_Level:
                if (!Int32.TryParse(getValue(), out value) ||
                    value < 1 || value > 6)
                {
                    DataConfiguration.addValidation("The " + m_conditionType + " should be within 1 and 6.");
                }
                break;

            case CommonTools.ConditionType.Faction_Required:
                if (!Int32.TryParse(getValue(), out value) ||
                    value < 1 || value > 999999)
                {
                    DataConfiguration.addValidation("The " + m_conditionType + " should be within 1 and 999,999.");
                }
                DataConfiguration.addValidation(DataConfiguration.DataType.faction, getFlag());
                break;

            case CommonTools.ConditionType.Item_Required:
                if (!Int32.TryParse(getValue(), out value) ||
                    value < 1 || value > 5000)
                {
                    DataConfiguration.addValidation("The " + m_conditionType + " should be within 1 and 5,000.");
                }
                DataConfiguration.addValidation(DataConfiguration.DataType.item, getFlag());
                break;

            case CommonTools.ConditionType.Profession:
                if (!"012".Contains(getValue()))
                {
                    DataConfiguration.addValidation("Profession type is invalid.");
                }
                break;

            case CommonTools.ConditionType.Race:
                if (!"012".Contains(getValue()))
                {
                    DataConfiguration.addValidation("Race type is invalid.");
                }
                break;

            case CommonTools.ConditionType.Mission_Required:
                DataConfiguration.addValidation(DataConfiguration.DataType.mission, getValue());
                break;
            }
        }
Пример #6
0
        public void addValidations()
        {
            if (m_value == null || m_value.Length == 0)
            {
                DataConfiguration.addValidation("The completion value is mandatory");
            }
            else
            {
                Int32 count;
                switch (getCompletionType())
                {
                case CompletionType.Arrive_At:
                case CompletionType.Proximity_To_Space_Npc:
                case CompletionType.Talk_Space_Npc:
                    DataConfiguration.addValidation(DataConfiguration.DataType.sector_object, getValue());
                    break;

                case CompletionType.Nav_Message:
                    if (getCount() == -1)
                    {
                        setCount(5000);
                    }
                    if (getCount() != 5000 && getCount() != 10000 && getCount() != 30000)
                    {
                        DataConfiguration.addValidation("The 3 Nav Message ranges are 5000, 10000 and 30000. You must use one of these ranges to trigger your message.");
                    }
                    DataConfiguration.addValidation(DataConfiguration.DataType.sector_object, getValue());
                    break;

                case CompletionType.Fight_Mob:
                    if (getCount() == -1)
                    {
                        setCount(1);
                    }
                    if (getCount() < 0 || getCount() > 5000)
                    {
                        DataConfiguration.addValidation("The number of mobs to fight must be between 1 and 5,000");
                    }
                    DataConfiguration.addValidation(DataConfiguration.DataType.mob, getValue());
                    break;

                case CompletionType.Give_Credits:
                    if (!Int32.TryParse(getValue(), out count) ||
                        count < 0 || count > 25000)
                    {
                        DataConfiguration.addValidation("The amount of credits to give must be between 1 and 25,000");
                    }
                    break;

                case CompletionType.Give_Item:
                    if (getCount() == -1)
                    {
                        setCount(1);
                    }
                    if (getCount() < 0 || getCount() > 500)
                    {
                        DataConfiguration.addValidation("The quantity of items to give must be between 1 and 500");
                    }
                    DataConfiguration.addValidation(DataConfiguration.DataType.item, getValue());
                    break;

                case CompletionType.Nearest_Nav:
                    //can only have one nearest Nav for completions
                    DataConfiguration.addValidation(DataConfiguration.DataType.sector_object, getValue());
                    break;

                case CompletionType.Obtain_Items:
                    DataConfiguration.addValidation(DataConfiguration.DataType.item, getValue());
                    break;

                /*case CompletionType.Obtain_Items_At_Location:
                 *  DataConfiguration.addValidation(DataConfiguration.DataType.sector_object, getValue());
                 *  DataConfiguration.addValidation(DataConfiguration.DataType.item, getData());
                 *  break;*/
                case CompletionType.Possess_Item:
                    if (getCount() == -1)
                    {
                        setCount(1);
                    }
                    if (getCount() < 0 || getCount() > 5000)
                    {
                        DataConfiguration.addValidation("The quantity must be between 1 and 5,000");
                    }
                    DataConfiguration.addValidation(DataConfiguration.DataType.item, getValue());
                    break;

                case CompletionType.Receive_Item:
                    if (!Int32.TryParse(getValue(), out count) ||
                        count < 0 || count > 10)
                    {
                        DataConfiguration.addValidation("The quantity must be between 1 and 10");
                    }
                    break;

                case CompletionType.Current_Sector:
                    DataConfiguration.addValidation(DataConfiguration.DataType.sector, getValue());
                    break;

                /*case CompletionType.Take_Item_To_Location:
                 *  DataConfiguration.addValidation(DataConfiguration.DataType.sector_object, getValue());
                 *  DataConfiguration.addValidation(DataConfiguration.DataType.item, getData());
                 *  break;*/
                case CompletionType.Talk_To_Npc:
                    DataConfiguration.addValidation(DataConfiguration.DataType.npc, getValue());
                    break;

                case CompletionType.Use_Skill_On_Mob_Type:
                    DataConfiguration.addValidation(DataConfiguration.DataType.mob, getValue());
                    DataConfiguration.addValidation(DataConfiguration.DataType.skill, getData());
                    break;

                case CompletionType.Use_Skill_On_Object:
                    DataConfiguration.addValidation(DataConfiguration.DataType.sector_object, getValue());
                    DataConfiguration.addValidation(DataConfiguration.DataType.skill, getData());
                    break;
                }
            }
        }