public static string Format(ArCost target, string format) { return(string.Format(format, target.CostGroup , target.CostName , target.ChangeValueText , target.Items.Select(n => n.ToString()) )); }
public ArCost(ArCost copy) { this.CostGroup = copy.CostGroup; this.CostName = copy.CostName; this.CostUsage = copy.CostUsage; this.Items.Clear(); foreach (var i in copy.Items) { this.AddItem(new BindableValue <int>(i.Value)); } }
public override string ToString() { var result = ArCost.Format(this, "[ {0} ] {1} ({2})").Replace("()", ""); return(result); }
private static ArPC ParsePC(string url, HtmlDocument html) { var result = new ArPC { SheetUrl = url }; result.DodontoFPCData.UsingSystem = TrpgSystem.Arianrhod; var tables = html.DocumentNode.SelectNodes("//table"); result.DodontoFPCData.Resources.Items.Clear(); var cnt = 0; foreach (var table in tables) { var fate = ""; switch (cnt++) { case 0: //能力値・HP・MP { var charaTitles = table.SelectNodes("tbody/tr/th").Select(i => i.InnerText).ToList(); var charaValues = table.SelectNodes(@"tbody/tr/td[@class=""sumTD""]/input").Select(i => i.Attributes["value"].Value).ToList(); fate = table.SelectNodes(@"tbody/tr/th/input[@id=""V_fate""]")[0].Attributes["value"].Value; //Levelはfateをレベルに //Titlesは1から、Valuesは9から9個(能力値) //*[@id="SL_level"] var titles = new List <string>() { "筋力", "器用", "敏捷", "知力", "感知", "精神", "幸運" }; foreach (int i in Enumerable.Range(9, 7)) { int.TryParse(charaValues[i], out int sv); result.CharacterValues.AddItem(new BindableValue <int>(sv)); var rolldice = new RollDice(TrpgSystem.Arianrhod) { RollGroup = "能力", RollName = titles[i - 9], DiceNumber = 2, DiceBase = 6, DiceConst = sv, Inequality = ">=", TargetValue = 0 }; result.RollDices.AddItem(rolldice); } //"HP","MP" foreach (int i in Enumerable.Range(16, 2)) { int.TryParse(charaValues[i], out int sv); result.DodontoFPCData.Resources.AddItem(new BindableValue <int>(sv)); //HP,/HP result.DodontoFPCData.Resources.AddItem(new BindableValue <int>(sv)); //MP,/MP } //"Fate" int.TryParse(fate, out int fateint); result.DodontoFPCData.Resources.AddItem(new BindableValue <int>(fateint)); break; } case 1: //ライフパス //未使用 break; case 2: //スキル case 3: //一般スキル { var SkillCosts = table.SelectNodes("tbody/tr"); foreach (var sCost in SkillCosts) { var sc = sCost.SelectNodes("td")?.Select(i => getSkillName(i)).ToList(); if (sc != null) { var nCv = new ObservableCollection <BindableValue <int> >(); for (var i = 0; i < 5; i++) { nCv.Add(new BindableValue <int>(0)); } int.TryParse(sc[6], out int cost); nCv[(int)ArResource.MP].Value = -cost; //0名前 6コスト 8効果 var nsc = new ArCost() { CostGroup = "スキル使用", CostName = sc[0], Items = nCv, CostUsage = $"[SL:{sc[1]}/{sc[2]}]{sc[8]}" }; (result.DodontoFPCData as ArDodontoFPCData)?.Costs.AddItem(nsc); } } } break; case 4: //戦闘・武器・防具 { var artsTitlesRaw = table.SelectNodes("tbody/tr/th").Select(i => i.InnerText.Replace(" ", "").Replace("\r\n", "").Replace("判定", "").Replace("力", "")).ToList <string>(); var artsValues = table.SelectNodes(@"tbody/tr/td[@class=""sumTD""]/input").Select(i => i.Attributes["value"].Value).ToList <string>(); var diceValuesRaw = table.SelectNodes(@"tbody/tr/td/input[contains(@id,'dice')]").Select(i => i.Attributes["value"].Value).ToList <string>(); //命中、攻撃がそれぞれ2回、回避1回(ごり押し!) var artsTitles = new List <string>() { "命中(右手)", "命中(左手)", "攻撃(右手)", "攻撃(左手)", "回避" }; var diceValues = new List <string>() { diceValuesRaw[0], diceValuesRaw[0], diceValuesRaw[1], diceValuesRaw[1], diceValuesRaw[2] }; //"命右","命左","攻右","攻左","回避" foreach (int i in Enumerable.Range(9, 5)) { int.TryParse(diceValues[i - 9], out int dv); int.TryParse(artsValues[i], out int av); var rolldice = new RollDice(TrpgSystem.Arianrhod) { RollGroup = "戦闘", RollName = artsTitles[i - 9], DiceNumber = dv, DiceBase = 6, DiceConst = av, Inequality = ">=", TargetValue = 0 }; result.RollDices.AddItem(rolldice); } //"物防","魔防","行動力","移動力" { var target = result.DodontoFPCData as ArDodontoFPCData; target.Costs.DefPointPhysical = int.TryParse(artsValues[14], out var sv14) ? sv14 : 0; target.Costs.DefPointMagical = int.TryParse(artsValues[15], out var sv15) ? sv15 : 0; target.Initiative = int.TryParse(artsValues[16], out var sv16) ? sv16 : 0; //var _ = int.TryParse(artsValues[18], out var sv18) ? sv18 : 0; } break; } case 5: //装備(価格・重量など) //未使用 break; case 6: //所持品・所持金 break; case 7: //特殊な判定 { var SkillTitles = table.SelectNodes("tbody/tr/th").Select(i => i.InnerText).ToList <string>(); var SkillValues = table.SelectNodes(@"tbody/tr/td[@class=""sumTD""]/input").Select(i => getSkillValue(i)).ToList <string>(); var SkillDiceValues = table.SelectNodes(@"tbody/tr/td/input[contains(@id,'dice')]").Select(i => getSkillValue(i)).ToList <string>(); SkillTitles.RemoveAt(0); //"罠探知","罠解除","危険感知","敵識別","魔術","呪歌","錬金術" foreach (int i in Enumerable.Range(0, 8)) { int.TryParse(SkillDiceValues[i], out int dv); int.TryParse(SkillValues[i], out int sv); var rolldice = new RollDice(TrpgSystem.Arianrhod) { RollGroup = "特殊", RollName = SkillTitles[i], DiceNumber = dv, DiceBase = 6, DiceConst = sv, Inequality = ">=", TargetValue = 0 }; result.RollDices.AddItem(rolldice); } var addDr = TrpgSystem.Arianrhod.MakeNormalRollDice(); addDr.RollGroup = "その他"; var addDrNames = new string[] { "アイテムドロップ", "HPポーション", "MPポーション" }; foreach (var ad in addDrNames) { addDr.RollName = ad; result.RollDices.AddItem(new RollDice(addDr)); } break; } case 8: //レベルアップ記録 //未使用 break; case 9: //成長履歴 //未使用 break; case 10: //成長履歴その2 //未使用 break; case 11: //パーソナルデータ { //名前のみ使用。将来的に他のデータも保持する。 var FieldNames = table.SelectNodes("tbody/tr/th").Select(i => i.InnerText.Trim()).ToList <string>(); var FieldValues = table.SelectNodes("tbody/tr/td/input").Select(i => i.Attributes["value"].Value).ToList <string>(); result.Name = string.IsNullOrEmpty(FieldValues[0]) ? "名無し(パーソナルデータ-キャラクター名に名前を入力!)" : FieldValues[0]; break; } case 12: //コネクション //未使用 break; } } return(result); string getSkillValue(HtmlNode node) { var resSV = ""; try { resSV = node.Attributes["value"].Value; } catch { resSV = "0"; } return(resSV); } string getSkillName(HtmlNode node) { var resSN = ""; try { resSN = node.SelectSingleNode("input").Attributes["Value"].Value; } catch { resSN = ""; } return(resSN); } }