YotogiOldPropensity.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. using System;
  2. using System.Collections.Generic;
  3. using MaidStatus;
  4. public static class YotogiOldPropensity
  5. {
  6. public static void Create()
  7. {
  8. if (YotogiOldPropensity.propensityDatas != null)
  9. {
  10. return;
  11. }
  12. YotogiOldPropensity.propensityDatas = new Dictionary<int, YotogiOldPropensity.RequestData>();
  13. using (AFileBase afileBase = GameUty.FileSystemOld.FileOpen("propensity_learn.nei"))
  14. {
  15. using (CsvParser csvParser = new CsvParser())
  16. {
  17. bool condition = csvParser.Open(afileBase);
  18. NDebug.Assert(condition, "propensity_learn.nei\nopen failed.");
  19. int num = 2;
  20. while (csvParser.IsCellToExistData(1, num))
  21. {
  22. int cell_x = 1;
  23. string cellAsString = csvParser.GetCellAsString(cell_x++, num);
  24. if (!Propensity.IsEnabled(cellAsString))
  25. {
  26. num++;
  27. }
  28. else
  29. {
  30. YotogiOldPropensity.RequestData requestData = new YotogiOldPropensity.RequestData();
  31. requestData.seikeikens = new HashSet<Seikeiken>();
  32. requestData.parametersPack = new ParametersPack();
  33. Propensity.Data data = Propensity.GetData(cellAsString);
  34. cellAsString = csvParser.GetCellAsString(cell_x++, num);
  35. if (!string.IsNullOrEmpty(cellAsString))
  36. {
  37. string[] array = cellAsString.Split(new char[]
  38. {
  39. ','
  40. });
  41. foreach (string text in array)
  42. {
  43. string value = "NO_NO";
  44. if (text != null)
  45. {
  46. if (!(text == "指定なし"))
  47. {
  48. if (!(text == "前穴"))
  49. {
  50. if (!(text == "後穴"))
  51. {
  52. if (text == "両穴")
  53. {
  54. value = "Yes_Yes";
  55. }
  56. }
  57. else
  58. {
  59. value = "No_Yes";
  60. }
  61. }
  62. else
  63. {
  64. value = "Yes_No";
  65. }
  66. }
  67. else
  68. {
  69. value = "No_No";
  70. }
  71. }
  72. requestData.seikeikens.Add((Seikeiken)Enum.Parse(typeof(Seikeiken), value));
  73. }
  74. }
  75. while (csvParser.IsCellToExistData(cell_x, num))
  76. {
  77. string cellAsString2 = csvParser.GetCellAsString(cell_x++, num);
  78. int cellAsInteger = csvParser.GetCellAsInteger(cell_x++, num);
  79. ParametersPack.StatusType targetStatus = ParametersPack.NameToStatusType(cellAsString2);
  80. requestData.parametersPack.Set(targetStatus, cellAsInteger);
  81. }
  82. YotogiOldPropensity.propensityDatas.Add(data.id, requestData);
  83. num++;
  84. }
  85. }
  86. }
  87. }
  88. }
  89. public static bool IsGetPossiblePropensity(Propensity.Data data, Status status)
  90. {
  91. YotogiOldPropensity.Create();
  92. return Propensity.IsEnabled(data.id) && YotogiOldPropensity.propensityDatas.ContainsKey(data.id) && YotogiOldPropensity.propensityDatas[data.id].Check(status);
  93. }
  94. public static Dictionary<int, YotogiOldPropensity.RequestData> propensityDatas;
  95. public class RequestData
  96. {
  97. public bool Check(Status status)
  98. {
  99. return this.seikeikens.Contains(status.seikeiken) && this.parametersPack.GreaterThanOrEqualToStatus(status);
  100. }
  101. public HashSet<Seikeiken> seikeikens;
  102. public ParametersPack parametersPack;
  103. }
  104. }