//一键按职业给予符合等级的全技能 private void button11_Click(object sender, EventArgs e) { DialogResult dr = MessageBox.Show("请确保游戏不处于运行状态!", "", MessageBoxButtons.OKCancel); if (dr != DialogResult.OK)//如果点击“确定”按钮 { return; } //获取所有猛将、豪杰、军师、方士 List <AccAttr> player_jobWarload = CPlayerCtrl.LoadAllWarloadIndexDesc(); List <AccAttr> player_jobLeader = CPlayerCtrl.LoadAllLeaderIndexDesc(); List <AccAttr> player_jobAdvisor = CPlayerCtrl.LoadAllAdvisorIndexDesc(); List <AccAttr> player_jobWizard = CPlayerCtrl.LoadAllWizardIndexDesc(); //构建按职业的List<int> skills List <Magic_JobLimit_Str> skill_jobWarload = CSkillCtrl.LoadAllWarloadSkillsDesc(); List <Magic_JobLimit_Str> skill_jobLeader = CSkillCtrl.LoadAllLeaderSkillsDesc(); List <Magic_JobLimit_Str> skill_jobAdvisor = CSkillCtrl.LoadAllAdvisorSkillsDesc(); List <Magic_JobLimit_Str> skill_jobWizard = CSkillCtrl.LoadAllWizardSkillsDesc(); CSkillCtrl.AddSubSkills(player_jobWarload, skill_jobWarload, true); CSkillCtrl.AddSubSkills(player_jobLeader, skill_jobLeader, true); CSkillCtrl.AddSubSkills(player_jobAdvisor, skill_jobAdvisor, true); CSkillCtrl.AddSubSkills(player_jobWizard, skill_jobWizard, true); CSkillCtrl.SaveSkillsData(txt_svrForder.Text + "\\DataBase\\saves\\skill.dat"); MessageBox.Show("DONE!"); }
private void button14_Click(object sender, EventArgs e) { if (!m_Active) { MessageBox.Show("软件尚未激活! 请联系软件发布人给予激活!"); return; } try { DialogResult dr = MessageBox.Show("请确保游戏不处于运行状态!", "", MessageBoxButtons.OKCancel); if (dr != DialogResult.OK)//如果点击“确定”按钮 { return; } if (cbx_skillsAll.Checked) { if (rdb_playersAll.Checked) { //增加 || 删除 if (rdb_skillAdd.Checked) { CSkillCtrl.AddAllPlayersAllSkills(); } else if (rdb_skillDel.Checked) { CSkillCtrl.ClearAllPlayersAllSkills(); } } else if (rdb_playersSub.Checked) { //players List <int> players = new List <int>(); if (txt_handleSkills.Text != "") { var tmp = txt_handlePlayers.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); foreach (var item in tmp) { string name = item.Split(';')[1]; AccAttr attr = CPlayerCtrl.GetAttrByName(name); players.Add((int)attr.nIndex); } } //增加 || 删除 if (rdb_skillAdd.Checked) { CSkillCtrl.AddPlayerAllSkills(players); } else if (rdb_skillDel.Checked) { CSkillCtrl.ClearPlayerAllSkills(players); } } } else { //skills List <int> skills = new List <int>(); if (txt_handleSkills.Text != "") { var tmp = txt_handleSkills.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); foreach (var item in tmp) { int skillid = int.Parse(item.Split(';')[0]); skills.Add(skillid); } } if (rdb_playersAll.Checked) { //增加 || 删除 if (rdb_skillAdd.Checked) { CSkillCtrl.AddAllPlayersSkills(skills); } else if (rdb_skillDel.Checked) { CSkillCtrl.ClearAllPlayersSkills(skills); } } else if (rdb_playersSub.Checked) { //players List <int> players = new List <int>(); if (txt_handleSkills.Text != "") { var tmp = txt_handlePlayers.Text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); foreach (var item in tmp) { string name = item.Split(';')[1]; AccAttr attr = CPlayerCtrl.GetAttrByName(name); players.Add((int)attr.nIndex); } } //增加 || 删除 if (rdb_skillAdd.Checked) { CSkillCtrl.AddSubSkills(players, skills); } else if (rdb_skillDel.Checked) { CSkillCtrl.ClearSubSkills(players, skills); } } } CSkillCtrl.SaveSkillsData(txt_svrForder.Text + "\\DataBase\\saves\\skill.dat"); MessageBox.Show("DONE!"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }