using System; using System.Collections.Generic; using System.Globalization; using System.IO; using System.Text.RegularExpressions; using Edit; using MaidStatus.CsvData; using MaidStatus.Old; using UnityEngine; using wf; using Yotogis; namespace MaidStatus { public class Status { public Status() { Feature.CreateData(); Propensity.CreateData(); YotogiClass.CreateData(); JobClass.CreateData(); Personal.CreateData(); SubMaid.CreateData(); this.body = new BodyData(); this.features_ = new Dictionary(); this.features = new ReadOnlyDictionary(this.features_); this.propensitys_ = new Dictionary(); this.propensitys = new ReadOnlyDictionary(this.propensitys_); this.jobClass = new JobClassSystem(this); this.yotogiClass = new YotogiClassSystem(this); this.yotogiSkill = new YotogiSkillSystem(this); this.workDatas_ = new Dictionary(); this.workDatas = new ReadOnlyDictionary(this.workDatas_); this.flags_ = new Dictionary(); this.flags = new ReadOnlyDictionary(this.flags_); this.eventEndFlags_ = new Dictionary(); this.eventEndFlags = new ReadOnlyDictionary(this.eventEndFlags_); this.partsDic = new Dictionary(); this.bonusStatus = new BonusStatus(); this.SetPersonal(Personal.GetData("Muku")); this.heroineType = HeroineType.Original; this.mainChara = false; this.subCharaData = null; this.firstName = MaidRandomName.GetFirstName(); this.lastName = MaidRandomName.GetLastName(); this.isFirstNameCall = true; this.enabledYotogiStatusLock = false; string empty = string.Empty; this.freeComment = empty; this.profileComment = empty; } public static int maxNameLength { get { return (!Product.isEnglish) ? 8 : 11; } } public static int minAge { get { return 20; } } public static int maxAge { get { return 999; } } public string guid { get; private set; } public string creationTime { get; private set; } public ulong creationTimeNum { get; private set; } public Maid maid { get; private set; } public SubMaid.Data.CharacterStatus subCharaStatus { get { return (this.subCharaData != null) ? ((!GameMain.Instance.CharacterMgr.status.lockUserDraftMaid || this.subCharaData.secondStatus == null) ? this.subCharaData.status : this.subCharaData.secondStatus) : null; } } public int employmentDay { get { return this.employmentDay_; } set { this.employmentDay_ = wf.Math.Round5(value); } } public int employmentElapsedDay { get { int num = GameMain.Instance.CharacterMgr.status.days - this.employmentDay_; num += ((this.OldStatus != null) ? this.OldStatus.employmentElapsedDay : 0); return wf.Math.Round5(num); } } public string lastName { get { return this.lastName_; } set { this.lastName_ = ((value != null) ? Status.ConvertString(value, Status.maxNameLength) : string.Empty); } } public string firstName { get { return this.firstName_; } set { this.firstName_ = ((value != null) ? Status.ConvertString(value, Status.maxNameLength) : string.Empty); } } public NamePair charaName { get { NamePair result = new NamePair((!Product.isEnglish) ? this.lastName : this.firstName, (!Product.isEnglish) ? this.firstName : this.lastName); return result; } } public string fullNameJpStyle { get { return this.lastName + " " + this.firstName; } } public string fullNameEnStyle { get { return this.firstName + " " + this.lastName; } } public string nickName { get { return this.nickName_; } set { this.nickName_ = ((value != null) ? Status.ConvertString(value, Status.maxNameLength) : string.Empty); } } public string callName { get { return (!this.isNickNameCall) ? ((!this.isFirstNameCall) ? this.lastName : this.firstName) : this.nickName; } } public string freeComment { get { return this.freeComment_; } set { this.freeComment_ = ((value != null) ? Status.ConvertString(value, 308) : string.Empty); } } public Personal.Data personal { get { return this.personal_; } } public ClassData selectedJobClass { get; private set; } public ClassData selectedYotogiClass { get; private set; } public Relation relation { get { return this.relation_; } set { this.relation_ = value; if (this.OldStatus != null) { if (value == Relation.Contact && this.OldStatus.relation != Relation.Contact) { this.OldStatus.relation = Relation.Contact; } else if (value == Relation.Trust && this.OldStatus.relation != Relation.Trust) { this.OldStatus.relation = Relation.Trust; } else if (value == Relation.Lover && this.OldStatus.relation != Relation.Lover) { this.OldStatus.relation = Relation.Lover; } } } } public AdditionalRelation additionalRelation { get { return this.additionalRelation_; } set { if (Product.enabeldAdditionalRelation && this.personal.enabledAdditionalRelation) { this.additionalRelation_ = ((this.heroineType == HeroineType.Sub) ? AdditionalRelation.Null : value); } else { this.additionalRelation_ = AdditionalRelation.Null; } } } public string conditionText { get { return Title.Get(this); } } public string conditionTermText { get { return "MaidStatus/ステータス称号/" + this.conditionText; } } public int playCountYotogi { get { return (int)this.playCountYotogi_; } set { this.playCountYotogi_ = (ushort)wf.Math.Round4(value); } } public int playCountNightWork { get { return (int)this.playCountNightWork_; } set { this.playCountNightWork_ = (ushort)wf.Math.Round4(value); } } public int likability { get { return (int)this.likability_; } set { this.likability_ = (ushort)wf.Math.Round3(value); } } public int studyRate { get { return (int)this.studyRate_; } set { this.studyRate_ = (ushort)wf.Math.RoundMinMax(value, 0, 1000); } } public int currentExcite { get { return this.currentExcite_; } set { this.currentExcite_ = wf.Math.RoundMinMax(value, -100, 300); } } public int currentSensual { get { return this.currentSensual_; } set { this.currentSensual_ = wf.Math.RoundMinMax(value, 0, 300); } } public int maxHp { get { return wf.Math.Round3((int)this.maxHp_ + this.bonusStatus.hp); } } public int baseMaxHp { get { return (int)this.maxHp_; } set { this.maxHp_ = (ushort)wf.Math.Round3(value); } } public int currentHp { get { return (int)this.currentHp_; } set { this.currentHp_ = (ushort)wf.Math.RoundMinMax(value, 0, this.maxHp); } } public int maxMind { get { return wf.Math.Round3((int)this.maxMind_ + this.bonusStatus.mind); } } public int baseMaxMind { get { return (int)this.maxMind_; } set { this.maxMind_ = (ushort)wf.Math.Round3(value); } } public int currentMind { get { return (int)this.currentMind_; } set { this.currentMind_ = (ushort)wf.Math.RoundMinMax(value, 0, this.maxMind); } } public int maxReason { get { return wf.Math.Round3((int)this.maxReason_ + this.bonusStatus.reason); } } public int baseMaxReason { get { return (int)this.maxReason_; } set { this.maxReason_ = (ushort)wf.Math.Round3(value); } } public int currentReason { get { return (int)this.currentReason_; } set { this.currentReason_ = (ushort)wf.Math.RoundMinMax(value, 0, this.maxReason); } } public int reception { get { return wf.Math.Round4((int)this.reception_ + this.bonusStatus.reception); } } public int baseReception { get { return (int)this.reception_; } set { this.reception_ = (ushort)wf.Math.Round4(value); } } public int care { get { return wf.Math.Round4((int)this.care_ + this.bonusStatus.care); } } public int baseCare { get { return (int)this.care_; } set { this.care_ = (ushort)wf.Math.Round4(value); } } public int lovely { get { return wf.Math.Round4((int)this.lovely_ + this.bonusStatus.lovely); } } public int baseLovely { get { return (int)this.lovely_; } set { this.lovely_ = (ushort)wf.Math.Round4(value); } } public int elegance { get { return wf.Math.Round4((int)this.elegance_ + this.bonusStatus.elegance); } } public int baseElegance { get { return (int)this.elegance_; } set { this.elegance_ = (ushort)wf.Math.Round4(value); } } public int charm { get { return wf.Math.Round4((int)this.charm_ + this.bonusStatus.charm); } } public int baseCharm { get { return (int)this.charm_; } set { this.charm_ = (ushort)wf.Math.Round4(value); } } public int cooking { get { return wf.Math.Round4((int)this.cooking_ + this.bonusStatus.charm); } } public int baseCooking { get { return (int)this.cooking_; } set { this.cooking_ = (ushort)wf.Math.Round4(value); } } public int vocal { get { return wf.Math.Round4((int)this.vocal_ + this.bonusStatus.vocal); } } public int baseVocal { get { return (int)this.vocal_; } set { this.vocal_ = (ushort)wf.Math.Round4(value); } } public int dance { get { return wf.Math.Round4((int)this.dance_ + this.bonusStatus.dance); } } public int baseDance { get { return (int)this.dance_; } set { this.dance_ = (ushort)wf.Math.Round4(value); } } public int appealPoint { get { return wf.Math.RoundMinMax((int)this.appealPoint_ + this.bonusStatus.appealPoint, 0, this.maxAppealPoint); } } public int baseAppealPoint { get { return (int)this.appealPoint_; } set { this.appealPoint_ = (ushort)wf.Math.RoundMinMax(value, 0, this.maxAppealPoint); } } public int maxAppealPoint { get { return 200 + wf.Math.Round4(this.dance) / 1000 * 200; } } public int inyoku { get { return wf.Math.Round4((int)this.inyoku_ + this.bonusStatus.inyoku); } } public int baseInyoku { get { return (int)this.inyoku_; } set { this.inyoku_ = (ushort)wf.Math.Round4(value); } } public int mvalue { get { return wf.Math.Round4((int)this.m_value_ + this.bonusStatus.mvalue); } } public int baseMvalue { get { return (int)this.m_value_; } set { this.m_value_ = (ushort)wf.Math.Round4(value); } } public int hentai { get { return wf.Math.Round4((int)this.hentai_ + this.bonusStatus.hentai); } } public int baseHentai { get { return (int)this.hentai_; } set { this.hentai_ = (ushort)wf.Math.Round4(value); } } public int housi { get { return wf.Math.Round4((int)this.housi_ + this.bonusStatus.housi); } } public int baseHousi { get { return (int)this.housi_; } set { this.housi_ = (ushort)wf.Math.Round4(value); } } public int teachRate { get { return wf.Math.Round4((int)this.teachRate_ + this.bonusStatus.teachRate); } } public int baseTeachRate { get { return (int)this.teachRate_; } set { this.teachRate_ = (ushort)wf.Math.Round4(value); } } public int sexPlayNumberOfPeople { get { return (int)this.sexPlayNumberOfPeople_; } set { this.sexPlayNumberOfPeople_ = (ushort)wf.Math.Round3(value); } } public int popularRank { get { return (int)this.popularRank_; } set { this.popularRank_ = (ushort)wf.Math.Round3(value); } } public int evaluation { get { return (int)this.evaluation_; } set { this.evaluation_ = (ushort)wf.Math.Round4(value); } } public long totalEvaluations { get { return this.totalEvaluation_; } set { this.totalEvaluation_ = System.Math.Min(System.Math.Max(value, 0L), 9999999999L); } } public long sales { get { return this.sales_; } set { this.sales_ = System.Math.Min(System.Math.Max(value, 0L), 9999999999L); } } public long totalSales { get { return this.totalSales_; } set { this.totalSales_ = System.Math.Min(System.Math.Max(value, 0L), 9999999999L); } } public int inranGap { get { return this.inyoku + this.lovely; } } public int mValueGap { get { return this.mvalue + this.elegance; } } public int hentaiGap { get { return this.hentai + this.charm; } } public int banishmentPrice { get { return 10000; } } public bool isNickNameCall { get { return this.flags_.ContainsKey("__isNickNameCall__") && this.flags_["__isNickNameCall__"] != 0; } set { this.flags_["__isNickNameCall__"] = ((!value) ? 0 : 1); } } public VoiceGroup voiceGroup { get { return this.voiceGroup_; } set { this.voiceGroup_ = value; if (this.maid != null && this.maid.body0 != null) { this.maid.body0.SetVoiceGroup(value); } } } public ReadOnlyDictionary features { get; private set; } public ReadOnlyDictionary propensitys { get; private set; } public JobClassSystem jobClass { get; private set; } public YotogiClassSystem yotogiClass { get; private set; } public YotogiSkillSystem yotogiSkill { get; private set; } public ReadOnlyDictionary workDatas { get; private set; } public ReadOnlyDictionary flags { get; private set; } public ReadOnlyDictionary eventEndFlags { get; private set; } public Dictionary partsDic { get; private set; } public Status OldStatus { get; private set; } public bool isCompatiblePersonality { get { return this.heroineType == HeroineType.Transfer && this.personal.compatible; } } public static string ConvertString(string str, int maxStrSize = 8) { str = Regex.Replace(str, "[\\r\\n\\t\\\\]", string.Empty); if (str.Length == 0) { str = " "; } StringInfo stringInfo = new StringInfo(str); if (maxStrSize < stringInfo.LengthInTextElements) { str = stringInfo.SubstringByTextElements(0, maxStrSize); } return str; } public void Initialize(Maid maid) { this.maid = maid; this.guid = Guid.NewGuid().ToString(); this.creationTime = DateTime.Now.ToString("G", new CultureInfo("ja-JP")).Replace("/", string.Empty); string text = this.creationTime.Replace(":", string.Empty); text = text.Replace(" ", string.Empty); this.creationTimeNum = ulong.Parse(text); this.employmentDay = GameMain.Instance.CharacterMgr.status.days; this.additionalRelation = AdditionalRelation.Vigilance; this.specialRelation = SpecialRelation.Null; List learnPossibleClassDatas = this.jobClass.GetLearnPossibleClassDatas(true, AbstractClassData.ClassType.Share | AbstractClassData.ClassType.New); foreach (JobClass.Data data in learnPossibleClassDatas) { this.jobClass.Add(data, true, true); if (this.selectedJobClass == null) { this.ChangeJobClass(data); } } List learnPossibleClassDatas2 = this.yotogiClass.GetLearnPossibleClassDatas(true, AbstractClassData.ClassType.Share | AbstractClassData.ClassType.New); foreach (YotogiClass.Data data2 in learnPossibleClassDatas2) { this.yotogiClass.Add(data2, true, true); if (this.selectedYotogiClass == null) { this.ChangeYotogiClass(data2); } } List learnPossibleSkills = Skill.GetLearnPossibleSkills(this); foreach (Skill.Data data3 in learnPossibleSkills) { this.yotogiSkill.Add(data3.id); } int num = 100; this.baseMaxReason = num; num = num; this.baseMaxMind = num; this.baseMaxHp = num; this.UpdateClassBonusStatus(); this.sexPlayNumberOfPeople = MaidProfile.UpdateInitPlayNumber(maid); this.UpdateBodyParam(); this.profileComment = MaidProfile.Create(maid, false); this.currentHp = this.maxHp; this.currentMind = this.maxMind; } public bool SetPersonal(int personalId) { return this.SetPersonal(Personal.GetData(personalId)); } public bool SetPersonal(Personal.Data data) { if (!Personal.IsEnabled(data.id) && !data.oldPersonal) { Debug.LogError("性格[" + data.drawName + "]は有効ではないので設定できません"); return false; } this.personal_ = data; this.additionalRelation = this.additionalRelation; if (this.personal_.oldPersonal) { this.heroineType = HeroineType.Transfer; if (this.OldStatus == null) { this.OldStatus = new Status(this); } } else if (this.heroineType == HeroineType.Transfer) { this.heroineType = HeroineType.Original; this.OldStatus = null; } return true; } public void SetSeikeikenFront(bool val) { if (val) { if (this.seikeiken == Seikeiken.Yes_Yes || this.seikeiken == Seikeiken.Yes_No) { return; } if (this.seikeiken == Seikeiken.No_No) { this.seikeiken = Seikeiken.Yes_No; } else { this.seikeiken = Seikeiken.Yes_Yes; } } else { if (this.seikeiken == Seikeiken.No_No || this.seikeiken == Seikeiken.No_Yes) { return; } if (this.seikeiken == Seikeiken.Yes_Yes) { this.seikeiken = Seikeiken.No_Yes; } else { this.seikeiken = Seikeiken.No_No; } } } public void SetSeikeikenBack(bool val) { if (val) { if (this.seikeiken == Seikeiken.Yes_Yes || this.seikeiken == Seikeiken.No_Yes) { return; } if (this.seikeiken == Seikeiken.No_No) { this.seikeiken = Seikeiken.No_Yes; } else { this.seikeiken = Seikeiken.Yes_Yes; } } else { if (this.seikeiken == Seikeiken.No_No || this.seikeiken == Seikeiken.Yes_No) { return; } if (this.seikeiken == Seikeiken.Yes_Yes) { this.seikeiken = Seikeiken.Yes_No; } else { this.seikeiken = Seikeiken.No_No; } } } public bool ChangeJobClass(int jobClassId) { return this.ChangeJobClass(JobClass.GetData(jobClassId)); } public bool ChangeJobClass(JobClass.Data data) { if (data == null) { return false; } if (!JobClass.IsEnabled(data.id)) { Debug.LogError("ジョブクラス[" + data.drawName + "]は有効ではないので設定できません"); return false; } if (!this.jobClass.Contains(data.id)) { Debug.LogError("ジョブクラス[" + data.drawName + "]は取得していないので設定できません"); return false; } this.selectedJobClass = this.jobClass.Get(data.id); return true; } public bool ChangeYotogiClass(int yotogiClassId) { return this.ChangeYotogiClass(YotogiClass.GetData(yotogiClassId)); } public bool ChangeYotogiClass(YotogiClass.Data data) { if (data == null) { return false; } if (!YotogiClass.IsEnabled(data.id)) { Debug.LogError("夜伽クラス[" + data.drawName + "]は有効ではないので設定できません"); return false; } if (!this.yotogiClass.Contains(data.id)) { Debug.LogError("夜伽クラス[" + data.drawName + "]は取得していないので設定できません"); return false; } this.selectedYotogiClass = this.yotogiClass.Get(data.id); return true; } public Feature.Data AddFeature(int featureId) { return this.AddFeature(Feature.GetData(featureId)); } public Feature.Data AddFeature(Feature.Data data) { if (data != null && Feature.IsEnabled(data.id) && !this.features_.ContainsKey(data.id)) { this.features_.Add(data.id, data); } return data; } public void RemoveFeature(int featureId) { this.RemoveFeature(Feature.GetData(featureId)); } public void RemoveFeature(Feature.Data data) { if (data != null && this.features_.ContainsKey(data.id)) { this.features_.Remove(data.id); } } public Propensity.Data AddPropensity(int propensityId) { return this.AddPropensity(Propensity.GetData(propensityId)); } public Propensity.Data AddPropensity(Propensity.Data data) { if (data != null && Propensity.IsEnabled(data.id) && !this.propensitys_.ContainsKey(data.id)) { this.propensitys_.Add(data.id, data); } return data; } public void RemovePropensity(int featureId) { this.RemovePropensity(Propensity.GetData(featureId)); } public void RemovePropensity(Propensity.Data data) { if (data != null && this.propensitys_.ContainsKey(data.id)) { this.propensitys_.Remove(data.id); } } public void AddWorkDataPlayCount(int id, int addPlayCount) { if (!this.workDatas_.ContainsKey(id)) { this.workDatas_.Add(id, new WorkData()); } this.workDatas_[id].playCount += (uint)addPlayCount; } public void SetWorkDataLevel(int id, int level) { if (!this.workDatas_.ContainsKey(id)) { this.workDatas_.Add(id, new WorkData()); } this.workDatas_[id].level = level; } public void SetFlag(string flagName, int value) { if (!this.flags_.ContainsKey(flagName)) { this.flags_.Add(flagName, value); } else { this.flags_[flagName] = value; } } public void AddFlag(string flagName, int value) { if (!this.flags_.ContainsKey(flagName)) { this.flags_.Add(flagName, value); } else { Dictionary dictionary; (dictionary = this.flags_)[flagName] = dictionary[flagName] + value; } } public int GetFlag(string flagName) { return (!this.flags_.ContainsKey(flagName)) ? 0 : this.flags_[flagName]; } public bool RemoveFlag(string flagName) { return this.flags_.ContainsKey(flagName) && this.flags_.Remove(flagName); } public void SetEventEndFlag(int id, bool value) { if (this.eventEndFlags_.ContainsKey(id)) { this.eventEndFlags_[id] = value; } else { this.eventEndFlags_.Add(id, value); } } public void RemoveEventEndFlag(int id) { if (this.eventEndFlags_.ContainsKey(id)) { this.eventEndFlags_.Remove(id); } } public bool GetEventEndFlag(int id) { return this.eventEndFlags_.ContainsKey(id) && this.eventEndFlags_[id]; } public BonusStatus GetBonusStatusAsFeatureAndPropensitys() { BonusStatus result = new BonusStatus(); foreach (Feature.Data data in this.features.GetValueArray()) { if (data.bonusCorrection != null) { data.bonusCorrection.ApplyAddBonusStatus(result); } } foreach (Propensity.Data data2 in this.propensitys.GetValueArray()) { if (data2.bonusCorrection != null) { data2.bonusCorrection.ApplyAddBonusStatus(result); } } return result; } public void UpdateBodyParam() { if (this.maid.Parts == null) { return; } Func func = (MPN mpn) => (float)this.maid.GetProp(mpn).value; float num = 1340f + func(MPN.sintyou) * 4f + func(MPN.DouPer) * (1f + func(MPN.sintyou) * 0.005f) + func(MPN.KubiScl) * 0.5f + func(MPN.HeadY) * 0.5f; float num2 = 55f * func(MPN.RegFat) + 50f * func(MPN.sintyou) * 0.5f + 50f * func(MPN.DouPer) * 0.4f; float num3 = 55f * func(MPN.RegMeet) + 50f * func(MPN.sintyou) * 0.5f + 50f * func(MPN.DouPer) * 0.4f; float num4 = 10f * func(MPN.UdeScl) * 0.1f; float num5 = 5f * func(MPN.ArmL) + 5f * func(MPN.sintyou) * 1f + 5f * func(MPN.UdeScl) * 0.5f; float num6 = 70f * func(MPN.Hara) + 50f * func(MPN.sintyou) * 0.7f + 50f * func(MPN.west) * func(MPN.Hara) * 0.005f; float num7 = 10f * func(MPN.MuneL) * 2f; float num8 = num7 * func(MPN.MuneTare) * 0.005f; float num9 = 20f * func(MPN.west) * 0.5f + 15f * func(MPN.west) * func(MPN.sintyou) * 0.02f + 15f * func(MPN.west) * func(MPN.DouPer) * 0.01f; float num10 = 10f * func(MPN.koshi) + 7f * func(MPN.koshi) * func(MPN.sintyou) * 0.04f; float num11 = 4f * func(MPN.kata); float num12 = 38000f + num2 + num3 + num4 + num5 + num6 + num7 + num8 + num9 + num10 + num11; this.body.height = (int)(num / 10f); this.body.weight = (int)(num12 / 1000f); float num13 = 70f + func(MPN.MuneL) * 0.31f + func(MPN.west) * 0.02f; num13 -= 5f * (func(MPN.MuneS) / 100f); this.body.bust = (int)num13; this.body.waist = (int)(40f + func(MPN.west) * 0.25f + func(MPN.Hara) * 0.35f); this.body.hip = (int)(65f + func(MPN.koshi) * 0.3f + func(MPN.RegFat) * 0.025f + func(MPN.RegMeet) * 0.025f); if (num13 < 80f) { this.body.cup = "A"; } else if (110f <= num13) { this.body.cup = "N"; } else { char[] array = new char[] { 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M' }; this.body.cup = array[(int)((num13 - 80f) / 2.5f)].ToString(); } } public void UpdateClassBonusStatus() { this.bonusStatus.Clear(); if (this.heroineType == HeroineType.Sub) { return; } foreach (KeyValuePair> keyValuePair in this.jobClass.GetAllDatas()) { ClassData value = keyValuePair.Value; value.data.levelBonuss[value.level - 1].ApplyAddBonusStatus(this.bonusStatus); } } public void Serialize(BinaryWriter binary) { this.SetFlag("__1330_specialrelation__", (int)this.specialRelation); binary.Write("CM3D2_MAID_STATUS"); binary.Write(1430); binary.Write(this.guid); binary.Write(this.creationTime); binary.Write((short)this.heroineType); if (this.heroineType == HeroineType.Sub) { binary.Write(this.subCharaData.id); } binary.Write(this.mainChara); binary.Write(this.employmentDay_); binary.Write(this.lastName); binary.Write(this.firstName); binary.Write(this.profileComment); binary.Write(this.freeComment); binary.Write((short)this.initSeikeiken); binary.Write((short)this.seikeiken); binary.Write(this.personal_.id); binary.Write((short)this.contract); this.body.Serialize(binary); binary.Write((short)this.relation_); binary.Write(this.playCountYotogi_); binary.Write(this.playCountNightWork_); binary.Write(this.likability_); binary.Write(this.studyRate_); binary.Write(this.maxHp_); binary.Write(this.currentHp_); binary.Write(this.maxMind_); binary.Write(this.currentMind_); binary.Write(this.maxReason_); binary.Write(this.currentReason_); binary.Write(this.reception_); binary.Write(this.care_); binary.Write(this.lovely_); binary.Write(this.elegance_); binary.Write(this.charm_); binary.Write(this.cooking_); binary.Write(this.vocal_); binary.Write(this.dance_); binary.Write(this.appealPoint_); binary.Write(this.inyoku_); binary.Write(this.m_value_); binary.Write(this.hentai_); binary.Write(this.housi_); binary.Write(this.teachRate_); binary.Write(this.sexPlayNumberOfPeople_); binary.Write(this.popularRank_); binary.Write(this.sales_); binary.Write(this.totalSales_); binary.Write(this.evaluation_); binary.Write(this.totalEvaluation_); binary.Write(this.leader); binary.Write(this.isFirstNameCall); binary.Write(this.enabledYotogiStatusLock); binary.Write((short)this.eyePartsTab); binary.Write(this.noonWorkId); binary.Write(this.nightWorkId); binary.Write(this.noonCommu); binary.Write(this.nightCommu); binary.Write((short)this.features_.Count); foreach (KeyValuePair keyValuePair in this.features_) { binary.Write(keyValuePair.Key); } binary.Write((short)this.propensitys_.Count); foreach (KeyValuePair keyValuePair2 in this.propensitys_) { binary.Write(keyValuePair2.Key); } this.jobClass.Serialize(binary); this.yotogiClass.Serialize(binary); this.yotogiSkill.Serialize(binary); binary.Write((short)this.workDatas_.Count); foreach (KeyValuePair keyValuePair3 in this.workDatas_) { binary.Write(keyValuePair3.Key); keyValuePair3.Value.Serialize(binary); } binary.Write((short)this.flags_.Count); foreach (KeyValuePair keyValuePair4 in this.flags_) { binary.Write(keyValuePair4.Key); binary.Write(keyValuePair4.Value); } binary.Write((short)this.eventEndFlags_.Count); foreach (KeyValuePair keyValuePair5 in this.eventEndFlags_) { binary.Write(keyValuePair5.Key); binary.Write(keyValuePair5.Value); } binary.Write((short)this.partsDic.Count); foreach (KeyValuePair keyValuePair6 in this.partsDic) { binary.Write(keyValuePair6.Key); binary.Write(keyValuePair6.Value); } binary.Write(this.OldStatus != null); if (this.OldStatus != null) { this.OldStatus.Serialize(binary); } binary.Write(this.selectedJobClass != null); if (this.selectedJobClass != null) { binary.Write(this.selectedJobClass.data.id); } binary.Write(this.selectedYotogiClass != null); if (this.selectedYotogiClass != null) { binary.Write(this.selectedYotogiClass.data.id); } binary.Write((short)this.additionalRelation_); binary.Write(this.nickName_); binary.Write(this.age); binary.Write(2177629204u); } public void Deserialize(BinaryReader binary) { string a = binary.ReadString(); NDebug.Assert(a == "CM3D2_MAID_STATUS", "メイドパラメータのヘッダーが不正です。"); this.OldStatus = null; int num = binary.ReadInt32(); this.guid = binary.ReadString(); this.creationTime = binary.ReadString(); string text = this.creationTime.Replace(":", string.Empty); text = text.Replace(" ", string.Empty); this.creationTimeNum = ulong.Parse(text); this.heroineType = (HeroineType)binary.ReadInt16(); if (this.heroineType == HeroineType.Sub) { int id = binary.ReadInt32(); this.subCharaData = SubMaid.GetData(id); } if (205 < num) { this.mainChara = binary.ReadBoolean(); } this.employmentDay_ = binary.ReadInt32(); this.lastName = binary.ReadString(); this.firstName = binary.ReadString(); this.profileComment = binary.ReadString(); this.freeComment = binary.ReadString(); this.initSeikeiken = (Seikeiken)binary.ReadInt16(); this.seikeiken = (Seikeiken)binary.ReadInt16(); int num2 = binary.ReadInt32(); if (Personal.IsEnabled(num2)) { this.SetPersonal(num2); } else { Debug.LogWarning(this.fullNameJpStyle + " : ロードされたデータの性格[" + Personal.GetData(num2).drawName + "]は有効ではないので初期性格に強制変更しました"); this.SetPersonal(Personal.GetData("Muku")); } if (207 < num) { this.contract = (Contract)binary.ReadInt16(); } this.body.Deserialize(binary, num); this.relation_ = (Relation)binary.ReadInt16(); if (num < 215) { binary.ReadInt16(); } this.playCountYotogi_ = binary.ReadUInt16(); this.playCountNightWork_ = binary.ReadUInt16(); this.likability_ = binary.ReadUInt16(); this.studyRate_ = binary.ReadUInt16(); this.maxHp_ = binary.ReadUInt16(); this.currentHp_ = binary.ReadUInt16(); this.maxMind_ = binary.ReadUInt16(); this.currentMind_ = binary.ReadUInt16(); if (211 < num) { this.maxReason_ = binary.ReadUInt16(); this.currentReason_ = binary.ReadUInt16(); } this.reception_ = binary.ReadUInt16(); this.care_ = binary.ReadUInt16(); this.lovely_ = binary.ReadUInt16(); this.elegance_ = binary.ReadUInt16(); this.charm_ = binary.ReadUInt16(); this.cooking_ = binary.ReadUInt16(); this.vocal_ = binary.ReadUInt16(); this.dance_ = binary.ReadUInt16(); this.appealPoint_ = binary.ReadUInt16(); this.inyoku_ = binary.ReadUInt16(); this.m_value_ = binary.ReadUInt16(); this.hentai_ = binary.ReadUInt16(); this.housi_ = binary.ReadUInt16(); this.teachRate_ = binary.ReadUInt16(); this.sexPlayNumberOfPeople_ = binary.ReadUInt16(); this.popularRank_ = binary.ReadUInt16(); this.sales_ = binary.ReadInt64(); this.totalSales_ = binary.ReadInt64(); if (207 < num) { this.evaluation_ = binary.ReadUInt16(); this.totalEvaluation_ = binary.ReadInt64(); } this.leader = binary.ReadBoolean(); this.isFirstNameCall = binary.ReadBoolean(); if (202 < num) { this.enabledYotogiStatusLock = binary.ReadBoolean(); } this.eyePartsTab = (EyePartsTab)binary.ReadInt16(); this.noonWorkId = binary.ReadInt32(); this.nightWorkId = binary.ReadInt32(); this.noonCommu = binary.ReadBoolean(); this.nightCommu = binary.ReadBoolean(); int num3 = (int)binary.ReadInt16(); this.features_.Clear(); for (int i = 0; i < num3; i++) { int num4 = binary.ReadInt32(); if (Feature.IsEnabled(num4)) { this.features_.Add(num4, Feature.GetData(num4)); } } num3 = (int)binary.ReadInt16(); this.propensitys_.Clear(); for (int j = 0; j < num3; j++) { int num5 = binary.ReadInt32(); if (Propensity.IsEnabled(num5)) { this.propensitys_.Add(num5, Propensity.GetData(num5)); } } this.jobClass.Deserialize(binary, num); this.yotogiClass.Deserialize(binary, num); this.UpdateClassBonusStatus(); if (211 >= num) { num3 = (int)binary.ReadInt16(); for (int k = 0; k < num3; k++) { binary.ReadInt32(); binary.ReadUInt32(); binary.ReadUInt16(); binary.ReadInt32(); binary.ReadInt32(); binary.ReadInt32(); binary.ReadInt32(); } } else { this.yotogiSkill.Deserialize(binary, num); } num3 = (int)binary.ReadInt16(); this.workDatas_.Clear(); for (int l = 0; l < num3; l++) { int key = binary.ReadInt32(); WorkData workData = new WorkData(); workData.Deserialize(binary, num); this.workDatas_.Add(key, workData); } num3 = (int)binary.ReadInt16(); this.flags_.Clear(); for (int m = 0; m < num3; m++) { string key2 = binary.ReadString(); int value = binary.ReadInt32(); this.flags_.Add(key2, value); } if (205 < num) { num3 = (int)binary.ReadInt16(); this.eventEndFlags_.Clear(); for (int n = 0; n < num3; n++) { int key3 = binary.ReadInt32(); bool value2 = binary.ReadBoolean(); this.eventEndFlags_.Add(key3, value2); } } num3 = (int)binary.ReadInt16(); this.partsDic.Clear(); for (int num6 = 0; num6 < num3; num6++) { string key4 = binary.ReadString(); string value3 = binary.ReadString(); this.partsDic.Add(key4, value3); } if (207 < num) { bool flag = binary.ReadBoolean(); if (flag) { this.OldStatus = new Status(this); this.OldStatus.Deserialize(binary, num); } } this.selectedJobClass = null; if (binary.ReadBoolean()) { int id2 = binary.ReadInt32(); if (this.jobClass.Contains(id2)) { this.selectedJobClass = this.jobClass.Get(id2); } } if (this.selectedJobClass == null) { ClassData[] valueArray = this.jobClass.datas.GetValueArray(); int num7 = 0; if (num7 < valueArray.Length) { ClassData selectedJobClass = valueArray[num7]; this.selectedJobClass = selectedJobClass; } } this.selectedYotogiClass = null; if (binary.ReadBoolean()) { int id3 = binary.ReadInt32(); if (this.yotogiClass.Contains(id3)) { this.selectedYotogiClass = this.yotogiClass.Get(id3); } } if (this.selectedYotogiClass == null) { ClassData[] valueArray2 = this.yotogiClass.datas.GetValueArray(); int num8 = 0; if (num8 < valueArray2.Length) { ClassData selectedYotogiClass = valueArray2[num8]; this.selectedYotogiClass = selectedYotogiClass; } } this.additionalRelation_ = AdditionalRelation.Null; if (1270 <= num) { this.additionalRelation_ = (AdditionalRelation)binary.ReadInt16(); if (this.additionalRelation_ != AdditionalRelation.Null && this.heroineType == HeroineType.Sub) { this.additionalRelation_ = AdditionalRelation.Null; } this.nickName_ = binary.ReadString(); this.age = binary.ReadInt32(); if (this.additionalRelation_ == AdditionalRelation.Vigilance) { if (this.relation == Relation.Trust || this.relation == Relation.Lover) { this.additionalRelation_ = AdditionalRelation.Null; } if (this.relation == Relation.Lover) { if ((this.personal.uniqueName == "Muku" && this.GetEventEndFlag(5040)) || (this.personal.uniqueName == "Majime" && this.GetEventEndFlag(5140)) || (this.personal.uniqueName == "Rindere" && this.GetEventEndFlag(5240))) { this.additionalRelation_ = AdditionalRelation.LoverPlus; } } else if (this.relation == Relation.Contact && ((this.personal.uniqueName == "Muku" && this.GetEventEndFlag(5030)) || (this.personal.uniqueName == "Majime" && this.GetEventEndFlag(5130)) || (this.personal.uniqueName == "Rindere" && this.GetEventEndFlag(5230)))) { this.additionalRelation_ = AdditionalRelation.Null; } } } if (!PluginData.IsEnabled("GP002") || this.GetFlag("__1330_specialrelation__") == 0) { this.specialRelation = SpecialRelation.Null; } else { this.specialRelation = (SpecialRelation)this.GetFlag("__1330_specialrelation__"); } this.RemoveFlag("__1330_specialrelation__"); uint num9 = binary.ReadUInt32(); NDebug.Assert(2177629204u == num9, "メイドパラメータのロードに失敗しました"); if (num <= 1050) { YotogiClass.Data data = YotogiClass.GetData("Kokuhakuplay"); if (this.yotogiClass.Get(data) != null && this.contract != Contract.Free) { this.yotogiClass.Remove(data, true); } List list = new List(); foreach (YotogiSkillData yotogiSkillData in this.yotogiSkill.datas.GetValueArray()) { YotogiClass.Data yotogi_class = yotogiSkillData.data.getcondition_data.yotogi_class; if (yotogi_class != null && !this.yotogiClass.Contains(yotogi_class) && yotogi_class.learnConditions.requestContracts.Count != 0 && !yotogi_class.learnConditions.requestContracts.Contains(this.contract)) { list.Add(yotogiSkillData.id); } } foreach (int skillId in list) { this.yotogiSkill.Remove(skillId); } } if (num == 1380 && this.specialRelation == SpecialRelation.Null) { List list2 = new List(); foreach (YotogiSkillData yotogiSkillData2 in this.yotogiSkill.datas.GetValueArray()) { if (yotogiSkillData2.data.getcondition_data.requestMarried) { list2.Add(yotogiSkillData2.id); } } foreach (int skillId2 in list2) { this.yotogiSkill.Remove(skillId2); } } List learnPossibleSkills = Skill.GetLearnPossibleSkills(this); foreach (Skill.Data data2 in learnPossibleSkills) { if (data2.specialConditionType == Skill.Data.SpecialConditionType.GP01Recollect || data2.specialConditionType == Skill.Data.SpecialConditionType.GP02Recollect) { this.yotogiSkill.Add(data2); } } } public void Deserialize(StatusReader oldStatusReader, bool convertYotogiSkill) { Func func = (int value) => (int)System.Math.Floor((double)((float)value * 0.3f)); this.OldStatus = new Status(this); this.creationTimeNum = oldStatusReader.creationTimeNum; this.guid = oldStatusReader.guid; this.heroineType = HeroineType.Transfer; this.mainChara = false; this.employmentDay = GameMain.Instance.CharacterMgr.status.days; this.lastName = oldStatusReader.lastName; this.firstName = oldStatusReader.firstName; this.freeComment = oldStatusReader.freeComment; this.initSeikeiken = oldStatusReader.initSeikeiken; this.seikeiken = oldStatusReader.seikeiken; string uniqueName = oldStatusReader.personal.ToString(); this.SetPersonal(Personal.GetData(uniqueName)); this.contract = oldStatusReader.contract; this.additionalRelation = AdditionalRelation.Null; this.body.height = oldStatusReader.body.height; this.body.weight = oldStatusReader.body.weight; this.body.bust = oldStatusReader.body.bust; this.body.waist = oldStatusReader.body.waist; this.body.hip = oldStatusReader.body.hip; this.body.cup = oldStatusReader.body.cup; if (oldStatusReader.relation == Relation.Tonus || oldStatusReader.relation == Relation.Contact) { this.relation_ = Relation.Contact; } else if (oldStatusReader.relation == Relation.Trust) { this.relation_ = Relation.Trust; } else { this.relation_ = Relation.Lover; } this.playCountYotogi = oldStatusReader.playCountYotogi; this.playCountNightWork = oldStatusReader.playCountNightWork; this.likability = oldStatusReader.likability; this.studyRate = oldStatusReader.studyRate; int num = 100; this.baseMaxHp = num; this.currentHp = num; num = 100; this.baseMaxMind = num; this.currentMind = num; this.baseReception = func(oldStatusReader.reception); this.baseCare = func(oldStatusReader.care); this.baseLovely = func(oldStatusReader.lovely); this.baseElegance = func(oldStatusReader.elegance); this.baseCharm = func(oldStatusReader.charm); num = 0; this.baseAppealPoint = num; num = num; this.baseDance = num; num = num; this.baseVocal = num; this.baseCooking = num; this.baseInyoku = func(oldStatusReader.inyoku); this.baseMvalue = func(oldStatusReader.mvalue); this.baseHentai = func(oldStatusReader.hentai); this.baseHousi = func(oldStatusReader.housi); this.baseTeachRate = func(oldStatusReader.teachRate); this.sexPlayNumberOfPeople = oldStatusReader.sexPlayNumberOfPeople; this.popularRank = 0; num = 0; this.evaluation = num; this.sales = (long)num; this.totalSales = oldStatusReader.totalSales; this.totalEvaluations = oldStatusReader.totalEvaluations; this.leader = false; this.isFirstNameCall = oldStatusReader.isFirstNameCall; this.eyePartsTab = EyePartsTab.LR; this.noonWorkId = (this.nightWorkId = 0); this.noonCommu = (this.nightCommu = false); this.features_.Clear(); this.propensitys_.Clear(); this.jobClass.Clear(); this.yotogiClass.Clear(); this.yotogiSkill.Clear(); this.workDatas_.Clear(); this.flags_.Clear(); this.eventEndFlags_.Clear(); this.selectedJobClass = null; AbstractClassData.ClassType classTypeFlags = AbstractClassData.ClassType.Share | AbstractClassData.ClassType.New | AbstractClassData.ClassType.Old; List learnPossibleClassDatas = this.jobClass.GetLearnPossibleClassDatas(true, classTypeFlags); foreach (JobClass.Data data in learnPossibleClassDatas) { if (GameMain.Instance.CharacterMgr.status.IsJobClassOpenFlag(data.id)) { this.jobClass.Add(data, false, false); } } List learnPossibleClassDatas2 = this.yotogiClass.GetLearnPossibleClassDatas(true, classTypeFlags); foreach (YotogiClass.Data data2 in learnPossibleClassDatas2) { if (GameMain.Instance.CharacterMgr.status.IsYotogiClassOpenFlag(data2.id)) { this.yotogiClass.Add(data2, false, false); } } foreach (StatusReader.ClassData classData in oldStatusReader.maidClassDatas) { if (classData.isHave && JobClass.IsEnabled(classData.classId) && !this.jobClass.Contains(classData.classId)) { ClassData classData2 = this.jobClass.Add(classData.classId, false, false); if (classData2 != null) { classData2.expSystem.SetLevel(classData.level); } } } foreach (StatusReader.ClassData classData3 in oldStatusReader.yotogiClassDatas) { if (classData3.isHave && YotogiClass.IsEnabled(classData3.classId) && !this.yotogiClass.Contains(classData3.classId)) { ClassData classData4 = this.yotogiClass.Add(classData3.classId, false, false); if (classData4 != null) { classData4.expSystem.SetLevel(classData3.level); } } } if (oldStatusReader.selectedMaidClass != null && this.jobClass.Contains(oldStatusReader.selectedMaidClass.classId)) { this.selectedJobClass = this.jobClass.Get(oldStatusReader.selectedMaidClass.classId); } if (this.selectedJobClass == null) { ClassData[] valueArray = this.jobClass.oldDatas.GetValueArray(); int num2 = 0; if (num2 < valueArray.Length) { ClassData selectedJobClass = valueArray[num2]; this.selectedJobClass = selectedJobClass; } } if (convertYotogiSkill) { List learnPossibleSkills = Skill.GetLearnPossibleSkills(this); foreach (Skill.Data data3 in learnPossibleSkills) { this.yotogiSkill.Add(data3.id); } foreach (KeyValuePair keyValuePair in oldStatusReader.yotogiSkillDatas) { int id = keyValuePair.Value.id; int level = keyValuePair.Value.level; uint playCount = keyValuePair.Value.playCount; if (!this.yotogiSkill.Contains(id) && Skill.Old.Contains(id)) { this.yotogiSkill.Add(id); } YotogiSkillData yotogiSkillData = this.yotogiSkill.Get(id); if (yotogiSkillData != null && yotogiSkillData.oldData != null) { yotogiSkillData.expSystem.SetLevel(level); yotogiSkillData.playCount = playCount; } } } foreach (KeyValuePair keyValuePair2 in oldStatusReader.workDatas) { this.workDatas_.Add(keyValuePair2.Key, keyValuePair2.Value.toNewWorkData()); } foreach (int num3 in oldStatusReader.features) { StatusReader.Feature feature = (StatusReader.Feature)num3; string uniqueName2 = feature.ToString(); this.AddFeature(Feature.GetData(uniqueName2)); } this.OldStatus.employmentElapsedDay = oldStatusReader.employmentElapsedDay; this.OldStatus.relation = oldStatusReader.relation; Dictionary dictionary = new Dictionary(); dictionary.Add(StatusReader.Propensity.淫乱, "敏感体質"); dictionary.Add(StatusReader.Propensity.変態, "変態の素質"); dictionary.Add(StatusReader.Propensity.飲精好き, "ごっくん大好き"); dictionary.Add(StatusReader.Propensity.奉仕好き, "桃色泡姫"); dictionary.Add(StatusReader.Propensity.M女, "ドMの素質"); dictionary.Add(StatusReader.Propensity.中出し好き, "中出し大好き"); foreach (int num4 in oldStatusReader.propensitys) { StatusReader.Propensity key = (StatusReader.Propensity)num4; if (dictionary.ContainsKey(key)) { this.AddPropensity(Propensity.GetData(dictionary[key])); } } if (1000 <= oldStatusReader.sexual.curi) { this.AddPropensity(Propensity.GetData("敏感なクリトリス")); } this.partsDic = new Dictionary(oldStatusReader.partsDic); this.OldStatus.isMarriage = (oldStatusReader.flags.ContainsKey("_maid_param_marriage_flag") && oldStatusReader.flags["_maid_param_marriage_flag"] != 0); this.OldStatus.isNewWife = (oldStatusReader.flags.ContainsKey("_maid_param_newwife_flag") && oldStatusReader.flags["_maid_param_newwife_flag"] != 0); foreach (KeyValuePair keyValuePair3 in oldStatusReader.flags) { this.OldStatus.AddFlag(keyValuePair3.Key, keyValuePair3.Value); } if (!GameMain.Instance.CharacterMgr.status.isOldPlayer) { this.likability = 0; this.relation_ = Relation.Contact; this.OldStatus.isMarriage = false; this.OldStatus.isNewWife = false; } this.profileComment = MaidProfile.Create(this.maid, true); } public const int MaidPointUpStatus = 20; public const int NullID = -2147483648; private const uint SaveDataCheckCode = 2177629204u; public HeroineType heroineType; public bool mainChara; public SubMaid.Data subCharaData; public string profileComment; public int age; public Seikeiken initSeikeiken; public Seikeiken seikeiken; public Contract contract; public BodyData body; public SpecialRelation specialRelation; public int noonWorkId; public int nightWorkId; public bool noonCommu; public bool nightCommu; public bool leader; public bool isFirstNameCall; public bool enabledYotogiStatusLock; public EyePartsTab eyePartsTab; private Dictionary features_; private Dictionary propensitys_; private BonusStatus bonusStatus; private string freeComment_; private Personal.Data personal_; private int employmentDay_; private string lastName_ = string.Empty; private string firstName_ = string.Empty; private string nickName_ = string.Empty; private Relation relation_; private AdditionalRelation additionalRelation_; private ushort playCountYotogi_; private ushort playCountNightWork_; private ushort likability_; private ushort studyRate_; private int currentExcite_; private int currentSensual_; private ushort maxHp_; private ushort currentHp_; private ushort maxMind_; private ushort currentMind_; private ushort maxReason_; private ushort currentReason_; private ushort reception_; private ushort care_; private ushort lovely_; private ushort elegance_; private ushort charm_; private ushort cooking_; private ushort vocal_; private ushort dance_; private ushort appealPoint_; private ushort inyoku_; private ushort m_value_; private ushort hentai_; private ushort housi_; private ushort teachRate_; private ushort sexPlayNumberOfPeople_; private ushort popularRank_; private long sales_; private long totalSales_; private ushort evaluation_; private long totalEvaluation_; private Dictionary workDatas_; private Dictionary flags_; private Dictionary eventEndFlags_; private VoiceGroup voiceGroup_; } }