Beispiel #1
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);
        }
Beispiel #2
0
 public PalletMaster()
 {
     Setting        = new Setting();
     Searcher       = new Searcher();
     ActionHistorys = new List <ActionHistory>();
 }
Beispiel #3
0
        private Searcher ImportCharacterByAngleSharp(string html, Searcher searcher)
        {
            var parser = new HtmlParser();

            // HtmlParserクラスのParserメソッドを使用してパースする。
            // Parserメソッドの戻り値の型はIHtmlDocument
            var doc = parser.ParseDocument(html);

            string[] dt;
            //キャラネームの取得
            var name = doc.QuerySelector("h1").TextContent.Trim();

            char[] removeChars = new char[] { ' ', ' ' };
            string m_buff      = removeChars.Aggregate(name, (s, c) => s.Replace(c.ToString(), ""));

            dt = m_buff.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);

            searcher.characterInfos.characterName = dt[0];

            //キャラ能力値の取得
            var status = doc.QuerySelectorAll("tr[id = status_total] td");

            var charaStatus = new List <String>();

            foreach (var row in status)
            {
                var nodes = row.TextContent;
                if (nodes == null)
                {
                    continue;
                }

                m_buff = removeChars.Aggregate(nodes, (s, c) => s.Replace(c.ToString(), ""));
                charaStatus.Add(m_buff.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries)[0]);
            }

            int num;

            searcher.characterInfos.HP  = int.TryParse(charaStatus[8], out num) ? num : 0;
            searcher.characterInfos.MP  = int.TryParse(charaStatus[9], out num) ? num : 0;
            searcher.characterInfos.SAN = int.TryParse(charaStatus[10], out num) ? num : 0;

            searcher.abilityValues.STR = int.TryParse(charaStatus[0], out num) ? num : 0;
            searcher.abilityValues.CON = int.TryParse(charaStatus[1], out num) ? num : 0;
            searcher.abilityValues.POW = int.TryParse(charaStatus[2], out num) ? num : 0;
            searcher.abilityValues.DEX = int.TryParse(charaStatus[3], out num) ? num : 0;
            searcher.abilityValues.APP = int.TryParse(charaStatus[4], out num) ? num : 0;
            searcher.abilityValues.SIZ = int.TryParse(charaStatus[5], out num) ? num : 0;
            searcher.abilityValues.INT = int.TryParse(charaStatus[6], out num) ? num : 0;
            searcher.abilityValues.EDU = int.TryParse(charaStatus[7], out num) ? num : 0;

            //技能の取得
            foreach (var row in doc.QuerySelectorAll("div [id = skill] tr"))
            {
                var nodes = row.TextContent;
                if (nodes == null)
                {
                    continue;
                }

                m_buff = removeChars.Aggregate(nodes, (s, c) => s.Replace(c.ToString(), ""));
                dt     = m_buff.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);


                try
                {
                    if (dt[0] == "種別" || dt[1] == "技能名" || dt[2] == "値")
                    {
                        continue;
                    }

                    var value = int.TryParse(dt[2], out var m) ? m : -1;
                    if (value == -1)
                    {
                        continue;
                    }
                    searcher.SetSkill(new Skill(dt[1], value, dt[0]));
                }
                catch (Exception exc)
                {
                    Console.WriteLine(exc.Message);
                }
            }

            return(searcher);
        }
Beispiel #4
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);
        }
Beispiel #5
0
 //スキルをキャラクターにセットする
 private Searcher AddSkillSearcher(string name, int value, string type, Searcher searcher)
 {
     searcher.SetSkill(new Skill(name, value, type));
     return(searcher);
 }