12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504 |
- using System;
- using System.Collections.Generic;
- using BackupParamAccessor;
- using MaidStatus;
- using PlayerStatus;
- using UnityEngine;
- using wf;
- namespace Schedule
- {
- public static class ScheduleAPI
- {
- public static void log(string text)
- {
- if (!ScheduleAPI.logOutput)
- {
- return;
- }
- if (ScheduleAPI.logs.Count > 500)
- {
- ScheduleAPI.logs.RemoveRange(0, 400);
- }
- ScheduleAPI.logs.Add(text);
- }
- public static int GetNoonTrainerWorkId()
- {
- foreach (KeyValuePair<int, ScheduleCSVData.ScheduleBase> keyValuePair in ScheduleCSVData.AllData)
- {
- if (keyValuePair.Value.type == ScheduleTaskCtrl.TaskType.Training)
- {
- ScheduleCSVData.Training training = (ScheduleCSVData.Training)keyValuePair.Value;
- if (training.trainingType == ScheduleCSVData.TrainingType.Trainer)
- {
- return keyValuePair.Key;
- }
- }
- }
- Debug.LogWarning("ScheduleCSVData.GetNoonTrainerWorkId:昼のメイド研修(研修官)仕事IDが発見できませんでした。");
- return 0;
- }
- public static int GetTraineeWorkId()
- {
- foreach (KeyValuePair<int, ScheduleCSVData.Training> keyValuePair in ScheduleCSVData.TrainingData)
- {
- if (keyValuePair.Value.trainingType == ScheduleCSVData.TrainingType.Trainee)
- {
- return keyValuePair.Key;
- }
- }
- Debug.LogWarning("ScheduleCSVData.GetNoonTraineeWorkId:昼のメイド研修(研修生)仕事IDが発見できませんでした。");
- return 0;
- }
- public static int GetTravelWorkId()
- {
- foreach (KeyValuePair<int, ScheduleCSVData.Training> keyValuePair in ScheduleCSVData.TrainingData)
- {
- if (keyValuePair.Value.trainingType == ScheduleCSVData.TrainingType.Travel)
- {
- return keyValuePair.Key;
- }
- }
- Debug.LogWarning("ScheduleCSVData.GetNoonTravelWorkId:昼の旅行仕事IDが発見できませんでした。");
- return 0;
- }
- public static int GetNightTrainerWorkId()
- {
- foreach (KeyValuePair<int, ScheduleCSVData.Training> keyValuePair in ScheduleCSVData.TrainingData)
- {
- if (keyValuePair.Value.trainingType == ScheduleCSVData.TrainingType.Trainer)
- {
- return keyValuePair.Key;
- }
- }
- Debug.LogWarning("ScheduleCSVData.GetNightTrainerWorkId:夜のメイド研修(研修官)仕事IDが発見できませんでした。");
- return 0;
- }
- public static int GetNightTraineeWorkId()
- {
- foreach (KeyValuePair<int, ScheduleCSVData.Training> keyValuePair in ScheduleCSVData.TrainingData)
- {
- if (keyValuePair.Value.trainingType == ScheduleCSVData.TrainingType.Trainee)
- {
- return keyValuePair.Key;
- }
- }
- Debug.LogWarning("ScheduleCSVData.GetNightTraineeWorkId:夜のメイド研修(研修生)仕事IDが発見できませんでした。");
- return 0;
- }
- public static int GetNightTravelWorkId()
- {
- foreach (KeyValuePair<int, ScheduleCSVData.Yotogi> keyValuePair in ScheduleCSVData.YotogiData)
- {
- if (keyValuePair.Value.yotogiType == ScheduleCSVData.YotogiType.Travel)
- {
- return keyValuePair.Key;
- }
- }
- Debug.LogWarning("ScheduleCSVData.GetNightTravelWorkId:夜の旅行仕事IDが発見できませんでした。");
- return 0;
- }
- public static int GetNightEntertainWorkId()
- {
- foreach (KeyValuePair<int, ScheduleCSVData.Yotogi> keyValuePair in ScheduleCSVData.YotogiData)
- {
- if (keyValuePair.Value.yotogiType == ScheduleCSVData.YotogiType.Entertain)
- {
- return keyValuePair.Key;
- }
- }
- Debug.LogWarning("ScheduleCSVData.GetNightEntertainWorkId:夜のクラブ接待 仕事IDが発見できませんでした。");
- return 0;
- }
- public static int GetNightRestWorkId()
- {
- foreach (KeyValuePair<int, ScheduleCSVData.Yotogi> keyValuePair in ScheduleCSVData.YotogiData)
- {
- if (keyValuePair.Value.yotogiType == ScheduleCSVData.YotogiType.Rest)
- {
- return keyValuePair.Key;
- }
- }
- Debug.LogWarning("ScheduleCSVData.GetNightRestWorkId:夜の休息 仕事IDが発見できませんでした。");
- return 0;
- }
- public static bool CheckNoProblemTravel(int nightWorkId)
- {
- ScheduleCSVData.ScheduleBase scheduleBase = null;
- foreach (KeyValuePair<int, ScheduleCSVData.ScheduleBase> keyValuePair in ScheduleCSVData.AllData)
- {
- if (keyValuePair.Value.id == nightWorkId)
- {
- scheduleBase = keyValuePair.Value;
- break;
- }
- }
- if (scheduleBase == null)
- {
- return false;
- }
- if (scheduleBase.type != ScheduleTaskCtrl.TaskType.Yotogi)
- {
- return false;
- }
- ScheduleCSVData.YotogiType yotogiType = ((ScheduleCSVData.Yotogi)scheduleBase).yotogiType;
- return yotogiType != ScheduleCSVData.YotogiType.HaveSex && yotogiType != ScheduleCSVData.YotogiType.NewSex && yotogiType != ScheduleCSVData.YotogiType.Vip && yotogiType != ScheduleCSVData.YotogiType.VipCall;
- }
- public static void BackupParam(SCENE_ID scene_id)
- {
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null)
- {
- BackupParamAccessor.BackupParam(new int?(i), scene_id);
- }
- }
- }
- public static void BackUpScheduleSlot()
- {
- if (DailyMgr.IsLegacy)
- {
- GameMain.Instance.CharacterMgr.status.BackupScheduleSlot(ScheduleSlotBackup.Type.CM3D2);
- }
- else
- {
- GameMain.Instance.CharacterMgr.status.BackupScheduleSlot(ScheduleSlotBackup.Type.COM3D);
- }
- }
- public static Maid GetNoonTrainerMaid()
- {
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null && scheduleSlot.status.noonWorkId == ScheduleAPI.GetNoonTrainerWorkId())
- {
- return scheduleSlot;
- }
- }
- return null;
- }
- public static Maid GetNoonTraineeMaid()
- {
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null && scheduleSlot.status.noonWorkId == ScheduleAPI.GetTraineeWorkId())
- {
- return scheduleSlot;
- }
- }
- return null;
- }
- public static Maid GetNightTrainerMaid()
- {
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null && scheduleSlot.status.nightWorkId == ScheduleAPI.GetNightTrainerWorkId())
- {
- return scheduleSlot;
- }
- }
- return null;
- }
- public static Maid GetNightTraineeMaid()
- {
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null && scheduleSlot.status.nightWorkId == ScheduleAPI.GetNightTraineeWorkId())
- {
- return scheduleSlot;
- }
- }
- return null;
- }
- public static Maid GetTravelMaid()
- {
- int travelWorkId = ScheduleAPI.GetTravelWorkId();
- if (travelWorkId != 0)
- {
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null && scheduleSlot.status.noonWorkId == travelWorkId)
- {
- return scheduleSlot;
- }
- }
- }
- return null;
- }
- public static KeyValuePair<string, KeyValuePair<Vector3, Vector3>> GetTravelBgData(bool time_is_noon)
- {
- int travelWorkId = ScheduleAPI.GetTravelWorkId();
- if (travelWorkId != 0)
- {
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null && scheduleSlot.status.noonWorkId == travelWorkId)
- {
- ScheduleCSVData.Training training = (ScheduleCSVData.Training)ScheduleCSVData.AllData[travelWorkId];
- foreach (int key in training.needEventItemIdList)
- {
- Shop.ItemDataEvent itemDataEvent = Shop.item_data_dic[key] as Shop.ItemDataEvent;
- if (itemDataEvent.is_have_item)
- {
- string key2 = itemDataEvent.free_text[(!time_is_noon) ? 1 : 0];
- Vector3 key3 = Parse.Vector3("(" + itemDataEvent.free_text[2] + ")");
- Vector3 value = Parse.Vector3("(" + itemDataEvent.free_text[3] + ")");
- return new KeyValuePair<string, KeyValuePair<Vector3, Vector3>>(key2, new KeyValuePair<Vector3, Vector3>(key3, value));
- }
- }
- }
- }
- }
- return new KeyValuePair<string, KeyValuePair<Vector3, Vector3>>(string.Empty, new KeyValuePair<Vector3, Vector3>(Vector3.zero, Vector3.zero));
- }
- public static Maid GetStockMaidLeader()
- {
- int stockMaidCount = GameMain.Instance.CharacterMgr.GetStockMaidCount();
- for (int i = 0; i < stockMaidCount; i++)
- {
- Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(i);
- if (stockMaid != null && stockMaid.status.leader)
- {
- return stockMaid;
- }
- }
- return null;
- }
- public static bool VipCalledMaid(int workId, Maid maid)
- {
- NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(workId);
- return nightWorksState != null && !string.IsNullOrEmpty(nightWorksState.calledMaidGUID) && !(nightWorksState.calledMaidGUID == maid.status.guid);
- }
- public static int GetScheduleId(Maid maid, bool isDaytime)
- {
- if (maid == null)
- {
- return 0;
- }
- if (isDaytime)
- {
- return maid.status.noonWorkId;
- }
- return maid.status.nightWorkId;
- }
- public static int GetScheduleId(Maid maid, ScheduleMgr.ScheduleTime time)
- {
- return ScheduleAPI.GetScheduleId(maid, time == ScheduleMgr.ScheduleTime.DayTime);
- }
- public static ScheduleCSVData.ScheduleBase GetSchedule(Maid maid, bool isDaytime)
- {
- if (maid == null)
- {
- return null;
- }
- int key = maid.status.noonWorkId;
- if (isDaytime)
- {
- key = maid.status.noonWorkId;
- }
- else
- {
- key = maid.status.nightWorkId;
- }
- if (!ScheduleCSVData.AllData.ContainsKey(key))
- {
- return null;
- }
- return ScheduleCSVData.AllData[key];
- }
- public static ScheduleCSVData.ScheduleBase GetSchedule(Maid maid, ScheduleMgr.ScheduleTime time)
- {
- return ScheduleAPI.GetSchedule(maid, time == ScheduleMgr.ScheduleTime.DayTime);
- }
- private static bool CheckCommu(Maid m, bool isDaytime, bool checkCommuState)
- {
- if (checkCommuState)
- {
- if (isDaytime && !m.status.noonCommu)
- {
- return false;
- }
- if (!isDaytime && !m.status.nightCommu)
- {
- return false;
- }
- }
- int key;
- if (isDaytime)
- {
- key = m.status.noonWorkId;
- }
- else
- {
- key = m.status.nightWorkId;
- }
- if (ScheduleCSVData.AllData.ContainsKey(key))
- {
- ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[key];
- if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Work)
- {
- ScheduleMgr.ScheduleTime scheduleTime;
- if (isDaytime)
- {
- scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
- }
- else
- {
- scheduleTime = ScheduleMgr.ScheduleTime.Night;
- }
- Facility maidAssignedFacility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(m, scheduleTime);
- if (maidAssignedFacility == null || !maidAssignedFacility.IsOperation(scheduleTime))
- {
- return false;
- }
- }
- if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Training || scheduleBase.type == ScheduleTaskCtrl.TaskType.Work)
- {
- ScheduleCSVData.Training training = (ScheduleCSVData.Training)scheduleBase;
- if (checkCommuState)
- {
- switch (training.trainingType)
- {
- case ScheduleCSVData.TrainingType.Basic:
- case ScheduleCSVData.TrainingType.Trainer:
- case ScheduleCSVData.TrainingType.Trainee:
- case ScheduleCSVData.TrainingType.Holiday:
- return true;
- }
- }
- else
- {
- ScheduleCSVData.TrainingType trainingType = training.trainingType;
- if (trainingType == ScheduleCSVData.TrainingType.Basic)
- {
- return true;
- }
- }
- }
- }
- return false;
- }
- public static Maid GetCommunicationMaid(bool isDaytime)
- {
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null && ScheduleAPI.CheckCommu(scheduleSlot, isDaytime, true))
- {
- return scheduleSlot;
- }
- }
- return null;
- }
- public static List<Maid> CanCommunicationMaids(bool isDaytime)
- {
- List<Maid> list = new List<Maid>();
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null && ScheduleAPI.CheckCommu(scheduleSlot, isDaytime, false))
- {
- list.Add(scheduleSlot);
- }
- }
- return list;
- }
- public static List<Maid> GetFacilityPowerUpMaids(bool isDaytime)
- {
- List<Maid> list = new List<Maid>();
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null)
- {
- int num;
- if (isDaytime)
- {
- num = scheduleSlot.status.noonWorkId;
- }
- else
- {
- num = scheduleSlot.status.nightWorkId;
- }
- if (num == ScheduleCSVData.faclilityPowerUpWorkId)
- {
- list.Add(scheduleSlot);
- }
- }
- }
- return list;
- }
- public static List<Maid> GetEntertainMaids()
- {
- List<Maid> list = new List<Maid>();
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null)
- {
- ScheduleCSVData.YotogiType yotogiType = ScheduleCSVData.YotogiData[scheduleSlot.status.nightWorkId].yotogiType;
- if (yotogiType == ScheduleCSVData.YotogiType.Entertain)
- {
- list.Add(scheduleSlot);
- }
- }
- }
- return list;
- }
- public static List<Maid> GetVipWorkMaids(bool isDaytime)
- {
- List<Maid> list = new List<Maid>();
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null)
- {
- int key;
- if (isDaytime)
- {
- key = scheduleSlot.status.noonWorkId;
- }
- else
- {
- key = scheduleSlot.status.nightWorkId;
- }
- ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[key];
- if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Yotogi)
- {
- ScheduleCSVData.Yotogi yotogi = (ScheduleCSVData.Yotogi)scheduleBase;
- ScheduleCSVData.YotogiType yotogiType = yotogi.yotogiType;
- if (yotogiType == ScheduleCSVData.YotogiType.Vip || yotogiType == ScheduleCSVData.YotogiType.VipCall)
- {
- list.Add(scheduleSlot);
- }
- }
- }
- }
- return list;
- }
- public static List<Maid> GetYotogiMaids(bool isDaytime)
- {
- List<Maid> list = new List<Maid>();
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null)
- {
- int num;
- if (isDaytime)
- {
- num = scheduleSlot.status.noonWorkId;
- }
- else
- {
- num = scheduleSlot.status.nightWorkId;
- }
- if (!ScheduleCSVData.AllData.ContainsKey(num))
- {
- Debug.LogError("ScheduleAPI:タスクID[" + num + "]のデータが見つかりませんでした");
- }
- ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[num];
- if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Yotogi)
- {
- ScheduleCSVData.Yotogi yotogi = (ScheduleCSVData.Yotogi)scheduleBase;
- if (yotogi.yotogiType == ScheduleCSVData.YotogiType.HaveSex)
- {
- list.Add(scheduleSlot);
- }
- }
- }
- }
- return list;
- }
- public static List<Maid> GetNewYotogiMaids(bool isDaytime)
- {
- List<Maid> list = new List<Maid>();
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null)
- {
- int num;
- if (isDaytime)
- {
- num = scheduleSlot.status.noonWorkId;
- }
- else
- {
- num = scheduleSlot.status.nightWorkId;
- }
- if (!ScheduleCSVData.AllData.ContainsKey(num))
- {
- Debug.LogError("ScheduleAPI:タスクID[" + num + "]のデータが見つかりませんでした");
- }
- ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[num];
- if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Yotogi)
- {
- ScheduleCSVData.Yotogi yotogi = (ScheduleCSVData.Yotogi)scheduleBase;
- if (yotogi.yotogiType == ScheduleCSVData.YotogiType.NewSex)
- {
- if (yotogi.pairCondPersonal.Count <= 0 || ScheduleAPI.GetNewYotogiHaremPairCandidateList(yotogi, yotogi.pairCondPersonal, scheduleSlot).Count > 0)
- {
- list.Add(scheduleSlot);
- }
- }
- }
- }
- }
- return list;
- }
- public static List<Maid> GetNewYotogiHaremPairCandidateList(ScheduleCSVData.Yotogi workData, List<int> condPersonalIds, Maid excludeMaid = null)
- {
- List<Maid> list = new List<Maid>();
- if (condPersonalIds == null || condPersonalIds.Count <= 0)
- {
- return list;
- }
- for (int i = 0; i < GameMain.Instance.CharacterMgr.GetStockMaidCount(); i++)
- {
- Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(i);
- if (stockMaid != null && stockMaid.status.heroineType != HeroineType.Sub)
- {
- if (!(excludeMaid != null) || !(excludeMaid.status.guid == stockMaid.status.guid))
- {
- if (PersonalEventBlocker.IsEnabledScheduleTask(stockMaid.status.personal, workData.id))
- {
- if (workData.id == 10072 && workData.isCheckGP002Personal)
- {
- if ((stockMaid.status.seikeiken == Seikeiken.Yes_No || stockMaid.status.seikeiken == Seikeiken.Yes_Yes) && condPersonalIds.Contains(stockMaid.status.personal.id) && PluginData.IsEnabledForGP002Personal(stockMaid.status.personal.uniqueName))
- {
- list.Add(stockMaid);
- }
- }
- else if (stockMaid.status.seikeiken == Seikeiken.Yes_Yes && stockMaid.status.relation >= Relation.Lover && condPersonalIds.Contains(stockMaid.status.personal.id))
- {
- if (workData.isCheckGP002Personal)
- {
- if (PluginData.IsEnabledForGP002Personal(stockMaid.status.personal.uniqueName))
- {
- list.Add(stockMaid);
- }
- }
- else
- {
- list.Add(stockMaid);
- }
- }
- }
- }
- }
- }
- return list;
- }
- public static void DecideSuccess(WorkResultSceneMode sceneMode, int index, bool commu)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(index);
- ScheduleData scheduleData = GameMain.Instance.CharacterMgr.status.scheduleSlot[index];
- if (scheduleSlot != null)
- {
- ScheduleData.WorkSuccessLv workSuccessLv;
- if (commu)
- {
- workSuccessLv = ScheduleData.WorkSuccessLv.Success;
- }
- else if (scheduleSlot.status.features.ContainsKey(Feature.GetData("疲労").id))
- {
- workSuccessLv = ScheduleData.WorkSuccessLv.Miss;
- }
- else
- {
- int num = UnityEngine.Random.Range(1, 100);
- if (num <= ScheduleCSVData.workSuccessLvMissIncidence)
- {
- workSuccessLv = ScheduleData.WorkSuccessLv.Miss;
- }
- else if (num > 100 - ScheduleCSVData.workSuccessLvPerfectIncidence)
- {
- workSuccessLv = ScheduleData.WorkSuccessLv.Perfect;
- }
- else
- {
- workSuccessLv = ScheduleData.WorkSuccessLv.Success;
- }
- }
- int num2 = 0;
- if (sceneMode == WorkResultSceneMode.Noon)
- {
- num2 = scheduleSlot.status.noonWorkId;
- }
- else if (sceneMode == WorkResultSceneMode.Night)
- {
- num2 = scheduleSlot.status.nightWorkId;
- }
- if (num2 == ScheduleCSVData.faclilityPowerUpWorkId)
- {
- Facility facility;
- Facility.RecipeData recipeData;
- if (!GameMain.Instance.FacilityMgr.TryGetCacheFacilityPowerUpResult(scheduleSlot, out facility, out recipeData))
- {
- workSuccessLv = ScheduleData.WorkSuccessLv.Unexecuted;
- }
- else
- {
- workSuccessLv = ScheduleData.WorkSuccessLv.Success;
- }
- }
- ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[num2];
- if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Work && num2 != ScheduleCSVData.faclilityPowerUpWorkId)
- {
- ScheduleMgr.ScheduleTime scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
- if (sceneMode == WorkResultSceneMode.Noon)
- {
- scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
- }
- else if (sceneMode == WorkResultSceneMode.Night)
- {
- scheduleTime = ScheduleMgr.ScheduleTime.Night;
- }
- Facility maidAssignedFacility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(scheduleSlot, scheduleTime);
- if (maidAssignedFacility == null || !maidAssignedFacility.IsOperation(scheduleTime))
- {
- workSuccessLv = ScheduleData.WorkSuccessLv.Unexecuted;
- }
- }
- if (sceneMode == WorkResultSceneMode.Noon)
- {
- scheduleData.noon_success_level = workSuccessLv;
- }
- else if (sceneMode == WorkResultSceneMode.Night)
- {
- scheduleData.night_success_level = workSuccessLv;
- }
- }
- }
- private static ScheduleAPI.TrainingResultSimulateParam TrainingResultSimulate(Maid maid, int workId, ScheduleData.WorkSuccessLv successLv = ScheduleData.WorkSuccessLv.Success, bool communicationBonus = false)
- {
- ScheduleAPI.TrainingResultSimulateParam trainingResultSimulateParam = new ScheduleAPI.TrainingResultSimulateParam();
- if (maid == null)
- {
- return trainingResultSimulateParam;
- }
- ScheduleCSVData.Training training = (ScheduleCSVData.Training)ScheduleCSVData.AllData[workId];
- switch (training.trainingType)
- {
- case ScheduleCSVData.TrainingType.Basic:
- case ScheduleCSVData.TrainingType.Dispatch:
- {
- BonusStatus bonusStatusAsFeatureAndPropensitys = maid.status.GetBonusStatusAsFeatureAndPropensitys();
- int workLvRevision = ScheduleAPI.NoonWorkLvToRevision(ScheduleAPI.NoonWorkPlayToLv(ScheduleAPI.NoonWorkPlayCount(maid, workId)));
- double successRevision = 1.0;
- if (successLv == ScheduleData.WorkSuccessLv.Unexecuted)
- {
- successRevision = 0.0;
- }
- else if (communicationBonus)
- {
- successRevision = 0.3;
- }
- else if (successLv != ScheduleData.WorkSuccessLv.Miss)
- {
- if (successLv != ScheduleData.WorkSuccessLv.Success)
- {
- if (successLv == ScheduleData.WorkSuccessLv.Perfect)
- {
- successRevision = 1.5;
- }
- }
- else
- {
- successRevision = 1.0;
- }
- }
- else
- {
- successRevision = 0.5;
- }
- trainingResultSimulateParam.study_rate = training.study_rate;
- trainingResultSimulateParam.reception = ScheduleAPI.NoonWorkResultSimulate_basic(training.reception, bonusStatusAsFeatureAndPropensitys.reception, workLvRevision, successRevision);
- trainingResultSimulateParam.care = ScheduleAPI.NoonWorkResultSimulate_basic(training.care, bonusStatusAsFeatureAndPropensitys.care, workLvRevision, successRevision);
- trainingResultSimulateParam.lovely = ScheduleAPI.NoonWorkResultSimulate_basic(training.lovely, bonusStatusAsFeatureAndPropensitys.lovely, workLvRevision, successRevision);
- trainingResultSimulateParam.elegance = ScheduleAPI.NoonWorkResultSimulate_basic(training.elegance, bonusStatusAsFeatureAndPropensitys.elegance, workLvRevision, successRevision);
- trainingResultSimulateParam.charm = ScheduleAPI.NoonWorkResultSimulate_basic(training.charm, bonusStatusAsFeatureAndPropensitys.charm, workLvRevision, successRevision);
- trainingResultSimulateParam.teach_rate = ScheduleAPI.NoonWorkResultSimulate_basic(training.teach_rate, bonusStatusAsFeatureAndPropensitys.teachRate, workLvRevision, successRevision);
- trainingResultSimulateParam.cooking = ScheduleAPI.NoonWorkResultSimulate_basic(training.cooking, bonusStatusAsFeatureAndPropensitys.cooking, workLvRevision, successRevision);
- trainingResultSimulateParam.vocal = ScheduleAPI.NoonWorkResultSimulate_basic(training.vocal, bonusStatusAsFeatureAndPropensitys.vocal, workLvRevision, successRevision);
- trainingResultSimulateParam.dance = ScheduleAPI.NoonWorkResultSimulate_basic(training.dance, bonusStatusAsFeatureAndPropensitys.dance, workLvRevision, successRevision);
- trainingResultSimulateParam.appealPoint = ScheduleAPI.NoonWorkResultSimulate_basic(training.appealPoint, bonusStatusAsFeatureAndPropensitys.appealPoint, workLvRevision, successRevision);
- trainingResultSimulateParam.income = ScheduleAPI.NoonWorkResultSimulate_basic(training.income, 0, workLvRevision, successRevision);
- trainingResultSimulateParam.income = (int)((double)trainingResultSimulateParam.income * (System.Math.Ceiling((double)maid.status.care / (double)ScheduleCSVData.dispatchIncomCoefficient) / 100.0 + 1.0));
- trainingResultSimulateParam.exp = ScheduleAPI.NoonWorkResultSimulate_basic(training.exp, 0, workLvRevision, successRevision);
- if (communicationBonus)
- {
- trainingResultSimulateParam.study_rate = 0;
- }
- break;
- }
- case ScheduleCSVData.TrainingType.Trainee:
- {
- Maid stockMaidLeader = ScheduleAPI.GetStockMaidLeader();
- if (stockMaidLeader != null)
- {
- int noonTrainerWorkId = ScheduleAPI.GetNoonTrainerWorkId();
- int workLvRevision2 = ScheduleAPI.NoonWorkLvToRevision(ScheduleAPI.NoonWorkPlayToLv(ScheduleAPI.NoonWorkPlayCount(stockMaidLeader, noonTrainerWorkId)));
- int teachRevision = stockMaidLeader.status.teachRate / 50;
- MaidStatus.Status status = stockMaidLeader.status;
- trainingResultSimulateParam.study_rate = training.study_rate;
- trainingResultSimulateParam.reception = ScheduleAPI.NoonWorkResultSimulate_trainee(status.reception, workLvRevision2, teachRevision);
- trainingResultSimulateParam.care = ScheduleAPI.NoonWorkResultSimulate_trainee(status.care, workLvRevision2, teachRevision);
- trainingResultSimulateParam.lovely = ScheduleAPI.NoonWorkResultSimulate_trainee(status.lovely, workLvRevision2, teachRevision);
- trainingResultSimulateParam.elegance = ScheduleAPI.NoonWorkResultSimulate_trainee(status.elegance, workLvRevision2, teachRevision);
- trainingResultSimulateParam.charm = ScheduleAPI.NoonWorkResultSimulate_trainee(status.charm, workLvRevision2, teachRevision);
- trainingResultSimulateParam.inyoku = ScheduleAPI.NoonWorkResultSimulate_trainee(status.inyoku, workLvRevision2, teachRevision);
- trainingResultSimulateParam.mvalue = ScheduleAPI.NoonWorkResultSimulate_trainee(status.mvalue, workLvRevision2, teachRevision);
- trainingResultSimulateParam.hentai = ScheduleAPI.NoonWorkResultSimulate_trainee(status.hentai, workLvRevision2, teachRevision);
- trainingResultSimulateParam.housi = ScheduleAPI.NoonWorkResultSimulate_trainee(status.housi, workLvRevision2, teachRevision);
- }
- break;
- }
- }
- return trainingResultSimulateParam;
- }
- private static int NoonWorkResultSimulate_basic(int workParam, int maidRevision, int workLvRevision, double successRevision)
- {
- return (int)System.Math.Ceiling((double)workParam * (double)(100 + maidRevision + workLvRevision) / 100.0 * successRevision);
- }
- private static int NoonWorkResultSimulate_trainee(int trainerParam, int workLvRevision, int teachRevision)
- {
- return (int)System.Math.Ceiling((double)trainerParam / 25.0 * (double)(100 + workLvRevision + teachRevision) / 100.0);
- }
- public static Params OneDayParamDiff(int? slotId = null)
- {
- int num = 0;
- if (slotId == null)
- {
- for (int i = 0; i < 40; i++)
- {
- if (GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i) != null)
- {
- num = i;
- break;
- }
- }
- }
- else
- {
- num = ((slotId == null) ? 0 : slotId.Value);
- }
- if (GameMain.Instance.CharacterMgr.status.GetScheduleSlot(num) != null)
- {
- return BackupParamAccessor.GetBackupParams(num, SCENE_ID.Start);
- }
- return null;
- }
- public static ScheduleAPI.YotogiResultSimulateParam YotogiResultSimulate(Maid maid, int workId)
- {
- ScheduleAPI.YotogiResultSimulateParam yotogiResultSimulateParam = new ScheduleAPI.YotogiResultSimulateParam();
- if (maid == null)
- {
- return yotogiResultSimulateParam;
- }
- ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[workId];
- switch (yotogi.yotogiType)
- {
- case ScheduleCSVData.YotogiType.Entertain:
- {
- int num = 0;
- int num2 = 0;
- int clubGrade = GameMain.Instance.CharacterMgr.status.clubGrade;
- int num3 = ScheduleCSVData.EntertainNumberData[clubGrade];
- 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;
- if (!entertainGuest.sexual)
- {
- num4 += System.Math.Ceiling((double)maid.status.lovely / 500.0);
- num4 += System.Math.Ceiling((double)maid.status.elegance / 500.0);
- num4 += System.Math.Ceiling((double)maid.status.charm / 500.0);
- num4 += System.Math.Ceiling((double)maid.status.reception / 500.0);
- num4 += System.Math.Ceiling((double)maid.status.cooking / 500.0);
- num4 += System.Math.Ceiling((double)maid.status.vocal / 500.0);
- num4 += System.Math.Ceiling((double)maid.status.dance / 500.0);
- num4 += System.Math.Ceiling((double)maid.status.appealPoint / 500.0);
- }
- else
- {
- num4 += System.Math.Ceiling((double)maid.status.inyoku / 500.0);
- num4 += System.Math.Ceiling((double)maid.status.mvalue / 500.0);
- num4 += System.Math.Ceiling((double)maid.status.hentai / 500.0);
- num4 += System.Math.Ceiling((double)maid.status.housi / 500.0);
- }
- num4 /= 2.0;
- num4 = num4 / 100.0 + 1.0;
- double num5 = 0.0;
- num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
- for (int j = 0; j < maid.status.propensitys.Count; j++)
- {
- num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
- }
- if (maid.status.inyoku >= ScheduleCSVData.entertainParameterRevisionThreshold)
- {
- num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
- }
- if (maid.status.mvalue >= ScheduleCSVData.entertainParameterRevisionThreshold)
- {
- num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
- }
- if (maid.status.hentai >= ScheduleCSVData.entertainParameterRevisionThreshold)
- {
- num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
- }
- if (maid.status.housi >= ScheduleCSVData.entertainParameterRevisionThreshold)
- {
- num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
- }
- if (maid.status.lovely >= ScheduleCSVData.entertainParameterRevisionThreshold)
- {
- num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
- }
- if (maid.status.elegance >= ScheduleCSVData.entertainParameterRevisionThreshold)
- {
- num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
- }
- if (maid.status.charm >= ScheduleCSVData.entertainParameterRevisionThreshold)
- {
- num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
- }
- if (maid.status.reception >= ScheduleCSVData.entertainParameterRevisionThreshold)
- {
- num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
- }
- if (maid.status.cooking >= ScheduleCSVData.entertainParameterRevisionThreshold)
- {
- num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
- }
- if (maid.status.vocal >= ScheduleCSVData.entertainParameterRevisionThreshold)
- {
- num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
- }
- if (maid.status.dance >= ScheduleCSVData.entertainParameterRevisionThreshold)
- {
- num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
- }
- if (maid.status.appealPoint >= ScheduleCSVData.entertainParameterRevisionThreshold)
- {
- num5 += (double)(UnityEngine.Random.Range(-1, 2) * 10);
- }
- num5 = num5 / 100.0 + 1.0;
- if (num5 < (double)(ScheduleCSVData.entertainPropensityRevisionMin / 100))
- {
- num5 = (double)(ScheduleCSVData.entertainPropensityRevisionMin / 100);
- }
- else if (num5 > (double)(ScheduleCSVData.entertainPropensityRevisionMax / 100))
- {
- num5 = (double)(ScheduleCSVData.entertainPropensityRevisionMax / 100);
- }
- yotogiResultSimulateParam.otherPlayNumber++;
- if (entertainGuest.sexual)
- {
- Contract contract = maid.status.contract;
- if (contract != Contract.Trainee && contract != Contract.Free)
- {
- if (contract == Contract.Exclusive)
- {
- num5 /= 2.0;
- }
- }
- else
- {
- yotogiResultSimulateParam.playNumber++;
- }
- }
- int num6 = (int)((double)entertainGuest.baseIcome * num4 * num5);
- int num7 = (int)((double)entertainGuest.baseEvaluation * num4 * num5);
- num6 = (int)System.Math.Ceiling((double)num6 / 1000.0) * 1000;
- num += num6;
- num2 += num7;
- }
- yotogiResultSimulateParam.income = num;
- yotogiResultSimulateParam.evaluation = num2;
- break;
- }
- case ScheduleCSVData.YotogiType.HaveSex:
- case ScheduleCSVData.YotogiType.NewSex:
- if (maid.status.GetFlag("_YotogiPlayed") > 0)
- {
- }
- break;
- case ScheduleCSVData.YotogiType.Vip:
- case ScheduleCSVData.YotogiType.VipCall:
- {
- NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(workId);
- if (nightWorksState != null && !nightWorksState.finish)
- {
- yotogiResultSimulateParam.income = yotogi.income;
- yotogiResultSimulateParam.evaluation = yotogi.evaluation;
- }
- if (yotogi != null)
- {
- yotogiResultSimulateParam.playNumber += yotogi.add_play_number;
- yotogiResultSimulateParam.otherPlayNumber += yotogi.add_other_play_number;
- }
- break;
- }
- case ScheduleCSVData.YotogiType.EasyYotogi:
- {
- ScheduleCSVData.Yotogi.EasyYotogi easyYotogi = yotogi.easyYotogi;
- if (easyYotogi != null)
- {
- yotogiResultSimulateParam.study_rate = easyYotogi.study_rate;
- yotogiResultSimulateParam.care = easyYotogi.care;
- yotogiResultSimulateParam.reception = easyYotogi.reception;
- yotogiResultSimulateParam.teach_rate = easyYotogi.teach_rate;
- yotogiResultSimulateParam.study_rate = easyYotogi.study_rate;
- yotogiResultSimulateParam.inyoku = easyYotogi.inyoku;
- yotogiResultSimulateParam.hentai = easyYotogi.hentai;
- yotogiResultSimulateParam.mvalue = easyYotogi.msei;
- yotogiResultSimulateParam.housi = easyYotogi.housi;
- }
- break;
- }
- }
- return yotogiResultSimulateParam;
- }
- public static void AddYotogiWorkResultParam(ScheduleCSVData.Yotogi scheduleData, Maid maid, ScheduleAPI.YotogiResultSimulateParam param)
- {
- maid.status.studyRate += param.study_rate;
- maid.status.evaluation += param.evaluation;
- maid.status.totalEvaluations += (long)param.evaluation;
- 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;
- maid.status.sexPlayNumberOfPeople += param.playNumber;
- maid.status.baseCare += param.care;
- maid.status.baseReception += param.reception;
- maid.status.baseTeachRate += param.teach_rate;
- maid.status.baseInyoku += param.inyoku;
- maid.status.baseHentai += param.hentai;
- maid.status.baseMvalue += param.mvalue;
- maid.status.baseHousi += param.housi;
- }
- public static bool EnableNoonWork(int workId, Maid maid = null)
- {
- if (!ScheduleCSVData.TrainingData.ContainsKey(workId))
- {
- return false;
- }
- ScheduleCSVData.Training training = ScheduleCSVData.TrainingData[workId];
- if (training.condPackage.Count > 0)
- {
- for (int i = 0; i < training.condPackage.Count; i++)
- {
- if (!PluginData.IsEnabled(training.condPackage[i]))
- {
- return false;
- }
- }
- }
- if (maid != null)
- {
- if (training.trainingType == ScheduleCSVData.TrainingType.Trainer)
- {
- if (maid != ScheduleAPI.GetStockMaidLeader())
- {
- return false;
- }
- if (maid.status.contract == Contract.Trainee)
- {
- return false;
- }
- }
- if (training.trainingType == ScheduleCSVData.TrainingType.Trainee)
- {
- if (maid == ScheduleAPI.GetStockMaidLeader())
- {
- return false;
- }
- if (maid.status.studyRate < -training.study_rate)
- {
- return false;
- }
- bool flag = false;
- for (int j = 0; j < 40; j++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(j);
- if (scheduleSlot != null && ScheduleAPI.EnableNoonWork(ScheduleAPI.GetNoonTrainerWorkId(), scheduleSlot))
- {
- flag = true;
- break;
- }
- }
- if (!flag)
- {
- return false;
- }
- }
- if (training.condContract.Count > 0)
- {
- bool flag2 = false;
- for (int k = 0; k < training.condContract.Count; k++)
- {
- if (training.condContract[k] == maid.status.contract)
- {
- flag2 = true;
- break;
- }
- }
- if (!flag2)
- {
- return false;
- }
- }
- if (training.condMaidClass.Count > 0)
- {
- for (int l = 0; l < training.condMaidClass.Count; l++)
- {
- if (!maid.status.jobClass.Contains(training.condMaidClass[l]))
- {
- return false;
- }
- }
- }
- }
- return true;
- }
- public static bool VisibleNightWork(int workId, Maid maid = null, bool checkFinish = true)
- {
- ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[workId];
- switch (yotogi.yotogiType)
- {
- case ScheduleCSVData.YotogiType.Vip:
- case ScheduleCSVData.YotogiType.VipCall:
- {
- NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(workId);
- if (nightWorksState == null)
- {
- return false;
- }
- if (checkFinish && nightWorksState.finish)
- {
- if (DailyMgr.IsLegacy)
- {
- return false;
- }
- if (GameMain.Instance.CharacterMgr.status.clubGrade < 5)
- {
- return false;
- }
- if (GameMain.Instance.CharacterMgr.status.days < ScheduleCSVData.vipFullOpenDay)
- {
- return false;
- }
- }
- break;
- }
- case ScheduleCSVData.YotogiType.Travel:
- return false;
- case ScheduleCSVData.YotogiType.EasyYotogi:
- {
- if (yotogi.easyYotogi == null)
- {
- return false;
- }
- int trophyId = yotogi.easyYotogi.trophyId;
- if (!GameMain.Instance.CharacterMgr.status.IsHaveTrophy(trophyId))
- {
- return false;
- }
- break;
- }
- }
- if (yotogi.condPackage.Count > 0)
- {
- for (int i = 0; i < ScheduleCSVData.YotogiData[workId].condPackage.Count; i++)
- {
- if (!PluginData.IsEnabled(ScheduleCSVData.YotogiData[workId].condPackage[i]))
- {
- return false;
- }
- }
- }
- if (yotogi.condManVisibleFlag1.Count > 0)
- {
- for (int j = 0; j < yotogi.condManVisibleFlag1.Count; j++)
- {
- if (GameMain.Instance.CharacterMgr.status.GetFlag(yotogi.condManVisibleFlag1[j]) < 1)
- {
- return false;
- }
- }
- }
- if (maid != null)
- {
- if (ScheduleCSVData.YotogiData[workId].condMainChara && !maid.status.mainChara)
- {
- return false;
- }
- if (yotogi.condPersonal.Count > 0)
- {
- bool flag = false;
- for (int k = 0; k < yotogi.condPersonal.Count; k++)
- {
- if (maid.status.personal.id == yotogi.condPersonal[k])
- {
- flag = true;
- break;
- }
- }
- if (!flag)
- {
- return false;
- }
- }
- if (yotogi.subMaidUnipueName != string.Empty)
- {
- if (maid.status.heroineType != HeroineType.Sub)
- {
- return false;
- }
- if (yotogi.subMaidUnipueName != maid.status.subCharaData.uniqueName)
- {
- return false;
- }
- }
- else if (maid.status.heroineType == HeroineType.Sub)
- {
- return false;
- }
- }
- return true;
- }
- public static bool EnableNightWork(int workId, Maid maid = null, bool calledTargetCheck = true, bool withMaid = true)
- {
- ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[workId];
- if (yotogi.condPackage.Count > 0)
- {
- for (int i = 0; i < yotogi.condPackage.Count; i++)
- {
- if (!PluginData.IsEnabled(yotogi.condPackage[i]))
- {
- return false;
- }
- }
- }
- if (yotogi.condSalonGrade > GameMain.Instance.CharacterMgr.status.clubGrade)
- {
- return false;
- }
- if (yotogi.easyYotogi != null)
- {
- int trophyId = yotogi.easyYotogi.trophyId;
- if (!GameMain.Instance.CharacterMgr.status.IsHaveTrophy(trophyId))
- {
- return false;
- }
- }
- if (!DailyMgr.IsLegacy && yotogi.mode == ScheduleCSVData.ScheduleBase.Mode.CM3D2)
- {
- return false;
- }
- if (DailyMgr.IsLegacy && yotogi.mode == ScheduleCSVData.ScheduleBase.Mode.COM3D)
- {
- return false;
- }
- if (maid != null)
- {
- if (yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall && calledTargetCheck && !ScheduleAPI.VipCalledMaid(workId, maid))
- {
- return false;
- }
- foreach (KeyValuePair<int, int> keyValuePair in yotogi.condSkill)
- {
- if (!maid.status.yotogiSkill.Contains(keyValuePair.Key))
- {
- return false;
- }
- YotogiSkillData yotogiSkillData = maid.status.yotogiSkill.Get(keyValuePair.Key);
- if (keyValuePair.Value > yotogiSkillData.level)
- {
- return false;
- }
- }
- if (yotogi.condMaidClass.Count > 0)
- {
- for (int j = 0; j < yotogi.condMaidClass.Count; j++)
- {
- if (!maid.status.jobClass.Contains(yotogi.condMaidClass[j]))
- {
- return false;
- }
- }
- }
- if (yotogi.condYotogiClass.Count > 0)
- {
- for (int k = 0; k < yotogi.condYotogiClass.Count; k++)
- {
- if (!maid.status.yotogiClass.Contains(yotogi.condYotogiClass[k]))
- {
- return false;
- }
- }
- }
- if (yotogi.condPropensity.Count > 0)
- {
- bool flag = false;
- for (int l = 0; l < yotogi.condPropensity.Count; l++)
- {
- if (maid.status.propensitys.ContainsKey(yotogi.condPropensity[l]))
- {
- flag = true;
- break;
- }
- }
- if (!flag)
- {
- return false;
- }
- }
- if (yotogi.condSeikeiken.Count > 0)
- {
- bool flag2 = false;
- for (int m = 0; m < yotogi.condSeikeiken.Count; m++)
- {
- if (yotogi.condSeikeiken[m] == maid.status.seikeiken)
- {
- flag2 = true;
- break;
- }
- }
- if (!flag2)
- {
- return false;
- }
- }
- if (yotogi.condFlag1.Count > 0)
- {
- for (int n = 0; n < yotogi.condFlag1.Count; n++)
- {
- if (ScheduleAPI.GetMaidFlag(maid, yotogi.condFlag1[n]) < 1)
- {
- return false;
- }
- }
- }
- if (yotogi.condFlag0.Count > 0)
- {
- for (int num = 0; num < yotogi.condFlag0.Count; num++)
- {
- if (ScheduleAPI.GetMaidFlag(maid, yotogi.condFlag0[num]) > 0)
- {
- return false;
- }
- }
- }
- if (DailyMgr.IsLegacy)
- {
- if (yotogi.condRelationOld.Count > 0)
- {
- bool flag3 = false;
- for (int num2 = 0; num2 < yotogi.condRelationOld.Count; num2++)
- {
- if (yotogi.condRelationOld[num2] == maid.status.OldStatus.relation)
- {
- flag3 = true;
- break;
- }
- }
- if (!flag3)
- {
- return false;
- }
- }
- }
- else
- {
- if (yotogi.condRelation.Count > 0)
- {
- bool flag4 = false;
- for (int num3 = 0; num3 < yotogi.condRelation.Count; num3++)
- {
- if (yotogi.condRelation[num3] == maid.status.relation)
- {
- flag4 = true;
- break;
- }
- }
- if (!flag4)
- {
- return false;
- }
- }
- if (yotogi.condAdditionalRelation.Count > 0)
- {
- bool flag5 = false;
- for (int num4 = 0; num4 < yotogi.condAdditionalRelation.Count; num4++)
- {
- if (yotogi.condAdditionalRelation[num4] == maid.status.additionalRelation)
- {
- flag5 = true;
- break;
- }
- }
- if (!flag5)
- {
- return false;
- }
- }
- if (yotogi.condSpecialRelation.Count > 0)
- {
- bool flag6 = false;
- for (int num5 = 0; num5 < yotogi.condSpecialRelation.Count; num5++)
- {
- if (yotogi.condSpecialRelation[num5] == maid.status.specialRelation)
- {
- flag6 = true;
- break;
- }
- }
- if (!flag6)
- {
- return false;
- }
- }
- }
- if (yotogi.condManFlag1.Count > 0)
- {
- for (int num6 = 0; num6 < yotogi.condManFlag1.Count; num6++)
- {
- if (GameMain.Instance.CharacterMgr.status.GetFlag(yotogi.condManFlag1[num6]) < 1)
- {
- return false;
- }
- }
- }
- if (yotogi.condManFlag0.Count > 0)
- {
- for (int num7 = 0; num7 < yotogi.condManFlag0.Count; num7++)
- {
- if (GameMain.Instance.CharacterMgr.status.GetFlag(yotogi.condManFlag0[num7]) > 0)
- {
- return false;
- }
- }
- }
- if (yotogi.condContract.Count > 0)
- {
- bool flag7 = false;
- for (int num8 = 0; num8 < yotogi.condContract.Count; num8++)
- {
- if (yotogi.condContract[num8] == maid.status.contract)
- {
- flag7 = true;
- break;
- }
- }
- if (!flag7)
- {
- return false;
- }
- }
- if (yotogi.condFacilityID.Count > 0)
- {
- foreach (List<int> list in yotogi.condFacilityID)
- {
- bool flag8 = false;
- foreach (int num9 in list)
- {
- Facility[] facilityArray = GameMain.Instance.FacilityMgr.GetFacilityArray();
- foreach (Facility facility in facilityArray)
- {
- ScheduleMgr.ScheduleTime scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
- if (withMaid)
- {
- if (yotogi.id == maid.status.noonWorkId)
- {
- scheduleTime = ScheduleMgr.ScheduleTime.DayTime;
- }
- else if (yotogi.id == maid.status.nightWorkId)
- {
- scheduleTime = ScheduleMgr.ScheduleTime.Night;
- }
- }
- else
- {
- scheduleTime = ScheduleTaskViewer.ScheduleTime;
- }
- if (!(facility == null) && facility.defaultData.ID == num9)
- {
- if (facility.IsOperation(scheduleTime))
- {
- flag8 = true;
- Maid[] allocationMaidArray = facility.GetAllocationMaidArray(scheduleTime);
- if (allocationMaidArray != null && allocationMaidArray.Length == facility.minMaidCount)
- {
- foreach (Maid y in allocationMaidArray)
- {
- if (maid == y)
- {
- flag8 = false;
- break;
- }
- }
- }
- if (flag8)
- {
- break;
- }
- }
- }
- }
- if (flag8)
- {
- break;
- }
- }
- if (!flag8)
- {
- ScheduleAPI.log("対象の施設が稼動していない");
- return false;
- }
- }
- }
- if (ScheduleCSVData.YotogiData[workId].condMainChara && !maid.status.mainChara)
- {
- return false;
- }
- if (yotogi.condPersonal.Count > 0)
- {
- bool flag9 = false;
- for (int num12 = 0; num12 < yotogi.condPersonal.Count; num12++)
- {
- if (maid.status.personal.id == yotogi.condPersonal[num12])
- {
- flag9 = (!yotogi.isCheckGP002Personal || PluginData.IsEnabledForGP002Personal(maid.status.personal.uniqueName));
- break;
- }
- }
- if (!flag9)
- {
- return false;
- }
- }
- if (yotogi.pairCondPersonal.Count > 0 && ScheduleAPI.GetNewYotogiHaremPairCandidateList(yotogi, yotogi.pairCondPersonal, maid).Count <= 0)
- {
- return false;
- }
- if (yotogi.subMaidUnipueName != string.Empty)
- {
- if (maid.status.heroineType != HeroineType.Sub)
- {
- return false;
- }
- if (yotogi.subMaidUnipueName != maid.status.subCharaData.uniqueName)
- {
- return false;
- }
- return true;
- }
- else
- {
- if (maid.status.heroineType == HeroineType.Sub)
- {
- return false;
- }
- return true;
- }
- bool result;
- return result;
- }
- return true;
- }
- private static int GetMaidFlag(Maid maid, string flagName)
- {
- if (DailyMgr.IsLegacy && maid.status.OldStatus.GetFlag(flagName) != 0)
- {
- return maid.status.OldStatus.GetFlag(flagName);
- }
- return maid.status.GetFlag(flagName);
- }
- public static void NightWorksStateErrorCheck(bool care = true)
- {
- foreach (KeyValuePair<int, ScheduleCSVData.Yotogi> keyValuePair in ScheduleCSVData.YotogiData)
- {
- int key = keyValuePair.Key;
- ScheduleCSVData.Yotogi value = keyValuePair.Value;
- NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(key);
- if (nightWorksState != null)
- {
- if (!nightWorksState.finish)
- {
- bool flag = false;
- if (value.yotogiType == ScheduleCSVData.YotogiType.VipCall)
- {
- string calledMaidGUID = nightWorksState.calledMaidGUID;
- Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(calledMaidGUID);
- if (stockMaid == null)
- {
- flag = true;
- }
- else if (!ScheduleAPI.EnableNightWork(key, stockMaid, false, true))
- {
- flag = true;
- }
- }
- if (flag)
- {
- GameMain.Instance.CharacterMgr.status.RemoveNightWorksState(key);
- }
- }
- }
- }
- if (care)
- {
- ScheduleAPI.MaidWorkIdErrorCheck(care);
- }
- }
- public static void SlotEmptyCheck()
- {
- bool flag = false;
- for (int i = 0; i < 40; i++)
- {
- Maid maid = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (maid != null)
- {
- flag = true;
- break;
- }
- }
- if (!flag)
- {
- if (DailyMgr.IsLegacy)
- {
- for (int j = 0; j < GameMain.Instance.CharacterMgr.GetStockMaidCount(); j++)
- {
- Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(j);
- if (stockMaid != null && stockMaid.status.isCompatiblePersonality)
- {
- GameMain.Instance.CharacterMgr.status.scheduleSlot[0].maid_guid = stockMaid.status.guid;
- break;
- }
- }
- }
- else
- {
- Maid maid = ScheduleAPI.GetStockMaidLeader();
- if (maid != null)
- {
- GameMain.Instance.CharacterMgr.status.scheduleSlot[0].maid_guid = maid.status.guid;
- }
- else
- {
- for (int k = 0; k < GameMain.Instance.CharacterMgr.GetStockMaidCount(); k++)
- {
- Maid stockMaid2 = GameMain.Instance.CharacterMgr.GetStockMaid(k);
- if (stockMaid2 != null)
- {
- GameMain.Instance.CharacterMgr.status.scheduleSlot[0].maid_guid = stockMaid2.status.guid;
- break;
- }
- }
- }
- }
- }
- }
- public static void MaidWorkIdErrorCheck(bool care = true)
- {
- ScheduleAPI.SlotEmptyCheck();
- Maid noonTrainerMaid = ScheduleAPI.GetNoonTrainerMaid();
- Maid nightTrainerMaid = ScheduleAPI.GetNightTrainerMaid();
- Maid noonTraineeMaid = ScheduleAPI.GetNoonTraineeMaid();
- Maid nightTraineeMaid = ScheduleAPI.GetNightTraineeMaid();
- if ((noonTrainerMaid != nightTrainerMaid || noonTraineeMaid != nightTraineeMaid || noonTrainerMaid == null || nightTrainerMaid == null || !ScheduleAPI.CanTrainee(noonTraineeMaid) || !ScheduleAPI.CanTrainee(nightTraineeMaid)) && (noonTrainerMaid != null || nightTrainerMaid != null || noonTraineeMaid != null || nightTraineeMaid != null))
- {
- Debug.Log("MaidWorkIdErrorCheck:メイド研修の条件一致箇所があったためメイド研修をスロットから破棄します。");
- if (noonTrainerMaid != null)
- {
- ScheduleAPI.WorkIdReset(noonTrainerMaid.status, ScheduleMgr.ScheduleTime.DayTime);
- }
- if (nightTrainerMaid != null)
- {
- ScheduleAPI.WorkIdReset(nightTrainerMaid.status, ScheduleMgr.ScheduleTime.Night);
- }
- if (noonTraineeMaid != null)
- {
- ScheduleAPI.WorkIdReset(noonTraineeMaid.status, ScheduleMgr.ScheduleTime.DayTime);
- }
- if (nightTraineeMaid != null)
- {
- ScheduleAPI.WorkIdReset(nightTraineeMaid.status, ScheduleMgr.ScheduleTime.Night);
- }
- }
- int travelWorkId = ScheduleAPI.GetTravelWorkId();
- int nightTravelWorkId = ScheduleAPI.GetNightTravelWorkId();
- Maid maid = null;
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null && (scheduleSlot.status.noonWorkId == travelWorkId || scheduleSlot.status.nightWorkId == nightTravelWorkId))
- {
- if (maid == null && scheduleSlot.status.noonWorkId == travelWorkId && scheduleSlot.status.nightWorkId == nightTravelWorkId)
- {
- maid = scheduleSlot;
- }
- else
- {
- if (scheduleSlot.status.noonWorkId == travelWorkId)
- {
- ScheduleAPI.WorkIdReset(scheduleSlot.status, ScheduleMgr.ScheduleTime.DayTime);
- }
- if (scheduleSlot.status.nightWorkId == nightTravelWorkId)
- {
- ScheduleAPI.WorkIdReset(scheduleSlot.status, ScheduleMgr.ScheduleTime.Night);
- }
- }
- }
- }
- if (maid != null)
- {
- for (int j = 0; j < 40; j++)
- {
- Maid scheduleSlot2 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(j);
- if (scheduleSlot2 != null && scheduleSlot2 != maid && scheduleSlot2.status.nightWorkId != 0 && !ScheduleAPI.CheckNoProblemTravel(scheduleSlot2.status.nightWorkId))
- {
- ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime);
- ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.Night);
- break;
- }
- }
- }
- for (int k = 0; k < 40; k++)
- {
- Maid scheduleSlot3 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(k);
- if (scheduleSlot3 != null)
- {
- ScheduleAPI.MaidWorkIdErrorCheck(scheduleSlot3, care);
- }
- }
- if (maid != null && maid.status.noonWorkId == travelWorkId && maid.status.nightWorkId == nightTravelWorkId)
- {
- int nightEntertainWorkId = ScheduleAPI.GetNightEntertainWorkId();
- int nightRestWorkId = ScheduleAPI.GetNightRestWorkId();
- for (int l = 0; l < 40; l++)
- {
- Maid scheduleSlot4 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(l);
- if (scheduleSlot4 != null && scheduleSlot4 != maid && ScheduleCSVData.YotogiData.ContainsKey(scheduleSlot4.status.nightWorkId) && !ScheduleAPI.CheckNoProblemTravel(scheduleSlot4.status.nightWorkId))
- {
- if (scheduleSlot4.status.contract == Contract.Free)
- {
- scheduleSlot4.status.nightWorkId = nightRestWorkId;
- }
- else
- {
- scheduleSlot4.status.nightWorkId = nightEntertainWorkId;
- }
- }
- }
- }
- }
- private static void MaidWorkIdErrorCheck(Maid maid, bool care = true)
- {
- ScheduleAPI.SlotEmptyCheck();
- ScheduleAPI.CheckTask(maid, ScheduleMgr.ScheduleTime.DayTime, care);
- ScheduleAPI.CheckTask(maid, ScheduleMgr.ScheduleTime.Night, care);
- if (care)
- {
- ScheduleAPI.EmptyToRandomWork(maid);
- }
- }
- private static void CheckTask(Maid maid, ScheduleMgr.ScheduleTime time, bool care)
- {
- int num = 0;
- if (time == ScheduleMgr.ScheduleTime.DayTime)
- {
- num = maid.status.noonWorkId;
- }
- else if (time == ScheduleMgr.ScheduleTime.Night)
- {
- num = maid.status.nightWorkId;
- }
- if (!ScheduleCSVData.AllData.ContainsKey(num))
- {
- return;
- }
- ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[num];
- if ((DailyMgr.IsLegacy && scheduleBase.mode == ScheduleCSVData.ScheduleBase.Mode.COM3D) || (!DailyMgr.IsLegacy && scheduleBase.mode == ScheduleCSVData.ScheduleBase.Mode.CM3D2))
- {
- ScheduleAPI.WorkIdReset(maid.status, time);
- return;
- }
- if (DailyMgr.IsLegacy && ((time == ScheduleMgr.ScheduleTime.DayTime && scheduleBase.type != ScheduleTaskCtrl.TaskType.Training) || (time == ScheduleMgr.ScheduleTime.Night && scheduleBase.type != ScheduleTaskCtrl.TaskType.Yotogi)))
- {
- ScheduleAPI.WorkIdReset(maid.status, time);
- }
- ScheduleTaskCtrl.TaskType type = scheduleBase.type;
- if (type != ScheduleTaskCtrl.TaskType.Training)
- {
- if (type != ScheduleTaskCtrl.TaskType.Yotogi)
- {
- if (type == ScheduleTaskCtrl.TaskType.Work)
- {
- ScheduleAPI.CheckWork(maid, num, care, time);
- }
- }
- else
- {
- ScheduleAPI.CheckYotogi(maid, num, time);
- }
- }
- else
- {
- ScheduleAPI.CheckTraining(maid, num, care, time);
- }
- }
- private static void CheckWork(Maid maid, int taskId, bool care, ScheduleMgr.ScheduleTime time)
- {
- if (ScheduleCSVData.WorkData.ContainsKey(taskId))
- {
- ScheduleCSVData.Work work = ScheduleCSVData.WorkData[taskId];
- if (taskId != ScheduleCSVData.faclilityPowerUpWorkId)
- {
- Facility maidAssignedFacility = GameMain.Instance.FacilityMgr.GetMaidAssignedFacility(maid, time);
- if (maidAssignedFacility == null || maidAssignedFacility.defaultData.workData.id != taskId)
- {
- ScheduleAPI.WorkIdReset(maid.status, time);
- }
- }
- }
- }
- private static void CheckTraining(Maid maid, int taskId, bool care, ScheduleMgr.ScheduleTime time)
- {
- if (ScheduleCSVData.TrainingData.ContainsKey(taskId))
- {
- bool flag = false;
- ScheduleCSVData.Training training = ScheduleCSVData.TrainingData[taskId];
- ScheduleCSVData.TrainingType trainingType = training.trainingType;
- if (trainingType != ScheduleCSVData.TrainingType.Trainer)
- {
- if (trainingType != ScheduleCSVData.TrainingType.Trainee)
- {
- if (trainingType == ScheduleCSVData.TrainingType.Travel)
- {
- if (!flag && !ScheduleAPI.EnableNoonWork(taskId, maid))
- {
- flag = true;
- }
- if (!flag && ScheduleCSVData.YotogiData[maid.status.nightWorkId].yotogiType != ScheduleCSVData.YotogiType.Travel)
- {
- flag = true;
- }
- if (!flag)
- {
- int num = 0;
- while (num < 40 && !flag)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(num);
- if (!(scheduleSlot == maid))
- {
- if (scheduleSlot != null && ScheduleCSVData.YotogiData.ContainsKey(scheduleSlot.status.nightWorkId) && ScheduleCSVData.YotogiData[scheduleSlot.status.nightWorkId].yotogiType != ScheduleCSVData.YotogiType.Entertain && ScheduleCSVData.YotogiData[scheduleSlot.status.nightWorkId].yotogiType != ScheduleCSVData.YotogiType.Rest)
- {
- flag = true;
- }
- }
- num++;
- }
- }
- if (flag)
- {
- ScheduleAPI.EmptyToRandomWork(maid);
- }
- }
- }
- else
- {
- if (!flag && !ScheduleAPI.EnableNoonWork(taskId, maid))
- {
- flag = true;
- }
- if (!flag && maid.status.noonWorkId != maid.status.nightWorkId)
- {
- flag = true;
- }
- if (flag)
- {
- ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime);
- ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.Night);
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot2 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot2 != null && ScheduleCSVData.TrainingData.ContainsKey(scheduleSlot2.status.noonWorkId) && ScheduleCSVData.TrainingData[scheduleSlot2.status.noonWorkId].trainingType == ScheduleCSVData.TrainingType.Trainer)
- {
- ScheduleAPI.WorkIdReset(scheduleSlot2.status, ScheduleMgr.ScheduleTime.DayTime);
- ScheduleAPI.WorkIdReset(scheduleSlot2.status, ScheduleMgr.ScheduleTime.Night);
- if (care)
- {
- ScheduleAPI.EmptyToRandomWork(scheduleSlot2);
- }
- break;
- }
- }
- }
- }
- }
- else
- {
- if (!flag && !ScheduleAPI.EnableNoonWork(taskId, maid))
- {
- flag = true;
- }
- if (!flag && maid.status.noonWorkId != maid.status.nightWorkId)
- {
- flag = true;
- }
- bool flag2 = false;
- for (int j = 0; j < 40; j++)
- {
- Maid scheduleSlot3 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(j);
- if (scheduleSlot3 != null && ScheduleCSVData.TrainingData.ContainsKey(scheduleSlot3.status.noonWorkId))
- {
- ScheduleCSVData.Training training2 = ScheduleCSVData.TrainingData[scheduleSlot3.status.noonWorkId];
- if (training2.trainingType == ScheduleCSVData.TrainingType.Trainee && scheduleSlot3.status.noonWorkId == scheduleSlot3.status.nightWorkId)
- {
- flag2 = true;
- break;
- }
- }
- }
- if (!flag2)
- {
- flag = true;
- }
- if (flag)
- {
- ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime);
- ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.Night);
- if (care)
- {
- ScheduleAPI.EmptyToRandomWork(maid);
- }
- for (int k = 0; k < 40; k++)
- {
- Maid scheduleSlot4 = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(k);
- if (scheduleSlot4 != null && ScheduleCSVData.TrainingData.ContainsKey(scheduleSlot4.status.noonWorkId) && ScheduleCSVData.TrainingData[scheduleSlot4.status.noonWorkId].trainingType == ScheduleCSVData.TrainingType.Trainee)
- {
- ScheduleAPI.WorkIdReset(scheduleSlot4.status, ScheduleMgr.ScheduleTime.DayTime);
- ScheduleAPI.WorkIdReset(scheduleSlot4.status, ScheduleMgr.ScheduleTime.Night);
- if (care)
- {
- ScheduleAPI.EmptyToRandomWork(scheduleSlot4);
- }
- break;
- }
- }
- }
- }
- }
- else
- {
- ScheduleAPI.WorkIdReset(maid.status, ScheduleMgr.ScheduleTime.DayTime);
- }
- }
- private static void CheckYotogi(Maid maid, int taskId, ScheduleMgr.ScheduleTime time)
- {
- if (ScheduleCSVData.YotogiData.ContainsKey(taskId))
- {
- bool flag = false;
- ScheduleCSVData.Yotogi yotogi = ScheduleCSVData.YotogiData[taskId];
- if (!flag && (yotogi.yotogiType == ScheduleCSVData.YotogiType.Vip || yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall))
- {
- if (maid != null)
- {
- if (!ScheduleAPI.VisibleNightWork(taskId, maid, true))
- {
- flag = true;
- }
- }
- else if (!ScheduleAPI.VisibleNightWork(taskId, null, true))
- {
- flag = true;
- }
- }
- if (!flag && (yotogi.yotogiType == ScheduleCSVData.YotogiType.Vip || yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall))
- {
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null && scheduleSlot != maid && (taskId == scheduleSlot.status.noonWorkId || taskId == scheduleSlot.status.nightWorkId))
- {
- flag = true;
- break;
- }
- }
- }
- if (!flag && (yotogi.yotogiType == ScheduleCSVData.YotogiType.Vip || yotogi.yotogiType == ScheduleCSVData.YotogiType.VipCall || yotogi.yotogiType == ScheduleCSVData.YotogiType.Entertain || yotogi.yotogiType == ScheduleCSVData.YotogiType.Travel) && !ScheduleAPI.EnableNightWork(taskId, maid, true, true))
- {
- flag = true;
- }
- if (flag)
- {
- ScheduleAPI.WorkIdReset(maid.status, time);
- }
- }
- else
- {
- ScheduleAPI.WorkIdReset(maid.status, time);
- }
- }
- private static void WorkIdReset(MaidStatus.Status maidStatus, ScheduleMgr.ScheduleTime time)
- {
- if (time == ScheduleMgr.ScheduleTime.DayTime)
- {
- maidStatus.noonWorkId = 0;
- }
- else if (time == ScheduleMgr.ScheduleTime.Night)
- {
- maidStatus.nightWorkId = 0;
- }
- }
- public static void ScheduleErrorAllCheck()
- {
- ScheduleAPI.SlotEmptyCheck();
- ScheduleAPI.NightWorksStateErrorCheck(false);
- ScheduleAPI.MaidWorkIdErrorCheck(false);
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null)
- {
- ScheduleAPI.EmptyToRandomWork(scheduleSlot);
- }
- }
- }
- public static void DayStartManage()
- {
- bool flag = false;
- int travelWorkId = ScheduleAPI.GetTravelWorkId();
- int num = 0;
- while (num < 40 && !flag)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(num);
- if (scheduleSlot != null && scheduleSlot.status.noonWorkId == travelWorkId)
- {
- flag = true;
- }
- num++;
- }
- if (flag)
- {
- ScheduleCSVData.Training training = (ScheduleCSVData.Training)ScheduleCSVData.AllData[travelWorkId];
- foreach (int key in training.needEventItemIdList)
- {
- if (Shop.item_data_dic.ContainsKey(key) && Shop.item_data_dic[key].type == Shop.ItemDataBase.Type.Event)
- {
- Shop.ItemDataEvent itemDataEvent = Shop.item_data_dic[key] as Shop.ItemDataEvent;
- itemDataEvent.Reset();
- }
- }
- }
- if (DailyMgr.IsLegacy)
- {
- GameMain.Instance.CharacterMgr.status.ApplyScheduleSlotBackup(ScheduleSlotBackup.Type.CM3D2);
- }
- else
- {
- GameMain.Instance.CharacterMgr.status.ApplyScheduleSlotBackup(ScheduleSlotBackup.Type.COM3D);
- }
- ScheduleAPI.ErrorCheck();
- GameMain.Instance.CharacterMgr.status.SetFlag("_Schedule_Noon_Resulted", 0);
- GameMain.Instance.CharacterMgr.status.SetFlag("_Schedule_Night_Resulted", 0);
- ScheduleAPI.BackupParam(SCENE_ID.Start);
- }
- public static void ErrorCheck()
- {
- ScheduleAPI.SlotEmptyCheck();
- ScheduleAPI.NightWorksStateErrorCheck(false);
- ScheduleAPI.OccurNightWork();
- ScheduleAPI.MaidWorkIdErrorCheck(false);
- int stockMaidCount = GameMain.Instance.CharacterMgr.GetStockMaidCount();
- for (int i = 0; i < stockMaidCount; i++)
- {
- Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(i);
- ScheduleAPI.EmptyToRandomWork(stockMaid);
- }
- }
- public static void ThroughNoonResult()
- {
- if (GameMain.Instance.CharacterMgr.status.GetFlag("_Schedule_Noon_Resulted") > 0)
- {
- return;
- }
- GameMain.Instance.CharacterMgr.status.SetFlag("_Schedule_Noon_Resulted", 1);
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null)
- {
- GameMain.Instance.CharacterMgr.status.scheduleSlot[i].noon_success_level = ScheduleData.WorkSuccessLv.Miss;
- BackupParamAccessor.BackupParam(new int?(i), SCENE_ID.Morning);
- BackupParamAccessor.BackupParam(new int?(i), SCENE_ID.Noon);
- BackupParamAccessor.BackupParam(new int?(i), SCENE_ID.NoonBonus);
- }
- }
- }
- public static int NoonWorkPlayCount(Maid maid, int workId)
- {
- if (maid.status.workDatas.ContainsKey(workId))
- {
- return (int)maid.status.workDatas.Get(workId).playCount;
- }
- return 0;
- }
- public static int NoonWorkPlayToLv(int noonWorkPlayCount)
- {
- if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv2Exp)
- {
- return 1;
- }
- if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv3Exp)
- {
- return 2;
- }
- return 3;
- }
- public static float NoonWorkPlayExpRatio(int noonWorkPlayCount)
- {
- if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv2Exp)
- {
- return (float)noonWorkPlayCount / (float)ScheduleCSVData.noonWorkLv2Exp;
- }
- if (noonWorkPlayCount < ScheduleCSVData.noonWorkLv3Exp)
- {
- return (float)(noonWorkPlayCount - ScheduleCSVData.noonWorkLv2Exp) / (float)ScheduleCSVData.noonWorkLv3Exp;
- }
- return 0f;
- }
- public static int NoonWorkLvToRevision(int lv)
- {
- return (lv - 1) * 10;
- }
- public static bool EmptyToRandomWork(Maid maid)
- {
- bool result = false;
- if (maid.status.noonWorkId == 0)
- {
- int num = ScheduleAPI.NoonWorkRandom(maid);
- maid.status.noonWorkId = num;
- result = true;
- ScheduleAPI.AddTrainingFacility(maid, num, ScheduleMgr.ScheduleTime.DayTime);
- if (maid.status.heroineType == HeroineType.Sub)
- {
- ScheduleAPI.SubMaidDefaultFacility(maid, num, ScheduleMgr.ScheduleTime.DayTime);
- }
- }
- if (maid.status.nightWorkId == 0)
- {
- int num = ScheduleAPI.NightWorkRandom(maid);
- maid.status.nightWorkId = num;
- result = true;
- ScheduleAPI.AddTrainingFacility(maid, num, ScheduleMgr.ScheduleTime.Night);
- if (maid.status.heroineType == HeroineType.Sub)
- {
- ScheduleAPI.SubMaidDefaultFacility(maid, num, ScheduleMgr.ScheduleTime.Night);
- }
- }
- return result;
- }
- public static int NoonWorkRandom(Maid maid)
- {
- if (maid.status.heroineType == HeroineType.Sub)
- {
- return ScheduleCSVData.subMaidInitTaskId;
- }
- Dictionary<int, int> db;
- if (DailyMgr.IsLegacy)
- {
- db = ScheduleCSVData.NoonWorkInitDataLegacy[maid.status.personal.id];
- }
- else
- {
- db = ScheduleCSVData.NoonWorkInitData[maid.status.personal.id];
- }
- return ScheduleAPI.WorkRandom(db);
- }
- public static int NightWorkRandom(Maid maid)
- {
- if (maid.status.heroineType == HeroineType.Sub)
- {
- return ScheduleCSVData.subMaidInitTaskId;
- }
- Dictionary<int, int> db = ScheduleCSVData.NightWorkInitData[maid.status.personal.id];
- return ScheduleAPI.WorkRandom(db);
- }
- public static void FacilitySlotReset(string maidGuid, ScheduleMgr.ScheduleTime time)
- {
- Maid maid = ScheduleAPI.IsSlotInMaid(maidGuid);
- if (maid == null)
- {
- return;
- }
- if (time == ScheduleMgr.ScheduleTime.DayTime)
- {
- maid.status.noonWorkId = 0;
- }
- else if (time == ScheduleMgr.ScheduleTime.Night)
- {
- maid.status.nightWorkId = 0;
- }
- }
- public static void AddTrainingFacility(Maid maid, int workId, ScheduleMgr.ScheduleTime time)
- {
- if (DailyMgr.IsLegacy)
- {
- return;
- }
- if (!ScheduleCSVData.TrainingData.ContainsKey(workId))
- {
- return;
- }
- ScheduleCSVData.Training training = ScheduleCSVData.TrainingData[workId];
- if (training.trainingType != ScheduleCSVData.TrainingType.Basic)
- {
- return;
- }
- Facility[] facilityArray = GameMain.Instance.FacilityMgr.GetFacilityArray();
- foreach (Facility facility in facilityArray)
- {
- if (!(facility == null))
- {
- if (facility.defaultData.ID == training.facilityId)
- {
- facility.AllocationMaid(maid, time);
- return;
- }
- }
- }
- }
- public static void SubMaidDefaultFacility(Maid maid, int workId, ScheduleMgr.ScheduleTime time)
- {
- if (DailyMgr.IsLegacy || maid.status.heroineType != HeroineType.Sub || !ScheduleCSVData.WorkData.ContainsKey(workId))
- {
- return;
- }
- ScheduleCSVData.Work work = ScheduleCSVData.WorkData[workId];
- Facility[] facilityArray = GameMain.Instance.FacilityMgr.GetFacilityArray();
- foreach (Facility facility in facilityArray)
- {
- if (facility.defaultData.ID == work.facility.ID)
- {
- facility.AllocationMaid(maid, time);
- return;
- }
- }
- }
- public static bool FacilitySlotActive(string maidGuid, Facility facility, ScheduleMgr.ScheduleTime time)
- {
- Maid maid = ScheduleAPI.IsSlotInMaid(maidGuid);
- if (maid == null)
- {
- return false;
- }
- int key = 0;
- if (time == ScheduleMgr.ScheduleTime.DayTime)
- {
- key = maid.status.noonWorkId;
- }
- if (time == ScheduleMgr.ScheduleTime.Night)
- {
- key = maid.status.nightWorkId;
- }
- if (ScheduleCSVData.AllData.ContainsKey(key))
- {
- ScheduleCSVData.ScheduleBase scheduleBase = ScheduleCSVData.AllData[key];
- if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Work)
- {
- ScheduleCSVData.Work work = (ScheduleCSVData.Work)scheduleBase;
- if (work.facility == facility.defaultData && work.facilityId != ScheduleCSVData.faclilityPowerUpWorkId)
- {
- return true;
- }
- }
- else if (scheduleBase.type == ScheduleTaskCtrl.TaskType.Training)
- {
- ScheduleCSVData.Training training = (ScheduleCSVData.Training)scheduleBase;
- if (training.facilityId == facility.defaultData.ID)
- {
- return true;
- }
- }
- }
- return false;
- }
- private static Maid IsSlotInMaid(string maidGuid)
- {
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null && scheduleSlot.status.guid == maidGuid)
- {
- return scheduleSlot;
- }
- }
- return null;
- }
- public static bool CanTrainee(Maid maid)
- {
- if (maid == null)
- {
- return false;
- }
- int num = 0;
- for (int i = 0; i < 40; i++)
- {
- Maid scheduleSlot = GameMain.Instance.CharacterMgr.status.GetScheduleSlot(i);
- if (scheduleSlot != null)
- {
- num++;
- }
- }
- return num >= 3 && maid.status.studyRate >= 50;
- }
- private static int WorkRandom(Dictionary<int, int> db)
- {
- if (db.Count == 0)
- {
- Debug.LogWarning("ScheduleAPI.WorkRandom:傾向情報がありませんでした。0を返します。");
- return 0;
- }
- int num = 0;
- foreach (KeyValuePair<int, int> keyValuePair in db)
- {
- num += keyValuePair.Value;
- }
- int num2 = UnityEngine.Random.Range(0, num);
- foreach (KeyValuePair<int, int> keyValuePair2 in db)
- {
- num2 -= keyValuePair2.Value;
- if (num2 < 0)
- {
- return keyValuePair2.Key;
- }
- }
- Debug.LogWarning("ScheduleAPI.WorkRandom:本来通過するはずの無い箇所です。");
- return 0;
- }
- public static string InfoReplace(int nightWorkId, string info)
- {
- NightWorkState nightWorksState = GameMain.Instance.CharacterMgr.status.GetNightWorksState(nightWorkId);
- if (nightWorksState != null)
- {
- string calledMaidGUID = nightWorksState.calledMaidGUID;
- Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(calledMaidGUID);
- if (stockMaid != null)
- {
- info = info.Replace("[HF]", stockMaid.status.firstName);
- }
- }
- return info;
- }
- private static List<Maid> GetNightWorkMeetMaidList(int workId, bool calledTargetCheck = false)
- {
- List<Maid> list = new List<Maid>();
- int stockMaidCount = GameMain.Instance.CharacterMgr.GetStockMaidCount();
- for (int i = 0; i < stockMaidCount; i++)
- {
- Maid stockMaid = GameMain.Instance.CharacterMgr.GetStockMaid(i);
- if (ScheduleAPI.EnableNightWork(workId, stockMaid, calledTargetCheck, true))
- {
- list.Add(stockMaid);
- }
- }
- return list;
- }
- public static void OccurNightWork()
- {
- foreach (KeyValuePair<int, ScheduleCSVData.Yotogi> keyValuePair in ScheduleCSVData.YotogiData)
- {
- ScheduleCSVData.Yotogi value = keyValuePair.Value;
- ScheduleCSVData.YotogiType yotogiType = value.yotogiType;
- if (yotogiType != ScheduleCSVData.YotogiType.Vip)
- {
- if (yotogiType == ScheduleCSVData.YotogiType.VipCall)
- {
- if (GameMain.Instance.CharacterMgr.status.GetNightWorksState(value.id) == null && ScheduleAPI.EnableNightWork(value.id, null, true, true))
- {
- List<Maid> nightWorkMeetMaidList = ScheduleAPI.GetNightWorkMeetMaidList(value.id, false);
- if (nightWorkMeetMaidList.Count > 0)
- {
- NightWorkState nightWorkState = new NightWorkState();
- nightWorkState.finish = false;
- nightWorkState.workId = keyValuePair.Key;
- int index = UnityEngine.Random.Range(0, nightWorkMeetMaidList.Count - 1);
- nightWorkState.calledMaidGUID = nightWorkMeetMaidList[index].status.guid;
- GameMain.Instance.CharacterMgr.status.AddNightWorksState(nightWorkState);
- }
- }
- }
- }
- else if (GameMain.Instance.CharacterMgr.status.GetNightWorksState(value.id) == null && ScheduleAPI.EnableNightWork(value.id, null, true, true))
- {
- NightWorkState nightWorkState2 = new NightWorkState();
- nightWorkState2.finish = false;
- nightWorkState2.workId = keyValuePair.Key;
- nightWorkState2.calledMaidGUID = null;
- GameMain.Instance.CharacterMgr.status.AddNightWorksState(nightWorkState2);
- }
- }
- }
- public static List<string> logs = new List<string>();
- public static bool logOutput = false;
- public const string NOON_RESULTED_GENERAL_FLAG = "_Schedule_Noon_Resulted";
- public const string NIGHT_RESULTED_GENERAL_FLAG = "_Schedule_Night_Resulted";
- public class TrainingResultSimulateParam
- {
- 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 inyoku;
- public int mvalue;
- public int hentai;
- public int housi;
- public int income;
- public int commandExp;
- }
- public class YotogiResultSimulateParam
- {
- public int income;
- public int evaluation;
- public int playNumber;
- public int otherPlayNumber;
- public int study_rate;
- public int reception;
- public int care;
- public int teach_rate;
- public int inyoku;
- public int mvalue;
- public int hentai;
- public int housi;
- }
- }
- }
|