Exemplo n.º 1
0
        private void button_delete_Click(object sender, EventArgs e)
        {
            if (Datastores.dbused)
            {
                switch (MessageBox.Show("Are you sure you want to delete the selected text from the database?", "Remove from database?", MessageBoxButtons.YesNoCancel))
                {
                case DialogResult.Yes:
                    string       query = SQLcreator.CreateDeleteQuery(localized_texts.map[text_id], "");
                    MySqlCommand c     = new MySqlCommand(query, SQLConnection.conn);
                    try
                    {
                        c.ExecuteNonQuery();
                        localized_texts.map.Remove(text_id);
                        UpdateListBox(false);
                        if (customlistBoxtexts.Items.Count != 0)
                        {
                            customlistBoxtexts.SelectedIndex = 0;
                        }
                        else
                        {
                            customlistBoxtexts.SelectedIndex = -1;
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    break;

                case DialogResult.No:
                    localized_texts.map.Remove(text_id);
                    UpdateListBox(false);
                    if (customlistBoxtexts.Items.Count != 0)
                    {
                        customlistBoxtexts.SelectedIndex = 0;
                    }
                    else
                    {
                        customlistBoxtexts.SelectedIndex = -1;
                    }
                    break;

                case DialogResult.Cancel:
                    break;
                }
            }
            else
            {
                localized_texts.map.Remove(text_id);
                UpdateListBox(false);
                if (customlistBoxtexts.Items.Count != 0)
                {
                    customlistBoxtexts.SelectedIndex = 0;
                }
                else
                {
                    customlistBoxtexts.SelectedIndex = -1;
                }
            }
        }
Exemplo n.º 2
0
        public static string PrintCreatureToWindow(uint creature_id)
        {
            string value = "";

            value = SQLcreator.WriteCreatureToWindow(npcList[creature_id]);
            return(value);
        }
Exemplo n.º 3
0
        public static string PrintScriptToWindow(uint id, string table)
        {
            string value = "";

            value = SQLcreator.WriteScriptToWindow(scriptList[id], table);
            return(value);
        }
Exemplo n.º 4
0
 public static bool PrintALLCreaturesToFile(string file)
 {
     foreach (KeyValuePair <uint, creature> item in npcList)
     {
         SQLcreator.WriteCreatureToFile(item.Value, file, true);
     }
     return(true);
 }
Exemplo n.º 5
0
        public static string PrintToQueryWindow(uint script_id)
        {
            string value = "";

            value = SQLcreator.WriteSummonToWindow(map[script_id]);

            return(value);
        }
Exemplo n.º 6
0
 public static bool PrintALLScriptsToFile(string file, string table)
 {
     foreach (KeyValuePair <uint, db_script> item in scriptList)
     {
         SQLcreator.WriteScriptToFile(item.Value, file, true, table);
     }
     return(true);
 }
Exemplo n.º 7
0
        public static string PrintToQueryWindow(int script_id)
        {
            string value = "";

            value = SQLcreator.WriteLocalizedTextToWindow(map[script_id]);

            return(value);
        }
Exemplo n.º 8
0
        public static bool PrintALLSummonsToFile(string file)
        {
            foreach (KeyValuePair <uint, summon> item in map)
            {
                SQLcreator.WriteSummonToFile(item.Value, file, true);
            }

            return(true);
        }
Exemplo n.º 9
0
        public static bool PrintALLLocalsToFile(string file)
        {
            foreach (KeyValuePair <int, localized_text> item in map)
            {
                SQLcreator.WriteLocalizedTextToFile(item.Value, file, true);
            }

            return(true);
        }
Exemplo n.º 10
0
        private void testToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (Datastores.dbused && (npclistbox.SelectedIndex != -1))
            {
                switch (MessageBox.Show("Do you want to Remove it from Database Now? (Executing delete Query", "Remove from Database?", MessageBoxButtons.YesNoCancel))
                {
                case DialogResult.Yes:
                    string       query = SQLcreator.CreateDeleteQuery(creatures.GetCreature(System.Convert.ToUInt32(this.npclistbox.Items[npclistbox.SelectedIndex])), "");
                    MySqlCommand c     = new MySqlCommand(query, SQLConnection.conn);
                    try
                    {
                        if (npclistbox.SelectedIndex != -1)
                        {
                            foreach (Form item in MdiChildren)
                            {
                                if (item is NPCEditor)
                                {
                                    if ((item as NPCEditor).Id == System.Convert.ToInt32(this.npclistbox.Items[npclistbox.SelectedIndex]))
                                    {
                                        (item as NPCEditor).Close();
                                    }
                                }
                            }
                            c.ExecuteNonQuery();
                            creatures.DelCreature(System.Convert.ToUInt32(this.npclistbox.Items[npclistbox.SelectedIndex]));
                            UpdateNPCListBox();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    break;

                case DialogResult.No:
                    if (npclistbox.SelectedIndex != -1)
                    {
                        foreach (Form item in MdiChildren)
                        {
                            if (item is NPCEditor)
                            {
                                if ((item as NPCEditor).Id == System.Convert.ToInt32(this.npclistbox.Items[npclistbox.SelectedIndex]))
                                {
                                    (item as NPCEditor).Close();
                                }
                            }
                        }

                        creatures.DelCreature(System.Convert.ToUInt32(this.npclistbox.Items[npclistbox.SelectedIndex]));
                        UpdateNPCListBox();
                    }
                    break;

                case DialogResult.Cancel:
                    break;
                }
            }
            else
            {
                if (npclistbox.SelectedIndex != -1)
                {
                    //foreach (Form item in MdiChildren)
                    //{
                    //    if (item is NPCEditor)
                    //    {
                    //        if ((item as NPCEditor).npc_id == System.Convert.ToInt32(this.npclistbox.Items[npcofflistbox.SelectedIndex]))
                    //        {
                    //            (item as NPCEditor).Close();
                    //        }
                    //    }
                    //}

                    //creatures.DelCreature(System.Convert.ToUInt32(this.npclistbox.Items[npcofflistbox.SelectedIndex]));
                    //UpdateNPCListBox(false);
                }
            }
        }
Exemplo n.º 11
0
 public static bool PrintCreatureToFile(uint creature_id, string file)
 {
     SQLcreator.WriteCreatureToFile(npcList[creature_id], file, false);
     return(true);
 }
Exemplo n.º 12
0
 public static bool PrintSummonToFile(uint creature_id, string file)
 {
     SQLcreator.WriteSummonToFile(map[creature_id], file, false);
     return(true);
 }
Exemplo n.º 13
0
 public static bool PrintScriptToFile(uint id, string file, string table)
 {
     SQLcreator.WriteScriptToFile(scriptList[id], file, false, table);
     return(true);
 }
Exemplo n.º 14
0
 public static bool PrintLocalToFile(int creature_id, string file)
 {
     SQLcreator.WriteLocalizedTextToFile(map[creature_id], file, false);
     return(true);
 }