private void ParseGossipOptionData(GossipMenuOption GossipMenu) { _tbGossipMenuID.Text = GossipMenu.menu_id.ToString(); _tbGossipID.Text = GossipMenu.id.ToString(); _tbGossipOptionText.Text = GossipMenu.option_text; _tbGossipNpcMenu.Text = GossipMenu.npc_menu_id.ToString(); _tbGossipPOI_id.Text = GossipMenu.action_poi_id.ToString(); _tbGossipAction.Text = GossipMenu.action_script_id.ToString(); _tbGossipBoxCoded.Text = GossipMenu.box_coded.ToString(); _tbGossipBoxMoney.Text = GossipMenu.box_money.ToString(); _tbGossipBoxText.Text = GossipMenu.box_text; _cbGossipOptionIcon.SelectedValue = GossipMenu.option_icon; _cbGossipOptionID.SelectedValue = GossipMenu.option_id; _cbGossipOptionNpcFlag.SelectedValue = GossipMenu.npc_option_npcflag; _cbGossipOptionCondtion_1.SelectedValue = GossipMenu.cond[0]; _cbOptionCondtion1Value_1.SetValue(GossipMenu.cond_val[0, 0]); _cbOptionCondtion1Value_2.SetValue(GossipMenu.cond_val[0, 1]); _cbGossipOptionCondtion_2.SelectedValue = GossipMenu.cond[1]; _cbOptionCondtion2Value_1.SetValue(GossipMenu.cond_val[1, 0]); _cbOptionCondtion2Value_2.SetValue(GossipMenu.cond_val[1, 1]); _cbGossipOptionCondtion_3.SelectedValue = GossipMenu.cond[2]; _cbOptionCondtion3Value_1.SetValue(GossipMenu.cond_val[2, 0]); _cbOptionCondtion3Value_2.SetValue(GossipMenu.cond_val[2, 1]); }
private void _bGossipOptionCreate_Click(object sender, EventArgs e) { rtbGossipOptionMenuOut.Clear(); rtbGossipOptionMenuOut.ForeColor = Color.Blue; GossipMenuOption gossip = new GossipMenuOption(); gossip.menu_id = _tbGossipMenuID.Text.ToInt32(); gossip.id = _tbGossipID.Text.ToInt32(); gossip.option_text = _tbGossipOptionText.Text; gossip.npc_menu_id = _tbGossipNpcMenu.Text.ToInt32(); gossip.action_poi_id = _tbGossipPOI_id.Text.ToInt32(); gossip.action_script_id = _tbGossipAction.Text.ToInt32(); gossip.box_coded = _tbGossipBoxCoded.Text.ToInt32(); gossip.box_money = _tbGossipBoxMoney.Text.ToInt32(); gossip.box_text = _tbGossipBoxText.Text; gossip.option_icon = _cbGossipOptionIcon.GetIntValue(); gossip.option_id = _cbGossipOptionID.GetIntValue(); gossip.npc_option_npcflag = _cbGossipOptionNpcFlag.GetIntValue(); gossip.cond[0] = _cbGossipOptionCondtion_1.GetIntValue(); gossip.cond_val[0, 0] = _cbGossipOptionCondtion_1.GetIntValue(); gossip.cond_val[0, 1] = _cbOptionCondtion1Value_2.GetIntValue(); gossip.cond[1] = _cbGossipOptionCondtion_2.GetIntValue(); gossip.cond_val[1, 0] = _cbOptionCondtion2Value_1.GetIntValue(); gossip.cond_val[1, 1] = _cbOptionCondtion2Value_2.GetIntValue(); gossip.cond[2] = _cbGossipOptionCondtion_3.GetIntValue(); gossip.cond_val[2, 0] = _cbOptionCondtion3Value_1.GetIntValue(); gossip.cond_val[2, 1] = _cbOptionCondtion3Value_2.GetIntValue(); StringBuilder sb = new StringBuilder(); sb.AppendFormatLine("DELETE FROM `gossip_menu_option` WHERE `entry`='{0}' AND `id`='{1}';", gossip.menu_id, gossip.id); sb.AppendFormatLine("INSERT INTO `gossip_menu_option` VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}'," + "'{9}', '{10}', '{11}', '{12}', '{13}', '{15}', '{16}', '{17}', '{18}', '{19}', '{20}');" , gossip.menu_id, gossip.id, gossip.option_icon, gossip.option_text.RemExc(), gossip.option_id, gossip.npc_option_npcflag, gossip.npc_menu_id , gossip.action_poi_id, gossip.action_script_id, gossip.box_coded, gossip.box_money, gossip.box_text, gossip.cond[0], gossip.cond_val[0, 0] , gossip.cond_val[0, 1], gossip.cond[1], gossip.cond_val[1, 0], gossip.cond_val[1, 1], gossip.cond[2], gossip.cond_val[2, 0], gossip.cond_val[2, 1]); rtbGossipOptionMenuOut.Text = sb.ToString(); }
public static void SelectGossipOption(int MenuID) { if (!IsConnected) { System.Windows.Forms.MessageBox.Show("No connection to database, please check settings", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string query; if (MenuID > 0) { query = "SELECT * FROM gossip_menu_option WHERE menu_id=" + MenuID; } else { query = "SELECT * FROM gossip_menu_option"; } using (_conn = new MySqlConnection(ConnectionString)) { _command = new MySqlCommand(query, _conn); _conn.Open(); _GossipMenuOption.Clear(); using (var reader = _command.ExecuteReader()) { while (reader.Read()) { GossipMenuOption GossipOption = new GossipMenuOption(); GossipOption.menu_id = reader[0].ToInt32(); GossipOption.id = reader[1].ToInt32(); GossipOption.option_icon = reader[2].ToInt32(); GossipOption.option_text = reader[3].ToString(); GossipOption.option_id = reader[4].ToInt32(); GossipOption.npc_option_npcflag = reader[5].ToInt32(); GossipOption.npc_menu_id = reader[6].ToInt32(); GossipOption.action_poi_id = reader[7].ToInt32(); GossipOption.action_script_id = reader[8].ToInt32(); GossipOption.box_coded = reader[9].ToInt32(); GossipOption.box_money = reader[10].ToInt32(); GossipOption.box_text = reader[11].ToString(); GossipOption.cond[0] = reader[12].ToInt32(); GossipOption.cond_val[0, 0] = reader[13].ToInt32(); GossipOption.cond_val[0, 1] = reader[14].ToInt32(); GossipOption.cond[1] = reader[15].ToInt32(); GossipOption.cond_val[1, 0] = reader[16].ToInt32(); GossipOption.cond_val[1, 1] = reader[17].ToInt32(); GossipOption.cond[2] = reader[18].ToInt32(); GossipOption.cond_val[2, 0] = reader[19].ToInt32(); GossipOption.cond_val[2, 1] = reader[20].ToInt32(); _GossipMenuOption.Add(GossipOption); } } _conn.Close(); } }