using System;
using System.IO;
using wf;
using Yotogis;

namespace MaidStatus
{
	public class YotogiSkillData
	{
		public int id
		{
			get
			{
				return (this.data == null) ? this.oldData.id : this.data.id;
			}
		}

		public uint playCount
		{
			get
			{
				return this.playCount_;
			}
			set
			{
				this.playCount_ = (uint)wf.Math.RoundMinMax((long)((ulong)value), 0L, (long)((ulong)-1));
			}
		}

		public int commandCount
		{
			get
			{
				return (int)this.commandCount_;
			}
			set
			{
				this.commandCount_ = (ushort)wf.Math.RoundMinMax(value, 0, 65535);
			}
		}

		public int level
		{
			get
			{
				return this.expSystem.GetCurrentLevel();
			}
		}

		public int currentExp
		{
			get
			{
				return this.expSystem.GetCurrentExp();
			}
		}

		public int nextExp
		{
			get
			{
				return this.expSystem.GetNextLevelExp(this.level);
			}
		}

		public void Serialize(BinaryWriter binary)
		{
			binary.Write(this.playCount_);
			binary.Write(this.commandCount_);
			binary.Write(this.lockSkillExp);
			this.expSystem.Serialize(binary);
		}

		public void Deserialize(BinaryReader binary, int version)
		{
			this.playCount_ = binary.ReadUInt32();
			this.commandCount_ = binary.ReadUInt16();
			if (213 < version)
			{
				this.lockSkillExp = binary.ReadBoolean();
			}
			this.expSystem.Deserialize(binary, version);
		}

		public Skill.Data data;

		public Skill.Old.Data oldData;

		public SimpleExperienceSystem expSystem = new SimpleExperienceSystem();

		public bool lockSkillExp;

		private uint playCount_;

		private ushort commandCount_;
	}
}
