using System; using System.IO; using MaidStatus; using UnityEngine; using wf; namespace scoutmode { public class ScoutMaidOverrideData : ICloneable { public string guid { get; private set; } public bool enabled { get; private set; } public void CreateStatus(ScoutMaidData.SimpleStatus status) { this.enabled = true; this.guid = Guid.NewGuid().ToString(); this.status.SetStatus(status); } public void Apply(Maid maid) { if (!this.enabled) { return; } if (!string.IsNullOrEmpty(this.guid)) { maid.status.SetNewGuidAndCreationTime(this.guid, maid.status.creationTime); } MaidStatus.Status status = maid.status; status.SetPersonal(this.status.personalId); status.seikeiken = (status.initSeikeiken = this.status.seikeiken); status.baseLovely = this.status.lovely; status.baseElegance = this.status.elegance; status.baseCharm = this.status.charm; status.baseCooking = this.status.cooking; status.baseDance = this.status.dance; status.baseVocal = this.status.vocal; status.baseInyoku = this.status.inyoku; status.baseMvalue = this.status.mvalue; status.baseHentai = this.status.hentai; status.baseHousi = this.status.housi; } public void Destroy() { this.enabled = false; } public byte[] Serialize() { MemoryStream memoryStream = new MemoryStream(); BinaryWriter binaryWriter = new BinaryWriter(memoryStream); binaryWriter.Write("COM3D2_SCOUT_OVERRIDE_DATA"); binaryWriter.Write(1000); binaryWriter.Write((this.guid != null) ? this.guid : string.Empty); binaryWriter.Write(JsonUtility.ToJson(this.status)); binaryWriter.Write(this.enabled); int num = (this.iconImageBinary != null && this.iconImageBinary.Length > 0) ? this.iconImageBinary.Length : 0; binaryWriter.Write(num); if (num > 0) { binaryWriter.Write(this.iconImageBinary); } num = ((this.pressetBinary != null && this.pressetBinary.Length > 0) ? this.pressetBinary.Length : 0); binaryWriter.Write(num); if (num > 0) { binaryWriter.Write(this.pressetBinary); } return memoryStream.ToArray(); } public void DeSerialize(byte[] data) { MemoryStream input = new MemoryStream(data); BinaryReader binaryReader = new BinaryReader(input); NDebug.Assert(binaryReader.ReadString() == "COM3D2_SCOUT_OVERRIDE_DATA", "ScoutMaidData::ScoutMaidOverrideData::DeSerialize Header Check error."); int num = binaryReader.ReadInt32(); this.guid = binaryReader.ReadString(); this.status = JsonUtility.FromJson(binaryReader.ReadString()); this.enabled = binaryReader.ReadBoolean(); int num2 = binaryReader.ReadInt32(); this.iconImageBinary = ((num2 > 0) ? binaryReader.ReadBytes(num2) : null); num2 = binaryReader.ReadInt32(); this.pressetBinary = ((num2 > 0) ? binaryReader.ReadBytes(num2) : null); } public object Clone() { ScoutMaidOverrideData scoutMaidOverrideData = (ScoutMaidOverrideData)base.MemberwiseClone(); scoutMaidOverrideData.status = JsonUtility.FromJson(JsonUtility.ToJson(this.status)); scoutMaidOverrideData.iconImageBinary = ((this.iconImageBinary != null && this.iconImageBinary.Length > 0) ? ((byte[])this.iconImageBinary.Clone()) : null); scoutMaidOverrideData.pressetBinary = ((this.pressetBinary != null && this.pressetBinary.Length > 0) ? ((byte[])this.pressetBinary.Clone()) : null); return scoutMaidOverrideData; } private const int FixVersion = 1000; public ScoutMaidOverrideData.Status status = new ScoutMaidOverrideData.Status(); public byte[] iconImageBinary; public byte[] pressetBinary; [Serializable] public class Status : ISerializationCallbackReceiver { public Personal.Data personal { get { return Personal.GetData(this.personalId); } } public void SetStatus(ScoutMaidData.SimpleStatus status) { this.personalId = status.personalId; this.seikeiken = status.seikeiken; this.lovely = status.lovely; this.elegance = status.elegance; this.charm = status.charm; this.cooking = status.cooking; this.dance = status.dance; this.vocal = status.vocal; this.inyoku = status.inyoku; this.mvalue = status.mvalue; this.hentai = status.hentai; this.housi = status.housi; } public void ClearStatus() { this.lovely = 0; this.elegance = 0; this.charm = 0; this.cooking = 0; this.dance = 0; this.vocal = 0; this.inyoku = 0; this.mvalue = 0; this.hentai = 0; this.housi = 0; } public bool AddRandomStatusValue(int value) { switch (UnityEngine.Random.Range(0, 10)) { case 0: if (this.lovely == 9999) { return false; } this.lovely = wf.Math.Round4(this.lovely + value); break; case 1: if (this.elegance == 9999) { return false; } this.elegance = wf.Math.Round4(this.elegance + value); break; case 2: if (this.charm == 9999) { return false; } this.charm = wf.Math.Round4(this.charm + value); break; case 3: if (this.cooking == 9999) { return false; } this.cooking = wf.Math.Round4(this.cooking + value); break; case 4: if (this.dance == 9999) { return false; } this.dance = wf.Math.Round4(this.dance + value); break; case 5: if (this.vocal == 9999) { return false; } this.vocal = wf.Math.Round4(this.vocal + value); break; case 6: if (this.inyoku == 9999) { return false; } this.inyoku = wf.Math.Round4(this.inyoku + value); break; case 7: if (this.mvalue == 9999) { return false; } this.mvalue = wf.Math.Round4(this.mvalue + value); break; case 8: if (this.hentai == 9999) { return false; } this.hentai = wf.Math.Round4(this.hentai + value); break; case 9: if (this.housi == 9999) { return false; } this.housi = wf.Math.Round4(this.housi + value); break; } return true; } public void OnBeforeSerialize() { this.version = 1000; } public void OnAfterDeserialize() { } public int version = 1000; public int personalId; public Seikeiken seikeiken; public int lovely; public int elegance; public int charm; public int cooking; public int dance; public int vocal; public int inyoku; public int mvalue; public int hentai; public int housi; } } }