Esempio n. 1
0
        private void button_Update_Click(object sender, EventArgs e)
        {
            richTextBox_OutputView.Clear();

            if (textBox_XLOC.Text == String.Empty || textBox_YLOC.Text == String.Empty || textBox_ZLOC.Text == String.Empty || textBox_Speed.Text == String.Empty)
            {
                listView_Loaded_SelectedIndexChanged(sender, e);
            }
            else
            {
                DataStruct locData = dataLoc[rowNumber];
                locData.XLoc     = float.Parse(textBox_XLOC.Text);
                locData.YLoc     = float.Parse(textBox_YLOC.Text);
                locData.ZLoc     = float.Parse(textBox_ZLOC.Text);
                locData.Speed    = Convert.ToInt32(textBox_Speed.Text);
                locData.Delay    = Convert.ToInt32(textBox_Delay.Text);
                locData.Function = textBox_Function.Text;
                dataLoc.Insert(rowNumber, locData);
                dataLoc.RemoveAt(rowNumber + 1);

                ResetTextBoxes();
                ResetListView(true);
                ListviewLoad();
                richTextBox_OutputView.Text = "Updated Entry";
            }
        }
Esempio n. 2
0
        private void button_Reset_Click(object sender, EventArgs e)
        {
            richTextBox_OutputView.Clear();

            ResetTextBoxes();
            DataStruct locData = dataLoc[rowNumber];

            richTextBox_OutputView.Text = "Cleared Textboxes";
        }
Esempio n. 3
0
        private void button_Save_Click(object sender, EventArgs e)
        {
            richTextBox_OutputView.Clear();

            DateTime dateTime = DateTime.Now;

            List <string> checkfunctions = new List <string>();
            DataStruct    locData        = dataLoc[rowNumber];
            string        spawnName      = locData.Name + ".lua";
            StreamWriter  streamWriter   = new StreamWriter(spawnName);

            string script = "--[[\n\tScript Name\t\t:\t" + spawnName + "\n\tScript Purpose\t:\tWaypoint Path for " + spawnName + "\n\tScript Author\t:\t" +
                            locData.Author + "\n\tScript Date\t\t:\t" + dateTime.ToString("MM/dd/yyyy hh:mm:ss tt") + "\n\tScript Notes\t:\tLocations collected from Live\n--]]\n\n" +
                            "function spawn(NPC)\n\twaypoints(NPC)\nend\n\nfunction hailed(NPC, Spawn)\n\tFaceTarget(NPC, Spawn)\nend\n\nfunction respawn(NPC)\nend\n\n" +
                            "function waypoints(NPC)";

            streamWriter.WriteLine(script);

            for (int i = 0; i < dataLoc.Count; i++)
            {
                //rowNumber = i;
                locData = dataLoc[i];
                if (!String.IsNullOrEmpty(locData.Function.ToString()))
                {
                    string output = "	MovementLoopAddLocation(NPC, "+ locData.XLoc.ToString(CultureInfo.InvariantCulture) + ", " + locData.YLoc.ToString(CultureInfo.InvariantCulture) + ", " + locData.ZLoc.ToString(CultureInfo.InvariantCulture) + ", " +
                                    locData.Speed + ", " + locData.Delay + ", " +
                                    "\"" + locData.Function.ToString() + "\")";
                    streamWriter.WriteLine(output);
                }
                else
                {
                    string output = "	MovementLoopAddLocation(NPC, "+ locData.XLoc.ToString(CultureInfo.InvariantCulture) + ", " + locData.YLoc.ToString(CultureInfo.InvariantCulture) + ", " + locData.ZLoc.ToString(CultureInfo.InvariantCulture) + ", " +
                                    locData.Speed + ", " + locData.Delay + ")";
                    streamWriter.WriteLine(output);
                }
            }

            streamWriter.WriteLine("end\n\n");

            for (int i = 0; i < dataLoc.Count; i++)
            {
                //need to check for duplicates of the movement function
                locData = dataLoc[i];

                if (!String.IsNullOrEmpty(locData.Function.ToString()))
                {
                    string movementfunctions = "function " + locData.Function.ToString() + "(NPC)\n\t Say(NPC, " + "\"" + "This is the " + locData.Function.ToString() + " function\"" + ")\nend";
                    streamWriter.WriteLine(movementfunctions + "\n\n");
                }
            }

            streamWriter.Close();
            richTextBox_OutputView.Text = "Saved to " + spawnName + "";
        }
Esempio n. 4
0
        private void button_Remove_Click(object sender, EventArgs e)
        {
            richTextBox_OutputView.Clear();

            DataStruct locData = dataLoc[rowNumber];

            dataLoc.RemoveAt(rowNumber);

            ResetTextBoxes();
            ResetListView(true);
            ListviewLoad();
            richTextBox_OutputView.Text = "Removed Selected Entry";
        }
Esempio n. 5
0
        private void button_InsertBelow_Click(object sender, EventArgs e)
        {
            richTextBox_OutputView.Clear();

            if (listView_Loaded.SelectedIndices.Count == 0 || listView_Loaded.SelectedIndices[0] == -1)
            {
                MessageBox.Show("You must select something from the list first", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (textBox_XLOC.Text == String.Empty || textBox_YLOC.Text == String.Empty || textBox_ZLOC.Text == String.Empty)
            {
                MessageBox.Show("You are missing either X, Y, or Z coordinates", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (string.IsNullOrEmpty(textBox_Speed.Text))
            {
                textBox_Speed.Text = "2";
            }
            if (string.IsNullOrEmpty(textBox_Delay.Text))
            {
                textBox_Delay.Text = "0";
            }
            DataStruct locData = dataLoc[rowNumber];

            locData.XLoc     = float.Parse(textBox_XLOC.Text);
            locData.YLoc     = float.Parse(textBox_YLOC.Text);
            locData.ZLoc     = float.Parse(textBox_ZLOC.Text);
            locData.Speed    = Convert.ToInt32(textBox_Speed.Text);
            locData.Delay    = Convert.ToInt32(textBox_Delay.Text);
            locData.Function = textBox_Function.Text;
            dataLoc.Insert(rowNumber + 1, locData);

            ResetTextBoxes();
            ResetListView(true);
            ListviewLoad();
            richTextBox_OutputView.Text = "Inserted New Entry";
        }
Esempio n. 6
0
        private void checkBox_ReversePath_CheckedChanged(object sender, EventArgs e)
        {
            int rowCount = dataLoc.Count;
            // Throws an error here if the checkbox has been unchecked and checked a second time
            DataStruct locData  = dataLoc[rowNumber];
            bool       firstRun = true;

            // Reverse the path
            if (checkBox_ReversePath.Checked)
            {
                rowNumber = rowCount - 1;
                while (rowCount > 0)
                {
                    if (firstRun == true)
                    {
                        rowCount = (rowCount - 2);

                        firstRun = false;
                    }
                    else
                    {
                        rowCount--;
                    }

                    locData = dataLoc[rowCount];
                    float  tmpXLoc     = locData.XLoc;
                    float  tmpYLoc     = locData.YLoc;
                    float  tmpZLoc     = locData.ZLoc;
                    int    tmpSpeed    = locData.Speed;
                    int    tmpDelay    = locData.Delay;
                    string tmpFunction = locData.Function;

                    locData.XLoc     = tmpXLoc;
                    locData.YLoc     = tmpYLoc;
                    locData.ZLoc     = tmpZLoc;
                    locData.Speed    = tmpSpeed;
                    locData.Delay    = tmpDelay;
                    locData.Function = tmpFunction;
                    dataLoc.Add(locData);
                }

                ResetListView(true);
                ResetTextBoxes();
                richTextBox_OutputView.Clear();
                richTextBox_OutputView.Text = "The waypoints have been reverse, added to the current list of waypoints, and the spawn path will now loop";
                ListviewLoad();
            }
            else
            {
                // Revert Changes if checkbox is unchecked
                int revertrowcount = rowCount / 2;
                int count          = 0;

                while (count < revertrowcount)
                {
                    count++;
                    dataLoc.RemoveAt(rowNumber);
                    rowNumber--;
                }
                ResetListView(true);
                ResetTextBoxes();
                richTextBox_OutputView.Clear();
                ListviewLoad();
            }
        }