using System; using System.Collections.Generic; using MaidStatus.CsvData; using wf; using Yotogis; namespace MaidStatus { public static class YotogiClass { public static int Count { get { YotogiClass.CreateData(); return YotogiClass.commonIdManager.idMap.Count; } } public static bool Contains(string name) { return YotogiClass.commonIdManager.nameMap.ContainsKey(name); } public static bool Contains(int id) { return YotogiClass.commonIdManager.idMap.ContainsKey(id); } public static int uniqueNameToId(string name) { YotogiClass.CreateData(); NDebug.Assert(YotogiClass.commonIdManager.nameMap.ContainsKey(name), "夜伽クラス\nユニーク名[" + name + "]をIDに変換できませんでした"); return YotogiClass.commonIdManager.nameMap[name]; } public static string IdToUniqueName(int id) { YotogiClass.CreateData(); NDebug.Assert(YotogiClass.commonIdManager.idMap.ContainsKey(id), "夜伽クラス\nID[" + id + "]をユニーク名に変換できませんでした"); return YotogiClass.commonIdManager.idMap[id].Key; } public static YotogiClass.Data GetData(int id) { YotogiClass.CreateData(); NDebug.Assert(YotogiClass.basicDatas.ContainsKey(id), "夜伽クラス\nID[" + id + "]のデータは存在しません"); return YotogiClass.basicDatas[id]; } public static YotogiClass.Data GetData(string uniqueName) { return YotogiClass.GetData(YotogiClass.uniqueNameToId(uniqueName)); } public static bool IsEnabled(string uniqueName) { YotogiClass.CreateData(); return YotogiClass.commonIdManager.enabledIdList.Contains(YotogiClass.uniqueNameToId(uniqueName)); } public static bool IsEnabled(int id) { YotogiClass.CreateData(); return YotogiClass.commonIdManager.enabledIdList.Contains(id); } public static List GetAllDatas(bool onlyEnabled) { YotogiClass.CreateData(); List list = new List(); foreach (KeyValuePair> keyValuePair in YotogiClass.commonIdManager.idMap) { if (!onlyEnabled || YotogiClass.commonIdManager.enabledIdList.Contains(keyValuePair.Key)) { list.Add(YotogiClass.basicDatas[keyValuePair.Key]); } } return list; } public static SortedList> GetLearnSkillList(string uniqueName) { return YotogiClass.GetLearnSkillList(YotogiClass.uniqueNameToId(uniqueName)); } public static SortedList> GetLearnSkillList(int id) { if (YotogiClass.learnSkillList == null) { YotogiClass.learnSkillList = new Dictionary>>(); Skill.CreateData(); YotogiClass.CreateData(); foreach (YotogiClass.Data data in YotogiClass.GetAllDatas(false)) { YotogiClass.learnSkillList.Add(data.id, new SortedList>()); } for (int i = 0; i < Skill.skill_data_list.Length; i++) { foreach (Skill.Data data2 in Skill.skill_data_list[i].Values) { if (data2.getcondition_data.yotogi_class != null) { if (YotogiClass.learnSkillList.ContainsKey(data2.getcondition_data.yotogi_class.id)) { SortedList> sortedList = YotogiClass.learnSkillList[data2.getcondition_data.yotogi_class.id]; if (sortedList.ContainsKey(data2.getcondition_data.yotogi_class_level)) { sortedList[data2.getcondition_data.yotogi_class_level].Add(data2); } else { List list = new List(); list.Add(data2); sortedList.Add(data2.getcondition_data.yotogi_class_level, list); } } } } } } NDebug.Assert(YotogiClass.learnSkillList.ContainsKey(id), "夜伽クラス\nID[" + id + "]のデータは存在しません"); return YotogiClass.learnSkillList[id]; } public static SortedList> GetLearnSkillOldList(string uniqueName) { return YotogiClass.GetLearnSkillOldList(YotogiClass.uniqueNameToId(uniqueName)); } public static SortedList> GetLearnSkillOldList(int id) { if (YotogiClass.learnSkillOldList == null) { YotogiClass.learnSkillOldList = new Dictionary>>(); Skill.CreateData(); YotogiClass.CreateData(); foreach (YotogiClass.Data data in YotogiClass.GetAllDatas(false)) { YotogiClass.learnSkillOldList.Add(data.id, new SortedList>()); } for (int i = 0; i < Skill.Old.skill_data_list.Length; i++) { foreach (Skill.Old.Data data2 in Skill.Old.skill_data_list[i].Values) { if (1 <= data2.getcondition_data.yotogi_class_level) { if (YotogiClass.learnSkillOldList.ContainsKey(data2.getcondition_data.yotogi_class.id)) { SortedList> sortedList = YotogiClass.learnSkillOldList[data2.getcondition_data.yotogi_class.id]; if (sortedList.ContainsKey(data2.getcondition_data.yotogi_class_level)) { sortedList[data2.getcondition_data.yotogi_class_level].Add(data2); } else { List list = new List(); list.Add(data2); sortedList.Add(data2.getcondition_data.yotogi_class_level, list); } } } } } } NDebug.Assert(YotogiClass.learnSkillOldList.ContainsKey(id), "夜伽クラス\nID[" + id + "]のデータは存在しません"); return YotogiClass.learnSkillOldList[id]; } public static bool IsNTRClass(int id, bool refOld) { YotogiClass.Data data = YotogiClass.GetData(id); if (refOld && data.classType == AbstractClassData.ClassType.New) { refOld = false; } else if (!refOld && data.classType == AbstractClassData.ClassType.Old) { refOld = true; } bool flag = true; if (refOld) { SortedList> sortedList = YotogiClass.GetLearnSkillOldList(data.id); if (sortedList.Count == 0) { flag = false; } foreach (KeyValuePair> keyValuePair in sortedList) { List value = keyValuePair.Value; for (int i = 0; i < value.Count; i++) { if (value[i].category != YotogiOld.Category.交換 && value[i].category != YotogiOld.Category.乱交) { flag = false; break; } if (!flag) { break; } } if (!flag) { break; } } } else { SortedList> sortedList2 = YotogiClass.GetLearnSkillList(data.id); if (sortedList2.Count == 0) { flag = false; } foreach (KeyValuePair> keyValuePair2 in sortedList2) { List value2 = keyValuePair2.Value; for (int j = 0; j < value2.Count; j++) { if (value2[j].category != Yotogi.Category.交換 && value2[j].category != Yotogi.Category.乱交) { flag = false; break; } if (!flag) { break; } } if (!flag) { break; } } } return flag; } public static void CreateData() { if (YotogiClass.commonIdManager != null) { return; } YotogiClass.commonIdManager = new CsvCommonIdManager("maid_status_yotogiclass", "夜伽クラス", CsvCommonIdManager.Type.IdAndUniqueName, null); YotogiClass.basicDatas = new Dictionary(); string[] array = new string[] { "list", "acquired_condition", "bonus", "experiences" }; KeyValuePair[] array2 = new KeyValuePair[array.Length]; for (int i = 0; i < array2.Length; i++) { string text = "maid_status_yotogiclass_" + array[i] + ".nei"; AFileBase afileBase = GameUty.FileSystem.FileOpen(text); CsvParser csvParser = new CsvParser(); bool condition = csvParser.Open(afileBase); NDebug.Assert(condition, text + "\nopen failed."); array2[i] = new KeyValuePair(afileBase, csvParser); } foreach (KeyValuePair keyValuePair in YotogiClass.commonIdManager.nameMap) { string key = keyValuePair.Key; YotogiClass.Data value = new YotogiClass.Data(key, array2[0].Value, array2[1].Value, array2[2].Value, array2[3].Value); YotogiClass.basicDatas.Add(keyValuePair.Value, value); } foreach (KeyValuePair keyValuePair2 in array2) { keyValuePair2.Value.Dispose(); keyValuePair2.Key.Dispose(); } if (GameUty.FileSystemOld.IsExistentFile("yotogi_class_enabled_list.nei")) { Dictionary enabledIdListOld = new Dictionary(); Action action = delegate(string file_name) { file_name += ".nei"; if (!GameUty.FileSystemOld.IsExistentFile(file_name)) { return; } using (AFileBase afileBase3 = GameUty.FileSystemOld.FileOpen(file_name)) { using (CsvParser csvParser3 = new CsvParser()) { bool condition3 = csvParser3.Open(afileBase3); NDebug.Assert(condition3, file_name + "\nopen failed."); for (int num2 = 1; num2 < csvParser3.max_cell_y; num2++) { if (csvParser3.IsCellToExistData(0, num2)) { string cellAsString2 = csvParser3.GetCellAsString(0, num2); string cellAsString3 = csvParser3.GetCellAsString(1, num2); if (!enabledIdListOld.ContainsKey(cellAsString2)) { enabledIdListOld.Add(cellAsString2, cellAsString3); } } } } } }; action("yotogi_class_enabled_list"); for (int k = 0; k < GameUty.PathListOld.Count; k++) { action("yotogi_class_enabled_list_" + GameUty.PathListOld[k]); } array = new string[] { "infotext", "acquisition_data", "bonus_status", "exp_list" }; array2 = new KeyValuePair[array.Length]; for (int l = 0; l < array2.Length; l++) { string text2 = "yotogi_class_" + array[l] + ".nei"; AFileBase afileBase2 = GameUty.FileSystemOld.FileOpen(text2); CsvParser csvParser2 = new CsvParser(); bool condition2 = csvParser2.Open(afileBase2); NDebug.Assert(condition2, text2 + "\nopen failed."); array2[l] = new KeyValuePair(afileBase2, csvParser2); } Dictionary> dictionary = new Dictionary>(); Dictionary dictionary2 = new Dictionary(); for (int m = 1; m < array2[0].Value.max_cell_y; m++) { int num = array2[0].Value.GetCellAsInteger(0, m); if (num == 56 || num == 57) { num += 2; } if (!YotogiClass.basicDatas.ContainsKey(num)) { string cellAsString = array2[0].Value.GetCellAsString(1, m); string text3 = (!enabledIdListOld.ContainsKey(cellAsString)) ? cellAsString : enabledIdListOld[cellAsString]; YotogiClass.Data value2 = new YotogiClass.Data(cellAsString, text3, array2[0].Value, array2[1].Value, array2[2].Value, array2[3].Value); YotogiClass.basicDatas.Add(num, value2); dictionary.Add(num, new KeyValuePair(cellAsString, text3)); dictionary2.Add(cellAsString, num); } else { YotogiClass.basicDatas[num].SetClassType(AbstractClassData.ClassType.Share); } } Dictionary> dictionary3 = new Dictionary>(YotogiClass.commonIdManager.idMap); Dictionary dictionary4 = new Dictionary(YotogiClass.commonIdManager.nameMap); HashSet hashSet = new HashSet(YotogiClass.commonIdManager.enabledIdList); foreach (KeyValuePair> keyValuePair3 in dictionary) { dictionary3.Add(keyValuePair3.Key, keyValuePair3.Value); NDebug.Assert(!dictionary4.ContainsKey(keyValuePair3.Value.Key), "夜伽クラスのユニーク名[" + keyValuePair3.Value.Key + "]が重複しています"); dictionary4.Add(keyValuePair3.Value.Key, keyValuePair3.Key); } foreach (KeyValuePair keyValuePair4 in enabledIdListOld) { if (dictionary2.ContainsKey(keyValuePair4.Key) && !hashSet.Contains(dictionary2[keyValuePair4.Key])) { hashSet.Add(dictionary2[keyValuePair4.Key]); } } YotogiClass.commonIdManager = new CsvCommonIdManager(dictionary3, dictionary4, hashSet, CsvCommonIdManager.Type.IdAndUniqueName); foreach (KeyValuePair keyValuePair5 in array2) { keyValuePair5.Value.Dispose(); keyValuePair5.Key.Dispose(); } } } private const string csvTopCommonName = "maid_status_yotogiclass"; private const string typeNameForErrorLog = "夜伽クラス"; private static CsvCommonIdManager commonIdManager; private static Dictionary basicDatas; private static Dictionary>> learnSkillList; private static Dictionary>> learnSkillOldList; public class Data : AbstractClassData { public Data(string uniqueName, CsvParser basicCsv, CsvParser acquiredConditionCsv, CsvParser bonusCsv, CsvParser experienceCsv) : base(uniqueName, basicCsv, acquiredConditionCsv, bonusCsv, experienceCsv) { } public Data(string uniqueName, string drawName, CsvParser infoCsv, CsvParser acquiredConditionCsv, CsvParser bonusCsv, CsvParser experienceCsv) : base(uniqueName, drawName, infoCsv, acquiredConditionCsv, bonusCsv, experienceCsv) { } protected override string termCategoryName { get { return "夜伽クラス"; } } } } }