using System; using System.Collections.Generic; using I2.Loc; using MaidStatus; using UnityEngine; namespace Edit { public static class MaidProfile { public static string Create(Maid maid, bool employment) { Status status_ = maid.status; string profileText = string.Empty; Func GetTranslation = delegate(string termSuffix) { if (string.IsNullOrEmpty(termSuffix)) { return string.Empty; } string result = termSuffix; if (Product.supportMultiLanguage) { string empty = string.Empty; if (LocalizationManager.TryGetTranslation("ProfileComment/" + termSuffix, out empty, true, 0, true, false, null, Product.EnumConvert.ToI2LocalizeLanguageName(Product.defaultLanguage))) { result = empty; } else { Debug.LogWarning("not find Term:ProfileComment/" + termSuffix); } } return result; }; Func success_call_back = delegate(MaidProfile.CsvDataBlock block, int x, int y) { string cellAsString = block.csv.GetCellAsString(block.GetOriginalX(block.max_x - 1), block.GetOriginalY(y)); profileText += GetTranslation(cellAsString); return true; }; string text = "profile_comment_1.nei"; profileText = string.Empty; using (AFileBase afileBase = GameUty.FileSystem.FileOpen(text)) { NDebug.Assert(afileBase.IsValid(), "file open failed.\n" + text); using (CsvParser csvParser = new CsvParser()) { if (!csvParser.Open(afileBase)) { NDebug.Assert("csv open failed.\n" + text, false); } MaidProfile.CsvDataBlock csvDataBlock = new MaidProfile.CsvDataBlock(csvParser, 0); Func line_func = delegate(MaidProfile.CsvDataBlock cur_block, int line_y) { if (!cur_block.csv.IsCellToExistData(cur_block.GetOriginalX(1), line_y)) { return true; } string cellAsString = cur_block.csv.GetCellAsString(cur_block.GetOriginalX(1), line_y); string cellAsString2 = cur_block.csv.GetCellAsString(cur_block.GetOriginalX(2), line_y); return !status_.partsDic.ContainsKey(cellAsString) || status_.partsDic[cellAsString] == cellAsString2; }; csvDataBlock.BlockAnalysis(1, line_func, success_call_back); csvDataBlock.NextBlock(); Func line_func2 = delegate(MaidProfile.CsvDataBlock cur_block, int line_y) { if (!cur_block.csv.IsCellToExistData(cur_block.GetOriginalX(1), line_y)) { return true; } string cellAsString = cur_block.csv.GetCellAsString(cur_block.GetOriginalX(1), line_y); return status_.features.ContainsKey(Feature.GetData(cellAsString).id); }; csvDataBlock.BlockAnalysis(1, line_func2, success_call_back); csvDataBlock.NextBlock(); csvDataBlock.BlockAnalysis(1, line_func, success_call_back); } } text = "profile_comment_2.nei"; using (AFileBase afileBase2 = GameUty.FileSystem.FileOpen(text)) { NDebug.Assert(afileBase2.IsValid(), "file open failed.\n" + text); using (CsvParser csv = new CsvParser()) { if (!csv.Open(afileBase2)) { NDebug.Assert("csv open failed.\n" + text, false); } MaidProfile.CsvDataBlock csvDataBlock2 = new MaidProfile.CsvDataBlock(csv, 0); string text2 = csv.GetCellAsString(csvDataBlock2.GetOriginalX(csvDataBlock2.max_x - 1), csvDataBlock2.GetOriginalY(csvDataBlock2.max_y - 1)); text2 = GetTranslation(text2); profileText += text2.Replace("[n]", string.Empty + status_.body.bust); csvDataBlock2.NextBlock(); text2 = csv.GetCellAsString(csvDataBlock2.GetOriginalX(csvDataBlock2.max_x - 1), csvDataBlock2.GetOriginalY(csvDataBlock2.max_y - 1)); text2 = GetTranslation(text2); profileText += text2.Replace("[n]", string.Empty + status_.body.waist); csvDataBlock2.NextBlock(); text2 = csv.GetCellAsString(csvDataBlock2.GetOriginalX(csvDataBlock2.max_x - 1), csvDataBlock2.GetOriginalY(csvDataBlock2.max_y - 1)); text2 = GetTranslation(text2); profileText += text2.Replace("[n]", string.Empty + status_.body.hip); csvDataBlock2.NextBlock(); Func line_func3 = delegate(MaidProfile.CsvDataBlock cur_block, int line_y) { string cellAsString = csv.GetCellAsString(cur_block.GetOriginalX(1), line_y); if (cellAsString.IndexOf(status_.body.cup) == -1) { return false; } bool flag = csv.GetCellAsString(cur_block.GetOriginalX(2), line_y) == "○"; return !flag || (maid.Parts != null && 50 <= maid.GetProp(MPN.MuneTare).value); }; csvDataBlock2.BlockAnalysis(1, line_func3, success_call_back); csvDataBlock2.NextBlock(); Func line_func4 = delegate(MaidProfile.CsvDataBlock cur_block, int line_y) { int cellAsInteger = csv.GetCellAsInteger(cur_block.GetOriginalX(1), line_y); if (cellAsInteger <= status_.body.waist) { return false; } int num = int.MinValue; if (csv.IsCellToExistData(cur_block.GetOriginalX(2), line_y)) { num = csv.GetCellAsInteger(cur_block.GetOriginalX(2), line_y); } int num2 = int.MaxValue; if (csv.IsCellToExistData(cur_block.GetOriginalX(3), line_y)) { num2 = csv.GetCellAsInteger(cur_block.GetOriginalX(3), line_y); } return num <= status_.body.hip && status_.body.hip <= num2; }; csvDataBlock2.BlockAnalysis(1, line_func4, success_call_back); csvDataBlock2.NextBlock(); Func line_func5 = delegate(MaidProfile.CsvDataBlock cur_block, int line_y) { int cellAsInteger = cur_block.csv.GetCellAsInteger(cur_block.GetOriginalX(1), line_y); if (status_.personal.id != Personal.GetData(cellAsInteger).id) { return false; } if (!cur_block.csv.IsCellToExistData(cur_block.GetOriginalX(2), line_y)) { return true; } string cellAsString = cur_block.csv.GetCellAsString(cur_block.GetOriginalX(2), line_y); return status_.features.ContainsKey(Feature.GetData(cellAsString).id); }; csvDataBlock2.BlockAnalysis(1, line_func5, success_call_back); csvDataBlock2.NextBlock(); csvDataBlock2.BlockAnalysis(1, line_func5, success_call_back); } } text = "profile_comment_3.nei"; using (AFileBase afileBase3 = GameUty.FileSystem.FileOpen(text)) { NDebug.Assert(afileBase3.IsValid(), "file open failed.\n" + text); using (CsvParser csv = new CsvParser()) { if (!csv.Open(afileBase3)) { NDebug.Assert("csv open failed.\n" + text, false); } MaidProfile.CsvDataBlock csvDataBlock3 = new MaidProfile.CsvDataBlock(csv, 0); Func line_func6 = delegate(MaidProfile.CsvDataBlock cur_block, int line_y) { int num = int.MinValue; if (csv.IsCellToExistData(cur_block.GetOriginalX(1), line_y)) { num = csv.GetCellAsInteger(cur_block.GetOriginalX(1), line_y); } int num2 = int.MaxValue; if (csv.IsCellToExistData(cur_block.GetOriginalX(2), line_y)) { num2 = csv.GetCellAsInteger(cur_block.GetOriginalX(2), line_y); } if (num > status_.body.bust || status_.body.bust > num2) { return false; } num = int.MinValue; if (csv.IsCellToExistData(cur_block.GetOriginalX(3), line_y)) { num = csv.GetCellAsInteger(cur_block.GetOriginalX(3), line_y); } num2 = int.MaxValue; if (csv.IsCellToExistData(cur_block.GetOriginalX(4), line_y)) { num2 = csv.GetCellAsInteger(cur_block.GetOriginalX(4), line_y); } if (num > status_.body.waist || status_.body.waist > num2) { return false; } num = int.MinValue; if (csv.IsCellToExistData(cur_block.GetOriginalX(5), line_y)) { num = csv.GetCellAsInteger(cur_block.GetOriginalX(5), line_y); } num2 = int.MaxValue; if (csv.IsCellToExistData(cur_block.GetOriginalX(6), line_y)) { num2 = csv.GetCellAsInteger(cur_block.GetOriginalX(6), line_y); } return num <= status_.body.hip && status_.body.hip <= num2; }; csvDataBlock3.BlockAnalysis(1, line_func6, success_call_back); csvDataBlock3.NextBlock(); Func line_func7 = delegate(MaidProfile.CsvDataBlock cur_block, int line_y) { int cellAsInteger = cur_block.csv.GetCellAsInteger(cur_block.GetOriginalX(1), line_y); return status_.personal.id == Personal.GetData(cellAsInteger).id; }; csvDataBlock3.BlockAnalysis(1, line_func7, success_call_back); csvDataBlock3.NextBlock(); Func line_func8 = delegate(MaidProfile.CsvDataBlock cur_block, int line_y) { JobClass.Data data = JobClass.GetData(cur_block.csv.GetCellAsInteger(cur_block.GetOriginalX(1), line_y)); return data.id == status_.selectedJobClass.data.id; }; csvDataBlock3.BlockAnalysis(1, line_func8, success_call_back); } } text = "profile_comment_4.nei"; if (!Product.isPublic) { using (AFileBase afileBase4 = GameUty.FileSystem.FileOpen(text)) { NDebug.Assert(afileBase4.IsValid(), "file open failed.\n" + text); using (CsvParser csv = new CsvParser()) { if (!csv.Open(afileBase4)) { NDebug.Assert("csv open failed.\n" + text, false); } Func line_func9 = delegate(MaidProfile.CsvDataBlock cur_block, int line_y) { int num = 1; if (csv.IsCellToExistData(cur_block.GetOriginalX(num++), line_y)) { YotogiClass.Data data = YotogiClass.GetData(cur_block.csv.GetCellAsInteger(cur_block.GetOriginalX(num - 1), line_y)); if (data.id != status_.selectedJobClass.data.id) { return false; } } int[] array = new int[] { status_.sexPlayNumberOfPeople, status_.inyoku, status_.lovely, status_.mvalue, status_.elegance, status_.hentai, status_.charm, status_.housi }; foreach (int num2 in array) { if (csv.IsCellToExistData(cur_block.GetOriginalX(num++), line_y)) { int cellAsInteger = csv.GetCellAsInteger(cur_block.GetOriginalX(num - 1), line_y); if (cellAsInteger > num2) { return false; } } } return true; }; MaidProfile.CsvDataBlock csvDataBlock4 = new MaidProfile.CsvDataBlock(csv, 0); Func line_func10 = delegate(MaidProfile.CsvDataBlock cur_block, int line_y) { Personal.Data data = Personal.GetData(cur_block.csv.GetCellAsInteger(cur_block.GetOriginalX(1), line_y)); return status_.personal.id == data.id; }; csvDataBlock4.BlockAnalysis(1, line_func10, success_call_back); csvDataBlock4.NextBlock(); Func line_func11 = delegate(MaidProfile.CsvDataBlock cur_block, int line_y) { Contract cellAsInteger = (Contract)cur_block.csv.GetCellAsInteger(cur_block.GetOriginalX(1), line_y); return status_.contract == cellAsInteger; }; csvDataBlock4.BlockAnalysis(1, line_func11, success_call_back); csvDataBlock4.NextBlock(); if (!employment && status_.seikeiken == Seikeiken.No_No) { Func line_func12 = delegate(MaidProfile.CsvDataBlock cur_block, int line_y) { int num = int.MinValue; if (csv.IsCellToExistData(cur_block.GetOriginalX(1), line_y)) { num = cur_block.csv.GetCellAsInteger(cur_block.GetOriginalX(1), line_y); } bool flag = num <= status_.inyoku; if (flag) { status_.studyRate = cur_block.csv.GetCellAsInteger(cur_block.GetOriginalX(2), line_y); } return flag; }; csvDataBlock4.BlockAnalysis(1, line_func12, success_call_back); } csvDataBlock4.NextBlock(); if (employment && status_.seikeiken == Seikeiken.No_No) { csvDataBlock4.BlockAnalysis(1, line_func9, success_call_back); } csvDataBlock4.NextBlock(); if (!employment && status_.seikeiken == Seikeiken.Yes_No) { Func line_func13 = delegate(MaidProfile.CsvDataBlock cur_block, int line_y) { int num = int.MinValue; if (csv.IsCellToExistData(cur_block.GetOriginalX(1), line_y)) { num = cur_block.csv.GetCellAsInteger(cur_block.GetOriginalX(1), line_y); } bool flag = num <= status_.sexPlayNumberOfPeople; if (flag) { status_.studyRate = cur_block.csv.GetCellAsInteger(cur_block.GetOriginalX(2), line_y); } return flag; }; csvDataBlock4.BlockAnalysis(1, line_func13, success_call_back); } csvDataBlock4.NextBlock(); if (employment && status_.seikeiken == Seikeiken.Yes_No) { csvDataBlock4.BlockAnalysis(1, line_func9, success_call_back); } csvDataBlock4.NextBlock(); if (!employment && status_.seikeiken == Seikeiken.No_Yes) { Func line_func14 = delegate(MaidProfile.CsvDataBlock cur_block, int line_y) { int num = int.MinValue; if (csv.IsCellToExistData(cur_block.GetOriginalX(1), line_y)) { num = cur_block.csv.GetCellAsInteger(cur_block.GetOriginalX(1), line_y); } bool flag = num <= status_.sexPlayNumberOfPeople; if (flag) { status_.studyRate = cur_block.csv.GetCellAsInteger(cur_block.GetOriginalX(2), line_y); } return flag; }; csvDataBlock4.BlockAnalysis(1, line_func14, success_call_back); } csvDataBlock4.NextBlock(); if (employment && status_.seikeiken == Seikeiken.No_Yes) { csvDataBlock4.BlockAnalysis(1, line_func9, success_call_back); } csvDataBlock4.NextBlock(); if (!employment && status_.seikeiken == Seikeiken.Yes_Yes) { Func line_func15 = delegate(MaidProfile.CsvDataBlock cur_block, int line_y) { int num = int.MinValue; if (csv.IsCellToExistData(cur_block.GetOriginalX(1), line_y)) { num = cur_block.csv.GetCellAsInteger(cur_block.GetOriginalX(1), line_y); } bool flag = num <= status_.sexPlayNumberOfPeople; if (flag) { status_.studyRate = cur_block.csv.GetCellAsInteger(cur_block.GetOriginalX(2), line_y); } return flag; }; csvDataBlock4.BlockAnalysis(1, line_func15, success_call_back); } csvDataBlock4.NextBlock(); if (employment && status_.seikeiken == Seikeiken.Yes_Yes) { csvDataBlock4.BlockAnalysis(1, line_func9, success_call_back); } } } } text = "profile_comment_5.nei"; using (AFileBase afileBase5 = GameUty.FileSystem.FileOpen(text)) { NDebug.Assert(afileBase5.IsValid(), "file open failed.\n" + text); using (CsvParser csv = new CsvParser()) { if (!csv.Open(afileBase5)) { NDebug.Assert("csv open failed.\n" + text, false); } int comment_no = 0; MaidProfile.CsvDataBlock csvDataBlock5 = new MaidProfile.CsvDataBlock(csv, 0); Func success_call_back2 = delegate(MaidProfile.CsvDataBlock succes_block, int x, int y) { string cellAsString = succes_block.csv.GetCellAsString(succes_block.GetOriginalX(succes_block.max_x - 3 + comment_no), succes_block.GetOriginalY(y)); profileText += GetTranslation(cellAsString); return true; }; Func line_func16 = delegate(MaidProfile.CsvDataBlock cur_block, int line_y) { string cellAsString = cur_block.csv.GetCellAsString(cur_block.GetOriginalX(1), line_y); int id = Propensity.GetData(cellAsString).id; if (!status_.propensitys.ContainsKey(id)) { return false; } string cellAsString2 = cur_block.csv.GetCellAsString(cur_block.GetOriginalX(2), line_y); if (cellAsString2 != null) { if (!(cellAsString2 == "処女")) { if (!(cellAsString2 == "前穴")) { if (!(cellAsString2 == "後穴")) { if (cellAsString2 == "両穴") { if (status_.seikeiken != Seikeiken.Yes_Yes) { return false; } } } else if (status_.seikeiken != Seikeiken.No_Yes) { return false; } } else if (status_.seikeiken != Seikeiken.Yes_No) { return false; } } else if (status_.seikeiken != Seikeiken.No_No) { return false; } } int[] array = new int[] { status_.inyoku, status_.mvalue, status_.hentai, status_.housi }; int num = 3; foreach (int num2 in array) { if (csv.IsCellToExistData(cur_block.GetOriginalX(num++), line_y)) { int cellAsInteger = csv.GetCellAsInteger(cur_block.GetOriginalX(num - 1), line_y); if (cellAsInteger > num2) { return false; } } } comment_no = 0; int cellAsInteger2 = csv.GetCellAsInteger(cur_block.GetOriginalX(num++), line_y); if (0 < cellAsInteger2) { if (cellAsInteger2 > status_.lovely && cellAsInteger2 > status_.elegance && cellAsInteger2 > status_.charm) { return false; } SortedList sortedList = new SortedList(); sortedList.Add(status_.lovely, "可憐"); if (!sortedList.ContainsKey(status_.elegance)) { sortedList.Add(status_.elegance, "気品"); } if (!sortedList.ContainsKey(status_.charm)) { sortedList.Add(status_.charm, "魅惑"); } int num3 = sortedList.Count - 1; int num4 = 0; foreach (KeyValuePair keyValuePair in sortedList) { if (num3 == num4) { string value = keyValuePair.Value; if (value != null) { if (!(value == "気品")) { if (value == "魅惑") { comment_no = 2; } } else { comment_no = 1; } } break; } num4++; } } return true; }; csvDataBlock5.BlockAnalysis(1, line_func16, success_call_back2); } } text = "profile_comment_6.nei"; using (AFileBase afileBase6 = GameUty.FileSystem.FileOpen(text)) { NDebug.Assert(afileBase6.IsValid(), "file open failed.\n" + text); using (CsvParser csvParser2 = new CsvParser()) { if (!csvParser2.Open(afileBase6)) { NDebug.Assert("csv open failed.\n" + text, false); } MaidProfile.CsvDataBlock csvDataBlock6 = new MaidProfile.CsvDataBlock(csvParser2, 0); csvDataBlock6.NextBlock(); Func line_func17 = delegate(MaidProfile.CsvDataBlock cur_block, int line_y) { if (!cur_block.csv.IsCellToExistData(cur_block.GetOriginalX(1), line_y)) { return true; } string cellAsString = cur_block.csv.GetCellAsString(cur_block.GetOriginalX(1), line_y); Feature.Data data = Feature.GetData(cellAsString); return status_.features.ContainsKey(data.id); }; csvDataBlock6.BlockAnalysis(1, line_func17, success_call_back); } } text = "profile_comment_7.nei"; using (AFileBase afileBase7 = GameUty.FileSystem.FileOpen(text)) { NDebug.Assert(afileBase7.IsValid(), "file open failed.\n" + text); using (CsvParser csvParser3 = new CsvParser()) { if (!csvParser3.Open(afileBase7)) { NDebug.Assert("csv open failed.\n" + text, false); } MaidProfile.CsvDataBlock csvDataBlock7 = new MaidProfile.CsvDataBlock(csvParser3, 0); csvDataBlock7.NextBlock(); Func line_func18 = delegate(MaidProfile.CsvDataBlock cur_block, int line_y) { if (!cur_block.csv.IsCellToExistData(cur_block.GetOriginalX(1), line_y)) { return true; } string cellAsString = cur_block.csv.GetCellAsString(cur_block.GetOriginalX(1), line_y); Feature.Data data = Feature.GetData(cellAsString); return status_.features.ContainsKey(data.id); }; csvDataBlock7.BlockAnalysis(1, line_func18, success_call_back); csvDataBlock7.NextBlock(); csvDataBlock7.BlockAnalysis(1, line_func18, success_call_back); csvDataBlock7.NextBlock(); csvDataBlock7.BlockAnalysis(1, line_func18, success_call_back); } } return profileText; } public static int UpdateInitPlayNumber(Maid maid) { Status status = maid.status; int result = 0; if (status.initSeikeiken != Seikeiken.No_No) { using (AFileBase afileBase = GameUty.FileSystem.FileOpen("init_keiken_num_setting.nei")) { int size = afileBase.GetSize(); NDebug.Assert(afileBase.IsValid(), "file open failed.\ninit_keiken_num_setting.nei"); using (CsvParser csvParser = new CsvParser()) { if (!csvParser.Open(afileBase)) { NDebug.Assert("csv open failed.\ninit_keiken_num_setting.nei", false); } for (int i = 2; i < csvParser.max_cell_y; i++) { if (!csvParser.IsCellToExistData(0, i)) { break; } int num = 0; string cellAsString = csvParser.GetCellAsString(num++, i); Seikeiken seikeiken = Seikeiken.Yes_No; if (cellAsString == "前穴") { seikeiken = Seikeiken.Yes_No; } else if (cellAsString == "後穴") { seikeiken = Seikeiken.No_Yes; } else if (cellAsString == "両穴") { seikeiken = Seikeiken.Yes_Yes; } if (seikeiken == status.initSeikeiken) { int cellAsInteger = csvParser.GetCellAsInteger(num++, i); int cellAsInteger2 = csvParser.GetCellAsInteger(num++, i); int cellAsInteger3 = csvParser.GetCellAsInteger(num++, i); if (cellAsInteger2 <= status.inyoku && cellAsInteger3 <= status.hentai) { result = cellAsInteger; break; } } } } } } return result; } private const string FileNameProfileComment = "profile_comment"; private class DataBlock { public int GetOriginalX(int x) { return this.rect.left + x; } public int GetOriginalY(int y) { return this.rect.top + y; } public int max_x { get { return this.rect.right - this.rect.left + 1; } } public int max_y { get { return this.rect.bottom - this.rect.top + 1; } } public PlaneRect rect; } private class CsvDataBlock : MaidProfile.DataBlock { public CsvDataBlock(CsvParser check_csv, int check_start_y) { this.csv_ = check_csv; this.NextBlock(check_start_y); } public bool NextBlock(int check_start_y) { this.rect.left = 0; this.rect.bottom = this.csv_.max_cell_y - 1; for (int i = check_start_y; i < this.csv_.max_cell_y; i++) { if (this.csv_.IsCellToExistData(0, i)) { this.rect.top = i; int j; for (j = 0; j < this.csv_.max_cell_x; j++) { if (!this.csv_.IsCellToExistData(j, i)) { break; } } j--; this.rect.right = j; break; } } if (this.rect.right <= 0) { this.rect.left = (this.rect.right = (this.rect.top = (this.rect.bottom = 0))); return false; } for (int k = this.rect.top; k < this.csv_.max_cell_y; k++) { bool flag = false; for (int l = 0; l <= this.rect.right; l++) { if (this.csv_.IsCellToExistData(l, k)) { flag = true; break; } } if (!flag) { this.rect.bottom = k - 1; break; } } for (int m = this.rect.left; m < this.csv_.max_cell_x; m++) { for (int n = this.rect.top; n <= this.rect.bottom; n++) { if (this.csv_.IsCellToExistData(m, n) && this.rect.right < m - 1) { this.rect.right = m - 1; } } } return true; } public void BlockAnalysis(int start_y, Func line_func, Func success_call_back) { for (int i = start_y; i < base.max_y; i++) { if (line_func(this, base.GetOriginalY(i)) && success_call_back(this, this.rect.left, i)) { return; } } } public bool NextBlock() { return this.NextBlock(base.GetOriginalY(base.max_y)); } public CsvParser csv { get { return this.csv_; } } private CsvParser csv_; } } }