Example #1
0
        //キャラクターアーカイブスからキャラクターデータを読込
        public Searcher charaArchiveHTMLRead(string m_URL)
        {
            var searcher = new Searcher();
            var wc       = new WebClient();

            var defaultSkillList = Proccess.GetSkillSet();

            searcher.SetDefaultSkills(defaultSkillList);

            try
            {
                wc.Encoding = System.Text.Encoding.UTF8;
                string html = wc.DownloadString(m_URL); //指定URLのHTMLデータを取得
                                                        // HtmlParserクラスをインスタンス化
                searcher = ImportCharacterByAngleSharp(html, searcher);
            }
            catch (WebException exc)
            {
                Console.WriteLine(exc.Message);
            }
            catch (NullReferenceException exc)
            {
                Console.WriteLine(exc.Message);
            }
            searcher.CheckUnique(); //技能値が初期値かそうでないか判定をする
            return(searcher);
        }
Example #2
0
        private void パレマス形式ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            chpLoad m_d;

            m_d = JSONLoad();
            if (m_d.f)
            {
                PalletMaster.Searcher = new Searcher();
                PalletMaster.Searcher.SetSearcher(m_d.d);

                PalletMaster.AbilityDataSet();

                sanControl.SetSanText(PalletMaster.Searcher.characterInfos.SAN.ToString());             //SAN情報の入力
                fightControl.SetFightText(PalletMaster.Searcher.characterInfos.HP.ToString());          //HP情報の入力
                fightControl.SetFightDamageBonusText(PalletMaster.Searcher.characterInfos.damageBonus); //HP情報の入力

                PalletMaster.Searcher.CheckUnique();
                PalletMaster.RefreshListView();
            }

            var defaultSkillList = Proccess.GetSkillSet();

            PalletMaster.Searcher.SetDefaultSkills(defaultSkillList);

            if (PalletMaster.Setting.charaNameToUserNameFlg)
            {
                PalletMaster.Setting.userName = PalletMaster.Searcher.characterInfos.characterName;
            }
        }
Example #3
0
        public MinimumForm(PalletMaster palletMaster)
        {
            PalletMaster = palletMaster;
            InitializeComponent();

            TopMost = true;
            Proccess.RefreshSkillList(listViewSkill, PalletMaster.Searcher.skills.FindAll(s => s.unique));
        }
Example #4
0
        public NewCharacter()
        {
            Searcher = new Searcher();
            Searcher.SetDefaultSkills(Proccess.GetSkillSet());

            Searcher.skills = Proccess.GetSkillSet();
            Searcher.skills.ForEach(_ => _.defaultValue = _.value);
        }
Example #5
0
 private void refreshSkillListView()
 {
     Proccess.RefreshSkillListNewChara(listViewFightSkill,
                                       newCharacter.Searcher.skills.Where(item => item.type == "戦闘").ToList <Skill>());
     Proccess.RefreshSkillListNewChara(listViewSearchSkill,
                                       newCharacter.Searcher.skills.Where(item => item.type == "探索").ToList <Skill>());
     Proccess.RefreshSkillListNewChara(listViewActSkill,
                                       newCharacter.Searcher.skills.Where(item => item.type == "行動").ToList <Skill>());
     Proccess.RefreshSkillListNewChara(listViewNegosiateSkill,
                                       newCharacter.Searcher.skills.Where(item => item.type == "交渉").ToList <Skill>());
     Proccess.RefreshSkillListNewChara(listViewWisdomSkill,
                                       newCharacter.Searcher.skills.Where(item => item.type == "知識").ToList <Skill>());
 }
Example #6
0
        private void attack_Click(object sender, EventArgs e)
        {
            try
            {
                var damageText = FightDamage.fightSkillDamage[attackSkill] + damageBonusTextBox.Text;

                MessageBox.Show("攻撃値:" + Proccess.TotalDice(damageText).Sum(), "攻撃値",
                                MessageBoxButtons.OK);
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc.Message);
            }
        }
Example #7
0
        public ChpSearcher ChpDataImport()
        {
            chpLoad m_d;

            m_d = ImportChpFromJSON();
            if (!m_d.f)
            {
                return(new ChpSearcher());
            }

            var defaultSkillList = Proccess.ReadCSVToDictionary(System.AppDomain.CurrentDomain.BaseDirectory + "defaultSkill.csv");

            return(SetSearcher(m_d.d).SetDefaultSkills(defaultSkillList));
        }
Example #8
0
 public void RefreshSkillList(string mode = "ユニーク")
 {
     if (mode == "ユニーク")
     {
         Proccess.RefreshSkillList(listViewSkill, PalletMaster.Searcher.skills.FindAll(s => s.unique));
     }
     else if (mode == "全て")
     {
         Proccess.RefreshSkillList(listViewSkill, PalletMaster.Searcher.skills);
     }
     else
     {
         Proccess.RefreshSkillList(listViewSkill, PalletMaster.Searcher.skills.FindAll(s => s.type == mode));
     }
 }
Example #9
0
        //「読込」を押したときの制御
        private void buttonRead_Click(object sender, EventArgs e)
        {
            var            al       = new List <string>();
            OpenFileDialog ofDialog = new OpenFileDialog();

            //ダイアログのタイトルを指定する
            ofDialog.Title = "CSVファイル読み込み";

            //ダイアログを表示する
            if (ofDialog.ShowDialog() == DialogResult.OK)
            {
                var skills = Proccess.ReadCSVToDictionary(ofDialog.FileName);
                foreach (var kvp in skills)
                {
                    PalletMaster.Searcher.SetSkill(new Skill(kvp.Key, int.Parse(kvp.Value)));
                }
            }
            PalletMaster.RefreshListView();
        }
Example #10
0
            public Searcher ConversionToSearcher()
            {
                if (this == null)
                {
                    return(new Searcher());
                }

                Searcher searcher = new Searcher();

                searcher.SetDefaultSkills(Proccess.GetSkillSet());
                searcher = ReplacementSkills(uniqueSkills, searcher, "");
                searcher = ReplacementSkills(fightSkills, searcher, "戦闘");

                searcher.abilityValues.setCHP(abilityValues);
                searcher.characterInfos.setCHP(searcherInfos);
                searcher.backgroundString = backgroundString;
                searcher.CheckUnique();

                return(searcher);
            }
Example #11
0
 internal void SetTextRole(string text, string skill)
 {
     if (Setting.offlineMode)
     {
         new Proccess().ShowResultDialog(text, skill);
     }
     else if (Setting.useBCDiceAPIFlg)
     {
         new Proccess().SendPostWebhookBCDiceAPI(text,
                                                 Setting.webhookURL, Setting.bcdiceAPIURL, Setting.userName, skill);
     }
     else if (Setting.useWebhookFlg)
     {
         _ = new Proccess().SendPostWebhookAsync(text + " " + Setting.userName,
                                                 Setting.webhookURL, Setting.userName);
     }
     else
     {
         SetClipBoard(text);
     }
 }
Example #12
0
        private async Task bcDiceAccess(string url)
        {
            //BCDice-APIにGET通信してダイスを振る
            var result = Proccess.SendGetBCDice_API(textResult.Text,
                                                    PalletMaster.Setting.bcdiceAPIURL);

            using (var hc = new HttpClient()) {
                var json = JsonConvert.SerializeObject(new
                {
                    username = PalletMaster.Setting.userName,
                    content  = textResult.Text.Length == 0 ?
                               DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") :
                               textResult.Text,
                });

                //var content = new StringContent(json, Encoding.UTF8, "application/json");
                //var res = hc.PostAsync(url, content).Result;
                HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, url);
                request.Content = new System.Net.Http.StringContent(json, Encoding.UTF8, "application/json");
                var res = await hc.SendAsync(request);
            }
        }
Example #13
0
 public void RefreshSkillList()
 {
     Proccess.RefreshSkillList(listViewFight, PalletMaster.Searcher.skills.FindAll(s => s.type == "戦闘"));
 }
Example #14
0
        public MainForm(Searcher d)
        {
            InitializeComponent(); //フォームの初期化
            PalletMaster = new PalletMaster
            {
                //設定の読込と初期設定
                Setting = IOHelper.toLoadSetting()
            };

            var templeteTextSelected = PalletMaster.Setting.useBCDiceAPIFlg ||
                                       PalletMaster.Setting.offlineMode;

            skillControl.SetButtonTempleteUserCopyName
            (
                templeteTextSelected ?
                "ダイス" :
                "コピー"
            );
            if (PalletMaster.Setting.useDiceBotFlg == 0)
            {
                toChangeBCDice();
            }
            else
            {
                toChageSidekick();
            }

            var defaultSkills = Proccess.GetSkillSet();

            PalletMaster.Searcher.SetDefaultSkills(defaultSkills);

            historyAbilityControl.SelectedIndexListBoxAbility(0);
            historyAbilityControl.SelectedIndexListBoxValue(4);

            //フォームを最前面に表示するか否かをセット
            TopMost = PalletMaster.Setting.checkTopMostFlg;

            //PalletMasterのコンストラクタにMainFormを割り当てる
            //PalletMasterからMainFormの関数を叩けるようにする
            PalletMaster.SetMainForm(this);

            //skillControlを技能タブに割り当てる
            skillControl.SetPalletMaster(PalletMaster);
            setTab(skillControl, tabPageSkill);

            //SANControlを技能タブに割り当てる
            sanControl.SetPalletMaster(PalletMaster);
            setTab(sanControl, tabPageSAN);

            //FightControlを技能タブに割り当てる
            fightControl.SetPalletMaster(PalletMaster);
            setTab(fightControl, tabPageFight);

            //HistoryAbibilityControlを技能タブに割り当てる
            historyAbilityControl.SetPalletMaster(PalletMaster);
            setTab(historyAbilityControl, tabHistoryAblityRole);

            //MemoControlを技能タブに割り当てる
            memoControl.SetMainForm(PalletMaster);
            setTab(memoControl, tabPageMemo);

            formFontChange(PalletMaster.Setting.font, PalletMaster.Setting.fontSize);
        }
Example #15
0
        //能力値を決めるダイスロール
        private void diceButton_Click(object sender, EventArgs e)
        {
            //ダイスロール
            textSTR.Text = ConvertStringFromInt(newCharacter.Searcher.abilityValues.STR = Proccess.DDice("3d6").Sum());
            textAPP.Text = ConvertStringFromInt(newCharacter.Searcher.abilityValues.APP = Proccess.DDice("3d6").Sum());
            textCON.Text = ConvertStringFromInt(newCharacter.Searcher.abilityValues.CON = Proccess.DDice("3d6").Sum());
            textDEX.Text = ConvertStringFromInt(newCharacter.Searcher.abilityValues.DEX = Proccess.DDice("3d6").Sum());
            textEDU.Text = ConvertStringFromInt(newCharacter.Searcher.abilityValues.EDU = Proccess.TotalDice("3d6+3").Sum());
            textINT.Text = ConvertStringFromInt(newCharacter.Searcher.abilityValues.INT = Proccess.TotalDice("2d6+6").Sum());
            textPOW.Text = ConvertStringFromInt(newCharacter.Searcher.abilityValues.POW = Proccess.DDice("3d6").Sum());
            textSIZ.Text = ConvertStringFromInt(newCharacter.Searcher.abilityValues.SIZ = Proccess.TotalDice("2d6+6").Sum());

            //検索して能力値に基づいた値に更新
            newCharacter.Searcher.skills.Where(item => item.name == "回避").ToList().ForEach(item => item.value  = int.Parse(textDEX.Text) * 2);
            newCharacter.Searcher.skills.Where(item => item.name == "言語").ToList().ForEach(item => item.value  = int.Parse(textEDU.Text) * 1);
            newCharacter.Searcher.skills.Where(item => item.name == "母国語").ToList().ForEach(item => item.value = int.Parse(textEDU.Text) * 5);

            //能力値によって決まる各値を代入
            workMaxPoint.Text     = (int.Parse(textEDU.Text) * 20).ToString(); //職業ポイントの割り当て最大値
            interestMaxPoint.Text = (int.Parse(textINT.Text) * 10).ToString(); //興味ポイントの割り当て最大値

            labelHP.Text = ((int.Parse(textCON.Text) + int.Parse(textSIZ.Text)) / 2).ToString();
            labelMP.Text = textPOW.Text;

            newCharacter.Searcher = PalletMaster.AbilityDataSet(newCharacter.Searcher);

            refreshSkillListView();
        }
Example #16
0
        //キャラクター保管所のtxtデータをキャラクターデータに成形
        public Searcher toChangeTxtToData(List <string> al)
        {
            var searcher = new Searcher();

            searcher.SetDefaultSkills(Proccess.GetSkillSet());

            char[] del       = { '-', '-', '《', '》', ':', '/', ' ', '%', ' ', '●' };
            string importFlg = "base";

            foreach (string charaLine in al)
            {
                string[] arr = charaLine.Split(del, StringSplitOptions.RemoveEmptyEntries);
                if (arr.Length == 0)
                {
                    continue;
                }

                switch (arr[0])
                {
                //戦闘系技能のインポート
                case "■技能■":
                    importFlg = "fightSkill";
                    break;

                case "探索系技能":
                    importFlg = "sarchSkill";
                    break;

                case "行動系技能":
                    importFlg = "actSkill";
                    break;

                case "交渉系技能":
                    importFlg = "negotiationSkill";
                    break;

                case "知識系技能":
                    importFlg = "wisdomSkill";
                    break;

                case "■戦闘■":
                    importFlg = "fight";
                    break;
                }
                try
                {
                    if (arr[0].IsAny("職業", "年齢", "出身", "髪の色", "身長", "体重", "STR", "作成時", "成長等", "他修正", "習得", "名称"))
                    {
                        continue;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    continue;
                }

                switch (importFlg)
                {
                case "base":
                    //能力値のインポート

                    if (arr[0] == "=合計=")
                    {
                        int num;
                        searcher.abilityValues.STR = int.TryParse(arr[1], out num) ? num : 0;
                        searcher.abilityValues.CON = int.TryParse(arr[2], out num) ? num : 0;
                        searcher.abilityValues.POW = int.TryParse(arr[3], out num) ? num : 0;
                        searcher.abilityValues.DEX = int.TryParse(arr[4], out num) ? num : 0;
                        searcher.abilityValues.APP = int.TryParse(arr[5], out num) ? num : 0;
                        searcher.abilityValues.SIZ = int.TryParse(arr[6], out num) ? num : 0;
                        searcher.abilityValues.INT = int.TryParse(arr[7], out num) ? num : 0;
                        searcher.abilityValues.EDU = int.TryParse(arr[8], out num) ? num : 0;
                        searcher.characterInfos.HP = int.TryParse(arr[9], out num) ? num : 0;
                        searcher.characterInfos.MP = int.TryParse(arr[10], out num) ? num : 0;
                    }

                    else
                    {
                        //探索者情報のインポート
                        try
                        {
                            searcher.characterInfos.setParameter(arr[0], arr[1]);
                        }
                        catch (Exception exc)
                        {
                            Console.WriteLine(exc.Message);
                        }
                    }

                    break;


                case "fightSkill":
                    //探索者情報のインポート
                    try
                    {
                        for (int i = 0; i <= arr.Length; i += 2)
                        {
                            var value = int.TryParse(arr[i + 1], out var x) ? x : -1;
                            if (value != -1)
                            {
                                AddSkillSearcher(arr[i], value, "戦闘", searcher);
                            }
                        }
                    }
                    catch (Exception exc)
                    {
                        Console.WriteLine(exc.Message);
                    }
                    break;

                case "actSkill":
                    if (arr.Length % 2 != 0)
                    {
                        break;
                    }
                    for (int i = 0; i < arr.Length; i += 2)
                    {
                        var value = int.TryParse(arr[i + 1], out var x) ? x : -1;
                        if (value != -1)
                        {
                            AddSkillSearcher(arr[i], value, "行動", searcher);
                        }
                    }
                    break;

                case "sarchSkill":
                    if (arr.Length % 2 != 0)
                    {
                        break;
                    }
                    //探索者情報のインポート
                    for (int i = 0; i < arr.Length; i += 2)
                    {
                        var value = int.TryParse(arr[i + 1], out var x) ? x : -1;
                        if (value != -1)
                        {
                            AddSkillSearcher(arr[i], value, "探索", searcher);
                        }
                    }
                    break;

                case "negotiationSkill":
                    if (arr.Length % 2 != 0)
                    {
                        break;
                    }
                    //探索者情報のインポート
                    for (int i = 0; i < arr.Length; i += 2)
                    {
                        var value = int.TryParse(arr[i + 1], out var x) ? x : -1;
                        if (value != -1)
                        {
                            AddSkillSearcher(arr[i], value, "交渉", searcher);
                        }
                    }
                    break;

                case "wisdomSkill":
                    if (arr.Length % 2 != 0)
                    {
                        break;
                    }
                    //探索者情報のインポート
                    for (int i = 0; i < arr.Length; i += 2)
                    {
                        var value = int.TryParse(arr[i + 1], out var x) ? x : -1;
                        if (value != -1)
                        {
                            AddSkillSearcher(arr[i], value, "知識", searcher);
                        }
                    }
                    break;

                case "fight":
                    if (arr[0] == "ダメージボーナス")
                    {
                        searcher.characterInfos.setParameter(arr[0], arr[1]);
                    }
                    break;
                }
            }

            return(searcher);
        }