using System;
using System.Collections.Generic;
using MaidStatus;
using PlayerStatus;
using UnityEngine;

namespace Schedule
{
	public class ScheduleCalcAPI
	{
		public static ScheduleCalcAPI.ResultSimulateParam SimulateMaidStatusResult(Maid maid, int workId, ScheduleData.WorkSuccessLv successLv = ScheduleData.WorkSuccessLv.Success, bool commu = false)
		{
			ScheduleCalcAPI.ResultSimulateParam resultSimulateParam = new ScheduleCalcAPI.ResultSimulateParam();
			if (maid == null)
			{
				return resultSimulateParam;
			}
			ScheduleCSVData.Training training = (ScheduleCSVData.Training)ScheduleCSVData.AllData[workId];
			switch (training.trainingType)
			{
			case ScheduleCSVData.TrainingType.Basic:
			case ScheduleCSVData.TrainingType.Dispatch:
			{
				int revisionLevel = ScheduleCalcAPI.GetRevisionLevel(ScheduleCalcAPI.NoonWorkPlayToLv(ScheduleCalcAPI.NoonWorkPlayCount(maid, workId)));
				double revisionFacilityLevel = ScheduleCalcAPI.GetRevisionFacilityLevel(training.facility);
				BonusStatus bonusStatusAsFeatureAndPropensitys = maid.status.GetBonusStatusAsFeatureAndPropensitys();
				double revisionFacility = ScheduleCalcAPI.GetRevisionFacility1(training.facility);
				double revisionSuccess = ScheduleCalcAPI.GetRevisionSuccess(successLv, commu);
				ScheduleCalcAPI.log.SetTarget(maid);
				resultSimulateParam.reception = ScheduleCalcAPI.Simulate_basic("接待", training.reception, revisionLevel, revisionFacilityLevel, bonusStatusAsFeatureAndPropensitys.reception, revisionFacility, revisionSuccess);
				resultSimulateParam.care = ScheduleCalcAPI.Simulate_basic("お世話", training.care, revisionLevel, revisionFacilityLevel, bonusStatusAsFeatureAndPropensitys.care, revisionFacility, revisionSuccess);
				resultSimulateParam.lovely = ScheduleCalcAPI.Simulate_basic("可燐", training.lovely, revisionLevel, revisionFacilityLevel, bonusStatusAsFeatureAndPropensitys.lovely, revisionFacility, revisionSuccess);
				resultSimulateParam.elegance = ScheduleCalcAPI.Simulate_basic("気品", training.elegance, revisionLevel, revisionFacilityLevel, bonusStatusAsFeatureAndPropensitys.elegance, revisionFacility, revisionSuccess);
				resultSimulateParam.charm = ScheduleCalcAPI.Simulate_basic("魅惑", training.charm, revisionLevel, revisionFacilityLevel, bonusStatusAsFeatureAndPropensitys.charm, revisionFacility, revisionSuccess);
				resultSimulateParam.teach_rate = ScheduleCalcAPI.Simulate_basic("指導", training.teach_rate, revisionLevel, revisionFacilityLevel, bonusStatusAsFeatureAndPropensitys.teachRate, revisionFacility, revisionSuccess);
				resultSimulateParam.cooking = ScheduleCalcAPI.Simulate_basic("料理", training.cooking, revisionLevel, revisionFacilityLevel, bonusStatusAsFeatureAndPropensitys.cooking, revisionFacility, revisionSuccess);
				resultSimulateParam.vocal = ScheduleCalcAPI.Simulate_basic("ボーカル", training.vocal, revisionLevel, revisionFacilityLevel, bonusStatusAsFeatureAndPropensitys.vocal, revisionFacility, revisionSuccess);
				resultSimulateParam.dance = ScheduleCalcAPI.Simulate_basic("ダンス", training.dance, revisionLevel, revisionFacilityLevel, bonusStatusAsFeatureAndPropensitys.dance, revisionFacility, revisionSuccess);
				resultSimulateParam.appealPoint = ScheduleCalcAPI.Simulate_basic("アピール", training.appealPoint, revisionLevel, revisionFacilityLevel, bonusStatusAsFeatureAndPropensitys.appealPoint, revisionFacility, revisionSuccess);
				resultSimulateParam.exp = ScheduleCalcAPI.Simulate_basic("ｼﾞｮﾌﾞEXP", training.exp, revisionLevel, revisionFacilityLevel, 0, revisionFacility, revisionSuccess);
				resultSimulateParam.study_rate = training.study_rate;
				resultSimulateParam.income = ScheduleCalcAPI.Simulate_basic("収入", training.income, revisionLevel, 0.0, 0, 0.0, revisionSuccess);
				resultSimulateParam.income = (int)((double)resultSimulateParam.income * (Math.Ceiling((double)maid.status.care / (double)ScheduleCSVData.dispatchIncomCoefficient) / 100.0 + 1.0));
				break;
			}
			case ScheduleCSVData.TrainingType.Trainee:
			{
				Maid stockMaidLeader = ScheduleAPI.GetStockMaidLeader();
				if (stockMaidLeader != null)
				{
					int noonTrainerWorkId = ScheduleAPI.GetNoonTrainerWorkId();
					int revisionLevel2 = ScheduleCalcAPI.GetRevisionLevel(ScheduleCalcAPI.NoonWorkPlayToLv(ScheduleCalcAPI.NoonWorkPlayCount(stockMaidLeader, noonTrainerWorkId)));
					int teachRevision = stockMaidLeader.status.teachRate / 50;
					MaidStatus.Status status = stockMaidLeader.status;
					ScheduleCalcAPI.log.SetTarget(maid);
					resultSimulateParam.study_rate = training.study_rate;
					resultSimulateParam.reception = ScheduleCalcAPI.Simulate_trainee("接待", status.reception, revisionLevel2, teachRevision);
					resultSimulateParam.care = ScheduleCalcAPI.Simulate_trainee("お世話", status.care, revisionLevel2, teachRevision);
					resultSimulateParam.lovely = ScheduleCalcAPI.Simulate_trainee("可燐", status.lovely, revisionLevel2, teachRevision);
					resultSimulateParam.elegance = ScheduleCalcAPI.Simulate_trainee("気品", status.elegance, revisionLevel2, teachRevision);
					resultSimulateParam.charm = ScheduleCalcAPI.Simulate_trainee("魅惑", status.charm, revisionLevel2, teachRevision);
					resultSimulateParam.cooking = ScheduleCalcAPI.Simulate_trainee("料理", status.cooking, revisionLevel2, teachRevision);
					resultSimulateParam.vocal = ScheduleCalcAPI.Simulate_trainee("ボーカル", status.vocal, revisionLevel2, teachRevision);
					resultSimulateParam.dance = ScheduleCalcAPI.Simulate_trainee("ダンス", status.dance, revisionLevel2, teachRevision);
					resultSimulateParam.inyoku = ScheduleCalcAPI.Simulate_trainee("淫欲", status.inyoku, revisionLevel2, teachRevision);
					resultSimulateParam.mvalue = ScheduleCalcAPI.Simulate_trainee("M性", status.mvalue, revisionLevel2, teachRevision);
					resultSimulateParam.hentai = ScheduleCalcAPI.Simulate_trainee("変態", status.hentai, revisionLevel2, teachRevision);
					resultSimulateParam.housi = ScheduleCalcAPI.Simulate_trainee("奉仕", status.housi, revisionLevel2, teachRevision);
				}
				break;
			}
			}
			return resultSimulateParam;
		}

		public static ScheduleCalcAPI.ResultSimulateParam SimulateIncomeResult(Maid maid, int workId, Facility facility, ScheduleMgr.ScheduleTime time, ScheduleData.WorkSuccessLv successLv = ScheduleData.WorkSuccessLv.Success, bool commu = false)
		{
			ScheduleCalcAPI.ResultSimulateParam resultSimulateParam = new ScheduleCalcAPI.ResultSimulateParam();
			if (maid == null)
			{
				return resultSimulateParam;
			}
			ScheduleCSVData.Training training = (ScheduleCSVData.Training)ScheduleCSVData.AllData[workId];
			double revisionMainFacility = ScheduleCalcAPI.GetRevisionMainFacility(facility);
			double revisionFacilityLevel = ScheduleCalcAPI.GetRevisionFacilityLevel(facility.defaultData);
			double revisionFacility = ScheduleCalcAPI.GetRevisionFacility1(facility.defaultData);
			double revisionFacility2 = ScheduleCalcAPI.GetRevisionFacility2(facility);
			int num = 0;
			int num2 = 0;
			int clubGrade = GameMain.Instance.CharacterMgr.status.clubGrade;
			int num3 = ScheduleCSVData.EntertainNumberData[clubGrade];
			double revisionSuccess = ScheduleCalcAPI.GetRevisionSuccess(successLv, commu);
			if (revisionSuccess == 0.0)
			{
				return resultSimulateParam;
			}
			num3 = (int)((double)num3 * ScheduleCalcAPI.CP(revisionMainFacility));
			ScheduleCalcAPI.log.SetTarget(maid);
			ScheduleCalcAPI.log.AddLog(string.Empty);
			ScheduleCalcAPI.log.AddLog(facility.defaultData.name + "    収支:" + training.facility.businessType.ToString());
			for (int i = 0; i < num3; i++)
			{
				int count = ScheduleCSVData.EntertainGuestData[clubGrade].Count;
				int index = UnityEngine.Random.Range(0, count);
				ScheduleCSVData.EntertainGuest entertainGuest = ScheduleCSVData.EntertainGuestData[clubGrade][index];
				double num4 = 0.0;
				double num5 = 0.0;
				ScheduleCalcAPI.log.AddLog(i + "人目------------------------------------------------------------");
				FacilityDataTable.BusinessType businessType = training.facility.businessType;
				if (businessType != FacilityDataTable.BusinessType.接待系)
				{
					if (businessType != FacilityDataTable.BusinessType.営業系)
					{
						if (businessType == FacilityDataTable.BusinessType.アイドル系)
						{
							double revisionAllMaid = ScheduleCalcAPI.GetRevisionAllMaid();
							double revisionStatusIdol = ScheduleCalcAPI.GetRevisionStatusIdol(maid.status);
							double num6 = ScheduleCalcAPI.CP(revisionAllMaid + revisionStatusIdol * ScheduleCalcAPI.CP(revisionFacility + revisionFacilityLevel)) * ScheduleCalcAPI.CP(revisionFacility2) * revisionSuccess;
							num4 = (double)entertainGuest.baseIcome * num6;
							ScheduleCalcAPI.log.AddLog(string.Format("基本金額{0}*(100+所属合計補正{1}+(ステータス補正『アイドル』{2}*(100+施設補正①{3}+施設レベル補正{4})/100)/100*(100+施設補正②{5})/100*成功補正{6}", new object[]
							{
								entertainGuest.baseIcome,
								revisionAllMaid,
								revisionStatusIdol,
								revisionFacility,
								revisionFacilityLevel,
								revisionFacility2,
								revisionSuccess
							}) + "=" + num4);
							double num7 = ScheduleCalcAPI.CP(revisionStatusIdol * ScheduleCalcAPI.CP(revisionFacility + revisionFacilityLevel)) * ScheduleCalcAPI.CP(revisionFacility2) * revisionSuccess;
							num5 = (double)entertainGuest.baseEvaluation * num7;
							ScheduleCalcAPI.log.AddLog(string.Format("基本評価{0}*(100+ステータス補正『アイドル』{1}*(100+施設補正①{2}+施設レベル補正{3})/100)/100*(100+施設補正②{4})/100*成功補正{5}", new object[]
							{
								entertainGuest.baseEvaluation,
								revisionStatusIdol,
								revisionFacility,
								revisionFacilityLevel,
								revisionFacility2,
								revisionSuccess
							}) + "=" + num5);
						}
					}
					else
					{
						double revisionStatusSales = ScheduleCalcAPI.GetRevisionStatusSales(maid, facility, time);
						double num8 = ScheduleCalcAPI.CP(revisionStatusSales * ScheduleCalcAPI.CP(revisionFacility + revisionFacilityLevel)) * ScheduleCalcAPI.CP(revisionFacility2) * revisionSuccess;
						num4 = (double)entertainGuest.baseIcome * num8;
						ScheduleCalcAPI.log.AddLog(string.Format("基本金額{0}*(100+ステータス補正『営業』{1}*(100+施設補正①{2}+施設レベル補正{3})/100)/100*(100+施設補正②{4})/100*成功補正{5}", new object[]
						{
							entertainGuest.baseIcome,
							revisionStatusSales,
							revisionFacility,
							revisionFacilityLevel,
							revisionFacility2,
							revisionSuccess
						}) + "=" + num4);
						double num9 = ScheduleCalcAPI.CP(revisionStatusSales * ScheduleCalcAPI.CP(revisionFacility + revisionFacilityLevel)) * ScheduleCalcAPI.CP(revisionFacility2) * revisionSuccess;
						num5 = (double)entertainGuest.baseEvaluation * num9;
						ScheduleCalcAPI.log.AddLog(string.Format("基本評価{0}*(100+ステータス補正『営業』{1}*(100+施設補正①{2}+施設レベル補正{3})/100)/100*(100+施設補正②{4})/100*成功補正{5}", new object[]
						{
							entertainGuest.baseEvaluation,
							revisionStatusSales,
							revisionFacility,
							revisionFacilityLevel,
							revisionFacility2,
							revisionSuccess
						}) + "=" + num5);
					}
				}
				else
				{
					double revisionStatusReception = ScheduleCalcAPI.GetRevisionStatusReception(maid.status, entertainGuest.sexual);
					double revisionAttribute = ScheduleCalcAPI.GetRevisionAttribute(entertainGuest.sexual);
					double num10 = ScheduleCalcAPI.CP(revisionStatusReception * ScheduleCalcAPI.CP(revisionFacility + revisionFacilityLevel) + revisionAttribute) * ScheduleCalcAPI.CP(revisionFacility2) * revisionSuccess;
					num4 = (double)entertainGuest.baseIcome * num10;
					ScheduleCalcAPI.log.AddLog(string.Format("基本金額{0}*(100+ステータス補正『接待』{1}*(100+施設補正①{2}+施設レベル補正{3})/100＋属性補正①{4})/100*(100+施設補正②{5})/100*成功補正{6}", new object[]
					{
						entertainGuest.baseIcome,
						revisionStatusReception,
						revisionFacility,
						revisionFacilityLevel,
						revisionAttribute,
						revisionFacility2,
						revisionSuccess
					}) + "=" + num4);
					double num11 = ScheduleCalcAPI.CP(revisionStatusReception * ScheduleCalcAPI.CP(revisionFacility + revisionFacilityLevel)) * ScheduleCalcAPI.CP(revisionFacility2) * revisionSuccess;
					num5 = (double)entertainGuest.baseEvaluation * num11;
					ScheduleCalcAPI.log.AddLog(string.Format("基本評価{0}*(100+ステータス補正『接待』{1}*(100+施設補正①{2}+施設レベル補正{3})/100)/100*(100+施設補正②{4})/100*成功補正{5}", new object[]
					{
						entertainGuest.baseEvaluation,
						revisionStatusReception,
						revisionFacility,
						revisionFacilityLevel,
						revisionFacility2,
						revisionSuccess
					}) + "=" + num5);
				}
				num4 = (double)((int)Math.Ceiling(num4 / 1000.0) * 1000);
				num += (int)num4;
				num2 += (int)num5;
			}
			resultSimulateParam.income = num;
			resultSimulateParam.evaluation = num2;
			resultSimulateParam.otherPlayNumber = num3;
			ScheduleCalcAPI.log.AddLog(string.Empty);
			ScheduleCalcAPI.log.AddLog(string.Concat(new object[]
			{
				"合計金額:",
				resultSimulateParam.income,
				"  合計評価:",
				resultSimulateParam.evaluation,
				"  接客回数:",
				resultSimulateParam.otherPlayNumber
			}));
			return resultSimulateParam;
		}

		public static double CP(double value)
		{
			return (100.0 + value) / 100.0;
		}

		public static void AddResultParam(Maid maid, ScheduleCalcAPI.ResultSimulateParam param)
		{
			if (maid.status.heroineType == HeroineType.Original || maid.status.heroineType == HeroineType.Transfer)
			{
				maid.status.studyRate += param.study_rate;
				maid.status.baseReception += param.reception;
				maid.status.baseCare += param.care;
				maid.status.baseLovely += param.lovely;
				maid.status.baseElegance += param.elegance;
				maid.status.baseCharm += param.charm;
				maid.status.baseTeachRate += param.teach_rate;
				maid.status.baseCooking += param.cooking;
				maid.status.baseVocal += param.vocal;
				maid.status.baseDance += param.dance;
				maid.status.baseAppealPoint += param.appealPoint;
				if (maid.status.selectedJobClass != null)
				{
					maid.status.selectedJobClass.expSystem.AddExp(param.exp);
				}
				maid.status.baseInyoku += param.inyoku;
				maid.status.baseMvalue += param.mvalue;
				maid.status.baseHentai += param.hentai;
				maid.status.baseHousi += param.housi;
				maid.status.evaluation += param.evaluation;
				maid.status.totalEvaluations += (long)param.evaluation;
				maid.status.sexPlayNumberOfPeople += param.playNumber;
			}
			maid.status.sales += (long)param.income;
			maid.status.totalSales += (long)param.income;
			GameMain.Instance.CharacterMgr.status.baseClubEvaluation += param.evaluation;
			GameMain.Instance.CharacterMgr.status.money += (long)param.income;
			maid.status.playCountNightWork += param.otherPlayNumber;
		}

		private static int Simulate_basic(string name, int basic, int level, double facilityLevel, int sexualChara, double facility1, double success)
		{
			double num = (double)basic * ScheduleCalcAPI.CP((double)level + facilityLevel + (double)sexualChara) * ScheduleCalcAPI.CP(facility1) * success;
			if (num > 0.0)
			{
				ScheduleCalcAPI.log.AddLog("[ステータス." + name + "]");
				ScheduleCalcAPI.log.AddLog(string.Format("基本値{0} *(100+レベル補正{1} +施設レベル補正 {2} +性癖特徴補正 {3})/100*(100+施設補正①{4} )/100*成功補正 {5}", new object[]
				{
					basic,
					level,
					facilityLevel,
					sexualChara,
					facility1,
					success
				}) + "=" + num);
			}
			return (int)Math.Ceiling(num);
		}

		private static int Simulate_trainee(string name, int trainerParam, int workLvRevision, int teachRevision)
		{
			double num = (double)(trainerParam / 20) * ScheduleCalcAPI.CP((double)(workLvRevision + teachRevision)) / 2.0;
			if (num > 0.0)
			{
				ScheduleCalcAPI.log.AddLog("[ステータス." + name + "]");
				ScheduleCalcAPI.log.AddLog(string.Format("育成する側のメイド長のパラメータ{0}/20)*((100+レベル補正{1}+指導補正{2})/100) / 2", trainerParam, workLvRevision, teachRevision) + "=" + num);
			}
			return (int)Math.Ceiling(num);
		}

		private static double GetRevisionSuccess(ScheduleData.WorkSuccessLv successLv, bool commu)
		{
			double result = 0.0;
			if (successLv == ScheduleData.WorkSuccessLv.Unexecuted)
			{
				result = 0.0;
			}
			else if (commu)
			{
				result = 1.3;
			}
			else if (successLv != ScheduleData.WorkSuccessLv.Miss)
			{
				if (successLv != ScheduleData.WorkSuccessLv.Success)
				{
					if (successLv == ScheduleData.WorkSuccessLv.Perfect)
					{
						result = 1.5;
					}
				}
				else
				{
					result = 1.0;
				}
			}
			else
			{
				result = 0.5;
			}
			return result;
		}

		private static double GetBasicIncome()
		{
			return 0.0;
		}

		private static double GetEvaluation()
		{
			return 0.0;
		}

		private static double GetVisitorCnt()
		{
			return 0.0;
		}

		public static int GetRevisionLevel(int lv)
		{
			return (lv - 1) * 10;
		}

		public static int NoonWorkPlayToLv(int noonWorkPlayCount)
		{
			if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv2Exp)
			{
				return 1;
			}
			if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv3Exp)
			{
				return 2;
			}
			return 3;
		}

		public static int NoonWorkPlayCount(Maid maid, int workId)
		{
			if (maid.status.workDatas.ContainsKey(workId))
			{
				return (int)maid.status.workDatas.Get(workId).playCount;
			}
			return 0;
		}

		private static double GetRevisionStatusReception(MaidStatus.Status status, bool guestSexual)
		{
			double num = 0.0;
			if (guestSexual)
			{
				num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.inyoku);
				num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.mvalue);
				num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.hentai);
				num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.housi);
			}
			else
			{
				num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.lovely);
				num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.elegance);
				num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.charm);
				num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.reception);
			}
			return (double)Mathf.Clamp((float)(num / 2.0), 0f, 40f);
		}

		private static double GetRevisionStatusSales(Maid maid, Facility facility, ScheduleMgr.ScheduleTime time)
		{
			double num = 0.0;
			double num2 = (double)maid.status.lovely;
			double num3 = (double)maid.status.charm;
			double num4 = (double)maid.status.elegance;
			double num5 = (double)maid.status.cooking;
			double num6 = (double)maid.status.reception;
			foreach (Maid maid2 in facility.GetAllocationMaidArray(time))
			{
				if (maid2 != null && maid2 != maid)
				{
					num2 += (double)maid2.status.lovely * 0.1;
					num3 += (double)maid2.status.charm * 0.1;
					num4 += (double)maid2.status.elegance * 0.1;
					num5 += (double)maid2.status.cooking * 0.1;
					num6 += (double)maid2.status.reception * 0.1;
				}
			}
			num2 = (double)Mathf.Clamp((float)num2, 0f, 9999f);
			num3 = (double)Mathf.Clamp((float)num3, 0f, 9999f);
			num4 = (double)Mathf.Clamp((float)num4, 0f, 9999f);
			num5 = (double)Mathf.Clamp((float)num5, 0f, 9999f);
			num6 = (double)Mathf.Clamp((float)num6, 0f, 9999f);
			num += ScheduleCalcAPI.ConvertRevisionStatus(num2);
			num += ScheduleCalcAPI.ConvertRevisionStatus(num3);
			num += ScheduleCalcAPI.ConvertRevisionStatus(num4);
			num += ScheduleCalcAPI.ConvertRevisionStatus(num5);
			num += ScheduleCalcAPI.ConvertRevisionStatus(num6);
			return (double)Mathf.Clamp((float)(num / 3.0), 0f, 33f);
		}

		private static double GetRevisionStatusIdol(MaidStatus.Status status)
		{
			double num = 0.0;
			num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.lovely);
			num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.elegance);
			num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.charm);
			num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.dance);
			num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.vocal);
			return (double)Mathf.Clamp((float)(num / 3.0), 0f, 33f);
		}

		private static double GetRevisionMainFacility(Facility facility)
		{
			return 0.0;
		}

		private static double GetRevisionFacilityLevel(FacilityDataTable.FacilityDefaultData defaultData)
		{
			int num = GameMain.Instance.FacilityMgr.GetFacilityLevel(defaultData.ID);
			num = Mathf.Clamp((num - 1) * 5, 0, int.MaxValue);
			return (double)num;
		}

		private static double GetRevisionFacility1(FacilityDataTable.FacilityDefaultData facilityDefaultData)
		{
			return (double)facilityDefaultData.heroineMagnification;
		}

		private static double GetRevisionFacility2(Facility facility)
		{
			Facility.FacilityParameter facilityParameter = facility.CalcRecipeParameter();
			return (double)facilityParameter.experienceValue;
		}

		private static double GetRevisionAttribute(bool guestSexual)
		{
			return 1.0;
		}

		private static double GetRevisionAllMaid()
		{
			double num = 0.0;
			for (int i = 0; i < GameMain.Instance.CharacterMgr.GetMaidCount(); i++)
			{
				Maid maid = GameMain.Instance.CharacterMgr.GetMaid(i);
				if (maid != null)
				{
					double basicMaidEvaluation = ScheduleCalcAPI.GetBasicMaidEvaluation(maid.status);
					double workEvalution = ScheduleCalcAPI.GetWorkEvalution(maid.status);
					double num2 = (double)Mathf.Clamp((float)(basicMaidEvaluation + workEvalution), 0f, 100f);
					num += num2;
				}
			}
			return num;
		}

		private static double GetBasicMaidEvaluation(MaidStatus.Status status)
		{
			double num = 0.0;
			num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.lovely);
			num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.elegance);
			num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.charm);
			num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.care);
			num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.reception);
			num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.dance);
			num += ScheduleCalcAPI.ConvertRevisionStatus((double)status.vocal);
			return (double)Mathf.Clamp((float)(num / 2.0), 0f, 50f);
		}

		private static double GetWorkEvalution(MaidStatus.Status status)
		{
			return 0.0;
		}

		private static double ConvertRevisionStatus(double value)
		{
			double num = (double)Mathf.Clamp((float)value, 0f, 9999f);
			return Math.Ceiling(value / 500.0);
		}

		public static ScheduleCalcAPI.ResultLog log = new ScheduleCalcAPI.ResultLog();

		public class ResultLog
		{
			public void SetTarget(Maid target)
			{
				this.target = target;
			}

			public void AddLog(Maid key, string message)
			{
				if (!this.resultLog.ContainsKey(key))
				{
					this.resultLog.Add(key, new List<string>());
				}
				this.resultLog[key].Add(message);
			}

			public void AddLog(string message)
			{
				if (this.target == null)
				{
					return;
				}
				this.AddLog(this.target, message);
			}

			public void LogClear()
			{
				this.resultLog.Clear();
			}

			public Dictionary<Maid, List<string>> resultLog = new Dictionary<Maid, List<string>>();

			public Maid target;
		}

		public class ResultSimulateParam
		{
			public int study_rate;

			public int reception;

			public int care;

			public int lovely;

			public int elegance;

			public int charm;

			public int teach_rate;

			public int exp;

			public int cooking;

			public int vocal;

			public int dance;

			public int appealPoint;

			public int income;

			public int evaluation;

			public int playNumber;

			public int otherPlayNumber;

			public int commandExp;

			public int inyoku;

			public int mvalue;

			public int hentai;

			public int housi;
		}
	}
}
