示例#1
0
        private static Keyword GetActionFalse()
        {
            Keyword keyword = new Keyword();

            keyword.Command          = "if_action_false";
            keyword.FriendlyName     = "Action Not Complete";
            keyword.HelpText         = "Used for determining if a given action has not been completed.";
            keyword.AllowConditional = true;

            KeywordInput action = new KeywordInput(KeywordInputType.Action, "Action ID", "The ID of the Action for which the objective is associated.");

            action.AllowableActions.Add(2);
            action.AllowableActions.Add(4);
            action.AllowableActions.Add(6);
            action.AllowableActions.Add(8);
            action.AllowableActions.Add(19);
            action.AllowableActions.Add(22);
            //add some that are missing -crapshoot
            action.AllowableActions.Add(33); //expire
            action.AllowableActions.Add(34); //explode
            //this technically can be used with any action because it just checks goalnum
            keyword.Inputs.Add(action);

            return(keyword);
        }
示例#2
0
        public void SetupDataProvider(string fileName, ICSharpCode.TextEditor.TextArea textArea)
        {
            _textArea = textArea;
            _document = textArea.Document;
            _keywords = KeywordFactory.GetKeywords();

            //TODO: just put these keywords in the factory and add a flag for "IsRequired" or something.
            //      it may just require a KeywordType (Header, Action, etc). This needs cleaned up
            //      in the code completion data provider as well.

            // the keyword factory just has the non-required words
            Keyword sightDist = new Keyword("bot_SightDist", "", "", false);

            sightDist.Inputs.Add(new KeywordInput(KeywordInputType.Action, "Sight Distance", "How far the highest skill bot can see on this map. 1500 is good for non-foggy maps, 700 is good for foggy maps."));
            _keywords.Add(sightDist);

            _keywords.Add(new Keyword("spawnflag_is_priority", "", "Whether or no bots focus on spawnflags.", false));
            _keywords.Add(new Keyword("cmdpost_is_priority", "", "Whether or not command posts critical on this map.", false));
            _keywords.Add(new Keyword("construct_is_priority", "", "Whether or not engineers focus more on constructibles.", false));
            _keywords.Add(new Keyword("map_has_vehicle", "", "Type of vehicle 0 = none, 1 = tank, 2 = train", false));
            _keywords.Add(new Keyword("vehicle_entity_number", "", "The entity number of the vehicle.", false));
            _keywords.Add(new Keyword("vehicle_team_owner", "", "The owner of the vehicle.", false));

            LineSegment line = textArea.Document.GetLineSegmentForOffset(textArea.Caret.Offset);

            if (line != null)
            {
                TextWord first = GetWord(line, 1);

                if (first != null)
                {
                    Keyword keyword = _keywords.GetWord(first.Word);

                    if (keyword != null)
                    {
                        if (keyword.Inputs.Count > 0)
                        {
                            for (int x = 0; x < keyword.Inputs.Count; x++)
                            {
                                TextWord param = GetWord(line, x + 2);

                                if (param == null)
                                {
                                    KeywordInput inputParam = (KeywordInput)keyword.Inputs[x];

                                    if (inputParam.InputType != KeywordInputType.PredefinedList)
                                    {
                                        _insightKeywords.Add(new Keyword(inputParam.Label, inputParam.Label, inputParam.HelpText, false));
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
示例#3
0
        private static Keyword GetWaitCommand()
        {
            Keyword keyword = new Keyword();

            keyword.Command      = "wait";
            keyword.FriendlyName = "Wait";
            keyword.HelpText     = "Used to wait a specified period (in seconds) before executing the next lines command.";

            KeywordInput seconds = new KeywordInput(KeywordInputType.Integer, "Seconds", "The amount of seconds to wait before executing the next command.");

            keyword.Inputs.Add(seconds);

            return(keyword);
        }
示例#4
0
        //crapshoot: set_Vehicle_Number
        private static Keyword GetSetVehicleNumber()
        {
            Keyword keyword = new Keyword();

            keyword.Command      = "set_Vehicle_Number";
            keyword.FriendlyName = "Vehicle Number";
            keyword.HelpText     = "The entity number of the vehicle (script_mover)";

            KeywordInput entity = new KeywordInput(KeywordInputType.Integer, "Entity Number", "Entity Number for Vehicle.");

            keyword.Inputs.Add(entity);

            return(keyword);
        }
示例#5
0
        private static Keyword GetIfObjCaptured()
        {
            Keyword keyword = new Keyword();

            keyword.Command          = "if_obj_captured";
            keyword.FriendlyName     = "If An Objective Captured";
            keyword.HelpText         = "Used for determining if an objective has been captured. Associate the action that represents the objective.";
            keyword.AllowConditional = true;

            KeywordInput action = new KeywordInput(KeywordInputType.Action, "Action ID", "The ID of the Action for which the objective is associated.");

            action.AllowableActions.Add(8);
            keyword.Inputs.Add(action);

            return(keyword);
        }
示例#6
0
        //crapshoot: set_Vehicle_Owner
        private static Keyword GetSetVehicleOwner()
        {
            Keyword keyword = new Keyword();

            keyword.Command      = "set_Vehicle_Owner";
            keyword.FriendlyName = "Vehicle Owner";
            keyword.HelpText     = "Who owns the vehicle?";

            KeywordInput input = new KeywordInput(KeywordInputType.PredefinedList, "Vehicle Owner", "Who Owns the Vehicle");

            input.AllowableValues.Add("allies");
            input.AllowableValues.Add("axis");
            keyword.Inputs.Add(input);

            return(keyword);
        }
示例#7
0
        //crapshoot: set_Map_Has_Vehicle
        private static Keyword GetSetMapHasVehicle()
        {
            Keyword keyword = new Keyword();

            keyword.Command      = "set_Map_Has_Vehicle";
            keyword.FriendlyName = "Map Has Vehicle";
            keyword.HelpText     = "Used for turning movers on and off";

            KeywordInput input = new KeywordInput(KeywordInputType.PredefinedList, "Has Vehicle", "Whether or not a Vehicle is active.");

            input.AllowableValues.Add("true");
            input.AllowableValues.Add("false");
            keyword.Inputs.Add(input);

            return(keyword);
        }
示例#8
0
        private static Keyword GetIfObjHomeTrue()
        {
            Keyword keyword = new Keyword();

            keyword.Command          = "if_obj_home_true";
            keyword.FriendlyName     = "If Objective Is Home";
            keyword.HelpText         = "Used for determining if an objective is in place. The action associated with this Keyword is typically a 'Steal' action for documents.";
            keyword.AllowConditional = true;

            KeywordInput action = new KeywordInput(KeywordInputType.Action, "Action ID", "The ID of the Action for which the objective is associated.");

            action.AllowableActions.Add(8);

            keyword.Inputs.Add(action);

            return(keyword);
        }
示例#9
0
        private static Keyword GetIfAxisCpBuiltFalse()
        {
            Keyword keyword = new Keyword();

            keyword.Command          = "if_axis_cp_built_false";
            keyword.FriendlyName     = "If Axis Command Post Is Not Built";
            keyword.HelpText         = "Used for determining if an Axis Command Post is not built.";
            keyword.AllowConditional = true;

            KeywordInput action = new KeywordInput(KeywordInputType.Action, "Action ID", "The ID of the Action for which the objective is associated.");

            action.AllowableActions.Add(22);

            keyword.Inputs.Add(action);

            return(keyword);
        }
示例#10
0
        private static Keyword GetIfConstructBuiltTrue()
        {
            Keyword keyword = new Keyword();

            keyword.Command          = "if_construct_built_true";
            keyword.FriendlyName     = "If Constructible Is Built";
            keyword.HelpText         = "Used for determining if an has been constructed. Associate a construct major or minor action with this command.";
            keyword.AllowConditional = true;

            KeywordInput action = new KeywordInput(KeywordInputType.Action, "Action ID", "The ID of the Action for which the objective is associated.");

            action.AllowableActions.Add(19);
            action.AllowableActions.Add(2);
            keyword.Inputs.Add(action);

            return(keyword);
        }
示例#11
0
        private static Keyword GetIfFlagOwnerAllies()
        {
            Keyword keyword = new Keyword();

            keyword.Command          = "if_fda_owner_allies";
            keyword.FriendlyName     = "If Allies Have Flag";
            keyword.HelpText         = "Used for determining if the Allies have the flag. Associate a 'Spawn Flag' action with this command.";
            keyword.AllowConditional = true;

            KeywordInput action = new KeywordInput(KeywordInputType.Action, "Action ID", "The ID of the Action for which the objective is associated.");

            action.AllowableActions.Add(6);

            keyword.Inputs.Add(action);

            return(keyword);
        }
示例#12
0
        private static Keyword GetNodeDisconnect()
        {
            Keyword keyword = new Keyword();

            keyword.Command      = "node_disconnect";
            keyword.FriendlyName = "Node Disconnect";
            keyword.HelpText     = "Used to disconnect nodes";

            keyword.Inputs.Add(new KeywordInput(KeywordInputType.Node, "Node ID 1", "The ID of the first node to disconnect."));
            keyword.Inputs.Add(new KeywordInput(KeywordInputType.Node, "Node ID 2", "The ID of the second node to discconnect."));

            KeywordInput input = new KeywordInput(KeywordInputType.PredefinedList, "Two Way Disconnect", "Whether or not this is a two way connection.");

            input.AllowableValues.Add("true");
            input.AllowableValues.Add("false");
            keyword.Inputs.Add(input);
            return(keyword);
        }
示例#13
0
        //crapshoot: openNodeGrpToTeam
        private static Keyword GetOpenNodeGrpToTeam()
        {
            Keyword keyword = new Keyword();

            keyword.Command      = "openNodeGrpToTeam";
            keyword.FriendlyName = "Open Node Group";
            keyword.HelpText     = "Used to open a group of nodes to a team";

            keyword.Inputs.Add(new KeywordInput(KeywordInputType.Group, "Node Group", "The Group ID of nodes to open."));

            KeywordInput input = new KeywordInput(KeywordInputType.PredefinedList, "Team", "The Team to open the nodes for.");

            input.AllowableValues.Add("axis");
            input.AllowableValues.Add("allies");
            keyword.Inputs.Add(input);

            return(keyword);
        }
示例#14
0
        private static Keyword GetActionTrue()
        {
            Keyword keyword = new Keyword();

            keyword.Command = "if_action_true";
            keyword.FriendlyName = "Action Complete";
            keyword.HelpText = "Used for determining if a given action has been completed.";
            keyword.AllowConditional = true;

            KeywordInput action = new KeywordInput(KeywordInputType.Action, "Action ID", "The ID of the Action for which the objective is associated.");
            action.AllowableActions.Add(2);
            action.AllowableActions.Add(4);
            action.AllowableActions.Add(6);
            action.AllowableActions.Add(8);
            action.AllowableActions.Add(19);
            action.AllowableActions.Add(22);
            keyword.Inputs.Add(action);

            return keyword;
        }
示例#15
0
        private static Keyword GetActionFalse()
        {
            Keyword keyword = new Keyword();

            keyword.Command          = "if_action_false";
            keyword.FriendlyName     = "Action Not Complete";
            keyword.HelpText         = "Used for determining if a given action has not been completed.";
            keyword.AllowConditional = true;

            KeywordInput action = new KeywordInput(KeywordInputType.Action, "Action ID", "The ID of the Action for which the objective is associated.");

            action.AllowableActions.Add(2);
            action.AllowableActions.Add(4);
            action.AllowableActions.Add(6);
            action.AllowableActions.Add(8);
            action.AllowableActions.Add(19);
            action.AllowableActions.Add(22);
            keyword.Inputs.Add(action);

            return(keyword);
        }
示例#16
0
        private static Keyword GetBotSwitchToWeap()
        {
            Keyword keyword = new Keyword();

            keyword.Command      = "bot_switchToWeap";
            keyword.FriendlyName = "Switch Weapons";
            keyword.HelpText     = "Will cause all soldiers on the specified team to switch to the defined weapon.";

            KeywordInput weapon = new KeywordInput(KeywordInputType.PredefinedList, "Weapon", "The weapon to switch to.");

            weapon.AllowableValues.Add("FG42");
            weapon.AllowableValues.Add("flame");
            weapon.AllowableValues.Add("garand");
            weapon.AllowableValues.Add("k43");
            weapon.AllowableValues.Add("MG42");
            weapon.AllowableValues.Add("mortar");
            weapon.AllowableValues.Add("panzer");
            weapon.AllowableValues.Add("random");
            weapon.AllowableValues.Add("random_f");
            weapon.AllowableValues.Add("random_fp");
            weapon.AllowableValues.Add("random_p");
            weapon.AllowableValues.Add("random_pf");
            weapon.AllowableValues.Add("smg");
            weapon.AllowableValues.Add("sniper");
            weapon.AllowableValues.Add("venom");

            keyword.Inputs.Add(weapon);

            KeywordInput team = new KeywordInput(KeywordInputType.PredefinedList, "Team", "The team to switch weapons for");

            team.AllowableValues.Add("allies");
            team.AllowableValues.Add("axis");

            keyword.Inputs.Add(team);

            return(keyword);
        }
示例#17
0
        private static Keyword GetActionTrue()
        {
            Keyword keyword = new Keyword();

            keyword.Command = "if_action_true";
            keyword.FriendlyName = "Action Complete";
            keyword.HelpText = "Used for determining if a given action has been completed.";
            keyword.AllowConditional = true;

            KeywordInput action = new KeywordInput(KeywordInputType.Action, "Action ID", "The ID of the Action for which the objective is associated.");
            action.AllowableActions.Add(2);
            action.AllowableActions.Add(4);
            action.AllowableActions.Add(6);
            action.AllowableActions.Add(8);
            action.AllowableActions.Add(19);
            action.AllowableActions.Add(22);
            //add some that are missing -crapshoot
            action.AllowableActions.Add(33); //expire
            action.AllowableActions.Add(34); //explode
            //this technically can be used with any action because it just checks goalnum
            keyword.Inputs.Add(action);

            return keyword;
        }
示例#18
0
        private static Keyword GetIfAxisCpBuiltTrue()
        {
            Keyword keyword = new Keyword();

            keyword.Command = "if_axis_cp_built_true";
            keyword.FriendlyName = "If Axis Command Post Built";
            keyword.HelpText = "Used for determining if an Axis Command Post is built.";
            keyword.AllowConditional = true;

            KeywordInput action = new KeywordInput(KeywordInputType.Action, "Action ID", "The ID of the Action for which the objective is associated.");
            action.AllowableActions.Add(22);

            keyword.Inputs.Add(action);

            return keyword;
        }
示例#19
0
        private static Keyword GetIfConstructBuiltTrue()
        {
            Keyword keyword = new Keyword();

            keyword.Command = "if_construct_built_true";
            keyword.FriendlyName = "If Constructible Is Built";
            keyword.HelpText = "Used for determining if an has been constructed. Associate a construct major or minor action with this command.";
            keyword.AllowConditional = true;

            KeywordInput action = new KeywordInput(KeywordInputType.Action, "Action ID", "The ID of the Action for which the objective is associated.");
            action.AllowableActions.Add(19);
            action.AllowableActions.Add(2);
            keyword.Inputs.Add(action);

            return keyword;
        }
示例#20
0
        private static Keyword GetIfFlagOwnerAxis()
        {
            Keyword keyword = new Keyword();

            keyword.Command = "if_fda_owner_axis";
            keyword.FriendlyName = "If Axis Have Flag";
            keyword.HelpText = "Used for determining if the Axis have the flag. Associate a 'Spawn Flag' action with this command.";
            keyword.AllowConditional = true;

            KeywordInput action = new KeywordInput(KeywordInputType.Action, "Action ID", "The ID of the Action for which the objective is associated.");
            action.AllowableActions.Add(6);

            keyword.Inputs.Add(action);

            return keyword;
        }
示例#21
0
        private static Keyword GetIfObjCaptured()
        {
            Keyword keyword = new Keyword();

            keyword.Command = "if_obj_captured";
            keyword.FriendlyName = "If An Objective Captured";
            keyword.HelpText = "Used for determining if an objective has been captured. Associate the action that represents the objective.";
            keyword.AllowConditional = true;

            KeywordInput action = new KeywordInput(KeywordInputType.Action, "Action ID", "The ID of the Action for which the objective is associated.");
            action.AllowableActions.Add(8);
            keyword.Inputs.Add(action);

            return keyword;
        }
示例#22
0
        private static Keyword GetIfObjHomeTrue()
        {
            Keyword keyword = new Keyword();

            keyword.Command = "if_obj_home_true";
            keyword.FriendlyName = "If Objective Is Home";
            keyword.HelpText = "Used for determining if an objective is in place. The action associated with this Keyword is typically a 'Steal' action for documents.";
            keyword.AllowConditional = true;

            KeywordInput action = new KeywordInput(KeywordInputType.Action, "Action ID", "The ID of the Action for which the objective is associated.");
            action.AllowableActions.Add(8);

            keyword.Inputs.Add(action);

            return keyword;
        }
示例#23
0
        private static Keyword GetNodeDisconnect()
        {
            Keyword keyword = new Keyword();

            keyword.Command = "node_disconnect";
            keyword.FriendlyName = "Node Disconnect";
            keyword.HelpText = "Used to disconnect nodes";

            keyword.Inputs.Add(new KeywordInput(KeywordInputType.Node, "Node ID 1", "The ID of the first node to disconnect."));
            keyword.Inputs.Add(new KeywordInput(KeywordInputType.Node, "Node ID 2", "The ID of the second node to discconnect."));

            KeywordInput input = new KeywordInput(KeywordInputType.PredefinedList, "Two Way Disconnect", "Whether or not this is a two way connection.");
            input.AllowableValues.Add("true");
            input.AllowableValues.Add("false");
            keyword.Inputs.Add(input);
            return keyword;
        }
示例#24
0
        //crapshoot: set_Map_Has_Vehicle
        private static Keyword GetSetMapHasVehicle()
        {
            Keyword keyword = new Keyword();

            keyword.Command = "set_Map_Has_Vehicle";
            keyword.FriendlyName = "Map Has Vehicle";
            keyword.HelpText = "Used for turning movers on and off";

            KeywordInput input = new KeywordInput(KeywordInputType.PredefinedList, "Has Vehicle", "Whether or not a Vehicle is active.");
            input.AllowableValues.Add("true");
            input.AllowableValues.Add("false");
            keyword.Inputs.Add(input);

            return keyword;
        }
示例#25
0
        //crapshoot: set_Vehicle_Number
        private static Keyword GetSetVehicleNumber()
        {
            Keyword keyword = new Keyword();

            keyword.Command = "set_Vehicle_Number";
            keyword.FriendlyName = "Vehicle Number";
            keyword.HelpText = "The entity number of the vehicle (script_mover)";

            KeywordInput entity = new KeywordInput(KeywordInputType.Integer, "Entity Number", "Entity Number for Vehicle.");
            keyword.Inputs.Add(entity);

            return keyword;
        }
示例#26
0
        //crapshoot: set_Vehicle_Owner
        private static Keyword GetSetVehicleOwner()
        {
            Keyword keyword = new Keyword();

            keyword.Command = "set_Vehicle_Owner";
            keyword.FriendlyName = "Vehicle Owner";
            keyword.HelpText = "Who owns the vehicle?";

            KeywordInput input = new KeywordInput(KeywordInputType.PredefinedList, "Vehicle Owner", "Who Owns the Vehicle");
            input.AllowableValues.Add("allies");
            input.AllowableValues.Add("axis");
            keyword.Inputs.Add(input);

            return keyword;
        }
示例#27
0
        private static Keyword GetWaitCommand()
        {
            Keyword keyword = new Keyword();

            keyword.Command = "wait";
            keyword.FriendlyName = "Wait";
            keyword.HelpText = "Used to wait a specified period (in seconds) before executing the next lines command.";

            KeywordInput seconds = new KeywordInput(KeywordInputType.Integer, "Seconds", "The amount of seconds to wait before executing the next command.");
            keyword.Inputs.Add(seconds);

            return keyword;
        }
        public ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
        {
            _keywords = KeywordFactory.GetKeywords();

            // the keyword factory just has the non-required words
            _keywords.Add(new Keyword("bot_SightDist", "", "How far the highest skill bot can see on this map", false));

            ArrayList allowable = new ArrayList();
            allowable.Add("0");
            allowable.Add("1");

            Keyword flag = new Keyword("spawnflag_is_priority", "",  "Whether or no bots focus on spawnflags.", false);
            KeywordInput flagInput = new KeywordInput(KeywordInputType.PredefinedList, "spawnflag_is_priority", "Whether or no bots focus on spawnflags.");
            flagInput.AllowableValues = allowable;
            flag.Inputs.Add(flagInput);
            _keywords.Add(flag);

            Keyword cmdpost = new Keyword("cmdpost_is_priority", "",  "Whether or not command posts critical on this map.", false);
            KeywordInput cmdpostInput = new KeywordInput(KeywordInputType.PredefinedList, "cmdpost_is_priority", "Whether or not command posts critical on this map.");
            cmdpostInput.AllowableValues = allowable;
            cmdpost.Inputs.Add(cmdpostInput);
            _keywords.Add(cmdpost);

            Keyword construct = new Keyword("construct_is_priority", "",  "Whether or not engineers focus more on constructibles.", false);
            KeywordInput constructInput = new KeywordInput(KeywordInputType.PredefinedList, "construct_is_priority", "Whether or not engineers focus more on constructibles.");
            constructInput.AllowableValues = allowable;
            construct.Inputs.Add(constructInput);
            _keywords.Add(construct);

            Keyword vehicle = new Keyword("map_has_vehicle", "",  "Whether or not this map has a tank or a train.", false);
            KeywordInput vehicleInput = new KeywordInput(KeywordInputType.PredefinedList, "map_has_vehicle", "Type of vehicle 0 = none, 1 = tank, 2 = train");

            ArrayList allowableVehicle = new ArrayList();
            allowable.Add("0");
            allowable.Add("1");
            allowable.Add("2");
            vehicleInput.AllowableValues = allowableVehicle;
            vehicle.Inputs.Add(vehicleInput);
            _keywords.Add(vehicle);

            //vehicle_entity_number 429 //the entity number of the tank
            Keyword vehicleEntity = new Keyword("vehicle_entity_number", "",  "The entity number of the vehicle.", false);
            vehicleEntity.Inputs.Add(new KeywordInput(KeywordInputType.Action, "Vehicle Entity Number", "The entity number of the vehicle."));
            _keywords.Add(vehicleEntity);

            //vehicle_team_owner 2 //ALLIES own this tank! 1 = AXIS, 2 = ALLIES
            Keyword vehicleOwner = new Keyword("vehicle_team_owner", "",  "The owner of the vehicle.", false);
            KeywordInput vehicleOwnerInput = new KeywordInput(KeywordInputType.PredefinedList, "vehicle_team_owner", "1 = AXIS, 2 = ALLIES.");
            vehicleOwnerInput.AllowableValues.Add("1");;
            vehicleOwnerInput.AllowableValues.Add("2");;
            vehicleOwner.Inputs.Add(vehicleOwnerInput);
            _keywords.Add(vehicleOwner);

            _keywords.Sort(KeywordComparer.SortBy.Command);

            _textArea = textArea;
            _typedChar = charTyped;

            // see if a word on the line the input was in is a keyword that we have,
            // then figure out what input they are at
            LineSegment line = textArea.Document.GetLineSegmentForOffset(textArea.Caret.Offset);

            bool keywordFound = false;
            if (line != null)
            {
                TextWord first = GetWord(line, 1);

                if (first != null)
                {
                    Keyword keyword = _keywords.GetWord(first.Word);

                    if (keyword != null)
                    {
                        keywordFound = true;
                        if (keyword.Inputs.Count > 0)
                        {
                            for (int x = 0; x < keyword.Inputs.Count; x++)
                            {
                                TextWord param = GetWord(line, x + 2);

                                if (param == null)
                                {
                                    KeywordInput inputParam = (KeywordInput)keyword.Inputs[x];

                                    if (inputParam.InputType == KeywordInputType.PredefinedList)
                                    {
                                        ICompletionData[] data = new ICompletionData[inputParam.AllowableValues.Count];

                                        for (int y = 0; y < inputParam.AllowableValues.Count; y++)
                                        {
                                            Keyword dummyKeyword = new Keyword((string)inputParam.AllowableValues[y], (string)inputParam.AllowableValues[y], inputParam.HelpText, false);
                                            data[y] = new KeywordCompletionData(dummyKeyword);
                                        }

                                        return data;
                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (keywordFound)
            {
                return null;
            }

            // fall through, return all keywords
            ICompletionData[] all = new ICompletionData[_keywords.Count];

            for (int x = 0; x < _keywords.Count; x++)
            {
                all[x] = new KeywordCompletionData(_keywords[x]);
            }

            return all;
        }
示例#29
0
        private static Keyword GetBotSwitchToWeap()
        {
            Keyword keyword = new Keyword();

            keyword.Command = "bot_switchToWeap";
            keyword.FriendlyName = "Switch Weapons";
            keyword.HelpText = "Will cause all soldiers on the specified team to switch to the defined weapon.";

            KeywordInput weapon = new KeywordInput(KeywordInputType.PredefinedList, "Weapon", "The weapon to switch to.");
            weapon.AllowableValues.Add("FG42");
            weapon.AllowableValues.Add("flame");
            weapon.AllowableValues.Add("garand");
            weapon.AllowableValues.Add("k43");
            weapon.AllowableValues.Add("MG42");
            weapon.AllowableValues.Add("mortar");
            weapon.AllowableValues.Add("panzer");
            weapon.AllowableValues.Add("random");
            weapon.AllowableValues.Add("random_f");
            weapon.AllowableValues.Add("random_fp");
            weapon.AllowableValues.Add("random_p");
            weapon.AllowableValues.Add("random_pf");
            weapon.AllowableValues.Add("smg");
            weapon.AllowableValues.Add("sniper");
            weapon.AllowableValues.Add("venom");

            keyword.Inputs.Add(weapon);

            KeywordInput team = new KeywordInput(KeywordInputType.PredefinedList, "Team", "The team to switch weapons for");
            team.AllowableValues.Add("allies");
            team.AllowableValues.Add("axis");

            keyword.Inputs.Add(team);

            return keyword;
        }
        public ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
        {
            _keywords = KeywordFactory.GetKeywords();

            // the keyword factory just has the non-required words
            _keywords.Add(new Keyword("bot_SightDist", "", "How far the highest skill bot can see on this map", false));

            ArrayList allowable = new ArrayList();

            allowable.Add("0");
            allowable.Add("1");

            Keyword      flag      = new Keyword("spawnflag_is_priority", "", "Whether or no bots focus on spawnflags.", false);
            KeywordInput flagInput = new KeywordInput(KeywordInputType.PredefinedList, "spawnflag_is_priority", "Whether or no bots focus on spawnflags.");

            flagInput.AllowableValues = allowable;
            flag.Inputs.Add(flagInput);
            _keywords.Add(flag);

            Keyword      cmdpost      = new Keyword("cmdpost_is_priority", "", "Whether or not command posts critical on this map.", false);
            KeywordInput cmdpostInput = new KeywordInput(KeywordInputType.PredefinedList, "cmdpost_is_priority", "Whether or not command posts critical on this map.");

            cmdpostInput.AllowableValues = allowable;
            cmdpost.Inputs.Add(cmdpostInput);
            _keywords.Add(cmdpost);

            Keyword      construct      = new Keyword("construct_is_priority", "", "Whether or not engineers focus more on constructibles.", false);
            KeywordInput constructInput = new KeywordInput(KeywordInputType.PredefinedList, "construct_is_priority", "Whether or not engineers focus more on constructibles.");

            constructInput.AllowableValues = allowable;
            construct.Inputs.Add(constructInput);
            _keywords.Add(construct);

            Keyword      vehicle      = new Keyword("map_has_vehicle", "", "Whether or not this map has a tank or a train.", false);
            KeywordInput vehicleInput = new KeywordInput(KeywordInputType.PredefinedList, "map_has_vehicle", "Type of vehicle 0 = none, 1 = tank, 2 = train");

            ArrayList allowableVehicle = new ArrayList();

            allowable.Add("0");
            allowable.Add("1");
            allowable.Add("2");
            vehicleInput.AllowableValues = allowableVehicle;
            vehicle.Inputs.Add(vehicleInput);
            _keywords.Add(vehicle);

            //vehicle_entity_number 429 //the entity number of the tank
            Keyword vehicleEntity = new Keyword("vehicle_entity_number", "", "The entity number of the vehicle.", false);

            vehicleEntity.Inputs.Add(new KeywordInput(KeywordInputType.Action, "Vehicle Entity Number", "The entity number of the vehicle."));
            _keywords.Add(vehicleEntity);

            //vehicle_team_owner 2 //ALLIES own this tank! 1 = AXIS, 2 = ALLIES
            Keyword      vehicleOwner      = new Keyword("vehicle_team_owner", "", "The owner of the vehicle.", false);
            KeywordInput vehicleOwnerInput = new KeywordInput(KeywordInputType.PredefinedList, "vehicle_team_owner", "1 = AXIS, 2 = ALLIES.");

            vehicleOwnerInput.AllowableValues.Add("1");;
            vehicleOwnerInput.AllowableValues.Add("2");;
            vehicleOwner.Inputs.Add(vehicleOwnerInput);
            _keywords.Add(vehicleOwner);

            _keywords.Sort(KeywordComparer.SortBy.Command);

            _textArea  = textArea;
            _typedChar = charTyped;

            // see if a word on the line the input was in is a keyword that we have,
            // then figure out what input they are at
            LineSegment line = textArea.Document.GetLineSegmentForOffset(textArea.Caret.Offset);

            bool keywordFound = false;

            if (line != null)
            {
                TextWord first = GetWord(line, 1);

                if (first != null)
                {
                    Keyword keyword = _keywords.GetWord(first.Word);

                    if (keyword != null)
                    {
                        keywordFound = true;
                        if (keyword.Inputs.Count > 0)
                        {
                            for (int x = 0; x < keyword.Inputs.Count; x++)
                            {
                                TextWord param = GetWord(line, x + 2);

                                if (param == null)
                                {
                                    KeywordInput inputParam = (KeywordInput)keyword.Inputs[x];

                                    if (inputParam.InputType == KeywordInputType.PredefinedList)
                                    {
                                        ICompletionData[] data = new ICompletionData[inputParam.AllowableValues.Count];

                                        for (int y = 0; y < inputParam.AllowableValues.Count; y++)
                                        {
                                            Keyword dummyKeyword = new Keyword((string)inputParam.AllowableValues[y], (string)inputParam.AllowableValues[y], inputParam.HelpText, false);
                                            data[y] = new KeywordCompletionData(dummyKeyword);
                                        }

                                        return(data);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            if (keywordFound)
            {
                return(null);
            }

            // fall through, return all keywords
            ICompletionData[] all = new ICompletionData[_keywords.Count];

            for (int x = 0; x < _keywords.Count; x++)
            {
                all[x] = new KeywordCompletionData(_keywords[x]);
            }

            return(all);
        }
示例#31
0
        //crapshoot: openNodeGrpToTeam
        private static Keyword GetOpenNodeGrpToTeam()
        {
            Keyword keyword = new Keyword();

            keyword.Command = "openNodeGrpToTeam";
            keyword.FriendlyName = "Open Node Group";
            keyword.HelpText = "Used to open a group of nodes to a team";

            keyword.Inputs.Add(new KeywordInput(KeywordInputType.Group, "Node Group", "The Group ID of nodes to open."));

            KeywordInput input = new KeywordInput(KeywordInputType.PredefinedList, "Team", "The Team to open the nodes for.");
            input.AllowableValues.Add("axis");
            input.AllowableValues.Add("allies");
            keyword.Inputs.Add(input);

            return keyword;
        }