123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- using System;
- using System.Collections.Generic;
- namespace MaidStatus
- {
- public static class PersonalEventBlocker
- {
- public static void CreateData()
- {
- if (PersonalEventBlocker.blockerDataList != null)
- {
- return;
- }
- PersonalEventBlocker.blockerDataList = new List<PersonalEventBlocker.Data>();
- string text = string.Empty;
- string str = string.Empty;
- if (Product.type == Product.Type.EnAdult)
- {
- text = "maid_personaleventblocker_list.nei";
- str = "maid_personaleventblocker_unlocklist_";
- }
- else if (Product.type == Product.Type.JpAdult)
- {
- text = "maid_personaleventblocker_list_jp.nei";
- str = "maid_personaleventblocker_unlocklist_jp_";
- }
- if (string.IsNullOrEmpty(text) || !GameUty.FileSystem.IsExistentFile(text))
- {
- return;
- }
- using (AFileBase afileBase = GameUty.FileSystem.FileOpen(text))
- {
- using (CsvParser csvParser = new CsvParser())
- {
- bool flag = csvParser.Open(afileBase);
- if (flag)
- {
- int num = 1;
- while (csvParser.IsCellToExistData(0, num))
- {
- PersonalEventBlocker.Data item = new PersonalEventBlocker.Data(csvParser, num);
- PersonalEventBlocker.blockerDataList.Add(item);
- num++;
- }
- }
- }
- }
- if (GameUty.PathList != null)
- {
- HashSet<PersonalEventBlocker.Data> hashSet = new HashSet<PersonalEventBlocker.Data>();
- foreach (string str2 in GameUty.PathList)
- {
- string f_strFileName = str + str2 + ".nei";
- if (GameUty.FileSystem.IsExistentFile(f_strFileName))
- {
- using (AFileBase afileBase2 = GameUty.FileSystem.FileOpen(f_strFileName))
- {
- using (CsvParser csvParser2 = new CsvParser())
- {
- bool flag2 = csvParser2.Open(afileBase2);
- if (flag2)
- {
- int num2 = 1;
- while (csvParser2.IsCellToExistData(0, num2))
- {
- Personal.Data data = Personal.GetData(csvParser2.GetCellAsString(0, num2));
- foreach (PersonalEventBlocker.Data data2 in PersonalEventBlocker.blockerDataList)
- {
- if (data == data2.personal)
- {
- hashSet.Add(data2);
- break;
- }
- }
- num2++;
- }
- }
- }
- }
- }
- }
- foreach (PersonalEventBlocker.Data item2 in hashSet)
- {
- PersonalEventBlocker.blockerDataList.Remove(item2);
- }
- }
- }
- public static PersonalEventBlocker.Data GetData(Personal.Data personal)
- {
- foreach (PersonalEventBlocker.Data data in PersonalEventBlocker.blockerDataList)
- {
- if (personal == data.personal)
- {
- return data;
- }
- }
- return null;
- }
- public static List<PersonalEventBlocker.Data> GetAllDatas()
- {
- return PersonalEventBlocker.blockerDataList;
- }
- public static bool IsEnabledYotodiSkill(Personal.Data personal, int yotogiSkillId)
- {
- PersonalEventBlocker.Data data = PersonalEventBlocker.GetData(personal);
- return data == null || !data.blockYotogiIdList.Contains(yotogiSkillId);
- }
- public static bool IsEnabledScheduleTask(Personal.Data personal, int taskId)
- {
- PersonalEventBlocker.Data data = PersonalEventBlocker.GetData(personal);
- return data == null || !data.blockScheduleIdList.Contains(taskId);
- }
- public static bool IsEnabledLifeMode(Personal.Data personal)
- {
- return Product.type != Product.Type.EnAdult || PersonalEventBlocker.GetData(personal) == null;
- }
- private static List<PersonalEventBlocker.Data> blockerDataList;
- public class Data
- {
- public Data(CsvParser csv, int readLineY)
- {
- if (!csv.IsValid() || !csv.IsCellToExistData(0, readLineY))
- {
- return;
- }
- Func<string, HashSet<int>> func = delegate(string cellText)
- {
- HashSet<int> hashSet = new HashSet<int>();
- if (!string.IsNullOrEmpty(cellText))
- {
- foreach (string text in cellText.Split(new char[]
- {
- ','
- }))
- {
- int item;
- if (int.TryParse(text.Trim(), out item))
- {
- hashSet.Add(item);
- }
- }
- }
- return hashSet;
- };
- int num = 0;
- this.personal = Personal.GetData(csv.GetCellAsString(num++, readLineY));
- this.blockScheduleIdList = func(csv.GetCellAsString(num++, readLineY));
- this.blockYotogiIdList = func(csv.GetCellAsString(num++, readLineY));
- }
- public readonly Personal.Data personal;
- public readonly HashSet<int> blockScheduleIdList;
- public readonly HashSet<int> blockYotogiIdList;
- }
- }
- }
|