using System;
using System.Collections.Generic;
using System.IO;

namespace MaidStatus.Old
{
	public class StatusReader
	{
		public StatusReader(BinaryReader reader, int day)
		{
			string a = reader.ReadString();
			NDebug.Assert(a == "CM3D2_MAID_PPARAM", "メイドパラメータのヘッダーが不正です。");
			int num = reader.ReadInt32();
			this.guid = reader.ReadString();
			this.creationTime = reader.ReadString();
			this.creationTimeNum = reader.ReadUInt64();
			this.employmentDay = reader.ReadInt32();
			this.employmentElapsedDay = day - this.employmentDay;
			this.maidPoint = reader.ReadInt32();
			this.lastName = reader.ReadString();
			this.firstName = reader.ReadString();
			this.profileComment = reader.ReadString();
			this.freeComment = reader.ReadString();
			this.initSeikeiken = (Seikeiken)reader.ReadInt32();
			this.seikeiken = (Seikeiken)reader.ReadInt32();
			this.personal = (Personal)reader.ReadInt32();
			this.contract = (Contract)reader.ReadInt32();
			this.maidClassDatas = new List<StatusReader.ClassData>();
			int num2 = reader.ReadInt32();
			for (int i = 0; i < num2; i++)
			{
				this.maidClassDatas.Add(new StatusReader.ClassData(i, reader));
			}
			this.selectedMaidClass = this.maidClassDatas[reader.ReadInt32()];
			this.yotogiClassDatas = new List<StatusReader.ClassData>();
			num2 = reader.ReadInt32();
			for (int j = 0; j < num2; j++)
			{
				this.yotogiClassDatas.Add(new StatusReader.ClassData(j, reader));
			}
			this.selectedYotogiClass = this.yotogiClassDatas[reader.ReadInt32()];
			this.features = new List<int>();
			num2 = reader.ReadInt32();
			for (int k = 0; k < num2; k++)
			{
				this.features.Add(reader.ReadInt32());
			}
			this.propensitys = new List<int>();
			num2 = reader.ReadInt32();
			for (int l = 0; l < num2; l++)
			{
				this.propensitys.Add(reader.ReadInt32());
			}
			this.body = new StatusReader.Body(reader);
			this.relation = (Relation)reader.ReadInt32();
			this.condition = (Condition)reader.ReadInt32();
			this.playCountYotogi = reader.ReadInt32();
			this.playCountNightWork = reader.ReadInt32();
			this.likability = reader.ReadInt32();
			this.studyRate = reader.ReadInt32();
			this.currentHp = reader.ReadInt32();
			this.maxHp = reader.ReadInt32();
			this.currentMind = reader.ReadInt32();
			this.maxMind = reader.ReadInt32();
			this.currentReason = reader.ReadInt32();
			this.reason = reader.ReadInt32();
			this.reception = reader.ReadInt32();
			this.care = reader.ReadInt32();
			this.lovely = reader.ReadInt32();
			this.inyoku = reader.ReadInt32();
			this.elegance = reader.ReadInt32();
			this.mvalue = reader.ReadInt32();
			this.charm = reader.ReadInt32();
			this.hentai = reader.ReadInt32();
			this.housi = reader.ReadInt32();
			this.teachRate = reader.ReadInt32();
			this.sexual = new Sexual();
			this.sexual.Deserialize(reader, num);
			this.sexPlayNumberOfPeople = reader.ReadInt32();
			reader.ReadInt32();
			this.popularRank = reader.ReadInt32();
			this.evaluation = reader.ReadInt64();
			this.totalEvaluations = reader.ReadInt64();
			this.sales = reader.ReadInt64();
			this.totalSales = reader.ReadInt64();
			if (num > 6)
			{
				this.isFirstNameCall = reader.ReadBoolean();
			}
			else
			{
				this.isFirstNameCall = true;
			}
			if (num > 8)
			{
				this.isRentalMaid = reader.ReadBoolean();
			}
			else
			{
				this.isRentalMaid = false;
			}
			reader.ReadInt32();
			reader.ReadInt32();
			this.yotogiSkillDatas = new Dictionary<int, StatusReader.SkillData>();
			num2 = reader.ReadInt32();
			for (int m = 0; m < num2; m++)
			{
				int key = reader.ReadInt32();
				StatusReader.SkillData value = new StatusReader.SkillData(reader);
				this.yotogiSkillDatas.Add(key, value);
			}
			this.workDatas = new Dictionary<int, StatusReader.WorkData>();
			num2 = reader.ReadInt32();
			for (int n = 0; n < num2; n++)
			{
				reader.ReadInt32();
				StatusReader.WorkData workData = new StatusReader.WorkData(reader);
				if (!this.workDatas.ContainsKey(workData.id))
				{
					this.workDatas.Add(workData.id, workData);
				}
			}
			this.flags = new Dictionary<string, int>();
			num2 = reader.ReadInt32();
			for (int num3 = 0; num3 < num2; num3++)
			{
				string key2 = reader.ReadString();
				int value2 = reader.ReadInt32();
				this.flags.Add(key2, value2);
			}
			reader.ReadBoolean();
			this.leader = reader.ReadBoolean();
			reader.ReadInt32();
			this.partsDic = new Dictionary<string, string>();
			num2 = reader.ReadInt32();
			for (int num4 = 0; num4 < num2; num4++)
			{
				string key3 = reader.ReadString();
				string value3 = reader.ReadString();
				this.partsDic.Add(key3, value3);
			}
			for (int num5 = 0; num5 < 12; num5++)
			{
				reader.ReadInt32();
			}
			int num6 = reader.ReadInt32();
			NDebug.Assert(1923480616 == num6, "メイドパラメータのロードに失敗しました");
		}

		public string guid;

		public string creationTime;

		public ulong creationTimeNum;

		public int employmentDay;

		public int employmentElapsedDay;

		public int maidPoint;

		public string lastName;

		public string firstName;

		public string profileComment;

		public string freeComment;

		public Seikeiken initSeikeiken;

		public Seikeiken seikeiken;

		public Personal personal;

		public Contract contract;

		public List<StatusReader.ClassData> maidClassDatas;

		public StatusReader.ClassData selectedMaidClass;

		public List<StatusReader.ClassData> yotogiClassDatas;

		public StatusReader.ClassData selectedYotogiClass;

		public List<int> features;

		public List<int> propensitys;

		public StatusReader.Body body;

		public Sexual sexual;

		public Relation relation;

		public Condition condition;

		public int playCountYotogi;

		public int playCountNightWork;

		public int likability;

		public int studyRate;

		public int currentHp;

		public int maxHp;

		public int currentMind;

		public int maxMind;

		public int currentReason;

		public int reason;

		public int reception;

		public int care;

		public int lovely;

		public int inyoku;

		public int elegance;

		public int mvalue;

		public int charm;

		public int hentai;

		public int housi;

		public int teachRate;

		public int sexPlayNumberOfPeople;

		public int popularRank;

		public long evaluation;

		public long totalEvaluations;

		public long sales;

		public long totalSales;

		public bool isFirstNameCall;

		public bool isRentalMaid;

		public bool leader;

		public Dictionary<int, StatusReader.SkillData> yotogiSkillDatas;

		public Dictionary<int, StatusReader.WorkData> workDatas;

		public Dictionary<string, int> flags;

		public Dictionary<string, string> partsDic;

		public enum Feature
		{
			Null,
			元気な笑顔,
			朗らかな魅力,
			優美,
			純真無垢,
			天使,
			魅了,
			大人びた魅力,
			魔性の魅力,
			凜とした,
			高貴,
			恥ずかしがり屋,
			素直,
			妖艶な魅力,
			上品,
			優雅,
			とことん尽くす,
			傅く,
			過去の秘密,
			疲労,
			過去の過ち,
			雅,
			撫子,
			一途,
			盲目的,
			風雅,
			母性的,
			女神,
			無防備,
			小悪魔,
			落ち着きがある,
			礼儀正しい,
			妹系,
			元気,
			ハニ\u30FCトラップ,
			傾国の美女,
			Max
		}

		public enum Propensity
		{
			Null,
			淫乱,
			M女,
			尻穴好き,
			二穴好き,
			変態,
			奉仕好き,
			中出し好き,
			飲精好き,
			Max
		}

		public class WorkData
		{
			public WorkData(BinaryReader reader)
			{
				this.id = reader.ReadInt32();
				this.play_count = reader.ReadUInt32();
				this.level = reader.ReadInt32();
			}

			public MaidStatus.WorkData toNewWorkData()
			{
				return new MaidStatus.WorkData
				{
					id = this.id,
					playCount = this.play_count,
					level = this.level
				};
			}

			public int id;

			public uint play_count;

			public int level;
		}

		public class ClassData
		{
			public ClassData(int classId, BinaryReader reader)
			{
				this.classId = classId;
				this.isHave = reader.ReadBoolean();
				this.currentExp = reader.ReadInt32();
				this.totalExp = reader.ReadInt32();
				this.nextExp = reader.ReadInt32();
				this.level = reader.ReadInt32();
			}

			public readonly int classId;

			public readonly bool isHave;

			public readonly int currentExp;

			public readonly int totalExp;

			public readonly int nextExp;

			public readonly int level;
		}

		public class SkillData
		{
			public SkillData(BinaryReader reader)
			{
				this.id = reader.ReadInt32();
				this.playCount = reader.ReadUInt32();
				this.currentExp = reader.ReadInt32();
				this.totalExp = reader.ReadInt32();
				this.nextExp = reader.ReadInt32();
				this.level = reader.ReadInt32();
			}

			public readonly int id;

			public readonly uint playCount;

			public readonly int currentExp;

			public readonly int totalExp;

			public readonly int nextExp;

			public readonly int level;
		}

		public class Body
		{
			public Body(BinaryReader reader)
			{
				this.height = reader.ReadInt32();
				this.weight = reader.ReadInt32();
				this.bust = reader.ReadInt32();
				this.waist = reader.ReadInt32();
				this.hip = reader.ReadInt32();
				this.cup = reader.ReadString();
			}

			public int height;

			public int weight;

			public int bust;

			public int waist;

			public int hip;

			public string cup;
		}
	}
}
